@zohodesk/components 1.0.0-temp-259.5 → 1.0.0-temp-262
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/CHANGELOG.md +37 -0
- package/assets/Appearance/dark/mode/Component_v1_DarkMode.module.css +20 -0
- package/assets/Appearance/dark/themes/blue/blue_componentsCTA_DarkModifyCategory.module.css +2 -0
- package/assets/Appearance/dark/themes/green/green_componentsCTA_DarkModifyCategory.module.css +2 -0
- package/assets/Appearance/dark/themes/orange/orange_componentsCTA_DarkModifyCategory.module.css +2 -0
- package/assets/Appearance/dark/themes/red/red_componentsCTA_DarkModifyCategory.module.css +2 -0
- package/assets/Appearance/dark/themes/yellow/yellow_componentsCTA_DarkModifyCategory.module.css +2 -0
- package/assets/Appearance/light/mode/Component_LightMode.module.css +1 -1
- package/assets/Appearance/light/mode/Component_v1_LightMode.module.css +20 -0
- package/assets/Appearance/light/themes/blue/blue_componentsCTA_LightModifyCategory.module.css +2 -0
- package/assets/Appearance/light/themes/green/green_componentsCTA_LightModifyCategory.module.css +2 -0
- package/assets/Appearance/light/themes/orange/orange_componentsCTA_LightModifyCategory.module.css +2 -0
- package/assets/Appearance/light/themes/red/red_componentsCTA_LightModifyCategory.module.css +2 -0
- package/assets/Appearance/light/themes/yellow/yellow_componentsCTA_LightModifyCategory.module.css +2 -0
- package/assets/Appearance/pureDark/mode/Component_v1_PureDarkMode.module.css +20 -0
- package/assets/Appearance/pureDark/themes/blue/blue_componentsCTA_PureDarkModifyCategory.module.css +2 -0
- package/assets/Appearance/pureDark/themes/green/green_componentsCTA_PureDarkModifyCategory.module.css +2 -0
- package/assets/Appearance/pureDark/themes/orange/orange_componentsCTA_PureDarkModifyCategory.module.css +2 -0
- package/assets/Appearance/pureDark/themes/red/red_componentsCTA_PureDarkModifyCategory.module.css +2 -0
- package/assets/Appearance/pureDark/themes/yellow/yellow_componentsCTA_PureDarkModifyCategory.module.css +2 -0
- package/cbt.config.js +1 -0
- package/es/Accordion/__tests__/Accordion.spec.js +117 -3
- package/es/Accordion/__tests__/AccordionItem.spec.js +118 -6
- package/es/Accordion/__tests__/__snapshots__/Accordion.spec.js.snap +344 -2
- package/es/Accordion/__tests__/__snapshots__/AccordionItem.spec.js.snap +155 -3
- package/es/Animation/__tests__/Animation.spec.js +28 -4
- package/es/Animation/__tests__/__snapshots__/Animation.spec.js.snap +92 -2
- package/es/Avatar/Avatar.module.css +5 -11
- package/es/AvatarTeam/AvatarTeam.module.css +1 -3
- package/es/Button/css/Button.module.css +8 -12
- package/es/Card/Card.module.css +2 -2
- package/es/CheckBox/CheckBox.js +1 -1
- package/es/CheckBox/CheckBox.module.css +4 -6
- package/es/CheckBox/__tests__/__snapshots__/CheckBox.spec.js.snap +1 -1
- package/es/DateTime/DateTime.module.css +15 -22
- package/es/DateTime/DateWidget.js +1 -1
- package/es/DateTime/DateWidget.module.css +10 -5
- package/es/DateTime/YearView.module.css +6 -9
- package/es/DateTime/__tests__/CalendarView.spec.js +70 -3
- package/es/DateTime/__tests__/DateTime.spec.js +89 -6
- package/es/DateTime/__tests__/DateTimePopupFooter.spec.js +20 -2
- package/es/DateTime/__tests__/DateTimePopupHeader.spec.js +29 -2
- package/es/DateTime/__tests__/DateWidget.spec.js +34 -2
- package/es/DateTime/__tests__/DaysRow.spec.js +19 -3
- package/es/DateTime/__tests__/Time.spec.js +50 -3
- package/es/DateTime/__tests__/YearView.spec.js +60 -3
- package/es/DateTime/__tests__/__snapshots__/CalendarView.spec.js.snap +2907 -170
- package/es/DateTime/__tests__/__snapshots__/DateTime.spec.js.snap +4392 -108
- package/es/DateTime/__tests__/__snapshots__/DateTimePopupFooter.spec.js.snap +67 -1
- package/es/DateTime/__tests__/__snapshots__/DateTimePopupHeader.spec.js.snap +187 -1
- package/es/DateTime/__tests__/__snapshots__/DateWidget.spec.js.snap +266 -2
- package/es/DateTime/__tests__/__snapshots__/DaysRow.spec.js.snap +155 -2
- package/es/DateTime/__tests__/__snapshots__/Time.spec.js.snap +522 -5
- package/es/DateTime/__tests__/__snapshots__/YearView.spec.js.snap +540 -0
- package/es/DividerLine/DividerLine.js +40 -0
- package/es/DividerLine/__tests__/DividerLine.spec.js +81 -0
- package/es/DividerLine/__tests__/__snapshots__/DividerLine.spec.js.snap +131 -0
- package/es/DividerLine/constants/index.js +29 -0
- package/es/DividerLine/css/DividerLine.module.css +51 -0
- package/es/DividerLine/css/cssJSLogic.js +1 -0
- package/es/DividerLine/css/dividerLine.cva.js +42 -0
- package/es/DividerLine/props/defaultProps.js +11 -0
- package/es/DividerLine/props/propTypes.js +19 -0
- package/es/DropBox/DropBoxElement/css/DropBoxElement.module.css +7 -11
- package/es/DropBox/css/DropBox.module.css +3 -3
- package/es/DropDown/DropDownHeading.module.css +1 -1
- package/es/DropDown/DropDownItem.module.css +3 -7
- package/es/DropDown/DropDownSeparator.js +9 -4
- package/es/DropDown/DropDownSeparator.module.css +0 -4
- package/es/DropDown/__tests__/DropDownSeparator.spec.js +8 -0
- package/es/DropDown/__tests__/__snapshots__/DropDownSeparator.spec.js.snap +12 -2
- package/es/Heading/Heading.module.css +1 -1
- package/es/Heading/__tests__/Heading.spec.js +57 -3
- package/es/Heading/__tests__/__snapshots__/Heading.spec.js.snap +87 -14
- package/es/Label/Label.module.css +3 -3
- package/es/ListItem/ListItem.module.css +9 -13
- package/es/ListItem/__tests__/ListContainer.spec.js +228 -1
- package/es/ListItem/__tests__/ListItem.spec.js +359 -1
- package/es/ListItem/__tests__/ListItemWithAvatar.spec.js +390 -1
- package/es/ListItem/__tests__/ListItemWithCheckBox.spec.js +214 -1
- package/es/ListItem/__tests__/ListItemWithIcon.spec.js +303 -1
- package/es/ListItem/__tests__/ListItemWithRadio.spec.js +230 -1
- package/es/ListItem/__tests__/__snapshots__/ListContainer.spec.js.snap +602 -0
- package/es/ListItem/__tests__/__snapshots__/ListItem.spec.js.snap +1807 -0
- package/es/ListItem/__tests__/__snapshots__/ListItemWithAvatar.spec.js.snap +2703 -0
- package/es/ListItem/__tests__/__snapshots__/ListItemWithCheckBox.spec.js.snap +2909 -0
- package/es/ListItem/__tests__/__snapshots__/ListItemWithIcon.spec.js.snap +2009 -0
- package/es/ListItem/__tests__/__snapshots__/ListItemWithRadio.spec.js.snap +3070 -0
- package/es/MultiSelect/AdvancedGroupMultiSelect.js +1 -0
- package/es/MultiSelect/AdvancedMultiSelect.js +1 -0
- package/es/MultiSelect/MobileHeader/MobileHeader.module.css +1 -1
- package/es/MultiSelect/MultiSelect.module.css +13 -21
- package/es/MultiSelect/SelectedOptions.js +3 -3
- package/es/MultiSelect/SelectedOptions.module.css +1 -1
- package/es/MultiSelect/__tests__/AdvancedGroupMultiSelect.spec.js +713 -1
- package/es/MultiSelect/__tests__/AdvancedMultiSelect.spec.js +740 -1
- package/es/MultiSelect/__tests__/EmptyState.spec.js +268 -1
- package/es/MultiSelect/__tests__/MultiSelect.spec.js +899 -2
- package/es/MultiSelect/__tests__/MultiSelectHeader.spec.js +50 -1
- package/es/MultiSelect/__tests__/MultiSelectWithAvatar.spec.js +487 -1
- package/es/MultiSelect/__tests__/SelectedOptions.spec.js +291 -1
- package/es/MultiSelect/__tests__/Suggestions.spec.js +370 -2
- package/es/MultiSelect/__tests__/__snapshots__/AdvancedGroupMultiSelect.spec.js.snap +11906 -0
- package/es/MultiSelect/__tests__/__snapshots__/AdvancedMultiSelect.spec.js.snap +12180 -0
- package/es/MultiSelect/__tests__/__snapshots__/EmptyState.spec.js.snap +253 -0
- package/es/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +14209 -0
- package/es/MultiSelect/__tests__/__snapshots__/MultiSelectHeader.spec.js.snap +136 -0
- package/es/MultiSelect/__tests__/__snapshots__/MultiSelectWithAvatar.spec.js.snap +11506 -0
- package/es/MultiSelect/__tests__/__snapshots__/SelectedOptions.spec.js.snap +1382 -0
- package/es/MultiSelect/__tests__/__snapshots__/Suggestions.spec.js.snap +3611 -0
- package/es/PopOver/PopOver.module.css +2 -2
- package/es/PopOver/__tests__/PopOver.spec.js +141 -2
- package/es/PopOver/__tests__/__snapshots__/PopOver.spec.js.snap +1260 -0
- package/es/Radio/Radio.module.css +8 -8
- package/es/ResponsiveDropBox/__tests__/ResponsiveDropBox.spec.js +212 -1
- package/es/ResponsiveDropBox/__tests__/__snapshots__/ResponsiveDropBox.spec.js.snap +1802 -0
- package/es/Ribbon/Ribbon.module.css +12 -19
- package/es/RippleEffect/RippleEffect.module.css +2 -2
- package/es/Select/Select.module.css +4 -4
- package/es/Select/SelectWithAvatar.js +14 -3
- package/es/Select/SelectWithIcon.js +23 -1
- package/es/Select/__tests__/SelectWithAvatar.spec.js +17 -0
- package/es/Select/__tests__/SelectWithIcon.spec.js +18 -0
- package/es/Select/__tests__/__snapshots__/SelectWithAvatar.spec.js.snap +47 -0
- package/es/Select/__tests__/__snapshots__/SelectWithIcon.spec.js.snap +19 -0
- package/es/Select/props/propTypes.js +1 -0
- package/es/Switch/Switch.module.css +4 -7
- package/es/Tab/Tab.module.css +5 -8
- package/es/Tab/TabContent.module.css +1 -1
- package/es/Tab/Tabs.module.css +8 -10
- package/es/Tab/__tests__/Tab.spec.js +249 -1
- package/es/Tab/__tests__/TabContent.spec.js +34 -1
- package/es/Tab/__tests__/TabContentWrapper.spec.js +72 -1
- package/es/Tab/__tests__/TabWrapper.spec.js +163 -1
- package/es/Tab/__tests__/Tabs.spec.js +681 -1
- package/es/Tab/__tests__/__snapshots__/Tab.spec.js.snap +1049 -0
- package/es/Tab/__tests__/__snapshots__/TabContent.spec.js.snap +99 -0
- package/es/Tab/__tests__/__snapshots__/TabContentWrapper.spec.js.snap +121 -0
- package/es/Tab/__tests__/__snapshots__/TabWrapper.spec.js.snap +2002 -0
- package/es/Tab/__tests__/__snapshots__/Tabs.spec.js.snap +11053 -0
- package/es/Tag/Tag.module.css +4 -7
- package/es/TextBoxIcon/TextBoxIcon.module.css +1 -1
- package/es/Textarea/Textarea.module.css +4 -5
- package/es/Tooltip/Tooltip.js +4 -1
- package/es/Tooltip/Tooltip.module.css +3 -7
- package/es/Tooltip/__tests__/Tooltip.spec.js +590 -0
- package/es/Tooltip/__tests__/__snapshots__/Tooltip.spec.js.snap +813 -0
- package/es/Typography/css/Typography.module.css +33 -40
- package/es/common/animation.module.css +8 -8
- package/es/common/basic.module.css +5 -5
- package/es/common/common.module.css +85 -157
- package/es/common/transition.module.css +2 -0
- package/es/index.d.ts +39 -0
- package/es/index.js +12 -12
- package/es/semantic/Button/semanticButton.module.css +1 -5
- package/es/shared/InputFieldLine/InputFieldLine.module.css +1 -1
- package/es/v1/Button/__tests__/__snapshots__/Button.spec.js.snap +1 -1
- package/es/v1/Button/css/Button_v1.module.css +2 -3
- package/es/v1/Label/css/Label_v1.module.css +1 -1
- package/es/v1/Switch/css/Switch_v1.module.css +5 -9
- package/es/v1/Tab/Tab.js +150 -0
- package/es/v1/Tab/TabList.js +145 -0
- package/es/v1/Tab/TabMoreMenu.js +245 -0
- package/es/v1/Tab/TabPanel.js +51 -0
- package/es/v1/Tab/Tabs.js +125 -0
- package/es/v1/Tab/__tests__/Tab.spec.js +824 -0
- package/es/v1/Tab/__tests__/__snapshots__/Tab.spec.js.snap +4684 -0
- package/es/v1/Tab/constants/index.js +105 -0
- package/es/v1/Tab/constants/presets.js +22 -0
- package/es/v1/Tab/context.js +19 -0
- package/es/v1/Tab/core/Tab.js +60 -0
- package/es/v1/Tab/core/TabList.js +51 -0
- package/es/v1/Tab/core/TabListFocusScope.js +18 -0
- package/es/v1/Tab/core/TabPanel.js +54 -0
- package/es/v1/Tab/core/Tabs.js +45 -0
- package/es/v1/Tab/core/index.js +6 -0
- package/es/v1/Tab/css/Tab_v1.module.css +369 -0
- package/es/v1/Tab/css/cssJSLogic.js +1 -0
- package/es/v1/Tab/css/tab.cva.js +163 -0
- package/es/v1/Tab/index.js +8 -0
- package/es/v1/Tab/props/defaultProps.js +55 -0
- package/es/v1/Tab/props/propTypes.js +215 -0
- package/es/v1/Tab/utils/pinSelectedTab.js +44 -0
- package/es/v1/shared/Spinner/Spinner_v1.module.css +3 -5
- package/es/v1/shared/SuccessTick/SuccessTick_v1.module.css +1 -2
- package/lib/Accordion/__tests__/Accordion.spec.js +122 -2
- package/lib/Accordion/__tests__/AccordionItem.spec.js +126 -4
- package/lib/Accordion/__tests__/__snapshots__/Accordion.spec.js.snap +344 -2
- package/lib/Accordion/__tests__/__snapshots__/AccordionItem.spec.js.snap +155 -3
- package/lib/Animation/__tests__/Animation.spec.js +31 -5
- package/lib/Animation/__tests__/__snapshots__/Animation.spec.js.snap +92 -2
- package/lib/Avatar/Avatar.module.css +5 -11
- package/lib/AvatarTeam/AvatarTeam.module.css +1 -3
- package/lib/Button/css/Button.module.css +8 -12
- package/lib/Card/Card.module.css +2 -2
- package/lib/CheckBox/CheckBox.js +1 -1
- package/lib/CheckBox/CheckBox.module.css +4 -6
- package/lib/CheckBox/__tests__/__snapshots__/CheckBox.spec.js.snap +1 -1
- package/lib/DateTime/DateTime.module.css +15 -22
- package/lib/DateTime/DateWidget.js +1 -1
- package/lib/DateTime/DateWidget.module.css +10 -5
- package/lib/DateTime/YearView.module.css +6 -9
- package/lib/DateTime/__tests__/CalendarView.spec.js +71 -2
- package/lib/DateTime/__tests__/DateTime.spec.js +92 -6
- package/lib/DateTime/__tests__/DateTimePopupFooter.spec.js +21 -1
- package/lib/DateTime/__tests__/DateTimePopupHeader.spec.js +30 -1
- package/lib/DateTime/__tests__/DateWidget.spec.js +35 -1
- package/lib/DateTime/__tests__/DaysRow.spec.js +20 -2
- package/lib/DateTime/__tests__/Time.spec.js +51 -2
- package/lib/DateTime/__tests__/YearView.spec.js +61 -2
- package/lib/DateTime/__tests__/__snapshots__/CalendarView.spec.js.snap +2907 -170
- package/lib/DateTime/__tests__/__snapshots__/DateTime.spec.js.snap +4392 -108
- package/lib/DateTime/__tests__/__snapshots__/DateTimePopupFooter.spec.js.snap +67 -1
- package/lib/DateTime/__tests__/__snapshots__/DateTimePopupHeader.spec.js.snap +187 -1
- package/lib/DateTime/__tests__/__snapshots__/DateWidget.spec.js.snap +266 -2
- package/lib/DateTime/__tests__/__snapshots__/DaysRow.spec.js.snap +155 -2
- package/lib/DateTime/__tests__/__snapshots__/Time.spec.js.snap +522 -5
- package/lib/DateTime/__tests__/__snapshots__/YearView.spec.js.snap +540 -0
- package/lib/DividerLine/DividerLine.js +50 -0
- package/lib/DividerLine/__tests__/DividerLine.spec.js +88 -0
- package/lib/DividerLine/__tests__/__snapshots__/DividerLine.spec.js.snap +131 -0
- package/lib/DividerLine/constants/index.js +39 -0
- package/lib/DividerLine/css/DividerLine.module.css +51 -0
- package/lib/DividerLine/css/cssJSLogic.js +13 -0
- package/lib/DividerLine/css/dividerLine.cva.js +57 -0
- package/lib/DividerLine/props/defaultProps.js +21 -0
- package/lib/DividerLine/props/propTypes.js +31 -0
- package/lib/DropBox/DropBoxElement/css/DropBoxElement.module.css +7 -11
- package/lib/DropBox/css/DropBox.module.css +3 -3
- package/lib/DropDown/DropDownHeading.module.css +1 -1
- package/lib/DropDown/DropDownItem.module.css +3 -7
- package/lib/DropDown/DropDownSeparator.js +9 -4
- package/lib/DropDown/DropDownSeparator.module.css +0 -4
- package/lib/DropDown/__tests__/DropDownSeparator.spec.js +8 -0
- package/lib/DropDown/__tests__/__snapshots__/DropDownSeparator.spec.js.snap +12 -2
- package/lib/Heading/Heading.module.css +1 -1
- package/lib/Heading/__tests__/Heading.spec.js +60 -4
- package/lib/Heading/__tests__/__snapshots__/Heading.spec.js.snap +87 -14
- package/lib/Label/Label.module.css +3 -3
- package/lib/ListItem/ListItem.module.css +9 -13
- package/lib/ListItem/__tests__/ListContainer.spec.js +229 -0
- package/lib/ListItem/__tests__/ListItem.spec.js +362 -0
- package/lib/ListItem/__tests__/ListItemWithAvatar.spec.js +391 -0
- package/lib/ListItem/__tests__/ListItemWithCheckBox.spec.js +215 -0
- package/lib/ListItem/__tests__/ListItemWithIcon.spec.js +304 -0
- package/lib/ListItem/__tests__/ListItemWithRadio.spec.js +231 -0
- package/lib/ListItem/__tests__/__snapshots__/ListContainer.spec.js.snap +602 -0
- package/lib/ListItem/__tests__/__snapshots__/ListItem.spec.js.snap +1807 -0
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithAvatar.spec.js.snap +2703 -0
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithCheckBox.spec.js.snap +2909 -0
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithIcon.spec.js.snap +2009 -0
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithRadio.spec.js.snap +3070 -0
- package/lib/MultiSelect/AdvancedGroupMultiSelect.js +1 -0
- package/lib/MultiSelect/AdvancedMultiSelect.js +1 -0
- package/lib/MultiSelect/MobileHeader/MobileHeader.module.css +1 -1
- package/lib/MultiSelect/MultiSelect.module.css +13 -21
- package/lib/MultiSelect/SelectedOptions.js +3 -3
- package/lib/MultiSelect/SelectedOptions.module.css +1 -1
- package/lib/MultiSelect/__tests__/AdvancedGroupMultiSelect.spec.js +734 -0
- package/lib/MultiSelect/__tests__/AdvancedMultiSelect.spec.js +751 -0
- package/lib/MultiSelect/__tests__/EmptyState.spec.js +273 -0
- package/lib/MultiSelect/__tests__/MultiSelect.spec.js +920 -0
- package/lib/MultiSelect/__tests__/MultiSelectHeader.spec.js +51 -0
- package/lib/MultiSelect/__tests__/MultiSelectWithAvatar.spec.js +497 -0
- package/lib/MultiSelect/__tests__/SelectedOptions.spec.js +305 -0
- package/lib/MultiSelect/__tests__/Suggestions.spec.js +375 -0
- package/lib/MultiSelect/__tests__/__snapshots__/AdvancedGroupMultiSelect.spec.js.snap +11906 -0
- package/lib/MultiSelect/__tests__/__snapshots__/AdvancedMultiSelect.spec.js.snap +12180 -0
- package/lib/MultiSelect/__tests__/__snapshots__/EmptyState.spec.js.snap +253 -0
- package/lib/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +14209 -0
- package/lib/MultiSelect/__tests__/__snapshots__/MultiSelectHeader.spec.js.snap +136 -0
- package/lib/MultiSelect/__tests__/__snapshots__/MultiSelectWithAvatar.spec.js.snap +11506 -0
- package/lib/MultiSelect/__tests__/__snapshots__/SelectedOptions.spec.js.snap +1382 -0
- package/lib/MultiSelect/__tests__/__snapshots__/Suggestions.spec.js.snap +3611 -0
- package/lib/PopOver/PopOver.module.css +2 -2
- package/lib/PopOver/__tests__/PopOver.spec.js +150 -1
- package/lib/PopOver/__tests__/__snapshots__/PopOver.spec.js.snap +1260 -0
- package/lib/Radio/Radio.module.css +8 -8
- package/lib/ResponsiveDropBox/__tests__/ResponsiveDropBox.spec.js +213 -0
- package/lib/ResponsiveDropBox/__tests__/__snapshots__/ResponsiveDropBox.spec.js.snap +1802 -0
- package/lib/Ribbon/Ribbon.module.css +12 -19
- package/lib/RippleEffect/RippleEffect.module.css +2 -2
- package/lib/Select/Select.module.css +4 -4
- package/lib/Select/SelectWithAvatar.js +15 -3
- package/lib/Select/SelectWithIcon.js +26 -1
- package/lib/Select/__tests__/SelectWithAvatar.spec.js +20 -0
- package/lib/Select/__tests__/SelectWithIcon.spec.js +21 -0
- package/lib/Select/__tests__/__snapshots__/SelectWithAvatar.spec.js.snap +47 -0
- package/lib/Select/__tests__/__snapshots__/SelectWithIcon.spec.js.snap +19 -0
- package/lib/Select/props/propTypes.js +1 -0
- package/lib/Switch/Switch.module.css +4 -7
- package/lib/Tab/Tab.module.css +5 -8
- package/lib/Tab/TabContent.module.css +1 -1
- package/lib/Tab/Tabs.module.css +8 -10
- package/lib/Tab/__tests__/Tab.spec.js +250 -0
- package/lib/Tab/__tests__/TabContent.spec.js +35 -0
- package/lib/Tab/__tests__/TabContentWrapper.spec.js +76 -0
- package/lib/Tab/__tests__/TabWrapper.spec.js +174 -0
- package/lib/Tab/__tests__/Tabs.spec.js +741 -0
- package/lib/Tab/__tests__/__snapshots__/Tab.spec.js.snap +1049 -0
- package/lib/Tab/__tests__/__snapshots__/TabContent.spec.js.snap +99 -0
- package/lib/Tab/__tests__/__snapshots__/TabContentWrapper.spec.js.snap +121 -0
- package/lib/Tab/__tests__/__snapshots__/TabWrapper.spec.js.snap +2002 -0
- package/lib/Tab/__tests__/__snapshots__/Tabs.spec.js.snap +11053 -0
- package/lib/Tag/Tag.module.css +4 -7
- package/lib/TextBoxIcon/TextBoxIcon.module.css +1 -1
- package/lib/Textarea/Textarea.module.css +4 -5
- package/lib/Tooltip/Tooltip.js +6 -1
- package/lib/Tooltip/Tooltip.module.css +3 -7
- package/lib/Tooltip/__tests__/Tooltip.spec.js +629 -0
- package/lib/Tooltip/__tests__/__snapshots__/Tooltip.spec.js.snap +813 -0
- package/lib/Typography/css/Typography.module.css +33 -40
- package/lib/common/animation.module.css +8 -8
- package/lib/common/basic.module.css +5 -5
- package/lib/common/common.module.css +85 -157
- package/lib/common/transition.module.css +2 -0
- package/lib/index.d.ts +39 -0
- package/lib/index.js +270 -173
- package/lib/semantic/Button/semanticButton.module.css +1 -5
- package/lib/shared/InputFieldLine/InputFieldLine.module.css +1 -1
- package/lib/v1/Button/__tests__/__snapshots__/Button.spec.js.snap +1 -1
- package/lib/v1/Button/css/Button_v1.module.css +2 -3
- package/lib/v1/Label/css/Label_v1.module.css +1 -1
- package/lib/v1/Switch/css/Switch_v1.module.css +5 -9
- package/lib/v1/Tab/Tab.js +171 -0
- package/lib/v1/Tab/TabList.js +180 -0
- package/lib/v1/Tab/TabMoreMenu.js +284 -0
- package/lib/v1/Tab/TabPanel.js +64 -0
- package/lib/v1/Tab/Tabs.js +151 -0
- package/lib/v1/Tab/__tests__/Tab.spec.js +913 -0
- package/lib/v1/Tab/__tests__/__snapshots__/Tab.spec.js.snap +4684 -0
- package/lib/v1/Tab/constants/index.js +109 -0
- package/lib/v1/Tab/constants/presets.js +31 -0
- package/lib/v1/Tab/context.js +30 -0
- package/lib/v1/Tab/core/Tab.js +88 -0
- package/lib/v1/Tab/core/TabList.js +82 -0
- package/lib/v1/Tab/core/TabListFocusScope.js +28 -0
- package/lib/v1/Tab/core/TabPanel.js +85 -0
- package/lib/v1/Tab/core/Tabs.js +63 -0
- package/lib/v1/Tab/core/index.js +109 -0
- package/lib/v1/Tab/css/Tab_v1.module.css +369 -0
- package/lib/v1/Tab/css/cssJSLogic.js +25 -0
- package/lib/v1/Tab/css/tab.cva.js +173 -0
- package/lib/v1/Tab/index.js +141 -0
- package/lib/v1/Tab/props/defaultProps.js +69 -0
- package/lib/v1/Tab/props/propTypes.js +240 -0
- package/lib/v1/Tab/utils/pinSelectedTab.js +59 -0
- package/lib/v1/shared/Spinner/Spinner_v1.module.css +3 -5
- package/lib/v1/shared/SuccessTick/SuccessTick_v1.module.css +1 -2
- package/package.json +25 -21
- package/tsconfig.jest.json +5 -0
- package/tsconfig.json +9 -0
- package/ut.config.js +2 -1
|
@@ -0,0 +1,824 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { render, screen, fireEvent } from '@testing-library/react';
|
|
7
|
+
import Tabs from "../Tabs";
|
|
8
|
+
import TabList from "../TabList";
|
|
9
|
+
import Tab from "../Tab";
|
|
10
|
+
import TabPanel from "../TabPanel";
|
|
11
|
+
import { SIZE, VARIANT, POSITION, LABEL_STYLE, ICON_PLACEMENT } from "../constants";
|
|
12
|
+
import { INFO_BAR_RAIL, SUBTAB_STRIP } from "../constants/presets";
|
|
13
|
+
/*
|
|
14
|
+
* `uniqueId` is passed on every render on purpose. The id scope is otherwise
|
|
15
|
+
* counter-based, so every id, aria-controls and aria-labelledby recorded below
|
|
16
|
+
* would depend on how many <Tabs> rendered before it - and adding a test above
|
|
17
|
+
* would invalidate every snapshot under it.
|
|
18
|
+
*
|
|
19
|
+
* Data-driven mode is deterministic here too: jsdom reports every offsetWidth
|
|
20
|
+
* as 0, so useAdaptiveRenderer keeps exactly `minVisibleTabs` tabs in the strip
|
|
21
|
+
* and collapses the rest into the more menu.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
const ITEMS = [{
|
|
25
|
+
value: 'a',
|
|
26
|
+
text: 'Alpha',
|
|
27
|
+
iconName: 'ZD-TB-menu'
|
|
28
|
+
}, {
|
|
29
|
+
value: 'b',
|
|
30
|
+
text: 'Bravo'
|
|
31
|
+
}, {
|
|
32
|
+
value: 'c',
|
|
33
|
+
text: 'Charlie'
|
|
34
|
+
}];
|
|
35
|
+
|
|
36
|
+
function Group({
|
|
37
|
+
uniqueId = 'tabs',
|
|
38
|
+
tabProps,
|
|
39
|
+
listProps,
|
|
40
|
+
...tabsProps
|
|
41
|
+
}) {
|
|
42
|
+
return /*#__PURE__*/React.createElement(Tabs, _extends({
|
|
43
|
+
uniqueId: uniqueId
|
|
44
|
+
}, tabsProps), /*#__PURE__*/React.createElement(TabList, _extends({
|
|
45
|
+
ariaLabel: "Cities"
|
|
46
|
+
}, listProps), /*#__PURE__*/React.createElement(Tab, _extends({
|
|
47
|
+
value: "one",
|
|
48
|
+
text: "one"
|
|
49
|
+
}, tabProps)), /*#__PURE__*/React.createElement(Tab, {
|
|
50
|
+
value: "two",
|
|
51
|
+
text: "two"
|
|
52
|
+
})), /*#__PURE__*/React.createElement(TabPanel, {
|
|
53
|
+
value: "one"
|
|
54
|
+
}, "Panel one"), /*#__PURE__*/React.createElement(TabPanel, {
|
|
55
|
+
value: "two"
|
|
56
|
+
}, "Panel two"));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
describe('Tab - Snapshot', () => {
|
|
60
|
+
test('Render with default props', () => {
|
|
61
|
+
const {
|
|
62
|
+
asFragment
|
|
63
|
+
} = render( /*#__PURE__*/React.createElement(Group, null));
|
|
64
|
+
expect(asFragment()).toMatchSnapshot();
|
|
65
|
+
});
|
|
66
|
+
test('Render with defaultValue', () => {
|
|
67
|
+
const {
|
|
68
|
+
asFragment
|
|
69
|
+
} = render( /*#__PURE__*/React.createElement(Group, {
|
|
70
|
+
defaultValue: "two"
|
|
71
|
+
}));
|
|
72
|
+
expect(asFragment()).toMatchSnapshot();
|
|
73
|
+
});
|
|
74
|
+
test('Render with selectedValue', () => {
|
|
75
|
+
const {
|
|
76
|
+
asFragment
|
|
77
|
+
} = render( /*#__PURE__*/React.createElement(Group, {
|
|
78
|
+
selectedValue: "two"
|
|
79
|
+
}));
|
|
80
|
+
expect(asFragment()).toMatchSnapshot();
|
|
81
|
+
});
|
|
82
|
+
test('Render with activation=manual', () => {
|
|
83
|
+
const {
|
|
84
|
+
asFragment
|
|
85
|
+
} = render( /*#__PURE__*/React.createElement(Group, {
|
|
86
|
+
activation: "manual"
|
|
87
|
+
}));
|
|
88
|
+
expect(asFragment()).toMatchSnapshot();
|
|
89
|
+
});
|
|
90
|
+
test.each(Object.values(SIZE))('Render with size=%s', size => {
|
|
91
|
+
const {
|
|
92
|
+
asFragment
|
|
93
|
+
} = render( /*#__PURE__*/React.createElement(Group, {
|
|
94
|
+
size: size
|
|
95
|
+
}));
|
|
96
|
+
expect(asFragment()).toMatchSnapshot();
|
|
97
|
+
});
|
|
98
|
+
test.each(Object.values(VARIANT))('Render with variant=%s', variant => {
|
|
99
|
+
const {
|
|
100
|
+
asFragment
|
|
101
|
+
} = render( /*#__PURE__*/React.createElement(Group, {
|
|
102
|
+
variant: variant
|
|
103
|
+
}));
|
|
104
|
+
expect(asFragment()).toMatchSnapshot();
|
|
105
|
+
});
|
|
106
|
+
test.each(Object.values(POSITION))('Render with position=%s', position => {
|
|
107
|
+
const {
|
|
108
|
+
asFragment
|
|
109
|
+
} = render( /*#__PURE__*/React.createElement(Group, {
|
|
110
|
+
position: position
|
|
111
|
+
}));
|
|
112
|
+
expect(asFragment()).toMatchSnapshot();
|
|
113
|
+
});
|
|
114
|
+
test.each(Object.values(LABEL_STYLE))('Render with labelStyle=%s', labelStyle => {
|
|
115
|
+
const {
|
|
116
|
+
asFragment
|
|
117
|
+
} = render( /*#__PURE__*/React.createElement(Group, {
|
|
118
|
+
labelStyle: labelStyle,
|
|
119
|
+
tabProps: {
|
|
120
|
+
iconName: 'ZD-TB-menu'
|
|
121
|
+
}
|
|
122
|
+
}));
|
|
123
|
+
expect(asFragment()).toMatchSnapshot();
|
|
124
|
+
});
|
|
125
|
+
test.each(Object.values(ICON_PLACEMENT))('Render with iconPlacement=%s', iconPlacement => {
|
|
126
|
+
const {
|
|
127
|
+
asFragment
|
|
128
|
+
} = render( /*#__PURE__*/React.createElement(Group, {
|
|
129
|
+
iconPlacement: iconPlacement,
|
|
130
|
+
labelStyle: "iconAndText",
|
|
131
|
+
tabProps: {
|
|
132
|
+
iconName: 'ZD-TB-menu'
|
|
133
|
+
}
|
|
134
|
+
}));
|
|
135
|
+
expect(asFragment()).toMatchSnapshot();
|
|
136
|
+
});
|
|
137
|
+
test('Render with iconSpacing', () => {
|
|
138
|
+
const {
|
|
139
|
+
asFragment
|
|
140
|
+
} = render( /*#__PURE__*/React.createElement(Group, {
|
|
141
|
+
iconSpacing: "12",
|
|
142
|
+
tabProps: {
|
|
143
|
+
iconName: 'ZD-TB-menu'
|
|
144
|
+
}
|
|
145
|
+
}));
|
|
146
|
+
expect(asFragment()).toMatchSnapshot();
|
|
147
|
+
});
|
|
148
|
+
test('Render with isFullWidth', () => {
|
|
149
|
+
const {
|
|
150
|
+
asFragment
|
|
151
|
+
} = render( /*#__PURE__*/React.createElement(Group, {
|
|
152
|
+
isFullWidth: true
|
|
153
|
+
}));
|
|
154
|
+
expect(asFragment()).toMatchSnapshot();
|
|
155
|
+
});
|
|
156
|
+
test('Render with hasScroll', () => {
|
|
157
|
+
const {
|
|
158
|
+
asFragment
|
|
159
|
+
} = render( /*#__PURE__*/React.createElement(Group, {
|
|
160
|
+
hasScroll: true
|
|
161
|
+
}));
|
|
162
|
+
expect(asFragment()).toMatchSnapshot();
|
|
163
|
+
});
|
|
164
|
+
test('Render with hasSurface', () => {
|
|
165
|
+
const {
|
|
166
|
+
asFragment
|
|
167
|
+
} = render( /*#__PURE__*/React.createElement(Group, {
|
|
168
|
+
hasSurface: true
|
|
169
|
+
}));
|
|
170
|
+
expect(asFragment()).toMatchSnapshot();
|
|
171
|
+
});
|
|
172
|
+
test('Render with hasListBorder=false and hasListPadding=false', () => {
|
|
173
|
+
const {
|
|
174
|
+
asFragment
|
|
175
|
+
} = render( /*#__PURE__*/React.createElement(Group, {
|
|
176
|
+
hasListBorder: false,
|
|
177
|
+
hasListPadding: false
|
|
178
|
+
}));
|
|
179
|
+
expect(asFragment()).toMatchSnapshot();
|
|
180
|
+
});
|
|
181
|
+
test('Render with textTransform and textTruncate', () => {
|
|
182
|
+
const {
|
|
183
|
+
asFragment
|
|
184
|
+
} = render( /*#__PURE__*/React.createElement(Group, {
|
|
185
|
+
textTransform: "upper",
|
|
186
|
+
textTruncate: "ellipsis"
|
|
187
|
+
}));
|
|
188
|
+
expect(asFragment()).toMatchSnapshot();
|
|
189
|
+
});
|
|
190
|
+
test('Render with customClass for every slot', () => {
|
|
191
|
+
const {
|
|
192
|
+
asFragment
|
|
193
|
+
} = render( /*#__PURE__*/React.createElement(Group, {
|
|
194
|
+
customClass: {
|
|
195
|
+
root: 'my-root',
|
|
196
|
+
list: 'my-list',
|
|
197
|
+
tab: 'my-tab',
|
|
198
|
+
tabText: 'my-text',
|
|
199
|
+
panel: 'my-panel'
|
|
200
|
+
}
|
|
201
|
+
}));
|
|
202
|
+
expect(asFragment()).toMatchSnapshot();
|
|
203
|
+
});
|
|
204
|
+
test('Render with customId and testId', () => {
|
|
205
|
+
const {
|
|
206
|
+
asFragment
|
|
207
|
+
} = render( /*#__PURE__*/React.createElement(Group, {
|
|
208
|
+
customId: "tab-customId",
|
|
209
|
+
testId: "tab-testId"
|
|
210
|
+
}));
|
|
211
|
+
expect(asFragment()).toMatchSnapshot();
|
|
212
|
+
});
|
|
213
|
+
test('Render with customProps and customAttributes on the root', () => {
|
|
214
|
+
const {
|
|
215
|
+
asFragment
|
|
216
|
+
} = render( /*#__PURE__*/React.createElement(Group, {
|
|
217
|
+
customProps: {
|
|
218
|
+
root: {
|
|
219
|
+
'data-custom-prop': 'true'
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
customAttributes: {
|
|
223
|
+
root: {
|
|
224
|
+
'data-custom-attr': 'true'
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
a11yAttributes: {
|
|
228
|
+
'aria-roledescription': 'tab group'
|
|
229
|
+
}
|
|
230
|
+
}));
|
|
231
|
+
expect(asFragment()).toMatchSnapshot();
|
|
232
|
+
});
|
|
233
|
+
test('Render a tab with an icon', () => {
|
|
234
|
+
const {
|
|
235
|
+
asFragment
|
|
236
|
+
} = render( /*#__PURE__*/React.createElement(Group, {
|
|
237
|
+
tabProps: {
|
|
238
|
+
iconName: 'ZD-TB-menu',
|
|
239
|
+
iconSize: 14
|
|
240
|
+
}
|
|
241
|
+
}));
|
|
242
|
+
expect(asFragment()).toMatchSnapshot();
|
|
243
|
+
});
|
|
244
|
+
test('Render a disabled tab', () => {
|
|
245
|
+
const {
|
|
246
|
+
asFragment
|
|
247
|
+
} = render( /*#__PURE__*/React.createElement(Group, {
|
|
248
|
+
tabProps: {
|
|
249
|
+
isDisabled: true
|
|
250
|
+
}
|
|
251
|
+
}));
|
|
252
|
+
expect(asFragment()).toMatchSnapshot();
|
|
253
|
+
});
|
|
254
|
+
test('Render a tab with title', () => {
|
|
255
|
+
const {
|
|
256
|
+
asFragment
|
|
257
|
+
} = render( /*#__PURE__*/React.createElement(Group, {
|
|
258
|
+
tabProps: {
|
|
259
|
+
title: 'First tab'
|
|
260
|
+
}
|
|
261
|
+
}));
|
|
262
|
+
expect(asFragment()).toMatchSnapshot();
|
|
263
|
+
});
|
|
264
|
+
test('Render a tab with renderIcon, renderBefore and renderAfter', () => {
|
|
265
|
+
const {
|
|
266
|
+
asFragment
|
|
267
|
+
} = render( /*#__PURE__*/React.createElement(Group, {
|
|
268
|
+
tabProps: {
|
|
269
|
+
renderIcon: () => /*#__PURE__*/React.createElement("span", null, "icon"),
|
|
270
|
+
renderBefore: () => /*#__PURE__*/React.createElement("span", null, "before"),
|
|
271
|
+
renderAfter: ({
|
|
272
|
+
isSelected
|
|
273
|
+
}) => /*#__PURE__*/React.createElement("span", null, isSelected ? 'on' : 'off')
|
|
274
|
+
}
|
|
275
|
+
}));
|
|
276
|
+
expect(asFragment()).toMatchSnapshot();
|
|
277
|
+
});
|
|
278
|
+
test('Render a tab with children', () => {
|
|
279
|
+
const {
|
|
280
|
+
asFragment
|
|
281
|
+
} = render( /*#__PURE__*/React.createElement(Group, {
|
|
282
|
+
tabProps: {
|
|
283
|
+
children: /*#__PURE__*/React.createElement("span", null, "badge")
|
|
284
|
+
}
|
|
285
|
+
}));
|
|
286
|
+
expect(asFragment()).toMatchSnapshot();
|
|
287
|
+
});
|
|
288
|
+
test('Render a tab with its own customAttributes and a11yAttributes', () => {
|
|
289
|
+
const {
|
|
290
|
+
asFragment
|
|
291
|
+
} = render( /*#__PURE__*/React.createElement(Group, {
|
|
292
|
+
tabProps: {
|
|
293
|
+
customAttributes: {
|
|
294
|
+
tab: {
|
|
295
|
+
'data-tour-step': 'step-1'
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
a11yAttributes: {
|
|
299
|
+
'aria-keyshortcuts': 'Alt+1'
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}));
|
|
303
|
+
expect(asFragment()).toMatchSnapshot();
|
|
304
|
+
});
|
|
305
|
+
test('Render a tab with tourId and title', () => {
|
|
306
|
+
const {
|
|
307
|
+
asFragment
|
|
308
|
+
} = render( /*#__PURE__*/React.createElement(Group, {
|
|
309
|
+
tabProps: {
|
|
310
|
+
title: 'One',
|
|
311
|
+
tourId: 'tour-one'
|
|
312
|
+
}
|
|
313
|
+
}));
|
|
314
|
+
expect(asFragment()).toMatchSnapshot();
|
|
315
|
+
});
|
|
316
|
+
test('Render a link tab', () => {
|
|
317
|
+
const {
|
|
318
|
+
asFragment
|
|
319
|
+
} = render( /*#__PURE__*/React.createElement(Group, {
|
|
320
|
+
tabProps: {
|
|
321
|
+
href: '/one',
|
|
322
|
+
target: '_blank',
|
|
323
|
+
rel: 'noreferrer'
|
|
324
|
+
}
|
|
325
|
+
}));
|
|
326
|
+
expect(asFragment()).toMatchSnapshot();
|
|
327
|
+
});
|
|
328
|
+
test('Render a panel kept in the DOM with shouldUnmount=false', () => {
|
|
329
|
+
const {
|
|
330
|
+
asFragment
|
|
331
|
+
} = render( /*#__PURE__*/React.createElement(Tabs, {
|
|
332
|
+
uniqueId: "tabs"
|
|
333
|
+
}, /*#__PURE__*/React.createElement(TabList, {
|
|
334
|
+
ariaLabel: "Cities"
|
|
335
|
+
}, /*#__PURE__*/React.createElement(Tab, {
|
|
336
|
+
value: "one",
|
|
337
|
+
text: "one"
|
|
338
|
+
}), /*#__PURE__*/React.createElement(Tab, {
|
|
339
|
+
value: "two",
|
|
340
|
+
text: "two"
|
|
341
|
+
})), /*#__PURE__*/React.createElement(TabPanel, {
|
|
342
|
+
value: "one"
|
|
343
|
+
}, "Panel one"), /*#__PURE__*/React.createElement(TabPanel, {
|
|
344
|
+
value: "two",
|
|
345
|
+
shouldUnmount: false
|
|
346
|
+
}, "Panel two")));
|
|
347
|
+
expect(asFragment()).toMatchSnapshot();
|
|
348
|
+
});
|
|
349
|
+
test('Render a static panel', () => {
|
|
350
|
+
const {
|
|
351
|
+
asFragment
|
|
352
|
+
} = render( /*#__PURE__*/React.createElement(Tabs, {
|
|
353
|
+
uniqueId: "tabs"
|
|
354
|
+
}, /*#__PURE__*/React.createElement(TabList, {
|
|
355
|
+
ariaLabel: "Cities"
|
|
356
|
+
}, /*#__PURE__*/React.createElement(Tab, {
|
|
357
|
+
value: "one",
|
|
358
|
+
text: "one"
|
|
359
|
+
})), /*#__PURE__*/React.createElement(TabPanel, {
|
|
360
|
+
value: "two",
|
|
361
|
+
isStatic: true
|
|
362
|
+
}, "Always here")));
|
|
363
|
+
expect(asFragment()).toMatchSnapshot();
|
|
364
|
+
});
|
|
365
|
+
test('Render a panel with customId, testId and prop bags', () => {
|
|
366
|
+
const {
|
|
367
|
+
asFragment
|
|
368
|
+
} = render( /*#__PURE__*/React.createElement(Tabs, {
|
|
369
|
+
uniqueId: "tabs"
|
|
370
|
+
}, /*#__PURE__*/React.createElement(TabList, {
|
|
371
|
+
ariaLabel: "Cities"
|
|
372
|
+
}, /*#__PURE__*/React.createElement(Tab, {
|
|
373
|
+
value: "one",
|
|
374
|
+
text: "one"
|
|
375
|
+
})), /*#__PURE__*/React.createElement(TabPanel, {
|
|
376
|
+
value: "one",
|
|
377
|
+
customId: "panel-customId",
|
|
378
|
+
testId: "panel-testId",
|
|
379
|
+
customAttributes: {
|
|
380
|
+
panel: {
|
|
381
|
+
'data-custom-attr': 'true'
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
a11yAttributes: {
|
|
385
|
+
'aria-live': 'polite'
|
|
386
|
+
}
|
|
387
|
+
}, "Panel one")));
|
|
388
|
+
expect(asFragment()).toMatchSnapshot();
|
|
389
|
+
});
|
|
390
|
+
test('Render a panel with scroll', () => {
|
|
391
|
+
const {
|
|
392
|
+
asFragment
|
|
393
|
+
} = render( /*#__PURE__*/React.createElement(Tabs, {
|
|
394
|
+
uniqueId: "tabs"
|
|
395
|
+
}, /*#__PURE__*/React.createElement(TabList, {
|
|
396
|
+
ariaLabel: "Cities"
|
|
397
|
+
}, /*#__PURE__*/React.createElement(Tab, {
|
|
398
|
+
value: "one",
|
|
399
|
+
text: "one"
|
|
400
|
+
})), /*#__PURE__*/React.createElement(TabPanel, {
|
|
401
|
+
value: "one",
|
|
402
|
+
scroll: "vertical"
|
|
403
|
+
}, "Panel one")));
|
|
404
|
+
expect(asFragment()).toMatchSnapshot();
|
|
405
|
+
});
|
|
406
|
+
test('Render a tablist named with ariaLabelledBy', () => {
|
|
407
|
+
const {
|
|
408
|
+
asFragment
|
|
409
|
+
} = render( /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h2", {
|
|
410
|
+
id: "cities-heading"
|
|
411
|
+
}, "Cities"), /*#__PURE__*/React.createElement(Group, {
|
|
412
|
+
listProps: {
|
|
413
|
+
ariaLabel: undefined,
|
|
414
|
+
ariaLabelledBy: 'cities-heading'
|
|
415
|
+
}
|
|
416
|
+
})));
|
|
417
|
+
expect(asFragment()).toMatchSnapshot();
|
|
418
|
+
});
|
|
419
|
+
test('Render a data-driven tablist collapsing into a more menu', () => {
|
|
420
|
+
const {
|
|
421
|
+
asFragment
|
|
422
|
+
} = render( /*#__PURE__*/React.createElement(Tabs, {
|
|
423
|
+
uniqueId: "tabs"
|
|
424
|
+
}, /*#__PURE__*/React.createElement(TabList, {
|
|
425
|
+
ariaLabel: "Cities",
|
|
426
|
+
items: ITEMS
|
|
427
|
+
})));
|
|
428
|
+
expect(asFragment()).toMatchSnapshot();
|
|
429
|
+
});
|
|
430
|
+
test('Render a data-driven tablist with minVisibleTabs raised', () => {
|
|
431
|
+
const {
|
|
432
|
+
asFragment
|
|
433
|
+
} = render( /*#__PURE__*/React.createElement(Tabs, {
|
|
434
|
+
uniqueId: "tabs"
|
|
435
|
+
}, /*#__PURE__*/React.createElement(TabList, {
|
|
436
|
+
ariaLabel: "Cities",
|
|
437
|
+
items: ITEMS,
|
|
438
|
+
minVisibleTabs: 2
|
|
439
|
+
})));
|
|
440
|
+
expect(asFragment()).toMatchSnapshot();
|
|
441
|
+
});
|
|
442
|
+
test('Render a data-driven tablist with nothing overflowing', () => {
|
|
443
|
+
const {
|
|
444
|
+
asFragment
|
|
445
|
+
} = render( /*#__PURE__*/React.createElement(Tabs, {
|
|
446
|
+
uniqueId: "tabs"
|
|
447
|
+
}, /*#__PURE__*/React.createElement(TabList, {
|
|
448
|
+
ariaLabel: "Cities",
|
|
449
|
+
items: ITEMS,
|
|
450
|
+
minVisibleTabs: ITEMS.length
|
|
451
|
+
})));
|
|
452
|
+
expect(asFragment()).toMatchSnapshot();
|
|
453
|
+
});
|
|
454
|
+
test('Render a data-driven tablist carrying renderBefore and renderAfter into the more menu', () => {
|
|
455
|
+
const {
|
|
456
|
+
asFragment
|
|
457
|
+
} = render( /*#__PURE__*/React.createElement(Tabs, {
|
|
458
|
+
uniqueId: "tabs"
|
|
459
|
+
}, /*#__PURE__*/React.createElement(TabList, {
|
|
460
|
+
ariaLabel: "Cities",
|
|
461
|
+
items: ITEMS.map(item => ({ ...item,
|
|
462
|
+
renderBefore: () => /*#__PURE__*/React.createElement("span", null, "dot"),
|
|
463
|
+
renderAfter: ({
|
|
464
|
+
value
|
|
465
|
+
}) => /*#__PURE__*/React.createElement("span", null, `count-${value}`)
|
|
466
|
+
}))
|
|
467
|
+
})));
|
|
468
|
+
expect(asFragment()).toMatchSnapshot();
|
|
469
|
+
});
|
|
470
|
+
test('Render the open more menu with renderBefore and renderAfter mapped onto ListItem', () => {
|
|
471
|
+
/*
|
|
472
|
+
* The menu only mounts while the popup is open, so the ListItem mapping -
|
|
473
|
+
* renderBefore sharing the leading slot with the icon, renderAfter as the
|
|
474
|
+
* right-of-value placeholder - is only reachable through the trigger.
|
|
475
|
+
*
|
|
476
|
+
* Recorded from `baseElement`, not `asFragment()`: the DropBox renders in a
|
|
477
|
+
* portal on document.body, which the container fragment does not include.
|
|
478
|
+
*/
|
|
479
|
+
const {
|
|
480
|
+
baseElement
|
|
481
|
+
} = render( /*#__PURE__*/React.createElement(Tabs, {
|
|
482
|
+
uniqueId: "tabs"
|
|
483
|
+
}, /*#__PURE__*/React.createElement(TabList, {
|
|
484
|
+
ariaLabel: "Cities",
|
|
485
|
+
moreMenu: {
|
|
486
|
+
ariaLabel: 'More tabs'
|
|
487
|
+
},
|
|
488
|
+
items: ITEMS.map(item => ({ ...item,
|
|
489
|
+
|
|
490
|
+
/* every item gets an icon here, so the collapsed ones record what
|
|
491
|
+
* the strip cannot: the icon and renderBefore sharing one slot */
|
|
492
|
+
iconName: 'ZD-TB-menu',
|
|
493
|
+
renderBefore: () => /*#__PURE__*/React.createElement("span", null, "dot"),
|
|
494
|
+
renderAfter: ({
|
|
495
|
+
value
|
|
496
|
+
}) => /*#__PURE__*/React.createElement("span", null, `count-${value}`)
|
|
497
|
+
}))
|
|
498
|
+
})));
|
|
499
|
+
fireEvent.click(screen.getByRole('button', {
|
|
500
|
+
name: 'More tabs'
|
|
501
|
+
}));
|
|
502
|
+
expect(baseElement).toMatchSnapshot();
|
|
503
|
+
});
|
|
504
|
+
test('Render a data-driven tablist with a custom more trigger', () => {
|
|
505
|
+
const {
|
|
506
|
+
asFragment
|
|
507
|
+
} = render( /*#__PURE__*/React.createElement(Tabs, {
|
|
508
|
+
uniqueId: "tabs"
|
|
509
|
+
}, /*#__PURE__*/React.createElement(TabList, {
|
|
510
|
+
ariaLabel: "Cities",
|
|
511
|
+
items: ITEMS,
|
|
512
|
+
moreMenu: {
|
|
513
|
+
iconName: 'ZD-more',
|
|
514
|
+
iconSize: 14,
|
|
515
|
+
ariaLabel: 'Show the rest',
|
|
516
|
+
renderTarget: ({
|
|
517
|
+
hiddenCount
|
|
518
|
+
}) => /*#__PURE__*/React.createElement("span", null, "+", hiddenCount)
|
|
519
|
+
}
|
|
520
|
+
})));
|
|
521
|
+
expect(asFragment()).toMatchSnapshot();
|
|
522
|
+
});
|
|
523
|
+
test('Render the open more menu with Popup HOC options forwarded via customProps.popup', () => {
|
|
524
|
+
const {
|
|
525
|
+
baseElement
|
|
526
|
+
} = render( /*#__PURE__*/React.createElement(Tabs, {
|
|
527
|
+
uniqueId: "tabs"
|
|
528
|
+
}, /*#__PURE__*/React.createElement(TabList, {
|
|
529
|
+
ariaLabel: "Cities",
|
|
530
|
+
items: ITEMS,
|
|
531
|
+
moreMenu: {
|
|
532
|
+
ariaLabel: 'More tabs'
|
|
533
|
+
},
|
|
534
|
+
customProps: {
|
|
535
|
+
popup: {
|
|
536
|
+
isAbsolutePositioningNeeded: true,
|
|
537
|
+
isArrow: true
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
})));
|
|
541
|
+
fireEvent.click(screen.getByRole('button', {
|
|
542
|
+
name: 'More tabs'
|
|
543
|
+
}));
|
|
544
|
+
expect(baseElement).toMatchSnapshot();
|
|
545
|
+
});
|
|
546
|
+
test('Render extra children after the tabs in items mode', () => {
|
|
547
|
+
const {
|
|
548
|
+
asFragment
|
|
549
|
+
} = render( /*#__PURE__*/React.createElement(Tabs, {
|
|
550
|
+
uniqueId: "tabs"
|
|
551
|
+
}, /*#__PURE__*/React.createElement(TabList, {
|
|
552
|
+
ariaLabel: "Cities",
|
|
553
|
+
items: ITEMS
|
|
554
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
555
|
+
"data-id": "otherTab"
|
|
556
|
+
}, "extra"))));
|
|
557
|
+
expect(asFragment()).toMatchSnapshot();
|
|
558
|
+
});
|
|
559
|
+
test('Render the open more menu with search and link items', () => {
|
|
560
|
+
const {
|
|
561
|
+
baseElement
|
|
562
|
+
} = render( /*#__PURE__*/React.createElement(Tabs, {
|
|
563
|
+
uniqueId: "tabs"
|
|
564
|
+
}, /*#__PURE__*/React.createElement(TabList, {
|
|
565
|
+
ariaLabel: "Cities",
|
|
566
|
+
moreMenu: {
|
|
567
|
+
ariaLabel: 'More tabs',
|
|
568
|
+
searchThreshold: 1
|
|
569
|
+
},
|
|
570
|
+
items: ITEMS.map(item => ({ ...item,
|
|
571
|
+
href: `/${item.value}`,
|
|
572
|
+
target: '_blank'
|
|
573
|
+
}))
|
|
574
|
+
})));
|
|
575
|
+
fireEvent.click(screen.getByRole('button', {
|
|
576
|
+
name: 'More tabs'
|
|
577
|
+
}));
|
|
578
|
+
expect(baseElement).toMatchSnapshot();
|
|
579
|
+
});
|
|
580
|
+
describe('Presets', () => {
|
|
581
|
+
const presets = [['INFO_BAR_RAIL', INFO_BAR_RAIL], ['SUBTAB_STRIP', SUBTAB_STRIP]];
|
|
582
|
+
test.each(presets)('Should render preset %s', (_name, preset) => {
|
|
583
|
+
const {
|
|
584
|
+
asFragment
|
|
585
|
+
} = render( /*#__PURE__*/React.createElement(Group, _extends({}, preset, {
|
|
586
|
+
tabProps: {
|
|
587
|
+
iconName: 'ZD-TB-menu'
|
|
588
|
+
}
|
|
589
|
+
})));
|
|
590
|
+
expect(asFragment()).toMatchSnapshot();
|
|
591
|
+
});
|
|
592
|
+
});
|
|
593
|
+
});
|
|
594
|
+
/*
|
|
595
|
+
* The behaviour these cover is not visible in a snapshot: the F1 font-size
|
|
596
|
+
* cascade fix, the F2 customClass merge fix, a keyboard model, and a click
|
|
597
|
+
* that must NOT change state.
|
|
598
|
+
*/
|
|
599
|
+
|
|
600
|
+
describe('Tab - Behaviour', () => {
|
|
601
|
+
test('size is the sole font-size axis: no variant re-declares --local-tab-font-size', () => {
|
|
602
|
+
/*
|
|
603
|
+
* The F1 regression. `--local-tab-font-size` is set by `.small` / `.medium`
|
|
604
|
+
* / `.large`, but the `.elevated` / `.spaced` / `.dotted` preset-variant
|
|
605
|
+
* blocks used to redeclare it too - and, appearing later in the file at
|
|
606
|
+
* equal specificity on the same <Tabs> root element, they always won, so
|
|
607
|
+
* `size` silently had no visible effect whenever a variant was also set.
|
|
608
|
+
*
|
|
609
|
+
* jsdom applies no CSS-module styles, so the guard is in two parts: both
|
|
610
|
+
* the size and variant classes must reach the root element together, and
|
|
611
|
+
* the stylesheet must declare `--local-tab-font-size` in exactly the size
|
|
612
|
+
* blocks, never in the variant blocks.
|
|
613
|
+
*/
|
|
614
|
+
const {
|
|
615
|
+
container
|
|
616
|
+
} = render( /*#__PURE__*/React.createElement(Group, {
|
|
617
|
+
size: "large",
|
|
618
|
+
variant: "elevated"
|
|
619
|
+
}));
|
|
620
|
+
const root = container.firstChild;
|
|
621
|
+
expect(root.className).toContain('large');
|
|
622
|
+
expect(root.className).toContain('elevated');
|
|
623
|
+
const css = fs.readFileSync(path.join(__dirname, '..', 'css', 'Tab_v1.module.css'), 'utf8');
|
|
624
|
+
|
|
625
|
+
const block = selector => {
|
|
626
|
+
const match = css.match(new RegExp(`\\.${selector}\\s*\\{([^}]*)\\}`));
|
|
627
|
+
return match ? match[1] : '';
|
|
628
|
+
};
|
|
629
|
+
|
|
630
|
+
expect(block('small')).toMatch(/--local-tab-font-size/);
|
|
631
|
+
expect(block('medium')).toMatch(/--local-tab-font-size/);
|
|
632
|
+
expect(block('large')).toMatch(/--local-tab-font-size/);
|
|
633
|
+
expect(block('elevated')).not.toMatch(/--local-tab-font-size/);
|
|
634
|
+
expect(block('spaced')).not.toMatch(/--local-tab-font-size/);
|
|
635
|
+
expect(block('dotted')).not.toMatch(/--local-tab-font-size/);
|
|
636
|
+
});
|
|
637
|
+
test('a group customClass.tab is merged with, not overwritten by, a per-tab getClasses call', () => {
|
|
638
|
+
/*
|
|
639
|
+
* The F2 regression. Tabs.js's `getClasses(extra)` used to spread `extra`
|
|
640
|
+
* over the whole style-props object in one shallow merge, so Tab.js's own
|
|
641
|
+
* `getClasses({ labelStyle, customClass })` call - always made, even when
|
|
642
|
+
* the tab has no per-tab `customClass` of its own - replaced the group's
|
|
643
|
+
* `customClass` outright with `undefined` instead of layering onto it.
|
|
644
|
+
*/
|
|
645
|
+
const {
|
|
646
|
+
container
|
|
647
|
+
} = render( /*#__PURE__*/React.createElement(Group, {
|
|
648
|
+
customClass: {
|
|
649
|
+
tab: 'group-tab-class'
|
|
650
|
+
}
|
|
651
|
+
}));
|
|
652
|
+
const tab = container.querySelector('[role="tab"]');
|
|
653
|
+
expect(tab.className).toContain('group-tab-class');
|
|
654
|
+
});
|
|
655
|
+
test('a link tab selects on a plain click and defers to the browser on a modifier click', () => {
|
|
656
|
+
const onChange = jest.fn();
|
|
657
|
+
render( /*#__PURE__*/React.createElement(Tabs, {
|
|
658
|
+
uniqueId: "tabs",
|
|
659
|
+
onChange: onChange
|
|
660
|
+
}, /*#__PURE__*/React.createElement(TabList, {
|
|
661
|
+
ariaLabel: "Cities"
|
|
662
|
+
}, /*#__PURE__*/React.createElement(Tab, {
|
|
663
|
+
value: "one",
|
|
664
|
+
text: "one"
|
|
665
|
+
}), /*#__PURE__*/React.createElement(Tab, {
|
|
666
|
+
value: "two",
|
|
667
|
+
text: "two",
|
|
668
|
+
href: "/two"
|
|
669
|
+
}))));
|
|
670
|
+
const link = screen.getByRole('tab', {
|
|
671
|
+
name: 'two'
|
|
672
|
+
});
|
|
673
|
+
expect(link.tagName).toBe('A');
|
|
674
|
+
expect(link).toHaveAttribute('href', '/two');
|
|
675
|
+
/* Mount already reported one call - the reducer adopting the first enabled
|
|
676
|
+
* tab - so clear before asserting on what the click does. */
|
|
677
|
+
|
|
678
|
+
onChange.mockClear();
|
|
679
|
+
/* Modifier-click is the browser's: open in a new tab, selection untouched. */
|
|
680
|
+
|
|
681
|
+
fireEvent.click(link, {
|
|
682
|
+
metaKey: true
|
|
683
|
+
});
|
|
684
|
+
expect(onChange).not.toHaveBeenCalled();
|
|
685
|
+
fireEvent.click(link);
|
|
686
|
+
expect(onChange).toHaveBeenCalledWith(expect.objectContaining({
|
|
687
|
+
value: 'two'
|
|
688
|
+
}), expect.anything());
|
|
689
|
+
});
|
|
690
|
+
test('a disabled link tab carries no href', () => {
|
|
691
|
+
render( /*#__PURE__*/React.createElement(Tabs, {
|
|
692
|
+
uniqueId: "tabs"
|
|
693
|
+
}, /*#__PURE__*/React.createElement(TabList, {
|
|
694
|
+
ariaLabel: "Cities"
|
|
695
|
+
}, /*#__PURE__*/React.createElement(Tab, {
|
|
696
|
+
value: "one",
|
|
697
|
+
text: "one"
|
|
698
|
+
}), /*#__PURE__*/React.createElement(Tab, {
|
|
699
|
+
value: "two",
|
|
700
|
+
text: "two",
|
|
701
|
+
href: "/two",
|
|
702
|
+
isDisabled: true
|
|
703
|
+
}))));
|
|
704
|
+
const link = screen.getByRole('tab', {
|
|
705
|
+
name: 'two'
|
|
706
|
+
});
|
|
707
|
+
expect(link.tagName).toBe('A');
|
|
708
|
+
expect(link).not.toHaveAttribute('href');
|
|
709
|
+
});
|
|
710
|
+
test('a vertical tablist (position=left) moves focus with ArrowDown, ArrowUp, Home and End', () => {
|
|
711
|
+
render( /*#__PURE__*/React.createElement(Tabs, {
|
|
712
|
+
uniqueId: "tabs",
|
|
713
|
+
position: "left",
|
|
714
|
+
activation: "manual"
|
|
715
|
+
}, /*#__PURE__*/React.createElement(TabList, {
|
|
716
|
+
ariaLabel: "Cities"
|
|
717
|
+
}, /*#__PURE__*/React.createElement(Tab, {
|
|
718
|
+
value: "one",
|
|
719
|
+
text: "one"
|
|
720
|
+
}), /*#__PURE__*/React.createElement(Tab, {
|
|
721
|
+
value: "two",
|
|
722
|
+
text: "two"
|
|
723
|
+
}), /*#__PURE__*/React.createElement(Tab, {
|
|
724
|
+
value: "three",
|
|
725
|
+
text: "three"
|
|
726
|
+
}))));
|
|
727
|
+
const [one, two, three] = screen.getAllByRole('tab');
|
|
728
|
+
/* Dispatched on the focused tab, which is where a real keypress lands - the
|
|
729
|
+
* tablist sees it on the way through, in the capture phase. */
|
|
730
|
+
|
|
731
|
+
const press = key => fireEvent.keyDown(document.activeElement, {
|
|
732
|
+
key
|
|
733
|
+
});
|
|
734
|
+
|
|
735
|
+
one.focus();
|
|
736
|
+
press('ArrowDown');
|
|
737
|
+
expect(document.activeElement).toBe(two);
|
|
738
|
+
press('ArrowUp');
|
|
739
|
+
expect(document.activeElement).toBe(one);
|
|
740
|
+
press('End');
|
|
741
|
+
expect(document.activeElement).toBe(three);
|
|
742
|
+
press('Home');
|
|
743
|
+
expect(document.activeElement).toBe(one);
|
|
744
|
+
/* Wraps, matching the horizontal loop useFocusLoop already provides. */
|
|
745
|
+
|
|
746
|
+
press('ArrowUp');
|
|
747
|
+
expect(document.activeElement).toBe(three);
|
|
748
|
+
});
|
|
749
|
+
test('vertical arrow keys skip a disabled tab', () => {
|
|
750
|
+
render( /*#__PURE__*/React.createElement(Tabs, {
|
|
751
|
+
uniqueId: "tabs",
|
|
752
|
+
position: "left",
|
|
753
|
+
activation: "manual"
|
|
754
|
+
}, /*#__PURE__*/React.createElement(TabList, {
|
|
755
|
+
ariaLabel: "Cities"
|
|
756
|
+
}, /*#__PURE__*/React.createElement(Tab, {
|
|
757
|
+
value: "one",
|
|
758
|
+
text: "one"
|
|
759
|
+
}), /*#__PURE__*/React.createElement(Tab, {
|
|
760
|
+
value: "two",
|
|
761
|
+
text: "two",
|
|
762
|
+
isDisabled: true
|
|
763
|
+
}), /*#__PURE__*/React.createElement(Tab, {
|
|
764
|
+
value: "three",
|
|
765
|
+
text: "three"
|
|
766
|
+
}))));
|
|
767
|
+
const [one,, three] = screen.getAllByRole('tab');
|
|
768
|
+
one.focus();
|
|
769
|
+
fireEvent.keyDown(document.activeElement, {
|
|
770
|
+
key: 'ArrowDown'
|
|
771
|
+
});
|
|
772
|
+
expect(document.activeElement).toBe(three);
|
|
773
|
+
});
|
|
774
|
+
test('the overflow menu filters, and shows an empty state when nothing matches', () => {
|
|
775
|
+
render( /*#__PURE__*/React.createElement(Tabs, {
|
|
776
|
+
uniqueId: "tabs"
|
|
777
|
+
}, /*#__PURE__*/React.createElement(TabList, {
|
|
778
|
+
ariaLabel: "Cities",
|
|
779
|
+
items: ITEMS,
|
|
780
|
+
moreMenu: {
|
|
781
|
+
ariaLabel: 'More tabs',
|
|
782
|
+
searchThreshold: 1,
|
|
783
|
+
searchErrorText: 'No results'
|
|
784
|
+
}
|
|
785
|
+
})));
|
|
786
|
+
fireEvent.click(screen.getByRole('button', {
|
|
787
|
+
name: 'More tabs'
|
|
788
|
+
}));
|
|
789
|
+
const search = document.querySelector('input[name="search"]');
|
|
790
|
+
expect(search).not.toBeNull();
|
|
791
|
+
expect(screen.getAllByRole('menuitem')).toHaveLength(2);
|
|
792
|
+
fireEvent.change(search, {
|
|
793
|
+
target: {
|
|
794
|
+
value: 'char'
|
|
795
|
+
}
|
|
796
|
+
});
|
|
797
|
+
expect(screen.getAllByRole('menuitem')).toHaveLength(1);
|
|
798
|
+
expect(screen.getByText('Charlie')).toBeInTheDocument();
|
|
799
|
+
fireEvent.change(search, {
|
|
800
|
+
target: {
|
|
801
|
+
value: 'zzz'
|
|
802
|
+
}
|
|
803
|
+
});
|
|
804
|
+
expect(screen.queryAllByRole('menuitem')).toHaveLength(0);
|
|
805
|
+
expect(screen.getByText('No results')).toBeInTheDocument();
|
|
806
|
+
});
|
|
807
|
+
test('the overflow menu hides its search below the threshold', () => {
|
|
808
|
+
render( /*#__PURE__*/React.createElement(Tabs, {
|
|
809
|
+
uniqueId: "tabs"
|
|
810
|
+
}, /*#__PURE__*/React.createElement(TabList, {
|
|
811
|
+
ariaLabel: "Cities",
|
|
812
|
+
items: ITEMS,
|
|
813
|
+
moreMenu: {
|
|
814
|
+
ariaLabel: 'More tabs'
|
|
815
|
+
}
|
|
816
|
+
})));
|
|
817
|
+
fireEvent.click(screen.getByRole('button', {
|
|
818
|
+
name: 'More tabs'
|
|
819
|
+
}));
|
|
820
|
+
/* Two tabs collapse here, and the default threshold is 4. */
|
|
821
|
+
|
|
822
|
+
expect(document.querySelector('input[name="search"]')).toBeNull();
|
|
823
|
+
});
|
|
824
|
+
});
|