@gem-sdk/components 2.0.0-dev.278 → 2.0.0-dev.289
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/components/CalloutText.js +2 -1
- package/dist/cjs/post-purchase/callout-banner/components/common/getClasses.js +5 -2
- package/dist/cjs/post-purchase/callout-banner/components/common/getStyles.js +2 -4
- package/dist/cjs/post-purchase/callout-banner/setting/config/callout-box/setting.js +4 -10
- package/dist/cjs/post-purchase/callout-banner/setting/config/callout-text/setting.js +1 -11
- 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/settings/product-image/setting-v2.js +5 -5
- 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/product/components/FileUpload/components/common/index.js +3 -0
- package/dist/cjs/product/components/Product.liquid.js +1 -1
- 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/components/CalloutText.js +2 -1
- package/dist/esm/post-purchase/callout-banner/components/common/getClasses.js +5 -2
- package/dist/esm/post-purchase/callout-banner/components/common/getStyles.js +2 -4
- package/dist/esm/post-purchase/callout-banner/setting/config/callout-box/setting.js +4 -10
- package/dist/esm/post-purchase/callout-banner/setting/config/callout-text/setting.js +1 -11
- 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/settings/product-image/setting-v2.js +5 -5
- 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/product/components/FileUpload/components/common/index.js +3 -0
- package/dist/esm/product/components/Product.liquid.js +1 -1
- 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 +174 -257
- 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
|
@@ -1,64 +1,48 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { MINIMUM_CHILD, BODY_CHILD_INDEX } from './AccordionItem.js';
|
|
1
|
+
import { composeClasses, template, RenderChildren } from '@gem-sdk/core';
|
|
3
2
|
import Text from '../../text/components/Text.liquid.js';
|
|
3
|
+
import { getParentSettings, getSettingItemLiquid, DEFAULT_BEFORE_ICON, DEFAULT_AFTER_ICON, MINIMUM_CHILD, BODY_CHILD_INDEX } from './common/index.js';
|
|
4
|
+
import { createClass, createStyle, If } from '@gem-sdk/system';
|
|
5
|
+
import { getItemContainerClasses, getDropdownClasses, getIconClasses, getIconRotateClasses, getContentClasses, getGapClasses, getLayoutTextClasses, getRenderChildrenClasses } from './common/classes.js';
|
|
6
|
+
import { getIconGlobalSize, getItemContainerStyles, getDropdownStyles, getIconRotateStyles, getGapStyles, getLayoutTextStyles, getRenderChildrenStyles } from './common/styles.js';
|
|
4
7
|
|
|
5
|
-
const AccordionItem = (
|
|
6
|
-
const {
|
|
7
|
-
|
|
8
|
-
const {
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if (iconSvg === 'plus') {
|
|
44
|
-
if (isShow) {
|
|
45
|
-
return iconNimbus;
|
|
46
|
-
}
|
|
47
|
-
return iconPlus;
|
|
48
|
-
}
|
|
49
|
-
if (iconSvg) {
|
|
50
|
-
return iconSvg;
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
const collapsibleIcon = makeIcon();
|
|
54
|
-
const composeIconColor = ()=>{
|
|
55
|
-
if (isShow) {
|
|
56
|
-
return makeStyle({
|
|
57
|
-
c: iconColor?.active
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
return getGlobalColorStateStyle('c', iconColor);
|
|
61
|
-
};
|
|
8
|
+
const AccordionItem = (props)=>{
|
|
9
|
+
const { parentUid, childrenIcon, rawChildren, index, builderProps, title } = props;
|
|
10
|
+
const { iconSvg, titleTypo, layoutHeader, iconGlobalSize, iconCollapseSize, iconCollapse, iconExpand, alignment, configIconSize, iconPosition } = getParentSettings(props.parentSetting) ?? {};
|
|
11
|
+
const { isShow, composeContentSizeStyle, collapsibleIcon, composeIconColor, makeIcon } = getSettingItemLiquid(props);
|
|
12
|
+
const composeContainerClasses = createClass(getItemContainerClasses);
|
|
13
|
+
const composeDropdownClasses = createClass(getDropdownClasses(props.parentStyle, {
|
|
14
|
+
isShow,
|
|
15
|
+
uniqueId: parentUid,
|
|
16
|
+
makeIcon: makeIcon(),
|
|
17
|
+
index
|
|
18
|
+
}));
|
|
19
|
+
const composeIconPaddingGlobalSize = createStyle(getIconGlobalSize(iconGlobalSize));
|
|
20
|
+
const composeIconClasses = createClass(getIconClasses);
|
|
21
|
+
const composeIconRotateClasses = createClass(getIconRotateClasses(props.parentStyle, {
|
|
22
|
+
isShow,
|
|
23
|
+
iconExpand,
|
|
24
|
+
iconSvg,
|
|
25
|
+
iconCollapse
|
|
26
|
+
}));
|
|
27
|
+
const composeContentClasses = createClass(getContentClasses(parentUid));
|
|
28
|
+
const composeGapClasses = createClass(getGapClasses);
|
|
29
|
+
const composeContainerStyles = createStyle(getItemContainerStyles(props.parentStyle));
|
|
30
|
+
const composeDropdownStyles = createStyle(getDropdownStyles(props.parentStyle, {
|
|
31
|
+
isShow,
|
|
32
|
+
iconPosition
|
|
33
|
+
}));
|
|
34
|
+
const composeIconRotateStyles = createStyle(getIconRotateStyles(props.parentStyle, isShow, iconCollapseSize));
|
|
35
|
+
const composeGapStyles = createStyle(getGapStyles(iconGlobalSize, alignment));
|
|
36
|
+
const inlineFlexClass = createClass(composeClasses('gp-inline-flex'));
|
|
37
|
+
const composeLayoutTextClasses = createClass(getLayoutTextClasses);
|
|
38
|
+
const composeLayoutTextStyles = createStyle(getLayoutTextStyles(composeIconColor, configIconSize));
|
|
39
|
+
const composeRenderChildrenClasses = createClass(getRenderChildrenClasses(props.parentStyle, {
|
|
40
|
+
isShow,
|
|
41
|
+
hasTransitionedIn: false,
|
|
42
|
+
isMounted: false
|
|
43
|
+
}));
|
|
44
|
+
const composeRenderChildrenStyles = createStyle(getRenderChildrenStyles(composeContentSizeStyle));
|
|
45
|
+
const composeItemBodyClasses = createClass(composeClasses('gp-accordion-item_body-inner gp-transition-all gp-duration-500 gp-min-h-0'));
|
|
62
46
|
const getChildForBody = ()=>{
|
|
63
47
|
if (rawChildren && rawChildren.length >= MINIMUM_CHILD) {
|
|
64
48
|
return RenderChildren({
|
|
@@ -67,132 +51,32 @@ const AccordionItem = ({ accordions, index, rawChildren, builderProps, title, pa
|
|
|
67
51
|
}
|
|
68
52
|
return '';
|
|
69
53
|
};
|
|
70
|
-
const composeColorIconStyle = ()=>{
|
|
71
|
-
return `.${parentUid}.gp-accordion-item-${parentUid}-${index}:hover .gp-collapsible-icon, .${parentUid}.gp-accordion-item-${parentUid}-${index}:hover .gp-icon {
|
|
72
|
-
color: ${isShow ? color?.active : color?.hover}
|
|
73
|
-
} {
|
|
74
|
-
}`;
|
|
75
|
-
};
|
|
76
|
-
const getTemplateRow = ()=>{
|
|
77
|
-
return {
|
|
78
|
-
'grid-template-rows': `${+Boolean(isShow)}fr`
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
54
|
return template`
|
|
82
|
-
<
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
bc: getSingleColorVariable(borderContent?.color ?? borderContent?.color)
|
|
100
|
-
}),
|
|
101
|
-
...makeStyleResponsive('bg', backgroundContent),
|
|
102
|
-
...getStyleShadow({
|
|
103
|
-
value: accordionShadow,
|
|
104
|
-
styleAppliedFor: 'box-shadow',
|
|
105
|
-
isEnableShadow: accordionShadow?.type !== 'none'
|
|
106
|
-
}),
|
|
107
|
-
...getRadiusStyleActiveState({
|
|
108
|
-
...roundedContent,
|
|
109
|
-
active: {
|
|
110
|
-
...roundedContent || {},
|
|
111
|
-
radiusType: 'custom'
|
|
112
|
-
}
|
|
113
|
-
})
|
|
114
|
-
}}">
|
|
115
|
-
<div
|
|
116
|
-
data-index="${index?.toString()}"
|
|
117
|
-
class="${cls(parentUid, `gp-accordion-item gp-overflow-hidden gp-child-item-${parentUid}`)}"
|
|
118
|
-
style="${{
|
|
119
|
-
scrollBehavior: 'smooth'
|
|
120
|
-
}}"
|
|
121
|
-
>
|
|
122
|
-
<div
|
|
123
|
-
aria-hidden
|
|
124
|
-
uid="${builderProps?.uid}"
|
|
125
|
-
id="${builderProps?.uid}"
|
|
126
|
-
data-index="${index?.toString()}"
|
|
127
|
-
class="${cls(parentUid, `gp-accordion-item-${parentUid}-${index}`, 'gp-flex gp-items-center gp-accordion-item_header gp-cursor-pointer', handleConvertClassColor(headerBorder), itemHeaderSpacing?.type && !headerContentPadding ? genSizeClass(itemHeaderSpacing?.type) : '', {
|
|
128
|
-
[getGlobalColorClass('bg', bgColor?.active)]: isShow,
|
|
129
|
-
[getGlobalColorClass('text', textColor?.active)]: isShow,
|
|
130
|
-
[getGlobalColorStateClass('bg', bgColor)]: !isShow,
|
|
131
|
-
[getGlobalColorStateClass('text', textColor)]: !isShow
|
|
132
|
-
})}"
|
|
133
|
-
style="${{
|
|
134
|
-
...headerContentPadding && headerContentPaddingSize.padding,
|
|
135
|
-
...!itemHeaderSpacing?.type && !headerContentPadding ? composeSize(itemHeaderSpacing?.custom) : {},
|
|
136
|
-
...widthHeightSizeControl.height,
|
|
137
|
-
...composePosition(),
|
|
138
|
-
gap: collapsibleIcon ? '16px' : '',
|
|
139
|
-
...isShow ? makeStyle({
|
|
140
|
-
bgc: getSingleColorVariable(bgColor?.active ?? bgColor?.normal),
|
|
141
|
-
bs: headerBorder?.active?.border ?? headerBorder?.normal?.border,
|
|
142
|
-
bw: headerBorder?.active?.width ?? headerBorder?.normal?.width,
|
|
143
|
-
bc: getSingleColorVariable(headerBorder?.active?.color ?? headerBorder?.normal?.color),
|
|
144
|
-
c: getSingleColorVariable(textColor?.active ?? textColor?.normal)
|
|
145
|
-
}) : {
|
|
146
|
-
...getGlobalColorStateStyle('bgc', bgColor),
|
|
147
|
-
...getGlobalColorStateStyle('c', textColor),
|
|
148
|
-
...handleConvertBorderStyle(headerBorder),
|
|
149
|
-
...handleConvertBorderWidth(headerBorder),
|
|
150
|
-
...handleConvertBorderColor(headerBorder),
|
|
151
|
-
...getGlobalColorStateStyle('bgc', bgColor)
|
|
152
|
-
}
|
|
153
|
-
}}"
|
|
154
|
-
>
|
|
155
|
-
<style class="accordion-style">${composeColorIconStyle()}</style>
|
|
156
|
-
<div class="gp-inline-flex">
|
|
157
|
-
${collapsibleIcon ? template`<span
|
|
158
|
-
style="${{
|
|
159
|
-
...isShow ? makeStyle({
|
|
160
|
-
c: getSingleColorVariable(color?.active ?? color?.normal)
|
|
161
|
-
}) : {
|
|
162
|
-
...getGlobalColorStateStyle('c', color)
|
|
163
|
-
},
|
|
164
|
-
width: `${iconCollapseSize || 16}px`,
|
|
165
|
-
height: `${iconCollapseSize || 16}px`
|
|
166
|
-
}}"
|
|
167
|
-
data-index="${index}"
|
|
168
|
-
class="${cls(parentUid, 'gp-accordion-item_icon gp-collapsible-icon', {
|
|
169
|
-
'-gp-rotate-90': isShow === true && iconSvg !== 'plus' && !iconExpand,
|
|
170
|
-
'gp-rotate-90': isShow === false && !iconCollapse
|
|
171
|
-
}, 'gp-inline-flex gp-items-center gp-justify-center gp-overflow-hidden gp-transition-all gp-duration-200 [&>svg]:!gp-h-[var(--height-iconCollapseSize)] [&>svg]:!gp-w-auto', isShow ? getGlobalColorClass('text', color?.active) : getGlobalColorStateClass('text', color))}"
|
|
172
|
-
>${collapsibleIcon}</span>` : ``}
|
|
173
|
-
|
|
174
|
-
</div>
|
|
175
|
-
<div class="gp-flex gp-items-center gp-w-full" style="${{
|
|
176
|
-
...composeIconGlobalSize.gap,
|
|
177
|
-
...makeStyleResponsive('jc', alignment)
|
|
178
|
-
}}">
|
|
179
|
-
${RenderIf(beforeText, template`
|
|
180
|
-
<div class="gp-inline-flex" style="${{
|
|
181
|
-
...composeIconGlobalSize.padding
|
|
55
|
+
<div class="${composeContainerClasses}" style="${composeContainerStyles}">
|
|
56
|
+
<div data-index="${index?.toString()}" class="${composeContentClasses}">
|
|
57
|
+
<div aria-hidden uid="${builderProps?.uid}" id="${builderProps?.uid}" data-index="${index?.toString()}"
|
|
58
|
+
class="${composeDropdownClasses}" style="${composeDropdownStyles}">
|
|
59
|
+
${If(Boolean(collapsibleIcon), template`
|
|
60
|
+
<div class="${composeIconClasses}">
|
|
61
|
+
<span style="${composeIconRotateStyles}"
|
|
62
|
+
data-index="${index}"
|
|
63
|
+
class="${composeIconRotateClasses}">
|
|
64
|
+
${collapsibleIcon}
|
|
65
|
+
</span>
|
|
66
|
+
</div>
|
|
67
|
+
`)}
|
|
68
|
+
<div class="${composeGapClasses}" style="${composeGapStyles}">
|
|
69
|
+
${If(Boolean(layoutHeader === 'before-text'), template`
|
|
70
|
+
<div class="${inlineFlexClass}" style="${{
|
|
71
|
+
...composeIconPaddingGlobalSize
|
|
182
72
|
}}">
|
|
183
73
|
<span
|
|
184
|
-
class="
|
|
185
|
-
style="${
|
|
186
|
-
|
|
187
|
-
...{
|
|
188
|
-
width: configIconSize ? `${configIconSize}px` : '16px',
|
|
189
|
-
height: configIconSize ? `${configIconSize}px` : '16px'
|
|
190
|
-
}
|
|
191
|
-
}}">
|
|
192
|
-
${childrenIconWidthDefault}</span>
|
|
74
|
+
class="${composeLayoutTextClasses}"
|
|
75
|
+
style="${composeLayoutTextStyles}">
|
|
76
|
+
${childrenIcon ?? DEFAULT_BEFORE_ICON}</span>
|
|
193
77
|
</div>
|
|
194
|
-
|
|
195
|
-
|
|
78
|
+
`)}
|
|
79
|
+
${Text({
|
|
196
80
|
styles: {
|
|
197
81
|
typo: titleTypo
|
|
198
82
|
},
|
|
@@ -204,43 +88,21 @@ const AccordionItem = ({ accordions, index, rawChildren, builderProps, title, pa
|
|
|
204
88
|
},
|
|
205
89
|
className: 'gp-overflow-hidden'
|
|
206
90
|
})}
|
|
207
|
-
|
|
208
|
-
<div class="
|
|
209
|
-
...
|
|
91
|
+
${If(Boolean(layoutHeader === 'after-text'), template`
|
|
92
|
+
<div class="${inlineFlexClass}" style="${{
|
|
93
|
+
...composeIconPaddingGlobalSize
|
|
210
94
|
}}">
|
|
211
95
|
<span
|
|
212
|
-
class="
|
|
213
|
-
style="${
|
|
214
|
-
|
|
215
|
-
width: configIconSize ? `${configIconSize}px` : '16px',
|
|
216
|
-
height: configIconSize ? `${configIconSize}px` : '16px'
|
|
217
|
-
},
|
|
218
|
-
...composeIconColor()
|
|
219
|
-
}}">
|
|
220
|
-
${childrenIconWidthDefault}</span>
|
|
96
|
+
class="${composeLayoutTextClasses}"
|
|
97
|
+
style="${composeLayoutTextStyles}">
|
|
98
|
+
${childrenIcon ?? DEFAULT_AFTER_ICON}</span>
|
|
221
99
|
</div>
|
|
222
|
-
|
|
223
|
-
|
|
100
|
+
`)}
|
|
101
|
+
</div>
|
|
224
102
|
</div>
|
|
225
|
-
<div
|
|
226
|
-
${{
|
|
227
|
-
|
|
228
|
-
}}
|
|
229
|
-
data-index="${index}"
|
|
230
|
-
data-show="${isShow}"
|
|
231
|
-
class="${cls(parentUid, 'gp-accordion-item_body gp-transition-all gp-grid gp-duration-500 gp-overflow-hidden', itemContentSpacing?.type ? genSizeClass(itemContentSpacing?.type) : '')}"
|
|
232
|
-
style="${{
|
|
233
|
-
...getTemplateRow(),
|
|
234
|
-
'grid-template-columns': 'minmax(auto, 100%)'
|
|
235
|
-
}}"
|
|
236
|
-
>
|
|
237
|
-
<div
|
|
238
|
-
${{
|
|
239
|
-
...builderProps
|
|
240
|
-
}}
|
|
241
|
-
data-index="${index}"
|
|
242
|
-
class="${cls(parentUid, 'gp-accordion-item_body-inner gp-min-h-0 gp-transition-all gp-duration-500')}" style="${composeContentSizeStyle()}" >
|
|
243
|
-
${getChildForBody()}
|
|
103
|
+
<div data-index="${index}" data-show="${isShow}" class="${composeRenderChildrenClasses}" style="${composeRenderChildrenStyles}">
|
|
104
|
+
<div data-index="${index}" class="${composeItemBodyClasses}">
|
|
105
|
+
${getChildForBody()}
|
|
244
106
|
</div>
|
|
245
107
|
</div>
|
|
246
108
|
</div>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { composeClasses, cls, getGlobalColorClass, getGlobalColorStateClass, genSizeClass } from '@gem-sdk/core';
|
|
2
|
+
|
|
3
|
+
const getContainerClasses = (advanceClass, mode)=>{
|
|
4
|
+
const classes = cls('gp-flex gp-flex-col gp-w-full', {
|
|
5
|
+
'gp-px-[1px]': mode === 'edit'
|
|
6
|
+
}, advanceClass);
|
|
7
|
+
return composeClasses(classes);
|
|
8
|
+
};
|
|
9
|
+
const extendClasses = ()=>{
|
|
10
|
+
return composeClasses(cls('gp-hidden gp-rotate-90 -gp-rotate-90 gp-rotate-180'));
|
|
11
|
+
};
|
|
12
|
+
const getItemContainerClasses = composeClasses('gp-overflow-clip gp-group');
|
|
13
|
+
const getIconClasses = composeClasses('gp-inline-flex');
|
|
14
|
+
const getIconRotateClasses = (styles, extraData)=>{
|
|
15
|
+
const { isShow, iconExpand, iconSvg, iconCollapse } = extraData || {};
|
|
16
|
+
const { color } = styles ?? {};
|
|
17
|
+
return composeClasses(cls({
|
|
18
|
+
'-gp-rotate-90': isShow === true && iconSvg !== 'plus' && !iconExpand,
|
|
19
|
+
'gp-rotate-90': isShow === false && !iconCollapse
|
|
20
|
+
}, 'group-hover:[color:var(--icon-hover-color)] gp-collapsible-icon gp-accordion-item_icon gp-inline-flex gp-items-center gp-justify-center gp-overflow-hidden gp-transition-all gp-duration-200 [&>svg]:!gp-h-[var(--height-iconCollapseSize)] [&>svg]:!gp-w-auto', isShow ? getGlobalColorClass('text', color?.active) : getGlobalColorStateClass('text', color)));
|
|
21
|
+
};
|
|
22
|
+
const getDropdownClasses = (styles, extraData)=>{
|
|
23
|
+
const { isShow, uniqueId, makeIcon } = extraData || {};
|
|
24
|
+
const { itemHeaderSpacing, headerContentPadding, bgColor, textColor } = styles ?? {};
|
|
25
|
+
return composeClasses(cls('gp-flex gp-accordion-item_header gp-cursor-pointer gp-items-center', makeIcon ? 'gp-gap-[16px]' : '', uniqueId, `gp-accordion-item-${uniqueId}-${extraData?.index}`, itemHeaderSpacing?.type && !headerContentPadding ? genSizeClass(itemHeaderSpacing?.type) : '', {
|
|
26
|
+
[getGlobalColorClass('bg', bgColor?.active)]: isShow,
|
|
27
|
+
[getGlobalColorClass('text', textColor?.active)]: isShow,
|
|
28
|
+
[getGlobalColorStateClass('bg', bgColor)]: !isShow,
|
|
29
|
+
[getGlobalColorStateClass('text', textColor)]: !isShow
|
|
30
|
+
}));
|
|
31
|
+
};
|
|
32
|
+
const getContentClasses = (parentUid)=>composeClasses(cls(`${parentUid}`, 'gp-overflow-hidden', `gp-child-item-${parentUid}`, 'gp-accordion-item'));
|
|
33
|
+
const getGapClasses = composeClasses('gp-flex gp-w-full gp-items-center gp-break-all');
|
|
34
|
+
const getLayoutTextClasses = composeClasses('group-hover:[color:var(--icon-hover-color)] [color:var(--icon-hover-color)] [color:var(--icon-active-color)] gp-icon gp-inline-flex header-icon gp-items-center gp-justify-center gp-overflow-hidden [&>svg]:!gp-h-[var(--height-configIconSize)] [&>svg]:!gp-w-auto');
|
|
35
|
+
const getRenderChildrenClasses = (styles, extraData)=>{
|
|
36
|
+
const { isShow, hasTransitionedIn, isMounted } = extraData || {};
|
|
37
|
+
const { itemContentSpacing, contentSizePadding } = styles ?? {};
|
|
38
|
+
return composeClasses(cls('gp-accordion-item_body gp-transition-all gp-grid gp-duration-500 gp-overflow-hidden', `gp-grid-rows-[${+Boolean(isShow)}fr]`, {
|
|
39
|
+
'gp-grid-rows-[1fr]': isShow ? hasTransitionedIn : isMounted,
|
|
40
|
+
'gp-grid-rows-[0fr]': !isShow ? !isMounted : !hasTransitionedIn
|
|
41
|
+
}, itemContentSpacing?.type && !contentSizePadding ? genSizeClass(itemContentSpacing?.type) : ''));
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { extendClasses, getContainerClasses, getContentClasses, getDropdownClasses, getGapClasses, getIconClasses, getIconRotateClasses, getItemContainerClasses, getLayoutTextClasses, getRenderChildrenClasses };
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { makeGlobalSize, composeSize, removePaddingYInStyle, makeStyle, getGlobalColorStateStyle } from '@gem-sdk/core';
|
|
2
|
+
|
|
3
|
+
const MINIMUM_CHILD = 1;
|
|
4
|
+
const BODY_CHILD_INDEX = 0;
|
|
5
|
+
const DEFAULT_BEFORE_ICON = '<svg height="100%" width="100%" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"><path fill="currentColor" strokelinecap="round" strokelinejoin="round" d="M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z"></path></svg>';
|
|
6
|
+
const DEFAULT_AFTER_ICON = '<svg height="100%" width="100%" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"><path fill="currentColor" strokelinecap="round" strokelinejoin="round" d="M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z"></path></svg>';
|
|
7
|
+
const ICON_MINUS = `<svg width='16' height='16' fill='currentColor' viewBox="0 0 448 512"><path fill='currentColor' d="M400 288h-352c-17.69 0-32-14.32-32-32.01s14.31-31.99 32-31.99h352c17.69 0 32 14.3 32 31.99S417.7 288 400 288z"/></svg>`;
|
|
8
|
+
const ICON_PLUS = `<svg fill='currentColor' width='16' height='16' xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill='currentColor' d="M432 256c0 17.69-14.33 32.01-32 32.01H256v144c0 17.69-14.33 31.99-32 31.99s-32-14.3-32-31.99v-144H48c-17.67 0-32-14.32-32-32.01s14.33-31.99 32-31.99H192v-144c0-17.69 14.33-32.01 32-32.01s32 14.32 32 32.01v144h144C417.7 224 432 238.3 432 256z"/></svg>`;
|
|
9
|
+
const getDataState = (props, rawChildren)=>{
|
|
10
|
+
const { setting = {}, styles = {}, builderProps } = props;
|
|
11
|
+
const { activeKey, iconSvg, expandItem, iconPosition, iconCollapseSize, iconGlobalSize, iconExpand, iconCollapse, layoutHeader, expandedMode, configIconSize } = setting;
|
|
12
|
+
const { bgColor, color, headerBorder, width, fullWidth, textColor, itemHeaderSpacing, contentSizePadding, iconColor, headerContentPadding, widthHeightSize } = styles;
|
|
13
|
+
const expanded = expandedMode === 'multiple';
|
|
14
|
+
const parseActiveKeys = (key)=>{
|
|
15
|
+
if (!key) return [];
|
|
16
|
+
return key.toLowerCase().split(',').map((item)=>parseInt(item.trim()) - 1).map((item)=>item.toString());
|
|
17
|
+
};
|
|
18
|
+
const activeIndex = expandItem ? parseActiveKeys(activeKey) : [];
|
|
19
|
+
const accordions = expanded ? [
|
|
20
|
+
...activeIndex
|
|
21
|
+
] : activeIndex;
|
|
22
|
+
const getSetting = ()=>({
|
|
23
|
+
iconSvg,
|
|
24
|
+
isIconPlus: iconSvg === 'plus',
|
|
25
|
+
activeKey,
|
|
26
|
+
expanded,
|
|
27
|
+
expandItem,
|
|
28
|
+
iconPosition,
|
|
29
|
+
iconGlobalSize,
|
|
30
|
+
iconCollapse,
|
|
31
|
+
iconExpand,
|
|
32
|
+
iconCollapseSize,
|
|
33
|
+
layoutHeader,
|
|
34
|
+
expandedMode,
|
|
35
|
+
configIconSize,
|
|
36
|
+
parentUid: builderProps?.uid,
|
|
37
|
+
childListNumber: expandItem ? activeKey?.toLowerCase() === 'all' ? rawChildren?.map((_, index)=>index.toString()) : accordions : [],
|
|
38
|
+
chidlrenUid: rawChildren?.map((item)=>item.uid)
|
|
39
|
+
});
|
|
40
|
+
const getStyles = ()=>({
|
|
41
|
+
bgColor,
|
|
42
|
+
color,
|
|
43
|
+
headerBorder,
|
|
44
|
+
fullWidth,
|
|
45
|
+
width,
|
|
46
|
+
itemHeaderSpacing,
|
|
47
|
+
textColor,
|
|
48
|
+
iconColor,
|
|
49
|
+
contentSizePadding,
|
|
50
|
+
headerContentPadding,
|
|
51
|
+
widthHeightSize
|
|
52
|
+
});
|
|
53
|
+
return {
|
|
54
|
+
uidState: builderProps?.uid,
|
|
55
|
+
settingState: getSetting(),
|
|
56
|
+
stylesState: getStyles(),
|
|
57
|
+
accordions
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
const getParentSettings = (parentSettings = {})=>{
|
|
61
|
+
const { iconSvg, titleTypo, layoutHeader, iconGlobalSize, iconCollapseSize, iconCollapse, iconExpand, alignment, configIconSize, iconPosition } = parentSettings;
|
|
62
|
+
const sanitizedTitleTypo = titleTypo ? {
|
|
63
|
+
...titleTypo,
|
|
64
|
+
attrs: {
|
|
65
|
+
...titleTypo.attrs
|
|
66
|
+
}
|
|
67
|
+
} : undefined;
|
|
68
|
+
if (sanitizedTitleTypo?.attrs?.color) {
|
|
69
|
+
delete sanitizedTitleTypo.attrs.color;
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
iconSvg,
|
|
73
|
+
titleTypo: sanitizedTitleTypo,
|
|
74
|
+
layoutHeader,
|
|
75
|
+
iconGlobalSize,
|
|
76
|
+
iconCollapseSize,
|
|
77
|
+
iconCollapse,
|
|
78
|
+
iconExpand,
|
|
79
|
+
alignment,
|
|
80
|
+
configIconSize,
|
|
81
|
+
iconPosition
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
const getSettingItemLiquid = (props)=>{
|
|
85
|
+
const { index, accordions, parentSetting, parentStyle } = props;
|
|
86
|
+
const { iconSvg, titleTypo, iconCollapse, iconExpand, activeKey, expandItem } = parentSetting ?? {};
|
|
87
|
+
delete titleTypo?.attrs?.color;
|
|
88
|
+
const { itemContentSpacing, iconColor, contentSizePadding } = parentStyle ?? {};
|
|
89
|
+
const isShow = !expandItem ? false : activeKey?.toString()?.toLowerCase() === 'all' ? true : accordions?.includes(index?.toString() ?? '');
|
|
90
|
+
const contentSizePaddingSize = makeGlobalSize(contentSizePadding);
|
|
91
|
+
const composeContentSizeStyle = ()=>{
|
|
92
|
+
const contentSizeStyle = {
|
|
93
|
+
...contentSizePadding && contentSizePaddingSize.padding,
|
|
94
|
+
...!itemContentSpacing?.type && !contentSizePadding ? composeSize(itemContentSpacing?.custom) : {}
|
|
95
|
+
};
|
|
96
|
+
if (!isShow) {
|
|
97
|
+
return removePaddingYInStyle(contentSizeStyle);
|
|
98
|
+
}
|
|
99
|
+
return contentSizeStyle;
|
|
100
|
+
};
|
|
101
|
+
const makeIcon = ()=>{
|
|
102
|
+
if (iconExpand && isShow) {
|
|
103
|
+
return iconExpand;
|
|
104
|
+
}
|
|
105
|
+
if (iconCollapse && !isShow) {
|
|
106
|
+
return iconCollapse;
|
|
107
|
+
}
|
|
108
|
+
if (iconSvg === 'plus') {
|
|
109
|
+
if (isShow) {
|
|
110
|
+
return ICON_MINUS;
|
|
111
|
+
}
|
|
112
|
+
return ICON_PLUS;
|
|
113
|
+
}
|
|
114
|
+
if (iconSvg) {
|
|
115
|
+
return iconSvg;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
const collapsibleIcon = makeIcon();
|
|
119
|
+
const composeIconColor = ()=>{
|
|
120
|
+
if (isShow) {
|
|
121
|
+
return makeStyle({
|
|
122
|
+
c: iconColor?.active
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
return getGlobalColorStateStyle('c', iconColor);
|
|
126
|
+
};
|
|
127
|
+
return {
|
|
128
|
+
isShow,
|
|
129
|
+
composeContentSizeStyle,
|
|
130
|
+
collapsibleIcon,
|
|
131
|
+
composeIconColor,
|
|
132
|
+
makeIcon
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export { BODY_CHILD_INDEX, DEFAULT_AFTER_ICON, DEFAULT_BEFORE_ICON, ICON_MINUS, ICON_PLUS, MINIMUM_CHILD, getDataState, getParentSettings, getSettingItemLiquid };
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { getStyleBackgroundByDevice, makeStyle, getSingleColorVariable, makeStyleResponsive, getStyleShadow, getRadiusStyleActiveState, composeSize, getGlobalColorStateStyle, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertBorderColor, makeGlobalSize, makeWidth } from '@gem-sdk/core';
|
|
2
|
+
|
|
3
|
+
const filterStyles = (style)=>{
|
|
4
|
+
const delList = [
|
|
5
|
+
'--mb',
|
|
6
|
+
'--mb-mobile',
|
|
7
|
+
'--mb-tablet',
|
|
8
|
+
'--d',
|
|
9
|
+
'--d-mobile',
|
|
10
|
+
'--d-tablet'
|
|
11
|
+
];
|
|
12
|
+
delList.forEach((element)=>{
|
|
13
|
+
delete style?.[element];
|
|
14
|
+
});
|
|
15
|
+
return style;
|
|
16
|
+
};
|
|
17
|
+
const contentSizePaddingSize = (styles)=>makeGlobalSize(styles?.contentSizePadding);
|
|
18
|
+
const getContainerStyles = (style, styles)=>{
|
|
19
|
+
return {
|
|
20
|
+
...filterStyles(style),
|
|
21
|
+
...contentSizePaddingSize(styles).gap,
|
|
22
|
+
...getStyleBackgroundByDevice(style?.backgroundContent),
|
|
23
|
+
borderRadius: 'inherit',
|
|
24
|
+
overflow: 'hidden'
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
const widthHeightSizeControl = (widthHeightSize)=>makeGlobalSize(widthHeightSize);
|
|
28
|
+
const widthStyle = (width, fullWidth, widthHeightSize)=>widthHeightSizeControl(widthHeightSize).width['--w'] ? widthHeightSizeControl(widthHeightSize).width : makeStyleResponsive('w', makeWidth(width, fullWidth));
|
|
29
|
+
const getItemContainerStyles = (styles, isShow)=>{
|
|
30
|
+
const { borderContent, backgroundContent, roundedContent, accordionShadow, width, fullWidth, widthHeightSize, color } = styles ?? {};
|
|
31
|
+
return {
|
|
32
|
+
'--icon-hover-color': isShow ? color?.active : color?.hover,
|
|
33
|
+
'--icon-active-color': color?.active,
|
|
34
|
+
...widthStyle(width, fullWidth, widthHeightSize),
|
|
35
|
+
...makeStyle({
|
|
36
|
+
bs: borderContent?.border ?? borderContent?.border,
|
|
37
|
+
bw: borderContent?.width ?? borderContent?.width,
|
|
38
|
+
bc: getSingleColorVariable(borderContent?.color ?? borderContent?.color)
|
|
39
|
+
}),
|
|
40
|
+
...makeStyleResponsive('bg', backgroundContent),
|
|
41
|
+
...getStyleShadow({
|
|
42
|
+
value: accordionShadow,
|
|
43
|
+
styleAppliedFor: 'box-shadow',
|
|
44
|
+
isEnableShadow: accordionShadow?.type !== 'none'
|
|
45
|
+
}),
|
|
46
|
+
...getRadiusStyleActiveState({
|
|
47
|
+
...roundedContent,
|
|
48
|
+
active: {
|
|
49
|
+
...roundedContent || {},
|
|
50
|
+
radiusType: 'custom'
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
const headerContentPaddingSize = (headerContentPadding)=>makeGlobalSize(headerContentPadding);
|
|
56
|
+
const composePosition = (iconPosition)=>{
|
|
57
|
+
return makeStyle({
|
|
58
|
+
fd: iconPosition === 'left' ? 'row' : 'row-reverse',
|
|
59
|
+
jc: iconPosition === 'right' ? 'space-between' : ''
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
const getDropdownStyles = (styles, extraData)=>{
|
|
63
|
+
const { headerContentPadding, widthHeightSize, itemHeaderSpacing, bgColor, textColor, headerBorder } = styles ?? {};
|
|
64
|
+
const { isShow, iconPosition } = extraData ?? {};
|
|
65
|
+
return {
|
|
66
|
+
...headerContentPadding && headerContentPaddingSize(headerContentPadding).padding,
|
|
67
|
+
...!itemHeaderSpacing?.type && !headerContentPadding ? composeSize(itemHeaderSpacing?.custom) : {},
|
|
68
|
+
...widthHeightSizeControl(widthHeightSize).height,
|
|
69
|
+
...composePosition(iconPosition),
|
|
70
|
+
...isShow ? makeStyle({
|
|
71
|
+
bgc: getSingleColorVariable(bgColor?.active ?? bgColor?.normal),
|
|
72
|
+
bs: headerBorder?.active?.border,
|
|
73
|
+
bw: headerBorder?.active?.width,
|
|
74
|
+
bc: getSingleColorVariable(headerBorder?.active?.color),
|
|
75
|
+
c: getSingleColorVariable(textColor?.active ?? textColor?.normal)
|
|
76
|
+
}) : {
|
|
77
|
+
...getGlobalColorStateStyle('bgc', bgColor),
|
|
78
|
+
...getGlobalColorStateStyle('c', textColor),
|
|
79
|
+
...handleConvertBorderStyle(headerBorder),
|
|
80
|
+
...handleConvertBorderWidth(headerBorder),
|
|
81
|
+
...handleConvertBorderColor(headerBorder),
|
|
82
|
+
...getGlobalColorStateStyle('bgc', bgColor)
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
const getIconRotateStyles = (styles, isShow, iconCollapseSize)=>{
|
|
87
|
+
const { color } = styles ?? {};
|
|
88
|
+
return {
|
|
89
|
+
...isShow ? makeStyle({
|
|
90
|
+
c: getSingleColorVariable(color?.active ?? color?.normal)
|
|
91
|
+
}) : {
|
|
92
|
+
...getGlobalColorStateStyle('c', color)
|
|
93
|
+
},
|
|
94
|
+
width: `${iconCollapseSize ?? 16}px`,
|
|
95
|
+
height: `${iconCollapseSize ?? 16}px`
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
const composeIconGlobalSize = (iconGlobalSize)=>makeGlobalSize(iconGlobalSize);
|
|
99
|
+
const getGapStyles = (iconGlobalSize, alignment)=>{
|
|
100
|
+
return {
|
|
101
|
+
...composeIconGlobalSize(iconGlobalSize).gap,
|
|
102
|
+
...makeStyleResponsive('jc', alignment)
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
const getLayoutTextStyles = (composeIconColor, configIconSize)=>{
|
|
106
|
+
const size = configIconSize ? `${configIconSize}px` : '16px';
|
|
107
|
+
return {
|
|
108
|
+
...composeIconColor,
|
|
109
|
+
width: size,
|
|
110
|
+
height: size,
|
|
111
|
+
'--height': size
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
const getRenderChildrenStyles = (composeContentSizeStyle)=>{
|
|
115
|
+
return {
|
|
116
|
+
...composeContentSizeStyle,
|
|
117
|
+
gridTemplateColumns: 'minmax(auto, 100%)'
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
const getIconGlobalSize = (iconGlobalSize)=>makeGlobalSize(iconGlobalSize)?.padding;
|
|
121
|
+
|
|
122
|
+
export { getContainerStyles, getDropdownStyles, getGapStyles, getIconGlobalSize, getIconRotateStyles, getItemContainerStyles, getLayoutTextStyles, getRenderChildrenStyles };
|