@salutejs/plasma-new-hope 0.72.0-canary.1160.8612911363.0 → 0.72.0-canary.1160.8617165473.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.
- package/cjs/components/Cell/Cell.js +2 -0
- package/cjs/components/Cell/Cell.js.map +1 -1
- package/cjs/components/TextField/TextField.js +5 -5
- package/cjs/components/TextField/TextField.js.map +1 -1
- package/cjs/components/TextField/hooks/useKeyNavigation.js +5 -4
- package/cjs/components/TextField/hooks/useKeyNavigation.js.map +1 -1
- package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js +3 -3
- package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js.map +1 -1
- package/es/components/Cell/Cell.js +2 -0
- package/es/components/Cell/Cell.js.map +1 -1
- package/es/components/TextField/TextField.js +5 -5
- package/es/components/TextField/TextField.js.map +1 -1
- package/es/components/TextField/hooks/useKeyNavigation.js +5 -4
- package/es/components/TextField/hooks/useKeyNavigation.js.map +1 -1
- package/es/components/TextField/ui/TextFieldChip/TextFieldChip.js +3 -3
- package/es/components/TextField/ui/TextFieldChip/TextFieldChip.js.map +1 -1
- package/package.json +2 -2
- package/styled-components/cjs/components/Cell/Cell.js +2 -0
- package/styled-components/cjs/components/TextField/TextField.js +5 -5
- package/styled-components/cjs/components/TextField/hooks/useKeyNavigation.js +5 -4
- package/styled-components/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js +3 -3
- package/styled-components/cjs/examples/plasma_b2c/components/TextField/TextField.stories.tsx +60 -12
- package/styled-components/cjs/examples/plasma_web/components/TextField/TextField.stories.tsx +60 -12
- package/styled-components/cjs/examples/sds_engineer/components/TextField/TextField.stories.tsx +60 -12
- package/styled-components/es/components/Cell/Cell.js +2 -0
- package/styled-components/es/components/TextField/TextField.js +5 -5
- package/styled-components/es/components/TextField/hooks/useKeyNavigation.js +5 -4
- package/styled-components/es/components/TextField/ui/TextFieldChip/TextFieldChip.js +3 -3
- package/styled-components/es/examples/plasma_b2c/components/TextField/TextField.stories.tsx +60 -12
- package/styled-components/es/examples/plasma_web/components/TextField/TextField.stories.tsx +60 -12
- package/styled-components/es/examples/sds_engineer/components/TextField/TextField.stories.tsx +60 -12
- package/types/components/Cell/Cell.d.ts.map +1 -1
- package/types/components/TextField/TextField.types.d.ts +42 -19
- package/types/components/TextField/TextField.types.d.ts.map +1 -1
- package/types/components/TextField/hooks/useKeyNavigation.d.ts +2 -2
- package/types/components/TextField/hooks/useKeyNavigation.d.ts.map +1 -1
- package/types/components/TextField/ui/TextFieldChip/TextFieldChip.types.d.ts +1 -1
- package/types/components/TextField/ui/TextFieldChip/TextFieldChip.types.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/TextField/TextField.d.ts +35 -1
- package/types/examples/plasma_b2c/components/TextField/TextField.d.ts.map +1 -1
- package/types/examples/plasma_web/components/TextField/TextField.d.ts +35 -1
- package/types/examples/plasma_web/components/TextField/TextField.d.ts.map +1 -1
- package/types/examples/sds_engineer/components/TextField/TextField.d.ts +35 -1
- package/types/examples/sds_engineer/components/TextField/TextField.d.ts.map +1 -1
@@ -68,7 +68,7 @@ export var useKeyNavigation = function useKeyNavigation(_ref) {
|
|
68
68
|
updateChips(_newChips, _newValues);
|
69
69
|
}
|
70
70
|
};
|
71
|
-
var onChipClear = function onChipClear(clearId) {
|
71
|
+
var onChipClear = function onChipClear(clearId, index) {
|
72
72
|
if (!chips.length) {
|
73
73
|
return;
|
74
74
|
}
|
@@ -80,19 +80,20 @@ export var useKeyNavigation = function useKeyNavigation(_ref) {
|
|
80
80
|
var text = _ref6.text;
|
81
81
|
return text;
|
82
82
|
});
|
83
|
+
chipsRefs === null || chipsRefs === void 0 ? void 0 : chipsRefs.current.splice(index, 1);
|
83
84
|
updateChips(newChips, newValues);
|
84
85
|
};
|
85
|
-
var handleChipKeyDown = function handleChipKeyDown(event, chipId) {
|
86
|
+
var handleChipKeyDown = function handleChipKeyDown(event, chipId, chipIndex) {
|
86
87
|
if (event.key === Keys.Tab) {
|
87
88
|
event.preventDefault();
|
88
89
|
}
|
89
90
|
if (event.key === Keys.Backspace) {
|
90
|
-
onChipClear(chipId);
|
91
|
+
onChipClear(chipId, chipIndex);
|
91
92
|
}
|
92
93
|
};
|
93
94
|
var handleContentKeyDown = function handleContentKeyDown(event) {
|
94
95
|
var _inputRef$current2, _focusedItem, _focusedItem2;
|
95
|
-
var chipsRefsCount =
|
96
|
+
var chipsRefsCount = chipsRefs.current.length;
|
96
97
|
var currentCaretPosition = (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.selectionStart) || 0;
|
97
98
|
var newActiveChipIndex = activeChipIndex;
|
98
99
|
var focusedItem = null;
|
@@ -4,7 +4,7 @@ import { StyledChip } from './TextFieldChip.styles';
|
|
4
4
|
* Чип, отображающий выбранный элемент
|
5
5
|
*/
|
6
6
|
export var TextFieldChip = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
7
|
-
var
|
7
|
+
var id = _ref.id,
|
8
8
|
text = _ref.text,
|
9
9
|
disabled = _ref.disabled,
|
10
10
|
readOnly = _ref.readOnly,
|
@@ -12,10 +12,10 @@ export var TextFieldChip = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
12
12
|
onClear = _ref.onClear,
|
13
13
|
onKeyDown = _ref.onKeyDown;
|
14
14
|
var onClearHandle = function onClearHandle() {
|
15
|
-
return onClear(
|
15
|
+
return onClear(id);
|
16
16
|
};
|
17
17
|
var onKeyDownHandle = function onKeyDownHandle(event) {
|
18
|
-
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event,
|
18
|
+
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event, id);
|
19
19
|
};
|
20
20
|
return /*#__PURE__*/React.createElement(StyledChip, {
|
21
21
|
ref: ref,
|
@@ -11,10 +11,10 @@ const onChange = action('onChange');
|
|
11
11
|
const onFocus = action('onFocus');
|
12
12
|
const onBlur = action('onBlur');
|
13
13
|
const onSearch = action('onSearch');
|
14
|
+
const onChipsChange = action('onChipsChange');
|
14
15
|
|
15
16
|
const sizes = ['l', 'm', 's', 'xs'];
|
16
17
|
const views = ['default', 'positive', 'warning', 'negative'];
|
17
|
-
const enumerationTypes = ['plain', 'chip'];
|
18
18
|
const labelPlacements = ['outer', 'inner'];
|
19
19
|
|
20
20
|
const meta: Meta<typeof TextField> = {
|
@@ -39,12 +39,6 @@ const meta: Meta<typeof TextField> = {
|
|
39
39
|
type: 'inline-radio',
|
40
40
|
},
|
41
41
|
},
|
42
|
-
enumerationType: {
|
43
|
-
options: enumerationTypes,
|
44
|
-
control: {
|
45
|
-
type: 'select',
|
46
|
-
},
|
47
|
-
},
|
48
42
|
size: {
|
49
43
|
options: sizes,
|
50
44
|
control: {
|
@@ -72,6 +66,9 @@ type StoryPropsDefault = Omit<
|
|
72
66
|
| 'maxLength'
|
73
67
|
| 'minLength'
|
74
68
|
| 'required'
|
69
|
+
| 'enumerationType'
|
70
|
+
| 'chips'
|
71
|
+
| 'onChangeChips'
|
75
72
|
> & {
|
76
73
|
'storybook:contentLeft': boolean;
|
77
74
|
'storybook:contentRight': boolean;
|
@@ -90,6 +87,7 @@ const StoryDemo = ({
|
|
90
87
|
return (
|
91
88
|
<TextField
|
92
89
|
{...rest}
|
90
|
+
enumerationType="plain"
|
93
91
|
value={text}
|
94
92
|
contentLeft={enableContentLeft ? <IconPlaceholder size={iconSize} /> : undefined}
|
95
93
|
contentRight={enableContentRight ? <IconPlaceholder size={iconSize} /> : undefined}
|
@@ -114,7 +112,6 @@ export const Default: StoryObj<StoryPropsDefault> = {
|
|
114
112
|
labelPlacement: 'outer',
|
115
113
|
placeholder: 'Заполните поле',
|
116
114
|
leftHelper: 'Подсказка к полю',
|
117
|
-
enumerationType: 'plain',
|
118
115
|
disabled: false,
|
119
116
|
readOnly: false,
|
120
117
|
'storybook:contentLeft': true,
|
@@ -123,11 +120,62 @@ export const Default: StoryObj<StoryPropsDefault> = {
|
|
123
120
|
render: (args) => <StoryDemo {...args} />,
|
124
121
|
};
|
125
122
|
|
126
|
-
|
123
|
+
type StoryPropsChips = Omit<
|
124
|
+
ComponentProps<typeof TextField>,
|
125
|
+
| 'helperBlock'
|
126
|
+
| 'contentLeft'
|
127
|
+
| 'htmlSize'
|
128
|
+
| 'contentRight'
|
129
|
+
| 'type'
|
130
|
+
| 'name'
|
131
|
+
| 'onFocus'
|
132
|
+
| 'onBlur'
|
133
|
+
| 'onChange'
|
134
|
+
| 'onSearch'
|
135
|
+
| 'value'
|
136
|
+
| 'checked'
|
137
|
+
| 'maxLength'
|
138
|
+
| 'minLength'
|
139
|
+
| 'required'
|
140
|
+
| 'enumerationType'
|
141
|
+
> & {
|
142
|
+
'storybook:contentLeft': boolean;
|
143
|
+
'storybook:contentRight': boolean;
|
144
|
+
};
|
145
|
+
|
146
|
+
const StoryChips = ({
|
147
|
+
'storybook:contentLeft': enableContentLeft,
|
148
|
+
'storybook:contentRight': enableContentRight,
|
149
|
+
view,
|
150
|
+
...rest
|
151
|
+
}: StoryPropsChips) => {
|
152
|
+
const [text, setText] = useState('Значение поля');
|
153
|
+
|
154
|
+
const iconSize = rest.size === 'xs' ? 'xs' : 's';
|
155
|
+
|
156
|
+
return (
|
157
|
+
<TextField
|
158
|
+
{...rest}
|
159
|
+
enumerationType="chip"
|
160
|
+
value={text}
|
161
|
+
contentLeft={enableContentLeft ? <IconPlaceholder size={iconSize} /> : undefined}
|
162
|
+
contentRight={enableContentRight ? <IconPlaceholder size={iconSize} /> : undefined}
|
163
|
+
view={view}
|
164
|
+
onChange={(e) => {
|
165
|
+
setText(e.target.value);
|
166
|
+
onChange(e.target.value);
|
167
|
+
}}
|
168
|
+
onFocus={onFocus}
|
169
|
+
onBlur={onBlur}
|
170
|
+
onChangeChips={onChipsChange}
|
171
|
+
/>
|
172
|
+
);
|
173
|
+
};
|
174
|
+
|
175
|
+
export const Chips: StoryObj<StoryPropsChips> = {
|
127
176
|
args: {
|
128
177
|
...Default.args,
|
129
|
-
|
130
|
-
values: ['1 value', '2 value', '3 value', '4 value'],
|
178
|
+
chips: ['1 value', '2 value', '3 value', '4 value'],
|
131
179
|
},
|
132
|
-
render: (args) => <
|
180
|
+
render: (args) => <StoryChips {...args} />,
|
133
181
|
};
|
@@ -11,10 +11,10 @@ const onChange = action('onChange');
|
|
11
11
|
const onFocus = action('onFocus');
|
12
12
|
const onBlur = action('onBlur');
|
13
13
|
const onSearch = action('onSearch');
|
14
|
+
const onChipsChange = action('onChipsChange');
|
14
15
|
|
15
16
|
const sizes = ['l', 'm', 's', 'xs'];
|
16
17
|
const views = ['default', 'positive', 'warning', 'negative'];
|
17
|
-
const enumerationTypes = ['plain', 'chip'];
|
18
18
|
const labelPlacements = ['outer', 'inner'];
|
19
19
|
|
20
20
|
const meta: Meta<typeof TextField> = {
|
@@ -39,12 +39,6 @@ const meta: Meta<typeof TextField> = {
|
|
39
39
|
type: 'inline-radio',
|
40
40
|
},
|
41
41
|
},
|
42
|
-
enumerationType: {
|
43
|
-
options: enumerationTypes,
|
44
|
-
control: {
|
45
|
-
type: 'select',
|
46
|
-
},
|
47
|
-
},
|
48
42
|
size: {
|
49
43
|
options: sizes,
|
50
44
|
control: {
|
@@ -72,6 +66,9 @@ type StoryPropsDefault = Omit<
|
|
72
66
|
| 'maxLength'
|
73
67
|
| 'minLength'
|
74
68
|
| 'required'
|
69
|
+
| 'enumerationType'
|
70
|
+
| 'chips'
|
71
|
+
| 'onChangeChips'
|
75
72
|
> & {
|
76
73
|
'storybook:contentLeft': boolean;
|
77
74
|
'storybook:contentRight': boolean;
|
@@ -90,6 +87,7 @@ const StoryDemo = ({
|
|
90
87
|
return (
|
91
88
|
<TextField
|
92
89
|
{...rest}
|
90
|
+
enumerationType="plain"
|
93
91
|
value={text}
|
94
92
|
contentLeft={enableContentLeft ? <IconPlaceholder size={iconSize} /> : undefined}
|
95
93
|
contentRight={enableContentRight ? <IconPlaceholder size={iconSize} /> : undefined}
|
@@ -114,7 +112,6 @@ export const Default: StoryObj<StoryPropsDefault> = {
|
|
114
112
|
labelPlacement: 'outer',
|
115
113
|
placeholder: 'Заполните поле',
|
116
114
|
leftHelper: 'Подсказка к полю',
|
117
|
-
enumerationType: 'plain',
|
118
115
|
disabled: false,
|
119
116
|
readOnly: false,
|
120
117
|
'storybook:contentLeft': true,
|
@@ -123,11 +120,62 @@ export const Default: StoryObj<StoryPropsDefault> = {
|
|
123
120
|
render: (args) => <StoryDemo {...args} />,
|
124
121
|
};
|
125
122
|
|
126
|
-
|
123
|
+
type StoryPropsChips = Omit<
|
124
|
+
ComponentProps<typeof TextField>,
|
125
|
+
| 'helperBlock'
|
126
|
+
| 'contentLeft'
|
127
|
+
| 'htmlSize'
|
128
|
+
| 'contentRight'
|
129
|
+
| 'type'
|
130
|
+
| 'name'
|
131
|
+
| 'onFocus'
|
132
|
+
| 'onBlur'
|
133
|
+
| 'onChange'
|
134
|
+
| 'onSearch'
|
135
|
+
| 'value'
|
136
|
+
| 'checked'
|
137
|
+
| 'maxLength'
|
138
|
+
| 'minLength'
|
139
|
+
| 'required'
|
140
|
+
| 'enumerationType'
|
141
|
+
> & {
|
142
|
+
'storybook:contentLeft': boolean;
|
143
|
+
'storybook:contentRight': boolean;
|
144
|
+
};
|
145
|
+
|
146
|
+
const StoryChips = ({
|
147
|
+
'storybook:contentLeft': enableContentLeft,
|
148
|
+
'storybook:contentRight': enableContentRight,
|
149
|
+
view,
|
150
|
+
...rest
|
151
|
+
}: StoryPropsChips) => {
|
152
|
+
const [text, setText] = useState('Значение поля');
|
153
|
+
|
154
|
+
const iconSize = rest.size === 'xs' ? 'xs' : 's';
|
155
|
+
|
156
|
+
return (
|
157
|
+
<TextField
|
158
|
+
{...rest}
|
159
|
+
enumerationType="chip"
|
160
|
+
value={text}
|
161
|
+
contentLeft={enableContentLeft ? <IconPlaceholder size={iconSize} /> : undefined}
|
162
|
+
contentRight={enableContentRight ? <IconPlaceholder size={iconSize} /> : undefined}
|
163
|
+
view={view}
|
164
|
+
onChange={(e) => {
|
165
|
+
setText(e.target.value);
|
166
|
+
onChange(e.target.value);
|
167
|
+
}}
|
168
|
+
onFocus={onFocus}
|
169
|
+
onBlur={onBlur}
|
170
|
+
onChangeChips={onChipsChange}
|
171
|
+
/>
|
172
|
+
);
|
173
|
+
};
|
174
|
+
|
175
|
+
export const Chips: StoryObj<StoryPropsChips> = {
|
127
176
|
args: {
|
128
177
|
...Default.args,
|
129
|
-
|
130
|
-
values: ['1 value', '2 value', '3 value', '4 value'],
|
178
|
+
chips: ['1 value', '2 value', '3 value', '4 value'],
|
131
179
|
},
|
132
|
-
render: (args) => <
|
180
|
+
render: (args) => <StoryChips {...args} />,
|
133
181
|
};
|
package/styled-components/es/examples/sds_engineer/components/TextField/TextField.stories.tsx
CHANGED
@@ -11,10 +11,10 @@ const onChange = action('onChange');
|
|
11
11
|
const onFocus = action('onFocus');
|
12
12
|
const onBlur = action('onBlur');
|
13
13
|
const onSearch = action('onSearch');
|
14
|
+
const onChipsChange = action('onChipsChange');
|
14
15
|
|
15
16
|
const sizes = ['l', 'm', 's', 'xs'];
|
16
17
|
const views = ['default', 'positive', 'warning', 'negative'];
|
17
|
-
const enumerationTypes = ['plain', 'chip'];
|
18
18
|
const labelPlacements = ['outer', 'inner'];
|
19
19
|
|
20
20
|
const meta: Meta<typeof TextField> = {
|
@@ -39,12 +39,6 @@ const meta: Meta<typeof TextField> = {
|
|
39
39
|
type: 'inline-radio',
|
40
40
|
},
|
41
41
|
},
|
42
|
-
enumerationType: {
|
43
|
-
options: enumerationTypes,
|
44
|
-
control: {
|
45
|
-
type: 'select',
|
46
|
-
},
|
47
|
-
},
|
48
42
|
size: {
|
49
43
|
options: sizes,
|
50
44
|
control: {
|
@@ -72,6 +66,9 @@ type StoryPropsDefault = Omit<
|
|
72
66
|
| 'maxLength'
|
73
67
|
| 'minLength'
|
74
68
|
| 'required'
|
69
|
+
| 'enumerationType'
|
70
|
+
| 'chips'
|
71
|
+
| 'onChangeChips'
|
75
72
|
> & {
|
76
73
|
'storybook:contentLeft': boolean;
|
77
74
|
'storybook:contentRight': boolean;
|
@@ -90,6 +87,7 @@ const StoryDemo = ({
|
|
90
87
|
return (
|
91
88
|
<TextField
|
92
89
|
{...rest}
|
90
|
+
enumerationType="plain"
|
93
91
|
value={text}
|
94
92
|
contentLeft={enableContentLeft ? <IconPlaceholder size={iconSize} /> : undefined}
|
95
93
|
contentRight={enableContentRight ? <IconPlaceholder size={iconSize} /> : undefined}
|
@@ -114,7 +112,6 @@ export const Default: StoryObj<StoryPropsDefault> = {
|
|
114
112
|
labelPlacement: 'outer',
|
115
113
|
placeholder: 'Заполните поле',
|
116
114
|
leftHelper: 'Подсказка к полю',
|
117
|
-
enumerationType: 'plain',
|
118
115
|
disabled: false,
|
119
116
|
readOnly: false,
|
120
117
|
'storybook:contentLeft': true,
|
@@ -123,11 +120,62 @@ export const Default: StoryObj<StoryPropsDefault> = {
|
|
123
120
|
render: (args) => <StoryDemo {...args} />,
|
124
121
|
};
|
125
122
|
|
126
|
-
|
123
|
+
type StoryPropsChips = Omit<
|
124
|
+
ComponentProps<typeof TextField>,
|
125
|
+
| 'helperBlock'
|
126
|
+
| 'contentLeft'
|
127
|
+
| 'htmlSize'
|
128
|
+
| 'contentRight'
|
129
|
+
| 'type'
|
130
|
+
| 'name'
|
131
|
+
| 'onFocus'
|
132
|
+
| 'onBlur'
|
133
|
+
| 'onChange'
|
134
|
+
| 'onSearch'
|
135
|
+
| 'value'
|
136
|
+
| 'checked'
|
137
|
+
| 'maxLength'
|
138
|
+
| 'minLength'
|
139
|
+
| 'required'
|
140
|
+
| 'enumerationType'
|
141
|
+
> & {
|
142
|
+
'storybook:contentLeft': boolean;
|
143
|
+
'storybook:contentRight': boolean;
|
144
|
+
};
|
145
|
+
|
146
|
+
const StoryChips = ({
|
147
|
+
'storybook:contentLeft': enableContentLeft,
|
148
|
+
'storybook:contentRight': enableContentRight,
|
149
|
+
view,
|
150
|
+
...rest
|
151
|
+
}: StoryPropsChips) => {
|
152
|
+
const [text, setText] = useState('Значение поля');
|
153
|
+
|
154
|
+
const iconSize = rest.size === 'xs' ? 'xs' : 's';
|
155
|
+
|
156
|
+
return (
|
157
|
+
<TextField
|
158
|
+
{...rest}
|
159
|
+
enumerationType="chip"
|
160
|
+
value={text}
|
161
|
+
contentLeft={enableContentLeft ? <IconPlaceholder size={iconSize} /> : undefined}
|
162
|
+
contentRight={enableContentRight ? <IconPlaceholder size={iconSize} /> : undefined}
|
163
|
+
view={view}
|
164
|
+
onChange={(e) => {
|
165
|
+
setText(e.target.value);
|
166
|
+
onChange(e.target.value);
|
167
|
+
}}
|
168
|
+
onFocus={onFocus}
|
169
|
+
onBlur={onBlur}
|
170
|
+
onChangeChips={onChipsChange}
|
171
|
+
/>
|
172
|
+
);
|
173
|
+
};
|
174
|
+
|
175
|
+
export const Chips: StoryObj<StoryPropsChips> = {
|
127
176
|
args: {
|
128
177
|
...Default.args,
|
129
|
-
|
130
|
-
values: ['1 value', '2 value', '3 value', '4 value'],
|
178
|
+
chips: ['1 value', '2 value', '3 value', '4 value'],
|
131
179
|
},
|
132
|
-
render: (args) => <
|
180
|
+
render: (args) => <StoryChips {...args} />,
|
133
181
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Cell.d.ts","sourceRoot":"","sources":["../../../src/components/Cell/Cell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAO9C,eAAO,MAAM,QAAQ,SAAU,UAAU,cAAc,EAAE,SAAS,CAAC,
|
1
|
+
{"version":3,"file":"Cell.d.ts","sourceRoot":"","sources":["../../../src/components/Cell/Cell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAO9C,eAAO,MAAM,QAAQ,SAAU,UAAU,cAAc,EAAE,SAAS,CAAC,qFA0C9D,CAAC;AAEN,eAAO,MAAM,UAAU;;;mBA5CQ,UAAU,cAAc,EAAE,SAAS,CAAC;;;;;;;;;;;;;;CA6DlE,CAAC"}
|
@@ -5,7 +5,44 @@ export declare type ChipValues = {
|
|
5
5
|
text: TextFieldPrimitiveValue;
|
6
6
|
};
|
7
7
|
export declare type EnumerationType = 'plain' | 'chip';
|
8
|
-
|
8
|
+
declare type TextFieldChipProps = {
|
9
|
+
/**
|
10
|
+
* Выбранные значения.
|
11
|
+
*/
|
12
|
+
chips?: never;
|
13
|
+
/**
|
14
|
+
* Обработчик изменения выбранных значений.
|
15
|
+
*/
|
16
|
+
onChangeChips?: never;
|
17
|
+
/**
|
18
|
+
* Тип перечисления значений.
|
19
|
+
* Варианты: plain, chip
|
20
|
+
*/
|
21
|
+
enumerationType?: 'plain';
|
22
|
+
/**
|
23
|
+
* Callback по нажатию Enter
|
24
|
+
*/
|
25
|
+
onSearch?: (value: string, event?: KeyboardEvent<HTMLInputElement>) => void;
|
26
|
+
} | {
|
27
|
+
/**
|
28
|
+
* Тип перечисления значений.
|
29
|
+
* Варианты: plain, chip
|
30
|
+
*/
|
31
|
+
enumerationType: 'chip';
|
32
|
+
/**
|
33
|
+
* Callback по нажатию Enter
|
34
|
+
*/
|
35
|
+
onSearch?: never;
|
36
|
+
/**
|
37
|
+
* Выбранные значения.
|
38
|
+
*/
|
39
|
+
chips?: Array<TextFieldPrimitiveValue>;
|
40
|
+
/**
|
41
|
+
* Обработчик изменения выбранных значений.
|
42
|
+
*/
|
43
|
+
onChangeChips?: (value: Array<TextFieldPrimitiveValue>) => void;
|
44
|
+
};
|
45
|
+
export declare type TextFieldPropsBase = {
|
9
46
|
/**
|
10
47
|
* Метка-подпись к элементу
|
11
48
|
*/
|
@@ -26,25 +63,12 @@ export interface TextFieldPropsBase {
|
|
26
63
|
* Слот для контента справа.
|
27
64
|
*/
|
28
65
|
contentRight?: React.ReactElement;
|
29
|
-
/**
|
30
|
-
* Тип перечисления значений.
|
31
|
-
* Варианты: plain, chips
|
32
|
-
*/
|
33
|
-
enumerationType?: EnumerationType;
|
34
|
-
/**
|
35
|
-
* Выбранные значения.
|
36
|
-
*/
|
37
|
-
values?: Array<TextFieldPrimitiveValue>;
|
38
66
|
/**
|
39
67
|
* Callback по нажатию Enter
|
40
68
|
*/
|
41
69
|
onSearch?: (value: string, event?: KeyboardEvent<HTMLInputElement>) => void;
|
42
|
-
|
43
|
-
|
44
|
-
*/
|
45
|
-
onChangeChips?: (value: Array<TextFieldPrimitiveValue>) => void;
|
46
|
-
}
|
47
|
-
export interface TextFieldPropsVariations extends TextFieldPropsBase {
|
70
|
+
} & TextFieldChipProps;
|
71
|
+
export declare type TextFieldProps = {
|
48
72
|
/**
|
49
73
|
* Размер контрола.
|
50
74
|
*/
|
@@ -61,9 +85,7 @@ export interface TextFieldPropsVariations extends TextFieldPropsBase {
|
|
61
85
|
* Компонент неактивен.
|
62
86
|
*/
|
63
87
|
disabled?: boolean;
|
64
|
-
}
|
65
|
-
export interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'>, TextFieldPropsVariations {
|
66
|
-
}
|
88
|
+
} & TextFieldPropsBase & Omit<InputHTMLAttributes<HTMLInputElement>, 'size'>;
|
67
89
|
export interface ControlledRefs {
|
68
90
|
chipsRefs: MutableRefObject<Array<HTMLButtonElement>>;
|
69
91
|
inputRef?: MutableRefObject<HTMLInputElement | null>;
|
@@ -79,4 +101,5 @@ export interface UseKeyNavigationProps {
|
|
79
101
|
onSearch?: (value: string, event?: KeyboardEvent<HTMLInputElement>) => void;
|
80
102
|
onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
|
81
103
|
}
|
104
|
+
export {};
|
82
105
|
//# sourceMappingURL=TextField.types.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"TextField.types.d.ts","sourceRoot":"","sources":["../../../src/components/TextField/TextField.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAE/F,oBAAY,uBAAuB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEhE,oBAAY,UAAU,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,uBAAuB,CAAC;CACjC,CAAC;AAEF,oBAAY,eAAe,GAAG,OAAO,GAAG,MAAM,CAAC;AAE/C,
|
1
|
+
{"version":3,"file":"TextField.types.d.ts","sourceRoot":"","sources":["../../../src/components/TextField/TextField.types.ts"],"names":[],"mappings":"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"}
|
@@ -10,8 +10,8 @@ export declare const Keys: {
|
|
10
10
|
};
|
11
11
|
export declare const useKeyNavigation: ({ controlledRefs: { chipsRefs, contentRef, inputRef }, disabled, readOnly, chips, enumerationType, updateChips, onChange, onSearch, }: UseKeyNavigationProps) => {
|
12
12
|
readonly handleInputKeydown: (event: ChangeEvent<HTMLInputElement> & KeyboardEvent<HTMLInputElement>) => void;
|
13
|
-
readonly handleChipKeyDown: (event: KeyboardEvent<HTMLButtonElement>, chipId: string) => void;
|
14
|
-
readonly onChipClear: (clearId: string) => void;
|
13
|
+
readonly handleChipKeyDown: (event: KeyboardEvent<HTMLButtonElement>, chipId: string, chipIndex: number) => void;
|
14
|
+
readonly onChipClear: (clearId: string, index: number) => void;
|
15
15
|
readonly handleContentKeyDown: (event: KeyboardEvent<HTMLDivElement>) => void;
|
16
16
|
};
|
17
17
|
//# sourceMappingURL=useKeyNavigation.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useKeyNavigation.d.ts","sourceRoot":"","sources":["../../../../src/components/TextField/hooks/useKeyNavigation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAExD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEhE,eAAO,MAAM,IAAI;;;;;;;CAOhB,CAAC;AAEF,eAAO,MAAM,gBAAgB,0IAS1B,qBAAqB;yCAGe,YAAY,gBAAgB,CAAC,GAAG,cAAc,gBAAgB,CAAC;
|
1
|
+
{"version":3,"file":"useKeyNavigation.d.ts","sourceRoot":"","sources":["../../../../src/components/TextField/hooks/useKeyNavigation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAExD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEhE,eAAO,MAAM,IAAI;;;;;;;CAOhB,CAAC;AAEF,eAAO,MAAM,gBAAgB,0IAS1B,qBAAqB;yCAGe,YAAY,gBAAgB,CAAC,GAAG,cAAc,gBAAgB,CAAC;wCA6ChE,cAAc,iBAAiB,CAAC,UAAU,MAAM,aAAa,MAAM;oCAZvE,MAAM,SAAS,MAAM;2CAsBd,cAAc,cAAc,CAAC;CAkDrE,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"TextFieldChip.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/TextField/ui/TextFieldChip/TextFieldChip.types.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAErE,MAAM,WAAW,kBAAkB;IAC/B;;OAEG;IACH,
|
1
|
+
{"version":3,"file":"TextFieldChip.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/TextField/ui/TextFieldChip/TextFieldChip.types.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAErE,MAAM,WAAW,kBAAkB;IAC/B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,IAAI,EAAE,uBAAuB,CAAC;IAC9B;;OAEG;IACH,KAAK,EAAE,uBAAuB,CAAC;IAC/B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9B;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAC/D;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,iBAAiB,CAAC,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACvF"}
|
@@ -22,5 +22,39 @@ export declare const TextField: import("react").FunctionComponent<import("../../
|
|
22
22
|
readOnly: {
|
23
23
|
true: import("@linaria/core").LinariaClassName;
|
24
24
|
};
|
25
|
-
}> &
|
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
|
+
onSearch?: ((value: string, event?: import("react").KeyboardEvent<HTMLInputElement> | undefined) => void) | undefined;
|
37
|
+
} & {
|
38
|
+
chips?: undefined;
|
39
|
+
onChangeChips?: undefined;
|
40
|
+
enumerationType?: "plain" | undefined;
|
41
|
+
onSearch?: ((value: string, event?: import("react").KeyboardEvent<HTMLInputElement> | undefined) => void) | undefined;
|
42
|
+
} & Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "size"> & import("react").RefAttributes<HTMLDivElement>) | ({
|
43
|
+
size?: string | undefined;
|
44
|
+
view?: string | undefined;
|
45
|
+
readOnly?: boolean | undefined;
|
46
|
+
disabled?: boolean | undefined;
|
47
|
+
} & {
|
48
|
+
label?: string | undefined;
|
49
|
+
labelPlacement?: "inner" | "outer" | undefined;
|
50
|
+
leftHelper?: string | undefined;
|
51
|
+
contentLeft?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
|
52
|
+
contentRight?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
|
53
|
+
onSearch?: ((value: string, event?: import("react").KeyboardEvent<HTMLInputElement> | undefined) => void) | undefined;
|
54
|
+
} & {
|
55
|
+
enumerationType: "chip";
|
56
|
+
onSearch?: undefined;
|
57
|
+
chips?: import("../../../../components/TextField/TextField.types").TextFieldPrimitiveValue[] | undefined;
|
58
|
+
onChangeChips?: ((value: import("../../../../components/TextField/TextField.types").TextFieldPrimitiveValue[]) => void) | undefined;
|
59
|
+
} & Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "size"> & import("react").RefAttributes<HTMLDivElement>))>;
|
26
60
|
//# sourceMappingURL=TextField.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../../../src/examples/plasma_b2c/components/TextField/TextField.ts"],"names":[],"mappings":";AAMA,eAAO,MAAM,SAAS
|
1
|
+
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../../../src/examples/plasma_b2c/components/TextField/TextField.ts"],"names":[],"mappings":";AAMA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0HAA0B,CAAC"}
|
@@ -22,5 +22,39 @@ export declare const TextField: import("react").FunctionComponent<import("../../
|
|
22
22
|
readOnly: {
|
23
23
|
true: import("@linaria/core").LinariaClassName;
|
24
24
|
};
|
25
|
-
}> &
|
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
|
+
onSearch?: ((value: string, event?: import("react").KeyboardEvent<HTMLInputElement> | undefined) => void) | undefined;
|
37
|
+
} & {
|
38
|
+
chips?: undefined;
|
39
|
+
onChangeChips?: undefined;
|
40
|
+
enumerationType?: "plain" | undefined;
|
41
|
+
onSearch?: ((value: string, event?: import("react").KeyboardEvent<HTMLInputElement> | undefined) => void) | undefined;
|
42
|
+
} & Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "size"> & import("react").RefAttributes<HTMLDivElement>) | ({
|
43
|
+
size?: string | undefined;
|
44
|
+
view?: string | undefined;
|
45
|
+
readOnly?: boolean | undefined;
|
46
|
+
disabled?: boolean | undefined;
|
47
|
+
} & {
|
48
|
+
label?: string | undefined;
|
49
|
+
labelPlacement?: "inner" | "outer" | undefined;
|
50
|
+
leftHelper?: string | undefined;
|
51
|
+
contentLeft?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
|
52
|
+
contentRight?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
|
53
|
+
onSearch?: ((value: string, event?: import("react").KeyboardEvent<HTMLInputElement> | undefined) => void) | undefined;
|
54
|
+
} & {
|
55
|
+
enumerationType: "chip";
|
56
|
+
onSearch?: undefined;
|
57
|
+
chips?: import("../../../../components/TextField/TextField.types").TextFieldPrimitiveValue[] | undefined;
|
58
|
+
onChangeChips?: ((value: import("../../../../components/TextField/TextField.types").TextFieldPrimitiveValue[]) => void) | undefined;
|
59
|
+
} & Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "size"> & import("react").RefAttributes<HTMLDivElement>))>;
|
26
60
|
//# sourceMappingURL=TextField.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../../../src/examples/plasma_web/components/TextField/TextField.ts"],"names":[],"mappings":";AAMA,eAAO,MAAM,SAAS
|
1
|
+
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../../../src/examples/plasma_web/components/TextField/TextField.ts"],"names":[],"mappings":";AAMA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0HAA0B,CAAC"}
|