@okta/odyssey-react-mui 1.0.2 → 1.1.1

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 (204) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +1 -1
  3. package/dist/Autocomplete.js +9 -3
  4. package/dist/Autocomplete.js.map +1 -1
  5. package/dist/Banner.js +3 -1
  6. package/dist/Banner.js.map +1 -1
  7. package/dist/Box.js +8 -4
  8. package/dist/Box.js.map +1 -1
  9. package/dist/Button.js +3 -1
  10. package/dist/Button.js.map +1 -1
  11. package/dist/Callout.js +2 -0
  12. package/dist/Callout.js.map +1 -1
  13. package/dist/Checkbox.js +6 -2
  14. package/dist/Checkbox.js.map +1 -1
  15. package/dist/CheckboxGroup.js +5 -7
  16. package/dist/CheckboxGroup.js.map +1 -1
  17. package/dist/CircularProgress.js +2 -0
  18. package/dist/CircularProgress.js.map +1 -1
  19. package/dist/Dialog.js +2 -0
  20. package/dist/Dialog.js.map +1 -1
  21. package/dist/Field.js.map +1 -1
  22. package/dist/FieldError.js +2 -0
  23. package/dist/FieldError.js.map +1 -1
  24. package/dist/FieldHint.js +2 -0
  25. package/dist/FieldHint.js.map +1 -1
  26. package/dist/FieldLabel.js +3 -1
  27. package/dist/FieldLabel.js.map +1 -1
  28. package/dist/Fieldset.js +3 -1
  29. package/dist/Fieldset.js.map +1 -1
  30. package/dist/Form.js +5 -3
  31. package/dist/Form.js.map +1 -1
  32. package/dist/Link.js +3 -1
  33. package/dist/Link.js.map +1 -1
  34. package/dist/MenuButton.js +8 -2
  35. package/dist/MenuButton.js.map +1 -1
  36. package/dist/MenuItem.js +6 -2
  37. package/dist/MenuItem.js.map +1 -1
  38. package/dist/NativeSelect.js +3 -1
  39. package/dist/NativeSelect.js.map +1 -1
  40. package/dist/OdysseyI18n.js +2 -0
  41. package/dist/OdysseyI18n.js.map +1 -1
  42. package/dist/OdysseyProvider.js +7 -4
  43. package/dist/OdysseyProvider.js.map +1 -1
  44. package/dist/OdysseyThemeProvider.js +3 -6
  45. package/dist/OdysseyThemeProvider.js.map +1 -1
  46. package/dist/OdysseyTranslationProvider.types.js +1 -1
  47. package/dist/OdysseyTranslationProvider.types.js.map +1 -1
  48. package/dist/PasswordField.js +9 -8
  49. package/dist/PasswordField.js.map +1 -1
  50. package/dist/Radio.js +2 -0
  51. package/dist/Radio.js.map +1 -1
  52. package/dist/RadioGroup.js +5 -2
  53. package/dist/RadioGroup.js.map +1 -1
  54. package/dist/SearchField.js +11 -10
  55. package/dist/SearchField.js.map +1 -1
  56. package/dist/Select.js +8 -5
  57. package/dist/Select.js.map +1 -1
  58. package/dist/SeleniumProps.js +2 -0
  59. package/dist/SeleniumProps.js.map +1 -0
  60. package/dist/Status.js +4 -2
  61. package/dist/Status.js.map +1 -1
  62. package/dist/Tabs.js +11 -4
  63. package/dist/Tabs.js.map +1 -1
  64. package/dist/Tag.js +4 -2
  65. package/dist/Tag.js.map +1 -1
  66. package/dist/TagList.js +3 -1
  67. package/dist/TagList.js.map +1 -1
  68. package/dist/TextField.js +6 -2
  69. package/dist/TextField.js.map +1 -1
  70. package/dist/Toast.js +2 -0
  71. package/dist/Toast.js.map +1 -1
  72. package/dist/Tooltip.js +2 -0
  73. package/dist/Tooltip.js.map +1 -1
  74. package/dist/Typography.js +71 -37
  75. package/dist/Typography.js.map +1 -1
  76. package/dist/labs/DatePicker.js +4 -2
  77. package/dist/labs/DatePicker.js.map +1 -1
  78. package/dist/labs/PaginatedTable.js +6 -4
  79. package/dist/labs/PaginatedTable.js.map +1 -1
  80. package/dist/labs/StaticTable.js +9 -4
  81. package/dist/labs/StaticTable.js.map +1 -1
  82. package/dist/src/Autocomplete.d.ts +7 -2
  83. package/dist/src/Autocomplete.d.ts.map +1 -1
  84. package/dist/src/Banner.d.ts +3 -2
  85. package/dist/src/Banner.d.ts.map +1 -1
  86. package/dist/src/Box.d.ts +9 -2
  87. package/dist/src/Box.d.ts.map +1 -1
  88. package/dist/src/Button.d.ts +3 -2
  89. package/dist/src/Button.d.ts.map +1 -1
  90. package/dist/src/Callout.d.ts +3 -2
  91. package/dist/src/Callout.d.ts.map +1 -1
  92. package/dist/src/Checkbox.d.ts +8 -3
  93. package/dist/src/Checkbox.d.ts.map +1 -1
  94. package/dist/src/CheckboxGroup.d.ts +3 -6
  95. package/dist/src/CheckboxGroup.d.ts.map +1 -1
  96. package/dist/src/CircularProgress.d.ts +3 -2
  97. package/dist/src/CircularProgress.d.ts.map +1 -1
  98. package/dist/src/Dialog.d.ts +3 -2
  99. package/dist/src/Dialog.d.ts.map +1 -1
  100. package/dist/src/Field.d.ts +2 -1
  101. package/dist/src/Field.d.ts.map +1 -1
  102. package/dist/src/FieldError.d.ts +3 -2
  103. package/dist/src/FieldError.d.ts.map +1 -1
  104. package/dist/src/FieldHint.d.ts +3 -2
  105. package/dist/src/FieldHint.d.ts.map +1 -1
  106. package/dist/src/FieldLabel.d.ts +3 -2
  107. package/dist/src/FieldLabel.d.ts.map +1 -1
  108. package/dist/src/Fieldset.d.ts +3 -2
  109. package/dist/src/Fieldset.d.ts.map +1 -1
  110. package/dist/src/Form.d.ts +3 -2
  111. package/dist/src/Form.d.ts.map +1 -1
  112. package/dist/src/Link.d.ts +3 -2
  113. package/dist/src/Link.d.ts.map +1 -1
  114. package/dist/src/MenuButton.d.ts +12 -3
  115. package/dist/src/MenuButton.d.ts.map +1 -1
  116. package/dist/src/MenuItem.d.ts +5 -4
  117. package/dist/src/MenuItem.d.ts.map +1 -1
  118. package/dist/src/NativeSelect.d.ts +56 -2
  119. package/dist/src/NativeSelect.d.ts.map +1 -1
  120. package/dist/src/OdysseyI18n.d.ts +15 -0
  121. package/dist/src/OdysseyI18n.d.ts.map +1 -1
  122. package/dist/src/OdysseyProvider.d.ts.map +1 -1
  123. package/dist/src/OdysseyThemeProvider.d.ts.map +1 -1
  124. package/dist/src/OdysseyTranslationProvider.types.d.ts +1 -1
  125. package/dist/src/OdysseyTranslationProvider.types.d.ts.map +1 -1
  126. package/dist/src/PasswordField.d.ts +70 -2
  127. package/dist/src/PasswordField.d.ts.map +1 -1
  128. package/dist/src/Radio.d.ts +3 -2
  129. package/dist/src/Radio.d.ts.map +1 -1
  130. package/dist/src/RadioGroup.d.ts +8 -3
  131. package/dist/src/RadioGroup.d.ts.map +1 -1
  132. package/dist/src/SearchField.d.ts +58 -2
  133. package/dist/src/SearchField.d.ts.map +1 -1
  134. package/dist/src/Select.d.ts +60 -2
  135. package/dist/src/Select.d.ts.map +1 -1
  136. package/dist/src/SeleniumProps.d.ts +20 -0
  137. package/dist/src/SeleniumProps.d.ts.map +1 -0
  138. package/dist/src/Status.d.ts +3 -2
  139. package/dist/src/Status.d.ts.map +1 -1
  140. package/dist/src/Tabs.d.ts +9 -3
  141. package/dist/src/Tabs.d.ts.map +1 -1
  142. package/dist/src/Tag.d.ts +3 -2
  143. package/dist/src/Tag.d.ts.map +1 -1
  144. package/dist/src/TagList.d.ts +3 -2
  145. package/dist/src/TagList.d.ts.map +1 -1
  146. package/dist/src/TextField.d.ts +86 -2
  147. package/dist/src/TextField.d.ts.map +1 -1
  148. package/dist/src/Toast.d.ts +3 -2
  149. package/dist/src/Toast.d.ts.map +1 -1
  150. package/dist/src/Tooltip.d.ts +3 -2
  151. package/dist/src/Tooltip.d.ts.map +1 -1
  152. package/dist/src/Typography.d.ts +14 -45
  153. package/dist/src/Typography.d.ts.map +1 -1
  154. package/dist/src/labs/DatePicker.d.ts +5 -1
  155. package/dist/src/labs/DatePicker.d.ts.map +1 -1
  156. package/dist/src/labs/PaginatedTable.d.ts.map +1 -1
  157. package/dist/src/labs/StaticTable.d.ts.map +1 -1
  158. package/dist/src/theme/components.d.ts.map +1 -1
  159. package/dist/theme/components.js +38 -10
  160. package/dist/theme/components.js.map +1 -1
  161. package/dist/tsconfig.production.tsbuildinfo +1 -1
  162. package/package.json +6 -5
  163. package/src/Autocomplete.tsx +13 -2
  164. package/src/Banner.tsx +11 -2
  165. package/src/Box.tsx +11 -5
  166. package/src/Button.tsx +6 -1
  167. package/src/Callout.tsx +5 -3
  168. package/src/Checkbox.tsx +14 -4
  169. package/src/CheckboxGroup.tsx +6 -10
  170. package/src/CircularProgress.tsx +5 -1
  171. package/src/Dialog.tsx +5 -2
  172. package/src/Field.tsx +2 -0
  173. package/src/FieldError.tsx +5 -3
  174. package/src/FieldHint.tsx +9 -3
  175. package/src/FieldLabel.tsx +5 -3
  176. package/src/Fieldset.tsx +4 -1
  177. package/src/Form.tsx +7 -4
  178. package/src/Link.tsx +18 -3
  179. package/src/MenuButton.tsx +33 -4
  180. package/src/MenuItem.tsx +11 -6
  181. package/src/NativeSelect.tsx +7 -2
  182. package/src/OdysseyI18n.ts +2 -0
  183. package/src/OdysseyProvider.tsx +9 -6
  184. package/src/OdysseyThemeProvider.tsx +4 -6
  185. package/src/OdysseyTranslationProvider.types.ts +1 -0
  186. package/src/PasswordField.tsx +18 -10
  187. package/src/Radio.tsx +5 -1
  188. package/src/RadioGroup.tsx +12 -4
  189. package/src/SearchField.tsx +23 -15
  190. package/src/Select.tsx +16 -6
  191. package/src/SeleniumProps.ts +20 -0
  192. package/src/Status.tsx +15 -3
  193. package/src/Tabs.tsx +18 -4
  194. package/src/Tag.tsx +12 -3
  195. package/src/TagList.tsx +4 -2
  196. package/src/TextField.tsx +14 -2
  197. package/src/Toast.tsx +4 -1
  198. package/src/Tooltip.tsx +4 -1
  199. package/src/Typography.tsx +76 -28
  200. package/src/labs/DatePicker.tsx +15 -7
  201. package/src/labs/PaginatedTable.tsx +12 -3
  202. package/src/labs/README.md +2 -2
  203. package/src/labs/StaticTable.tsx +13 -3
  204. package/src/theme/components.tsx +43 -9
@@ -1,5 +1,6 @@
1
1
  import _InputBase from "@mui/material/InputBase";
2
2
  import _InputAdornment from "@mui/material/InputAdornment";
3
+ import _IconButton from "@mui/material/IconButton";
3
4
  /*!
4
5
  * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.
5
6
  * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
@@ -13,7 +14,6 @@ import _InputAdornment from "@mui/material/InputAdornment";
13
14
  */
14
15
  import { forwardRef, memo, useCallback, useState } from "react";
15
16
  import { ShowIcon, HideIcon } from "./icons.generated/index.js";
16
- import { Button } from "./Button.js";
17
17
  import { Field } from "./Field.js";
18
18
  import { jsx as _jsx } from "react/jsx-runtime";
19
19
  const PasswordField = forwardRef((_ref, ref) => {
@@ -27,10 +27,12 @@ const PasswordField = forwardRef((_ref, ref) => {
27
27
  isOptional = false,
28
28
  isReadOnly,
29
29
  label,
30
+ name: nameOverride,
30
31
  onChange,
31
32
  onFocus,
32
33
  onBlur,
33
34
  placeholder,
35
+ testId,
34
36
  value
35
37
  } = _ref;
36
38
  const [inputType, setInputType] = useState("password");
@@ -46,18 +48,17 @@ const PasswordField = forwardRef((_ref, ref) => {
46
48
  "aria-describedby": ariaDescribedBy,
47
49
  autoComplete: autoCompleteType,
48
50
  autoFocus: hasInitialFocus,
51
+ "data-se": testId,
49
52
  endAdornment: _jsx(_InputAdornment, {
50
53
  position: "end",
51
- children: _jsx(Button, {
52
- ariaLabel: "toggle password visibility",
53
- endIcon: inputType === "password" ? _jsx(ShowIcon, {}) : _jsx(HideIcon, {}),
54
+ children: _jsx(_IconButton, {
55
+ "aria-label": "toggle password visibility",
54
56
  onClick: togglePasswordVisibility,
55
- size: "small",
56
- variant: "floating"
57
+ children: inputType === "password" ? _jsx(ShowIcon, {}) : _jsx(HideIcon, {})
57
58
  })
58
59
  }),
59
60
  id: id,
60
- name: id,
61
+ name: nameOverride ?? id,
61
62
  onChange: onChange,
62
63
  onFocus: onFocus,
63
64
  onBlur: onBlur,
@@ -68,7 +69,7 @@ const PasswordField = forwardRef((_ref, ref) => {
68
69
  type: inputType,
69
70
  value: value
70
71
  });
71
- }, [autoCompleteType, hasInitialFocus, togglePasswordVisibility, inputType, onChange, onFocus, onBlur, placeholder, isOptional, isReadOnly, ref, value]);
72
+ }, [autoCompleteType, hasInitialFocus, togglePasswordVisibility, inputType, nameOverride, onChange, onFocus, onBlur, placeholder, isOptional, isReadOnly, ref, testId, value]);
72
73
  return _jsx(Field, {
73
74
  errorMessage: errorMessage,
74
75
  fieldType: "single",
@@ -1 +1 @@
1
- {"version":3,"file":"PasswordField.js","names":["forwardRef","memo","useCallback","useState","ShowIcon","HideIcon","Button","Field","jsx","_jsx","PasswordField","_ref","ref","autoCompleteType","errorMessage","hasInitialFocus","hint","id","idOverride","isDisabled","isOptional","isReadOnly","label","onChange","onFocus","onBlur","placeholder","value","inputType","setInputType","togglePasswordVisibility","renderFieldComponent","_ref2","ariaDescribedBy","_InputBase","autoComplete","autoFocus","endAdornment","_InputAdornment","position","children","ariaLabel","endIcon","onClick","size","variant","name","readOnly","required","type","fieldType","hasVisibleLabel","MemoizedPasswordField","displayName"],"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 { ShowIcon, HideIcon } from \"./icons.generated\";\nimport { Button } from \"./Button\";\nimport { Field } from \"./Field\";\n\nexport type PasswordFieldProps = {\n /**\n * This prop helps users to fill forms faster, especially on mobile devices.\n * The name can be confusing, as it's more like an autofill.\n * You can learn more about it [following the specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill).\n */\n autoCompleteType?: \"current-password\" | \"new-password\";\n /**\n * If `error` is not undefined, the `input` will indicate an error.\n */\n errorMessage?: string;\n /**\n * If `true`, the component will receive focus automatically.\n */\n hasInitialFocus?: boolean;\n /**\n * The helper text content.\n */\n hint?: string;\n /**\n * The id of the `input` element.\n */\n id?: string;\n /**\n * If `true`, the component is disabled.\n */\n isDisabled?: boolean;\n /**\n * If `true`, the `input` element is not required.\n */\n isOptional?: boolean;\n /**\n * It prevents the user from changing the value of the field\n */\n isReadOnly?: boolean;\n /**\n * The label for the `input` element.\n */\n label: string;\n /**\n * Callback fired when the `input` element loses focus.\n */\n onBlur?: FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;\n /**\n * Callback fired when the value is changed.\n */\n onChange?: ChangeEventHandler<HTMLTextAreaElement | HTMLInputElement>;\n /**\n * Callback fired when the `input` element get focus.\n */\n onFocus?: FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;\n /**\n * The short hint displayed in the `input` before the user enters a value.\n */\n placeholder?: string;\n /**\n * The value of the `input` element, required for a controlled component.\n */\n value?: string;\n};\n\nconst PasswordField = forwardRef<HTMLInputElement, PasswordFieldProps>(\n (\n {\n autoCompleteType,\n errorMessage,\n hasInitialFocus,\n hint,\n id: idOverride,\n isDisabled = false,\n isOptional = false,\n isReadOnly,\n label,\n onChange,\n onFocus,\n onBlur,\n placeholder,\n value,\n },\n ref\n ) => {\n const [inputType, setInputType] = useState(\"password\");\n\n const togglePasswordVisibility = useCallback(() => {\n setInputType((inputType) =>\n inputType === \"password\" ? \"text\" : \"password\"\n );\n }, []);\n\n const renderFieldComponent = useCallback(\n ({ ariaDescribedBy, id }) => (\n <InputBase\n aria-describedby={ariaDescribedBy}\n autoComplete={autoCompleteType}\n /* eslint-disable-next-line jsx-a11y/no-autofocus */\n autoFocus={hasInitialFocus}\n endAdornment={\n <InputAdornment position=\"end\">\n <Button\n ariaLabel=\"toggle password visibility\"\n endIcon={inputType === \"password\" ? <ShowIcon /> : <HideIcon />}\n onClick={togglePasswordVisibility}\n size=\"small\"\n variant=\"floating\"\n />\n </InputAdornment>\n }\n id={id}\n name={id}\n onChange={onChange}\n onFocus={onFocus}\n onBlur={onBlur}\n placeholder={placeholder}\n readOnly={isReadOnly}\n ref={ref}\n required={!isOptional}\n type={inputType}\n value={value}\n />\n ),\n [\n autoCompleteType,\n hasInitialFocus,\n togglePasswordVisibility,\n inputType,\n onChange,\n onFocus,\n onBlur,\n placeholder,\n isOptional,\n isReadOnly,\n ref,\n value,\n ]\n );\n\n return (\n <Field\n errorMessage={errorMessage}\n fieldType=\"single\"\n hasVisibleLabel\n hint={hint}\n id={idOverride}\n isDisabled={isDisabled}\n isOptional={isOptional}\n label={label}\n renderFieldComponent={renderFieldComponent}\n />\n );\n }\n);\n\nconst MemoizedPasswordField = memo(PasswordField);\nMemoizedPasswordField.displayName = \"PasswordField\";\n\nexport { MemoizedPasswordField as PasswordField };\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,SAGEA,UAAU,EACVC,IAAI,EACJC,WAAW,EACXC,QAAQ,QACH,OAAO;AAAC,SAENC,QAAQ,EAAEC,QAAQ;AAAA,SAClBC,MAAM;AAAA,SACNC,KAAK;AAAA,SAAAC,GAAA,IAAAC,IAAA;AA+Dd,MAAMC,aAAa,GAAGV,UAAU,CAC9B,CAAAW,IAAA,EAiBEC,GAAG,KACA;EAAA,IAjBH;IACEC,gBAAgB;IAChBC,YAAY;IACZC,eAAe;IACfC,IAAI;IACJC,EAAE,EAAEC,UAAU;IACdC,UAAU,GAAG,KAAK;IAClBC,UAAU,GAAG,KAAK;IAClBC,UAAU;IACVC,KAAK;IACLC,QAAQ;IACRC,OAAO;IACPC,MAAM;IACNC,WAAW;IACXC;EACF,CAAC,GAAAhB,IAAA;EAGD,MAAM,CAACiB,SAAS,EAAEC,YAAY,CAAC,GAAG1B,QAAQ,CAAC,UAAU,CAAC;EAEtD,MAAM2B,wBAAwB,GAAG5B,WAAW,CAAC,MAAM;IACjD2B,YAAY,C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C3BoC,SAAS,EAAC,QAAQ;IAClBC,eAAe;IACfnC,IAAI,EAAEA,IAAK;IACXC,EAAE,EAAEC,UAAW;IACfC,UAAU,EAAEA,UAAW;IACvBC,UAAU,EAAEA,UAAW;IACvBE,KAAK,EAAEA,KAAM;IACbS,oBAAoB,EAAEA;EAAqB,CAC5C,CAAC;AAEN,CACF,CAAC;AAED,MAAMqB,qBAAqB,GAAGnD,IAAI,CAACS,aAAa,CAAC;AACjD0C,qBAAqB,CAACC,WAAW,GAAG,eAAe;AAEnD,SAASD,qBAAqB,IAAI1C,aAAa"}
1
+ {"version":3,"file":"PasswordField.js","names":["forwardRef","memo","useCallback","useState","ShowIcon","HideIcon","Field","jsx","_jsx","PasswordField","_ref","ref","autoCompleteType","errorMessage","hasInitialFocus","hint","id","idOverride","isDisabled","isOptional","isReadOnly","label","name","nameOverride","onChange","onFocus","onBlur","placeholder","testId","value","inputType","setInputType","togglePasswordVisibility","renderFieldComponent","_ref2","ariaDescribedBy","_InputBase","autoComplete","autoFocus","endAdornment","_InputAdornment","position","children","_IconButton","onClick","readOnly","required","type","fieldType","hasVisibleLabel","MemoizedPasswordField","displayName"],"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, IconButton } from \"@mui/material\";\nimport {\n ChangeEventHandler,\n FocusEventHandler,\n forwardRef,\n memo,\n useCallback,\n useState,\n} from \"react\";\n\nimport { ShowIcon, HideIcon } from \"./icons.generated\";\nimport { Field } from \"./Field\";\nimport type { SeleniumProps } from \"./SeleniumProps\";\n\nexport type PasswordFieldProps = {\n /**\n * This prop helps users to fill forms faster, especially on mobile devices.\n * The name can be confusing, as it's more like an autofill.\n * You can learn more about it [following the specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill).\n */\n autoCompleteType?: \"current-password\" | \"new-password\";\n /**\n * If `error` is not undefined, the `input` will indicate an error.\n */\n errorMessage?: string;\n /**\n * If `true`, the component will receive focus automatically.\n */\n hasInitialFocus?: boolean;\n /**\n * The helper text content.\n */\n hint?: string;\n /**\n * The id of the `input` element.\n */\n id?: string;\n /**\n * If `true`, the component is disabled.\n */\n isDisabled?: boolean;\n /**\n * If `true`, the `input` element is not required.\n */\n isOptional?: boolean;\n /**\n * It prevents the user from changing the value of the field\n */\n isReadOnly?: boolean;\n /**\n * The label for the `input` element.\n */\n label: string;\n /**\n * The name of the `input` element. Defaults to the `id` if not set.\n */\n name?: 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} & SeleniumProps;\n\nconst PasswordField = forwardRef<HTMLInputElement, PasswordFieldProps>(\n (\n {\n autoCompleteType,\n errorMessage,\n hasInitialFocus,\n hint,\n id: idOverride,\n isDisabled = false,\n isOptional = false,\n isReadOnly,\n label,\n name: nameOverride,\n onChange,\n onFocus,\n onBlur,\n placeholder,\n testId,\n value,\n },\n ref\n ) => {\n const [inputType, setInputType] = useState(\"password\");\n\n const togglePasswordVisibility = useCallback(() => {\n setInputType((inputType) =>\n inputType === \"password\" ? \"text\" : \"password\"\n );\n }, []);\n\n const renderFieldComponent = useCallback(\n ({ ariaDescribedBy, id }) => (\n <InputBase\n aria-describedby={ariaDescribedBy}\n autoComplete={autoCompleteType}\n /* eslint-disable-next-line jsx-a11y/no-autofocus */\n autoFocus={hasInitialFocus}\n data-se={testId}\n endAdornment={\n <InputAdornment position=\"end\">\n <IconButton\n aria-label=\"toggle password visibility\"\n onClick={togglePasswordVisibility}\n >\n {inputType === \"password\" ? <ShowIcon /> : <HideIcon />}\n </IconButton>\n </InputAdornment>\n }\n id={id}\n name={nameOverride ?? id}\n onChange={onChange}\n onFocus={onFocus}\n onBlur={onBlur}\n placeholder={placeholder}\n readOnly={isReadOnly}\n ref={ref}\n required={!isOptional}\n type={inputType}\n value={value}\n />\n ),\n [\n autoCompleteType,\n hasInitialFocus,\n togglePasswordVisibility,\n inputType,\n nameOverride,\n onChange,\n onFocus,\n onBlur,\n placeholder,\n isOptional,\n isReadOnly,\n ref,\n testId,\n value,\n ]\n );\n\n return (\n <Field\n errorMessage={errorMessage}\n fieldType=\"single\"\n hasVisibleLabel\n hint={hint}\n id={idOverride}\n isDisabled={isDisabled}\n isOptional={isOptional}\n label={label}\n renderFieldComponent={renderFieldComponent}\n />\n );\n }\n);\n\nconst MemoizedPasswordField = memo(PasswordField);\nMemoizedPasswordField.displayName = \"PasswordField\";\n\nexport { MemoizedPasswordField as PasswordField };\n"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,SAGEA,UAAU,EACVC,IAAI,EACJC,WAAW,EACXC,QAAQ,QACH,OAAO;AAAC,SAENC,QAAQ,EAAEC,QAAQ;AAAA,SAClBC,KAAK;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAoEd,MAAMC,aAAa,GAAGT,UAAU,CAC9B,CAAAU,IAAA,EAmBEC,GAAG,KACA;EAAA,IAnBH;IACEC,gBAAgB;IAChBC,YAAY;IACZC,eAAe;IACfC,IAAI;IACJC,EAAE,EAAEC,UAAU;IACdC,UAAU,G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AW;MACtB4B,IAAI,EAAEjB,SAAU;MAChBD,KAAK,EAAEA;IAAM,CACd,CAAC;EAAA,CACH,EACD,CACEjB,gBAAgB,EAChBE,eAAe,EACfkB,wBAAwB,EACxBF,SAAS,EACTP,YAAY,EACZC,QAAQ,EACRC,OAAO,EACPC,MAAM,EACNC,WAAW,EACXR,UAAU,EACVC,UAAU,EACVT,GAAG,EACHiB,MAAM,EACNC,KAAK,CAET,CAAC;EAED,OACErB,IAAA,CAACF,KAAK;IACJO,YAAY,EAAEA,YAAa;IAC3BmC,SAAS,EAAC,QAAQ;IAClBC,eAAe;IACflC,IAAI,EAAEA,IAAK;IACXC,EAAE,EAAEC,UAAW;IACfC,UAAU,EAAEA,UAAW;IACvBC,UAAU,EAAEA,UAAW;IACvBE,KAAK,EAAEA,KAAM;IACbY,oBAAoB,EAAEA;EAAqB,CAC5C,CAAC;AAEN,CACF,CAAC;AAED,MAAMiB,qBAAqB,GAAGjD,IAAI,CAACQ,aAAa,CAAC;AACjDyC,qBAAqB,CAACC,WAAW,GAAG,eAAe;AAEnD,SAASD,qBAAqB,IAAIzC,aAAa"}
package/dist/Radio.js CHANGED
@@ -20,12 +20,14 @@ const Radio = _ref => {
20
20
  isInvalid,
21
21
  label,
22
22
  name,
23
+ testId,
23
24
  value
24
25
  } = _ref;
25
26
  return _jsx(_FormControlLabel, {
26
27
  checked: isChecked,
27
28
  className: isInvalid ? "Mui-error" : "",
28
29
  control: _jsx(_Radio, {}),
30
+ "data-se": testId,
29
31
  disabled: isDisabled,
30
32
  label: label,
31
33
  name: name,
package/dist/Radio.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Radio.js","names":["memo","jsx","_jsx","Radio","_ref","isChecked","isDisabled","isInvalid","label","name","value","_FormControlLabel","checked","className","control","_Radio","disabled","MemoizedRadio","displayName"],"sources":["../src/Radio.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 { Radio as MuiRadio } from \"@mui/material\";\nimport { memo } from \"react\";\n\nimport { FormControlLabel } from \"@mui/material\";\n\nexport type RadioProps = {\n /**\n * If `true`, the Radio is selected\n */\n isChecked?: boolean;\n /**\n * If `true`, the Radio is disabled\n */\n isDisabled?: boolean;\n /**\n * If `true`, the Radio has an invalid value\n */\n isInvalid?: boolean;\n /**\n * The label text for the Radio\n */\n label: string;\n /**\n * The name attribute of the Radio\n */\n name?: string;\n /**\n * The value attribute of the Radio\n */\n value: string;\n};\n\nconst Radio = ({\n isChecked,\n isDisabled,\n isInvalid,\n label,\n name,\n value,\n}: RadioProps) => (\n <FormControlLabel\n checked={isChecked}\n className={isInvalid ? \"Mui-error\" : \"\"}\n control={<MuiRadio />}\n disabled={isDisabled}\n label={label}\n name={name}\n value={value}\n />\n);\n\nconst MemoizedRadio = memo(Radio);\nMemoizedRadio.displayName = \"Radio\";\n\nexport { MemoizedRadio as Radio };\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,SAASA,IAAI,QAAQ,OAAO;AAAC,SAAAC,GAAA,IAAAC,IAAA;AA+B7B,MAAMC,KAAK,GAAGC,IAAA;EAAA,IAAC;IACbC,SAAS;IACTC,UAAU;IACVC,SAAS;IACTC,KAAK;IACLC,IAAI;IACJC;EACU,CAAC,GAAAN,IAAA;EAAA,OACXF,IAAA,CAAAS,iBAAA;IACEC,OAAO,EAAEP,SAAU;IACnBQ,SAAS,EAAEN,SAAS,GAAG,WAAW,GAAG,EAAG;IACxCO,OAAO,EAAEZ,IAAA,CAAAa,MAAA,IAAW,CAAE;IACtBC,QAAQ,EAAEV,UAAW;IACrBE,KAAK,EAAEA,KAAM;IACbC,IAAI,EAAEA,IAAK;IACXC,KAAK,EAAEA;EAAM,CACd,CAAC;AAAA,CACH;AAED,MAAMO,aAAa,GAAGjB,IAAI,CAACG,KAAK,CAAC;AACjCc,aAAa,CAACC,WAAW,GAAG,OAAO;AAEnC,SAASD,aAAa,IAAId,KAAK"}
1
+ {"version":3,"file":"Radio.js","names":["memo","jsx","_jsx","Radio","_ref","isChecked","isDisabled","isInvalid","label","name","testId","value","_FormControlLabel","checked","className","control","_Radio","disabled","MemoizedRadio","displayName"],"sources":["../src/Radio.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 { Radio as MuiRadio } from \"@mui/material\";\nimport { memo } from \"react\";\n\nimport { FormControlLabel } from \"@mui/material\";\n\nimport type { SeleniumProps } from \"./SeleniumProps\";\n\nexport type RadioProps = {\n /**\n * If `true`, the Radio is selected\n */\n isChecked?: boolean;\n /**\n * If `true`, the Radio is disabled\n */\n isDisabled?: boolean;\n /**\n * If `true`, the Radio has an invalid value\n */\n isInvalid?: boolean;\n /**\n * The label text for the Radio\n */\n label: string;\n /**\n * The name attribute of the Radio\n */\n name?: string;\n /**\n * The value attribute of the Radio\n */\n value: string;\n} & SeleniumProps;\n\nconst Radio = ({\n isChecked,\n isDisabled,\n isInvalid,\n label,\n name,\n testId,\n value,\n}: RadioProps) => (\n <FormControlLabel\n checked={isChecked}\n className={isInvalid ? \"Mui-error\" : \"\"}\n control={<MuiRadio />}\n data-se={testId}\n disabled={isDisabled}\n label={label}\n name={name}\n value={value}\n />\n);\n\nconst MemoizedRadio = memo(Radio);\nMemoizedRadio.displayName = \"Radio\";\n\nexport { MemoizedRadio as Radio };\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,SAASA,IAAI,QAAQ,OAAO;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAiC7B,MAAMC,KAAK,GAAGC,IAAA;EAAA,IAAC;IACbC,SAAS;IACTC,UAAU;IACVC,SAAS;IACTC,KAAK;IACLC,IAAI;IACJC,MAAM;IACNC;EACU,CAAC,GAAAP,IAAA;EAAA,OACXF,IAAA,CAAAU,iBAAA;IACEC,OAAO,EAAER,SAAU;IACnBS,SAAS,EAAEP,SAAS,GAAG,WAAW,GAAG,EAAG;IACxCQ,OAAO,EAAEb,IAAA,CAAAc,MAAA,IAAW,CAAE;IACtB,WAASN,MAAO;IAChBO,QAAQ,EAAEX,UAAW;IACrBE,KAAK,EAAEA,KAAM;IACbC,IAAI,EAAEA,IAAK;IACXE,KAAK,EAAEA;EAAM,CACd,CAAC;AAAA,CACH;AAED,MAAMO,aAAa,GAAGlB,IAAI,CAACG,KAAK,CAAC;AACjCe,aAAa,CAACC,WAAW,GAAG,OAAO;AAEnC,SAASD,aAAa,IAAIf,KAAK"}
@@ -22,7 +22,9 @@ const RadioGroup = _ref => {
22
22
  id: idOverride,
23
23
  isDisabled,
24
24
  label,
25
+ name: nameOverride,
25
26
  onChange,
27
+ testId,
26
28
  value
27
29
  } = _ref;
28
30
  const renderFieldComponent = useCallback(_ref2 => {
@@ -32,14 +34,15 @@ const RadioGroup = _ref => {
32
34
  } = _ref2;
33
35
  return _jsx(_RadioGroup, {
34
36
  "aria-describedby": ariaDescribedBy,
37
+ "data-se": testId,
35
38
  defaultValue: defaultValue,
36
39
  id: id,
37
- name: id,
40
+ name: nameOverride ?? id,
38
41
  onChange: onChange,
39
42
  value: value,
40
43
  children: children
41
44
  });
42
- }, [children, defaultValue, onChange, value]);
45
+ }, [children, defaultValue, nameOverride, onChange, testId, value]);
43
46
  return _jsx(Field, {
44
47
  errorMessage: errorMessage,
45
48
  fieldType: "group",
@@ -1 +1 @@
1
- {"version":3,"file":"RadioGroup.js","names":["memo","useCallback","Field","jsx","_jsx","RadioGroup","_ref","children","defaultValue","errorMessage","hint","id","idOverride","isDisabled","label","onChange","value","renderFieldComponent","_ref2","ariaDescribedBy","_RadioGroup","name","fieldType","hasVisibleLabel","MemoizedRadioGroup","displayName"],"sources":["../src/RadioGroup.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { RadioGroup as MuiRadioGroup } from \"@mui/material\";\nimport { ChangeEventHandler, memo, ReactElement, useCallback } from \"react\";\n\nimport { Radio, RadioProps } from \"./Radio\";\nimport { Field } from \"./Field\";\n\nexport type RadioGroupProps = {\n /**\n * The Radio components within the group. Must include two or more.\n */\n children: Array<ReactElement<typeof Radio>>;\n /**\n * The text value of the Radio that should be selected by default\n */\n defaultValue?: string;\n /**\n * The error text for an invalid RadioGroup\n */\n errorMessage?: string;\n /**\n * Optional hint text\n */\n hint?: string;\n /**\n * The id of the `input` element. This will also be the input's `name` field.\n */\n id?: string;\n /**\n * Disables the whole RadioGroup\n */\n isDisabled?: boolean;\n /**\n * The text label for the RadioGroup\n */\n label: string;\n /**\n * Listen for changes in the browser that change `value`\n */\n onChange?: ChangeEventHandler<EventTarget>;\n /**\n * The `value` on the selected Radio\n */\n value?: RadioProps[\"value\"];\n};\n\nconst RadioGroup = ({\n children,\n defaultValue,\n errorMessage,\n hint,\n id: idOverride,\n isDisabled,\n label,\n onChange,\n value,\n}: RadioGroupProps) => {\n const renderFieldComponent = useCallback(\n ({ ariaDescribedBy, id }) => (\n <MuiRadioGroup\n aria-describedby={ariaDescribedBy}\n defaultValue={defaultValue}\n id={id}\n name={id}\n onChange={onChange}\n value={value}\n >\n {children}\n </MuiRadioGroup>\n ),\n [children, defaultValue, onChange, value]\n );\n\n return (\n <Field\n errorMessage={errorMessage}\n fieldType=\"group\"\n hasVisibleLabel={false}\n hint={hint}\n id={idOverride}\n isDisabled={isDisabled}\n label={label}\n renderFieldComponent={renderFieldComponent}\n />\n );\n};\n\nconst MemoizedRadioGroup = memo(RadioGroup);\nMemoizedRadioGroup.displayName = \"RadioGroup\";\n\nexport { MemoizedRadioGroup as RadioGroup };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,SAA6BA,IAAI,EAAgBC,WAAW,QAAQ,OAAO;AAAC,SAGnEC,KAAK;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAyCd,MAAMC,UAAU,GAAGC,IAAA,IAUI;EAAA,IAVH;IAClBC,QAAQ;IACRC,YAAY;IACZC,YAAY;IACZC,IAAI;IACJC,EAAE,EAAEC,UAAU;IACdC,UAAU;IACVC,KAAK;IACLC,QAAQ;IACRC;EACe,CAAC,GAAAV,IAAA;EAChB,MAAMW,oBAAoB,GAAGhB,WAAW,CACtCiB,KAAA;IAAA,IAAC;MAAEC,eAAe;MAAER;IAAG,CAAC,GAAAO,KAAA;IAAA,OACtBd,IAAA,CAAAgB,WAAA;MACE,oBAAkBD,eAAgB;MAClCX,YAAY,EAAEA,YAAa;MAC3BG,EAAE,EAAEA,EAAG;MACPU,IAAI,EAAEV,EAAG;MACTI,QAAQ,EAAEA,QAAS;MACnBC,KAAK,EAAEA,KAAM;MAAAT,QAAA,EAEZA;IAAQ,CACI,CAAC;EAAA,CACjB,EACD,CAACA,QAAQ,EAAEC,YAAY,EAAEO,QAAQ,EAAEC,KAAK,CAC1C,CAAC;EAED,OACEZ,IAAA,CAACF,KAAK;IACJO,YAAY,EAAEA,YAAa;IAC3Ba,SAAS,EAAC,OAAO;IACjBC,eAAe,EAAE,KAAM;IACvBb,IAAI,EAAEA,IAAK;IACXC,EAAE,EAAEC,UAAW;IACfC,UAAU,EAAEA,UAAW;IACvBC,KAAK,EAAEA,KAAM;IACbG,oBAAoB,EAAEA;EAAqB,CAC5C,CAAC;AAEN,CAAC;AAED,MAAMO,kBAAkB,GAAGxB,IAAI,CAACK,UAAU,CAAC;AAC3CmB,kBAAkB,CAACC,WAAW,GAAG,YAAY;AAE7C,SAASD,kBAAkB,IAAInB,UAAU"}
1
+ {"version":3,"file":"RadioGroup.js","names":["memo","useCallback","Field","jsx","_jsx","RadioGroup","_ref","children","defaultValue","errorMessage","hint","id","idOverride","isDisabled","label","name","nameOverride","onChange","testId","value","renderFieldComponent","_ref2","ariaDescribedBy","_RadioGroup","fieldType","hasVisibleLabel","MemoizedRadioGroup","displayName"],"sources":["../src/RadioGroup.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { RadioGroup as MuiRadioGroup } from \"@mui/material\";\nimport { ChangeEventHandler, memo, ReactElement, useCallback } from \"react\";\n\nimport { Radio, RadioProps } from \"./Radio\";\nimport { Field } from \"./Field\";\nimport type { SeleniumProps } from \"./SeleniumProps\";\n\nexport type RadioGroupProps = {\n /**\n * The Radio components within the group. Must include two or more.\n */\n children: Array<ReactElement<typeof Radio>>;\n /**\n * The text value of the Radio that should be selected by default\n */\n defaultValue?: string;\n /**\n * The error text for an invalid RadioGroup\n */\n errorMessage?: string;\n /**\n * Optional hint text\n */\n hint?: string;\n /**\n * The id of the `input` element.\n */\n id?: string;\n /**\n * Disables the whole RadioGroup\n */\n isDisabled?: boolean;\n /**\n * The text label for the RadioGroup\n */\n label: string;\n /**\n * The name of the `input` element. Defaults to the `id` if not set.\n */\n name?: string;\n /**\n * Listen for changes in the browser that change `value`\n */\n onChange?: ChangeEventHandler<EventTarget>;\n /**\n * The `value` on the selected Radio\n */\n value?: RadioProps[\"value\"];\n} & SeleniumProps;\n\nconst RadioGroup = ({\n children,\n defaultValue,\n errorMessage,\n hint,\n id: idOverride,\n isDisabled,\n label,\n name: nameOverride,\n onChange,\n testId,\n value,\n}: RadioGroupProps) => {\n const renderFieldComponent = useCallback(\n ({ ariaDescribedBy, id }) => (\n <MuiRadioGroup\n aria-describedby={ariaDescribedBy}\n data-se={testId}\n defaultValue={defaultValue}\n id={id}\n name={nameOverride ?? id}\n onChange={onChange}\n value={value}\n >\n {children}\n </MuiRadioGroup>\n ),\n [children, defaultValue, nameOverride, onChange, testId, value]\n );\n\n return (\n <Field\n errorMessage={errorMessage}\n fieldType=\"group\"\n hasVisibleLabel={false}\n hint={hint}\n id={idOverride}\n isDisabled={isDisabled}\n label={label}\n renderFieldComponent={renderFieldComponent}\n />\n );\n};\n\nconst MemoizedRadioGroup = memo(RadioGroup);\nMemoizedRadioGroup.displayName = \"RadioGroup\";\n\nexport { MemoizedRadioGroup as RadioGroup };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,SAA6BA,IAAI,EAAgBC,WAAW,QAAQ,OAAO;AAAC,SAGnEC,KAAK;AAAA,SAAAC,GAAA,IAAAC,IAAA;AA8Cd,MAAMC,UAAU,GAAGC,IAAA,IAYI;EAAA,IAZH;IAClBC,QAAQ;IACRC,YAAY;IACZC,YAAY;IACZC,IAAI;IACJC,EAAE,EAAEC,UAAU;IACdC,UAAU;IACVC,KAAK;IACLC,IAAI,EAAEC,YAAY;IAClBC,QAAQ;IACRC,MAAM;IACNC;EACe,CAAC,GAAAb,IAAA;EAChB,MAAMc,oBAAoB,GAAGnB,WAAW,CACtCoB,KAAA;IAAA,IAAC;MAAEC,eAAe;MAAEX;IAAG,CAAC,GAAAU,KAAA;IAAA,OACtBjB,IAAA,CAAAmB,WAAA;MACE,oBAAkBD,eAAgB;MAClC,WAASJ,MAAO;MAChBV,YAAY,EAAEA,YAAa;MAC3BG,EAAE,EAAEA,EAAG;MACPI,IAAI,EAAEC,YAAY,IAAIL,EAAG;MACzBM,QAAQ,EAAEA,QAAS;MACnBE,KAAK,EAAEA,KAAM;MAAAZ,QAAA,EAEZA;IAAQ,CACI,CAAC;EAAA,CACjB,EACD,CAACA,QAAQ,EAAEC,YAAY,EAAEQ,YAAY,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,KAAK,CAChE,CAAC;EAED,OACEf,IAAA,CAACF,KAAK;IACJO,YAAY,EAAEA,YAAa;IAC3Be,SAAS,EAAC,OAAO;IACjBC,eAAe,EAAE,KAAM;IACvBf,IAAI,EAAEA,IAAK;IACXC,EAAE,EAAEC,UAAW;IACfC,UAAU,EAAEA,UAAW;IACvBC,KAAK,EAAEA,KAAM;IACbM,oBAAoB,EAAEA;EAAqB,CAC5C,CAAC;AAEN,CAAC;AAED,MAAMM,kBAAkB,GAAG1B,IAAI,CAACK,UAAU,CAAC;AAC3CqB,kBAAkB,CAACC,WAAW,GAAG,YAAY;AAE7C,SAASD,kBAAkB,IAAIrB,UAAU"}
@@ -1,5 +1,6 @@
1
1
  import _InputBase from "@mui/material/InputBase";
2
2
  import _InputAdornment from "@mui/material/InputAdornment";
3
+ import _IconButton from "@mui/material/IconButton";
3
4
  /*!
4
5
  * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.
5
6
  * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
@@ -16,7 +17,6 @@ import { useState, useEffect } from "react";
16
17
  import { forwardRef, memo, useCallback } from "react";
17
18
  import { CloseCircleFilledIcon, SearchIcon } from "./icons.generated/index.js";
18
19
  import { Field } from "./Field.js";
19
- import { Button } from "./Button.js";
20
20
  import { jsx as _jsx } from "react/jsx-runtime";
21
21
  const SearchField = forwardRef((_ref, ref) => {
22
22
  let {
@@ -25,11 +25,13 @@ const SearchField = forwardRef((_ref, ref) => {
25
25
  id: idOverride,
26
26
  isDisabled = false,
27
27
  label,
28
+ name: nameOverride,
28
29
  onChange: onChangeProp,
29
30
  onFocus,
30
31
  onBlur,
31
32
  onClear: onClearProp,
32
33
  placeholder,
34
+ testId,
33
35
  value: controlledValue
34
36
  } = _ref;
35
37
  const [uncontrolledValue, setUncontrolledValue] = useState("");
@@ -55,23 +57,22 @@ const SearchField = forwardRef((_ref, ref) => {
55
57
  "aria-describedby": ariaDescribedBy,
56
58
  autoComplete: autoCompleteType,
57
59
  autoFocus: hasInitialFocus,
60
+ "data-se": testId,
58
61
  endAdornment: uncontrolledValue && _jsx(_InputAdornment, {
59
62
  position: "end",
60
- children: _jsx(Button, {
61
- ariaLabel: "Clear",
62
- isDisabled: isDisabled,
63
- label: "",
63
+ children: _jsx(_IconButton, {
64
+ "aria-label": "Clear",
65
+ disabled: isDisabled,
64
66
  onClick: onClear,
65
67
  size: "small",
66
- startIcon: _jsx(CloseCircleFilledIcon, {}),
67
- variant: "floating"
68
+ children: _jsx(CloseCircleFilledIcon, {})
68
69
  })
69
70
  }),
70
71
  id: id,
71
- name: id,
72
+ name: nameOverride ?? id,
73
+ onBlur: onBlur,
72
74
  onChange: onChange,
73
75
  onFocus: onFocus,
74
- onBlur: onBlur,
75
76
  placeholder: placeholder,
76
77
  ref: ref,
77
78
  startAdornment: _jsx(_InputAdornment, {
@@ -81,7 +82,7 @@ const SearchField = forwardRef((_ref, ref) => {
81
82
  type: "search",
82
83
  value: controlledValue === undefined ? uncontrolledValue : controlledValue
83
84
  });
84
- }, [autoCompleteType, hasInitialFocus, isDisabled, onClear, onChange, onFocus, onBlur, placeholder, ref, controlledValue, uncontrolledValue]);
85
+ }, [autoCompleteType, controlledValue, hasInitialFocus, isDisabled, nameOverride, onBlur, onChange, onClear, onFocus, placeholder, ref, testId, uncontrolledValue]);
85
86
  return _jsx(Field, {
86
87
  fieldType: "single",
87
88
  hasVisibleLabel: false,
@@ -1 +1 @@
1
- {"version":3,"file":"SearchField.js","names":["useState","useEffect","forwardRef","memo","useCallback","CloseCircleFilledIcon","SearchIcon","Field","Button","jsx","_jsx","SearchField","_ref","ref","autoCompleteType","hasInitialFocus","id","idOverride","isDisabled","label","onChange","onChangeProp","onFocus","onBlur","onClear","onClearProp","placeholder","value","controlledValue","uncontrolledValue","setUncontrolledValue","event","currentTarget","undefined","renderFieldComponent","_ref2","ariaDescribedBy","_InputBase","autoComplete","autoFocus","endAdornment","_InputAdornment","position","children","ariaLabel","onClick","size","startIcon","variant","name","startAdornment","type","fieldType","hasVisibleLabel","isOptional","MemoizedSearchField","displayName"],"sources":["../src/SearchField.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { useState, useEffect } from \"react\";\nimport { InputAdornment, InputBase } from \"@mui/material\";\nimport {\n ChangeEventHandler,\n FocusEventHandler,\n forwardRef,\n InputHTMLAttributes,\n memo,\n useCallback,\n} from \"react\";\n\nimport { CloseCircleFilledIcon, SearchIcon } from \"./icons.generated\";\nimport { Field } from \"./Field\";\nimport { Button } from \"./Button\";\n\nexport type SearchFieldProps = {\n /**\n * This prop helps users to fill forms faster, especially on mobile devices.\n * The name can be confusing, as it's more like an autofill.\n * You can learn more about it [following the specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill).\n */\n autoCompleteType?: InputHTMLAttributes<HTMLInputElement>[\"autoComplete\"];\n /**\n * If `true`, the component will receive focus automatically.\n */\n hasInitialFocus?: boolean;\n /**\n * The id of the `input` element.\n */\n id?: string;\n /**\n * If `true`, the component is disabled.\n */\n isDisabled?: boolean;\n /**\n * This label won't show up visually, but it's required for accessibility.\n */\n label: string;\n /**\n * Callback fired when the `input` element loses focus.\n */\n onBlur?: FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;\n /**\n * Callback fired when the clear button is pressed.\n */\n onClear?: () => void;\n /**\n * Callback fired when the value is changed.\n */\n onChange?: ChangeEventHandler<HTMLTextAreaElement | HTMLInputElement>;\n /**\n * Callback fired when the `input` element get focus.\n */\n onFocus?: FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;\n /**\n * The short hint displayed in the `input` before the user enters a value.\n */\n placeholder?: string;\n /**\n * The value of the `input` element, required for a controlled component.\n */\n value?: string;\n};\n\nconst SearchField = forwardRef<HTMLInputElement, SearchFieldProps>(\n (\n {\n autoCompleteType,\n hasInitialFocus,\n id: idOverride,\n isDisabled = false,\n label,\n onChange: onChangeProp,\n onFocus,\n onBlur,\n onClear: onClearProp,\n placeholder,\n value: controlledValue,\n },\n ref\n ) => {\n const [uncontrolledValue, setUncontrolledValue] = useState(\"\");\n\n const onChange: ChangeEventHandler<HTMLTextAreaElement | HTMLInputElement> =\n useCallback(\n (event) => {\n setUncontrolledValue(event.currentTarget.value);\n onChangeProp?.(event);\n },\n [onChangeProp]\n );\n\n const onClear = useCallback(() => {\n setUncontrolledValue(\"\");\n onClearProp?.();\n }, [onClearProp]);\n\n useEffect(() => {\n if (controlledValue !== undefined) {\n setUncontrolledValue(controlledValue);\n }\n }, [controlledValue]);\n\n const renderFieldComponent = useCallback(\n ({ ariaDescribedBy, id }) => (\n <InputBase\n aria-describedby={ariaDescribedBy}\n autoComplete={autoCompleteType}\n /* eslint-disable-next-line jsx-a11y/no-autofocus */\n autoFocus={hasInitialFocus}\n endAdornment={\n uncontrolledValue && (\n <InputAdornment position=\"end\">\n <Button\n ariaLabel=\"Clear\"\n isDisabled={isDisabled}\n label=\"\"\n onClick={onClear}\n size=\"small\"\n startIcon={<CloseCircleFilledIcon />}\n variant=\"floating\"\n />\n </InputAdornment>\n )\n }\n id={id}\n name={id}\n onChange={onChange}\n onFocus={onFocus}\n onBlur={onBlur}\n placeholder={placeholder}\n ref={ref}\n startAdornment={\n <InputAdornment position=\"start\">\n <SearchIcon />\n </InputAdornment>\n }\n type=\"search\"\n value={\n controlledValue === undefined ? uncontrolledValue : controlledValue\n }\n />\n ),\n [\n autoCompleteType,\n hasInitialFocus,\n isDisabled,\n onClear,\n onChange,\n onFocus,\n onBlur,\n placeholder,\n ref,\n controlledValue,\n uncontrolledValue,\n ]\n );\n\n return (\n <Field\n fieldType=\"single\"\n hasVisibleLabel={false}\n id={idOverride}\n isDisabled={isDisabled}\n isOptional={true}\n label={label}\n renderFieldComponent={renderFieldComponent}\n />\n );\n }\n);\n\nconst MemoizedSearchField = memo(SearchField);\nMemoizedSearchField.displayName = \"SearchField\";\n\nexport { MemoizedSearchField as SearchField };\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAE3C,SAGEC,UAAU,EAEVC,IAAI,EACJC,WAAW,QACN,OAAO;AAAC,SAENC,qBAAqB,EAAEC,UAAU;AAAA,SACjCC,KAAK;AAAA,SACLC,MAAM;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAmDf,MAAMC,WAAW,GAAGT,UAAU,CAC5B,CAAAU,IAAA,EAcEC,GAAG,KACA;EAAA,IAdH;IACEC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ErB,OAAQ;UACjBsB,IAAI,EAAC,OAAO;UACZC,SAAS,EAAErC,IAAA,CAACL,qBAAqB,IAAE,CAAE;UACrC2C,OAAO,EAAC;QAAU,CACnB;MAAC,CACY,CAEnB;MACDhC,EAAE,EAAEA,EAAG;MACPiC,IAAI,EAAEjC,EAAG;MACTI,QAAQ,EAAEA,QAAS;MACnBE,OAAO,EAAEA,OAAQ;MACjBC,MAAM,EAAEA,MAAO;MACfG,WAAW,EAAEA,WAAY;MACzBb,GAAG,EAAEA,GAAI;MACTqC,cAAc,EACZxC,IAAA,CAAA+B,eAAA;QAAgBC,QAAQ,EAAC,OAAO;QAAAC,QAAA,EAC9BjC,IAAA,CAACJ,UAAU,IAAE;MAAC,CACA,CACjB;MACD6C,IAAI,EAAC,QAAQ;MACbxB,KAAK,EACHC,eAAe,KAAKK,SAAS,GAAGJ,iBAAiB,GAAGD;IACrD,CACF,CAAC;EAAA,CACH,EACD,CACEd,gBAAgB,EAChBC,eAAe,EACfG,UAAU,EACVM,OAAO,EACPJ,QAAQ,EACRE,OAAO,EACPC,MAAM,EACNG,WAAW,EACXb,GAAG,EACHe,eAAe,EACfC,iBAAiB,CAErB,CAAC;EAED,OACEnB,IAAA,CAACH,KAAK;IACJ6C,SAAS,EAAC,QAAQ;IAClBC,eAAe,EAAE,KAAM;IACvBrC,EAAE,EAAEC,UAAW;IACfC,UAAU,EAAEA,UAAW;IACvBoC,UAAU,EAAE,IAAK;IACjBnC,KAAK,EAAEA,KAAM;IACbe,oBAAoB,EAAEA;EAAqB,CAC5C,CAAC;AAEN,CACF,CAAC;AAED,MAAMqB,mBAAmB,GAAGpD,IAAI,CAACQ,WAAW,CAAC;AAC7C4C,mBAAmB,CAACC,WAAW,GAAG,aAAa;AAE/C,SAASD,mBAAmB,IAAI5C,WAAW"}
1
+ {"version":3,"file":"SearchField.js","names":["useState","useEffect","forwardRef","memo","useCallback","CloseCircleFilledIcon","SearchIcon","Field","jsx","_jsx","SearchField","_ref","ref","autoCompleteType","hasInitialFocus","id","idOverride","isDisabled","label","name","nameOverride","onChange","onChangeProp","onFocus","onBlur","onClear","onClearProp","placeholder","testId","value","controlledValue","uncontrolledValue","setUncontrolledValue","event","currentTarget","undefined","renderFieldComponent","_ref2","ariaDescribedBy","_InputBase","autoComplete","autoFocus","endAdornment","_InputAdornment","position","children","_IconButton","disabled","onClick","size","startAdornment","type","fieldType","hasVisibleLabel","isOptional","MemoizedSearchField","displayName"],"sources":["../src/SearchField.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { useState, useEffect } from \"react\";\nimport { InputAdornment, InputBase, IconButton } from \"@mui/material\";\nimport {\n ChangeEventHandler,\n FocusEventHandler,\n forwardRef,\n InputHTMLAttributes,\n memo,\n useCallback,\n} from \"react\";\n\nimport { CloseCircleFilledIcon, SearchIcon } from \"./icons.generated\";\nimport { Field } from \"./Field\";\nimport type { SeleniumProps } from \"./SeleniumProps\";\n\nexport type SearchFieldProps = {\n /**\n * This prop helps users to fill forms faster, especially on mobile devices.\n * The name can be confusing, as it's more like an autofill.\n * You can learn more about it [following the specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill).\n */\n autoCompleteType?: InputHTMLAttributes<HTMLInputElement>[\"autoComplete\"];\n /**\n * If `true`, the component will receive focus automatically.\n */\n hasInitialFocus?: boolean;\n /**\n * The id of the `input` element.\n */\n id?: string;\n /**\n * If `true`, the component is disabled.\n */\n isDisabled?: boolean;\n /**\n * This label won't show up visually, but it's required for accessibility.\n */\n label: string;\n /**\n * The name of the `input` element. Defaults to the `id` if not set.\n */\n name?: string;\n /**\n * Callback fired when the `input` element loses focus.\n */\n onBlur?: FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;\n /**\n * Callback fired when the clear button is pressed.\n */\n onClear?: () => void;\n /**\n * Callback fired when the value is changed.\n */\n onChange?: ChangeEventHandler<HTMLTextAreaElement | HTMLInputElement>;\n /**\n * Callback fired when the `input` element get focus.\n */\n onFocus?: FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;\n /**\n * The short hint displayed in the `input` before the user enters a value.\n */\n placeholder?: string;\n /**\n * The value of the `input` element, required for a controlled component.\n */\n value?: string;\n} & SeleniumProps;\n\nconst SearchField = forwardRef<HTMLInputElement, SearchFieldProps>(\n (\n {\n autoCompleteType,\n hasInitialFocus,\n id: idOverride,\n isDisabled = false,\n label,\n name: nameOverride,\n onChange: onChangeProp,\n onFocus,\n onBlur,\n onClear: onClearProp,\n placeholder,\n testId,\n value: controlledValue,\n },\n ref\n ) => {\n const [uncontrolledValue, setUncontrolledValue] = useState(\"\");\n\n const onChange: ChangeEventHandler<HTMLTextAreaElement | HTMLInputElement> =\n useCallback(\n (event) => {\n setUncontrolledValue(event.currentTarget.value);\n onChangeProp?.(event);\n },\n [onChangeProp]\n );\n\n const onClear = useCallback(() => {\n setUncontrolledValue(\"\");\n onClearProp?.();\n }, [onClearProp]);\n\n useEffect(() => {\n if (controlledValue !== undefined) {\n setUncontrolledValue(controlledValue);\n }\n }, [controlledValue]);\n\n const renderFieldComponent = useCallback(\n ({ ariaDescribedBy, id }) => (\n <InputBase\n aria-describedby={ariaDescribedBy}\n autoComplete={autoCompleteType}\n /* eslint-disable-next-line jsx-a11y/no-autofocus */\n autoFocus={hasInitialFocus}\n data-se={testId}\n endAdornment={\n uncontrolledValue && (\n <InputAdornment position=\"end\">\n <IconButton\n aria-label=\"Clear\"\n disabled={isDisabled}\n onClick={onClear}\n size=\"small\"\n >\n <CloseCircleFilledIcon />\n </IconButton>\n </InputAdornment>\n )\n }\n id={id}\n name={nameOverride ?? id}\n onBlur={onBlur}\n onChange={onChange}\n onFocus={onFocus}\n placeholder={placeholder}\n ref={ref}\n startAdornment={\n <InputAdornment position=\"start\">\n <SearchIcon />\n </InputAdornment>\n }\n type=\"search\"\n value={\n controlledValue === undefined ? uncontrolledValue : controlledValue\n }\n />\n ),\n [\n autoCompleteType,\n controlledValue,\n hasInitialFocus,\n isDisabled,\n nameOverride,\n onBlur,\n onChange,\n onClear,\n onFocus,\n placeholder,\n ref,\n testId,\n uncontrolledValue,\n ]\n );\n\n return (\n <Field\n fieldType=\"single\"\n hasVisibleLabel={false}\n id={idOverride}\n isDisabled={isDisabled}\n isOptional={true}\n label={label}\n renderFieldComponent={renderFieldComponent}\n />\n );\n }\n);\n\nconst MemoizedSearchField = memo(SearchField);\nMemoizedSearchField.displayName = \"SearchField\";\n\nexport { MemoizedSearchField as SearchField };\n"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAE3C,SAGEC,UAAU,EAEVC,IAAI,EACJC,WAAW,QACN,OAAO;AAAC,SAENC,qBAAqB,EAAEC,UAAU;AAAA,SACjCC,KAAK;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAwDd,MAAMC,WAAW,GAAGR,UAAU,CAC5B,CAAAS,IAAA,EAgBEC,GAAG,KACA;EAAA,IAhBH;IACEC,gBAAgB;IAChBC,eAAe;IACfC,EAAE,EAAEC,UAAU;IACdC,UAAU,GAAG,KAAK;IAClBC,KAAK;IACLC,IAAI,EAAEC,YAAY;IAClBC,QAAQ,EAAEC,YAAY;IACtBC,OAAO;IACPC,MAAM;IACNC,OAAO,EAAEC,WAAW;IACpBC,WAAW;IACXC,MAAM;IACNC,KAAK,EAAEC;EACT,CAAC,GAAAnB,IAAA;EAGD,MAAM,CAACoB,iBAAiB,EAAEC,oBAAoB,CAAC,GAAGhC,QAAQ,C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AAG,EAAEA,GAAI;MACTsC,cAAc,EACZzC,IAAA,CAAAkC,eAAA;QAAgBC,QAAQ,EAAC,OAAO;QAAAC,QAAA,EAC9BpC,IAAA,CAACH,UAAU,IAAE;MAAC,CACA,CACjB;MACD6C,IAAI,EAAC,QAAQ;MACbtB,KAAK,EACHC,eAAe,KAAKK,SAAS,GAAGJ,iBAAiB,GAAGD;IACrD,CACF,CAAC;EAAA,CACH,EACD,CACEjB,gBAAgB,EAChBiB,eAAe,EACfhB,eAAe,EACfG,UAAU,EACVG,YAAY,EACZI,MAAM,EACNH,QAAQ,EACRI,OAAO,EACPF,OAAO,EACPI,WAAW,EACXf,GAAG,EACHgB,MAAM,EACNG,iBAAiB,CAErB,CAAC;EAED,OACEtB,IAAA,CAACF,KAAK;IACJ6C,SAAS,EAAC,QAAQ;IAClBC,eAAe,EAAE,KAAM;IACvBtC,EAAE,EAAEC,UAAW;IACfC,UAAU,EAAEA,UAAW;IACvBqC,UAAU,EAAE,IAAK;IACjBpC,KAAK,EAAEA,KAAM;IACbkB,oBAAoB,EAAEA;EAAqB,CAC5C,CAAC;AAEN,CACF,CAAC;AAED,MAAMmB,mBAAmB,GAAGpD,IAAI,CAACO,WAAW,CAAC;AAC7C6C,mBAAmB,CAACC,WAAW,GAAG,aAAa;AAE/C,SAASD,mBAAmB,IAAI7C,WAAW"}
package/dist/Select.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import _Select from "@mui/material/Select";
2
2
  import _MenuItem from "@mui/material/MenuItem";
3
+ import _Checkbox from "@mui/material/Checkbox";
3
4
  import _ListSubheader from "@mui/material/ListSubheader";
4
5
  import _Box from "@mui/material/Box";
5
6
  import _Chip from "@mui/material/Chip";
@@ -16,7 +17,6 @@ import _Chip from "@mui/material/Chip";
16
17
  */
17
18
 
18
19
  import { forwardRef, memo, useCallback, useState } from "react";
19
- import { Checkbox } from "./Checkbox.js";
20
20
  import { Field } from "./Field.js";
21
21
  import { jsx as _jsx } from "react/jsx-runtime";
22
22
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -29,10 +29,12 @@ const Select = forwardRef((_ref, ref) => {
29
29
  isMultiSelect = false,
30
30
  isOptional = false,
31
31
  label,
32
+ name: nameOverride,
32
33
  onBlur,
33
34
  onChange: onChangeProp,
34
35
  onFocus,
35
36
  value,
37
+ testId,
36
38
  options
37
39
  } = _ref;
38
40
  if (typeof value === "undefined") {
@@ -96,16 +98,17 @@ const Select = forwardRef((_ref, ref) => {
96
98
  }
97
99
  return _jsxs(_MenuItem, {
98
100
  value: option.value,
99
- children: [isMultiSelect && _jsx(Checkbox, {
100
- isDefaultChecked: selectedValue.includes(option.value)
101
+ children: [isMultiSelect && _jsx(_Checkbox, {
102
+ checked: selectedValue.includes(option.value)
101
103
  }), option.text]
102
104
  }, option.value);
103
105
  });
104
106
  const renderFieldComponent = useCallback(() => _jsx(_Select, {
105
107
  children: children,
108
+ "data-se": testId,
106
109
  id: idOverride,
107
110
  multiple: isMultiSelect,
108
- name: idOverride,
111
+ name: nameOverride ?? idOverride,
109
112
  onBlur: onBlur,
110
113
  onChange: onChange,
111
114
  onFocus: onFocus,
@@ -113,7 +116,7 @@ const Select = forwardRef((_ref, ref) => {
113
116
  renderValue: isMultiSelect ? renderValue : undefined,
114
117
  value: selectedValue,
115
118
  labelId: label
116
- }), [idOverride, isMultiSelect, onBlur, onChange, onFocus, ref, children, renderValue, selectedValue, label]);
119
+ }), [children, idOverride, isMultiSelect, label, nameOverride, onBlur, onChange, onFocus, ref, renderValue, selectedValue, testId]);
117
120
  return _jsx(Field, {
118
121
  errorMessage: errorMessage,
119
122
  fieldType: "single",
@@ -1 +1 @@
1
- {"version":3,"file":"Select.js","names":["forwardRef","memo","useCallback","useState","Checkbox","Field","jsx","_jsx","jsxs","_jsxs","Select","_ref","ref","errorMessage","hint","id","idOverride","isDisabled","isMultiSelect","isOptional","label","onBlur","onChange","onChangeProp","onFocus","value","options","selectedValue","setSelectedValue","event","child","target","split","normalizedOptions","map","option","text","type","renderValue","selected","undefined","renderedChips","item","selectedOption","find","_Chip","filter","Boolean","length","_Box","children","_ListSubheader","_MenuItem","isDefaultChecked","includes","renderFieldComponent","_Select","multiple","name","labelId","fieldType","hasVisibleLabel","MemoizedSelect","displayName"],"sources":["../src/Select.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 { ReactNode, forwardRef, memo, useCallback, useState } from \"react\";\nimport {\n Box,\n Chip,\n ListSubheader,\n MenuItem,\n Select as MuiSelect,\n SelectChangeEvent,\n} from \"@mui/material\";\nimport { SelectProps as MuiSelectProps } from \"@mui/material\";\nimport { Checkbox } from \"./Checkbox\";\nimport { Field } from \"./Field\";\n\nexport type SelectOption = {\n text: string;\n type?: \"heading\" | \"option\";\n value?: string;\n};\n\nexport type SelectProps = {\n /**\n * The error message for the Select\n */\n errorMessage?: string;\n /**\n * The hint text for the Select\n */\n hint?: string;\n /**\n * The id attribute of the Select\n */\n id?: string;\n /**\n * If `true`, the Select is disabled\n */\n isDisabled?: boolean;\n /**\n * If `true`, the Select allows multiple selections\n */\n isMultiSelect?: boolean;\n /**\n * If `true`, the Select is optional\n */\n isOptional?: boolean;\n /**\n * The label text for the Select\n */\n label: string;\n /**\n * Callback fired when the Select loses focus\n */\n onBlur?: MuiSelectProps[\"onBlur\"];\n /**\n * Callback fired when the value of the Select changes\n */\n onChange?: MuiSelectProps[\"onChange\"];\n /**\n * Callback fired when the Select gains focus\n */\n onFocus?: MuiSelectProps[\"onFocus\"];\n /**\n * The options for the Select\n */\n options: (string | SelectOption)[];\n /**\n * The value or values selected in the Select\n */\n value?: string | string[];\n};\n\n/**\n * Options in Odyssey <Select> are passed as an array, which can contain any combination\n * of the following:\n * - string — A simple string. The string will be both the text and the value of the resulting option.\n * <option value=\"string\">string</option>\n *\n * - { text: string } — Same as above, but the string is contained within an object.\n * <option value=\"text\">text</option>\n *\n * - { text: string, value: string } — The option text will be text, and the option value will be value.\n * <option value=\"value\">text</option>\n *\n * - { text: string, type: \"heading\" } — Used to display a group heading with the text\n */\n\nconst Select = forwardRef<HTMLSelectElement, SelectProps>(\n (\n {\n errorMessage,\n hint,\n id: idOverride,\n isDisabled = false,\n isMultiSelect = false,\n isOptional = false,\n label,\n onBlur,\n onChange: onChangeProp,\n onFocus,\n value,\n options,\n },\n ref\n ) => {\n // If there's no value set, we set it to a blank string (if it's a single-select)\n // or an empty array (if it's a multi-select)\n if (typeof value === \"undefined\") {\n value = isMultiSelect ? [] : \"\";\n }\n\n const [selectedValue, setSelectedValue] = useState<string | string[]>(\n value\n );\n\n const onChange = useCallback(\n (event: SelectChangeEvent<string | string[]>, child: ReactNode) => {\n const {\n target: { value },\n } = event;\n\n // Set the field value, with some additional logic to handle array values\n // for multi-selects\n if (isMultiSelect) {\n setSelectedValue(\n typeof value === \"string\" ? value.split(\",\") : value\n );\n } else {\n setSelectedValue(value);\n }\n\n // Trigger the onChange event, if one has been passed\n if (onChangeProp) {\n onChangeProp(event, child);\n }\n },\n [isMultiSelect, onChangeProp, setSelectedValue]\n );\n\n // Normalize the options array to accommodate the various\n // data types that might be passed\n const normalizedOptions = options.map((option) => {\n if (typeof option === \"object\") {\n return {\n text: option.text,\n value: option.value || option.text,\n type: option.type === \"heading\" ? \"heading\" : \"option\",\n };\n }\n\n return { text: option, value: option, type: \"option\" };\n });\n\n const renderValue = useCallback(\n (selected: string | string[]) => {\n // If the selected value isn't an array, then we don't need to display\n // chips and should fall back to the default render behavior\n if (typeof selected === \"string\") {\n return undefined;\n }\n\n // Convert the selected options array into <Chip>s\n const renderedChips = selected\n .map((item: string) => {\n const selectedOption = normalizedOptions.find(\n (option) => option.value === item\n );\n\n if (!selectedOption) {\n return null;\n }\n\n return <Chip key={item} label={selectedOption.text} />;\n })\n .filter(Boolean);\n\n if (renderedChips.length === 0) {\n return null;\n }\n\n // We need the <Box> to surround the <Chip>s for\n // proper styling\n return <Box>{renderedChips}</Box>;\n },\n [normalizedOptions]\n );\n\n // Convert the options into the ReactNode children\n // that will populate the <Select>\n const children = normalizedOptions.map((option) => {\n if (option.type === \"heading\") {\n return <ListSubheader key={option.text}>{option.text}</ListSubheader>;\n }\n\n return (\n <MenuItem key={option.value} value={option.value}>\n {isMultiSelect && (\n <Checkbox isDefaultChecked={selectedValue.includes(option.value)} />\n )}\n {option.text}\n </MenuItem>\n );\n });\n\n const renderFieldComponent = useCallback(\n () => (\n <MuiSelect\n children={children}\n id={idOverride}\n multiple={isMultiSelect}\n name={idOverride}\n onBlur={onBlur}\n onChange={onChange}\n onFocus={onFocus}\n ref={ref}\n renderValue={isMultiSelect ? renderValue : undefined}\n value={selectedValue}\n labelId={label}\n />\n ),\n [\n idOverride,\n isMultiSelect,\n onBlur,\n onChange,\n onFocus,\n ref,\n children,\n renderValue,\n selectedValue,\n label,\n ]\n );\n\n return (\n <Field\n errorMessage={errorMessage}\n fieldType=\"single\"\n hasVisibleLabel\n hint={hint}\n id={idOverride}\n isDisabled={isDisabled}\n isOptional={isOptional}\n label={label}\n renderFieldComponent={renderFieldComponent}\n />\n );\n }\n);\n\nconst MemoizedSelect = memo(Select);\nMemoizedSelect.displayName = \"Select\";\n\nexport { MemoizedSelect as Select };\n"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAoBA,UAAU,EAAEC,IAAI,EAAEC,WAAW,EAAEC,QAAQ,QAAQ,OAAO;AAAC,SAUlEC,QAAQ;AAAA,SACRC,KAAK;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IA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Q;QAACiD,gBAAgB,EAAE1B,aAAa,CAAC2B,QAAQ,CAACnB,MAAM,CAACV,KAAK;MAAE,CAAE,CACpE,EACAU,MAAM,CAACC,IAAI;IAAA,GAJCD,MAAM,CAACV,KAKZ,CAAC;EAEf,CAAC,CAAC;EAEF,MAAM8B,oBAAoB,GAAGrD,WAAW,CACtC,MACEK,IAAA,CAAAiD,OAAA;IACEN,QAAQ,EAAEA,QAAS;IACnBnC,EAAE,EAAEC,UAAW;IACfyC,QAAQ,EAAEvC,aAAc;IACxBwC,IAAI,EAAE1C,UAAW;IACjBK,MAAM,EAAEA,MAAO;IACfC,QAAQ,EAAEA,QAAS;IACnBE,OAAO,EAAEA,OAAQ;IACjBZ,GAAG,EAAEA,GAAI;IACT0B,WAAW,EAAEpB,aAAa,GAAGoB,WAAW,GAAGE,SAAU;IACrDf,KAAK,EAAEE,aAAc;IACrBgC,OAAO,EAAEvC;EAAM,CAChB,CACF,EACD,CACEJ,UAAU,EACVE,aAAa,EACbG,MAAM,EACNC,QAAQ,EACRE,OAAO,EACPZ,GAAG,EACHsC,QAAQ,EACRZ,WAAW,EACXX,aAAa,EACbP,KAAK,CAET,CAAC;EAED,OACEb,IAAA,CAACF,KAAK;IACJQ,YAAY,EAAEA,YAAa;IAC3B+C,SAAS,EAAC,QAAQ;IAClBC,eAAe;IACf/C,IAAI,EAAEA,IAAK;IACXC,EAAE,EAAEC,UAAW;IACfC,UAAU,EAAEA,UAAW;IACvBE,UAAU,EAAEA,UAAW;IACvBC,KAAK,EAAEA,KAAM;IACbmC,oBAAoB,EAAEA;EAAqB,CAC5C,CAAC;AAEN,CACF,CAAC;AAED,MAAMO,cAAc,GAAG7D,IAAI,CAACS,MAAM,CAAC;AACnCoD,cAAc,CAACC,WAAW,GAAG,QAAQ;AAErC,SAASD,cAAc,IAAIpD,MAAM"}
1
+ {"version":3,"file":"Select.js","names":["forwardRef","memo","useCallback","useState","Field","jsx","_jsx","jsxs","_jsxs","Select","_ref","ref","errorMessage","hint","id","idOverride","isDisabled","isMultiSelect","isOptional","label","name","nameOverride","onBlur","onChange","onChangeProp","onFocus","value","testId","options","selectedValue","setSelectedValue","event","child","target","split","normalizedOptions","map","option","text","type","renderValue","selected","undefined","renderedChips","item","selectedOption","find","_Chip","filter","Boolean","length","_Box","children","_ListSubheader","_MenuItem","_Checkbox","checked","includes","renderFieldComponent","_Select","multiple","labelId","fieldType","hasVisibleLabel","MemoizedSelect","displayName"],"sources":["../src/Select.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 { ReactNode, forwardRef, memo, useCallback, useState } from \"react\";\nimport {\n Box,\n Chip,\n Checkbox as MuiCheckbox,\n ListSubheader,\n MenuItem,\n Select as MuiSelect,\n SelectChangeEvent,\n} from \"@mui/material\";\nimport { SelectProps as MuiSelectProps } from \"@mui/material\";\nimport { Field } from \"./Field\";\nimport type { SeleniumProps } from \"./SeleniumProps\";\n\nexport type SelectOption = {\n text: string;\n type?: \"heading\" | \"option\";\n value?: string;\n};\n\nexport type SelectProps = {\n /**\n * The error message for the Select\n */\n errorMessage?: string;\n /**\n * The hint text for the Select\n */\n hint?: string;\n /**\n * The id attribute of the Select\n */\n id?: string;\n /**\n * If `true`, the Select is disabled\n */\n isDisabled?: boolean;\n /**\n * If `true`, the Select allows multiple selections\n */\n isMultiSelect?: boolean;\n /**\n * If `true`, the Select is optional\n */\n isOptional?: boolean;\n /**\n * The label text for the Select\n */\n label: string;\n /**\n * The name of the `input` element. Defaults to the `id` if not set.\n */\n name?: string;\n /**\n * Callback fired when the Select loses focus\n */\n onBlur?: MuiSelectProps[\"onBlur\"];\n /**\n * Callback fired when the value of the Select changes\n */\n onChange?: MuiSelectProps[\"onChange\"];\n /**\n * Callback fired when the Select gains focus\n */\n onFocus?: MuiSelectProps[\"onFocus\"];\n /**\n * The options for the Select\n */\n options: (string | SelectOption)[];\n /**\n * The value or values selected in the Select\n */\n value?: string | string[];\n} & SeleniumProps;\n\n/**\n * Options in Odyssey <Select> are passed as an array, which can contain any combination\n * of the following:\n * - string — A simple string. The string will be both the text and the value of the resulting option.\n * <option value=\"string\">string</option>\n *\n * - { text: string } — Same as above, but the string is contained within an object.\n * <option value=\"text\">text</option>\n *\n * - { text: string, value: string } — The option text will be text, and the option value will be value.\n * <option value=\"value\">text</option>\n *\n * - { text: string, type: \"heading\" } — Used to display a group heading with the text\n */\n\nconst Select = forwardRef<HTMLSelectElement, SelectProps>(\n (\n {\n errorMessage,\n hint,\n id: idOverride,\n isDisabled = false,\n isMultiSelect = false,\n isOptional = false,\n label,\n name: nameOverride,\n onBlur,\n onChange: onChangeProp,\n onFocus,\n value,\n testId,\n options,\n },\n ref\n ) => {\n // If there's no value set, we set it to a blank string (if it's a single-select)\n // or an empty array (if it's a multi-select)\n if (typeof value === \"undefined\") {\n value = isMultiSelect ? [] : \"\";\n }\n\n const [selectedValue, setSelectedValue] = useState<string | string[]>(\n value\n );\n\n const onChange = useCallback(\n (event: SelectChangeEvent<string | string[]>, child: ReactNode) => {\n const {\n target: { value },\n } = event;\n\n // Set the field value, with some additional logic to handle array values\n // for multi-selects\n if (isMultiSelect) {\n setSelectedValue(\n typeof value === \"string\" ? value.split(\",\") : value\n );\n } else {\n setSelectedValue(value);\n }\n\n // Trigger the onChange event, if one has been passed\n if (onChangeProp) {\n onChangeProp(event, child);\n }\n },\n [isMultiSelect, onChangeProp, setSelectedValue]\n );\n\n // Normalize the options array to accommodate the various\n // data types that might be passed\n const normalizedOptions = options.map((option) => {\n if (typeof option === \"object\") {\n return {\n text: option.text,\n value: option.value || option.text,\n type: option.type === \"heading\" ? \"heading\" : \"option\",\n };\n }\n\n return { text: option, value: option, type: \"option\" };\n });\n\n const renderValue = useCallback(\n (selected: string | string[]) => {\n // If the selected value isn't an array, then we don't need to display\n // chips and should fall back to the default render behavior\n if (typeof selected === \"string\") {\n return undefined;\n }\n\n // Convert the selected options array into <Chip>s\n const renderedChips = selected\n .map((item: string) => {\n const selectedOption = normalizedOptions.find(\n (option) => option.value === item\n );\n\n if (!selectedOption) {\n return null;\n }\n\n return <Chip key={item} label={selectedOption.text} />;\n })\n .filter(Boolean);\n\n if (renderedChips.length === 0) {\n return null;\n }\n\n // We need the <Box> to surround the <Chip>s for\n // proper styling\n return <Box>{renderedChips}</Box>;\n },\n [normalizedOptions]\n );\n\n // Convert the options into the ReactNode children\n // that will populate the <Select>\n const children = normalizedOptions.map((option) => {\n if (option.type === \"heading\") {\n return <ListSubheader key={option.text}>{option.text}</ListSubheader>;\n }\n\n return (\n <MenuItem key={option.value} value={option.value}>\n {isMultiSelect && (\n <MuiCheckbox checked={selectedValue.includes(option.value)} />\n )}\n {option.text}\n </MenuItem>\n );\n });\n\n const renderFieldComponent = useCallback(\n () => (\n <MuiSelect\n children={children}\n data-se={testId}\n id={idOverride}\n multiple={isMultiSelect}\n name={nameOverride ?? idOverride}\n onBlur={onBlur}\n onChange={onChange}\n onFocus={onFocus}\n ref={ref}\n renderValue={isMultiSelect ? renderValue : undefined}\n value={selectedValue}\n labelId={label}\n />\n ),\n [\n children,\n idOverride,\n isMultiSelect,\n label,\n nameOverride,\n onBlur,\n onChange,\n onFocus,\n ref,\n renderValue,\n selectedValue,\n testId,\n ]\n );\n\n return (\n <Field\n errorMessage={errorMessage}\n fieldType=\"single\"\n hasVisibleLabel\n hint={hint}\n id={idOverride}\n isDisabled={isDisabled}\n isOptional={isOptional}\n label={label}\n renderFieldComponent={renderFieldComponent}\n />\n );\n }\n);\n\nconst MemoizedSelect = memo(Select);\nMemoizedSelect.displayName = \"Select\";\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AAEA,UAAW;IACvBE,UAAU,EAAEA,UAAW;IACvBC,KAAK,EAAEA,KAAM;IACbuC,oBAAoB,EAAEA;EAAqB,CAC5C,CAAC;AAEN,CACF,CAAC;AAED,MAAMM,cAAc,GAAG/D,IAAI,CAACQ,MAAM,CAAC;AACnCuD,cAAc,CAACC,WAAW,GAAG,QAAQ;AAErC,SAASD,cAAc,IAAIvD,MAAM"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=SeleniumProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SeleniumProps.js","names":[],"sources":["../src/SeleniumProps.ts"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nexport type SeleniumProps = {\n /**\n * This prop puts a `data` attribute on an HTML element in this component with the value provided.\n *\n * @deprecated **WARNING:** You should be using Semantic Selectors instead of this property. This is a temporary measure for backwards compatibility with existing Selenium tests.\n */\n testId?: string;\n};\n"],"mappings":""}
package/dist/Status.js CHANGED
@@ -16,15 +16,17 @@ export const statusSeverityValues = ["default", "error", "success", "warning"];
16
16
  export const statusVariantValues = ["lamp", "pill"];
17
17
  export const Status = _ref => {
18
18
  let {
19
- severity,
20
19
  label,
20
+ severity,
21
+ testId,
21
22
  variant = "lamp"
22
23
  } = _ref;
23
24
  const muiProps = useMuiProps();
24
25
  return _jsx(_Chip, {
25
26
  ...muiProps,
26
- label: label,
27
27
  color: severity,
28
+ "data-se": testId,
29
+ label: label,
28
30
  variant: variant
29
31
  });
30
32
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Status.js","names":["useMuiProps","jsx","_jsx","statusSeverityValues","statusVariantValues","Status","_ref","severity","label","variant","muiProps","_Chip","color"],"sources":["../src/Status.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { Chip } from \"@mui/material\";\n\nimport { useMuiProps } from \"./MuiPropsContext\";\n\nexport const statusSeverityValues = [\n \"default\",\n \"error\",\n \"success\",\n \"warning\",\n] as const;\nexport const statusVariantValues = [\"lamp\", \"pill\"] as const;\n\nexport type StatusProps = {\n /**\n * The text content of the Status\n */\n label: string;\n /**\n * Determine the color and icon of the Status\n */\n severity: (typeof statusSeverityValues)[number];\n /**\n * The style of the Status indicator\n */\n variant?: (typeof statusVariantValues)[number];\n};\n\nexport const Status = ({ severity, label, variant = \"lamp\" }: StatusProps) => {\n const muiProps = useMuiProps();\n\n return (\n <Chip {...muiProps} label={label} color={severity} variant={variant} />\n );\n};\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVA,SAcSA,WAAW;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAEpB,OAAO,MAAMC,oBAAoB,GAAG,CAClC,SAAS,EACT,OAAO,EACP,SAAS,EACT,SAAS,CACD;AACV,OAAO,MAAMC,mBAAmB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAU;AAiB5D,OAAO,MAAMC,MAAM,GAAGC,IAAA,IAAwD;EAAA,IAAvD;IAAEC,QAAQ;IAAEC,KAAK;IAAEC,OAAO,GAAG;EAAoB,CAAC,GAAAH,IAAA;EACvE,MAAMI,QAAQ,GAAGV,WAAW,CAAC,CAAC;EAE9B,OACEE,IAAA,CAAAS,KAAA;IAAA,GAAUD,QAAQ;IAAEF,KAAK,EAAEA,KAAM;IAACI,KAAK,EAAEL,QAAS;IAACE,OAAO,EAAEA;EAAQ,CAAE,CAAC;AAE3E,CAAC"}
1
+ {"version":3,"file":"Status.js","names":["useMuiProps","jsx","_jsx","statusSeverityValues","statusVariantValues","Status","_ref","label","severity","testId","variant","muiProps","_Chip","color"],"sources":["../src/Status.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { Chip } from \"@mui/material\";\n\nimport { useMuiProps } from \"./MuiPropsContext\";\nimport type { SeleniumProps } from \"./SeleniumProps\";\n\nexport const statusSeverityValues = [\n \"default\",\n \"error\",\n \"success\",\n \"warning\",\n] as const;\nexport const statusVariantValues = [\"lamp\", \"pill\"] as const;\n\nexport type StatusProps = {\n /**\n * The text content of the Status\n */\n label: string;\n /**\n * Determine the color and icon of the Status\n */\n severity: (typeof statusSeverityValues)[number];\n /**\n * The style of the Status indicator\n */\n variant?: (typeof statusVariantValues)[number];\n} & SeleniumProps;\n\nexport const Status = ({\n label,\n severity,\n testId,\n variant = \"lamp\",\n}: StatusProps) => {\n const muiProps = useMuiProps();\n\n return (\n <Chip\n {...muiProps}\n color={severity}\n data-se={testId}\n label={label}\n variant={variant}\n />\n );\n};\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVA,SAcSA,WAAW;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAGpB,OAAO,MAAMC,oBAAoB,GAAG,CAClC,SAAS,EACT,OAAO,EACP,SAAS,EACT,SAAS,CACD;AACV,OAAO,MAAMC,mBAAmB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAU;AAiB5D,OAAO,MAAMC,MAAM,GAAGC,IAAA,IAKH;EAAA,IALI;IACrBC,KAAK;IACLC,QAAQ;IACRC,MAAM;IACNC,OAAO,GAAG;EACC,CAAC,GAAAJ,IAAA;EACZ,MAAMK,QAAQ,GAAGX,WAAW,CAAC,CAAC;EAE9B,OACEE,IAAA,CAAAU,KAAA;IAAA,GACMD,QAAQ;IACZE,KAAK,EAAEL,QAAS;IAChB,WAASC,MAAO;IAChBF,KAAK,EAAEA,KAAM;IACbG,OAAO,EAAEA;EAAQ,CAClB,CAAC;AAEN,CAAC"}
package/dist/Tabs.js CHANGED
@@ -11,26 +11,33 @@ import _Tab from "@mui/material/Tab";
11
11
  * See the License for the specific language governing permissions and limitations under the License.
12
12
  */
13
13
 
14
- import React, { memo, useCallback, useState } from "react";
14
+ import React, { memo, useCallback, useEffect, useState } from "react";
15
15
  import { TabList as MuiTabList, TabPanel as MuiTabPanel, TabContext as MuiTabContext } from "@mui/lab";
16
16
  import { jsx as _jsx } from "react/jsx-runtime";
17
17
  import { jsxs as _jsxs } from "react/jsx-runtime";
18
18
  const Tabs = _ref => {
19
19
  let {
20
20
  ariaLabel,
21
- initialValue = "0",
22
- tabs
21
+ initialValue,
22
+ tabs,
23
+ value
23
24
  } = _ref;
24
- const [tabState, setTabState] = useState(initialValue);
25
+ const [tabState, setTabState] = useState(initialValue ?? value ?? "0");
25
26
  const onChange = useCallback((_event, newState) => {
26
27
  setTabState(newState);
27
28
  }, []);
29
+ useEffect(() => {
30
+ if (value !== undefined) {
31
+ setTabState(value);
32
+ }
33
+ }, [value]);
28
34
  return _jsxs(MuiTabContext, {
29
35
  value: tabState,
30
36
  children: [_jsx(MuiTabList, {
31
37
  onChange: onChange,
32
38
  "aria-label": ariaLabel,
33
39
  children: tabs.map((tab, index) => _jsx(_Tab, {
40
+ "data-se": tab.testId,
34
41
  disabled: tab.isDisabled,
35
42
  icon: tab.startIcon,
36
43
  label: tab.label,
package/dist/Tabs.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.js","names":["React","memo","useCallback","useState","TabList","MuiTabList","TabPanel","MuiTabPanel","TabContext","MuiTabContext","jsx","_jsx","jsxs","_jsxs","Tabs","_ref","ariaLabel","initialValue","tabs","tabState","setTabState","onChange","_event","newState","value","children","map","tab","index","_Tab","disabled","isDisabled","icon","startIcon","label","toString","MemoizedTabs","displayName"],"sources":["../src/Tabs.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 React, {\n ReactElement,\n ReactNode,\n memo,\n useCallback,\n useState,\n} from \"react\";\nimport { Tab as MuiTab } from \"@mui/material\";\nimport {\n TabList as MuiTabList,\n TabPanel as MuiTabPanel,\n TabContext as MuiTabContext,\n} from \"@mui/lab\";\n\nexport type TabItemProps = {\n /**\n * The content of the Tab itself\n */\n children: ReactNode;\n /**\n * If `true`, the TabItem is disabled\n */\n isDisabled?: boolean;\n /**\n * The label text for the TabItem\n */\n label: string;\n /**\n * An optional icon to display at the start of the TabItem\n */\n startIcon?: ReactElement;\n /**\n * The value associated with the TabItem\n */\n value?: string;\n};\n\nexport type TabsProps = {\n /**\n * The ARIA label for the full Tabs group\n */\n ariaLabel?: string;\n /**\n * The value of the Tab that should be selected by default\n */\n initialValue?: string;\n /**\n * The TabItems to be included in the Tabs group\n */\n tabs: TabItemProps[];\n};\n\nconst Tabs = ({ ariaLabel, initialValue = \"0\", tabs }: TabsProps) => {\n const [tabState, setTabState] = useState(initialValue);\n\n const onChange = useCallback(\n (_event: React.SyntheticEvent, newState: string) => {\n setTabState(newState);\n },\n []\n );\n\n return (\n <MuiTabContext value={tabState}>\n <MuiTabList onChange={onChange} aria-label={ariaLabel}>\n {tabs.map((tab, index) => (\n <MuiTab\n disabled={tab.isDisabled}\n icon={tab.startIcon}\n label={tab.label}\n value={tab.value ? tab.value : index.toString()}\n key={tab.value ? tab.value : index.toString()}\n />\n ))}\n </MuiTabList>\n {tabs.map((tab, index) => (\n <MuiTabPanel\n value={tab.value ? tab.value : index.toString()}\n key={tab.value ? tab.value : index.toString()}\n >\n {tab.children}\n </MuiTabPanel>\n ))}\n </MuiTabContext>\n );\n};\n\nconst MemoizedTabs = memo(Tabs);\nMemoizedTabs.displayName = \"Tabs\";\n\nexport { MemoizedTabs as Tabs };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IAGVC,IAAI,EACJC,WAAW,EACXC,QAAQ,QACH,OAAO;AAEd,SACEC,OAAO,IAAIC,UAAU,EACrBC,QAAQ,IAAIC,WAAW,EACvBC,UAAU,IAAIC,aAAa,QACtB,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAwClB,MAAMC,IAAI,GAAGC,IAAA,IAAwD;EAAA,IAAvD;IAAEC,SAAS;IAAEC,YAAY,GAAG,GAAG;IAAEC;EAAgB,CAAC,GAAAH,IAAA;EAC9D,MAAM,CAACI,QAAQ,EAAEC,WAAW,CAAC,GAAGjB,QAAQ,CAACc,YAAY,CAAC;EAEtD,MAAMI,QAAQ,GAAGnB,WAAW,CAC1B,CAACoB,MAA4B,EAAEC,QAAgB,KAAK;IAClDH,WAAW,CAACG,QAAQ,CAAC;EACvB,CAAC,EACD,EACF,CAAC;EAED,OACEV,KAAA,CAACJ,aAAa;IAACe,KAAK,EAAEL,QAAS;IAAAM,QAAA,GAC7Bd,IAAA,CAACN,UAAU;MAACgB,QAAQ,EAAEA,QAAS;MAAC,cAAYL,SAAU;MAAAS,QAAA,EACnDP,IAAI,CAACQ,GAAG,CAAC,CAACC,GAAG,EAAEC,KAAK,KACnBjB,IAAA,CAAAkB,IAAA;QACEC,QAAQ,EAAEH,GAAG,CAACI,UAAW;QACzBC,IAAI,EAAEL,GAAG,CAACM,SAAU;QACpBC,KAAK,EAAEP,GAAG,CAACO,KAAM;QACjBV,KAAK,EAAEG,GAAG,CAACH,KAAK,GAAGG,GAAG,CAACH,KAAK,GAAGI,KAAK,CAACO,QAAQ,CAAC;MAAE,GAC3CR,GAAG,CAACH,KAAK,GAAGG,GAAG,CAACH,KAAK,GAAGI,KAAK,CAACO,QAAQ,CAAC,CAC7C,CACF;IAAC,CACQ,CAAC,EACZjB,IAAI,CAACQ,GAAG,CAAC,CAACC,GAAG,EAAEC,KAAK,KACnBjB,IAAA,CAACJ,WAAW;MACViB,KAAK,EAAEG,GAAG,CAACH,KAAK,GAAGG,GAAG,CAACH,KAAK,GAAGI,KAAK,CAACO,QAAQ,CAAC,CAAE;MAAAV,QAAA,EAG/CE,GAAG,CAACF;IAAQ,GAFRE,GAAG,CAACH,KAAK,GAAGG,GAAG,CAACH,KAAK,GAAGI,KAAK,CAACO,QAAQ,CAAC,CAGjC,CACd,CAAC;EAAA,CACW,CAAC;AAEpB,CAAC;AAED,MAAMC,YAAY,GAAGnC,IAAI,CAACa,IAAI,CAAC;AAC/BsB,YAAY,CAACC,WAAW,GAAG,MAAM;AAEjC,SAASD,YAAY,IAAItB,IAAI"}
1
+ {"version":3,"file":"Tabs.js","names":["React","memo","useCallback","useEffect","useState","TabList","MuiTabList","TabPanel","MuiTabPanel","TabContext","MuiTabContext","jsx","_jsx","jsxs","_jsxs","Tabs","_ref","ariaLabel","initialValue","tabs","value","tabState","setTabState","onChange","_event","newState","undefined","children","map","tab","index","_Tab","testId","disabled","isDisabled","icon","startIcon","label","toString","MemoizedTabs","displayName"],"sources":["../src/Tabs.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 React, {\n ReactElement,\n ReactNode,\n memo,\n useCallback,\n useEffect,\n useState,\n} from \"react\";\nimport { Tab as MuiTab } from \"@mui/material\";\nimport {\n TabList as MuiTabList,\n TabPanel as MuiTabPanel,\n TabContext as MuiTabContext,\n} from \"@mui/lab\";\nimport { SeleniumProps } from \"./SeleniumProps\";\n\nexport type TabItemProps = {\n /**\n * The content of the Tab itself\n */\n children: ReactNode;\n /**\n * If `true`, the TabItem is disabled\n */\n isDisabled?: boolean;\n /**\n * The label text for the TabItem\n */\n label: string;\n /**\n * An optional icon to display at the start of the TabItem\n */\n startIcon?: ReactElement;\n /**\n * The value associated with the TabItem\n */\n value?: string;\n} & SeleniumProps;\n\nexport type TabsProps = {\n /**\n * The ARIA label for the full Tabs group\n */\n ariaLabel?: string;\n /**\n * @deprecated please use the `value` prop instead\n * When `value` is provided, `initialValue` isn't used.\n */\n initialValue?: string;\n /**\n * The TabItems to be included in the Tabs group\n */\n tabs: TabItemProps[];\n /**\n * Identifier for the selected tab.\n */\n value?: string;\n};\n\nconst Tabs = ({ ariaLabel, initialValue, tabs, value }: TabsProps) => {\n const [tabState, setTabState] = useState(initialValue ?? value ?? \"0\");\n\n const onChange = useCallback(\n (_event: React.SyntheticEvent, newState: string) => {\n setTabState(newState);\n },\n []\n );\n\n useEffect(() => {\n if (value !== undefined) {\n setTabState(value);\n }\n }, [value]);\n\n return (\n <MuiTabContext value={tabState}>\n <MuiTabList onChange={onChange} aria-label={ariaLabel}>\n {tabs.map((tab, index) => (\n <MuiTab\n data-se={tab.testId}\n disabled={tab.isDisabled}\n icon={tab.startIcon}\n label={tab.label}\n value={tab.value ? tab.value : index.toString()}\n key={tab.value ? tab.value : index.toString()}\n />\n ))}\n </MuiTabList>\n {tabs.map((tab, index) => (\n <MuiTabPanel\n value={tab.value ? tab.value : index.toString()}\n key={tab.value ? tab.value : index.toString()}\n >\n {tab.children}\n </MuiTabPanel>\n ))}\n </MuiTabContext>\n );\n};\n\nconst MemoizedTabs = memo(Tabs);\nMemoizedTabs.displayName = \"Tabs\";\n\nexport { MemoizedTabs as Tabs };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IAGVC,IAAI,EACJC,WAAW,EACXC,SAAS,EACTC,QAAQ,QACH,OAAO;AAEd,SACEC,OAAO,IAAIC,UAAU,EACrBC,QAAQ,IAAIC,WAAW,EACvBC,UAAU,IAAIC,aAAa,QACtB,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AA8ClB,MAAMC,IAAI,GAAGC,IAAA,IAAyD;EAAA,IAAxD;IAAEC,SAAS;IAAEC,YAAY;IAAEC,IAAI;IAAEC;EAAiB,CAAC,GAAAJ,IAAA;EAC/D,MAAM,CAACK,QAAQ,EAAEC,WAAW,CAAC,GAAGlB,QAAQ,CAACc,YAAY,IAAIE,KAAK,IAAI,GAAG,CAAC;EAEtE,MAAMG,QAAQ,GAAGrB,WAAW,CAC1B,CAACsB,MAA4B,EAAEC,QAAgB,KAAK;IAClDH,WAAW,CAACG,QAAQ,CAAC;EACvB,CAAC,EACD,EACF,CAAC;EAEDtB,SAAS,CAAC,MAAM;IACd,IAAIiB,KAAK,KAA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= _ref => {
20
20
  isDisabled,
21
21
  label,
22
22
  onClick,
23
- onRemove
23
+ onRemove,
24
+ testId
24
25
  } = _ref;
25
26
  const {
26
27
  chipElementType
@@ -30,12 +31,13 @@ const Tag = _ref => {
30
31
  "aria-disabled": isDisabled,
31
32
  clickable: onClick ? true : false,
32
33
  component: chipElementType,
34
+ "data-se": testId,
33
35
  disabled: isDisabled,
34
36
  icon: icon,
35
37
  label: label,
36
38
  onClick: onClick,
37
39
  onDelete: onRemove
38
- }), [chipElementType, icon, isDisabled, label, onClick, onRemove]);
40
+ }), [chipElementType, icon, isDisabled, label, onClick, onRemove, testId]);
39
41
  return _jsx(MuiPropsContext.Consumer, {
40
42
  children: renderTag
41
43
  });
package/dist/Tag.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Tag.js","names":["memo","useCallback","useContext","TagListContext","MuiPropsContext","jsx","_jsx","Tag","_ref","icon","isDisabled","label","onClick","onRemove","chipElementType","renderTag","muiProps","_Chip","clickable","component","disabled","onDelete","Consumer","children","MemoizedTag","displayName"],"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 as MuiChip, ChipProps as MuiChipProps } from \"@mui/material\";\nimport { memo, ReactElement, useCallback, useContext } from \"react\";\nimport { TagListContext } from \"./TagListContext\";\nimport { MuiPropsContext } from \"./MuiPropsContext\";\n\nexport type TagProps = {\n icon?: ReactElement;\n isDisabled?: boolean;\n /**\n * The label text for the Tag\n */\n label: string;\n /**\n * Callback fired when the Tag is clicked\n */\n onClick?: MuiChipProps[\"onClick\"];\n /**\n * Callback fired when the remove button of the Tag is clicked\n */\n onRemove?: MuiChipProps[\"onDelete\"];\n};\n\nconst Tag = ({ icon, isDisabled, label, onClick, onRemove }: TagProps) => {\n const { chipElementType } = useContext(TagListContext);\n\n const renderTag = useCallback(\n (muiProps) => (\n <MuiChip\n {...muiProps}\n aria-disabled={isDisabled}\n clickable={onClick ? true : false}\n component={chipElementType}\n disabled={isDisabled}\n icon={icon}\n label={label}\n onClick={onClick}\n onDelete={onRemove}\n />\n ),\n [chipElementType, icon, isDisabled, label, onClick, onRemove]\n );\n\n return <MuiPropsContext.Consumer>{renderTag}</MuiPropsContext.Consumer>;\n};\n\nconst MemoizedTag = memo(Tag);\nMemoizedTag.displayName = \"Tag\";\n\nexport { MemoizedTag as Tag };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,SAASA,IAAI,EAAgBC,WAAW,EAAEC,UAAU,QAAQ,OAAO;AAAC,SAC3DC,cAAc;AAAA,SACdC,eAAe;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAmBxB,MAAMC,GAAG,GAAGC,IAAA,IAA8D;EAAA,IAA7D;IAAEC,IAAI;IAAEC,UAAU;IAAEC,KAAK;IAAEC,OAAO;IAAEC;EAAmB,CAAC,GAAAL,IAAA;EACnE,MAAM;IAAEM;EAAgB,CAAC,GAAGZ,UAAU,CAACC,cAAc,CAAC;EAEtD,MAAMY,SAAS,GAAGd,WAAW,CAC1Be,QAAQ,IACPV,IAAA,CAAAW,KAAA;IAAA,GACMD,QAAQ;IACZ,iBAAeN,UAAW;IAC1BQ,SAAS,EAAEN,OAAO,GAAG,IAAI,GAAG,KAAM;IAClCO,SAAS,EAAEL,eAAgB;IAC3BM,QAAQ,EAAEV,UAAW;IACrBD,IAAI,EAAEA,IAAK;IACXE,KAAK,EAAEA,KAAM;IACbC,OAAO,EAAEA,OAAQ;IACjBS,QAAQ,EAAER;EAAS,CACpB,CACF,EACD,CAACC,eAAe,EAAEL,IAAI,EAAEC,UAAU,EAAEC,KAAK,EAAEC,OAAO,EAAEC,QAAQ,CAC9D,CAAC;EAED,OAAOP,IAAA,CAACF,eAAe,CAACkB,QAAQ;IAAAC,QAAA,EAAER;EAAS,CAA2B,CAAC;AACzE,CAAC;AAED,MAAMS,WAAW,GAAGxB,IAAI,CAACO,GAAG,CAAC;AAC7BiB,WAAW,CAACC,WAAW,GAAG,KAAK;AAE/B,SAASD,WAAW,IAAIjB,GAAG"}
1
+ {"version":3,"file":"Tag.js","names":["memo","useCallback","useContext","TagListContext","MuiPropsContext","jsx","_jsx","Tag","_ref","icon","isDisabled","label","onClick","onRemove","testId","chipElementType","renderTag","muiProps","_Chip","clickable","component","disabled","onDelete","Consumer","children","MemoizedTag","displayName"],"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 as MuiChip, ChipProps as MuiChipProps } from \"@mui/material\";\nimport { memo, ReactElement, useCallback, useContext } from \"react\";\nimport { TagListContext } from \"./TagListContext\";\nimport { MuiPropsContext } from \"./MuiPropsContext\";\nimport { SeleniumProps } from \"./SeleniumProps\";\n\nexport type TagProps = {\n icon?: ReactElement;\n isDisabled?: boolean;\n /**\n * The label text for the Tag\n */\n label: string;\n /**\n * Callback fired when the Tag is clicked\n */\n onClick?: MuiChipProps[\"onClick\"];\n /**\n * Callback fired when the remove button of the Tag is clicked\n */\n onRemove?: MuiChipProps[\"onDelete\"];\n} & SeleniumProps;\n\nconst Tag = ({\n icon,\n isDisabled,\n label,\n onClick,\n onRemove,\n testId,\n}: TagProps) => {\n const { chipElementType } = useContext(TagListContext);\n\n const renderTag = useCallback(\n (muiProps) => (\n <MuiChip\n {...muiProps}\n aria-disabled={isDisabled}\n clickable={onClick ? true : false}\n component={chipElementType}\n data-se={testId}\n disabled={isDisabled}\n icon={icon}\n label={label}\n onClick={onClick}\n onDelete={onRemove}\n />\n ),\n [chipElementType, icon, isDisabled, label, onClick, onRemove, testId]\n );\n\n return <MuiPropsContext.Consumer>{renderTag}</MuiPropsContext.Consumer>;\n};\n\nconst MemoizedTag = memo(Tag);\nMemoizedTag.displayName = \"Tag\";\n\nexport { MemoizedTag as Tag };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,SAASA,IAAI,EAAgBC,WAAW,EAAEC,UAAU,QAAQ,OAAO;AAAC,SAC3DC,cAAc;AAAA,SACdC,eAAe;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAoBxB,MAAMC,GAAG,GAAGC,IAAA,IAOI;EAAA,IAPH;IACXC,IAAI;IACJC,UAAU;IACVC,KAAK;IACLC,OAAO;IACPC,QAAQ;IACRC;EACQ,CAAC,GAAAN,IAAA;EACT,MAAM;IAAEO;EAAgB,CAAC,GAAGb,UAAU,CAACC,cAAc,CAAC;EAEtD,MAAMa,SAAS,GAAGf,WAAW,CAC1BgB,QAAQ,IACPX,IAAA,CAAAY,KAAA;IAAA,GACMD,QAAQ;IACZ,iBAAeP,UAAW;IAC1BS,SAAS,EAAEP,OAAO,GAAG,IAAI,GAAG,KAAM;IAClCQ,SAAS,EAAEL,eAAgB;IAC3B,WAASD,MAAO;IAChBO,QAAQ,EAAEX,UAAW;IACrBD,IAAI,EAAEA,IAAK;IACXE,KAAK,EAAEA,KAAM;IACbC,OAAO,EAAEA,OAAQ;IACjBU,QAAQ,EAAET;EAAS,CACpB,CACF,EACD,CAACE,eAAe,EAAEN,IAAI,EAAEC,UAAU,EAAEC,KAAK,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,MAAM,CACtE,CAAC;EAED,OAAOR,IAAA,CAACF,eAAe,CAACmB,QAAQ;IAAAC,QAAA,EAAER;EAAS,CAA2B,CAAC;AACzE,CAAC;AAED,MAAMS,WAAW,GAAGzB,IAAI,CAACO,GAAG,CAAC;AAC7BkB,WAAW,CAACC,WAAW,GAAG,KAAK;AAE/B,SAASD,WAAW,IAAIlB,GAAG"}