@workday/canvas-kit-react 15.1.11 → 15.1.14
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/collection/lib/useOverflowListModel.tsx +9 -0
- package/dist/commonjs/action-bar/lib/ActionBarList.js +1 -1
- package/dist/commonjs/action-bar/lib/ActionBarOverflowButton.js +1 -1
- package/dist/commonjs/avatar/lib/Avatar.js +13 -13
- package/dist/commonjs/avatar/lib/AvatarImage.js +1 -1
- package/dist/commonjs/avatar/lib/AvatarName.js +1 -1
- package/dist/commonjs/avatar/lib/BaseAvatar.js +12 -12
- package/dist/commonjs/badge/lib/CountBadge.js +6 -6
- package/dist/commonjs/banner/lib/Banner.js +5 -5
- package/dist/commonjs/banner/lib/BannerActionText.js +2 -2
- package/dist/commonjs/banner/lib/BannerIcon.js +1 -1
- package/dist/commonjs/banner/lib/BannerLabel.js +1 -1
- package/dist/commonjs/breadcrumbs/lib/BreadcrumbsCurrentItem.js +1 -1
- package/dist/commonjs/breadcrumbs/lib/BreadcrumbsItem.js +1 -1
- package/dist/commonjs/breadcrumbs/lib/BreadcrumbsLink.js +1 -1
- package/dist/commonjs/breadcrumbs/lib/BreadcrumbsList.js +1 -1
- package/dist/commonjs/breadcrumbs/lib/BreadcrumbsMenu.js +2 -2
- package/dist/commonjs/breadcrumbs/lib/BreadcrumbsOverflowButton.js +1 -1
- package/dist/commonjs/button/lib/BaseButton.js +21 -21
- package/dist/commonjs/button/lib/DeleteButton.js +1 -1
- package/dist/commonjs/button/lib/ExternalHyperlink.js +1 -1
- package/dist/commonjs/button/lib/Hyperlink.js +4 -4
- package/dist/commonjs/button/lib/PrimaryButton.js +2 -2
- package/dist/commonjs/button/lib/SecondaryButton.js +2 -2
- package/dist/commonjs/button/lib/TertiaryButton.js +17 -17
- package/dist/commonjs/button/lib/ToolbarDropdownButton.js +3 -3
- package/dist/commonjs/button/lib/ToolbarIconButton.js +1 -1
- package/dist/commonjs/button/lib/parts/ButtonLabel.js +1 -1
- package/dist/commonjs/button/lib/parts/ButtonLabelIcon.js +5 -5
- package/dist/commonjs/card/lib/Card.js +3 -3
- package/dist/commonjs/card/lib/CardBody.js +1 -1
- package/dist/commonjs/card/lib/CardHeading.js +1 -1
- package/dist/commonjs/checkbox/lib/CheckBackground.js +6 -6
- package/dist/commonjs/checkbox/lib/CheckboxCheck.js +6 -6
- package/dist/commonjs/checkbox/lib/CheckboxContainer.js +1 -1
- package/dist/commonjs/checkbox/lib/CheckboxInput.js +5 -5
- package/dist/commonjs/checkbox/lib/CheckboxRipple.js +1 -1
- package/dist/commonjs/collection/lib/ListBox.js +3 -3
- package/dist/commonjs/collection/lib/useOverflowListModel.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/useOverflowListModel.js +2 -0
- package/dist/commonjs/color-picker/lib/ColorInput.js +3 -3
- package/dist/commonjs/color-picker/lib/ColorPreview.js +1 -1
- package/dist/commonjs/color-picker/lib/parts/ColorSwatch.js +2 -2
- package/dist/commonjs/combobox/lib/ComboboxCard.js +1 -1
- package/dist/commonjs/combobox/lib/ComboboxMenuList.js +1 -1
- package/dist/commonjs/common/lib/AccessibleHide.js +1 -1
- package/dist/commonjs/common/lib/CanvasProvider.js +1 -1
- package/dist/commonjs/common/lib/EllipsisText.js +1 -1
- package/dist/commonjs/expandable/lib/Expandable.js +1 -1
- package/dist/commonjs/expandable/lib/ExpandableAvatar.js +1 -1
- package/dist/commonjs/expandable/lib/ExpandableContent.js +1 -1
- package/dist/commonjs/expandable/lib/ExpandableIcon.js +10 -10
- package/dist/commonjs/expandable/lib/ExpandableTarget.js +1 -1
- package/dist/commonjs/expandable/lib/ExpandableTitle.js +1 -1
- package/dist/commonjs/form-field/lib/FormFieldField.js +1 -1
- package/dist/commonjs/form-field/lib/FormFieldGroupLabel.js +5 -5
- package/dist/commonjs/form-field/lib/FormFieldGroupList.js +3 -3
- package/dist/commonjs/form-field/lib/FormFieldHint.js +3 -3
- package/dist/commonjs/form-field/lib/FormFieldLabel.js +6 -6
- package/dist/commonjs/form-field/lib/formFieldStencil.js +8 -8
- package/dist/commonjs/icon/lib/AccentIcon.js +2 -2
- package/dist/commonjs/icon/lib/AppletIcon.js +1 -1
- package/dist/commonjs/icon/lib/ExpressiveIcon.js +1 -1
- package/dist/commonjs/icon/lib/Graphic.js +4 -4
- package/dist/commonjs/icon/lib/Svg.js +3 -3
- package/dist/commonjs/icon/lib/SystemIcon.js +1 -1
- package/dist/commonjs/icon/lib/SystemIconCircle.js +2 -2
- package/dist/commonjs/information-highlight/lib/InformationHighlight.js +7 -7
- package/dist/commonjs/information-highlight/lib/parts/Body.js +1 -1
- package/dist/commonjs/information-highlight/lib/parts/Heading.js +1 -1
- package/dist/commonjs/information-highlight/lib/parts/Link.js +1 -1
- package/dist/commonjs/loading-dots/lib/LoadingDots.js +3 -3
- package/dist/commonjs/menu/lib/MenuCard.js +1 -1
- package/dist/commonjs/menu/lib/MenuDivider.js +1 -1
- package/dist/commonjs/menu/lib/MenuGroup.js +1 -1
- package/dist/commonjs/menu/lib/MenuItem.js +1 -1
- package/dist/commonjs/menu/lib/MenuList.js +3 -3
- package/dist/commonjs/menu/lib/MenuPopper.d.ts +5 -1
- package/dist/commonjs/menu/lib/MenuPopper.d.ts.map +1 -1
- package/dist/commonjs/menu/lib/MenuPopper.js +6 -2
- package/dist/commonjs/menu/lib/Submenu.d.ts.map +1 -1
- package/dist/commonjs/menu/lib/Submenu.js +68 -2
- package/dist/commonjs/modal/lib/ModalBody.js +1 -1
- package/dist/commonjs/modal/lib/ModalCard.js +1 -1
- package/dist/commonjs/modal/lib/ModalHeading.js +1 -1
- package/dist/commonjs/modal/lib/ModalOverflowOverlay.js +1 -1
- package/dist/commonjs/modal/lib/ModalOverlay.js +2 -2
- package/dist/commonjs/pagination/lib/Pagination/AdditionalDetails.js +2 -2
- package/dist/commonjs/pagination/lib/Pagination/Controls.js +2 -2
- package/dist/commonjs/pagination/lib/Pagination/GoTo/Form.js +1 -1
- package/dist/commonjs/pagination/lib/Pagination/GoTo/Label.js +1 -1
- package/dist/commonjs/pagination/lib/Pagination/GoTo/TextInput.js +1 -1
- package/dist/commonjs/pagination/lib/Pagination/Nav.js +1 -1
- package/dist/commonjs/pagination/lib/Pagination/PageButton.js +2 -2
- package/dist/commonjs/pagination/lib/Pagination/PageList.js +1 -1
- package/dist/commonjs/pagination/lib/Pagination/Pagination.js +1 -1
- package/dist/commonjs/pagination/lib/Pagination/common/List.js +2 -2
- package/dist/commonjs/pill/lib/Pill.js +3 -3
- package/dist/commonjs/pill/lib/PillAvatar.js +1 -1
- package/dist/commonjs/pill/lib/PillCount.js +1 -1
- package/dist/commonjs/pill/lib/PillIcon.js +1 -1
- package/dist/commonjs/pill/lib/PillIconButton.js +1 -1
- package/dist/commonjs/pill/lib/PillLabel.js +1 -1
- package/dist/commonjs/popup/lib/Popper.d.ts +2 -1
- package/dist/commonjs/popup/lib/Popper.d.ts.map +1 -1
- package/dist/commonjs/popup/lib/Popper.js +4 -1
- package/dist/commonjs/popup/lib/PopupBody.js +1 -1
- package/dist/commonjs/popup/lib/PopupCard.js +2 -2
- package/dist/commonjs/popup/lib/PopupCloseIcon.js +1 -1
- package/dist/commonjs/popup/lib/PopupHeading.js +1 -1
- package/dist/commonjs/popup/lib/hooks/useDisableBodyScroll.js +1 -1
- package/dist/commonjs/segmented-control/lib/SegmentedControlItem.js +16 -16
- package/dist/commonjs/segmented-control/lib/SegmentedControlList.js +3 -3
- package/dist/commonjs/select/lib/SelectCard.js +1 -1
- package/dist/commonjs/select/lib/SelectInput.js +3 -3
- package/dist/commonjs/side-panel/lib/SidePanel.js +7 -7
- package/dist/commonjs/side-panel/lib/SidePanelHeading.js +3 -3
- package/dist/commonjs/side-panel/lib/SidePanelToggleButton.js +10 -10
- package/dist/commonjs/skeleton/lib/Skeleton.js +2 -2
- package/dist/commonjs/skeleton/lib/parts/SkeletonHeader.js +1 -1
- package/dist/commonjs/skeleton/lib/parts/SkeletonShape.js +1 -1
- package/dist/commonjs/skeleton/lib/parts/SkeletonText.js +1 -1
- package/dist/commonjs/switch/lib/Switch.js +7 -7
- package/dist/commonjs/table/lib/BaseTable.js +1 -1
- package/dist/commonjs/table/lib/Table.js +7 -7
- package/dist/commonjs/table/lib/parts/BaseTableBody.js +1 -1
- package/dist/commonjs/table/lib/parts/BaseTableCaption.js +1 -1
- package/dist/commonjs/table/lib/parts/BaseTableCell.js +1 -1
- package/dist/commonjs/table/lib/parts/BaseTableHead.js +1 -1
- package/dist/commonjs/table/lib/parts/BaseTableHeader.js +1 -1
- package/dist/commonjs/table/lib/parts/css-grid-table/TableRow.js +1 -1
- package/dist/commonjs/tabs/lib/TabsItem.d.ts +3 -1
- package/dist/commonjs/tabs/lib/TabsItem.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/TabsItem.js +55 -3
- package/dist/commonjs/tabs/lib/TabsList.d.ts +321 -1
- package/dist/commonjs/tabs/lib/TabsList.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/TabsList.js +66 -12
- package/dist/commonjs/tabs/lib/TabsOverflowButton.d.ts +24 -214
- package/dist/commonjs/tabs/lib/TabsOverflowButton.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/TabsOverflowButton.js +72 -7
- package/dist/commonjs/tabs/lib/useTabsModel.d.ts +5 -0
- package/dist/commonjs/tabs/lib/useTabsModel.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/useTabsModel.js +146 -7
- package/dist/commonjs/testing/lib/ComponentStatesTable.js +1 -1
- package/dist/commonjs/text/lib/LabelText.js +6 -6
- package/dist/commonjs/text/lib/Text.js +16 -16
- package/dist/commonjs/text/lib/TypeLevelComponents.js +4 -4
- package/dist/commonjs/text-area/lib/TextArea.js +5 -5
- package/dist/commonjs/text-input/lib/InputGroup.js +6 -6
- package/dist/commonjs/text-input/lib/TextInput.js +5 -5
- package/dist/commonjs/toast/lib/Toast.js +1 -1
- package/dist/commonjs/toast/lib/ToastBody.js +1 -1
- package/dist/commonjs/toast/lib/ToastCloseIcon.js +1 -1
- package/dist/commonjs/toast/lib/ToastIcon.js +1 -1
- package/dist/commonjs/toast/lib/ToastMessage.js +1 -1
- package/dist/commonjs/tooltip/lib/TooltipContainer.js +3 -3
- package/dist/commonjs/version/lib/version.js +1 -1
- package/dist/es6/action-bar/lib/ActionBarList.js +1 -1
- package/dist/es6/action-bar/lib/ActionBarOverflowButton.js +1 -1
- package/dist/es6/avatar/lib/Avatar.js +13 -13
- package/dist/es6/avatar/lib/AvatarImage.js +1 -1
- package/dist/es6/avatar/lib/AvatarName.js +1 -1
- package/dist/es6/avatar/lib/BaseAvatar.js +12 -12
- package/dist/es6/badge/lib/CountBadge.js +6 -6
- package/dist/es6/banner/lib/Banner.js +5 -5
- package/dist/es6/banner/lib/BannerActionText.js +2 -2
- package/dist/es6/banner/lib/BannerIcon.js +1 -1
- package/dist/es6/banner/lib/BannerLabel.js +1 -1
- package/dist/es6/breadcrumbs/lib/BreadcrumbsCurrentItem.js +1 -1
- package/dist/es6/breadcrumbs/lib/BreadcrumbsItem.js +1 -1
- package/dist/es6/breadcrumbs/lib/BreadcrumbsLink.js +1 -1
- package/dist/es6/breadcrumbs/lib/BreadcrumbsList.js +1 -1
- package/dist/es6/breadcrumbs/lib/BreadcrumbsMenu.js +2 -2
- package/dist/es6/breadcrumbs/lib/BreadcrumbsOverflowButton.js +1 -1
- package/dist/es6/button/lib/BaseButton.js +21 -21
- package/dist/es6/button/lib/DeleteButton.js +1 -1
- package/dist/es6/button/lib/ExternalHyperlink.js +1 -1
- package/dist/es6/button/lib/Hyperlink.js +4 -4
- package/dist/es6/button/lib/PrimaryButton.js +2 -2
- package/dist/es6/button/lib/SecondaryButton.js +2 -2
- package/dist/es6/button/lib/TertiaryButton.js +17 -17
- package/dist/es6/button/lib/ToolbarDropdownButton.js +3 -3
- package/dist/es6/button/lib/ToolbarIconButton.js +1 -1
- package/dist/es6/button/lib/parts/ButtonLabel.js +1 -1
- package/dist/es6/button/lib/parts/ButtonLabelIcon.js +5 -5
- package/dist/es6/card/lib/Card.js +3 -3
- package/dist/es6/card/lib/CardBody.js +1 -1
- package/dist/es6/card/lib/CardHeading.js +1 -1
- package/dist/es6/checkbox/lib/CheckBackground.js +6 -6
- package/dist/es6/checkbox/lib/CheckboxCheck.js +6 -6
- package/dist/es6/checkbox/lib/CheckboxContainer.js +1 -1
- package/dist/es6/checkbox/lib/CheckboxInput.js +5 -5
- package/dist/es6/checkbox/lib/CheckboxRipple.js +1 -1
- package/dist/es6/collection/lib/ListBox.js +3 -3
- package/dist/es6/collection/lib/useOverflowListModel.d.ts.map +1 -1
- package/dist/es6/collection/lib/useOverflowListModel.js +2 -0
- package/dist/es6/color-picker/lib/ColorInput.js +3 -3
- package/dist/es6/color-picker/lib/ColorPreview.js +1 -1
- package/dist/es6/color-picker/lib/parts/ColorSwatch.js +2 -2
- package/dist/es6/combobox/lib/ComboboxCard.js +1 -1
- package/dist/es6/combobox/lib/ComboboxMenuList.js +1 -1
- package/dist/es6/common/lib/AccessibleHide.js +1 -1
- package/dist/es6/common/lib/CanvasProvider.js +1 -1
- package/dist/es6/common/lib/EllipsisText.js +1 -1
- package/dist/es6/expandable/lib/Expandable.js +1 -1
- package/dist/es6/expandable/lib/ExpandableAvatar.js +1 -1
- package/dist/es6/expandable/lib/ExpandableContent.js +1 -1
- package/dist/es6/expandable/lib/ExpandableIcon.js +10 -10
- package/dist/es6/expandable/lib/ExpandableTarget.js +1 -1
- package/dist/es6/expandable/lib/ExpandableTitle.js +1 -1
- package/dist/es6/form-field/lib/FormFieldField.js +1 -1
- package/dist/es6/form-field/lib/FormFieldGroupLabel.js +5 -5
- package/dist/es6/form-field/lib/FormFieldGroupList.js +3 -3
- package/dist/es6/form-field/lib/FormFieldHint.js +3 -3
- package/dist/es6/form-field/lib/FormFieldLabel.js +6 -6
- package/dist/es6/form-field/lib/formFieldStencil.js +8 -8
- package/dist/es6/icon/lib/AccentIcon.js +2 -2
- package/dist/es6/icon/lib/AppletIcon.js +1 -1
- package/dist/es6/icon/lib/ExpressiveIcon.js +1 -1
- package/dist/es6/icon/lib/Graphic.js +4 -4
- package/dist/es6/icon/lib/Svg.js +3 -3
- package/dist/es6/icon/lib/SystemIcon.js +1 -1
- package/dist/es6/icon/lib/SystemIconCircle.js +2 -2
- package/dist/es6/information-highlight/lib/InformationHighlight.js +7 -7
- package/dist/es6/information-highlight/lib/parts/Body.js +1 -1
- package/dist/es6/information-highlight/lib/parts/Heading.js +1 -1
- package/dist/es6/information-highlight/lib/parts/Link.js +1 -1
- package/dist/es6/loading-dots/lib/LoadingDots.js +3 -3
- package/dist/es6/menu/lib/MenuCard.js +1 -1
- package/dist/es6/menu/lib/MenuDivider.js +1 -1
- package/dist/es6/menu/lib/MenuGroup.js +1 -1
- package/dist/es6/menu/lib/MenuItem.js +1 -1
- package/dist/es6/menu/lib/MenuList.js +3 -3
- package/dist/es6/menu/lib/MenuPopper.d.ts +5 -1
- package/dist/es6/menu/lib/MenuPopper.d.ts.map +1 -1
- package/dist/es6/menu/lib/MenuPopper.js +5 -1
- package/dist/es6/menu/lib/Submenu.d.ts.map +1 -1
- package/dist/es6/menu/lib/Submenu.js +70 -4
- package/dist/es6/modal/lib/ModalBody.js +1 -1
- package/dist/es6/modal/lib/ModalCard.js +1 -1
- package/dist/es6/modal/lib/ModalHeading.js +1 -1
- package/dist/es6/modal/lib/ModalOverflowOverlay.js +1 -1
- package/dist/es6/modal/lib/ModalOverlay.js +2 -2
- package/dist/es6/pagination/lib/Pagination/AdditionalDetails.js +2 -2
- package/dist/es6/pagination/lib/Pagination/Controls.js +2 -2
- package/dist/es6/pagination/lib/Pagination/GoTo/Form.js +1 -1
- package/dist/es6/pagination/lib/Pagination/GoTo/Label.js +1 -1
- package/dist/es6/pagination/lib/Pagination/GoTo/TextInput.js +1 -1
- package/dist/es6/pagination/lib/Pagination/Nav.js +1 -1
- package/dist/es6/pagination/lib/Pagination/PageButton.js +2 -2
- package/dist/es6/pagination/lib/Pagination/PageList.js +1 -1
- package/dist/es6/pagination/lib/Pagination/Pagination.js +1 -1
- package/dist/es6/pagination/lib/Pagination/common/List.js +2 -2
- package/dist/es6/pill/lib/Pill.js +3 -3
- package/dist/es6/pill/lib/PillAvatar.js +1 -1
- package/dist/es6/pill/lib/PillCount.js +1 -1
- package/dist/es6/pill/lib/PillIcon.js +1 -1
- package/dist/es6/pill/lib/PillIconButton.js +1 -1
- package/dist/es6/pill/lib/PillLabel.js +1 -1
- package/dist/es6/popup/lib/Popper.d.ts +2 -1
- package/dist/es6/popup/lib/Popper.d.ts.map +1 -1
- package/dist/es6/popup/lib/Popper.js +4 -1
- package/dist/es6/popup/lib/PopupBody.js +1 -1
- package/dist/es6/popup/lib/PopupCard.js +2 -2
- package/dist/es6/popup/lib/PopupCloseIcon.js +1 -1
- package/dist/es6/popup/lib/PopupHeading.js +1 -1
- package/dist/es6/popup/lib/hooks/useDisableBodyScroll.js +1 -1
- package/dist/es6/segmented-control/lib/SegmentedControlItem.js +16 -16
- package/dist/es6/segmented-control/lib/SegmentedControlList.js +3 -3
- package/dist/es6/select/lib/SelectCard.js +1 -1
- package/dist/es6/select/lib/SelectInput.js +3 -3
- package/dist/es6/side-panel/lib/SidePanel.js +7 -7
- package/dist/es6/side-panel/lib/SidePanelHeading.js +3 -3
- package/dist/es6/side-panel/lib/SidePanelToggleButton.js +10 -10
- package/dist/es6/skeleton/lib/Skeleton.js +2 -2
- package/dist/es6/skeleton/lib/parts/SkeletonHeader.js +1 -1
- package/dist/es6/skeleton/lib/parts/SkeletonShape.js +1 -1
- package/dist/es6/skeleton/lib/parts/SkeletonText.js +1 -1
- package/dist/es6/switch/lib/Switch.js +7 -7
- package/dist/es6/table/lib/BaseTable.js +1 -1
- package/dist/es6/table/lib/Table.js +7 -7
- package/dist/es6/table/lib/parts/BaseTableBody.js +1 -1
- package/dist/es6/table/lib/parts/BaseTableCaption.js +1 -1
- package/dist/es6/table/lib/parts/BaseTableCell.js +1 -1
- package/dist/es6/table/lib/parts/BaseTableHead.js +1 -1
- package/dist/es6/table/lib/parts/BaseTableHeader.js +1 -1
- package/dist/es6/table/lib/parts/css-grid-table/TableRow.js +1 -1
- package/dist/es6/tabs/lib/TabsItem.d.ts +3 -1
- package/dist/es6/tabs/lib/TabsItem.d.ts.map +1 -1
- package/dist/es6/tabs/lib/TabsItem.js +33 -4
- package/dist/es6/tabs/lib/TabsList.d.ts +321 -1
- package/dist/es6/tabs/lib/TabsList.d.ts.map +1 -1
- package/dist/es6/tabs/lib/TabsList.js +69 -15
- package/dist/es6/tabs/lib/TabsOverflowButton.d.ts +24 -214
- package/dist/es6/tabs/lib/TabsOverflowButton.d.ts.map +1 -1
- package/dist/es6/tabs/lib/TabsOverflowButton.js +73 -9
- package/dist/es6/tabs/lib/useTabsModel.d.ts +5 -0
- package/dist/es6/tabs/lib/useTabsModel.d.ts.map +1 -1
- package/dist/es6/tabs/lib/useTabsModel.js +146 -7
- package/dist/es6/testing/lib/ComponentStatesTable.js +1 -1
- package/dist/es6/text/lib/LabelText.js +6 -6
- package/dist/es6/text/lib/Text.js +16 -16
- package/dist/es6/text/lib/TypeLevelComponents.js +4 -4
- package/dist/es6/text-area/lib/TextArea.js +5 -5
- package/dist/es6/text-input/lib/InputGroup.js +6 -6
- package/dist/es6/text-input/lib/TextInput.js +5 -5
- package/dist/es6/toast/lib/Toast.js +1 -1
- package/dist/es6/toast/lib/ToastBody.js +1 -1
- package/dist/es6/toast/lib/ToastCloseIcon.js +1 -1
- package/dist/es6/toast/lib/ToastIcon.js +1 -1
- package/dist/es6/toast/lib/ToastMessage.js +1 -1
- package/dist/es6/tooltip/lib/TooltipContainer.js +3 -3
- package/dist/es6/version/lib/version.js +1 -1
- package/menu/lib/MenuPopper.tsx +6 -1
- package/menu/lib/Submenu.tsx +95 -9
- package/package.json +4 -4
- package/popup/lib/Popper.tsx +6 -2
- package/tabs/lib/TabsItem.tsx +36 -0
- package/tabs/lib/TabsList.tsx +84 -5
- package/tabs/lib/TabsOverflowButton.tsx +78 -6
- package/tabs/lib/useTabsModel.tsx +161 -3
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
export { TABS_OVERFLOW_BUTTON_ID } from './useTabsModel';
|
|
2
3
|
export interface OverflowButtonProps {
|
|
3
4
|
/**
|
|
4
5
|
* The label text of the Tab.
|
|
@@ -7,10 +8,6 @@ export interface OverflowButtonProps {
|
|
|
7
8
|
}
|
|
8
9
|
export declare const useTabsOverflowButton: import("@workday/canvas-kit-react/common").BehaviorHook<{
|
|
9
10
|
state: {
|
|
10
|
-
getId: (item: any) => string;
|
|
11
|
-
orientation: import("@workday/canvas-kit-react/collection").Orientation;
|
|
12
|
-
panels: import("@workday/canvas-kit-react/collection").Item<any>[];
|
|
13
|
-
panelIndexRef: React.MutableRefObject<number>;
|
|
14
11
|
hiddenIds: string[];
|
|
15
12
|
itemSizeCache: Record<string, number>;
|
|
16
13
|
itemWidthCache: Record<string, number>;
|
|
@@ -30,19 +27,13 @@ export declare const useTabsOverflowButton: import("@workday/canvas-kit-react/co
|
|
|
30
27
|
UNSTABLE_defaultItemHeight: number;
|
|
31
28
|
containerRef: React.RefObject<HTMLDivElement>;
|
|
32
29
|
id: string;
|
|
30
|
+
orientation: "horizontal" | "vertical";
|
|
33
31
|
indexRef: React.MutableRefObject<number>;
|
|
34
32
|
nonInteractiveIds: string[];
|
|
35
33
|
isVirtualized: boolean;
|
|
36
34
|
items: import("@workday/canvas-kit-react/collection").Item<any>[];
|
|
37
35
|
};
|
|
38
36
|
events: {
|
|
39
|
-
registerPanel: (data: {
|
|
40
|
-
id: string;
|
|
41
|
-
textValue: string;
|
|
42
|
-
}) => void;
|
|
43
|
-
unregisterPanel: (data: {
|
|
44
|
-
id: string;
|
|
45
|
-
}) => void;
|
|
46
37
|
select(data: {
|
|
47
38
|
id: string;
|
|
48
39
|
}): void;
|
|
@@ -116,215 +107,28 @@ export declare const useTabsOverflowButton: import("@workday/canvas-kit-react/co
|
|
|
116
107
|
value: number;
|
|
117
108
|
}): void;
|
|
118
109
|
};
|
|
119
|
-
menu: {
|
|
120
|
-
state: {
|
|
121
|
-
stackRef: React.RefObject<HTMLDivElement>;
|
|
122
|
-
targetRef: React.RefObject<HTMLButtonElement>;
|
|
123
|
-
initialFocusRef: React.RefObject<any> | undefined;
|
|
124
|
-
returnFocusRef: React.RefObject<any> | undefined;
|
|
125
|
-
placement: import("@popperjs/core").Placement;
|
|
126
|
-
id: string;
|
|
127
|
-
visibility: "hidden" | "visible";
|
|
128
|
-
selectedIds: string[] | "all";
|
|
129
|
-
unselectedIds: string[];
|
|
130
|
-
cursorId: string | string[];
|
|
131
|
-
columnCount: number;
|
|
132
|
-
pageSizeRef: React.MutableRefObject<number>;
|
|
133
|
-
cursorIndexRef: {
|
|
134
|
-
readonly current: number;
|
|
135
|
-
};
|
|
136
|
-
UNSTABLE_virtual: import("@tanstack/virtual-core").Virtualizer<HTMLDivElement, Element>;
|
|
137
|
-
UNSTABLE_defaultItemHeight: number;
|
|
138
|
-
containerRef: React.RefObject<HTMLDivElement>;
|
|
139
|
-
orientation: "horizontal" | "vertical";
|
|
140
|
-
indexRef: React.MutableRefObject<number>;
|
|
141
|
-
nonInteractiveIds: string[];
|
|
142
|
-
isVirtualized: boolean;
|
|
143
|
-
items: import("@workday/canvas-kit-react/collection").Item<any>[];
|
|
144
|
-
mode: "multiple" | "single";
|
|
145
|
-
};
|
|
146
|
-
events: {
|
|
147
|
-
updatePlacement(data: {
|
|
148
|
-
placement: import("@popperjs/core").Placement;
|
|
149
|
-
}): void;
|
|
150
|
-
show(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
151
|
-
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
152
|
-
select(data: {
|
|
153
|
-
id: string;
|
|
154
|
-
}): void;
|
|
155
|
-
selectAll(): void;
|
|
156
|
-
unselectAll(): void;
|
|
157
|
-
setSelectedIds(ids: string[] | "all"): void;
|
|
158
|
-
remove(data: {
|
|
159
|
-
id: string;
|
|
160
|
-
nextId?: string | undefined;
|
|
161
|
-
event?: Event | React.SyntheticEvent<Element, Event> | undefined;
|
|
162
|
-
}): void;
|
|
163
|
-
goTo(data: {
|
|
164
|
-
id: string;
|
|
165
|
-
}): void;
|
|
166
|
-
goToNext(): void;
|
|
167
|
-
goToPrevious(): void;
|
|
168
|
-
goToPreviousRow(): void;
|
|
169
|
-
goToNextRow(): void;
|
|
170
|
-
goToFirst(): void;
|
|
171
|
-
goToLast(): void;
|
|
172
|
-
goToFirstOfRow(): void;
|
|
173
|
-
goToLastOfRow(): void;
|
|
174
|
-
goToNextPage(): void;
|
|
175
|
-
goToPreviousPage(): void;
|
|
176
|
-
registerItem(data: {
|
|
177
|
-
id: string;
|
|
178
|
-
textValue: string;
|
|
179
|
-
}): void;
|
|
180
|
-
unregisterItem(data: {
|
|
181
|
-
id: string;
|
|
182
|
-
}): void;
|
|
183
|
-
updateItemHeight(data: {
|
|
184
|
-
value: number;
|
|
185
|
-
}): void;
|
|
186
|
-
};
|
|
187
|
-
UNSTABLE_parentModel: {
|
|
188
|
-
state: {
|
|
189
|
-
selectedIds: string[] | "all";
|
|
190
|
-
unselectedIds: string[];
|
|
191
|
-
cursorId: string | string[];
|
|
192
|
-
columnCount: number;
|
|
193
|
-
pageSizeRef: React.MutableRefObject<number>;
|
|
194
|
-
cursorIndexRef: {
|
|
195
|
-
readonly current: number;
|
|
196
|
-
};
|
|
197
|
-
UNSTABLE_virtual: import("@tanstack/virtual-core").Virtualizer<HTMLDivElement, Element>;
|
|
198
|
-
UNSTABLE_defaultItemHeight: number;
|
|
199
|
-
containerRef: React.RefObject<HTMLDivElement>;
|
|
200
|
-
id: string;
|
|
201
|
-
orientation: "horizontal" | "vertical";
|
|
202
|
-
indexRef: React.MutableRefObject<number>;
|
|
203
|
-
nonInteractiveIds: string[];
|
|
204
|
-
isVirtualized: boolean;
|
|
205
|
-
items: import("@workday/canvas-kit-react/collection").Item<any>[];
|
|
206
|
-
};
|
|
207
|
-
events: {
|
|
208
|
-
select(data: {
|
|
209
|
-
id: string;
|
|
210
|
-
}): void;
|
|
211
|
-
selectAll(): void;
|
|
212
|
-
unselectAll(): void;
|
|
213
|
-
setSelectedIds(ids: string[] | "all"): void;
|
|
214
|
-
remove(data: {
|
|
215
|
-
id: string;
|
|
216
|
-
nextId?: string | undefined;
|
|
217
|
-
event?: Event | React.SyntheticEvent<Element, Event> | undefined;
|
|
218
|
-
}): void;
|
|
219
|
-
goTo(data: {
|
|
220
|
-
id: string;
|
|
221
|
-
}): void;
|
|
222
|
-
goToNext(): void;
|
|
223
|
-
goToPrevious(): void;
|
|
224
|
-
goToPreviousRow(): void;
|
|
225
|
-
goToNextRow(): void;
|
|
226
|
-
goToFirst(): void;
|
|
227
|
-
goToLast(): void;
|
|
228
|
-
goToFirstOfRow(): void;
|
|
229
|
-
goToLastOfRow(): void;
|
|
230
|
-
goToNextPage(): void;
|
|
231
|
-
goToPreviousPage(): void;
|
|
232
|
-
registerItem(data: {
|
|
233
|
-
id: string;
|
|
234
|
-
textValue: string;
|
|
235
|
-
}): void;
|
|
236
|
-
unregisterItem(data: {
|
|
237
|
-
id: string;
|
|
238
|
-
}): void;
|
|
239
|
-
updateItemHeight(data: {
|
|
240
|
-
value: number;
|
|
241
|
-
}): void;
|
|
242
|
-
};
|
|
243
|
-
selection: import("@workday/canvas-kit-react/collection").SelectionManager;
|
|
244
|
-
navigation: import("@workday/canvas-kit-react/collection").NavigationManager;
|
|
245
|
-
getId: (item: any) => string;
|
|
246
|
-
getTextValue: (item: any) => string;
|
|
247
|
-
UNSTABLE_parentModel: {
|
|
248
|
-
state: {
|
|
249
|
-
selectedIds: string[] | "all";
|
|
250
|
-
unselectedIds: string[];
|
|
251
|
-
cursorId: string | string[];
|
|
252
|
-
columnCount: number;
|
|
253
|
-
pageSizeRef: React.MutableRefObject<number>;
|
|
254
|
-
cursorIndexRef: {
|
|
255
|
-
readonly current: number;
|
|
256
|
-
};
|
|
257
|
-
UNSTABLE_virtual: import("@tanstack/virtual-core").Virtualizer<HTMLDivElement, Element>;
|
|
258
|
-
UNSTABLE_defaultItemHeight: number;
|
|
259
|
-
containerRef: React.RefObject<HTMLDivElement>;
|
|
260
|
-
id: string;
|
|
261
|
-
orientation: "horizontal" | "vertical";
|
|
262
|
-
indexRef: React.MutableRefObject<number>;
|
|
263
|
-
nonInteractiveIds: string[];
|
|
264
|
-
isVirtualized: boolean;
|
|
265
|
-
items: import("@workday/canvas-kit-react/collection").Item<any>[];
|
|
266
|
-
};
|
|
267
|
-
events: {
|
|
268
|
-
select(data: {
|
|
269
|
-
id: string;
|
|
270
|
-
}): void;
|
|
271
|
-
selectAll(): void;
|
|
272
|
-
unselectAll(): void;
|
|
273
|
-
setSelectedIds(ids: string[] | "all"): void;
|
|
274
|
-
remove(data: {
|
|
275
|
-
id: string;
|
|
276
|
-
nextId?: string | undefined;
|
|
277
|
-
event?: Event | React.SyntheticEvent<Element, Event> | undefined;
|
|
278
|
-
}): void;
|
|
279
|
-
goTo(data: {
|
|
280
|
-
id: string;
|
|
281
|
-
}): void;
|
|
282
|
-
goToNext(): void;
|
|
283
|
-
goToPrevious(): void;
|
|
284
|
-
goToPreviousRow(): void;
|
|
285
|
-
goToNextRow(): void;
|
|
286
|
-
goToFirst(): void;
|
|
287
|
-
goToLast(): void;
|
|
288
|
-
goToFirstOfRow(): void;
|
|
289
|
-
goToLastOfRow(): void;
|
|
290
|
-
goToNextPage(): void;
|
|
291
|
-
goToPreviousPage(): void;
|
|
292
|
-
registerItem(data: {
|
|
293
|
-
id: string;
|
|
294
|
-
textValue: string;
|
|
295
|
-
}): void;
|
|
296
|
-
unregisterItem(data: {
|
|
297
|
-
id: string;
|
|
298
|
-
}): void;
|
|
299
|
-
updateItemHeight(data: {
|
|
300
|
-
value: number;
|
|
301
|
-
}): void;
|
|
302
|
-
};
|
|
303
|
-
selection: import("@workday/canvas-kit-react/collection").SelectionManager;
|
|
304
|
-
navigation: import("@workday/canvas-kit-react/collection").NavigationManager;
|
|
305
|
-
getId: (item: any) => string;
|
|
306
|
-
getTextValue: (item: any) => string;
|
|
307
|
-
} | undefined;
|
|
308
|
-
};
|
|
309
|
-
selection: import("@workday/canvas-kit-react/collection").SelectionManager;
|
|
310
|
-
navigation: import("@workday/canvas-kit-react/collection").NavigationManager;
|
|
311
|
-
getId: (item: any) => string;
|
|
312
|
-
getTextValue: (item: any) => string;
|
|
313
|
-
};
|
|
314
110
|
selection: import("@workday/canvas-kit-react/collection").SelectionManager;
|
|
315
111
|
navigation: import("@workday/canvas-kit-react/collection").NavigationManager;
|
|
316
112
|
getId: (item: any) => string;
|
|
317
113
|
getTextValue: (item: any) => string;
|
|
318
114
|
}, import("@workday/canvas-kit-react/common").RemoveNulls<import("@workday/canvas-kit-react/common").MergeProps<{
|
|
319
|
-
readonly 'aria-haspopup': true;
|
|
320
|
-
}, import("@workday/canvas-kit-react/common").MergeProps<{
|
|
321
115
|
readonly ref: (instance: HTMLElement | null) => void;
|
|
322
|
-
|
|
116
|
+
}, import("@workday/canvas-kit-react/common").MergeProps<{
|
|
117
|
+
readonly onKeyDown: (event: React.KeyboardEvent<HTMLElement>) => void;
|
|
118
|
+
readonly onClick: () => void;
|
|
119
|
+
readonly 'data-focus-id': string;
|
|
323
120
|
readonly tabIndex: 0 | -1;
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
121
|
+
}, import("@workday/canvas-kit-react/common").MergeProps<{
|
|
122
|
+
readonly ref: (instance: Element | null | undefined) => void;
|
|
123
|
+
readonly 'data-id': string;
|
|
124
|
+
readonly disabled: true | undefined;
|
|
125
|
+
readonly 'aria-setsize': number | undefined;
|
|
126
|
+
readonly 'aria-posinset': number | undefined;
|
|
127
|
+
readonly 'data-index': number | undefined;
|
|
128
|
+
readonly style: React.CSSProperties;
|
|
129
|
+
readonly id: string;
|
|
130
|
+
}, import("@workday/canvas-kit-react/common").MergeProps<{
|
|
131
|
+
readonly 'data-id': "__tabs-overflow__";
|
|
328
132
|
}, import("@workday/canvas-kit-react/common").MergeProps<import("@workday/canvas-kit-react/common").RemoveNulls<import("@workday/canvas-kit-react/common").MergeProps<{
|
|
329
133
|
readonly id: string;
|
|
330
134
|
readonly 'aria-haspopup': "true";
|
|
@@ -333,7 +137,13 @@ export declare const useTabsOverflowButton: import("@workday/canvas-kit-react/co
|
|
|
333
137
|
}, import("@workday/canvas-kit-react/common").MergeProps<{
|
|
334
138
|
readonly ref: (instance: unknown) => void;
|
|
335
139
|
readonly onClick: (event: React.MouseEvent<Element, MouseEvent>) => void;
|
|
336
|
-
}, import("@workday/canvas-kit-react/common").MergeProps<{}, import("@workday/canvas-kit-react/common").MergeProps<{}, import("@workday/canvas-kit-react/common").MergeProps<{}, import("@workday/canvas-kit-react/common").MergeProps<{}, {}>>>>>>>, import("@workday/canvas-kit-react/common").MergeProps<{
|
|
140
|
+
}, import("@workday/canvas-kit-react/common").MergeProps<{}, import("@workday/canvas-kit-react/common").MergeProps<{}, import("@workday/canvas-kit-react/common").MergeProps<{}, import("@workday/canvas-kit-react/common").MergeProps<{}, {}>>>>>>>, import("@workday/canvas-kit-react/common").MergeProps<{
|
|
141
|
+
readonly onFocus: () => void;
|
|
142
|
+
}, {
|
|
143
|
+
readonly 'aria-haspopup': "menu";
|
|
144
|
+
readonly 'aria-selected': false;
|
|
145
|
+
readonly role: "tab";
|
|
146
|
+
}>>>>>>>>;
|
|
337
147
|
export declare const TabsOverflowButton: import("@workday/canvas-kit-react/common").ElementComponentM<"button", OverflowButtonProps, {
|
|
338
148
|
state: {
|
|
339
149
|
getId: (item: any) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabsOverflowButton.d.ts","sourceRoot":"","sources":["../../../../tabs/lib/TabsOverflowButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"TabsOverflowButton.d.ts","sourceRoot":"","sources":["../../../../tabs/lib/TabsOverflowButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAyB/B,OAAO,EAAC,uBAAuB,EAAC,MAAM,gBAAgB,CAAC;AAEvD,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAoCD,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAqCjC,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwB7B,CAAC"}
|
|
@@ -1,25 +1,89 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { composeHooks, createElemPropsHook, createSubModelElemPropsHook, createSubcomponent, } from '@workday/canvas-kit-react/common';
|
|
2
|
+
import { useListItemRegister, useListItemRovingFocus, useOverflowListModel, } from '@workday/canvas-kit-react/collection';
|
|
3
|
+
import { composeHooks, createElemPropsHook, createSubModelElemPropsHook, createSubcomponent, useLocalRef, useResizeObserver, } from '@workday/canvas-kit-react/common';
|
|
4
4
|
import { SystemIcon } from '@workday/canvas-kit-react/icon';
|
|
5
5
|
import { mergeStyles } from '@workday/canvas-kit-react/layout';
|
|
6
6
|
import { useMenuTarget } from '@workday/canvas-kit-react/menu';
|
|
7
7
|
import { createStencil } from '@workday/canvas-kit-styling';
|
|
8
8
|
import { chevronDownSmallIcon } from '@workday/canvas-system-icons-web';
|
|
9
9
|
import { StyledTabItem } from './TabsItem';
|
|
10
|
-
import { useTabsModel } from './useTabsModel';
|
|
10
|
+
import { TABS_OVERFLOW_BUTTON_ID, useTabsModel } from './useTabsModel';
|
|
11
|
+
// Re-export for consumers who may need to reference the overflow button ID
|
|
12
|
+
export { TABS_OVERFLOW_BUTTON_ID } from './useTabsModel';
|
|
11
13
|
const tabsOverflowButtonStencil = createStencil({
|
|
12
|
-
base: { name: "
|
|
13
|
-
}, "tabs-overflow-button-
|
|
14
|
-
|
|
14
|
+
base: { name: "1rucva", styles: "box-sizing:border-box;&:has([data-part=\"tabs-overflow-button-icon\"]){display:flex;gap:0;}" }
|
|
15
|
+
}, "tabs-overflow-button-b7c6dc");
|
|
16
|
+
/**
|
|
17
|
+
* Measures the overflow button and reports its size to the model for overflow calculation.
|
|
18
|
+
* Unlike useOverflowListTarget, this does NOT set aria-hidden or visibility styles because
|
|
19
|
+
* we handle visibility via conditional rendering in the TabsOverflowButton component.
|
|
20
|
+
*/
|
|
21
|
+
const useTabsOverflowButtonMeasure = createElemPropsHook(useOverflowListModel)((model, ref) => {
|
|
22
|
+
const { elementRef, localRef } = useLocalRef(ref);
|
|
23
|
+
useResizeObserver({
|
|
24
|
+
ref: localRef,
|
|
25
|
+
onResize: ({ width = 0, height = 0 }) => {
|
|
26
|
+
if (localRef.current && (width > 0 || height > 0)) {
|
|
27
|
+
const styles = getComputedStyle(localRef.current);
|
|
28
|
+
const w = width + parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
|
|
29
|
+
const h = height + parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
|
|
30
|
+
model.events.setOverflowTargetSize({ width: w, height: h });
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
});
|
|
15
34
|
return {
|
|
16
|
-
|
|
35
|
+
ref: elementRef,
|
|
17
36
|
};
|
|
18
|
-
})
|
|
37
|
+
});
|
|
38
|
+
export const useTabsOverflowButton = composeHooks(
|
|
39
|
+
// Measures the overflow button for overflow calculation (no aria-hidden or visibility styles)
|
|
40
|
+
useTabsOverflowButtonMeasure,
|
|
41
|
+
// Adds roving tabindex behavior for arrow key navigation within the tablist
|
|
42
|
+
useListItemRovingFocus,
|
|
43
|
+
// Registers the overflow button as an item in the collection for cursor navigation
|
|
44
|
+
useListItemRegister,
|
|
45
|
+
// Provides the stable data-id needed for collection registration
|
|
46
|
+
createElemPropsHook(useTabsModel)(() => {
|
|
47
|
+
return {
|
|
48
|
+
'data-id': TABS_OVERFLOW_BUTTON_ID,
|
|
49
|
+
};
|
|
50
|
+
}),
|
|
51
|
+
// Connects to the menu sub-model for popup behavior
|
|
52
|
+
createSubModelElemPropsHook(useTabsModel)(m => m.menu, useMenuTarget),
|
|
53
|
+
// Syncs the cursor to the overflow button when it receives focus.
|
|
54
|
+
// This is needed because when the menu closes and focus returns to the overflow button,
|
|
55
|
+
// the cursor state needs to be updated so arrow key navigation works correctly.
|
|
56
|
+
createElemPropsHook(useTabsModel)(model => {
|
|
57
|
+
return {
|
|
58
|
+
onFocus() {
|
|
59
|
+
model.events.goTo({ id: TABS_OVERFLOW_BUTTON_ID });
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}),
|
|
63
|
+
// Runs FIRST - Sets ARIA attributes for the overflow tab
|
|
64
|
+
// In composeHooks, hooks run right-to-left, and mergeProps gives precedence to elemProps
|
|
65
|
+
// (props from earlier-running hooks). So this runs first and its props win.
|
|
66
|
+
// Note: We intentionally do NOT include useListItemSelect here because clicking
|
|
67
|
+
// the overflow button should open the menu, not select it as the active tab
|
|
68
|
+
createElemPropsHook(useTabsModel)(() => {
|
|
69
|
+
return {
|
|
70
|
+
'aria-haspopup': 'menu',
|
|
71
|
+
'aria-selected': false,
|
|
72
|
+
role: 'tab',
|
|
73
|
+
};
|
|
74
|
+
}));
|
|
19
75
|
export const TabsOverflowButton = createSubcomponent('button')({
|
|
20
76
|
displayName: 'Tabs.OverflowButton',
|
|
21
77
|
modelHook: useTabsModel,
|
|
22
78
|
elemPropsHook: useTabsOverflowButton,
|
|
23
|
-
})(({ children, ...elemProps }, Element) => {
|
|
79
|
+
})(({ children, ...elemProps }, Element, model) => {
|
|
80
|
+
// Don't render the overflow button if there are no hidden items.
|
|
81
|
+
// This removes it from the DOM entirely, which:
|
|
82
|
+
// - Removes it from keyboard navigation (roving focus)
|
|
83
|
+
// - Removes it from screen reader announcements
|
|
84
|
+
// - Prevents the "8 tabs" announcement when only 7 are visible
|
|
85
|
+
if (model.state.hiddenIds.length === 0) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
24
88
|
return (_jsxs(StyledTabItem, { type: "button", as: Element, ...mergeStyles(elemProps, tabsOverflowButtonStencil()), children: [_jsx("span", { children: children }), _jsx(SystemIcon, { "data-part": "tabs-overflow-button-icon", icon: chevronDownSmallIcon })] }));
|
|
25
89
|
});
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* This constant is used as the stable identifier for the overflow button in the tabs collection.
|
|
4
|
+
* It uses a `__` prefix to avoid conflicts with user-provided item IDs.
|
|
5
|
+
*/
|
|
6
|
+
export declare const TABS_OVERFLOW_BUTTON_ID = "__tabs-overflow__";
|
|
2
7
|
/**
|
|
3
8
|
* The TabsModel extends the [Collection
|
|
4
9
|
* System](/get-started/for-developers/guides/collection-api/). Tabs have tab items and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTabsModel.d.ts","sourceRoot":"","sources":["../../../../tabs/lib/useTabsModel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B;;;;;;;;;;;;;;;GAeG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G;;;;;QAEH;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsDL,CAAC"}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { defaultGetId, useListModel, useOverflowListModel, } from '@workday/canvas-kit-react/collection';
|
|
3
|
-
import { createModelHook, useModalityType } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { createModelHook, slugify, useModalityType } from '@workday/canvas-kit-react/common';
|
|
4
4
|
import { useMenuModel } from '@workday/canvas-kit-react/menu';
|
|
5
|
+
/**
|
|
6
|
+
* This constant is used as the stable identifier for the overflow button in the tabs collection.
|
|
7
|
+
* It uses a `__` prefix to avoid conflicts with user-provided item IDs.
|
|
8
|
+
*/
|
|
9
|
+
export const TABS_OVERFLOW_BUTTON_ID = '__tabs-overflow__';
|
|
5
10
|
/**
|
|
6
11
|
* The TabsModel extends the [Collection
|
|
7
12
|
* System](/get-started/for-developers/guides/collection-api/). Tabs have tab items and
|
|
@@ -44,11 +49,73 @@ export const useTabsModel = createModelHook({
|
|
|
44
49
|
requiredConfig: useOverflowListModel.requiredConfig,
|
|
45
50
|
contextOverride: useOverflowListModel.Context,
|
|
46
51
|
})(config => {
|
|
47
|
-
var _a, _b, _c;
|
|
52
|
+
var _a, _b, _c, _d;
|
|
48
53
|
const initialSelectedRef = React.useRef(config.initialTab);
|
|
49
|
-
const
|
|
54
|
+
const userGetId = config.getId || defaultGetId;
|
|
50
55
|
const modality = useModalityType();
|
|
56
|
+
// Stable object so getId can recognize the synthetic overflow item. Callers
|
|
57
|
+
// often pass a getId that only understands their own item shape (for example
|
|
58
|
+
// `item => item.contextId`). Without this, the overflow item gets an empty id
|
|
59
|
+
// and Tabs.List renders it as a normal tab.
|
|
60
|
+
const overflowItemRef = React.useRef({
|
|
61
|
+
id: TABS_OVERFLOW_BUTTON_ID,
|
|
62
|
+
text: 'More',
|
|
63
|
+
});
|
|
64
|
+
const getId = (item) => {
|
|
65
|
+
if (item === overflowItemRef.current) {
|
|
66
|
+
return TABS_OVERFLOW_BUTTON_ID;
|
|
67
|
+
}
|
|
68
|
+
const id = userGetId(item);
|
|
69
|
+
if (id === TABS_OVERFLOW_BUTTON_ID) {
|
|
70
|
+
throw new Error(`Tabs item id "${TABS_OVERFLOW_BUTTON_ID}" is reserved for the overflow tab. Choose a different id.`);
|
|
71
|
+
}
|
|
72
|
+
return id;
|
|
73
|
+
};
|
|
74
|
+
// When using dynamic items, append a synthetic overflow button item to the
|
|
75
|
+
// items array. This ensures the overflow button is included in the navigation
|
|
76
|
+
// sequence for roving tabindex. The overflow button component will handle
|
|
77
|
+
// conditional rendering (not showing when there are no hidden items).
|
|
78
|
+
// The overflow button is NOT included in itemSizeCache (measured separately
|
|
79
|
+
// via setOverflowTargetSize), so it won't be incorrectly hidden.
|
|
80
|
+
const itemsWithOverflowButton = React.useMemo(() => {
|
|
81
|
+
var _a;
|
|
82
|
+
if ((_a = config.items) === null || _a === void 0 ? void 0 : _a.length) {
|
|
83
|
+
return [...config.items, overflowItemRef.current];
|
|
84
|
+
}
|
|
85
|
+
return config.items;
|
|
86
|
+
}, [config.items]);
|
|
87
|
+
// Track whether the overflow button should be non-interactive based on previous
|
|
88
|
+
// render's hiddenIds. We use a ref because hiddenIds isn't available until after
|
|
89
|
+
// the model is created, but we need to pass nonInteractiveIds to the model config.
|
|
90
|
+
// On first render, assume non-interactive (no overflow calculated yet).
|
|
91
|
+
// On subsequent renders, use the previous hiddenIds.length to determine.
|
|
92
|
+
const prevHiddenIdsLengthRef = React.useRef(0);
|
|
93
|
+
const [, setNonInteractiveTick] = React.useState(0);
|
|
94
|
+
const overflowButtonNonInteractive = !!((_a = config.items) === null || _a === void 0 ? void 0 : _a.length) && prevHiddenIdsLengthRef.current === 0;
|
|
95
|
+
// Compute nonInteractiveIds to pass to the model, including overflow button when appropriate
|
|
96
|
+
const nonInteractiveIdsForModel = React.useMemo(() => {
|
|
97
|
+
const baseIds = config.nonInteractiveIds || [];
|
|
98
|
+
if (overflowButtonNonInteractive) {
|
|
99
|
+
return [...baseIds, TABS_OVERFLOW_BUTTON_ID];
|
|
100
|
+
}
|
|
101
|
+
return baseIds;
|
|
102
|
+
}, [config.nonInteractiveIds, overflowButtonNonInteractive]);
|
|
103
|
+
// Stores the ID of a tab that should receive focus after the menu closes.
|
|
104
|
+
// This is used when selecting a tab from the overflow menu - we want focus
|
|
105
|
+
// to go to the newly selected tab, not back to the overflow button.
|
|
106
|
+
const pendingFocusTabIdRef = React.useRef(null);
|
|
107
|
+
const pendingFocusRafOuterRef = React.useRef(0);
|
|
108
|
+
const pendingFocusRafInnerRef = React.useRef(0);
|
|
109
|
+
React.useLayoutEffect(() => {
|
|
110
|
+
return () => {
|
|
111
|
+
cancelAnimationFrame(pendingFocusRafOuterRef.current);
|
|
112
|
+
cancelAnimationFrame(pendingFocusRafInnerRef.current);
|
|
113
|
+
};
|
|
114
|
+
}, []);
|
|
51
115
|
const model = useOverflowListModel(useOverflowListModel.mergeConfig(config, {
|
|
116
|
+
items: itemsWithOverflowButton,
|
|
117
|
+
getId,
|
|
118
|
+
nonInteractiveIds: nonInteractiveIdsForModel,
|
|
52
119
|
shouldCalculateOverflow: modality !== 'touch',
|
|
53
120
|
orientation: config.orientation || 'horizontal',
|
|
54
121
|
onRegisterItem(data) {
|
|
@@ -59,11 +126,64 @@ export const useTabsModel = createModelHook({
|
|
|
59
126
|
},
|
|
60
127
|
initialSelectedIds: config.initialTab
|
|
61
128
|
? [config.initialTab]
|
|
62
|
-
: ((
|
|
129
|
+
: ((_b = config.items) === null || _b === void 0 ? void 0 : _b.length)
|
|
63
130
|
? [getId(config.items[0])]
|
|
64
131
|
: [],
|
|
65
132
|
shouldVirtualize: false,
|
|
66
133
|
}));
|
|
134
|
+
// Update the ref after each render so the next render knows the current hiddenIds.length.
|
|
135
|
+
// If hiddenIds.length changed (e.g. overflow just calculated), force a re-render so
|
|
136
|
+
// we pass the correct nonInteractiveIds and the overflow button is not stuck disabled.
|
|
137
|
+
React.useLayoutEffect(() => {
|
|
138
|
+
const nextLen = model.state.hiddenIds.length;
|
|
139
|
+
if (prevHiddenIdsLengthRef.current !== nextLen) {
|
|
140
|
+
prevHiddenIdsLengthRef.current = nextLen;
|
|
141
|
+
setNonInteractiveTick(t => t + 1);
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
prevHiddenIdsLengthRef.current = nextLen;
|
|
145
|
+
}
|
|
146
|
+
}, [model.state.hiddenIds.length]);
|
|
147
|
+
// When the cursor is on an item that isn't in the DOM, move it to a visible one so the
|
|
148
|
+
// roving tabindex lands on a focusable element. This covers: (1) cursor on a hidden tab when
|
|
149
|
+
// only "More" is visible, and (2) cursor on the overflow button when we widen and it unmounts.
|
|
150
|
+
React.useLayoutEffect(() => {
|
|
151
|
+
var _a;
|
|
152
|
+
const { cursorId, hiddenIds, items } = model.state;
|
|
153
|
+
if (!cursorId) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
const currentCursorId = typeof cursorId === 'string' ? cursorId : ((_a = cursorId.slice(-1)[0]) !== null && _a !== void 0 ? _a : '');
|
|
157
|
+
const cursorOnHidden = currentCursorId ? hiddenIds.includes(currentCursorId) : false;
|
|
158
|
+
const cursorOnOverflowWhenNoOverflow = currentCursorId === TABS_OVERFLOW_BUTTON_ID && hiddenIds.length === 0;
|
|
159
|
+
if (cursorOnHidden) {
|
|
160
|
+
// Move to first visible item (including overflow button when it's the only one visible)
|
|
161
|
+
const firstVisible = items.find(item => !hiddenIds.includes(item.id));
|
|
162
|
+
if (firstVisible) {
|
|
163
|
+
model.events.goTo({ id: firstVisible.id });
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
else if (cursorOnOverflowWhenNoOverflow) {
|
|
167
|
+
// Overflow button unmounted; move to selected tab or first tab (not the overflow button)
|
|
168
|
+
const selectedIds = model.state.selectedIds;
|
|
169
|
+
const selectedId = selectedIds !== 'all' && Array.isArray(selectedIds) && selectedIds.length
|
|
170
|
+
? selectedIds[0]
|
|
171
|
+
: undefined;
|
|
172
|
+
const firstVisibleTab = items.find(item => item.id !== TABS_OVERFLOW_BUTTON_ID && !hiddenIds.includes(item.id));
|
|
173
|
+
const targetId = selectedId && !hiddenIds.includes(selectedId) ? selectedId : firstVisibleTab === null || firstVisibleTab === void 0 ? void 0 : firstVisibleTab.id;
|
|
174
|
+
if (targetId) {
|
|
175
|
+
model.events.goTo({ id: targetId });
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
// Use field-level deps instead of `model.state` so this does not re-run on every model update.
|
|
179
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
180
|
+
}, [
|
|
181
|
+
model.state.cursorId,
|
|
182
|
+
model.state.hiddenIds,
|
|
183
|
+
model.state.items,
|
|
184
|
+
model.state.selectedIds,
|
|
185
|
+
model.events,
|
|
186
|
+
]);
|
|
67
187
|
const panels = useListModel();
|
|
68
188
|
const state = {
|
|
69
189
|
...model.state,
|
|
@@ -100,12 +220,31 @@ export const useTabsModel = createModelHook({
|
|
|
100
220
|
// `getId`/`getTextValue` aren't callbacks or guards, so `mergeConfig` would let these
|
|
101
221
|
// unconditionally clobber a `menuConfig.getId`/`getTextValue` override. Fall back to the
|
|
102
222
|
// top-level Tabs config only when the caller hasn't set one on `menuConfig` directly.
|
|
103
|
-
getId: ((
|
|
104
|
-
getTextValue: ((
|
|
223
|
+
getId: ((_c = config.menuConfig) === null || _c === void 0 ? void 0 : _c.getId) || getId,
|
|
224
|
+
getTextValue: ((_d = config.menuConfig) === null || _d === void 0 ? void 0 : _d.getTextValue) || config.getTextValue,
|
|
105
225
|
nonInteractiveIds: state.nonInteractiveIds.filter(key => !state.hiddenIds.includes(key)),
|
|
106
226
|
onSelect(data) {
|
|
107
|
-
menu
|
|
227
|
+
// Store the tab ID to focus after the menu closes and React re-renders
|
|
228
|
+
pendingFocusTabIdRef.current = data.id;
|
|
229
|
+
// Update state: select the tab, move cursor, then close menu
|
|
108
230
|
events.select(data);
|
|
231
|
+
model.events.goTo({ id: data.id });
|
|
232
|
+
menu.events.hide();
|
|
233
|
+
// Focus the selected tab AFTER React has re-rendered.
|
|
234
|
+
// Double rAF is required because useReturnFocus restores focus to the overflow
|
|
235
|
+
// button on a single rAF after hide; the second frame runs after that restore.
|
|
236
|
+
pendingFocusRafOuterRef.current = requestAnimationFrame(() => {
|
|
237
|
+
pendingFocusRafInnerRef.current = requestAnimationFrame(() => {
|
|
238
|
+
const tabId = pendingFocusTabIdRef.current;
|
|
239
|
+
if (tabId) {
|
|
240
|
+
const tabElement = document.querySelector(`[data-focus-id="${slugify(`${model.state.id}-${tabId}`)}"]`);
|
|
241
|
+
if (tabElement) {
|
|
242
|
+
tabElement.focus();
|
|
243
|
+
}
|
|
244
|
+
pendingFocusTabIdRef.current = null;
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
});
|
|
109
248
|
},
|
|
110
249
|
onShow() {
|
|
111
250
|
// Always select the first item when the menu is opened
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createStyles, px2rem } from '@workday/canvas-kit-styling';
|
|
3
3
|
import { system } from '@workday/canvas-tokens-web';
|
|
4
|
-
const tableStyles = createStyles({ name: "
|
|
4
|
+
const tableStyles = createStyles({ name: "3w2ixi", styles: "width:100%;thead{text-align:start;padding-block-end:var(--cnvs-sys-padding-md);}td, th{min-width:6.25rem;padding-block-end:var(--cnvs-sys-padding-md);padding-inline-end:var(--cnvs-sys-padding-md);text-align:start;}" });
|
|
5
5
|
export const ComponentStatesTable = ({ rowProps, columnProps, children, }) => {
|
|
6
6
|
return (_jsxs("table", { className: tableStyles, children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "Variants" }), columnProps.map(col => (_jsx("th", { children: col.label }, `component-table-heading-${col.label.toLowerCase().replace(' ', ',')}`)))] }) }), _jsx("tbody", { children: rowProps.map(row => {
|
|
7
7
|
return (_jsxs("tr", { children: [_jsx("td", { children: row.label }), columnProps.map(col => {
|