@salutejs/plasma-new-hope 0.71.2-dev.0 → 0.72.0-canary.1160.8612911363.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (246) hide show
  1. package/cjs/components/Cell/Cell.js +0 -2
  2. package/cjs/components/Cell/Cell.js.map +1 -1
  3. package/cjs/components/TextField/TextField.js +166 -40
  4. package/cjs/components/TextField/TextField.js.map +1 -1
  5. package/cjs/components/TextField/TextField.styles.js +27 -11
  6. package/cjs/components/TextField/TextField.styles.js.map +1 -1
  7. package/cjs/components/TextField/TextField.styles_1b1mddp.css +8 -0
  8. package/cjs/components/TextField/TextField.tokens.js +68 -20
  9. package/cjs/components/TextField/TextField.tokens.js.map +1 -1
  10. package/cjs/components/TextField/TextField_wctd2m.css +1 -0
  11. package/cjs/components/TextField/hooks/useKeyNavigation.js +131 -0
  12. package/cjs/components/TextField/hooks/useKeyNavigation.js.map +1 -0
  13. package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.css +19 -0
  14. package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js +38 -0
  15. package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js.map +1 -0
  16. package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.styles.js +26 -0
  17. package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.styles.js.map +1 -0
  18. package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.styles_1y8n7la.css +1 -0
  19. package/cjs/components/TextField/{_disabled → variations/_disabled}/base.js +2 -2
  20. package/cjs/components/TextField/variations/_disabled/base.js.map +1 -0
  21. package/cjs/components/TextField/variations/_disabled/base_1tnjoy9.css +1 -0
  22. package/cjs/components/TextField/{_label-placement → variations/_label-placement}/base.js +1 -1
  23. package/cjs/components/TextField/variations/_label-placement/base.js.map +1 -0
  24. package/cjs/components/TextField/{_label-placement → variations/_label-placement}/inner.js +2 -2
  25. package/cjs/components/TextField/variations/_label-placement/inner.js.map +1 -0
  26. package/cjs/components/TextField/variations/_label-placement/inner_gqlcj2.css +1 -0
  27. package/cjs/components/TextField/{_label-placement → variations/_label-placement}/outer.js +2 -2
  28. package/cjs/components/TextField/variations/_label-placement/outer.js.map +1 -0
  29. package/cjs/components/TextField/variations/_label-placement/outer_is41nj.css +1 -0
  30. package/cjs/components/TextField/{_view → variations/_read-only}/base.js +2 -2
  31. package/cjs/components/TextField/variations/_read-only/base.js.map +1 -0
  32. package/cjs/components/TextField/variations/_read-only/base_134hshp.css +1 -0
  33. package/cjs/components/TextField/variations/_size/base.js +9 -0
  34. package/cjs/components/TextField/variations/_size/base.js.map +1 -0
  35. package/cjs/components/TextField/variations/_size/base_1khzr9t.css +1 -0
  36. package/cjs/components/TextField/{_size → variations/_view}/base.js +2 -2
  37. package/cjs/components/TextField/variations/_view/base.js.map +1 -0
  38. package/cjs/components/TextField/variations/_view/base_1qd77x6.css +1 -0
  39. package/cjs/index.css +16 -9
  40. package/cjs/index.js +2 -2
  41. package/es/components/Cell/Cell.js +0 -2
  42. package/es/components/Cell/Cell.js.map +1 -1
  43. package/es/components/TextField/TextField.js +169 -44
  44. package/es/components/TextField/TextField.js.map +1 -1
  45. package/es/components/TextField/TextField.styles.js +25 -12
  46. package/es/components/TextField/TextField.styles.js.map +1 -1
  47. package/es/components/TextField/TextField.styles_1b1mddp.css +8 -0
  48. package/es/components/TextField/TextField.tokens.js +68 -21
  49. package/es/components/TextField/TextField.tokens.js.map +1 -1
  50. package/es/components/TextField/TextField_wctd2m.css +1 -0
  51. package/es/components/TextField/hooks/useKeyNavigation.js +126 -0
  52. package/es/components/TextField/hooks/useKeyNavigation.js.map +1 -0
  53. package/es/components/TextField/ui/TextFieldChip/TextFieldChip.css +19 -0
  54. package/es/components/TextField/ui/TextFieldChip/TextFieldChip.js +34 -0
  55. package/es/components/TextField/ui/TextFieldChip/TextFieldChip.js.map +1 -0
  56. package/es/components/TextField/ui/TextFieldChip/TextFieldChip.styles.js +22 -0
  57. package/es/components/TextField/ui/TextFieldChip/TextFieldChip.styles.js.map +1 -0
  58. package/es/components/TextField/ui/TextFieldChip/TextFieldChip.styles_1y8n7la.css +1 -0
  59. package/es/components/TextField/variations/_disabled/base.js +5 -0
  60. package/es/components/TextField/variations/_disabled/base.js.map +1 -0
  61. package/es/components/TextField/variations/_disabled/base_1tnjoy9.css +1 -0
  62. package/es/components/TextField/{_label-placement → variations/_label-placement}/base.js +1 -1
  63. package/es/components/TextField/variations/_label-placement/base.js.map +1 -0
  64. package/es/components/TextField/variations/_label-placement/inner.js +5 -0
  65. package/es/components/TextField/variations/_label-placement/inner.js.map +1 -0
  66. package/es/components/TextField/variations/_label-placement/inner_gqlcj2.css +1 -0
  67. package/es/components/TextField/variations/_label-placement/outer.js +5 -0
  68. package/es/components/TextField/variations/_label-placement/outer.js.map +1 -0
  69. package/es/components/TextField/variations/_label-placement/outer_is41nj.css +1 -0
  70. package/es/components/TextField/variations/_read-only/base.js +5 -0
  71. package/es/components/TextField/variations/_read-only/base.js.map +1 -0
  72. package/es/components/TextField/variations/_read-only/base_134hshp.css +1 -0
  73. package/es/components/TextField/variations/_size/base.js +5 -0
  74. package/es/components/TextField/variations/_size/base.js.map +1 -0
  75. package/es/components/TextField/variations/_size/base_1khzr9t.css +1 -0
  76. package/es/components/TextField/{_disabled → variations/_view}/base.js +2 -2
  77. package/es/components/TextField/variations/_view/base.js.map +1 -0
  78. package/es/components/TextField/variations/_view/base_1qd77x6.css +1 -0
  79. package/es/index.css +16 -9
  80. package/es/index.js +2 -2
  81. package/package.json +2 -2
  82. package/styled-components/cjs/components/Cell/Cell.js +0 -2
  83. package/styled-components/cjs/components/TextField/TextField.js +173 -43
  84. package/styled-components/cjs/components/TextField/TextField.styles.js +18 -10
  85. package/styled-components/cjs/components/TextField/TextField.template-doc.mdx +24 -0
  86. package/styled-components/cjs/components/TextField/TextField.tokens.js +68 -21
  87. package/styled-components/cjs/components/TextField/hooks/index.js +12 -0
  88. package/styled-components/cjs/components/TextField/hooks/useKeyNavigation.js +137 -0
  89. package/styled-components/cjs/components/TextField/index.js +2 -2
  90. package/styled-components/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js +39 -0
  91. package/styled-components/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.styles.js +25 -0
  92. package/styled-components/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.types.js +5 -0
  93. package/styled-components/cjs/components/TextField/ui/index.js +12 -0
  94. package/styled-components/cjs/components/TextField/variations/_disabled/base.js +10 -0
  95. package/styled-components/cjs/components/TextField/variations/_label-placement/inner.js +10 -0
  96. package/styled-components/cjs/components/TextField/{_label-placement → variations/_label-placement}/outer.js +3 -3
  97. package/styled-components/cjs/components/TextField/variations/_read-only/base.js +10 -0
  98. package/styled-components/cjs/components/TextField/variations/_read-only/tokens.json +1 -0
  99. package/styled-components/cjs/components/TextField/variations/_size/base.js +10 -0
  100. package/styled-components/cjs/components/TextField/variations/_view/base.js +10 -0
  101. package/styled-components/cjs/examples/plasma_b2c/components/TextField/TextField.config.js +43 -0
  102. package/styled-components/cjs/examples/plasma_b2c/components/TextField/TextField.js +11 -0
  103. package/styled-components/cjs/examples/plasma_b2c/components/TextField/TextField.stories.tsx +133 -0
  104. package/styled-components/cjs/examples/plasma_web/components/TextField/TextField.config.js +40 -0
  105. package/styled-components/cjs/examples/plasma_web/components/TextField/TextField.js +11 -0
  106. package/styled-components/cjs/examples/plasma_web/components/TextField/TextField.stories.tsx +133 -0
  107. package/styled-components/cjs/examples/sds_engineer/components/TextField/TextField.config.js +43 -0
  108. package/styled-components/cjs/examples/sds_engineer/components/TextField/TextField.js +11 -0
  109. package/styled-components/cjs/examples/sds_engineer/components/TextField/TextField.stories.tsx +133 -0
  110. package/styled-components/es/components/Cell/Cell.js +0 -2
  111. package/styled-components/es/components/TextField/TextField.js +177 -47
  112. package/styled-components/es/components/TextField/TextField.styles.js +17 -9
  113. package/styled-components/es/components/TextField/TextField.template-doc.mdx +24 -0
  114. package/styled-components/es/components/TextField/TextField.tokens.js +67 -20
  115. package/styled-components/es/components/TextField/hooks/index.js +1 -0
  116. package/styled-components/es/components/TextField/hooks/useKeyNavigation.js +131 -0
  117. package/styled-components/es/components/TextField/index.js +2 -2
  118. package/styled-components/es/components/TextField/ui/TextFieldChip/TextFieldChip.js +30 -0
  119. package/styled-components/es/components/TextField/ui/TextFieldChip/TextFieldChip.styles.js +19 -0
  120. package/styled-components/es/components/TextField/ui/TextFieldChip/TextFieldChip.types.js +1 -0
  121. package/styled-components/es/components/TextField/ui/index.js +1 -0
  122. package/styled-components/es/components/TextField/variations/_disabled/base.js +4 -0
  123. package/styled-components/es/components/TextField/variations/_label-placement/inner.js +4 -0
  124. package/styled-components/es/components/TextField/variations/_label-placement/outer.js +4 -0
  125. package/styled-components/es/components/TextField/variations/_read-only/base.js +4 -0
  126. package/styled-components/es/components/TextField/variations/_read-only/tokens.json +1 -0
  127. package/styled-components/es/components/TextField/variations/_size/base.js +4 -0
  128. package/styled-components/es/components/TextField/variations/_view/base.js +4 -0
  129. package/styled-components/es/examples/plasma_b2c/components/TextField/TextField.config.js +37 -0
  130. package/styled-components/es/examples/plasma_b2c/components/TextField/TextField.js +5 -0
  131. package/styled-components/es/examples/plasma_b2c/components/TextField/TextField.stories.tsx +133 -0
  132. package/styled-components/es/examples/plasma_web/components/TextField/TextField.config.js +34 -0
  133. package/styled-components/es/examples/plasma_web/components/TextField/TextField.js +5 -0
  134. package/styled-components/es/examples/plasma_web/components/TextField/TextField.stories.tsx +133 -0
  135. package/styled-components/es/examples/sds_engineer/components/TextField/TextField.config.js +37 -0
  136. package/styled-components/es/examples/sds_engineer/components/TextField/TextField.js +5 -0
  137. package/styled-components/es/examples/sds_engineer/components/TextField/TextField.stories.tsx +133 -0
  138. package/types/components/Cell/Cell.d.ts.map +1 -1
  139. package/types/components/TextField/TextField.d.ts +8 -3
  140. package/types/components/TextField/TextField.d.ts.map +1 -1
  141. package/types/components/TextField/TextField.styles.d.ts +6 -3
  142. package/types/components/TextField/TextField.styles.d.ts.map +1 -1
  143. package/types/components/TextField/TextField.tokens.d.ts +57 -8
  144. package/types/components/TextField/TextField.tokens.d.ts.map +1 -1
  145. package/types/components/TextField/TextField.types.d.ts +45 -3
  146. package/types/components/TextField/TextField.types.d.ts.map +1 -1
  147. package/types/components/TextField/hooks/index.d.ts +2 -0
  148. package/types/components/TextField/hooks/index.d.ts.map +1 -0
  149. package/types/components/TextField/hooks/useKeyNavigation.d.ts +17 -0
  150. package/types/components/TextField/hooks/useKeyNavigation.d.ts.map +1 -0
  151. package/types/components/TextField/index.d.ts +3 -2
  152. package/types/components/TextField/index.d.ts.map +1 -1
  153. package/types/components/TextField/ui/TextFieldChip/TextFieldChip.d.ts +7 -0
  154. package/types/components/TextField/ui/TextFieldChip/TextFieldChip.d.ts.map +1 -0
  155. package/types/components/TextField/ui/TextFieldChip/TextFieldChip.styles.d.ts +3 -0
  156. package/types/components/TextField/ui/TextFieldChip/TextFieldChip.styles.d.ts.map +1 -0
  157. package/types/components/TextField/ui/TextFieldChip/TextFieldChip.types.d.ts +37 -0
  158. package/types/components/TextField/ui/TextFieldChip/TextFieldChip.types.d.ts.map +1 -0
  159. package/types/components/TextField/ui/index.d.ts +2 -0
  160. package/types/components/TextField/ui/index.d.ts.map +1 -0
  161. package/types/components/TextField/variations/_disabled/base.d.ts.map +1 -0
  162. package/types/components/TextField/variations/_label-placement/base.d.ts.map +1 -0
  163. package/types/components/TextField/variations/_label-placement/index.d.ts.map +1 -0
  164. package/types/components/TextField/variations/_label-placement/inner.d.ts.map +1 -0
  165. package/types/components/TextField/variations/_label-placement/outer.d.ts.map +1 -0
  166. package/types/components/TextField/variations/_read-only/base.d.ts.map +1 -0
  167. package/types/components/TextField/variations/_size/base.d.ts.map +1 -0
  168. package/types/components/TextField/variations/_view/base.d.ts +2 -0
  169. package/types/components/TextField/variations/_view/base.d.ts.map +1 -0
  170. package/types/examples/plasma_b2c/components/TextField/TextField.config.d.ts +32 -0
  171. package/types/examples/plasma_b2c/components/TextField/TextField.config.d.ts.map +1 -0
  172. package/types/examples/plasma_b2c/components/TextField/TextField.d.ts +26 -0
  173. package/types/examples/plasma_b2c/components/TextField/TextField.d.ts.map +1 -0
  174. package/types/examples/plasma_web/components/TextField/TextField.config.d.ts +32 -0
  175. package/types/examples/plasma_web/components/TextField/TextField.config.d.ts.map +1 -0
  176. package/types/examples/plasma_web/components/TextField/TextField.d.ts +26 -0
  177. package/types/examples/plasma_web/components/TextField/TextField.d.ts.map +1 -0
  178. package/types/examples/sds_engineer/components/TextField/TextField.config.d.ts +32 -0
  179. package/types/examples/sds_engineer/components/TextField/TextField.config.d.ts.map +1 -0
  180. package/types/examples/sds_engineer/components/TextField/TextField.d.ts +26 -0
  181. package/types/examples/sds_engineer/components/TextField/TextField.d.ts.map +1 -0
  182. package/cjs/components/TextField/TextField.styles_2qw1n8.css +0 -5
  183. package/cjs/components/TextField/TextField_1lzb2r1.css +0 -1
  184. package/cjs/components/TextField/_disabled/base.js.map +0 -1
  185. package/cjs/components/TextField/_disabled/base_so3w81.css +0 -1
  186. package/cjs/components/TextField/_label-placement/base.js.map +0 -1
  187. package/cjs/components/TextField/_label-placement/inner.js.map +0 -1
  188. package/cjs/components/TextField/_label-placement/inner_1tyuicp.css +0 -1
  189. package/cjs/components/TextField/_label-placement/outer.js.map +0 -1
  190. package/cjs/components/TextField/_label-placement/outer_19ekaek.css +0 -1
  191. package/cjs/components/TextField/_size/base.js.map +0 -1
  192. package/cjs/components/TextField/_size/base_b5smyu.css +0 -1
  193. package/cjs/components/TextField/_view/base.js.map +0 -1
  194. package/cjs/components/TextField/_view/base_5bqzed.css +0 -1
  195. package/es/components/TextField/TextField.styles_2qw1n8.css +0 -5
  196. package/es/components/TextField/TextField_1lzb2r1.css +0 -1
  197. package/es/components/TextField/_disabled/base.js.map +0 -1
  198. package/es/components/TextField/_disabled/base_so3w81.css +0 -1
  199. package/es/components/TextField/_label-placement/base.js.map +0 -1
  200. package/es/components/TextField/_label-placement/inner.js +0 -5
  201. package/es/components/TextField/_label-placement/inner.js.map +0 -1
  202. package/es/components/TextField/_label-placement/inner_1tyuicp.css +0 -1
  203. package/es/components/TextField/_label-placement/outer.js +0 -5
  204. package/es/components/TextField/_label-placement/outer.js.map +0 -1
  205. package/es/components/TextField/_label-placement/outer_19ekaek.css +0 -1
  206. package/es/components/TextField/_size/base.js +0 -5
  207. package/es/components/TextField/_size/base.js.map +0 -1
  208. package/es/components/TextField/_size/base_b5smyu.css +0 -1
  209. package/es/components/TextField/_view/base.js +0 -5
  210. package/es/components/TextField/_view/base.js.map +0 -1
  211. package/es/components/TextField/_view/base_5bqzed.css +0 -1
  212. package/styled-components/cjs/components/TextField/_disabled/base.js +0 -9
  213. package/styled-components/cjs/components/TextField/_label-placement/inner.js +0 -10
  214. package/styled-components/cjs/components/TextField/_size/base.js +0 -10
  215. package/styled-components/cjs/components/TextField/_view/base.js +0 -10
  216. package/styled-components/es/components/TextField/_disabled/base.js +0 -3
  217. package/styled-components/es/components/TextField/_label-placement/inner.js +0 -4
  218. package/styled-components/es/components/TextField/_label-placement/outer.js +0 -4
  219. package/styled-components/es/components/TextField/_size/base.js +0 -4
  220. package/styled-components/es/components/TextField/_view/base.js +0 -4
  221. package/types/components/TextField/_disabled/base.d.ts.map +0 -1
  222. package/types/components/TextField/_label-placement/base.d.ts.map +0 -1
  223. package/types/components/TextField/_label-placement/index.d.ts.map +0 -1
  224. package/types/components/TextField/_label-placement/inner.d.ts.map +0 -1
  225. package/types/components/TextField/_label-placement/outer.d.ts.map +0 -1
  226. package/types/components/TextField/_size/base.d.ts.map +0 -1
  227. package/types/components/TextField/_view/base.d.ts.map +0 -1
  228. /package/cjs/components/TextField/{_label-placement → variations/_label-placement}/base_x642ct.css +0 -0
  229. /package/es/components/TextField/{_label-placement → variations/_label-placement}/base_x642ct.css +0 -0
  230. /package/styled-components/cjs/components/TextField/{_disabled → variations/_disabled}/tokens.json +0 -0
  231. /package/styled-components/cjs/components/TextField/{_label-placement → variations/_label-placement}/base.js +0 -0
  232. /package/styled-components/cjs/components/TextField/{_label-placement → variations/_label-placement}/index.js +0 -0
  233. /package/styled-components/cjs/components/TextField/{_size → variations/_size}/tokens.json +0 -0
  234. /package/styled-components/cjs/components/TextField/{_view → variations/_view}/tokens.json +0 -0
  235. /package/styled-components/es/components/TextField/{_disabled → variations/_disabled}/tokens.json +0 -0
  236. /package/styled-components/es/components/TextField/{_label-placement → variations/_label-placement}/base.js +0 -0
  237. /package/styled-components/es/components/TextField/{_label-placement → variations/_label-placement}/index.js +0 -0
  238. /package/styled-components/es/components/TextField/{_size → variations/_size}/tokens.json +0 -0
  239. /package/styled-components/es/components/TextField/{_view → variations/_view}/tokens.json +0 -0
  240. /package/types/components/TextField/{_disabled → variations/_disabled}/base.d.ts +0 -0
  241. /package/types/components/TextField/{_label-placement → variations/_label-placement}/base.d.ts +0 -0
  242. /package/types/components/TextField/{_label-placement → variations/_label-placement}/index.d.ts +0 -0
  243. /package/types/components/TextField/{_label-placement → variations/_label-placement}/inner.d.ts +0 -0
  244. /package/types/components/TextField/{_label-placement → variations/_label-placement}/outer.d.ts +0 -0
  245. /package/types/components/TextField/{_size → variations/_read-only}/base.d.ts +0 -0
  246. /package/types/components/TextField/{_view → variations/_size}/base.d.ts +0 -0
@@ -0,0 +1,133 @@
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
+
15
+ const sizes = ['l', 'm', 's', 'xs'];
16
+ const views = ['default', 'positive', 'warning', 'negative'];
17
+ const enumerationTypes = ['plain', 'chip'];
18
+ const labelPlacements = ['outer', 'inner'];
19
+
20
+ const meta: Meta<typeof TextField> = {
21
+ title: 'plasma_b2c/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
+ enumerationType: {
43
+ options: enumerationTypes,
44
+ control: {
45
+ type: 'select',
46
+ },
47
+ },
48
+ size: {
49
+ options: sizes,
50
+ control: {
51
+ type: 'inline-radio',
52
+ },
53
+ },
54
+ },
55
+ };
56
+
57
+ export default meta;
58
+
59
+ type StoryPropsDefault = Omit<
60
+ ComponentProps<typeof TextField>,
61
+ | 'helperBlock'
62
+ | 'contentLeft'
63
+ | 'htmlSize'
64
+ | 'contentRight'
65
+ | 'type'
66
+ | 'name'
67
+ | 'onFocus'
68
+ | 'onBlur'
69
+ | 'onChange'
70
+ | 'value'
71
+ | 'checked'
72
+ | 'maxLength'
73
+ | 'minLength'
74
+ | 'required'
75
+ > & {
76
+ 'storybook:contentLeft': boolean;
77
+ 'storybook:contentRight': boolean;
78
+ };
79
+
80
+ const StoryDemo = ({
81
+ 'storybook:contentLeft': enableContentLeft,
82
+ 'storybook:contentRight': enableContentRight,
83
+ view,
84
+ ...rest
85
+ }: StoryPropsDefault) => {
86
+ const [text, setText] = useState('Значение поля');
87
+
88
+ const iconSize = rest.size === 'xs' ? 'xs' : 's';
89
+
90
+ return (
91
+ <TextField
92
+ {...rest}
93
+ value={text}
94
+ contentLeft={enableContentLeft ? <IconPlaceholder size={iconSize} /> : undefined}
95
+ contentRight={enableContentRight ? <IconPlaceholder size={iconSize} /> : undefined}
96
+ view={view}
97
+ onChange={(e) => {
98
+ setText(e.target.value);
99
+ onChange(e.target.value);
100
+ }}
101
+ onFocus={onFocus}
102
+ onBlur={onBlur}
103
+ onSearch={onSearch}
104
+ />
105
+ );
106
+ };
107
+
108
+ export const Default: StoryObj<StoryPropsDefault> = {
109
+ args: {
110
+ id: 'example-text-field',
111
+ size: 'l',
112
+ view: 'default',
113
+ label: 'Лейбл',
114
+ labelPlacement: 'outer',
115
+ placeholder: 'Заполните поле',
116
+ leftHelper: 'Подсказка к полю',
117
+ enumerationType: 'plain',
118
+ disabled: false,
119
+ readOnly: false,
120
+ 'storybook:contentLeft': true,
121
+ 'storybook:contentRight': true,
122
+ },
123
+ render: (args) => <StoryDemo {...args} />,
124
+ };
125
+
126
+ export const Chips: StoryObj<StoryPropsDefault> = {
127
+ args: {
128
+ ...Default.args,
129
+ enumerationType: 'chip',
130
+ values: ['1 value', '2 value', '3 value', '4 value'],
131
+ },
132
+ render: (args) => <StoryDemo {...args} />,
133
+ };
@@ -0,0 +1,34 @@
1
+ import { css } from 'styled-components';
2
+ import { textFieldTokens as tokens, textField_labelPlacement_inner as labelPlacement_inner, textField_labelPlacement_outer as labelPlacement_outer } from '../../../../components/TextField';
3
+ export var config = {
4
+ defaults: {
5
+ view: 'default',
6
+ size: 'l',
7
+ labelPlacement: 'outer'
8
+ },
9
+ variations: {
10
+ view: {
11
+ "default": /*#__PURE__*/css(["", ":var(--text-primary);", ":var(--surface-clear);", ":var(--text-accent);", ":var(--text-secondary);", ":var(--text-primary);", ":var(--text-secondary);", ":var(--surface-transparent-tertiary);", ":var(--plasma-colors-secondary);", ":var(--surface-accent);", ":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);"], tokens.color, tokens.backgroundColor, tokens.caretColor, tokens.placeholderColor, tokens.labelColor, tokens.leftHelperColor, tokens.borderColor, tokens.borderColorHover, tokens.borderColorFocus, tokens.chipCloseIconColor, tokens.chipColor, tokens.chipBackground, tokens.chipColorHover, tokens.chipBackgroundHover, tokens.chipColorActive, tokens.chipBackgroundActive, tokens.chipBackgroundReadOnly, tokens.chipColorReadOnly, tokens.chipBackgroundReadOnlyHover, tokens.chipColorReadOnlyHover, tokens.chipOpacityReadonly, tokens.focusColor),
12
+ positive: /*#__PURE__*/css(["", ":var(--text-primary);", ":var(--surface-clear);", ":var(--text-accent);", ":var(--text-secondary);", ":var(--text-primary);", ":var(--text-positive);", ":var(--surface-positive);", ":var(--surface-positive);", ":var(--surface-accent);", ":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);"], tokens.color, tokens.backgroundColor, tokens.caretColor, tokens.placeholderColor, tokens.labelColor, tokens.leftHelperColor, tokens.borderColor, tokens.borderColorHover, tokens.borderColorFocus, tokens.chipCloseIconColor, tokens.chipColor, tokens.chipBackground, tokens.chipColorHover, tokens.chipBackgroundHover, tokens.chipColorActive, tokens.chipBackgroundActive, tokens.chipBackgroundReadOnly, tokens.chipColorReadOnly, tokens.chipBackgroundReadOnlyHover, tokens.chipColorReadOnlyHover, tokens.chipOpacityReadonly, tokens.focusColor),
13
+ warning: /*#__PURE__*/css(["", ":var(--text-primary);", ":var(--surface-clear);", ":var(--text-accent);", ":var(--text-secondary);", ":var(--text-primary);", ":var(--text-warning);", ":var(--surface-warning);", ":var(--surface-warning);", ":var(--surface-accent);", ":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);"], tokens.color, tokens.backgroundColor, tokens.caretColor, tokens.placeholderColor, tokens.labelColor, tokens.leftHelperColor, tokens.borderColor, tokens.borderColorHover, tokens.borderColorFocus, tokens.chipCloseIconColor, tokens.chipColor, tokens.chipBackground, tokens.chipColorHover, tokens.chipBackgroundHover, tokens.chipColorActive, tokens.chipBackgroundActive, tokens.chipBackgroundReadOnly, tokens.chipColorReadOnly, tokens.chipBackgroundReadOnlyHover, tokens.chipColorReadOnlyHover, tokens.chipOpacityReadonly, tokens.focusColor),
14
+ negative: /*#__PURE__*/css(["", ":var(--text-primary);", ":var(--surface-clear);", ":var(--text-accent);", ":var(--text-secondary);", ":var(--text-primary);", ":var(--text-negative);", ":var(--surface-negative);", ":var(--surface-negative);", ":var(--surface-accent);", ":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);"], tokens.color, tokens.backgroundColor, tokens.caretColor, tokens.placeholderColor, tokens.labelColor, tokens.leftHelperColor, tokens.borderColor, tokens.borderColorHover, tokens.borderColorFocus, tokens.chipCloseIconColor, tokens.chipColor, tokens.chipBackground, tokens.chipColorHover, tokens.chipBackgroundHover, tokens.chipColorActive, tokens.chipBackgroundActive, tokens.chipBackgroundReadOnly, tokens.chipColorReadOnly, tokens.chipBackgroundReadOnlyHover, tokens.chipColorReadOnlyHover, tokens.chipOpacityReadonly, tokens.focusColor)
15
+ },
16
+ size: {
17
+ l: /*#__PURE__*/css(["", ":3.5rem;", ":1.0625rem 1.125rem 1.0625rem 1.125rem;", ":0.375rem;", ":0.875rem;", ":0.0625rem;", ":-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);"], tokens.height, tokens.padding, tokens.paddingWithChips, tokens.borderRadius, tokens.borderWidth, tokens.leftContentMargin, tokens.rightContentMargin, tokens.fontFamily, tokens.fontSize, tokens.fontStyle, tokens.fontWeight, tokens.letterSpacing, tokens.lineHeight, tokens.labelOffset, tokens.labelFontFamily, tokens.labelFontSize, tokens.labelFontStyle, tokens.labelFontWeight, tokens.labelLetterSpacing, tokens.labelLineHeight, tokens.leftHelperOffset, tokens.leftHelperFontFamily, tokens.leftHelperFontSize, tokens.leftHelperFontStyle, tokens.leftHelperFontWeight, tokens.leftHelperLetterSpacing, tokens.leftHelperLineHeight, tokens.labelInnerPadding, tokens.contentLabelInnerPadding, tokens.chipGap, tokens.chipBorderRadius, tokens.chipWidth, tokens.chipHeight, tokens.chipPaddingRight, tokens.chipPaddingLeft, tokens.chipClearContentMarginLeft, tokens.chipClearContentMarginRight, tokens.chipCloseIconSize, tokens.chipFontFamily, tokens.chipFontSize, tokens.chipFontStyle, tokens.chipFontWeight, tokens.chipLetterSpacing, tokens.chipLineHeight),
18
+ m: /*#__PURE__*/css(["", ":3rem;", ":0.875rem 1rem 0.875rem 1rem;", ":0.375rem;", ":0.75rem;", ":0.0625rem;", ":-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);"], tokens.height, tokens.padding, tokens.paddingWithChips, tokens.borderRadius, tokens.borderWidth, tokens.leftContentMargin, tokens.rightContentMargin, tokens.fontFamily, tokens.fontSize, tokens.fontStyle, tokens.fontWeight, tokens.letterSpacing, tokens.lineHeight, tokens.labelOffset, tokens.labelFontFamily, tokens.labelFontSize, tokens.labelFontStyle, tokens.labelFontWeight, tokens.labelLetterSpacing, tokens.labelLineHeight, tokens.leftHelperOffset, tokens.leftHelperFontFamily, tokens.leftHelperFontSize, tokens.leftHelperFontStyle, tokens.leftHelperFontWeight, tokens.leftHelperLetterSpacing, tokens.leftHelperLineHeight, tokens.labelInnerPadding, tokens.contentLabelInnerPadding, tokens.chipGap, tokens.chipBorderRadius, tokens.chipWidth, tokens.chipHeight, tokens.chipPaddingRight, tokens.chipPaddingLeft, tokens.chipClearContentMarginLeft, tokens.chipClearContentMarginRight, tokens.chipCloseIconSize, tokens.chipFontFamily, tokens.chipFontSize, tokens.chipFontStyle, tokens.chipFontWeight, tokens.chipLetterSpacing, tokens.chipLineHeight),
19
+ s: /*#__PURE__*/css(["", ":2.5rem;", ":0.6875rem 0.875rem 0.6875rem 0.875rem;", ":0.375rem;", ":0.625rem;", ":0.0625rem;", ":-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);"], tokens.height, tokens.padding, tokens.paddingWithChips, tokens.borderRadius, tokens.borderWidth, tokens.leftContentMargin, tokens.rightContentMargin, tokens.fontFamily, tokens.fontSize, tokens.fontStyle, tokens.fontWeight, tokens.letterSpacing, tokens.lineHeight, tokens.labelOffset, tokens.labelFontFamily, tokens.labelFontSize, tokens.labelFontStyle, tokens.labelFontWeight, tokens.labelLetterSpacing, tokens.labelLineHeight, tokens.leftHelperOffset, tokens.leftHelperFontFamily, tokens.leftHelperFontSize, tokens.leftHelperFontStyle, tokens.leftHelperFontWeight, tokens.leftHelperLetterSpacing, tokens.leftHelperLineHeight, tokens.labelInnerPadding, tokens.contentLabelInnerPadding, tokens.chipGap, tokens.chipBorderRadius, tokens.chipWidth, tokens.chipHeight, tokens.chipPaddingRight, tokens.chipPaddingLeft, tokens.chipClearContentMarginLeft, tokens.chipClearContentMarginRight, tokens.chipCloseIconSize, tokens.chipFontFamily, tokens.chipFontSize, tokens.chipFontStyle, tokens.chipFontWeight, tokens.chipLetterSpacing, tokens.chipLineHeight),
20
+ xs: /*#__PURE__*/css(["", ":2rem;", ":0.5625rem 0.625rem 0.5625rem 0.625rem;", ":0.375rem;", ":0.5rem;", ":0.0625rem;", ":-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);"], tokens.height, tokens.padding, tokens.paddingWithChips, tokens.borderRadius, tokens.borderWidth, tokens.leftContentMargin, tokens.rightContentMargin, tokens.fontFamily, tokens.fontSize, tokens.fontStyle, tokens.fontWeight, tokens.letterSpacing, tokens.lineHeight, tokens.labelOffset, tokens.labelFontFamily, tokens.labelFontSize, tokens.labelFontStyle, tokens.labelFontWeight, tokens.labelLetterSpacing, tokens.labelLineHeight, tokens.leftHelperOffset, tokens.leftHelperFontFamily, tokens.leftHelperFontSize, tokens.leftHelperFontStyle, tokens.leftHelperFontWeight, tokens.leftHelperLetterSpacing, tokens.leftHelperLineHeight, tokens.labelInnerPadding, tokens.contentLabelInnerPadding, tokens.chipGap, tokens.chipBorderRadius, tokens.chipWidth, tokens.chipHeight, tokens.chipPaddingRight, tokens.chipPaddingLeft, tokens.chipClearContentMarginLeft, tokens.chipClearContentMarginRight, tokens.chipCloseIconSize, tokens.chipFontFamily, tokens.chipFontSize, tokens.chipFontStyle, tokens.chipFontWeight, tokens.chipLetterSpacing, tokens.chipLineHeight)
21
+ },
22
+ labelPlacement: {
23
+ inner: [labelPlacement_inner, /*#__PURE__*/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);}"], labelPlacement_inner, tokens.placeholderColor, tokens.labelInnerFontFamily, tokens.labelInnerFontSize, tokens.labelInnerFontStyle, tokens.labelInnerFontWeight, tokens.labelInnerLetterSpacing, tokens.labelInnerLineHeight)],
24
+ outer: [labelPlacement_outer, /*#__PURE__*/css(["&.", "{}"], labelPlacement_outer)]
25
+ },
26
+ disabled: {
27
+ "true": /*#__PURE__*/css(["", ":0.4;"], tokens.disabledOpacity)
28
+ },
29
+ // TODO заменить --surface-transparent-primary на корректный токен
30
+ readOnly: {
31
+ "true": /*#__PURE__*/css(["", ":var(--text-primary);", ":var(--surface-clear);", ":var(--surface-transparent-tertiary);", ":var(--text-secondary);", ":var(--text-secondary);", ":var(--text-secondary);"], tokens.colorReadOnly, tokens.backgroundColorReadOnly, tokens.borderColorReadOnly, tokens.placeholderColorReadOnly, tokens.leftHelperColorReadOnly, tokens.labelColorReadOnly)
32
+ }
33
+ }
34
+ };
@@ -0,0 +1,5 @@
1
+ import { component, mergeConfig } from '../../../../engines';
2
+ import { textFieldConfig } from '../../../../components/TextField';
3
+ import { config } from './TextField.config';
4
+ var mergedConfig = /*#__PURE__*/mergeConfig(textFieldConfig, config);
5
+ export var TextField = /*#__PURE__*/component(mergedConfig);
@@ -0,0 +1,133 @@
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
+
15
+ const sizes = ['l', 'm', 's', 'xs'];
16
+ const views = ['default', 'positive', 'warning', 'negative'];
17
+ const enumerationTypes = ['plain', 'chip'];
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
+ enumerationType: {
43
+ options: enumerationTypes,
44
+ control: {
45
+ type: 'select',
46
+ },
47
+ },
48
+ size: {
49
+ options: sizes,
50
+ control: {
51
+ type: 'inline-radio',
52
+ },
53
+ },
54
+ },
55
+ };
56
+
57
+ export default meta;
58
+
59
+ type StoryPropsDefault = Omit<
60
+ ComponentProps<typeof TextField>,
61
+ | 'helperBlock'
62
+ | 'contentLeft'
63
+ | 'htmlSize'
64
+ | 'contentRight'
65
+ | 'type'
66
+ | 'name'
67
+ | 'onFocus'
68
+ | 'onBlur'
69
+ | 'onChange'
70
+ | 'value'
71
+ | 'checked'
72
+ | 'maxLength'
73
+ | 'minLength'
74
+ | 'required'
75
+ > & {
76
+ 'storybook:contentLeft': boolean;
77
+ 'storybook:contentRight': boolean;
78
+ };
79
+
80
+ const StoryDemo = ({
81
+ 'storybook:contentLeft': enableContentLeft,
82
+ 'storybook:contentRight': enableContentRight,
83
+ view,
84
+ ...rest
85
+ }: StoryPropsDefault) => {
86
+ const [text, setText] = useState('Значение поля');
87
+
88
+ const iconSize = rest.size === 'xs' ? 'xs' : 's';
89
+
90
+ return (
91
+ <TextField
92
+ {...rest}
93
+ value={text}
94
+ contentLeft={enableContentLeft ? <IconPlaceholder size={iconSize} /> : undefined}
95
+ contentRight={enableContentRight ? <IconPlaceholder size={iconSize} /> : undefined}
96
+ view={view}
97
+ onChange={(e) => {
98
+ setText(e.target.value);
99
+ onChange(e.target.value);
100
+ }}
101
+ onFocus={onFocus}
102
+ onBlur={onBlur}
103
+ onSearch={onSearch}
104
+ />
105
+ );
106
+ };
107
+
108
+ export const Default: StoryObj<StoryPropsDefault> = {
109
+ args: {
110
+ id: 'example-text-field',
111
+ size: 'l',
112
+ view: 'default',
113
+ label: 'Лейбл',
114
+ labelPlacement: 'outer',
115
+ placeholder: 'Заполните поле',
116
+ leftHelper: 'Подсказка к полю',
117
+ enumerationType: 'plain',
118
+ disabled: false,
119
+ readOnly: false,
120
+ 'storybook:contentLeft': true,
121
+ 'storybook:contentRight': true,
122
+ },
123
+ render: (args) => <StoryDemo {...args} />,
124
+ };
125
+
126
+ export const Chips: StoryObj<StoryPropsDefault> = {
127
+ args: {
128
+ ...Default.args,
129
+ enumerationType: 'chip',
130
+ values: ['1 value', '2 value', '3 value', '4 value'],
131
+ },
132
+ render: (args) => <StoryDemo {...args} />,
133
+ };
@@ -0,0 +1,37 @@
1
+ import { css } from 'styled-components';
2
+ import { textFieldTokens as tokens, textField_labelPlacement_inner as labelPlacement_inner, textField_labelPlacement_outer as labelPlacement_outer } from '../../../../components/TextField';
3
+ export var config = {
4
+ defaults: {
5
+ view: 'default',
6
+ size: 'l',
7
+ labelPlacement: 'outer'
8
+ },
9
+ variations: {
10
+ view: {
11
+ "default": /*#__PURE__*/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);"], tokens.color, tokens.backgroundColor, tokens.backgroundColorFocus, tokens.caretColor, tokens.placeholderColor, tokens.labelColor, tokens.leftHelperColor, tokens.colorReadOnly, tokens.backgroundColorReadOnly, tokens.placeholderColorReadOnly, tokens.chipCloseIconColor, tokens.chipColor, tokens.chipBackground, tokens.chipColorHover, tokens.chipBackgroundHover, tokens.chipColorActive, tokens.chipBackgroundActive, tokens.chipBackgroundReadOnly, tokens.chipColorReadOnly, tokens.chipBackgroundReadOnlyHover, tokens.chipColorReadOnlyHover, tokens.chipOpacityReadonly, tokens.focusColor),
12
+ // TODO заменить --surface-transparent-positive на корректный токен
13
+ positive: /*#__PURE__*/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);"], tokens.color, tokens.backgroundColor, tokens.backgroundColorFocus, tokens.caretColor, tokens.placeholderColor, tokens.labelColor, tokens.leftHelperColor, tokens.colorReadOnly, tokens.backgroundColorReadOnly, tokens.placeholderColorReadOnly, tokens.chipCloseIconColor, tokens.chipColor, tokens.chipBackground, tokens.chipColorHover, tokens.chipBackgroundHover, tokens.chipColorActive, tokens.chipBackgroundActive, tokens.chipBackgroundReadOnly, tokens.chipColorReadOnly, tokens.chipBackgroundReadOnlyHover, tokens.chipColorReadOnlyHover, tokens.chipOpacityReadonly, tokens.focusColor),
14
+ // // TODO заменить --surface-transparent-warning на корректный токен
15
+ warning: /*#__PURE__*/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);"], tokens.color, tokens.backgroundColor, tokens.backgroundColorFocus, tokens.caretColor, tokens.placeholderColor, tokens.labelColor, tokens.leftHelperColor, tokens.colorReadOnly, tokens.backgroundColorReadOnly, tokens.placeholderColorReadOnly, tokens.chipCloseIconColor, tokens.chipColor, tokens.chipBackground, tokens.chipColorHover, tokens.chipBackgroundHover, tokens.chipColorActive, tokens.chipBackgroundActive, tokens.chipBackgroundReadOnly, tokens.chipColorReadOnly, tokens.chipBackgroundReadOnlyHover, tokens.chipColorReadOnlyHover, tokens.chipOpacityReadonly, tokens.focusColor),
16
+ // // TODO заменить --surface-transparent-negative на корректный токен
17
+ negative: /*#__PURE__*/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);"], tokens.color, tokens.backgroundColor, tokens.backgroundColorFocus, tokens.caretColor, tokens.placeholderColor, tokens.labelColor, tokens.leftHelperColor, tokens.colorReadOnly, tokens.backgroundColorReadOnly, tokens.placeholderColorReadOnly, tokens.chipCloseIconColor, tokens.chipColor, tokens.chipBackground, tokens.chipColorHover, tokens.chipBackgroundHover, tokens.chipColorActive, tokens.chipBackgroundActive, tokens.chipBackgroundReadOnly, tokens.chipColorReadOnly, tokens.chipBackgroundReadOnlyHover, tokens.chipColorReadOnlyHover, tokens.chipOpacityReadonly, tokens.focusColor)
18
+ },
19
+ size: {
20
+ l: /*#__PURE__*/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);"], tokens.height, tokens.padding, tokens.paddingWithChips, tokens.borderRadius, tokens.leftContentMargin, tokens.rightContentMargin, tokens.fontFamily, tokens.fontSize, tokens.fontStyle, tokens.fontWeight, tokens.letterSpacing, tokens.lineHeight, tokens.labelOffset, tokens.labelFontFamily, tokens.labelFontSize, tokens.labelFontStyle, tokens.labelFontWeight, tokens.labelLetterSpacing, tokens.labelLineHeight, tokens.leftHelperOffset, tokens.leftHelperFontFamily, tokens.leftHelperFontSize, tokens.leftHelperFontStyle, tokens.leftHelperFontWeight, tokens.leftHelperLetterSpacing, tokens.leftHelperLineHeight, tokens.labelInnerPadding, tokens.contentLabelInnerPadding, tokens.chipGap, tokens.chipBorderRadius, tokens.chipWidth, tokens.chipHeight, tokens.chipPaddingRight, tokens.chipPaddingLeft, tokens.chipClearContentMarginLeft, tokens.chipClearContentMarginRight, tokens.chipCloseIconSize, tokens.chipFontFamily, tokens.chipFontSize, tokens.chipFontStyle, tokens.chipFontWeight, tokens.chipLetterSpacing, tokens.chipLineHeight),
21
+ m: /*#__PURE__*/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);"], tokens.height, tokens.padding, tokens.paddingWithChips, tokens.borderRadius, tokens.leftContentMargin, tokens.rightContentMargin, tokens.fontFamily, tokens.fontSize, tokens.fontStyle, tokens.fontWeight, tokens.letterSpacing, tokens.lineHeight, tokens.labelOffset, tokens.labelFontFamily, tokens.labelFontSize, tokens.labelFontStyle, tokens.labelFontWeight, tokens.labelLetterSpacing, tokens.labelLineHeight, tokens.leftHelperOffset, tokens.leftHelperFontFamily, tokens.leftHelperFontSize, tokens.leftHelperFontStyle, tokens.leftHelperFontWeight, tokens.leftHelperLetterSpacing, tokens.leftHelperLineHeight, tokens.labelInnerPadding, tokens.contentLabelInnerPadding, tokens.chipGap, tokens.chipBorderRadius, tokens.chipWidth, tokens.chipHeight, tokens.chipPaddingRight, tokens.chipPaddingLeft, tokens.chipClearContentMarginLeft, tokens.chipClearContentMarginRight, tokens.chipCloseIconSize, tokens.chipFontFamily, tokens.chipFontSize, tokens.chipFontStyle, tokens.chipFontWeight, tokens.chipLetterSpacing, tokens.chipLineHeight),
22
+ s: /*#__PURE__*/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);"], tokens.height, tokens.padding, tokens.paddingWithChips, tokens.borderRadius, tokens.leftContentMargin, tokens.rightContentMargin, tokens.fontFamily, tokens.fontSize, tokens.fontStyle, tokens.fontWeight, tokens.letterSpacing, tokens.lineHeight, tokens.labelOffset, tokens.labelFontFamily, tokens.labelFontSize, tokens.labelFontStyle, tokens.labelFontWeight, tokens.labelLetterSpacing, tokens.labelLineHeight, tokens.leftHelperOffset, tokens.leftHelperFontFamily, tokens.leftHelperFontSize, tokens.leftHelperFontStyle, tokens.leftHelperFontWeight, tokens.leftHelperLetterSpacing, tokens.leftHelperLineHeight, tokens.labelInnerPadding, tokens.contentLabelInnerPadding, tokens.chipGap, tokens.chipBorderRadius, tokens.chipWidth, tokens.chipHeight, tokens.chipPaddingRight, tokens.chipPaddingLeft, tokens.chipClearContentMarginLeft, tokens.chipClearContentMarginRight, tokens.chipCloseIconSize, tokens.chipFontFamily, tokens.chipFontSize, tokens.chipFontStyle, tokens.chipFontWeight, tokens.chipLetterSpacing, tokens.chipLineHeight),
23
+ xs: /*#__PURE__*/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);"], tokens.height, tokens.padding, tokens.paddingWithChips, tokens.borderRadius, tokens.leftContentMargin, tokens.rightContentMargin, tokens.fontFamily, tokens.fontSize, tokens.fontStyle, tokens.fontWeight, tokens.letterSpacing, tokens.lineHeight, tokens.labelOffset, tokens.labelFontFamily, tokens.labelFontSize, tokens.labelFontStyle, tokens.labelFontWeight, tokens.labelLetterSpacing, tokens.labelLineHeight, tokens.leftHelperOffset, tokens.leftHelperFontFamily, tokens.leftHelperFontSize, tokens.leftHelperFontStyle, tokens.leftHelperFontWeight, tokens.leftHelperLetterSpacing, tokens.leftHelperLineHeight, tokens.labelInnerPadding, tokens.contentLabelInnerPadding, tokens.chipGap, tokens.chipBorderRadius, tokens.chipWidth, tokens.chipHeight, tokens.chipPaddingRight, tokens.chipPaddingLeft, tokens.chipClearContentMarginLeft, tokens.chipClearContentMarginRight, tokens.chipCloseIconSize, tokens.chipFontFamily, tokens.chipFontSize, tokens.chipFontStyle, tokens.chipFontWeight, tokens.chipLetterSpacing, tokens.chipLineHeight)
24
+ },
25
+ labelPlacement: {
26
+ inner: [labelPlacement_inner, /*#__PURE__*/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);}"], labelPlacement_inner, tokens.placeholderColor, tokens.labelInnerFontFamily, tokens.labelInnerFontSize, tokens.labelInnerFontStyle, tokens.labelInnerFontWeight, tokens.labelInnerLetterSpacing, tokens.labelInnerLineHeight)],
27
+ outer: [labelPlacement_outer, /*#__PURE__*/css(["&.", "{}"], labelPlacement_outer)]
28
+ },
29
+ disabled: {
30
+ "true": /*#__PURE__*/css(["", ":0.4;"], tokens.disabledOpacity)
31
+ },
32
+ // TODO заменить --surface-transparent-primary на корректный токен
33
+ readOnly: {
34
+ "true": /*#__PURE__*/css(["", ":var(--text-secondary);", ":var(--surface-transparent-primary);", ":var(--text-secondary);", ":var(--text-secondary);", ":var(--text-secondary);"], tokens.colorReadOnly, tokens.backgroundColorReadOnly, tokens.placeholderColorReadOnly, tokens.leftHelperColorReadOnly, tokens.labelColorReadOnly)
35
+ }
36
+ }
37
+ };
@@ -0,0 +1,5 @@
1
+ import { component, mergeConfig } from '../../../../engines';
2
+ import { textFieldConfig } from '../../../../components/TextField';
3
+ import { config } from './TextField.config';
4
+ var mergedConfig = /*#__PURE__*/mergeConfig(textFieldConfig, config);
5
+ export var TextField = /*#__PURE__*/component(mergedConfig);
@@ -0,0 +1,133 @@
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
+
15
+ const sizes = ['l', 'm', 's', 'xs'];
16
+ const views = ['default', 'positive', 'warning', 'negative'];
17
+ const enumerationTypes = ['plain', 'chip'];
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
+ enumerationType: {
43
+ options: enumerationTypes,
44
+ control: {
45
+ type: 'select',
46
+ },
47
+ },
48
+ size: {
49
+ options: sizes,
50
+ control: {
51
+ type: 'inline-radio',
52
+ },
53
+ },
54
+ },
55
+ };
56
+
57
+ export default meta;
58
+
59
+ type StoryPropsDefault = Omit<
60
+ ComponentProps<typeof TextField>,
61
+ | 'helperBlock'
62
+ | 'contentLeft'
63
+ | 'htmlSize'
64
+ | 'contentRight'
65
+ | 'type'
66
+ | 'name'
67
+ | 'onFocus'
68
+ | 'onBlur'
69
+ | 'onChange'
70
+ | 'value'
71
+ | 'checked'
72
+ | 'maxLength'
73
+ | 'minLength'
74
+ | 'required'
75
+ > & {
76
+ 'storybook:contentLeft': boolean;
77
+ 'storybook:contentRight': boolean;
78
+ };
79
+
80
+ const StoryDemo = ({
81
+ 'storybook:contentLeft': enableContentLeft,
82
+ 'storybook:contentRight': enableContentRight,
83
+ view,
84
+ ...rest
85
+ }: StoryPropsDefault) => {
86
+ const [text, setText] = useState('Значение поля');
87
+
88
+ const iconSize = rest.size === 'xs' ? 'xs' : 's';
89
+
90
+ return (
91
+ <TextField
92
+ {...rest}
93
+ value={text}
94
+ contentLeft={enableContentLeft ? <IconPlaceholder size={iconSize} /> : undefined}
95
+ contentRight={enableContentRight ? <IconPlaceholder size={iconSize} /> : undefined}
96
+ view={view}
97
+ onChange={(e) => {
98
+ setText(e.target.value);
99
+ onChange(e.target.value);
100
+ }}
101
+ onFocus={onFocus}
102
+ onBlur={onBlur}
103
+ onSearch={onSearch}
104
+ />
105
+ );
106
+ };
107
+
108
+ export const Default: StoryObj<StoryPropsDefault> = {
109
+ args: {
110
+ id: 'example-text-field',
111
+ size: 'l',
112
+ view: 'default',
113
+ label: 'Лейбл',
114
+ labelPlacement: 'outer',
115
+ placeholder: 'Заполните поле',
116
+ leftHelper: 'Подсказка к полю',
117
+ enumerationType: 'plain',
118
+ disabled: false,
119
+ readOnly: false,
120
+ 'storybook:contentLeft': true,
121
+ 'storybook:contentRight': true,
122
+ },
123
+ render: (args) => <StoryDemo {...args} />,
124
+ };
125
+
126
+ export const Chips: StoryObj<StoryPropsDefault> = {
127
+ args: {
128
+ ...Default.args,
129
+ enumerationType: 'chip',
130
+ values: ['1 value', '2 value', '3 value', '4 value'],
131
+ },
132
+ render: (args) => <StoryDemo {...args} />,
133
+ };
@@ -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,qFA0C9D,CAAC;AAEN,eAAO,MAAM,UAAU;;;mBA5CQ,UAAU,cAAc,EAAE,SAAS,CAAC;;;;;;;;;;;;;;CA6DlE,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,qFAwC9D,CAAC;AAEN,eAAO,MAAM,UAAU;;;mBA1CQ,UAAU,cAAc,EAAE,SAAS,CAAC;;;;;;;;;;;;;;CA2DlE,CAAC"}
@@ -1,12 +1,12 @@
1
1
  import React from 'react';
2
- import type { LabelHTMLAttributes } from 'react';
3
2
  import type { RootProps } from '../../engines';
4
3
  import type { TextFieldProps } from './TextField.types';
5
- export declare const textFieldRoot: (Root: RootProps<HTMLInputElement, TextFieldProps & LabelHTMLAttributes<HTMLLabelElement>>) => React.ForwardRefExoticComponent<import("../../engines/types").Filter<React.InputHTMLAttributes<HTMLInputElement>, "size"> & import("./TextField.types").TextFieldPropsVariations & React.RefAttributes<HTMLInputElement>>;
4
+ export declare const base: import("@linaria/core").LinariaClassName;
5
+ export declare const textFieldRoot: (Root: RootProps<HTMLDivElement, TextFieldProps>) => React.ForwardRefExoticComponent<TextFieldProps & React.RefAttributes<HTMLDivElement>>;
6
6
  export declare const textFieldConfig: {
7
7
  name: string;
8
8
  tag: string;
9
- layout: (Root: RootProps<HTMLInputElement, TextFieldProps & LabelHTMLAttributes<HTMLLabelElement>>) => React.ForwardRefExoticComponent<import("../../engines/types").Filter<React.InputHTMLAttributes<HTMLInputElement>, "size"> & import("./TextField.types").TextFieldPropsVariations & React.RefAttributes<HTMLInputElement>>;
9
+ layout: (Root: RootProps<HTMLDivElement, TextFieldProps>) => React.ForwardRefExoticComponent<TextFieldProps & React.RefAttributes<HTMLDivElement>>;
10
10
  base: import("@linaria/core").LinariaClassName;
11
11
  variations: {
12
12
  view: {
@@ -19,12 +19,17 @@ export declare const textFieldConfig: {
19
19
  css: import("@linaria/core").LinariaClassName;
20
20
  attrs: boolean;
21
21
  };
22
+ readOnly: {
23
+ css: import("@linaria/core").LinariaClassName;
24
+ attrs: boolean;
25
+ };
22
26
  labelPlacement: {
23
27
  css: import("@linaria/core").LinariaClassName;
24
28
  };
25
29
  };
26
30
  defaults: {
27
31
  size: string;
32
+ view: string;
28
33
  };
29
34
  };
30
35
  //# sourceMappingURL=TextField.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../src/components/TextField/TextField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAC1C,OAAO,KAAK,EAA4C,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAI3F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAYxD,eAAO,MAAM,aAAa,SAChB,UAAU,gBAAgB,EAAE,cAAc,GAAG,oBAAoB,gBAAgB,CAAC,CAAC,8NAoEvF,CAAC;AAEP,eAAO,MAAM,eAAe;;;mBAtElB,UAAU,gBAAgB,EAAE,cAAc,GAAG,oBAAoB,gBAAgB,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;CA6F5F,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;AAoB7F,eAAO,MAAM,IAAI,0CAIhB,CAAC;AAEF,eAAO,MAAM,aAAa,SAAU,UAAU,cAAc,EAAE,cAAc,CAAC,0FAgMxE,CAAC;AAEN,eAAO,MAAM,eAAe;;;mBAlMQ,UAAU,cAAc,EAAE,cAAc,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;CA8N5E,CAAC"}
@@ -1,7 +1,10 @@
1
1
  /// <reference types="react" />
2
- export declare const Input: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLInputElement> & import("react").InputHTMLAttributes<HTMLInputElement> & Record<never, unknown>>;
3
- export declare const InputLabelWrapper: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
4
2
  export declare const InputWrapper: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
5
- export declare const Label: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
3
+ export declare const InputLabelWrapper: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
4
+ export declare const StyledChips: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
5
+ export declare const Input: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLInputElement> & import("react").InputHTMLAttributes<HTMLInputElement> & Record<never, unknown>>;
6
+ export declare const Label: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLLabelElement> & import("react").LabelHTMLAttributes<HTMLLabelElement> & Record<never, unknown>>;
7
+ export declare const StyledContentLeft: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
8
+ export declare const StyledContentRight: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
6
9
  export declare const LeftHelper: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
7
10
  //# sourceMappingURL=TextField.styles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.styles.d.ts","sourceRoot":"","sources":["../../../src/components/TextField/TextField.styles.ts"],"names":[],"mappings":";AAEA,eAAO,MAAM,KAAK,8KAOjB,CAAC;AAEF,eAAO,MAAM,iBAAiB,qKAI7B,CAAC;AAGF,eAAO,MAAM,YAAY,qKAUxB,CAAC;AAEF,eAAO,MAAM,KAAK,qKAAe,CAAC;AAElC,eAAO,MAAM,UAAU,qKAAe,CAAC"}
1
+ {"version":3,"file":"TextField.styles.d.ts","sourceRoot":"","sources":["../../../src/components/TextField/TextField.styles.ts"],"names":[],"mappings":";AAIA,eAAO,MAAM,YAAY,qKAKxB,CAAC;AAEF,eAAO,MAAM,iBAAiB,qKAoB7B,CAAC;AAEF,eAAO,MAAM,WAAW,qKAKvB,CAAC;AAEF,eAAO,MAAM,KAAK,8KASjB,CAAC;AAEF,eAAO,MAAM,KAAK,8KAAiB,CAAC;AAEpC,eAAO,MAAM,iBAAiB,qKAE7B,CAAC;AAEF,eAAO,MAAM,kBAAkB,qKAE9B,CAAC;AAEF,eAAO,MAAM,UAAU,qKAAe,CAAC"}