@gem-sdk/components 3.0.0-pre-production.10 → 3.0.0-pre-production.11
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.
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var core = require('@gem-sdk/core');
|
|
6
6
|
|
|
7
|
-
const TabItem = ({ children, builderAttrs, style, className, parentUid })=>{
|
|
7
|
+
const TabItem = ({ children, builderAttrs, style, className, parentUid, isActive })=>{
|
|
8
8
|
if (core.isEmptyChildren(children)) {
|
|
9
9
|
return core.template`<div class="gp-tab-item"></div>`;
|
|
10
10
|
}
|
|
@@ -16,7 +16,9 @@ const TabItem = ({ children, builderAttrs, style, className, parentUid })=>{
|
|
|
16
16
|
style="${{
|
|
17
17
|
...style
|
|
18
18
|
}}"
|
|
19
|
-
class="${core.cls(`gp-tab-item gp-child-item-${parentUid}`, className
|
|
19
|
+
class="${core.cls(`gp-tab-item gp-child-item-${parentUid}`, className, {
|
|
20
|
+
'gp-visible gp-h-0 gp-overflow-hidden': !isActive
|
|
21
|
+
})}"
|
|
20
22
|
>
|
|
21
23
|
${children}
|
|
22
24
|
</div>
|
|
@@ -108,10 +108,12 @@ const Tabs = ({ builderAttrs, builderProps, rawChildren, style, setting, advance
|
|
|
108
108
|
${core.WrapRenderChildren({
|
|
109
109
|
uid: builderProps?.uid || '',
|
|
110
110
|
customProps: rawChildren?.[0].customProps
|
|
111
|
-
}, rawChildren?.map((child)=>{
|
|
111
|
+
}, rawChildren?.map((child, index)=>{
|
|
112
|
+
const isActive = (setting?.activeKey ?? 0) < 0 || (setting?.activeKey ?? 0) >= (setting?.childItem ?? []).length ? index === 0 : index === (setting?.activeKey ?? 0) - 1;
|
|
112
113
|
return child ? core.template`${core.RenderChildren({
|
|
113
114
|
...child,
|
|
114
|
-
parentUid: builderProps?.uid
|
|
115
|
+
parentUid: builderProps?.uid,
|
|
116
|
+
isActive
|
|
115
117
|
})}` : '';
|
|
116
118
|
}))}
|
|
117
119
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isEmptyChildren, template, cls } from '@gem-sdk/core';
|
|
2
2
|
|
|
3
|
-
const TabItem = ({ children, builderAttrs, style, className, parentUid })=>{
|
|
3
|
+
const TabItem = ({ children, builderAttrs, style, className, parentUid, isActive })=>{
|
|
4
4
|
if (isEmptyChildren(children)) {
|
|
5
5
|
return template`<div class="gp-tab-item"></div>`;
|
|
6
6
|
}
|
|
@@ -12,7 +12,9 @@ const TabItem = ({ children, builderAttrs, style, className, parentUid })=>{
|
|
|
12
12
|
style="${{
|
|
13
13
|
...style
|
|
14
14
|
}}"
|
|
15
|
-
class="${cls(`gp-tab-item gp-child-item-${parentUid}`, className
|
|
15
|
+
class="${cls(`gp-tab-item gp-child-item-${parentUid}`, className, {
|
|
16
|
+
'gp-visible gp-h-0 gp-overflow-hidden': !isActive
|
|
17
|
+
})}"
|
|
16
18
|
>
|
|
17
19
|
${children}
|
|
18
20
|
</div>
|
|
@@ -104,10 +104,12 @@ const Tabs = ({ builderAttrs, builderProps, rawChildren, style, setting, advance
|
|
|
104
104
|
${WrapRenderChildren({
|
|
105
105
|
uid: builderProps?.uid || '',
|
|
106
106
|
customProps: rawChildren?.[0].customProps
|
|
107
|
-
}, rawChildren?.map((child)=>{
|
|
107
|
+
}, rawChildren?.map((child, index)=>{
|
|
108
|
+
const isActive = (setting?.activeKey ?? 0) < 0 || (setting?.activeKey ?? 0) >= (setting?.childItem ?? []).length ? index === 0 : index === (setting?.activeKey ?? 0) - 1;
|
|
108
109
|
return child ? template`${RenderChildren({
|
|
109
110
|
...child,
|
|
110
|
-
parentUid: builderProps?.uid
|
|
111
|
+
parentUid: builderProps?.uid,
|
|
112
|
+
isActive
|
|
111
113
|
})}` : '';
|
|
112
114
|
}))}
|
|
113
115
|
</div>
|
package/dist/types/index.d.ts
CHANGED
|
@@ -6417,7 +6417,7 @@ type TabsPropsLiquid = TabsProps & {
|
|
|
6417
6417
|
};
|
|
6418
6418
|
declare const Tabs: ({ builderAttrs, builderProps, rawChildren, style, setting, advanced, pageContext, }: TabsPropsLiquid) => string;
|
|
6419
6419
|
|
|
6420
|
-
declare const TabItem: ({ children, builderAttrs, style, className, parentUid }: {
|
|
6420
|
+
declare const TabItem: ({ children, builderAttrs, style, className, parentUid, isActive, }: {
|
|
6421
6421
|
children?: React.ReactNode;
|
|
6422
6422
|
className?: string | undefined;
|
|
6423
6423
|
isActive?: boolean | undefined;
|
|
@@ -6427,6 +6427,7 @@ declare const TabItem: ({ children, builderAttrs, style, className, parentUid }:
|
|
|
6427
6427
|
style?: React.CSSProperties | undefined;
|
|
6428
6428
|
} & {
|
|
6429
6429
|
parentUid?: string | undefined;
|
|
6430
|
+
isActive?: boolean | undefined;
|
|
6430
6431
|
}) => string;
|
|
6431
6432
|
|
|
6432
6433
|
declare const HeroBanner: ({ builderAttrs, builderProps, setting, styles, style, children, rawChildren, advanced, pageContext, }: _gem_sdk_core.BaseProps<{
|