@workday/canvas-kit-react 16.0.0-alpha.0499-next.0 → 16.0.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/common/lib/CanvasProvider.tsx +156 -324
- package/common/lib/theming/README.md +49 -6
- package/common/lib/theming/brandScope.ts +566 -0
- package/common/lib/theming/index.ts +1 -0
- package/common/lib/theming/sanaTheme.ts +133 -0
- package/common/lib/theming/types.ts +292 -0
- package/dist/commonjs/action-bar/lib/ActionBarList.js +1 -1
- package/dist/commonjs/action-bar/lib/ActionBarOverflowButton.js +1 -1
- package/dist/commonjs/avatar/lib/Avatar.js +13 -13
- package/dist/commonjs/avatar/lib/AvatarImage.js +1 -1
- package/dist/commonjs/avatar/lib/AvatarName.js +1 -1
- package/dist/commonjs/avatar/lib/BaseAvatar.js +14 -14
- 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 +2 -2
- package/dist/commonjs/button/lib/ExternalHyperlink.js +1 -1
- package/dist/commonjs/button/lib/Hyperlink.js +5 -5
- 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 +14 -14
- package/dist/commonjs/button/lib/ToolbarDropdownButton.js +3 -3
- package/dist/commonjs/button/lib/ToolbarIconButton.js +1 -1
- package/dist/commonjs/button/lib/parts/ButtonLabel.js +1 -1
- package/dist/commonjs/button/lib/parts/ButtonLabelIcon.js +5 -5
- package/dist/commonjs/card/lib/Card.js +3 -3
- package/dist/commonjs/card/lib/CardBody.js +1 -1
- package/dist/commonjs/card/lib/CardHeading.js +1 -1
- package/dist/commonjs/checkbox/lib/CheckBackground.js +6 -6
- package/dist/commonjs/checkbox/lib/CheckboxCheck.js +6 -6
- package/dist/commonjs/checkbox/lib/CheckboxContainer.js +2 -2
- 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.d.ts +296 -5
- package/dist/commonjs/common/lib/CanvasProvider.d.ts.map +1 -1
- package/dist/commonjs/common/lib/CanvasProvider.js +105 -287
- package/dist/commonjs/common/lib/EllipsisText.js +1 -1
- package/dist/commonjs/common/lib/styles/cornerShape.js +1 -1
- package/dist/commonjs/common/lib/theming/brandScope.d.ts +64 -0
- package/dist/commonjs/common/lib/theming/brandScope.d.ts.map +1 -0
- package/dist/commonjs/common/lib/theming/brandScope.js +499 -0
- package/dist/commonjs/common/lib/theming/index.d.ts +1 -0
- package/dist/commonjs/common/lib/theming/index.d.ts.map +1 -1
- package/dist/commonjs/common/lib/theming/index.js +1 -0
- package/dist/commonjs/common/lib/theming/sanaTheme.d.ts +33 -0
- package/dist/commonjs/common/lib/theming/sanaTheme.d.ts.map +1 -0
- package/dist/commonjs/common/lib/theming/sanaTheme.js +130 -0
- package/dist/commonjs/common/lib/theming/types.d.ts +162 -0
- package/dist/commonjs/common/lib/theming/types.d.ts.map +1 -1
- package/dist/commonjs/common/lib/theming/types.js +81 -1
- package/dist/commonjs/expandable/lib/Expandable.js +1 -1
- package/dist/commonjs/expandable/lib/ExpandableAvatar.js +1 -1
- package/dist/commonjs/expandable/lib/ExpandableContent.js +1 -1
- package/dist/commonjs/expandable/lib/ExpandableIcon.js +10 -10
- package/dist/commonjs/expandable/lib/ExpandableTarget.js +1 -1
- package/dist/commonjs/expandable/lib/ExpandableTitle.js +1 -1
- package/dist/commonjs/form-field/lib/FormFieldField.js +1 -1
- package/dist/commonjs/form-field/lib/FormFieldGroupLabel.js +5 -5
- package/dist/commonjs/form-field/lib/FormFieldGroupList.js +3 -3
- package/dist/commonjs/form-field/lib/FormFieldHint.js +3 -3
- package/dist/commonjs/form-field/lib/FormFieldLabel.js +6 -6
- package/dist/commonjs/form-field/lib/formFieldStencil.js +8 -8
- package/dist/commonjs/icon/lib/AccentIcon.js +2 -2
- package/dist/commonjs/icon/lib/AppletIcon.js +1 -1
- package/dist/commonjs/icon/lib/ExpressiveIcon.js +1 -1
- package/dist/commonjs/icon/lib/Graphic.js +4 -4
- package/dist/commonjs/icon/lib/Svg.js +3 -3
- package/dist/commonjs/icon/lib/SystemIcon.js +1 -1
- package/dist/commonjs/icon/lib/SystemIconCircle.js +2 -2
- package/dist/commonjs/information-highlight/lib/InformationHighlight.js +9 -9
- package/dist/commonjs/information-highlight/lib/parts/Body.js +3 -3
- package/dist/commonjs/information-highlight/lib/parts/Heading.js +3 -3
- package/dist/commonjs/information-highlight/lib/parts/Link.js +3 -3
- 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.d.ts +2 -2
- package/dist/commonjs/pill/lib/Pill.js +3 -3
- package/dist/commonjs/pill/lib/PillAvatar.js +1 -1
- package/dist/commonjs/pill/lib/PillCount.js +1 -1
- package/dist/commonjs/pill/lib/PillIcon.js +1 -1
- package/dist/commonjs/pill/lib/PillIconButton.js +1 -1
- package/dist/commonjs/pill/lib/PillLabel.js +1 -1
- package/dist/commonjs/popup/lib/PopupBody.js +1 -1
- package/dist/commonjs/popup/lib/PopupButtonGroup.js +5 -5
- 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/popup/lib/hooks/usePopupStack.d.ts.map +1 -1
- package/dist/commonjs/popup/lib/hooks/usePopupStack.js +18 -16
- package/dist/commonjs/segmented-control/lib/SegmentedControlItem.js +16 -16
- package/dist/commonjs/segmented-control/lib/SegmentedControlList.js +6 -6
- package/dist/commonjs/select/lib/SelectCard.js +1 -1
- package/dist/commonjs/select/lib/SelectInput.js +3 -3
- package/dist/commonjs/side-panel/lib/SidePanel.js +8 -8
- package/dist/commonjs/side-panel/lib/SidePanelHeading.js +3 -3
- package/dist/commonjs/side-panel/lib/SidePanelToggleButton.js +7 -7
- 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 +2 -2
- package/dist/commonjs/skeleton/lib/parts/SkeletonText.js +2 -2
- 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/testing/lib/ComponentStatesTable.js +1 -1
- package/dist/commonjs/testing/lib/StaticStates.d.ts +2 -2
- package/dist/commonjs/testing/lib/StaticStates.d.ts.map +1 -1
- package/dist/commonjs/testing/lib/StaticStates.js +5 -2
- 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 +7 -7
- 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 +4 -4
- package/dist/commonjs/version/lib/version.js +1 -1
- package/dist/es6/action-bar/lib/ActionBarList.js +1 -1
- package/dist/es6/action-bar/lib/ActionBarOverflowButton.js +1 -1
- package/dist/es6/avatar/lib/Avatar.js +13 -13
- package/dist/es6/avatar/lib/AvatarImage.js +1 -1
- package/dist/es6/avatar/lib/AvatarName.js +1 -1
- package/dist/es6/avatar/lib/BaseAvatar.js +14 -14
- 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 +2 -2
- package/dist/es6/button/lib/ExternalHyperlink.js +1 -1
- package/dist/es6/button/lib/Hyperlink.js +5 -5
- 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 +14 -14
- package/dist/es6/button/lib/ToolbarDropdownButton.js +3 -3
- package/dist/es6/button/lib/ToolbarIconButton.js +1 -1
- package/dist/es6/button/lib/parts/ButtonLabel.js +1 -1
- package/dist/es6/button/lib/parts/ButtonLabelIcon.js +5 -5
- package/dist/es6/card/lib/Card.js +3 -3
- package/dist/es6/card/lib/CardBody.js +1 -1
- package/dist/es6/card/lib/CardHeading.js +1 -1
- package/dist/es6/checkbox/lib/CheckBackground.js +6 -6
- package/dist/es6/checkbox/lib/CheckboxCheck.js +6 -6
- package/dist/es6/checkbox/lib/CheckboxContainer.js +2 -2
- 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.d.ts +296 -5
- package/dist/es6/common/lib/CanvasProvider.d.ts.map +1 -1
- package/dist/es6/common/lib/CanvasProvider.js +82 -288
- package/dist/es6/common/lib/EllipsisText.js +1 -1
- package/dist/es6/common/lib/styles/cornerShape.js +1 -1
- package/dist/es6/common/lib/theming/brandScope.d.ts +64 -0
- package/dist/es6/common/lib/theming/brandScope.d.ts.map +1 -0
- package/dist/es6/common/lib/theming/brandScope.js +483 -0
- package/dist/es6/common/lib/theming/index.d.ts +1 -0
- package/dist/es6/common/lib/theming/index.d.ts.map +1 -1
- package/dist/es6/common/lib/theming/index.js +1 -0
- package/dist/es6/common/lib/theming/sanaTheme.d.ts +33 -0
- package/dist/es6/common/lib/theming/sanaTheme.d.ts.map +1 -0
- package/dist/es6/common/lib/theming/sanaTheme.js +127 -0
- package/dist/es6/common/lib/theming/types.d.ts +162 -0
- package/dist/es6/common/lib/theming/types.d.ts.map +1 -1
- package/dist/es6/common/lib/theming/types.js +78 -0
- package/dist/es6/expandable/lib/Expandable.js +1 -1
- package/dist/es6/expandable/lib/ExpandableAvatar.js +1 -1
- package/dist/es6/expandable/lib/ExpandableContent.js +1 -1
- package/dist/es6/expandable/lib/ExpandableIcon.js +10 -10
- package/dist/es6/expandable/lib/ExpandableTarget.js +1 -1
- package/dist/es6/expandable/lib/ExpandableTitle.js +1 -1
- package/dist/es6/form-field/lib/FormFieldField.js +1 -1
- package/dist/es6/form-field/lib/FormFieldGroupLabel.js +5 -5
- package/dist/es6/form-field/lib/FormFieldGroupList.js +3 -3
- package/dist/es6/form-field/lib/FormFieldHint.js +3 -3
- package/dist/es6/form-field/lib/FormFieldLabel.js +6 -6
- package/dist/es6/form-field/lib/formFieldStencil.js +8 -8
- package/dist/es6/icon/lib/AccentIcon.js +2 -2
- package/dist/es6/icon/lib/AppletIcon.js +1 -1
- package/dist/es6/icon/lib/ExpressiveIcon.js +1 -1
- package/dist/es6/icon/lib/Graphic.js +4 -4
- package/dist/es6/icon/lib/Svg.js +3 -3
- package/dist/es6/icon/lib/SystemIcon.js +1 -1
- package/dist/es6/icon/lib/SystemIconCircle.js +2 -2
- package/dist/es6/information-highlight/lib/InformationHighlight.js +9 -9
- package/dist/es6/information-highlight/lib/parts/Body.js +3 -3
- package/dist/es6/information-highlight/lib/parts/Heading.js +3 -3
- package/dist/es6/information-highlight/lib/parts/Link.js +3 -3
- 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.d.ts +2 -2
- package/dist/es6/pill/lib/Pill.js +3 -3
- package/dist/es6/pill/lib/PillAvatar.js +1 -1
- package/dist/es6/pill/lib/PillCount.js +1 -1
- package/dist/es6/pill/lib/PillIcon.js +1 -1
- package/dist/es6/pill/lib/PillIconButton.js +1 -1
- package/dist/es6/pill/lib/PillLabel.js +1 -1
- package/dist/es6/popup/lib/PopupBody.js +1 -1
- package/dist/es6/popup/lib/PopupButtonGroup.js +5 -5
- 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/popup/lib/hooks/usePopupStack.d.ts.map +1 -1
- package/dist/es6/popup/lib/hooks/usePopupStack.js +13 -11
- package/dist/es6/segmented-control/lib/SegmentedControlItem.js +16 -16
- package/dist/es6/segmented-control/lib/SegmentedControlList.js +6 -6
- package/dist/es6/select/lib/SelectCard.js +1 -1
- package/dist/es6/select/lib/SelectInput.js +3 -3
- package/dist/es6/side-panel/lib/SidePanel.js +8 -8
- package/dist/es6/side-panel/lib/SidePanelHeading.js +3 -3
- package/dist/es6/side-panel/lib/SidePanelToggleButton.js +7 -7
- 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 +2 -2
- package/dist/es6/skeleton/lib/parts/SkeletonText.js +2 -2
- 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/testing/lib/ComponentStatesTable.js +1 -1
- package/dist/es6/testing/lib/StaticStates.d.ts +2 -2
- package/dist/es6/testing/lib/StaticStates.d.ts.map +1 -1
- package/dist/es6/testing/lib/StaticStates.js +6 -3
- 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 +7 -7
- 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 +4 -4
- package/dist/es6/version/lib/version.js +1 -1
- package/package.json +4 -4
- package/popup/lib/hooks/usePopupStack.ts +13 -11
- package/testing/lib/StaticStates.tsx +11 -9
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
import { colorSpace, maybeWrapCSSVariables } from '@workday/canvas-kit-styling';
|
|
2
|
+
import { brand, system } from '@workday/canvas-tokens-web';
|
|
3
|
+
import { defaultCanvasTheme } from './theme';
|
|
4
|
+
import { isNumericalTheme, } from './types';
|
|
5
|
+
/** True when a semantic theme intentionally passes a non-empty `canvas.palette`. */
|
|
6
|
+
export function hasExplicitSemanticPalette(theme) {
|
|
7
|
+
var _a;
|
|
8
|
+
return (!isNumericalTheme(theme) &&
|
|
9
|
+
!!((_a = theme.canvas) === null || _a === void 0 ? void 0 : _a.palette) &&
|
|
10
|
+
Object.keys(theme.canvas.palette).length > 0);
|
|
11
|
+
}
|
|
12
|
+
/** Tokens that change when a consumer sets only their primary brand color. */
|
|
13
|
+
export const BRAND_SCOPE_PRIMARY_BUNDLE = {
|
|
14
|
+
action: ['base', 'dark', 'darkest', 'accent'],
|
|
15
|
+
accent: ['primary', 'action'],
|
|
16
|
+
selected: {
|
|
17
|
+
fg: system.color.brand.fg.selected,
|
|
18
|
+
surface: system.color.brand.surface.selected,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Independently brandable tokens — writable when explicitly provided,
|
|
23
|
+
* but NEVER derived from primary.main / brand.primary.600.
|
|
24
|
+
*/
|
|
25
|
+
export const BRAND_SCOPE_INDEPENDENT = {
|
|
26
|
+
focus: {
|
|
27
|
+
primary: system.color.brand.focus.primary,
|
|
28
|
+
brandToken: brand.primary500,
|
|
29
|
+
semanticKey: 'focusOutline',
|
|
30
|
+
},
|
|
31
|
+
border: {
|
|
32
|
+
primary: system.color.brand.border.primary,
|
|
33
|
+
brandToken: brand.primary500,
|
|
34
|
+
semanticKey: 'focusOutline',
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
const commonTokenMapping = {
|
|
38
|
+
focusOutline: brand.common.focus,
|
|
39
|
+
alertInner: brand.common.caution.inner,
|
|
40
|
+
alertOuter: brand.common.caution.outer,
|
|
41
|
+
errorInner: brand.common.critical,
|
|
42
|
+
};
|
|
43
|
+
const brandColorMapping = {
|
|
44
|
+
primary: 'primary',
|
|
45
|
+
error: 'critical',
|
|
46
|
+
success: 'positive',
|
|
47
|
+
alert: 'caution',
|
|
48
|
+
neutral: 'neutral',
|
|
49
|
+
};
|
|
50
|
+
/** Brand ramp keys defined in Sana CSS but not yet exported from canvas-tokens-web. */
|
|
51
|
+
const EXTENDED_BRAND_TOKEN_MAP = {
|
|
52
|
+
neutral150: '--cnvs-brand-neutral-150',
|
|
53
|
+
neutral850: '--cnvs-brand-neutral-850',
|
|
54
|
+
neutralA150: '--cnvs-brand-neutral-a150',
|
|
55
|
+
};
|
|
56
|
+
const setStyleVar = (style, token, value) => {
|
|
57
|
+
// @ts-ignore - CSS custom property key
|
|
58
|
+
style[token] = maybeWrapCSSVariables(value);
|
|
59
|
+
};
|
|
60
|
+
/** Maps a numerical brand ramp onto `brand.<color><rampKey>` CSS variables. */
|
|
61
|
+
export function writeNumericalBrandRamp(color, ramp, style, options) {
|
|
62
|
+
if (!ramp) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
Object.keys(ramp).forEach(rampKey => {
|
|
66
|
+
var _a, _b;
|
|
67
|
+
if ((_a = options === null || options === void 0 ? void 0 : options.skipKeys) === null || _a === void 0 ? void 0 : _a.has(String(rampKey))) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const value = ramp[rampKey];
|
|
71
|
+
if (value == null) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const token = color === 'action'
|
|
75
|
+
? brand.action[rampKey]
|
|
76
|
+
: // @ts-ignore - dynamic token lookup
|
|
77
|
+
((_b = brand[`${color}${rampKey}`]) !== null && _b !== void 0 ? _b : EXTENDED_BRAND_TOKEN_MAP[`${color}${rampKey}`]);
|
|
78
|
+
if (token) {
|
|
79
|
+
setStyleVar(style, token, value);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
/** Called when consumer sets only `primary.main` or `brand.primary['600']`. */
|
|
84
|
+
export function applyPrimaryBrandBundle(primaryColor, style) {
|
|
85
|
+
const value = maybeWrapCSSVariables(primaryColor);
|
|
86
|
+
setStyleVar(style, brand.primary.base, value);
|
|
87
|
+
setStyleVar(style, brand.primary600, value);
|
|
88
|
+
setStyleVar(style, brand.action.base, value);
|
|
89
|
+
if (system.color.brand.accent.primary) {
|
|
90
|
+
setStyleVar(style, system.color.brand.accent.primary, value);
|
|
91
|
+
}
|
|
92
|
+
if (system.color.brand.accent.action) {
|
|
93
|
+
setStyleVar(style, system.color.brand.accent.action, value);
|
|
94
|
+
}
|
|
95
|
+
const selectedFg = colorSpace.pressed({
|
|
96
|
+
color: `var(${brand.primary600})`,
|
|
97
|
+
fallback: value,
|
|
98
|
+
colorType: 'accent',
|
|
99
|
+
});
|
|
100
|
+
const selectedSurface = colorSpace.darken({
|
|
101
|
+
color: system.color.bg.default,
|
|
102
|
+
fallback: 'white',
|
|
103
|
+
mixinColor: `var(${brand.primary600})`,
|
|
104
|
+
mixinValue: '0.11',
|
|
105
|
+
});
|
|
106
|
+
setStyleVar(style, brand.primary700, selectedFg);
|
|
107
|
+
setStyleVar(style, brand.primary.dark, selectedFg);
|
|
108
|
+
setStyleVar(style, brand.primaryA50, selectedSurface);
|
|
109
|
+
if (BRAND_SCOPE_PRIMARY_BUNDLE.selected.fg) {
|
|
110
|
+
setStyleVar(style, BRAND_SCOPE_PRIMARY_BUNDLE.selected.fg, selectedFg);
|
|
111
|
+
}
|
|
112
|
+
if (BRAND_SCOPE_PRIMARY_BUNDLE.selected.surface) {
|
|
113
|
+
setStyleVar(style, BRAND_SCOPE_PRIMARY_BUNDLE.selected.surface, selectedSurface);
|
|
114
|
+
}
|
|
115
|
+
const hoverColor = colorSpace.hover({
|
|
116
|
+
color: `var(${brand.action.base})`,
|
|
117
|
+
fallback: value,
|
|
118
|
+
colorType: 'accent',
|
|
119
|
+
});
|
|
120
|
+
const pressedColor = colorSpace.pressed({
|
|
121
|
+
color: `var(${brand.action.base})`,
|
|
122
|
+
fallback: value,
|
|
123
|
+
colorType: 'accent',
|
|
124
|
+
});
|
|
125
|
+
setStyleVar(style, brand.action.dark, hoverColor);
|
|
126
|
+
setStyleVar(style, brand.action.darkest, pressedColor);
|
|
127
|
+
}
|
|
128
|
+
/** Called when consumer sets only `error.main` or `brand.critical['600']`. */
|
|
129
|
+
export function applyCriticalBrandBundle(criticalColor, style) {
|
|
130
|
+
var _a;
|
|
131
|
+
const value = maybeWrapCSSVariables(criticalColor);
|
|
132
|
+
setStyleVar(style, brand.error.base, value);
|
|
133
|
+
setStyleVar(style, brand.critical600, value);
|
|
134
|
+
setStyleVar(style, brand.critical500, value);
|
|
135
|
+
if (system.color.brand.accent.critical) {
|
|
136
|
+
setStyleVar(style, system.color.brand.accent.critical, value);
|
|
137
|
+
}
|
|
138
|
+
if ((_a = system.color.brand.fg.critical) === null || _a === void 0 ? void 0 : _a.default) {
|
|
139
|
+
setStyleVar(style, system.color.brand.fg.critical.default, value);
|
|
140
|
+
}
|
|
141
|
+
if (system.color.brand.border.critical) {
|
|
142
|
+
setStyleVar(style, system.color.brand.border.critical, value);
|
|
143
|
+
}
|
|
144
|
+
if (system.color.brand.focus.critical) {
|
|
145
|
+
setStyleVar(style, system.color.brand.focus.critical, value);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/** Called when consumer sets only `alert.main` or `brand.caution['400']`. */
|
|
149
|
+
export function applyCautionBrandBundle(cautionColor, style) {
|
|
150
|
+
var _a, _b, _c;
|
|
151
|
+
const value = maybeWrapCSSVariables(cautionColor);
|
|
152
|
+
setStyleVar(style, brand.alert.base, value);
|
|
153
|
+
setStyleVar(style, brand.caution400, value);
|
|
154
|
+
setStyleVar(style, brand.caution500, value);
|
|
155
|
+
if (system.color.brand.accent.caution) {
|
|
156
|
+
setStyleVar(style, system.color.brand.accent.caution, value);
|
|
157
|
+
}
|
|
158
|
+
if ((_a = system.color.brand.fg.caution) === null || _a === void 0 ? void 0 : _a.default) {
|
|
159
|
+
setStyleVar(style, system.color.brand.fg.caution.default, value);
|
|
160
|
+
}
|
|
161
|
+
if (system.color.brand.border.caution) {
|
|
162
|
+
setStyleVar(style, system.color.brand.border.caution, value);
|
|
163
|
+
}
|
|
164
|
+
if ((_b = system.color.brand.focus.caution) === null || _b === void 0 ? void 0 : _b.inner) {
|
|
165
|
+
setStyleVar(style, system.color.brand.focus.caution.inner, value);
|
|
166
|
+
}
|
|
167
|
+
if ((_c = system.color.brand.focus.caution) === null || _c === void 0 ? void 0 : _c.outer) {
|
|
168
|
+
setStyleVar(style, system.color.brand.focus.caution.outer, value);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/** Called when consumer sets only `success.main` or `brand.positive['600']`. */
|
|
172
|
+
export function applyPositiveBrandBundle(positiveColor, style) {
|
|
173
|
+
var _a;
|
|
174
|
+
const value = maybeWrapCSSVariables(positiveColor);
|
|
175
|
+
setStyleVar(style, brand.success.base, value);
|
|
176
|
+
setStyleVar(style, brand.positive600, value);
|
|
177
|
+
if (system.color.brand.accent.positive) {
|
|
178
|
+
setStyleVar(style, system.color.brand.accent.positive, value);
|
|
179
|
+
}
|
|
180
|
+
if ((_a = system.color.brand.fg.positive) === null || _a === void 0 ? void 0 : _a.default) {
|
|
181
|
+
setStyleVar(style, system.color.brand.fg.positive.default, value);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
/** Called when consumer sets only `neutral.main` or `brand.neutral['600']`. */
|
|
185
|
+
export function applyNeutralBrandBundle(neutralColor, style) {
|
|
186
|
+
const value = maybeWrapCSSVariables(neutralColor);
|
|
187
|
+
setStyleVar(style, brand.neutral.base, value);
|
|
188
|
+
setStyleVar(style, brand.neutral600, value);
|
|
189
|
+
}
|
|
190
|
+
/** Writes first-class selected shortcuts from numerical theme input. */
|
|
191
|
+
export function writeSelectedShortcuts(selected, style) {
|
|
192
|
+
if (!selected) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
if (selected.fg && BRAND_SCOPE_PRIMARY_BUNDLE.selected.fg) {
|
|
196
|
+
setStyleVar(style, BRAND_SCOPE_PRIMARY_BUNDLE.selected.fg, selected.fg);
|
|
197
|
+
}
|
|
198
|
+
if (selected.surface && BRAND_SCOPE_PRIMARY_BUNDLE.selected.surface) {
|
|
199
|
+
setStyleVar(style, BRAND_SCOPE_PRIMARY_BUNDLE.selected.surface, selected.surface);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
function writeFocusBorderBundle(value, style) {
|
|
203
|
+
setStyleVar(style, brand.common.focusOutline, value);
|
|
204
|
+
setStyleVar(style, brand.primary500, value);
|
|
205
|
+
if (BRAND_SCOPE_INDEPENDENT.focus.primary) {
|
|
206
|
+
setStyleVar(style, BRAND_SCOPE_INDEPENDENT.focus.primary, value);
|
|
207
|
+
}
|
|
208
|
+
if (BRAND_SCOPE_INDEPENDENT.border.primary) {
|
|
209
|
+
setStyleVar(style, BRAND_SCOPE_INDEPENDENT.border.primary, value);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
/** Writes focus/border from explicit common or brand.primary.500 input — never from primary.main. */
|
|
213
|
+
export function writeIndependentBrandTokens(theme, style) {
|
|
214
|
+
var _a, _b, _c, _d;
|
|
215
|
+
if (!theme) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
if (isNumericalTheme(theme)) {
|
|
219
|
+
const focusValue = (_b = (_a = theme.brand) === null || _a === void 0 ? void 0 : _a.primary) === null || _b === void 0 ? void 0 : _b['500'];
|
|
220
|
+
if (focusValue) {
|
|
221
|
+
writeFocusBorderBundle(focusValue, style);
|
|
222
|
+
}
|
|
223
|
+
if (theme.system) {
|
|
224
|
+
writeSystemBrandOverrides(theme.system, style);
|
|
225
|
+
}
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
const common = (_d = (_c = theme.canvas) === null || _c === void 0 ? void 0 : _c.palette) === null || _d === void 0 ? void 0 : _d.common;
|
|
229
|
+
if (!common) {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
['focusOutline', 'alertInner', 'alertOuter', 'errorInner'].forEach(key => {
|
|
233
|
+
var _a;
|
|
234
|
+
const rawValue = common[key];
|
|
235
|
+
if (rawValue == null) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
if (rawValue === defaultCanvasTheme.palette.common[key]) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
const value = maybeWrapCSSVariables(rawValue);
|
|
242
|
+
// @ts-ignore
|
|
243
|
+
setStyleVar(style, brand.common[key], value);
|
|
244
|
+
// @ts-ignore
|
|
245
|
+
setStyleVar(style, commonTokenMapping[key], value);
|
|
246
|
+
if (key === 'focusOutline') {
|
|
247
|
+
writeFocusBorderBundle(value, style);
|
|
248
|
+
}
|
|
249
|
+
if (key === 'alertInner' && ((_a = system.color.brand.focus.caution) === null || _a === void 0 ? void 0 : _a.inner)) {
|
|
250
|
+
setStyleVar(style, system.color.brand.focus.caution.inner, value);
|
|
251
|
+
}
|
|
252
|
+
if (key === 'alertOuter' && system.color.brand.border.caution) {
|
|
253
|
+
setStyleVar(style, system.color.brand.border.caution, value);
|
|
254
|
+
}
|
|
255
|
+
if (key === 'errorInner') {
|
|
256
|
+
if (system.color.brand.focus.critical) {
|
|
257
|
+
setStyleVar(style, system.color.brand.focus.critical, value);
|
|
258
|
+
}
|
|
259
|
+
if (system.color.brand.border.critical) {
|
|
260
|
+
setStyleVar(style, system.color.brand.border.critical, value);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
/** Walks nested system override object and sets matching system CSS vars. */
|
|
266
|
+
export function writeSystemBrandOverrides(systemOverrides, style) {
|
|
267
|
+
var _a;
|
|
268
|
+
const brandOverrides = (_a = systemOverrides === null || systemOverrides === void 0 ? void 0 : systemOverrides.color) === null || _a === void 0 ? void 0 : _a.brand;
|
|
269
|
+
if (!brandOverrides) {
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
const walk = (node, path) => {
|
|
273
|
+
Object.entries(node).forEach(([key, val]) => {
|
|
274
|
+
var _a, _b;
|
|
275
|
+
if (val && typeof val === 'object') {
|
|
276
|
+
walk(val, [...path, key]);
|
|
277
|
+
}
|
|
278
|
+
else if (typeof val === 'string') {
|
|
279
|
+
let tokenNode = system.color.brand;
|
|
280
|
+
for (const seg of [...path, key]) {
|
|
281
|
+
// @ts-ignore
|
|
282
|
+
tokenNode = tokenNode === null || tokenNode === void 0 ? void 0 : tokenNode[seg];
|
|
283
|
+
}
|
|
284
|
+
if (typeof tokenNode === 'string') {
|
|
285
|
+
const cssVarName = (_b = (_a = tokenNode.match(/--[\w-]+/)) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : tokenNode;
|
|
286
|
+
setStyleVar(style, cssVarName, val);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
};
|
|
291
|
+
walk(brandOverrides, []);
|
|
292
|
+
}
|
|
293
|
+
const mappedKeys = {
|
|
294
|
+
lightest: 'lightest',
|
|
295
|
+
lighter: 'lighter',
|
|
296
|
+
light: 'light',
|
|
297
|
+
main: 'base',
|
|
298
|
+
dark: 'dark',
|
|
299
|
+
darkest: 'darkest',
|
|
300
|
+
contrast: 'accent',
|
|
301
|
+
};
|
|
302
|
+
const numericalTokenMapping = {
|
|
303
|
+
lightest: '25',
|
|
304
|
+
lighter: '50',
|
|
305
|
+
light: '200',
|
|
306
|
+
main: '600',
|
|
307
|
+
dark: '700',
|
|
308
|
+
darkest: '800',
|
|
309
|
+
};
|
|
310
|
+
/** Full-scope semantic writer — filled palette compared against defaults unless `writeAll`. */
|
|
311
|
+
export function writeSemanticTheme(palette, style, options) {
|
|
312
|
+
var _a;
|
|
313
|
+
const writeAll = (_a = options === null || options === void 0 ? void 0 : options.writeAll) !== null && _a !== void 0 ? _a : false;
|
|
314
|
+
['common', 'primary', 'error', 'alert', 'success', 'neutral'].forEach(color => {
|
|
315
|
+
if (color === 'common') {
|
|
316
|
+
['focusOutline', 'alertInner', 'alertOuter', 'errorInner'].forEach(key => {
|
|
317
|
+
var _a;
|
|
318
|
+
if (writeAll || palette.common[key] !== defaultCanvasTheme.palette.common[key]) {
|
|
319
|
+
const value = maybeWrapCSSVariables(palette.common[key]);
|
|
320
|
+
// @ts-ignore
|
|
321
|
+
setStyleVar(style, brand.common[key], value);
|
|
322
|
+
// @ts-ignore
|
|
323
|
+
setStyleVar(style, commonTokenMapping[key], value);
|
|
324
|
+
if (key === 'focusOutline') {
|
|
325
|
+
writeFocusBorderBundle(value, style);
|
|
326
|
+
}
|
|
327
|
+
if (key === 'alertInner' && ((_a = system.color.brand.focus.caution) === null || _a === void 0 ? void 0 : _a.inner)) {
|
|
328
|
+
setStyleVar(style, system.color.brand.focus.caution.inner, value);
|
|
329
|
+
}
|
|
330
|
+
if (key === 'alertOuter' && system.color.brand.border.caution) {
|
|
331
|
+
setStyleVar(style, system.color.brand.border.caution, value);
|
|
332
|
+
}
|
|
333
|
+
if (key === 'errorInner') {
|
|
334
|
+
if (system.color.brand.focus.critical) {
|
|
335
|
+
setStyleVar(style, system.color.brand.focus.critical, value);
|
|
336
|
+
}
|
|
337
|
+
if (system.color.brand.border.critical) {
|
|
338
|
+
setStyleVar(style, system.color.brand.border.critical, value);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
else {
|
|
345
|
+
['lightest', 'lighter', 'light', 'main', 'dark', 'darkest', 'contrast'].forEach(key => {
|
|
346
|
+
var _a, _b, _c, _d, _e;
|
|
347
|
+
// @ts-ignore
|
|
348
|
+
if (writeAll || palette[color][key] !== defaultCanvasTheme.palette[color][key]) {
|
|
349
|
+
// @ts-ignore
|
|
350
|
+
const value = maybeWrapCSSVariables(palette[color][key]);
|
|
351
|
+
// @ts-ignore
|
|
352
|
+
setStyleVar(style, brand[color][mappedKeys[key]], value);
|
|
353
|
+
if (key !== 'contrast' && key in numericalTokenMapping) {
|
|
354
|
+
const newBrandColor = brandColorMapping[color];
|
|
355
|
+
const numericalSuffix = numericalTokenMapping[key];
|
|
356
|
+
// @ts-ignore
|
|
357
|
+
const numericalToken = brand[newBrandColor + numericalSuffix];
|
|
358
|
+
if (numericalToken) {
|
|
359
|
+
setStyleVar(style, numericalToken, value);
|
|
360
|
+
}
|
|
361
|
+
if (key === 'main') {
|
|
362
|
+
// @ts-ignore
|
|
363
|
+
const systemAccentToken = system.color.brand.accent[newBrandColor];
|
|
364
|
+
if (systemAccentToken) {
|
|
365
|
+
setStyleVar(style, systemAccentToken, value);
|
|
366
|
+
}
|
|
367
|
+
// @ts-ignore
|
|
368
|
+
const systemFgToken = (_a = system.color.brand.fg[newBrandColor]) === null || _a === void 0 ? void 0 : _a.default;
|
|
369
|
+
if (systemFgToken) {
|
|
370
|
+
setStyleVar(style, systemFgToken, value);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
else if (key === 'dark') {
|
|
374
|
+
// @ts-ignore
|
|
375
|
+
const systemFgStrongToken = (_b = system.color.brand.fg[newBrandColor]) === null || _b === void 0 ? void 0 : _b.strong;
|
|
376
|
+
if (systemFgStrongToken) {
|
|
377
|
+
setStyleVar(style, systemFgStrongToken, value);
|
|
378
|
+
}
|
|
379
|
+
if (newBrandColor === 'primary' && system.color.brand.fg.selected) {
|
|
380
|
+
setStyleVar(style, system.color.brand.fg.selected, value);
|
|
381
|
+
}
|
|
382
|
+
if (newBrandColor === 'critical') {
|
|
383
|
+
if (system.color.brand.focus.critical) {
|
|
384
|
+
setStyleVar(style, system.color.brand.focus.critical, value);
|
|
385
|
+
}
|
|
386
|
+
if (system.color.brand.border.critical) {
|
|
387
|
+
setStyleVar(style, system.color.brand.border.critical, value);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
if (newBrandColor === 'caution') {
|
|
391
|
+
if ((_c = system.color.brand.focus.caution) === null || _c === void 0 ? void 0 : _c.outer) {
|
|
392
|
+
setStyleVar(style, system.color.brand.focus.caution.outer, value);
|
|
393
|
+
}
|
|
394
|
+
if (system.color.brand.border.caution) {
|
|
395
|
+
setStyleVar(style, system.color.brand.border.caution, value);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
else if (key === 'lighter') {
|
|
400
|
+
// @ts-ignore
|
|
401
|
+
const surfaceStrongToken = (_d = system.color.brand.surface[newBrandColor]) === null || _d === void 0 ? void 0 : _d.strong;
|
|
402
|
+
if (surfaceStrongToken) {
|
|
403
|
+
setStyleVar(style, surfaceStrongToken, value);
|
|
404
|
+
}
|
|
405
|
+
if (newBrandColor === 'primary' && system.color.brand.surface.selected) {
|
|
406
|
+
setStyleVar(style, system.color.brand.surface.selected, value);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
else if (key === 'lightest') {
|
|
410
|
+
// @ts-ignore
|
|
411
|
+
const surfaceDefaultToken = (_e = system.color.brand.surface[newBrandColor]) === null || _e === void 0 ? void 0 : _e.default;
|
|
412
|
+
if (surfaceDefaultToken) {
|
|
413
|
+
setStyleVar(style, surfaceDefaultToken, value);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
/** Writes numerical theme — brand scope applies per-family shortcuts; remaining keys write 1:1. */
|
|
423
|
+
export function writeNumericalTheme(theme, style, scope) {
|
|
424
|
+
var _a, _b, _c;
|
|
425
|
+
const brandPalette = theme.brand;
|
|
426
|
+
const skipRamp = {};
|
|
427
|
+
if (scope === 'brand' && brandPalette) {
|
|
428
|
+
if (((_a = brandPalette.primary) === null || _a === void 0 ? void 0 : _a['600']) && Object.keys(brandPalette.primary).length === 1) {
|
|
429
|
+
applyPrimaryBrandBundle(brandPalette.primary['600'], style);
|
|
430
|
+
skipRamp.primary = new Set(['600']);
|
|
431
|
+
// Do not skip action keys — explicit `brand.action.*` must win over derived shades
|
|
432
|
+
// written by applyPrimaryBrandBundle (writeNumericalBrandRamp runs after).
|
|
433
|
+
}
|
|
434
|
+
// Only the main ramp key triggers the family shortcut. Lone `'500'` (focus/border) must
|
|
435
|
+
// write 1:1 and must not overwrite critical600 / caution400 via the bundle.
|
|
436
|
+
const critical = brandPalette.critical;
|
|
437
|
+
if ((critical === null || critical === void 0 ? void 0 : critical['600']) && Object.keys(critical).length === 1) {
|
|
438
|
+
applyCriticalBrandBundle(critical['600'], style);
|
|
439
|
+
skipRamp.critical = new Set(['600']);
|
|
440
|
+
}
|
|
441
|
+
const caution = brandPalette.caution;
|
|
442
|
+
if ((caution === null || caution === void 0 ? void 0 : caution['400']) && Object.keys(caution).length === 1) {
|
|
443
|
+
applyCautionBrandBundle(caution['400'], style);
|
|
444
|
+
skipRamp.caution = new Set(['400']);
|
|
445
|
+
}
|
|
446
|
+
if (((_b = brandPalette.positive) === null || _b === void 0 ? void 0 : _b['600']) && Object.keys(brandPalette.positive).length === 1) {
|
|
447
|
+
applyPositiveBrandBundle(brandPalette.positive['600'], style);
|
|
448
|
+
skipRamp.positive = new Set(['600']);
|
|
449
|
+
}
|
|
450
|
+
if (((_c = brandPalette.neutral) === null || _c === void 0 ? void 0 : _c['600']) && Object.keys(brandPalette.neutral).length === 1) {
|
|
451
|
+
applyNeutralBrandBundle(brandPalette.neutral['600'], style);
|
|
452
|
+
skipRamp.neutral = new Set(['600']);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
if (brandPalette) {
|
|
456
|
+
['primary', 'critical', 'caution', 'positive', 'neutral', 'action'].forEach(color => {
|
|
457
|
+
writeNumericalBrandRamp(color, brandPalette[color], style, { skipKeys: skipRamp[color] });
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
writeSelectedShortcuts(theme.selected, style);
|
|
461
|
+
writeIndependentBrandTokens(theme, style);
|
|
462
|
+
}
|
|
463
|
+
/** Brand-scope semantic path — reads raw input only, not useTheme-filled palette. */
|
|
464
|
+
export function writeBrandScopeSemantic(theme, style) {
|
|
465
|
+
var _a, _b, _c, _d, _e, _f;
|
|
466
|
+
const palette = (_a = theme.canvas) === null || _a === void 0 ? void 0 : _a.palette;
|
|
467
|
+
if ((_b = palette === null || palette === void 0 ? void 0 : palette.primary) === null || _b === void 0 ? void 0 : _b.main) {
|
|
468
|
+
applyPrimaryBrandBundle(palette.primary.main, style);
|
|
469
|
+
}
|
|
470
|
+
if ((_c = palette === null || palette === void 0 ? void 0 : palette.error) === null || _c === void 0 ? void 0 : _c.main) {
|
|
471
|
+
applyCriticalBrandBundle(palette.error.main, style);
|
|
472
|
+
}
|
|
473
|
+
if ((_d = palette === null || palette === void 0 ? void 0 : palette.alert) === null || _d === void 0 ? void 0 : _d.main) {
|
|
474
|
+
applyCautionBrandBundle(palette.alert.main, style);
|
|
475
|
+
}
|
|
476
|
+
if ((_e = palette === null || palette === void 0 ? void 0 : palette.success) === null || _e === void 0 ? void 0 : _e.main) {
|
|
477
|
+
applyPositiveBrandBundle(palette.success.main, style);
|
|
478
|
+
}
|
|
479
|
+
if ((_f = palette === null || palette === void 0 ? void 0 : palette.neutral) === null || _f === void 0 ? void 0 : _f.main) {
|
|
480
|
+
applyNeutralBrandBundle(palette.neutral.main, style);
|
|
481
|
+
}
|
|
482
|
+
writeIndependentBrandTokens(theme, style);
|
|
483
|
+
}
|
|
@@ -14,6 +14,7 @@ export { default as styled, type StyleRewriteFn, filterOutProps } from './styled
|
|
|
14
14
|
* For more information, view our [Theming Docs](https://workday.github.io/canvas-kit/?path=/docs/features-theming-overview--docs#-preferred-approach-v14).
|
|
15
15
|
*/
|
|
16
16
|
export * from './theme';
|
|
17
|
+
export * from './sanaTheme';
|
|
17
18
|
/**
|
|
18
19
|
* @deprecated ⚠️ `useTheme` and `getTheme` are deprecated. Use CSS variables from `@workday/canvas-tokens-web` instead.
|
|
19
20
|
* For more information, view our [Theming Docs](https://workday.github.io/canvas-kit/?path=/docs/features-theming-overview--docs#-preferred-approach-v14).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B;;;GAGG;AACH,cAAc,SAAS,CAAC;AACxB;;;GAGG;AACH,OAAO,EAAC,OAAO,IAAI,MAAM,EAAE,KAAK,cAAc,EAAE,cAAc,EAAC,MAAM,UAAU,CAAC;AAChF;;;GAGG;AACH,cAAc,SAAS,CAAC;AACxB;;;GAGG;AACH,cAAc,YAAY,CAAC;AAC3B;;;GAGG;AACH,cAAc,iBAAiB,CAAC;AAChC;;;GAGG;AACH,cAAc,YAAY,CAAC;AAC3B;;;GAGG;AACH,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B;;;GAGG;AACH,cAAc,SAAS,CAAC;AACxB;;;GAGG;AACH,OAAO,EAAC,OAAO,IAAI,MAAM,EAAE,KAAK,cAAc,EAAE,cAAc,EAAC,MAAM,UAAU,CAAC;AAChF;;;GAGG;AACH,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B;;;GAGG;AACH,cAAc,YAAY,CAAC;AAC3B;;;GAGG;AACH,cAAc,iBAAiB,CAAC;AAChC;;;GAGG;AACH,cAAc,YAAY,CAAC;AAC3B;;;GAGG;AACH,cAAc,kBAAkB,CAAC"}
|
|
@@ -14,6 +14,7 @@ export { default as styled, filterOutProps } from './styled';
|
|
|
14
14
|
* For more information, view our [Theming Docs](https://workday.github.io/canvas-kit/?path=/docs/features-theming-overview--docs#-preferred-approach-v14).
|
|
15
15
|
*/
|
|
16
16
|
export * from './theme';
|
|
17
|
+
export * from './sanaTheme';
|
|
17
18
|
/**
|
|
18
19
|
* @deprecated ⚠️ `useTheme` and `getTheme` are deprecated. Use CSS variables from `@workday/canvas-tokens-web` instead.
|
|
19
20
|
* For more information, view our [Theming Docs](https://workday.github.io/canvas-kit/?path=/docs/features-theming-overview--docs#-preferred-approach-v14).
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { CanvasNumericalBrandTheme } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Sana Canvas brand tokens for scoped `CanvasProvider` / popup forwarding.
|
|
4
|
+
* Values are `var()` references to Sana brand variables — not merged from `defaultCanvasTheme`.
|
|
5
|
+
*/
|
|
6
|
+
export declare const sanaCanvasNumericalTheme: CanvasNumericalBrandTheme;
|
|
7
|
+
/**
|
|
8
|
+
* Pass to root `CanvasProvider` to forward Sana brand CSS variables onto popup containers
|
|
9
|
+
* (menus, selects, modals, tooltips).
|
|
10
|
+
*
|
|
11
|
+
* **When to use it**
|
|
12
|
+
* - **Required** when you cannot set `data-theme="sana-canvas"` on `<html>` (embedded apps,
|
|
13
|
+
* microfrontends, third-party shells). Popups portal to `document.body` and will not inherit
|
|
14
|
+
* a nested `data-theme` — this preset copies Sana brand vars onto the popup stack container.
|
|
15
|
+
* - Also useful in tests without global Sana CSS, or custom popup hosts outside normal cascade.
|
|
16
|
+
*
|
|
17
|
+
* **When you can skip it**
|
|
18
|
+
* - Prefer setting `data-theme="sana-canvas"` on `<html>` with Sana CSS imported. Popups then
|
|
19
|
+
* inherit brand variables from the document and no `theme` prop is needed.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* // Preferred — control <html>
|
|
24
|
+
* import '@workday/canvas-tokens-web/css/sana/_variables.css';
|
|
25
|
+
* // <html data-theme="sana-canvas">
|
|
26
|
+
* <CanvasProvider><App /></CanvasProvider>
|
|
27
|
+
*
|
|
28
|
+
* // No access to <html> — required for popup parity
|
|
29
|
+
* <CanvasProvider theme={sanaCanvasProviderTheme}><App /></CanvasProvider>
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare const sanaCanvasProviderTheme: CanvasNumericalBrandTheme;
|
|
33
|
+
//# sourceMappingURL=sanaTheme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanaTheme.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/sanaTheme.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,SAAS,CAAC;AAevD;;;GAGG;AACH,eAAO,MAAM,wBAAwB,EAAE,yBAmEtC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,uBAAuB,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sana Canvas theme presets.
|
|
3
|
+
*
|
|
4
|
+
* Sana is a distinct theme from classic Canvas — not a delta on `defaultCanvasTheme`.
|
|
5
|
+
* Full visual treatment (fonts, shapes, system surfaces) comes from global CSS:
|
|
6
|
+
* import `@workday/canvas-tokens-web/css/sana/_variables.css` and set
|
|
7
|
+
* `data-theme="sana-canvas"` on `<html>`.
|
|
8
|
+
*
|
|
9
|
+
* These JS presets reference Sana brand CSS variables so `CanvasProvider` can forward
|
|
10
|
+
* them to popup containers (menus, selects, modals). Keep in sync with
|
|
11
|
+
* `@workday/canvas-tokens-web/css/sana/_variables.css`.
|
|
12
|
+
*
|
|
13
|
+
* | Preset | Use case |
|
|
14
|
+
* |--------|----------|
|
|
15
|
+
* | `sanaCanvasNumericalTheme` | Numerical `brand` shape for popup forwarding |
|
|
16
|
+
* | `sanaCanvasProviderTheme` | Same — pass to root `CanvasProvider` when `<html>` is unavailable |
|
|
17
|
+
*/
|
|
18
|
+
import { base, brand } from '@workday/canvas-tokens-web';
|
|
19
|
+
/** Reference a canvas-tokens CSS variable (resolves under `[data-theme="sana-canvas"]`). */
|
|
20
|
+
const varRef = (token) => `var(${token})`;
|
|
21
|
+
/**
|
|
22
|
+
* Sana extends the neutral ramp with steps not yet exported from canvas-tokens-web JS.
|
|
23
|
+
* Defined in `@workday/canvas-tokens-web/css/sana/_variables.css`.
|
|
24
|
+
*/
|
|
25
|
+
const sanaBrandNeutral = {
|
|
26
|
+
'150': '--cnvs-brand-neutral-150',
|
|
27
|
+
'850': '--cnvs-brand-neutral-850',
|
|
28
|
+
A150: '--cnvs-brand-neutral-a150',
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Sana Canvas brand tokens for scoped `CanvasProvider` / popup forwarding.
|
|
32
|
+
* Values are `var()` references to Sana brand variables — not merged from `defaultCanvasTheme`.
|
|
33
|
+
*/
|
|
34
|
+
export const sanaCanvasNumericalTheme = {
|
|
35
|
+
// Explicit brand vars only — multi-key ramps write 1:1; no system shortcut bundles run.
|
|
36
|
+
themeScope: 'brand',
|
|
37
|
+
brand: {
|
|
38
|
+
action: {
|
|
39
|
+
base: varRef(brand.neutral975),
|
|
40
|
+
dark: varRef(brand.neutral950),
|
|
41
|
+
darkest: varRef(brand.neutral900),
|
|
42
|
+
accent: varRef(base.neutral0),
|
|
43
|
+
lightest: varRef(brand.neutral25),
|
|
44
|
+
lighter: varRef(brand.neutral50),
|
|
45
|
+
light: varRef(brand.neutral200),
|
|
46
|
+
},
|
|
47
|
+
neutral: {
|
|
48
|
+
'25': varRef(brand.neutral25),
|
|
49
|
+
'50': varRef(brand.neutral50),
|
|
50
|
+
'100': varRef(brand.neutral100),
|
|
51
|
+
'150': varRef(sanaBrandNeutral['150']),
|
|
52
|
+
'200': varRef(brand.neutral200),
|
|
53
|
+
'300': varRef(brand.neutral300),
|
|
54
|
+
'400': varRef(brand.neutral400),
|
|
55
|
+
'500': varRef(brand.neutral500),
|
|
56
|
+
'600': varRef(brand.neutral600),
|
|
57
|
+
'700': varRef(brand.neutral700),
|
|
58
|
+
'800': varRef(brand.neutral800),
|
|
59
|
+
'850': varRef(sanaBrandNeutral['850']),
|
|
60
|
+
'900': varRef(brand.neutral900),
|
|
61
|
+
'950': varRef(brand.neutral950),
|
|
62
|
+
'975': varRef(brand.neutral975),
|
|
63
|
+
A25: varRef(brand.neutralA25),
|
|
64
|
+
A50: varRef(brand.neutralA50),
|
|
65
|
+
A100: varRef(brand.neutralA100),
|
|
66
|
+
A150: varRef(sanaBrandNeutral.A150),
|
|
67
|
+
A200: varRef(brand.neutralA200),
|
|
68
|
+
},
|
|
69
|
+
primary: {
|
|
70
|
+
'500': varRef(brand.primary500),
|
|
71
|
+
'600': varRef(brand.primary600),
|
|
72
|
+
'700': varRef(brand.primary700),
|
|
73
|
+
A25: varRef(brand.primaryA25),
|
|
74
|
+
A50: varRef(brand.primaryA50),
|
|
75
|
+
A100: varRef(brand.primaryA100),
|
|
76
|
+
},
|
|
77
|
+
critical: {
|
|
78
|
+
'500': varRef(brand.critical500),
|
|
79
|
+
'600': varRef(brand.critical600),
|
|
80
|
+
'700': varRef(brand.critical700),
|
|
81
|
+
A25: varRef(brand.criticalA25),
|
|
82
|
+
A50: varRef(brand.criticalA50),
|
|
83
|
+
},
|
|
84
|
+
caution: {
|
|
85
|
+
'400': varRef(brand.caution400),
|
|
86
|
+
'500': varRef(brand.caution500),
|
|
87
|
+
A25: varRef(brand.cautionA25),
|
|
88
|
+
A50: varRef(brand.cautionA50),
|
|
89
|
+
},
|
|
90
|
+
positive: {
|
|
91
|
+
'600': varRef(brand.positive600),
|
|
92
|
+
'800': varRef(brand.positive800),
|
|
93
|
+
A25: varRef(brand.positiveA25),
|
|
94
|
+
A50: varRef(brand.positiveA50),
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
selected: {
|
|
98
|
+
fg: varRef(brand.neutralA900),
|
|
99
|
+
surface: varRef(brand.neutralA100),
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Pass to root `CanvasProvider` to forward Sana brand CSS variables onto popup containers
|
|
104
|
+
* (menus, selects, modals, tooltips).
|
|
105
|
+
*
|
|
106
|
+
* **When to use it**
|
|
107
|
+
* - **Required** when you cannot set `data-theme="sana-canvas"` on `<html>` (embedded apps,
|
|
108
|
+
* microfrontends, third-party shells). Popups portal to `document.body` and will not inherit
|
|
109
|
+
* a nested `data-theme` — this preset copies Sana brand vars onto the popup stack container.
|
|
110
|
+
* - Also useful in tests without global Sana CSS, or custom popup hosts outside normal cascade.
|
|
111
|
+
*
|
|
112
|
+
* **When you can skip it**
|
|
113
|
+
* - Prefer setting `data-theme="sana-canvas"` on `<html>` with Sana CSS imported. Popups then
|
|
114
|
+
* inherit brand variables from the document and no `theme` prop is needed.
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```tsx
|
|
118
|
+
* // Preferred — control <html>
|
|
119
|
+
* import '@workday/canvas-tokens-web/css/sana/_variables.css';
|
|
120
|
+
* // <html data-theme="sana-canvas">
|
|
121
|
+
* <CanvasProvider><App /></CanvasProvider>
|
|
122
|
+
*
|
|
123
|
+
* // No access to <html> — required for popup parity
|
|
124
|
+
* <CanvasProvider theme={sanaCanvasProviderTheme}><App /></CanvasProvider>
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
export const sanaCanvasProviderTheme = sanaCanvasNumericalTheme;
|