@okta/odyssey-react-mui 1.14.5 → 1.14.7

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 (218) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/Badge.js +1 -1
  3. package/dist/Badge.js.map +1 -1
  4. package/dist/Callout.js +27 -10
  5. package/dist/Callout.js.map +1 -1
  6. package/dist/Field.js.map +1 -1
  7. package/dist/Fieldset.js +17 -14
  8. package/dist/Fieldset.js.map +1 -1
  9. package/dist/Form.js +33 -23
  10. package/dist/Form.js.map +1 -1
  11. package/dist/MenuButton.js +1 -1
  12. package/dist/MenuButton.js.map +1 -1
  13. package/dist/SearchField.js +2 -2
  14. package/dist/SearchField.js.map +1 -1
  15. package/dist/labs/FileUpload.js +195 -0
  16. package/dist/labs/FileUpload.js.map +1 -0
  17. package/dist/labs/FileUploadIllustration.js +54 -0
  18. package/dist/labs/FileUploadIllustration.js.map +1 -0
  19. package/dist/labs/FileUploadPreview.js +109 -0
  20. package/dist/labs/FileUploadPreview.js.map +1 -0
  21. package/dist/labs/index.js +1 -0
  22. package/dist/labs/index.js.map +1 -1
  23. package/dist/properties/ts/odyssey-react-mui.js +3 -0
  24. package/dist/properties/ts/odyssey-react-mui.js.map +1 -1
  25. package/dist/properties/ts/odyssey-react-mui_cs.js +2 -1
  26. package/dist/properties/ts/odyssey-react-mui_cs.js.map +1 -1
  27. package/dist/properties/ts/odyssey-react-mui_da.js +2 -1
  28. package/dist/properties/ts/odyssey-react-mui_da.js.map +1 -1
  29. package/dist/properties/ts/odyssey-react-mui_de.js +2 -1
  30. package/dist/properties/ts/odyssey-react-mui_de.js.map +1 -1
  31. package/dist/properties/ts/odyssey-react-mui_el.js +2 -1
  32. package/dist/properties/ts/odyssey-react-mui_el.js.map +1 -1
  33. package/dist/properties/ts/odyssey-react-mui_es.js +2 -1
  34. package/dist/properties/ts/odyssey-react-mui_es.js.map +1 -1
  35. package/dist/properties/ts/odyssey-react-mui_fi.js +2 -1
  36. package/dist/properties/ts/odyssey-react-mui_fi.js.map +1 -1
  37. package/dist/properties/ts/odyssey-react-mui_fr.js +2 -1
  38. package/dist/properties/ts/odyssey-react-mui_fr.js.map +1 -1
  39. package/dist/properties/ts/odyssey-react-mui_hu.js +2 -1
  40. package/dist/properties/ts/odyssey-react-mui_hu.js.map +1 -1
  41. package/dist/properties/ts/odyssey-react-mui_id.js +2 -1
  42. package/dist/properties/ts/odyssey-react-mui_id.js.map +1 -1
  43. package/dist/properties/ts/odyssey-react-mui_it.js +2 -1
  44. package/dist/properties/ts/odyssey-react-mui_it.js.map +1 -1
  45. package/dist/properties/ts/odyssey-react-mui_ja.js +2 -1
  46. package/dist/properties/ts/odyssey-react-mui_ja.js.map +1 -1
  47. package/dist/properties/ts/odyssey-react-mui_ko.js +2 -1
  48. package/dist/properties/ts/odyssey-react-mui_ko.js.map +1 -1
  49. package/dist/properties/ts/odyssey-react-mui_ms.js +2 -1
  50. package/dist/properties/ts/odyssey-react-mui_ms.js.map +1 -1
  51. package/dist/properties/ts/odyssey-react-mui_nb.js +2 -1
  52. package/dist/properties/ts/odyssey-react-mui_nb.js.map +1 -1
  53. package/dist/properties/ts/odyssey-react-mui_nl_NL.js +2 -1
  54. package/dist/properties/ts/odyssey-react-mui_nl_NL.js.map +1 -1
  55. package/dist/properties/ts/odyssey-react-mui_pl.js +2 -1
  56. package/dist/properties/ts/odyssey-react-mui_pl.js.map +1 -1
  57. package/dist/properties/ts/odyssey-react-mui_pt_BR.js +2 -1
  58. package/dist/properties/ts/odyssey-react-mui_pt_BR.js.map +1 -1
  59. package/dist/properties/ts/odyssey-react-mui_ro.js +2 -1
  60. package/dist/properties/ts/odyssey-react-mui_ro.js.map +1 -1
  61. package/dist/properties/ts/odyssey-react-mui_ru.js +2 -1
  62. package/dist/properties/ts/odyssey-react-mui_ru.js.map +1 -1
  63. package/dist/properties/ts/odyssey-react-mui_sv.js +2 -1
  64. package/dist/properties/ts/odyssey-react-mui_sv.js.map +1 -1
  65. package/dist/properties/ts/odyssey-react-mui_th.js +2 -1
  66. package/dist/properties/ts/odyssey-react-mui_th.js.map +1 -1
  67. package/dist/properties/ts/odyssey-react-mui_tr.js +2 -1
  68. package/dist/properties/ts/odyssey-react-mui_tr.js.map +1 -1
  69. package/dist/properties/ts/odyssey-react-mui_uk.js +2 -1
  70. package/dist/properties/ts/odyssey-react-mui_uk.js.map +1 -1
  71. package/dist/properties/ts/odyssey-react-mui_vi.js +2 -1
  72. package/dist/properties/ts/odyssey-react-mui_vi.js.map +1 -1
  73. package/dist/properties/ts/odyssey-react-mui_zh_CN.js +2 -1
  74. package/dist/properties/ts/odyssey-react-mui_zh_CN.js.map +1 -1
  75. package/dist/properties/ts/odyssey-react-mui_zh_TW.js +2 -1
  76. package/dist/properties/ts/odyssey-react-mui_zh_TW.js.map +1 -1
  77. package/dist/src/Callout.d.ts +1 -1
  78. package/dist/src/Callout.d.ts.map +1 -1
  79. package/dist/src/Field.d.ts +8 -7
  80. package/dist/src/Field.d.ts.map +1 -1
  81. package/dist/src/Fieldset.d.ts.map +1 -1
  82. package/dist/src/Form.d.ts.map +1 -1
  83. package/dist/src/OdysseyTranslationProvider.d.ts +1 -1
  84. package/dist/src/OdysseyTranslationProvider.d.ts.map +1 -1
  85. package/dist/src/SearchField.d.ts.map +1 -1
  86. package/dist/src/labs/FileUpload.d.ts +40 -0
  87. package/dist/src/labs/FileUpload.d.ts.map +1 -0
  88. package/dist/src/labs/FileUploadIllustration.d.ts +15 -0
  89. package/dist/src/labs/FileUploadIllustration.d.ts.map +1 -0
  90. package/dist/src/labs/FileUploadPreview.d.ts +21 -0
  91. package/dist/src/labs/FileUploadPreview.d.ts.map +1 -0
  92. package/dist/src/labs/index.d.ts +1 -0
  93. package/dist/src/labs/index.d.ts.map +1 -1
  94. package/dist/src/properties/ts/odyssey-react-mui.d.ts +3 -0
  95. package/dist/src/properties/ts/odyssey-react-mui.d.ts.map +1 -1
  96. package/dist/src/properties/ts/odyssey-react-mui_cs.d.ts +1 -0
  97. package/dist/src/properties/ts/odyssey-react-mui_cs.d.ts.map +1 -1
  98. package/dist/src/properties/ts/odyssey-react-mui_da.d.ts +1 -0
  99. package/dist/src/properties/ts/odyssey-react-mui_da.d.ts.map +1 -1
  100. package/dist/src/properties/ts/odyssey-react-mui_de.d.ts +1 -0
  101. package/dist/src/properties/ts/odyssey-react-mui_de.d.ts.map +1 -1
  102. package/dist/src/properties/ts/odyssey-react-mui_el.d.ts +1 -0
  103. package/dist/src/properties/ts/odyssey-react-mui_el.d.ts.map +1 -1
  104. package/dist/src/properties/ts/odyssey-react-mui_es.d.ts +1 -0
  105. package/dist/src/properties/ts/odyssey-react-mui_es.d.ts.map +1 -1
  106. package/dist/src/properties/ts/odyssey-react-mui_fi.d.ts +1 -0
  107. package/dist/src/properties/ts/odyssey-react-mui_fi.d.ts.map +1 -1
  108. package/dist/src/properties/ts/odyssey-react-mui_fr.d.ts +1 -0
  109. package/dist/src/properties/ts/odyssey-react-mui_fr.d.ts.map +1 -1
  110. package/dist/src/properties/ts/odyssey-react-mui_hu.d.ts +1 -0
  111. package/dist/src/properties/ts/odyssey-react-mui_hu.d.ts.map +1 -1
  112. package/dist/src/properties/ts/odyssey-react-mui_id.d.ts +1 -0
  113. package/dist/src/properties/ts/odyssey-react-mui_id.d.ts.map +1 -1
  114. package/dist/src/properties/ts/odyssey-react-mui_it.d.ts +1 -0
  115. package/dist/src/properties/ts/odyssey-react-mui_it.d.ts.map +1 -1
  116. package/dist/src/properties/ts/odyssey-react-mui_ja.d.ts +1 -0
  117. package/dist/src/properties/ts/odyssey-react-mui_ja.d.ts.map +1 -1
  118. package/dist/src/properties/ts/odyssey-react-mui_ko.d.ts +1 -0
  119. package/dist/src/properties/ts/odyssey-react-mui_ko.d.ts.map +1 -1
  120. package/dist/src/properties/ts/odyssey-react-mui_ms.d.ts +1 -0
  121. package/dist/src/properties/ts/odyssey-react-mui_ms.d.ts.map +1 -1
  122. package/dist/src/properties/ts/odyssey-react-mui_nb.d.ts +1 -0
  123. package/dist/src/properties/ts/odyssey-react-mui_nb.d.ts.map +1 -1
  124. package/dist/src/properties/ts/odyssey-react-mui_nl_NL.d.ts +1 -0
  125. package/dist/src/properties/ts/odyssey-react-mui_nl_NL.d.ts.map +1 -1
  126. package/dist/src/properties/ts/odyssey-react-mui_pl.d.ts +1 -0
  127. package/dist/src/properties/ts/odyssey-react-mui_pl.d.ts.map +1 -1
  128. package/dist/src/properties/ts/odyssey-react-mui_pt_BR.d.ts +1 -0
  129. package/dist/src/properties/ts/odyssey-react-mui_pt_BR.d.ts.map +1 -1
  130. package/dist/src/properties/ts/odyssey-react-mui_ro.d.ts +1 -0
  131. package/dist/src/properties/ts/odyssey-react-mui_ro.d.ts.map +1 -1
  132. package/dist/src/properties/ts/odyssey-react-mui_ru.d.ts +1 -0
  133. package/dist/src/properties/ts/odyssey-react-mui_ru.d.ts.map +1 -1
  134. package/dist/src/properties/ts/odyssey-react-mui_sv.d.ts +1 -0
  135. package/dist/src/properties/ts/odyssey-react-mui_sv.d.ts.map +1 -1
  136. package/dist/src/properties/ts/odyssey-react-mui_th.d.ts +1 -0
  137. package/dist/src/properties/ts/odyssey-react-mui_th.d.ts.map +1 -1
  138. package/dist/src/properties/ts/odyssey-react-mui_tr.d.ts +1 -0
  139. package/dist/src/properties/ts/odyssey-react-mui_tr.d.ts.map +1 -1
  140. package/dist/src/properties/ts/odyssey-react-mui_uk.d.ts +1 -0
  141. package/dist/src/properties/ts/odyssey-react-mui_uk.d.ts.map +1 -1
  142. package/dist/src/properties/ts/odyssey-react-mui_vi.d.ts +1 -0
  143. package/dist/src/properties/ts/odyssey-react-mui_vi.d.ts.map +1 -1
  144. package/dist/src/properties/ts/odyssey-react-mui_zh_CN.d.ts +1 -0
  145. package/dist/src/properties/ts/odyssey-react-mui_zh_CN.d.ts.map +1 -1
  146. package/dist/src/properties/ts/odyssey-react-mui_zh_TW.d.ts +1 -0
  147. package/dist/src/properties/ts/odyssey-react-mui_zh_TW.d.ts.map +1 -1
  148. package/dist/src/theme/components.d.ts.map +1 -1
  149. package/dist/theme/components.js +11 -7
  150. package/dist/theme/components.js.map +1 -1
  151. package/dist/tsconfig.production.tsbuildinfo +1 -1
  152. package/package.json +3 -3
  153. package/src/Badge.tsx +1 -1
  154. package/src/Callout.tsx +28 -10
  155. package/src/Field.tsx +9 -7
  156. package/src/Fieldset.tsx +24 -18
  157. package/src/Form.tsx +43 -27
  158. package/src/MenuButton.tsx +1 -1
  159. package/src/SearchField.tsx +1 -2
  160. package/src/labs/FileUpload.tsx +301 -0
  161. package/src/labs/FileUploadIllustration.tsx +66 -0
  162. package/src/labs/FileUploadPreview.tsx +150 -0
  163. package/src/labs/index.ts +1 -2
  164. package/src/properties/odyssey-react-mui.properties +3 -7
  165. package/src/properties/translations/odyssey-react-mui_cs.properties +1 -0
  166. package/src/properties/translations/odyssey-react-mui_da.properties +1 -0
  167. package/src/properties/translations/odyssey-react-mui_de.properties +1 -0
  168. package/src/properties/translations/odyssey-react-mui_el.properties +1 -0
  169. package/src/properties/translations/odyssey-react-mui_es.properties +1 -0
  170. package/src/properties/translations/odyssey-react-mui_fi.properties +1 -0
  171. package/src/properties/translations/odyssey-react-mui_fr.properties +1 -0
  172. package/src/properties/translations/odyssey-react-mui_hu.properties +1 -0
  173. package/src/properties/translations/odyssey-react-mui_id.properties +1 -0
  174. package/src/properties/translations/odyssey-react-mui_it.properties +1 -0
  175. package/src/properties/translations/odyssey-react-mui_ja.properties +1 -0
  176. package/src/properties/translations/odyssey-react-mui_ko.properties +1 -0
  177. package/src/properties/translations/odyssey-react-mui_ms.properties +1 -0
  178. package/src/properties/translations/odyssey-react-mui_nb.properties +1 -0
  179. package/src/properties/translations/odyssey-react-mui_nl_NL.properties +1 -0
  180. package/src/properties/translations/odyssey-react-mui_pl.properties +1 -0
  181. package/src/properties/translations/odyssey-react-mui_pt_BR.properties +1 -0
  182. package/src/properties/translations/odyssey-react-mui_ro.properties +1 -0
  183. package/src/properties/translations/odyssey-react-mui_ru.properties +1 -0
  184. package/src/properties/translations/odyssey-react-mui_sv.properties +1 -0
  185. package/src/properties/translations/odyssey-react-mui_th.properties +1 -0
  186. package/src/properties/translations/odyssey-react-mui_tr.properties +1 -0
  187. package/src/properties/translations/odyssey-react-mui_uk.properties +1 -0
  188. package/src/properties/translations/odyssey-react-mui_vi.properties +1 -0
  189. package/src/properties/translations/odyssey-react-mui_zh_CN.properties +1 -0
  190. package/src/properties/translations/odyssey-react-mui_zh_TW.properties +1 -0
  191. package/src/properties/ts/odyssey-react-mui.ts +1 -1
  192. package/src/properties/ts/odyssey-react-mui_cs.ts +1 -1
  193. package/src/properties/ts/odyssey-react-mui_da.ts +1 -1
  194. package/src/properties/ts/odyssey-react-mui_de.ts +1 -1
  195. package/src/properties/ts/odyssey-react-mui_el.ts +1 -1
  196. package/src/properties/ts/odyssey-react-mui_es.ts +1 -1
  197. package/src/properties/ts/odyssey-react-mui_fi.ts +1 -1
  198. package/src/properties/ts/odyssey-react-mui_fr.ts +1 -1
  199. package/src/properties/ts/odyssey-react-mui_hu.ts +1 -1
  200. package/src/properties/ts/odyssey-react-mui_id.ts +1 -1
  201. package/src/properties/ts/odyssey-react-mui_it.ts +1 -1
  202. package/src/properties/ts/odyssey-react-mui_ja.ts +1 -1
  203. package/src/properties/ts/odyssey-react-mui_ko.ts +1 -1
  204. package/src/properties/ts/odyssey-react-mui_ms.ts +1 -1
  205. package/src/properties/ts/odyssey-react-mui_nb.ts +1 -1
  206. package/src/properties/ts/odyssey-react-mui_nl_NL.ts +1 -1
  207. package/src/properties/ts/odyssey-react-mui_pl.ts +1 -1
  208. package/src/properties/ts/odyssey-react-mui_pt_BR.ts +1 -1
  209. package/src/properties/ts/odyssey-react-mui_ro.ts +1 -1
  210. package/src/properties/ts/odyssey-react-mui_ru.ts +1 -1
  211. package/src/properties/ts/odyssey-react-mui_sv.ts +1 -1
  212. package/src/properties/ts/odyssey-react-mui_th.ts +1 -1
  213. package/src/properties/ts/odyssey-react-mui_tr.ts +1 -1
  214. package/src/properties/ts/odyssey-react-mui_uk.ts +1 -1
  215. package/src/properties/ts/odyssey-react-mui_vi.ts +1 -1
  216. package/src/properties/ts/odyssey-react-mui_zh_CN.ts +1 -1
  217. package/src/properties/ts/odyssey-react-mui_zh_TW.ts +1 -1
  218. package/src/theme/components.tsx +9 -5
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.14.7](https://github.com/okta/odyssey/compare/v1.14.6...v1.14.7) (2024-03-08)
7
+
8
+ **Note:** Version bump only for package @okta/odyssey-react-mui
9
+
10
+ ## [1.14.6](https://github.com/okta/odyssey/compare/v1.14.5...v1.14.6) (2024-03-07)
11
+
12
+ **Note:** Version bump only for package @okta/odyssey-react-mui
13
+
6
14
  ## [1.14.5](https://github.com/okta/odyssey/compare/v1.14.4...v1.14.5) (2024-03-01)
7
15
 
8
16
  **Note:** Version bump only for package @okta/odyssey-react-mui
package/dist/Badge.js CHANGED
@@ -64,7 +64,7 @@ const Badge = ({
64
64
  const hasNotificationCount = badgeContent && badgeContent > 0;
65
65
  return hasNotificationCount ? _jsx(Box, {
66
66
  sx: badgeStyles,
67
- "data-se": testId,
67
+ testId: testId,
68
68
  translate: translate,
69
69
  children: formattedContent
70
70
  }) : null;
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","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 { HtmlProps } from \"./HtmlProps\";\n\nexport type BadgeContentMax = 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 | 90 | 100;\n\nexport const badgeTypeValues = [\"default\", \"attention\", \"danger\"] as const;\n\nexport type BadgeProps = {\n badgeContent: number;\n badgeContentMax?: BadgeContentMax;\n type?: (typeof badgeTypeValues)[number];\n} & Pick<HtmlProps, \"testId\" | \"translate\">;\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 = 100,\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;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,MAAMmC,aAAa,GAAG7D,IAAI,CAACmB,KAAK,CAAC;AACjC0C,aAAa,CAACC,WAAW,GAAG,OAAO;AAEnC,SAASD,aAAa,IAAI1C,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","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 { HtmlProps } from \"./HtmlProps\";\n\nexport type BadgeContentMax = 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 | 90 | 100;\n\nexport const badgeTypeValues = [\"default\", \"attention\", \"danger\"] as const;\n\nexport type BadgeProps = {\n badgeContent: number;\n badgeContentMax?: BadgeContentMax;\n type?: (typeof badgeTypeValues)[number];\n} & Pick<HtmlProps, \"testId\" | \"translate\">;\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 = 100,\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} testId={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;AAKZ,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,GAAGA,CAAC;EACbC,YAAY;EACZC,eAAe,GAAG,GAAG;EACrBC,MAAM;EACNC,SAAS;EACTC,IAAI,GAAG;AACG,CAAC,KAAK;EAChB,MAAMC,mBAAmB,GAAGvB,sBAAsB,CAAC,CAAC;EAEpD,MAAMwB,WAAW,GAAGzB,OAAO,CAAC,MAAM;I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AC+B,sBAAuB,EAAC;MACnEC,kBAAkB,EAAG;IACvB,CAAC;IAED,MAAMC,oBAAoB,GAAGtC,YAAY,IAAIA,YAAY,GAAG,CAAC;IAE7D,OAAOsC,oBAAoB,GACzBrD,IAAA,CAACF,GAAG;MAACwD,EAAE,EAAE1B,WAAY;MAACX,MAAM,EAAEA,MAAO;MAACC,SAAS,EAAEA,SAAU;MAAAqC,QAAA,EACxD7B;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,GAAG7D,IAAI,CAACmB,KAAK,CAAC;AACjC0C,aAAa,CAACC,WAAW,GAAG,OAAO;AAEnC,SAASD,aAAa,IAAI1C,KAAK"}
package/dist/Callout.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import _Alert from "@mui/material/Alert";
2
+ import _Link from "@mui/material/Link";
2
3
  import _Box from "@mui/material/Box";
3
4
  import _AlertTitle from "@mui/material/AlertTitle";
4
5
  /*!
@@ -16,12 +17,22 @@ import _AlertTitle from "@mui/material/AlertTitle";
16
17
  import { memo } from "react";
17
18
  import { ScreenReaderText } from "./ScreenReaderText.js";
18
19
  import { useTranslation } from "react-i18next";
19
- import { Link } from "./Link.js";
20
20
  import { Paragraph } from "./Typography.js";
21
+ import { useOdysseyDesignTokens } from "./OdysseyDesignTokensContext.js";
22
+ import styled from "@emotion/styled";
21
23
  import { jsx as _jsx } from "react/jsx-runtime";
22
24
  import { jsxs as _jsxs } from "react/jsx-runtime";
23
25
  export const calloutRoleValues = ["status", "alert"];
24
26
  export const calloutSeverityValues = ["success", "info", "warning", "error"];
27
+ const ContentContainer = styled("div", {
28
+ shouldForwardProp: prop => prop !== "odysseyDesignTokens"
29
+ })(({
30
+ odysseyDesignTokens
31
+ }) => ({
32
+ "& > * + *": {
33
+ marginBlockStart: odysseyDesignTokens.Spacing4
34
+ }
35
+ }));
25
36
  const Callout = ({
26
37
  children,
27
38
  linkText,
@@ -36,6 +47,7 @@ const Callout = ({
36
47
  const {
37
48
  t
38
49
  } = useTranslation();
50
+ const odysseyDesignTokens = useOdysseyDesignTokens();
39
51
  return _jsxs(_Alert, {
40
52
  "data-se": testId,
41
53
  role: role,
@@ -47,15 +59,20 @@ const Callout = ({
47
59
  }), title && _jsx(_AlertTitle, {
48
60
  translate: translate,
49
61
  children: title
50
- }), children && _jsx(_Box, {
51
- component: "div",
52
- children: children
53
- }), text && _jsx(Paragraph, {
54
- children: text
55
- }), linkUrl && _jsx(Link, {
56
- href: linkUrl,
57
- variant: "monochrome",
58
- children: linkText
62
+ }), _jsxs(ContentContainer, {
63
+ odysseyDesignTokens: odysseyDesignTokens,
64
+ children: [children && _jsx(_Box, {
65
+ component: "div",
66
+ children: children
67
+ }), text && _jsx(Paragraph, {
68
+ children: text
69
+ }), linkUrl && _jsx(_Box, {
70
+ children: _jsx(_Link, {
71
+ href: linkUrl,
72
+ variant: "monochrome",
73
+ children: linkText
74
+ })
75
+ })]
59
76
  })]
60
77
  });
61
78
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Callout.js","names":["memo","ScreenReaderText","useTranslation","Link","Paragraph","jsx","_jsx","jsxs","_jsxs","calloutRoleValues","calloutSeverityValues","Callout","children","linkText","linkUrl","role","severity","testId","text","title","translate","t","_Alert","variant","_AlertTitle","_Box","component","href","MemoizedCallout","displayName"],"sources":["../src/Callout.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { memo, ReactNode } from \"react\";\nimport { Alert, AlertTitle, Box } from \"@mui/material\";\nimport { ScreenReaderText } from \"./ScreenReaderText\";\nimport { useTranslation } from \"react-i18next\";\n\nimport type { HtmlProps } from \"./HtmlProps\";\nimport { Link } from \"./Link\";\nimport { Paragraph } from \"./Typography\";\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 text content of the Callout\n */\n text?: string;\n /**\n * The title of the Callout\n */\n title?: string;\n} & (\n | {\n text: string;\n children?: never;\n }\n | {\n text?: never;\n children: ReactNode;\n }\n) &\n (\n | {\n /**\n * If linkUrl is not undefined, this is the text of the link.\n * If left blank, it defaults to \"Learn more\".\n * Note that linkText does nothing if linkUrl is not defined\n */\n linkUrl: string;\n /**\n * If defined, the Toast will include a link to the URL\n */\n linkText: string;\n }\n | {\n linkUrl?: never;\n linkText?: never;\n }\n ) &\n Pick<HtmlProps, \"testId\" | \"translate\">;\n\nconst Callout = ({\n children,\n linkText,\n linkUrl,\n role,\n severity,\n testId,\n text,\n title,\n translate,\n}: CalloutProps) => {\n const { t } = useTranslation();\n\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 {children && <Box component=\"div\">{children}</Box>}\n {text && <Paragraph>{text}</Paragraph>}\n {linkUrl && (\n <Link href={linkUrl} variant=\"monochrome\">\n {linkText}\n </Link>\n )}\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,SAGtCC,IAAI;AAAA,SACJC,SAAS;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAElB,OAAO,MAAMC,iBAAiB,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAU;AAC7D,OAAO,MAAMC,qBAAqB,GAAG,CACnC,SAAS,EACT,MAAM,EACN,SAAS,EACT,OAAO,CACC;AAuDV,MAAMC,OAAO,GAAGA,CAAC;EACfC,QAAQ;EACRC,QAAQ;EACRC,OAAO;EACPC,IAAI;EACJC,QAAQ;EACRC,MAAM;EACNC,IAAI;EACJC,KAAK;EACLC;AACY,CAAC,KAAK;EAClB,MAAM;IAAEC;EAAE,CAAC,GAAGnB,cAAc,CAAC,CAAC;EAE9B,OACEM,KAAA,CAAAc,MAAA;IAAO,WAASL,MAAO;IAACF,IAAI,EAAEA,IAAK;IAACC,QAAQ,EAAEA,QAAS;IAACO,OAAO,EAAC,SAAS;IAAAX,QAAA,GACvEN,IAAA,CAACL,gBAAgB;MAACmB,SAAS,EAAEA,SAAU;MAAAR,QAAA,EACpCS,CAAC,CAAE,YAAWL,QAAS,EAAC;IAAC,CACV,CAAC,EAClBG,KAAK,IAAIb,IAAA,CAAAkB,WAAA;MAAYJ,SAAS,EAAEA,SAAU;MAAAR,QAAA,EAAEO;IAAK,CAAa,CAAC,EAC/DP,QAAQ,IAAIN,IAAA,CAAAmB,IAAA;MAAKC,SAAS,EAAC,KAAK;MAAAd,QAAA,EAAEA;IAAQ,CAAM,CAAC,EACjDM,IAAI,IAAIZ,IAAA,CAACF,SAAS;MAAAQ,QAAA,EAAEM;IAAI,CAAY,CAAC,EACrCJ,OAAO,IACNR,IAAA,CAACH,IAAI;MAACwB,IAAI,EAAEb,OAAQ;MAACS,OAAO,EAAC,YAAY;MAAAX,QAAA,EACtCC;IAAQ,CACL,CACP;EAAA,CACI,CAAC;AAEZ,CAAC;AAED,MAAMe,eAAe,GAAG5B,IAAI,CAACW,OAAO,CAAC;AACrCiB,eAAe,CAACC,WAAW,GAAG,SAAS;AAEvC,SAASD,eAAe,IAAIjB,OAAO"}
1
+ {"version":3,"file":"Callout.js","names":["memo","ScreenReaderText","useTranslation","Paragraph","useOdysseyDesignTokens","styled","jsx","_jsx","jsxs","_jsxs","calloutRoleValues","calloutSeverityValues","ContentContainer","shouldForwardProp","prop","odysseyDesignTokens","marginBlockStart","Spacing4","Callout","children","linkText","linkUrl","role","severity","testId","text","title","translate","t","_Alert","variant","_AlertTitle","_Box","component","_Link","href","MemoizedCallout","displayName"],"sources":["../src/Callout.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { memo, ReactNode } from \"react\";\nimport { Alert, AlertTitle, Box, Link as MuiLink } from \"@mui/material\";\nimport { ScreenReaderText } from \"./ScreenReaderText\";\nimport { useTranslation } from \"react-i18next\";\n\nimport type { HtmlProps } from \"./HtmlProps\";\nimport { Paragraph } from \"./Typography\";\n\nimport {\n DesignTokens,\n useOdysseyDesignTokens,\n} from \"./OdysseyDesignTokensContext\";\nimport styled from \"@emotion/styled\";\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 * @deprecated Callout content shuold be set via title, text, linkText, and linkUrl\n */\n children?: ReactNode;\n /**\n * Sets the ARIA role of the Callout\n * (\"status\" for something that dynamically updates, \"alert\" for errors, null for something\n * unchanging)\n */\n role?: (typeof calloutRoleValues)[number];\n /**\n * Determine the color and icon of the Callout\n */\n severity: (typeof calloutSeverityValues)[number];\n /**\n * The text content of the Callout\n */\n text?: string;\n /**\n * The title of the Callout\n */\n title?: string;\n} & (\n | {\n text: string;\n children?: never;\n }\n | {\n text?: never;\n children: ReactNode;\n }\n) &\n (\n | {\n /**\n * If linkUrl is not undefined, this is the text of the link.\n * If left blank, it defaults to \"Learn more\".\n * Note that linkText does nothing if linkUrl is not defined\n */\n linkUrl: string;\n /**\n * If defined, the Toast will include a link to the URL\n */\n linkText: string;\n }\n | {\n linkUrl?: never;\n linkText?: never;\n }\n ) &\n Pick<HtmlProps, \"testId\" | \"translate\">;\n\nconst ContentContainer = styled(\"div\", {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})(({ odysseyDesignTokens }: { odysseyDesignTokens: DesignTokens }) => ({\n \"& > * + *\": {\n marginBlockStart: odysseyDesignTokens.Spacing4,\n },\n}));\n\nconst Callout = ({\n children,\n linkText,\n linkUrl,\n role,\n severity,\n testId,\n text,\n title,\n translate,\n}: CalloutProps) => {\n const { t } = useTranslation();\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\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 <ContentContainer odysseyDesignTokens={odysseyDesignTokens}>\n {children && <Box component=\"div\">{children}</Box>}\n {text && <Paragraph>{text}</Paragraph>}\n {linkUrl && (\n <Box>\n <MuiLink href={linkUrl} variant=\"monochrome\">\n {linkText}\n </MuiLink>\n </Box>\n )}\n </ContentContainer>\n </Alert>\n );\n};\n\nconst MemoizedCallout = memo(Callout);\nMemoizedCallout.displayName = \"Callout\";\n\nexport { MemoizedCallout as Callout };\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,QAAmB,OAAO;AAAC,SAE/BC,gBAAgB;AACzB,SAASC,cAAc,QAAQ,eAAe;AAAC,SAGtCC,SAAS;AAAA,SAIhBC,sBAAsB;AAExB,OAAOC,MAAM,MAAM,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAErC,OAAO,MAAMC,iBAAiB,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAU;AAC7D,OAAO,MAAMC,qBAAqB,GAAG,CACnC,SAAS,EACT,MAAM,EACN,SAAS,EACT,OAAO,CACC;AAuDV,MAAMC,gBAAgB,GAAGP,MAAM,CAAC,KAAK,EAAE;EACrCQ,iBAAiB,EAAGC,IAAI,IAAKA,IAAI,KAAK;AACxC,CAAC,CAAC,CAAC,CAAC;EAAEC;AAA2D,CAAC,MAAM;EACtE,WAAW,EAAE;IACXC,gBAAgB,EAAED,mBAAmB,CAACE;EACxC;AACF,CAAC,CAAC,CAAC;AAEH,MAAMC,OAAO,GAAGA,CAAC;EACfC,QAAQ;EACRC,QAAQ;EACRC,OAAO;EACPC,IAAI;EACJC,QAAQ;EACRC,MAAM;EACNC,IAAI;EACJC,KAAK;EACLC;AACY,CAAC,KAAK;EAClB,MAAM;IAAEC;EAAE,CAAC,GAAG1B,cAAc,CAAC,CAAC;EAC9B,MAAMa,mBAAmB,GAAGX,sBAAsB,CAAC,CAAC;EAEpD,OACEK,KAAA,CAAAoB,MAAA;IAAO,WAASL,MAAO;IAACF,IAAI,EAAEA,IAAK;IAACC,QAAQ,EAAEA,QAAS;IAACO,OAAO,EAAC,SAAS;IAAAX,QAAA,GACvEZ,IAAA,CAACN,gBAAgB;MAAC0B,SAAS,EAAEA,SAAU;MAAAR,QAAA,EACpCS,CAAC,CAAE,YAAWL,QAAS,EAAC;IAAC,CACV,CAAC,EAClBG,KAAK,IAAInB,IAAA,CAAAwB,WAAA;MAAYJ,SAAS,EAAEA,SAAU;MAAAR,QAAA,EAAEO;IAAK,CAAa,CAAC,EAChEjB,KAAA,CAACG,gBAAgB;MAACG,mBAAmB,EAAEA,mBAAoB;MAAAI,QAAA,GACxDA,QAAQ,IAAIZ,IAAA,CAAAyB,IAAA;QAAKC,SAAS,EAAC,KAAK;QAAAd,QAAA,EAAEA;MAAQ,CAAM,CAAC,EACjDM,IAAI,IAAIlB,IAAA,CAACJ,SAAS;QAAAgB,QAAA,EAAEM;MAAI,CAAY,CAAC,EACrCJ,OAAO,IACNd,IAAA,CAAAyB,IAAA;QAAAb,QAAA,EACEZ,IAAA,CAAA2B,KAAA;UAASC,IAAI,EAAEd,OAAQ;UAACS,OAAO,EAAC,YAAY;UAAAX,QAAA,EACzCC;QAAQ,CACF;MAAC,CACP,CACN;IAAA,CACe,CAAC;EAAA,CACd,CAAC;AAEZ,CAAC;AAED,MAAMgB,eAAe,GAAGpC,IAAI,CAACkB,OAAO,CAAC;AACrCkB,eAAe,CAACC,WAAW,GAAG,SAAS;AAEvC,SAASD,eAAe,IAAIlB,OAAO"}
package/dist/Field.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Field.js","names":["memo","useMemo","FieldError","FieldHint","FieldLabel","Typography","useFieldset","useTranslation","useUniqueId","jsxs","_jsxs","jsx","_jsx","fieldTypeValues","Field","ariaDescribedBy","errorMessage","errorMessageList","fieldType","hasVisibleLabel","hint","HintLinkComponent","id","idOverride","isDisabled","isDisabledProp","isFullWidth","isRadioGroup","isOptional","label","renderFieldComponent","t","hintId","undefined","errorMessageElementId","labelElementId","localAriaDescribedBy","join","trim","isFieldsetDisabled","_FormControl","component","disabled","error","Boolean","Array","isArray","length","role","fullWidth","children","_FormLabel","color","inputId","text","LinkComponent","message","messageList","MemoizedField","displayName"],"sources":["../src/Field.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { memo, ReactElement, useMemo } from \"react\";\n\nimport {\n FormControl as MuiFormControl,\n FormLabel as MuiFormLabel,\n} from \"@mui/material\";\n\nimport { FieldComponentProps } from \"./FieldComponentProps\";\nimport { FieldError } from \"./FieldError\";\nimport { FieldHint } from \"./FieldHint\";\nimport { FieldLabel } from \"./FieldLabel\";\nimport { HtmlProps } from \"./HtmlProps\";\nimport { Typography } from \"./Typography\";\nimport { useFieldset } from \"./FieldsetContext\";\nimport { useTranslation } from \"react-i18next\";\nimport { useUniqueId } from \"./useUniqueId\";\n\nexport const fieldTypeValues = [\"single\", \"group\"] as const;\n\nexport type FieldProps = {\n /**\n * If `error` is not undefined, the `input` will indicate an error.\n */\n errorMessageList?: string[];\n /**\n * The field type determines how ARIA components are setup. It's important to use this to denote if you expect only one component (like a text field) or multiple (like a radio group).\n */\n fieldType: (typeof fieldTypeValues)[number];\n /**\n * If `true`, the Field label will be shown\n */\n hasVisibleLabel: boolean;\n /**\n * Important for narrowing down the `fieldset` role to \"radiogroup\".\n */\n isRadioGroup?: boolean;\n /**\n * Important for determining if children inherit error state\n */\n isCheckboxGroup?: boolean;\n /**\n * The label for the `input` element.\n */\n label: string;\n /**\n * The short hint displayed in the `input` before the user enters a value.\n */\n placeholder?: string;\n /**\n * Render-props function that sends back ARIA props to your field component.\n */\n renderFieldComponent: ({\n ariaDescribedBy,\n dataSe,\n errorMessageElementId,\n id,\n labelElementId,\n }: {\n ariaDescribedBy?: string;\n dataSe?: string;\n errorMessageElementId?: string;\n id: string;\n labelElementId: string;\n }) => ReactElement;\n};\n\nconst Field = ({\n ariaDescribedBy,\n errorMessage,\n errorMessageList,\n fieldType,\n hasVisibleLabel,\n hint,\n HintLinkComponent,\n id: idOverride,\n isDisabled: isDisabledProp = false,\n isFullWidth = false,\n isRadioGroup = false,\n isOptional = false,\n label,\n renderFieldComponent,\n}: FieldProps &\n Pick<\n FieldComponentProps,\n | \"errorMessage\"\n | \"errorMessageList\"\n | \"hint\"\n | \"HintLinkComponent\"\n | \"id\"\n | \"isDisabled\"\n | \"isFullWidth\"\n | \"isOptional\"\n > &\n Pick<HtmlProps, \"ariaDescribedBy\">) => {\n const { t } = useTranslation();\n\n const id = useUniqueId(idOverride);\n const hintId = hint ? `${id}-hint` : undefined;\n const errorMessageElementId =\n errorMessage || errorMessageList ? `${id}-error` : undefined;\n const labelElementId = `${id}-label`;\n\n const localAriaDescribedBy = useMemo(\n () =>\n [hintId, errorMessageElementId, ariaDescribedBy].join(\" \").trim() ||\n undefined,\n [ariaDescribedBy, errorMessageElementId, hintId],\n );\n\n const { isDisabled: isFieldsetDisabled } = useFieldset();\n\n const isDisabled = useMemo(\n () => isDisabledProp || isFieldsetDisabled,\n [isDisabledProp, isFieldsetDisabled],\n );\n\n return (\n <MuiFormControl\n component={fieldType === \"group\" ? \"fieldset\" : \"div\"}\n disabled={isDisabled}\n error={\n Boolean(errorMessage) ||\n (Array.isArray(errorMessageList) && errorMessageList.length > 0)\n }\n role={isRadioGroup ? \"radiogroup\" : undefined}\n fullWidth={isFullWidth}\n >\n {fieldType === \"group\" ? (\n <MuiFormLabel component=\"legend\" id={labelElementId}>\n {label}{\" \"}\n {isOptional && label && (\n <Typography component=\"span\" color=\"textSecondary\">\n ({t(\"fieldlabel.optional.text\")})\n </Typography>\n )}\n </MuiFormLabel>\n ) : (\n <FieldLabel\n hasVisibleLabel={hasVisibleLabel}\n id={labelElementId}\n inputId={id}\n isOptional={isOptional}\n text={label}\n />\n )}\n\n {hint && (\n <FieldHint id={hintId} LinkComponent={HintLinkComponent} text={hint} />\n )}\n\n {renderFieldComponent({\n ariaDescribedBy: localAriaDescribedBy,\n errorMessageElementId,\n id,\n labelElementId,\n })}\n\n {(errorMessage || errorMessageList) && (\n <FieldError\n id={errorMessageElementId}\n message={errorMessage}\n messageList={errorMessageList}\n />\n )}\n </MuiFormControl>\n );\n};\n\nconst MemoizedField = memo(Field);\nMemoizedField.displayName = \"Field\";\n\nexport { MemoizedField as Field };\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,EAAgBC,OAAO,QAAQ,OAAO;AAAC,SAQ3CC,UAAU;AAAA,SACVC,SAAS;AAAA,SACTC,UAAU;AAAA,SAEVC,UAAU;AAAA,SACVC,WAAW;AACpB,SAASC,cAAc,QAAQ,eAAe;AAAC,SACtCC,WAAW;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAEpB,OAAO,MAAMC,eAAe,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAU;AAiD3D,MAAMC,KAAK,GAAGA,CAAC;EACbC,eAAe;EACfC,YAAY;EACZC,gBAAgB;EAChBC,SAAS;EACTC,eAAe;EACfC,IAAI;EACJC,iBAAiB;EACjBC,EAAE,EAAEC,UAAU;EACdC,UAAU,EAAEC,cAAc,GAAG,KAAK;EAClCC,WAAW,GAAG,KAAK;EACnBC,YAAY,GAAG,KAAK;EACpBC,UAAU,GAAG,KAAK;EAClBC,KAAK;EACLC;AAaiC,CAAC,KAAK;EACvC,MAAM;IAAEC;EAAE,CAAC,GAAGxB,cAAc,CAAC,CAAC;EAE9B,MAAMe,EAAE,GAAGd,WAAW,CAACe,UAAU,CAAC;EAClC,MAAMS,MAAM,GAAGZ,IAAI,GAAI,GAAEE,E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0B,CAAC,EAAC,GAClC;MAAA,CAAY,CACb;IAAA,CACW,CAAC,GAEfnB,IAAA,CAACR,UAAU;MACTe,eAAe,EAAEA,eAAgB;MACjCG,EAAE,EAAEa,cAAe;MACnBkB,OAAO,EAAE/B,EAAG;MACZM,UAAU,EAAEA,UAAW;MACvB0B,IAAI,EAAEzB;IAAM,CACb,CACF,EAEAT,IAAI,IACHR,IAAA,CAACT,SAAS;MAACmB,EAAE,EAAEU,MAAO;MAACuB,aAAa,EAAElC,iBAAkB;MAACiC,IAAI,EAAElC;IAAK,CAAE,CACvE,EAEAU,oBAAoB,CAAC;MACpBf,eAAe,EAAEqB,oBAAoB;MACrCF,qBAAqB;MACrBZ,EAAE;MACFa;IACF,CAAC,CAAC,EAED,CAACnB,YAAY,IAAIC,gBAAgB,KAChCL,IAAA,CAACV,UAAU;MACToB,EAAE,EAAEY,qBAAsB;MAC1BsB,OAAO,EAAExC,YAAa;MACtByC,WAAW,EAAExC;IAAiB,CAC/B,CACF;EAAA,CACa,CAAC;AAErB,CAAC;AAED,MAAMyC,aAAa,GAAG1D,IAAI,CAACc,KAAK,CAAC;AACjC4C,aAAa,CAACC,WAAW,GAAG,OAAO;AAEnC,SAASD,aAAa,IAAI5C,KAAK"}
1
+ {"version":3,"file":"Field.js","names":["memo","useMemo","FieldError","FieldHint","FieldLabel","Typography","useFieldset","useTranslation","useUniqueId","jsxs","_jsxs","jsx","_jsx","fieldTypeValues","Field","ariaDescribedBy","errorMessage","errorMessageList","fieldType","hasVisibleLabel","hint","HintLinkComponent","id","idOverride","isDisabled","isDisabledProp","isFullWidth","isRadioGroup","isOptional","label","renderFieldComponent","t","hintId","undefined","errorMessageElementId","labelElementId","localAriaDescribedBy","join","trim","isFieldsetDisabled","_FormControl","component","disabled","error","Boolean","Array","isArray","length","role","fullWidth","children","_FormLabel","color","inputId","text","LinkComponent","message","messageList","MemoizedField","displayName"],"sources":["../src/Field.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { memo, ReactElement, useMemo } from \"react\";\n\nimport {\n FormControl as MuiFormControl,\n FormLabel as MuiFormLabel,\n} from \"@mui/material\";\n\nimport { FieldComponentProps } from \"./FieldComponentProps\";\nimport { FieldError } from \"./FieldError\";\nimport { FieldHint } from \"./FieldHint\";\nimport { FieldLabel } from \"./FieldLabel\";\nimport { HtmlProps } from \"./HtmlProps\";\nimport { Typography } from \"./Typography\";\nimport { useFieldset } from \"./FieldsetContext\";\nimport { useTranslation } from \"react-i18next\";\nimport { useUniqueId } from \"./useUniqueId\";\n\nexport const fieldTypeValues = [\"single\", \"group\"] as const;\n\nexport type RenderFieldComponentProps = {\n ariaDescribedBy?: string;\n dataSe?: string;\n errorMessageElementId?: string;\n id: string;\n labelElementId: string;\n};\n\nexport type FieldProps = {\n /**\n * If `error` is not undefined, the `input` will indicate an error.\n */\n errorMessageList?: string[];\n /**\n * The field type determines how ARIA components are setup. It's important to use this to denote if you expect only one component (like a text field) or multiple (like a radio group).\n */\n fieldType: (typeof fieldTypeValues)[number];\n /**\n * If `true`, the Field label will be shown\n */\n hasVisibleLabel: boolean;\n /**\n * Important for narrowing down the `fieldset` role to \"radiogroup\".\n */\n isRadioGroup?: boolean;\n /**\n * Important for determining if children inherit error state\n */\n isCheckboxGroup?: boolean;\n /**\n * The label for the `input` element.\n */\n label: string;\n /**\n * The short hint displayed in the `input` before the user enters a value.\n */\n placeholder?: string;\n /**\n * Render-props function that sends back ARIA props to your field component.\n */\n renderFieldComponent: ({\n ariaDescribedBy,\n dataSe,\n errorMessageElementId,\n id,\n labelElementId,\n }: RenderFieldComponentProps) => ReactElement;\n};\n\nconst Field = ({\n ariaDescribedBy,\n errorMessage,\n errorMessageList,\n fieldType,\n hasVisibleLabel,\n hint,\n HintLinkComponent,\n id: idOverride,\n isDisabled: isDisabledProp = false,\n isFullWidth = false,\n isRadioGroup = false,\n isOptional = false,\n label,\n renderFieldComponent,\n}: FieldProps &\n Pick<\n FieldComponentProps,\n | \"errorMessage\"\n | \"errorMessageList\"\n | \"hint\"\n | \"HintLinkComponent\"\n | \"id\"\n | \"isDisabled\"\n | \"isFullWidth\"\n | \"isOptional\"\n > &\n Pick<HtmlProps, \"ariaDescribedBy\">) => {\n const { t } = useTranslation();\n\n const id = useUniqueId(idOverride);\n const hintId = hint ? `${id}-hint` : undefined;\n const errorMessageElementId =\n errorMessage || errorMessageList ? `${id}-error` : undefined;\n const labelElementId = `${id}-label`;\n\n const localAriaDescribedBy = useMemo(\n () =>\n [hintId, errorMessageElementId, ariaDescribedBy].join(\" \").trim() ||\n undefined,\n [ariaDescribedBy, errorMessageElementId, hintId],\n );\n\n const { isDisabled: isFieldsetDisabled } = useFieldset();\n\n const isDisabled = useMemo(\n () => isDisabledProp || isFieldsetDisabled,\n [isDisabledProp, isFieldsetDisabled],\n );\n\n return (\n <MuiFormControl\n component={fieldType === \"group\" ? \"fieldset\" : \"div\"}\n disabled={isDisabled}\n error={\n Boolean(errorMessage) ||\n (Array.isArray(errorMessageList) && errorMessageList.length > 0)\n }\n role={isRadioGroup ? \"radiogroup\" : undefined}\n fullWidth={isFullWidth}\n >\n {fieldType === \"group\" ? (\n <MuiFormLabel component=\"legend\" id={labelElementId}>\n {label}{\" \"}\n {isOptional && label && (\n <Typography component=\"span\" color=\"textSecondary\">\n ({t(\"fieldlabel.optional.text\")})\n </Typography>\n )}\n </MuiFormLabel>\n ) : (\n <FieldLabel\n hasVisibleLabel={hasVisibleLabel}\n id={labelElementId}\n inputId={id}\n isOptional={isOptional}\n text={label}\n />\n )}\n\n {hint && (\n <FieldHint id={hintId} LinkComponent={HintLinkComponent} text={hint} />\n )}\n\n {renderFieldComponent({\n ariaDescribedBy: localAriaDescribedBy,\n errorMessageElementId,\n id,\n labelElementId,\n })}\n\n {(errorMessage || errorMessageList) && (\n <FieldError\n id={errorMessageElementId}\n message={errorMessage}\n messageList={errorMessageList}\n />\n )}\n </MuiFormControl>\n );\n};\n\nconst MemoizedField = memo(Field);\nMemoizedField.displayName = \"Field\";\n\nexport { MemoizedField as Field };\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,EAAgBC,OAAO,QAAQ,OAAO;AAAC,SAQ3CC,UAAU;AAAA,SACVC,SAAS;AAAA,SACTC,UAAU;AAAA,SAEVC,UAAU;AAAA,SACVC,WAAW;AACpB,SAASC,cAAc,QAAQ,eAAe;AAAC,SACtCC,WAAW;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAEpB,OAAO,MAAMC,eAAe,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAU;AAmD3D,MAAMC,KAAK,GAAGA,CAAC;EACbC,eAAe;EACfC,YAAY;EACZC,gBAAgB;EAChBC,SAAS;EACTC,eAAe;EACfC,IAAI;EACJC,iBAAiB;EACjBC,EAAE,EAAEC,UAAU;EACdC,UAAU,EAAEC,cAAc,GAAG,KAAK;EAClCC,WAAW,GAAG,KAAK;EACnBC,YAAY,GAAG,KAAK;EACpBC,UAAU,GAAG,KAAK;EAClBC,KAAK;EACLC;AAaiC,CAAC,KAAK;EACvC,MAAM;IAAEC;EAAE,CAAC,GAAGxB,cAAc,CAAC,CAAC;EAE9B,MAAMe,EAAE,GAAGd,WAAW,CAACe,UAAU,CAAC;EAClC,MAAMS,MAAM,GAAGZ,IAAI,GAAI,GAAEE,EAAG,OAAM,GAAGW,SAAS;EAC9C,MAAMC,qBAAqB,GACzBlB,YAAY,IAAIC,gBAAgB,GA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U;MACTe,eAAe,EAAEA,eAAgB;MACjCG,EAAE,EAAEa,cAAe;MACnBkB,OAAO,EAAE/B,EAAG;MACZM,UAAU,EAAEA,UAAW;MACvB0B,IAAI,EAAEzB;IAAM,CACb,CACF,EAEAT,IAAI,IACHR,IAAA,CAACT,SAAS;MAACmB,EAAE,EAAEU,MAAO;MAACuB,aAAa,EAAElC,iBAAkB;MAACiC,IAAI,EAAElC;IAAK,CAAE,CACvE,EAEAU,oBAAoB,CAAC;MACpBf,eAAe,EAAEqB,oBAAoB;MACrCF,qBAAqB;MACrBZ,EAAE;MACFa;IACF,CAAC,CAAC,EAED,CAACnB,YAAY,IAAIC,gBAAgB,KAChCL,IAAA,CAACV,UAAU;MACToB,EAAE,EAAEY,qBAAsB;MAC1BsB,OAAO,EAAExC,YAAa;MACtByC,WAAW,EAAExC;IAAiB,CAC/B,CACF;EAAA,CACa,CAAC;AAErB,CAAC;AAED,MAAMyC,aAAa,GAAG1D,IAAI,CAACc,KAAK,CAAC;AACjC4C,aAAa,CAACC,WAAW,GAAG,OAAO;AAEnC,SAASD,aAAa,IAAI5C,KAAK"}
package/dist/Fieldset.js CHANGED
@@ -1,4 +1,3 @@
1
- import _Box from "@mui/material/Box";
2
1
  /*!
3
2
  * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.
4
3
  * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
@@ -10,13 +9,27 @@ import _Box from "@mui/material/Box";
10
9
  *
11
10
  * See the License for the specific language governing permissions and limitations under the License.
12
11
  */
12
+
13
13
  import { memo, useMemo } from "react";
14
+ import styled from "@emotion/styled";
14
15
  import { FieldsetContext } from "./FieldsetContext.js";
15
16
  import { Legend, Support } from "./Typography.js";
16
17
  import { useOdysseyDesignTokens } from "./OdysseyDesignTokensContext.js";
17
18
  import { useUniqueId } from "./useUniqueId.js";
18
19
  import { jsx as _jsx } from "react/jsx-runtime";
19
20
  import { jsxs as _jsxs } from "react/jsx-runtime";
21
+ const StyledFieldset = styled.fieldset(({
22
+ odysseyDesignTokens
23
+ }) => ({
24
+ border: "0",
25
+ margin: odysseyDesignTokens.Spacing0,
26
+ marginBlockEnd: odysseyDesignTokens.Spacing6,
27
+ maxWidth: odysseyDesignTokens.TypographyLineLengthMax,
28
+ padding: odysseyDesignTokens.Spacing0,
29
+ "&:last-child": {
30
+ marginBlockEnd: odysseyDesignTokens.Spacing0
31
+ }
32
+ }));
20
33
  const Fieldset = ({
21
34
  alert,
22
35
  children,
@@ -33,22 +46,12 @@ const Fieldset = ({
33
46
  const fieldsetContextValue = useMemo(() => ({
34
47
  isDisabled
35
48
  }), [isDisabled]);
36
- return _jsxs(_Box, {
37
- component: "fieldset",
49
+ return _jsxs(StyledFieldset, {
38
50
  "data-se": testId,
39
51
  disabled: isDisabled,
40
- name: name,
41
52
  id: id,
42
- sx: {
43
- border: "0",
44
- margin: odysseyDesignTokens.Spacing0,
45
- marginBlockEnd: odysseyDesignTokens.Spacing6,
46
- maxWidth: odysseyDesignTokens.TypographyLineLengthMax,
47
- padding: odysseyDesignTokens.Spacing0,
48
- "&:last-child": {
49
- marginBlockEnd: odysseyDesignTokens.Spacing0
50
- }
51
- },
53
+ name: name,
54
+ odysseyDesignTokens: odysseyDesignTokens,
52
55
  children: [_jsx(Legend, {
53
56
  translate: translate,
54
57
  children: legend
@@ -1 +1 @@
1
- {"version":3,"file":"Fieldset.js","names":["memo","useMemo","FieldsetContext","Legend","Support","useOdysseyDesignTokens","useUniqueId","jsx","_jsx","jsxs","_jsxs","Fieldset","alert","children","description","id","idOverride","isDisabled","legend","name","testId","translate","odysseyDesignTokens","fieldsetContextValue","_Box","component","disabled","sx","border","margin","Spacing0","marginBlockEnd","Spacing6","maxWidth","TypographyLineLengthMax","padding","Provider","value","MemoizedFieldset","displayName"],"sources":["../src/Fieldset.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 { Box } from \"@mui/material\";\nimport { memo, ReactElement, useMemo } from \"react\";\n\nimport { Callout } from \"./Callout\";\nimport { FieldsetContext } from \"./FieldsetContext\";\nimport { Legend, Support } from \"./Typography\";\nimport { useOdysseyDesignTokens } from \"./OdysseyDesignTokensContext\";\nimport { useUniqueId } from \"./useUniqueId\";\nimport type { HtmlProps } from \"./HtmlProps\";\n\nexport type FieldsetProps = {\n /**\n * A Callout indicating a Fieldset-wide error or status update.\n */\n alert?: ReactElement<typeof Callout>;\n /**\n * The Field components within the Fieldset\n */\n children: ReactElement | Array<ReactElement>;\n /**\n * A supplementary description\n */\n description?: string;\n /**\n * Defines a unique identifier (ID) which must be unique in the whole document.\n */\n id?: string;\n /**\n * Disables the component and any wrapped input fields.\n */\n isDisabled?: boolean;\n /**\n * The title of the Fieldset\n */\n legend: string;\n /**\n * The name associated with the group.\n */\n name?: string;\n} & Pick<HtmlProps, \"testId\" | \"translate\">;\n\nconst Fieldset = ({\n alert,\n children,\n description,\n id: idOverride,\n isDisabled = false,\n legend,\n name,\n testId,\n translate,\n}: FieldsetProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const id = useUniqueId(idOverride);\n\n const fieldsetContextValue = useMemo(\n () => ({\n isDisabled,\n }),\n [isDisabled],\n );\n\n return (\n <Box\n component=\"fieldset\"\n data-se={testId}\n disabled={isDisabled}\n name={name}\n id={id}\n sx={{\n border: \"0\",\n margin: odysseyDesignTokens.Spacing0,\n marginBlockEnd: odysseyDesignTokens.Spacing6,\n maxWidth: odysseyDesignTokens.TypographyLineLengthMax,\n padding: odysseyDesignTokens.Spacing0,\n\n \"&:last-child\": {\n marginBlockEnd: odysseyDesignTokens.Spacing0,\n },\n }}\n >\n <Legend translate={translate}>{legend}</Legend>\n\n {description && <Support translate={translate}>{description}</Support>}\n\n {alert}\n\n <FieldsetContext.Provider value={fieldsetContextValue}>\n {children}\n </FieldsetContext.Provider>\n </Box>\n );\n};\n\nconst MemoizedFieldset = memo(Fieldset);\nMemoizedFieldset.displayName = \"Fieldset\";\n\nexport { MemoizedFieldset as Fieldset };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,SAASA,IAAI,EAAgBC,OAAO,QAAQ,OAAO;AAAC,SAG3CC,eAAe;AAAA,SACfC,MAAM,EAAEC,OAAO;AAAA,SACfC,sBAAsB;AAAA,SACtBC,WAAW;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAkCpB,MAAMC,QAAQ,GAAGA,CAAC;EAChBC,KAAK;EACLC,QAAQ;EACRC,WAAW;EACXC,EAAE,EAAEC,UAAU;EACdC,UAAU,GAAG,KAAK;EAClBC,MAAM;EACNC,IAAI;EACJC,MAAM;EACNC;AACa,CAAC,KAAK;EACnB,MAAMC,mBAAmB,GAAGjB,sBAAsB,CAAC,CAAC;EACpD,MAAMU,EAAE,GAAGT,WAAW,CAACU,UAAU,CAAC;EAElC,MAAMO,oBAAoB,GAAGtB,OAAO,CAClC,OAAO;IACLgB;EACF,CAAC,CAAC,EACF,CAACA,UAAU,CACb,CAAC;EAED,OACEP,KAAA,CAAAc,IAAA;IACEC,SAAS,EAAC,UAAU;IACpB,WAASL,MAAO;IAChBM,QAAQ,EAAET,UAAW;IACrBE,IAAI,EAAEA,IAAK;IACXJ,EAAE,EAAEA,EAAG;IACPY,EAAE,EAAE;MACFC,MAAM,EAAE,GAAG;MACXC,MAAM,EAAEP,mBAAmB,CAACQ,QAAQ;MACpCC,cAAc,EAAET,mBAAmB,CAACU,QAAQ;MAC5CC,QAAQ,EAAEX,mBAAmB,CAACY,uBAAuB;MACrDC,OAAO,EAAEb,mBAAmB,CAACQ,QAAQ;MAErC,cAAc,EAAE;QACdC,cAAc,EAAET,mBAAmB,CAACQ;MACtC;IACF,CAAE;IAAAjB,QAAA,GAEFL,IAAA,CAACL,MAAM;MAACkB,SAAS,EAAEA,SAAU;MAAAR,QAAA,EAAEK;IAAM,CAAS,CAAC,EAE9CJ,WAAW,IAAIN,IAAA,CAACJ,OAAO;MAACiB,SAAS,EAAEA,SAAU;MAAAR,QAAA,EAAEC;IAAW,CAAU,CAAC,EAErEF,KAAK,EAENJ,IAAA,CAACN,eAAe,CAACkC,QAAQ;MAACC,KAAK,EAAEd,oBAAqB;MAAAV,QAAA,EACnDA;IAAQ,CACe,CAAC;EAAA,CACxB,CAAC;AAEV,CAAC;AAED,MAAMyB,gBAAgB,GAAGtC,IAAI,CAACW,QAAQ,CAAC;AACvC2B,gBAAgB,CAACC,WAAW,GAAG,UAAU;AAEzC,SAASD,gBAAgB,IAAI3B,QAAQ"}
1
+ {"version":3,"file":"Fieldset.js","names":["memo","useMemo","styled","FieldsetContext","Legend","Support","useOdysseyDesignTokens","useUniqueId","jsx","_jsx","jsxs","_jsxs","StyledFieldset","fieldset","odysseyDesignTokens","border","margin","Spacing0","marginBlockEnd","Spacing6","maxWidth","TypographyLineLengthMax","padding","Fieldset","alert","children","description","id","idOverride","isDisabled","legend","name","testId","translate","fieldsetContextValue","disabled","Provider","value","MemoizedFieldset","displayName"],"sources":["../src/Fieldset.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { memo, ReactElement, useMemo } from \"react\";\nimport styled from \"@emotion/styled\";\n\nimport { Callout } from \"./Callout\";\nimport { FieldsetContext } from \"./FieldsetContext\";\nimport type { HtmlProps } from \"./HtmlProps\";\nimport { Legend, Support } from \"./Typography\";\nimport {\n useOdysseyDesignTokens,\n DesignTokens,\n} from \"./OdysseyDesignTokensContext\";\nimport { useUniqueId } from \"./useUniqueId\";\n\nconst StyledFieldset = styled.fieldset<{\n odysseyDesignTokens: DesignTokens;\n}>(({ odysseyDesignTokens }) => ({\n border: \"0\",\n margin: odysseyDesignTokens.Spacing0,\n marginBlockEnd: odysseyDesignTokens.Spacing6,\n maxWidth: odysseyDesignTokens.TypographyLineLengthMax,\n padding: odysseyDesignTokens.Spacing0,\n\n \"&:last-child\": {\n marginBlockEnd: odysseyDesignTokens.Spacing0,\n },\n}));\n\nexport type FieldsetProps = {\n /**\n * A Callout indicating a Fieldset-wide error or status update.\n */\n alert?: ReactElement<typeof Callout>;\n /**\n * The Field components within the Fieldset\n */\n children: ReactElement | Array<ReactElement>;\n /**\n * A supplementary description\n */\n description?: string;\n /**\n * Defines a unique identifier (ID) which must be unique in the whole document.\n */\n id?: string;\n /**\n * Disables the component and any wrapped input fields.\n */\n isDisabled?: boolean;\n /**\n * The title of the Fieldset\n */\n legend: string;\n /**\n * The name associated with the group.\n */\n name?: string;\n} & Pick<HtmlProps, \"testId\" | \"translate\">;\n\nconst Fieldset = ({\n alert,\n children,\n description,\n id: idOverride,\n isDisabled = false,\n legend,\n name,\n testId,\n translate,\n}: FieldsetProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const id = useUniqueId(idOverride);\n\n const fieldsetContextValue = useMemo(\n () => ({\n isDisabled,\n }),\n [isDisabled],\n );\n\n return (\n <StyledFieldset\n data-se={testId}\n disabled={isDisabled}\n id={id}\n name={name}\n odysseyDesignTokens={odysseyDesignTokens}\n >\n <Legend translate={translate}>{legend}</Legend>\n\n {description && <Support translate={translate}>{description}</Support>}\n\n {alert}\n\n <FieldsetContext.Provider value={fieldsetContextValue}>\n {children}\n </FieldsetContext.Provider>\n </StyledFieldset>\n );\n};\n\nconst MemoizedFieldset = memo(Fieldset);\nMemoizedFieldset.displayName = \"Fieldset\";\n\nexport { MemoizedFieldset as Fieldset };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,EAAgBC,OAAO,QAAQ,OAAO;AACnD,OAAOC,MAAM,MAAM,iBAAiB;AAAC,SAG5BC,eAAe;AAAA,SAEfC,MAAM,EAAEC,OAAO;AAAA,SAEtBC,sBAAsB;AAAA,SAGfC,WAAW;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAEpB,MAAMC,cAAc,GAAGV,MAAM,CAACW,QAAQ,CAEnC,CAAC;EAAEC;AAAoB,CAAC,MAAM;EAC/BC,MAAM,EAAE,GAAG;EACXC,MAAM,EAAEF,mBAAmB,CAACG,QAAQ;EACpCC,cAAc,EAAEJ,mBAAmB,CAACK,QAAQ;EAC5CC,QAAQ,EAAEN,mBAAmB,CAACO,uBAAuB;EACrDC,OAAO,EAAER,mBAAmB,CAACG,QAAQ;EAErC,cAAc,EAAE;IACdC,cAAc,EAAEJ,mBAAmB,CAACG;EACtC;AACF,CAAC,CAAC,CAAC;AAiCH,MAAMM,QAAQ,GAAGA,CAAC;EAChBC,KAAK;EACLC,QAAQ;EACRC,WAAW;EACXC,EAAE,EAAEC,UAAU;EACdC,UAAU,GAAG,KAAK;EAClBC,MAAM;EACNC,IAAI;EACJC,MAAM;EACNC;AACa,CAAC,KAAK;EACnB,MAAMnB,mBAAmB,GAAGR,sBAAsB,CAAC,CAAC;EACpD,MAAMqB,EAAE,GAAGpB,WAAW,CAACqB,UAAU,CAAC;EAElC,MAAMM,oBAAoB,GAAGjC,OAAO,CAClC,OAAO;IACL4B;EACF,CAAC,CAAC,EACF,CAACA,UAAU,CACb,CAAC;EAED,OACElB,KAAA,CAACC,cAAc;IACb,WAASoB,MAAO;IAChBG,QAAQ,EAAEN,UAAW;IACrBF,EAAE,EAAEA,EAAG;IACPI,IAAI,EAAEA,IAAK;IACXjB,mBAAmB,EAAEA,mBAAoB;IAAAW,QAAA,GAEzChB,IAAA,CAACL,MAAM;MAAC6B,SAAS,EAAEA,SAAU;MAAAR,QAAA,EAAEK;IAAM,CAAS,CAAC,EAE9CJ,WAAW,IAAIjB,IAAA,CAACJ,OAAO;MAAC4B,SAAS,EAAEA,SAAU;MAAAR,QAAA,EAAEC;IAAW,CAAU,CAAC,EAErEF,KAAK,EAENf,IAAA,CAACN,eAAe,CAACiC,QAAQ;MAACC,KAAK,EAAEH,oBAAqB;MAAAT,QAAA,EACnDA;IAAQ,CACe,CAAC;EAAA,CACb,CAAC;AAErB,CAAC;AAED,MAAMa,gBAAgB,GAAGtC,IAAI,CAACuB,QAAQ,CAAC;AACvCe,gBAAgB,CAACC,WAAW,GAAG,UAAU;AAEzC,SAASD,gBAAgB,IAAIf,QAAQ"}
package/dist/Form.js CHANGED
@@ -1,4 +1,3 @@
1
- import _Box from "@mui/material/Box";
2
1
  /*!
3
2
  * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.
4
3
  * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
@@ -12,13 +11,37 @@ import _Box from "@mui/material/Box";
12
11
  */
13
12
 
14
13
  import { memo } from "react";
14
+ import styled from "@emotion/styled";
15
15
  import { Heading4, Support } from "./Typography.js";
16
16
  import { useUniqueId } from "./useUniqueId.js";
17
+ import { useOdysseyDesignTokens } from "./OdysseyDesignTokensContext.js";
17
18
  import { jsx as _jsx } from "react/jsx-runtime";
18
19
  import { jsxs as _jsxs } from "react/jsx-runtime";
19
20
  export const formEncodingTypeValues = ["application/x-www-form-urlencoded", "application/json", "multipart/form-data", "text/plain"];
20
21
  export const formAutoCompleteTypeValues = ["on", "off"];
21
22
  export const formMethodValues = ["post", "get", "dialog"];
23
+ const StyledForm = styled.form(({
24
+ isFullWidth,
25
+ odysseyDesignTokens
26
+ }) => ({
27
+ maxWidth: isFullWidth ? "100%" : odysseyDesignTokens.TypographyLineLengthMax,
28
+ margin: 0,
29
+ padding: 0
30
+ }));
31
+ const TitleContainer = styled.div(({
32
+ odysseyDesignTokens
33
+ }) => ({
34
+ marginBlockEnd: odysseyDesignTokens.Spacing4
35
+ }));
36
+ const FormActionContainer = styled.div({
37
+ display: "flex",
38
+ justifyContent: "flex-end"
39
+ }, ({
40
+ odysseyDesignTokens
41
+ }) => ({
42
+ gap: odysseyDesignTokens.Spacing1,
43
+ marginBlockStart: odysseyDesignTokens.Spacing7
44
+ }));
22
45
  const Form = ({
23
46
  alert,
24
47
  autoCompleteType,
@@ -38,27 +61,21 @@ const Form = ({
38
61
  translate
39
62
  }) => {
40
63
  const id = useUniqueId(idOverride);
41
- return _jsxs(_Box, {
64
+ const odysseyDesignTokens = useOdysseyDesignTokens();
65
+ return _jsxs(StyledForm, {
42
66
  autoComplete: autoCompleteType,
43
- component: "form",
44
67
  "data-se": testId,
45
68
  encType: encodingType,
46
69
  id: id,
70
+ isFullWidth: isFullWidth,
47
71
  method: method,
48
72
  name: name,
49
73
  noValidate: noValidate,
74
+ odysseyDesignTokens: odysseyDesignTokens,
50
75
  onSubmit: onSubmit,
51
76
  target: target,
52
- sx: {
53
- maxWidth: theme => isFullWidth ? "100%" : theme.mixins.maxWidth,
54
- margin: theme => theme.spacing(0),
55
- padding: theme => theme.spacing(0)
56
- },
57
- children: [_jsxs(_Box, {
58
- component: "div",
59
- sx: {
60
- marginBlockEnd: theme => theme.spacing(4)
61
- },
77
+ children: [_jsxs(TitleContainer, {
78
+ odysseyDesignTokens: odysseyDesignTokens,
62
79
  children: [title && _jsx(Heading4, {
63
80
  component: "h1",
64
81
  translate: translate,
@@ -67,17 +84,10 @@ const Form = ({
67
84
  translate: translate,
68
85
  children: description
69
86
  }), alert]
70
- }), _jsx(_Box, {
71
- component: "div",
87
+ }), _jsx("div", {
72
88
  children: children
73
- }), formActions && _jsx(_Box, {
74
- component: "div",
75
- sx: {
76
- display: "flex",
77
- justifyContent: "flex-end",
78
- gap: theme => theme.spacing(1),
79
- marginBlockStart: theme => theme.spacing(7)
80
- },
89
+ }), formActions && _jsx(FormActionContainer, {
90
+ odysseyDesignTokens: odysseyDesignTokens,
81
91
  children: formActions
82
92
  })]
83
93
  });
package/dist/Form.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Form.js","names":["memo","Heading4","Support","useUniqueId","jsx","_jsx","jsxs","_jsxs","formEncodingTypeValues","formAutoCompleteTypeValues","formMethodValues","Form","alert","autoCompleteType","children","description","encodingType","formActions","id","idOverride","isFullWidth","method","name","noValidate","onSubmit","target","testId","title","translate","_Box","autoComplete","component","encType","sx","maxWidth","theme","mixins","margin","spacing","padding","marginBlockEnd","display","justifyContent","gap","marginBlockStart","MemoizedForm","displayName"],"sources":["../src/Form.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 { FormEventHandler, memo, ReactElement } from \"react\";\nimport { Box } from \"@mui/material\";\n\nimport { Button } from \"./Button\";\nimport { Callout } from \"./Callout\";\nimport { FieldComponentProps } from \"./FieldComponentProps\";\nimport type { HtmlProps } from \"./HtmlProps\";\nimport { Heading4, Support } from \"./Typography\";\nimport { useUniqueId } from \"./useUniqueId\";\n\nexport const formEncodingTypeValues = [\n \"application/x-www-form-urlencoded\",\n \"application/json\",\n \"multipart/form-data\",\n \"text/plain\",\n] as const;\nexport const formAutoCompleteTypeValues = [\"on\", \"off\"] as const;\nexport const formMethodValues = [\"post\", \"get\", \"dialog\"] as const;\n\nexport type FormProps = {\n /**\n * A Callout indicating a Form-wide error or status update.\n */\n alert?: ReactElement<typeof Callout>;\n /**\n * Indicates whether input elements can by default have their values automatically completed by the browser.\n * `autocomplete` attributes on form elements override it on <form>\n */\n autoCompleteType?: (typeof formAutoCompleteTypeValues)[number];\n /**\n * The Field or FieldSet components within the Form\n */\n children: ReactElement | Array<ReactElement>;\n /**\n * A supplementary description\n */\n description?: string;\n /**\n * If the value of the method attribute is post, enctype is the MIME type of the form submission.\n * This value can be overridden by formenctype attributes on <button>, <input type=\"submit\">, or <input type=\"image\"> elements.\n */\n encodingType?: (typeof formEncodingTypeValues)[number];\n /**\n * The Field or FieldGroup components within the Form\n */\n formActions?:\n | ReactElement<typeof Button>\n | Array<ReactElement<typeof Button>>;\n /**\n * Defines a unique identifier (ID) which must be unique in the whole document.\n */\n id?: string;\n /**\n * The HTTP method to submit the form with.\n * This value is overridden by formmethod attributes on <button>, <input type=\"submit\">, or <input type=\"image\"> elements.\n */\n method?: (typeof formMethodValues)[number];\n /**\n * The name of the form. The value must not be the empty string, and must be unique among the form elements in the forms collection that it is in, if any.\n */\n name: string;\n /**\n * This Boolean attribute indicates that the form shouldn't be validated when submitted.\n * If this attribute is not set (and therefore the form is validated),\n * it can be overridden by a formnovalidate attribute on a <button>, <input type=\"submit\">, or <input type=\"image\"> element belonging to the form.\n */\n noValidate?: boolean;\n /**\n * Callback that passes the submit event to the consumer\n */\n onSubmit?: FormEventHandler<HTMLFormElement>;\n /**\n * Indicates where to display the response after submitting the form. It is a name/keyword for a browsing context (for example, tab, window, or iframe).\n * This value can be overridden by a formtarget attribute on a <button>, <input type=\"submit\">, or <input type=\"image\"> element.\n */\n target?: string;\n /**\n * The title of the Form\n */\n title?: string;\n} & Pick<FieldComponentProps, \"isFullWidth\"> &\n Pick<HtmlProps, \"testId\" | \"translate\">;\n\nconst Form = ({\n alert,\n autoCompleteType,\n children,\n description,\n encodingType,\n formActions,\n id: idOverride,\n isFullWidth,\n method,\n name,\n noValidate = false,\n onSubmit,\n target,\n testId,\n title,\n translate,\n}: FormProps) => {\n const id = useUniqueId(idOverride);\n\n return (\n <Box\n autoComplete={autoCompleteType}\n component=\"form\"\n data-se={testId}\n encType={encodingType}\n id={id}\n method={method}\n name={name}\n noValidate={noValidate}\n onSubmit={onSubmit}\n target={target}\n sx={{\n maxWidth: (theme) => (isFullWidth ? \"100%\" : theme.mixins.maxWidth),\n margin: (theme) => theme.spacing(0),\n padding: (theme) => theme.spacing(0),\n }}\n >\n <Box\n component=\"div\"\n sx={{\n marginBlockEnd: (theme) => theme.spacing(4),\n }}\n >\n {title && (\n <Heading4 component=\"h1\" translate={translate}>\n {title}\n </Heading4>\n )}\n {description && <Support translate={translate}>{description}</Support>}\n {alert}\n </Box>\n <Box component=\"div\">{children}</Box>\n {formActions && (\n <Box\n component=\"div\"\n sx={{\n display: \"flex\",\n justifyContent: \"flex-end\",\n gap: (theme) => theme.spacing(1),\n marginBlockStart: (theme) => theme.spacing(7),\n }}\n >\n {formActions}\n </Box>\n )}\n </Box>\n );\n};\n\nconst MemoizedForm = memo(Form);\nMemoizedForm.displayName = \"Form\";\n\nexport { MemoizedForm as Form };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAA2BA,IAAI,QAAsB,OAAO;AAAC,SAOpDC,QAAQ,EAAEC,OAAO;AAAA,SACjBC,WAAW;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAEpB,OAAO,MAAMC,sBAAsB,GAAG,CACpC,mCAAmC,EACnC,kBAAkB,EAClB,qBAAqB,EACrB,YAAY,CACJ;AACV,OAAO,MAAMC,0BAA0B,GAAG,CAAC,IAAI,EAAE,KAAK,CAAU;AAChE,OAAO,MAAMC,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ACAZ,WAAW,IAAIV,IAAA,CAACH,OAAO;QAAC0B,SAAS,EAAEA,SAAU;QAAAd,QAAA,EAAEC;MAAW,CAAU,CAAC,EACrEH,KAAK;IAAA,CACH,CAAC,EACNP,IAAA,CAAAwB,IAAA;MAAKE,SAAS,EAAC,KAAK;MAAAjB,QAAA,EAAEA;IAAQ,CAAM,CAAC,EACpCG,WAAW,IACVZ,IAAA,CAAAwB,IAAA;MACEE,SAAS,EAAC,KAAK;MACfE,EAAE,EAAE;QACFQ,OAAO,EAAE,MAAM;QACfC,cAAc,EAAE,UAAU;QAC1BC,GAAG,EAAGR,KAAK,IAAKA,KAAK,CAACG,OAAO,CAAC,CAAC,CAAC;QAChCM,gBAAgB,EAAGT,KAAK,IAAKA,KAAK,CAACG,OAAO,CAAC,CAAC;MAC9C,CAAE;MAAAxB,QAAA,EAEDG;IAAW,CACT,CACN;EAAA,CACE,CAAC;AAEV,CAAC;AAED,MAAM4B,YAAY,GAAG7C,IAAI,CAACW,IAAI,CAAC;AAC/BkC,YAAY,CAACC,WAAW,GAAG,MAAM;AAEjC,SAASD,YAAY,IAAIlC,IAAI"}
1
+ {"version":3,"file":"Form.js","names":["memo","styled","Heading4","Support","useUniqueId","useOdysseyDesignTokens","jsx","_jsx","jsxs","_jsxs","formEncodingTypeValues","formAutoCompleteTypeValues","formMethodValues","StyledForm","form","isFullWidth","odysseyDesignTokens","maxWidth","TypographyLineLengthMax","margin","padding","TitleContainer","div","marginBlockEnd","Spacing4","FormActionContainer","display","justifyContent","gap","Spacing1","marginBlockStart","Spacing7","Form","alert","autoCompleteType","children","description","encodingType","formActions","id","idOverride","method","name","noValidate","onSubmit","target","testId","title","translate","autoComplete","encType","component","MemoizedForm","displayName"],"sources":["../src/Form.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 { FormEventHandler, memo, ReactElement } from \"react\";\nimport styled from \"@emotion/styled\";\n\nimport { Button } from \"./Button\";\nimport { Callout } from \"./Callout\";\nimport { FieldComponentProps } from \"./FieldComponentProps\";\nimport type { HtmlProps } from \"./HtmlProps\";\nimport { Heading4, Support } from \"./Typography\";\nimport { useUniqueId } from \"./useUniqueId\";\nimport {\n useOdysseyDesignTokens,\n DesignTokens,\n} from \"./OdysseyDesignTokensContext\";\n\nexport const formEncodingTypeValues = [\n \"application/x-www-form-urlencoded\",\n \"application/json\",\n \"multipart/form-data\",\n \"text/plain\",\n] as const;\nexport const formAutoCompleteTypeValues = [\"on\", \"off\"] as const;\nexport const formMethodValues = [\"post\", \"get\", \"dialog\"] as const;\n\nconst StyledForm = styled.form<{\n isFullWidth?: boolean;\n odysseyDesignTokens: DesignTokens;\n}>(({ isFullWidth, odysseyDesignTokens }) => ({\n maxWidth: isFullWidth ? \"100%\" : odysseyDesignTokens.TypographyLineLengthMax,\n margin: 0,\n padding: 0,\n}));\n\nconst TitleContainer = styled.div<{\n odysseyDesignTokens: DesignTokens;\n}>(({ odysseyDesignTokens }) => ({\n marginBlockEnd: odysseyDesignTokens.Spacing4,\n}));\n\nconst FormActionContainer = styled.div<{\n odysseyDesignTokens: DesignTokens;\n}>(\n {\n display: \"flex\",\n justifyContent: \"flex-end\",\n },\n ({ odysseyDesignTokens }) => ({\n gap: odysseyDesignTokens.Spacing1,\n marginBlockStart: odysseyDesignTokens.Spacing7,\n }),\n);\n\nexport type FormProps = {\n /**\n * A Callout indicating a Form-wide error or status update.\n */\n alert?: ReactElement<typeof Callout>;\n /**\n * Indicates whether input elements can by default have their values automatically completed by the browser.\n * `autocomplete` attributes on form elements override it on <form>\n */\n autoCompleteType?: (typeof formAutoCompleteTypeValues)[number];\n /**\n * The Field or FieldSet components within the Form\n */\n children: ReactElement | Array<ReactElement>;\n /**\n * A supplementary description\n */\n description?: string;\n /**\n * If the value of the method attribute is post, enctype is the MIME type of the form submission.\n * This value can be overridden by formenctype attributes on <button>, <input type=\"submit\">, or <input type=\"image\"> elements.\n */\n encodingType?: (typeof formEncodingTypeValues)[number];\n /**\n * The Field or FieldGroup components within the Form\n */\n formActions?:\n | ReactElement<typeof Button>\n | Array<ReactElement<typeof Button>>;\n /**\n * Defines a unique identifier (ID) which must be unique in the whole document.\n */\n id?: string;\n /**\n * The HTTP method to submit the form with.\n * This value is overridden by formmethod attributes on <button>, <input type=\"submit\">, or <input type=\"image\"> elements.\n */\n method?: (typeof formMethodValues)[number];\n /**\n * The name of the form. The value must not be the empty string, and must be unique among the form elements in the forms collection that it is in, if any.\n */\n name: string;\n /**\n * This Boolean attribute indicates that the form shouldn't be validated when submitted.\n * If this attribute is not set (and therefore the form is validated),\n * it can be overridden by a formnovalidate attribute on a <button>, <input type=\"submit\">, or <input type=\"image\"> element belonging to the form.\n */\n noValidate?: boolean;\n /**\n * Callback that passes the submit event to the consumer\n */\n onSubmit?: FormEventHandler<HTMLFormElement>;\n /**\n * Indicates where to display the response after submitting the form. It is a name/keyword for a browsing context (for example, tab, window, or iframe).\n * This value can be overridden by a formtarget attribute on a <button>, <input type=\"submit\">, or <input type=\"image\"> element.\n */\n target?: string;\n /**\n * The title of the Form\n */\n title?: string;\n} & Pick<FieldComponentProps, \"isFullWidth\"> &\n Pick<HtmlProps, \"testId\" | \"translate\">;\n\nconst Form = ({\n alert,\n autoCompleteType,\n children,\n description,\n encodingType,\n formActions,\n id: idOverride,\n isFullWidth,\n method,\n name,\n noValidate = false,\n onSubmit,\n target,\n testId,\n title,\n translate,\n}: FormProps) => {\n const id = useUniqueId(idOverride);\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n return (\n <StyledForm\n autoComplete={autoCompleteType}\n data-se={testId}\n encType={encodingType}\n id={id}\n isFullWidth={isFullWidth}\n method={method}\n name={name}\n noValidate={noValidate}\n odysseyDesignTokens={odysseyDesignTokens}\n onSubmit={onSubmit}\n target={target}\n >\n <TitleContainer odysseyDesignTokens={odysseyDesignTokens}>\n {title && (\n <Heading4 component=\"h1\" translate={translate}>\n {title}\n </Heading4>\n )}\n {description && <Support translate={translate}>{description}</Support>}\n {alert}\n </TitleContainer>\n <div>{children}</div>\n {formActions && (\n <FormActionContainer odysseyDesignTokens={odysseyDesignTokens}>\n {formActions}\n </FormActionContainer>\n )}\n </StyledForm>\n );\n};\n\nconst MemoizedForm = memo(Form);\nMemoizedForm.displayName = \"Form\";\n\nexport { MemoizedForm as Form };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAA2BA,IAAI,QAAsB,OAAO;AAC5D,OAAOC,MAAM,MAAM,iBAAiB;AAAC,SAM5BC,QAAQ,EAAEC,OAAO;AAAA,SACjBC,WAAW;AAAA,SAElBC,sBAAsB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAIxB,OAAO,MAAMC,sBAAsB,GAAG,CACpC,mCAAmC,EACnC,kBAAkB,EAClB,qBAAqB,EACrB,YAAY,CACJ;AACV,OAAO,MAAMC,0BAA0B,GAAG,CAAC,IAAI,EAAE,KAAK,CAAU;AAChE,OAAO,MAAMC,gBAAgB,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAU;AAElE,MAAMC,UAAU,GAAGZ,MAAM,CAACa,IAAI,CAG3B,CAAC;EAAEC,WAAW;EAAEC;AAAoB,CAAC,MAAM;EAC5CC,QAAQ,EAAEF,WAAW,GAAG,MAAM,GAAGC,mBAAmB,CAACE,uBAAuB;EAC5EC,MAAM,EAAE,CAAC;EACTC,OAAO,EAAE;AACX,CAAC,CAAC,CAAC;AAEH,MAAMC,cAAc,GAAGp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,EAAEA,SAAU;QAAAb,QAAA,EAC3CY;MAAK,CACE,CACX,EACAX,WAAW,IAAI7B,IAAA,CAACJ,OAAO;QAAC6C,SAAS,EAAEA,SAAU;QAAAb,QAAA,EAAEC;MAAW,CAAU,CAAC,EACrEH,KAAK;IAAA,CACQ,CAAC,EACjB1B,IAAA;MAAA4B,QAAA,EAAMA;IAAQ,CAAM,CAAC,EACpBG,WAAW,IACV/B,IAAA,CAACkB,mBAAmB;MAACT,mBAAmB,EAAEA,mBAAoB;MAAAmB,QAAA,EAC3DG;IAAW,CACO,CACtB;EAAA,CACS,CAAC;AAEjB,CAAC;AAED,MAAMc,YAAY,GAAGpD,IAAI,CAACgC,IAAI,CAAC;AAC/BoB,YAAY,CAACC,WAAW,GAAG,MAAM;AAEjC,SAASD,YAAY,IAAIpB,IAAI"}
@@ -70,7 +70,7 @@ const MenuButton = ({
70
70
  ariaDescribedBy: ariaDescribedBy,
71
71
  ariaLabel: ariaLabel,
72
72
  ariaLabelledBy: ariaLabelledBy,
73
- "data-se": testId,
73
+ testId: testId,
74
74
  endIcon: endIcon,
75
75
  id: `${uniqueId}-button`,
76
76
  isDisabled: isDisabled,
@@ -1 +1 @@
1
- {"version":3,"file":"MenuButton.js","names":["memo","useCallback","useMemo","useState","Button","useUniqueId","ChevronDownIcon","MoreIcon","MenuContext","jsx","_jsx","jsxs","_jsxs","menuAlignmentValues","MenuButton","ariaLabel","ariaLabelledBy","ariaDescribedBy","buttonLabel","buttonVariant","children","shouldCloseOnSelect","endIcon","endIconProp","id","idOverride","isDisabled","isOverflow","menuAlignment","size","testId","tooltipText","translate","anchorEl","setAnchorEl","isOpen","Boolean","closeMenu","openMenu","event","currentTarget","uniqueId","menuListProps","providerValue","anchorOrigin","horizontal","vertical","transformOrigin","ariaControls","undefined","ariaExpanded","ariaHasPopup","label","onClick","variant","_Menu","MenuListProps","onClose","open","Provider","value","MemoizedMenuButton","displayName"],"sources":["../src/MenuButton.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { memo, type ReactElement, useCallback, useMemo, useState } from \"react\";\nimport {\n Divider,\n ListSubheader,\n Menu as MuiMenu,\n PopoverOrigin,\n} from \"@mui/material\";\n\nimport {\n Button,\n buttonSizeValues,\n buttonVariantValues,\n MenuItem,\n useUniqueId,\n} from \"./\";\nimport { ChevronDownIcon, MoreIcon } from \"./icons.generated\";\nimport { FieldComponentProps } from \"./FieldComponentProps\";\nimport { MenuContext, MenuContextType } from \"./MenuContext\";\nimport { NullElement } from \"./NullElement\";\nimport type { HtmlProps } from \"./HtmlProps\";\n\nexport const menuAlignmentValues = [\"left\", \"right\"] as const;\n\nexport type MenuButtonProps = {\n /**\n * The label on the triggering Button\n */\n buttonLabel?: string;\n /**\n * The variant of the triggering Button\n */\n buttonVariant?: (typeof buttonVariantValues)[number];\n /**\n * The <MenuItem> components within the Menu.\n */\n children:\n | ReactElement<typeof MenuItem | typeof Divider | typeof ListSubheader>\n | Array<\n | ReactElement<typeof MenuItem | typeof Divider | typeof ListSubheader>\n | NullElement\n >\n | NullElement;\n /**\n * The end Icon on the trigggering Button\n */\n endIcon?: ReactElement;\n /**\n * The id of the Button\n */\n id?: string;\n /**\n * If the MenuButton is an overflow menu or standard menu.\n */\n isOverflow?: boolean;\n /**\n * The horizontal alignment of the menu.\n */\n menuAlignment?: (typeof menuAlignmentValues)[number];\n /**\n * If true (the default), the menu will close when a child MenuItem is clicked.\n * Otherwise, it will remain open.\n */\n shouldCloseOnSelect?: boolean;\n /**\n * The size of the button\n */\n size?: (typeof buttonSizeValues)[number];\n /**\n * The tooltip text for the Button if it's icon-only\n */\n tooltipText?: string;\n} & Pick<\n HtmlProps,\n \"ariaDescribedBy\" | \"ariaLabel\" | \"ariaLabelledBy\" | \"testId\" | \"translate\"\n> &\n Pick<FieldComponentProps, \"isDisabled\"> &\n (\n | { buttonLabel: string }\n | (Required<Pick<HtmlProps, \"ariaLabelledBy\">> &\n Partial<Pick<HtmlProps, \"ariaLabel\">> & {\n buttonLabel?: undefined | \"\";\n })\n | (Required<Pick<HtmlProps, \"ariaLabel\">> &\n Partial<Pick<HtmlProps, \"ariaLabelledBy\">> & {\n buttonLabel?: undefined | \"\";\n })\n );\n\nconst MenuButton = ({\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy,\n buttonLabel = \"\",\n buttonVariant = \"secondary\",\n children,\n shouldCloseOnSelect = true,\n endIcon: endIconProp,\n id: idOverride,\n isDisabled,\n isOverflow,\n menuAlignment = \"left\",\n size,\n testId,\n tooltipText,\n translate,\n}: MenuButtonProps) => {\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);\n\n const isOpen = Boolean(anchorEl);\n\n const closeMenu = useCallback(() => {\n setAnchorEl(null);\n }, []);\n\n const openMenu = useCallback<MenuContextType[\"openMenu\"]>((event) => {\n setAnchorEl(event.currentTarget);\n }, []);\n\n const uniqueId = useUniqueId(idOverride);\n\n const menuListProps = useMemo(\n () => ({ \"aria-labelledby\": `${uniqueId}-button` }),\n [uniqueId],\n );\n\n const providerValue = useMemo<MenuContextType>(\n () => ({\n closeMenu,\n openMenu,\n shouldCloseOnSelect,\n }),\n [closeMenu, openMenu, shouldCloseOnSelect],\n );\n\n const endIcon = endIconProp ? (\n endIconProp\n ) : isOverflow ? (\n <MoreIcon />\n ) : (\n <ChevronDownIcon />\n );\n\n const anchorOrigin = useMemo(\n () =>\n ({\n horizontal: menuAlignment,\n vertical: \"bottom\",\n }) as PopoverOrigin,\n [menuAlignment],\n );\n\n const transformOrigin = useMemo(\n () =>\n ({\n horizontal: menuAlignment,\n vertical: \"top\",\n }) as PopoverOrigin,\n [menuAlignment],\n );\n\n return (\n <div>\n <Button\n ariaControls={isOpen ? `${uniqueId}-menu` : undefined}\n ariaExpanded={isOpen ? \"true\" : undefined}\n ariaHasPopup=\"true\"\n ariaDescribedBy={ariaDescribedBy}\n ariaLabel={ariaLabel}\n ariaLabelledBy={ariaLabelledBy}\n data-se={testId}\n endIcon={endIcon}\n id={`${uniqueId}-button`}\n isDisabled={isDisabled}\n label={buttonLabel}\n onClick={openMenu}\n size={size}\n tooltipText={tooltipText}\n translate={translate}\n variant={buttonVariant}\n />\n\n <MuiMenu\n anchorOrigin={anchorOrigin}\n transformOrigin={transformOrigin}\n anchorEl={anchorEl}\n id={`${uniqueId}-menu`}\n MenuListProps={menuListProps}\n onClose={closeMenu}\n open={isOpen}\n >\n <MenuContext.Provider value={providerValue}>\n {children}\n </MenuContext.Provider>\n </MuiMenu>\n </div>\n );\n};\n\nconst MemoizedMenuButton = memo(MenuButton);\nMemoizedMenuButton.displayName = \"MenuButton\";\n\nexport { MemoizedMenuButton as MenuButton };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,EAAqBC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAAC,SAS9EC,MAAM,EAINC,WAAW;AAAA,SAEJC,eAAe,EAAEC,QAAQ;AAAA,SAEzBC,WAAW;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAIpB,OAAO,MAAMC,mBAAmB,GAAG,CAAC,MAAM,EAAE,OAAO,CAAU;AAmE7D,MAAMC,UAAU,GAAGA,CAAC;EAClBC,SAAS;EACTC,cAAc;EACdC,eAAe;EACfC,WAAW,GAAG,EAAE;EAChBC,aAAa,GAAG,WAAW;EAC3BC,QAAQ;EACRC,mBAAmB,GAAG,IAAI;EAC1BC,OAAO,EAAEC,WAAW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AAC,CAAkB,EACrB,CAAClB,aAAa,CAChB,CAAC;EAED,OACEhB,KAAA;IAAAQ,QAAA,GACEV,IAAA,CAACN,MAAM;MACL4C,YAAY,EAAEb,MAAM,GAAI,GAAEM,QAAS,OAAM,GAAGQ,SAAU;MACtDC,YAAY,EAAEf,MAAM,GAAG,MAAM,GAAGc,SAAU;MAC1CE,YAAY,EAAC,MAAM;MACnBlC,eAAe,EAAEA,eAAgB;MACjCF,SAAS,EAAEA,SAAU;MACrBC,cAAc,EAAEA,cAAe;MAC/B,WAASc,MAAO;MAChBR,OAAO,EAAEA,OAAQ;MACjBE,EAAE,EAAG,GAAEiB,QAAS,SAAS;MACzBf,UAAU,EAAEA,UAAW;MACvB0B,KAAK,EAAElC,WAAY;MACnBmC,OAAO,EAAEf,QAAS;MAClBT,IAAI,EAAEA,IAAK;MACXE,WAAW,EAAEA,WAAY;MACzBC,SAAS,EAAEA,SAAU;MACrBsB,OAAO,EAAEnC;IAAc,CACxB,CAAC,EAEFT,IAAA,CAAA6C,KAAA;MACEX,YAAY,EAAEA,YAAa;MAC3BG,eAAe,EAAEA,eAAgB;MACjCd,QAAQ,EAAEA,QAAS;MACnBT,EAAE,EAAG,GAAEiB,QAAS,OAAO;MACvBe,aAAa,EAAEd,aAAc;MAC7Be,OAAO,EAAEpB,SAAU;MACnBqB,IAAI,EAAEvB,MAAO;MAAAf,QAAA,EAEbV,IAAA,CAACF,WAAW,CAACmD,QAAQ;QAACC,KAAK,EAAEjB,aAAc;QAAAvB,QAAA,EACxCA;MAAQ,CACW;IAAC,CAChB,CAAC;EAAA,CACP,CAAC;AAEV,CAAC;AAED,MAAMyC,kBAAkB,GAAG7D,IAAI,CAACc,UAAU,CAAC;AAC3C+C,kBAAkB,CAACC,WAAW,GAAG,YAAY;AAE7C,SAASD,kBAAkB,IAAI/C,UAAU"}
1
+ {"version":3,"file":"MenuButton.js","names":["memo","useCallback","useMemo","useState","Button","useUniqueId","ChevronDownIcon","MoreIcon","MenuContext","jsx","_jsx","jsxs","_jsxs","menuAlignmentValues","MenuButton","ariaLabel","ariaLabelledBy","ariaDescribedBy","buttonLabel","buttonVariant","children","shouldCloseOnSelect","endIcon","endIconProp","id","idOverride","isDisabled","isOverflow","menuAlignment","size","testId","tooltipText","translate","anchorEl","setAnchorEl","isOpen","Boolean","closeMenu","openMenu","event","currentTarget","uniqueId","menuListProps","providerValue","anchorOrigin","horizontal","vertical","transformOrigin","ariaControls","undefined","ariaExpanded","ariaHasPopup","label","onClick","variant","_Menu","MenuListProps","onClose","open","Provider","value","MemoizedMenuButton","displayName"],"sources":["../src/MenuButton.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { memo, type ReactElement, useCallback, useMemo, useState } from \"react\";\nimport {\n Divider,\n ListSubheader,\n Menu as MuiMenu,\n PopoverOrigin,\n} from \"@mui/material\";\n\nimport {\n Button,\n buttonSizeValues,\n buttonVariantValues,\n MenuItem,\n useUniqueId,\n} from \"./\";\nimport { ChevronDownIcon, MoreIcon } from \"./icons.generated\";\nimport { FieldComponentProps } from \"./FieldComponentProps\";\nimport { MenuContext, MenuContextType } from \"./MenuContext\";\nimport { NullElement } from \"./NullElement\";\nimport type { HtmlProps } from \"./HtmlProps\";\n\nexport const menuAlignmentValues = [\"left\", \"right\"] as const;\n\nexport type MenuButtonProps = {\n /**\n * The label on the triggering Button\n */\n buttonLabel?: string;\n /**\n * The variant of the triggering Button\n */\n buttonVariant?: (typeof buttonVariantValues)[number];\n /**\n * The <MenuItem> components within the Menu.\n */\n children:\n | ReactElement<typeof MenuItem | typeof Divider | typeof ListSubheader>\n | Array<\n | ReactElement<typeof MenuItem | typeof Divider | typeof ListSubheader>\n | NullElement\n >\n | NullElement;\n /**\n * The end Icon on the trigggering Button\n */\n endIcon?: ReactElement;\n /**\n * The id of the Button\n */\n id?: string;\n /**\n * If the MenuButton is an overflow menu or standard menu.\n */\n isOverflow?: boolean;\n /**\n * The horizontal alignment of the menu.\n */\n menuAlignment?: (typeof menuAlignmentValues)[number];\n /**\n * If true (the default), the menu will close when a child MenuItem is clicked.\n * Otherwise, it will remain open.\n */\n shouldCloseOnSelect?: boolean;\n /**\n * The size of the button\n */\n size?: (typeof buttonSizeValues)[number];\n /**\n * The tooltip text for the Button if it's icon-only\n */\n tooltipText?: string;\n} & Pick<\n HtmlProps,\n \"ariaDescribedBy\" | \"ariaLabel\" | \"ariaLabelledBy\" | \"testId\" | \"translate\"\n> &\n Pick<FieldComponentProps, \"isDisabled\"> &\n (\n | { buttonLabel: string }\n | (Required<Pick<HtmlProps, \"ariaLabelledBy\">> &\n Partial<Pick<HtmlProps, \"ariaLabel\">> & {\n buttonLabel?: undefined | \"\";\n })\n | (Required<Pick<HtmlProps, \"ariaLabel\">> &\n Partial<Pick<HtmlProps, \"ariaLabelledBy\">> & {\n buttonLabel?: undefined | \"\";\n })\n );\n\nconst MenuButton = ({\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy,\n buttonLabel = \"\",\n buttonVariant = \"secondary\",\n children,\n shouldCloseOnSelect = true,\n endIcon: endIconProp,\n id: idOverride,\n isDisabled,\n isOverflow,\n menuAlignment = \"left\",\n size,\n testId,\n tooltipText,\n translate,\n}: MenuButtonProps) => {\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);\n\n const isOpen = Boolean(anchorEl);\n\n const closeMenu = useCallback(() => {\n setAnchorEl(null);\n }, []);\n\n const openMenu = useCallback<MenuContextType[\"openMenu\"]>((event) => {\n setAnchorEl(event.currentTarget);\n }, []);\n\n const uniqueId = useUniqueId(idOverride);\n\n const menuListProps = useMemo(\n () => ({ \"aria-labelledby\": `${uniqueId}-button` }),\n [uniqueId],\n );\n\n const providerValue = useMemo<MenuContextType>(\n () => ({\n closeMenu,\n openMenu,\n shouldCloseOnSelect,\n }),\n [closeMenu, openMenu, shouldCloseOnSelect],\n );\n\n const endIcon = endIconProp ? (\n endIconProp\n ) : isOverflow ? (\n <MoreIcon />\n ) : (\n <ChevronDownIcon />\n );\n\n const anchorOrigin = useMemo(\n () =>\n ({\n horizontal: menuAlignment,\n vertical: \"bottom\",\n }) as PopoverOrigin,\n [menuAlignment],\n );\n\n const transformOrigin = useMemo(\n () =>\n ({\n horizontal: menuAlignment,\n vertical: \"top\",\n }) as PopoverOrigin,\n [menuAlignment],\n );\n\n return (\n <div>\n <Button\n ariaControls={isOpen ? `${uniqueId}-menu` : undefined}\n ariaExpanded={isOpen ? \"true\" : undefined}\n ariaHasPopup=\"true\"\n ariaDescribedBy={ariaDescribedBy}\n ariaLabel={ariaLabel}\n ariaLabelledBy={ariaLabelledBy}\n testId={testId}\n endIcon={endIcon}\n id={`${uniqueId}-button`}\n isDisabled={isDisabled}\n label={buttonLabel}\n onClick={openMenu}\n size={size}\n tooltipText={tooltipText}\n translate={translate}\n variant={buttonVariant}\n />\n\n <MuiMenu\n anchorOrigin={anchorOrigin}\n transformOrigin={transformOrigin}\n anchorEl={anchorEl}\n id={`${uniqueId}-menu`}\n MenuListProps={menuListProps}\n onClose={closeMenu}\n open={isOpen}\n >\n <MenuContext.Provider value={providerValue}>\n {children}\n </MenuContext.Provider>\n </MuiMenu>\n </div>\n );\n};\n\nconst MemoizedMenuButton = memo(MenuButton);\nMemoizedMenuButton.displayName = \"MenuButton\";\n\nexport { MemoizedMenuButton as MenuButton };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,EAAqBC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAA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nBqB,IAAI,EAAEvB,MAAO;MAAAf,QAAA,EAEbV,IAAA,CAACF,WAAW,CAACmD,QAAQ;QAACC,KAAK,EAAEjB,aAAc;QAAAvB,QAAA,EACxCA;MAAQ,CACW;IAAC,CAChB,CAAC;EAAA,CACP,CAAC;AAEV,CAAC;AAED,MAAMyC,kBAAkB,GAAG7D,IAAI,CAACc,UAAU,CAAC;AAC3C+C,kBAAkB,CAACC,WAAW,GAAG,YAAY;AAE7C,SAASD,kBAAkB,IAAI/C,UAAU"}
@@ -66,7 +66,7 @@ const SearchField = forwardRef(({
66
66
  autoComplete: autoCompleteType,
67
67
  autoFocus: hasInitialFocus,
68
68
  "data-se": testId,
69
- endAdornment: defaultValue && _jsx(_InputAdornment, {
69
+ endAdornment: (inputValues?.defaultValue || inputValues?.value) && _jsx(_InputAdornment, {
70
70
  position: "end",
71
71
  children: _jsx(_IconButton, {
72
72
  "aria-label": "Clear",
@@ -91,7 +91,7 @@ const SearchField = forwardRef(({
91
91
  }),
92
92
  translate: translate,
93
93
  type: "search"
94
- }), [autoCompleteType, defaultValue, hasInitialFocus, inputValues, isDisabled, nameOverride, onBlur, onChange, onClear, onFocus, placeholder, ref, tabIndex, testId, translate, variant]);
94
+ }), [autoCompleteType, hasInitialFocus, inputValues, isDisabled, nameOverride, onBlur, onChange, onClear, onFocus, placeholder, ref, tabIndex, testId, translate, variant]);
95
95
  return _jsx(Field, {
96
96
  ariaDescribedBy: ariaDescribedBy,
97
97
  fieldType: "single",
@@ -1 +1 @@
1
- {"version":3,"file":"SearchField.js","names":["forwardRef","memo","useCallback","useRef","CloseCircleFilledIcon","SearchIcon","Field","getControlState","useInputValues","jsx","_jsx","searchVariantValues","SearchField","ariaDescribedBy","autoCompleteType","defaultValue","hasInitialFocus","id","idOverride","isDisabled","isFullWidth","label","name","nameOverride","onChange","onChangeProp","onFocus","onBlur","onClear","onClearProp","placeholder","tabIndex","testId","translate","value","variant","ref","event","controlledStateRef","controlledValue","uncontrolledValue","inputValues","controlState","current","renderFieldComponent","_InputBase","inputProps","autoComplete","autoFocus","endAdornment","_InputAdornment","position","children","_IconButton","disabled","onClick","size","startAdornment","type","fieldType","hasVisibleLabel","isOptional","MemoizedSearchField","displayName"],"sources":["../src/SearchField.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 { InputAdornment, InputBase, IconButton } from \"@mui/material\";\nimport {\n ChangeEventHandler,\n FocusEventHandler,\n forwardRef,\n HTMLAttributes,\n InputHTMLAttributes,\n memo,\n useCallback,\n useRef,\n} from \"react\";\n\nimport { CloseCircleFilledIcon, SearchIcon } from \"./icons.generated\";\nimport { Field } from \"./Field\";\nimport {\n FieldComponentProps,\n FieldComponentRenderProps,\n} from \"./FieldComponentProps\";\nimport type { HtmlProps } from \"./HtmlProps\";\nimport { getControlState, useInputValues } from \"./inputUtils\";\n\nexport const searchVariantValues = [\"outline\", \"filled\"] as const;\n\nexport type SearchFieldProps = {\n /**\n * This prop helps users to fill forms faster, especially on mobile devices.\n * The name can be confusing, as it's more like an autofill.\n * You can learn more about it [following the specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill).\n */\n autoCompleteType?: InputHTMLAttributes<HTMLInputElement>[\"autoComplete\"];\n /**\n * The value of the `input` element to use when uncontrolled.\n */\n defaultValue?: string;\n /**\n * If `true`, the component will receive focus automatically.\n */\n hasInitialFocus?: boolean;\n /**\n * The id of the `input` element.\n */\n id?: string;\n /**\n * If `true`, the component is disabled.\n */\n isDisabled?: boolean;\n /**\n * This label won't show up visually, but it's required for accessibility.\n */\n label: string;\n /**\n * Callback fired when the `input` element loses focus.\n */\n onBlur?: FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;\n /**\n * Callback fired when the clear button is pressed.\n */\n onClear?: () => void;\n /**\n * Callback fired when the value is changed.\n */\n onChange?: ChangeEventHandler<HTMLTextAreaElement | HTMLInputElement>;\n /**\n * Callback fired when the `input` element get focus.\n */\n onFocus?: FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;\n /**\n * The short hint displayed in the `input` before the user enters a value.\n */\n placeholder?: string;\n\n tabIndex?: HTMLAttributes<HTMLElement>[\"tabIndex\"];\n /**\n * The value of the `input` element, to use when controlled.\n */\n value?: string;\n /**\n * Whether the SearchField has a gray or white background\n */\n variant?: (typeof searchVariantValues)[number];\n} & Pick<FieldComponentProps, \"id\" | \"isDisabled\" | \"name\" | \"isFullWidth\"> &\n Pick<HtmlProps, \"ariaDescribedBy\" | \"testId\" | \"translate\">;\n\ntype FieldRenderProps = Partial<Pick<HtmlProps, \"ariaDescribedBy\">> &\n Pick<FieldComponentRenderProps, \"id\">;\n\nconst SearchField = forwardRef<HTMLInputElement, SearchFieldProps>(\n (\n {\n ariaDescribedBy,\n autoCompleteType,\n defaultValue,\n hasInitialFocus,\n id: idOverride,\n isDisabled = false,\n isFullWidth = false,\n label,\n name: nameOverride,\n onChange: onChangeProp,\n onFocus,\n onBlur,\n onClear: onClearProp,\n placeholder,\n tabIndex,\n testId,\n translate,\n value,\n variant = \"outline\",\n },\n ref,\n ) => {\n const onChange: ChangeEventHandler<HTMLTextAreaElement | HTMLInputElement> =\n useCallback(\n (event) => {\n onChangeProp?.(event);\n },\n [onChangeProp],\n );\n\n const onClear = useCallback(() => {\n onClearProp?.();\n }, [onClearProp]);\n\n const controlledStateRef = useRef(\n getControlState({\n controlledValue: value,\n uncontrolledValue: defaultValue,\n }),\n );\n const inputValues = useInputValues({\n defaultValue,\n value,\n controlState: controlledStateRef.current,\n });\n\n const renderFieldComponent = useCallback(\n ({ ariaDescribedBy, id }: FieldRenderProps) => (\n <InputBase\n {...inputValues}\n inputProps={{\n tabIndex,\n }}\n aria-describedby={ariaDescribedBy}\n autoComplete={autoCompleteType}\n /* eslint-disable-next-line jsx-a11y/no-autofocus */\n autoFocus={hasInitialFocus}\n data-se={testId}\n endAdornment={\n defaultValue && (\n <InputAdornment position=\"end\">\n <IconButton\n aria-label=\"Clear\"\n disabled={isDisabled}\n onClick={onClear}\n size=\"small\"\n >\n <CloseCircleFilledIcon />\n </IconButton>\n </InputAdornment>\n )\n }\n id={id}\n data-ods-type=\"search\"\n data-ods-variant={variant}\n name={nameOverride ?? id}\n onBlur={onBlur}\n onChange={onChange}\n onFocus={onFocus}\n placeholder={placeholder}\n ref={ref}\n startAdornment={\n <InputAdornment position=\"start\">\n <SearchIcon />\n </InputAdornment>\n }\n translate={translate}\n type=\"search\"\n />\n ),\n [\n autoCompleteType,\n defaultValue,\n hasInitialFocus,\n inputValues,\n isDisabled,\n nameOverride,\n onBlur,\n onChange,\n onClear,\n onFocus,\n placeholder,\n ref,\n tabIndex,\n testId,\n translate,\n variant,\n ],\n );\n\n return (\n <Field\n ariaDescribedBy={ariaDescribedBy}\n fieldType=\"single\"\n hasVisibleLabel={false}\n id={idOverride}\n isDisabled={isDisabled}\n isFullWidth={isFullWidth}\n isOptional={true}\n label={label}\n renderFieldComponent={renderFieldComponent}\n />\n );\n },\n);\n\nconst MemoizedSearchField = memo(SearchField);\nMemoizedSearchField.displayName = \"SearchField\";\n\nexport { MemoizedSearchField as SearchField };\n"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,SAGEA,UAAU,EAGVC,IAAI,EACJC,WAAW,EACXC,MAAM,QACD,OAAO;AAAC,SAENC,qBAAqB,EAAEC,UAAU;AAAA,SACjCC,KAAK;AAAA,SAMLC,eAAe,EAAEC,cAAc;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAExC,OAAO,MAAMC,mBAAmB,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CAAC;AAED,MAAMkB,mBAAmB,GAAG7D,IAAI,CAACW,WAAW,CAAC;AAC7CkD,mBAAmB,CAACC,WAAW,GAAG,aAAa;AAE/C,SAASD,mBAAmB,IAAIlD,WAAW"}
1
+ {"version":3,"file":"SearchField.js","names":["forwardRef","memo","useCallback","useRef","CloseCircleFilledIcon","SearchIcon","Field","getControlState","useInputValues","jsx","_jsx","searchVariantValues","SearchField","ariaDescribedBy","autoCompleteType","defaultValue","hasInitialFocus","id","idOverride","isDisabled","isFullWidth","label","name","nameOverride","onChange","onChangeProp","onFocus","onBlur","onClear","onClearProp","placeholder","tabIndex","testId","translate","value","variant","ref","event","controlledStateRef","controlledValue","uncontrolledValue","inputValues","controlState","current","renderFieldComponent","_InputBase","inputProps","autoComplete","autoFocus","endAdornment","_InputAdornment","position","children","_IconButton","disabled","onClick","size","startAdornment","type","fieldType","hasVisibleLabel","isOptional","MemoizedSearchField","displayName"],"sources":["../src/SearchField.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 { InputAdornment, InputBase, IconButton } from \"@mui/material\";\nimport {\n ChangeEventHandler,\n FocusEventHandler,\n forwardRef,\n HTMLAttributes,\n InputHTMLAttributes,\n memo,\n useCallback,\n useRef,\n} from \"react\";\n\nimport { CloseCircleFilledIcon, SearchIcon } from \"./icons.generated\";\nimport { Field } from \"./Field\";\nimport {\n FieldComponentProps,\n FieldComponentRenderProps,\n} from \"./FieldComponentProps\";\nimport type { HtmlProps } from \"./HtmlProps\";\nimport { getControlState, useInputValues } from \"./inputUtils\";\n\nexport const searchVariantValues = [\"outline\", \"filled\"] as const;\n\nexport type SearchFieldProps = {\n /**\n * This prop helps users to fill forms faster, especially on mobile devices.\n * The name can be confusing, as it's more like an autofill.\n * You can learn more about it [following the specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill).\n */\n autoCompleteType?: InputHTMLAttributes<HTMLInputElement>[\"autoComplete\"];\n /**\n * The value of the `input` element to use when uncontrolled.\n */\n defaultValue?: string;\n /**\n * If `true`, the component will receive focus automatically.\n */\n hasInitialFocus?: boolean;\n /**\n * The id of the `input` element.\n */\n id?: string;\n /**\n * If `true`, the component is disabled.\n */\n isDisabled?: boolean;\n /**\n * This label won't show up visually, but it's required for accessibility.\n */\n label: string;\n /**\n * Callback fired when the `input` element loses focus.\n */\n onBlur?: FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;\n /**\n * Callback fired when the clear button is pressed.\n */\n onClear?: () => void;\n /**\n * Callback fired when the value is changed.\n */\n onChange?: ChangeEventHandler<HTMLTextAreaElement | HTMLInputElement>;\n /**\n * Callback fired when the `input` element get focus.\n */\n onFocus?: FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;\n /**\n * The short hint displayed in the `input` before the user enters a value.\n */\n placeholder?: string;\n\n tabIndex?: HTMLAttributes<HTMLElement>[\"tabIndex\"];\n /**\n * The value of the `input` element, to use when controlled.\n */\n value?: string;\n /**\n * Whether the SearchField has a gray or white background\n */\n variant?: (typeof searchVariantValues)[number];\n} & Pick<FieldComponentProps, \"id\" | \"isDisabled\" | \"name\" | \"isFullWidth\"> &\n Pick<HtmlProps, \"ariaDescribedBy\" | \"testId\" | \"translate\">;\n\ntype FieldRenderProps = Partial<Pick<HtmlProps, \"ariaDescribedBy\">> &\n Pick<FieldComponentRenderProps, \"id\">;\n\nconst SearchField = forwardRef<HTMLInputElement, SearchFieldProps>(\n (\n {\n ariaDescribedBy,\n autoCompleteType,\n defaultValue,\n hasInitialFocus,\n id: idOverride,\n isDisabled = false,\n isFullWidth = false,\n label,\n name: nameOverride,\n onChange: onChangeProp,\n onFocus,\n onBlur,\n onClear: onClearProp,\n placeholder,\n tabIndex,\n testId,\n translate,\n value,\n variant = \"outline\",\n },\n ref,\n ) => {\n const onChange: ChangeEventHandler<HTMLTextAreaElement | HTMLInputElement> =\n useCallback(\n (event) => {\n onChangeProp?.(event);\n },\n [onChangeProp],\n );\n\n const onClear = useCallback(() => {\n onClearProp?.();\n }, [onClearProp]);\n\n const controlledStateRef = useRef(\n getControlState({\n controlledValue: value,\n uncontrolledValue: defaultValue,\n }),\n );\n const inputValues = useInputValues({\n defaultValue,\n value,\n controlState: controlledStateRef.current,\n });\n\n const renderFieldComponent = useCallback(\n ({ ariaDescribedBy, id }: FieldRenderProps) => (\n <InputBase\n {...inputValues}\n inputProps={{\n tabIndex,\n }}\n aria-describedby={ariaDescribedBy}\n autoComplete={autoCompleteType}\n /* eslint-disable-next-line jsx-a11y/no-autofocus */\n autoFocus={hasInitialFocus}\n data-se={testId}\n endAdornment={\n (inputValues?.defaultValue || inputValues?.value) && (\n <InputAdornment position=\"end\">\n <IconButton\n aria-label=\"Clear\"\n disabled={isDisabled}\n onClick={onClear}\n size=\"small\"\n >\n <CloseCircleFilledIcon />\n </IconButton>\n </InputAdornment>\n )\n }\n id={id}\n data-ods-type=\"search\"\n data-ods-variant={variant}\n name={nameOverride ?? id}\n onBlur={onBlur}\n onChange={onChange}\n onFocus={onFocus}\n placeholder={placeholder}\n ref={ref}\n startAdornment={\n <InputAdornment position=\"start\">\n <SearchIcon />\n </InputAdornment>\n }\n translate={translate}\n type=\"search\"\n />\n ),\n [\n autoCompleteType,\n hasInitialFocus,\n inputValues,\n isDisabled,\n nameOverride,\n onBlur,\n onChange,\n onClear,\n onFocus,\n placeholder,\n ref,\n tabIndex,\n testId,\n translate,\n variant,\n ],\n );\n\n return (\n <Field\n ariaDescribedBy={ariaDescribedBy}\n fieldType=\"single\"\n hasVisibleLabel={false}\n id={idOverride}\n isDisabled={isDisabled}\n isFullWidth={isFullWidth}\n isOptional={true}\n label={label}\n renderFieldComponent={renderFieldComponent}\n />\n );\n },\n);\n\nconst MemoizedSearchField = memo(SearchField);\nMemoizedSearchField.displayName = \"SearchField\";\n\nexport { MemoizedSearchField as SearchField };\n"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,SAGEA,UAAU,EAGVC,IAAI,EACJC,WAAW,EACXC,MAAM,QACD,OAAO;AAAC,SAENC,qBAAqB,EAAEC,UAAU;AAAA,SACjCC,KAAK;AAAA,SAMLC,eAAe,EAAEC,cAAc;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAExC,OAAO,MAAMC,mBAAmB,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAU;AAiEjE,MAAMC,WAAW,GAAGZ,UAAU,CAC5B,CACE;EACEa,eAAe;EACfC,gBAAgB;EAChBC,YAAY;EACZC,eAAe;EACfC,EAAE,EAAEC,UAAU;EACdC,UAAU,GAAG,KAAK;EAClBC,WAAW,GAAG,KAAK;EACnBC,KAAK;EACLC,IAAI,EAAEC,YAAY;EAClBC,QAAQ,EAAEC,YAAY;EACtBC,OAAO;EACPC,MAAM;EACNC,OAAO,EAAEC,WAAW;EACpBC,WAAW;EACXC,QAAQ;EACRC,MAAM;EACNC,SAAS;EACTC,KAAK;EACLC,OAAO,GAAG;AACZ,CAAC,EACDC,GAAG,KACA;EACH,MAAMZ,QAAoE,GACxEtB,WAAW,CACRmC,KAAK,IAAK;IACTZ,YAAY,GAAGY,KAAK,CAAC;EACvB,CAAC,EACD,CAACZ,YAAY,CACf,CAAC;EAEH,MAAMG,OAAO,GAAG1B,WAAW,CAAC,MAAM;IAChC2B,WAAW,GAAG,CAAC;EACjB,CAAC,EAAE,CAACA,WAAW,CAAC,CAAC;EAEjB,MAAMS,kBAAkB,GAAGnC,MAAM,CAC/BI,eAAe,CAAC;IACdgC,eAAe,EAAEL,KAAK;IACtBM,iBAAiB,EAAEz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