@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.
Files changed (325) hide show
  1. package/common/lib/CanvasProvider.tsx +156 -324
  2. package/common/lib/theming/README.md +49 -6
  3. package/common/lib/theming/brandScope.ts +566 -0
  4. package/common/lib/theming/index.ts +1 -0
  5. package/common/lib/theming/sanaTheme.ts +133 -0
  6. package/common/lib/theming/types.ts +292 -0
  7. package/dist/commonjs/action-bar/lib/ActionBarList.js +1 -1
  8. package/dist/commonjs/action-bar/lib/ActionBarOverflowButton.js +1 -1
  9. package/dist/commonjs/avatar/lib/Avatar.js +13 -13
  10. package/dist/commonjs/avatar/lib/AvatarImage.js +1 -1
  11. package/dist/commonjs/avatar/lib/AvatarName.js +1 -1
  12. package/dist/commonjs/avatar/lib/BaseAvatar.js +14 -14
  13. package/dist/commonjs/badge/lib/CountBadge.js +6 -6
  14. package/dist/commonjs/banner/lib/Banner.js +5 -5
  15. package/dist/commonjs/banner/lib/BannerActionText.js +2 -2
  16. package/dist/commonjs/banner/lib/BannerIcon.js +1 -1
  17. package/dist/commonjs/banner/lib/BannerLabel.js +1 -1
  18. package/dist/commonjs/breadcrumbs/lib/BreadcrumbsCurrentItem.js +1 -1
  19. package/dist/commonjs/breadcrumbs/lib/BreadcrumbsItem.js +1 -1
  20. package/dist/commonjs/breadcrumbs/lib/BreadcrumbsLink.js +1 -1
  21. package/dist/commonjs/breadcrumbs/lib/BreadcrumbsList.js +1 -1
  22. package/dist/commonjs/breadcrumbs/lib/BreadcrumbsMenu.js +2 -2
  23. package/dist/commonjs/breadcrumbs/lib/BreadcrumbsOverflowButton.js +1 -1
  24. package/dist/commonjs/button/lib/BaseButton.js +21 -21
  25. package/dist/commonjs/button/lib/DeleteButton.js +2 -2
  26. package/dist/commonjs/button/lib/ExternalHyperlink.js +1 -1
  27. package/dist/commonjs/button/lib/Hyperlink.js +5 -5
  28. package/dist/commonjs/button/lib/PrimaryButton.js +2 -2
  29. package/dist/commonjs/button/lib/SecondaryButton.js +2 -2
  30. package/dist/commonjs/button/lib/TertiaryButton.js +14 -14
  31. package/dist/commonjs/button/lib/ToolbarDropdownButton.js +3 -3
  32. package/dist/commonjs/button/lib/ToolbarIconButton.js +1 -1
  33. package/dist/commonjs/button/lib/parts/ButtonLabel.js +1 -1
  34. package/dist/commonjs/button/lib/parts/ButtonLabelIcon.js +5 -5
  35. package/dist/commonjs/card/lib/Card.js +3 -3
  36. package/dist/commonjs/card/lib/CardBody.js +1 -1
  37. package/dist/commonjs/card/lib/CardHeading.js +1 -1
  38. package/dist/commonjs/checkbox/lib/CheckBackground.js +6 -6
  39. package/dist/commonjs/checkbox/lib/CheckboxCheck.js +6 -6
  40. package/dist/commonjs/checkbox/lib/CheckboxContainer.js +2 -2
  41. package/dist/commonjs/checkbox/lib/CheckboxInput.js +5 -5
  42. package/dist/commonjs/checkbox/lib/CheckboxRipple.js +1 -1
  43. package/dist/commonjs/collection/lib/ListBox.js +3 -3
  44. package/dist/commonjs/color-picker/lib/ColorInput.js +3 -3
  45. package/dist/commonjs/color-picker/lib/ColorPreview.js +1 -1
  46. package/dist/commonjs/color-picker/lib/parts/ColorSwatch.js +2 -2
  47. package/dist/commonjs/combobox/lib/ComboboxMenuList.js +1 -1
  48. package/dist/commonjs/common/lib/AccessibleHide.js +1 -1
  49. package/dist/commonjs/common/lib/CanvasProvider.d.ts +296 -5
  50. package/dist/commonjs/common/lib/CanvasProvider.d.ts.map +1 -1
  51. package/dist/commonjs/common/lib/CanvasProvider.js +105 -287
  52. package/dist/commonjs/common/lib/EllipsisText.js +1 -1
  53. package/dist/commonjs/common/lib/styles/cornerShape.js +1 -1
  54. package/dist/commonjs/common/lib/theming/brandScope.d.ts +64 -0
  55. package/dist/commonjs/common/lib/theming/brandScope.d.ts.map +1 -0
  56. package/dist/commonjs/common/lib/theming/brandScope.js +499 -0
  57. package/dist/commonjs/common/lib/theming/index.d.ts +1 -0
  58. package/dist/commonjs/common/lib/theming/index.d.ts.map +1 -1
  59. package/dist/commonjs/common/lib/theming/index.js +1 -0
  60. package/dist/commonjs/common/lib/theming/sanaTheme.d.ts +33 -0
  61. package/dist/commonjs/common/lib/theming/sanaTheme.d.ts.map +1 -0
  62. package/dist/commonjs/common/lib/theming/sanaTheme.js +130 -0
  63. package/dist/commonjs/common/lib/theming/types.d.ts +162 -0
  64. package/dist/commonjs/common/lib/theming/types.d.ts.map +1 -1
  65. package/dist/commonjs/common/lib/theming/types.js +81 -1
  66. package/dist/commonjs/expandable/lib/Expandable.js +1 -1
  67. package/dist/commonjs/expandable/lib/ExpandableAvatar.js +1 -1
  68. package/dist/commonjs/expandable/lib/ExpandableContent.js +1 -1
  69. package/dist/commonjs/expandable/lib/ExpandableIcon.js +10 -10
  70. package/dist/commonjs/expandable/lib/ExpandableTarget.js +1 -1
  71. package/dist/commonjs/expandable/lib/ExpandableTitle.js +1 -1
  72. package/dist/commonjs/form-field/lib/FormFieldField.js +1 -1
  73. package/dist/commonjs/form-field/lib/FormFieldGroupLabel.js +5 -5
  74. package/dist/commonjs/form-field/lib/FormFieldGroupList.js +3 -3
  75. package/dist/commonjs/form-field/lib/FormFieldHint.js +3 -3
  76. package/dist/commonjs/form-field/lib/FormFieldLabel.js +6 -6
  77. package/dist/commonjs/form-field/lib/formFieldStencil.js +8 -8
  78. package/dist/commonjs/icon/lib/AccentIcon.js +2 -2
  79. package/dist/commonjs/icon/lib/AppletIcon.js +1 -1
  80. package/dist/commonjs/icon/lib/ExpressiveIcon.js +1 -1
  81. package/dist/commonjs/icon/lib/Graphic.js +4 -4
  82. package/dist/commonjs/icon/lib/Svg.js +3 -3
  83. package/dist/commonjs/icon/lib/SystemIcon.js +1 -1
  84. package/dist/commonjs/icon/lib/SystemIconCircle.js +2 -2
  85. package/dist/commonjs/information-highlight/lib/InformationHighlight.js +9 -9
  86. package/dist/commonjs/information-highlight/lib/parts/Body.js +3 -3
  87. package/dist/commonjs/information-highlight/lib/parts/Heading.js +3 -3
  88. package/dist/commonjs/information-highlight/lib/parts/Link.js +3 -3
  89. package/dist/commonjs/loading-dots/lib/LoadingDots.js +3 -3
  90. package/dist/commonjs/menu/lib/MenuCard.js +1 -1
  91. package/dist/commonjs/menu/lib/MenuDivider.js +1 -1
  92. package/dist/commonjs/menu/lib/MenuGroup.js +1 -1
  93. package/dist/commonjs/menu/lib/MenuItem.js +1 -1
  94. package/dist/commonjs/menu/lib/MenuList.js +3 -3
  95. package/dist/commonjs/modal/lib/ModalBody.js +1 -1
  96. package/dist/commonjs/modal/lib/ModalCard.js +1 -1
  97. package/dist/commonjs/modal/lib/ModalHeading.js +1 -1
  98. package/dist/commonjs/modal/lib/ModalOverflowOverlay.js +1 -1
  99. package/dist/commonjs/modal/lib/ModalOverlay.js +2 -2
  100. package/dist/commonjs/pagination/lib/Pagination/AdditionalDetails.js +2 -2
  101. package/dist/commonjs/pagination/lib/Pagination/Controls.js +2 -2
  102. package/dist/commonjs/pagination/lib/Pagination/GoTo/Form.js +1 -1
  103. package/dist/commonjs/pagination/lib/Pagination/GoTo/Label.js +1 -1
  104. package/dist/commonjs/pagination/lib/Pagination/GoTo/TextInput.js +1 -1
  105. package/dist/commonjs/pagination/lib/Pagination/Nav.js +1 -1
  106. package/dist/commonjs/pagination/lib/Pagination/PageButton.js +2 -2
  107. package/dist/commonjs/pagination/lib/Pagination/PageList.js +1 -1
  108. package/dist/commonjs/pagination/lib/Pagination/Pagination.js +1 -1
  109. package/dist/commonjs/pagination/lib/Pagination/common/List.js +2 -2
  110. package/dist/commonjs/pill/lib/Pill.d.ts +2 -2
  111. package/dist/commonjs/pill/lib/Pill.js +3 -3
  112. package/dist/commonjs/pill/lib/PillAvatar.js +1 -1
  113. package/dist/commonjs/pill/lib/PillCount.js +1 -1
  114. package/dist/commonjs/pill/lib/PillIcon.js +1 -1
  115. package/dist/commonjs/pill/lib/PillIconButton.js +1 -1
  116. package/dist/commonjs/pill/lib/PillLabel.js +1 -1
  117. package/dist/commonjs/popup/lib/PopupBody.js +1 -1
  118. package/dist/commonjs/popup/lib/PopupButtonGroup.js +5 -5
  119. package/dist/commonjs/popup/lib/PopupCard.js +2 -2
  120. package/dist/commonjs/popup/lib/PopupCloseIcon.js +1 -1
  121. package/dist/commonjs/popup/lib/PopupHeading.js +1 -1
  122. package/dist/commonjs/popup/lib/hooks/useDisableBodyScroll.js +1 -1
  123. package/dist/commonjs/popup/lib/hooks/usePopupStack.d.ts.map +1 -1
  124. package/dist/commonjs/popup/lib/hooks/usePopupStack.js +18 -16
  125. package/dist/commonjs/segmented-control/lib/SegmentedControlItem.js +16 -16
  126. package/dist/commonjs/segmented-control/lib/SegmentedControlList.js +6 -6
  127. package/dist/commonjs/select/lib/SelectCard.js +1 -1
  128. package/dist/commonjs/select/lib/SelectInput.js +3 -3
  129. package/dist/commonjs/side-panel/lib/SidePanel.js +8 -8
  130. package/dist/commonjs/side-panel/lib/SidePanelHeading.js +3 -3
  131. package/dist/commonjs/side-panel/lib/SidePanelToggleButton.js +7 -7
  132. package/dist/commonjs/skeleton/lib/Skeleton.js +2 -2
  133. package/dist/commonjs/skeleton/lib/parts/SkeletonHeader.js +1 -1
  134. package/dist/commonjs/skeleton/lib/parts/SkeletonShape.js +2 -2
  135. package/dist/commonjs/skeleton/lib/parts/SkeletonText.js +2 -2
  136. package/dist/commonjs/switch/lib/Switch.js +7 -7
  137. package/dist/commonjs/table/lib/BaseTable.js +1 -1
  138. package/dist/commonjs/table/lib/Table.js +7 -7
  139. package/dist/commonjs/table/lib/parts/BaseTableBody.js +1 -1
  140. package/dist/commonjs/table/lib/parts/BaseTableCaption.js +1 -1
  141. package/dist/commonjs/table/lib/parts/BaseTableCell.js +1 -1
  142. package/dist/commonjs/table/lib/parts/BaseTableHead.js +1 -1
  143. package/dist/commonjs/table/lib/parts/BaseTableHeader.js +1 -1
  144. package/dist/commonjs/table/lib/parts/css-grid-table/TableRow.js +1 -1
  145. package/dist/commonjs/tabs/lib/TabsItem.js +1 -1
  146. package/dist/commonjs/tabs/lib/TabsList.js +8 -8
  147. package/dist/commonjs/tabs/lib/TabsOverflowButton.js +1 -1
  148. package/dist/commonjs/testing/lib/ComponentStatesTable.js +1 -1
  149. package/dist/commonjs/testing/lib/StaticStates.d.ts +2 -2
  150. package/dist/commonjs/testing/lib/StaticStates.d.ts.map +1 -1
  151. package/dist/commonjs/testing/lib/StaticStates.js +5 -2
  152. package/dist/commonjs/text/lib/LabelText.js +6 -6
  153. package/dist/commonjs/text/lib/Text.js +16 -16
  154. package/dist/commonjs/text/lib/TypeLevelComponents.js +4 -4
  155. package/dist/commonjs/text-area/lib/TextArea.js +5 -5
  156. package/dist/commonjs/text-input/lib/InputGroup.js +7 -7
  157. package/dist/commonjs/text-input/lib/TextInput.js +5 -5
  158. package/dist/commonjs/toast/lib/Toast.js +1 -1
  159. package/dist/commonjs/toast/lib/ToastBody.js +1 -1
  160. package/dist/commonjs/toast/lib/ToastCloseIcon.js +1 -1
  161. package/dist/commonjs/toast/lib/ToastIcon.js +1 -1
  162. package/dist/commonjs/toast/lib/ToastMessage.js +1 -1
  163. package/dist/commonjs/tooltip/lib/TooltipContainer.js +4 -4
  164. package/dist/commonjs/version/lib/version.js +1 -1
  165. package/dist/es6/action-bar/lib/ActionBarList.js +1 -1
  166. package/dist/es6/action-bar/lib/ActionBarOverflowButton.js +1 -1
  167. package/dist/es6/avatar/lib/Avatar.js +13 -13
  168. package/dist/es6/avatar/lib/AvatarImage.js +1 -1
  169. package/dist/es6/avatar/lib/AvatarName.js +1 -1
  170. package/dist/es6/avatar/lib/BaseAvatar.js +14 -14
  171. package/dist/es6/badge/lib/CountBadge.js +6 -6
  172. package/dist/es6/banner/lib/Banner.js +5 -5
  173. package/dist/es6/banner/lib/BannerActionText.js +2 -2
  174. package/dist/es6/banner/lib/BannerIcon.js +1 -1
  175. package/dist/es6/banner/lib/BannerLabel.js +1 -1
  176. package/dist/es6/breadcrumbs/lib/BreadcrumbsCurrentItem.js +1 -1
  177. package/dist/es6/breadcrumbs/lib/BreadcrumbsItem.js +1 -1
  178. package/dist/es6/breadcrumbs/lib/BreadcrumbsLink.js +1 -1
  179. package/dist/es6/breadcrumbs/lib/BreadcrumbsList.js +1 -1
  180. package/dist/es6/breadcrumbs/lib/BreadcrumbsMenu.js +2 -2
  181. package/dist/es6/breadcrumbs/lib/BreadcrumbsOverflowButton.js +1 -1
  182. package/dist/es6/button/lib/BaseButton.js +21 -21
  183. package/dist/es6/button/lib/DeleteButton.js +2 -2
  184. package/dist/es6/button/lib/ExternalHyperlink.js +1 -1
  185. package/dist/es6/button/lib/Hyperlink.js +5 -5
  186. package/dist/es6/button/lib/PrimaryButton.js +2 -2
  187. package/dist/es6/button/lib/SecondaryButton.js +2 -2
  188. package/dist/es6/button/lib/TertiaryButton.js +14 -14
  189. package/dist/es6/button/lib/ToolbarDropdownButton.js +3 -3
  190. package/dist/es6/button/lib/ToolbarIconButton.js +1 -1
  191. package/dist/es6/button/lib/parts/ButtonLabel.js +1 -1
  192. package/dist/es6/button/lib/parts/ButtonLabelIcon.js +5 -5
  193. package/dist/es6/card/lib/Card.js +3 -3
  194. package/dist/es6/card/lib/CardBody.js +1 -1
  195. package/dist/es6/card/lib/CardHeading.js +1 -1
  196. package/dist/es6/checkbox/lib/CheckBackground.js +6 -6
  197. package/dist/es6/checkbox/lib/CheckboxCheck.js +6 -6
  198. package/dist/es6/checkbox/lib/CheckboxContainer.js +2 -2
  199. package/dist/es6/checkbox/lib/CheckboxInput.js +5 -5
  200. package/dist/es6/checkbox/lib/CheckboxRipple.js +1 -1
  201. package/dist/es6/collection/lib/ListBox.js +3 -3
  202. package/dist/es6/color-picker/lib/ColorInput.js +3 -3
  203. package/dist/es6/color-picker/lib/ColorPreview.js +1 -1
  204. package/dist/es6/color-picker/lib/parts/ColorSwatch.js +2 -2
  205. package/dist/es6/combobox/lib/ComboboxMenuList.js +1 -1
  206. package/dist/es6/common/lib/AccessibleHide.js +1 -1
  207. package/dist/es6/common/lib/CanvasProvider.d.ts +296 -5
  208. package/dist/es6/common/lib/CanvasProvider.d.ts.map +1 -1
  209. package/dist/es6/common/lib/CanvasProvider.js +82 -288
  210. package/dist/es6/common/lib/EllipsisText.js +1 -1
  211. package/dist/es6/common/lib/styles/cornerShape.js +1 -1
  212. package/dist/es6/common/lib/theming/brandScope.d.ts +64 -0
  213. package/dist/es6/common/lib/theming/brandScope.d.ts.map +1 -0
  214. package/dist/es6/common/lib/theming/brandScope.js +483 -0
  215. package/dist/es6/common/lib/theming/index.d.ts +1 -0
  216. package/dist/es6/common/lib/theming/index.d.ts.map +1 -1
  217. package/dist/es6/common/lib/theming/index.js +1 -0
  218. package/dist/es6/common/lib/theming/sanaTheme.d.ts +33 -0
  219. package/dist/es6/common/lib/theming/sanaTheme.d.ts.map +1 -0
  220. package/dist/es6/common/lib/theming/sanaTheme.js +127 -0
  221. package/dist/es6/common/lib/theming/types.d.ts +162 -0
  222. package/dist/es6/common/lib/theming/types.d.ts.map +1 -1
  223. package/dist/es6/common/lib/theming/types.js +78 -0
  224. package/dist/es6/expandable/lib/Expandable.js +1 -1
  225. package/dist/es6/expandable/lib/ExpandableAvatar.js +1 -1
  226. package/dist/es6/expandable/lib/ExpandableContent.js +1 -1
  227. package/dist/es6/expandable/lib/ExpandableIcon.js +10 -10
  228. package/dist/es6/expandable/lib/ExpandableTarget.js +1 -1
  229. package/dist/es6/expandable/lib/ExpandableTitle.js +1 -1
  230. package/dist/es6/form-field/lib/FormFieldField.js +1 -1
  231. package/dist/es6/form-field/lib/FormFieldGroupLabel.js +5 -5
  232. package/dist/es6/form-field/lib/FormFieldGroupList.js +3 -3
  233. package/dist/es6/form-field/lib/FormFieldHint.js +3 -3
  234. package/dist/es6/form-field/lib/FormFieldLabel.js +6 -6
  235. package/dist/es6/form-field/lib/formFieldStencil.js +8 -8
  236. package/dist/es6/icon/lib/AccentIcon.js +2 -2
  237. package/dist/es6/icon/lib/AppletIcon.js +1 -1
  238. package/dist/es6/icon/lib/ExpressiveIcon.js +1 -1
  239. package/dist/es6/icon/lib/Graphic.js +4 -4
  240. package/dist/es6/icon/lib/Svg.js +3 -3
  241. package/dist/es6/icon/lib/SystemIcon.js +1 -1
  242. package/dist/es6/icon/lib/SystemIconCircle.js +2 -2
  243. package/dist/es6/information-highlight/lib/InformationHighlight.js +9 -9
  244. package/dist/es6/information-highlight/lib/parts/Body.js +3 -3
  245. package/dist/es6/information-highlight/lib/parts/Heading.js +3 -3
  246. package/dist/es6/information-highlight/lib/parts/Link.js +3 -3
  247. package/dist/es6/loading-dots/lib/LoadingDots.js +3 -3
  248. package/dist/es6/menu/lib/MenuCard.js +1 -1
  249. package/dist/es6/menu/lib/MenuDivider.js +1 -1
  250. package/dist/es6/menu/lib/MenuGroup.js +1 -1
  251. package/dist/es6/menu/lib/MenuItem.js +1 -1
  252. package/dist/es6/menu/lib/MenuList.js +3 -3
  253. package/dist/es6/modal/lib/ModalBody.js +1 -1
  254. package/dist/es6/modal/lib/ModalCard.js +1 -1
  255. package/dist/es6/modal/lib/ModalHeading.js +1 -1
  256. package/dist/es6/modal/lib/ModalOverflowOverlay.js +1 -1
  257. package/dist/es6/modal/lib/ModalOverlay.js +2 -2
  258. package/dist/es6/pagination/lib/Pagination/AdditionalDetails.js +2 -2
  259. package/dist/es6/pagination/lib/Pagination/Controls.js +2 -2
  260. package/dist/es6/pagination/lib/Pagination/GoTo/Form.js +1 -1
  261. package/dist/es6/pagination/lib/Pagination/GoTo/Label.js +1 -1
  262. package/dist/es6/pagination/lib/Pagination/GoTo/TextInput.js +1 -1
  263. package/dist/es6/pagination/lib/Pagination/Nav.js +1 -1
  264. package/dist/es6/pagination/lib/Pagination/PageButton.js +2 -2
  265. package/dist/es6/pagination/lib/Pagination/PageList.js +1 -1
  266. package/dist/es6/pagination/lib/Pagination/Pagination.js +1 -1
  267. package/dist/es6/pagination/lib/Pagination/common/List.js +2 -2
  268. package/dist/es6/pill/lib/Pill.d.ts +2 -2
  269. package/dist/es6/pill/lib/Pill.js +3 -3
  270. package/dist/es6/pill/lib/PillAvatar.js +1 -1
  271. package/dist/es6/pill/lib/PillCount.js +1 -1
  272. package/dist/es6/pill/lib/PillIcon.js +1 -1
  273. package/dist/es6/pill/lib/PillIconButton.js +1 -1
  274. package/dist/es6/pill/lib/PillLabel.js +1 -1
  275. package/dist/es6/popup/lib/PopupBody.js +1 -1
  276. package/dist/es6/popup/lib/PopupButtonGroup.js +5 -5
  277. package/dist/es6/popup/lib/PopupCard.js +2 -2
  278. package/dist/es6/popup/lib/PopupCloseIcon.js +1 -1
  279. package/dist/es6/popup/lib/PopupHeading.js +1 -1
  280. package/dist/es6/popup/lib/hooks/useDisableBodyScroll.js +1 -1
  281. package/dist/es6/popup/lib/hooks/usePopupStack.d.ts.map +1 -1
  282. package/dist/es6/popup/lib/hooks/usePopupStack.js +13 -11
  283. package/dist/es6/segmented-control/lib/SegmentedControlItem.js +16 -16
  284. package/dist/es6/segmented-control/lib/SegmentedControlList.js +6 -6
  285. package/dist/es6/select/lib/SelectCard.js +1 -1
  286. package/dist/es6/select/lib/SelectInput.js +3 -3
  287. package/dist/es6/side-panel/lib/SidePanel.js +8 -8
  288. package/dist/es6/side-panel/lib/SidePanelHeading.js +3 -3
  289. package/dist/es6/side-panel/lib/SidePanelToggleButton.js +7 -7
  290. package/dist/es6/skeleton/lib/Skeleton.js +2 -2
  291. package/dist/es6/skeleton/lib/parts/SkeletonHeader.js +1 -1
  292. package/dist/es6/skeleton/lib/parts/SkeletonShape.js +2 -2
  293. package/dist/es6/skeleton/lib/parts/SkeletonText.js +2 -2
  294. package/dist/es6/switch/lib/Switch.js +7 -7
  295. package/dist/es6/table/lib/BaseTable.js +1 -1
  296. package/dist/es6/table/lib/Table.js +7 -7
  297. package/dist/es6/table/lib/parts/BaseTableBody.js +1 -1
  298. package/dist/es6/table/lib/parts/BaseTableCaption.js +1 -1
  299. package/dist/es6/table/lib/parts/BaseTableCell.js +1 -1
  300. package/dist/es6/table/lib/parts/BaseTableHead.js +1 -1
  301. package/dist/es6/table/lib/parts/BaseTableHeader.js +1 -1
  302. package/dist/es6/table/lib/parts/css-grid-table/TableRow.js +1 -1
  303. package/dist/es6/tabs/lib/TabsItem.js +1 -1
  304. package/dist/es6/tabs/lib/TabsList.js +8 -8
  305. package/dist/es6/tabs/lib/TabsOverflowButton.js +1 -1
  306. package/dist/es6/testing/lib/ComponentStatesTable.js +1 -1
  307. package/dist/es6/testing/lib/StaticStates.d.ts +2 -2
  308. package/dist/es6/testing/lib/StaticStates.d.ts.map +1 -1
  309. package/dist/es6/testing/lib/StaticStates.js +6 -3
  310. package/dist/es6/text/lib/LabelText.js +6 -6
  311. package/dist/es6/text/lib/Text.js +16 -16
  312. package/dist/es6/text/lib/TypeLevelComponents.js +4 -4
  313. package/dist/es6/text-area/lib/TextArea.js +5 -5
  314. package/dist/es6/text-input/lib/InputGroup.js +7 -7
  315. package/dist/es6/text-input/lib/TextInput.js +5 -5
  316. package/dist/es6/toast/lib/Toast.js +1 -1
  317. package/dist/es6/toast/lib/ToastBody.js +1 -1
  318. package/dist/es6/toast/lib/ToastCloseIcon.js +1 -1
  319. package/dist/es6/toast/lib/ToastIcon.js +1 -1
  320. package/dist/es6/toast/lib/ToastMessage.js +1 -1
  321. package/dist/es6/tooltip/lib/TooltipContainer.js +4 -4
  322. package/dist/es6/version/lib/version.js +1 -1
  323. package/package.json +4 -4
  324. package/popup/lib/hooks/usePopupStack.ts +13 -11
  325. package/testing/lib/StaticStates.tsx +11 -9
@@ -1,117 +1,59 @@
1
1
  import {CacheProvider, Theme, ThemeProvider} from '@emotion/react';
2
2
  import * as React from 'react';
3
3
 
4
- import {createStyles, getCache, maybeWrapCSSVariables} from '@workday/canvas-kit-styling';
4
+ import {createStyles, getCache} from '@workday/canvas-kit-styling';
5
5
  import {base, brand, system} from '@workday/canvas-tokens-web';
6
6
 
7
- import {PartialEmotionCanvasTheme, defaultCanvasTheme, useTheme} from './theming';
7
+ import {
8
+ CanvasProviderTheme,
9
+ CanvasThemingScope,
10
+ EmotionCanvasTheme,
11
+ PartialEmotionCanvasTheme,
12
+ defaultCanvasTheme,
13
+ getTheme,
14
+ isNumericalTheme,
15
+ resolveThemingScope,
16
+ useTheme,
17
+ } from './theming';
18
+ import {
19
+ hasExplicitSemanticPalette,
20
+ writeBrandScopeSemantic,
21
+ writeNumericalTheme,
22
+ writeSemanticTheme,
23
+ } from './theming/brandScope';
24
+ import {sanaCanvasProviderTheme} from './theming/sanaTheme';
25
+
26
+ /**
27
+ * Context for providing brand CSS variables to popup containers.
28
+ * This carries the resolved CSS variable style map from CanvasProvider
29
+ * to usePopupStack for proper popup theming, regardless of whether
30
+ * a numerical or legacy theme is used.
31
+ */
32
+ export const CanvasBrandStyleContext = React.createContext<React.CSSProperties>({});
8
33
 
9
34
  export interface CanvasProviderProps {
10
35
  /**
11
36
  * ⚠️ Only use this prop if you intent to to theme a part of your application that is different from global theming.
12
- * For more information, view our [Theming Docs](https://workday.github.io/canvas-kit/?path=/docs/features-theming-overview--docs#global-vs-scoped-theming).
37
+ * For more information, view our [Theming Docs](https://workday.github.io/canvas-kit/?path=/docs/features-theming-overview--docs#scoped-theming).
13
38
  *
14
39
  * While we support theme overrides, we advise to use global theming via CSS Variables.
15
40
  */
16
- theme?: PartialEmotionCanvasTheme;
41
+ theme?: CanvasProviderTheme;
42
+ /**
43
+ * How partial theme input expands. Default `'brand'`.
44
+ *
45
+ * **Numerical `brand` shape:** `'brand'` applies the `primary['600']` shortcut
46
+ * (PrimaryButton + selected states). `'full'` writes each ramp key literally with
47
+ * no shortcuts. Other `brand.*` keys always map 1:1 to CSS variables.
48
+ *
49
+ * **Legacy `canvas.palette` shape:** `'brand'` = primary.main shortcut only.
50
+ * `'full'` = auto-generated ramps + broad `system.color.brand.*` forwarding.
51
+ *
52
+ * @default 'brand'
53
+ */
54
+ themeScope?: CanvasThemingScope;
17
55
  }
18
56
 
19
- const mappedKeys = {
20
- lightest: 'lightest',
21
- lighter: 'lighter',
22
- light: 'light',
23
- main: 'base',
24
- dark: 'dark',
25
- darkest: 'darkest',
26
- contrast: 'accent',
27
- };
28
-
29
- /**
30
- * Mapping from deprecated theme palette keys to new numerical brand tokens.
31
- * This ensures backwards compatibility when consumers use the old theme format.
32
- * For example: palette.primary.main -> brand.primary600
33
- */
34
- const numericalTokenMapping = {
35
- lightest: '25',
36
- lighter: '50',
37
- light: '200',
38
- main: '600',
39
- dark: '700',
40
- darkest: '800',
41
- } as const;
42
-
43
- /**
44
- * Mapping from deprecated theme palette colors to new brand token names.
45
- * For example:
46
- * `primary` -> `primary`
47
- * `error` -> `critical`
48
- * `success` -> `positive`
49
- * `alert` -> `caution`
50
- * `neutral` -> `neutral`
51
- */
52
- const brandColorMapping = {
53
- primary: 'primary',
54
- error: 'critical',
55
- success: 'positive',
56
- alert: 'caution',
57
- neutral: 'neutral',
58
- } as const;
59
-
60
- /**
61
- * Mapping from deprecated common palette keys to new brand.common tokens.
62
- *
63
- * ## Brandable System Tokens
64
- *
65
- * These are all the `system.color.brand.*` tokens that can be customized via theming.
66
- * Each token references a brand token that can be overridden through the CanvasProvider theme prop.
67
- *
68
- * ### Focus Tokens
69
- * - `system.color.brand.focus.primary` → `brand.primary.500` → Controlled by `focusOutline` (separately from `palette.primary.main`, which controls `brand.primary.600`)
70
- * - `system.color.brand.focus.critical` → `brand.critical.500` → Controlled by `palette.error.dark` or `errorInner`
71
- * - `system.color.brand.focus.caution.inner` → `brand.caution.400` → Controlled by `palette.alert.main` or `alertInner`
72
- * - `system.color.brand.focus.caution.outer` → `brand.caution.500` → Controlled by `palette.alert.dark` or `alertOuter`
73
- *
74
- * ### Border Tokens
75
- * - `system.color.brand.border.primary` → `brand.primary.500` → Controlled by `focusOutline` (separately from `palette.primary.main`, which controls `brand.primary.600`)
76
- * - `system.color.brand.border.critical` → `brand.critical.500` → Controlled by `palette.error.dark` or `errorInner`
77
- * - `system.color.brand.border.caution` → `brand.caution.500` → Controlled by `palette.alert.dark` or `alertOuter`
78
- *
79
- * ### Surface Tokens
80
- * - `system.color.brand.surface.primary.default` → `brand.primary.A25` → Controlled by `palette.primary.lightest`
81
- * - `system.color.brand.surface.primary.strong` → `brand.primary.A50` → Controlled by `palette.primary.lighter`
82
- * - `system.color.brand.surface.critical.default` → `brand.critical.A25` → Controlled by `palette.error.lightest`
83
- * - `system.color.brand.surface.critical.strong` → `brand.critical.A50` → Controlled by `palette.error.lighter`
84
- * - `system.color.brand.surface.caution.default` → `brand.caution.A25` → Controlled by `palette.alert.lightest`
85
- * - `system.color.brand.surface.caution.strong` → `brand.caution.A50` → Controlled by `palette.alert.lighter`
86
- * - `system.color.brand.surface.positive.default` → `brand.positive.A25` → Controlled by `palette.success.lightest`
87
- * - `system.color.brand.surface.positive.strong` → `brand.positive.A50` → Controlled by `palette.success.lighter`
88
- * - `system.color.brand.surface.selected` → `brand.primary.A50` → Controlled by `palette.primary.lighter`
89
- *
90
- * ### Accent Tokens
91
- * - `system.color.brand.accent.primary` → `brand.primary.600` → Controlled by `palette.primary.main`
92
- * - `system.color.brand.accent.critical` → `brand.critical.600` → Controlled by `palette.error.main`
93
- * - `system.color.brand.accent.caution` → `brand.caution.400` → Controlled by `palette.alert.main`
94
- * - `system.color.brand.accent.positive` → `brand.positive.600` → Controlled by `palette.success.main`
95
- * - `system.color.brand.accent.action` → `brand.primary.600` → Controlled by `palette.primary.main`
96
- *
97
- * ### Foreground (Text/Icon) Tokens
98
- * - `system.color.brand.fg.primary.default` → `brand.primary.600` → Controlled by `palette.primary.main`
99
- * - `system.color.brand.fg.primary.strong` → `brand.primary.700` → Controlled by `palette.primary.dark`
100
- * - `system.color.brand.fg.critical.default` → `brand.critical.600` → Controlled by `palette.error.main`
101
- * - `system.color.brand.fg.critical.strong` → `brand.critical.700` → Controlled by `palette.error.dark`
102
- * - `system.color.brand.fg.caution.default` → `brand.caution.600` → Controlled by `palette.alert.darkest`
103
- * - `system.color.brand.fg.caution.strong` → `brand.caution.700` → Controlled by `palette.alert.dark` (Note: no direct mapping, inherits default)
104
- * - `system.color.brand.fg.positive.default` → `brand.positive.600` → Controlled by `palette.success.main`
105
- * - `system.color.brand.fg.positive.strong` → `brand.positive.700` → Controlled by `palette.success.dark`
106
- * - `system.color.brand.fg.selected` → `brand.primary.700` → Controlled by `palette.primary.dark`
107
- */
108
- const commonTokenMapping = {
109
- focusOutline: brand.common.focus, // maps to brand.primary500
110
- alertInner: brand.common.caution.inner, // maps to brand.caution400
111
- alertOuter: brand.common.caution.outer, // maps to brand.caution500
112
- errorInner: brand.common.critical, // maps to brand.critical500
113
- } as const;
114
-
115
57
  /**
116
58
  * If you wish to reset the theme to the default, apply this class on the CanvasProvider.
117
59
  */
@@ -158,12 +100,6 @@ export const defaultBranding = createStyles({
158
100
  [brand.gradient.primary]:
159
101
  `linear-gradient(90deg, ${brand.primary.base} 0%, ${brand.primary.dark} 100%)`,
160
102
 
161
- /**
162
- * Default `system.color.brand.*` values on the provider scope so components that read
163
- * system tokens first (e.g. `cssVar(system.color.brand.accent.primary, brand.primary.base)`)
164
- * still resolve to the same branding as legacy `brand.*` vars when globals define system
165
- * tokens differently, or when consumers override `brand.*` via `className`.
166
- */
167
103
  [system.color.brand.focus.primary]: brand.common.focusOutline,
168
104
  [system.color.brand.border.primary]: brand.common.focusOutline,
169
105
  [system.color.brand.accent.primary]: brand.primary.base,
@@ -202,240 +138,136 @@ export const defaultBranding = createStyles({
202
138
  [system.color.brand.surface.selected]: brand.primary.lighter,
203
139
  });
204
140
 
141
+ /** Pure function — safe to call outside React hooks (e.g. usePopupStack). */
142
+ export function canvasThemeToCssVars(
143
+ theme: CanvasProviderTheme | undefined,
144
+ elemProps: React.HTMLAttributes<HTMLElement>,
145
+ options?: {
146
+ themeScope?: CanvasThemingScope;
147
+ filledSemanticTheme?: EmotionCanvasTheme;
148
+ }
149
+ ) {
150
+ const className = elemProps.className || '';
151
+ const style: React.CSSProperties = {...(elemProps.style || {})};
152
+ const scope = options?.themeScope ?? resolveThemingScope(theme);
153
+
154
+ if (!theme) {
155
+ return {...elemProps, className, style};
156
+ }
157
+
158
+ if (isNumericalTheme(theme)) {
159
+ writeNumericalTheme(theme, style, scope);
160
+ } else if (!hasExplicitSemanticPalette(theme)) {
161
+ // `{canvas: {}}` — no inline overrides; global CSS (e.g. Sana) cascades through.
162
+ } else if (scope === 'brand') {
163
+ writeBrandScopeSemantic(theme, style);
164
+ } else {
165
+ const filledTheme =
166
+ options?.filledSemanticTheme ?? getTheme(theme as PartialEmotionCanvasTheme);
167
+ writeSemanticTheme(filledTheme.canvas.palette, style, {writeAll: true});
168
+ }
169
+
170
+ return {...elemProps, className, style};
171
+ }
172
+
205
173
  export const useCanvasThemeToCssVars = (
206
174
  /**
207
175
  * @deprecated ⚠️ `theme` is deprecated. In previous versions of Canvas Kit, we allowed teams to pass a theme object, this supported [Emotion's theming](https://emotion.sh/docs/theming). Now that we're shifting to a global theming approach based on CSS variables, we advise to no longer using the theme prop. For more information, view our [Theming Docs](https://workday.github.io/canvas-kit/?path=/docs/features-theming-overview--docs#-preferred-approach-v14).
208
176
  */
209
- theme: PartialEmotionCanvasTheme | undefined,
210
- elemProps: React.HTMLAttributes<HTMLElement>
177
+ theme: CanvasProviderTheme | undefined,
178
+ elemProps: React.HTMLAttributes<HTMLElement>,
179
+ themeScope?: CanvasThemingScope
211
180
  ) => {
212
- const filledTheme = useTheme(theme);
213
- const className = (elemProps.className || '').split(' ').concat(defaultBranding).join(' ');
214
- const style = elemProps.style || {};
215
- const {palette} = filledTheme.canvas;
216
-
217
- (['common', 'primary', 'error', 'alert', 'success', 'neutral'] as const).forEach(color => {
218
- if (color === 'common') {
219
- (['focusOutline', 'alertInner', 'alertOuter', 'errorInner'] as const).forEach(key => {
220
- if (palette.common[key] !== defaultCanvasTheme.palette.common[key]) {
221
- const value = maybeWrapCSSVariables(palette.common[key]);
222
-
223
- // Set deprecated token for backwards compatibility
224
- //@ts-ignore
225
- style[brand.common[key]] = value;
226
-
227
- // Forward to new brand.common tokens
228
- //@ts-ignore
229
- style[commonTokenMapping[key]] = value;
230
-
231
- // Additional system token forwarding for focusOutline
232
- if (key === 'focusOutline') {
233
- // system.color.brand.focus.primary -> brand.primary.500 (via brand.common.focus)
234
- // @ts-ignore
235
- style[system.color.brand.focus.primary] = value;
236
- // system.color.brand.border.primary -> brand.primary.500
237
- // @ts-ignore
238
- style[system.color.brand.border.primary] = value;
239
- }
240
-
241
- // Additional system token forwarding for alertInner
242
- if (key === 'alertInner') {
243
- // Forward alertInner to system.color.brand.focus.caution.inner
244
- // This token is used by components (e.g., TextInput with error="caution")
245
- // for inner focus ring styling. Maps to brand.caution400 via brand.common.caution.inner.
246
- // This ensures backwards compatibility when users customize alertInner in their theme.
247
- // @ts-ignore
248
- style[system.color.brand.focus.caution.inner] = value;
249
- }
250
-
251
- // Additional system token forwarding for alertOuter
252
- if (key === 'alertOuter') {
253
- // Forward alertOuter to system.color.brand.border.caution
254
- // This token is used by components (e.g., TextInput with error="caution")
255
- // for border and outer focus ring styling. Maps to brand.caution500 via brand.common.caution.outer.
256
- // This ensures backwards compatibility when users customize alertOuter in their theme.
257
- // @ts-ignore
258
- style[system.color.brand.border.caution] = value;
259
- }
260
-
261
- // Additional system token forwarding for errorInner
262
- if (key === 'errorInner') {
263
- // Forward errorInner to system.color.brand.focus.critical and system.color.brand.border.critical
264
- // These tokens are used by components (e.g., TextInput with error="error", Switch) for critical
265
- // focus ring and border styling. Maps to brand.critical500 via brand.common.errorInner.
266
- // This ensures backwards compatibility when users customize errorInner in their theme.
267
- // @ts-ignore
268
- style[system.color.brand.focus.critical] = value;
269
- // @ts-ignore
270
- style[system.color.brand.border.critical] = value;
271
- }
272
- }
273
- });
274
- } else {
275
- (['lightest', 'lighter', 'light', 'main', 'dark', 'darkest', 'contrast'] as const).forEach(
276
- key => {
277
- // We only want to set custom colors if they do not match the default. The `defaultBranding` class will take care of the rest.
278
- //@ts-ignore
279
- if (palette[color][key] !== defaultCanvasTheme.palette[color][key]) {
280
- const value = maybeWrapCSSVariables(palette[color][key]);
281
-
282
- // Set deprecated token (e.g., brand.primary.base) for backwards compatibility
283
- // @ts-ignore
284
- style[brand[color][mappedKeys[key]]] = value;
285
-
286
- // Forward to new numerical brand tokens (e.g., brand.primary600)
287
- // Skip 'contrast' as it doesn't map to numerical tokens
288
- if (key !== 'contrast' && key in numericalTokenMapping) {
289
- const newBrandColor = brandColorMapping[color as keyof typeof brandColorMapping];
290
- const numericalSuffix =
291
- numericalTokenMapping[key as keyof typeof numericalTokenMapping];
292
-
293
- // @ts-ignore - Dynamically access brand tokens like brand.primary600
294
- const numericalToken = brand[newBrandColor + numericalSuffix];
295
- if (numericalToken) {
296
- // @ts-ignore
297
- style[numericalToken] = value;
298
- }
299
-
300
- // Forward to all relevant system.color.brand.* tokens
301
- // These system tokens reference the numerical brand tokens, so updating them ensures full compatibility
302
- if (key === 'main') {
303
- // system.color.brand.accent.{color} -> brand.{color}.600 (except caution -> 400)
304
- // @ts-ignore
305
- const systemAccentToken = system.color.brand.accent[newBrandColor];
306
- if (systemAccentToken) {
307
- // @ts-ignore
308
- style[systemAccentToken] = value;
309
- }
310
-
311
- // system.color.brand.fg.{color}.default -> brand.{color}.600
312
- // @ts-ignore
313
- const systemFgToken = system.color.brand.fg[newBrandColor]?.default;
314
- if (systemFgToken) {
315
- // @ts-ignore
316
- style[systemFgToken] = value;
317
- }
318
-
319
- // system.color.brand.focus.primary (maps to brand.primary.500 per docs)
320
- // For primary only, update focus when 'main' changes — unless focusOutline was customized (it takes precedence)
321
- if (newBrandColor === 'primary') {
322
- const focusOutlineCustomized =
323
- palette.common.focusOutline !== defaultCanvasTheme.palette.common.focusOutline;
324
- if (!focusOutlineCustomized) {
325
- // @ts-ignore
326
- const focusToken = system.color.brand.focus.primary;
327
- if (focusToken) {
328
- // @ts-ignore
329
- style[focusToken] = value;
330
- }
331
- }
332
- }
333
- } else if (key === 'dark') {
334
- // system.color.brand.fg.{color}.strong -> brand.{color}.700
335
- // @ts-ignore
336
- const systemFgStrongToken = system.color.brand.fg[newBrandColor]?.strong;
337
- if (systemFgStrongToken) {
338
- // @ts-ignore
339
- style[systemFgStrongToken] = value;
340
- }
341
-
342
- // system.color.brand.fg.selected -> brand.primary.700 (for primary only)
343
- if (newBrandColor === 'primary') {
344
- // @ts-ignore
345
- const selectedToken = system.color.brand.fg.selected;
346
- if (selectedToken) {
347
- // @ts-ignore
348
- style[selectedToken] = value;
349
- }
350
- }
351
-
352
- // system.color.brand.focus.critical & system.color.brand.border.critical -> brand.critical.500 (palette.error.dark)
353
- if (newBrandColor === 'critical') {
354
- // @ts-ignore
355
- const focusCriticalToken = system.color.brand.focus.critical;
356
- if (focusCriticalToken) {
357
- // @ts-ignore
358
- style[focusCriticalToken] = value;
359
- }
360
- // @ts-ignore
361
- const borderCriticalToken = system.color.brand.border.critical;
362
- if (borderCriticalToken) {
363
- // @ts-ignore
364
- style[borderCriticalToken] = value;
365
- }
366
- }
367
-
368
- // system.color.brand.focus.caution.outer & system.color.brand.border.caution -> brand.caution.500 (palette.alert.dark)
369
- if (newBrandColor === 'caution') {
370
- // @ts-ignore
371
- const focusCautionOuterToken = system.color.brand.focus.caution?.outer;
372
- if (focusCautionOuterToken) {
373
- // @ts-ignore
374
- style[focusCautionOuterToken] = value;
375
- }
376
- // @ts-ignore
377
- const borderCautionToken = system.color.brand.border.caution;
378
- if (borderCautionToken) {
379
- // @ts-ignore
380
- style[borderCautionToken] = value;
381
- }
382
- }
383
- } else if (key === 'lighter') {
384
- // system.color.brand.surface.{color}.strong -> brand.{color}.A50
385
- // Note: A50 tokens are different from regular 50 tokens but we'll forward the lighter value
386
- // @ts-ignore
387
- const surfaceStrongToken = system.color.brand.surface[newBrandColor]?.strong;
388
- if (surfaceStrongToken) {
389
- // @ts-ignore
390
- style[surfaceStrongToken] = value;
391
- }
181
+ const filledTheme = useTheme(
182
+ isNumericalTheme(theme) ? undefined : (theme as PartialEmotionCanvasTheme)
183
+ );
184
+ const resolvedScope = themeScope ?? resolveThemingScope(theme);
392
185
 
393
- // system.color.brand.surface.selected -> brand.primary.A50 (for primary only)
394
- if (newBrandColor === 'primary') {
395
- // @ts-ignore
396
- const selectedSurfaceToken = system.color.brand.surface.selected;
397
- if (selectedSurfaceToken) {
398
- // @ts-ignore
399
- style[selectedSurfaceToken] = value;
400
- }
401
- }
402
- } else if (key === 'lightest') {
403
- // system.color.brand.surface.{color}.default -> brand.{color}.A25
404
- // @ts-ignore
405
- const surfaceDefaultToken = system.color.brand.surface[newBrandColor]?.default;
406
- if (surfaceDefaultToken) {
407
- // @ts-ignore
408
- style[surfaceDefaultToken] = value;
409
- }
410
- }
411
- }
412
- }
413
- }
414
- );
415
- }
186
+ return canvasThemeToCssVars(theme, elemProps, {
187
+ themeScope: resolvedScope,
188
+ filledSemanticTheme:
189
+ !isNumericalTheme(theme) && resolvedScope === 'full' ? filledTheme : undefined,
416
190
  });
417
-
418
- return {...elemProps, className, style};
419
191
  };
420
192
 
421
193
  export const CanvasProvider = ({
422
194
  children,
423
- theme = {canvas: {}}, // default to empty theme to avoid breaking changes
195
+ theme,
196
+ themeScope,
424
197
  ...props
425
198
  }: CanvasProviderProps & React.HTMLAttributes<HTMLElement>) => {
426
- const {className, ...elemProps} = useCanvasThemeToCssVars(theme, props);
199
+ // Add console warning for unnecessary sanaCanvasProviderTheme usage
200
+ React.useEffect(() => {
201
+ if (process.env.NODE_ENV !== 'production') {
202
+ if (
203
+ theme === sanaCanvasProviderTheme &&
204
+ typeof document !== 'undefined' &&
205
+ document.documentElement.getAttribute('data-theme') === 'sana-canvas'
206
+ ) {
207
+ console.warn(
208
+ 'Canvas Kit: You are passing sanaCanvasProviderTheme to CanvasProvider but ' +
209
+ 'data-theme="sana-canvas" is already set on <html>. The theme prop is not needed ' +
210
+ 'in this case and can be removed. Keep sanaCanvasProviderTheme when you cannot ' +
211
+ 'control <html> (embedded apps / microfrontends) so popups still get Sana brand ' +
212
+ 'variables. See: ' +
213
+ 'https://workday.github.io/canvas-kit/?path=/docs/features-theming-overview--docs'
214
+ );
215
+ }
216
+ }
217
+ }, [theme]);
218
+
219
+ // Computed className/style win over consumer props — do not re-spread `props` over them.
220
+ const {className, style, ...elemProps} = useCanvasThemeToCssVars(theme, props, themeScope);
427
221
  const cache = getCache();
428
- const rest = {...elemProps, ...props};
222
+
223
+ // Read parent context to support nested scoped providers
224
+ const parentBrandStyle = React.useContext(CanvasBrandStyleContext);
225
+
226
+ // Popup forwarding only needs CSS custom properties (not consumer layout styles).
227
+ const mergedBrandStyle = React.useMemo(() => {
228
+ const merged: React.CSSProperties = {};
229
+ for (const [key, value] of Object.entries({...parentBrandStyle, ...style})) {
230
+ if (key.startsWith('--') && typeof value === 'string') {
231
+ // @ts-ignore - CSS custom property key
232
+ merged[key] = value;
233
+ }
234
+ }
235
+ return merged;
236
+ }, [parentBrandStyle, style]);
237
+
238
+ const emotionTheme = theme
239
+ ? isNumericalTheme(theme)
240
+ ? ({canvas: defaultCanvasTheme} as Theme)
241
+ : (theme as Theme)
242
+ : undefined;
243
+ const content = (
244
+ <div
245
+ dir={
246
+ isNumericalTheme(theme)
247
+ ? theme.direction || defaultCanvasTheme.direction
248
+ : theme?.canvas?.direction || defaultCanvasTheme.direction
249
+ }
250
+ className={className}
251
+ {...(elemProps as React.HTMLAttributes<HTMLDivElement>)}
252
+ style={style}
253
+ >
254
+ {children}
255
+ </div>
256
+ );
257
+
258
+ const wrappedContent = (
259
+ <CanvasBrandStyleContext.Provider value={mergedBrandStyle}>
260
+ {content}
261
+ </CanvasBrandStyleContext.Provider>
262
+ );
263
+
429
264
  return (
430
265
  <CacheProvider value={cache}>
431
- <ThemeProvider theme={theme as Theme}>
432
- <div
433
- dir={theme?.canvas?.direction || defaultCanvasTheme.direction}
434
- {...(rest as React.HTMLAttributes<HTMLDivElement>)}
435
- >
436
- {children}
437
- </div>
438
- </ThemeProvider>
266
+ {emotionTheme ? (
267
+ <ThemeProvider theme={emotionTheme}>{wrappedContent}</ThemeProvider>
268
+ ) : (
269
+ wrappedContent
270
+ )}
439
271
  </CacheProvider>
440
272
  );
441
273
  };
@@ -6,6 +6,13 @@
6
6
  > guide, see our
7
7
  > [Theming Documentation](https://workday.github.io/canvas-kit/?path=/docs/features-theming-overview--docs).
8
8
 
9
+ ## Sana Canvas Theme
10
+
11
+ For application-level theming in v16, import the Sana CSS variables and set `data-theme="sana-canvas"`
12
+ on `<html>`. See the
13
+ [v16 Upgrade Guide](https://workday.github.io/canvas-kit/?path=/docs/guides-upgrade-guides-v-16-0-overview--docs#sana-canvas-theme)
14
+ for the canonical setup. The `CanvasProvider` `theme` prop is for **scoped** theming only.
15
+
9
16
  ## Installation
10
17
 
11
18
  ```sh
@@ -14,7 +21,7 @@ yarn add @workday/canvas-kit-react/common
14
21
 
15
22
  ## Recommended Approach: CSS Variables
16
23
 
17
- Canvas Kit v14+ promotes using CSS variables for theming. Import CSS variable files and override
24
+ Canvas Kit v16 promotes using CSS variables for theming. Import CSS variable files and override
18
25
  values in your root CSS:
19
26
 
20
27
  ```css
@@ -23,12 +30,13 @@ values in your root CSS:
23
30
  @import '@workday/canvas-tokens-web/css/system/_variables.css';
24
31
  @import '@workday/canvas-tokens-web/css/brand/_variables.css';
25
32
  @import '@workday/canvas-tokens-web/css/component/_variables.css';
33
+ @import '@workday/canvas-tokens-web/css/sana/_variables.css';
26
34
 
27
35
  :root {
28
36
  /* Override brand primary colors */
29
- --cnvs-brand-primary-base: var(--cnvs-base-palette-magenta-600);
30
- --cnvs-brand-primary-light: var(--cnvs-base-palette-magenta-200);
31
- --cnvs-brand-primary-dark: var(--cnvs-base-palette-magenta-700);
37
+ --cnvs-brand-primary-600: var(--cnvs-base-palette-magenta-600);
38
+ --cnvs-brand-primary-500: var(--cnvs-base-palette-magenta-500);
39
+ --cnvs-brand-primary-A50: var(--cnvs-base-palette-magenta-A50);
32
40
  }
33
41
  ```
34
42
 
@@ -40,8 +48,8 @@ import {createStyles} from '@workday/canvas-kit-styling';
40
48
  import {base, brand} from '@workday/canvas-tokens-web';
41
49
 
42
50
  const themedBrand = createStyles({
43
- [brand.primary.base]: base.legacy.magenta600,
44
- [brand.primary.dark]: base.legacy.magenta700,
51
+ [brand.primary600]: base.magenta600,
52
+ [brand.primary700]: base.magenta700,
45
53
  });
46
54
 
47
55
  <CanvasProvider className={themedBrand}>
@@ -49,6 +57,41 @@ const themedBrand = createStyles({
49
57
  </CanvasProvider>;
50
58
  ```
51
59
 
60
+ ## Scoped Theming (CanvasProvider)
61
+
62
+ For embedded or multi-brand sections, use the numerical `brand` shape:
63
+
64
+ ```tsx
65
+ import {CanvasProvider} from '@workday/canvas-kit-react/common';
66
+ import {base} from '@workday/canvas-tokens-web';
67
+
68
+ <CanvasProvider theme={{brand: {primary: {'600': base.magenta600}}}}>
69
+ <ScopedSection />
70
+ </CanvasProvider>
71
+ ```
72
+
73
+ ### Popups and `sanaCanvasProviderTheme`
74
+
75
+ Popups (menus, selects, modals) portal to `document.body`. Theme inheritance depends on where
76
+ `data-theme="sana-canvas"` lives:
77
+
78
+ - **You control `<html>`:** set `data-theme="sana-canvas"` there. Popups inherit Sana variables —
79
+ no `theme` prop needed.
80
+ - **You cannot control `<html>`** (embedded apps, microfrontends, third-party shells): pass
81
+ `sanaCanvasProviderTheme` to your root `CanvasProvider`. Nested `data-theme` on a wrapper does
82
+ not reach portaled popups; this preset forwards Sana brand variables onto the popup stack.
83
+
84
+ ```tsx
85
+ import {CanvasProvider, sanaCanvasProviderTheme} from '@workday/canvas-kit-react/common';
86
+
87
+ // Required when <html> is unavailable
88
+ <CanvasProvider theme={sanaCanvasProviderTheme}>
89
+ <App />
90
+ </CanvasProvider>
91
+ ```
92
+
93
+ See the [Theming documentation](https://workday.github.io/canvas-kit/?path=/docs/features-theming-overview--docs) for details.
94
+
52
95
  ## Bidirectionality (RTL Support)
53
96
 
54
97
  ### Setting RTL Direction