@cloud-ru/uikit-product-fields-predefined 2.0.2 → 2.0.3-preview-cb2a7557.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +45 -0
  2. package/dist/cjs/components/FieldAi/FieldAi.d.ts +1 -1
  3. package/dist/cjs/components/FieldDescription/FieldDescription.d.ts +1 -1
  4. package/dist/cjs/components/FieldDescription/FieldDescriptionRHF.d.ts +1 -1
  5. package/dist/cjs/components/FieldMask/FieldMask.d.ts +16 -0
  6. package/dist/cjs/components/FieldMask/FieldMask.js +37 -0
  7. package/dist/cjs/components/FieldMask/constants.d.ts +19 -0
  8. package/dist/cjs/components/FieldMask/constants.js +60 -0
  9. package/dist/cjs/components/FieldMask/index.d.ts +3 -0
  10. package/dist/cjs/components/FieldMask/index.js +20 -0
  11. package/dist/cjs/components/FieldMask/types.d.ts +3 -0
  12. package/dist/cjs/components/FieldMask/types.js +2 -0
  13. package/dist/cjs/components/FieldName/FieldName.d.ts +1 -1
  14. package/dist/cjs/components/FieldName/FieldNameRHF.d.ts +1 -1
  15. package/dist/cjs/components/FieldPhone/FieldPhone.d.ts +1 -1
  16. package/dist/cjs/components/index.d.ts +1 -0
  17. package/dist/cjs/components/index.js +1 -0
  18. package/dist/esm/components/FieldAi/FieldAi.d.ts +1 -1
  19. package/dist/esm/components/FieldDescription/FieldDescription.d.ts +1 -1
  20. package/dist/esm/components/FieldDescription/FieldDescriptionRHF.d.ts +1 -1
  21. package/dist/esm/components/FieldMask/FieldMask.d.ts +16 -0
  22. package/dist/esm/components/FieldMask/FieldMask.js +31 -0
  23. package/dist/esm/components/FieldMask/constants.d.ts +19 -0
  24. package/dist/esm/components/FieldMask/constants.js +57 -0
  25. package/dist/esm/components/FieldMask/index.d.ts +3 -0
  26. package/dist/esm/components/FieldMask/index.js +2 -0
  27. package/dist/esm/components/FieldMask/types.d.ts +3 -0
  28. package/dist/esm/components/FieldMask/types.js +1 -0
  29. package/dist/esm/components/FieldName/FieldName.d.ts +1 -1
  30. package/dist/esm/components/FieldName/FieldNameRHF.d.ts +1 -1
  31. package/dist/esm/components/FieldPhone/FieldPhone.d.ts +1 -1
  32. package/dist/esm/components/index.d.ts +1 -0
  33. package/dist/esm/components/index.js +1 -0
  34. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  35. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  36. package/package.json +4 -3
  37. package/src/components/FieldMask/FieldMask.tsx +48 -0
  38. package/src/components/FieldMask/constants.ts +70 -0
  39. package/src/components/FieldMask/index.ts +3 -0
  40. package/src/components/FieldMask/types.ts +5 -0
  41. package/src/components/index.ts +1 -0
package/README.md CHANGED
@@ -306,6 +306,51 @@
306
306
  | addButton | `boolean` | - | Поле появляется по кнопке "Добавить описание" (только для опционального поля) |
307
307
  | ref | `LegacyRef<HTMLInputElement>` | - | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref). @see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom React Docs} |
308
308
  | key | `Key` | - | |
309
+ ## FieldMask
310
+ ### Props
311
+ | name | type | default value | description |
312
+ |------|------|---------------|-------------|
313
+ | layoutType* | enum LayoutType: `"mobile"`, `"tablet"`, `"desktop"`, `"desktopSmall"` | - | |
314
+ | mask* | enum Mask: `"code"`, `"uuid"`, `"passport"`, `"snils"`, `"ip-v4-address"`, `"ip-v4-address-with-mask"` | - | |
315
+ | id | `string` | - | Значение html-атрибута id |
316
+ | name | `string` | - | Значение html-атрибута name |
317
+ | placeholder | `string` | - | Значение плейсхолдера |
318
+ | maxLength | `number` | - | Максимальная длина вводимого значения |
319
+ | disabled | `boolean` | false | Является ли поле деактивированным |
320
+ | readonly | `boolean` | false | Является ли поле доступным только для чтения |
321
+ | onFocus | `FocusEventHandler<HTMLInputElement>` | - | Колбек обработки получения фокуса |
322
+ | onBlur | `FocusEventHandler<HTMLInputElement>` | - | Колбек обработки потери фокуса |
323
+ | autoComplete | `string \| boolean` | false | Включен ли автокомплит для поля |
324
+ | autoFocus | `boolean` | false | Включен ли авто-фокус для поля |
325
+ | onPaste | `ClipboardEventHandler<HTMLInputElement>` | - | Колбек обработки вставки значения |
326
+ | onKeyDown | `KeyboardEventHandler<HTMLInputElement>` | - | Колбек обработки начала нажатия клавиши клавиатуры |
327
+ | spellCheck | `boolean` | true | Значение атрибута spellcheck (проверка орфографии) |
328
+ | pattern | `string` | - | Регулярное выражение валидного инпута |
329
+ | className | `string` | - | CSS-класс |
330
+ | label | `string` | - | Лейбл |
331
+ | labelTooltip | `ReactNode` | - | Всплывающая подсказка лейбла |
332
+ | required | `boolean` | - | Является ли поле обязательным |
333
+ | caption | `string` | - | Подпись справа от лейбла |
334
+ | hint | `string` | - | Подсказка внизу |
335
+ | showHintIcon | `boolean` | - | Отображать иконку подсказки |
336
+ | size | enum Size: `"s"`, `"m"`, `"l"` | - | Размер |
337
+ | validationState | enum ValidationState: `"error"`, `"default"`, `"warning"`, `"success"` | - | Состояние валидации |
338
+ | labelTooltipPlacement | enum Placement: `"left"`, `"left-start"`, `"left-end"`, `"right"`, `"right-start"`, `"right-end"`, `"top"`, `"top-start"`, `"top-end"`, `"bottom"`, `"bottom-start"`, `"bottom-end"` | top | Расположение подсказки лейбла |
339
+ | error | `string` | - | |
340
+ | prefix | `ReactNode` | - | Произвольный префикс для поля |
341
+ | prefixIcon | `ReactElement<any, string \| JSXElementConstructor<any>>` | - | Иконка-префикс для поля |
342
+ | postfix | `ReactNode` | - | Произвольный постфикс для поля |
343
+ | allowMoreThanMaxLength | `boolean` | - | Можно ли вводить больше разрешённого кол-ва символов |
344
+ | button | `Button` | - | Кнопка действия внутри поля |
345
+ | type | "text" \| "tel" \| "email" | - | |
346
+ | showCopyButton | `boolean` | - | Отображение кнопки Копировать для поля (актуально только для `readonly = true`) |
347
+ | onCopyButtonClick | `() => void` | - | Колбек клика по кнопке Копировать для поля |
348
+ | showClearButton | `boolean` | true | Отображение кнопки очистки поля |
349
+ | onClearButtonClick | `() => void` | - | Колбек клика по кнопке очистки поля |
350
+ | value | `string` | - | |
351
+ | onChange | `(value: string, mask: InputMask<Record<string, unknown>>) => void` | - | |
352
+ | ref | `LegacyRef<HTMLInputElement>` | - | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref). @see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom React Docs} |
353
+ | key | `Key` | - | |
309
354
 
310
355
 
311
356
  [//]: DOCUMENTATION_SECTION_END
@@ -20,5 +20,5 @@ export declare const FieldAi: import("react").ForwardRefExoticComponent<Omit<Fie
20
20
  /** Действие для отмены секьюрности поля */
21
21
  onCancelSecure?(): void;
22
22
  } & {
23
- layoutType: import("@cloud-ru/uikit-product-utils").LayoutType;
23
+ layoutType: import("@cloud-ru/uikit-product-utils/.").LayoutType;
24
24
  } & import("react").RefAttributes<HTMLTextAreaElement>>;
@@ -8,5 +8,5 @@ export declare const FieldDescription: import("react").ForwardRefExoticComponent
8
8
  } & {
9
9
  onValidationError?: (error: ValidationError | null) => void;
10
10
  } & {
11
- layoutType: import("@cloud-ru/uikit-product-utils").LayoutType;
11
+ layoutType: import("@cloud-ru/uikit-product-utils/.").LayoutType;
12
12
  } & import("react").RefAttributes<HTMLTextAreaElement>>;
@@ -7,5 +7,5 @@ export declare const FieldDescriptionRHF: import("react").ForwardRefExoticCompon
7
7
  } & {
8
8
  controllerProps: Omit<import("react-hook-form").ControllerProps<import("react-hook-form").FieldValues>, "render" | "rules" | "disabled">;
9
9
  } & {
10
- layoutType: import("@cloud-ru/uikit-product-utils").LayoutType;
10
+ layoutType: import("@cloud-ru/uikit-product-utils/.").LayoutType;
11
11
  } & import("react").RefAttributes<HTMLTextAreaElement>>;
@@ -0,0 +1,16 @@
1
+ import { type InputMask } from 'imask';
2
+ import { FieldTextProps } from '@cloud-ru/uikit-product-mobile-fields';
3
+ import { WithLayoutType } from '@cloud-ru/uikit-product-utils';
4
+ import { Mask } from './types';
5
+ export type FieldMaskProps = WithLayoutType<Omit<FieldTextProps, 'value' | 'onChange' | 'inputMode'> & {
6
+ value?: string;
7
+ onChange?(value: string, mask: InputMask): void;
8
+ mask: Mask;
9
+ }>;
10
+ export declare const FieldMask: import("react").ForwardRefExoticComponent<Omit<FieldTextProps, "onChange" | "value" | "inputMode"> & {
11
+ value?: string;
12
+ onChange?(value: string, mask: InputMask): void;
13
+ mask: Mask;
14
+ } & {
15
+ layoutType: import("@cloud-ru/uikit-product-utils/.").LayoutType;
16
+ } & import("react").RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.FieldMask = void 0;
18
+ const jsx_runtime_1 = require("react/jsx-runtime");
19
+ const merge_refs_1 = __importDefault(require("merge-refs"));
20
+ const react_1 = require("react");
21
+ const react_imask_1 = require("react-imask");
22
+ const uikit_product_mobile_fields_1 = require("@cloud-ru/uikit-product-mobile-fields");
23
+ const constants_1 = require("./constants");
24
+ exports.FieldMask = (0, react_1.forwardRef)((_a, ref) => {
25
+ var _b;
26
+ var { value: valueProp, onChange, mask } = _a, props = __rest(_a, ["value", "onChange", "mask"]);
27
+ const maskOptions = constants_1.MASK_OPTIONS[mask];
28
+ const { ref: maskedRef, value, setValue, } = (0, react_imask_1.useIMask)(Object.assign(Object.assign({}, constants_1.BASE_MASK_OPTIONS), maskOptions.options), {
29
+ defaultValue: valueProp,
30
+ onAccept: onChange,
31
+ });
32
+ return ((0, jsx_runtime_1.jsx)(uikit_product_mobile_fields_1.AdaptiveFieldText
33
+ // @ts-expect-error maskedRef type is not compatible with ref type
34
+ , Object.assign({
35
+ // @ts-expect-error maskedRef type is not compatible with ref type
36
+ ref: (0, merge_refs_1.default)(ref, maskedRef), value: value, onChange: setValue, placeholder: maskOptions.placeholder, inputMode: (_b = maskOptions.inputMode) !== null && _b !== void 0 ? _b : 'numeric' }, props)));
37
+ });
@@ -0,0 +1,19 @@
1
+ import { FieldTextProps } from '@cloud-ru/uikit-product-mobile-fields';
2
+ import { Mask } from './types';
3
+ export declare const MASK: {
4
+ readonly Code: "code";
5
+ readonly Uuid: "uuid";
6
+ readonly Passport: "passport";
7
+ readonly Snils: "snils";
8
+ readonly IpV4Address: "ip-v4-address";
9
+ readonly IpV4AddressWithMask: "ip-v4-address-with-mask";
10
+ };
11
+ export declare const MASK_OPTIONS: Record<Mask, {
12
+ placeholder: string;
13
+ options: Record<string, unknown>;
14
+ inputMode?: FieldTextProps['inputMode'];
15
+ }>;
16
+ export declare const BASE_MASK_OPTIONS: {
17
+ readonly lazy: true;
18
+ readonly autofix: true;
19
+ };
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BASE_MASK_OPTIONS = exports.MASK_OPTIONS = exports.MASK = void 0;
4
+ exports.MASK = {
5
+ Code: 'code',
6
+ Uuid: 'uuid',
7
+ Passport: 'passport',
8
+ Snils: 'snils',
9
+ IpV4Address: 'ip-v4-address',
10
+ IpV4AddressWithMask: 'ip-v4-address-with-mask',
11
+ };
12
+ exports.MASK_OPTIONS = {
13
+ [exports.MASK.Uuid]: {
14
+ placeholder: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
15
+ options: {
16
+ mask: 'hhhhhhhh-hhhh-hhhh-hhhh-hhhhhhhhhhhh',
17
+ placeholderChar: '_',
18
+ definitions: {
19
+ h: /[0-9a-f]/,
20
+ },
21
+ },
22
+ inputMode: 'numeric',
23
+ },
24
+ [exports.MASK.Code]: {
25
+ placeholder: 'XXXX',
26
+ options: {
27
+ mask: '0000',
28
+ placeholderChar: '_',
29
+ },
30
+ inputMode: 'numeric',
31
+ },
32
+ [exports.MASK.Passport]: {
33
+ placeholder: 'XXXX XXXXXX',
34
+ options: {
35
+ mask: '0000 000000',
36
+ },
37
+ inputMode: 'numeric',
38
+ },
39
+ [exports.MASK.Snils]: {
40
+ placeholder: 'XXXXXX-XXX XX',
41
+ options: {
42
+ mask: '000000-000 00',
43
+ },
44
+ inputMode: 'numeric',
45
+ },
46
+ [exports.MASK.IpV4Address]: {
47
+ placeholder: '___.___.___.___',
48
+ options: { mask: '0[00]{.}`0[00]{.}`0[00]{.}`0[00]' },
49
+ inputMode: 'numeric',
50
+ },
51
+ [exports.MASK.IpV4AddressWithMask]: {
52
+ placeholder: '___.___.___.___/__',
53
+ options: { mask: '0[00]{.}`0[00]{.}`0[00]{.}`0[00]{/}`0[0]' },
54
+ inputMode: 'numeric',
55
+ },
56
+ };
57
+ exports.BASE_MASK_OPTIONS = {
58
+ lazy: true,
59
+ autofix: true,
60
+ };
@@ -0,0 +1,3 @@
1
+ export * from './FieldMask';
2
+ export { type Mask } from './types';
3
+ export { MASK } from './constants';
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.MASK = void 0;
18
+ __exportStar(require("./FieldMask"), exports);
19
+ var constants_1 = require("./constants");
20
+ Object.defineProperty(exports, "MASK", { enumerable: true, get: function () { return constants_1.MASK; } });
@@ -0,0 +1,3 @@
1
+ import { ValueOf } from '@snack-uikit/utils';
2
+ import { MASK } from './constants';
3
+ export type Mask = ValueOf<typeof MASK>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -8,5 +8,5 @@ export declare const FieldName: import("react").ForwardRefExoticComponent<Omit<i
8
8
  } & {
9
9
  onValidationError?: (error: ValidationError | null) => void;
10
10
  } & {
11
- layoutType: import("@cloud-ru/uikit-product-utils").LayoutType;
11
+ layoutType: import("@cloud-ru/uikit-product-utils/.").LayoutType;
12
12
  } & import("react").RefAttributes<HTMLInputElement>>;
@@ -7,5 +7,5 @@ export declare const FieldNameRHF: import("react").ForwardRefExoticComponent<Omi
7
7
  } & {
8
8
  controllerProps: Omit<import("react-hook-form").ControllerProps<import("react-hook-form").FieldValues>, "render" | "rules" | "disabled">;
9
9
  } & {
10
- layoutType: import("@cloud-ru/uikit-product-utils").LayoutType;
10
+ layoutType: import("@cloud-ru/uikit-product-utils/.").LayoutType;
11
11
  } & import("react").RefAttributes<HTMLInputElement>>;
@@ -21,5 +21,5 @@ export declare const FieldPhone: import("react").ForwardRefExoticComponent<Omit<
21
21
  /** options — объект конфигурации для изменения стандартного списка стран */
22
22
  options?: CountrySettings;
23
23
  } & {
24
- layoutType: import("@cloud-ru/uikit-product-utils").LayoutType;
24
+ layoutType: import("@cloud-ru/uikit-product-utils/.").LayoutType;
25
25
  } & import("react").RefAttributes<HTMLInputElement>>;
@@ -5,3 +5,4 @@ export * from './FieldChat';
5
5
  export * from './AIDisclaimer';
6
6
  export * from './FieldName';
7
7
  export * from './FieldDescription';
8
+ export * from './FieldMask';
@@ -21,3 +21,4 @@ __exportStar(require("./FieldChat"), exports);
21
21
  __exportStar(require("./AIDisclaimer"), exports);
22
22
  __exportStar(require("./FieldName"), exports);
23
23
  __exportStar(require("./FieldDescription"), exports);
24
+ __exportStar(require("./FieldMask"), exports);
@@ -20,5 +20,5 @@ export declare const FieldAi: import("react").ForwardRefExoticComponent<Omit<Fie
20
20
  /** Действие для отмены секьюрности поля */
21
21
  onCancelSecure?(): void;
22
22
  } & {
23
- layoutType: import("@cloud-ru/uikit-product-utils").LayoutType;
23
+ layoutType: import("@cloud-ru/uikit-product-utils/.").LayoutType;
24
24
  } & import("react").RefAttributes<HTMLTextAreaElement>>;
@@ -8,5 +8,5 @@ export declare const FieldDescription: import("react").ForwardRefExoticComponent
8
8
  } & {
9
9
  onValidationError?: (error: ValidationError | null) => void;
10
10
  } & {
11
- layoutType: import("@cloud-ru/uikit-product-utils").LayoutType;
11
+ layoutType: import("@cloud-ru/uikit-product-utils/.").LayoutType;
12
12
  } & import("react").RefAttributes<HTMLTextAreaElement>>;
@@ -7,5 +7,5 @@ export declare const FieldDescriptionRHF: import("react").ForwardRefExoticCompon
7
7
  } & {
8
8
  controllerProps: Omit<import("react-hook-form").ControllerProps<import("react-hook-form").FieldValues>, "render" | "rules" | "disabled">;
9
9
  } & {
10
- layoutType: import("@cloud-ru/uikit-product-utils").LayoutType;
10
+ layoutType: import("@cloud-ru/uikit-product-utils/.").LayoutType;
11
11
  } & import("react").RefAttributes<HTMLTextAreaElement>>;
@@ -0,0 +1,16 @@
1
+ import { type InputMask } from 'imask';
2
+ import { FieldTextProps } from '@cloud-ru/uikit-product-mobile-fields';
3
+ import { WithLayoutType } from '@cloud-ru/uikit-product-utils';
4
+ import { Mask } from './types';
5
+ export type FieldMaskProps = WithLayoutType<Omit<FieldTextProps, 'value' | 'onChange' | 'inputMode'> & {
6
+ value?: string;
7
+ onChange?(value: string, mask: InputMask): void;
8
+ mask: Mask;
9
+ }>;
10
+ export declare const FieldMask: import("react").ForwardRefExoticComponent<Omit<FieldTextProps, "onChange" | "value" | "inputMode"> & {
11
+ value?: string;
12
+ onChange?(value: string, mask: InputMask): void;
13
+ mask: Mask;
14
+ } & {
15
+ layoutType: import("@cloud-ru/uikit-product-utils/.").LayoutType;
16
+ } & import("react").RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,31 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import mergeRefs from 'merge-refs';
14
+ import { forwardRef } from 'react';
15
+ import { useIMask } from 'react-imask';
16
+ import { AdaptiveFieldText } from '@cloud-ru/uikit-product-mobile-fields';
17
+ import { BASE_MASK_OPTIONS, MASK_OPTIONS } from './constants';
18
+ export const FieldMask = forwardRef((_a, ref) => {
19
+ var _b;
20
+ var { value: valueProp, onChange, mask } = _a, props = __rest(_a, ["value", "onChange", "mask"]);
21
+ const maskOptions = MASK_OPTIONS[mask];
22
+ const { ref: maskedRef, value, setValue, } = useIMask(Object.assign(Object.assign({}, BASE_MASK_OPTIONS), maskOptions.options), {
23
+ defaultValue: valueProp,
24
+ onAccept: onChange,
25
+ });
26
+ return (_jsx(AdaptiveFieldText
27
+ // @ts-expect-error maskedRef type is not compatible with ref type
28
+ , Object.assign({
29
+ // @ts-expect-error maskedRef type is not compatible with ref type
30
+ ref: mergeRefs(ref, maskedRef), value: value, onChange: setValue, placeholder: maskOptions.placeholder, inputMode: (_b = maskOptions.inputMode) !== null && _b !== void 0 ? _b : 'numeric' }, props)));
31
+ });
@@ -0,0 +1,19 @@
1
+ import { FieldTextProps } from '@cloud-ru/uikit-product-mobile-fields';
2
+ import { Mask } from './types';
3
+ export declare const MASK: {
4
+ readonly Code: "code";
5
+ readonly Uuid: "uuid";
6
+ readonly Passport: "passport";
7
+ readonly Snils: "snils";
8
+ readonly IpV4Address: "ip-v4-address";
9
+ readonly IpV4AddressWithMask: "ip-v4-address-with-mask";
10
+ };
11
+ export declare const MASK_OPTIONS: Record<Mask, {
12
+ placeholder: string;
13
+ options: Record<string, unknown>;
14
+ inputMode?: FieldTextProps['inputMode'];
15
+ }>;
16
+ export declare const BASE_MASK_OPTIONS: {
17
+ readonly lazy: true;
18
+ readonly autofix: true;
19
+ };
@@ -0,0 +1,57 @@
1
+ export const MASK = {
2
+ Code: 'code',
3
+ Uuid: 'uuid',
4
+ Passport: 'passport',
5
+ Snils: 'snils',
6
+ IpV4Address: 'ip-v4-address',
7
+ IpV4AddressWithMask: 'ip-v4-address-with-mask',
8
+ };
9
+ export const MASK_OPTIONS = {
10
+ [MASK.Uuid]: {
11
+ placeholder: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
12
+ options: {
13
+ mask: 'hhhhhhhh-hhhh-hhhh-hhhh-hhhhhhhhhhhh',
14
+ placeholderChar: '_',
15
+ definitions: {
16
+ h: /[0-9a-f]/,
17
+ },
18
+ },
19
+ inputMode: 'numeric',
20
+ },
21
+ [MASK.Code]: {
22
+ placeholder: 'XXXX',
23
+ options: {
24
+ mask: '0000',
25
+ placeholderChar: '_',
26
+ },
27
+ inputMode: 'numeric',
28
+ },
29
+ [MASK.Passport]: {
30
+ placeholder: 'XXXX XXXXXX',
31
+ options: {
32
+ mask: '0000 000000',
33
+ },
34
+ inputMode: 'numeric',
35
+ },
36
+ [MASK.Snils]: {
37
+ placeholder: 'XXXXXX-XXX XX',
38
+ options: {
39
+ mask: '000000-000 00',
40
+ },
41
+ inputMode: 'numeric',
42
+ },
43
+ [MASK.IpV4Address]: {
44
+ placeholder: '___.___.___.___',
45
+ options: { mask: '0[00]{.}`0[00]{.}`0[00]{.}`0[00]' },
46
+ inputMode: 'numeric',
47
+ },
48
+ [MASK.IpV4AddressWithMask]: {
49
+ placeholder: '___.___.___.___/__',
50
+ options: { mask: '0[00]{.}`0[00]{.}`0[00]{.}`0[00]{/}`0[0]' },
51
+ inputMode: 'numeric',
52
+ },
53
+ };
54
+ export const BASE_MASK_OPTIONS = {
55
+ lazy: true,
56
+ autofix: true,
57
+ };
@@ -0,0 +1,3 @@
1
+ export * from './FieldMask';
2
+ export { type Mask } from './types';
3
+ export { MASK } from './constants';
@@ -0,0 +1,2 @@
1
+ export * from './FieldMask';
2
+ export { MASK } from './constants';
@@ -0,0 +1,3 @@
1
+ import { ValueOf } from '@snack-uikit/utils';
2
+ import { MASK } from './constants';
3
+ export type Mask = ValueOf<typeof MASK>;
@@ -0,0 +1 @@
1
+ export {};
@@ -8,5 +8,5 @@ export declare const FieldName: import("react").ForwardRefExoticComponent<Omit<i
8
8
  } & {
9
9
  onValidationError?: (error: ValidationError | null) => void;
10
10
  } & {
11
- layoutType: import("@cloud-ru/uikit-product-utils").LayoutType;
11
+ layoutType: import("@cloud-ru/uikit-product-utils/.").LayoutType;
12
12
  } & import("react").RefAttributes<HTMLInputElement>>;
@@ -7,5 +7,5 @@ export declare const FieldNameRHF: import("react").ForwardRefExoticComponent<Omi
7
7
  } & {
8
8
  controllerProps: Omit<import("react-hook-form").ControllerProps<import("react-hook-form").FieldValues>, "render" | "rules" | "disabled">;
9
9
  } & {
10
- layoutType: import("@cloud-ru/uikit-product-utils").LayoutType;
10
+ layoutType: import("@cloud-ru/uikit-product-utils/.").LayoutType;
11
11
  } & import("react").RefAttributes<HTMLInputElement>>;
@@ -21,5 +21,5 @@ export declare const FieldPhone: import("react").ForwardRefExoticComponent<Omit<
21
21
  /** options — объект конфигурации для изменения стандартного списка стран */
22
22
  options?: CountrySettings;
23
23
  } & {
24
- layoutType: import("@cloud-ru/uikit-product-utils").LayoutType;
24
+ layoutType: import("@cloud-ru/uikit-product-utils/.").LayoutType;
25
25
  } & import("react").RefAttributes<HTMLInputElement>>;
@@ -5,3 +5,4 @@ export * from './FieldChat';
5
5
  export * from './AIDisclaimer';
6
6
  export * from './FieldName';
7
7
  export * from './FieldDescription';
8
+ export * from './FieldMask';
@@ -5,3 +5,4 @@ export * from './FieldChat';
5
5
  export * from './AIDisclaimer';
6
6
  export * from './FieldName';
7
7
  export * from './FieldDescription';
8
+ export * from './FieldMask';