@okta/odyssey-react-mui 1.1.1 → 1.4.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 (142) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +1 -1
  3. package/dist/Autocomplete.js +13 -1
  4. package/dist/Autocomplete.js.map +1 -1
  5. package/dist/Breadcrumbs.js +146 -0
  6. package/dist/Breadcrumbs.js.map +1 -0
  7. package/dist/Link.js +3 -1
  8. package/dist/Link.js.map +1 -1
  9. package/dist/MenuButton.js.map +1 -1
  10. package/dist/OdysseyCacheProvider.js +4 -1
  11. package/dist/OdysseyCacheProvider.js.map +1 -1
  12. package/dist/OdysseyProvider.js +5 -1
  13. package/dist/OdysseyProvider.js.map +1 -1
  14. package/dist/OdysseyThemeProvider.js +5 -1
  15. package/dist/OdysseyThemeProvider.js.map +1 -1
  16. package/dist/OdysseyTranslationProvider.js +1 -1
  17. package/dist/OdysseyTranslationProvider.js.map +1 -1
  18. package/dist/PasswordField.js +11 -3
  19. package/dist/PasswordField.js.map +1 -1
  20. package/dist/Select.js +34 -33
  21. package/dist/Select.js.map +1 -1
  22. package/dist/Tabs.js +8 -6
  23. package/dist/Tabs.js.map +1 -1
  24. package/dist/Typography.js +0 -22
  25. package/dist/Typography.js.map +1 -1
  26. package/dist/createShadowDom.js +26 -0
  27. package/dist/createShadowDom.js.map +1 -0
  28. package/dist/{OdysseyI18n.js → i18n.js} +3 -2
  29. package/dist/i18n.js.map +1 -0
  30. package/dist/index.js +2 -0
  31. package/dist/index.js.map +1 -1
  32. package/dist/labs/GroupPicker.js +190 -0
  33. package/dist/labs/GroupPicker.js.map +1 -0
  34. package/dist/labs/datePickerTheme.js +4 -2
  35. package/dist/labs/datePickerTheme.js.map +1 -1
  36. package/dist/labs/index.js +1 -0
  37. package/dist/labs/index.js.map +1 -1
  38. package/dist/properties/ts/odyssey-react-mui.js +4 -0
  39. package/dist/properties/ts/odyssey-react-mui.js.map +1 -1
  40. package/dist/src/Autocomplete.d.ts +23 -3
  41. package/dist/src/Autocomplete.d.ts.map +1 -1
  42. package/dist/src/Breadcrumbs.d.ts +31 -0
  43. package/dist/src/Breadcrumbs.d.ts.map +1 -0
  44. package/dist/src/Link.d.ts +6 -1
  45. package/dist/src/Link.d.ts.map +1 -1
  46. package/dist/src/MenuButton.d.ts +1 -1
  47. package/dist/src/MenuButton.d.ts.map +1 -1
  48. package/dist/src/OdysseyCacheProvider.d.ts +6 -1
  49. package/dist/src/OdysseyCacheProvider.d.ts.map +1 -1
  50. package/dist/src/OdysseyProvider.d.ts +1 -1
  51. package/dist/src/OdysseyProvider.d.ts.map +1 -1
  52. package/dist/src/OdysseyThemeProvider.d.ts +2 -1
  53. package/dist/src/OdysseyThemeProvider.d.ts.map +1 -1
  54. package/dist/src/OdysseyTranslationProvider.d.ts +1 -1
  55. package/dist/src/OdysseyTranslationProvider.d.ts.map +1 -1
  56. package/dist/src/PasswordField.d.ts +8 -0
  57. package/dist/src/PasswordField.d.ts.map +1 -1
  58. package/dist/src/Select.d.ts +1 -54
  59. package/dist/src/Select.d.ts.map +1 -1
  60. package/dist/src/Tabs.d.ts +7 -2
  61. package/dist/src/Tabs.d.ts.map +1 -1
  62. package/dist/src/Typography.d.ts +11 -15
  63. package/dist/src/Typography.d.ts.map +1 -1
  64. package/dist/src/createShadowDom.d.ts +16 -0
  65. package/dist/src/createShadowDom.d.ts.map +1 -0
  66. package/dist/src/{OdysseyI18n.d.ts → i18n.d.ts} +7 -2
  67. package/dist/src/i18n.d.ts.map +1 -0
  68. package/dist/src/index.d.ts +2 -0
  69. package/dist/src/index.d.ts.map +1 -1
  70. package/dist/src/labs/GroupPicker.d.ts +25 -0
  71. package/dist/src/labs/GroupPicker.d.ts.map +1 -0
  72. package/dist/src/labs/index.d.ts +1 -0
  73. package/dist/src/labs/index.d.ts.map +1 -1
  74. package/dist/src/properties/ts/odyssey-react-mui.d.ts +4 -0
  75. package/dist/src/properties/ts/odyssey-react-mui.d.ts.map +1 -1
  76. package/dist/src/theme/components.d.ts +4 -1
  77. package/dist/src/theme/components.d.ts.map +1 -1
  78. package/dist/src/theme/createOdysseyMuiTheme.d.ts +23 -0
  79. package/dist/src/theme/createOdysseyMuiTheme.d.ts.map +1 -0
  80. package/dist/src/theme/mixins.d.ts +3 -1
  81. package/dist/src/theme/mixins.d.ts.map +1 -1
  82. package/dist/src/theme/palette.d.ts +3 -1
  83. package/dist/src/theme/palette.d.ts.map +1 -1
  84. package/dist/src/theme/shape.d.ts +3 -1
  85. package/dist/src/theme/shape.d.ts.map +1 -1
  86. package/dist/src/theme/spacing.d.ts +3 -1
  87. package/dist/src/theme/spacing.d.ts.map +1 -1
  88. package/dist/src/theme/theme.d.ts +1 -8
  89. package/dist/src/theme/theme.d.ts.map +1 -1
  90. package/dist/src/theme/typography.d.ts +3 -1
  91. package/dist/src/theme/typography.d.ts.map +1 -1
  92. package/dist/theme/components.js +112 -67
  93. package/dist/theme/components.js.map +1 -1
  94. package/dist/theme/createOdysseyMuiTheme.js +51 -0
  95. package/dist/theme/createOdysseyMuiTheme.js.map +1 -0
  96. package/dist/theme/mixins.js +4 -1
  97. package/dist/theme/mixins.js.map +1 -1
  98. package/dist/theme/palette.js +4 -1
  99. package/dist/theme/palette.js.map +1 -1
  100. package/dist/theme/shape.js +4 -1
  101. package/dist/theme/shape.js.map +1 -1
  102. package/dist/theme/spacing.js +4 -1
  103. package/dist/theme/spacing.js.map +1 -1
  104. package/dist/theme/theme.js +1 -20
  105. package/dist/theme/theme.js.map +1 -1
  106. package/dist/theme/typography.js +4 -1
  107. package/dist/theme/typography.js.map +1 -1
  108. package/dist/tsconfig.production.tsbuildinfo +1 -1
  109. package/package.json +4 -4
  110. package/scripts/properties-to-ts.js +1 -1
  111. package/src/Autocomplete.tsx +47 -3
  112. package/src/Breadcrumbs.tsx +199 -0
  113. package/src/Link.tsx +7 -1
  114. package/src/MenuButton.tsx +2 -3
  115. package/src/OdysseyCacheProvider.tsx +9 -1
  116. package/src/OdysseyProvider.tsx +9 -2
  117. package/src/OdysseyThemeProvider.tsx +8 -2
  118. package/src/OdysseyTranslationProvider.test.tsx +2 -2
  119. package/src/OdysseyTranslationProvider.tsx +1 -1
  120. package/src/PasswordField.tsx +24 -8
  121. package/src/Select.tsx +147 -152
  122. package/src/Tabs.tsx +24 -12
  123. package/src/Typography.tsx +0 -26
  124. package/src/createShadowDom.ts +46 -0
  125. package/src/{OdysseyI18n.ts → i18n.ts} +2 -2
  126. package/src/index.ts +2 -0
  127. package/src/labs/GroupPicker.tsx +241 -0
  128. package/src/labs/README.md +1 -1
  129. package/src/labs/datePickerTheme.tsx +2 -2
  130. package/src/labs/index.ts +1 -0
  131. package/src/properties/odyssey-react-mui.properties +4 -0
  132. package/src/properties/ts/odyssey-react-mui.ts +1 -1
  133. package/src/theme/components.tsx +61 -13
  134. package/src/theme/createOdysseyMuiTheme.ts +47 -0
  135. package/src/theme/mixins.ts +5 -1
  136. package/src/theme/palette.ts +5 -3
  137. package/src/theme/shape.ts +5 -1
  138. package/src/theme/spacing.ts +5 -3
  139. package/src/theme/theme.ts +1 -26
  140. package/src/theme/typography.ts +5 -3
  141. package/dist/OdysseyI18n.js.map +0 -1
  142. package/dist/src/OdysseyI18n.d.ts.map +0 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,48 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.4.0](https://github.com/okta/odyssey/compare/v1.3.0...v1.4.0) (2023-10-23)
7
+
8
+ ### Features
9
+
10
+ - add onclick prop to link component ([#2003](https://github.com/okta/odyssey/issues/2003)) ([7ae351e](https://github.com/okta/odyssey/commit/7ae351edb3001de752ffc292133a05a9b64c57be))
11
+
12
+ ## [1.3.0](https://github.com/okta/odyssey/compare/v1.2.0...v1.3.0) (2023-10-18)
13
+
14
+ ### Features
15
+
16
+ - group picker ([71171e0](https://github.com/okta/odyssey/commit/71171e009460f6f6606cd4b87647d36c8d5b119a))
17
+
18
+ ### Bug Fixes
19
+
20
+ - gray color in default Status lamp variant ([1dd74df](https://github.com/okta/odyssey/commit/1dd74df9cb86147ed4cb02e3deb04c0be7f6fe6c))
21
+ - inclusive language adjustments ([#1995](https://github.com/okta/odyssey/issues/1995)) ([82f4cb5](https://github.com/okta/odyssey/commit/82f4cb5290d418623c35fdb2504da37ab05a2d89))
22
+ - menu button not allowing falsey children ([#1999](https://github.com/okta/odyssey/issues/1999)) ([b63b117](https://github.com/okta/odyssey/commit/b63b117beb7d86671a91d76256092400d0c7e204))
23
+ - remove border from default status lamp ([5bacb73](https://github.com/okta/odyssey/commit/5bacb73d76662e6d4c4a5423fdf6cb96ac677913))
24
+ - update displayName for Autocomplete ([#1983](https://github.com/okta/odyssey/issues/1983)) ([65abc8e](https://github.com/okta/odyssey/commit/65abc8e99949d9bafacace4a5591dec93ca3cc1f))
25
+
26
+ ## [1.2.0](https://github.com/okta/odyssey/compare/v1.1.1...v1.2.0) (2023-09-29)
27
+
28
+ ### Features
29
+
30
+ - adds ability to use Shadow DOM with Odyssey ([#1966](https://github.com/okta/odyssey/issues/1966)) ([6b52246](https://github.com/okta/odyssey/commit/6b5224662982d7e214457292d0ab168719dc8c29))
31
+ - hide selected Autocomplete items ([#1984](https://github.com/okta/odyssey/issues/1984)) ([11aa9ee](https://github.com/okta/odyssey/commit/11aa9ee0211e7f5b2c2512d77ee7efd8b4c7426e))
32
+ - **odyssey-react-mui:** adding new prop for PasswordField to control show password button ([58ad6c8](https://github.com/okta/odyssey/commit/58ad6c8027d963a557fc501acba7ebc5724e2410))
33
+ - **odyssey-react-mui:** renamed prop to hasShowPassword and changed default to true ([6c3b8d2](https://github.com/okta/odyssey/commit/6c3b8d2d8486afbee6869a12c5320f2ea152dc5a))
34
+
35
+ ### Bug Fixes
36
+
37
+ - id and name not changing in Storybook ([#1987](https://github.com/okta/odyssey/issues/1987)) ([2f57e15](https://github.com/okta/odyssey/commit/2f57e156f27c64954e8aa39662198d9c04ff9518))
38
+ - **odyssey-react-mui:** add mising prop errorMessage to autocomplete ([1c1360c](https://github.com/okta/odyssey/commit/1c1360cd33f74b5d91f961ed859ab0972633995d))
39
+ - **odyssey-react-mui:** add props onBlur, onFocus, id, name ([66ad838](https://github.com/okta/odyssey/commit/66ad838821ba18c3ee4c24f729b89c76eb62df3e))
40
+ - **odyssey-react-mui:** address PR comments ([f10a903](https://github.com/okta/odyssey/commit/f10a903cece4f873f91a588b3b603d96b6055eb1))
41
+ - **odyssey-react-mui:** fixing issue with t function type by upgrading package ([c0b8343](https://github.com/okta/odyssey/commit/c0b834326afda7e42aacb64af174def159c31e90))
42
+ - **odyssey-react-mui:** fixing tests to use getByRole and canvas ([cd7feed](https://github.com/okta/odyssey/commit/cd7feed17147397e5f79eed31e31d59ee17f562d))
43
+ - **odyssey-react-mui:** localizing the aria-label for the PasswordField component ([e9d332a](https://github.com/okta/odyssey/commit/e9d332a5f691742609533e679bb58d7f910c9a1b))
44
+ - **odyssey-react-mui:** toggle aria label based on password ([405fd71](https://github.com/okta/odyssey/commit/405fd7155d8ac9bb5b697bbb8b4dad3c021a0e63))
45
+ - **odyssey-react-mui:** updating descriptions for props ([12b9587](https://github.com/okta/odyssey/commit/12b9587cda9058ff00180e0cc7b2bcb4debeb27f))
46
+ - removed classes prop from Typography components ([#1989](https://github.com/okta/odyssey/issues/1989)) ([889f369](https://github.com/okta/odyssey/commit/889f3697582da68f71f2db801c1e7702a29fd9f5))
47
+
6
48
  ## [1.1.1](https://github.com/okta/odyssey/compare/v1.1.0...v1.1.1) (2023-09-15)
7
49
 
8
50
  **Note:** Version bump only for package @okta/odyssey-react-mui
package/README.md CHANGED
@@ -129,7 +129,7 @@ bundled, and polyfilled for advanced use cases and browser support targets.
129
129
 
130
130
  ## License
131
131
 
132
- [Apache Version 2.0](https://github.com/okta/odyssey/blob/master/LICENSE)
132
+ [Apache Version 2.0](https://github.com/okta/odyssey/blob/main/LICENSE)
133
133
 
134
134
  ## Support Disclaimer
135
135
 
@@ -16,7 +16,9 @@ import { Field } from "./Field.js";
16
16
  import { jsx as _jsx } from "react/jsx-runtime";
17
17
  const Autocomplete = _ref => {
18
18
  let {
19
+ errorMessage,
19
20
  hasMultipleChoices,
21
+ id: idOverride,
20
22
  isCustomValueAllowed,
21
23
  isDisabled,
22
24
  isLoading,
@@ -24,8 +26,11 @@ const Autocomplete = _ref => {
24
26
  isReadOnly,
25
27
  hint,
26
28
  label,
29
+ name: nameOverride,
30
+ onBlur,
27
31
  onChange,
28
32
  onInputChange,
33
+ onFocus,
29
34
  options,
30
35
  value,
31
36
  testId
@@ -37,6 +42,7 @@ const Autocomplete = _ref => {
37
42
  ...params
38
43
  } = _ref2;
39
44
  return _jsx(Field, {
45
+ errorMessage: errorMessage,
40
46
  fieldType: "single",
41
47
  hasVisibleLabel: true,
42
48
  id: InputLabelProps.htmlFor,
@@ -53,21 +59,26 @@ const Autocomplete = _ref => {
53
59
  ...InputProps,
54
60
  "aria-describedby": ariaDescribedBy,
55
61
  id: id,
62
+ name: nameOverride ?? id,
56
63
  required: !isOptional
57
64
  });
58
65
  }
59
66
  });
60
- }, [hint, isOptional, label]);
67
+ }, [errorMessage, hint, isOptional, label, nameOverride]);
61
68
  return _jsx(_Autocomplete, {
62
69
  "aria-disabled": isDisabled,
63
70
  "data-se": testId,
64
71
  disableCloseOnSelect: hasMultipleChoices,
65
72
  disabled: isDisabled,
66
73
  freeSolo: isCustomValueAllowed,
74
+ filterSelectedOptions: true,
75
+ id: idOverride,
67
76
  loading: isLoading,
68
77
  multiple: hasMultipleChoices,
78
+ onBlur: onBlur,
69
79
  onChange: onChange,
70
80
  onInputChange: onInputChange,
81
+ onFocus: onFocus,
71
82
  options: options,
72
83
  readOnly: isReadOnly,
73
84
  renderInput: renderInput,
@@ -75,5 +86,6 @@ const Autocomplete = _ref => {
75
86
  });
76
87
  };
77
88
  const MemoizedAutocomplete = memo(Autocomplete);
89
+ MemoizedAutocomplete.displayName = "Autocomplete";
78
90
  export { MemoizedAutocomplete as Autocomplete };
79
91
  //# sourceMappingURL=Autocomplete.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Autocomplete.js","names":["memo","useCallback","Field","jsx","_jsx","Autocomplete","_ref","hasMultipleChoices","isCustomValueAllowed","isDisabled","isLoading","isOptional","isReadOnly","hint","label","onChange","onInputChange","options","value","testId","renderInput","_ref2","InputLabelProps","InputProps","params","fieldType","hasVisibleLabel","id","htmlFor","renderFieldComponent","_ref3","ariaDescribedBy","_InputBase","required","_Autocomplete","disableCloseOnSelect","disabled","freeSolo","loading","multiple","readOnly","MemoizedAutocomplete"],"sources":["../src/Autocomplete.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport {\n Autocomplete as MuiAutocomplete,\n AutocompleteProps as MuiAutocompleteProps,\n InputBase,\n} from \"@mui/material\";\nimport { memo, useCallback } from \"react\";\n\nimport { Field } from \"./Field\";\nimport type { SeleniumProps } from \"./SeleniumProps\";\n\nexport type AutocompleteProps<\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined\n> = {\n /**\n * Enables multiple choice selection\n */\n hasMultipleChoices?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"multiple\"];\n /**\n * The hint text for the Autocomplete input\n */\n hint?: string;\n /**\n * Allows the input of custom values\n */\n isCustomValueAllowed?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"freeSolo\"];\n /**\n * Disables the Autocomplete input\n */\n isDisabled?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"disabled\"];\n /**\n * Displays a loading indicator\n */\n isLoading?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"loading\"];\n /**\n * If `true`, the `input` element is not required.\n */\n isOptional?: boolean;\n /**\n * Makes the Autocomplete input read-only\n */\n isReadOnly?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"readOnly\"];\n /**\n * The label text for the autocomplete input\n */\n label: string;\n /**\n * Callback fired when the value of the autocomplete input changes\n */\n onChange?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onChange\"];\n /**\n * Callback fired when the input value of the autocomplete input changes\n */\n onInputChange?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onInputChange\"];\n /**\n * The options for the Autocomplete input\n */\n options: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"options\"];\n /**\n * The value of the Autocomplete input\n */\n value?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"value\"];\n} & SeleniumProps;\n\nconst Autocomplete = <\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined\n>({\n hasMultipleChoices,\n isCustomValueAllowed,\n isDisabled,\n isLoading,\n isOptional = false,\n isReadOnly,\n hint,\n label,\n onChange,\n onInputChange,\n options,\n value,\n testId,\n}: AutocompleteProps<OptionType, HasMultipleChoices, IsCustomValueAllowed>) => {\n const renderInput = useCallback(\n ({ InputLabelProps, InputProps, ...params }) => (\n <Field\n fieldType=\"single\"\n hasVisibleLabel\n id={InputLabelProps.htmlFor}\n hint={hint}\n label={label}\n isOptional={isOptional}\n renderFieldComponent={({ ariaDescribedBy, id }) => (\n <InputBase\n {...params}\n {...InputProps}\n aria-describedby={ariaDescribedBy}\n id={id}\n required={!isOptional}\n />\n )}\n />\n ),\n [hint, isOptional, label]\n );\n\n return (\n <MuiAutocomplete\n // AutoComplete is wrapped in a div within MUI which does not get the disabled attr. So this aria-disabled gets set in the div\n aria-disabled={isDisabled}\n data-se={testId}\n disableCloseOnSelect={hasMultipleChoices}\n disabled={isDisabled}\n freeSolo={isCustomValueAllowed}\n loading={isLoading}\n multiple={hasMultipleChoices}\n onChange={onChange}\n onInputChange={onInputChange}\n options={options}\n readOnly={isReadOnly}\n renderInput={renderInput}\n value={value}\n />\n );\n};\n\nconst MemoizedAutocomplete = memo(Autocomplete) as typeof Autocomplete;\n\nexport { MemoizedAutocomplete as Autocomplete };\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA,SAASA,IAAI,EAAEC,WAAW,QAAQ,OAAO;AAAC,SAEjCC,KAAK;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAuGd,MAAMC,YAAY,GAAGC,IAAA,IAkB0D;EAAA,IAd7E;IACAC,kBAAkB;IAClBC,oBAAoB;IACpBC,UAAU;IACVC,SAAS;IACTC,UAAU,GAAG,KAAK;IAClBC,UAAU;IACVC,IAAI;IACJC,KAAK;IACLC,QAAQ;IACRC,aAAa;IACbC,OAAO;IACPC,KAAK;IACLC;EACuE,CAAC,GAAAb,IAAA;EACxE,MAAMc,WAAW,GAAGnB,WAAW,CAC7BoB,KAAA;IAAA,IAAC;MAAEC,eAAe;MAAEC,UAAU;MAAE,GAAGC;IAAO,CAAC,GAAAH,KAAA;IAAA,OACzCjB,IAAA,CAACF,KAAK;MACJuB,SAAS,EAAC,QAAQ;MAClBC,eAAe;MACfC,EAAE,EAAEL,eAAe,CAACM,OAAQ;MAC5Bf,IAAI,EAAEA,IAAK;MACXC,KAAK,EAAEA,KAAM;MACbH,UAAU,EAAEA,UAAW;MACvBkB,oBAAoB,EAAEC,KAAA;QAAA,IAAC;UAAEC,eAAe;UAAEJ;QAAG,CAAC,GAAAG,KAAA;QAAA,OAC5C1B,IAAA,CAAA4B,UAAA;UAAA,GACMR,MAAM;UAAA,GACND,UAAU;UACd,oBAAkBQ,eAAgB;UAClCJ,EAAE,EAAEA,EAAG;UACPM,QAAQ,EAAE,CAACtB;QAAW,CACvB,CAAC;MAAA;IACF,CACH,CAAC;EAAA,CACH,EACD,CAACE,IAAI,EAAEF,UAAU,EAAEG,KAAK,CAC1B,CAAC;EAED,OACEV,IAAA,CAAA8B,aAAA;IAEE,iBAAezB,UAAW;IAC1B,WAASU,MAAO;IAChBgB,oBAAoB,EAAE5B,kBAAmB;IACzC6B,QAAQ,EAAE3B,UAAW;IACrB4B,QAAQ,EAAE7B,oBAAqB;IAC/B8B,OAAO,EAAE5B,SAAU;IACnB6B,QAAQ,EAAEhC,kBAAmB;IAC7BQ,QAAQ,EAAEA,QAAS;IACnBC,aAAa,EAAEA,aAAc;IAC7BC,OAAO,EAAEA,OAAQ;IACjBuB,QAAQ,EAAE5B,UAAW;IACrBQ,WAAW,EAAEA,WAAY;IACzBF,KAAK,EAAEA;EAAM,CACd,CAAC;AAEN,CAAC;AAED,MAAMuB,oBAAoB,GAAGzC,IAAI,CAACK,YAAY,CAAwB;AAEtE,SAASoC,oBAAoB,IAAIpC,YAAY"}
1
+ {"version":3,"file":"Autocomplete.js","names":["memo","useCallback","Field","jsx","_jsx","Autocomplete","_ref","errorMessage","hasMultipleChoices","id","idOverride","isCustomValueAllowed","isDisabled","isLoading","isOptional","isReadOnly","hint","label","name","nameOverride","onBlur","onChange","onInputChange","onFocus","options","value","testId","renderInput","_ref2","InputLabelProps","InputProps","params","fieldType","hasVisibleLabel","htmlFor","renderFieldComponent","_ref3","ariaDescribedBy","_InputBase","required","_Autocomplete","disableCloseOnSelect","disabled","freeSolo","filterSelectedOptions","loading","multiple","readOnly","MemoizedAutocomplete","displayName"],"sources":["../src/Autocomplete.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport {\n Autocomplete as MuiAutocomplete,\n AutocompleteProps as MuiAutocompleteProps,\n InputBase,\n} from \"@mui/material\";\nimport { memo, useCallback } from \"react\";\n\nimport { Field } from \"./Field\";\nimport type { SeleniumProps } from \"./SeleniumProps\";\n\nexport type AutocompleteProps<\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined\n> = {\n /**\n * The error message for the Select\n */\n errorMessage?: string;\n /**\n * Enables multiple choice selection\n */\n hasMultipleChoices?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"multiple\"];\n /**\n * The hint text for the Autocomplete input\n */\n hint?: string;\n /**\n * The id attribute of the Select\n */\n id?: string;\n /**\n * Allows the input of custom values\n */\n isCustomValueAllowed?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"freeSolo\"];\n /**\n * Disables the Autocomplete input\n */\n isDisabled?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"disabled\"];\n /**\n * Displays a loading indicator\n */\n isLoading?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"loading\"];\n /**\n * If `true`, the `input` element is not required.\n */\n isOptional?: boolean;\n /**\n * Makes the Autocomplete input read-only\n */\n isReadOnly?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"readOnly\"];\n /**\n * The label text for the autocomplete input\n */\n label: string;\n /**\n * The name of the `input` element. Defaults to the `id` if not set.\n */\n name?: string;\n /**\n * Callback fired when the autocomplete loses focus.\n */\n onBlur?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onBlur\"];\n /**\n * Callback fired when a selection is made.\n */\n onChange?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onChange\"];\n /**\n * Callback fired when the textbox receives typed characters.\n */\n onInputChange?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onInputChange\"];\n /**\n * Callback fired when the autocomplete gains focus.\n */\n onFocus?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onFocus\"];\n /**\n * The options for the Autocomplete input\n */\n options: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"options\"];\n /**\n * The value of the Autocomplete input\n */\n value?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"value\"];\n} & SeleniumProps;\n\nconst Autocomplete = <\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined\n>({\n errorMessage,\n hasMultipleChoices,\n id: idOverride,\n isCustomValueAllowed,\n isDisabled,\n isLoading,\n isOptional = false,\n isReadOnly,\n hint,\n label,\n name: nameOverride,\n onBlur,\n onChange,\n onInputChange,\n onFocus,\n options,\n value,\n testId,\n}: AutocompleteProps<OptionType, HasMultipleChoices, IsCustomValueAllowed>) => {\n const renderInput = useCallback(\n ({ InputLabelProps, InputProps, ...params }) => (\n <Field\n errorMessage={errorMessage}\n fieldType=\"single\"\n hasVisibleLabel\n id={InputLabelProps.htmlFor}\n hint={hint}\n label={label}\n isOptional={isOptional}\n renderFieldComponent={({ ariaDescribedBy, id }) => (\n <InputBase\n {...params}\n {...InputProps}\n aria-describedby={ariaDescribedBy}\n id={id}\n name={nameOverride ?? id}\n required={!isOptional}\n />\n )}\n />\n ),\n [errorMessage, hint, isOptional, label, nameOverride]\n );\n\n return (\n <MuiAutocomplete\n // AutoComplete is wrapped in a div within MUI which does not get the disabled attr. So this aria-disabled gets set in the div\n aria-disabled={isDisabled}\n data-se={testId}\n disableCloseOnSelect={hasMultipleChoices}\n disabled={isDisabled}\n freeSolo={isCustomValueAllowed}\n filterSelectedOptions={true}\n id={idOverride}\n loading={isLoading}\n multiple={hasMultipleChoices}\n onBlur={onBlur}\n onChange={onChange}\n onInputChange={onInputChange}\n onFocus={onFocus}\n options={options}\n readOnly={isReadOnly}\n renderInput={renderInput}\n value={value}\n />\n );\n};\n\n// Need the `typeof Autocomplete` because generics don't get passed through\nconst MemoizedAutocomplete = memo(Autocomplete) as typeof Autocomplete;\n// @ts-expect-error displayName is expected to not be on `typeof Autocomplete`\nMemoizedAutocomplete.displayName = \"Autocomplete\";\n\nexport { MemoizedAutocomplete as Autocomplete };\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA,SAASA,IAAI,EAAEC,WAAW,QAAQ,OAAO;AAAC,SAEjCC,KAAK;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAqId,MAAMC,YAAY,GAAGC,IAAA,IAuB0D;EAAA,IAnB7E;IACAC,YAAY;IACZC,kBAAkB;IAClBC,EAAE,EAAEC,UAAU;IACdC,oBAAoB;IACpBC,UAAU;IACVC,SAAS;IACTC,UAAU,GAAG,KAAK;IAClBC,UAAU;IACVC,IAAI;IACJC,KAAK;IACLC,IAAI,EAAEC,YAAY;IAClBC,MAAM;IACNC,QAAQ;IACRC,aAAa;IACbC,OAAO;IACPC,OAAO;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QAAQ,EAAEhC,UAAW;IACrBY,WAAW,EAAEA,WAAY;IACzBF,KAAK,EAAEA;EAAM,CACd,CAAC;AAEN,CAAC;AAGD,MAAMuB,oBAAoB,GAAGhD,IAAI,CAACK,YAAY,CAAwB;AAEtE2C,oBAAoB,CAACC,WAAW,GAAG,cAAc;AAEjD,SAASD,oBAAoB,IAAI3C,YAAY"}
@@ -0,0 +1,146 @@
1
+ import _Breadcrumbs from "@mui/material/Breadcrumbs";
2
+ import _Menu from "@mui/material/Menu";
3
+ import _ButtonBase from "@mui/material/ButtonBase";
4
+ import _MenuItem from "@mui/material/MenuItem";
5
+ /*!
6
+ * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.
7
+ * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
8
+ *
9
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ *
14
+ * See the License for the specific language governing permissions and limitations under the License.
15
+ */
16
+ import { createContext, memo, useCallback, useContext, useMemo, useState } from "react";
17
+ import { GroupIcon, HomeIcon, UserIcon } from "./icons.generated/index.js";
18
+ import { Typography } from "./Typography.js";
19
+ import { useTranslation } from "react-i18next";
20
+ import { jsx as _jsx } from "react/jsx-runtime";
21
+ import { Fragment as _Fragment } from "react/jsx-runtime";
22
+ import { jsxs as _jsxs } from "react/jsx-runtime";
23
+ export const BreadcrumbContext = createContext({
24
+ breadcrumbType: "listItem"
25
+ });
26
+ export const Breadcrumb = _ref => {
27
+ let {
28
+ children,
29
+ href,
30
+ iconName
31
+ } = _ref;
32
+ const {
33
+ breadcrumbType
34
+ } = useContext(BreadcrumbContext);
35
+ const breadcrumbContent = _jsxs(_Fragment, {
36
+ children: [iconName === "group" ? _jsx(GroupIcon, {}) : iconName === "user" ? _jsx(UserIcon, {}) : null, children]
37
+ });
38
+ if (breadcrumbType === "menuItem") {
39
+ return _jsx(_MenuItem, {
40
+ href: href,
41
+ children: breadcrumbContent
42
+ });
43
+ }
44
+ if (breadcrumbType === "currentPage") {
45
+ return _jsx(Typography, {
46
+ children: breadcrumbContent
47
+ });
48
+ }
49
+ return _jsx(_ButtonBase, {
50
+ href: href,
51
+ children: breadcrumbContent
52
+ });
53
+ };
54
+ const breadcrumbProviderValue = {
55
+ currentPage: {
56
+ breadcrumbType: "currentPage"
57
+ },
58
+ listItem: {
59
+ breadcrumbType: "listItem"
60
+ },
61
+ menuItem: {
62
+ breadcrumbType: "menuItem"
63
+ }
64
+ };
65
+ const BreadcrumbList = _ref2 => {
66
+ let {
67
+ children,
68
+ homeHref,
69
+ maxVisibleItems: maxVisibleItemsOverride
70
+ } = _ref2;
71
+ const maxVisibleItems = maxVisibleItemsOverride ?? children.length;
72
+ const {
73
+ t
74
+ } = useTranslation();
75
+ const [anchorEl, setAnchorEl] = useState(null);
76
+ const breadcrumbSections = useMemo(() => {
77
+ if (children.length <= maxVisibleItems) {
78
+ return {
79
+ beforeMenu: [],
80
+ insideMenu: [],
81
+ remainingBreadcrumbs: children
82
+ };
83
+ } else {
84
+ const menuStart = Math.floor(maxVisibleItems / 2);
85
+ const menuLength = children.length - maxVisibleItems;
86
+ return {
87
+ beforeMenu: children.slice(0, menuStart),
88
+ insideMenu: children.slice(menuStart, menuStart + menuLength),
89
+ remainingBreadcrumbs: children.slice(menuStart + menuLength)
90
+ };
91
+ }
92
+ }, [children, maxVisibleItems]);
93
+ const onMenuButtonClick = useCallback(event => setAnchorEl(event.currentTarget), []);
94
+ const onCloseMenu = useCallback(() => {
95
+ setAnchorEl(null);
96
+ }, []);
97
+ return _jsxs(_Breadcrumbs, {
98
+ maxItems: children.length + 1,
99
+ "aria-label": t("breadcrumbs.label.text"),
100
+ children: [homeHref && _jsx(_ButtonBase, {
101
+ href: homeHref,
102
+ "aria-label": t("breadcrumbs.home.text"),
103
+ children: _jsx(HomeIcon, {})
104
+ }), breadcrumbSections.beforeMenu.map(breadcrumb => _jsx(BreadcrumbContext.Provider, {
105
+ value: breadcrumbProviderValue.listItem,
106
+ children: breadcrumb
107
+ })), breadcrumbSections.insideMenu && _jsxs(_Fragment, {
108
+ children: [_jsx(_ButtonBase, {
109
+ onClick: onMenuButtonClick,
110
+ children: "\u2026"
111
+ }), _jsx(_Menu, {
112
+ open: Boolean(anchorEl),
113
+ onClose: onCloseMenu,
114
+ anchorEl: anchorEl,
115
+ anchorOrigin: {
116
+ horizontal: "left",
117
+ vertical: "bottom"
118
+ },
119
+ MenuListProps: {
120
+ sx: {
121
+ minWidth: 180
122
+ }
123
+ },
124
+ children: _jsx(BreadcrumbContext.Provider, {
125
+ value: breadcrumbProviderValue.menuItem,
126
+ children: breadcrumbSections.insideMenu
127
+ })
128
+ })]
129
+ }), breadcrumbSections.remainingBreadcrumbs.map((breadcrumb, i) => {
130
+ if (i === breadcrumbSections.remainingBreadcrumbs.length - 1) {
131
+ return _jsx(BreadcrumbContext.Provider, {
132
+ value: breadcrumbProviderValue.currentPage,
133
+ children: breadcrumb
134
+ });
135
+ }
136
+ return _jsx(BreadcrumbContext.Provider, {
137
+ value: breadcrumbProviderValue.listItem,
138
+ children: breadcrumb
139
+ });
140
+ })]
141
+ });
142
+ };
143
+ const MemoizedBreadcrumbList = memo(BreadcrumbList);
144
+ MemoizedBreadcrumbList.displayName = "BreadcrumbList";
145
+ export { MemoizedBreadcrumbList as BreadcrumbList };
146
+ //# sourceMappingURL=Breadcrumbs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Breadcrumbs.js","names":["createContext","memo","useCallback","useContext","useMemo","useState","GroupIcon","HomeIcon","UserIcon","Typography","useTranslation","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","BreadcrumbContext","breadcrumbType","Breadcrumb","_ref","children","href","iconName","breadcrumbContent","_MenuItem","_ButtonBase","breadcrumbProviderValue","currentPage","listItem","menuItem","BreadcrumbList","_ref2","homeHref","maxVisibleItems","maxVisibleItemsOverride","length","t","anchorEl","setAnchorEl","breadcrumbSections","beforeMenu","insideMenu","remainingBreadcrumbs","menuStart","Math","floor","menuLength","slice","onMenuButtonClick","event","currentTarget","onCloseMenu","_Breadcrumbs","maxItems","map","breadcrumb","Provider","value","onClick","_Menu","open","Boolean","onClose","anchorOrigin","horizontal","vertical","MenuListProps","sx","minWidth","i","MemoizedBreadcrumbList","displayName"],"sources":["../src/Breadcrumbs.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport {\n ButtonBase,\n Menu,\n MenuItem,\n Breadcrumbs as MuiBreadcrumbs,\n} from \"@mui/material\";\nimport {\n MouseEventHandler,\n ReactElement,\n createContext,\n memo,\n useCallback,\n useContext,\n useMemo,\n useState,\n} from \"react\";\nimport { GroupIcon, HomeIcon, UserIcon } from \"./icons.generated\";\nimport { Typography } from \"./Typography\";\nimport { useTranslation } from \"react-i18next\";\n\nexport type BreadcrumbType = \"listItem\" | \"menuItem\" | \"currentPage\";\n\nexport type BreadcrumbProps = {\n children?: string;\n href: string;\n iconName?: \"user\" | \"group\";\n};\n\nexport type BreadcrumbsProps = {\n children: ReactElement<typeof Breadcrumb>[];\n homeHref?: string;\n maxVisibleItems?: number;\n};\n\nexport type BreadcrumbContextType = {\n breadcrumbType: BreadcrumbType;\n};\n\nexport const BreadcrumbContext = createContext<BreadcrumbContextType>({\n breadcrumbType: \"listItem\",\n});\n\nexport const Breadcrumb = ({ children, href, iconName }: BreadcrumbProps) => {\n const { breadcrumbType } = useContext(BreadcrumbContext);\n\n const breadcrumbContent = (\n <>\n {iconName === \"group\" ? (\n <GroupIcon />\n ) : iconName === \"user\" ? (\n <UserIcon />\n ) : null}\n {children}\n </>\n );\n\n if (breadcrumbType === \"menuItem\") {\n return <MenuItem href={href}>{breadcrumbContent}</MenuItem>;\n }\n\n if (breadcrumbType === \"currentPage\") {\n return <Typography>{breadcrumbContent}</Typography>;\n }\n\n // breadcrumbType === \"listItem\" is the default\n // Provided here without a conditional to get TS to be quiet\n // about potential undefined returns\n return <ButtonBase href={href}>{breadcrumbContent}</ButtonBase>;\n};\n\nconst breadcrumbProviderValue: Record<\n BreadcrumbType,\n { breadcrumbType: BreadcrumbType }\n> = {\n currentPage: {\n breadcrumbType: \"currentPage\",\n },\n listItem: {\n breadcrumbType: \"listItem\",\n },\n menuItem: {\n breadcrumbType: \"menuItem\",\n },\n};\n\nconst BreadcrumbList = ({\n children,\n homeHref,\n maxVisibleItems: maxVisibleItemsOverride,\n}: BreadcrumbsProps) => {\n const maxVisibleItems = maxVisibleItemsOverride ?? children.length;\n\n const { t } = useTranslation();\n\n const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);\n\n const breadcrumbSections = useMemo(() => {\n if (children.length <= maxVisibleItems) {\n return {\n beforeMenu: [],\n insideMenu: [],\n remainingBreadcrumbs: children,\n };\n } else {\n const menuStart = Math.floor(maxVisibleItems / 2);\n const menuLength = children.length - maxVisibleItems;\n\n return {\n beforeMenu: children.slice(0, menuStart),\n insideMenu: children.slice(menuStart, menuStart + menuLength),\n remainingBreadcrumbs: children.slice(menuStart + menuLength),\n };\n }\n }, [children, maxVisibleItems]);\n\n const onMenuButtonClick = useCallback<MouseEventHandler<HTMLButtonElement>>(\n (event) => setAnchorEl(event.currentTarget),\n []\n );\n const onCloseMenu = useCallback(() => {\n setAnchorEl(null);\n }, []);\n\n return (\n <MuiBreadcrumbs\n maxItems={children.length + 1}\n aria-label={t(\"breadcrumbs.label.text\")}\n >\n {homeHref && (\n <ButtonBase href={homeHref} aria-label={t(\"breadcrumbs.home.text\")}>\n <HomeIcon />\n </ButtonBase>\n )}\n\n {breadcrumbSections.beforeMenu.map((breadcrumb) => (\n <BreadcrumbContext.Provider value={breadcrumbProviderValue.listItem}>\n {breadcrumb}\n </BreadcrumbContext.Provider>\n ))}\n\n {breadcrumbSections.insideMenu && (\n <>\n <ButtonBase onClick={onMenuButtonClick}>…</ButtonBase>\n <Menu\n open={Boolean(anchorEl)}\n onClose={onCloseMenu}\n anchorEl={anchorEl}\n anchorOrigin={{ horizontal: \"left\", vertical: \"bottom\" }}\n MenuListProps={{\n sx: {\n minWidth: 180,\n },\n }}\n >\n <BreadcrumbContext.Provider\n value={breadcrumbProviderValue.menuItem}\n >\n {breadcrumbSections.insideMenu}\n </BreadcrumbContext.Provider>\n </Menu>\n </>\n )}\n\n {breadcrumbSections.remainingBreadcrumbs.map((breadcrumb, i) => {\n if (i === breadcrumbSections.remainingBreadcrumbs.length - 1) {\n return (\n <BreadcrumbContext.Provider\n value={breadcrumbProviderValue.currentPage}\n >\n {breadcrumb}\n </BreadcrumbContext.Provider>\n );\n }\n return (\n <BreadcrumbContext.Provider value={breadcrumbProviderValue.listItem}>\n {breadcrumb}\n </BreadcrumbContext.Provider>\n );\n })}\n </MuiBreadcrumbs>\n );\n};\n\nconst MemoizedBreadcrumbList = memo(BreadcrumbList);\nMemoizedBreadcrumbList.displayName = \"BreadcrumbList\";\n\nexport { MemoizedBreadcrumbList as BreadcrumbList };\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAQA,SAGEA,aAAa,EACbC,IAAI,EACJC,WAAW,EACXC,UAAU,EACVC,OAAO,EACPC,QAAQ,QACH,OAAO;AAAC,SACNC,SAAS,EAAEC,QAAQ,EAAEC,QAAQ;AAAA,SAC7BC,UAAU;AACnB,SAASC,cAAc,QAAQ,eAAe;AAAC,SAAAC,GAAA,IAAAC,IAAA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AACC,WAAY;UAAAP,QAAA,EAE1CmC;QAAU,CACe,CAAC;MAEjC;MACA,OACE5C,IAAA,CAACK,iBAAiB,CAACwC,QAAQ;QAACC,KAAK,EAAE/B,uBAAuB,CAACE,QAAS;QAAAR,QAAA,EACjEmC;MAAU,CACe,CAAC;IAEjC,CAAC,CAAC;EAAA,CACY,CAAC;AAErB,CAAC;AAED,MAAMe,sBAAsB,GAAGtE,IAAI,CAAC8B,cAAc,CAAC;AACnDwC,sBAAsB,CAACC,WAAW,GAAG,gBAAgB;AAErD,SAASD,sBAAsB,IAAIxC,cAAc"}
package/dist/Link.js CHANGED
@@ -24,7 +24,8 @@ const Link = _ref => {
24
24
  rel,
25
25
  target,
26
26
  testId,
27
- variant
27
+ variant,
28
+ onClick
28
29
  } = _ref;
29
30
  return _jsxs(_Link, {
30
31
  "data-se": testId,
@@ -32,6 +33,7 @@ const Link = _ref => {
32
33
  rel: rel,
33
34
  target: target,
34
35
  variant: variant,
36
+ onClick: onClick,
35
37
  children: [icon && _jsx("span", {
36
38
  className: "Link-icon",
37
39
  children: icon
package/dist/Link.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Link.js","names":["memo","ExternalLinkIcon","jsx","_jsx","jsxs","_jsxs","linkVariantValues","Link","_ref","children","href","icon","rel","target","testId","variant","_Link","className","role","MemoizedLink","displayName"],"sources":["../src/Link.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { memo, ReactElement } from \"react\";\nimport { ExternalLinkIcon } from \"./icons.generated\";\nimport type { SeleniumProps } from \"./SeleniumProps\";\n\nimport { Link as MuiLink } from \"@mui/material\";\n\nexport const linkVariantValues = [\"default\", \"monochrome\"] as const;\n\nexport type LinkProps = {\n /**\n * The content within the Link\n */\n children: React.ReactNode;\n /**\n * The Link destination\n */\n href: string;\n /**\n * An optional Icon component at the start of the Link\n */\n icon?: ReactElement;\n /**\n * The HTML `rel` attribute for the Link\n */\n rel?: string;\n /**\n * The HTML `target` attribute for the Link\n */\n target?:\n | \"_self\"\n | \"_blank\"\n | \"_parent\"\n | \"_top\"\n | (string & NonNullable<unknown>);\n /**\n * The visual presentation of the Link (default or monochrome)\n */\n variant?: (typeof linkVariantValues)[number];\n} & SeleniumProps;\n\nconst Link = ({\n children,\n href,\n icon,\n rel,\n target,\n testId,\n variant,\n}: LinkProps) => (\n <MuiLink\n data-se={testId}\n href={href}\n rel={rel}\n target={target}\n variant={variant}\n >\n {icon && <span className=\"Link-icon\">{icon}</span>}\n\n {children}\n\n {target === \"_blank\" && (\n <span className=\"Link-indicator\" role=\"presentation\">\n <ExternalLinkIcon />\n </span>\n )}\n </MuiLink>\n);\n\nconst MemoizedLink = memo(Link);\n\nMemoizedLink.displayName = \"Link\";\n\nexport { MemoizedLink as Link };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,QAAsB,OAAO;AAAC,SAClCC,gBAAgB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAKzB,OAAO,MAAMC,iBAAiB,GAAG,CAAC,SAAS,EAAE,YAAY,CAAU;AAkCnE,MAAMC,IAAI,GAAGC,IAAA;EAAA,IAAC;IACZC,QAAQ;IACRC,IAAI;IACJC,IAAI;IACJC,GAAG;IACHC,MAAM;IACNC,MAAM;IACNC;EACS,CAAC,GAAAP,IAAA;EAAA,OACVH,KAAA,CAAAW,KAAA;IACE,WAASF,MAAO;IAChBJ,IAAI,EAAEA,IAAK;IACXE,GAAG,EAAEA,GAAI;IACTC,MAAM,EAAEA,MAAO;IACfE,OAAO,EAAEA,OAAQ;IAAAN,QAAA,GAEhBE,IAAI,IAAIR,IAAA;MAAMc,SAAS,EAAC,WAAW;MAAAR,QAAA,EAAEE;IAAI,CAAO,CAAC,EAEjDF,QAAQ,EAERI,MAAM,KAAK,QAAQ,IAClBV,IAAA;MAAMc,SAAS,EAAC,gBAAgB;MAACC,IAAI,EAAC,cAAc;MAAAT,QAAA,EAClDN,IAAA,CAACF,gBAAgB,IAAE;IAAC,CAChB,CACP;EAAA,CACM,CAAC;AAAA,CACX;AAED,MAAMkB,YAAY,GAAGnB,IAAI,CAACO,IAAI,CAAC;AAE/BY,YAAY,CAACC,WAAW,GAAG,MAAM;AAEjC,SAASD,YAAY,IAAIZ,IAAI"}
1
+ {"version":3,"file":"Link.js","names":["memo","ExternalLinkIcon","jsx","_jsx","jsxs","_jsxs","linkVariantValues","Link","_ref","children","href","icon","rel","target","testId","variant","onClick","_Link","className","role","MemoizedLink","displayName"],"sources":["../src/Link.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { memo, ReactElement } from \"react\";\nimport { ExternalLinkIcon } from \"./icons.generated\";\nimport type { SeleniumProps } from \"./SeleniumProps\";\n\nimport { Link as MuiLink, LinkProps as MuiLinkProps } from \"@mui/material\";\n\nexport const linkVariantValues = [\"default\", \"monochrome\"] as const;\n\nexport type LinkProps = {\n /**\n * The content within the Link\n */\n children: React.ReactNode;\n /**\n * The Link destination\n */\n href: string;\n /**\n * An optional Icon component at the start of the Link\n */\n icon?: ReactElement;\n /**\n * The click event handler for the Link\n */\n onClick?: MuiLinkProps[\"onClick\"];\n /**\n * The HTML `rel` attribute for the Link\n */\n rel?: string;\n /**\n * The HTML `target` attribute for the Link\n */\n target?:\n | \"_self\"\n | \"_blank\"\n | \"_parent\"\n | \"_top\"\n | (string & NonNullable<unknown>);\n /**\n * The visual presentation of the Link (default or monochrome)\n */\n variant?: (typeof linkVariantValues)[number];\n} & SeleniumProps;\n\nconst Link = ({\n children,\n href,\n icon,\n rel,\n target,\n testId,\n variant,\n onClick,\n}: LinkProps) => (\n <MuiLink\n data-se={testId}\n href={href}\n rel={rel}\n target={target}\n variant={variant}\n onClick={onClick}\n >\n {icon && <span className=\"Link-icon\">{icon}</span>}\n\n {children}\n\n {target === \"_blank\" && (\n <span className=\"Link-indicator\" role=\"presentation\">\n <ExternalLinkIcon />\n </span>\n )}\n </MuiLink>\n);\n\nconst MemoizedLink = memo(Link);\n\nMemoizedLink.displayName = \"Link\";\n\nexport { MemoizedLink as Link };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,QAAsB,OAAO;AAAC,SAClCC,gBAAgB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAKzB,OAAO,MAAMC,iBAAiB,GAAG,CAAC,SAAS,EAAE,YAAY,CAAU;AAsCnE,MAAMC,IAAI,GAAGC,IAAA;EAAA,IAAC;IACZC,QAAQ;IACRC,IAAI;IACJC,IAAI;IACJC,GAAG;IACHC,MAAM;IACNC,MAAM;IACNC,OAAO;IACPC;EACS,CAAC,GAAAR,IAAA;EAAA,OACVH,KAAA,CAAAY,KAAA;IACE,WAASH,MAAO;IAChBJ,IAAI,EAAEA,IAAK;IACXE,GAAG,EAAEA,GAAI;IACTC,MAAM,EAAEA,MAAO;IACfE,OAAO,EAAEA,OAAQ;IACjBC,OAAO,EAAEA,OAAQ;IAAAP,QAAA,GAEhBE,IAAI,IAAIR,IAAA;MAAMe,SAAS,EAAC,WAAW;MAAAT,QAAA,EAAEE;IAAI,CAAO,CAAC,EAEjDF,QAAQ,EAERI,MAAM,KAAK,QAAQ,IAClBV,IAAA;MAAMe,SAAS,EAAC,gBAAgB;MAACC,IAAI,EAAC,cAAc;MAAAV,QAAA,EAClDN,IAAA,CAACF,gBAAgB,IAAE;IAAC,CAChB,CACP;EAAA,CACM,CAAC;AAAA,CACX;AAED,MAAMmB,YAAY,GAAGpB,IAAI,CAACO,IAAI,CAAC;AAE/Ba,YAAY,CAACC,WAAW,GAAG,MAAM;AAEjC,SAASD,YAAY,IAAIb,IAAI"}
@@ -1 +1 @@
1
- {"version":3,"file":"MenuButton.js","names":["Button","useUniqueId","ChevronDownIcon","MoreIcon","memo","useCallback","useMemo","useState","MenuContext","jsx","_jsx","jsxs","_jsxs","MenuButton","_ref","ariaLabel","ariaLabelledBy","ariaDescribedBy","buttonLabel","buttonVariant","children","endIcon","endIconProp","id","idOverride","isOverflow","size","testId","tooltipText","anchorEl","setAnchorEl","isOpen","Boolean","closeMenu","openMenu","event","currentTarget","uniqueId","menuListProps","providerValue","undefined","label","onClick","variant","_Menu","MenuListProps","onClose","open","Provider","value","MemoizedMenuButton","displayName"],"sources":["../src/MenuButton.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 Button,\n buttonSizeValues,\n buttonVariantValues,\n MenuItem,\n useUniqueId,\n} from \"./\";\nimport { Divider, ListSubheader, Menu } from \"@mui/material\";\nimport { ChevronDownIcon, MoreIcon } from \"./icons.generated\";\nimport { memo, type ReactElement, useCallback, useMemo, useState } from \"react\";\n\nimport { MenuContext, MenuContextType } from \"./MenuContext\";\nimport { NullElement } from \"./NullElement\";\nimport type { SeleniumProps } from \"./SeleniumProps\";\n\nexport type MenuButtonProps = {\n /**\n * The ARIA label for the Button\n */\n ariaLabel?: string;\n /**\n * The ID of the element that labels the Button\n */\n ariaLabelledBy?: string;\n /**\n * The ID of the element that describes the Button\n */\n ariaDescribedBy?: string;\n /**\n * The label on the triggering Button\n */\n buttonLabel?: string;\n /**\n * The variant of the triggering Button\n */\n buttonVariant?: (typeof buttonVariantValues)[number];\n /**\n * The <MenuItem> components within the Menu.\n */\n children: Array<\n ReactElement<\n typeof MenuItem | typeof Divider | typeof ListSubheader | NullElement\n >\n >;\n /**\n * The end Icon on the trigggering Button\n */\n endIcon?: ReactElement;\n /**\n * The id of the Button\n */\n id?: string;\n /**\n * If the MenuButton is an overflow menu or standard menu.\n */\n isOverflow?: boolean;\n /**\n * The size of the button\n */\n size?: (typeof buttonSizeValues)[number];\n /**\n * The tooltip text for the Button if it's icon-only\n */\n tooltipText?: string;\n} & (\n | {\n ariaLabel?: string;\n ariaLabelledBy?: string;\n buttonLabel: string;\n }\n | {\n ariaLabel: string;\n ariaLabelledBy?: string;\n buttonLabel?: undefined | \"\";\n }\n | {\n ariaLabel?: string;\n ariaLabelledBy: string;\n buttonLabel?: undefined | \"\";\n }\n) &\n SeleniumProps;\n\nconst MenuButton = ({\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy,\n buttonLabel = \"\",\n buttonVariant = \"secondary\",\n children,\n endIcon: endIconProp,\n id: idOverride,\n isOverflow,\n size,\n testId,\n tooltipText,\n}: MenuButtonProps) => {\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);\n\n const isOpen = Boolean(anchorEl);\n\n const closeMenu = useCallback<MenuContextType[\"closeMenu\"]>(() => {\n setAnchorEl(null);\n }, []);\n\n const openMenu = useCallback<MenuContextType[\"openMenu\"]>((event) => {\n setAnchorEl(event.currentTarget);\n }, []);\n\n const uniqueId = useUniqueId(idOverride);\n\n const menuListProps = useMemo(\n () => ({ \"aria-labelledby\": `${uniqueId}-button` }),\n [uniqueId]\n );\n\n const providerValue = useMemo<MenuContextType>(\n () => ({\n closeMenu,\n openMenu,\n }),\n [closeMenu, openMenu]\n );\n\n const endIcon = endIconProp ? (\n endIconProp\n ) : isOverflow ? (\n <MoreIcon />\n ) : (\n <ChevronDownIcon />\n );\n\n return (\n <div>\n <Button\n aria-controls={isOpen ? `${uniqueId}-menu` : undefined}\n aria-expanded={isOpen ? \"true\" : undefined}\n aria-haspopup=\"true\"\n ariaDescribedBy={ariaDescribedBy}\n ariaLabel={ariaLabel}\n ariaLabelledBy={ariaLabelledBy}\n data-se={testId}\n endIcon={endIcon}\n id={`${uniqueId}-button`}\n label={buttonLabel}\n onClick={openMenu}\n size={size}\n tooltipText={tooltipText}\n variant={buttonVariant}\n />\n\n <Menu\n anchorEl={anchorEl}\n id={`${uniqueId}-menu`}\n MenuListProps={menuListProps}\n onClose={closeMenu}\n open={isOpen}\n >\n <MenuContext.Provider value={providerValue}>\n {children}\n </MenuContext.Provider>\n </Menu>\n </div>\n );\n};\n\nconst MemoizedMenuButton = memo(MenuButton);\nMemoizedMenuButton.displayName = \"MenuButton\";\n\nexport { MemoizedMenuButton as MenuButton };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVA,SAaEA,MAAM,EAINC,WAAW;AAAA,SAGJC,eAAe,EAAEC,QAAQ;AAClC,SAASC,IAAI,EAAqBC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAAC,SAEvEC,WAAW;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAwEpB,MAAMC,UAAU,GAAGC,IAAA,IAaI;EAAA,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,EAAEA,eAAgB;MACjCF,SAAS,EAAEA,SAAU;MACrBC,cAAc,EAAEA,cAAe;MAC/B,WAASW,MAAO;MAChBN,OAAO,EAAEA,OAAQ;MACjBE,EAAE,EAAG,GAAEc,QAAS,SAAS;MACzBI,KAAK,EAAEvB,WAAY;MACnBwB,OAAO,EAAER,QAAS;MAClBR,IAAI,EAAEA,IAAK;MACXE,WAAW,EAAEA,WAAY;MACzBe,OAAO,EAAExB;IAAc,CACxB,CAAC,EAEFT,IAAA,CAAAkC,KAAA;MACEf,QAAQ,EAAEA,QAAS;MACnBN,EAAE,EAAG,GAAEc,QAAS,OAAO;MACvBQ,aAAa,EAAEP,aAAc;MAC7BQ,OAAO,EAAEb,SAAU;MACnBc,IAAI,EAAEhB,MAAO;MAAAX,QAAA,EAEbV,IAAA,CAACF,WAAW,CAACwC,QAAQ;QAACC,KAAK,EAAEV,aAAc;QAAAnB,QAAA,EACxCA;MAAQ,CACW;IAAC,CACnB,CAAC;EAAA,CACJ,CAAC;AAEV,CAAC;AAED,MAAM8B,kBAAkB,GAAG9C,IAAI,CAACS,UAAU,CAAC;AAC3CqC,kBAAkB,CAACC,WAAW,GAAG,YAAY;AAE7C,SAASD,kBAAkB,IAAIrC,UAAU"}
1
+ {"version":3,"file":"MenuButton.js","names":["Button","useUniqueId","ChevronDownIcon","MoreIcon","memo","useCallback","useMemo","useState","MenuContext","jsx","_jsx","jsxs","_jsxs","MenuButton","_ref","ariaLabel","ariaLabelledBy","ariaDescribedBy","buttonLabel","buttonVariant","children","endIcon","endIconProp","id","idOverride","isOverflow","size","testId","tooltipText","anchorEl","setAnchorEl","isOpen","Boolean","closeMenu","openMenu","event","currentTarget","uniqueId","menuListProps","providerValue","undefined","label","onClick","variant","_Menu","MenuListProps","onClose","open","Provider","value","MemoizedMenuButton","displayName"],"sources":["../src/MenuButton.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 Button,\n buttonSizeValues,\n buttonVariantValues,\n MenuItem,\n useUniqueId,\n} from \"./\";\nimport { Divider, ListSubheader, Menu } from \"@mui/material\";\nimport { ChevronDownIcon, MoreIcon } from \"./icons.generated\";\nimport { memo, type ReactElement, useCallback, useMemo, useState } from \"react\";\n\nimport { MenuContext, MenuContextType } from \"./MenuContext\";\nimport { NullElement } from \"./NullElement\";\nimport type { SeleniumProps } from \"./SeleniumProps\";\n\nexport type MenuButtonProps = {\n /**\n * The ARIA label for the Button\n */\n ariaLabel?: string;\n /**\n * The ID of the element that labels the Button\n */\n ariaLabelledBy?: string;\n /**\n * The ID of the element that describes the Button\n */\n ariaDescribedBy?: string;\n /**\n * The label on the triggering Button\n */\n buttonLabel?: string;\n /**\n * The variant of the triggering Button\n */\n buttonVariant?: (typeof buttonVariantValues)[number];\n /**\n * The <MenuItem> components within the Menu.\n */\n children: Array<\n | ReactElement<typeof MenuItem | typeof Divider | typeof ListSubheader>\n | NullElement\n >;\n /**\n * The end Icon on the trigggering Button\n */\n endIcon?: ReactElement;\n /**\n * The id of the Button\n */\n id?: string;\n /**\n * If the MenuButton is an overflow menu or standard menu.\n */\n isOverflow?: boolean;\n /**\n * The size of the button\n */\n size?: (typeof buttonSizeValues)[number];\n /**\n * The tooltip text for the Button if it's icon-only\n */\n tooltipText?: string;\n} & (\n | {\n ariaLabel?: string;\n ariaLabelledBy?: string;\n buttonLabel: string;\n }\n | {\n ariaLabel: string;\n ariaLabelledBy?: string;\n buttonLabel?: undefined | \"\";\n }\n | {\n ariaLabel?: string;\n ariaLabelledBy: string;\n buttonLabel?: undefined | \"\";\n }\n) &\n SeleniumProps;\n\nconst MenuButton = ({\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy,\n buttonLabel = \"\",\n buttonVariant = \"secondary\",\n children,\n endIcon: endIconProp,\n id: idOverride,\n isOverflow,\n size,\n testId,\n tooltipText,\n}: MenuButtonProps) => {\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);\n\n const isOpen = Boolean(anchorEl);\n\n const closeMenu = useCallback<MenuContextType[\"closeMenu\"]>(() => {\n setAnchorEl(null);\n }, []);\n\n const openMenu = useCallback<MenuContextType[\"openMenu\"]>((event) => {\n setAnchorEl(event.currentTarget);\n }, []);\n\n const uniqueId = useUniqueId(idOverride);\n\n const menuListProps = useMemo(\n () => ({ \"aria-labelledby\": `${uniqueId}-button` }),\n [uniqueId]\n );\n\n const providerValue = useMemo<MenuContextType>(\n () => ({\n closeMenu,\n openMenu,\n }),\n [closeMenu, openMenu]\n );\n\n const endIcon = endIconProp ? (\n endIconProp\n ) : isOverflow ? (\n <MoreIcon />\n ) : (\n <ChevronDownIcon />\n );\n\n return (\n <div>\n <Button\n aria-controls={isOpen ? `${uniqueId}-menu` : undefined}\n aria-expanded={isOpen ? \"true\" : undefined}\n aria-haspopup=\"true\"\n ariaDescribedBy={ariaDescribedBy}\n ariaLabel={ariaLabel}\n ariaLabelledBy={ariaLabelledBy}\n data-se={testId}\n endIcon={endIcon}\n id={`${uniqueId}-button`}\n label={buttonLabel}\n onClick={openMenu}\n size={size}\n tooltipText={tooltipText}\n variant={buttonVariant}\n />\n\n <Menu\n anchorEl={anchorEl}\n id={`${uniqueId}-menu`}\n MenuListProps={menuListProps}\n onClose={closeMenu}\n open={isOpen}\n >\n <MenuContext.Provider value={providerValue}>\n {children}\n </MenuContext.Provider>\n </Menu>\n </div>\n );\n};\n\nconst MemoizedMenuButton = memo(MenuButton);\nMemoizedMenuButton.displayName = \"MenuButton\";\n\nexport { MemoizedMenuButton as MenuButton };\n"],"mappings":";AAAA;AACA;AACA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AO,GAAGC,WAAW,GACzBA,WAAW,GACTG,UAAU,GACZf,IAAA,CAACP,QAAQ,IAAE,CAAC,GAEZO,IAAA,CAACR,eAAe,IAAE,CACnB;EAED,OACEU,KAAA;IAAAQ,QAAA,GACEV,IAAA,CAACV,MAAM;MACL,iBAAe+B,MAAM,GAAI,GAAEM,QAAS,OAAM,GAAGG,SAAU;MACvD,iBAAeT,MAAM,GAAG,MAAM,GAAGS,SAAU;MAC3C,iBAAc,MAAM;MACpBvB,eAAe,EAAEA,eAAgB;MACjCF,SAAS,EAAEA,SAAU;MACrBC,cAAc,EAAEA,cAAe;MAC/B,WAASW,MAAO;MAChBN,OAAO,EAAEA,OAAQ;MACjBE,EAAE,EAAG,GAAEc,QAAS,SAAS;MACzBI,KAAK,EAAEvB,WAAY;MACnBwB,OAAO,EAAER,QAAS;MAClBR,IAAI,EAAEA,IAAK;MACXE,WAAW,EAAEA,WAAY;MACzBe,OAAO,EAAExB;IAAc,CACxB,CAAC,EAEFT,IAAA,CAAAkC,KAAA;MACEf,QAAQ,EAAEA,QAAS;MACnBN,EAAE,EAAG,GAAEc,QAAS,OAAO;MACvBQ,aAAa,EAAEP,aAAc;MAC7BQ,OAAO,EAAEb,SAAU;MACnBc,IAAI,EAAEhB,MAAO;MAAAX,QAAA,EAEbV,IAAA,CAACF,WAAW,CAACwC,QAAQ;QAACC,KAAK,EAAEV,aAAc;QAAAnB,QAAA,EACxCA;MAAQ,CACW;IAAC,CACnB,CAAC;EAAA,CACJ,CAAC;AAEV,CAAC;AAED,MAAM8B,kBAAkB,GAAG9C,IAAI,CAACS,UAAU,CAAC;AAC3CqC,kBAAkB,CAACC,WAAW,GAAG,YAAY;AAE7C,SAASD,kBAAkB,IAAIrC,UAAU"}
@@ -18,15 +18,18 @@ import { jsx as _jsx } from "react/jsx-runtime";
18
18
  const OdysseyCacheProvider = _ref => {
19
19
  let {
20
20
  children,
21
+ emotionRootElement,
21
22
  nonce,
22
23
  stylisPlugins
23
24
  } = _ref;
24
25
  const uniqueAlphabeticalId = useUniqueAlphabeticalId();
25
26
  const emotionCache = useMemo(() => createCache({
27
+ container: emotionRootElement,
26
28
  key: uniqueAlphabeticalId,
27
29
  nonce: nonce || window.cspNonce,
30
+ prepend: Boolean(emotionRootElement),
28
31
  stylisPlugins
29
- }), [nonce, stylisPlugins, uniqueAlphabeticalId]);
32
+ }), [emotionRootElement, nonce, stylisPlugins, uniqueAlphabeticalId]);
30
33
  return _jsx(CacheProvider, {
31
34
  value: emotionCache,
32
35
  children: children
@@ -1 +1 @@
1
- {"version":3,"file":"OdysseyCacheProvider.js","names":["createCache","CacheProvider","memo","useMemo","useUniqueAlphabeticalId","jsx","_jsx","OdysseyCacheProvider","_ref","children","nonce","stylisPlugins","uniqueAlphabeticalId","emotionCache","key","window","cspNonce","value","MemoizedOdysseyCacheProvider","displayName"],"sources":["../src/OdysseyCacheProvider.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\ndeclare global {\n interface Window {\n cspNonce: string;\n }\n}\n\nimport createCache, { StylisPlugin } from \"@emotion/cache\";\nimport { CacheProvider } from \"@emotion/react\";\nimport { memo, ReactNode, useMemo } from \"react\";\n\nimport { useUniqueAlphabeticalId } from \"./useUniqueAlphabeticalId\";\n\nexport type OdysseyCacheProviderProps = {\n children: ReactNode;\n nonce?: string;\n stylisPlugins?: StylisPlugin[];\n};\n\nconst OdysseyCacheProvider = ({\n children,\n nonce,\n stylisPlugins,\n}: OdysseyCacheProviderProps) => {\n const uniqueAlphabeticalId = useUniqueAlphabeticalId();\n\n const emotionCache = useMemo(\n () =>\n createCache({\n key: uniqueAlphabeticalId,\n nonce: nonce || window.cspNonce,\n stylisPlugins,\n }),\n [nonce, stylisPlugins, uniqueAlphabeticalId]\n );\n\n return <CacheProvider value={emotionCache}>{children}</CacheProvider>;\n};\n\nconst MemoizedOdysseyCacheProvider = memo(OdysseyCacheProvider);\nMemoizedOdysseyCacheProvider.displayName = \"OdysseyCacheProvider\";\n\nexport { MemoizedOdysseyCacheProvider as OdysseyCacheProvider };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,OAAOA,WAAW,MAAwB,gBAAgB;AAC1D,SAASC,aAAa,QAAQ,gBAAgB;AAC9C,SAASC,IAAI,EAAaC,OAAO,QAAQ,OAAO;AAAC,SAExCC,uBAAuB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAQhC,MAAMC,oBAAoB,GAAGC,IAAA,IAII;EAAA,IAJH;IAC5BC,QAAQ;IACRC,KAAK;IACLC;EACyB,CAAC,GAAAH,IAAA;EAC1B,MAAMI,oBAAoB,GAAGR,uBAAuB,CAAC,CAAC;EAEtD,MAAMS,YAAY,GAAGV,OAAO,CAC1B,MACEH,WAAW,CAAC;IACVc,GAAG,EAAEF,oBAAoB;IACzBF,KAAK,EAAEA,KAAK,IAAIK,MAAM,CAACC,QAAQ;IAC/BL;EACF,CAAC,CAAC,EACJ,CAACD,KAAK,EAAEC,aAAa,EAAEC,oBAAoB,CAC7C,CAAC;EAED,OAAON,IAAA,CAACL,aAAa;IAACgB,KAAK,EAAEJ,YAAa;IAAAJ,QAAA,EAAEA;EAAQ,CAAgB,CAAC;AACvE,CAAC;AAED,MAAMS,4BAA4B,GAAGhB,IAAI,CAACK,oBAAoB,CAAC;AAC/DW,4BAA4B,CAACC,WAAW,GAAG,sBAAsB;AAEjE,SAASD,4BAA4B,IAAIX,oBAAoB"}
1
+ {"version":3,"file":"OdysseyCacheProvider.js","names":["createCache","CacheProvider","memo","useMemo","useUniqueAlphabeticalId","jsx","_jsx","OdysseyCacheProvider","_ref","children","emotionRootElement","nonce","stylisPlugins","uniqueAlphabeticalId","emotionCache","container","key","window","cspNonce","prepend","Boolean","value","MemoizedOdysseyCacheProvider","displayName"],"sources":["../src/OdysseyCacheProvider.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\ndeclare global {\n interface Window {\n cspNonce: string;\n }\n}\n\nimport createCache, { StylisPlugin } from \"@emotion/cache\";\nimport { CacheProvider } from \"@emotion/react\";\nimport { memo, ReactNode, useMemo } from \"react\";\n\nimport { useUniqueAlphabeticalId } from \"./useUniqueAlphabeticalId\";\n\nexport type OdysseyCacheProviderProps = {\n children: ReactNode;\n /**\n * Emotion renders into this HTML element.\n * When enabling this prop, Emotion renders at the top of this component rather than the bottom like it does in the HTML `<head>`.\n */\n emotionRootElement?: HTMLStyleElement;\n nonce?: string;\n stylisPlugins?: StylisPlugin[];\n};\n\nconst OdysseyCacheProvider = ({\n children,\n emotionRootElement,\n nonce,\n stylisPlugins,\n}: OdysseyCacheProviderProps) => {\n const uniqueAlphabeticalId = useUniqueAlphabeticalId();\n\n const emotionCache = useMemo(\n () =>\n createCache({\n container: emotionRootElement,\n key: uniqueAlphabeticalId,\n nonce: nonce || window.cspNonce,\n prepend: Boolean(emotionRootElement),\n stylisPlugins,\n }),\n [emotionRootElement, nonce, stylisPlugins, uniqueAlphabeticalId]\n );\n\n return <CacheProvider value={emotionCache}>{children}</CacheProvider>;\n};\n\nconst MemoizedOdysseyCacheProvider = memo(OdysseyCacheProvider);\nMemoizedOdysseyCacheProvider.displayName = \"OdysseyCacheProvider\";\n\nexport { MemoizedOdysseyCacheProvider as OdysseyCacheProvider };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,OAAOA,WAAW,MAAwB,gBAAgB;AAC1D,SAASC,aAAa,QAAQ,gBAAgB;AAC9C,SAASC,IAAI,EAAaC,OAAO,QAAQ,OAAO;AAAC,SAExCC,uBAAuB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAahC,MAAMC,oBAAoB,GAAGC,IAAA,IAKI;EAAA,IALH;IAC5BC,QAAQ;IACRC,kBAAkB;IAClBC,KAAK;IACLC;EACyB,CAAC,GAAAJ,IAAA;EAC1B,MAAMK,oBAAoB,GAAGT,uBAAuB,CAAC,CAAC;EAEtD,MAAMU,YAAY,GAAGX,OAAO,CAC1B,MACEH,WAAW,CAAC;IACVe,SAAS,EAAEL,kBAAkB;IAC7BM,GAAG,EAAEH,oBAAoB;IACzBF,KAAK,EAAEA,KAAK,IAAIM,MAAM,CAACC,QAAQ;IAC/BC,OAAO,EAAEC,OAAO,CAACV,kBAAkB,CAAC;IACpCE;EACF,CAAC,CAAC,EACJ,CAACF,kBAAkB,EAAEC,KAAK,EAAEC,aAAa,EAAEC,oBAAoB,CACjE,CAAC;EAED,OAAOP,IAAA,CAACL,aAAa;IAACoB,KAAK,EAAEP,YAAa;IAAAL,QAAA,EAAEA;EAAQ,CAAgB,CAAC;AACvE,CAAC;AAED,MAAMa,4BAA4B,GAAGpB,IAAI,CAACK,oBAAoB,CAAC;AAC/De,4BAA4B,CAACC,WAAW,GAAG,sBAAsB;AAEjE,SAASD,4BAA4B,IAAIf,oBAAoB"}
@@ -20,6 +20,8 @@ const OdysseyProvider = _ref => {
20
20
  let {
21
21
  children,
22
22
  designTokensOverride,
23
+ emotionRootElement,
24
+ shadowRootElement,
23
25
  languageCode,
24
26
  nonce,
25
27
  stylisPlugins,
@@ -27,11 +29,13 @@ const OdysseyProvider = _ref => {
27
29
  translationOverrides
28
30
  } = _ref;
29
31
  return _jsx(OdysseyCacheProvider, {
32
+ emotionRootElement: emotionRootElement,
30
33
  nonce: nonce,
31
34
  stylisPlugins: stylisPlugins,
32
35
  children: _jsx(OdysseyThemeProvider, {
33
- themeOverride: themeOverride,
34
36
  designTokensOverride: designTokensOverride,
37
+ shadowRootElement: shadowRootElement,
38
+ themeOverride: themeOverride,
35
39
  children: _jsx(_ScopedCssBaseline, {
36
40
  children: _jsx(OdysseyTranslationProvider, {
37
41
  languageCode: languageCode,
@@ -1 +1 @@
1
- {"version":3,"file":"OdysseyProvider.js","names":["memo","OdysseyCacheProvider","OdysseyThemeProvider","OdysseyTranslationProvider","jsx","_jsx","OdysseyProvider","_ref","children","designTokensOverride","languageCode","nonce","stylisPlugins","themeOverride","translationOverrides","_ScopedCssBaseline","MemoizedThemeProvider"],"sources":["../src/OdysseyProvider.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { memo, ReactNode } from \"react\";\nimport { ScopedCssBaseline } from \"@mui/material\";\n\nimport {\n OdysseyCacheProvider,\n OdysseyCacheProviderProps,\n} from \"./OdysseyCacheProvider\";\nimport {\n OdysseyThemeProvider,\n OdysseyThemeProviderProps,\n} from \"./OdysseyThemeProvider\";\nimport {\n OdysseyTranslationProvider,\n OdysseyTranslationProviderProps,\n} from \"./OdysseyTranslationProvider\";\n\nexport type OdysseyProviderProps = OdysseyCacheProviderProps &\n OdysseyThemeProviderProps &\n OdysseyTranslationProviderProps & {\n children: ReactNode;\n };\n\nconst OdysseyProvider = ({\n children,\n designTokensOverride,\n languageCode,\n nonce,\n stylisPlugins,\n themeOverride,\n translationOverrides,\n}: OdysseyProviderProps) => (\n <OdysseyCacheProvider nonce={nonce} stylisPlugins={stylisPlugins}>\n <OdysseyThemeProvider\n themeOverride={themeOverride}\n designTokensOverride={designTokensOverride}\n >\n <ScopedCssBaseline>\n <OdysseyTranslationProvider\n languageCode={languageCode}\n translationOverrides={translationOverrides}\n >\n {children}\n </OdysseyTranslationProvider>\n </ScopedCssBaseline>\n </OdysseyThemeProvider>\n </OdysseyCacheProvider>\n);\n\nconst MemoizedThemeProvider = memo(OdysseyProvider);\n\nexport { MemoizedThemeProvider as OdysseyProvider };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,QAAmB,OAAO;AAAC,SAItCC,oBAAoB;AAAA,SAIpBC,oBAAoB;AAAA,SAIpBC,0BAA0B;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAU5B,MAAMC,eAAe,GAAGC,IAAA;EAAA,IAAC;IACvBC,QAAQ;IACRC,oBAAoB;IACpBC,YAAY;IACZC,KAAK;IACLC,aAAa;IACbC,aAAa;IACbC;EACoB,CAAC,GAAAP,IAAA;EAAA,OACrBF,IAAA,CAACJ,oBAAoB;IAACU,KAAK,EAAEA,KAAM;IAACC,aAAa,EAAEA,aAAc;IAAAJ,QAAA,EAC/DH,IAAA,CAACH,oBAAoB;MACnBW,aAAa,EAAEA,aAAc;MAC7BJ,oBAAoB,EAAEA,oBAAqB;MAAAD,QAAA,EAE3CH,IAAA,CAAAU,kBAAA;QAAAP,QAAA,EACEH,IAAA,CAACF,0BAA0B;UACzBO,YAAY,EAAEA,YAAa;UAC3BI,oBAAoB,EAAEA,oBAAqB;UAAAN,QAAA,EAE1CA;QAAQ,CACiB;MAAC,CACZ;IAAC,CACA;EAAC,CACH,CAAC;AAAA,CACxB;AAED,MAAMQ,qBAAqB,GAAGhB,IAAI,CAACM,eAAe,CAAC;AAEnD,SAASU,qBAAqB,IAAIV,eAAe"}
1
+ {"version":3,"file":"OdysseyProvider.js","names":["memo","OdysseyCacheProvider","OdysseyThemeProvider","OdysseyTranslationProvider","jsx","_jsx","OdysseyProvider","_ref","children","designTokensOverride","emotionRootElement","shadowRootElement","languageCode","nonce","stylisPlugins","themeOverride","translationOverrides","_ScopedCssBaseline","MemoizedThemeProvider"],"sources":["../src/OdysseyProvider.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { memo, ReactNode } from \"react\";\nimport { ScopedCssBaseline } from \"@mui/material\";\n\nimport {\n OdysseyCacheProvider,\n OdysseyCacheProviderProps,\n} from \"./OdysseyCacheProvider\";\nimport {\n OdysseyThemeProvider,\n OdysseyThemeProviderProps,\n} from \"./OdysseyThemeProvider\";\nimport {\n OdysseyTranslationProvider,\n OdysseyTranslationProviderProps,\n} from \"./OdysseyTranslationProvider\";\n\nexport type OdysseyProviderProps = OdysseyCacheProviderProps &\n OdysseyThemeProviderProps &\n OdysseyTranslationProviderProps & {\n children: ReactNode;\n };\n\nconst OdysseyProvider = ({\n children,\n designTokensOverride,\n emotionRootElement,\n shadowRootElement,\n languageCode,\n nonce,\n stylisPlugins,\n themeOverride,\n translationOverrides,\n}: OdysseyProviderProps) => (\n <OdysseyCacheProvider\n emotionRootElement={emotionRootElement}\n nonce={nonce}\n stylisPlugins={stylisPlugins}\n >\n <OdysseyThemeProvider\n designTokensOverride={designTokensOverride}\n shadowRootElement={shadowRootElement}\n themeOverride={themeOverride}\n >\n <ScopedCssBaseline>\n <OdysseyTranslationProvider\n languageCode={languageCode}\n translationOverrides={translationOverrides}\n >\n {children}\n </OdysseyTranslationProvider>\n </ScopedCssBaseline>\n </OdysseyThemeProvider>\n </OdysseyCacheProvider>\n);\n\nconst MemoizedThemeProvider = memo(OdysseyProvider);\n\nexport { MemoizedThemeProvider as OdysseyProvider };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,QAAmB,OAAO;AAAC,SAItCC,oBAAoB;AAAA,SAIpBC,oBAAoB;AAAA,SAIpBC,0BAA0B;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAU5B,MAAMC,eAAe,GAAGC,IAAA;EAAA,IAAC;IACvBC,QAAQ;IACRC,oBAAoB;IACpBC,kBAAkB;IAClBC,iBAAiB;IACjBC,YAAY;IACZC,KAAK;IACLC,aAAa;IACbC,aAAa;IACbC;EACoB,CAAC,GAAAT,IAAA;EAAA,OACrBF,IAAA,CAACJ,oBAAoB;IACnBS,kBAAkB,EAAEA,kBAAmB;IACvCG,KAAK,EAAEA,KAAM;IACbC,aAAa,EAAEA,aAAc;IAAAN,QAAA,EAE7BH,IAAA,CAACH,oBAAoB;MACnBO,oBAAoB,EAAEA,oBAAqB;MAC3CE,iBAAiB,EAAEA,iBAAkB;MACrCI,aAAa,EAAEA,aAAc;MAAAP,QAAA,EAE7BH,IAAA,CAAAY,kBAAA;QAAAT,QAAA,EACEH,IAAA,CAACF,0BAA0B;UACzBS,YAAY,EAAEA,YAAa;UAC3BI,oBAAoB,EAAEA,oBAAqB;UAAAR,QAAA,EAE1CA;QAAQ,CACiB;MAAC,CACZ;IAAC,CACA;EAAC,CACH,CAAC;AAAA,CACxB;AAED,MAAMU,qBAAqB,GAAGlB,IAAI,CAACM,eAAe,CAAC;AAEnD,SAASY,qBAAqB,IAAIZ,eAAe"}
@@ -21,13 +21,17 @@ const OdysseyThemeProvider = _ref => {
21
21
  let {
22
22
  children,
23
23
  designTokensOverride,
24
+ shadowRootElement,
24
25
  themeOverride
25
26
  } = _ref;
26
27
  const odysseyTokens = useMemo(() => ({
27
28
  ...Tokens,
28
29
  ...designTokensOverride
29
30
  }), [designTokensOverride]);
30
- const odysseyTheme = useMemo(() => createOdysseyMuiTheme(odysseyTokens), [odysseyTokens]);
31
+ const odysseyTheme = useMemo(() => createOdysseyMuiTheme({
32
+ odysseyTokens,
33
+ shadowRootElement
34
+ }), [odysseyTokens, shadowRootElement]);
31
35
  const customOdysseyTheme = useMemo(() => themeOverride && createTheme(deepmerge(odysseyTheme, themeOverride)), [odysseyTheme, themeOverride]);
32
36
  return _jsx(MuiThemeProvider, {
33
37
  theme: customOdysseyTheme ?? odysseyTheme,
@@ -1 +1 @@
1
- {"version":3,"file":"OdysseyThemeProvider.js","names":["createTheme","ThemeProvider","MuiThemeProvider","memo","useMemo","deepmerge","createOdysseyMuiTheme","Tokens","OdysseyDesignTokensContext","jsx","_jsx","OdysseyThemeProvider","_ref","children","designTokensOverride","themeOverride","odysseyTokens","odysseyTheme","customOdysseyTheme","theme","Provider","value","MemoizedOdysseyThemeProvider"],"sources":["../src/OdysseyThemeProvider.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 createTheme,\n ThemeProvider as MuiThemeProvider,\n} from \"@mui/material/styles\";\nimport { memo, ReactNode, useMemo } from \"react\";\n\nimport { ThemeOptions } from \"@mui/material\";\nimport { deepmerge } from \"@mui/utils\";\nimport { createOdysseyMuiTheme, DesignTokensOverride } from \"./theme\";\nimport * as Tokens from \"@okta/odyssey-design-tokens\";\nimport { OdysseyDesignTokensContext } from \"./OdysseyDesignTokensContext\";\n\nexport type OdysseyThemeProviderProps = {\n children: ReactNode;\n designTokensOverride?: DesignTokensOverride;\n themeOverride?: ThemeOptions;\n};\n\nconst OdysseyThemeProvider = ({\n children,\n designTokensOverride,\n themeOverride,\n}: OdysseyThemeProviderProps) => {\n const odysseyTokens = useMemo(\n () => ({ ...Tokens, ...designTokensOverride }),\n [designTokensOverride]\n );\n const odysseyTheme = useMemo(\n () => createOdysseyMuiTheme(odysseyTokens),\n [odysseyTokens]\n );\n\n const customOdysseyTheme = useMemo(\n () => themeOverride && createTheme(deepmerge(odysseyTheme, themeOverride)),\n [odysseyTheme, themeOverride]\n );\n\n return (\n <MuiThemeProvider theme={customOdysseyTheme ?? odysseyTheme}>\n <OdysseyDesignTokensContext.Provider value={odysseyTokens}>\n {children}\n </OdysseyDesignTokensContext.Provider>\n </MuiThemeProvider>\n );\n};\n\nconst MemoizedOdysseyThemeProvider = memo(OdysseyThemeProvider);\n\nexport { MemoizedOdysseyThemeProvider as OdysseyThemeProvider };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,WAAW,EACXC,aAAa,IAAIC,gBAAgB,QAC5B,sBAAsB;AAC7B,SAASC,IAAI,EAAaC,OAAO,QAAQ,OAAO;AAGhD,SAASC,SAAS,QAAQ,YAAY;AAAC,SAC9BC,qBAAqB;AAC9B,OAAO,KAAKC,MAAM,MAAM,6BAA6B;AAAC,SAC7CC,0BAA0B;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAQnC,MAAMC,oBAAoB,GAAGC,IAAA,IAII;EAAA,IAJH;IAC5BC,QAAQ;IACRC,oBAAoB;IACpBC;EACyB,CAAC,GAAAH,IAAA;EAC1B,MAAMI,aAAa,GAAGZ,OAAO,CAC3B,OAAO;IAAE,GAAGG,MAAM;IAAE,GAAGO;EAAqB,CAAC,CAAC,EAC9C,CAACA,oBAAoB,CACvB,CAAC;EACD,MAAMG,YAAY,GAAGb,OAAO,CAC1B,MAAME,qBAAqB,CAACU,aAAa,CAAC,EAC1C,CAACA,aAAa,CAChB,CAAC;EAED,MAAME,kBAAkB,GAAGd,OAAO,CAChC,MAAMW,aAAa,IAAIf,WAAW,CAACK,SAAS,CAACY,YAAY,EAAEF,aAAa,CAAC,CAAC,EAC1E,CAACE,YAAY,EAAEF,aAAa,CAC9B,CAAC;EAED,OACEL,IAAA,CAACR,gBAAgB;IAACiB,KAAK,EAAED,kBAAkB,IAAID,YAAa;IAAAJ,QAAA,EAC1DH,IAAA,CAACF,0BAA0B,CAACY,QAAQ;MAACC,KAAK,EAAEL,aAAc;MAAAH,QAAA,EACvDA;IAAQ,CAC0B;EAAC,CACtB,CAAC;AAEvB,CAAC;AAED,MAAMS,4BAA4B,GAAGnB,IAAI,CAACQ,oBAAoB,CAAC;AAE/D,SAASW,4BAA4B,IAAIX,oBAAoB"}
1
+ {"version":3,"file":"OdysseyThemeProvider.js","names":["createTheme","ThemeProvider","MuiThemeProvider","memo","useMemo","deepmerge","createOdysseyMuiTheme","Tokens","OdysseyDesignTokensContext","jsx","_jsx","OdysseyThemeProvider","_ref","children","designTokensOverride","shadowRootElement","themeOverride","odysseyTokens","odysseyTheme","customOdysseyTheme","theme","Provider","value","MemoizedOdysseyThemeProvider"],"sources":["../src/OdysseyThemeProvider.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 createTheme,\n ThemeProvider as MuiThemeProvider,\n} from \"@mui/material/styles\";\nimport { memo, ReactNode, useMemo } from \"react\";\n\nimport { ThemeOptions } from \"@mui/material\";\nimport { deepmerge } from \"@mui/utils\";\nimport { createOdysseyMuiTheme, DesignTokensOverride } from \"./theme\";\nimport * as Tokens from \"@okta/odyssey-design-tokens\";\nimport { OdysseyDesignTokensContext } from \"./OdysseyDesignTokensContext\";\n\nexport type OdysseyThemeProviderProps = {\n children: ReactNode;\n designTokensOverride?: DesignTokensOverride;\n shadowRootElement?: HTMLDivElement;\n themeOverride?: ThemeOptions;\n};\n\nconst OdysseyThemeProvider = ({\n children,\n designTokensOverride,\n shadowRootElement,\n themeOverride,\n}: OdysseyThemeProviderProps) => {\n const odysseyTokens = useMemo(\n () => ({ ...Tokens, ...designTokensOverride }),\n [designTokensOverride]\n );\n const odysseyTheme = useMemo(\n () =>\n createOdysseyMuiTheme({\n odysseyTokens,\n shadowRootElement,\n }),\n [odysseyTokens, shadowRootElement]\n );\n\n const customOdysseyTheme = useMemo(\n () => themeOverride && createTheme(deepmerge(odysseyTheme, themeOverride)),\n [odysseyTheme, themeOverride]\n );\n\n return (\n <MuiThemeProvider theme={customOdysseyTheme ?? odysseyTheme}>\n <OdysseyDesignTokensContext.Provider value={odysseyTokens}>\n {children}\n </OdysseyDesignTokensContext.Provider>\n </MuiThemeProvider>\n );\n};\n\nconst MemoizedOdysseyThemeProvider = memo(OdysseyThemeProvider);\n\nexport { MemoizedOdysseyThemeProvider as OdysseyThemeProvider };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,WAAW,EACXC,aAAa,IAAIC,gBAAgB,QAC5B,sBAAsB;AAC7B,SAASC,IAAI,EAAaC,OAAO,QAAQ,OAAO;AAGhD,SAASC,SAAS,QAAQ,YAAY;AAAC,SAC9BC,qBAAqB;AAC9B,OAAO,KAAKC,MAAM,MAAM,6BAA6B;AAAC,SAC7CC,0BAA0B;AAAA,SAAAC,GAAA,IAAAC,IAAA;AASnC,MAAMC,oBAAoB,GAAGC,IAAA,IAKI;EAAA,IALH;IAC5BC,QAAQ;IACRC,oBAAoB;IACpBC,iBAAiB;IACjBC;EACyB,CAAC,GAAAJ,IAAA;EAC1B,MAAMK,aAAa,GAAGb,OAAO,CAC3B,OAAO;IAAE,GAAGG,MAAM;IAAE,GAAGO;EAAqB,CAAC,CAAC,EAC9C,CAACA,oBAAoB,CACvB,CAAC;EACD,MAAMI,YAAY,GAAGd,OAAO,CAC1B,MACEE,qBAAqB,CAAC;IACpBW,aAAa;IACbF;EACF,CAAC,CAAC,EACJ,CAACE,aAAa,EAAEF,iBAAiB,CACnC,CAAC;EAED,MAAMI,kBAAkB,GAAGf,OAAO,CAChC,MAAMY,aAAa,IAAIhB,WAAW,CAACK,SAAS,CAACa,YAAY,EAAEF,aAAa,CAAC,CAAC,EAC1E,CAACE,YAAY,EAAEF,aAAa,CAC9B,CAAC;EAED,OACEN,IAAA,CAACR,gBAAgB;IAACkB,KAAK,EAAED,kBAAkB,IAAID,YAAa;IAAAL,QAAA,EAC1DH,IAAA,CAACF,0BAA0B,CAACa,QAAQ;MAACC,KAAK,EAAEL,aAAc;MAAAJ,QAAA,EACvDA;IAAQ,CAC0B;EAAC,CACtB,CAAC;AAEvB,CAAC;AAED,MAAMU,4BAA4B,GAAGpB,IAAI,CAACQ,oBAAoB,CAAC;AAE/D,SAASY,4BAA4B,IAAIZ,oBAAoB"}
@@ -11,7 +11,7 @@
11
11
  */
12
12
 
13
13
  import { useEffect } from "react";
14
- import i18n, { defaultNS, resources } from "./OdysseyI18n.js";
14
+ import { i18n, defaultNS, resources } from "./i18n.js";
15
15
  import { I18nextProvider } from "react-i18next";
16
16
  import { jsx as _jsx } from "react/jsx-runtime";
17
17
  const mergeBundleOverrides = (languageCode, translationOverrides) => {
@@ -1 +1 @@
1
- {"version":3,"file":"OdysseyTranslationProvider.js","names":["useEffect","i18n","defaultNS","resources","I18nextProvider","jsx","_jsx","mergeBundleOverrides","languageCode","translationOverrides","bundle","overrides","OdysseyTranslationProvider","_ref","children","changeLanguage","window","navigator","language","Object","keys","forEach","addResourceBundle"],"sources":["../src/OdysseyTranslationProvider.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { ReactNode, useEffect } from \"react\";\n\nimport { SupportedLanguages } from \"./OdysseyTranslationProvider.types\";\n\nimport i18n, { defaultNS, resources } from \"./OdysseyI18n\";\nimport { I18nextProvider } from \"react-i18next\";\n\nexport type TranslationOverrides = {\n [key in SupportedLanguages]?: Partial<(typeof resources)[\"en\"]>;\n};\n\nconst mergeBundleOverrides = (\n languageCode: SupportedLanguages,\n translationOverrides: TranslationOverrides\n) => {\n const bundle = resources[languageCode];\n const overrides = translationOverrides[languageCode];\n return {\n ...bundle,\n ...overrides,\n };\n};\n\nexport type OdysseyTranslationProviderProps = {\n children: ReactNode;\n languageCode?: SupportedLanguages;\n translationOverrides?: TranslationOverrides;\n};\n\nexport const OdysseyTranslationProvider = ({\n children,\n languageCode,\n translationOverrides,\n}: OdysseyTranslationProviderProps) => {\n useEffect(() => {\n // Defaults to the browser's language if available otherwise `en` will be used\n i18n.changeLanguage(languageCode || window.navigator.language);\n }, [languageCode]);\n\n useEffect(() => {\n if (translationOverrides) {\n Object.keys(translationOverrides).forEach((language) => {\n const bundle = mergeBundleOverrides(\n language as SupportedLanguages,\n translationOverrides\n );\n i18n.addResourceBundle(language, defaultNS, bundle);\n });\n }\n }, [translationOverrides]);\n\n return <I18nextProvider i18n={i18n}>{children}</I18nextProvider>;\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAoBA,SAAS,QAAQ,OAAO;AAAC,OAItCC,IAAI,IAAIC,SAAS,EAAEC,SAAS;AACnC,SAASC,eAAe,QAAQ,eAAe;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAMhD,MAAMC,oBAAoB,GAAGA,CAC3BC,YAAgC,EAChCC,oBAA0C,KACvC;EACH,MAAMC,MAAM,GAAGP,SAAS,CAACK,YAAY,CAAC;EACtC,MAAMG,SAAS,GAAGF,oBAAoB,CAACD,YAAY,CAAC;EACpD,OAAO;IACL,GAAGE,MAAM;IACT,GAAGC;EACL,CAAC;AACH,CAAC;AAQD,OAAO,MAAMC,0BAA0B,GAAGC,IAAA,IAIH;EAAA,IAJI;IACzCC,QAAQ;IACRN,YAAY;IACZC;EAC+B,CAAC,GAAAI,IAAA;EAChCb,SAAS,CAAC,MAAM;IAEdC,IAAI,CAACc,cAAc,CAACP,YAAY,IAAIQ,MAAM,CAACC,SAAS,CAACC,QAAQ,CAAC;EAChE,CAAC,EAAE,CAACV,YAAY,CAAC,CAAC;EAElBR,SAAS,CAAC,MAAM;IACd,IAAIS,oBAAoB,EAAE;MACxBU,MAAM,CAACC,IAAI,CAACX,oBAAoB,CAAC,CAACY,OAAO,CAAEH,QAAQ,IAAK;QACtD,MAAMR,MAAM,GAAGH,oBAAoB,CACjCW,QAAQ,EACRT,oBACF,CAAC;QACDR,IAAI,CAACqB,iBAAiB,CAACJ,QAAQ,EAAEhB,SAAS,EAAEQ,MAAM,CAAC;MACrD,CAAC,CAAC;IACJ;EACF,CAAC,EAAE,CAACD,oBAAoB,CAAC,CAAC;EAE1B,OAAOH,IAAA,CAACF,eAAe;IAACH,IAAI,EAAEA,IAAK;IAAAa,QAAA,EAAEA;EAAQ,CAAkB,CAAC;AAClE,CAAC"}
1
+ {"version":3,"file":"OdysseyTranslationProvider.js","names":["useEffect","i18n","defaultNS","resources","I18nextProvider","jsx","_jsx","mergeBundleOverrides","languageCode","translationOverrides","bundle","overrides","OdysseyTranslationProvider","_ref","children","changeLanguage","window","navigator","language","Object","keys","forEach","addResourceBundle"],"sources":["../src/OdysseyTranslationProvider.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { ReactNode, useEffect } from \"react\";\n\nimport { SupportedLanguages } from \"./OdysseyTranslationProvider.types\";\n\nimport { i18n, defaultNS, resources } from \"./i18n\";\nimport { I18nextProvider } from \"react-i18next\";\n\nexport type TranslationOverrides = {\n [key in SupportedLanguages]?: Partial<(typeof resources)[\"en\"]>;\n};\n\nconst mergeBundleOverrides = (\n languageCode: SupportedLanguages,\n translationOverrides: TranslationOverrides\n) => {\n const bundle = resources[languageCode];\n const overrides = translationOverrides[languageCode];\n return {\n ...bundle,\n ...overrides,\n };\n};\n\nexport type OdysseyTranslationProviderProps = {\n children: ReactNode;\n languageCode?: SupportedLanguages;\n translationOverrides?: TranslationOverrides;\n};\n\nexport const OdysseyTranslationProvider = ({\n children,\n languageCode,\n translationOverrides,\n}: OdysseyTranslationProviderProps) => {\n useEffect(() => {\n // Defaults to the browser's language if available otherwise `en` will be used\n i18n.changeLanguage(languageCode || window.navigator.language);\n }, [languageCode]);\n\n useEffect(() => {\n if (translationOverrides) {\n Object.keys(translationOverrides).forEach((language) => {\n const bundle = mergeBundleOverrides(\n language as SupportedLanguages,\n translationOverrides\n );\n i18n.addResourceBundle(language, defaultNS, bundle);\n });\n }\n }, [translationOverrides]);\n\n return <I18nextProvider i18n={i18n}>{children}</I18nextProvider>;\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAoBA,SAAS,QAAQ,OAAO;AAAC,SAIpCC,IAAI,EAAEC,SAAS,EAAEC,SAAS;AACnC,SAASC,eAAe,QAAQ,eAAe;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAMhD,MAAMC,oBAAoB,GAAGA,CAC3BC,YAAgC,EAChCC,oBAA0C,KACvC;EACH,MAAMC,MAAM,GAAGP,SAAS,CAACK,YAAY,CAAC;EACtC,MAAMG,SAAS,GAAGF,oBAAoB,CAACD,YAAY,CAAC;EACpD,OAAO;IACL,GAAGE,MAAM;IACT,GAAGC;EACL,CAAC;AACH,CAAC;AAQD,OAAO,MAAMC,0BAA0B,GAAGC,IAAA,IAIH;EAAA,IAJI;IACzCC,QAAQ;IACRN,YAAY;IACZC;EAC+B,CAAC,GAAAI,IAAA;EAChCb,SAAS,CAAC,MAAM;IAEdC,IAAI,CAACc,cAAc,CAACP,YAAY,IAAIQ,MAAM,CAACC,SAAS,CAACC,QAAQ,CAAC;EAChE,CAAC,EAAE,CAACV,YAAY,CAAC,CAAC;EAElBR,SAAS,CAAC,MAAM;IACd,IAAIS,oBAAoB,EAAE;MACxBU,MAAM,CAACC,IAAI,CAACX,oBAAoB,CAAC,CAACY,OAAO,CAAEH,QAAQ,IAAK;QACtD,MAAMR,MAAM,GAAGH,oBAAoB,CACjCW,QAAQ,EACRT,oBACF,CAAC;QACDR,IAAI,CAACqB,iBAAiB,CAACJ,QAAQ,EAAEhB,SAAS,EAAEQ,MAAM,CAAC;MACrD,CAAC,CAAC;IACJ;EACF,CAAC,EAAE,CAACD,oBAAoB,CAAC,CAAC;EAE1B,OAAOH,IAAA,CAACF,eAAe;IAACH,IAAI,EAAEA,IAAK;IAAAa,QAAA,EA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