@zohodesk/components 1.0.0-temp-252.4 → 1.0.0-temp-256
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/README.md +20 -3
- package/assets/Appearance/dark/mode/Component_DarkMode.module.css +4 -4
- package/assets/Appearance/dark/themes/blue/blue_componentsCTA_DarkModifyCategory.module.css +14 -0
- package/assets/Appearance/dark/themes/green/green_componentsCTA_DarkModifyCategory.module.css +14 -0
- package/assets/Appearance/dark/themes/orange/orange_componentsCTA_DarkModifyCategory.module.css +14 -0
- package/assets/Appearance/dark/themes/red/red_componentsCTA_DarkModifyCategory.module.css +14 -0
- package/assets/Appearance/dark/themes/yellow/yellow_componentsCTA_DarkModifyCategory.module.css +14 -0
- package/assets/Appearance/light/mode/Component_LightMode.module.css +6 -6
- package/assets/Appearance/light/themes/blue/blue_componentsCTA_LightModifyCategory.module.css +14 -0
- package/assets/Appearance/light/themes/green/green_componentsCTA_LightModifyCategory.module.css +14 -0
- package/assets/Appearance/light/themes/orange/orange_componentsCTA_LightModifyCategory.module.css +14 -0
- package/assets/Appearance/light/themes/red/red_componentsCTA_LightModifyCategory.module.css +14 -0
- package/assets/Appearance/light/themes/yellow/yellow_componentsCTA_LightModifyCategory.module.css +14 -0
- package/assets/Appearance/pureDark/mode/Component_PureDarkMode.module.css +3 -3
- package/assets/Appearance/pureDark/themes/blue/blue_componentsCTA_PureDarkModifyCategory.module.css +14 -0
- package/assets/Appearance/pureDark/themes/green/green_componentsCTA_PureDarkModifyCategory.module.css +14 -0
- package/assets/Appearance/pureDark/themes/orange/orange_componentsCTA_PureDarkModifyCategory.module.css +14 -0
- package/assets/Appearance/pureDark/themes/red/red_componentsCTA_PureDarkModifyCategory.module.css +14 -0
- package/assets/Appearance/pureDark/themes/yellow/yellow_componentsCTA_PureDarkModifyCategory.module.css +14 -0
- package/cbt.config.js +12 -3
- package/es/Avatar/Avatar.js +1 -2
- package/es/Button/css/cssJSLogic.js +4 -5
- package/es/DateTime/DateTime.js +3 -6
- package/es/DateTime/DateWidget.js +34 -11
- package/es/DateTime/YearView.js +5 -6
- package/es/DateTime/common.js +2 -9
- package/es/DateTime/dateFormatUtils/dateFormat.js +55 -76
- package/es/DateTime/dateFormatUtils/index.js +7 -12
- package/es/DateTime/dateFormatUtils/timeChange.js +3 -4
- package/es/DateTime/dateFormatUtils/yearChange.js +3 -4
- package/es/DropBox/DropBoxElement/css/cssJSLogic.js +5 -6
- package/es/Layout/utils.js +1 -2
- package/es/ListItem/ListContainer.js +4 -5
- package/es/Modal/Portal/Portal.js +4 -5
- package/es/MultiSelect/AdvancedGroupMultiSelect.js +91 -103
- package/es/MultiSelect/AdvancedMultiSelect.js +74 -80
- package/es/MultiSelect/MultiSelect.js +4 -13
- package/es/MultiSelect/Suggestions.js +14 -17
- package/es/Popup/Popup.js +1 -4
- package/es/Provider/IdProvider.js +4 -5
- package/es/Provider/LibraryContext.js +15 -12
- package/es/Provider/NumberGenerator/NumberGenerator.js +15 -17
- package/es/Provider/ZindexProvider.js +4 -5
- package/es/Responsive/CustomResponsive.js +8 -11
- package/es/Responsive/ResizeComponent.js +1 -3
- package/es/Responsive/Responsive.js +9 -12
- package/es/Responsive/sizeObservers.js +1 -5
- package/es/ResponsiveDropBox/ResponsiveDropBox.js +10 -14
- package/es/Select/GroupSelect.js +98 -103
- package/es/Select/Select.js +110 -116
- package/es/Select/SelectWithAvatar.js +91 -95
- package/es/Select/SelectWithIcon.js +104 -109
- package/es/Select/__tests__/Select.spec.js +6 -9
- package/es/Tab/Tab.js +90 -40
- package/es/Tab/Tab.module.css +25 -0
- package/es/Tab/TabContent.js +16 -19
- package/es/Tab/TabContentWrapper.js +19 -22
- package/es/Tab/TabWrapper.js +15 -16
- package/es/Tab/Tabs.js +105 -81
- package/es/Tab/Tabs.module.css +48 -3
- package/es/Tab/__tests__/Tab.spec.js +112 -0
- package/es/Tab/__tests__/__snapshots__/Tab.spec.js.snap +316 -0
- package/es/Tab/props/defaultProps.js +3 -2
- package/es/Tab/props/propTypes.js +12 -3
- package/es/Tab/utils/tabConfigs.js +5 -0
- package/es/Typography/css/cssJSLogic.js +4 -5
- package/es/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +1 -2
- package/es/utils/Common.js +10 -31
- package/es/utils/datetime/common.js +12 -9
- package/es/utils/dropDownUtils.js +7 -11
- package/es/utils/getInitial.js +1 -3
- package/es/v1/Button/css/cssJSLogic.js +4 -8
- package/es/v1/Label/css/cssJSLogic.js +4 -5
- package/es/v1/Switch/css/cssJSLogic.js +4 -5
- package/es/v1/helpers/colorHelpers/colorHelper.js +28 -39
- package/lib/DateTime/DateWidget.js +33 -6
- package/lib/Provider/LibraryContext.js +5 -1
- package/lib/Tab/Tab.js +62 -9
- package/lib/Tab/Tab.module.css +25 -0
- package/lib/Tab/Tabs.js +34 -3
- package/lib/Tab/Tabs.module.css +48 -3
- package/lib/Tab/__tests__/Tab.spec.js +115 -0
- package/lib/Tab/__tests__/__snapshots__/Tab.spec.js.snap +316 -0
- package/lib/Tab/props/defaultProps.js +3 -2
- package/lib/Tab/props/propTypes.js +14 -3
- package/lib/Tab/utils/tabConfigs.js +7 -1
- package/lib/utils/datetime/common.js +10 -2
- package/package.json +12 -11
package/es/Tab/TabContent.js
CHANGED
|
@@ -5,25 +5,22 @@ import { Container } from "../Layout";
|
|
|
5
5
|
import style from "./TabContent.module.css";
|
|
6
6
|
/* eslint-disable react/forbid-component-props */
|
|
7
7
|
|
|
8
|
-
const TabContent =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
dataSelectorId: dataSelectorId
|
|
25
|
-
}, children);
|
|
26
|
-
};
|
|
8
|
+
const TabContent = ({
|
|
9
|
+
children,
|
|
10
|
+
scroll,
|
|
11
|
+
dataId,
|
|
12
|
+
id,
|
|
13
|
+
dataSelectorId
|
|
14
|
+
}) => /*#__PURE__*/React.createElement(Container, {
|
|
15
|
+
className: style.container,
|
|
16
|
+
scroll: scroll,
|
|
17
|
+
dataId: `${dataId}_TabContent`,
|
|
18
|
+
isScrollAttribute: true,
|
|
19
|
+
"aria-labelledby": id,
|
|
20
|
+
tabindex: "-1",
|
|
21
|
+
role: "tabpanel",
|
|
22
|
+
dataSelectorId: dataSelectorId
|
|
23
|
+
}, children);
|
|
27
24
|
|
|
28
25
|
TabContent.defaultProps = TabContent_defaultProps;
|
|
29
26
|
TabContent.propTypes = TabContent_propTypes;
|
|
@@ -6,28 +6,25 @@ import { TabContentWrapper_propTypes } from "./props/propTypes";
|
|
|
6
6
|
import { Box } from "../Layout";
|
|
7
7
|
/* eslint-disable react/forbid-component-props */
|
|
8
8
|
|
|
9
|
-
const TabContentWrapper =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
tagName: tagName
|
|
29
|
-
}, a11y), React.Children.map(children, child => /*#__PURE__*/React.isValidElement(child) && child.props.id === selectedTab ? child : null));
|
|
30
|
-
};
|
|
9
|
+
const TabContentWrapper = ({
|
|
10
|
+
style,
|
|
11
|
+
className,
|
|
12
|
+
children,
|
|
13
|
+
dataId,
|
|
14
|
+
selectedTab,
|
|
15
|
+
onScroll,
|
|
16
|
+
dataSelectorId,
|
|
17
|
+
tagName,
|
|
18
|
+
a11y
|
|
19
|
+
}) => /*#__PURE__*/React.createElement(Box, _extends({
|
|
20
|
+
flexible: true,
|
|
21
|
+
style: style,
|
|
22
|
+
dataId: dataId,
|
|
23
|
+
className: className,
|
|
24
|
+
onScroll: onScroll,
|
|
25
|
+
dataSelectorId: dataSelectorId,
|
|
26
|
+
tagName: tagName
|
|
27
|
+
}, a11y), React.Children.map(children, child => /*#__PURE__*/React.isValidElement(child) && child.props.id === selectedTab ? child : null));
|
|
31
28
|
|
|
32
29
|
TabContentWrapper.defaultProps = TabContentWrapper_defaultProps;
|
|
33
30
|
TabContentWrapper.propTypes = TabContentWrapper_propTypes;
|
package/es/Tab/TabWrapper.js
CHANGED
|
@@ -6,22 +6,21 @@ import { TabWrapper_propTypes } from "./props/propTypes";
|
|
|
6
6
|
import { Container } from "../Layout";
|
|
7
7
|
import { TAB_ALIGN_MAPPING } from "./utils/tabConfigs";
|
|
8
8
|
|
|
9
|
-
function TabWrapper(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
} = _ref;
|
|
9
|
+
function TabWrapper({
|
|
10
|
+
defaultTab,
|
|
11
|
+
hookToDisableInternalState,
|
|
12
|
+
onSelect,
|
|
13
|
+
type,
|
|
14
|
+
isAnimate,
|
|
15
|
+
needTabBorder,
|
|
16
|
+
needBorder,
|
|
17
|
+
needPadding,
|
|
18
|
+
needAppearance,
|
|
19
|
+
align,
|
|
20
|
+
dataId,
|
|
21
|
+
children,
|
|
22
|
+
dataSelectorId
|
|
23
|
+
}) {
|
|
25
24
|
let [selectedTabInternal, setSelected] = useState(!hookToDisableInternalState ? defaultTab || 0 : null);
|
|
26
25
|
const setSelectedTab = useCallback(id => {
|
|
27
26
|
if (!hookToDisableInternalState) {
|
package/es/Tab/Tabs.js
CHANGED
|
@@ -4,8 +4,9 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
4
4
|
|
|
5
5
|
/* eslint css-modules/no-unused-class: [2, {
|
|
6
6
|
markAsUsed: [
|
|
7
|
-
'hidden','alpha','gamma','beta','delta','special','text','maxWidth','widgetList','menuContainer','border','tabText','block','tabAlpha','alphaActive','gammaActive','betaActive','deltaActive','tabGamma','tabBeta','tabDelta','specialActive','tabSpecial',
|
|
8
|
-
'alpha_padding','alpha_border','gamma_padding','gamma_border','beta_padding','beta_border','delta_padding','delta_border','textContainer','disabled','alphaActive_border','gammaActive_border','betaActive_border','deltaActive_border'
|
|
7
|
+
'hidden','alpha','gamma','beta','delta','default','special','text','maxWidth','widgetList','menuContainer','border','tabText','block','tabAlpha','alphaActive','gammaActive','betaActive','deltaActive','tabGamma','tabBeta','tabDelta','specialActive','tabSpecial',
|
|
8
|
+
'alpha_padding','alpha_border','gamma_padding','gamma_border','beta_padding','beta_border','delta_padding','delta_border','default_padding','default_border','textContainer','disabled','alphaActive_border','gammaActive_border','betaActive_border','deltaActive_border',
|
|
9
|
+
'defaultMoreButton','defaultMoreButtonActive','defaultMenuListItem'
|
|
9
10
|
]
|
|
10
11
|
}]
|
|
11
12
|
*/
|
|
@@ -18,13 +19,14 @@ import { remConvert, getTotalDimension, cs, bind, throttle, cancelBubblingEffect
|
|
|
18
19
|
import { Box, Container } from "../Layout";
|
|
19
20
|
import ResizeObserver from "../Responsive/ResizeObserver";
|
|
20
21
|
import ListItem from "../ListItem/ListItem";
|
|
22
|
+
import ListItemWithIcon from "../ListItem/ListItemWithIcon";
|
|
21
23
|
import { Icon } from '@zohodesk/icons';
|
|
22
24
|
import tabsStyle from "./Tabs.module.css";
|
|
23
25
|
import Popup from "../Popup/Popup";
|
|
24
26
|
import TextBoxIcon from "../TextBoxIcon/TextBoxIcon";
|
|
25
27
|
import ResponsiveDropBox from "../ResponsiveDropBox/ResponsiveDropBox";
|
|
26
28
|
import { ResponsiveReceiver } from "../Responsive/CustomResponsive";
|
|
27
|
-
import { TAB_DIRECTION_MAPPING, TAB_POPUP_POSITION_MAPPING } from "./utils/tabConfigs";
|
|
29
|
+
import { TAB_DIRECTION_MAPPING, TAB_POPUP_POSITION_MAPPING, VARIANT } from "./utils/tabConfigs";
|
|
28
30
|
import btnstyle from "../semantic/Button/semanticButton.module.css";
|
|
29
31
|
|
|
30
32
|
class Tabs extends React.Component {
|
|
@@ -107,8 +109,7 @@ class Tabs extends React.Component {
|
|
|
107
109
|
}
|
|
108
110
|
}
|
|
109
111
|
|
|
110
|
-
setMaxDim() {
|
|
111
|
-
let totalDimension = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
112
|
+
setMaxDim(totalDimension = 0) {
|
|
112
113
|
let {
|
|
113
114
|
selectedTab
|
|
114
115
|
} = this.props; // let actual = Object.keys(tabDimensions).reduce(
|
|
@@ -409,10 +410,9 @@ class Tabs extends React.Component {
|
|
|
409
410
|
togglePopup(e, boxPosition);
|
|
410
411
|
}
|
|
411
412
|
|
|
412
|
-
responsiveFunc(
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
} = _ref;
|
|
413
|
+
responsiveFunc({
|
|
414
|
+
mediaQueryOR
|
|
415
|
+
}) {
|
|
416
416
|
return {
|
|
417
417
|
tabletMode: mediaQueryOR([{
|
|
418
418
|
maxWidth: 700
|
|
@@ -432,10 +432,9 @@ class Tabs extends React.Component {
|
|
|
432
432
|
});
|
|
433
433
|
}
|
|
434
434
|
|
|
435
|
-
getMoreList(
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
} = _ref2;
|
|
435
|
+
getMoreList({
|
|
436
|
+
moreTabs
|
|
437
|
+
}) {
|
|
439
438
|
const validElements = [];
|
|
440
439
|
React.Children.map(moreTabs, child => {
|
|
441
440
|
const isValidElement = /*#__PURE__*/React.isValidElement(child);
|
|
@@ -447,10 +446,9 @@ class Tabs extends React.Component {
|
|
|
447
446
|
return validElements;
|
|
448
447
|
}
|
|
449
448
|
|
|
450
|
-
handleFilterSuggestions(
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
} = _ref3;
|
|
449
|
+
handleFilterSuggestions({
|
|
450
|
+
moreTabs
|
|
451
|
+
}) {
|
|
454
452
|
const {
|
|
455
453
|
showTitleInMoreOptions
|
|
456
454
|
} = this.props;
|
|
@@ -534,6 +532,10 @@ class Tabs extends React.Component {
|
|
|
534
532
|
moreTabs
|
|
535
533
|
});
|
|
536
534
|
const hasSearch = moreTabs.length > 4;
|
|
535
|
+
const isDefaultType = type === 'default';
|
|
536
|
+
const defaultMoreClass = isDefaultType ? tabsStyle.defaultMoreButton : '';
|
|
537
|
+
const defaultMoreActiveClass = isDefaultType ? tabsStyle.defaultMoreButtonActive : '';
|
|
538
|
+
const effectiveMenuItemClass = isDefaultType ? `${tabsStyle.defaultMenuListItem}${menuItemClass ? ` ${menuItemClass}` : ''}` : menuItemClass;
|
|
537
539
|
return /*#__PURE__*/React.createElement(React.Fragment, null, React.Children.map(mainTabs, child => {
|
|
538
540
|
if (!child) {
|
|
539
541
|
return null;
|
|
@@ -567,7 +569,7 @@ class Tabs extends React.Component {
|
|
|
567
569
|
className: `${tabsStyle.menu} `,
|
|
568
570
|
dataSelectorId: `${dataSelectorId}_moreIcon`
|
|
569
571
|
}, /*#__PURE__*/React.createElement(Container, _extends({
|
|
570
|
-
className: `${btnstyle.buttonReset} ${moreButtonClass} ${isPopupOpen ? moreButtonActiveClass : ''}`,
|
|
572
|
+
className: `${btnstyle.buttonReset} ${defaultMoreClass} ${moreButtonClass} ${isPopupOpen ? `${defaultMoreActiveClass} ${moreButtonActiveClass}` : ''}`,
|
|
571
573
|
align: "both",
|
|
572
574
|
onClick: this.togglePopup,
|
|
573
575
|
dataId: "moreTabs",
|
|
@@ -582,66 +584,70 @@ class Tabs extends React.Component {
|
|
|
582
584
|
})), isPopupOpen && /*#__PURE__*/React.createElement(ResponsiveReceiver, {
|
|
583
585
|
query: this.responsiveFunc,
|
|
584
586
|
responsiveId: "Helmet"
|
|
585
|
-
},
|
|
587
|
+
}, ({
|
|
588
|
+
tabletMode
|
|
589
|
+
}) => /*#__PURE__*/React.createElement(ResponsiveDropBox, _extends({
|
|
590
|
+
isActive: isPopupReady,
|
|
591
|
+
isAnimate: true,
|
|
592
|
+
size: "medium",
|
|
593
|
+
customClass: {
|
|
594
|
+
customDropBoxWrap: `${moreContainerClass} ${popupClass}`
|
|
595
|
+
},
|
|
596
|
+
boxPosition: position,
|
|
597
|
+
getRef: getContainerRef,
|
|
598
|
+
isBoxPaddingNeed: false,
|
|
599
|
+
isArrow: false,
|
|
600
|
+
isAbsolutePositioningNeeded: isAbsolutePositioningNeeded,
|
|
601
|
+
isRestrictScroll: isRestrictScroll,
|
|
602
|
+
positionsOffset: positionsOffset,
|
|
603
|
+
targetOffset: targetOffset
|
|
604
|
+
}, DropBoxProps, {
|
|
605
|
+
isResponsivePadding: true,
|
|
606
|
+
needFocusScope: true,
|
|
607
|
+
dataId: `${dataId}_dropbox`,
|
|
608
|
+
onClick: removeClose,
|
|
609
|
+
onClose: this.togglePopup
|
|
610
|
+
}), getCustomDropBoxHeaderPlaceHolder && getCustomDropBoxHeaderPlaceHolder(this.props), hasSearch ? /*#__PURE__*/React.createElement(Box, {
|
|
611
|
+
className: tabsStyle.search
|
|
612
|
+
}, /*#__PURE__*/React.createElement(TextBoxIcon, _extends({
|
|
613
|
+
placeHolder: placeHolderText,
|
|
614
|
+
onChange: this.handleChange,
|
|
615
|
+
value: searchValue,
|
|
616
|
+
onClear: this.handleSearchValueClear,
|
|
617
|
+
size: searchBoxSize,
|
|
618
|
+
customProps: {
|
|
619
|
+
TextBoxProps: {
|
|
620
|
+
'data-a11y-autofocus': true
|
|
621
|
+
}
|
|
622
|
+
},
|
|
623
|
+
dataId: `${dataId}_search`,
|
|
624
|
+
autoComplete: false,
|
|
625
|
+
name: "search"
|
|
626
|
+
}, TextBoxIconProps))) : null, /*#__PURE__*/React.createElement(Box, {
|
|
627
|
+
flexible: true,
|
|
628
|
+
shrink: true,
|
|
629
|
+
scroll: "vertical",
|
|
630
|
+
className: `${tabsStyle.listWrapper} ${tabletMode ? '' : tabsStyle.menuBox} ${moreBoxClass}`,
|
|
631
|
+
onScroll: this.onScroll,
|
|
632
|
+
dataId: `${dataId}_Tabs`
|
|
633
|
+
}, moreTabsListItems.length ? moreTabsListItems.map(data => {
|
|
586
634
|
let {
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
targetOffset: targetOffset
|
|
604
|
-
}, DropBoxProps, {
|
|
605
|
-
isResponsivePadding: true,
|
|
606
|
-
needFocusScope: true,
|
|
607
|
-
dataId: `${dataId}_dropbox`,
|
|
608
|
-
onClick: removeClose,
|
|
609
|
-
onClose: this.togglePopup
|
|
610
|
-
}), getCustomDropBoxHeaderPlaceHolder && getCustomDropBoxHeaderPlaceHolder(this.props), hasSearch ? /*#__PURE__*/React.createElement(Box, {
|
|
611
|
-
className: tabsStyle.search
|
|
612
|
-
}, /*#__PURE__*/React.createElement(TextBoxIcon, _extends({
|
|
613
|
-
placeHolder: placeHolderText,
|
|
614
|
-
onChange: this.handleChange,
|
|
615
|
-
value: searchValue,
|
|
616
|
-
onClear: this.handleSearchValueClear,
|
|
617
|
-
size: searchBoxSize,
|
|
618
|
-
customProps: {
|
|
619
|
-
TextBoxProps: {
|
|
620
|
-
'data-a11y-autofocus': true
|
|
621
|
-
}
|
|
622
|
-
},
|
|
623
|
-
dataId: `${dataId}_search`,
|
|
624
|
-
autoComplete: false,
|
|
625
|
-
name: "search"
|
|
626
|
-
}, TextBoxIconProps))) : null, /*#__PURE__*/React.createElement(Box, {
|
|
627
|
-
flexible: true,
|
|
628
|
-
shrink: true,
|
|
629
|
-
scroll: "vertical",
|
|
630
|
-
className: `${tabsStyle.listWrapper} ${tabletMode ? '' : tabsStyle.menuBox} ${moreBoxClass}`,
|
|
631
|
-
onScroll: this.onScroll,
|
|
632
|
-
dataId: `${dataId}_Tabs`
|
|
633
|
-
}, moreTabsListItems.length ? moreTabsListItems.map(data => {
|
|
634
|
-
let {
|
|
635
|
-
text,
|
|
636
|
-
id,
|
|
637
|
-
title,
|
|
638
|
-
isLink,
|
|
639
|
-
href,
|
|
640
|
-
children,
|
|
641
|
-
dataId
|
|
642
|
-
} = data;
|
|
643
|
-
const value = text ? text : showTitleInMoreOptions ? title : null;
|
|
644
|
-
return /*#__PURE__*/React.createElement(ListItem, _extends({
|
|
635
|
+
text,
|
|
636
|
+
id,
|
|
637
|
+
title,
|
|
638
|
+
isLink,
|
|
639
|
+
href,
|
|
640
|
+
children,
|
|
641
|
+
dataId,
|
|
642
|
+
variant,
|
|
643
|
+
iconName,
|
|
644
|
+
iconSize
|
|
645
|
+
} = data;
|
|
646
|
+
const value = text ? text : showTitleInMoreOptions ? title : null;
|
|
647
|
+
const showIconInDropdown = variant !== VARIANT.TEXT && iconName;
|
|
648
|
+
|
|
649
|
+
if (showIconInDropdown) {
|
|
650
|
+
return /*#__PURE__*/React.createElement(ListItemWithIcon, _extends({
|
|
645
651
|
key: id,
|
|
646
652
|
value: value,
|
|
647
653
|
onClick: this.moreTabSelect,
|
|
@@ -650,14 +656,32 @@ class Tabs extends React.Component {
|
|
|
650
656
|
isLink: isLink,
|
|
651
657
|
href: href,
|
|
652
658
|
autoHover: true,
|
|
659
|
+
iconName: iconName,
|
|
660
|
+
iconSize: iconSize,
|
|
653
661
|
customClass: {
|
|
654
|
-
customListItem:
|
|
662
|
+
customListItem: effectiveMenuItemClass
|
|
655
663
|
},
|
|
656
664
|
target: "self",
|
|
657
665
|
dataId: `${dataId}_Tab`
|
|
658
|
-
}, ListItemProps)
|
|
659
|
-
}
|
|
660
|
-
|
|
666
|
+
}, ListItemProps));
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
return /*#__PURE__*/React.createElement(ListItem, _extends({
|
|
670
|
+
key: id,
|
|
671
|
+
value: value,
|
|
672
|
+
onClick: this.moreTabSelect,
|
|
673
|
+
id: id,
|
|
674
|
+
title: title || text,
|
|
675
|
+
isLink: isLink,
|
|
676
|
+
href: href,
|
|
677
|
+
autoHover: true,
|
|
678
|
+
customClass: {
|
|
679
|
+
customListItem: effectiveMenuItemClass
|
|
680
|
+
},
|
|
681
|
+
target: "self",
|
|
682
|
+
dataId: `${dataId}_Tab`
|
|
683
|
+
}, ListItemProps), !showTitleInMoreOptions ? children : null);
|
|
684
|
+
}) : this.renderEmptyState())))) : null);
|
|
661
685
|
}
|
|
662
686
|
|
|
663
687
|
render() {
|
package/es/Tab/Tabs.module.css
CHANGED
|
@@ -82,6 +82,51 @@
|
|
|
82
82
|
border-bottom: 1px dotted var(--zdt_tabs_alpha_border);
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
.default {
|
|
86
|
+
height: var(--zd_size35) ;
|
|
87
|
+
transition: padding var(--zd_transition3);
|
|
88
|
+
z-index: 2;
|
|
89
|
+
background-color: var(--zd-bg-secondary);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.default_padding {
|
|
93
|
+
padding-inline-start: var(--zd_size10) ;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.default_border {
|
|
97
|
+
border-bottom: 1px solid var(--zd-border-primary);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.defaultMoreButton {
|
|
101
|
+
max-height: var(--zd_size28) ;
|
|
102
|
+
color: var(--zd-text-secondary);
|
|
103
|
+
padding: var(--zd_size6) ;
|
|
104
|
+
border: 1px solid var(--zd-border-transparent);
|
|
105
|
+
border-radius: 4px;
|
|
106
|
+
margin-top: var(--zd_size3) ;
|
|
107
|
+
cursor: pointer;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.defaultMoreButton:hover {
|
|
111
|
+
border-color: var(--zdt_rippleeffect_navy_border);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.defaultMoreButtonActive {
|
|
115
|
+
border-color: var(--zdt_cta_secondary_light_border);
|
|
116
|
+
background: var(--zd-bg-brandLight);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.defaultMoreButtonActive:hover {
|
|
120
|
+
border-color: var(--zdt_cta_secondary_light_border);
|
|
121
|
+
background: var(--zd-bg-brandLight);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.defaultMenuListItem {
|
|
125
|
+
font-size: var(--zd_font_size11) ;
|
|
126
|
+
text-transform: uppercase;
|
|
127
|
+
letter-spacing: 0.4px;
|
|
128
|
+
}
|
|
129
|
+
|
|
85
130
|
.delta .highlight {
|
|
86
131
|
border-color: var(--zdt_tabs_delta_border);
|
|
87
132
|
}
|
|
@@ -126,7 +171,7 @@
|
|
|
126
171
|
|
|
127
172
|
.search {
|
|
128
173
|
padding-block: var(--zd_size6) 0 ;
|
|
129
|
-
padding-inline:var(--zd_size20) ;
|
|
174
|
+
padding-inline: var(--zd_size20) ;
|
|
130
175
|
}
|
|
131
176
|
|
|
132
177
|
.emptyStateContainer {
|
|
@@ -153,5 +198,5 @@
|
|
|
153
198
|
|
|
154
199
|
.listWrapper {
|
|
155
200
|
padding-block: var(--zd_size10) ;
|
|
156
|
-
padding-inline:0 ;
|
|
157
|
-
}
|
|
201
|
+
padding-inline: 0 ;
|
|
202
|
+
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render } from '@testing-library/react';
|
|
3
3
|
import Tab from "../Tab";
|
|
4
|
+
|
|
5
|
+
const noop = () => {};
|
|
6
|
+
|
|
4
7
|
describe('Tab', () => {
|
|
5
8
|
test('rendering the defult props', () => {
|
|
6
9
|
const {
|
|
@@ -8,4 +11,113 @@ describe('Tab', () => {
|
|
|
8
11
|
} = render( /*#__PURE__*/React.createElement(Tab, null));
|
|
9
12
|
expect(asFragment()).toMatchSnapshot();
|
|
10
13
|
});
|
|
14
|
+
describe('variant-based label rendering', () => {
|
|
15
|
+
test('variant="text" renders text only', () => {
|
|
16
|
+
const {
|
|
17
|
+
asFragment
|
|
18
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
19
|
+
id: "t1",
|
|
20
|
+
text: "Home",
|
|
21
|
+
variant: "text",
|
|
22
|
+
onSelect: noop
|
|
23
|
+
}));
|
|
24
|
+
expect(asFragment()).toMatchSnapshot();
|
|
25
|
+
});
|
|
26
|
+
test('variant="icon" renders icon and suppresses text label', () => {
|
|
27
|
+
const {
|
|
28
|
+
asFragment
|
|
29
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
30
|
+
id: "t2",
|
|
31
|
+
text: "Home",
|
|
32
|
+
variant: "icon",
|
|
33
|
+
iconName: "ZD-TB-menu",
|
|
34
|
+
onSelect: noop
|
|
35
|
+
}));
|
|
36
|
+
expect(asFragment()).toMatchSnapshot();
|
|
37
|
+
});
|
|
38
|
+
test('variant="iconWithText" renders icon followed by text', () => {
|
|
39
|
+
const {
|
|
40
|
+
asFragment
|
|
41
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
42
|
+
id: "t3",
|
|
43
|
+
text: "Home",
|
|
44
|
+
variant: "iconWithText",
|
|
45
|
+
iconName: "ZD-TB-menu",
|
|
46
|
+
onSelect: noop
|
|
47
|
+
}));
|
|
48
|
+
expect(asFragment()).toMatchSnapshot();
|
|
49
|
+
});
|
|
50
|
+
test('renderIcon overrides iconName', () => {
|
|
51
|
+
const {
|
|
52
|
+
asFragment
|
|
53
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
54
|
+
id: "t4",
|
|
55
|
+
text: "Home",
|
|
56
|
+
variant: "iconWithText",
|
|
57
|
+
renderIcon: /*#__PURE__*/React.createElement("span", null, "\u2605"),
|
|
58
|
+
iconName: "ZD-TB-menu",
|
|
59
|
+
onSelect: noop
|
|
60
|
+
}));
|
|
61
|
+
expect(asFragment()).toMatchSnapshot();
|
|
62
|
+
});
|
|
63
|
+
test('renderIcon as function receives no args and renders custom node', () => {
|
|
64
|
+
const {
|
|
65
|
+
asFragment
|
|
66
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
67
|
+
id: "t5",
|
|
68
|
+
text: "Home",
|
|
69
|
+
variant: "icon",
|
|
70
|
+
renderIcon: () => /*#__PURE__*/React.createElement("span", null, "\u2605"),
|
|
71
|
+
onSelect: noop
|
|
72
|
+
}));
|
|
73
|
+
expect(asFragment()).toMatchSnapshot();
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
describe('renderBefore / renderAfter slots', () => {
|
|
77
|
+
test('renderBefore renders a node to the left of the label', () => {
|
|
78
|
+
const {
|
|
79
|
+
asFragment
|
|
80
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
81
|
+
id: "t6",
|
|
82
|
+
text: "Home",
|
|
83
|
+
renderBefore: /*#__PURE__*/React.createElement("span", null, "\u25C0"),
|
|
84
|
+
onSelect: noop
|
|
85
|
+
}));
|
|
86
|
+
expect(asFragment()).toMatchSnapshot();
|
|
87
|
+
});
|
|
88
|
+
test('renderAfter renders a node to the right of the label', () => {
|
|
89
|
+
const {
|
|
90
|
+
asFragment
|
|
91
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
92
|
+
id: "t7",
|
|
93
|
+
text: "Home",
|
|
94
|
+
renderAfter: /*#__PURE__*/React.createElement("span", null, "3"),
|
|
95
|
+
onSelect: noop
|
|
96
|
+
}));
|
|
97
|
+
expect(asFragment()).toMatchSnapshot();
|
|
98
|
+
});
|
|
99
|
+
test('renderBefore and renderAfter both render around the label', () => {
|
|
100
|
+
const {
|
|
101
|
+
asFragment
|
|
102
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
103
|
+
id: "t8",
|
|
104
|
+
text: "Home",
|
|
105
|
+
renderBefore: /*#__PURE__*/React.createElement("span", null, "\u25C0"),
|
|
106
|
+
renderAfter: /*#__PURE__*/React.createElement("span", null, "\u25B6"),
|
|
107
|
+
onSelect: noop
|
|
108
|
+
}));
|
|
109
|
+
expect(asFragment()).toMatchSnapshot();
|
|
110
|
+
});
|
|
111
|
+
test('renderBefore as function renders custom node', () => {
|
|
112
|
+
const {
|
|
113
|
+
asFragment
|
|
114
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
115
|
+
id: "t9",
|
|
116
|
+
text: "Home",
|
|
117
|
+
renderBefore: () => /*#__PURE__*/React.createElement("span", null, "\u25C0"),
|
|
118
|
+
onSelect: noop
|
|
119
|
+
}));
|
|
120
|
+
expect(asFragment()).toMatchSnapshot();
|
|
121
|
+
});
|
|
122
|
+
});
|
|
11
123
|
});
|