pixelize-design-library 2.4.2-beta.55 → 2.4.2-beta.57

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 (365) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/COMPONENT-GOTCHAS.md +50 -22
  3. package/DESIGN-GUIDE.md +19 -2
  4. package/dist/Components/AddressCard/AddressCard.d.ts +4 -0
  5. package/dist/Components/AddressCard/AddressCard.js +25 -0
  6. package/dist/Components/AddressCard/AddressCardGroup.d.ts +4 -0
  7. package/dist/Components/AddressCard/AddressCardGroup.js +7 -0
  8. package/dist/Components/AddressCard/AddressCardProps.d.ts +43 -0
  9. package/dist/Components/AddressCard/AddressCardProps.js +2 -0
  10. package/dist/Components/BagBar/BagBar.d.ts +4 -0
  11. package/dist/Components/BagBar/BagBar.js +32 -0
  12. package/dist/Components/BagBar/BagBarProps.d.ts +30 -0
  13. package/dist/Components/BagBar/BagBarProps.js +2 -0
  14. package/dist/Components/CartItem/CartItem.d.ts +4 -0
  15. package/dist/Components/CartItem/CartItem.js +60 -0
  16. package/dist/Components/CartItem/CartItemProps.d.ts +64 -0
  17. package/dist/Components/CartItem/CartItemProps.js +2 -0
  18. package/dist/Components/CartItem/cartItemOptions.d.ts +3 -0
  19. package/dist/Components/CartItem/cartItemOptions.js +13 -0
  20. package/dist/Components/CheckoutKit/selectable.d.ts +58 -0
  21. package/dist/Components/CheckoutKit/selectable.js +120 -0
  22. package/dist/Components/Commerce/commerceTypes.d.ts +52 -0
  23. package/dist/Components/Commerce/commerceTypes.js +2 -0
  24. package/dist/Components/Commerce/commerceVariants.d.ts +13 -0
  25. package/dist/Components/Commerce/commerceVariants.js +51 -0
  26. package/dist/Components/Commerce/index.d.ts +2 -0
  27. package/dist/Components/Commerce/index.js +18 -0
  28. package/dist/Components/Commerce/useContainerWidth.d.ts +3 -0
  29. package/dist/Components/Commerce/useContainerWidth.js +25 -0
  30. package/dist/Components/CouponField/CouponField.d.ts +4 -0
  31. package/dist/Components/CouponField/CouponField.js +72 -0
  32. package/dist/Components/CouponField/CouponFieldProps.d.ts +49 -0
  33. package/dist/Components/CouponField/CouponFieldProps.js +2 -0
  34. package/dist/Components/DatePicker/DatePickerProps.d.ts +1 -1
  35. package/dist/Components/DatePicker/PickerPortal.d.ts +11 -0
  36. package/dist/Components/DatePicker/PickerPortal.js +26 -0
  37. package/dist/Components/DatePicker/RangeDatePicker.d.ts +1 -1
  38. package/dist/Components/DatePicker/RangeDatePicker.js +67 -32
  39. package/dist/Components/DatePicker/SingleDatePicker.js +49 -13
  40. package/dist/Components/DatePicker/TimeOnlyPicker.js +39 -4
  41. package/dist/Components/DetailSections/DetailSections.d.ts +4 -0
  42. package/dist/Components/DetailSections/DetailSections.js +112 -0
  43. package/dist/Components/DetailSections/DetailSectionsProps.d.ts +58 -0
  44. package/dist/Components/DetailSections/DetailSectionsProps.js +2 -0
  45. package/dist/Components/Input/PhoneNumberInputProps.d.ts +1 -1
  46. package/dist/Components/MediaGallery/MediaFrame.d.ts +31 -0
  47. package/dist/Components/MediaGallery/MediaFrame.js +55 -0
  48. package/dist/Components/MediaGallery/MediaGallery.d.ts +4 -0
  49. package/dist/Components/MediaGallery/MediaGallery.js +206 -0
  50. package/dist/Components/MediaGallery/MediaGalleryProps.d.ts +76 -0
  51. package/dist/Components/MediaGallery/MediaGalleryProps.js +20 -0
  52. package/dist/Components/MediaGallery/MediaLightbox.d.ts +4 -0
  53. package/dist/Components/MediaGallery/MediaLightbox.js +116 -0
  54. package/dist/Components/MediaGallery/MediaLightboxProps.d.ts +40 -0
  55. package/dist/Components/MediaGallery/MediaLightboxProps.js +15 -0
  56. package/dist/Components/MediaGallery/MediaThumb.d.ts +18 -0
  57. package/dist/Components/MediaGallery/MediaThumb.js +25 -0
  58. package/dist/Components/MediaGallery/glass.d.ts +31 -0
  59. package/dist/Components/MediaGallery/glass.js +47 -0
  60. package/dist/Components/MediaGallery/mediaGalleryModel.d.ts +22 -0
  61. package/dist/Components/MediaGallery/mediaGalleryModel.js +83 -0
  62. package/dist/Components/MediaGallery/motion.d.ts +5 -0
  63. package/dist/Components/MediaGallery/motion.js +12 -0
  64. package/dist/Components/MediaGallery/useMatchMedia.d.ts +2 -0
  65. package/dist/Components/MediaGallery/useMatchMedia.js +20 -0
  66. package/dist/Components/MultiSelect/MultiSelectProps.d.ts +1 -1
  67. package/dist/Components/OffersList/OffersList.d.ts +4 -0
  68. package/dist/Components/OffersList/OffersList.js +83 -0
  69. package/dist/Components/OffersList/OffersListProps.d.ts +34 -0
  70. package/dist/Components/OffersList/OffersListProps.js +2 -0
  71. package/dist/Components/OptionChip/OptionChip.d.ts +4 -0
  72. package/dist/Components/OptionChip/OptionChip.js +97 -0
  73. package/dist/Components/OptionChip/OptionChipProps.d.ts +33 -0
  74. package/dist/Components/OptionChip/OptionChipProps.js +2 -0
  75. package/dist/Components/OptionChip/optionInk.d.ts +12 -0
  76. package/dist/Components/OptionChip/optionInk.js +25 -0
  77. package/dist/Components/OrderStatusTimeline/OrderStatusTimeline.d.ts +4 -0
  78. package/dist/Components/OrderStatusTimeline/OrderStatusTimeline.js +57 -0
  79. package/dist/Components/OrderStatusTimeline/OrderStatusTimelineProps.d.ts +29 -0
  80. package/dist/Components/OrderStatusTimeline/OrderStatusTimelineProps.js +2 -0
  81. package/dist/Components/OrderSummary/OrderSummary.d.ts +4 -0
  82. package/dist/Components/OrderSummary/OrderSummary.js +63 -0
  83. package/dist/Components/OrderSummary/OrderSummaryProps.d.ts +53 -0
  84. package/dist/Components/OrderSummary/OrderSummaryProps.js +2 -0
  85. package/dist/Components/PaymentOption/PaymentOption.d.ts +4 -0
  86. package/dist/Components/PaymentOption/PaymentOption.js +24 -0
  87. package/dist/Components/PaymentOption/PaymentOptionGroup.d.ts +4 -0
  88. package/dist/Components/PaymentOption/PaymentOptionGroup.js +7 -0
  89. package/dist/Components/PaymentOption/PaymentOptionProps.d.ts +32 -0
  90. package/dist/Components/PaymentOption/PaymentOptionProps.js +2 -0
  91. package/dist/Components/PinInput/PinInputProps.d.ts +1 -1
  92. package/dist/Components/PincodeChecker/PincodeChecker.d.ts +4 -0
  93. package/dist/Components/PincodeChecker/PincodeChecker.js +175 -0
  94. package/dist/Components/PincodeChecker/PincodeCheckerProps.d.ts +57 -0
  95. package/dist/Components/PincodeChecker/PincodeCheckerProps.js +2 -0
  96. package/dist/Components/PriceBlock/PriceBlock.d.ts +4 -0
  97. package/dist/Components/PriceBlock/PriceBlock.js +41 -0
  98. package/dist/Components/PriceBlock/PriceBlockProps.d.ts +39 -0
  99. package/dist/Components/PriceBlock/PriceBlockProps.js +2 -0
  100. package/dist/Components/ProductBadges/ProductBadges.d.ts +4 -0
  101. package/dist/Components/ProductBadges/ProductBadges.js +61 -0
  102. package/dist/Components/ProductBadges/ProductBadgesProps.d.ts +18 -0
  103. package/dist/Components/ProductBadges/ProductBadgesProps.js +2 -0
  104. package/dist/Components/ProductCard/ProductCard.d.ts +3 -2
  105. package/dist/Components/ProductCard/ProductCard.js +103 -52
  106. package/dist/Components/ProductCard/ProductCardAction.d.ts +17 -0
  107. package/dist/Components/ProductCard/ProductCardAction.js +65 -0
  108. package/dist/Components/ProductCard/ProductCardGrid.d.ts +4 -0
  109. package/dist/Components/ProductCard/ProductCardGrid.js +20 -0
  110. package/dist/Components/ProductCard/ProductCardMedia.d.ts +18 -0
  111. package/dist/Components/ProductCard/ProductCardMedia.js +35 -0
  112. package/dist/Components/ProductCard/ProductCardProps.d.ts +138 -56
  113. package/dist/Components/ProductCard/ProductCardSkeleton.d.ts +4 -0
  114. package/dist/Components/ProductCard/ProductCardSkeleton.js +17 -0
  115. package/dist/Components/ProductCard/ProductCardSwatches.d.ts +15 -0
  116. package/dist/Components/ProductCard/ProductCardSwatches.js +37 -0
  117. package/dist/Components/ProductCard/QuickAddSheet.d.ts +4 -0
  118. package/dist/Components/ProductCard/QuickAddSheet.js +109 -0
  119. package/dist/Components/ProductCard/QuickAddSheetProps.d.ts +38 -0
  120. package/dist/Components/ProductCard/QuickAddSheetProps.js +2 -0
  121. package/dist/Components/ProductCard/cardLabels.d.ts +2 -0
  122. package/dist/Components/ProductCard/cardLabels.js +16 -0
  123. package/dist/Components/ProductCard/cardMetrics.d.ts +27 -0
  124. package/dist/Components/ProductCard/cardMetrics.js +55 -0
  125. package/dist/Components/ProductCard/productCardFixtures.d.ts +7 -0
  126. package/dist/Components/ProductCard/productCardFixtures.js +61 -0
  127. package/dist/Components/ProductCard/productCardModel.d.ts +22 -0
  128. package/dist/Components/ProductCard/productCardModel.js +79 -0
  129. package/dist/Components/ProductCard/useMinWidth.d.ts +2 -0
  130. package/dist/Components/ProductCard/useMinWidth.js +20 -0
  131. package/dist/Components/ProductDetails/ProductDetails.d.ts +3 -2
  132. package/dist/Components/ProductDetails/ProductDetails.js +209 -33
  133. package/dist/Components/ProductDetails/ProductDetailsProps.d.ts +143 -41
  134. package/dist/Components/ProductDetails/productDetailsModel.d.ts +14 -0
  135. package/dist/Components/ProductDetails/productDetailsModel.js +45 -0
  136. package/dist/Components/ProductDetails/useInViewport.d.ts +3 -0
  137. package/dist/Components/ProductDetails/useInViewport.js +18 -0
  138. package/dist/Components/QuantityStepper/QuantityStepper.d.ts +4 -0
  139. package/dist/Components/QuantityStepper/QuantityStepper.js +59 -0
  140. package/dist/Components/QuantityStepper/QuantityStepperProps.d.ts +24 -0
  141. package/dist/Components/QuantityStepper/QuantityStepperProps.js +2 -0
  142. package/dist/Components/Rating/Rating.d.ts +4 -0
  143. package/dist/Components/Rating/Rating.js +81 -0
  144. package/dist/Components/Rating/RatingProps.d.ts +27 -0
  145. package/dist/Components/Rating/RatingProps.js +2 -0
  146. package/dist/Components/ReviewList/ReviewList.d.ts +4 -0
  147. package/dist/Components/ReviewList/ReviewList.js +94 -0
  148. package/dist/Components/ReviewList/ReviewListProps.d.ts +68 -0
  149. package/dist/Components/ReviewList/ReviewListProps.js +2 -0
  150. package/dist/Components/ReviewSummary/ReviewSummary.d.ts +4 -0
  151. package/dist/Components/ReviewSummary/ReviewSummary.js +47 -0
  152. package/dist/Components/ReviewSummary/ReviewSummaryProps.d.ts +31 -0
  153. package/dist/Components/ReviewSummary/ReviewSummaryProps.js +2 -0
  154. package/dist/Components/Search/SearchProps.d.ts +1 -1
  155. package/dist/Components/SearchSelect/SearchSelectProps.d.ts +1 -1
  156. package/dist/Components/SegmentedControl/SegmentedControl.d.ts +1 -1
  157. package/dist/Components/SegmentedControl/SegmentedControl.js +17 -5
  158. package/dist/Components/SegmentedControl/SegmentedControlProps.d.ts +6 -0
  159. package/dist/Components/SegmentedControl/segmentedInk.d.ts +2 -0
  160. package/dist/Components/SegmentedControl/segmentedInk.js +4 -1
  161. package/dist/Components/SegmentedControl/useSlidingPill.d.ts +2 -0
  162. package/dist/Components/SegmentedControl/useSlidingPill.js +6 -1
  163. package/dist/Components/Select/SelectProps.d.ts +1 -1
  164. package/dist/Components/SelectSearch/SelectSearchProps.d.ts +1 -1
  165. package/dist/Components/SelectV2/SelectV2Props.d.ts +1 -1
  166. package/dist/Components/SideBar/SecondaryBar.js +13 -8
  167. package/dist/Components/SideBar/SideBarProps.d.ts +3 -1
  168. package/dist/Components/SideBar/components/MenuItemBox.js +47 -10
  169. package/dist/Components/SideBar/components/MenuPopoverContent.js +4 -3
  170. package/dist/Components/SpecTable/SpecTable.d.ts +4 -0
  171. package/dist/Components/SpecTable/SpecTable.js +39 -0
  172. package/dist/Components/SpecTable/SpecTableProps.d.ts +25 -0
  173. package/dist/Components/SpecTable/SpecTableProps.js +2 -0
  174. package/dist/Components/Spinner/Spinner.d.ts +1 -1
  175. package/dist/Components/Spinner/Spinner.js +2 -2
  176. package/dist/Components/Spinner/SpinnerProps.d.ts +2 -0
  177. package/dist/Components/StageProgress/StepperStage.js +2 -1
  178. package/dist/Components/StatCard/StatCard.d.ts +1 -1
  179. package/dist/Components/StatCard/StatCard.js +2 -2
  180. package/dist/Components/StatCard/StatCardProps.d.ts +4 -0
  181. package/dist/Components/StickyBuyBar/StickyBuyBar.d.ts +3 -0
  182. package/dist/Components/StickyBuyBar/StickyBuyBar.js +85 -0
  183. package/dist/Components/StickyBuyBar/StickyBuyBarProps.d.ts +54 -0
  184. package/dist/Components/StickyBuyBar/StickyBuyBarProps.js +2 -0
  185. package/dist/Components/StockStatus/StockStatus.d.ts +4 -0
  186. package/dist/Components/StockStatus/StockStatus.js +31 -0
  187. package/dist/Components/StockStatus/StockStatusProps.d.ts +14 -0
  188. package/dist/Components/StockStatus/StockStatusProps.js +2 -0
  189. package/dist/Components/Table/Table.js +2 -1
  190. package/dist/Components/Table/TableProps.d.ts +5 -2
  191. package/dist/Components/Table/columnLabel.d.ts +6 -0
  192. package/dist/Components/Table/columnLabel.js +27 -0
  193. package/dist/Components/Table/components/TableBody.js +5 -1
  194. package/dist/Components/Table/components/TableHeader.js +3 -2
  195. package/dist/Components/Table/filters/ActiveFilters.js +2 -1
  196. package/dist/Components/Table/filters/TableFilters.js +2 -1
  197. package/dist/Components/Table/hooks/useTable.js +3 -2
  198. package/dist/Components/Table/settings/ManageColumns.js +4 -3
  199. package/dist/Components/Table/settings/TableSettings.js +2 -1
  200. package/dist/Components/TrustBadges/TrustBadges.d.ts +4 -0
  201. package/dist/Components/TrustBadges/TrustBadges.js +24 -0
  202. package/dist/Components/TrustBadges/TrustBadgesProps.d.ts +20 -0
  203. package/dist/Components/TrustBadges/TrustBadgesProps.js +2 -0
  204. package/dist/Components/VariantSelector/VariantSelector.d.ts +4 -0
  205. package/dist/Components/VariantSelector/VariantSelector.js +123 -0
  206. package/dist/Components/VariantSelector/VariantSelectorProps.d.ts +27 -0
  207. package/dist/Components/VariantSelector/VariantSelectorProps.js +2 -0
  208. package/dist/Components/VariantSelector/variantSelection.d.ts +6 -0
  209. package/dist/Components/VariantSelector/variantSelection.js +25 -0
  210. package/dist/Components/WishlistToggle/WishlistToggle.d.ts +4 -0
  211. package/dist/Components/WishlistToggle/WishlistToggle.js +65 -0
  212. package/dist/Components/WishlistToggle/WishlistToggleProps.d.ts +19 -0
  213. package/dist/Components/WishlistToggle/WishlistToggleProps.js +2 -0
  214. package/dist/Theme/assertPalette.d.ts +1 -1
  215. package/dist/Theme/assertPalette.js +1 -1
  216. package/dist/Theme/tokens/brands/index.js +2 -0
  217. package/dist/Theme/tokens/brands/zinc/palette.dark.d.ts +1 -0
  218. package/dist/Theme/tokens/builders/buildDarkPalette.js +2 -0
  219. package/dist/Theme/tokens/builders/index.d.ts +1 -0
  220. package/dist/Theme/tokens/builders/index.js +1 -0
  221. package/dist/Theme/tokens/builders/rechartsTheme.d.ts +56 -0
  222. package/dist/Theme/tokens/builders/rechartsTheme.js +43 -0
  223. package/dist/Theme/tokens/builders/star.d.ts +3 -0
  224. package/dist/Theme/tokens/builders/star.js +8 -0
  225. package/dist/Theme/tokens/primitives/controlSizes.js +1 -1
  226. package/dist/Theme/tokens/types.d.ts +3 -1
  227. package/dist/Theme/useChartTheme.d.ts +4 -0
  228. package/dist/Theme/useChartTheme.js +12 -0
  229. package/dist/Utils/price.d.ts +16 -0
  230. package/dist/Utils/price.js +34 -0
  231. package/dist/esm/Components/AddressCard/AddressCard.js +20 -0
  232. package/dist/esm/Components/AddressCard/AddressCardGroup.js +5 -0
  233. package/dist/esm/Components/AddressCard/AddressCardProps.js +1 -0
  234. package/dist/esm/Components/BagBar/BagBar.js +27 -0
  235. package/dist/esm/Components/BagBar/BagBarProps.js +1 -0
  236. package/dist/esm/Components/CartItem/CartItem.js +55 -0
  237. package/dist/esm/Components/CartItem/CartItemProps.js +1 -0
  238. package/dist/esm/Components/CartItem/cartItemOptions.js +9 -0
  239. package/dist/esm/Components/CheckoutKit/selectable.js +112 -0
  240. package/dist/esm/Components/Commerce/commerceTypes.js +1 -0
  241. package/dist/esm/Components/Commerce/commerceVariants.js +41 -0
  242. package/dist/esm/Components/Commerce/index.js +2 -0
  243. package/dist/esm/Components/Commerce/useContainerWidth.js +21 -0
  244. package/dist/esm/Components/CouponField/CouponField.js +67 -0
  245. package/dist/esm/Components/CouponField/CouponFieldProps.js +1 -0
  246. package/dist/esm/Components/DatePicker/PickerPortal.js +21 -0
  247. package/dist/esm/Components/DatePicker/RangeDatePicker.js +34 -32
  248. package/dist/esm/Components/DatePicker/SingleDatePicker.js +16 -13
  249. package/dist/esm/Components/DatePicker/TimeOnlyPicker.js +6 -4
  250. package/dist/esm/Components/DetailSections/DetailSections.js +107 -0
  251. package/dist/esm/Components/DetailSections/DetailSectionsProps.js +1 -0
  252. package/dist/esm/Components/MediaGallery/MediaFrame.js +48 -0
  253. package/dist/esm/Components/MediaGallery/MediaGallery.js +201 -0
  254. package/dist/esm/Components/MediaGallery/MediaGalleryProps.js +17 -0
  255. package/dist/esm/Components/MediaGallery/MediaLightbox.js +78 -0
  256. package/dist/esm/Components/MediaGallery/MediaLightboxProps.js +12 -0
  257. package/dist/esm/Components/MediaGallery/MediaThumb.js +23 -0
  258. package/dist/esm/Components/MediaGallery/glass.js +42 -0
  259. package/dist/esm/Components/MediaGallery/mediaGalleryModel.js +71 -0
  260. package/dist/esm/Components/MediaGallery/motion.js +8 -0
  261. package/dist/esm/Components/MediaGallery/useMatchMedia.js +16 -0
  262. package/dist/esm/Components/OffersList/OffersList.js +81 -0
  263. package/dist/esm/Components/OffersList/OffersListProps.js +1 -0
  264. package/dist/esm/Components/OptionChip/OptionChip.js +95 -0
  265. package/dist/esm/Components/OptionChip/OptionChipProps.js +1 -0
  266. package/dist/esm/Components/OptionChip/optionInk.js +21 -0
  267. package/dist/esm/Components/OrderStatusTimeline/OrderStatusTimeline.js +55 -0
  268. package/dist/esm/Components/OrderStatusTimeline/OrderStatusTimelineProps.js +1 -0
  269. package/dist/esm/Components/OrderSummary/OrderSummary.js +58 -0
  270. package/dist/esm/Components/OrderSummary/OrderSummaryProps.js +1 -0
  271. package/dist/esm/Components/PaymentOption/PaymentOption.js +19 -0
  272. package/dist/esm/Components/PaymentOption/PaymentOptionGroup.js +5 -0
  273. package/dist/esm/Components/PaymentOption/PaymentOptionProps.js +1 -0
  274. package/dist/esm/Components/PincodeChecker/PincodeChecker.js +170 -0
  275. package/dist/esm/Components/PincodeChecker/PincodeCheckerProps.js +1 -0
  276. package/dist/esm/Components/PriceBlock/PriceBlock.js +39 -0
  277. package/dist/esm/Components/PriceBlock/PriceBlockProps.js +1 -0
  278. package/dist/esm/Components/ProductBadges/ProductBadges.js +59 -0
  279. package/dist/esm/Components/ProductBadges/ProductBadgesProps.js +1 -0
  280. package/dist/esm/Components/ProductCard/ProductCard.js +105 -54
  281. package/dist/esm/Components/ProductCard/ProductCardAction.js +60 -0
  282. package/dist/esm/Components/ProductCard/ProductCardGrid.js +18 -0
  283. package/dist/esm/Components/ProductCard/ProductCardMedia.js +33 -0
  284. package/dist/esm/Components/ProductCard/ProductCardSkeleton.js +12 -0
  285. package/dist/esm/Components/ProductCard/ProductCardSwatches.js +35 -0
  286. package/dist/esm/Components/ProductCard/QuickAddSheet.js +71 -0
  287. package/dist/esm/Components/ProductCard/QuickAddSheetProps.js +1 -0
  288. package/dist/esm/Components/ProductCard/cardLabels.js +13 -0
  289. package/dist/esm/Components/ProductCard/cardMetrics.js +52 -0
  290. package/dist/esm/Components/ProductCard/productCardFixtures.js +58 -0
  291. package/dist/esm/Components/ProductCard/productCardModel.js +65 -0
  292. package/dist/esm/Components/ProductCard/useMinWidth.js +16 -0
  293. package/dist/esm/Components/ProductDetails/ProductDetails.js +210 -34
  294. package/dist/esm/Components/ProductDetails/productDetailsModel.js +35 -0
  295. package/dist/esm/Components/ProductDetails/useInViewport.js +14 -0
  296. package/dist/esm/Components/QuantityStepper/QuantityStepper.js +57 -0
  297. package/dist/esm/Components/QuantityStepper/QuantityStepperProps.js +1 -0
  298. package/dist/esm/Components/Rating/Rating.js +79 -0
  299. package/dist/esm/Components/Rating/RatingProps.js +1 -0
  300. package/dist/esm/Components/ReviewList/ReviewList.js +89 -0
  301. package/dist/esm/Components/ReviewList/ReviewListProps.js +1 -0
  302. package/dist/esm/Components/ReviewSummary/ReviewSummary.js +42 -0
  303. package/dist/esm/Components/ReviewSummary/ReviewSummaryProps.js +1 -0
  304. package/dist/esm/Components/SegmentedControl/SegmentedControl.js +19 -7
  305. package/dist/esm/Components/SegmentedControl/segmentedInk.js +2 -0
  306. package/dist/esm/Components/SegmentedControl/useSlidingPill.js +6 -1
  307. package/dist/esm/Components/SideBar/SecondaryBar.js +14 -9
  308. package/dist/esm/Components/SideBar/components/MenuItemBox.js +14 -10
  309. package/dist/esm/Components/SideBar/components/MenuPopoverContent.js +4 -3
  310. package/dist/esm/Components/SpecTable/SpecTable.js +34 -0
  311. package/dist/esm/Components/SpecTable/SpecTableProps.js +1 -0
  312. package/dist/esm/Components/Spinner/Spinner.js +2 -2
  313. package/dist/esm/Components/StageProgress/StepperStage.js +2 -1
  314. package/dist/esm/Components/StatCard/StatCard.js +2 -2
  315. package/dist/esm/Components/StickyBuyBar/StickyBuyBar.js +80 -0
  316. package/dist/esm/Components/StickyBuyBar/StickyBuyBarProps.js +1 -0
  317. package/dist/esm/Components/StockStatus/StockStatus.js +29 -0
  318. package/dist/esm/Components/StockStatus/StockStatusProps.js +1 -0
  319. package/dist/esm/Components/Table/Table.js +2 -1
  320. package/dist/esm/Components/Table/columnLabel.js +21 -0
  321. package/dist/esm/Components/Table/components/TableBody.js +5 -1
  322. package/dist/esm/Components/Table/components/TableHeader.js +3 -2
  323. package/dist/esm/Components/Table/filters/ActiveFilters.js +2 -1
  324. package/dist/esm/Components/Table/filters/TableFilters.js +2 -1
  325. package/dist/esm/Components/Table/hooks/useTable.js +3 -2
  326. package/dist/esm/Components/Table/settings/ManageColumns.js +4 -3
  327. package/dist/esm/Components/Table/settings/TableSettings.js +2 -1
  328. package/dist/esm/Components/TrustBadges/TrustBadges.js +22 -0
  329. package/dist/esm/Components/TrustBadges/TrustBadgesProps.js +1 -0
  330. package/dist/esm/Components/VariantSelector/VariantSelector.js +118 -0
  331. package/dist/esm/Components/VariantSelector/VariantSelectorProps.js +1 -0
  332. package/dist/esm/Components/VariantSelector/variantSelection.js +19 -0
  333. package/dist/esm/Components/WishlistToggle/WishlistToggle.js +63 -0
  334. package/dist/esm/Components/WishlistToggle/WishlistToggleProps.js +1 -0
  335. package/dist/esm/Theme/assertPalette.js +1 -1
  336. package/dist/esm/Theme/tokens/brands/index.js +2 -0
  337. package/dist/esm/Theme/tokens/builders/buildDarkPalette.js +2 -0
  338. package/dist/esm/Theme/tokens/builders/index.js +1 -0
  339. package/dist/esm/Theme/tokens/builders/rechartsTheme.js +37 -0
  340. package/dist/esm/Theme/tokens/builders/star.js +4 -0
  341. package/dist/esm/Theme/tokens/primitives/controlSizes.js +1 -1
  342. package/dist/esm/Theme/useChartTheme.js +8 -0
  343. package/dist/esm/Utils/price.js +27 -0
  344. package/dist/esm/index.js +36 -0
  345. package/dist/index.d.ts +66 -0
  346. package/dist/index.js +86 -4
  347. package/package.json +1 -1
  348. package/dist/Components/ProductCard/ProductLabel.d.ts +0 -7
  349. package/dist/Components/ProductCard/ProductLabel.js +0 -20
  350. package/dist/Components/ProductCard/ProductPrice.d.ts +0 -10
  351. package/dist/Components/ProductCard/ProductPrice.js +0 -126
  352. package/dist/Components/ProductCard/ProductReview.d.ts +0 -8
  353. package/dist/Components/ProductCard/ProductReview.js +0 -30
  354. package/dist/Components/ProductCard/ProductTags.d.ts +0 -8
  355. package/dist/Components/ProductCard/ProductTags.js +0 -53
  356. package/dist/Components/ProductDetails/ProductDtlPrice.d.ts +0 -7
  357. package/dist/Components/ProductDetails/ProductDtlPrice.js +0 -24
  358. package/dist/Components/ProductDetails/ProductImageSlider.d.ts +0 -13
  359. package/dist/Components/ProductDetails/ProductImageSlider.js +0 -240
  360. package/dist/esm/Components/ProductCard/ProductLabel.js +0 -18
  361. package/dist/esm/Components/ProductCard/ProductPrice.js +0 -121
  362. package/dist/esm/Components/ProductCard/ProductReview.js +0 -28
  363. package/dist/esm/Components/ProductCard/ProductTags.js +0 -48
  364. package/dist/esm/Components/ProductDetails/ProductDtlPrice.js +0 -22
  365. package/dist/esm/Components/ProductDetails/ProductImageSlider.js +0 -204
@@ -1,57 +1,139 @@
1
- /** Card size; drives width, image height and padding via ProductCard's own sizeStyles map. */
2
- export type SizeType = "xs" | "sm" | "md" | "lg";
3
- /** Compact catalog/grid tile (image + price + cart actions) — for a full gallery/description page use ProductDetails instead. */
4
- export type ProductCardProps = {
5
- id: string | number;
6
- label: string;
7
- /** Accepted by the type but never read by ProductCard — passing it has no effect. */
8
- description?: string;
9
- productImage: productImage[];
10
- /** Renders nothing at all past 4 tags — ProductTags' row layout has no case for 5 or more. */
11
- tags?: string[];
12
- rating?: string | number;
13
- reviews?: string | number;
14
- /** Non-empty when provided — `[]` crashes the price dropdown; selection won't refresh if this array is later replaced. */
15
- options?: options[];
16
- onClick?: () => void;
17
- button?: {
18
- label: string;
19
- onClick: () => void;
20
- };
21
- onAddToCart?: (id: string | number, var_id: number, qty?: number) => void;
22
- onNotifyMe?: (id: string | number, var_id: number) => void;
23
- /** Also fires once on mount for the default (first) option, not only when the shopper picks a different one. */
24
- onOptionChange?: (option: options) => void;
25
- addToCart?: boolean;
26
- goToCart?: boolean;
27
- notifyMe?: boolean;
28
- OnGoToCart?: () => void;
29
- batch?: batch;
30
- size?: SizeType;
31
- /** Accepted by the type but never read anywhere in ProductCard — always a no-op regardless of value. */
32
- avalabilitys?: boolean;
33
- isQtyEditable?: boolean;
34
- displayRating?: boolean;
35
- };
36
- /** One purchase variant (weight/price/stock) shown in the price dropdown; var_id identifies it to cart callbacks. */
37
- export type options = {
38
- label: string;
39
- weight: number;
40
- unit?: number;
1
+ import type { ComponentPropsWithoutRef, ElementType, MouseEvent, ReactNode } from "react";
2
+ import type { OptionAxis, PriceFormat, ProductBadge, ProductMedia, ProductVariant } from "../Commerce/commerceTypes";
3
+ import type { UnitPrice } from "../../Utils/price";
4
+ import type { QuickAddPresentation, QuickAddSheetProps } from "./QuickAddSheetProps";
5
+ /** grid fills its column, list is a horizontal row with the action in the body, rail is a fixed-width scroll-snap item. */
6
+ export type ProductCardLayout = "grid" | "list" | "rail";
7
+ /** Type, insets and the add affordance scale together: compact is the 173 px phone 2-up, spacious the desktop 4-up. */
8
+ export type ProductCardDensity = "compact" | "comfortable" | "spacious";
9
+ /** Ratio of the media well; images cover it, so one ratio per grid keeps rows level. */
10
+ export type ProductCardAspectRatio = "4/5" | "1/1" | "3/4";
11
+ /** What the primary control does: choose options in the sheet, add at once, or ask to be notified. */
12
+ export type ProductCardAction = "options" | "add" | "notify";
13
+ /** Fires when the card (title link or button) is pressed anywhere outside its own controls. */
14
+ export type ProductCardPressHandler = (event: MouseEvent<HTMLElement>) => void;
15
+ /** Visible and screen-reader copy of the card's own controls; override every string for another language. */
16
+ export interface ProductCardLabels {
17
+ /** Wishlist button name, given the product title. */
18
+ save: (title: string) => string;
19
+ /** Name of the control that opens the option sheet, given the product title. */
20
+ chooseOptions: (title: string) => string;
21
+ /** Name of the control that adds a product with no options, given the product title. */
22
+ addToBag: (title: string) => string;
23
+ /** Visible text of the notify control. */
24
+ notifyMe: string;
25
+ /** Name of the notify control, given the product title. */
26
+ notifyMeFor: (title: string) => string;
27
+ /** Visible text on the hover bar of a spacious card whose action opens options. */
28
+ chooseOptionsText: string;
29
+ /** Visible text on the hover bar of a spacious card that adds directly. */
30
+ addToBagText: string;
31
+ /** Status text of an unavailable product. */
32
+ soldOut: string;
33
+ /** Screen-reader text added to a selected card. */
34
+ selected: string;
35
+ /** Screen-reader text after the "+N" swatch count, given N. */
36
+ moreColours: (count: number) => string;
37
+ /** Image fallback text. */
38
+ imageUnavailable: string;
39
+ }
40
+ /** Product card for listings, rails and search: media, brand, title, rating, price, swatches and one action; owns no product vocabulary beyond `axes`. */
41
+ export interface ProductCardProps extends PriceFormat {
42
+ title: string;
43
+ /** Muted line above the title; own-brand stores omit it. */
44
+ brand?: string;
45
+ /** First frame is the primary image, the second is the hover frame; every frame is also the pool `mediaIdsByOption` points into. */
46
+ media: ProductMedia[];
47
+ /** Alt text for the primary image when the media item has none; defaults to the title. */
48
+ alt?: string;
49
+ /** Selling price; a range replaces it when `variants` differ in price. */
41
50
  price: number;
42
- offer: number;
43
- var_id: number;
44
- stocks: number;
45
- };
46
- /** Corner ribbon badge on the product image (e.g. "Sale"); color defaults to green when unset. */
47
- export type batch = {
48
- label: string;
49
- color?: string;
50
- };
51
- /** One gallery image; the first two (after filtering isImage !== false) are the cover and hover-swap. */
52
- export type productImage = {
53
- imageUrl: string;
54
- imageId: number;
55
- order: number;
56
- isImage?: boolean;
57
- };
51
+ /** List price; the strike and discount show only when above `price` and the product is in stock. */
52
+ mrp?: number;
53
+ /** A `unitPrice()` result or a ready string, shown under the price. */
54
+ unitPrice?: UnitPrice | string | null;
55
+ /** 0 to 5; the row is hidden when missing or 0, never rendered as "0 reviews". */
56
+ rating?: number;
57
+ ratingCount?: number;
58
+ /** Badges in priority order; at most two are drawn, and none on a sold-out card. */
59
+ badges?: ProductBadge[];
60
+ /** Option axes; any axis with more than one value makes the primary action open the quick-add sheet. */
61
+ axes?: OptionAxis[];
62
+ /** Variants the axes resolve to; drive availability, the price range and the sheet's confirm button. */
63
+ variants?: ProductVariant[];
64
+ /** Maps `"<axisId>:<valueId>"` to the media ids shown for that value, so a swatch swaps the card image. */
65
+ mediaIdsByOption?: Record<string, string[]>;
66
+ /** Most colour dots shown before "+N". */
67
+ swatchLimit?: number;
68
+ /** Units left for a product without variants; shown as "Only N left" at or under the low-stock threshold. */
69
+ stock?: number;
70
+ /** Forces the sold-out state; derived from `variants` or `stock` when omitted. */
71
+ outOfStock?: boolean;
72
+ /** Renders the title as a link and makes the whole card its target. */
73
+ href?: string;
74
+ /** Component for the title link, e.g. a router Link; receives `href` and `linkProps`. */
75
+ linkAs?: ElementType;
76
+ /** Extra props for the title link, e.g. `{ to: "/p/jacket" }` for a router Link. */
77
+ linkProps?: Omit<ComponentPropsWithoutRef<"a">, "href" | "onClick">;
78
+ /** Makes the title a stretched button when there is no `href`, or runs beside navigation when there is. */
79
+ onPress?: ProductCardPressHandler;
80
+ layout?: ProductCardLayout;
81
+ density?: ProductCardDensity;
82
+ aspectRatio?: ProductCardAspectRatio;
83
+ /** Overrides the action derived from the data (notify when sold out, options when an axis has choices, else add). */
84
+ action?: ProductCardAction;
85
+ /** Units in the bag; above 0 the add control becomes a stepper. Omit to let the card track it after a direct add. */
86
+ quantity?: number;
87
+ /** Fires from the stepper; 0 means the shopper removed the product. */
88
+ onQuantityChange?: (quantity: number) => void;
89
+ /** How the quick-add sheet opens; `auto` follows the window width, so pass `drawer` inside a phone-width frame. */
90
+ quickAddPresentation?: QuickAddPresentation;
91
+ /** Forwarded to the quick-add drawer panel; the drawer portals to the window; see `QuickAddSheetProps.drawerContentProps` for capping its width. */
92
+ quickAddDrawerProps?: QuickAddSheetProps["drawerContentProps"];
93
+ /** Fires on a direct add (quantity 1) and from the quick-add sheet; `variantId` is the chosen variant when one is known. */
94
+ onAdd?: (variantId: string | undefined, quantity: number) => void;
95
+ /** Fires when the stepper's minus is pressed at 1, after `onQuantityChange(0)`. */
96
+ onRemove?: () => void;
97
+ /** Fires from the notify control of a sold-out card. */
98
+ onNotify?: () => void;
99
+ /** Controlled wishlist state. */
100
+ wishlisted?: boolean;
101
+ onWishlistChange?: (wishlisted: boolean) => void;
102
+ /** Marks the card as chosen (compare, bulk select): a ring on the media and a check, never colour alone. */
103
+ selected?: boolean;
104
+ /** Renders the skeleton with the same box model, so nothing shifts on load. */
105
+ isLoading?: boolean;
106
+ /** Glass content laid over the media well, clear of the badge, wishlist and action corners. */
107
+ mediaOverlay?: ReactNode;
108
+ /** Replaces the default meta line (low-stock status) under the price; sold-out status stays. */
109
+ meta?: ReactNode;
110
+ /** Replaces the derived add control, keeping its footprint. */
111
+ actions?: ReactNode;
112
+ labels?: Partial<ProductCardLabels>;
113
+ "data-testid"?: string;
114
+ }
115
+ /** Skeleton with the card's box model; pass the same layout, density and ratio as the loaded cards. */
116
+ export interface ProductCardSkeletonProps {
117
+ layout?: ProductCardLayout;
118
+ density?: ProductCardDensity;
119
+ aspectRatio?: ProductCardAspectRatio;
120
+ "data-testid"?: string;
121
+ }
122
+ /** Column counts per breakpoint of a card grid. */
123
+ export type ProductCardGridColumns = Partial<Record<"base" | "sm" | "md" | "lg" | "xl", number>>;
124
+ /** Responsive grid for cards: 2 columns on a phone up to 5 on a wide screen, equal-height rows, one gap scale. */
125
+ export interface ProductCardGridProps {
126
+ /** One card per child; each is wrapped in a list item that stretches it to the row height. */
127
+ children: ReactNode;
128
+ /** Columns per breakpoint; defaults to 2, 3 from md, 4 from lg and 5 from xl. */
129
+ columns?: ProductCardGridColumns;
130
+ /** Gap on both axes, overriding the window-based gaps; a number is in Chakra space units, a string any CSS length. */
131
+ gap?: string | number;
132
+ /** Column gap only; wins over `gap`. */
133
+ columnGap?: string | number;
134
+ /** Row gap only; wins over `gap`. */
135
+ rowGap?: string | number;
136
+ /** Accessible name of the list, e.g. "Jackets". */
137
+ "aria-label"?: string;
138
+ "data-testid"?: string;
139
+ }
@@ -0,0 +1,4 @@
1
+ import type { ProductCardSkeletonProps } from "./ProductCardProps";
2
+ /** Loading twin of ProductCard: same media ratio, title reservation and gaps, so the swap never moves the grid. */
3
+ declare const ProductCardSkeleton: ({ layout, density, aspectRatio, "data-testid": testId, }: ProductCardSkeletonProps) => import("react/jsx-runtime").JSX.Element;
4
+ export default ProductCardSkeleton;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const react_1 = require("@chakra-ui/react");
8
+ const Skeletons_1 = __importDefault(require("../Skeletons/Skeletons"));
9
+ const cardMetrics_1 = require("./cardMetrics");
10
+ /** Loading twin of ProductCard: same media ratio, title reservation and gaps, so the swap never moves the grid. */
11
+ const ProductCardSkeleton = ({ layout = "grid", density = "compact", aspectRatio = "4/5", "data-testid": testId, }) => {
12
+ const m = cardMetrics_1.DENSITY[density];
13
+ const horizontal = layout === "list";
14
+ const rail = layout === "rail";
15
+ return ((0, jsx_runtime_1.jsxs)(react_1.Flex, { "aria-busy": "true", "data-testid": testId, "data-layout": layout, direction: horizontal ? "row" : "column", gap: horizontal ? 3 : 0, w: rail ? m.railWidth : "100%", h: "100%", minW: 0, flexShrink: rail ? 0 : undefined, children: [(0, jsx_runtime_1.jsx)(react_1.VisuallyHidden, { children: "Loading product" }), (0, jsx_runtime_1.jsx)(react_1.Box, { flexShrink: 0, w: horizontal ? m.listMedia : "100%", borderRadius: cardMetrics_1.MEDIA_RADIUS, overflow: "hidden", sx: { aspectRatio: cardMetrics_1.CSS_RATIO[aspectRatio] }, children: (0, jsx_runtime_1.jsx)(Skeletons_1.default, { type: "skeleton", height: "100%", width: "100%", borderRadius: cardMetrics_1.MEDIA_RADIUS }) }), (0, jsx_runtime_1.jsxs)(react_1.Flex, { direction: "column", flex: 1, minW: 0, gap: m.bodyGap, pt: horizontal ? 0 : m.bodyTop, "aria-hidden": true, children: [(0, jsx_runtime_1.jsx)(Skeletons_1.default, { type: "skeleton", height: `${m.brand.line - 4}px`, width: "35%" }), (0, jsx_runtime_1.jsxs)(react_1.Flex, { direction: "column", gap: "4px", minH: `${m.title.line * cardMetrics_1.TITLE_LINES}px`, justify: "center", children: [(0, jsx_runtime_1.jsx)(Skeletons_1.default, { type: "skeleton", height: `${m.title.line - 6}px`, width: "92%" }), (0, jsx_runtime_1.jsx)(Skeletons_1.default, { type: "skeleton", height: `${m.title.line - 6}px`, width: "60%" })] }), (0, jsx_runtime_1.jsx)(Skeletons_1.default, { type: "skeleton", height: "1rem", width: "45%" }), (0, jsx_runtime_1.jsx)(Skeletons_1.default, { type: "skeleton", height: "1.25rem", width: "55%" })] })] }));
16
+ };
17
+ exports.default = ProductCardSkeleton;
@@ -0,0 +1,15 @@
1
+ import type { OptionAxis } from "../Commerce/commerceTypes";
2
+ import type { ProductCardLabels } from "./ProductCardProps";
3
+ type ProductCardSwatchesProps = {
4
+ axis: OptionAxis;
5
+ limit: number;
6
+ dot: number;
7
+ activeId: string;
8
+ soldOutIds: ReadonlySet<string>;
9
+ labels: ProductCardLabels;
10
+ onPreview: (valueId: string | null) => void;
11
+ onPick: (valueId: string) => void;
12
+ };
13
+ /** Colour dots for the first swatch axis: hover or focus previews the image, a press keeps it. */
14
+ declare const ProductCardSwatches: ({ axis, limit, dot, activeId, soldOutIds, labels, onPreview, onPick }: ProductCardSwatchesProps) => import("react/jsx-runtime").JSX.Element;
15
+ export default ProductCardSwatches;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ const react_1 = require("react");
5
+ const react_2 = require("@chakra-ui/react");
6
+ const useCustomTheme_1 = require("../../Theme/useCustomTheme");
7
+ const motion_1 = require("../../Theme/tokens/primitives/motion");
8
+ const motion_2 = require("../../Theme/chakra/motion");
9
+ const focusRing_styles_1 = require("../../Theme/chakra/focusRing.styles");
10
+ const TARGET = "1.5rem";
11
+ const UNAVAILABLE_OPACITY = 0.45;
12
+ /** Colour dots for the first swatch axis: hover or focus previews the image, a press keeps it. */
13
+ const ProductCardSwatches = ({ axis, limit, dot, activeId, soldOutIds, labels, onPreview, onPick }) => {
14
+ const { colors } = (0, useCustomTheme_1.useCustomTheme)();
15
+ const cells = (0, react_1.useRef)([]);
16
+ const shown = axis.values.slice(0, limit);
17
+ const rest = axis.values.length - shown.length;
18
+ const activeIndex = Math.max(0, shown.findIndex((value) => value.id === activeId));
19
+ const onKeyDown = (event) => {
20
+ var _a;
21
+ const step = event.key === "ArrowRight" || event.key === "ArrowDown" ? 1 : event.key === "ArrowLeft" || event.key === "ArrowUp" ? -1 : 0;
22
+ if (step === 0)
23
+ return;
24
+ event.preventDefault();
25
+ const next = (activeIndex + step + shown.length) % shown.length;
26
+ onPick(shown[next].id);
27
+ (_a = cells.current[next]) === null || _a === void 0 ? void 0 : _a.focus();
28
+ };
29
+ return ((0, jsx_runtime_1.jsxs)(react_2.Flex, { "data-control": true, position: "relative", zIndex: 2, align: "center", minH: TARGET, ml: "-0.375rem", maxW: "100%", children: [(0, jsx_runtime_1.jsx)(react_2.Flex, { role: "radiogroup", "aria-label": axis.label, onKeyDown: onKeyDown, onMouseLeave: () => onPreview(null), children: shown.map((value, index) => {
30
+ const selected = value.id === activeId;
31
+ const soldOut = soldOutIds.has(value.id);
32
+ return ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "button", type: "button", role: "radio", ref: (el) => {
33
+ cells.current[index] = el;
34
+ }, "aria-checked": selected, "aria-label": soldOut ? `${value.label}, ${labels.soldOut.toLowerCase()}` : value.label, tabIndex: index === activeIndex ? 0 : -1, title: value.label, onClick: () => onPick(value.id), onMouseEnter: () => onPreview(value.id), onFocus: () => onPreview(value.id), onBlur: () => onPreview(null), display: "inline-flex", alignItems: "center", justifyContent: "center", boxSize: TARGET, flexShrink: 0, borderRadius: "full", cursor: "pointer", sx: { outline: "none", ...(0, focusRing_styles_1.focusVisibleStyles)(colors) }, children: (0, jsx_runtime_1.jsx)(react_2.Box, { as: "span", display: "inline-flex", p: "2px", borderWidth: "2px", borderStyle: "solid", borderRadius: "full", borderColor: selected ? colors.header[900] : "transparent", transition: (0, motion_1.transitionFor)(["border-color"]), sx: (0, motion_2.reducedMotionSx)(), children: (0, jsx_runtime_1.jsx)(react_2.Box, { as: "span", display: "block", boxSize: `${dot}px`, borderRadius: "full", backgroundColor: value.swatch, opacity: soldOut ? UNAVAILABLE_OPACITY : 1, boxShadow: `inset 0 0 0 1px ${colors.boxborder[200]}` }) }) }, value.id));
35
+ }) }), rest > 0 ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_2.Text, { as: "span", "aria-hidden": true, ml: 1, fontSize: "0.75rem", fontWeight: 500, color: colors.textMuted, sx: { fontVariantNumeric: "tabular-nums" }, children: ["+", rest] }), (0, jsx_runtime_1.jsx)(react_2.VisuallyHidden, { children: labels.moreColours(rest) })] })) : null] }));
36
+ };
37
+ exports.default = ProductCardSwatches;
@@ -0,0 +1,4 @@
1
+ import type { QuickAddSheetProps } from "./QuickAddSheetProps";
2
+ /** Bottom sheet on phones, centred panel on desktop; holds the option picker so a card never grows. */
3
+ declare const QuickAddSheet: ({ isOpen, onClose, title, brand, media, axes, variants, defaultSelection, onConfirm, presentation, drawerContentProps, labels, currency, locale, "data-testid": testId, }: QuickAddSheetProps) => import("react/jsx-runtime").JSX.Element;
4
+ export default QuickAddSheet;
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ const jsx_runtime_1 = require("react/jsx-runtime");
40
+ const react_1 = require("react");
41
+ const react_2 = require("@chakra-ui/react");
42
+ const useCustomTheme_1 = require("../../Theme/useCustomTheme");
43
+ const price_1 = require("../../Utils/price");
44
+ const Button_1 = __importDefault(require("../Button/Button"));
45
+ const Drawer_1 = __importStar(require("../Drawer/Drawer"));
46
+ const Modal_1 = __importStar(require("../Modal/Modal"));
47
+ const PriceBlock_1 = __importDefault(require("../PriceBlock/PriceBlock"));
48
+ const QuantityStepper_1 = __importDefault(require("../QuantityStepper/QuantityStepper"));
49
+ const VariantSelector_1 = __importDefault(require("../VariantSelector/VariantSelector"));
50
+ const commerceVariants_1 = require("../Commerce/commerceVariants");
51
+ const productCardModel_1 = require("./productCardModel");
52
+ const useMinWidth_1 = require("./useMinWidth");
53
+ const DEFAULT_LABELS = {
54
+ heading: "Choose options",
55
+ quantity: "Quantity",
56
+ confirm: "Add to bag",
57
+ confirmWithTotal: (total) => `Add to bag — ${total}`,
58
+ prompt: (axisLabel) => `Select a ${axisLabel}`,
59
+ };
60
+ const DESKTOP_QUERY = "(min-width: 48em)";
61
+ /** Bottom sheet on phones, centred panel on desktop; holds the option picker so a card never grows. */
62
+ const QuickAddSheet = ({ isOpen, onClose, title, brand, media, axes, variants, defaultSelection, onConfirm, presentation = "auto", drawerContentProps, labels, currency, locale, "data-testid": testId, }) => {
63
+ var _a, _b, _c;
64
+ const { colors } = (0, useCustomTheme_1.useCustomTheme)();
65
+ const desktop = (0, useMinWidth_1.useMinWidth)(DESKTOP_QUERY);
66
+ const copy = { ...DEFAULT_LABELS, ...labels };
67
+ const [selection, setSelection] = (0, react_1.useState)(defaultSelection !== null && defaultSelection !== void 0 ? defaultSelection : {});
68
+ const [quantity, setQuantity] = (0, react_1.useState)(1);
69
+ const [error, setError] = (0, react_1.useState)();
70
+ const [wasOpen, setWasOpen] = (0, react_1.useState)(isOpen);
71
+ if (isOpen !== wasOpen) {
72
+ setWasOpen(isOpen);
73
+ if (isOpen) {
74
+ setSelection(defaultSelection !== null && defaultSelection !== void 0 ? defaultSelection : {});
75
+ setQuantity(1);
76
+ setError(undefined);
77
+ }
78
+ }
79
+ const fmt = { currency, locale };
80
+ const variant = (0, commerceVariants_1.findVariant)(axes, variants, selection);
81
+ const range = (0, productCardModel_1.rangeOf)(variants);
82
+ const maxQuantity = (variant === null || variant === void 0 ? void 0 : variant.stock) !== undefined && variant.stock > 0 ? variant.stock : undefined;
83
+ const confirmLabel = variant ? copy.confirmWithTotal((0, price_1.formatPrice)(variant.price * quantity, fmt)) : copy.confirm;
84
+ const onSelect = (next) => {
85
+ setSelection(next);
86
+ setError(undefined);
87
+ const nextVariant = (0, commerceVariants_1.findVariant)(axes, variants, next);
88
+ if ((nextVariant === null || nextVariant === void 0 ? void 0 : nextVariant.stock) !== undefined && nextVariant.stock > 0)
89
+ setQuantity((q) => Math.min(q, nextVariant.stock));
90
+ };
91
+ const confirm = () => {
92
+ var _a;
93
+ if (!variant) {
94
+ const missing = (0, productCardModel_1.firstMissingAxis)(axes, selection);
95
+ setError(copy.prompt(((_a = missing === null || missing === void 0 ? void 0 : missing.label) !== null && _a !== void 0 ? _a : "option").toLowerCase()));
96
+ return;
97
+ }
98
+ onConfirm(variant, quantity);
99
+ };
100
+ const summary = ((0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "center", gap: 3, mb: 4, children: [media ? ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "img", src: (_a = media.thumb) !== null && _a !== void 0 ? _a : media.src, alt: "", boxSize: "4.5rem", flexShrink: 0, borderRadius: "xl", objectFit: "cover", bg: colors.background[100] })) : null, (0, jsx_runtime_1.jsxs)(react_2.Flex, { direction: "column", gap: 0.5, minW: 0, children: [brand ? ((0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: "xs", color: colors.textMuted, noOfLines: 1, children: brand })) : null, (0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: "sm", fontWeight: 500, color: colors.header[900], noOfLines: 2, children: title }), (0, jsx_runtime_1.jsx)(PriceBlock_1.default, { size: "sm", price: (_b = variant === null || variant === void 0 ? void 0 : variant.price) !== null && _b !== void 0 ? _b : (_c = variants[0]) === null || _c === void 0 ? void 0 : _c.price, mrp: variant === null || variant === void 0 ? void 0 : variant.mrp, priceRange: variant ? undefined : range, currency: currency, locale: locale })] })] }));
101
+ const body = ((0, jsx_runtime_1.jsxs)(react_2.Flex, { direction: "column", gap: 5, "data-testid": testId, children: [summary, (0, jsx_runtime_1.jsx)(VariantSelector_1.default, { axes: axes, variants: variants, value: selection, onValueChange: onSelect, error: error, showSelectedLabel: true, showLowStock: true }), (0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "center", justify: "space-between", gap: 3, children: [(0, jsx_runtime_1.jsx)(react_2.Text, { as: "span", fontSize: "sm", fontWeight: 600, color: colors.header[900], children: copy.quantity }), (0, jsx_runtime_1.jsx)(QuantityStepper_1.default, { value: quantity, min: 1, max: maxQuantity, onValueChange: setQuantity, itemLabel: title })] })] }));
102
+ const action = ((0, jsx_runtime_1.jsx)(Button_1.default, { size: "lg", width: "100%", onClick: confirm, children: confirmLabel }));
103
+ const asModal = presentation === "modal" || (presentation === "auto" && desktop);
104
+ if (asModal) {
105
+ return ((0, jsx_runtime_1.jsxs)(Modal_1.default, { size: "md", isOpen: isOpen, onClose: onClose, isCentered: true, title: copy.heading, children: [(0, jsx_runtime_1.jsx)(Modal_1.ModalBody, { children: body }), (0, jsx_runtime_1.jsx)(Modal_1.ModalFooter, { children: action })] }));
106
+ }
107
+ return ((0, jsx_runtime_1.jsxs)(Drawer_1.default, { isOpen: isOpen, onClose: onClose, placement: "bottom", size: "md", contentProps: { maxW: "100%", w: "100%", maxH: "90vh", borderTopRadius: "2xl", overflow: "auto", ...drawerContentProps }, children: [(0, jsx_runtime_1.jsx)(Drawer_1.DrawerHeader, { children: copy.heading }), (0, jsx_runtime_1.jsx)(Drawer_1.DrawerBody, { children: body }), (0, jsx_runtime_1.jsx)(Drawer_1.DrawerFooter, { children: action })] }));
108
+ };
109
+ exports.default = QuickAddSheet;
@@ -0,0 +1,38 @@
1
+ import type { DrawerContentProps } from "@chakra-ui/react";
2
+ import type { OptionAxis, PriceFormat, ProductMedia, ProductVariant, VariantSelection } from "../Commerce/commerceTypes";
3
+ /** Visible copy of the sheet; override every string for another language. */
4
+ export interface QuickAddSheetLabels {
5
+ /** Sheet heading, which also names the dialog. */
6
+ heading: string;
7
+ /** Label of the quantity stepper row. */
8
+ quantity: string;
9
+ /** Confirm button text while no variant is chosen. */
10
+ confirm: string;
11
+ /** Confirm button text for a chosen variant, given the formatted total. */
12
+ confirmWithTotal: (total: string) => string;
13
+ /** Prompt shown when confirming with an axis unpicked, given the lower-cased axis label ("size"). */
14
+ prompt: (axisLabel: string) => string;
15
+ }
16
+ /** drawer slides up from the bottom edge, modal is a centred panel, auto picks modal from 48em up. */
17
+ export type QuickAddPresentation = "auto" | "drawer" | "modal";
18
+ /** Option picker shown before an add: the product, a `VariantSelector`, a quantity stepper and a confirm button naming the total. */
19
+ export interface QuickAddSheetProps extends PriceFormat {
20
+ isOpen: boolean;
21
+ onClose: () => void;
22
+ title: string;
23
+ brand?: string;
24
+ /** Thumbnail beside the title. */
25
+ media?: ProductMedia;
26
+ axes: OptionAxis[];
27
+ /** Availability and the confirm total are derived from these. */
28
+ variants: ProductVariant[];
29
+ /** Picks to start from each time the sheet opens, e.g. the colour already chosen on the card. */
30
+ defaultSelection?: VariantSelection;
31
+ /** Fires with the chosen variant and quantity; the sheet does not close itself. */
32
+ onConfirm: (variant: ProductVariant, quantity: number) => void;
33
+ presentation?: QuickAddPresentation;
34
+ /** Merged over the drawer panel defaults, e.g. `{ maxW: "390px !important", mx: "auto" }` inside a phone-width frame; the slide sets an inline max-width. */
35
+ drawerContentProps?: DrawerContentProps;
36
+ labels?: Partial<QuickAddSheetLabels>;
37
+ "data-testid"?: string;
38
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ import type { ProductCardLabels } from "./ProductCardProps";
2
+ export declare const DEFAULT_LABELS: ProductCardLabels;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_LABELS = void 0;
4
+ exports.DEFAULT_LABELS = {
5
+ save: (title) => `Save ${title}`,
6
+ chooseOptions: (title) => `Choose options for ${title}`,
7
+ addToBag: (title) => `Add to bag: ${title}`,
8
+ notifyMe: "Notify me",
9
+ notifyMeFor: (title) => `Notify me when ${title} is back`,
10
+ chooseOptionsText: "Choose options",
11
+ addToBagText: "Add to bag",
12
+ soldOut: "Sold out",
13
+ selected: "Selected",
14
+ moreColours: (count) => `${count} more colours`,
15
+ imageUnavailable: "Image unavailable",
16
+ };
@@ -0,0 +1,27 @@
1
+ import type { ProductCardAspectRatio, ProductCardDensity } from "./ProductCardProps";
2
+ import type { PriceBlockSize } from "../PriceBlock/PriceBlockProps";
3
+ export type DensityMetrics = {
4
+ badgeInset: string;
5
+ wishlistInset: string;
6
+ actionInset: string;
7
+ bodyTop: string;
8
+ bodyGap: string;
9
+ brand: {
10
+ size: string;
11
+ line: number;
12
+ };
13
+ title: {
14
+ size: string;
15
+ line: number;
16
+ };
17
+ price: PriceBlockSize;
18
+ dot: number;
19
+ railWidth: string;
20
+ listMedia: string;
21
+ rowGap: string;
22
+ };
23
+ export declare const DENSITY: Record<ProductCardDensity, DensityMetrics>;
24
+ export declare const CSS_RATIO: Record<ProductCardAspectRatio, string>;
25
+ export declare const MEDIA_RADIUS = "1rem";
26
+ export declare const TITLE_LINES = 2;
27
+ export declare const FINE_POINTER = "@media (hover: hover) and (pointer: fine)";
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FINE_POINTER = exports.TITLE_LINES = exports.MEDIA_RADIUS = exports.CSS_RATIO = exports.DENSITY = void 0;
4
+ exports.DENSITY = {
5
+ compact: {
6
+ badgeInset: "0.5rem",
7
+ wishlistInset: "0",
8
+ actionInset: "0.25rem",
9
+ bodyTop: "0.5rem",
10
+ bodyGap: "1px",
11
+ brand: { size: "0.75rem", line: 16 },
12
+ title: { size: "0.8125rem", line: 18 },
13
+ price: "sm",
14
+ dot: 12,
15
+ railWidth: "9.75rem",
16
+ listMedia: "6rem",
17
+ rowGap: "1.5rem",
18
+ },
19
+ comfortable: {
20
+ badgeInset: "0.625rem",
21
+ wishlistInset: "0.125rem",
22
+ actionInset: "0.375rem",
23
+ bodyTop: "0.625rem",
24
+ bodyGap: "2px",
25
+ brand: { size: "0.75rem", line: 16 },
26
+ title: { size: "0.875rem", line: 20 },
27
+ price: "sm",
28
+ dot: 14,
29
+ railWidth: "12.5rem",
30
+ listMedia: "7rem",
31
+ rowGap: "1.5rem",
32
+ },
33
+ spacious: {
34
+ badgeInset: "0.75rem",
35
+ wishlistInset: "0.25rem",
36
+ actionInset: "0.5rem",
37
+ bodyTop: "0.75rem",
38
+ bodyGap: "3px",
39
+ brand: { size: "0.8125rem", line: 18 },
40
+ title: { size: "0.9375rem", line: 22 },
41
+ price: "md",
42
+ dot: 16,
43
+ railWidth: "12.5rem",
44
+ listMedia: "7rem",
45
+ rowGap: "2rem",
46
+ },
47
+ };
48
+ exports.CSS_RATIO = {
49
+ "4/5": "4 / 5",
50
+ "1/1": "1 / 1",
51
+ "3/4": "3 / 4",
52
+ };
53
+ exports.MEDIA_RADIUS = "1rem";
54
+ exports.TITLE_LINES = 2;
55
+ exports.FINE_POINTER = "@media (hover: hover) and (pointer: fine)";
@@ -0,0 +1,7 @@
1
+ import type { OptionAxis, ProductMedia, ProductVariant } from "../Commerce/commerceTypes";
2
+ export declare const jacketMedia: ProductMedia[];
3
+ export declare const jacketAxes: OptionAxis[];
4
+ export declare const jacketVariants: ProductVariant[];
5
+ export declare const jacketMediaIds: Record<string, string[]>;
6
+ export declare const mugMedia: ProductMedia[];
7
+ export declare const mugVariants: ProductVariant[];
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mugVariants = exports.mugMedia = exports.jacketMediaIds = exports.jacketVariants = exports.jacketAxes = exports.jacketMedia = void 0;
4
+ exports.jacketMedia = [
5
+ { id: "indigo-front", src: "/p/indigo-front.webp", alt: "Jacket in indigo, front" },
6
+ { id: "indigo-back", src: "/p/indigo-back.webp", alt: "Jacket in indigo, back" },
7
+ { id: "ice-front", src: "/p/ice-front.webp", alt: "Jacket in ice blue, front" },
8
+ { id: "ice-back", src: "/p/ice-back.webp", alt: "Jacket in ice blue, back" },
9
+ { id: "black-front", src: "/p/black-front.webp", alt: "Jacket in black, front" },
10
+ { id: "olive-front", src: "/p/olive-front.webp", alt: "Jacket in olive, front" },
11
+ ];
12
+ exports.jacketAxes = [
13
+ {
14
+ id: "colour",
15
+ label: "Colour",
16
+ type: "swatch",
17
+ values: [
18
+ { id: "indigo", label: "Indigo Wash", swatch: "steelblue" },
19
+ { id: "ice", label: "Ice Blue", swatch: "lightsteelblue" },
20
+ { id: "black", label: "Washed Black", swatch: "black" },
21
+ { id: "olive", label: "Olive", swatch: "olive" },
22
+ ],
23
+ },
24
+ {
25
+ id: "size",
26
+ label: "Size",
27
+ type: "chip",
28
+ values: [
29
+ { id: "m", label: "M" },
30
+ { id: "l", label: "L" },
31
+ ],
32
+ },
33
+ ];
34
+ const sized = (colour, size, stock) => ({
35
+ id: `jacket-${colour}-${size}`,
36
+ options: { colour, size },
37
+ price: 3499,
38
+ mrp: 4999,
39
+ stock,
40
+ });
41
+ exports.jacketVariants = [
42
+ sized("indigo", "m", 10),
43
+ sized("indigo", "l", 4),
44
+ sized("ice", "m", 9),
45
+ sized("ice", "l", 9),
46
+ sized("black", "m", 0),
47
+ sized("black", "l", 0),
48
+ sized("olive", "m", 6),
49
+ sized("olive", "l", 6),
50
+ ];
51
+ exports.jacketMediaIds = {
52
+ "colour:indigo": ["indigo-front", "indigo-back"],
53
+ "colour:ice": ["ice-front", "ice-back"],
54
+ "colour:black": ["black-front"],
55
+ "colour:olive": ["olive-front"],
56
+ };
57
+ exports.mugMedia = [
58
+ { id: "front", src: "/p/mug.webp", alt: "Mug, front" },
59
+ { id: "detail", src: "/p/mug-d.webp", alt: "Mug, glaze close-up" },
60
+ ];
61
+ exports.mugVariants = [{ id: "mug-default", options: {}, price: 699, stock: 46 }];