@salutejs/plasma-new-hope 0.72.0-dev.0 → 0.73.0-dev.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (239) hide show
  1. package/cjs/components/TextField/TextField.js +166 -40
  2. package/cjs/components/TextField/TextField.js.map +1 -1
  3. package/cjs/components/TextField/TextField.styles.js +27 -11
  4. package/cjs/components/TextField/TextField.styles.js.map +1 -1
  5. package/cjs/components/TextField/TextField.styles_1b1mddp.css +8 -0
  6. package/cjs/components/TextField/TextField.tokens.js +68 -20
  7. package/cjs/components/TextField/TextField.tokens.js.map +1 -1
  8. package/cjs/components/TextField/TextField_wctd2m.css +1 -0
  9. package/cjs/components/TextField/hooks/useKeyNavigation.js +132 -0
  10. package/cjs/components/TextField/hooks/useKeyNavigation.js.map +1 -0
  11. package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.css +19 -0
  12. package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js +38 -0
  13. package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js.map +1 -0
  14. package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.styles.js +26 -0
  15. package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.styles.js.map +1 -0
  16. package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.styles_1y8n7la.css +1 -0
  17. package/cjs/components/TextField/{_disabled → variations/_disabled}/base.js +2 -2
  18. package/cjs/components/TextField/variations/_disabled/base.js.map +1 -0
  19. package/cjs/components/TextField/variations/_disabled/base_1tnjoy9.css +1 -0
  20. package/cjs/components/TextField/{_label-placement → variations/_label-placement}/base.js +1 -1
  21. package/cjs/components/TextField/variations/_label-placement/base.js.map +1 -0
  22. package/cjs/components/TextField/{_label-placement → variations/_label-placement}/inner.js +2 -2
  23. package/cjs/components/TextField/variations/_label-placement/inner.js.map +1 -0
  24. package/cjs/components/TextField/variations/_label-placement/inner_gqlcj2.css +1 -0
  25. package/cjs/components/TextField/{_label-placement → variations/_label-placement}/outer.js +2 -2
  26. package/cjs/components/TextField/variations/_label-placement/outer.js.map +1 -0
  27. package/cjs/components/TextField/variations/_label-placement/outer_is41nj.css +1 -0
  28. package/cjs/components/TextField/{_view → variations/_read-only}/base.js +2 -2
  29. package/cjs/components/TextField/variations/_read-only/base.js.map +1 -0
  30. package/cjs/components/TextField/variations/_read-only/base_134hshp.css +1 -0
  31. package/cjs/components/TextField/variations/_size/base.js +9 -0
  32. package/cjs/components/TextField/variations/_size/base.js.map +1 -0
  33. package/cjs/components/TextField/variations/_size/base_1khzr9t.css +1 -0
  34. package/cjs/components/TextField/{_size → variations/_view}/base.js +2 -2
  35. package/cjs/components/TextField/variations/_view/base.js.map +1 -0
  36. package/cjs/components/TextField/variations/_view/base_1qd77x6.css +1 -0
  37. package/cjs/index.css +16 -9
  38. package/cjs/index.js +2 -2
  39. package/es/components/TextField/TextField.js +169 -44
  40. package/es/components/TextField/TextField.js.map +1 -1
  41. package/es/components/TextField/TextField.styles.js +25 -12
  42. package/es/components/TextField/TextField.styles.js.map +1 -1
  43. package/es/components/TextField/TextField.styles_1b1mddp.css +8 -0
  44. package/es/components/TextField/TextField.tokens.js +68 -21
  45. package/es/components/TextField/TextField.tokens.js.map +1 -1
  46. package/es/components/TextField/TextField_wctd2m.css +1 -0
  47. package/es/components/TextField/hooks/useKeyNavigation.js +127 -0
  48. package/es/components/TextField/hooks/useKeyNavigation.js.map +1 -0
  49. package/es/components/TextField/ui/TextFieldChip/TextFieldChip.css +19 -0
  50. package/es/components/TextField/ui/TextFieldChip/TextFieldChip.js +34 -0
  51. package/es/components/TextField/ui/TextFieldChip/TextFieldChip.js.map +1 -0
  52. package/es/components/TextField/ui/TextFieldChip/TextFieldChip.styles.js +22 -0
  53. package/es/components/TextField/ui/TextFieldChip/TextFieldChip.styles.js.map +1 -0
  54. package/es/components/TextField/ui/TextFieldChip/TextFieldChip.styles_1y8n7la.css +1 -0
  55. package/es/components/TextField/variations/_disabled/base.js +5 -0
  56. package/es/components/TextField/variations/_disabled/base.js.map +1 -0
  57. package/es/components/TextField/variations/_disabled/base_1tnjoy9.css +1 -0
  58. package/es/components/TextField/{_label-placement → variations/_label-placement}/base.js +1 -1
  59. package/es/components/TextField/variations/_label-placement/base.js.map +1 -0
  60. package/es/components/TextField/variations/_label-placement/inner.js +5 -0
  61. package/es/components/TextField/variations/_label-placement/inner.js.map +1 -0
  62. package/es/components/TextField/variations/_label-placement/inner_gqlcj2.css +1 -0
  63. package/es/components/TextField/variations/_label-placement/outer.js +5 -0
  64. package/es/components/TextField/variations/_label-placement/outer.js.map +1 -0
  65. package/es/components/TextField/variations/_label-placement/outer_is41nj.css +1 -0
  66. package/es/components/TextField/variations/_read-only/base.js +5 -0
  67. package/es/components/TextField/variations/_read-only/base.js.map +1 -0
  68. package/es/components/TextField/variations/_read-only/base_134hshp.css +1 -0
  69. package/es/components/TextField/variations/_size/base.js +5 -0
  70. package/es/components/TextField/variations/_size/base.js.map +1 -0
  71. package/es/components/TextField/variations/_size/base_1khzr9t.css +1 -0
  72. package/es/components/TextField/{_disabled → variations/_view}/base.js +2 -2
  73. package/es/components/TextField/variations/_view/base.js.map +1 -0
  74. package/es/components/TextField/variations/_view/base_1qd77x6.css +1 -0
  75. package/es/index.css +16 -9
  76. package/es/index.js +2 -2
  77. package/package.json +2 -2
  78. package/styled-components/cjs/components/TextField/TextField.js +173 -43
  79. package/styled-components/cjs/components/TextField/TextField.styles.js +18 -10
  80. package/styled-components/cjs/components/TextField/TextField.template-doc.mdx +24 -0
  81. package/styled-components/cjs/components/TextField/TextField.tokens.js +68 -21
  82. package/styled-components/cjs/components/TextField/hooks/index.js +12 -0
  83. package/styled-components/cjs/components/TextField/hooks/useKeyNavigation.js +138 -0
  84. package/styled-components/cjs/components/TextField/index.js +2 -2
  85. package/styled-components/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js +39 -0
  86. package/styled-components/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.styles.js +25 -0
  87. package/styled-components/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.types.js +5 -0
  88. package/styled-components/cjs/components/TextField/ui/index.js +12 -0
  89. package/styled-components/cjs/components/TextField/variations/_disabled/base.js +10 -0
  90. package/styled-components/cjs/components/TextField/variations/_label-placement/inner.js +10 -0
  91. package/styled-components/cjs/components/TextField/{_label-placement → variations/_label-placement}/outer.js +3 -3
  92. package/styled-components/cjs/components/TextField/variations/_read-only/base.js +10 -0
  93. package/styled-components/cjs/components/TextField/variations/_read-only/tokens.json +1 -0
  94. package/styled-components/cjs/components/TextField/variations/_size/base.js +10 -0
  95. package/styled-components/cjs/components/TextField/variations/_view/base.js +10 -0
  96. package/styled-components/cjs/examples/plasma_b2c/components/TextField/TextField.config.js +43 -0
  97. package/styled-components/cjs/examples/plasma_b2c/components/TextField/TextField.js +11 -0
  98. package/styled-components/cjs/examples/plasma_b2c/components/TextField/TextField.stories.tsx +181 -0
  99. package/styled-components/cjs/examples/plasma_web/components/TextField/TextField.config.js +40 -0
  100. package/styled-components/cjs/examples/plasma_web/components/TextField/TextField.js +11 -0
  101. package/styled-components/cjs/examples/plasma_web/components/TextField/TextField.stories.tsx +181 -0
  102. package/styled-components/cjs/examples/sds_engineer/components/TextField/TextField.config.js +43 -0
  103. package/styled-components/cjs/examples/sds_engineer/components/TextField/TextField.js +11 -0
  104. package/styled-components/cjs/examples/sds_engineer/components/TextField/TextField.stories.tsx +181 -0
  105. package/styled-components/es/components/TextField/TextField.js +177 -47
  106. package/styled-components/es/components/TextField/TextField.styles.js +17 -9
  107. package/styled-components/es/components/TextField/TextField.template-doc.mdx +24 -0
  108. package/styled-components/es/components/TextField/TextField.tokens.js +67 -20
  109. package/styled-components/es/components/TextField/hooks/index.js +1 -0
  110. package/styled-components/es/components/TextField/hooks/useKeyNavigation.js +132 -0
  111. package/styled-components/es/components/TextField/index.js +2 -2
  112. package/styled-components/es/components/TextField/ui/TextFieldChip/TextFieldChip.js +30 -0
  113. package/styled-components/es/components/TextField/ui/TextFieldChip/TextFieldChip.styles.js +19 -0
  114. package/styled-components/es/components/TextField/ui/TextFieldChip/TextFieldChip.types.js +1 -0
  115. package/styled-components/es/components/TextField/ui/index.js +1 -0
  116. package/styled-components/es/components/TextField/variations/_disabled/base.js +4 -0
  117. package/styled-components/es/components/TextField/variations/_label-placement/inner.js +4 -0
  118. package/styled-components/es/components/TextField/variations/_label-placement/outer.js +4 -0
  119. package/styled-components/es/components/TextField/variations/_read-only/base.js +4 -0
  120. package/styled-components/es/components/TextField/variations/_read-only/tokens.json +1 -0
  121. package/styled-components/es/components/TextField/variations/_size/base.js +4 -0
  122. package/styled-components/es/components/TextField/variations/_view/base.js +4 -0
  123. package/styled-components/es/examples/plasma_b2c/components/TextField/TextField.config.js +37 -0
  124. package/styled-components/es/examples/plasma_b2c/components/TextField/TextField.js +5 -0
  125. package/styled-components/es/examples/plasma_b2c/components/TextField/TextField.stories.tsx +181 -0
  126. package/styled-components/es/examples/plasma_web/components/TextField/TextField.config.js +34 -0
  127. package/styled-components/es/examples/plasma_web/components/TextField/TextField.js +5 -0
  128. package/styled-components/es/examples/plasma_web/components/TextField/TextField.stories.tsx +181 -0
  129. package/styled-components/es/examples/sds_engineer/components/TextField/TextField.config.js +37 -0
  130. package/styled-components/es/examples/sds_engineer/components/TextField/TextField.js +5 -0
  131. package/styled-components/es/examples/sds_engineer/components/TextField/TextField.stories.tsx +181 -0
  132. package/types/components/TextField/TextField.d.ts +8 -3
  133. package/types/components/TextField/TextField.d.ts.map +1 -1
  134. package/types/components/TextField/TextField.styles.d.ts +6 -3
  135. package/types/components/TextField/TextField.styles.d.ts.map +1 -1
  136. package/types/components/TextField/TextField.tokens.d.ts +57 -8
  137. package/types/components/TextField/TextField.tokens.d.ts.map +1 -1
  138. package/types/components/TextField/TextField.types.d.ts +71 -6
  139. package/types/components/TextField/TextField.types.d.ts.map +1 -1
  140. package/types/components/TextField/hooks/index.d.ts +2 -0
  141. package/types/components/TextField/hooks/index.d.ts.map +1 -0
  142. package/types/components/TextField/hooks/useKeyNavigation.d.ts +17 -0
  143. package/types/components/TextField/hooks/useKeyNavigation.d.ts.map +1 -0
  144. package/types/components/TextField/index.d.ts +3 -2
  145. package/types/components/TextField/index.d.ts.map +1 -1
  146. package/types/components/TextField/ui/TextFieldChip/TextFieldChip.d.ts +7 -0
  147. package/types/components/TextField/ui/TextFieldChip/TextFieldChip.d.ts.map +1 -0
  148. package/types/components/TextField/ui/TextFieldChip/TextFieldChip.styles.d.ts +3 -0
  149. package/types/components/TextField/ui/TextFieldChip/TextFieldChip.styles.d.ts.map +1 -0
  150. package/types/components/TextField/ui/TextFieldChip/TextFieldChip.types.d.ts +37 -0
  151. package/types/components/TextField/ui/TextFieldChip/TextFieldChip.types.d.ts.map +1 -0
  152. package/types/components/TextField/ui/index.d.ts +2 -0
  153. package/types/components/TextField/ui/index.d.ts.map +1 -0
  154. package/types/components/TextField/variations/_disabled/base.d.ts.map +1 -0
  155. package/types/components/TextField/variations/_label-placement/base.d.ts.map +1 -0
  156. package/types/components/TextField/variations/_label-placement/index.d.ts.map +1 -0
  157. package/types/components/TextField/variations/_label-placement/inner.d.ts.map +1 -0
  158. package/types/components/TextField/variations/_label-placement/outer.d.ts.map +1 -0
  159. package/types/components/TextField/variations/_read-only/base.d.ts.map +1 -0
  160. package/types/components/TextField/variations/_size/base.d.ts.map +1 -0
  161. package/types/components/TextField/variations/_view/base.d.ts +2 -0
  162. package/types/components/TextField/variations/_view/base.d.ts.map +1 -0
  163. package/types/examples/plasma_b2c/components/TextField/TextField.config.d.ts +32 -0
  164. package/types/examples/plasma_b2c/components/TextField/TextField.config.d.ts.map +1 -0
  165. package/types/examples/plasma_b2c/components/TextField/TextField.d.ts +60 -0
  166. package/types/examples/plasma_b2c/components/TextField/TextField.d.ts.map +1 -0
  167. package/types/examples/plasma_web/components/TextField/TextField.config.d.ts +32 -0
  168. package/types/examples/plasma_web/components/TextField/TextField.config.d.ts.map +1 -0
  169. package/types/examples/plasma_web/components/TextField/TextField.d.ts +60 -0
  170. package/types/examples/plasma_web/components/TextField/TextField.d.ts.map +1 -0
  171. package/types/examples/sds_engineer/components/TextField/TextField.config.d.ts +32 -0
  172. package/types/examples/sds_engineer/components/TextField/TextField.config.d.ts.map +1 -0
  173. package/types/examples/sds_engineer/components/TextField/TextField.d.ts +60 -0
  174. package/types/examples/sds_engineer/components/TextField/TextField.d.ts.map +1 -0
  175. package/cjs/components/TextField/TextField.styles_2qw1n8.css +0 -5
  176. package/cjs/components/TextField/TextField_1lzb2r1.css +0 -1
  177. package/cjs/components/TextField/_disabled/base.js.map +0 -1
  178. package/cjs/components/TextField/_disabled/base_so3w81.css +0 -1
  179. package/cjs/components/TextField/_label-placement/base.js.map +0 -1
  180. package/cjs/components/TextField/_label-placement/inner.js.map +0 -1
  181. package/cjs/components/TextField/_label-placement/inner_1tyuicp.css +0 -1
  182. package/cjs/components/TextField/_label-placement/outer.js.map +0 -1
  183. package/cjs/components/TextField/_label-placement/outer_19ekaek.css +0 -1
  184. package/cjs/components/TextField/_size/base.js.map +0 -1
  185. package/cjs/components/TextField/_size/base_b5smyu.css +0 -1
  186. package/cjs/components/TextField/_view/base.js.map +0 -1
  187. package/cjs/components/TextField/_view/base_5bqzed.css +0 -1
  188. package/es/components/TextField/TextField.styles_2qw1n8.css +0 -5
  189. package/es/components/TextField/TextField_1lzb2r1.css +0 -1
  190. package/es/components/TextField/_disabled/base.js.map +0 -1
  191. package/es/components/TextField/_disabled/base_so3w81.css +0 -1
  192. package/es/components/TextField/_label-placement/base.js.map +0 -1
  193. package/es/components/TextField/_label-placement/inner.js +0 -5
  194. package/es/components/TextField/_label-placement/inner.js.map +0 -1
  195. package/es/components/TextField/_label-placement/inner_1tyuicp.css +0 -1
  196. package/es/components/TextField/_label-placement/outer.js +0 -5
  197. package/es/components/TextField/_label-placement/outer.js.map +0 -1
  198. package/es/components/TextField/_label-placement/outer_19ekaek.css +0 -1
  199. package/es/components/TextField/_size/base.js +0 -5
  200. package/es/components/TextField/_size/base.js.map +0 -1
  201. package/es/components/TextField/_size/base_b5smyu.css +0 -1
  202. package/es/components/TextField/_view/base.js +0 -5
  203. package/es/components/TextField/_view/base.js.map +0 -1
  204. package/es/components/TextField/_view/base_5bqzed.css +0 -1
  205. package/styled-components/cjs/components/TextField/_disabled/base.js +0 -9
  206. package/styled-components/cjs/components/TextField/_label-placement/inner.js +0 -10
  207. package/styled-components/cjs/components/TextField/_size/base.js +0 -10
  208. package/styled-components/cjs/components/TextField/_view/base.js +0 -10
  209. package/styled-components/es/components/TextField/_disabled/base.js +0 -3
  210. package/styled-components/es/components/TextField/_label-placement/inner.js +0 -4
  211. package/styled-components/es/components/TextField/_label-placement/outer.js +0 -4
  212. package/styled-components/es/components/TextField/_size/base.js +0 -4
  213. package/styled-components/es/components/TextField/_view/base.js +0 -4
  214. package/types/components/TextField/_disabled/base.d.ts.map +0 -1
  215. package/types/components/TextField/_label-placement/base.d.ts.map +0 -1
  216. package/types/components/TextField/_label-placement/index.d.ts.map +0 -1
  217. package/types/components/TextField/_label-placement/inner.d.ts.map +0 -1
  218. package/types/components/TextField/_label-placement/outer.d.ts.map +0 -1
  219. package/types/components/TextField/_size/base.d.ts.map +0 -1
  220. package/types/components/TextField/_view/base.d.ts.map +0 -1
  221. /package/cjs/components/TextField/{_label-placement → variations/_label-placement}/base_x642ct.css +0 -0
  222. /package/es/components/TextField/{_label-placement → variations/_label-placement}/base_x642ct.css +0 -0
  223. /package/styled-components/cjs/components/TextField/{_disabled → variations/_disabled}/tokens.json +0 -0
  224. /package/styled-components/cjs/components/TextField/{_label-placement → variations/_label-placement}/base.js +0 -0
  225. /package/styled-components/cjs/components/TextField/{_label-placement → variations/_label-placement}/index.js +0 -0
  226. /package/styled-components/cjs/components/TextField/{_size → variations/_size}/tokens.json +0 -0
  227. /package/styled-components/cjs/components/TextField/{_view → variations/_view}/tokens.json +0 -0
  228. /package/styled-components/es/components/TextField/{_disabled → variations/_disabled}/tokens.json +0 -0
  229. /package/styled-components/es/components/TextField/{_label-placement → variations/_label-placement}/base.js +0 -0
  230. /package/styled-components/es/components/TextField/{_label-placement → variations/_label-placement}/index.js +0 -0
  231. /package/styled-components/es/components/TextField/{_size → variations/_size}/tokens.json +0 -0
  232. /package/styled-components/es/components/TextField/{_view → variations/_view}/tokens.json +0 -0
  233. /package/types/components/TextField/{_disabled → variations/_disabled}/base.d.ts +0 -0
  234. /package/types/components/TextField/{_label-placement → variations/_label-placement}/base.d.ts +0 -0
  235. /package/types/components/TextField/{_label-placement → variations/_label-placement}/index.d.ts +0 -0
  236. /package/types/components/TextField/{_label-placement → variations/_label-placement}/inner.d.ts +0 -0
  237. /package/types/components/TextField/{_label-placement → variations/_label-placement}/outer.d.ts +0 -0
  238. /package/types/components/TextField/{_size → variations/_read-only}/base.d.ts +0 -0
  239. /package/types/components/TextField/{_view → variations/_size}/base.d.ts +0 -0
@@ -0,0 +1,181 @@
1
+ import React, { ComponentProps, useState } from 'react';
2
+ import type { StoryObj, Meta } from '@storybook/react';
3
+ import { action } from '@storybook/addon-actions';
4
+ import { IconPlaceholder } from '@salutejs/plasma-sb-utils';
5
+
6
+ import { WithTheme } from '../../../_helpers';
7
+
8
+ import { TextField } from './TextField';
9
+
10
+ const onChange = action('onChange');
11
+ const onFocus = action('onFocus');
12
+ const onBlur = action('onBlur');
13
+ const onSearch = action('onSearch');
14
+ const onChipsChange = action('onChipsChange');
15
+
16
+ const sizes = ['l', 'm', 's', 'xs'];
17
+ const views = ['default', 'positive', 'warning', 'negative'];
18
+ const labelPlacements = ['outer', 'inner'];
19
+
20
+ const meta: Meta<typeof TextField> = {
21
+ title: 'plasma_web/TextField',
22
+ component: TextField,
23
+ decorators: [WithTheme],
24
+ argTypes: {
25
+ view: {
26
+ options: views,
27
+ control: {
28
+ type: 'select',
29
+ },
30
+ },
31
+ maxLength: {
32
+ control: {
33
+ type: 'number',
34
+ },
35
+ },
36
+ labelPlacement: {
37
+ options: labelPlacements,
38
+ control: {
39
+ type: 'inline-radio',
40
+ },
41
+ },
42
+ size: {
43
+ options: sizes,
44
+ control: {
45
+ type: 'inline-radio',
46
+ },
47
+ },
48
+ },
49
+ };
50
+
51
+ export default meta;
52
+
53
+ type StoryPropsDefault = Omit<
54
+ ComponentProps<typeof TextField>,
55
+ | 'helperBlock'
56
+ | 'contentLeft'
57
+ | 'htmlSize'
58
+ | 'contentRight'
59
+ | 'type'
60
+ | 'name'
61
+ | 'onFocus'
62
+ | 'onBlur'
63
+ | 'onChange'
64
+ | 'value'
65
+ | 'checked'
66
+ | 'maxLength'
67
+ | 'minLength'
68
+ | 'required'
69
+ | 'enumerationType'
70
+ | 'chips'
71
+ | 'onChangeChips'
72
+ > & {
73
+ 'storybook:contentLeft': boolean;
74
+ 'storybook:contentRight': boolean;
75
+ };
76
+
77
+ const StoryDemo = ({
78
+ 'storybook:contentLeft': enableContentLeft,
79
+ 'storybook:contentRight': enableContentRight,
80
+ view,
81
+ ...rest
82
+ }: StoryPropsDefault) => {
83
+ const [text, setText] = useState('Значение поля');
84
+
85
+ const iconSize = rest.size === 'xs' ? 'xs' : 's';
86
+
87
+ return (
88
+ <TextField
89
+ {...rest}
90
+ enumerationType="plain"
91
+ value={text}
92
+ contentLeft={enableContentLeft ? <IconPlaceholder size={iconSize} /> : undefined}
93
+ contentRight={enableContentRight ? <IconPlaceholder size={iconSize} /> : undefined}
94
+ view={view}
95
+ onChange={(e) => {
96
+ setText(e.target.value);
97
+ onChange(e.target.value);
98
+ }}
99
+ onFocus={onFocus}
100
+ onBlur={onBlur}
101
+ onSearch={onSearch}
102
+ />
103
+ );
104
+ };
105
+
106
+ export const Default: StoryObj<StoryPropsDefault> = {
107
+ args: {
108
+ id: 'example-text-field',
109
+ size: 'l',
110
+ view: 'default',
111
+ label: 'Лейбл',
112
+ labelPlacement: 'outer',
113
+ placeholder: 'Заполните поле',
114
+ leftHelper: 'Подсказка к полю',
115
+ disabled: false,
116
+ readOnly: false,
117
+ 'storybook:contentLeft': true,
118
+ 'storybook:contentRight': true,
119
+ },
120
+ render: (args) => <StoryDemo {...args} />,
121
+ };
122
+
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> = {
176
+ args: {
177
+ ...Default.args,
178
+ chips: ['1 value', '2 value', '3 value', '4 value'],
179
+ },
180
+ render: (args) => <StoryChips {...args} />,
181
+ };
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.config = void 0;
7
+ var _styledComponents = /*#__PURE__*/require("styled-components");
8
+ var _TextField = /*#__PURE__*/require("../../../../components/TextField");
9
+ var config = exports.config = {
10
+ defaults: {
11
+ view: 'default',
12
+ size: 'l',
13
+ labelPlacement: 'outer'
14
+ },
15
+ variations: {
16
+ view: {
17
+ "default": /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--text-primary);", ":var(--surface-transparent-primary);", ":var(--surface-transparent-secondary);", ":var(--text-accent);", ":var(--text-secondary);", ":var(--text-primary);", ":var(--text-secondary);", ":var(--text-secondary);", ":var(--surface-clear);", ":var(--text-secondary);", ":var(--text-secondary);", ":var(--text-primary);", ":var(--surface-transparent-secondary);", ":var(--text-primary);", ":var(--surface-transparent-secondary-hover);", ":var(--text-primary);", ":var(--surface-transparent-secondary-active);", ":var(--surface-transparent-secondary);", ":var(--text-primary);", ":var(--surface-transparent-secondary);", ":var(--text-primary);", ":0.72;", ":var(--text-accent);"], _TextField.textFieldTokens.color, _TextField.textFieldTokens.backgroundColor, _TextField.textFieldTokens.backgroundColorFocus, _TextField.textFieldTokens.caretColor, _TextField.textFieldTokens.placeholderColor, _TextField.textFieldTokens.labelColor, _TextField.textFieldTokens.leftHelperColor, _TextField.textFieldTokens.colorReadOnly, _TextField.textFieldTokens.backgroundColorReadOnly, _TextField.textFieldTokens.placeholderColorReadOnly, _TextField.textFieldTokens.chipCloseIconColor, _TextField.textFieldTokens.chipColor, _TextField.textFieldTokens.chipBackground, _TextField.textFieldTokens.chipColorHover, _TextField.textFieldTokens.chipBackgroundHover, _TextField.textFieldTokens.chipColorActive, _TextField.textFieldTokens.chipBackgroundActive, _TextField.textFieldTokens.chipBackgroundReadOnly, _TextField.textFieldTokens.chipColorReadOnly, _TextField.textFieldTokens.chipBackgroundReadOnlyHover, _TextField.textFieldTokens.chipColorReadOnlyHover, _TextField.textFieldTokens.chipOpacityReadonly, _TextField.textFieldTokens.focusColor),
18
+ // TODO заменить --surface-transparent-positive на корректный токен
19
+ positive: /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--plasma-colors-primary);", ":var(--surface-transparent-positive);", ":var(--surface-transparent-positive-active);", ":var(--text-accent);", ":var(--text-secondary);", ":var(--text-primary);", ":var(--text-positive);", ":var(--text-secondary);", ":var(--surface-clear);", ":var(--text-secondary);", ":var(--text-secondary);", ":var(--text-primary);", ":var(--surface-transparent-secondary);", ":var(--text-primary);", ":var(--surface-transparent-secondary-hover);", ":var(--text-primary);", ":var(--surface-transparent-secondary-active);", ":var(--surface-transparent-secondary);", ":var(--text-primary);", ":var(--surface-transparent-secondary);", ":var(--text-primary);", ":0.72;", ":var(--text-accent);"], _TextField.textFieldTokens.color, _TextField.textFieldTokens.backgroundColor, _TextField.textFieldTokens.backgroundColorFocus, _TextField.textFieldTokens.caretColor, _TextField.textFieldTokens.placeholderColor, _TextField.textFieldTokens.labelColor, _TextField.textFieldTokens.leftHelperColor, _TextField.textFieldTokens.colorReadOnly, _TextField.textFieldTokens.backgroundColorReadOnly, _TextField.textFieldTokens.placeholderColorReadOnly, _TextField.textFieldTokens.chipCloseIconColor, _TextField.textFieldTokens.chipColor, _TextField.textFieldTokens.chipBackground, _TextField.textFieldTokens.chipColorHover, _TextField.textFieldTokens.chipBackgroundHover, _TextField.textFieldTokens.chipColorActive, _TextField.textFieldTokens.chipBackgroundActive, _TextField.textFieldTokens.chipBackgroundReadOnly, _TextField.textFieldTokens.chipColorReadOnly, _TextField.textFieldTokens.chipBackgroundReadOnlyHover, _TextField.textFieldTokens.chipColorReadOnlyHover, _TextField.textFieldTokens.chipOpacityReadonly, _TextField.textFieldTokens.focusColor),
20
+ // // TODO заменить --surface-transparent-warning на корректный токен
21
+ warning: /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--plasma-colors-primary);", ":var(--surface-transparent-warning);", ":var(--surface-transparent-warning-active);", ":var(--text-accent);", ":var(--text-secondary);", ":var(--text-primary);", ":var(--text-warning);", ":var(--text-secondary);", ":var(--surface-clear);", ":var(--text-secondary);", ":var(--text-secondary);", ":var(--text-primary);", ":var(--surface-transparent-secondary);", ":var(--text-primary);", ":var(--surface-transparent-secondary-hover);", ":var(--text-primary);", ":var(--surface-transparent-secondary-active);", ":var(--surface-transparent-secondary);", ":var(--text-primary);", ":var(--surface-transparent-secondary);", ":var(--text-primary);", ":0.72;", ":var(--text-accent);"], _TextField.textFieldTokens.color, _TextField.textFieldTokens.backgroundColor, _TextField.textFieldTokens.backgroundColorFocus, _TextField.textFieldTokens.caretColor, _TextField.textFieldTokens.placeholderColor, _TextField.textFieldTokens.labelColor, _TextField.textFieldTokens.leftHelperColor, _TextField.textFieldTokens.colorReadOnly, _TextField.textFieldTokens.backgroundColorReadOnly, _TextField.textFieldTokens.placeholderColorReadOnly, _TextField.textFieldTokens.chipCloseIconColor, _TextField.textFieldTokens.chipColor, _TextField.textFieldTokens.chipBackground, _TextField.textFieldTokens.chipColorHover, _TextField.textFieldTokens.chipBackgroundHover, _TextField.textFieldTokens.chipColorActive, _TextField.textFieldTokens.chipBackgroundActive, _TextField.textFieldTokens.chipBackgroundReadOnly, _TextField.textFieldTokens.chipColorReadOnly, _TextField.textFieldTokens.chipBackgroundReadOnlyHover, _TextField.textFieldTokens.chipColorReadOnlyHover, _TextField.textFieldTokens.chipOpacityReadonly, _TextField.textFieldTokens.focusColor),
22
+ // // TODO заменить --surface-transparent-negative на корректный токен
23
+ negative: /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--plasma-colors-primary);", ":var(--surface-transparent-negative);", ":var(--surface-transparent-negative-active);", ":var(--text-accent);", ":var(--text-secondary);", ":var(--text-primary);", ":var(--text-negative);", ":var(--text-secondary);", ":var(--surface-clear);", ":var(--text-secondary);", ":var(--text-secondary);", ":var(--text-primary);", ":var(--surface-transparent-secondary);", ":var(--text-primary);", ":var(--surface-transparent-secondary-hover);", ":var(--text-primary);", ":var(--surface-transparent-secondary-active);", ":var(--surface-transparent-secondary);", ":var(--text-primary);", ":var(--surface-transparent-secondary);", ":var(--text-primary);", ":0.72;", ":var(--text-accent);"], _TextField.textFieldTokens.color, _TextField.textFieldTokens.backgroundColor, _TextField.textFieldTokens.backgroundColorFocus, _TextField.textFieldTokens.caretColor, _TextField.textFieldTokens.placeholderColor, _TextField.textFieldTokens.labelColor, _TextField.textFieldTokens.leftHelperColor, _TextField.textFieldTokens.colorReadOnly, _TextField.textFieldTokens.backgroundColorReadOnly, _TextField.textFieldTokens.placeholderColorReadOnly, _TextField.textFieldTokens.chipCloseIconColor, _TextField.textFieldTokens.chipColor, _TextField.textFieldTokens.chipBackground, _TextField.textFieldTokens.chipColorHover, _TextField.textFieldTokens.chipBackgroundHover, _TextField.textFieldTokens.chipColorActive, _TextField.textFieldTokens.chipBackgroundActive, _TextField.textFieldTokens.chipBackgroundReadOnly, _TextField.textFieldTokens.chipColorReadOnly, _TextField.textFieldTokens.chipBackgroundReadOnlyHover, _TextField.textFieldTokens.chipColorReadOnlyHover, _TextField.textFieldTokens.chipOpacityReadonly, _TextField.textFieldTokens.focusColor)
24
+ },
25
+ size: {
26
+ l: /*#__PURE__*/(0, _styledComponents.css)(["", ":3.5rem;", ":1.0625rem 1.125rem 1.0625rem 1.125rem;", ":0.375rem;", ":0.875rem;", ":-0.0625rem 0.5rem -0.0625rem -0.125rem;", ":-0.0625rem -0.125rem -0.0625rem 0.75rem;", ":var(--plasma-typo-body-l-font-family);", ":var(--plasma-typo-body-l-font-size);", ":var(--plasma-typo-body-l-font-style);", ":var(--plasma-typo-body-l-font-weight);", ":var(--plasma-typo-body-l-letter-spacing);", ":var(--plasma-typo-body-l-line-height);", ":0.75rem;", ":var(--plasma-typo-body-l-font-family);", ":var(--plasma-typo-body-l-font-size);", ":var(--plasma-typo-body-l-font-style);", ":var(--plasma-typo-body-l-font-weight);", ":var(--plasma-typo-body-l-letter-spacing);", ":var(--plasma-typo-body-l-line-height);", ":0.25rem;", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":0.5625rem 0 0.125rem 0;", ":1.5625rem 0 0.5625rem 0;", ":0.25rem;", ":0.5rem;", ":auto;", ":2.75rem;", ":0.75rem;", ":1rem;", ":0.625rem;", ":0rem;", ":1.5rem;", ":var(--plasma-typo-body-l-font-family);", ":var(--plasma-typo-body-l-font-size);", ":var(--plasma-typo-body-l-font-style);", ":var(--plasma-typo-body-l-font-weight);", ":var(--plasma-typo-body-l-letter-spacing);", ":var(--plasma-typo-body-l-line-height);"], _TextField.textFieldTokens.height, _TextField.textFieldTokens.padding, _TextField.textFieldTokens.paddingWithChips, _TextField.textFieldTokens.borderRadius, _TextField.textFieldTokens.leftContentMargin, _TextField.textFieldTokens.rightContentMargin, _TextField.textFieldTokens.fontFamily, _TextField.textFieldTokens.fontSize, _TextField.textFieldTokens.fontStyle, _TextField.textFieldTokens.fontWeight, _TextField.textFieldTokens.letterSpacing, _TextField.textFieldTokens.lineHeight, _TextField.textFieldTokens.labelOffset, _TextField.textFieldTokens.labelFontFamily, _TextField.textFieldTokens.labelFontSize, _TextField.textFieldTokens.labelFontStyle, _TextField.textFieldTokens.labelFontWeight, _TextField.textFieldTokens.labelLetterSpacing, _TextField.textFieldTokens.labelLineHeight, _TextField.textFieldTokens.leftHelperOffset, _TextField.textFieldTokens.leftHelperFontFamily, _TextField.textFieldTokens.leftHelperFontSize, _TextField.textFieldTokens.leftHelperFontStyle, _TextField.textFieldTokens.leftHelperFontWeight, _TextField.textFieldTokens.leftHelperLetterSpacing, _TextField.textFieldTokens.leftHelperLineHeight, _TextField.textFieldTokens.labelInnerPadding, _TextField.textFieldTokens.contentLabelInnerPadding, _TextField.textFieldTokens.chipGap, _TextField.textFieldTokens.chipBorderRadius, _TextField.textFieldTokens.chipWidth, _TextField.textFieldTokens.chipHeight, _TextField.textFieldTokens.chipPaddingRight, _TextField.textFieldTokens.chipPaddingLeft, _TextField.textFieldTokens.chipClearContentMarginLeft, _TextField.textFieldTokens.chipClearContentMarginRight, _TextField.textFieldTokens.chipCloseIconSize, _TextField.textFieldTokens.chipFontFamily, _TextField.textFieldTokens.chipFontSize, _TextField.textFieldTokens.chipFontStyle, _TextField.textFieldTokens.chipFontWeight, _TextField.textFieldTokens.chipLetterSpacing, _TextField.textFieldTokens.chipLineHeight),
27
+ m: /*#__PURE__*/(0, _styledComponents.css)(["", ":3rem;", ":0.875rem 1rem 0.875rem 1rem;", ":0.375rem;", ":0.75rem;", ":-0.125rem 0.375rem -0.125rem -0.125rem;", ":-0.125rem -0.125rem -0.125rem 0.75rem;", ":var(--plasma-typo-body-m-font-family);", ":var(--plasma-typo-body-m-font-size);", ":var(--plasma-typo-body-m-font-style);", ":var(--plasma-typo-body-m-font-weight);", ":var(--plasma-typo-body-m-letter-spacing);", ":var(--plasma-typo-body-m-line-height);", ":0.625rem;", ":var(--plasma-typo-body-m-font-family);", ":var(--plasma-typo-body-m-font-size);", ":var(--plasma-typo-body-m-font-style);", ":var(--plasma-typo-body-m-font-weight);", ":var(--plasma-typo-body-m-letter-spacing);", ":var(--plasma-typo-body-m-line-height);", ":0.25rem;", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":0.375rem 0 0.125rem 0;", ":1.375rem 0 0.375rem 0;", ":0.25rem;", ":0.375rem;", ":auto;", ":2.25rem;", ":0.625rem;", ":0.875rem;", ":0.5rem;", ":0rem;", ":1.25rem;", ":var(--plasma-typo-body-m-font-family);", ":var(--plasma-typo-body-m-font-size);", ":var(--plasma-typo-body-m-font-style);", ":var(--plasma-typo-body-m-font-weight);", ":var(--plasma-typo-body-m-letter-spacing);", ":var(--plasma-typo-body-m-line-height);"], _TextField.textFieldTokens.height, _TextField.textFieldTokens.padding, _TextField.textFieldTokens.paddingWithChips, _TextField.textFieldTokens.borderRadius, _TextField.textFieldTokens.leftContentMargin, _TextField.textFieldTokens.rightContentMargin, _TextField.textFieldTokens.fontFamily, _TextField.textFieldTokens.fontSize, _TextField.textFieldTokens.fontStyle, _TextField.textFieldTokens.fontWeight, _TextField.textFieldTokens.letterSpacing, _TextField.textFieldTokens.lineHeight, _TextField.textFieldTokens.labelOffset, _TextField.textFieldTokens.labelFontFamily, _TextField.textFieldTokens.labelFontSize, _TextField.textFieldTokens.labelFontStyle, _TextField.textFieldTokens.labelFontWeight, _TextField.textFieldTokens.labelLetterSpacing, _TextField.textFieldTokens.labelLineHeight, _TextField.textFieldTokens.leftHelperOffset, _TextField.textFieldTokens.leftHelperFontFamily, _TextField.textFieldTokens.leftHelperFontSize, _TextField.textFieldTokens.leftHelperFontStyle, _TextField.textFieldTokens.leftHelperFontWeight, _TextField.textFieldTokens.leftHelperLetterSpacing, _TextField.textFieldTokens.leftHelperLineHeight, _TextField.textFieldTokens.labelInnerPadding, _TextField.textFieldTokens.contentLabelInnerPadding, _TextField.textFieldTokens.chipGap, _TextField.textFieldTokens.chipBorderRadius, _TextField.textFieldTokens.chipWidth, _TextField.textFieldTokens.chipHeight, _TextField.textFieldTokens.chipPaddingRight, _TextField.textFieldTokens.chipPaddingLeft, _TextField.textFieldTokens.chipClearContentMarginLeft, _TextField.textFieldTokens.chipClearContentMarginRight, _TextField.textFieldTokens.chipCloseIconSize, _TextField.textFieldTokens.chipFontFamily, _TextField.textFieldTokens.chipFontSize, _TextField.textFieldTokens.chipFontStyle, _TextField.textFieldTokens.chipFontWeight, _TextField.textFieldTokens.chipLetterSpacing, _TextField.textFieldTokens.chipLineHeight),
28
+ s: /*#__PURE__*/(0, _styledComponents.css)(["", ":2.5rem;", ":0.6875rem 0.875rem 0.6875rem 0.875rem;", ":0.375rem;", ":0.625rem;", ":-0.1875rem 0.25rem -0.1875rem -0.125rem;", ":-0.1875rem -0.125rem -0.1875rem 0.75rem;", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-font-weight);", ":var(--plasma-typo-body-s-letter-spacing);", ":var(--plasma-typo-body-s-line-height);", ":0.5rem;", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-font-weight);", ":var(--plasma-typo-body-s-letter-spacing);", ":var(--plasma-typo-body-s-line-height);", ":0.25rem;", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":0.3125rem 0 0 0;", ":1.0625rem 0 0.3125rem 0;", ":0.25rem;", ":0.25rem;", ":auto;", ":1.75rem;", ":0.5rem;", ":0.75rem;", ":0.375rem;", ":0rem;", ":1rem;", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-font-weight);", ":var(--plasma-typo-body-s-letter-spacing);", ":var(--plasma-typo-body-s-line-height);"], _TextField.textFieldTokens.height, _TextField.textFieldTokens.padding, _TextField.textFieldTokens.paddingWithChips, _TextField.textFieldTokens.borderRadius, _TextField.textFieldTokens.leftContentMargin, _TextField.textFieldTokens.rightContentMargin, _TextField.textFieldTokens.fontFamily, _TextField.textFieldTokens.fontSize, _TextField.textFieldTokens.fontStyle, _TextField.textFieldTokens.fontWeight, _TextField.textFieldTokens.letterSpacing, _TextField.textFieldTokens.lineHeight, _TextField.textFieldTokens.labelOffset, _TextField.textFieldTokens.labelFontFamily, _TextField.textFieldTokens.labelFontSize, _TextField.textFieldTokens.labelFontStyle, _TextField.textFieldTokens.labelFontWeight, _TextField.textFieldTokens.labelLetterSpacing, _TextField.textFieldTokens.labelLineHeight, _TextField.textFieldTokens.leftHelperOffset, _TextField.textFieldTokens.leftHelperFontFamily, _TextField.textFieldTokens.leftHelperFontSize, _TextField.textFieldTokens.leftHelperFontStyle, _TextField.textFieldTokens.leftHelperFontWeight, _TextField.textFieldTokens.leftHelperLetterSpacing, _TextField.textFieldTokens.leftHelperLineHeight, _TextField.textFieldTokens.labelInnerPadding, _TextField.textFieldTokens.contentLabelInnerPadding, _TextField.textFieldTokens.chipGap, _TextField.textFieldTokens.chipBorderRadius, _TextField.textFieldTokens.chipWidth, _TextField.textFieldTokens.chipHeight, _TextField.textFieldTokens.chipPaddingRight, _TextField.textFieldTokens.chipPaddingLeft, _TextField.textFieldTokens.chipClearContentMarginLeft, _TextField.textFieldTokens.chipClearContentMarginRight, _TextField.textFieldTokens.chipCloseIconSize, _TextField.textFieldTokens.chipFontFamily, _TextField.textFieldTokens.chipFontSize, _TextField.textFieldTokens.chipFontStyle, _TextField.textFieldTokens.chipFontWeight, _TextField.textFieldTokens.chipLetterSpacing, _TextField.textFieldTokens.chipLineHeight),
29
+ xs: /*#__PURE__*/(0, _styledComponents.css)(["", ":2rem;", ":0.5625rem 0.625rem 0.5625rem 0.625rem;", ":0.375rem;", ":0.5rem;", ":-0.0625rem 0.25rem -0.0625rem -0.125rem;", ":-0.0625rem -0.125rem -0.0625rem 0.75rem;", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":0.375rem;", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":0.25rem;", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":0.3125rem 0 0 0;", ":1.0625rem 0 0.3125rem 0;", ":0.25rem;", ":0.125rem;", ":auto;", ":1.25rem;", ":0.375rem;", ":0.625rem;", ":0.25rem;", ":0rem;", ":0.75rem;", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);"], _TextField.textFieldTokens.height, _TextField.textFieldTokens.padding, _TextField.textFieldTokens.paddingWithChips, _TextField.textFieldTokens.borderRadius, _TextField.textFieldTokens.leftContentMargin, _TextField.textFieldTokens.rightContentMargin, _TextField.textFieldTokens.fontFamily, _TextField.textFieldTokens.fontSize, _TextField.textFieldTokens.fontStyle, _TextField.textFieldTokens.fontWeight, _TextField.textFieldTokens.letterSpacing, _TextField.textFieldTokens.lineHeight, _TextField.textFieldTokens.labelOffset, _TextField.textFieldTokens.labelFontFamily, _TextField.textFieldTokens.labelFontSize, _TextField.textFieldTokens.labelFontStyle, _TextField.textFieldTokens.labelFontWeight, _TextField.textFieldTokens.labelLetterSpacing, _TextField.textFieldTokens.labelLineHeight, _TextField.textFieldTokens.leftHelperOffset, _TextField.textFieldTokens.leftHelperFontFamily, _TextField.textFieldTokens.leftHelperFontSize, _TextField.textFieldTokens.leftHelperFontStyle, _TextField.textFieldTokens.leftHelperFontWeight, _TextField.textFieldTokens.leftHelperLetterSpacing, _TextField.textFieldTokens.leftHelperLineHeight, _TextField.textFieldTokens.labelInnerPadding, _TextField.textFieldTokens.contentLabelInnerPadding, _TextField.textFieldTokens.chipGap, _TextField.textFieldTokens.chipBorderRadius, _TextField.textFieldTokens.chipWidth, _TextField.textFieldTokens.chipHeight, _TextField.textFieldTokens.chipPaddingRight, _TextField.textFieldTokens.chipPaddingLeft, _TextField.textFieldTokens.chipClearContentMarginLeft, _TextField.textFieldTokens.chipClearContentMarginRight, _TextField.textFieldTokens.chipCloseIconSize, _TextField.textFieldTokens.chipFontFamily, _TextField.textFieldTokens.chipFontSize, _TextField.textFieldTokens.chipFontStyle, _TextField.textFieldTokens.chipFontWeight, _TextField.textFieldTokens.chipLetterSpacing, _TextField.textFieldTokens.chipLineHeight)
30
+ },
31
+ labelPlacement: {
32
+ inner: [_TextField.textField_labelPlacement_inner, /*#__PURE__*/(0, _styledComponents.css)(["&.", "{", ":var(--plasma-input-label-color,var(--plasma-input-placeholder-color,var(--plasma-colors-secondary)));", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);}"], _TextField.textField_labelPlacement_inner, _TextField.textFieldTokens.placeholderColor, _TextField.textFieldTokens.labelInnerFontFamily, _TextField.textFieldTokens.labelInnerFontSize, _TextField.textFieldTokens.labelInnerFontStyle, _TextField.textFieldTokens.labelInnerFontWeight, _TextField.textFieldTokens.labelInnerLetterSpacing, _TextField.textFieldTokens.labelInnerLineHeight)],
33
+ outer: [_TextField.textField_labelPlacement_outer, /*#__PURE__*/(0, _styledComponents.css)(["&.", "{}"], _TextField.textField_labelPlacement_outer)]
34
+ },
35
+ disabled: {
36
+ "true": /*#__PURE__*/(0, _styledComponents.css)(["", ":0.4;"], _TextField.textFieldTokens.disabledOpacity)
37
+ },
38
+ // TODO заменить --surface-transparent-primary на корректный токен
39
+ readOnly: {
40
+ "true": /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--text-secondary);", ":var(--surface-transparent-primary);", ":var(--text-secondary);", ":var(--text-secondary);", ":var(--text-secondary);"], _TextField.textFieldTokens.colorReadOnly, _TextField.textFieldTokens.backgroundColorReadOnly, _TextField.textFieldTokens.placeholderColorReadOnly, _TextField.textFieldTokens.leftHelperColorReadOnly, _TextField.textFieldTokens.labelColorReadOnly)
41
+ }
42
+ }
43
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.TextField = void 0;
7
+ var _engines = /*#__PURE__*/require("../../../../engines");
8
+ var _TextField = /*#__PURE__*/require("../../../../components/TextField");
9
+ var _TextField2 = /*#__PURE__*/require("./TextField.config");
10
+ var mergedConfig = /*#__PURE__*/(0, _engines.mergeConfig)(_TextField.textFieldConfig, _TextField2.config);
11
+ var TextField = exports.TextField = /*#__PURE__*/(0, _engines.component)(mergedConfig);
@@ -0,0 +1,181 @@
1
+ import React, { ComponentProps, useState } from 'react';
2
+ import type { StoryObj, Meta } from '@storybook/react';
3
+ import { action } from '@storybook/addon-actions';
4
+ import { IconPlaceholder } from '@salutejs/plasma-sb-utils';
5
+
6
+ import { WithTheme } from '../../../_helpers';
7
+
8
+ import { TextField } from './TextField';
9
+
10
+ const onChange = action('onChange');
11
+ const onFocus = action('onFocus');
12
+ const onBlur = action('onBlur');
13
+ const onSearch = action('onSearch');
14
+ const onChipsChange = action('onChipsChange');
15
+
16
+ const sizes = ['l', 'm', 's', 'xs'];
17
+ const views = ['default', 'positive', 'warning', 'negative'];
18
+ const labelPlacements = ['outer', 'inner'];
19
+
20
+ const meta: Meta<typeof TextField> = {
21
+ title: 'sds_engineer/TextField',
22
+ component: TextField,
23
+ decorators: [WithTheme],
24
+ argTypes: {
25
+ view: {
26
+ options: views,
27
+ control: {
28
+ type: 'select',
29
+ },
30
+ },
31
+ maxLength: {
32
+ control: {
33
+ type: 'number',
34
+ },
35
+ },
36
+ labelPlacement: {
37
+ options: labelPlacements,
38
+ control: {
39
+ type: 'inline-radio',
40
+ },
41
+ },
42
+ size: {
43
+ options: sizes,
44
+ control: {
45
+ type: 'inline-radio',
46
+ },
47
+ },
48
+ },
49
+ };
50
+
51
+ export default meta;
52
+
53
+ type StoryPropsDefault = Omit<
54
+ ComponentProps<typeof TextField>,
55
+ | 'helperBlock'
56
+ | 'contentLeft'
57
+ | 'htmlSize'
58
+ | 'contentRight'
59
+ | 'type'
60
+ | 'name'
61
+ | 'onFocus'
62
+ | 'onBlur'
63
+ | 'onChange'
64
+ | 'value'
65
+ | 'checked'
66
+ | 'maxLength'
67
+ | 'minLength'
68
+ | 'required'
69
+ | 'enumerationType'
70
+ | 'chips'
71
+ | 'onChangeChips'
72
+ > & {
73
+ 'storybook:contentLeft': boolean;
74
+ 'storybook:contentRight': boolean;
75
+ };
76
+
77
+ const StoryDemo = ({
78
+ 'storybook:contentLeft': enableContentLeft,
79
+ 'storybook:contentRight': enableContentRight,
80
+ view,
81
+ ...rest
82
+ }: StoryPropsDefault) => {
83
+ const [text, setText] = useState('Значение поля');
84
+
85
+ const iconSize = rest.size === 'xs' ? 'xs' : 's';
86
+
87
+ return (
88
+ <TextField
89
+ {...rest}
90
+ enumerationType="plain"
91
+ value={text}
92
+ contentLeft={enableContentLeft ? <IconPlaceholder size={iconSize} /> : undefined}
93
+ contentRight={enableContentRight ? <IconPlaceholder size={iconSize} /> : undefined}
94
+ view={view}
95
+ onChange={(e) => {
96
+ setText(e.target.value);
97
+ onChange(e.target.value);
98
+ }}
99
+ onFocus={onFocus}
100
+ onBlur={onBlur}
101
+ onSearch={onSearch}
102
+ />
103
+ );
104
+ };
105
+
106
+ export const Default: StoryObj<StoryPropsDefault> = {
107
+ args: {
108
+ id: 'example-text-field',
109
+ size: 'l',
110
+ view: 'default',
111
+ label: 'Лейбл',
112
+ labelPlacement: 'outer',
113
+ placeholder: 'Заполните поле',
114
+ leftHelper: 'Подсказка к полю',
115
+ disabled: false,
116
+ readOnly: false,
117
+ 'storybook:contentLeft': true,
118
+ 'storybook:contentRight': true,
119
+ },
120
+ render: (args) => <StoryDemo {...args} />,
121
+ };
122
+
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> = {
176
+ args: {
177
+ ...Default.args,
178
+ chips: ['1 value', '2 value', '3 value', '4 value'],
179
+ },
180
+ render: (args) => <StoryChips {...args} />,
181
+ };