@faststore/ui 1.9.8 → 1.9.11

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 (435) hide show
  1. package/CHANGELOG.md +742 -2289
  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 +45 -37
  100. package/dist/atoms/Slider/Slider.js +30 -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 +16 -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 +6 -11
  382. package/src/atoms/Slider/Slider.test.tsx +13 -2
  383. package/src/atoms/Slider/Slider.tsx +50 -55
  384. package/src/molecules/AggregateRating/stories/AggregateRating.stories.tsx +2 -3
  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/PriceRange/PriceRange.test.tsx +8 -2
  389. package/src/molecules/PriceRange/PriceRange.tsx +12 -20
  390. package/src/typings/PolymorphicGenerics.ts +2 -3
  391. package/dist/atoms/Badge/stories/Badge.stories.d.ts +0 -17
  392. package/dist/atoms/Button/stories/Button.stories.d.ts +0 -14
  393. package/dist/atoms/Checkbox/stories/Checkbox.stories.d.ts +0 -4
  394. package/dist/atoms/Icon/stories/Icon.stories.d.ts +0 -14
  395. package/dist/atoms/Incentive/stories/Incentive.stories.d.ts +0 -4
  396. package/dist/atoms/Input/stories/Input.stories.d.ts +0 -14
  397. package/dist/atoms/Label/stories/Label.stories.d.ts +0 -14
  398. package/dist/atoms/List/stories/List.stories.d.ts +0 -22
  399. package/dist/atoms/Overlay/stories/Overlay.stories.d.ts +0 -8
  400. package/dist/atoms/Popover/stories/Popover.stories.d.ts +0 -14
  401. package/dist/atoms/Price/stories/Price.stories.d.ts +0 -18
  402. package/dist/atoms/Radio/stories/Radio.stories.d.ts +0 -4
  403. package/dist/atoms/Select/stories/Select.stories.d.ts +0 -20
  404. package/dist/atoms/Skeleton/stories/Skeleton.stories.d.ts +0 -12
  405. package/dist/atoms/Slider/stories/Slider.stories.d.ts +0 -4
  406. package/dist/atoms/Spinner/stories/Spinner.stories.d.ts +0 -12
  407. package/dist/atoms/TextArea/stories/TextArea.stories.d.ts +0 -4
  408. package/dist/molecules/Accordion/stories/Accordion.stories.d.ts +0 -14
  409. package/dist/molecules/AggregateRating/stories/AggregateRating.stories.d.ts +0 -16
  410. package/dist/molecules/Alert/stories/Alert.stories.d.ts +0 -5
  411. package/dist/molecules/Banner/stories/Banner.stories.d.ts +0 -4
  412. package/dist/molecules/Breadcrumb/stories/Breadcrumb.stories.d.ts +0 -15
  413. package/dist/molecules/Bullets/stories/Bullets.stories.d.ts +0 -15
  414. package/dist/molecules/Card/stories/Card.stories.d.ts +0 -4
  415. package/dist/molecules/Carousel/stories/Carousel.stories.d.ts +0 -18
  416. package/dist/molecules/Dropdown/stories/Dropdown.stories.d.ts +0 -7
  417. package/dist/molecules/Form/stories/Form.stories.d.ts +0 -12
  418. package/dist/molecules/IconButton/stories/IconButton.stories.d.ts +0 -5
  419. package/dist/molecules/LoadingButton/stories/LoadingButton.stories.d.ts +0 -14
  420. package/dist/molecules/Modal/stories/Modal.stories.d.ts +0 -5
  421. package/dist/molecules/PaymentMethods/stories/PaymentMethods.stories.d.ts +0 -4
  422. package/dist/molecules/PriceRange/stories/PriceRange.stories.d.ts +0 -4
  423. package/dist/molecules/ProductCard/stories/ProductCard.stories.d.ts +0 -4
  424. package/dist/molecules/QuantitySelector/stories/QuantitySelector.stories.d.ts +0 -5
  425. package/dist/molecules/RadioGroup/stories/RadioGroup.stories.d.ts +0 -15
  426. package/dist/molecules/SearchInput/stories/SearchInput.stories.d.ts +0 -15
  427. package/dist/molecules/Table/stories/Table.stories.d.ts +0 -12
  428. package/dist/organisms/Hero/stories/Hero.stories.d.ts +0 -4
  429. package/dist/organisms/OutOfStock/stories/OutOfStock.stories.d.ts +0 -10
  430. package/dist/ui.cjs.development.js +0 -2109
  431. package/dist/ui.cjs.development.js.map +0 -1
  432. package/dist/ui.cjs.production.min.js +0 -2
  433. package/dist/ui.cjs.production.min.js.map +0 -1
  434. package/dist/ui.esm.js +0 -2037
  435. package/dist/ui.esm.js.map +0 -1
@@ -1,2109 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
-
7
- var React = require('react');
8
- var React__default = _interopDefault(React);
9
- var ReachPopover = require('@reach/popover');
10
- var ReachPopover__default = _interopDefault(ReachPopover);
11
- var reactSwipeable = require('react-swipeable');
12
- var reactDom = require('react-dom');
13
- var tabbable = require('tabbable');
14
-
15
- const Link = /*#__PURE__*/React.forwardRef(function Link({
16
- as,
17
- children,
18
- testId = 'store-link',
19
- ...otherProps
20
- }, ref) {
21
- const Component = as != null ? as : 'a';
22
- return React__default.createElement(Component, Object.assign({
23
- ref: ref,
24
- "data-store-link": true,
25
- "data-testid": testId
26
- }, otherProps), children);
27
- });
28
-
29
- const Button = /*#__PURE__*/React.forwardRef(function Button({
30
- children,
31
- testId = 'store-button',
32
- ...otherProps
33
- }, ref) {
34
- return React__default.createElement("button", Object.assign({
35
- ref: ref,
36
- "data-store-button": true,
37
- "data-testid": testId
38
- }, otherProps), children);
39
- });
40
-
41
- const Input = /*#__PURE__*/React.forwardRef(function Input({
42
- variant,
43
- testId = 'store-input',
44
- ...otherProps
45
- }, ref) {
46
- const variants = {
47
- 'data-error': variant === 'error' || undefined,
48
- 'data-success': variant === 'success' || undefined
49
- };
50
- return React__default.createElement("input", Object.assign({
51
- ref: ref,
52
- "data-store-input": true,
53
- "data-testid": testId
54
- }, variants, otherProps));
55
- });
56
-
57
- const Icon = /*#__PURE__*/React.forwardRef(function Button({
58
- component,
59
- testId = 'store-icon',
60
- ...otherProps
61
- }, ref) {
62
- return React__default.createElement("span", Object.assign({
63
- ref: ref,
64
- "data-store-icon": true,
65
- "data-testid": testId
66
- }, otherProps), component);
67
- });
68
-
69
- const Popover = ({
70
- targetRef,
71
- testId = 'store-popover',
72
- children,
73
- ...otherProps
74
- }) => {
75
- return React__default.createElement(ReachPopover__default, Object.assign({
76
- "data-store-popover": true,
77
- "data-testid": testId,
78
- position: ReachPopover.positionDefault,
79
- targetRef: targetRef
80
- }, otherProps), children);
81
- };
82
-
83
- const Price = /*#__PURE__*/React.forwardRef(function Price({
84
- as: Component = 'span',
85
- testId = 'store-price',
86
- value,
87
- formatter = price => price,
88
- variant = 'selling',
89
- ...otherProps
90
- }, ref) {
91
- const formattedPrice = formatter(value, variant);
92
- return React__default.createElement(Component, Object.assign({
93
- ref: ref,
94
- "data-store-price": true,
95
- "data-testid": testId,
96
- "data-variant": variant
97
- }, otherProps), formattedPrice);
98
- });
99
-
100
- const TextArea = /*#__PURE__*/React.forwardRef(function TextArea({
101
- variant,
102
- testId = 'store-textarea',
103
- ...otherProps
104
- }, ref) {
105
- const variants = {
106
- 'data-success': variant === 'success' || undefined,
107
- 'data-error': variant === 'error' || undefined
108
- };
109
- return React__default.createElement("textarea", Object.assign({
110
- ref: ref,
111
- "data-store-textarea": true,
112
- "data-testid": testId
113
- }, variants, otherProps));
114
- });
115
-
116
- const Checkbox = /*#__PURE__*/React.forwardRef(function Checkbox({
117
- testId = 'store-checkbox',
118
- ...otherProps
119
- }, ref) {
120
- return React__default.createElement("input", Object.assign({
121
- ref: ref,
122
- "data-store-checkbox": true,
123
- "data-testid": testId,
124
- type: "checkbox"
125
- }, otherProps));
126
- });
127
-
128
- const Overlay = /*#__PURE__*/React.forwardRef(function Overlay({
129
- testId = 'store-overlay',
130
- ...otherProps
131
- }, ref) {
132
- return React__default.createElement("div", Object.assign({
133
- role: "presentation",
134
- "data-store-overlay": true,
135
- "data-testid": testId,
136
- ref: ref
137
- }, otherProps));
138
- });
139
-
140
- const Select = /*#__PURE__*/React.forwardRef(function Select({
141
- children,
142
- testId = 'store-select',
143
- ...otherProps
144
- }, ref) {
145
- return React__default.createElement("select", Object.assign({
146
- ref: ref,
147
- "data-store-select": true,
148
- "data-testid": testId
149
- }, otherProps), children);
150
- });
151
-
152
- const Radio = /*#__PURE__*/React.forwardRef(function Radio({
153
- testId = 'store-radio',
154
- ...otherProps
155
- }, ref) {
156
- return React__default.createElement("input", Object.assign({
157
- ref: ref,
158
- "data-store-radio": true,
159
- "data-testid": testId,
160
- type: "radio"
161
- }, otherProps));
162
- });
163
-
164
- const Badge = /*#__PURE__*/React.forwardRef(function Badge({
165
- testId = 'store-badge',
166
- children,
167
- ...otherProps
168
- }, ref) {
169
- return React__default.createElement("div", Object.assign({
170
- ref: ref,
171
- "data-store-badge": true,
172
- "data-testid": testId
173
- }, otherProps), children);
174
- });
175
-
176
- /**
177
- * This code is inspired by the work of [sandra-lewis](https://codesandbox.io/u/sandra-lewis)
178
- */
179
-
180
- const Slider = ({
181
- min,
182
- max,
183
- onChange,
184
- testId = 'store-slider',
185
- getAriaValueText,
186
- className
187
- }) => {
188
- const [minVal, setMinVal] = React.useState(min);
189
- const [maxVal, setMaxVal] = React.useState(max);
190
- const minValRef = React.useRef(min);
191
- const maxValRef = React.useRef(max);
192
- const range = React.useRef(null);
193
- const getPercent = React.useCallback(value => Math.round((value - min) / (max - min) * 100), [min, max]); // width of the range to reduce from the left side
194
-
195
- React.useEffect(() => {
196
- const minPercent = getPercent(minVal);
197
- const maxPercent = getPercent(maxValRef.current);
198
-
199
- if (range.current) {
200
- range.current.style.left = `${minPercent}%`;
201
- range.current.style.width = `${maxPercent - minPercent}%`;
202
- }
203
- }, [minVal, getPercent]); // width of the range to reduce from the right side
204
-
205
- React.useEffect(() => {
206
- const minPercent = getPercent(minValRef.current);
207
- const maxPercent = getPercent(maxVal);
208
-
209
- if (range.current) {
210
- range.current.style.width = `${maxPercent - minPercent}%`;
211
- }
212
- }, [maxVal, getPercent]);
213
- React.useEffect(() => {
214
- onChange == null ? void 0 : onChange({
215
- min: minVal,
216
- max: maxVal
217
- });
218
- }, [minVal, maxVal, onChange]);
219
- return React__default.createElement("div", {
220
- "data-store-slider": true,
221
- "data-testid": testId,
222
- className: className
223
- }, React__default.createElement("div", {
224
- ref: range,
225
- "data-slider-range": true
226
- }), React__default.createElement("input", {
227
- type: "range",
228
- min: min,
229
- max: max,
230
- value: minVal,
231
- onChange: event => {
232
- const value = Math.min(Number(event.target.value), maxVal - 1);
233
- setMinVal(value);
234
- minValRef.current = value;
235
- },
236
- "data-slider-thumb": "left",
237
- "aria-valuemin": min,
238
- "aria-valuemax": max,
239
- "aria-valuenow": minVal,
240
- "aria-label": String(minVal),
241
- "aria-labelledby": getAriaValueText ? getAriaValueText(minVal, 'min') : undefined
242
- }), React__default.createElement("input", {
243
- type: "range",
244
- min: min,
245
- max: max,
246
- value: maxVal,
247
- onChange: event => {
248
- const value = Math.max(Number(event.target.value), minVal + 1);
249
- setMaxVal(value);
250
- maxValRef.current = value;
251
- },
252
- "data-slider-thumb": "right",
253
- "aria-valuemin": min,
254
- "aria-valuemax": max,
255
- "aria-valuenow": maxVal,
256
- "aria-label": String(maxVal),
257
- "aria-labelledby": getAriaValueText ? getAriaValueText(maxVal, 'max') : undefined
258
- }));
259
- };
260
-
261
- const variantToElement = {
262
- description: 'dl',
263
- unordered: 'ul',
264
- ordered: 'ol'
265
- };
266
- const List = /*#__PURE__*/React.forwardRef(function List({
267
- testId = 'store-list',
268
- variant = 'unordered',
269
- as: MaybeComponent,
270
- ...otherProps
271
- }, ref) {
272
- var _ref;
273
-
274
- const dataAttributes = {
275
- 'data-testid': testId,
276
- 'data-store-list': variant
277
- };
278
- const Component = (_ref = MaybeComponent != null ? MaybeComponent : variantToElement[variant]) != null ? _ref : 'ul';
279
- return React__default.createElement(Component, Object.assign({
280
- ref: ref
281
- }, dataAttributes, otherProps));
282
- });
283
-
284
- const Skeleton = /*#__PURE__*/React.forwardRef(function Skeleton({
285
- testId = 'store-skeleton',
286
- ...otherProps
287
- }, ref) {
288
- return React__default.createElement("div", Object.assign({
289
- ref: ref,
290
- "data-store-skeleton": true,
291
- "data-testid": testId
292
- }, otherProps));
293
- });
294
-
295
- const Spinner = /*#__PURE__*/React.forwardRef(function Spinner({
296
- children,
297
- testId = 'store-spinner',
298
- ...otherProps
299
- }, ref) {
300
- return React__default.createElement("span", Object.assign({
301
- ref: ref,
302
- "data-store-spinner": true,
303
- "data-testid": testId
304
- }, otherProps));
305
- });
306
-
307
- const Label = /*#__PURE__*/React.forwardRef(function Label({
308
- testId = 'store-label',
309
- children,
310
- ...otherProps
311
- }, ref) {
312
- return React__default.createElement("label", Object.assign({
313
- ref: ref,
314
- "data-store-label": true,
315
- "data-testid": testId
316
- }, otherProps), children);
317
- });
318
-
319
- const Incentive = /*#__PURE__*/React.forwardRef(function Incentive({
320
- testId = 'store-incentive',
321
- children,
322
- ...otherProps
323
- }, ref) {
324
- return React__default.createElement("div", Object.assign({
325
- ref: ref,
326
- "data-store-incentive": true,
327
- "data-testid": testId
328
- }, otherProps), children);
329
- });
330
-
331
- const ProductCard = /*#__PURE__*/React.forwardRef(function Card({
332
- testId = 'store-product-card',
333
- children,
334
- ...otherProps
335
- }, ref) {
336
- return React__default.createElement("article", Object.assign({
337
- ref: ref,
338
- "data-store-product-card": true,
339
- "data-testid": testId
340
- }, otherProps), children);
341
- });
342
-
343
- const ProductCardImage = /*#__PURE__*/React.forwardRef(function ProductCardImage({
344
- testId = 'store-product-card-image',
345
- children,
346
- ...otherProps
347
- }, ref) {
348
- return React__default.createElement("div", Object.assign({
349
- ref: ref,
350
- "data-product-card-image": true,
351
- "data-testid": testId
352
- }, otherProps), children);
353
- });
354
-
355
- const ProductCardContent = /*#__PURE__*/React.forwardRef(function CardContent({
356
- testId = 'store-product-card-content',
357
- children,
358
- ...otherProps
359
- }, ref) {
360
- return React__default.createElement("section", Object.assign({
361
- ref: ref,
362
- "data-product-card-content": true,
363
- "data-testid": testId
364
- }, otherProps), children);
365
- });
366
-
367
- const ProductCardActions = /*#__PURE__*/React.forwardRef(function CardActions({
368
- testId = 'store-product-card-actions',
369
- children,
370
- ...otherProps
371
- }, ref) {
372
- return React__default.createElement("div", Object.assign({
373
- ref: ref,
374
- "data-product-card-actions": true,
375
- "data-testid": testId
376
- }, otherProps), children);
377
- });
378
-
379
- const Card = /*#__PURE__*/React.forwardRef(function Card({
380
- testId = 'store-card',
381
- children,
382
- ...otherProps
383
- }, ref) {
384
- return React__default.createElement("article", Object.assign({
385
- ref: ref,
386
- "data-store-card": true,
387
- "data-testid": testId
388
- }, otherProps), children);
389
- });
390
-
391
- const CardImage = /*#__PURE__*/React.forwardRef(function CardImage({
392
- testId = 'store-card-image',
393
- children,
394
- ...otherProps
395
- }, ref) {
396
- return React__default.createElement("div", Object.assign({
397
- ref: ref,
398
- "data-card-image": true,
399
- "data-testid": testId
400
- }, otherProps), children);
401
- });
402
-
403
- const CardContent = /*#__PURE__*/React.forwardRef(function CardContent({
404
- testId = 'store-card-content',
405
- children,
406
- ...otherProps
407
- }, ref) {
408
- return React__default.createElement("section", Object.assign({
409
- ref: ref,
410
- "data-card-content": true,
411
- "data-testid": testId
412
- }, otherProps), children);
413
- });
414
-
415
- const CardActions = /*#__PURE__*/React.forwardRef(function CardActions({
416
- testId = 'store-card-actions',
417
- children,
418
- ...otherProps
419
- }, ref) {
420
- return React__default.createElement("div", Object.assign({
421
- ref: ref,
422
- "data-card-actions": true,
423
- "data-testid": testId
424
- }, otherProps), children);
425
- });
426
-
427
- const defaultAriaLabel = (idx, isActive) => isActive ? 'Current page' : `Go to page ${idx + 1}`;
428
-
429
- const Bullets = /*#__PURE__*/React.forwardRef(function Bullets({
430
- totalQuantity,
431
- activeBullet,
432
- onClick,
433
- testId = 'store-bullets',
434
- ariaLabelGenerator = defaultAriaLabel,
435
- ariaControlsGenerator,
436
- ...otherProps
437
- }, ref) {
438
- const bulletIndexes = React.useMemo(() => Array(totalQuantity).fill(0), [totalQuantity]);
439
- return React__default.createElement("div", Object.assign({
440
- ref: ref,
441
- "data-store-bullets": true,
442
- "data-testid": testId,
443
- role: "tablist"
444
- }, otherProps), bulletIndexes.map((_, idx) => {
445
- const isActive = activeBullet === idx;
446
- return React__default.createElement(Button, {
447
- "data-bullet-item": true,
448
- role: "tab",
449
- tabIndex: -1,
450
- key: idx,
451
- testId: `${testId}-item`,
452
- onClick: e => onClick(e, idx),
453
- "aria-label": ariaLabelGenerator(idx, isActive),
454
- "aria-controls": ariaControlsGenerator == null ? void 0 : ariaControlsGenerator(idx),
455
- "aria-selected": isActive
456
- });
457
- }));
458
- });
459
-
460
- const Form = /*#__PURE__*/React.forwardRef(function Form({
461
- testId = 'store-form',
462
- children,
463
- ...otherProps
464
- }, ref) {
465
- return React__default.createElement("form", Object.assign({
466
- ref: ref,
467
- "data-store-form": true,
468
- "data-testid": testId
469
- }, otherProps), children);
470
- });
471
-
472
- const SearchIcon = () => React__default.createElement("svg", {
473
- xmlns: "http://www.w3.org/2000/svg",
474
- width: "1em",
475
- height: "1em",
476
- viewBox: "0 0 24 24",
477
- fill: "none",
478
- stroke: "currentColor",
479
- strokeWidth: "2",
480
- strokeLinecap: "round",
481
- strokeLinejoin: "round"
482
- }, React__default.createElement("circle", {
483
- cx: "11",
484
- cy: "11",
485
- r: "8"
486
- }), React__default.createElement("line", {
487
- x1: "21",
488
- y1: "21",
489
- x2: "16.65",
490
- y2: "16.65"
491
- }));
492
-
493
- const SearchInput = /*#__PURE__*/React.forwardRef(function SearchInput({
494
- onSubmit,
495
- icon,
496
- 'aria-label': ariaLabel = 'search',
497
- testId = 'store-search-input',
498
- ...otherProps
499
- }, ref) {
500
- const inputRef = React.useRef(null);
501
- const formRef = React.useRef(null);
502
-
503
- const handleSubmit = event => {
504
- var _inputRef$current;
505
-
506
- event.preventDefault();
507
-
508
- if (((_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.value) !== '') {
509
- onSubmit(inputRef.current.value);
510
- }
511
- };
512
-
513
- React.useImperativeHandle(ref, () => ({
514
- inputRef: inputRef.current,
515
- formRef: formRef.current
516
- }));
517
- return React__default.createElement(Form, {
518
- ref: formRef,
519
- "data-store-search-input": true,
520
- "data-testid": testId,
521
- onSubmit: handleSubmit,
522
- role: "search"
523
- }, React__default.createElement(Input, Object.assign({
524
- ref: inputRef,
525
- "aria-label": ariaLabel
526
- }, otherProps)), React__default.createElement(Button, {
527
- type: "submit",
528
- "aria-label": "Submit Search"
529
- }, React__default.createElement(Icon, {
530
- component: icon != null ? icon : React__default.createElement(SearchIcon, null)
531
- })));
532
- });
533
-
534
- const LeftArrowIcon = ({
535
- size = {
536
- width: 25,
537
- height: 25
538
- },
539
- viewBox = '0 0 16 16',
540
- color = 'currentColor'
541
- }) => React__default.createElement("svg", {
542
- xmlns: "http://www.w3.org/2000/svg",
543
- xmlnsXlink: "http://www.w3.org/1999/xlink",
544
- viewBox: viewBox,
545
- width: size.width,
546
- height: size.height
547
- }, React__default.createElement("path", {
548
- d: "M11 1L4 8L11 15",
549
- strokeWidth: "2",
550
- strokeMiterlimit: "10",
551
- strokeLinecap: "round",
552
- strokeLinejoin: "round",
553
- stroke: color,
554
- fill: "none"
555
- }));
556
- const RightArrowIcon = ({
557
- size = {
558
- width: 25,
559
- height: 25
560
- },
561
- viewBox = '0 0 16 16',
562
- color = 'currentColor'
563
- }) => React__default.createElement("svg", {
564
- xmlns: "http://www.w3.org/2000/svg",
565
- xmlnsXlink: "http://www.w3.org/1999/xlink",
566
- viewBox: viewBox,
567
- width: size.width,
568
- height: size.height
569
- }, React__default.createElement("path", {
570
- d: "M5 15L12 8L5 1",
571
- strokeWidth: "2",
572
- strokeMiterlimit: "10",
573
- strokeLinecap: "round",
574
- strokeLinejoin: "round",
575
- stroke: color,
576
- fill: "none"
577
- }));
578
-
579
- const nextPage = (current, total) => (current + 1) % total;
580
- const previousPage = (current, total) => (total - (total - current + 1) % total) % total;
581
-
582
- function reducer(state, action) {
583
- switch (action.type) {
584
- case 'NEXT_PAGE':
585
- {
586
- // If `state.infinite` is true, we need to take into account an extra
587
- // page in the calculation. This extra page is a clone of the first page.
588
- const adjustedTotalPages = state.infinite ? state.totalPages + 1 : state.totalPages;
589
- const nextPageIndex = nextPage(state.currentPage, adjustedTotalPages);
590
- const nextItemIndex = nextPageIndex % adjustedTotalPages * state.itemsPerPage;
591
- return { ...state,
592
- sliding: true,
593
- slideDirection: 'next',
594
- currentItem: nextItemIndex,
595
- currentPage: nextPageIndex
596
- };
597
- }
598
-
599
- case 'PREVIOUS_PAGE':
600
- {
601
- // If `state.infinite` is true, we need to take into account an extra
602
- // page in the calculation. This extra page is a clone of the first page.
603
- const adjustedTotalPages = state.infinite ? state.totalPages + 1 : state.totalPages; // If `state.infinite` is true and we're currently on page 0, we need to
604
- // let the slider go to page -1. This -1 page is a clone of the last page.
605
-
606
- const shouldGoToClone = state.infinite && state.currentPage === 0;
607
- const previousPageIndex = shouldGoToClone ? -1 : previousPage(state.currentPage, state.totalPages);
608
- return { ...state,
609
- sliding: true,
610
- slideDirection: 'previous',
611
- currentItem: previousPageIndex % adjustedTotalPages * state.itemsPerPage,
612
- currentPage: previousPageIndex
613
- };
614
- }
615
-
616
- case 'GO_TO_PAGE':
617
- {
618
- if (action.payload.pageIndex === state.currentPage) {
619
- return state;
620
- }
621
-
622
- return { ...state,
623
- sliding: action.payload.shouldSlide,
624
- slideDirection: action.payload.pageIndex > state.currentPage ? 'next' : 'previous',
625
- currentItem: action.payload.pageIndex % state.totalPages * state.itemsPerPage,
626
- currentPage: action.payload.pageIndex
627
- };
628
- }
629
-
630
- case 'STOP_SLIDE':
631
- return { ...state,
632
- sliding: false
633
- };
634
-
635
- default:
636
- return state;
637
- }
638
- }
639
-
640
- const defaultSliderState = (totalItems, itemsPerPage, infinite) => ({
641
- currentItem: 0,
642
- currentPage: 0,
643
- sliding: false,
644
- slideDirection: 'next',
645
- totalItems,
646
- itemsPerPage,
647
- totalPages: Math.ceil(totalItems / itemsPerPage),
648
- infinite
649
- });
650
-
651
- const slide = (page, dispatch) => {
652
- if (page === 'next') {
653
- dispatch({
654
- type: 'NEXT_PAGE'
655
- });
656
- }
657
-
658
- if (page === 'previous') {
659
- dispatch({
660
- type: 'PREVIOUS_PAGE'
661
- });
662
- }
663
-
664
- if (typeof page === 'number') {
665
- dispatch({
666
- type: 'GO_TO_PAGE',
667
- payload: {
668
- pageIndex: page,
669
- shouldSlide: true
670
- }
671
- });
672
- }
673
- };
674
-
675
- function useSlider({
676
- totalItems,
677
- itemsPerPage = 1,
678
- infiniteMode = false,
679
- ...swipeableConfigOverrides
680
- }) {
681
- const [sliderState, sliderDispatch] = React.useReducer(reducer, undefined, () => defaultSliderState(totalItems, itemsPerPage, infiniteMode));
682
- const handlers = reactSwipeable.useSwipeable({
683
- onSwipedRight: () => slide('previous', sliderDispatch),
684
- onSwipedLeft: () => slide('next', sliderDispatch),
685
- preventDefaultTouchmoveEvent: true,
686
- trackMouse: true,
687
- ...swipeableConfigOverrides
688
- });
689
- return {
690
- handlers,
691
- slide,
692
- sliderState,
693
- sliderDispatch
694
- };
695
- }
696
-
697
- function isSlideVisible({
698
- itemsPerPage,
699
- currentSlide,
700
- slideIdx,
701
- totalItems
702
- }) {
703
- const isClonedSlide = currentSlide < 0 || currentSlide >= totalItems;
704
- const isVisible = slideIdx >= currentSlide && slideIdx < currentSlide + itemsPerPage;
705
- return isClonedSlide || isVisible;
706
- }
707
-
708
- function useSlideVisibility({
709
- currentSlide,
710
- itemsPerPage,
711
- totalItems
712
- }) {
713
- /** Keeps track of slides that have been visualized before.
714
- * We want to keep rendering them because the issue is mostly rendering
715
- * slides that might never be viewed; On the other hand, hiding slides
716
- * that were visible causes visual glitches */
717
- const visitedSlides = React.useRef(new Set());
718
- React.useEffect(() => {
719
- for (let i = 0; i < itemsPerPage; i++) {
720
- visitedSlides.current.add(currentSlide + i);
721
- }
722
- }, [currentSlide, itemsPerPage]);
723
-
724
- const isItemVisible = index => isSlideVisible({
725
- slideIdx: index,
726
- currentSlide,
727
- itemsPerPage,
728
- totalItems
729
- });
730
-
731
- const shouldRenderItem = index => {
732
- return visitedSlides.current.has(index) || isItemVisible(index);
733
- };
734
-
735
- return {
736
- shouldRenderItem,
737
- isItemVisible
738
- };
739
- }
740
-
741
- const IconButton = /*#__PURE__*/React.forwardRef(function IconButton({
742
- icon,
743
- testId = 'store-icon-button',
744
- ...buttonProps
745
- }, ref) {
746
- return React__default.createElement(Button, Object.assign({
747
- ref: ref,
748
- "data-store-icon-button": true,
749
- testId: testId
750
- }, buttonProps), React__default.createElement(Icon, {
751
- component: icon
752
- }));
753
- });
754
-
755
- const createTransformValues = (infinite, totalItems) => {
756
- const transformMap = {};
757
- const slideWidth = 100 / totalItems;
758
-
759
- for (let idx = 0; idx < totalItems; ++idx) {
760
- const currIdx = infinite ? idx - 1 : idx;
761
- const transformValue = -(slideWidth * idx);
762
- transformMap[currIdx] = transformValue;
763
- }
764
-
765
- return transformMap;
766
- };
767
-
768
- function Carousel({
769
- infiniteMode = true,
770
- controls = 'complete',
771
- testId = 'store-carousel',
772
- transition = {
773
- duration: 400,
774
- property: 'transform'
775
- },
776
- children,
777
- id = 'store-carousel',
778
- ...swipeableConfigOverrides
779
- }) {
780
- var _transition$timing, _transition$delay;
781
-
782
- const childrenArray = React__default.Children.toArray(children);
783
- const childrenCount = childrenArray.length;
784
- const numberOfSlides = infiniteMode ? childrenCount + 2 : childrenCount;
785
- const slidingTransition = `${transition.property} ${transition.duration}ms ${(_transition$timing = transition.timing) != null ? _transition$timing : ''} ${(_transition$delay = transition.delay) != null ? _transition$delay : ''}`;
786
- const showNavigationArrows = controls === 'complete' || controls === 'navigationArrows';
787
- const showPaginationBullets = controls === 'complete' || controls === 'paginationBullets';
788
- const transformValues = React.useMemo(() => createTransformValues(infiniteMode, numberOfSlides), [numberOfSlides, infiniteMode]);
789
- const {
790
- handlers,
791
- slide,
792
- sliderState,
793
- sliderDispatch
794
- } = useSlider({
795
- totalItems: childrenCount,
796
- itemsPerPage: 1,
797
- infiniteMode,
798
- ...swipeableConfigOverrides
799
- });
800
- const {
801
- isItemVisible,
802
- shouldRenderItem
803
- } = useSlideVisibility({
804
- itemsPerPage: sliderState.itemsPerPage,
805
- currentSlide: sliderState.currentItem,
806
- totalItems: childrenCount
807
- });
808
- const postRenderedSlides = infiniteMode && children ? childrenArray.slice(0, 1) : [];
809
- const preRenderedSlides = infiniteMode && children ? childrenArray.slice(childrenCount - 1) : [];
810
- const slides = preRenderedSlides.concat(children != null ? children : [], postRenderedSlides);
811
-
812
- const slidePrevious = () => {
813
- if (sliderState.sliding || !infiniteMode && sliderState.currentPage === 0) {
814
- return;
815
- }
816
-
817
- slide('previous', sliderDispatch);
818
- };
819
-
820
- const slideNext = () => {
821
- if (sliderState.sliding || !infiniteMode && sliderState.currentPage === childrenCount - 1) {
822
- return;
823
- }
824
-
825
- slide('next', sliderDispatch);
826
- }; // accessible behavior for tablist
827
-
828
-
829
- const handleBulletsKeyDown = event => {
830
- switch (event.key) {
831
- case 'ArrowLeft':
832
- {
833
- slidePrevious();
834
- break;
835
- }
836
-
837
- case 'ArrowRight':
838
- {
839
- slideNext();
840
- break;
841
- }
842
-
843
- case 'Home':
844
- {
845
- slide(0, sliderDispatch);
846
- break;
847
- }
848
-
849
- case 'End':
850
- {
851
- slide(childrenCount - 1, sliderDispatch);
852
- break;
853
- }
854
- }
855
- };
856
-
857
- return React__default.createElement("section", {
858
- id: id,
859
- "data-store-carousel": true,
860
- "data-testid": testId,
861
- "aria-label": "carousel",
862
- "aria-roledescription": "carousel"
863
- }, React__default.createElement("div", Object.assign({
864
- "data-carousel-track-container": true,
865
- style: {
866
- overflow: 'hidden',
867
- width: '100%'
868
- }
869
- }, handlers), React__default.createElement("div", {
870
- "data-carousel-track": true,
871
- style: {
872
- display: 'flex',
873
- transition: sliderState.sliding ? slidingTransition : undefined,
874
- width: `${numberOfSlides * 100}%`,
875
- transform: `translate3d(${transformValues[sliderState.currentPage]}%, 0, 0)`
876
- },
877
- onTransitionEnd: () => {
878
- sliderDispatch({
879
- type: 'STOP_SLIDE'
880
- });
881
-
882
- if (sliderState.currentItem >= childrenCount) {
883
- sliderDispatch({
884
- type: 'GO_TO_PAGE',
885
- payload: {
886
- pageIndex: 0,
887
- shouldSlide: false
888
- }
889
- });
890
- }
891
-
892
- if (sliderState.currentItem < 0) {
893
- sliderDispatch({
894
- type: 'GO_TO_PAGE',
895
- payload: {
896
- pageIndex: sliderState.totalPages - 1,
897
- shouldSlide: false
898
- }
899
- });
900
- }
901
- },
902
- "aria-live": "polite"
903
- }, slides.map((currentSlide, idx) => React__default.createElement("div", {
904
- role: "tabpanel",
905
- "aria-roledescription": "slide",
906
- key: idx,
907
- id: `carousel-item-${idx}`,
908
- "data-carousel-item": true,
909
- style: {
910
- width: '100%'
911
- },
912
- "data-visible": isItemVisible(idx - Number(infiniteMode)) || undefined
913
- }, shouldRenderItem(idx - Number(infiniteMode)) ? currentSlide : null)))), showNavigationArrows && React__default.createElement("div", {
914
- "data-carousel-controls": true
915
- }, React__default.createElement(IconButton, {
916
- "aria-label": "previous",
917
- "data-arrow": "left",
918
- "aria-controls": id,
919
- onClick: slidePrevious,
920
- icon: React__default.createElement(LeftArrowIcon, null)
921
- }), React__default.createElement(IconButton, {
922
- "aria-label": "next",
923
- "data-arrow": "right",
924
- "aria-controls": id,
925
- onClick: slideNext,
926
- icon: React__default.createElement(RightArrowIcon, null)
927
- })), showPaginationBullets && React__default.createElement("div", {
928
- "data-carousel-bullets": true
929
- }, React__default.createElement(Bullets, {
930
- tabIndex: 0,
931
- totalQuantity: childrenCount,
932
- activeBullet: sliderState.currentPage,
933
- onClick: (_, idx) => {
934
- if (sliderState.sliding) {
935
- return;
936
- }
937
-
938
- slide(idx, sliderDispatch);
939
- },
940
- ariaControlsGenerator: idx => `carousel-item-${idx}`,
941
- onKeyDown: handleBulletsKeyDown,
942
- onFocus: event => {
943
- event.currentTarget.focus();
944
- }
945
- })));
946
- }
947
-
948
- /*
949
- * Element that will maintain the focus inside trapFocusRef, focus the first element,
950
- * and focus back on the element that was in focus when useTrapFocus was triggered.
951
- *
952
- * Inspired by Reakit useTrapFocus https://github.com/reakit/reakit/blob/a211d94da9f3b683182568a56479b91afb1b85ae/packages/reakit/src/Dialog/__utils/useFocusTrap.ts
953
- */
954
-
955
- const useTrapFocus = ({
956
- trapFocusRef,
957
- beforeElementRef,
958
- afterElementRef
959
- }) => {
960
- const tabbableNodesRef = React.useRef();
961
- const nodeToRestoreRef = React.useRef(document.hasFocus() ? document.activeElement : null); // Focus back on the element that was focused when useTrapFocus is triggered.
962
-
963
- React.useEffect(() => {
964
- const nodeToRestore = nodeToRestoreRef.current;
965
- return () => {
966
- nodeToRestore == null ? void 0 : nodeToRestore.focus();
967
- };
968
- }, [nodeToRestoreRef]); // Set focus on first tabbable element
969
-
970
- React.useEffect(() => {
971
- if (!trapFocusRef.current) {
972
- return;
973
- }
974
-
975
- if (!tabbableNodesRef.current) {
976
- tabbableNodesRef.current = tabbable.tabbable(trapFocusRef.current);
977
- }
978
-
979
- const [firstTabbable] = tabbableNodesRef.current;
980
-
981
- if (!firstTabbable) {
982
- trapFocusRef.current.focus();
983
- return;
984
- }
985
-
986
- firstTabbable.focus();
987
- }, [trapFocusRef]); // Handle loop focus. Set keydown and focusin event listeners
988
-
989
- React.useEffect(() => {
990
- if (!trapFocusRef.current || !beforeElementRef.current || !afterElementRef.current) {
991
- return;
992
- }
993
-
994
- const beforeElement = beforeElementRef.current;
995
- const afterElement = afterElementRef.current;
996
- const trapFocus = trapFocusRef.current;
997
-
998
- const handleLoopFocus = nativeEvent => {
999
- if (!document.hasFocus()) {
1000
- return;
1001
- }
1002
-
1003
- tabbableNodesRef.current = tabbable.tabbable(trapFocusRef.current);
1004
-
1005
- if (!tabbableNodesRef.current.length) {
1006
- trapFocus.focus();
1007
- }
1008
- /*
1009
- * Handle loop focus from beforeElementRef. This node can only be focused if the user press shift tab.
1010
- * It will focus the last element of the trapFocusRef.
1011
- */
1012
-
1013
-
1014
- if (nativeEvent.target === beforeElement) {
1015
- var _tabbableNodesRef$cur;
1016
-
1017
- (_tabbableNodesRef$cur = tabbableNodesRef.current[tabbableNodesRef.current.length - 1]) == null ? void 0 : _tabbableNodesRef$cur.focus();
1018
- }
1019
- /*
1020
- * Handle loop focus from afterElementRef. This node can only be focused if the user press tab.
1021
- * It will focus the first element of the trapFocusRef.
1022
- */
1023
-
1024
-
1025
- if (nativeEvent.target === afterElement) {
1026
- var _tabbableNodesRef$cur2;
1027
-
1028
- (_tabbableNodesRef$cur2 = tabbableNodesRef.current[0]) == null ? void 0 : _tabbableNodesRef$cur2.focus();
1029
- }
1030
- };
1031
-
1032
- beforeElement == null ? void 0 : beforeElement.addEventListener('focusin', handleLoopFocus);
1033
- afterElement == null ? void 0 : afterElement.addEventListener('focusin', handleLoopFocus);
1034
- return () => {
1035
- beforeElement == null ? void 0 : beforeElement.removeEventListener('focusin', handleLoopFocus);
1036
- afterElement == null ? void 0 : afterElement.removeEventListener('focusin', handleLoopFocus);
1037
- };
1038
- }, [tabbableNodesRef, afterElementRef, beforeElementRef, trapFocusRef]);
1039
- };
1040
-
1041
- const ModalContentPure = ({
1042
- beforeElementRef,
1043
- trapFocusRef,
1044
- afterElementRef,
1045
- testId = 'store-modal-content',
1046
- children,
1047
- ...otherProps
1048
- }) => {
1049
- return React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
1050
- ref: beforeElementRef,
1051
- "data-testid": "beforeElement",
1052
- tabIndex: 0,
1053
- "aria-hidden": "true"
1054
- }), React__default.createElement("div", Object.assign({
1055
- "data-store-modal-content": true,
1056
- "data-testid": testId,
1057
- ref: trapFocusRef,
1058
- "aria-modal": "true",
1059
- role: "dialog",
1060
- tabIndex: -1
1061
- }, otherProps), children), React__default.createElement("div", {
1062
- ref: afterElementRef,
1063
- "data-testid": "afterElement",
1064
- tabIndex: 0,
1065
- "aria-hidden": "true"
1066
- }));
1067
- };
1068
-
1069
- const ModalContent = ({
1070
- children,
1071
- ...otherProps
1072
- }) => {
1073
- const trapFocusRef = React.useRef(null);
1074
- const beforeElementRef = React.useRef(null);
1075
- const afterElementRef = React.useRef(null);
1076
- useTrapFocus({
1077
- beforeElementRef,
1078
- trapFocusRef,
1079
- afterElementRef
1080
- });
1081
- return React__default.createElement(ModalContentPure, Object.assign({}, otherProps, {
1082
- trapFocusRef: trapFocusRef,
1083
- beforeElementRef: beforeElementRef,
1084
- afterElementRef: afterElementRef,
1085
- onClick: event => {
1086
- event.stopPropagation();
1087
- }
1088
- }), children);
1089
- };
1090
-
1091
- /*
1092
- * This component is based on @reach/dialog.
1093
- * https://github.com/reach/reach-ui/blob/main/packages/dialog/src/index.tsx
1094
- * https://reach.tech/dialog
1095
- */
1096
-
1097
- const Modal = ({
1098
- isOpen,
1099
- children,
1100
- onDismiss,
1101
- testId = 'store-modal',
1102
- ...otherProps
1103
- }) => {
1104
- const handleBackdropClick = event => {
1105
- if (event.defaultPrevented) {
1106
- return;
1107
- }
1108
-
1109
- event.stopPropagation();
1110
- onDismiss == null ? void 0 : onDismiss(event);
1111
- };
1112
-
1113
- const handleBackdropKeyDown = event => {
1114
- if (event.key !== 'Escape' || event.defaultPrevented) {
1115
- return;
1116
- }
1117
-
1118
- event.stopPropagation();
1119
- onDismiss == null ? void 0 : onDismiss(event);
1120
- };
1121
-
1122
- return isOpen ? reactDom.createPortal(React__default.createElement(Overlay, {
1123
- "data-modal-overlay": true,
1124
- onClick: handleBackdropClick,
1125
- onKeyDown: handleBackdropKeyDown
1126
- }, React__default.createElement(ModalContent, Object.assign({}, otherProps, {
1127
- testId: testId
1128
- }), children)), document.body) : null;
1129
- };
1130
-
1131
- const Banner = /*#__PURE__*/React.forwardRef(function Banner({
1132
- testId = 'store-banner',
1133
- children,
1134
- variant = 'vertical',
1135
- ...otherProps
1136
- }, ref) {
1137
- return React__default.createElement("article", Object.assign({
1138
- ref: ref,
1139
- "data-store-banner": variant,
1140
- "data-testid": testId
1141
- }, otherProps), children);
1142
- });
1143
-
1144
- const BannerImage = /*#__PURE__*/React.forwardRef(function BannerImage({
1145
- testId = 'store-banner-image',
1146
- children,
1147
- ...otherProps
1148
- }, ref) {
1149
- return React__default.createElement("div", Object.assign({
1150
- ref: ref,
1151
- "data-banner-image": true,
1152
- "data-testid": testId
1153
- }, otherProps), children);
1154
- });
1155
-
1156
- const BannerContent = /*#__PURE__*/React.forwardRef(function BannerContent({
1157
- testId = 'store-banner-content',
1158
- children,
1159
- ...otherProps
1160
- }, ref) {
1161
- return React__default.createElement("div", Object.assign({
1162
- ref: ref,
1163
- "data-banner-content": true,
1164
- "data-testid": testId
1165
- }, otherProps), children);
1166
- });
1167
-
1168
- const BannerLink = /*#__PURE__*/React.forwardRef(function BannerLink({
1169
- testId = 'store-banner-link',
1170
- children,
1171
- ...otherProps
1172
- }, ref) {
1173
- return React__default.createElement("div", Object.assign({
1174
- ref: ref,
1175
- "data-banner-link": true,
1176
- "data-testid": testId
1177
- }, otherProps), children);
1178
- });
1179
-
1180
- const PaymentMethods = /*#__PURE__*/React.forwardRef(function PaymentMethods({
1181
- testId = 'store-payment-methods',
1182
- title,
1183
- 'aria-label': ariaLabel = 'Payment Methods',
1184
- children,
1185
- ...otherProps
1186
- }, ref) {
1187
- return React__default.createElement("div", Object.assign({
1188
- ref: ref,
1189
- "data-store-payment-methods": true,
1190
- "data-testid": testId
1191
- }, otherProps), !!title && React__default.createElement("div", null, title), React__default.createElement("div", {
1192
- "data-payment-methods-flags": true,
1193
- "aria-label": title ? undefined : ariaLabel
1194
- }, children));
1195
- });
1196
-
1197
- const Divider = ({
1198
- divider,
1199
- testId
1200
- }) => {
1201
- const props = {
1202
- 'data-breadcrumb-divider': true,
1203
- 'aria-hidden': true,
1204
- 'data-testid': `${testId}-divider`
1205
- };
1206
-
1207
- if (React__default.isValidElement(divider)) {
1208
- return React__default.cloneElement(divider, props);
1209
- }
1210
-
1211
- return React__default.createElement("span", Object.assign({}, props), divider != null ? divider : '/');
1212
- };
1213
-
1214
- const ListItem = ({
1215
- children,
1216
- isLastItem,
1217
- divider,
1218
- testId
1219
- }) => {
1220
- const props = {
1221
- 'data-testid': `${testId}-item`,
1222
- 'data-breadcrumb-item': isLastItem ? 'current' : true,
1223
- 'aria-current': isLastItem ? 'page' : undefined
1224
- };
1225
-
1226
- if (!React__default.isValidElement(children)) {
1227
- return React__default.createElement("li", {
1228
- "data-breadcrumb-list-item": true
1229
- }, React__default.createElement("span", Object.assign({}, props), children, isLastItem ? null : React__default.createElement(Divider, {
1230
- divider: divider,
1231
- testId: testId
1232
- })));
1233
- }
1234
-
1235
- return React__default.createElement("li", {
1236
- "data-breadcrumb-list-item": true
1237
- }, React__default.cloneElement(children, props), isLastItem ? null : React__default.createElement(Divider, {
1238
- divider: divider,
1239
- testId: testId
1240
- }));
1241
- };
1242
-
1243
- const Breadcrumb = /*#__PURE__*/React.forwardRef(function Breadcrumb({
1244
- children,
1245
- divider: rawDivider,
1246
- testId = 'store-breadcrumb',
1247
- ...otherProps
1248
- }, ref) {
1249
- return React__default.createElement("nav", Object.assign({
1250
- "aria-label": "Breadcrumb",
1251
- role: "navigation",
1252
- ref: ref,
1253
- "data-store-breadcrumb": true,
1254
- "data-testid": testId
1255
- }, otherProps), React__default.createElement(List, {
1256
- "data-breadcrumb-list": true,
1257
- variant: "ordered"
1258
- }, React__default.Children.toArray(children).map((child, index, childrenArray) => {
1259
- const isLastItem = index === childrenArray.length - 1;
1260
- return React__default.createElement(ListItem, {
1261
- isLastItem: isLastItem,
1262
- divider: rawDivider,
1263
- key: `breadcrumb-${index}`,
1264
- testId: testId
1265
- }, child);
1266
- })));
1267
- });
1268
-
1269
- const LoadingButton = /*#__PURE__*/React.forwardRef(function LoadingButton({
1270
- children,
1271
- loading,
1272
- testId = 'store-loading-button',
1273
- ...otherProps
1274
- }, ref) {
1275
- return React__default.createElement(Button, Object.assign({
1276
- ref: ref,
1277
- "data-store-loading-button": true,
1278
- testId: testId
1279
- }, otherProps), loading ? React__default.createElement(Spinner, null) : children);
1280
- });
1281
-
1282
- const PriceRange = ({
1283
- className,
1284
- formatter,
1285
- max,
1286
- min,
1287
- onChange,
1288
- testId = 'store-price-range',
1289
- variant,
1290
- 'aria-label': ariaLabel
1291
- }) => {
1292
- const [minVal, setMinVal] = React.useState(min);
1293
- const [maxVal, setMaxVal] = React.useState(max);
1294
-
1295
- const handleChange = values => {
1296
- if (values.min !== minVal) {
1297
- setMinVal(values.min);
1298
- }
1299
-
1300
- if (values.max !== maxVal) {
1301
- setMaxVal(values.max);
1302
- }
1303
-
1304
- onChange == null ? void 0 : onChange(values);
1305
- };
1306
-
1307
- return React__default.createElement("div", {
1308
- "data-store-price-range": true,
1309
- "data-testid": testId,
1310
- className: className
1311
- }, React__default.createElement(Slider, {
1312
- min: min,
1313
- max: max,
1314
- onChange: handleChange,
1315
- "aria-label": ariaLabel
1316
- }), React__default.createElement("div", {
1317
- "data-price-range-values": true
1318
- }, React__default.createElement(Price, {
1319
- formatter: formatter,
1320
- "data-price-range-value": "min",
1321
- value: minVal,
1322
- variant: variant
1323
- }), React__default.createElement(Price, {
1324
- formatter: formatter,
1325
- "data-price-range-value": "max",
1326
- value: maxVal,
1327
- variant: variant
1328
- })));
1329
- };
1330
-
1331
- const RadioGroupContext = /*#__PURE__*/React.createContext(undefined);
1332
- function useRadioGroup() {
1333
- const context = React.useContext(RadioGroupContext);
1334
-
1335
- if (!context) {
1336
- throw new Error(`useRadioOption hook cannot be used outside the RadioGroup context`);
1337
- }
1338
-
1339
- return context;
1340
- }
1341
-
1342
- const RadioGroup = ({
1343
- name,
1344
- onChange,
1345
- children,
1346
- selectedValue
1347
- }) => {
1348
- const contextValues = React__default.useMemo(() => {
1349
- return {
1350
- name,
1351
- selectedValue,
1352
- onChange
1353
- };
1354
- }, [name, selectedValue, onChange]);
1355
- return React__default.createElement(RadioGroupContext.Provider, {
1356
- value: contextValues
1357
- }, children);
1358
- };
1359
-
1360
- const RadioOption = /*#__PURE__*/React.forwardRef(function RadioOption({
1361
- label,
1362
- value,
1363
- children,
1364
- testId = 'store-radio-option',
1365
- ...otherProps
1366
- }, ref) {
1367
- const {
1368
- name,
1369
- selectedValue,
1370
- onChange
1371
- } = useRadioGroup();
1372
- return React__default.createElement("label", {
1373
- "aria-label": label,
1374
- "data-store-radio-option": true
1375
- }, React__default.createElement(Radio, Object.assign({
1376
- "data-store-radio-option-item": true,
1377
- ref: ref,
1378
- name: name,
1379
- checked: value === selectedValue,
1380
- onChange: onChange,
1381
- value: value,
1382
- testId: testId
1383
- }, otherProps)), children);
1384
- });
1385
-
1386
- const AccordionContext = /*#__PURE__*/React.createContext(undefined);
1387
- const Accordion = /*#__PURE__*/React.forwardRef(function Accordion({
1388
- testId = 'store-accordion',
1389
- indices,
1390
- onChange,
1391
- children,
1392
- ...otherProps
1393
- }, ref) {
1394
- const childrenWithIndex = React__default.Children.map(children, (child, index) => {
1395
- var _child$props$index;
1396
-
1397
- return React.cloneElement(child, {
1398
- index: (_child$props$index = child.props.index) != null ? _child$props$index : index
1399
- });
1400
- });
1401
- const context = {
1402
- indices: new Set(indices),
1403
- onChange,
1404
- numberOfItems: childrenWithIndex.length
1405
- };
1406
- return React__default.createElement(AccordionContext.Provider, {
1407
- value: context
1408
- }, React__default.createElement("div", Object.assign({
1409
- ref: ref,
1410
- "data-store-accordion": true,
1411
- "data-testid": testId,
1412
- role: "region"
1413
- }, otherProps), childrenWithIndex));
1414
- });
1415
- function useAccordion() {
1416
- const context = React.useContext(AccordionContext);
1417
-
1418
- if (context === undefined) {
1419
- throw new Error('Do not use Accordion components outside the Accordion context.');
1420
- }
1421
-
1422
- return context;
1423
- }
1424
-
1425
- const AccordionItemContext = /*#__PURE__*/React.createContext(undefined);
1426
- const AccordionItem = /*#__PURE__*/React.forwardRef(function AccordionItem({
1427
- testId = 'store-accordion-item',
1428
- children,
1429
- prefixId = '',
1430
- index = 0,
1431
- ...otherProps
1432
- }, ref) {
1433
- const context = {
1434
- index,
1435
- prefixId,
1436
- panel: `${prefixId && `${prefixId}-`}panel--${index}`,
1437
- button: `${prefixId && `${prefixId}-`}button--${index}`
1438
- };
1439
- return React__default.createElement(AccordionItemContext.Provider, {
1440
- value: context
1441
- }, React__default.createElement("div", Object.assign({
1442
- ref: ref,
1443
- "data-accordion-item": true,
1444
- "data-testid": testId
1445
- }, otherProps), children));
1446
- });
1447
- function useAccordionItem() {
1448
- const context = React.useContext(AccordionItemContext);
1449
-
1450
- if (context === undefined) {
1451
- throw new Error('Do not use AccordionItem components outside the AccordionItem context.');
1452
- }
1453
-
1454
- return context;
1455
- }
1456
-
1457
- const AccordionButton = /*#__PURE__*/React.forwardRef(function AccordionButton({
1458
- testId = 'store-accordion-button',
1459
- children,
1460
- ...otherProps
1461
- }, ref) {
1462
- const {
1463
- indices,
1464
- onChange,
1465
- numberOfItems
1466
- } = useAccordion();
1467
- const {
1468
- index,
1469
- panel,
1470
- button,
1471
- prefixId
1472
- } = useAccordionItem();
1473
-
1474
- const onKeyDown = event => {
1475
- var _getNext, _getPrevious;
1476
-
1477
- if (!['ArrowDown', 'ArrowUp'].includes(event.key)) {
1478
- return;
1479
- }
1480
-
1481
- const getNext = () => {
1482
- const next = Number(index) + 1 === numberOfItems ? 0 : Number(index) + 1;
1483
- return document.getElementById(`${prefixId && `${prefixId}-`}button--${next}`);
1484
- };
1485
-
1486
- const getPrevious = () => {
1487
- const previous = Number(index) - 1 < 0 ? numberOfItems - 1 : Number(index) - 1;
1488
- return document.getElementById(`${prefixId && `${prefixId}-`}button--${previous}`);
1489
- };
1490
-
1491
- switch (event.key) {
1492
- case 'ArrowDown':
1493
- event.preventDefault();
1494
- (_getNext = getNext()) == null ? void 0 : _getNext.focus();
1495
- break;
1496
-
1497
- case 'ArrowUp':
1498
- event.preventDefault();
1499
- (_getPrevious = getPrevious()) == null ? void 0 : _getPrevious.focus();
1500
- break;
1501
- }
1502
- };
1503
-
1504
- return React__default.createElement(Button, Object.assign({
1505
- ref: ref,
1506
- id: button,
1507
- "aria-expanded": indices.has(index),
1508
- "aria-controls": panel,
1509
- "data-accordion-button": true,
1510
- "data-testid": testId,
1511
- onKeyDown: onKeyDown,
1512
- onClick: () => {
1513
- onChange(index);
1514
- }
1515
- }, otherProps), children);
1516
- });
1517
-
1518
- const AccordionPanel = /*#__PURE__*/React.forwardRef(function AccordionPanel({
1519
- testId = 'store-accordion-panel',
1520
- children,
1521
- ...otherProps
1522
- }, ref) {
1523
- const {
1524
- indices
1525
- } = useAccordion();
1526
- const {
1527
- index,
1528
- button,
1529
- panel
1530
- } = useAccordionItem();
1531
- return React__default.createElement("div", Object.assign({
1532
- ref: ref,
1533
- id: panel,
1534
- "aria-labelledby": button,
1535
- role: "region",
1536
- "data-accordion-panel": true,
1537
- "data-testid": testId,
1538
- hidden: !indices.has(index)
1539
- }, otherProps), children);
1540
- });
1541
-
1542
- const Table = /*#__PURE__*/React.forwardRef(function Table({
1543
- testId = 'store-table',
1544
- children,
1545
- ...otherProps
1546
- }, ref) {
1547
- return React__default.createElement("table", Object.assign({
1548
- ref: ref,
1549
- "data-store-table": true,
1550
- "data-testid": testId
1551
- }, otherProps), children);
1552
- });
1553
-
1554
- const TableRow = /*#__PURE__*/React.forwardRef(function TableRow({
1555
- testId = 'store-table-row',
1556
- children,
1557
- ...otherProps
1558
- }, ref) {
1559
- return React__default.createElement("tr", Object.assign({
1560
- ref: ref,
1561
- "data-table-row": true,
1562
- "data-testid": testId
1563
- }, otherProps), children);
1564
- });
1565
-
1566
- const TableCell = /*#__PURE__*/React.forwardRef(function TableCell({
1567
- testId = 'store-table-cell',
1568
- children,
1569
- variant = 'data',
1570
- scope,
1571
- ...otherProps
1572
- }, ref) {
1573
- const Cell = variant === 'header' ? 'th' : 'td';
1574
- return React__default.createElement(Cell, Object.assign({
1575
- ref: ref,
1576
- "data-table-cell": variant,
1577
- "data-testid": testId,
1578
- scope: scope
1579
- }, otherProps), children);
1580
- });
1581
-
1582
- const TableBody = /*#__PURE__*/React.forwardRef(function TableBody({
1583
- children,
1584
- testId = 'store-table-body',
1585
- ...otherProps
1586
- }, ref) {
1587
- return React__default.createElement("tbody", Object.assign({
1588
- ref: ref,
1589
- "data-testid": testId,
1590
- "data-table-body": true
1591
- }, otherProps), children);
1592
- });
1593
-
1594
- const TableHead = /*#__PURE__*/React.forwardRef(function TableHead({
1595
- children,
1596
- testId = 'store-table-head',
1597
- ...otherProps
1598
- }, ref) {
1599
- return React__default.createElement("thead", Object.assign({
1600
- ref: ref,
1601
- "data-testid": testId,
1602
- "data-table-head": true
1603
- }, otherProps), children);
1604
- });
1605
-
1606
- const TableFooter = /*#__PURE__*/React.forwardRef(function TableFooter({
1607
- children,
1608
- testId = 'store-table-footer',
1609
- ...otherProps
1610
- }, ref) {
1611
- return React__default.createElement("tfoot", Object.assign({
1612
- ref: ref,
1613
- "data-testid": testId,
1614
- "data-table-footer": true
1615
- }, otherProps), children);
1616
- });
1617
-
1618
- const Alert = /*#__PURE__*/React.forwardRef(function Alert({
1619
- testId = 'store-alert',
1620
- children,
1621
- ...otherProps
1622
- }, ref) {
1623
- return React__default.createElement("div", Object.assign({
1624
- ref: ref,
1625
- role: "alert",
1626
- "data-store-alert": true,
1627
- "data-testid": testId
1628
- }, otherProps), children);
1629
- });
1630
-
1631
- const QuantitySelector = /*#__PURE__*/React.forwardRef(function QuantitySelector({
1632
- quantity,
1633
- testId = 'store-quantity-selector',
1634
- leftButtonProps,
1635
- inputProps,
1636
- rightButtonProps,
1637
- ...otherProps
1638
- }, ref) {
1639
- return React__default.createElement("div", Object.assign({
1640
- "data-store-quantity-selector": true,
1641
- "data-testid": testId,
1642
- ref: ref
1643
- }, otherProps), React__default.createElement(IconButton, Object.assign({
1644
- "aria-controls": "quantity-selector-input",
1645
- "aria-label": "Decrement Quantity",
1646
- "data-quantity-selector-button": "left"
1647
- }, leftButtonProps)), React__default.createElement(Input, Object.assign({
1648
- "aria-label": "Quantity",
1649
- "data-quantity-selector-input": true,
1650
- id: "quantity-selector-input",
1651
- value: quantity
1652
- }, inputProps)), React__default.createElement(IconButton, Object.assign({
1653
- "aria-controls": "quantity-selector-input",
1654
- "aria-label": "Increment Quantity",
1655
- "data-quantity-selector-button": "right"
1656
- }, rightButtonProps)));
1657
- });
1658
-
1659
- const defaultState = {
1660
- isOpen: false,
1661
- dropdownButtonRef: null,
1662
- selectedDropdownItemIndexRef: null,
1663
- dropdownItemsRef: null,
1664
- id: 'store-dropdown'
1665
- };
1666
- const DropdownContext = /*#__PURE__*/React.createContext(defaultState);
1667
-
1668
- const Dropdown = ({
1669
- children,
1670
- isOpen: isOpenDefault = false,
1671
- onDismiss,
1672
- id = 'store-dropdown'
1673
- }) => {
1674
- const [isOpen, setIsOpen] = React.useState(isOpenDefault);
1675
- const dropdownItemsRef = React.useRef([]);
1676
- const selectedDropdownItemIndexRef = React.useRef(0);
1677
- const dropdownButtonRef = React.useRef(null);
1678
- const close = React.useCallback(() => {
1679
- var _dropdownButtonRef$cu;
1680
-
1681
- setIsOpen(false);
1682
- onDismiss == null ? void 0 : onDismiss();
1683
- (_dropdownButtonRef$cu = dropdownButtonRef.current) == null ? void 0 : _dropdownButtonRef$cu.focus();
1684
- }, [onDismiss]);
1685
-
1686
- const open = () => {
1687
- setIsOpen(true);
1688
- };
1689
-
1690
- const toggle = React.useCallback(() => {
1691
- setIsOpen(old => {
1692
- if (old) {
1693
- var _dropdownButtonRef$cu2;
1694
-
1695
- onDismiss == null ? void 0 : onDismiss();
1696
- (_dropdownButtonRef$cu2 = dropdownButtonRef.current) == null ? void 0 : _dropdownButtonRef$cu2.focus();
1697
- }
1698
-
1699
- return !old;
1700
- });
1701
- }, [onDismiss]);
1702
- React.useEffect(() => {
1703
- setIsOpen(isOpenDefault);
1704
- }, [isOpenDefault]);
1705
- React.useEffect(() => {
1706
- var _dropdownItemsRef$cur;
1707
-
1708
- isOpen && (dropdownItemsRef == null ? void 0 : (_dropdownItemsRef$cur = dropdownItemsRef.current[0]) == null ? void 0 : _dropdownItemsRef$cur.focus());
1709
- }, [isOpen]);
1710
- React.useEffect(() => {
1711
- let firstClick = true;
1712
-
1713
- const event = e => {
1714
- const someItemWasClicked = dropdownItemsRef == null ? void 0 : dropdownItemsRef.current.some(item => e.target === item);
1715
-
1716
- if (firstClick) {
1717
- firstClick = false;
1718
- return;
1719
- }
1720
-
1721
- !someItemWasClicked && close();
1722
- };
1723
-
1724
- if (isOpen) {
1725
- document.addEventListener('click', event);
1726
- } else {
1727
- document.removeEventListener('click', event);
1728
- }
1729
-
1730
- return () => {
1731
- document.removeEventListener('click', event);
1732
- };
1733
- }, [close, isOpen]);
1734
- const value = React.useMemo(() => {
1735
- return {
1736
- isOpen,
1737
- close,
1738
- open,
1739
- toggle,
1740
- dropdownButtonRef,
1741
- onDismiss,
1742
- selectedDropdownItemIndexRef,
1743
- dropdownItemsRef,
1744
- id
1745
- };
1746
- }, [close, id, isOpen, onDismiss, toggle]);
1747
- return React__default.createElement(DropdownContext.Provider, {
1748
- value: value
1749
- }, children);
1750
- };
1751
-
1752
- /**
1753
- * Hook to use the Dropdown context.
1754
- * @returns Dropdown context.
1755
- */
1756
-
1757
- const useDropdown = () => {
1758
- const context = React.useContext(DropdownContext);
1759
-
1760
- if (context === undefined) {
1761
- throw new Error('Do not use useDropdown hook outside the Dropdown context.');
1762
- }
1763
-
1764
- return context;
1765
- };
1766
-
1767
- const DropdownButton = /*#__PURE__*/React.forwardRef(function Button({
1768
- children,
1769
- testId = 'store-dropdown-button',
1770
- ...otherProps
1771
- }, ref) {
1772
- const {
1773
- toggle,
1774
- dropdownButtonRef,
1775
- isOpen,
1776
- id
1777
- } = useDropdown();
1778
- React.useImperativeHandle(ref, () => dropdownButtonRef.current, [dropdownButtonRef]);
1779
- return React__default.createElement("button", Object.assign({
1780
- "data-store-dropdown-button": true,
1781
- onClick: toggle,
1782
- "data-testid": testId,
1783
- ref: dropdownButtonRef,
1784
- "aria-expanded": isOpen,
1785
- "aria-haspopup": "menu",
1786
- "aria-controls": id
1787
- }, otherProps), children);
1788
- });
1789
-
1790
- const DropdownItem = /*#__PURE__*/React.forwardRef(function Button({
1791
- children,
1792
- onClick,
1793
- testId = 'store-dropdown-item',
1794
- ...otherProps
1795
- }, ref) {
1796
- const {
1797
- dropdownItemsRef,
1798
- selectedDropdownItemIndexRef,
1799
- close
1800
- } = useDropdown();
1801
- const [dropdownItemIndex, setDropdownItemIndex] = React.useState(0);
1802
- const dropdownItemRef = React.useRef();
1803
-
1804
- const addToRefs = el => {
1805
- if (el && !(dropdownItemsRef != null && dropdownItemsRef.current.includes(el))) {
1806
- var _dropdownItemsRef$cur;
1807
-
1808
- dropdownItemsRef == null ? void 0 : dropdownItemsRef.current.push(el);
1809
- setDropdownItemIndex((_dropdownItemsRef$cur = dropdownItemsRef == null ? void 0 : dropdownItemsRef.current.findIndex(element => element === el)) != null ? _dropdownItemsRef$cur : 0);
1810
- }
1811
-
1812
- dropdownItemRef.current = el;
1813
- };
1814
-
1815
- const onFocusItem = () => {
1816
- var _dropdownItemsRef$cur2;
1817
-
1818
- selectedDropdownItemIndexRef.current = dropdownItemIndex;
1819
- dropdownItemsRef == null ? void 0 : (_dropdownItemsRef$cur2 = dropdownItemsRef.current[selectedDropdownItemIndexRef.current]) == null ? void 0 : _dropdownItemsRef$cur2.focus();
1820
- };
1821
-
1822
- const handleOnClickItem = event => {
1823
- onClick == null ? void 0 : onClick(event);
1824
- close == null ? void 0 : close();
1825
- };
1826
-
1827
- React.useImperativeHandle(ref, () => dropdownItemRef.current, []);
1828
- return React__default.createElement("button", Object.assign({
1829
- "data-store-dropdown-item": true,
1830
- "data-testid": testId,
1831
- ref: addToRefs,
1832
- onFocus: onFocusItem,
1833
- onMouseEnter: onFocusItem,
1834
- onClick: handleOnClickItem,
1835
- role: "menuitem",
1836
- tabIndex: -1,
1837
- "data-index": dropdownItemIndex
1838
- }, otherProps), children);
1839
- });
1840
-
1841
- /**
1842
- * Hook used to find the DropdownMenu position in relation to DropdownButton
1843
- * @returns Style with positions.
1844
- */
1845
-
1846
- const useDropdownPosition = () => {
1847
- var _dropdownButtonRef$cu, _buttonRect$top, _buttonRect$height, _buttonRect$left, _document, _document$documentEle, _document2, _document2$documentEl;
1848
-
1849
- const {
1850
- dropdownButtonRef
1851
- } = useDropdown(); // Necessary to use this component in SSR
1852
-
1853
- const isBrowser = typeof window !== 'undefined';
1854
- const buttonRect = dropdownButtonRef == null ? void 0 : (_dropdownButtonRef$cu = dropdownButtonRef.current) == null ? void 0 : _dropdownButtonRef$cu.getBoundingClientRect();
1855
- const topLevel = (_buttonRect$top = buttonRect == null ? void 0 : buttonRect.top) != null ? _buttonRect$top : 0;
1856
- const topOffset = (_buttonRect$height = buttonRect == null ? void 0 : buttonRect.height) != null ? _buttonRect$height : 0;
1857
- const leftLevel = (_buttonRect$left = buttonRect == null ? void 0 : buttonRect.left) != null ? _buttonRect$left : 0; // The scroll properties fix the position of DropdownMenu when the scroll is activated.
1858
-
1859
- const scrollTop = isBrowser ? (_document = document) == null ? void 0 : (_document$documentEle = _document.documentElement) == null ? void 0 : _document$documentEle.scrollTop : 0;
1860
- const scrollLeft = isBrowser ? (_document2 = document) == null ? void 0 : (_document2$documentEl = _document2.documentElement) == null ? void 0 : _document2$documentEl.scrollLeft : 0;
1861
- const topPosition = topLevel + topOffset + scrollTop;
1862
- const leftPosition = leftLevel + scrollLeft;
1863
- return {
1864
- position: 'absolute',
1865
- top: topPosition,
1866
- left: leftPosition
1867
- };
1868
- };
1869
-
1870
- /*
1871
- * This component is based on @reach/dialog.
1872
- * https://github.com/reach/reach-ui/blob/main/packages/dialog/src/index.tsx
1873
- * https://reach.tech/dialog
1874
- */
1875
-
1876
- const DropdownMenu = ({
1877
- children,
1878
- testId = 'store-dropdown-menu',
1879
- style,
1880
- ...otherProps
1881
- }) => {
1882
- const {
1883
- isOpen,
1884
- close,
1885
- dropdownItemsRef,
1886
- selectedDropdownItemIndexRef,
1887
- id
1888
- } = useDropdown();
1889
- const dropdownPosition = useDropdownPosition();
1890
- const childrenLength = React__default.Children.toArray(children).length;
1891
-
1892
- const handleDownPress = () => {
1893
- var _dropdownItemsRef$cur;
1894
-
1895
- if (selectedDropdownItemIndexRef.current < childrenLength - 1) {
1896
- selectedDropdownItemIndexRef.current++;
1897
- } else {
1898
- selectedDropdownItemIndexRef.current = 0;
1899
- }
1900
-
1901
- dropdownItemsRef == null ? void 0 : (_dropdownItemsRef$cur = dropdownItemsRef.current[selectedDropdownItemIndexRef.current]) == null ? void 0 : _dropdownItemsRef$cur.focus();
1902
- };
1903
-
1904
- const handleUpPress = () => {
1905
- var _dropdownItemsRef$cur2;
1906
-
1907
- if (selectedDropdownItemIndexRef.current > 0) {
1908
- selectedDropdownItemIndexRef.current--;
1909
- } else {
1910
- selectedDropdownItemIndexRef.current = childrenLength - 1;
1911
- }
1912
-
1913
- dropdownItemsRef == null ? void 0 : (_dropdownItemsRef$cur2 = dropdownItemsRef.current[selectedDropdownItemIndexRef.current]) == null ? void 0 : _dropdownItemsRef$cur2.focus();
1914
- };
1915
-
1916
- const handleHomePress = () => {
1917
- var _dropdownItemsRef$cur3;
1918
-
1919
- selectedDropdownItemIndexRef.current = 0;
1920
- dropdownItemsRef == null ? void 0 : (_dropdownItemsRef$cur3 = dropdownItemsRef.current[selectedDropdownItemIndexRef.current]) == null ? void 0 : _dropdownItemsRef$cur3.focus();
1921
- };
1922
-
1923
- const handleEndPress = () => {
1924
- var _dropdownItemsRef$cur4;
1925
-
1926
- selectedDropdownItemIndexRef.current = childrenLength - 1;
1927
- dropdownItemsRef == null ? void 0 : (_dropdownItemsRef$cur4 = dropdownItemsRef.current[selectedDropdownItemIndexRef.current]) == null ? void 0 : _dropdownItemsRef$cur4.focus();
1928
- };
1929
-
1930
- const handleEscapePress = () => {
1931
- close == null ? void 0 : close();
1932
- };
1933
-
1934
- const handleBackdropKeyDown = event => {
1935
- if (event.defaultPrevented || event.key === 'Enter') {
1936
- return;
1937
- }
1938
-
1939
- event.preventDefault();
1940
- event.key === 'Escape' && handleEscapePress();
1941
- event.key === 'ArrowDown' && handleDownPress();
1942
- event.key === 'ArrowUp' && handleUpPress();
1943
- event.key === 'Home' && handleHomePress();
1944
- event.key === 'End' && handleEndPress();
1945
- event.stopPropagation();
1946
- };
1947
-
1948
- const clearChildrenReferences = () => {
1949
- dropdownItemsRef.current = [];
1950
- return null;
1951
- };
1952
-
1953
- return isOpen ? reactDom.createPortal(React__default.createElement("div", {
1954
- role: "presentation",
1955
- "data-store-dropdown-overlay": true,
1956
- onKeyDown: handleBackdropKeyDown,
1957
- "data-testid": `${testId}-overlay`
1958
- }, React__default.createElement("div", Object.assign({
1959
- role: "menu",
1960
- "aria-orientation": "vertical",
1961
- "data-store-dropdown-menu": true,
1962
- "data-testid": testId,
1963
- style: { ...dropdownPosition,
1964
- ...style
1965
- },
1966
- id: id
1967
- }, otherProps), children)), document.body) : clearChildrenReferences();
1968
- };
1969
-
1970
- const OutOfStock = ({
1971
- testId = 'store-out-of-stock',
1972
- children,
1973
- ...otherProps
1974
- }) => {
1975
- return React__default.createElement("section", {
1976
- "data-store-out-of-stock": true,
1977
- "data-testid": testId
1978
- }, React__default.createElement(Form, Object.assign({
1979
- "data-out-of-stock-form": true,
1980
- testId: `${testId}-form`
1981
- }, otherProps), children));
1982
- };
1983
-
1984
- const OutOfStockMessage = ({
1985
- as: MessageComponent = 'p',
1986
- testId = 'store-out-of-stock-message',
1987
- children,
1988
- ...otherProps
1989
- }) => {
1990
- return React__default.createElement(MessageComponent, Object.assign({
1991
- "data-out-of-stock-message": true,
1992
- "data-testid": testId
1993
- }, otherProps), children);
1994
- };
1995
-
1996
- const OutOfStockTitle = ({
1997
- as: TitleComponent = 'h2',
1998
- testId = 'store-out-of-stock-title',
1999
- children,
2000
- ...otherProps
2001
- }) => {
2002
- return React__default.createElement(TitleComponent, Object.assign({
2003
- "data-out-of-stock-title": true,
2004
- "data-testid": testId
2005
- }, otherProps), children);
2006
- };
2007
-
2008
- const Hero = /*#__PURE__*/React.forwardRef(function Hero({
2009
- testId = 'store-hero',
2010
- children,
2011
- ...otherProps
2012
- }, ref) {
2013
- return React__default.createElement("article", Object.assign({
2014
- ref: ref,
2015
- "data-store-hero": true,
2016
- "data-testid": testId
2017
- }, otherProps), children);
2018
- });
2019
-
2020
- const HeroImage = /*#__PURE__*/React.forwardRef(function HeroImage({
2021
- testId = 'store-hero-image',
2022
- children,
2023
- ...otherProps
2024
- }, ref) {
2025
- return React__default.createElement("div", Object.assign({
2026
- ref: ref,
2027
- "data-hero-image": true,
2028
- "data-testid": testId
2029
- }, otherProps), children);
2030
- });
2031
-
2032
- const HeroHeading = /*#__PURE__*/React.forwardRef(function HeroHeading({
2033
- testId = 'store-hero-heading',
2034
- children,
2035
- ...otherProps
2036
- }, ref) {
2037
- return React__default.createElement("header", Object.assign({
2038
- ref: ref,
2039
- "data-hero-heading": true,
2040
- "data-testid": testId
2041
- }, otherProps), children);
2042
- });
2043
-
2044
- exports.Accordion = Accordion;
2045
- exports.AccordionButton = AccordionButton;
2046
- exports.AccordionItem = AccordionItem;
2047
- exports.AccordionPanel = AccordionPanel;
2048
- exports.Alert = Alert;
2049
- exports.Badge = Badge;
2050
- exports.Banner = Banner;
2051
- exports.BannerContent = BannerContent;
2052
- exports.BannerImage = BannerImage;
2053
- exports.BannerLink = BannerLink;
2054
- exports.Breadcrumb = Breadcrumb;
2055
- exports.Bullets = Bullets;
2056
- exports.Button = Button;
2057
- exports.Card = Card;
2058
- exports.CardActions = CardActions;
2059
- exports.CardContent = CardContent;
2060
- exports.CardImage = CardImage;
2061
- exports.Carousel = Carousel;
2062
- exports.Checkbox = Checkbox;
2063
- exports.Dropdown = Dropdown;
2064
- exports.DropdownButton = DropdownButton;
2065
- exports.DropdownItem = DropdownItem;
2066
- exports.DropdownMenu = DropdownMenu;
2067
- exports.Form = Form;
2068
- exports.Hero = Hero;
2069
- exports.HeroHeading = HeroHeading;
2070
- exports.HeroImage = HeroImage;
2071
- exports.Icon = Icon;
2072
- exports.IconButton = IconButton;
2073
- exports.Incentive = Incentive;
2074
- exports.Input = Input;
2075
- exports.Label = Label;
2076
- exports.Link = Link;
2077
- exports.List = List;
2078
- exports.LoadingButton = LoadingButton;
2079
- exports.Modal = Modal;
2080
- exports.OutOfStock = OutOfStock;
2081
- exports.OutOfStockMessage = OutOfStockMessage;
2082
- exports.OutOfStockTitle = OutOfStockTitle;
2083
- exports.Overlay = Overlay;
2084
- exports.PaymentMethods = PaymentMethods;
2085
- exports.Popover = Popover;
2086
- exports.Price = Price;
2087
- exports.PriceRange = PriceRange;
2088
- exports.ProductCard = ProductCard;
2089
- exports.ProductCardActions = ProductCardActions;
2090
- exports.ProductCardContent = ProductCardContent;
2091
- exports.ProductCardImage = ProductCardImage;
2092
- exports.QuantitySelector = QuantitySelector;
2093
- exports.Radio = Radio;
2094
- exports.RadioGroup = RadioGroup;
2095
- exports.RadioOption = RadioOption;
2096
- exports.SearchInput = SearchInput;
2097
- exports.Select = Select;
2098
- exports.Skeleton = Skeleton;
2099
- exports.Slider = Slider;
2100
- exports.Spinner = Spinner;
2101
- exports.Table = Table;
2102
- exports.TableBody = TableBody;
2103
- exports.TableCell = TableCell;
2104
- exports.TableFooter = TableFooter;
2105
- exports.TableHead = TableHead;
2106
- exports.TableRow = TableRow;
2107
- exports.TextArea = TextArea;
2108
- exports.useSlider = useSlider;
2109
- //# sourceMappingURL=ui.cjs.development.js.map