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