@okta/odyssey-react-mui 0.21.4 → 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 (135) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/Autocomplete.js +58 -0
  3. package/dist/Autocomplete.js.map +1 -0
  4. package/dist/Button.js +46 -0
  5. package/dist/Button.js.map +1 -0
  6. package/dist/Field.js +59 -0
  7. package/dist/Field.js.map +1 -0
  8. package/dist/FieldError.js +34 -0
  9. package/dist/FieldError.js.map +1 -0
  10. package/dist/FieldHint.js +29 -0
  11. package/dist/FieldHint.js.map +1 -0
  12. package/dist/FieldLabel.js +32 -0
  13. package/dist/FieldLabel.js.map +1 -0
  14. package/dist/MenuButton.js +2 -2
  15. package/dist/MenuButton.js.map +1 -1
  16. package/dist/MenuItem.js +0 -1
  17. package/dist/MenuItem.js.map +1 -1
  18. package/dist/PasswordField.js +68 -0
  19. package/dist/PasswordField.js.map +1 -0
  20. package/dist/SearchField.js +54 -0
  21. package/dist/SearchField.js.map +1 -0
  22. package/dist/Tag.js +28 -0
  23. package/dist/Tag.js.map +1 -0
  24. package/dist/TagList.js +26 -0
  25. package/dist/TagList.js.map +1 -0
  26. package/dist/TagListContext.js +16 -0
  27. package/dist/TagListContext.js.map +1 -0
  28. package/dist/TextField.js +26 -61
  29. package/dist/TextField.js.map +1 -1
  30. package/dist/index.js +10 -2
  31. package/dist/index.js.map +1 -1
  32. package/dist/src/Autocomplete.d.ts +27 -0
  33. package/dist/src/Autocomplete.d.ts.map +1 -0
  34. package/dist/src/Button.d.ts +31 -0
  35. package/dist/src/Button.d.ts.map +1 -0
  36. package/dist/src/Field.d.ts +54 -0
  37. package/dist/src/Field.d.ts.map +1 -0
  38. package/dist/src/FieldError.d.ts +19 -0
  39. package/dist/src/FieldError.d.ts.map +1 -0
  40. package/dist/src/FieldHint.d.ts +19 -0
  41. package/dist/src/FieldHint.d.ts.map +1 -0
  42. package/dist/src/FieldLabel.d.ts +23 -0
  43. package/dist/src/FieldLabel.d.ts.map +1 -0
  44. package/dist/src/Icon.d.ts +1 -1
  45. package/dist/src/Link.d.ts +1 -1
  46. package/dist/src/MenuButton.d.ts.map +1 -1
  47. package/dist/src/MenuItem.d.ts +1 -1
  48. package/dist/src/MenuItem.d.ts.map +1 -1
  49. package/dist/src/PasswordField.d.ts +75 -0
  50. package/dist/src/PasswordField.d.ts.map +1 -0
  51. package/dist/src/SearchField.d.ts +59 -0
  52. package/dist/src/SearchField.d.ts.map +1 -0
  53. package/dist/src/Tag.d.ts +22 -0
  54. package/dist/src/Tag.d.ts.map +1 -0
  55. package/dist/src/TagList.d.ts +19 -0
  56. package/dist/src/TagList.d.ts.map +1 -0
  57. package/dist/src/TagListContext.d.ts +18 -0
  58. package/dist/src/TagListContext.d.ts.map +1 -0
  59. package/dist/src/TextField.d.ts +3 -8
  60. package/dist/src/TextField.d.ts.map +1 -1
  61. package/dist/src/iconDictionary/Add.d.ts +1 -1
  62. package/dist/src/iconDictionary/AddCircle.d.ts +1 -1
  63. package/dist/src/iconDictionary/AlertCircle.d.ts +1 -1
  64. package/dist/src/iconDictionary/AlertCircleFilled.d.ts +1 -1
  65. package/dist/src/iconDictionary/AlertTriangleFilled.d.ts +1 -1
  66. package/dist/src/iconDictionary/Anchor.d.ts +1 -1
  67. package/dist/src/iconDictionary/ArrowDown.d.ts +1 -1
  68. package/dist/src/iconDictionary/ArrowLeft.d.ts +1 -1
  69. package/dist/src/iconDictionary/ArrowRight.d.ts +1 -1
  70. package/dist/src/iconDictionary/ArrowUp.d.ts +1 -1
  71. package/dist/src/iconDictionary/ArrowUpDown.d.ts +1 -1
  72. package/dist/src/iconDictionary/Calendar.d.ts +1 -1
  73. package/dist/src/iconDictionary/Check.d.ts +1 -1
  74. package/dist/src/iconDictionary/CheckCircleFilled.d.ts +1 -1
  75. package/dist/src/iconDictionary/ChevronDown.d.ts +1 -1
  76. package/dist/src/iconDictionary/ChevronUp.d.ts +1 -1
  77. package/dist/src/iconDictionary/Close.d.ts +1 -1
  78. package/dist/src/iconDictionary/CloseCircleFilled.d.ts +1 -1
  79. package/dist/src/iconDictionary/Copy.d.ts +1 -1
  80. package/dist/src/iconDictionary/Delete.d.ts +1 -1
  81. package/dist/src/iconDictionary/Download.d.ts +1 -1
  82. package/dist/src/iconDictionary/DragHandle.d.ts +1 -1
  83. package/dist/src/iconDictionary/Edit.d.ts +1 -1
  84. package/dist/src/iconDictionary/ExternalLink.d.ts +1 -1
  85. package/dist/src/iconDictionary/Eye.d.ts +1 -1
  86. package/dist/src/iconDictionary/EyeOff.d.ts +1 -1
  87. package/dist/src/iconDictionary/Filter.d.ts +1 -1
  88. package/dist/src/iconDictionary/Globe.d.ts +1 -1
  89. package/dist/src/iconDictionary/Home.d.ts +1 -1
  90. package/dist/src/iconDictionary/InformationCircle.d.ts +1 -1
  91. package/dist/src/iconDictionary/InformationCircleFilled.d.ts +1 -1
  92. package/dist/src/iconDictionary/Notification.d.ts +1 -1
  93. package/dist/src/iconDictionary/OverflowVertical.d.ts +1 -1
  94. package/dist/src/iconDictionary/QuestionCircle.d.ts +1 -1
  95. package/dist/src/iconDictionary/QuestionCircleFilled.d.ts +1 -1
  96. package/dist/src/iconDictionary/Search.d.ts +1 -1
  97. package/dist/src/iconDictionary/Settings.d.ts +1 -1
  98. package/dist/src/iconDictionary/Subtract.d.ts +1 -1
  99. package/dist/src/iconDictionary/User.d.ts +1 -1
  100. package/dist/src/iconDictionary/UserGroup.d.ts +1 -1
  101. package/dist/src/iconDictionary/index.d.ts +40 -40
  102. package/dist/src/index.d.ts +11 -3
  103. package/dist/src/index.d.ts.map +1 -1
  104. package/dist/src/theme/components.d.ts.map +1 -1
  105. package/dist/src/theme/components.types.d.ts +0 -8
  106. package/dist/src/theme/components.types.d.ts.map +1 -1
  107. package/dist/theme/components.js +217 -124
  108. package/dist/theme/components.js.map +1 -1
  109. package/dist/theme/components.types.js.map +1 -1
  110. package/dist/tsconfig.production.tsbuildinfo +1 -1
  111. package/package.json +3 -3
  112. package/src/Autocomplete.tsx +132 -0
  113. package/src/Button.tsx +75 -0
  114. package/src/Field.tsx +112 -0
  115. package/src/FieldError.tsx +34 -0
  116. package/src/FieldHint.tsx +28 -0
  117. package/src/FieldLabel.tsx +57 -0
  118. package/src/MenuButton.tsx +2 -3
  119. package/src/MenuItem.tsx +0 -1
  120. package/src/OdysseyCacheProvider.test.tsx +1 -1
  121. package/src/PasswordField.tsx +174 -0
  122. package/src/SearchField.tsx +136 -0
  123. package/src/Tag.tsx +41 -0
  124. package/src/TagList.tsx +43 -0
  125. package/src/TagListContext.tsx +23 -0
  126. package/src/TextField.tsx +43 -101
  127. package/src/index.ts +9 -3
  128. package/src/theme/components.tsx +87 -18
  129. package/src/theme/components.types.ts +0 -8
  130. package/dist/PasswordInput.js +0 -87
  131. package/dist/PasswordInput.js.map +0 -1
  132. package/dist/src/PasswordInput.d.ts +0 -21
  133. package/dist/src/PasswordInput.d.ts.map +0 -1
  134. package/src/PasswordInput.test.tsx +0 -51
  135. package/src/PasswordInput.tsx +0 -111
package/CHANGELOG.md CHANGED
@@ -3,6 +3,23 @@
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
+
6
23
  ## [0.21.4](https://github.com/okta/odyssey/compare/v0.21.3...v0.21.4) (2023-04-13)
7
24
 
8
25
  ### 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/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"}
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"}
@@ -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
@@ -0,0 +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"}
@@ -0,0 +1,54 @@
1
+ import _InputBase from "@mui/material/InputBase";
2
+ import _InputAdornment from "@mui/material/InputAdornment";
3
+ import { forwardRef, memo, useCallback } from "react";
4
+ import { SearchIcon } from "./index.js";
5
+ import { Field } from "./Field.js";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ const SearchField = forwardRef((_ref, ref) => {
8
+ let {
9
+ autoCompleteType,
10
+ autoFocus,
11
+ id: idOverride,
12
+ isDisabled = false,
13
+ label,
14
+ onChange,
15
+ onFocus,
16
+ onBlur,
17
+ placeholder,
18
+ value
19
+ } = _ref;
20
+ const renderFieldComponent = useCallback(_ref2 => {
21
+ let {
22
+ ariaDescribedBy,
23
+ id
24
+ } = _ref2;
25
+ return _jsx(_InputBase, {
26
+ "aria-describedby": ariaDescribedBy,
27
+ autoComplete: autoCompleteType,
28
+ autoFocus: autoFocus,
29
+ id: id,
30
+ onChange: onChange,
31
+ onFocus: onFocus,
32
+ onBlur: onBlur,
33
+ placeholder: placeholder,
34
+ ref: ref,
35
+ startAdornment: _jsx(_InputAdornment, {
36
+ position: "start",
37
+ children: _jsx(SearchIcon, {})
38
+ }),
39
+ type: "search",
40
+ value: value
41
+ });
42
+ }, [autoCompleteType, autoFocus, onChange, onFocus, onBlur, placeholder, ref, value]);
43
+ return _jsx(Field, {
44
+ hasVisibleLabel: false,
45
+ id: idOverride,
46
+ isDisabled: isDisabled,
47
+ isRequired: false,
48
+ label: label,
49
+ renderFieldComponent: renderFieldComponent
50
+ });
51
+ });
52
+ const MemoizedSearchField = memo(SearchField);
53
+ export { MemoizedSearchField as SearchField };
54
+ //# sourceMappingURL=SearchField.js.map
@@ -0,0 +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"}
package/dist/Tag.js ADDED
@@ -0,0 +1,28 @@
1
+ import _Chip from "@mui/material/Chip";
2
+ import { memo, useContext } from "react";
3
+ import { TagListContext } from "./TagListContext.js";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+
6
+ const Tag = _ref => {
7
+ let {
8
+ isDisabled,
9
+ label,
10
+ onClick,
11
+ onRemove
12
+ } = _ref;
13
+ const {
14
+ chipElementType
15
+ } = useContext(TagListContext);
16
+ return _jsx(_Chip, {
17
+ label: label,
18
+ clickable: onClick ? true : false,
19
+ component: chipElementType,
20
+ disabled: isDisabled,
21
+ onClick: onClick,
22
+ onDelete: onRemove
23
+ });
24
+ };
25
+
26
+ const MemoizedTag = memo(Tag);
27
+ export { MemoizedTag as Tag };
28
+ //# sourceMappingURL=Tag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tag.js","names":["memo","useContext","TagListContext","Tag","isDisabled","label","onClick","onRemove","chipElementType","MemoizedTag"],"sources":["../src/Tag.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, ChipProps } from \"@mui/material\";\nimport { memo, useContext } from \"react\";\nimport { TagListContext } from \"./TagListContext\";\n\nexport type TagProps = {\n isDisabled?: boolean;\n label: string;\n onClick?: ChipProps[\"onClick\"];\n onRemove?: ChipProps[\"onDelete\"];\n};\n\nconst Tag = ({ isDisabled, label, onClick, onRemove }: TagProps) => {\n const { chipElementType } = useContext(TagListContext);\n\n return (\n <Chip\n label={label}\n clickable={onClick ? true : false}\n component={chipElementType}\n disabled={isDisabled}\n onClick={onClick}\n onDelete={onRemove}\n />\n );\n};\n\nconst MemoizedTag = memo(Tag);\n\nexport { MemoizedTag as Tag };\n"],"mappings":";AAaA,SAASA,IAAT,EAAeC,UAAf,QAAiC,OAAjC;SACSC,c;;;AAST,MAAMC,GAAG,GAAG,QAAwD;EAAA,IAAvD;IAAEC,UAAF;IAAcC,KAAd;IAAqBC,OAArB;IAA8BC;EAA9B,CAAuD;EAClE,MAAM;IAAEC;EAAF,IAAsBP,UAAU,CAACC,cAAD,CAAtC;EAEA,OACE;IACE,KAAK,EAAEG,KADT;IAEE,SAAS,EAAEC,OAAO,GAAG,IAAH,GAAU,KAF9B;IAGE,SAAS,EAAEE,eAHb;IAIE,QAAQ,EAAEJ,UAJZ;IAKE,OAAO,EAAEE,OALX;IAME,QAAQ,EAAEC;EANZ,EADF;AAUD,CAbD;;AAeA,MAAME,WAAW,GAAGT,IAAI,CAACG,GAAD,CAAxB;AAEA,SAASM,WAAW,IAAIN,GAAxB"}
@@ -0,0 +1,26 @@
1
+ import _Stack from "@mui/material/Stack";
2
+ import { memo, useMemo } from "react";
3
+ import { TagListContext } from "./TagListContext.js";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+
6
+ const TagList = _ref => {
7
+ let {
8
+ children
9
+ } = _ref;
10
+ const providerValue = useMemo(() => ({
11
+ chipElementType: "li"
12
+ }), []);
13
+ return _jsx(_Stack, {
14
+ component: "ul",
15
+ direction: "row",
16
+ spacing: 2,
17
+ children: _jsx(TagListContext.Provider, {
18
+ value: providerValue,
19
+ children: children
20
+ })
21
+ });
22
+ };
23
+
24
+ const MemoizedTagList = memo(TagList);
25
+ export { MemoizedTagList as TagList };
26
+ //# sourceMappingURL=TagList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TagList.js","names":["memo","useMemo","TagListContext","TagList","children","providerValue","chipElementType","MemoizedTagList"],"sources":["../src/TagList.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 { Tag } from \"./\";\nimport { Stack } from \"@mui/material\";\nimport { memo, ReactElement, useMemo } from \"react\";\nimport { ChipElementType, TagListContext } from \"./TagListContext\";\n\nexport type TagListProps = {\n children: ReactElement<typeof Tag> | Array<ReactElement<typeof Tag>>;\n};\n\nconst TagList = ({ children }: TagListProps) => {\n const providerValue = useMemo<{\n chipElementType: ChipElementType;\n }>(\n () => ({\n chipElementType: \"li\",\n }),\n []\n );\n\n return (\n <Stack component=\"ul\" direction=\"row\" spacing={2}>\n <TagListContext.Provider value={providerValue}>\n {children}\n </TagListContext.Provider>\n </Stack>\n );\n};\n\nconst MemoizedTagList = memo(TagList);\n\nexport { MemoizedTagList as TagList };\n"],"mappings":";AAcA,SAASA,IAAT,EAA6BC,OAA7B,QAA4C,OAA5C;SAC0BC,c;;;AAM1B,MAAMC,OAAO,GAAG,QAAgC;EAAA,IAA/B;IAAEC;EAAF,CAA+B;EAC9C,MAAMC,aAAa,GAAGJ,OAAO,CAG3B,OAAO;IACLK,eAAe,EAAE;EADZ,CAAP,CAH2B,EAM3B,EAN2B,CAA7B;EASA,OACE;IAAO,SAAS,EAAC,IAAjB;IAAsB,SAAS,EAAC,KAAhC;IAAsC,OAAO,EAAE,CAA/C;IAAA,UACE,KAAC,cAAD,CAAgB,QAAhB;MAAyB,KAAK,EAAED,aAAhC;MAAA,UACGD;IADH;EADF,EADF;AAOD,CAjBD;;AAmBA,MAAMG,eAAe,GAAGP,IAAI,CAACG,OAAD,CAA5B;AAEA,SAASI,eAAe,IAAIJ,OAA5B"}