@okta/odyssey-react-mui 0.22.0 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (280) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/Autocomplete.js +5 -1
  3. package/dist/Autocomplete.js.map +1 -1
  4. package/dist/Banner.js +3 -3
  5. package/dist/Banner.js.map +1 -1
  6. package/dist/Button.js +8 -8
  7. package/dist/Button.js.map +1 -1
  8. package/dist/CheckboxGroup.js +23 -35
  9. package/dist/CheckboxGroup.js.map +1 -1
  10. package/dist/Dialog.js +68 -0
  11. package/dist/Dialog.js.map +1 -0
  12. package/dist/Field.js +18 -5
  13. package/dist/Field.js.map +1 -1
  14. package/dist/FieldLabel.js +3 -3
  15. package/dist/FieldLabel.js.map +1 -1
  16. package/dist/Icon.js +7 -6
  17. package/dist/Icon.js.map +1 -1
  18. package/dist/Infobox.js +1 -1
  19. package/dist/Infobox.js.map +1 -1
  20. package/dist/Link.js +5 -2
  21. package/dist/Link.js.map +1 -1
  22. package/dist/MenuButton.js +3 -2
  23. package/dist/MenuButton.js.map +1 -1
  24. package/dist/MuiPropsChild.js +30 -0
  25. package/dist/MuiPropsChild.js.map +1 -0
  26. package/dist/MuiPropsContext.js +14 -0
  27. package/dist/MuiPropsContext.js.map +1 -0
  28. package/dist/PasswordField.js +8 -3
  29. package/dist/PasswordField.js.map +1 -1
  30. package/dist/RadioGroup.js +25 -26
  31. package/dist/RadioGroup.js.map +1 -1
  32. package/dist/SearchField.js +6 -4
  33. package/dist/SearchField.js.map +1 -1
  34. package/dist/Status.js.map +1 -1
  35. package/dist/TextField.js +17 -8
  36. package/dist/TextField.js.map +1 -1
  37. package/dist/Toast.js +72 -0
  38. package/dist/Toast.js.map +1 -0
  39. package/dist/ToastStack.js +33 -0
  40. package/dist/ToastStack.js.map +1 -0
  41. package/dist/Tooltip.js +20 -0
  42. package/dist/Tooltip.js.map +1 -0
  43. package/dist/iconDictionary/Add.js +4 -4
  44. package/dist/iconDictionary/Add.js.map +1 -1
  45. package/dist/iconDictionary/AddCircle.js +4 -4
  46. package/dist/iconDictionary/AddCircle.js.map +1 -1
  47. package/dist/iconDictionary/AlertCircle.js +4 -4
  48. package/dist/iconDictionary/AlertCircle.js.map +1 -1
  49. package/dist/iconDictionary/AlertCircleFilled.js +4 -4
  50. package/dist/iconDictionary/AlertCircleFilled.js.map +1 -1
  51. package/dist/iconDictionary/AlertTriangleFilled.js +4 -4
  52. package/dist/iconDictionary/AlertTriangleFilled.js.map +1 -1
  53. package/dist/iconDictionary/Anchor.js +5 -5
  54. package/dist/iconDictionary/Anchor.js.map +1 -1
  55. package/dist/iconDictionary/ArrowDown.js +4 -4
  56. package/dist/iconDictionary/ArrowDown.js.map +1 -1
  57. package/dist/iconDictionary/ArrowLeft.js +4 -4
  58. package/dist/iconDictionary/ArrowLeft.js.map +1 -1
  59. package/dist/iconDictionary/ArrowRight.js +4 -4
  60. package/dist/iconDictionary/ArrowRight.js.map +1 -1
  61. package/dist/iconDictionary/ArrowUp.js +4 -4
  62. package/dist/iconDictionary/ArrowUp.js.map +1 -1
  63. package/dist/iconDictionary/ArrowUpDown.js +4 -4
  64. package/dist/iconDictionary/ArrowUpDown.js.map +1 -1
  65. package/dist/iconDictionary/Calendar.js +4 -4
  66. package/dist/iconDictionary/Calendar.js.map +1 -1
  67. package/dist/iconDictionary/Check.js +4 -4
  68. package/dist/iconDictionary/Check.js.map +1 -1
  69. package/dist/iconDictionary/CheckCircleFilled.js +4 -4
  70. package/dist/iconDictionary/CheckCircleFilled.js.map +1 -1
  71. package/dist/iconDictionary/ChevronDown.js +4 -4
  72. package/dist/iconDictionary/ChevronDown.js.map +1 -1
  73. package/dist/iconDictionary/ChevronUp.js +4 -4
  74. package/dist/iconDictionary/ChevronUp.js.map +1 -1
  75. package/dist/iconDictionary/Close.js +4 -4
  76. package/dist/iconDictionary/Close.js.map +1 -1
  77. package/dist/iconDictionary/CloseCircleFilled.js +4 -4
  78. package/dist/iconDictionary/CloseCircleFilled.js.map +1 -1
  79. package/dist/iconDictionary/Copy.js +4 -4
  80. package/dist/iconDictionary/Copy.js.map +1 -1
  81. package/dist/iconDictionary/Delete.js +4 -4
  82. package/dist/iconDictionary/Delete.js.map +1 -1
  83. package/dist/iconDictionary/Download.js +4 -4
  84. package/dist/iconDictionary/Download.js.map +1 -1
  85. package/dist/iconDictionary/DragHandle.js +4 -4
  86. package/dist/iconDictionary/DragHandle.js.map +1 -1
  87. package/dist/iconDictionary/Edit.js +4 -4
  88. package/dist/iconDictionary/Edit.js.map +1 -1
  89. package/dist/iconDictionary/ExternalLink.js +4 -4
  90. package/dist/iconDictionary/ExternalLink.js.map +1 -1
  91. package/dist/iconDictionary/Eye.js +4 -4
  92. package/dist/iconDictionary/Eye.js.map +1 -1
  93. package/dist/iconDictionary/EyeOff.js +4 -4
  94. package/dist/iconDictionary/EyeOff.js.map +1 -1
  95. package/dist/iconDictionary/Filter.js +4 -4
  96. package/dist/iconDictionary/Filter.js.map +1 -1
  97. package/dist/iconDictionary/Globe.js +4 -4
  98. package/dist/iconDictionary/Globe.js.map +1 -1
  99. package/dist/iconDictionary/Home.js +4 -4
  100. package/dist/iconDictionary/Home.js.map +1 -1
  101. package/dist/iconDictionary/InformationCircle.js +4 -4
  102. package/dist/iconDictionary/InformationCircle.js.map +1 -1
  103. package/dist/iconDictionary/InformationCircleFilled.js +4 -4
  104. package/dist/iconDictionary/InformationCircleFilled.js.map +1 -1
  105. package/dist/iconDictionary/Notification.js +4 -4
  106. package/dist/iconDictionary/Notification.js.map +1 -1
  107. package/dist/iconDictionary/OverflowVertical.js +4 -4
  108. package/dist/iconDictionary/OverflowVertical.js.map +1 -1
  109. package/dist/iconDictionary/QuestionCircle.js +4 -4
  110. package/dist/iconDictionary/QuestionCircle.js.map +1 -1
  111. package/dist/iconDictionary/QuestionCircleFilled.js +4 -4
  112. package/dist/iconDictionary/QuestionCircleFilled.js.map +1 -1
  113. package/dist/iconDictionary/Search.js +4 -4
  114. package/dist/iconDictionary/Search.js.map +1 -1
  115. package/dist/iconDictionary/Settings.js +3 -3
  116. package/dist/iconDictionary/Settings.js.map +1 -1
  117. package/dist/iconDictionary/Subtract.js +4 -4
  118. package/dist/iconDictionary/Subtract.js.map +1 -1
  119. package/dist/iconDictionary/User.js +4 -4
  120. package/dist/iconDictionary/User.js.map +1 -1
  121. package/dist/iconDictionary/UserGroup.js +4 -4
  122. package/dist/iconDictionary/UserGroup.js.map +1 -1
  123. package/dist/iconDictionary/index.js.map +1 -1
  124. package/dist/index.js +5 -4
  125. package/dist/index.js.map +1 -1
  126. package/dist/src/Autocomplete.d.ts +2 -1
  127. package/dist/src/Autocomplete.d.ts.map +1 -1
  128. package/dist/src/Banner.d.ts +19 -19
  129. package/dist/src/Banner.d.ts.map +1 -1
  130. package/dist/src/Button.d.ts +4 -3
  131. package/dist/src/Button.d.ts.map +1 -1
  132. package/dist/src/CheckboxGroup.d.ts +7 -4
  133. package/dist/src/CheckboxGroup.d.ts.map +1 -1
  134. package/dist/src/Dialog.d.ts +25 -0
  135. package/dist/src/Dialog.d.ts.map +1 -0
  136. package/dist/src/Field.d.ts +14 -3
  137. package/dist/src/Field.d.ts.map +1 -1
  138. package/dist/src/FieldLabel.d.ts +2 -2
  139. package/dist/src/Icon.d.ts +6 -7
  140. package/dist/src/Icon.d.ts.map +1 -1
  141. package/dist/src/Infobox.d.ts +7 -7
  142. package/dist/src/Infobox.d.ts.map +1 -1
  143. package/dist/src/Link.d.ts +9 -4
  144. package/dist/src/Link.d.ts.map +1 -1
  145. package/dist/src/MenuButton.d.ts +7 -3
  146. package/dist/src/MenuButton.d.ts.map +1 -1
  147. package/dist/src/MenuItem.d.ts +1 -1
  148. package/dist/src/MuiPropsChild.d.ts +18 -0
  149. package/dist/src/MuiPropsChild.d.ts.map +1 -0
  150. package/dist/src/MuiPropsContext.d.ts +15 -0
  151. package/dist/src/MuiPropsContext.d.ts.map +1 -0
  152. package/dist/src/PasswordField.d.ts +8 -8
  153. package/dist/src/PasswordField.d.ts.map +1 -1
  154. package/dist/src/RadioGroup.d.ts +8 -8
  155. package/dist/src/RadioGroup.d.ts.map +1 -1
  156. package/dist/src/SearchField.d.ts +4 -4
  157. package/dist/src/SearchField.d.ts.map +1 -1
  158. package/dist/src/Status.d.ts +2 -2
  159. package/dist/src/Status.d.ts.map +1 -1
  160. package/dist/src/TextField.d.ts +13 -12
  161. package/dist/src/TextField.d.ts.map +1 -1
  162. package/dist/src/Toast.d.ts +60 -0
  163. package/dist/src/Toast.d.ts.map +1 -0
  164. package/dist/src/ToastStack.d.ts +19 -0
  165. package/dist/src/ToastStack.d.ts.map +1 -0
  166. package/dist/src/Tooltip.d.ts +21 -0
  167. package/dist/src/Tooltip.d.ts.map +1 -0
  168. package/dist/src/iconDictionary/Add.d.ts +2 -2
  169. package/dist/src/iconDictionary/AddCircle.d.ts +2 -2
  170. package/dist/src/iconDictionary/AlertCircle.d.ts +2 -2
  171. package/dist/src/iconDictionary/AlertCircleFilled.d.ts +2 -2
  172. package/dist/src/iconDictionary/AlertTriangleFilled.d.ts +2 -2
  173. package/dist/src/iconDictionary/Anchor.d.ts +2 -2
  174. package/dist/src/iconDictionary/ArrowDown.d.ts +2 -2
  175. package/dist/src/iconDictionary/ArrowLeft.d.ts +2 -2
  176. package/dist/src/iconDictionary/ArrowRight.d.ts +2 -2
  177. package/dist/src/iconDictionary/ArrowUp.d.ts +2 -2
  178. package/dist/src/iconDictionary/ArrowUpDown.d.ts +2 -2
  179. package/dist/src/iconDictionary/Calendar.d.ts +2 -2
  180. package/dist/src/iconDictionary/Check.d.ts +2 -2
  181. package/dist/src/iconDictionary/CheckCircleFilled.d.ts +2 -2
  182. package/dist/src/iconDictionary/ChevronDown.d.ts +2 -2
  183. package/dist/src/iconDictionary/ChevronUp.d.ts +2 -2
  184. package/dist/src/iconDictionary/Close.d.ts +2 -2
  185. package/dist/src/iconDictionary/CloseCircleFilled.d.ts +2 -2
  186. package/dist/src/iconDictionary/Copy.d.ts +2 -2
  187. package/dist/src/iconDictionary/Delete.d.ts +2 -2
  188. package/dist/src/iconDictionary/Download.d.ts +2 -2
  189. package/dist/src/iconDictionary/DragHandle.d.ts +2 -2
  190. package/dist/src/iconDictionary/Edit.d.ts +2 -2
  191. package/dist/src/iconDictionary/ExternalLink.d.ts +2 -2
  192. package/dist/src/iconDictionary/Eye.d.ts +2 -2
  193. package/dist/src/iconDictionary/EyeOff.d.ts +2 -2
  194. package/dist/src/iconDictionary/Filter.d.ts +2 -2
  195. package/dist/src/iconDictionary/Globe.d.ts +2 -2
  196. package/dist/src/iconDictionary/Home.d.ts +2 -2
  197. package/dist/src/iconDictionary/InformationCircle.d.ts +2 -2
  198. package/dist/src/iconDictionary/InformationCircleFilled.d.ts +2 -2
  199. package/dist/src/iconDictionary/Notification.d.ts +2 -2
  200. package/dist/src/iconDictionary/OverflowVertical.d.ts +2 -2
  201. package/dist/src/iconDictionary/QuestionCircle.d.ts +2 -2
  202. package/dist/src/iconDictionary/QuestionCircleFilled.d.ts +2 -2
  203. package/dist/src/iconDictionary/Search.d.ts +2 -2
  204. package/dist/src/iconDictionary/Settings.d.ts +2 -2
  205. package/dist/src/iconDictionary/Subtract.d.ts +2 -2
  206. package/dist/src/iconDictionary/User.d.ts +2 -2
  207. package/dist/src/iconDictionary/UserGroup.d.ts +2 -2
  208. package/dist/src/iconDictionary/index.d.ts +40 -40
  209. package/dist/src/index.d.ts +8 -7
  210. package/dist/src/index.d.ts.map +1 -1
  211. package/dist/src/theme/components.d.ts.map +1 -1
  212. package/dist/theme/components.js +32 -12
  213. package/dist/theme/components.js.map +1 -1
  214. package/dist/tsconfig.production.tsbuildinfo +1 -1
  215. package/package.json +3 -3
  216. package/src/Autocomplete.tsx +10 -1
  217. package/src/Banner.tsx +21 -21
  218. package/src/Button.tsx +38 -18
  219. package/src/CheckboxGroup.tsx +27 -34
  220. package/src/Dialog.tsx +110 -0
  221. package/src/Field.tsx +42 -19
  222. package/src/FieldLabel.tsx +7 -7
  223. package/src/Icon.test.tsx +1 -1
  224. package/src/Icon.tsx +24 -7
  225. package/src/Infobox.tsx +7 -7
  226. package/src/Link.tsx +14 -6
  227. package/src/MenuButton.tsx +8 -3
  228. package/src/MuiPropsChild.tsx +41 -0
  229. package/src/MuiPropsContext.ts +17 -0
  230. package/src/PasswordField.tsx +17 -11
  231. package/src/RadioGroup.tsx +31 -46
  232. package/src/SearchField.tsx +10 -8
  233. package/src/Status.tsx +2 -2
  234. package/src/TextField.tsx +32 -21
  235. package/src/Toast.tsx +138 -0
  236. package/src/ToastStack.tsx +33 -0
  237. package/src/Tooltip.tsx +39 -0
  238. package/src/iconDictionary/Add.tsx +3 -3
  239. package/src/iconDictionary/AddCircle.tsx +3 -3
  240. package/src/iconDictionary/AlertCircle.tsx +3 -3
  241. package/src/iconDictionary/AlertCircleFilled.tsx +3 -3
  242. package/src/iconDictionary/AlertTriangleFilled.tsx +3 -3
  243. package/src/iconDictionary/Anchor.tsx +3 -3
  244. package/src/iconDictionary/ArrowDown.tsx +3 -3
  245. package/src/iconDictionary/ArrowLeft.tsx +3 -3
  246. package/src/iconDictionary/ArrowRight.tsx +3 -3
  247. package/src/iconDictionary/ArrowUp.tsx +3 -3
  248. package/src/iconDictionary/ArrowUpDown.tsx +3 -3
  249. package/src/iconDictionary/Calendar.tsx +3 -3
  250. package/src/iconDictionary/Check.tsx +3 -3
  251. package/src/iconDictionary/CheckCircleFilled.tsx +3 -3
  252. package/src/iconDictionary/ChevronDown.tsx +3 -3
  253. package/src/iconDictionary/ChevronUp.tsx +3 -3
  254. package/src/iconDictionary/Close.tsx +3 -3
  255. package/src/iconDictionary/CloseCircleFilled.tsx +3 -3
  256. package/src/iconDictionary/Copy.tsx +3 -3
  257. package/src/iconDictionary/Delete.tsx +3 -3
  258. package/src/iconDictionary/Download.tsx +3 -3
  259. package/src/iconDictionary/DragHandle.tsx +3 -3
  260. package/src/iconDictionary/Edit.tsx +3 -3
  261. package/src/iconDictionary/ExternalLink.tsx +3 -3
  262. package/src/iconDictionary/Eye.tsx +3 -3
  263. package/src/iconDictionary/EyeOff.tsx +3 -3
  264. package/src/iconDictionary/Filter.tsx +3 -3
  265. package/src/iconDictionary/Globe.tsx +3 -3
  266. package/src/iconDictionary/Home.tsx +3 -3
  267. package/src/iconDictionary/InformationCircle.tsx +3 -3
  268. package/src/iconDictionary/InformationCircleFilled.tsx +3 -3
  269. package/src/iconDictionary/Notification.tsx +3 -3
  270. package/src/iconDictionary/OverflowVertical.tsx +3 -3
  271. package/src/iconDictionary/QuestionCircle.tsx +3 -3
  272. package/src/iconDictionary/QuestionCircleFilled.tsx +3 -3
  273. package/src/iconDictionary/Search.tsx +3 -3
  274. package/src/iconDictionary/Settings.tsx +2 -2
  275. package/src/iconDictionary/Subtract.tsx +3 -3
  276. package/src/iconDictionary/User.tsx +3 -3
  277. package/src/iconDictionary/UserGroup.tsx +3 -3
  278. package/src/iconDictionary/index.ts +1 -1
  279. package/src/index.ts +4 -14
  280. package/src/theme/components.tsx +32 -9
@@ -19,7 +19,8 @@ const MenuButton = _ref => {
19
19
  buttonLabel = "",
20
20
  children,
21
21
  buttonEndIcon = _jsx(ChevronDownIcon, {}),
22
- buttonVariant = "secondary"
22
+ buttonVariant = "secondary",
23
+ id: idOverride
23
24
  } = _ref;
24
25
  const [anchorEl, setAnchorEl] = useState(null);
25
26
  const open = Boolean(anchorEl);
@@ -32,7 +33,7 @@ const MenuButton = _ref => {
32
33
  setAnchorEl(null);
33
34
  };
34
35
 
35
- const uniqueId = useUniqueId();
36
+ const uniqueId = useUniqueId(idOverride);
36
37
  const menuListProps = useMemo(() => ({
37
38
  "aria-labelledby": `${uniqueId}-button`
38
39
  }), [uniqueId]);
@@ -1 +1 @@
1
- {"version":3,"file":"MenuButton.js","names":["Button","ChevronDownIcon","Menu","useUniqueId","memo","useMemo","useState","MenuButton","buttonLabel","children","buttonEndIcon","buttonVariant","anchorEl","setAnchorEl","open","Boolean","handleClick","event","currentTarget","handleClose","uniqueId","menuListProps","undefined","MemoizedMenuButton"],"sources":["../src/MenuButton.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport {\n Button,\n ButtonProps,\n ChevronDownIcon,\n Divider,\n ListSubheader,\n Menu,\n MenuItem,\n useUniqueId,\n} from \"./\";\nimport { memo, MouseEvent, ReactElement, useMemo, useState } from \"react\";\n\nexport interface MenuButtonProps {\n /**\n * The <MenuItem> components within the Menu.\n */\n children: Array<\n ReactElement<typeof MenuItem | typeof Divider | typeof ListSubheader>\n >;\n /**\n * The end Icon on the trigggering Button\n */\n buttonEndIcon?: ReactElement;\n /**\n * The label on the triggering Button\n */\n buttonLabel?: string;\n /**\n * The variant of the triggering Button\n */\n buttonVariant?: ButtonProps[\"variant\"];\n}\n\nconst MenuButton = ({\n buttonLabel = \"\",\n children,\n buttonEndIcon = <ChevronDownIcon />,\n buttonVariant = \"secondary\",\n}: MenuButtonProps) => {\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);\n\n const open = Boolean(anchorEl);\n\n const handleClick = (event: MouseEvent<HTMLButtonElement>) => {\n setAnchorEl(event.currentTarget);\n };\n\n const handleClose = () => {\n setAnchorEl(null);\n };\n\n const uniqueId = useUniqueId();\n\n const menuListProps = useMemo(\n () => ({ \"aria-labelledby\": `${uniqueId}-button` }),\n [uniqueId]\n );\n\n return (\n <div>\n <Button\n endIcon={buttonEndIcon}\n id={`${uniqueId}-button`}\n aria-controls={open ? `${uniqueId}-menu` : undefined}\n aria-haspopup=\"true\"\n aria-expanded={open ? \"true\" : undefined}\n onClick={handleClick}\n text={buttonLabel}\n variant={buttonVariant}\n />\n <Menu\n id={`${uniqueId}-menu`}\n anchorEl={anchorEl}\n open={open}\n onClose={handleClose}\n MenuListProps={menuListProps}\n >\n {children}\n </Menu>\n </div>\n );\n};\n\nconst MemoizedMenuButton = memo(MenuButton);\n\nexport { MemoizedMenuButton as MenuButton };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;SAGEA,M,EAEAC,e,EAGAC,I,EAEAC,W;AAEF,SAASC,IAAT,EAAyCC,OAAzC,EAAkDC,QAAlD,QAAkE,OAAlE;;;;AAuBA,MAAMC,UAAU,GAAG,QAKI;EAAA,IALH;IAClBC,WAAW,GAAG,EADI;IAElBC,QAFkB;IAGlBC,aAAa,GAAG,KAAC,eAAD,KAHE;IAIlBC,aAAa,GAAG;EAJE,CAKG;EACrB,MAAM,CAACC,QAAD,EAAWC,WAAX,IAA0BP,QAAQ,CAAqB,IAArB,CAAxC;EAEA,MAAMQ,IAAI,GAAGC,OAAO,CAACH,QAAD,CAApB;;EAEA,MAAMI,WAAW,GAAIC,KAAD,IAA0C;IAC5DJ,WAAW,CAACI,KAAK,CAACC,aAAP,CAAX;EACD,CAFD;;EAIA,MAAMC,WAAW,GAAG,MAAM;IACxBN,WAAW,CAAC,IAAD,CAAX;EACD,CAFD;;EAIA,MAAMO,QAAQ,GAAGjB,WAAW,EAA5B;EAEA,MAAMkB,aAAa,GAAGhB,OAAO,CAC3B,OAAO;IAAE,mBAAoB,GAAEe,QAAS;EAAjC,CAAP,CAD2B,EAE3B,CAACA,QAAD,CAF2B,CAA7B;EAKA,OACE;IAAA,WACE,KAAC,MAAD;MACE,OAAO,EAAEV,aADX;MAEE,EAAE,EAAG,GAAEU,QAAS,SAFlB;MAGE,iBAAeN,IAAI,GAAI,GAAEM,QAAS,OAAf,GAAwBE,SAH7C;MAIE,iBAAc,MAJhB;MAKE,iBAAeR,IAAI,GAAG,MAAH,GAAYQ,SALjC;MAME,OAAO,EAAEN,WANX;MAOE,IAAI,EAAER,WAPR;MAQE,OAAO,EAAEG;IARX,EADF,EAWE,KAAC,IAAD;MACE,EAAE,EAAG,GAAES,QAAS,OADlB;MAEE,QAAQ,EAAER,QAFZ;MAGE,IAAI,EAAEE,IAHR;MAIE,OAAO,EAAEK,WAJX;MAKE,aAAa,EAAEE,aALjB;MAAA,UAOGZ;IAPH,EAXF;EAAA,EADF;AAuBD,CAhDD;;AAkDA,MAAMc,kBAAkB,GAAGnB,IAAI,CAACG,UAAD,CAA/B;AAEA,SAASgB,kBAAkB,IAAIhB,UAA/B"}
1
+ {"version":3,"file":"MenuButton.js","names":["Button","ChevronDownIcon","Menu","useUniqueId","memo","useMemo","useState","MenuButton","buttonLabel","children","buttonEndIcon","buttonVariant","id","idOverride","anchorEl","setAnchorEl","open","Boolean","handleClick","event","currentTarget","handleClose","uniqueId","menuListProps","undefined","MemoizedMenuButton"],"sources":["../src/MenuButton.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport {\n Button,\n ButtonProps,\n ChevronDownIcon,\n Divider,\n ListSubheader,\n Menu,\n MenuItem,\n useUniqueId,\n} from \"./\";\nimport { memo, MouseEvent, ReactElement, useMemo, useState } from \"react\";\n\nexport type MenuButtonProps = {\n /**\n * The <MenuItem> components within the Menu.\n */\n children: Array<\n ReactElement<typeof MenuItem | typeof Divider | typeof ListSubheader>\n >;\n /**\n * The end Icon on the trigggering Button\n */\n buttonEndIcon?: ReactElement;\n /**\n * The label on the triggering Button\n */\n buttonLabel?: string;\n /**\n * The variant of the triggering Button\n */\n buttonVariant?: ButtonProps[\"variant\"];\n /**\n * The id of the `input` element.\n */\n id?: string;\n};\n\nconst MenuButton = ({\n buttonLabel = \"\",\n children,\n buttonEndIcon = <ChevronDownIcon />,\n buttonVariant = \"secondary\",\n id: idOverride,\n}: MenuButtonProps) => {\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);\n\n const open = Boolean(anchorEl);\n\n const handleClick = (event: MouseEvent<HTMLButtonElement>) => {\n setAnchorEl(event.currentTarget);\n };\n\n const handleClose = () => {\n setAnchorEl(null);\n };\n\n const uniqueId = useUniqueId(idOverride);\n\n const menuListProps = useMemo(\n () => ({ \"aria-labelledby\": `${uniqueId}-button` }),\n [uniqueId]\n );\n\n return (\n <div>\n <Button\n endIcon={buttonEndIcon}\n id={`${uniqueId}-button`}\n aria-controls={open ? `${uniqueId}-menu` : undefined}\n aria-haspopup=\"true\"\n aria-expanded={open ? \"true\" : undefined}\n onClick={handleClick}\n text={buttonLabel}\n variant={buttonVariant}\n />\n <Menu\n id={`${uniqueId}-menu`}\n anchorEl={anchorEl}\n open={open}\n onClose={handleClose}\n MenuListProps={menuListProps}\n >\n {children}\n </Menu>\n </div>\n );\n};\n\nconst MemoizedMenuButton = memo(MenuButton);\n\nexport { MemoizedMenuButton as MenuButton };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;SAGEA,M,EAEAC,e,EAGAC,I,EAEAC,W;AAEF,SAASC,IAAT,EAAyCC,OAAzC,EAAkDC,QAAlD,QAAkE,OAAlE;;;;AA2BA,MAAMC,UAAU,GAAG,QAMI;EAAA,IANH;IAClBC,WAAW,GAAG,EADI;IAElBC,QAFkB;IAGlBC,aAAa,GAAG,KAAC,eAAD,KAHE;IAIlBC,aAAa,GAAG,WAJE;IAKlBC,EAAE,EAAEC;EALc,CAMG;EACrB,MAAM,CAACC,QAAD,EAAWC,WAAX,IAA0BT,QAAQ,CAAqB,IAArB,CAAxC;EAEA,MAAMU,IAAI,GAAGC,OAAO,CAACH,QAAD,CAApB;;EAEA,MAAMI,WAAW,GAAIC,KAAD,IAA0C;IAC5DJ,WAAW,CAACI,KAAK,CAACC,aAAP,CAAX;EACD,CAFD;;EAIA,MAAMC,WAAW,GAAG,MAAM;IACxBN,WAAW,CAAC,IAAD,CAAX;EACD,CAFD;;EAIA,MAAMO,QAAQ,GAAGnB,WAAW,CAACU,UAAD,CAA5B;EAEA,MAAMU,aAAa,GAAGlB,OAAO,CAC3B,OAAO;IAAE,mBAAoB,GAAEiB,QAAS;EAAjC,CAAP,CAD2B,EAE3B,CAACA,QAAD,CAF2B,CAA7B;EAKA,OACE;IAAA,WACE,KAAC,MAAD;MACE,OAAO,EAAEZ,aADX;MAEE,EAAE,EAAG,GAAEY,QAAS,SAFlB;MAGE,iBAAeN,IAAI,GAAI,GAAEM,QAAS,OAAf,GAAwBE,SAH7C;MAIE,iBAAc,MAJhB;MAKE,iBAAeR,IAAI,GAAG,MAAH,GAAYQ,SALjC;MAME,OAAO,EAAEN,WANX;MAOE,IAAI,EAAEV,WAPR;MAQE,OAAO,EAAEG;IARX,EADF,EAWE,KAAC,IAAD;MACE,EAAE,EAAG,GAAEW,QAAS,OADlB;MAEE,QAAQ,EAAER,QAFZ;MAGE,IAAI,EAAEE,IAHR;MAIE,OAAO,EAAEK,WAJX;MAKE,aAAa,EAAEE,aALjB;MAAA,UAOGd;IAPH,EAXF;EAAA,EADF;AAuBD,CAjDD;;AAmDA,MAAMgB,kBAAkB,GAAGrB,IAAI,CAACG,UAAD,CAA/B;AAEA,SAASkB,kBAAkB,IAAIlB,UAA/B"}
@@ -0,0 +1,30 @@
1
+ /*!
2
+ * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.
3
+ * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
4
+ *
5
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
6
+ * Unless required by applicable law or agreed to in writing, software
7
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
8
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9
+ *
10
+ * See the License for the specific language governing permissions and limitations under the License.
11
+ */
12
+ import { forwardRef, memo, useMemo } from "react";
13
+ import { MuiPropsContext } from "./MuiPropsContext.js";
14
+ import { jsx as _jsx } from "react/jsx-runtime";
15
+ const MuiPropsChild = forwardRef((_ref, ref) => {
16
+ let {
17
+ children,
18
+ ...muiProps
19
+ } = _ref;
20
+ const providerValue = useMemo(() => ({ ...muiProps,
21
+ ref
22
+ }), [muiProps, ref]);
23
+ return _jsx(MuiPropsContext.Provider, {
24
+ value: providerValue,
25
+ children: children
26
+ });
27
+ });
28
+ const MemoizedMuiPropsChild = memo(MuiPropsChild);
29
+ export { MemoizedMuiPropsChild as MuiPropsChild };
30
+ //# sourceMappingURL=MuiPropsChild.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MuiPropsChild.js","names":["forwardRef","memo","useMemo","MuiPropsContext","MuiPropsChild","ref","children","muiProps","providerValue","MemoizedMuiPropsChild"],"sources":["../src/MuiPropsChild.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 { forwardRef, memo, ReactNode, useMemo } from \"react\";\n\nimport { MuiPropsContext, MuiPropsContextType } from \"./MuiPropsContext\";\n\nexport type MuiPropsChildProps = {\n children: ReactNode;\n};\n\nconst MuiPropsChild = forwardRef<HTMLElement, MuiPropsChildProps>(\n ({ children, ...muiProps }, ref) => {\n const providerValue = useMemo<MuiPropsContextType>(\n () => ({\n ...muiProps,\n ref,\n }),\n [muiProps, ref]\n );\n\n return (\n <MuiPropsContext.Provider value={providerValue}>\n {children}\n </MuiPropsContext.Provider>\n );\n }\n);\n\nconst MemoizedMuiPropsChild = memo(MuiPropsChild);\n\nexport { MemoizedMuiPropsChild as MuiPropsChild };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,UAAT,EAAqBC,IAArB,EAAsCC,OAAtC,QAAqD,OAArD;SAESC,e;;AAMT,MAAMC,aAAa,GAAGJ,UAAU,CAC9B,OAA4BK,GAA5B,KAAoC;EAAA,IAAnC;IAAEC,QAAF;IAAY,GAAGC;EAAf,CAAmC;EAClC,MAAMC,aAAa,GAAGN,OAAO,CAC3B,OAAO,EACL,GAAGK,QADE;IAELF;EAFK,CAAP,CAD2B,EAK3B,CAACE,QAAD,EAAWF,GAAX,CAL2B,CAA7B;EAQA,OACE,KAAC,eAAD,CAAiB,QAAjB;IAA0B,KAAK,EAAEG,aAAjC;IAAA,UACGF;EADH,EADF;AAKD,CAf6B,CAAhC;AAkBA,MAAMG,qBAAqB,GAAGR,IAAI,CAACG,aAAD,CAAlC;AAEA,SAASK,qBAAqB,IAAIL,aAAlC"}
@@ -0,0 +1,14 @@
1
+ /*!
2
+ * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.
3
+ * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
4
+ *
5
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
6
+ * Unless required by applicable law or agreed to in writing, software
7
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
8
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9
+ *
10
+ * See the License for the specific language governing permissions and limitations under the License.
11
+ */
12
+ import { createContext } from "react";
13
+ export const MuiPropsContext = createContext({});
14
+ //# sourceMappingURL=MuiPropsContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MuiPropsContext.js","names":["createContext","MuiPropsContext"],"sources":["../src/MuiPropsContext.ts"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { createContext } from \"react\";\n\nexport type MuiPropsContextType = Record<string, unknown>;\n\nexport const MuiPropsContext = createContext<MuiPropsContextType>({});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,aAAT,QAA8B,OAA9B;AAIA,OAAO,MAAMC,eAAe,GAAGD,aAAa,CAAsB,EAAtB,CAArC"}
@@ -7,11 +7,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
7
7
  const PasswordField = forwardRef((_ref, ref) => {
8
8
  let {
9
9
  autoCompleteType,
10
- autoFocus,
11
10
  errorMessage,
11
+ hasInitialFocus,
12
12
  hint,
13
13
  id: idOverride,
14
14
  isDisabled = false,
15
+ isOptional = false,
15
16
  isReadOnly,
16
17
  label,
17
18
  onChange,
@@ -32,7 +33,7 @@ const PasswordField = forwardRef((_ref, ref) => {
32
33
  return _jsx(_InputBase, {
33
34
  "aria-describedby": ariaDescribedBy,
34
35
  autoComplete: autoCompleteType,
35
- autoFocus: autoFocus,
36
+ autoFocus: hasInitialFocus,
36
37
  endAdornment: _jsx(_InputAdornment, {
37
38
  position: "end",
38
39
  children: _jsx(IconButton, {
@@ -43,22 +44,26 @@ const PasswordField = forwardRef((_ref, ref) => {
43
44
  })
44
45
  }),
45
46
  id: id,
47
+ name: id,
46
48
  onChange: onChange,
47
49
  onFocus: onFocus,
48
50
  onBlur: onBlur,
49
51
  placeholder: placeholder,
50
52
  readOnly: isReadOnly,
51
53
  ref: ref,
54
+ required: !isOptional,
52
55
  type: inputType,
53
56
  value: value
54
57
  });
55
- }, [autoCompleteType, autoFocus, togglePasswordVisibility, inputType, onChange, onFocus, onBlur, placeholder, isReadOnly, ref, value]);
58
+ }, [autoCompleteType, hasInitialFocus, togglePasswordVisibility, inputType, onChange, onFocus, onBlur, placeholder, isOptional, isReadOnly, ref, value]);
56
59
  return _jsx(Field, {
57
60
  errorMessage: errorMessage,
61
+ fieldType: "single",
58
62
  hasVisibleLabel: true,
59
63
  hint: hint,
60
64
  id: idOverride,
61
65
  isDisabled: isDisabled,
66
+ isOptional: isOptional,
62
67
  label: label,
63
68
  renderFieldComponent: renderFieldComponent
64
69
  });
@@ -1 +1 @@
1
- {"version":3,"file":"PasswordField.js","names":["forwardRef","memo","useCallback","useState","EyeIcon","EyeOffIcon","IconButton","Field","PasswordField","ref","autoCompleteType","autoFocus","errorMessage","hint","id","idOverride","isDisabled","isReadOnly","label","onChange","onFocus","onBlur","placeholder","value","inputType","setInputType","togglePasswordVisibility","renderFieldComponent","ariaDescribedBy","MemoizedPasswordField"],"sources":["../src/PasswordField.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 } from \"@mui/material\";\nimport {\n ChangeEventHandler,\n FocusEventHandler,\n forwardRef,\n memo,\n useCallback,\n useState,\n} from \"react\";\n\nimport { EyeIcon, EyeOffIcon, IconButton } from \"./\";\nimport { Field } from \"./Field\";\n\nexport type PasswordFieldProps = {\n /**\n * If `true`, the component will receive focus automatically.\n */\n autoFocus?: boolean;\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?: \"current-password\" | \"new-password\";\n /**\n * If `error` is not undefined, the `input` will indicate an error.\n */\n errorMessage?: string;\n /**\n * The helper text content.\n */\n hint?: string;\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 * It prevents the user from changing the value of the field\n */\n isReadOnly?: boolean;\n /**\n * If `true`, the `input` element is required.\n */\n isRequired?: boolean;\n /**\n * The label for the `input` element.\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 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 * The value of the `input` element, required for a controlled component.\n */\n value?: string;\n};\n\nconst PasswordField = forwardRef<HTMLInputElement, PasswordFieldProps>(\n (\n {\n autoCompleteType,\n autoFocus,\n errorMessage,\n hint,\n id: idOverride,\n isDisabled = false,\n isReadOnly,\n label,\n onChange,\n onFocus,\n onBlur,\n placeholder,\n value,\n },\n ref\n ) => {\n const [inputType, setInputType] = useState(\"password\");\n\n const togglePasswordVisibility = useCallback(() => {\n setInputType((inputType) =>\n inputType === \"password\" ? \"text\" : \"password\"\n );\n }, []);\n\n const renderFieldComponent = useCallback(\n ({ ariaDescribedBy, id }) => (\n <InputBase\n aria-describedby={ariaDescribedBy}\n autoComplete={autoCompleteType}\n /* eslint-disable-next-line jsx-a11y/no-autofocus */\n autoFocus={autoFocus}\n endAdornment={\n <InputAdornment position=\"end\">\n <IconButton\n aria-label=\"toggle password visibility\"\n edge=\"end\"\n onClick={togglePasswordVisibility}\n >\n {inputType === \"password\" ? <EyeIcon /> : <EyeOffIcon />}\n </IconButton>\n </InputAdornment>\n }\n id={id}\n onChange={onChange}\n onFocus={onFocus}\n onBlur={onBlur}\n placeholder={placeholder}\n readOnly={isReadOnly}\n ref={ref}\n type={inputType}\n value={value}\n />\n ),\n [\n autoCompleteType,\n autoFocus,\n togglePasswordVisibility,\n inputType,\n onChange,\n onFocus,\n onBlur,\n placeholder,\n isReadOnly,\n ref,\n value,\n ]\n );\n\n return (\n <Field\n errorMessage={errorMessage}\n hasVisibleLabel\n hint={hint}\n id={idOverride}\n isDisabled={isDisabled}\n label={label}\n renderFieldComponent={renderFieldComponent}\n />\n );\n }\n);\n\nconst MemoizedPasswordField = memo(PasswordField);\n\nexport { MemoizedPasswordField as PasswordField };\n"],"mappings":";;AAaA,SAGEA,UAHF,EAIEC,IAJF,EAKEC,WALF,EAMEC,QANF,QAOO,OAPP;SASSC,O,EAASC,U,EAAYC,U;SACrBC,K;;AA+DT,MAAMC,aAAa,GAAGR,UAAU,CAC9B,OAgBES,GAhBF,KAiBK;EAAA,IAhBH;IACEC,gBADF;IAEEC,SAFF;IAGEC,YAHF;IAIEC,IAJF;IAKEC,EAAE,EAAEC,UALN;IAMEC,UAAU,GAAG,KANf;IAOEC,UAPF;IAQEC,KARF;IASEC,QATF;IAUEC,OAVF;IAWEC,MAXF;IAYEC,WAZF;IAaEC;EAbF,CAgBG;EACH,MAAM,CAACC,SAAD,EAAYC,YAAZ,IAA4BtB,QAAQ,CAAC,UAAD,CAA1C;EAEA,MAAMuB,wBAAwB,GAAGxB,WAAW,CAAC,MAAM;IACjDuB,YAAY,CAAED,SAAD,IACXA,SAAS,KAAK,UAAd,GAA2B,MAA3B,GAAoC,UAD1B,CAAZ;EAGD,CAJ2C,EAIzC,EAJyC,CAA5C;EAMA,MAAMG,oBAAoB,GAAGzB,WAAW,CACtC;IAAA,IAAC;MAAE0B,eAAF;MAAmBd;IAAnB,CAAD;IAAA,OACE;MACE,oBAAkBc,eADpB;MAEE,YAAY,EAAElB,gBAFhB;MAIE,SAAS,EAAEC,SAJb;MAKE,YAAY,EACV;QAAgB,QAAQ,EAAC,KAAzB;QAAA,UACE,KAAC,UAAD;UACE,cAAW,4BADb;UAEE,IAAI,EAAC,KAFP;UAGE,OAAO,EAAEe,wBAHX;UAAA,UAKGF,SAAS,KAAK,UAAd,GAA2B,KAAC,OAAD,KAA3B,GAAyC,KAAC,UAAD;QAL5C;MADF,EANJ;MAgBE,EAAE,EAAEV,EAhBN;MAiBE,QAAQ,EAAEK,QAjBZ;MAkBE,OAAO,EAAEC,OAlBX;MAmBE,MAAM,EAAEC,MAnBV;MAoBE,WAAW,EAAEC,WApBf;MAqBE,QAAQ,EAAEL,UArBZ;MAsBE,GAAG,EAAER,GAtBP;MAuBE,IAAI,EAAEe,SAvBR;MAwBE,KAAK,EAAED;IAxBT,EADF;EAAA,CADsC,EA6BtC,CACEb,gBADF,EAEEC,SAFF,EAGEe,wBAHF,EAIEF,SAJF,EAKEL,QALF,EAMEC,OANF,EAOEC,MAPF,EAQEC,WARF,EASEL,UATF,EAUER,GAVF,EAWEc,KAXF,CA7BsC,CAAxC;EA4CA,OACE,KAAC,KAAD;IACE,YAAY,EAAEX,YADhB;IAEE,eAAe,MAFjB;IAGE,IAAI,EAAEC,IAHR;IAIE,EAAE,EAAEE,UAJN;IAKE,UAAU,EAAEC,UALd;IAME,KAAK,EAAEE,KANT;IAOE,oBAAoB,EAAES;EAPxB,EADF;AAWD,CAlF6B,CAAhC;AAqFA,MAAME,qBAAqB,GAAG5B,IAAI,CAACO,aAAD,CAAlC;AAEA,SAASqB,qBAAqB,IAAIrB,aAAlC"}
1
+ {"version":3,"file":"PasswordField.js","names":["forwardRef","memo","useCallback","useState","EyeIcon","EyeOffIcon","IconButton","Field","PasswordField","ref","autoCompleteType","errorMessage","hasInitialFocus","hint","id","idOverride","isDisabled","isOptional","isReadOnly","label","onChange","onFocus","onBlur","placeholder","value","inputType","setInputType","togglePasswordVisibility","renderFieldComponent","ariaDescribedBy","MemoizedPasswordField"],"sources":["../src/PasswordField.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 } from \"@mui/material\";\nimport {\n ChangeEventHandler,\n FocusEventHandler,\n forwardRef,\n memo,\n useCallback,\n useState,\n} from \"react\";\n\nimport { EyeIcon, EyeOffIcon, IconButton } from \"./\";\nimport { Field } from \"./Field\";\n\nexport type PasswordFieldProps = {\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?: \"current-password\" | \"new-password\";\n /**\n * If `error` is not undefined, the `input` will indicate an error.\n */\n errorMessage?: string;\n /**\n * If `true`, the component will receive focus automatically.\n */\n hasInitialFocus?: boolean;\n /**\n * The helper text content.\n */\n hint?: string;\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 * If `true`, the `input` element is not required.\n */\n isOptional?: boolean;\n /**\n * It prevents the user from changing the value of the field\n */\n isReadOnly?: boolean;\n /**\n * The label for the `input` element.\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 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 * The value of the `input` element, required for a controlled component.\n */\n value?: string;\n};\n\nconst PasswordField = forwardRef<HTMLInputElement, PasswordFieldProps>(\n (\n {\n autoCompleteType,\n errorMessage,\n hasInitialFocus,\n hint,\n id: idOverride,\n isDisabled = false,\n isOptional = false,\n isReadOnly,\n label,\n onChange,\n onFocus,\n onBlur,\n placeholder,\n value,\n },\n ref\n ) => {\n const [inputType, setInputType] = useState(\"password\");\n\n const togglePasswordVisibility = useCallback(() => {\n setInputType((inputType) =>\n inputType === \"password\" ? \"text\" : \"password\"\n );\n }, []);\n\n const renderFieldComponent = useCallback(\n ({ ariaDescribedBy, id }) => (\n <InputBase\n aria-describedby={ariaDescribedBy}\n autoComplete={autoCompleteType}\n /* eslint-disable-next-line jsx-a11y/no-autofocus */\n autoFocus={hasInitialFocus}\n endAdornment={\n <InputAdornment position=\"end\">\n <IconButton\n aria-label=\"toggle password visibility\"\n edge=\"end\"\n onClick={togglePasswordVisibility}\n >\n {inputType === \"password\" ? <EyeIcon /> : <EyeOffIcon />}\n </IconButton>\n </InputAdornment>\n }\n id={id}\n name={id}\n onChange={onChange}\n onFocus={onFocus}\n onBlur={onBlur}\n placeholder={placeholder}\n readOnly={isReadOnly}\n ref={ref}\n required={!isOptional}\n type={inputType}\n value={value}\n />\n ),\n [\n autoCompleteType,\n hasInitialFocus,\n togglePasswordVisibility,\n inputType,\n onChange,\n onFocus,\n onBlur,\n placeholder,\n isOptional,\n isReadOnly,\n ref,\n value,\n ]\n );\n\n return (\n <Field\n errorMessage={errorMessage}\n fieldType=\"single\"\n hasVisibleLabel\n hint={hint}\n id={idOverride}\n isDisabled={isDisabled}\n isOptional={isOptional}\n label={label}\n renderFieldComponent={renderFieldComponent}\n />\n );\n }\n);\n\nconst MemoizedPasswordField = memo(PasswordField);\n\nexport { MemoizedPasswordField as PasswordField };\n"],"mappings":";;AAaA,SAGEA,UAHF,EAIEC,IAJF,EAKEC,WALF,EAMEC,QANF,QAOO,OAPP;SASSC,O,EAASC,U,EAAYC,U;SACrBC,K;;AA+DT,MAAMC,aAAa,GAAGR,UAAU,CAC9B,OAiBES,GAjBF,KAkBK;EAAA,IAjBH;IACEC,gBADF;IAEEC,YAFF;IAGEC,eAHF;IAIEC,IAJF;IAKEC,EAAE,EAAEC,UALN;IAMEC,UAAU,GAAG,KANf;IAOEC,UAAU,GAAG,KAPf;IAQEC,UARF;IASEC,KATF;IAUEC,QAVF;IAWEC,OAXF;IAYEC,MAZF;IAaEC,WAbF;IAcEC;EAdF,CAiBG;EACH,MAAM,CAACC,SAAD,EAAYC,YAAZ,IAA4BvB,QAAQ,CAAC,UAAD,CAA1C;EAEA,MAAMwB,wBAAwB,GAAGzB,WAAW,CAAC,MAAM;IACjDwB,YAAY,CAAED,SAAD,IACXA,SAAS,KAAK,UAAd,GAA2B,MAA3B,GAAoC,UAD1B,CAAZ;EAGD,CAJ2C,EAIzC,EAJyC,CAA5C;EAMA,MAAMG,oBAAoB,GAAG1B,WAAW,CACtC;IAAA,IAAC;MAAE2B,eAAF;MAAmBf;IAAnB,CAAD;IAAA,OACE;MACE,oBAAkBe,eADpB;MAEE,YAAY,EAAEnB,gBAFhB;MAIE,SAAS,EAAEE,eAJb;MAKE,YAAY,EACV;QAAgB,QAAQ,EAAC,KAAzB;QAAA,UACE,KAAC,UAAD;UACE,cAAW,4BADb;UAEE,IAAI,EAAC,KAFP;UAGE,OAAO,EAAEe,wBAHX;UAAA,UAKGF,SAAS,KAAK,UAAd,GAA2B,KAAC,OAAD,KAA3B,GAAyC,KAAC,UAAD;QAL5C;MADF,EANJ;MAgBE,EAAE,EAAEX,EAhBN;MAiBE,IAAI,EAAEA,EAjBR;MAkBE,QAAQ,EAAEM,QAlBZ;MAmBE,OAAO,EAAEC,OAnBX;MAoBE,MAAM,EAAEC,MApBV;MAqBE,WAAW,EAAEC,WArBf;MAsBE,QAAQ,EAAEL,UAtBZ;MAuBE,GAAG,EAAET,GAvBP;MAwBE,QAAQ,EAAE,CAACQ,UAxBb;MAyBE,IAAI,EAAEQ,SAzBR;MA0BE,KAAK,EAAED;IA1BT,EADF;EAAA,CADsC,EA+BtC,CACEd,gBADF,EAEEE,eAFF,EAGEe,wBAHF,EAIEF,SAJF,EAKEL,QALF,EAMEC,OANF,EAOEC,MAPF,EAQEC,WARF,EASEN,UATF,EAUEC,UAVF,EAWET,GAXF,EAYEe,KAZF,CA/BsC,CAAxC;EA+CA,OACE,KAAC,KAAD;IACE,YAAY,EAAEb,YADhB;IAEE,SAAS,EAAC,QAFZ;IAGE,eAAe,MAHjB;IAIE,IAAI,EAAEE,IAJR;IAKE,EAAE,EAAEE,UALN;IAME,UAAU,EAAEC,UANd;IAOE,UAAU,EAAEC,UAPd;IAQE,KAAK,EAAEE,KART;IASE,oBAAoB,EAAES;EATxB,EADF;AAaD,CAxF6B,CAAhC;AA2FA,MAAME,qBAAqB,GAAG7B,IAAI,CAACO,aAAD,CAAlC;AAEA,SAASsB,qBAAqB,IAAItB,aAAlC"}
@@ -1,8 +1,7 @@
1
1
  import _RadioGroup from "@mui/material/RadioGroup";
2
- import { memo, useMemo } from "react";
3
- import { FormControl, FormLabel, FormHelperText, ScreenReaderText, useUniqueId } from "./index.js";
2
+ import { memo, useCallback } from "react";
3
+ import { Field } from "./Field.js";
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
- import { jsxs as _jsxs } from "react/jsx-runtime";
6
5
 
7
6
  const RadioGroup = _ref => {
8
7
  let {
@@ -10,36 +9,36 @@ const RadioGroup = _ref => {
10
9
  defaultValue,
11
10
  errorMessage,
12
11
  hint,
12
+ id: idOverride,
13
13
  isDisabled,
14
14
  label,
15
- name,
16
- onChange
15
+ onChange,
16
+ value
17
17
  } = _ref;
18
- const ariaDescribedBy = useMemo(() => errorMessage || hint ? [hint && `${name}-hint`, errorMessage && `${name}-error`].filter(Boolean).join(" ") : undefined, [errorMessage, hint, name]);
19
- const uniqueName = useUniqueId(name);
20
- return _jsxs(FormControl, {
21
- component: "fieldset",
22
- disabled: isDisabled,
23
- error: Boolean(errorMessage),
24
- children: [_jsx(FormLabel, {
25
- component: "legend",
26
- children: label
27
- }), hint && _jsx(FormHelperText, {
28
- id: `${uniqueName}-hint`,
29
- children: hint
30
- }), _jsx(_RadioGroup, {
18
+ const renderFieldComponent = useCallback(_ref2 => {
19
+ let {
20
+ ariaDescribedBy,
21
+ id
22
+ } = _ref2;
23
+ return _jsx(_RadioGroup, {
31
24
  "aria-describedby": ariaDescribedBy,
32
25
  defaultValue: defaultValue,
33
- name: uniqueName,
26
+ id: id,
27
+ name: id,
34
28
  onChange: onChange,
29
+ value: value,
35
30
  children: children
36
- }), errorMessage && _jsxs(FormHelperText, {
37
- id: `${uniqueName}-error`,
38
- error: true,
39
- children: [_jsx(ScreenReaderText, {
40
- children: "Error:"
41
- }), " ", errorMessage]
42
- })]
31
+ });
32
+ }, [children, defaultValue, onChange, value]);
33
+ return _jsx(Field, {
34
+ errorMessage: errorMessage,
35
+ fieldType: "group",
36
+ hasVisibleLabel: false,
37
+ hint: hint,
38
+ id: idOverride,
39
+ isDisabled: isDisabled,
40
+ label: label,
41
+ renderFieldComponent: renderFieldComponent
43
42
  });
44
43
  };
45
44
 
@@ -1 +1 @@
1
- {"version":3,"file":"RadioGroup.js","names":["memo","useMemo","FormControl","FormLabel","FormHelperText","ScreenReaderText","useUniqueId","RadioGroup","children","defaultValue","errorMessage","hint","isDisabled","label","name","onChange","ariaDescribedBy","filter","Boolean","join","undefined","uniqueName","MemoizedRadioGroup"],"sources":["../src/RadioGroup.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 { RadioGroup as MuiRadioGroup } from \"@mui/material\";\nimport { ChangeEventHandler, memo, ReactElement, useMemo } from \"react\";\n\nimport {\n FormControl,\n FormLabel,\n FormHelperText,\n Radio,\n ScreenReaderText,\n useUniqueId,\n RadioProps,\n} from \".\";\n\nexport interface RadioGroupProps {\n /**\n * The <Radio> components within the group. Must include two or more.\n */\n children: Array<ReactElement<typeof Radio>>;\n /**\n * The text value of the radio that should be selected by default\n */\n defaultValue?: string;\n /**\n * The error text for an invalid group\n */\n errorMessage?: string;\n /**\n * Optional hint text\n */\n hint?: string;\n /**\n * Disables the whole radio group\n */\n isDisabled?: boolean;\n /**\n * The text label for the radio group\n */\n label: string;\n /**\n * The name of the radio group, which only needs to be changed if there are multiple radio groups on the same screen\n */\n name?: string;\n /**\n * Listen for changes in the browser that change `value`.\n */\n onChange?: ChangeEventHandler<EventTarget>;\n /**\n * The `value` on the selected radio button.\n */\n value?: RadioProps[\"value\"];\n}\n\nconst RadioGroup = ({\n children,\n defaultValue,\n errorMessage,\n hint,\n isDisabled,\n label,\n name,\n onChange,\n}: RadioGroupProps) => {\n const ariaDescribedBy = useMemo(\n () =>\n errorMessage || hint\n ? [hint && `${name}-hint`, errorMessage && `${name}-error`]\n .filter(Boolean)\n .join(\" \")\n : undefined,\n [errorMessage, hint, name]\n );\n\n const uniqueName = useUniqueId(name);\n\n return (\n <FormControl\n component=\"fieldset\"\n disabled={isDisabled}\n error={Boolean(errorMessage)}\n >\n <FormLabel component=\"legend\">{label}</FormLabel>\n {hint && (\n <FormHelperText id={`${uniqueName}-hint`}>{hint}</FormHelperText>\n )}\n <MuiRadioGroup\n aria-describedby={ariaDescribedBy}\n defaultValue={defaultValue}\n name={uniqueName}\n onChange={onChange}\n >\n {children}\n </MuiRadioGroup>\n {errorMessage && (\n <FormHelperText id={`${uniqueName}-error`} error>\n <ScreenReaderText>Error:</ScreenReaderText> {errorMessage}\n </FormHelperText>\n )}\n </FormControl>\n );\n};\n\nconst MemoizedRadioGroup = memo(RadioGroup);\n\nexport { MemoizedRadioGroup as RadioGroup };\n"],"mappings":";AAaA,SAA6BA,IAA7B,EAAiDC,OAAjD,QAAgE,OAAhE;SAGEC,W,EACAC,S,EACAC,c,EAEAC,gB,EACAC,W;;;;AA2CF,MAAMC,UAAU,GAAG,QASI;EAAA,IATH;IAClBC,QADkB;IAElBC,YAFkB;IAGlBC,YAHkB;IAIlBC,IAJkB;IAKlBC,UALkB;IAMlBC,KANkB;IAOlBC,IAPkB;IAQlBC;EARkB,CASG;EACrB,MAAMC,eAAe,GAAGf,OAAO,CAC7B,MACES,YAAY,IAAIC,IAAhB,GACI,CAACA,IAAI,IAAK,GAAEG,IAAK,OAAjB,EAAyBJ,YAAY,IAAK,GAAEI,IAAK,QAAjD,EACGG,MADH,CACUC,OADV,EAEGC,IAFH,CAEQ,GAFR,CADJ,GAIIC,SANuB,EAO7B,CAACV,YAAD,EAAeC,IAAf,EAAqBG,IAArB,CAP6B,CAA/B;EAUA,MAAMO,UAAU,GAAGf,WAAW,CAACQ,IAAD,CAA9B;EAEA,OACE,MAAC,WAAD;IACE,SAAS,EAAC,UADZ;IAEE,QAAQ,EAAEF,UAFZ;IAGE,KAAK,EAAEM,OAAO,CAACR,YAAD,CAHhB;IAAA,WAKE,KAAC,SAAD;MAAW,SAAS,EAAC,QAArB;MAAA,UAA+BG;IAA/B,EALF,EAMGF,IAAI,IACH,KAAC,cAAD;MAAgB,EAAE,EAAG,GAAEU,UAAW,OAAlC;MAAA,UAA2CV;IAA3C,EAPJ,EASE;MACE,oBAAkBK,eADpB;MAEE,YAAY,EAAEP,YAFhB;MAGE,IAAI,EAAEY,UAHR;MAIE,QAAQ,EAAEN,QAJZ;MAAA,UAMGP;IANH,EATF,EAiBGE,YAAY,IACX,MAAC,cAAD;MAAgB,EAAE,EAAG,GAAEW,UAAW,QAAlC;MAA2C,KAAK,MAAhD;MAAA,WACE,KAAC,gBAAD;QAAA;MAAA,EADF,OAC+CX,YAD/C;IAAA,EAlBJ;EAAA,EADF;AAyBD,CA/CD;;AAiDA,MAAMY,kBAAkB,GAAGtB,IAAI,CAACO,UAAD,CAA/B;AAEA,SAASe,kBAAkB,IAAIf,UAA/B"}
1
+ {"version":3,"file":"RadioGroup.js","names":["memo","useCallback","Field","RadioGroup","children","defaultValue","errorMessage","hint","id","idOverride","isDisabled","label","onChange","value","renderFieldComponent","ariaDescribedBy","MemoizedRadioGroup"],"sources":["../src/RadioGroup.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 { RadioGroup as MuiRadioGroup } from \"@mui/material\";\nimport { ChangeEventHandler, memo, ReactElement, useCallback } from \"react\";\n\nimport { Radio, RadioProps } from \"./Radio\";\nimport { Field } from \"./Field\";\n\nexport type RadioGroupProps = {\n /**\n * The <Radio> components within the group. Must include two or more.\n */\n children: Array<ReactElement<typeof Radio>>;\n /**\n * The text value of the radio that should be selected by default\n */\n defaultValue?: string;\n /**\n * The error text for an invalid group\n */\n errorMessage?: string;\n /**\n * Optional hint text\n */\n hint?: string;\n /**\n * The id of the `input` element. This will also be the input's `name` field.\n */\n id?: string;\n /**\n * Disables the whole radio group\n */\n isDisabled?: boolean;\n /**\n * The text label for the radio group\n */\n label: string;\n /**\n * Listen for changes in the browser that change `value`.\n */\n onChange?: ChangeEventHandler<EventTarget>;\n /**\n * The `value` on the selected radio button.\n */\n value?: RadioProps[\"value\"];\n};\n\nconst RadioGroup = ({\n children,\n defaultValue,\n errorMessage,\n hint,\n id: idOverride,\n isDisabled,\n label,\n onChange,\n value,\n}: RadioGroupProps) => {\n const renderFieldComponent = useCallback(\n ({ ariaDescribedBy, id }) => (\n <MuiRadioGroup\n aria-describedby={ariaDescribedBy}\n defaultValue={defaultValue}\n id={id}\n name={id}\n onChange={onChange}\n value={value}\n >\n {children}\n </MuiRadioGroup>\n ),\n [children, defaultValue, onChange, value]\n );\n\n return (\n <Field\n errorMessage={errorMessage}\n fieldType=\"group\"\n hasVisibleLabel={false}\n hint={hint}\n id={idOverride}\n isDisabled={isDisabled}\n label={label}\n renderFieldComponent={renderFieldComponent}\n />\n );\n};\n\nconst MemoizedRadioGroup = memo(RadioGroup);\n\nexport { MemoizedRadioGroup as RadioGroup };\n"],"mappings":";AAaA,SAA6BA,IAA7B,EAAiDC,WAAjD,QAAoE,OAApE;SAGSC,K;;;AAyCT,MAAMC,UAAU,GAAG,QAUI;EAAA,IAVH;IAClBC,QADkB;IAElBC,YAFkB;IAGlBC,YAHkB;IAIlBC,IAJkB;IAKlBC,EAAE,EAAEC,UALc;IAMlBC,UANkB;IAOlBC,KAPkB;IAQlBC,QARkB;IASlBC;EATkB,CAUG;EACrB,MAAMC,oBAAoB,GAAGb,WAAW,CACtC;IAAA,IAAC;MAAEc,eAAF;MAAmBP;IAAnB,CAAD;IAAA,OACE;MACE,oBAAkBO,eADpB;MAEE,YAAY,EAAEV,YAFhB;MAGE,EAAE,EAAEG,EAHN;MAIE,IAAI,EAAEA,EAJR;MAKE,QAAQ,EAAEI,QALZ;MAME,KAAK,EAAEC,KANT;MAAA,UAQGT;IARH,EADF;EAAA,CADsC,EAatC,CAACA,QAAD,EAAWC,YAAX,EAAyBO,QAAzB,EAAmCC,KAAnC,CAbsC,CAAxC;EAgBA,OACE,KAAC,KAAD;IACE,YAAY,EAAEP,YADhB;IAEE,SAAS,EAAC,OAFZ;IAGE,eAAe,EAAE,KAHnB;IAIE,IAAI,EAAEC,IAJR;IAKE,EAAE,EAAEE,UALN;IAME,UAAU,EAAEC,UANd;IAOE,KAAK,EAAEC,KAPT;IAQE,oBAAoB,EAAEG;EARxB,EADF;AAYD,CAvCD;;AAyCA,MAAME,kBAAkB,GAAGhB,IAAI,CAACG,UAAD,CAA/B;AAEA,SAASa,kBAAkB,IAAIb,UAA/B"}
@@ -7,7 +7,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
7
7
  const SearchField = forwardRef((_ref, ref) => {
8
8
  let {
9
9
  autoCompleteType,
10
- autoFocus,
10
+ hasInitialFocus,
11
11
  id: idOverride,
12
12
  isDisabled = false,
13
13
  label,
@@ -25,8 +25,9 @@ const SearchField = forwardRef((_ref, ref) => {
25
25
  return _jsx(_InputBase, {
26
26
  "aria-describedby": ariaDescribedBy,
27
27
  autoComplete: autoCompleteType,
28
- autoFocus: autoFocus,
28
+ autoFocus: hasInitialFocus,
29
29
  id: id,
30
+ name: id,
30
31
  onChange: onChange,
31
32
  onFocus: onFocus,
32
33
  onBlur: onBlur,
@@ -39,12 +40,13 @@ const SearchField = forwardRef((_ref, ref) => {
39
40
  type: "search",
40
41
  value: value
41
42
  });
42
- }, [autoCompleteType, autoFocus, onChange, onFocus, onBlur, placeholder, ref, value]);
43
+ }, [autoCompleteType, hasInitialFocus, onChange, onFocus, onBlur, placeholder, ref, value]);
43
44
  return _jsx(Field, {
45
+ fieldType: "single",
44
46
  hasVisibleLabel: false,
45
47
  id: idOverride,
46
48
  isDisabled: isDisabled,
47
- isRequired: false,
49
+ isOptional: true,
48
50
  label: label,
49
51
  renderFieldComponent: renderFieldComponent
50
52
  });
@@ -1 +1 @@
1
- {"version":3,"file":"SearchField.js","names":["forwardRef","memo","useCallback","SearchIcon","Field","SearchField","ref","autoCompleteType","autoFocus","id","idOverride","isDisabled","label","onChange","onFocus","onBlur","placeholder","value","renderFieldComponent","ariaDescribedBy","MemoizedSearchField"],"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 } from \"@mui/material\";\nimport {\n ChangeEventHandler,\n FocusEventHandler,\n forwardRef,\n InputHTMLAttributes,\n memo,\n useCallback,\n} from \"react\";\n\nimport { SearchIcon } from \"./\";\nimport { Field } from \"./Field\";\n\nexport type SearchFieldProps = {\n /**\n * If `true`, the component will receive focus automatically.\n */\n autoFocus?: boolean;\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 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 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 * The value of the `input` element, required for a controlled component.\n */\n value?: string;\n};\n\nconst SearchField = forwardRef<HTMLInputElement, SearchFieldProps>(\n (\n {\n autoCompleteType,\n autoFocus,\n id: idOverride,\n isDisabled = false,\n label,\n onChange,\n onFocus,\n onBlur,\n placeholder,\n value,\n },\n ref\n ) => {\n const renderFieldComponent = useCallback(\n ({ ariaDescribedBy, id }) => (\n <InputBase\n aria-describedby={ariaDescribedBy}\n autoComplete={autoCompleteType}\n /* eslint-disable-next-line jsx-a11y/no-autofocus */\n autoFocus={autoFocus}\n id={id}\n onChange={onChange}\n onFocus={onFocus}\n onBlur={onBlur}\n placeholder={placeholder}\n ref={ref}\n startAdornment={\n <InputAdornment position=\"start\">\n <SearchIcon />\n </InputAdornment>\n }\n type=\"search\"\n value={value}\n />\n ),\n [\n autoCompleteType,\n autoFocus,\n onChange,\n onFocus,\n onBlur,\n placeholder,\n ref,\n value,\n ]\n );\n\n return (\n <Field\n hasVisibleLabel={false}\n id={idOverride}\n isDisabled={isDisabled}\n isRequired={false}\n label={label}\n renderFieldComponent={renderFieldComponent}\n />\n );\n }\n);\n\nconst MemoizedSearchField = memo(SearchField);\n\nexport { MemoizedSearchField as SearchField };\n"],"mappings":";;AAaA,SAGEA,UAHF,EAKEC,IALF,EAMEC,WANF,QAOO,OAPP;SASSC,U;SACAC,K;;AA+CT,MAAMC,WAAW,GAAGL,UAAU,CAC5B,OAaEM,GAbF,KAcK;EAAA,IAbH;IACEC,gBADF;IAEEC,SAFF;IAGEC,EAAE,EAAEC,UAHN;IAIEC,UAAU,GAAG,KAJf;IAKEC,KALF;IAMEC,QANF;IAOEC,OAPF;IAQEC,MARF;IASEC,WATF;IAUEC;EAVF,CAaG;EACH,MAAMC,oBAAoB,GAAGhB,WAAW,CACtC;IAAA,IAAC;MAAEiB,eAAF;MAAmBV;IAAnB,CAAD;IAAA,OACE;MACE,oBAAkBU,eADpB;MAEE,YAAY,EAAEZ,gBAFhB;MAIE,SAAS,EAAEC,SAJb;MAKE,EAAE,EAAEC,EALN;MAME,QAAQ,EAAEI,QANZ;MAOE,OAAO,EAAEC,OAPX;MAQE,MAAM,EAAEC,MARV;MASE,WAAW,EAAEC,WATf;MAUE,GAAG,EAAEV,GAVP;MAWE,cAAc,EACZ;QAAgB,QAAQ,EAAC,OAAzB;QAAA,UACE,KAAC,UAAD;MADF,EAZJ;MAgBE,IAAI,EAAC,QAhBP;MAiBE,KAAK,EAAEW;IAjBT,EADF;EAAA,CADsC,EAsBtC,CACEV,gBADF,EAEEC,SAFF,EAGEK,QAHF,EAIEC,OAJF,EAKEC,MALF,EAMEC,WANF,EAOEV,GAPF,EAQEW,KARF,CAtBsC,CAAxC;EAkCA,OACE,KAAC,KAAD;IACE,eAAe,EAAE,KADnB;IAEE,EAAE,EAAEP,UAFN;IAGE,UAAU,EAAEC,UAHd;IAIE,UAAU,EAAE,KAJd;IAKE,KAAK,EAAEC,KALT;IAME,oBAAoB,EAAEM;EANxB,EADF;AAUD,CA5D2B,CAA9B;AA+DA,MAAME,mBAAmB,GAAGnB,IAAI,CAACI,WAAD,CAAhC;AAEA,SAASe,mBAAmB,IAAIf,WAAhC"}
1
+ {"version":3,"file":"SearchField.js","names":["forwardRef","memo","useCallback","SearchIcon","Field","SearchField","ref","autoCompleteType","hasInitialFocus","id","idOverride","isDisabled","label","onChange","onFocus","onBlur","placeholder","value","renderFieldComponent","ariaDescribedBy","MemoizedSearchField"],"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 } from \"@mui/material\";\nimport {\n ChangeEventHandler,\n FocusEventHandler,\n forwardRef,\n InputHTMLAttributes,\n memo,\n useCallback,\n} from \"react\";\n\nimport { SearchIcon } from \"./\";\nimport { Field } from \"./Field\";\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 * 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 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 * The value of the `input` element, required for a controlled component.\n */\n value?: string;\n};\n\nconst SearchField = forwardRef<HTMLInputElement, SearchFieldProps>(\n (\n {\n autoCompleteType,\n hasInitialFocus,\n id: idOverride,\n isDisabled = false,\n label,\n onChange,\n onFocus,\n onBlur,\n placeholder,\n value,\n },\n ref\n ) => {\n const renderFieldComponent = useCallback(\n ({ ariaDescribedBy, id }) => (\n <InputBase\n aria-describedby={ariaDescribedBy}\n autoComplete={autoCompleteType}\n /* eslint-disable-next-line jsx-a11y/no-autofocus */\n autoFocus={hasInitialFocus}\n id={id}\n name={id}\n onChange={onChange}\n onFocus={onFocus}\n onBlur={onBlur}\n placeholder={placeholder}\n ref={ref}\n startAdornment={\n <InputAdornment position=\"start\">\n <SearchIcon />\n </InputAdornment>\n }\n type=\"search\"\n value={value}\n />\n ),\n [\n autoCompleteType,\n hasInitialFocus,\n onChange,\n onFocus,\n onBlur,\n placeholder,\n ref,\n value,\n ]\n );\n\n return (\n <Field\n fieldType=\"single\"\n hasVisibleLabel={false}\n id={idOverride}\n isDisabled={isDisabled}\n isOptional={true}\n label={label}\n renderFieldComponent={renderFieldComponent}\n />\n );\n }\n);\n\nconst MemoizedSearchField = memo(SearchField);\n\nexport { MemoizedSearchField as SearchField };\n"],"mappings":";;AAaA,SAGEA,UAHF,EAKEC,IALF,EAMEC,WANF,QAOO,OAPP;SASSC,U;SACAC,K;;AA+CT,MAAMC,WAAW,GAAGL,UAAU,CAC5B,OAaEM,GAbF,KAcK;EAAA,IAbH;IACEC,gBADF;IAEEC,eAFF;IAGEC,EAAE,EAAEC,UAHN;IAIEC,UAAU,GAAG,KAJf;IAKEC,KALF;IAMEC,QANF;IAOEC,OAPF;IAQEC,MARF;IASEC,WATF;IAUEC;EAVF,CAaG;EACH,MAAMC,oBAAoB,GAAGhB,WAAW,CACtC;IAAA,IAAC;MAAEiB,eAAF;MAAmBV;IAAnB,CAAD;IAAA,OACE;MACE,oBAAkBU,eADpB;MAEE,YAAY,EAAEZ,gBAFhB;MAIE,SAAS,EAAEC,eAJb;MAKE,EAAE,EAAEC,EALN;MAME,IAAI,EAAEA,EANR;MAOE,QAAQ,EAAEI,QAPZ;MAQE,OAAO,EAAEC,OARX;MASE,MAAM,EAAEC,MATV;MAUE,WAAW,EAAEC,WAVf;MAWE,GAAG,EAAEV,GAXP;MAYE,cAAc,EACZ;QAAgB,QAAQ,EAAC,OAAzB;QAAA,UACE,KAAC,UAAD;MADF,EAbJ;MAiBE,IAAI,EAAC,QAjBP;MAkBE,KAAK,EAAEW;IAlBT,EADF;EAAA,CADsC,EAuBtC,CACEV,gBADF,EAEEC,eAFF,EAGEK,QAHF,EAIEC,OAJF,EAKEC,MALF,EAMEC,WANF,EAOEV,GAPF,EAQEW,KARF,CAvBsC,CAAxC;EAmCA,OACE,KAAC,KAAD;IACE,SAAS,EAAC,QADZ;IAEE,eAAe,EAAE,KAFnB;IAGE,EAAE,EAAEP,UAHN;IAIE,UAAU,EAAEC,UAJd;IAKE,UAAU,EAAE,IALd;IAME,KAAK,EAAEC,KANT;IAOE,oBAAoB,EAAEM;EAPxB,EADF;AAWD,CA9D2B,CAA9B;AAiEA,MAAME,mBAAmB,GAAGnB,IAAI,CAACI,WAAD,CAAhC;AAEA,SAASe,mBAAmB,IAAIf,WAAhC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Status.js","names":["Chip","Status","severity","label"],"sources":["../src/Status.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 { Chip } from \"./\";\n\nexport interface StatusProps {\n /**\n * Determine the color and icon of the alert\n */\n severity: \"default\" | \"error\" | \"info\" | \"success\" | \"warning\";\n\n /**\n * The text content of the status\n */\n label: string;\n}\n\nexport const Status = ({ severity, label }: StatusProps) => (\n <Chip label={label} color={severity} variant=\"status\" />\n);\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;SAESA,I;;AAcT,OAAO,MAAMC,MAAM,GAAG;EAAA,IAAC;IAAEC,QAAF;IAAYC;EAAZ,CAAD;EAAA,OACpB,KAAC,IAAD;IAAM,KAAK,EAAEA,KAAb;IAAoB,KAAK,EAAED,QAA3B;IAAqC,OAAO,EAAC;EAA7C,EADoB;AAAA,CAAf"}
1
+ {"version":3,"file":"Status.js","names":["Chip","Status","severity","label"],"sources":["../src/Status.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 { Chip } from \"./\";\n\nexport type StatusProps = {\n /**\n * Determine the color and icon of the alert\n */\n severity: \"default\" | \"error\" | \"info\" | \"success\" | \"warning\";\n\n /**\n * The text content of the status\n */\n label: string;\n};\n\nexport const Status = ({ severity, label }: StatusProps) => (\n <Chip label={label} color={severity} variant=\"status\" />\n);\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;SAESA,I;;AAcT,OAAO,MAAMC,MAAM,GAAG;EAAA,IAAC;IAAEC,QAAF;IAAYC;EAAZ,CAAD;EAAA,OACpB,KAAC,IAAD;IAAM,KAAK,EAAEA,KAAb;IAAoB,KAAK,EAAED,QAA3B;IAAqC,OAAO,EAAC;EAA7C,EADoB;AAAA,CAAf"}
package/dist/TextField.js CHANGED
@@ -1,24 +1,25 @@
1
1
  import _InputBase from "@mui/material/InputBase";
2
+ import _InputAdornment from "@mui/material/InputAdornment";
2
3
  import { forwardRef, memo, useCallback } from "react";
3
4
  import { Field } from "./Field.js";
4
5
  import { jsx as _jsx } from "react/jsx-runtime";
5
6
  const TextField = forwardRef((_ref, ref) => {
6
7
  let {
7
8
  autoCompleteType,
8
- autoFocus,
9
+ hasInitialFocus,
9
10
  endAdornment,
10
11
  errorMessage,
11
12
  hint,
12
13
  id: idOverride,
13
14
  isDisabled = false,
14
15
  isMultiline = false,
16
+ isOptional = false,
15
17
  isReadOnly,
16
- isRequired = true,
17
18
  label,
18
19
  onBlur,
19
20
  onChange,
20
21
  onFocus,
21
- optionalLabel,
22
+ optionalLabel = "Optional",
22
23
  placeholder,
23
24
  startAdornment,
24
25
  type = "text",
@@ -32,28 +33,36 @@ const TextField = forwardRef((_ref, ref) => {
32
33
  return _jsx(_InputBase, {
33
34
  "aria-describedby": ariaDescribedBy,
34
35
  autoComplete: autoCompleteType,
35
- autoFocus: autoFocus,
36
- endAdornment: endAdornment,
36
+ autoFocus: hasInitialFocus,
37
+ endAdornment: endAdornment && _jsx(_InputAdornment, {
38
+ position: "end",
39
+ children: endAdornment
40
+ }),
37
41
  id: id,
38
42
  multiline: isMultiline,
43
+ name: id,
39
44
  onBlur: onBlur,
40
45
  onChange: onChange,
41
46
  onFocus: onFocus,
42
47
  placeholder: placeholder,
43
48
  readOnly: isReadOnly,
44
49
  ref: ref,
45
- startAdornment: startAdornment,
50
+ startAdornment: startAdornment && _jsx(_InputAdornment, {
51
+ position: "start",
52
+ children: startAdornment
53
+ }),
46
54
  type: type,
47
55
  value: value
48
56
  });
49
- }, [autoCompleteType, autoFocus, endAdornment, isMultiline, onChange, onFocus, onBlur, placeholder, isReadOnly, ref, startAdornment, type, value]);
57
+ }, [autoCompleteType, hasInitialFocus, endAdornment, isMultiline, onChange, onFocus, onBlur, placeholder, isReadOnly, ref, startAdornment, type, value]);
50
58
  return _jsx(Field, {
51
59
  errorMessage: errorMessage,
60
+ fieldType: "single",
52
61
  hasVisibleLabel: true,
53
62
  hint: hint,
54
63
  id: idOverride,
55
64
  isDisabled: isDisabled,
56
- isRequired: isRequired,
65
+ isOptional: isOptional,
57
66
  label: label,
58
67
  optionalLabel: optionalLabel,
59
68
  renderFieldComponent: renderFieldComponent
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.js","names":["forwardRef","memo","useCallback","Field","TextField","ref","autoCompleteType","autoFocus","endAdornment","errorMessage","hint","id","idOverride","isDisabled","isMultiline","isReadOnly","isRequired","label","onBlur","onChange","onFocus","optionalLabel","placeholder","startAdornment","type","value","renderFieldComponent","ariaDescribedBy","MemoizedTextField"],"sources":["../src/TextField.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 { InputBase } from \"@mui/material\";\nimport {\n ChangeEventHandler,\n FocusEventHandler,\n forwardRef,\n InputHTMLAttributes,\n memo,\n ReactNode,\n useCallback,\n} from \"react\";\n\nimport { Field } from \"./Field\";\n\nexport type TextFieldProps = {\n /**\n * If `true`, the component will receive focus automatically.\n */\n autoFocus?: boolean;\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 * End `InputAdornment` for this component.\n */\n endAdornment?: ReactNode;\n /**\n * If `error` is not undefined, the `input` will indicate an error.\n */\n errorMessage?: string;\n /**\n * The helper text content.\n */\n hint?: string;\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 * If `true`, a [TextareaAutosize](/material-ui/react-textarea-autosize/) element is rendered.\n */\n isMultiline?: boolean;\n /**\n * It prevents the user from changing the value of the field\n */\n isReadOnly?: boolean;\n /**\n * If `true`, the `input` element is required.\n */\n isRequired?: boolean;\n /**\n * The label for the `input` element.\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 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 label for the `input` element if the it's not optional\n */\n optionalLabel?: string;\n /**\n * The short hint displayed in the `input` before the user enters a value.\n */\n placeholder?: string;\n /**\n * Start `InputAdornment` for this component.\n */\n startAdornment?: ReactNode;\n /**\n * Type of the `input` element. It should be [a valid HTML5 input type](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Form_%3Cinput%3E_types).\n */\n type?: \"email\" | \"number\" | \"tel\" | \"text\" | \"url\";\n /**\n * The value of the `input` element, required for a controlled component.\n */\n value?: string;\n};\n\nconst TextField = forwardRef<HTMLInputElement, TextFieldProps>(\n (\n {\n autoCompleteType,\n autoFocus,\n endAdornment,\n errorMessage,\n hint,\n id: idOverride,\n isDisabled = false,\n isMultiline = false,\n isReadOnly,\n isRequired = true,\n label,\n onBlur,\n onChange,\n onFocus,\n optionalLabel,\n placeholder,\n startAdornment,\n type = \"text\",\n value,\n },\n ref\n ) => {\n const renderFieldComponent = useCallback(\n ({ ariaDescribedBy, id }) => (\n <InputBase\n aria-describedby={ariaDescribedBy}\n autoComplete={autoCompleteType}\n /* eslint-disable-next-line jsx-a11y/no-autofocus */\n autoFocus={autoFocus}\n endAdornment={endAdornment}\n id={id}\n multiline={isMultiline}\n onBlur={onBlur}\n onChange={onChange}\n onFocus={onFocus}\n placeholder={placeholder}\n readOnly={isReadOnly}\n ref={ref}\n startAdornment={startAdornment}\n type={type}\n value={value}\n />\n ),\n [\n autoCompleteType,\n autoFocus,\n endAdornment,\n isMultiline,\n onChange,\n onFocus,\n onBlur,\n placeholder,\n isReadOnly,\n ref,\n startAdornment,\n type,\n value,\n ]\n );\n\n return (\n <Field\n errorMessage={errorMessage}\n hasVisibleLabel\n hint={hint}\n id={idOverride}\n isDisabled={isDisabled}\n isRequired={isRequired}\n label={label}\n optionalLabel={optionalLabel}\n renderFieldComponent={renderFieldComponent}\n />\n );\n }\n);\n\nconst MemoizedTextField = memo(TextField);\n\nexport { MemoizedTextField as TextField };\n"],"mappings":";AAaA,SAGEA,UAHF,EAKEC,IALF,EAOEC,WAPF,QAQO,OARP;SAUSC,K;;AAmFT,MAAMC,SAAS,GAAGJ,UAAU,CAC1B,OAsBEK,GAtBF,KAuBK;EAAA,IAtBH;IACEC,gBADF;IAEEC,SAFF;IAGEC,YAHF;IAIEC,YAJF;IAKEC,IALF;IAMEC,EAAE,EAAEC,UANN;IAOEC,UAAU,GAAG,KAPf;IAQEC,WAAW,GAAG,KARhB;IASEC,UATF;IAUEC,UAAU,GAAG,IAVf;IAWEC,KAXF;IAYEC,MAZF;IAaEC,QAbF;IAcEC,OAdF;IAeEC,aAfF;IAgBEC,WAhBF;IAiBEC,cAjBF;IAkBEC,IAAI,GAAG,MAlBT;IAmBEC;EAnBF,CAsBG;EACH,MAAMC,oBAAoB,GAAGxB,WAAW,CACtC;IAAA,IAAC;MAAEyB,eAAF;MAAmBhB;IAAnB,CAAD;IAAA,OACE;MACE,oBAAkBgB,eADpB;MAEE,YAAY,EAAErB,gBAFhB;MAIE,SAAS,EAAEC,SAJb;MAKE,YAAY,EAAEC,YALhB;MAME,EAAE,EAAEG,EANN;MAOE,SAAS,EAAEG,WAPb;MAQE,MAAM,EAAEI,MARV;MASE,QAAQ,EAAEC,QATZ;MAUE,OAAO,EAAEC,OAVX;MAWE,WAAW,EAAEE,WAXf;MAYE,QAAQ,EAAEP,UAZZ;MAaE,GAAG,EAAEV,GAbP;MAcE,cAAc,EAAEkB,cAdlB;MAeE,IAAI,EAAEC,IAfR;MAgBE,KAAK,EAAEC;IAhBT,EADF;EAAA,CADsC,EAqBtC,CACEnB,gBADF,EAEEC,SAFF,EAGEC,YAHF,EAIEM,WAJF,EAKEK,QALF,EAMEC,OANF,EAOEF,MAPF,EAQEI,WARF,EASEP,UATF,EAUEV,GAVF,EAWEkB,cAXF,EAYEC,IAZF,EAaEC,KAbF,CArBsC,CAAxC;EAsCA,OACE,KAAC,KAAD;IACE,YAAY,EAAEhB,YADhB;IAEE,eAAe,MAFjB;IAGE,IAAI,EAAEC,IAHR;IAIE,EAAE,EAAEE,UAJN;IAKE,UAAU,EAAEC,UALd;IAME,UAAU,EAAEG,UANd;IAOE,KAAK,EAAEC,KAPT;IAQE,aAAa,EAAEI,aARjB;IASE,oBAAoB,EAAEK;EATxB,EADF;AAaD,CA5EyB,CAA5B;AA+EA,MAAME,iBAAiB,GAAG3B,IAAI,CAACG,SAAD,CAA9B;AAEA,SAASwB,iBAAiB,IAAIxB,SAA9B"}
1
+ {"version":3,"file":"TextField.js","names":["forwardRef","memo","useCallback","Field","TextField","ref","autoCompleteType","hasInitialFocus","endAdornment","errorMessage","hint","id","idOverride","isDisabled","isMultiline","isOptional","isReadOnly","label","onBlur","onChange","onFocus","optionalLabel","placeholder","startAdornment","type","value","renderFieldComponent","ariaDescribedBy","MemoizedTextField"],"sources":["../src/TextField.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 } from \"@mui/material\";\nimport {\n ChangeEventHandler,\n FocusEventHandler,\n forwardRef,\n InputHTMLAttributes,\n memo,\n ReactElement,\n useCallback,\n} from \"react\";\n\nimport { Field } from \"./Field\";\nimport { Icon } from \"./Icon\";\n\nexport type TextFieldProps = {\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 * End `InputAdornment` for this component.\n */\n endAdornment?: string | ReactElement<typeof Icon>;\n /**\n * If `error` is not undefined, the `input` will indicate an error.\n */\n errorMessage?: string;\n /**\n * If `true`, the component will receive focus automatically.\n */\n hasInitialFocus?: boolean;\n /**\n * The helper text content.\n */\n hint?: string;\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 * If `true`, a [TextareaAutosize](/material-ui/react-textarea-autosize/) element is rendered.\n */\n isMultiline?: boolean;\n /**\n * If `true`, the `input` element is not required.\n */\n isOptional?: boolean;\n /**\n * It prevents the user from changing the value of the field\n */\n isReadOnly?: boolean;\n /**\n * The label for the `input` element.\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 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 label for the `input` element if it's optional\n */\n optionalLabel?: string;\n /**\n * The short hint displayed in the `input` before the user enters a value.\n */\n placeholder?: string;\n /**\n * Start `InputAdornment` for this component.\n */\n startAdornment?: string | ReactElement<typeof Icon>;\n /**\n * Type of the `input` element. It should be [a valid HTML5 input type](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Form_%3Cinput%3E_types).\n */\n type?: \"email\" | \"number\" | \"tel\" | \"text\" | \"url\";\n /**\n * The value of the `input` element, required for a controlled component.\n */\n value?: string;\n};\n\nconst TextField = forwardRef<HTMLInputElement, TextFieldProps>(\n (\n {\n autoCompleteType,\n hasInitialFocus,\n endAdornment,\n errorMessage,\n hint,\n id: idOverride,\n isDisabled = false,\n isMultiline = false,\n isOptional = false,\n isReadOnly,\n label,\n onBlur,\n onChange,\n onFocus,\n optionalLabel = \"Optional\",\n placeholder,\n startAdornment,\n type = \"text\",\n value,\n },\n ref\n ) => {\n const renderFieldComponent = useCallback(\n ({ ariaDescribedBy, id }) => (\n <InputBase\n aria-describedby={ariaDescribedBy}\n autoComplete={autoCompleteType}\n /* eslint-disable-next-line jsx-a11y/no-autofocus */\n autoFocus={hasInitialFocus}\n endAdornment={\n endAdornment && (\n <InputAdornment position=\"end\">{endAdornment}</InputAdornment>\n )\n }\n id={id}\n multiline={isMultiline}\n name={id}\n onBlur={onBlur}\n onChange={onChange}\n onFocus={onFocus}\n placeholder={placeholder}\n readOnly={isReadOnly}\n ref={ref}\n startAdornment={\n startAdornment && (\n <InputAdornment position=\"start\">{startAdornment}</InputAdornment>\n )\n }\n type={type}\n value={value}\n />\n ),\n [\n autoCompleteType,\n hasInitialFocus,\n endAdornment,\n isMultiline,\n onChange,\n onFocus,\n onBlur,\n placeholder,\n isReadOnly,\n ref,\n startAdornment,\n type,\n value,\n ]\n );\n\n return (\n <Field\n errorMessage={errorMessage}\n fieldType=\"single\"\n hasVisibleLabel\n hint={hint}\n id={idOverride}\n isDisabled={isDisabled}\n isOptional={isOptional}\n label={label}\n optionalLabel={optionalLabel}\n renderFieldComponent={renderFieldComponent}\n />\n );\n }\n);\n\nconst MemoizedTextField = memo(TextField);\n\nexport { MemoizedTextField as TextField };\n"],"mappings":";;AAaA,SAGEA,UAHF,EAKEC,IALF,EAOEC,WAPF,QAQO,OARP;SAUSC,K;;AAoFT,MAAMC,SAAS,GAAGJ,UAAU,CAC1B,OAsBEK,GAtBF,KAuBK;EAAA,IAtBH;IACEC,gBADF;IAEEC,eAFF;IAGEC,YAHF;IAIEC,YAJF;IAKEC,IALF;IAMEC,EAAE,EAAEC,UANN;IAOEC,UAAU,GAAG,KAPf;IAQEC,WAAW,GAAG,KARhB;IASEC,UAAU,GAAG,KATf;IAUEC,UAVF;IAWEC,KAXF;IAYEC,MAZF;IAaEC,QAbF;IAcEC,OAdF;IAeEC,aAAa,GAAG,UAflB;IAgBEC,WAhBF;IAiBEC,cAjBF;IAkBEC,IAAI,GAAG,MAlBT;IAmBEC;EAnBF,CAsBG;EACH,MAAMC,oBAAoB,GAAGxB,WAAW,CACtC;IAAA,IAAC;MAAEyB,eAAF;MAAmBhB;IAAnB,CAAD;IAAA,OACE;MACE,oBAAkBgB,eADpB;MAEE,YAAY,EAAErB,gBAFhB;MAIE,SAAS,EAAEC,eAJb;MAKE,YAAY,EACVC,YAAY,IACV;QAAgB,QAAQ,EAAC,KAAzB;QAAA,UAAgCA;MAAhC,EAPN;MAUE,EAAE,EAAEG,EAVN;MAWE,SAAS,EAAEG,WAXb;MAYE,IAAI,EAAEH,EAZR;MAaE,MAAM,EAAEO,MAbV;MAcE,QAAQ,EAAEC,QAdZ;MAeE,OAAO,EAAEC,OAfX;MAgBE,WAAW,EAAEE,WAhBf;MAiBE,QAAQ,EAAEN,UAjBZ;MAkBE,GAAG,EAAEX,GAlBP;MAmBE,cAAc,EACZkB,cAAc,IACZ;QAAgB,QAAQ,EAAC,OAAzB;QAAA,UAAkCA;MAAlC,EArBN;MAwBE,IAAI,EAAEC,IAxBR;MAyBE,KAAK,EAAEC;IAzBT,EADF;EAAA,CADsC,EA8BtC,CACEnB,gBADF,EAEEC,eAFF,EAGEC,YAHF,EAIEM,WAJF,EAKEK,QALF,EAMEC,OANF,EAOEF,MAPF,EAQEI,WARF,EASEN,UATF,EAUEX,GAVF,EAWEkB,cAXF,EAYEC,IAZF,EAaEC,KAbF,CA9BsC,CAAxC;EA+CA,OACE,KAAC,KAAD;IACE,YAAY,EAAEhB,YADhB;IAEE,SAAS,EAAC,QAFZ;IAGE,eAAe,MAHjB;IAIE,IAAI,EAAEC,IAJR;IAKE,EAAE,EAAEE,UALN;IAME,UAAU,EAAEC,UANd;IAOE,UAAU,EAAEE,UAPd;IAQE,KAAK,EAAEE,KART;IASE,aAAa,EAAEI,aATjB;IAUE,oBAAoB,EAAEK;EAVxB,EADF;AAcD,CAtFyB,CAA5B;AAyFA,MAAME,iBAAiB,GAAG3B,IAAI,CAACG,SAAD,CAA9B;AAEA,SAASwB,iBAAiB,IAAIxB,SAA9B"}
package/dist/Toast.js ADDED
@@ -0,0 +1,72 @@
1
+ /*!
2
+ * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.
3
+ * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
4
+ *
5
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
6
+ * Unless required by applicable law or agreed to in writing, software
7
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
8
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9
+ *
10
+ * See the License for the specific language governing permissions and limitations under the License.
11
+ */
12
+ import { useEffect, memo, forwardRef, useState, useCallback } from "react";
13
+ import { Alert, AlertTitle, CloseIcon, Link, Snackbar, visuallyHidden } from "./index.js";
14
+ import { Button } from "./Button.js";
15
+ import { jsx as _jsx } from "react/jsx-runtime";
16
+ import { jsxs as _jsxs } from "react/jsx-runtime";
17
+ const ClickAwayListenerProps = {
18
+ onClickAway: () => false
19
+ };
20
+ const Toast = forwardRef(_ref => {
21
+ let {
22
+ autoHideDuration = 6000,
23
+ isDismissable,
24
+ linkText,
25
+ linkUrl,
26
+ isVisible: isVisibleProp,
27
+ onHide: onHideProp,
28
+ role,
29
+ severity,
30
+ text
31
+ } = _ref;
32
+ const [isVisible, setIsVisible] = useState(isVisibleProp);
33
+ useEffect(() => {
34
+ setIsVisible(isVisibleProp);
35
+ }, [isVisibleProp]);
36
+ const onHide = useCallback(() => {
37
+ setIsVisible(false);
38
+ onHideProp?.();
39
+ }, [onHideProp]);
40
+ return _jsx(Snackbar, {
41
+ open: isVisible,
42
+ autoHideDuration: isDismissable || autoHideDuration <= 0 ? undefined : autoHideDuration,
43
+ onClose: onHide,
44
+ className: "Toast",
45
+ ClickAwayListenerProps: ClickAwayListenerProps,
46
+ children: _jsxs(Alert, {
47
+ action: isDismissable === true && _jsx(Button, {
48
+ "aria-label": "close",
49
+ onClick: onHide,
50
+ size: "small",
51
+ startIcon: _jsx(CloseIcon, {}),
52
+ variant: "floating"
53
+ }),
54
+ role: role,
55
+ severity: severity,
56
+ variant: "toast",
57
+ children: [_jsxs(AlertTitle, {
58
+ children: [_jsxs("span", {
59
+ style: visuallyHidden,
60
+ children: [severity, ":"]
61
+ }), text]
62
+ }), linkUrl && _jsx(Link, {
63
+ href: linkUrl,
64
+ variant: "monochrome",
65
+ children: linkText
66
+ })]
67
+ })
68
+ });
69
+ });
70
+ const MemoizedToast = memo(Toast);
71
+ export { MemoizedToast as Toast };
72
+ //# sourceMappingURL=Toast.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Toast.js","names":["useEffect","memo","forwardRef","useState","useCallback","Alert","AlertTitle","CloseIcon","Link","Snackbar","visuallyHidden","Button","ClickAwayListenerProps","onClickAway","Toast","autoHideDuration","isDismissable","linkText","linkUrl","isVisible","isVisibleProp","onHide","onHideProp","role","severity","text","setIsVisible","undefined","MemoizedToast"],"sources":["../src/Toast.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 { AlertColor } from \"@mui/material\";\nimport { useEffect, memo, forwardRef, useState, useCallback } from \"react\";\nimport {\n Alert,\n AlertTitle,\n CloseIcon,\n Link,\n Snackbar,\n visuallyHidden,\n} from \".\";\nimport { Button } from \"./Button\";\n\nexport type ToastProps = {\n /**\n * If set, this determines how long the toast should appear before automatically disappearing in milliseconds.\n * It will only take effect if the toast is not dismissible.\n * If left blank, it defaults to 6000.\n */\n autoHideDuration?: number;\n /**\n * If `true`, the alert will include a close button.\n */\n isDismissable?: boolean;\n /**\n * If true, the Toast is visible\n */\n isVisible?: boolean;\n /**\n * If linkUrl is not undefined, this is the text of the link.\n * If left blank, it defaults to \"Learn more\".\n * Note that linkText does nothing if linkUrl is not defined\n */\n linkText?: string;\n /**\n * If defined, the alert will include a link to the URL\n */\n linkUrl?: string;\n /**\n * An optional function to run when the Toast is closed.\n */\n onHide?: () => void;\n /**\n * Sets the ARIA role of the alert\n * (\"status\" for something that dynamically updates, \"alert\" for errors, null for something\n * unchanging)\n */\n role?: \"status\" | \"alert\";\n /**\n * Determine the color and icon of the alert\n */\n severity: AlertColor;\n /**\n * The text content of the alert\n */\n text: string;\n};\n\nconst ClickAwayListenerProps = { onClickAway: () => false };\n\nconst Toast = forwardRef(\n ({\n autoHideDuration = 6000,\n isDismissable,\n linkText,\n linkUrl,\n isVisible: isVisibleProp,\n onHide: onHideProp,\n role,\n severity,\n text,\n }: ToastProps) => {\n const [isVisible, setIsVisible] = useState(isVisibleProp);\n\n useEffect(() => {\n setIsVisible(isVisibleProp);\n }, [isVisibleProp]);\n\n const onHide = useCallback(() => {\n setIsVisible(false);\n onHideProp?.();\n }, [onHideProp]);\n\n return (\n <Snackbar\n open={isVisible}\n autoHideDuration={\n isDismissable || autoHideDuration <= 0 ? undefined : autoHideDuration\n }\n onClose={onHide}\n className=\"Toast\"\n ClickAwayListenerProps={ClickAwayListenerProps}\n >\n <Alert\n action={\n isDismissable === true && (\n <Button\n aria-label=\"close\"\n onClick={onHide}\n size=\"small\"\n startIcon={<CloseIcon />}\n variant=\"floating\"\n />\n )\n }\n role={role}\n severity={severity}\n variant=\"toast\"\n >\n <AlertTitle>\n <span style={visuallyHidden}>{severity}:</span>\n {text}\n </AlertTitle>\n {linkUrl && (\n <Link href={linkUrl} variant=\"monochrome\">\n {linkText}\n </Link>\n )}\n </Alert>\n </Snackbar>\n );\n }\n);\n\nconst MemoizedToast = memo(Toast);\n\nexport { MemoizedToast as Toast };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,SAASA,SAAT,EAAoBC,IAApB,EAA0BC,UAA1B,EAAsCC,QAAtC,EAAgDC,WAAhD,QAAmE,OAAnE;SAEEC,K,EACAC,U,EACAC,S,EACAC,I,EACAC,Q,EACAC,c;SAEOC,M;;;AA+CT,MAAMC,sBAAsB,GAAG;EAAEC,WAAW,EAAE,MAAM;AAArB,CAA/B;AAEA,MAAMC,KAAK,GAAGZ,UAAU,CACtB,QAUkB;EAAA,IAVjB;IACCa,gBAAgB,GAAG,IADpB;IAECC,aAFD;IAGCC,QAHD;IAICC,OAJD;IAKCC,SAAS,EAAEC,aALZ;IAMCC,MAAM,EAAEC,UANT;IAOCC,IAPD;IAQCC,QARD;IASCC;EATD,CAUiB;EAChB,MAAM,CAACN,SAAD,EAAYO,YAAZ,IAA4BvB,QAAQ,CAACiB,aAAD,CAA1C;EAEApB,SAAS,CAAC,MAAM;IACd0B,YAAY,CAACN,aAAD,CAAZ;EACD,CAFQ,EAEN,CAACA,aAAD,CAFM,CAAT;EAIA,MAAMC,MAAM,GAAGjB,WAAW,CAAC,MAAM;IAC/BsB,YAAY,CAAC,KAAD,CAAZ;IACAJ,UAAU;EACX,CAHyB,EAGvB,CAACA,UAAD,CAHuB,CAA1B;EAKA,OACE,KAAC,QAAD;IACE,IAAI,EAAEH,SADR;IAEE,gBAAgB,EACdH,aAAa,IAAID,gBAAgB,IAAI,CAArC,GAAyCY,SAAzC,GAAqDZ,gBAHzD;IAKE,OAAO,EAAEM,MALX;IAME,SAAS,EAAC,OANZ;IAOE,sBAAsB,EAAET,sBAP1B;IAAA,UASE,MAAC,KAAD;MACE,MAAM,EACJI,aAAa,KAAK,IAAlB,IACE,KAAC,MAAD;QACE,cAAW,OADb;QAEE,OAAO,EAAEK,MAFX;QAGE,IAAI,EAAC,OAHP;QAIE,SAAS,EAAE,KAAC,SAAD,KAJb;QAKE,OAAO,EAAC;MALV,EAHN;MAYE,IAAI,EAAEE,IAZR;MAaE,QAAQ,EAAEC,QAbZ;MAcE,OAAO,EAAC,OAdV;MAAA,WAgBE,MAAC,UAAD;QAAA,WACE;UAAM,KAAK,EAAEd,cAAb;UAAA,WAA8Bc,QAA9B;QAAA,EADF,EAEGC,IAFH;MAAA,EAhBF,EAoBGP,OAAO,IACN,KAAC,IAAD;QAAM,IAAI,EAAEA,OAAZ;QAAqB,OAAO,EAAC,YAA7B;QAAA,UACGD;MADH,EArBJ;IAAA;EATF,EADF;AAsCD,CA7DqB,CAAxB;AAgEA,MAAMW,aAAa,GAAG3B,IAAI,CAACa,KAAD,CAA1B;AAEA,SAASc,aAAa,IAAId,KAA1B"}
@@ -0,0 +1,33 @@
1
+ /*!
2
+ * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.
3
+ * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
4
+ *
5
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
6
+ * Unless required by applicable law or agreed to in writing, software
7
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
8
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9
+ *
10
+ * See the License for the specific language governing permissions and limitations under the License.
11
+ */
12
+ import { memo } from "react";
13
+ import { Box, Snackbar } from "./index.js";
14
+ import { jsx as _jsx } from "react/jsx-runtime";
15
+
16
+ const ToastStack = _ref => {
17
+ let {
18
+ children
19
+ } = _ref;
20
+ return _jsx(Snackbar, {
21
+ open: true,
22
+ children: _jsx(Box, {
23
+ display: "flex",
24
+ flexDirection: "column-reverse",
25
+ gap: 2,
26
+ children: children
27
+ })
28
+ });
29
+ };
30
+
31
+ const MemoizedToastStack = memo(ToastStack);
32
+ export { MemoizedToastStack as ToastStack };
33
+ //# sourceMappingURL=ToastStack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToastStack.js","names":["memo","Box","Snackbar","ToastStack","children","MemoizedToastStack"],"sources":["../src/ToastStack.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { memo, ReactElement } from \"react\";\nimport { Box, Snackbar } from \".\";\nimport { Toast } from \"./Toast\";\n\nexport type ToastStackProps = {\n children: ReactElement<typeof Toast> | Array<ReactElement<typeof Toast>>;\n};\n\nconst ToastStack = ({ children }: ToastStackProps) => {\n return (\n <Snackbar open={true}>\n <Box display=\"flex\" flexDirection=\"column-reverse\" gap={2}>\n {children}\n </Box>\n </Snackbar>\n );\n};\n\nconst MemoizedToastStack = memo(ToastStack);\n\nexport { MemoizedToastStack as ToastStack };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,IAAT,QAAmC,OAAnC;SACSC,G,EAAKC,Q;;;AAOd,MAAMC,UAAU,GAAG,QAAmC;EAAA,IAAlC;IAAEC;EAAF,CAAkC;EACpD,OACE,KAAC,QAAD;IAAU,IAAI,EAAE,IAAhB;IAAA,UACE,KAAC,GAAD;MAAK,OAAO,EAAC,MAAb;MAAoB,aAAa,EAAC,gBAAlC;MAAmD,GAAG,EAAE,CAAxD;MAAA,UACGA;IADH;EADF,EADF;AAOD,CARD;;AAUA,MAAMC,kBAAkB,GAAGL,IAAI,CAACG,UAAD,CAA/B;AAEA,SAASE,kBAAkB,IAAIF,UAA/B"}