tee3apps-cms-sdk-react 0.0.19 → 0.0.20
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/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/PageComponents/BoxComponent.tsx +26 -74
- package/src/PageComponents/Visual-Components/CarouselComponent.tsx +363 -363
- package/src/PageComponents/Visual-Components/ImageComponent.tsx +5 -6
- package/src/PageComponents/Visual-Components/TabComponent.tsx +4 -2
- package/src/index.css +10 -9
package/package.json
CHANGED
|
@@ -71,63 +71,18 @@ const BoxComponent: React.FC<BoxComponentProps> = ({
|
|
|
71
71
|
return null;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
const hasMediaComponents = (): boolean => {
|
|
76
|
-
const checkChild = (child: React.ReactNode): boolean => {
|
|
77
|
-
if (!React.isValidElement(child)) return false;
|
|
78
|
-
|
|
79
|
-
const componentName = (child.type as any)?.name || (child.type as any)?.displayName;
|
|
80
|
-
const mediaComponents = [
|
|
81
|
-
'ImageComponent',
|
|
82
|
-
'CarouselComponent',
|
|
83
|
-
'VideoComponent',
|
|
84
|
-
'TabComponent',
|
|
85
|
-
'GroupImageComponent',
|
|
86
|
-
'GroupVideoComponent'
|
|
87
|
-
];
|
|
88
|
-
|
|
89
|
-
if (componentName && mediaComponents.includes(componentName)) {
|
|
90
|
-
return true;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// Check nested children
|
|
94
|
-
if (child.props && typeof child.props === 'object' && 'children' in child.props) {
|
|
95
|
-
const children = (child.props as any).children;
|
|
96
|
-
if (children) {
|
|
97
|
-
const nestedChildren = React.Children.toArray(children);
|
|
98
|
-
return nestedChildren.some(checkChild);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return false;
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
return React.Children.toArray(children).some(checkChild);
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
// Check if we have media components
|
|
109
|
-
const hasMedia = hasMediaComponents();
|
|
110
|
-
|
|
111
|
-
const getBoxHeight = (): string | undefined => {
|
|
74
|
+
const getBoxHeight = (): string => {
|
|
112
75
|
if (!autoAdjustForImages) {
|
|
113
76
|
return currentMode.height || 'auto';
|
|
114
77
|
}
|
|
115
78
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
79
|
+
const hasImageComponent = React.Children.toArray(children).some(child =>
|
|
80
|
+
React.isValidElement(child) &&
|
|
81
|
+
(child.type as any)?.name === 'ImageComponent' || 'CarouselComponent'
|
|
82
|
+
);
|
|
119
83
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
// Get dynamic minHeight based on media components
|
|
124
|
-
const getBoxMinHeight = (): string | undefined => {
|
|
125
|
-
if (!autoAdjustForImages) {
|
|
126
|
-
return currentMode.height || 'auto';
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
if (hasMedia) {
|
|
130
|
-
return undefined; // Remove minHeight constraint for media components
|
|
84
|
+
if (hasImageComponent) {
|
|
85
|
+
return 'auto';
|
|
131
86
|
}
|
|
132
87
|
|
|
133
88
|
return currentMode.height || 'auto';
|
|
@@ -176,15 +131,12 @@ const getAlignItems = (align: React.CSSProperties['alignItems']): React.CSSPrope
|
|
|
176
131
|
// Get children as array
|
|
177
132
|
const childrenArray = React.Children.toArray(children);
|
|
178
133
|
|
|
179
|
-
// Check if we should use auto height for layouts
|
|
180
|
-
const useAutoHeight = autoAdjustForImages && hasMedia;
|
|
181
|
-
|
|
182
134
|
// Layout styles
|
|
183
135
|
const rowLayout = {
|
|
184
136
|
display: 'flex',
|
|
185
137
|
flexDirection: 'row' as const,
|
|
186
138
|
width: '100%',
|
|
187
|
-
height:
|
|
139
|
+
height: '100%',
|
|
188
140
|
margin: 0,
|
|
189
141
|
padding: 0,
|
|
190
142
|
boxSizing: 'border-box' as const
|
|
@@ -197,7 +149,7 @@ const getAlignItems = (align: React.CSSProperties['alignItems']): React.CSSPrope
|
|
|
197
149
|
justifyContent: 'center',
|
|
198
150
|
padding: '5px',
|
|
199
151
|
boxSizing: 'border-box' as const,
|
|
200
|
-
flex:
|
|
152
|
+
flex: 1
|
|
201
153
|
};
|
|
202
154
|
|
|
203
155
|
// Render layout based on the layout prop
|
|
@@ -224,7 +176,7 @@ const getAlignItems = (align: React.CSSProperties['alignItems']): React.CSSPrope
|
|
|
224
176
|
return (
|
|
225
177
|
<div style={{
|
|
226
178
|
width: "100%",
|
|
227
|
-
height:
|
|
179
|
+
height: "100%",
|
|
228
180
|
minHeight: "50px",
|
|
229
181
|
boxSizing: "border-box",
|
|
230
182
|
overflow: "hidden",
|
|
@@ -238,7 +190,7 @@ const getAlignItems = (align: React.CSSProperties['alignItems']): React.CSSPrope
|
|
|
238
190
|
display:"flex",
|
|
239
191
|
justifyContent:props.justify,
|
|
240
192
|
alignItems:props.align,
|
|
241
|
-
|
|
193
|
+
height: "100%"
|
|
242
194
|
}}>
|
|
243
195
|
<div style={{width:'100%'}}> {children}</div>
|
|
244
196
|
</div>
|
|
@@ -251,7 +203,7 @@ const getAlignItems = (align: React.CSSProperties['alignItems']): React.CSSPrope
|
|
|
251
203
|
display: 'flex',
|
|
252
204
|
flexDirection: 'column', // Changed to column to stack vertically
|
|
253
205
|
width: '100%',
|
|
254
|
-
height:
|
|
206
|
+
height: '100%',
|
|
255
207
|
margin: 0,
|
|
256
208
|
padding: 0,
|
|
257
209
|
boxSizing: 'border-box'
|
|
@@ -261,9 +213,9 @@ const getAlignItems = (align: React.CSSProperties['alignItems']): React.CSSPrope
|
|
|
261
213
|
key={`BOX-LAYOUT2-${idx}`}
|
|
262
214
|
style={{
|
|
263
215
|
...colLayout,
|
|
264
|
-
minHeight:
|
|
216
|
+
minHeight: "50%",
|
|
265
217
|
width: '100%',
|
|
266
|
-
flex:
|
|
218
|
+
flex: 1
|
|
267
219
|
}}
|
|
268
220
|
>
|
|
269
221
|
{!isEmpty(childrenArray[idx]) ? (
|
|
@@ -279,15 +231,15 @@ const getAlignItems = (align: React.CSSProperties['alignItems']): React.CSSPrope
|
|
|
279
231
|
);
|
|
280
232
|
case "layout3":
|
|
281
233
|
return (
|
|
282
|
-
<div style={{ ...rowLayout, flexDirection: 'column' }}>
|
|
283
|
-
<div style={{ ...rowLayout, flex:
|
|
234
|
+
<div style={{ ...rowLayout, flexDirection: 'column', height: '100%' }}>
|
|
235
|
+
<div style={{ ...rowLayout, flex: 1 }}>
|
|
284
236
|
{[0, 1].map((idx) => (
|
|
285
237
|
<div
|
|
286
238
|
key={`BOX-LAYOUT3-TOP-${idx}`}
|
|
287
239
|
style={{
|
|
288
240
|
...colLayout,
|
|
289
241
|
minHeight: "50px",
|
|
290
|
-
flex:
|
|
242
|
+
flex: 1
|
|
291
243
|
}}
|
|
292
244
|
>
|
|
293
245
|
{!isEmpty(childrenArray[idx]) ? (
|
|
@@ -300,14 +252,14 @@ const getAlignItems = (align: React.CSSProperties['alignItems']): React.CSSPrope
|
|
|
300
252
|
</div>
|
|
301
253
|
))}
|
|
302
254
|
</div>
|
|
303
|
-
<div style={{ ...rowLayout, flex:
|
|
255
|
+
<div style={{ ...rowLayout, flex: 1 }}>
|
|
304
256
|
{[2, 3].map((idx) => (
|
|
305
257
|
<div
|
|
306
258
|
key={`BOX-LAYOUT3-BOTTOM-${idx}`}
|
|
307
259
|
style={{
|
|
308
260
|
...colLayout,
|
|
309
261
|
minHeight: "50px",
|
|
310
|
-
flex:
|
|
262
|
+
flex: 1
|
|
311
263
|
}}
|
|
312
264
|
>
|
|
313
265
|
{!isEmpty(childrenArray[idx]) ? (
|
|
@@ -330,7 +282,7 @@ const getAlignItems = (align: React.CSSProperties['alignItems']): React.CSSPrope
|
|
|
330
282
|
style={{
|
|
331
283
|
...colLayout,
|
|
332
284
|
minHeight: "50px",
|
|
333
|
-
flex:
|
|
285
|
+
flex: 1
|
|
334
286
|
}}
|
|
335
287
|
>
|
|
336
288
|
{!isEmpty(childrenArray[0]) ? (
|
|
@@ -341,14 +293,14 @@ const getAlignItems = (align: React.CSSProperties['alignItems']): React.CSSPrope
|
|
|
341
293
|
</div>
|
|
342
294
|
)}
|
|
343
295
|
</div>
|
|
344
|
-
<div style={{ display: 'flex', flexDirection: 'column', flex:
|
|
296
|
+
<div style={{ display: 'flex', flexDirection: 'column', flex: 1 }}>
|
|
345
297
|
{[1, 2].map((idx) => (
|
|
346
298
|
<div
|
|
347
299
|
key={`BOX-LAYOUT4-${idx}`}
|
|
348
300
|
style={{
|
|
349
301
|
...colLayout,
|
|
350
302
|
minHeight: "50px",
|
|
351
|
-
flex:
|
|
303
|
+
flex: 1
|
|
352
304
|
}}
|
|
353
305
|
>
|
|
354
306
|
{!isEmpty(childrenArray[idx]) ? (
|
|
@@ -367,14 +319,14 @@ const getAlignItems = (align: React.CSSProperties['alignItems']): React.CSSPrope
|
|
|
367
319
|
case "layout5":
|
|
368
320
|
return (
|
|
369
321
|
<div style={rowLayout}>
|
|
370
|
-
<div style={{ display: 'flex', flexDirection: 'column', flex:
|
|
322
|
+
<div style={{ display: 'flex', flexDirection: 'column', flex: 1 }}>
|
|
371
323
|
{[0, 1].map((idx) => (
|
|
372
324
|
<div
|
|
373
325
|
key={`BOX-LAYOUT5-${idx}`}
|
|
374
326
|
style={{
|
|
375
327
|
...colLayout,
|
|
376
328
|
minHeight: "50px",
|
|
377
|
-
flex:
|
|
329
|
+
flex: 1
|
|
378
330
|
}}
|
|
379
331
|
>
|
|
380
332
|
{!isEmpty(childrenArray[idx]) ? (
|
|
@@ -391,7 +343,7 @@ const getAlignItems = (align: React.CSSProperties['alignItems']): React.CSSPrope
|
|
|
391
343
|
style={{
|
|
392
344
|
...colLayout,
|
|
393
345
|
minHeight: "50px",
|
|
394
|
-
flex:
|
|
346
|
+
flex: 1
|
|
395
347
|
}}
|
|
396
348
|
>
|
|
397
349
|
{!isEmpty(childrenArray[2]) ? (
|
|
@@ -416,7 +368,7 @@ const getAlignItems = (align: React.CSSProperties['alignItems']): React.CSSPrope
|
|
|
416
368
|
backgroundColor: props.bgColor,
|
|
417
369
|
backgroundSize: props.bgsize || 'cover',
|
|
418
370
|
height: getBoxHeight(),
|
|
419
|
-
minHeight:
|
|
371
|
+
minHeight: autoAdjustForImages ? 'auto' : (currentMode.height || 'auto'),
|
|
420
372
|
borderRadius: currentMode.radius || '0px',
|
|
421
373
|
width: `calc(${(colspan / 12) * 100}% - 1px)`,
|
|
422
374
|
maxWidth: `calc(${(colspan / 12) * 100}% - 1px)`,
|