odaptos_design_system 2.0.150 → 2.0.152
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/Molecules/Tabs/TabsUnderLine.d.ts +3 -2
- package/dist/odaptos_design_system.cjs.development.js +26 -22
- package/dist/odaptos_design_system.cjs.development.js.map +1 -1
- package/dist/odaptos_design_system.cjs.production.min.js +1 -1
- package/dist/odaptos_design_system.cjs.production.min.js.map +1 -1
- package/dist/odaptos_design_system.esm.js +26 -22
- package/dist/odaptos_design_system.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/Molecules/Tabs/TabsUnderLine.tsx +38 -24
|
@@ -2,12 +2,13 @@ import React from 'react';
|
|
|
2
2
|
interface TabsUnderlineProps {
|
|
3
3
|
id?: string;
|
|
4
4
|
type?: 'underline' | 'filled';
|
|
5
|
-
defaultValue
|
|
5
|
+
defaultValue?: number;
|
|
6
|
+
value?: number;
|
|
6
7
|
onChange: (index: number, item: any) => void;
|
|
7
8
|
tabs: any[];
|
|
8
9
|
className?: string;
|
|
9
10
|
isArrowIconDisplay?: boolean;
|
|
10
11
|
}
|
|
11
12
|
/** Figma link : https://www.figma.com/file/fjnhhbL12HvKccPmJchVnr/Atomic-Library?type=design&node-id=2946-50988&mode=dev */
|
|
12
|
-
export declare const TabsUnderline: ({ id, type, defaultValue, onChange, tabs, className, isArrowIconDisplay, }: TabsUnderlineProps) => React.JSX.Element;
|
|
13
|
+
export declare const TabsUnderline: ({ id, type, defaultValue, value, onChange, tabs, className, isArrowIconDisplay, }: TabsUnderlineProps) => React.JSX.Element;
|
|
13
14
|
export {};
|
|
@@ -16222,30 +16222,34 @@ const TabsUnderline = ({
|
|
|
16222
16222
|
id,
|
|
16223
16223
|
type = 'underline',
|
|
16224
16224
|
defaultValue,
|
|
16225
|
+
value,
|
|
16225
16226
|
onChange,
|
|
16226
16227
|
tabs,
|
|
16227
16228
|
className,
|
|
16228
16229
|
isArrowIconDisplay = false
|
|
16229
16230
|
}) => {
|
|
16230
|
-
const [
|
|
16231
|
+
const [internalValue, setInternalValue] = React.useState(value !== undefined ? value : defaultValue ?? 0);
|
|
16232
|
+
React.useEffect(() => {
|
|
16233
|
+
if (value !== undefined) {
|
|
16234
|
+
setInternalValue(value);
|
|
16235
|
+
}
|
|
16236
|
+
}, [value]);
|
|
16237
|
+
React.useEffect(() => {
|
|
16238
|
+
if (value === undefined && defaultValue !== undefined) {
|
|
16239
|
+
setInternalValue(defaultValue);
|
|
16240
|
+
}
|
|
16241
|
+
}, [defaultValue, value]);
|
|
16231
16242
|
const onClickTab = (_event, index) => {
|
|
16232
16243
|
if (tabs[index].disabled) return;else {
|
|
16233
|
-
|
|
16244
|
+
setInternalValue(index);
|
|
16234
16245
|
onChange(index, tabs[index].value);
|
|
16235
16246
|
}
|
|
16236
16247
|
};
|
|
16237
|
-
React.useEffect(() => {
|
|
16238
|
-
if (defaultValue === undefined) return;
|
|
16239
|
-
if (defaultValue !== value) {
|
|
16240
|
-
setValue(defaultValue);
|
|
16241
|
-
onChange(defaultValue, tabs[defaultValue].value);
|
|
16242
|
-
}
|
|
16243
|
-
}, [defaultValue]);
|
|
16244
16248
|
if (type === 'underline') return /*#__PURE__*/React__default.createElement("div", {
|
|
16245
16249
|
className: `${styles$T.tabbar} ${className && className}`,
|
|
16246
16250
|
id: id
|
|
16247
16251
|
}, /*#__PURE__*/React__default.createElement(Tabs$1, {
|
|
16248
|
-
value:
|
|
16252
|
+
value: internalValue,
|
|
16249
16253
|
onChange: onClickTab,
|
|
16250
16254
|
className: styles$T.tabs_root,
|
|
16251
16255
|
variant: "scrollable",
|
|
@@ -16270,14 +16274,14 @@ const TabsUnderline = ({
|
|
|
16270
16274
|
textTransform: 'none'
|
|
16271
16275
|
},
|
|
16272
16276
|
label: /*#__PURE__*/React__default.createElement("div", {
|
|
16273
|
-
className: `${styles$T.tab_label_content} ${
|
|
16277
|
+
className: `${styles$T.tab_label_content} ${internalValue === index ? styles$T.selected : ''}`,
|
|
16274
16278
|
id: item.id,
|
|
16275
16279
|
onClick: e => onClickTab(e, index)
|
|
16276
16280
|
}, /*#__PURE__*/React__default.createElement(Title, {
|
|
16277
16281
|
text: item.label,
|
|
16278
|
-
weight:
|
|
16282
|
+
weight: internalValue === item.value ? 'semi-bold' : 'regular',
|
|
16279
16283
|
size: "base",
|
|
16280
|
-
color:
|
|
16284
|
+
color: internalValue === item.value ? 'black' : 'gray'
|
|
16281
16285
|
}), item.betaIconDescription === undefined || item.betaIconDescription === '' ? null : /*#__PURE__*/React__default.createElement(PopoverBeta, {
|
|
16282
16286
|
description: item.betaIconDescription,
|
|
16283
16287
|
placement: "bottom",
|
|
@@ -16297,10 +16301,10 @@ const TabsUnderline = ({
|
|
|
16297
16301
|
}, /*#__PURE__*/React__default.createElement(Title, {
|
|
16298
16302
|
key: `tab#${index}`,
|
|
16299
16303
|
className: `${!isArrowIconDisplay ? styles$T.tab_label_replacement : styles$T.tab_label_replacement_icon} ${styles$T.disabled}`,
|
|
16300
|
-
weight:
|
|
16304
|
+
weight: internalValue === item.value ? 'semi-bold' : 'regular',
|
|
16301
16305
|
size: "base",
|
|
16302
16306
|
text: item.label,
|
|
16303
|
-
color:
|
|
16307
|
+
color: internalValue === item.value ? 'black' : 'gray'
|
|
16304
16308
|
}), item.betaIconDescription === undefined || item.betaIconDescription === '' ? null : /*#__PURE__*/React__default.createElement(PopoverBeta, {
|
|
16305
16309
|
description: item.betaIconDescription,
|
|
16306
16310
|
placement: "bottom",
|
|
@@ -16327,10 +16331,10 @@ const TabsUnderline = ({
|
|
|
16327
16331
|
}, /*#__PURE__*/React__default.createElement(Title, {
|
|
16328
16332
|
key: `tab#${index}`,
|
|
16329
16333
|
className: `${!isArrowIconDisplay ? styles$T.tab_label_replacement : styles$T.tab_label_replacement_icon} ${styles$T.disabled}`,
|
|
16330
|
-
weight:
|
|
16334
|
+
weight: internalValue === item.value ? 'semi-bold' : 'regular',
|
|
16331
16335
|
size: "base",
|
|
16332
16336
|
text: item.label,
|
|
16333
|
-
color:
|
|
16337
|
+
color: internalValue === item.value ? 'black' : 'gray'
|
|
16334
16338
|
}), item.betaIconDescription === undefined || item.betaIconDescription === '' ? null : /*#__PURE__*/React__default.createElement(PopoverBeta, {
|
|
16335
16339
|
description: item.betaIconDescription,
|
|
16336
16340
|
placement: "bottom",
|
|
@@ -16358,7 +16362,7 @@ const TabsUnderline = ({
|
|
|
16358
16362
|
id: id,
|
|
16359
16363
|
className: `${styles$T.tabFilled} ${className && className}`
|
|
16360
16364
|
}, /*#__PURE__*/React__default.createElement(Tabs$1, {
|
|
16361
|
-
value:
|
|
16365
|
+
value: internalValue,
|
|
16362
16366
|
onChange: onClickTab,
|
|
16363
16367
|
className: styles$T.tabs_root,
|
|
16364
16368
|
variant: "scrollable",
|
|
@@ -16380,12 +16384,12 @@ const TabsUnderline = ({
|
|
|
16380
16384
|
textTransform: 'none'
|
|
16381
16385
|
},
|
|
16382
16386
|
label: /*#__PURE__*/React__default.createElement("div", {
|
|
16383
|
-
className: `${styles$T.tab_label_content} ${item.disabled ? styles$T.tab_label_disabled : ''} ${
|
|
16387
|
+
className: `${styles$T.tab_label_content} ${item.disabled ? styles$T.tab_label_disabled : ''} ${internalValue === index ? styles$T.selected : ''}`,
|
|
16384
16388
|
id: item.id
|
|
16385
16389
|
}, /*#__PURE__*/React__default.createElement(TextForButton, {
|
|
16386
16390
|
text: item.label,
|
|
16387
16391
|
size: "base",
|
|
16388
|
-
color:
|
|
16392
|
+
color: internalValue === index ? 'black' : 'gray'
|
|
16389
16393
|
}), item.betaIconDescription === undefined || item.betaIconDescription === '' ? null : /*#__PURE__*/React__default.createElement(PopoverBeta, {
|
|
16390
16394
|
description: item.betaIconDescription,
|
|
16391
16395
|
placement: "bottom",
|
|
@@ -16401,7 +16405,7 @@ const TabsUnderline = ({
|
|
|
16401
16405
|
className: `${!isArrowIconDisplay ? styles$T.tab_label_replacement : styles$T.tab_label_replacement_icon} ${styles$T.disabled}`,
|
|
16402
16406
|
size: "base",
|
|
16403
16407
|
text: item.label,
|
|
16404
|
-
color:
|
|
16408
|
+
color: internalValue === index ? 'black' : 'gray'
|
|
16405
16409
|
}), item.betaIconDescription === undefined || item.betaIconDescription === '' ? null : /*#__PURE__*/React__default.createElement(PopoverBeta, {
|
|
16406
16410
|
description: item.betaIconDescription,
|
|
16407
16411
|
placement: "bottom",
|
|
@@ -16429,7 +16433,7 @@ const TabsUnderline = ({
|
|
|
16429
16433
|
className: `${!isArrowIconDisplay ? styles$T.tab_label_replacement : styles$T.tab_label_replacement_icon} ${styles$T.disabled}`,
|
|
16430
16434
|
size: "base",
|
|
16431
16435
|
text: item.label,
|
|
16432
|
-
color:
|
|
16436
|
+
color: internalValue === index ? 'black' : 'gray'
|
|
16433
16437
|
}), item.betaIconDescription === undefined || item.betaIconDescription === '' ? null : /*#__PURE__*/React__default.createElement(PopoverBeta, {
|
|
16434
16438
|
description: item.betaIconDescription,
|
|
16435
16439
|
placement: "bottom",
|