@okta/odyssey-react-mui 1.32.0 → 1.32.4

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 (458) hide show
  1. package/dist/cjs/theme/components.cjs +6 -0
  2. package/dist/cjs/theme/components.cjs.map +1 -1
  3. package/dist/cjs/ui-shell/SideNav/SideNav.cjs +2 -1
  4. package/dist/cjs/ui-shell/SideNav/SideNav.cjs.map +1 -1
  5. package/dist/cjs/ui-shell/SideNav/SideNavItemContent.cjs +36 -11
  6. package/dist/cjs/ui-shell/SideNav/SideNavItemContent.cjs.map +1 -1
  7. package/dist/cjs/ui-shell/SideNav/SideNavItemLinkContent.cjs +3 -1
  8. package/dist/cjs/ui-shell/SideNav/SideNavItemLinkContent.cjs.map +1 -1
  9. package/dist/cjs/ui-shell/SideNav/SideNavLogo.cjs +14 -2
  10. package/dist/cjs/ui-shell/SideNav/SideNavLogo.cjs.map +1 -1
  11. package/dist/cjs/ui-shell/SideNav/SideNavToggleButton.cjs +1 -1
  12. package/dist/cjs/ui-shell/SideNav/SideNavToggleButton.cjs.map +1 -1
  13. package/dist/cjs/ui-shell/SideNav/types.cjs.map +1 -1
  14. package/dist/cjs/ui-shell/UiShellContent.cjs +48 -32
  15. package/dist/cjs/ui-shell/UiShellContent.cjs.map +1 -1
  16. package/dist/cjs/ui-shell/index.cjs +9 -1
  17. package/dist/cjs/ui-shell/index.cjs.map +1 -1
  18. package/dist/cjs/useContrastMode.cjs +1 -1
  19. package/dist/cjs/useContrastMode.cjs.map +1 -1
  20. package/dist/esm/theme/components.js +6 -0
  21. package/dist/esm/theme/components.js.map +1 -1
  22. package/dist/esm/ui-shell/SideNav/SideNav.js +2 -1
  23. package/dist/esm/ui-shell/SideNav/SideNav.js.map +1 -1
  24. package/dist/esm/ui-shell/SideNav/SideNavItemContent.js +37 -12
  25. package/dist/esm/ui-shell/SideNav/SideNavItemContent.js.map +1 -1
  26. package/dist/esm/ui-shell/SideNav/SideNavItemLinkContent.js +3 -1
  27. package/dist/esm/ui-shell/SideNav/SideNavItemLinkContent.js.map +1 -1
  28. package/dist/esm/ui-shell/SideNav/SideNavLogo.js +14 -2
  29. package/dist/esm/ui-shell/SideNav/SideNavLogo.js.map +1 -1
  30. package/dist/esm/ui-shell/SideNav/SideNavToggleButton.js +1 -1
  31. package/dist/esm/ui-shell/SideNav/SideNavToggleButton.js.map +1 -1
  32. package/dist/esm/ui-shell/SideNav/types.js.map +1 -1
  33. package/dist/esm/ui-shell/UiShellContent.js +45 -31
  34. package/dist/esm/ui-shell/UiShellContent.js.map +1 -1
  35. package/dist/esm/ui-shell/index.js +1 -0
  36. package/dist/esm/ui-shell/index.js.map +1 -1
  37. package/dist/esm/useContrastMode.js +2 -2
  38. package/dist/esm/useContrastMode.js.map +1 -1
  39. package/dist/index.cjs +1 -1
  40. package/dist/index.mjs +1 -1
  41. package/dist/index.scss +1 -1
  42. package/dist/tsconfig.production.tsbuildinfo +1 -1
  43. package/dist/types/theme/components.d.ts.map +1 -1
  44. package/dist/types/ui-shell/SideNav/SideNav.d.ts.map +1 -1
  45. package/dist/types/ui-shell/SideNav/SideNavItemContent.d.ts +9 -7
  46. package/dist/types/ui-shell/SideNav/SideNavItemContent.d.ts.map +1 -1
  47. package/dist/types/ui-shell/SideNav/SideNavItemLinkContent.d.ts +1 -1
  48. package/dist/types/ui-shell/SideNav/SideNavItemLinkContent.d.ts.map +1 -1
  49. package/dist/types/ui-shell/SideNav/SideNavLogo.d.ts.map +1 -1
  50. package/dist/types/ui-shell/SideNav/types.d.ts +5 -1
  51. package/dist/types/ui-shell/SideNav/types.d.ts.map +1 -1
  52. package/dist/types/ui-shell/UiShellContent.d.ts +8 -2
  53. package/dist/types/ui-shell/UiShellContent.d.ts.map +1 -1
  54. package/dist/types/ui-shell/index.d.ts +1 -1
  55. package/dist/types/ui-shell/index.d.ts.map +1 -1
  56. package/package.json +4 -4
  57. package/.browserslistrc +0 -1
  58. package/.svgrrc.cjs +0 -13
  59. package/CHANGELOG.md +0 -1490
  60. package/babel.config.cjs +0 -112
  61. package/i18n.config.json +0 -10
  62. package/scripts/generateIconsIndex.ts +0 -49
  63. package/scripts/generateTestSelectorsJson.ts +0 -33
  64. package/scripts/properties-to-ts.ts +0 -111
  65. package/src/@types/i18next.d.ts +0 -24
  66. package/src/@types/properties.d.ts +0 -292
  67. package/src/@types/react-augment.d.ts +0 -22
  68. package/src/Accordion.tsx +0 -117
  69. package/src/Autocomplete.tsx +0 -321
  70. package/src/Badge.tsx +0 -112
  71. package/src/Banner.tsx +0 -112
  72. package/src/Box.tsx +0 -44
  73. package/src/Breadcrumbs.tsx +0 -221
  74. package/src/Buttons/BaseButton.tsx +0 -250
  75. package/src/Buttons/BaseMenuButton.tsx +0 -342
  76. package/src/Buttons/Button.tsx +0 -30
  77. package/src/Buttons/ButtonContext.tsx +0 -23
  78. package/src/Buttons/MenuButton.tsx +0 -33
  79. package/src/Buttons/MenuContext.ts +0 -25
  80. package/src/Buttons/MenuItem.tsx +0 -103
  81. package/src/Buttons/index.ts +0 -25
  82. package/src/Callout.tsx +0 -176
  83. package/src/Card.tsx +0 -186
  84. package/src/Checkbox.tsx +0 -261
  85. package/src/CheckboxGroup.tsx +0 -127
  86. package/src/CircularProgress.tsx +0 -42
  87. package/src/CssBaseline.tsx +0 -20
  88. package/src/DataTable/DataTable.tsx +0 -968
  89. package/src/DataTable/DataTableRowActions.tsx +0 -132
  90. package/src/DataTable/DataTableSettings.tsx +0 -136
  91. package/src/DataTable/constants.ts +0 -13
  92. package/src/DataTable/index.tsx +0 -28
  93. package/src/DataTable/reorderDataRowsLocally.tsx +0 -48
  94. package/src/DataTable/useRowReordering.tsx +0 -232
  95. package/src/DataTable/useScrollIndication.tsx +0 -125
  96. package/src/DatePickers/DateField.tsx +0 -267
  97. package/src/DatePickers/DateFieldActionBar.tsx +0 -65
  98. package/src/DatePickers/DateFieldLocalizationProvider.tsx +0 -46
  99. package/src/DatePickers/DatePicker.test.tsx +0 -66
  100. package/src/DatePickers/DatePicker.tsx +0 -299
  101. package/src/DatePickers/DatePicker.types.d.ts +0 -14
  102. package/src/DatePickers/TimeZonePicker.tsx +0 -59
  103. package/src/DatePickers/datePickerTheme.tsx +0 -377
  104. package/src/DatePickers/index.ts +0 -15
  105. package/src/DatePickers/useDateFieldsTranslations.ts +0 -94
  106. package/src/DatePickers/useOdysseyDateFields.ts +0 -303
  107. package/src/Dialog.tsx +0 -178
  108. package/src/Drawer.tsx +0 -255
  109. package/src/EmptyState.tsx +0 -79
  110. package/src/ErrorMessageList.tsx +0 -56
  111. package/src/Field.tsx +0 -189
  112. package/src/FieldComponentProps.ts +0 -66
  113. package/src/FieldError.tsx +0 -59
  114. package/src/FieldHint.tsx +0 -72
  115. package/src/FieldLabel.tsx +0 -67
  116. package/src/Fieldset.tsx +0 -116
  117. package/src/FieldsetContext.tsx +0 -23
  118. package/src/FileUploader/FileUploadIllustration.tsx +0 -66
  119. package/src/FileUploader/FileUploadPreview.tsx +0 -151
  120. package/src/FileUploader/FileUploader.tsx +0 -311
  121. package/src/FileUploader/index.ts +0 -13
  122. package/src/Form.tsx +0 -185
  123. package/src/FormCheckedProps.ts +0 -59
  124. package/src/HintLink.tsx +0 -28
  125. package/src/HtmlProps.ts +0 -112
  126. package/src/IconWithTooltip.tsx +0 -90
  127. package/src/Link.tsx +0 -115
  128. package/src/MuiPropsChild.tsx +0 -42
  129. package/src/MuiPropsContext.ts +0 -18
  130. package/src/NativeSelect.tsx +0 -249
  131. package/src/NullElement.tsx +0 -13
  132. package/src/OdysseyCacheProvider.test.tsx +0 -39
  133. package/src/OdysseyCacheProvider.tsx +0 -86
  134. package/src/OdysseyDesignTokensContext.tsx +0 -23
  135. package/src/OdysseyProvider.tsx +0 -92
  136. package/src/OdysseyThemeProvider.test.tsx +0 -211
  137. package/src/OdysseyThemeProvider.tsx +0 -109
  138. package/src/OdysseyTranslationProvider.test.tsx +0 -95
  139. package/src/OdysseyTranslationProvider.tsx +0 -77
  140. package/src/OdysseyTranslationProvider.types.ts +0 -47
  141. package/src/Pagination/Pagination.test.tsx +0 -327
  142. package/src/Pagination/Pagination.tsx +0 -417
  143. package/src/Pagination/constants.ts +0 -13
  144. package/src/Pagination/index.ts +0 -15
  145. package/src/Pagination/usePagination.ts +0 -45
  146. package/src/PasswordField.tsx +0 -253
  147. package/src/Radio.tsx +0 -199
  148. package/src/RadioGroup.tsx +0 -164
  149. package/src/ScreenReaderText.tsx +0 -53
  150. package/src/SearchField.tsx +0 -240
  151. package/src/Select.tsx +0 -576
  152. package/src/Stack.tsx +0 -56
  153. package/src/Status.tsx +0 -67
  154. package/src/Surface.tsx +0 -61
  155. package/src/SvgIcon.ts +0 -22
  156. package/src/Switch.tsx +0 -425
  157. package/src/Tabs.tsx +0 -259
  158. package/src/Tag.tsx +0 -317
  159. package/src/TagList.tsx +0 -55
  160. package/src/TagListContext.tsx +0 -23
  161. package/src/TextField.tsx +0 -298
  162. package/src/Toast.tsx +0 -151
  163. package/src/ToastStack.tsx +0 -43
  164. package/src/Tooltip.tsx +0 -61
  165. package/src/Typography.test.tsx +0 -26
  166. package/src/Typography.tsx +0 -474
  167. package/src/createContrastColors.ts +0 -112
  168. package/src/createUniqueAlphabeticalId.test.ts +0 -22
  169. package/src/createUniqueAlphabeticalId.ts +0 -17
  170. package/src/createUniqueId.test.ts +0 -22
  171. package/src/createUniqueId.ts +0 -17
  172. package/src/getTypedObjectKeys.ts +0 -15
  173. package/src/hexToRgb.ts +0 -40
  174. package/src/i18n.ts +0 -110
  175. package/src/icons.generated/Add.tsx +0 -44
  176. package/src/icons.generated/AddCircle.tsx +0 -46
  177. package/src/icons.generated/Apps.tsx +0 -44
  178. package/src/icons.generated/ArrowBottom.tsx +0 -46
  179. package/src/icons.generated/ArrowDown.tsx +0 -46
  180. package/src/icons.generated/ArrowLeft.tsx +0 -46
  181. package/src/icons.generated/ArrowLowerLeft.tsx +0 -46
  182. package/src/icons.generated/ArrowLowerRight.tsx +0 -46
  183. package/src/icons.generated/ArrowRight.tsx +0 -46
  184. package/src/icons.generated/ArrowTop.tsx +0 -46
  185. package/src/icons.generated/ArrowUnsorted.tsx +0 -46
  186. package/src/icons.generated/ArrowUp.tsx +0 -46
  187. package/src/icons.generated/ArrowUpperLeft.tsx +0 -46
  188. package/src/icons.generated/ArrowUpperRight.tsx +0 -46
  189. package/src/icons.generated/Bug.tsx +0 -44
  190. package/src/icons.generated/Calendar.tsx +0 -46
  191. package/src/icons.generated/Call.tsx +0 -44
  192. package/src/icons.generated/Chat.tsx +0 -44
  193. package/src/icons.generated/Check.tsx +0 -44
  194. package/src/icons.generated/CheckCircleFilled.tsx +0 -47
  195. package/src/icons.generated/ChevronDown.tsx +0 -46
  196. package/src/icons.generated/ChevronLeft.tsx +0 -46
  197. package/src/icons.generated/ChevronRight.tsx +0 -46
  198. package/src/icons.generated/ChevronUp.tsx +0 -46
  199. package/src/icons.generated/Clock.tsx +0 -44
  200. package/src/icons.generated/Close.tsx +0 -44
  201. package/src/icons.generated/CloseCircleFilled.tsx +0 -47
  202. package/src/icons.generated/CollapseLeft.tsx +0 -46
  203. package/src/icons.generated/CollapseRight.tsx +0 -46
  204. package/src/icons.generated/Copy.tsx +0 -44
  205. package/src/icons.generated/Custom.tsx +0 -50
  206. package/src/icons.generated/DangerDiamond.tsx +0 -46
  207. package/src/icons.generated/DangerDiamondFilled.tsx +0 -47
  208. package/src/icons.generated/Delete.tsx +0 -44
  209. package/src/icons.generated/Deny.tsx +0 -44
  210. package/src/icons.generated/Devices.tsx +0 -46
  211. package/src/icons.generated/Directory.tsx +0 -46
  212. package/src/icons.generated/Documentation.tsx +0 -46
  213. package/src/icons.generated/Download.tsx +0 -46
  214. package/src/icons.generated/DragIndicator.tsx +0 -46
  215. package/src/icons.generated/Duo.tsx +0 -62
  216. package/src/icons.generated/Edit.tsx +0 -44
  217. package/src/icons.generated/Email.tsx +0 -49
  218. package/src/icons.generated/ExpandLeft.tsx +0 -46
  219. package/src/icons.generated/ExpandRight.tsx +0 -46
  220. package/src/icons.generated/ExternalLink.tsx +0 -44
  221. package/src/icons.generated/Fido2.tsx +0 -72
  222. package/src/icons.generated/Filter.tsx +0 -44
  223. package/src/icons.generated/Folder.tsx +0 -44
  224. package/src/icons.generated/Globe.tsx +0 -44
  225. package/src/icons.generated/GoogleAuth.tsx +0 -70
  226. package/src/icons.generated/Grid.tsx +0 -47
  227. package/src/icons.generated/Group.tsx +0 -44
  228. package/src/icons.generated/Hide.tsx +0 -44
  229. package/src/icons.generated/Home.tsx +0 -44
  230. package/src/icons.generated/Idp.tsx +0 -54
  231. package/src/icons.generated/InformationCircle.tsx +0 -47
  232. package/src/icons.generated/InformationCircleFilled.tsx +0 -47
  233. package/src/icons.generated/Link.tsx +0 -44
  234. package/src/icons.generated/List.tsx +0 -44
  235. package/src/icons.generated/Lock.tsx +0 -44
  236. package/src/icons.generated/More.tsx +0 -44
  237. package/src/icons.generated/Notification.tsx +0 -46
  238. package/src/icons.generated/OktaVerify.tsx +0 -46
  239. package/src/icons.generated/OnPremMfa.tsx +0 -52
  240. package/src/icons.generated/OneTimePassword.tsx +0 -65
  241. package/src/icons.generated/Password.tsx +0 -80
  242. package/src/icons.generated/Pause.tsx +0 -44
  243. package/src/icons.generated/QuestionCircle.tsx +0 -46
  244. package/src/icons.generated/QuestionCircleFilled.tsx +0 -47
  245. package/src/icons.generated/Refresh.tsx +0 -46
  246. package/src/icons.generated/Reset.tsx +0 -44
  247. package/src/icons.generated/Resume.tsx +0 -44
  248. package/src/icons.generated/Search.tsx +0 -44
  249. package/src/icons.generated/SecurityQuestion.tsx +0 -51
  250. package/src/icons.generated/Server.tsx +0 -44
  251. package/src/icons.generated/Settings.tsx +0 -46
  252. package/src/icons.generated/Show.tsx +0 -44
  253. package/src/icons.generated/SmartCard.tsx +0 -65
  254. package/src/icons.generated/Sms.tsx +0 -55
  255. package/src/icons.generated/Subtract.tsx +0 -46
  256. package/src/icons.generated/SymantecVip.tsx +0 -52
  257. package/src/icons.generated/Sync.tsx +0 -44
  258. package/src/icons.generated/ThumbsDown.tsx +0 -46
  259. package/src/icons.generated/ThumbsUp.tsx +0 -46
  260. package/src/icons.generated/Unlock.tsx +0 -44
  261. package/src/icons.generated/Upload.tsx +0 -44
  262. package/src/icons.generated/User.tsx +0 -44
  263. package/src/icons.generated/Video.tsx +0 -44
  264. package/src/icons.generated/VoiceCall.tsx +0 -62
  265. package/src/icons.generated/Warning.tsx +0 -46
  266. package/src/icons.generated/WarningFilled.tsx +0 -46
  267. package/src/icons.generated/Yubikey.tsx +0 -44
  268. package/src/icons.generated/index.ts +0 -107
  269. package/src/index.ts +0 -118
  270. package/src/inputUtils.ts +0 -80
  271. package/src/labs/AppTile.tsx +0 -421
  272. package/src/labs/DataFilters.tsx +0 -871
  273. package/src/labs/DataTable.tsx +0 -877
  274. package/src/labs/DataTablePagination.tsx +0 -88
  275. package/src/labs/DataView/BulkActionsMenu.tsx +0 -98
  276. package/src/labs/DataView/CardLayoutContent.tsx +0 -272
  277. package/src/labs/DataView/DataCard.tsx +0 -357
  278. package/src/labs/DataView/DataTable.tsx +0 -128
  279. package/src/labs/DataView/DataView.test.tsx +0 -1168
  280. package/src/labs/DataView/DataView.tsx +0 -504
  281. package/src/labs/DataView/DetailPanel.tsx +0 -31
  282. package/src/labs/DataView/LayoutSwitcher.tsx +0 -72
  283. package/src/labs/DataView/RowActions.tsx +0 -125
  284. package/src/labs/DataView/TableLayoutContent.tsx +0 -500
  285. package/src/labs/DataView/TableSettings.tsx +0 -144
  286. package/src/labs/DataView/componentTypes.ts +0 -129
  287. package/src/labs/DataView/constants.tsx +0 -28
  288. package/src/labs/DataView/dataTypes.ts +0 -83
  289. package/src/labs/DataView/fetchData.ts +0 -49
  290. package/src/labs/DataView/index.ts +0 -19
  291. package/src/labs/DataView/tableConstants.tsx +0 -137
  292. package/src/labs/DataView/testSupportData.tsx +0 -301
  293. package/src/labs/DataView/useFilterConversion.ts +0 -88
  294. package/src/labs/DatePickers/DateTimeField.tsx +0 -267
  295. package/src/labs/DatePickers/DateTimePicker.test.tsx +0 -70
  296. package/src/labs/DatePickers/DateTimePicker.tsx +0 -303
  297. package/src/labs/DatePickers/dateTimePickerTheme.ts +0 -216
  298. package/src/labs/DatePickers/index.ts +0 -13
  299. package/src/labs/GroupPicker.tsx +0 -261
  300. package/src/labs/OdysseyPickers/ComposablePicker.test.tsx +0 -32
  301. package/src/labs/OdysseyPickers/ComposablePicker.tsx +0 -188
  302. package/src/labs/OdysseyPickers/Picker.tsx +0 -381
  303. package/src/labs/OdysseyPickers/PickerVirtualizationListBox.tsx +0 -192
  304. package/src/labs/OdysseyPickers/PickerWithOptionAdornment.tsx +0 -429
  305. package/src/labs/OdysseyPickers/index.ts +0 -15
  306. package/src/labs/PageTemplate/Layout.tsx +0 -85
  307. package/src/labs/PageTemplate/PageTemplate.tsx +0 -234
  308. package/src/labs/PageTemplate/index.ts +0 -14
  309. package/src/labs/PaginatedTable.tsx +0 -290
  310. package/src/labs/README.md +0 -46
  311. package/src/labs/StaticTable.tsx +0 -131
  312. package/src/labs/UserProfile.tsx +0 -104
  313. package/src/labs/UserProfileMenuButton.tsx +0 -86
  314. package/src/labs/index.ts +0 -47
  315. package/src/labs/materialReactTableTypes.tsx +0 -19
  316. package/src/properties/odyssey-react-mui.properties +0 -140
  317. package/src/properties/translations/odyssey-react-mui_cs.properties +0 -140
  318. package/src/properties/translations/odyssey-react-mui_da.properties +0 -140
  319. package/src/properties/translations/odyssey-react-mui_de.properties +0 -140
  320. package/src/properties/translations/odyssey-react-mui_el.properties +0 -140
  321. package/src/properties/translations/odyssey-react-mui_es.properties +0 -140
  322. package/src/properties/translations/odyssey-react-mui_fi.properties +0 -140
  323. package/src/properties/translations/odyssey-react-mui_fr.properties +0 -140
  324. package/src/properties/translations/odyssey-react-mui_ht.properties +0 -140
  325. package/src/properties/translations/odyssey-react-mui_hu.properties +0 -140
  326. package/src/properties/translations/odyssey-react-mui_id.properties +0 -140
  327. package/src/properties/translations/odyssey-react-mui_it.properties +0 -140
  328. package/src/properties/translations/odyssey-react-mui_ja.properties +0 -140
  329. package/src/properties/translations/odyssey-react-mui_ko.properties +0 -140
  330. package/src/properties/translations/odyssey-react-mui_ms.properties +0 -140
  331. package/src/properties/translations/odyssey-react-mui_nb.properties +0 -140
  332. package/src/properties/translations/odyssey-react-mui_nl_NL.properties +0 -140
  333. package/src/properties/translations/odyssey-react-mui_ok_PL.properties +0 -126
  334. package/src/properties/translations/odyssey-react-mui_ok_SK.properties +0 -126
  335. package/src/properties/translations/odyssey-react-mui_pl.properties +0 -140
  336. package/src/properties/translations/odyssey-react-mui_pt_BR.properties +0 -140
  337. package/src/properties/translations/odyssey-react-mui_ro.properties +0 -140
  338. package/src/properties/translations/odyssey-react-mui_ru.properties +0 -140
  339. package/src/properties/translations/odyssey-react-mui_sv.properties +0 -140
  340. package/src/properties/translations/odyssey-react-mui_th.properties +0 -140
  341. package/src/properties/translations/odyssey-react-mui_tr.properties +0 -140
  342. package/src/properties/translations/odyssey-react-mui_uk.properties +0 -140
  343. package/src/properties/translations/odyssey-react-mui_vi.properties +0 -140
  344. package/src/properties/translations/odyssey-react-mui_zh_CN.properties +0 -140
  345. package/src/properties/translations/odyssey-react-mui_zh_TW.properties +0 -140
  346. package/src/properties/ts/odyssey-react-mui.ts +0 -1
  347. package/src/properties/ts/odyssey-react-mui_cs.ts +0 -1
  348. package/src/properties/ts/odyssey-react-mui_da.ts +0 -1
  349. package/src/properties/ts/odyssey-react-mui_de.ts +0 -1
  350. package/src/properties/ts/odyssey-react-mui_el.ts +0 -1
  351. package/src/properties/ts/odyssey-react-mui_es.ts +0 -1
  352. package/src/properties/ts/odyssey-react-mui_fi.ts +0 -1
  353. package/src/properties/ts/odyssey-react-mui_fr.ts +0 -1
  354. package/src/properties/ts/odyssey-react-mui_ht.ts +0 -1
  355. package/src/properties/ts/odyssey-react-mui_hu.ts +0 -1
  356. package/src/properties/ts/odyssey-react-mui_id.ts +0 -1
  357. package/src/properties/ts/odyssey-react-mui_it.ts +0 -1
  358. package/src/properties/ts/odyssey-react-mui_ja.ts +0 -1
  359. package/src/properties/ts/odyssey-react-mui_ko.ts +0 -1
  360. package/src/properties/ts/odyssey-react-mui_ms.ts +0 -1
  361. package/src/properties/ts/odyssey-react-mui_nb.ts +0 -1
  362. package/src/properties/ts/odyssey-react-mui_nl_NL.ts +0 -1
  363. package/src/properties/ts/odyssey-react-mui_ok_PL.ts +0 -1
  364. package/src/properties/ts/odyssey-react-mui_ok_SK.ts +0 -1
  365. package/src/properties/ts/odyssey-react-mui_pl.ts +0 -1
  366. package/src/properties/ts/odyssey-react-mui_pt_BR.ts +0 -1
  367. package/src/properties/ts/odyssey-react-mui_ro.ts +0 -1
  368. package/src/properties/ts/odyssey-react-mui_ru.ts +0 -1
  369. package/src/properties/ts/odyssey-react-mui_sv.ts +0 -1
  370. package/src/properties/ts/odyssey-react-mui_th.ts +0 -1
  371. package/src/properties/ts/odyssey-react-mui_tr.ts +0 -1
  372. package/src/properties/ts/odyssey-react-mui_uk.ts +0 -1
  373. package/src/properties/ts/odyssey-react-mui_vi.ts +0 -1
  374. package/src/properties/ts/odyssey-react-mui_zh_CN.ts +0 -1
  375. package/src/properties/ts/odyssey-react-mui_zh_TW.ts +0 -1
  376. package/src/remUtils.ts +0 -27
  377. package/src/shadow-dom/index.ts +0 -13
  378. package/src/shadow-dom/shadow-dom.test.ts +0 -24
  379. package/src/shadow-dom/shadow-dom.ts +0 -54
  380. package/src/test-selectors/getByQuerySelector.ts +0 -176
  381. package/src/test-selectors/getComputedAccessibleErrorMessageText.ts +0 -52
  382. package/src/test-selectors/getComputedAccessibleText.ts +0 -36
  383. package/src/test-selectors/index.ts +0 -15
  384. package/src/test-selectors/interpolateString.ts +0 -41
  385. package/src/test-selectors/linkedHtmlSelectors.ts +0 -73
  386. package/src/test-selectors/queryOdysseySelector.ts +0 -36
  387. package/src/test-selectors/querySelector.ts +0 -249
  388. package/src/test-selectors/sanityChecks.ts +0 -53
  389. package/src/test-selectors/testSelector.ts +0 -143
  390. package/src/theme/components.tsx +0 -3275
  391. package/src/theme/components.types.ts +0 -111
  392. package/src/theme/createOdysseyMuiTheme.ts +0 -54
  393. package/src/theme/index.ts +0 -13
  394. package/src/theme/mixins.ts +0 -29
  395. package/src/theme/mixins.types.ts +0 -31
  396. package/src/theme/palette.ts +0 -112
  397. package/src/theme/palette.types.ts +0 -24
  398. package/src/theme/shape.ts +0 -31
  399. package/src/theme/spacing.ts +0 -34
  400. package/src/theme/theme.ts +0 -13
  401. package/src/theme/typography.ts +0 -137
  402. package/src/theme/typography.types.ts +0 -41
  403. package/src/theme/useContrastMode.test.tsx +0 -504
  404. package/src/ui-shell/AppSwitcher/AppSwitcher.tsx +0 -94
  405. package/src/ui-shell/AppSwitcher/AppSwitcherApp.tsx +0 -146
  406. package/src/ui-shell/AppSwitcher/OktaAura.tsx +0 -50
  407. package/src/ui-shell/AppSwitcher/index.ts +0 -13
  408. package/src/ui-shell/SideNav/CollapseIcon.tsx +0 -34
  409. package/src/ui-shell/SideNav/HandleIcon.tsx +0 -35
  410. package/src/ui-shell/SideNav/NavAccordion.tsx +0 -243
  411. package/src/ui-shell/SideNav/OktaLogo.tsx +0 -34
  412. package/src/ui-shell/SideNav/SideNav.test.tsx +0 -326
  413. package/src/ui-shell/SideNav/SideNav.tsx +0 -810
  414. package/src/ui-shell/SideNav/SideNavFooterContent.tsx +0 -85
  415. package/src/ui-shell/SideNav/SideNavHeader.tsx +0 -134
  416. package/src/ui-shell/SideNav/SideNavItemContent.tsx +0 -402
  417. package/src/ui-shell/SideNav/SideNavItemContentContext.tsx +0 -29
  418. package/src/ui-shell/SideNav/SideNavItemLinkContent.tsx +0 -90
  419. package/src/ui-shell/SideNav/SideNavLogo.tsx +0 -65
  420. package/src/ui-shell/SideNav/SideNavToggleButton.tsx +0 -272
  421. package/src/ui-shell/SideNav/SortableList/SortableItem.tsx +0 -237
  422. package/src/ui-shell/SideNav/SortableList/SortableList.tsx +0 -132
  423. package/src/ui-shell/SideNav/SortableList/SortableOverlay.tsx +0 -34
  424. package/src/ui-shell/SideNav/index.ts +0 -16
  425. package/src/ui-shell/SideNav/types.ts +0 -224
  426. package/src/ui-shell/TopNav/TopNav.tsx +0 -109
  427. package/src/ui-shell/TopNav/TopNavLinksList.tsx +0 -68
  428. package/src/ui-shell/TopNav/TopNavListItem.tsx +0 -209
  429. package/src/ui-shell/TopNav/index.ts +0 -13
  430. package/src/ui-shell/UiShell.test.tsx +0 -366
  431. package/src/ui-shell/UiShell.tsx +0 -153
  432. package/src/ui-shell/UiShellContent.tsx +0 -350
  433. package/src/ui-shell/UiShellProvider.tsx +0 -103
  434. package/src/ui-shell/bufferLatest.test.ts +0 -79
  435. package/src/ui-shell/bufferLatest.ts +0 -64
  436. package/src/ui-shell/createMessageBus.test.ts +0 -115
  437. package/src/ui-shell/createMessageBus.ts +0 -53
  438. package/src/ui-shell/createStore.test.ts +0 -103
  439. package/src/ui-shell/createStore.ts +0 -37
  440. package/src/ui-shell/index.ts +0 -21
  441. package/src/ui-shell/renderUiShell.test.tsx +0 -203
  442. package/src/ui-shell/renderUiShell.tsx +0 -158
  443. package/src/ui-shell/useHasUiShell.ts +0 -25
  444. package/src/ui-shell/useScrollState.ts +0 -59
  445. package/src/useAutocomplete.tsx +0 -184
  446. package/src/useContrastMode.tsx +0 -143
  447. package/src/useNormalizedKey.ts +0 -17
  448. package/src/useUniqueAlphabeticalId.ts +0 -21
  449. package/src/useUniqueId.ts +0 -21
  450. package/src/web-component/createReactRootElements.test.ts +0 -40
  451. package/src/web-component/createReactRootElements.ts +0 -39
  452. package/src/web-component/index.ts +0 -13
  453. package/src/web-component/renderReactInWebComponent.test.tsx +0 -128
  454. package/src/web-component/renderReactInWebComponent.ts +0 -135
  455. package/tsconfig.json +0 -16
  456. package/tsconfig.production.json +0 -13
  457. package/vitest.config.ts +0 -36
  458. package/vitest.setup.ts +0 -32
@@ -1 +1 @@
1
- {"version":3,"file":"SideNavLogo.js","names":["memo","useMemo","styled","OktaLogo","jsx","_jsx","StyledLogoContainer","display","alignItems","height","StyledLogoLink","SideNavLogo","imageAltText","logoComponent","imageUrl","optionalProps","logo","src","alt","ariaLabel","href","children","role","MemoizedSideNavLogo","displayName"],"sources":["../../../../src/ui-shell/SideNav/SideNavLogo.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { memo, useMemo } from \"react\";\nimport styled from \"@emotion/styled\";\n\nimport { OktaLogo } from \"./OktaLogo.js\";\nimport { SideNavLogoProps } from \"./types.js\";\n\nconst StyledLogoContainer = styled(\"div\")(() => ({\n display: \"flex\",\n alignItems: \"center\",\n height: \"100%\",\n}));\n\nconst StyledLogoLink = styled(\"a\")(() => ({\n display: \"flex\",\n alignItems: \"center\",\n height: \"100%\",\n}));\n\nconst SideNavLogo = ({\n imageAltText,\n logoComponent,\n imageUrl,\n ...optionalProps\n}: SideNavLogoProps) => {\n const logo = useMemo(() => {\n if (logoComponent) {\n return logoComponent;\n }\n\n if (imageAltText && imageUrl) {\n return <img src={imageUrl} alt={imageAltText} />;\n }\n\n return <OktaLogo />;\n }, [imageAltText, logoComponent, imageUrl]);\n\n return \"href\" in optionalProps && \"ariaLabel\" in optionalProps ? (\n <StyledLogoLink\n aria-label={optionalProps.ariaLabel}\n data-se=\"sidenav-header-logo\"\n href={optionalProps.href}\n >\n {logo}\n </StyledLogoLink>\n ) : (\n <StyledLogoContainer role=\"presentation\">{logo}</StyledLogoContainer>\n );\n};\n\nconst MemoizedSideNavLogo = memo(S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EAExBL;EAAI,CACS,CAAC,GAEjBX,IAAA,CAACC,mBAAmB;IAACgB,IAAI,EAAC,cAAc;IAAAD,QAAA,EAAEL;EAAI,CAAsB,CACrE;AACH,CAAC;AAED,MAAMO,mBAAmB,GAAGvB,IAAI,CAACW,WAAW,CAAC;AAC7CY,mBAAmB,CAACC,WAAW,GAAG,aAAa;AAE/C,SAASD,mBAAmB,IAAIZ,WAAW","ignoreList":[]}
1
+ {"version":3,"file":"SideNavLogo.js","names":["memo","useMemo","styled","OktaLogo","jsx","_jsx","StyledLogoContainer","shouldForwardProp","prop","isLogoInteractive","display","alignItems","height","cursor","StyledLogoLink","SideNavLogo","imageAltText","logoComponent","imageUrl","optionalProps","logo","src","alt","ariaLabel","href","onClick","children","role","Boolean","MemoizedSideNavLogo","displayName"],"sources":["../../../../src/ui-shell/SideNav/SideNavLogo.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { memo, useMemo } from \"react\";\nimport styled from \"@emotion/styled\";\n\nimport { OktaLogo } from \"./OktaLogo.js\";\nimport { SideNavLogoProps } from \"./types.js\";\n\nconst StyledLogoContainer = styled(\"div\", {\n shouldForwardProp: (prop) => prop !== \"isLogoInteractive\",\n})<{\n isLogoInteractive?: boolean;\n}>(({ isLogoInteractive }) => ({\n display: \"flex\",\n alignItems: \"center\",\n height: \"100%\",\n ...(isLogoInteractive && {\n cursor: \"pointer\",\n }),\n}));\n\nconst StyledLogoLink = styled(\"a\")(() => ({\n display: \"flex\",\n alignItems: \"center\",\n height: \"100%\",\n}));\n\nconst SideNavLogo = ({\n imageAltText,\n logoComponent,\n imageUrl,\n ...optionalProps\n}: SideNavLogoProps) => {\n const logo = useMemo(() => {\n if (logoComponent) {\n return logoComponent;\n }\n\n if (imageAltText && imageUrl) {\n return <img src={imageUrl} alt={imageAltText} />;\n }\n\n return <OktaLogo />;\n }, [imageAltText, logoComponent, imageUrl]);\n\n return \"href\" in optionalProps && \"ariaLabel\" in optionalProps ? (\n <StyledLogoLink\n aria-label={optionalProps.ariaLabel}\n data-se=\"sidenav-header-logo\"\n href={optionalProps.href}\n onClick={optionalProps.onClick}\n >\n {logo}\n </StyledLogoLink>\n ) : (\n <StyledLogoContainer\n role=\"presentation\"\n aria-label={optionalProps.ariaLabel}\n data-se=\"sidenav-header-logo\"\n onClick={optionalProps.onClick}\n isLogoInteractive={Boolean(optionalProps.onClick) || optionalProps.href}\n >\n {logo}\n </StyledLogoContainer>\n );\n};\n\nconst MemoizedSideNavLogo = memo(SideNavLogo);\nMemoizedSideNavLogo.displayName = \"SideNavLogo\";\n\nexport { MemoizedSideNavLogo as SideNavLogo };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,EAAEC,OAAO,QAAQ,OAAO;AACrC,OAAOC,MAAM,MAAM,iBAAiB;AAEpC,SAASC,QAAQ,QAAQ,eAAe;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGzC,MAAMC,mBAAmB,GAAGJ,MAAM,CAAC,KAAK,EAAE;EACxCK,iBAAiB,EAAGC,IAAI,IAAKA,IAAI,KAAK;AACxC,CAAC,CAAC,CAEC,CAAC;EAAEC;AAAkB,CAAC,MAAM;EAC7BC,OAAO,EAAE,MAAM;EACfC,UAAU,EAAE,QAAQ;EACpBC,MAAM,EAAE,MAAM;EACd,IAAIH,iBAAiB,IAAI;IACvBI,MAAM,EAAE;EACV,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,MAAMC,cAAc,GAAGZ,MAAM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AAW","ignoreList":[]}
@@ -31,7 +31,7 @@ const StyledToggleButton = styled(_Button, {
31
31
  width: odysseyDesignTokens.Spacing6,
32
32
  height: odysseyDesignTokens.Spacing6,
33
33
  border: 0,
34
- zIndex: 2,
34
+ zIndex: 200,
35
35
  "&:focus-visible": {
36
36
  boxShadow: `inset 0 0 0 2px ${odysseyDesignTokens.PalettePrimaryMain}`,
37
37
  outline: "none"
@@ -1 +1 @@
1
- {"version":3,"file":"SideNavToggleButton.js","names":["memo","useCallback","useImperativeHandle","useMemo","useRef","styled","useTranslation","generateContrastColors","MuiPropsContext","useOdysseyDesignTokens","Tooltip","useUiShellContext","jsx","_jsx","jsxs","_jsxs","StyledToggleButton","_Button","shouldForwardProp","prop","isSideNavCollapsed","odysseyDesignTokens","toggleContrastColors","backgroundColor","position","width","Spacing6","height","border","zIndex","boxShadow","PalettePrimaryMain","outline","animation","TransitionDurationMain","animationFillMode","transform","span","top","left","Spacing4","HueNeutral600","transition","fontColor","SideNavToggleButton","ariaControls","buttonRef","id","onClick","tabIndex","t","uiShellContext","localButtonRef","hasNonStandardAppBackgroundColor","appBackgroundColor","HueNeutralWhite","HueNeutral50","undefined","focus","current","toggleLabel","renderButton","muiProps","ref","element","variant","children","ariaType","placement","text","Consumer","MemoizedSideNavToggleButton","displayName"],"sources":["../../../../src/ui-shell/SideNav/SideNavToggleButton.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { Button as MuiButton } from \"@mui/material\";\nimport type { ButtonProps as MuiButtonProps } from \"@mui/material\";\nimport {\n HTMLAttributes,\n memo,\n useCallback,\n useImperativeHandle,\n useMemo,\n useRef,\n} from \"react\";\nimport styled from \"@emotion/styled\";\nimport { useTranslation } from \"react-i18next\";\n\nimport {\n ContrastColors,\n generateContrastColors,\n} from \"../../createContrastColors.js\";\nimport { FocusHandle } from \"../../inputUtils.js\";\nimport { MuiPropsContext, MuiPropsContextType } from \"../../MuiPropsContext.js\";\nimport {\n DesignTokens,\n useOdysseyDesignTokens,\n} from \"../../OdysseyDesignTokensContext.js\";\nimport { Tooltip } from \"../../Tooltip.js\";\nimport { useUiShellContext } from \"../../ui-shell/UiShellProvider.js\";\n\nconst StyledToggleButton = styled(MuiButton, {\n shouldForwardProp: (prop) =>\n prop !== \"odysseyDesignTokens\" &&\n prop !== \"isSideNavCollapsed\" &&\n prop !== \"toggleContrastColors\",\n})<{\n isSideNavCollapsed: boolean;\n odysseyDesignTokens: DesignTokens;\n toggleContrastColors?: ContrastColors;\n}>(({ isSideNavCollapsed, odysseyDesignTokens, toggleContrastColors }) => ({\n backgroundColor: \"transparent\",\n position: \"relative\",\n width: odysseyDesignTokens.Spacing6,\n height: odysseyDesignTokens.Spacing6,\n border: 0,\n zIndex: 2,\n\n \"&:focus-visible\": {\n boxShadow: `inset 0 0 0 2px ${odysseyDesignTokens.PalettePrimaryMain}`,\n outline: \"none\",\n },\n\n \"&:hover, &:focus-visible\": {\n backgroundColor: \"transparent\",\n\n \"#lineOne\": {\n animation: `lineOne-animate-to-collapse ${odysseyDesignTokens.TransitionDurationMain} cubic-bezier(0, 0, 0.2, 1)`,\n animationFillMode: \"forwards\",\n \"@keyframes lineOne-animate-to-collapse\": {\n \"0%\": {\n transform: \"translate3d(-50%, -50%, 0)\",\n },\n \"50%\": {\n transform: \"translate3d(-50%, -50%, 0) rotate(-90deg) scaleY(.75)\",\n },\n \"100%\": {\n transform: \"translate3d(-50%, -27%, 0) rotate(-45deg) scaleY(.75)\",\n },\n },\n },\n\n \"#lineTwo\": {\n animation: `lineTwo-animate-to-collapse ${odysseyDesignTokens.TransitionDurationMain} cubic-bezier(0, 0, 0.2, 1)`,\n animationFillMode: \"forwards\",\n \"@keyframes lineTwo-animate-to-collapse\": {\n \"0%\": {\n transform: \"translate3d(-50%, -50%, 0)\",\n },\n \"50%\": {\n transform: \"translate3d(-50%, -50%, 0) rotate(-90deg) scaleY(.75)\",\n },\n \"100%\": {\n transform: \"translate3d(-50%, -73%, 0) rotate(-135deg) scaleY(.75)\",\n },\n },\n },\n\n ...(isSideNavCollapsed && {\n \"#lineOne\": {\n animation: `lineOne-animate-to-expand ${odysseyDesignTokens.TransitionDurationMain} cubic-bezier(0, 0, 0.2, 1)`,\n animationFillMode: \"forwards\",\n \"@keyframes lineOne-animate-to-expand\": {\n \"0%\": {\n transform: \"translate3d(-50%, -50%, 0)\",\n },\n \"50%\": {\n transform: \"translate3d(-50%, -50%, 0) rotate(90deg) scaleY(.75)\",\n },\n \"100%\": {\n transform: \"translate3d(-50%, -73%, 0) rotate(135deg) scaleY(.75)\",\n },\n },\n },\n\n \"#lineTwo\": {\n animation: `lineTwo-animate-to-expand ${odysseyDesignTokens.TransitionDurationMain} cubic-bezier(0, 0, 0.2, 1)`,\n animationFillMode: \"forwards\",\n \"@keyframes lineTwo-animate-to-expand\": {\n \"0%\": {\n transform: \"translate3d(-50%, -50%, 0)\",\n },\n \"50%\": {\n transform: \"translate3d(-50%, -50%, 0) rotate(90deg) scaleY(.75)\",\n },\n \"100%\": {\n transform: \"translate3d(-50%, -27%, 0) rotate(45deg) scaleY(.75)\",\n },\n },\n },\n }),\n },\n\n span: {\n position: \"absolute\",\n top: \"50%\",\n left: \"50%\",\n width: \"2px\",\n height: odysseyDesignTokens.Spacing4,\n backgroundColor: odysseyDesignTokens.HueNeutral600,\n transform: \"translate3d(-50%, -50%, 0)\",\n transition: `transform ${odysseyDesignTokens.TransitionDurationMain}`,\n\n ...(toggleContrastColors?.fontColor && {\n backgroundColor: toggleContrastColors.fontColor,\n }),\n },\n}));\n\nexport type SideNavToggleButtonProps = {\n /**\n * The ref forwarded to the Button\n */\n buttonRef?: React.RefObject<FocusHandle>;\n /**\n * The `id` of the item this button controls\n */\n ariaControls: string;\n /**\n * The ID of the Button\n */\n id?: string;\n isSideNavCollapsed: boolean;\n tabIndex?: HTMLAttributes<HTMLElement>[\"tabIndex\"];\n /**\n * The click event handler for the Button\n */\n onClick?: MuiButtonProps[\"onClick\"];\n onKeyDown?: MuiButtonProps[\"onKeyDown\"];\n};\n\nconst SideNavToggleButton = ({\n ariaControls,\n buttonRef,\n id,\n isSideNavCollapsed,\n onClick,\n tabIndex,\n}: SideNavToggleButtonProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const { t } = useTranslation();\n const uiShellContext = useUiShellContext();\n\n const localButtonRef = useRef<HTMLButtonElement | HTMLAnchorElement>(null);\n\n const toggleContrastColors = useMemo(() => {\n const hasNonStandardAppBackgroundColor =\n uiShellContext?.appBackgroundColor &&\n uiShellContext?.appBackgroundColor !==\n odysseyDesignTokens.HueNeutralWhite &&\n uiShellContext?.appBackgroundColor !== odysseyDesignTokens.HueNeutral50;\n\n if (hasNonStandardAppBackgroundColor) {\n return generateContrastColors(\n uiShellContext.appBackgroundColor,\n odysseyDesignTokens,\n );\n }\n\n return undefined;\n }, [odysseyDesignTokens, uiShellContext]);\n\n useImperativeHandle(\n buttonRef,\n () => ({\n focus: () => {\n localButtonRef.current?.focus();\n },\n }),\n [],\n );\n\n const toggleLabel = useMemo(\n () =>\n isSideNavCollapsed\n ? t(\"sidenav.toggle.expand\")\n : t(\"sidenav.toggle.collapse\"),\n [isSideNavCollapsed, t],\n );\n\n const renderButton = useCallback(\n (muiProps: MuiPropsContextType) => {\n return (\n <StyledToggleButton\n {...muiProps}\n aria-controls={ariaControls}\n aria-expanded={!isSideNavCollapsed}\n aria-label={toggleLabel}\n data-se=\"sidenav-toggle-button\"\n data-sidenav-toggle={true}\n id={id}\n isSideNavCollapsed={isSideNavCollapsed}\n odysseyDesignTokens={odysseyDesignTokens}\n onClick={onClick}\n ref={(element) => {\n if (element) {\n (\n localButtonRef as React.MutableRefObject<HTMLButtonElement>\n ).current = element;\n //@ts-expect-error ref is not an optional prop on the props context type\n muiProps?.ref?.(element);\n }\n }}\n tabIndex={tabIndex}\n toggleContrastColors={toggleContrastColors}\n variant=\"floating\"\n >\n <span id=\"lineOne\" />\n <span id=\"lineTwo\" />\n </StyledToggleButton>\n );\n },\n [\n ariaControls,\n id,\n isSideNavCollapsed,\n odysseyDesignTokens,\n onClick,\n tabIndex,\n toggleContrastColors,\n toggleLabel,\n ],\n );\n\n return (\n <Tooltip ariaType=\"description\" placement=\"right\" text={toggleLabel}>\n <MuiPropsContext.Consumer>{renderButton}</MuiPropsContext.Consumer>\n </Tooltip>\n );\n};\n\nconst MemoizedSideNavToggleButton = memo(SideNavToggleButton);\nMemoizedSideNavToggleButton.displayName = \"SideNavToggleButton\";\n\nexport { MemoizedSideNavToggleButton as SideNavToggleButton };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA,SAEEA,IAAI,EACJC,WAAW,EACXC,mBAAmB,EACnBC,OAAO,EACPC,MAAM,QACD,OAAO;AACd,OAAOC,MAAM,MAAM,iBAAiB;AACpC,SAASC,cAAc,QAAQ,eAAe;AAE9C,SAEEC,sBAAsB,QACjB,+BAA+B;AAEtC,SAASC,eAAe,QAA6B,0BAA0B;AAC/E,SAEEC,sBAAsB,QACjB,qCAAqC;AAC5C,SAASC,OAAO,QAAQ,kBAAkB;AAC1C,SAASC,iBAAiB,QAAQ,mCAAmC;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEtE,MAAMC,kBAAkB,GAAGX,MAAM,CAAAY,OAAA,EAAY;EAC3CC,iBAAiB,EAAGC,IAAI,IACtBA,IAAI,KAAK,qBAAqB,IAC9BA,IAAI,KAAK,oBAAoB,IAC7BA,IAAI,KAAK;AACb,CAAC,CAA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AS,CAAE,CAAC,EACrBlC,IAAA;QAAMkC,EAAE,EAAC;MAAS,CAAE,CAAC;IAAA,CACH,CAAC;EAEzB,CAAC,EACD,CACEF,YAAY,EACZE,EAAE,EACF3B,kBAAkB,EAClBC,mBAAmB,EACnB2B,OAAO,EACPC,QAAQ,EACR3B,oBAAoB,EACpBsC,WAAW,CAEf,CAAC;EAED,OACE/C,IAAA,CAACH,OAAO;IAACyD,QAAQ,EAAC,aAAa;IAACC,SAAS,EAAC,OAAO;IAACC,IAAI,EAAET,WAAY;IAAAM,QAAA,EAClErD,IAAA,CAACL,eAAe,CAAC8D,QAAQ;MAAAJ,QAAA,EAAEL;IAAY,CAA2B;EAAC,CAC5D,CAAC;AAEd,CAAC;AAED,MAAMU,2BAA2B,GAAGvE,IAAI,CAAC4C,mBAAmB,CAAC;AAC7D2B,2BAA2B,CAACC,WAAW,GAAG,qBAAqB;AAE/D,SAASD,2BAA2B,IAAI3B,mBAAmB","ignoreList":[]}
1
+ {"version":3,"file":"SideNavToggleButton.js","names":["memo","useCallback","useImperativeHandle","useMemo","useRef","styled","useTranslation","generateContrastColors","MuiPropsContext","useOdysseyDesignTokens","Tooltip","useUiShellContext","jsx","_jsx","jsxs","_jsxs","StyledToggleButton","_Button","shouldForwardProp","prop","isSideNavCollapsed","odysseyDesignTokens","toggleContrastColors","backgroundColor","position","width","Spacing6","height","border","zIndex","boxShadow","PalettePrimaryMain","outline","animation","TransitionDurationMain","animationFillMode","transform","span","top","left","Spacing4","HueNeutral600","transition","fontColor","SideNavToggleButton","ariaControls","buttonRef","id","onClick","tabIndex","t","uiShellContext","localButtonRef","hasNonStandardAppBackgroundColor","appBackgroundColor","HueNeutralWhite","HueNeutral50","undefined","focus","current","toggleLabel","renderButton","muiProps","ref","element","variant","children","ariaType","placement","text","Consumer","MemoizedSideNavToggleButton","displayName"],"sources":["../../../../src/ui-shell/SideNav/SideNavToggleButton.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { Button as MuiButton } from \"@mui/material\";\nimport type { ButtonProps as MuiButtonProps } from \"@mui/material\";\nimport {\n HTMLAttributes,\n memo,\n useCallback,\n useImperativeHandle,\n useMemo,\n useRef,\n} from \"react\";\nimport styled from \"@emotion/styled\";\nimport { useTranslation } from \"react-i18next\";\n\nimport {\n ContrastColors,\n generateContrastColors,\n} from \"../../createContrastColors.js\";\nimport { FocusHandle } from \"../../inputUtils.js\";\nimport { MuiPropsContext, MuiPropsContextType } from \"../../MuiPropsContext.js\";\nimport {\n DesignTokens,\n useOdysseyDesignTokens,\n} from \"../../OdysseyDesignTokensContext.js\";\nimport { Tooltip } from \"../../Tooltip.js\";\nimport { useUiShellContext } from \"../../ui-shell/UiShellProvider.js\";\n\nconst StyledToggleButton = styled(MuiButton, {\n shouldForwardProp: (prop) =>\n prop !== \"odysseyDesignTokens\" &&\n prop !== \"isSideNavCollapsed\" &&\n prop !== \"toggleContrastColors\",\n})<{\n isSideNavCollapsed: boolean;\n odysseyDesignTokens: DesignTokens;\n toggleContrastColors?: ContrastColors;\n}>(({ isSideNavCollapsed, odysseyDesignTokens, toggleContrastColors }) => ({\n backgroundColor: \"transparent\",\n position: \"relative\",\n width: odysseyDesignTokens.Spacing6,\n height: odysseyDesignTokens.Spacing6,\n border: 0,\n zIndex: 200,\n\n \"&:focus-visible\": {\n boxShadow: `inset 0 0 0 2px ${odysseyDesignTokens.PalettePrimaryMain}`,\n outline: \"none\",\n },\n\n \"&:hover, &:focus-visible\": {\n backgroundColor: \"transparent\",\n\n \"#lineOne\": {\n animation: `lineOne-animate-to-collapse ${odysseyDesignTokens.TransitionDurationMain} cubic-bezier(0, 0, 0.2, 1)`,\n animationFillMode: \"forwards\",\n \"@keyframes lineOne-animate-to-collapse\": {\n \"0%\": {\n transform: \"translate3d(-50%, -50%, 0)\",\n },\n \"50%\": {\n transform: \"translate3d(-50%, -50%, 0) rotate(-90deg) scaleY(.75)\",\n },\n \"100%\": {\n transform: \"translate3d(-50%, -27%, 0) rotate(-45deg) scaleY(.75)\",\n },\n },\n },\n\n \"#lineTwo\": {\n animation: `lineTwo-animate-to-collapse ${odysseyDesignTokens.TransitionDurationMain} cubic-bezier(0, 0, 0.2, 1)`,\n animationFillMode: \"forwards\",\n \"@keyframes lineTwo-animate-to-collapse\": {\n \"0%\": {\n transform: \"translate3d(-50%, -50%, 0)\",\n },\n \"50%\": {\n transform: \"translate3d(-50%, -50%, 0) rotate(-90deg) scaleY(.75)\",\n },\n \"100%\": {\n transform: \"translate3d(-50%, -73%, 0) rotate(-135deg) scaleY(.75)\",\n },\n },\n },\n\n ...(isSideNavCollapsed && {\n \"#lineOne\": {\n animation: `lineOne-animate-to-expand ${odysseyDesignTokens.TransitionDurationMain} cubic-bezier(0, 0, 0.2, 1)`,\n animationFillMode: \"forwards\",\n \"@keyframes lineOne-animate-to-expand\": {\n \"0%\": {\n transform: \"translate3d(-50%, -50%, 0)\",\n },\n \"50%\": {\n transform: \"translate3d(-50%, -50%, 0) rotate(90deg) scaleY(.75)\",\n },\n \"100%\": {\n transform: \"translate3d(-50%, -73%, 0) rotate(135deg) scaleY(.75)\",\n },\n },\n },\n\n \"#lineTwo\": {\n animation: `lineTwo-animate-to-expand ${odysseyDesignTokens.TransitionDurationMain} cubic-bezier(0, 0, 0.2, 1)`,\n animationFillMode: \"forwards\",\n \"@keyframes lineTwo-animate-to-expand\": {\n \"0%\": {\n transform: \"translate3d(-50%, -50%, 0)\",\n },\n \"50%\": {\n transform: \"translate3d(-50%, -50%, 0) rotate(90deg) scaleY(.75)\",\n },\n \"100%\": {\n transform: \"translate3d(-50%, -27%, 0) rotate(45deg) scaleY(.75)\",\n },\n },\n },\n }),\n },\n\n span: {\n position: \"absolute\",\n top: \"50%\",\n left: \"50%\",\n width: \"2px\",\n height: odysseyDesignTokens.Spacing4,\n backgroundColor: odysseyDesignTokens.HueNeutral600,\n transform: \"translate3d(-50%, -50%, 0)\",\n transition: `transform ${odysseyDesignTokens.TransitionDurationMain}`,\n\n ...(toggleContrastColors?.fontColor && {\n backgroundColor: toggleContrastColors.fontColor,\n }),\n },\n}));\n\nexport type SideNavToggleButtonProps = {\n /**\n * The ref forwarded to the Button\n */\n buttonRef?: React.RefObject<FocusHandle>;\n /**\n * The `id` of the item this button controls\n */\n ariaControls: string;\n /**\n * The ID of the Button\n */\n id?: string;\n isSideNavCollapsed: boolean;\n tabIndex?: HTMLAttributes<HTMLElement>[\"tabIndex\"];\n /**\n * The click event handler for the Button\n */\n onClick?: MuiButtonProps[\"onClick\"];\n onKeyDown?: MuiButtonProps[\"onKeyDown\"];\n};\n\nconst SideNavToggleButton = ({\n ariaControls,\n buttonRef,\n id,\n isSideNavCollapsed,\n onClick,\n tabIndex,\n}: SideNavToggleButtonProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const { t } = useTranslation();\n const uiShellContext = useUiShellContext();\n\n const localButtonRef = useRef<HTMLButtonElement | HTMLAnchorElement>(null);\n\n const toggleContrastColors = useMemo(() => {\n const hasNonStandardAppBackgroundColor =\n uiShellContext?.appBackgroundColor &&\n uiShellContext?.appBackgroundColor !==\n odysseyDesignTokens.HueNeutralWhite &&\n uiShellContext?.appBackgroundColor !== odysseyDesignTokens.HueNeutral50;\n\n if (hasNonStandardAppBackgroundColor) {\n return generateContrastColors(\n uiShellContext.appBackgroundColor,\n odysseyDesignTokens,\n );\n }\n\n return undefined;\n }, [odysseyDesignTokens, uiShellContext]);\n\n useImperativeHandle(\n buttonRef,\n () => ({\n focus: () => {\n localButtonRef.current?.focus();\n },\n }),\n [],\n );\n\n const toggleLabel = useMemo(\n () =>\n isSideNavCollapsed\n ? t(\"sidenav.toggle.expand\")\n : t(\"sidenav.toggle.collapse\"),\n [isSideNavCollapsed, t],\n );\n\n const renderButton = useCallback(\n (muiProps: MuiPropsContextType) => {\n return (\n <StyledToggleButton\n {...muiProps}\n aria-controls={ariaControls}\n aria-expanded={!isSideNavCollapsed}\n aria-label={toggleLabel}\n data-se=\"sidenav-toggle-button\"\n data-sidenav-toggle={true}\n id={id}\n isSideNavCollapsed={isSideNavCollapsed}\n odysseyDesignTokens={odysseyDesignTokens}\n onClick={onClick}\n ref={(element) => {\n if (element) {\n (\n localButtonRef as React.MutableRefObject<HTMLButtonElement>\n ).current = element;\n //@ts-expect-error ref is not an optional prop on the props context type\n muiProps?.ref?.(element);\n }\n }}\n tabIndex={tabIndex}\n toggleContrastColors={toggleContrastColors}\n variant=\"floating\"\n >\n <span id=\"lineOne\" />\n <span id=\"lineTwo\" />\n </StyledToggleButton>\n );\n },\n [\n ariaControls,\n id,\n isSideNavCollapsed,\n odysseyDesignTokens,\n onClick,\n tabIndex,\n toggleContrastColors,\n toggleLabel,\n ],\n );\n\n return (\n <Tooltip ariaType=\"description\" placement=\"right\" text={toggleLabel}>\n <MuiPropsContext.Consumer>{renderButton}</MuiPropsContext.Consumer>\n </Tooltip>\n );\n};\n\nconst MemoizedSideNavToggleButton = memo(SideNavToggleButton);\nMemoizedSideNavToggleButton.displayName = \"SideNavToggleButton\";\n\nexport { MemoizedSideNavToggleButton as SideNavToggleButton };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA,SAEEA,IAAI,EACJC,WAAW,EACXC,mBAAmB,EACnBC,OAAO,EACPC,MAAM,QACD,OAAO;AACd,OAAOC,MAAM,MAAM,iBAAiB;AACpC,SAASC,cAAc,QAAQ,eAAe;AAE9C,SAEEC,sBAAsB,QACjB,+BAA+B;AAEtC,SAASC,eAAe,QAA6B,0BAA0B;AAC/E,S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,mBAAoB;MACzC2B,OAAO,EAAEA,OAAQ;MACjBe,GAAG,EAAGC,OAAO,IAAK;QAChB,IAAIA,OAAO,EAAE;UAETZ,cAAc,CACdO,OAAO,GAAGK,OAAO;UAEnBF,QAAQ,EAAEC,GAAG,GAAGC,OAAO,CAAC;QAC1B;MACF,CAAE;MACFf,QAAQ,EAAEA,QAAS;MACnB3B,oBAAoB,EAAEA,oBAAqB;MAC3C2C,OAAO,EAAC,UAAU;MAAAC,QAAA,GAElBrD,IAAA;QAAMkC,EAAE,EAAC;MAAS,CAAE,CAAC,EACrBlC,IAAA;QAAMkC,EAAE,EAAC;MAAS,CAAE,CAAC;IAAA,CACH,CAAC;EAEzB,CAAC,EACD,CACEF,YAAY,EACZE,EAAE,EACF3B,kBAAkB,EAClBC,mBAAmB,EACnB2B,OAAO,EACPC,QAAQ,EACR3B,oBAAoB,EACpBsC,WAAW,CAEf,CAAC;EAED,OACE/C,IAAA,CAACH,OAAO;IAACyD,QAAQ,EAAC,aAAa;IAACC,SAAS,EAAC,OAAO;IAACC,IAAI,EAAET,WAAY;IAAAM,QAAA,EAClErD,IAAA,CAACL,eAAe,CAAC8D,QAAQ;MAAAJ,QAAA,EAAEL;IAAY,CAA2B;EAAC,CAC5D,CAAC;AAEd,CAAC;AAED,MAAMU,2BAA2B,GAAGvE,IAAI,CAAC4C,mBAAmB,CAAC;AAC7D2B,2BAA2B,CAACC,WAAW,GAAG,qBAAqB;AAE/D,SAASD,2BAA2B,IAAI3B,mBAAmB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../../src/ui-shell/SideNav/types.ts"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport type { ReactElement, SyntheticEvent } from \"react\";\n\nimport type { HtmlProps } from \"../../HtmlProps.js\";\nimport type { statusSeverityValues } from \"../../Status.js\";\nimport { UniqueIdentifier } from \"@dnd-kit/core\";\n\ntype LogoWithLink = {\n href: string;\n ariaLabel: string;\n};\ntype LogoWithNoLink = {\n href?: never;\n ariaLabel?: never;\n};\n\nexport type SideNavLogoProps = { isSameBackgroundAsMain?: boolean } & (\n | LogoWithLink\n | LogoWithNoLink\n) &\n (\n | {\n /**\n * a component to render as the logo\n */\n logoComponent: ReactElement;\n imageAltText?: never;\n imageUrl?: never;\n }\n | {\n /**\n * The src url to render in an `img` tag\n */\n imageUrl: string;\n /**\n * alt text for the img logo\n */\n imageAltText: string;\n logoComponent?: never;\n }\n | {\n /**\n * The src url to render in an `img` tag\n */\n imageUrl?: never;\n /**\n * alt text for the img logo\n */\n imageAltText?: never;\n logoComponent?: never;\n }\n );\n\nexport type SideNavProps = {\n /**\n * Side Nav header text that is usually reserved to show the App name\n */\n appName?: string;\n /**\n * Determines whether the side nav is collapsible\n */\n isCollapsible?: boolean;\n /**\n * Determines whether the side nav is collapsed\n */\n isCollapsed?: boolean;\n /**\n * Determines whether the side nav items use compact layout\n */\n isCompact?: boolean;\n /**\n * Before the side nav has items, it will be in a loading state.\n */\n isLoading?: boolean;\n /**\n * An optional logo component or src string for an img to display in the header. If not provided, will default to the Okta logo\n */\n logoProps?: SideNavLogoProps;\n /**\n * Triggers when the side nav is collapsed\n */\n onCollapse?: () => void;\n /**\n * Triggers when the side nav is expanded\n */\n onExpand?: () => void;\n /**\n * Triggers when the item is reordered\n */\n onSort?: (\n reorderedItems: SideNavItem[],\n parentId: string,\n activeId: UniqueIdentifier,\n activeIndex: number,\n overIndex: number,\n ) => void;\n /**\n * Nav items in the side nav\n */\n sideNavItems: SideNavItem[];\n} & (\n | {\n /**\n * The component to display as the footer; if present the `footerItems` are ignored and not rendered.\n */\n footerComponent?: ReactElement;\n footerItems?: never;\n hasCustomFooter: true;\n }\n | {\n footerComponent?: never;\n /**\n * Footer items in the side nav\n */\n footerItems?: SideNavFooterItem[];\n hasCustomFooter?: false;\n }\n) &\n Pick<HtmlProps, \"testId\">;\n\nexport type SideNavItem = {\n /**\n * The number to display as a count alongside the nav item\n */\n count?: number;\n /**\n * The icon element to display after the nav item text. Only use this with images that don't have React context. Even the official Odyssey Icons use MUI which references the MUI theme in context and will error when rendered in Unified UI Shell.\n */\n endIcon?: ReactElement;\n id: string;\n /**\n * Whether the item is disabled. When set to true the nav item is set to Disabled color,\n * the link/item is not clickable, and item with nestedNavItems is not expandable.\n */\n isDisabled?: boolean;\n /**\n * Whether the item is active/selected\n */\n isSelected?: boolean;\n /**\n * Whether the item is sortable within a sortable list\n */\n isSortable?: boolean;\n label: string;\n /**\n * Event fired when the nav item is clicked\n */\n onClick?: (event: SyntheticEvent) => void;\n /**\n * The status element to display after the label\n */\n severity?: (typeof statusSeverityValues)[number];\n /**\n * The icon element to display before the nav item text. Only use this with images that don't have React context. Even the official Odyssey Icons use MUI which references the MUI theme in context and will error when rendered in Unified UI Shell.\n */\n startIcon?: ReactElement;\n /**\n * The label to display inside the status\n */\n statusLabel?: string;\n /**\n * The link target prop. e.g., \"_blank\"\n */\n target?: string;\n} & (\n | {\n nestedNavItems?: never;\n href?: never;\n isDefaultExpanded?: never;\n isExpanded?: never;\n /**\n * Determines if the side nav item is a section header\n */\n isSectionHeader: true;\n }\n | {\n nestedNavItems?: never;\n /**\n * link added to the nav item. if it is undefined, static text will be displayed.\n * fires onClick event when it is passed\n */\n href?: string;\n isDefaultExpanded?: never;\n isExpanded?: never;\n isSectionHeader?: never;\n }\n | {\n /**\n * An array of side nav items to be displayed as nestedNavItems within Accordion\n */\n nestedNavItems: Array<Omit<SideNavItem, \"nestedNavItems\" | \"startIcon\">>;\n href?: never;\n /**\n * Whether the accordion (nav item with nestedNavItems) is expanded by default\n */\n isDefaultExpanded?: boolean;\n /**\n * If true, expands the accordion, otherwise collapse it.\n * Setting this prop enables control over the accordion.\n */\n isExpanded?: boolean;\n /**\n * If true, enables sorting for the accordion items\n */\n isSectionHeader?: never;\n }\n);\n\nexport type SideNavFooterItem = {\n href?: string;\n id: string;\n label: string;\n};\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../../src/ui-shell/SideNav/types.ts"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport type { ReactElement, SyntheticEvent } from \"react\";\n\nimport type { HtmlProps } from \"../../HtmlProps.js\";\nimport type { statusSeverityValues } from \"../../Status.js\";\nimport { UniqueIdentifier } from \"@dnd-kit/core\";\n\ntype LogoWithLink = {\n href: string;\n ariaLabel: string;\n};\ntype LogoWithNoLink = {\n href?: never;\n ariaLabel?: never;\n};\n\nexport type SideNavLogoProps = {\n isSameBackgroundAsMain?: boolean;\n /**\n * Event fired when the logo is clicked\n */\n onClick?: (event: SyntheticEvent) => void;\n} & (LogoWithLink | LogoWithNoLink) &\n (\n | {\n /**\n * a component to render as the logo\n */\n logoComponent: ReactElement;\n imageAltText?: never;\n imageUrl?: never;\n }\n | {\n /**\n * The src url to render in an `img` tag\n */\n imageUrl: string;\n /**\n * alt text for the img logo\n */\n imageAltText: string;\n logoComponent?: never;\n }\n | {\n /**\n * The src url to render in an `img` tag\n */\n imageUrl?: never;\n /**\n * alt text for the img logo\n */\n imageAltText?: never;\n logoComponent?: never;\n }\n );\n\nexport type SideNavProps = {\n /**\n * Side Nav header text that is usually reserved to show the App name\n */\n appName?: string;\n /**\n * Determines whether the side nav is collapsible\n */\n isCollapsible?: boolean;\n /**\n * Determines whether the side nav is collapsed\n */\n isCollapsed?: boolean;\n /**\n * Determines whether the side nav items use compact layout\n */\n isCompact?: boolean;\n /**\n * Before the side nav has items, it will be in a loading state.\n */\n isLoading?: boolean;\n /**\n * An optional logo component or src string for an img to display in the header. If not provided, will default to the Okta logo\n */\n logoProps?: SideNavLogoProps;\n /**\n * Triggers when the side nav is collapsed\n */\n onCollapse?: () => void;\n /**\n * Triggers when the side nav is expanded\n */\n onExpand?: () => void;\n /**\n * Triggers when the item is reordered\n */\n onSort?: (\n reorderedItems: SideNavItem[],\n parentId: string,\n activeId: UniqueIdentifier,\n activeIndex: number,\n overIndex: number,\n ) => void;\n /**\n * Nav items in the side nav\n */\n sideNavItems: SideNavItem[];\n} & (\n | {\n /**\n * The component to display as the footer; if present the `footerItems` are ignored and not rendered.\n */\n footerComponent?: ReactElement;\n footerItems?: never;\n hasCustomFooter: true;\n }\n | {\n footerComponent?: never;\n /**\n * Footer items in the side nav\n */\n footerItems?: SideNavFooterItem[];\n hasCustomFooter?: false;\n }\n) &\n Pick<HtmlProps, \"testId\">;\n\nexport type SideNavItem = {\n /**\n * The number to display as a count alongside the nav item\n */\n count?: number;\n /**\n * The icon element to display after the nav item text. Only use this with images that don't have React context. Even the official Odyssey Icons use MUI which references the MUI theme in context and will error when rendered in Unified UI Shell.\n */\n endIcon?: ReactElement;\n id: string;\n /**\n * Whether the item is disabled. When set to true the nav item is set to Disabled color,\n * the link/item is not clickable, and item with nestedNavItems is not expandable.\n */\n isDisabled?: boolean;\n /**\n * Whether the item is active/selected\n */\n isSelected?: boolean;\n /**\n * Whether the item is sortable within a sortable list\n */\n isSortable?: boolean;\n label: string;\n /**\n * Event fired when the nav item is clicked\n */\n onClick?: (event: SyntheticEvent) => void;\n /**\n * The status element to display after the label\n */\n severity?: (typeof statusSeverityValues)[number];\n /**\n * The icon element to display before the nav item text. Only use this with images that don't have React context. Even the official Odyssey Icons use MUI which references the MUI theme in context and will error when rendered in Unified UI Shell.\n */\n startIcon?: ReactElement;\n /**\n * The label to display inside the status\n */\n statusLabel?: string;\n /**\n * The link target prop. e.g., \"_blank\"\n */\n target?: string;\n} & (\n | {\n nestedNavItems?: never;\n href?: never;\n isDefaultExpanded?: never;\n isExpanded?: never;\n /**\n * Determines if the side nav item is a section header\n */\n isSectionHeader: true;\n }\n | {\n nestedNavItems?: never;\n /**\n * link added to the nav item. if it is undefined, static text will be displayed.\n * fires onClick event when it is passed\n */\n href?: string;\n isDefaultExpanded?: never;\n isExpanded?: never;\n isSectionHeader?: never;\n }\n | {\n /**\n * An array of side nav items to be displayed as nestedNavItems within Accordion\n */\n nestedNavItems: Array<Omit<SideNavItem, \"nestedNavItems\" | \"startIcon\">>;\n href?: never;\n /**\n * Whether the accordion (nav item with nestedNavItems) is expanded by default\n */\n isDefaultExpanded?: boolean;\n /**\n * If true, expands the accordion, otherwise collapse it.\n * Setting this prop enables control over the accordion.\n */\n isExpanded?: boolean;\n /**\n * If true, enables sorting for the accordion items\n */\n isSectionHeader?: never;\n }\n) &\n Pick<HtmlProps, \"translate\">;\n\nexport type SideNavFooterItem = {\n href?: string;\n id: string;\n label: string;\n};\n"],"mappings":"","ignoreList":[]}
@@ -26,22 +26,22 @@ const fullHeightStyles = {
26
26
  };
27
27
  const emptySideNavItems = [];
28
28
  const StyledAppContainer = styled("div", {
29
- shouldForwardProp: prop => prop !== "odysseyDesignTokens"
29
+ shouldForwardProp: prop => prop !== "appBackgroundColor" && prop !== "odysseyDesignTokens"
30
30
  })(({
31
31
  appBackgroundColor
32
32
  }) => ({
33
33
  gridArea: "app-content",
34
34
  backgroundColor: appBackgroundColor
35
35
  }));
36
- const StyledBannersContainer = styled("div")(() => ({
36
+ const StyledBannersContainer = styled("div")({
37
37
  gridArea: "banners"
38
- }));
39
- const StyledAppSwitcherContainer = styled("div")(() => ({
38
+ });
39
+ const StyledAppSwitcherContainer = styled("div")({
40
40
  gridArea: "app-switcher"
41
- }));
42
- const StyledSideNavContainer = styled("div")(() => ({
41
+ });
42
+ const StyledSideNavContainer = styled("div")({
43
43
  gridArea: "side-nav"
44
- }));
44
+ });
45
45
  const StyledShellContainer = styled("div", {
46
46
  shouldForwardProp: prop => prop !== "odysseyDesignTokens"
47
47
  })(({
@@ -60,20 +60,25 @@ const StyledShellContainer = styled("div", {
60
60
  height: "100vh",
61
61
  width: "100vw"
62
62
  }));
63
- const StyledTopNavContainer = styled("div")(() => ({
63
+ const StyledTopNavContainer = styled("div")({
64
64
  gridArea: "top-nav"
65
- }));
65
+ });
66
66
  export const subComponentNames = ["TopNav", "SideNav", "AppSwitcher"];
67
- const setStylesToMatchElement = (elementToStyle, elementToReference, additionalStyles) => {
68
- const boundingRect = elementToReference.getBoundingClientRect();
69
- elementToStyle.style.setProperty("position", "absolute");
70
- elementToStyle.style.setProperty("top", `${boundingRect.y}px`);
71
- elementToStyle.style.setProperty("left", `${boundingRect.x}px`);
72
- elementToStyle.style.setProperty("width", `${boundingRect.width}px`);
73
- elementToStyle.style.setProperty("height", `${boundingRect.height}px`);
74
- for (const key in additionalStyles) {
75
- elementToStyle.style.setProperty(key, additionalStyles[key]);
76
- }
67
+ export const convertCamelCaseToKebabCase = string => string.replace(/([A-Z])/g, "-$1").toLowerCase();
68
+ export const setStylesToMatchElement = ({
69
+ additionalStyles,
70
+ appContainerElement,
71
+ appContentReferenceElement
72
+ }) => {
73
+ const boundingRect = appContentReferenceElement.getBoundingClientRect();
74
+ appContainerElement.style.setProperty("position", "absolute");
75
+ appContainerElement.style.setProperty("top", `${boundingRect.y}px`);
76
+ appContainerElement.style.setProperty("left", `${boundingRect.x}px`);
77
+ appContainerElement.style.setProperty("width", `${boundingRect.width}px`);
78
+ appContainerElement.style.setProperty("height", `${boundingRect.height}px`);
79
+ Object.entries(additionalStyles).forEach(([cssPropertyName, cssPropertyValue]) => {
80
+ appContainerElement.style.setProperty(convertCamelCaseToKebabCase(cssPropertyName), String(cssPropertyValue));
81
+ });
77
82
  };
78
83
  const UiShellContent = ({
79
84
  appContainerElement,
@@ -94,20 +99,20 @@ const UiShellContent = ({
94
99
  const sideNavContainerRef = useRef(null);
95
100
  const topNavContainerRef = useRef(null);
96
101
  const uiShellContext = useUiShellContext();
97
- const paddingStyles = useMemo(() => ({
102
+ const appContainerElementStyles = useMemo(() => ({
98
103
  ...(hasStandardAppContentPadding ? {
99
- "padding-block": odysseyDesignTokens.Spacing5 ?? null,
100
- "padding-inline": odysseyDesignTokens.Spacing8 ?? null
104
+ paddingBlock: odysseyDesignTokens.Spacing5 ?? null,
105
+ paddingInline: odysseyDesignTokens.Spacing8 ?? null
101
106
  } : {}),
102
107
  ...(appContainerScrollingMode === "horizontal" || appContainerScrollingMode === "both" ? {
103
- "overflow-x": "auto"
108
+ overflowX: "auto"
104
109
  } : {
105
- "overflow-x": "hidden"
110
+ overflowX: "hidden"
106
111
  }),
107
112
  ...(appContainerScrollingMode === "vertical" || appContainerScrollingMode === "both" ? {
108
- "overflow-y": "auto"
113
+ overflowY: "auto"
109
114
  } : {
110
- "overflow-y": "hidden"
115
+ overflowY: "hidden"
111
116
  })
112
117
  }), [hasStandardAppContentPadding, appContainerScrollingMode, odysseyDesignTokens]);
113
118
  useEffect(() => {
@@ -117,23 +122,32 @@ const UiShellContent = ({
117
122
  cancelAnimationFrame(animationFrameId);
118
123
  animationFrameId = requestAnimationFrame(() => {
119
124
  if (appContainerRef.current) {
120
- setStylesToMatchElement(appContainerElement, appContainerRef.current, paddingStyles);
125
+ setStylesToMatchElement({
126
+ additionalStyles: appContainerElementStyles,
127
+ appContentReferenceElement: appContainerRef.current,
128
+ appContainerElement
129
+ });
121
130
  }
122
131
  });
123
132
  };
133
+ const sideNavElement = sideNavContainerRef.current;
134
+ sideNavElement?.addEventListener("transitionend", updateStyles);
124
135
  const observer = new ResizeObserver(updateStyles);
125
136
  observer.observe(appContainerRef.current);
126
- if (sideNavContainerRef.current) {
127
- observer.observe(sideNavContainerRef.current);
137
+ if (sideNavElement) {
138
+ observer.observe(sideNavElement);
128
139
  }
129
140
  if (topNavContainerRef.current) {
130
141
  observer.observe(topNavContainerRef.current);
131
142
  }
132
143
  updateStyles();
133
- return () => observer.disconnect();
144
+ return () => {
145
+ observer.disconnect();
146
+ sideNavElement?.removeEventListener("transitionend", updateStyles);
147
+ };
134
148
  }
135
149
  return () => {};
136
- }, [appContainerRef, appContainerElement, paddingStyles]);
150
+ }, [appContainerElement, appContainerElementStyles, appContainerRef]);
137
151
  return _jsxs(StyledShellContainer, {
138
152
  odysseyDesignTokens: odysseyDesignTokens,
139
153
  children: [_jsx(StyledBannersContainer, {
@@ -1 +1 @@
1
- {"version":3,"file":"UiShellContent.js","names":["styled","memo","useEffect","useMemo","useRef","ErrorBoundary","AppSwitcher","SideNav","TopNav","useOdysseyDesignTokens","useScrollState","useUiShellContext","jsx","_jsx","jsxs","_jsxs","fullHeightStyles","height","emptySideNavItems","StyledAppContainer","shouldForwardProp","prop","appBackgroundColor","gridArea","backgroundColor","StyledBannersContainer","StyledAppSwitcherContainer","StyledSideNavContainer","StyledShellContainer","odysseyDesignTokens","HueNeutral50","display","gridGap","gridTemplateAreas","gridTemplateColumns","gridTemplateRows","width","StyledTopNavContainer","subComponentNames","setStylesToMatchElement","elementToStyle","elementToReference","additionalStyles","boundingRect","getBoundingClientRect","style","setProperty","y","x","key","UiShellContent","appContainerElement","hasStandardAppContentPadding","appContainerScrollingMode","initialVisibleSections","onError","console","error","optionalComponents","appSwitcherProps","sideNavProps","topNavProps","isContentScrolled","scrollableContentRef","appContainerRef","sideNavContainerRef","topNavContainerRef","uiShellContext","paddingStyles","Spacing5","Spacing8","current","animationFrameId","updateStyles","cancelAnimationFrame","requestAnimationFrame","observer","ResizeObserver","observe","disconnect","children","banners","_ScopedCssBaseline","sx","includes","fallback","isLoading","appIcons","selectedAppName","ref","undefined","appName","sideNavItems","hasCustomFooter","sideNavFooter","footerComponent","footerItems","leftSideComponent","topNavLeftSide","rightSideComponent","topNavRightSide","isScrolled","tabIndex","MemoizedUiShellContent","displayName"],"sources":["../../../src/ui-shell/UiShellContent.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport styled from \"@emotion/styled\";\nimport { memo, useEffect, useMemo, useRef, type ReactElement } from \"react\";\nimport { ErrorBoundary, ErrorBoundaryProps } from \"react-error-boundary\";\n\nimport { AppSwitcher, type AppSwitcherProps } from \"./AppSwitcher/index.js\";\nimport { SideNav, type SideNavProps } from \"./SideNav/index.js\";\nimport { TopNav, type TopNavProps } from \"./TopNav/index.js\";\nimport {\n useOdysseyDesignTokens,\n type DesignTokens,\n} from \"../OdysseyDesignTokensContext.js\";\nimport { useScrollState } from \"./useScrollState.js\";\nimport { ContrastMode } from \"../useContrastMode.js\";\nimport { UiShellColors, useUiShellContext } from \"./UiShellProvider.js\";\nimport { ScopedCssBaseline } from \"@mui/material\";\n\nconst fullHeightStyles = { height: \"100%\" };\n\nconst emptySideNavItems = [] satisfies SideNavProps[\"sideNavItems\"];\n\nconst StyledAppContainer = styled(\"div\", {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})<{\n appBackgroundColor?: UiShellColors[\"appBackgroundColor\"];\n}>(({ appBackgroundColor }) => ({\n gridArea: \"app-content\",\n backgroundColor: appBackgroundColor,\n}));\n\nconst StyledBannersContainer = styled(\"div\")(() => ({\n gridArea: \"banners\",\n}));\n\nconst StyledAppSwitcherContainer = styled(\"div\")(() => ({\n gridArea: \"app-switcher\",\n}));\n\nconst StyledSideNavContainer = styled(\"div\")(() => ({\n gridArea: \"side-nav\",\n}));\n\nconst StyledShellContainer = styled(\"div\", {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})<{\n odysseyDesignTokens: DesignTokens;\n}>(({ odysseyDesignTokens }) => ({\n backgroundColor: odysseyDesignTokens.HueNeutral50,\n display: \"grid\",\n gridGap: 0,\n gridTemplateAreas: `\n \"banners banners banners\"\n \"app-switcher side-nav top-nav\"\n \"app-switcher side-nav app-content\"\n `,\n gridTemplateColumns: \"auto auto 1fr\",\n gridTemplateRows: \"auto auto 1fr\",\n height: \"100vh\",\n width: \"100vw\",\n}));\n\nconst StyledTopNavContainer = styled(\"div\")(() => ({\n gridArea: \"top-nav\",\n}));\n\nexport const subComponentNames = [\"TopNav\", \"SideNav\", \"AppSwitcher\"] as const;\nexport type SubComponentName = (typeof subComponentNames)[number];\n\nexport type UiShellNavComponentProps = {\n /**\n * Object that gets pass directly to the app switcher component.\n */\n appSwitcherProps?: AppSwitcherProps;\n /**\n * Object that gets pass directly to the side nav component. If `undefined` and in `initialVisibleSections`, SideNav will be initially rendered. Pass `null` to hide a previously-visible SideNav.\n */\n sideNavProps?: Omit<SideNavProps, \"footerComponent\"> | null;\n /**\n * Object that gets pass directly to the top nav component. If `undefined` and in `initialVisibleSections`, TopNav will be initially rendered. Pass `null` to hide a previously-visible TopNav.\n */\n topNavProps?: Omit<\n TopNavProps,\n \"leftSideComponent\" | \"rightSideComponent\"\n > | null;\n};\n\nexport type UiShellContentProps = {\n /**\n * Sets a custom background color for the app content area.\n */\n appBackgroundColor?: string;\n /**\n * Sets either a gray or white background color for the app content area.\n */\n appBackgroundContrastMode?: ContrastMode;\n /**\n * The element within which the app will be rendered. This will be positioned appropriately while being kept out of the shadow DOM.\n */\n appContainerElement: HTMLDivElement;\n /**\n * Controls the scrolling behavior of the app content area. Defaults to \"vertical\".\n */\n appContainerScrollingMode?: \"none\" | \"horizontal\" | \"vertical\" | \"both\";\n /**\n * defaults to `true`. If `false`, the content area will have no padding provided\n */\n hasStandardAppContentPadding?: boolean;\n /**\n * Which parts of the UI Shell should be visible initially? For example,\n * if sideNavProps is undefined, should the space for the sidenav be initially visible?\n */\n initialVisibleSections?: SubComponentName[];\n /**\n * Notifies when a React rendering error occurs. This could be useful for logging, flagging \"p0\"s, and recovering UI Shell when errors occur.\n */\n onError?: ErrorBoundaryProps[\"onError\"];\n /**\n * Components that will render as children of various other components such as the top nav or side nav.\n */\n optionalComponents?: {\n banners?: ReactElement;\n sideNavFooter?: SideNavProps[\"footerComponent\"];\n topNavLeftSide?: TopNavProps[\"leftSideComponent\"];\n topNavRightSide?: TopNavProps[\"rightSideComponent\"];\n };\n} & UiShellNavComponentProps;\n\nconst setStylesToMatchElement = (\n elementToStyle: HTMLElement,\n elementToReference: HTMLElement,\n additionalStyles: Record<string, string | null>,\n) => {\n const boundingRect = elementToReference.getBoundingClientRect();\n elementToStyle.style.setProperty(\"position\", \"absolute\");\n elementToStyle.style.setProperty(\"top\", `${boundingRect.y}px`);\n elementToStyle.style.setProperty(\"left\", `${boundingRect.x}px`);\n elementToStyle.style.setProperty(\"width\", `${boundingRect.width}px`);\n elementToStyle.style.setProperty(\"height\", `${boundingRect.height}px`);\n for (const key in additionalStyles) {\n elementToStyle.style.setProperty(key, additionalStyles[key]);\n }\n};\n\n/**\n * Our new Unified Platform UI Shell.\n *\n * This includes the top and side navigation as well as the footer and provides a spot for your app to render into.\n *\n * If an error occurs, this will revert to only showing the app.\n */\nconst UiShellContent = ({\n appContainerElement,\n hasStandardAppContentPadding = true,\n appContainerScrollingMode = \"vertical\",\n initialVisibleSections = [\"TopNav\", \"SideNav\", \"AppSwitcher\"],\n onError = console.error,\n optionalComponents,\n appSwitcherProps,\n sideNavProps,\n topNavProps,\n}: UiShellContentProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const { isContentScrolled, scrollableContentRef: appContainerRef } =\n useScrollState(appContainerElement);\n const sideNavContainerRef = useRef<HTMLDivElement>(null);\n const topNavContainerRef = useRef<HTMLDivElement>(null);\n const uiShellContext = useUiShellContext();\n\n const paddingStyles = useMemo<Record<string, string | null>>(\n () => ({\n ...(hasStandardAppContentPadding\n ? {\n \"padding-block\": odysseyDesignTokens.Spacing5 ?? null,\n \"padding-inline\": odysseyDesignTokens.Spacing8 ?? null,\n }\n : {}),\n ...(appContainerScrollingMode === \"horizontal\" ||\n appContainerScrollingMode === \"both\"\n ? {\n \"overflow-x\": \"auto\",\n }\n : {\n \"overflow-x\": \"hidden\",\n }),\n ...(appContainerScrollingMode === \"vertical\" ||\n appContainerScrollingMode === \"both\"\n ? {\n \"overflow-y\": \"auto\",\n }\n : {\n \"overflow-y\": \"hidden\",\n }),\n }),\n [\n hasStandardAppContentPadding,\n appContainerScrollingMode,\n odysseyDesignTokens,\n ],\n );\n\n useEffect(() => {\n // Once appContainerRef is rendered, we can position appContainerElement on top\n if (appContainerRef.current && appContainerElement) {\n let animationFrameId: number;\n\n const updateStyles = () => {\n cancelAnimationFrame(animationFrameId);\n animationFrameId = requestAnimationFrame(() => {\n if (appContainerRef.current) {\n setStylesToMatchElement(\n appContainerElement,\n appContainerRef.current,\n paddingStyles,\n );\n }\n });\n };\n\n // Setup a mutation observer to sync later updates\n const observer = new ResizeObserver(updateStyles);\n observer.observe(appContainerRef.current);\n\n if (sideNavContainerRef.current) {\n observer.observe(sideNavContainerRef.current);\n }\n\n if (topNavContainerRef.current) {\n observer.observe(topNavContainerRef.current);\n }\n\n // Set the initial style\n updateStyles();\n return () => observer.disconnect();\n }\n return () => {};\n }, [appContainerRef, appContainerElement, paddingStyles]);\n\n return (\n <StyledShellContainer odysseyDesignTokens={odysseyDesignTokens}>\n <StyledBannersContainer>\n {optionalComponents?.banners}\n </StyledBannersContainer>\n\n <StyledAppSwitcherContainer>\n <ScopedCssBaseline sx={fullHeightStyles}>\n {\n /* If AppSwitcher should be initially visible and we have not yet received props, render AppSwitcher in the loading state */\n initialVisibleSections?.includes(\"AppSwitcher\") &&\n !appSwitcherProps && (\n <ErrorBoundary fallback={null} onError={onError}>\n <AppSwitcher isLoading appIcons={[]} selectedAppName=\"\" />\n </ErrorBoundary>\n )\n }\n {appSwitcherProps && (\n <ErrorBoundary fallback={null} onError={onError}>\n <AppSwitcher {...appSwitcherProps} />\n </ErrorBoundary>\n )}\n </ScopedCssBaseline>\n </StyledAppSwitcherContainer>\n\n <StyledSideNavContainer ref={sideNavContainerRef}>\n <ScopedCssBaseline sx={fullHeightStyles}>\n {\n /* If SideNav should be initially visible and we have not yet received props, render SideNav with minimal inputs */\n initialVisibleSections?.includes(\"SideNav\") &&\n sideNavProps === undefined && (\n <ErrorBoundary fallback={null} onError={onError}>\n <SideNav\n isLoading\n appName=\"\"\n sideNavItems={emptySideNavItems}\n />\n </ErrorBoundary>\n )\n }\n {sideNavProps && (\n <ErrorBoundary fallback={null} onError={onError}>\n <SideNav\n {...{\n ...sideNavProps,\n ...(sideNavProps.hasCustomFooter &&\n optionalComponents?.sideNavFooter\n ? {\n footerComponent: optionalComponents.sideNavFooter,\n footerItems: undefined,\n hasCustomFooter: sideNavProps.hasCustomFooter,\n }\n : {\n footerItems: sideNavProps.footerItems,\n hasCustomFooter: false,\n }),\n }}\n />\n </ErrorBoundary>\n )}\n </ScopedCssBaseline>\n </StyledSideNavContainer>\n <StyledTopNavContainer ref={topNavContainerRef}>\n <ScopedCssBaseline sx={fullHeightStyles}>\n {\n /* If TopNav should be initially visible and we have not yet received props, render Topnav with minimal inputs */\n initialVisibleSections?.includes(\"TopNav\") &&\n topNavProps === undefined && (\n <ErrorBoundary fallback={null} onError={onError}>\n <TopNav\n leftSideComponent={optionalComponents?.topNavLeftSide}\n rightSideComponent={optionalComponents?.topNavRightSide}\n />\n </ErrorBoundary>\n )\n }\n {topNavProps && (\n <ErrorBoundary fallback={null} onError={onError}>\n <TopNav\n {...topNavProps}\n isScrolled={isContentScrolled}\n leftSideComponent={optionalComponents?.topNavLeftSide}\n rightSideComponent={optionalComponents?.topNavRightSide}\n />\n </ErrorBoundary>\n )}\n </ScopedCssBaseline>\n </StyledTopNavContainer>\n\n <StyledAppContainer\n appBackgroundColor={uiShellContext?.appBackgroundColor}\n tabIndex={0}\n ref={appContainerRef}\n />\n </StyledShellContainer>\n );\n};\n\nconst MemoizedUiShellContent = memo(UiShellContent);\nMemoizedUiShellContent.displayName = \"UiShellContent\";\n\nexport { MemoizedUiShellContent as UiShellContent };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,MAAM,MAAM,iBAAiB;AACpC,SAASC,IAAI,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAA2B,OAAO;AAC3E,SAASC,aAAa,QAA4B,sBAAsB;AAExE,SAASC,WAAW,QAA+B,wBAAwB;AAC3E,SAASC,OAAO,QAA2B,oBAAoB;AAC/D,SAASC,MAAM,QAA0B,mBAAmB;AAC5D,SACEC,sBAAsB,QAEjB,kCAAkC;AACzC,SAASC,cAAc,QAAQ,qBAAqB;AAEpD,SAAwBC,iBAAiB,QAAQ,sBAAsB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAGxE,MAAMC,gBAAgB,GAAG;EAAEC,MAAM,EAAE;AAAO,CAAC;AAE3C,MAAMC,iBAAiB,GAAG,EAAyC;AAEnE,MAAMC,kBAAkB,GAAGnB,MAAM,CAAC,KAAK,EAAE;EACvCoB,iBAAiB,EAAGC,IAAI,IAAKA,IAAI,KAAK;AACxC,CAAC,CAAC,CAEC,CAAC;EAAEC;AAAmB,CAAC,MAAM;EAC9BC,QAAQ,EAAE,aAAa;EACvBC,eAAe,EAAEF;AACnB,CAAC,CAAC,CAAC;AAEH,MAAMG,sBAAsB,GAAGzB,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO;EAClDuB,QAAQ,EAAE;AACZ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,EAExBvF,IAAA,CAACM,kBAAkB;MACjBG,kBAAkB,EAAE6C,cAAc,EAAE7C,kBAAmB;MACvDgF,QAAQ,EAAE,CAAE;MACZb,GAAG,EAAEzB;IAAgB,CACtB,CAAC;EAAA,CACkB,CAAC;AAE3B,CAAC;AAED,MAAMuC,sBAAsB,GAAGtG,IAAI,CAACiD,cAAc,CAAC;AACnDqD,sBAAsB,CAACC,WAAW,GAAG,gBAAgB;AAErD,SAASD,sBAAsB,IAAIrD,cAAc","ignoreList":[]}
1
+ {"version":3,"file":"UiShellContent.js","names":["styled","memo","useEffect","useMemo","useRef","ErrorBoundary","AppSwitcher","SideNav","TopNav","useOdysseyDesignTokens","useScrollState","useUiShellContext","jsx","_jsx","jsxs","_jsxs","fullHeightStyles","height","emptySideNavItems","StyledAppContainer","shouldForwardProp","prop","appBackgroundColor","gridArea","backgroundColor","StyledBannersContainer","StyledAppSwitcherContainer","StyledSideNavContainer","StyledShellContainer","odysseyDesignTokens","HueNeutral50","display","gridGap","gridTemplateAreas","gridTemplateColumns","gridTemplateRows","width","StyledTopNavContainer","subComponentNames","convertCamelCaseToKebabCase","string","replace","toLowerCase","setStylesToMatchElement","additionalStyles","appContainerElement","appContentReferenceElement","boundingRect","getBoundingClientRect","style","setProperty","y","x","Object","entries","forEach","cssPropertyName","cssPropertyValue","String","UiShellContent","hasStandardAppContentPadding","appContainerScrollingMode","initialVisibleSections","onError","console","error","optionalComponents","appSwitcherProps","sideNavProps","topNavProps","isContentScrolled","scrollableContentRef","appContainerRef","sideNavContainerRef","topNavContainerRef","uiShellContext","appContainerElementStyles","paddingBlock","Spacing5","paddingInline","Spacing8","overflowX","overflowY","current","animationFrameId","updateStyles","cancelAnimationFrame","requestAnimationFrame","sideNavElement","addEventListener","observer","ResizeObserver","observe","disconnect","removeEventListener","children","banners","_ScopedCssBaseline","sx","includes","fallback","isLoading","appIcons","selectedAppName","ref","undefined","appName","sideNavItems","hasCustomFooter","sideNavFooter","footerComponent","footerItems","leftSideComponent","topNavLeftSide","rightSideComponent","topNavRightSide","isScrolled","tabIndex","MemoizedUiShellContent","displayName"],"sources":["../../../src/ui-shell/UiShellContent.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport styled from \"@emotion/styled\";\nimport {\n CSSProperties,\n memo,\n useEffect,\n useMemo,\n useRef,\n type ReactElement,\n} from \"react\";\nimport { ErrorBoundary, ErrorBoundaryProps } from \"react-error-boundary\";\n\nimport { AppSwitcher, type AppSwitcherProps } from \"./AppSwitcher/index.js\";\nimport { SideNav, type SideNavProps } from \"./SideNav/index.js\";\nimport { TopNav, type TopNavProps } from \"./TopNav/index.js\";\nimport {\n useOdysseyDesignTokens,\n type DesignTokens,\n} from \"../OdysseyDesignTokensContext.js\";\nimport { useScrollState } from \"./useScrollState.js\";\nimport { ContrastMode } from \"../useContrastMode.js\";\nimport { UiShellColors, useUiShellContext } from \"./UiShellProvider.js\";\nimport { ScopedCssBaseline } from \"@mui/material\";\n\nconst fullHeightStyles = { height: \"100%\" };\n\nconst emptySideNavItems = [] satisfies SideNavProps[\"sideNavItems\"];\n\nconst StyledAppContainer = styled(\"div\", {\n shouldForwardProp: (prop) =>\n prop !== \"appBackgroundColor\" && prop !== \"odysseyDesignTokens\",\n})<{\n appBackgroundColor?: UiShellColors[\"appBackgroundColor\"];\n}>(({ appBackgroundColor }) => ({\n gridArea: \"app-content\",\n backgroundColor: appBackgroundColor,\n}));\n\nconst StyledBannersContainer = styled(\"div\")({\n gridArea: \"banners\",\n});\n\nconst StyledAppSwitcherContainer = styled(\"div\")({\n gridArea: \"app-switcher\",\n});\n\nconst StyledSideNavContainer = styled(\"div\")({\n gridArea: \"side-nav\",\n});\n\nconst StyledShellContainer = styled(\"div\", {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})<{\n odysseyDesignTokens: DesignTokens;\n}>(({ odysseyDesignTokens }) => ({\n backgroundColor: odysseyDesignTokens.HueNeutral50,\n display: \"grid\",\n gridGap: 0,\n gridTemplateAreas: `\n \"banners banners banners\"\n \"app-switcher side-nav top-nav\"\n \"app-switcher side-nav app-content\"\n `,\n gridTemplateColumns: \"auto auto 1fr\",\n gridTemplateRows: \"auto auto 1fr\",\n height: \"100vh\",\n width: \"100vw\",\n}));\n\nconst StyledTopNavContainer = styled(\"div\")({\n gridArea: \"top-nav\",\n});\n\nexport const subComponentNames = [\"TopNav\", \"SideNav\", \"AppSwitcher\"] as const;\nexport type SubComponentName = (typeof subComponentNames)[number];\n\nexport type UiShellNavComponentProps = {\n /**\n * Object that gets pass directly to the app switcher component.\n */\n appSwitcherProps?: AppSwitcherProps;\n /**\n * Object that gets pass directly to the side nav component. If `undefined` and in `initialVisibleSections`, SideNav will be initially rendered. Pass `null` to hide a previously-visible SideNav.\n */\n sideNavProps?: Omit<SideNavProps, \"footerComponent\"> | null;\n /**\n * Object that gets pass directly to the top nav component. If `undefined` and in `initialVisibleSections`, TopNav will be initially rendered. Pass `null` to hide a previously-visible TopNav.\n */\n topNavProps?: Omit<\n TopNavProps,\n \"leftSideComponent\" | \"rightSideComponent\"\n > | null;\n};\n\nexport type UiShellContentProps = {\n /**\n * Sets a custom background color for the app content area.\n */\n appBackgroundColor?: string;\n /**\n * Sets either a gray or white background color for the app content area.\n */\n appBackgroundContrastMode?: ContrastMode;\n /**\n * When passed, the app is expected to render into this element, not the Shadow DOM. UI Shell will position this element appropriately as if it was rendered in the app content area of the Shadow DOM.\n */\n appContainerElement: HTMLDivElement;\n /**\n * Controls the scrolling behavior of the app content area. Defaults to \"vertical\".\n */\n appContainerScrollingMode?: \"none\" | \"horizontal\" | \"vertical\" | \"both\";\n /**\n * defaults to `true`. If `false`, the content area will have no padding provided\n */\n hasStandardAppContentPadding?: boolean;\n /**\n * Which parts of the UI Shell should be visible initially? For example,\n * if sideNavProps is undefined, should the space for the sidenav be initially visible?\n */\n initialVisibleSections?: SubComponentName[];\n /**\n * Notifies when a React rendering error occurs. This could be useful for logging, flagging \"p0\"s, and recovering UI Shell when errors occur.\n */\n onError?: ErrorBoundaryProps[\"onError\"];\n /**\n * Components that will render as children of various other components such as the top nav or side nav.\n */\n optionalComponents?: {\n banners?: ReactElement;\n sideNavFooter?: SideNavProps[\"footerComponent\"];\n topNavLeftSide?: TopNavProps[\"leftSideComponent\"];\n topNavRightSide?: TopNavProps[\"rightSideComponent\"];\n };\n} & UiShellNavComponentProps;\n\nexport const convertCamelCaseToKebabCase = (string: string) =>\n string.replace(/([A-Z])/g, \"-$1\").toLowerCase();\n\nexport const setStylesToMatchElement = ({\n additionalStyles,\n appContainerElement,\n appContentReferenceElement,\n}: {\n additionalStyles: CSSProperties;\n appContainerElement: HTMLElement;\n appContentReferenceElement: HTMLElement;\n}) => {\n const boundingRect = appContentReferenceElement.getBoundingClientRect();\n\n appContainerElement.style.setProperty(\"position\", \"absolute\");\n appContainerElement.style.setProperty(\"top\", `${boundingRect.y}px`);\n appContainerElement.style.setProperty(\"left\", `${boundingRect.x}px`);\n appContainerElement.style.setProperty(\"width\", `${boundingRect.width}px`);\n appContainerElement.style.setProperty(\"height\", `${boundingRect.height}px`);\n\n (\n Object.entries(additionalStyles) as Array<\n [\n keyof typeof additionalStyles,\n (typeof additionalStyles)[keyof typeof additionalStyles],\n ]\n >\n ).forEach(([cssPropertyName, cssPropertyValue]) => {\n appContainerElement.style.setProperty(\n convertCamelCaseToKebabCase(cssPropertyName),\n String(cssPropertyValue),\n );\n });\n};\n\n/**\n * Our new Unified Platform UI Shell.\n *\n * This includes the top and side navigation as well as the footer and provides a spot for your app to render into.\n *\n * If an error occurs, this will revert to only showing the app.\n */\nconst UiShellContent = ({\n appContainerElement,\n hasStandardAppContentPadding = true,\n appContainerScrollingMode = \"vertical\",\n initialVisibleSections = [\"TopNav\", \"SideNav\", \"AppSwitcher\"],\n onError = console.error,\n optionalComponents,\n appSwitcherProps,\n sideNavProps,\n topNavProps,\n}: UiShellContentProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const { isContentScrolled, scrollableContentRef: appContainerRef } =\n useScrollState(appContainerElement);\n const sideNavContainerRef = useRef<HTMLDivElement>(null);\n const topNavContainerRef = useRef<HTMLDivElement>(null);\n const uiShellContext = useUiShellContext();\n\n const appContainerElementStyles = useMemo<CSSProperties>(\n () => ({\n ...(hasStandardAppContentPadding\n ? {\n paddingBlock: odysseyDesignTokens.Spacing5 ?? null,\n paddingInline: odysseyDesignTokens.Spacing8 ?? null,\n }\n : {}),\n ...(appContainerScrollingMode === \"horizontal\" ||\n appContainerScrollingMode === \"both\"\n ? {\n overflowX: \"auto\",\n }\n : {\n overflowX: \"hidden\",\n }),\n ...(appContainerScrollingMode === \"vertical\" ||\n appContainerScrollingMode === \"both\"\n ? {\n overflowY: \"auto\",\n }\n : {\n overflowY: \"hidden\",\n }),\n }),\n [\n hasStandardAppContentPadding,\n appContainerScrollingMode,\n odysseyDesignTokens,\n ],\n );\n\n useEffect(() => {\n // Once appContainerRef is rendered, we can position appContainerElement on top\n if (appContainerRef.current && appContainerElement) {\n let animationFrameId: number;\n\n const updateStyles = () => {\n cancelAnimationFrame(animationFrameId);\n animationFrameId = requestAnimationFrame(() => {\n if (appContainerRef.current) {\n setStylesToMatchElement({\n additionalStyles: appContainerElementStyles,\n appContentReferenceElement: appContainerRef.current,\n appContainerElement,\n });\n }\n });\n };\n\n // This element might have changed from `.current`, so it's important to keep track of the old one when we attach event listeners.\n const sideNavElement = sideNavContainerRef.current;\n\n sideNavElement?.addEventListener(\"transitionend\", updateStyles);\n\n // Setup a mutation observer to sync later updates\n const observer = new ResizeObserver(updateStyles);\n observer.observe(appContainerRef.current);\n\n if (sideNavElement) {\n observer.observe(sideNavElement);\n }\n\n if (topNavContainerRef.current) {\n observer.observe(topNavContainerRef.current);\n }\n\n // Set the initial styles\n updateStyles();\n\n return () => {\n observer.disconnect();\n sideNavElement?.removeEventListener(\"transitionend\", updateStyles);\n };\n }\n return () => {};\n }, [appContainerElement, appContainerElementStyles, appContainerRef]);\n\n return (\n <StyledShellContainer odysseyDesignTokens={odysseyDesignTokens}>\n <StyledBannersContainer>\n {optionalComponents?.banners}\n </StyledBannersContainer>\n\n <StyledAppSwitcherContainer>\n <ScopedCssBaseline sx={fullHeightStyles}>\n {\n /* If AppSwitcher should be initially visible and we have not yet received props, render AppSwitcher in the loading state */\n initialVisibleSections?.includes(\"AppSwitcher\") &&\n !appSwitcherProps && (\n <ErrorBoundary fallback={null} onError={onError}>\n <AppSwitcher isLoading appIcons={[]} selectedAppName=\"\" />\n </ErrorBoundary>\n )\n }\n {appSwitcherProps && (\n <ErrorBoundary fallback={null} onError={onError}>\n <AppSwitcher {...appSwitcherProps} />\n </ErrorBoundary>\n )}\n </ScopedCssBaseline>\n </StyledAppSwitcherContainer>\n\n <StyledSideNavContainer ref={sideNavContainerRef}>\n <ScopedCssBaseline sx={fullHeightStyles}>\n {\n /* If SideNav should be initially visible and we have not yet received props, render SideNav with minimal inputs */\n initialVisibleSections?.includes(\"SideNav\") &&\n sideNavProps === undefined && (\n <ErrorBoundary fallback={null} onError={onError}>\n <SideNav\n isLoading\n appName=\"\"\n sideNavItems={emptySideNavItems}\n />\n </ErrorBoundary>\n )\n }\n {sideNavProps && (\n <ErrorBoundary fallback={null} onError={onError}>\n <SideNav\n {...{\n ...sideNavProps,\n ...(sideNavProps.hasCustomFooter &&\n optionalComponents?.sideNavFooter\n ? {\n footerComponent: optionalComponents.sideNavFooter,\n footerItems: undefined,\n hasCustomFooter: sideNavProps.hasCustomFooter,\n }\n : {\n footerItems: sideNavProps.footerItems,\n hasCustomFooter: false,\n }),\n }}\n />\n </ErrorBoundary>\n )}\n </ScopedCssBaseline>\n </StyledSideNavContainer>\n <StyledTopNavContainer ref={topNavContainerRef}>\n <ScopedCssBaseline sx={fullHeightStyles}>\n {\n /* If TopNav should be initially visible and we have not yet received props, render Topnav with minimal inputs */\n initialVisibleSections?.includes(\"TopNav\") &&\n topNavProps === undefined && (\n <ErrorBoundary fallback={null} onError={onError}>\n <TopNav\n leftSideComponent={optionalComponents?.topNavLeftSide}\n rightSideComponent={optionalComponents?.topNavRightSide}\n />\n </ErrorBoundary>\n )\n }\n {topNavProps && (\n <ErrorBoundary fallback={null} onError={onError}>\n <TopNav\n {...topNavProps}\n isScrolled={isContentScrolled}\n leftSideComponent={optionalComponents?.topNavLeftSide}\n rightSideComponent={optionalComponents?.topNavRightSide}\n />\n </ErrorBoundary>\n )}\n </ScopedCssBaseline>\n </StyledTopNavContainer>\n\n <StyledAppContainer\n appBackgroundColor={uiShellContext?.appBackgroundColor}\n tabIndex={0}\n ref={appContainerRef}\n />\n </StyledShellContainer>\n );\n};\n\nconst MemoizedUiShellContent = memo(UiShellContent);\nMemoizedUiShellContent.displayName = \"UiShellContent\";\n\nexport { MemoizedUiShellContent as UiShellContent };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,MAAM,MAAM,iBAAiB;AACpC,SAEEC,IAAI,EACJC,SAAS,EACTC,OAAO,EACPC,MAAM,QAED,OAAO;AACd,SAASC,aAAa,QAA4B,sBAAsB;AAExE,SAASC,WAAW,QAA+B,wBAAwB;AAC3E,SAASC,OAAO,QAA2B,oBAAoB;AAC/D,SAASC,MAAM,QAA0B,mBAAmB;AAC5D,SACEC,sBAAsB,QAEjB,kCAAkC;AACzC,SAASC,cAAc,QAAQ,qBAAqB;AAEpD,SAAwBC,iBAAiB,QAAQ,sBAAsB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAGxE,MA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HasUiShell.js";
18
18
  export * from "../web-component/renderReactInWebComponent.js";
19
19
  export { UiShell } from "./UiShell.js";
20
+ export { UiShellContent } from "./UiShellContent.js";
20
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["UiShell"],"sources":["../../../src/ui-shell/index.ts"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nexport * from \"./AppSwitcher/index.js\";\nexport * from \"./renderUiShell.js\";\nexport * from \"./SideNav/index.js\";\nexport * from \"./TopNav/index.js\";\nexport * from \"./useHasUiShell.js\";\nexport * from \"../web-component/renderReactInWebComponent.js\"; // This is located here because some teams use React v17, and this uses React v18's `ReactDOM/client` import which isn't in older versions.\n\nexport { UiShell, type UiShellProps } from \"./UiShell.js\";\nexport { type UiShellNavComponentProps } from \"./UiShellContent.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,wBAAwB;AACtC,cAAc,oBAAoB;AAClC,cAAc,oBAAoB;AAClC,cAAc,mBAAmB;AACjC,cAAc,oBAAoB;AAClC,cAAc,+CAA+C;AAE7D,SAASA,OAAO,QAA2B,cAAc","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["UiShell","UiShellContent"],"sources":["../../../src/ui-shell/index.ts"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nexport * from \"./AppSwitcher/index.js\";\nexport * from \"./renderUiShell.js\";\nexport * from \"./SideNav/index.js\";\nexport * from \"./TopNav/index.js\";\nexport * from \"./useHasUiShell.js\";\nexport * from \"../web-component/renderReactInWebComponent.js\"; // This is located here because some teams use React v17, and this uses React v18's `ReactDOM/client` import which isn't in older versions.\n\nexport { UiShell, type UiShellProps } from \"./UiShell.js\";\nexport {\n UiShellContent,\n type UiShellNavComponentProps,\n} from \"./UiShellContent.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,wBAAwB;AACtC,cAAc,oBAAoB;AAClC,cAAc,oBAAoB;AAClC,cAAc,mBAAmB;AACjC,cAAc,oBAAoB;AAClC,cAAc,+CAA+C;AAE7D,SAASA,OAAO,QAA2B,cAAc;AACzD,SACEC,cAAc,QAET,qBAAqB","ignoreList":[]}
@@ -10,7 +10,7 @@
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import { createContext, useContext, useRef, useLayoutEffect, useState, useCallback } from "react";
13
+ import { createContext, useCallback, useContext, useEffect, useRef, useState } from "react";
14
14
  import * as Tokens from "@okta/odyssey-design-tokens";
15
15
  import { hexToRgb } from "./hexToRgb.js";
16
16
  export const ContrastModeContext = createContext({
@@ -56,7 +56,7 @@ export const useContrastMode = ({
56
56
  setContrastMode(newBgColor === Tokens.HueNeutral50 ? "highContrast" : "lowContrast");
57
57
  }
58
58
  }, [explicitContrastMode]);
59
- useLayoutEffect(() => {
59
+ useEffect(() => {
60
60
  const observer = new MutationObserver(updateBackgroundColor);
61
61
  observer.observe(document.querySelector("html"), {
62
62
  attributes: true,
@@ -1 +1 @@
1
- {"version":3,"file":"useContrastMode.js","names":["createContext","useContext","useRef","useLayoutEffect","useState","useCallback","Tokens","hexToRgb","ContrastModeContext","contrastMode","defaultContrast","useContrastModeContext","hueNeutral50Rgb","HueNeutral50","asFormattedString","isTransparentColor","color","normalizeRgbaToRgb","rgba","replace","getElementComputedBackgroundColor","element","window","getComputedStyle","backgroundColor","normalizeBackgroundColor","bgColor","test","normalizedColor","defaultParentBackgroundColor","getBackgroundColor","parentElement","useContrastMode","explicitContrastMode","contrastContainerRef","existingContrastMode","parentBackgroundColor","setParentBackgroundColor","setContrastMode","updateBackgroundColor","newBgColor","current","observer","MutationObserver","observe","document","querySelector","attributes","attributeFilter","head","childList","subtree","onTransitionEnd","event","propertyName","addEventListener","removeEventListener","disconnect"],"sources":["../../src/useContrastMode.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport {\n createContext,\n useContext,\n useRef,\n useLayoutEffect,\n useState,\n useCallback,\n} from \"react\";\nimport * as Tokens from \"@okta/odyssey-design-tokens\";\n\nimport { hexToRgb } from \"./hexToRgb.js\";\n\nexport type ContrastMode = \"lowContrast\" | \"highContrast\";\nexport type ContrastModeContextType = {\n contrastMode: ContrastMode;\n};\n\nexport const ContrastModeContext = createContext<ContrastModeContextType>({\n contrastMode: \"lowContrast\",\n});\n\nexport const defaultContrast = \"lowContrast\";\n\nexport const useContrastModeContext = () => useContext(ContrastModeContext);\n\nexport const hueNeutral50Rgb = hexToRgb(Tokens.HueNeutral50).asFormattedString;\n\nexport const isTransparentColor = (color: string) =>\n color === \"rgba(0, 0, 0, 0)\" || color === \"transparent\";\n\nexport const normalizeRgbaToRgb = (rgba: string) =>\n rgba.replace(/rgba\\((\\d+),\\s*(\\d+),\\s*(\\d+),\\s*[\\d.]+\\)/, \"rgb($1, $2, $3)\");\n\nexport const getElementComputedBackgroundColor = (\n element: HTMLElement,\n): string => window.getComputedStyle(element).backgroundColor;\n\nexport const normalizeBackgroundColor = (bgColor: string): string => {\n if (/rgba\\((\\d+),\\s*(\\d+),\\s*(\\d+),\\s*[\\d.]+\\)/.test(bgColor)) {\n const normalizedColor = normalizeRgbaToRgb(bgColor);\n return normalizedColor === hueNeutral50Rgb\n ? Tokens.HueNeutral50\n : normalizedColor;\n }\n\n return bgColor === hueNeutral50Rgb ? Tokens.HueNeutral50 : bgColor;\n};\n\nexport const defaultParentBackgroundColor = \"#ffffff\";\n\n/**\n * Determines the effective background color of an element.\n *\n * @param element - The HTML element to check.\n * @returns The effective background color. Returns defaultParentBackgroundColor if no non-transparent background is found.\n *\n * Note:\n * - Low contrast mode is used for white background (defaultParentBackgroundColor or HueNeutralWhite).\n * - High contrast mode is used for gray background (#f4f4f4 or HueNeutral50).\n */\nexport const getBackgroundColor = (element: HTMLElement | null): string => {\n while (element) {\n const bgColor = getElementComputedBackgroundColor(element);\n if (!isTransparentColor(bgColor)) {\n return normalizeBackgroundColor(bgColor);\n }\n element = element.parentElement;\n }\n return defaultParentBackgroundColor; // Default to white/low contrast if no background color is found\n};\n\ntype UseContrastModeProps = {\n contrastMode?: ContrastMode;\n};\n\nexport const useContrastMode = ({\n contrastMode: explicitContrastMode,\n}: UseContrastModeProps) => {\n const contrastContainerRef = useRef<HTMLDivElement>(null);\n const { contrastMode: existingContrastMode } = useContrastModeContext();\n\n const [parentBackgroundColor, setParentBackgroundColor] = useState(\n defaultParentBackgroundColor,\n );\n const [contrastMode, setContrastMode] = useState<ContrastMode>(\n () => explicitContrastMode || existingContrastMode,\n );\n\n const updateBackgroundColor = useCallback(() => {\n const newBgColor = getBackgroundColor(contrastContainerRef.current);\n setParentBackgroundColor(newBgColor);\n\n if (!explicitContrastMode) {\n setContrastMode(\n newBgColor === Tokens.HueNeutral50 ? \"highContrast\" : \"lowContrast\",\n );\n }\n }, [explicitContrastMode]);\n\n useLayoutEffect(() => {\n const observer = new MutationObserver(updateBackgroundColor);\n observer.observe(document.querySelector(\"html\") as HTMLHtmlElement, {\n attributes: true,\n attributeFilter: [\"class\", \"style\"],\n });\n observer.observe(document.head, {\n childList: true,\n subtree: true,\n });\n\n const onTransitionEnd = (event: TransitionEvent) => {\n if (event.propertyName === \"background-color\") {\n updateBackgroundColor();\n }\n };\n\n document.addEventListener(\"transitionend\", onTransitionEnd);\n updateBackgroundColor();\n\n return () => {\n document.removeEventListener(\"transitionend\", onTransitionEnd);\n observer.disconnect();\n };\n }, [updateBackgroundColor]);\n\n return {\n contrastContainerRef,\n contrastMode,\n parentBackgroundColor,\n };\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,aAAa,EACbC,UAAU,EACVC,MAAM,EACNC,eAAe,EACfC,QAAQ,EACRC,WAAW,QACN,OAAO;AACd,OAAO,KAAKC,MAAM,MAAM,6BAA6B;AAErD,SAASC,QAAQ,QAAQ,eAAe;AAOxC,OAAO,MAAMC,mBAAmB,GAAGR,aAAa,CAA0B;EACxES,YAAY,EAAE;AAChB,CAAC,CAAC;AAEF,OAAO,MAAMC,eAAe,GAAG,aAAa;AAE5C,OAAO,MAAMC,sBAAsB,GAAGA,CAAA,KAAMV,UAAU,CAACO,mBAAmB,CAAC;AAE3E,OAAO,MAAMI,eAAe,GAAGL,QAAQ,CAACD,MAAM,CAACO,YAAY,CAAC,CAACC,iBAAiB;AAE9E,OAAO,MAAMC,kBAAkB,GAAIC,KAAa,IAC9CA,KAAK,KAAK,kBAAkB,IAAIA,KAAK,KAAK,aAAa;AAEzD,OAAO,MAAMC,kBAAkB,GAAIC,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ED,MAAMI,qBAAqB,GAAGlC,WAAW,CAAC,MAAM;IAC9C,MAAMmC,UAAU,GAAGV,kBAAkB,CAACI,oBAAoB,CAACO,OAAO,CAAC;IACnEJ,wBAAwB,CAACG,UAAU,CAAC;IAEpC,IAAI,CAACP,oBAAoB,EAAE;MACzBK,eAAe,CACbE,UAAU,KAAKlC,MAAM,CAACO,YAAY,GAAG,cAAc,GAAG,aACxD,CAAC;IACH;EACF,CAAC,EAAE,CAACoB,oBAAoB,CAAC,CAAC;EAE1B9B,eAAe,CAAC,MAAM;IACpB,MAAMuC,QAAQ,GAAG,IAAIC,gBAAgB,CAACJ,qBAAqB,CAAC;IAC5DG,QAAQ,CAACE,OAAO,CAACC,QAAQ,CAACC,aAAa,CAAC,MAAM,CAAC,EAAqB;MAClEC,UAAU,EAAE,IAAI;MAChBC,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO;IACpC,CAAC,CAAC;IACFN,QAAQ,CAACE,OAAO,CAACC,QAAQ,CAACI,IAAI,EAAE;MAC9BC,SAAS,EAAE,IAAI;MACfC,OAAO,EAAE;IACX,CAAC,CAAC;IAEF,MAAMC,eAAe,GAAIC,KAAsB,IAAK;MAClD,IAAIA,KAAK,CAACC,YAAY,KAAK,kBAAkB,EAAE;QAC7Cf,qBAAqB,CAAC,CAAC;MACzB;IACF,CAAC;IAEDM,QAAQ,CAACU,gBAAgB,CAAC,eAAe,EAAEH,eAAe,CAAC;IAC3Db,qBAAqB,CAAC,CAAC;IAEvB,OAAO,MAAM;MACXM,QAAQ,CAACW,mBAAmB,CAAC,eAAe,EAAEJ,eAAe,CAAC;MAC9DV,QAAQ,CAACe,UAAU,CAAC,CAAC;IACvB,CAAC;EACH,CAAC,EAAE,CAAClB,qBAAqB,CAAC,CAAC;EAE3B,OAAO;IACLL,oBAAoB;IACpBzB,YAAY;IACZ2B;EACF,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"useContrastMode.js","names":["createContext","useCallback","useContext","useEffect","useRef","useState","Tokens","hexToRgb","ContrastModeContext","contrastMode","defaultContrast","useContrastModeContext","hueNeutral50Rgb","HueNeutral50","asFormattedString","isTransparentColor","color","normalizeRgbaToRgb","rgba","replace","getElementComputedBackgroundColor","element","window","getComputedStyle","backgroundColor","normalizeBackgroundColor","bgColor","test","normalizedColor","defaultParentBackgroundColor","getBackgroundColor","parentElement","useContrastMode","explicitContrastMode","contrastContainerRef","existingContrastMode","parentBackgroundColor","setParentBackgroundColor","setContrastMode","updateBackgroundColor","newBgColor","current","observer","MutationObserver","observe","document","querySelector","attributes","attributeFilter","head","childList","subtree","onTransitionEnd","event","propertyName","addEventListener","removeEventListener","disconnect"],"sources":["../../src/useContrastMode.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport * as Tokens from \"@okta/odyssey-design-tokens\";\n\nimport { hexToRgb } from \"./hexToRgb.js\";\n\nexport type ContrastMode = \"lowContrast\" | \"highContrast\";\nexport type ContrastModeContextType = {\n contrastMode: ContrastMode;\n};\n\nexport const ContrastModeContext = createContext<ContrastModeContextType>({\n contrastMode: \"lowContrast\",\n});\n\nexport const defaultContrast = \"lowContrast\";\n\nexport const useContrastModeContext = () => useContext(ContrastModeContext);\n\nexport const hueNeutral50Rgb = hexToRgb(Tokens.HueNeutral50).asFormattedString;\n\nexport const isTransparentColor = (color: string) =>\n color === \"rgba(0, 0, 0, 0)\" || color === \"transparent\";\n\nexport const normalizeRgbaToRgb = (rgba: string) =>\n rgba.replace(/rgba\\((\\d+),\\s*(\\d+),\\s*(\\d+),\\s*[\\d.]+\\)/, \"rgb($1, $2, $3)\");\n\nexport const getElementComputedBackgroundColor = (\n element: HTMLElement,\n): string => window.getComputedStyle(element).backgroundColor;\n\nexport const normalizeBackgroundColor = (bgColor: string): string => {\n if (/rgba\\((\\d+),\\s*(\\d+),\\s*(\\d+),\\s*[\\d.]+\\)/.test(bgColor)) {\n const normalizedColor = normalizeRgbaToRgb(bgColor);\n return normalizedColor === hueNeutral50Rgb\n ? Tokens.HueNeutral50\n : normalizedColor;\n }\n\n return bgColor === hueNeutral50Rgb ? Tokens.HueNeutral50 : bgColor;\n};\n\nexport const defaultParentBackgroundColor = \"#ffffff\";\n\n/**\n * Determines the effective background color of an element.\n *\n * @param element - The HTML element to check.\n * @returns The effective background color. Returns defaultParentBackgroundColor if no non-transparent background is found.\n *\n * Note:\n * - Low contrast mode is used for white background (defaultParentBackgroundColor or HueNeutralWhite).\n * - High contrast mode is used for gray background (#f4f4f4 or HueNeutral50).\n */\nexport const getBackgroundColor = (element: HTMLElement | null): string => {\n while (element) {\n const bgColor = getElementComputedBackgroundColor(element);\n if (!isTransparentColor(bgColor)) {\n return normalizeBackgroundColor(bgColor);\n }\n element = element.parentElement;\n }\n return defaultParentBackgroundColor; // Default to white/low contrast if no background color is found\n};\n\ntype UseContrastModeProps = {\n contrastMode?: ContrastMode;\n};\n\nexport const useContrastMode = ({\n contrastMode: explicitContrastMode,\n}: UseContrastModeProps) => {\n const contrastContainerRef = useRef<HTMLDivElement>(null);\n const { contrastMode: existingContrastMode } = useContrastModeContext();\n\n const [parentBackgroundColor, setParentBackgroundColor] = useState(\n defaultParentBackgroundColor,\n );\n const [contrastMode, setContrastMode] = useState<ContrastMode>(\n () => explicitContrastMode || existingContrastMode,\n );\n\n const updateBackgroundColor = useCallback(() => {\n const newBgColor = getBackgroundColor(contrastContainerRef.current);\n setParentBackgroundColor(newBgColor);\n\n if (!explicitContrastMode) {\n setContrastMode(\n newBgColor === Tokens.HueNeutral50 ? \"highContrast\" : \"lowContrast\",\n );\n }\n }, [explicitContrastMode]);\n\n useEffect(() => {\n const observer = new MutationObserver(updateBackgroundColor);\n observer.observe(document.querySelector(\"html\") as HTMLHtmlElement, {\n attributes: true,\n attributeFilter: [\"class\", \"style\"],\n });\n observer.observe(document.head, {\n childList: true,\n subtree: true,\n });\n\n const onTransitionEnd = (event: TransitionEvent) => {\n if (event.propertyName === \"background-color\") {\n updateBackgroundColor();\n }\n };\n\n document.addEventListener(\"transitionend\", onTransitionEnd);\n updateBackgroundColor();\n\n return () => {\n document.removeEventListener(\"transitionend\", onTransitionEnd);\n observer.disconnect();\n };\n }, [updateBackgroundColor]);\n\n return {\n contrastContainerRef,\n contrastMode,\n parentBackgroundColor,\n };\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,aAAa,EACbC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,MAAM,EACNC,QAAQ,QACH,OAAO;AACd,OAAO,KAAKC,MAAM,MAAM,6BAA6B;AAErD,SAASC,QAAQ,QAAQ,eAAe;AAOxC,OAAO,MAAMC,mBAAmB,GAAGR,aAAa,CAA0B;EACxES,YAAY,EAAE;AAChB,CAAC,CAAC;AAEF,OAAO,MAAMC,eAAe,GAAG,aAAa;AAE5C,OAAO,MAAMC,sBAAsB,GAAGA,CAAA,KAAMT,UAAU,CAACM,mBAAmB,CAAC;AAE3E,OAAO,MAAMI,eAAe,GAAGL,QAAQ,CAACD,MAAM,CAACO,YAAY,CAAC,CAACC,iBAAiB;AAE9E,OAAO,MAAMC,kBAAkB,GAAIC,KAAa,IAC9CA,KAAK,KAAK,kBAAkB,IAAIA,KAAK,KAAK,aAAa;AAEzD,OAAO,MAAMC,kBAAkB,GAAIC,IAAY,IAC7CA,IAAI,CAACC,OAAO,CAAC,2CAA2C,EAAE,iBAAiB,CAAC;AAE9E,OAAO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20 GMT
4
4
  */
5
5
 
6
6
  module.exports = {
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Wed, 05 Feb 2025 20:20:12 GMT
3
+ * Generated on Mon, 10 Feb 2025 21:53:20 GMT
4
4
  */
5
5
 
6
6
  export const BorderColorControl = "#8d8d8d";
package/dist/index.scss CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  /**
3
3
  * Do not edit directly
4
- * Generated on Wed, 05 Feb 2025 20:20:12 GMT
4
+ * Generated on Mon, 10 Feb 2025 21:53:21 GMT
5
5
  */
6
6
 
7
7
  $border-color-control: #8d8d8d !default;