@mrshmllw/smores-react 4.0.1 → 5.0.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 (520) hide show
  1. package/README.md +0 -2
  2. package/dist/.gitkeep +0 -0
  3. package/dist/Accordion/Accordion.js +90 -32
  4. package/dist/ActionDropdown/ActionDropdown.js +65 -25
  5. package/dist/ActionDropdown/List.js +8 -6
  6. package/dist/Banner/BannerContainer.js +40 -31
  7. package/dist/Banner/BannerItem.js +112 -54
  8. package/dist/Banner/hooks.js +7 -5
  9. package/dist/Box/Box.js +7 -5
  10. package/dist/BrandCard/BrandCard.js +61 -24
  11. package/dist/Button/Button.js +110 -40
  12. package/dist/Card/Card.js +86 -34
  13. package/dist/CheckBox/CheckBox.js +41 -20
  14. package/dist/CheckBoxGroup/CheckBoxGroup.js +22 -6
  15. package/dist/Chip/Chip.d.ts +1 -1
  16. package/dist/Chip/Chip.js +60 -26
  17. package/dist/CurrencyInput/CurrencyInput.js +89 -50
  18. package/dist/Datepicker/Datepicker.js +130 -83
  19. package/dist/Datepicker/DatesList.js +42 -26
  20. package/dist/Divider/Divider.js +17 -11
  21. package/dist/Dropdown/Dropdown.js +101 -54
  22. package/dist/Emoji/Emoji.js +27 -6
  23. package/dist/Icon/Icon.js +5522 -851
  24. package/dist/IconStrict/IconStrict.js +67 -38
  25. package/dist/IconWrapper/IconWrapper.js +28 -12
  26. package/dist/LabelledText/LabelledText.js +16 -8
  27. package/dist/Link/Link.js +87 -47
  28. package/dist/Loader/Loader.js +38 -12
  29. package/dist/Logo/Logo.js +154 -44
  30. package/dist/Modal/Modal.js +73 -27
  31. package/dist/Modal/useBodyScrollLock.js +23 -19
  32. package/dist/NumberInput/NumberInput.js +125 -78
  33. package/dist/Pagination/Pagination.js +144 -103
  34. package/dist/RadioGroup/RadioElement.js +33 -18
  35. package/dist/RadioGroup/RadioGroup.js +64 -33
  36. package/dist/RadioGroup/RadioItem.js +79 -47
  37. package/dist/RadioGroup/constants.js +3 -2
  38. package/dist/Row/Row.js +68 -27
  39. package/dist/SearchInput/SearchInput.js +102 -45
  40. package/dist/SearchInput/SearchOptions.js +18 -14
  41. package/dist/Snackbar/SnackbarContainer.js +49 -31
  42. package/dist/Snackbar/SnackbarItem.js +37 -17
  43. package/dist/Snackbar/hooks.js +7 -5
  44. package/dist/SupportMessage/SupportMessage.js +79 -52
  45. package/dist/Table/Table.js +73 -50
  46. package/dist/Table/components/RowActions.js +82 -43
  47. package/dist/Table/components/TableHeader.js +40 -7
  48. package/dist/Table/components/TableRow.js +111 -69
  49. package/dist/Table/components/commonComponents.js +31 -46
  50. package/dist/Table/helpers.js +14 -10
  51. package/dist/Tag/Tag.js +28 -9
  52. package/dist/Text/Text.js +53 -33
  53. package/dist/Text/fontMapping.js +19 -17
  54. package/dist/TextInput/TextInput.js +65 -16
  55. package/dist/Textarea/Textarea.js +50 -16
  56. package/dist/Toggle/Toggle.js +32 -16
  57. package/dist/Tooltip/Tooltip.js +202 -178
  58. package/dist/fields/Field/Field.js +7 -5
  59. package/dist/fields/Fieldset/Fieldset.js +21 -5
  60. package/dist/fields/commonFieldTypes.d.ts +1 -1
  61. package/dist/fields/components/CommonInput.js +17 -21
  62. package/dist/fields/components/InternalField.js +77 -29
  63. package/dist/fontStyle.js +5 -3
  64. package/dist/hooks/useClickOutside/index.js +30 -22
  65. package/dist/hooks/useEventListener/index.js +19 -12
  66. package/dist/hooks/useScript/index.js +16 -11
  67. package/dist/hooks/useTimeout/index.js +13 -11
  68. package/dist/index.d.ts +1 -1
  69. package/dist/index.js +49 -43
  70. package/dist/theme.js +87 -57
  71. package/dist/utils/date.js +8 -7
  72. package/dist/utils/debounce.js +13 -18
  73. package/dist/utils/flex.js +47 -30
  74. package/dist/utils/focusOutline.js +8 -4
  75. package/dist/utils/id.js +10 -8
  76. package/dist/utils/isReactElement.js +5 -3
  77. package/dist/utils/measure.js +11 -10
  78. package/dist/utils/responsiveProp.js +16 -17
  79. package/dist/utils/space.js +78 -62
  80. package/dist/utils/useControlledState.js +20 -12
  81. package/dist/utils/visuallyHidden.js +3 -6
  82. package/package.json +17 -16
  83. package/dist/Accordion/Accordion.js.map +0 -1
  84. package/dist/Accordion/Accordion.stories.d.ts +0 -9
  85. package/dist/Accordion/Accordion.stories.js +0 -11
  86. package/dist/Accordion/Accordion.stories.js.map +0 -1
  87. package/dist/Accordion/Collection.d.ts +0 -2
  88. package/dist/Accordion/Collection.js +0 -52
  89. package/dist/Accordion/Collection.js.map +0 -1
  90. package/dist/Accordion/__tests__/Accordion.d.ts +0 -1
  91. package/dist/Accordion/__tests__/Accordion.js +0 -9
  92. package/dist/Accordion/__tests__/Accordion.js.map +0 -1
  93. package/dist/Accordion/index.js +0 -2
  94. package/dist/Accordion/index.js.map +0 -1
  95. package/dist/ActionDropdown/ActionDropdown.js.map +0 -1
  96. package/dist/ActionDropdown/ActionDropdown.stories.d.ts +0 -7
  97. package/dist/ActionDropdown/ActionDropdown.stories.js +0 -13
  98. package/dist/ActionDropdown/ActionDropdown.stories.js.map +0 -1
  99. package/dist/ActionDropdown/Container.d.ts +0 -2
  100. package/dist/ActionDropdown/Container.js +0 -51
  101. package/dist/ActionDropdown/Container.js.map +0 -1
  102. package/dist/ActionDropdown/List.js.map +0 -1
  103. package/dist/ActionDropdown/__tests__/ActionDropdown.d.ts +0 -1
  104. package/dist/ActionDropdown/__tests__/ActionDropdown.js +0 -23
  105. package/dist/ActionDropdown/__tests__/ActionDropdown.js.map +0 -1
  106. package/dist/ActionDropdown/index.js +0 -2
  107. package/dist/ActionDropdown/index.js.map +0 -1
  108. package/dist/Banner/Banner.stories.d.ts +0 -9
  109. package/dist/Banner/Banner.stories.js +0 -86
  110. package/dist/Banner/Banner.stories.js.map +0 -1
  111. package/dist/Banner/BannerContainer.js.map +0 -1
  112. package/dist/Banner/BannerItem.js.map +0 -1
  113. package/dist/Banner/hooks.js.map +0 -1
  114. package/dist/Banner/index.js +0 -3
  115. package/dist/Banner/index.js.map +0 -1
  116. package/dist/Banner/types.js +0 -2
  117. package/dist/Banner/types.js.map +0 -1
  118. package/dist/Box/Box.js.map +0 -1
  119. package/dist/Box/Box.stories.d.ts +0 -7
  120. package/dist/Box/Box.stories.js +0 -38
  121. package/dist/Box/Box.stories.js.map +0 -1
  122. package/dist/Box/__tests__/Box.d.ts +0 -1
  123. package/dist/Box/__tests__/Box.js +0 -9
  124. package/dist/Box/__tests__/Box.js.map +0 -1
  125. package/dist/Box/index.js +0 -2
  126. package/dist/Box/index.js.map +0 -1
  127. package/dist/BrandCard/BrandCard.js.map +0 -1
  128. package/dist/BrandCard/BrandCard.stories.d.ts +0 -11
  129. package/dist/BrandCard/BrandCard.stories.js +0 -54
  130. package/dist/BrandCard/BrandCard.stories.js.map +0 -1
  131. package/dist/BrandCard/__tests__/BrandCard.d.ts +0 -1
  132. package/dist/BrandCard/__tests__/BrandCard.js +0 -9
  133. package/dist/BrandCard/__tests__/BrandCard.js.map +0 -1
  134. package/dist/BrandCard/index.js +0 -2
  135. package/dist/BrandCard/index.js.map +0 -1
  136. package/dist/Button/Button.js.map +0 -1
  137. package/dist/Button/Button.stories.d.ts +0 -16
  138. package/dist/Button/Button.stories.js +0 -28
  139. package/dist/Button/Button.stories.js.map +0 -1
  140. package/dist/Button/Collection.d.ts +0 -4
  141. package/dist/Button/Collection.js +0 -53
  142. package/dist/Button/Collection.js.map +0 -1
  143. package/dist/Button/InteractivePlayground.d.ts +0 -2
  144. package/dist/Button/InteractivePlayground.js +0 -17
  145. package/dist/Button/InteractivePlayground.js.map +0 -1
  146. package/dist/Button/__tests__/Button.d.ts +0 -1
  147. package/dist/Button/__tests__/Button.js +0 -9
  148. package/dist/Button/__tests__/Button.js.map +0 -1
  149. package/dist/Button/index.js +0 -2
  150. package/dist/Button/index.js.map +0 -1
  151. package/dist/Card/Card.js.map +0 -1
  152. package/dist/Card/Card.stories.d.ts +0 -17
  153. package/dist/Card/Card.stories.js +0 -92
  154. package/dist/Card/Card.stories.js.map +0 -1
  155. package/dist/Card/__tests__/Card.d.ts +0 -1
  156. package/dist/Card/__tests__/Card.js +0 -9
  157. package/dist/Card/__tests__/Card.js.map +0 -1
  158. package/dist/Card/index.js +0 -2
  159. package/dist/Card/index.js.map +0 -1
  160. package/dist/CheckBox/CheckBox.js.map +0 -1
  161. package/dist/CheckBox/CheckBox.stories.d.ts +0 -10
  162. package/dist/CheckBox/CheckBox.stories.js +0 -22
  163. package/dist/CheckBox/CheckBox.stories.js.map +0 -1
  164. package/dist/CheckBox/Container.d.ts +0 -2
  165. package/dist/CheckBox/Container.js +0 -7
  166. package/dist/CheckBox/Container.js.map +0 -1
  167. package/dist/CheckBox/__tests__/CheckBox.d.ts +0 -1
  168. package/dist/CheckBox/__tests__/CheckBox.js +0 -8
  169. package/dist/CheckBox/__tests__/CheckBox.js.map +0 -1
  170. package/dist/CheckBox/index.js +0 -2
  171. package/dist/CheckBox/index.js.map +0 -1
  172. package/dist/CheckBoxGroup/CheckBoxGroup.js.map +0 -1
  173. package/dist/CheckBoxGroup/CheckBoxGroup.stories.d.ts +0 -14
  174. package/dist/CheckBoxGroup/CheckBoxGroup.stories.js +0 -40
  175. package/dist/CheckBoxGroup/CheckBoxGroup.stories.js.map +0 -1
  176. package/dist/CheckBoxGroup/index.js +0 -2
  177. package/dist/CheckBoxGroup/index.js.map +0 -1
  178. package/dist/Chip/Chip.js.map +0 -1
  179. package/dist/Chip/Chip.stories.d.ts +0 -16
  180. package/dist/Chip/Chip.stories.js +0 -35
  181. package/dist/Chip/Chip.stories.js.map +0 -1
  182. package/dist/Chip/index.js +0 -2
  183. package/dist/Chip/index.js.map +0 -1
  184. package/dist/CurrencyInput/Collection.d.ts +0 -2
  185. package/dist/CurrencyInput/Collection.js +0 -65
  186. package/dist/CurrencyInput/Collection.js.map +0 -1
  187. package/dist/CurrencyInput/CurrencyInput.js.map +0 -1
  188. package/dist/CurrencyInput/CurrencyInput.stories.d.ts +0 -16
  189. package/dist/CurrencyInput/CurrencyInput.stories.js +0 -33
  190. package/dist/CurrencyInput/CurrencyInput.stories.js.map +0 -1
  191. package/dist/CurrencyInput/Example.d.ts +0 -2
  192. package/dist/CurrencyInput/Example.js +0 -8
  193. package/dist/CurrencyInput/Example.js.map +0 -1
  194. package/dist/CurrencyInput/__tests__/CurrencyInput.d.ts +0 -1
  195. package/dist/CurrencyInput/__tests__/CurrencyInput.js +0 -17
  196. package/dist/CurrencyInput/__tests__/CurrencyInput.js.map +0 -1
  197. package/dist/CurrencyInput/index.js +0 -2
  198. package/dist/CurrencyInput/index.js.map +0 -1
  199. package/dist/Datepicker/Datepicker.js.map +0 -1
  200. package/dist/Datepicker/Datepicker.stories.d.ts +0 -13
  201. package/dist/Datepicker/Datepicker.stories.js +0 -18
  202. package/dist/Datepicker/Datepicker.stories.js.map +0 -1
  203. package/dist/Datepicker/DatesList.js.map +0 -1
  204. package/dist/Datepicker/index.js +0 -2
  205. package/dist/Datepicker/index.js.map +0 -1
  206. package/dist/Datepicker/types.js +0 -2
  207. package/dist/Datepicker/types.js.map +0 -1
  208. package/dist/Divider/Divider.js.map +0 -1
  209. package/dist/Divider/Divier.stories.d.ts +0 -8
  210. package/dist/Divider/Divier.stories.js +0 -10
  211. package/dist/Divider/Divier.stories.js.map +0 -1
  212. package/dist/Divider/index.js +0 -2
  213. package/dist/Divider/index.js.map +0 -1
  214. package/dist/Dropdown/Collection.d.ts +0 -2
  215. package/dist/Dropdown/Collection.js +0 -101
  216. package/dist/Dropdown/Collection.js.map +0 -1
  217. package/dist/Dropdown/Container.d.ts +0 -2
  218. package/dist/Dropdown/Container.js +0 -98
  219. package/dist/Dropdown/Container.js.map +0 -1
  220. package/dist/Dropdown/Dropdown.js.map +0 -1
  221. package/dist/Dropdown/Dropdown.stories.d.ts +0 -15
  222. package/dist/Dropdown/Dropdown.stories.js +0 -54
  223. package/dist/Dropdown/Dropdown.stories.js.map +0 -1
  224. package/dist/Dropdown/index.js +0 -2
  225. package/dist/Dropdown/index.js.map +0 -1
  226. package/dist/Emoji/Emoji.js.map +0 -1
  227. package/dist/Emoji/Emoji.stories.d.ts +0 -8
  228. package/dist/Emoji/Emoji.stories.js +0 -18
  229. package/dist/Emoji/Emoji.stories.js.map +0 -1
  230. package/dist/Emoji/__tests__/Emoji.d.ts +0 -1
  231. package/dist/Emoji/__tests__/Emoji.js +0 -9
  232. package/dist/Emoji/__tests__/Emoji.js.map +0 -1
  233. package/dist/Emoji/index.js +0 -2
  234. package/dist/Emoji/index.js.map +0 -1
  235. package/dist/Icon/Container.d.ts +0 -2
  236. package/dist/Icon/Container.js +0 -638
  237. package/dist/Icon/Container.js.map +0 -1
  238. package/dist/Icon/Icon.js.map +0 -1
  239. package/dist/Icon/Icon.stories.d.ts +0 -9
  240. package/dist/Icon/Icon.stories.js +0 -31
  241. package/dist/Icon/Icon.stories.js.map +0 -1
  242. package/dist/Icon/__tests__/Icon.d.ts +0 -1
  243. package/dist/Icon/__tests__/Icon.js +0 -9
  244. package/dist/Icon/__tests__/Icon.js.map +0 -1
  245. package/dist/Icon/index.js +0 -2
  246. package/dist/Icon/index.js.map +0 -1
  247. package/dist/IconStrict/IconStrict.js.map +0 -1
  248. package/dist/IconStrict/IconStrict.stories.d.ts +0 -11
  249. package/dist/IconStrict/IconStrict.stories.js +0 -33
  250. package/dist/IconStrict/IconStrict.stories.js.map +0 -1
  251. package/dist/IconStrict/__tests__/IconStrict.d.ts +0 -1
  252. package/dist/IconStrict/__tests__/IconStrict.js +0 -9
  253. package/dist/IconStrict/__tests__/IconStrict.js.map +0 -1
  254. package/dist/IconStrict/index.js +0 -2
  255. package/dist/IconStrict/index.js.map +0 -1
  256. package/dist/IconWrapper/IconWrapper.js.map +0 -1
  257. package/dist/IconWrapper/IconWrapper.stories.d.ts +0 -13
  258. package/dist/IconWrapper/IconWrapper.stories.js +0 -45
  259. package/dist/IconWrapper/IconWrapper.stories.js.map +0 -1
  260. package/dist/IconWrapper/__tests__/IconWrapper.d.ts +0 -1
  261. package/dist/IconWrapper/__tests__/IconWrapper.js +0 -19
  262. package/dist/IconWrapper/__tests__/IconWrapper.js.map +0 -1
  263. package/dist/IconWrapper/index.js +0 -2
  264. package/dist/IconWrapper/index.js.map +0 -1
  265. package/dist/LabelledText/LabelledText.js.map +0 -1
  266. package/dist/LabelledText/LabelledText.stories.d.ts +0 -8
  267. package/dist/LabelledText/LabelledText.stories.js +0 -12
  268. package/dist/LabelledText/LabelledText.stories.js.map +0 -1
  269. package/dist/LabelledText/__tests__/LabelledText.d.ts +0 -1
  270. package/dist/LabelledText/__tests__/LabelledText.js +0 -9
  271. package/dist/LabelledText/__tests__/LabelledText.js.map +0 -1
  272. package/dist/LabelledText/index.js +0 -2
  273. package/dist/LabelledText/index.js.map +0 -1
  274. package/dist/Link/Link.js.map +0 -1
  275. package/dist/Link/Link.stories.d.ts +0 -16
  276. package/dist/Link/Link.stories.js +0 -38
  277. package/dist/Link/Link.stories.js.map +0 -1
  278. package/dist/Link/index.js +0 -2
  279. package/dist/Link/index.js.map +0 -1
  280. package/dist/Loader/Loader.js.map +0 -1
  281. package/dist/Loader/Loader.stories.d.ts +0 -9
  282. package/dist/Loader/Loader.stories.js +0 -17
  283. package/dist/Loader/Loader.stories.js.map +0 -1
  284. package/dist/Loader/__tests__/Loader.d.ts +0 -1
  285. package/dist/Loader/__tests__/Loader.js +0 -9
  286. package/dist/Loader/__tests__/Loader.js.map +0 -1
  287. package/dist/Loader/index.js +0 -2
  288. package/dist/Loader/index.js.map +0 -1
  289. package/dist/Logo/Collection.d.ts +0 -4
  290. package/dist/Logo/Collection.js +0 -33
  291. package/dist/Logo/Collection.js.map +0 -1
  292. package/dist/Logo/Logo.js.map +0 -1
  293. package/dist/Logo/Logo.stories.d.ts +0 -13
  294. package/dist/Logo/Logo.stories.js +0 -28
  295. package/dist/Logo/Logo.stories.js.map +0 -1
  296. package/dist/Logo/index.js +0 -2
  297. package/dist/Logo/index.js.map +0 -1
  298. package/dist/Modal/Modal.js.map +0 -1
  299. package/dist/Modal/Modal.stories.d.ts +0 -13
  300. package/dist/Modal/Modal.stories.js +0 -28
  301. package/dist/Modal/Modal.stories.js.map +0 -1
  302. package/dist/Modal/__tests__/Modal.d.ts +0 -1
  303. package/dist/Modal/__tests__/Modal.js +0 -9
  304. package/dist/Modal/__tests__/Modal.js.map +0 -1
  305. package/dist/Modal/index.js +0 -2
  306. package/dist/Modal/index.js.map +0 -1
  307. package/dist/Modal/useBodyScrollLock.js.map +0 -1
  308. package/dist/NumberInput/Collection.d.ts +0 -2
  309. package/dist/NumberInput/Collection.js +0 -97
  310. package/dist/NumberInput/Collection.js.map +0 -1
  311. package/dist/NumberInput/Container.d.ts +0 -2
  312. package/dist/NumberInput/Container.js +0 -10
  313. package/dist/NumberInput/Container.js.map +0 -1
  314. package/dist/NumberInput/NumberInput.js.map +0 -1
  315. package/dist/NumberInput/NumberInput.stories.d.ts +0 -16
  316. package/dist/NumberInput/NumberInput.stories.js +0 -33
  317. package/dist/NumberInput/NumberInput.stories.js.map +0 -1
  318. package/dist/NumberInput/__tests__/NumberInput.d.ts +0 -1
  319. package/dist/NumberInput/__tests__/NumberInput.js +0 -33
  320. package/dist/NumberInput/__tests__/NumberInput.js.map +0 -1
  321. package/dist/NumberInput/index.js +0 -2
  322. package/dist/NumberInput/index.js.map +0 -1
  323. package/dist/Pagination/Pagination.js.map +0 -1
  324. package/dist/Pagination/Pagination.stories.d.ts +0 -14
  325. package/dist/Pagination/Pagination.stories.js +0 -26
  326. package/dist/Pagination/Pagination.stories.js.map +0 -1
  327. package/dist/Pagination/__tests__/Pagination.d.ts +0 -1
  328. package/dist/Pagination/__tests__/Pagination.js +0 -9
  329. package/dist/Pagination/__tests__/Pagination.js.map +0 -1
  330. package/dist/Pagination/index.js +0 -2
  331. package/dist/Pagination/index.js.map +0 -1
  332. package/dist/RadioGroup/RadioElement.js.map +0 -1
  333. package/dist/RadioGroup/RadioGroup.js.map +0 -1
  334. package/dist/RadioGroup/RadioGroup.stories.d.ts +0 -33
  335. package/dist/RadioGroup/RadioGroup.stories.js +0 -76
  336. package/dist/RadioGroup/RadioGroup.stories.js.map +0 -1
  337. package/dist/RadioGroup/RadioItem.js.map +0 -1
  338. package/dist/RadioGroup/constants.js.map +0 -1
  339. package/dist/RadioGroup/index.js +0 -2
  340. package/dist/RadioGroup/index.js.map +0 -1
  341. package/dist/RadioGroup/types.js +0 -2
  342. package/dist/RadioGroup/types.js.map +0 -1
  343. package/dist/Row/Row.js.map +0 -1
  344. package/dist/Row/Row.stories.d.ts +0 -20
  345. package/dist/Row/Row.stories.js +0 -63
  346. package/dist/Row/Row.stories.js.map +0 -1
  347. package/dist/Row/__tests__/Row.d.ts +0 -1
  348. package/dist/Row/__tests__/Row.js +0 -10
  349. package/dist/Row/__tests__/Row.js.map +0 -1
  350. package/dist/Row/index.js +0 -2
  351. package/dist/Row/index.js.map +0 -1
  352. package/dist/SearchInput/Container.d.ts +0 -3
  353. package/dist/SearchInput/Container.js +0 -36
  354. package/dist/SearchInput/Container.js.map +0 -1
  355. package/dist/SearchInput/SearchInput.js.map +0 -1
  356. package/dist/SearchInput/SearchInput.stories.d.ts +0 -9
  357. package/dist/SearchInput/SearchInput.stories.js +0 -16
  358. package/dist/SearchInput/SearchInput.stories.js.map +0 -1
  359. package/dist/SearchInput/SearchOptions.js.map +0 -1
  360. package/dist/SearchInput/index.js +0 -2
  361. package/dist/SearchInput/index.js.map +0 -1
  362. package/dist/Snackbar/Snackbar.stories.d.ts +0 -9
  363. package/dist/Snackbar/Snackbar.stories.js +0 -26
  364. package/dist/Snackbar/Snackbar.stories.js.map +0 -1
  365. package/dist/Snackbar/SnackbarContainer.js.map +0 -1
  366. package/dist/Snackbar/SnackbarItem.js.map +0 -1
  367. package/dist/Snackbar/hooks.js.map +0 -1
  368. package/dist/Snackbar/index.js +0 -3
  369. package/dist/Snackbar/index.js.map +0 -1
  370. package/dist/Snackbar/types.js +0 -2
  371. package/dist/Snackbar/types.js.map +0 -1
  372. package/dist/SupportMessage/Collection.d.ts +0 -2
  373. package/dist/SupportMessage/Collection.js +0 -63
  374. package/dist/SupportMessage/Collection.js.map +0 -1
  375. package/dist/SupportMessage/SupportMessage.js.map +0 -1
  376. package/dist/SupportMessage/SupportMessage.stories.d.ts +0 -11
  377. package/dist/SupportMessage/SupportMessage.stories.js +0 -33
  378. package/dist/SupportMessage/SupportMessage.stories.js.map +0 -1
  379. package/dist/SupportMessage/SupportMessage.test.d.ts +0 -1
  380. package/dist/SupportMessage/SupportMessage.test.js +0 -29
  381. package/dist/SupportMessage/SupportMessage.test.js.map +0 -1
  382. package/dist/SupportMessage/index.js +0 -2
  383. package/dist/SupportMessage/index.js.map +0 -1
  384. package/dist/Table/Table.js.map +0 -1
  385. package/dist/Table/Table.stories.d.ts +0 -21
  386. package/dist/Table/Table.stories.js +0 -173
  387. package/dist/Table/Table.stories.js.map +0 -1
  388. package/dist/Table/components/RowActions.js.map +0 -1
  389. package/dist/Table/components/TableHeader.js.map +0 -1
  390. package/dist/Table/components/TableRow.js.map +0 -1
  391. package/dist/Table/components/commonComponents.js.map +0 -1
  392. package/dist/Table/helpers.js.map +0 -1
  393. package/dist/Table/index.js +0 -3
  394. package/dist/Table/index.js.map +0 -1
  395. package/dist/Table/storyUtils.d.ts +0 -68
  396. package/dist/Table/storyUtils.js +0 -204
  397. package/dist/Table/storyUtils.js.map +0 -1
  398. package/dist/Table/types.js +0 -2
  399. package/dist/Table/types.js.map +0 -1
  400. package/dist/Tag/Collection.d.ts +0 -2
  401. package/dist/Tag/Collection.js +0 -77
  402. package/dist/Tag/Collection.js.map +0 -1
  403. package/dist/Tag/Tag.js.map +0 -1
  404. package/dist/Tag/Tag.stories.d.ts +0 -9
  405. package/dist/Tag/Tag.stories.js +0 -22
  406. package/dist/Tag/Tag.stories.js.map +0 -1
  407. package/dist/Tag/__tests__/Tag.d.ts +0 -1
  408. package/dist/Tag/__tests__/Tag.js +0 -9
  409. package/dist/Tag/__tests__/Tag.js.map +0 -1
  410. package/dist/Tag/index.js +0 -2
  411. package/dist/Tag/index.js.map +0 -1
  412. package/dist/Text/Text.js.map +0 -1
  413. package/dist/Text/Text.stories.d.ts +0 -12
  414. package/dist/Text/Text.stories.js +0 -60
  415. package/dist/Text/Text.stories.js.map +0 -1
  416. package/dist/Text/__tests__/Text.d.ts +0 -1
  417. package/dist/Text/__tests__/Text.js +0 -9
  418. package/dist/Text/__tests__/Text.js.map +0 -1
  419. package/dist/Text/fontMapping.js.map +0 -1
  420. package/dist/Text/index.js +0 -2
  421. package/dist/Text/index.js.map +0 -1
  422. package/dist/TextInput/Collection.d.ts +0 -2
  423. package/dist/TextInput/Collection.js +0 -80
  424. package/dist/TextInput/Collection.js.map +0 -1
  425. package/dist/TextInput/Container.d.ts +0 -2
  426. package/dist/TextInput/Container.js +0 -8
  427. package/dist/TextInput/Container.js.map +0 -1
  428. package/dist/TextInput/TextInput.js.map +0 -1
  429. package/dist/TextInput/TextInput.stories.d.ts +0 -17
  430. package/dist/TextInput/TextInput.stories.js +0 -44
  431. package/dist/TextInput/TextInput.stories.js.map +0 -1
  432. package/dist/TextInput/__tests__/TextInput.d.ts +0 -1
  433. package/dist/TextInput/__tests__/TextInput.js +0 -9
  434. package/dist/TextInput/__tests__/TextInput.js.map +0 -1
  435. package/dist/TextInput/index.js +0 -2
  436. package/dist/TextInput/index.js.map +0 -1
  437. package/dist/Textarea/Container.d.ts +0 -2
  438. package/dist/Textarea/Container.js +0 -8
  439. package/dist/Textarea/Container.js.map +0 -1
  440. package/dist/Textarea/Textarea.js.map +0 -1
  441. package/dist/Textarea/Textarea.stories.d.ts +0 -13
  442. package/dist/Textarea/Textarea.stories.js +0 -66
  443. package/dist/Textarea/Textarea.stories.js.map +0 -1
  444. package/dist/Textarea/index.js +0 -2
  445. package/dist/Textarea/index.js.map +0 -1
  446. package/dist/Toggle/Container.d.ts +0 -2
  447. package/dist/Toggle/Container.js +0 -7
  448. package/dist/Toggle/Container.js.map +0 -1
  449. package/dist/Toggle/Toggle.js.map +0 -1
  450. package/dist/Toggle/Toggle.stories.d.ts +0 -11
  451. package/dist/Toggle/Toggle.stories.js +0 -10
  452. package/dist/Toggle/Toggle.stories.js.map +0 -1
  453. package/dist/Toggle/__tests__/Toggle.d.ts +0 -1
  454. package/dist/Toggle/__tests__/Toggle.js +0 -9
  455. package/dist/Toggle/__tests__/Toggle.js.map +0 -1
  456. package/dist/Toggle/index.js +0 -2
  457. package/dist/Toggle/index.js.map +0 -1
  458. package/dist/Tooltip/Tooltip.js.map +0 -1
  459. package/dist/Tooltip/Tooltip.stories.d.ts +0 -12
  460. package/dist/Tooltip/Tooltip.stories.js +0 -87
  461. package/dist/Tooltip/Tooltip.stories.js.map +0 -1
  462. package/dist/Tooltip/index.js +0 -2
  463. package/dist/Tooltip/index.js.map +0 -1
  464. package/dist/colors.stories.d.ts +0 -7
  465. package/dist/colors.stories.js +0 -100
  466. package/dist/colors.stories.js.map +0 -1
  467. package/dist/fields/Field/Field.js.map +0 -1
  468. package/dist/fields/Field/index.js +0 -2
  469. package/dist/fields/Field/index.js.map +0 -1
  470. package/dist/fields/Fieldset/Fieldset.js.map +0 -1
  471. package/dist/fields/Fieldset/Fieldset.stories.d.ts +0 -11
  472. package/dist/fields/Fieldset/Fieldset.stories.js +0 -34
  473. package/dist/fields/Fieldset/Fieldset.stories.js.map +0 -1
  474. package/dist/fields/Fieldset/index.js +0 -2
  475. package/dist/fields/Fieldset/index.js.map +0 -1
  476. package/dist/fields/commonFieldTypes.js +0 -2
  477. package/dist/fields/commonFieldTypes.js.map +0 -1
  478. package/dist/fields/components/CommonInput.js.map +0 -1
  479. package/dist/fields/components/InternalField.js.map +0 -1
  480. package/dist/fields/components/Placeholder.js +0 -25
  481. package/dist/fields/components/Placeholder.js.map +0 -1
  482. package/dist/fontStyle.js.map +0 -1
  483. package/dist/hooks/index.js +0 -5
  484. package/dist/hooks/index.js.map +0 -1
  485. package/dist/hooks/useClickOutside/index.js.map +0 -1
  486. package/dist/hooks/useClickOutside/useClickOutside.test.js +0 -46
  487. package/dist/hooks/useClickOutside/useClickOutside.test.js.map +0 -1
  488. package/dist/hooks/useEventListener/index.js.map +0 -1
  489. package/dist/hooks/useEventListener/useEventLitener.test.js +0 -36
  490. package/dist/hooks/useEventListener/useEventLitener.test.js.map +0 -1
  491. package/dist/hooks/useScript/index.js.map +0 -1
  492. package/dist/hooks/useScript/useScript.test.js +0 -17
  493. package/dist/hooks/useScript/useScript.test.js.map +0 -1
  494. package/dist/hooks/useTimeout/index.js.map +0 -1
  495. package/dist/index.js.map +0 -1
  496. package/dist/setupTests.d.ts +0 -1
  497. package/dist/setupTests.js +0 -2
  498. package/dist/setupTests.js.map +0 -1
  499. package/dist/theme.js.map +0 -1
  500. package/dist/tokenTest.spec.js +0 -8
  501. package/dist/tokenTest.spec.js.map +0 -1
  502. package/dist/types.js +0 -2
  503. package/dist/types.js.map +0 -1
  504. package/dist/utils/date.js.map +0 -1
  505. package/dist/utils/debounce.js.map +0 -1
  506. package/dist/utils/deprecated.js +0 -30
  507. package/dist/utils/deprecated.js.map +0 -1
  508. package/dist/utils/flex.js.map +0 -1
  509. package/dist/utils/focusOutline.js.map +0 -1
  510. package/dist/utils/id.js.map +0 -1
  511. package/dist/utils/id.test.js +0 -21
  512. package/dist/utils/id.test.js.map +0 -1
  513. package/dist/utils/isReactElement.js.map +0 -1
  514. package/dist/utils/measure.js.map +0 -1
  515. package/dist/utils/noop.js +0 -3
  516. package/dist/utils/noop.js.map +0 -1
  517. package/dist/utils/responsiveProp.js.map +0 -1
  518. package/dist/utils/space.js.map +0 -1
  519. package/dist/utils/useControlledState.js.map +0 -1
  520. package/dist/utils/visuallyHidden.js.map +0 -1
@@ -1,107 +1,147 @@
1
- import React, { useEffect, useState } from 'react';
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { useState, useEffect } from 'react';
2
3
  import styled from 'styled-components';
3
- import { Box } from '../Box';
4
- import { Text } from '../Text';
5
- import { Icon } from '../Icon';
6
- import { theme } from '../theme';
7
- import { focusOutlineStyle } from '../utils/focusOutline';
4
+ import { Box } from '../Box/Box.js';
5
+ import { Text } from '../Text/Text.js';
6
+ import { Icon } from '../Icon/Icon.js';
7
+ import { theme } from '../theme.js';
8
+ import { focusOutlineStyle } from '../utils/focusOutline.js';
9
+
8
10
  const MAX_PAGES = 7;
9
11
  const MAX_ADDITIONAL_PAGES = Math.ceil(MAX_PAGES / 2);
10
- export const Pagination = ({ total, partition, handlePageChange, currentPage, ...marginProps }) => {
11
- const [lastPage, setLastPage] = useState(0);
12
- const [activePage, setActivePage] = useState(1);
13
- const [pages, setPages] = useState([]);
14
- const [shownPages, setShownPages] = useState([]);
15
- const [showFirstDots, setShowFirstDots] = useState(false);
16
- const [showLastDots, setShowLastDots] = useState(false);
17
- useEffect(() => {
18
- // This is a rather hacky fix, in theory it should be listening to total, but because the total comes from the same endpoint as the data, it forces a reset to 1 every time
19
- // Using lastPage seems to bypass that
20
- if (currentPage) {
21
- setActivePage(currentPage);
22
- }
23
- else {
24
- setActivePage(1);
25
- }
26
- }, [lastPage, currentPage]);
27
- useEffect(() => {
28
- const numberOfPages = Math.ceil(total / partition);
29
- if (numberOfPages > 1) {
30
- setLastPage(numberOfPages);
31
- }
32
- else if (numberOfPages === 1) {
33
- // Sets last page to be null to avoid the last page being kept from previous state.
34
- setLastPage(0);
35
- }
36
- if (numberOfPages > 2) {
37
- const allPages = Array.from({ length: numberOfPages }, (_, i) => i + 1);
38
- setPages(allPages.slice(1, numberOfPages - 1));
39
- }
40
- else {
41
- // Sets pages to empty to avoid using the previous state if pages set before.
42
- setPages([]);
43
- }
44
- }, [total, partition]);
45
- useEffect(() => {
46
- if (lastPage <= MAX_PAGES) {
47
- setShownPages(pages);
48
- }
49
- else if (activePage <= MAX_ADDITIONAL_PAGES) {
50
- setShownPages(pages.slice(0, MAX_ADDITIONAL_PAGES));
51
- }
52
- else if (activePage > lastPage - MAX_ADDITIONAL_PAGES) {
53
- setShownPages(pages.slice(pages.length - MAX_ADDITIONAL_PAGES));
54
- }
55
- else {
56
- const activePageIndex = pages.indexOf(activePage);
57
- setShownPages(pages.slice(activePageIndex - 1, activePageIndex + 2));
58
- }
59
- }, [lastPage, activePage, pages]);
60
- useEffect(() => {
61
- setShowFirstDots(shownPages[0] !== pages[0]);
62
- setShowLastDots(shownPages[shownPages.length - 1] !== pages[pages.length - 1]);
63
- }, [shownPages, pages]);
64
- const movePage = (page) => {
65
- if (page > 0 && page <= lastPage) {
66
- setActivePage(page);
67
- handlePageChange(page);
68
- }
69
- };
70
- return (React.createElement(Container, { flex: true, direction: "row", ...marginProps },
71
- activePage - 1 > 0 && (React.createElement(IconBox, { firstPage: true, onClick: () => movePage(activePage - 1), onKeyDown: (e) => {
72
- if (e.key === 'Enter') {
73
- movePage(activePage - 1);
74
- }
75
- } },
76
- React.createElement(Icon, { size: 18, render: "arrow" }))),
77
- React.createElement(PageBox, { active: activePage === 1, onClick: () => movePage(1) },
78
- React.createElement(Text, { typo: activePage === 1 ? 'desc-medium' : 'desc-light', tag: "p" }, "1")),
79
- showFirstDots && (React.createElement(PageBox, null,
80
- React.createElement(Text, { tag: "p" }, "..."))),
81
- shownPages.map((i) => {
82
- return (React.createElement(PageBox, { active: activePage === i, key: i, onClick: () => movePage(i), onKeyDown: (e) => {
83
- if (e.key === 'Enter') {
84
- movePage(i);
85
- }
86
- } },
87
- React.createElement(Text, { typo: activePage === i ? 'desc-medium' : 'desc-light', tag: "p" }, i)));
88
- }),
89
- showLastDots && (React.createElement(PageBox, null,
90
- React.createElement(Text, { tag: "p" }, "..."))),
91
- Boolean(lastPage) && (React.createElement(PageBox, { active: activePage === lastPage, onClick: () => movePage(lastPage), onKeyDown: (e) => {
92
- if (e.key === 'Enter') {
93
- movePage(lastPage);
94
- }
95
- } },
96
- React.createElement(Text, { typo: activePage === lastPage ? 'desc-medium' : 'desc-light', tag: "p" }, lastPage))),
97
- activePage + 1 <= lastPage && (React.createElement(IconBox, { onClick: () => movePage(activePage + 1), onKeyDown: (e) => {
98
- if (e.key === 'Enter') {
99
- movePage(activePage + 1);
100
- }
101
- } },
102
- React.createElement(Icon, { size: 18, render: "arrow", rotate: 180 })))));
12
+ const Pagination = ({
13
+ total,
14
+ partition,
15
+ handlePageChange,
16
+ currentPage,
17
+ ...marginProps
18
+ }) => {
19
+ const [lastPage, setLastPage] = useState(0);
20
+ const [activePage, setActivePage] = useState(1);
21
+ const [pages, setPages] = useState([]);
22
+ const [shownPages, setShownPages] = useState([]);
23
+ const [showFirstDots, setShowFirstDots] = useState(false);
24
+ const [showLastDots, setShowLastDots] = useState(false);
25
+ useEffect(() => {
26
+ if (currentPage) {
27
+ setActivePage(currentPage);
28
+ } else {
29
+ setActivePage(1);
30
+ }
31
+ }, [lastPage, currentPage]);
32
+ useEffect(() => {
33
+ const numberOfPages = Math.ceil(total / partition);
34
+ if (numberOfPages > 1) {
35
+ setLastPage(numberOfPages);
36
+ } else if (numberOfPages === 1) {
37
+ setLastPage(0);
38
+ }
39
+ if (numberOfPages > 2) {
40
+ const allPages = Array.from({ length: numberOfPages }, (_, i) => i + 1);
41
+ setPages(allPages.slice(1, numberOfPages - 1));
42
+ } else {
43
+ setPages([]);
44
+ }
45
+ }, [total, partition]);
46
+ useEffect(() => {
47
+ if (lastPage <= MAX_PAGES) {
48
+ setShownPages(pages);
49
+ } else if (activePage <= MAX_ADDITIONAL_PAGES) {
50
+ setShownPages(pages.slice(0, MAX_ADDITIONAL_PAGES));
51
+ } else if (activePage > lastPage - MAX_ADDITIONAL_PAGES) {
52
+ setShownPages(pages.slice(pages.length - MAX_ADDITIONAL_PAGES));
53
+ } else {
54
+ const activePageIndex = pages.indexOf(activePage);
55
+ setShownPages(pages.slice(activePageIndex - 1, activePageIndex + 2));
56
+ }
57
+ }, [lastPage, activePage, pages]);
58
+ useEffect(() => {
59
+ setShowFirstDots(shownPages[0] !== pages[0]);
60
+ setShowLastDots(
61
+ shownPages[shownPages.length - 1] !== pages[pages.length - 1]
62
+ );
63
+ }, [shownPages, pages]);
64
+ const movePage = (page) => {
65
+ if (page > 0 && page <= lastPage) {
66
+ setActivePage(page);
67
+ handlePageChange(page);
68
+ }
69
+ };
70
+ return /* @__PURE__ */ jsxs(Container, { flex: true, direction: "row", ...marginProps, children: [
71
+ activePage - 1 > 0 && /* @__PURE__ */ jsx(
72
+ IconBox,
73
+ {
74
+ firstPage: true,
75
+ onClick: () => movePage(activePage - 1),
76
+ onKeyDown: (e) => {
77
+ if (e.key === "Enter") {
78
+ movePage(activePage - 1);
79
+ }
80
+ },
81
+ children: /* @__PURE__ */ jsx(Icon, { size: 18, render: "arrow" })
82
+ }
83
+ ),
84
+ /* @__PURE__ */ jsx(PageBox, { active: activePage === 1, onClick: () => movePage(1), children: /* @__PURE__ */ jsx(Text, { typo: activePage === 1 ? "desc-medium" : "desc-light", tag: "p", children: "1" }) }),
85
+ showFirstDots && /* @__PURE__ */ jsx(PageBox, { children: /* @__PURE__ */ jsx(Text, { tag: "p", children: "..." }) }),
86
+ shownPages.map((i) => {
87
+ return /* @__PURE__ */ jsx(
88
+ PageBox,
89
+ {
90
+ active: activePage === i,
91
+ onClick: () => movePage(i),
92
+ onKeyDown: (e) => {
93
+ if (e.key === "Enter") {
94
+ movePage(i);
95
+ }
96
+ },
97
+ children: /* @__PURE__ */ jsx(
98
+ Text,
99
+ {
100
+ typo: activePage === i ? "desc-medium" : "desc-light",
101
+ tag: "p",
102
+ children: i
103
+ }
104
+ )
105
+ },
106
+ i
107
+ );
108
+ }),
109
+ showLastDots && /* @__PURE__ */ jsx(PageBox, { children: /* @__PURE__ */ jsx(Text, { tag: "p", children: "..." }) }),
110
+ Boolean(lastPage) && /* @__PURE__ */ jsx(
111
+ PageBox,
112
+ {
113
+ active: activePage === lastPage,
114
+ onClick: () => movePage(lastPage),
115
+ onKeyDown: (e) => {
116
+ if (e.key === "Enter") {
117
+ movePage(lastPage);
118
+ }
119
+ },
120
+ children: /* @__PURE__ */ jsx(
121
+ Text,
122
+ {
123
+ typo: activePage === lastPage ? "desc-medium" : "desc-light",
124
+ tag: "p",
125
+ children: lastPage
126
+ }
127
+ )
128
+ }
129
+ ),
130
+ activePage + 1 <= lastPage && /* @__PURE__ */ jsx(
131
+ IconBox,
132
+ {
133
+ onClick: () => movePage(activePage + 1),
134
+ onKeyDown: (e) => {
135
+ if (e.key === "Enter") {
136
+ movePage(activePage + 1);
137
+ }
138
+ },
139
+ children: /* @__PURE__ */ jsx(Icon, { size: 18, render: "arrow", rotate: 180 })
140
+ }
141
+ )
142
+ ] });
103
143
  };
104
- const Container = styled(Box) `
144
+ const Container = styled(Box)`
105
145
  align-items: center;
106
146
  > button {
107
147
  margin-right: 4px;
@@ -111,7 +151,7 @@ const Container = styled(Box) `
111
151
  }
112
152
  }
113
153
  `;
114
- const PageBox = styled.button `
154
+ const PageBox = styled.button`
115
155
  background: ${({ active }) => active ? theme.colors.custard : theme.colors.cream};
116
156
  cursor: pointer;
117
157
  display: flex;
@@ -129,9 +169,10 @@ const PageBox = styled.button `
129
169
 
130
170
  ${focusOutlineStyle}
131
171
  `;
132
- const IconBox = styled.button `
172
+ const IconBox = styled.button`
133
173
  cursor: pointer;
134
174
 
135
175
  ${focusOutlineStyle}
136
176
  `;
137
- //# sourceMappingURL=Pagination.js.map
177
+
178
+ export { Pagination };
@@ -1,19 +1,36 @@
1
- import React, { forwardRef } from 'react';
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
+ import { forwardRef } from 'react';
2
3
  import styled from 'styled-components';
3
- import { theme } from '../theme';
4
- import { focusOutline } from '../utils/focusOutline';
5
- import { visuallyHidden } from '../utils/visuallyHidden';
6
- import { Box } from '../Box';
7
- export const RadioElement = forwardRef(function RadioElement({ name, id, value, checked, onChange, onBlur, isError, ...marginProps }, ref) {
8
- return (React.createElement(React.Fragment, null,
9
- React.createElement(StyledInput, { ref: ref, type: "radio", name: name, id: id, value: `${value}`, checked: checked, onChange: () => onChange(value), onBlur: onBlur }),
10
- React.createElement(RadioCircle, { isError: isError, checked: checked, ...marginProps })));
11
- });
12
- const StyledInput = styled.input `
4
+ import { theme } from '../theme.js';
5
+ import { focusOutline } from '../utils/focusOutline.js';
6
+ import { visuallyHidden } from '../utils/visuallyHidden.js';
7
+ import { Box } from '../Box/Box.js';
8
+
9
+ const RadioElement = forwardRef(
10
+ function RadioElement2({ name, id, value, checked, onChange, onBlur, isError, ...marginProps }, ref) {
11
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
12
+ /* @__PURE__ */ jsx(
13
+ StyledInput,
14
+ {
15
+ ref,
16
+ type: "radio",
17
+ name,
18
+ id,
19
+ value: `${value}`,
20
+ checked,
21
+ onChange: () => onChange(value),
22
+ onBlur
23
+ }
24
+ ),
25
+ /* @__PURE__ */ jsx(RadioCircle, { isError, checked, ...marginProps })
26
+ ] });
27
+ }
28
+ );
29
+ const StyledInput = styled.input`
13
30
  ${visuallyHidden}
14
31
  `;
15
32
  const RADIO_SIZE = 24;
16
- const RadioCircle = styled(Box) `
33
+ const RadioCircle = styled(Box)`
17
34
  flex-shrink: 0;
18
35
  width: ${RADIO_SIZE}px;
19
36
  height: ${RADIO_SIZE}px;
@@ -22,17 +39,15 @@ const RadioCircle = styled(Box) `
22
39
  border: 2px solid
23
40
  ${({ isError }) => isError ? theme.colors.strawberry : theme.colors.sesame};
24
41
 
25
- ${({ checked, isError }) => !checked &&
26
- !isError &&
27
- `
42
+ ${({ checked, isError }) => !checked && !isError && `
28
43
  &:hover {
29
44
  border: 2px solid ${theme.colors.liquorice};
30
45
  }
31
46
  `}
32
47
 
33
- ${({ checked, isError }) => checked &&
34
- `border: 8px solid ${isError ? theme.colors.strawberry : theme.colors.liquorice};`}
48
+ ${({ checked, isError }) => checked && `border: 8px solid ${isError ? theme.colors.strawberry : theme.colors.liquorice};`}
35
49
 
36
50
  ${focusOutline({ selector: `${StyledInput}:focus-visible + &` })}
37
51
  `;
38
- //# sourceMappingURL=RadioElement.js.map
52
+
53
+ export { RadioElement };
@@ -1,44 +1,75 @@
1
- import React, { forwardRef, useImperativeHandle, useRef, } from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { forwardRef, useRef, useImperativeHandle } from 'react';
2
3
  import styled from 'styled-components';
3
- import { useUniqueId } from '../utils/id';
4
- import { Fieldset } from '../fields/Fieldset';
5
- import { ITEM_GAP } from './constants';
6
- import { RadioItem } from './RadioItem';
7
- const RadioGroupComponent = ({ options, onChange, onBlur, value, displayType = 'normal', renderAsTitle = false, error = false, fallbackStyle = false, ...fieldProps }, ref) => {
8
- const name = useUniqueId();
9
- const optionRefs = useRef([]);
10
- useImperativeHandle(ref, () => {
11
- return {
12
- focus: () => {
13
- const selectedIndex = options.findIndex((item) => item.value === value);
14
- const elementToFocus = selectedIndex === -1 ? 0 : selectedIndex;
15
- optionRefs.current[elementToFocus].current?.focus();
16
- },
17
- };
18
- });
19
- return (React.createElement(Fieldset, { renderAsTitle: renderAsTitle, error: error, ...fieldProps },
20
- React.createElement(RadioItemList, { displayType: displayType }, options.map((option, index) => {
21
- const isSelected = option.value === value;
22
- return (React.createElement(RadioItem, { ref: (radioOptionRef) => {
23
- optionRefs.current[index] = {
24
- current: radioOptionRef,
25
- };
26
- }, key: `${option.value}`, name: name, visual: option.visual, icon: option.icon, iconPosition: option.iconPosition, label: option.label, value: option.value, checked: isSelected, onChange: onChange, onBlur: onBlur, displayType: displayType, isError: error, fallbackStyle: fallbackStyle, bodyCopy: option.bodyCopy }));
27
- }))));
4
+ import { useUniqueId } from '../utils/id.js';
5
+ import { Fieldset } from '../fields/Fieldset/Fieldset.js';
6
+ import { ITEM_GAP } from './constants.js';
7
+ import { RadioItem } from './RadioItem.js';
8
+
9
+ const RadioGroupComponent = ({
10
+ options,
11
+ onChange,
12
+ onBlur,
13
+ value,
14
+ displayType = "normal",
15
+ renderAsTitle = false,
16
+ error = false,
17
+ fallbackStyle = false,
18
+ ...fieldProps
19
+ }, ref) => {
20
+ const name = useUniqueId();
21
+ const optionRefs = useRef([]);
22
+ useImperativeHandle(ref, () => {
23
+ return {
24
+ focus: () => {
25
+ const selectedIndex = options.findIndex((item) => item.value === value);
26
+ const elementToFocus = selectedIndex === -1 ? 0 : selectedIndex;
27
+ optionRefs.current[elementToFocus].current?.focus();
28
+ }
29
+ };
30
+ });
31
+ return /* @__PURE__ */ jsx(Fieldset, { renderAsTitle, error, ...fieldProps, children: /* @__PURE__ */ jsx(RadioItemList, { displayType, children: options.map((option, index) => {
32
+ const isSelected = option.value === value;
33
+ return /* @__PURE__ */ jsx(
34
+ RadioItem,
35
+ {
36
+ ref: (radioOptionRef) => {
37
+ optionRefs.current[index] = {
38
+ current: radioOptionRef
39
+ };
40
+ },
41
+ name,
42
+ visual: option.visual,
43
+ icon: option.icon,
44
+ iconPosition: option.iconPosition,
45
+ label: option.label,
46
+ value: option.value,
47
+ checked: isSelected,
48
+ onChange,
49
+ onBlur,
50
+ displayType,
51
+ isError: error,
52
+ fallbackStyle,
53
+ bodyCopy: option.bodyCopy
54
+ },
55
+ `${option.value}`
56
+ );
57
+ }) }) });
28
58
  };
29
- export const RadioGroup = forwardRef(RadioGroupComponent);
30
- const RadioItemList = styled.div `
59
+ const RadioGroup = forwardRef(RadioGroupComponent);
60
+ const RadioItemList = styled.div`
31
61
  display: flex;
32
62
  gap: ${ITEM_GAP}px;
33
63
 
34
64
  ${({ displayType }) => {
35
- if (displayType === 'horizontal-card') {
36
- return `
65
+ if (displayType === "horizontal-card") {
66
+ return `
37
67
  flex-direction: row;
38
68
  flex-wrap: wrap;
39
69
  `;
40
- }
41
- return `flex-direction: column;`;
70
+ }
71
+ return `flex-direction: column;`;
42
72
  }}
43
73
  `;
44
- //# sourceMappingURL=RadioGroup.js.map
74
+
75
+ export { RadioGroup };
@@ -1,46 +1,86 @@
1
- import React, { forwardRef } from 'react';
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { forwardRef } from 'react';
2
3
  import styled, { css } from 'styled-components';
3
- import { theme } from '../theme';
4
- import { useUniqueId } from '../utils/id';
5
- import { Box } from '../Box';
6
- import { Icon } from '../Icon';
7
- import { Text } from '../Text';
8
- import { RadioElement } from './RadioElement';
9
- import { ITEM_GAP } from './constants';
10
- export const RadioItem = forwardRef(function RadioItem({ name, visual, icon, iconPosition = 'center', label, value, checked, onChange, onBlur, displayType, isError, fallbackStyle, bodyCopy, }, ref) {
4
+ import { theme } from '../theme.js';
5
+ import { useUniqueId } from '../utils/id.js';
6
+ import { Box } from '../Box/Box.js';
7
+ import { Icon } from '../Icon/Icon.js';
8
+ import { Text } from '../Text/Text.js';
9
+ import { RadioElement } from './RadioElement.js';
10
+ import { ITEM_GAP } from './constants.js';
11
+
12
+ const RadioItem = forwardRef(
13
+ function RadioItem2({
14
+ name,
15
+ visual,
16
+ icon,
17
+ iconPosition = "center",
18
+ label,
19
+ value,
20
+ checked,
21
+ onChange,
22
+ onBlur,
23
+ displayType,
24
+ isError,
25
+ fallbackStyle,
26
+ bodyCopy
27
+ }, ref) {
11
28
  const id = useUniqueId();
12
- return (React.createElement(Wrapper, { htmlFor: id, checked: checked, displayType: displayType, "data-testid": value, isError: isError, fallbackStyle: fallbackStyle },
13
- visual && !icon && (React.createElement(VisualWrapper, null,
14
- React.createElement(Visual, { visualUrl: visual }))),
15
- !visual && icon && (React.createElement(IconWrapper, { iconPosition: iconPosition },
16
- React.createElement(Icon, { render: icon, size: 24 }))),
17
- React.createElement(Box, { flex: true, alignItems: "center" },
18
- React.createElement(RadioElement, { ref: ref, name: name, id: id, value: value, checked: checked, onChange: onChange, onBlur: onBlur, isError: isError, mr: "8px" }),
19
- React.createElement(Box, null,
20
- React.createElement(RadioText, { isError: isError }, label),
21
- bodyCopy && (React.createElement(Box, null,
22
- React.createElement(Text, { typo: "caption" }, bodyCopy)))))));
23
- });
24
- const VisualWrapper = styled.div `
29
+ return /* @__PURE__ */ jsxs(
30
+ Wrapper,
31
+ {
32
+ htmlFor: id,
33
+ checked,
34
+ displayType,
35
+ "data-testid": value,
36
+ isError,
37
+ fallbackStyle,
38
+ children: [
39
+ visual && !icon && /* @__PURE__ */ jsx(VisualWrapper, { children: /* @__PURE__ */ jsx(Visual, { visualUrl: visual }) }),
40
+ !visual && icon && /* @__PURE__ */ jsx(IconWrapper, { iconPosition, children: /* @__PURE__ */ jsx(Icon, { render: icon, size: 24 }) }),
41
+ /* @__PURE__ */ jsxs(Box, { flex: true, alignItems: "center", children: [
42
+ /* @__PURE__ */ jsx(
43
+ RadioElement,
44
+ {
45
+ ref,
46
+ name,
47
+ id,
48
+ value,
49
+ checked,
50
+ onChange,
51
+ onBlur,
52
+ isError,
53
+ mr: "8px"
54
+ }
55
+ ),
56
+ /* @__PURE__ */ jsxs(Box, { children: [
57
+ /* @__PURE__ */ jsx(RadioText, { isError, children: label }),
58
+ bodyCopy && /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, { typo: "caption", children: bodyCopy }) })
59
+ ] })
60
+ ] })
61
+ ]
62
+ }
63
+ );
64
+ }
65
+ );
66
+ const VisualWrapper = styled.div`
25
67
  width: 100%;
26
68
  max-width: 120px;
27
69
  margin: 0 auto 8px;
28
70
  `;
29
- const IconWrapper = styled.div `
71
+ const IconWrapper = styled.div`
30
72
  display: flex;
31
73
  padding-bottom: 12px;
32
74
 
33
- ${({ iconPosition }) => iconPosition === 'center' &&
34
- css `
75
+ ${({ iconPosition }) => iconPosition === "center" && css`
35
76
  justify-content: center;
36
77
  `}
37
78
 
38
- ${({ iconPosition }) => iconPosition === 'start' &&
39
- css `
79
+ ${({ iconPosition }) => iconPosition === "start" && css`
40
80
  justify-content: flex-start;
41
81
  `}
42
82
  `;
43
- const Visual = styled.div `
83
+ const Visual = styled.div`
44
84
  width: 100%;
45
85
  padding-top: 100%;
46
86
  background-image: url('${(p) => p.visualUrl}');
@@ -48,32 +88,23 @@ const Visual = styled.div `
48
88
  background-repeat: no-repeat;
49
89
  background-position: center;
50
90
  `;
51
- const Wrapper = styled.label `
91
+ const Wrapper = styled.label`
52
92
  display: flex;
53
93
  flex-direction: column;
54
94
  cursor: pointer;
55
95
 
56
- ${({ displayType, checked, isError, fallbackStyle }) => css `
57
- ${(displayType === 'horizontal-card' || displayType === 'vertical-card') &&
58
- css `
96
+ ${({ displayType, checked, isError, fallbackStyle }) => css`
97
+ ${(displayType === "horizontal-card" || displayType === "vertical-card") && css`
59
98
  border-radius: 12px;
60
- background-color: ${fallbackStyle
61
- ? theme.colors.cream
62
- : theme.colors.custard};
63
- padding: ${checked ? '10px' : '12px'};
64
- border: ${checked &&
65
- (isError
66
- ? `2px solid ${theme.colors.strawberry}`
67
- : `2px solid ${theme.colors.liquorice}`)};
99
+ background-color: ${fallbackStyle ? theme.colors.cream : theme.colors.custard};
100
+ padding: ${checked ? "10px" : "12px"};
101
+ border: ${checked && (isError ? `2px solid ${theme.colors.strawberry}` : `2px solid ${theme.colors.liquorice}`)};
68
102
 
69
103
  &:hover {
70
- background-color: ${fallbackStyle
71
- ? theme.colors.coconut
72
- : theme.colors.oatmeal};
104
+ background-color: ${fallbackStyle ? theme.colors.coconut : theme.colors.oatmeal};
73
105
  }
74
106
  `}
75
- ${displayType === 'horizontal-card' &&
76
- css `
107
+ ${displayType === "horizontal-card" && css`
77
108
  width: 100%;
78
109
  justify-content: center;
79
110
 
@@ -87,11 +118,12 @@ const Wrapper = styled.label `
87
118
  `}
88
119
  `}
89
120
  `;
90
- const RadioText = styled.span `
121
+ const RadioText = styled.span`
91
122
  line-height: 16px;
92
123
  font-size: 16px;
93
124
  font-weight: ${theme.font.weight.medium};
94
125
  color: ${({ isError }) => isError ? theme.colors.strawberry : theme.colors.liquorice};
95
126
  margin-top: 4px;
96
127
  `;
97
- //# sourceMappingURL=RadioItem.js.map
128
+
129
+ export { RadioItem };
@@ -1,2 +1,3 @@
1
- export const ITEM_GAP = 12;
2
- //# sourceMappingURL=constants.js.map
1
+ const ITEM_GAP = 12;
2
+
3
+ export { ITEM_GAP };