@okta/odyssey-react-mui 1.21.2 → 1.23.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 (593) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/@types/i18next.d.js.map +1 -1
  3. package/dist/Autocomplete.js +106 -38
  4. package/dist/Autocomplete.js.map +1 -1
  5. package/dist/Callout.js +12 -24
  6. package/dist/Callout.js.map +1 -1
  7. package/dist/Checkbox.js +26 -11
  8. package/dist/Checkbox.js.map +1 -1
  9. package/dist/CheckboxGroup.js +14 -3
  10. package/dist/CheckboxGroup.js.map +1 -1
  11. package/dist/DataTable/DataTable.js +10 -2
  12. package/dist/DataTable/DataTable.js.map +1 -1
  13. package/dist/DataTable/useScrollIndication.js +9 -5
  14. package/dist/DataTable/useScrollIndication.js.map +1 -1
  15. package/dist/Field.js +3 -1
  16. package/dist/Field.js.map +1 -1
  17. package/dist/FileUploader/FileUploadIllustration.js.map +1 -0
  18. package/dist/FileUploader/FileUploadPreview.js.map +1 -0
  19. package/dist/{labs/FileUpload.js → FileUploader/FileUploader.js} +6 -5
  20. package/dist/FileUploader/FileUploader.js.map +1 -0
  21. package/dist/FileUploader/index.js +13 -0
  22. package/dist/FileUploader/index.js.map +1 -0
  23. package/dist/OdysseyCacheProvider.js +4 -3
  24. package/dist/OdysseyCacheProvider.js.map +1 -1
  25. package/dist/OdysseyProvider.js +10 -3
  26. package/dist/OdysseyProvider.js.map +1 -1
  27. package/dist/OdysseyThemeProvider.js +3 -2
  28. package/dist/OdysseyThemeProvider.js.map +1 -1
  29. package/dist/Radio.js +33 -6
  30. package/dist/Radio.js.map +1 -1
  31. package/dist/RadioGroup.js +17 -5
  32. package/dist/RadioGroup.js.map +1 -1
  33. package/dist/Select.js +89 -31
  34. package/dist/Select.js.map +1 -1
  35. package/dist/{labs/Switch.js → Switch.js} +77 -23
  36. package/dist/Switch.js.map +1 -0
  37. package/dist/Tabs.js +7 -9
  38. package/dist/Tabs.js.map +1 -1
  39. package/dist/Tag.js +102 -4
  40. package/dist/Tag.js.map +1 -1
  41. package/dist/TextField.js +16 -39
  42. package/dist/TextField.js.map +1 -1
  43. package/dist/Toast.js +2 -2
  44. package/dist/Toast.js.map +1 -1
  45. package/dist/ToastStack.js.map +1 -1
  46. package/dist/createShadowDomElements.js +43 -0
  47. package/dist/createShadowDomElements.js.map +1 -0
  48. package/dist/i18n.js +1 -1
  49. package/dist/i18n.js.map +1 -1
  50. package/dist/index.js +3 -2
  51. package/dist/index.js.map +1 -1
  52. package/dist/index.scss +96 -8
  53. package/dist/labs/AppTile.js +124 -0
  54. package/dist/labs/AppTile.js.map +1 -0
  55. package/dist/labs/DataView/BulkActionsMenu.js.map +1 -0
  56. package/dist/labs/{DataComponents/StackContent.js → DataView/CardLayoutContent.js} +14 -14
  57. package/dist/labs/DataView/CardLayoutContent.js.map +1 -0
  58. package/dist/labs/{DataComponents/StackCard.js → DataView/DataCard.js} +6 -6
  59. package/dist/labs/DataView/DataCard.js.map +1 -0
  60. package/dist/labs/{DataComponents → DataView}/DataTable.js +6 -2
  61. package/dist/labs/DataView/DataTable.js.map +1 -0
  62. package/dist/labs/{DataComponents → DataView}/DataView.js +79 -30
  63. package/dist/labs/DataView/DataView.js.map +1 -0
  64. package/dist/labs/DataView/DetailPanel.js.map +1 -0
  65. package/dist/labs/DataView/LayoutSwitcher.js.map +1 -0
  66. package/dist/labs/DataView/RowActions.js.map +1 -0
  67. package/dist/labs/{DataComponents/TableContent.js → DataView/TableLayoutContent.js} +34 -20
  68. package/dist/labs/DataView/TableLayoutContent.js.map +1 -0
  69. package/dist/labs/{DataComponents → DataView}/TableSettings.js +2 -2
  70. package/dist/labs/DataView/TableSettings.js.map +1 -0
  71. package/dist/labs/DataView/componentTypes.js.map +1 -0
  72. package/dist/labs/{DataComponents → DataView}/constants.js +2 -2
  73. package/dist/labs/DataView/constants.js.map +1 -0
  74. package/dist/labs/DataView/dataTypes.js.map +1 -0
  75. package/dist/labs/DataView/fetchData.js.map +1 -0
  76. package/dist/labs/{DataComponents → DataView}/index.js +0 -1
  77. package/dist/labs/DataView/index.js.map +1 -0
  78. package/dist/labs/DataView/tableConstants.js.map +1 -0
  79. package/dist/labs/DataView/useFilterConversion.js.map +1 -0
  80. package/dist/labs/DateField.js +2 -0
  81. package/dist/labs/DateField.js.map +1 -1
  82. package/dist/labs/DatePicker.js +5 -1
  83. package/dist/labs/DatePicker.js.map +1 -1
  84. package/dist/labs/SideNav/CollapseIcon.js +44 -0
  85. package/dist/labs/SideNav/CollapseIcon.js.map +1 -0
  86. package/dist/labs/SideNav/OktaLogo.js +36 -0
  87. package/dist/labs/SideNav/OktaLogo.js.map +1 -0
  88. package/dist/labs/SideNav/SideNav.js +335 -0
  89. package/dist/labs/SideNav/SideNav.js.map +1 -0
  90. package/dist/labs/SideNav/SideNavFooterContent.js +49 -0
  91. package/dist/labs/SideNav/SideNavFooterContent.js.map +1 -0
  92. package/dist/labs/SideNav/SideNavHeader.js +81 -0
  93. package/dist/labs/SideNav/SideNavHeader.js.map +1 -0
  94. package/dist/labs/SideNav/SideNavItemContent.js +157 -0
  95. package/dist/labs/SideNav/SideNavItemContent.js.map +1 -0
  96. package/dist/labs/SideNav/SideNavItemLinkContent.js +71 -0
  97. package/dist/labs/SideNav/SideNavItemLinkContent.js.map +1 -0
  98. package/dist/labs/SideNav/index.js +14 -0
  99. package/dist/labs/SideNav/index.js.map +1 -0
  100. package/dist/labs/SideNav/types.js +2 -0
  101. package/dist/labs/SideNav/types.js.map +1 -0
  102. package/dist/labs/TopNav.js +2 -1
  103. package/dist/labs/TopNav.js.map +1 -1
  104. package/dist/labs/index.js +3 -4
  105. package/dist/labs/index.js.map +1 -1
  106. package/dist/labs/useDateFieldsTranslations.js +1 -1
  107. package/dist/labs/useDateFieldsTranslations.js.map +1 -1
  108. package/dist/properties/ts/odyssey-react-mui.js +3 -1
  109. package/dist/properties/ts/odyssey-react-mui.js.map +1 -1
  110. package/dist/properties/ts/odyssey-react-mui_cs.js +17 -3
  111. package/dist/properties/ts/odyssey-react-mui_cs.js.map +1 -1
  112. package/dist/properties/ts/odyssey-react-mui_da.js +17 -3
  113. package/dist/properties/ts/odyssey-react-mui_da.js.map +1 -1
  114. package/dist/properties/ts/odyssey-react-mui_de.js +16 -2
  115. package/dist/properties/ts/odyssey-react-mui_de.js.map +1 -1
  116. package/dist/properties/ts/odyssey-react-mui_el.js +18 -4
  117. package/dist/properties/ts/odyssey-react-mui_el.js.map +1 -1
  118. package/dist/properties/ts/odyssey-react-mui_es.js +17 -3
  119. package/dist/properties/ts/odyssey-react-mui_es.js.map +1 -1
  120. package/dist/properties/ts/odyssey-react-mui_fi.js +17 -3
  121. package/dist/properties/ts/odyssey-react-mui_fi.js.map +1 -1
  122. package/dist/properties/ts/odyssey-react-mui_fr.js +17 -3
  123. package/dist/properties/ts/odyssey-react-mui_fr.js.map +1 -1
  124. package/dist/properties/ts/odyssey-react-mui_ht.js +18 -4
  125. package/dist/properties/ts/odyssey-react-mui_ht.js.map +1 -1
  126. package/dist/properties/ts/odyssey-react-mui_hu.js +17 -3
  127. package/dist/properties/ts/odyssey-react-mui_hu.js.map +1 -1
  128. package/dist/properties/ts/odyssey-react-mui_id.js +17 -3
  129. package/dist/properties/ts/odyssey-react-mui_id.js.map +1 -1
  130. package/dist/properties/ts/odyssey-react-mui_it.js +17 -3
  131. package/dist/properties/ts/odyssey-react-mui_it.js.map +1 -1
  132. package/dist/properties/ts/odyssey-react-mui_ja.js +16 -2
  133. package/dist/properties/ts/odyssey-react-mui_ja.js.map +1 -1
  134. package/dist/properties/ts/odyssey-react-mui_ko.js +16 -2
  135. package/dist/properties/ts/odyssey-react-mui_ko.js.map +1 -1
  136. package/dist/properties/ts/odyssey-react-mui_ms.js +17 -3
  137. package/dist/properties/ts/odyssey-react-mui_ms.js.map +1 -1
  138. package/dist/properties/ts/odyssey-react-mui_nb.js +17 -3
  139. package/dist/properties/ts/odyssey-react-mui_nb.js.map +1 -1
  140. package/dist/properties/ts/odyssey-react-mui_nl_NL.js +17 -3
  141. package/dist/properties/ts/odyssey-react-mui_nl_NL.js.map +1 -1
  142. package/dist/properties/ts/odyssey-react-mui_pl.js +17 -3
  143. package/dist/properties/ts/odyssey-react-mui_pl.js.map +1 -1
  144. package/dist/properties/ts/odyssey-react-mui_pt_BR.js +17 -3
  145. package/dist/properties/ts/odyssey-react-mui_pt_BR.js.map +1 -1
  146. package/dist/properties/ts/odyssey-react-mui_ro.js +17 -3
  147. package/dist/properties/ts/odyssey-react-mui_ro.js.map +1 -1
  148. package/dist/properties/ts/odyssey-react-mui_ru.js +17 -3
  149. package/dist/properties/ts/odyssey-react-mui_ru.js.map +1 -1
  150. package/dist/properties/ts/odyssey-react-mui_sv.js +17 -3
  151. package/dist/properties/ts/odyssey-react-mui_sv.js.map +1 -1
  152. package/dist/properties/ts/odyssey-react-mui_th.js +16 -2
  153. package/dist/properties/ts/odyssey-react-mui_th.js.map +1 -1
  154. package/dist/properties/ts/odyssey-react-mui_tr.js +17 -3
  155. package/dist/properties/ts/odyssey-react-mui_tr.js.map +1 -1
  156. package/dist/properties/ts/odyssey-react-mui_uk.js +17 -3
  157. package/dist/properties/ts/odyssey-react-mui_uk.js.map +1 -1
  158. package/dist/properties/ts/odyssey-react-mui_vi.js +17 -3
  159. package/dist/properties/ts/odyssey-react-mui_vi.js.map +1 -1
  160. package/dist/properties/ts/odyssey-react-mui_zh_CN.js +16 -2
  161. package/dist/properties/ts/odyssey-react-mui_zh_CN.js.map +1 -1
  162. package/dist/properties/ts/odyssey-react-mui_zh_TW.js +16 -2
  163. package/dist/properties/ts/odyssey-react-mui_zh_TW.js.map +1 -1
  164. package/dist/src/Autocomplete.d.ts +30 -0
  165. package/dist/src/Autocomplete.d.ts.map +1 -1
  166. package/dist/src/Callout.d.ts +11 -23
  167. package/dist/src/Callout.d.ts.map +1 -1
  168. package/dist/src/Checkbox.d.ts +2 -2
  169. package/dist/src/Checkbox.d.ts.map +1 -1
  170. package/dist/src/CheckboxGroup.d.ts +3 -3
  171. package/dist/src/CheckboxGroup.d.ts.map +1 -1
  172. package/dist/src/DataTable/DataTable.d.ts +9 -1
  173. package/dist/src/DataTable/DataTable.d.ts.map +1 -1
  174. package/dist/src/DataTable/useScrollIndication.d.ts.map +1 -1
  175. package/dist/src/Field.d.ts +3 -2
  176. package/dist/src/Field.d.ts.map +1 -1
  177. package/dist/src/FileUploader/FileUploadIllustration.d.ts.map +1 -0
  178. package/dist/src/{labs → FileUploader}/FileUploadPreview.d.ts +2 -2
  179. package/dist/src/FileUploader/FileUploadPreview.d.ts.map +1 -0
  180. package/dist/src/{labs/FileUpload.d.ts → FileUploader/FileUploader.d.ts} +5 -4
  181. package/dist/src/FileUploader/FileUploader.d.ts.map +1 -0
  182. package/dist/src/FileUploader/index.d.ts +13 -0
  183. package/dist/src/FileUploader/index.d.ts.map +1 -0
  184. package/dist/src/NativeSelect.d.ts +1 -1
  185. package/dist/src/OdysseyCacheProvider.d.ts +7 -3
  186. package/dist/src/OdysseyCacheProvider.d.ts.map +1 -1
  187. package/dist/src/OdysseyProvider.d.ts +1 -1
  188. package/dist/src/OdysseyProvider.d.ts.map +1 -1
  189. package/dist/src/OdysseyThemeProvider.d.ts +3 -1
  190. package/dist/src/OdysseyThemeProvider.d.ts.map +1 -1
  191. package/dist/src/OdysseyTranslationProvider.d.ts +1 -1
  192. package/dist/src/OdysseyTranslationProvider.d.ts.map +1 -1
  193. package/dist/src/PasswordField.d.ts +1 -1
  194. package/dist/src/Radio.d.ts +6 -8
  195. package/dist/src/Radio.d.ts.map +1 -1
  196. package/dist/src/RadioGroup.d.ts +4 -5
  197. package/dist/src/RadioGroup.d.ts.map +1 -1
  198. package/dist/src/SearchField.d.ts +1 -1
  199. package/dist/src/Select.d.ts +38 -2
  200. package/dist/src/Select.d.ts.map +1 -1
  201. package/dist/src/{labs/Switch.d.ts → Switch.d.ts} +8 -4
  202. package/dist/src/Switch.d.ts.map +1 -0
  203. package/dist/src/Tabs.d.ts +6 -8
  204. package/dist/src/Tabs.d.ts.map +1 -1
  205. package/dist/src/Tag.d.ts +7 -1
  206. package/dist/src/Tag.d.ts.map +1 -1
  207. package/dist/src/TextField.d.ts +17 -40
  208. package/dist/src/TextField.d.ts.map +1 -1
  209. package/dist/src/ToastStack.d.ts +2 -2
  210. package/dist/src/ToastStack.d.ts.map +1 -1
  211. package/dist/src/{createShadowRootElement.d.ts → createShadowDomElements.d.ts} +6 -1
  212. package/dist/src/createShadowDomElements.d.ts.map +1 -0
  213. package/dist/src/i18n.d.ts +2 -2
  214. package/dist/src/i18n.d.ts.map +1 -1
  215. package/dist/src/index.d.ts +3 -2
  216. package/dist/src/index.d.ts.map +1 -1
  217. package/dist/src/labs/AppTile.d.ts +39 -0
  218. package/dist/src/labs/AppTile.d.ts.map +1 -0
  219. package/dist/src/labs/DataView/BulkActionsMenu.d.ts.map +1 -0
  220. package/dist/src/labs/{DataComponents/StackContent.d.ts → DataView/CardLayoutContent.d.ts} +7 -7
  221. package/dist/src/labs/DataView/CardLayoutContent.d.ts.map +1 -0
  222. package/dist/src/labs/{DataComponents/StackCard.d.ts → DataView/DataCard.d.ts} +4 -4
  223. package/dist/src/labs/DataView/DataCard.d.ts.map +1 -0
  224. package/dist/src/labs/DataView/DataTable.d.ts +16 -0
  225. package/dist/src/labs/DataView/DataTable.d.ts.map +1 -0
  226. package/dist/src/labs/{DataComponents → DataView}/DataView.d.ts +1 -1
  227. package/dist/src/labs/DataView/DataView.d.ts.map +1 -0
  228. package/dist/src/labs/{DataComponents → DataView}/DetailPanel.d.ts +2 -2
  229. package/dist/src/labs/DataView/DetailPanel.d.ts.map +1 -0
  230. package/dist/src/labs/DataView/LayoutSwitcher.d.ts.map +1 -0
  231. package/dist/src/labs/DataView/RowActions.d.ts.map +1 -0
  232. package/dist/src/labs/{DataComponents/TableContent.d.ts → DataView/TableLayoutContent.d.ts} +8 -7
  233. package/dist/src/labs/DataView/TableLayoutContent.d.ts.map +1 -0
  234. package/dist/src/labs/{DataComponents → DataView}/TableSettings.d.ts +3 -3
  235. package/dist/src/labs/DataView/TableSettings.d.ts.map +1 -0
  236. package/dist/src/labs/{DataComponents → DataView}/componentTypes.d.ts +21 -9
  237. package/dist/src/labs/DataView/componentTypes.d.ts.map +1 -0
  238. package/dist/src/labs/{DataComponents → DataView}/constants.d.ts +1 -1
  239. package/dist/src/labs/DataView/constants.d.ts.map +1 -0
  240. package/dist/src/labs/DataView/dataTypes.d.ts.map +1 -0
  241. package/dist/src/labs/DataView/fetchData.d.ts.map +1 -0
  242. package/dist/src/labs/{DataComponents → DataView}/index.d.ts +0 -1
  243. package/dist/src/labs/DataView/index.d.ts.map +1 -0
  244. package/dist/src/labs/DataView/tableConstants.d.ts.map +1 -0
  245. package/dist/src/labs/{DataComponents → DataView}/useFilterConversion.d.ts +2 -2
  246. package/dist/src/labs/DataView/useFilterConversion.d.ts.map +1 -0
  247. package/dist/src/labs/DateField.d.ts +2 -2
  248. package/dist/src/labs/DateField.d.ts.map +1 -1
  249. package/dist/src/labs/DatePicker.d.ts +2 -2
  250. package/dist/src/labs/DatePicker.d.ts.map +1 -1
  251. package/dist/src/labs/SideNav/CollapseIcon.d.ts +17 -0
  252. package/dist/src/labs/SideNav/CollapseIcon.d.ts.map +1 -0
  253. package/dist/src/labs/SideNav/OktaLogo.d.ts +14 -0
  254. package/dist/src/labs/SideNav/OktaLogo.d.ts.map +1 -0
  255. package/dist/src/labs/SideNav/SideNav.d.ts +16 -0
  256. package/dist/src/labs/SideNav/SideNav.d.ts.map +1 -0
  257. package/dist/{test-selectors/odysseyTestSelectors.js → src/labs/SideNav/SideNavFooterContent.d.ts} +6 -9
  258. package/dist/src/labs/SideNav/SideNavFooterContent.d.ts.map +1 -0
  259. package/dist/src/labs/SideNav/SideNavHeader.d.ts +16 -0
  260. package/dist/src/labs/SideNav/SideNavHeader.d.ts.map +1 -0
  261. package/dist/src/labs/SideNav/SideNavItemContent.d.ts +33 -0
  262. package/dist/src/labs/SideNav/SideNavItemContent.d.ts.map +1 -0
  263. package/dist/src/labs/SideNav/SideNavItemLinkContent.d.ts +16 -0
  264. package/dist/src/labs/SideNav/SideNavItemLinkContent.d.ts.map +1 -0
  265. package/dist/src/labs/SideNav/index.d.ts +14 -0
  266. package/dist/src/labs/SideNav/index.d.ts.map +1 -0
  267. package/dist/src/labs/{SideNav.d.ts → SideNav/types.d.ts} +54 -33
  268. package/dist/src/labs/SideNav/types.d.ts.map +1 -0
  269. package/dist/src/labs/TopNav.d.ts +1 -0
  270. package/dist/src/labs/TopNav.d.ts.map +1 -1
  271. package/dist/src/labs/index.d.ts +2 -3
  272. package/dist/src/labs/index.d.ts.map +1 -1
  273. package/dist/src/properties/ts/odyssey-react-mui.d.ts +2 -0
  274. package/dist/src/properties/ts/odyssey-react-mui.d.ts.map +1 -1
  275. package/dist/src/properties/ts/odyssey-react-mui_cs.d.ts +15 -1
  276. package/dist/src/properties/ts/odyssey-react-mui_cs.d.ts.map +1 -1
  277. package/dist/src/properties/ts/odyssey-react-mui_da.d.ts +15 -1
  278. package/dist/src/properties/ts/odyssey-react-mui_da.d.ts.map +1 -1
  279. package/dist/src/properties/ts/odyssey-react-mui_de.d.ts +15 -1
  280. package/dist/src/properties/ts/odyssey-react-mui_de.d.ts.map +1 -1
  281. package/dist/src/properties/ts/odyssey-react-mui_el.d.ts +15 -1
  282. package/dist/src/properties/ts/odyssey-react-mui_el.d.ts.map +1 -1
  283. package/dist/src/properties/ts/odyssey-react-mui_es.d.ts +15 -1
  284. package/dist/src/properties/ts/odyssey-react-mui_es.d.ts.map +1 -1
  285. package/dist/src/properties/ts/odyssey-react-mui_fi.d.ts +15 -1
  286. package/dist/src/properties/ts/odyssey-react-mui_fi.d.ts.map +1 -1
  287. package/dist/src/properties/ts/odyssey-react-mui_fr.d.ts +15 -1
  288. package/dist/src/properties/ts/odyssey-react-mui_fr.d.ts.map +1 -1
  289. package/dist/src/properties/ts/odyssey-react-mui_ht.d.ts +16 -2
  290. package/dist/src/properties/ts/odyssey-react-mui_ht.d.ts.map +1 -1
  291. package/dist/src/properties/ts/odyssey-react-mui_hu.d.ts +15 -1
  292. package/dist/src/properties/ts/odyssey-react-mui_hu.d.ts.map +1 -1
  293. package/dist/src/properties/ts/odyssey-react-mui_id.d.ts +15 -1
  294. package/dist/src/properties/ts/odyssey-react-mui_id.d.ts.map +1 -1
  295. package/dist/src/properties/ts/odyssey-react-mui_it.d.ts +15 -1
  296. package/dist/src/properties/ts/odyssey-react-mui_it.d.ts.map +1 -1
  297. package/dist/src/properties/ts/odyssey-react-mui_ja.d.ts +15 -1
  298. package/dist/src/properties/ts/odyssey-react-mui_ja.d.ts.map +1 -1
  299. package/dist/src/properties/ts/odyssey-react-mui_ko.d.ts +15 -1
  300. package/dist/src/properties/ts/odyssey-react-mui_ko.d.ts.map +1 -1
  301. package/dist/src/properties/ts/odyssey-react-mui_ms.d.ts +15 -1
  302. package/dist/src/properties/ts/odyssey-react-mui_ms.d.ts.map +1 -1
  303. package/dist/src/properties/ts/odyssey-react-mui_nb.d.ts +15 -1
  304. package/dist/src/properties/ts/odyssey-react-mui_nb.d.ts.map +1 -1
  305. package/dist/src/properties/ts/odyssey-react-mui_nl_NL.d.ts +15 -1
  306. package/dist/src/properties/ts/odyssey-react-mui_nl_NL.d.ts.map +1 -1
  307. package/dist/src/properties/ts/odyssey-react-mui_pl.d.ts +15 -1
  308. package/dist/src/properties/ts/odyssey-react-mui_pl.d.ts.map +1 -1
  309. package/dist/src/properties/ts/odyssey-react-mui_pt_BR.d.ts +15 -1
  310. package/dist/src/properties/ts/odyssey-react-mui_pt_BR.d.ts.map +1 -1
  311. package/dist/src/properties/ts/odyssey-react-mui_ro.d.ts +15 -1
  312. package/dist/src/properties/ts/odyssey-react-mui_ro.d.ts.map +1 -1
  313. package/dist/src/properties/ts/odyssey-react-mui_ru.d.ts +15 -1
  314. package/dist/src/properties/ts/odyssey-react-mui_ru.d.ts.map +1 -1
  315. package/dist/src/properties/ts/odyssey-react-mui_sv.d.ts +15 -1
  316. package/dist/src/properties/ts/odyssey-react-mui_sv.d.ts.map +1 -1
  317. package/dist/src/properties/ts/odyssey-react-mui_th.d.ts +15 -1
  318. package/dist/src/properties/ts/odyssey-react-mui_th.d.ts.map +1 -1
  319. package/dist/src/properties/ts/odyssey-react-mui_tr.d.ts +15 -1
  320. package/dist/src/properties/ts/odyssey-react-mui_tr.d.ts.map +1 -1
  321. package/dist/src/properties/ts/odyssey-react-mui_uk.d.ts +15 -1
  322. package/dist/src/properties/ts/odyssey-react-mui_uk.d.ts.map +1 -1
  323. package/dist/src/properties/ts/odyssey-react-mui_vi.d.ts +15 -1
  324. package/dist/src/properties/ts/odyssey-react-mui_vi.d.ts.map +1 -1
  325. package/dist/src/properties/ts/odyssey-react-mui_zh_CN.d.ts +15 -1
  326. package/dist/src/properties/ts/odyssey-react-mui_zh_CN.d.ts.map +1 -1
  327. package/dist/src/properties/ts/odyssey-react-mui_zh_TW.d.ts +15 -1
  328. package/dist/src/properties/ts/odyssey-react-mui_zh_TW.d.ts.map +1 -1
  329. package/dist/src/test-selectors/getByQuerySelector.d.ts +148 -0
  330. package/dist/src/test-selectors/getByQuerySelector.d.ts.map +1 -0
  331. package/dist/src/test-selectors/getComputedAccessibleErrorMessageText.d.ts +14 -0
  332. package/dist/src/test-selectors/getComputedAccessibleErrorMessageText.d.ts.map +1 -0
  333. package/dist/src/test-selectors/getComputedAccessibleText.d.ts +23 -0
  334. package/dist/src/test-selectors/getComputedAccessibleText.d.ts.map +1 -0
  335. package/dist/src/test-selectors/index.d.ts +2 -2
  336. package/dist/src/test-selectors/index.d.ts.map +1 -1
  337. package/{src/test-selectors/odysseyTestSelectors.ts → dist/src/test-selectors/interpolateString.d.ts} +4 -11
  338. package/dist/src/test-selectors/interpolateString.d.ts.map +1 -0
  339. package/dist/src/test-selectors/linkedHtmlSelectors.d.ts +24 -0
  340. package/dist/src/test-selectors/linkedHtmlSelectors.d.ts.map +1 -0
  341. package/dist/src/test-selectors/queryOdysseySelector.d.ts +5755 -0
  342. package/dist/src/test-selectors/queryOdysseySelector.d.ts.map +1 -0
  343. package/dist/src/test-selectors/querySelector.d.ts +59 -3613
  344. package/dist/src/test-selectors/querySelector.d.ts.map +1 -1
  345. package/dist/src/test-selectors/sanityChecks.d.ts +18 -0
  346. package/dist/src/test-selectors/sanityChecks.d.ts.map +1 -0
  347. package/dist/src/test-selectors/testSelector.d.ts +46 -0
  348. package/dist/src/test-selectors/testSelector.d.ts.map +1 -0
  349. package/dist/src/theme/components.d.ts +3 -1
  350. package/dist/src/theme/components.d.ts.map +1 -1
  351. package/dist/src/theme/createOdysseyMuiTheme.d.ts +3 -1
  352. package/dist/src/theme/createOdysseyMuiTheme.d.ts.map +1 -1
  353. package/dist/test-selectors/getByQuerySelector.js +64 -0
  354. package/dist/test-selectors/getByQuerySelector.js.map +1 -0
  355. package/dist/test-selectors/getComputedAccessibleErrorMessageText.js +25 -0
  356. package/dist/test-selectors/getComputedAccessibleErrorMessageText.js.map +1 -0
  357. package/dist/test-selectors/getComputedAccessibleText.js +24 -0
  358. package/dist/test-selectors/getComputedAccessibleText.js.map +1 -0
  359. package/dist/test-selectors/index.js +2 -2
  360. package/dist/test-selectors/index.js.map +1 -1
  361. package/dist/test-selectors/interpolateString.js +25 -0
  362. package/dist/test-selectors/interpolateString.js.map +1 -0
  363. package/dist/test-selectors/linkedHtmlSelectors.js +34 -0
  364. package/dist/test-selectors/linkedHtmlSelectors.js.map +1 -0
  365. package/dist/test-selectors/queryOdysseySelector.js +26 -0
  366. package/dist/test-selectors/queryOdysseySelector.js.map +1 -0
  367. package/dist/test-selectors/querySelector.js +82 -58
  368. package/dist/test-selectors/querySelector.js.map +1 -1
  369. package/dist/test-selectors/sanityChecks.js +33 -0
  370. package/dist/test-selectors/sanityChecks.js.map +1 -0
  371. package/dist/test-selectors/testSelector.js +2 -0
  372. package/dist/test-selectors/testSelector.js.map +1 -0
  373. package/dist/test-selectors/testSelectors.json +1 -1
  374. package/dist/theme/components.js +231 -146
  375. package/dist/theme/components.js.map +1 -1
  376. package/dist/theme/createOdysseyMuiTheme.js +3 -2
  377. package/dist/theme/createOdysseyMuiTheme.js.map +1 -1
  378. package/dist/tsconfig.production.tsbuildinfo +1 -1
  379. package/dist/tsconfig.tsbuildinfo +1 -1
  380. package/jest.setup.js +3 -0
  381. package/package.json +5 -5
  382. package/scripts/generateTestSelectorsJson.ts +1 -1
  383. package/src/@types/i18next.d.ts +1 -1
  384. package/src/Autocomplete.tsx +140 -45
  385. package/src/Callout.tsx +13 -25
  386. package/src/Checkbox.tsx +39 -9
  387. package/src/CheckboxGroup.tsx +20 -4
  388. package/src/DataTable/DataTable.tsx +24 -1
  389. package/src/DataTable/useScrollIndication.tsx +11 -4
  390. package/src/Field.tsx +5 -2
  391. package/src/{labs → FileUploader}/FileUploadPreview.tsx +3 -3
  392. package/src/{labs/FileUpload.tsx → FileUploader/FileUploader.tsx} +7 -6
  393. package/src/FileUploader/index.ts +13 -0
  394. package/src/OdysseyCacheProvider.test.tsx +1 -0
  395. package/src/OdysseyCacheProvider.tsx +18 -4
  396. package/src/OdysseyProvider.tsx +12 -4
  397. package/src/OdysseyThemeProvider.tsx +6 -2
  398. package/src/Radio.tsx +41 -12
  399. package/src/RadioGroup.tsx +26 -7
  400. package/src/Select.tsx +116 -45
  401. package/src/{labs/Switch.tsx → Switch.tsx} +95 -41
  402. package/src/Tabs.tsx +8 -10
  403. package/src/Tag.tsx +134 -3
  404. package/src/TextField.tsx +18 -41
  405. package/src/Toast.tsx +1 -1
  406. package/src/ToastStack.tsx +2 -2
  407. package/src/createShadowDomElements.ts +53 -0
  408. package/src/i18n.ts +3 -3
  409. package/src/index.ts +7 -2
  410. package/src/labs/AppTile.tsx +200 -0
  411. package/src/labs/{DataComponents/StackContent.tsx → DataView/CardLayoutContent.tsx} +24 -19
  412. package/src/labs/{DataComponents/StackCard.tsx → DataView/DataCard.tsx} +7 -7
  413. package/src/labs/{DataComponents → DataView}/DataTable.tsx +8 -4
  414. package/src/labs/DataView/DataView.test.tsx +158 -0
  415. package/src/labs/{DataComponents → DataView}/DataView.tsx +119 -42
  416. package/src/labs/{DataComponents → DataView}/DetailPanel.tsx +2 -2
  417. package/src/labs/{DataComponents/TableContent.tsx → DataView/TableLayoutContent.tsx} +59 -27
  418. package/src/labs/{DataComponents → DataView}/TableSettings.tsx +5 -4
  419. package/src/labs/{DataComponents → DataView}/componentTypes.ts +24 -9
  420. package/src/labs/{DataComponents → DataView}/constants.tsx +2 -2
  421. package/src/labs/{DataComponents → DataView}/index.tsx +0 -1
  422. package/src/labs/{DataComponents → DataView}/useFilterConversion.ts +2 -2
  423. package/src/labs/DateField.tsx +3 -0
  424. package/src/labs/DatePicker.tsx +12 -1
  425. package/src/labs/SideNav/CollapseIcon.tsx +48 -0
  426. package/src/labs/SideNav/OktaLogo.tsx +39 -0
  427. package/src/labs/SideNav/SideNav.tsx +486 -0
  428. package/src/labs/SideNav/SideNavFooterContent.tsx +64 -0
  429. package/src/labs/SideNav/SideNavHeader.tsx +88 -0
  430. package/src/labs/SideNav/SideNavItemContent.tsx +216 -0
  431. package/src/labs/SideNav/SideNavItemLinkContent.tsx +87 -0
  432. package/src/labs/SideNav/index.ts +15 -0
  433. package/src/labs/SideNav/types.ts +152 -0
  434. package/src/labs/TopNav.tsx +3 -1
  435. package/src/labs/index.ts +3 -4
  436. package/src/labs/useDateFieldsTranslations.ts +1 -1
  437. package/src/properties/odyssey-react-mui.properties +2 -1
  438. package/src/properties/translations/odyssey-react-mui_cs.properties +15 -3
  439. package/src/properties/translations/odyssey-react-mui_da.properties +15 -3
  440. package/src/properties/translations/odyssey-react-mui_de.properties +14 -2
  441. package/src/properties/translations/odyssey-react-mui_el.properties +16 -4
  442. package/src/properties/translations/odyssey-react-mui_es.properties +15 -3
  443. package/src/properties/translations/odyssey-react-mui_fi.properties +15 -3
  444. package/src/properties/translations/odyssey-react-mui_fr.properties +15 -3
  445. package/src/properties/translations/odyssey-react-mui_ht.properties +17 -6
  446. package/src/properties/translations/odyssey-react-mui_hu.properties +15 -3
  447. package/src/properties/translations/odyssey-react-mui_id.properties +15 -3
  448. package/src/properties/translations/odyssey-react-mui_it.properties +15 -3
  449. package/src/properties/translations/odyssey-react-mui_ja.properties +14 -2
  450. package/src/properties/translations/odyssey-react-mui_ko.properties +14 -2
  451. package/src/properties/translations/odyssey-react-mui_ms.properties +15 -3
  452. package/src/properties/translations/odyssey-react-mui_nb.properties +15 -3
  453. package/src/properties/translations/odyssey-react-mui_nl_NL.properties +15 -3
  454. package/src/properties/translations/odyssey-react-mui_pl.properties +15 -3
  455. package/src/properties/translations/odyssey-react-mui_pt_BR.properties +15 -3
  456. package/src/properties/translations/odyssey-react-mui_ro.properties +15 -3
  457. package/src/properties/translations/odyssey-react-mui_ru.properties +15 -3
  458. package/src/properties/translations/odyssey-react-mui_sv.properties +15 -3
  459. package/src/properties/translations/odyssey-react-mui_th.properties +14 -2
  460. package/src/properties/translations/odyssey-react-mui_tr.properties +15 -3
  461. package/src/properties/translations/odyssey-react-mui_uk.properties +15 -3
  462. package/src/properties/translations/odyssey-react-mui_vi.properties +15 -3
  463. package/src/properties/translations/odyssey-react-mui_zh_CN.properties +14 -2
  464. package/src/properties/translations/odyssey-react-mui_zh_TW.properties +14 -2
  465. package/src/properties/ts/odyssey-react-mui.ts +1 -1
  466. package/src/properties/ts/odyssey-react-mui_cs.ts +1 -1
  467. package/src/properties/ts/odyssey-react-mui_da.ts +1 -1
  468. package/src/properties/ts/odyssey-react-mui_de.ts +1 -1
  469. package/src/properties/ts/odyssey-react-mui_el.ts +1 -1
  470. package/src/properties/ts/odyssey-react-mui_es.ts +1 -1
  471. package/src/properties/ts/odyssey-react-mui_fi.ts +1 -1
  472. package/src/properties/ts/odyssey-react-mui_fr.ts +1 -1
  473. package/src/properties/ts/odyssey-react-mui_ht.ts +1 -1
  474. package/src/properties/ts/odyssey-react-mui_hu.ts +1 -1
  475. package/src/properties/ts/odyssey-react-mui_id.ts +1 -1
  476. package/src/properties/ts/odyssey-react-mui_it.ts +1 -1
  477. package/src/properties/ts/odyssey-react-mui_ja.ts +1 -1
  478. package/src/properties/ts/odyssey-react-mui_ko.ts +1 -1
  479. package/src/properties/ts/odyssey-react-mui_ms.ts +1 -1
  480. package/src/properties/ts/odyssey-react-mui_nb.ts +1 -1
  481. package/src/properties/ts/odyssey-react-mui_nl_NL.ts +1 -1
  482. package/src/properties/ts/odyssey-react-mui_pl.ts +1 -1
  483. package/src/properties/ts/odyssey-react-mui_pt_BR.ts +1 -1
  484. package/src/properties/ts/odyssey-react-mui_ro.ts +1 -1
  485. package/src/properties/ts/odyssey-react-mui_ru.ts +1 -1
  486. package/src/properties/ts/odyssey-react-mui_sv.ts +1 -1
  487. package/src/properties/ts/odyssey-react-mui_th.ts +1 -1
  488. package/src/properties/ts/odyssey-react-mui_tr.ts +1 -1
  489. package/src/properties/ts/odyssey-react-mui_uk.ts +1 -1
  490. package/src/properties/ts/odyssey-react-mui_vi.ts +1 -1
  491. package/src/properties/ts/odyssey-react-mui_zh_CN.ts +1 -1
  492. package/src/properties/ts/odyssey-react-mui_zh_TW.ts +1 -1
  493. package/src/test-selectors/getByQuerySelector.ts +176 -0
  494. package/src/test-selectors/getComputedAccessibleErrorMessageText.ts +52 -0
  495. package/src/test-selectors/getComputedAccessibleText.ts +36 -0
  496. package/src/test-selectors/index.ts +2 -2
  497. package/src/test-selectors/interpolateString.ts +41 -0
  498. package/src/test-selectors/linkedHtmlSelectors.ts +73 -0
  499. package/src/test-selectors/queryOdysseySelector.ts +36 -0
  500. package/src/test-selectors/querySelector.ts +221 -170
  501. package/src/test-selectors/sanityChecks.ts +53 -0
  502. package/src/test-selectors/testSelector.ts +143 -0
  503. package/src/theme/components.tsx +238 -150
  504. package/src/theme/createOdysseyMuiTheme.ts +4 -1
  505. package/dist/createShadowRootElement.js +0 -26
  506. package/dist/createShadowRootElement.js.map +0 -1
  507. package/dist/labs/DataComponents/BulkActionsMenu.js.map +0 -1
  508. package/dist/labs/DataComponents/DataStack.js +0 -85
  509. package/dist/labs/DataComponents/DataStack.js.map +0 -1
  510. package/dist/labs/DataComponents/DataTable.js.map +0 -1
  511. package/dist/labs/DataComponents/DataView.js.map +0 -1
  512. package/dist/labs/DataComponents/DetailPanel.js.map +0 -1
  513. package/dist/labs/DataComponents/LayoutSwitcher.js.map +0 -1
  514. package/dist/labs/DataComponents/RowActions.js.map +0 -1
  515. package/dist/labs/DataComponents/StackCard.js.map +0 -1
  516. package/dist/labs/DataComponents/StackContent.js.map +0 -1
  517. package/dist/labs/DataComponents/TableContent.js.map +0 -1
  518. package/dist/labs/DataComponents/TableSettings.js.map +0 -1
  519. package/dist/labs/DataComponents/componentTypes.js.map +0 -1
  520. package/dist/labs/DataComponents/constants.js.map +0 -1
  521. package/dist/labs/DataComponents/dataTypes.js.map +0 -1
  522. package/dist/labs/DataComponents/fetchData.js.map +0 -1
  523. package/dist/labs/DataComponents/index.js.map +0 -1
  524. package/dist/labs/DataComponents/tableConstants.js.map +0 -1
  525. package/dist/labs/DataComponents/useFilterConversion.js.map +0 -1
  526. package/dist/labs/FileUpload.js.map +0 -1
  527. package/dist/labs/FileUploadIllustration.js.map +0 -1
  528. package/dist/labs/FileUploadPreview.js.map +0 -1
  529. package/dist/labs/SideNav.js +0 -478
  530. package/dist/labs/SideNav.js.map +0 -1
  531. package/dist/labs/Switch.js.map +0 -1
  532. package/dist/src/createShadowRootElement.d.ts.map +0 -1
  533. package/dist/src/labs/DataComponents/BulkActionsMenu.d.ts.map +0 -1
  534. package/dist/src/labs/DataComponents/DataStack.d.ts +0 -20
  535. package/dist/src/labs/DataComponents/DataStack.d.ts.map +0 -1
  536. package/dist/src/labs/DataComponents/DataTable.d.ts +0 -16
  537. package/dist/src/labs/DataComponents/DataTable.d.ts.map +0 -1
  538. package/dist/src/labs/DataComponents/DataView.d.ts.map +0 -1
  539. package/dist/src/labs/DataComponents/DetailPanel.d.ts.map +0 -1
  540. package/dist/src/labs/DataComponents/LayoutSwitcher.d.ts.map +0 -1
  541. package/dist/src/labs/DataComponents/RowActions.d.ts.map +0 -1
  542. package/dist/src/labs/DataComponents/StackCard.d.ts.map +0 -1
  543. package/dist/src/labs/DataComponents/StackContent.d.ts.map +0 -1
  544. package/dist/src/labs/DataComponents/TableContent.d.ts.map +0 -1
  545. package/dist/src/labs/DataComponents/TableSettings.d.ts.map +0 -1
  546. package/dist/src/labs/DataComponents/componentTypes.d.ts.map +0 -1
  547. package/dist/src/labs/DataComponents/constants.d.ts.map +0 -1
  548. package/dist/src/labs/DataComponents/dataTypes.d.ts.map +0 -1
  549. package/dist/src/labs/DataComponents/fetchData.d.ts.map +0 -1
  550. package/dist/src/labs/DataComponents/index.d.ts.map +0 -1
  551. package/dist/src/labs/DataComponents/tableConstants.d.ts.map +0 -1
  552. package/dist/src/labs/DataComponents/useFilterConversion.d.ts.map +0 -1
  553. package/dist/src/labs/FileUpload.d.ts.map +0 -1
  554. package/dist/src/labs/FileUploadIllustration.d.ts.map +0 -1
  555. package/dist/src/labs/FileUploadPreview.d.ts.map +0 -1
  556. package/dist/src/labs/SideNav.d.ts.map +0 -1
  557. package/dist/src/labs/Switch.d.ts.map +0 -1
  558. package/dist/src/test-selectors/featureTestSelector.d.ts +0 -31
  559. package/dist/src/test-selectors/featureTestSelector.d.ts.map +0 -1
  560. package/dist/src/test-selectors/odysseyTestSelectors.d.ts +0 -120
  561. package/dist/src/test-selectors/odysseyTestSelectors.d.ts.map +0 -1
  562. package/dist/test-selectors/featureTestSelector.js +0 -2
  563. package/dist/test-selectors/featureTestSelector.js.map +0 -1
  564. package/dist/test-selectors/odysseyTestSelectors.js.map +0 -1
  565. package/src/createShadowRootElement.ts +0 -31
  566. package/src/labs/DataComponents/DataStack.tsx +0 -105
  567. package/src/labs/SideNav.tsx +0 -745
  568. package/src/test-selectors/featureTestSelector.ts +0 -41
  569. /package/dist/{labs → FileUploader}/FileUploadIllustration.js +0 -0
  570. /package/dist/{labs → FileUploader}/FileUploadPreview.js +0 -0
  571. /package/dist/labs/{DataComponents → DataView}/BulkActionsMenu.js +0 -0
  572. /package/dist/labs/{DataComponents → DataView}/DetailPanel.js +0 -0
  573. /package/dist/labs/{DataComponents → DataView}/LayoutSwitcher.js +0 -0
  574. /package/dist/labs/{DataComponents → DataView}/RowActions.js +0 -0
  575. /package/dist/labs/{DataComponents → DataView}/componentTypes.js +0 -0
  576. /package/dist/labs/{DataComponents → DataView}/dataTypes.js +0 -0
  577. /package/dist/labs/{DataComponents → DataView}/fetchData.js +0 -0
  578. /package/dist/labs/{DataComponents → DataView}/tableConstants.js +0 -0
  579. /package/dist/labs/{DataComponents → DataView}/useFilterConversion.js +0 -0
  580. /package/dist/src/{labs → FileUploader}/FileUploadIllustration.d.ts +0 -0
  581. /package/dist/src/labs/{DataComponents → DataView}/BulkActionsMenu.d.ts +0 -0
  582. /package/dist/src/labs/{DataComponents → DataView}/LayoutSwitcher.d.ts +0 -0
  583. /package/dist/src/labs/{DataComponents → DataView}/RowActions.d.ts +0 -0
  584. /package/dist/src/labs/{DataComponents → DataView}/dataTypes.d.ts +0 -0
  585. /package/dist/src/labs/{DataComponents → DataView}/fetchData.d.ts +0 -0
  586. /package/dist/src/labs/{DataComponents → DataView}/tableConstants.d.ts +0 -0
  587. /package/src/{labs → FileUploader}/FileUploadIllustration.tsx +0 -0
  588. /package/src/labs/{DataComponents → DataView}/BulkActionsMenu.tsx +0 -0
  589. /package/src/labs/{DataComponents → DataView}/LayoutSwitcher.tsx +0 -0
  590. /package/src/labs/{DataComponents → DataView}/RowActions.tsx +0 -0
  591. /package/src/labs/{DataComponents → DataView}/dataTypes.ts +0 -0
  592. /package/src/labs/{DataComponents → DataView}/fetchData.ts +0 -0
  593. /package/src/labs/{DataComponents → DataView}/tableConstants.tsx +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"Select.js","names":["memo","useCallback","useEffect","useMemo","useRef","useState","useImperativeHandle","Field","CheckIcon","CloseCircleFilledIcon","ComponentControlledState","useInputValues","getControlState","normalizedKey","styled","useOdysseyDesignTokens","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","SelectContainer","div","ChipsPositioningContainer","shouldForwardProp","prop","odysseyDesignTokens","Spacing0","Spacing5","Spacing1","BorderWidthMain","NonInteractiveIcon","Spacing2","ChipsInnerContainer","_Box","isInteractive","Spacing6","CONTROLLED","Select","ariaDescribedBy","defaultValue","errorMessage","errorMessageList","hasMultipleChoices","hasMultipleChoicesProp","hint","HintLinkComponent","id","idOverride","inputRef","isDisabled","isFullWidth","isMultiSelect","isOptional","label","name","nameOverride","onBlur","onChange","onChangeProp","onFocus","options","testId","translate","value","undefined","controlledStateRef","controlledValue","uncontrolledValue","internalSelectedValues","setInternalSelectedValues","current","localInputRef","focus","inputValues","controlState","event","child","target","split","normalizedOptions","map","option","text","type","removeSelectedValue","selectedValue","Array","isArray","newValue","filter","internalSelectedValue","syntheticEvent","Chips","stopPropagation","hasNonInteractiveIcon","children","item","length","_Chip","tabIndex","onDelete","deleteIcon","sx","pointerEvents","onMouseDown","renderedOptions","index","_ListSubheader","isSelected","includes","_MenuItem","selected","_Checkbox","checked","_ListItemSecondaryAction","toString","renderValue","renderFieldComponent","errorMessageElementId","labelElementId","_Select","displayEmpty","inputProps","labelId","multiple","fieldType","hasVisibleLabel","MemoizedSelect","displayName"],"sources":["../src/Select.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 {\n memo,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n useImperativeHandle,\n MouseEvent,\n} from \"react\";\nimport {\n Box as MuiBox,\n Checkbox as MuiCheckbox,\n Chip as MuiChip,\n ListItemSecondaryAction,\n ListSubheader,\n MenuItem as MuiMenuItem,\n Select as MuiSelect,\n SelectChangeEvent,\n} from \"@mui/material\";\nimport { SelectProps as MuiSelectProps } from \"@mui/material\";\n\nimport { Field } from \"./Field\";\nimport {\n FieldComponentProps,\n FieldComponentRenderProps,\n} from \"./FieldComponentProps\";\nimport { CheckIcon, CloseCircleFilledIcon } from \"./icons.generated\";\nimport type { HtmlProps } from \"./HtmlProps\";\nimport {\n ComponentControlledState,\n FocusHandle,\n useInputValues,\n getControlState,\n} from \"./inputUtils\";\nimport { normalizedKey } from \"./useNormalizedKey\";\nimport styled from \"@emotion/styled\";\n\nimport {\n useOdysseyDesignTokens,\n DesignTokens,\n} from \"./OdysseyDesignTokensContext\";\n\nexport type SelectOption = {\n text: string;\n type?: \"heading\" | \"option\";\n value?: string;\n};\n\nconst SelectContainer = styled.div`\n position: relative;\n width: 100%;\n display: flex;\n`;\n\nconst ChipsPositioningContainer = styled(\"div\", {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})<{\n odysseyDesignTokens: DesignTokens;\n}>`\n display: flex;\n align-items: center;\n position: absolute;\n top: ${({ odysseyDesignTokens }) => odysseyDesignTokens.Spacing0};\n right: ${({ odysseyDesignTokens }) => odysseyDesignTokens.Spacing5};\n bottom: ${({ odysseyDesignTokens }) => odysseyDesignTokens.Spacing0};\n left: ${({ odysseyDesignTokens }) => odysseyDesignTokens.Spacing1};\n margin-inline-start: ${({ odysseyDesignTokens }) =>\n odysseyDesignTokens.BorderWidthMain};\n opacity: 1;\n pointer-events: none;\n`;\n\nconst NonInteractiveIcon = styled(CloseCircleFilledIcon, {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})<{\n odysseyDesignTokens: DesignTokens;\n}>`\n font-size: 1em;\n margin-inline-start: ${({ odysseyDesignTokens }) =>\n odysseyDesignTokens.Spacing2};\n margin-inline-end: -${({ odysseyDesignTokens }) => odysseyDesignTokens.Spacing1};\n margin-block-end: -1px;\n`;\n\nconst ChipsInnerContainer = styled(MuiBox, {\n shouldForwardProp: (prop) =>\n prop !== \"odysseyDesignTokens\" && prop !== \"isInteractive\",\n})<{\n isInteractive?: boolean;\n odysseyDesignTokens: DesignTokens;\n}>`\n display: flex;\n flex-wrap: wrap;\n gap: ${({ odysseyDesignTokens }) => odysseyDesignTokens.Spacing1};\n pointer-events: none;\n opacity: ${({ isInteractive }) => (isInteractive ? 1 : 0)};\n min-height: ${({ odysseyDesignTokens }) => odysseyDesignTokens.Spacing6};\n`;\n\nexport type SelectValueType<HasMultipleChoices> =\n HasMultipleChoices extends true ? string[] : string;\n\nexport type SelectProps<\n Value extends SelectValueType<HasMultipleChoices>,\n HasMultipleChoices extends boolean,\n> = {\n /**\n * The default value. Use when the component is not controlled.\n */\n defaultValue?: MuiSelectProps<Value>[\"defaultValue\"];\n /**\n * If `true`, the Select allows multiple selections\n */\n hasMultipleChoices?: HasMultipleChoices;\n /**\n * The ref forwarded to the Select\n */\n inputRef?: React.RefObject<FocusHandle>;\n /**\n * @deprecated Use `hasMultipleChoices` instead.\n */\n /** **Deprecated:** use `hasMultipleChoices` */\n isMultiSelect?: HasMultipleChoices;\n /**\n * The label text for the Select\n */\n label: string;\n /**\n * Callback fired when the Select loses focus\n */\n onBlur?: MuiSelectProps<Value>[\"onBlur\"];\n /**\n * Callback fired when the value of the Select changes\n */\n onChange?: MuiSelectProps<Value>[\"onChange\"];\n /**\n * Callback fired when the Select gains focus\n */\n onFocus?: MuiSelectProps<Value>[\"onFocus\"];\n /**\n * The options for the Select\n */\n options: (string | SelectOption)[];\n /**\n * The value or values selected in the Select\n */\n value?: Value;\n} & Pick<\n FieldComponentProps,\n | \"errorMessage\"\n | \"errorMessageList\"\n | \"hint\"\n | \"HintLinkComponent\"\n | \"id\"\n | \"isDisabled\"\n | \"isFullWidth\"\n | \"isOptional\"\n | \"name\"\n> &\n Pick<HtmlProps, \"ariaDescribedBy\" | \"testId\" | \"translate\">;\n\ntype SelectRenderProps = Partial<\n Pick<FieldComponentRenderProps, \"ariaDescribedBy\" | \"errorMessageElementId\">\n> &\n Pick<FieldComponentRenderProps, \"id\" | \"labelElementId\">;\n\n/**\n * Options in Odyssey <Select> are passed as an array, which can contain any combination\n * of the following:\n * - string — A simple string. The string will be both the text and the value of the resulting option.\n * <option value=\"string\">string</option>\n *\n * - { text: string } — Same as above, but the string is contained within an object.\n * <option value=\"text\">text</option>\n *\n * - { text: string, value: string } — The option text will be text, and the option value will be value.\n * <option value=\"value\">text</option>\n *\n * - { text: string, type: \"heading\" } — Used to display a group heading with the text\n */\n\nconst { CONTROLLED } = ComponentControlledState;\nconst Select = <\n Value extends SelectValueType<HasMultipleChoices>,\n HasMultipleChoices extends boolean,\n>({\n ariaDescribedBy,\n defaultValue,\n errorMessage,\n errorMessageList,\n hasMultipleChoices: hasMultipleChoicesProp,\n hint,\n HintLinkComponent,\n id: idOverride,\n inputRef,\n isDisabled = false,\n isFullWidth = false,\n isMultiSelect,\n isOptional = false,\n label,\n name: nameOverride,\n onBlur,\n onChange: onChangeProp,\n onFocus,\n options,\n testId,\n translate,\n value,\n}: SelectProps<Value, HasMultipleChoices>) => {\n const hasMultipleChoices = useMemo(\n () =>\n hasMultipleChoicesProp === undefined\n ? isMultiSelect\n : hasMultipleChoicesProp,\n [hasMultipleChoicesProp, isMultiSelect],\n );\n const controlledStateRef = useRef(\n getControlState({\n controlledValue: value,\n uncontrolledValue: defaultValue,\n }),\n );\n const [internalSelectedValues, setInternalSelectedValues] = useState(\n controlledStateRef.current === CONTROLLED ? value : defaultValue,\n );\n\n const localInputRef = useRef<HTMLSelectElement>(null);\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n useImperativeHandle(\n inputRef,\n () => {\n return {\n focus: () => {\n localInputRef.current?.focus();\n },\n };\n },\n [],\n );\n\n useEffect(() => {\n if (controlledStateRef.current === CONTROLLED) {\n setInternalSelectedValues(value);\n }\n }, [value]);\n\n const inputValues = useInputValues({\n defaultValue,\n value,\n controlState: controlledStateRef.current,\n });\n\n const onChange = useCallback<NonNullable<MuiSelectProps<Value>[\"onChange\"]>>(\n (event, child) => {\n const {\n target: { value },\n } = event;\n if (controlledStateRef.current !== CONTROLLED) {\n setInternalSelectedValues(\n (typeof value === \"string\" && hasMultipleChoices\n ? value.split(\",\")\n : value) as Value,\n );\n }\n onChangeProp?.(event, child);\n },\n [hasMultipleChoices, onChangeProp],\n );\n\n // Normalize the options array to accommodate the various\n // data types that might be passed\n const normalizedOptions = useMemo(\n () =>\n options.map((option) => {\n if (typeof option === \"object\") {\n /**\n * If the value of `option?.value is an empty string, we need to make sure that we\n * set an empty string to `value` in the normalized option so that the select component\n * can potentially set it as the selected one in the text input\n */\n const value =\n option?.value === \"\" ? option.value : option.value || option.text;\n return {\n text: option.text,\n value,\n type: option.type === \"heading\" ? \"heading\" : \"option\",\n };\n }\n return { text: option, value: option, type: \"option\" };\n }),\n [options],\n );\n\n const removeSelectedValue = useCallback(\n (selectedValue: string) => {\n if (Array.isArray(internalSelectedValues)) {\n const newValue = internalSelectedValues.filter(\n (internalSelectedValue) => internalSelectedValue !== selectedValue,\n );\n\n const syntheticEvent = {\n target: { value: newValue },\n } as SelectChangeEvent<Value>;\n\n onChange(syntheticEvent, null);\n }\n },\n [internalSelectedValues, onChange],\n );\n\n const Chips = useCallback(\n ({ isInteractive }: { isInteractive: boolean }) => {\n const stopPropagation = (event: MouseEvent<SVGSVGElement>) =>\n event.stopPropagation();\n\n const hasNonInteractiveIcon =\n !isInteractive &&\n controlledStateRef.current === CONTROLLED &&\n hasMultipleChoices;\n\n return (\n Array.isArray(internalSelectedValues) && (\n <ChipsInnerContainer\n isInteractive={isInteractive}\n odysseyDesignTokens={odysseyDesignTokens}\n >\n {internalSelectedValues.map(\n (item) =>\n item?.length > 0 && (\n <MuiChip\n key={item}\n label={\n <>\n {item}\n {hasNonInteractiveIcon && (\n <NonInteractiveIcon\n odysseyDesignTokens={odysseyDesignTokens}\n />\n )}\n </>\n }\n tabIndex={-1}\n onDelete={\n isInteractive && controlledStateRef.current === CONTROLLED\n ? () => removeSelectedValue(item)\n : undefined\n }\n deleteIcon={\n <CloseCircleFilledIcon\n sx={{ pointerEvents: \"auto\" }}\n // We need to stop event propagation on mouse down to prevent the deletion\n // from being blocked by the Select list opening, and also ensure that\n // the pointerEvent is registered even when the parent's are not\n onMouseDown={stopPropagation}\n />\n }\n />\n ),\n )}\n </ChipsInnerContainer>\n )\n );\n },\n [\n controlledStateRef,\n hasMultipleChoices,\n internalSelectedValues,\n odysseyDesignTokens,\n removeSelectedValue,\n ],\n );\n\n // Convert the options into the ReactNode children\n // that will populate the <Select>\n const renderedOptions = useMemo(\n () =>\n normalizedOptions.map((option, index) => {\n if (option.type === \"heading\") {\n return (\n <ListSubheader key={option.text}> {option.text} </ListSubheader>\n );\n }\n\n const isSelected = hasMultipleChoices\n ? internalSelectedValues?.includes(option.value)\n : internalSelectedValues === option.value;\n\n return (\n <MuiMenuItem\n key={normalizedKey(option.text, index.toString())}\n value={option.value}\n selected={isSelected}\n >\n {hasMultipleChoices && <MuiCheckbox checked={isSelected} />}\n {option.text}\n {!hasMultipleChoices && internalSelectedValues === option.value && (\n <ListItemSecondaryAction>\n <CheckIcon />\n </ListItemSecondaryAction>\n )}\n </MuiMenuItem>\n );\n }),\n [hasMultipleChoices, normalizedOptions, internalSelectedValues],\n );\n const renderValue = useCallback(\n (value: Value) => Array.isArray(value) && <Chips isInteractive={false} />,\n [Chips],\n );\n\n const renderFieldComponent = useCallback(\n ({\n ariaDescribedBy,\n errorMessageElementId,\n id,\n labelElementId,\n }: SelectRenderProps) => (\n <SelectContainer>\n <MuiSelect\n {...inputValues}\n aria-describedby={ariaDescribedBy}\n aria-errormessage={errorMessageElementId}\n displayEmpty\n id={id}\n inputProps={{ \"data-se\": testId }}\n inputRef={localInputRef}\n labelId={labelElementId}\n multiple={hasMultipleChoices}\n name={nameOverride ?? id}\n onBlur={onBlur}\n onChange={onChange}\n onFocus={onFocus}\n renderValue={hasMultipleChoices ? renderValue : undefined}\n translate={translate}\n >\n {renderedOptions}\n </MuiSelect>\n {hasMultipleChoices && (\n <>\n <ChipsPositioningContainer\n odysseyDesignTokens={odysseyDesignTokens}\n >\n <Chips isInteractive={true} />\n </ChipsPositioningContainer>\n </>\n )}\n </SelectContainer>\n ),\n [\n Chips,\n inputValues,\n hasMultipleChoices,\n nameOverride,\n odysseyDesignTokens,\n onBlur,\n onChange,\n onFocus,\n renderedOptions,\n renderValue,\n testId,\n translate,\n ],\n );\n\n return (\n <Field\n ariaDescribedBy={ariaDescribedBy}\n errorMessage={errorMessage}\n errorMessageList={errorMessageList}\n fieldType=\"single\"\n hasVisibleLabel\n hint={hint}\n HintLinkComponent={HintLinkComponent}\n id={idOverride}\n isDisabled={isDisabled}\n isFullWidth={isFullWidth}\n isOptional={isOptional}\n label={label}\n renderFieldComponent={renderFieldComponent}\n />\n );\n};\n\nconst MemoizedSelect = memo(Select);\nMemoizedSelect.displayName = \"Select\";\n\nexport { MemoizedSelect as Select };\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,IAAI,EACJC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,EACRC,mBAAmB,QAEd,OAAO;AAAC,SAaNC,KAAK;AAAA,SAKLC,SAAS,EAAEC,qBAAqB;AAAA,SAGvCC,wBAAwB,EAExBC,cAAc,EACdC,eAAe;AAAA,SAERC,aAAa;AACtB,OAAOC,MAAM,MAAM,iBAAiB;AAAC,SAGnCC,sBAAsB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAUxB,MAAMC,eAAe,GAAGR,MAAM,CAACS,GAAI;AACnC;AACA;AACA;AACA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M,EACNC,QAAQ,EACRE,OAAO,EACP8C,eAAe,EACfW,WAAW,EACXvD,MAAM,EACNC,SAAS,CAEb,CAAC;EAED,OACE/C,IAAA,CAACV,KAAK;IACJiC,eAAe,EAAEA,eAAgB;IACjCE,YAAY,EAAEA,YAAa;IAC3BC,gBAAgB,EAAEA,gBAAiB;IACnCoF,SAAS,EAAC,QAAQ;IAClBC,eAAe;IACflF,IAAI,EAAEA,IAAK;IACXC,iBAAiB,EAAEA,iBAAkB;IACrCC,EAAE,EAAEC,UAAW;IACfE,UAAU,EAAEA,UAAW;IACvBC,WAAW,EAAEA,WAAY;IACzBE,UAAU,EAAEA,UAAW;IACvBC,KAAK,EAAEA,KAAM;IACbgE,oBAAoB,EAAEA;EAAqB,CAC5C,CAAC;AAEN,CAAC;AAED,MAAMU,cAAc,GAAGjI,IAAI,CAACuC,MAAM,CAAC;AACnC0F,cAAc,CAACC,WAAW,GAAG,QAAQ;AAErC,SAASD,cAAc,IAAI1F,MAAM"}
1
+ {"version":3,"file":"Select.js","names":["memo","useCallback","useEffect","useMemo","useRef","useState","useImperativeHandle","Field","CheckIcon","CloseCircleFilledIcon","ComponentControlledState","useInputValues","getControlState","normalizedKey","styled","useOdysseyDesignTokens","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","SelectTestSelector","accessibleText","errorMessage","hint","label","children","list","listItem","elementSelector","method","options","role","isControlledElement","SelectContainer","div","ChipsPositioningContainer","shouldForwardProp","prop","odysseyDesignTokens","Spacing0","Spacing5","Spacing1","BorderWidthMain","NonInteractiveIcon","Spacing2","ChipsInnerContainer","_Box","isInteractive","isReadOnly","Spacing6","CONTROLLED","Select","ariaDescribedBy","defaultValue","errorMessageList","hasMultipleChoices","hasMultipleChoicesProp","HintLinkComponent","id","idOverride","inputRef","isDisabled","isFullWidth","isMultiSelect","isOptional","name","nameOverride","onBlur","onChange","onChangeProp","onFocus","testId","translate","value","selectRef","undefined","controlledStateRef","controlledValue","uncontrolledValue","internalSelectedValues","setInternalSelectedValues","current","localInputRef","focus","inputValues","controlState","event","child","preventDefault","target","split","normalizedOptions","normalizedOptionsMap","map","option","text","type","Map","removeSelectedValue","selectedValue","Array","isArray","newValue","filter","internalSelectedValue","syntheticEvent","Chips","stopPropagation","hasNonInteractiveIcon","item","length","_Chip","get","tabIndex","onDelete","deleteIcon","sx","pointerEvents","onMouseDown","renderedOptions","index","_ListSubheader","isSelected","includes","_MenuItem","selected","_Checkbox","checked","_ListItemSecondaryAction","toString","renderValue","renderFieldComponent","errorMessageElementId","labelElementId","_Select","displayEmpty","inputProps","readOnly","el","labelId","multiple","fieldType","hasVisibleLabel","MemoizedSelect","displayName"],"sources":["../src/Select.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 {\n memo,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n useImperativeHandle,\n} from \"react\";\nimport {\n Box as MuiBox,\n Checkbox as MuiCheckbox,\n Chip as MuiChip,\n ListItemSecondaryAction,\n ListSubheader,\n MenuItem as MuiMenuItem,\n Select as MuiSelect,\n SelectChangeEvent,\n} from \"@mui/material\";\nimport { SelectProps as MuiSelectProps } from \"@mui/material\";\nimport { Field } from \"./Field\";\nimport {\n FieldComponentProps,\n FieldComponentRenderProps,\n} from \"./FieldComponentProps\";\nimport { CheckIcon, CloseCircleFilledIcon } from \"./icons.generated\";\nimport type { HtmlProps } from \"./HtmlProps\";\nimport {\n ComponentControlledState,\n FocusHandle,\n useInputValues,\n getControlState,\n} from \"./inputUtils\";\nimport { normalizedKey } from \"./useNormalizedKey\";\nimport styled from \"@emotion/styled\";\nimport {\n useOdysseyDesignTokens,\n DesignTokens,\n} from \"./OdysseyDesignTokensContext\";\nimport { TestSelector } from \"./test-selectors\";\n\nexport const SelectTestSelector = {\n accessibleText: {\n errorMessage: \"errorMessage\",\n hint: \"description\",\n label: \"label\",\n },\n children: {\n list: {\n accessibleText: {\n label: \"label\",\n },\n children: {\n listItem: {\n accessibleText: {\n label: \"label\",\n },\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\nexport type SelectOption = {\n text: string;\n type?: \"heading\" | \"option\";\n value?: string;\n};\n\nconst SelectContainer = styled.div`\n position: relative;\n width: 100%;\n display: flex;\n`;\n\nconst ChipsPositioningContainer = styled(\"div\", {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})<{\n odysseyDesignTokens: DesignTokens;\n}>`\n display: flex;\n align-items: center;\n position: absolute;\n top: ${({ odysseyDesignTokens }) => odysseyDesignTokens.Spacing0};\n right: ${({ odysseyDesignTokens }) => odysseyDesignTokens.Spacing5};\n bottom: ${({ odysseyDesignTokens }) => odysseyDesignTokens.Spacing0};\n left: ${({ odysseyDesignTokens }) => odysseyDesignTokens.Spacing1};\n margin-inline-start: ${({ odysseyDesignTokens }) =>\n odysseyDesignTokens.BorderWidthMain};\n opacity: 1;\n pointer-events: none;\n`;\n\nconst NonInteractiveIcon = styled(CloseCircleFilledIcon, {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})<{\n odysseyDesignTokens: DesignTokens;\n}>`\n font-size: 1em;\n margin-inline-start: ${({ odysseyDesignTokens }) =>\n odysseyDesignTokens.Spacing2};\n margin-inline-end: -${({ odysseyDesignTokens }) => odysseyDesignTokens.Spacing1};\n margin-block-end: -1px;\n`;\n\nconst ChipsInnerContainer = styled(MuiBox, {\n shouldForwardProp: (prop) =>\n prop !== \"odysseyDesignTokens\" &&\n prop !== \"isInteractive\" &&\n prop !== \"isReadOnly\",\n})<{\n isInteractive?: boolean;\n isReadOnly?: boolean;\n odysseyDesignTokens: DesignTokens;\n}>`\n display: flex;\n flex-wrap: wrap;\n gap: ${({ odysseyDesignTokens }) => odysseyDesignTokens.Spacing1};\n pointer-events: none;\n opacity: ${({ isInteractive, isReadOnly }) =>\n isInteractive || isReadOnly ? 1 : 0};\n min-height: ${({ odysseyDesignTokens }) => odysseyDesignTokens.Spacing6};\n`;\n\nexport type SelectValueType<HasMultipleChoices> =\n HasMultipleChoices extends true ? string[] : string;\n\nexport type SelectProps<\n Value extends SelectValueType<HasMultipleChoices>,\n HasMultipleChoices extends boolean,\n> = {\n /**\n * The default value. Use when the component is not controlled.\n */\n defaultValue?: MuiSelectProps<Value>[\"defaultValue\"];\n /**\n * If `true`, the Select allows multiple selections\n */\n hasMultipleChoices?: HasMultipleChoices;\n /**\n * The ref forwarded to the Select\n */\n inputRef?: React.RefObject<FocusHandle>;\n /**\n * @deprecated Use `hasMultipleChoices` instead.\n */\n /** **Deprecated:** use `hasMultipleChoices` */\n isMultiSelect?: HasMultipleChoices;\n /**\n * The label text for the Select\n */\n label: string;\n /**\n * Callback fired when the Select loses focus\n */\n onBlur?: MuiSelectProps<Value>[\"onBlur\"];\n /**\n * Callback fired when the value of the Select changes\n */\n onChange?: MuiSelectProps<Value>[\"onChange\"];\n /**\n * Callback fired when the Select gains focus\n */\n onFocus?: MuiSelectProps<Value>[\"onFocus\"];\n /**\n * The options for the Select\n */\n options: (string | SelectOption)[];\n /**\n * The value or values selected in the Select\n */\n value?: Value;\n} & Pick<\n FieldComponentProps,\n | \"errorMessage\"\n | \"errorMessageList\"\n | \"hint\"\n | \"HintLinkComponent\"\n | \"id\"\n | \"isDisabled\"\n | \"isFullWidth\"\n | \"isOptional\"\n | \"isReadOnly\"\n | \"name\"\n> &\n Pick<HtmlProps, \"ariaDescribedBy\" | \"testId\" | \"translate\">;\n\ntype SelectRenderProps = Partial<\n Pick<FieldComponentRenderProps, \"ariaDescribedBy\" | \"errorMessageElementId\">\n> &\n Pick<FieldComponentRenderProps, \"id\" | \"labelElementId\">;\n\n/**\n * Options in Odyssey <Select> are passed as an array, which can contain any combination\n * of the following:\n * - string — A simple string. The string will be both the text and the value of the resulting option.\n * <option value=\"string\">string</option>\n *\n * - { text: string } — Same as above, but the string is contained within an object.\n * <option value=\"text\">text</option>\n *\n * - { text: string, value: string } — The option text will be text, and the option value will be value.\n * <option value=\"value\">text</option>\n *\n * - { text: string, type: \"heading\" } — Used to display a group heading with the text\n */\n\nconst { CONTROLLED } = ComponentControlledState;\nconst Select = <\n Value extends SelectValueType<HasMultipleChoices>,\n HasMultipleChoices extends boolean,\n>({\n ariaDescribedBy,\n defaultValue,\n errorMessage,\n errorMessageList,\n hasMultipleChoices: hasMultipleChoicesProp,\n hint,\n HintLinkComponent,\n id: idOverride,\n inputRef,\n isDisabled = false,\n isFullWidth = false,\n isMultiSelect,\n isOptional = false,\n isReadOnly = false,\n label,\n name: nameOverride,\n onBlur,\n onChange: onChangeProp,\n onFocus,\n options,\n testId,\n translate,\n value,\n}: SelectProps<Value, HasMultipleChoices>) => {\n const selectRef = useRef<HTMLInputElement | HTMLTextAreaElement | null>(null);\n\n const hasMultipleChoices = useMemo(\n () =>\n hasMultipleChoicesProp === undefined\n ? isMultiSelect\n : hasMultipleChoicesProp,\n [hasMultipleChoicesProp, isMultiSelect],\n );\n\n const controlledStateRef = useRef(\n getControlState({\n controlledValue: value,\n uncontrolledValue: defaultValue,\n }),\n );\n const [internalSelectedValues, setInternalSelectedValues] = useState(\n controlledStateRef.current === CONTROLLED ? value : defaultValue,\n );\n\n const localInputRef = useRef<HTMLSelectElement>(null);\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n useImperativeHandle(\n inputRef,\n () => {\n return {\n focus: () => {\n localInputRef.current?.focus();\n },\n };\n },\n [],\n );\n\n useEffect(() => {\n if (controlledStateRef.current === CONTROLLED) {\n setInternalSelectedValues(value);\n }\n }, [value]);\n\n const inputValues = useInputValues({\n defaultValue,\n value,\n controlState: controlledStateRef.current,\n });\n\n const onChange = useCallback<NonNullable<MuiSelectProps<Value>[\"onChange\"]>>(\n (event, child) => {\n if (isReadOnly) {\n event.preventDefault();\n } else {\n const {\n target: { value },\n } = event;\n if (controlledStateRef.current !== CONTROLLED) {\n setInternalSelectedValues(\n (typeof value === \"string\" && hasMultipleChoices\n ? value.split(\",\")\n : value) as Value,\n );\n }\n onChangeProp?.(event, child);\n }\n },\n [hasMultipleChoices, onChangeProp, isReadOnly],\n );\n // Normalize the options array to accommodate the various\n // data types that might be passed\n const [normalizedOptions, normalizedOptionsMap] = useMemo(() => {\n const normalizedOptions = options.map((option) => {\n if (typeof option === \"object\") {\n /**\n * If the value of `option?.value is an empty string, we need to make sure that we\n * set an empty string to `value` in the normalized option so that the select component\n * can potentially set it as the selected one in the text input\n */\n const value =\n option?.value === \"\" ? option.value : option.value || option.text;\n return {\n text: option.text,\n value,\n type: option.type === \"heading\" ? \"heading\" : \"option\",\n };\n }\n\n return { text: option, value: option, type: \"option\" };\n });\n\n const normalizedOptionsMap = new Map(\n normalizedOptions.map((option) => [option.value, option]),\n );\n return [normalizedOptions, normalizedOptionsMap];\n }, [options]);\n\n const removeSelectedValue = useCallback(\n (selectedValue: string) => {\n if (Array.isArray(internalSelectedValues)) {\n const newValue = internalSelectedValues.filter(\n (internalSelectedValue) => internalSelectedValue !== selectedValue,\n );\n\n const syntheticEvent = {\n target: { value: newValue },\n } as SelectChangeEvent<Value>;\n\n onChange(syntheticEvent, null);\n }\n },\n [internalSelectedValues, onChange],\n );\n\n const Chips = useCallback(\n ({\n isInteractive,\n isReadOnly,\n }: {\n isInteractive: boolean;\n isReadOnly?: boolean;\n }) => {\n const stopPropagation = (event: React.MouseEvent<SVGSVGElement>) =>\n event.stopPropagation();\n\n const hasNonInteractiveIcon =\n !isInteractive &&\n controlledStateRef.current === CONTROLLED &&\n hasMultipleChoices;\n return (\n Array.isArray(internalSelectedValues) && (\n <ChipsInnerContainer\n isInteractive={isInteractive}\n isReadOnly={isReadOnly}\n odysseyDesignTokens={odysseyDesignTokens}\n >\n {internalSelectedValues.map(\n (item) =>\n item?.length > 0 && (\n <MuiChip\n key={item}\n label={\n <>\n {normalizedOptionsMap.get(item)?.text}\n {hasNonInteractiveIcon && (\n <NonInteractiveIcon\n odysseyDesignTokens={odysseyDesignTokens}\n />\n )}\n </>\n }\n tabIndex={-1}\n onDelete={\n isInteractive && controlledStateRef.current === CONTROLLED\n ? () => removeSelectedValue(item)\n : undefined\n }\n deleteIcon={\n <CloseCircleFilledIcon\n sx={{ pointerEvents: \"auto\" }}\n // We need to stop event propagation on mouse down to prevent the deletion\n // from being blocked by the Select list opening, and also ensure that\n // the pointerEvent is registered even when the parent's are not\n onMouseDown={stopPropagation}\n />\n }\n />\n ),\n )}\n </ChipsInnerContainer>\n )\n );\n },\n [\n controlledStateRef,\n hasMultipleChoices,\n internalSelectedValues,\n odysseyDesignTokens,\n removeSelectedValue,\n normalizedOptionsMap,\n ],\n );\n\n // Convert the options into the ReactNode children\n // that will populate the <Select>\n const renderedOptions = useMemo(\n () =>\n normalizedOptions.map((option, index) => {\n if (option.type === \"heading\") {\n return (\n <ListSubheader key={option.text}> {option.text} </ListSubheader>\n );\n }\n\n const isSelected = hasMultipleChoices\n ? internalSelectedValues?.includes(option.value)\n : internalSelectedValues === option.value;\n\n return (\n <MuiMenuItem\n data-empty={!option.text}\n key={normalizedKey(option.text, index.toString())}\n value={option.value}\n selected={isSelected}\n >\n {hasMultipleChoices && <MuiCheckbox checked={isSelected} />}\n {option.text}\n {!hasMultipleChoices && internalSelectedValues === option.value && (\n <ListItemSecondaryAction>\n <CheckIcon />\n </ListItemSecondaryAction>\n )}\n </MuiMenuItem>\n );\n }),\n [hasMultipleChoices, normalizedOptions, internalSelectedValues],\n );\n\n const renderValue = useCallback(\n (value: Value) => Array.isArray(value) && <Chips isInteractive={false} />,\n [Chips],\n );\n\n const renderFieldComponent = useCallback(\n ({\n ariaDescribedBy,\n errorMessageElementId,\n id,\n labelElementId,\n }: SelectRenderProps) => (\n <SelectContainer>\n <MuiSelect\n {...inputValues}\n aria-describedby={ariaDescribedBy}\n aria-errormessage={errorMessageElementId}\n displayEmpty\n id={id}\n inputProps={{\n \"data-se\": testId,\n \"aria-disabled\": isDisabled || isReadOnly,\n readOnly: isReadOnly,\n }}\n inputRef={(el: HTMLInputElement | HTMLTextAreaElement | null) => {\n if (localInputRef.current !== el) {\n (localInputRef as React.MutableRefObject<typeof el>).current = el;\n }\n selectRef.current = el;\n }}\n labelId={labelElementId}\n multiple={hasMultipleChoices}\n name={nameOverride ?? id}\n onBlur={onBlur}\n onChange={onChange}\n onFocus={onFocus}\n renderValue={hasMultipleChoices ? renderValue : undefined}\n translate={translate}\n >\n {renderedOptions}\n </MuiSelect>\n {hasMultipleChoices && (\n <>\n <ChipsPositioningContainer\n odysseyDesignTokens={odysseyDesignTokens}\n >\n <Chips isInteractive={!isReadOnly} isReadOnly={isReadOnly} />\n </ChipsPositioningContainer>\n </>\n )}\n </SelectContainer>\n ),\n [\n Chips,\n inputValues,\n hasMultipleChoices,\n isDisabled,\n isReadOnly,\n nameOverride,\n odysseyDesignTokens,\n onBlur,\n onChange,\n onFocus,\n renderedOptions,\n renderValue,\n testId,\n translate,\n ],\n );\n\n return (\n <Field\n ariaDescribedBy={ariaDescribedBy}\n errorMessage={errorMessage}\n errorMessageList={errorMessageList}\n fieldType=\"single\"\n hasVisibleLabel\n hint={hint}\n HintLinkComponent={HintLinkComponent}\n id={idOverride}\n isDisabled={isDisabled}\n isFullWidth={isFullWidth}\n isOptional={isOptional}\n label={label}\n renderFieldComponent={renderFieldComponent}\n />\n );\n};\n\nconst MemoizedSelect = memo(Select);\nMemoizedSelect.displayName = \"Select\";\n\nexport { MemoizedSelect as Select };\n"],"mappings":";;;;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AW;IACvBxC,KAAK,EAAEA,KAAM;IACb2G,oBAAoB,EAAEA;EAAqB,CAC5C,CAAC;AAEN,CAAC;AAED,MAAMY,cAAc,GAAGjJ,IAAI,CAACqD,MAAM,CAAC;AACnC4F,cAAc,CAACC,WAAW,GAAG,QAAQ;AAErC,SAASD,cAAc,IAAI5F,MAAM"}
@@ -14,20 +14,20 @@ import _FormLabel from "@mui/material/FormLabel";
14
14
  import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
15
15
  import { useTranslation } from "react-i18next";
16
16
  import styled from "@emotion/styled";
17
- import { Box } from "../Box.js";
18
- import { FieldHint } from "../FieldHint.js";
19
- import { CheckIcon } from "../icons.generated/index.js";
20
- import { ComponentControlledState, getControlState } from "../inputUtils.js";
21
- import { useOdysseyDesignTokens } from "../OdysseyDesignTokensContext.js";
22
- import { stripRem, toRem } from "../remUtils.js";
23
- import { useUniqueId } from "../useUniqueId.js";
17
+ import { Box } from "./Box.js";
18
+ import { FieldHint } from "./FieldHint.js";
19
+ import { CheckIcon } from "./icons.generated/index.js";
20
+ import { ComponentControlledState, getControlState } from "./inputUtils.js";
21
+ import { useOdysseyDesignTokens } from "./OdysseyDesignTokensContext.js";
22
+ import { stripRem, toRem } from "./remUtils.js";
23
+ import { useUniqueId } from "./useUniqueId.js";
24
24
  import { jsx as _jsx } from "react/jsx-runtime";
25
25
  import { jsxs as _jsxs } from "react/jsx-runtime";
26
26
  import { Fragment as _Fragment } from "react/jsx-runtime";
27
27
  const {
28
28
  CONTROLLED
29
29
  } = ComponentControlledState;
30
- const nonForwardedProps = ["isChecked", "isDisabled", "isFullWidth", "odysseyDesignTokens"];
30
+ const nonForwardedProps = ["isChecked", "isDisabled", "isFullWidth", "isReadOnly", "odysseyDesignTokens"];
31
31
  const SwitchAndLabelContainer = styled("div", {
32
32
  shouldForwardProp: prop => !nonForwardedProps.includes(prop)
33
33
  })(({
@@ -46,18 +46,29 @@ const StyledSwitchLabel = styled(_FormLabel, {
46
46
  shouldForwardProp: prop => !nonForwardedProps.includes(prop)
47
47
  })(({
48
48
  isDisabled,
49
+ isReadOnly,
49
50
  odysseyDesignTokens
50
51
  }) => ({
51
52
  display: "block",
52
53
  margin: 0,
53
- color: isDisabled ? odysseyDesignTokens.TypographyColorDisabled : odysseyDesignTokens.PaletteNeutralDark,
54
+ color: odysseyDesignTokens.PaletteNeutralDark,
54
55
  ...(isDisabled && {
56
+ color: odysseyDesignTokens.TypographyColorDisabled,
55
57
  p: {
56
58
  color: odysseyDesignTokens.TypographyColorDisabled
57
59
  },
58
60
  a: {
59
61
  color: `${odysseyDesignTokens.TypographyColorDisabled} !important`
60
62
  }
63
+ }),
64
+ ...(isReadOnly && {
65
+ color: odysseyDesignTokens.HueNeutral700,
66
+ p: {
67
+ color: odysseyDesignTokens.HueNeutral700
68
+ },
69
+ a: {
70
+ color: `${odysseyDesignTokens.HueNeutral700} !important`
71
+ }
61
72
  })
62
73
  }));
63
74
  const SwitchTrack = styled("div", {
@@ -65,20 +76,31 @@ const SwitchTrack = styled("div", {
65
76
  })(({
66
77
  isChecked,
67
78
  isDisabled,
79
+ isReadOnly,
68
80
  odysseyDesignTokens
69
81
  }) => ({
70
82
  position: "relative",
71
83
  width: odysseyDesignTokens.Spacing7,
72
84
  height: `calc(${odysseyDesignTokens.Spacing4} + ${odysseyDesignTokens.Spacing1})`,
73
85
  borderRadius: odysseyDesignTokens.BorderRadiusOuter,
74
- backgroundColor: isDisabled ? odysseyDesignTokens.HueNeutral200 : isChecked ? odysseyDesignTokens.PaletteSuccessLight : odysseyDesignTokens.HueNeutral300,
75
- transition: `background-color ${odysseyDesignTokens.TransitionDurationMain}`
86
+ backgroundColor: odysseyDesignTokens.HueNeutral300,
87
+ transition: `background-color ${odysseyDesignTokens.TransitionDurationMain}`,
88
+ ...(isDisabled && {
89
+ backgroundColor: odysseyDesignTokens.HueNeutral200
90
+ }),
91
+ ...(isReadOnly && {
92
+ backgroundColor: odysseyDesignTokens.HueNeutral600
93
+ }),
94
+ ...(isChecked && !isDisabled && !isReadOnly && {
95
+ backgroundColor: odysseyDesignTokens.PaletteSuccessLight
96
+ })
76
97
  }));
77
98
  const SwitchThumb = styled("span", {
78
99
  shouldForwardProp: prop => !nonForwardedProps.includes(prop)
79
100
  })(({
80
101
  isChecked,
81
102
  isDisabled,
103
+ isReadOnly,
82
104
  odysseyDesignTokens
83
105
  }) => {
84
106
  const thumbOffset = toRem(3);
@@ -92,9 +114,18 @@ const SwitchThumb = styled("span", {
92
114
  width: `calc(${odysseyDesignTokens.Spacing4} - ${toRem(2)}rem)`,
93
115
  height: `calc(${odysseyDesignTokens.Spacing4} - ${toRem(2)}rem)`,
94
116
  borderRadius: odysseyDesignTokens.BorderRadiusRound,
95
- backgroundColor: isDisabled ? odysseyDesignTokens.HueNeutral50 : odysseyDesignTokens.HueNeutralWhite,
96
- transform: isChecked ? `translate3d(${transformDistance}rem, -50%, 0)` : "translate3d(0, -50%, 0)",
97
- transition: `transform ${odysseyDesignTokens.TransitionDurationMain}`
117
+ backgroundColor: odysseyDesignTokens.HueNeutralWhite,
118
+ transform: "translate3d(0, -50%, 0)",
119
+ transition: `transform ${odysseyDesignTokens.TransitionDurationMain}`,
120
+ ...(isDisabled && {
121
+ backgroundColor: odysseyDesignTokens.HueNeutral50
122
+ }),
123
+ ...(isReadOnly && {
124
+ backgroundColor: odysseyDesignTokens.HueNeutral400
125
+ }),
126
+ ...(isChecked && {
127
+ transform: `translate3d(${transformDistance}rem, -50%, 0)`
128
+ })
98
129
  };
99
130
  });
100
131
  const SwitchCheckMark = styled(CheckIcon, {
@@ -102,6 +133,7 @@ const SwitchCheckMark = styled(CheckIcon, {
102
133
  })(({
103
134
  isChecked,
104
135
  isDisabled,
136
+ isReadOnly,
105
137
  odysseyDesignTokens
106
138
  }) => ({
107
139
  position: "absolute",
@@ -110,13 +142,22 @@ const SwitchCheckMark = styled(CheckIcon, {
110
142
  width: odysseyDesignTokens.Spacing4,
111
143
  transform: "translateY(-50%)",
112
144
  transition: `opacity ${odysseyDesignTokens.TransitionDurationMain}`,
113
- opacity: isChecked ? 1 : 0,
145
+ opacity: 0,
114
146
  path: {
115
- fill: isDisabled ? odysseyDesignTokens.HueNeutral50 : odysseyDesignTokens.HueNeutralWhite
116
- }
147
+ fill: odysseyDesignTokens.HueNeutralWhite
148
+ },
149
+ ...(isChecked && {
150
+ opacity: 1
151
+ }),
152
+ ...((isDisabled || isReadOnly) && {
153
+ path: {
154
+ fill: odysseyDesignTokens.HueNeutral50
155
+ }
156
+ })
117
157
  }));
118
158
  const HiddenCheckbox = styled.input(({
119
- odysseyDesignTokens
159
+ odysseyDesignTokens,
160
+ isReadOnly
120
161
  }) => ({
121
162
  position: "absolute",
122
163
  top: 0,
@@ -125,7 +166,7 @@ const HiddenCheckbox = styled.input(({
125
166
  height: "100%",
126
167
  margin: 0,
127
168
  opacity: 0,
128
- cursor: "pointer",
169
+ cursor: isReadOnly ? "default" : "pointer",
129
170
  zIndex: 2,
130
171
  "&:focus-visible": {
131
172
  "~ [data-switch-track='true']": {
@@ -139,13 +180,15 @@ const SwitchLabel = ({
139
180
  HintLinkComponent,
140
181
  inputId,
141
182
  isDisabled,
142
- label
183
+ label,
184
+ isReadOnly
143
185
  }) => {
144
186
  const odysseyDesignTokens = useOdysseyDesignTokens();
145
187
  return _jsx(_Fragment, {
146
188
  children: _jsxs(StyledSwitchLabel, {
147
189
  htmlFor: inputId,
148
190
  isDisabled: isDisabled,
191
+ isReadOnly: isReadOnly,
149
192
  odysseyDesignTokens: odysseyDesignTokens,
150
193
  children: [label, hint && _jsx(FieldHint, {
151
194
  id: hintId,
@@ -165,6 +208,7 @@ const Switch = ({
165
208
  isDefaultChecked,
166
209
  isDisabled,
167
210
  isFullWidth = false,
211
+ isReadOnly = false,
168
212
  label,
169
213
  name,
170
214
  onChange,
@@ -199,6 +243,10 @@ const Switch = ({
199
243
  const hintId = hint ? `${inputId}-hint` : undefined;
200
244
  const labelElementId = `${inputId}-label`;
201
245
  const handleOnChange = useCallback(event => {
246
+ if (isReadOnly) {
247
+ event.preventDefault();
248
+ return;
249
+ }
202
250
  const target = event.target;
203
251
  const {
204
252
  checked,
@@ -209,7 +257,7 @@ const Switch = ({
209
257
  checked,
210
258
  value
211
259
  });
212
- }, [onChange, setInternalSwitchChecked]);
260
+ }, [onChange, setInternalSwitchChecked, isReadOnly]);
213
261
  return _jsx(Box, {
214
262
  sx: {
215
263
  marginBlockEnd: odysseyDesignTokens.Spacing2,
@@ -227,7 +275,8 @@ const Switch = ({
227
275
  inputId: inputId,
228
276
  isDisabled: isDisabled,
229
277
  isFullWidth: isFullWidth,
230
- label: label
278
+ label: label,
279
+ isReadOnly: isReadOnly
231
280
  }), _jsxs(SwitchContainer, {
232
281
  children: [_jsx(HiddenCheckbox, {
233
282
  ...inputValues,
@@ -242,19 +291,24 @@ const Switch = ({
242
291
  onChange: handleOnChange,
243
292
  odysseyDesignTokens: odysseyDesignTokens,
244
293
  type: "checkbox",
245
- value: value
294
+ value: value,
295
+ readOnly: isReadOnly,
296
+ isReadOnly: isReadOnly
246
297
  }), _jsxs(SwitchTrack, {
247
298
  "data-switch-track": true,
248
299
  isChecked: internalSwitchChecked,
249
300
  isDisabled: isDisabled,
301
+ isReadOnly: isReadOnly,
250
302
  odysseyDesignTokens: odysseyDesignTokens,
251
303
  children: [_jsx(SwitchThumb, {
252
304
  isChecked: internalSwitchChecked,
253
305
  isDisabled: isDisabled,
306
+ isReadOnly: isReadOnly,
254
307
  odysseyDesignTokens: odysseyDesignTokens
255
308
  }), _jsx(SwitchCheckMark, {
256
309
  isChecked: internalSwitchChecked,
257
310
  isDisabled: isDisabled,
311
+ isReadOnly: isReadOnly,
258
312
  odysseyDesignTokens: odysseyDesignTokens
259
313
  })]
260
314
  })]
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Switch.js","names":["memo","useCallback","useEffect","useMemo","useRef","useState","useTranslation","styled","Box","FieldHint","CheckIcon","ComponentControlledState","getControlState","useOdysseyDesignTokens","stripRem","toRem","useUniqueId","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","CONTROLLED","nonForwardedProps","SwitchAndLabelContainer","shouldForwardProp","prop","includes","isFullWidth","odysseyDesignTokens","display","alignItems","justifyContent","maxWidth","TypographyLineLengthMax","SwitchContainer","div","position","StyledSwitchLabel","_FormLabel","isDisabled","isReadOnly","margin","color","PaletteNeutralDark","TypographyColorDisabled","p","a","HueNeutral700","SwitchTrack","isChecked","width","Spacing7","height","Spacing4","Spacing1","borderRadius","BorderRadiusOuter","backgroundColor","HueNeutral300","transition","TransitionDurationMain","HueNeutral200","HueNeutral600","PaletteSuccessLight","SwitchThumb","thumbOffset","trackWidth","thumbWidth","transformDistance","top","left","BorderRadiusRound","HueNeutralWhite","transform","HueNeutral50","HueNeutral400","SwitchCheckMark","opacity","path","fill","HiddenCheckbox","input","cursor","zIndex","boxShadow","PalettePrimaryMain","SwitchLabel","hint","hintId","HintLinkComponent","inputId","label","children","htmlFor","id","text","LinkComponent","MemoizedSwitchLabel","displayName","Switch","idProp","isDefaultChecked","name","onChange","testId","value","t","controlledStateRef","controlledValue","uncontrolledValue","inputValues","current","checked","defaultChecked","internalSwitchChecked","setInternalSwitchChecked","Boolean","undefined","labelElementId","handleOnChange","event","preventDefault","target","sx","marginBlockEnd","Spacing2","disabled","type","readOnly","MemoizedSwitch"],"sources":["../src/Switch.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 {\n ChangeEventHandler,\n memo,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { SwitchProps as MuiSwitchProps, FormLabel } from \"@mui/material\";\nimport { useTranslation } from \"react-i18next\";\nimport styled from \"@emotion/styled\";\n\nimport { Box } from \"./Box\";\nimport { FieldComponentProps } from \"./FieldComponentProps\";\nimport { FieldHint } from \"./FieldHint\";\nimport { CheckedFieldProps } from \"./FormCheckedProps\";\nimport type { HtmlProps } from \"./HtmlProps\";\nimport { CheckIcon } from \"./icons.generated\";\nimport { ComponentControlledState, getControlState } from \"./inputUtils\";\nimport {\n DesignTokens,\n useOdysseyDesignTokens,\n} from \"./OdysseyDesignTokensContext\";\nimport { stripRem, toRem } from \"./remUtils\";\nimport { useUniqueId } from \"./useUniqueId\";\n\nconst { CONTROLLED } = ComponentControlledState;\n\nconst nonForwardedProps = [\n \"isChecked\",\n \"isDisabled\",\n \"isFullWidth\",\n \"isReadOnly\",\n \"odysseyDesignTokens\",\n];\n\nconst SwitchAndLabelContainer = styled(\"div\", {\n shouldForwardProp: (prop) => !nonForwardedProps.includes(prop),\n})<\n Pick<SwitchProps, \"isFullWidth\" | \"isDisabled\" | \"isReadOnly\"> & {\n odysseyDesignTokens: DesignTokens;\n }\n>(({ isFullWidth, odysseyDesignTokens }) => ({\n display: \"flex\",\n alignItems: \"flex-start\",\n justifyContent: \"space-between\",\n maxWidth: isFullWidth ? \"100%\" : odysseyDesignTokens.TypographyLineLengthMax,\n}));\n\nconst SwitchContainer = styled.div({\n position: \"relative\",\n});\n\nconst StyledSwitchLabel = styled(FormLabel, {\n shouldForwardProp: (prop) => !nonForwardedProps.includes(prop),\n})<\n Pick<SwitchLabelComponentProps, \"isDisabled\" | \"isReadOnly\"> & {\n odysseyDesignTokens: DesignTokens;\n }\n>(({ isDisabled, isReadOnly, odysseyDesignTokens }) => ({\n display: \"block\",\n margin: 0,\n color: odysseyDesignTokens.PaletteNeutralDark,\n\n ...(isDisabled && {\n color: odysseyDesignTokens.TypographyColorDisabled,\n p: {\n color: odysseyDesignTokens.TypographyColorDisabled,\n },\n a: {\n color: `${odysseyDesignTokens.TypographyColorDisabled} !important`,\n },\n }),\n\n ...(isReadOnly && {\n color: odysseyDesignTokens.HueNeutral700,\n p: {\n color: odysseyDesignTokens.HueNeutral700,\n },\n a: {\n color: `${odysseyDesignTokens.HueNeutral700} !important`,\n },\n }),\n}));\n\nconst SwitchTrack = styled(\"div\", {\n shouldForwardProp: (prop) => !nonForwardedProps.includes(prop),\n})<\n Pick<SwitchProps, \"isChecked\" | \"isDisabled\" | \"isReadOnly\"> & {\n odysseyDesignTokens: DesignTokens;\n }\n>(({ isChecked, isDisabled, isReadOnly, odysseyDesignTokens }) => ({\n position: \"relative\",\n width: odysseyDesignTokens.Spacing7,\n height: `calc(${odysseyDesignTokens.Spacing4} + ${odysseyDesignTokens.Spacing1})`,\n borderRadius: odysseyDesignTokens.BorderRadiusOuter,\n backgroundColor: odysseyDesignTokens.HueNeutral300,\n transition: `background-color ${odysseyDesignTokens.TransitionDurationMain}`,\n\n ...(isDisabled && {\n backgroundColor: odysseyDesignTokens.HueNeutral200,\n }),\n\n ...(isReadOnly && {\n backgroundColor: odysseyDesignTokens.HueNeutral600,\n }),\n\n ...(isChecked &&\n !isDisabled &&\n !isReadOnly && {\n backgroundColor: odysseyDesignTokens.PaletteSuccessLight,\n }),\n}));\n\nconst SwitchThumb = styled(\"span\", {\n shouldForwardProp: (prop) => !nonForwardedProps.includes(prop),\n})<\n Pick<SwitchProps, \"isChecked\" | \"isDisabled\" | \"isReadOnly\"> & {\n odysseyDesignTokens: DesignTokens;\n }\n>(({ isChecked, isDisabled, isReadOnly, odysseyDesignTokens }) => {\n const thumbOffset = toRem(3);\n const trackWidth = stripRem(odysseyDesignTokens.Spacing7);\n const thumbWidth = stripRem(odysseyDesignTokens.Spacing4) - toRem(2);\n const transformDistance = trackWidth - thumbWidth - thumbOffset * 2;\n\n return {\n position: \"absolute\",\n top: \"50%\",\n left: `${thumbOffset}rem`,\n width: `calc(${odysseyDesignTokens.Spacing4} - ${toRem(2)}rem)`,\n height: `calc(${odysseyDesignTokens.Spacing4} - ${toRem(2)}rem)`,\n borderRadius: odysseyDesignTokens.BorderRadiusRound,\n backgroundColor: odysseyDesignTokens.HueNeutralWhite,\n transform: \"translate3d(0, -50%, 0)\",\n transition: `transform ${odysseyDesignTokens.TransitionDurationMain}`,\n\n ...(isDisabled && {\n backgroundColor: odysseyDesignTokens.HueNeutral50,\n }),\n\n ...(isReadOnly && {\n backgroundColor: odysseyDesignTokens.HueNeutral400,\n }),\n\n ...(isChecked && {\n transform: `translate3d(${transformDistance}rem, -50%, 0)`,\n }),\n };\n});\n\nconst SwitchCheckMark = styled(CheckIcon, {\n shouldForwardProp: (prop) => !nonForwardedProps.includes(prop),\n})<\n Pick<SwitchProps, \"isChecked\" | \"isDisabled\" | \"isReadOnly\"> & {\n odysseyDesignTokens: DesignTokens;\n }\n>(({ isChecked, isDisabled, isReadOnly, odysseyDesignTokens }) => ({\n position: \"absolute\",\n top: \"50%\",\n left: 3,\n width: odysseyDesignTokens.Spacing4,\n transform: \"translateY(-50%)\",\n transition: `opacity ${odysseyDesignTokens.TransitionDurationMain}`,\n opacity: 0,\n path: {\n fill: odysseyDesignTokens.HueNeutralWhite,\n },\n\n ...(isChecked && {\n opacity: 1,\n }),\n\n ...((isDisabled || isReadOnly) && {\n path: {\n fill: odysseyDesignTokens.HueNeutral50,\n },\n }),\n}));\n\nconst HiddenCheckbox = styled.input<{\n odysseyDesignTokens: DesignTokens;\n isReadOnly?: boolean;\n}>(({ odysseyDesignTokens, isReadOnly }) => ({\n position: \"absolute\",\n top: 0,\n left: 0,\n width: \"100%\",\n height: \"100%\",\n margin: 0,\n opacity: 0,\n cursor: isReadOnly ? \"default\" : \"pointer\",\n zIndex: 2,\n\n \"&:focus-visible\": {\n \"~ [data-switch-track='true']\": {\n boxShadow: `0 0 0 2px ${odysseyDesignTokens.HueNeutralWhite}, 0 0 0 4px ${odysseyDesignTokens.PalettePrimaryMain}`,\n },\n },\n}));\n\ntype OnChangeCallbackArguments = {\n checked: boolean;\n value: string;\n};\n\nexport type SwitchProps = {\n /**\n * The label text for the Switch\n */\n label: string;\n /**\n * The change event handler for the Switch\n */\n onChange?: ({ checked, value }: OnChangeCallbackArguments) => void;\n /**\n * The value attribute of the Switch\n */\n value: string;\n /**\n * Determines whether the Switch is read-only\n */\n isReadOnly?: boolean;\n} & Pick<\n FieldComponentProps,\n \"hint\" | \"HintLinkComponent\" | \"id\" | \"isFullWidth\" | \"isDisabled\" | \"name\"\n> &\n Pick<CheckedFieldProps<MuiSwitchProps>, \"isChecked\" | \"isDefaultChecked\"> &\n Pick<HtmlProps, \"testId\">;\n\ntype SwitchLabelComponentProps = {\n hint: SwitchProps[\"hint\"];\n hintId?: string;\n HintLinkComponent: SwitchProps[\"HintLinkComponent\"];\n inputId: string;\n isDisabled: SwitchProps[\"isDisabled\"];\n isFullWidth: SwitchProps[\"isFullWidth\"];\n label: SwitchProps[\"label\"];\n isReadOnly: SwitchProps[\"isReadOnly\"];\n};\n\nconst SwitchLabel = ({\n hint,\n hintId,\n HintLinkComponent,\n inputId,\n isDisabled,\n label,\n isReadOnly,\n}: SwitchLabelComponentProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n return (\n <>\n <StyledSwitchLabel\n htmlFor={inputId}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n odysseyDesignTokens={odysseyDesignTokens}\n >\n {label}\n {hint && (\n <FieldHint\n id={hintId}\n text={hint}\n LinkComponent={HintLinkComponent}\n />\n )}\n </StyledSwitchLabel>\n </>\n );\n};\n\nconst MemoizedSwitchLabel = memo(SwitchLabel);\nSwitchLabel.displayName = \"SwitchLabel\";\n\nconst Switch = ({\n hint,\n HintLinkComponent,\n id: idProp,\n isChecked,\n isDefaultChecked,\n isDisabled,\n isFullWidth = false,\n isReadOnly = false,\n label,\n name,\n onChange,\n testId,\n value,\n}: SwitchProps) => {\n const { t } = useTranslation();\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const controlledStateRef = useRef(\n getControlState({\n controlledValue: isChecked,\n uncontrolledValue: isDefaultChecked,\n }),\n );\n const inputValues = useMemo(() => {\n if (controlledStateRef.current === CONTROLLED) {\n return { checked: isChecked };\n }\n return { defaultChecked: isDefaultChecked };\n }, [isDefaultChecked, isChecked]);\n\n const [internalSwitchChecked, setInternalSwitchChecked] = useState(\n controlledStateRef.current === CONTROLLED\n ? Boolean(isChecked)\n : Boolean(isDefaultChecked),\n );\n\n useEffect(() => {\n if (controlledStateRef.current === CONTROLLED) {\n setInternalSwitchChecked(Boolean(isChecked));\n }\n }, [isChecked]);\n\n const inputId = useUniqueId(idProp);\n\n const hintId = hint ? `${inputId}-hint` : undefined;\n const labelElementId = `${inputId}-label`;\n\n const handleOnChange = useCallback<ChangeEventHandler<HTMLInputElement>>(\n (event) => {\n if (isReadOnly) {\n event.preventDefault();\n return;\n }\n const target = event.target;\n const { checked, value } = target;\n setInternalSwitchChecked(checked);\n onChange?.({ checked, value });\n },\n [onChange, setInternalSwitchChecked, isReadOnly],\n );\n\n return (\n <Box\n sx={{\n marginBlockEnd: odysseyDesignTokens.Spacing2,\n \"&:last-child\": {\n marginBlockEnd: 0,\n },\n }}\n >\n <SwitchAndLabelContainer\n isFullWidth={isFullWidth}\n odysseyDesignTokens={odysseyDesignTokens}\n >\n <MemoizedSwitchLabel\n hint={hint}\n hintId={hintId}\n HintLinkComponent={HintLinkComponent}\n inputId={inputId}\n isDisabled={isDisabled}\n isFullWidth={isFullWidth}\n label={label}\n isReadOnly={isReadOnly}\n />\n <SwitchContainer>\n <HiddenCheckbox\n {...inputValues}\n aria-checked={internalSwitchChecked}\n aria-describedby={hintId}\n aria-label={\n internalSwitchChecked\n ? `${label}: ${t(\"switch.active\")}`\n : `${label}: ${t(\"switch.inactive\")}`\n }\n aria-labelledby={labelElementId}\n data-se={testId}\n disabled={isDisabled}\n id={inputId}\n name={name ?? inputId}\n onChange={handleOnChange}\n odysseyDesignTokens={odysseyDesignTokens}\n type=\"checkbox\"\n value={value}\n readOnly={isReadOnly}\n isReadOnly={isReadOnly}\n />\n <SwitchTrack\n data-switch-track\n isChecked={internalSwitchChecked}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n odysseyDesignTokens={odysseyDesignTokens}\n >\n <SwitchThumb\n isChecked={internalSwitchChecked}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n odysseyDesignTokens={odysseyDesignTokens}\n />\n <SwitchCheckMark\n isChecked={internalSwitchChecked}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n odysseyDesignTokens={odysseyDesignTokens}\n />\n </SwitchTrack>\n </SwitchContainer>\n </SwitchAndLabelContainer>\n </Box>\n );\n};\n\nconst MemoizedSwitch = memo(Switch);\nMemoizedSwitch.displayName = \"Switch\";\n\nexport { MemoizedSwitch as Switch };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAEEA,IAAI,EACJC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH,OAAO;AAEd,SAASC,cAAc,QAAQ,eAAe;AAC9C,OAAOC,MAAM,MAAM,iBAAiB;AAAC,SAE5BC,GAAG;AAAA,SAEHC,SAAS;AAAA,SAGTC,SAAS;AAAA,SACTC,wBAAwB,EAAEC,eAAe;AAAA,SAGhDC,sBAAsB;AAAA,SAEfC,QAAQ,EAAEC,KAAK;AAAA,SACfC,WAAW;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAEpB,MAAM;EAAEC;AAAW,CAAC,GAAGZ,wBAAwB;AAE/C,MAAMa,iBAAiB,GAAG,CACxB,WAAW,EACX,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,qBAAqB,CACtB;AAED,MAAMC,uBAAuB,GAAGlB,MAAM,CAAC,KAAK,EAAE;EAC5CmB,iBAAiB,EAAGC,IAAI,IAAK,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CAAC/B,WAAW,GAAG,QAAQ;AAErC,SAAS+B,cAAc,IAAI9B,MAAM"}
package/dist/Tabs.js CHANGED
@@ -19,26 +19,24 @@ import { useOdysseyDesignTokens } from "./OdysseyDesignTokensContext.js";
19
19
  import { jsx as _jsx } from "react/jsx-runtime";
20
20
  import { Fragment as _Fragment } from "react/jsx-runtime";
21
21
  import { jsxs as _jsxs } from "react/jsx-runtime";
22
- export const TabsTestSelectors = {
23
- feature: {
22
+ export const TabsTestSelector = {
23
+ children: {
24
24
  tabItem: {
25
- selector: {
25
+ elementSelector: {
26
26
  method: "ByRole",
27
27
  options: {
28
- name: "${label}"
28
+ label: "name"
29
29
  },
30
- templateVariableNames: ["label"],
31
30
  role: "tab"
32
31
  }
33
32
  }
34
33
  },
35
- selector: {
34
+ elementSelector: {
36
35
  method: "ByRole",
37
36
  options: {
38
- name: "${ariaLabel}"
37
+ label: "name"
39
38
  },
40
- role: "tablist",
41
- templateVariableNames: ["ariaLabel"]
39
+ role: "tablist"
42
40
  }
43
41
  };
44
42
  const TabLabel = ({
package/dist/Tabs.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.js","names":["memo","useCallback","useEffect","useState","TabContext","MuiTabContext","TabList","MuiTabList","TabPanel","MuiTabPanel","Badge","Box","useOdysseyDesignTokens","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","TabsTestSelectors","feature","tabItem","selector","method","options","name","templateVariableNames","role","TabLabel","label","notificationCount","notificationCountMax","tabState","value","odysseyDesignTokens","children","undefined","sx","marginInlineStart","Spacing2","badgeContent","badgeContentMax","type","Tabs","ariaLabel","initialValue","tabs","onChange","onChangeProp","setTabState","scrollButtons","setScrollButtons","event","animationFrame","cleanup","cancelAnimationFrame","document","removeEventListener","refreshScrollButtons","requestAnimationFrame","addEventListener","renderTab","tab","index","testId","isDisabled","startIcon","_Tab","disabled","icon","tabIndex","toString","variant","map","MemoizedTabs","displayName"],"sources":["../src/Tabs.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 {\n ReactElement,\n ReactNode,\n memo,\n useCallback,\n useEffect,\n useState,\n} from \"react\";\nimport {\n TabContext as MuiTabContext,\n TabList as MuiTabList,\n TabListProps as MuiTabListProps,\n TabPanel as MuiTabPanel,\n} from \"@mui/lab\";\nimport { Tab as MuiTab } from \"@mui/material\";\n\nimport { Badge, BadgeProps } from \"./Badge\";\nimport { Box } from \"./Box\";\nimport { HtmlProps } from \"./HtmlProps\";\nimport { useOdysseyDesignTokens } from \"./OdysseyDesignTokensContext\";\nimport { type FeatureTestSelector } from \"./test-selectors\";\n\nexport const TabsTestSelectors = {\n feature: {\n tabItem: {\n selector: {\n method: \"ByRole\",\n options: {\n name: \"${label}\",\n },\n templateVariableNames: [\"label\"],\n role: \"tab\",\n },\n },\n },\n selector: {\n method: \"ByRole\",\n options: {\n name: \"${ariaLabel}\",\n },\n role: \"tablist\",\n templateVariableNames: [\"ariaLabel\"],\n },\n} as const satisfies FeatureTestSelector;\n\nexport type TabItemProps = {\n /**\n * The content of the Tab itself\n */\n children: ReactNode;\n /**\n * If `true`, the TabItem is disabled\n */\n isDisabled?: boolean;\n /**\n * The label text for the TabItem\n */\n label: string;\n /**\n * An optional icon to display at the start of the TabItem\n */\n startIcon?: ReactElement;\n /**\n * The value associated with the TabItem\n */\n value?: string;\n} & {\n notificationCount?: BadgeProps[\"badgeContent\"];\n notificationCountMax?: BadgeProps[\"badgeContentMax\"];\n} & Pick<HtmlProps, \"testId\" | \"translate\">;\n\nexport type TabsProps = {\n /**\n * @deprecated please use the `value` prop instead\n * When `value` is provided, `initialValue` isn't used.\n */\n initialValue?: string;\n /**\n * The TabItems to be included in the Tabs group\n */\n tabs: TabItemProps[];\n /**\n * Identifier for the selected tab.\n */\n value?: string;\n /**\n * Callback fired when the active tab is changed.\n */\n onChange?: MuiTabListProps[\"onChange\"];\n};\n\nconst TabLabel = ({\n label,\n notificationCount,\n notificationCountMax,\n tabState,\n value,\n}: Pick<\n TabItemProps,\n \"label\" | \"notificationCount\" | \"notificationCountMax\" | \"value\"\n> & {\n tabState: string;\n}) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n return (\n <>\n {label}\n {notificationCount !== undefined && notificationCount > 0 && (\n <Box\n sx={{\n marginInlineStart: notificationCount\n ? odysseyDesignTokens.Spacing2\n : 0,\n }}\n >\n <Badge\n badgeContent={notificationCount}\n badgeContentMax={notificationCountMax}\n type={value === tabState ? \"attention\" : \"default\"}\n />\n </Box>\n )}\n </>\n );\n};\n\nconst Tabs = ({\n ariaLabel,\n initialValue,\n tabs,\n value,\n onChange: onChangeProp,\n}: TabsProps & Pick<HtmlProps, \"ariaLabel\">) => {\n const [tabState, setTabState] = useState(initialValue ?? value ?? \"0\");\n /*\n The scrollButtons prop is initially set to `false`.\n It's then reset to `auto` when the document is visible.\n This prevents a rare bug where scroll buttons appear\n when the component is rendered while hidden and the\n screen is wide enough to not need scroll buttons.\n */\n const [scrollButtons, setScrollButtons] =\n useState<MuiTabListProps[\"scrollButtons\"]>(false);\n const onChange = useCallback<NonNullable<MuiTabListProps[\"onChange\"]>>(\n (event, value: string) => {\n setTabState(value);\n onChangeProp?.(event, value);\n },\n [onChangeProp],\n );\n\n useEffect(() => {\n if (value !== undefined) {\n setTabState(value);\n }\n }, [value]);\n\n // listen for visibility change to reset scroll buttons override\n useEffect(() => {\n // keep track of animation frame to cancel when needed\n let animationFrame: number;\n\n // called when unmounted or scroll buttons is reset\n const cleanup = () => {\n cancelAnimationFrame(animationFrame);\n document.removeEventListener(\"visibilitychange\", refreshScrollButtons);\n };\n\n // Reset the scroll buttons override when the document becomes visible.\n // If called, then the document is hidden because the event listener\n // is only registered if the document is hidden\n function refreshScrollButtons() {\n animationFrame = requestAnimationFrame(() => {\n cleanup();\n setScrollButtons(\"auto\");\n });\n }\n\n // don't override scroll buttons if it's already set to \"auto\"\n if (scrollButtons !== \"auto\") {\n document.addEventListener(\"visibilitychange\", refreshScrollButtons);\n }\n return () => {\n cleanup();\n };\n }, [scrollButtons]);\n\n const renderTab = useCallback(\n (tab: TabItemProps, index: number) => {\n const {\n testId,\n isDisabled,\n label,\n startIcon,\n value,\n notificationCount,\n notificationCountMax,\n } = tab;\n\n return (\n <MuiTab\n data-se={testId}\n disabled={isDisabled}\n icon={startIcon}\n tabIndex={0}\n label={\n <TabLabel\n label={label}\n notificationCount={notificationCount}\n notificationCountMax={notificationCountMax}\n tabState={tabState}\n value={value}\n />\n }\n value={value ? value : index.toString()}\n key={value ? value : index.toString()}\n />\n );\n },\n [tabState],\n );\n\n return (\n <MuiTabContext value={tabState}>\n <MuiTabList\n onChange={onChange}\n aria-label={ariaLabel}\n variant=\"scrollable\"\n scrollButtons={scrollButtons}\n >\n {tabs.map((tab, index) => renderTab(tab, index))}\n </MuiTabList>\n {tabs.map((tab, index) => (\n <MuiTabPanel\n value={tab.value ? tab.value : index.toString()}\n key={tab.value ? tab.value : index.toString()}\n >\n {tab.children}\n </MuiTabPanel>\n ))}\n </MuiTabContext>\n );\n};\n\nconst MemoizedTabs = memo(Tabs);\nMemoizedTabs.displayName = \"Tabs\";\n\nexport { MemoizedTabs as Tabs };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAGEA,IAAI,EACJC,WAAW,EACXC,SAAS,EACTC,QAAQ,QACH,OAAO;AACd,SACEC,UAAU,IAAIC,aAAa,EAC3BC,OAAO,IAAIC,UAAU,EAErBC,QAAQ,IAAIC,WAAW,QAClB,UAAU;AAAC,SAGT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CAAC7B,KAAK,GAAG6B,GAAG,CAAC7B,KAAK,GAAG8B,KAAK,CAACQ,QAAQ,CAAC,CAGjC,CACd,CAAC;EAAA,CACW,CAAC;AAEpB,CAAC;AAED,MAAMG,YAAY,GAAG1E,IAAI,CAAC2C,IAAI,CAAC;AAC/B+B,YAAY,CAACC,WAAW,GAAG,MAAM;AAEjC,SAASD,YAAY,IAAI/B,IAAI"}
1
+ {"version":3,"file":"Tabs.js","names":["memo","useCallback","useEffect","useState","TabContext","MuiTabContext","TabList","MuiTabList","TabPanel","MuiTabPanel","Badge","Box","useOdysseyDesignTokens","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","TabsTestSelector","children","tabItem","elementSelector","method","options","label","role","TabLabel","notificationCount","notificationCountMax","tabState","value","odysseyDesignTokens","undefined","sx","marginInlineStart","Spacing2","badgeContent","badgeContentMax","type","Tabs","ariaLabel","initialValue","tabs","onChange","onChangeProp","setTabState","scrollButtons","setScrollButtons","event","animationFrame","cleanup","cancelAnimationFrame","document","removeEventListener","refreshScrollButtons","requestAnimationFrame","addEventListener","renderTab","tab","index","testId","isDisabled","startIcon","_Tab","disabled","icon","tabIndex","toString","variant","map","MemoizedTabs","displayName"],"sources":["../src/Tabs.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 {\n ReactElement,\n ReactNode,\n memo,\n useCallback,\n useEffect,\n useState,\n} from \"react\";\nimport {\n TabContext as MuiTabContext,\n TabList as MuiTabList,\n TabListProps as MuiTabListProps,\n TabPanel as MuiTabPanel,\n} from \"@mui/lab\";\nimport { Tab as MuiTab } from \"@mui/material\";\n\nimport { Badge, BadgeProps } from \"./Badge\";\nimport { Box } from \"./Box\";\nimport { HtmlProps } from \"./HtmlProps\";\nimport { useOdysseyDesignTokens } from \"./OdysseyDesignTokensContext\";\nimport { type TestSelector } from \"./test-selectors\";\n\nexport const TabsTestSelector = {\n children: {\n tabItem: {\n elementSelector: {\n method: \"ByRole\",\n options: {\n label: \"name\",\n },\n role: \"tab\",\n },\n },\n },\n elementSelector: {\n method: \"ByRole\",\n options: {\n label: \"name\",\n },\n role: \"tablist\",\n },\n} as const satisfies TestSelector;\n\nexport type TabItemProps = {\n /**\n * The content of the Tab itself\n */\n children: ReactNode;\n /**\n * If `true`, the TabItem is disabled\n */\n isDisabled?: boolean;\n /**\n * The label text for the TabItem\n */\n label: string;\n /**\n * An optional icon to display at the start of the TabItem\n */\n startIcon?: ReactElement;\n /**\n * The value associated with the TabItem\n */\n value?: string;\n} & {\n notificationCount?: BadgeProps[\"badgeContent\"];\n notificationCountMax?: BadgeProps[\"badgeContentMax\"];\n} & Pick<HtmlProps, \"testId\" | \"translate\">;\n\nexport type TabsProps = {\n /**\n * @deprecated please use the `value` prop instead\n * When `value` is provided, `initialValue` isn't used.\n */\n initialValue?: string;\n /**\n * The TabItems to be included in the Tabs group\n */\n tabs: TabItemProps[];\n /**\n * Identifier for the selected tab.\n */\n value?: string;\n /**\n * Callback fired when the active tab is changed.\n */\n onChange?: MuiTabListProps[\"onChange\"];\n};\n\nconst TabLabel = ({\n label,\n notificationCount,\n notificationCountMax,\n tabState,\n value,\n}: Pick<\n TabItemProps,\n \"label\" | \"notificationCount\" | \"notificationCountMax\" | \"value\"\n> & {\n tabState: string;\n}) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n return (\n <>\n {label}\n {notificationCount !== undefined && notificationCount > 0 && (\n <Box\n sx={{\n marginInlineStart: notificationCount\n ? odysseyDesignTokens.Spacing2\n : 0,\n }}\n >\n <Badge\n badgeContent={notificationCount}\n badgeContentMax={notificationCountMax}\n type={value === tabState ? \"attention\" : \"default\"}\n />\n </Box>\n )}\n </>\n );\n};\n\nconst Tabs = ({\n ariaLabel,\n initialValue,\n tabs,\n value,\n onChange: onChangeProp,\n}: TabsProps & Pick<HtmlProps, \"ariaLabel\">) => {\n const [tabState, setTabState] = useState(initialValue ?? value ?? \"0\");\n /*\n The scrollButtons prop is initially set to `false`.\n It's then reset to `auto` when the document is visible.\n This prevents a rare bug where scroll buttons appear\n when the component is rendered while hidden and the\n screen is wide enough to not need scroll buttons.\n */\n const [scrollButtons, setScrollButtons] =\n useState<MuiTabListProps[\"scrollButtons\"]>(false);\n const onChange = useCallback<NonNullable<MuiTabListProps[\"onChange\"]>>(\n (event, value: string) => {\n setTabState(value);\n onChangeProp?.(event, value);\n },\n [onChangeProp],\n );\n\n useEffect(() => {\n if (value !== undefined) {\n setTabState(value);\n }\n }, [value]);\n\n // listen for visibility change to reset scroll buttons override\n useEffect(() => {\n // keep track of animation frame to cancel when needed\n let animationFrame: number;\n\n // called when unmounted or scroll buttons is reset\n const cleanup = () => {\n cancelAnimationFrame(animationFrame);\n document.removeEventListener(\"visibilitychange\", refreshScrollButtons);\n };\n\n // Reset the scroll buttons override when the document becomes visible.\n // If called, then the document is hidden because the event listener\n // is only registered if the document is hidden\n function refreshScrollButtons() {\n animationFrame = requestAnimationFrame(() => {\n cleanup();\n setScrollButtons(\"auto\");\n });\n }\n\n // don't override scroll buttons if it's already set to \"auto\"\n if (scrollButtons !== \"auto\") {\n document.addEventListener(\"visibilitychange\", refreshScrollButtons);\n }\n return () => {\n cleanup();\n };\n }, [scrollButtons]);\n\n const renderTab = useCallback(\n (tab: TabItemProps, index: number) => {\n const {\n testId,\n isDisabled,\n label,\n startIcon,\n value,\n notificationCount,\n notificationCountMax,\n } = tab;\n\n return (\n <MuiTab\n data-se={testId}\n disabled={isDisabled}\n icon={startIcon}\n tabIndex={0}\n label={\n <TabLabel\n label={label}\n notificationCount={notificationCount}\n notificationCountMax={notificationCountMax}\n tabState={tabState}\n value={value}\n />\n }\n value={value ? value : index.toString()}\n key={value ? value : index.toString()}\n />\n );\n },\n [tabState],\n );\n\n return (\n <MuiTabContext value={tabState}>\n <MuiTabList\n onChange={onChange}\n aria-label={ariaLabel}\n variant=\"scrollable\"\n scrollButtons={scrollButtons}\n >\n {tabs.map((tab, index) => renderTab(tab, index))}\n </MuiTabList>\n {tabs.map((tab, index) => (\n <MuiTabPanel\n value={tab.value ? tab.value : index.toString()}\n key={tab.value ? tab.value : index.toString()}\n >\n {tab.children}\n </MuiTabPanel>\n ))}\n </MuiTabContext>\n );\n};\n\nconst MemoizedTabs = memo(Tabs);\nMemoizedTabs.displayName = \"Tabs\";\n\nexport { MemoizedTabs as Tabs };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAGEA,IAAI,EACJC,WAAW,EACXC,SAAS,EACTC,QAAQ,QACH,OAAO;AACd,SACEC,UAAU,IAAIC,aAAa,EAC3BC,OAAO,IAAIC,UAAU,EAErBC,QAAQ,IAAIC,WAAW,QAClB,UAAU;AAAC,SAGTC,KAAK;AAAA,SACLC,GAAG;AAAA,SAEHC,sBAAsB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAG/B,OAAO,MAAMC,gBAAgB,GAAG;EAC9BC,QAAQ,EAAE;IACRC,OAAO,EAAE;MACPC,eAAe,EAAE;QACfC,MAAM,EAAE,QAAQ;QAChBC,OAAO,EAAE;UACPC,KAAK,EAAE;QACT,CAAC;QACDC,IAAI,EAAE;MACR;IACF;EACF,CAAC;EACDJ,eAAe,EAAE;IACfC,MAAM,EAAE,QAAQ;IAChBC,OAAO,EAAE;MACPC,KAAK,EAAE;IACT,CAAC;IACDC,IAAI,EAAE;EACR;AACF,CAAiC;AAgDjC,MAAMC,QAAQ,GAAGA,CAAC;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