@okta/odyssey-react-mui 1.6.14 → 1.6.18

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,24 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.6.18](https://github.com/okta/odyssey/compare/v1.6.17...v1.6.18) (2023-11-15)
7
+
8
+ ### Bug Fixes
9
+
10
+ - shadow DOM function using wrong return value ([#2043](https://github.com/okta/odyssey/issues/2043)) ([c701afb](https://github.com/okta/odyssey/commit/c701afb6b43fd52cbfd486cbaa41fdde65b6ba30))
11
+
12
+ ## [1.6.17](https://github.com/okta/odyssey/compare/v1.6.16...v1.6.17) (2023-11-14)
13
+
14
+ **Note:** Version bump only for package @okta/odyssey-react-mui
15
+
16
+ ## [1.6.16](https://github.com/okta/odyssey/compare/v1.6.15...v1.6.16) (2023-11-13)
17
+
18
+ **Note:** Version bump only for package @okta/odyssey-react-mui
19
+
20
+ ## [1.6.15](https://github.com/okta/odyssey/compare/v1.6.14...v1.6.15) (2023-11-13)
21
+
22
+ **Note:** Version bump only for package @okta/odyssey-react-mui
23
+
6
24
  ## [1.6.14](https://github.com/okta/odyssey/compare/v1.6.13...v1.6.14) (2023-11-13)
7
25
 
8
26
  **Note:** Version bump only for package @okta/odyssey-react-mui
package/dist/Checkbox.js CHANGED
@@ -13,8 +13,9 @@ import _Checkbox from "@mui/material/Checkbox";
13
13
  */
14
14
 
15
15
  import { useTranslation } from "react-i18next";
16
- import { memo, useCallback, useMemo, useState } from "react";
16
+ import { memo, useCallback, useMemo } from "react";
17
17
  import { Typography } from "./Typography.js";
18
+ import { useControlledState } from "./useControlledState.js";
18
19
  import { jsxs as _jsxs } from "react/jsx-runtime";
19
20
  import { Fragment as _Fragment } from "react/jsx-runtime";
20
21
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -24,7 +25,8 @@ const Checkbox = _ref => {
24
25
  ariaLabel,
25
26
  ariaLabelledBy,
26
27
  id: idOverride,
27
- isDefaultChecked = false,
28
+ isChecked,
29
+ isDefaultChecked,
28
30
  isDisabled,
29
31
  isIndeterminate,
30
32
  isRequired,
@@ -38,7 +40,10 @@ const Checkbox = _ref => {
38
40
  const {
39
41
  t
40
42
  } = useTranslation();
41
- const [isCheckedValue, setIsCheckedValue] = useState(isDefaultChecked);
43
+ const [isLocalChecked, setIsLocalChecked] = useControlledState({
44
+ controlledValue: isChecked,
45
+ uncontrolledValue: isDefaultChecked
46
+ });
42
47
  const label = useMemo(() => {
43
48
  if (isRequired) {
44
49
  return _jsxs(_Fragment, {
@@ -55,16 +60,17 @@ const Checkbox = _ref => {
55
60
  }
56
61
  }, [isRequired, labelProp, t]);
57
62
  const onChange = useCallback((event, checked) => {
58
- setIsCheckedValue(event.target.checked);
63
+ setIsLocalChecked(checked);
59
64
  onChangeProp?.(event, checked);
60
- }, [onChangeProp]);
65
+ }, [onChangeProp, setIsLocalChecked]);
61
66
  return _jsx(_FormControlLabel, {
62
67
  "aria-label": ariaLabel,
63
68
  "aria-labelledby": ariaLabelledBy,
64
- checked: isCheckedValue,
65
69
  className: validity === "invalid" ? "Mui-error" : validity === "valid" ? "Mui-valid" : "",
66
70
  control: _jsx(_Checkbox, {
71
+ checked: isLocalChecked,
67
72
  indeterminate: isIndeterminate,
73
+ onChange: onChange,
68
74
  required: isRequired
69
75
  }),
70
76
  "data-se": testId,
@@ -72,7 +78,6 @@ const Checkbox = _ref => {
72
78
  id: idOverride,
73
79
  label: label,
74
80
  name: nameOverride ?? idOverride,
75
- onChange: onChange,
76
81
  value: value,
77
82
  required: isRequired
78
83
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.js","names":["useTranslation","memo","useCallback","useMemo","useState","Typography","jsxs","_jsxs","Fragment","_Fragment","jsx","_jsx","checkboxValidityValues","Checkbox","_ref","ariaLabel","ariaLabelledBy","id","idOverride","isDefaultChecked","isDisabled","isIndeterminate","isRequired","label","labelProp","name","nameOverride","onChange","onChangeProp","testId","validity","value","t","isCheckedValue","setIsCheckedValue","children","component","color","event","checked","target","_FormControlLabel","className","control","_Checkbox","indeterminate","required","disabled","MemoizedCheckbox","displayName"],"sources":["../src/Checkbox.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 { useTranslation } from \"react-i18next\";\nimport { memo, useCallback, useMemo, useState } from \"react\";\nimport {\n Checkbox as MuiCheckbox,\n CheckboxProps as MuiCheckboxProps,\n FormControlLabel,\n} from \"@mui/material\";\n\nimport { FieldComponentProps } from \"./FieldComponentProps\";\nimport { Typography } from \"./Typography\";\nimport type { SeleniumProps } from \"./SeleniumProps\";\n\nexport const checkboxValidityValues = [\"valid\", \"invalid\", \"inherit\"] as const;\n\nexport type CheckboxProps = {\n /**\n * The ARIA label for the Checkbox\n */\n ariaLabel?: string;\n /**\n * The ID of the element that labels the Checkbox\n */\n ariaLabelledBy?: string;\n /**\n * Determines whether the Checkbox is checked\n */\n isDefaultChecked?: boolean;\n /**\n * Determines whether the Checkbox is in an indeterminate state\n */\n isIndeterminate?: boolean;\n /**\n * Determines whether the Checkbox is required\n */\n isRequired?: boolean;\n /**\n * The label text for the Checkbox\n */\n label?: string;\n /**\n * The change event handler for the Checkbox\n */\n onChange?: MuiCheckboxProps[\"onChange\"];\n /**\n * The checkbox validity, if different from its enclosing group. Defaults to \"inherit\".\n */\n validity?: (typeof checkboxValidityValues)[number];\n /**\n * The value attribute of the Checkbox\n */\n value?: string;\n} & Pick<FieldComponentProps, \"id\" | \"isDisabled\" | \"name\"> &\n SeleniumProps;\n\nconst Checkbox = ({\n ariaLabel,\n ariaLabelledBy,\n id: idOverride,\n isDefaultChecked = false,\n isDisabled,\n isIndeterminate,\n isRequired,\n label: labelProp,\n name: nameOverride,\n onChange: onChangeProp,\n testId,\n validity = \"inherit\",\n value,\n}: CheckboxProps) => {\n const { t } = useTranslation();\n const [isCheckedValue, setIsCheckedValue] = useState(isDefaultChecked);\n\n const label = useMemo(() => {\n if (isRequired) {\n return (\n <>\n {labelProp}{\" \"}\n <Typography component=\"span\" color=\"textSecondary\">\n ({t(\"fieldlabel.required.text\")})\n </Typography>\n </>\n );\n } else {\n return <>{labelProp}</>;\n }\n }, [isRequired, labelProp, t]);\n\n const onChange = useCallback(\n (event, checked) => {\n setIsCheckedValue(event.target.checked);\n onChangeProp?.(event, checked);\n },\n [onChangeProp]\n );\n\n return (\n <FormControlLabel\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n checked={isCheckedValue}\n className={\n validity === \"invalid\"\n ? \"Mui-error\"\n : validity === \"valid\"\n ? \"Mui-valid\"\n : \"\"\n }\n control={\n <MuiCheckbox indeterminate={isIndeterminate} required={isRequired} />\n }\n data-se={testId}\n disabled={isDisabled}\n id={idOverride}\n label={label}\n name={nameOverride ?? idOverride}\n onChange={onChange}\n value={value}\n required={isRequired}\n />\n );\n};\n\nconst MemoizedCheckbox = memo(Checkbox);\nMemoizedCheckbox.displayName = \"Checkbox\";\n\nexport { MemoizedCheckbox as Checkbox };\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,cAAc,QAAQ,eAAe;AAC9C,SAASC,IAAI,EAAEC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAAC,SAQpDC,UAAU;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,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ChC,CAAC,EACD,CAACX,YAAY,CACf,CAAC;EAED,OACEjB,IAAA,CAAA8B,iBAAA;IACE,cAAY1B,SAAU;IACtB,mBAAiBC,cAAe;IAChCuB,OAAO,EAAEN,cAAe;IACxBS,SAAS,EACPZ,QAAQ,KAAK,SAAS,GAClB,WAAW,GACXA,QAAQ,KAAK,OAAO,GACpB,WAAW,GACX,EACL;IACDa,OAAO,EACLhC,IAAA,CAAAiC,SAAA;MAAaC,aAAa,EAAExB,eAAgB;MAACyB,QAAQ,EAAExB;IAAW,CAAE,CACrE;IACD,WAASO,MAAO;IAChBkB,QAAQ,EAAE3B,UAAW;IACrBH,EAAE,EAAEC,UAAW;IACfK,KAAK,EAAEA,KAAM;IACbE,IAAI,EAAEC,YAAY,IAAIR,UAAW;IACjCS,QAAQ,EAAEA,QAAS;IACnBI,KAAK,EAAEA,KAAM;IACbe,QAAQ,EAAExB;EAAW,CACtB,CAAC;AAEN,CAAC;AAED,MAAM0B,gBAAgB,GAAG/C,IAAI,CAACY,QAAQ,CAAC;AACvCmC,gBAAgB,CAACC,WAAW,GAAG,UAAU;AAEzC,SAASD,gBAAgB,IAAInC,QAAQ"}
1
+ {"version":3,"file":"Checkbox.js","names":["useTranslation","memo","useCallback","useMemo","Typography","useControlledState","jsxs","_jsxs","Fragment","_Fragment","jsx","_jsx","checkboxValidityValues","Checkbox","_ref","ariaLabel","ariaLabelledBy","id","idOverride","isChecked","isDefaultChecked","isDisabled","isIndeterminate","isRequired","label","labelProp","name","nameOverride","onChange","onChangeProp","testId","validity","value","t","isLocalChecked","setIsLocalChecked","controlledValue","uncontrolledValue","children","component","color","event","checked","_FormControlLabel","className","control","_Checkbox","indeterminate","required","disabled","MemoizedCheckbox","displayName"],"sources":["../src/Checkbox.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 { useTranslation } from \"react-i18next\";\nimport { memo, useCallback, useMemo } from \"react\";\nimport {\n Checkbox as MuiCheckbox,\n CheckboxProps as MuiCheckboxProps,\n FormControlLabel,\n} from \"@mui/material\";\n\nimport { FieldComponentProps } from \"./FieldComponentProps\";\nimport { Typography } from \"./Typography\";\nimport type { SeleniumProps } from \"./SeleniumProps\";\nimport { useControlledState } from \"./useControlledState\";\nimport { CheckedFieldProps } from \"./FormCheckedProps\";\n\nexport const checkboxValidityValues = [\"valid\", \"invalid\", \"inherit\"] as const;\n\nexport type CheckboxProps = {\n /**\n * The ARIA label for the Checkbox\n */\n ariaLabel?: string;\n /**\n * The ID of the element that labels the Checkbox\n */\n ariaLabelledBy?: string;\n /**\n * The id of the `input` element.\n */\n id?: string;\n /**\n * Determines whether the Checkbox is disabled\n */\n isDisabled?: boolean;\n /**\n * Determines whether the Checkbox is in an indeterminate state\n */\n isIndeterminate?: boolean;\n /**\n * Determines whether the Checkbox is required\n */\n isRequired?: boolean;\n /**\n * The label text for the Checkbox\n */\n label?: string;\n /**\n * The checkbox validity, if different from its enclosing group. Defaults to \"inherit\".\n */\n validity?: (typeof checkboxValidityValues)[number];\n /**\n * The value attribute of the Checkbox\n */\n value?: string;\n} & Pick<FieldComponentProps, \"id\" | \"isDisabled\" | \"name\"> &\n CheckedFieldProps<MuiCheckboxProps> &\n SeleniumProps;\n\nconst Checkbox = ({\n ariaLabel,\n ariaLabelledBy,\n id: idOverride,\n isChecked,\n isDefaultChecked,\n isDisabled,\n isIndeterminate,\n isRequired,\n label: labelProp,\n name: nameOverride,\n onChange: onChangeProp,\n testId,\n validity = \"inherit\",\n value,\n}: CheckboxProps) => {\n const { t } = useTranslation();\n const [isLocalChecked, setIsLocalChecked] = useControlledState({\n controlledValue: isChecked,\n uncontrolledValue: isDefaultChecked,\n });\n\n const label = useMemo(() => {\n if (isRequired) {\n return (\n <>\n {labelProp}{\" \"}\n <Typography component=\"span\" color=\"textSecondary\">\n ({t(\"fieldlabel.required.text\")})\n </Typography>\n </>\n );\n } else {\n return <>{labelProp}</>;\n }\n }, [isRequired, labelProp, t]);\n\n const onChange = useCallback<NonNullable<MuiCheckboxProps[\"onChange\"]>>(\n (event, checked) => {\n setIsLocalChecked(checked);\n onChangeProp?.(event, checked);\n },\n [onChangeProp, setIsLocalChecked]\n );\n\n return (\n <FormControlLabel\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n className={\n validity === \"invalid\"\n ? \"Mui-error\"\n : validity === \"valid\"\n ? \"Mui-valid\"\n : \"\"\n }\n control={\n <MuiCheckbox\n checked={isLocalChecked}\n indeterminate={isIndeterminate}\n onChange={onChange}\n required={isRequired}\n />\n }\n data-se={testId}\n disabled={isDisabled}\n id={idOverride}\n label={label}\n name={nameOverride ?? idOverride}\n value={value}\n required={isRequired}\n />\n );\n};\n\nconst MemoizedCheckbox = memo(Checkbox);\nMemoizedCheckbox.displayName = \"Checkbox\";\n\nexport { MemoizedCheckbox as Checkbox };\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,cAAc,QAAQ,eAAe;AAC9C,SAASC,IAAI,EAAEC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAAC,SAQ1CC,UAAU;AAAA,SAEVC,kBAAkB;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAG3B,OAAO,MAAMC,sBAAsB,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,CAAU;AA2C9E,MAAMC,QAAQ,GAAGC,IAAA,IAeI;EAAA,IAfH;IAChBC,SAAS;IACT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SAAS,EACPb,QAAQ,KAAK,SAAS,GAClB,WAAW,GACXA,QAAQ,KAAK,OAAO,GACpB,WAAW,GACX,EACL;IACDc,OAAO,EACLlC,IAAA,CAAAmC,SAAA;MACEJ,OAAO,EAAER,cAAe;MACxBa,aAAa,EAAEzB,eAAgB;MAC/BM,QAAQ,EAAEA,QAAS;MACnBoB,QAAQ,EAAEzB;IAAW,CACtB,CACF;IACD,WAASO,MAAO;IAChBmB,QAAQ,EAAE5B,UAAW;IACrBJ,EAAE,EAAEC,UAAW;IACfM,KAAK,EAAEA,KAAM;IACbE,IAAI,EAAEC,YAAY,IAAIT,UAAW;IACjCc,KAAK,EAAEA,KAAM;IACbgB,QAAQ,EAAEzB;EAAW,CACtB,CAAC;AAEN,CAAC;AAED,MAAM2B,gBAAgB,GAAGjD,IAAI,CAACY,QAAQ,CAAC;AACvCqC,gBAAgB,CAACC,WAAW,GAAG,UAAU;AAEzC,SAASD,gBAAgB,IAAIrC,QAAQ"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=FormCheckedProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormCheckedProps.js","names":[],"sources":["../src/FormCheckedProps.ts"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { SwitchBaseProps } from \"@mui/material/internal/SwitchBase\";\n\ntype SwitchOnChangeProp = Pick<SwitchBaseProps, \"onChange\">;\n\nexport type ControlledCheckedFieldProps<\n TogglableInputElement extends SwitchOnChangeProp\n> = {\n /**\n * Sets the checked state of the Checkbox\n */\n isChecked: boolean;\n /**\n * Determines whether the Checkbox is checked\n * Should not be used if `isChecked` is used\n */\n isDefaultChecked?: never;\n /**\n * The change event handler for the Checkbox\n * Must be used if `isChecked` is used\n */\n onChange: TogglableInputElement[\"onChange\"];\n};\n\nexport type UncontrolledCheckedFieldProps<\n TogglableInputElement extends SwitchOnChangeProp\n> = {\n /**\n * Sets the checked state of the Checkbox\n */\n isChecked?: never;\n /**\n * Determines whether the Checkbox is checked\n * Should not be used if `isChecked` is used\n */\n isDefaultChecked?: boolean;\n /**\n * The change event handler for the Checkbox\n * Must be used if `isChecked` is used\n */\n onChange?: TogglableInputElement[\"onChange\"];\n};\n\nexport type CheckedFieldProps<\n TogglableInputElement extends SwitchOnChangeProp\n> =\n | ControlledCheckedFieldProps<TogglableInputElement>\n | UncontrolledCheckedFieldProps<TogglableInputElement>;\n"],"mappings":""}
package/dist/Radio.js CHANGED
@@ -11,7 +11,7 @@ import _Radio from "@mui/material/Radio";
11
11
  *
12
12
  * See the License for the specific language governing permissions and limitations under the License.
13
13
  */
14
- import { memo } from "react";
14
+ import { memo, useCallback } from "react";
15
15
  import { jsx as _jsx } from "react/jsx-runtime";
16
16
  const Radio = _ref => {
17
17
  let {
@@ -21,12 +21,18 @@ const Radio = _ref => {
21
21
  label,
22
22
  name,
23
23
  testId,
24
- value
24
+ value,
25
+ onChange: onChangeProp
25
26
  } = _ref;
27
+ const onChange = useCallback((event, checked) => {
28
+ onChangeProp?.(event, checked);
29
+ }, [onChangeProp]);
26
30
  return _jsx(_FormControlLabel, {
27
31
  checked: isChecked,
28
32
  className: isInvalid ? "Mui-error" : "",
29
- control: _jsx(_Radio, {}),
33
+ control: _jsx(_Radio, {
34
+ onChange: onChange
35
+ }),
30
36
  "data-se": testId,
31
37
  disabled: isDisabled,
32
38
  label: label,
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","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 { FieldComponentProps } from \"./FieldComponentProps\";\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 has an invalid value\n */\n isInvalid?: boolean;\n /**\n * The label text for the Radio\n */\n label: string;\n /**\n * The value attribute of the Radio\n */\n value: string;\n} & Pick<FieldComponentProps, \"isDisabled\" | \"name\"> &\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;AA2B7B,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"}
1
+ {"version":3,"file":"Radio.js","names":["memo","useCallback","jsx","_jsx","Radio","_ref","isChecked","isDisabled","isInvalid","label","name","testId","value","onChange","onChangeProp","event","checked","_FormControlLabel","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 {\n FormControlLabel,\n Radio as MuiRadio,\n RadioProps as MuiRadioProps,\n} from \"@mui/material\";\nimport { memo, useCallback } from \"react\";\n\nimport { FieldComponentProps } from \"./FieldComponentProps\";\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 has an invalid value\n */\n isInvalid?: boolean;\n /**\n * The label text for the Radio\n */\n label: string;\n /**\n * The value attribute of the Radio\n */\n value: string;\n /**\n * Callback fired when the state is changed. Provides event and checked value.\n */\n onChange?: MuiRadioProps[\"onChange\"];\n} & Pick<FieldComponentProps, \"isDisabled\" | \"name\"> &\n SeleniumProps;\n\nconst Radio = ({\n isChecked,\n isDisabled,\n isInvalid,\n label,\n name,\n testId,\n value,\n onChange: onChangeProp,\n}: RadioProps) => {\n const onChange = useCallback<NonNullable<MuiRadioProps[\"onChange\"]>>(\n (event, checked) => {\n onChangeProp?.(event, checked);\n },\n [onChangeProp]\n );\n\n return (\n <FormControlLabel\n checked={isChecked}\n className={isInvalid ? \"Mui-error\" : \"\"}\n control={<MuiRadio onChange={onChange} />}\n data-se={testId}\n disabled={isDisabled}\n label={label}\n name={name}\n value={value}\n />\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;AAOA,SAASA,IAAI,EAAEC,WAAW,QAAQ,OAAO;AAAC,SAAAC,GAAA,IAAAC,IAAA;AA6B1C,MAAMC,KAAK,GAAGC,IAAA,IASI;EAAA,IATH;IACbC,SAAS;IACTC,UAAU;IACVC,SAAS;IACTC,KAAK;IACLC,IAAI;IACJC,MAAM;IACNC,KAAK;IACLC,QAAQ,EAAEC;EACA,CAAC,GAAAT,IAAA;EACX,MAAMQ,QAAQ,GAAGZ,WAAW,CAC1B,CAACc,KAAK,EAAEC,OAAO,KAAK;IAClBF,YAAY,GAAGC,KAAK,EAAEC,OAAO,CAAC;EAChC,CAAC,EACD,CAACF,YAAY,CACf,CAAC;EAED,OACEX,IAAA,CAAAc,iBAAA;IACED,OAAO,EAAEV,SAAU;IACnBY,SAAS,EAAEV,SAAS,GAAG,WAAW,GAAG,EAAG;IACxCW,OAAO,EAAEhB,IAAA,CAAAiB,MAAA;MAAUP,QAAQ,EAAEA;IAAS,CAAE,CAAE;IAC1C,WAASF,MAAO;IAChBU,QAAQ,EAAEd,UAAW;IACrBE,KAAK,EAAEA,KAAM;IACbC,IAAI,EAAEA,IAAK;IACXE,KAAK,EAAEA;EAAM,CACd,CAAC;AAEN,CAAC;AAED,MAAMU,aAAa,GAAGtB,IAAI,CAACI,KAAK,CAAC;AACjCkB,aAAa,CAACC,WAAW,GAAG,OAAO;AAEnC,SAASD,aAAa,IAAIlB,KAAK"}
@@ -12,6 +12,7 @@ import _RadioGroup from "@mui/material/RadioGroup";
12
12
  */
13
13
  import { memo, useCallback } from "react";
14
14
  import { Field } from "./Field.js";
15
+ import { useControlledState } from "./useControlledState.js";
15
16
  import { jsx as _jsx } from "react/jsx-runtime";
16
17
  const RadioGroup = _ref => {
17
18
  let {
@@ -23,10 +24,18 @@ const RadioGroup = _ref => {
23
24
  isDisabled,
24
25
  label,
25
26
  name: nameOverride,
26
- onChange,
27
+ onChange: onChangeProp,
27
28
  testId,
28
29
  value
29
30
  } = _ref;
31
+ const [localValue, setLocalValue] = useControlledState({
32
+ controlledValue: value,
33
+ uncontrolledValue: defaultValue
34
+ });
35
+ const onChange = useCallback((event, value) => {
36
+ setLocalValue(value);
37
+ onChangeProp?.(event, value);
38
+ }, [onChangeProp, setLocalValue]);
30
39
  const renderFieldComponent = useCallback(_ref2 => {
31
40
  let {
32
41
  ariaDescribedBy,
@@ -43,10 +52,10 @@ const RadioGroup = _ref => {
43
52
  id: id,
44
53
  name: nameOverride ?? id,
45
54
  onChange: onChange,
46
- value: value,
55
+ value: localValue,
47
56
  children: children
48
57
  });
49
- }, [children, defaultValue, nameOverride, onChange, testId, value]);
58
+ }, [children, defaultValue, nameOverride, onChange, testId, localValue]);
50
59
  return _jsx(Field, {
51
60
  errorMessage: errorMessage,
52
61
  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","name","nameOverride","onChange","testId","value","renderFieldComponent","_ref2","ariaDescribedBy","errorMessageElementId","labelElementId","_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 {\n RadioGroup as MuiRadioGroup,\n type RadioGroupProps as MuiRadioGroupProps,\n} from \"@mui/material\";\nimport { memo, ReactElement, useCallback } from \"react\";\n\nimport { Radio, RadioProps } from \"./Radio\";\nimport { Field } from \"./Field\";\nimport { FieldComponentProps } from \"./FieldComponentProps\";\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 text label for the RadioGroup\n */\n label: string;\n /**\n * Listen for changes in the browser that change `value`\n */\n onChange?: MuiRadioGroupProps[\"onChange\"];\n /**\n * The `value` on the selected Radio\n */\n value?: RadioProps[\"value\"];\n} & Pick<\n FieldComponentProps,\n \"errorMessage\" | \"hint\" | \"id\" | \"isDisabled\" | \"name\"\n> &\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, errorMessageElementId, id, labelElementId }) => (\n <MuiRadioGroup\n aria-describedby={ariaDescribedBy}\n aria-errormessage={errorMessageElementId}\n aria-labelledby={labelElementId}\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;AAMA,SAASA,IAAI,EAAgBC,WAAW,QAAQ,OAAO;AAAC,SAG/CC,KAAK;AAAA,SAAAC,GAAA,IAAAC,IAAA;AA+Bd,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;MAAEC,qBAAqB;MAAEZ,EAAE;MAAEa;IAAe,CAAC,GAAAH,KAAA;IAAA,OAC7DjB,IAAA,CAAAqB,WAAA;MACE,oBAAkBH,eAAgB;MAClC,qBAAmBC,qBAAsB;MACzC,mBAAiBC,cAAe;MAChC,WAASN,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;IAC3BiB,SAAS,EAAC,OAAO;IACjBC,eAAe,EAAE,KAAM;IACvBjB,IAAI,EAAEA,IAAK;IACXC,EAAE,EAAEC,UAAW;IACfC,UAAU,EAAEA,UAAW;IACvBC,KAAK,EAAEA,KAAM;IACbM,oBAAoB,EAAEA;EAAqB,CAC5C,CAAC;AAEN,CAAC;AAED,MAAMQ,kBAAkB,GAAG5B,IAAI,CAACK,UAAU,CAAC;AAC3CuB,kBAAkB,CAACC,WAAW,GAAG,YAAY;AAE7C,SAASD,kBAAkB,IAAIvB,UAAU"}
1
+ {"version":3,"file":"RadioGroup.js","names":["memo","useCallback","Field","useControlledState","jsx","_jsx","RadioGroup","_ref","children","defaultValue","errorMessage","hint","id","idOverride","isDisabled","label","name","nameOverride","onChange","onChangeProp","testId","value","localValue","setLocalValue","controlledValue","uncontrolledValue","event","renderFieldComponent","_ref2","ariaDescribedBy","errorMessageElementId","labelElementId","_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 {\n RadioGroup as MuiRadioGroup,\n type RadioGroupProps as MuiRadioGroupProps,\n} from \"@mui/material\";\nimport { memo, ReactElement, useCallback } from \"react\";\n\nimport { Radio, RadioProps } from \"./Radio\";\nimport { Field } from \"./Field\";\nimport { FieldComponentProps } from \"./FieldComponentProps\";\nimport type { SeleniumProps } from \"./SeleniumProps\";\nimport { useControlledState } from \"./useControlledState\";\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 text label for the RadioGroup\n */\n label: string;\n /**\n * Listen for changes in the browser that change `value`\n */\n onChange?: MuiRadioGroupProps[\"onChange\"];\n /**\n * The `value` on the selected Radio\n */\n value?: RadioProps[\"value\"];\n} & Pick<\n FieldComponentProps,\n \"errorMessage\" | \"hint\" | \"id\" | \"isDisabled\" | \"name\"\n> &\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: onChangeProp,\n testId,\n value,\n}: RadioGroupProps) => {\n const [localValue, setLocalValue] = useControlledState({\n controlledValue: value,\n uncontrolledValue: defaultValue,\n });\n\n const onChange = useCallback<NonNullable<MuiRadioGroupProps[\"onChange\"]>>(\n (event, value) => {\n setLocalValue(value);\n onChangeProp?.(event, value);\n },\n [onChangeProp, setLocalValue]\n );\n const renderFieldComponent = useCallback(\n ({ ariaDescribedBy, errorMessageElementId, id, labelElementId }) => (\n <MuiRadioGroup\n aria-describedby={ariaDescribedBy}\n aria-errormessage={errorMessageElementId}\n aria-labelledby={labelElementId}\n data-se={testId}\n defaultValue={defaultValue}\n id={id}\n name={nameOverride ?? id}\n onChange={onChange}\n value={localValue}\n >\n {children}\n </MuiRadioGroup>\n ),\n [children, defaultValue, nameOverride, onChange, testId, localValue]\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;AAMA,SAASA,IAAI,EAAgBC,WAAW,QAAQ,OAAO;AAAC,SAG/CC,KAAK;AAAA,SAGLC,kBAAkB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AA6B3B,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,EAAEC,YAAY;IACtBC,MAAM;IACNC;EACe,CAAC,GAAAd,IAAA;EAChB,MAAM,CAACe,UAAU,EAAEC,aAAa,CAAC,GAAGpB,kBAAkB,CAAC;IACrDqB,eAAe,EAAEH,KAAK;IACtBI,iBAAiB,EAAEhB;EACrB,CAAC,CAAC;EAEF,MAAMS,QAAQ,GAAGjB,WAAW,CAC1B,CAACyB,KAAK,EAAEL,KAAK,KAAK;IAChBE,aAAa,CAACF,KAAK,CAAC;IACpBF,YAAY,GAAGO,KAAK,EAAEL,KAAK,CAAC;EAC9B,CAAC,EACD,CAACF,YAAY,EAAEI,aAAa,CAC9B,CAAC;EACD,MAAMI,oBAAoB,GAAG1B,WAAW,CACtC2B,KAAA;IAAA,IAAC;MAAEC,eAAe;MAAEC,qBAAqB;MAAElB,EAAE;MAAEmB;IAAe,CAAC,GAAAH,KAAA;IAAA,OAC7DvB,IAAA,CAAA2B,WAAA;MACE,oBAAkBH,eAAgB;MAClC,qBAAmBC,qBAAsB;MACzC,mBAAiBC,cAAe;MAChC,WAASX,MAAO;MAChBX,YAAY,EAAEA,YAAa;MAC3BG,EAAE,EAAEA,EAAG;MACPI,IAAI,EAAEC,YAAY,IAAIL,EAAG;MACzBM,QAAQ,EAAEA,QAAS;MACnBG,KAAK,EAAEC,UAAW;MAAAd,QAAA,EAEjBA;IAAQ,CACI,CAAC;EAAA,CACjB,EACD,CAACA,QAAQ,EAAEC,YAAY,EAAEQ,YAAY,EAAEC,QAAQ,EAAEE,MAAM,EAAEE,UAAU,CACrE,CAAC;EAED,OACEjB,IAAA,CAACH,KAAK;IACJQ,YAAY,EAAEA,YAAa;IAC3BuB,SAAS,EAAC,OAAO;IACjBC,eAAe,EAAE,KAAM;IACvBvB,IAAI,EAAEA,IAAK;IACXC,EAAE,EAAEC,UAAW;IACfC,UAAU,EAAEA,UAAW;IACvBC,KAAK,EAAEA,KAAM;IACbY,oBAAoB,EAAEA;EAAqB,CAC5C,CAAC;AAEN,CAAC;AAED,MAAMQ,kBAAkB,GAAGnC,IAAI,CAACM,UAAU,CAAC;AAC3C6B,kBAAkB,CAACC,WAAW,GAAG,YAAY;AAE7C,SAASD,kBAAkB,IAAI7B,UAAU"}
@@ -14,8 +14,8 @@ export const createShadowRootElement = containerElement => {
14
14
  const shadowRoot = containerElement.attachShadow({
15
15
  mode: "open"
16
16
  });
17
- const ShadowRootElement = document.createElement("div");
18
- shadowRoot.append(ShadowRootElement);
19
- return createShadowRootElement;
17
+ const shadowRootElement = document.createElement("div");
18
+ shadowRoot.append(shadowRootElement);
19
+ return shadowRoot;
20
20
  };
21
21
  //# sourceMappingURL=createShadowRootElement.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createShadowRootElement.js","names":["createShadowRootElement","containerElement","shadowRoot","attachShadow","mode","ShadowRootElement","document","createElement","append"],"sources":["../src/createShadowRootElement.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 const createShadowRootElement = (containerElement: HTMLElement) => {\n const shadowRoot = containerElement.attachShadow({ mode: \"open\" });\n\n const ShadowRootElement = document.createElement(\"div\");\n\n shadowRoot.append(ShadowRootElement);\n\n return createShadowRootElement;\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,uBAAuB,GAAIC,gBAA6B,IAAK;EACxE,MAAMC,UAAU,GAAGD,gBAAgB,CAACE,YAAY,CAAC;IAAEC,IAAI,EAAE;EAAO,CAAC,CAAC;EAElE,MAAMC,iBAAiB,GAAGC,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;EAEvDL,UAAU,CAACM,MAAM,CAACH,iBAAiB,CAAC;EAEpC,OAAOL,uBAAuB;AAChC,CAAC"}
1
+ {"version":3,"file":"createShadowRootElement.js","names":["createShadowRootElement","containerElement","shadowRoot","attachShadow","mode","shadowRootElement","document","createElement","append"],"sources":["../src/createShadowRootElement.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 const createShadowRootElement = (containerElement: HTMLElement) => {\n const shadowRoot = containerElement.attachShadow({ mode: \"open\" });\n\n const shadowRootElement = document.createElement(\"div\");\n\n shadowRoot.append(shadowRootElement);\n\n return shadowRoot;\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,uBAAuB,GAAIC,gBAA6B,IAAK;EACxE,MAAMC,UAAU,GAAGD,gBAAgB,CAACE,YAAY,CAAC;IAAEC,IAAI,EAAE;EAAO,CAAC,CAAC;EAElE,MAAMC,iBAAiB,GAAGC,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;EAEvDL,UAAU,CAACM,MAAM,CAACH,iBAAiB,CAAC;EAEpC,OAAOH,UAAU;AACnB,CAAC"}
@@ -13,6 +13,7 @@
13
13
  import { CheckboxProps as MuiCheckboxProps } from "@mui/material";
14
14
  import { FieldComponentProps } from "./FieldComponentProps";
15
15
  import type { SeleniumProps } from "./SeleniumProps";
16
+ import { CheckedFieldProps } from "./FormCheckedProps";
16
17
  export declare const checkboxValidityValues: readonly ["valid", "invalid", "inherit"];
17
18
  export type CheckboxProps = {
18
19
  /**
@@ -24,9 +25,13 @@ export type CheckboxProps = {
24
25
  */
25
26
  ariaLabelledBy?: string;
26
27
  /**
27
- * Determines whether the Checkbox is checked
28
+ * The id of the `input` element.
28
29
  */
29
- isDefaultChecked?: boolean;
30
+ id?: string;
31
+ /**
32
+ * Determines whether the Checkbox is disabled
33
+ */
34
+ isDisabled?: boolean;
30
35
  /**
31
36
  * Determines whether the Checkbox is in an indeterminate state
32
37
  */
@@ -39,10 +44,6 @@ export type CheckboxProps = {
39
44
  * The label text for the Checkbox
40
45
  */
41
46
  label?: string;
42
- /**
43
- * The change event handler for the Checkbox
44
- */
45
- onChange?: MuiCheckboxProps["onChange"];
46
47
  /**
47
48
  * The checkbox validity, if different from its enclosing group. Defaults to "inherit".
48
49
  */
@@ -51,7 +52,7 @@ export type CheckboxProps = {
51
52
  * The value attribute of the Checkbox
52
53
  */
53
54
  value?: string;
54
- } & Pick<FieldComponentProps, "id" | "isDisabled" | "name"> & SeleniumProps;
55
- declare const MemoizedCheckbox: import("react").MemoExoticComponent<({ ariaLabel, ariaLabelledBy, id: idOverride, isDefaultChecked, isDisabled, isIndeterminate, isRequired, label: labelProp, name: nameOverride, onChange: onChangeProp, testId, validity, value, }: CheckboxProps) => JSX.Element>;
55
+ } & Pick<FieldComponentProps, "id" | "isDisabled" | "name"> & CheckedFieldProps<MuiCheckboxProps> & SeleniumProps;
56
+ declare const MemoizedCheckbox: import("react").MemoExoticComponent<({ ariaLabel, ariaLabelledBy, id: idOverride, isChecked, isDefaultChecked, isDisabled, isIndeterminate, isRequired, label: labelProp, name: nameOverride, onChange: onChangeProp, testId, validity, value, }: CheckboxProps) => JSX.Element>;
56
57
  export { MemoizedCheckbox as Checkbox };
57
58
  //# sourceMappingURL=Checkbox.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../src/Checkbox.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;;AAIH,OAAO,EAEL,aAAa,IAAI,gBAAgB,EAElC,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,eAAO,MAAM,sBAAsB,0CAA2C,CAAC;AAE/E,MAAM,MAAM,aAAa,GAAG;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC;IACxC;;OAEG;IACH,QAAQ,CAAC,EAA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AG,YAAY,GAAG,MAAM,CAAC,GACzD,iBAAiB,CAAC,gBAAgB,CAAC,GACnC,aAAa,CAAC;AA6EhB,QAAA,MAAM,gBAAgB,oPA5DnB,aAAa,iBA4DuB,CAAC;AAGxC,OAAO,EAAE,gBAAgB,IAAI,QAAQ,EAAE,CAAC"}
@@ -0,0 +1,48 @@
1
+ /*!
2
+ * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.
3
+ * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
4
+ *
5
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
6
+ * Unless required by applicable law or agreed to in writing, software
7
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
8
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9
+ *
10
+ * See the License for the specific language governing permissions and limitations under the License.
11
+ */
12
+ import { SwitchBaseProps } from "@mui/material/internal/SwitchBase";
13
+ type SwitchOnChangeProp = Pick<SwitchBaseProps, "onChange">;
14
+ export type ControlledCheckedFieldProps<TogglableInputElement extends SwitchOnChangeProp> = {
15
+ /**
16
+ * Sets the checked state of the Checkbox
17
+ */
18
+ isChecked: boolean;
19
+ /**
20
+ * Determines whether the Checkbox is checked
21
+ * Should not be used if `isChecked` is used
22
+ */
23
+ isDefaultChecked?: never;
24
+ /**
25
+ * The change event handler for the Checkbox
26
+ * Must be used if `isChecked` is used
27
+ */
28
+ onChange: TogglableInputElement["onChange"];
29
+ };
30
+ export type UncontrolledCheckedFieldProps<TogglableInputElement extends SwitchOnChangeProp> = {
31
+ /**
32
+ * Sets the checked state of the Checkbox
33
+ */
34
+ isChecked?: never;
35
+ /**
36
+ * Determines whether the Checkbox is checked
37
+ * Should not be used if `isChecked` is used
38
+ */
39
+ isDefaultChecked?: boolean;
40
+ /**
41
+ * The change event handler for the Checkbox
42
+ * Must be used if `isChecked` is used
43
+ */
44
+ onChange?: TogglableInputElement["onChange"];
45
+ };
46
+ export type CheckedFieldProps<TogglableInputElement extends SwitchOnChangeProp> = ControlledCheckedFieldProps<TogglableInputElement> | UncontrolledCheckedFieldProps<TogglableInputElement>;
47
+ export {};
48
+ //# sourceMappingURL=FormCheckedProps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormCheckedProps.d.ts","sourceRoot":"","sources":["../../src/FormCheckedProps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEpE,KAAK,kBAAkB,GAAG,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;AAE5D,MAAM,MAAM,2BAA2B,CACrC,qBAAqB,SAAS,kBAAkB,IAC9C;IACF;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,KAAK,CAAC;IACzB;;;OAGG;IACH,QAAQ,EAAE,qBAAqB,CAAC,UAAU,CAAC,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,6BAA6B,CACvC,qBAAqB,SAAS,kBAAkB,IAC9C;IACF;;OAEG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC;IAClB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,EAAE,qBAAqB,CAAC,UAAU,CAAC,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,iBAAiB,CAC3B,qBAAqB,SAAS,kBAAkB,IAE9C,2BAA2B,CAAC,qBAAqB,CAAC,GAClD,6BAA6B,CAAC,qBAAqB,CAAC,CAAC"}
@@ -10,6 +10,7 @@
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
12
  /// <reference types="react" />
13
+ import { RadioProps as MuiRadioProps } from "@mui/material";
13
14
  import { FieldComponentProps } from "./FieldComponentProps";
14
15
  import type { SeleniumProps } from "./SeleniumProps";
15
16
  export type RadioProps = {
@@ -29,7 +30,11 @@ export type RadioProps = {
29
30
  * The value attribute of the Radio
30
31
  */
31
32
  value: string;
33
+ /**
34
+ * Callback fired when the state is changed. Provides event and checked value.
35
+ */
36
+ onChange?: MuiRadioProps["onChange"];
32
37
  } & Pick<FieldComponentProps, "isDisabled" | "name"> & SeleniumProps;
33
- declare const MemoizedRadio: import("react").MemoExoticComponent<({ isChecked, isDisabled, isInvalid, label, name, testId, value, }: RadioProps) => JSX.Element>;
38
+ declare const MemoizedRadio: import("react").MemoExoticComponent<({ isChecked, isDisabled, isInvalid, label, name, testId, value, onChange: onChangeProp, }: RadioProps) => JSX.Element>;
34
39
  export { MemoizedRadio as Radio };
35
40
  //# sourceMappingURL=Radio.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Radio.d.ts","sourceRoot":"","sources":["../../src/Radio.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;;AAOH,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,MAAM,UAAU,GAAG;IACvB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,IAAI,CAAC,mBAAmB,EAAE,YAAY,GAAG,MAAM,CAAC,GAClD,aAAa,CAAC;AAuBhB,QAAA,MAAM,aAAa,0GAbhB,UAAU,iBAaoB,CAAC;AAGlC,OAAO,EAAE,aAAa,IAAI,KAAK,EAAE,CAAC"}
1
+ {"version":3,"file":"Radio.d.ts","sourceRoot":"","sources":["../../src/Radio.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;;AAEH,OAAO,EAGL,UAAU,IAAI,aAAa,EAC5B,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,MAAM,UAAU,GAAG;IACvB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,QAAQ,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;CACtC,GAAG,IAAI,CAAC,mBAAmB,EAAE,YAAY,GAAG,MAAM,CAAC,GAClD,aAAa,CAAC;AAiChB,QAAA,MAAM,aAAa,kIAtBhB,UAAU,iBAsBoB,CAAC;AAGlC,OAAO,EAAE,aAAa,IAAI,KAAK,EAAE,CAAC"}
@@ -36,6 +36,6 @@ export type RadioGroupProps = {
36
36
  */
37
37
  value?: RadioProps["value"];
38
38
  } & Pick<FieldComponentProps, "errorMessage" | "hint" | "id" | "isDisabled" | "name"> & SeleniumProps;
39
- declare const MemoizedRadioGroup: import("react").MemoExoticComponent<({ children, defaultValue, errorMessage, hint, id: idOverride, isDisabled, label, name: nameOverride, onChange, testId, value, }: RadioGroupProps) => JSX.Element>;
39
+ declare const MemoizedRadioGroup: import("react").MemoExoticComponent<({ children, defaultValue, errorMessage, hint, id: idOverride, isDisabled, label, name: nameOverride, onChange: onChangeProp, testId, value, }: RadioGroupProps) => JSX.Element>;
40
40
  export { MemoizedRadioGroup as RadioGroup };
41
41
  //# sourceMappingURL=RadioGroup.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RadioGroup.d.ts","sourceRoot":"","sources":["../../src/RadioGroup.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAEL,KAAK,eAAe,IAAI,kBAAkB,EAC3C,MAAM,eAAe,CAAC;AACvB,OAAO,EAAQ,YAAY,EAAe,M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YAAY,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC;IAC5C;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,QAAQ,CAAC,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAC;IAC1C;;OAEG;IACH,KAAK,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;CAC7B,GAAG,IAAI,CACN,mBAAmB,EACnB,cAAc,GAAG,MAAM,GAAG,IAAI,GAAG,YAAY,GAAG,MAAM,CACvD,GACC,aAAa,CAAC;AA4DhB,QAAA,MAAM,kBAAkB,sLA9CrB,eAAe,iBA8CyB,CAAC;AAG5C,OAAO,EAAE,kBAAkB,IAAI,UAAU,EAAE,CAAC"}
@@ -9,5 +9,5 @@
9
9
  *
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
- export declare const createShadowRootElement: (containerElement: HTMLElement) => any;
12
+ export declare const createShadowRootElement: (containerElement: HTMLElement) => ShadowRoot;
13
13
  //# sourceMappingURL=createShadowRootElement.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createShadowRootElement.d.ts","sourceRoot":"","sources":["../../src/createShadowRootElement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,eAAO,MAAM,uBAAuB,qBAAsB,WAAW,QAQpE,CAAC"}
1
+ {"version":3,"file":"createShadowRootElement.d.ts","sourceRoot":"","sources":["../../src/createShadowRootElement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,eAAO,MAAM,uBAAuB,qBAAsB,WAAW,eAQpE,CAAC"}
@@ -0,0 +1,28 @@
1
+ /*!
2
+ * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.
3
+ * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
4
+ *
5
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
6
+ * Unless required by applicable law or agreed to in writing, software
7
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
8
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9
+ *
10
+ * See the License for the specific language governing permissions and limitations under the License.
11
+ */
12
+ /// <reference types="react" />
13
+ type UseControlledStateProps<Value> = {
14
+ controlledValue?: Value;
15
+ uncontrolledValue?: Value;
16
+ };
17
+ /**
18
+ * Use the same way as `useState`. Returns a stateful value, and a function to update it.
19
+ * When `initialState` is passed, the returned function to update it does nothing. This is
20
+ * useful to handle values in components that may be controlled externally when that value is
21
+ * passed in props and thus wish to prevent internal updates of the same value.
22
+ *
23
+ * @param initialState
24
+ * @see https://react.dev/reference/react/useState
25
+ */
26
+ export declare const useControlledState: <Value>({ controlledValue, uncontrolledValue, }: UseControlledStateProps<Value>) => readonly [Value | undefined, import("react").Dispatch<import("react").SetStateAction<Value | undefined>>];
27
+ export {};
28
+ //# sourceMappingURL=useControlledState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useControlledState.d.ts","sourceRoot":"","sources":["../../src/useControlledState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;;AAIH,KAAK,uBAAuB,CAAC,KAAK,IAAI;IACpC,eAAe,CAAC,EAAE,KAAK,CAAC;IACxB,iBAAiB,CAAC,EAAE,KAAK,CAAC;CAC3B,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,+LA2B9B,CAAC"}