![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
antd-mask-input
Advanced tools
Readme
An Ant Design Input component for <input>
masking, built on top of imask.
The version 2.0.0 Requires antd >= 4.19.0 - for previous versions use the version
0.1.15
npm install antd-mask-input --save
stories.add('Phone', () => (
<>
<MaskedInput
mask={
// https://imask.js.org/guide.html#masked-pattern
'+55(00)0000-0000'
}
/>
</>
));
stories.add('AMEX', () => (
<>
<MaskedInput mask={'0000 000000 00000'} />
</>
));
const DynamicPhone = (props: any) => {
const cellphoneMask = '(00) 0 0000-0000';
const phoneMask = '(00) 0000-0000';
// always memoize dynamic masks
const mask = React.useMemo(
() => [
{
mask: cellphoneMask,
lazy: false,
},
{
mask: phoneMask,
lazy: false,
},
],
[]
);
return (
<MaskedInput
{...props}
mask={mask}
maskOptions={{
dispatch: function (appended, dynamicMasked) {
const isCellPhone = dynamicMasked.unmaskedValue[2] === '9';
return dynamicMasked.compiledMasks[isCellPhone ? 0 : 1];
},
}}
/>
);
};
stories.add('Dynamic Mask', () => <DynamicPhone />);
stories.add('RGB', () => {
const mask = React.useMemo<MaskType>(() => {
return [
{
mask: 'RGB,RGB,RGB',
blocks: {
RGB: {
mask: IMask.MaskedRange,
from: 0,
to: 255,
},
},
},
{
mask: /^#[0-9a-f]{0,6}$/i,
},
];
}, []);
return (
<>
<MaskedInput mask={mask} />
</>
);
});
// https://imask.js.org/guide.html#masked-pattern
const DUMB_IP_MASK = '0[0][0].0[0][0].0[0][0].0[0][0]';
stories.add('IP', () => (
<MaskedInput
mask={DUMB_IP_MASK}
value="192.16.1.5" //
/>
));
window.formRef = {};
stories.add('Form', () => (
<Form ref={(val) => (window.formRef = val)}>
<Form.Item
label="Username"
name="username"
initialValue={'123'}
rules={[{ required: true, message: 'Please input your username!' }]}
>
<DynamicPhone />
</Form.Item>
<button>Go</button>
</Form>
));
mask
type MaskType = string | RegExp | Date | Number; // See the https://imask.js.org/guide.html
onChange
onChange: (
event: SyntheticEvent & { maskedValue: string; unmaskedValue: string }
) => any;
maskOptions
:see the type InputMaskOptions
See Ant Design Input
See Imask options.
Note that this package is not intended to be fully compatible with imask, but the options are almost the same.
FAQs
Ant Design Mask Input
The npm package antd-mask-input receives a total of 15,285 weekly downloads. As such, antd-mask-input popularity was classified as popular.
We found that antd-mask-input demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.