@developer_tribe/react-builder 1.2.44 → 1.2.46

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 (35) hide show
  1. package/dist/components/DeviceButton.d.ts +2 -1
  2. package/dist/index.cjs.js +28 -1
  3. package/dist/index.cjs.js.map +1 -1
  4. package/dist/index.esm.js +28 -1
  5. package/dist/index.esm.js.map +1 -1
  6. package/dist/index.web.cjs.js +3 -3
  7. package/dist/index.web.cjs.js.map +1 -1
  8. package/dist/index.web.esm.js +3 -3
  9. package/dist/index.web.esm.js.map +1 -1
  10. package/dist/modals/CreateDeviceModal.d.ts +8 -0
  11. package/dist/product-base/periodLocalizationKeys.d.ts +16 -0
  12. package/dist/store/customDeviceStore.d.ts +21 -0
  13. package/dist/store.d.ts +1 -1
  14. package/dist/styles.css +1 -1
  15. package/package.json +1 -1
  16. package/src/.DS_Store +0 -0
  17. package/src/assets/.DS_Store +0 -0
  18. package/src/assets/meta.json +1 -1
  19. package/src/build-components/FormCheckbox/FormCheckbox.tsx +2 -0
  20. package/src/build-components/Text/Text.tsx +2 -3
  21. package/src/components/DeviceButton.tsx +34 -1
  22. package/src/components/EditorHeader.tsx +22 -4
  23. package/src/modals/CreateDeviceModal.tsx +264 -0
  24. package/src/modals/DeviceSelectorModal.tsx +44 -7
  25. package/src/product-base/calculations.ts +30 -1
  26. package/src/product-base/extractAndroidParams.ts +2 -3
  27. package/src/product-base/extractIOSParams.ts +14 -8
  28. package/src/product-base/mockProducts.json +102 -0
  29. package/src/product-base/periodLocalizationKeys.ts +46 -0
  30. package/src/store/customDeviceStore.ts +38 -0
  31. package/src/styles/components/_editor-shell.scss +12 -2
  32. package/src/styles/index.scss +1 -0
  33. package/src/styles/modals/_create-device.scss +113 -0
  34. package/src/utils/__special_exceptions.ts +8 -0
  35. package/src/utils/analyseNodeByPatterns.ts +8 -1
@@ -94,7 +94,7 @@
94
94
  }
95
95
  }
96
96
 
97
- .editor-device-button span {
97
+ .editor-device-button__platform {
98
98
  position: absolute;
99
99
  bottom: 4px;
100
100
  right: 4px;
@@ -106,7 +106,7 @@
106
106
  overflow: hidden;
107
107
  }
108
108
 
109
- .editor-device-button img {
109
+ .editor-device-button__platform img {
110
110
  position: absolute;
111
111
  top: 50%;
112
112
  left: 50%;
@@ -117,6 +117,16 @@
117
117
  height: auto;
118
118
  }
119
119
 
120
+ .editor-device-button__edit {
121
+ transition:
122
+ opacity 0.2s ease,
123
+ transform 0.2s ease;
124
+ &:hover {
125
+ opacity: 1 !important;
126
+ transform: scale(1.1);
127
+ }
128
+ }
129
+
120
130
  .editor-header__actions {
121
131
  margin-left: auto; /* push actions to the far right */
122
132
  display: flex;
@@ -32,5 +32,6 @@
32
32
  @use './modals/benefit-presets-modal';
33
33
  @use './modals/inspect-modal';
34
34
  @use './modals/prompt-manager-modal';
35
+ @use './modals/create-device';
35
36
 
36
37
  @use './utilities/carousel';
@@ -0,0 +1,113 @@
1
+ @use '../foundation/colors' as colors;
2
+ @use '../foundation/sizes' as sizes;
3
+ @use '../foundation/typography' as typography;
4
+
5
+ .create-device-modal {
6
+ width: 100%;
7
+ max-width: 480px;
8
+
9
+ .modal__body {
10
+ padding: sizes.$spaceComfy;
11
+ display: flex;
12
+ flex-direction: column;
13
+ gap: sizes.$spaceCozy;
14
+ }
15
+ }
16
+
17
+ .create-device-form {
18
+ &__group {
19
+ display: flex;
20
+ flex-direction: column;
21
+ gap: sizes.$spaceTight;
22
+ }
23
+
24
+ &__row {
25
+ display: flex;
26
+ gap: sizes.$spaceCozy;
27
+
28
+ > * {
29
+ flex: 1;
30
+ }
31
+ }
32
+
33
+ &__label {
34
+ font-size: sizes.$fontSizeSm;
35
+ font-weight: 600;
36
+ color: colors.$mutedTextColor;
37
+ text-transform: uppercase;
38
+ letter-spacing: sizes.$letterSpacingTight;
39
+ }
40
+
41
+ &__error {
42
+ color: colors.$dangerColor;
43
+ font-size: sizes.$fontSizeXs;
44
+ margin-top: 2px;
45
+ }
46
+
47
+ &__footer {
48
+ margin-top: sizes.$spaceCozy;
49
+ display: flex;
50
+ justify-content: flex-end;
51
+ }
52
+ }
53
+
54
+ // Global-ish classes but styled for this context if not already defined
55
+ .editor-input {
56
+ height: sizes.$controlHeightMd;
57
+ padding: 0 sizes.$spaceInset;
58
+ border-radius: sizes.$radiusMid;
59
+ border: 1px solid colors.$borderColor;
60
+ background: colors.$surfaceColor;
61
+ color: colors.$textColor;
62
+ font-family: inherit;
63
+ font-size: sizes.$fontSizeBase;
64
+ width: 100%;
65
+ transition:
66
+ border-color 0.2s ease,
67
+ box-shadow 0.2s ease;
68
+
69
+ &:focus {
70
+ outline: none;
71
+ border-color: colors.$accentColor;
72
+ box-shadow: 0 0 0 3px hsl(var(--rb-primary) / 0.15);
73
+ }
74
+
75
+ &::placeholder {
76
+ color: colors.$mutedTextColor;
77
+ opacity: 0.5;
78
+ }
79
+ }
80
+
81
+ select.editor-input {
82
+ cursor: pointer;
83
+ appearance: none;
84
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 5 3 3 3-3'/%3E%3C/svg%3E");
85
+ background-repeat: no-repeat;
86
+ background-position: right sizes.$spaceInset center;
87
+ padding-right: sizes.$spaceRoomy;
88
+ }
89
+
90
+ .editor-button--primary {
91
+ background: colors.$textColor;
92
+ color: colors.$surfaceColor;
93
+ font-weight: 600;
94
+ border-color: colors.$textColor;
95
+
96
+ &:hover {
97
+ background: colors.$accentColor;
98
+ border-color: colors.$accentColor;
99
+ }
100
+ }
101
+
102
+ .device-selector-modal__search-container {
103
+ padding: 0 sizes.$spaceComfy;
104
+ margin-top: sizes.$spaceComfy;
105
+ margin-bottom: sizes.$spaceCompact;
106
+ display: flex;
107
+ gap: sizes.$spaceCozy;
108
+ align-items: center;
109
+
110
+ .editor-input {
111
+ flex: 1;
112
+ }
113
+ }
@@ -79,6 +79,14 @@ export function normalizeNodeForValidation(
79
79
  ? normalizeUnknownValue(attributes)
80
80
  : attributes;
81
81
 
82
+ if (
83
+ isPlainObject(attributes) &&
84
+ Array.isArray(attributes.styles) &&
85
+ attributes.styles.length === 0
86
+ ) {
87
+ attributes.styles = {};
88
+ }
89
+
82
90
  const children =
83
91
  recordData.children !== undefined
84
92
  ? (normalizeNodeForValidation(
@@ -14,6 +14,7 @@ import {
14
14
  isNodeNullOrUndefined,
15
15
  isNodeString,
16
16
  } from './nodeGuards';
17
+ import { logger } from './logger';
17
18
 
18
19
  export type AnalyseResultWithPath = {
19
20
  valid: boolean;
@@ -407,7 +408,13 @@ function validateAttributesByPattern(
407
408
  // Validate nested `attributes.styles` (canonical store for AttributesEditor).
408
409
  if (maybeStyles != null) {
409
410
  if (!isPlainObject(maybeStyles)) {
410
- return fail(`styles must be an object`, joinPath(path, 'styles'));
411
+ const msg = `styles must be an object`;
412
+ logger.error('analyseNodeByPatterns', msg, {
413
+ path: joinPath(path, 'styles'),
414
+ actualValue: maybeStyles,
415
+ actualType: Array.isArray(maybeStyles) ? 'array' : typeof maybeStyles,
416
+ });
417
+ return fail(msg, joinPath(path, 'styles'));
411
418
  }
412
419
  const stylesRecord = maybeStyles as Record<string, unknown>;
413
420
  for (const [styleKey, styleValue] of Object.entries(stylesRecord)) {