@okta/odyssey-react-mui 1.9.11 → 1.9.13

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 (195) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/Accordion.js +3 -1
  3. package/dist/Accordion.js.map +1 -1
  4. package/dist/AllowedProps.js +2 -0
  5. package/dist/AllowedProps.js.map +1 -0
  6. package/dist/Autocomplete.js +4 -2
  7. package/dist/Autocomplete.js.map +1 -1
  8. package/dist/Badge.js +35 -30
  9. package/dist/Badge.js.map +1 -1
  10. package/dist/Banner.js +5 -1
  11. package/dist/Banner.js.map +1 -1
  12. package/dist/Box.js +4 -2
  13. package/dist/Box.js.map +1 -1
  14. package/dist/Breadcrumbs.js +5 -1
  15. package/dist/Breadcrumbs.js.map +1 -1
  16. package/dist/Button.js +3 -1
  17. package/dist/Button.js.map +1 -1
  18. package/dist/Callout.js +4 -1
  19. package/dist/Callout.js.map +1 -1
  20. package/dist/Checkbox.js +5 -2
  21. package/dist/Checkbox.js.map +1 -1
  22. package/dist/CheckboxGroup.js +4 -2
  23. package/dist/CheckboxGroup.js.map +1 -1
  24. package/dist/CircularProgress.js.map +1 -1
  25. package/dist/Dialog.js +2 -0
  26. package/dist/Dialog.js.map +1 -1
  27. package/dist/FieldError.js +4 -1
  28. package/dist/FieldError.js.map +1 -1
  29. package/dist/FieldHint.js +3 -1
  30. package/dist/FieldHint.js.map +1 -1
  31. package/dist/FieldLabel.js +4 -1
  32. package/dist/FieldLabel.js.map +1 -1
  33. package/dist/Fieldset.js +4 -1
  34. package/dist/Fieldset.js.map +1 -1
  35. package/dist/Form.js +4 -1
  36. package/dist/Form.js.map +1 -1
  37. package/dist/Link.js +2 -0
  38. package/dist/Link.js.map +1 -1
  39. package/dist/MenuButton.js +3 -1
  40. package/dist/MenuButton.js.map +1 -1
  41. package/dist/MenuItem.js.map +1 -1
  42. package/dist/NativeSelect.js +4 -2
  43. package/dist/NativeSelect.js.map +1 -1
  44. package/dist/PasswordField.js +3 -1
  45. package/dist/PasswordField.js.map +1 -1
  46. package/dist/Radio.js +2 -0
  47. package/dist/Radio.js.map +1 -1
  48. package/dist/RadioGroup.js +3 -1
  49. package/dist/RadioGroup.js.map +1 -1
  50. package/dist/ScreenReaderText.js +3 -1
  51. package/dist/ScreenReaderText.js.map +1 -1
  52. package/dist/SearchField.js +3 -1
  53. package/dist/SearchField.js.map +1 -1
  54. package/dist/Select.js +4 -2
  55. package/dist/Select.js.map +1 -1
  56. package/dist/Status.js +2 -0
  57. package/dist/Status.js.map +1 -1
  58. package/dist/Tabs.js +54 -10
  59. package/dist/Tabs.js.map +1 -1
  60. package/dist/Tag.js +5 -3
  61. package/dist/Tag.js.map +1 -1
  62. package/dist/TagList.js.map +1 -1
  63. package/dist/TextField.js +6 -2
  64. package/dist/TextField.js.map +1 -1
  65. package/dist/Toast.js +4 -1
  66. package/dist/Toast.js.map +1 -1
  67. package/dist/Tooltip.js +3 -1
  68. package/dist/Tooltip.js.map +1 -1
  69. package/dist/Typography.js +32 -10
  70. package/dist/Typography.js.map +1 -1
  71. package/dist/labs/Switch.js.map +1 -1
  72. package/dist/labs/VirtualizedAutocomplete.js +4 -2
  73. package/dist/labs/VirtualizedAutocomplete.js.map +1 -1
  74. package/dist/src/Accordion.d.ts +3 -3
  75. package/dist/src/Accordion.d.ts.map +1 -1
  76. package/dist/src/{SeleniumProps.d.ts → AllowedProps.d.ts} +6 -2
  77. package/dist/src/AllowedProps.d.ts.map +1 -0
  78. package/dist/src/Autocomplete.d.ts +3 -3
  79. package/dist/src/Autocomplete.d.ts.map +1 -1
  80. package/dist/src/Badge.d.ts +3 -3
  81. package/dist/src/Badge.d.ts.map +1 -1
  82. package/dist/src/Banner.d.ts +3 -3
  83. package/dist/src/Banner.d.ts.map +1 -1
  84. package/dist/src/Box.d.ts +3 -3
  85. package/dist/src/Box.d.ts.map +1 -1
  86. package/dist/src/Breadcrumbs.d.ts +3 -2
  87. package/dist/src/Breadcrumbs.d.ts.map +1 -1
  88. package/dist/src/Button.d.ts +3 -3
  89. package/dist/src/Button.d.ts.map +1 -1
  90. package/dist/src/Callout.d.ts +3 -3
  91. package/dist/src/Callout.d.ts.map +1 -1
  92. package/dist/src/Checkbox.d.ts +3 -3
  93. package/dist/src/Checkbox.d.ts.map +1 -1
  94. package/dist/src/CheckboxGroup.d.ts +3 -3
  95. package/dist/src/CheckboxGroup.d.ts.map +1 -1
  96. package/dist/src/CircularProgress.d.ts +2 -2
  97. package/dist/src/CircularProgress.d.ts.map +1 -1
  98. package/dist/src/Dialog.d.ts +3 -3
  99. package/dist/src/Dialog.d.ts.map +1 -1
  100. package/dist/src/FieldError.d.ts +3 -3
  101. package/dist/src/FieldError.d.ts.map +1 -1
  102. package/dist/src/FieldHint.d.ts +3 -3
  103. package/dist/src/FieldHint.d.ts.map +1 -1
  104. package/dist/src/FieldLabel.d.ts +3 -3
  105. package/dist/src/FieldLabel.d.ts.map +1 -1
  106. package/dist/src/Fieldset.d.ts +3 -3
  107. package/dist/src/Fieldset.d.ts.map +1 -1
  108. package/dist/src/Form.d.ts +3 -3
  109. package/dist/src/Form.d.ts.map +1 -1
  110. package/dist/src/Link.d.ts +3 -3
  111. package/dist/src/Link.d.ts.map +1 -1
  112. package/dist/src/MenuButton.d.ts +3 -3
  113. package/dist/src/MenuButton.d.ts.map +1 -1
  114. package/dist/src/MenuItem.d.ts +2 -2
  115. package/dist/src/MenuItem.d.ts.map +1 -1
  116. package/dist/src/NativeSelect.d.ts +2 -2
  117. package/dist/src/NativeSelect.d.ts.map +1 -1
  118. package/dist/src/PasswordField.d.ts +3 -3
  119. package/dist/src/PasswordField.d.ts.map +1 -1
  120. package/dist/src/Radio.d.ts +3 -3
  121. package/dist/src/Radio.d.ts.map +1 -1
  122. package/dist/src/RadioGroup.d.ts +3 -3
  123. package/dist/src/RadioGroup.d.ts.map +1 -1
  124. package/dist/src/ScreenReaderText.d.ts +3 -2
  125. package/dist/src/ScreenReaderText.d.ts.map +1 -1
  126. package/dist/src/SearchField.d.ts +3 -3
  127. package/dist/src/SearchField.d.ts.map +1 -1
  128. package/dist/src/Select.d.ts +3 -3
  129. package/dist/src/Select.d.ts.map +1 -1
  130. package/dist/src/Status.d.ts +3 -3
  131. package/dist/src/Status.d.ts.map +1 -1
  132. package/dist/src/Tabs.d.ts +7 -3
  133. package/dist/src/Tabs.d.ts.map +1 -1
  134. package/dist/src/Tag.d.ts +3 -3
  135. package/dist/src/Tag.d.ts.map +1 -1
  136. package/dist/src/TagList.d.ts +2 -2
  137. package/dist/src/TagList.d.ts.map +1 -1
  138. package/dist/src/TextField.d.ts +3 -3
  139. package/dist/src/TextField.d.ts.map +1 -1
  140. package/dist/src/Toast.d.ts +3 -3
  141. package/dist/src/Toast.d.ts.map +1 -1
  142. package/dist/src/Tooltip.d.ts +3 -3
  143. package/dist/src/Tooltip.d.ts.map +1 -1
  144. package/dist/src/Typography.d.ts +13 -13
  145. package/dist/src/Typography.d.ts.map +1 -1
  146. package/dist/src/labs/Switch.d.ts +2 -2
  147. package/dist/src/labs/Switch.d.ts.map +1 -1
  148. package/dist/src/labs/VirtualizedAutocomplete.d.ts +3 -3
  149. package/dist/src/labs/VirtualizedAutocomplete.d.ts.map +1 -1
  150. package/dist/theme/components.js +1 -1
  151. package/dist/theme/components.js.map +1 -1
  152. package/dist/tsconfig.production.tsbuildinfo +1 -1
  153. package/package.json +3 -3
  154. package/src/Accordion.tsx +6 -3
  155. package/src/{SeleniumProps.ts → AllowedProps.ts} +5 -1
  156. package/src/Autocomplete.tsx +4 -2
  157. package/src/Badge.tsx +37 -27
  158. package/src/Banner.tsx +8 -5
  159. package/src/Box.tsx +4 -3
  160. package/src/Breadcrumbs.tsx +6 -1
  161. package/src/Button.tsx +5 -2
  162. package/src/Callout.tsx +14 -5
  163. package/src/Checkbox.tsx +6 -4
  164. package/src/CheckboxGroup.tsx +5 -3
  165. package/src/CircularProgress.tsx +2 -2
  166. package/src/Dialog.tsx +4 -3
  167. package/src/FieldError.tsx +5 -5
  168. package/src/FieldHint.tsx +10 -4
  169. package/src/FieldLabel.tsx +11 -5
  170. package/src/Fieldset.tsx +5 -4
  171. package/src/Form.tsx +9 -4
  172. package/src/Link.tsx +4 -2
  173. package/src/MenuButton.tsx +4 -2
  174. package/src/MenuItem.tsx +2 -2
  175. package/src/NativeSelect.tsx +5 -2
  176. package/src/PasswordField.tsx +5 -2
  177. package/src/Radio.tsx +4 -2
  178. package/src/RadioGroup.tsx +5 -3
  179. package/src/ScreenReaderText.tsx +4 -3
  180. package/src/SearchField.tsx +5 -2
  181. package/src/Select.tsx +5 -2
  182. package/src/Status.tsx +4 -2
  183. package/src/Tabs.tsx +87 -19
  184. package/src/Tag.tsx +14 -3
  185. package/src/TagList.tsx +2 -2
  186. package/src/TextField.tsx +11 -4
  187. package/src/Toast.tsx +5 -4
  188. package/src/Tooltip.tsx +4 -2
  189. package/src/Typography.tsx +24 -2
  190. package/src/labs/Switch.tsx +2 -2
  191. package/src/labs/VirtualizedAutocomplete.tsx +4 -2
  192. package/src/theme/components.tsx +1 -1
  193. package/dist/SeleniumProps.js +0 -2
  194. package/dist/SeleniumProps.js.map +0 -1
  195. package/dist/src/SeleniumProps.d.ts.map +0 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
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.9.13](https://github.com/okta/odyssey/compare/v1.9.12...v1.9.13) (2024-01-04)
7
+
8
+ **Note:** Version bump only for package @okta/odyssey-react-mui
9
+
10
+ ## [1.9.12](https://github.com/okta/odyssey/compare/v1.9.11...v1.9.12) (2023-12-22)
11
+
12
+ **Note:** Version bump only for package @okta/odyssey-react-mui
13
+
6
14
  ## [1.9.11](https://github.com/okta/odyssey/compare/v1.9.10...v1.9.11) (2023-12-22)
7
15
 
8
16
  **Note:** Version bump only for package @okta/odyssey-react-mui
package/dist/Accordion.js CHANGED
@@ -26,7 +26,8 @@ const Accordion = _ref => {
26
26
  isDefaultExpanded,
27
27
  isDisabled,
28
28
  isExpanded,
29
- onChange
29
+ onChange,
30
+ translate
30
31
  } = _ref;
31
32
  return _jsxs(_Accordion, {
32
33
  defaultExpanded: isDefaultExpanded,
@@ -39,6 +40,7 @@ const Accordion = _ref => {
39
40
  expandIcon: _jsx(ChevronDownIcon, {}),
40
41
  children: _jsx(Support, {
41
42
  component: "div",
43
+ translate: translate,
42
44
  children: label
43
45
  })
44
46
  }), _jsx(_AccordionDetails, {
@@ -1 +1 @@
1
- {"version":3,"file":"Accordion.js","names":["memo","ChevronDownIcon","Support","jsx","_jsx","jsxs","_jsxs","Accordion","_ref","children","label","hasShadow","isDefaultExpanded","isDisabled","isExpanded","onChange","_Accordion","defaultExpanded","disabled","disableGutters","expanded","className","undefined","_AccordionSummary","expandIcon","component","_AccordionDetails","MemoizedAccordion","displayName"],"sources":["../src/Accordion.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, memo } from \"react\";\nimport type { SeleniumProps } from \"./SeleniumProps\";\nimport {\n Accordion as MuiAccordion,\n AccordionDetails as MuiAccordionDetails,\n AccordionSummary as MuiAccordionSummary,\n AccordionProps as MuiAccordionProps,\n} from \"@mui/material\";\nimport { ChevronDownIcon } from \"./icons.generated\";\nimport { Support } from \"./Typography\";\n\nexport type AccordionProps = {\n /**\n * The content of the Accordion itself\n */\n children: ReactNode;\n /**\n * The label text for the AccordionSummary\n */\n label: string;\n /**\n * If true, the Accordion item will have a shadow.\n */\n hasShadow?: boolean;\n /**\n * Whether the item is expanded by default\n */\n isDefaultExpanded?: boolean;\n /**\n * Whether the item is disabled\n */\n isDisabled?: boolean;\n /**\n * Whether the item is expanded\n */\n isExpanded?: boolean;\n /**\n * Event fired when the expansion state of the accordion is changed\n */\n onChange?: MuiAccordionProps[\"onChange\"];\n} & (\n | {\n isExpanded: boolean;\n isDefaultExpanded?: never;\n }\n | {\n isDefaultExpanded?: boolean;\n isExpanded?: never;\n }\n) &\n SeleniumProps;\n\nconst Accordion = ({\n children,\n label,\n hasShadow = true,\n isDefaultExpanded,\n isDisabled,\n isExpanded,\n onChange,\n}: AccordionProps) => {\n return (\n <MuiAccordion\n defaultExpanded={isDefaultExpanded}\n disabled={isDisabled}\n disableGutters\n expanded={isExpanded}\n onChange={onChange}\n className={hasShadow ? `hasShadow` : undefined}\n >\n <MuiAccordionSummary expandIcon={<ChevronDownIcon />}>\n <Support component=\"div\">{label}</Support>\n </MuiAccordionSummary>\n <MuiAccordionDetails>{children}</MuiAccordionDetails>\n </MuiAccordion>\n );\n};\n\nconst MemoizedAccordion = memo(Accordion);\nMemoizedAccordion.displayName = \"Accordion\";\n\nexport { MemoizedAccordion as Accordion };\n"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAoBA,IAAI,QAAQ,OAAO;AAAC,SAQ/BC,eAAe;AAAA,SACfC,OAAO;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AA2ChB,MAAMC,SAAS,GAAGC,IAAA,IAQI;EAAA,IARH;IACjBC,QAAQ;IACRC,KAAK;IACLC,SAAS,GAAG,IAAI;IAChBC,iBAAiB;IACjBC,UAAU;IACVC,UAAU;IACVC;EACc,CAAC,GAAAP,IAAA;EACf,OACEF,KAAA,CAAAU,UAAA;IACEC,eAAe,EAAEL,iBAAkB;IACnCM,QAAQ,EAAEL,UAAW;IACrBM,cAAc;IACdC,QAAQ,EAAEN,UAAW;IACrBC,QAAQ,EAAEA,QAAS;IACnBM,SAAS,EAAEV,SAAS,GAAI,WAAU,GAAGW,SAAU;IAAAb,QAAA,GAE/CL,IAAA,CAAAmB,iBAAA;MAAqBC,UAAU,EAAEpB,IAAA,CAACH,eAAe,IAAE,CAAE;MAAAQ,QAAA,EACnDL,IAAA,CAACF,OAAO;QAACuB,SAAS,EAAC,KAAK;QAAAhB,QAAA,EAAEC;MAAK,CAAU;IAAC,CACvB,CAAC,EACtBN,IAAA,CAAAsB,iBAAA;MAAAjB,QAAA,EAAsBA;IAAQ,CAAsB,CAAC;EAAA,CACzC,CAAC;AAEnB,CAAC;AAED,MAAMkB,iBAAiB,GAAG3B,IAAI,CAACO,SAAS,CAAC;AACzCoB,iBAAiB,CAACC,WAAW,GAAG,WAAW;AAE3C,SAASD,iBAAiB,IAAIpB,SAAS"}
1
+ {"version":3,"file":"Accordion.js","names":["memo","ChevronDownIcon","Support","jsx","_jsx","jsxs","_jsxs","Accordion","_ref","children","label","hasShadow","isDefaultExpanded","isDisabled","isExpanded","onChange","translate","_Accordion","defaultExpanded","disabled","disableGutters","expanded","className","undefined","_AccordionSummary","expandIcon","component","_AccordionDetails","MemoizedAccordion","displayName"],"sources":["../src/Accordion.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, memo } from \"react\";\nimport type { AllowedProps } from \"./AllowedProps\";\nimport {\n Accordion as MuiAccordion,\n AccordionDetails as MuiAccordionDetails,\n AccordionSummary as MuiAccordionSummary,\n AccordionProps as MuiAccordionProps,\n} from \"@mui/material\";\nimport { ChevronDownIcon } from \"./icons.generated\";\nimport { Support } from \"./Typography\";\n\nexport type AccordionProps = {\n /**\n * The content of the Accordion itself\n */\n children: ReactNode;\n /**\n * The label text for the AccordionSummary\n */\n label: string;\n /**\n * If true, the Accordion item will have a shadow.\n */\n hasShadow?: boolean;\n /**\n * Whether the item is expanded by default\n */\n isDefaultExpanded?: boolean;\n /**\n * Whether the item is disabled\n */\n isDisabled?: boolean;\n /**\n * Whether the item is expanded\n */\n isExpanded?: boolean;\n /**\n * Event fired when the expansion state of the accordion is changed\n */\n onChange?: MuiAccordionProps[\"onChange\"];\n} & (\n | {\n isExpanded: boolean;\n isDefaultExpanded?: never;\n }\n | {\n isDefaultExpanded?: boolean;\n isExpanded?: never;\n }\n) &\n AllowedProps;\n\nconst Accordion = ({\n children,\n label,\n hasShadow = true,\n isDefaultExpanded,\n isDisabled,\n isExpanded,\n onChange,\n translate,\n}: AccordionProps) => {\n return (\n <MuiAccordion\n defaultExpanded={isDefaultExpanded}\n disabled={isDisabled}\n disableGutters\n expanded={isExpanded}\n onChange={onChange}\n className={hasShadow ? `hasShadow` : undefined}\n >\n <MuiAccordionSummary expandIcon={<ChevronDownIcon />}>\n <Support component=\"div\" translate={translate}>\n {label}\n </Support>\n </MuiAccordionSummary>\n <MuiAccordionDetails>{children}</MuiAccordionDetails>\n </MuiAccordion>\n );\n};\n\nconst MemoizedAccordion = memo(Accordion);\nMemoizedAccordion.displayName = \"Accordion\";\n\nexport { MemoizedAccordion as Accordion };\n"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAoBA,IAAI,QAAQ,OAAO;AAAC,SAQ/BC,eAAe;AAAA,SACfC,OAAO;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AA2ChB,MAAMC,SAAS,GAAGC,IAAA,IASI;EAAA,IATH;IACjBC,QAAQ;IACRC,KAAK;IACLC,SAAS,GAAG,IAAI;IAChBC,iBAAiB;IACjBC,UAAU;IACVC,UAAU;IACVC,QAAQ;IACRC;EACc,CAAC,GAAAR,IAAA;EACf,OACEF,KAAA,CAAAW,UAAA;IACEC,eAAe,EAAEN,iBAAkB;IACnCO,QAAQ,EAAEN,UAAW;IACrBO,cAAc;IACdC,QAAQ,EAAEP,UAAW;IACrBC,QAAQ,EAAEA,QAAS;IACnBO,SAAS,EAAEX,SAAS,GAAI,WAAU,GAAGY,SAAU;IAAAd,QAAA,GAE/CL,IAAA,CAAAoB,iBAAA;MAAqBC,UAAU,EAAErB,IAAA,CAACH,eAAe,IAAE,CAAE;MAAAQ,QAAA,EACnDL,IAAA,CAACF,OAAO;QAACwB,SAAS,EAAC,KAAK;QAACV,SAAS,EAAEA,SAAU;QAAAP,QAAA,EAC3CC;MAAK,CACC;IAAC,CACS,CAAC,EACtBN,IAAA,CAAAuB,iBAAA;MAAAlB,QAAA,EAAsBA;IAAQ,CAAsB,CAAC;EAAA,CACzC,CAAC;AAEnB,CAAC;AAED,MAAMmB,iBAAiB,GAAG5B,IAAI,CAACO,SAAS,CAAC;AACzCqB,iBAAiB,CAACC,WAAW,GAAG,WAAW;AAE3C,SAASD,iBAAiB,IAAIrB,SAAS"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=AllowedProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AllowedProps.js","names":[],"sources":["../src/AllowedProps.ts"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nexport type AllowedProps = {\n /**\n * This prop puts a `data` attribute on an HTML element in this component with the value provided.\n *\n * @deprecated **WARNING:** You should be using Semantic Selectors instead of this property. This is a temporary measure for backwards compatibility with existing Selenium tests.\n */\n testId?: string;\n /**\n * This prop puts a `translate` attribute on an HTML element. It should be used to indicate whether text within the element should be translated.\n */\n translate?: \"yes\" | \"no\";\n};\n"],"mappings":""}
@@ -39,7 +39,8 @@ const Autocomplete = _ref => {
39
39
  options,
40
40
  value,
41
41
  getIsOptionEqualToValue,
42
- testId
42
+ testId,
43
+ translate
43
44
  } = _ref;
44
45
  const controlledStateRef = useRef(getControlState({
45
46
  controlledValue: value,
@@ -131,7 +132,8 @@ const Autocomplete = _ref => {
131
132
  options: options,
132
133
  readOnly: isReadOnly,
133
134
  renderInput: renderInput,
134
- isOptionEqualToValue: getIsOptionEqualToValue
135
+ isOptionEqualToValue: getIsOptionEqualToValue,
136
+ translate: translate
135
137
  });
136
138
  };
137
139
  const MemoizedAutocomplete = memo(Autocomplete);
@@ -1 +1 @@
1
- {"version":3,"file":"Autocomplete.js","names":["memo","useCallback","useMemo","useRef","Field","ComponentControlledState","useInputValues","getControlState","jsx","_jsx","Autocomplete","_ref","defaultValue","errorMessage","hasMultipleChoices","id","idOverride","inputValue","isCustomValueAllowed","isDisabled","isFullWidth","isLoading","isOptional","isReadOnly","hint","HintLinkComponent","label","name","nameOverride","onBlur","onChange","onChangeProp","onInputChange","onInputChangeProp","onFocus","options","value","getIsOptionEqualToValue","testId","controlledStateRef","controlledValue","uncontrolledValue","defaultValueProp","undefined","valueProps","controlState","current","inputValueProp","CONTROLLED","renderInput","_ref2","InputLabelProps","InputProps","params","fieldType","hasVisibleLabel","htmlFor","renderFieldComponent","_ref3","ariaDescribedBy","errorMessageElementId","labelElementId","_InputBase","inputProps","required","event","reason","details","_Autocomplete","disableCloseOnSelect","disabled","freeSolo","filterSelectedOptions","fullWidth","loading","multiple","readOnly","isOptionEqualToValue","MemoizedAutocomplete","displayName"],"sources":["../src/Autocomplete.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport {\n Autocomplete as MuiAutocomplete,\n AutocompleteProps as MuiAutocompleteProps,\n InputBase,\n UseAutocompleteProps,\n AutocompleteValue,\n} from \"@mui/material\";\nimport { memo, useCallback, useMemo, useRef } from \"react\";\n\nimport { Field } from \"./Field\";\nimport { FieldComponentProps } from \"./FieldComponentProps\";\nimport type { SeleniumProps } from \"./SeleniumProps\";\nimport {\n ComponentControlledState,\n useInputValues,\n getControlState,\n} from \"./inputUtils\";\n\nexport type AutocompleteProps<\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined\n> = {\n /**\n * The default value. Use when the component is not controlled.\n */\n defaultValue?: UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"defaultValue\"];\n /**\n * Enables multiple choice selection\n */\n hasMultipleChoices?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"multiple\"];\n /**\n * The value for the input\n */\n inputValue?: UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"inputValue\"];\n /**\n * Allows the input of custom values\n */\n isCustomValueAllowed?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"freeSolo\"];\n /**\n * Disables the Autocomplete input\n */\n isDisabled?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"disabled\"];\n /**\n * Displays a loading indicator\n */\n isLoading?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"loading\"];\n /**\n * Makes the Autocomplete input read-only\n */\n isReadOnly?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"readOnly\"];\n /**\n * The label text for the autocomplete input\n */\n label: string;\n /**\n * Callback fired when the autocomplete loses focus.\n */\n onBlur?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onBlur\"];\n /**\n * Callback fired when a selection is made.\n */\n onChange?: UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onChange\"];\n /**\n * Callback fired when the textbox receives typed characters.\n */\n onInputChange?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onInputChange\"];\n /**\n * Callback fired when the autocomplete gains focus.\n */\n onFocus?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onFocus\"];\n /**\n * The options for the Autocomplete input\n */\n options: ReadonlyArray<OptionType>;\n /**\n * The value of the Autocomplete input\n */\n value?: UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"value\"];\n\n /**\n * Used to determine if the option represents the given value. Uses strict equality by default if none provided.\n * Both arguments need to be handled, an option can only match with one value.\n * option: the option to test\n * value: the value to test against\n *\n * You will need to implement this function if your `option` items are objects.\n */\n getIsOptionEqualToValue?: (option: OptionType, value: OptionType) => boolean;\n} & Pick<\n FieldComponentProps,\n | \"errorMessage\"\n | \"hint\"\n | \"HintLinkComponent\"\n | \"id\"\n | \"isFullWidth\"\n | \"isOptional\"\n | \"name\"\n> &\n SeleniumProps;\n\nconst Autocomplete = <\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined\n>({\n defaultValue,\n errorMessage,\n hasMultipleChoices,\n id: idOverride,\n inputValue,\n isCustomValueAllowed,\n isDisabled,\n isFullWidth = false,\n isLoading,\n isOptional = false,\n isReadOnly,\n hint,\n HintLinkComponent,\n label,\n name: nameOverride,\n onBlur,\n onChange: onChangeProp,\n onInputChange: onInputChangeProp,\n onFocus,\n options,\n value,\n getIsOptionEqualToValue,\n testId,\n}: AutocompleteProps<OptionType, HasMultipleChoices, IsCustomValueAllowed>) => {\n const controlledStateRef = useRef(\n getControlState({ controlledValue: value, uncontrolledValue: defaultValue })\n );\n const defaultValueProp = useMemo<\n | AutocompleteValue<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >\n | undefined\n >(() => {\n if (hasMultipleChoices) {\n if (value === undefined) {\n return defaultValue;\n }\n return [] as AutocompleteValue<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >;\n }\n return value === undefined ? defaultValue : undefined;\n }, [defaultValue, hasMultipleChoices, value]);\n\n const valueProps = useInputValues({\n defaultValue: defaultValueProp,\n value: value,\n controlState: controlledStateRef.current,\n });\n\n const inputValueProp = useMemo(() => {\n if (controlledStateRef.current === ComponentControlledState.CONTROLLED) {\n return { inputValue };\n }\n return undefined;\n }, [inputValue]);\n\n const renderInput = useCallback(\n ({ InputLabelProps, InputProps, ...params }) => (\n <Field\n errorMessage={errorMessage}\n fieldType=\"single\"\n hasVisibleLabel\n id={InputLabelProps.htmlFor}\n hint={hint}\n HintLinkComponent={HintLinkComponent}\n label={label}\n isOptional={isOptional}\n renderFieldComponent={({\n ariaDescribedBy,\n id,\n errorMessageElementId,\n labelElementId,\n }) => (\n <InputBase\n {...params}\n {...InputProps}\n inputProps={{\n ...params.inputProps,\n \"aria-errormessage\": errorMessageElementId,\n \"aria-labelledby\": labelElementId,\n }}\n aria-describedby={ariaDescribedBy}\n id={id}\n name={nameOverride ?? id}\n required={!isOptional}\n />\n )}\n />\n ),\n [errorMessage, hint, HintLinkComponent, isOptional, label, nameOverride]\n );\n const onChange = useCallback<\n NonNullable<\n UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onChange\"]\n >\n >(\n (event, value, reason, details) => {\n onChangeProp?.(event, value, reason, details);\n },\n [onChangeProp]\n );\n\n const onInputChange = useCallback<\n NonNullable<\n UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onInputChange\"]\n >\n >(\n (event, value, reason) => {\n onInputChangeProp?.(event, value, reason);\n },\n [onInputChangeProp]\n );\n\n return (\n <MuiAutocomplete\n {...valueProps}\n {...inputValueProp}\n // 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 fullWidth={isFullWidth}\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 isOptionEqualToValue={getIsOptionEqualToValue}\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;AASA,SAASA,IAAI,EAAEC,WAAW,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAAC,SAElDC,KAAK;AAAA,SAIZC,wBAAwB,E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AACpC,YAAY,CACf,CAAC;EAED,MAAMC,aAAa,GAAG/B,WAAW,CAU/B,CAACgE,KAAK,EAAE7B,KAAK,EAAE8B,MAAM,KAAK;IACxBjC,iBAAiB,GAAGgC,KAAK,EAAE7B,KAAK,EAAE8B,MAAM,CAAC;EAC3C,CAAC,EACD,CAACjC,iBAAiB,CACpB,CAAC;EAED,OACExB,IAAA,CAAA2D,aAAA;IAAA,GACMxB,UAAU;IAAA,GACVG,cAAc;IAElB,iBAAe5B,UAAW;IAC1B,WAASmB,MAAO;IAChB+B,oBAAoB,EAAEvD,kBAAmB;IACzCwD,QAAQ,EAAEnD,UAAW;IACrBoD,QAAQ,EAAErD,oBAAqB;IAC/BsD,qBAAqB,EAAE,IAAK;IAC5BzD,EAAE,EAAEC,UAAW;IACfyD,SAAS,EAAErD,WAAY;IACvBsD,OAAO,EAAErD,SAAU;IACnBsD,QAAQ,EAAE7D,kBAAmB;IAC7Be,MAAM,EAAEA,MAAO;IACfC,QAAQ,EAAEA,QAAS;IACnBE,aAAa,EAAEA,aAAc;IAC7BE,OAAO,EAAEA,OAAQ;IACjBC,OAAO,EAAEA,OAAQ;IACjByC,QAAQ,EAAErD,UAAW;IACrB0B,WAAW,EAAEA,WAAY;IACzB4B,oBAAoB,EAAExC;EAAwB,CAC/C,CAAC;AAEN,CAAC;AAGD,MAAMyC,oBAAoB,GAAG9E,IAAI,CAACU,YAAY,CAAwB;AAEtEoE,oBAAoB,CAACC,WAAW,GAAG,cAAc;AAEjD,SAASD,oBAAoB,IAAIpE,YAAY"}
1
+ {"version":3,"file":"Autocomplete.js","names":["memo","useCallback","useMemo","useRef","Field","ComponentControlledState","useInputValues","getControlState","jsx","_jsx","Autocomplete","_ref","defaultValue","errorMessage","hasMultipleChoices","id","idOverride","inputValue","isCustomValueAllowed","isDisabled","isFullWidth","isLoading","isOptional","isReadOnly","hint","HintLinkComponent","label","name","nameOverride","onBlur","onChange","onChangeProp","onInputChange","onInputChangeProp","onFocus","options","value","getIsOptionEqualToValue","testId","translate","controlledStateRef","controlledValue","uncontrolledValue","defaultValueProp","undefined","valueProps","controlState","current","inputValueProp","CONTROLLED","renderInput","_ref2","InputLabelProps","InputProps","params","fieldType","hasVisibleLabel","htmlFor","renderFieldComponent","_ref3","ariaDescribedBy","errorMessageElementId","labelElementId","_InputBase","inputProps","required","event","reason","details","_Autocomplete","disableCloseOnSelect","disabled","freeSolo","filterSelectedOptions","fullWidth","loading","multiple","readOnly","isOptionEqualToValue","MemoizedAutocomplete","displayName"],"sources":["../src/Autocomplete.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport {\n Autocomplete as MuiAutocomplete,\n AutocompleteProps as MuiAutocompleteProps,\n InputBase,\n UseAutocompleteProps,\n AutocompleteValue,\n} from \"@mui/material\";\nimport { memo, useCallback, useMemo, useRef } from \"react\";\n\nimport { Field } from \"./Field\";\nimport { FieldComponentProps } from \"./FieldComponentProps\";\nimport type { AllowedProps } from \"./AllowedProps\";\nimport {\n ComponentControlledState,\n useInputValues,\n getControlState,\n} from \"./inputUtils\";\n\nexport type AutocompleteProps<\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined\n> = {\n /**\n * The default value. Use when the component is not controlled.\n */\n defaultValue?: UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"defaultValue\"];\n /**\n * Enables multiple choice selection\n */\n hasMultipleChoices?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"multiple\"];\n /**\n * The value for the input\n */\n inputValue?: UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"inputValue\"];\n /**\n * Allows the input of custom values\n */\n isCustomValueAllowed?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"freeSolo\"];\n /**\n * Disables the Autocomplete input\n */\n isDisabled?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"disabled\"];\n /**\n * Displays a loading indicator\n */\n isLoading?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"loading\"];\n /**\n * Makes the Autocomplete input read-only\n */\n isReadOnly?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"readOnly\"];\n /**\n * The label text for the autocomplete input\n */\n label: string;\n /**\n * Callback fired when the autocomplete loses focus.\n */\n onBlur?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onBlur\"];\n /**\n * Callback fired when a selection is made.\n */\n onChange?: UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onChange\"];\n /**\n * Callback fired when the textbox receives typed characters.\n */\n onInputChange?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onInputChange\"];\n /**\n * Callback fired when the autocomplete gains focus.\n */\n onFocus?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onFocus\"];\n /**\n * The options for the Autocomplete input\n */\n options: ReadonlyArray<OptionType>;\n /**\n * The value of the Autocomplete input\n */\n value?: UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"value\"];\n\n /**\n * Used to determine if the option represents the given value. Uses strict equality by default if none provided.\n * Both arguments need to be handled, an option can only match with one value.\n * option: the option to test\n * value: the value to test against\n *\n * You will need to implement this function if your `option` items are objects.\n */\n getIsOptionEqualToValue?: (option: OptionType, value: OptionType) => boolean;\n} & Pick<\n FieldComponentProps,\n | \"errorMessage\"\n | \"hint\"\n | \"HintLinkComponent\"\n | \"id\"\n | \"isFullWidth\"\n | \"isOptional\"\n | \"name\"\n> &\n AllowedProps;\n\nconst Autocomplete = <\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined\n>({\n defaultValue,\n errorMessage,\n hasMultipleChoices,\n id: idOverride,\n inputValue,\n isCustomValueAllowed,\n isDisabled,\n isFullWidth = false,\n isLoading,\n isOptional = false,\n isReadOnly,\n hint,\n HintLinkComponent,\n label,\n name: nameOverride,\n onBlur,\n onChange: onChangeProp,\n onInputChange: onInputChangeProp,\n onFocus,\n options,\n value,\n getIsOptionEqualToValue,\n testId,\n translate,\n}: AutocompleteProps<OptionType, HasMultipleChoices, IsCustomValueAllowed>) => {\n const controlledStateRef = useRef(\n getControlState({ controlledValue: value, uncontrolledValue: defaultValue })\n );\n const defaultValueProp = useMemo<\n | AutocompleteValue<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >\n | undefined\n >(() => {\n if (hasMultipleChoices) {\n if (value === undefined) {\n return defaultValue;\n }\n return [] as AutocompleteValue<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >;\n }\n return value === undefined ? defaultValue : undefined;\n }, [defaultValue, hasMultipleChoices, value]);\n\n const valueProps = useInputValues({\n defaultValue: defaultValueProp,\n value: value,\n controlState: controlledStateRef.current,\n });\n\n const inputValueProp = useMemo(() => {\n if (controlledStateRef.current === ComponentControlledState.CONTROLLED) {\n return { inputValue };\n }\n return undefined;\n }, [inputValue]);\n\n const renderInput = useCallback(\n ({ InputLabelProps, InputProps, ...params }) => (\n <Field\n errorMessage={errorMessage}\n fieldType=\"single\"\n hasVisibleLabel\n id={InputLabelProps.htmlFor}\n hint={hint}\n HintLinkComponent={HintLinkComponent}\n label={label}\n isOptional={isOptional}\n renderFieldComponent={({\n ariaDescribedBy,\n id,\n errorMessageElementId,\n labelElementId,\n }) => (\n <InputBase\n {...params}\n {...InputProps}\n inputProps={{\n ...params.inputProps,\n \"aria-errormessage\": errorMessageElementId,\n \"aria-labelledby\": labelElementId,\n }}\n aria-describedby={ariaDescribedBy}\n id={id}\n name={nameOverride ?? id}\n required={!isOptional}\n />\n )}\n />\n ),\n [errorMessage, hint, HintLinkComponent, isOptional, label, nameOverride]\n );\n const onChange = useCallback<\n NonNullable<\n UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onChange\"]\n >\n >(\n (event, value, reason, details) => {\n onChangeProp?.(event, value, reason, details);\n },\n [onChangeProp]\n );\n\n const onInputChange = useCallback<\n NonNullable<\n UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onInputChange\"]\n >\n >(\n (event, value, reason) => {\n onInputChangeProp?.(event, value, reason);\n },\n [onInputChangeProp]\n );\n\n return (\n <MuiAutocomplete\n {...valueProps}\n {...inputValueProp}\n // 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 fullWidth={isFullWidth}\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 isOptionEqualToValue={getIsOptionEqualToValue}\n translate={translate}\n />\n );\n};\n\n// Need the `typeof Autocomplete` because generics don't get passed through\nconst MemoizedAutocomplete = memo(Autocomplete) as typeof Autocomplete;\n// @ts-expect-error displayName is expected to not be on `typeof Autocomplete`\nMemoizedAutocomplete.displayName = \"Autocomplete\";\n\nexport { MemoizedAutocomplete as Autocomplete };\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AASA,SAASA,IAAI,EAAEC,WAAW,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAAC,SAElDC,KAAK;AAAA,SAIZC,wBAAwB,EACxBC,cAAc,EACdC,eAAe;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAkJjB,MAAMC,YAAY,GAAGC,IAAA,IA6B0D;EAAA,IAzB7E;IACAC,YAAY;IACZC,YAAY;IACZC,kBAAkB;IAClBC,EAAE,EAAEC,UAAU;IACdC,UAAU;IACVC,oBAAoB;IACpBC,UAAU;IACVC,WAAW,GAAG,KAAK;IACnBC,SAAS;IACTC,UAAU,GAAG,KAAK;IAClBC,UAAU;IACVC,IAAI;IACJC,iBAAiB;IACjBC,KAAK;IACLC,IAAI,EAAEC,YAAY;IAClBC,MAAM;IACNC,QAAQ,EAAEC,YAAY;IACtBC,aAAa,EAAEC,iBAAiB;IAChCC,OAAO;IACPC,OAAO;IACPC,KAAK;IACLC,uBAAuB;IACvBC,MAAM;IACNC;EACuE,CAAC,GAAA5B,IAAA;EACxE,MAAM6B,kBAAkB,GAAGrC,MAAM,CAC/BI,eAAe,CAAC;IAAEkC,eAAe,EAAEL,KAAK;IAAEM,iBAAiB,EAAE9B;EAAa,CAAC,CAC7E,CAAC;EACD,MAAM+B,gBAAgB,GAAGzC,OAAO,CAQ9B,MAAM;IACN,IAAIY,kBAAkB,EAAE;MACtB,IAAIsB,KAAK,KAAKQ,SAAS,EAAE;QACvB,OAAOhC,YAAY;MACrB;MACA,OAAO,EAAE;IAMX;IACA,OAAOwB,KAAK,KAAKQ,SAAS,GAAGhC,YAAY,GAAGgC,SAAS;EACvD,CAAC,EAAE,CAAChC,YAAY,EAAEE,kBAAkB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AAoB,CAACC,WAAW,GAAG,cAAc;AAEjD,SAASD,oBAAoB,IAAIrE,YAAY"}
package/dist/Badge.js CHANGED
@@ -33,39 +33,44 @@ const Badge = _ref => {
33
33
  let {
34
34
  badgeContent,
35
35
  badgeContentMax = 999,
36
+ testId,
37
+ translate,
36
38
  type = "default"
37
39
  } = _ref;
38
40
  const odysseyDesignTokens = useOdysseyDesignTokens();
39
- const greaterThanZeroContentMax = badgeContentMax > 0 ? badgeContentMax : 1;
40
- const threeDigitLimitedMax = greaterThanZeroContentMax > 999 ? 999 : greaterThanZeroContentMax;
41
- const isOverContentMax = Boolean(badgeContent && badgeContent > threeDigitLimitedMax);
42
- const overContentMaxMessage = `${greaterThanZeroContentMax}+`;
43
- const formattedContent = isOverContentMax ? overContentMaxMessage : badgeContent;
44
- const contentIsLongerThanOneChar = formattedContent?.toString()?.length > 1;
45
- const badgeStyles = useMemo(() => ({
46
- display: "inline-flex",
47
- alignItems: "center",
48
- justifyContent: "center",
49
- minWidth: `calc(${odysseyDesignTokens.Spacing4} + ${odysseyDesignTokens.Spacing1})`,
50
- height: `calc(${odysseyDesignTokens.Spacing4} + ${odysseyDesignTokens.Spacing1})`,
51
- minHeight: `calc(${odysseyDesignTokens.Spacing4} + ${odysseyDesignTokens.Spacing1})`,
52
- padding: `0 calc(${odysseyDesignTokens.Spacing1} * 1.5)`,
53
- backgroundColor: badgeTypeColors(odysseyDesignTokens)[type].background,
54
- color: badgeTypeColors(odysseyDesignTokens)[type].font,
55
- borderRadius: contentIsLongerThanOneChar ? `${odysseyDesignTokens.BorderRadiusOuter}` : "50%",
56
- fontSize: `${odysseyDesignTokens.TypographyScale0}`,
57
- fontFamily: `${odysseyDesignTokens.TypographyFamilyMono}`,
58
- fontWeight: `${odysseyDesignTokens.TypographyWeightBodyBold}`,
59
- lineHeight: 1
60
- }), [type, contentIsLongerThanOneChar, odysseyDesignTokens]);
61
- const shouldHideBadge = badgeContent <= 0 || !badgeContent;
62
- if (shouldHideBadge) {
63
- return null;
64
- }
65
- return _jsx(Box, {
66
- sx: badgeStyles,
67
- children: formattedContent
68
- });
41
+ const renderBadge = useMemo(() => {
42
+ const greaterThanZeroContentMax = badgeContentMax > 0 ? badgeContentMax : 1;
43
+ const threeDigitLimitedMax = greaterThanZeroContentMax > 999 ? 999 : greaterThanZeroContentMax;
44
+ const isOverContentMax = badgeContent > threeDigitLimitedMax;
45
+ const overContentMaxMessage = `${greaterThanZeroContentMax}+`;
46
+ const formattedContent = isOverContentMax ? overContentMaxMessage : badgeContent.toString();
47
+ const badgeStyles = {
48
+ display: "inline-flex",
49
+ alignItems: "center",
50
+ justifyContent: "center",
51
+ minWidth: `calc(${odysseyDesignTokens.Spacing4} + ${odysseyDesignTokens.Spacing1})`,
52
+ height: `calc(${odysseyDesignTokens.Spacing4} + ${odysseyDesignTokens.Spacing1})`,
53
+ minHeight: `calc(${odysseyDesignTokens.Spacing4} + ${odysseyDesignTokens.Spacing1})`,
54
+ padding: "0 6px",
55
+ backgroundColor: badgeTypeColors(odysseyDesignTokens)[type].background,
56
+ color: badgeTypeColors(odysseyDesignTokens)[type].font,
57
+ borderRadius: formattedContent.length > 1 ? `${odysseyDesignTokens.BorderRadiusOuter}` : "50%",
58
+ fontSize: `${odysseyDesignTokens.TypographyScale0}`,
59
+ fontFamily: `${odysseyDesignTokens.TypographyFamilyMono}`,
60
+ fontWeight: `${odysseyDesignTokens.TypographyWeightBodyBold}`,
61
+ lineHeight: 1,
62
+ transitionDuration: `${odysseyDesignTokens.TransitionDurationMain}`,
63
+ transitionProperty: `background-color, color`
64
+ };
65
+ const hasNotificationCount = badgeContent && badgeContent > 0;
66
+ return hasNotificationCount ? _jsx(Box, {
67
+ sx: badgeStyles,
68
+ "data-se": testId,
69
+ translate: translate,
70
+ children: formattedContent
71
+ }) : null;
72
+ }, [badgeContent, badgeContentMax, odysseyDesignTokens, testId, translate, type]);
73
+ return renderBadge;
69
74
  };
70
75
  const MemoizedBadge = memo(Badge);
71
76
  MemoizedBadge.displayName = "Badge";
package/dist/Badge.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Badge.js","names":["memo","useMemo","useOdysseyDesignTokens","Box","jsx","_jsx","badgeTypeValues","badgeTypeColors","odysseyTokens","default","background","HueNeutral200","font","TypographyColorBody","attention","PalettePrimaryMain","TypographyColorInverse","danger","PaletteDangerMain","Badge","_ref","badgeContent","badgeContentMax","type","odysseyDesignTokens","greaterThanZeroContentMax","threeDigitLimitedMax","isOverContentMax","Boolean","overContentMaxMessage","formattedContent","contentIsLongerThanOneChar","toString","length","badgeStyles","display","alignItems","justifyContent","minWidth","Spacing4","Spacing1","height","minHeight","padding","backgroundColor","color","borderRadius","BorderRadiusOuter","fontSize","TypographyScale0","fontFamily","TypographyFamilyMono","fontWeight","TypographyWeightBodyBold","lineHeight","shouldHideBadge","sx","children","MemoizedBadge","displayName"],"sources":["../src/Badge.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 { CSSProperties, memo, useMemo } from \"react\";\n\nimport {\n useOdysseyDesignTokens,\n DesignTokens,\n} from \"./OdysseyDesignTokensContext\";\nimport { Box } from \"./Box\";\nimport type { SeleniumProps } from \"./SeleniumProps\";\n\nexport const badgeTypeValues = [\"default\", \"attention\", \"danger\"] as const;\n\nexport type BadgeProps = {\n badgeContent: number;\n badgeContentMax?: number;\n type?: (typeof badgeTypeValues)[number];\n} & SeleniumProps;\n\nconst badgeTypeColors = (odysseyTokens: DesignTokens) => ({\n default: {\n background: odysseyTokens.HueNeutral200,\n font: odysseyTokens.TypographyColorBody,\n },\n attention: {\n background: odysseyTokens.PalettePrimaryMain,\n font: odysseyTokens.TypographyColorInverse,\n },\n danger: {\n background: odysseyTokens.PaletteDangerMain,\n font: odysseyTokens.TypographyColorInverse,\n },\n});\n\nconst Badge = ({\n badgeContent,\n badgeContentMax = 999,\n type = \"default\",\n}: BadgeProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n const greaterThanZeroContentMax = badgeContentMax > 0 ? badgeContentMax : 1;\n const threeDigitLimitedMax =\n greaterThanZeroContentMax > 999 ? 999 : greaterThanZeroContentMax;\n const isOverContentMax = Boolean(\n badgeContent && badgeContent > threeDigitLimitedMax\n );\n const overContentMaxMessage = `${greaterThanZeroContentMax}+`;\n const formattedContent = isOverContentMax\n ? overContentMaxMessage\n : badgeContent;\n const contentIsLongerThanOneChar = formattedContent?.toString()?.length > 1;\n\n const badgeStyles = useMemo<CSSProperties>(\n () => ({\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n minWidth: `calc(${odysseyDesignTokens.Spacing4} + ${odysseyDesignTokens.Spacing1})`,\n height: `calc(${odysseyDesignTokens.Spacing4} + ${odysseyDesignTokens.Spacing1})`,\n minHeight: `calc(${odysseyDesignTokens.Spacing4} + ${odysseyDesignTokens.Spacing1})`,\n // 6px horizontal padding per design requirements\n padding: `0 calc(${odysseyDesignTokens.Spacing1} * 1.5)`,\n backgroundColor: badgeTypeColors(odysseyDesignTokens)[type].background,\n color: badgeTypeColors(odysseyDesignTokens)[type].font,\n borderRadius: contentIsLongerThanOneChar\n ? `${odysseyDesignTokens.BorderRadiusOuter}`\n : \"50%\",\n fontSize: `${odysseyDesignTokens.TypographyScale0}`,\n fontFamily: `${odysseyDesignTokens.TypographyFamilyMono}`,\n fontWeight: `${odysseyDesignTokens.TypographyWeightBodyBold}`,\n lineHeight: 1,\n }),\n [type, contentIsLongerThanOneChar, odysseyDesignTokens]\n );\n\n const shouldHideBadge = badgeContent <= 0 || !badgeContent;\n\n if (shouldHideBadge) {\n return null;\n }\n\n return <Box sx={badgeStyles}>{formattedContent}</Box>;\n};\n\nconst MemoizedBadge = memo(Badge);\nMemoizedBadge.displayName = \"Badge\";\n\nexport { MemoizedBadge as Badge };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAwBA,IAAI,EAAEC,OAAO,QAAQ,OAAO;AAAC,SAGnDC,sBAAsB;AAAA,SAGfC,GAAG;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAGZ,OAAO,MAAMC,eAAe,GAAG,CAAC,SAAS,EAAE,WAAW,EAAE,QAAQ,CAAU;AAQ1E,MAAMC,eAAe,GAAIC,aAA2B,KAAM;EACxDC,OAAO,EAAE;IACPC,UAAU,EAAEF,aAAa,CAACG,aAAa;IACvCC,IAAI,EAAEJ,aAAa,CAACK;EACtB,CAAC;EACDC,SAAS,EAAE;IACTJ,UAAU,EAAEF,aAAa,CAACO,kBAAkB;IAC5CH,IAAI,EAAEJ,aAAa,CAACQ;EACtB,CAAC;EACDC,MAAM,EAAE;IACNP,UAAU,EAAEF,aAAa,CAACU,iBAAiB;IAC3CN,IAAI,EAAEJ,aAAa,CAACQ;EACtB;AACF,CAAC,CAAC;AAEF,MAAMG,KAAK,GAAGC,IAAA,IAII;EAAA,IAJH;IACbC,YAAY;IACZC,eAAe,GAAG,GAAG;IACrBC,IAAI,GAAG;EACG,CAAC,GAAAH,IAAA;EACX,MAAMI,mBAAmB,GAAGtB,sBAAsB,CAAC,CAAC;EAEpD,MAAMuB,yBAAyB,GAAGH,eAAe,GAAG,CAAC,GAAGA,eAAe,GAAG,CAAC;EAC3E,MAAMI,oBAAoB,GACxBD,yBAAyB,GAAG,GAAG,GAAG,GAAG,GAAGA,yBAAyB;EACnE,MAAME,gBAAgB,GAAGC,OAAO,CAC9BP,YAAY,IAAIA,YAAY,GAAGK,oBACjC,CAAC;EACD,MAAMG,qBAAqB,GAAI,GAAEJ,yBA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;EAEA,OAAOlD,IAAA,CAACF,GAAG;IAACqD,EAAE,EAAEtB,WAAY;IAAAuB,QAAA,EAAE3B;EAAgB,CAAM,CAAC;AACvD,CAAC;AAED,MAAM4B,aAAa,GAAG1D,IAAI,CAACmB,KAAK,CAAC;AACjCuC,aAAa,CAACC,WAAW,GAAG,OAAO;AAEnC,SAASD,aAAa,IAAIvC,KAAK"}
1
+ {"version":3,"file":"Badge.js","names":["memo","useMemo","useOdysseyDesignTokens","Box","jsx","_jsx","badgeTypeValues","badgeTypeColors","odysseyTokens","default","background","HueNeutral200","font","TypographyColorBody","attention","PalettePrimaryMain","TypographyColorInverse","danger","PaletteDangerMain","Badge","_ref","badgeContent","badgeContentMax","testId","translate","type","odysseyDesignTokens","renderBadge","greaterThanZeroContentMax","threeDigitLimitedMax","isOverContentMax","overContentMaxMessage","formattedContent","toString","badgeStyles","display","alignItems","justifyContent","minWidth","Spacing4","Spacing1","height","minHeight","padding","backgroundColor","color","borderRadius","length","BorderRadiusOuter","fontSize","TypographyScale0","fontFamily","TypographyFamilyMono","fontWeight","TypographyWeightBodyBold","lineHeight","transitionDuration","TransitionDurationMain","transitionProperty","hasNotificationCount","sx","children","MemoizedBadge","displayName"],"sources":["../src/Badge.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 { CSSProperties, memo, useMemo } from \"react\";\n\nimport {\n useOdysseyDesignTokens,\n DesignTokens,\n} from \"./OdysseyDesignTokensContext\";\nimport { Box } from \"./Box\";\nimport type { AllowedProps } from \"./AllowedProps\";\n\nexport const badgeTypeValues = [\"default\", \"attention\", \"danger\"] as const;\n\nexport type BadgeProps = {\n badgeContent: number;\n badgeContentMax?: number;\n type?: (typeof badgeTypeValues)[number];\n} & AllowedProps;\n\nconst badgeTypeColors = (odysseyTokens: DesignTokens) => ({\n default: {\n background: odysseyTokens.HueNeutral200,\n font: odysseyTokens.TypographyColorBody,\n },\n attention: {\n background: odysseyTokens.PalettePrimaryMain,\n font: odysseyTokens.TypographyColorInverse,\n },\n danger: {\n background: odysseyTokens.PaletteDangerMain,\n font: odysseyTokens.TypographyColorInverse,\n },\n});\n\nconst Badge = ({\n badgeContent,\n badgeContentMax = 999,\n testId,\n translate,\n type = \"default\",\n}: BadgeProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n const renderBadge = useMemo(() => {\n const greaterThanZeroContentMax = badgeContentMax > 0 ? badgeContentMax : 1;\n const threeDigitLimitedMax =\n greaterThanZeroContentMax > 999 ? 999 : greaterThanZeroContentMax;\n const isOverContentMax = badgeContent > threeDigitLimitedMax;\n const overContentMaxMessage = `${greaterThanZeroContentMax}+`;\n const formattedContent = isOverContentMax\n ? overContentMaxMessage\n : badgeContent.toString();\n\n const badgeStyles: CSSProperties = {\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n minWidth: `calc(${odysseyDesignTokens.Spacing4} + ${odysseyDesignTokens.Spacing1})`,\n height: `calc(${odysseyDesignTokens.Spacing4} + ${odysseyDesignTokens.Spacing1})`,\n minHeight: `calc(${odysseyDesignTokens.Spacing4} + ${odysseyDesignTokens.Spacing1})`,\n // 6px horizontal padding per design requirements\n padding: \"0 6px\",\n backgroundColor: badgeTypeColors(odysseyDesignTokens)[type].background,\n color: badgeTypeColors(odysseyDesignTokens)[type].font,\n borderRadius:\n formattedContent.length > 1\n ? `${odysseyDesignTokens.BorderRadiusOuter}`\n : \"50%\",\n fontSize: `${odysseyDesignTokens.TypographyScale0}`,\n fontFamily: `${odysseyDesignTokens.TypographyFamilyMono}`,\n fontWeight: `${odysseyDesignTokens.TypographyWeightBodyBold}`,\n lineHeight: 1,\n transitionDuration: `${odysseyDesignTokens.TransitionDurationMain}`,\n transitionProperty: `background-color, color`,\n };\n\n const hasNotificationCount = badgeContent && badgeContent > 0;\n\n return hasNotificationCount ? (\n <Box sx={badgeStyles} data-se={testId} translate={translate}>\n {formattedContent}\n </Box>\n ) : null;\n }, [\n badgeContent,\n badgeContentMax,\n odysseyDesignTokens,\n testId,\n translate,\n type,\n ]);\n\n return renderBadge;\n};\n\nconst MemoizedBadge = memo(Badge);\nMemoizedBadge.displayName = \"Badge\";\n\nexport { MemoizedBadge as Badge };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAwBA,IAAI,EAAEC,OAAO,QAAQ,OAAO;AAAC,SAGnDC,sBAAsB;AAAA,SAGfC,GAAG;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAGZ,OAAO,MAAMC,eAAe,GAAG,CAAC,SAAS,EAAE,WAAW,EAAE,QAAQ,CAAU;AAQ1E,MAAMC,eAAe,GAAIC,aAA2B,KAAM;EACxDC,OAAO,EAAE;IACPC,UAAU,EAAEF,aAAa,CAACG,aAAa;IACvCC,IAAI,EAAEJ,aAAa,CAACK;EACtB,CAAC;EACDC,SAAS,EAAE;IACTJ,UAAU,EAAEF,aAAa,CAACO,kBAAkB;IAC5CH,IAAI,EAAEJ,aAAa,CAACQ;EACtB,CAAC;EACDC,MAAM,EAAE;IACNP,UAAU,EAAEF,aAAa,CAACU,iBAAiB;IAC3CN,IAAI,EAAEJ,aAAa,CAACQ;EACtB;AACF,CAAC,CAAC;AAEF,MAAMG,KAAK,GAAGC,IAAA,IAMI;EAAA,IANH;IACbC,YAAY;IACZC,eAAe,GAAG,GAAG;IACrBC,MAAM;IACNC,SAAS;IACTC,IAAI,GAAG;EACG,CAAC,GAAAL,IAAA;EACX,MAAMM,mBAAmB,GAAGxB,sBAAsB,CAAC,CAA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AAE,CAAC;MACbC,kBAAkB,EAAG,GAAE9B,mBAAmB,CAAC+B,sBAAuB,EAAC;MACnEC,kBAAkB,EAAG;IACvB,CAAC;IAED,MAAMC,oBAAoB,GAAGtC,YAAY,IAAIA,YAAY,GAAG,CAAC;IAE7D,OAAOsC,oBAAoB,GACzBtD,IAAA,CAACF,GAAG;MAACyD,EAAE,EAAE1B,WAAY;MAAC,WAASX,MAAO;MAACC,SAAS,EAAEA,SAAU;MAAAqC,QAAA,EACzD7B;IAAgB,CACd,CAAC,GACJ,IAAI;EACV,CAAC,EAAE,CACDX,YAAY,EACZC,eAAe,EACfI,mBAAmB,EACnBH,MAAM,EACNC,SAAS,EACTC,IAAI,CACL,CAAC;EAEF,OAAOE,WAAW;AACpB,CAAC;AAED,MAAMmC,aAAa,GAAG9D,IAAI,CAACmB,KAAK,CAAC;AACjC2C,aAAa,CAACC,WAAW,GAAG,OAAO;AAEnC,SAASD,aAAa,IAAI3C,KAAK"}
package/dist/Banner.js CHANGED
@@ -27,7 +27,8 @@ const Banner = _ref => {
27
27
  role,
28
28
  severity,
29
29
  text,
30
- testId
30
+ testId,
31
+ translate
31
32
  } = _ref;
32
33
  const {
33
34
  t
@@ -39,12 +40,15 @@ const Banner = _ref => {
39
40
  severity: severity,
40
41
  variant: "banner",
41
42
  children: [_jsxs(ScreenReaderText, {
43
+ translate: translate,
42
44
  children: [t(`severity.${severity}`), ":"]
43
45
  }), _jsx(_AlertTitle, {
46
+ translate: translate,
44
47
  children: text
45
48
  }), linkUrl && _jsx(Link, {
46
49
  href: linkUrl,
47
50
  variant: "monochrome",
51
+ translate: translate,
48
52
  children: linkText
49
53
  })]
50
54
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Banner.js","names":["Link","ScreenReaderText","memo","useTranslation","jsxs","_jsxs","jsx","_jsx","bannerRoleValues","bannerSeverityValues","Banner","_ref","linkUrl","linkText","onClose","role","severity","text","testId","t","_Alert","variant","children","_AlertTitle","href","MemoizedBanner","displayName"],"sources":["../src/Banner.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { Alert, AlertColor, AlertTitle, AlertProps } from \"@mui/material\";\nimport { Link } from \"./Link\";\nimport { ScreenReaderText } from \"./ScreenReaderText\";\nimport { memo } from \"react\";\nimport { useTranslation } from \"react-i18next\";\n\nimport type { SeleniumProps } from \"./SeleniumProps\";\n\nexport const bannerRoleValues = [\"status\", \"alert\"] as const;\nexport const bannerSeverityValues: AlertColor[] = [\n \"success\",\n \"info\",\n \"warning\",\n \"error\",\n];\n\nexport type BannerProps = {\n /**\n * If linkUrl is not undefined, this is the text of the link.\n * If left blank, it defaults to \"Learn more\".\n * Note that linkText does nothing if linkUrl is not defined\n */\n linkText?: string;\n /**\n * If defined, the alert will include a link to the URL\n */\n linkUrl?: string;\n /**\n * The function that's fired when the user clicks the close button. If undefined,\n * the close button will not be shown.\n */\n onClose?: AlertProps[\"onClose\"];\n /**\n * Sets the ARIA role of the alert\n * (\"status\" for something that dynamically updates, \"alert\" for errors, null for something\n * unchanging)\n */\n role?: (typeof bannerRoleValues)[number];\n /**\n * Determine the color and icon of the alert\n */\n severity: (typeof bannerSeverityValues)[number];\n /**\n * The text content of the alert\n */\n text: string;\n} & SeleniumProps;\n\nconst Banner = ({\n linkUrl,\n linkText,\n onClose,\n role,\n severity,\n text,\n testId,\n}: BannerProps) => {\n const { t } = useTranslation();\n\n return (\n <Alert\n data-se={testId}\n onClose={onClose}\n role={role}\n severity={severity}\n variant=\"banner\"\n >\n <ScreenReaderText>{t(`severity.${severity}`)}:</ScreenReaderText>\n <AlertTitle>{text}</AlertTitle>\n {linkUrl && (\n <Link href={linkUrl} variant=\"monochrome\">\n {linkText}\n </Link>\n )}\n </Alert>\n );\n};\n\nconst MemoizedBanner = memo(Banner);\nMemoizedBanner.displayName = \"Banner\";\n\nexport { MemoizedBanner as Banner };\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVA,SAaSA,IAAI;AAAA,SACJC,gBAAgB;AACzB,SAASC,IAAI,QAAQ,OAAO;AAC5B,SAASC,cAAc,QAAQ,eAAe;AAAC,SAAAC,IAAA,IAAAC,KAAA;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAI/C,OAAO,MAAMC,gBAAgB,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAU;AAC5D,OAAO,MAAMC,oBAAkC,GAAG,CAChD,SAAS,EACT,MAAM,EACN,SAAS,EACT,OAAO,CACR;AAkCD,MAAMC,MAAM,GAAGC,IAAA,IAQI;EAAA,IARH;IACdC,OAAO;IACPC,QAAQ;IACRC,OAAO;IACPC,IAAI;IACJC,QAAQ;IACRC,IAAI;IACJC;EACW,CAAC,GAAAP,IAAA;EACZ,MAAM;IAAEQ;EAAE,CAAC,GAAGhB,cAAc,CAAC,CAAC;EAE9B,OACEE,KAAA,CAAAe,MAAA;IACE,WAASF,MAAO;IAChBJ,OAAO,EAAEA,OAAQ;IACjBC,IAAI,EAAEA,IAAK;IACXC,QAAQ,EAAEA,QAAS;IACnBK,OAAO,EAAC,QAAQ;IAAAC,QAAA,GAEhBjB,KAAA,CAACJ,gBAAgB;MAAAqB,QAAA,GAAEH,CAAC,CAAE,YAAWH,QAAS,EAAC,CAAC,EAAC,GAAC;IAAA,CAAkB,CAAC,EACjET,IAAA,CAAAgB,WAAA;MAAAD,QAAA,EAAaL;IAAI,CAAa,CAAC,EAC9BL,OAAO,IACNL,IAAA,CAACP,IAAI;MAACwB,IAAI,EAAEZ,OAAQ;MAACS,OAAO,EAAC,YAAY;MAAAC,QAAA,EACtCT;IAAQ,CACL,CACP;EAAA,CACI,CAAC;AAEZ,CAAC;AAED,MAAMY,cAAc,GAAGvB,IAAI,CAACQ,MAAM,CAAC;AACnCe,cAAc,CAACC,WAAW,GAAG,QAAQ;AAErC,SAASD,cAAc,IAAIf,MAAM"}
1
+ {"version":3,"file":"Banner.js","names":["Link","ScreenReaderText","memo","useTranslation","jsxs","_jsxs","jsx","_jsx","bannerRoleValues","bannerSeverityValues","Banner","_ref","linkUrl","linkText","onClose","role","severity","text","testId","translate","t","_Alert","variant","children","_AlertTitle","href","MemoizedBanner","displayName"],"sources":["../src/Banner.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { Alert, AlertColor, AlertTitle, AlertProps } from \"@mui/material\";\nimport { Link } from \"./Link\";\nimport { ScreenReaderText } from \"./ScreenReaderText\";\nimport { memo } from \"react\";\nimport { useTranslation } from \"react-i18next\";\n\nimport type { AllowedProps } from \"./AllowedProps\";\n\nexport const bannerRoleValues = [\"status\", \"alert\"] as const;\nexport const bannerSeverityValues: AlertColor[] = [\n \"success\",\n \"info\",\n \"warning\",\n \"error\",\n];\n\nexport type BannerProps = {\n /**\n * If linkUrl is not undefined, this is the text of the link.\n * If left blank, it defaults to \"Learn more\".\n * Note that linkText does nothing if linkUrl is not defined\n */\n linkText?: string;\n /**\n * If defined, the alert will include a link to the URL\n */\n linkUrl?: string;\n /**\n * The function that's fired when the user clicks the close button. If undefined,\n * the close button will not be shown.\n */\n onClose?: AlertProps[\"onClose\"];\n /**\n * Sets the ARIA role of the alert\n * (\"status\" for something that dynamically updates, \"alert\" for errors, null for something\n * unchanging)\n */\n role?: (typeof bannerRoleValues)[number];\n /**\n * Determine the color and icon of the alert\n */\n severity: (typeof bannerSeverityValues)[number];\n /**\n * The text content of the alert\n */\n text: string;\n} & AllowedProps;\n\nconst Banner = ({\n linkUrl,\n linkText,\n onClose,\n role,\n severity,\n text,\n testId,\n translate,\n}: BannerProps) => {\n const { t } = useTranslation();\n\n return (\n <Alert\n data-se={testId}\n onClose={onClose}\n role={role}\n severity={severity}\n variant=\"banner\"\n >\n <ScreenReaderText translate={translate}>\n {t(`severity.${severity}`)}:\n </ScreenReaderText>\n <AlertTitle translate={translate}>{text}</AlertTitle>\n {linkUrl && (\n <Link href={linkUrl} variant=\"monochrome\" translate={translate}>\n {linkText}\n </Link>\n )}\n </Alert>\n );\n};\n\nconst MemoizedBanner = memo(Banner);\nMemoizedBanner.displayName = \"Banner\";\n\nexport { MemoizedBanner as Banner };\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVA,SAaSA,IAAI;AAAA,SACJC,gBAAgB;AACzB,SAASC,IAAI,QAAQ,OAAO;AAC5B,SAASC,cAAc,QAAQ,eAAe;AAAC,SAAAC,IAAA,IAAAC,KAAA;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAI/C,OAAO,MAAMC,gBAAgB,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAU;AAC5D,OAAO,MAAMC,oBAAkC,GAAG,CAChD,SAAS,EACT,MAAM,EACN,SAAS,EACT,OAAO,CACR;AAkCD,MAAMC,MAAM,GAAGC,IAAA,IASI;EAAA,IATH;IACdC,OAAO;IACPC,QAAQ;IACRC,OAAO;IACPC,IAAI;IACJC,QAAQ;IACRC,IAAI;IACJC,MAAM;IACNC;EACW,CAAC,GAAAR,IAAA;EACZ,MAAM;IAAES;EAAE,CAAC,GAAGjB,cAAc,CAAC,CAAC;EAE9B,OACEE,KAAA,CAAAgB,MAAA;IACE,WAASH,MAAO;IAChBJ,OAAO,EAAEA,OAAQ;IACjBC,IAAI,EAAEA,IAAK;IACXC,QAAQ,EAAEA,QAAS;IACnBM,OAAO,EAAC,QAAQ;IAAAC,QAAA,GAEhBlB,KAAA,CAACJ,gBAAgB;MAACkB,SAAS,EAAEA,SAAU;MAAAI,QAAA,GACpCH,CAAC,CAAE,YAAWJ,QAAS,EAAC,CAAC,EAAC,GAC7B;IAAA,CAAkB,CAAC,EACnBT,IAAA,CAAAiB,WAAA;MAAYL,SAAS,EAAEA,SAAU;MAAAI,QAAA,EAAEN;IAAI,CAAa,CAAC,EACpDL,OAAO,IACNL,IAAA,CAACP,IAAI;MAACyB,IAAI,EAAEb,OAAQ;MAACU,OAAO,EAAC,YAAY;MAACH,SAAS,EAAEA,SAAU;MAAAI,QAAA,EAC5DV;IAAQ,CACL,CACP;EAAA,CACI,CAAC;AAEZ,CAAC;AAED,MAAMa,cAAc,GAAGxB,IAAI,CAACQ,MAAM,CAAC;AACnCgB,cAAc,CAACC,WAAW,GAAG,QAAQ;AAErC,SAASD,cAAc,IAAIhB,MAAM"}
package/dist/Box.js CHANGED
@@ -18,7 +18,8 @@ const Box = forwardRef((_ref, ref) => {
18
18
  component,
19
19
  id,
20
20
  sx,
21
- testId
21
+ testId,
22
+ translate
22
23
  } = _ref;
23
24
  return _jsx(_Box, {
24
25
  ref: ref,
@@ -26,7 +27,8 @@ const Box = forwardRef((_ref, ref) => {
26
27
  component: component,
27
28
  "data-se": testId,
28
29
  id: id,
29
- sx: sx
30
+ sx: sx,
31
+ translate: translate
30
32
  });
31
33
  });
32
34
  const MemoizedBox = memo(Box);
package/dist/Box.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Box.js","names":["forwardRef","memo","jsx","_jsx","Box","_ref","ref","children","component","id","sx","testId","_Box","MemoizedBox","displayName"],"sources":["../src/Box.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 { Box as MuiBox, BoxProps as MuiBoxProps } from \"@mui/material\";\nimport { ReactNode, forwardRef, memo } from \"react\";\n\nimport type { SeleniumProps } from \"./SeleniumProps\";\n\nexport type BoxProps = {\n children?: ReactNode;\n component?: MuiBoxProps[\"component\"];\n id?: MuiBoxProps[\"id\"];\n sx?: MuiBoxProps[\"sx\"];\n} & SeleniumProps;\n\nconst Box = forwardRef<HTMLElement, BoxProps>(\n ({ children, component, id, sx, testId }, ref) => (\n <MuiBox\n ref={ref}\n children={children}\n component={component}\n data-se={testId}\n id={id}\n sx={sx}\n />\n )\n);\n\nconst MemoizedBox = memo(Box);\nMemoizedBox.displayName = \"Box\";\n\nexport { MemoizedBox as Box };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,SAAoBA,UAAU,EAAEC,IAAI,QAAQ,OAAO;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAWpD,MAAMC,GAAG,GAAGJ,UAAU,CACpB,CAAAK,IAAA,EAA0CC,GAAG;EAAA,IAA5C;IAAEC,QAAQ;IAAEC,SAAS;IAAEC,EAAE;IAAEC,EAAE;IAAEC;EAAO,CAAC,GAAAN,IAAA;EAAA,OACtCF,IAAA,CAAAS,IAAA;IACEN,GAAG,EAAEA,GAAI;IACTC,QAAQ,EAAEA,QAAS;IACnBC,SAAS,EAAEA,SAAU;IACrB,WAASG,MAAO;IAChBF,EAAE,EAAEA,EAAG;IACPC,EAAE,EAAEA;EAAG,CACR,CAAC;AAAA,CAEN,CAAC;AAED,MAAMG,WAAW,GAAGZ,IAAI,CAACG,GAAG,CAAC;AAC7BS,WAAW,CAACC,WAAW,GAAG,KAAK;AAE/B,SAASD,WAAW,IAAIT,GAAG"}
1
+ {"version":3,"file":"Box.js","names":["forwardRef","memo","jsx","_jsx","Box","_ref","ref","children","component","id","sx","testId","translate","_Box","MemoizedBox","displayName"],"sources":["../src/Box.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 { Box as MuiBox, BoxProps as MuiBoxProps } from \"@mui/material\";\nimport { ReactNode, forwardRef, memo } from \"react\";\n\nimport type { AllowedProps } from \"./AllowedProps\";\n\nexport type BoxProps = {\n children?: ReactNode;\n component?: MuiBoxProps[\"component\"];\n id?: MuiBoxProps[\"id\"];\n sx?: MuiBoxProps[\"sx\"];\n} & AllowedProps;\n\nconst Box = forwardRef<HTMLElement, BoxProps>(\n ({ children, component, id, sx, testId, translate }, ref) => (\n <MuiBox\n ref={ref}\n children={children}\n component={component}\n data-se={testId}\n id={id}\n sx={sx}\n translate={translate}\n />\n )\n);\n\nconst MemoizedBox = memo(Box);\nMemoizedBox.displayName = \"Box\";\n\nexport { MemoizedBox as Box };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,SAAoBA,UAAU,EAAEC,IAAI,QAAQ,OAAO;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAWpD,MAAMC,GAAG,GAAGJ,UAAU,CACpB,CAAAK,IAAA,EAAqDC,GAAG;EAAA,IAAvD;IAAEC,QAAQ;IAAEC,SAAS;IAAEC,EAAE;IAAEC,EAAE;IAAEC,MAAM;IAAEC;EAAU,CAAC,GAAAP,IAAA;EAAA,OACjDF,IAAA,CAAAU,IAAA;IACEP,GAAG,EAAEA,GAAI;IACTC,QAAQ,EAAEA,QAAS;IACnBC,SAAS,EAAEA,SAAU;IACrB,WAASG,MAAO;IAChBF,EAAE,EAAEA,EAAG;IACPC,EAAE,EAAEA,EAAG;IACPE,SAAS,EAAEA;EAAU,CACtB,CAAC;AAAA,CAEN,CAAC;AAED,MAAME,WAAW,GAAGb,IAAI,CAACG,GAAG,CAAC;AAC7BU,WAAW,CAACC,WAAW,GAAG,KAAK;AAE/B,SAASD,WAAW,IAAIV,GAAG"}
@@ -68,7 +68,9 @@ const BreadcrumbList = _ref2 => {
68
68
  let {
69
69
  children,
70
70
  homeHref,
71
- maxVisibleItems = defaultTruncationValue
71
+ maxVisibleItems = defaultTruncationValue,
72
+ testId,
73
+ translate
72
74
  } = _ref2;
73
75
  const {
74
76
  t
@@ -98,6 +100,8 @@ const BreadcrumbList = _ref2 => {
98
100
  return _jsxs(_Breadcrumbs, {
99
101
  maxItems: children.length + 1,
100
102
  "aria-label": t("breadcrumbs.label.text"),
103
+ "data-se": testId,
104
+ translate: translate,
101
105
  children: [homeHref && _jsx(_ButtonBase, {
102
106
  href: homeHref,
103
107
  "aria-label": t("breadcrumbs.home.text"),
@@ -1 +1 @@
1
- {"version":3,"file":"Breadcrumbs.js","names":["createContext","memo","useCallback","useContext","useMemo","useState","GroupIcon","HomeIcon","UserIcon","Subordinate","useTranslation","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","BreadcrumbContext","breadcrumbType","Breadcrumb","_ref","children","href","iconName","breadcrumbContent","_MenuItem","color","_ButtonBase","breadcrumbProviderValue","currentPage","listItem","menuItem","defaultTruncationValue","BreadcrumbList","_ref2","homeHref","maxVisibleItems","t","anchorEl","setAnchorEl","breadcrumbSections","length","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 { Subordinate } 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 <Subordinate color=\"textPrimary\">{breadcrumbContent}</Subordinate>;\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 defaultTruncationValue = 5;\n\nconst BreadcrumbList = ({\n children,\n homeHref,\n maxVisibleItems = defaultTruncationValue,\n}: BreadcrumbsProps) => {\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,WAAW;AACpB,SAASC,cAAc,QAAQ,eAAe;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAoB/C,OAAO,MAAMC,iBAAiB,GAAGj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C,QAAQ;QAACC,KAAK,EAAE/B,uBAAuB,CAACE,QAAS;QAAAT,QAAA,EACjEoC;MAAU,CACe,CAAC;IAEjC,CAAC,CAAC;EAAA,CACY,CAAC;AAErB,CAAC;AAED,MAAMe,sBAAsB,GAAGvE,IAAI,CAACgC,cAAc,CAAC;AACnDuC,sBAAsB,CAACC,WAAW,GAAG,gBAAgB;AAErD,SAASD,sBAAsB,IAAIvC,cAAc"}
1
+ {"version":3,"file":"Breadcrumbs.js","names":["createContext","memo","useCallback","useContext","useMemo","useState","GroupIcon","HomeIcon","UserIcon","Subordinate","useTranslation","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","BreadcrumbContext","breadcrumbType","Breadcrumb","_ref","children","href","iconName","breadcrumbContent","_MenuItem","color","_ButtonBase","breadcrumbProviderValue","currentPage","listItem","menuItem","defaultTruncationValue","BreadcrumbList","_ref2","homeHref","maxVisibleItems","testId","translate","t","anchorEl","setAnchorEl","breadcrumbSections","length","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 { Subordinate } from \"./Typography\";\nimport { useTranslation } from \"react-i18next\";\nimport { AllowedProps } from \"./AllowedProps\";\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} & AllowedProps;\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 <Subordinate color=\"textPrimary\">{breadcrumbContent}</Subordinate>;\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 defaultTruncationValue = 5;\n\nconst BreadcrumbList = ({\n children,\n homeHref,\n maxVisibleItems = defaultTruncationValue,\n testId,\n translate,\n}: BreadcrumbsProps) => {\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 data-se={testId}\n translate={translate}\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,WAAW;AACpB,SAASC,cAAc,QAAQ,eAAe;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAqB/C,OAAO,MAAMC,iBAAiB,GAAGjB,aAAa,CAAwB;EACpEkB,cAAc,EAAE;AAClB,CAAC,CAAC;AAEF,OAAO,MAAMC,UAAU,GAAGC,IAAA,IAAmD;EAAA,IAAlD;IAAEC,QAAQ;IAAEC,IAAI;IAAEC;EAA0B,CAAC,GAAAH,IAAA;EACtE,MAAM;IAAEF;EAAe,CAAC,GAAGf,UAAU,CAACc,iBAAiB,CAAC;EAExD,MAAMO,iBAAiB,GACrBR,KAAA,CAAAF,SAAA;IAAAO,QAAA,GACGE,QAAQ,KAAK,OAAO,GACnBX,IAAA,CAACN,SAAS,IAAE,CAAC,GACXiB,QAAQ,KAAK,MAAM,GACrBX,IAAA,CAACJ,QAAQ,IAAE,CAAC,GACV,IAAI,EACPa,QAAQ;EAAA,CACT,CACH;EAED,IAAIH,cAAc,KAAK,UAAU,EAAE;IACjC,OAAON,IAAA,CAAAa,SAAA;MAA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QACEC,IAAI,EAAEC,OAAO,CAACzB,QAAQ,CAAE;QACxB0B,OAAO,EAAEX,WAAY;QACrBf,QAAQ,EAAEA,QAAS;QACnB2B,YAAY,EAAE;UAAEC,UAAU,EAAE,MAAM;UAAEC,QAAQ,EAAE;QAAS,CAAE;QACzDC,aAAa,EAAE;UACbC,EAAE,EAAE;YACFC,QAAQ,EAAE;UACZ;QACF,CAAE;QAAAnD,QAAA,EAEFT,IAAA,CAACK,iBAAiB,CAAC2C,QAAQ;UACzBC,KAAK,EAAEjC,uBAAuB,CAACG,QAAS;UAAAV,QAAA,EAEvCqB,kBAAkB,CAACG;QAAU,CACJ;MAAC,CACzB,CAAC;IAAA,CACP,CACH,EAEAH,kBAAkB,CAACI,oBAAoB,CAACY,GAAG,CAAC,CAACC,UAAU,EAAEc,CAAC,KAAK;MAC9D,IAAIA,CAAC,KAAK/B,kBAAkB,CAACI,oBAAoB,CAACH,MAAM,GAAG,CAAC,EAAE;QAC5D,OACE/B,IAAA,CAACK,iBAAiB,CAAC2C,QAAQ;UACzBC,KAAK,EAAEjC,uBAAuB,CAACC,WAAY;UAAAR,QAAA,EAE1CsC;QAAU,CACe,CAAC;MAEjC;MACA,OACE/C,IAAA,CAACK,iBAAiB,CAAC2C,QAAQ;QAACC,KAAK,EAAEjC,uBAAuB,CAACE,QAAS;QAAAT,QAAA,EACjEsC;MAAU,CACe,CAAC;IAEjC,CAAC,CAAC;EAAA,CACY,CAAC;AAErB,CAAC;AAED,MAAMe,sBAAsB,GAAGzE,IAAI,CAACgC,cAAc,CAAC;AACnDyC,sBAAsB,CAACC,WAAW,GAAG,gBAAgB;AAErD,SAASD,sBAAsB,IAAIzC,cAAc"}
package/dist/Button.js CHANGED
@@ -35,6 +35,7 @@ const Button = _ref => {
35
35
  startIcon,
36
36
  testId,
37
37
  tooltipText,
38
+ translate,
38
39
  type = "button",
39
40
  variant
40
41
  } = _ref;
@@ -62,10 +63,11 @@ const Button = _ref => {
62
63
  ref: ref,
63
64
  size: size,
64
65
  startIcon: startIcon,
66
+ translate: translate,
65
67
  type: type,
66
68
  variant: variant,
67
69
  children: label
68
- }), [ariaDescribedBy, ariaLabel, ariaLabelledBy, endIcon, id, isDisabled, isFullWidth, label, onClick, size, startIcon, testId, type, variant]);
70
+ }), [ariaDescribedBy, ariaLabel, ariaLabelledBy, endIcon, id, isDisabled, isFullWidth, label, onClick, size, startIcon, testId, translate, type, variant]);
69
71
  return _jsxs(_Fragment, {
70
72
  children: [tooltipText && !isDisabled && _jsx(Tooltip, {
71
73
  ariaType: "description",
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","names":["memo","useCallback","useImperativeHandle","useRef","MuiPropsContext","useMuiProps","Tooltip","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","buttonSizeValues","buttonTypeValues","buttonVariantValues","Button","_ref","ariaDescribedBy","ariaLabel","ariaLabelledBy","buttonFocusRef","endIcon","id","isDisabled","isFullWidth","label","onClick","size","startIcon","testId","tooltipText","type","variant","muiProps","ref","element","current","focus","renderButton","_Button","disabled","fullWidth","children","ariaType","placement","text","Consumer","MemoizedButton","displayName"],"sources":["../src/Button.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { Button as MuiButton } from \"@mui/material\";\nimport type { ButtonProps as MuiButtonProps } from \"@mui/material\";\nimport {\n memo,\n ReactElement,\n useCallback,\n useImperativeHandle,\n useRef,\n} from \"react\";\n\nimport { MuiPropsContext, useMuiProps } from \"./MuiPropsContext\";\nimport { Tooltip } from \"./Tooltip\";\nimport type { SeleniumProps } from \"./SeleniumProps\";\nimport { FocusHandle } from \"./@types/react-augment\";\n\nexport const buttonSizeValues = [\"small\", \"medium\", \"large\"] as const;\nexport const buttonTypeValues = [\"button\", \"submit\", \"reset\"] as const;\nexport const buttonVariantValues = [\n \"primary\",\n \"secondary\",\n \"tertiary\",\n \"danger\",\n \"floating\",\n] as const;\n\nexport type ButtonProps = {\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 ref forwarded to the Button to expose focus()\n */\n buttonFocusRef?: React.RefObject<FocusHandle>;\n /**\n * The icon element to display at the end of the Button\n */\n endIcon?: ReactElement;\n /**\n * The ID of the Button\n */\n id?: string;\n /**\n * Determines whether the Button is disabled\n */\n isDisabled?: boolean;\n /**\n * Determines whether the Button should take up the full available width\n */\n isFullWidth?: boolean;\n /**\n * The text content of the Button\n */\n label?: string;\n /**\n * The click event handler for the Button\n */\n onClick?: MuiButtonProps[\"onClick\"];\n /**\n * The size of the button\n */\n size?: (typeof buttonSizeValues)[number];\n /**\n * The icon element to display at the start of the Button\n */\n startIcon?: ReactElement;\n /**\n * The tooltip text for the Button if it's icon-only\n */\n tooltipText?: string;\n /**\n * The type of the HTML button element\n */\n type?: (typeof buttonTypeValues)[number];\n /**\n * The variant of the Button\n */\n variant: (typeof buttonVariantValues)[number];\n} & (\n | {\n endIcon?: ReactElement;\n label: string;\n startIcon?: ReactElement;\n }\n | {\n endIcon?: ReactElement;\n label?: \"\" | undefined;\n startIcon: ReactElement;\n }\n | {\n endIcon: ReactElement;\n label?: \"\" | undefined;\n startIcon?: ReactElement;\n }\n) &\n SeleniumProps;\n\nconst Button = ({\n ariaDescribedBy,\n ariaLabel,\n ariaLabelledBy,\n buttonFocusRef,\n endIcon,\n id,\n isDisabled,\n isFullWidth,\n label = \"\",\n onClick,\n size = \"medium\",\n startIcon,\n testId,\n tooltipText,\n type = \"button\",\n variant,\n}: ButtonProps) => {\n const muiProps = useMuiProps();\n\n const ref = useRef<HTMLButtonElement>(null);\n useImperativeHandle(\n buttonFocusRef,\n () => {\n const element = ref.current;\n return {\n focus: () => {\n element && element.focus();\n },\n };\n },\n []\n );\n\n const renderButton = useCallback(\n (muiProps) => (\n <MuiButton\n {...muiProps}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n data-se={testId}\n disabled={isDisabled}\n endIcon={endIcon}\n fullWidth={isFullWidth}\n id={id}\n onClick={onClick}\n ref={ref}\n size={size}\n startIcon={startIcon}\n type={type}\n variant={variant}\n >\n {label}\n </MuiButton>\n ),\n [\n ariaDescribedBy,\n ariaLabel,\n ariaLabelledBy,\n endIcon,\n id,\n isDisabled,\n isFullWidth,\n label,\n onClick,\n size,\n startIcon,\n testId,\n type,\n variant,\n ]\n );\n\n return (\n <>\n {tooltipText && !isDisabled && (\n <Tooltip ariaType=\"description\" placement=\"top\" text={tooltipText}>\n <MuiPropsContext.Consumer>{renderButton}</MuiPropsContext.Consumer>\n </Tooltip>\n )}\n\n {(isDisabled || !tooltipText) && renderButton(muiProps)}\n </>\n );\n};\n\nconst MemoizedButton = memo(Button);\nMemoizedButton.displayName = \"Button\";\n\nexport { MemoizedButton as Button };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA,SACEA,IAAI,EAEJC,WAAW,EACXC,mBAAmB,EACnBC,MAAM,QACD,OAAO;AAAC,SAENC,eAAe,EAAEC,WAAW;AAAA,SAC5BC,OAAO;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAIhB,OAAO,MAAMC,gBAAgB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAU;AACrE,OAAO,MAAMC,gBAAgB,GAAG,CAAC,QAA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;EAAK,CACG,CACZ,EACD,CACER,eAAe,EACfC,SAAS,EACTC,cAAc,EACdE,OAAO,EACPC,EAAE,EACFC,UAAU,EACVC,WAAW,EACXC,KAAK,EACLC,OAAO,EACPC,IAAI,EACJC,SAAS,EACTC,MAAM,EACNE,IAAI,EACJC,OAAO,CAEX,CAAC;EAED,OACErB,KAAA,CAAAF,SAAA;IAAAiC,QAAA,GACGZ,WAAW,IAAI,CAACP,UAAU,IACzBhB,IAAA,CAACF,OAAO;MAACsC,QAAQ,EAAC,aAAa;MAACC,SAAS,EAAC,KAAK;MAACC,IAAI,EAAEf,WAAY;MAAAY,QAAA,EAChEnC,IAAA,CAACJ,eAAe,CAAC2C,QAAQ;QAAAJ,QAAA,EAAEJ;MAAY,CAA2B;IAAC,CAC5D,CACV,EAEA,CAACf,UAAU,IAAI,CAACO,WAAW,KAAKQ,YAAY,CAACL,QAAQ,CAAC;EAAA,CACvD,CAAC;AAEP,CAAC;AAED,MAAMc,cAAc,GAAGhD,IAAI,CAACgB,MAAM,CAAC;AACnCgC,cAAc,CAACC,WAAW,GAAG,QAAQ;AAErC,SAASD,cAAc,IAAIhC,MAAM"}
1
+ {"version":3,"file":"Button.js","names":["memo","useCallback","useImperativeHandle","useRef","MuiPropsContext","useMuiProps","Tooltip","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","buttonSizeValues","buttonTypeValues","buttonVariantValues","Button","_ref","ariaDescribedBy","ariaLabel","ariaLabelledBy","buttonFocusRef","endIcon","id","isDisabled","isFullWidth","label","onClick","size","startIcon","testId","tooltipText","translate","type","variant","muiProps","ref","element","current","focus","renderButton","_Button","disabled","fullWidth","children","ariaType","placement","text","Consumer","MemoizedButton","displayName"],"sources":["../src/Button.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { Button as MuiButton } from \"@mui/material\";\nimport type { ButtonProps as MuiButtonProps } from \"@mui/material\";\nimport {\n memo,\n ReactElement,\n useCallback,\n useImperativeHandle,\n useRef,\n} from \"react\";\n\nimport { MuiPropsContext, useMuiProps } from \"./MuiPropsContext\";\nimport { Tooltip } from \"./Tooltip\";\nimport type { AllowedProps } from \"./AllowedProps\";\nimport { FocusHandle } from \"./@types/react-augment\";\n\nexport const buttonSizeValues = [\"small\", \"medium\", \"large\"] as const;\nexport const buttonTypeValues = [\"button\", \"submit\", \"reset\"] as const;\nexport const buttonVariantValues = [\n \"primary\",\n \"secondary\",\n \"tertiary\",\n \"danger\",\n \"floating\",\n] as const;\n\nexport type ButtonProps = {\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 ref forwarded to the Button to expose focus()\n */\n buttonFocusRef?: React.RefObject<FocusHandle>;\n /**\n * The icon element to display at the end of the Button\n */\n endIcon?: ReactElement;\n /**\n * The ID of the Button\n */\n id?: string;\n /**\n * Determines whether the Button is disabled\n */\n isDisabled?: boolean;\n /**\n * Determines whether the Button should take up the full available width\n */\n isFullWidth?: boolean;\n /**\n * The text content of the Button\n */\n label?: string;\n /**\n * The click event handler for the Button\n */\n onClick?: MuiButtonProps[\"onClick\"];\n /**\n * The size of the button\n */\n size?: (typeof buttonSizeValues)[number];\n /**\n * The icon element to display at the start of the Button\n */\n startIcon?: ReactElement;\n /**\n * The tooltip text for the Button if it's icon-only\n */\n tooltipText?: string;\n /**\n * The type of the HTML button element\n */\n type?: (typeof buttonTypeValues)[number];\n /**\n * The variant of the Button\n */\n variant: (typeof buttonVariantValues)[number];\n} & (\n | {\n endIcon?: ReactElement;\n label: string;\n startIcon?: ReactElement;\n }\n | {\n endIcon?: ReactElement;\n label?: \"\" | undefined;\n startIcon: ReactElement;\n }\n | {\n endIcon: ReactElement;\n label?: \"\" | undefined;\n startIcon?: ReactElement;\n }\n) &\n AllowedProps;\n\nconst Button = ({\n ariaDescribedBy,\n ariaLabel,\n ariaLabelledBy,\n buttonFocusRef,\n endIcon,\n id,\n isDisabled,\n isFullWidth,\n label = \"\",\n onClick,\n size = \"medium\",\n startIcon,\n testId,\n tooltipText,\n translate,\n type = \"button\",\n variant,\n}: ButtonProps) => {\n const muiProps = useMuiProps();\n\n const ref = useRef<HTMLButtonElement>(null);\n useImperativeHandle(\n buttonFocusRef,\n () => {\n const element = ref.current;\n return {\n focus: () => {\n element && element.focus();\n },\n };\n },\n []\n );\n\n const renderButton = useCallback(\n (muiProps) => (\n <MuiButton\n {...muiProps}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n data-se={testId}\n disabled={isDisabled}\n endIcon={endIcon}\n fullWidth={isFullWidth}\n id={id}\n onClick={onClick}\n ref={ref}\n size={size}\n startIcon={startIcon}\n translate={translate}\n type={type}\n variant={variant}\n >\n {label}\n </MuiButton>\n ),\n [\n ariaDescribedBy,\n ariaLabel,\n ariaLabelledBy,\n endIcon,\n id,\n isDisabled,\n isFullWidth,\n label,\n onClick,\n size,\n startIcon,\n testId,\n translate,\n type,\n variant,\n ]\n );\n\n return (\n <>\n {tooltipText && !isDisabled && (\n <Tooltip ariaType=\"description\" placement=\"top\" text={tooltipText}>\n <MuiPropsContext.Consumer>{renderButton}</MuiPropsContext.Consumer>\n </Tooltip>\n )}\n\n {(isDisabled || !tooltipText) && renderButton(muiProps)}\n </>\n );\n};\n\nconst MemoizedButton = memo(Button);\nMemoizedButton.displayName = \"Button\";\n\nexport { MemoizedButton as Button };\n"],"mappings":";AAAA;AACA;AACA;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- title
29
+ title,
30
+ translate
30
31
  } = _ref;
31
32
  const {
32
33
  t
@@ -37,8 +38,10 @@ const Callout = _ref => {
37
38
  severity: severity,
38
39
  variant: "callout",
39
40
  children: [_jsx(ScreenReaderText, {
41
+ translate: translate,
40
42
  children: t(`severity.${severity}`)
41
43
  }), title && _jsx(_AlertTitle, {
44
+ translate: translate,
42
45
  children: title
43
46
  }), _jsx(_Box, {
44
47
  component: "div",
@@ -1 +1 @@
1
- {"version":3,"file":"Callout.js","names":["memo","ScreenReaderText","useTranslation","jsx","_jsx","jsxs","_jsxs","calloutRoleValues","calloutSeverityValues","Callout","_ref","children","role","severity","testId","title","t","_Alert","variant","_AlertTitle","_Box","component","MemoizedCallout","displayName"],"sources":["../src/Callout.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { memo, ReactNode } from \"react\";\nimport { Alert, AlertTitle, Box } from \"@mui/material\";\nimport { ScreenReaderText } from \"./ScreenReaderText\";\nimport { useTranslation } from \"react-i18next\";\n\nimport type { SeleniumProps } from \"./SeleniumProps\";\n\nexport const calloutRoleValues = [\"status\", \"alert\"] as const;\nexport const calloutSeverityValues = [\n \"success\",\n \"info\",\n \"warning\",\n \"error\",\n] as const;\n\nexport type CalloutProps = {\n /**\n * The contents of the Callout\n */\n children: ReactNode;\n /**\n * Sets the ARIA role of the Callout\n * (\"status\" for something that dynamically updates, \"alert\" for errors, null for something\n * unchanging)\n */\n role?: (typeof calloutRoleValues)[number];\n /**\n * Determine the color and icon of the Callout\n */\n severity: (typeof calloutSeverityValues)[number];\n /**\n * The title of the Callout\n */\n title?: string;\n} & SeleniumProps;\n\nconst Callout = ({ children, role, severity, testId, title }: CalloutProps) => {\n const { t } = useTranslation();\n\n return (\n <Alert data-se={testId} role={role} severity={severity} variant=\"callout\">\n <ScreenReaderText>{t(`severity.${severity}`)}</ScreenReaderText>\n {title && <AlertTitle>{title}</AlertTitle>}\n <Box component=\"div\">{children}</Box>\n </Alert>\n );\n};\n\nconst MemoizedCallout = memo(Callout);\nMemoizedCallout.displayName = \"Callout\";\n\nexport { MemoizedCallout as Callout };\n"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,QAAmB,OAAO;AAAC,SAE/BC,gBAAgB;AACzB,SAASC,cAAc,QAAQ,eAAe;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAI/C,OAAO,MAAMC,iBAAiB,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAU;AAC7D,OAAO,MAAMC,qBAAqB,GAAG,CACnC,SAAS,EACT,MAAM,EACN,SAAS,EACT,OAAO,CACC;AAuBV,MAAMC,OAAO,GAAGC,IAAA,IAA+D;EAAA,IAA9D;IAAEC,QAAQ;IAAEC,IAAI;IAAEC,QAAQ;IAAEC,MAAM;IAAEC;EAAoB,CAAC,GAAAL,IAAA;EACxE,MAAM;IAAEM;EAAE,CAAC,GAAGd,cAAc,CAAC,CAAC;EAE9B,OACEI,KAAA,CAAAW,MAAA;IAAO,WAASH,MAAO;IAACF,IAAI,EAAEA,IAAK;IAACC,QAAQ,EAAEA,QAAS;IAACK,OAAO,EAAC,SAAS;IAAAP,QAAA,GACvEP,IAAA,CAACH,gBAAgB;MAAAU,QAAA,EAAEK,CAAC,CAAE,YAAWH,QAAS,EAAC;IAAC,CAAmB,CAAC,EAC/DE,KAAK,IAAIX,IAAA,CAAAe,WAAA;MAAAR,QAAA,EAAaI;IAAK,CAAa,CAAC,EAC1CX,IAAA,CAAAgB,IAAA;MAAKC,SAAS,EAAC,KAAK;MAAAV,QAAA,EAAEA;IAAQ,CAAM,CAAC;EAAA,CAChC,CAAC;AAEZ,CAAC;AAED,MAAMW,eAAe,GAAGtB,IAAI,CAACS,OAAO,CAAC;AACrCa,eAAe,CAACC,WAAW,GAAG,SAAS;AAEvC,SAASD,eAAe,IAAIb,OAAO"}
1
+ {"version":3,"file":"Callout.js","names":["memo","ScreenReaderText","useTranslation","jsx","_jsx","jsxs","_jsxs","calloutRoleValues","calloutSeverityValues","Callout","_ref","children","role","severity","testId","title","translate","t","_Alert","variant","_AlertTitle","_Box","component","MemoizedCallout","displayName"],"sources":["../src/Callout.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { memo, ReactNode } from \"react\";\nimport { Alert, AlertTitle, Box } from \"@mui/material\";\nimport { ScreenReaderText } from \"./ScreenReaderText\";\nimport { useTranslation } from \"react-i18next\";\n\nimport type { AllowedProps } from \"./AllowedProps\";\n\nexport const calloutRoleValues = [\"status\", \"alert\"] as const;\nexport const calloutSeverityValues = [\n \"success\",\n \"info\",\n \"warning\",\n \"error\",\n] as const;\n\nexport type CalloutProps = {\n /**\n * The contents of the Callout\n */\n children: ReactNode;\n /**\n * Sets the ARIA role of the Callout\n * (\"status\" for something that dynamically updates, \"alert\" for errors, null for something\n * unchanging)\n */\n role?: (typeof calloutRoleValues)[number];\n /**\n * Determine the color and icon of the Callout\n */\n severity: (typeof calloutSeverityValues)[number];\n /**\n * The title of the Callout\n */\n title?: string;\n} & AllowedProps;\n\nconst Callout = ({\n children,\n role,\n severity,\n testId,\n title,\n translate,\n}: CalloutProps) => {\n const { t } = useTranslation();\n\n return (\n <Alert data-se={testId} role={role} severity={severity} variant=\"callout\">\n <ScreenReaderText translate={translate}>\n {t(`severity.${severity}`)}\n </ScreenReaderText>\n {title && <AlertTitle translate={translate}>{title}</AlertTitle>}\n <Box component=\"div\">{children}</Box>\n </Alert>\n );\n};\n\nconst MemoizedCallout = memo(Callout);\nMemoizedCallout.displayName = \"Callout\";\n\nexport { MemoizedCallout as Callout };\n"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,QAAmB,OAAO;AAAC,SAE/BC,gBAAgB;AACzB,SAASC,cAAc,QAAQ,eAAe;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAI/C,OAAO,MAAMC,iBAAiB,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAU;AAC7D,OAAO,MAAMC,qBAAqB,GAAG,CACnC,SAAS,EACT,MAAM,EACN,SAAS,EACT,OAAO,CACC;AAuBV,MAAMC,OAAO,GAAGC,IAAA,IAOI;EAAA,IAPH;IACfC,QAAQ;IACRC,IAAI;IACJC,QAAQ;IACRC,MAAM;IACNC,KAAK;IACLC;EACY,CAAC,GAAAN,IAAA;EACb,MAAM;IAAEO;EAAE,CAAC,GAAGf,cAAc,CAAC,CAAC;EAE9B,OACEI,KAAA,CAAAY,MAAA;IAAO,WAASJ,MAAO;IAACF,IAAI,EAAEA,IAAK;IAACC,QAAQ,EAAEA,QAAS;IAACM,OAAO,EAAC,SAAS;IAAAR,QAAA,GACvEP,IAAA,CAACH,gBAAgB;MAACe,SAAS,EAAEA,SAAU;MAAAL,QAAA,EACpCM,CAAC,CAAE,YAAWJ,QAAS,EAAC;IAAC,CACV,CAAC,EAClBE,KAAK,IAAIX,IAAA,CAAAgB,WAAA;MAAYJ,SAAS,EAAEA,SAAU;MAAAL,QAAA,EAAEI;IAAK,CAAa,CAAC,EAChEX,IAAA,CAAAiB,IAAA;MAAKC,SAAS,EAAC,KAAK;MAAAX,QAAA,EAAEA;IAAQ,CAAM,CAAC;EAAA,CAChC,CAAC;AAEZ,CAAC;AAED,MAAMY,eAAe,GAAGvB,IAAI,CAACS,OAAO,CAAC;AACrCc,eAAe,CAACC,WAAW,GAAG,SAAS;AAEvC,SAASD,eAAe,IAAId,OAAO"}
package/dist/Checkbox.js CHANGED
@@ -38,6 +38,7 @@ const Checkbox = _ref => {
38
38
  onChange: onChangeProp,
39
39
  onBlur: onBlurProp,
40
40
  testId,
41
+ translate,
41
42
  validity = "inherit",
42
43
  value
43
44
  } = _ref;
@@ -76,10 +77,11 @@ const Checkbox = _ref => {
76
77
  children: ["(", t("fieldlabel.required.text"), ")"]
77
78
  })]
78
79
  }), hint && _jsx(_FormHelperText, {
80
+ translate: translate,
79
81
  children: hint
80
82
  })]
81
83
  });
82
- }, [isRequired, labelProp, hint, t]);
84
+ }, [isRequired, labelProp, hint, t, translate]);
83
85
  const onChange = useCallback((event, checked) => {
84
86
  onChangeProp?.(event, checked);
85
87
  }, [onChangeProp]);
@@ -110,7 +112,8 @@ const Checkbox = _ref => {
110
112
  name: nameOverride ?? idOverride,
111
113
  value: value,
112
114
  required: isRequired,
113
- onBlur: onBlur
115
+ onBlur: onBlur,
116
+ translate: translate
114
117
  });
115
118
  };
116
119
  const MemoizedCheckbox = memo(Checkbox);