@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
package/dist/Chip/Chip.js CHANGED
@@ -1,15 +1,51 @@
1
- import React, { forwardRef } from 'react';
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
+ import { forwardRef } from 'react';
2
3
  import styled, { css } from 'styled-components';
3
- import { theme } from '../theme';
4
- import { Box } from '../Box';
5
- import { Icon as IconComponent } from '../Icon';
6
- import { Loader } from '../Loader';
7
- import { focusOutline } from '../utils/focusOutline';
8
- export const Chip = forwardRef(({ children, handleClick, primary = false, secondary = false, disabled = false, loading = false, icon = '', ...props }, ref) => (React.createElement(Container, { as: "button", primary: primary, secondary: secondary, disabled: disabled || loading, "$loading": loading, onClick: handleClick, icon: icon, ...props, ref: ref }, loading ? (React.createElement(Loader, { color: primary ? 'liquorice' : 'cream', height: "16" })) : (React.createElement(React.Fragment, null,
9
- icon && (React.createElement(IconComponent, { render: icon, size: 20, color: primary ? 'liquorice' : 'cream' })),
10
- React.createElement(ChildrenContainer, null, children))))));
11
- Chip.displayName = 'Chip';
12
- const Container = styled(Box)(({ primary, secondary, icon, $loading, disabled }) => css `
4
+ import { Box } from '../Box/Box.js';
5
+ import { Icon } from '../Icon/Icon.js';
6
+ import { Loader } from '../Loader/Loader.js';
7
+ import { theme } from '../theme.js';
8
+ import { focusOutline } from '../utils/focusOutline.js';
9
+
10
+ const Chip = forwardRef(
11
+ ({
12
+ children,
13
+ handleClick,
14
+ primary = false,
15
+ secondary = false,
16
+ disabled = false,
17
+ loading = false,
18
+ icon,
19
+ ...props
20
+ }, ref) => /* @__PURE__ */ jsx(
21
+ Container,
22
+ {
23
+ as: "button",
24
+ primary,
25
+ secondary,
26
+ disabled: disabled || loading,
27
+ $loading: loading,
28
+ onClick: handleClick,
29
+ icon,
30
+ ...props,
31
+ ref,
32
+ children: loading ? /* @__PURE__ */ jsx(Loader, { color: primary ? "liquorice" : "cream", height: "16" }) : /* @__PURE__ */ jsxs(Fragment, { children: [
33
+ icon && /* @__PURE__ */ jsx(
34
+ Icon,
35
+ {
36
+ render: icon,
37
+ size: 20,
38
+ color: primary ? "liquorice" : "cream"
39
+ }
40
+ ),
41
+ /* @__PURE__ */ jsx(ChildrenContainer, { children })
42
+ ] })
43
+ }
44
+ )
45
+ );
46
+ Chip.displayName = "Chip";
47
+ const Container = styled(Box)(
48
+ ({ primary, secondary, icon, $loading, disabled }) => css`
13
49
  ${focusOutline()}
14
50
 
15
51
  align-items: center;
@@ -19,35 +55,33 @@ const Container = styled(Box)(({ primary, secondary, icon, $loading, disabled })
19
55
  color: ${theme.colors.liquorice};
20
56
  display: flex;
21
57
  font-size: 16px;
22
- justify-content: ${icon ? 'space-evenly' : 'center'};
58
+ justify-content: ${icon ? "space-evenly" : "center"};
23
59
  line-height: 100%;
24
- padding: 8px 16px 8px ${icon ? '8px' : '16px'};
60
+ padding: 8px 16px 8px ${icon ? "8px" : "16px"};
25
61
  width: 98px;
26
62
  min-height: 40px;
27
- cursor: ${disabled || $loading ? 'not-allowed' : 'pointer'};
28
- opacity: ${disabled ? '0.5' : '1'};
63
+ cursor: ${disabled || $loading ? "not-allowed" : "pointer"};
64
+ opacity: ${disabled ? "0.5" : "1"};
29
65
 
30
- ${primary &&
31
- css `
66
+ ${primary && css`
32
67
  &:hover {
33
- border: ${!(disabled || $loading) &&
34
- `2px solid ${theme.colors.mascarpone}`};
68
+ border: ${!(disabled || $loading) && `2px solid ${theme.colors.mascarpone}`};
35
69
  background-color: ${!(disabled || $loading) && theme.colors.mascarpone};
36
70
  }
37
71
  `}
38
- ${secondary &&
39
- css `
72
+ ${secondary && css`
40
73
  color: ${theme.colors.cream};
41
74
  background-color: ${theme.colors.liquorice};
42
75
  border: 2px solid ${theme.colors.liquorice};
43
76
  &:hover {
44
- border: ${!(disabled || $loading) &&
45
- `2px solid ${theme.colors.sesame}`};
77
+ border: ${!(disabled || $loading) && `2px solid ${theme.colors.sesame}`};
46
78
  background-color: ${!(disabled || $loading) && theme.colors.sesame};
47
79
  }
48
80
  `};
49
- `);
50
- const ChildrenContainer = styled.div `
81
+ `
82
+ );
83
+ const ChildrenContainer = styled.div`
51
84
  flex-grow: 1;
52
85
  `;
53
- //# sourceMappingURL=Chip.js.map
86
+
87
+ export { Chip };
@@ -1,51 +1,90 @@
1
- import React, { forwardRef } from 'react';
2
- import { Box } from '../Box';
3
- import { Field } from '../fields/Field';
4
- import { useUniqueId } from '../utils/id';
5
- import { Input, StyledFrontIcon } from '../fields/components/CommonInput';
6
- export const CurrencyInput = forwardRef(function CurrencyInput({ id: idProp, placeholder, name, value, decimalNumber = true, onChange, onInputChange, onBlur, min, max, disabled = false, error = false, fallbackStyle, ...fieldProps }, ref) {
7
- const id = useUniqueId(idProp);
8
- const frontIcon = 'pound-regular';
9
- const formatCurrency = (value) => {
10
- const decimalIndex = value.indexOf('.');
11
- if (!decimalNumber) {
12
- return Math.trunc(Number(value)).toString();
13
- }
14
- if (decimalIndex >= 0 && value.length > decimalIndex + 1) {
15
- const fractionalString = value.substring(decimalIndex + 1).substring(0, 2);
16
- return `${value.substring(0, decimalIndex)}.${fractionalString}`;
17
- }
18
- else {
19
- return value;
20
- }
21
- };
22
- const applyMinMax = (value) => {
23
- const numberValue = Number(value);
24
- if (min && numberValue < min)
25
- return min.toString();
26
- if (max && numberValue > max)
27
- return max.toString();
28
- return value;
29
- };
30
- const handleChange = (value) => {
31
- if (onChange === undefined)
32
- return;
33
- const EMPTY_INPUT = '';
34
- if (value === EMPTY_INPUT) {
35
- onChange(value);
36
- }
37
- else {
38
- const amount = formatCurrency(value);
39
- const normalisedValue = applyMinMax(amount);
40
- onChange(normalisedValue);
41
- }
42
- };
43
- return (React.createElement(Field, { ...fieldProps, htmlFor: id, error: error },
44
- React.createElement(Box, { flex: true, alignItems: "center", justifyContent: "flex-start" },
45
- React.createElement(StyledFrontIcon, { disabled: disabled, render: frontIcon, color: "sesame" }),
46
- React.createElement(Input, { ref: ref, error: error, disabled: disabled, type: "number", id: id, name: name, placeholder: placeholder, value: value, frontIcon: frontIcon, fallbackStyle: fallbackStyle, onChange: (e) => {
47
- onChange && handleChange(e.currentTarget.value);
48
- onInputChange && onInputChange(e);
49
- }, onBlur: onBlur }))));
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { forwardRef } from 'react';
3
+ import { Box } from '../Box/Box.js';
4
+ import { Field } from '../fields/Field/Field.js';
5
+ import { useUniqueId } from '../utils/id.js';
6
+ import { StyledFrontIcon, Input } from '../fields/components/CommonInput.js';
7
+
8
+ const CurrencyInput = forwardRef(function CurrencyInput2({
9
+ id: idProp,
10
+ placeholder,
11
+ name,
12
+ value,
13
+ decimalNumber = true,
14
+ onChange,
15
+ onInputChange,
16
+ onBlur,
17
+ min,
18
+ max,
19
+ disabled = false,
20
+ error = false,
21
+ fallbackStyle,
22
+ ...fieldProps
23
+ }, ref) {
24
+ const id = useUniqueId(idProp);
25
+ const frontIcon = "pound-regular";
26
+ const formatCurrency = (value2) => {
27
+ const decimalIndex = value2.indexOf(".");
28
+ if (!decimalNumber) {
29
+ return Math.trunc(Number(value2)).toString();
30
+ }
31
+ if (decimalIndex >= 0 && value2.length > decimalIndex + 1) {
32
+ const fractionalString = value2.substring(decimalIndex + 1).substring(0, 2);
33
+ return `${value2.substring(0, decimalIndex)}.${fractionalString}`;
34
+ } else {
35
+ return value2;
36
+ }
37
+ };
38
+ const applyMinMax = (value2) => {
39
+ const numberValue = Number(value2);
40
+ if (min && numberValue < min)
41
+ return min.toString();
42
+ if (max && numberValue > max)
43
+ return max.toString();
44
+ return value2;
45
+ };
46
+ const handleChange = (value2) => {
47
+ if (onChange === void 0)
48
+ return;
49
+ const EMPTY_INPUT = "";
50
+ if (value2 === EMPTY_INPUT) {
51
+ onChange(value2);
52
+ } else {
53
+ const amount = formatCurrency(value2);
54
+ const normalisedValue = applyMinMax(amount);
55
+ onChange(normalisedValue);
56
+ }
57
+ };
58
+ return /* @__PURE__ */ jsx(Field, { ...fieldProps, htmlFor: id, error, children: /* @__PURE__ */ jsxs(Box, { flex: true, alignItems: "center", justifyContent: "flex-start", children: [
59
+ /* @__PURE__ */ jsx(
60
+ StyledFrontIcon,
61
+ {
62
+ disabled,
63
+ render: frontIcon,
64
+ color: "sesame"
65
+ }
66
+ ),
67
+ /* @__PURE__ */ jsx(
68
+ Input,
69
+ {
70
+ ref,
71
+ error,
72
+ disabled,
73
+ type: "number",
74
+ id,
75
+ name,
76
+ placeholder,
77
+ value,
78
+ frontIcon,
79
+ fallbackStyle,
80
+ onChange: (e) => {
81
+ onChange && handleChange(e.currentTarget.value);
82
+ onInputChange && onInputChange(e);
83
+ },
84
+ onBlur
85
+ }
86
+ )
87
+ ] }) });
50
88
  });
51
- //# sourceMappingURL=CurrencyInput.js.map
89
+
90
+ export { CurrencyInput };
@@ -1,82 +1,130 @@
1
- import { addDays, eachMonthOfInterval, format, getDaysInMonth, getMonth, getYear, isSameDay, isSameMonth, isWeekend, isWithinInterval, } from 'date-fns';
2
- import React, { useState } from 'react';
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { addDays, isSameMonth, getYear, eachMonthOfInterval, format, getDaysInMonth, getMonth, isSameDay, isWithinInterval, isWeekend } from 'date-fns';
3
+ import { useState } from 'react';
3
4
  import styled, { css } from 'styled-components';
4
- import { Box } from '../Box';
5
- import { Icon } from '../Icon';
6
- import { Text } from '../Text';
7
- import { theme } from '../theme';
8
- import { convertToUkDate } from '../utils/date';
9
- import { focusOutlineStyle } from '../utils/focusOutline';
10
- import { useControllableState } from '../utils/useControlledState';
11
- import { DatesList } from './DatesList';
5
+ import { Box } from '../Box/Box.js';
6
+ import { Icon } from '../Icon/Icon.js';
7
+ import { Text } from '../Text/Text.js';
8
+ import { theme } from '../theme.js';
9
+ import { convertToUkDate } from '../utils/date.js';
10
+ import { focusOutlineStyle } from '../utils/focusOutline.js';
11
+ import { useControllableState } from '../utils/useControlledState.js';
12
+ import { DatesList } from './DatesList.js';
13
+
12
14
  const getAvailableMonths = (startDate, endDate) => {
13
- const monthList = eachMonthOfInterval({
14
- start: startDate,
15
- end: endDate,
16
- });
17
- return monthList.map((monthDate) => ({
18
- date: monthDate,
19
- label: format(monthDate, 'MMMM'),
20
- }));
15
+ const monthList = eachMonthOfInterval({
16
+ start: startDate,
17
+ end: endDate
18
+ });
19
+ return monthList.map((monthDate) => ({
20
+ date: monthDate,
21
+ label: format(monthDate, "MMMM")
22
+ }));
21
23
  };
22
- export const Datepicker = ({ showDayLabels = false, disableWeekend = true, range = 14, fromDate = new Date(), endingDate, showYear = false, showSelectedDate = false, onDateSelect, onChange, value, fallbackStyle = false, ...marginProps }) => {
23
- // We want to make sure that the date is in the UK timezone,
24
- // this might need to be revisit when opening up to new countries
25
- const startDate = convertToUkDate(fromDate);
26
- const endDate = endingDate ? endingDate : addDays(startDate, range);
27
- const availableMonths = getAvailableMonths(startDate, endDate);
28
- const selectedDate = value ?? new Date();
29
- const [activeDay, setActiveDay] = useControllableState({
30
- initialState: undefined,
31
- stateProp: value,
32
- });
33
- const [activeMonthIndex, setActiveMonth] = useState(showSelectedDate
34
- ? availableMonths.findIndex((month) => isSameMonth(month.date, selectedDate))
35
- : 0);
36
- const handleSelectEvent = (date) => {
37
- setActiveDay(date);
38
- onChange?.(date);
39
- onDateSelect(format(date, 'yyyy-MM-dd'));
40
- };
41
- const generateDaysForMonth = (monthDate) => {
42
- const daysInMonth = getDaysInMonth(monthDate);
43
- const month = getMonth(monthDate);
44
- const year = getYear(monthDate);
45
- const filteredDays = [];
46
- for (let i = 1; i <= daysInMonth; i += 1) {
47
- const date = new Date(year, month, i);
48
- filteredDays.push({
49
- date,
50
- label: format(date, 'dd'),
51
- active: activeDay ? isSameDay(date, activeDay) : false,
52
- disabled: !isWithinInterval(date, { start: startDate, end: endDate }) ||
53
- (disableWeekend && isWeekend(date)),
54
- });
55
- }
56
- return filteredDays;
57
- };
58
- return (React.createElement(Container, { id: "datepicker", ...marginProps, fallbackStyle: fallbackStyle },
59
- React.createElement(Header, { flex: true, alignItems: "center", justifyContent: "space-between", direction: "row" },
60
- React.createElement(Circle, { type: "button", disabled: activeMonthIndex === 0, onClick: () => setActiveMonth(activeMonthIndex - 1), onKeyDown: (e) => {
61
- if (e.key === 'Enter') {
62
- setActiveMonth(activeMonthIndex - 1);
63
- }
64
- } },
65
- React.createElement(Icon, { render: "caret", color: "cream", size: 18, rotate: 90 })),
66
- React.createElement(Heading, { tag: "h4", typo: "body-regular" },
67
- availableMonths[activeMonthIndex].label,
68
- ' ',
69
- showYear && `- ${getYear(availableMonths[activeMonthIndex].date)}`),
70
- React.createElement(Circle, { type: "button", disabled: activeMonthIndex === availableMonths.length - 1, onClick: () => setActiveMonth(activeMonthIndex + 1), onKeyDown: (e) => {
71
- if (e.key === 'Enter') {
72
- setActiveMonth(activeMonthIndex + 1);
73
- }
74
- } },
75
- React.createElement(Icon, { render: "caret", color: "cream", size: 18, rotate: -90 }))),
76
- React.createElement(Box, { flex: true, alignItems: "center", justifyContent: "center" },
77
- React.createElement(DatesList, { items: generateDaysForMonth(availableMonths[activeMonthIndex].date), showDayLabels: showDayLabels, handleDateSelect: handleSelectEvent }))));
24
+ const Datepicker = ({
25
+ showDayLabels = false,
26
+ disableWeekend = true,
27
+ range = 14,
28
+ fromDate = /* @__PURE__ */ new Date(),
29
+ endingDate,
30
+ showYear = false,
31
+ showSelectedDate = false,
32
+ onDateSelect,
33
+ onChange,
34
+ value,
35
+ fallbackStyle = false,
36
+ ...marginProps
37
+ }) => {
38
+ const startDate = convertToUkDate(fromDate);
39
+ const endDate = endingDate ? endingDate : addDays(startDate, range);
40
+ const availableMonths = getAvailableMonths(startDate, endDate);
41
+ const selectedDate = value ?? /* @__PURE__ */ new Date();
42
+ const [activeDay, setActiveDay] = useControllableState({
43
+ initialState: void 0,
44
+ stateProp: value
45
+ });
46
+ const [activeMonthIndex, setActiveMonth] = useState(
47
+ showSelectedDate ? availableMonths.findIndex(
48
+ (month) => isSameMonth(month.date, selectedDate)
49
+ ) : 0
50
+ );
51
+ const handleSelectEvent = (date) => {
52
+ setActiveDay(date);
53
+ onChange?.(date);
54
+ onDateSelect(format(date, "yyyy-MM-dd"));
55
+ };
56
+ const generateDaysForMonth = (monthDate) => {
57
+ const daysInMonth = getDaysInMonth(monthDate);
58
+ const month = getMonth(monthDate);
59
+ const year = getYear(monthDate);
60
+ const filteredDays = [];
61
+ for (let i = 1; i <= daysInMonth; i += 1) {
62
+ const date = new Date(year, month, i);
63
+ filteredDays.push({
64
+ date,
65
+ label: format(date, "dd"),
66
+ active: activeDay ? isSameDay(date, activeDay) : false,
67
+ disabled: !isWithinInterval(date, { start: startDate, end: endDate }) || disableWeekend && isWeekend(date)
68
+ });
69
+ }
70
+ return filteredDays;
71
+ };
72
+ return /* @__PURE__ */ jsxs(Container, { id: "datepicker", ...marginProps, fallbackStyle, children: [
73
+ /* @__PURE__ */ jsxs(
74
+ Header,
75
+ {
76
+ flex: true,
77
+ alignItems: "center",
78
+ justifyContent: "space-between",
79
+ direction: "row",
80
+ children: [
81
+ /* @__PURE__ */ jsx(
82
+ Circle,
83
+ {
84
+ type: "button",
85
+ disabled: activeMonthIndex === 0,
86
+ onClick: () => setActiveMonth(activeMonthIndex - 1),
87
+ onKeyDown: (e) => {
88
+ if (e.key === "Enter") {
89
+ setActiveMonth(activeMonthIndex - 1);
90
+ }
91
+ },
92
+ children: /* @__PURE__ */ jsx(Icon, { render: "caret", color: "cream", size: 18, rotate: 90 })
93
+ }
94
+ ),
95
+ /* @__PURE__ */ jsxs(Heading, { tag: "h4", typo: "body-regular", children: [
96
+ availableMonths[activeMonthIndex].label,
97
+ " ",
98
+ showYear && `- ${getYear(availableMonths[activeMonthIndex].date)}`
99
+ ] }),
100
+ /* @__PURE__ */ jsx(
101
+ Circle,
102
+ {
103
+ type: "button",
104
+ disabled: activeMonthIndex === availableMonths.length - 1,
105
+ onClick: () => setActiveMonth(activeMonthIndex + 1),
106
+ onKeyDown: (e) => {
107
+ if (e.key === "Enter") {
108
+ setActiveMonth(activeMonthIndex + 1);
109
+ }
110
+ },
111
+ children: /* @__PURE__ */ jsx(Icon, { render: "caret", color: "cream", size: 18, rotate: -90 })
112
+ }
113
+ )
114
+ ]
115
+ }
116
+ ),
117
+ /* @__PURE__ */ jsx(Box, { flex: true, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsx(
118
+ DatesList,
119
+ {
120
+ items: generateDaysForMonth(availableMonths[activeMonthIndex].date),
121
+ showDayLabels,
122
+ handleDateSelect: handleSelectEvent
123
+ }
124
+ ) })
125
+ ] });
78
126
  };
79
- const Container = styled(Box) `
127
+ const Container = styled(Box)`
80
128
  font-family: ${theme.font.system};
81
129
  display: inline-block;
82
130
  box-sizing: border-box;
@@ -84,16 +132,14 @@ const Container = styled(Box) `
84
132
  border-radius: 16px;
85
133
 
86
134
  ${({ fallbackStyle }) => {
87
- return fallbackStyle
88
- ? css `
135
+ return fallbackStyle ? css`
89
136
  background-color: ${theme.colors.cream};
90
- `
91
- : css `
137
+ ` : css`
92
138
  background-color: ${theme.colors.custard};
93
139
  `;
94
140
  }}
95
141
  `;
96
- const Header = styled(Box) `
142
+ const Header = styled(Box)`
97
143
  color: ${theme.colors.liquorice};
98
144
  user-select: none;
99
145
  padding: 16px;
@@ -104,12 +150,12 @@ const Header = styled(Box) `
104
150
  line-height: 1;
105
151
  }
106
152
  `;
107
- const Heading = styled(Text) `
153
+ const Heading = styled(Text)`
108
154
  position: relative;
109
155
  top: 2px;
110
156
  font-weight: ${theme.font.weight.medium};
111
157
  `;
112
- const Circle = styled.button `
158
+ const Circle = styled.button`
113
159
  background-color: ${theme.colors.liquorice};
114
160
  height: 32px;
115
161
  width: 32px;
@@ -128,4 +174,5 @@ const Circle = styled.button `
128
174
 
129
175
  ${focusOutlineStyle}
130
176
  `;
131
- //# sourceMappingURL=Datepicker.js.map
177
+
178
+ export { Datepicker };
@@ -1,30 +1,45 @@
1
- import React from 'react';
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import styled from 'styled-components';
3
3
  import { getISODay } from 'date-fns';
4
- import { theme } from '../theme';
5
- import { Text } from '../Text';
6
- import { focusOutlineStyle } from '../utils/focusOutline';
4
+ import { theme } from '../theme.js';
5
+ import { Text } from '../Text/Text.js';
6
+ import { focusOutlineStyle } from '../utils/focusOutline.js';
7
+
7
8
  const getBlankDaysCount = (firstDayOfTheMonth) => {
8
- const dayOfTheWeek = getISODay(firstDayOfTheMonth);
9
- return dayOfTheWeek - 1;
9
+ const dayOfTheWeek = getISODay(firstDayOfTheMonth);
10
+ return dayOfTheWeek - 1;
10
11
  };
11
- const daysOfTheWeek = ['mon', 'tues', 'wed', 'thurs', 'fri', 'sat', 'sun'];
12
- export const DatesList = ({ items, handleDateSelect, showDayLabels, }) => {
13
- return (React.createElement(Container, null,
14
- showDayLabels &&
15
- daysOfTheWeek.map((day) => {
16
- return (React.createElement(Text, { key: day, color: "sesame", typo: "label", mb: "24px" }, day));
17
- }),
18
- Array(getBlankDaysCount(items[0].date))
19
- .fill(null)
20
- .map((_, index) => (React.createElement(ListButton, { key: `blankItem-${index}`, disabled: true }))),
21
- items.map((item, i) => (React.createElement(ListButton, { key: i, type: "button", disabled: item.disabled, className: `ListButton ${item.active ? 'active' : ''}`, onClick: () => handleDateSelect(item.date), onKeyDown: (e) => {
22
- if (e.key === 'Enter') {
23
- handleDateSelect(item.date);
24
- }
25
- }, "data-testid": item.label }, item.label)))));
12
+ const daysOfTheWeek = ["mon", "tues", "wed", "thurs", "fri", "sat", "sun"];
13
+ const DatesList = ({
14
+ items,
15
+ handleDateSelect,
16
+ showDayLabels
17
+ }) => {
18
+ return /* @__PURE__ */ jsxs(Container, { children: [
19
+ showDayLabels && daysOfTheWeek.map((day) => {
20
+ return /* @__PURE__ */ jsx(Text, { color: "sesame", typo: "label", mb: "24px", children: day }, day);
21
+ }),
22
+ Array(getBlankDaysCount(items[0].date)).fill(null).map((_, index) => /* @__PURE__ */ jsx(ListButton, { disabled: true }, `blankItem-${index}`)),
23
+ items.map((item, i) => /* @__PURE__ */ jsx(
24
+ ListButton,
25
+ {
26
+ type: "button",
27
+ disabled: item.disabled,
28
+ className: `ListButton ${item.active ? "active" : ""}`,
29
+ onClick: () => handleDateSelect(item.date),
30
+ onKeyDown: (e) => {
31
+ if (e.key === "Enter") {
32
+ handleDateSelect(item.date);
33
+ }
34
+ },
35
+ "data-testid": item.label,
36
+ children: item.label
37
+ },
38
+ i
39
+ ))
40
+ ] });
26
41
  };
27
- const Container = styled.div `
42
+ const Container = styled.div`
28
43
  justify-items: center;
29
44
  display: grid;
30
45
  grid-column-gap: 4px;
@@ -42,7 +57,7 @@ const Container = styled.div `
42
57
  padding: 32px;
43
58
  }
44
59
  `;
45
- const ListButton = styled.button `
60
+ const ListButton = styled.button`
46
61
  display: flex;
47
62
  align-items: center;
48
63
  justify-content: center;
@@ -55,8 +70,8 @@ const ListButton = styled.button `
55
70
  line-height: 15px;
56
71
  color: ${theme.colors.liquorice};
57
72
  background-color: transparent;
58
- pointer-events: ${({ disabled }) => (disabled ? 'none' : '')};
59
- opacity: ${({ disabled }) => (disabled ? '0.2' : '1')};
73
+ pointer-events: ${({ disabled }) => disabled ? "none" : ""};
74
+ opacity: ${({ disabled }) => disabled ? "0.2" : "1"};
60
75
  cursor: pointer;
61
76
 
62
77
  &:hover:not(.active) {
@@ -72,4 +87,5 @@ const ListButton = styled.button `
72
87
 
73
88
  ${focusOutlineStyle}
74
89
  `;
75
- //# sourceMappingURL=DatesList.js.map
90
+
91
+ export { DatesList };
@@ -1,19 +1,25 @@
1
- import React, { memo } from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { memo } from 'react';
2
3
  import styled, { css } from 'styled-components';
3
- import { Box } from '../Box';
4
- import { theme } from '../theme';
5
- export const Divider = memo(function Divider({ maxWidth = 'none', height = '1px', color = 'oatmeal', ...marginProps }) {
6
- return (React.createElement(Line, { maxWidth: maxWidth, height: height, color: color, ...marginProps }));
4
+ import { Box } from '../Box/Box.js';
5
+ import { theme } from '../theme.js';
6
+
7
+ const Divider = memo(function Divider2({
8
+ maxWidth = "none",
9
+ height = "1px",
10
+ color = "oatmeal",
11
+ ...marginProps
12
+ }) {
13
+ return /* @__PURE__ */ jsx(Line, { maxWidth, height, color, ...marginProps });
7
14
  });
8
- const Line = styled(Box) `
9
- ${({ color }) => color
10
- ? css `
15
+ const Line = styled(Box)`
16
+ ${({ color }) => color ? css`
11
17
  background: ${theme.colors[color]};
12
- `
13
- : ''}
18
+ ` : ""}
14
19
  display: block;
15
20
  height: ${({ height }) => height};
16
21
  max-width: ${({ maxWidth }) => maxWidth};
17
22
  width: 100%;
18
23
  `;
19
- //# sourceMappingURL=Divider.js.map
24
+
25
+ export { Divider };