@developer_tribe/react-builder 1.2.7 → 1.2.9
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/AttributesEditor.d.ts +2 -11
- package/dist/attribute-analyser/style/native/useExtractImageStyle.d.ts +10 -0
- package/dist/attribute-analyser/style/native/useExtractTextStyle.d.ts +9 -0
- package/dist/attribute-analyser/style/native/useExtractViewStyle.d.ts +8 -0
- package/dist/attribute-analyser/style/web/useExtractImageStyle.d.ts +4 -0
- package/dist/attribute-analyser/style/web/useExtractTextStyle.d.ts +4 -0
- package/dist/attribute-analyser/style/web/useExtractViewStyle.d.ts +4 -0
- package/dist/attributes-editor/AttributesEditorFields.d.ts +18 -0
- package/dist/attributes-editor/AttributesEditorView.d.ts +4 -0
- package/dist/attributes-editor/attributesEditorModelTypes.d.ts +67 -0
- package/dist/attributes-editor/attributesEditorUtils.d.ts +19 -0
- package/dist/attributes-editor/useAttributesEditorModel.d.ts +2 -0
- package/dist/build-components/BIcon/BIconProps.generated.d.ts +41 -38
- package/dist/build-components/BackgroundImage/BackgroundImageProps.generated.d.ts +37 -34
- package/dist/build-components/Button/ButtonProps.generated.d.ts +39 -36
- package/dist/build-components/Carousel/CarouselProps.generated.d.ts +37 -34
- package/dist/build-components/CarouselButtons/CarouselButtonsProps.generated.d.ts +37 -34
- package/dist/build-components/CarouselDots/CarouselDotsProps.generated.d.ts +37 -34
- package/dist/build-components/CarouselItem/CarouselItemProps.generated.d.ts +36 -33
- package/dist/build-components/CarouselProvider/CarouselProviderProps.generated.d.ts +36 -33
- package/dist/build-components/Image/ImageProps.generated.d.ts +38 -33
- package/dist/build-components/Main/MainProps.generated.d.ts +36 -33
- package/dist/build-components/Onboard/OnboardProps.generated.d.ts +36 -33
- package/dist/build-components/OnboardButton/OnboardButtonProps.generated.d.ts +38 -34
- package/dist/build-components/OnboardButtons/OnboardButtonsProps.generated.d.ts +39 -36
- package/dist/build-components/OnboardDot/OnboardDotProps.generated.d.ts +43 -34
- package/dist/build-components/OnboardFooter/OnboardFooterProps.generated.d.ts +41 -38
- package/dist/build-components/OnboardImage/OnboardImageProps.generated.d.ts +36 -31
- package/dist/build-components/OnboardItem/OnboardItemProps.generated.d.ts +39 -33
- package/dist/build-components/OnboardProvider/OnboardProviderProps.generated.d.ts +38 -34
- package/dist/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.d.ts +41 -38
- package/dist/build-components/OnboardTitle/OnboardTitleProps.generated.d.ts +41 -38
- package/dist/build-components/PaywallBackground/PaywallBackgroundProps.generated.d.ts +36 -33
- package/dist/build-components/PaywallCloseButton/PaywallCloseButtonProps.generated.d.ts +41 -38
- package/dist/build-components/PaywallOptions/PaywallOptionsProps.generated.d.ts +36 -33
- package/dist/build-components/PaywallProvider/PaywallProviderProps.generated.d.ts +36 -33
- package/dist/build-components/PaywallSubscribeButton/PaywallSubscribeButtonProps.generated.d.ts +39 -36
- package/dist/build-components/RadioButton/RadioButtonProps.generated.d.ts +36 -33
- package/dist/build-components/Text/TextProps.generated.d.ts +41 -38
- package/dist/build-components/View/ViewProps.generated.d.ts +36 -33
- package/dist/build-components/patterns.generated.d.ts +2673 -5787
- package/dist/components/BuilderProvider.d.ts +6 -0
- package/dist/index.cjs.js +5 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +5 -26
- package/dist/index.esm.js +5 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.cjs.js +6 -4
- package/dist/index.native.cjs.js.map +1 -1
- package/dist/index.native.d.ts +6 -3
- package/dist/index.native.esm.js +6 -4
- package/dist/index.native.esm.js.map +1 -1
- package/dist/migrations/migratePipe.d.ts +1 -1
- package/dist/migrations/migrations/1.1.2_extract_component_attributes_from_style.d.ts +2 -0
- package/dist/mockOS/components/PermissionModal.d.ts +1 -2
- package/dist/styles.css +1 -1
- package/dist/types/PreviewConfig.d.ts +1 -5
- package/dist/utils/extractImageStyle.d.ts +3 -0
- package/dist/utils/extractTextStyle/extractTextStyleNative.d.ts +17 -0
- package/dist/utils/extractTextStyle.d.ts +2 -0
- package/dist/utils/extractViewStyle/extractViewStyleNative.d.ts +12 -0
- package/dist/utils/extractViewStyle.d.ts +2 -0
- package/dist/utils/getMeta.d.ts +5 -0
- package/dist/utils/patterns.d.ts +14 -1
- package/package.json +2 -1
- package/scripts/prebuild/prebuild.js +14 -0
- package/scripts/prebuild/utils/createGeneratedProps.js +51 -3
- package/scripts/prebuild/utils/index.js +1 -0
- package/scripts/prebuild/utils/updateMetaJson.js +66 -0
- package/scripts/prebuild/utils/validateAllComponentsOrThrow.js +37 -3
- package/scripts/prebuild/utils/validatePatternJson.js +27 -2
- package/scripts/public/scripts/build/index.js +20 -3
- package/scripts/public/scripts/build/info.json +6 -0
- package/scripts/public/scripts/build/utils/createComponentsIndex.js +9 -3
- package/scripts/public/scripts/build/utils/createRenderNodeGenerated.js +66 -8
- package/src/AttributesEditor.tsx +8 -944
- package/src/assets/meta.json +4 -0
- package/src/assets/samples/carousel-sample.json +1 -1
- package/src/assets/samples/getSamples.ts +2 -0
- package/src/assets/samples/paywall-1.json +11 -7
- package/src/assets/samples/simple-1.json +3 -3
- package/src/assets/samples/simple-2.json +3 -3
- package/src/assets/samples/unmigrated-builder-1.1.1.json +87 -0
- package/src/assets/samples/unmigrated-builder1.json +1 -1
- package/src/assets/samples/unvalidated-builder1.json +3 -3
- package/src/assets/samples/unvalidated-crash1.json +1 -1
- package/src/assets/samples/unvalidated-crashcomponent1.json +1 -1
- package/src/assets/samples/vpn-onboard-1.json +1 -1
- package/src/assets/samples/vpn-onboard-2.json +1 -1
- package/src/assets/samples/vpn-onboard-3.json +1 -1
- package/src/assets/samples/vpn-onboard-4.json +1 -1
- package/src/assets/samples/vpn-onboard-5.json +1 -1
- package/src/assets/samples/vpn-onboard-6.json +1 -1
- package/src/attribute-analyser/style/native/useExtractImageStyle.ts +46 -0
- package/src/attribute-analyser/style/native/useExtractTextStyle.ts +50 -0
- package/src/attribute-analyser/style/native/useExtractViewStyle.ts +32 -0
- package/src/attribute-analyser/style/web/useExtractImageStyle.ts +20 -0
- package/src/{hooks → attribute-analyser/style/web}/useExtractTextStyle.ts +7 -6
- package/src/{hooks → attribute-analyser/style/web}/useExtractViewStyle.ts +7 -6
- package/src/attributes-editor/AttributesEditorFields.tsx +248 -0
- package/src/attributes-editor/AttributesEditorView.tsx +360 -0
- package/src/attributes-editor/LayoutPreviewPicker.tsx +4 -3
- package/src/attributes-editor/attributesEditorModelTypes.ts +86 -0
- package/src/attributes-editor/attributesEditorUtils.ts +102 -0
- package/src/attributes-editor/useAttributesEditorModel.ts +477 -0
- package/src/build-components/BIcon/BIcon.tsx +4 -3
- package/src/build-components/BIcon/BIconProps.generated.ts +42 -38
- package/src/build-components/BIcon/pattern.json +5 -6
- package/src/build-components/BackgroundImage/BackgroundImage.tsx +7 -4
- package/src/build-components/BackgroundImage/BackgroundImageProps.generated.ts +38 -34
- package/src/build-components/BackgroundImage/pattern.json +9 -17
- package/src/build-components/Button/Button.tsx +7 -6
- package/src/build-components/Button/ButtonProps.generated.ts +40 -36
- package/src/build-components/Button/pattern.json +17 -15
- package/src/build-components/Carousel/Carousel.tsx +1 -1
- package/src/build-components/Carousel/CarouselProps.generated.ts +38 -34
- package/src/build-components/CarouselButtons/CarouselButtons.tsx +4 -6
- package/src/build-components/CarouselButtons/CarouselButtonsProps.generated.ts +41 -37
- package/src/build-components/CarouselButtons/pattern.json +2 -1
- package/src/build-components/CarouselDots/CarouselDots.tsx +2 -2
- package/src/build-components/CarouselDots/CarouselDotsProps.generated.ts +44 -40
- package/src/build-components/CarouselItem/CarouselItem.tsx +1 -1
- package/src/build-components/CarouselItem/CarouselItemProps.generated.ts +37 -33
- package/src/build-components/CarouselProvider/CarouselProvider.tsx +1 -1
- package/src/build-components/CarouselProvider/CarouselProviderProps.generated.ts +37 -33
- package/src/build-components/Image/Image.tsx +4 -3
- package/src/build-components/Image/ImageProps.generated.ts +39 -33
- package/src/build-components/Image/pattern.json +5 -11
- package/src/build-components/Main/Main.tsx +1 -1
- package/src/build-components/Main/MainProps.generated.ts +37 -33
- package/src/build-components/Main/pattern.json +2 -1
- package/src/build-components/Onboard/OnboardProps.generated.ts +37 -33
- package/src/build-components/OnboardButton/OnboardButton.tsx +8 -6
- package/src/build-components/OnboardButton/OnboardButtonProps.generated.ts +44 -39
- package/src/build-components/OnboardButton/pattern.json +9 -7
- package/src/build-components/OnboardButtons/OnboardButtons.tsx +31 -31
- package/src/build-components/OnboardButtons/OnboardButtonsProps.generated.ts +43 -39
- package/src/build-components/OnboardButtons/pattern.json +9 -7
- package/src/build-components/OnboardDot/OnboardDot.tsx +7 -5
- package/src/build-components/OnboardDot/OnboardDotProps.generated.ts +55 -34
- package/src/build-components/OnboardFooter/OnboardFooter.tsx +19 -23
- package/src/build-components/OnboardFooter/OnboardFooterProps.generated.ts +42 -38
- package/src/build-components/OnboardFooter/pattern.json +16 -14
- package/src/build-components/OnboardImage/OnboardImage.tsx +8 -7
- package/src/build-components/OnboardImage/OnboardImageProps.generated.ts +37 -31
- package/src/build-components/OnboardImage/pattern.json +2 -1
- package/src/build-components/OnboardItem/OnboardItem.tsx +1 -1
- package/src/build-components/OnboardItem/OnboardItemProps.generated.ts +40 -33
- package/src/build-components/OnboardItem/pattern.json +2 -1
- package/src/build-components/OnboardProvider/OnboardProvider.tsx +1 -1
- package/src/build-components/OnboardProvider/OnboardProviderProps.generated.ts +39 -34
- package/src/build-components/OnboardProvider/pattern.json +2 -1
- package/src/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.ts +42 -38
- package/src/build-components/OnboardTitle/OnboardTitleProps.generated.ts +42 -38
- package/src/build-components/PaywallBackground/PaywallBackground.tsx +1 -1
- package/src/build-components/PaywallBackground/PaywallBackgroundProps.generated.ts +37 -33
- package/src/build-components/PaywallCloseButton/PaywallCloseButton.tsx +6 -5
- package/src/build-components/PaywallCloseButton/PaywallCloseButtonProps.generated.ts +42 -38
- package/src/build-components/PaywallOptions/PaywallOptionButton.tsx +1 -1
- package/src/build-components/PaywallOptions/PaywallOptionsProps.generated.ts +37 -33
- package/src/build-components/PaywallProvider/PaywallProvider.tsx +1 -1
- package/src/build-components/PaywallProvider/PaywallProviderProps.generated.ts +37 -33
- package/src/build-components/PaywallSubscribeButton/PaywallSubscribeButton.tsx +1 -1
- package/src/build-components/PaywallSubscribeButton/PaywallSubscribeButtonProps.generated.ts +40 -36
- package/src/build-components/RadioButton/RadioButton.tsx +5 -4
- package/src/build-components/RadioButton/RadioButtonProps.generated.ts +37 -33
- package/src/build-components/RadioButton/pattern.json +9 -7
- package/src/build-components/Text/Text.tsx +6 -8
- package/src/build-components/Text/TextProps.generated.ts +42 -38
- package/src/build-components/Text/pattern.json +15 -11
- package/src/build-components/View/View.tsx +1 -1
- package/src/build-components/View/ViewProps.generated.ts +37 -33
- package/src/build-components/View/pattern.json +71 -66
- package/src/build-components/patterns.generated.ts +3022 -5971
- package/src/components/AttributesEditorPanel.tsx +2 -2
- package/src/components/BuilderProvider.tsx +15 -1
- package/src/index.native.ts +7 -4
- package/src/index.ts +6 -77
- package/src/migrations/migratePipe.ts +7 -3
- package/src/migrations/migrations/1.1.2_extract_component_attributes_from_style.ts +211 -0
- package/src/mockOS/components/MockOSRouter.tsx +3 -1
- package/src/mockOS/components/PermissionModal.tsx +20 -160
- package/src/mockOS/components/SubscriptionModal.tsx +41 -278
- package/src/pages/ProjectPage.tsx +12 -6
- package/src/styles/components/_attributes-editor.scss +122 -0
- package/src/styles/components/_mockos-router.scss +388 -0
- package/src/styles/components/_onboard.scss +23 -0
- package/src/styles/index.scss +1 -0
- package/src/types/PreviewConfig.ts +1 -5
- package/src/utils/analyseNodeByPatterns.ts +39 -4
- package/src/utils/extractImageStyle.ts +34 -5
- package/src/utils/extractTextStyle/extractTextStyle.ts +7 -6
- package/src/utils/extractTextStyle/extractTextStyleNative.ts +106 -0
- package/src/utils/extractTextStyle.ts +2 -0
- package/src/utils/extractViewStyle/extractViewStyle.ts +2 -4
- package/src/utils/extractViewStyle/extractViewStyleNative.ts +111 -0
- package/src/utils/extractViewStyle.ts +2 -0
- package/src/utils/getMeta.ts +15 -0
- package/src/utils/patterns.ts +100 -3
- package/dist/hooks/useExtractImageStyle.d.ts +0 -3
- package/dist/hooks/useExtractTextStyle.d.ts +0 -3
- package/dist/hooks/useExtractViewStyle.d.ts +0 -3
- package/src/hooks/useExtractImageStyle.ts +0 -19
- package/src/migrations/migrations/1.1.0_normalize_style_attributes.ts +0 -80
|
@@ -4,6 +4,12 @@ import type { NodeData } from '../../types/Node';
|
|
|
4
4
|
|
|
5
5
|
export type TypeOptionType = 'Permission' | 'Navigate';
|
|
6
6
|
export type PermissionOptionType = 'att' | 'notification' | 'rating' | 'GDPR';
|
|
7
|
+
export type AnimationOptionType =
|
|
8
|
+
| 'simple-animation'
|
|
9
|
+
| 'line-animation'
|
|
10
|
+
| 'blur'
|
|
11
|
+
| 'blur-animation'
|
|
12
|
+
| 'blur-line-animation';
|
|
7
13
|
export type FlexDirectionOptionType = 'row' | 'column';
|
|
8
14
|
export type AlignItemsOptionType =
|
|
9
15
|
| 'flex-start'
|
|
@@ -19,12 +25,6 @@ export type JustifyContentOptionType =
|
|
|
19
25
|
| 'space-around'
|
|
20
26
|
| 'space-evenly';
|
|
21
27
|
export type PositionOptionType = 'relative' | 'absolute';
|
|
22
|
-
export type AnimationOptionType =
|
|
23
|
-
| 'simple-animation'
|
|
24
|
-
| 'line-animation'
|
|
25
|
-
| 'blur'
|
|
26
|
-
| 'blur-animation'
|
|
27
|
-
| 'blur-line-animation';
|
|
28
28
|
|
|
29
29
|
export interface EventObjectGenerated {
|
|
30
30
|
type?: TypeOptionType;
|
|
@@ -33,48 +33,53 @@ export interface EventObjectGenerated {
|
|
|
33
33
|
targetIndex?: number;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
export interface OnboardButtonStyleGenerated {
|
|
37
|
+
flexDirection?: FlexDirectionOptionType;
|
|
38
|
+
alignItems?: AlignItemsOptionType;
|
|
39
|
+
justifyContent?: JustifyContentOptionType;
|
|
40
|
+
gap?: string;
|
|
41
|
+
padding?: string;
|
|
42
|
+
paddingHorizontal?: string;
|
|
43
|
+
paddingVertical?: string;
|
|
44
|
+
paddingTop?: string;
|
|
45
|
+
paddingBottom?: string;
|
|
46
|
+
paddingLeft?: string;
|
|
47
|
+
paddingRight?: string;
|
|
48
|
+
margin?: string;
|
|
49
|
+
marginHorizontal?: string;
|
|
50
|
+
marginVertical?: string;
|
|
51
|
+
marginTop?: string;
|
|
52
|
+
marginBottom?: string;
|
|
53
|
+
marginLeft?: string;
|
|
54
|
+
marginRight?: string;
|
|
55
|
+
backgroundColor?: string;
|
|
56
|
+
borderRadius?: string;
|
|
57
|
+
width?: string;
|
|
58
|
+
minWidth?: string;
|
|
59
|
+
maxWidth?: string;
|
|
60
|
+
height?: string;
|
|
61
|
+
minHeight?: string;
|
|
62
|
+
maxHeight?: string;
|
|
63
|
+
flex?: number;
|
|
64
|
+
position?: PositionOptionType;
|
|
65
|
+
top?: string;
|
|
66
|
+
bottom?: string;
|
|
67
|
+
left?: string;
|
|
68
|
+
right?: string;
|
|
69
|
+
zIndex?: number;
|
|
70
|
+
}
|
|
71
|
+
|
|
36
72
|
export interface OnboardButtonPropsGenerated {
|
|
37
73
|
child: string;
|
|
38
74
|
attributes: {
|
|
39
|
-
style?:
|
|
75
|
+
style?: OnboardButtonStyleGenerated;
|
|
40
76
|
scrollable?: boolean;
|
|
41
|
-
flexDirection?: FlexDirectionOptionType;
|
|
42
|
-
alignItems?: AlignItemsOptionType;
|
|
43
|
-
justifyContent?: JustifyContentOptionType;
|
|
44
|
-
gap?: string;
|
|
45
|
-
padding?: string;
|
|
46
|
-
paddingHorizontal?: string;
|
|
47
|
-
paddingVertical?: string;
|
|
48
|
-
paddingTop?: string;
|
|
49
|
-
paddingBottom?: string;
|
|
50
|
-
paddingLeft?: string;
|
|
51
|
-
paddingRight?: string;
|
|
52
|
-
margin?: string;
|
|
53
|
-
marginVertical?: string;
|
|
54
|
-
marginTop?: string;
|
|
55
|
-
marginBottom?: string;
|
|
56
|
-
marginLeft?: string;
|
|
57
|
-
marginRight?: string;
|
|
58
|
-
backgroundColor?: string;
|
|
59
|
-
borderRadius?: string;
|
|
60
|
-
width?: string;
|
|
61
|
-
minWidth?: string;
|
|
62
|
-
maxWidth?: string;
|
|
63
|
-
height?: string;
|
|
64
|
-
minHeight?: string;
|
|
65
|
-
maxHeight?: string;
|
|
66
|
-
flex?: number;
|
|
67
|
-
position?: PositionOptionType;
|
|
68
|
-
top?: string;
|
|
69
|
-
bottom?: string;
|
|
70
|
-
left?: string;
|
|
71
|
-
right?: string;
|
|
72
|
-
zIndex?: number;
|
|
73
77
|
labelKey?: string;
|
|
74
78
|
button_text_color?: string;
|
|
75
79
|
animation?: AnimationOptionType;
|
|
76
80
|
animation_color?: string;
|
|
77
81
|
button_background_color?: string;
|
|
82
|
+
flex?: number;
|
|
78
83
|
events?: EventObjectGenerated[];
|
|
79
84
|
};
|
|
80
85
|
}
|
|
@@ -44,13 +44,6 @@
|
|
|
44
44
|
"label": "Onboard Button",
|
|
45
45
|
"description": "Single action button for onboarding.",
|
|
46
46
|
"styles": {
|
|
47
|
-
"labelKey": {
|
|
48
|
-
"label": "Label Key",
|
|
49
|
-
"description": "Localization key for the button text.",
|
|
50
|
-
"category": "other",
|
|
51
|
-
"specialCategory": null,
|
|
52
|
-
"sort": 1
|
|
53
|
-
},
|
|
54
47
|
"button_text_color": {
|
|
55
48
|
"label": "Button Text Color",
|
|
56
49
|
"description": "Text color of the button.",
|
|
@@ -78,6 +71,15 @@
|
|
|
78
71
|
"category": "style",
|
|
79
72
|
"specialCategory": null,
|
|
80
73
|
"sort": 5
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"attributes": {
|
|
77
|
+
"labelKey": {
|
|
78
|
+
"label": "Label Key",
|
|
79
|
+
"description": "Localization key for the button text.",
|
|
80
|
+
"category": "other",
|
|
81
|
+
"specialCategory": null,
|
|
82
|
+
"sort": 1
|
|
81
83
|
},
|
|
82
84
|
"flex": {
|
|
83
85
|
"label": "Flex",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useContext, useEffect, useId, useState } from 'react';
|
|
1
|
+
import React, { useContext, useEffect, useId, useMemo, useState } from 'react';
|
|
2
2
|
import type { Node } from '../../types/Node';
|
|
3
3
|
import type { OnboardButtonsComponentProps } from './OnboardButtonsProps.generated';
|
|
4
4
|
import { onboardContext } from '../OnboardProvider/OnboardProvider';
|
|
@@ -6,7 +6,7 @@ import RenderNode from '../RenderNode.generated';
|
|
|
6
6
|
import useNode from '../useNode';
|
|
7
7
|
import { useBuilderParams } from '../../components/BuilderProvider';
|
|
8
8
|
import { useLogRender } from '../../utils/useLogRender';
|
|
9
|
-
import { useExtractViewStyle } from '../../
|
|
9
|
+
import { useExtractViewStyle } from '../../attribute-analyser/style/web/useExtractViewStyle';
|
|
10
10
|
|
|
11
11
|
function OnboardButtons({ node }: OnboardButtonsComponentProps) {
|
|
12
12
|
useLogRender('OnboardButtons');
|
|
@@ -26,19 +26,31 @@ function OnboardButtons({ node }: OnboardButtonsComponentProps) {
|
|
|
26
26
|
}
|
|
27
27
|
}, [ctx.selectedIndex]);
|
|
28
28
|
|
|
29
|
+
const attributes = node.attributes as any;
|
|
30
|
+
const styleBag = attributes?.style as Record<string, unknown> | undefined as
|
|
31
|
+
| Record<string, unknown>
|
|
32
|
+
| undefined;
|
|
29
33
|
const direction =
|
|
30
|
-
|
|
34
|
+
(attributes?.buttons_direction ?? (styleBag as any)?.buttons_direction) ===
|
|
35
|
+
'column'
|
|
36
|
+
? 'column'
|
|
37
|
+
: 'row';
|
|
31
38
|
const seperatorColor =
|
|
32
|
-
|
|
39
|
+
attributes?.seperatorColor ??
|
|
40
|
+
(styleBag as any)?.seperatorColor ??
|
|
41
|
+
seperatorColorDefault;
|
|
42
|
+
const buttonsClassName =
|
|
43
|
+
direction === 'column'
|
|
44
|
+
? 'onboard__buttons onboard__buttons--column'
|
|
45
|
+
: 'onboard__buttons onboard__buttons--row';
|
|
33
46
|
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
));
|
|
47
|
+
const children = useMemo(() => {
|
|
48
|
+
const raw = node.children as unknown;
|
|
49
|
+
if (Array.isArray(raw)) {
|
|
50
|
+
return raw as Node[];
|
|
39
51
|
}
|
|
40
|
-
return
|
|
41
|
-
};
|
|
52
|
+
return [raw as Node];
|
|
53
|
+
}, [node.children]);
|
|
42
54
|
|
|
43
55
|
const viewStyle = useExtractViewStyle(node);
|
|
44
56
|
|
|
@@ -47,8 +59,9 @@ function OnboardButtons({ node }: OnboardButtonsComponentProps) {
|
|
|
47
59
|
const generatedId = useId();
|
|
48
60
|
|
|
49
61
|
// New condition logic: hide when condition is carousel-index and does not match
|
|
50
|
-
const condition =
|
|
51
|
-
const conditionVariable =
|
|
62
|
+
const condition = attributes?.condition ?? (styleBag as any)?.condition;
|
|
63
|
+
const conditionVariable =
|
|
64
|
+
attributes?.conditionVariable ?? (styleBag as any)?.conditionVariable;
|
|
52
65
|
const shouldHide =
|
|
53
66
|
condition === 'carousel-index' &&
|
|
54
67
|
typeof conditionVariable === 'number' &&
|
|
@@ -66,25 +79,12 @@ function OnboardButtons({ node }: OnboardButtonsComponentProps) {
|
|
|
66
79
|
>
|
|
67
80
|
<div
|
|
68
81
|
className="onboard__separator"
|
|
69
|
-
style={{
|
|
70
|
-
height: 1,
|
|
71
|
-
backgroundColor: seperatorColor,
|
|
72
|
-
width: '100%',
|
|
73
|
-
}}
|
|
82
|
+
style={seperatorColor ? { backgroundColor: seperatorColor } : undefined}
|
|
74
83
|
/>
|
|
75
|
-
<div
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
flexDirection: direction as any,
|
|
80
|
-
height: 40,
|
|
81
|
-
gap: 12,
|
|
82
|
-
alignItems: 'center',
|
|
83
|
-
justifyContent: 'center',
|
|
84
|
-
margin: '12px 24px',
|
|
85
|
-
}}
|
|
86
|
-
>
|
|
87
|
-
{renderChildren()}
|
|
84
|
+
<div className={buttonsClassName}>
|
|
85
|
+
{children.map((child, idx) => (
|
|
86
|
+
<RenderNode key={(child as any)?.key ?? idx} node={child} />
|
|
87
|
+
))}
|
|
88
88
|
</div>
|
|
89
89
|
</div>
|
|
90
90
|
);
|
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
import type { NodeData } from '../../types/Node';
|
|
4
4
|
|
|
5
|
+
export type ButtonTypeOptionType =
|
|
6
|
+
| 'previous_button'
|
|
7
|
+
| 'next_button'
|
|
8
|
+
| 'skip_button';
|
|
9
|
+
export type ButtonsDirectionOptionType = 'row' | 'column';
|
|
10
|
+
export type ConditionOptionType = 'carousel-index';
|
|
5
11
|
export type FlexDirectionOptionType = 'row' | 'column';
|
|
6
12
|
export type AlignItemsOptionType =
|
|
7
13
|
| 'flex-start'
|
|
@@ -17,50 +23,48 @@ export type JustifyContentOptionType =
|
|
|
17
23
|
| 'space-around'
|
|
18
24
|
| 'space-evenly';
|
|
19
25
|
export type PositionOptionType = 'relative' | 'absolute';
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
|
|
27
|
+
export interface OnboardButtonsStyleGenerated {
|
|
28
|
+
flexDirection?: FlexDirectionOptionType;
|
|
29
|
+
alignItems?: AlignItemsOptionType;
|
|
30
|
+
justifyContent?: JustifyContentOptionType;
|
|
31
|
+
gap?: string;
|
|
32
|
+
padding?: string;
|
|
33
|
+
paddingHorizontal?: string;
|
|
34
|
+
paddingVertical?: string;
|
|
35
|
+
paddingTop?: string;
|
|
36
|
+
paddingBottom?: string;
|
|
37
|
+
paddingLeft?: string;
|
|
38
|
+
paddingRight?: string;
|
|
39
|
+
margin?: string;
|
|
40
|
+
marginHorizontal?: string;
|
|
41
|
+
marginVertical?: string;
|
|
42
|
+
marginTop?: string;
|
|
43
|
+
marginBottom?: string;
|
|
44
|
+
marginLeft?: string;
|
|
45
|
+
marginRight?: string;
|
|
46
|
+
backgroundColor?: string;
|
|
47
|
+
borderRadius?: string;
|
|
48
|
+
width?: string;
|
|
49
|
+
minWidth?: string;
|
|
50
|
+
maxWidth?: string;
|
|
51
|
+
height?: string;
|
|
52
|
+
minHeight?: string;
|
|
53
|
+
maxHeight?: string;
|
|
54
|
+
flex?: number;
|
|
55
|
+
position?: PositionOptionType;
|
|
56
|
+
top?: string;
|
|
57
|
+
bottom?: string;
|
|
58
|
+
left?: string;
|
|
59
|
+
right?: string;
|
|
60
|
+
zIndex?: number;
|
|
61
|
+
}
|
|
26
62
|
|
|
27
63
|
export interface OnboardButtonsPropsGenerated {
|
|
28
64
|
child: string;
|
|
29
65
|
attributes: {
|
|
30
|
-
style?:
|
|
66
|
+
style?: OnboardButtonsStyleGenerated;
|
|
31
67
|
scrollable?: boolean;
|
|
32
|
-
flexDirection?: FlexDirectionOptionType;
|
|
33
|
-
alignItems?: AlignItemsOptionType;
|
|
34
|
-
justifyContent?: JustifyContentOptionType;
|
|
35
|
-
gap?: string;
|
|
36
|
-
padding?: string;
|
|
37
|
-
paddingHorizontal?: string;
|
|
38
|
-
paddingVertical?: string;
|
|
39
|
-
paddingTop?: string;
|
|
40
|
-
paddingBottom?: string;
|
|
41
|
-
paddingLeft?: string;
|
|
42
|
-
paddingRight?: string;
|
|
43
|
-
margin?: string;
|
|
44
|
-
marginVertical?: string;
|
|
45
|
-
marginTop?: string;
|
|
46
|
-
marginBottom?: string;
|
|
47
|
-
marginLeft?: string;
|
|
48
|
-
marginRight?: string;
|
|
49
|
-
backgroundColor?: string;
|
|
50
|
-
borderRadius?: string;
|
|
51
|
-
width?: string;
|
|
52
|
-
minWidth?: string;
|
|
53
|
-
maxWidth?: string;
|
|
54
|
-
height?: string;
|
|
55
|
-
minHeight?: string;
|
|
56
|
-
maxHeight?: string;
|
|
57
|
-
flex?: number;
|
|
58
|
-
position?: PositionOptionType;
|
|
59
|
-
top?: string;
|
|
60
|
-
bottom?: string;
|
|
61
|
-
left?: string;
|
|
62
|
-
right?: string;
|
|
63
|
-
zIndex?: number;
|
|
64
68
|
buttonType?: ButtonTypeOptionType;
|
|
65
69
|
skipNumber?: number;
|
|
66
70
|
buttons_direction?: ButtonsDirectionOptionType;
|
|
@@ -30,6 +30,15 @@
|
|
|
30
30
|
"label": "Onboard Buttons",
|
|
31
31
|
"description": "Wrapper for onboarding button set.",
|
|
32
32
|
"styles": {
|
|
33
|
+
"seperatorColor": {
|
|
34
|
+
"label": "Seperator Color",
|
|
35
|
+
"description": "Color of the divider line.",
|
|
36
|
+
"category": "style",
|
|
37
|
+
"specialCategory": null,
|
|
38
|
+
"sort": 5
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"attributes": {
|
|
33
42
|
"buttonType": {
|
|
34
43
|
"label": "Button Type",
|
|
35
44
|
"description": "Which onboard button to show.",
|
|
@@ -58,13 +67,6 @@
|
|
|
58
67
|
"specialCategory": null,
|
|
59
68
|
"sort": 4
|
|
60
69
|
},
|
|
61
|
-
"seperatorColor": {
|
|
62
|
-
"label": "Seperator Color",
|
|
63
|
-
"description": "Color of the divider line.",
|
|
64
|
-
"category": "style",
|
|
65
|
-
"specialCategory": null,
|
|
66
|
-
"sort": 5
|
|
67
|
-
},
|
|
68
70
|
"condition": {
|
|
69
71
|
"label": "Condition",
|
|
70
72
|
"description": "Built-in condition to check.",
|
|
@@ -3,7 +3,7 @@ import type { OnboardDotComponentProps } from './OnboardDotProps.generated';
|
|
|
3
3
|
import { onboardContext } from '../OnboardProvider/OnboardProvider';
|
|
4
4
|
import useNode from '../useNode';
|
|
5
5
|
import { useLogRender } from '../../utils/useLogRender';
|
|
6
|
-
import { useExtractViewStyle } from '../../
|
|
6
|
+
import { useExtractViewStyle } from '../../attribute-analyser/style/web/useExtractViewStyle';
|
|
7
7
|
import { useBuilderParams } from '../../components/BuilderProvider';
|
|
8
8
|
import { isNodeSelected, SELECTED_OUTLINE_STYLE } from '../../utils/selection';
|
|
9
9
|
import { useMergedStyle } from '../../utils/useMergedStyle';
|
|
@@ -19,7 +19,9 @@ function OnboardDot({ node }: OnboardDotComponentProps) {
|
|
|
19
19
|
const generatedId = useId();
|
|
20
20
|
const attributeName = node.type ?? 'OnboardDot';
|
|
21
21
|
const attributeKey = node.key ?? generatedId;
|
|
22
|
-
const
|
|
22
|
+
const attrs = node.attributes;
|
|
23
|
+
const styleBag = attrs?.style;
|
|
24
|
+
const dotType = attrs?.dotType || 'normal_dot';
|
|
23
25
|
const GHOST_DOT_DARK_COLOR = '#E4E5E7';
|
|
24
26
|
const GHOST_DOT_LIGHT_COLOR = '#F7F7F9';
|
|
25
27
|
const {
|
|
@@ -35,8 +37,8 @@ function OnboardDot({ node }: OnboardDotComponentProps) {
|
|
|
35
37
|
const inactiveDotColor = isDark
|
|
36
38
|
? GHOST_DOT_DARK_COLOR
|
|
37
39
|
: GHOST_DOT_LIGHT_COLOR;
|
|
38
|
-
const inactiveDotOpacity =
|
|
39
|
-
const activeDotColor =
|
|
40
|
+
const inactiveDotOpacity = attrs?.inactive_dot_opacity ?? 0.3;
|
|
41
|
+
const activeDotColor = attrs?.active_dot_color;
|
|
40
42
|
const resolvedActiveDotColor = useMemo(
|
|
41
43
|
() => parseColor(activeDotColor, { theme: appConfig.theme, projectColors }),
|
|
42
44
|
[activeDotColor, appConfig.theme, projectColors],
|
|
@@ -56,7 +58,7 @@ function OnboardDot({ node }: OnboardDotComponentProps) {
|
|
|
56
58
|
baseStyle,
|
|
57
59
|
isSelected ? SELECTED_OUTLINE_STYLE : undefined,
|
|
58
60
|
);
|
|
59
|
-
const expandingDotWidthRaw =
|
|
61
|
+
const expandingDotWidthRaw = attrs?.expanding_dot_width;
|
|
60
62
|
const expandingDotWidthOverride = useMemo(() => {
|
|
61
63
|
const parsed = parseSize(expandingDotWidthRaw);
|
|
62
64
|
if (parsed === undefined) return undefined;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import type { NodeData } from '../../types/Node';
|
|
4
4
|
|
|
5
|
-
export type PositionOptionType = 'relative' | 'absolute';
|
|
6
5
|
export type DotTypeOptionType =
|
|
7
6
|
| 'expanding_dot'
|
|
8
7
|
| 'normal_dot'
|
|
@@ -10,48 +9,70 @@ export type DotTypeOptionType =
|
|
|
10
9
|
| 'sliding_border'
|
|
11
10
|
| 'sliding_dot'
|
|
12
11
|
| 'liquid_like';
|
|
12
|
+
export type FlexDirectionOptionType = 'row' | 'column';
|
|
13
|
+
export type AlignItemsOptionType =
|
|
14
|
+
| 'flex-start'
|
|
15
|
+
| 'center'
|
|
16
|
+
| 'flex-end'
|
|
17
|
+
| 'stretch'
|
|
18
|
+
| 'baseline';
|
|
19
|
+
export type JustifyContentOptionType =
|
|
20
|
+
| 'flex-start'
|
|
21
|
+
| 'center'
|
|
22
|
+
| 'flex-end'
|
|
23
|
+
| 'space-between'
|
|
24
|
+
| 'space-around'
|
|
25
|
+
| 'space-evenly';
|
|
26
|
+
export type PositionOptionType = 'relative' | 'absolute';
|
|
27
|
+
|
|
28
|
+
export interface OnboardDotStyleGenerated {
|
|
29
|
+
flexDirection?: FlexDirectionOptionType;
|
|
30
|
+
alignItems?: AlignItemsOptionType;
|
|
31
|
+
justifyContent?: JustifyContentOptionType;
|
|
32
|
+
gap?: string;
|
|
33
|
+
padding?: string;
|
|
34
|
+
paddingHorizontal?: string;
|
|
35
|
+
paddingVertical?: string;
|
|
36
|
+
paddingTop?: string;
|
|
37
|
+
paddingBottom?: string;
|
|
38
|
+
paddingLeft?: string;
|
|
39
|
+
paddingRight?: string;
|
|
40
|
+
margin?: string;
|
|
41
|
+
marginHorizontal?: string;
|
|
42
|
+
marginVertical?: string;
|
|
43
|
+
marginTop?: string;
|
|
44
|
+
marginBottom?: string;
|
|
45
|
+
marginLeft?: string;
|
|
46
|
+
marginRight?: string;
|
|
47
|
+
backgroundColor?: string;
|
|
48
|
+
borderRadius?: string;
|
|
49
|
+
width?: string;
|
|
50
|
+
minWidth?: string;
|
|
51
|
+
maxWidth?: string;
|
|
52
|
+
height?: string;
|
|
53
|
+
minHeight?: string;
|
|
54
|
+
maxHeight?: string;
|
|
55
|
+
flex?: number;
|
|
56
|
+
position?: PositionOptionType;
|
|
57
|
+
top?: string;
|
|
58
|
+
bottom?: string;
|
|
59
|
+
left?: string;
|
|
60
|
+
right?: string;
|
|
61
|
+
zIndex?: number;
|
|
62
|
+
}
|
|
13
63
|
|
|
14
64
|
export interface OnboardDotPropsGenerated {
|
|
15
65
|
child: string;
|
|
16
66
|
attributes: {
|
|
17
|
-
style?:
|
|
67
|
+
style?: OnboardDotStyleGenerated;
|
|
18
68
|
scrollable?: boolean;
|
|
19
|
-
flexDirection?: never;
|
|
20
|
-
alignItems?: never;
|
|
21
|
-
justifyContent?: never;
|
|
22
|
-
gap?: string;
|
|
23
|
-
padding?: string;
|
|
24
|
-
paddingHorizontal?: string;
|
|
25
|
-
paddingVertical?: string;
|
|
26
|
-
paddingTop?: string;
|
|
27
|
-
paddingBottom?: string;
|
|
28
|
-
paddingLeft?: string;
|
|
29
|
-
paddingRight?: string;
|
|
30
|
-
margin?: string;
|
|
31
|
-
marginVertical?: string;
|
|
32
|
-
marginTop?: string;
|
|
33
|
-
marginBottom?: string;
|
|
34
|
-
marginLeft?: string;
|
|
35
|
-
marginRight?: string;
|
|
36
|
-
backgroundColor?: string;
|
|
37
|
-
borderRadius?: string;
|
|
38
|
-
width?: string;
|
|
39
|
-
minWidth?: string;
|
|
40
|
-
maxWidth?: string;
|
|
41
|
-
height?: string;
|
|
42
|
-
minHeight?: string;
|
|
43
|
-
maxHeight?: string;
|
|
44
|
-
flex?: number;
|
|
45
|
-
position?: PositionOptionType;
|
|
46
|
-
top?: string;
|
|
47
|
-
bottom?: string;
|
|
48
|
-
left?: string;
|
|
49
|
-
right?: string;
|
|
50
|
-
zIndex?: number;
|
|
51
69
|
dotType?: DotTypeOptionType;
|
|
52
70
|
inactive_dot_opacity?: number;
|
|
53
71
|
expanding_dot_width?: string;
|
|
54
72
|
active_dot_color?: string;
|
|
73
|
+
flexDirection?: never;
|
|
74
|
+
alignItems?: never;
|
|
75
|
+
justifyContent?: never;
|
|
55
76
|
};
|
|
56
77
|
}
|
|
57
78
|
|
|
@@ -3,8 +3,8 @@ import type { OnboardFooterComponentProps } from './OnboardFooterProps.generated
|
|
|
3
3
|
import useNode from '../useNode';
|
|
4
4
|
import { useBuilderParams } from '../../components/BuilderProvider';
|
|
5
5
|
import { parseSize } from '../../size-matters';
|
|
6
|
-
import { useExtractTextStyle } from '../../
|
|
7
|
-
import { useExtractViewStyle } from '../../
|
|
6
|
+
import { useExtractTextStyle } from '../../attribute-analyser/style/web/useExtractTextStyle';
|
|
7
|
+
import { useExtractViewStyle } from '../../attribute-analyser/style/web/useExtractViewStyle';
|
|
8
8
|
import { useLogRender } from '../../utils/useLogRender';
|
|
9
9
|
import { isNodeSelected } from '../../utils/selection';
|
|
10
10
|
import { useMergedStyle } from '../../utils/useMergedStyle';
|
|
@@ -104,7 +104,9 @@ function OnboardFooter({ node }: OnboardFooterComponentProps) {
|
|
|
104
104
|
const t = (key?: string) =>
|
|
105
105
|
key ? (localication?.[defaultLanguage ?? 'en']?.[key] ?? key) : '';
|
|
106
106
|
|
|
107
|
-
const
|
|
107
|
+
const attrs = node?.attributes;
|
|
108
|
+
const styleBag = attrs?.style;
|
|
109
|
+
const text = t(attrs?.textLocalizationKey);
|
|
108
110
|
const textStyle = useExtractTextStyle(node);
|
|
109
111
|
const viewStyle = useExtractViewStyle(node);
|
|
110
112
|
|
|
@@ -113,7 +115,7 @@ function OnboardFooter({ node }: OnboardFooterComponentProps) {
|
|
|
113
115
|
cursor: color ? 'pointer' : undefined,
|
|
114
116
|
});
|
|
115
117
|
|
|
116
|
-
const paddingHorizontal = parseSize(
|
|
118
|
+
const paddingHorizontal = parseSize(styleBag?.paddingHorizontal);
|
|
117
119
|
const layoutStyle = useMemo<React.CSSProperties>(
|
|
118
120
|
() => ({
|
|
119
121
|
paddingLeft: paddingHorizontal,
|
|
@@ -141,24 +143,22 @@ function OnboardFooter({ node }: OnboardFooterComponentProps) {
|
|
|
141
143
|
>
|
|
142
144
|
{!!text &&
|
|
143
145
|
(() => {
|
|
144
|
-
const firstText = t(
|
|
145
|
-
const secondText = t(
|
|
146
|
-
node?.attributes?.linkedWordSecondLocalizationKey,
|
|
147
|
-
);
|
|
146
|
+
const firstText = t(attrs?.linkedWordFirstLocalizationKey);
|
|
147
|
+
const secondText = t(attrs?.linkedWordSecondLocalizationKey);
|
|
148
148
|
const { segments, matchCount } = buildSegments(text, [
|
|
149
149
|
{
|
|
150
150
|
value: firstText,
|
|
151
|
-
color:
|
|
152
|
-
page: (
|
|
151
|
+
color: attrs?.linkedWordFirstColor,
|
|
152
|
+
page: (attrs as any)?.linkedWordFirstPage,
|
|
153
153
|
},
|
|
154
154
|
{
|
|
155
155
|
value: secondText,
|
|
156
|
-
color:
|
|
157
|
-
page: (
|
|
156
|
+
color: attrs?.linkedWordSecondColor,
|
|
157
|
+
page: (attrs as any)?.linkedWordSecondPage,
|
|
158
158
|
},
|
|
159
159
|
]);
|
|
160
160
|
|
|
161
|
-
const textColor =
|
|
161
|
+
const textColor = styleBag?.color;
|
|
162
162
|
|
|
163
163
|
const handleClick = (page?: string) => {
|
|
164
164
|
if (!page) return;
|
|
@@ -183,25 +183,21 @@ function OnboardFooter({ node }: OnboardFooterComponentProps) {
|
|
|
183
183
|
</p>
|
|
184
184
|
{matchCount === 0 && (
|
|
185
185
|
<div>
|
|
186
|
-
{
|
|
186
|
+
{attrs?.linkedWordFirstLocalizationKey && (
|
|
187
187
|
<span
|
|
188
|
-
style={linkStyle(
|
|
188
|
+
style={linkStyle(attrs?.linkedWordFirstColor)}
|
|
189
189
|
onClick={() =>
|
|
190
|
-
handleClick(
|
|
191
|
-
(node?.attributes as any)?.linkedWordFirstPage,
|
|
192
|
-
)
|
|
190
|
+
handleClick((attrs as any)?.linkedWordFirstPage)
|
|
193
191
|
}
|
|
194
192
|
>
|
|
195
193
|
{firstText}
|
|
196
194
|
</span>
|
|
197
195
|
)}
|
|
198
|
-
{
|
|
196
|
+
{attrs?.linkedWordSecondLocalizationKey && (
|
|
199
197
|
<span
|
|
200
|
-
style={linkStyle(
|
|
198
|
+
style={linkStyle(attrs?.linkedWordSecondColor)}
|
|
201
199
|
onClick={() =>
|
|
202
|
-
handleClick(
|
|
203
|
-
(node?.attributes as any)?.linkedWordSecondPage,
|
|
204
|
-
)
|
|
200
|
+
handleClick((attrs as any)?.linkedWordSecondPage)
|
|
205
201
|
}
|
|
206
202
|
>
|
|
207
203
|
{secondText}
|