@workday/canvas-kit-react 7.0.0-alpha.0-next.7 → 7.0.0-alpha.78-next.6
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/badge/README.md +2 -3
- package/banner/lib/BannerIcon.tsx +2 -2
- package/button/README.md +68 -1
- package/button/index.ts +1 -1
- package/button/lib/{parts/ButtonContainer.tsx → BaseButton.tsx} +123 -66
- package/button/lib/DeleteButton.tsx +7 -4
- package/button/lib/PrimaryButton.tsx +86 -109
- package/button/lib/SecondaryButton.tsx +44 -66
- package/button/lib/TertiaryButton.tsx +86 -53
- package/button/lib/ToolbarDropdownButton.tsx +12 -11
- package/button/lib/ToolbarIconButton.tsx +22 -17
- package/button/lib/parts/ButtonLabel.tsx +17 -2
- package/button/lib/parts/ButtonLabelIcon.tsx +30 -54
- package/button/lib/parts/index.tsx +0 -2
- package/button/lib/types.ts +2 -2
- package/common/lib/parts/_brand-assets.ts +5 -5
- package/common/lib/utils/StaticStates.tsx +6 -5
- package/dist/commonjs/banner/lib/BannerIcon.js +2 -2
- package/dist/commonjs/button/index.d.ts +1 -1
- package/dist/commonjs/button/index.d.ts.map +1 -1
- package/dist/commonjs/button/index.js +3 -3
- package/dist/commonjs/button/lib/BaseButton.d.ts +31 -0
- package/dist/commonjs/button/lib/BaseButton.d.ts.map +1 -0
- package/dist/commonjs/button/lib/BaseButton.js +198 -0
- package/dist/commonjs/button/lib/DeleteButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/DeleteButton.js +4 -3
- package/dist/commonjs/button/lib/PrimaryButton.d.ts +4 -76
- package/dist/commonjs/button/lib/PrimaryButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/PrimaryButton.js +15 -36
- package/dist/commonjs/button/lib/SecondaryButton.d.ts +0 -5
- package/dist/commonjs/button/lib/SecondaryButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/SecondaryButton.js +16 -38
- package/dist/commonjs/button/lib/TertiaryButton.d.ts +2 -2
- package/dist/commonjs/button/lib/TertiaryButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/TertiaryButton.js +66 -38
- package/dist/commonjs/button/lib/ToolbarDropdownButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/ToolbarDropdownButton.js +7 -7
- package/dist/commonjs/button/lib/ToolbarIconButton.d.ts +5 -2
- package/dist/commonjs/button/lib/ToolbarIconButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/ToolbarIconButton.js +5 -11
- package/dist/commonjs/button/lib/parts/ButtonLabel.d.ts +4 -4
- package/dist/commonjs/button/lib/parts/ButtonLabel.d.ts.map +1 -1
- package/dist/commonjs/button/lib/parts/ButtonLabel.js +35 -1
- package/dist/commonjs/button/lib/parts/ButtonLabelIcon.d.ts +4 -3
- package/dist/commonjs/button/lib/parts/ButtonLabelIcon.d.ts.map +1 -1
- package/dist/commonjs/button/lib/parts/ButtonLabelIcon.js +13 -62
- package/dist/commonjs/button/lib/parts/index.d.ts +0 -2
- package/dist/commonjs/button/lib/parts/index.d.ts.map +1 -1
- package/dist/commonjs/button/lib/parts/index.js +1 -5
- package/dist/commonjs/button/lib/types.d.ts +2 -2
- package/dist/commonjs/button/lib/types.d.ts.map +1 -1
- package/dist/commonjs/common/lib/parts/_brand-assets.d.ts.map +1 -1
- package/dist/commonjs/common/lib/parts/_brand-assets.js +5 -5
- package/dist/commonjs/common/lib/utils/StaticStates.d.ts.map +1 -1
- package/dist/commonjs/common/lib/utils/StaticStates.js +5 -2
- package/dist/commonjs/icon/lib/AccentIcon.d.ts +3 -5
- package/dist/commonjs/icon/lib/AccentIcon.d.ts.map +1 -1
- package/dist/commonjs/icon/lib/AccentIcon.js +8 -24
- package/dist/commonjs/icon/lib/AppletIcon.d.ts +5 -6
- package/dist/commonjs/icon/lib/AppletIcon.d.ts.map +1 -1
- package/dist/commonjs/icon/lib/AppletIcon.js +13 -27
- package/dist/commonjs/icon/lib/Graphic.d.ts +3 -5
- package/dist/commonjs/icon/lib/Graphic.d.ts.map +1 -1
- package/dist/commonjs/icon/lib/Graphic.js +8 -24
- package/dist/commonjs/icon/lib/Icon.d.ts +2 -5
- package/dist/commonjs/icon/lib/Icon.d.ts.map +1 -1
- package/dist/commonjs/icon/lib/Icon.js +10 -25
- package/dist/commonjs/icon/lib/Svg.d.ts +4 -6
- package/dist/commonjs/icon/lib/Svg.d.ts.map +1 -1
- package/dist/commonjs/icon/lib/Svg.js +11 -27
- package/dist/commonjs/icon/lib/SystemIcon.d.ts +5 -6
- package/dist/commonjs/icon/lib/SystemIcon.d.ts.map +1 -1
- package/dist/commonjs/icon/lib/SystemIcon.js +8 -24
- package/dist/commonjs/icon/lib/SystemIconCircle.d.ts +3 -6
- package/dist/commonjs/icon/lib/SystemIconCircle.d.ts.map +1 -1
- package/dist/commonjs/icon/lib/SystemIconCircle.js +7 -25
- package/dist/commonjs/layout/lib/Box.d.ts +17 -0
- package/dist/commonjs/layout/lib/Box.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/Box.js +41 -1
- package/dist/commonjs/modal/lib/ModalOverflowOverlay.js +1 -1
- package/dist/commonjs/pagination/lib/Pagination/Controls.d.ts +2 -2
- package/dist/commonjs/pagination/lib/Pagination/Controls.d.ts.map +1 -1
- package/dist/commonjs/pagination/lib/Pagination/Controls.js +4 -4
- package/dist/commonjs/pagination/lib/Pagination/PageButton.d.ts +1 -2
- package/dist/commonjs/pagination/lib/Pagination/PageButton.d.ts.map +1 -1
- package/dist/commonjs/pagination/lib/Pagination/PageButton.js +34 -9
- package/dist/commonjs/pagination/lib/Pagination/Pagination.d.ts +5 -5
- package/dist/commonjs/pagination/lib/Pagination/Pagination.d.ts.map +1 -1
- package/dist/commonjs/popup/lib/PopupCloseIcon.d.ts +2 -2
- package/dist/commonjs/popup/lib/PopupCloseIcon.d.ts.map +1 -1
- package/dist/commonjs/popup/lib/PopupCloseIcon.js +5 -6
- package/dist/commonjs/popup/lib/hooks/useDisableBodyScroll.d.ts.map +1 -1
- package/dist/commonjs/popup/lib/hooks/useDisableBodyScroll.js +4 -0
- package/dist/commonjs/segmented-control/lib/SegmentedControl.d.ts +9 -7
- package/dist/commonjs/segmented-control/lib/SegmentedControl.d.ts.map +1 -1
- package/dist/commonjs/segmented-control/lib/SegmentedControl.js +21 -57
- package/dist/commonjs/segmented-control/lib/SegmentedControlButton.d.ts +8 -0
- package/dist/commonjs/segmented-control/lib/SegmentedControlButton.d.ts.map +1 -0
- package/dist/commonjs/segmented-control/lib/SegmentedControlButton.js +106 -0
- package/dist/commonjs/side-panel/lib/SidePanel.d.ts.map +1 -1
- package/dist/commonjs/side-panel/lib/SidePanel.js +2 -2
- package/dist/commonjs/tabs/lib/Tabs.d.ts +2 -2
- package/dist/commonjs/tabs/lib/TabsItem.d.ts +1 -2
- package/dist/commonjs/tabs/lib/TabsItem.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/TabsList.js +1 -1
- package/dist/commonjs/tabs/lib/menu/Menu.d.ts +1 -1
- package/dist/commonjs/tabs/lib/menu/MenuItem.d.ts +1 -2
- package/dist/commonjs/tabs/lib/menu/MenuItem.d.ts.map +1 -1
- package/dist/commonjs/text-input/lib/InputIconContainer.d.ts +1 -1
- package/dist/commonjs/text-input/lib/InputIconContainer.d.ts.map +1 -1
- package/dist/commonjs/tooltip/lib/Tooltip.d.ts +1 -1
- package/dist/commonjs/tooltip/lib/useTooltip.d.ts +1 -1
- package/dist/es6/banner/lib/BannerIcon.js +2 -2
- package/dist/es6/button/index.d.ts +1 -1
- package/dist/es6/button/index.d.ts.map +1 -1
- package/dist/es6/button/index.js +1 -1
- package/dist/es6/button/lib/BaseButton.d.ts +31 -0
- package/dist/es6/button/lib/BaseButton.d.ts.map +1 -0
- package/dist/es6/button/lib/BaseButton.js +174 -0
- package/dist/es6/button/lib/DeleteButton.d.ts.map +1 -1
- package/dist/es6/button/lib/DeleteButton.js +4 -3
- package/dist/es6/button/lib/PrimaryButton.d.ts +4 -76
- package/dist/es6/button/lib/PrimaryButton.d.ts.map +1 -1
- package/dist/es6/button/lib/PrimaryButton.js +15 -35
- package/dist/es6/button/lib/SecondaryButton.d.ts +0 -5
- package/dist/es6/button/lib/SecondaryButton.d.ts.map +1 -1
- package/dist/es6/button/lib/SecondaryButton.js +16 -38
- package/dist/es6/button/lib/TertiaryButton.d.ts +2 -2
- package/dist/es6/button/lib/TertiaryButton.d.ts.map +1 -1
- package/dist/es6/button/lib/TertiaryButton.js +68 -40
- package/dist/es6/button/lib/ToolbarDropdownButton.d.ts.map +1 -1
- package/dist/es6/button/lib/ToolbarDropdownButton.js +8 -8
- package/dist/es6/button/lib/ToolbarIconButton.d.ts +5 -2
- package/dist/es6/button/lib/ToolbarIconButton.d.ts.map +1 -1
- package/dist/es6/button/lib/ToolbarIconButton.js +7 -13
- package/dist/es6/button/lib/parts/ButtonLabel.d.ts +4 -4
- package/dist/es6/button/lib/parts/ButtonLabel.d.ts.map +1 -1
- package/dist/es6/button/lib/parts/ButtonLabel.js +33 -2
- package/dist/es6/button/lib/parts/ButtonLabelIcon.d.ts +4 -3
- package/dist/es6/button/lib/parts/ButtonLabelIcon.d.ts.map +1 -1
- package/dist/es6/button/lib/parts/ButtonLabelIcon.js +13 -42
- package/dist/es6/button/lib/parts/index.d.ts +0 -2
- package/dist/es6/button/lib/parts/index.d.ts.map +1 -1
- package/dist/es6/button/lib/parts/index.js +0 -2
- package/dist/es6/button/lib/types.d.ts +2 -2
- package/dist/es6/button/lib/types.d.ts.map +1 -1
- package/dist/es6/common/lib/parts/_brand-assets.d.ts.map +1 -1
- package/dist/es6/common/lib/parts/_brand-assets.js +5 -5
- package/dist/es6/common/lib/utils/StaticStates.d.ts.map +1 -1
- package/dist/es6/common/lib/utils/StaticStates.js +5 -2
- package/dist/es6/icon/lib/AccentIcon.d.ts +3 -5
- package/dist/es6/icon/lib/AccentIcon.d.ts.map +1 -1
- package/dist/es6/icon/lib/AccentIcon.js +8 -24
- package/dist/es6/icon/lib/AppletIcon.d.ts +5 -6
- package/dist/es6/icon/lib/AppletIcon.d.ts.map +1 -1
- package/dist/es6/icon/lib/AppletIcon.js +11 -25
- package/dist/es6/icon/lib/Graphic.d.ts +3 -5
- package/dist/es6/icon/lib/Graphic.d.ts.map +1 -1
- package/dist/es6/icon/lib/Graphic.js +8 -24
- package/dist/es6/icon/lib/Icon.d.ts +2 -5
- package/dist/es6/icon/lib/Icon.d.ts.map +1 -1
- package/dist/es6/icon/lib/Icon.js +8 -24
- package/dist/es6/icon/lib/Svg.d.ts +4 -6
- package/dist/es6/icon/lib/Svg.d.ts.map +1 -1
- package/dist/es6/icon/lib/Svg.js +10 -27
- package/dist/es6/icon/lib/SystemIcon.d.ts +5 -6
- package/dist/es6/icon/lib/SystemIcon.d.ts.map +1 -1
- package/dist/es6/icon/lib/SystemIcon.js +8 -24
- package/dist/es6/icon/lib/SystemIconCircle.d.ts +3 -6
- package/dist/es6/icon/lib/SystemIconCircle.d.ts.map +1 -1
- package/dist/es6/icon/lib/SystemIconCircle.js +8 -26
- package/dist/es6/layout/lib/Box.d.ts +17 -0
- package/dist/es6/layout/lib/Box.d.ts.map +1 -1
- package/dist/es6/layout/lib/Box.js +39 -0
- package/dist/es6/modal/lib/ModalOverflowOverlay.js +1 -1
- package/dist/es6/pagination/lib/Pagination/Controls.d.ts +2 -2
- package/dist/es6/pagination/lib/Pagination/Controls.d.ts.map +1 -1
- package/dist/es6/pagination/lib/Pagination/Controls.js +5 -5
- package/dist/es6/pagination/lib/Pagination/PageButton.d.ts +1 -2
- package/dist/es6/pagination/lib/Pagination/PageButton.d.ts.map +1 -1
- package/dist/es6/pagination/lib/Pagination/PageButton.js +35 -10
- package/dist/es6/pagination/lib/Pagination/Pagination.d.ts +5 -5
- package/dist/es6/pagination/lib/Pagination/Pagination.d.ts.map +1 -1
- package/dist/es6/popup/lib/PopupCloseIcon.d.ts +2 -2
- package/dist/es6/popup/lib/PopupCloseIcon.d.ts.map +1 -1
- package/dist/es6/popup/lib/PopupCloseIcon.js +6 -7
- package/dist/es6/popup/lib/hooks/useDisableBodyScroll.d.ts.map +1 -1
- package/dist/es6/popup/lib/hooks/useDisableBodyScroll.js +4 -0
- package/dist/es6/segmented-control/lib/SegmentedControl.d.ts +9 -7
- package/dist/es6/segmented-control/lib/SegmentedControl.d.ts.map +1 -1
- package/dist/es6/segmented-control/lib/SegmentedControl.js +20 -57
- package/dist/es6/segmented-control/lib/SegmentedControlButton.d.ts +8 -0
- package/dist/es6/segmented-control/lib/SegmentedControlButton.d.ts.map +1 -0
- package/dist/es6/segmented-control/lib/SegmentedControlButton.js +100 -0
- package/dist/es6/side-panel/lib/SidePanel.d.ts.map +1 -1
- package/dist/es6/side-panel/lib/SidePanel.js +3 -3
- package/dist/es6/tabs/lib/Tabs.d.ts +2 -2
- package/dist/es6/tabs/lib/TabsItem.d.ts +1 -2
- package/dist/es6/tabs/lib/TabsItem.d.ts.map +1 -1
- package/dist/es6/tabs/lib/TabsList.js +1 -1
- package/dist/es6/tabs/lib/menu/Menu.d.ts +1 -1
- package/dist/es6/tabs/lib/menu/MenuItem.d.ts +1 -2
- package/dist/es6/tabs/lib/menu/MenuItem.d.ts.map +1 -1
- package/dist/es6/text-input/lib/InputIconContainer.d.ts +1 -1
- package/dist/es6/text-input/lib/InputIconContainer.d.ts.map +1 -1
- package/dist/es6/tooltip/lib/Tooltip.d.ts +1 -1
- package/dist/es6/tooltip/lib/useTooltip.d.ts +1 -1
- package/icon/README.md +0 -30
- package/icon/lib/AccentIcon.tsx +17 -16
- package/icon/lib/AppletIcon.tsx +18 -12
- package/icon/lib/Graphic.tsx +15 -8
- package/icon/lib/Icon.tsx +10 -8
- package/icon/lib/Svg.tsx +12 -14
- package/icon/lib/SystemIcon.tsx +21 -12
- package/icon/lib/SystemIconCircle.tsx +17 -14
- package/layout/lib/Box.tsx +40 -0
- package/modal/lib/ModalOverflowOverlay.tsx +1 -1
- package/package.json +5 -5
- package/pagination/lib/Pagination/Controls.tsx +6 -10
- package/pagination/lib/Pagination/PageButton.tsx +38 -17
- package/pagination/lib/Pagination/Pagination.tsx +5 -5
- package/popup/lib/PopupCloseIcon.tsx +7 -8
- package/popup/lib/hooks/useDisableBodyScroll.ts +6 -0
- package/segmented-control/README.md +8 -9
- package/segmented-control/lib/SegmentedControl.tsx +39 -78
- package/segmented-control/lib/SegmentedControlButton.tsx +109 -0
- package/side-panel/README.md +3 -3
- package/side-panel/lib/SidePanel.tsx +4 -5
- package/tabs/lib/TabsList.tsx +1 -1
- package/text-input/lib/InputIconContainer.tsx +1 -1
- package/tooltip/README.md +6 -5
- package/tooltip/lib/Tooltip.tsx +1 -1
- package/tooltip/lib/useTooltip.tsx +1 -1
- package/ts3.5/dist/commonjs/button/index.d.ts +1 -1
- package/ts3.5/dist/commonjs/button/lib/BaseButton.d.ts +31 -0
- package/ts3.5/dist/commonjs/button/lib/PrimaryButton.d.ts +4 -76
- package/ts3.5/dist/commonjs/button/lib/SecondaryButton.d.ts +0 -5
- package/ts3.5/dist/commonjs/button/lib/TertiaryButton.d.ts +2 -2
- package/ts3.5/dist/commonjs/button/lib/ToolbarIconButton.d.ts +5 -2
- package/ts3.5/dist/commonjs/button/lib/parts/ButtonLabel.d.ts +4 -4
- package/ts3.5/dist/commonjs/button/lib/parts/ButtonLabelIcon.d.ts +4 -3
- package/ts3.5/dist/commonjs/button/lib/parts/index.d.ts +0 -2
- package/ts3.5/dist/commonjs/button/lib/types.d.ts +2 -2
- package/ts3.5/dist/commonjs/icon/lib/AccentIcon.d.ts +3 -5
- package/ts3.5/dist/commonjs/icon/lib/AppletIcon.d.ts +5 -6
- package/ts3.5/dist/commonjs/icon/lib/Graphic.d.ts +3 -5
- package/ts3.5/dist/commonjs/icon/lib/Icon.d.ts +2 -5
- package/ts3.5/dist/commonjs/icon/lib/Svg.d.ts +4 -6
- package/ts3.5/dist/commonjs/icon/lib/SystemIcon.d.ts +5 -6
- package/ts3.5/dist/commonjs/icon/lib/SystemIconCircle.d.ts +3 -6
- package/ts3.5/dist/commonjs/layout/lib/Box.d.ts +17 -0
- package/ts3.5/dist/commonjs/pagination/lib/Pagination/Controls.d.ts +2 -2
- package/ts3.5/dist/commonjs/pagination/lib/Pagination/PageButton.d.ts +1 -2
- package/ts3.5/dist/commonjs/pagination/lib/Pagination/Pagination.d.ts +5 -5
- package/ts3.5/dist/commonjs/popup/lib/PopupCloseIcon.d.ts +2 -2
- package/ts3.5/dist/commonjs/segmented-control/lib/SegmentedControl.d.ts +9 -7
- package/ts3.5/dist/commonjs/segmented-control/lib/SegmentedControlButton.d.ts +8 -0
- package/ts3.5/dist/commonjs/tabs/lib/Tabs.d.ts +2 -2
- package/ts3.5/dist/commonjs/tabs/lib/TabsItem.d.ts +1 -2
- package/ts3.5/dist/commonjs/tabs/lib/menu/Menu.d.ts +1 -1
- package/ts3.5/dist/commonjs/tabs/lib/menu/MenuItem.d.ts +1 -2
- package/ts3.5/dist/commonjs/text-input/lib/InputIconContainer.d.ts +1 -1
- package/ts3.5/dist/commonjs/tooltip/lib/Tooltip.d.ts +1 -1
- package/ts3.5/dist/commonjs/tooltip/lib/useTooltip.d.ts +1 -1
- package/ts3.5/dist/es6/button/index.d.ts +1 -1
- package/ts3.5/dist/es6/button/lib/BaseButton.d.ts +31 -0
- package/ts3.5/dist/es6/button/lib/PrimaryButton.d.ts +4 -76
- package/ts3.5/dist/es6/button/lib/SecondaryButton.d.ts +0 -5
- package/ts3.5/dist/es6/button/lib/TertiaryButton.d.ts +2 -2
- package/ts3.5/dist/es6/button/lib/ToolbarIconButton.d.ts +5 -2
- package/ts3.5/dist/es6/button/lib/parts/ButtonLabel.d.ts +4 -4
- package/ts3.5/dist/es6/button/lib/parts/ButtonLabelIcon.d.ts +4 -3
- package/ts3.5/dist/es6/button/lib/parts/index.d.ts +0 -2
- package/ts3.5/dist/es6/button/lib/types.d.ts +2 -2
- package/ts3.5/dist/es6/icon/lib/AccentIcon.d.ts +3 -5
- package/ts3.5/dist/es6/icon/lib/AppletIcon.d.ts +5 -6
- package/ts3.5/dist/es6/icon/lib/Graphic.d.ts +3 -5
- package/ts3.5/dist/es6/icon/lib/Icon.d.ts +2 -5
- package/ts3.5/dist/es6/icon/lib/Svg.d.ts +4 -6
- package/ts3.5/dist/es6/icon/lib/SystemIcon.d.ts +5 -6
- package/ts3.5/dist/es6/icon/lib/SystemIconCircle.d.ts +3 -6
- package/ts3.5/dist/es6/layout/lib/Box.d.ts +17 -0
- package/ts3.5/dist/es6/pagination/lib/Pagination/Controls.d.ts +2 -2
- package/ts3.5/dist/es6/pagination/lib/Pagination/PageButton.d.ts +1 -2
- package/ts3.5/dist/es6/pagination/lib/Pagination/Pagination.d.ts +5 -5
- package/ts3.5/dist/es6/popup/lib/PopupCloseIcon.d.ts +2 -2
- package/ts3.5/dist/es6/segmented-control/lib/SegmentedControl.d.ts +9 -7
- package/ts3.5/dist/es6/segmented-control/lib/SegmentedControlButton.d.ts +8 -0
- package/ts3.5/dist/es6/tabs/lib/Tabs.d.ts +2 -2
- package/ts3.5/dist/es6/tabs/lib/TabsItem.d.ts +1 -2
- package/ts3.5/dist/es6/tabs/lib/menu/Menu.d.ts +1 -1
- package/ts3.5/dist/es6/tabs/lib/menu/MenuItem.d.ts +1 -2
- package/ts3.5/dist/es6/text-input/lib/InputIconContainer.d.ts +1 -1
- package/ts3.5/dist/es6/tooltip/lib/Tooltip.d.ts +1 -1
- package/ts3.5/dist/es6/tooltip/lib/useTooltip.d.ts +1 -1
- package/button/lib/IconButton.tsx +0 -279
- package/button/lib/parts/ButtonLabelData.tsx +0 -16
- package/dist/commonjs/button/lib/IconButton.d.ts +0 -44
- package/dist/commonjs/button/lib/IconButton.d.ts.map +0 -1
- package/dist/commonjs/button/lib/IconButton.js +0 -219
- package/dist/commonjs/button/lib/parts/ButtonContainer.d.ts +0 -33
- package/dist/commonjs/button/lib/parts/ButtonContainer.d.ts.map +0 -1
- package/dist/commonjs/button/lib/parts/ButtonContainer.js +0 -126
- package/dist/commonjs/button/lib/parts/ButtonLabelData.d.ts +0 -3
- package/dist/commonjs/button/lib/parts/ButtonLabelData.d.ts.map +0 -1
- package/dist/commonjs/button/lib/parts/ButtonLabelData.js +0 -45
- package/dist/es6/button/lib/IconButton.d.ts +0 -44
- package/dist/es6/button/lib/IconButton.d.ts.map +0 -1
- package/dist/es6/button/lib/IconButton.js +0 -197
- package/dist/es6/button/lib/parts/ButtonContainer.d.ts +0 -33
- package/dist/es6/button/lib/parts/ButtonContainer.d.ts.map +0 -1
- package/dist/es6/button/lib/parts/ButtonContainer.js +0 -120
- package/dist/es6/button/lib/parts/ButtonLabelData.d.ts +0 -3
- package/dist/es6/button/lib/parts/ButtonLabelData.d.ts.map +0 -1
- package/dist/es6/button/lib/parts/ButtonLabelData.js +0 -22
- package/ts3.5/dist/commonjs/button/lib/IconButton.d.ts +0 -44
- package/ts3.5/dist/commonjs/button/lib/parts/ButtonContainer.d.ts +0 -33
- package/ts3.5/dist/commonjs/button/lib/parts/ButtonLabelData.d.ts +0 -3
- package/ts3.5/dist/es6/button/lib/IconButton.d.ts +0 -44
- package/ts3.5/dist/es6/button/lib/parts/ButtonContainer.d.ts +0 -33
- package/ts3.5/dist/es6/button/lib/parts/ButtonLabelData.d.ts +0 -3
|
@@ -10,110 +10,10 @@ import {
|
|
|
10
10
|
} from '@workday/canvas-kit-react/common';
|
|
11
11
|
import {colors} from '@workday/canvas-kit-react/tokens';
|
|
12
12
|
import {CanvasSystemIcon} from '@workday/design-assets-types';
|
|
13
|
-
|
|
14
|
-
import {ButtonContainer, ButtonLabel, ButtonLabelData, ButtonLabelIcon} from './parts';
|
|
15
13
|
import {ButtonSizes, IconPositions} from './types';
|
|
14
|
+
import {BaseButton, getMinWidthStyles, getPaddingStyles} from './BaseButton';
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* The variant of the PrimaryButton.
|
|
20
|
-
* @default undefined
|
|
21
|
-
*/
|
|
22
|
-
variant?: 'inverse';
|
|
23
|
-
/**
|
|
24
|
-
* There are four button sizes: `extraSmall`, `small`, `medium`, and `large`.
|
|
25
|
-
* If no size is provided, it will default to `medium`.
|
|
26
|
-
*
|
|
27
|
-
* @default 'medium'
|
|
28
|
-
*/
|
|
29
|
-
size?: ButtonSizes;
|
|
30
|
-
/**
|
|
31
|
-
* The data label of the Button.
|
|
32
|
-
* Note: not displayed at `small` size
|
|
33
|
-
*/
|
|
34
|
-
dataLabel?: String;
|
|
35
|
-
/**
|
|
36
|
-
* The icon of the Button.
|
|
37
|
-
* Note: not displayed at `small` size
|
|
38
|
-
*/
|
|
39
|
-
icon?: CanvasSystemIcon;
|
|
40
|
-
/**
|
|
41
|
-
* Button icon positions can either be `left` or `right`.
|
|
42
|
-
* If no value is provided, it defaults to `left`.
|
|
43
|
-
* @default 'left'
|
|
44
|
-
*/
|
|
45
|
-
iconPosition?: IconPositions;
|
|
46
|
-
/**
|
|
47
|
-
* If set to `true`, transform the icon's x-axis to mirror the graphic
|
|
48
|
-
* @default false
|
|
49
|
-
*/
|
|
50
|
-
shouldMirrorIcon?: boolean;
|
|
51
|
-
children?: React.ReactNode;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// Button sizes where data labels are enabled
|
|
55
|
-
const dataLabelSizes = ['medium', 'large'];
|
|
56
|
-
// All disabled buttons are set to 40% opacity.
|
|
57
|
-
// This will eventually live in the ButtonContainer styles, but for now we're scoping it to Primary, Secondary, and Tertiary buttons.
|
|
58
|
-
const disabledButtonOpacity = {
|
|
59
|
-
'&:disabled, &:disabled:active': {
|
|
60
|
-
opacity: 0.4,
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export const PrimaryButton = createComponent('button')({
|
|
65
|
-
displayName: 'PrimaryButton',
|
|
66
|
-
Component: (
|
|
67
|
-
{
|
|
68
|
-
// TODO: Fix useTheme and make it a real hook
|
|
69
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
70
|
-
theme = useTheme(),
|
|
71
|
-
size = 'medium',
|
|
72
|
-
iconPosition = 'left',
|
|
73
|
-
variant,
|
|
74
|
-
dataLabel,
|
|
75
|
-
icon,
|
|
76
|
-
shouldMirrorIcon = false,
|
|
77
|
-
children,
|
|
78
|
-
...elemProps
|
|
79
|
-
}: PrimaryButtonProps,
|
|
80
|
-
ref,
|
|
81
|
-
Element
|
|
82
|
-
) => (
|
|
83
|
-
<ButtonContainer
|
|
84
|
-
ref={ref}
|
|
85
|
-
as={Element}
|
|
86
|
-
colors={getPrimaryButtonColors(variant, theme)}
|
|
87
|
-
size={size}
|
|
88
|
-
extraStyles={disabledButtonOpacity}
|
|
89
|
-
{...elemProps}
|
|
90
|
-
>
|
|
91
|
-
{icon && iconPosition === 'left' && (
|
|
92
|
-
<ButtonLabelIcon
|
|
93
|
-
size={size}
|
|
94
|
-
iconPosition={iconPosition}
|
|
95
|
-
icon={icon}
|
|
96
|
-
shouldMirrorIcon={shouldMirrorIcon}
|
|
97
|
-
/>
|
|
98
|
-
)}
|
|
99
|
-
<ButtonLabel>{children}</ButtonLabel>
|
|
100
|
-
{dataLabel && dataLabelSizes.includes(size) && <ButtonLabelData>{dataLabel}</ButtonLabelData>}
|
|
101
|
-
{icon && iconPosition === 'right' && (
|
|
102
|
-
<ButtonLabelIcon
|
|
103
|
-
size={size}
|
|
104
|
-
iconPosition={iconPosition}
|
|
105
|
-
icon={icon}
|
|
106
|
-
shouldMirrorIcon={shouldMirrorIcon}
|
|
107
|
-
/>
|
|
108
|
-
)}
|
|
109
|
-
</ButtonContainer>
|
|
110
|
-
),
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
export const getPrimaryButtonColors = (
|
|
114
|
-
variant: 'inverse' | undefined,
|
|
115
|
-
theme: EmotionCanvasTheme
|
|
116
|
-
) => {
|
|
16
|
+
const getPrimaryButtonColors = (variant: 'inverse' | undefined, theme: EmotionCanvasTheme) => {
|
|
117
17
|
const {
|
|
118
18
|
canvas: {
|
|
119
19
|
palette: {primary: themePrimary},
|
|
@@ -149,30 +49,27 @@ export const getPrimaryButtonColors = (
|
|
|
149
49
|
background: colors.frenchVanilla100,
|
|
150
50
|
icon: colors.blackPepper400,
|
|
151
51
|
label: colors.blackPepper400,
|
|
152
|
-
labelData: colors.blackPepper400,
|
|
153
52
|
},
|
|
154
53
|
hover: {
|
|
155
54
|
background: colors.soap300,
|
|
156
55
|
icon: colors.blackPepper500,
|
|
157
56
|
label: colors.blackPepper500,
|
|
158
|
-
labelData: colors.blackPepper500,
|
|
159
57
|
},
|
|
160
58
|
active: {
|
|
161
|
-
background: colors.
|
|
59
|
+
background: colors.soap400,
|
|
162
60
|
icon: colors.blackPepper500,
|
|
163
61
|
label: colors.blackPepper500,
|
|
164
|
-
labelData: colors.blackPepper500,
|
|
165
62
|
},
|
|
166
63
|
focus: {
|
|
167
64
|
background: colors.frenchVanilla100,
|
|
168
65
|
border: colors.blackPepper400,
|
|
169
66
|
icon: colors.blackPepper400,
|
|
170
67
|
label: colors.blackPepper400,
|
|
171
|
-
|
|
68
|
+
|
|
172
69
|
focusRing: focusRing(
|
|
173
70
|
{
|
|
174
71
|
separation: 1,
|
|
175
|
-
innerColor: colors.
|
|
72
|
+
innerColor: colors.blackPepper400,
|
|
176
73
|
outerColor: colors.frenchVanilla100,
|
|
177
74
|
},
|
|
178
75
|
theme
|
|
@@ -183,8 +80,88 @@ export const getPrimaryButtonColors = (
|
|
|
183
80
|
background: colors.frenchVanilla100,
|
|
184
81
|
icon: colors.blackPepper400,
|
|
185
82
|
label: colors.blackPepper400,
|
|
186
|
-
labelData: colors.blackPepper400,
|
|
187
83
|
},
|
|
188
84
|
};
|
|
189
85
|
}
|
|
190
86
|
};
|
|
87
|
+
|
|
88
|
+
export interface PrimaryButtonProps extends Themeable, GrowthBehavior {
|
|
89
|
+
/**
|
|
90
|
+
* The variant of the PrimaryButton.
|
|
91
|
+
* @default undefined
|
|
92
|
+
*/
|
|
93
|
+
variant?: 'inverse';
|
|
94
|
+
/**
|
|
95
|
+
* There are four button sizes: `extraSmall`, `small`, `medium`, and `large`.
|
|
96
|
+
* If no size is provided, it will default to `medium`.
|
|
97
|
+
*
|
|
98
|
+
* @default 'medium'
|
|
99
|
+
*/
|
|
100
|
+
size?: ButtonSizes;
|
|
101
|
+
/**
|
|
102
|
+
* The icon of the Button.
|
|
103
|
+
* Note: not displayed at `small` size
|
|
104
|
+
*/
|
|
105
|
+
icon?: CanvasSystemIcon;
|
|
106
|
+
/**
|
|
107
|
+
* Button icon positions can either be `start` or `end`.
|
|
108
|
+
* If no value is provided, it defaults to `start`.
|
|
109
|
+
* @default 'start'
|
|
110
|
+
*/
|
|
111
|
+
iconPosition?: IconPositions;
|
|
112
|
+
/**
|
|
113
|
+
* If set to `true`, transform the icon's x-axis to mirror the graphic
|
|
114
|
+
* @default false
|
|
115
|
+
*/
|
|
116
|
+
shouldMirrorIcon?: boolean;
|
|
117
|
+
children?: React.ReactNode;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export const PrimaryButton = createComponent('button')({
|
|
121
|
+
displayName: 'PrimaryButton',
|
|
122
|
+
Component: (
|
|
123
|
+
{
|
|
124
|
+
size = 'medium',
|
|
125
|
+
iconPosition = 'start',
|
|
126
|
+
variant,
|
|
127
|
+
icon,
|
|
128
|
+
shouldMirrorIcon = false,
|
|
129
|
+
children,
|
|
130
|
+
...elemProps
|
|
131
|
+
}: PrimaryButtonProps,
|
|
132
|
+
ref,
|
|
133
|
+
Element
|
|
134
|
+
) => {
|
|
135
|
+
const theme = useTheme();
|
|
136
|
+
return (
|
|
137
|
+
<BaseButton
|
|
138
|
+
ref={ref}
|
|
139
|
+
size={size}
|
|
140
|
+
colors={getPrimaryButtonColors(variant, theme)}
|
|
141
|
+
padding={getPaddingStyles(children, size, icon, iconPosition)}
|
|
142
|
+
minWidth={getMinWidthStyles(children, size)}
|
|
143
|
+
as={Element}
|
|
144
|
+
{...elemProps}
|
|
145
|
+
>
|
|
146
|
+
{icon && iconPosition === 'start' && (
|
|
147
|
+
<BaseButton.Icon
|
|
148
|
+
size={size}
|
|
149
|
+
iconPosition={iconPosition}
|
|
150
|
+
icon={icon}
|
|
151
|
+
shouldMirrorIcon={shouldMirrorIcon}
|
|
152
|
+
/>
|
|
153
|
+
)}
|
|
154
|
+
{children && <BaseButton.Label>{children}</BaseButton.Label>}
|
|
155
|
+
|
|
156
|
+
{icon && iconPosition === 'end' && (
|
|
157
|
+
<BaseButton.Icon
|
|
158
|
+
size={size}
|
|
159
|
+
iconPosition={iconPosition}
|
|
160
|
+
icon={icon}
|
|
161
|
+
shouldMirrorIcon={shouldMirrorIcon}
|
|
162
|
+
/>
|
|
163
|
+
)}
|
|
164
|
+
</BaseButton>
|
|
165
|
+
);
|
|
166
|
+
},
|
|
167
|
+
});
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from '@workday/canvas-kit-react/common';
|
|
12
12
|
import {CanvasSystemIcon} from '@workday/design-assets-types';
|
|
13
13
|
import {ButtonColors, ButtonSizes, IconPositions} from './types';
|
|
14
|
-
import {
|
|
14
|
+
import {BaseButton, getMinWidthStyles, getPaddingStyles} from './BaseButton';
|
|
15
15
|
|
|
16
16
|
export interface SecondaryButtonProps extends Themeable, GrowthBehavior {
|
|
17
17
|
/**
|
|
@@ -26,11 +26,6 @@ export interface SecondaryButtonProps extends Themeable, GrowthBehavior {
|
|
|
26
26
|
* @default 'medium'
|
|
27
27
|
*/
|
|
28
28
|
size?: ButtonSizes;
|
|
29
|
-
/**
|
|
30
|
-
* The data label of the Button.
|
|
31
|
-
* Note: not displayed at `small` size
|
|
32
|
-
*/
|
|
33
|
-
dataLabel?: String;
|
|
34
29
|
/**
|
|
35
30
|
* The icon of the Button.
|
|
36
31
|
* Note: not displayed at `small` size
|
|
@@ -50,27 +45,13 @@ export interface SecondaryButtonProps extends Themeable, GrowthBehavior {
|
|
|
50
45
|
children?: React.ReactNode;
|
|
51
46
|
}
|
|
52
47
|
|
|
53
|
-
// Button sizes where data labels are enabled
|
|
54
|
-
const dataLabelSizes = ['medium', 'large'];
|
|
55
|
-
// All disabled buttons are set to 40% opacity.
|
|
56
|
-
// This will eventually live in the ButtonContainer styles, but for now we're scoping it to Primary, Secondary, and Tertiary buttons.
|
|
57
|
-
const disabledButtonOpacity = {
|
|
58
|
-
'&:disabled, &:disabled:active': {
|
|
59
|
-
opacity: 0.4,
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
|
|
63
48
|
export const SecondaryButton = createComponent('button')({
|
|
64
49
|
displayName: 'SecondaryButton',
|
|
65
50
|
Component: (
|
|
66
51
|
{
|
|
67
|
-
// TODO: Fix useTheme and make it a real hook
|
|
68
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
69
|
-
theme = useTheme(),
|
|
70
52
|
size = 'medium',
|
|
71
|
-
iconPosition = '
|
|
53
|
+
iconPosition = 'start',
|
|
72
54
|
variant,
|
|
73
|
-
dataLabel,
|
|
74
55
|
icon,
|
|
75
56
|
shouldMirrorIcon = false,
|
|
76
57
|
children,
|
|
@@ -78,35 +59,39 @@ export const SecondaryButton = createComponent('button')({
|
|
|
78
59
|
}: SecondaryButtonProps,
|
|
79
60
|
ref,
|
|
80
61
|
Element
|
|
81
|
-
) =>
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
62
|
+
) => {
|
|
63
|
+
const theme = useTheme();
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<BaseButton
|
|
67
|
+
ref={ref}
|
|
68
|
+
size={size}
|
|
69
|
+
colors={getSecondaryButtonColors(variant, theme)}
|
|
70
|
+
padding={getPaddingStyles(children, size, icon, iconPosition)}
|
|
71
|
+
minWidth={getMinWidthStyles(children, size)}
|
|
72
|
+
as={Element}
|
|
73
|
+
{...elemProps}
|
|
74
|
+
>
|
|
75
|
+
{icon && iconPosition === 'start' && (
|
|
76
|
+
<BaseButton.Icon
|
|
77
|
+
size={size}
|
|
78
|
+
iconPosition={iconPosition}
|
|
79
|
+
icon={icon}
|
|
80
|
+
shouldMirrorIcon={shouldMirrorIcon}
|
|
81
|
+
/>
|
|
82
|
+
)}
|
|
83
|
+
{children && <BaseButton.Label>{children}</BaseButton.Label>}
|
|
84
|
+
{icon && iconPosition === 'end' && (
|
|
85
|
+
<BaseButton.Icon
|
|
86
|
+
size={size}
|
|
87
|
+
iconPosition={iconPosition}
|
|
88
|
+
icon={icon}
|
|
89
|
+
shouldMirrorIcon={shouldMirrorIcon}
|
|
90
|
+
/>
|
|
91
|
+
)}
|
|
92
|
+
</BaseButton>
|
|
93
|
+
);
|
|
94
|
+
},
|
|
110
95
|
});
|
|
111
96
|
|
|
112
97
|
export const getSecondaryButtonColors = (
|
|
@@ -128,27 +113,23 @@ export const getSecondaryButtonColors = (
|
|
|
128
113
|
border: colors.blackPepper400,
|
|
129
114
|
icon: colors.blackPepper400,
|
|
130
115
|
label: colors.blackPepper400,
|
|
131
|
-
labelData: colors.blackPepper400,
|
|
132
116
|
},
|
|
133
117
|
hover: {
|
|
134
118
|
background: colors.blackPepper400,
|
|
135
119
|
border: colors.blackPepper400,
|
|
136
120
|
icon: themePrimary.contrast,
|
|
137
121
|
label: themePrimary.contrast,
|
|
138
|
-
labelData: themePrimary.contrast,
|
|
139
122
|
},
|
|
140
123
|
active: {
|
|
141
124
|
background: colors.blackPepper500,
|
|
142
125
|
border: colors.blackPepper500,
|
|
143
126
|
icon: themePrimary.contrast,
|
|
144
127
|
label: themePrimary.contrast,
|
|
145
|
-
labelData: themePrimary.contrast,
|
|
146
128
|
},
|
|
147
129
|
focus: {
|
|
148
130
|
border: colors.blackPepper400,
|
|
149
131
|
icon: colors.blackPepper400,
|
|
150
132
|
label: colors.blackPepper400,
|
|
151
|
-
labelData: colors.blackPepper400,
|
|
152
133
|
},
|
|
153
134
|
// Identical to 'default' styles. ButtonContainer will set opacity to 40%
|
|
154
135
|
disabled: {
|
|
@@ -156,7 +137,6 @@ export const getSecondaryButtonColors = (
|
|
|
156
137
|
border: colors.blackPepper400,
|
|
157
138
|
icon: colors.blackPepper400,
|
|
158
139
|
label: colors.blackPepper400,
|
|
159
|
-
labelData: colors.blackPepper400,
|
|
160
140
|
},
|
|
161
141
|
};
|
|
162
142
|
case 'inverse':
|
|
@@ -170,26 +150,24 @@ export const getSecondaryButtonColors = (
|
|
|
170
150
|
hover: {
|
|
171
151
|
background: colors.soap300,
|
|
172
152
|
border: colors.soap300,
|
|
173
|
-
icon: colors.
|
|
174
|
-
label: colors.
|
|
175
|
-
labelData: colors.blackPepper400,
|
|
153
|
+
icon: colors.blackPepper500,
|
|
154
|
+
label: colors.blackPepper500,
|
|
176
155
|
},
|
|
177
156
|
active: {
|
|
178
157
|
background: colors.soap400,
|
|
179
158
|
border: colors.soap400,
|
|
180
|
-
icon: colors.
|
|
181
|
-
label: colors.
|
|
182
|
-
labelData: colors.blackPepper400,
|
|
159
|
+
icon: colors.blackPepper500,
|
|
160
|
+
label: colors.blackPepper500,
|
|
183
161
|
},
|
|
184
162
|
focus: {
|
|
185
163
|
background: colors.frenchVanilla100,
|
|
186
|
-
icon: colors.
|
|
187
|
-
|
|
188
|
-
|
|
164
|
+
icon: colors.blackPepper500,
|
|
165
|
+
border: colors.blackPepper400,
|
|
166
|
+
label: colors.blackPepper500,
|
|
189
167
|
focusRing: focusRing(
|
|
190
168
|
{
|
|
191
|
-
separation:
|
|
192
|
-
innerColor:
|
|
169
|
+
separation: 1,
|
|
170
|
+
innerColor: colors.blackPepper400,
|
|
193
171
|
outerColor: colors.frenchVanilla100,
|
|
194
172
|
},
|
|
195
173
|
theme
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {CSSObject} from '@emotion/styled';
|
|
3
2
|
import {
|
|
4
3
|
focusRing,
|
|
5
4
|
useTheme,
|
|
6
5
|
Themeable,
|
|
7
6
|
EmotionCanvasTheme,
|
|
8
7
|
createComponent,
|
|
8
|
+
styled,
|
|
9
|
+
StyledType,
|
|
9
10
|
} from '@workday/canvas-kit-react/common';
|
|
10
|
-
import {colors, space
|
|
11
|
+
import {borderRadius, colors, space} from '@workday/canvas-kit-react/tokens';
|
|
11
12
|
import {CanvasSystemIcon} from '@workday/design-assets-types';
|
|
12
|
-
import {ButtonColors,
|
|
13
|
-
import {
|
|
13
|
+
import {ButtonColors, IconPositions, ButtonSizes} from './types';
|
|
14
|
+
import {BaseButton} from './BaseButton';
|
|
14
15
|
|
|
15
16
|
export interface TertiaryButtonProps extends Themeable {
|
|
16
17
|
/**
|
|
@@ -24,7 +25,7 @@ export interface TertiaryButtonProps extends Themeable {
|
|
|
24
25
|
*
|
|
25
26
|
* @default 'medium'
|
|
26
27
|
*/
|
|
27
|
-
size?:
|
|
28
|
+
size?: ButtonSizes;
|
|
28
29
|
/**
|
|
29
30
|
* Button icon positions can either be `left` or `right`.
|
|
30
31
|
* If no value is provided, it defaults to `left`.
|
|
@@ -49,7 +50,8 @@ export interface TertiaryButtonProps extends Themeable {
|
|
|
49
50
|
|
|
50
51
|
const getTertiaryButtonColors = (
|
|
51
52
|
variant: 'inverse' | undefined,
|
|
52
|
-
theme: EmotionCanvasTheme
|
|
53
|
+
theme: EmotionCanvasTheme,
|
|
54
|
+
children: React.ReactNode
|
|
53
55
|
): ButtonColors => {
|
|
54
56
|
const {
|
|
55
57
|
canvas: {
|
|
@@ -97,65 +99,103 @@ const getTertiaryButtonColors = (
|
|
|
97
99
|
} else {
|
|
98
100
|
return {
|
|
99
101
|
default: {
|
|
100
|
-
icon: themePrimary.main,
|
|
102
|
+
icon: children ? themePrimary.main : colors.blackPepper400,
|
|
101
103
|
label: themePrimary.main,
|
|
102
104
|
},
|
|
103
105
|
hover: {
|
|
104
106
|
background: colors.soap200,
|
|
105
|
-
icon: themePrimary.dark,
|
|
107
|
+
icon: children ? themePrimary.dark : colors.blackPepper500,
|
|
106
108
|
label: themePrimary.dark,
|
|
107
109
|
},
|
|
108
110
|
active: {
|
|
109
111
|
background: colors.soap300,
|
|
110
|
-
icon: themePrimary.dark,
|
|
112
|
+
icon: children ? themePrimary.dark : colors.blackPepper500,
|
|
111
113
|
label: themePrimary.dark,
|
|
112
114
|
},
|
|
113
115
|
focus: {
|
|
114
|
-
icon: themePrimary.
|
|
115
|
-
label: themePrimary.
|
|
116
|
-
focusRing: focusRing({}, theme),
|
|
116
|
+
icon: children ? themePrimary.main : colors.blackPepper500,
|
|
117
|
+
label: themePrimary.main,
|
|
118
|
+
focusRing: focusRing({innerColor: colors.blueberry400}, theme),
|
|
117
119
|
},
|
|
118
120
|
disabled: {
|
|
119
|
-
icon: themePrimary.main,
|
|
121
|
+
icon: children ? themePrimary.main : colors.blackPepper400,
|
|
120
122
|
label: themePrimary.main,
|
|
121
123
|
},
|
|
122
124
|
};
|
|
123
125
|
}
|
|
124
126
|
};
|
|
125
127
|
|
|
128
|
+
const StyledButtonLabel = styled(BaseButton.Label)({
|
|
129
|
+
textDecoration: 'underline',
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
const StyledTertiaryButtonContainer = styled(BaseButton)<
|
|
133
|
+
StyledType & Pick<TertiaryButtonProps, 'allCaps'>
|
|
134
|
+
>(
|
|
135
|
+
{
|
|
136
|
+
border: '0',
|
|
137
|
+
},
|
|
138
|
+
({allCaps}) => ({
|
|
139
|
+
textTransform: allCaps ? 'uppercase' : undefined,
|
|
140
|
+
})
|
|
141
|
+
);
|
|
142
|
+
|
|
126
143
|
const getPaddingStyles = (
|
|
127
144
|
icon: CanvasSystemIcon | undefined,
|
|
128
|
-
iconPosition: '
|
|
145
|
+
iconPosition: 'start' | 'end',
|
|
146
|
+
children: React.ReactNode,
|
|
147
|
+
size: ButtonSizes
|
|
129
148
|
): string => {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
149
|
+
if (children) {
|
|
150
|
+
// if there is an icon on the left, add 4px extra padding to the right for visual balance
|
|
151
|
+
if (icon && iconPosition === 'start') {
|
|
152
|
+
if (size === 'extraSmall') {
|
|
153
|
+
return `0 ${space.xxs} 0 ${space.xxxs}`;
|
|
154
|
+
}
|
|
155
|
+
return `0 ${space.xs} 0 ${space.xxs}`;
|
|
156
|
+
}
|
|
157
|
+
// if there is an icon on the right, add 4px extra padding to the left for visual balance
|
|
158
|
+
if (icon && iconPosition === 'end') {
|
|
159
|
+
if (size === 'extraSmall') {
|
|
160
|
+
return `0 ${space.xxxs} 0 ${space.xxs}`;
|
|
161
|
+
}
|
|
162
|
+
return `0 ${space.xxs} 0 ${space.xs}`;
|
|
163
|
+
}
|
|
164
|
+
// if there is no icon, return the default padding
|
|
165
|
+
return `0 ${space.xxs}`;
|
|
166
|
+
} else {
|
|
167
|
+
return '0';
|
|
137
168
|
}
|
|
138
|
-
// if there is no icon, return the default padding
|
|
139
|
-
return `0 ${space.xxs}`;
|
|
140
169
|
};
|
|
141
170
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
171
|
+
const getMinWidthStyles = (children: React.ReactNode, size: ButtonSizes): string => {
|
|
172
|
+
let minWidthNum;
|
|
173
|
+
switch (size) {
|
|
174
|
+
case 'large':
|
|
175
|
+
minWidthNum = '48px';
|
|
176
|
+
break;
|
|
177
|
+
case 'medium':
|
|
178
|
+
minWidthNum = space.xl;
|
|
179
|
+
break;
|
|
180
|
+
case 'small':
|
|
181
|
+
minWidthNum = space.l;
|
|
182
|
+
break;
|
|
183
|
+
case 'extraSmall':
|
|
184
|
+
minWidthNum = space.m;
|
|
185
|
+
break;
|
|
186
|
+
default:
|
|
187
|
+
minWidthNum = space.xl;
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
return children ? 'auto' : minWidthNum;
|
|
148
191
|
};
|
|
149
192
|
|
|
150
193
|
export const TertiaryButton = createComponent('button')({
|
|
151
194
|
displayName: 'TertiaryButton',
|
|
152
195
|
Component: (
|
|
153
196
|
{
|
|
154
|
-
// TODO: Fix useTheme and make it a real hook
|
|
155
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
156
|
-
theme = useTheme(),
|
|
157
197
|
size = 'medium',
|
|
158
|
-
iconPosition = '
|
|
198
|
+
iconPosition = 'start',
|
|
159
199
|
variant,
|
|
160
200
|
children,
|
|
161
201
|
icon,
|
|
@@ -166,45 +206,38 @@ export const TertiaryButton = createComponent('button')({
|
|
|
166
206
|
ref,
|
|
167
207
|
Element
|
|
168
208
|
) => {
|
|
169
|
-
const
|
|
170
|
-
borderRadius: borderRadius.m,
|
|
171
|
-
border: '0',
|
|
172
|
-
padding: getPaddingStyles(icon, iconPosition),
|
|
173
|
-
minWidth: 'auto',
|
|
174
|
-
textTransform: allCaps ? 'uppercase' : undefined,
|
|
175
|
-
'.wdc-text-button-label': {
|
|
176
|
-
textDecoration: 'underline',
|
|
177
|
-
},
|
|
178
|
-
...disabledButtonOpacity,
|
|
179
|
-
};
|
|
209
|
+
const theme = useTheme();
|
|
180
210
|
|
|
181
211
|
return (
|
|
182
|
-
<
|
|
212
|
+
<StyledTertiaryButtonContainer
|
|
183
213
|
ref={ref}
|
|
184
214
|
as={Element}
|
|
185
|
-
|
|
215
|
+
allCaps={allCaps}
|
|
216
|
+
colors={getTertiaryButtonColors(variant, theme, children)}
|
|
186
217
|
size={size}
|
|
187
|
-
|
|
218
|
+
padding={getPaddingStyles(icon, iconPosition, children, size)}
|
|
219
|
+
minWidth={getMinWidthStyles(children, size)}
|
|
220
|
+
style={{borderRadius: children ? borderRadius.m : borderRadius.circle}}
|
|
188
221
|
{...elemProps}
|
|
189
222
|
>
|
|
190
|
-
{icon && iconPosition === '
|
|
191
|
-
<
|
|
223
|
+
{icon && iconPosition === 'start' && (
|
|
224
|
+
<BaseButton.Icon
|
|
192
225
|
size={size}
|
|
193
226
|
iconPosition={iconPosition}
|
|
194
227
|
icon={icon}
|
|
195
228
|
shouldMirrorIcon={shouldMirrorIcon}
|
|
196
229
|
/>
|
|
197
230
|
)}
|
|
198
|
-
<
|
|
199
|
-
{icon && iconPosition === '
|
|
200
|
-
<
|
|
231
|
+
{children && <StyledButtonLabel>{children}</StyledButtonLabel>}
|
|
232
|
+
{icon && iconPosition === 'end' && (
|
|
233
|
+
<BaseButton.Icon
|
|
201
234
|
size={size}
|
|
202
235
|
iconPosition={iconPosition}
|
|
203
236
|
icon={icon}
|
|
204
237
|
shouldMirrorIcon={shouldMirrorIcon}
|
|
205
238
|
/>
|
|
206
239
|
)}
|
|
207
|
-
</
|
|
240
|
+
</StyledTertiaryButtonContainer>
|
|
208
241
|
);
|
|
209
242
|
},
|
|
210
243
|
});
|