@okta/odyssey-react-mui 0.21.3 → 0.22.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 (158) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/Autocomplete.js +58 -0
  3. package/dist/Autocomplete.js.map +1 -0
  4. package/dist/Banner.js +2 -3
  5. package/dist/Banner.js.map +1 -1
  6. package/dist/Button.js +46 -0
  7. package/dist/Button.js.map +1 -0
  8. package/dist/CheckboxGroup.js +2 -3
  9. package/dist/CheckboxGroup.js.map +1 -1
  10. package/dist/CircularProgress.js +12 -0
  11. package/dist/CircularProgress.js.map +1 -0
  12. package/dist/Field.js +59 -0
  13. package/dist/Field.js.map +1 -0
  14. package/dist/FieldError.js +34 -0
  15. package/dist/FieldError.js.map +1 -0
  16. package/dist/FieldHint.js +29 -0
  17. package/dist/FieldHint.js.map +1 -0
  18. package/dist/FieldLabel.js +32 -0
  19. package/dist/FieldLabel.js.map +1 -0
  20. package/dist/Infobox.js +2 -3
  21. package/dist/Infobox.js.map +1 -1
  22. package/dist/MenuButton.js +2 -2
  23. package/dist/MenuButton.js.map +1 -1
  24. package/dist/MenuItem.js +0 -1
  25. package/dist/MenuItem.js.map +1 -1
  26. package/dist/PasswordField.js +68 -0
  27. package/dist/PasswordField.js.map +1 -0
  28. package/dist/RadioGroup.js +2 -3
  29. package/dist/RadioGroup.js.map +1 -1
  30. package/dist/ScreenReaderText.js +30 -0
  31. package/dist/ScreenReaderText.js.map +1 -0
  32. package/dist/SearchField.js +54 -0
  33. package/dist/SearchField.js.map +1 -0
  34. package/dist/Tag.js +28 -0
  35. package/dist/Tag.js.map +1 -0
  36. package/dist/TagList.js +26 -0
  37. package/dist/TagList.js.map +1 -0
  38. package/dist/TagListContext.js +16 -0
  39. package/dist/TagListContext.js.map +1 -0
  40. package/dist/TextField.js +26 -62
  41. package/dist/TextField.js.map +1 -1
  42. package/dist/index.js +12 -2
  43. package/dist/index.js.map +1 -1
  44. package/dist/src/Autocomplete.d.ts +27 -0
  45. package/dist/src/Autocomplete.d.ts.map +1 -0
  46. package/dist/src/Button.d.ts +31 -0
  47. package/dist/src/Button.d.ts.map +1 -0
  48. package/dist/src/CircularProgress.d.ts +16 -0
  49. package/dist/src/CircularProgress.d.ts.map +1 -0
  50. package/dist/src/Field.d.ts +54 -0
  51. package/dist/src/Field.d.ts.map +1 -0
  52. package/dist/src/FieldError.d.ts +19 -0
  53. package/dist/src/FieldError.d.ts.map +1 -0
  54. package/dist/src/FieldHint.d.ts +19 -0
  55. package/dist/src/FieldHint.d.ts.map +1 -0
  56. package/dist/src/FieldLabel.d.ts +23 -0
  57. package/dist/src/FieldLabel.d.ts.map +1 -0
  58. package/dist/src/Icon.d.ts +1 -1
  59. package/dist/src/Link.d.ts +1 -1
  60. package/dist/src/MenuButton.d.ts.map +1 -1
  61. package/dist/src/MenuItem.d.ts +1 -1
  62. package/dist/src/MenuItem.d.ts.map +1 -1
  63. package/dist/src/PasswordField.d.ts +75 -0
  64. package/dist/src/PasswordField.d.ts.map +1 -0
  65. package/dist/src/RadioGroup.d.ts.map +1 -1
  66. package/dist/src/ScreenReaderText.d.ts +21 -0
  67. package/dist/src/ScreenReaderText.d.ts.map +1 -0
  68. package/dist/src/SearchField.d.ts +59 -0
  69. package/dist/src/SearchField.d.ts.map +1 -0
  70. package/dist/src/Tag.d.ts +22 -0
  71. package/dist/src/Tag.d.ts.map +1 -0
  72. package/dist/src/TagList.d.ts +19 -0
  73. package/dist/src/TagList.d.ts.map +1 -0
  74. package/dist/src/TagListContext.d.ts +18 -0
  75. package/dist/src/TagListContext.d.ts.map +1 -0
  76. package/dist/src/TextField.d.ts +3 -8
  77. package/dist/src/TextField.d.ts.map +1 -1
  78. package/dist/src/iconDictionary/Add.d.ts +1 -1
  79. package/dist/src/iconDictionary/AddCircle.d.ts +1 -1
  80. package/dist/src/iconDictionary/AlertCircle.d.ts +1 -1
  81. package/dist/src/iconDictionary/AlertCircleFilled.d.ts +1 -1
  82. package/dist/src/iconDictionary/AlertTriangleFilled.d.ts +1 -1
  83. package/dist/src/iconDictionary/Anchor.d.ts +1 -1
  84. package/dist/src/iconDictionary/ArrowDown.d.ts +1 -1
  85. package/dist/src/iconDictionary/ArrowLeft.d.ts +1 -1
  86. package/dist/src/iconDictionary/ArrowRight.d.ts +1 -1
  87. package/dist/src/iconDictionary/ArrowUp.d.ts +1 -1
  88. package/dist/src/iconDictionary/ArrowUpDown.d.ts +1 -1
  89. package/dist/src/iconDictionary/Calendar.d.ts +1 -1
  90. package/dist/src/iconDictionary/Check.d.ts +1 -1
  91. package/dist/src/iconDictionary/CheckCircleFilled.d.ts +1 -1
  92. package/dist/src/iconDictionary/ChevronDown.d.ts +1 -1
  93. package/dist/src/iconDictionary/ChevronUp.d.ts +1 -1
  94. package/dist/src/iconDictionary/Close.d.ts +1 -1
  95. package/dist/src/iconDictionary/CloseCircleFilled.d.ts +1 -1
  96. package/dist/src/iconDictionary/Copy.d.ts +1 -1
  97. package/dist/src/iconDictionary/Delete.d.ts +1 -1
  98. package/dist/src/iconDictionary/Download.d.ts +1 -1
  99. package/dist/src/iconDictionary/DragHandle.d.ts +1 -1
  100. package/dist/src/iconDictionary/Edit.d.ts +1 -1
  101. package/dist/src/iconDictionary/ExternalLink.d.ts +1 -1
  102. package/dist/src/iconDictionary/Eye.d.ts +1 -1
  103. package/dist/src/iconDictionary/EyeOff.d.ts +1 -1
  104. package/dist/src/iconDictionary/Filter.d.ts +1 -1
  105. package/dist/src/iconDictionary/Globe.d.ts +1 -1
  106. package/dist/src/iconDictionary/Home.d.ts +1 -1
  107. package/dist/src/iconDictionary/InformationCircle.d.ts +1 -1
  108. package/dist/src/iconDictionary/InformationCircleFilled.d.ts +1 -1
  109. package/dist/src/iconDictionary/Notification.d.ts +1 -1
  110. package/dist/src/iconDictionary/OverflowVertical.d.ts +1 -1
  111. package/dist/src/iconDictionary/QuestionCircle.d.ts +1 -1
  112. package/dist/src/iconDictionary/QuestionCircleFilled.d.ts +1 -1
  113. package/dist/src/iconDictionary/Search.d.ts +1 -1
  114. package/dist/src/iconDictionary/Settings.d.ts +1 -1
  115. package/dist/src/iconDictionary/Subtract.d.ts +1 -1
  116. package/dist/src/iconDictionary/User.d.ts +1 -1
  117. package/dist/src/iconDictionary/UserGroup.d.ts +1 -1
  118. package/dist/src/iconDictionary/index.d.ts +40 -40
  119. package/dist/src/index.d.ts +13 -3
  120. package/dist/src/index.d.ts.map +1 -1
  121. package/dist/src/theme/components.d.ts.map +1 -1
  122. package/dist/src/theme/components.types.d.ts +0 -8
  123. package/dist/src/theme/components.types.d.ts.map +1 -1
  124. package/dist/theme/components.js +217 -124
  125. package/dist/theme/components.js.map +1 -1
  126. package/dist/theme/components.types.js.map +1 -1
  127. package/dist/tsconfig.production.tsbuildinfo +1 -1
  128. package/package.json +3 -3
  129. package/src/Autocomplete.tsx +132 -0
  130. package/src/Banner.tsx +2 -2
  131. package/src/Button.tsx +75 -0
  132. package/src/CheckboxGroup.tsx +2 -2
  133. package/src/CircularProgress.tsx +24 -0
  134. package/src/Field.tsx +112 -0
  135. package/src/FieldError.tsx +34 -0
  136. package/src/FieldHint.tsx +28 -0
  137. package/src/FieldLabel.tsx +57 -0
  138. package/src/Infobox.tsx +2 -2
  139. package/src/MenuButton.tsx +2 -3
  140. package/src/MenuItem.tsx +0 -1
  141. package/src/OdysseyCacheProvider.test.tsx +1 -1
  142. package/src/PasswordField.tsx +174 -0
  143. package/src/RadioGroup.tsx +2 -2
  144. package/src/ScreenReaderText.tsx +36 -0
  145. package/src/SearchField.tsx +136 -0
  146. package/src/Tag.tsx +41 -0
  147. package/src/TagList.tsx +43 -0
  148. package/src/TagListContext.tsx +23 -0
  149. package/src/TextField.tsx +43 -101
  150. package/src/index.ts +11 -5
  151. package/src/theme/components.tsx +87 -18
  152. package/src/theme/components.types.ts +0 -8
  153. package/dist/PasswordInput.js +0 -87
  154. package/dist/PasswordInput.js.map +0 -1
  155. package/dist/src/PasswordInput.d.ts +0 -21
  156. package/dist/src/PasswordInput.d.ts.map +0 -1
  157. package/src/PasswordInput.test.tsx +0 -51
  158. package/src/PasswordInput.tsx +0 -111
package/CHANGELOG.md CHANGED
@@ -3,6 +3,30 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.22.0](https://github.com/okta/odyssey/compare/v0.21.4...v0.22.0) (2023-04-21)
7
+
8
+ ### Features
9
+
10
+ - **odyssey-react-mui:** add styling for Autocomplete ([b03516b](https://github.com/okta/odyssey/commit/b03516ba469ef1045c17326590a97e39f0235aa8))
11
+ - wrap the Button ([507cf60](https://github.com/okta/odyssey/commit/507cf60c045a445e09c039dc1f35574271114697))
12
+ - wrapped Tag and TagList ([43ab012](https://github.com/okta/odyssey/commit/43ab012d17934503bd827624ad17c6d00531a978))
13
+
14
+ ### Bug Fixes
15
+
16
+ - added extra props to Autocomplete to fix MUI types ([d7aff4a](https://github.com/okta/odyssey/commit/d7aff4ab510cbb512bee043b4056e1085ce0d059))
17
+ - created Autocomplete wrapper component ([dbb1210](https://github.com/okta/odyssey/commit/dbb12100e656e9db3deb2a0d76bdcf5fb715e93d))
18
+ - export types for Autocomplete ([28be391](https://github.com/okta/odyssey/commit/28be391f49bbce4882b68334a1d5805e50d47a4e))
19
+ - pulled out TextField into separate components ([#1744](https://github.com/okta/odyssey/issues/1744)) ([0b7a412](https://github.com/okta/odyssey/commit/0b7a41290eb1a60693ee827f45e240531e7fbbcb))
20
+ - removed explicit displayName from MenuItem ([ab84734](https://github.com/okta/odyssey/commit/ab84734a4f8dc11aba42f56818bce59dbd469ddf))
21
+ - separated InputProps and params in Autocomplete ([a93542c](https://github.com/okta/odyssey/commit/a93542c6238ab56a0a06075aceb5cf0997ceb7f1))
22
+
23
+ ## [0.21.4](https://github.com/okta/odyssey/compare/v0.21.3...v0.21.4) (2023-04-13)
24
+
25
+ ### Features
26
+
27
+ - **odyssey-react-mui:** add ScreenReaderText component ([b0c98ad](https://github.com/okta/odyssey/commit/b0c98ad72924c5a510590f5e584dc99e1465ae1c))
28
+ - wrapped CircularProgress ([fda8978](https://github.com/okta/odyssey/commit/fda89787c3bc13830d2d4e09290d261e490c0902))
29
+
6
30
  ## [0.21.3](https://github.com/okta/odyssey/compare/v0.21.2...v0.21.3) (2023-04-06)
7
31
 
8
32
  ### Features
@@ -0,0 +1,58 @@
1
+ import _Autocomplete from "@mui/material/Autocomplete";
2
+ import _InputBase from "@mui/material/InputBase";
3
+ import { memo, useCallback } from "react";
4
+ import { Field } from "./Field.js";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+
7
+ const Autocomplete = _ref => {
8
+ let {
9
+ isCustomValueAllowed,
10
+ hasMultipleChoices,
11
+ isDisabled,
12
+ isLoading,
13
+ isReadOnly,
14
+ hint,
15
+ label,
16
+ onChange,
17
+ options,
18
+ value
19
+ } = _ref;
20
+ const renderInput = useCallback(_ref2 => {
21
+ let {
22
+ InputLabelProps,
23
+ InputProps,
24
+ ...params
25
+ } = _ref2;
26
+ return _jsx(Field, { ...InputLabelProps,
27
+ hasVisibleLabel: true,
28
+ hint: hint,
29
+ label: label,
30
+ renderFieldComponent: _ref3 => {
31
+ let {
32
+ ariaDescribedBy,
33
+ id
34
+ } = _ref3;
35
+ return _jsx(_InputBase, { ...params,
36
+ ...InputProps,
37
+ "aria-describedby": ariaDescribedBy,
38
+ id: id
39
+ });
40
+ }
41
+ });
42
+ }, [hint, label]);
43
+ return _jsx(_Autocomplete, {
44
+ disabled: isDisabled,
45
+ freeSolo: isCustomValueAllowed,
46
+ loading: isLoading,
47
+ multiple: hasMultipleChoices,
48
+ onChange: onChange,
49
+ options: options,
50
+ readOnly: isReadOnly,
51
+ renderInput: renderInput,
52
+ value: value
53
+ });
54
+ };
55
+
56
+ const MemoizedAutocomplete = memo(Autocomplete);
57
+ export { MemoizedAutocomplete as Autocomplete };
58
+ //# sourceMappingURL=Autocomplete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Autocomplete.js","names":["memo","useCallback","Field","Autocomplete","isCustomValueAllowed","hasMultipleChoices","isDisabled","isLoading","isReadOnly","hint","label","onChange","options","value","renderInput","InputLabelProps","InputProps","params","ariaDescribedBy","id","MemoizedAutocomplete"],"sources":["../src/Autocomplete.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport {\n Autocomplete as MuiAutocomplete,\n AutocompleteProps as MuiAutocompleteProps,\n InputBase,\n} from \"@mui/material\";\nimport { memo, useCallback } from \"react\";\n\nimport { Field } from \"./Field\";\n\nexport type AutocompleteProps<\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined\n> = {\n hasMultipleChoices?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"multiple\"];\n hint?: string;\n isCustomValueAllowed?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"freeSolo\"];\n isDisabled?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"disabled\"];\n isLoading?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"loading\"];\n isReadOnly?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"readOnly\"];\n label: string;\n onChange?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onChange\"];\n options: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"options\"];\n value?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"value\"];\n};\n\nconst Autocomplete = <\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined\n>({\n isCustomValueAllowed,\n hasMultipleChoices,\n isDisabled,\n isLoading,\n isReadOnly,\n hint,\n label,\n onChange,\n options,\n value,\n}: AutocompleteProps<OptionType, HasMultipleChoices, IsCustomValueAllowed>) => {\n const renderInput = useCallback(\n ({ InputLabelProps, InputProps, ...params }) => (\n <Field\n {...InputLabelProps}\n hasVisibleLabel\n hint={hint}\n label={label}\n renderFieldComponent={({ ariaDescribedBy, id }) => (\n <InputBase\n {...params}\n {...InputProps}\n aria-describedby={ariaDescribedBy}\n id={id}\n />\n )}\n />\n ),\n [hint, label]\n );\n\n return (\n <MuiAutocomplete\n disabled={isDisabled}\n freeSolo={isCustomValueAllowed}\n loading={isLoading}\n multiple={hasMultipleChoices}\n onChange={onChange}\n options={options}\n readOnly={isReadOnly}\n renderInput={renderInput}\n value={value}\n />\n );\n};\n\nconst MemoizedAutocomplete = memo(Autocomplete) as typeof Autocomplete;\n\nexport { MemoizedAutocomplete as Autocomplete };\n"],"mappings":";;AAiBA,SAASA,IAAT,EAAeC,WAAf,QAAkC,OAAlC;SAESC,K;;;AA2DT,MAAMC,YAAY,GAAG,QAe0D;EAAA,IAX7E;IACAC,oBADA;IAEAC,kBAFA;IAGAC,UAHA;IAIAC,SAJA;IAKAC,UALA;IAMAC,IANA;IAOAC,KAPA;IAQAC,QARA;IASAC,OATA;IAUAC;EAVA,CAW6E;EAC7E,MAAMC,WAAW,GAAGb,WAAW,CAC7B;IAAA,IAAC;MAAEc,eAAF;MAAmBC,UAAnB;MAA+B,GAAGC;IAAlC,CAAD;IAAA,OACE,KAAC,KAAD,OACMF,eADN;MAEE,eAAe,MAFjB;MAGE,IAAI,EAAEN,IAHR;MAIE,KAAK,EAAEC,KAJT;MAKE,oBAAoB,EAAE;QAAA,IAAC;UAAEQ,eAAF;UAAmBC;QAAnB,CAAD;QAAA,OACpB,sBACMF,MADN;UAAA,GAEMD,UAFN;UAGE,oBAAkBE,eAHpB;UAIE,EAAE,EAAEC;QAJN,EADoB;MAAA;IALxB,EADF;EAAA,CAD6B,EAiB7B,CAACV,IAAD,EAAOC,KAAP,CAjB6B,CAA/B;EAoBA,OACE;IACE,QAAQ,EAAEJ,UADZ;IAEE,QAAQ,EAAEF,oBAFZ;IAGE,OAAO,EAAEG,SAHX;IAIE,QAAQ,EAAEF,kBAJZ;IAKE,QAAQ,EAAEM,QALZ;IAME,OAAO,EAAEC,OANX;IAOE,QAAQ,EAAEJ,UAPZ;IAQE,WAAW,EAAEM,WARf;IASE,KAAK,EAAED;EATT,EADF;AAaD,CAjDD;;AAmDA,MAAMO,oBAAoB,GAAGpB,IAAI,CAACG,YAAD,CAAjC;AAEA,SAASiB,oBAAoB,IAAIjB,YAAjC"}
package/dist/Banner.js CHANGED
@@ -10,7 +10,7 @@
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
12
  import { memo } from "react";
13
- import { Alert, Link, visuallyHidden } from "./index.js";
13
+ import { Alert, Link, ScreenReaderText } from "./index.js";
14
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
15
15
  import { jsx as _jsx } from "react/jsx-runtime";
16
16
 
@@ -28,8 +28,7 @@ const Banner = _ref => {
28
28
  role: role,
29
29
  severity: severity,
30
30
  variant: "banner",
31
- children: [_jsxs("span", {
32
- style: visuallyHidden,
31
+ children: [_jsxs(ScreenReaderText, {
33
32
  children: [severity, ":"]
34
33
  }), text, linkUrl && _jsx(Link, {
35
34
  href: linkUrl,
@@ -1 +1 @@
1
- {"version":3,"file":"Banner.js","names":["memo","Alert","Link","visuallyHidden","Banner","onClose","severity","role","linkUrl","linkText","text","MemoizedBanner"],"sources":["../src/Banner.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { AlertColor, AlertProps } from \"@mui/material\";\nimport { memo } from \"react\";\nimport { Alert, Link, visuallyHidden } from \"./\";\n\nexport interface BannerProps {\n /**\n * Determine the color and icon of the alert\n */\n severity: AlertColor;\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 * The text content of the alert\n */\n text: string;\n /**\n * The function that's fired when the user clicks the close button. If undefined,\n * the close button will not be shown.\n */\n onClose?: AlertProps[\"onClose\"];\n /**\n * If defined, the alert will include a link to the URL\n */\n linkUrl?: string;\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\nconst Banner = ({\n onClose,\n severity,\n role,\n linkUrl,\n linkText,\n text,\n}: BannerProps) => (\n <Alert onClose={onClose} role={role} severity={severity} variant=\"banner\">\n <span style={visuallyHidden}>{severity}:</span>\n {text}\n {linkUrl && (\n <Link href={linkUrl} variant=\"monochrome\">\n {linkText}\n </Link>\n )}\n </Alert>\n);\n\nconst MemoizedBanner = memo(Banner);\n\nexport { MemoizedBanner as Banner };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,SAASA,IAAT,QAAqB,OAArB;SACSC,K,EAAOC,I,EAAMC,c;;;;AAkCtB,MAAMC,MAAM,GAAG;EAAA,IAAC;IACdC,OADc;IAEdC,QAFc;IAGdC,IAHc;IAIdC,OAJc;IAKdC,QALc;IAMdC;EANc,CAAD;EAAA,OAQb,MAAC,KAAD;IAAO,OAAO,EAAEL,OAAhB;IAAyB,IAAI,EAAEE,IAA/B;IAAqC,QAAQ,EAAED,QAA/C;IAAyD,OAAO,EAAC,QAAjE;IAAA,WACE;MAAM,KAAK,EAAEH,cAAb;MAAA,WAA8BG,QAA9B;IAAA,EADF,EAEGI,IAFH,EAGGF,OAAO,IACN,KAAC,IAAD;MAAM,IAAI,EAAEA,OAAZ;MAAqB,OAAO,EAAC,YAA7B;MAAA,UACGC;IADH,EAJJ;EAAA,EARa;AAAA,CAAf;;AAmBA,MAAME,cAAc,GAAGX,IAAI,CAACI,MAAD,CAA3B;AAEA,SAASO,cAAc,IAAIP,MAA3B"}
1
+ {"version":3,"file":"Banner.js","names":["memo","Alert","Link","ScreenReaderText","Banner","onClose","severity","role","linkUrl","linkText","text","MemoizedBanner"],"sources":["../src/Banner.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { AlertColor, AlertProps } from \"@mui/material\";\nimport { memo } from \"react\";\nimport { Alert, Link, ScreenReaderText } from \"./\";\n\nexport interface BannerProps {\n /**\n * Determine the color and icon of the alert\n */\n severity: AlertColor;\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 * The text content of the alert\n */\n text: string;\n /**\n * The function that's fired when the user clicks the close button. If undefined,\n * the close button will not be shown.\n */\n onClose?: AlertProps[\"onClose\"];\n /**\n * If defined, the alert will include a link to the URL\n */\n linkUrl?: string;\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\nconst Banner = ({\n onClose,\n severity,\n role,\n linkUrl,\n linkText,\n text,\n}: BannerProps) => (\n <Alert onClose={onClose} role={role} severity={severity} variant=\"banner\">\n <ScreenReaderText>{severity}:</ScreenReaderText>\n {text}\n {linkUrl && (\n <Link href={linkUrl} variant=\"monochrome\">\n {linkText}\n </Link>\n )}\n </Alert>\n);\n\nconst MemoizedBanner = memo(Banner);\n\nexport { MemoizedBanner as Banner };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,SAASA,IAAT,QAAqB,OAArB;SACSC,K,EAAOC,I,EAAMC,gB;;;;AAkCtB,MAAMC,MAAM,GAAG;EAAA,IAAC;IACdC,OADc;IAEdC,QAFc;IAGdC,IAHc;IAIdC,OAJc;IAKdC,QALc;IAMdC;EANc,CAAD;EAAA,OAQb,MAAC,KAAD;IAAO,OAAO,EAAEL,OAAhB;IAAyB,IAAI,EAAEE,IAA/B;IAAqC,QAAQ,EAAED,QAA/C;IAAyD,OAAO,EAAC,QAAjE;IAAA,WACE,MAAC,gBAAD;MAAA,WAAmBA,QAAnB;IAAA,EADF,EAEGI,IAFH,EAGGF,OAAO,IACN,KAAC,IAAD;MAAM,IAAI,EAAEA,OAAZ;MAAqB,OAAO,EAAC,YAA7B;MAAA,UACGC;IADH,EAJJ;EAAA,EARa;AAAA,CAAf;;AAmBA,MAAME,cAAc,GAAGX,IAAI,CAACI,MAAD,CAA3B;AAEA,SAASO,cAAc,IAAIP,MAA3B"}
package/dist/Button.js ADDED
@@ -0,0 +1,46 @@
1
+ import _Button from "@mui/material/Button";
2
+ import { Tooltip } from "./index.js";
3
+ import { memo } from "react";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ import { Fragment as _Fragment } from "react/jsx-runtime";
6
+ import { jsxs as _jsxs } from "react/jsx-runtime";
7
+
8
+ const Button = _ref => {
9
+ let {
10
+ endIcon,
11
+ id,
12
+ isDisabled,
13
+ isFullWidth,
14
+ onClick,
15
+ size = "medium",
16
+ startIcon,
17
+ text,
18
+ tooltipText,
19
+ variant
20
+ } = _ref;
21
+
22
+ const button = _jsx(_Button, {
23
+ disabled: isDisabled,
24
+ endIcon: endIcon,
25
+ fullWidth: isFullWidth,
26
+ id: id,
27
+ onClick: onClick,
28
+ size: size,
29
+ startIcon: startIcon,
30
+ variant: variant,
31
+ children: text
32
+ });
33
+
34
+ return _jsxs(_Fragment, {
35
+ children: [tooltipText && _jsx(Tooltip, {
36
+ describeChild: true,
37
+ placement: "top",
38
+ title: tooltipText,
39
+ children: button
40
+ }), !tooltipText && button]
41
+ });
42
+ };
43
+
44
+ const MemoizedButton = memo(Button);
45
+ export { MemoizedButton as Button };
46
+ //# sourceMappingURL=Button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Button.js","names":["Tooltip","memo","Button","endIcon","id","isDisabled","isFullWidth","onClick","size","startIcon","text","tooltipText","variant","button","MemoizedButton"],"sources":["../src/Button.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { Button as MuiButton } from \"@mui/material\";\nimport type { ButtonProps as MuiButtonProps } from \"@mui/material\";\nimport { Tooltip } from \"./\";\nimport { memo } from \"react\";\n\nexport type ButtonProps = {\n endIcon?: React.ReactNode;\n id?: string;\n isDisabled?: boolean;\n isFullWidth?: boolean;\n onClick?: MuiButtonProps[\"onClick\"];\n size?: MuiButtonProps[\"size\"];\n startIcon?: React.ReactNode;\n text?: string;\n /**\n * `tooltipText` determines the text of the tooltip that wraps the button if it's icon-only.\n */\n tooltipText?: string;\n variant?: \"primary\" | \"secondary\" | \"danger\" | \"floating\";\n};\n\nconst Button = ({\n endIcon,\n id,\n isDisabled,\n isFullWidth,\n onClick,\n size = \"medium\",\n startIcon,\n text,\n tooltipText,\n variant,\n}: ButtonProps) => {\n const button = (\n <MuiButton\n disabled={isDisabled}\n endIcon={endIcon}\n fullWidth={isFullWidth}\n id={id}\n onClick={onClick}\n size={size}\n startIcon={startIcon}\n variant={variant}\n >\n {text}\n </MuiButton>\n );\n\n return (\n <>\n {tooltipText && (\n <Tooltip describeChild placement=\"top\" title={tooltipText}>\n {button}\n </Tooltip>\n )}\n {!tooltipText && button}\n </>\n );\n};\n\nconst MemoizedButton = memo(Button);\n\nexport { MemoizedButton as Button };\n"],"mappings":";SAcSA,O;AACT,SAASC,IAAT,QAAqB,OAArB;;;;;AAkBA,MAAMC,MAAM,GAAG,QAWI;EAAA,IAXH;IACdC,OADc;IAEdC,EAFc;IAGdC,UAHc;IAIdC,WAJc;IAKdC,OALc;IAMdC,IAAI,GAAG,QANO;IAOdC,SAPc;IAQdC,IARc;IASdC,WATc;IAUdC;EAVc,CAWG;;EACjB,MAAMC,MAAM,GACV;IACE,QAAQ,EAAER,UADZ;IAEE,OAAO,EAAEF,OAFX;IAGE,SAAS,EAAEG,WAHb;IAIE,EAAE,EAAEF,EAJN;IAKE,OAAO,EAAEG,OALX;IAME,IAAI,EAAEC,IANR;IAOE,SAAS,EAAEC,SAPb;IAQE,OAAO,EAAEG,OARX;IAAA,UAUGF;EAVH,EADF;;EAeA,OACE;IAAA,WACGC,WAAW,IACV,KAAC,OAAD;MAAS,aAAa,MAAtB;MAAuB,SAAS,EAAC,KAAjC;MAAuC,KAAK,EAAEA,WAA9C;MAAA,UACGE;IADH,EAFJ,EAMG,CAACF,WAAD,IAAgBE,MANnB;EAAA,EADF;AAUD,CArCD;;AAuCA,MAAMC,cAAc,GAAGb,IAAI,CAACC,MAAD,CAA3B;AAEA,SAASY,cAAc,IAAIZ,MAA3B"}
@@ -10,7 +10,7 @@
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
12
  import { memo, useMemo } from "react";
13
- import { FormControl, FormGroup, FormHelperText, FormLabel, visuallyHidden } from "./index.js";
13
+ import { FormControl, FormGroup, FormHelperText, FormLabel, ScreenReaderText } from "./index.js";
14
14
  import { jsx as _jsx } from "react/jsx-runtime";
15
15
  import { jsxs as _jsxs } from "react/jsx-runtime";
16
16
 
@@ -40,8 +40,7 @@ const CheckboxGroup = _ref => {
40
40
  }), errorMessage && _jsxs(FormHelperText, {
41
41
  id: `${name}-error`,
42
42
  error: true,
43
- children: [_jsx("span", {
44
- style: visuallyHidden,
43
+ children: [_jsx(ScreenReaderText, {
45
44
  children: "Error:"
46
45
  }), " ", errorMessage]
47
46
  })]
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxGroup.js","names":["memo","useMemo","FormControl","FormGroup","FormHelperText","FormLabel","visuallyHidden","CheckboxGroup","children","isDisabled","errorMessage","hint","label","name","ariaDescribedBy","filter","Boolean","join","undefined","MemoizedCheckboxGroup"],"sources":["../src/CheckboxGroup.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { memo, ReactElement, useMemo } from \"react\";\n\nimport {\n Checkbox,\n FormControl,\n FormGroup,\n FormHelperText,\n FormLabel,\n visuallyHidden,\n} from \".\";\n\nexport type CheckboxGroupProps = {\n children:\n | ReactElement<typeof Checkbox>\n | Array<ReactElement<typeof Checkbox>>;\n errorMessage?: string;\n hint?: string;\n isDisabled?: boolean;\n label?: string;\n name?: string;\n};\n\nconst CheckboxGroup = ({\n children,\n isDisabled,\n errorMessage,\n hint,\n label,\n name,\n}: CheckboxGroupProps) => {\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 return (\n <FormControl\n component=\"fieldset\"\n disabled={isDisabled}\n error={Boolean(errorMessage)}\n >\n {label && <FormLabel component=\"legend\">{label}</FormLabel>}\n {hint && <FormHelperText id={`${name}-hint`}>{hint}</FormHelperText>}\n <FormGroup aria-describedby={ariaDescribedBy}>{children}</FormGroup>\n {errorMessage && (\n <FormHelperText id={`${name}-error`} error>\n <span style={visuallyHidden}>Error:</span> {errorMessage}\n </FormHelperText>\n )}\n </FormControl>\n );\n};\n\nconst MemoizedCheckboxGroup = memo(CheckboxGroup);\n\nexport { MemoizedCheckboxGroup as CheckboxGroup };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,IAAT,EAA6BC,OAA7B,QAA4C,OAA5C;SAIEC,W,EACAC,S,EACAC,c,EACAC,S,EACAC,c;;;;AAcF,MAAMC,aAAa,GAAG,QAOI;EAAA,IAPH;IACrBC,QADqB;IAErBC,UAFqB;IAGrBC,YAHqB;IAIrBC,IAJqB;IAKrBC,KALqB;IAMrBC;EANqB,CAOG;EACxB,MAAMC,eAAe,GAAGb,OAAO,CAC7B,MACES,YAAY,IAAIC,IAAhB,GACI,CAACA,IAAI,IAAK,GAAEE,IAAK,OAAjB,EAAyBH,YAAY,IAAK,GAAEG,IAAK,QAAjD,EACGE,MADH,CACUC,OADV,EAEGC,IAFH,CAEQ,GAFR,CADJ,GAIIC,SANuB,EAO7B,CAACR,YAAD,EAAeC,IAAf,EAAqBE,IAArB,CAP6B,CAA/B;EAUA,OACE,MAAC,WAAD;IACE,SAAS,EAAC,UADZ;IAEE,QAAQ,EAAEJ,UAFZ;IAGE,KAAK,EAAEO,OAAO,CAACN,YAAD,CAHhB;IAAA,WAKGE,KAAK,IAAI,KAAC,SAAD;MAAW,SAAS,EAAC,QAArB;MAAA,UAA+BA;IAA/B,EALZ,EAMGD,IAAI,IAAI,KAAC,cAAD;MAAgB,EAAE,EAAG,GAAEE,IAAK,OAA5B;MAAA,UAAqCF;IAArC,EANX,EAOE,KAAC,SAAD;MAAW,oBAAkBG,eAA7B;MAAA,UAA+CN;IAA/C,EAPF,EAQGE,YAAY,IACX,MAAC,cAAD;MAAgB,EAAE,EAAG,GAAEG,IAAK,QAA5B;MAAqC,KAAK,MAA1C;MAAA,WACE;QAAM,KAAK,EAAEP,cAAb;QAAA;MAAA,EADF,OAC8CI,YAD9C;IAAA,EATJ;EAAA,EADF;AAgBD,CAlCD;;AAoCA,MAAMS,qBAAqB,GAAGnB,IAAI,CAACO,aAAD,CAAlC;AAEA,SAASY,qBAAqB,IAAIZ,aAAlC"}
1
+ {"version":3,"file":"CheckboxGroup.js","names":["memo","useMemo","FormControl","FormGroup","FormHelperText","FormLabel","ScreenReaderText","CheckboxGroup","children","isDisabled","errorMessage","hint","label","name","ariaDescribedBy","filter","Boolean","join","undefined","MemoizedCheckboxGroup"],"sources":["../src/CheckboxGroup.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { memo, ReactElement, useMemo } from \"react\";\n\nimport {\n Checkbox,\n FormControl,\n FormGroup,\n FormHelperText,\n FormLabel,\n ScreenReaderText,\n} from \".\";\n\nexport type CheckboxGroupProps = {\n children:\n | ReactElement<typeof Checkbox>\n | Array<ReactElement<typeof Checkbox>>;\n errorMessage?: string;\n hint?: string;\n isDisabled?: boolean;\n label?: string;\n name?: string;\n};\n\nconst CheckboxGroup = ({\n children,\n isDisabled,\n errorMessage,\n hint,\n label,\n name,\n}: CheckboxGroupProps) => {\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 return (\n <FormControl\n component=\"fieldset\"\n disabled={isDisabled}\n error={Boolean(errorMessage)}\n >\n {label && <FormLabel component=\"legend\">{label}</FormLabel>}\n {hint && <FormHelperText id={`${name}-hint`}>{hint}</FormHelperText>}\n <FormGroup aria-describedby={ariaDescribedBy}>{children}</FormGroup>\n {errorMessage && (\n <FormHelperText id={`${name}-error`} error>\n <ScreenReaderText>Error:</ScreenReaderText> {errorMessage}\n </FormHelperText>\n )}\n </FormControl>\n );\n};\n\nconst MemoizedCheckboxGroup = memo(CheckboxGroup);\n\nexport { MemoizedCheckboxGroup as CheckboxGroup };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,IAAT,EAA6BC,OAA7B,QAA4C,OAA5C;SAIEC,W,EACAC,S,EACAC,c,EACAC,S,EACAC,gB;;;;AAcF,MAAMC,aAAa,GAAG,QAOI;EAAA,IAPH;IACrBC,QADqB;IAErBC,UAFqB;IAGrBC,YAHqB;IAIrBC,IAJqB;IAKrBC,KALqB;IAMrBC;EANqB,CAOG;EACxB,MAAMC,eAAe,GAAGb,OAAO,CAC7B,MACES,YAAY,IAAIC,IAAhB,GACI,CAACA,IAAI,IAAK,GAAEE,IAAK,OAAjB,EAAyBH,YAAY,IAAK,GAAEG,IAAK,QAAjD,EACGE,MADH,CACUC,OADV,EAEGC,IAFH,CAEQ,GAFR,CADJ,GAIIC,SANuB,EAO7B,CAACR,YAAD,EAAeC,IAAf,EAAqBE,IAArB,CAP6B,CAA/B;EAUA,OACE,MAAC,WAAD;IACE,SAAS,EAAC,UADZ;IAEE,QAAQ,EAAEJ,UAFZ;IAGE,KAAK,EAAEO,OAAO,CAACN,YAAD,CAHhB;IAAA,WAKGE,KAAK,IAAI,KAAC,SAAD;MAAW,SAAS,EAAC,QAArB;MAAA,UAA+BA;IAA/B,EALZ,EAMGD,IAAI,IAAI,KAAC,cAAD;MAAgB,EAAE,EAAG,GAAEE,IAAK,OAA5B;MAAA,UAAqCF;IAArC,EANX,EAOE,KAAC,SAAD;MAAW,oBAAkBG,eAA7B;MAAA,UAA+CN;IAA/C,EAPF,EAQGE,YAAY,IACX,MAAC,cAAD;MAAgB,EAAE,EAAG,GAAEG,IAAK,QAA5B;MAAqC,KAAK,MAA1C;MAAA,WACE,KAAC,gBAAD;QAAA;MAAA,EADF,OAC+CH,YAD/C;IAAA,EATJ;EAAA,EADF;AAgBD,CAlCD;;AAoCA,MAAMS,qBAAqB,GAAGnB,IAAI,CAACO,aAAD,CAAlC;AAEA,SAASY,qBAAqB,IAAIZ,aAAlC"}
@@ -0,0 +1,12 @@
1
+ import _CircularProgress from "@mui/material/CircularProgress";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ export const CircularProgress = _ref => {
4
+ let {
5
+ value
6
+ } = _ref;
7
+ return _jsx(_CircularProgress, {
8
+ value: value,
9
+ variant: value ? "determinate" : "indeterminate"
10
+ });
11
+ };
12
+ //# sourceMappingURL=CircularProgress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CircularProgress.js","names":["CircularProgress","value"],"sources":["../src/CircularProgress.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 { CircularProgress as MuiCircularProgress } from \"@mui/material\";\n\nexport type CircularProgressProps = {\n value?: number;\n};\n\nexport const CircularProgress = ({ value }: CircularProgressProps) => (\n <MuiCircularProgress\n value={value}\n variant={value ? \"determinate\" : \"indeterminate\"}\n />\n);\n"],"mappings":";;AAkBA,OAAO,MAAMA,gBAAgB,GAAG;EAAA,IAAC;IAAEC;EAAF,CAAD;EAAA,OAC9B;IACE,KAAK,EAAEA,KADT;IAEE,OAAO,EAAEA,KAAK,GAAG,aAAH,GAAmB;EAFnC,EAD8B;AAAA,CAAzB"}
package/dist/Field.js ADDED
@@ -0,0 +1,59 @@
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, useMemo } from "react";
13
+ import { FieldError, FieldHint, FieldLabel, FormControl, useUniqueId } from "./index.js";
14
+ import { jsx as _jsx } from "react/jsx-runtime";
15
+ import { jsxs as _jsxs } from "react/jsx-runtime";
16
+
17
+ const Field = _ref => {
18
+ let {
19
+ errorMessage,
20
+ hasVisibleLabel,
21
+ hint,
22
+ id: idOverride,
23
+ isDisabled = false,
24
+ isRequired = true,
25
+ label,
26
+ optionalLabel,
27
+ renderFieldComponent
28
+ } = _ref;
29
+ const id = useUniqueId(idOverride);
30
+ const hintId = hint ? `${id}-hint` : undefined;
31
+ const errorId = errorMessage ? `${id}-error` : undefined;
32
+ const labelId = `${id}-label`;
33
+ const ariaDescribedBy = useMemo(() => [hintId, errorId].join(" ").trim() || undefined, [errorId, hintId]);
34
+ return _jsxs(FormControl, {
35
+ disabled: isDisabled,
36
+ error: Boolean(errorMessage),
37
+ children: [_jsx(FieldLabel, {
38
+ hasVisibleLabel: hasVisibleLabel,
39
+ id: labelId,
40
+ inputId: id,
41
+ isRequired: isRequired,
42
+ optionalText: optionalLabel,
43
+ text: label
44
+ }), hint && _jsx(FieldHint, {
45
+ id: hintId,
46
+ text: hint
47
+ }), renderFieldComponent({
48
+ ariaDescribedBy,
49
+ id
50
+ }), errorMessage && _jsx(FieldError, {
51
+ id: errorId,
52
+ text: errorMessage
53
+ })]
54
+ });
55
+ };
56
+
57
+ const MemoizedField = memo(Field);
58
+ export { MemoizedField as Field };
59
+ //# sourceMappingURL=Field.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Field.js","names":["memo","useMemo","FieldError","FieldHint","FieldLabel","FormControl","useUniqueId","Field","errorMessage","hasVisibleLabel","hint","id","idOverride","isDisabled","isRequired","label","optionalLabel","renderFieldComponent","hintId","undefined","errorId","labelId","ariaDescribedBy","join","trim","Boolean","MemoizedField"],"sources":["../src/Field.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { memo, ReactElement, useMemo } from \"react\";\n\nimport {\n FieldError,\n FieldHint,\n FieldLabel,\n FormControl,\n useUniqueId,\n} from \"./\";\n\nexport type FieldProps = {\n /**\n * If `error` is not undefined, the `input` will indicate an error.\n */\n errorMessage?: string;\n hasVisibleLabel: 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 required.\n */\n isRequired?: boolean;\n /**\n * The label for the `input` element.\n */\n label: string;\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 renderFieldComponent: ({\n ariaDescribedBy,\n id,\n }: {\n ariaDescribedBy?: string;\n id: string;\n }) => ReactElement;\n};\n\nconst Field = ({\n errorMessage,\n hasVisibleLabel,\n hint,\n id: idOverride,\n isDisabled = false,\n isRequired = true,\n label,\n optionalLabel,\n renderFieldComponent,\n}: FieldProps) => {\n const id = useUniqueId(idOverride);\n const hintId = hint ? `${id}-hint` : undefined;\n const errorId = errorMessage ? `${id}-error` : undefined;\n const labelId = `${id}-label`;\n\n const ariaDescribedBy = useMemo(\n () => [hintId, errorId].join(\" \").trim() || undefined,\n [errorId, hintId]\n );\n\n return (\n <FormControl disabled={isDisabled} error={Boolean(errorMessage)}>\n <FieldLabel\n hasVisibleLabel={hasVisibleLabel}\n id={labelId}\n inputId={id}\n isRequired={isRequired}\n optionalText={optionalLabel}\n text={label}\n />\n\n {hint && <FieldHint id={hintId} text={hint} />}\n\n {renderFieldComponent({\n ariaDescribedBy,\n id,\n })}\n\n {errorMessage && <FieldError id={errorId} text={errorMessage} />}\n </FormControl>\n );\n};\n\nconst MemoizedField = memo(Field);\n\nexport { MemoizedField as Field };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,IAAT,EAA6BC,OAA7B,QAA4C,OAA5C;SAGEC,U,EACAC,S,EACAC,U,EACAC,W,EACAC,W;;;;AA8CF,MAAMC,KAAK,GAAG,QAUI;EAAA,IAVH;IACbC,YADa;IAEbC,eAFa;IAGbC,IAHa;IAIbC,EAAE,EAAEC,UAJS;IAKbC,UAAU,GAAG,KALA;IAMbC,UAAU,GAAG,IANA;IAObC,KAPa;IAQbC,aARa;IASbC;EATa,CAUG;EAChB,MAAMN,EAAE,GAAGL,WAAW,CAACM,UAAD,CAAtB;EACA,MAAMM,MAAM,GAAGR,IAAI,GAAI,GAAEC,EAAG,OAAT,GAAkBQ,SAArC;EACA,MAAMC,OAAO,GAAGZ,YAAY,GAAI,GAAEG,EAAG,QAAT,GAAmBQ,SAA/C;EACA,MAAME,OAAO,GAAI,GAAEV,EAAG,QAAtB;EAEA,MAAMW,eAAe,GAAGrB,OAAO,CAC7B,MAAM,CAACiB,MAAD,EAASE,OAAT,EAAkBG,IAAlB,CAAuB,GAAvB,EAA4BC,IAA5B,MAAsCL,SADf,EAE7B,CAACC,OAAD,EAAUF,MAAV,CAF6B,CAA/B;EAKA,OACE,MAAC,WAAD;IAAa,QAAQ,EAAEL,UAAvB;IAAmC,KAAK,EAAEY,OAAO,CAACjB,YAAD,CAAjD;IAAA,WACE,KAAC,UAAD;MACE,eAAe,EAAEC,eADnB;MAEE,EAAE,EAAEY,OAFN;MAGE,OAAO,EAAEV,EAHX;MAIE,UAAU,EAAEG,UAJd;MAKE,YAAY,EAAEE,aALhB;MAME,IAAI,EAAED;IANR,EADF,EAUGL,IAAI,IAAI,KAAC,SAAD;MAAW,EAAE,EAAEQ,MAAf;MAAuB,IAAI,EAAER;IAA7B,EAVX,EAYGO,oBAAoB,CAAC;MACpBK,eADoB;MAEpBX;IAFoB,CAAD,CAZvB,EAiBGH,YAAY,IAAI,KAAC,UAAD;MAAY,EAAE,EAAEY,OAAhB;MAAyB,IAAI,EAAEZ;IAA/B,EAjBnB;EAAA,EADF;AAqBD,CA1CD;;AA4CA,MAAMkB,aAAa,GAAG1B,IAAI,CAACO,KAAD,CAA1B;AAEA,SAASmB,aAAa,IAAInB,KAA1B"}
@@ -0,0 +1,34 @@
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 { memo } from "react";
13
+ import { FormHelperText } from "./index.js";
14
+ import { ScreenReaderText } from "./ScreenReaderText.js";
15
+ import { jsx as _jsx } from "react/jsx-runtime";
16
+ import { jsxs as _jsxs } from "react/jsx-runtime";
17
+
18
+ const FieldError = _ref => {
19
+ let {
20
+ id,
21
+ text
22
+ } = _ref;
23
+ return _jsxs(FormHelperText, {
24
+ error: true,
25
+ id: id,
26
+ children: [_jsx(ScreenReaderText, {
27
+ children: "Error:"
28
+ }), text]
29
+ });
30
+ };
31
+
32
+ const MemoizedFieldError = memo(FieldError);
33
+ export { MemoizedFieldError as FieldError };
34
+ //# sourceMappingURL=FieldError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FieldError.js","names":["memo","FormHelperText","ScreenReaderText","FieldError","id","text","MemoizedFieldError"],"sources":["../src/FieldError.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 { memo } from \"react\";\n\nimport { FormHelperText } from \".\";\nimport { ScreenReaderText } from \"./ScreenReaderText\";\n\nexport type FieldErrorProps = {\n id?: string;\n text: string;\n};\n\nconst FieldError = ({ id, text }: FieldErrorProps) => {\n return (\n <FormHelperText error id={id}>\n <ScreenReaderText>Error:</ScreenReaderText>\n {text}\n </FormHelperText>\n );\n};\n\nconst MemoizedFieldError = memo(FieldError);\n\nexport { MemoizedFieldError as FieldError };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,IAAT,QAAqB,OAArB;SAESC,c;SACAC,gB;;;;AAOT,MAAMC,UAAU,GAAG,QAAmC;EAAA,IAAlC;IAAEC,EAAF;IAAMC;EAAN,CAAkC;EACpD,OACE,MAAC,cAAD;IAAgB,KAAK,MAArB;IAAsB,EAAE,EAAED,EAA1B;IAAA,WACE,KAAC,gBAAD;MAAA;IAAA,EADF,EAEGC,IAFH;EAAA,EADF;AAMD,CAPD;;AASA,MAAMC,kBAAkB,GAAGN,IAAI,CAACG,UAAD,CAA/B;AAEA,SAASG,kBAAkB,IAAIH,UAA/B"}
@@ -0,0 +1,29 @@
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 { memo } from "react";
13
+ import { FormHelperText } from "./index.js";
14
+ import { jsx as _jsx } from "react/jsx-runtime";
15
+
16
+ const FieldHint = _ref => {
17
+ let {
18
+ id,
19
+ text
20
+ } = _ref;
21
+ return _jsx(FormHelperText, {
22
+ id: id,
23
+ children: text
24
+ });
25
+ };
26
+
27
+ const MemoizedFieldHint = memo(FieldHint);
28
+ export { MemoizedFieldHint as FieldHint };
29
+ //# sourceMappingURL=FieldHint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FieldHint.js","names":["memo","FormHelperText","FieldHint","id","text","MemoizedFieldHint"],"sources":["../src/FieldHint.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 { memo } from \"react\";\n\nimport { FormHelperText } from \"./\";\n\nexport type FieldHintProps = {\n id?: string;\n text: string;\n};\n\nconst FieldHint = ({ id, text }: FieldHintProps) => {\n return <FormHelperText id={id}>{text}</FormHelperText>;\n};\n\nconst MemoizedFieldHint = memo(FieldHint);\n\nexport { MemoizedFieldHint as FieldHint };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,IAAT,QAAqB,OAArB;SAESC,c;;;AAOT,MAAMC,SAAS,GAAG,QAAkC;EAAA,IAAjC;IAAEC,EAAF;IAAMC;EAAN,CAAiC;EAClD,OAAO,KAAC,cAAD;IAAgB,EAAE,EAAED,EAApB;IAAA,UAAyBC;EAAzB,EAAP;AACD,CAFD;;AAIA,MAAMC,iBAAiB,GAAGL,IAAI,CAACE,SAAD,CAA9B;AAEA,SAASG,iBAAiB,IAAIH,SAA9B"}
@@ -0,0 +1,32 @@
1
+ import _InputLabel from "@mui/material/InputLabel";
2
+ import { memo, useMemo } from "react";
3
+ import { ScreenReaderText } from "./ScreenReaderText.js";
4
+ import { Typography } from "./index.js";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ import { jsxs as _jsxs } from "react/jsx-runtime";
7
+
8
+ const FieldLabel = _ref => {
9
+ let {
10
+ hasVisibleLabel,
11
+ id,
12
+ inputId,
13
+ isRequired,
14
+ optionalText,
15
+ text
16
+ } = _ref;
17
+ const inputLabel = useMemo(() => _jsxs(_InputLabel, {
18
+ htmlFor: inputId,
19
+ id: id,
20
+ children: [text, !isRequired && _jsx(Typography, {
21
+ variant: "subtitle1",
22
+ children: optionalText
23
+ })]
24
+ }), [id, inputId, isRequired, optionalText, text]);
25
+ return hasVisibleLabel ? inputLabel : _jsx(ScreenReaderText, {
26
+ children: inputLabel
27
+ });
28
+ };
29
+
30
+ const MemoizedFieldLabel = memo(FieldLabel);
31
+ export { MemoizedFieldLabel as FieldLabel };
32
+ //# sourceMappingURL=FieldLabel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FieldLabel.js","names":["memo","useMemo","ScreenReaderText","Typography","FieldLabel","hasVisibleLabel","id","inputId","isRequired","optionalText","text","inputLabel","MemoizedFieldLabel"],"sources":["../src/FieldLabel.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 { InputLabel } from \"@mui/material\";\nimport { memo, useMemo } from \"react\";\n\nimport { ScreenReaderText } from \"./ScreenReaderText\";\nimport { Typography } from \".\";\n\nexport type FieldLabelProps = {\n hasVisibleLabel: boolean;\n id: string;\n inputId: string;\n isRequired: boolean;\n optionalText?: string;\n text: string;\n};\n\nconst FieldLabel = ({\n hasVisibleLabel,\n id,\n inputId,\n isRequired,\n optionalText,\n text,\n}: FieldLabelProps) => {\n const inputLabel = useMemo(\n () => (\n <InputLabel htmlFor={inputId} id={id}>\n {text}\n {!isRequired && (\n <Typography variant=\"subtitle1\">{optionalText}</Typography>\n )}\n </InputLabel>\n ),\n [id, inputId, isRequired, optionalText, text]\n );\n\n return hasVisibleLabel ? (\n inputLabel\n ) : (\n <ScreenReaderText>{inputLabel}</ScreenReaderText>\n );\n};\n\nconst MemoizedFieldLabel = memo(FieldLabel);\n\nexport { MemoizedFieldLabel as FieldLabel };\n"],"mappings":";AAaA,SAASA,IAAT,EAAeC,OAAf,QAA8B,OAA9B;SAESC,gB;SACAC,U;;;;AAWT,MAAMC,UAAU,GAAG,QAOI;EAAA,IAPH;IAClBC,eADkB;IAElBC,EAFkB;IAGlBC,OAHkB;IAIlBC,UAJkB;IAKlBC,YALkB;IAMlBC;EANkB,CAOG;EACrB,MAAMC,UAAU,GAAGV,OAAO,CACxB,MACE;IAAY,OAAO,EAAEM,OAArB;IAA8B,EAAE,EAAED,EAAlC;IAAA,WACGI,IADH,EAEG,CAACF,UAAD,IACC,KAAC,UAAD;MAAY,OAAO,EAAC,WAApB;MAAA,UAAiCC;IAAjC,EAHJ;EAAA,EAFsB,EASxB,CAACH,EAAD,EAAKC,OAAL,EAAcC,UAAd,EAA0BC,YAA1B,EAAwCC,IAAxC,CATwB,CAA1B;EAYA,OAAOL,eAAe,GACpBM,UADoB,GAGpB,KAAC,gBAAD;IAAA,UAAmBA;EAAnB,EAHF;AAKD,CAzBD;;AA2BA,MAAMC,kBAAkB,GAAGZ,IAAI,CAACI,UAAD,CAA/B;AAEA,SAASQ,kBAAkB,IAAIR,UAA/B"}
package/dist/Infobox.js CHANGED
@@ -10,7 +10,7 @@
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
12
  import { memo } from "react";
13
- import { Alert, AlertTitle, visuallyHidden } from "./index.js";
13
+ import { Alert, AlertTitle, ScreenReaderText } from "./index.js";
14
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
15
15
  import { jsx as _jsx } from "react/jsx-runtime";
16
16
 
@@ -25,8 +25,7 @@ const Infobox = _ref => {
25
25
  role: role,
26
26
  severity: severity,
27
27
  variant: "infobox",
28
- children: [_jsxs("span", {
29
- style: visuallyHidden,
28
+ children: [_jsxs(ScreenReaderText, {
30
29
  children: [severity, ": "]
31
30
  }), title && _jsx(AlertTitle, {
32
31
  children: title
@@ -1 +1 @@
1
- {"version":3,"file":"Infobox.js","names":["memo","Alert","AlertTitle","visuallyHidden","Infobox","children","severity","role","title","MemoizedInfobox"],"sources":["../src/Infobox.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 { memo, ReactNode } from \"react\";\nimport { Alert, AlertTitle, visuallyHidden } from \".\";\n\nexport interface InfoboxProps {\n /**\n * The contents of the alert\n */\n children: ReactNode;\n /**\n * Determine the color and icon of the alert\n */\n severity: AlertColor;\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 * The title of the alert\n */\n title?: string;\n}\n\nconst Infobox = ({ children, severity, role, title }: InfoboxProps) => (\n <Alert role={role} severity={severity} variant=\"infobox\">\n <span style={visuallyHidden}>{severity}: </span>\n {title && <AlertTitle>{title}</AlertTitle>}\n {children}\n </Alert>\n);\n\nconst MemoizedInfobox = memo(Infobox);\n\nexport { MemoizedInfobox as Infobox };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,SAASA,IAAT,QAAgC,OAAhC;SACSC,K,EAAOC,U,EAAYC,c;;;;AAuB5B,MAAMC,OAAO,GAAG;EAAA,IAAC;IAAEC,QAAF;IAAYC,QAAZ;IAAsBC,IAAtB;IAA4BC;EAA5B,CAAD;EAAA,OACd,MAAC,KAAD;IAAO,IAAI,EAAED,IAAb;IAAmB,QAAQ,EAAED,QAA7B;IAAuC,OAAO,EAAC,SAA/C;IAAA,WACE;MAAM,KAAK,EAAEH,cAAb;MAAA,WAA8BG,QAA9B;IAAA,EADF,EAEGE,KAAK,IAAI,KAAC,UAAD;MAAA,UAAaA;IAAb,EAFZ,EAGGH,QAHH;EAAA,EADc;AAAA,CAAhB;;AAQA,MAAMI,eAAe,GAAGT,IAAI,CAACI,OAAD,CAA5B;AAEA,SAASK,eAAe,IAAIL,OAA5B"}
1
+ {"version":3,"file":"Infobox.js","names":["memo","Alert","AlertTitle","ScreenReaderText","Infobox","children","severity","role","title","MemoizedInfobox"],"sources":["../src/Infobox.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 { memo, ReactNode } from \"react\";\nimport { Alert, AlertTitle, ScreenReaderText } from \".\";\n\nexport interface InfoboxProps {\n /**\n * The contents of the alert\n */\n children: ReactNode;\n /**\n * Determine the color and icon of the alert\n */\n severity: AlertColor;\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 * The title of the alert\n */\n title?: string;\n}\n\nconst Infobox = ({ children, severity, role, title }: InfoboxProps) => (\n <Alert role={role} severity={severity} variant=\"infobox\">\n <ScreenReaderText>{severity}: </ScreenReaderText>\n {title && <AlertTitle>{title}</AlertTitle>}\n {children}\n </Alert>\n);\n\nconst MemoizedInfobox = memo(Infobox);\n\nexport { MemoizedInfobox as Infobox };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,SAASA,IAAT,QAAgC,OAAhC;SACSC,K,EAAOC,U,EAAYC,gB;;;;AAuB5B,MAAMC,OAAO,GAAG;EAAA,IAAC;IAAEC,QAAF;IAAYC,QAAZ;IAAsBC,IAAtB;IAA4BC;EAA5B,CAAD;EAAA,OACd,MAAC,KAAD;IAAO,IAAI,EAAED,IAAb;IAAmB,QAAQ,EAAED,QAA7B;IAAuC,OAAO,EAAC,SAA/C;IAAA,WACE,MAAC,gBAAD;MAAA,WAAmBA,QAAnB;IAAA,EADF,EAEGE,KAAK,IAAI,KAAC,UAAD;MAAA,UAAaA;IAAb,EAFZ,EAGGH,QAHH;EAAA,EADc;AAAA,CAAhB;;AAQA,MAAMI,eAAe,GAAGT,IAAI,CAACI,OAAD,CAA5B;AAEA,SAASK,eAAe,IAAIL,OAA5B"}
@@ -44,8 +44,8 @@ const MenuButton = _ref => {
44
44
  "aria-haspopup": "true",
45
45
  "aria-expanded": open ? "true" : undefined,
46
46
  onClick: handleClick,
47
- variant: buttonVariant,
48
- children: buttonLabel
47
+ text: buttonLabel,
48
+ variant: buttonVariant
49
49
  }), _jsx(Menu, {
50
50
  id: `${uniqueId}-menu`,
51
51
  anchorEl: anchorEl,
@@ -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 variant={buttonVariant}\n >\n {buttonLabel}\n </Button>\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,OAAO,EAAEL,aAPX;MAAA,UASGH;IATH,EADF,EAYE,KAAC,IAAD;MACE,EAAE,EAAG,GAAEY,QAAS,OADlB;MAEE,QAAQ,EAAER,QAFZ;MAGE,IAAI,EAAEE,IAHR;MAIE,OAAO,EAAEK,WAJX;MAKE,aAAa,EAAEE,aALjB;MAAA,UAOGZ;IAPH,EAZF;EAAA,EADF;AAwBD,CAjDD;;AAmDA,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","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"}
package/dist/MenuItem.js CHANGED
@@ -26,6 +26,5 @@ const MenuItem = forwardRef((_ref, ref) => {
26
26
  });
27
27
  });
28
28
  const MemoizedMenuItem = memo(MenuItem);
29
- MemoizedMenuItem.displayName = "MenuItem";
30
29
  export { MemoizedMenuItem as MenuItem };
31
30
  //# sourceMappingURL=MenuItem.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MenuItem.js","names":["memo","forwardRef","menuItemClasses","MenuItem","ref","isDestructive","props","root","undefined","children","MemoizedMenuItem","displayName"],"sources":["../src/MenuItem.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, forwardRef } from \"react\";\nimport { MenuItem as MuiMenuItem } from \"@mui/material\";\nimport { menuItemClasses } from \"@mui/material/MenuItem\";\nimport type { MenuItemProps as MuiMenuItemProps } from \"@mui/material\";\n\nexport interface MenuItemProps\n extends Omit<\n MuiMenuItemProps,\n | \"component\"\n | \"dense\"\n | \"disableGutters\"\n | \"divider\"\n | \"focusVisibleClassName\"\n > {\n /**\n * Toggles whether or not the MenuItem represents a destructive action.\n */\n isDestructive?: boolean;\n}\n\nconst MenuItem = forwardRef<HTMLLIElement, MenuItemProps>(\n ({ isDestructive, ...props }, ref) => (\n <MuiMenuItem\n {...props}\n ref={ref}\n className={\n isDestructive ? `${menuItemClasses.root}-destructive` : undefined\n }\n >\n {props.children}\n </MuiMenuItem>\n )\n);\n\nconst MemoizedMenuItem = memo(MenuItem);\nMemoizedMenuItem.displayName = \"MenuItem\";\n\nexport { MemoizedMenuItem as MenuItem };\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,IAAT,EAAeC,UAAf,QAAiC,OAAjC;AAEA,SAASC,eAAT,QAAgC,wBAAhC;;AAkBA,MAAMC,QAAQ,GAAGF,UAAU,CACzB,OAA8BG,GAA9B;EAAA,IAAC;IAAEC,aAAF;IAAiB,GAAGC;EAApB,CAAD;EAAA,OACE,qBACMA,KADN;IAEE,GAAG,EAAEF,GAFP;IAGE,SAAS,EACPC,aAAa,GAAI,GAAEH,eAAe,CAACK,IAAK,cAA3B,GAA2CC,SAJ5D;IAAA,UAOGF,KAAK,CAACG;EAPT,EADF;AAAA,CADyB,CAA3B;AAcA,MAAMC,gBAAgB,GAAGV,IAAI,CAACG,QAAD,CAA7B;AACAO,gBAAgB,CAACC,WAAjB,GAA+B,UAA/B;AAEA,SAASD,gBAAgB,IAAIP,QAA7B"}
1
+ {"version":3,"file":"MenuItem.js","names":["memo","forwardRef","menuItemClasses","MenuItem","ref","isDestructive","props","root","undefined","children","MemoizedMenuItem"],"sources":["../src/MenuItem.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, forwardRef } from \"react\";\nimport { MenuItem as MuiMenuItem } from \"@mui/material\";\nimport { menuItemClasses } from \"@mui/material/MenuItem\";\nimport type { MenuItemProps as MuiMenuItemProps } from \"@mui/material\";\n\nexport interface MenuItemProps\n extends Omit<\n MuiMenuItemProps,\n | \"component\"\n | \"dense\"\n | \"disableGutters\"\n | \"divider\"\n | \"focusVisibleClassName\"\n > {\n /**\n * Toggles whether or not the MenuItem represents a destructive action.\n */\n isDestructive?: boolean;\n}\n\nconst MenuItem = forwardRef<HTMLLIElement, MenuItemProps>(\n ({ isDestructive, ...props }, ref) => (\n <MuiMenuItem\n {...props}\n ref={ref}\n className={\n isDestructive ? `${menuItemClasses.root}-destructive` : undefined\n }\n >\n {props.children}\n </MuiMenuItem>\n )\n);\n\nconst MemoizedMenuItem = memo(MenuItem);\n\nexport { MemoizedMenuItem as MenuItem };\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,IAAT,EAAeC,UAAf,QAAiC,OAAjC;AAEA,SAASC,eAAT,QAAgC,wBAAhC;;AAkBA,MAAMC,QAAQ,GAAGF,UAAU,CACzB,OAA8BG,GAA9B;EAAA,IAAC;IAAEC,aAAF;IAAiB,GAAGC;EAApB,CAAD;EAAA,OACE,qBACMA,KADN;IAEE,GAAG,EAAEF,GAFP;IAGE,SAAS,EACPC,aAAa,GAAI,GAAEH,eAAe,CAACK,IAAK,cAA3B,GAA2CC,SAJ5D;IAAA,UAOGF,KAAK,CAACG;EAPT,EADF;AAAA,CADyB,CAA3B;AAcA,MAAMC,gBAAgB,GAAGV,IAAI,CAACG,QAAD,CAA7B;AAEA,SAASO,gBAAgB,IAAIP,QAA7B"}
@@ -0,0 +1,68 @@
1
+ import _InputBase from "@mui/material/InputBase";
2
+ import _InputAdornment from "@mui/material/InputAdornment";
3
+ import { forwardRef, memo, useCallback, useState } from "react";
4
+ import { EyeIcon, EyeOffIcon, IconButton } from "./index.js";
5
+ import { Field } from "./Field.js";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ const PasswordField = forwardRef((_ref, ref) => {
8
+ let {
9
+ autoCompleteType,
10
+ autoFocus,
11
+ errorMessage,
12
+ hint,
13
+ id: idOverride,
14
+ isDisabled = false,
15
+ isReadOnly,
16
+ label,
17
+ onChange,
18
+ onFocus,
19
+ onBlur,
20
+ placeholder,
21
+ value
22
+ } = _ref;
23
+ const [inputType, setInputType] = useState("password");
24
+ const togglePasswordVisibility = useCallback(() => {
25
+ setInputType(inputType => inputType === "password" ? "text" : "password");
26
+ }, []);
27
+ const renderFieldComponent = useCallback(_ref2 => {
28
+ let {
29
+ ariaDescribedBy,
30
+ id
31
+ } = _ref2;
32
+ return _jsx(_InputBase, {
33
+ "aria-describedby": ariaDescribedBy,
34
+ autoComplete: autoCompleteType,
35
+ autoFocus: autoFocus,
36
+ endAdornment: _jsx(_InputAdornment, {
37
+ position: "end",
38
+ children: _jsx(IconButton, {
39
+ "aria-label": "toggle password visibility",
40
+ edge: "end",
41
+ onClick: togglePasswordVisibility,
42
+ children: inputType === "password" ? _jsx(EyeIcon, {}) : _jsx(EyeOffIcon, {})
43
+ })
44
+ }),
45
+ id: id,
46
+ onChange: onChange,
47
+ onFocus: onFocus,
48
+ onBlur: onBlur,
49
+ placeholder: placeholder,
50
+ readOnly: isReadOnly,
51
+ ref: ref,
52
+ type: inputType,
53
+ value: value
54
+ });
55
+ }, [autoCompleteType, autoFocus, togglePasswordVisibility, inputType, onChange, onFocus, onBlur, placeholder, isReadOnly, ref, value]);
56
+ return _jsx(Field, {
57
+ errorMessage: errorMessage,
58
+ hasVisibleLabel: true,
59
+ hint: hint,
60
+ id: idOverride,
61
+ isDisabled: isDisabled,
62
+ label: label,
63
+ renderFieldComponent: renderFieldComponent
64
+ });
65
+ });
66
+ const MemoizedPasswordField = memo(PasswordField);
67
+ export { MemoizedPasswordField as PasswordField };
68
+ //# sourceMappingURL=PasswordField.js.map