@workday/canvas-kit-react 15.0.0-alpha.0076-next.0 → 15.0.0-alpha.0090-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/avatar/index.ts +4 -0
- package/avatar/lib/Avatar.tsx +85 -243
- package/avatar/lib/AvatarImage.tsx +20 -0
- package/avatar/lib/AvatarName.tsx +32 -0
- package/avatar/lib/BaseAvatar.tsx +127 -0
- package/avatar/lib/getInitialsFromName.ts +11 -0
- package/combobox/lib/hooks/useComboboxInput.ts +1 -1
- package/dist/commonjs/action-bar/lib/ActionBarList.js +1 -1
- package/dist/commonjs/action-bar/lib/ActionBarOverflowButton.js +1 -1
- package/dist/commonjs/avatar/index.d.ts +4 -0
- package/dist/commonjs/avatar/index.d.ts.map +1 -1
- package/dist/commonjs/avatar/index.js +4 -0
- package/dist/commonjs/avatar/lib/Avatar.d.ts +183 -185
- package/dist/commonjs/avatar/lib/Avatar.d.ts.map +1 -1
- package/dist/commonjs/avatar/lib/Avatar.js +29 -113
- package/dist/commonjs/avatar/lib/AvatarImage.d.ts +6 -0
- package/dist/commonjs/avatar/lib/AvatarImage.d.ts.map +1 -0
- package/dist/commonjs/avatar/lib/AvatarImage.js +15 -0
- package/dist/commonjs/avatar/lib/AvatarName.d.ts +14 -0
- package/dist/commonjs/avatar/lib/AvatarName.d.ts.map +1 -0
- package/dist/commonjs/avatar/lib/AvatarName.js +16 -0
- package/dist/commonjs/avatar/lib/BaseAvatar.d.ts +148 -0
- package/dist/commonjs/avatar/lib/BaseAvatar.d.ts.map +1 -0
- package/dist/commonjs/avatar/lib/BaseAvatar.js +47 -0
- package/dist/commonjs/avatar/lib/getInitialsFromName.d.ts +2 -0
- package/dist/commonjs/avatar/lib/getInitialsFromName.d.ts.map +1 -0
- package/dist/commonjs/avatar/lib/getInitialsFromName.js +13 -0
- 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/combobox/lib/hooks/useComboboxInput.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 +1 -1
- package/dist/commonjs/expandable/lib/ExpandableAvatar.d.ts.map +1 -1
- package/dist/commonjs/expandable/lib/ExpandableAvatar.js +3 -3
- 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/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/lib/Pill.js +3 -3
- package/dist/commonjs/pill/lib/PillAvatar.d.ts +1 -1
- package/dist/commonjs/pill/lib/PillAvatar.d.ts.map +1 -1
- package/dist/commonjs/pill/lib/PillAvatar.js +3 -3
- 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/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 +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/Tabs.d.ts +1 -1
- package/dist/commonjs/tabs/lib/Tabs.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/tabs/lib/useTabsModel.d.ts +46 -16
- package/dist/commonjs/tabs/lib/useTabsModel.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/useTabsModel.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/index.d.ts +4 -0
- package/dist/es6/avatar/index.d.ts.map +1 -1
- package/dist/es6/avatar/index.js +4 -0
- package/dist/es6/avatar/lib/Avatar.d.ts +183 -185
- package/dist/es6/avatar/lib/Avatar.d.ts.map +1 -1
- package/dist/es6/avatar/lib/Avatar.js +29 -93
- package/dist/es6/avatar/lib/AvatarImage.d.ts +6 -0
- package/dist/es6/avatar/lib/AvatarImage.d.ts.map +1 -0
- package/dist/es6/avatar/lib/AvatarImage.js +12 -0
- package/dist/es6/avatar/lib/AvatarName.d.ts +14 -0
- package/dist/es6/avatar/lib/AvatarName.d.ts.map +1 -0
- package/dist/es6/avatar/lib/AvatarName.js +13 -0
- package/dist/es6/avatar/lib/BaseAvatar.d.ts +148 -0
- package/dist/es6/avatar/lib/BaseAvatar.d.ts.map +1 -0
- package/dist/es6/avatar/lib/BaseAvatar.js +44 -0
- package/dist/es6/avatar/lib/getInitialsFromName.d.ts +2 -0
- package/dist/es6/avatar/lib/getInitialsFromName.d.ts.map +1 -0
- package/dist/es6/avatar/lib/getInitialsFromName.js +9 -0
- 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/combobox/lib/hooks/useComboboxInput.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 +1 -1
- package/dist/es6/expandable/lib/ExpandableAvatar.d.ts.map +1 -1
- package/dist/es6/expandable/lib/ExpandableAvatar.js +3 -3
- 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/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/lib/Pill.js +3 -3
- package/dist/es6/pill/lib/PillAvatar.d.ts +1 -1
- package/dist/es6/pill/lib/PillAvatar.d.ts.map +1 -1
- package/dist/es6/pill/lib/PillAvatar.js +3 -3
- 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/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 +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/Tabs.d.ts +1 -1
- package/dist/es6/tabs/lib/Tabs.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/tabs/lib/useTabsModel.d.ts +46 -16
- package/dist/es6/tabs/lib/useTabsModel.d.ts.map +1 -1
- package/dist/es6/tabs/lib/useTabsModel.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 +1 -1
- package/package.json +5 -5
- package/pill/lib/PillAvatar.tsx +1 -1
- package/tabs/lib/Tabs.tsx +1 -1
- package/tabs/lib/useTabsModel.tsx +1 -1
package/avatar/index.ts
CHANGED
package/avatar/lib/Avatar.tsx
CHANGED
|
@@ -1,55 +1,14 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {Property} from 'csstype';
|
|
3
|
-
import {createComponent, focusRing} from '@workday/canvas-kit-react/common';
|
|
4
|
-
import {createStencil, calc, CSProps, px2rem} from '@workday/canvas-kit-styling';
|
|
5
|
-
import {mergeStyles} from '@workday/canvas-kit-react/layout';
|
|
6
|
-
import {borderRadius} from '@workday/canvas-kit-react/tokens';
|
|
7
|
-
import {SystemIcon, SystemIconCircleSize, systemIconStencil} from '@workday/canvas-kit-react/icon';
|
|
1
|
+
import React from 'react';
|
|
8
2
|
|
|
9
|
-
import {
|
|
3
|
+
import {createComponent} from '@workday/canvas-kit-react/common';
|
|
4
|
+
import {Property} from 'csstype';
|
|
5
|
+
import {createStencil, handleCsProp} from '@workday/canvas-kit-styling';
|
|
10
6
|
import {system} from '@workday/canvas-tokens-web';
|
|
11
7
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*/
|
|
15
|
-
export enum AvatarVariant {
|
|
16
|
-
Light,
|
|
17
|
-
Dark,
|
|
18
|
-
}
|
|
8
|
+
import {BaseAvatarProps, BaseAvatar, baseAvatarStencil} from './BaseAvatar';
|
|
9
|
+
import {AvatarNameProps} from './AvatarName';
|
|
19
10
|
|
|
20
|
-
|
|
21
|
-
* @deprecated ⚠️ `AvatarProps` is deprecated and will be removed in a future major version. Please use the `Avatar` component from the Preview package instead (@workday/canvas-kit-preview-react/avatar).
|
|
22
|
-
*/
|
|
23
|
-
export interface AvatarProps extends CSProps {
|
|
24
|
-
/**
|
|
25
|
-
* The variant of the avatar. Use `light` on dark backgrounds and `dark` on light backgrounds.
|
|
26
|
-
* @default "light"
|
|
27
|
-
*/
|
|
28
|
-
variant?: 'light' | 'dark' | AvatarVariant;
|
|
29
|
-
/**
|
|
30
|
-
* The size of the Avatar.
|
|
31
|
-
* - `extraExtraLarge`: 7.5rem x 7.5rem (120px x 120px)
|
|
32
|
-
* - `extraLarge`: 4.5rem x 4.5rem (64px x 64px)
|
|
33
|
-
* - `large`: 2.5rem x 2.5rem (40px x 40px)
|
|
34
|
-
* - `medium`: 2rem x 2rem (32px x 32px)
|
|
35
|
-
* - `small`: 1.5rem x 1.5rem (24px x 24px)
|
|
36
|
-
* - `small`: 1rem x 1rem (16px x 16px)
|
|
37
|
-
* @default "medium"
|
|
38
|
-
*/
|
|
39
|
-
size?: /** size of small */
|
|
40
|
-
| 'extraSmall'
|
|
41
|
-
| 'small'
|
|
42
|
-
| 'medium'
|
|
43
|
-
| 'large'
|
|
44
|
-
| 'extraLarge'
|
|
45
|
-
| 'extraExtraLarge'
|
|
46
|
-
| (string & {})
|
|
47
|
-
| SystemIconCircleSize
|
|
48
|
-
| number;
|
|
49
|
-
/**
|
|
50
|
-
* The alt text of the Avatar image. This prop is also used for the aria-label.
|
|
51
|
-
*/
|
|
52
|
-
altText?: string;
|
|
11
|
+
export interface AvatarProps extends BaseAvatarProps, AvatarNameProps {
|
|
53
12
|
/**
|
|
54
13
|
* The URL of the user's photo. For best fit, use square images.
|
|
55
14
|
*/
|
|
@@ -59,256 +18,139 @@ export interface AvatarProps extends CSProps {
|
|
|
59
18
|
* @default "contain"
|
|
60
19
|
*/
|
|
61
20
|
objectFit?: Property.ObjectFit;
|
|
21
|
+
/**
|
|
22
|
+
* If true, the Avatar won't forward the `name` prop to the `alt` attribute of the image. This is useful when the Avatar is purely decorative and is rendered next to a name or text.
|
|
23
|
+
*/
|
|
24
|
+
isDecorative?: boolean;
|
|
62
25
|
}
|
|
63
26
|
|
|
64
|
-
/**
|
|
65
|
-
* @deprecated `avatarStencil` is deprecated and will be removed in a future major version. Please use `Avatar` from the Preview package instead (@workday/canvas-kit-preview-react/avatar).
|
|
66
|
-
*/
|
|
67
27
|
export const avatarStencil = createStencil({
|
|
68
|
-
|
|
69
|
-
size: '',
|
|
70
|
-
},
|
|
28
|
+
extends: baseAvatarStencil,
|
|
71
29
|
parts: {
|
|
72
|
-
|
|
73
|
-
|
|
30
|
+
avatarImage: 'avatar-image',
|
|
31
|
+
avatarName: 'avatar-name',
|
|
74
32
|
},
|
|
75
|
-
base:
|
|
76
|
-
background: system.color.bg.caution.default,
|
|
77
|
-
position: 'relative',
|
|
78
|
-
display: 'flex',
|
|
79
|
-
alignItems: 'center',
|
|
80
|
-
justifyContent: 'center',
|
|
81
|
-
padding: 0,
|
|
82
|
-
border: 0,
|
|
83
|
-
overflow: 'hidden',
|
|
84
|
-
cursor: 'default',
|
|
85
|
-
pointerEvents: 'none',
|
|
86
|
-
borderRadius: system.shape.round,
|
|
87
|
-
width: size,
|
|
88
|
-
height: size,
|
|
89
|
-
'&:focus-visible, &.focus': {
|
|
90
|
-
outline: 'none',
|
|
91
|
-
...focusRing({separation: 2}),
|
|
92
|
-
},
|
|
93
|
-
':is(button)': {
|
|
94
|
-
cursor: 'pointer',
|
|
95
|
-
pointerEvents: 'auto',
|
|
96
|
-
},
|
|
97
|
-
'&:disabled, &.disabled': {
|
|
98
|
-
opacity: system.opacity.disabled,
|
|
99
|
-
},
|
|
100
|
-
[iconPart]: {
|
|
101
|
-
transition: 'opacity 150ms linear',
|
|
102
|
-
display: 'flex',
|
|
103
|
-
alignItems: 'center',
|
|
104
|
-
justifyContent: 'center',
|
|
105
|
-
[systemIconStencil.vars.size]: calc.multiply(size, 0.625),
|
|
106
|
-
opacity: 1,
|
|
107
|
-
},
|
|
108
|
-
[imagePart]: {
|
|
109
|
-
position: 'absolute',
|
|
110
|
-
width: '100%',
|
|
111
|
-
height: '100%',
|
|
112
|
-
borderRadius: borderRadius.circle,
|
|
113
|
-
transition: 'opacity 150ms linear',
|
|
114
|
-
opacity: 0,
|
|
115
|
-
},
|
|
116
|
-
}),
|
|
33
|
+
base: {},
|
|
117
34
|
modifiers: {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
[systemIconStencil.vars.color]: system.color.fg.default,
|
|
123
|
-
},
|
|
124
|
-
}),
|
|
125
|
-
dark: ({iconPart}) => ({
|
|
126
|
-
backgroundColor: system.color.bg.primary.default,
|
|
127
|
-
[iconPart]: {
|
|
128
|
-
[systemIconStencil.vars.color]: system.color.fg.inverse,
|
|
129
|
-
},
|
|
130
|
-
}),
|
|
131
|
-
},
|
|
132
|
-
size: {
|
|
133
|
-
extraSmall: ({iconPart}) => ({
|
|
134
|
-
width: system.space.x4,
|
|
135
|
-
height: system.space.x4,
|
|
136
|
-
[iconPart]: {
|
|
137
|
-
[systemIconStencil.vars.size]: calc.multiply(system.space.x4, 0.625),
|
|
138
|
-
},
|
|
139
|
-
}),
|
|
140
|
-
small: ({iconPart}) => ({
|
|
141
|
-
width: system.space.x6,
|
|
142
|
-
height: system.space.x6,
|
|
143
|
-
[iconPart]: {
|
|
144
|
-
[systemIconStencil.vars.size]: calc.multiply(system.space.x6, 0.625),
|
|
145
|
-
},
|
|
146
|
-
}),
|
|
147
|
-
medium: ({iconPart}) => ({
|
|
148
|
-
width: system.space.x8,
|
|
149
|
-
height: system.space.x8,
|
|
150
|
-
[iconPart]: {
|
|
151
|
-
[systemIconStencil.vars.size]: calc.multiply(system.space.x8, 0.625),
|
|
152
|
-
},
|
|
153
|
-
}),
|
|
154
|
-
large: ({iconPart}) => ({
|
|
155
|
-
width: system.space.x10,
|
|
156
|
-
height: system.space.x10,
|
|
157
|
-
[iconPart]: {
|
|
158
|
-
[systemIconStencil.vars.size]: calc.multiply(system.space.x10, 0.625),
|
|
159
|
-
},
|
|
160
|
-
}),
|
|
161
|
-
extraLarge: ({iconPart}) => ({
|
|
162
|
-
width: system.space.x16,
|
|
163
|
-
height: system.space.x16,
|
|
164
|
-
[iconPart]: {
|
|
165
|
-
[systemIconStencil.vars.size]: calc.multiply(system.space.x16, 0.625),
|
|
166
|
-
},
|
|
167
|
-
}),
|
|
168
|
-
extraExtraLarge: ({iconPart}) => ({
|
|
169
|
-
width: calc.multiply(system.space.x10, 3),
|
|
170
|
-
height: calc.multiply(system.space.x10, 3),
|
|
171
|
-
[iconPart]: {
|
|
172
|
-
[systemIconStencil.vars.size]: calc.multiply(calc.multiply(system.space.x10, 3), 0.625),
|
|
35
|
+
imageLoaded: {
|
|
36
|
+
false: ({avatarImagePart}) => ({
|
|
37
|
+
[avatarImagePart]: {
|
|
38
|
+
display: 'none',
|
|
173
39
|
},
|
|
174
40
|
}),
|
|
41
|
+
true: {
|
|
42
|
+
backgroundColor: system.color.bg.default,
|
|
43
|
+
},
|
|
175
44
|
},
|
|
176
45
|
objectFit: {
|
|
177
|
-
contain: ({
|
|
178
|
-
[
|
|
46
|
+
contain: ({avatarImagePart}) => ({
|
|
47
|
+
[avatarImagePart]: {
|
|
179
48
|
objectFit: 'contain',
|
|
180
49
|
},
|
|
181
50
|
}),
|
|
182
|
-
|
|
183
|
-
[
|
|
184
|
-
objectFit: 'fill',
|
|
185
|
-
},
|
|
186
|
-
}),
|
|
187
|
-
cover: ({imagePart}) => ({
|
|
188
|
-
[imagePart]: {
|
|
51
|
+
cover: ({avatarImagePart}) => ({
|
|
52
|
+
[avatarImagePart]: {
|
|
189
53
|
objectFit: 'cover',
|
|
190
54
|
},
|
|
191
55
|
}),
|
|
192
|
-
|
|
193
|
-
[
|
|
194
|
-
objectFit: '
|
|
56
|
+
fill: ({avatarImagePart}) => ({
|
|
57
|
+
[avatarImagePart]: {
|
|
58
|
+
objectFit: 'fill',
|
|
195
59
|
},
|
|
196
60
|
}),
|
|
197
|
-
none: ({
|
|
198
|
-
[
|
|
61
|
+
none: ({avatarImagePart}) => ({
|
|
62
|
+
[avatarImagePart]: {
|
|
199
63
|
objectFit: 'none',
|
|
200
64
|
},
|
|
201
65
|
}),
|
|
202
|
-
['-
|
|
203
|
-
[
|
|
204
|
-
objectFit: '-
|
|
66
|
+
['scale-down']: ({avatarImagePart}) => ({
|
|
67
|
+
[avatarImagePart]: {
|
|
68
|
+
objectFit: 'scale-down',
|
|
205
69
|
},
|
|
206
70
|
}),
|
|
207
|
-
|
|
208
|
-
[
|
|
71
|
+
initial: ({avatarImagePart}) => ({
|
|
72
|
+
[avatarImagePart]: {
|
|
209
73
|
objectFit: 'initial',
|
|
210
74
|
},
|
|
211
75
|
}),
|
|
212
|
-
|
|
213
|
-
|
|
76
|
+
|
|
77
|
+
inherit: ({avatarImagePart}) => ({
|
|
78
|
+
[avatarImagePart]: {
|
|
214
79
|
objectFit: 'inherit',
|
|
215
80
|
},
|
|
216
81
|
}),
|
|
217
|
-
|
|
218
|
-
[
|
|
219
|
-
objectFit: 'revert',
|
|
220
|
-
},
|
|
221
|
-
}),
|
|
222
|
-
['unset']: ({imagePart}) => ({
|
|
223
|
-
[imagePart]: {
|
|
82
|
+
unset: ({avatarImagePart}) => ({
|
|
83
|
+
[avatarImagePart]: {
|
|
224
84
|
objectFit: 'unset',
|
|
225
85
|
},
|
|
226
86
|
}),
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
[iconPart]: {
|
|
231
|
-
opacity: 0,
|
|
87
|
+
['-moz-initial']: ({avatarImagePart}) => ({
|
|
88
|
+
[avatarImagePart]: {
|
|
89
|
+
objectFit: '-moz-initial',
|
|
232
90
|
},
|
|
233
|
-
|
|
234
|
-
|
|
91
|
+
}),
|
|
92
|
+
['revert']: ({avatarImagePart}) => ({
|
|
93
|
+
[avatarImagePart]: {
|
|
94
|
+
objectFit: 'revert',
|
|
235
95
|
},
|
|
236
96
|
}),
|
|
237
97
|
},
|
|
238
98
|
},
|
|
239
|
-
defaultModifiers: {
|
|
240
|
-
variant: 'light',
|
|
241
|
-
objectFit: 'contain',
|
|
242
|
-
},
|
|
243
99
|
});
|
|
244
100
|
|
|
245
101
|
/**
|
|
246
|
-
*
|
|
102
|
+
* JSDoc for Avatar. Will be part of the Component API docs
|
|
247
103
|
*/
|
|
248
|
-
export const Avatar = createComponent('
|
|
104
|
+
export const Avatar = createComponent('div')({
|
|
249
105
|
displayName: 'Avatar',
|
|
106
|
+
|
|
250
107
|
Component: (
|
|
251
|
-
{
|
|
108
|
+
{
|
|
109
|
+
url,
|
|
110
|
+
name,
|
|
111
|
+
variant,
|
|
112
|
+
objectFit = 'contain',
|
|
113
|
+
preferredInitials,
|
|
114
|
+
isDecorative,
|
|
115
|
+
size,
|
|
116
|
+
...elemProps
|
|
117
|
+
}: AvatarProps,
|
|
252
118
|
ref,
|
|
253
119
|
Element
|
|
254
120
|
) => {
|
|
255
|
-
const [imageLoaded, setImageLoaded] = useState(false);
|
|
121
|
+
const [imageLoaded, setImageLoaded] = React.useState(false);
|
|
256
122
|
|
|
257
|
-
const
|
|
123
|
+
const handleImageLoad = () => {
|
|
258
124
|
if (!imageLoaded) {
|
|
259
125
|
setImageLoaded(true);
|
|
260
126
|
}
|
|
261
127
|
};
|
|
262
128
|
|
|
263
|
-
React.useLayoutEffect(() => {
|
|
264
|
-
setImageLoaded(false);
|
|
265
|
-
}, [url]);
|
|
266
|
-
|
|
267
|
-
// TODO: Remove this warning for a hard breaking change in v13
|
|
268
|
-
if (process.env.NODE_ENV === 'development') {
|
|
269
|
-
if (typeof variant === 'number') {
|
|
270
|
-
console.warn(
|
|
271
|
-
'Avatar: Avatar.Variant is deprecated and will be removed in v13. Please use a string literal of "light" or "dark"'
|
|
272
|
-
);
|
|
273
|
-
}
|
|
274
|
-
if (typeof size === 'number') {
|
|
275
|
-
console.warn(
|
|
276
|
-
"Avatar: Avatar.Size is deprecated and will be removed in v13. Use the string literal values for size: 'extraSmall' | 'small | 'medium' | 'large' | 'extraLarge | 'extraExtraLarge' | (string & {})"
|
|
277
|
-
);
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
129
|
return (
|
|
282
|
-
<
|
|
130
|
+
<BaseAvatar
|
|
131
|
+
as={Element}
|
|
283
132
|
ref={ref}
|
|
284
|
-
|
|
285
|
-
{...mergeStyles(elemProps, [
|
|
286
|
-
avatarStencil({
|
|
287
|
-
variant:
|
|
288
|
-
variant === AvatarVariant.Light
|
|
289
|
-
? 'light'
|
|
290
|
-
: variant === AvatarVariant.Dark
|
|
291
|
-
? 'dark'
|
|
292
|
-
: variant,
|
|
293
|
-
size: typeof size === 'number' ? px2rem(size) : size,
|
|
294
|
-
objectFit,
|
|
295
|
-
isImageLoaded: imageLoaded,
|
|
296
|
-
}),
|
|
297
|
-
])}
|
|
133
|
+
{...handleCsProp(elemProps, avatarStencil({variant, size, imageLoaded, objectFit}))}
|
|
298
134
|
>
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
135
|
+
{url && (
|
|
136
|
+
<>
|
|
137
|
+
<BaseAvatar.Image
|
|
138
|
+
onLoad={handleImageLoad}
|
|
139
|
+
src={url}
|
|
140
|
+
alt={isDecorative ? undefined : name}
|
|
141
|
+
aria-hidden={isDecorative}
|
|
142
|
+
{...avatarStencil.parts.avatarImage}
|
|
143
|
+
/>
|
|
144
|
+
</>
|
|
145
|
+
)}
|
|
146
|
+
{name && (!url || !imageLoaded) && (
|
|
147
|
+
<BaseAvatar.Name
|
|
148
|
+
name={name}
|
|
149
|
+
preferredInitials={preferredInitials}
|
|
150
|
+
{...avatarStencil.parts.avatarName}
|
|
151
|
+
/>
|
|
152
|
+
)}
|
|
153
|
+
</BaseAvatar>
|
|
302
154
|
);
|
|
303
155
|
},
|
|
304
|
-
subComponents: {
|
|
305
|
-
/**
|
|
306
|
-
* @deprecated ⚠️ `Avatar.Variant` is deprecated and will be removed in a future major version. Use the string literal of `light` or `dark`.
|
|
307
|
-
*/
|
|
308
|
-
Variant: AvatarVariant,
|
|
309
|
-
/**
|
|
310
|
-
* @deprecated ⚠️ `Avatar.Size` is deprecated and will be removed in a future major version. Use the string literal values for size: 'extraSmall' | 'small | 'medium' | 'large' | 'extraLarge | 'extraExtraLarge' | (string & {})
|
|
311
|
-
*/
|
|
312
|
-
Size: SystemIconCircleSize,
|
|
313
|
-
},
|
|
314
156
|
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {createComponent} from '@workday/canvas-kit-react/common';
|
|
2
|
+
|
|
3
|
+
import {handleCsProp, createStencil, CSProps} from '@workday/canvas-kit-styling';
|
|
4
|
+
|
|
5
|
+
export interface AvatarImageProps extends CSProps {}
|
|
6
|
+
|
|
7
|
+
export const avatarImageStencil = createStencil({
|
|
8
|
+
base: {
|
|
9
|
+
height: '100%',
|
|
10
|
+
width: '100%',
|
|
11
|
+
objectFit: 'cover',
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export const AvatarImage = createComponent('img')({
|
|
16
|
+
displayName: 'AvatarImage',
|
|
17
|
+
Component: ({...elemProps}: AvatarImageProps, ref, Element) => {
|
|
18
|
+
return <Element ref={ref} {...handleCsProp(elemProps, avatarImageStencil())} />;
|
|
19
|
+
},
|
|
20
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {createComponent} from '@workday/canvas-kit-react/common';
|
|
2
|
+
import {CSProps, handleCsProp, createStencil} from '@workday/canvas-kit-styling';
|
|
3
|
+
import {getInitialsFromName} from './getInitialsFromName';
|
|
4
|
+
|
|
5
|
+
export interface AvatarNameProps extends CSProps {
|
|
6
|
+
/**
|
|
7
|
+
* The alt text of the Avatar image. This prop is also used for the initials. The first letter of the first name and the first letter of the second name are chosen for the initials.
|
|
8
|
+
*/
|
|
9
|
+
name: string;
|
|
10
|
+
/**
|
|
11
|
+
* If you want full control over the initials, use `preferredInitials` instead.
|
|
12
|
+
*/
|
|
13
|
+
preferredInitials?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const avatarNameStencil = createStencil({
|
|
17
|
+
base: {
|
|
18
|
+
textTransform: 'uppercase',
|
|
19
|
+
cursor: 'default',
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export const AvatarName = createComponent('span')({
|
|
24
|
+
displayName: 'AvatarName',
|
|
25
|
+
Component: ({name, preferredInitials, ...elemProps}: AvatarNameProps, ref, Element) => {
|
|
26
|
+
return (
|
|
27
|
+
<Element ref={ref} {...handleCsProp(elemProps, avatarNameStencil())}>
|
|
28
|
+
{preferredInitials || getInitialsFromName(name)}
|
|
29
|
+
</Element>
|
|
30
|
+
);
|
|
31
|
+
},
|
|
32
|
+
});
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {createComponent} from '@workday/canvas-kit-react/common';
|
|
4
|
+
|
|
5
|
+
import {AvatarImage} from './AvatarImage';
|
|
6
|
+
import {AvatarName} from './AvatarName';
|
|
7
|
+
import {createStencil, cssVar, calc, handleCsProp, CSProps} from '@workday/canvas-kit-styling';
|
|
8
|
+
import {system, base} from '@workday/canvas-tokens-web';
|
|
9
|
+
|
|
10
|
+
export interface BaseAvatarProps extends CSProps {
|
|
11
|
+
/**
|
|
12
|
+
* Children of the BaseAvatar.
|
|
13
|
+
*/
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* The variant of the Avatar.
|
|
17
|
+
* @default "blue"
|
|
18
|
+
*/
|
|
19
|
+
variant?: 'blue' | 'amber' | 'teal' | 'purple';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The size of the Avatar.
|
|
23
|
+
* `extraExtraSmall` is 24px x 24px
|
|
24
|
+
* `extraSmall` is 32px x 32px
|
|
25
|
+
* `small` is 40px x 40px
|
|
26
|
+
* `medium` is 48px x 48px
|
|
27
|
+
* `large` is 72px x 72px
|
|
28
|
+
* `extraLarge` is 96px x 96px
|
|
29
|
+
* `extraExtraLarge` is 120px x 120px
|
|
30
|
+
* @default "medium"
|
|
31
|
+
*/
|
|
32
|
+
size?:
|
|
33
|
+
| 'extraExtraSmall'
|
|
34
|
+
| 'extraSmall'
|
|
35
|
+
| 'small'
|
|
36
|
+
| 'medium'
|
|
37
|
+
| 'large'
|
|
38
|
+
| 'extraLarge'
|
|
39
|
+
| 'extraExtraLarge'
|
|
40
|
+
| (string & {});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const baseAvatarStencil = createStencil({
|
|
44
|
+
vars: {
|
|
45
|
+
backgroundColor: '',
|
|
46
|
+
color: '',
|
|
47
|
+
size: '',
|
|
48
|
+
},
|
|
49
|
+
base: ({backgroundColor, color, size}) => ({
|
|
50
|
+
borderRadius: system.shape.round,
|
|
51
|
+
width: cssVar(size, calc.add(system.space.x10, system.space.x2)),
|
|
52
|
+
height: cssVar(size, calc.add(system.space.x10, system.space.x2)),
|
|
53
|
+
backgroundColor: cssVar(backgroundColor, base.blue300),
|
|
54
|
+
color: cssVar(color, base.blue800),
|
|
55
|
+
display: 'flex',
|
|
56
|
+
alignItems: 'center',
|
|
57
|
+
justifyContent: 'center',
|
|
58
|
+
overflow: 'hidden',
|
|
59
|
+
border: 'none',
|
|
60
|
+
...system.type.body.medium,
|
|
61
|
+
}),
|
|
62
|
+
modifiers: {
|
|
63
|
+
variant: {
|
|
64
|
+
blue: ({backgroundColor, color}) => ({
|
|
65
|
+
backgroundColor: cssVar(backgroundColor, base.blue300),
|
|
66
|
+
color: cssVar(color, base.blue800),
|
|
67
|
+
}),
|
|
68
|
+
amber: ({backgroundColor, color}) => ({
|
|
69
|
+
backgroundColor: cssVar(backgroundColor, base.amber200),
|
|
70
|
+
color: cssVar(color, base.amber700),
|
|
71
|
+
}),
|
|
72
|
+
|
|
73
|
+
teal: ({backgroundColor, color}) => ({
|
|
74
|
+
backgroundColor: cssVar(backgroundColor, base.teal300),
|
|
75
|
+
color: cssVar(color, base.teal800),
|
|
76
|
+
}),
|
|
77
|
+
purple: ({backgroundColor, color}) => ({
|
|
78
|
+
backgroundColor: cssVar(backgroundColor, base.purple300),
|
|
79
|
+
color: cssVar(color, base.purple800),
|
|
80
|
+
}),
|
|
81
|
+
},
|
|
82
|
+
size: {
|
|
83
|
+
extraExtraSmall: ({size}) => ({
|
|
84
|
+
[size]: system.space.x6,
|
|
85
|
+
...system.type.subtext.small,
|
|
86
|
+
}),
|
|
87
|
+
extraSmall: ({size}) => ({
|
|
88
|
+
[size]: system.space.x8,
|
|
89
|
+
...system.type.subtext.medium,
|
|
90
|
+
}),
|
|
91
|
+
small: ({size}) => ({
|
|
92
|
+
[size]: system.space.x10,
|
|
93
|
+
...system.type.body.small,
|
|
94
|
+
}),
|
|
95
|
+
medium: ({size}) => ({
|
|
96
|
+
[size]: calc.add(system.space.x10, system.space.x2),
|
|
97
|
+
...system.type.body.medium,
|
|
98
|
+
}),
|
|
99
|
+
large: ({size}) => ({
|
|
100
|
+
[size]: calc.add(system.space.x16, system.space.x2),
|
|
101
|
+
...system.type.heading.medium,
|
|
102
|
+
}),
|
|
103
|
+
extraLarge: ({size}) => ({
|
|
104
|
+
[size]: calc.add(system.space.x20, system.space.x4),
|
|
105
|
+
...system.type.title.small,
|
|
106
|
+
}),
|
|
107
|
+
extraExtraLarge: ({size}) => ({
|
|
108
|
+
[size]: calc.multiply(system.space.x10, 3),
|
|
109
|
+
...system.type.title.medium,
|
|
110
|
+
}),
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* JSDoc for Avatar. Will be part of the Component API docs
|
|
117
|
+
*/
|
|
118
|
+
export const BaseAvatar = createComponent('div')({
|
|
119
|
+
displayName: 'BaseAvatar',
|
|
120
|
+
subComponents: {
|
|
121
|
+
Image: AvatarImage,
|
|
122
|
+
Name: AvatarName,
|
|
123
|
+
},
|
|
124
|
+
Component: ({variant, size, ...elemProps}: BaseAvatarProps, ref, Element) => {
|
|
125
|
+
return <Element ref={ref} {...handleCsProp(elemProps, baseAvatarStencil({variant, size}))} />;
|
|
126
|
+
},
|
|
127
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const getInitialsFromName = (name: string) => {
|
|
2
|
+
// Trim and split by one or more whitespace characters
|
|
3
|
+
const nameParts = name.trim().split(/\s+/).filter(Boolean);
|
|
4
|
+
|
|
5
|
+
const first = nameParts[0];
|
|
6
|
+
const firstInitial = first?.[0] || '';
|
|
7
|
+
const last = nameParts.length > 1 ? nameParts[nameParts.length - 1] : undefined;
|
|
8
|
+
const lastInitial = last?.[0] || '';
|
|
9
|
+
|
|
10
|
+
return `${firstInitial}${lastInitial}`;
|
|
11
|
+
};
|
|
@@ -9,7 +9,7 @@ const collection_1 = require("@workday/canvas-kit-react/collection");
|
|
|
9
9
|
const useActionBarModel_1 = require("./useActionBarModel");
|
|
10
10
|
const canvas_kit_styling_1 = require("@workday/canvas-kit-styling");
|
|
11
11
|
exports.actionBarListStencil = (0, canvas_kit_styling_1.createStencil)({
|
|
12
|
-
base: { name: "
|
|
12
|
+
base: { name: "umre5", styles: "box-sizing:border-box;display:flex;box-shadow:var(--cnvs-sys-depth-1);gap:var(--cnvs-sys-gap-md, var(--cnvs-sys-space-x4));background:var(--cnvs-sys-color-bg-default);border-block-start:solid 1px var(--cnvs-sys-color-border-divider);padding:var(--cnvs-sys-padding-md, var(--cnvs-sys-space-x4)) var(--cnvs-sys-padding-xxl, var(--cnvs-sys-space-x8)) ;position:fixed;inset-block-end:0;inset-inline-start:0;inset-inline-end:0;@media (max-width: 767.5px){padding:var(--cnvs-sys-padding-md, var(--cnvs-sys-space-x4));> *{flex:1;}}" }
|
|
13
13
|
}, "action-bar-list-0c9a57");
|
|
14
14
|
exports.useActionBarList = collection_1.useOverflowListMeasure;
|
|
15
15
|
exports.ActionBarList = (0, common_1.createSubcomponent)('div')({
|
|
@@ -11,7 +11,7 @@ const button_1 = require("@workday/canvas-kit-react/button");
|
|
|
11
11
|
const canvas_kit_styling_1 = require("@workday/canvas-kit-styling");
|
|
12
12
|
const layout_1 = require("@workday/canvas-kit-react/layout");
|
|
13
13
|
exports.actionBarOverflowButtonStencil = (0, canvas_kit_styling_1.createStencil)({
|
|
14
|
-
base: { name: "
|
|
14
|
+
base: { name: "3z6gko", styles: "box-sizing:border-box;flex:0;" }
|
|
15
15
|
}, "action-bar-overflow-button-0a24d9");
|
|
16
16
|
exports.useActionBarOverflowButton = (0, common_1.composeHooks)((0, common_1.createElemPropsHook)(useActionBarModel_1.useActionBarModel)(() => ({
|
|
17
17
|
'aria-haspopup': true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../avatar/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../avatar/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC"}
|
|
@@ -15,3 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./lib/Avatar"), exports);
|
|
18
|
+
__exportStar(require("./lib/AvatarImage"), exports);
|
|
19
|
+
__exportStar(require("./lib/AvatarName"), exports);
|
|
20
|
+
__exportStar(require("./lib/BaseAvatar"), exports);
|
|
21
|
+
__exportStar(require("./lib/getInitialsFromName"), exports);
|