@workday/canvas-kit-react 15.0.0-alpha.0064-next.0 → 15.0.0-alpha.0075-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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 +20 -20
- 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/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 +3 -3
- package/dist/commonjs/checkbox/lib/CheckboxCheck.js +5 -5
- 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/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/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/expandable/lib/Expandable.js +1 -1
- package/dist/commonjs/expandable/lib/ExpandableAvatar.d.ts.map +1 -1
- package/dist/commonjs/expandable/lib/ExpandableAvatar.js +4 -4
- 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/FormFieldContainer.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/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 +1 -1
- package/dist/commonjs/index.d.ts +1 -0
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +1 -0
- 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/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/index.d.ts +8 -0
- package/dist/commonjs/pill/index.d.ts.map +1 -0
- package/dist/commonjs/pill/index.js +23 -0
- package/dist/commonjs/pill/lib/Pill.d.ts +265 -0
- package/dist/commonjs/pill/lib/Pill.d.ts.map +1 -0
- package/dist/commonjs/pill/lib/Pill.js +147 -0
- package/dist/commonjs/pill/lib/PillAvatar.d.ts +526 -0
- package/dist/commonjs/pill/lib/PillAvatar.d.ts.map +1 -0
- package/dist/commonjs/pill/lib/PillAvatar.js +22 -0
- package/dist/commonjs/pill/lib/PillCount.d.ts +12 -0
- package/dist/commonjs/pill/lib/PillCount.d.ts.map +1 -0
- package/dist/commonjs/pill/lib/PillCount.js +21 -0
- package/dist/commonjs/pill/lib/PillIcon.d.ts +54 -0
- package/dist/commonjs/pill/lib/PillIcon.d.ts.map +1 -0
- package/dist/commonjs/pill/lib/PillIcon.js +20 -0
- package/dist/commonjs/pill/lib/PillIconButton.d.ts +148 -0
- package/dist/commonjs/pill/lib/PillIconButton.d.ts.map +1 -0
- package/dist/commonjs/pill/lib/PillIconButton.js +21 -0
- package/dist/commonjs/pill/lib/PillLabel.d.ts +14 -0
- package/dist/commonjs/pill/lib/PillLabel.d.ts.map +1 -0
- package/dist/commonjs/pill/lib/PillLabel.js +17 -0
- package/dist/commonjs/pill/lib/usePillModel.d.ts +46 -0
- package/dist/commonjs/pill/lib/usePillModel.d.ts.map +1 -0
- package/dist/commonjs/pill/lib/usePillModel.js +24 -0
- 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/SegmentedControl.d.ts +1 -1
- package/dist/commonjs/segmented-control/lib/SegmentedControl.js +1 -1
- package/dist/commonjs/segmented-control/lib/SegmentedControlItem.js +16 -16
- package/dist/commonjs/segmented-control/lib/SegmentedControlList.js +4 -4
- package/dist/commonjs/select/lib/SelectCard.js +1 -1
- package/dist/commonjs/select/lib/SelectInput.js +3 -3
- 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.js +1 -1
- package/dist/commonjs/tabs/lib/TabsList.js +8 -8
- package/dist/commonjs/tabs/lib/TabsOverflowButton.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 +2 -2
- 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 +20 -20
- 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/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 +3 -3
- package/dist/es6/checkbox/lib/CheckboxCheck.js +5 -5
- 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/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/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/expandable/lib/Expandable.js +1 -1
- package/dist/es6/expandable/lib/ExpandableAvatar.d.ts.map +1 -1
- package/dist/es6/expandable/lib/ExpandableAvatar.js +4 -4
- 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/FormFieldContainer.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/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 +1 -1
- package/dist/es6/index.d.ts +1 -0
- package/dist/es6/index.d.ts.map +1 -1
- package/dist/es6/index.js +1 -0
- 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/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/index.d.ts +8 -0
- package/dist/es6/pill/index.d.ts.map +1 -0
- package/dist/es6/pill/index.js +7 -0
- package/dist/es6/pill/lib/Pill.d.ts +265 -0
- package/dist/es6/pill/lib/Pill.d.ts.map +1 -0
- package/dist/es6/pill/lib/Pill.js +144 -0
- package/dist/es6/pill/lib/PillAvatar.d.ts +526 -0
- package/dist/es6/pill/lib/PillAvatar.d.ts.map +1 -0
- package/dist/es6/pill/lib/PillAvatar.js +19 -0
- package/dist/es6/pill/lib/PillCount.d.ts +12 -0
- package/dist/es6/pill/lib/PillCount.d.ts.map +1 -0
- package/dist/es6/pill/lib/PillCount.js +18 -0
- package/dist/es6/pill/lib/PillIcon.d.ts +54 -0
- package/dist/es6/pill/lib/PillIcon.d.ts.map +1 -0
- package/dist/es6/pill/lib/PillIcon.js +17 -0
- package/dist/es6/pill/lib/PillIconButton.d.ts +148 -0
- package/dist/es6/pill/lib/PillIconButton.d.ts.map +1 -0
- package/dist/es6/pill/lib/PillIconButton.js +18 -0
- package/dist/es6/pill/lib/PillLabel.d.ts +14 -0
- package/dist/es6/pill/lib/PillLabel.d.ts.map +1 -0
- package/dist/es6/pill/lib/PillLabel.js +14 -0
- package/dist/es6/pill/lib/usePillModel.d.ts +46 -0
- package/dist/es6/pill/lib/usePillModel.d.ts.map +1 -0
- package/dist/es6/pill/lib/usePillModel.js +21 -0
- 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/SegmentedControl.d.ts +1 -1
- package/dist/es6/segmented-control/lib/SegmentedControl.js +1 -1
- package/dist/es6/segmented-control/lib/SegmentedControlItem.js +16 -16
- package/dist/es6/segmented-control/lib/SegmentedControlList.js +4 -4
- package/dist/es6/select/lib/SelectCard.js +1 -1
- package/dist/es6/select/lib/SelectInput.js +3 -3
- 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.js +1 -1
- package/dist/es6/tabs/lib/TabsList.js +8 -8
- package/dist/es6/tabs/lib/TabsOverflowButton.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 +2 -2
- package/dist/es6/version/lib/version.js +1 -1
- package/expandable/lib/ExpandableAvatar.tsx +7 -2
- package/index.ts +1 -0
- package/package.json +5 -5
- package/pill/index.ts +7 -0
- package/pill/lib/Pill.tsx +285 -0
- package/pill/lib/PillAvatar.tsx +35 -0
- package/pill/lib/PillCount.tsx +44 -0
- package/pill/lib/PillIcon.tsx +32 -0
- package/pill/lib/PillIconButton.tsx +86 -0
- package/pill/lib/PillLabel.tsx +32 -0
- package/pill/lib/usePillModel.tsx +23 -0
- package/pill/package.json +6 -0
- package/segmented-control/lib/SegmentedControl.tsx +1 -1
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import {buttonStencil} from '@workday/canvas-kit-react/button';
|
|
2
|
+
import {createContainer, focusRing} from '@workday/canvas-kit-react/common';
|
|
3
|
+
import {Box, BoxProps, mergeStyles} from '@workday/canvas-kit-react/layout';
|
|
4
|
+
import {px2rem, createStencil, cssVar} from '@workday/canvas-kit-styling';
|
|
5
|
+
|
|
6
|
+
import {usePillModel} from './usePillModel';
|
|
7
|
+
|
|
8
|
+
import {PillIcon} from './PillIcon';
|
|
9
|
+
import {PillIconButton} from './PillIconButton';
|
|
10
|
+
import {PillCount, pillCountStencil} from './PillCount';
|
|
11
|
+
import {PillAvatar} from './PillAvatar';
|
|
12
|
+
import {PillLabel} from './PillLabel';
|
|
13
|
+
import {systemIconStencil} from '@workday/canvas-kit-react/icon';
|
|
14
|
+
import {system} from '@workday/canvas-tokens-web';
|
|
15
|
+
|
|
16
|
+
export interface PillProps extends BoxProps {
|
|
17
|
+
/**
|
|
18
|
+
* Defines what kind of pill to render stylistically and its interaction states
|
|
19
|
+
* @default 'default'
|
|
20
|
+
*/
|
|
21
|
+
variant?: 'readOnly' | 'removable';
|
|
22
|
+
/**
|
|
23
|
+
* Determines the max width of the pill. If the pill text is longer than the max width,
|
|
24
|
+
* text will be truncated and a tooltip will show the rest of the content when hovered over
|
|
25
|
+
*/
|
|
26
|
+
maxWidth?: string | number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const pillStencil = createStencil({
|
|
30
|
+
extends: buttonStencil,
|
|
31
|
+
vars: {
|
|
32
|
+
maxWidth: '',
|
|
33
|
+
},
|
|
34
|
+
base: ({maxWidth}) => ({
|
|
35
|
+
display: 'initial',
|
|
36
|
+
flexDirection: 'row',
|
|
37
|
+
alignItems: 'center',
|
|
38
|
+
borderRadius: system.shape.x1,
|
|
39
|
+
...system.type.subtext.large,
|
|
40
|
+
lineHeight: system.lineHeight.subtext.small, // ensure correct line height when there's no elements and just text
|
|
41
|
+
boxShadow: 'none',
|
|
42
|
+
outline: 'none',
|
|
43
|
+
fontWeight: system.fontWeight.medium,
|
|
44
|
+
WebkitFontSmoothing: 'antialiased',
|
|
45
|
+
MozOsxFontSmoothing: 'grayscale',
|
|
46
|
+
width: 'fit-content',
|
|
47
|
+
padding: `${px2rem(2)} ${cssVar(system.space.x2)}`,
|
|
48
|
+
height: system.space.x6,
|
|
49
|
+
position: 'relative',
|
|
50
|
+
gap: system.space.x1,
|
|
51
|
+
maxWidth,
|
|
52
|
+
whiteSpace: 'nowrap',
|
|
53
|
+
textOverflow: 'ellipsis',
|
|
54
|
+
overflow: 'hidden',
|
|
55
|
+
[buttonStencil.vars.background]: system.color.bg.alt.default,
|
|
56
|
+
[buttonStencil.vars.border]: system.color.border.input.default,
|
|
57
|
+
[buttonStencil.vars.label]: system.color.fg.strong,
|
|
58
|
+
[systemIconStencil.vars.color]: 'currentColor',
|
|
59
|
+
[pillCountStencil.vars.borderColor]: 'transparent',
|
|
60
|
+
|
|
61
|
+
'&:has(span)': {
|
|
62
|
+
display: 'flex',
|
|
63
|
+
lineHeight: system.lineHeight.subtext.large, // ensure correct line height
|
|
64
|
+
},
|
|
65
|
+
'&:hover, &.hover': {
|
|
66
|
+
[buttonStencil.vars.background]: system.color.bg.alt.strong,
|
|
67
|
+
[buttonStencil.vars.border]: system.color.border.input.strong,
|
|
68
|
+
[buttonStencil.vars.label]: system.color.fg.strong,
|
|
69
|
+
[systemIconStencil.vars.color]: 'currentColor',
|
|
70
|
+
[pillCountStencil.vars.backgroundColor]: system.color.bg.muted.softer,
|
|
71
|
+
[pillCountStencil.vars.borderColor]: 'transparent',
|
|
72
|
+
},
|
|
73
|
+
'&:active, &.active': {
|
|
74
|
+
[buttonStencil.vars.background]: system.color.bg.alt.stronger,
|
|
75
|
+
[buttonStencil.vars.border]: system.color.border.input.strong,
|
|
76
|
+
[buttonStencil.vars.label]: system.color.fg.strong,
|
|
77
|
+
[systemIconStencil.vars.color]: 'currentColor',
|
|
78
|
+
[pillCountStencil.vars.backgroundColor]: system.color.bg.muted.softer,
|
|
79
|
+
[pillCountStencil.vars.borderColor]: 'transparent',
|
|
80
|
+
},
|
|
81
|
+
'&:focus-visible, &.focus': {
|
|
82
|
+
[buttonStencil.vars.background]: system.color.bg.alt.default,
|
|
83
|
+
[buttonStencil.vars.border]: system.color.border.primary.default,
|
|
84
|
+
[buttonStencil.vars.label]: system.color.fg.strong,
|
|
85
|
+
borderColor: system.color.border.primary.default,
|
|
86
|
+
[systemIconStencil.vars.color]: 'currentColor',
|
|
87
|
+
[pillCountStencil.vars.borderColor]: system.color.border.primary.default,
|
|
88
|
+
|
|
89
|
+
...focusRing({
|
|
90
|
+
width: 0,
|
|
91
|
+
inset: 'inner',
|
|
92
|
+
innerColor: system.color.border.primary.default,
|
|
93
|
+
outerColor: system.color.border.primary.default,
|
|
94
|
+
separation: 1,
|
|
95
|
+
}),
|
|
96
|
+
},
|
|
97
|
+
'&:disabled, &.disabled': {
|
|
98
|
+
[buttonStencil.vars.background]: system.color.bg.alt.default,
|
|
99
|
+
[buttonStencil.vars.border]: system.color.border.input.disabled,
|
|
100
|
+
[buttonStencil.vars.label]: system.color.fg.disabled,
|
|
101
|
+
[systemIconStencil.vars.color]: 'currentColor',
|
|
102
|
+
[pillCountStencil.vars.backgroundColor]: system.color.bg.alt.strong,
|
|
103
|
+
[pillCountStencil.vars.borderColor]: 'transparent',
|
|
104
|
+
},
|
|
105
|
+
}),
|
|
106
|
+
modifiers: {
|
|
107
|
+
variant: {
|
|
108
|
+
readOnly: {
|
|
109
|
+
border: `${px2rem(1)} solid ${system.color.border.container}`,
|
|
110
|
+
cursor: 'default',
|
|
111
|
+
[buttonStencil.vars.background]: system.color.bg.default,
|
|
112
|
+
'&:hover, &.hover': {
|
|
113
|
+
borderColor: system.color.border.container,
|
|
114
|
+
[buttonStencil.vars.background]: system.color.bg.default,
|
|
115
|
+
},
|
|
116
|
+
'&:focus-visible, &.focus': {
|
|
117
|
+
[buttonStencil.vars.background]: system.color.bg.default,
|
|
118
|
+
},
|
|
119
|
+
'&:active, &.active': {
|
|
120
|
+
[buttonStencil.vars.background]: system.color.bg.default,
|
|
121
|
+
},
|
|
122
|
+
'&:disabled, &.disabled': {
|
|
123
|
+
[buttonStencil.vars.background]: system.color.bg.default,
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
removable: {
|
|
127
|
+
'&:focus-visible, &.focus': {
|
|
128
|
+
[buttonStencil.vars.background]: system.color.bg.alt.default,
|
|
129
|
+
[buttonStencil.vars.border]: system.color.border.input.default,
|
|
130
|
+
[buttonStencil.vars.label]: system.color.fg.strong,
|
|
131
|
+
boxShadow: 'none',
|
|
132
|
+
},
|
|
133
|
+
'&:hover, &.hover': {
|
|
134
|
+
[buttonStencil.vars.background]: system.color.bg.alt.strong,
|
|
135
|
+
},
|
|
136
|
+
'&:active, &.active': {
|
|
137
|
+
[buttonStencil.vars.background]: system.color.bg.alt.stronger,
|
|
138
|
+
},
|
|
139
|
+
'&:disabled, &.disabled': {
|
|
140
|
+
[buttonStencil.vars.background]: system.color.bg.alt.default,
|
|
141
|
+
[systemIconStencil.vars.color]: 'currentColor',
|
|
142
|
+
},
|
|
143
|
+
cursor: 'default',
|
|
144
|
+
overflow: 'revert', // override BaseButton overflow styles so the click target exists outside the pill for removable
|
|
145
|
+
position: 'relative',
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* By default, a `Pill` renders an interactive element that accepts subcomponents. By "interactive"
|
|
153
|
+
* we mean that the Pill container is a focusable element (a `<button>`). All leading elements
|
|
154
|
+
* (icons or avatars) are intended to be descriptive, helping support the label. They should not
|
|
155
|
+
* receive focus.
|
|
156
|
+
*
|
|
157
|
+
* `Pill` is the container component. It also provides a React context model for its subcomponents.
|
|
158
|
+
* Based on the `variant` prop this component will render different styled `Pill`s.
|
|
159
|
+
*
|
|
160
|
+
* Example of read only:
|
|
161
|
+
*
|
|
162
|
+
* ```tsx
|
|
163
|
+
* <Pill variant="readOnly">This is a read only</Pill>
|
|
164
|
+
* ```
|
|
165
|
+
*
|
|
166
|
+
* Example of interactive:
|
|
167
|
+
*
|
|
168
|
+
* ```tsx
|
|
169
|
+
* <Pill onClick={() => console.log('clicked')}>
|
|
170
|
+
* <Pill.Avatar /> Regina Skeltor
|
|
171
|
+
* </Pill>
|
|
172
|
+
* ```
|
|
173
|
+
*
|
|
174
|
+
* Example of removable:
|
|
175
|
+
*
|
|
176
|
+
* ```tsx
|
|
177
|
+
* <Pill variant="removable">
|
|
178
|
+
* <Pill.Avatar /> Regina Skeltor
|
|
179
|
+
* <Pill.IconButton aria-label='Remove user' onClick={() => console.log('clicked')} />
|
|
180
|
+
* </Pill>
|
|
181
|
+
* ```
|
|
182
|
+
*
|
|
183
|
+
* If you set the `Pill` `variant` to `removable`, it will render a `<span>` element. You can then
|
|
184
|
+
* provide a `Pill.IconButton` that acts as the focus target. This creates a smaller, more
|
|
185
|
+
* intentional click target that prevents users from accidentally deleting an item.
|
|
186
|
+
*
|
|
187
|
+
* ```tsx
|
|
188
|
+
* <Pill variant="removable">
|
|
189
|
+
* Shoes
|
|
190
|
+
* <Pill.IconButton aria-label='Remove user' onClick={() => console.log('handle remove')} />
|
|
191
|
+
* </Pill>
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
194
|
+
export const Pill = createContainer('button')({
|
|
195
|
+
displayName: 'Pill',
|
|
196
|
+
modelHook: usePillModel,
|
|
197
|
+
subComponents: {
|
|
198
|
+
/**
|
|
199
|
+
* This component renders an avatar. It supports all props of the `Avatar` component.
|
|
200
|
+
*
|
|
201
|
+
* ```tsx
|
|
202
|
+
* <Pill variant="removable">
|
|
203
|
+
* <Pill.Avatar url={avatarUrl} />
|
|
204
|
+
* <Pill.Label>Regina Skeltor</Pill.Label>
|
|
205
|
+
* <Pill.IconButton aria-label='Remove user' onClick={() => console.log('handle remove')} />
|
|
206
|
+
* </Pill>
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
Avatar: PillAvatar,
|
|
210
|
+
/**
|
|
211
|
+
* This component renders its `children` as the count.
|
|
212
|
+
*
|
|
213
|
+
* ```tsx
|
|
214
|
+
* <Pill onClick={() => console.warn('clicked')}>
|
|
215
|
+
* <Pill.Label>Shoes</Pill.Label>
|
|
216
|
+
* <Pill.Count>30</Pill.Count>
|
|
217
|
+
* </Pill>
|
|
218
|
+
* ```
|
|
219
|
+
*/
|
|
220
|
+
Count: PillCount,
|
|
221
|
+
/**
|
|
222
|
+
* This component renders an `icon`. By default it renders a `plusIcon` but it can be overridden by
|
|
223
|
+
* providing an icon to the `icon` prop. You must provide an `aria-label` for the icon.
|
|
224
|
+
*
|
|
225
|
+
* ```tsx
|
|
226
|
+
* <Pill onClick={() => console.warn('clicked')}>
|
|
227
|
+
* <Pill.Icon aria-label='Add user' />
|
|
228
|
+
* <Pill.Label>Regina Skeltor</Pill.Label>
|
|
229
|
+
* </Pill>
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
232
|
+
Icon: PillIcon,
|
|
233
|
+
/**
|
|
234
|
+
* This component renders a custom icon button. It is only intended to be used with the
|
|
235
|
+
* `removable` variant. By default, it renders a `xSmallIcon` but can be overridden by providing
|
|
236
|
+
* an icon to the `icon` prop.
|
|
237
|
+
*
|
|
238
|
+
* ```tsx
|
|
239
|
+
* <Pill variant="removable">
|
|
240
|
+
* <Pill.Label>Pink Shirts</Pill.Label>
|
|
241
|
+
* <Pill.IconButton aria-label='Remove item' onClick={() => console.warn('clicked')} />
|
|
242
|
+
* </Pill>
|
|
243
|
+
* ```
|
|
244
|
+
*/
|
|
245
|
+
IconButton: PillIconButton,
|
|
246
|
+
/**
|
|
247
|
+
* This component renders a `<span>` that automatically handles overflow by rendering a tooltip.
|
|
248
|
+
* There's no need to use this component directly since the overflow is handled for you automatically unless you have an icon or other element.
|
|
249
|
+
*
|
|
250
|
+
* ```tsx
|
|
251
|
+
* <Pill variant="readOnly">
|
|
252
|
+
* <Pill.Label>Read-only</Pill.Label>
|
|
253
|
+
* </Pill>
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
256
|
+
Label: PillLabel,
|
|
257
|
+
},
|
|
258
|
+
})<PillProps>(({variant, maxWidth = 200, children, ...elemProps}, Element, model) => {
|
|
259
|
+
const maxWidthCSSValue = typeof maxWidth === 'number' ? px2rem(maxWidth) : maxWidth;
|
|
260
|
+
|
|
261
|
+
const isReadOnly = variant === 'readOnly';
|
|
262
|
+
|
|
263
|
+
return variant?.match(/^(readOnly|removable)$/) ? (
|
|
264
|
+
<Box
|
|
265
|
+
as={Element !== 'button' ? Element : 'span'}
|
|
266
|
+
id={isReadOnly ? model.state.id : undefined}
|
|
267
|
+
{...mergeStyles(elemProps, [
|
|
268
|
+
model.state.disabled ? 'disabled' : undefined,
|
|
269
|
+
pillStencil({maxWidth: maxWidthCSSValue, variant}),
|
|
270
|
+
])}
|
|
271
|
+
>
|
|
272
|
+
{isReadOnly ? <PillLabel>{children}</PillLabel> : children}
|
|
273
|
+
</Box>
|
|
274
|
+
) : (
|
|
275
|
+
<Element
|
|
276
|
+
disabled={model.state.disabled}
|
|
277
|
+
{...mergeStyles(elemProps, [
|
|
278
|
+
model.state.disabled ? 'disabled' : undefined,
|
|
279
|
+
pillStencil({maxWidth: maxWidthCSSValue}),
|
|
280
|
+
])}
|
|
281
|
+
>
|
|
282
|
+
{children}
|
|
283
|
+
</Element>
|
|
284
|
+
);
|
|
285
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {createSubcomponent} from '@workday/canvas-kit-react/common';
|
|
2
|
+
import {Avatar, AvatarProps, avatarStencil} from '@workday/canvas-kit-preview-react/avatar';
|
|
3
|
+
import {usePillModel} from './usePillModel';
|
|
4
|
+
import {createStencil, px2rem} from '@workday/canvas-kit-styling';
|
|
5
|
+
import {mergeStyles} from '@workday/canvas-kit-react/layout';
|
|
6
|
+
import {system} from '@workday/canvas-tokens-web';
|
|
7
|
+
|
|
8
|
+
export interface PillAvatarProps extends AvatarProps {}
|
|
9
|
+
|
|
10
|
+
export const pillAvatarStencil = createStencil({
|
|
11
|
+
extends: avatarStencil,
|
|
12
|
+
base: {
|
|
13
|
+
flex: '0 0 auto',
|
|
14
|
+
...system.type.subtext.small,
|
|
15
|
+
'&:disabled, &.disabled': {
|
|
16
|
+
opacity: system.opacity.disabled,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export const PillAvatar = createSubcomponent('div')({
|
|
22
|
+
modelHook: usePillModel,
|
|
23
|
+
})<PillAvatarProps>(({size, ...elemProps}: PillAvatarProps, Element, _model) => {
|
|
24
|
+
return (
|
|
25
|
+
<Avatar
|
|
26
|
+
isDecorative
|
|
27
|
+
as={Element}
|
|
28
|
+
size={px2rem(18)}
|
|
29
|
+
{...mergeStyles(elemProps, [
|
|
30
|
+
pillAvatarStencil(),
|
|
31
|
+
_model.state.disabled ? 'disabled' : undefined,
|
|
32
|
+
])}
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
35
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {createComponent} from '@workday/canvas-kit-react/common';
|
|
2
|
+
import {FlexProps, mergeStyles} from '@workday/canvas-kit-react/layout';
|
|
3
|
+
import {calc, createStencil, cssVar, px2rem} from '@workday/canvas-kit-styling';
|
|
4
|
+
import {system} from '@workday/canvas-tokens-web';
|
|
5
|
+
|
|
6
|
+
export interface PillCountProps extends FlexProps {}
|
|
7
|
+
|
|
8
|
+
export const pillCountStencil = createStencil({
|
|
9
|
+
vars: {
|
|
10
|
+
backgroundColor: '',
|
|
11
|
+
borderColor: '',
|
|
12
|
+
},
|
|
13
|
+
base: ({backgroundColor, borderColor}) => ({
|
|
14
|
+
borderStartStartRadius: system.shape.zero,
|
|
15
|
+
borderStartEndRadius: system.shape.x1,
|
|
16
|
+
borderEndStartRadius: system.shape.zero,
|
|
17
|
+
borderEndEndRadius: system.shape.x1,
|
|
18
|
+
borderWidth: px2rem(1),
|
|
19
|
+
borderInlineStartWidth: system.space.zero,
|
|
20
|
+
borderStyle: 'solid',
|
|
21
|
+
borderColor: cssVar(borderColor, system.color.border.transparent),
|
|
22
|
+
display: 'inline-flex',
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
justifyContent: 'center',
|
|
25
|
+
height: px2rem(22),
|
|
26
|
+
width: system.space.x6,
|
|
27
|
+
padding: `${system.space.zero} ${system.space.x1}`,
|
|
28
|
+
marginInlineEnd: calc.negate(system.space.x2),
|
|
29
|
+
marginInlineStart: system.space.x1,
|
|
30
|
+
backgroundColor: cssVar(backgroundColor, system.color.bg.alt.stronger),
|
|
31
|
+
flex: '0 0 auto',
|
|
32
|
+
}),
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export const PillCount = createComponent('span')({
|
|
36
|
+
displayName: 'Pill.Count',
|
|
37
|
+
Component: ({children, ...elemProps}: PillCountProps, ref, Element) => {
|
|
38
|
+
return (
|
|
39
|
+
<Element ref={ref} {...mergeStyles(elemProps, pillCountStencil())}>
|
|
40
|
+
{children}
|
|
41
|
+
</Element>
|
|
42
|
+
);
|
|
43
|
+
},
|
|
44
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {createSubcomponent} from '@workday/canvas-kit-react/common';
|
|
2
|
+
|
|
3
|
+
import {SystemIcon, SystemIconProps, systemIconStencil} from '@workday/canvas-kit-react/icon';
|
|
4
|
+
import {usePillModel} from './usePillModel';
|
|
5
|
+
import {plusIcon} from '@workday/canvas-system-icons-web';
|
|
6
|
+
import {calc, createStencil, px2rem} from '@workday/canvas-kit-styling';
|
|
7
|
+
import {system} from '@workday/canvas-tokens-web';
|
|
8
|
+
import {mergeStyles} from '@workday/canvas-kit-react/layout';
|
|
9
|
+
|
|
10
|
+
export interface PillIconProps extends Partial<SystemIconProps> {}
|
|
11
|
+
|
|
12
|
+
export const pillIconStencil = createStencil({
|
|
13
|
+
extends: systemIconStencil,
|
|
14
|
+
base: {
|
|
15
|
+
marginInlineStart: calc.negate(system.space.x1),
|
|
16
|
+
[systemIconStencil.vars.size]: px2rem(20),
|
|
17
|
+
flex: '0 0 auto',
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export const PillIcon = createSubcomponent('span')({
|
|
22
|
+
modelHook: usePillModel,
|
|
23
|
+
})<PillIconProps>(({icon, ...elemProps}, Element) => {
|
|
24
|
+
return (
|
|
25
|
+
<SystemIcon
|
|
26
|
+
as={Element}
|
|
27
|
+
role="img"
|
|
28
|
+
icon={icon || plusIcon}
|
|
29
|
+
{...mergeStyles(elemProps, pillIconStencil())}
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
32
|
+
});
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import {focusRing, createSubcomponent} from '@workday/canvas-kit-react/common';
|
|
2
|
+
import {SystemIcon, SystemIconProps, systemIconStencil} from '@workday/canvas-kit-react/icon';
|
|
3
|
+
import {usePillModel} from './usePillModel';
|
|
4
|
+
import {xSmallIcon} from '@workday/canvas-system-icons-web';
|
|
5
|
+
import {buttonStencil} from '@workday/canvas-kit-react/button';
|
|
6
|
+
import {calc, createStencil, px2rem} from '@workday/canvas-kit-styling';
|
|
7
|
+
import {system} from '@workday/canvas-tokens-web';
|
|
8
|
+
import {mergeStyles} from '@workday/canvas-kit-react/layout';
|
|
9
|
+
|
|
10
|
+
export interface PillIconButtonProps extends Partial<SystemIconProps> {
|
|
11
|
+
/**
|
|
12
|
+
* The aria label for the removable icon. You must provide a valid string to represent the action.
|
|
13
|
+
*/
|
|
14
|
+
'aria-label'?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const pillIconButtonStencil = createStencil({
|
|
18
|
+
extends: buttonStencil,
|
|
19
|
+
base: {
|
|
20
|
+
marginInlineEnd: calc.negate(px2rem(7)), // visually pull in the pill to the right size by -7px
|
|
21
|
+
marginInlineStart: calc.negate(px2rem(2)), // visually create space between label and the button by -2px
|
|
22
|
+
borderRadius: system.shape.half,
|
|
23
|
+
height: calc.add(system.space.x4, system.space.x1),
|
|
24
|
+
width: calc.add(system.space.x4, system.space.x1),
|
|
25
|
+
padding: system.space.zero,
|
|
26
|
+
overflow: 'visible',
|
|
27
|
+
flex: '0 0 auto',
|
|
28
|
+
[buttonStencil.vars.border]: system.color.border.transparent,
|
|
29
|
+
[buttonStencil.vars.background]: system.color.bg.alt.default,
|
|
30
|
+
[systemIconStencil.vars.color]: system.color.fg.strong,
|
|
31
|
+
[systemIconStencil.vars.size]: system.space.x6,
|
|
32
|
+
'::after': {
|
|
33
|
+
content: '""',
|
|
34
|
+
height: system.space.x8,
|
|
35
|
+
width: system.space.x8,
|
|
36
|
+
position: 'absolute',
|
|
37
|
+
left: calc.negate(px2rem(7)),
|
|
38
|
+
bottom: calc.negate(px2rem(7)),
|
|
39
|
+
margin: system.space.zero,
|
|
40
|
+
pointerEvents: 'all',
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
'&:focus-visible, &.focus': {
|
|
44
|
+
[buttonStencil.vars.border]: system.color.border.transparent,
|
|
45
|
+
[buttonStencil.vars.background]: system.color.bg.alt.default,
|
|
46
|
+
...focusRing({
|
|
47
|
+
innerColor: system.color.border.transparent,
|
|
48
|
+
}),
|
|
49
|
+
},
|
|
50
|
+
'&:hover, &.hover': {
|
|
51
|
+
[buttonStencil.vars.border]: system.color.border.transparent,
|
|
52
|
+
[buttonStencil.vars.background]: system.color.bg.alt.strong,
|
|
53
|
+
},
|
|
54
|
+
'&:active, &.active': {
|
|
55
|
+
[buttonStencil.vars.border]: system.color.border.transparent,
|
|
56
|
+
[buttonStencil.vars.background]: system.color.bg.alt.stronger,
|
|
57
|
+
},
|
|
58
|
+
'&:disabled, &.disabled': {
|
|
59
|
+
[buttonStencil.vars.border]: system.color.border.transparent,
|
|
60
|
+
[buttonStencil.vars.background]: system.color.bg.alt.default,
|
|
61
|
+
[systemIconStencil.vars.color]: system.color.fg.disabled,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
export const PillIconButton = createSubcomponent('button')({
|
|
67
|
+
modelHook: usePillModel,
|
|
68
|
+
})<PillIconButtonProps>(
|
|
69
|
+
({size, icon, children, 'aria-label': ariaLabel = '', ...elemProps}, Element, model) => {
|
|
70
|
+
return (
|
|
71
|
+
<Element
|
|
72
|
+
disabled={model.state.disabled}
|
|
73
|
+
aria-labelledby={`removable-${model.state.id} label-${model.state.id}`}
|
|
74
|
+
{...mergeStyles(elemProps, pillIconButtonStencil())}
|
|
75
|
+
>
|
|
76
|
+
<SystemIcon
|
|
77
|
+
aria-label={ariaLabel}
|
|
78
|
+
id={`removable-${model.state.id}`}
|
|
79
|
+
icon={icon || xSmallIcon}
|
|
80
|
+
aria-hidden // This works for Chrome but not needed in Safari
|
|
81
|
+
role="img"
|
|
82
|
+
/>
|
|
83
|
+
</Element>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {createSubcomponent} from '@workday/canvas-kit-react/common';
|
|
2
|
+
import {BoxProps, mergeStyles} from '@workday/canvas-kit-react/layout';
|
|
3
|
+
import {OverflowTooltip, OverflowTooltipProps} from '@workday/canvas-kit-react/tooltip';
|
|
4
|
+
|
|
5
|
+
import {usePillModel} from './usePillModel';
|
|
6
|
+
|
|
7
|
+
import {createStencil} from '@workday/canvas-kit-styling';
|
|
8
|
+
|
|
9
|
+
export interface PillLabelProps extends BoxProps {
|
|
10
|
+
tooltipProps?: Omit<OverflowTooltipProps, 'children'>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const pillLabelStencil = createStencil({
|
|
14
|
+
base: {
|
|
15
|
+
flexShrink: 1,
|
|
16
|
+
whiteSpace: 'nowrap',
|
|
17
|
+
textOverflow: 'ellipsis',
|
|
18
|
+
overflow: 'hidden',
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export const PillLabel = createSubcomponent('span')({
|
|
23
|
+
modelHook: usePillModel,
|
|
24
|
+
})<PillLabelProps>(({tooltipProps, children, ...elemProps}, Element, model) => {
|
|
25
|
+
return (
|
|
26
|
+
<OverflowTooltip {...tooltipProps}>
|
|
27
|
+
<Element id={`label-${model.state.id}`} {...mergeStyles(elemProps, pillLabelStencil())}>
|
|
28
|
+
{children}
|
|
29
|
+
</Element>
|
|
30
|
+
</OverflowTooltip>
|
|
31
|
+
);
|
|
32
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {createModelHook, useUniqueId} from '@workday/canvas-kit-react/common';
|
|
2
|
+
|
|
3
|
+
export const usePillModel = createModelHook({
|
|
4
|
+
defaultConfig: {
|
|
5
|
+
/**
|
|
6
|
+
* Used to disable a pill and apply the correct styles.
|
|
7
|
+
*/
|
|
8
|
+
disabled: false,
|
|
9
|
+
/**
|
|
10
|
+
* ID used to add accessibility labels to pill elements.
|
|
11
|
+
* @default `useUniqueId()`
|
|
12
|
+
*/
|
|
13
|
+
id: '',
|
|
14
|
+
},
|
|
15
|
+
})(config => {
|
|
16
|
+
const id = useUniqueId(config.id);
|
|
17
|
+
const state = {
|
|
18
|
+
...config,
|
|
19
|
+
id,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
return {state, events: {}};
|
|
23
|
+
});
|
|
@@ -26,7 +26,7 @@ export interface SegmentedControlProps {
|
|
|
26
26
|
* items: [],
|
|
27
27
|
* });
|
|
28
28
|
*
|
|
29
|
-
* <SegmentedControl model={model}>{Child components}</SegmentedControl
|
|
29
|
+
* <SegmentedControl model={model}>{Child components}</SegmentedControl>
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
32
|
export const SegmentedControl = createContainer()({
|