@faststore/ui 1.9.4 → 1.9.10

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 (434) hide show
  1. package/CHANGELOG.md +744 -2291
  2. package/README.md +2 -0
  3. package/dist/atoms/Badge/Badge.d.ts +11 -11
  4. package/dist/atoms/Badge/Badge.js +6 -0
  5. package/dist/atoms/Badge/Badge.js.map +1 -0
  6. package/dist/atoms/Badge/index.d.ts +2 -2
  7. package/dist/atoms/Badge/index.js +2 -0
  8. package/dist/atoms/Badge/index.js.map +1 -0
  9. package/dist/atoms/Button/Button.d.ts +10 -10
  10. package/dist/atoms/Button/Button.js +6 -0
  11. package/dist/atoms/Button/Button.js.map +1 -0
  12. package/dist/atoms/Button/index.d.ts +2 -2
  13. package/dist/atoms/Button/index.js +2 -0
  14. package/dist/atoms/Button/index.js.map +1 -0
  15. package/dist/atoms/Checkbox/Checkbox.d.ts +10 -10
  16. package/dist/atoms/Checkbox/Checkbox.js +6 -0
  17. package/dist/atoms/Checkbox/Checkbox.js.map +1 -0
  18. package/dist/atoms/Checkbox/index.d.ts +2 -2
  19. package/dist/atoms/Checkbox/index.js +2 -0
  20. package/dist/atoms/Checkbox/index.js.map +1 -0
  21. package/dist/atoms/Icon/Icon.d.ts +14 -14
  22. package/dist/atoms/Icon/Icon.js +6 -0
  23. package/dist/atoms/Icon/Icon.js.map +1 -0
  24. package/dist/atoms/Icon/index.d.ts +2 -2
  25. package/dist/atoms/Icon/index.js +2 -0
  26. package/dist/atoms/Icon/index.js.map +1 -0
  27. package/dist/atoms/Icon/stories/assets/ShoppingCart.d.ts +3 -3
  28. package/dist/atoms/Icon/stories/assets/ShoppingCart.js +8 -0
  29. package/dist/atoms/Icon/stories/assets/ShoppingCart.js.map +1 -0
  30. package/dist/atoms/Incentive/Incentive.d.ts +11 -11
  31. package/dist/atoms/Incentive/Incentive.js +6 -0
  32. package/dist/atoms/Incentive/Incentive.js.map +1 -0
  33. package/dist/atoms/Incentive/index.d.ts +2 -2
  34. package/dist/atoms/Incentive/index.js +2 -0
  35. package/dist/atoms/Incentive/index.js.map +1 -0
  36. package/dist/atoms/Incentive/stories/assets/Icons.d.ts +2 -2
  37. package/dist/atoms/Incentive/stories/assets/Icons.js +6 -0
  38. package/dist/atoms/Incentive/stories/assets/Icons.js.map +1 -0
  39. package/dist/atoms/Input/Input.d.ts +14 -14
  40. package/dist/atoms/Input/Input.js +10 -0
  41. package/dist/atoms/Input/Input.js.map +1 -0
  42. package/dist/atoms/Input/index.d.ts +2 -2
  43. package/dist/atoms/Input/index.js +2 -0
  44. package/dist/atoms/Input/index.js.map +1 -0
  45. package/dist/atoms/Label/Label.d.ts +10 -10
  46. package/dist/atoms/Label/Label.js +6 -0
  47. package/dist/atoms/Label/Label.js.map +1 -0
  48. package/dist/atoms/Label/index.d.ts +2 -2
  49. package/dist/atoms/Label/index.js +2 -0
  50. package/dist/atoms/Label/index.js.map +1 -0
  51. package/dist/atoms/Link/Link.d.ts +19 -19
  52. package/dist/atoms/Link/Link.js +13 -0
  53. package/dist/atoms/Link/Link.js.map +1 -0
  54. package/dist/atoms/Link/index.d.ts +2 -2
  55. package/dist/atoms/Link/index.js +2 -0
  56. package/dist/atoms/Link/index.js.map +1 -0
  57. package/dist/atoms/List/List.d.ts +12 -12
  58. package/dist/atoms/List/List.js +16 -0
  59. package/dist/atoms/List/List.js.map +1 -0
  60. package/dist/atoms/List/index.d.ts +2 -2
  61. package/dist/atoms/List/index.js +2 -0
  62. package/dist/atoms/List/index.js.map +1 -0
  63. package/dist/atoms/Overlay/Overlay.d.ts +10 -10
  64. package/dist/atoms/Overlay/Overlay.js +6 -0
  65. package/dist/atoms/Overlay/Overlay.js.map +1 -0
  66. package/dist/atoms/Overlay/index.d.ts +2 -2
  67. package/dist/atoms/Overlay/index.js +2 -0
  68. package/dist/atoms/Overlay/index.js.map +1 -0
  69. package/dist/atoms/Popover/Popover.d.ts +15 -15
  70. package/dist/atoms/Popover/Popover.js +7 -0
  71. package/dist/atoms/Popover/Popover.js.map +1 -0
  72. package/dist/atoms/Popover/index.d.ts +2 -2
  73. package/dist/atoms/Popover/index.js +2 -0
  74. package/dist/atoms/Popover/index.js.map +1 -0
  75. package/dist/atoms/Price/Price.d.ts +28 -28
  76. package/dist/atoms/Price/Price.js +7 -0
  77. package/dist/atoms/Price/Price.js.map +1 -0
  78. package/dist/atoms/Price/index.d.ts +2 -2
  79. package/dist/atoms/Price/index.js +2 -0
  80. package/dist/atoms/Price/index.js.map +1 -0
  81. package/dist/atoms/Radio/Radio.d.ts +7 -7
  82. package/dist/atoms/Radio/Radio.js +6 -0
  83. package/dist/atoms/Radio/Radio.js.map +1 -0
  84. package/dist/atoms/Radio/index.d.ts +2 -2
  85. package/dist/atoms/Radio/index.js +2 -0
  86. package/dist/atoms/Radio/index.js.map +1 -0
  87. package/dist/atoms/Select/Select.d.ts +10 -10
  88. package/dist/atoms/Select/Select.js +6 -0
  89. package/dist/atoms/Select/Select.js.map +1 -0
  90. package/dist/atoms/Select/index.d.ts +2 -2
  91. package/dist/atoms/Select/index.js +2 -0
  92. package/dist/atoms/Select/index.js.map +1 -0
  93. package/dist/atoms/Skeleton/Skeleton.d.ts +10 -10
  94. package/dist/atoms/Skeleton/Skeleton.js +6 -0
  95. package/dist/atoms/Skeleton/Skeleton.js.map +1 -0
  96. package/dist/atoms/Skeleton/index.d.ts +2 -2
  97. package/dist/atoms/Skeleton/index.js +2 -0
  98. package/dist/atoms/Skeleton/index.js.map +1 -0
  99. package/dist/atoms/Slider/Slider.d.ts +37 -37
  100. package/dist/atoms/Slider/Slider.js +46 -0
  101. package/dist/atoms/Slider/Slider.js.map +1 -0
  102. package/dist/atoms/Slider/index.d.ts +2 -2
  103. package/dist/atoms/Slider/index.js +2 -0
  104. package/dist/atoms/Slider/index.js.map +1 -0
  105. package/dist/atoms/Spinner/Spinner.d.ts +11 -11
  106. package/dist/atoms/Spinner/Spinner.js +6 -0
  107. package/dist/atoms/Spinner/Spinner.js.map +1 -0
  108. package/dist/atoms/Spinner/index.d.ts +2 -2
  109. package/dist/atoms/Spinner/index.js +2 -0
  110. package/dist/atoms/Spinner/index.js.map +1 -0
  111. package/dist/atoms/TextArea/TextArea.d.ts +14 -14
  112. package/dist/atoms/TextArea/TextArea.js +10 -0
  113. package/dist/atoms/TextArea/TextArea.js.map +1 -0
  114. package/dist/atoms/TextArea/index.d.ts +2 -2
  115. package/dist/atoms/TextArea/index.js +2 -0
  116. package/dist/atoms/TextArea/index.js.map +1 -0
  117. package/dist/hooks/useSlider/index.d.ts +2 -2
  118. package/dist/hooks/useSlider/index.js +3 -0
  119. package/dist/hooks/useSlider/index.js.map +1 -0
  120. package/dist/hooks/useSlider/useSlider.d.ts +62 -62
  121. package/dist/hooks/useSlider/useSlider.js +108 -0
  122. package/dist/hooks/useSlider/useSlider.js.map +1 -0
  123. package/dist/index.d.ts +80 -80
  124. package/dist/index.js +45 -8
  125. package/dist/index.js.map +1 -0
  126. package/dist/molecules/Accordion/Accordion.d.ts +26 -26
  127. package/dist/molecules/Accordion/Accordion.js +21 -0
  128. package/dist/molecules/Accordion/Accordion.js.map +1 -0
  129. package/dist/molecules/Accordion/AccordionButton.d.ts +10 -10
  130. package/dist/molecules/Accordion/AccordionButton.js +37 -0
  131. package/dist/molecules/Accordion/AccordionButton.js.map +1 -0
  132. package/dist/molecules/Accordion/AccordionItem.d.ts +28 -28
  133. package/dist/molecules/Accordion/AccordionItem.js +21 -0
  134. package/dist/molecules/Accordion/AccordionItem.js.map +1 -0
  135. package/dist/molecules/Accordion/AccordionPanel.d.ts +10 -10
  136. package/dist/molecules/Accordion/AccordionPanel.js +10 -0
  137. package/dist/molecules/Accordion/AccordionPanel.js.map +1 -0
  138. package/dist/molecules/Accordion/index.d.ts +8 -8
  139. package/dist/molecules/Accordion/index.js +5 -0
  140. package/dist/molecules/Accordion/index.js.map +1 -0
  141. package/dist/molecules/AggregateRating/AggregateRating.d.ts +18 -18
  142. package/dist/molecules/AggregateRating/AggregateRating.js +26 -0
  143. package/dist/molecules/AggregateRating/AggregateRating.js.map +1 -0
  144. package/dist/molecules/AggregateRating/index.d.ts +2 -2
  145. package/dist/molecules/AggregateRating/index.js +2 -0
  146. package/dist/molecules/AggregateRating/index.js.map +1 -0
  147. package/dist/molecules/Alert/Alert.d.ts +11 -11
  148. package/dist/molecules/Alert/Alert.js +6 -0
  149. package/dist/molecules/Alert/Alert.js.map +1 -0
  150. package/dist/molecules/Alert/index.d.ts +2 -2
  151. package/dist/molecules/Alert/index.js +2 -0
  152. package/dist/molecules/Alert/index.js.map +1 -0
  153. package/dist/molecules/Banner/Banner.d.ts +14 -14
  154. package/dist/molecules/Banner/Banner.js +6 -0
  155. package/dist/molecules/Banner/Banner.js.map +1 -0
  156. package/dist/molecules/Banner/BannerContent.d.ts +10 -10
  157. package/dist/molecules/Banner/BannerContent.js +6 -0
  158. package/dist/molecules/Banner/BannerContent.js.map +1 -0
  159. package/dist/molecules/Banner/BannerImage.d.ts +10 -10
  160. package/dist/molecules/Banner/BannerImage.js +6 -0
  161. package/dist/molecules/Banner/BannerImage.js.map +1 -0
  162. package/dist/molecules/Banner/BannerLink.d.ts +10 -10
  163. package/dist/molecules/Banner/BannerLink.js +6 -0
  164. package/dist/molecules/Banner/BannerLink.js.map +1 -0
  165. package/dist/molecules/Banner/index.d.ts +8 -8
  166. package/dist/molecules/Banner/index.js +5 -0
  167. package/dist/molecules/Banner/index.js.map +1 -0
  168. package/dist/molecules/Breadcrumb/Breadcrumb.d.ts +14 -14
  169. package/dist/molecules/Breadcrumb/Breadcrumb.js +38 -0
  170. package/dist/molecules/Breadcrumb/Breadcrumb.js.map +1 -0
  171. package/dist/molecules/Breadcrumb/index.d.ts +2 -2
  172. package/dist/molecules/Breadcrumb/index.js +2 -0
  173. package/dist/molecules/Breadcrumb/index.js.map +1 -0
  174. package/dist/molecules/Bullets/Bullets.d.ts +35 -35
  175. package/dist/molecules/Bullets/Bullets.js +12 -0
  176. package/dist/molecules/Bullets/Bullets.js.map +1 -0
  177. package/dist/molecules/Bullets/index.d.ts +2 -2
  178. package/dist/molecules/Bullets/index.js +2 -0
  179. package/dist/molecules/Bullets/index.js.map +1 -0
  180. package/dist/molecules/Card/Card.d.ts +10 -10
  181. package/dist/molecules/Card/Card.js +6 -0
  182. package/dist/molecules/Card/Card.js.map +1 -0
  183. package/dist/molecules/Card/CardActions.d.ts +10 -10
  184. package/dist/molecules/Card/CardActions.js +6 -0
  185. package/dist/molecules/Card/CardActions.js.map +1 -0
  186. package/dist/molecules/Card/CardContent.d.ts +10 -10
  187. package/dist/molecules/Card/CardContent.js +6 -0
  188. package/dist/molecules/Card/CardContent.js.map +1 -0
  189. package/dist/molecules/Card/CardImage.d.ts +10 -10
  190. package/dist/molecules/Card/CardImage.js +6 -0
  191. package/dist/molecules/Card/CardImage.js.map +1 -0
  192. package/dist/molecules/Card/index.d.ts +8 -8
  193. package/dist/molecules/Card/index.js +5 -0
  194. package/dist/molecules/Card/index.js.map +1 -0
  195. package/dist/molecules/Carousel/Arrows.d.ts +12 -12
  196. package/dist/molecules/Carousel/Arrows.js +6 -0
  197. package/dist/molecules/Carousel/Arrows.js.map +1 -0
  198. package/dist/molecules/Carousel/Carousel.d.ts +16 -16
  199. package/dist/molecules/Carousel/Carousel.js +124 -0
  200. package/dist/molecules/Carousel/Carousel.js.map +1 -0
  201. package/dist/molecules/Carousel/hooks/useSlideVisibility.d.ts +9 -9
  202. package/dist/molecules/Carousel/hooks/useSlideVisibility.js +29 -0
  203. package/dist/molecules/Carousel/hooks/useSlideVisibility.js.map +1 -0
  204. package/dist/molecules/Carousel/index.d.ts +2 -2
  205. package/dist/molecules/Carousel/index.js +3 -0
  206. package/dist/molecules/Carousel/index.js.map +1 -0
  207. package/dist/molecules/Dropdown/Dropdown.d.ts +9 -9
  208. package/dist/molecules/Dropdown/Dropdown.js +67 -0
  209. package/dist/molecules/Dropdown/Dropdown.js.map +1 -0
  210. package/dist/molecules/Dropdown/DropdownButton.d.ts +10 -10
  211. package/dist/molecules/Dropdown/DropdownButton.js +11 -0
  212. package/dist/molecules/Dropdown/DropdownButton.js.map +1 -0
  213. package/dist/molecules/Dropdown/DropdownItem.d.ts +10 -10
  214. package/dist/molecules/Dropdown/DropdownItem.js +26 -0
  215. package/dist/molecules/Dropdown/DropdownItem.js.map +1 -0
  216. package/dist/molecules/Dropdown/DropdownMenu.d.ts +22 -22
  217. package/dist/molecules/Dropdown/DropdownMenu.js +65 -0
  218. package/dist/molecules/Dropdown/DropdownMenu.js.map +1 -0
  219. package/dist/molecules/Dropdown/contexts/DropdownContext.d.ts +41 -41
  220. package/dist/molecules/Dropdown/contexts/DropdownContext.js +11 -0
  221. package/dist/molecules/Dropdown/contexts/DropdownContext.js.map +1 -0
  222. package/dist/molecules/Dropdown/hooks/useDropdown.d.ts +6 -6
  223. package/dist/molecules/Dropdown/hooks/useDropdown.js +14 -0
  224. package/dist/molecules/Dropdown/hooks/useDropdown.js.map +1 -0
  225. package/dist/molecules/Dropdown/hooks/useDropdownPosition.d.ts +8 -8
  226. package/dist/molecules/Dropdown/hooks/useDropdownPosition.js +25 -0
  227. package/dist/molecules/Dropdown/hooks/useDropdownPosition.js.map +1 -0
  228. package/dist/molecules/Dropdown/index.d.ts +8 -8
  229. package/dist/molecules/Dropdown/index.js +5 -0
  230. package/dist/molecules/Dropdown/index.js.map +1 -0
  231. package/dist/molecules/Dropdown/stories/assets/Caret.d.ts +2 -2
  232. package/dist/molecules/Dropdown/stories/assets/Caret.js +4 -0
  233. package/dist/molecules/Dropdown/stories/assets/Caret.js.map +1 -0
  234. package/dist/molecules/Form/Form.d.ts +11 -11
  235. package/dist/molecules/Form/Form.js +6 -0
  236. package/dist/molecules/Form/Form.js.map +1 -0
  237. package/dist/molecules/Form/index.d.ts +2 -2
  238. package/dist/molecules/Form/index.js +2 -0
  239. package/dist/molecules/Form/index.js.map +1 -0
  240. package/dist/molecules/IconButton/IconButton.d.ts +19 -19
  241. package/dist/molecules/IconButton/IconButton.js +9 -0
  242. package/dist/molecules/IconButton/IconButton.js.map +1 -0
  243. package/dist/molecules/IconButton/index.d.ts +2 -2
  244. package/dist/molecules/IconButton/index.js +2 -0
  245. package/dist/molecules/IconButton/index.js.map +1 -0
  246. package/dist/molecules/LoadingButton/LoadingButton.d.ts +14 -14
  247. package/dist/molecules/LoadingButton/LoadingButton.js +8 -0
  248. package/dist/molecules/LoadingButton/LoadingButton.js.map +1 -0
  249. package/dist/molecules/LoadingButton/index.d.ts +2 -2
  250. package/dist/molecules/LoadingButton/index.js +2 -0
  251. package/dist/molecules/LoadingButton/index.js.map +1 -0
  252. package/dist/molecules/Modal/Modal.d.ts +25 -25
  253. package/dist/molecules/Modal/Modal.js +31 -0
  254. package/dist/molecules/Modal/Modal.js.map +1 -0
  255. package/dist/molecules/Modal/ModalContent.d.ts +10 -10
  256. package/dist/molecules/Modal/ModalContent.js +23 -0
  257. package/dist/molecules/Modal/ModalContent.js.map +1 -0
  258. package/dist/molecules/Modal/index.d.ts +2 -2
  259. package/dist/molecules/Modal/index.js +2 -0
  260. package/dist/molecules/Modal/index.js.map +1 -0
  261. package/dist/molecules/Modal/useTrapFocus.d.ts +8 -8
  262. package/dist/molecules/Modal/useTrapFocus.js +76 -0
  263. package/dist/molecules/Modal/useTrapFocus.js.map +1 -0
  264. package/dist/molecules/PaymentMethods/PaymentMethods.d.ts +26 -26
  265. package/dist/molecules/PaymentMethods/PaymentMethods.js +8 -0
  266. package/dist/molecules/PaymentMethods/PaymentMethods.js.map +1 -0
  267. package/dist/molecules/PaymentMethods/index.d.ts +2 -2
  268. package/dist/molecules/PaymentMethods/index.js +2 -0
  269. package/dist/molecules/PaymentMethods/index.js.map +1 -0
  270. package/dist/molecules/PaymentMethods/stories/assets/Icons.d.ts +9 -9
  271. package/dist/molecules/PaymentMethods/stories/assets/Icons.js +26 -0
  272. package/dist/molecules/PaymentMethods/stories/assets/Icons.js.map +1 -0
  273. package/dist/molecules/PriceRange/PriceRange.d.ts +23 -23
  274. package/dist/molecules/PriceRange/PriceRange.js +23 -0
  275. package/dist/molecules/PriceRange/PriceRange.js.map +1 -0
  276. package/dist/molecules/PriceRange/index.d.ts +2 -2
  277. package/dist/molecules/PriceRange/index.js +2 -0
  278. package/dist/molecules/PriceRange/index.js.map +1 -0
  279. package/dist/molecules/ProductCard/ProductCard.d.ts +11 -11
  280. package/dist/molecules/ProductCard/ProductCard.js +6 -0
  281. package/dist/molecules/ProductCard/ProductCard.js.map +1 -0
  282. package/dist/molecules/ProductCard/ProductCardActions.d.ts +10 -10
  283. package/dist/molecules/ProductCard/ProductCardActions.js +6 -0
  284. package/dist/molecules/ProductCard/ProductCardActions.js.map +1 -0
  285. package/dist/molecules/ProductCard/ProductCardContent.d.ts +10 -10
  286. package/dist/molecules/ProductCard/ProductCardContent.js +6 -0
  287. package/dist/molecules/ProductCard/ProductCardContent.js.map +1 -0
  288. package/dist/molecules/ProductCard/ProductCardImage.d.ts +10 -10
  289. package/dist/molecules/ProductCard/ProductCardImage.js +6 -0
  290. package/dist/molecules/ProductCard/ProductCardImage.js.map +1 -0
  291. package/dist/molecules/ProductCard/index.d.ts +8 -8
  292. package/dist/molecules/ProductCard/index.js +5 -0
  293. package/dist/molecules/ProductCard/index.js.map +1 -0
  294. package/dist/molecules/QuantitySelector/QuantitySelector.d.ts +30 -30
  295. package/dist/molecules/QuantitySelector/QuantitySelector.js +11 -0
  296. package/dist/molecules/QuantitySelector/QuantitySelector.js.map +1 -0
  297. package/dist/molecules/QuantitySelector/index.d.ts +2 -2
  298. package/dist/molecules/QuantitySelector/index.js +2 -0
  299. package/dist/molecules/QuantitySelector/index.js.map +1 -0
  300. package/dist/molecules/QuantitySelector/stories/assets/Icons.d.ts +7 -7
  301. package/dist/molecules/QuantitySelector/stories/assets/Icons.js +11 -0
  302. package/dist/molecules/QuantitySelector/stories/assets/Icons.js.map +1 -0
  303. package/dist/molecules/RadioGroup/RadioGroup.d.ts +5 -5
  304. package/dist/molecules/RadioGroup/RadioGroup.js +10 -0
  305. package/dist/molecules/RadioGroup/RadioGroup.js.map +1 -0
  306. package/dist/molecules/RadioGroup/RadioOption.d.ts +19 -19
  307. package/dist/molecules/RadioGroup/RadioOption.js +11 -0
  308. package/dist/molecules/RadioGroup/RadioOption.js.map +1 -0
  309. package/dist/molecules/RadioGroup/index.d.ts +4 -4
  310. package/dist/molecules/RadioGroup/index.js +3 -0
  311. package/dist/molecules/RadioGroup/index.js.map +1 -0
  312. package/dist/molecules/RadioGroup/useRadioGroup.d.ts +17 -17
  313. package/dist/molecules/RadioGroup/useRadioGroup.js +10 -0
  314. package/dist/molecules/RadioGroup/useRadioGroup.js.map +1 -0
  315. package/dist/molecules/SearchInput/SearchInput.d.ts +28 -28
  316. package/dist/molecules/SearchInput/SearchInput.js +28 -0
  317. package/dist/molecules/SearchInput/SearchInput.js.map +1 -0
  318. package/dist/molecules/SearchInput/index.d.ts +2 -2
  319. package/dist/molecules/SearchInput/index.js +2 -0
  320. package/dist/molecules/SearchInput/index.js.map +1 -0
  321. package/dist/molecules/SearchInput/stories/assets/CustomIcon.d.ts +3 -3
  322. package/dist/molecules/SearchInput/stories/assets/CustomIcon.js +7 -0
  323. package/dist/molecules/SearchInput/stories/assets/CustomIcon.js.map +1 -0
  324. package/dist/molecules/Table/Table.d.ts +11 -11
  325. package/dist/molecules/Table/Table.js +6 -0
  326. package/dist/molecules/Table/Table.js.map +1 -0
  327. package/dist/molecules/Table/TableBody.d.ts +11 -11
  328. package/dist/molecules/Table/TableBody.js +6 -0
  329. package/dist/molecules/Table/TableBody.js.map +1 -0
  330. package/dist/molecules/Table/TableCell.d.ts +20 -20
  331. package/dist/molecules/Table/TableCell.js +7 -0
  332. package/dist/molecules/Table/TableCell.js.map +1 -0
  333. package/dist/molecules/Table/TableFooter.d.ts +11 -11
  334. package/dist/molecules/Table/TableFooter.js +6 -0
  335. package/dist/molecules/Table/TableFooter.js.map +1 -0
  336. package/dist/molecules/Table/TableHead.d.ts +11 -11
  337. package/dist/molecules/Table/TableHead.js +6 -0
  338. package/dist/molecules/Table/TableHead.js.map +1 -0
  339. package/dist/molecules/Table/TableRow.d.ts +11 -11
  340. package/dist/molecules/Table/TableRow.js +6 -0
  341. package/dist/molecules/Table/TableRow.js.map +1 -0
  342. package/dist/molecules/Table/index.d.ts +12 -12
  343. package/dist/molecules/Table/index.js +7 -0
  344. package/dist/molecules/Table/index.js.map +1 -0
  345. package/dist/organisms/Hero/Hero.d.ts +11 -11
  346. package/dist/organisms/Hero/Hero.js +6 -0
  347. package/dist/organisms/Hero/Hero.js.map +1 -0
  348. package/dist/organisms/Hero/HeroHeading.d.ts +10 -10
  349. package/dist/organisms/Hero/HeroHeading.js +6 -0
  350. package/dist/organisms/Hero/HeroHeading.js.map +1 -0
  351. package/dist/organisms/Hero/HeroImage.d.ts +10 -10
  352. package/dist/organisms/Hero/HeroImage.js +6 -0
  353. package/dist/organisms/Hero/HeroImage.js.map +1 -0
  354. package/dist/organisms/Hero/index.d.ts +6 -6
  355. package/dist/organisms/Hero/index.js +4 -0
  356. package/dist/organisms/Hero/index.js.map +1 -0
  357. package/dist/organisms/OutOfStock/OutOfStock.d.ts +21 -21
  358. package/dist/organisms/OutOfStock/OutOfStock.js +8 -0
  359. package/dist/organisms/OutOfStock/OutOfStock.js.map +1 -0
  360. package/dist/organisms/OutOfStock/OutOfStockMessage.d.ts +9 -9
  361. package/dist/organisms/OutOfStock/OutOfStockMessage.js +5 -0
  362. package/dist/organisms/OutOfStock/OutOfStockMessage.js.map +1 -0
  363. package/dist/organisms/OutOfStock/OutOfStockTitle.d.ts +9 -9
  364. package/dist/organisms/OutOfStock/OutOfStockTitle.js +5 -0
  365. package/dist/organisms/OutOfStock/OutOfStockTitle.js.map +1 -0
  366. package/dist/organisms/OutOfStock/index.d.ts +6 -6
  367. package/dist/organisms/OutOfStock/index.js +4 -0
  368. package/dist/organisms/OutOfStock/index.js.map +1 -0
  369. package/dist/setupTests.d.ts +1 -1
  370. package/dist/setupTests.js +6 -0
  371. package/dist/setupTests.js.map +1 -0
  372. package/dist/typings/PolymorphicGenerics.d.ts +28 -28
  373. package/dist/typings/PolymorphicGenerics.js +8 -0
  374. package/dist/typings/PolymorphicGenerics.js.map +1 -0
  375. package/dist/typings/index.d.ts +1 -1
  376. package/dist/typings/index.js +2 -0
  377. package/dist/typings/index.js.map +1 -0
  378. package/dist/utils/toHaveNoIncomplete.d.ts +17 -17
  379. package/dist/utils/toHaveNoIncomplete.js +43 -0
  380. package/dist/utils/toHaveNoIncomplete.js.map +1 -0
  381. package/package.json +9 -13
  382. package/src/molecules/Accordion/Accordion.test.tsx +3 -3
  383. package/src/molecules/AggregateRating/stories/AggregateRating.stories.tsx +2 -3
  384. package/src/molecules/Bullets/Bullets.test.tsx +6 -6
  385. package/src/molecules/Bullets/Bullets.tsx +4 -3
  386. package/src/molecules/Dropdown/DropdownItem.tsx +2 -5
  387. package/src/molecules/Dropdown/DropdownMenu.tsx +2 -7
  388. package/src/molecules/Modal/ModalContent.tsx +0 -1
  389. package/src/typings/PolymorphicGenerics.ts +2 -3
  390. package/dist/atoms/Badge/stories/Badge.stories.d.ts +0 -17
  391. package/dist/atoms/Button/stories/Button.stories.d.ts +0 -14
  392. package/dist/atoms/Checkbox/stories/Checkbox.stories.d.ts +0 -4
  393. package/dist/atoms/Icon/stories/Icon.stories.d.ts +0 -14
  394. package/dist/atoms/Incentive/stories/Incentive.stories.d.ts +0 -4
  395. package/dist/atoms/Input/stories/Input.stories.d.ts +0 -14
  396. package/dist/atoms/Label/stories/Label.stories.d.ts +0 -14
  397. package/dist/atoms/List/stories/List.stories.d.ts +0 -22
  398. package/dist/atoms/Overlay/stories/Overlay.stories.d.ts +0 -8
  399. package/dist/atoms/Popover/stories/Popover.stories.d.ts +0 -14
  400. package/dist/atoms/Price/stories/Price.stories.d.ts +0 -18
  401. package/dist/atoms/Radio/stories/Radio.stories.d.ts +0 -4
  402. package/dist/atoms/Select/stories/Select.stories.d.ts +0 -20
  403. package/dist/atoms/Skeleton/stories/Skeleton.stories.d.ts +0 -12
  404. package/dist/atoms/Slider/stories/Slider.stories.d.ts +0 -4
  405. package/dist/atoms/Spinner/stories/Spinner.stories.d.ts +0 -12
  406. package/dist/atoms/TextArea/stories/TextArea.stories.d.ts +0 -4
  407. package/dist/molecules/Accordion/stories/Accordion.stories.d.ts +0 -14
  408. package/dist/molecules/AggregateRating/stories/AggregateRating.stories.d.ts +0 -16
  409. package/dist/molecules/Alert/stories/Alert.stories.d.ts +0 -5
  410. package/dist/molecules/Banner/stories/Banner.stories.d.ts +0 -4
  411. package/dist/molecules/Breadcrumb/stories/Breadcrumb.stories.d.ts +0 -15
  412. package/dist/molecules/Bullets/stories/Bullets.stories.d.ts +0 -15
  413. package/dist/molecules/Card/stories/Card.stories.d.ts +0 -4
  414. package/dist/molecules/Carousel/stories/Carousel.stories.d.ts +0 -18
  415. package/dist/molecules/Dropdown/stories/Dropdown.stories.d.ts +0 -7
  416. package/dist/molecules/Form/stories/Form.stories.d.ts +0 -12
  417. package/dist/molecules/IconButton/stories/IconButton.stories.d.ts +0 -5
  418. package/dist/molecules/LoadingButton/stories/LoadingButton.stories.d.ts +0 -14
  419. package/dist/molecules/Modal/stories/Modal.stories.d.ts +0 -5
  420. package/dist/molecules/PaymentMethods/stories/PaymentMethods.stories.d.ts +0 -4
  421. package/dist/molecules/PriceRange/stories/PriceRange.stories.d.ts +0 -4
  422. package/dist/molecules/ProductCard/stories/ProductCard.stories.d.ts +0 -4
  423. package/dist/molecules/QuantitySelector/stories/QuantitySelector.stories.d.ts +0 -5
  424. package/dist/molecules/RadioGroup/stories/RadioGroup.stories.d.ts +0 -15
  425. package/dist/molecules/SearchInput/stories/SearchInput.stories.d.ts +0 -15
  426. package/dist/molecules/Table/stories/Table.stories.d.ts +0 -12
  427. package/dist/organisms/Hero/stories/Hero.stories.d.ts +0 -4
  428. package/dist/organisms/OutOfStock/stories/OutOfStock.stories.d.ts +0 -10
  429. package/dist/ui.cjs.development.js +0 -2109
  430. package/dist/ui.cjs.development.js.map +0 -1
  431. package/dist/ui.cjs.production.min.js +0 -2
  432. package/dist/ui.cjs.production.min.js.map +0 -1
  433. package/dist/ui.esm.js +0 -2037
  434. package/dist/ui.esm.js.map +0 -1
@@ -1,62 +1,62 @@
1
- import type { Dispatch } from 'react';
2
- import type { SwipeableProps } from 'react-swipeable';
3
- export declare type SlideDirection = 'next' | 'previous';
4
- interface NextPageAction {
5
- type: 'NEXT_PAGE';
6
- }
7
- interface PreviousPageAction {
8
- type: 'PREVIOUS_PAGE';
9
- }
10
- interface GoToPageAction {
11
- type: 'GO_TO_PAGE';
12
- payload: {
13
- pageIndex: number;
14
- shouldSlide: boolean;
15
- };
16
- }
17
- interface StopSlideAction {
18
- type: 'STOP_SLIDE';
19
- }
20
- export declare type Action = NextPageAction | PreviousPageAction | StopSlideAction | GoToPageAction;
21
- export declare type SliderDispatch = Dispatch<Action>;
22
- export interface SliderState {
23
- /**
24
- * The `currentItem` in a Slider with multiple items in a single page is
25
- * always **the one with the lowest index** in the current page.
26
- */
27
- currentItem: number;
28
- /** Currently active page */
29
- currentPage: number;
30
- /**
31
- * Whether or not the Slider is currently sliding. This is useful to
32
- * manipulate the `transition` property in a component.
33
- */
34
- sliding: boolean;
35
- /** The direction in which the Slider is sliding. */
36
- slideDirection: SlideDirection;
37
- /** The total number of unique items in the slider. */
38
- totalItems: number;
39
- /** The number of items in a single page. */
40
- itemsPerPage: number;
41
- /** The total number of pages in the slider. */
42
- totalPages: number;
43
- /** Whether or not the slider is infinite. */
44
- infinite: boolean;
45
- }
46
- export declare const nextPage: (current: number, total: number) => number;
47
- export declare const previousPage: (current: number, total: number) => number;
48
- export interface UseSliderArgs extends SwipeableProps {
49
- /** The total number of unique items in the slider. */
50
- totalItems: number;
51
- /** The number of items in a single slider page. */
52
- itemsPerPage?: number;
53
- /** Whether or not the slider is infinite. */
54
- infiniteMode?: boolean;
55
- }
56
- export default function useSlider({ totalItems, itemsPerPage, infiniteMode, ...swipeableConfigOverrides }: UseSliderArgs): {
57
- handlers: import("react-swipeable").SwipeableHandlers;
58
- slide: (page: number | "next" | "previous", dispatch: Dispatch<Action>) => void;
59
- sliderState: SliderState;
60
- sliderDispatch: Dispatch<Action>;
61
- };
62
- export {};
1
+ import type { Dispatch } from 'react';
2
+ import type { SwipeableProps } from 'react-swipeable';
3
+ export declare type SlideDirection = 'next' | 'previous';
4
+ interface NextPageAction {
5
+ type: 'NEXT_PAGE';
6
+ }
7
+ interface PreviousPageAction {
8
+ type: 'PREVIOUS_PAGE';
9
+ }
10
+ interface GoToPageAction {
11
+ type: 'GO_TO_PAGE';
12
+ payload: {
13
+ pageIndex: number;
14
+ shouldSlide: boolean;
15
+ };
16
+ }
17
+ interface StopSlideAction {
18
+ type: 'STOP_SLIDE';
19
+ }
20
+ export declare type Action = NextPageAction | PreviousPageAction | StopSlideAction | GoToPageAction;
21
+ export declare type SliderDispatch = Dispatch<Action>;
22
+ export interface SliderState {
23
+ /**
24
+ * The `currentItem` in a Slider with multiple items in a single page is
25
+ * always **the one with the lowest index** in the current page.
26
+ */
27
+ currentItem: number;
28
+ /** Currently active page */
29
+ currentPage: number;
30
+ /**
31
+ * Whether or not the Slider is currently sliding. This is useful to
32
+ * manipulate the `transition` property in a component.
33
+ */
34
+ sliding: boolean;
35
+ /** The direction in which the Slider is sliding. */
36
+ slideDirection: SlideDirection;
37
+ /** The total number of unique items in the slider. */
38
+ totalItems: number;
39
+ /** The number of items in a single page. */
40
+ itemsPerPage: number;
41
+ /** The total number of pages in the slider. */
42
+ totalPages: number;
43
+ /** Whether or not the slider is infinite. */
44
+ infinite: boolean;
45
+ }
46
+ export declare const nextPage: (current: number, total: number) => number;
47
+ export declare const previousPage: (current: number, total: number) => number;
48
+ export interface UseSliderArgs extends SwipeableProps {
49
+ /** The total number of unique items in the slider. */
50
+ totalItems: number;
51
+ /** The number of items in a single slider page. */
52
+ itemsPerPage?: number;
53
+ /** Whether or not the slider is infinite. */
54
+ infiniteMode?: boolean;
55
+ }
56
+ export default function useSlider({ totalItems, itemsPerPage, infiniteMode, ...swipeableConfigOverrides }: UseSliderArgs): {
57
+ handlers: import("react-swipeable").SwipeableHandlers;
58
+ slide: (page: number | SlideDirection, dispatch: Dispatch<Action>) => void;
59
+ sliderState: SliderState;
60
+ sliderDispatch: Dispatch<Action>;
61
+ };
62
+ export {};
@@ -0,0 +1,108 @@
1
+ import { useReducer } from 'react';
2
+ import { useSwipeable } from 'react-swipeable';
3
+ export const nextPage = (current, total) => (current + 1) % total;
4
+ export const previousPage = (current, total) => (total - ((total - current + 1) % total)) % total;
5
+ function reducer(state, action) {
6
+ switch (action.type) {
7
+ case 'NEXT_PAGE': {
8
+ // If `state.infinite` is true, we need to take into account an extra
9
+ // page in the calculation. This extra page is a clone of the first page.
10
+ const adjustedTotalPages = state.infinite
11
+ ? state.totalPages + 1
12
+ : state.totalPages;
13
+ const nextPageIndex = nextPage(state.currentPage, adjustedTotalPages);
14
+ const nextItemIndex = (nextPageIndex % adjustedTotalPages) * state.itemsPerPage;
15
+ return {
16
+ ...state,
17
+ sliding: true,
18
+ slideDirection: 'next',
19
+ currentItem: nextItemIndex,
20
+ currentPage: nextPageIndex,
21
+ };
22
+ }
23
+ case 'PREVIOUS_PAGE': {
24
+ // If `state.infinite` is true, we need to take into account an extra
25
+ // page in the calculation. This extra page is a clone of the first page.
26
+ const adjustedTotalPages = state.infinite
27
+ ? state.totalPages + 1
28
+ : state.totalPages;
29
+ // If `state.infinite` is true and we're currently on page 0, we need to
30
+ // let the slider go to page -1. This -1 page is a clone of the last page.
31
+ const shouldGoToClone = state.infinite && state.currentPage === 0;
32
+ const previousPageIndex = shouldGoToClone
33
+ ? -1
34
+ : previousPage(state.currentPage, state.totalPages);
35
+ return {
36
+ ...state,
37
+ sliding: true,
38
+ slideDirection: 'previous',
39
+ currentItem: (previousPageIndex % adjustedTotalPages) * state.itemsPerPage,
40
+ currentPage: previousPageIndex,
41
+ };
42
+ }
43
+ case 'GO_TO_PAGE': {
44
+ if (action.payload.pageIndex === state.currentPage) {
45
+ return state;
46
+ }
47
+ return {
48
+ ...state,
49
+ sliding: action.payload.shouldSlide,
50
+ slideDirection: action.payload.pageIndex > state.currentPage ? 'next' : 'previous',
51
+ currentItem: (action.payload.pageIndex % state.totalPages) * state.itemsPerPage,
52
+ currentPage: action.payload.pageIndex,
53
+ };
54
+ }
55
+ case 'STOP_SLIDE':
56
+ return { ...state, sliding: false };
57
+ default:
58
+ return state;
59
+ }
60
+ }
61
+ const defaultSliderState = (totalItems, itemsPerPage, infinite) => ({
62
+ currentItem: 0,
63
+ currentPage: 0,
64
+ sliding: false,
65
+ slideDirection: 'next',
66
+ totalItems,
67
+ itemsPerPage,
68
+ totalPages: Math.ceil(totalItems / itemsPerPage),
69
+ infinite,
70
+ });
71
+ const slide = (page, dispatch) => {
72
+ if (page === 'next') {
73
+ dispatch({
74
+ type: 'NEXT_PAGE',
75
+ });
76
+ }
77
+ if (page === 'previous') {
78
+ dispatch({
79
+ type: 'PREVIOUS_PAGE',
80
+ });
81
+ }
82
+ if (typeof page === 'number') {
83
+ dispatch({
84
+ type: 'GO_TO_PAGE',
85
+ payload: {
86
+ pageIndex: page,
87
+ shouldSlide: true,
88
+ },
89
+ });
90
+ }
91
+ };
92
+ export default function useSlider({ totalItems, itemsPerPage = 1, infiniteMode = false, ...swipeableConfigOverrides }) {
93
+ const [sliderState, sliderDispatch] = useReducer(reducer, undefined, () => defaultSliderState(totalItems, itemsPerPage, infiniteMode));
94
+ const handlers = useSwipeable({
95
+ onSwipedRight: () => slide('previous', sliderDispatch),
96
+ onSwipedLeft: () => slide('next', sliderDispatch),
97
+ preventDefaultTouchmoveEvent: true,
98
+ trackMouse: true,
99
+ ...swipeableConfigOverrides,
100
+ });
101
+ return {
102
+ handlers,
103
+ slide,
104
+ sliderState,
105
+ sliderDispatch,
106
+ };
107
+ }
108
+ //# sourceMappingURL=useSlider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file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CAAA;IAEF,OAAO;QACL,QAAQ;QACR,KAAK;QACL,WAAW;QACX,cAAc;KACf,CAAA;AACH,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,80 +1,80 @@
1
- export { default as Link } from './atoms/Link';
2
- export type { LinkProps } from './atoms/Link';
3
- export { default as Button } from './atoms/Button';
4
- export type { ButtonProps } from './atoms/Button';
5
- export { default as Input } from './atoms/Input';
6
- export type { InputProps } from './atoms/Input';
7
- export { default as Icon } from './atoms/Icon';
8
- export type { IconProps } from './atoms/Icon';
9
- export { default as Popover } from './atoms/Popover';
10
- export type { PopoverProps } from './atoms/Popover';
11
- export { default as Price } from './atoms/Price';
12
- export type { PriceProps } from './atoms/Price';
13
- export { default as TextArea } from './atoms/TextArea';
14
- export type { TextAreaProps } from './atoms/TextArea';
15
- export { default as Checkbox } from './atoms/Checkbox';
16
- export type { CheckboxProps } from './atoms/Checkbox';
17
- export { default as Overlay } from './atoms/Overlay';
18
- export type { OverlayProps } from './atoms/Overlay';
19
- export { default as Select } from './atoms/Select';
20
- export type { SelectProps } from './atoms/Select';
21
- export { default as Radio } from './atoms/Radio';
22
- export type { RadioProps } from './atoms/Radio';
23
- export { default as Badge } from './atoms/Badge';
24
- export type { BadgeProps } from './atoms/Badge';
25
- export { default as Slider } from './atoms/Slider';
26
- export type { SliderProps } from './atoms/Slider';
27
- export { default as List } from './atoms/List';
28
- export type { ListProps } from './atoms/List';
29
- export { default as Skeleton } from './atoms/Skeleton';
30
- export type { SkeletonProps } from './atoms/Skeleton';
31
- export { default as Spinner } from './atoms/Spinner';
32
- export type { SpinnerProps } from './atoms/Spinner';
33
- export { default as Label } from './atoms/Label';
34
- export type { LabelProps } from './atoms/Label';
35
- export { default as Incentive } from './atoms/Incentive';
36
- export type { IncentiveProps } from './atoms/Incentive';
37
- export { default as ProductCard, ProductCardImage, ProductCardContent, ProductCardActions, } from './molecules/ProductCard';
38
- export type { ProductCardProps, ProductCardImageProps, ProductCardContentProps, ProductCardActionsProps, } from './molecules/ProductCard';
39
- export { default as Card, CardImage, CardContent, CardActions, } from './molecules/Card';
40
- export type { CardProps, CardImageProps, CardContentProps, CardActionsProps, } from './molecules/Card';
41
- export { default as Bullets } from './molecules/Bullets';
42
- export type { BulletsProps } from './molecules/Bullets';
43
- export { default as SearchInput } from './molecules/SearchInput';
44
- export type { SearchInputProps, SearchInputRef } from './molecules/SearchInput';
45
- export { default as Carousel } from './molecules/Carousel';
46
- export type { CarouselProps } from './molecules/Carousel';
47
- export { default as IconButton } from './molecules/IconButton';
48
- export type { IconButtonProps } from './molecules/IconButton';
49
- export { default as Modal } from './molecules/Modal';
50
- export type { ModalProps } from './molecules/Modal';
51
- export { default as Banner, BannerContent, BannerImage, BannerLink, } from './molecules/Banner';
52
- export type { BannerProps, BannerContentProps, BannerImageProps, BannerLinkProps, } from './molecules/Banner';
53
- export { default as PaymentMethods } from './molecules/PaymentMethods';
54
- export type { PaymentMethodsProps } from './molecules/PaymentMethods';
55
- export { default as Breadcrumb } from './molecules/Breadcrumb';
56
- export type { BreadcrumbProps } from './molecules/Breadcrumb';
57
- export { default as LoadingButton } from './molecules/LoadingButton';
58
- export type { LoadingButtonProps } from './molecules/LoadingButton';
59
- export { default as PriceRange } from './molecules/PriceRange';
60
- export type { PriceRangeProps } from './molecules/PriceRange';
61
- export { default as RadioGroup, RadioOption } from './molecules/RadioGroup';
62
- export type { RadioGroupProps, RadioOptionProps } from './molecules/RadioGroup';
63
- export { default as Accordion, AccordionItem, AccordionButton, AccordionPanel, } from './molecules/Accordion';
64
- export type { AccordionProps, AccordionItemProps, AccordionButtonProps, AccordionPanelProps, } from './molecules/Accordion';
65
- export { Table, TableBody, TableCell, TableFooter, TableHead, TableRow, } from './molecules/Table';
66
- export type { TableProps, TableBodyProps, TableCellProps, TableFooterProps, TableHeadProps, TableRowProps, } from './molecules/Table';
67
- export { default as Form } from './molecules/Form';
68
- export type { FormProps } from './molecules/Form';
69
- export { default as Alert } from './molecules/Alert';
70
- export type { AlertProps } from './molecules/Alert';
71
- export { default as QuantitySelector } from './molecules/QuantitySelector';
72
- export type { QuantitySelectorProps } from './molecules/QuantitySelector';
73
- export { default as Dropdown, DropdownButton, DropdownItem, DropdownMenu, } from './molecules/Dropdown';
74
- export type { DropdownProps, DropdownButtonProps, DropdownItemProps, DropdownMenuProps, } from './molecules/Dropdown';
75
- export { default as OutOfStock, OutOfStockTitle, OutOfStockMessage, } from './organisms/OutOfStock';
76
- export type { OutOfStockProps, OutOfStockMessageProps, OutOfStockTitleProps, } from './organisms/OutOfStock';
77
- export { default as Hero, HeroHeading, HeroImage } from './organisms/Hero';
78
- export type { HeroProps, HeroHeadingProps, HeroImageProps, } from './organisms/Hero';
79
- export { default as useSlider } from './hooks/useSlider';
80
- export type { UseSliderArgs, SliderState, SliderDispatch, SlideDirection, } from './hooks/useSlider';
1
+ export { default as Link } from './atoms/Link';
2
+ export type { LinkProps } from './atoms/Link';
3
+ export { default as Button } from './atoms/Button';
4
+ export type { ButtonProps } from './atoms/Button';
5
+ export { default as Input } from './atoms/Input';
6
+ export type { InputProps } from './atoms/Input';
7
+ export { default as Icon } from './atoms/Icon';
8
+ export type { IconProps } from './atoms/Icon';
9
+ export { default as Popover } from './atoms/Popover';
10
+ export type { PopoverProps } from './atoms/Popover';
11
+ export { default as Price } from './atoms/Price';
12
+ export type { PriceProps } from './atoms/Price';
13
+ export { default as TextArea } from './atoms/TextArea';
14
+ export type { TextAreaProps } from './atoms/TextArea';
15
+ export { default as Checkbox } from './atoms/Checkbox';
16
+ export type { CheckboxProps } from './atoms/Checkbox';
17
+ export { default as Overlay } from './atoms/Overlay';
18
+ export type { OverlayProps } from './atoms/Overlay';
19
+ export { default as Select } from './atoms/Select';
20
+ export type { SelectProps } from './atoms/Select';
21
+ export { default as Radio } from './atoms/Radio';
22
+ export type { RadioProps } from './atoms/Radio';
23
+ export { default as Badge } from './atoms/Badge';
24
+ export type { BadgeProps } from './atoms/Badge';
25
+ export { default as Slider } from './atoms/Slider';
26
+ export type { SliderProps } from './atoms/Slider';
27
+ export { default as List } from './atoms/List';
28
+ export type { ListProps } from './atoms/List';
29
+ export { default as Skeleton } from './atoms/Skeleton';
30
+ export type { SkeletonProps } from './atoms/Skeleton';
31
+ export { default as Spinner } from './atoms/Spinner';
32
+ export type { SpinnerProps } from './atoms/Spinner';
33
+ export { default as Label } from './atoms/Label';
34
+ export type { LabelProps } from './atoms/Label';
35
+ export { default as Incentive } from './atoms/Incentive';
36
+ export type { IncentiveProps } from './atoms/Incentive';
37
+ export { default as ProductCard, ProductCardImage, ProductCardContent, ProductCardActions, } from './molecules/ProductCard';
38
+ export type { ProductCardProps, ProductCardImageProps, ProductCardContentProps, ProductCardActionsProps, } from './molecules/ProductCard';
39
+ export { default as Card, CardImage, CardContent, CardActions, } from './molecules/Card';
40
+ export type { CardProps, CardImageProps, CardContentProps, CardActionsProps, } from './molecules/Card';
41
+ export { default as Bullets } from './molecules/Bullets';
42
+ export type { BulletsProps } from './molecules/Bullets';
43
+ export { default as SearchInput } from './molecules/SearchInput';
44
+ export type { SearchInputProps, SearchInputRef } from './molecules/SearchInput';
45
+ export { default as Carousel } from './molecules/Carousel';
46
+ export type { CarouselProps } from './molecules/Carousel';
47
+ export { default as IconButton } from './molecules/IconButton';
48
+ export type { IconButtonProps } from './molecules/IconButton';
49
+ export { default as Modal } from './molecules/Modal';
50
+ export type { ModalProps } from './molecules/Modal';
51
+ export { default as Banner, BannerContent, BannerImage, BannerLink, } from './molecules/Banner';
52
+ export type { BannerProps, BannerContentProps, BannerImageProps, BannerLinkProps, } from './molecules/Banner';
53
+ export { default as PaymentMethods } from './molecules/PaymentMethods';
54
+ export type { PaymentMethodsProps } from './molecules/PaymentMethods';
55
+ export { default as Breadcrumb } from './molecules/Breadcrumb';
56
+ export type { BreadcrumbProps } from './molecules/Breadcrumb';
57
+ export { default as LoadingButton } from './molecules/LoadingButton';
58
+ export type { LoadingButtonProps } from './molecules/LoadingButton';
59
+ export { default as PriceRange } from './molecules/PriceRange';
60
+ export type { PriceRangeProps } from './molecules/PriceRange';
61
+ export { default as RadioGroup, RadioOption } from './molecules/RadioGroup';
62
+ export type { RadioGroupProps, RadioOptionProps } from './molecules/RadioGroup';
63
+ export { default as Accordion, AccordionItem, AccordionButton, AccordionPanel, } from './molecules/Accordion';
64
+ export type { AccordionProps, AccordionItemProps, AccordionButtonProps, AccordionPanelProps, } from './molecules/Accordion';
65
+ export { Table, TableBody, TableCell, TableFooter, TableHead, TableRow, } from './molecules/Table';
66
+ export type { TableProps, TableBodyProps, TableCellProps, TableFooterProps, TableHeadProps, TableRowProps, } from './molecules/Table';
67
+ export { default as Form } from './molecules/Form';
68
+ export type { FormProps } from './molecules/Form';
69
+ export { default as Alert } from './molecules/Alert';
70
+ export type { AlertProps } from './molecules/Alert';
71
+ export { default as QuantitySelector } from './molecules/QuantitySelector';
72
+ export type { QuantitySelectorProps } from './molecules/QuantitySelector';
73
+ export { default as Dropdown, DropdownButton, DropdownItem, DropdownMenu, } from './molecules/Dropdown';
74
+ export type { DropdownProps, DropdownButtonProps, DropdownItemProps, DropdownMenuProps, } from './molecules/Dropdown';
75
+ export { default as OutOfStock, OutOfStockTitle, OutOfStockMessage, } from './organisms/OutOfStock';
76
+ export type { OutOfStockProps, OutOfStockMessageProps, OutOfStockTitleProps, } from './organisms/OutOfStock';
77
+ export { default as Hero, HeroHeading, HeroImage } from './organisms/Hero';
78
+ export type { HeroProps, HeroHeadingProps, HeroImageProps, } from './organisms/Hero';
79
+ export { default as useSlider } from './hooks/useSlider';
80
+ export type { UseSliderArgs, SliderState, SliderDispatch, SlideDirection, } from './hooks/useSlider';
package/dist/index.js CHANGED
@@ -1,8 +1,45 @@
1
-
2
- 'use strict'
3
-
4
- if (process.env.NODE_ENV === 'production') {
5
- module.exports = require('./ui.cjs.production.min.js')
6
- } else {
7
- module.exports = require('./ui.cjs.development.js')
8
- }
1
+ // Atoms
2
+ export { default as Link } from './atoms/Link';
3
+ export { default as Button } from './atoms/Button';
4
+ export { default as Input } from './atoms/Input';
5
+ export { default as Icon } from './atoms/Icon';
6
+ export { default as Popover } from './atoms/Popover';
7
+ export { default as Price } from './atoms/Price';
8
+ export { default as TextArea } from './atoms/TextArea';
9
+ export { default as Checkbox } from './atoms/Checkbox';
10
+ export { default as Overlay } from './atoms/Overlay';
11
+ export { default as Select } from './atoms/Select';
12
+ export { default as Radio } from './atoms/Radio';
13
+ export { default as Badge } from './atoms/Badge';
14
+ export { default as Slider } from './atoms/Slider';
15
+ export { default as List } from './atoms/List';
16
+ export { default as Skeleton } from './atoms/Skeleton';
17
+ export { default as Spinner } from './atoms/Spinner';
18
+ export { default as Label } from './atoms/Label';
19
+ export { default as Incentive } from './atoms/Incentive';
20
+ // Molecules
21
+ export { default as ProductCard, ProductCardImage, ProductCardContent, ProductCardActions, } from './molecules/ProductCard';
22
+ export { default as Card, CardImage, CardContent, CardActions, } from './molecules/Card';
23
+ export { default as Bullets } from './molecules/Bullets';
24
+ export { default as SearchInput } from './molecules/SearchInput';
25
+ export { default as Carousel } from './molecules/Carousel';
26
+ export { default as IconButton } from './molecules/IconButton';
27
+ export { default as Modal } from './molecules/Modal';
28
+ export { default as Banner, BannerContent, BannerImage, BannerLink, } from './molecules/Banner';
29
+ export { default as PaymentMethods } from './molecules/PaymentMethods';
30
+ export { default as Breadcrumb } from './molecules/Breadcrumb';
31
+ export { default as LoadingButton } from './molecules/LoadingButton';
32
+ export { default as PriceRange } from './molecules/PriceRange';
33
+ export { default as RadioGroup, RadioOption } from './molecules/RadioGroup';
34
+ export { default as Accordion, AccordionItem, AccordionButton, AccordionPanel, } from './molecules/Accordion';
35
+ export { Table, TableBody, TableCell, TableFooter, TableHead, TableRow, } from './molecules/Table';
36
+ export { default as Form } from './molecules/Form';
37
+ export { default as Alert } from './molecules/Alert';
38
+ export { default as QuantitySelector } from './molecules/QuantitySelector';
39
+ export { default as Dropdown, DropdownButton, DropdownItem, DropdownMenu, } from './molecules/Dropdown';
40
+ // Organisms
41
+ export { default as OutOfStock, OutOfStockTitle, OutOfStockMessage, } from './organisms/OutOfStock';
42
+ export { default as Hero, HeroHeading, HeroImage } from './organisms/Hero';
43
+ // Hooks
44
+ export { default as useSlider } from './hooks/useSlider';
45
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,QAAQ;AACR,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,cAAc,CAAA;AAG9C,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAGlD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAA;AAGhD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,cAAc,CAAA;AAG9C,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAGpD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAA;AAGhD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAGtD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAGtD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAGpD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAGlD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAA;AAGhD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAA;AAGhD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAGlD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,cAAc,CAAA;AAG9C,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAGtD,OAAO,EAAE,OAAO,IAAI,OAAO,E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ACL,SAAS,EACT,SAAS,EACT,WAAW,EACX,SAAS,EACT,QAAQ,GACT,MAAM,mBAAmB,CAAA;AAU1B,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAGlD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAGpD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAG1E,OAAO,EACL,OAAO,IAAI,QAAQ,EACnB,cAAc,EACd,YAAY,EACZ,YAAY,GACb,MAAM,sBAAsB,CAAA;AAQ7B,YAAY;AACZ,OAAO,EACL,OAAO,IAAI,UAAU,EACrB,eAAe,EACf,iBAAiB,GAClB,MAAM,wBAAwB,CAAA;AAO/B,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAO1E,QAAQ;AACR,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAA"}
@@ -1,26 +1,26 @@
1
- import type { HTMLAttributes } from 'react';
2
- import React from 'react';
3
- interface AccordionContext {
4
- indices: Set<number>;
5
- onChange: (index: number) => void;
6
- numberOfItems: number;
7
- }
8
- declare const AccordionContext: React.Context<AccordionContext | undefined>;
9
- export interface AccordionProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
10
- /**
11
- * ID to find this component in testing tools (e.g.: cypress,
12
- * testing-library, and jest).
13
- */
14
- testId?: string;
15
- /**
16
- * Indices that indicate which accordion items are opened.
17
- */
18
- indices: Iterable<number>;
19
- /**
20
- * Function that is triggered when an accordion item is opened/closed.
21
- */
22
- onChange: (index: number) => void;
23
- }
24
- declare const Accordion: React.ForwardRefExoticComponent<AccordionProps & React.RefAttributes<HTMLDivElement>>;
25
- export declare function useAccordion(): AccordionContext;
26
- export default Accordion;
1
+ import type { HTMLAttributes } from 'react';
2
+ import React from 'react';
3
+ interface AccordionContext {
4
+ indices: Set<number>;
5
+ onChange: (index: number) => void;
6
+ numberOfItems: number;
7
+ }
8
+ declare const AccordionContext: React.Context<AccordionContext | undefined>;
9
+ export interface AccordionProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
10
+ /**
11
+ * ID to find this component in testing tools (e.g.: cypress,
12
+ * testing-library, and jest).
13
+ */
14
+ testId?: string;
15
+ /**
16
+ * Indices that indicate which accordion items are opened.
17
+ */
18
+ indices: Iterable<number>;
19
+ /**
20
+ * Function that is triggered when an accordion item is opened/closed.
21
+ */
22
+ onChange: (index: number) => void;
23
+ }
24
+ declare const Accordion: React.ForwardRefExoticComponent<AccordionProps & React.RefAttributes<HTMLDivElement>>;
25
+ export declare function useAccordion(): AccordionContext;
26
+ export default Accordion;
@@ -0,0 +1,21 @@
1
+ import React, { useContext, cloneElement, forwardRef, createContext, } from 'react';
2
+ const AccordionContext = createContext(undefined);
3
+ const Accordion = forwardRef(function Accordion({ testId = 'store-accordion', indices, onChange, children, ...otherProps }, ref) {
4
+ const childrenWithIndex = React.Children.map(children, (child, index) => cloneElement(child, { index: child.props.index ?? index }));
5
+ const context = {
6
+ indices: new Set(indices),
7
+ onChange,
8
+ numberOfItems: childrenWithIndex.length,
9
+ };
10
+ return (React.createElement(AccordionContext.Provider, { value: context },
11
+ React.createElement("div", Object.assign({ ref: ref, "data-store-accordion": true, "data-testid": testId, role: "region" }, otherProps), childrenWithIndex)));
12
+ });
13
+ export function useAccordion() {
14
+ const context = useContext(AccordionContext);
15
+ if (context === undefined) {
16
+ throw new Error('Do not use Accordion components outside the Accordion context.');
17
+ }
18
+ return context;
19
+ }
20
+ export default Accordion;
21
+ //# sourceMappingURL=Accordion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Accordion.js","sourceRoot":"","sources":["../../../src/molecules/Accordion/Accordion.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EACZ,UAAU,EACV,YAAY,EACZ,UAAU,EACV,aAAa,GACd,MAAM,OAAO,CAAA;AAQd,MAAM,gBAAgB,GAAG,aAAa,CAA+B,SAAS,CAAC,CAAA;AAmB/E,MAAM,SAAS,GAAG,UAAU,CAAiC,SAAS,SAAS,CAC7E,EAAE,MAAM,GAAG,iBAAiB,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,EAC1E,GAAG;IAEH,MAAM,iBAAiB,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAC1C,QAAwB,EACxB,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,EAAE,CAAC,CAC7E,CAAA;IAED,MAAM,OAAO,GAAG;QACd,OAAO,EAAE,IAAI,GAAG,CAAC,OAAO,CAAC;QACzB,QAAQ;QACR,aAAa,EAAE,iBAAiB,CAAC,MAAM;KACxC,CAAA;IAED,OAAO,CACL,oBAAC,gBAAgB,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO;QACvC,2CACE,GAAG,EAAE,GAAG,+CAEK,MAAM,EACnB,IAAI,EAAC,QAAQ,IACT,UAAU,GAEb,iBAAiB,CACd,CACoB,CAC7B,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,MAAM,UAAU,YAAY;IAC1B,MAAM,OAAO,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAA;IAE5C,IAAI,OAAO,KAAK,SAAS,EAAE;QACzB,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAA;KACF;IAED,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,eAAe,SAAS,CAAA"}
@@ -1,10 +1,10 @@
1
- import type { ButtonHTMLAttributes } from 'react';
2
- import React from 'react';
3
- export interface AccordionButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
4
- /**
5
- * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
6
- */
7
- testId?: string;
8
- }
9
- declare const AccordionButton: React.ForwardRefExoticComponent<AccordionButtonProps & React.RefAttributes<HTMLButtonElement>>;
10
- export default AccordionButton;
1
+ import type { ButtonHTMLAttributes } from 'react';
2
+ import React from 'react';
3
+ export interface AccordionButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
4
+ /**
5
+ * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
6
+ */
7
+ testId?: string;
8
+ }
9
+ declare const AccordionButton: React.ForwardRefExoticComponent<AccordionButtonProps & React.RefAttributes<HTMLButtonElement>>;
10
+ export default AccordionButton;
@@ -0,0 +1,37 @@
1
+ import React, { forwardRef } from 'react';
2
+ import Button from '../../atoms/Button';
3
+ import { useAccordion } from './Accordion';
4
+ import { useAccordionItem } from './AccordionItem';
5
+ const AccordionButton = forwardRef(function AccordionButton({ testId = 'store-accordion-button', children, ...otherProps }, ref) {
6
+ const { indices, onChange, numberOfItems } = useAccordion();
7
+ const { index, panel, button, prefixId } = useAccordionItem();
8
+ const onKeyDown = (event) => {
9
+ if (!['ArrowDown', 'ArrowUp'].includes(event.key)) {
10
+ return;
11
+ }
12
+ const getNext = () => {
13
+ const next = Number(index) + 1 === numberOfItems ? 0 : Number(index) + 1;
14
+ return document.getElementById(`${prefixId && `${prefixId}-`}button--${next}`);
15
+ };
16
+ const getPrevious = () => {
17
+ const previous = Number(index) - 1 < 0 ? numberOfItems - 1 : Number(index) - 1;
18
+ return document.getElementById(`${prefixId && `${prefixId}-`}button--${previous}`);
19
+ };
20
+ switch (event.key) {
21
+ case 'ArrowDown':
22
+ event.preventDefault();
23
+ getNext()?.focus();
24
+ break;
25
+ case 'ArrowUp':
26
+ event.preventDefault();
27
+ getPrevious()?.focus();
28
+ break;
29
+ default:
30
+ }
31
+ };
32
+ return (React.createElement(Button, Object.assign({ ref: ref, id: button, "aria-expanded": indices.has(index), "aria-controls": panel, "data-accordion-button": true, "data-testid": testId, onKeyDown: onKeyDown, onClick: () => {
33
+ onChange(index);
34
+ } }, otherProps), children));
35
+ });
36
+ export default AccordionButton;
37
+ //# sourceMappingURL=AccordionButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccordionButton.js","sourceRoot":"","sources":["../../../src/molecules/Accordion/AccordionButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,MAAM,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAUlD,MAAM,eAAe,GAAG,UAAU,CAChC,SAAS,eAAe,CACtB,EAAE,MAAM,GAAG,wBAAwB,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,EAC9D,GAAG;IAEH,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,GAAG,YAAY,EAAE,CAAA;IAC3D,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,gBAAgB,EAAE,CAAA;IAE7D,MAAM,SAAS,GAAG,CAAC,KAA0B,EAAE,EAAE;QAC/C,IAAI,CAAC,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;YACjD,OAAM;SACP;QAED,MAAM,OAAO,GAAG,GAAG,EAAE;YACnB,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAExE,OAAO,QAAQ,CAAC,cAAc,CAC5B,GAAG,QAAQ,IAAI,GAAG,QAAQ,GAAG,WAAW,IAAI,EAAE,CAC/C,CAAA;QACH,CAAC,CAAA;QAED,MAAM,WAAW,GAAG,GAAG,EAAE;YACvB,MAAM,QAAQ,GACZ,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,GAA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