@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
|
@@ -19,6 +19,7 @@ const SettingUIV2 = [
|
|
|
19
19
|
'%'
|
|
20
20
|
],
|
|
21
21
|
hideUnit: false,
|
|
22
|
+
fallbackValue: 'Auto',
|
|
22
23
|
linkWithSetting: {
|
|
23
24
|
name: 'globalSize',
|
|
24
25
|
field: 'width'
|
|
@@ -33,21 +34,6 @@ const SettingUIV2 = [
|
|
|
33
34
|
label: 'Full',
|
|
34
35
|
value: '100%',
|
|
35
36
|
showValue: true
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
label: 'Small',
|
|
39
|
-
value: '100px',
|
|
40
|
-
showValue: true
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
label: 'Medium',
|
|
44
|
-
value: '116px',
|
|
45
|
-
showValue: true
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
label: 'Large',
|
|
49
|
-
value: '132px',
|
|
50
|
-
showValue: true
|
|
51
37
|
}
|
|
52
38
|
]
|
|
53
39
|
},
|
|
@@ -67,6 +53,7 @@ const SettingUIV2 = [
|
|
|
67
53
|
'px'
|
|
68
54
|
],
|
|
69
55
|
hideUnit: false,
|
|
56
|
+
fallbackValue: 'Auto',
|
|
70
57
|
linkWithSetting: {
|
|
71
58
|
name: 'globalSize',
|
|
72
59
|
field: 'height'
|
|
@@ -76,21 +63,6 @@ const SettingUIV2 = [
|
|
|
76
63
|
label: 'Fit content',
|
|
77
64
|
value: 'Auto',
|
|
78
65
|
showValue: true
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
label: 'Small',
|
|
82
|
-
value: '28px',
|
|
83
|
-
showValue: true
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
label: 'Medium',
|
|
87
|
-
value: '36px',
|
|
88
|
-
showValue: true
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
label: 'Large',
|
|
92
|
-
value: '44px',
|
|
93
|
-
showValue: true
|
|
94
66
|
}
|
|
95
67
|
]
|
|
96
68
|
},
|
|
@@ -136,15 +108,6 @@ const SettingUIV2 = [
|
|
|
136
108
|
id: 'backgroundColorV2',
|
|
137
109
|
state: 'normal'
|
|
138
110
|
}
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
label: {
|
|
142
|
-
en: 'Image'
|
|
143
|
-
},
|
|
144
|
-
setting: {
|
|
145
|
-
id: 'backgroundImage',
|
|
146
|
-
state: 'normal'
|
|
147
|
-
}
|
|
148
111
|
}
|
|
149
112
|
]
|
|
150
113
|
},
|
|
@@ -203,7 +166,7 @@ const SettingUIV2 = [
|
|
|
203
166
|
},
|
|
204
167
|
{
|
|
205
168
|
label: {
|
|
206
|
-
en: '
|
|
169
|
+
en: 'Icon'
|
|
207
170
|
},
|
|
208
171
|
setting: {
|
|
209
172
|
id: 'iconSvg'
|
|
@@ -223,7 +186,7 @@ const SettingUIV2 = [
|
|
|
223
186
|
{
|
|
224
187
|
type: 'control',
|
|
225
188
|
label: {
|
|
226
|
-
en: '
|
|
189
|
+
en: 'Text & icon gap'
|
|
227
190
|
},
|
|
228
191
|
setting: {
|
|
229
192
|
id: 'iconSpacing'
|
|
@@ -289,15 +252,6 @@ const SettingUIV2 = [
|
|
|
289
252
|
state: 'hover'
|
|
290
253
|
}
|
|
291
254
|
},
|
|
292
|
-
{
|
|
293
|
-
label: {
|
|
294
|
-
en: 'BG image'
|
|
295
|
-
},
|
|
296
|
-
setting: {
|
|
297
|
-
id: 'backgroundImage',
|
|
298
|
-
state: 'hover'
|
|
299
|
-
}
|
|
300
|
-
},
|
|
301
255
|
{
|
|
302
256
|
label: {
|
|
303
257
|
en: 'Text color'
|
|
@@ -1,433 +1,148 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import {
|
|
4
|
-
import { useMemo, useRef, useState, useCallback, useEffect } from 'react';
|
|
5
|
-
import { isShowModal, isMobile, heightStyle, removeHeightPercentForContent, inheritStyleBody, bodyDialogClass } from '../helpers/common.js';
|
|
6
|
-
import { useScrollPercentage } from '../hooks/use-scroll-percentage.js';
|
|
3
|
+
import { useEditorMode, isEmptyChildren, filterToolbarPreview } from '@gem-sdk/core';
|
|
7
4
|
import ChildrenDroppable from '../../grid/components/ChildrenDroppable.js';
|
|
8
|
-
import {
|
|
5
|
+
import { useDialog } from './hooks/useDialog.js';
|
|
6
|
+
import { createAttr, createStyle, createClass, If } from '@gem-sdk/system';
|
|
7
|
+
import { getAttr, getAttrContainer, getAttrOverlay, getAttrClose } from './common/getAttr.js';
|
|
8
|
+
import { getWrapperStyle, getContainStyle, getBackdropStyle, getOverlayStyle, getDialogContentStyle, getButtonContentStyle, getSvgContentStyle, getBodyContentStyle } from './common/getStyle.js';
|
|
9
|
+
import { getWrapperClasses, getContainClasses, getBackdropClasses, getOverlayClasses, getDialogContentClasses, getHeadContentClasses, getButtonContentClasses, getBodyContentClasses } from './common/getClasses.js';
|
|
9
10
|
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
};
|
|
15
|
-
const createDialogKey = (uid = '', type = '')=>({
|
|
16
|
-
id: `dialog:${uid}:${type}`,
|
|
17
|
-
time: `dialog:${uid}:${type}:time`
|
|
18
|
-
});
|
|
19
|
-
const Dialog = ({ setting, children, builderProps, builderAttrs, style })=>{
|
|
20
|
-
const { frequency = 3, triggerPercentage = 0, frequencyMode = 'once' } = setting ?? {};
|
|
21
|
-
const { dialogId, trigger, triggerTime, name, mobileTrigger, mobileTriggerTime } = setting ?? {};
|
|
22
|
-
const { fullScreen, width, height, position, effectType, background } = setting ?? {};
|
|
23
|
-
const { btnBg, btnColor, btnSize, iconSize, closeButtonPosition, btnRounded } = setting ?? {};
|
|
24
|
-
const { isOverlay, overlayColor, overlayOpacity, closeOnClickOutside } = setting ?? {};
|
|
25
|
-
const dialogInfo = useMemo(()=>createDialogKey(dialogId ?? builderProps?.uid, trigger), [
|
|
26
|
-
builderProps?.uid,
|
|
27
|
-
dialogId,
|
|
28
|
-
trigger
|
|
29
|
-
]);
|
|
30
|
-
const activeId = useModalStore((s)=>s.activeId);
|
|
31
|
-
const setModalActive = useModalStore((s)=>s.setModalActive);
|
|
32
|
-
const clearModal = useModalStore((s)=>s.clearModal);
|
|
11
|
+
const Dialog = (props)=>{
|
|
12
|
+
const { setting, children, builderProps, style, advanced, builderAttrs } = props;
|
|
13
|
+
const display = advanced?.d;
|
|
14
|
+
const { name, fullScreen, width, height, position, overlayColor, overlayOpacity, iconSize, closeButtonPosition } = setting ?? {};
|
|
33
15
|
const mode = useEditorMode();
|
|
34
|
-
const
|
|
35
|
-
const overlay = useRef(null);
|
|
36
|
-
const triggerScroll = useRef(false);
|
|
37
|
-
const opened = useRef(false);
|
|
38
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
39
|
-
const percent = useScrollPercentage();
|
|
40
|
-
const forceOpen = activeId === builderProps?.uid;
|
|
41
|
-
const open = mode === 'edit' ? forceOpen : isOpen;
|
|
16
|
+
const { ref, overlay, handleClickOverlay, closeModal, open, dialogId } = useDialog(setting, builderProps, mode === 'edit');
|
|
42
17
|
const enableEffect = open;
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
case 'once':
|
|
118
|
-
break;
|
|
119
|
-
case 'after-period-time':
|
|
120
|
-
{
|
|
121
|
-
const diff = isShowModal(currentFrequency, frequency);
|
|
122
|
-
if (diff) {
|
|
123
|
-
openModal();
|
|
124
|
-
}
|
|
125
|
-
break;
|
|
126
|
-
}
|
|
127
|
-
case 'every':
|
|
128
|
-
{
|
|
129
|
-
openModal();
|
|
130
|
-
break;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}, [
|
|
135
|
-
dialogInfo.time,
|
|
136
|
-
frequency,
|
|
137
|
-
openModal,
|
|
138
|
-
frequencyMode
|
|
139
|
-
]);
|
|
140
|
-
const onMouseLeave = useCallback(()=>{
|
|
141
|
-
if (opened.current || mode === 'edit' || trigger !== 'show-when-about-exit') return;
|
|
142
|
-
handleShowModal();
|
|
143
|
-
}, [
|
|
144
|
-
handleShowModal,
|
|
145
|
-
mode,
|
|
146
|
-
trigger
|
|
147
|
-
]);
|
|
148
|
-
useEffect(()=>{
|
|
149
|
-
const selector = `[data-id="${builderProps?.uid}"]`;
|
|
150
|
-
if (!onListener) {
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
onListener({
|
|
154
|
-
event: 'gp:toggle-popup-open',
|
|
155
|
-
selector
|
|
156
|
-
}, ()=>{
|
|
157
|
-
openModal();
|
|
158
|
-
});
|
|
159
|
-
onListener({
|
|
160
|
-
event: 'gp:toggle-popup-close',
|
|
161
|
-
selector
|
|
162
|
-
}, ()=>{
|
|
163
|
-
closeModal();
|
|
164
|
-
});
|
|
165
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
166
|
-
}, [
|
|
167
|
-
onListener
|
|
168
|
-
]);
|
|
169
|
-
useEffect(()=>{
|
|
170
|
-
document.addEventListener('mouseleave', onMouseLeave);
|
|
171
|
-
return ()=>{
|
|
172
|
-
document.removeEventListener('mouseleave', onMouseLeave);
|
|
173
|
-
};
|
|
174
|
-
}, [
|
|
175
|
-
onMouseLeave
|
|
176
|
-
]);
|
|
177
|
-
useEffect(()=>{
|
|
178
|
-
if (opened.current) return;
|
|
179
|
-
if (isMobile(navigator.userAgent) && trigger === 'show-when-about-exit' && mobileTrigger === 'timer') {
|
|
180
|
-
timeoutRef.current = setTimeout(()=>{
|
|
181
|
-
handleShowModal();
|
|
182
|
-
}, (mobileTriggerTime ?? 0) * 1000);
|
|
183
|
-
return ()=>{
|
|
184
|
-
clearTimeout(timeoutRef.current);
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
}, [
|
|
188
|
-
mobileTrigger,
|
|
189
|
-
mobileTriggerTime,
|
|
190
|
-
handleShowModal,
|
|
191
|
-
trigger
|
|
192
|
-
]);
|
|
193
|
-
useEffect(()=>{
|
|
194
|
-
if (triggerScroll.current) return;
|
|
195
|
-
if (trigger === 'show-after-scroll') {
|
|
196
|
-
if (percent >= triggerPercentage) {
|
|
197
|
-
triggerScroll.current = true;
|
|
198
|
-
handleShowModal();
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}, [
|
|
202
|
-
percent,
|
|
203
|
-
triggerPercentage,
|
|
204
|
-
handleShowModal,
|
|
205
|
-
trigger
|
|
206
|
-
]);
|
|
207
|
-
const handleClickOverlay = useCallback((e)=>{
|
|
208
|
-
const isClickOutside = e.target === overlay.current;
|
|
209
|
-
if (closeOnClickOutside && isClickOutside) {
|
|
210
|
-
closeModal();
|
|
211
|
-
}
|
|
212
|
-
}, [
|
|
213
|
-
closeModal,
|
|
214
|
-
closeOnClickOutside
|
|
215
|
-
]);
|
|
216
|
-
useEffect(()=>{
|
|
217
|
-
switch(trigger){
|
|
218
|
-
case 'show-on-page-load':
|
|
219
|
-
handleShowModal();
|
|
220
|
-
break;
|
|
221
|
-
case 'show-after-time':
|
|
222
|
-
{
|
|
223
|
-
timeoutRef.current = setTimeout(()=>{
|
|
224
|
-
handleShowModal();
|
|
225
|
-
}, parseNumber(triggerTime) * 1000);
|
|
226
|
-
break;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
return ()=>{
|
|
230
|
-
clearTimeout(timeoutRef.current);
|
|
231
|
-
};
|
|
232
|
-
}, [
|
|
233
|
-
handleShowModal,
|
|
234
|
-
trigger,
|
|
235
|
-
triggerTime
|
|
236
|
-
]);
|
|
237
|
-
const w = makeWidth(width, fullScreen);
|
|
238
|
-
const displayStyle = useMemo(()=>{
|
|
239
|
-
return Object.keys(style ?? {}).filter((key)=>[
|
|
240
|
-
'--d',
|
|
241
|
-
'--d-mobile',
|
|
242
|
-
'--d-tablet'
|
|
243
|
-
].includes(key)).reduce((curr, key)=>({
|
|
244
|
-
...curr,
|
|
245
|
-
[key]: style?.[key]
|
|
246
|
-
}), {});
|
|
247
|
-
}, [
|
|
248
|
-
style
|
|
249
|
-
]);
|
|
250
|
-
const borderStyle = useMemo(()=>{
|
|
251
|
-
return Object.keys(style ?? {}).filter((key)=>[
|
|
252
|
-
'--bw',
|
|
253
|
-
'--bw-mobile',
|
|
254
|
-
'--bw-tablet',
|
|
255
|
-
'--bc',
|
|
256
|
-
'--bc-tablet',
|
|
257
|
-
'--bc-mobile',
|
|
258
|
-
'--b',
|
|
259
|
-
'--b-tablet',
|
|
260
|
-
'--b-mobile',
|
|
261
|
-
'--bs',
|
|
262
|
-
'--bs-tablet',
|
|
263
|
-
'--bs-mobile',
|
|
264
|
-
'--radius',
|
|
265
|
-
'--radius-tablet',
|
|
266
|
-
'--radius-mobile',
|
|
267
|
-
'--bblr',
|
|
268
|
-
'--bbrr',
|
|
269
|
-
'--btlr',
|
|
270
|
-
'--btrr',
|
|
271
|
-
'--bblr-tablet',
|
|
272
|
-
'--bbrr-tablet',
|
|
273
|
-
'--btlr-tablet',
|
|
274
|
-
'--btrr-tablet',
|
|
275
|
-
'--bblr-mobile',
|
|
276
|
-
'--bbrr-mobile',
|
|
277
|
-
'--btlr-mobile',
|
|
278
|
-
'--btrr-mobile'
|
|
279
|
-
].includes(key)).reduce((curr, key)=>({
|
|
280
|
-
...curr,
|
|
281
|
-
[key]: style?.[key]
|
|
282
|
-
}), {});
|
|
283
|
-
}, [
|
|
284
|
-
style
|
|
285
|
-
]);
|
|
286
|
-
const wrapperStyle = useMemo(()=>{
|
|
287
|
-
return Object.keys(style ?? {}).filter((key)=>key.startsWith('--mt') || key.startsWith('--mb') || key.startsWith('--ml') || key.startsWith('--mr')).reduce((curr, key)=>({
|
|
288
|
-
...curr,
|
|
289
|
-
[key]: style?.[key]
|
|
290
|
-
}), {});
|
|
291
|
-
}, [
|
|
292
|
-
style
|
|
293
|
-
]);
|
|
294
|
-
const innerStyle = useMemo(()=>{
|
|
295
|
-
return Object.keys(style ?? {}).filter((key)=>!Object.keys(wrapperStyle).includes(key) && !Object.keys(displayStyle).includes(key) && !Object.keys(borderStyle).includes(key)).reduce((curr, key)=>({
|
|
296
|
-
...curr,
|
|
297
|
-
[key]: style?.[key]
|
|
298
|
-
}), {});
|
|
299
|
-
}, [
|
|
300
|
-
style,
|
|
301
|
-
wrapperStyle,
|
|
302
|
-
displayStyle,
|
|
303
|
-
borderStyle
|
|
304
|
-
]);
|
|
305
|
-
const pointerEventStyle = useMemo(()=>{
|
|
306
|
-
return Object.keys(style ?? {}).filter((key)=>[
|
|
307
|
-
'--d',
|
|
308
|
-
'--d-mobile',
|
|
309
|
-
'--d-tablet'
|
|
310
|
-
].includes(key)).reduce((curr, key)=>({
|
|
311
|
-
...curr,
|
|
312
|
-
[key.replace('--d', '--pe')]: style?.[key] === 'none' ? 'none' : 'auto'
|
|
313
|
-
}), {});
|
|
314
|
-
}, [
|
|
315
|
-
style
|
|
316
|
-
]);
|
|
18
|
+
const isILP = mode !== 'edit';
|
|
19
|
+
const attrs = createAttr({
|
|
20
|
+
...getAttr({
|
|
21
|
+
uid: builderProps?.uid || ''
|
|
22
|
+
})
|
|
23
|
+
});
|
|
24
|
+
const wrapperDialogStyle = createStyle({
|
|
25
|
+
...getWrapperStyle(display)
|
|
26
|
+
});
|
|
27
|
+
const wrapperClasses = createClass({
|
|
28
|
+
...getWrapperClasses()
|
|
29
|
+
});
|
|
30
|
+
const containClasses = createClass({
|
|
31
|
+
...getContainClasses(advanced?.cssClass)
|
|
32
|
+
});
|
|
33
|
+
const containAttrs = createAttr({
|
|
34
|
+
...getAttrContainer({
|
|
35
|
+
uid: dialogId || ''
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
const containStyle = createStyle({
|
|
39
|
+
...getContainStyle()
|
|
40
|
+
});
|
|
41
|
+
const backdropClasses = createClass({
|
|
42
|
+
...getBackdropClasses(position)
|
|
43
|
+
});
|
|
44
|
+
const backdropStyle = createStyle({
|
|
45
|
+
...getBackdropStyle(style)
|
|
46
|
+
});
|
|
47
|
+
const overlayAttrs = createAttr({
|
|
48
|
+
...getAttrOverlay()
|
|
49
|
+
});
|
|
50
|
+
const overlayClasses = createClass({
|
|
51
|
+
...getOverlayClasses()
|
|
52
|
+
});
|
|
53
|
+
const overlayStyle = createStyle({
|
|
54
|
+
...getOverlayStyle(overlayOpacity, overlayColor, style)
|
|
55
|
+
});
|
|
56
|
+
const dialogContentStyle = createStyle({
|
|
57
|
+
...getDialogContentStyle({
|
|
58
|
+
style,
|
|
59
|
+
width,
|
|
60
|
+
height,
|
|
61
|
+
fullScreen
|
|
62
|
+
})
|
|
63
|
+
});
|
|
64
|
+
const dialogContentClasses = createClass({
|
|
65
|
+
...getDialogContentClasses({
|
|
66
|
+
setting,
|
|
67
|
+
enableEffect,
|
|
68
|
+
isILP
|
|
69
|
+
})
|
|
70
|
+
});
|
|
71
|
+
const closeAttrs = createAttr({
|
|
72
|
+
...getAttrClose()
|
|
73
|
+
});
|
|
74
|
+
const headContentClasses = createClass({
|
|
75
|
+
...getHeadContentClasses()
|
|
76
|
+
});
|
|
77
|
+
const buttonContentStyle = createStyle({
|
|
78
|
+
...getButtonContentStyle(setting)
|
|
79
|
+
});
|
|
80
|
+
const buttonContentClasses = createClass({
|
|
81
|
+
...getButtonContentClasses(closeButtonPosition)
|
|
82
|
+
});
|
|
83
|
+
const svgContentStyle = createStyle({
|
|
84
|
+
...getSvgContentStyle(iconSize)
|
|
85
|
+
});
|
|
86
|
+
const bodyContentStyle = createStyle({
|
|
87
|
+
...getBodyContentStyle(setting, style)
|
|
88
|
+
});
|
|
89
|
+
const bodyContentClasses = createClass({
|
|
90
|
+
...getBodyContentClasses()
|
|
91
|
+
});
|
|
317
92
|
return /*#__PURE__*/ jsx("div", {
|
|
318
|
-
|
|
93
|
+
...attrs,
|
|
94
|
+
className: wrapperClasses,
|
|
95
|
+
style: wrapperDialogStyle,
|
|
319
96
|
children: (open || mode !== 'edit') && /*#__PURE__*/ jsx("dialog", {
|
|
320
97
|
ref: ref,
|
|
321
|
-
"data-id": builderProps?.uid,
|
|
322
98
|
open: open,
|
|
323
|
-
className: "gp-dialog gp-bg-transparent",
|
|
324
99
|
"aria-label": name,
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
100
|
+
...containAttrs,
|
|
101
|
+
className: containClasses,
|
|
102
|
+
style: containStyle,
|
|
328
103
|
children: /*#__PURE__*/ jsxs("div", {
|
|
329
104
|
"aria-label": "Backdrop",
|
|
330
|
-
className:
|
|
331
|
-
|
|
332
|
-
'gp-items-start gp-justify-center': position === 'top',
|
|
333
|
-
'gp-items-start gp-justify-end': position === 'top-right',
|
|
334
|
-
'gp-items-start gp-justify-start': position === 'top-left',
|
|
335
|
-
'gp-items-end gp-justify-center': position === 'bottom',
|
|
336
|
-
'gp-items-center gp-justify-start': position === 'left',
|
|
337
|
-
'gp-items-center gp-justify-end': position === 'right',
|
|
338
|
-
'gp-items-end gp-justify-start': position === 'bottom-left',
|
|
339
|
-
'gp-items-end gp-justify-end': position === 'bottom-right'
|
|
340
|
-
}),
|
|
341
|
-
style: pointerEventStyle,
|
|
105
|
+
className: backdropClasses,
|
|
106
|
+
style: backdropStyle,
|
|
342
107
|
children: [
|
|
343
|
-
|
|
108
|
+
If(!!overlayColor, /*#__PURE__*/ jsx("div", {
|
|
344
109
|
ref: overlay,
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
op: (overlayOpacity ?? 0) / 100
|
|
349
|
-
}),
|
|
350
|
-
...getGlobalColorResponsiveStyle('bgc', {
|
|
351
|
-
desktop: overlayColor
|
|
352
|
-
}),
|
|
353
|
-
...displayStyle
|
|
354
|
-
},
|
|
110
|
+
...overlayAttrs,
|
|
111
|
+
className: overlayClasses,
|
|
112
|
+
style: overlayStyle,
|
|
355
113
|
onClick: handleClickOverlay,
|
|
356
114
|
"aria-hidden": true
|
|
357
|
-
}),
|
|
115
|
+
})),
|
|
358
116
|
/*#__PURE__*/ jsx("span", {
|
|
359
|
-
className:
|
|
117
|
+
className: headContentClasses
|
|
360
118
|
}),
|
|
361
119
|
/*#__PURE__*/ jsxs("div", {
|
|
362
|
-
...builderAttrs,
|
|
363
120
|
role: "dialog",
|
|
364
121
|
"aria-label": "Dialog content",
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
'gp-animate-[zoomOut_0.3s_ease-in]': effectType === 'zoom-out' && enableEffect,
|
|
369
|
-
'gp-animate-[slideInLeft_0.3s_ease-in]': effectType === 'horizontal' && enableEffect,
|
|
370
|
-
'gp-animate-[slideInUp_0.3s_ease-in]': effectType === 'vertical' && enableEffect,
|
|
371
|
-
'gp-animate-[unfold_0.3s_ease-in-out]': effectType === 'unfold' && enableEffect,
|
|
372
|
-
'gp-animate-[fadeOut_0.2s_ease-out]': !open && mode !== 'edit',
|
|
373
|
-
'gp-overflow-hidden': closeButtonPosition !== 'outside'
|
|
374
|
-
}),
|
|
375
|
-
style: {
|
|
376
|
-
...wrapperStyle,
|
|
377
|
-
...displayStyle,
|
|
378
|
-
...borderStyle,
|
|
379
|
-
...makeStyleResponsive('w', w),
|
|
380
|
-
...heightStyle(fullScreen, height)
|
|
381
|
-
},
|
|
122
|
+
...builderAttrs,
|
|
123
|
+
className: dialogContentClasses,
|
|
124
|
+
style: dialogContentStyle,
|
|
382
125
|
children: [
|
|
383
126
|
/*#__PURE__*/ jsx("button", {
|
|
384
|
-
|
|
127
|
+
...closeAttrs,
|
|
128
|
+
type: "button",
|
|
385
129
|
tabIndex: -1,
|
|
386
|
-
className:
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
style: {
|
|
390
|
-
...makeStyle({
|
|
391
|
-
w: `${parseInt(btnSize.toString())}px`,
|
|
392
|
-
h: `${parseInt(btnSize.toString())}px`
|
|
393
|
-
}),
|
|
394
|
-
...getGlobalColorResponsiveStyle('c', {
|
|
395
|
-
desktop: btnColor
|
|
396
|
-
}),
|
|
397
|
-
...getGlobalColorResponsiveStyle('bgc', {
|
|
398
|
-
desktop: btnBg
|
|
399
|
-
}),
|
|
400
|
-
...composeRadius({
|
|
401
|
-
normal: btnRounded
|
|
402
|
-
})
|
|
403
|
-
},
|
|
130
|
+
className: buttonContentClasses,
|
|
131
|
+
style: buttonContentStyle,
|
|
132
|
+
onClick: closeModal,
|
|
404
133
|
children: /*#__PURE__*/ jsx("svg", {
|
|
405
134
|
viewBox: "0 0 12 12",
|
|
406
135
|
fill: "currentColor",
|
|
407
|
-
style:
|
|
408
|
-
...makeStyle({
|
|
409
|
-
w: iconSize,
|
|
410
|
-
h: iconSize
|
|
411
|
-
})
|
|
412
|
-
},
|
|
136
|
+
style: svgContentStyle,
|
|
413
137
|
children: /*#__PURE__*/ jsx("path", {
|
|
414
138
|
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"
|
|
415
139
|
})
|
|
416
140
|
})
|
|
417
141
|
}),
|
|
418
142
|
/*#__PURE__*/ jsx("div", {
|
|
419
|
-
style: {
|
|
420
|
-
...innerStyle,
|
|
421
|
-
...removeHeightPercentForContent(heightStyle(fullScreen, height)),
|
|
422
|
-
...inheritStyleBody,
|
|
423
|
-
...getStyleBackgroundByDevice(background, {
|
|
424
|
-
ignoreBackgroundImage: true,
|
|
425
|
-
ignoreBackgroundImageProperties: true,
|
|
426
|
-
ignoreBgAttachment: true
|
|
427
|
-
})
|
|
428
|
-
},
|
|
429
143
|
"aria-label": "Dialog body",
|
|
430
|
-
|
|
144
|
+
style: bodyContentStyle,
|
|
145
|
+
className: bodyContentClasses,
|
|
431
146
|
children: isEmptyChildren(children) ? /*#__PURE__*/ jsx(ChildrenDroppable, {}) : filterToolbarPreview(children)
|
|
432
147
|
}),
|
|
433
148
|
filterToolbarPreview(children, true)
|