@salutejs/plasma-new-hope 0.324.0-canary.1985.15205350468.0 → 0.325.0-canary.1941.15208820474.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (281) hide show
  1. package/cjs/components/Autocomplete/Autocomplete.css +1 -1
  2. package/cjs/components/CodeField/CodeField.css +14 -0
  3. package/cjs/components/CodeField/CodeField.js +290 -0
  4. package/cjs/components/CodeField/CodeField.js.map +1 -0
  5. package/cjs/components/CodeField/CodeField.styles.js +57 -0
  6. package/cjs/components/CodeField/CodeField.styles.js.map +1 -0
  7. package/cjs/components/CodeField/CodeField.styles_7zxgpc.css +6 -0
  8. package/cjs/components/CodeField/CodeField.tokens.js +59 -0
  9. package/cjs/components/CodeField/CodeField.tokens.js.map +1 -0
  10. package/cjs/components/CodeField/utils/constants.js +18 -0
  11. package/cjs/components/CodeField/utils/constants.js.map +1 -0
  12. package/cjs/components/CodeField/utils/handleCodeError.js +55 -0
  13. package/cjs/components/CodeField/utils/handleCodeError.js.map +1 -0
  14. package/cjs/components/CodeField/utils/handleItemError.js +53 -0
  15. package/cjs/components/CodeField/utils/handleItemError.js.map +1 -0
  16. package/cjs/components/CodeField/utils/initialValuesHelper.js +33 -0
  17. package/cjs/components/CodeField/utils/initialValuesHelper.js.map +1 -0
  18. package/cjs/components/CodeField/variations/_disabled/base.js +9 -0
  19. package/cjs/components/CodeField/variations/_disabled/base.js.map +1 -0
  20. package/cjs/components/CodeField/variations/_disabled/base_obsae2.css +1 -0
  21. package/cjs/components/CodeField/variations/_shape/base.js +9 -0
  22. package/cjs/components/CodeField/variations/_shape/base.js.map +1 -0
  23. package/cjs/components/CodeField/variations/_shape/base_1scsyya.css +1 -0
  24. package/cjs/components/CodeField/variations/_size/base.js +9 -0
  25. package/cjs/components/CodeField/variations/_size/base.js.map +1 -0
  26. package/cjs/components/CodeField/variations/_size/base_1wrvbr5.css +1 -0
  27. package/cjs/components/CodeField/variations/_view/base.js +9 -0
  28. package/cjs/components/CodeField/variations/_view/base.js.map +1 -0
  29. package/cjs/components/CodeField/variations/_view/base_9a5yza.css +1 -0
  30. package/cjs/components/Combobox/ComboboxNew/Combobox.css +1 -1
  31. package/cjs/components/DatePicker/RangeDate/RangeDate.css +1 -1
  32. package/cjs/components/DatePicker/RangeDate/RangeDatePopover/RangeDatePopover.css +1 -1
  33. package/cjs/components/DatePicker/SingleDate/SingleDate.css +1 -1
  34. package/cjs/components/NumberFormat/NumberFormat.js +3 -2
  35. package/cjs/components/NumberFormat/NumberFormat.js.map +1 -1
  36. package/cjs/components/NumberInput/ui/Input/Input.js +0 -3
  37. package/cjs/components/NumberInput/ui/Input/Input.js.map +1 -1
  38. package/cjs/components/Pagination/Pagination.css +1 -1
  39. package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +1 -1
  40. package/cjs/components/Range/Range.css +1 -1
  41. package/cjs/components/Select/Select.css +1 -1
  42. package/cjs/components/Select/ui/Target/Target.css +1 -1
  43. package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.css +1 -1
  44. package/cjs/components/Slider/Slider.css +1 -1
  45. package/cjs/components/Slider/components/DoubleUncontrolled/DoubleUncontrolled.css +1 -1
  46. package/cjs/components/Table/Table.css +1 -1
  47. package/cjs/components/Table/ui/Cell/Cell.css +1 -1
  48. package/cjs/components/Table/ui/EditableCell/EditableCell.css +1 -1
  49. package/cjs/components/Table/ui/HeadCell/HeadCell.css +1 -1
  50. package/cjs/components/Table/ui/HeadCell/ui/Filter/Filter.css +1 -1
  51. package/cjs/components/TextField/TextField.js +1 -1
  52. package/cjs/components/TextField/TextField.js.map +1 -1
  53. package/cjs/components/TextField/TextField.tokens.js +2 -1
  54. package/cjs/components/TextField/TextField.tokens.js.map +1 -1
  55. package/cjs/components/TextField/variations/_label-placement/base.js +1 -1
  56. package/cjs/components/TextField/variations/_label-placement/base.js.map +1 -1
  57. package/cjs/components/TextField/variations/_label-placement/base_18kkeb9.css +1 -0
  58. package/cjs/index.css +16 -1
  59. package/cjs/index.js +10 -0
  60. package/cjs/index.js.map +1 -1
  61. package/emotion/cjs/components/CodeField/CodeField.js +299 -0
  62. package/emotion/cjs/components/CodeField/CodeField.styles.js +65 -0
  63. package/emotion/cjs/components/CodeField/CodeField.template-doc.mdx +150 -0
  64. package/emotion/cjs/components/CodeField/CodeField.tokens.js +57 -0
  65. package/emotion/cjs/components/CodeField/CodeField.types.js +5 -0
  66. package/emotion/cjs/components/CodeField/index.js +50 -0
  67. package/emotion/cjs/components/CodeField/utils/constants.js +12 -0
  68. package/emotion/cjs/components/CodeField/utils/handleCodeError.js +58 -0
  69. package/emotion/cjs/components/CodeField/utils/handleItemError.js +56 -0
  70. package/emotion/cjs/components/CodeField/utils/index.js +38 -0
  71. package/emotion/cjs/components/CodeField/utils/initialValuesHelper.js +30 -0
  72. package/emotion/cjs/components/CodeField/variations/_disabled/base.js +9 -0
  73. package/emotion/cjs/components/CodeField/variations/_disabled/tokens.json +4 -0
  74. package/emotion/cjs/components/CodeField/variations/_shape/base.js +10 -0
  75. package/emotion/cjs/components/CodeField/variations/_shape/tokens.json +1 -0
  76. package/emotion/cjs/components/CodeField/variations/_size/base.js +10 -0
  77. package/emotion/cjs/components/CodeField/variations/_size/tokens.json +19 -0
  78. package/emotion/cjs/components/CodeField/variations/_view/base.js +10 -0
  79. package/emotion/cjs/components/CodeField/variations/_view/tokens.json +0 -0
  80. package/emotion/cjs/components/NumberFormat/NumberFormat.js +3 -2
  81. package/emotion/cjs/components/NumberInput/ui/Input/Input.js +0 -3
  82. package/emotion/cjs/components/TextField/TextField.js +2 -2
  83. package/emotion/cjs/components/TextField/TextField.tokens.js +2 -1
  84. package/emotion/cjs/components/TextField/variations/_label-placement/base.js +1 -1
  85. package/emotion/cjs/examples/plasma_b2c/components/CodeField/CodeField.config.js +31 -0
  86. package/emotion/cjs/examples/plasma_b2c/components/CodeField/CodeField.js +11 -0
  87. package/emotion/cjs/examples/plasma_b2c/components/CodeField/CodeField.stories.tsx +107 -0
  88. package/emotion/cjs/examples/plasma_web/components/CodeField/CodeField.config.js +31 -0
  89. package/emotion/cjs/examples/plasma_web/components/CodeField/CodeField.js +11 -0
  90. package/emotion/cjs/examples/plasma_web/components/CodeField/CodeField.stories.tsx +107 -0
  91. package/emotion/cjs/index.js +11 -0
  92. package/emotion/es/components/CodeField/CodeField.js +290 -0
  93. package/emotion/es/components/CodeField/CodeField.styles.js +58 -0
  94. package/emotion/es/components/CodeField/CodeField.template-doc.mdx +150 -0
  95. package/emotion/es/components/CodeField/CodeField.tokens.js +51 -0
  96. package/emotion/es/components/CodeField/CodeField.types.js +1 -0
  97. package/emotion/es/components/CodeField/index.js +3 -0
  98. package/emotion/es/components/CodeField/utils/constants.js +6 -0
  99. package/emotion/es/components/CodeField/utils/handleCodeError.js +52 -0
  100. package/emotion/es/components/CodeField/utils/handleItemError.js +50 -0
  101. package/emotion/es/components/CodeField/utils/index.js +3 -0
  102. package/emotion/es/components/CodeField/utils/initialValuesHelper.js +24 -0
  103. package/emotion/es/components/CodeField/variations/_disabled/base.js +3 -0
  104. package/emotion/es/components/CodeField/variations/_disabled/tokens.json +4 -0
  105. package/emotion/es/components/CodeField/variations/_shape/base.js +4 -0
  106. package/emotion/es/components/CodeField/variations/_shape/tokens.json +1 -0
  107. package/emotion/es/components/CodeField/variations/_size/base.js +4 -0
  108. package/emotion/es/components/CodeField/variations/_size/tokens.json +19 -0
  109. package/emotion/es/components/CodeField/variations/_view/base.js +4 -0
  110. package/emotion/es/components/CodeField/variations/_view/tokens.json +0 -0
  111. package/emotion/es/components/NumberFormat/NumberFormat.js +3 -2
  112. package/emotion/es/components/NumberInput/ui/Input/Input.js +0 -3
  113. package/emotion/es/components/TextField/TextField.js +2 -2
  114. package/emotion/es/components/TextField/TextField.tokens.js +2 -1
  115. package/emotion/es/components/TextField/variations/_label-placement/base.js +1 -1
  116. package/emotion/es/examples/plasma_b2c/components/CodeField/CodeField.config.js +25 -0
  117. package/emotion/es/examples/plasma_b2c/components/CodeField/CodeField.js +5 -0
  118. package/emotion/es/examples/plasma_b2c/components/CodeField/CodeField.stories.tsx +107 -0
  119. package/emotion/es/examples/plasma_web/components/CodeField/CodeField.config.js +25 -0
  120. package/emotion/es/examples/plasma_web/components/CodeField/CodeField.js +5 -0
  121. package/emotion/es/examples/plasma_web/components/CodeField/CodeField.stories.tsx +107 -0
  122. package/emotion/es/index.js +2 -1
  123. package/es/components/Autocomplete/Autocomplete.css +1 -1
  124. package/es/components/CodeField/CodeField.css +14 -0
  125. package/es/components/CodeField/CodeField.js +280 -0
  126. package/es/components/CodeField/CodeField.js.map +1 -0
  127. package/es/components/CodeField/CodeField.styles.js +48 -0
  128. package/es/components/CodeField/CodeField.styles.js.map +1 -0
  129. package/es/components/CodeField/CodeField.styles_7zxgpc.css +6 -0
  130. package/es/components/CodeField/CodeField.tokens.js +54 -0
  131. package/es/components/CodeField/CodeField.tokens.js.map +1 -0
  132. package/es/components/CodeField/utils/constants.js +9 -0
  133. package/es/components/CodeField/utils/constants.js.map +1 -0
  134. package/es/components/CodeField/utils/handleCodeError.js +51 -0
  135. package/es/components/CodeField/utils/handleCodeError.js.map +1 -0
  136. package/es/components/CodeField/utils/handleItemError.js +49 -0
  137. package/es/components/CodeField/utils/handleItemError.js.map +1 -0
  138. package/es/components/CodeField/utils/initialValuesHelper.js +27 -0
  139. package/es/components/CodeField/utils/initialValuesHelper.js.map +1 -0
  140. package/es/components/CodeField/variations/_disabled/base.js +5 -0
  141. package/es/components/CodeField/variations/_disabled/base.js.map +1 -0
  142. package/es/components/CodeField/variations/_disabled/base_obsae2.css +1 -0
  143. package/es/components/CodeField/variations/_shape/base.js +5 -0
  144. package/es/components/CodeField/variations/_shape/base.js.map +1 -0
  145. package/es/components/CodeField/variations/_shape/base_1scsyya.css +1 -0
  146. package/es/components/CodeField/variations/_size/base.js +5 -0
  147. package/es/components/CodeField/variations/_size/base.js.map +1 -0
  148. package/es/components/CodeField/variations/_size/base_1wrvbr5.css +1 -0
  149. package/es/components/CodeField/variations/_view/base.js +5 -0
  150. package/es/components/CodeField/variations/_view/base.js.map +1 -0
  151. package/es/components/CodeField/variations/_view/base_9a5yza.css +1 -0
  152. package/es/components/Combobox/ComboboxNew/Combobox.css +1 -1
  153. package/es/components/DatePicker/RangeDate/RangeDate.css +1 -1
  154. package/es/components/DatePicker/RangeDate/RangeDatePopover/RangeDatePopover.css +1 -1
  155. package/es/components/DatePicker/SingleDate/SingleDate.css +1 -1
  156. package/es/components/NumberFormat/NumberFormat.js +3 -2
  157. package/es/components/NumberFormat/NumberFormat.js.map +1 -1
  158. package/es/components/NumberInput/ui/Input/Input.js +0 -3
  159. package/es/components/NumberInput/ui/Input/Input.js.map +1 -1
  160. package/es/components/Pagination/Pagination.css +1 -1
  161. package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +1 -1
  162. package/es/components/Range/Range.css +1 -1
  163. package/es/components/Select/Select.css +1 -1
  164. package/es/components/Select/ui/Target/Target.css +1 -1
  165. package/es/components/Select/ui/Target/ui/Textfield/Textfield.css +1 -1
  166. package/es/components/Slider/Slider.css +1 -1
  167. package/es/components/Slider/components/DoubleUncontrolled/DoubleUncontrolled.css +1 -1
  168. package/es/components/Table/Table.css +1 -1
  169. package/es/components/Table/ui/Cell/Cell.css +1 -1
  170. package/es/components/Table/ui/EditableCell/EditableCell.css +1 -1
  171. package/es/components/Table/ui/HeadCell/HeadCell.css +1 -1
  172. package/es/components/Table/ui/HeadCell/ui/Filter/Filter.css +1 -1
  173. package/es/components/TextField/TextField.js +1 -1
  174. package/es/components/TextField/TextField.js.map +1 -1
  175. package/es/components/TextField/TextField.tokens.js +2 -1
  176. package/es/components/TextField/TextField.tokens.js.map +1 -1
  177. package/es/components/TextField/variations/_label-placement/base.js +1 -1
  178. package/es/components/TextField/variations/_label-placement/base.js.map +1 -1
  179. package/es/components/TextField/variations/_label-placement/base_18kkeb9.css +1 -0
  180. package/es/index.css +16 -1
  181. package/es/index.js +3 -0
  182. package/es/index.js.map +1 -1
  183. package/package.json +4 -4
  184. package/styled-components/cjs/components/CodeField/CodeField.js +299 -0
  185. package/styled-components/cjs/components/CodeField/CodeField.styles.js +38 -0
  186. package/styled-components/cjs/components/CodeField/CodeField.template-doc.mdx +150 -0
  187. package/styled-components/cjs/components/CodeField/CodeField.tokens.js +57 -0
  188. package/styled-components/cjs/components/CodeField/CodeField.types.js +5 -0
  189. package/styled-components/cjs/components/CodeField/index.js +50 -0
  190. package/styled-components/cjs/components/CodeField/utils/constants.js +12 -0
  191. package/styled-components/cjs/components/CodeField/utils/handleCodeError.js +58 -0
  192. package/styled-components/cjs/components/CodeField/utils/handleItemError.js +56 -0
  193. package/styled-components/cjs/components/CodeField/utils/index.js +38 -0
  194. package/styled-components/cjs/components/CodeField/utils/initialValuesHelper.js +30 -0
  195. package/styled-components/cjs/components/CodeField/variations/_disabled/base.js +9 -0
  196. package/styled-components/cjs/components/CodeField/variations/_disabled/tokens.json +4 -0
  197. package/styled-components/cjs/components/CodeField/variations/_shape/base.js +10 -0
  198. package/styled-components/cjs/components/CodeField/variations/_shape/tokens.json +1 -0
  199. package/styled-components/cjs/components/CodeField/variations/_size/base.js +10 -0
  200. package/styled-components/cjs/components/CodeField/variations/_size/tokens.json +19 -0
  201. package/styled-components/cjs/components/CodeField/variations/_view/base.js +10 -0
  202. package/styled-components/cjs/components/CodeField/variations/_view/tokens.json +0 -0
  203. package/styled-components/cjs/components/NumberFormat/NumberFormat.js +3 -2
  204. package/styled-components/cjs/components/NumberInput/ui/Input/Input.js +0 -3
  205. package/styled-components/cjs/components/TextField/TextField.js +1 -1
  206. package/styled-components/cjs/components/TextField/TextField.tokens.js +2 -1
  207. package/styled-components/cjs/components/TextField/variations/_label-placement/base.js +1 -1
  208. package/styled-components/cjs/examples/plasma_b2c/components/CodeField/CodeField.config.js +31 -0
  209. package/styled-components/cjs/examples/plasma_b2c/components/CodeField/CodeField.js +11 -0
  210. package/styled-components/cjs/examples/plasma_b2c/components/CodeField/CodeField.stories.tsx +107 -0
  211. package/styled-components/cjs/examples/plasma_web/components/CodeField/CodeField.config.js +31 -0
  212. package/styled-components/cjs/examples/plasma_web/components/CodeField/CodeField.js +11 -0
  213. package/styled-components/cjs/examples/plasma_web/components/CodeField/CodeField.stories.tsx +107 -0
  214. package/styled-components/cjs/index.js +11 -0
  215. package/styled-components/es/components/CodeField/CodeField.js +290 -0
  216. package/styled-components/es/components/CodeField/CodeField.styles.js +30 -0
  217. package/styled-components/es/components/CodeField/CodeField.template-doc.mdx +150 -0
  218. package/styled-components/es/components/CodeField/CodeField.tokens.js +51 -0
  219. package/styled-components/es/components/CodeField/CodeField.types.js +1 -0
  220. package/styled-components/es/components/CodeField/index.js +3 -0
  221. package/styled-components/es/components/CodeField/utils/constants.js +6 -0
  222. package/styled-components/es/components/CodeField/utils/handleCodeError.js +52 -0
  223. package/styled-components/es/components/CodeField/utils/handleItemError.js +50 -0
  224. package/styled-components/es/components/CodeField/utils/index.js +3 -0
  225. package/styled-components/es/components/CodeField/utils/initialValuesHelper.js +24 -0
  226. package/styled-components/es/components/CodeField/variations/_disabled/base.js +3 -0
  227. package/styled-components/es/components/CodeField/variations/_disabled/tokens.json +4 -0
  228. package/styled-components/es/components/CodeField/variations/_shape/base.js +4 -0
  229. package/styled-components/es/components/CodeField/variations/_shape/tokens.json +1 -0
  230. package/styled-components/es/components/CodeField/variations/_size/base.js +4 -0
  231. package/styled-components/es/components/CodeField/variations/_size/tokens.json +19 -0
  232. package/styled-components/es/components/CodeField/variations/_view/base.js +4 -0
  233. package/styled-components/es/components/CodeField/variations/_view/tokens.json +0 -0
  234. package/styled-components/es/components/NumberFormat/NumberFormat.js +3 -2
  235. package/styled-components/es/components/NumberInput/ui/Input/Input.js +0 -3
  236. package/styled-components/es/components/TextField/TextField.js +1 -1
  237. package/styled-components/es/components/TextField/TextField.tokens.js +2 -1
  238. package/styled-components/es/components/TextField/variations/_label-placement/base.js +1 -1
  239. package/styled-components/es/examples/plasma_b2c/components/CodeField/CodeField.config.js +25 -0
  240. package/styled-components/es/examples/plasma_b2c/components/CodeField/CodeField.js +5 -0
  241. package/styled-components/es/examples/plasma_b2c/components/CodeField/CodeField.stories.tsx +107 -0
  242. package/styled-components/es/examples/plasma_web/components/CodeField/CodeField.config.js +25 -0
  243. package/styled-components/es/examples/plasma_web/components/CodeField/CodeField.js +5 -0
  244. package/styled-components/es/examples/plasma_web/components/CodeField/CodeField.stories.tsx +107 -0
  245. package/styled-components/es/index.js +2 -1
  246. package/types/components/CodeField/CodeField.d.ts +69 -0
  247. package/types/components/CodeField/CodeField.d.ts.map +1 -0
  248. package/types/components/CodeField/CodeField.styles.d.ts +11 -0
  249. package/types/components/CodeField/CodeField.styles.d.ts.map +1 -0
  250. package/types/components/CodeField/CodeField.tokens.d.ts +52 -0
  251. package/types/components/CodeField/CodeField.tokens.d.ts.map +1 -0
  252. package/types/components/CodeField/CodeField.types.d.ts +93 -0
  253. package/types/components/CodeField/CodeField.types.d.ts.map +1 -0
  254. package/types/components/CodeField/index.d.ts +4 -0
  255. package/types/components/CodeField/index.d.ts.map +1 -0
  256. package/types/components/CodeField/utils/constants.d.ts +7 -0
  257. package/types/components/CodeField/utils/constants.d.ts.map +1 -0
  258. package/types/components/CodeField/utils/handleCodeError.d.ts +15 -0
  259. package/types/components/CodeField/utils/handleCodeError.d.ts.map +1 -0
  260. package/types/components/CodeField/utils/handleItemError.d.ts +14 -0
  261. package/types/components/CodeField/utils/handleItemError.d.ts.map +1 -0
  262. package/types/components/CodeField/utils/index.d.ts +4 -0
  263. package/types/components/CodeField/utils/index.d.ts.map +1 -0
  264. package/types/components/CodeField/utils/initialValuesHelper.d.ts +4 -0
  265. package/types/components/CodeField/utils/initialValuesHelper.d.ts.map +1 -0
  266. package/types/components/CodeField/variations/_disabled/base.d.ts +2 -0
  267. package/types/components/CodeField/variations/_disabled/base.d.ts.map +1 -0
  268. package/types/components/CodeField/variations/_shape/base.d.ts +2 -0
  269. package/types/components/CodeField/variations/_shape/base.d.ts.map +1 -0
  270. package/types/components/CodeField/variations/_size/base.d.ts +2 -0
  271. package/types/components/CodeField/variations/_size/base.d.ts.map +1 -0
  272. package/types/components/CodeField/variations/_view/base.d.ts +2 -0
  273. package/types/components/CodeField/variations/_view/base.d.ts.map +1 -0
  274. package/types/components/NumberInput/ui/Input/Input.d.ts.map +1 -1
  275. package/types/components/TextField/TextField.d.ts.map +1 -1
  276. package/types/components/TextField/TextField.tokens.d.ts +1 -0
  277. package/types/components/TextField/TextField.tokens.d.ts.map +1 -1
  278. package/types/index.d.ts +1 -0
  279. package/types/index.d.ts.map +1 -1
  280. package/cjs/components/TextField/variations/_label-placement/base_jfnl8i.css +0 -1
  281. package/es/components/TextField/variations/_label-placement/base_jfnl8i.css +0 -1
@@ -0,0 +1,280 @@
1
+ import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends, defineProperty as _defineProperty, toConsumableArray as _toConsumableArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
+ import React, { forwardRef, useState, useRef, useCallback, useEffect, Fragment } from 'react';
3
+ import cls from 'classnames';
4
+ import { FORBIDDEN_KEYS, BACKSPACE_KEY, ONLY_DIGITS_PATTERN } from './utils/constants.js';
5
+ import { classes } from './CodeField.tokens.js';
6
+ import { CodeWrapper, CodeGroup, ItemInput, Separator, CaptionWrapper, base } from './CodeField.styles.js';
7
+ import { base as base$1 } from './variations/_view/base.js';
8
+ import { base as base$2 } from './variations/_size/base.js';
9
+ import { base as base$3 } from './variations/_shape/base.js';
10
+ import { base as base$4 } from './variations/_disabled/base.js';
11
+ import { getCodeValue, getPlaceholderValue, getFieldPattern } from './utils/initialValuesHelper.js';
12
+ import { useDidMountEffect } from '../../hooks/useDidMountEffect.js';
13
+ import { handleCodeError } from './utils/handleCodeError.js';
14
+ import { getSizeValueFromProp } from '../../utils/getSizeValueFromProp.js';
15
+ import { handleItemError } from './utils/handleItemError.js';
16
+
17
+ var _Separator;
18
+ var _excluded = ["className", "value", "placeholder", "autoFocus", "codeLength", "caption", "captionAlign", "width", "shape", "view", "size", "disabled", "isError", "allowedSymbols", "itemErrorBehavior", "codeErrorBehavior", "autoComplete", "setIsError", "onChange", "onFullCodeEnter"];
19
+ var codeFieldRoot = function codeFieldRoot(Root) {
20
+ return /*#__PURE__*/forwardRef(function (_ref, ref) {
21
+ var className = _ref.className,
22
+ outerValue = _ref.value,
23
+ placeholder = _ref.placeholder,
24
+ autoFocus = _ref.autoFocus,
25
+ _ref$codeLength = _ref.codeLength,
26
+ codeLength = _ref$codeLength === void 0 ? 6 : _ref$codeLength,
27
+ caption = _ref.caption,
28
+ _ref$captionAlign = _ref.captionAlign,
29
+ captionAlign = _ref$captionAlign === void 0 ? 'left' : _ref$captionAlign,
30
+ width = _ref.width,
31
+ _ref$shape = _ref.shape,
32
+ shape = _ref$shape === void 0 ? 'default' : _ref$shape,
33
+ view = _ref.view,
34
+ size = _ref.size,
35
+ disabled = _ref.disabled,
36
+ isError = _ref.isError,
37
+ _ref$allowedSymbols = _ref.allowedSymbols,
38
+ allowedSymbols = _ref$allowedSymbols === void 0 ? ONLY_DIGITS_PATTERN : _ref$allowedSymbols,
39
+ _ref$itemErrorBehavio = _ref.itemErrorBehavior,
40
+ itemErrorBehavior = _ref$itemErrorBehavio === void 0 ? 'remove-symbol' : _ref$itemErrorBehavio,
41
+ _ref$codeErrorBehavio = _ref.codeErrorBehavior,
42
+ codeErrorBehavior = _ref$codeErrorBehavio === void 0 ? 'remove-code' : _ref$codeErrorBehavio,
43
+ _ref$autoComplete = _ref.autoComplete,
44
+ autoComplete = _ref$autoComplete === void 0 ? 'one-time-code' : _ref$autoComplete,
45
+ setIsError = _ref.setIsError,
46
+ onChange = _ref.onChange,
47
+ onFullCodeEnter = _ref.onFullCodeEnter,
48
+ rest = _objectWithoutProperties(_ref, _excluded);
49
+ var _useState = useState(getCodeValue(codeLength, outerValue || '')),
50
+ _useState2 = _slicedToArray(_useState, 2),
51
+ code = _useState2[0],
52
+ setCode = _useState2[1];
53
+ var _useState3 = useState(code.join('')),
54
+ _useState4 = _slicedToArray(_useState3, 2),
55
+ originalValue = _useState4[0],
56
+ setOriginalValue = _useState4[1];
57
+ var inputRefs = useRef([]);
58
+ var inputContainerRef = useRef(null);
59
+ var captionRef = useRef(null);
60
+ var fieldPattern = getFieldPattern(allowedSymbols);
61
+ var placeholderValue = getPlaceholderValue(codeLength, placeholder);
62
+ var parts = codeLength === 6 ? 2 : 1;
63
+ var widthValue = width ? getSizeValueFromProp(width, 'rem') : undefined;
64
+ var getLastActiveIndex = function getLastActiveIndex() {
65
+ if (code.length && code.length < codeLength) {
66
+ return code.length;
67
+ }
68
+ var lastEmptyIndex = code.findIndex(function (digit) {
69
+ return digit === '';
70
+ });
71
+ return lastEmptyIndex >= 0 ? lastEmptyIndex : codeLength - 1;
72
+ };
73
+ var handleClick = function handleClick() {
74
+ if (disabled) {
75
+ return;
76
+ }
77
+ var lastActiveIndex = getLastActiveIndex();
78
+ if (inputRefs.current[lastActiveIndex]) {
79
+ inputRefs.current[lastActiveIndex].focus();
80
+ }
81
+ };
82
+ var handleOnKeyDown = function handleOnKeyDown(event, index) {
83
+ if (disabled) {
84
+ return;
85
+ }
86
+ var key = event.key;
87
+ if (FORBIDDEN_KEYS.includes(key)) {
88
+ event.preventDefault();
89
+ return;
90
+ }
91
+ if (key === BACKSPACE_KEY) {
92
+ if (index > 0 && code[index] === '') {
93
+ var _inputRefs$current;
94
+ (_inputRefs$current = inputRefs.current[index - 1]) === null || _inputRefs$current === void 0 || _inputRefs$current.focus();
95
+ }
96
+ }
97
+ };
98
+ var codeSetter = function codeSetter(newCode) {
99
+ setCode(newCode);
100
+ setOriginalValue(newCode.join(''));
101
+ if (onChange) {
102
+ onChange(newCode.join(''));
103
+ }
104
+ };
105
+ var handleChange = function handleChange(event, index) {
106
+ var _inputRefs$current$in;
107
+ if (disabled) {
108
+ return;
109
+ }
110
+ var rawSymbol = event.currentTarget.value;
111
+ var symbol = rawSymbol.charAt(rawSymbol.length - 1);
112
+ var newCode = _toConsumableArray(code);
113
+ (_inputRefs$current$in = inputRefs.current[index]) === null || _inputRefs$current$in === void 0 || _inputRefs$current$in.classList.remove(classes.itemError);
114
+ if (isError) {
115
+ var _captionRef$current;
116
+ (_captionRef$current = captionRef.current) === null || _captionRef$current === void 0 || _captionRef$current.classList.remove(classes.captionError);
117
+ if (codeErrorBehavior === 'keep') {
118
+ var _inputContainerRef$cu;
119
+ (_inputContainerRef$cu = inputContainerRef.current) === null || _inputContainerRef$cu === void 0 || _inputContainerRef$cu.classList.remove(classes.codeError, classes.codeErrorAnimation);
120
+ }
121
+ if (setIsError) {
122
+ setIsError(false);
123
+ }
124
+ }
125
+ if (!fieldPattern) {
126
+ newCode[index] = symbol;
127
+ codeSetter(newCode);
128
+ if (symbol && index < codeLength - 1) {
129
+ var _inputRefs$current2;
130
+ (_inputRefs$current2 = inputRefs.current[index + 1]) === null || _inputRefs$current2 === void 0 || _inputRefs$current2.focus();
131
+ }
132
+ return;
133
+ }
134
+ if (!symbol) {
135
+ newCode[index] = '';
136
+ codeSetter(newCode);
137
+ return;
138
+ }
139
+ if (fieldPattern.test(symbol)) {
140
+ newCode[index] = symbol.charAt(symbol.length - 1);
141
+ codeSetter(newCode);
142
+ if (index < codeLength - 1) {
143
+ var _inputRefs$current3;
144
+ (_inputRefs$current3 = inputRefs.current[index + 1]) === null || _inputRefs$current3 === void 0 || _inputRefs$current3.focus();
145
+ }
146
+ } else {
147
+ newCode[index] = symbol.charAt(symbol.length - 1);
148
+ handleItemError({
149
+ currentSymbol: symbol,
150
+ itemErrorBehavior: itemErrorBehavior,
151
+ index: index,
152
+ newCode: newCode,
153
+ inputRefs: inputRefs,
154
+ setCode: setCode,
155
+ codeSetter: codeSetter
156
+ });
157
+ }
158
+ };
159
+ var handlePaste = function handlePaste(event) {
160
+ var _inputRefs$current$ac;
161
+ if (disabled) {
162
+ return;
163
+ }
164
+ event.preventDefault();
165
+ var rawData = event.clipboardData.getData('text/plain');
166
+ var pastedData = (fieldPattern ? rawData.split('').map(function (symb) {
167
+ var _symb$match;
168
+ return ((_symb$match = symb.match(fieldPattern)) === null || _symb$match === void 0 ? void 0 : _symb$match[0]) || '';
169
+ }).filter(Boolean) || [] : rawData.split('')).slice(0, codeLength);
170
+ var activeIndex = Math.min(pastedData.length, codeLength - 1);
171
+ (_inputRefs$current$ac = inputRefs.current[activeIndex]) === null || _inputRefs$current$ac === void 0 || _inputRefs$current$ac.focus();
172
+ codeSetter(pastedData);
173
+ };
174
+ var handleFullCodeEnter = useCallback(function (fullCode) {
175
+ if (onFullCodeEnter) {
176
+ onFullCodeEnter(fullCode);
177
+ }
178
+ }, []);
179
+ useEffect(function () {
180
+ inputRefs.current = inputRefs.current.slice(0, codeLength);
181
+ }, [codeLength]);
182
+ useEffect(function () {
183
+ if (autoFocus && !disabled) {
184
+ var _inputRefs$current$la;
185
+ var lastActiveIndex = getLastActiveIndex();
186
+ (_inputRefs$current$la = inputRefs.current[lastActiveIndex]) === null || _inputRefs$current$la === void 0 || _inputRefs$current$la.focus();
187
+ }
188
+ }, [autoFocus]);
189
+ useDidMountEffect(function () {
190
+ if (handleFullCodeEnter && originalValue.length === codeLength) {
191
+ handleFullCodeEnter(originalValue);
192
+ }
193
+ }, [originalValue, handleFullCodeEnter]);
194
+ useDidMountEffect(function () {
195
+ if (isError) {
196
+ handleCodeError({
197
+ codeLength: codeLength,
198
+ codeErrorBehavior: codeErrorBehavior,
199
+ currentCode: code,
200
+ inputRefs: inputRefs,
201
+ inputContainerRef: inputContainerRef,
202
+ captionRef: captionRef,
203
+ setCode: setCode,
204
+ codeSetter: codeSetter
205
+ });
206
+ }
207
+ }, [isError]);
208
+ return /*#__PURE__*/React.createElement(Root, _extends({
209
+ ref: ref,
210
+ view: view,
211
+ size: size,
212
+ shape: shape,
213
+ disabled: disabled,
214
+ onClick: handleClick,
215
+ className: cls(className, _defineProperty({}, classes.captionAlignLeft, captionAlign === 'left'))
216
+ }, rest), /*#__PURE__*/React.createElement(CodeWrapper, {
217
+ ref: inputContainerRef
218
+ }, _toConsumableArray(Array(parts)).map(function (_, partIndex) {
219
+ return /*#__PURE__*/React.createElement(Fragment, {
220
+ key: partIndex
221
+ }, /*#__PURE__*/React.createElement(CodeGroup, {
222
+ role: "group"
223
+ }, _toConsumableArray(Array(codeLength / parts)).map(function (_, i) {
224
+ var inputCorrectIndex = i + codeLength / parts * partIndex;
225
+ return /*#__PURE__*/React.createElement(ItemInput, _extends({
226
+ key: partIndex + i + partIndex * i,
227
+ ref: function ref(element) {
228
+ inputRefs.current[inputCorrectIndex] = element;
229
+ },
230
+ className: cls(_defineProperty(_defineProperty({}, classes.segmented, shape === 'segmented'), classes.hoverEnabled, inputCorrectIndex >= originalValue.length)),
231
+ value: code[inputCorrectIndex] || '',
232
+ autoComplete: autoComplete,
233
+ onChange: function onChange(e) {
234
+ handleChange(e, inputCorrectIndex);
235
+ },
236
+ onKeyDown: function onKeyDown(e) {
237
+ handleOnKeyDown(e, inputCorrectIndex);
238
+ },
239
+ onPaste: handlePaste,
240
+ tabIndex: originalValue.length === inputCorrectIndex ? 0 : -1
241
+ }, placeholderValue && {
242
+ placeholder: placeholderValue[inputCorrectIndex]
243
+ }));
244
+ })), partIndex !== parts - 1 && (_Separator || (_Separator = /*#__PURE__*/React.createElement(Separator, null))));
245
+ })), caption && /*#__PURE__*/React.createElement(CaptionWrapper, {
246
+ ref: captionRef,
247
+ captionAlign: captionAlign,
248
+ widthValue: widthValue
249
+ }, caption));
250
+ });
251
+ };
252
+ var codeFieldConfig = {
253
+ name: 'CodeField',
254
+ tag: 'div',
255
+ layout: codeFieldRoot,
256
+ base: base,
257
+ variations: {
258
+ view: {
259
+ css: base$1
260
+ },
261
+ size: {
262
+ css: base$2
263
+ },
264
+ shape: {
265
+ css: base$3
266
+ },
267
+ disabled: {
268
+ css: base$4,
269
+ attrs: true
270
+ }
271
+ },
272
+ defaults: {
273
+ size: 'm',
274
+ view: 'default',
275
+ shape: 'default'
276
+ }
277
+ };
278
+
279
+ export { codeFieldConfig, codeFieldRoot };
280
+ //# sourceMappingURL=CodeField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodeField.js","sources":["../../../src/components/CodeField/CodeField.tsx"],"sourcesContent":["import React, { forwardRef, Fragment, useCallback, useEffect, useRef, useState } from 'react';\nimport cls from 'classnames';\nimport type { ChangeEvent, KeyboardEvent, ClipboardEvent } from 'react';\nimport type { RootProps } from 'src/engines';\nimport { useDidMountEffect } from 'src/hooks';\nimport { getSizeValueFromProp } from 'src/utils';\n\nimport type { CodeFieldProps } from './CodeField.types';\nimport { BACKSPACE_KEY, FORBIDDEN_KEYS, ONLY_DIGITS_PATTERN } from './utils/constants';\nimport { getCodeValue, getFieldPattern, getPlaceholderValue, handleCodeError, handleItemError } from './utils';\nimport { classes } from './CodeField.tokens';\nimport { base, CaptionWrapper, CodeGroup, CodeWrapper, ItemInput, Separator } from './CodeField.styles';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { base as shapeCSS } from './variations/_shape/base';\nimport { base as disabledCSS } from './variations/_disabled/base';\n\nexport const codeFieldRoot = (Root: RootProps<HTMLDivElement, CodeFieldProps>) =>\n forwardRef<HTMLInputElement, CodeFieldProps>(\n (\n {\n className,\n value: outerValue,\n placeholder,\n autoFocus,\n codeLength = 6,\n caption,\n captionAlign = 'left',\n width,\n shape = 'default',\n view,\n size,\n disabled,\n isError,\n allowedSymbols = ONLY_DIGITS_PATTERN,\n itemErrorBehavior = 'remove-symbol',\n codeErrorBehavior = 'remove-code',\n autoComplete = 'one-time-code',\n setIsError,\n onChange,\n onFullCodeEnter,\n ...rest\n },\n ref,\n ) => {\n const [code, setCode] = useState<Array<string>>(getCodeValue(codeLength, outerValue || ''));\n const [originalValue, setOriginalValue] = useState<string>(code.join(''));\n\n const inputRefs = useRef<Array<HTMLInputElement>>([]);\n const inputContainerRef = useRef<HTMLDivElement | null>(null);\n const captionRef = useRef<HTMLDivElement | null>(null);\n\n const fieldPattern = getFieldPattern(allowedSymbols);\n const placeholderValue = getPlaceholderValue(codeLength, placeholder);\n const parts = codeLength === 6 ? 2 : 1;\n\n const widthValue = width ? getSizeValueFromProp(width, 'rem') : undefined;\n\n const getLastActiveIndex = () => {\n if (code.length && code.length < codeLength) {\n return code.length;\n }\n\n const lastEmptyIndex = code.findIndex((digit) => digit === '');\n return lastEmptyIndex >= 0 ? lastEmptyIndex : codeLength - 1;\n };\n\n const handleClick = () => {\n if (disabled) {\n return;\n }\n\n const lastActiveIndex = getLastActiveIndex();\n\n if (inputRefs.current[lastActiveIndex]) {\n inputRefs.current[lastActiveIndex].focus();\n }\n };\n\n const handleOnKeyDown = (event: KeyboardEvent<HTMLInputElement>, index: number) => {\n if (disabled) {\n return;\n }\n\n const { key } = event;\n if (FORBIDDEN_KEYS.includes(key)) {\n event.preventDefault();\n\n return;\n }\n\n if (key === BACKSPACE_KEY) {\n if (index > 0 && code[index] === '') {\n inputRefs.current[index - 1]?.focus();\n }\n }\n };\n\n const codeSetter = (newCode: Array<string>) => {\n setCode(newCode);\n setOriginalValue(newCode.join(''));\n\n if (onChange) {\n onChange(newCode.join(''));\n }\n };\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>, index: number) => {\n if (disabled) {\n return;\n }\n\n const rawSymbol = event.currentTarget.value;\n const symbol = rawSymbol.charAt(rawSymbol.length - 1);\n const newCode = [...code];\n\n inputRefs.current[index]?.classList.remove(classes.itemError);\n if (isError) {\n captionRef.current?.classList.remove(classes.captionError);\n\n if (codeErrorBehavior === 'keep') {\n inputContainerRef.current?.classList.remove(classes.codeError, classes.codeErrorAnimation);\n }\n\n if (setIsError) {\n setIsError(false);\n }\n }\n\n if (!fieldPattern) {\n newCode[index] = symbol;\n codeSetter(newCode);\n\n if (symbol && index < codeLength - 1) {\n inputRefs.current[index + 1]?.focus();\n }\n\n return;\n }\n\n if (!symbol) {\n newCode[index] = '';\n codeSetter(newCode);\n\n return;\n }\n\n if (fieldPattern.test(symbol)) {\n newCode[index] = symbol.charAt(symbol.length - 1);\n codeSetter(newCode);\n\n if (index < codeLength - 1) {\n inputRefs.current[index + 1]?.focus();\n }\n } else {\n newCode[index] = symbol.charAt(symbol.length - 1);\n\n handleItemError({\n currentSymbol: symbol,\n itemErrorBehavior,\n index,\n newCode,\n inputRefs,\n setCode,\n codeSetter,\n });\n }\n };\n\n const handlePaste = (event: ClipboardEvent<HTMLInputElement>) => {\n if (disabled) {\n return;\n }\n\n event.preventDefault();\n\n const rawData = event.clipboardData.getData('text/plain');\n\n const pastedData = (fieldPattern\n ? rawData\n .split('')\n .map((symb) => symb.match(fieldPattern)?.[0] || '')\n .filter(Boolean) || []\n : rawData.split('')\n ).slice(0, codeLength);\n\n const activeIndex = Math.min(pastedData.length, codeLength - 1);\n inputRefs.current[activeIndex]?.focus();\n\n codeSetter(pastedData);\n };\n\n const handleFullCodeEnter = useCallback((fullCode: string) => {\n if (onFullCodeEnter) {\n onFullCodeEnter(fullCode);\n }\n }, []);\n\n useEffect(() => {\n inputRefs.current = inputRefs.current.slice(0, codeLength);\n }, [codeLength]);\n\n useEffect(() => {\n if (autoFocus && !disabled) {\n const lastActiveIndex = getLastActiveIndex();\n\n inputRefs.current[lastActiveIndex]?.focus();\n }\n }, [autoFocus]);\n\n useDidMountEffect(() => {\n if (handleFullCodeEnter && originalValue.length === codeLength) {\n handleFullCodeEnter(originalValue);\n }\n }, [originalValue, handleFullCodeEnter]);\n\n useDidMountEffect(() => {\n if (isError) {\n handleCodeError({\n codeLength,\n codeErrorBehavior,\n currentCode: code,\n inputRefs,\n inputContainerRef,\n captionRef,\n setCode,\n codeSetter,\n });\n }\n }, [isError]);\n\n return (\n <Root\n ref={ref}\n view={view}\n size={size}\n shape={shape}\n disabled={disabled}\n onClick={handleClick}\n className={cls(className, {\n [classes.captionAlignLeft]: captionAlign === 'left',\n })}\n {...rest}\n >\n <CodeWrapper ref={inputContainerRef}>\n {[...Array(parts)].map((_, partIndex) => (\n <Fragment key={partIndex}>\n <CodeGroup role=\"group\">\n {[...Array(codeLength / parts)].map((_, i) => {\n const inputCorrectIndex = i + (codeLength / parts) * partIndex;\n\n return (\n <ItemInput\n key={partIndex + i + partIndex * i}\n ref={(element: HTMLInputElement) => {\n inputRefs.current[inputCorrectIndex] = element;\n }}\n className={cls({\n [classes.segmented]: shape === 'segmented',\n [classes.hoverEnabled]: inputCorrectIndex >= originalValue.length,\n })}\n value={code[inputCorrectIndex] || ''}\n autoComplete={autoComplete}\n onChange={(e: ChangeEvent<HTMLInputElement>) => {\n handleChange(e, inputCorrectIndex);\n }}\n onKeyDown={(e: KeyboardEvent<HTMLInputElement>) => {\n handleOnKeyDown(e, inputCorrectIndex);\n }}\n onPaste={handlePaste}\n tabIndex={originalValue.length === inputCorrectIndex ? 0 : -1}\n {...(placeholderValue && {\n placeholder: placeholderValue[inputCorrectIndex],\n })}\n />\n );\n })}\n </CodeGroup>\n {partIndex !== parts - 1 && <Separator />}\n </Fragment>\n ))}\n </CodeWrapper>\n {caption && (\n <CaptionWrapper ref={captionRef} captionAlign={captionAlign} widthValue={widthValue}>\n {caption}\n </CaptionWrapper>\n )}\n </Root>\n );\n },\n );\n\nexport const codeFieldConfig = {\n name: 'CodeField',\n tag: 'div',\n layout: codeFieldRoot,\n base,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n shape: {\n css: shapeCSS,\n },\n disabled: {\n css: disabledCSS,\n attrs: true,\n },\n },\n defaults: {\n size: 'm',\n view: 'default',\n shape: 'default',\n },\n};\n"],"names":["codeFieldRoot","Root","forwardRef","_ref","ref","className","outerValue","value","placeholder","autoFocus","_ref$codeLength","codeLength","caption","_ref$captionAlign","captionAlign","width","_ref$shape","shape","view","size","disabled","isError","_ref$allowedSymbols","allowedSymbols","ONLY_DIGITS_PATTERN","_ref$itemErrorBehavio","itemErrorBehavior","_ref$codeErrorBehavio","codeErrorBehavior","_ref$autoComplete","autoComplete","setIsError","onChange","onFullCodeEnter","rest","_objectWithoutProperties","_excluded","_useState","useState","getCodeValue","_useState2","_slicedToArray","code","setCode","_useState3","join","_useState4","originalValue","setOriginalValue","inputRefs","useRef","inputContainerRef","captionRef","fieldPattern","getFieldPattern","placeholderValue","getPlaceholderValue","parts","widthValue","getSizeValueFromProp","undefined","getLastActiveIndex","length","lastEmptyIndex","findIndex","digit","handleClick","lastActiveIndex","current","focus","handleOnKeyDown","event","index","key","FORBIDDEN_KEYS","includes","preventDefault","BACKSPACE_KEY","_inputRefs$current","codeSetter","newCode","handleChange","_inputRefs$current$in","rawSymbol","currentTarget","symbol","charAt","_toConsumableArray","classList","remove","classes","itemError","_captionRef$current","captionError","_inputContainerRef$cu","codeError","codeErrorAnimation","_inputRefs$current2","test","_inputRefs$current3","handleItemError","currentSymbol","handlePaste","_inputRefs$current$ac","rawData","clipboardData","getData","pastedData","split","map","symb","_symb$match","match","filter","Boolean","slice","activeIndex","Math","min","handleFullCodeEnter","useCallback","fullCode","useEffect","_inputRefs$current$la","useDidMountEffect","handleCodeError","currentCode","React","createElement","_extends","onClick","cls","_defineProperty","captionAlignLeft","CodeWrapper","Array","_","partIndex","Fragment","CodeGroup","role","i","inputCorrectIndex","ItemInput","element","segmented","hoverEnabled","e","onKeyDown","onPaste","tabIndex","_Separator","Separator","CaptionWrapper","codeFieldConfig","name","tag","layout","base","variations","css","viewCSS","sizeCSS","shapeCSS","disabledCSS","attrs","defaults"],"mappings":";;;;;;;;;;;;;;;;;;IAiBaA,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,IAA+C,EAAA;AAAA,EAAA,oBACzEC,UAAU,CACN,UAAAC,IAAA,EAwBIC,GAAG,EACF;AAAA,IAAA,IAvBGC,SAAS,GAAAF,IAAA,CAATE,SAAS;MACFC,UAAU,GAAAH,IAAA,CAAjBI,KAAK;MACLC,WAAW,GAAAL,IAAA,CAAXK,WAAW;MACXC,SAAS,GAAAN,IAAA,CAATM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E,MAAAA;KACR;AACDjJ,IAAAA,KAAK,EAAE;AACH+I,MAAAA,GAAG,EAAEG,MAAAA;KACR;AACD/I,IAAAA,QAAQ,EAAE;AACN4I,MAAAA,GAAG,EAAEI,MAAW;AAChBC,MAAAA,KAAK,EAAE,IAAA;AACX,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNnJ,IAAAA,IAAI,EAAE,GAAG;AACTD,IAAAA,IAAI,EAAE,SAAS;AACfD,IAAAA,KAAK,EAAE,SAAA;AACX,GAAA;AACJ;;;;"}
@@ -0,0 +1,48 @@
1
+ import './CodeField.styles_7zxgpc.css';
2
+ import { styled } from '@linaria/react';
3
+
4
+ var base = "b1xx9skx";
5
+ var CodeWrapper = /*#__PURE__*/styled('div')({
6
+ name: "CodeWrapper",
7
+ "class": "c1wzspax",
8
+ propsAsIs: false
9
+ });
10
+ var CodeGroup = /*#__PURE__*/styled('div')({
11
+ name: "CodeGroup",
12
+ "class": "c7swj1z",
13
+ propsAsIs: false
14
+ });
15
+ var Separator = /*#__PURE__*/styled('div')({
16
+ name: "Separator",
17
+ "class": "s13uxcg8",
18
+ propsAsIs: false
19
+ });
20
+ var ItemInput = /*#__PURE__*/styled('input')({
21
+ name: "ItemInput",
22
+ "class": "ig5h1kg",
23
+ propsAsIs: false
24
+ });
25
+ var _exp4 = function _exp4() {
26
+ return function (_ref) {
27
+ var captionAlign = _ref.captionAlign;
28
+ return captionAlign;
29
+ };
30
+ };
31
+ var _exp5 = function _exp5() {
32
+ return function (_ref2) {
33
+ var widthValue = _ref2.widthValue;
34
+ return widthValue || 'auto';
35
+ };
36
+ };
37
+ var CaptionWrapper = /*#__PURE__*/styled('div')({
38
+ name: "CaptionWrapper",
39
+ "class": "c1jpzjak",
40
+ propsAsIs: false,
41
+ vars: {
42
+ "c1jpzjak-0": [/*#__PURE__*/_exp4()],
43
+ "c1jpzjak-1": [/*#__PURE__*/_exp5()]
44
+ }
45
+ });
46
+
47
+ export { CaptionWrapper, CodeGroup, CodeWrapper, ItemInput, Separator, base };
48
+ //# sourceMappingURL=CodeField.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodeField.styles.js","sources":["../../../src/components/CodeField/CodeField.styles.ts"],"sourcesContent":["import { css } from '@linaria/core';\nimport { styled } from '@linaria/react';\n\nimport { classes, tokens } from './CodeField.tokens';\n\nexport const base = css`\n display: flex;\n flex-direction: column;\n justify-content: center;\n width: min-content;\n align-items: center;\n\n &.${classes.captionAlignLeft} {\n align-items: start;\n }\n`;\n\nexport const CodeWrapper = styled.div`\n display: flex;\n align-items: center;\n`;\n\nexport const CodeGroup = styled.div`\n display: flex;\n align-items: center;\n`;\n\nexport const Separator = styled.div`\n width: var(${tokens.separatorWidth});\n`;\n\nexport const ItemInput = styled.input`\n box-sizing: border-box;\n appearance: none;\n border: 0;\n padding: 0;\n outline: none;\n pointer-events: none;\n text-align: center;\n`;\n\nexport const CaptionWrapper = styled.div<{ captionAlign: 'left' | 'center'; widthValue?: string }>`\n text-align: ${({ captionAlign }) => captionAlign};\n align-self: ${({ captionAlign }) => captionAlign};\n width: ${({ widthValue }) => widthValue || 'auto'};\n white-space: pre-line;\n`;\n"],"names":["base","CodeWrapper","styled","name","class","propsAsIs","CodeGroup","Separator","ItemInput","_exp4","_ref","captionAlign","_exp5","_ref2","widthValue","CaptionWrapper","vars"],"mappings":";;AAKO,IAAMA,IAAI,GAUhB,WAAA;AAEM,IAAMC,WAAW,gBAAGC,MAAM,CAAA,KAAA,CAAA,CAAA;AAAAC,EAAAA,IAAA,EAAA,aAAA;AAAAC,EAAAA,OAAAA,EAAA,UAAA;AAAAC,EAAAA,SAAA,EAAA,KAAA;AAAA,CAGhC,EAAA;AAEM,IAAMC,SAAS,gBAAGJ,MAAM,CAAA,KAAA,CAAA,CAAA;AAAAC,EAAAA,IAAA,EAAA,WAAA;AAAAC,EAAAA,OAAAA,EAAA,SAAA;AAAAC,EAAAA,SAAA,EAAA,KAAA;AAAA,CAG9B,EAAA;AAE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;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;width:-webkit-min-content;width:-moz-min-content;width:min-content;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}.b1xx9skx.codefield-caption-align-left{-webkit-align-items:start;-webkit-box-align:start;-ms-flex-align:start;align-items:start;}
2
+ .c1wzspax{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}
3
+ .c7swj1z{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}
4
+ .s13uxcg8{width:var(--plasma-codefield-separator-width);}
5
+ .ig5h1kg{box-sizing:border-box;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:0;padding:0;outline:none;pointer-events:none;text-align:center;}
6
+ .c1jpzjak{text-align:var(--c1jpzjak-0);-webkit-align-self:var(--c1jpzjak-0);-ms-flex-item-align:var(--c1jpzjak-0);align-self:var(--c1jpzjak-0);width:var(--c1jpzjak-1);white-space:pre-line;}
@@ -0,0 +1,54 @@
1
+ var classes = {
2
+ itemError: 'codefield-item-error',
3
+ itemErrorAnimation: 'codefield-item-error-animation',
4
+ itemErrorFade: 'codefield-item-error-fade',
5
+ captionError: 'codefield-caption-error',
6
+ codeError: 'codefield-code-error',
7
+ codeErrorAnimation: 'codefield-code-error-animation',
8
+ codeErrorFade: 'codefield-code-error-fade',
9
+ captionAlignLeft: 'codefield-caption-align-left',
10
+ hoverEnabled: 'codefield-item-hover-enabled',
11
+ segmented: 'codefield-shape-segmented',
12
+ "default": 'codefield-shape-default',
13
+ disabled: 'codefield-disabled'
14
+ };
15
+ var tokens = {
16
+ captionGap: '--plasma-codefield-caption-gap',
17
+ codeItemsGap: '--plasma-codefield-code-item-gap',
18
+ separatorWidth: '--plasma-codefield-separator-width',
19
+ codeItemWidth: '--plasma-codefield-item-width',
20
+ codeItemHeight: '--plasma-codefield-item-height',
21
+ fontFamily: '--plasma-codefield-font-family',
22
+ fontStyle: '--plasma-codefield-font-style',
23
+ fontSize: '--plasma-codefield-font-size',
24
+ fontWeight: '--plasma-codefield-font-weight',
25
+ letterSpacing: '--plasma-codefield-letter-spacing',
26
+ lineHeight: '--plasma-codefield-line-height',
27
+ captionFontFamily: '--plasma-codefield-caption-font-family',
28
+ captionFontSize: '--plasma-codefield-caption-font-style',
29
+ captionFontStyle: '--plasma-codefield-caption-font-size',
30
+ captionFontWeight: '--plasma-codefield-caption-font-weight',
31
+ captionLetterSpacing: '--plasma-codefield-caption-letter-spacing',
32
+ captionLineHeight: '--plasma-codefield-caption-line-height',
33
+ borderRadius: '--plasma-codefield-code-item-border-radius',
34
+ borderRadiusSegmented: '--plasma-codefield-code-item-border-radius-segmented',
35
+ segmentedSideBorderRadius: '--plasma-codefield-code-item-segmented-side-border-radius',
36
+ captionColor: '--plasma-codefield-caption-color',
37
+ captionColorError: '--plasma-codefield-caption-color-error',
38
+ codeColor: '--plasma-codefield-code-color',
39
+ codeColorError: '--plasma-codefield-code-color-error',
40
+ backgroundColor: '--plasma-codefield-background-color',
41
+ backgroundColorHover: '--plasma-codefield-background-color-hover',
42
+ backgroundColorFocus: '--plasma-codefield-background-color-focus',
43
+ backgroundErrorColor: '--plasma-codefield-background-error-color',
44
+ borderWidth: '--plasma-codefield-border-width',
45
+ borderColor: '--plasma-codefield-border-color',
46
+ borderColorHover: '--plasma-codefield-border-color-hover',
47
+ borderColorFocus: '--plasma-codefield-border-color-focus',
48
+ borderErrorColor: '--plasma-codefield-border-error-color',
49
+ caretColor: '--plasma-codefield-caret-color',
50
+ disabledOpacity: '--plasma-codefield-disabled-opacity'
51
+ };
52
+
53
+ export { classes, tokens };
54
+ //# sourceMappingURL=CodeField.tokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodeField.tokens.js","sources":["../../../src/components/CodeField/CodeField.tokens.ts"],"sourcesContent":["export const classes = {\n itemError: 'codefield-item-error',\n itemErrorAnimation: 'codefield-item-error-animation',\n itemErrorFade: 'codefield-item-error-fade',\n captionError: 'codefield-caption-error',\n codeError: 'codefield-code-error',\n codeErrorAnimation: 'codefield-code-error-animation',\n codeErrorFade: 'codefield-code-error-fade',\n\n captionAlignLeft: 'codefield-caption-align-left',\n\n hoverEnabled: 'codefield-item-hover-enabled',\n\n segmented: 'codefield-shape-segmented',\n default: 'codefield-shape-default',\n\n disabled: 'codefield-disabled',\n};\n\nexport const tokens = {\n captionGap: '--plasma-codefield-caption-gap',\n codeItemsGap: '--plasma-codefield-code-item-gap',\n\n separatorWidth: '--plasma-codefield-separator-width',\n\n codeItemWidth: '--plasma-codefield-item-width',\n codeItemHeight: '--plasma-codefield-item-height',\n\n fontFamily: '--plasma-codefield-font-family',\n fontStyle: '--plasma-codefield-font-style',\n fontSize: '--plasma-codefield-font-size',\n fontWeight: '--plasma-codefield-font-weight',\n letterSpacing: '--plasma-codefield-letter-spacing',\n lineHeight: '--plasma-codefield-line-height',\n\n captionFontFamily: '--plasma-codefield-caption-font-family',\n captionFontSize: '--plasma-codefield-caption-font-style',\n captionFontStyle: '--plasma-codefield-caption-font-size',\n captionFontWeight: '--plasma-codefield-caption-font-weight',\n captionLetterSpacing: '--plasma-codefield-caption-letter-spacing',\n captionLineHeight: '--plasma-codefield-caption-line-height',\n\n borderRadius: '--plasma-codefield-code-item-border-radius',\n borderRadiusSegmented: '--plasma-codefield-code-item-border-radius-segmented',\n segmentedSideBorderRadius: '--plasma-codefield-code-item-segmented-side-border-radius',\n\n captionColor: '--plasma-codefield-caption-color',\n captionColorError: '--plasma-codefield-caption-color-error',\n\n codeColor: '--plasma-codefield-code-color',\n codeColorError: '--plasma-codefield-code-color-error',\n\n backgroundColor: '--plasma-codefield-background-color',\n backgroundColorHover: '--plasma-codefield-background-color-hover',\n backgroundColorFocus: '--plasma-codefield-background-color-focus',\n backgroundErrorColor: '--plasma-codefield-background-error-color',\n\n borderWidth: '--plasma-codefield-border-width',\n borderColor: '--plasma-codefield-border-color',\n borderColorHover: '--plasma-codefield-border-color-hover',\n borderColorFocus: '--plasma-codefield-border-color-focus',\n borderErrorColor: '--plasma-codefield-border-error-color',\n\n caretColor: '--plasma-codefield-caret-color',\n\n disabledOpacity: '--plasma-codefield-disabled-opacity',\n};\n"],"names":["classes","itemError","itemErrorAnimation","itemErrorFade","captionError","codeError","codeErrorAnimation","codeErrorFade","captionAlignLeft","hoverEnabled","segmented","disabled","tokens","captionGap","codeItemsGap","separatorWidth","codeItemWidth","codeItemHeight","fontFamily","fontStyle","fontSize","fontWeight","letterSpacing","lineHeight","captionFontFamily","captionFontSize","captionFontStyle","captionFontWeight","captionLetterSpacing","captionLineHeight","borderRadius","borderRadiusSegmented","segmentedSideBorderRadius","captionColor","captionColorError","codeColor","codeColorError","backgroundColor","backgroundColorHover","backgroundColorFocus","backgroundErrorColor","borderWidth","borderColor","borderColorHover","borderColorFocus","borderErrorColor","caretColor","disabledOpacity"],"mappings":"AAAO,IAAMA,OAAO,GAAG;AACnBC,EAAAA,SAAS,EAAE,sBAAsB;AACjCC,EAAAA,kBAAkB,EAAE,gCAAgC;AACpDC,EAAAA,aAAa,EAAE,2BAA2B;AAC1CC,EAAAA,YAAY,EAAE,yBAAyB;AACvCC,EAAAA,SAAS,EAAE,sBAAsB;AACjCC,EAAAA,kBAAkB,EAAE,gCAAgC;AACpDC,EAAAA,aAAa,EAAE,2BAA2B;AAE1CC,EAAAA,gBAAgB,EAAE,8BAA8B;AAEhDC,EAAAA,YAAY,EAAE,8BAA8B;AAE5CC,EAAAA,SAAS,EAAE,2BAA2B;AACtC,EAAA,SAAA,EAAS,yBAAyB;AAElCC,EAAAA,QAAQ,EAAE,oBAAA;AACd,EAAC;AAEM,IAAMC,MAAM,GAAG;AAClBC,EAAAA,UAAU,EAAE,gCAAgC;AAC5CC,EAAAA,YAAY,EAAE,kCAAkC;AAEhDC,EAAAA,cAAc,EAAE,oCAAoC;AAEpDC,EAAAA,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 var ONLY_CHARS_PATTERN = '^[a-zA-Z]+$';
3
+ var ONLY_DIGITS_AND_CHARS_PATTERN = '^[a-zA-Z0-9]+$';
4
+ var FORBIDDEN_KEYS = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Delete'];
5
+ var BACKSPACE_KEY = 'Backspace';
6
+ var ANIMATION_TIMEOUT = 300;
7
+
8
+ export { ANIMATION_TIMEOUT, BACKSPACE_KEY, FORBIDDEN_KEYS, ONLY_CHARS_PATTERN, ONLY_DIGITS_AND_CHARS_PATTERN, ONLY_DIGITS_PATTERN };
9
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sources":["../../../../src/components/CodeField/utils/constants.ts"],"sourcesContent":["export const ONLY_DIGITS_PATTERN = '^\\\\d+$';\nexport const ONLY_CHARS_PATTERN = '^[a-zA-Z]+$';\nexport const ONLY_DIGITS_AND_CHARS_PATTERN = '^[a-zA-Z0-9]+$';\n\nexport const FORBIDDEN_KEYS = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Delete'];\nexport const BACKSPACE_KEY = 'Backspace';\n\nexport const ANIMATION_TIMEOUT = 300;\n"],"names":["ONLY_DIGITS_PATTERN","ONLY_CHARS_PATTERN","ONLY_DIGITS_AND_CHARS_PATTERN","FORBIDDEN_KEYS","BACKSPACE_KEY","ANIMATION_TIMEOUT"],"mappings":"AAAO,IAAMA,mBAAmB,GAAG,SAAQ;AACpC,IAAMC,kBAAkB,GAAG,cAAa;AACxC,IAAMC,6BAA6B,GAAG,iBAAgB;AAEhDC,IAAAA,cAAc,GAAG,CAAC,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAC;AACpF,IAAMC,aAAa,GAAG,YAAW;AAEjC,IAAMC,iBAAiB,GAAG;;;;"}
@@ -0,0 +1,51 @@
1
+ import { toConsumableArray as _toConsumableArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
2
+ import { classes } from '../CodeField.tokens.js';
3
+ import { ANIMATION_TIMEOUT } from './constants.js';
4
+ import { getCodeValue } from './initialValuesHelper.js';
5
+
6
+ var handleCodeError = function handleCodeError(_ref) {
7
+ var _captionRef$current, _captionRef$current2;
8
+ var codeLength = _ref.codeLength,
9
+ codeErrorBehavior = _ref.codeErrorBehavior,
10
+ currentCode = _ref.currentCode,
11
+ inputRefs = _ref.inputRefs,
12
+ inputContainerRef = _ref.inputContainerRef,
13
+ captionRef = _ref.captionRef,
14
+ setCode = _ref.setCode,
15
+ codeSetter = _ref.codeSetter;
16
+ if (!inputContainerRef.current) {
17
+ return;
18
+ }
19
+ switch (codeErrorBehavior) {
20
+ case 'keep':
21
+ inputContainerRef.current.classList.add(classes.codeError, classes.codeErrorAnimation);
22
+ (_captionRef$current = captionRef.current) === null || _captionRef$current === void 0 || _captionRef$current.classList.add(classes.captionError);
23
+ setTimeout(function () {
24
+ var _inputContainerRef$cu;
25
+ var newCode = _toConsumableArray(currentCode);
26
+ newCode.pop();
27
+ codeSetter(newCode);
28
+ setCode(currentCode);
29
+ (_inputContainerRef$cu = inputContainerRef.current) === null || _inputContainerRef$cu === void 0 || _inputContainerRef$cu.classList.remove(classes.codeErrorAnimation);
30
+ setTimeout(function () {
31
+ var _inputRefs$current, _inputRefs$current2;
32
+ (_inputRefs$current = inputRefs.current[inputRefs.current.length - 1]) === null || _inputRefs$current === void 0 || _inputRefs$current.setSelectionRange(0, 1);
33
+ (_inputRefs$current2 = inputRefs.current[inputRefs.current.length - 1]) === null || _inputRefs$current2 === void 0 || _inputRefs$current2.focus();
34
+ }, 0);
35
+ }, ANIMATION_TIMEOUT);
36
+ break;
37
+ case 'remove-code':
38
+ default:
39
+ inputContainerRef.current.classList.add(classes.codeError, classes.codeErrorAnimation, classes.codeErrorFade);
40
+ (_captionRef$current2 = captionRef.current) === null || _captionRef$current2 === void 0 || _captionRef$current2.classList.add(classes.captionError);
41
+ setTimeout(function () {
42
+ var _inputRefs$current$, _inputContainerRef$cu2;
43
+ codeSetter(getCodeValue(codeLength, ''));
44
+ (_inputRefs$current$ = inputRefs.current[0]) === null || _inputRefs$current$ === void 0 || _inputRefs$current$.focus();
45
+ (_inputContainerRef$cu2 = inputContainerRef.current) === null || _inputContainerRef$cu2 === void 0 || _inputContainerRef$cu2.classList.remove(classes.codeError, classes.codeErrorAnimation, classes.codeErrorFade);
46
+ }, ANIMATION_TIMEOUT);
47
+ }
48
+ };
49
+
50
+ export { handleCodeError };
51
+ //# sourceMappingURL=handleCodeError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handleCodeError.js","sources":["../../../../src/components/CodeField/utils/handleCodeError.ts"],"sourcesContent":["import { Dispatch, MutableRefObject, SetStateAction } from 'react';\n\nimport type { CodeErrorBehavior } from '../CodeField.types';\nimport { classes } from '../CodeField.tokens';\n\nimport { ANIMATION_TIMEOUT } from './constants';\nimport { getCodeValue } from './initialValuesHelper';\n\ntype ValidateSymbolsArgs = {\n codeLength: number;\n codeErrorBehavior: CodeErrorBehavior;\n currentCode: Array<string>;\n inputContainerRef: MutableRefObject<HTMLDivElement | null>;\n inputRefs: MutableRefObject<Array<HTMLInputElement | null>>;\n captionRef: MutableRefObject<HTMLDivElement | null>;\n setCode: Dispatch<SetStateAction<Array<string>>>;\n codeSetter: (newCode: Array<string>) => void;\n};\n\nexport const handleCodeError = ({\n codeLength,\n codeErrorBehavior,\n currentCode,\n inputRefs,\n inputContainerRef,\n captionRef,\n setCode,\n codeSetter,\n}: ValidateSymbolsArgs) => {\n if (!inputContainerRef.current) {\n return;\n }\n\n switch (codeErrorBehavior) {\n case 'keep':\n inputContainerRef.current.classList.add(classes.codeError, classes.codeErrorAnimation);\n captionRef.current?.classList.add(classes.captionError);\n\n setTimeout(() => {\n const newCode = [...currentCode];\n\n newCode.pop();\n codeSetter(newCode);\n setCode(currentCode);\n\n inputContainerRef.current?.classList.remove(classes.codeErrorAnimation);\n\n setTimeout(() => {\n inputRefs.current[inputRefs.current.length - 1]?.setSelectionRange(0, 1);\n inputRefs.current[inputRefs.current.length - 1]?.focus();\n }, 0);\n }, ANIMATION_TIMEOUT);\n\n break;\n case 'remove-code':\n default:\n inputContainerRef.current.classList.add(\n classes.codeError,\n classes.codeErrorAnimation,\n classes.codeErrorFade,\n );\n captionRef.current?.classList.add(classes.captionError);\n\n setTimeout(() => {\n codeSetter(getCodeValue(codeLength, ''));\n\n inputRefs.current[0]?.focus();\n inputContainerRef.current?.classList.remove(\n classes.codeError,\n classes.codeErrorAnimation,\n classes.codeErrorFade,\n );\n }, ANIMATION_TIMEOUT);\n }\n};\n"],"names":["handleCodeError","_ref","_captionRef$current","_captionRef$current2","codeLength","codeErrorBehavior","currentCode","inputRefs","inputContainerRef","captionRef","setCode","codeSetter","current","classList","add","classes","codeError","codeErrorAnimation","captionError","setTimeout","_inputContainerRef$cu","newCode","_toConsumableArray","pop","remove","_inputRefs$current","_inputRefs$current2","length","setSelectionRange","focus","ANIMATION_TIMEOUT","codeErrorFade","_inputRefs$current$","_inputContainerRef$cu2","getCodeValue"],"mappings":";;;;;IAmBaA,eAAe,GAAG,SAAlBA,eAAeA,CAAAC,IAAA,EASD;EAAA,IAAAC,mBAAA,EAAAC,oBAAA,CAAA;AAAA,EAAA,IARvBC,UAAU,GAAAH,IAAA,CAAVG,UAAU;IACVC,iBAAiB,GAAAJ,IAAA,CAAjBI,iBAAiB;IACjBC,WAAW,GAAAL,IAAA,CAAXK,WAAW;IACXC,SAAS,GAAAN,IAAA,CAATM,SAAS;IACTC,iBAAiB,GAAAP,IAAA,CAAjBO,iBAAiB;IACjBC,UAAU,GAAAR,IAAA,CAAVQ,UAAU;IACVC,OAAO,GAAAT,IAAA,CAAPS,OAAO;IACPC,UAAU,GAAAV,IAAA,CAAVU,UAAU,CAAA;AAEV,EAAA,IAAI,CAACH,iBAAiB,CAACI,OAAO,EAAE;AAC5B,IAAA,OAAA;AACJ,GAAA;AAEA,EAAA,QAAQP,iBAAiB;AACrB,IAAA,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A;AAErB,MAAA,MAAA;AACJ,IAAA,KAAK,aAAa,CAAA;AAClB,IAAA;AACItB,MAAAA,iBAAiB,CAACI,OAAO,CAACC,SAAS,CAACC,GAAG,CACnCC,OAAO,CAACC,SAAS,EACjBD,OAAO,CAACE,kBAAkB,EAC1BF,OAAO,CAACgB,aACZ,CAAC,CAAA;AACD,MAAA,CAAA5B,oBAAA,GAAAM,UAAU,CAACG,OAAO,cAAAT,oBAAA,KAAA,KAAA,CAAA,IAAlBA,oBAAA,CAAoBU,SAAS,CAACC,GAAG,CAACC,OAAO,CAACG,YAAY,CAAC,CAAA;AAEvDC,MAAAA,UAAU,CAAC,YAAM;QAAA,IAAAa,mBAAA,EAAAC,sBAAA,CAAA;AACbtB,QAAAA,UAAU,CAACuB,YAAY,CAAC9B,UAAU,EAAE,EAAE,CAAC,CAAC,CAAA;AAExC,QAAA,CAAA4B,mBAAA,GAAAzB,SAAS,CAACK,OAAO,CAAC,CAAC,CAAC,MAAA,IAAA,IAAAoB,mBAAA,KAApBA,KAAAA,CAAAA,IAAAA,mBAAA,CAAsBH,KAAK,EAAE,CAAA;QAC7B,CAAAI,sBAAA,GAAAzB,iBAAiB,CAACI,OAAO,cAAAqB,sBAAA,KAAA,KAAA,CAAA,IAAzBA,sBAAA,CAA2BpB,SAAS,CAACW,MAAM,CACvCT,OAAO,CAACC,SAAS,EACjBD,OAAO,CAACE,kBAAkB,EAC1BF,OAAO,CAACgB,aACZ,CAAC,CAAA;OACJ,EAAED,iBAAiB,CAAC,CAAA;AAC7B,GAAA;AACJ;;;;"}
@@ -0,0 +1,49 @@
1
+ import { toConsumableArray as _toConsumableArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
2
+ import { classes } from '../CodeField.tokens.js';
3
+ import { ANIMATION_TIMEOUT } from './constants.js';
4
+
5
+ var handleItemError = function handleItemError(_ref) {
6
+ var _inputRefs$current$in, _inputRefs$current$in4;
7
+ var currentSymbol = _ref.currentSymbol,
8
+ itemErrorBehavior = _ref.itemErrorBehavior,
9
+ index = _ref.index,
10
+ newCode = _ref.newCode,
11
+ inputRefs = _ref.inputRefs,
12
+ setCode = _ref.setCode,
13
+ codeSetter = _ref.codeSetter;
14
+ if (!inputRefs.current[index] || currentSymbol === ' ') {
15
+ return;
16
+ }
17
+ switch (itemErrorBehavior) {
18
+ case 'keep':
19
+ setCode(newCode);
20
+ (_inputRefs$current$in = inputRefs.current[index]) === null || _inputRefs$current$in === void 0 || _inputRefs$current$in.classList.add(classes.itemError, classes.itemErrorAnimation);
21
+ setTimeout(function () {
22
+ var _inputRefs$current$in2;
23
+ (_inputRefs$current$in2 = inputRefs.current[index]) === null || _inputRefs$current$in2 === void 0 || _inputRefs$current$in2.classList.remove(classes.itemErrorAnimation);
24
+ setTimeout(function () {
25
+ var _inputRefs$current$in3;
26
+ return (_inputRefs$current$in3 = inputRefs.current[index]) === null || _inputRefs$current$in3 === void 0 ? void 0 : _inputRefs$current$in3.setSelectionRange(0, 1);
27
+ }, 0);
28
+ }, ANIMATION_TIMEOUT);
29
+ break;
30
+ case 'forbid-enter':
31
+ newCode[index] = '';
32
+ codeSetter(newCode);
33
+ break;
34
+ case 'remove-symbol':
35
+ default:
36
+ setCode(newCode);
37
+ (_inputRefs$current$in4 = inputRefs.current[index]) === null || _inputRefs$current$in4 === void 0 || _inputRefs$current$in4.classList.add(classes.itemError, classes.itemErrorFade, classes.itemErrorAnimation);
38
+ setTimeout(function () {
39
+ var _inputRefs$current$in5;
40
+ var updatedCode = _toConsumableArray(newCode);
41
+ updatedCode[index] = '';
42
+ codeSetter(updatedCode);
43
+ (_inputRefs$current$in5 = inputRefs.current[index]) === null || _inputRefs$current$in5 === void 0 || _inputRefs$current$in5.classList.remove(classes.itemError, classes.itemErrorFade, classes.itemErrorAnimation);
44
+ }, ANIMATION_TIMEOUT);
45
+ }
46
+ };
47
+
48
+ export { handleItemError };
49
+ //# sourceMappingURL=handleItemError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handleItemError.js","sources":["../../../../src/components/CodeField/utils/handleItemError.ts"],"sourcesContent":["import { Dispatch, MutableRefObject, SetStateAction } from 'react';\n\nimport type { ItemErrorBehavior } from '../CodeField.types';\nimport { classes } from '../CodeField.tokens';\n\nimport { ANIMATION_TIMEOUT } from './constants';\n\ntype ValidateSymbolsArgs = {\n currentSymbol: string;\n itemErrorBehavior: ItemErrorBehavior;\n index: number;\n newCode: Array<string>;\n inputRefs: MutableRefObject<Array<HTMLInputElement | null>>;\n setCode: Dispatch<SetStateAction<Array<string>>>;\n codeSetter: (newCode: Array<string>) => void;\n};\n\nexport const handleItemError = ({\n currentSymbol,\n itemErrorBehavior,\n index,\n newCode,\n inputRefs,\n setCode,\n codeSetter,\n}: ValidateSymbolsArgs) => {\n if (!inputRefs.current[index] || currentSymbol === ' ') {\n return;\n }\n\n switch (itemErrorBehavior) {\n case 'keep':\n setCode(newCode);\n inputRefs.current[index]?.classList.add(classes.itemError, classes.itemErrorAnimation);\n\n setTimeout(() => {\n inputRefs.current[index]?.classList.remove(classes.itemErrorAnimation);\n\n setTimeout(() => inputRefs.current[index]?.setSelectionRange(0, 1), 0);\n }, ANIMATION_TIMEOUT);\n\n break;\n case 'forbid-enter':\n newCode[index] = '';\n codeSetter(newCode);\n\n break;\n case 'remove-symbol':\n default:\n setCode(newCode);\n inputRefs.current[index]?.classList.add(\n classes.itemError,\n classes.itemErrorFade,\n classes.itemErrorAnimation,\n );\n\n setTimeout(() => {\n const updatedCode = [...newCode];\n updatedCode[index] = '';\n\n codeSetter(updatedCode);\n\n inputRefs.current[index]?.classList.remove(\n classes.itemError,\n classes.itemErrorFade,\n classes.itemErrorAnimation,\n );\n }, ANIMATION_TIMEOUT);\n }\n};\n"],"names":["handleItemError","_ref","_inputRefs$current$in","_inputRefs$current$in4","currentSymbol","itemErrorBehavior","index","newCode","inputRefs","setCode","codeSetter","current","classList","add","classes","itemError","itemErrorAnimation","setTimeout","_inputRefs$current$in2","remove","_inputRefs$current$in3","setSelectionRange","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