tee3apps-cms-sdk-react 0.0.18 → 0.0.19
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/App.css +5 -7
- package/src/PageComponents/BoxComponent.tsx +74 -26
- package/src/PageComponents/RowComponent.tsx +55 -2
- package/src/PageComponents/Visual-Components/CarouselComponent.tsx +6 -8
- package/src/PageComponents/Visual-Components/ImageComponent.tsx +6 -5
- package/src/PageComponents/Visual-Components/TabComponent.tsx +50 -46
- package/src/PageComponents/Visual-Components/tab.css +3 -8
- package/src/index.css +7 -8
package/package.json
CHANGED
package/src/App.css
CHANGED
|
@@ -22,16 +22,14 @@
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
.image-box {
|
|
25
|
-
|
|
26
|
-
width: 100%;
|
|
27
|
-
/* height: 280px; */
|
|
25
|
+
width: 100%;
|
|
28
26
|
overflow: hidden;
|
|
29
|
-
display:
|
|
30
|
-
|
|
31
|
-
justify-content: center;
|
|
27
|
+
display: block;
|
|
28
|
+
position: relative;
|
|
32
29
|
}
|
|
33
30
|
|
|
34
31
|
.fitted-image {
|
|
35
32
|
width: 100%;
|
|
36
|
-
height:
|
|
33
|
+
height: auto;
|
|
34
|
+
display: block;
|
|
37
35
|
}
|
|
@@ -71,23 +71,68 @@ const BoxComponent: React.FC<BoxComponentProps> = ({
|
|
|
71
71
|
return null;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
// Check if children contain image/video components for dynamic height
|
|
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 => {
|
|
75
112
|
if (!autoAdjustForImages) {
|
|
76
113
|
return currentMode.height || 'auto';
|
|
77
114
|
}
|
|
78
115
|
|
|
79
|
-
|
|
80
|
-
React.isValidElement(child) &&
|
|
81
|
-
(child.type as any)?.name === 'ImageComponent' || 'CarouselComponent'
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
if (hasImageComponent) {
|
|
116
|
+
if (hasMedia) {
|
|
85
117
|
return 'auto';
|
|
86
118
|
}
|
|
87
119
|
|
|
88
120
|
return currentMode.height || 'auto';
|
|
89
121
|
};
|
|
90
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
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return currentMode.height || 'auto';
|
|
134
|
+
};
|
|
135
|
+
|
|
91
136
|
// Handle content justification with proper CSS values
|
|
92
137
|
const getJustifyContent = (justify: string): React.CSSProperties['justifyContent'] => {
|
|
93
138
|
if (justify === 'initial') return 'initial';
|
|
@@ -131,12 +176,15 @@ const getAlignItems = (align: React.CSSProperties['alignItems']): React.CSSPrope
|
|
|
131
176
|
// Get children as array
|
|
132
177
|
const childrenArray = React.Children.toArray(children);
|
|
133
178
|
|
|
179
|
+
// Check if we should use auto height for layouts
|
|
180
|
+
const useAutoHeight = autoAdjustForImages && hasMedia;
|
|
181
|
+
|
|
134
182
|
// Layout styles
|
|
135
183
|
const rowLayout = {
|
|
136
184
|
display: 'flex',
|
|
137
185
|
flexDirection: 'row' as const,
|
|
138
186
|
width: '100%',
|
|
139
|
-
height: '100%',
|
|
187
|
+
height: useAutoHeight ? 'auto' : '100%',
|
|
140
188
|
margin: 0,
|
|
141
189
|
padding: 0,
|
|
142
190
|
boxSizing: 'border-box' as const
|
|
@@ -149,7 +197,7 @@ const getAlignItems = (align: React.CSSProperties['alignItems']): React.CSSPrope
|
|
|
149
197
|
justifyContent: 'center',
|
|
150
198
|
padding: '5px',
|
|
151
199
|
boxSizing: 'border-box' as const,
|
|
152
|
-
flex: 1
|
|
200
|
+
flex: useAutoHeight ? 'none' : 1
|
|
153
201
|
};
|
|
154
202
|
|
|
155
203
|
// Render layout based on the layout prop
|
|
@@ -176,7 +224,7 @@ const getAlignItems = (align: React.CSSProperties['alignItems']): React.CSSPrope
|
|
|
176
224
|
return (
|
|
177
225
|
<div style={{
|
|
178
226
|
width: "100%",
|
|
179
|
-
height: "100%",
|
|
227
|
+
height: useAutoHeight ? 'auto' : "100%",
|
|
180
228
|
minHeight: "50px",
|
|
181
229
|
boxSizing: "border-box",
|
|
182
230
|
overflow: "hidden",
|
|
@@ -190,7 +238,7 @@ const getAlignItems = (align: React.CSSProperties['alignItems']): React.CSSPrope
|
|
|
190
238
|
display:"flex",
|
|
191
239
|
justifyContent:props.justify,
|
|
192
240
|
alignItems:props.align,
|
|
193
|
-
height: "100%"
|
|
241
|
+
height: useAutoHeight ? 'auto' : "100%"
|
|
194
242
|
}}>
|
|
195
243
|
<div style={{width:'100%'}}> {children}</div>
|
|
196
244
|
</div>
|
|
@@ -203,7 +251,7 @@ height: "100%"
|
|
|
203
251
|
display: 'flex',
|
|
204
252
|
flexDirection: 'column', // Changed to column to stack vertically
|
|
205
253
|
width: '100%',
|
|
206
|
-
height: '100%',
|
|
254
|
+
height: useAutoHeight ? 'auto' : '100%',
|
|
207
255
|
margin: 0,
|
|
208
256
|
padding: 0,
|
|
209
257
|
boxSizing: 'border-box'
|
|
@@ -213,9 +261,9 @@ height: "100%"
|
|
|
213
261
|
key={`BOX-LAYOUT2-${idx}`}
|
|
214
262
|
style={{
|
|
215
263
|
...colLayout,
|
|
216
|
-
minHeight: "50%",
|
|
264
|
+
minHeight: useAutoHeight ? "50px" : "50%",
|
|
217
265
|
width: '100%',
|
|
218
|
-
flex: 1
|
|
266
|
+
flex: useAutoHeight ? 'none' : 1
|
|
219
267
|
}}
|
|
220
268
|
>
|
|
221
269
|
{!isEmpty(childrenArray[idx]) ? (
|
|
@@ -231,15 +279,15 @@ height: "100%"
|
|
|
231
279
|
);
|
|
232
280
|
case "layout3":
|
|
233
281
|
return (
|
|
234
|
-
<div style={{ ...rowLayout, flexDirection: 'column'
|
|
235
|
-
<div style={{ ...rowLayout, flex: 1 }}>
|
|
282
|
+
<div style={{ ...rowLayout, flexDirection: 'column' }}>
|
|
283
|
+
<div style={{ ...rowLayout, flex: useAutoHeight ? 'none' : 1 }}>
|
|
236
284
|
{[0, 1].map((idx) => (
|
|
237
285
|
<div
|
|
238
286
|
key={`BOX-LAYOUT3-TOP-${idx}`}
|
|
239
287
|
style={{
|
|
240
288
|
...colLayout,
|
|
241
289
|
minHeight: "50px",
|
|
242
|
-
flex: 1
|
|
290
|
+
flex: useAutoHeight ? 'none' : 1
|
|
243
291
|
}}
|
|
244
292
|
>
|
|
245
293
|
{!isEmpty(childrenArray[idx]) ? (
|
|
@@ -252,14 +300,14 @@ height: "100%"
|
|
|
252
300
|
</div>
|
|
253
301
|
))}
|
|
254
302
|
</div>
|
|
255
|
-
<div style={{ ...rowLayout, flex: 1 }}>
|
|
303
|
+
<div style={{ ...rowLayout, flex: useAutoHeight ? 'none' : 1 }}>
|
|
256
304
|
{[2, 3].map((idx) => (
|
|
257
305
|
<div
|
|
258
306
|
key={`BOX-LAYOUT3-BOTTOM-${idx}`}
|
|
259
307
|
style={{
|
|
260
308
|
...colLayout,
|
|
261
309
|
minHeight: "50px",
|
|
262
|
-
flex: 1
|
|
310
|
+
flex: useAutoHeight ? 'none' : 1
|
|
263
311
|
}}
|
|
264
312
|
>
|
|
265
313
|
{!isEmpty(childrenArray[idx]) ? (
|
|
@@ -282,7 +330,7 @@ height: "100%"
|
|
|
282
330
|
style={{
|
|
283
331
|
...colLayout,
|
|
284
332
|
minHeight: "50px",
|
|
285
|
-
flex: 1
|
|
333
|
+
flex: useAutoHeight ? 'none' : 1
|
|
286
334
|
}}
|
|
287
335
|
>
|
|
288
336
|
{!isEmpty(childrenArray[0]) ? (
|
|
@@ -293,14 +341,14 @@ height: "100%"
|
|
|
293
341
|
</div>
|
|
294
342
|
)}
|
|
295
343
|
</div>
|
|
296
|
-
<div style={{ display: 'flex', flexDirection: 'column', flex: 1 }}>
|
|
344
|
+
<div style={{ display: 'flex', flexDirection: 'column', flex: useAutoHeight ? 'none' : 1 }}>
|
|
297
345
|
{[1, 2].map((idx) => (
|
|
298
346
|
<div
|
|
299
347
|
key={`BOX-LAYOUT4-${idx}`}
|
|
300
348
|
style={{
|
|
301
349
|
...colLayout,
|
|
302
350
|
minHeight: "50px",
|
|
303
|
-
flex: 1
|
|
351
|
+
flex: useAutoHeight ? 'none' : 1
|
|
304
352
|
}}
|
|
305
353
|
>
|
|
306
354
|
{!isEmpty(childrenArray[idx]) ? (
|
|
@@ -319,14 +367,14 @@ height: "100%"
|
|
|
319
367
|
case "layout5":
|
|
320
368
|
return (
|
|
321
369
|
<div style={rowLayout}>
|
|
322
|
-
<div style={{ display: 'flex', flexDirection: 'column', flex: 1 }}>
|
|
370
|
+
<div style={{ display: 'flex', flexDirection: 'column', flex: useAutoHeight ? 'none' : 1 }}>
|
|
323
371
|
{[0, 1].map((idx) => (
|
|
324
372
|
<div
|
|
325
373
|
key={`BOX-LAYOUT5-${idx}`}
|
|
326
374
|
style={{
|
|
327
375
|
...colLayout,
|
|
328
376
|
minHeight: "50px",
|
|
329
|
-
flex: 1
|
|
377
|
+
flex: useAutoHeight ? 'none' : 1
|
|
330
378
|
}}
|
|
331
379
|
>
|
|
332
380
|
{!isEmpty(childrenArray[idx]) ? (
|
|
@@ -343,7 +391,7 @@ height: "100%"
|
|
|
343
391
|
style={{
|
|
344
392
|
...colLayout,
|
|
345
393
|
minHeight: "50px",
|
|
346
|
-
flex: 1
|
|
394
|
+
flex: useAutoHeight ? 'none' : 1
|
|
347
395
|
}}
|
|
348
396
|
>
|
|
349
397
|
{!isEmpty(childrenArray[2]) ? (
|
|
@@ -368,7 +416,7 @@ height: "100%"
|
|
|
368
416
|
backgroundColor: props.bgColor,
|
|
369
417
|
backgroundSize: props.bgsize || 'cover',
|
|
370
418
|
height: getBoxHeight(),
|
|
371
|
-
minHeight:
|
|
419
|
+
minHeight: getBoxMinHeight(),
|
|
372
420
|
borderRadius: currentMode.radius || '0px',
|
|
373
421
|
width: `calc(${(colspan / 12) * 100}% - 1px)`,
|
|
374
422
|
maxWidth: `calc(${(colspan / 12) * 100}% - 1px)`,
|
|
@@ -61,6 +61,59 @@ const RowComponent: React.FC<RowComponentProps> = ({
|
|
|
61
61
|
return null;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
// Check if children contain image/video components for dynamic height
|
|
65
|
+
const hasMediaComponents = (): boolean => {
|
|
66
|
+
const checkChild = (child: React.ReactNode): boolean => {
|
|
67
|
+
if (!React.isValidElement(child)) return false;
|
|
68
|
+
|
|
69
|
+
const componentName = (child.type as any)?.name || (child.type as any)?.displayName;
|
|
70
|
+
const mediaComponents = [
|
|
71
|
+
'ImageComponent',
|
|
72
|
+
'CarouselComponent',
|
|
73
|
+
'VideoComponent',
|
|
74
|
+
'TabComponent',
|
|
75
|
+
'GroupImageComponent',
|
|
76
|
+
'GroupVideoComponent'
|
|
77
|
+
];
|
|
78
|
+
|
|
79
|
+
if (componentName && mediaComponents.includes(componentName)) {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Check nested children
|
|
84
|
+
if (child.props && typeof child.props === 'object' && 'children' in child.props) {
|
|
85
|
+
const children = (child.props as any).children;
|
|
86
|
+
if (children) {
|
|
87
|
+
const nestedChildren = React.Children.toArray(children);
|
|
88
|
+
return nestedChildren.some(checkChild);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return false;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
return React.Children.toArray(children).some(checkChild);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
// Check if we have media components
|
|
99
|
+
const hasMedia = hasMediaComponents();
|
|
100
|
+
|
|
101
|
+
// Get dynamic height based on media components
|
|
102
|
+
const getRowHeight = (): string | undefined => {
|
|
103
|
+
if (hasMedia) {
|
|
104
|
+
return 'auto';
|
|
105
|
+
}
|
|
106
|
+
return currentMode.height;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
// Get dynamic minHeight based on media components
|
|
110
|
+
const getRowMinHeight = (): string | undefined => {
|
|
111
|
+
if (hasMedia) {
|
|
112
|
+
return undefined; // Remove minHeight constraint for media components
|
|
113
|
+
}
|
|
114
|
+
return props.minHeight;
|
|
115
|
+
};
|
|
116
|
+
|
|
64
117
|
// Handle content justification with proper CSS values
|
|
65
118
|
const getJustifyContent = (): React.CSSProperties['justifyContent'] => {
|
|
66
119
|
const justifyMap: Record<string, React.CSSProperties['justifyContent']> = {
|
|
@@ -81,14 +134,14 @@ const getJustifyContent = (): React.CSSProperties['justifyContent'] => {
|
|
|
81
134
|
return (
|
|
82
135
|
<div
|
|
83
136
|
style={{
|
|
84
|
-
minHeight:
|
|
137
|
+
minHeight: getRowMinHeight(),
|
|
85
138
|
backgroundColor: props.bgColor,
|
|
86
139
|
backgroundImage: props.bgImage ? `url(${props.bgImage})` : 'none',
|
|
87
140
|
backgroundSize: props.bgsize,
|
|
88
141
|
backgroundPosition: 'center',
|
|
89
142
|
backgroundRepeat: 'no-repeat',
|
|
90
143
|
width: currentMode.width || '100%',
|
|
91
|
-
height:
|
|
144
|
+
height: getRowHeight(),
|
|
92
145
|
marginTop: currentMode.top,
|
|
93
146
|
marginBottom: currentMode.bottom,
|
|
94
147
|
marginLeft: currentMode.left,
|
|
@@ -200,7 +200,7 @@ const CarouselComponent: React.FC<CarouselComponentMainProps> = ({
|
|
|
200
200
|
className="carousel-container"
|
|
201
201
|
style={{
|
|
202
202
|
position: 'relative',
|
|
203
|
-
|
|
203
|
+
width: '100%',
|
|
204
204
|
overflow: 'hidden'
|
|
205
205
|
}}
|
|
206
206
|
onMouseEnter={handleMouseEnter}
|
|
@@ -211,7 +211,7 @@ const CarouselComponent: React.FC<CarouselComponentMainProps> = ({
|
|
|
211
211
|
className="carousel-slides"
|
|
212
212
|
style={{
|
|
213
213
|
display: 'flex',
|
|
214
|
-
|
|
214
|
+
width: '100%',
|
|
215
215
|
transition: `opacity ${props.speed}ms ease`,
|
|
216
216
|
flexDirection: props.vertical ? 'column' : 'row'
|
|
217
217
|
}}
|
|
@@ -225,11 +225,9 @@ const CarouselComponent: React.FC<CarouselComponentMainProps> = ({
|
|
|
225
225
|
className="carousel-slide"
|
|
226
226
|
style={{
|
|
227
227
|
flex: `0 0 ${100 / slidesToShow}%`,
|
|
228
|
-
|
|
228
|
+
width: props.vertical ? '100%' : `${100 / slidesToShow}%`,
|
|
229
229
|
overflow: 'hidden',
|
|
230
|
-
display: '
|
|
231
|
-
alignItems: 'center',
|
|
232
|
-
justifyContent: 'center',
|
|
230
|
+
display: 'block',
|
|
233
231
|
cursor: clickable ? 'pointer' : 'default'
|
|
234
232
|
}}
|
|
235
233
|
onClick={clickable ? () => handleSlideClick(slide) : undefined}
|
|
@@ -237,7 +235,7 @@ const CarouselComponent: React.FC<CarouselComponentMainProps> = ({
|
|
|
237
235
|
{slide.sl_type === 'video' ? (
|
|
238
236
|
<video
|
|
239
237
|
src={resolveAssetUrl(slide.video?.url)}
|
|
240
|
-
style={{ width: '100%', height: '
|
|
238
|
+
style={{ width: '100%', height: 'auto', display: 'block' }}
|
|
241
239
|
autoPlay={props.autoplay}
|
|
242
240
|
muted
|
|
243
241
|
loop
|
|
@@ -247,7 +245,7 @@ const CarouselComponent: React.FC<CarouselComponentMainProps> = ({
|
|
|
247
245
|
<img
|
|
248
246
|
src={resolveAssetUrl(slide.image?.url)}
|
|
249
247
|
alt={slide.image?.alt || ''}
|
|
250
|
-
style={{ width: '100%', height: '
|
|
248
|
+
style={{ width: '100%', height: 'auto', display: 'block' }}
|
|
251
249
|
/>
|
|
252
250
|
)}
|
|
253
251
|
</div>
|
|
@@ -122,7 +122,6 @@ const ImageComponent: React.FC<ImageComponentMainProps> = ({
|
|
|
122
122
|
};
|
|
123
123
|
|
|
124
124
|
const currentMode = getCurrentMode();
|
|
125
|
-
const containerHeight = boxHeight === 'auto' ? 'auto' : boxHeight;
|
|
126
125
|
const link = bannerLink(props);
|
|
127
126
|
const imageUrl = `${Linodeurl}${props.images?.url || props.images?.all?.url}`;
|
|
128
127
|
const altText = props.images.alt || '';
|
|
@@ -132,7 +131,9 @@ const ImageComponent: React.FC<ImageComponentMainProps> = ({
|
|
|
132
131
|
src={imageUrl}
|
|
133
132
|
alt={altText}
|
|
134
133
|
className="fitted-image"
|
|
135
|
-
style={{
|
|
134
|
+
style={{
|
|
135
|
+
cursor: link ? 'pointer' : 'default'
|
|
136
|
+
}}
|
|
136
137
|
/>
|
|
137
138
|
);
|
|
138
139
|
|
|
@@ -141,15 +142,15 @@ const ImageComponent: React.FC<ImageComponentMainProps> = ({
|
|
|
141
142
|
className="image-box"
|
|
142
143
|
style={{
|
|
143
144
|
borderRadius: `${currentMode.borderRadius}px`,
|
|
144
|
-
|
|
145
|
+
width: '100%',
|
|
145
146
|
overflow: 'hidden',
|
|
146
147
|
}}
|
|
147
148
|
>
|
|
148
149
|
{link ? (
|
|
149
150
|
<a
|
|
150
151
|
href={link}
|
|
151
|
-
|
|
152
|
-
style={{ display: 'block', width: '100%'
|
|
152
|
+
target={props?.linktype=='EXTERNAL' ? props?.link?.target :'_self'}
|
|
153
|
+
style={{ display: 'block', width: '100%' }}
|
|
153
154
|
>
|
|
154
155
|
{imageElement}
|
|
155
156
|
</a>
|