@anker-in/headless-ui 1.3.57 → 1.3.59
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.
- package/dist/cjs/biz-components/AccessoriesShelf/components/AccessoriesProductGrid/index.d.ts +11 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/AccessoriesProductGrid/index.js +2 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/AccessoriesProductGrid/index.js.map +7 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/AccessoryShelf/ProductCard.d.ts +23 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/AccessoryShelf/ProductCard.js +2 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/AccessoryShelf/ProductCard.js.map +7 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/AccessoryShelf/index.d.ts +40 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/AccessoryShelf/index.js +2 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/AccessoryShelf/index.js.map +7 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/AccessoryShelf/types.d.ts +107 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/AccessoryShelf/types.js +2 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/AccessoryShelf/types.js.map +7 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/AddToCartSuccessPopover/index.d.ts +82 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/AddToCartSuccessPopover/index.js +2 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/AddToCartSuccessPopover/index.js.map +7 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/MainProductArea/index.d.ts +22 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/MainProductArea/index.js +2 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/MainProductArea/index.js.map +7 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/PromoBanner/index.d.ts +10 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/PromoBanner/index.js +2 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/PromoBanner/index.js.map +7 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/SectionHeader/index.d.ts +9 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/SectionHeader/index.js +2 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/SectionHeader/index.js.map +7 -0
- package/dist/cjs/biz-components/AccessoriesShelf/index.d.ts +9 -0
- package/dist/cjs/biz-components/AccessoriesShelf/index.js +2 -0
- package/dist/cjs/biz-components/AccessoriesShelf/index.js.map +7 -0
- package/dist/cjs/biz-components/AccessoriesShelf/types.d.ts +16 -0
- package/dist/cjs/biz-components/AccessoriesShelf/types.js +2 -0
- package/dist/cjs/biz-components/AccessoriesShelf/types.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/CartGiftSection.d.ts +15 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/CartGiftSection.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/CartGiftSection.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/components/GiftConfirmDialog/GiftConfirmDialog.d.ts +11 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/components/GiftConfirmDialog/GiftConfirmDialog.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/components/GiftConfirmDialog/GiftConfirmDialog.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/components/GiftConfirmDialog/index.d.ts +2 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/components/GiftConfirmDialog/index.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/components/GiftConfirmDialog/index.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/components/GiftOptionRow/GiftOptionRow.d.ts +14 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/components/GiftOptionRow/GiftOptionRow.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/components/GiftOptionRow/GiftOptionRow.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/components/GiftOptionRow/index.d.ts +2 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/components/GiftOptionRow/index.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/components/GiftOptionRow/index.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/index.d.ts +2 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/index.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/index.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/CartItemRow.d.ts +56 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/CartItemRow.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/CartItemRow.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/CartItemGiftShipping.d.ts +4 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/CartItemGiftShipping.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/CartItemGiftShipping.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/index.d.ts +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/index.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/index.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/types.d.ts +10 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/types.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/types.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemInfo/CartItemInfo.d.ts +11 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemInfo/CartItemInfo.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemInfo/CartItemInfo.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemInfo/index.d.ts +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemInfo/index.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemInfo/index.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemKsp/CartItemKsp.d.ts +13 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemKsp/CartItemKsp.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemKsp/CartItemKsp.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemKsp/index.d.ts +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemKsp/index.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemKsp/index.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/CartItemRemoveConfirm.d.ts +4 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/CartItemRemoveConfirm.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/CartItemRemoveConfirm.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/index.d.ts +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/index.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/index.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/types.d.ts +11 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/types.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/types.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemShipping/CartItemShipping.d.ts +8 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemShipping/CartItemShipping.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemShipping/CartItemShipping.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemShipping/index.d.ts +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemShipping/index.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemShipping/index.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/index.d.ts +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/index.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/index.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartPerksSection/CartPerksSection.d.ts +34 -0
- package/dist/cjs/biz-components/CartDetail/CartPerksSection/CartPerksSection.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartPerksSection/CartPerksSection.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartPerksSection/index.d.ts +2 -0
- package/dist/cjs/biz-components/CartDetail/CartPerksSection/index.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartPerksSection/index.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartPriceSummary/CartPriceSummary.d.ts +51 -0
- package/dist/cjs/biz-components/CartDetail/CartPriceSummary/CartPriceSummary.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartPriceSummary/CartPriceSummary.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartPriceSummary/index.d.ts +2 -0
- package/dist/cjs/biz-components/CartDetail/CartPriceSummary/index.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartPriceSummary/index.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartSummaryHeader/CartSummaryHeader.d.ts +26 -0
- package/dist/cjs/biz-components/CartDetail/CartSummaryHeader/CartSummaryHeader.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartSummaryHeader/CartSummaryHeader.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartSummaryHeader/index.d.ts +2 -0
- package/dist/cjs/biz-components/CartDetail/CartSummaryHeader/index.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartSummaryHeader/index.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartThirdParty/CartThirdParty.d.ts +10 -0
- package/dist/cjs/biz-components/CartDetail/CartThirdParty/CartThirdParty.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartThirdParty/CartThirdParty.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartThirdParty/index.d.ts +2 -0
- package/dist/cjs/biz-components/CartDetail/CartThirdParty/index.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartThirdParty/index.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/index.d.ts +16 -0
- package/dist/cjs/biz-components/CartDetail/index.js +2 -0
- package/dist/cjs/biz-components/CartDetail/index.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/types.d.ts +132 -0
- package/dist/cjs/biz-components/CartDetail/types.js +2 -0
- package/dist/cjs/biz-components/CartDetail/types.js.map +7 -0
- package/dist/cjs/biz-components/HeaderNavigation/index.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/index.js.map +2 -2
- package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.js +1 -1
- package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.js.map +2 -2
- package/dist/cjs/biz-components/index.d.ts +6 -0
- package/dist/cjs/biz-components/index.js +1 -1
- package/dist/cjs/biz-components/index.js.map +3 -3
- package/dist/cjs/components/breadcrumb.d.ts +12 -0
- package/dist/cjs/components/breadcrumb.js +2 -0
- package/dist/cjs/components/breadcrumb.js.map +7 -0
- package/dist/cjs/components/button.js +1 -1
- package/dist/cjs/components/button.js.map +2 -2
- package/dist/cjs/components/index.d.ts +3 -1
- package/dist/cjs/components/index.js +1 -1
- package/dist/cjs/components/index.js.map +3 -3
- package/dist/cjs/components/input-number.d.ts +22 -0
- package/dist/cjs/components/input-number.js +1 -1
- package/dist/cjs/components/input-number.js.map +3 -3
- package/dist/cjs/components/input.d.ts +5 -0
- package/dist/cjs/components/input.js +1 -1
- package/dist/cjs/components/input.js.map +3 -3
- package/dist/cjs/components/popover.d.ts +17 -2
- package/dist/cjs/components/popover.js +1 -1
- package/dist/cjs/components/popover.js.map +3 -3
- package/dist/cjs/components/toast.d.ts +25 -0
- package/dist/cjs/components/toast.js +2 -0
- package/dist/cjs/components/toast.js.map +7 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/AccessoriesProductGrid/index.d.ts +11 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/AccessoriesProductGrid/index.js +2 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/AccessoriesProductGrid/index.js.map +7 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/AccessoryShelf/ProductCard.d.ts +23 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/AccessoryShelf/ProductCard.js +2 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/AccessoryShelf/ProductCard.js.map +7 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/AccessoryShelf/index.d.ts +40 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/AccessoryShelf/index.js +2 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/AccessoryShelf/index.js.map +7 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/AccessoryShelf/types.d.ts +107 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/AccessoryShelf/types.js +1 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/AccessoryShelf/types.js.map +7 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/AddToCartSuccessPopover/index.d.ts +82 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/AddToCartSuccessPopover/index.js +2 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/AddToCartSuccessPopover/index.js.map +7 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/MainProductArea/index.d.ts +22 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/MainProductArea/index.js +2 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/MainProductArea/index.js.map +7 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/PromoBanner/index.d.ts +10 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/PromoBanner/index.js +2 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/PromoBanner/index.js.map +7 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/SectionHeader/index.d.ts +9 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/SectionHeader/index.js +2 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/SectionHeader/index.js.map +7 -0
- package/dist/esm/biz-components/AccessoriesShelf/index.d.ts +9 -0
- package/dist/esm/biz-components/AccessoriesShelf/index.js +2 -0
- package/dist/esm/biz-components/AccessoriesShelf/index.js.map +7 -0
- package/dist/esm/biz-components/AccessoriesShelf/types.d.ts +16 -0
- package/dist/esm/biz-components/AccessoriesShelf/types.js +1 -0
- package/dist/esm/biz-components/AccessoriesShelf/types.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/CartGiftSection.d.ts +15 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/CartGiftSection.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/CartGiftSection.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/components/GiftConfirmDialog/GiftConfirmDialog.d.ts +11 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/components/GiftConfirmDialog/GiftConfirmDialog.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/components/GiftConfirmDialog/GiftConfirmDialog.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/components/GiftConfirmDialog/index.d.ts +2 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/components/GiftConfirmDialog/index.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/components/GiftConfirmDialog/index.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/components/GiftOptionRow/GiftOptionRow.d.ts +14 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/components/GiftOptionRow/GiftOptionRow.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/components/GiftOptionRow/GiftOptionRow.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/components/GiftOptionRow/index.d.ts +2 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/components/GiftOptionRow/index.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/components/GiftOptionRow/index.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/index.d.ts +2 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/index.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/index.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/CartItemRow.d.ts +56 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/CartItemRow.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/CartItemRow.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/CartItemGiftShipping.d.ts +4 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/CartItemGiftShipping.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/CartItemGiftShipping.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/index.d.ts +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/index.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/index.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/types.d.ts +10 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/types.js +1 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/types.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemInfo/CartItemInfo.d.ts +11 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemInfo/CartItemInfo.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemInfo/CartItemInfo.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemInfo/index.d.ts +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemInfo/index.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemInfo/index.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemKsp/CartItemKsp.d.ts +13 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemKsp/CartItemKsp.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemKsp/CartItemKsp.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemKsp/index.d.ts +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemKsp/index.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemKsp/index.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/CartItemRemoveConfirm.d.ts +4 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/CartItemRemoveConfirm.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/CartItemRemoveConfirm.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/index.d.ts +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/index.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/index.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/types.d.ts +11 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/types.js +1 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/types.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemShipping/CartItemShipping.d.ts +8 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemShipping/CartItemShipping.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemShipping/CartItemShipping.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemShipping/index.d.ts +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemShipping/index.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemShipping/index.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/index.d.ts +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/index.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/index.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartPerksSection/CartPerksSection.d.ts +34 -0
- package/dist/esm/biz-components/CartDetail/CartPerksSection/CartPerksSection.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartPerksSection/CartPerksSection.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartPerksSection/index.d.ts +2 -0
- package/dist/esm/biz-components/CartDetail/CartPerksSection/index.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartPerksSection/index.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartPriceSummary/CartPriceSummary.d.ts +51 -0
- package/dist/esm/biz-components/CartDetail/CartPriceSummary/CartPriceSummary.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartPriceSummary/CartPriceSummary.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartPriceSummary/index.d.ts +2 -0
- package/dist/esm/biz-components/CartDetail/CartPriceSummary/index.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartPriceSummary/index.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartSummaryHeader/CartSummaryHeader.d.ts +26 -0
- package/dist/esm/biz-components/CartDetail/CartSummaryHeader/CartSummaryHeader.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartSummaryHeader/CartSummaryHeader.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartSummaryHeader/index.d.ts +2 -0
- package/dist/esm/biz-components/CartDetail/CartSummaryHeader/index.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartSummaryHeader/index.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartThirdParty/CartThirdParty.d.ts +10 -0
- package/dist/esm/biz-components/CartDetail/CartThirdParty/CartThirdParty.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartThirdParty/CartThirdParty.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartThirdParty/index.d.ts +2 -0
- package/dist/esm/biz-components/CartDetail/CartThirdParty/index.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartThirdParty/index.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/index.d.ts +16 -0
- package/dist/esm/biz-components/CartDetail/index.js +2 -0
- package/dist/esm/biz-components/CartDetail/index.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/types.d.ts +132 -0
- package/dist/esm/biz-components/CartDetail/types.js +1 -0
- package/dist/esm/biz-components/CartDetail/types.js.map +7 -0
- package/dist/esm/biz-components/HeaderNavigation/index.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/index.js.map +2 -2
- package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.js +1 -1
- package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.js.map +2 -2
- package/dist/esm/biz-components/index.d.ts +6 -0
- package/dist/esm/biz-components/index.js +1 -1
- package/dist/esm/biz-components/index.js.map +3 -3
- package/dist/esm/components/breadcrumb.d.ts +12 -0
- package/dist/esm/components/breadcrumb.js +2 -0
- package/dist/esm/components/breadcrumb.js.map +7 -0
- package/dist/esm/components/button.js +1 -1
- package/dist/esm/components/button.js.map +2 -2
- package/dist/esm/components/index.d.ts +3 -1
- package/dist/esm/components/index.js +1 -1
- package/dist/esm/components/index.js.map +3 -3
- package/dist/esm/components/input-number.d.ts +22 -0
- package/dist/esm/components/input-number.js +1 -1
- package/dist/esm/components/input-number.js.map +3 -3
- package/dist/esm/components/input.d.ts +5 -0
- package/dist/esm/components/input.js +1 -1
- package/dist/esm/components/input.js.map +3 -3
- package/dist/esm/components/popover.d.ts +17 -2
- package/dist/esm/components/popover.js +1 -1
- package/dist/esm/components/popover.js.map +3 -3
- package/dist/esm/components/toast.d.ts +25 -0
- package/dist/esm/components/toast.js +2 -0
- package/dist/esm/components/toast.js.map +7 -0
- package/dist/tokens/base.css +4 -0
- package/package.json +1 -1
- package/style.css +270 -3
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";import{jsx as l}from"react/jsx-runtime";import*as e from"react";import{cn as f}from"../../../../helpers/index.js";import{withLayout as p}from"../../../../shared/Styles.js";import o from"./ProductCard.js";const t=e.forwardRef(({className:s,children:a,classNames:d,...i},n)=>{const r=e.useRef(null);return e.useImperativeHandle(n,()=>r.current),l("div",{ref:r,className:f("w-full",s,d?.root),...i,children:a})});t.displayName="AccessoryShelf";const c=t;c.ProductCard=o;var A=p(c);export{o as AccessoryProductCard,A as default};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/biz-components/AccessoriesShelf/components/AccessoryShelf/index.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../../../helpers/index.js'\nimport { withLayout } from '../../../../shared/Styles.js'\nimport AccessoryProductCard from './ProductCard.js'\nimport type { AccessoryProductData, AccessoryCardSemanticName, AccessoryCopyConfig } from './types.js'\n\nexport type { AccessoryProductData, AccessoryCardSemanticName, AccessoryCopyConfig }\nexport type { AccessoryProductCardProps } from './ProductCard.js'\n\nexport interface AccessoryShelfProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * \u4EA7\u54C1\u5361\u7247\u533A\u57DF \u2014 \u4E1A\u52A1\u7AEF\u81EA\u884C\u7EC4\u5408\u5E03\u5C40\u5BB9\u5668 + AccessoryShelf.ProductCard\n *\n * @example \u642D\u914D AccessoriesProductGrid\n * ```tsx\n * <AccessoryShelf data={{ title: 'Add-ons' }}>\n * <AccessoriesProductGrid maxVisible={8} showMoreText=\"Show more\" showLessText=\"Show less\">\n * {products.map(p => (\n * <AccessoryShelf.ProductCard\n * key={p.sku}\n * product={p}\n * addedQuantity={quantities[p.sku]}\n * isLoading={loadingSkus.has(p.sku)}\n * onAddToCart={handleAddToCart}\n * />\n * ))}\n * </AccessoriesProductGrid>\n * </AccessoryShelf>\n * ```\n */\n children: React.ReactNode\n /** \u8BED\u4E49\u5316\u7C7B\u540D\u8986\u76D6\uFF08\u4EC5 root/title/description \u6709\u6548\uFF09 */\n classNames?: Partial<Record<'root' | 'title' | 'description', string>>\n}\n\nexport interface AccessoryShelfComponent extends React.ForwardRefExoticComponent<\n AccessoryShelfProps & React.RefAttributes<HTMLDivElement>\n> {\n /** \u914D\u4EF6\u5361\u7247\u5B50\u7EC4\u4EF6\uFF0C\u4E1A\u52A1\u7AEF\u5728 children \u4E2D\u76F4\u63A5\u4F7F\u7528 */\n ProductCard: typeof AccessoryProductCard\n}\n\nconst AccessoryShelf = React.forwardRef<HTMLDivElement, AccessoryShelfProps>(\n ({ className, children, classNames, ...props }, ref) => {\n const boxRef = React.useRef<HTMLDivElement>(null)\n\n React.useImperativeHandle(ref, () => boxRef.current as HTMLDivElement)\n\n return (\n <div ref={boxRef} className={cn('w-full', className, classNames?.root)} {...props}>\n {children}\n </div>\n )\n }\n)\n\nAccessoryShelf.displayName = 'AccessoryShelf'\n\n// \u590D\u5408\u7EC4\u4EF6\uFF1AAccessoryShelf.ProductCard \u53EF\u76F4\u63A5\u4F7F\u7528\nconst AccessoryShelfWithProductCard = AccessoryShelf as AccessoryShelfComponent\nAccessoryShelfWithProductCard.ProductCard = AccessoryProductCard\n\nexport { AccessoryProductCard }\nexport default withLayout(AccessoryShelfWithProductCard)\n"],
|
|
5
|
+
"mappings": "aAmDM,cAAAA,MAAA,oBAjDN,UAAYC,MAAW,QACvB,OAAS,MAAAC,MAAU,+BACnB,OAAS,cAAAC,MAAkB,+BAC3B,OAAOC,MAA0B,mBAuCjC,MAAMC,EAAiBJ,EAAM,WAC3B,CAAC,CAAE,UAAAK,EAAW,SAAAC,EAAU,WAAAC,EAAY,GAAGC,CAAM,EAAGC,IAAQ,CACtD,MAAMC,EAASV,EAAM,OAAuB,IAAI,EAEhD,OAAAA,EAAM,oBAAoBS,EAAK,IAAMC,EAAO,OAAyB,EAGnEX,EAAC,OAAI,IAAKW,EAAQ,UAAWT,EAAG,SAAUI,EAAWE,GAAY,IAAI,EAAI,GAAGC,EACzE,SAAAF,EACH,CAEJ,CACF,EAEAF,EAAe,YAAc,iBAG7B,MAAMO,EAAgCP,EACtCO,EAA8B,YAAcR,EAG5C,IAAOS,EAAQV,EAAWS,CAA6B",
|
|
6
|
+
"names": ["jsx", "React", "cn", "withLayout", "AccessoryProductCard", "AccessoryShelf", "className", "children", "classNames", "props", "ref", "boxRef", "AccessoryShelfWithProductCard", "AccessoryShelf_default"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { BadgeProps } from '../../../../components/badge.js';
|
|
3
|
+
/**
|
|
4
|
+
* 语义化类名
|
|
5
|
+
*/
|
|
6
|
+
export type AccessoryCardSemanticName = 'root' | 'image' | 'tags' | 'title' | 'description' | 'priceArea' | 'currentPrice' | 'originalPrice' | 'discountPrice' | 'memberPriceNote' | 'buttonGroup' | 'addButton';
|
|
7
|
+
/**
|
|
8
|
+
* 文案配置
|
|
9
|
+
*/
|
|
10
|
+
export interface AccessoryCopyConfig {
|
|
11
|
+
/** 售罄文案,默认 "Sold Out" */
|
|
12
|
+
outOfStockLabel?: string;
|
|
13
|
+
/** 加购按钮文案,默认 "Add" */
|
|
14
|
+
addLabel?: string;
|
|
15
|
+
/** 已加购按钮文案前缀,默认 "Added",最终显示为 "Added (n)" */
|
|
16
|
+
addedLabel?: string;
|
|
17
|
+
/** 不可用按钮文案,默认 "Unavailable" */
|
|
18
|
+
unavailableLabel?: string;
|
|
19
|
+
/** 会员价标签文本,默认 "Member price" */
|
|
20
|
+
memberPriceLabel?: string;
|
|
21
|
+
/** Plus 会员价标签文本,默认 "Plus member price" */
|
|
22
|
+
plusMemberPriceLabel?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* 产品数据接口(UI 层,价格已格式化为字符串)
|
|
26
|
+
* 业务端负责从 API 获取并转换后传入
|
|
27
|
+
*/
|
|
28
|
+
export interface AccessoryProductData {
|
|
29
|
+
/** SKU 唯一标识 */
|
|
30
|
+
sku: string;
|
|
31
|
+
/** 产品名称 */
|
|
32
|
+
name: string;
|
|
33
|
+
/** 产品主图 URL */
|
|
34
|
+
image: string;
|
|
35
|
+
/** 自定义图片 URL(覆盖 image) */
|
|
36
|
+
custom_image?: string;
|
|
37
|
+
/** 产品 handle */
|
|
38
|
+
handle: string;
|
|
39
|
+
/** Shopify ID */
|
|
40
|
+
shopify_id?: string;
|
|
41
|
+
/** 产品链接 */
|
|
42
|
+
listingLink?: string;
|
|
43
|
+
/** 自定义名称(覆盖 name) */
|
|
44
|
+
custom_name?: string;
|
|
45
|
+
/** 自定义描述(覆盖 description) */
|
|
46
|
+
custom_description?: string;
|
|
47
|
+
/** 产品描述 */
|
|
48
|
+
description?: string;
|
|
49
|
+
/** 现价(已格式化,如 "$49.99") */
|
|
50
|
+
price: string;
|
|
51
|
+
/** 原价(已格式化,有则显示删除线),优先级低于 discountPrice */
|
|
52
|
+
originalPrice?: string;
|
|
53
|
+
/** 折扣金额(已格式化,如 "-$10.00"),显示在现价旁边,品牌色、无删除线 */
|
|
54
|
+
discountPrice?: string;
|
|
55
|
+
/**
|
|
56
|
+
* 会员价提示(已格式化,如 "$42.49")
|
|
57
|
+
* 显示在现价下方小字,配合 memberPriceType 决定标签颜色
|
|
58
|
+
*/
|
|
59
|
+
memberPriceNote?: string;
|
|
60
|
+
/** 会员价类型,决定标签文案和颜色 */
|
|
61
|
+
memberPriceType?: 'member' | 'plus-member';
|
|
62
|
+
/** 是否可售 */
|
|
63
|
+
availableForSale: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* 可用库存上限(用于限制加购数量)
|
|
66
|
+
* 业务端从库存 API 获取后传入,组件只用于判断是否达到上限
|
|
67
|
+
*/
|
|
68
|
+
quantityAvailable?: number | null;
|
|
69
|
+
/** tags 列表 */
|
|
70
|
+
tags?: Array<{
|
|
71
|
+
label: string;
|
|
72
|
+
variant: BadgeProps['variant'];
|
|
73
|
+
promotionalType?: BadgeProps['promotionalType'];
|
|
74
|
+
} | React.ReactNode>;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* AccessoryProductCard Props
|
|
78
|
+
* 所有业务状态(addedQuantity、isLoading 等)由业务端维护并传入
|
|
79
|
+
*/
|
|
80
|
+
export interface AccessoryProductCardProps {
|
|
81
|
+
/** 产品数据 */
|
|
82
|
+
product: AccessoryProductData;
|
|
83
|
+
/** 已加购数量(业务端维护) */
|
|
84
|
+
addedQuantity?: number;
|
|
85
|
+
/** 最大可加购数量(undefined 则不限制) */
|
|
86
|
+
maxQuantity?: number;
|
|
87
|
+
/** 加购 loading 状态(业务端维护) */
|
|
88
|
+
isLoading?: boolean;
|
|
89
|
+
/** 是否显示 tags */
|
|
90
|
+
showTags?: boolean;
|
|
91
|
+
/** 是否显示原价(删除线) */
|
|
92
|
+
showOriginalPrice?: boolean;
|
|
93
|
+
/** 是否显示折扣金额(品牌色,无删除线,优先级高于 showOriginalPrice) */
|
|
94
|
+
showDiscountPrice?: boolean;
|
|
95
|
+
/** 是否显示会员价小字 */
|
|
96
|
+
showMemberPrice?: boolean;
|
|
97
|
+
/** 点击产品图/标题回调(不传则降级为 listingLink href) */
|
|
98
|
+
onProductClick?: (product: AccessoryProductData) => void;
|
|
99
|
+
/** 点击加购按钮回调 */
|
|
100
|
+
onAddToCart?: (product: AccessoryProductData) => void;
|
|
101
|
+
/** 样式类名 */
|
|
102
|
+
className?: string;
|
|
103
|
+
/** 语义化类名覆盖 */
|
|
104
|
+
classNames?: Partial<Record<AccessoryCardSemanticName, string>>;
|
|
105
|
+
/** 文案配置 */
|
|
106
|
+
copy?: AccessoryCopyConfig;
|
|
107
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.js.map
|
package/dist/esm/biz-components/AccessoriesShelf/components/AddToCartSuccessPopover/index.d.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { AccessoryProductData } from '../AccessoryShelf/types.js';
|
|
3
|
+
export type { AccessoryProductData };
|
|
4
|
+
/**
|
|
5
|
+
* 语义化类名
|
|
6
|
+
*/
|
|
7
|
+
export type AddToCartSuccessSemanticName = 'root' | 'arrow' | 'closeButton' | 'header' | 'successIcon' | 'successTitle' | 'productRow' | 'productImage' | 'productInfo' | 'productTitle' | 'productVariant' | 'priceRow' | 'currentPrice' | 'originalPrice' | 'quantity' | 'cartCountText' | 'viewCartButton';
|
|
8
|
+
/**
|
|
9
|
+
* 文案配置
|
|
10
|
+
*/
|
|
11
|
+
export interface AddToCartSuccessCopyConfig {
|
|
12
|
+
/** 成功提示标题,默认 "Successfully added to cart!" */
|
|
13
|
+
successTitle?: string;
|
|
14
|
+
/** 购物车商品总数文案,{count} 会被替换为总数量,默认 "There are {count} items in the shopping cart." */
|
|
15
|
+
cartCountText?: string;
|
|
16
|
+
/** 查看购物车按钮文案,默认 "View Cart" */
|
|
17
|
+
viewCartLabel?: string;
|
|
18
|
+
/** 关闭按钮无障碍标签,默认 "Close" */
|
|
19
|
+
closeLabel?: string;
|
|
20
|
+
/** 数量前缀符号,默认 "x",最终展示为 "x1" */
|
|
21
|
+
quantityPrefix?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface AddToCartSuccessPopoverProps {
|
|
24
|
+
/**
|
|
25
|
+
* 弹窗触发器,通常是购物车图标按钮,内部使用 asChild 包裹。
|
|
26
|
+
* 当提供 triggerRef 时可为空(此时 Popover 锚定到外部 DOM 元素)。
|
|
27
|
+
*/
|
|
28
|
+
children?: React.ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* 外部锚点元素 ref,用于将 Popover 锚定到页面上已有的元素(如导航栏中的购物车图标),
|
|
31
|
+
* 无需包裹该元素作为 children。传入后 children 可省略,内部使用 PopoverAnchor + virtualRef 实现。
|
|
32
|
+
* 注意:仅在 children 未提供时生效;如果同时提供 children 和 triggerRef,children 优先。
|
|
33
|
+
*/
|
|
34
|
+
triggerRef?: React.RefObject<HTMLElement>;
|
|
35
|
+
/** 受控展示状态 */
|
|
36
|
+
open?: boolean;
|
|
37
|
+
/** 非受控默认展示状态 */
|
|
38
|
+
defaultOpen?: boolean;
|
|
39
|
+
/** 展示状态变化回调 */
|
|
40
|
+
onOpenChange?: (open: boolean) => void;
|
|
41
|
+
/** 刚加购的商品数据(复用 AccessoryShelf 的 AccessoryProductData) */
|
|
42
|
+
product: AccessoryProductData;
|
|
43
|
+
/** 商品参数列表,如颜色/赠品,渲染为 "Color: Classic Black · Gift: 1" */
|
|
44
|
+
paramList?: {
|
|
45
|
+
label: string;
|
|
46
|
+
value: string;
|
|
47
|
+
}[];
|
|
48
|
+
/** 是否展示原价(删除线),默认 true(当 product.originalPrice 存在时) */
|
|
49
|
+
showOriginalPrice?: boolean;
|
|
50
|
+
/** 本次加购数量,用于展示 "x1",默认 1 */
|
|
51
|
+
quantity?: number;
|
|
52
|
+
/** 购物车商品总数,用于底部文案插值;不传则回退为 quantity */
|
|
53
|
+
cartTotalCount?: number;
|
|
54
|
+
/** 点击 "View Cart" 按钮回调 */
|
|
55
|
+
onViewCart?: () => void;
|
|
56
|
+
/** 文案配置 */
|
|
57
|
+
copy?: AddToCartSuccessCopyConfig;
|
|
58
|
+
/**
|
|
59
|
+
* 自动关闭延时(毫秒),设为 0 或 null 则禁用自动关闭。
|
|
60
|
+
* 默认 8000(8秒),用户无任何操作时自动隐藏。
|
|
61
|
+
*/
|
|
62
|
+
autoCloseDuration?: number | null;
|
|
63
|
+
/** Popover 对齐方式,默认 center(居中于触发器),移动端自动居中于屏幕 */
|
|
64
|
+
align?: 'start' | 'center' | 'end';
|
|
65
|
+
/** Popover 弹出方向,默认 bottom */
|
|
66
|
+
side?: 'top' | 'right' | 'bottom' | 'left';
|
|
67
|
+
/** 距离触发器的偏移量,默认 12 */
|
|
68
|
+
sideOffset?: number;
|
|
69
|
+
/** 根元素类名 */
|
|
70
|
+
className?: string;
|
|
71
|
+
/** 语义化类名覆盖 */
|
|
72
|
+
classNames?: Partial<Record<AddToCartSuccessSemanticName, string>>;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* AddToCartSuccessPopover - 加购成功悬浮提示
|
|
76
|
+
*
|
|
77
|
+
* @description 用户点击加购后,锚定在触发器(如购物车图标)下方展示的非模态悬浮提示,
|
|
78
|
+
* 展示成功提示、商品信息、购物车总数及"查看购物车"入口。
|
|
79
|
+
*/
|
|
80
|
+
declare const AddToCartSuccessPopover: React.ForwardRefExoticComponent<AddToCartSuccessPopoverProps & React.RefAttributes<HTMLDivElement>>;
|
|
81
|
+
export default AddToCartSuccessPopover;
|
|
82
|
+
export { AddToCartSuccessPopover };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as i}from"react/jsx-runtime";import*as c from"react";import{useRef as U}from"react";import{cn as o}from"../../../../helpers/index.js";import{Popover as X,PopoverTrigger as Y,PopoverAnchor as $,PopoverContent as ee,PopoverClose as te,PopoverArrow as oe,Button as ne,Text as p,Heading as ie,Picture as re}from"../../../../components/index.js";import{useExposure as ae}from"../../../../hooks/useExposure.js";import{gaTrack as S}from"../../../../shared/track.js";import{useAiuiContext as se}from"../../../AiuiProvider/index.js";const T="popover",y="add_to_cart_success_popover",ce=({className:l})=>i("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",className:l,"aria-hidden":!0,children:[e("circle",{cx:"10",cy:"10",r:"8.75",fill:"#30D158"}),e("path",{d:"M5.8335 9.58333L9.16683 12.5L14.1668 7.5",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),le=l=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",...l,children:e("path",{d:"M4.69617 4.69673C5.02156 4.37125 5.54924 4.3713 5.87468 4.69673L9.99947 8.82152L14.1243 4.69673C14.4497 4.37129 14.9774 4.37125 15.3028 4.69673C15.6281 5.02219 15.6281 5.5498 15.3028 5.87524L11.178 10L15.3028 14.1248C15.6281 14.4503 15.6281 14.9779 15.3028 15.3033C14.9774 15.6288 14.4497 15.6288 14.1243 15.3033L9.99947 11.1785L5.87468 15.3033C5.54924 15.6288 5.02156 15.6288 4.69617 15.3033C4.3708 14.9779 4.37081 14.4503 4.69617 14.1248L8.82096 10L4.69617 5.87524C4.37081 5.5498 4.3708 5.02219 4.69617 4.69673Z",fill:"#080A0F"})}),P=c.forwardRef(({children:l,triggerRef:d,open:_,defaultOpen:O,onOpenChange:R,product:r,paramList:g,showOriginalPrice:I=!0,quantity:L=1,cartTotalCount:z,onViewCart:B,copy:m,autoCloseDuration:u=8e3,align:D="center",side:E="bottom",sideOffset:H=12,className:j,classNames:t},q)=>{const{trackingData:k}=se(),[V,F]=c.useState(O??!1),v=_!==void 0,C=v?_:V,h=c.useCallback(a=>{v||F(a),R?.(a)},[v,R]);c.useEffect(()=>{if(!C||u==null||u<=0)return;const a=setTimeout(()=>h(!1),u);return()=>clearTimeout(a)},[C,u,h]);const x=m?.successTitle??"Successfully added to cart!",W=m?.cartCountText??"There are {count} items in the shopping cart.",w=m?.viewCartLabel??"View Cart",G=m?.closeLabel??"Close",Z=m?.quantityPrefix??"x",f=W.replace("{count}",String(z??L)),A=r.custom_name||r.name,J=r.custom_image||r.image,b=U(null);ae(b,{componentType:T,componentName:y,componentTitle:x,componentDescription:f}),c.useImperativeHandle(q,()=>b.current);const K=c.useMemo(()=>{if(d)return{current:{getBoundingClientRect:()=>{const n=d.current?.getBoundingClientRect()??new DOMRect,M=window.innerWidth,N=window.innerHeight,s=16;return n.bottom<=s?new DOMRect(Math.max(s,Math.min(n.left,M-s-n.width)),s,n.width||0,0):n.top>=N-s?new DOMRect(Math.max(s,Math.min(n.left,M-s-n.width)),N-s,n.width||0,0):n},contextElement:d.current||void 0}}},[d]),Q=l!=null?e(Y,{asChild:!0,children:l}):d&&e($,{virtualRef:K});return i(X,{open:C,onOpenChange:h,children:[Q,i(ee,{ref:b,align:D,side:E,sideOffset:H,zIndex:101,avoidCollisions:!0,collisionPadding:16,className:o("rounded-card laptop:w-[420px] laptop:p-6 relative w-[calc(100vw-32px)] max-w-[420px] border-none bg-white p-4 shadow-[0_2px_8px_0_rgba(0,0,0,0.12)] outline-none",j,t?.root),children:[e(oe,{className:o("drop-shadow-[0_2px_8px_rgba(0,0,0,0.12)]",t?.arrow)}),e(te,{asChild:!0,children:e("button",{type:"button",className:o("text-info-tertiary hover:text-info-primary absolute right-4 top-4 transition-colors",t?.closeButton),"aria-label":G,onClick:()=>{S({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:k?.pageGroup||"Home Page",component_type:T,component_name:y,component_description:f,position:1,navigation:"Close",component_title:x,sku:r?.sku,button_name:"Close",creative_id:""}})},children:e(le,{className:"laptop:size-6 size-5"})})}),i("div",{className:o("laptop:pt-6 flex items-center gap-1 pr-4 pt-5",t?.header),children:[e(ce,{className:o("laptop:size-6 size-5 shrink-0",t?.successIcon)}),e(ie,{as:"h3",size:2,className:o("text-info-primary laptop:text-2xl text-xl",t?.successTitle),children:x})]}),i("div",{className:o("bg-container-secondary-0 rounded-box-small laptop:mt-4 laptop:p-4 mt-3 flex items-start gap-2 p-3",t?.productRow),children:[e("div",{className:o("laptop:size-16 size-12 shrink-0 overflow-hidden rounded-md mix-blend-multiply",t?.productImage),children:e(re,{source:J,alt:A,className:"size-full",imgClassName:"object-contain size-full"})}),i("div",{className:o("flex min-w-0 flex-1 flex-col",t?.productInfo),children:[e(p,{as:"p",className:o("text-info-primary laptop:text-[14px] line-clamp-2 text-[12px] font-bold leading-[1.2]",t?.productTitle),children:A}),g&&g.length>0&&e(p,{as:"p",className:o("text-info-tertiary laptop:mt-1 laptop:text-[14px] mt-[2px] text-[12px] font-bold",t?.productVariant),children:g.map((a,n)=>i(c.Fragment,{children:[n>0&&" \xB7 ",a.label,": ",a.value]},n))}),i("div",{className:o("mt-1 flex items-center justify-between gap-2",t?.priceRow),children:[i("div",{className:"flex items-baseline gap-1",children:[e(p,{as:"span",className:o("text-info-primary text-[14px] font-bold",t?.currentPrice),children:r.price}),I&&r.originalPrice&&e(p,{as:"span",className:o("text-info-tertiary text-[14px] font-bold line-through",t?.originalPrice),children:r.originalPrice})]}),i(p,{as:"span",className:o("text-info-primary shrink-0 text-[14px] font-bold",t?.quantity),children:[Z,L]})]})]})]}),e(p,{as:"p",className:o("text-info-primary laptop:mt-6 laptop:text-[18px] mt-4 text-[14px] font-bold",t?.cartCountText),children:f}),e("div",{className:"laptop:mt-4 mt-3 flex justify-end",children:e(ne,{variant:"primary",size:"lg",onClick:()=>{S({event:"ga4Event",event_name:"component_click",event_parameters:{component_type:T,component_name:y,button_name:w,page_group:k?.pageGroup||"Home Page",component_description:f,position:1,navigation:w,component_title:x,sku:r?.sku,creative_id:""}}),B?.()},className:o("rounded-full",t?.viewCartButton),children:w})})]})]})});P.displayName="AddToCartSuccessPopover";var ge=P;export{P as AddToCartSuccessPopover,ge as default};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
package/dist/esm/biz-components/AccessoriesShelf/components/AddToCartSuccessPopover/index.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/biz-components/AccessoriesShelf/components/AddToCartSuccessPopover/index.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { useRef } from 'react'\nimport { cn } from '../../../../helpers/index.js'\nimport {\n Popover,\n PopoverTrigger,\n PopoverAnchor,\n PopoverContent,\n PopoverClose,\n PopoverArrow,\n Button,\n Text,\n Heading,\n Picture,\n} from '../../../../components/index.js'\nimport { useExposure } from '../../../../hooks/useExposure.js'\nimport { gaTrack } from '../../../../shared/track.js'\nimport type { AccessoryProductData } from '../AccessoryShelf/types.js'\nimport { useAiuiContext } from '../../../AiuiProvider/index.js'\n\nconst componentType = 'popover'\nconst componentName = 'add_to_cart_success_popover'\n\nexport type { AccessoryProductData }\n\n/**\n * \u8BED\u4E49\u5316\u7C7B\u540D\n */\nexport type AddToCartSuccessSemanticName =\n | 'root'\n | 'arrow'\n | 'closeButton'\n | 'header'\n | 'successIcon'\n | 'successTitle'\n | 'productRow'\n | 'productImage'\n | 'productInfo'\n | 'productTitle'\n | 'productVariant'\n | 'priceRow'\n | 'currentPrice'\n | 'originalPrice'\n | 'quantity'\n | 'cartCountText'\n | 'viewCartButton'\n\n/**\n * \u6587\u6848\u914D\u7F6E\n */\nexport interface AddToCartSuccessCopyConfig {\n /** \u6210\u529F\u63D0\u793A\u6807\u9898\uFF0C\u9ED8\u8BA4 \"Successfully added to cart!\" */\n successTitle?: string\n /** \u8D2D\u7269\u8F66\u5546\u54C1\u603B\u6570\u6587\u6848\uFF0C{count} \u4F1A\u88AB\u66FF\u6362\u4E3A\u603B\u6570\u91CF\uFF0C\u9ED8\u8BA4 \"There are {count} items in the shopping cart.\" */\n cartCountText?: string\n /** \u67E5\u770B\u8D2D\u7269\u8F66\u6309\u94AE\u6587\u6848\uFF0C\u9ED8\u8BA4 \"View Cart\" */\n viewCartLabel?: string\n /** \u5173\u95ED\u6309\u94AE\u65E0\u969C\u788D\u6807\u7B7E\uFF0C\u9ED8\u8BA4 \"Close\" */\n closeLabel?: string\n /** \u6570\u91CF\u524D\u7F00\u7B26\u53F7\uFF0C\u9ED8\u8BA4 \"x\"\uFF0C\u6700\u7EC8\u5C55\u793A\u4E3A \"x1\" */\n quantityPrefix?: string\n}\n\nexport interface AddToCartSuccessPopoverProps {\n /**\n * \u5F39\u7A97\u89E6\u53D1\u5668\uFF0C\u901A\u5E38\u662F\u8D2D\u7269\u8F66\u56FE\u6807\u6309\u94AE\uFF0C\u5185\u90E8\u4F7F\u7528 asChild \u5305\u88F9\u3002\n * \u5F53\u63D0\u4F9B triggerRef \u65F6\u53EF\u4E3A\u7A7A\uFF08\u6B64\u65F6 Popover \u951A\u5B9A\u5230\u5916\u90E8 DOM \u5143\u7D20\uFF09\u3002\n */\n children?: React.ReactNode\n /**\n * \u5916\u90E8\u951A\u70B9\u5143\u7D20 ref\uFF0C\u7528\u4E8E\u5C06 Popover \u951A\u5B9A\u5230\u9875\u9762\u4E0A\u5DF2\u6709\u7684\u5143\u7D20\uFF08\u5982\u5BFC\u822A\u680F\u4E2D\u7684\u8D2D\u7269\u8F66\u56FE\u6807\uFF09\uFF0C\n * \u65E0\u9700\u5305\u88F9\u8BE5\u5143\u7D20\u4F5C\u4E3A children\u3002\u4F20\u5165\u540E children \u53EF\u7701\u7565\uFF0C\u5185\u90E8\u4F7F\u7528 PopoverAnchor + virtualRef \u5B9E\u73B0\u3002\n * \u6CE8\u610F\uFF1A\u4EC5\u5728 children \u672A\u63D0\u4F9B\u65F6\u751F\u6548\uFF1B\u5982\u679C\u540C\u65F6\u63D0\u4F9B children \u548C triggerRef\uFF0Cchildren \u4F18\u5148\u3002\n */\n triggerRef?: React.RefObject<HTMLElement>\n /** \u53D7\u63A7\u5C55\u793A\u72B6\u6001 */\n open?: boolean\n /** \u975E\u53D7\u63A7\u9ED8\u8BA4\u5C55\u793A\u72B6\u6001 */\n defaultOpen?: boolean\n /** \u5C55\u793A\u72B6\u6001\u53D8\u5316\u56DE\u8C03 */\n onOpenChange?: (open: boolean) => void\n /** \u521A\u52A0\u8D2D\u7684\u5546\u54C1\u6570\u636E\uFF08\u590D\u7528 AccessoryShelf \u7684 AccessoryProductData\uFF09 */\n product: AccessoryProductData\n /** \u5546\u54C1\u53C2\u6570\u5217\u8868\uFF0C\u5982\u989C\u8272/\u8D60\u54C1\uFF0C\u6E32\u67D3\u4E3A \"Color: Classic Black \u00B7 Gift: 1\" */\n paramList?: { label: string; value: string }[]\n /** \u662F\u5426\u5C55\u793A\u539F\u4EF7\uFF08\u5220\u9664\u7EBF\uFF09\uFF0C\u9ED8\u8BA4 true\uFF08\u5F53 product.originalPrice \u5B58\u5728\u65F6\uFF09 */\n showOriginalPrice?: boolean\n /** \u672C\u6B21\u52A0\u8D2D\u6570\u91CF\uFF0C\u7528\u4E8E\u5C55\u793A \"x1\"\uFF0C\u9ED8\u8BA4 1 */\n quantity?: number\n /** \u8D2D\u7269\u8F66\u5546\u54C1\u603B\u6570\uFF0C\u7528\u4E8E\u5E95\u90E8\u6587\u6848\u63D2\u503C\uFF1B\u4E0D\u4F20\u5219\u56DE\u9000\u4E3A quantity */\n cartTotalCount?: number\n /** \u70B9\u51FB \"View Cart\" \u6309\u94AE\u56DE\u8C03 */\n onViewCart?: () => void\n /** \u6587\u6848\u914D\u7F6E */\n copy?: AddToCartSuccessCopyConfig\n /**\n * \u81EA\u52A8\u5173\u95ED\u5EF6\u65F6\uFF08\u6BEB\u79D2\uFF09\uFF0C\u8BBE\u4E3A 0 \u6216 null \u5219\u7981\u7528\u81EA\u52A8\u5173\u95ED\u3002\n * \u9ED8\u8BA4 8000\uFF088\u79D2\uFF09\uFF0C\u7528\u6237\u65E0\u4EFB\u4F55\u64CD\u4F5C\u65F6\u81EA\u52A8\u9690\u85CF\u3002\n */\n autoCloseDuration?: number | null\n /** Popover \u5BF9\u9F50\u65B9\u5F0F\uFF0C\u9ED8\u8BA4 center\uFF08\u5C45\u4E2D\u4E8E\u89E6\u53D1\u5668\uFF09\uFF0C\u79FB\u52A8\u7AEF\u81EA\u52A8\u5C45\u4E2D\u4E8E\u5C4F\u5E55 */\n align?: 'start' | 'center' | 'end'\n /** Popover \u5F39\u51FA\u65B9\u5411\uFF0C\u9ED8\u8BA4 bottom */\n side?: 'top' | 'right' | 'bottom' | 'left'\n /** \u8DDD\u79BB\u89E6\u53D1\u5668\u7684\u504F\u79FB\u91CF\uFF0C\u9ED8\u8BA4 12 */\n sideOffset?: number\n /** \u6839\u5143\u7D20\u7C7B\u540D */\n className?: string\n /** \u8BED\u4E49\u5316\u7C7B\u540D\u8986\u76D6 */\n classNames?: Partial<Record<AddToCartSuccessSemanticName, string>>\n}\n\nconst CheckIcon = ({ className }: { className?: string }) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n className={className}\n aria-hidden\n >\n <circle cx=\"10\" cy=\"10\" r=\"8.75\" fill=\"#30D158\" />\n <path\n d=\"M5.8335 9.58333L9.16683 12.5L14.1668 7.5\"\n stroke=\"white\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n)\n\nconst CloseIcon = (props: React.ComponentPropsWithoutRef<'svg'>) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" {...props}>\n <path\n d=\"M4.69617 4.69673C5.02156 4.37125 5.54924 4.3713 5.87468 4.69673L9.99947 8.82152L14.1243 4.69673C14.4497 4.37129 14.9774 4.37125 15.3028 4.69673C15.6281 5.02219 15.6281 5.5498 15.3028 5.87524L11.178 10L15.3028 14.1248C15.6281 14.4503 15.6281 14.9779 15.3028 15.3033C14.9774 15.6288 14.4497 15.6288 14.1243 15.3033L9.99947 11.1785L5.87468 15.3033C5.54924 15.6288 5.02156 15.6288 4.69617 15.3033C4.3708 14.9779 4.37081 14.4503 4.69617 14.1248L8.82096 10L4.69617 5.87524C4.37081 5.5498 4.3708 5.02219 4.69617 4.69673Z\"\n fill=\"#080A0F\"\n />\n </svg>\n)\n\n/**\n * AddToCartSuccessPopover - \u52A0\u8D2D\u6210\u529F\u60AC\u6D6E\u63D0\u793A\n *\n * @description \u7528\u6237\u70B9\u51FB\u52A0\u8D2D\u540E\uFF0C\u951A\u5B9A\u5728\u89E6\u53D1\u5668\uFF08\u5982\u8D2D\u7269\u8F66\u56FE\u6807\uFF09\u4E0B\u65B9\u5C55\u793A\u7684\u975E\u6A21\u6001\u60AC\u6D6E\u63D0\u793A\uFF0C\n * \u5C55\u793A\u6210\u529F\u63D0\u793A\u3001\u5546\u54C1\u4FE1\u606F\u3001\u8D2D\u7269\u8F66\u603B\u6570\u53CA\"\u67E5\u770B\u8D2D\u7269\u8F66\"\u5165\u53E3\u3002\n */\nconst AddToCartSuccessPopover = React.forwardRef<HTMLDivElement, AddToCartSuccessPopoverProps>(\n (\n {\n children,\n triggerRef,\n open: controlledOpen,\n defaultOpen,\n onOpenChange,\n product,\n paramList,\n showOriginalPrice = true,\n quantity = 1,\n cartTotalCount,\n onViewCart,\n copy,\n autoCloseDuration = 8000,\n align = 'center',\n side = 'bottom',\n sideOffset = 12,\n className,\n classNames,\n },\n ref\n ) => {\n const { trackingData } = useAiuiContext()\n const [internalOpen, setInternalOpen] = React.useState(defaultOpen ?? false)\n const isControlled = controlledOpen !== undefined\n const isOpen = isControlled ? controlledOpen : internalOpen\n\n const handleOpenChange = React.useCallback(\n (nextOpen: boolean) => {\n if (!isControlled) setInternalOpen(nextOpen)\n onOpenChange?.(nextOpen)\n },\n [isControlled, onOpenChange]\n )\n\n // \u81EA\u52A8\u5173\u95ED\u8BA1\u65F6\u5668\n React.useEffect(() => {\n if (!isOpen || autoCloseDuration == null || autoCloseDuration <= 0) return\n const timer = setTimeout(() => handleOpenChange(false), autoCloseDuration)\n return () => clearTimeout(timer)\n }, [isOpen, autoCloseDuration, handleOpenChange])\n\n const successTitle = copy?.successTitle ?? 'Successfully added to cart!'\n const cartCountTemplate = copy?.cartCountText ?? 'There are {count} items in the shopping cart.'\n const viewCartLabel = copy?.viewCartLabel ?? 'View Cart'\n const closeLabel = copy?.closeLabel ?? 'Close'\n const quantityPrefix = copy?.quantityPrefix ?? 'x'\n\n const cartCountText = cartCountTemplate.replace('{count}', String(cartTotalCount ?? quantity))\n const displayTitle = product.custom_name || product.name\n const displayImage = product.custom_image || product.image\n\n const boxRef = useRef<HTMLDivElement>(null)\n\n useExposure(boxRef, {\n componentType,\n componentName,\n componentTitle: successTitle,\n componentDescription: cartCountText,\n })\n\n React.useImperativeHandle(ref, () => boxRef.current as HTMLDivElement)\n\n // virtualRef \u9002\u914D\uFF1A\u521B\u5EFA\u5305\u542B contextElement \u7684\u865A\u62DF\u5143\u7D20\uFF0C\n // \u786E\u4FDD Floating UI \u80FD\u6B63\u786E\u8FFD\u8E2A\u951A\u70B9\u7684\u6EDA\u52A8\u548C\u4F4D\u7F6E\u53D8\u5316\u3002\n // getBoundingClientRect \u4F1A\u5C06\u951A\u70B9\u4F4D\u7F6E\u5939\u6301\u5728\u89C6\u53E3\u5185\uFF0C\u4FDD\u8BC1\u5F39\u7A97\u5728\u951A\u70B9\u6EDA\u51FA\u5C4F\u5E55\u540E\u4ECD\u53EF\u89C1\u3002\n const virtualRef = React.useMemo(() => {\n if (!triggerRef) return undefined\n\n return {\n current: {\n getBoundingClientRect: () => {\n const el = triggerRef.current\n const rect = el?.getBoundingClientRect() ?? new DOMRect()\n const vw = window.innerWidth\n const vh = window.innerHeight\n const pad = 16\n\n // \u951A\u70B9\u5728\u89C6\u53E3\u4E0A\u65B9\uFF08\u5411\u4E0A\u6EDA\u51FA\uFF09\n if (rect.bottom <= pad) {\n return new DOMRect(Math.max(pad, Math.min(rect.left, vw - pad - rect.width)), pad, rect.width || 0, 0)\n }\n // \u951A\u70B9\u5728\u89C6\u53E3\u4E0B\u65B9\uFF08\u5411\u4E0B\u6EDA\u51FA\uFF09\n if (rect.top >= vh - pad) {\n return new DOMRect(\n Math.max(pad, Math.min(rect.left, vw - pad - rect.width)),\n vh - pad,\n rect.width || 0,\n 0\n )\n }\n return rect\n },\n contextElement: triggerRef.current || undefined,\n },\n } as React.RefObject<{ getBoundingClientRect(): DOMRect; contextElement?: HTMLElement }>\n }, [triggerRef])\n\n const trigger =\n children != null ? (\n <PopoverTrigger asChild>{children}</PopoverTrigger>\n ) : (\n triggerRef && <PopoverAnchor virtualRef={virtualRef} />\n )\n\n return (\n <Popover open={isOpen} onOpenChange={handleOpenChange}>\n {trigger}\n <PopoverContent\n ref={boxRef}\n align={align}\n side={side}\n sideOffset={sideOffset}\n zIndex={101}\n avoidCollisions\n collisionPadding={16}\n className={cn(\n 'rounded-card laptop:w-[420px] laptop:p-6 relative w-[calc(100vw-32px)] max-w-[420px] border-none bg-white p-4 shadow-[0_2px_8px_0_rgba(0,0,0,0.12)] outline-none',\n className,\n classNames?.root\n )}\n >\n <PopoverArrow className={cn('drop-shadow-[0_2px_8px_rgba(0,0,0,0.12)]', classNames?.arrow)} />\n\n <PopoverClose asChild>\n <button\n type=\"button\"\n className={cn(\n 'text-info-tertiary hover:text-info-primary absolute right-4 top-4 transition-colors',\n classNames?.closeButton\n )}\n aria-label={closeLabel}\n onClick={() => {\n gaTrack({\n event: 'ga4Event',\n event_name: 'component_click',\n event_parameters: {\n page_group: trackingData?.pageGroup || 'Home Page',\n component_type: componentType,\n component_name: componentName,\n component_description: cartCountText,\n position: 1,\n navigation: 'Close',\n component_title: successTitle,\n sku: product?.sku,\n button_name: 'Close',\n creative_id: '',\n },\n })\n }}\n >\n <CloseIcon className=\"laptop:size-6 size-5\" />\n </button>\n </PopoverClose>\n\n <div className={cn('laptop:pt-6 flex items-center gap-1 pr-4 pt-5', classNames?.header)}>\n <CheckIcon className={cn('laptop:size-6 size-5 shrink-0', classNames?.successIcon)} />\n <Heading\n as=\"h3\"\n size={2}\n className={cn('text-info-primary laptop:text-2xl text-xl', classNames?.successTitle)}\n >\n {successTitle}\n </Heading>\n </div>\n\n <div\n className={cn(\n 'bg-container-secondary-0 rounded-box-small laptop:mt-4 laptop:p-4 mt-3 flex items-start gap-2 p-3',\n classNames?.productRow\n )}\n >\n <div\n className={cn(\n 'laptop:size-16 size-12 shrink-0 overflow-hidden rounded-md mix-blend-multiply',\n classNames?.productImage\n )}\n >\n <Picture\n source={displayImage}\n alt={displayTitle}\n className=\"size-full\"\n imgClassName=\"object-contain size-full\"\n />\n </div>\n <div className={cn('flex min-w-0 flex-1 flex-col', classNames?.productInfo)}>\n <Text\n as=\"p\"\n className={cn(\n 'text-info-primary laptop:text-[14px] line-clamp-2 text-[12px] font-bold leading-[1.2]',\n classNames?.productTitle\n )}\n >\n {displayTitle}\n </Text>\n {paramList && paramList.length > 0 && (\n <Text\n as=\"p\"\n className={cn(\n 'text-info-tertiary laptop:mt-1 laptop:text-[14px] mt-[2px] text-[12px] font-bold',\n classNames?.productVariant\n )}\n >\n {paramList.map((p, i) => (\n <React.Fragment key={i}>\n {i > 0 && ' \u00B7 '}\n {p.label}: {p.value}\n </React.Fragment>\n ))}\n </Text>\n )}\n <div className={cn('mt-1 flex items-center justify-between gap-2', classNames?.priceRow)}>\n <div className=\"flex items-baseline gap-1\">\n <Text as=\"span\" className={cn('text-info-primary text-[14px] font-bold', classNames?.currentPrice)}>\n {product.price}\n </Text>\n {showOriginalPrice && product.originalPrice && (\n <Text\n as=\"span\"\n className={cn('text-info-tertiary text-[14px] font-bold line-through', classNames?.originalPrice)}\n >\n {product.originalPrice}\n </Text>\n )}\n </div>\n <Text\n as=\"span\"\n className={cn('text-info-primary shrink-0 text-[14px] font-bold', classNames?.quantity)}\n >\n {quantityPrefix}\n {quantity}\n </Text>\n </div>\n </div>\n </div>\n\n <Text\n as=\"p\"\n className={cn(\n 'text-info-primary laptop:mt-6 laptop:text-[18px] mt-4 text-[14px] font-bold',\n classNames?.cartCountText\n )}\n >\n {cartCountText}\n </Text>\n\n <div className=\"laptop:mt-4 mt-3 flex justify-end\">\n <Button\n variant=\"primary\"\n size=\"lg\"\n onClick={() => {\n gaTrack({\n event: 'ga4Event',\n event_name: 'component_click',\n event_parameters: {\n component_type: componentType,\n component_name: componentName,\n button_name: viewCartLabel,\n page_group: trackingData?.pageGroup || 'Home Page',\n component_description: cartCountText,\n position: 1,\n navigation: viewCartLabel,\n component_title: successTitle,\n sku: product?.sku,\n creative_id: '',\n },\n })\n onViewCart?.()\n }}\n className={cn('rounded-full', classNames?.viewCartButton)}\n >\n {viewCartLabel}\n </Button>\n </div>\n </PopoverContent>\n </Popover>\n )\n }\n)\n\nAddToCartSuccessPopover.displayName = 'AddToCartSuccessPopover'\n\nexport default AddToCartSuccessPopover\nexport { AddToCartSuccessPopover }\n"],
|
|
5
|
+
"mappings": "aAmHE,OASE,OAAAA,EATF,QAAAC,MAAA,oBAjHF,UAAYC,MAAW,QACvB,OAAS,UAAAC,MAAc,QACvB,OAAS,MAAAC,MAAU,+BACnB,OACE,WAAAC,EACA,kBAAAC,EACA,iBAAAC,EACA,kBAAAC,GACA,gBAAAC,GACA,gBAAAC,GACA,UAAAC,GACA,QAAAC,EACA,WAAAC,GACA,WAAAC,OACK,kCACP,OAAS,eAAAC,OAAmB,mCAC5B,OAAS,WAAAC,MAAe,8BAExB,OAAS,kBAAAC,OAAsB,iCAE/B,MAAMC,EAAgB,UAChBC,EAAgB,8BA2FhBC,GAAY,CAAC,CAAE,UAAAC,CAAU,IAC7BpB,EAAC,OACC,MAAM,6BACN,MAAM,KACN,OAAO,KACP,QAAQ,YACR,KAAK,OACL,UAAWoB,EACX,cAAW,GAEX,UAAArB,EAAC,UA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"PopoverAnchor", "PopoverContent", "PopoverClose", "PopoverArrow", "Button", "Text", "Heading", "Picture", "useExposure", "gaTrack", "useAiuiContext", "componentType", "componentName", "CheckIcon", "className", "CloseIcon", "props", "AddToCartSuccessPopover", "children", "triggerRef", "controlledOpen", "defaultOpen", "onOpenChange", "product", "paramList", "showOriginalPrice", "quantity", "cartTotalCount", "onViewCart", "copy", "autoCloseDuration", "align", "side", "sideOffset", "classNames", "ref", "trackingData", "internalOpen", "setInternalOpen", "isControlled", "isOpen", "handleOpenChange", "nextOpen", "timer", "successTitle", "cartCountTemplate", "viewCartLabel", "closeLabel", "quantityPrefix", "cartCountText", "displayTitle", "displayImage", "boxRef", "virtualRef", "rect", "vw", "vh", "pad", "trigger", "p", "i", "AddToCartSuccessPopover_default"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { AccessoryProductData } from '../AccessoryShelf/types.js';
|
|
3
|
+
export interface MainProductAreaProps {
|
|
4
|
+
productTitle: string;
|
|
5
|
+
variantImage?: {
|
|
6
|
+
url: string;
|
|
7
|
+
altText?: string | null;
|
|
8
|
+
} | null;
|
|
9
|
+
paramList?: {
|
|
10
|
+
label: string;
|
|
11
|
+
value: string;
|
|
12
|
+
}[];
|
|
13
|
+
addedItems?: AccessoryProductData[];
|
|
14
|
+
priceSlot?: React.ReactNode;
|
|
15
|
+
actionSlot?: React.ReactNode;
|
|
16
|
+
onItemQuantityChange?: (item: AccessoryProductData, qty: number) => void;
|
|
17
|
+
onItemRemove?: (item: AccessoryProductData) => void;
|
|
18
|
+
addedItemQuantities?: Record<string, number>;
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
declare const MainProductArea: React.ForwardRefExoticComponent<MainProductAreaProps & React.RefAttributes<HTMLDivElement>>;
|
|
22
|
+
export default MainProductArea;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as i from"react";import{useRef as z}from"react";import{cn as H}from"../../../../helpers/index.js";import M from"../../../../components/input-number.js";import{Dialog as j,DialogContent as S,DialogHeader as E,DialogTitle as F,DialogFooter as Q}from"../../../../components/dialog.js";import N from"../../../../components/button.js";import{Text as x,Heading as b,Picture as q}from"../../../../components/index.js";import{useExposure as B}from"../../../../hooks/useExposure.js";const I="product",L="main_product_area",_=({item:n,quantity:r,onQuantityChange:s,onRemoveClick:l})=>{const c=p=>{p<1?l():s(p)};return t("div",{className:"flex items-center gap-3",children:[e("div",{className:"size-[80px] shrink-0 overflow-hidden rounded-md mix-blend-multiply",children:e("img",{src:n.image??"",alt:n.name,className:"size-full object-contain"})}),t("div",{className:"laptop:gap-2 flex w-full flex-col gap-2",children:[t("div",{className:"laptop:flex-row laptop:justify-between flex w-full min-w-0 flex-1 flex-col gap-1",children:[e(b,{size:2,className:"text-info-primary laptop:text-base line-clamp-2 text-[14px] font-bold leading-[1.2] tracking-[-0.28px]",children:n.name}),t("div",{className:"flex items-center gap-1",children:[e(x,{as:"span",className:"text-info-primary laptop:text-base text-[14px] font-bold leading-tight tracking-[-0.28px]",children:n.price}),e(x,{as:"span",className:"text-info-tertiary text-[14px] font-bold leading-tight tracking-[-0.28px] line-through",children:n.originalPrice})]})]}),t("div",{className:"flex shrink-0 flex-row justify-between",children:[e(M,{classNames:{root:"border-lines border-[1px] rounded-lg",inputWrapper:"mx-0 laptop:w-[40px] size-[28px] laptop:h-[32px]",input:"border-none",button:"border-none size-[28px] laptop:size-8"},value:r,min:0,onChange:c}),e("button",{onClick:l,className:"text-info-tertiary laptop:text-base text-[14px] font-bold leading-tight tracking-[-0.28px] underline",children:"Remove"})]})]})]})},h=i.forwardRef(({productTitle:n,variantImage:r,paramList:s,addedItems:l=[],priceSlot:c,actionSlot:p,onItemQuantityChange:k,onItemRemove:w,addedItemQuantities:m,className:R},D)=>{const f=z(null);B(f,{componentType:I,componentName:L,componentTitle:n}),i.useImperativeHandle(D,()=>f.current);const[P,v]=i.useState(()=>m??{}),[d,u]=i.useState(null);i.useEffect(()=>{m&&v(m)},[m]);const C=(a,o)=>{v(g=>({...g,[a.sku]:o})),k?.(a,o)},A=()=>{if(!d)return;const a=l.find(o=>o.sku===d);u(null),a&&w?.(a)},T=l.find(a=>a.sku===d),y=a=>a.map(o=>e(_,{item:o,quantity:P[o.sku]??1,onQuantityChange:g=>C(o,g),onRemoveClick:()=>u(o.sku)},o.sku));return t("div",{ref:f,className:H("rounded-card",R),children:[t("div",{className:"laptop:gap-16 laptop:items-center flex items-start gap-2",children:[e("div",{className:"laptop:size-[216px] size-[80px] shrink-0 overflow-hidden mix-blend-multiply",children:e(q,{source:r?.url,alt:r?.altText??n,className:"size-full",imgClassName:"object-cover h-full"})}),t("div",{className:"flex-1",children:[t("div",{className:"laptop:flex-row flex min-w-0 flex-col items-center justify-between gap-4",children:[t("div",{className:"flex w-full min-w-0 flex-1 flex-col gap-1",children:[e(b,{as:"h1",size:2,className:"text-info-primary tracking-[-0.8px]",html:n}),s&&s.length>0&&e(x,{as:"p",className:"lg-desktop:text-[16px] text-info-tertiary text-[14px] font-bold leading-[1.4] tracking-[-0.28px]",children:s.map((a,o)=>t(i.Fragment,{children:[o>0&&" \xB7 ",a.label,": ",a.value]},o))})]}),t("div",{className:"laptop:justify-end laptop:flex-row laptop:items-center flex w-full flex-1 shrink-0 flex-col items-start gap-2",children:[c&&e("div",{className:"flex flex-col gap-1",children:c}),p]})]}),l.length>0&&t("div",{className:"laptop:block hidden",children:[e("div",{className:"bg-lines-1 my-6 h-px"}),e("div",{className:"flex flex-col gap-4",children:y(l)})]})]})]}),l.length>0&&t("div",{className:"laptop:hidden",children:[e("div",{className:"bg-lines-1 my-8 h-px"}),e("div",{className:"flex flex-col gap-4",children:y(l)})]}),e(j,{open:!!d,onOpenChange:a=>!a&&u(null),children:t(S,{className:"max-w-sm",children:[e(E,{children:e(F,{children:"Remove item?"})}),t(x,{as:"p",className:"text-info-tertiary text-[14px] leading-[1.4]",children:["Are you sure you want to remove ",e("span",{className:"text-info-primary",children:T?.name})," from your cart?"]}),t(Q,{className:"gap-2",children:[e(N,{variant:"secondary",size:"base",onClick:()=>u(null),children:"Cancel"}),e(N,{variant:"primary",size:"base",onClick:A,children:"Remove"})]})]})})]})});h.displayName="MainProductArea";var X=h;export{X as default};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/biz-components/AccessoriesShelf/components/MainProductArea/index.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { useRef } from 'react'\nimport { cn } from '../../../../helpers/index.js'\nimport InputNumber, { type InputNumberProps } from '../../../../components/input-number.js'\nimport { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from '../../../../components/dialog.js'\nimport Button from '../../../../components/button.js'\nimport { Text, Heading, Picture } from '../../../../components/index.js'\nimport { useExposure } from '../../../../hooks/useExposure.js'\nimport type { AccessoryProductData } from '../AccessoryShelf/types.js'\n\nconst componentType = 'product'\nconst componentName = 'main_product_area'\n\nexport interface MainProductAreaProps {\n productTitle: string\n variantImage?: { url: string; altText?: string | null } | null\n paramList?: { label: string; value: string }[]\n addedItems?: AccessoryProductData[]\n priceSlot?: React.ReactNode\n actionSlot?: React.ReactNode\n onItemQuantityChange?: (item: AccessoryProductData, qty: number) => void\n onItemRemove?: (item: AccessoryProductData) => void\n addedItemQuantities?: Record<string, number>\n className?: string\n}\n\nconst AddedItemRow = ({\n item,\n quantity,\n onQuantityChange,\n onRemoveClick,\n}: {\n item: AccessoryProductData\n quantity: number\n onQuantityChange: (qty: number) => void\n onRemoveClick: () => void\n}) => {\n const handleQuantityChange = (qty: number) => {\n if (qty < 1) {\n onRemoveClick()\n } else {\n onQuantityChange(qty)\n }\n }\n\n return (\n <div className=\"flex items-center gap-3\">\n <div className=\"size-[80px] shrink-0 overflow-hidden rounded-md mix-blend-multiply\">\n <img src={item.image ?? ''} alt={item.name} className=\"size-full object-contain\" />\n </div>\n <div className=\"laptop:gap-2 flex w-full flex-col gap-2\">\n <div className=\"laptop:flex-row laptop:justify-between flex w-full min-w-0 flex-1 flex-col gap-1\">\n <Heading\n size={2}\n className=\"text-info-primary laptop:text-base line-clamp-2 text-[14px] font-bold leading-[1.2] tracking-[-0.28px]\"\n >\n {item.name}\n </Heading>\n <div className=\"flex items-center gap-1\">\n <Text\n as=\"span\"\n className=\"text-info-primary laptop:text-base text-[14px] font-bold leading-tight tracking-[-0.28px]\"\n >\n {item.price}\n </Text>\n <Text\n as=\"span\"\n className=\"text-info-tertiary text-[14px] font-bold leading-tight tracking-[-0.28px] line-through\"\n >\n {item.originalPrice}\n </Text>\n </div>\n </div>\n <div className=\"flex shrink-0 flex-row justify-between\">\n <InputNumber\n classNames={{\n root: 'border-lines border-[1px] rounded-lg',\n inputWrapper: 'mx-0 laptop:w-[40px] size-[28px] laptop:h-[32px]',\n input: 'border-none',\n button: 'border-none size-[28px] laptop:size-8',\n }}\n value={quantity}\n min={0}\n onChange={handleQuantityChange as InputNumberProps['onChange']}\n />\n <button\n onClick={onRemoveClick}\n className=\"text-info-tertiary laptop:text-base text-[14px] font-bold leading-tight tracking-[-0.28px] underline\"\n >\n Remove\n </button>\n </div>\n </div>\n </div>\n )\n}\n\nconst MainProductArea = React.forwardRef<HTMLDivElement, MainProductAreaProps>(\n (\n {\n productTitle,\n variantImage,\n paramList,\n addedItems = [],\n priceSlot,\n actionSlot,\n onItemQuantityChange,\n onItemRemove,\n addedItemQuantities,\n className,\n },\n ref\n ) => {\n const boxRef = useRef<HTMLDivElement>(null)\n\n useExposure(boxRef, {\n componentType,\n componentName,\n componentTitle: productTitle,\n })\n\n React.useImperativeHandle(ref, () => boxRef.current as HTMLDivElement)\n\n const [quantities, setQuantities] = React.useState<Record<string, number>>(() => addedItemQuantities ?? {})\n const [pendingRemoveSku, setPendingRemoveSku] = React.useState<string | null>(null)\n\n React.useEffect(() => {\n if (addedItemQuantities) {\n setQuantities(addedItemQuantities)\n }\n }, [addedItemQuantities])\n\n const handleQuantityChange = (item: AccessoryProductData, qty: number) => {\n setQuantities(prev => ({ ...prev, [item.sku]: qty }))\n onItemQuantityChange?.(item, qty)\n }\n\n const handleRemoveConfirm = () => {\n if (!pendingRemoveSku) return\n const item = addedItems.find(i => i.sku === pendingRemoveSku)\n setPendingRemoveSku(null)\n if (item) onItemRemove?.(item)\n }\n\n const pendingRemoveItem = addedItems.find(i => i.sku === pendingRemoveSku)\n\n const renderItems = (items: AccessoryProductData[]) =>\n items.map(item => (\n <AddedItemRow\n key={item.sku}\n item={item}\n quantity={quantities[item.sku] ?? 1}\n onQuantityChange={qty => handleQuantityChange(item, qty)}\n onRemoveClick={() => setPendingRemoveSku(item.sku)}\n />\n ))\n\n return (\n <div ref={boxRef} className={cn('rounded-card', className)}>\n <div className=\"laptop:gap-16 laptop:items-center flex items-start gap-2\">\n <div className=\"laptop:size-[216px] size-[80px] shrink-0 overflow-hidden mix-blend-multiply\">\n <Picture\n source={variantImage?.url}\n alt={variantImage?.altText ?? productTitle}\n className=\"size-full\"\n imgClassName=\"object-cover h-full\"\n />\n </div>\n\n <div className=\"flex-1\">\n <div className=\"laptop:flex-row flex min-w-0 flex-col items-center justify-between gap-4\">\n <div className=\"flex w-full min-w-0 flex-1 flex-col gap-1\">\n <Heading as=\"h1\" size={2} className=\"text-info-primary tracking-[-0.8px]\" html={productTitle} />\n {paramList && paramList.length > 0 && (\n <Text\n as=\"p\"\n className=\"lg-desktop:text-[16px] text-info-tertiary text-[14px] font-bold leading-[1.4] tracking-[-0.28px]\"\n >\n {paramList.map((p, i) => (\n <React.Fragment key={i}>\n {i > 0 && ' \u00B7 '}\n {p.label}: {p.value}\n </React.Fragment>\n ))}\n </Text>\n )}\n </div>\n <div className=\"laptop:justify-end laptop:flex-row laptop:items-center flex w-full flex-1 shrink-0 flex-col items-start gap-2\">\n {priceSlot && <div className=\"flex flex-col gap-1\">{priceSlot}</div>}\n {actionSlot}\n </div>\n </div>\n\n {addedItems.length > 0 && (\n <div className=\"laptop:block hidden\">\n <div className=\"bg-lines-1 my-6 h-px\" />\n <div className=\"flex flex-col gap-4\">{renderItems(addedItems)}</div>\n </div>\n )}\n </div>\n </div>\n\n {addedItems.length > 0 && (\n <div className=\"laptop:hidden\">\n <div className=\"bg-lines-1 my-8 h-px\" />\n <div className=\"flex flex-col gap-4\">{renderItems(addedItems)}</div>\n </div>\n )}\n\n <Dialog open={!!pendingRemoveSku} onOpenChange={open => !open && setPendingRemoveSku(null)}>\n <DialogContent className=\"max-w-sm\">\n <DialogHeader>\n <DialogTitle>Remove item?</DialogTitle>\n </DialogHeader>\n <Text as=\"p\" className=\"text-info-tertiary text-[14px] leading-[1.4]\">\n Are you sure you want to remove <span className=\"text-info-primary\">{pendingRemoveItem?.name}</span> from\n your cart?\n </Text>\n <DialogFooter className=\"gap-2\">\n <Button variant=\"secondary\" size=\"base\" onClick={() => setPendingRemoveSku(null)}>\n Cancel\n </Button>\n <Button variant=\"primary\" size=\"base\" onClick={handleRemoveConfirm}>\n Remove\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n </div>\n )\n }\n)\n\nMainProductArea.displayName = 'MainProductArea'\n\nexport default MainProductArea\n"],
|
|
5
|
+
"mappings": "aAkDQ,cAAAA,EAUE,QAAAC,MAVF,oBAhDR,UAAYC,MAAW,QACvB,OAAS,UAAAC,MAAc,QACvB,OAAS,MAAAC,MAAU,+BACnB,OAAOC,MAA4C,yCACnD,OAAS,UAAAC,EAAQ,iBAAAC,EAAe,gBAAAC,EAAc,eAAAC,EAAa,gBAAAC,MAAoB,mCAC/E,OAAOC,MAAY,mCACnB,OAAS,QAAAC,EAAM,WAAAC,EAAS,WAAAC,MAAe,kCACvC,OAAS,eAAAC,MAAmB,mCAG5B,MAAMC,EAAgB,UAChBC,EAAgB,oBAehBC,EAAe,CAAC,CACpB,KAAAC,EACA,SAA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putNumber", "Dialog", "DialogContent", "DialogHeader", "DialogTitle", "DialogFooter", "Button", "Text", "Heading", "Picture", "useExposure", "componentType", "componentName", "AddedItemRow", "item", "quantity", "onQuantityChange", "onRemoveClick", "handleQuantityChange", "qty", "MainProductArea", "productTitle", "variantImage", "paramList", "addedItems", "priceSlot", "actionSlot", "onItemQuantityChange", "onItemRemove", "addedItemQuantities", "className", "ref", "boxRef", "quantities", "setQuantities", "pendingRemoveSku", "setPendingRemoveSku", "prev", "handleRemoveConfirm", "i", "pendingRemoveItem", "renderItems", "items", "p", "open", "MainProductArea_default"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { UserType, BannerConfig, BannerAction } from '../../types.js';
|
|
3
|
+
export interface PromoBannerProps {
|
|
4
|
+
userType: UserType;
|
|
5
|
+
configs: Partial<Record<UserType, BannerConfig | null>>;
|
|
6
|
+
onAction?: (action: BannerAction) => void;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const PromoBanner: React.ForwardRefExoticComponent<PromoBannerProps & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
export default PromoBanner;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as o}from"react/jsx-runtime";import*as m from"react";import{cn as g}from"../../../../helpers/index.js";import{Text as C}from"../../../../components/index.js";const u=({className:t})=>o("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"28",height:"24",viewBox:"0 0 28 24",fill:"none",children:[e("path",{d:"M20.3194 0C21.1834 0 21.9923 0.429768 22.479 1.14948L27.5462 8.64391C28.2476 9.68126 28.125 11.0736 27.254 11.9707L16.6544 22.8856C15.2122 24.3702 12.8426 24.3716 11.3981 22.8891L0.748688 11.9602C-0.114133 11.0747 -0.24628 9.7017 0.430898 8.66496L5.31604 1.18456C5.79941 0.444636 6.62004 0 7.49882 0H20.3194Z",fill:"#005D8E"}),e("path",{d:"M19.0076 8.33664C19.4627 7.88876 20.2013 7.88756 20.6574 8.3344C21.1132 8.78154 21.1144 9.50728 20.6596 9.95535L14.8762 15.6466C14.3983 16.1168 13.6232 16.118 13.1443 15.6488L7.34264 9.95759C6.88678 9.51045 6.88556 8.78471 7.34036 8.33664C7.79546 7.88876 8.53413 7.88756 8.99017 8.3344L14.008 13.2555L19.0076 8.33664Z",fill:"white"})]}),x=({className:t})=>o("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"28",height:"24",viewBox:"0 0 28 24",fill:"none",children:[e("path",{d:"M20.3194 0C21.1834 0 21.9923 0.429768 22.479 1.14948L27.5462 8.64391C28.2476 9.68126 28.125 11.0736 27.254 11.9707L16.6544 22.8856C15.2122 24.3702 12.8426 24.3716 11.3981 22.8891L0.748688 11.9602C-0.114133 11.0747 -0.24628 9.7017 0.430898 8.66496L5.31604 1.18456C5.79941 0.444636 6.62004 0 7.49882 0H20.3194Z",fill:"url(#paint0_linear_5861_8479)"}),e("path",{d:"M19.0076 8.33664C19.4627 7.88876 20.2013 7.88756 20.6574 8.3344C21.1132 8.78154 21.1144 9.50728 20.6596 9.95535L14.8762 15.6466C14.3983 16.1168 13.6232 16.118 13.1443 15.6488L7.34264 9.95759C6.88678 9.51045 6.88556 8.78471 7.34036 8.33664C7.79546 7.88876 8.53413 7.88756 8.99017 8.3344L14.008 13.2555L19.0076 8.33664Z",fill:"url(#paint1_linear_5861_8479)"}),o("defs",{children:[o("linearGradient",{id:"paint0_linear_5861_8479",x1:"-0.341464",y1:"1.07126e-06",x2:"30.68",y2:"4.66513",gradientUnits:"userSpaceOnUse",children:[e("stop",{stopColor:"#6E6754"}),e("stop",{offset:"1",stopColor:"#070708"})]}),o("linearGradient",{id:"paint1_linear_5861_8479",x1:"6.82927",y1:"8",x2:"21.9228",y2:"11.4047",gradientUnits:"userSpaceOnUse",children:[e("stop",{stopColor:"#FFF5E0"}),e("stop",{offset:"1",stopColor:"#E8C08A"})]})]})]}),h={guest:"bg-[#E1F8FE]",member:"bg-[#FFF1E1]","plus-member":"bg-[#FFF1E1]"},s=m.forwardRef(({userType:t,configs:l,onAction:d,className:c},p)=>{const n=l[t];if(!n?.text)return null;const a=()=>{n.action&&d?.(n.action)},r=!!n.action,f=n.backgroundColor?void 0:h[t];return e("div",{ref:p,role:r?"button":void 0,tabIndex:r?0:void 0,onClick:r?a:void 0,onKeyDown:r?i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),a())}:void 0,className:g("rounded-card flex items-center justify-center px-6 py-4","lg-desktop:text-[16px] text-[14px] font-bold leading-[1.4] tracking-[-0.28px]",f,r&&"cursor-pointer",c),style:n.backgroundColor?{backgroundColor:n.backgroundColor}:void 0,children:o("div",{className:"flex items-end gap-1",children:[t==="guest"?e(u,{className:"shrink-0"}):e(x,{className:"shrink-0"}),e(C,{html:n.text,as:"div",className:"[&_a]:text-brand-0 flex items-center gap-1 [&_a]:underline"})]})})});s.displayName="PromoBanner";var y=s;export{y as default};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/biz-components/AccessoriesShelf/components/PromoBanner/index.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../../../helpers/index.js'\nimport type { UserType, BannerConfig, BannerAction } from '../../types.js'\nimport { Text } from '../../../../components/index.js'\n\nexport interface PromoBannerProps {\n userType: UserType\n configs: Partial<Record<UserType, BannerConfig | null>>\n onAction?: (action: BannerAction) => void\n className?: string\n}\n\nconst GuestPromotionalIcon = ({ className }: { className?: string }) => {\n return (\n <svg\n className={className}\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"28\"\n height=\"24\"\n viewBox=\"0 0 28 24\"\n fill=\"none\"\n >\n <path\n d=\"M20.3194 0C21.1834 0 21.9923 0.429768 22.479 1.14948L27.5462 8.64391C28.2476 9.68126 28.125 11.0736 27.254 11.9707L16.6544 22.8856C15.2122 24.3702 12.8426 24.3716 11.3981 22.8891L0.748688 11.9602C-0.114133 11.0747 -0.24628 9.7017 0.430898 8.66496L5.31604 1.18456C5.79941 0.444636 6.62004 0 7.49882 0H20.3194Z\"\n fill=\"#005D8E\"\n />\n <path\n d=\"M19.0076 8.33664C19.4627 7.88876 20.2013 7.88756 20.6574 8.3344C21.1132 8.78154 21.1144 9.50728 20.6596 9.95535L14.8762 15.6466C14.3983 16.1168 13.6232 16.118 13.1443 15.6488L7.34264 9.95759C6.88678 9.51045 6.88556 8.78471 7.34036 8.33664C7.79546 7.88876 8.53413 7.88756 8.99017 8.3344L14.008 13.2555L19.0076 8.33664Z\"\n fill=\"white\"\n />\n </svg>\n )\n}\n\nconst MemberPromotionalIcon = ({ className }: { className?: string }) => {\n return (\n <svg\n className={className}\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"28\"\n height=\"24\"\n viewBox=\"0 0 28 24\"\n fill=\"none\"\n >\n <path\n d=\"M20.3194 0C21.1834 0 21.9923 0.429768 22.479 1.14948L27.5462 8.64391C28.2476 9.68126 28.125 11.0736 27.254 11.9707L16.6544 22.8856C15.2122 24.3702 12.8426 24.3716 11.3981 22.8891L0.748688 11.9602C-0.114133 11.0747 -0.24628 9.7017 0.430898 8.66496L5.31604 1.18456C5.79941 0.444636 6.62004 0 7.49882 0H20.3194Z\"\n fill=\"url(#paint0_linear_5861_8479)\"\n />\n <path\n d=\"M19.0076 8.33664C19.4627 7.88876 20.2013 7.88756 20.6574 8.3344C21.1132 8.78154 21.1144 9.50728 20.6596 9.95535L14.8762 15.6466C14.3983 16.1168 13.6232 16.118 13.1443 15.6488L7.34264 9.95759C6.88678 9.51045 6.88556 8.78471 7.34036 8.33664C7.79546 7.88876 8.53413 7.88756 8.99017 8.3344L14.008 13.2555L19.0076 8.33664Z\"\n fill=\"url(#paint1_linear_5861_8479)\"\n />\n <defs>\n <linearGradient\n id=\"paint0_linear_5861_8479\"\n x1=\"-0.341464\"\n y1=\"1.07126e-06\"\n x2=\"30.68\"\n y2=\"4.66513\"\n gradientUnits=\"userSpaceOnUse\"\n >\n <stop stopColor=\"#6E6754\" />\n <stop offset=\"1\" stopColor=\"#070708\" />\n </linearGradient>\n <linearGradient\n id=\"paint1_linear_5861_8479\"\n x1=\"6.82927\"\n y1=\"8\"\n x2=\"21.9228\"\n y2=\"11.4047\"\n gradientUnits=\"userSpaceOnUse\"\n >\n <stop stopColor=\"#FFF5E0\" />\n <stop offset=\"1\" stopColor=\"#E8C08A\" />\n </linearGradient>\n </defs>\n </svg>\n )\n}\n\nconst BANNER_BG: Record<UserType, string> = {\n guest: 'bg-[#E1F8FE]',\n member: 'bg-[#FFF1E1]',\n 'plus-member': 'bg-[#FFF1E1]',\n}\n\nconst PromoBanner = React.forwardRef<HTMLDivElement, PromoBannerProps>(\n ({ userType, configs, onAction, className }, ref) => {\n const config = configs[userType]\n if (!config?.text) return null\n\n const handleClick = () => {\n if (config.action) onAction?.(config.action)\n }\n\n const hasClickBehavior = !!config.action\n const bgColor = config.backgroundColor ? undefined : BANNER_BG[userType]\n\n return (\n <div\n ref={ref}\n role={hasClickBehavior ? 'button' : undefined}\n tabIndex={hasClickBehavior ? 0 : undefined}\n onClick={hasClickBehavior ? handleClick : undefined}\n onKeyDown={\n hasClickBehavior\n ? e => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n handleClick()\n }\n }\n : undefined\n }\n className={cn(\n 'rounded-card flex items-center justify-center px-6 py-4',\n 'lg-desktop:text-[16px] text-[14px] font-bold leading-[1.4] tracking-[-0.28px]',\n bgColor,\n hasClickBehavior && 'cursor-pointer',\n className\n )}\n style={config.backgroundColor ? { backgroundColor: config.backgroundColor } : undefined}\n >\n <div className=\"flex items-end gap-1\">\n {userType === 'guest' ? (\n <GuestPromotionalIcon className=\"shrink-0\" />\n ) : (\n <MemberPromotionalIcon className=\"shrink-0\" />\n )}\n <Text html={config.text} as=\"div\" className=\"[&_a]:text-brand-0 flex items-center gap-1 [&_a]:underline\" />\n </div>\n </div>\n )\n }\n)\n\nPromoBanner.displayName = 'PromoBanner'\n\nexport default PromoBanner\n"],
|
|
5
|
+
"mappings": "aAgBI,OAQE,OAAAA,EARF,QAAAC,MAAA,oBAdJ,UAAYC,MAAW,QACvB,OAAS,MAAAC,MAAU,+BAEnB,OAAS,QAAAC,MAAY,kCASrB,MAAMC,EAAuB,CAAC,CAAE,UAAAC,CAAU,IAEtCL,EAAC,OACC,UAAWK,EACX,MAAM,6BACN,MAAM,KACN,OAAO,KACP,QAAQ,YACR,KAAK,OAEL,UAAAN,EAAC,QACC,EAAE,uTACF,KAAK,UACP,EACAA,EAAC,QACC,EAAE,gUACF,KAAK,QACP,GACF,EAIEO,EAAwB,CAAC,CAAE,UAAAD,CAAU,IAEvCL,EAAC,OACC,UAAWK,EACX,MAAM,6BACN,MAAM,KACN,OAAO,KACP,QAAQ,YACR,KAAK,OAEL,UAAAN,EAAC,QACC,EAAE,uTACF,KAAK,gCACP,EACAA,EAAC,QACC,EAAE,gUACF,KAAK,gCACP,EACAC,EAAC,QACC,UAAAA,EAAC,kBACC,GAAG,0BACH,GAAG,YACH,GAAG,cACH,GAAG,QACH,GAAG,UACH,cAAc,iBAEd,UAAAD,EAAC,QAAK,UAAU,UAAU,EAC1BA,EAAC,QAAK,OAAO,IAAI,UAAU,UAAU,GACvC,EACAC,EAAC,kBACC,GAAG,0BACH,GAAG,UACH,GAAG,IACH,GAAG,UACH,GAAG,UACH,cAAc,iBAEd,UAAAD,EAAC,QAAK,UAAU,UAAU,EAC1BA,EAAC,QAAK,OAAO,IAAI,UAAU,UAAU,GACvC,GACF,GACF,EAIEQ,EAAsC,CAC1C,MAAO,eACP,OAAQ,eACR,cAAe,cACjB,EAEMC,EAAcP,EAAM,WACxB,CAAC,CAAE,SAAAQ,EAAU,QAAAC,EAAS,SAAAC,EAAU,UAAAN,CAAU,EAAGO,IAAQ,CACnD,MAAMC,EAASH,EAAQD,CAAQ,EAC/B,GAAI,CAACI,GAAQ,KAAM,OAAO,KAE1B,MAAMC,EAAc,IAAM,CACpBD,EAAO,QAAQF,IAAWE,EAAO,MAAM,CAC7C,EAEME,EAAmB,CAAC,CAACF,EAAO,OAC5BG,EAAUH,EAAO,gBAAkB,OAAYN,EAAUE,CAAQ,EAEvE,OACEV,EAAC,OACC,IAAKa,EACL,KAAMG,EAAmB,SAAW,OACpC,SAAUA,EAAmB,EAAI,OACjC,QAASA,EAAmBD,EAAc,OAC1C,UACEC,EACIE,GAAK,EACCA,EAAE,MAAQ,SAAWA,EAAE,MAAQ,OACjCA,EAAE,eAAe,EACjBH,EAAY,EAEhB,EACA,OAEN,UAAWZ,EACT,0DACA,gFACAc,EACAD,GAAoB,iBACpBV,CACF,EACA,MAAOQ,EAAO,gBAAkB,CAAE,gBAAiBA,EAAO,eAAgB,EAAI,OAE9E,SAAAb,EAAC,OAAI,UAAU,uBACZ,UAAAS,IAAa,QACZV,EAACK,EAAA,CAAqB,UAAU,WAAW,EAE3CL,EAACO,EAAA,CAAsB,UAAU,WAAW,EAE9CP,EAACI,EAAA,CAAK,KAAMU,EAAO,KAAM,GAAG,MAAM,UAAU,6DAA6D,GAC3G,EACF,CAEJ,CACF,EAEAL,EAAY,YAAc,cAE1B,IAAOU,EAAQV",
|
|
6
|
+
"names": ["jsx", "jsxs", "React", "cn", "Text", "GuestPromotionalIcon", "className", "MemberPromotionalIcon", "BANNER_BG", "PromoBanner", "userType", "configs", "onAction", "ref", "config", "handleClick", "hasClickBehavior", "bgColor", "e", "PromoBanner_default"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface SectionHeaderProps {
|
|
3
|
+
title: string;
|
|
4
|
+
subtitle?: string;
|
|
5
|
+
selectionNote?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const SectionHeader: React.ForwardRefExoticComponent<SectionHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
export default SectionHeader;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as o}from"react/jsx-runtime";import*as p from"react";import{cn as x}from"../../../../helpers/index.js";import{Text as i,Heading as m}from"../../../../components/index.js";const r=p.forwardRef(({title:s,subtitle:t,selectionNote:a,className:l},n)=>o("div",{ref:n,className:x("laptop:flex-row laptop:items-end flex flex-col justify-between gap-6",l),children:[o("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:[e(m,{html:s,size:4,className:"text-info-primary"}),t&&e(i,{as:"p",html:t,className:"lg-desktop:text-[16px] text-info-primary text-[14px] font-bold leading-[1.4] tracking-[-0.28px]"})]}),a&&e(i,{as:"p",html:a,className:"lg-desktop:text-[16px] [&_span]:text-brand-0 text-info-primary shrink-0 whitespace-nowrap text-[14px] font-bold leading-[1.4] tracking-[-0.28px]"})]}));r.displayName="SectionHeader";var c=r;export{c as default};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/biz-components/AccessoriesShelf/components/SectionHeader/index.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../../../helpers/index.js'\nimport { Text, Heading } from '../../../../components/index.js'\n\nexport interface SectionHeaderProps {\n title: string\n subtitle?: string\n selectionNote?: string\n className?: string\n}\n\nconst SectionHeader = React.forwardRef<HTMLDivElement, SectionHeaderProps>(\n ({ title, subtitle, selectionNote, className }, ref) => {\n return (\n <div ref={ref} className={cn('laptop:flex-row laptop:items-end flex flex-col justify-between gap-6', className)}>\n <div className=\"flex min-w-0 flex-1 flex-col gap-2\">\n <Heading html={title} size={4} className=\"text-info-primary\" />\n {subtitle && (\n <Text\n as=\"p\"\n html={subtitle}\n className=\"lg-desktop:text-[16px] text-info-primary text-[14px] font-bold leading-[1.4] tracking-[-0.28px]\"\n />\n )}\n </div>\n {selectionNote && (\n <Text\n as=\"p\"\n html={selectionNote}\n className=\"lg-desktop:text-[16px] [&_span]:text-brand-0 text-info-primary shrink-0 whitespace-nowrap text-[14px] font-bold leading-[1.4] tracking-[-0.28px]\"\n />\n )}\n </div>\n )\n }\n)\n\nSectionHeader.displayName = 'SectionHeader'\n\nexport default SectionHeader\n"],
|
|
5
|
+
"mappings": "aAiBQ,OACE,OAAAA,EADF,QAAAC,MAAA,oBAfR,UAAYC,MAAW,QACvB,OAAS,MAAAC,MAAU,+BACnB,OAAS,QAAAC,EAAM,WAAAC,MAAe,kCAS9B,MAAMC,EAAgBJ,EAAM,WAC1B,CAAC,CAAE,MAAAK,EAAO,SAAAC,EAAU,cAAAC,EAAe,UAAAC,CAAU,EAAGC,IAE5CV,EAAC,OAAI,IAAKU,EAAK,UAAWR,EAAG,uEAAwEO,CAAS,EAC5G,UAAAT,EAAC,OAAI,UAAU,qCACb,UAAAD,EAACK,EAAA,CAAQ,KAAME,EAAO,KAAM,EAAG,UAAU,oBAAoB,EAC5DC,GACCR,EAACI,EAAA,CACC,GAAG,IACH,KAAMI,EACN,UAAU,kGACZ,GAEJ,EACCC,GACCT,EAACI,EAAA,CACC,GAAG,IACH,KAAMK,EACN,UAAU,mJACZ,GAEJ,CAGN,EAEAH,EAAc,YAAc,gBAE5B,IAAOM,EAAQN",
|
|
6
|
+
"names": ["jsx", "jsxs", "React", "cn", "Text", "Heading", "SectionHeader", "title", "subtitle", "selectionNote", "className", "ref", "SectionHeader_default"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import MainProductArea from './components/MainProductArea/index.js';
|
|
2
|
+
import PromoBanner from './components/PromoBanner/index.js';
|
|
3
|
+
import SectionHeader from './components/SectionHeader/index.js';
|
|
4
|
+
import AccessoriesProductGrid from './components/AccessoriesProductGrid/index.js';
|
|
5
|
+
import AddToCartSuccessPopover from './components/AddToCartSuccessPopover/index.js';
|
|
6
|
+
import type { UserType, BannerConfig, BannerAction } from './types.js';
|
|
7
|
+
export { AccessoriesProductGrid, SectionHeader, PromoBanner, MainProductArea, AddToCartSuccessPopover };
|
|
8
|
+
export type { UserType, BannerConfig, BannerAction };
|
|
9
|
+
export type { AddToCartSuccessPopoverProps, AddToCartSuccessCopyConfig, AddToCartSuccessSemanticName, } from './components/AddToCartSuccessPopover/index.js';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import o from"./components/MainProductArea/index.js";import r from"./components/PromoBanner/index.js";import e from"./components/SectionHeader/index.js";import t from"./components/AccessoriesProductGrid/index.js";import n from"./components/AddToCartSuccessPopover/index.js";export{t as AccessoriesProductGrid,n as AddToCartSuccessPopover,o as MainProductArea,r as PromoBanner,e as SectionHeader};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/biz-components/AccessoriesShelf/index.tsx"],
|
|
4
|
+
"sourcesContent": ["// 'use client'\n\nimport MainProductArea from './components/MainProductArea/index.js'\nimport PromoBanner from './components/PromoBanner/index.js'\nimport SectionHeader from './components/SectionHeader/index.js'\nimport AccessoriesProductGrid from './components/AccessoriesProductGrid/index.js'\nimport AddToCartSuccessPopover from './components/AddToCartSuccessPopover/index.js'\nimport type { UserType, BannerConfig, BannerAction } from './types.js'\n\nexport { AccessoriesProductGrid, SectionHeader, PromoBanner, MainProductArea, AddToCartSuccessPopover }\nexport type { UserType, BannerConfig, BannerAction }\nexport type {\n AddToCartSuccessPopoverProps,\n AddToCartSuccessCopyConfig,\n AddToCartSuccessSemanticName,\n} from './components/AddToCartSuccessPopover/index.js'\n"],
|
|
5
|
+
"mappings": "AAEA,OAAOA,MAAqB,wCAC5B,OAAOC,MAAiB,oCACxB,OAAOC,MAAmB,sCAC1B,OAAOC,MAA4B,+CACnC,OAAOC,MAA6B",
|
|
6
|
+
"names": ["MainProductArea", "PromoBanner", "SectionHeader", "AccessoriesProductGrid", "AddToCartSuccessPopover"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type UserType = 'guest' | 'member' | 'plus-member';
|
|
2
|
+
export type PriceStyleType = 1 | 2 | 3 | 4 | 5 | 6;
|
|
3
|
+
export type BannerAction = {
|
|
4
|
+
type: 'link';
|
|
5
|
+
url: string;
|
|
6
|
+
} | {
|
|
7
|
+
type: 'modal';
|
|
8
|
+
} | {
|
|
9
|
+
type: 'addToCart';
|
|
10
|
+
skuId: string;
|
|
11
|
+
};
|
|
12
|
+
export interface BannerConfig {
|
|
13
|
+
text: string;
|
|
14
|
+
backgroundColor?: string;
|
|
15
|
+
action?: BannerAction;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { GiftSlotConfig, GiftConfirmDialogCopy, GiftOptionRowCopy } from '../types.js';
|
|
3
|
+
export interface CartGiftSectionProps {
|
|
4
|
+
slots: GiftSlotConfig[];
|
|
5
|
+
selectedGiftSkus: string[];
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
onChange?: (newSkus: string[]) => void;
|
|
8
|
+
onGiftRemoveSku?: (sku: string) => void;
|
|
9
|
+
onNavigate?: (type: 'image' | 'title', source: 'main' | 'gift') => void;
|
|
10
|
+
copy?: GiftConfirmDialogCopy & GiftOptionRowCopy;
|
|
11
|
+
className?: string;
|
|
12
|
+
classNames?: Partial<Record<'root' | 'slotWrap' | 'slotTitle' | 'slotSubtitle' | 'reminder' | 'optionList', string>>;
|
|
13
|
+
}
|
|
14
|
+
declare const CartGiftSection: React.ForwardRefExoticComponent<CartGiftSectionProps & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
+
export default CartGiftSection;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";import{jsx as C,jsxs as F}from"react/jsx-runtime";import*as l from"react";import{cn as G}from"../../../helpers/index.js";import{DEFAULT_CART_COPY as A}from"../index.js";import W from"./components/GiftOptionRow/index.js";import _ from"../CartItemRow/components/CartItemRemoveConfirm/index.js";const h=l.forwardRef(({slots:d,selectedGiftSkus:g,disabled:k=!1,onChange:s,onGiftRemoveSku:y,onNavigate:N,copy:R,className:O,classNames:v={}},P)=>{const[u,p]=l.useState(null),[c,w]=l.useState(null),[n,m]=l.useState(g);l.useEffect(()=>{m(g)},[g]);const T=l.useCallback((e,i,a)=>{if(k)return;const r=a.mode??"radio",t=a.options.map(o=>o.sku);if(r==="radio"){if(!i){p(e);return}const o=n.find(f=>t.includes(f));if(o){w({oldSku:o,newSku:e});return}const S=[...n.filter(f=>!t.includes(f)),e];m(S),s?.(S);return}if(i){const o=a.maxSelectable,S=n.filter(E=>t.includes(E));if(o!=null&&S.length>=o)return;const f=[...n,e];m(f),s?.(f)}else p(e)},[k,n,s]),L=l.useCallback(()=>{if(!u)return;const e=n.filter(i=>i!==u);m(e),s?.(e),y?.(u),p(null)},[u,n,s,y]),b=l.useCallback(()=>{p(null)},[]),D=l.useCallback(()=>{if(!c)return;const{newSku:e}=c,i=d.find(t=>t.options.some(o=>o.sku===e));if(!i)return;const a=i.options.map(t=>t.sku),r=[...n.filter(t=>!a.includes(t)),e];m(r),s?.(r),w(null)},[c,n,d,s]),x=l.useCallback(()=>{w(null)},[]);return d.length===0?null:F("div",{ref:P,className:G("cart-gift-section-root flex flex-col gap-4",k&&"pointer-events-none opacity-50",O,v.root),children:[d.map((e,i)=>{const a=e.mode??"radio";return C("div",{className:G("cart-gift-section-slot flex flex-col gap-3 rounded-md",v.slotWrap),children:C("div",{className:G("cart-gift-section-option-list flex flex-col gap-2",v.optionList),role:"group","aria-label":`Gift slot ${i+1}`,children:e.options.map(r=>{const t=n.includes(r.sku);return C(W,{option:r,selected:t,mode:a,copy:R,onNavigate:N,onCheckedChange:o=>T(r.sku,o,e)},r.sku)})})},i)}),C(_,{open:u!==null||c!==null,copy:{removeConfirmText:R?.removeGiftConfirm??A.removeConfirmText},onConfirm:c?D:L,onCancel:c?x:b,onClose:c?x:b})]})});h.displayName="CartGiftSection";var $=h;export{$ as default};
|
|
2
|
+
//# sourceMappingURL=CartGiftSection.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/biz-components/CartDetail/CartGiftSection/CartGiftSection.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../../helpers/index.js'\nimport type { GiftSlotConfig, GiftOption, GiftConfirmDialogCopy, GiftOptionRowCopy } from '../types.js'\nimport { DEFAULT_CART_COPY } from '../index.js'\nimport GiftOptionRow from './components/GiftOptionRow/index.js'\n// import GiftConfirmDialog from './components/GiftConfirmDialog/index.js'\nimport CartItemRemoveConfirm from '../CartItemRow/components/CartItemRemoveConfirm/index.js'\n\nexport interface CartGiftSectionProps {\n slots: GiftSlotConfig[]\n selectedGiftSkus: string[]\n disabled?: boolean\n onChange?: (newSkus: string[]) => void\n onGiftRemoveSku?: (sku: string) => void\n onNavigate?: (type: 'image' | 'title', source: 'main' | 'gift') => void\n copy?: GiftConfirmDialogCopy & GiftOptionRowCopy\n className?: string\n classNames?: Partial<Record<'root' | 'slotWrap' | 'slotTitle' | 'slotSubtitle' | 'reminder' | 'optionList', string>>\n}\n\n// interface PendingAction {\n// newIds: string[]\n// message: string\n// }\n\nconst CartGiftSection = React.forwardRef<HTMLDivElement, CartGiftSectionProps>(\n (\n {\n slots,\n selectedGiftSkus,\n disabled = false,\n onChange,\n onGiftRemoveSku,\n onNavigate,\n copy,\n className,\n classNames = {},\n },\n ref\n ) => {\n // const [pendingAction, setPendingAction] = React.useState<PendingAction | null>(null)\n const [pendingRemoveSku, setPendingRemoveSku] = React.useState<string | null>(null)\n const [pendingSwitch, setPendingSwitch] = React.useState<{ oldSku: string; newSku: string } | null>(null)\n\n const [localSkus, setLocalSkus] = React.useState<string[]>(selectedGiftSkus)\n\n React.useEffect(() => {\n setLocalSkus(selectedGiftSkus)\n }, [selectedGiftSkus])\n\n const handleCheckedChange = React.useCallback(\n (optionSku: string, checked: boolean, slot: GiftSlotConfig) => {\n if (disabled) return\n\n const mode = slot.mode ?? 'radio'\n const slotSkus = slot.options.map(o => o.sku)\n\n if (mode === 'radio') {\n if (!checked) {\n setPendingRemoveSku(optionSku)\n return\n }\n const currentSlotSelected = localSkus.find(s => slotSkus.includes(s))\n if (currentSlotSelected) {\n setPendingSwitch({ oldSku: currentSlotSelected, newSku: optionSku })\n return\n }\n const newSkus = [...localSkus.filter(s => !slotSkus.includes(s)), optionSku]\n setLocalSkus(newSkus)\n onChange?.(newSkus)\n return\n }\n\n if (checked) {\n const maxSelectable = slot.maxSelectable\n const currentSlotSelected = localSkus.filter(s => slotSkus.includes(s))\n if (maxSelectable != null && currentSlotSelected.length >= maxSelectable) {\n return\n }\n const newSkus = [...localSkus, optionSku]\n setLocalSkus(newSkus)\n onChange?.(newSkus)\n } else {\n setPendingRemoveSku(optionSku)\n }\n },\n [disabled, localSkus, onChange]\n )\n\n const handleRemoveConfirm = React.useCallback(() => {\n if (!pendingRemoveSku) return\n const newSkus = localSkus.filter(s => s !== pendingRemoveSku)\n setLocalSkus(newSkus)\n onChange?.(newSkus)\n onGiftRemoveSku?.(pendingRemoveSku)\n setPendingRemoveSku(null)\n }, [pendingRemoveSku, localSkus, onChange, onGiftRemoveSku])\n\n const handleRemoveCancel = React.useCallback(() => {\n setPendingRemoveSku(null)\n }, [])\n\n const handleSwitchConfirm = React.useCallback(() => {\n if (!pendingSwitch) return\n const { newSku } = pendingSwitch\n const slot = slots.find(s => s.options.some(o => o.sku === newSku))\n if (!slot) return\n const slotSkus = slot.options.map(o => o.sku)\n const newSkus = [...localSkus.filter(s => !slotSkus.includes(s)), newSku]\n setLocalSkus(newSkus)\n onChange?.(newSkus)\n setPendingSwitch(null)\n }, [pendingSwitch, localSkus, slots, onChange])\n\n const handleSwitchCancel = React.useCallback(() => {\n setPendingSwitch(null)\n }, [])\n\n // const handleDialogConfirm = React.useCallback(() => {\n // if (!pendingAction) return\n // onChange?.(pendingAction.newIds)\n // setPendingAction(null)\n // }, [pendingAction, onChange])\n\n // const handleDialogCancel = React.useCallback(() => {\n // setPendingAction(null)\n // }, [])\n\n if (slots.length === 0) {\n return null\n }\n\n return (\n <div\n ref={ref}\n className={cn(\n 'cart-gift-section-root flex flex-col gap-4',\n disabled && 'pointer-events-none opacity-50',\n className,\n classNames.root\n )}\n >\n {slots.map((slot, slotIndex) => {\n const mode = slot.mode ?? 'radio'\n\n return (\n <div\n key={slotIndex}\n className={cn('cart-gift-section-slot flex flex-col gap-3 rounded-md', classNames.slotWrap)}\n >\n <div\n className={cn('cart-gift-section-option-list flex flex-col gap-2', classNames.optionList)}\n role=\"group\"\n aria-label={`Gift slot ${slotIndex + 1}`}\n >\n {slot.options.map((option: GiftOption) => {\n const optionSelected = localSkus.includes(option.sku)\n\n return (\n <GiftOptionRow\n key={option.sku}\n option={option}\n selected={optionSelected}\n mode={mode}\n copy={copy}\n onNavigate={onNavigate}\n onCheckedChange={checked => handleCheckedChange(option.sku, checked, slot)}\n />\n )\n })}\n </div>\n </div>\n )\n })}\n\n {/* <GiftConfirmDialog\n open={pendingAction !== null}\n message={pendingAction?.message ?? ''}\n copy={copy}\n onConfirm={handleDialogConfirm}\n onCancel={handleDialogCancel}\n /> */}\n\n <CartItemRemoveConfirm\n open={pendingRemoveSku !== null || pendingSwitch !== null}\n copy={{\n removeConfirmText: copy?.removeGiftConfirm ?? DEFAULT_CART_COPY.removeConfirmText,\n }}\n onConfirm={pendingSwitch ? handleSwitchConfirm : handleRemoveConfirm}\n onCancel={pendingSwitch ? handleSwitchCancel : handleRemoveCancel}\n onClose={pendingSwitch ? handleSwitchCancel : handleRemoveCancel}\n />\n </div>\n )\n }\n)\n\nCartGiftSection.displayName = 'CartGiftSection'\n\nexport default CartGiftSection\n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UAAWd,EACT,6CACAO,GAAY,iCACZK,EACAC,EAAW,IACb,EAEC,UAAAR,EAAM,IAAI,CAACmB,EAAMa,IAAc,CAC9B,MAAMZ,EAAOD,EAAK,MAAQ,QAE1B,OACE3B,EAAC,OAEC,UAAWG,EAAG,wDAAyDa,EAAW,QAAQ,EAE1F,SAAAhB,EAAC,OACC,UAAWG,EAAG,oDAAqDa,EAAW,UAAU,EACxF,KAAK,QACL,aAAY,aAAawB,EAAY,CAAC,GAErC,SAAAb,EAAK,QAAQ,IAAKc,GAAuB,CACxC,MAAMC,EAAiBpB,EAAU,SAASmB,EAAO,GAAG,EAEpD,OACEzC,EAACK,EAAA,CAEC,OAAQoC,EACR,SAAUC,EACV,KAAMd,EACN,KAAMd,EACN,WAAYD,EACZ,gBAAiBa,GAAWF,EAAoBiB,EAAO,IAAKf,EAASC,CAAI,GANpEc,EAAO,GAOd,CAEJ,CAAC,EACH,GAvBKD,CAwBP,CAEJ,CAAC,EAUDxC,EAACM,EAAA,CACC,KAAMY,IAAqB,MAAQE,IAAkB,KACrD,KAAM,CACJ,kBAAmBN,GAAM,mBAAqBV,EAAkB,iBAClE,EACA,UAAWgB,EAAgBgB,EAAsBF,EACjD,SAAUd,EAAgBmB,EAAqBJ,EAC/C,QAASf,EAAgBmB,EAAqBJ,EAChD,GACF,CAEJ,CACF,EAEA5B,EAAgB,YAAc,kBAE9B,IAAOoC,EAAQpC",
|
|
6
|
+
"names": ["jsx", "jsxs", "React", "cn", "DEFAULT_CART_COPY", "GiftOptionRow", "CartItemRemoveConfirm", "CartGiftSection", "slots", "selectedGiftSkus", "disabled", "onChange", "onGiftRemoveSku", "onNavigate", "copy", "className", "classNames", "ref", "pendingRemoveSku", "setPendingRemoveSku", "pendingSwitch", "setPendingSwitch", "localSkus", "setLocalSkus", "handleCheckedChange", "optionSku", "checked", "slot", "mode", "slotSkus", "currentSlotSelected", "s", "newSkus", "maxSelectable", "handleRemoveConfirm", "handleRemoveCancel", "handleSwitchConfirm", "newSku", "o", "handleSwitchCancel", "slotIndex", "option", "optionSelected", "CartGiftSection_default"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { GiftConfirmDialogCopy } from '../../../types.js';
|
|
3
|
+
export interface GiftConfirmDialogProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
message: string;
|
|
6
|
+
copy?: GiftConfirmDialogCopy;
|
|
7
|
+
onConfirm?: () => void;
|
|
8
|
+
onCancel?: () => void;
|
|
9
|
+
}
|
|
10
|
+
declare const GiftConfirmDialog: React.ForwardRefExoticComponent<GiftConfirmDialogProps & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
export default GiftConfirmDialog;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";import{jsx as t,jsxs as l}from"react/jsx-runtime";import*as y from"react";import{cn as n}from"../../../../../helpers/index.js";import{DEFAULT_CART_COPY as r}from"../../../index.js";const i=y.forwardRef(({open:s,message:m,copy:o,onConfirm:c,onCancel:a},d)=>{const f=o?.confirm??r.confirm,p=o?.cancel??r.cancel,b=o?.ariaLabel??r.ariaLabel;return s?t("div",{ref:d,className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/40",onClick:e=>{e.target===e.currentTarget&&a?.()},onKeyDown:e=>{e.key==="Escape"&&a?.()},role:"dialog","aria-modal":"true","aria-label":b,children:l("div",{className:"rounded-card bg-container-primary mx-auto w-full max-w-sm p-6 shadow-lg",children:[t("p",{className:"text-info-primary laptop:text-base text-sm leading-relaxed",children:m}),l("div",{className:"mt-5 flex items-center justify-end gap-3",children:[t("button",{type:"button",onClick:a,className:n("rounded-btn border-lines-primary text-info-secondary laptop:text-base border bg-transparent px-4 py-2 text-sm font-medium transition-colors","hover:bg-container-secondary"),children:p}),t("button",{type:"button",onClick:c,className:n("rounded-btn bg-btn-primary text-btn-primary-foreground laptop:text-base px-4 py-2 text-sm font-medium transition-colors","hover:opacity-80"),children:f})]})]})}):null});i.displayName="GiftConfirmDialog";var C=i;export{C as default};
|
|
2
|
+
//# sourceMappingURL=GiftConfirmDialog.js.map
|