@okta/odyssey-react-mui 1.22.0 → 1.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (271) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/@types/i18next.d.js.map +1 -1
  3. package/dist/Autocomplete.js +32 -0
  4. package/dist/Autocomplete.js.map +1 -1
  5. package/dist/Banner.js +6 -2
  6. package/dist/Banner.js.map +1 -1
  7. package/dist/Callout.js +18 -26
  8. package/dist/Callout.js.map +1 -1
  9. package/dist/ContrastModeProvider.js +86 -0
  10. package/dist/ContrastModeProvider.js.map +1 -0
  11. package/dist/DataTable/useScrollIndication.js +7 -3
  12. package/dist/DataTable/useScrollIndication.js.map +1 -1
  13. package/dist/FieldHint.js +20 -6
  14. package/dist/FieldHint.js.map +1 -1
  15. package/dist/FileUploader/FileUploadIllustration.js.map +1 -0
  16. package/dist/FileUploader/FileUploadPreview.js.map +1 -0
  17. package/dist/{labs/FileUpload.js → FileUploader/FileUploader.js} +6 -5
  18. package/dist/FileUploader/FileUploader.js.map +1 -0
  19. package/dist/FileUploader/index.js +13 -0
  20. package/dist/FileUploader/index.js.map +1 -0
  21. package/dist/Link.js.map +1 -1
  22. package/dist/OdysseyProvider.js +43 -19
  23. package/dist/OdysseyProvider.js.map +1 -1
  24. package/dist/Radio.js +2 -2
  25. package/dist/Radio.js.map +1 -1
  26. package/dist/Select.js +36 -0
  27. package/dist/Select.js.map +1 -1
  28. package/dist/Stack.js +32 -0
  29. package/dist/Stack.js.map +1 -0
  30. package/dist/{labs/Switch.js → Switch.js} +7 -7
  31. package/dist/Switch.js.map +1 -0
  32. package/dist/Tabs.js +7 -9
  33. package/dist/Tabs.js.map +1 -1
  34. package/dist/Tag.js +144 -4
  35. package/dist/Tag.js.map +1 -1
  36. package/dist/TextField.js +16 -39
  37. package/dist/TextField.js.map +1 -1
  38. package/dist/Toast.js +2 -2
  39. package/dist/Toast.js.map +1 -1
  40. package/dist/Typography.js +27 -6
  41. package/dist/Typography.js.map +1 -1
  42. package/dist/createShadowDomElements.js +1 -0
  43. package/dist/createShadowDomElements.js.map +1 -1
  44. package/dist/i18n.js +1 -1
  45. package/dist/i18n.js.map +1 -1
  46. package/dist/index.js +4 -1
  47. package/dist/index.js.map +1 -1
  48. package/dist/index.scss +96 -4
  49. package/dist/labs/DataView/DataView.js +64 -25
  50. package/dist/labs/DataView/DataView.js.map +1 -1
  51. package/dist/labs/DataView/TableLayoutContent.js +17 -3
  52. package/dist/labs/DataView/TableLayoutContent.js.map +1 -1
  53. package/dist/labs/DataView/componentTypes.js.map +1 -1
  54. package/dist/labs/DateField.js +2 -0
  55. package/dist/labs/DateField.js.map +1 -1
  56. package/dist/labs/DatePicker.js +5 -1
  57. package/dist/labs/DatePicker.js.map +1 -1
  58. package/dist/labs/SideNav/OktaLogo.js +36 -0
  59. package/dist/labs/SideNav/OktaLogo.js.map +1 -0
  60. package/dist/labs/SideNav/SideNav.js +125 -36
  61. package/dist/labs/SideNav/SideNav.js.map +1 -1
  62. package/dist/labs/SideNav/SideNavHeader.js +33 -10
  63. package/dist/labs/SideNav/SideNavHeader.js.map +1 -1
  64. package/dist/labs/SideNav/types.js.map +1 -1
  65. package/dist/labs/TopNav.js +2 -1
  66. package/dist/labs/TopNav.js.map +1 -1
  67. package/dist/labs/datePickerTheme.js +3 -6
  68. package/dist/labs/datePickerTheme.js.map +1 -1
  69. package/dist/labs/index.js +0 -2
  70. package/dist/labs/index.js.map +1 -1
  71. package/dist/labs/useDateFieldsTranslations.js +1 -1
  72. package/dist/labs/useDateFieldsTranslations.js.map +1 -1
  73. package/dist/properties/ts/odyssey-react-mui.js +3 -1
  74. package/dist/properties/ts/odyssey-react-mui.js.map +1 -1
  75. package/dist/src/Autocomplete.d.ts +37 -1
  76. package/dist/src/Autocomplete.d.ts.map +1 -1
  77. package/dist/src/Banner.d.ts +16 -12
  78. package/dist/src/Banner.d.ts.map +1 -1
  79. package/dist/src/Callout.d.ts +20 -32
  80. package/dist/src/Callout.d.ts.map +1 -1
  81. package/dist/src/ContrastModeProvider.d.ts +34 -0
  82. package/dist/src/ContrastModeProvider.d.ts.map +1 -0
  83. package/dist/src/DataTable/useScrollIndication.d.ts.map +1 -1
  84. package/dist/src/FieldHint.d.ts.map +1 -1
  85. package/dist/src/FileUploader/FileUploadIllustration.d.ts.map +1 -0
  86. package/dist/src/{labs → FileUploader}/FileUploadPreview.d.ts +2 -2
  87. package/dist/src/FileUploader/FileUploadPreview.d.ts.map +1 -0
  88. package/dist/src/{labs/FileUpload.d.ts → FileUploader/FileUploader.d.ts} +5 -4
  89. package/dist/src/FileUploader/FileUploader.d.ts.map +1 -0
  90. package/dist/src/FileUploader/index.d.ts +13 -0
  91. package/dist/src/FileUploader/index.d.ts.map +1 -0
  92. package/dist/src/Link.d.ts +3 -1
  93. package/dist/src/Link.d.ts.map +1 -1
  94. package/dist/src/NativeSelect.d.ts +1 -1
  95. package/dist/src/OdysseyProvider.d.ts +5 -3
  96. package/dist/src/OdysseyProvider.d.ts.map +1 -1
  97. package/dist/src/OdysseyTranslationProvider.d.ts +1 -1
  98. package/dist/src/OdysseyTranslationProvider.d.ts.map +1 -1
  99. package/dist/src/PasswordField.d.ts +1 -1
  100. package/dist/src/SearchField.d.ts +1 -1
  101. package/dist/src/Select.d.ts +36 -0
  102. package/dist/src/Select.d.ts.map +1 -1
  103. package/dist/src/Stack.d.ts +33 -0
  104. package/dist/src/Stack.d.ts.map +1 -0
  105. package/dist/src/{labs/Switch.d.ts → Switch.d.ts} +3 -3
  106. package/dist/src/Switch.d.ts.map +1 -0
  107. package/dist/src/Tabs.d.ts +6 -8
  108. package/dist/src/Tabs.d.ts.map +1 -1
  109. package/dist/src/Tag.d.ts +7 -1
  110. package/dist/src/Tag.d.ts.map +1 -1
  111. package/dist/src/TextField.d.ts +17 -40
  112. package/dist/src/TextField.d.ts.map +1 -1
  113. package/dist/src/Typography.d.ts +3 -2
  114. package/dist/src/Typography.d.ts.map +1 -1
  115. package/dist/src/createShadowDomElements.d.ts.map +1 -1
  116. package/dist/src/i18n.d.ts +2 -2
  117. package/dist/src/i18n.d.ts.map +1 -1
  118. package/dist/src/index.d.ts +8 -3
  119. package/dist/src/index.d.ts.map +1 -1
  120. package/dist/src/labs/DataView/DataView.d.ts +1 -1
  121. package/dist/src/labs/DataView/DataView.d.ts.map +1 -1
  122. package/dist/src/labs/DataView/TableLayoutContent.d.ts +2 -1
  123. package/dist/src/labs/DataView/TableLayoutContent.d.ts.map +1 -1
  124. package/dist/src/labs/DataView/componentTypes.d.ts +10 -0
  125. package/dist/src/labs/DataView/componentTypes.d.ts.map +1 -1
  126. package/dist/src/labs/DateField.d.ts +2 -2
  127. package/dist/src/labs/DateField.d.ts.map +1 -1
  128. package/dist/src/labs/DatePicker.d.ts +2 -2
  129. package/dist/src/labs/DatePicker.d.ts.map +1 -1
  130. package/dist/{test-selectors/odysseyTestSelectors.js → src/labs/SideNav/OktaLogo.d.ts} +3 -9
  131. package/dist/src/labs/SideNav/OktaLogo.d.ts.map +1 -0
  132. package/dist/src/labs/SideNav/SideNav.d.ts +2 -1
  133. package/dist/src/labs/SideNav/SideNav.d.ts.map +1 -1
  134. package/dist/src/labs/SideNav/SideNavHeader.d.ts +1 -1
  135. package/dist/src/labs/SideNav/SideNavHeader.d.ts.map +1 -1
  136. package/dist/src/labs/SideNav/types.d.ts +28 -5
  137. package/dist/src/labs/SideNav/types.d.ts.map +1 -1
  138. package/dist/src/labs/TopNav.d.ts +1 -0
  139. package/dist/src/labs/TopNav.d.ts.map +1 -1
  140. package/dist/src/labs/datePickerTheme.d.ts.map +1 -1
  141. package/dist/src/labs/index.d.ts +0 -2
  142. package/dist/src/labs/index.d.ts.map +1 -1
  143. package/dist/src/properties/ts/odyssey-react-mui.d.ts +2 -0
  144. package/dist/src/properties/ts/odyssey-react-mui.d.ts.map +1 -1
  145. package/dist/src/test-selectors/getByQuerySelector.d.ts +148 -0
  146. package/dist/src/test-selectors/getByQuerySelector.d.ts.map +1 -0
  147. package/dist/src/test-selectors/getComputedAccessibleErrorMessageText.d.ts +14 -0
  148. package/dist/src/test-selectors/getComputedAccessibleErrorMessageText.d.ts.map +1 -0
  149. package/dist/src/test-selectors/{featureTestSelector.d.ts → getComputedAccessibleText.d.ts} +11 -19
  150. package/dist/src/test-selectors/getComputedAccessibleText.d.ts.map +1 -0
  151. package/dist/src/test-selectors/index.d.ts +2 -2
  152. package/dist/src/test-selectors/index.d.ts.map +1 -1
  153. package/dist/src/test-selectors/interpolateString.d.ts +15 -0
  154. package/dist/src/test-selectors/interpolateString.d.ts.map +1 -0
  155. package/dist/src/test-selectors/linkedHtmlSelectors.d.ts +24 -0
  156. package/dist/src/test-selectors/linkedHtmlSelectors.d.ts.map +1 -0
  157. package/dist/src/test-selectors/queryOdysseySelector.d.ts +5755 -0
  158. package/dist/src/test-selectors/queryOdysseySelector.d.ts.map +1 -0
  159. package/dist/src/test-selectors/querySelector.d.ts +59 -3613
  160. package/dist/src/test-selectors/querySelector.d.ts.map +1 -1
  161. package/dist/src/test-selectors/sanityChecks.d.ts +18 -0
  162. package/dist/src/test-selectors/sanityChecks.d.ts.map +1 -0
  163. package/dist/src/test-selectors/testSelector.d.ts +46 -0
  164. package/dist/src/test-selectors/testSelector.d.ts.map +1 -0
  165. package/dist/src/theme/palette.d.ts.map +1 -1
  166. package/dist/src/theme/palette.types.d.ts +2 -0
  167. package/dist/src/theme/palette.types.d.ts.map +1 -1
  168. package/dist/test-selectors/getByQuerySelector.js +64 -0
  169. package/dist/test-selectors/getByQuerySelector.js.map +1 -0
  170. package/dist/test-selectors/getComputedAccessibleErrorMessageText.js +25 -0
  171. package/dist/test-selectors/getComputedAccessibleErrorMessageText.js.map +1 -0
  172. package/dist/test-selectors/getComputedAccessibleText.js +24 -0
  173. package/dist/test-selectors/getComputedAccessibleText.js.map +1 -0
  174. package/dist/test-selectors/index.js +2 -2
  175. package/dist/test-selectors/index.js.map +1 -1
  176. package/{src/test-selectors/featureTestSelector.ts → dist/test-selectors/interpolateString.js} +11 -27
  177. package/dist/test-selectors/interpolateString.js.map +1 -0
  178. package/dist/test-selectors/linkedHtmlSelectors.js +34 -0
  179. package/dist/test-selectors/linkedHtmlSelectors.js.map +1 -0
  180. package/dist/test-selectors/queryOdysseySelector.js +26 -0
  181. package/dist/test-selectors/queryOdysseySelector.js.map +1 -0
  182. package/dist/test-selectors/querySelector.js +82 -58
  183. package/dist/test-selectors/querySelector.js.map +1 -1
  184. package/dist/test-selectors/sanityChecks.js +33 -0
  185. package/dist/test-selectors/sanityChecks.js.map +1 -0
  186. package/dist/test-selectors/testSelector.js +2 -0
  187. package/dist/test-selectors/testSelector.js.map +1 -0
  188. package/dist/test-selectors/testSelectors.json +1 -1
  189. package/dist/theme/components.js +276 -274
  190. package/dist/theme/components.js.map +1 -1
  191. package/dist/theme/palette.js +2 -1
  192. package/dist/theme/palette.js.map +1 -1
  193. package/dist/theme/palette.types.js.map +1 -1
  194. package/dist/tsconfig.production.tsbuildinfo +1 -1
  195. package/dist/tsconfig.tsbuildinfo +1 -1
  196. package/jest.setup.js +3 -0
  197. package/package.json +5 -4
  198. package/scripts/generateTestSelectorsJson.ts +1 -1
  199. package/src/@types/i18next.d.ts +1 -1
  200. package/src/Autocomplete.tsx +45 -0
  201. package/src/Banner.tsx +29 -14
  202. package/src/Callout.tsx +31 -36
  203. package/src/ContrastModeProvider.tsx +131 -0
  204. package/src/DataTable/useScrollIndication.tsx +9 -2
  205. package/src/FieldHint.tsx +28 -4
  206. package/src/{labs → FileUploader}/FileUploadPreview.tsx +3 -3
  207. package/src/{labs/FileUpload.tsx → FileUploader/FileUploader.tsx} +7 -6
  208. package/src/FileUploader/index.ts +13 -0
  209. package/src/Link.tsx +3 -1
  210. package/src/OdysseyCacheProvider.test.tsx +1 -0
  211. package/src/OdysseyProvider.tsx +58 -26
  212. package/src/Radio.tsx +2 -2
  213. package/src/Select.tsx +38 -0
  214. package/src/Stack.tsx +56 -0
  215. package/src/{labs/Switch.tsx → Switch.tsx} +10 -10
  216. package/src/Tabs.tsx +8 -10
  217. package/src/Tag.tsx +178 -3
  218. package/src/TextField.tsx +18 -41
  219. package/src/Toast.tsx +1 -1
  220. package/src/{test-selectors/odysseyTestSelectors.ts → Typography.test.tsx} +13 -9
  221. package/src/Typography.tsx +38 -6
  222. package/src/createShadowDomElements.ts +3 -0
  223. package/src/i18n.ts +3 -3
  224. package/src/index.ts +10 -1
  225. package/src/labs/DataView/DataView.test.tsx +158 -0
  226. package/src/labs/DataView/DataView.tsx +98 -50
  227. package/src/labs/DataView/TableLayoutContent.tsx +28 -1
  228. package/src/labs/DataView/componentTypes.ts +13 -0
  229. package/src/labs/DateField.tsx +3 -0
  230. package/src/labs/DatePicker.tsx +12 -1
  231. package/src/labs/SideNav/OktaLogo.tsx +39 -0
  232. package/src/labs/SideNav/SideNav.tsx +187 -51
  233. package/src/labs/SideNav/SideNavHeader.tsx +30 -7
  234. package/src/labs/SideNav/types.ts +32 -5
  235. package/src/labs/TopNav.tsx +3 -1
  236. package/src/labs/datePickerTheme.tsx +2 -6
  237. package/src/labs/index.ts +0 -3
  238. package/src/labs/useDateFieldsTranslations.ts +1 -1
  239. package/src/properties/odyssey-react-mui.properties +2 -1
  240. package/src/properties/ts/odyssey-react-mui.ts +1 -1
  241. package/src/test-selectors/getByQuerySelector.ts +176 -0
  242. package/src/test-selectors/getComputedAccessibleErrorMessageText.ts +52 -0
  243. package/src/test-selectors/getComputedAccessibleText.ts +36 -0
  244. package/src/test-selectors/index.ts +2 -2
  245. package/src/test-selectors/interpolateString.ts +41 -0
  246. package/src/test-selectors/linkedHtmlSelectors.ts +73 -0
  247. package/src/test-selectors/queryOdysseySelector.ts +36 -0
  248. package/src/test-selectors/querySelector.ts +221 -170
  249. package/src/test-selectors/sanityChecks.ts +53 -0
  250. package/src/test-selectors/testSelector.ts +143 -0
  251. package/src/theme/components.tsx +284 -284
  252. package/src/theme/palette.ts +2 -1
  253. package/src/theme/palette.types.ts +2 -0
  254. package/dist/labs/FileUpload.js.map +0 -1
  255. package/dist/labs/FileUploadIllustration.js.map +0 -1
  256. package/dist/labs/FileUploadPreview.js.map +0 -1
  257. package/dist/labs/Switch.js.map +0 -1
  258. package/dist/src/labs/FileUpload.d.ts.map +0 -1
  259. package/dist/src/labs/FileUploadIllustration.d.ts.map +0 -1
  260. package/dist/src/labs/FileUploadPreview.d.ts.map +0 -1
  261. package/dist/src/labs/Switch.d.ts.map +0 -1
  262. package/dist/src/test-selectors/featureTestSelector.d.ts.map +0 -1
  263. package/dist/src/test-selectors/odysseyTestSelectors.d.ts +0 -120
  264. package/dist/src/test-selectors/odysseyTestSelectors.d.ts.map +0 -1
  265. package/dist/test-selectors/featureTestSelector.js +0 -2
  266. package/dist/test-selectors/featureTestSelector.js.map +0 -1
  267. package/dist/test-selectors/odysseyTestSelectors.js.map +0 -1
  268. /package/dist/{labs → FileUploader}/FileUploadIllustration.js +0 -0
  269. /package/dist/{labs → FileUploader}/FileUploadPreview.js +0 -0
  270. /package/dist/src/{labs → FileUploader}/FileUploadIllustration.d.ts +0 -0
  271. /package/src/{labs → FileUploader}/FileUploadIllustration.tsx +0 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,46 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.24.0](https://github.com/okta/odyssey/compare/v1.20.0...v1.24.0) (2024-10-01)
7
+
8
+ ### Features
9
+
10
+ - add additional action button and menu slot to table ([#2334](https://github.com/okta/odyssey/issues/2334)) ([52b3f38](https://github.com/okta/odyssey/commit/52b3f3832adc442e0219be16fe8a4d96cf100a4e))
11
+ - adds a generic top nav component ([#2296](https://github.com/okta/odyssey/issues/2296)) ([6f3165f](https://github.com/okta/odyssey/commit/6f3165f9fd4a1d1743c975b72132d4ec186d09bb))
12
+ - adds new Shadow DOM export with better naming ([#2338](https://github.com/okta/odyssey/issues/2338)) ([0997e36](https://github.com/okta/odyssey/commit/0997e36afd4d241f5b3960528aff2865fb6d6ac3))
13
+ - automatically scroll to the first isSelected SideNavItem ([#2325](https://github.com/okta/odyssey/issues/2325)) ([52ce441](https://github.com/okta/odyssey/commit/52ce44137ffe5601cfa6044782a21afb5449167e))
14
+ - Misc Odyssey updates ([#2326](https://github.com/okta/odyssey/issues/2326)) ([84fcef3](https://github.com/okta/odyssey/commit/84fcef346841f0a125995a61b80958499343e7e1))
15
+ - **odyssey-react-mui:** add overline typography variant ([#2349](https://github.com/okta/odyssey/issues/2349)) ([4530f69](https://github.com/okta/odyssey/commit/4530f699dffc11117f366ca26826e7ca51f4f296))
16
+
17
+ ### Bug Fixes
18
+
19
+ - Add missing props to Storybook ([#2313](https://github.com/okta/odyssey/issues/2313)) ([bbf96a2](https://github.com/okta/odyssey/commit/bbf96a257160b922c0ebc31b1c5dec1fe31c35b4))
20
+ - fixes translations not working with TypeScript ([#2354](https://github.com/okta/odyssey/issues/2354)) ([37653ee](https://github.com/okta/odyssey/commit/37653ee47c2fab8b54dec26efd5115f6633c2977))
21
+ - **odyssey-design-tokens:** using correct weights in SB ([#2363](https://github.com/okta/odyssey/issues/2363)) ([2dfa614](https://github.com/okta/odyssey/commit/2dfa614cd4c09d71d8624be690ae788e134a74ba))
22
+ - **odyssey-react-mui:** Add min-heights to keep correct heights ([#2324](https://github.com/okta/odyssey/issues/2324)) ([40d5a50](https://github.com/okta/odyssey/commit/40d5a5070ebfab1b650066e91b451c0ef4b3f2d8))
23
+ - remove invalid pseudo element from theme overrides ([#2310](https://github.com/okta/odyssey/issues/2310)) ([fea0793](https://github.com/okta/odyssey/commit/fea0793acf0800494270a87e4e5d65129942b99e))
24
+ - select multioption not rendering text when you use an options object ([#2323](https://github.com/okta/odyssey/issues/2323)) ([4bafbb9](https://github.com/okta/odyssey/commit/4bafbb99e03e52ad572fba9049013c058c75da38))
25
+ - Update Test Selector types and improve functionality ([#2333](https://github.com/okta/odyssey/issues/2333)) ([7039009](https://github.com/okta/odyssey/commit/703900947861dfb36b8996414130a8db3414ccfa))
26
+
27
+ ## [1.23.0](https://github.com/okta/odyssey/compare/v1.19.0...v1.23.0) (2024-09-19)
28
+
29
+ ### Features
30
+
31
+ - add additional action button and menu slot to table ([#2334](https://github.com/okta/odyssey/issues/2334)) ([52b3f38](https://github.com/okta/odyssey/commit/52b3f3832adc442e0219be16fe8a4d96cf100a4e))
32
+ - adds a generic top nav component ([#2296](https://github.com/okta/odyssey/issues/2296)) ([6f3165f](https://github.com/okta/odyssey/commit/6f3165f9fd4a1d1743c975b72132d4ec186d09bb))
33
+ - adds new Shadow DOM export with better naming ([#2338](https://github.com/okta/odyssey/issues/2338)) ([0997e36](https://github.com/okta/odyssey/commit/0997e36afd4d241f5b3960528aff2865fb6d6ac3))
34
+ - automatically scroll to the first isSelected SideNavItem ([#2325](https://github.com/okta/odyssey/issues/2325)) ([52ce441](https://github.com/okta/odyssey/commit/52ce44137ffe5601cfa6044782a21afb5449167e))
35
+
36
+ ### Bug Fixes
37
+
38
+ - Add missing props to Storybook ([#2313](https://github.com/okta/odyssey/issues/2313)) ([bbf96a2](https://github.com/okta/odyssey/commit/bbf96a257160b922c0ebc31b1c5dec1fe31c35b4))
39
+ - fixes translations not working with TypeScript ([#2354](https://github.com/okta/odyssey/issues/2354)) ([37653ee](https://github.com/okta/odyssey/commit/37653ee47c2fab8b54dec26efd5115f6633c2977))
40
+ - **odyssey-design-tokens:** using correct weights in SB ([#2363](https://github.com/okta/odyssey/issues/2363)) ([2dfa614](https://github.com/okta/odyssey/commit/2dfa614cd4c09d71d8624be690ae788e134a74ba))
41
+ - **odyssey-react-mui:** Add min-heights to keep correct heights ([#2324](https://github.com/okta/odyssey/issues/2324)) ([40d5a50](https://github.com/okta/odyssey/commit/40d5a5070ebfab1b650066e91b451c0ef4b3f2d8))
42
+ - remove invalid pseudo element from theme overrides ([#2310](https://github.com/okta/odyssey/issues/2310)) ([fea0793](https://github.com/okta/odyssey/commit/fea0793acf0800494270a87e4e5d65129942b99e))
43
+ - select multioption not rendering text when you use an options object ([#2323](https://github.com/okta/odyssey/issues/2323)) ([4bafbb9](https://github.com/okta/odyssey/commit/4bafbb99e03e52ad572fba9049013c058c75da38))
44
+ - Update Test Selector types and improve functionality ([#2333](https://github.com/okta/odyssey/issues/2333)) ([7039009](https://github.com/okta/odyssey/commit/703900947861dfb36b8996414130a8db3414ccfa))
45
+
6
46
  ## [1.22.0](https://github.com/okta/odyssey/compare/v1.19.0...v1.22.0) (2024-09-05)
7
47
 
8
48
  ### Features
@@ -1 +1 @@
1
- {"version":3,"file":"i18next.d.js","names":[],"sources":["../../src/@types/i18next.d.ts"],"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 \"i18next\";\nimport { translation as en } from \"../properties/ts/odyssey-react-mui\";\n\ndeclare module \"i18next\" {\n interface CustomTypeOptions {\n resources: {\n translations: typeof en;\n };\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,SAAS"}
1
+ {"version":3,"file":"i18next.d.js","names":[],"sources":["../../src/@types/i18next.d.ts"],"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 \"i18next\";\nimport { translation as en } from \"../properties/ts/odyssey-react-mui\";\n\ndeclare module \"i18next\" {\n interface CustomTypeOptions {\n resources: {\n translation: typeof en;\n };\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,SAAS"}
@@ -19,6 +19,36 @@ import { Field } from "./Field.js";
19
19
  import { ComponentControlledState, useInputValues, getControlState } from "./inputUtils.js";
20
20
  import { jsx as _jsx } from "react/jsx-runtime";
21
21
  import { createElement as _createElement } from "react";
22
+ export const AutocompleteTestSelector = {
23
+ accessibleText: {
24
+ errorMessage: "errorMessage",
25
+ hint: "description",
26
+ label: "label"
27
+ },
28
+ children: {
29
+ list: {
30
+ children: {
31
+ listItem: {
32
+ elementSelector: {
33
+ method: "ByRole",
34
+ options: {
35
+ label: "name"
36
+ },
37
+ role: "option"
38
+ }
39
+ }
40
+ },
41
+ isControlledElement: true
42
+ }
43
+ },
44
+ elementSelector: {
45
+ method: "ByRole",
46
+ options: {
47
+ label: "name"
48
+ },
49
+ role: "combobox"
50
+ }
51
+ };
22
52
  const ListboxContainer = styled.div`
23
53
  width: 100%;
24
54
  height: 100%;
@@ -28,6 +58,7 @@ const Autocomplete = ({
28
58
  defaultValue,
29
59
  errorMessage,
30
60
  errorMessageList,
61
+ getOptionLabel,
31
62
  hasMultipleChoices,
32
63
  id: idOverride,
33
64
  inputValue,
@@ -245,6 +276,7 @@ const Autocomplete = ({
245
276
  disabled: isDisabled,
246
277
  freeSolo: isCustomValueAllowed,
247
278
  filterSelectedOptions: true,
279
+ getOptionLabel: getOptionLabel,
248
280
  id: idOverride,
249
281
  fullWidth: isFullWidth,
250
282
  loading: isLoading,
@@ -1 +1 @@
1
- {"version":3,"file":"Autocomplete.js","names":["createContext","forwardRef","memo","useCallback","useContext","useEffect","useMemo","useRef","useState","styled","VariableSizeList","useTranslation","Field","ComponentControlledState","useInputValues","getControlState","jsx","_jsx","createElement","_createElement","ListboxContainer","div","Autocomplete","ariaDescribedBy","defaultValue","errorMessage","errorMessageList","hasMultipleChoices","id","idOverride","inputValue","isCustomValueAllowed","isDisabled","isFullWidth","isLoading","isOptional","isReadOnly","isVirtualized","isVirtualizedProp","hint","HintLinkComponent","label","name","nameOverride","noOptionsText","onBlur","onChange","onChangeProp","onInputChange","onInputChangeProp","onFocus","options","value","getIsOptionEqualToValue","testId","translate","t","controlledStateRef","controlledValue","uncontrolledValue","Boolean","defaultValueProp","undefined","valueProps","controlState","current","inputValueProp","CONTROLLED","renderInput","InputLabelProps","InputProps","params","fieldType","hasVisibleLabel","htmlFor","renderFieldComponent","errorMessageElementId","labelElementId","_InputBase","inputProps","required","Row","data","index","setItemSize","style","rowRef","firstChild","firstElementChild","height","clientHeight","baseOption","key","props","styles","ref","children","OuterListboxContext","OuterListboxElementType","outerProps","useResetCache","length","resetCacheRef","resetAfterIndex","ListboxComponent","listHeight","setListHeight","other","itemData","flatMap","item","concat","sizeMap","getListBoxHeight","COMBINED_LISTBOX_PADDING","OVERSCAN_ROW_COUNT","itemsHeightCalculated","map","_","reduce","prevItemHeight","nextItemHeight","gridRef","size","getItemSize","Provider","innerElementType","itemCount","itemSize","width","outerElementType","overscanCount","event","reason","details","_Autocomplete","clearText","closeText","disableCloseOnSelect","disabled","freeSolo","filterSelectedOptions","fullWidth","loading","multiple","openText","readOnly","isOptionEqualToValue","MemoizedAutocomplete","displayName"],"sources":["../src/Autocomplete.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 Autocomplete as MuiAutocomplete,\n AutocompleteProps as MuiAutocompleteProps,\n InputBase,\n UseAutocompleteProps,\n AutocompleteValue,\n AutocompleteRenderInputParams,\n} from \"@mui/material\";\nimport {\n createContext,\n forwardRef,\n HTMLAttributes,\n memo,\n ReactElement,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport styled from \"@emotion/styled\";\nimport { VariableSizeList, ListChildComponentProps } from \"react-window\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { Field } from \"./Field\";\nimport { FieldComponentProps } from \"./FieldComponentProps\";\nimport type { HtmlProps } from \"./HtmlProps\";\nimport {\n ComponentControlledState,\n useInputValues,\n getControlState,\n} from \"./inputUtils\";\n\ntype SetItemSize = (size: number) => void;\n\nexport type AutocompleteProps<\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n> = {\n /**\n * The default value. Use when the component is not controlled.\n */\n defaultValue?: UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"defaultValue\"];\n /**\n * Enables multiple choice selection\n */\n hasMultipleChoices?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"multiple\"];\n /**\n * The value for the input\n */\n inputValue?: UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"inputValue\"];\n /**\n * Allows the input of custom values\n */\n isCustomValueAllowed?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"freeSolo\"];\n /**\n * Disables the Autocomplete input\n */\n isDisabled?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"disabled\"];\n /**\n * Displays a loading indicator\n */\n isLoading?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"loading\"];\n /**\n * Makes the Autocomplete input read-only\n */\n isReadOnly?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"readOnly\"];\n /**\n * The label text for the autocomplete input\n */\n label: string;\n /**\n * The text to display when no options are available\n *\n * default: \"No Options\"\n */\n noOptionsText?: string;\n /**\n * Callback fired when the autocomplete loses focus.\n */\n onBlur?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onBlur\"];\n /**\n * Callback fired when a selection is made.\n */\n onChange?: UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onChange\"];\n /**\n * Callback fired when the textbox receives typed characters.\n */\n onInputChange?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onInputChange\"];\n /**\n * Callback fired when the autocomplete gains focus.\n */\n onFocus?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onFocus\"];\n /**\n * The options for the Autocomplete input\n */\n options: ReadonlyArray<OptionType>;\n /**\n * The value of the Autocomplete input\n */\n value?: UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"value\"];\n\n /**\n * Used to determine if the option represents the given value. Uses strict equality by default if none provided.\n * Both arguments need to be handled, an option can only match with one value.\n * option: the option to test\n * value: the value to test against\n *\n * You will need to implement this function if your `option` items are objects.\n */\n getIsOptionEqualToValue?: (option: OptionType, value: OptionType) => boolean;\n\n /**\n * If this component is required to display a virtualized list of options,\n * then this value needs to be set to true.\n * It is recommended if you're options are on the order of 10's of hundreds or more.\n */\n isVirtualized?: boolean;\n} & Pick<\n FieldComponentProps,\n | \"errorMessage\"\n | \"errorMessageList\"\n | \"hint\"\n | \"HintLinkComponent\"\n | \"id\"\n | \"isFullWidth\"\n | \"isOptional\"\n | \"name\"\n> &\n Pick<HtmlProps, \"ariaDescribedBy\" | \"testId\" | \"translate\">;\n\nconst ListboxContainer = styled.div`\n width: 100%;\n height: 100%;\n`;\n\nconst Autocomplete = <\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n>({\n ariaDescribedBy,\n defaultValue,\n errorMessage,\n errorMessageList,\n hasMultipleChoices,\n id: idOverride,\n inputValue,\n isCustomValueAllowed,\n isDisabled,\n isFullWidth = false,\n isLoading,\n isOptional = false,\n isReadOnly,\n isVirtualized: isVirtualizedProp = false,\n hint,\n HintLinkComponent,\n label,\n name: nameOverride,\n noOptionsText,\n onBlur,\n onChange: onChangeProp,\n onInputChange: onInputChangeProp,\n onFocus,\n options,\n value,\n getIsOptionEqualToValue,\n testId,\n translate,\n}: AutocompleteProps<OptionType, HasMultipleChoices, IsCustomValueAllowed>) => {\n const { t } = useTranslation();\n const controlledStateRef = useRef(\n getControlState({\n controlledValue: value,\n uncontrolledValue: defaultValue,\n }),\n );\n\n const isVirtualized = useRef(Boolean(isVirtualizedProp));\n\n const defaultValueProp = useMemo<\n | AutocompleteValue<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >\n | undefined\n >(() => {\n if (hasMultipleChoices) {\n if (value === undefined) {\n return defaultValue;\n }\n return [] as AutocompleteValue<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >;\n }\n return value === undefined ? defaultValue : undefined;\n }, [defaultValue, hasMultipleChoices, value]);\n\n const valueProps = useInputValues({\n defaultValue: defaultValueProp,\n value: value,\n controlState: controlledStateRef.current,\n });\n\n const inputValueProp = useMemo(() => {\n if (controlledStateRef.current === ComponentControlledState.CONTROLLED) {\n return { inputValue };\n }\n return undefined;\n }, [inputValue]);\n\n const renderInput = useCallback(\n ({\n InputLabelProps,\n InputProps,\n ...params\n }: AutocompleteRenderInputParams) => (\n <Field\n ariaDescribedBy={ariaDescribedBy}\n errorMessage={errorMessage}\n errorMessageList={errorMessageList}\n fieldType=\"single\"\n hasVisibleLabel\n //@ts-expect-error htmlFor does not exist ont he InputLabelProps for autocomplete\n id={InputLabelProps.htmlFor}\n isFullWidth={isFullWidth}\n hint={hint}\n HintLinkComponent={HintLinkComponent}\n label={label}\n isOptional={isOptional}\n renderFieldComponent={({\n ariaDescribedBy,\n id,\n errorMessageElementId,\n labelElementId,\n }) => (\n <InputBase\n {...params}\n {...InputProps}\n inputProps={{\n ...params.inputProps,\n \"aria-errormessage\": errorMessageElementId,\n \"aria-labelledby\": labelElementId,\n \"data-se\": testId,\n }}\n aria-describedby={ariaDescribedBy}\n id={id}\n name={nameOverride ?? id}\n required={!isOptional}\n />\n )}\n />\n ),\n [\n ariaDescribedBy,\n errorMessage,\n errorMessageList,\n hint,\n HintLinkComponent,\n isFullWidth,\n isOptional,\n label,\n nameOverride,\n testId,\n ],\n );\n\n const Row = ({\n data,\n index,\n setItemSize,\n style,\n }: ListChildComponentProps & { setItemSize: SetItemSize }) => {\n const rowRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (rowRef.current) {\n /**\n * Checking for child height to workaround a bug where the clientHeight of the row isn't updated correctly\n * @see here if you need to know more: https://github.com/bvaughn/react-window/issues/582#issuecomment-1883074908\n */\n const firstChild = rowRef.current.firstElementChild;\n const height = firstChild\n ? firstChild.clientHeight\n : rowRef.current.clientHeight;\n\n setItemSize(height);\n }\n }, [index, rowRef, setItemSize]);\n\n const baseOption = data[index];\n const { key, props } = baseOption;\n\n /**\n * react-window calculates the absolute positions of the list items, via an inline style, so\n * we need to add it to each list item that is being rendered in the viewable list window.\n * @see here if you need to know more: https://github.com/bvaughn/react-window?tab=readme-ov-file#why-is-my-list-blank-when-i-scroll\n */\n const styles = useMemo(\n () => ({\n ...style,\n height: \"auto\",\n }),\n [style],\n );\n\n return (\n <div ref={rowRef}>\n <li {...props} key={key} style={styles} />\n </div>\n );\n };\n\n const OuterListboxContext = createContext({});\n\n const OuterListboxElementType = forwardRef<HTMLDivElement>((props, ref) => {\n const outerProps = useContext(OuterListboxContext);\n return <div ref={ref} {...props} {...outerProps} />;\n });\n\n const useResetCache = (length: number) => {\n const resetCacheRef = useRef<VariableSizeList>(null);\n useEffect(() => {\n if (resetCacheRef.current) {\n resetCacheRef.current.resetAfterIndex(0, true);\n }\n }, [length]);\n return resetCacheRef;\n };\n\n const ListboxComponent = forwardRef<\n HTMLDivElement,\n HTMLAttributes<HTMLElement>\n >(function (props, ref) {\n const [listHeight, setListHeight] = useState(0);\n\n const { children, ...other } = props;\n const itemData: ReactElement[] = (children as ReactElement[]).flatMap(\n (item: ReactElement & { children?: ReactElement[] }) =>\n [item].concat(item.children || []),\n );\n\n const sizeMap = useRef<number[]>([]);\n\n const getListBoxHeight = useCallback(() => {\n // 8px of padding top/bottom applied by MUI\n const COMBINED_LISTBOX_PADDING = 16;\n\n if (itemData.length > OVERSCAN_ROW_COUNT) {\n // has a max-height of 40vh set in CSS. This is only set because height needs to be a number\n return 99999;\n } else {\n const itemsHeightCalculated = itemData\n .map((_, index) => sizeMap.current[index] || 0)\n .reduce(\n (prevItemHeight, nextItemHeight) => prevItemHeight + nextItemHeight,\n 0,\n );\n return COMBINED_LISTBOX_PADDING + itemsHeightCalculated;\n }\n }, [itemData, sizeMap]);\n\n useEffect(() => {\n if (sizeMap.current.length && itemData.length) {\n setListHeight(getListBoxHeight());\n }\n }, [getListBoxHeight, itemData, sizeMap]);\n\n // The number of items (rows or columns) to render outside of the visible area for performance and scrolling reasons\n const OVERSCAN_ROW_COUNT = 8;\n\n const gridRef = useResetCache(itemData.length);\n\n const setItemSize = useCallback<SetItemSize>(\n (size) => {\n gridRef?.current?.resetAfterIndex(0, true);\n sizeMap.current = sizeMap.current.concat(size);\n },\n [gridRef, sizeMap],\n );\n const getItemSize = useCallback(\n // using 45px as a sane default here to avoid a lot of content shift on repaint\n (index: number) => sizeMap.current[index] || 45,\n [sizeMap],\n );\n\n return (\n <ListboxContainer ref={ref}>\n <OuterListboxContext.Provider value={other}>\n <VariableSizeList\n innerElementType=\"ul\"\n itemData={itemData}\n itemCount={itemData.length}\n itemSize={getItemSize}\n height={listHeight}\n width=\"100%\"\n ref={gridRef}\n outerElementType={OuterListboxElementType}\n overscanCount={OVERSCAN_ROW_COUNT}\n >\n {({ data, index, style }) => (\n <Row\n data={data}\n index={index}\n style={style}\n setItemSize={setItemSize}\n />\n )}\n </VariableSizeList>\n </OuterListboxContext.Provider>\n </ListboxContainer>\n );\n });\n\n const onChange = useCallback<\n NonNullable<\n UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onChange\"]\n >\n >(\n (event, value, reason, details) => {\n onChangeProp?.(event, value, reason, details);\n },\n [onChangeProp],\n );\n\n const onInputChange = useCallback<\n NonNullable<\n UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onInputChange\"]\n >\n >(\n (event, value, reason) => {\n onInputChangeProp?.(event, value, reason);\n },\n [onInputChangeProp],\n );\n\n return (\n <MuiAutocomplete\n {...valueProps}\n {...inputValueProp}\n // conditionally provide the ListboxComponent if this needs to be virtualized\n {...(isVirtualized.current && {\n ListboxComponent,\n })}\n // AutoComplete is wrapped in a div within MUI which does not get the disabled attr. So this aria-disabled gets set in the div\n aria-disabled={isDisabled}\n clearText={t(\"clear.text\")}\n closeText={t(\"close.text\")}\n disableCloseOnSelect={hasMultipleChoices}\n disabled={isDisabled}\n freeSolo={isCustomValueAllowed}\n filterSelectedOptions={true}\n id={idOverride}\n fullWidth={isFullWidth}\n loading={isLoading}\n multiple={hasMultipleChoices}\n noOptionsText={noOptionsText}\n onBlur={onBlur}\n onChange={onChange}\n onInputChange={onInputChange}\n onFocus={onFocus}\n openText={t(\"open.text\")}\n options={options}\n readOnly={isReadOnly}\n renderInput={renderInput}\n isOptionEqualToValue={getIsOptionEqualToValue}\n translate={translate}\n />\n );\n};\n\n// Need the `typeof Autocomplete` because generics don't get passed through\nconst MemoizedAutocomplete = memo(Autocomplete) as typeof Autocomplete;\n// @ts-expect-error displayName is expected to not be on `typeof Autocomplete`\nMemoizedAutocomplete.displayName = \"Autocomplete\";\n\nexport { MemoizedAutocomplete as Autocomplete };\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAUA,SACEA,aAAa,EACbC,UAAU,EAEVC,IAAI,EAEJC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH,OAAO;AACd,OAAOC,MAAM,MAAM,iBAAiB;AACpC,SAASC,gBAAgB,QAAiC,cAAc;AACxE,SAASC,cAAc,QAAQ,eAAe;AAAC,SAEtCC,KAAK;AAAA,SAIZC,wBAAwB,EACxBC,cAAc,EACdC,eAAe;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,aAAA,IAAAC,cAAA;AAkKjB,MAAMC,gBAAgB,GAAGX,MAAM,CAACY,GAAI;AACpC;AACA;AACA,CAAC;AAED,MAAMC,YAAY,GAAGA,CAInB;EACAC,eAAe;EACfC,YAAY;EACZC,YAAY;EACZC,gBAAgB;EAChBC,kBAAkB;EAClBC,EAAE,EAAEC,UAAU;EACdC,UAAU;EACVC,oBAAoB;EACpBC,UAAU;EACVC,WAAW,GAAG,KAAK;EACnBC,SAAS;EACTC,UAAU,GAAG,KAAK;EAClBC,UAAU;EACVC,aAAa,EAAEC,iBAAiB,GAAG,KAAK;EACxCC,IAAI;EACJC,iBAAiB;EACjBC,KAAK;EACLC,IAAI,EAAEC,YAAY;EAClBC,aAAa;EACbC,MAAM;EACNC,QAAQ,EAAEC,YAAY;EACtBC,aAAa,EAAEC,iBAAiB;EAChCC,OAAO;EACPC,OAAO;EACPC,KAAK;EACLC,uBAAuB;EACvBC,MAAM;EACNC;AACuE,CAAC,KAAK;EAC7E,MAAM;IAAEC;EA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M,KAAK;IACxBpF,iBAAiB,GAAGmF,KAAK,EAAEhF,KAAK,EAAEiF,MAAM,CAAC;EAC3C,CAAC,EACD,CAACpF,iBAAiB,CACpB,CAAC;EAED,OACEhC,IAAA,CAAAsH,aAAA;IAAA,GACMxE,UAAU;IAAA,GACVG,cAAc;IAAA,IAEb7B,aAAa,CAAC4B,OAAO,IAAI;MAC5BuC;IACF,CAAC;IAED,iBAAexE,UAAW;IAC1BwG,SAAS,EAAEhF,CAAC,CAAC,YAAY,CAAE;IAC3BiF,SAAS,EAAEjF,CAAC,CAAC,YAAY,CAAE;IAC3BkF,oBAAoB,EAAE/G,kBAAmB;IACzCgH,QAAQ,EAAE3G,UAAW;IACrB4G,QAAQ,EAAE7G,oBAAqB;IAC/B8G,qBAAqB,EAAE,IAAK;IAC5BjH,EAAE,EAAEC,UAAW;IACfiH,SAAS,EAAE7G,WAAY;IACvB8G,OAAO,EAAE7G,SAAU;IACnB8G,QAAQ,EAAErH,kBAAmB;IAC7BiB,aAAa,EAAEA,aAAc;IAC7BC,MAAM,EAAEA,MAAO;IACfC,QAAQ,EAAEA,QAAS;IACnBE,aAAa,EAAEA,aAAc;IAC7BE,OAAO,EAAEA,OAAQ;IACjB+F,QAAQ,EAAEzF,CAAC,CAAC,WAAW,CAAE;IACzBL,OAAO,EAAEA,OAAQ;IACjB+F,QAAQ,EAAE9G,UAAW;IACrBgC,WAAW,EAAEA,WAAY;IACzB+E,oBAAoB,EAAE9F,uBAAwB;IAC9CE,SAAS,EAAEA;EAAU,CACtB,CAAC;AAEN,CAAC;AAGD,MAAM6F,oBAAoB,GAAGlJ,IAAI,CAACoB,YAAY,CAAwB;AAEtE8H,oBAAoB,CAACC,WAAW,GAAG,cAAc;AAEjD,SAASD,oBAAoB,IAAI9H,YAAY"}
1
+ {"version":3,"file":"Autocomplete.js","names":["createContext","forwardRef","memo","useCallback","useContext","useEffect","useMemo","useRef","useState","styled","VariableSizeList","useTranslation","Field","ComponentControlledState","useInputValues","getControlState","jsx","_jsx","createElement","_createElement","AutocompleteTestSelector","accessibleText","errorMessage","hint","label","children","list","listItem","elementSelector","method","options","role","isControlledElement","ListboxContainer","div","Autocomplete","ariaDescribedBy","defaultValue","errorMessageList","getOptionLabel","hasMultipleChoices","id","idOverride","inputValue","isCustomValueAllowed","isDisabled","isFullWidth","isLoading","isOptional","isReadOnly","isVirtualized","isVirtualizedProp","HintLinkComponent","name","nameOverride","noOptionsText","onBlur","onChange","onChangeProp","onInputChange","onInputChangeProp","onFocus","value","getIsOptionEqualToValue","testId","translate","t","controlledStateRef","controlledValue","uncontrolledValue","Boolean","defaultValueProp","undefined","valueProps","controlState","current","inputValueProp","CONTROLLED","renderInput","InputLabelProps","InputProps","params","fieldType","hasVisibleLabel","htmlFor","renderFieldComponent","errorMessageElementId","labelElementId","_InputBase","inputProps","required","Row","data","index","setItemSize","style","rowRef","firstChild","firstElementChild","height","clientHeight","baseOption","key","props","styles","ref","OuterListboxContext","OuterListboxElementType","outerProps","useResetCache","length","resetCacheRef","resetAfterIndex","ListboxComponent","listHeight","setListHeight","other","itemData","flatMap","item","concat","sizeMap","getListBoxHeight","COMBINED_LISTBOX_PADDING","OVERSCAN_ROW_COUNT","itemsHeightCalculated","map","_","reduce","prevItemHeight","nextItemHeight","gridRef","size","getItemSize","Provider","innerElementType","itemCount","itemSize","width","outerElementType","overscanCount","event","reason","details","_Autocomplete","clearText","closeText","disableCloseOnSelect","disabled","freeSolo","filterSelectedOptions","fullWidth","loading","multiple","openText","readOnly","isOptionEqualToValue","MemoizedAutocomplete","displayName"],"sources":["../src/Autocomplete.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 Autocomplete as MuiAutocomplete,\n AutocompleteProps as MuiAutocompleteProps,\n InputBase,\n UseAutocompleteProps,\n AutocompleteValue,\n AutocompleteRenderInputParams,\n} from \"@mui/material\";\nimport {\n createContext,\n forwardRef,\n HTMLAttributes,\n memo,\n ReactElement,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport styled from \"@emotion/styled\";\nimport { VariableSizeList, ListChildComponentProps } from \"react-window\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { Field } from \"./Field\";\nimport { FieldComponentProps } from \"./FieldComponentProps\";\nimport type { HtmlProps } from \"./HtmlProps\";\nimport {\n ComponentControlledState,\n useInputValues,\n getControlState,\n} from \"./inputUtils\";\nimport { TestSelector } from \"./test-selectors\";\n\nexport const AutocompleteTestSelector = {\n accessibleText: {\n errorMessage: \"errorMessage\",\n hint: \"description\",\n label: \"label\",\n },\n children: {\n list: {\n children: {\n listItem: {\n elementSelector: {\n method: \"ByRole\",\n options: {\n label: \"name\",\n },\n role: \"option\",\n },\n },\n },\n isControlledElement: true,\n },\n },\n elementSelector: {\n method: \"ByRole\",\n options: {\n label: \"name\",\n },\n role: \"combobox\",\n },\n} as const satisfies TestSelector;\n\ntype SetItemSize = (size: number) => void;\n\nexport type AutocompleteProps<\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n> = {\n /**\n * The default value. Use when the component is not controlled.\n */\n defaultValue?: UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"defaultValue\"];\n /**\n * Used to determine the string value for a given option. It's used to fill the input (and the list box options if renderOption is not provided). If used in free solo mode, it must accept both the type of the options and a string.\n *\n * `function(option: Value) => string`\n */\n getOptionLabel?: UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"getOptionLabel\"];\n /**\n * Enables multiple choice selection\n */\n hasMultipleChoices?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"multiple\"];\n /**\n * The value for the input\n */\n inputValue?: UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"inputValue\"];\n /**\n * Allows the input of custom values\n */\n isCustomValueAllowed?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"freeSolo\"];\n /**\n * Disables the Autocomplete input\n */\n isDisabled?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"disabled\"];\n /**\n * Displays a loading indicator\n */\n isLoading?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"loading\"];\n /**\n * Makes the Autocomplete input read-only\n */\n isReadOnly?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"readOnly\"];\n /**\n * The label text for the autocomplete input\n */\n label: string;\n /**\n * The text to display when no options are available\n *\n * default: \"No Options\"\n */\n noOptionsText?: string;\n /**\n * Callback fired when the autocomplete loses focus.\n */\n onBlur?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onBlur\"];\n /**\n * Callback fired when a selection is made.\n */\n onChange?: UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onChange\"];\n /**\n * Callback fired when the textbox receives typed characters.\n */\n onInputChange?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onInputChange\"];\n /**\n * Callback fired when the autocomplete gains focus.\n */\n onFocus?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onFocus\"];\n /**\n * The options for the Autocomplete input\n */\n options: ReadonlyArray<OptionType>;\n /**\n * The value of the Autocomplete input\n */\n value?: UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"value\"];\n\n /**\n * Used to determine if the option represents the given value. Uses strict equality by default if none provided.\n * Both arguments need to be handled, an option can only match with one value.\n * option: the option to test\n * value: the value to test against\n *\n * You will need to implement this function if your `option` items are objects.\n */\n getIsOptionEqualToValue?: (option: OptionType, value: OptionType) => boolean;\n\n /**\n * If this component is required to display a virtualized list of options,\n * then this value needs to be set to true.\n * It is recommended if you're options are on the order of 10's of hundreds or more.\n */\n isVirtualized?: boolean;\n} & Pick<\n FieldComponentProps,\n | \"errorMessage\"\n | \"errorMessageList\"\n | \"hint\"\n | \"HintLinkComponent\"\n | \"id\"\n | \"isFullWidth\"\n | \"isOptional\"\n | \"name\"\n> &\n Pick<HtmlProps, \"ariaDescribedBy\" | \"testId\" | \"translate\">;\n\nconst ListboxContainer = styled.div`\n width: 100%;\n height: 100%;\n`;\n\nconst Autocomplete = <\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n>({\n ariaDescribedBy,\n defaultValue,\n errorMessage,\n errorMessageList,\n getOptionLabel,\n hasMultipleChoices,\n id: idOverride,\n inputValue,\n isCustomValueAllowed,\n isDisabled,\n isFullWidth = false,\n isLoading,\n isOptional = false,\n isReadOnly,\n isVirtualized: isVirtualizedProp = false,\n hint,\n HintLinkComponent,\n label,\n name: nameOverride,\n noOptionsText,\n onBlur,\n onChange: onChangeProp,\n onInputChange: onInputChangeProp,\n onFocus,\n options,\n value,\n getIsOptionEqualToValue,\n testId,\n translate,\n}: AutocompleteProps<OptionType, HasMultipleChoices, IsCustomValueAllowed>) => {\n const { t } = useTranslation();\n const controlledStateRef = useRef(\n getControlState({\n controlledValue: value,\n uncontrolledValue: defaultValue,\n }),\n );\n\n const isVirtualized = useRef(Boolean(isVirtualizedProp));\n\n const defaultValueProp = useMemo<\n | AutocompleteValue<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >\n | undefined\n >(() => {\n if (hasMultipleChoices) {\n if (value === undefined) {\n return defaultValue;\n }\n return [] as AutocompleteValue<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >;\n }\n return value === undefined ? defaultValue : undefined;\n }, [defaultValue, hasMultipleChoices, value]);\n\n const valueProps = useInputValues({\n defaultValue: defaultValueProp,\n value: value,\n controlState: controlledStateRef.current,\n });\n\n const inputValueProp = useMemo(() => {\n if (controlledStateRef.current === ComponentControlledState.CONTROLLED) {\n return { inputValue };\n }\n return undefined;\n }, [inputValue]);\n\n const renderInput = useCallback(\n ({\n InputLabelProps,\n InputProps,\n ...params\n }: AutocompleteRenderInputParams) => (\n <Field\n ariaDescribedBy={ariaDescribedBy}\n errorMessage={errorMessage}\n errorMessageList={errorMessageList}\n fieldType=\"single\"\n hasVisibleLabel\n //@ts-expect-error htmlFor does not exist ont he InputLabelProps for autocomplete\n id={InputLabelProps.htmlFor}\n isFullWidth={isFullWidth}\n hint={hint}\n HintLinkComponent={HintLinkComponent}\n label={label}\n isOptional={isOptional}\n renderFieldComponent={({\n ariaDescribedBy,\n id,\n errorMessageElementId,\n labelElementId,\n }) => (\n <InputBase\n {...params}\n {...InputProps}\n inputProps={{\n ...params.inputProps,\n \"aria-errormessage\": errorMessageElementId,\n \"aria-labelledby\": labelElementId,\n \"data-se\": testId,\n }}\n aria-describedby={ariaDescribedBy}\n id={id}\n name={nameOverride ?? id}\n required={!isOptional}\n />\n )}\n />\n ),\n [\n ariaDescribedBy,\n errorMessage,\n errorMessageList,\n hint,\n HintLinkComponent,\n isFullWidth,\n isOptional,\n label,\n nameOverride,\n testId,\n ],\n );\n\n const Row = ({\n data,\n index,\n setItemSize,\n style,\n }: ListChildComponentProps & { setItemSize: SetItemSize }) => {\n const rowRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (rowRef.current) {\n /**\n * Checking for child height to workaround a bug where the clientHeight of the row isn't updated correctly\n * @see here if you need to know more: https://github.com/bvaughn/react-window/issues/582#issuecomment-1883074908\n */\n const firstChild = rowRef.current.firstElementChild;\n const height = firstChild\n ? firstChild.clientHeight\n : rowRef.current.clientHeight;\n\n setItemSize(height);\n }\n }, [index, rowRef, setItemSize]);\n\n const baseOption = data[index];\n const { key, props } = baseOption;\n\n /**\n * react-window calculates the absolute positions of the list items, via an inline style, so\n * we need to add it to each list item that is being rendered in the viewable list window.\n * @see here if you need to know more: https://github.com/bvaughn/react-window?tab=readme-ov-file#why-is-my-list-blank-when-i-scroll\n */\n const styles = useMemo(\n () => ({\n ...style,\n height: \"auto\",\n }),\n [style],\n );\n\n return (\n <div ref={rowRef}>\n <li {...props} key={key} style={styles} />\n </div>\n );\n };\n\n const OuterListboxContext = createContext({});\n\n const OuterListboxElementType = forwardRef<HTMLDivElement>((props, ref) => {\n const outerProps = useContext(OuterListboxContext);\n return <div ref={ref} {...props} {...outerProps} />;\n });\n\n const useResetCache = (length: number) => {\n const resetCacheRef = useRef<VariableSizeList>(null);\n useEffect(() => {\n if (resetCacheRef.current) {\n resetCacheRef.current.resetAfterIndex(0, true);\n }\n }, [length]);\n return resetCacheRef;\n };\n\n const ListboxComponent = forwardRef<\n HTMLDivElement,\n HTMLAttributes<HTMLElement>\n >(function (props, ref) {\n const [listHeight, setListHeight] = useState(0);\n\n const { children, ...other } = props;\n const itemData: ReactElement[] = (children as ReactElement[]).flatMap(\n (item: ReactElement & { children?: ReactElement[] }) =>\n [item].concat(item.children || []),\n );\n\n const sizeMap = useRef<number[]>([]);\n\n const getListBoxHeight = useCallback(() => {\n // 8px of padding top/bottom applied by MUI\n const COMBINED_LISTBOX_PADDING = 16;\n\n if (itemData.length > OVERSCAN_ROW_COUNT) {\n // has a max-height of 40vh set in CSS. This is only set because height needs to be a number\n return 99999;\n } else {\n const itemsHeightCalculated = itemData\n .map((_, index) => sizeMap.current[index] || 0)\n .reduce(\n (prevItemHeight, nextItemHeight) => prevItemHeight + nextItemHeight,\n 0,\n );\n return COMBINED_LISTBOX_PADDING + itemsHeightCalculated;\n }\n }, [itemData, sizeMap]);\n\n useEffect(() => {\n if (sizeMap.current.length && itemData.length) {\n setListHeight(getListBoxHeight());\n }\n }, [getListBoxHeight, itemData, sizeMap]);\n\n // The number of items (rows or columns) to render outside of the visible area for performance and scrolling reasons\n const OVERSCAN_ROW_COUNT = 8;\n\n const gridRef = useResetCache(itemData.length);\n\n const setItemSize = useCallback<SetItemSize>(\n (size) => {\n gridRef?.current?.resetAfterIndex(0, true);\n sizeMap.current = sizeMap.current.concat(size);\n },\n [gridRef, sizeMap],\n );\n const getItemSize = useCallback(\n // using 45px as a sane default here to avoid a lot of content shift on repaint\n (index: number) => sizeMap.current[index] || 45,\n [sizeMap],\n );\n\n return (\n <ListboxContainer ref={ref}>\n <OuterListboxContext.Provider value={other}>\n <VariableSizeList\n innerElementType=\"ul\"\n itemData={itemData}\n itemCount={itemData.length}\n itemSize={getItemSize}\n height={listHeight}\n width=\"100%\"\n ref={gridRef}\n outerElementType={OuterListboxElementType}\n overscanCount={OVERSCAN_ROW_COUNT}\n >\n {({ data, index, style }) => (\n <Row\n data={data}\n index={index}\n style={style}\n setItemSize={setItemSize}\n />\n )}\n </VariableSizeList>\n </OuterListboxContext.Provider>\n </ListboxContainer>\n );\n });\n\n const onChange = useCallback<\n NonNullable<\n UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onChange\"]\n >\n >(\n (event, value, reason, details) => {\n onChangeProp?.(event, value, reason, details);\n },\n [onChangeProp],\n );\n\n const onInputChange = useCallback<\n NonNullable<\n UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onInputChange\"]\n >\n >(\n (event, value, reason) => {\n onInputChangeProp?.(event, value, reason);\n },\n [onInputChangeProp],\n );\n\n return (\n <MuiAutocomplete\n {...valueProps}\n {...inputValueProp}\n // conditionally provide the ListboxComponent if this needs to be virtualized\n {...(isVirtualized.current && {\n ListboxComponent,\n })}\n // AutoComplete is wrapped in a div within MUI which does not get the disabled attr. So this aria-disabled gets set in the div\n aria-disabled={isDisabled}\n clearText={t(\"clear.text\")}\n closeText={t(\"close.text\")}\n disableCloseOnSelect={hasMultipleChoices}\n disabled={isDisabled}\n freeSolo={isCustomValueAllowed}\n filterSelectedOptions={true}\n getOptionLabel={getOptionLabel}\n id={idOverride}\n fullWidth={isFullWidth}\n loading={isLoading}\n multiple={hasMultipleChoices}\n noOptionsText={noOptionsText}\n onBlur={onBlur}\n onChange={onChange}\n onInputChange={onInputChange}\n onFocus={onFocus}\n openText={t(\"open.text\")}\n options={options}\n readOnly={isReadOnly}\n renderInput={renderInput}\n isOptionEqualToValue={getIsOptionEqualToValue}\n translate={translate}\n />\n );\n};\n\n// Need the `typeof Autocomplete` because generics don't get passed through\nconst MemoizedAutocomplete = memo(Autocomplete) as typeof Autocomplete;\n// @ts-expect-error displayName is expected to not be on `typeof Autocomplete`\nMemoizedAutocomplete.displayName = \"Autocomplete\";\n\nexport { MemoizedAutocomplete as Autocomplete };\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAUA,SACEA,aAAa,EACbC,UAAU,EAEVC,IAAI,EAEJC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH,OAAO;AACd,OAAOC,MAAM,MAAM,iBAAiB;AACpC,SAASC,gBAAgB,QAAiC,cAAc;AACxE,SAASC,cAAc,QAAQ,eAAe;AAAC,SAEtCC,KAAK;AAAA,SAIZC,wBAAwB,EACxBC,cAAc,EACdC,eAAe;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,aAAA,IAAAC,cAAA;AAIjB,OAAO,MAAMC,wBAAwB,GAAG;EACtCC,cAAc,EAAE;I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AAA,CAAA+H,aAAA;IAAA,GACMvE,UAAU;IAAA,GACVG,cAAc;IAAA,IAEb1B,aAAa,CAACyB,OAAO,IAAI;MAC5BsC;IACF,CAAC;IAED,iBAAepE,UAAW;IAC1BoG,SAAS,EAAE/E,CAAC,CAAC,YAAY,CAAE;IAC3BgF,SAAS,EAAEhF,CAAC,CAAC,YAAY,CAAE;IAC3BiF,oBAAoB,EAAE3G,kBAAmB;IACzC4G,QAAQ,EAAEvG,UAAW;IACrBwG,QAAQ,EAAEzG,oBAAqB;IAC/B0G,qBAAqB,EAAE,IAAK;IAC5B/G,cAAc,EAAEA,cAAe;IAC/BE,EAAE,EAAEC,UAAW;IACf6G,SAAS,EAAEzG,WAAY;IACvB0G,OAAO,EAAEzG,SAAU;IACnB0G,QAAQ,EAAEjH,kBAAmB;IAC7Be,aAAa,EAAEA,aAAc;IAC7BC,MAAM,EAAEA,MAAO;IACfC,QAAQ,EAAEA,QAAS;IACnBE,aAAa,EAAEA,aAAc;IAC7BE,OAAO,EAAEA,OAAQ;IACjB6F,QAAQ,EAAExF,CAAC,CAAC,WAAW,CAAE;IACzBpC,OAAO,EAAEA,OAAQ;IACjB6H,QAAQ,EAAE1G,UAAW;IACrB6B,WAAW,EAAEA,WAAY;IACzB8E,oBAAoB,EAAE7F,uBAAwB;IAC9CE,SAAS,EAAEA;EAAU,CACtB,CAAC;AAEN,CAAC;AAGD,MAAM4F,oBAAoB,GAAG3J,IAAI,CAACiC,YAAY,CAAwB;AAEtE0H,oBAAoB,CAACC,WAAW,GAAG,cAAc;AAEjD,SAASD,oBAAoB,IAAI1H,YAAY"}
package/dist/Banner.js CHANGED
@@ -21,8 +21,10 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
21
21
  export const bannerRoleValues = ["status", "alert"];
22
22
  export const bannerSeverityValues = ["success", "info", "warning", "error"];
23
23
  const Banner = ({
24
- linkUrl,
24
+ linkRel,
25
+ linkTarget,
25
26
  linkText,
27
+ linkUrl,
26
28
  onClose,
27
29
  role,
28
30
  severity,
@@ -47,8 +49,10 @@ const Banner = ({
47
49
  children: text
48
50
  }), linkUrl && _jsx(Link, {
49
51
  href: linkUrl,
50
- variant: "monochrome",
52
+ rel: linkRel,
53
+ target: linkTarget,
51
54
  translate: translate,
55
+ variant: "monochrome",
52
56
  children: linkText
53
57
  })]
54
58
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Banner.js","names":["memo","useTranslation","Link","ScreenReaderText","jsx","_jsx","jsxs","_jsxs","bannerRoleValues","bannerSeverityValues","Banner","linkUrl","linkText","onClose","role","severity","text","testId","translate","t","_Alert","variant","children","_AlertTitle","href","MemoizedBanner","displayName"],"sources":["../src/Banner.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 { memo } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { Alert, AlertColor, AlertTitle, AlertProps } from \"@mui/material\";\n\nimport type { HtmlProps } from \"./HtmlProps\";\nimport { Link } from \"./Link\";\nimport { ScreenReaderText } from \"./ScreenReaderText\";\n\nexport const bannerRoleValues = [\"status\", \"alert\"] as const;\nexport const bannerSeverityValues: AlertColor[] = [\n \"success\",\n \"info\",\n \"warning\",\n \"error\",\n];\n\nexport type BannerProps = {\n /**\n * If linkUrl is not undefined, this is the text of the link.\n * If left blank, it defaults to \"Learn more\".\n * Note that linkText does nothing if linkUrl is not defined\n */\n linkText?: string;\n /**\n * If defined, the alert will include a link to the URL\n */\n linkUrl?: string;\n /**\n * The function that's fired when the user clicks the close button. If undefined,\n * the close button will not be shown.\n */\n onClose?: AlertProps[\"onClose\"];\n /**\n * Sets the ARIA role of the alert\n * (\"status\" for something that dynamically updates, \"alert\" for errors, null for something\n * unchanging)\n */\n role?: (typeof bannerRoleValues)[number];\n /**\n * Determine the color and icon of the alert\n */\n severity: (typeof bannerSeverityValues)[number];\n /**\n * The text content of the alert\n */\n text: string;\n} & Pick<HtmlProps, \"testId\" | \"translate\">;\n\nconst Banner = ({\n linkUrl,\n linkText,\n onClose,\n role,\n severity,\n text,\n testId,\n translate,\n}: BannerProps) => {\n const { t } = useTranslation();\n\n return (\n <Alert\n data-se={testId}\n onClose={onClose}\n role={role}\n severity={severity}\n variant=\"banner\"\n >\n <ScreenReaderText translate={translate}>\n {t(`severity.${severity}`)}\n </ScreenReaderText>\n <AlertTitle translate={translate}>{text}</AlertTitle>\n {linkUrl && (\n <Link href={linkUrl} variant=\"monochrome\" translate={translate}>\n {linkText}\n </Link>\n )}\n </Alert>\n );\n};\n\nconst MemoizedBanner = memo(Banner);\nMemoizedBanner.displayName = \"Banner\";\n\nexport { MemoizedBanner as Banner };\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,QAAQ,OAAO;AAC5B,SAASC,cAAc,QAAQ,eAAe;AAAC,SAItCC,IAAI;AAAA,SACJC,gBAAgB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAEzB,OAAO,MAAMC,gBAAgB,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAU;AAC5D,OAAO,MAAMC,oBAAkC,GAAG,CAChD,SAAS,EACT,MAAM,EACN,SAAS,EACT,OAAO,CACR;AAkCD,MAAMC,MAAM,GAAGA,CAAC;EACdC,OAAO;EACPC,QAAQ;EACRC,OAAO;EACPC,IAAI;EACJC,QAAQ;EACRC,IAAI;EACJC,MAAM;EACNC;AACW,CAAC,KAAK;EACjB,MAAM;IAAEC;EAAE,CAAC,GAAGlB,cAAc,CAAC,CAAC;EAE9B,OACEM,KAAA,CAAAa,MAAA;IACE,WAASH,MAAO;IAChBJ,OAAO,EAAEA,OAAQ;IACjBC,IAAI,EAAEA,IAAK;IACXC,QAAQ,EAAEA,QAAS;IACnBM,OAAO,EAAC,QAAQ;IAAAC,QAAA,GAEhBjB,IAAA,CAACF,gBAAgB;MAACe,SAAS,EAAEA,SAAU;MAAAI,QAAA,EACpCH,CAAC,CAAE,YAAWJ,QAAS,EAAC;IAAC,CACV,CAAC,EACnBV,IAAA,CAAAkB,WAAA;MAAYL,SAAS,EAAEA,SAAU;MAAAI,QAAA,EAAEN;IAAI,CAAa,CAAC,EACpDL,OAAO,IACNN,IAAA,CAACH,IAAI;MAACsB,IAAI,EAAEb,OAAQ;MAACU,OAAO,EAAC,YAAY;MAACH,SAAS,EAAEA,SAAU;MAAAI,QAAA,EAC5DV;IAAQ,CACL,CACP;EAAA,CACI,CAAC;AAEZ,CAAC;AAED,MAAMa,cAAc,GAAGzB,IAAI,CAACU,MAAM,CAAC;AACnCe,cAAc,CAACC,WAAW,GAAG,QAAQ;AAErC,SAASD,cAAc,IAAIf,MAAM"}
1
+ {"version":3,"file":"Banner.js","names":["memo","useTranslation","Link","ScreenReaderText","jsx","_jsx","jsxs","_jsxs","bannerRoleValues","bannerSeverityValues","Banner","linkRel","linkTarget","linkText","linkUrl","onClose","role","severity","text","testId","translate","t","_Alert","variant","children","_AlertTitle","href","rel","target","MemoizedBanner","displayName"],"sources":["../src/Banner.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 { memo } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { Alert, AlertColor, AlertTitle, AlertProps } from \"@mui/material\";\n\nimport type { HtmlProps } from \"./HtmlProps\";\nimport { Link, LinkProps } from \"./Link\";\nimport { ScreenReaderText } from \"./ScreenReaderText\";\n\nexport const bannerRoleValues = [\"status\", \"alert\"] as const;\nexport const bannerSeverityValues: AlertColor[] = [\n \"success\",\n \"info\",\n \"warning\",\n \"error\",\n];\n\nexport type BannerProps = {\n /**\n * The function that's fired when the user clicks the close button. If undefined,\n * the close button will not be shown.\n */\n onClose?: AlertProps[\"onClose\"];\n /**\n * Sets the ARIA role of the alert\n * (\"status\" for something that dynamically updates, \"alert\" for errors, null for something\n * unchanging)\n */\n role?: (typeof bannerRoleValues)[number];\n /**\n * Determine the color and icon of the alert\n */\n severity: (typeof bannerSeverityValues)[number];\n /**\n * The text content of the alert\n */\n text: string;\n} & Pick<HtmlProps, \"testId\" | \"translate\"> &\n (\n | {\n linkRel?: LinkProps[\"rel\"];\n linkTarget?: LinkProps[\"target\"];\n linkText: string;\n /**\n * If defined, the Banner will include a link to the URL\n */\n linkUrl: LinkProps[\"href\"];\n }\n | {\n linkRel?: never;\n linkTarget?: never;\n linkText?: never;\n linkUrl?: never;\n }\n );\n\nconst Banner = ({\n linkRel,\n linkTarget,\n linkText,\n linkUrl,\n onClose,\n role,\n severity,\n text,\n testId,\n translate,\n}: BannerProps) => {\n const { t } = useTranslation();\n\n return (\n <Alert\n data-se={testId}\n onClose={onClose}\n role={role}\n severity={severity}\n variant=\"banner\"\n >\n <ScreenReaderText translate={translate}>\n {t(`severity.${severity}`)}\n </ScreenReaderText>\n <AlertTitle translate={translate}>{text}</AlertTitle>\n {linkUrl && (\n <Link\n href={linkUrl}\n rel={linkRel}\n target={linkTarget}\n translate={translate}\n variant=\"monochrome\"\n >\n {linkText}\n </Link>\n )}\n </Alert>\n );\n};\n\nconst MemoizedBanner = memo(Banner);\nMemoizedBanner.displayName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;IAAQ,CACL,CACP;EAAA,CACI,CAAC;AAEZ,CAAC;AAED,MAAMgB,cAAc,GAAG7B,IAAI,CAACU,MAAM,CAAC;AACnCmB,cAAc,CAACC,WAAW,GAAG,QAAQ;AAErC,SAASD,cAAc,IAAInB,MAAM"}
package/dist/Callout.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import _Alert from "@mui/material/Alert";
2
- import _Link from "@mui/material/Link";
3
2
  import _Box from "@mui/material/Box";
4
3
  import _AlertTitle from "@mui/material/AlertTitle";
5
4
  /*!
@@ -17,45 +16,34 @@ import _AlertTitle from "@mui/material/AlertTitle";
17
16
  import styled from "@emotion/styled";
18
17
  import { memo } from "react";
19
18
  import { useTranslation } from "react-i18next";
19
+ import { Link } from "./Link.js";
20
20
  import { useOdysseyDesignTokens } from "./OdysseyDesignTokensContext.js";
21
21
  import { Paragraph } from "./Typography.js";
22
22
  import { useUniqueId } from "./useUniqueId.js";
23
23
  import { jsx as _jsx } from "react/jsx-runtime";
24
24
  import { jsxs as _jsxs } from "react/jsx-runtime";
25
- export const CalloutTestSelectors = {
26
- feature: {
25
+ export const CalloutTestSelector = {
26
+ accessibleText: {
27
+ text: "description",
28
+ title: "label"
29
+ },
30
+ children: {
27
31
  link: {
28
- selector: {
32
+ elementSelector: {
29
33
  method: "ByRole",
30
34
  options: {
31
- name: "${linkText}"
35
+ linkText: "name"
32
36
  },
33
- role: "link",
34
- templateVariableNames: ["linkText"]
35
- }
36
- },
37
- text: {
38
- selector: {
39
- method: "ByText",
40
- templateVariableNames: ["text"],
41
- text: "${text}"
42
- }
43
- },
44
- title: {
45
- selector: {
46
- method: "ByText",
47
- templateVariableNames: ["title"],
48
- text: "${title}"
37
+ role: "link"
49
38
  }
50
39
  }
51
40
  },
52
- selector: {
41
+ elementSelector: {
53
42
  method: "ByRole",
54
43
  options: {
55
- name: "${title}"
44
+ title: "name"
56
45
  },
57
- role: "${role}",
58
- templateVariableNames: ["role", "title"]
46
+ role: ["alert", "status"]
59
47
  }
60
48
  };
61
49
  export const calloutRoleValues = ["status", "alert"];
@@ -71,6 +59,8 @@ const ContentContainer = styled("div", {
71
59
  }));
72
60
  const Callout = ({
73
61
  children,
62
+ linkRel,
63
+ linkTarget,
74
64
  linkText,
75
65
  linkUrl,
76
66
  role,
@@ -105,8 +95,10 @@ const Callout = ({
105
95
  }), text && _jsx(Paragraph, {
106
96
  children: text
107
97
  }), linkUrl && _jsx(_Box, {
108
- children: _jsx(_Link, {
98
+ children: _jsx(Link, {
109
99
  href: linkUrl,
100
+ rel: linkRel,
101
+ target: linkTarget,
110
102
  variant: "monochrome",
111
103
  children: linkText
112
104
  })
@@ -1 +1 @@
1
- {"version":3,"file":"Callout.js","names":["styled","memo","useTranslation","useOdysseyDesignTokens","Paragraph","useUniqueId","jsx","_jsx","jsxs","_jsxs","CalloutTestSelectors","feature","link","selector","method","options","name","role","templateVariableNames","text","title","calloutRoleValues","calloutSeverityValues","ContentContainer","shouldForwardProp","prop","odysseyDesignTokens","marginBlockStart","Spacing4","Callout","children","linkText","linkUrl","severity","testId","translate","t","titleId","_Alert","variant","_AlertTitle","id","_Box","component","_Link","href","MemoizedCallout","displayName"],"sources":["../src/Callout.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 styled from \"@emotion/styled\";\nimport { Alert, AlertTitle, Box, Link as MuiLink } from \"@mui/material\";\nimport { memo, ReactNode } from \"react\";\nimport { useTranslation } from \"react-i18next\";\n\nimport type { HtmlProps } from \"./HtmlProps\";\nimport {\n DesignTokens,\n useOdysseyDesignTokens,\n} from \"./OdysseyDesignTokensContext\";\nimport { type FeatureTestSelector } from \"./test-selectors\";\nimport { Paragraph } from \"./Typography\";\nimport { useUniqueId } from \"./useUniqueId\";\n\nexport const CalloutTestSelectors = {\n feature: {\n link: {\n selector: {\n method: \"ByRole\",\n options: {\n name: \"${linkText}\",\n },\n role: \"link\",\n templateVariableNames: [\"linkText\"],\n },\n },\n text: {\n selector: {\n method: \"ByText\",\n templateVariableNames: [\"text\"],\n text: \"${text}\",\n },\n },\n title: {\n selector: {\n method: \"ByText\",\n templateVariableNames: [\"title\"],\n text: \"${title}\",\n },\n },\n },\n selector: {\n method: \"ByRole\",\n options: {\n name: \"${title}\",\n },\n role: \"${role}\",\n templateVariableNames: [\"role\", \"title\"],\n },\n} as const satisfies FeatureTestSelector;\n\nexport const calloutRoleValues = [\"status\", \"alert\"] as const;\nexport const calloutSeverityValues = [\n \"success\",\n \"info\",\n \"warning\",\n \"error\",\n] as const;\n\nexport type CalloutProps = {\n /**\n * Used to optionally pass a text list to the component\n */\n children?: ReactNode;\n /**\n * Sets the ARIA role of the Callout\n * (\"status\" for something that dynamically updates, \"alert\" for errors, null for something\n * unchanging)\n */\n role?: (typeof calloutRoleValues)[number];\n /**\n * Determine the color and icon of the Callout\n */\n severity: (typeof calloutSeverityValues)[number];\n /**\n * The text content of the Callout\n */\n text?: string;\n /**\n * The title of the Callout\n */\n title?: string;\n} & (\n | {\n children?: never;\n text: string;\n }\n | {\n children: ReactNode;\n text?: never;\n }\n) &\n (\n | {\n /**\n * If linkUrl is not undefined, this is the text of the link.\n * If left blank, it defaults to \"Learn more\".\n * Note that linkText does nothing if linkUrl is not defined\n */\n linkUrl: string;\n /**\n * If defined, the Toast will include a link to the URL\n */\n linkText: string;\n }\n | {\n linkUrl?: never;\n linkText?: never;\n }\n ) &\n Pick<HtmlProps, \"testId\" | \"translate\">;\n\nconst ContentContainer = styled(\"div\", {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})(({ odysseyDesignTokens }: { odysseyDesignTokens: DesignTokens }) => ({\n \"& > * + *\": {\n marginBlockStart: odysseyDesignTokens.Spacing4,\n },\n}));\n\nconst Callout = ({\n children,\n linkText,\n linkUrl,\n role,\n severity,\n testId,\n text,\n title,\n translate,\n}: CalloutProps) => {\n const { t } = useTranslation();\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const titleId = useUniqueId();\n\n return (\n <Alert\n aria-label={t(`severity.${severity}`)}\n aria-labelledby={titleId}\n data-se={testId}\n role={role}\n severity={severity}\n variant=\"callout\"\n >\n {title && (\n <AlertTitle aria-hidden id={titleId} translate={translate}>\n {title}\n </AlertTitle>\n )}\n\n <ContentContainer odysseyDesignTokens={odysseyDesignTokens}>\n {children && <Box component=\"div\">{children}</Box>}\n {text && <Paragraph>{text}</Paragraph>}\n {linkUrl && (\n <Box>\n <MuiLink href={linkUrl} variant=\"monochrome\">\n {linkText}\n </MuiLink>\n </Box>\n )}\n </ContentContainer>\n </Alert>\n );\n};\n\nconst MemoizedCallout = memo(Callout);\nMemoizedCallout.displayName = \"Callout\";\n\nexport { MemoizedCallout as Callout };\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,MAAM,MAAM,iBAAiB;AAEpC,SAASC,IAAI,QAAmB,OAAO;AACvC,SAASC,cAAc,QAAQ,eAAe;AAAC,SAK7CC,sBAAsB;AAAA,SAGfC,SAAS;AAAA,SACTC,WAAW;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAEpB,OAAO,MAAMC,oBAAoB,GAAG;EAClCC,OAAO,EAAE;IACPC,IAAI,EAAE;MACJC,QAAQ,EAAE;QACRC,MAAM,EAAE,QAAQ;QAChBC,OAAO,EAAE;UACPC,IAAI,EAAE;QACR,CAAC;QACDC,IAAI,EAAE,MAAM;QACZC,qBAAqB,EAAE,CAAC,UAAU;MACpC;IACF,CAAC;IACDC,I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AC,CAAE;IACtC,mBAAiBI,OAAQ;IACzB,WAASH,MAAO;IAChBjB,IAAI,EAAEA,IAAK;IACXgB,QAAQ,EAAEA,QAAS;IACnBM,OAAO,EAAC,SAAS;IAAAT,QAAA,GAEhBV,KAAK,IACJb,IAAA,CAAAiC,WAAA;MAAY,mBAAW;MAACC,EAAE,EAAEJ,OAAQ;MAACF,SAAS,EAAEA,SAAU;MAAAL,QAAA,EACvDV;IAAK,CACI,CACb,EAEDX,KAAA,CAACc,gBAAgB;MAACG,mBAAmB,EAAEA,mBAAoB;MAAAI,QAAA,GACxDA,QAAQ,IAAIvB,IAAA,CAAAmC,IAAA;QAAKC,SAAS,EAAC,KAAK;QAAAb,QAAA,EAAEA;MAAQ,CAAM,CAAC,EACjDX,IAAI,IAAIZ,IAAA,CAACH,SAAS;QAAA0B,QAAA,EAAEX;MAAI,CAAY,CAAC,EACrCa,OAAO,IACNzB,IAAA,CAAAmC,IAAA;QAAAZ,QAAA,EACEvB,IAAA,CAAAqC,KAAA;UAASC,IAAI,EAAEb,OAAQ;UAACO,OAAO,EAAC,YAAY;UAAAT,QAAA,EACzCC;QAAQ,CACF;MAAC,CACP,CACN;IAAA,CACe,CAAC;EAAA,CACd,CAAC;AAEZ,CAAC;AAED,MAAMe,eAAe,GAAG7C,IAAI,CAAC4B,OAAO,CAAC;AACrCiB,eAAe,CAACC,WAAW,GAAG,SAAS;AAEvC,SAASD,eAAe,IAAIjB,OAAO"}
1
+ {"version":3,"file":"Callout.js","names":["styled","memo","useTranslation","Link","useOdysseyDesignTokens","Paragraph","useUniqueId","jsx","_jsx","jsxs","_jsxs","CalloutTestSelector","accessibleText","text","title","children","link","elementSelector","method","options","linkText","role","calloutRoleValues","calloutSeverityValues","ContentContainer","shouldForwardProp","prop","odysseyDesignTokens","marginBlockStart","Spacing4","Callout","linkRel","linkTarget","linkUrl","severity","testId","translate","t","titleId","_Alert","variant","_AlertTitle","id","_Box","component","href","rel","target","MemoizedCallout","displayName"],"sources":["../src/Callout.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 styled from \"@emotion/styled\";\nimport { Alert, AlertTitle, Box } from \"@mui/material\";\nimport { memo, ReactNode } from \"react\";\nimport { useTranslation } from \"react-i18next\";\n\nimport type { HtmlProps } from \"./HtmlProps\";\nimport { Link, LinkProps } from \"./Link\";\nimport {\n DesignTokens,\n useOdysseyDesignTokens,\n} from \"./OdysseyDesignTokensContext\";\nimport { type TestSelector } from \"./test-selectors\";\nimport { Paragraph } from \"./Typography\";\nimport { useUniqueId } from \"./useUniqueId\";\n\nexport const CalloutTestSelector = {\n accessibleText: {\n text: \"description\",\n title: \"label\",\n },\n children: {\n link: {\n elementSelector: {\n method: \"ByRole\",\n options: {\n linkText: \"name\",\n },\n role: \"link\",\n },\n },\n },\n elementSelector: {\n method: \"ByRole\",\n options: {\n title: \"name\",\n },\n role: [\"alert\", \"status\"],\n },\n} as const satisfies TestSelector;\n\nexport const calloutRoleValues = [\"status\", \"alert\"] as const;\nexport const calloutSeverityValues = [\n \"success\",\n \"info\",\n \"warning\",\n \"error\",\n] as const;\n\nexport type CalloutProps = {\n /**\n * Used to optionally pass a text list to the component\n */\n children?: ReactNode;\n /**\n * Sets the ARIA role of the Callout\n * (\"status\" for something that dynamically updates, \"alert\" for errors, null for something\n * unchanging)\n */\n role?: (typeof calloutRoleValues)[number];\n /**\n * Determine the color and icon of the Callout\n */\n severity: (typeof calloutSeverityValues)[number];\n /**\n * The text content of the Callout\n */\n text?: string;\n /**\n * The title of the Callout\n */\n title?: string;\n} & (\n | {\n children?: never;\n text: string;\n }\n | {\n children: ReactNode;\n text?: never;\n }\n) &\n (\n | {\n linkRel?: LinkProps[\"rel\"];\n linkTarget?: LinkProps[\"target\"];\n linkText: string;\n /**\n * If defined, the Callout will include a link to the URL\n */\n linkUrl: LinkProps[\"href\"];\n }\n | {\n linkRel?: never;\n linkTarget?: never;\n linkUrl?: never;\n linkText?: never;\n }\n ) &\n Pick<HtmlProps, \"testId\" | \"translate\">;\n\nconst ContentContainer = styled(\"div\", {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})(({ odysseyDesignTokens }: { odysseyDesignTokens: DesignTokens }) => ({\n \"& > * + *\": {\n marginBlockStart: odysseyDesignTokens.Spacing4,\n },\n}));\n\nconst Callout = ({\n children,\n linkRel,\n linkTarget,\n linkText,\n linkUrl,\n role,\n severity,\n testId,\n text,\n title,\n translate,\n}: CalloutProps) => {\n const { t } = useTranslation();\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const titleId = useUniqueId();\n\n return (\n <Alert\n aria-label={t(`severity.${severity}`)}\n aria-labelledby={titleId}\n data-se={testId}\n role={role}\n severity={severity}\n variant=\"callout\"\n >\n {title && (\n <AlertTitle aria-hidden id={titleId} translate={translate}>\n {title}\n </AlertTitle>\n )}\n\n <ContentContainer odysseyDesignTokens={odysseyDesignTokens}>\n {children && <Box component=\"div\">{children}</Box>}\n {text && <Paragraph>{text}</Paragraph>}\n {linkUrl && (\n <Box>\n <Link\n href={linkUrl}\n rel={linkRel}\n target={linkTarget}\n variant=\"monochrome\"\n >\n {linkText}\n </Link>\n </Box>\n )}\n </ContentContainer>\n </Alert>\n );\n};\n\nconst MemoizedCallout = memo(Callout);\nMemoizedCallout.displayName = \"Callout\";\n\nexport { MemoizedCallout as Callout };\n"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,MAAM,MAAM,iBAAiB;AAEpC,SAASC,IAAI,QAAmB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
3
+ * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
4
+ *
5
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
6
+ * Unless required by applicable law or agreed to in writing, software
7
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
8
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9
+ *
10
+ * See the License for the specific language governing permissions and limitations under the License.
11
+ */
12
+
13
+ import React, { createContext, useContext, useRef, useLayoutEffect, useState, useMemo } from "react";
14
+ import { createTheme, ThemeProvider, useTheme } from "@mui/material/styles";
15
+ import * as Tokens from "@okta/odyssey-design-tokens";
16
+ import { jsx as _jsx } from "react/jsx-runtime";
17
+ const ContrastModeContext = createContext({
18
+ contrastMode: "highContrast",
19
+ parentBackgroundColor: ""
20
+ });
21
+ export const useContrastContext = () => useContext(ContrastModeContext);
22
+ const hexToRgb = hex => {
23
+ const bigint = parseInt(hex.slice(1), 16);
24
+ const r = bigint >> 16 & 255;
25
+ const g = bigint >> 8 & 255;
26
+ const b = bigint & 255;
27
+ return `rgb(${r}, ${g}, ${b})`;
28
+ };
29
+ export const useParentBackgroundColor = ref => {
30
+ const [backgroundColor, setBackgroundColor] = useState("");
31
+ const hueNeutral50Rgb = useMemo(() => hexToRgb(Tokens.HueNeutral50), []);
32
+ useLayoutEffect(() => {
33
+ if (ref.current) {
34
+ let element = ref.current;
35
+ while (element) {
36
+ const bgColor = window.getComputedStyle(element).backgroundColor;
37
+ if (bgColor !== "rgba(0, 0, 0, 0)" && bgColor !== "transparent") {
38
+ if (bgColor === hueNeutral50Rgb) {
39
+ setBackgroundColor(Tokens.HueNeutral50);
40
+ } else {
41
+ setBackgroundColor(bgColor);
42
+ }
43
+ break;
44
+ }
45
+ element = element.parentElement;
46
+ }
47
+ }
48
+ }, [ref, hueNeutral50Rgb]);
49
+ return backgroundColor;
50
+ };
51
+ export const ContrastModeProvider = ({
52
+ children,
53
+ contrastMode: explicitContrastMode
54
+ }) => {
55
+ const ref = useRef(null);
56
+ const parentBackgroundColor = useParentBackgroundColor(ref);
57
+ const [contrastMode, setContrastMode] = useState("highContrast");
58
+ useLayoutEffect(() => {
59
+ if (explicitContrastMode) {
60
+ setContrastMode(explicitContrastMode);
61
+ } else {
62
+ const isLowContrast = parentBackgroundColor === Tokens.HueNeutral50;
63
+ setContrastMode(isLowContrast ? "lowContrast" : "highContrast");
64
+ }
65
+ }, [parentBackgroundColor, explicitContrastMode]);
66
+ const contextValue = useMemo(() => ({
67
+ contrastMode,
68
+ parentBackgroundColor
69
+ }), [contrastMode, parentBackgroundColor]);
70
+ const existingTheme = useTheme();
71
+ const theme = useMemo(() => createTheme({
72
+ ...existingTheme,
73
+ odysseyContrastMode: contrastMode
74
+ }), [existingTheme, contrastMode]);
75
+ return _jsx("div", {
76
+ ref: ref,
77
+ children: _jsx(ContrastModeContext.Provider, {
78
+ value: contextValue,
79
+ children: _jsx(ThemeProvider, {
80
+ theme: theme,
81
+ children: children
82
+ })
83
+ })
84
+ });
85
+ };
86
+ //# sourceMappingURL=ContrastModeProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContrastModeProvider.js","names":["React","createContext","useContext","useRef","useLayoutEffect","useState","useMemo","createTheme","ThemeProvider","useTheme","Tokens","jsx","_jsx","ContrastModeContext","contrastMode","parentBackgroundColor","useContrastContext","hexToRgb","hex","bigint","parseInt","slice","r","g","b","useParentBackgroundColor","ref","backgroundColor","setBackgroundColor","hueNeutral50Rgb","HueNeutral50","current","element","bgColor","window","getComputedStyle","parentElement","ContrastModeProvider","children","explicitContrastMode","setContrastMode","isLowContrast","contextValue","existingTheme","theme","odysseyContrastMode","Provider","value"],"sources":["../src/ContrastModeProvider.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 React, {\n createContext,\n useContext,\n useRef,\n useLayoutEffect,\n useState,\n useMemo,\n ReactNode,\n} from \"react\";\nimport { createTheme, ThemeProvider, useTheme } from \"@mui/material/styles\";\nimport * as Tokens from \"@okta/odyssey-design-tokens\";\n\ndeclare module \"@mui/material/styles\" {\n interface Theme {\n odysseyContrastMode: ContrastMode;\n }\n interface ThemeOptions {\n odysseyContrastMode?: ContrastMode;\n }\n}\n\nexport type ContrastMode = \"lowContrast\" | \"highContrast\";\n\nexport type ContrastModeContextType = {\n contrastMode: ContrastMode;\n parentBackgroundColor: string;\n};\n\nconst ContrastModeContext = createContext<ContrastModeContextType>({\n contrastMode: \"highContrast\",\n parentBackgroundColor: \"\",\n});\n\nexport const useContrastContext = () => useContext(ContrastModeContext);\n\nconst hexToRgb = (hex: string): string => {\n const bigint = parseInt(hex.slice(1), 16);\n const r = (bigint >> 16) & 255;\n const g = (bigint >> 8) & 255;\n const b = bigint & 255;\n return `rgb(${r}, ${g}, ${b})`;\n};\n\nexport const useParentBackgroundColor = (ref: React.RefObject<HTMLElement>) => {\n const [backgroundColor, setBackgroundColor] = useState(\"\");\n\n const hueNeutral50Rgb = useMemo(() => hexToRgb(Tokens.HueNeutral50), []);\n\n useLayoutEffect(() => {\n if (ref.current) {\n let element: HTMLElement | null = ref.current;\n while (element) {\n const bgColor = window.getComputedStyle(element).backgroundColor;\n\n if (bgColor !== \"rgba(0, 0, 0, 0)\" && bgColor !== \"transparent\") {\n if (bgColor === hueNeutral50Rgb) {\n setBackgroundColor(Tokens.HueNeutral50);\n } else {\n setBackgroundColor(bgColor);\n }\n break;\n }\n element = element.parentElement;\n }\n }\n }, [ref, hueNeutral50Rgb]);\n\n return backgroundColor;\n};\n\ntype ContrastModeProviderProps = {\n children: ReactNode;\n contrastMode?: ContrastMode;\n};\n\nexport const ContrastModeProvider = ({\n children,\n contrastMode: explicitContrastMode,\n}: ContrastModeProviderProps) => {\n const ref = useRef<HTMLDivElement>(null);\n const parentBackgroundColor = useParentBackgroundColor(ref);\n const [contrastMode, setContrastMode] =\n useState<ContrastMode>(\"highContrast\");\n\n useLayoutEffect(() => {\n if (explicitContrastMode) {\n setContrastMode(explicitContrastMode);\n } else {\n const isLowContrast = parentBackgroundColor === Tokens.HueNeutral50;\n setContrastMode(isLowContrast ? \"lowContrast\" : \"highContrast\");\n }\n }, [parentBackgroundColor, explicitContrastMode]);\n\n const contextValue = useMemo<ContrastModeContextType>(\n () => ({\n contrastMode,\n parentBackgroundColor,\n }),\n [contrastMode, parentBackgroundColor],\n );\n\n const existingTheme = useTheme();\n const theme = useMemo(\n () =>\n createTheme({\n ...existingTheme,\n odysseyContrastMode: contrastMode,\n }),\n [existingTheme, contrastMode],\n );\n\n return (\n <div ref={ref}>\n <ContrastModeContext.Provider value={contextValue}>\n <ThemeProvider theme={theme}>{children}</ThemeProvider>\n </ContrastModeContext.Provider>\n </div>\n );\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IACVC,aAAa,EACbC,UAAU,EACVC,MAAM,EACNC,eAAe,EACfC,QAAQ,EACRC,OAAO,QAEF,OAAO;AACd,SAASC,WAAW,EAAEC,aAAa,EAAEC,QAAQ,QAAQ,sBAAsB;AAC3E,OAAO,KAAKC,MAAM,MAAM,6BAA6B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAkBtD,MAAMC,mBAAmB,GAAGZ,aAAa,CAA0B;EACjEa,YAAY,EAAE,cAAc;EAC5BC,qBAAqB,EAAE;AACzB,CAAC,CAAC;AAEF,OAAO,MAAMC,kBAAkB,GAAGA,CAAA,KAAMd,UAAU,CAACW,mBAAmB,CAAC;AAEvE,MAAMI,QAAQ,G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AC,KAAK;EAC/B,MAAMb,GAAG,GAAGvB,MAAM,CAAiB,IAAI,CAAC;EACxC,MAAMY,qBAAqB,GAAGU,wBAAwB,CAACC,GAAG,CAAC;EAC3D,MAAM,CAACZ,YAAY,EAAE0B,eAAe,CAAC,GACnCnC,QAAQ,CAAe,cAAc,CAAC;EAExCD,eAAe,CAAC,MAAM;IACpB,IAAImC,oBAAoB,EAAE;MACxBC,eAAe,CAACD,oBAAoB,CAAC;IACvC,CAAC,MAAM;MACL,MAAME,aAAa,GAAG1B,qBAAqB,KAAKL,MAAM,CAACoB,YAAY;MACnEU,eAAe,CAACC,aAAa,GAAG,aAAa,GAAG,cAAc,CAAC;IACjE;EACF,CAAC,EAAE,CAAC1B,qBAAqB,EAAEwB,oBAAoB,CAAC,CAAC;EAEjD,MAAMG,YAAY,GAAGpC,OAAO,CAC1B,OAAO;IACLQ,YAAY;IACZC;EACF,CAAC,CAAC,EACF,CAACD,YAAY,EAAEC,qBAAqB,CACtC,CAAC;EAED,MAAM4B,aAAa,GAAGlC,QAAQ,CAAC,CAAC;EAChC,MAAMmC,KAAK,GAAGtC,OAAO,CACnB,MACEC,WAAW,CAAC;IACV,GAAGoC,aAAa;IAChBE,mBAAmB,EAAE/B;EACvB,CAAC,CAAC,EACJ,CAAC6B,aAAa,EAAE7B,YAAY,CAC9B,CAAC;EAED,OACEF,IAAA;IAAKc,GAAG,EAAEA,GAAI;IAAAY,QAAA,EACZ1B,IAAA,CAACC,mBAAmB,CAACiC,QAAQ;MAACC,KAAK,EAAEL,YAAa;MAAAJ,QAAA,EAChD1B,IAAA,CAACJ,aAAa;QAACoC,KAAK,EAAEA,KAAM;QAAAN,QAAA,EAAEA;MAAQ,CAAgB;IAAC,CAC3B;EAAC,CAC5B,CAAC;AAEV,CAAC"}
@@ -11,6 +11,7 @@
11
11
  */
12
12
 
13
13
  import { useCallback, useEffect, useRef } from "react";
14
+ import { useOdysseyDesignTokens } from "../OdysseyDesignTokensContext.js";
14
15
  export const useScrollIndication = ({
15
16
  tableOuterContainer,
16
17
  tableInnerContainer,
@@ -20,6 +21,7 @@ export const useScrollIndication = ({
20
21
  }) => {
21
22
  const animationFrameIdRef = useRef(null);
22
23
  const resizeObserverRef = useRef(null);
24
+ const odysseyDesignTokens = useOdysseyDesignTokens();
23
25
  const checkScrollIndicators = useCallback(() => {
24
26
  if (!tableOuterContainer || !tableInnerContainer) return;
25
27
  const containerWidth = tableOuterContainer.clientWidth;
@@ -30,7 +32,9 @@ export const useScrollIndication = ({
30
32
  setIsTableContainerScrolledToEnd(containerEndScrollPosition >= contentWidth - 16);
31
33
  }, [tableInnerContainer, tableOuterContainer, setIsTableContainerScrolledToEnd, setIsTableContainerScrolledToStart]);
32
34
  useEffect(() => {
33
- if (resizeObserverRef.current) return;
35
+ if (typeof ResizeObserver === "undefined" || resizeObserverRef.current) {
36
+ return;
37
+ }
34
38
  let debounceTimer;
35
39
  resizeObserverRef.current = new ResizeObserver(() => {
36
40
  clearTimeout(debounceTimer);
@@ -41,7 +45,7 @@ export const useScrollIndication = ({
41
45
  animationFrameIdRef.current = null;
42
46
  });
43
47
  }
44
- setTableInnerContainerWidth(tableInnerContainer?.clientWidth ? `${tableInnerContainer.clientWidth}px` : "100%");
48
+ setTableInnerContainerWidth(tableInnerContainer?.clientWidth ? `${tableInnerContainer.clientWidth - Number(odysseyDesignTokens.BorderWidthMain) * 2}px` : "100%");
45
49
  }, 100);
46
50
  });
47
51
  if (tableOuterContainer && tableOuterContainer.parentElement) {
@@ -58,7 +62,7 @@ export const useScrollIndication = ({
58
62
  animationFrameIdRef.current = null;
59
63
  }
60
64
  };
61
- }, [checkScrollIndicators, setTableInnerContainerWidth, tableOuterContainer, tableInnerContainer, setIsTableContainerScrolledToStart, setIsTableContainerScrolledToEnd]);
65
+ }, [checkScrollIndicators, setTableInnerContainerWidth, tableOuterContainer, tableInnerContainer, setIsTableContainerScrolledToStart, setIsTableContainerScrolledToEnd, odysseyDesignTokens.BorderWidthMain]);
62
66
  useEffect(() => {
63
67
  tableInnerContainer?.addEventListener("scroll", checkScrollIndicators);
64
68
  return () => tableInnerContainer?.removeEventListener("scroll", checkScrollIndicators);