@developer_tribe/react-builder 1.2.30 → 1.2.31

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.
Files changed (49) hide show
  1. package/dist/build-components/BIcon/BIcon.d.ts +1 -1
  2. package/dist/build-components/BackgroundImage/BackgroundImage.d.ts +1 -1
  3. package/dist/build-components/Button/Button.d.ts +1 -1
  4. package/dist/build-components/CarouselDots/CarouselDotsProps.generated.d.ts +4 -0
  5. package/dist/build-components/OnboardButton/OnboardButton.d.ts +1 -1
  6. package/dist/build-components/OnboardButton/OnboardButtonProps.generated.d.ts +0 -2
  7. package/dist/build-components/OnboardDot/OnboardDot.d.ts +1 -1
  8. package/dist/build-components/PaywallCloseButton/PaywallCloseButton.d.ts +1 -1
  9. package/dist/build-components/Text/Text.d.ts +1 -1
  10. package/dist/build-components/patterns.generated.d.ts +11 -17
  11. package/dist/index.cjs.js +1 -1
  12. package/dist/index.cjs.js.map +1 -1
  13. package/dist/index.esm.js +1 -1
  14. package/dist/index.esm.js.map +1 -1
  15. package/dist/index.web.cjs.js +4 -4
  16. package/dist/index.web.cjs.js.map +1 -1
  17. package/dist/index.web.esm.js +4 -4
  18. package/dist/index.web.esm.js.map +1 -1
  19. package/dist/utils/useMergedStyle.d.ts +1 -1
  20. package/package.json +1 -1
  21. package/src/assets/meta.json +1 -1
  22. package/src/assets/samples/vpn-onboard-1.json +21 -21
  23. package/src/assets/samples/vpn-onboard-2.json +21 -45
  24. package/src/assets/samples/vpn-onboard-3.json +21 -53
  25. package/src/assets/samples/vpn-onboard-4.json +21 -21
  26. package/src/assets/samples/vpn-onboard-5.json +33 -33
  27. package/src/assets/samples/vpn-onboard-6.json +21 -21
  28. package/src/assets/samples/vpn-onboard-7.json +21 -21
  29. package/src/build-components/BIcon/BIcon.tsx +1 -1
  30. package/src/build-components/BackgroundImage/BackgroundImage.tsx +1 -1
  31. package/src/build-components/Button/Button.tsx +1 -1
  32. package/src/build-components/CarouselDots/CarouselDots.tsx +8 -17
  33. package/src/build-components/CarouselDots/CarouselDotsProps.generated.ts +4 -0
  34. package/src/build-components/CarouselDots/pattern.json +12 -1
  35. package/src/build-components/Main/Main.tsx +1 -0
  36. package/src/build-components/OnboardButton/OnboardButton.tsx +11 -9
  37. package/src/build-components/OnboardButton/OnboardButtonProps.generated.ts +0 -2
  38. package/src/build-components/OnboardButton/pattern.json +0 -16
  39. package/src/build-components/OnboardDot/OnboardDot.tsx +10 -22
  40. package/src/build-components/OnboardDot/pattern.json +2 -1
  41. package/src/build-components/PaywallCloseButton/PaywallCloseButton.tsx +1 -1
  42. package/src/build-components/RadioButton/RadioButton.tsx +6 -3
  43. package/src/build-components/RenderNode.generated.tsx +7 -7
  44. package/src/build-components/Text/Text.tsx +1 -1
  45. package/src/build-components/patterns.generated.ts +11 -17
  46. package/src/components/BuilderProvider.tsx +1 -1
  47. package/src/hooks/useLocalize.ts +1 -1
  48. package/src/utils/projectColors.ts +3 -2
  49. package/src/utils/useMergedStyle.ts +9 -7
@@ -8,7 +8,6 @@
8
8
  "extends": "View",
9
9
  "attributes": {
10
10
  "labelKey": "string",
11
- "button_text_color": "color",
12
11
  "animation": [
13
12
  "simple-animation",
14
13
  "line-animation",
@@ -17,7 +16,6 @@
17
16
  "blur-line-animation"
18
17
  ],
19
18
  "animation_color": "color",
20
- "button_background_color": "color",
21
19
  "flex": "number",
22
20
  "events": "EventObject[]"
23
21
  },
@@ -41,13 +39,6 @@
41
39
  "label": "Onboard Button",
42
40
  "description": "Single action button for onboarding.",
43
41
  "styles": {
44
- "button_text_color": {
45
- "label": "Button Text Color",
46
- "description": "Text color of the button.",
47
- "category": "style",
48
- "specialCategory": null,
49
- "sort": 2
50
- },
51
42
  "animation": {
52
43
  "label": "Animation",
53
44
  "description": "Animation style for the button.",
@@ -61,13 +52,6 @@
61
52
  "category": "style",
62
53
  "specialCategory": null,
63
54
  "sort": 4
64
- },
65
- "button_background_color": {
66
- "label": "Button Background Color",
67
- "description": "Background color of the button.",
68
- "category": "style",
69
- "specialCategory": null,
70
- "sort": 5
71
55
  }
72
56
  },
73
57
  "attributes": {
@@ -11,7 +11,7 @@ import { parseColor } from '../../utils/parseColor';
11
11
  import { parseSize } from '../../size-matters';
12
12
  import { getStyleBag, toAttributeRecord } from '../../utils/attributeStyle';
13
13
 
14
- function OnboardDot({ node }: OnboardDotComponentProps) {
14
+ export function OnboardDot({ node }: OnboardDotComponentProps) {
15
15
  useLogRender('OnboardDot');
16
16
 
17
17
  node = useNode(node);
@@ -26,8 +26,6 @@ function OnboardDot({ node }: OnboardDotComponentProps) {
26
26
  (stylesBag?.dotType as string | undefined) ??
27
27
  (attrRecord.dotType as string | undefined) ??
28
28
  'normal_dot';
29
- const GHOST_DOT_DARK_COLOR = '#E4E5E7';
30
- const GHOST_DOT_LIGHT_COLOR = '#F7F7F9';
31
29
  const {
32
30
  previewMode,
33
31
  selectedKey,
@@ -35,12 +33,7 @@ function OnboardDot({ node }: OnboardDotComponentProps) {
35
33
  projectColors,
36
34
  baseSize,
37
35
  } = useBuilderParams();
38
- const isDark = theme === 'dark';
39
-
40
36
  // OnboardDot specific attributes
41
- const inactiveDotColor = isDark
42
- ? GHOST_DOT_DARK_COLOR
43
- : GHOST_DOT_LIGHT_COLOR;
44
37
  const inactiveDotOpacity =
45
38
  (stylesBag?.inactive_dot_opacity as number | undefined) ??
46
39
  (attrRecord.inactive_dot_opacity as number | undefined) ??
@@ -55,13 +48,10 @@ function OnboardDot({ node }: OnboardDotComponentProps) {
55
48
  () => parseColor(activeDotColor, { theme, projectColors }),
56
49
  [activeDotColor, theme, projectColors],
57
50
  );
58
- const resolvedInactiveDotColor = useMemo(() => {
59
- const parsed = parseColor(inactiveDotColorOverride, {
60
- theme,
61
- projectColors,
62
- });
63
- return parsed ?? inactiveDotColor;
64
- }, [inactiveDotColor, inactiveDotColorOverride, theme, projectColors]);
51
+ const resolvedInactiveDotColor = useMemo(
52
+ () => parseColor(inactiveDotColorOverride, { theme, projectColors }),
53
+ [inactiveDotColorOverride, theme, projectColors],
54
+ );
65
55
 
66
56
  const extractedStyle = useExtractViewStyle(node);
67
57
  const baseStyle = useMemo(() => {
@@ -138,14 +128,12 @@ function OnboardDot({ node }: OnboardDotComponentProps) {
138
128
  className={`embla__dots embla__dots--${dotType}`}
139
129
  style={containerStyle}
140
130
  >
141
- {scrollSnaps.map((snap, index) => {
131
+ {scrollSnaps.map((_, index) => {
142
132
  const isDotSelected = selectedIndex === index;
143
- const resolvedColor =
144
- isDotSelected && resolvedActiveDotColor
145
- ? resolvedActiveDotColor
146
- : resolvedInactiveDotColor;
147
- const activeFallback = '#007AFF';
148
- const dotColor = resolvedColor ?? activeFallback;
133
+ const resolvedColor = isDotSelected
134
+ ? resolvedActiveDotColor
135
+ : resolvedInactiveDotColor;
136
+ const dotColor = resolvedColor ?? undefined;
149
137
 
150
138
  return (
151
139
  <button
@@ -28,7 +28,8 @@
28
28
  "dotType": "expanding_dot",
29
29
  "dot_thickness": 10,
30
30
  "inactive_dot_opacity": 0.3,
31
- "active_dot_color": "#007AFF",
31
+ "active_dot_color": "STATIC_COLORS.ONBOARD_DOT_ACTIVE",
32
+ "inactive_dot_color": "THEME_COLORS.BACKGROUND",
32
33
  "style": {
33
34
  "flexDirection": "row",
34
35
  "alignItems": "center",
@@ -11,7 +11,7 @@ import { Icon } from '../../components/Icon.generated';
11
11
  import { IconsType } from '../../types/Icons.generated';
12
12
  import { usePaywallContext } from '../PaywallProvider/PaywallContext';
13
13
 
14
- function PaywallCloseButton({ node }: PaywallCloseButtonComponentProps) {
14
+ export function PaywallCloseButton({ node }: PaywallCloseButtonComponentProps) {
15
15
  useLogRender('PaywallCloseButton');
16
16
  node = useNode(node);
17
17
  const { onClose, isBackAllowed } = usePaywallContext();
@@ -28,11 +28,14 @@ export type RadioButtonBaseProps = {
28
28
 
29
29
  export function RadioButtonBase({
30
30
  selected,
31
- color = '#A6A6A6',
31
+ color,
32
32
  size = 24,
33
33
  }: RadioButtonBaseProps) {
34
34
  const borderWidth = Math.round(size * 0.1);
35
35
  const sizeHalf = Math.round(size * 0.5);
36
+ const { projectColors } = useBuilderParams();
37
+ const resolvedColor =
38
+ color ?? projectColors?.STATIC_COLORS?.RADIO_BUTTON_COLOR ?? '#A6A6A6';
36
39
 
37
40
  const paramsContext = useContext(ParamsContext);
38
41
  const { singleProductIsSelected: contextIsSelected } =
@@ -47,7 +50,7 @@ export function RadioButtonBase({
47
50
  alignItems: 'center',
48
51
  borderWidth,
49
52
  borderStyle: 'solid',
50
- borderColor: color,
53
+ borderColor: resolvedColor,
51
54
  width: size,
52
55
  height: size,
53
56
  borderRadius: sizeHalf,
@@ -61,7 +64,7 @@ export function RadioButtonBase({
61
64
  width: sizeHalf,
62
65
  height: sizeHalf,
63
66
  borderRadius: sizeHalf * 2,
64
- backgroundColor: color,
67
+ backgroundColor: resolvedColor,
65
68
  }}
66
69
  />
67
70
  ) : (
@@ -48,9 +48,9 @@ import type { SeparatorComponentProps } from './Separator/SeparatorProps.generat
48
48
  import type { StatusBarColorComponentProps } from './StatusBarColor/StatusBarColorProps.generated';
49
49
  import type { TextComponentProps } from './Text/TextProps.generated';
50
50
  import type { ViewComponentProps } from './View/ViewProps.generated';
51
- import BIcon from './BIcon/BIcon';
52
- import BackgroundImage from './BackgroundImage/BackgroundImage';
53
- import Button from './Button/Button';
51
+ import { BIcon } from './BIcon/BIcon';
52
+ import { BackgroundImage } from './BackgroundImage/BackgroundImage';
53
+ import { Button } from './Button/Button';
54
54
  import Carousel from './Carousel/Carousel';
55
55
  import CarouselButtons from './CarouselButtons/CarouselButtons';
56
56
  import CarouselDots from './CarouselDots/CarouselDots';
@@ -61,9 +61,9 @@ import Image from './Image/Image';
61
61
  import Main from './Main/Main';
62
62
  import NavigationBarColor from './NavigationBarColor/NavigationBarColor';
63
63
  import Onboard from './Onboard/Onboard';
64
- import OnboardButton from './OnboardButton/OnboardButton';
64
+ import { OnboardButton } from './OnboardButton/OnboardButton';
65
65
  import OnboardButtons from './OnboardButtons/OnboardButtons';
66
- import OnboardDot from './OnboardDot/OnboardDot';
66
+ import { OnboardDot } from './OnboardDot/OnboardDot';
67
67
  import OnboardFooter from './OnboardFooter/OnboardFooter';
68
68
  import OnboardImage from './OnboardImage/OnboardImage';
69
69
  import OnboardItem from './OnboardItem/OnboardItem';
@@ -71,7 +71,7 @@ import OnboardProvider from './OnboardProvider/OnboardProvider';
71
71
  import OnboardSubtitle from './OnboardSubtitle/OnboardSubtitle';
72
72
  import OnboardTitle from './OnboardTitle/OnboardTitle';
73
73
  import PaywallBackground from './PaywallBackground/PaywallBackground';
74
- import PaywallCloseButton from './PaywallCloseButton/PaywallCloseButton';
74
+ import { PaywallCloseButton } from './PaywallCloseButton/PaywallCloseButton';
75
75
  import PaywallOptions from './PaywallOptions/PaywallOptions';
76
76
  import PaywallProvider from './PaywallProvider/PaywallProvider';
77
77
  import PaywallSubscribeButton from './PaywallSubscribeButton/PaywallSubscribeButton';
@@ -81,7 +81,7 @@ import Promo from './Promo/Promo';
81
81
  import RadioButton from './RadioButton/RadioButton';
82
82
  import Separator from './Separator/Separator';
83
83
  import StatusBarColor from './StatusBarColor/StatusBarColor';
84
- import Text from './Text/Text';
84
+ import { Text } from './Text/Text';
85
85
  import View from './View/View';
86
86
 
87
87
  type BuilderNode =
@@ -8,7 +8,7 @@ import { isNodeSelected, SELECTED_OUTLINE_STYLE } from '../../utils/selection';
8
8
  import { useMergedStyle } from '../../utils/useMergedStyle';
9
9
  import { useLocalize } from '../../hooks/useLocalize';
10
10
 
11
- function Text({ node }: TextComponentProps) {
11
+ export function Text({ node }: TextComponentProps) {
12
12
  useLogRender('Text');
13
13
  node = useNode(node);
14
14
  const attributeName = node.sourceType ?? node.type ?? 'text';
@@ -2129,6 +2129,10 @@ export const patterns = [
2129
2129
  'sliding_dot',
2130
2130
  'liquid_like',
2131
2131
  ],
2132
+ dot_thickness: 'size',
2133
+ inactive_dot_opacity: 'number',
2134
+ inactive_dot_color: 'color',
2135
+ active_dot_color: 'color',
2132
2136
  },
2133
2137
  },
2134
2138
  meta: {
@@ -2453,6 +2457,11 @@ export const patterns = [
2453
2457
  flexGrow: 0,
2454
2458
  flexShrink: 0,
2455
2459
  },
2460
+ dotType: 'expanding_dot',
2461
+ dot_thickness: 10,
2462
+ inactive_dot_opacity: 0.3,
2463
+ active_dot_color: 'STATIC_COLORS.ONBOARD_DOT_ACTIVE',
2464
+ inactive_dot_color: 'THEME_COLORS.BACKGROUND',
2456
2465
  },
2457
2466
  types: {},
2458
2467
  },
@@ -5270,7 +5279,6 @@ export const patterns = [
5270
5279
  zIndex: 'number',
5271
5280
  },
5272
5281
  labelKey: 'string',
5273
- button_text_color: 'color',
5274
5282
  animation: [
5275
5283
  'simple-animation',
5276
5284
  'line-animation',
@@ -5279,7 +5287,6 @@ export const patterns = [
5279
5287
  'blur-line-animation',
5280
5288
  ],
5281
5289
  animation_color: 'color',
5282
- button_background_color: 'color',
5283
5290
  flex: 'number',
5284
5291
  events: 'EventObject[]',
5285
5292
  },
@@ -5330,13 +5337,6 @@ export const patterns = [
5330
5337
  sort: 21,
5331
5338
  preferredScale: 's',
5332
5339
  },
5333
- button_text_color: {
5334
- label: 'Button Text Color',
5335
- description: 'Text color of the button.',
5336
- category: 'style',
5337
- specialCategory: null,
5338
- sort: 2,
5339
- },
5340
5340
  animation: {
5341
5341
  label: 'Animation',
5342
5342
  description: 'Animation style for the button.',
@@ -5351,13 +5351,6 @@ export const patterns = [
5351
5351
  specialCategory: null,
5352
5352
  sort: 4,
5353
5353
  },
5354
- button_background_color: {
5355
- label: 'Button Background Color',
5356
- description: 'Background color of the button.',
5357
- category: 'style',
5358
- specialCategory: null,
5359
- sort: 5,
5360
- },
5361
5354
  },
5362
5355
  attributes: {
5363
5356
  scrollable: {
@@ -6524,7 +6517,8 @@ export const patterns = [
6524
6517
  dotType: 'expanding_dot',
6525
6518
  dot_thickness: 10,
6526
6519
  inactive_dot_opacity: 0.3,
6527
- active_dot_color: '#007AFF',
6520
+ active_dot_color: 'STATIC_COLORS.ONBOARD_DOT_ACTIVE',
6521
+ inactive_dot_color: 'THEME_COLORS.BACKGROUND',
6528
6522
  },
6529
6523
  types: {},
6530
6524
  },
@@ -67,7 +67,7 @@ export function BuilderProvider({ params, children }: BuilderProviderProps) {
67
67
  const lang = params.mockDefaultLanguage ?? defaultLanguage;
68
68
  return {
69
69
  ...params,
70
- // Ensure defaults if missing
70
+ // Ensure defaults if mxissing
71
71
  mockProducts: params.mockProducts ?? [],
72
72
  mockBenefits: params.mockBenefits ?? {},
73
73
  mockTheme: theme,
@@ -14,7 +14,7 @@ export function useLocalize(options?: {
14
14
  localization: builderLocalization,
15
15
  mockDefaultLanguage: builderDefaultLanguage,
16
16
  } = useBuilderParams();
17
-
17
+ //TODO: genelle (react-native ksımına export et)
18
18
  const localization =
19
19
  options?.localization ?? builderLocalization ?? defaultLocalization;
20
20
  const defaultLanguage =
@@ -11,10 +11,11 @@ export const defaultProjectColors: ProjectColors = {
11
11
  TRANSPARENT: '#ffffff00',
12
12
  ONBOARD_DOT_INACTIVE: '#E4E5E7',
13
13
  ONBOARD_DOT_ACTIVE: '#007AFF',
14
- ONBOARD_BUTTON_PRIMARY_BACKGROUND: '#0000FF',
15
- ONBOARD_BUTTON_PRIMARY_TEXT: '#000',
14
+ ONBOARD_BUTTON_PRIMARY_BACKGROUND: '#0066FF',
15
+ ONBOARD_BUTTON_PRIMARY_TEXT: '#FFFFFF',
16
16
  ONBOARD_LINK_COLOR: '#1778F2',
17
17
  ONBOARD_SEPARATOR_COLOR: '#44454D',
18
+ RADIO_BUTTON_COLOR: '#A6A6A6',
18
19
  },
19
20
  THEME_COLORS: {
20
21
  light: {
@@ -4,13 +4,15 @@ import type { CSSProperties } from 'react';
4
4
  const EMPTY_STYLE: CSSProperties = {};
5
5
 
6
6
  export function useMergedStyle(
7
- base?: CSSProperties,
8
- override?: CSSProperties,
7
+ ...args: (CSSProperties | undefined | null | false)[]
9
8
  ): CSSProperties {
9
+ // eslint-disable-next-line react-hooks/exhaustive-deps
10
10
  return useMemo(() => {
11
- if (!base && !override) return EMPTY_STYLE;
12
- if (!override) return base ?? EMPTY_STYLE;
13
- if (!base) return override;
14
- return { ...base, ...override };
15
- }, [base, override]);
11
+ const validStyles = args.filter((arg): arg is CSSProperties => !!arg);
12
+
13
+ if (validStyles.length === 0) return EMPTY_STYLE;
14
+ if (validStyles.length === 1) return validStyles[0];
15
+
16
+ return Object.assign({}, ...validStyles);
17
+ }, args);
16
18
  }