@gem-sdk/components 2.0.0-dev.293 → 2.0.0-dev.303
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/common/index.js +2 -2
- package/dist/cjs/article/components/ArticleAuthor.js +1 -1
- package/dist/cjs/article/components/ArticleTitle.js +3 -1
- package/dist/cjs/article/components/ArticleTitle.liquid.js +5 -2
- package/dist/cjs/article/setting/ArticleList.js +0 -30
- package/dist/cjs/article/setting/configs/ArticleAuthor/presets.js +0 -9
- package/dist/cjs/article/setting/configs/ArticleAuthor/settings.js +9 -5
- package/dist/cjs/article/setting/configs/ArticleAuthor/uiV2.js +16 -0
- package/dist/cjs/article/setting/configs/ArticleCategory/presets.js +0 -9
- package/dist/cjs/article/setting/configs/ArticleCategory/settings.js +9 -5
- package/dist/cjs/article/setting/configs/ArticleDate/presets.js +0 -9
- package/dist/cjs/article/setting/configs/ArticleDate/settings.js +9 -5
- package/dist/cjs/article/setting/configs/ArticleImage/settings.js +22 -1
- package/dist/cjs/article/setting/configs/ArticleTitle/settings.js +36 -7
- package/dist/cjs/article/setting/configs/ArticleTitle/uiV2.js +47 -2
- package/dist/cjs/builder.js +6 -2
- package/dist/cjs/button/components/Button.js +1 -1
- package/dist/cjs/button/components/Button.liquid.js +1 -1
- package/dist/cjs/button/components/ButtonIcon.liquid.js +3 -1
- package/dist/cjs/button/components/ButtonLabel.liquid.js +3 -1
- package/dist/cjs/button/components/common/attributes.js +2 -2
- package/dist/cjs/button/components/common/classes.js +2 -1
- package/dist/cjs/button/components/common/styles.js +9 -11
- package/dist/cjs/button/setting/configs/settings.js +7 -8
- package/dist/cjs/button/setting/configs/uiV2.js +4 -50
- package/dist/cjs/dialog/components/Dialog.js +109 -394
- package/dist/cjs/dialog/components/Dialog.liquid.js +129 -153
- package/dist/cjs/dialog/components/common/common.js +130 -0
- package/dist/cjs/dialog/components/common/getAttr.js +27 -0
- package/dist/cjs/dialog/components/common/getClasses.js +88 -0
- package/dist/cjs/dialog/components/common/getStyle.js +107 -0
- package/dist/cjs/dialog/components/hooks/useDialog.js +233 -0
- package/dist/cjs/dialog/setting/configs/settings.js +1 -1
- package/dist/cjs/dialog/setting/configs/uiV2.js +35 -25
- package/dist/cjs/form/components/form-checkbox/FormCheckbox.js +0 -4
- package/dist/cjs/form/components/textinput/TextInput.js +58 -0
- package/dist/cjs/form/components/textinput/TextInput.liquid.js +60 -0
- package/dist/cjs/form/components/textinput/common/composeClasses.js +33 -0
- package/dist/cjs/form/components/textinput/common/composeStyles.js +70 -0
- package/dist/cjs/form/next.js +5 -1
- package/dist/cjs/form/setting/index.js +3 -1
- package/dist/cjs/form/setting/newsletter/configs/settings.js +4 -2
- package/dist/cjs/form/setting/newsletter/configs/uiV2.js +2 -0
- package/dist/cjs/form/setting/text-input/TextInput.js +53 -0
- package/dist/cjs/form/setting/text-input/configs/settings.js +307 -0
- package/dist/cjs/form/setting/text-input/configs/uiV1.js +106 -0
- package/dist/cjs/form/setting/text-input/configs/uiV2.js +303 -0
- package/dist/cjs/grid/row/setting/configs/settings.js +6 -3
- package/dist/cjs/helpers.js +8 -0
- package/dist/cjs/icon-list/common/attrs.js +10 -0
- package/dist/cjs/icon-list/common/classes.js +9 -0
- package/dist/cjs/icon-list/common/styles.js +29 -0
- package/dist/cjs/icon-list/components/IconList.js +19 -30
- package/dist/cjs/icon-list/components/IconList.liquid.js +21 -24
- package/dist/cjs/icon-list/components/IconListItem.js +13 -7
- package/dist/cjs/icon-list/components/IconListItem.liquid.js +13 -7
- package/dist/cjs/icon-list-hoz/components/IconListHoz.js +37 -25
- package/dist/cjs/icon-list-hoz/components/IconListHoz.liquid.js +31 -25
- package/dist/cjs/icon-list-hoz/components/IconListHozItem.js +12 -6
- package/dist/cjs/icon-list-hoz/components/IconListIHozItem.liquid.js +26 -0
- package/dist/cjs/icon-list-hoz/components/common/getAttr.js +9 -0
- package/dist/cjs/icon-list-hoz/components/common/getClasses.js +24 -0
- package/dist/cjs/icon-list-hoz/components/common/getStyle.js +30 -0
- package/dist/cjs/image/components/AdaptiveImage.js +1 -1
- package/dist/cjs/image/components/AdaptiveImage.liquid.js +4 -4
- package/dist/cjs/image/components/Image.js +1 -5
- package/dist/cjs/image/components/common/styles.js +2 -2
- package/dist/cjs/image/components/helpers/getNextImageLiquidAttrs.js +6 -24
- package/dist/cjs/image/components/helpers/getNextImageReactAttrs.js +3 -3
- package/dist/cjs/index.js +6 -1
- package/dist/cjs/index.liquid.js +7 -3
- package/dist/cjs/line/common/classes.js +66 -0
- package/dist/cjs/line/common/index.js +16 -0
- package/dist/cjs/line/common/styles.js +120 -0
- package/dist/cjs/line/components/Divider.js +26 -0
- package/dist/cjs/line/components/Divider.liquid.js +22 -0
- package/dist/cjs/line/components/Line.js +98 -0
- package/dist/cjs/line/components/Line.liquid.js +86 -0
- package/dist/cjs/line/next.js +1 -1
- package/dist/cjs/post-purchase/line/setting/configs/uiV2.js +1 -1
- package/dist/cjs/post-purchase/link/setting/configs/settings.js +2 -1
- package/dist/cjs/post-purchase/link/setting/configs/uiV2.js +1 -1
- package/dist/cjs/post-purchase/product/settings/product-variants/configs/uiV2.js +1 -1
- package/dist/cjs/product/components/FileUpload/components/config/setting.js +24 -26
- package/dist/cjs/product/components/FileUpload/components/config/uiV2.js +12 -179
- package/dist/cjs/product/components/ProductList.js +1 -1
- package/dist/cjs/product/components/ProductVariants/index.js +2 -2
- package/dist/cjs/product/components/ProductVariants/index.liquid.js +2 -2
- package/dist/cjs/product/components/ProductVariants/variants/Dropdown.js +8 -3
- package/dist/cjs/product/components/ProductVariants/variants/Dropdown.liquid.js +7 -2
- package/dist/cjs/product/setting/ProductVariants.js +8 -1374
- package/dist/cjs/product/setting/product/configs/uiV2.js +2 -2
- package/dist/cjs/product/setting/product-list/configs/uiV2.js +0 -3
- package/dist/cjs/product/setting/product-variant/configs/presets.js +168 -0
- package/dist/cjs/product/setting/product-variant/configs/settings.js +732 -0
- package/dist/cjs/product/setting/product-variant/configs/uiV1.js +509 -0
- package/dist/cjs/product/setting/product-variant/configs/uiV2.js +347 -0
- package/dist/cjs/third-party/components/EcoboostifyShoppableReelUgc.js +33 -0
- package/dist/cjs/third-party/components/EcoboostifyShoppableReelUgc.liquid.js +12 -0
- package/dist/cjs/third-party/components/RechargeSubscriptions.liquid.js +1 -1
- package/dist/cjs/third-party/configs/EcoboostifyShoppableReelUgc.js +12 -0
- package/dist/cjs/third-party/next.js +5 -0
- package/dist/cjs/third-party/setting/EcoboostifyShoppableReelUgc.js +142 -0
- package/dist/cjs/third-party/setting/RechargeSubscriptions.js +5 -2
- package/dist/cjs/third-party/setting/index.js +3 -1
- package/dist/esm/accordion/components/common/index.js +2 -2
- package/dist/esm/article/components/ArticleAuthor.js +1 -1
- package/dist/esm/article/components/ArticleTitle.js +3 -1
- package/dist/esm/article/components/ArticleTitle.liquid.js +5 -2
- package/dist/esm/article/setting/ArticleList.js +0 -30
- package/dist/esm/article/setting/configs/ArticleAuthor/presets.js +0 -9
- package/dist/esm/article/setting/configs/ArticleAuthor/settings.js +9 -5
- package/dist/esm/article/setting/configs/ArticleAuthor/uiV2.js +16 -0
- package/dist/esm/article/setting/configs/ArticleCategory/presets.js +0 -9
- package/dist/esm/article/setting/configs/ArticleCategory/settings.js +9 -5
- package/dist/esm/article/setting/configs/ArticleDate/presets.js +0 -9
- package/dist/esm/article/setting/configs/ArticleDate/settings.js +9 -5
- package/dist/esm/article/setting/configs/ArticleImage/settings.js +22 -1
- package/dist/esm/article/setting/configs/ArticleTitle/settings.js +36 -7
- package/dist/esm/article/setting/configs/ArticleTitle/uiV2.js +47 -2
- package/dist/esm/builder.js +6 -2
- package/dist/esm/button/components/Button.js +1 -1
- package/dist/esm/button/components/Button.liquid.js +1 -1
- package/dist/esm/button/components/ButtonIcon.liquid.js +3 -1
- package/dist/esm/button/components/ButtonLabel.liquid.js +3 -1
- package/dist/esm/button/components/common/attributes.js +2 -2
- package/dist/esm/button/components/common/classes.js +3 -2
- package/dist/esm/button/components/common/styles.js +10 -12
- package/dist/esm/button/setting/configs/settings.js +7 -8
- package/dist/esm/button/setting/configs/uiV2.js +4 -50
- package/dist/esm/dialog/components/Dialog.js +110 -395
- package/dist/esm/dialog/components/Dialog.liquid.js +130 -154
- package/dist/esm/dialog/components/common/common.js +117 -0
- package/dist/esm/dialog/components/common/getAttr.js +22 -0
- package/dist/esm/dialog/components/common/getClasses.js +79 -0
- package/dist/esm/dialog/components/common/getStyle.js +98 -0
- package/dist/esm/dialog/components/hooks/useDialog.js +231 -0
- package/dist/esm/dialog/setting/configs/settings.js +1 -1
- package/dist/esm/dialog/setting/configs/uiV2.js +35 -25
- package/dist/esm/form/components/form-checkbox/FormCheckbox.js +0 -4
- package/dist/esm/form/components/textinput/TextInput.js +54 -0
- package/dist/esm/form/components/textinput/TextInput.liquid.js +56 -0
- package/dist/esm/form/components/textinput/common/composeClasses.js +29 -0
- package/dist/esm/form/components/textinput/common/composeStyles.js +67 -0
- package/dist/esm/form/next.js +5 -1
- package/dist/esm/form/setting/index.js +3 -1
- package/dist/esm/form/setting/newsletter/configs/settings.js +4 -2
- package/dist/esm/form/setting/newsletter/configs/uiV2.js +2 -0
- package/dist/esm/form/setting/text-input/TextInput.js +49 -0
- package/dist/esm/form/setting/text-input/configs/settings.js +305 -0
- package/dist/esm/form/setting/text-input/configs/uiV1.js +104 -0
- package/dist/esm/form/setting/text-input/configs/uiV2.js +301 -0
- package/dist/esm/grid/row/setting/configs/settings.js +6 -3
- package/dist/esm/helpers.js +8 -1
- package/dist/esm/icon-list/common/attrs.js +8 -0
- package/dist/esm/icon-list/common/classes.js +6 -0
- package/dist/esm/icon-list/common/styles.js +25 -0
- package/dist/esm/icon-list/components/IconList.js +21 -32
- package/dist/esm/icon-list/components/IconList.liquid.js +21 -24
- package/dist/esm/icon-list/components/IconListItem.js +13 -7
- package/dist/esm/icon-list/components/IconListItem.liquid.js +14 -8
- package/dist/esm/icon-list-hoz/components/IconListHoz.js +38 -26
- package/dist/esm/icon-list-hoz/components/IconListHoz.liquid.js +32 -26
- package/dist/esm/icon-list-hoz/components/IconListHozItem.js +12 -6
- package/dist/esm/icon-list-hoz/components/IconListIHozItem.liquid.js +22 -0
- package/dist/esm/icon-list-hoz/components/common/getAttr.js +7 -0
- package/dist/esm/icon-list-hoz/components/common/getClasses.js +21 -0
- package/dist/esm/icon-list-hoz/components/common/getStyle.js +27 -0
- package/dist/esm/image/components/AdaptiveImage.js +2 -2
- package/dist/esm/image/components/AdaptiveImage.liquid.js +4 -4
- package/dist/esm/image/components/Image.js +2 -6
- package/dist/esm/image/components/common/styles.js +2 -2
- package/dist/esm/image/components/helpers/getNextImageLiquidAttrs.js +6 -24
- package/dist/esm/image/components/helpers/getNextImageReactAttrs.js +3 -3
- package/dist/esm/index.js +4 -2
- package/dist/esm/index.liquid.js +4 -2
- package/dist/esm/line/common/classes.js +59 -0
- package/dist/esm/line/common/index.js +14 -0
- package/dist/esm/line/common/styles.js +114 -0
- package/dist/esm/line/components/Divider.js +22 -0
- package/dist/esm/line/components/Divider.liquid.js +18 -0
- package/dist/esm/line/components/Line.js +94 -0
- package/dist/esm/line/components/Line.liquid.js +82 -0
- package/dist/esm/line/next.js +1 -1
- package/dist/esm/post-purchase/line/setting/configs/uiV2.js +1 -1
- package/dist/esm/post-purchase/link/setting/configs/settings.js +2 -1
- package/dist/esm/post-purchase/link/setting/configs/uiV2.js +1 -1
- package/dist/esm/post-purchase/product/settings/product-variants/configs/uiV2.js +1 -1
- package/dist/esm/product/components/FileUpload/components/config/setting.js +24 -26
- package/dist/esm/product/components/FileUpload/components/config/uiV2.js +12 -179
- package/dist/esm/product/components/ProductList.js +1 -1
- package/dist/esm/product/components/ProductVariants/index.js +2 -2
- package/dist/esm/product/components/ProductVariants/index.liquid.js +2 -2
- package/dist/esm/product/components/ProductVariants/variants/Dropdown.js +8 -3
- package/dist/esm/product/components/ProductVariants/variants/Dropdown.liquid.js +7 -2
- package/dist/esm/product/setting/ProductVariants.js +8 -1374
- package/dist/esm/product/setting/product/configs/uiV2.js +2 -2
- package/dist/esm/product/setting/product-list/configs/uiV2.js +0 -3
- package/dist/esm/product/setting/product-variant/configs/presets.js +166 -0
- package/dist/esm/product/setting/product-variant/configs/settings.js +730 -0
- package/dist/esm/product/setting/product-variant/configs/uiV1.js +507 -0
- package/dist/esm/product/setting/product-variant/configs/uiV2.js +345 -0
- package/dist/esm/third-party/components/EcoboostifyShoppableReelUgc.js +29 -0
- package/dist/esm/third-party/components/EcoboostifyShoppableReelUgc.liquid.js +8 -0
- package/dist/esm/third-party/components/RechargeSubscriptions.liquid.js +1 -1
- package/dist/esm/third-party/configs/EcoboostifyShoppableReelUgc.js +8 -0
- package/dist/esm/third-party/next.js +5 -0
- package/dist/esm/third-party/setting/EcoboostifyShoppableReelUgc.js +138 -0
- package/dist/esm/third-party/setting/RechargeSubscriptions.js +5 -2
- package/dist/esm/third-party/setting/index.js +3 -1
- package/dist/types/index.d.ts +184 -166
- package/package.json +2 -2
- package/dist/cjs/dialog/helpers/common.js +0 -55
- package/dist/cjs/icon-list-hoz/components/IconListItemHoz.liquid.js +0 -23
- package/dist/cjs/line/Divider.js +0 -35
- package/dist/cjs/line/Divider.liquid.js +0 -35
- package/dist/cjs/line/Line.js +0 -167
- package/dist/cjs/line/Line.liquid.js +0 -163
- package/dist/esm/dialog/helpers/common.js +0 -47
- package/dist/esm/icon-list-hoz/components/IconListItemHoz.liquid.js +0 -19
- package/dist/esm/line/Divider.js +0 -31
- package/dist/esm/line/Divider.liquid.js +0 -31
- package/dist/esm/line/Line.js +0 -163
- package/dist/esm/line/Line.liquid.js +0 -159
- /package/dist/cjs/dialog/{hooks/use-scroll-percentage.js → components/hooks/useScrollPercentage.js} +0 -0
- /package/dist/cjs/product/setting/{swatches-style-config → product-variant/swatches-style-config}/color.js +0 -0
- /package/dist/cjs/product/setting/{swatches-style-config → product-variant/swatches-style-config}/dropdown.js +0 -0
- /package/dist/cjs/product/setting/{swatches-style-config → product-variant/swatches-style-config}/image-shopify.js +0 -0
- /package/dist/cjs/product/setting/{swatches-style-config → product-variant/swatches-style-config}/image.js +0 -0
- /package/dist/cjs/product/setting/{swatches-style-config → product-variant/swatches-style-config}/rectangle-list.js +0 -0
- /package/dist/esm/dialog/{hooks/use-scroll-percentage.js → components/hooks/useScrollPercentage.js} +0 -0
- /package/dist/esm/product/setting/{swatches-style-config → product-variant/swatches-style-config}/color.js +0 -0
- /package/dist/esm/product/setting/{swatches-style-config → product-variant/swatches-style-config}/dropdown.js +0 -0
- /package/dist/esm/product/setting/{swatches-style-config → product-variant/swatches-style-config}/image-shopify.js +0 -0
- /package/dist/esm/product/setting/{swatches-style-config → product-variant/swatches-style-config}/image.js +0 -0
- /package/dist/esm/product/setting/{swatches-style-config → product-variant/swatches-style-config}/rectangle-list.js +0 -0
|
@@ -3,75 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var core = require('@gem-sdk/core');
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
require('
|
|
9
|
-
require('
|
|
10
|
-
var _const = require('../../common/const.js');
|
|
6
|
+
var system = require('@gem-sdk/system');
|
|
7
|
+
var getAttr = require('./common/getAttr.js');
|
|
8
|
+
var getStyle = require('./common/getStyle.js');
|
|
9
|
+
var getClasses = require('./common/getClasses.js');
|
|
11
10
|
|
|
12
|
-
const Dialog = (
|
|
11
|
+
const Dialog = (props)=>{
|
|
12
|
+
const { setting, children, builderProps, style, advanced, builderAttrs } = props;
|
|
13
13
|
const display = advanced?.d;
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
'--d-tablet': display?.tablet ? 'contents' : 'none',
|
|
17
|
-
'--d-mobile': display?.mobile ? 'contents' : 'none'
|
|
18
|
-
};
|
|
19
|
-
const { name, frequency = 3, triggerPercentage = 0, trigger, triggerTime, frequencyMode = 'once' } = setting ?? {};
|
|
20
|
-
const { fullScreen, width, height, position, effectType, closeOnClickOutside, background } = setting ?? {};
|
|
21
|
-
const { btnBg, btnColor, btnSize, iconSize, closeButtonPosition, btnRounded } = setting ?? {};
|
|
22
|
-
const { isOverlay, overlayColor, overlayOpacity, mobileTrigger, mobileTriggerTime } = setting ?? {};
|
|
23
|
-
const w = core.makeWidth(width, fullScreen);
|
|
24
|
-
const displayStyle = Object.keys(style ?? {}).filter((key)=>[
|
|
25
|
-
'--d',
|
|
26
|
-
'--d-mobile',
|
|
27
|
-
'--d-tablet'
|
|
28
|
-
].includes(key)).reduce((curr, key)=>({
|
|
29
|
-
...curr,
|
|
30
|
-
[key]: style?.[key]
|
|
31
|
-
}), {});
|
|
32
|
-
const borderStyle = Object.keys(style ?? {}).filter((key)=>[
|
|
33
|
-
'--bw',
|
|
34
|
-
'--bw-mobile',
|
|
35
|
-
'--bw-tablet',
|
|
36
|
-
'--bc',
|
|
37
|
-
'--bc-tablet',
|
|
38
|
-
'--bc-mobile',
|
|
39
|
-
'--b',
|
|
40
|
-
'--b-tablet',
|
|
41
|
-
'--b-mobile',
|
|
42
|
-
'--bs',
|
|
43
|
-
'--bs-tablet',
|
|
44
|
-
'--bs-mobile',
|
|
45
|
-
'--radius',
|
|
46
|
-
'--radius-tablet',
|
|
47
|
-
'--radius-mobile',
|
|
48
|
-
'--bblr',
|
|
49
|
-
'--bbrr',
|
|
50
|
-
'--btlr',
|
|
51
|
-
'--btrr',
|
|
52
|
-
'--bblr-tablet',
|
|
53
|
-
'--bbrr-tablet',
|
|
54
|
-
'--btlr-tablet',
|
|
55
|
-
'--btrr-tablet',
|
|
56
|
-
'--bblr-mobile',
|
|
57
|
-
'--bbrr-mobile',
|
|
58
|
-
'--btlr-mobile',
|
|
59
|
-
'--btrr-mobile'
|
|
60
|
-
].includes(key)).reduce((curr, key)=>({
|
|
61
|
-
...curr,
|
|
62
|
-
[key]: style?.[key]
|
|
63
|
-
}), {});
|
|
64
|
-
const wrapperStyle = Object.keys(style ?? {}).filter((key)=>key.startsWith('--mt') || key.startsWith('--mb') || key.startsWith('--ml') || key.startsWith('--mr')).reduce((curr, key)=>({
|
|
65
|
-
...curr,
|
|
66
|
-
[key]: style?.[key]
|
|
67
|
-
}), {});
|
|
68
|
-
const innerStyle = Object.keys(style ?? {}).filter((key)=>!Object.keys(wrapperStyle).includes(key) && !Object.keys(displayStyle).includes(key) && !Object.keys(borderStyle).includes(key)).reduce((curr, key)=>({
|
|
69
|
-
...curr,
|
|
70
|
-
[key]: style?.[key]
|
|
71
|
-
}), {});
|
|
14
|
+
const { frequency = 3, triggerPercentage = 0, trigger, triggerTime, frequencyMode = 'once', mobileTrigger, mobileTriggerTime, closeOnClickOutside } = setting ?? {};
|
|
15
|
+
const { name, fullScreen, width, height, position, overlayColor, overlayOpacity, iconSize, closeButtonPosition } = setting ?? {};
|
|
72
16
|
const dialogId = setting?.dialogId ?? builderProps?.uid;
|
|
73
|
-
|
|
74
|
-
<gp-dialog class="gps-lazy" data-id="${builderProps?.uid}" style="${dStyle}" data-gp-setting='${JSON.stringify({
|
|
17
|
+
const stateData = system.createStateOrContext({
|
|
75
18
|
dialogId,
|
|
76
19
|
trigger,
|
|
77
20
|
triggerTime,
|
|
@@ -82,110 +25,143 @@ const Dialog = ({ setting, children, builderProps, style, advanced })=>{
|
|
|
82
25
|
closeOnClickOutside,
|
|
83
26
|
frequencyMode,
|
|
84
27
|
display
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
28
|
+
});
|
|
29
|
+
const enableEffect = true;
|
|
30
|
+
const isILP = false;
|
|
31
|
+
const attrs = system.createAttr({
|
|
32
|
+
...getAttr.getAttr({
|
|
33
|
+
uid: builderProps?.uid || ''
|
|
34
|
+
})
|
|
35
|
+
});
|
|
36
|
+
const wrapperDialogStyle = system.createStyle({
|
|
37
|
+
...getStyle.getWrapperStyle(display)
|
|
38
|
+
});
|
|
39
|
+
const wrapperClasses = system.createClass({
|
|
40
|
+
...getClasses.getWrapperClasses()
|
|
41
|
+
});
|
|
42
|
+
const containClasses = system.createClass({
|
|
43
|
+
...getClasses.getContainClasses(advanced?.cssClass)
|
|
44
|
+
});
|
|
45
|
+
const containAttrs = system.createAttr({
|
|
46
|
+
...getAttr.getAttrContainer({
|
|
47
|
+
uid: dialogId || ''
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
const containStyle = system.createStyle({
|
|
51
|
+
...getStyle.getContainStyle()
|
|
52
|
+
});
|
|
53
|
+
const backdropClasses = system.createClass({
|
|
54
|
+
...getClasses.getBackdropClasses(position)
|
|
55
|
+
});
|
|
56
|
+
const backdropStyle = system.createStyle({
|
|
57
|
+
...getStyle.getBackdropStyle(style)
|
|
58
|
+
});
|
|
59
|
+
const overlayAttrs = system.createAttr({
|
|
60
|
+
...getAttr.getAttrOverlay()
|
|
61
|
+
});
|
|
62
|
+
const overlayClasses = system.createClass({
|
|
63
|
+
...getClasses.getOverlayClasses()
|
|
64
|
+
});
|
|
65
|
+
const overlayStyle = system.createStyle({
|
|
66
|
+
...getStyle.getOverlayStyle(overlayOpacity, overlayColor, style)
|
|
67
|
+
});
|
|
68
|
+
const dialogContentStyle = system.createStyle({
|
|
69
|
+
...getStyle.getDialogContentStyle({
|
|
70
|
+
style,
|
|
71
|
+
width,
|
|
72
|
+
height,
|
|
73
|
+
fullScreen
|
|
74
|
+
})
|
|
75
|
+
});
|
|
76
|
+
const dialogContentClasses = system.createClass({
|
|
77
|
+
...getClasses.getDialogContentClasses({
|
|
78
|
+
setting,
|
|
79
|
+
enableEffect,
|
|
80
|
+
isILP
|
|
115
81
|
})
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
82
|
+
});
|
|
83
|
+
const closeAttrs = system.createAttr({
|
|
84
|
+
...getAttr.getAttrClose()
|
|
85
|
+
});
|
|
86
|
+
const headContentClasses = system.createClass({
|
|
87
|
+
...getClasses.getHeadContentClasses()
|
|
88
|
+
});
|
|
89
|
+
const buttonContentStyle = system.createStyle({
|
|
90
|
+
...getStyle.getButtonContentStyle(setting)
|
|
91
|
+
});
|
|
92
|
+
const buttonContentClasses = system.createClass({
|
|
93
|
+
...getClasses.getButtonContentClasses(closeButtonPosition)
|
|
94
|
+
});
|
|
95
|
+
const svgContentStyle = system.createStyle({
|
|
96
|
+
...getStyle.getSvgContentStyle(iconSize)
|
|
97
|
+
});
|
|
98
|
+
const bodyContentStyle = system.createStyle({
|
|
99
|
+
...getStyle.getBodyContentStyle(setting, style)
|
|
100
|
+
});
|
|
101
|
+
const bodyContentClasses = system.createClass({
|
|
102
|
+
...getClasses.getBodyContentClasses()
|
|
103
|
+
});
|
|
104
|
+
const renderScript = ()=>{
|
|
105
|
+
return core.RenderIf(core.isLocalEnv, `<script src="{{ 'gp-dialog.js' | asset_url }}" defer="defer"></script>`, `<script src="${core.baseAssetURL}/assets-v2/gp-dialog.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`);
|
|
106
|
+
};
|
|
107
|
+
return core.template /* liquid */ `
|
|
108
|
+
<gp-dialog
|
|
109
|
+
${{
|
|
110
|
+
...attrs
|
|
111
|
+
}}
|
|
112
|
+
class="${wrapperClasses}"
|
|
113
|
+
style="${wrapperDialogStyle}"
|
|
114
|
+
data-gp-setting='${JSON.stringify(stateData)}'>
|
|
115
|
+
<dialog
|
|
116
|
+
aria-label="${name}"
|
|
117
|
+
${{
|
|
118
|
+
...containAttrs
|
|
119
|
+
}}
|
|
120
|
+
class="${containClasses}"
|
|
121
|
+
style="${containStyle}"
|
|
122
|
+
>
|
|
123
|
+
<div aria-label="Backdrop" class="${backdropClasses}" style="${backdropStyle}">
|
|
124
|
+
${system.If(!!overlayColor, core.template`
|
|
125
|
+
<div
|
|
126
|
+
${{
|
|
127
|
+
...overlayAttrs
|
|
128
|
+
}}
|
|
129
|
+
class="${overlayClasses}"
|
|
130
|
+
style="${overlayStyle}"
|
|
131
|
+
aria-hidden=true
|
|
132
|
+
></div>
|
|
133
|
+
`)}
|
|
134
|
+
<span class="${headContentClasses}"></span>
|
|
120
135
|
<div
|
|
121
136
|
role="dialog"
|
|
122
137
|
aria-label="Dialog content"
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
'gp-animate-[slideInUp_0.3s_ease-in]': effectType === 'vertical',
|
|
129
|
-
'gp-animate-[unfold_0.3s_ease-in-out]': effectType === 'unfold',
|
|
130
|
-
'gp-shadow-xl': !helpers.isTransparentColor(background?.desktop?.color),
|
|
131
|
-
'gp-overflow-hidden': closeButtonPosition !== 'outside'
|
|
132
|
-
})}"
|
|
133
|
-
style="${{
|
|
134
|
-
...wrapperStyle,
|
|
135
|
-
...borderStyle,
|
|
136
|
-
...core.makeStyleResponsive('w', w),
|
|
137
|
-
...common.heightStyle(fullScreen, height)
|
|
138
|
-
}}"
|
|
138
|
+
${{
|
|
139
|
+
...builderAttrs
|
|
140
|
+
}}
|
|
141
|
+
class="${dialogContentClasses}"
|
|
142
|
+
style="${dialogContentStyle}"
|
|
139
143
|
>
|
|
140
144
|
<button
|
|
145
|
+
${{
|
|
146
|
+
...closeAttrs
|
|
147
|
+
}}
|
|
141
148
|
type="button"
|
|
142
|
-
data-gp-dialog-close
|
|
143
149
|
tabindex="-1"
|
|
144
|
-
class="${
|
|
145
|
-
|
|
146
|
-
})}"
|
|
147
|
-
style="${{
|
|
148
|
-
...core.makeStyle({
|
|
149
|
-
w: `${parseInt(btnSize.toString())}px`,
|
|
150
|
-
h: `${parseInt(btnSize.toString())}px`
|
|
151
|
-
}),
|
|
152
|
-
...core.getGlobalColorResponsiveStyle('c', {
|
|
153
|
-
desktop: btnColor
|
|
154
|
-
}),
|
|
155
|
-
...core.getGlobalColorResponsiveStyle('bgc', {
|
|
156
|
-
desktop: btnBg
|
|
157
|
-
}),
|
|
158
|
-
...core.composeRadius({
|
|
159
|
-
normal: btnRounded
|
|
160
|
-
})
|
|
161
|
-
}}"
|
|
150
|
+
class="${buttonContentClasses}"
|
|
151
|
+
style="${buttonContentStyle}"
|
|
162
152
|
>
|
|
163
153
|
<svg
|
|
164
154
|
viewBox="0 0 12 12"
|
|
165
155
|
fill="currentColor"
|
|
166
|
-
style="${
|
|
167
|
-
...core.makeStyle({
|
|
168
|
-
w: iconSize,
|
|
169
|
-
h: iconSize
|
|
170
|
-
})
|
|
171
|
-
}}"
|
|
156
|
+
style="${svgContentStyle}"
|
|
172
157
|
>
|
|
173
158
|
<path d="M7.1,6l4.5,4.5l-1.1,1.1L6,7.1l-4.5,4.5l-1.1-1.1L4.9,6L0.5,1.5l1.1-1.1L6,4.9l4.5-4.5l1.1,1.1L7.1,6z"></path>
|
|
174
159
|
</svg>
|
|
175
160
|
</button>
|
|
176
161
|
<div
|
|
177
|
-
style="${{
|
|
178
|
-
...innerStyle,
|
|
179
|
-
...common.removeHeightPercentForContent(common.heightStyle(fullScreen, height)),
|
|
180
|
-
...common.inheritStyleBody,
|
|
181
|
-
...core.getStyleBackgroundByDevice(background, {
|
|
182
|
-
ignoreBackgroundImage: true,
|
|
183
|
-
ignoreBackgroundImageProperties: true,
|
|
184
|
-
ignoreBgAttachment: true
|
|
185
|
-
})
|
|
186
|
-
}}"
|
|
187
162
|
aria-label="Dialog body"
|
|
188
|
-
|
|
163
|
+
style="${bodyContentStyle}"
|
|
164
|
+
class="${bodyContentClasses}">
|
|
189
165
|
<div>
|
|
190
166
|
${children ?? ''}
|
|
191
167
|
</div>
|
|
@@ -194,7 +170,7 @@ const Dialog = ({ setting, children, builderProps, style, advanced })=>{
|
|
|
194
170
|
</div>
|
|
195
171
|
</dialog>
|
|
196
172
|
</gp-dialog>
|
|
197
|
-
${
|
|
173
|
+
${renderScript()}
|
|
198
174
|
`;
|
|
199
175
|
};
|
|
200
176
|
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@gem-sdk/core');
|
|
4
|
+
|
|
5
|
+
const getDisplayStyle = (style)=>{
|
|
6
|
+
return Object.keys(style ?? {}).filter((key)=>[
|
|
7
|
+
'--d',
|
|
8
|
+
'--d-mobile',
|
|
9
|
+
'--d-tablet'
|
|
10
|
+
].includes(key)).reduce((curr, key)=>({
|
|
11
|
+
...curr,
|
|
12
|
+
[key]: style?.[key]
|
|
13
|
+
}), {});
|
|
14
|
+
};
|
|
15
|
+
const pointerEventStyle = (style)=>{
|
|
16
|
+
return Object.keys(style ?? {}).filter((key)=>[
|
|
17
|
+
'--d',
|
|
18
|
+
'--d-mobile',
|
|
19
|
+
'--d-tablet'
|
|
20
|
+
].includes(key)).reduce((curr, key)=>({
|
|
21
|
+
...curr,
|
|
22
|
+
[key.replace('--d', '--pe')]: style?.[key] === 'none' ? 'none' : 'auto'
|
|
23
|
+
}), {});
|
|
24
|
+
};
|
|
25
|
+
const getBorderStyle = (style)=>{
|
|
26
|
+
return Object.keys(style ?? {}).filter((key)=>[
|
|
27
|
+
'--bw',
|
|
28
|
+
'--bw-mobile',
|
|
29
|
+
'--bw-tablet',
|
|
30
|
+
'--bc',
|
|
31
|
+
'--bc-tablet',
|
|
32
|
+
'--bc-mobile',
|
|
33
|
+
'--b',
|
|
34
|
+
'--b-tablet',
|
|
35
|
+
'--b-mobile',
|
|
36
|
+
'--bs',
|
|
37
|
+
'--bs-tablet',
|
|
38
|
+
'--bs-mobile',
|
|
39
|
+
'--radius',
|
|
40
|
+
'--radius-tablet',
|
|
41
|
+
'--radius-mobile',
|
|
42
|
+
'--bblr',
|
|
43
|
+
'--bbrr',
|
|
44
|
+
'--btlr',
|
|
45
|
+
'--btrr',
|
|
46
|
+
'--bblr-tablet',
|
|
47
|
+
'--bbrr-tablet',
|
|
48
|
+
'--btlr-tablet',
|
|
49
|
+
'--btrr-tablet',
|
|
50
|
+
'--bblr-mobile',
|
|
51
|
+
'--bbrr-mobile',
|
|
52
|
+
'--btlr-mobile',
|
|
53
|
+
'--btrr-mobile'
|
|
54
|
+
].includes(key)).reduce((curr, key)=>({
|
|
55
|
+
...curr,
|
|
56
|
+
[key]: style?.[key]
|
|
57
|
+
}), {});
|
|
58
|
+
};
|
|
59
|
+
const getWrapperDialogStyle = (style)=>{
|
|
60
|
+
return Object.keys(style ?? {}).filter((key)=>key.startsWith('--mt') || key.startsWith('--mb') || key.startsWith('--ml') || key.startsWith('--mr')).reduce((curr, key)=>({
|
|
61
|
+
...curr,
|
|
62
|
+
[key]: style?.[key]
|
|
63
|
+
}), {});
|
|
64
|
+
};
|
|
65
|
+
const getInnerStyle = (style)=>{
|
|
66
|
+
return Object.keys(style ?? {}).filter((key)=>!Object.keys(getWrapperDialogStyle(style)).includes(key) && !Object.keys(getDisplayStyle(style)).includes(key) && !Object.keys(getBorderStyle(style)).includes(key)).reduce((curr, key)=>({
|
|
67
|
+
...curr,
|
|
68
|
+
[key]: style?.[key]
|
|
69
|
+
}), {});
|
|
70
|
+
};
|
|
71
|
+
const createDialogKey = (uid = '', type = '')=>({
|
|
72
|
+
id: `dialog:${uid}:${type}`,
|
|
73
|
+
time: `dialog:${uid}:${type}:time`
|
|
74
|
+
});
|
|
75
|
+
const isShowModal = (startDate, numberOfDay = 0)=>{
|
|
76
|
+
const start = startDate ? new Date(Number(startDate)) : new Date();
|
|
77
|
+
const c = Date.now() - start.getTime();
|
|
78
|
+
const diff = Math.abs(c / 24 / 60 / 60 / 1000);
|
|
79
|
+
return diff >= numberOfDay;
|
|
80
|
+
};
|
|
81
|
+
const isMobile = (userAgent)=>{
|
|
82
|
+
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent)) {
|
|
83
|
+
return true;
|
|
84
|
+
} else {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
const getPropertyByDevice = (property, device)=>{
|
|
89
|
+
if (device === 'tablet') return property?.tablet ?? property?.desktop;
|
|
90
|
+
if (device === 'mobile') return property?.mobile ?? property?.tablet ?? property?.desktop;
|
|
91
|
+
return property?.desktop;
|
|
92
|
+
};
|
|
93
|
+
const heightStyle = (fullScreen, height)=>({
|
|
94
|
+
...fullScreen?.desktop ? core.makeStyle({
|
|
95
|
+
h: '100%'
|
|
96
|
+
}) : !height?.desktop ? core.makeStyle({
|
|
97
|
+
minh: '300px'
|
|
98
|
+
}) : core.makeStyle({
|
|
99
|
+
h: height.desktop
|
|
100
|
+
}),
|
|
101
|
+
'--h-tablet': getPropertyByDevice(fullScreen, 'tablet') ? '100%' : getPropertyByDevice(height, 'tablet') ?? '300px',
|
|
102
|
+
'--h-mobile': getPropertyByDevice(fullScreen, 'mobile') ? '100%' : getPropertyByDevice(height, 'mobile') ?? '300px',
|
|
103
|
+
'--maxh': getPropertyByDevice(fullScreen, 'desktop') ? '100%' : '',
|
|
104
|
+
'--maxh-tablet': getPropertyByDevice(fullScreen, 'tablet') ? '100%' : '',
|
|
105
|
+
'--maxh-mobile': getPropertyByDevice(fullScreen, 'mobile') ? '100%' : ''
|
|
106
|
+
});
|
|
107
|
+
const removeHeightPercentForContent = (heightStyle)=>({
|
|
108
|
+
...heightStyle,
|
|
109
|
+
'--h': heightStyle['--h']?.includes('%') ? '100%' : heightStyle['--h'],
|
|
110
|
+
'--h-tablet': heightStyle['--h-tablet']?.includes('%') ? '100%' : heightStyle['--h-tablet'],
|
|
111
|
+
'--h-mobile': heightStyle['--h-mobile']?.includes('%') ? '100%' : heightStyle['--h-mobile']
|
|
112
|
+
});
|
|
113
|
+
const parseNumber = (value)=>{
|
|
114
|
+
const numb = parseFloat(value?.toString() ?? '0');
|
|
115
|
+
if (isNaN(numb)) return 0;
|
|
116
|
+
return numb;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
exports.createDialogKey = createDialogKey;
|
|
120
|
+
exports.getBorderStyle = getBorderStyle;
|
|
121
|
+
exports.getDisplayStyle = getDisplayStyle;
|
|
122
|
+
exports.getInnerStyle = getInnerStyle;
|
|
123
|
+
exports.getPropertyByDevice = getPropertyByDevice;
|
|
124
|
+
exports.getWrapperDialogStyle = getWrapperDialogStyle;
|
|
125
|
+
exports.heightStyle = heightStyle;
|
|
126
|
+
exports.isMobile = isMobile;
|
|
127
|
+
exports.isShowModal = isShowModal;
|
|
128
|
+
exports.parseNumber = parseNumber;
|
|
129
|
+
exports.pointerEventStyle = pointerEventStyle;
|
|
130
|
+
exports.removeHeightPercentForContent = removeHeightPercentForContent;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const getAttr = ({ uid })=>{
|
|
4
|
+
return {
|
|
5
|
+
'data-id': uid
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
const getAttrContainer = ({ uid })=>{
|
|
9
|
+
return {
|
|
10
|
+
'data-gp-dialog-id': uid
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
const getAttrOverlay = ()=>{
|
|
14
|
+
return {
|
|
15
|
+
'data-gp-dialog-overlay': ''
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
const getAttrClose = ()=>{
|
|
19
|
+
return {
|
|
20
|
+
'data-gp-dialog-close': ''
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
exports.getAttr = getAttr;
|
|
25
|
+
exports.getAttrClose = getAttrClose;
|
|
26
|
+
exports.getAttrContainer = getAttrContainer;
|
|
27
|
+
exports.getAttrOverlay = getAttrOverlay;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var helpers = require('../../../helpers.js');
|
|
4
|
+
|
|
5
|
+
function composeClasses(classList) {
|
|
6
|
+
return classList.split(' ').reduce((acc, item)=>{
|
|
7
|
+
acc[item] = true;
|
|
8
|
+
return acc;
|
|
9
|
+
}, {});
|
|
10
|
+
}
|
|
11
|
+
const getWrapperClasses = ()=>{
|
|
12
|
+
const classList = 'gps-lazy';
|
|
13
|
+
return {
|
|
14
|
+
...composeClasses(classList)
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
const getContainClasses = (advancedCssClass)=>{
|
|
18
|
+
let classList = 'gp-dialog gp-bg-transparent';
|
|
19
|
+
if (advancedCssClass) classList += ` ${advancedCssClass}`;
|
|
20
|
+
return {
|
|
21
|
+
...composeClasses(classList)
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
const getBackdropClasses = (position)=>{
|
|
25
|
+
let classList = 'gp-fixed gp-inset-0 gp-z-50 gp-flex gp-overflow-y-auto gp-overflow-x-hidden gp-shadow-xl';
|
|
26
|
+
if (position === 'center') classList += ` gp-items-center gp-justify-center`;
|
|
27
|
+
if (position === 'top') classList += ` gp-justify-center gp-items-start`;
|
|
28
|
+
if (position === 'top-right') classList += ` gp-justify-end gp-items-start`;
|
|
29
|
+
if (position === 'top-left') classList += ` gp-justify-start gp-items-start`;
|
|
30
|
+
if (position === 'bottom') classList += ` gp-items-end gp-justify-center`;
|
|
31
|
+
if (position === 'left') classList += ` gp-items-center gp-justify-start`;
|
|
32
|
+
if (position === 'right') classList += ` gp-items-center gp-justify-end`;
|
|
33
|
+
if (position === 'bottom-left') classList += ` gp-items-end gp-justify-start`;
|
|
34
|
+
if (position === 'bottom-right') classList += ` gp-items-end gp-justify-end`;
|
|
35
|
+
return {
|
|
36
|
+
...composeClasses(classList)
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
const getOverlayClasses = ()=>{
|
|
40
|
+
const classList = 'gp-fixed gp-inset-0 gp-block gp-transition-all gp-duration-100';
|
|
41
|
+
return {
|
|
42
|
+
...composeClasses(classList)
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
const getDialogContentClasses = ({ setting, enableEffect, isILP })=>{
|
|
46
|
+
const { effectType, background, closeButtonPosition } = setting ?? {};
|
|
47
|
+
let classList = 'gp-relative gp-max-h-full gp-max-w-full';
|
|
48
|
+
if (effectType === 'fade' && enableEffect) classList += ` gp-animate-[fadeIn_0.4s_ease-in]`;
|
|
49
|
+
if (effectType === 'zoom' && enableEffect) classList += ` gp-animate-[zoomIn_0.3s_ease-in]`;
|
|
50
|
+
if (effectType === 'zoom-out' && enableEffect) classList += ` gp-animate-[zoomOut_0.3s_ease-in]`;
|
|
51
|
+
if (effectType === 'horizontal' && enableEffect) classList += ` gp-animate-[slideInLeft_0.3s_ease-in]`;
|
|
52
|
+
if (effectType === 'vertical' && enableEffect) classList += ` gp-animate-[slideInUp_0.3s_ease-in]`;
|
|
53
|
+
if (effectType === 'unfold' && enableEffect) classList += ` gp-animate-[unfold_0.3s_ease-in-out]`;
|
|
54
|
+
if (closeButtonPosition !== 'outside') classList += ` gp-overflow-hidden`;
|
|
55
|
+
if (!helpers.isTransparentColor(background?.desktop?.color)) classList += ` gp-shadow-xl`;
|
|
56
|
+
if (!enableEffect && isILP) classList += ` gp-animate-[fadeOut_0.2s_ease-out]`;
|
|
57
|
+
return {
|
|
58
|
+
...composeClasses(classList)
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
const getHeadContentClasses = ()=>{
|
|
62
|
+
const classList = 'gp-inline-block gp-h-screen gp-align-middle';
|
|
63
|
+
return {
|
|
64
|
+
...composeClasses(classList)
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
const getButtonContentClasses = (closeButtonPosition)=>{
|
|
68
|
+
let classList = 'gp-absolute gp-top-0 gp-right-0 gp-z-[999999] gp-inline-flex gp-items-center gp-justify-center gp-outline-none focus-visible:gp-shadow-none focus-visible:gp-outline-none';
|
|
69
|
+
if (closeButtonPosition === 'outside') classList += ` gp-translate-x-1/2 -gp-translate-y-1/2 gp-shadow-md`;
|
|
70
|
+
return {
|
|
71
|
+
...composeClasses(classList)
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
const getBodyContentClasses = ()=>{
|
|
75
|
+
const classList = 'gp-h-full gp-w-full gp-overflow-y-auto gp-overflow-x-hidden !gp-max-h-screen';
|
|
76
|
+
return {
|
|
77
|
+
...composeClasses(classList)
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
exports.getBackdropClasses = getBackdropClasses;
|
|
82
|
+
exports.getBodyContentClasses = getBodyContentClasses;
|
|
83
|
+
exports.getButtonContentClasses = getButtonContentClasses;
|
|
84
|
+
exports.getContainClasses = getContainClasses;
|
|
85
|
+
exports.getDialogContentClasses = getDialogContentClasses;
|
|
86
|
+
exports.getHeadContentClasses = getHeadContentClasses;
|
|
87
|
+
exports.getOverlayClasses = getOverlayClasses;
|
|
88
|
+
exports.getWrapperClasses = getWrapperClasses;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@gem-sdk/core');
|
|
4
|
+
require('react/jsx-runtime');
|
|
5
|
+
require('react');
|
|
6
|
+
var _const = require('../../../common/const.js');
|
|
7
|
+
var common = require('./common.js');
|
|
8
|
+
|
|
9
|
+
function filterTruthyStyles(styles) {
|
|
10
|
+
return Object.fromEntries(Object.entries(styles || {}).filter(([, value])=>!!value));
|
|
11
|
+
}
|
|
12
|
+
const getWrapperStyle = (display)=>{
|
|
13
|
+
const composeStyles = {
|
|
14
|
+
'--d': display?.desktop ? 'contents' : 'none',
|
|
15
|
+
'--d-tablet': display?.tablet ? 'contents' : 'none',
|
|
16
|
+
'--d-mobile': display?.mobile ? 'contents' : 'none'
|
|
17
|
+
};
|
|
18
|
+
return filterTruthyStyles(composeStyles);
|
|
19
|
+
};
|
|
20
|
+
const getContainStyle = ()=>{
|
|
21
|
+
const composeStyles = {
|
|
22
|
+
'z-index': _const.ELEMENT_Z_INDEX.DIALOG
|
|
23
|
+
};
|
|
24
|
+
return filterTruthyStyles(composeStyles);
|
|
25
|
+
};
|
|
26
|
+
const getBackdropStyle = (style)=>{
|
|
27
|
+
const composeStyles = {
|
|
28
|
+
...common.pointerEventStyle(style)
|
|
29
|
+
};
|
|
30
|
+
return filterTruthyStyles(composeStyles);
|
|
31
|
+
};
|
|
32
|
+
const getOverlayStyle = (overlayOpacity, overlayColor, style)=>{
|
|
33
|
+
const composeStyles = {
|
|
34
|
+
...core.makeStyle({
|
|
35
|
+
op: (overlayOpacity ?? 0) / 100
|
|
36
|
+
}),
|
|
37
|
+
...core.getGlobalColorResponsiveStyle('bgc', {
|
|
38
|
+
desktop: overlayColor
|
|
39
|
+
}),
|
|
40
|
+
...common.getDisplayStyle(style)
|
|
41
|
+
};
|
|
42
|
+
return filterTruthyStyles(composeStyles);
|
|
43
|
+
};
|
|
44
|
+
const getDialogContentStyle = ({ style, width, height, fullScreen })=>{
|
|
45
|
+
const composeStyles = {
|
|
46
|
+
...common.getWrapperDialogStyle(style),
|
|
47
|
+
...common.getBorderStyle(style),
|
|
48
|
+
...common.getDisplayStyle(style),
|
|
49
|
+
...core.makeStyleResponsive('w', core.makeWidth(width, fullScreen)),
|
|
50
|
+
...common.heightStyle(fullScreen, height)
|
|
51
|
+
};
|
|
52
|
+
return filterTruthyStyles(composeStyles);
|
|
53
|
+
};
|
|
54
|
+
const getButtonContentStyle = (setting)=>{
|
|
55
|
+
const { btnSize, btnBg, btnRounded, btnColor } = setting ?? {};
|
|
56
|
+
const composeStyles = {
|
|
57
|
+
...core.makeStyle({
|
|
58
|
+
w: `${parseInt(btnSize.toString())}px`,
|
|
59
|
+
h: `${parseInt(btnSize.toString())}px`
|
|
60
|
+
}),
|
|
61
|
+
...core.getGlobalColorResponsiveStyle('c', {
|
|
62
|
+
desktop: btnColor
|
|
63
|
+
}),
|
|
64
|
+
...core.getGlobalColorResponsiveStyle('bgc', {
|
|
65
|
+
desktop: btnBg
|
|
66
|
+
}),
|
|
67
|
+
...core.composeRadius({
|
|
68
|
+
normal: btnRounded
|
|
69
|
+
})
|
|
70
|
+
};
|
|
71
|
+
return filterTruthyStyles(composeStyles);
|
|
72
|
+
};
|
|
73
|
+
const getSvgContentStyle = (iconSize)=>{
|
|
74
|
+
let composeStyles = {};
|
|
75
|
+
if (iconSize) {
|
|
76
|
+
composeStyles = {
|
|
77
|
+
...core.makeStyle({
|
|
78
|
+
w: iconSize,
|
|
79
|
+
h: iconSize
|
|
80
|
+
})
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
return filterTruthyStyles(composeStyles);
|
|
84
|
+
};
|
|
85
|
+
const getBodyContentStyle = (setting, style)=>{
|
|
86
|
+
const { fullScreen, height, background } = setting ?? {};
|
|
87
|
+
const composeStyles = {
|
|
88
|
+
...common.getInnerStyle(style),
|
|
89
|
+
...common.removeHeightPercentForContent(common.heightStyle(fullScreen, height)),
|
|
90
|
+
'border-radius': 'inherit',
|
|
91
|
+
...core.getStyleBackgroundByDevice(background, {
|
|
92
|
+
ignoreBackgroundImage: true,
|
|
93
|
+
ignoreBackgroundImageProperties: true,
|
|
94
|
+
ignoreBgAttachment: true
|
|
95
|
+
})
|
|
96
|
+
};
|
|
97
|
+
return filterTruthyStyles(composeStyles);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
exports.getBackdropStyle = getBackdropStyle;
|
|
101
|
+
exports.getBodyContentStyle = getBodyContentStyle;
|
|
102
|
+
exports.getButtonContentStyle = getButtonContentStyle;
|
|
103
|
+
exports.getContainStyle = getContainStyle;
|
|
104
|
+
exports.getDialogContentStyle = getDialogContentStyle;
|
|
105
|
+
exports.getOverlayStyle = getOverlayStyle;
|
|
106
|
+
exports.getSvgContentStyle = getSvgContentStyle;
|
|
107
|
+
exports.getWrapperStyle = getWrapperStyle;
|