@gem-sdk/components 2.0.0-dev.277 → 2.0.0-dev.288
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/accordion/components/Accordion.js +60 -179
- package/dist/cjs/accordion/components/Accordion.liquid.js +77 -101
- package/dist/cjs/accordion/components/AccordionItem.js +126 -280
- package/dist/cjs/accordion/components/AccordionItem.liquid.js +77 -215
- package/dist/cjs/accordion/components/common/classes.js +55 -0
- package/dist/cjs/accordion/components/common/index.js +146 -0
- package/dist/cjs/accordion/components/common/styles.js +131 -0
- package/dist/cjs/accordion/hooks/useAccordion.js +145 -0
- package/dist/cjs/accordion/hooks/useAccordionItem.js +119 -0
- package/dist/cjs/article/components/ArticleImage.js +0 -1
- package/dist/cjs/article/components/ArticlePagination.js +1 -1
- package/dist/cjs/article/components/ArticlePagination.liquid.js +3 -3
- package/dist/cjs/article/setting/configs/ArticleImage/settings.js +5 -5
- package/dist/cjs/banner/components/HeroBannerItem.js +0 -6
- package/dist/cjs/banner/components/HeroBannerItem.liquid.js +3 -0
- package/dist/cjs/banner/setting/setting.js +28 -3
- package/dist/cjs/banner/setting/uiV2.js +10 -97
- package/dist/cjs/builder.js +18 -20
- package/dist/cjs/cart/components/CartLineImage.js +0 -2
- package/dist/cjs/code/common/classes.js +11 -0
- package/dist/cjs/code/common/styles.js +15 -0
- package/dist/cjs/code/components/CSSCode.js +9 -99
- package/dist/cjs/code/components/CSSCode.liquid.js +11 -11
- package/dist/cjs/code/hooks/useCSSCode.js +102 -0
- package/dist/cjs/code/setting/CSSCode.js +7 -121
- package/dist/cjs/code/setting/config/setting.js +77 -0
- package/dist/cjs/code/setting/config/uiV1.js +52 -0
- package/dist/cjs/code/setting/config/uiV2.js +58 -0
- package/dist/cjs/estimate-delivery/components/EstimateDate.liquid.js +4 -1
- package/dist/cjs/form/components/contact/Contact.js +6 -2
- package/dist/cjs/form/components/contact/common/composeStyles.js +21 -0
- package/dist/cjs/form/components/form-checkbox/FormCheckbox.js +6 -4
- package/dist/cjs/form/components/form-checkbox/FormCheckbox.liquid.js +2 -4
- package/dist/cjs/form/components/form-checkbox/common/composeClasses.js +2 -2
- package/dist/cjs/form/components/form-checkbox/common/composeStyles.js +23 -10
- package/dist/cjs/form/components/form-dropdown/common/composeClasses.js +1 -1
- package/dist/cjs/form/components/form-email/FormEmail.js +18 -10
- package/dist/cjs/form/components/form-email/common/composeClasses.js +2 -1
- package/dist/cjs/form/components/newsletter/Newsletter.js +7 -2
- package/dist/cjs/form/components/newsletter/Newsletter.liquid.js +1 -1
- package/dist/cjs/form/components/newsletter/common/composeStyles.js +4 -2
- package/dist/cjs/form/components/textarea/TextArea.js +16 -8
- package/dist/cjs/form/components/textarea/common/composeClasses.js +1 -1
- package/dist/cjs/form/components/textfield/TextField.js +17 -9
- package/dist/cjs/form/components/textfield/common/composeClasses.js +2 -2
- package/dist/cjs/form/setting/contact/Contact.js +5 -1
- package/dist/cjs/form/setting/form-checkbox/configs/settings.js +153 -6
- package/dist/cjs/form/setting/form-checkbox/configs/uiV2.js +137 -0
- package/dist/cjs/form/setting/form-dropdown/configs/settings.js +147 -0
- package/dist/cjs/form/setting/form-dropdown/configs/uiV2.js +156 -4
- package/dist/cjs/form/setting/newsletter/configs/settings.js +132 -3
- package/dist/cjs/form/setting/newsletter/configs/uiV2.js +93 -0
- package/dist/cjs/form/setting/submit-button/configs/settings.js +37 -0
- package/dist/cjs/form/setting/submit-button/configs/uiV2.js +13 -0
- package/dist/cjs/grid/row/commons/getInnerRadius.js +11 -10
- package/dist/cjs/grid/row/setting/configs/uiV2.js +1 -1
- package/dist/cjs/header/components/kind/basic/index.js +1 -0
- package/dist/cjs/header/components/kind/modern/index.js +1 -1
- package/dist/cjs/helpers.js +53 -0
- package/dist/cjs/icon-list/setting/configs/uiV2.js +1 -1
- package/dist/cjs/icon-list-v2/setting/configs/settings.js +5 -5
- package/dist/cjs/image/components/AdaptiveImage.js +63 -49
- package/dist/cjs/image/components/AdaptiveImage.liquid.js +56 -44
- package/dist/cjs/image/components/Image.js +65 -154
- package/dist/cjs/image/components/Image.liquid.js +68 -103
- package/dist/cjs/image/components/Modal3d.liquid.js +54 -21
- package/dist/cjs/image/components/NextImage.js +26 -59
- package/dist/cjs/image/components/NextImage.liquid.js +27 -115
- package/dist/cjs/image/components/Video.liquid.js +38 -13
- package/dist/cjs/image/components/common/attributes.js +115 -0
- package/dist/cjs/image/components/common/classes.js +57 -0
- package/dist/cjs/image/components/common/constants.js +15 -0
- package/dist/cjs/image/components/common/data.js +24 -0
- package/dist/cjs/image/components/common/helpers.js +75 -0
- package/dist/cjs/image/components/common/styles.js +88 -0
- package/dist/cjs/image/components/helpers/getNextImageLiquidAttrs.js +80 -0
- package/dist/cjs/image/components/helpers/getNextImageReactAttrs.js +40 -0
- package/dist/cjs/image/components/hooks/useCheckNoImage.js +25 -0
- package/dist/cjs/image/helpers/getSrcSet.js +0 -2
- package/dist/cjs/image/next.js +1 -5
- package/dist/cjs/image/setting/configs/settings.js +14 -8
- package/dist/cjs/image/setting/configs/uiV2.js +61 -15
- package/dist/cjs/image/setting/index.js +1 -3
- package/dist/cjs/image-comparison/components/CompareImage.js +1 -1
- package/dist/cjs/image-comparison/components/CompareImage.liquid.js +1 -1
- package/dist/cjs/index.js +91 -91
- package/dist/cjs/index.liquid.js +8 -8
- package/dist/cjs/post-purchase/callout-banner/setting/config/callout-box/setting.js +4 -10
- package/dist/cjs/post-purchase/countdown-timer/components/PostPurchaseCountdownTimer.js +9 -23
- package/dist/cjs/post-purchase/countdown-timer/components/TextCountdown.js +12 -26
- package/dist/cjs/post-purchase/countdown-timer/components/common/getClasses.js +24 -0
- package/dist/cjs/post-purchase/countdown-timer/components/common/getStyles.js +21 -0
- package/dist/cjs/post-purchase/countdown-timer/hooks/useCountdownTimer.js +18 -1
- package/dist/cjs/post-purchase/countdown-timer/hooks/useGetTimeExpired.js +18 -0
- package/dist/cjs/post-purchase/countdown-timer/settings/CountdownTimer.js +9 -358
- package/dist/cjs/post-purchase/countdown-timer/settings/config/preset.js +26 -0
- package/dist/cjs/post-purchase/countdown-timer/settings/config/setting.js +243 -0
- package/dist/cjs/post-purchase/countdown-timer/settings/config/uiV1.js +125 -0
- package/dist/cjs/post-purchase/countdown-timer/settings/config/uiV2.js +185 -0
- package/dist/cjs/post-purchase/image/common/getClasses.js +1 -1
- package/dist/cjs/post-purchase/image/setting/setting-v2.js +5 -5
- package/dist/cjs/post-purchase/product/components/product-image/carousel-post-purchase/CarouselWrapperPostPurchase.js +24 -26
- package/dist/cjs/post-purchase/product/hooks/product-image/useListCarousel.js +1 -1
- package/dist/cjs/post-purchase/product/hooks/product-image/useProductImagePostPurchase.js +4 -1
- package/dist/cjs/post-purchase/product/settings/product-image/setting-v2.js +20 -7
- package/dist/cjs/post-purchase/product/settings/product-image/uiV2.js +3 -1
- package/dist/cjs/post-purchase/product/settings/product-price-breakdown/configs/settings.js +2 -2
- package/dist/cjs/post-purchase/product/settings/product-quantity/configs/settings.js +1 -1
- package/dist/cjs/post-purchase/utils/constants.js +1 -1
- package/dist/cjs/product/components/FileUpload/components/common/index.js +3 -0
- package/dist/cjs/product/components/ProductBundle/common/classes.js +25 -0
- package/dist/cjs/product/components/ProductBundle/common/index.js +5 -0
- package/dist/cjs/product/components/ProductBundle/common/styles.js +89 -0
- package/dist/cjs/product/components/ProductBundle/components/ProductBundleDiscount.js +82 -0
- package/dist/cjs/product/components/ProductBundle/components/ProductBundleDiscount.liquid.js +74 -0
- package/dist/cjs/product/components/ProductBundle/components/ProductBundleDiscountChildrenItem.js +69 -0
- package/dist/cjs/product/components/ProductBundle/components/ProductBundleDiscountChildrenItem.liquid.js +46 -0
- package/dist/cjs/product/components/ProductBundle/components/ProductBundleDiscountItem.js +23 -0
- package/dist/cjs/product/components/ProductBundle/components/ProductBundleDiscountItem.liquid.js +14 -0
- package/dist/cjs/product/components/{ProductBundleDiscount.js → ProductBundle/hooks/useProductBundleDataState.js} +20 -215
- package/dist/cjs/product/components/ProductBundle/hooks/useProductBundleDiscountState.js +56 -0
- package/dist/cjs/product/{setting → components/ProductBundle/setting}/ProductBundleDiscount.js +7 -7
- package/dist/cjs/product/{setting → components/ProductBundle/setting}/ProductBundleDiscountItem.js +3 -0
- package/dist/cjs/product/components/ProductButton.js +2 -2
- package/dist/cjs/product/components/ProductButton.liquid.js +2 -2
- package/dist/cjs/product/components/ProductPrice/common/getAttr.js +23 -0
- package/dist/cjs/product/components/ProductPrice/common/getClasses.js +19 -0
- package/dist/cjs/product/components/ProductPrice/common/getTextData.js +40 -0
- package/dist/cjs/product/components/ProductPrice/hooks/useGpPrice.js +126 -0
- package/dist/cjs/product/components/ProductPrice/index.js +54 -0
- package/dist/cjs/product/components/ProductPrice/index.liquid.js +43 -0
- package/dist/cjs/product/components/ProductQuickView/ProductQuickView.js +5 -5
- package/dist/cjs/product/next.js +3 -3
- package/dist/cjs/product/setting/index.js +2 -2
- package/dist/cjs/product/setting/product/configs/presets.js +1 -0
- package/dist/cjs/product/setting/product-image-v2/configs/setting-v2/ProductFeatureImage.js +6 -7
- package/dist/cjs/product/setting/product-image-v2/configs/setting-v2/ProductGalleryImage.js +11 -12
- package/dist/cjs/product/setting/product-image-v2/configs/setting-v2/index.js +6 -5
- package/dist/cjs/product/setting/product-list/configs/settingsV2.js +10 -8
- package/dist/cjs/setting.js +5 -2
- package/dist/esm/accordion/components/Accordion.js +61 -180
- package/dist/esm/accordion/components/Accordion.liquid.js +78 -102
- package/dist/esm/accordion/components/AccordionItem.js +129 -281
- package/dist/esm/accordion/components/AccordionItem.liquid.js +76 -214
- package/dist/esm/accordion/components/common/classes.js +44 -0
- package/dist/esm/accordion/components/common/index.js +136 -0
- package/dist/esm/accordion/components/common/styles.js +122 -0
- package/dist/esm/accordion/hooks/useAccordion.js +141 -0
- package/dist/esm/accordion/hooks/useAccordionItem.js +115 -0
- package/dist/esm/article/components/ArticleImage.js +0 -1
- package/dist/esm/article/components/ArticlePagination.js +1 -1
- package/dist/esm/article/components/ArticlePagination.liquid.js +3 -3
- package/dist/esm/article/setting/configs/ArticleImage/settings.js +5 -5
- package/dist/esm/banner/components/HeroBannerItem.js +0 -6
- package/dist/esm/banner/components/HeroBannerItem.liquid.js +3 -0
- package/dist/esm/banner/setting/setting.js +28 -3
- package/dist/esm/banner/setting/uiV2.js +10 -97
- package/dist/esm/builder.js +3 -5
- package/dist/esm/cart/components/CartLineImage.js +0 -2
- package/dist/esm/code/common/classes.js +9 -0
- package/dist/esm/code/common/styles.js +13 -0
- package/dist/esm/code/components/CSSCode.js +9 -99
- package/dist/esm/code/components/CSSCode.liquid.js +12 -12
- package/dist/esm/code/hooks/useCSSCode.js +98 -0
- package/dist/esm/code/setting/CSSCode.js +7 -121
- package/dist/esm/code/setting/config/setting.js +75 -0
- package/dist/esm/code/setting/config/uiV1.js +50 -0
- package/dist/esm/code/setting/config/uiV2.js +56 -0
- package/dist/esm/estimate-delivery/components/EstimateDate.liquid.js +4 -1
- package/dist/esm/form/components/contact/Contact.js +7 -3
- package/dist/esm/form/components/contact/common/composeStyles.js +19 -0
- package/dist/esm/form/components/form-checkbox/FormCheckbox.js +7 -5
- package/dist/esm/form/components/form-checkbox/FormCheckbox.liquid.js +3 -5
- package/dist/esm/form/components/form-checkbox/common/composeClasses.js +2 -2
- package/dist/esm/form/components/form-checkbox/common/composeStyles.js +25 -11
- package/dist/esm/form/components/form-dropdown/common/composeClasses.js +1 -1
- package/dist/esm/form/components/form-email/FormEmail.js +18 -10
- package/dist/esm/form/components/form-email/common/composeClasses.js +2 -1
- package/dist/esm/form/components/newsletter/Newsletter.js +8 -3
- package/dist/esm/form/components/newsletter/Newsletter.liquid.js +1 -1
- package/dist/esm/form/components/newsletter/common/composeStyles.js +4 -2
- package/dist/esm/form/components/textarea/TextArea.js +16 -8
- package/dist/esm/form/components/textarea/common/composeClasses.js +1 -1
- package/dist/esm/form/components/textfield/TextField.js +17 -9
- package/dist/esm/form/components/textfield/common/composeClasses.js +2 -2
- package/dist/esm/form/setting/contact/Contact.js +5 -1
- package/dist/esm/form/setting/form-checkbox/configs/settings.js +153 -6
- package/dist/esm/form/setting/form-checkbox/configs/uiV2.js +137 -0
- package/dist/esm/form/setting/form-dropdown/configs/settings.js +147 -0
- package/dist/esm/form/setting/form-dropdown/configs/uiV2.js +156 -4
- package/dist/esm/form/setting/newsletter/configs/settings.js +132 -3
- package/dist/esm/form/setting/newsletter/configs/uiV2.js +93 -0
- package/dist/esm/form/setting/submit-button/configs/settings.js +37 -0
- package/dist/esm/form/setting/submit-button/configs/uiV2.js +13 -0
- package/dist/esm/grid/row/commons/getInnerRadius.js +11 -10
- package/dist/esm/grid/row/setting/configs/uiV2.js +1 -1
- package/dist/esm/header/components/kind/basic/index.js +1 -0
- package/dist/esm/header/components/kind/modern/index.js +1 -1
- package/dist/esm/helpers.js +52 -1
- package/dist/esm/icon-list/setting/configs/uiV2.js +1 -1
- package/dist/esm/icon-list-v2/setting/configs/settings.js +5 -5
- package/dist/esm/image/components/AdaptiveImage.js +64 -50
- package/dist/esm/image/components/AdaptiveImage.liquid.js +57 -45
- package/dist/esm/image/components/Image.js +66 -155
- package/dist/esm/image/components/Image.liquid.js +69 -104
- package/dist/esm/image/components/Modal3d.liquid.js +55 -22
- package/dist/esm/image/components/NextImage.js +26 -59
- package/dist/esm/image/components/NextImage.liquid.js +28 -116
- package/dist/esm/image/components/Video.liquid.js +38 -13
- package/dist/esm/image/components/common/attributes.js +108 -0
- package/dist/esm/image/components/common/classes.js +51 -0
- package/dist/esm/image/components/common/constants.js +11 -0
- package/dist/esm/image/components/common/data.js +22 -0
- package/dist/esm/image/components/common/helpers.js +69 -0
- package/dist/esm/image/components/common/styles.js +80 -0
- package/dist/esm/image/components/helpers/getNextImageLiquidAttrs.js +78 -0
- package/dist/esm/image/components/helpers/getNextImageReactAttrs.js +38 -0
- package/dist/esm/image/components/hooks/useCheckNoImage.js +23 -0
- package/dist/esm/image/helpers/getSrcSet.js +1 -2
- package/dist/esm/image/next.js +1 -5
- package/dist/esm/image/setting/configs/settings.js +14 -8
- package/dist/esm/image/setting/configs/uiV2.js +61 -15
- package/dist/esm/image/setting/index.js +1 -3
- package/dist/esm/image-comparison/components/CompareImage.js +1 -1
- package/dist/esm/image-comparison/components/CompareImage.liquid.js +1 -1
- package/dist/esm/index.js +4 -5
- package/dist/esm/index.liquid.js +3 -3
- package/dist/esm/post-purchase/callout-banner/setting/config/callout-box/setting.js +4 -10
- package/dist/esm/post-purchase/countdown-timer/components/PostPurchaseCountdownTimer.js +9 -23
- package/dist/esm/post-purchase/countdown-timer/components/TextCountdown.js +13 -27
- package/dist/esm/post-purchase/countdown-timer/components/common/getClasses.js +21 -0
- package/dist/esm/post-purchase/countdown-timer/components/common/getStyles.js +19 -0
- package/dist/esm/post-purchase/countdown-timer/hooks/useCountdownTimer.js +19 -3
- package/dist/esm/post-purchase/countdown-timer/hooks/useGetTimeExpired.js +16 -0
- package/dist/esm/post-purchase/countdown-timer/settings/CountdownTimer.js +9 -358
- package/dist/esm/post-purchase/countdown-timer/settings/config/preset.js +24 -0
- package/dist/esm/post-purchase/countdown-timer/settings/config/setting.js +241 -0
- package/dist/esm/post-purchase/countdown-timer/settings/config/uiV1.js +123 -0
- package/dist/esm/post-purchase/countdown-timer/settings/config/uiV2.js +183 -0
- package/dist/esm/post-purchase/image/common/getClasses.js +1 -1
- package/dist/esm/post-purchase/image/setting/setting-v2.js +5 -5
- package/dist/esm/post-purchase/product/components/product-image/carousel-post-purchase/CarouselWrapperPostPurchase.js +25 -27
- package/dist/esm/post-purchase/product/hooks/product-image/useListCarousel.js +1 -1
- package/dist/esm/post-purchase/product/hooks/product-image/useProductImagePostPurchase.js +4 -1
- package/dist/esm/post-purchase/product/settings/product-image/setting-v2.js +20 -7
- package/dist/esm/post-purchase/product/settings/product-image/uiV2.js +3 -1
- package/dist/esm/post-purchase/product/settings/product-price-breakdown/configs/settings.js +2 -2
- package/dist/esm/post-purchase/product/settings/product-quantity/configs/settings.js +1 -1
- package/dist/esm/post-purchase/utils/constants.js +1 -1
- package/dist/esm/product/components/FileUpload/components/common/index.js +3 -0
- package/dist/esm/product/components/ProductBundle/common/classes.js +19 -0
- package/dist/esm/product/components/ProductBundle/common/index.js +3 -0
- package/dist/esm/product/components/ProductBundle/common/styles.js +80 -0
- package/dist/esm/product/components/ProductBundle/components/ProductBundleDiscount.js +78 -0
- package/dist/esm/product/components/ProductBundle/components/ProductBundleDiscount.liquid.js +70 -0
- package/dist/esm/product/components/ProductBundle/components/ProductBundleDiscountChildrenItem.js +65 -0
- package/dist/esm/product/components/ProductBundle/components/ProductBundleDiscountChildrenItem.liquid.js +42 -0
- package/dist/esm/product/components/ProductBundle/components/ProductBundleDiscountItem.js +19 -0
- package/dist/esm/product/components/ProductBundle/components/ProductBundleDiscountItem.liquid.js +10 -0
- package/dist/esm/product/components/{ProductBundleDiscount.js → ProductBundle/hooks/useProductBundleDataState.js} +21 -216
- package/dist/esm/product/components/ProductBundle/hooks/useProductBundleDiscountState.js +52 -0
- package/dist/esm/product/{setting → components/ProductBundle/setting}/ProductBundleDiscount.js +7 -7
- package/dist/esm/product/{setting → components/ProductBundle/setting}/ProductBundleDiscountItem.js +3 -0
- package/dist/esm/product/components/ProductButton.js +1 -1
- package/dist/esm/product/components/ProductButton.liquid.js +1 -1
- package/dist/esm/product/components/ProductPrice/common/getAttr.js +21 -0
- package/dist/esm/product/components/ProductPrice/common/getClasses.js +17 -0
- package/dist/esm/product/components/ProductPrice/common/getTextData.js +38 -0
- package/dist/esm/product/components/ProductPrice/hooks/useGpPrice.js +124 -0
- package/dist/esm/product/components/ProductPrice/index.js +50 -0
- package/dist/esm/product/components/ProductPrice/index.liquid.js +38 -0
- package/dist/esm/product/components/ProductQuickView/ProductQuickView.js +1 -1
- package/dist/esm/product/next.js +3 -3
- package/dist/esm/product/setting/index.js +2 -2
- package/dist/esm/product/setting/product/configs/presets.js +1 -0
- package/dist/esm/product/setting/product-image-v2/configs/setting-v2/ProductFeatureImage.js +6 -7
- package/dist/esm/product/setting/product-image-v2/configs/setting-v2/ProductGalleryImage.js +11 -12
- package/dist/esm/product/setting/product-image-v2/configs/setting-v2/index.js +6 -5
- package/dist/esm/product/setting/product-list/configs/settingsV2.js +10 -8
- package/dist/esm/setting.js +5 -2
- package/dist/types/index.d.ts +173 -256
- package/package.json +2 -2
- package/dist/cjs/image/components/BackgroundImage.js +0 -102
- package/dist/cjs/image/components/Img.js +0 -28
- package/dist/cjs/image/components/helpers.js +0 -12
- package/dist/cjs/image/setting/BackgroundImage.js +0 -364
- package/dist/cjs/product/components/ProductBundleDiscount.liquid.js +0 -81
- package/dist/cjs/product/components/ProductBundleDiscountItem.js +0 -42
- package/dist/cjs/product/components/ProductBundleDiscountItem.liquid.js +0 -103
- package/dist/cjs/product/components/ProductPrice.js +0 -209
- package/dist/cjs/product/components/ProductPrice.liquid.js +0 -88
- package/dist/esm/image/components/BackgroundImage.js +0 -98
- package/dist/esm/image/components/Img.js +0 -24
- package/dist/esm/image/components/helpers.js +0 -9
- package/dist/esm/image/setting/BackgroundImage.js +0 -360
- package/dist/esm/product/components/ProductBundleDiscount.liquid.js +0 -77
- package/dist/esm/product/components/ProductBundleDiscountItem.js +0 -36
- package/dist/esm/product/components/ProductBundleDiscountItem.liquid.js +0 -99
- package/dist/esm/product/components/ProductPrice.js +0 -205
- package/dist/esm/product/components/ProductPrice.liquid.js +0 -83
|
@@ -6,191 +6,72 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var core = require('@gem-sdk/core');
|
|
9
|
+
var system = require('@gem-sdk/system');
|
|
10
|
+
var styles = require('./common/styles.js');
|
|
11
|
+
var useAccordion = require('../hooks/useAccordion.js');
|
|
12
|
+
var classes = require('./common/classes.js');
|
|
9
13
|
|
|
10
|
-
const Accordion = ({ builderProps, builderAttrs, style, children, setting, styles })=>{
|
|
11
|
-
const { align } = styles ?? {};
|
|
12
|
-
const
|
|
13
|
-
const {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
currentAccordions.current = composeActiveKeys;
|
|
53
|
-
}
|
|
54
|
-
}, [
|
|
55
|
-
activeKey,
|
|
56
|
-
expandItem
|
|
57
|
-
]);
|
|
58
|
-
React.useEffect(()=>{
|
|
59
|
-
if (!expandItem) {
|
|
60
|
-
setAccordions([]);
|
|
61
|
-
currentAccordions.current = [];
|
|
62
|
-
}
|
|
63
|
-
if (activeKey?.toString()?.toLowerCase() === 'all' && expandItem) {
|
|
64
|
-
const list = Array.from(React.Children?.map(children, (_, index)=>index.toString()));
|
|
65
|
-
setAccordions(list);
|
|
66
|
-
currentAccordions.current = list;
|
|
67
|
-
}
|
|
68
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
69
|
-
}, [
|
|
70
|
-
activeKey,
|
|
71
|
-
expandItem
|
|
72
|
-
]);
|
|
73
|
-
const setActive = (id)=>{
|
|
74
|
-
if (accordions.includes(id)) {
|
|
75
|
-
setAccordions([]);
|
|
76
|
-
currentAccordions.current = [];
|
|
77
|
-
} else {
|
|
78
|
-
setAccordions([
|
|
79
|
-
id
|
|
80
|
-
]);
|
|
81
|
-
currentAccordions.current = [
|
|
82
|
-
id
|
|
83
|
-
];
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
const setToggle = (id)=>{
|
|
87
|
-
let newActive = [];
|
|
88
|
-
if (accordions.includes(id)) {
|
|
89
|
-
newActive = accordions.filter((accordion)=>accordion !== id);
|
|
90
|
-
} else {
|
|
91
|
-
newActive = [
|
|
92
|
-
...accordions,
|
|
93
|
-
id
|
|
94
|
-
];
|
|
95
|
-
}
|
|
96
|
-
setAccordions(newActive);
|
|
97
|
-
currentAccordions.current = newActive;
|
|
98
|
-
};
|
|
99
|
-
const handleDropdown = (id)=>{
|
|
100
|
-
expanded ? setToggle(id.toString()) : setActive(id.toString());
|
|
101
|
-
};
|
|
102
|
-
const filterStyles = React.useMemo(()=>{
|
|
103
|
-
const delList = [
|
|
104
|
-
'--mb',
|
|
105
|
-
'--mb-mobile',
|
|
106
|
-
'--mb-tablet',
|
|
107
|
-
'--d',
|
|
108
|
-
'--d-mobile',
|
|
109
|
-
'--d-tablet'
|
|
110
|
-
];
|
|
111
|
-
delList.forEach((element)=>{
|
|
112
|
-
delete style?.[element];
|
|
113
|
-
});
|
|
114
|
-
return style;
|
|
115
|
-
}, [
|
|
116
|
-
style
|
|
117
|
-
]);
|
|
118
|
-
React.useEffect(()=>{
|
|
119
|
-
const selector = `[data-id="${builderProps?.uid}"]`;
|
|
120
|
-
onListener({
|
|
121
|
-
event: 'gp:change-expanded-item-original',
|
|
122
|
-
selector
|
|
123
|
-
}, (params)=>{
|
|
124
|
-
const element = findElementIncludingSelf(ref.current || document, selector);
|
|
125
|
-
const { data, isRollback, key } = params || {};
|
|
126
|
-
if (data === undefined && isRollback) return;
|
|
127
|
-
if (isRollback) {
|
|
128
|
-
setAccordions(data);
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
let interactionAccordion = [
|
|
132
|
-
...currentAccordions.current
|
|
133
|
-
];
|
|
134
|
-
saveToElementInteractionData(element, key, JSON.stringify({
|
|
135
|
-
data: interactionAccordion
|
|
136
|
-
}));
|
|
137
|
-
const id = data.toString();
|
|
138
|
-
if (expanded) {
|
|
139
|
-
interactionAccordion = [
|
|
140
|
-
...interactionAccordion.filter((accordion)=>accordion !== id),
|
|
141
|
-
id
|
|
142
|
-
];
|
|
143
|
-
} else {
|
|
144
|
-
interactionAccordion = [
|
|
145
|
-
id
|
|
146
|
-
];
|
|
147
|
-
}
|
|
148
|
-
setAccordions(interactionAccordion);
|
|
14
|
+
const Accordion = ({ builderProps, builderAttrs, style, children, setting, styles: styles$1, advanced })=>{
|
|
15
|
+
const { align } = styles$1 ?? {};
|
|
16
|
+
const { childItem } = setting ?? {};
|
|
17
|
+
const { ref, mode, accordions, handleDropdown, activeKey } = useAccordion.default({
|
|
18
|
+
setting,
|
|
19
|
+
children,
|
|
20
|
+
builderProps
|
|
21
|
+
});
|
|
22
|
+
const createContainerStyles = system.createStyle({
|
|
23
|
+
...styles.getContainerStyles(style, styles$1)
|
|
24
|
+
});
|
|
25
|
+
const createContainerClasses = system.createClass(classes.getContainerClasses(advanced?.cssClass, mode));
|
|
26
|
+
const createContainerAttr = system.createAttr({
|
|
27
|
+
...builderAttrs,
|
|
28
|
+
'data-id': builderProps?.uid ?? ''
|
|
29
|
+
});
|
|
30
|
+
const createChildrenContainerStyles = system.createStyle({
|
|
31
|
+
...core.makeStyleResponsive('jc', align)
|
|
32
|
+
});
|
|
33
|
+
const createChildrenContainerClasses = system.createClass({
|
|
34
|
+
'gp-flex': true
|
|
35
|
+
});
|
|
36
|
+
const composeChildren = React.useMemo(()=>{
|
|
37
|
+
return React.Children.map(children, (child, index)=>{
|
|
38
|
+
if (!/*#__PURE__*/ React.isValidElement(child)) return child;
|
|
39
|
+
const childProps = {
|
|
40
|
+
...child.props,
|
|
41
|
+
index,
|
|
42
|
+
title: childItem?.[index],
|
|
43
|
+
accordions,
|
|
44
|
+
handleDropDown: handleDropdown,
|
|
45
|
+
parentSetting: setting,
|
|
46
|
+
parentStyle: styles$1,
|
|
47
|
+
activeKey,
|
|
48
|
+
childrenIcon: setting?.childConfig?.[index],
|
|
49
|
+
parentUid: builderProps?.uid
|
|
50
|
+
};
|
|
51
|
+
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
52
|
+
className: createChildrenContainerClasses,
|
|
53
|
+
style: createChildrenContainerStyles,
|
|
54
|
+
children: /*#__PURE__*/ React.cloneElement(child, childProps)
|
|
55
|
+
});
|
|
149
56
|
});
|
|
150
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
151
|
-
}, []);
|
|
152
|
-
React.useEffect(()=>{
|
|
153
|
-
currentAccordions.current = accordions;
|
|
154
57
|
}, [
|
|
155
|
-
accordions
|
|
58
|
+
accordions,
|
|
59
|
+
activeKey,
|
|
60
|
+
builderProps?.uid,
|
|
61
|
+
childItem,
|
|
62
|
+
children,
|
|
63
|
+
createChildrenContainerClasses,
|
|
64
|
+
createChildrenContainerStyles,
|
|
65
|
+
handleDropdown,
|
|
66
|
+
setting,
|
|
67
|
+
styles$1
|
|
156
68
|
]);
|
|
157
69
|
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
158
|
-
...
|
|
70
|
+
...createContainerAttr,
|
|
159
71
|
ref: ref,
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}),
|
|
164
|
-
style: {
|
|
165
|
-
...filterStyles,
|
|
166
|
-
...contentSizePaddingSize.gap,
|
|
167
|
-
...core.getStyleBackgroundByDevice(style?.backgroundContent),
|
|
168
|
-
borderRadius: 'inherit',
|
|
169
|
-
overflow: 'hidden'
|
|
170
|
-
},
|
|
171
|
-
children: React.Children.map(children, (child, index)=>{
|
|
172
|
-
if (/*#__PURE__*/ React.isValidElement(child)) {
|
|
173
|
-
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
174
|
-
className: "gp-flex",
|
|
175
|
-
style: {
|
|
176
|
-
...core.makeStyleResponsive('jc', align)
|
|
177
|
-
},
|
|
178
|
-
children: /*#__PURE__*/ jsxRuntime.jsx(child.type, {
|
|
179
|
-
...child.props,
|
|
180
|
-
index: index,
|
|
181
|
-
title: childItem?.[index],
|
|
182
|
-
accordions: accordions,
|
|
183
|
-
handleDropDown: handleDropdown,
|
|
184
|
-
parentSetting: setting,
|
|
185
|
-
parentStyle: styles,
|
|
186
|
-
activeKey: activeKey,
|
|
187
|
-
childrenIcon: setting?.childConfig?.[index],
|
|
188
|
-
parentUid: builderProps?.uid
|
|
189
|
-
})
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
return child;
|
|
193
|
-
})
|
|
72
|
+
className: createContainerClasses,
|
|
73
|
+
style: createContainerStyles,
|
|
74
|
+
children: composeChildren
|
|
194
75
|
});
|
|
195
76
|
};
|
|
196
77
|
|
|
@@ -4,110 +4,86 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var core = require('@gem-sdk/core');
|
|
6
6
|
var helpers = require('../../helpers.js');
|
|
7
|
+
var system = require('@gem-sdk/system');
|
|
8
|
+
var index = require('./common/index.js');
|
|
9
|
+
var styles = require('./common/styles.js');
|
|
10
|
+
var classes = require('./common/classes.js');
|
|
7
11
|
|
|
8
|
-
const Accordion = ({ rawChildren, setting, styles, builderProps, pageContext, advanced })=>{
|
|
9
|
-
const {
|
|
10
|
-
const {
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
itemHeaderSpacing,
|
|
65
|
-
textColor,
|
|
66
|
-
iconColor,
|
|
67
|
-
contentSizePadding,
|
|
68
|
-
headerContentPadding,
|
|
69
|
-
widthHeightSize
|
|
70
|
-
},
|
|
71
|
-
uid: builderProps?.uid
|
|
72
|
-
}).replaceAll("'", ''')}'
|
|
73
|
-
>
|
|
74
|
-
<div class="gp-hidden gp-rotate-90 -gp-rotate-90 gp-rotate-180"></div>
|
|
75
|
-
${core.WrapRenderChildren({
|
|
76
|
-
uid: builderProps?.uid || '',
|
|
77
|
-
customProps: rawChildren?.[0].customProps
|
|
78
|
-
}, rawChildren?.map((child, index)=>{
|
|
79
|
-
if (child) {
|
|
80
|
-
const title = helpers.getDynamicSourceLocales({
|
|
81
|
-
val: childItem?.[index],
|
|
82
|
-
uid: builderProps?.uid,
|
|
83
|
-
settingId: `childItem_${index}`,
|
|
84
|
-
pageContext,
|
|
85
|
-
isCapitalize: setting?.titleTypo?.attrs?.transform === 'capitalize',
|
|
86
|
-
translate
|
|
87
|
-
});
|
|
88
|
-
return core.template`<div
|
|
89
|
-
class="gp-flex"
|
|
90
|
-
style="${{
|
|
91
|
-
...core.makeStyleResponsive('jc', align)
|
|
92
|
-
}}"
|
|
93
|
-
>
|
|
94
|
-
${core.RenderChildren({
|
|
95
|
-
...child,
|
|
96
|
-
index: index,
|
|
97
|
-
title: title,
|
|
98
|
-
accordions: accordions,
|
|
99
|
-
parentSetting: setting,
|
|
100
|
-
parentStyle: styles,
|
|
101
|
-
parentUid: builderProps?.uid,
|
|
102
|
-
childrenIcon: setting?.childConfig?.[index],
|
|
103
|
-
activeKey: activeKey
|
|
104
|
-
})}
|
|
105
|
-
</div>
|
|
12
|
+
const Accordion = ({ rawChildren, setting, styles: styles$1, builderProps, pageContext, advanced, style, builderAttrs })=>{
|
|
13
|
+
const { align } = styles$1 ?? {};
|
|
14
|
+
const { translate, childItem, activeKey } = setting ?? {};
|
|
15
|
+
const { uidState, settingState, stylesState, accordions } = index.getDataState({
|
|
16
|
+
setting,
|
|
17
|
+
styles: styles$1,
|
|
18
|
+
builderProps
|
|
19
|
+
}, rawChildren);
|
|
20
|
+
const createDataState = system.createStateOrContext({
|
|
21
|
+
uid: uidState,
|
|
22
|
+
setting: settingState,
|
|
23
|
+
styles: stylesState
|
|
24
|
+
});
|
|
25
|
+
const createContainerClasses = system.createClass(classes.getContainerClasses(advanced?.cssClass));
|
|
26
|
+
const createContainerStyles = system.createStyle({
|
|
27
|
+
...styles.getContainerStyles(style, styles$1)
|
|
28
|
+
});
|
|
29
|
+
const createContainerAttr = system.createAttr({
|
|
30
|
+
...builderAttrs,
|
|
31
|
+
'data-id': builderProps?.uid ?? ''
|
|
32
|
+
});
|
|
33
|
+
const createChildrenContainerStyles = system.createStyle({
|
|
34
|
+
...core.makeStyleResponsive('jc', align)
|
|
35
|
+
});
|
|
36
|
+
const createChildrenContainerClasses = system.createClass({
|
|
37
|
+
'gp-flex': true
|
|
38
|
+
});
|
|
39
|
+
const createExtendClasses = system.createClass(classes.extendClasses());
|
|
40
|
+
const composeChildren = ()=>{
|
|
41
|
+
return core.WrapRenderChildren({
|
|
42
|
+
uid: builderProps?.uid ?? '',
|
|
43
|
+
customProps: rawChildren?.[0].customProps
|
|
44
|
+
}, rawChildren?.map((child, index)=>{
|
|
45
|
+
if (child) {
|
|
46
|
+
const title = helpers.getDynamicSourceLocales({
|
|
47
|
+
val: childItem?.[index],
|
|
48
|
+
uid: builderProps?.uid,
|
|
49
|
+
settingId: `childItem_${index}`,
|
|
50
|
+
pageContext,
|
|
51
|
+
isCapitalize: setting?.titleTypo?.attrs?.transform === 'capitalize',
|
|
52
|
+
translate
|
|
53
|
+
});
|
|
54
|
+
return core.template`
|
|
55
|
+
<div class="${createChildrenContainerClasses}" style="${createChildrenContainerStyles}">
|
|
56
|
+
${core.RenderChildren({
|
|
57
|
+
...child,
|
|
58
|
+
index: index,
|
|
59
|
+
title: title,
|
|
60
|
+
accordions: accordions,
|
|
61
|
+
parentSetting: setting,
|
|
62
|
+
parentStyle: styles$1,
|
|
63
|
+
parentUid: builderProps?.uid,
|
|
64
|
+
childrenIcon: setting?.childConfig?.[index],
|
|
65
|
+
activeKey: activeKey
|
|
66
|
+
})}
|
|
67
|
+
</div>
|
|
106
68
|
`;
|
|
107
|
-
|
|
108
|
-
|
|
69
|
+
}
|
|
70
|
+
}));
|
|
71
|
+
};
|
|
72
|
+
const renderScript = ()=>{
|
|
73
|
+
return core.RenderIf(core.isLocalEnv, `
|
|
74
|
+
<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-accordion.js' | asset_url }}"
|
|
75
|
+
defer="defer"></script>`, `
|
|
76
|
+
<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="${core.baseAssetURL}/assets-v2/gp-accordion.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>
|
|
77
|
+
`);
|
|
78
|
+
};
|
|
79
|
+
return core.template`
|
|
80
|
+
<gp-accordion ${createContainerAttr} class="${createContainerClasses}" style="${createContainerStyles}"
|
|
81
|
+
gp-data='${JSON.stringify(createDataState).replaceAll("'", ''')}'
|
|
82
|
+
>
|
|
83
|
+
<div class=" ${createExtendClasses}"></div>
|
|
84
|
+
${composeChildren()}
|
|
109
85
|
</gp-accordion>
|
|
110
|
-
${
|
|
86
|
+
${renderScript()}
|
|
111
87
|
`;
|
|
112
88
|
};
|
|
113
89
|
|