@salutejs/plasma-new-hope 0.146.0-canary.1436.10882554984.0 → 0.147.0-canary.1418.10899581491.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. package/cjs/components/Mask/Mask.js +209 -0
  2. package/cjs/components/Mask/Mask.js.map +1 -0
  3. package/cjs/components/Mask/utils/constants.js +33 -0
  4. package/cjs/components/Mask/utils/constants.js.map +1 -0
  5. package/cjs/components/Mask/utils/createMask.js +53 -0
  6. package/cjs/components/Mask/utils/createMask.js.map +1 -0
  7. package/cjs/components/Mask/utils/mask.js +244 -0
  8. package/cjs/components/Mask/utils/mask.js.map +1 -0
  9. package/cjs/components/Mask/utils/parseMask.js +38 -0
  10. package/cjs/components/Mask/utils/parseMask.js.map +1 -0
  11. package/cjs/components/Mask/utils/processInput.js +54 -0
  12. package/cjs/components/Mask/utils/processInput.js.map +1 -0
  13. package/cjs/components/Mask/utils/processMask.js +101 -0
  14. package/cjs/components/Mask/utils/processMask.js.map +1 -0
  15. package/cjs/components/Mask/utils/selection.js +50 -0
  16. package/cjs/components/Mask/utils/selection.js.map +1 -0
  17. package/cjs/components/TextField/TextField.js +3 -1
  18. package/cjs/components/TextField/TextField.js.map +1 -1
  19. package/cjs/index.js +2 -0
  20. package/cjs/index.js.map +1 -1
  21. package/emotion/cjs/components/Mask/Mask.js +220 -0
  22. package/emotion/cjs/components/Mask/Mask.template-doc.mdx +126 -0
  23. package/emotion/cjs/components/Mask/Mask.types.js +5 -0
  24. package/emotion/cjs/components/Mask/index.js +12 -0
  25. package/emotion/cjs/components/Mask/utils/constants.js +29 -0
  26. package/emotion/cjs/components/Mask/utils/createMask.js +50 -0
  27. package/emotion/cjs/components/Mask/utils/mask.js +247 -0
  28. package/emotion/cjs/components/Mask/utils/parseMask.js +36 -0
  29. package/emotion/cjs/components/Mask/utils/processInput.js +52 -0
  30. package/emotion/cjs/components/Mask/utils/processMask.js +99 -0
  31. package/emotion/cjs/components/Mask/utils/selection.js +48 -0
  32. package/emotion/cjs/components/TextField/TextField.js +4 -2
  33. package/emotion/cjs/examples/plasma_b2c/components/Mask/Mask.js +9 -0
  34. package/emotion/cjs/examples/plasma_b2c/components/Mask/Mask.stories.tsx +127 -0
  35. package/emotion/cjs/examples/plasma_web/components/Mask/Mask.js +9 -0
  36. package/emotion/cjs/examples/plasma_web/components/Mask/Mask.stories.tsx +125 -0
  37. package/emotion/cjs/index.js +11 -0
  38. package/emotion/es/components/Mask/Mask.js +212 -0
  39. package/emotion/es/components/Mask/Mask.template-doc.mdx +126 -0
  40. package/emotion/es/components/Mask/Mask.types.js +1 -0
  41. package/emotion/es/components/Mask/index.js +1 -0
  42. package/emotion/es/components/Mask/utils/constants.js +23 -0
  43. package/emotion/es/components/Mask/utils/createMask.js +44 -0
  44. package/emotion/es/components/Mask/utils/mask.js +243 -0
  45. package/emotion/es/components/Mask/utils/parseMask.js +30 -0
  46. package/emotion/es/components/Mask/utils/processInput.js +46 -0
  47. package/emotion/es/components/Mask/utils/processMask.js +93 -0
  48. package/emotion/es/components/Mask/utils/selection.js +42 -0
  49. package/emotion/es/components/TextField/TextField.js +4 -2
  50. package/emotion/es/examples/plasma_b2c/components/Mask/Mask.js +3 -0
  51. package/emotion/es/examples/plasma_b2c/components/Mask/Mask.stories.tsx +127 -0
  52. package/emotion/es/examples/plasma_web/components/Mask/Mask.js +3 -0
  53. package/emotion/es/examples/plasma_web/components/Mask/Mask.stories.tsx +125 -0
  54. package/emotion/es/index.js +2 -1
  55. package/es/components/Mask/Mask.js +205 -0
  56. package/es/components/Mask/Mask.js.map +1 -0
  57. package/es/components/Mask/utils/constants.js +26 -0
  58. package/es/components/Mask/utils/constants.js.map +1 -0
  59. package/es/components/Mask/utils/createMask.js +48 -0
  60. package/es/components/Mask/utils/createMask.js.map +1 -0
  61. package/es/components/Mask/utils/mask.js +240 -0
  62. package/es/components/Mask/utils/mask.js.map +1 -0
  63. package/es/components/Mask/utils/parseMask.js +34 -0
  64. package/es/components/Mask/utils/parseMask.js.map +1 -0
  65. package/es/components/Mask/utils/processInput.js +50 -0
  66. package/es/components/Mask/utils/processInput.js.map +1 -0
  67. package/es/components/Mask/utils/processMask.js +97 -0
  68. package/es/components/Mask/utils/processMask.js.map +1 -0
  69. package/es/components/Mask/utils/selection.js +46 -0
  70. package/es/components/Mask/utils/selection.js.map +1 -0
  71. package/es/components/TextField/TextField.js +3 -1
  72. package/es/components/TextField/TextField.js.map +1 -1
  73. package/es/index.js +1 -0
  74. package/es/index.js.map +1 -1
  75. package/package.json +2 -2
  76. package/styled-components/cjs/components/Mask/Mask.js +220 -0
  77. package/styled-components/cjs/components/Mask/Mask.template-doc.mdx +126 -0
  78. package/styled-components/cjs/components/Mask/Mask.types.js +5 -0
  79. package/styled-components/cjs/components/Mask/index.js +12 -0
  80. package/styled-components/cjs/components/Mask/utils/constants.js +29 -0
  81. package/styled-components/cjs/components/Mask/utils/createMask.js +50 -0
  82. package/styled-components/cjs/components/Mask/utils/mask.js +247 -0
  83. package/styled-components/cjs/components/Mask/utils/parseMask.js +36 -0
  84. package/styled-components/cjs/components/Mask/utils/processInput.js +52 -0
  85. package/styled-components/cjs/components/Mask/utils/processMask.js +99 -0
  86. package/styled-components/cjs/components/Mask/utils/selection.js +48 -0
  87. package/styled-components/cjs/components/TextField/TextField.js +3 -1
  88. package/styled-components/cjs/examples/plasma_b2c/components/Mask/Mask.js +9 -0
  89. package/styled-components/cjs/examples/plasma_b2c/components/Mask/Mask.stories.tsx +127 -0
  90. package/styled-components/cjs/examples/plasma_web/components/Mask/Mask.js +9 -0
  91. package/styled-components/cjs/examples/plasma_web/components/Mask/Mask.stories.tsx +125 -0
  92. package/styled-components/cjs/index.js +11 -0
  93. package/styled-components/es/components/Mask/Mask.js +212 -0
  94. package/styled-components/es/components/Mask/Mask.template-doc.mdx +126 -0
  95. package/styled-components/es/components/Mask/Mask.types.js +1 -0
  96. package/styled-components/es/components/Mask/index.js +1 -0
  97. package/styled-components/es/components/Mask/utils/constants.js +23 -0
  98. package/styled-components/es/components/Mask/utils/createMask.js +44 -0
  99. package/styled-components/es/components/Mask/utils/mask.js +243 -0
  100. package/styled-components/es/components/Mask/utils/parseMask.js +30 -0
  101. package/styled-components/es/components/Mask/utils/processInput.js +46 -0
  102. package/styled-components/es/components/Mask/utils/processMask.js +93 -0
  103. package/styled-components/es/components/Mask/utils/selection.js +42 -0
  104. package/styled-components/es/components/TextField/TextField.js +3 -1
  105. package/styled-components/es/examples/plasma_b2c/components/Mask/Mask.js +3 -0
  106. package/styled-components/es/examples/plasma_b2c/components/Mask/Mask.stories.tsx +127 -0
  107. package/styled-components/es/examples/plasma_web/components/Mask/Mask.js +3 -0
  108. package/styled-components/es/examples/plasma_web/components/Mask/Mask.stories.tsx +125 -0
  109. package/styled-components/es/index.js +2 -1
  110. package/types/components/Mask/Mask.d.ts +5 -0
  111. package/types/components/Mask/Mask.d.ts.map +1 -0
  112. package/types/components/Mask/Mask.types.d.ts +84 -0
  113. package/types/components/Mask/Mask.types.d.ts.map +1 -0
  114. package/types/components/Mask/index.d.ts +2 -0
  115. package/types/components/Mask/index.d.ts.map +1 -0
  116. package/types/components/Mask/utils/constants.d.ts +15 -0
  117. package/types/components/Mask/utils/constants.d.ts.map +1 -0
  118. package/types/components/Mask/utils/createMask.d.ts +19 -0
  119. package/types/components/Mask/utils/createMask.d.ts.map +1 -0
  120. package/types/components/Mask/utils/mask.d.ts +48 -0
  121. package/types/components/Mask/utils/mask.d.ts.map +1 -0
  122. package/types/components/Mask/utils/parseMask.d.ts +3 -0
  123. package/types/components/Mask/utils/parseMask.d.ts.map +1 -0
  124. package/types/components/Mask/utils/processInput.d.ts +13 -0
  125. package/types/components/Mask/utils/processInput.d.ts.map +1 -0
  126. package/types/components/Mask/utils/processMask.d.ts +7 -0
  127. package/types/components/Mask/utils/processMask.d.ts.map +1 -0
  128. package/types/components/Mask/utils/selection.d.ts +10 -0
  129. package/types/components/Mask/utils/selection.d.ts.map +1 -0
  130. package/types/components/TextField/TextField.d.ts.map +1 -1
  131. package/types/examples/plasma_b2c/components/Mask/Mask.d.ts +191 -0
  132. package/types/examples/plasma_b2c/components/Mask/Mask.d.ts.map +1 -0
  133. package/types/examples/plasma_web/components/Mask/Mask.d.ts +191 -0
  134. package/types/examples/plasma_web/components/Mask/Mask.d.ts.map +1 -0
  135. package/types/index.d.ts +1 -0
  136. package/types/index.d.ts.map +1 -1
@@ -0,0 +1,125 @@
1
+ import React from 'react';
2
+ import type { ComponentProps } from 'react';
3
+ import type { StoryObj, Meta } from '@storybook/react';
4
+ import { action } from '@storybook/addon-actions';
5
+
6
+ import { WithTheme } from '../../../_helpers';
7
+
8
+ import { Mask } from './Mask';
9
+
10
+ const onChange = action('onChange');
11
+
12
+ const sizes = ['l', 'm', 's', 'xs'];
13
+ const views = ['default', 'positive', 'warning', 'negative'];
14
+
15
+ const meta: Meta<typeof Mask> = {
16
+ title: 'plasma_web/Mask',
17
+ component: Mask,
18
+ decorators: [WithTheme],
19
+ argTypes: {
20
+ view: {
21
+ options: views,
22
+ control: {
23
+ type: 'select',
24
+ },
25
+ },
26
+ size: {
27
+ options: sizes,
28
+ control: {
29
+ type: 'inline-radio',
30
+ },
31
+ },
32
+ },
33
+ };
34
+
35
+ export default meta;
36
+
37
+ type StoryPropsDefault = Omit<
38
+ ComponentProps<typeof Mask>,
39
+ | 'helperBlock'
40
+ | 'contentLeft'
41
+ | 'htmlSize'
42
+ | 'contentRight'
43
+ | 'type'
44
+ | 'name'
45
+ | 'onFocus'
46
+ | 'onBlur'
47
+ | 'onChange'
48
+ | 'value'
49
+ | 'checked'
50
+ | 'maxLength'
51
+ | 'minLength'
52
+ | 'required'
53
+ | 'enumerationType'
54
+ | 'chips'
55
+ | 'onChangeChips'
56
+ >;
57
+
58
+ const StoryDemo = ({ view, ...rest }: StoryPropsDefault) => {
59
+ return (
60
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '2rem', width: '50%' }}>
61
+ <Mask
62
+ label="Маска телефона"
63
+ mask="+7 (000) 000 - 00 - 00"
64
+ maskChar="_"
65
+ showPrefix={false}
66
+ view={view}
67
+ onChange={onChange}
68
+ {...rest}
69
+ />
70
+
71
+ <Mask
72
+ label="Маска телефона: отображается всегда"
73
+ mask="+7 (000) 000 - 00 - 00"
74
+ maskChar="_"
75
+ view={view}
76
+ alwaysShowMask
77
+ onChange={onChange}
78
+ {...rest}
79
+ />
80
+
81
+ <Mask
82
+ label="Маска даты"
83
+ mask="00/00/0000"
84
+ maskString="DD/MM/YYYY"
85
+ alwaysShowMask
86
+ view={view}
87
+ onChange={onChange}
88
+ {...rest}
89
+ />
90
+
91
+ <Mask
92
+ label="Маска даты: значения по умолчанию"
93
+ // eslint-disable-next-line no-octal-escape
94
+ mask="12.\04.0000"
95
+ maskChar="_"
96
+ alwaysShowMask
97
+ view={view}
98
+ onChange={onChange}
99
+ {...rest}
100
+ />
101
+
102
+ <Mask
103
+ label="Маска времени"
104
+ mask="00:00"
105
+ maskChar="_"
106
+ alwaysShowMask
107
+ view={view}
108
+ onChange={onChange}
109
+ {...rest}
110
+ />
111
+ </div>
112
+ );
113
+ };
114
+
115
+ export const Default: StoryObj<StoryPropsDefault> = {
116
+ args: {
117
+ size: 'l',
118
+ view: 'default',
119
+ labelPlacement: 'outer',
120
+ placeholder: 'Заполните поле',
121
+ disabled: false,
122
+ readOnly: false,
123
+ },
124
+ render: (args) => <StoryDemo {...args} />,
125
+ };
@@ -56,4 +56,5 @@ export * from './components/Portal';
56
56
  export * from './components/Price';
57
57
  export * from './components/Autocomplete';
58
58
  export * from './components/EmptyState';
59
- export * from './components/Editable';
59
+ export * from './components/Editable';
60
+ export * from './components/Mask';
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import type { FC } from 'react';
3
+ import type { MaskProps } from './Mask.types';
4
+ export declare const composeMask: <T extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size">>(InputComponent: React.FC<T>) => React.ForwardRefExoticComponent<React.PropsWithoutRef<T & MaskProps> & React.RefAttributes<HTMLInputElement>>;
5
+ //# sourceMappingURL=Mask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Mask.d.ts","sourceRoot":"","sources":["../../../src/components/Mask/Mask.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAChF,OAAO,KAAK,EAAe,EAAE,EAAmC,MAAM,OAAO,CAAC;AAK9E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAK9C,eAAO,MAAM,WAAW,qNAiOlB,CAAC"}
@@ -0,0 +1,84 @@
1
+ import type { ChangeEvent } from 'react';
2
+ import { charType } from './utils/constants';
3
+ export declare type SelectRange = {
4
+ start: number;
5
+ end: number;
6
+ };
7
+ export declare type MaskInfo = {
8
+ str?: string;
9
+ regexp?: RegExp;
10
+ char?: string;
11
+ };
12
+ export declare type MaskItemsMap = {
13
+ [key: string]: MaskInfo;
14
+ };
15
+ export declare type InputValueInfo = {
16
+ char: string;
17
+ type: typeof charType[keyof typeof charType];
18
+ };
19
+ export declare type InputState = {
20
+ value: Array<InputValueInfo> | string;
21
+ visibleValue: string;
22
+ maskedValue: string;
23
+ selection: SelectRange;
24
+ };
25
+ export declare type ReformatFn = (params: {
26
+ value: Array<InputValueInfo> | string;
27
+ selection: SelectRange;
28
+ input?: string;
29
+ }) => InputState;
30
+ export declare type CreateInputArgs = {
31
+ value: string;
32
+ mask?: string;
33
+ maskChar?: string;
34
+ maskString?: string;
35
+ showPrefix?: boolean;
36
+ reformat?: ReformatFn;
37
+ };
38
+ export declare type MaskProps = {
39
+ /**
40
+ * Маска.
41
+ * Поддерживаются следующие символы:
42
+ * * 0 — любая цифра 0-9
43
+ * * \* — любой символ
44
+ * * a — A-Z, a-z
45
+ * * я — А-Я, а-я, ё, Ё
46
+ * * q — буква "q"
47
+ * * 2 — цифра "2"
48
+ * * \a — "\\" - символ экранирования; "a" - буква
49
+ */
50
+ mask?: string;
51
+ /**
52
+ * Символ маскирования.
53
+ */
54
+ maskChar?: string;
55
+ /**
56
+ * Строка, которая будет отображена в незаполненную часть маски.
57
+ * Если передать maskString, то maskChar игнорируется.
58
+ */
59
+ maskString?: string;
60
+ /**
61
+ * Отображать ли маску во время ввода.
62
+ */
63
+ showMask?: boolean;
64
+ /**
65
+ * Отображать ли маску всегда.
66
+ */
67
+ alwaysShowMask?: boolean;
68
+ /**
69
+ * Отображать ли префикс маски. Например у маски телефона "+7"
70
+ */
71
+ showPrefix?: boolean;
72
+ /**
73
+ * Функция форматирования, которая позволяет задать собственные правила форматирования.
74
+ */
75
+ reformat?: ReformatFn;
76
+ /**
77
+ * Callback при изменении значения маски
78
+ */
79
+ onChange?: (event: ChangeEvent<HTMLInputElement>, params: {
80
+ maskedValue: string;
81
+ value: string;
82
+ }) => void;
83
+ };
84
+ //# sourceMappingURL=Mask.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Mask.types.d.ts","sourceRoot":"","sources":["../../../src/components/Mask/Mask.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,oBAAY,WAAW,GAAG;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,oBAAY,QAAQ,GAAG;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,oBAAY,YAAY,GAAG;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAC;CAC3B,CAAC;AAEF,oBAAY,cAAc,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,QAAQ,CAAC,MAAM,OAAO,QAAQ,CAAC,CAAC;CAChD,CAAC;AAEF,oBAAY,UAAU,GAAG;IACrB,KAAK,EAAE,KAAK,CAAC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0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Mask/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,15 @@
1
+ export declare const charType: {
2
+ readonly User: 1;
3
+ readonly Char: 2;
4
+ readonly Mask: 3;
5
+ };
6
+ export declare const keyboardCode: {
7
+ Backspace: string;
8
+ Delete: string;
9
+ };
10
+ export declare const escapeChar = "\\";
11
+ export declare const defaultFormatChars: {
12
+ str: string;
13
+ regexp: RegExp;
14
+ }[];
15
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/components/Mask/utils/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ;;;;CAIX,CAAC;AAEX,eAAO,MAAM,YAAY;;;CAGxB,CAAC;AAEF,eAAO,MAAM,UAAU,OAAO,CAAC;AAE/B,eAAO,MAAM,kBAAkB;;;GAiB9B,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { CreateInputArgs, InputValueInfo } from '../Mask.types';
2
+ import { Mask } from './mask';
3
+ export declare const defaults: {
4
+ maskFormat: {
5
+ str: string;
6
+ regexp: RegExp;
7
+ }[];
8
+ maskChar: string;
9
+ showMask: boolean;
10
+ removeSelectedRange: (args: {
11
+ value: InputValueInfo[];
12
+ selection: import("../Mask.types").SelectRange;
13
+ maskChar: string;
14
+ maskString: string;
15
+ }) => InputValueInfo[];
16
+ showPrefix: boolean;
17
+ };
18
+ export declare const createMask: (params: CreateInputArgs) => Mask;
19
+ //# sourceMappingURL=createMask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createMask.d.ts","sourceRoot":"","sources":["../../../../src/components/Mask/utils/createMask.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAGrE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAG9B,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;CAMpB,CAAC;AAEF,eAAO,MAAM,UAAU,WAAY,eAAe,KAAG,IA+BpD,CAAC"}
@@ -0,0 +1,48 @@
1
+ import type { InputState, InputValueInfo, ReformatFn, MaskInfo, MaskItemsMap, SelectRange } from '../Mask.types';
2
+ /**
3
+ * Copyright (c) 2018 Nikita Mostovoy.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ export declare class Mask {
9
+ selection: SelectRange;
10
+ value: Array<InputValueInfo> | string;
11
+ maskedValue: string;
12
+ visibleValue: string;
13
+ mask: Array<MaskInfo>;
14
+ maskChar: string;
15
+ maskFormatMap: MaskItemsMap;
16
+ showPrefix: boolean;
17
+ callbacks: Array<(state: InputState) => any>;
18
+ maskString?: string;
19
+ reformat?: ReformatFn;
20
+ constructor(showPrefix: boolean, maskChar: string, maskString?: string, reformat?: ReformatFn);
21
+ private get parseMaskFormat();
22
+ get getSelection(): {
23
+ start: number;
24
+ end: number;
25
+ };
26
+ get getState(): {
27
+ value: string | InputValueInfo[];
28
+ maskedValue: string;
29
+ visibleValue: string;
30
+ selection: SelectRange;
31
+ };
32
+ set setSelection(newSelection: SelectRange);
33
+ set setShowStartChars(show: boolean);
34
+ updateMask(newMask?: string): void;
35
+ updateMaskChar(newMaskChar: string): void;
36
+ updateMaskString(newMaskString: string): void;
37
+ updateReformat(newReformat: ReformatFn): void;
38
+ updateValue(data: string | Array<InputValueInfo>): void;
39
+ removePreviousOrSelected(): void;
40
+ removeNextOrSelected(): void;
41
+ paste(value: string): void;
42
+ input(input: string): void;
43
+ applyChanges(result: InputState): void;
44
+ subscribe(callback: (state: InputState) => any): void;
45
+ unsubscribe(callback: (state: InputState) => any): void;
46
+ notify(): void;
47
+ }
48
+ //# sourceMappingURL=mask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mask.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AC,KAAK,EAAE,MAAM;IAInB,KAAK,CAAC,KAAK,EAAE,MAAM;IA6BnB,YAAY,CAAC,MAAM,EAAE,UAAU;IAoB/B,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,GAAG;IAI9C,WAAW,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,GAAG;IAIhD,MAAM;CAMT"}
@@ -0,0 +1,3 @@
1
+ import type { MaskInfo, MaskItemsMap } from '../Mask.types';
2
+ export declare const parseMask: (mask?: string | undefined, format?: MaskItemsMap | undefined) => Array<MaskInfo>;
3
+ //# sourceMappingURL=parseMask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseMask.d.ts","sourceRoot":"","sources":["../../../../src/components/Mask/utils/parseMask.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAI5D,eAAO,MAAM,SAAS,oEAA2C,MAAM,QAAQ,CAoC9E,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { InputState, InputValueInfo, MaskInfo, SelectRange } from '../Mask.types';
2
+ declare type ProcessInputArgs = {
3
+ data: Array<InputValueInfo>;
4
+ selection: SelectRange;
5
+ mask: Array<MaskInfo>;
6
+ maskChar?: string;
7
+ maskString?: string;
8
+ showPrefix?: boolean;
9
+ input?: string;
10
+ };
11
+ export declare const processInput: (args: ProcessInputArgs) => InputState;
12
+ export {};
13
+ //# sourceMappingURL=processInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"processInput.d.ts","sourceRoot":"","sources":["../../../../src/components/Mask/utils/processInput.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAKvF,aAAK,gBAAgB,GAAG;IACpB,IAAI,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IAC5B,SAAS,EAAE,WAAW,CAAC;IACvB,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,YAAY,SAAU,gBAAgB,KAAG,UAoCrD,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { MaskInfo, SelectRange, InputValueInfo } from '../Mask.types';
2
+ export declare const processMask: (data: Array<InputValueInfo>, mask: Array<MaskInfo>, input: string, maskChar: string, maskString: string, selection: SelectRange) => {
3
+ value: InputValueInfo[];
4
+ maskedValue: string;
5
+ inputValuesApplied: number;
6
+ };
7
+ //# sourceMappingURL=processMask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"processMask.d.ts","sourceRoot":"","sources":["../../../../src/components/Mask/utils/processMask.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAI3E,eAAO,MAAM,WAAW,SACd,MAAM,cAAc,CAAC,QACrB,MAAM,QAAQ,CAAC,SACd,MAAM,YACH,MAAM,cACJ,MAAM,aACP,WAAW;;;;CAqHzB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { InputValueInfo, SelectRange } from '../Mask.types';
2
+ declare type RemoveSelectionRangeArgs = {
3
+ value: Array<InputValueInfo>;
4
+ selection: SelectRange;
5
+ maskChar: string;
6
+ maskString: string;
7
+ };
8
+ export declare const removeSelectedRange: (args: RemoveSelectionRangeArgs) => Array<InputValueInfo>;
9
+ export {};
10
+ //# sourceMappingURL=selection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selection.d.ts","sourceRoot":"","sources":["../../../../src/components/Mask/utils/selection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAIjE,aAAK,wBAAwB,GAAG;IAC5B,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IAC7B,SAAS,EAAE,WAAW,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACtB,CAAC;AA4BF,eAAO,MAAM,mBAAmB,SAAU,wBAAwB,KAAG,MAAM,cAAc,CAoBxF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../src/components/TextField/TextField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAKvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG/C,OAAO,KAAK,EAAuC,cAAc,EAAE,MAAM,mBAAmB,CAAC;AA4B7F,eAAO,MAAM,IAAI,0CAGhB,CAAC;AAEF,eAAO,MAAM,aAAa,SAAU,UAAU,cAAc,EAAE,cAAc,CAAC,4FA8QxE,CAAC;AAEN,eAAO,MAAM,eAAe;;;mBAhRQ,UAAU,cAAc,EAAE,cAAc,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;CA4S5E,CAAC"}
1
+ {"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../src/components/TextField/TextField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAKvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG/C,OAAO,KAAK,EAAuC,cAAc,EAAE,MAAM,mBAAmB,CAAC;AA4B7F,eAAO,MAAM,IAAI,0CAGhB,CAAC;AAEF,eAAO,MAAM,aAAa,SAAU,UAAU,cAAc,EAAE,cAAc,CAAC,4FAiRxE,CAAC;AAEN,eAAO,MAAM,eAAe;;;mBAnRQ,UAAU,cAAc,EAAE,cAAc,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;CA+S5E,CAAC"}
@@ -0,0 +1,191 @@
1
+ /// <reference types="react" />
2
+ export declare const Mask: import("react").ForwardRefExoticComponent<(Omit<import("../../../../engines/types").PropsType<{
3
+ view: {
4
+ default: import("@linaria/core").LinariaClassName;
5
+ positive: import("@linaria/core").LinariaClassName;
6
+ warning: import("@linaria/core").LinariaClassName;
7
+ negative: import("@linaria/core").LinariaClassName;
8
+ };
9
+ size: {
10
+ l: import("@linaria/core").LinariaClassName;
11
+ m: import("@linaria/core").LinariaClassName;
12
+ s: import("@linaria/core").LinariaClassName;
13
+ xs: import("@linaria/core").LinariaClassName;
14
+ };
15
+ labelPlacement: {
16
+ inner: import("@linaria/core").LinariaClassName;
17
+ outer: import("@linaria/core").LinariaClassName;
18
+ };
19
+ disabled: {
20
+ true: import("@linaria/core").LinariaClassName;
21
+ };
22
+ readOnly: {
23
+ true: import("@linaria/core").LinariaClassName;
24
+ };
25
+ }> & {
26
+ size?: string | undefined;
27
+ view?: string | undefined;
28
+ readOnly?: boolean | undefined;
29
+ disabled?: boolean | undefined;
30
+ } & {
31
+ label?: string | undefined;
32
+ labelPlacement?: "inner" | "outer" | undefined;
33
+ leftHelper?: string | undefined;
34
+ contentLeft?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
35
+ contentRight?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
36
+ textBefore?: string | undefined;
37
+ textAfter?: string | undefined;
38
+ onSearch?: ((value: string, event?: import("react").KeyboardEvent<HTMLInputElement> | undefined) => void) | undefined;
39
+ } & {
40
+ requiredPlacement?: "left" | "right" | undefined;
41
+ } & {
42
+ required: true;
43
+ optional?: false | undefined;
44
+ } & {
45
+ chips?: undefined;
46
+ onChangeChips?: undefined;
47
+ enumerationType?: "plain" | undefined;
48
+ onSearch?: ((value: string, event?: import("react").KeyboardEvent<HTMLInputElement> | undefined) => void) | undefined;
49
+ } & Omit<import("../../../../types").InputHTMLAttributes<HTMLInputElement>, "required" | "size"> & import("react").RefAttributes<HTMLInputElement> & import("../../../../components/Mask/Mask.types").MaskProps, "ref"> | Omit<import("../../../../engines/types").PropsType<{
50
+ view: {
51
+ default: import("@linaria/core").LinariaClassName;
52
+ positive: import("@linaria/core").LinariaClassName;
53
+ warning: import("@linaria/core").LinariaClassName;
54
+ negative: import("@linaria/core").LinariaClassName;
55
+ };
56
+ size: {
57
+ l: import("@linaria/core").LinariaClassName;
58
+ m: import("@linaria/core").LinariaClassName;
59
+ s: import("@linaria/core").LinariaClassName;
60
+ xs: import("@linaria/core").LinariaClassName;
61
+ };
62
+ labelPlacement: {
63
+ inner: import("@linaria/core").LinariaClassName;
64
+ outer: import("@linaria/core").LinariaClassName;
65
+ };
66
+ disabled: {
67
+ true: import("@linaria/core").LinariaClassName;
68
+ };
69
+ readOnly: {
70
+ true: import("@linaria/core").LinariaClassName;
71
+ };
72
+ }> & {
73
+ size?: string | undefined;
74
+ view?: string | undefined;
75
+ readOnly?: boolean | undefined;
76
+ disabled?: boolean | undefined;
77
+ } & {
78
+ label?: string | undefined;
79
+ labelPlacement?: "inner" | "outer" | undefined;
80
+ leftHelper?: string | undefined;
81
+ contentLeft?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
82
+ contentRight?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
83
+ textBefore?: string | undefined;
84
+ textAfter?: string | undefined;
85
+ onSearch?: ((value: string, event?: import("react").KeyboardEvent<HTMLInputElement> | undefined) => void) | undefined;
86
+ } & {
87
+ requiredPlacement?: "left" | "right" | undefined;
88
+ } & {
89
+ required: true;
90
+ optional?: false | undefined;
91
+ } & {
92
+ enumerationType: "chip";
93
+ onSearch?: undefined;
94
+ chips?: import("../../../../components/TextField/TextField.types").TextFieldPrimitiveValue[] | undefined;
95
+ onChangeChips?: ((value: import("../../../../components/TextField/TextField.types").TextFieldPrimitiveValue[]) => void) | undefined;
96
+ } & Omit<import("../../../../types").InputHTMLAttributes<HTMLInputElement>, "required" | "size"> & import("react").RefAttributes<HTMLInputElement> & import("../../../../components/Mask/Mask.types").MaskProps, "ref"> | Omit<import("../../../../engines/types").PropsType<{
97
+ view: {
98
+ default: import("@linaria/core").LinariaClassName;
99
+ positive: import("@linaria/core").LinariaClassName;
100
+ warning: import("@linaria/core").LinariaClassName;
101
+ negative: import("@linaria/core").LinariaClassName;
102
+ };
103
+ size: {
104
+ l: import("@linaria/core").LinariaClassName;
105
+ m: import("@linaria/core").LinariaClassName;
106
+ s: import("@linaria/core").LinariaClassName;
107
+ xs: import("@linaria/core").LinariaClassName;
108
+ };
109
+ labelPlacement: {
110
+ inner: import("@linaria/core").LinariaClassName;
111
+ outer: import("@linaria/core").LinariaClassName;
112
+ };
113
+ disabled: {
114
+ true: import("@linaria/core").LinariaClassName;
115
+ };
116
+ readOnly: {
117
+ true: import("@linaria/core").LinariaClassName;
118
+ };
119
+ }> & {
120
+ size?: string | undefined;
121
+ view?: string | undefined;
122
+ readOnly?: boolean | undefined;
123
+ disabled?: boolean | undefined;
124
+ } & {
125
+ label?: string | undefined;
126
+ labelPlacement?: "inner" | "outer" | undefined;
127
+ leftHelper?: string | undefined;
128
+ contentLeft?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
129
+ contentRight?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
130
+ textBefore?: string | undefined;
131
+ textAfter?: string | undefined;
132
+ onSearch?: ((value: string, event?: import("react").KeyboardEvent<HTMLInputElement> | undefined) => void) | undefined;
133
+ } & {
134
+ requiredPlacement?: "left" | "right" | undefined;
135
+ } & {
136
+ optional?: true | undefined;
137
+ required?: false | undefined;
138
+ } & {
139
+ chips?: undefined;
140
+ onChangeChips?: undefined;
141
+ enumerationType?: "plain" | undefined;
142
+ onSearch?: ((value: string, event?: import("react").KeyboardEvent<HTMLInputElement> | undefined) => void) | undefined;
143
+ } & Omit<import("../../../../types").InputHTMLAttributes<HTMLInputElement>, "required" | "size"> & import("react").RefAttributes<HTMLInputElement> & import("../../../../components/Mask/Mask.types").MaskProps, "ref"> | Omit<import("../../../../engines/types").PropsType<{
144
+ view: {
145
+ default: import("@linaria/core").LinariaClassName;
146
+ positive: import("@linaria/core").LinariaClassName;
147
+ warning: import("@linaria/core").LinariaClassName;
148
+ negative: import("@linaria/core").LinariaClassName;
149
+ };
150
+ size: {
151
+ l: import("@linaria/core").LinariaClassName;
152
+ m: import("@linaria/core").LinariaClassName;
153
+ s: import("@linaria/core").LinariaClassName;
154
+ xs: import("@linaria/core").LinariaClassName;
155
+ };
156
+ labelPlacement: {
157
+ inner: import("@linaria/core").LinariaClassName;
158
+ outer: import("@linaria/core").LinariaClassName;
159
+ };
160
+ disabled: {
161
+ true: import("@linaria/core").LinariaClassName;
162
+ };
163
+ readOnly: {
164
+ true: import("@linaria/core").LinariaClassName;
165
+ };
166
+ }> & {
167
+ size?: string | undefined;
168
+ view?: string | undefined;
169
+ readOnly?: boolean | undefined;
170
+ disabled?: boolean | undefined;
171
+ } & {
172
+ label?: string | undefined;
173
+ labelPlacement?: "inner" | "outer" | undefined;
174
+ leftHelper?: string | undefined;
175
+ contentLeft?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
176
+ contentRight?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
177
+ textBefore?: string | undefined;
178
+ textAfter?: string | undefined;
179
+ onSearch?: ((value: string, event?: import("react").KeyboardEvent<HTMLInputElement> | undefined) => void) | undefined;
180
+ } & {
181
+ requiredPlacement?: "left" | "right" | undefined;
182
+ } & {
183
+ optional?: true | undefined;
184
+ required?: false | undefined;
185
+ } & {
186
+ enumerationType: "chip";
187
+ onSearch?: undefined;
188
+ chips?: import("../../../../components/TextField/TextField.types").TextFieldPrimitiveValue[] | undefined;
189
+ onChangeChips?: ((value: import("../../../../components/TextField/TextField.types").TextFieldPrimitiveValue[]) => void) | undefined;
190
+ } & Omit<import("../../../../types").InputHTMLAttributes<HTMLInputElement>, "required" | "size"> & import("react").RefAttributes<HTMLInputElement> & import("../../../../components/Mask/Mask.types").MaskProps, "ref">) & import("react").RefAttributes<HTMLInputElement>>;
191
+ //# sourceMappingURL=Mask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Mask.d.ts","sourceRoot":"","sources":["../../../../../src/examples/plasma_b2c/components/Mask/Mask.ts"],"names":[],"mappings":";AAGA,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2QAAyB,CAAC"}