@okta/odyssey-react-mui 1.6.18 → 1.6.20

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,14 @@
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.20](https://github.com/okta/odyssey/compare/v1.6.19...v1.6.20) (2023-11-28)
7
+
8
+ **Note:** Version bump only for package @okta/odyssey-react-mui
9
+
10
+ ## [1.6.19](https://github.com/okta/odyssey/compare/v1.6.18...v1.6.19) (2023-11-20)
11
+
12
+ **Note:** Version bump only for package @okta/odyssey-react-mui
13
+
6
14
  ## [1.6.18](https://github.com/okta/odyssey/compare/v1.6.17...v1.6.18) (2023-11-15)
7
15
 
8
16
  ### Bug Fixes
@@ -11,14 +11,17 @@ import _InputBase from "@mui/material/InputBase";
11
11
  *
12
12
  * See the License for the specific language governing permissions and limitations under the License.
13
13
  */
14
- import { memo, useCallback } from "react";
14
+ import { memo, useCallback, useMemo } from "react";
15
15
  import { Field } from "./Field.js";
16
+ import { useControlledState } from "./useControlledState.js";
16
17
  import { jsx as _jsx } from "react/jsx-runtime";
17
18
  const Autocomplete = _ref => {
18
19
  let {
20
+ defaultValue,
19
21
  errorMessage,
20
22
  hasMultipleChoices,
21
23
  id: idOverride,
24
+ inputValue,
22
25
  isCustomValueAllowed,
23
26
  isDisabled,
24
27
  isLoading,
@@ -28,11 +31,12 @@ const Autocomplete = _ref => {
28
31
  label,
29
32
  name: nameOverride,
30
33
  onBlur,
31
- onChange,
32
- onInputChange,
34
+ onChange: onChangeProp,
35
+ onInputChange: onInputChangeProp,
33
36
  onFocus,
34
37
  options,
35
38
  value,
39
+ getIsOptionEqualToValue,
36
40
  testId
37
41
  } = _ref;
38
42
  const renderInput = useCallback(_ref2 => {
@@ -72,9 +76,32 @@ const Autocomplete = _ref => {
72
76
  }
73
77
  });
74
78
  }, [errorMessage, hint, isOptional, label, nameOverride]);
79
+ const defaultValuesProp = useMemo(() => {
80
+ if (hasMultipleChoices) {
81
+ return defaultValue === undefined ? [] : defaultValue;
82
+ }
83
+ return defaultValue ?? undefined;
84
+ }, [defaultValue, hasMultipleChoices]);
85
+ const [localValue, setLocalValue] = useControlledState({
86
+ controlledValue: value,
87
+ uncontrolledValue: defaultValuesProp
88
+ });
89
+ const [localInputValue, setLocalInputValue] = useControlledState({
90
+ controlledValue: inputValue,
91
+ uncontrolledValue: undefined
92
+ });
93
+ const onChange = useCallback((event, value, reason, details) => {
94
+ setLocalValue(value);
95
+ onChangeProp?.(event, value, reason, details);
96
+ }, [onChangeProp, setLocalValue]);
97
+ const onInputChange = useCallback((event, value, reason) => {
98
+ setLocalInputValue(value);
99
+ onInputChangeProp?.(event, value, reason);
100
+ }, [onInputChangeProp, setLocalInputValue]);
75
101
  return _jsx(_Autocomplete, {
76
102
  "aria-disabled": isDisabled,
77
103
  "data-se": testId,
104
+ defaultValue: defaultValuesProp,
78
105
  disableCloseOnSelect: hasMultipleChoices,
79
106
  disabled: isDisabled,
80
107
  freeSolo: isCustomValueAllowed,
@@ -89,7 +116,9 @@ const Autocomplete = _ref => {
89
116
  options: options,
90
117
  readOnly: isReadOnly,
91
118
  renderInput: renderInput,
92
- value: value
119
+ value: localValue,
120
+ inputValue: localInputValue,
121
+ isOptionEqualToValue: getIsOptionEqualToValue
93
122
  });
94
123
  };
95
124
  const MemoizedAutocomplete = memo(Autocomplete);
@@ -1 +1 @@
1
- {"version":3,"file":"Autocomplete.js","names":["memo","useCallback","Field","jsx","_jsx","Autocomplete","_ref","errorMessage","hasMultipleChoices","id","idOverride","isCustomValueAllowed","isDisabled","isLoading","isOptional","isReadOnly","hint","label","name","nameOverride","onBlur","onChange","onInputChange","onFocus","options","value","testId","renderInput","_ref2","InputLabelProps","InputProps","params","fieldType","hasVisibleLabel","htmlFor","renderFieldComponent","_ref3","ariaDescribedBy","errorMessageElementId","labelElementId","_InputBase","inputProps","required","_Autocomplete","disableCloseOnSelect","disabled","freeSolo","filterSelectedOptions","loading","multiple","readOnly","MemoizedAutocomplete","displayName"],"sources":["../src/Autocomplete.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport {\n Autocomplete as MuiAutocomplete,\n AutocompleteProps as MuiAutocompleteProps,\n InputBase,\n} from \"@mui/material\";\nimport { memo, useCallback } from \"react\";\n\nimport { Field } from \"./Field\";\nimport { FieldComponentProps } from \"./FieldComponentProps\";\nimport type { SeleniumProps } from \"./SeleniumProps\";\n\nexport type AutocompleteProps<\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined\n> = {\n /**\n * Enables multiple choice selection\n */\n hasMultipleChoices?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"multiple\"];\n /**\n * Allows the input of custom values\n */\n isCustomValueAllowed?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"freeSolo\"];\n /**\n * Disables the Autocomplete input\n */\n isDisabled?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"disabled\"];\n /**\n * Displays a loading indicator\n */\n isLoading?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"loading\"];\n /**\n * Makes the Autocomplete input read-only\n */\n isReadOnly?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"readOnly\"];\n /**\n * The label text for the autocomplete input\n */\n label: string;\n /**\n * Callback fired when the autocomplete loses focus.\n */\n onBlur?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onBlur\"];\n /**\n * Callback fired when a selection is made.\n */\n onChange?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onChange\"];\n /**\n * Callback fired when the textbox receives typed characters.\n */\n onInputChange?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onInputChange\"];\n /**\n * Callback fired when the autocomplete gains focus.\n */\n onFocus?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onFocus\"];\n /**\n * The options for the Autocomplete input\n */\n options: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"options\"];\n /**\n * The value of the Autocomplete input\n */\n value?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"value\"];\n} & Pick<\n FieldComponentProps,\n \"errorMessage\" | \"hint\" | \"id\" | \"isOptional\" | \"name\"\n> &\n SeleniumProps;\n\nconst Autocomplete = <\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined\n>({\n errorMessage,\n hasMultipleChoices,\n id: idOverride,\n isCustomValueAllowed,\n isDisabled,\n isLoading,\n isOptional = false,\n isReadOnly,\n hint,\n label,\n name: nameOverride,\n onBlur,\n onChange,\n onInputChange,\n onFocus,\n options,\n value,\n testId,\n}: AutocompleteProps<OptionType, HasMultipleChoices, IsCustomValueAllowed>) => {\n const renderInput = useCallback(\n ({ InputLabelProps, InputProps, ...params }) => (\n <Field\n errorMessage={errorMessage}\n fieldType=\"single\"\n hasVisibleLabel\n id={InputLabelProps.htmlFor}\n hint={hint}\n label={label}\n isOptional={isOptional}\n renderFieldComponent={({\n ariaDescribedBy,\n id,\n errorMessageElementId,\n labelElementId,\n }) => (\n <InputBase\n {...params}\n {...InputProps}\n inputProps={{\n ...params.inputProps,\n \"aria-errormessage\": errorMessageElementId,\n \"aria-labelledby\": labelElementId,\n }}\n aria-describedby={ariaDescribedBy}\n id={id}\n name={nameOverride ?? id}\n required={!isOptional}\n />\n )}\n />\n ),\n [errorMessage, hint, isOptional, label, nameOverride]\n );\n\n return (\n <MuiAutocomplete\n // AutoComplete is wrapped in a div within MUI which does not get the disabled attr. So this aria-disabled gets set in the div\n aria-disabled={isDisabled}\n data-se={testId}\n disableCloseOnSelect={hasMultipleChoices}\n disabled={isDisabled}\n freeSolo={isCustomValueAllowed}\n filterSelectedOptions={true}\n id={idOverride}\n loading={isLoading}\n multiple={hasMultipleChoices}\n onBlur={onBlur}\n onChange={onChange}\n onInputChange={onInputChange}\n onFocus={onFocus}\n options={options}\n readOnly={isReadOnly}\n renderInput={renderInput}\n value={value}\n />\n );\n};\n\n// Need the `typeof Autocomplete` because generics don't get passed through\nconst MemoizedAutocomplete = memo(Autocomplete) as typeof Autocomplete;\n// @ts-expect-error displayName is expected to not be on `typeof Autocomplete`\nMemoizedAutocomplete.displayName = \"Autocomplete\";\n\nexport { MemoizedAutocomplete as Autocomplete };\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA,SAASA,IAAI,EAAEC,WAAW,QAAQ,OAAO;AAAC,SAEjCC,KAAK;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAsHd,MAAMC,YAAY,GAAGC,IAAA,IAuB0D;EAAA,IAnB7E;IACAC,YAAY;IACZC,kBAAkB;IAClBC,EAAE,EAAEC,UAAU;IACdC,oBAAoB;IACpBC,UAAU;IACVC,SAAS;IACTC,UAAU,GAAG,KAAK;IAClBC,UAAU;IACVC,IAAI;IACJC,KAAK;IAC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AE,EAAEC,UAAW;IACfsC,OAAO,EAAEnC,SAAU;IACnBoC,QAAQ,EAAEzC,kBAAmB;IAC7BY,MAAM,EAAEA,MAAO;IACfC,QAAQ,EAAEA,QAAS;IACnBC,aAAa,EAAEA,aAAc;IAC7BC,OAAO,EAAEA,OAAQ;IACjBC,OAAO,EAAEA,OAAQ;IACjB0B,QAAQ,EAAEnC,UAAW;IACrBY,WAAW,EAAEA,WAAY;IACzBF,KAAK,EAAEA;EAAM,CACd,CAAC;AAEN,CAAC;AAGD,MAAM0B,oBAAoB,GAAGnD,IAAI,CAACK,YAAY,CAAwB;AAEtE8C,oBAAoB,CAACC,WAAW,GAAG,cAAc;AAEjD,SAASD,oBAAoB,IAAI9C,YAAY"}
1
+ {"version":3,"file":"Autocomplete.js","names":["memo","useCallback","useMemo","Field","useControlledState","jsx","_jsx","Autocomplete","_ref","defaultValue","errorMessage","hasMultipleChoices","id","idOverride","inputValue","isCustomValueAllowed","isDisabled","isLoading","isOptional","isReadOnly","hint","label","name","nameOverride","onBlur","onChange","onChangeProp","onInputChange","onInputChangeProp","onFocus","options","value","getIsOptionEqualToValue","testId","renderInput","_ref2","InputLabelProps","InputProps","params","fieldType","hasVisibleLabel","htmlFor","renderFieldComponent","_ref3","ariaDescribedBy","errorMessageElementId","labelElementId","_InputBase","inputProps","required","defaultValuesProp","undefined","localValue","setLocalValue","controlledValue","uncontrolledValue","localInputValue","setLocalInputValue","event","reason","details","_Autocomplete","disableCloseOnSelect","disabled","freeSolo","filterSelectedOptions","loading","multiple","readOnly","isOptionEqualToValue","MemoizedAutocomplete","displayName"],"sources":["../src/Autocomplete.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport {\n Autocomplete as MuiAutocomplete,\n AutocompleteProps as MuiAutocompleteProps,\n InputBase,\n UseAutocompleteProps,\n AutocompleteValue,\n} from \"@mui/material\";\nimport { memo, useCallback, useMemo } from \"react\";\n\nimport { Field } from \"./Field\";\nimport { FieldComponentProps } from \"./FieldComponentProps\";\nimport type { SeleniumProps } from \"./SeleniumProps\";\nimport { useControlledState } from \"./useControlledState\";\n\nexport type AutocompleteProps<\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined\n> = {\n /**\n * The default value. Use when the component is not controlled.\n * @default props.multiple ? [] : null\n */\n defaultValue?: UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"defaultValue\"];\n /**\n * Enables multiple choice selection\n */\n hasMultipleChoices?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"multiple\"];\n /**\n * The value for the input\n */\n inputValue?: UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"inputValue\"];\n /**\n * Allows the input of custom values\n */\n isCustomValueAllowed?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"freeSolo\"];\n /**\n * Disables the Autocomplete input\n */\n isDisabled?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"disabled\"];\n /**\n * Displays a loading indicator\n */\n isLoading?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"loading\"];\n /**\n * Makes the Autocomplete input read-only\n */\n isReadOnly?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"readOnly\"];\n /**\n * The label text for the autocomplete input\n */\n label: string;\n /**\n * Callback fired when the autocomplete loses focus.\n */\n onBlur?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onBlur\"];\n /**\n * Callback fired when a selection is made.\n */\n onChange?: UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onChange\"];\n /**\n * Callback fired when the textbox receives typed characters.\n */\n onInputChange?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onInputChange\"];\n /**\n * Callback fired when the autocomplete gains focus.\n */\n onFocus?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onFocus\"];\n /**\n * The options for the Autocomplete input\n */\n options: ReadonlyArray<OptionType>;\n /**\n * The value of the Autocomplete input\n */\n value?: UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"value\"];\n\n /**\n * Used to determine if the option represents the given value. Uses strict equality by default if none provided.\n * Both arguments need to be handled, an option can only match with one value.\n * option: the option to test\n * value: the value to test against\n *\n * You will need to implement this function if your `option` items are objects.\n */\n getIsOptionEqualToValue?: (option: OptionType, value: OptionType) => boolean;\n} & Pick<\n FieldComponentProps,\n \"errorMessage\" | \"hint\" | \"id\" | \"isOptional\" | \"name\"\n> &\n SeleniumProps;\n\nconst Autocomplete = <\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined\n>({\n defaultValue,\n errorMessage,\n hasMultipleChoices,\n id: idOverride,\n inputValue,\n isCustomValueAllowed,\n isDisabled,\n isLoading,\n isOptional = false,\n isReadOnly,\n hint,\n label,\n name: nameOverride,\n onBlur,\n onChange: onChangeProp,\n onInputChange: onInputChangeProp,\n onFocus,\n options,\n value,\n getIsOptionEqualToValue,\n testId,\n}: AutocompleteProps<OptionType, HasMultipleChoices, IsCustomValueAllowed>) => {\n const renderInput = useCallback(\n ({ InputLabelProps, InputProps, ...params }) => (\n <Field\n errorMessage={errorMessage}\n fieldType=\"single\"\n hasVisibleLabel\n id={InputLabelProps.htmlFor}\n hint={hint}\n label={label}\n isOptional={isOptional}\n renderFieldComponent={({\n ariaDescribedBy,\n id,\n errorMessageElementId,\n labelElementId,\n }) => (\n <InputBase\n {...params}\n {...InputProps}\n inputProps={{\n ...params.inputProps,\n \"aria-errormessage\": errorMessageElementId,\n \"aria-labelledby\": labelElementId,\n }}\n aria-describedby={ariaDescribedBy}\n id={id}\n name={nameOverride ?? id}\n required={!isOptional}\n />\n )}\n />\n ),\n [errorMessage, hint, isOptional, label, nameOverride]\n );\n\n const defaultValuesProp = useMemo<\n | AutocompleteValue<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >\n | undefined\n >(() => {\n if (hasMultipleChoices) {\n return defaultValue === undefined\n ? ([] as AutocompleteValue<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >)\n : defaultValue;\n }\n return defaultValue ?? undefined;\n }, [defaultValue, hasMultipleChoices]);\n\n const [localValue, setLocalValue] = useControlledState({\n controlledValue: value,\n uncontrolledValue: defaultValuesProp,\n });\n\n const [localInputValue, setLocalInputValue] = useControlledState({\n controlledValue: inputValue,\n uncontrolledValue: undefined,\n });\n\n const onChange = useCallback<\n NonNullable<\n UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onChange\"]\n >\n >(\n (event, value, reason, details) => {\n setLocalValue(value);\n onChangeProp?.(event, value, reason, details);\n },\n [onChangeProp, setLocalValue]\n );\n\n const onInputChange = useCallback<\n NonNullable<\n UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onInputChange\"]\n >\n >(\n (event, value, reason) => {\n setLocalInputValue(value);\n onInputChangeProp?.(event, value, reason);\n },\n [onInputChangeProp, setLocalInputValue]\n );\n\n return (\n <MuiAutocomplete\n // AutoComplete is wrapped in a div within MUI which does not get the disabled attr. So this aria-disabled gets set in the div\n aria-disabled={isDisabled}\n data-se={testId}\n defaultValue={defaultValuesProp}\n disableCloseOnSelect={hasMultipleChoices}\n disabled={isDisabled}\n freeSolo={isCustomValueAllowed}\n filterSelectedOptions={true}\n id={idOverride}\n loading={isLoading}\n multiple={hasMultipleChoices}\n onBlur={onBlur}\n onChange={onChange}\n onInputChange={onInputChange}\n onFocus={onFocus}\n options={options}\n readOnly={isReadOnly}\n renderInput={renderInput}\n value={localValue}\n inputValue={localInputValue}\n isOptionEqualToValue={getIsOptionEqualToValue}\n />\n );\n};\n\n// Need the `typeof Autocomplete` because generics don't get passed through\nconst MemoizedAutocomplete = memo(Autocomplete) as typeof Autocomplete;\n// @ts-expect-error displayName is expected to not be on `typeof Autocomplete`\nMemoizedAutocomplete.displayName = \"Autocomplete\";\n\nexport { MemoizedAutocomplete as Autocomplete };\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AASA,SAASA,IAAI,EAAEC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAAC,SAE1CC,KAAK;AAAA,SAGLC,kBAAkB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AA4I3B,MAAMC,YAAY,GAAGC,IAAA,IA0B0D;EAAA,IAtB7E;IACAC,YAAY;IACZC,YAAY;IACZC,kBAAkB;IAClBC,EAAE,EAAEC,UAAU;IACdC,UAAU;IACVC,oBAAoB;IACpBC,UAAU;IACVC,SAAS;IACTC,UAAU,GAAG,KAAK;IAClBC,UAAU;IACVC,IAAI;IACJC,KAAK;IACLC,IAAI,EAAEC,YAAY;IAClBC,MAAM;IACNC,QAAQ,EAAEC,YAAY;IACtBC,aAAa,EAAEC,iBAAiB;IAChCC,OAAO;IACPC,OAAO;IACPC,KAAK;IACLC,uBAAuB;IACvBC;EACuE,CAAC,GAAAzB,IAAA;EAC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AAEqB,UAAW;IAClBtC,UAAU,EAAE0C,eAAgB;IAC5Ba,oBAAoB,EAAErC;EAAwB,CAC/C,CAAC;AAEN,CAAC;AAGD,MAAMsC,oBAAoB,GAAGtE,IAAI,CAACO,YAAY,CAAwB;AAEtE+D,oBAAoB,CAACC,WAAW,GAAG,cAAc;AAEjD,SAASD,oBAAoB,IAAI/D,YAAY"}
@@ -11,5 +11,7 @@ import _CssBaseline from "@mui/material/CssBaseline";
11
11
  * See the License for the specific language governing permissions and limitations under the License.
12
12
  */
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
- export const CssBaseline = () => _jsx(_CssBaseline, {});
14
+ export const CssBaseline = props => _jsx(_CssBaseline, {
15
+ ...props
16
+ });
15
17
  //# sourceMappingURL=CssBaseline.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CssBaseline.js","names":["jsx","_jsx","CssBaseline","_CssBaseline"],"sources":["../src/CssBaseline.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 { CssBaseline as MuiCssBaseline } from \"@mui/material\";\n\nexport const CssBaseline = () => <MuiCssBaseline />;\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVA,SAAAA,GAAA,IAAAC,IAAA;AAcA,OAAO,MAAMC,WAAW,GAAGA,CAAA,KAAMD,IAAA,CAAAE,YAAA,IAAiB,CAAC"}
1
+ {"version":3,"file":"CssBaseline.js","names":["jsx","_jsx","CssBaseline","props","_CssBaseline"],"sources":["../src/CssBaseline.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 CssBaseline as MuiCssBaseline,\n CssBaselineProps as MuiCssBaselineProps,\n} from \"@mui/material\";\n\nexport const CssBaseline = (props: MuiCssBaselineProps) => (\n <MuiCssBaseline {...props} />\n);\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVA,SAAAA,GAAA,IAAAC,IAAA;AAiBA,OAAO,MAAMC,WAAW,GAAIC,KAA0B,IACpDF,IAAA,CAAAG,YAAA;EAAA,GAAoBD;AAAK,CAAG,CAC7B"}
@@ -0,0 +1,129 @@
1
+ import _Autocomplete from "@mui/material/Autocomplete";
2
+ import _InputBase from "@mui/material/InputBase";
3
+ /*!
4
+ * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.
5
+ * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
6
+ *
7
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
8
+ * Unless required by applicable law or agreed to in writing, software
9
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ *
12
+ * See the License for the specific language governing permissions and limitations under the License.
13
+ */
14
+ import { memo, useCallback, useMemo } from "react";
15
+ import { Field } from "../Field.js";
16
+ import { useControlledState } from "../useControlledState.js";
17
+ import { jsx as _jsx } from "react/jsx-runtime";
18
+ const VirtualizedAutocomplete = _ref => {
19
+ let {
20
+ defaultValue,
21
+ errorMessage,
22
+ hasMultipleChoices,
23
+ id: idOverride,
24
+ inputValue,
25
+ isCustomValueAllowed,
26
+ isDisabled,
27
+ isLoading,
28
+ isOptional = false,
29
+ isReadOnly,
30
+ hint,
31
+ label,
32
+ ListboxComponent,
33
+ name: nameOverride,
34
+ onBlur,
35
+ onChange: onChangeProp,
36
+ onInputChange: onInputChangeProp,
37
+ onFocus,
38
+ options,
39
+ value,
40
+ getIsOptionEqualToValue,
41
+ testId
42
+ } = _ref;
43
+ const renderInput = useCallback(_ref2 => {
44
+ let {
45
+ InputLabelProps,
46
+ InputProps,
47
+ ...params
48
+ } = _ref2;
49
+ return _jsx(Field, {
50
+ errorMessage: errorMessage,
51
+ fieldType: "single",
52
+ hasVisibleLabel: true,
53
+ id: InputLabelProps.htmlFor,
54
+ hint: hint,
55
+ label: label,
56
+ isOptional: isOptional,
57
+ renderFieldComponent: _ref3 => {
58
+ let {
59
+ ariaDescribedBy,
60
+ id,
61
+ errorMessageElementId,
62
+ labelElementId
63
+ } = _ref3;
64
+ return _jsx(_InputBase, {
65
+ ...params,
66
+ ...InputProps,
67
+ inputProps: {
68
+ ...params.inputProps,
69
+ "aria-errormessage": errorMessageElementId,
70
+ "aria-labelledby": labelElementId
71
+ },
72
+ "aria-describedby": ariaDescribedBy,
73
+ id: id,
74
+ name: nameOverride ?? id,
75
+ required: !isOptional
76
+ });
77
+ }
78
+ });
79
+ }, [errorMessage, hint, isOptional, label, nameOverride]);
80
+ const defaultValuesProp = useMemo(() => {
81
+ if (hasMultipleChoices) {
82
+ return defaultValue === undefined ? [] : defaultValue;
83
+ }
84
+ return defaultValue ?? undefined;
85
+ }, [defaultValue, hasMultipleChoices]);
86
+ const [localValue, setLocalValue] = useControlledState({
87
+ controlledValue: value,
88
+ uncontrolledValue: defaultValuesProp
89
+ });
90
+ const [localInputValue, setLocalInputValue] = useControlledState({
91
+ controlledValue: inputValue,
92
+ uncontrolledValue: undefined
93
+ });
94
+ const onChange = useCallback((event, value, reason, details) => {
95
+ setLocalValue(value);
96
+ onChangeProp?.(event, value, reason, details);
97
+ }, [onChangeProp, setLocalValue]);
98
+ const onInputChange = useCallback((event, value, reason) => {
99
+ setLocalInputValue(value);
100
+ onInputChangeProp?.(event, value, reason);
101
+ }, [onInputChangeProp, setLocalInputValue]);
102
+ return _jsx(_Autocomplete, {
103
+ "aria-disabled": isDisabled,
104
+ "data-se": testId,
105
+ defaultValue: defaultValuesProp,
106
+ disableCloseOnSelect: hasMultipleChoices,
107
+ disabled: isDisabled,
108
+ freeSolo: isCustomValueAllowed,
109
+ filterSelectedOptions: true,
110
+ id: idOverride,
111
+ ListboxComponent: ListboxComponent,
112
+ loading: isLoading,
113
+ multiple: hasMultipleChoices,
114
+ onBlur: onBlur,
115
+ onChange: onChange,
116
+ onInputChange: onInputChange,
117
+ onFocus: onFocus,
118
+ options: options,
119
+ readOnly: isReadOnly,
120
+ renderInput: renderInput,
121
+ value: localValue,
122
+ inputValue: localInputValue,
123
+ isOptionEqualToValue: getIsOptionEqualToValue
124
+ });
125
+ };
126
+ const MemoizedAutocomplete = memo(VirtualizedAutocomplete);
127
+ MemoizedAutocomplete.displayName = "Autocomplete";
128
+ export { MemoizedAutocomplete as VirtualizedAutocomplete };
129
+ //# sourceMappingURL=VirtualizedAutocomplete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VirtualizedAutocomplete.js","names":["memo","useCallback","useMemo","Field","useControlledState","jsx","_jsx","VirtualizedAutocomplete","_ref","defaultValue","errorMessage","hasMultipleChoices","id","idOverride","inputValue","isCustomValueAllowed","isDisabled","isLoading","isOptional","isReadOnly","hint","label","ListboxComponent","name","nameOverride","onBlur","onChange","onChangeProp","onInputChange","onInputChangeProp","onFocus","options","value","getIsOptionEqualToValue","testId","renderInput","_ref2","InputLabelProps","InputProps","params","fieldType","hasVisibleLabel","htmlFor","renderFieldComponent","_ref3","ariaDescribedBy","errorMessageElementId","labelElementId","_InputBase","inputProps","required","defaultValuesProp","undefined","localValue","setLocalValue","controlledValue","uncontrolledValue","localInputValue","setLocalInputValue","event","reason","details","_Autocomplete","disableCloseOnSelect","disabled","freeSolo","filterSelectedOptions","loading","multiple","readOnly","isOptionEqualToValue","MemoizedAutocomplete","displayName"],"sources":["../../src/labs/VirtualizedAutocomplete.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport {\n Autocomplete as MuiAutocomplete,\n AutocompleteProps as MuiAutocompleteProps,\n InputBase,\n UseAutocompleteProps,\n AutocompleteValue,\n} from \"@mui/material\";\nimport { memo, useCallback, useMemo } from \"react\";\n\nimport { Field } from \"../Field\";\nimport { FieldComponentProps } from \"../FieldComponentProps\";\nimport type { SeleniumProps } from \"../SeleniumProps\";\nimport { useControlledState } from \"../useControlledState\";\n\nexport type AutocompleteProps<\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined\n> = {\n /**\n * The default value. Use when the component is not controlled.\n * @default props.multiple ? [] : null\n */\n defaultValue?: UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"defaultValue\"];\n /**\n * Enables multiple choice selection\n */\n hasMultipleChoices?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"multiple\"];\n /**\n * The value for the input\n */\n inputValue?: UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"inputValue\"];\n /**\n * Allows the input of custom values\n */\n isCustomValueAllowed?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"freeSolo\"];\n /**\n * Disables the Autocomplete input\n */\n isDisabled?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"disabled\"];\n /**\n * Displays a loading indicator\n */\n isLoading?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"loading\"];\n /**\n * Makes the Autocomplete input read-only\n */\n isReadOnly?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"readOnly\"];\n /**\n * The label text for the autocomplete input\n */\n label: string;\n /**\n * The component used to render the listbox.\n */\n ListboxComponent?: React.JSXElementConstructor<\n React.HTMLAttributes<HTMLElement>\n >;\n /**\n * Callback fired when the autocomplete loses focus.\n */\n onBlur?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onBlur\"];\n /**\n * Callback fired when a selection is made.\n */\n onChange?: UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onChange\"];\n /**\n * Callback fired when the textbox receives typed characters.\n */\n onInputChange?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onInputChange\"];\n /**\n * Callback fired when the autocomplete gains focus.\n */\n onFocus?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onFocus\"];\n /**\n * The options for the Autocomplete input\n */\n options: ReadonlyArray<OptionType>;\n /**\n * The value of the Autocomplete input\n */\n value?: UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"value\"];\n\n /**\n * Used to determine if the option represents the given value. Uses strict equality by default if none provided.\n * Both arguments need to be handled, an option can only match with one value.\n * option: the option to test\n * value: the value to test against\n *\n * You will need to implement this function if your `option` items are objects.\n */\n getIsOptionEqualToValue?: (option: OptionType, value: OptionType) => boolean;\n} & Pick<\n FieldComponentProps,\n \"errorMessage\" | \"hint\" | \"id\" | \"isOptional\" | \"name\"\n> &\n SeleniumProps;\n\nconst VirtualizedAutocomplete = <\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined\n>({\n defaultValue,\n errorMessage,\n hasMultipleChoices,\n id: idOverride,\n inputValue,\n isCustomValueAllowed,\n isDisabled,\n isLoading,\n isOptional = false,\n isReadOnly,\n hint,\n label,\n ListboxComponent,\n name: nameOverride,\n onBlur,\n onChange: onChangeProp,\n onInputChange: onInputChangeProp,\n onFocus,\n options,\n value,\n getIsOptionEqualToValue,\n testId,\n}: AutocompleteProps<OptionType, HasMultipleChoices, IsCustomValueAllowed>) => {\n const renderInput = useCallback(\n ({ InputLabelProps, InputProps, ...params }) => (\n <Field\n errorMessage={errorMessage}\n fieldType=\"single\"\n hasVisibleLabel\n id={InputLabelProps.htmlFor}\n hint={hint}\n label={label}\n isOptional={isOptional}\n renderFieldComponent={({\n ariaDescribedBy,\n id,\n errorMessageElementId,\n labelElementId,\n }) => (\n <InputBase\n {...params}\n {...InputProps}\n inputProps={{\n ...params.inputProps,\n \"aria-errormessage\": errorMessageElementId,\n \"aria-labelledby\": labelElementId,\n }}\n aria-describedby={ariaDescribedBy}\n id={id}\n name={nameOverride ?? id}\n required={!isOptional}\n />\n )}\n />\n ),\n [errorMessage, hint, isOptional, label, nameOverride]\n );\n\n const defaultValuesProp = useMemo<\n | AutocompleteValue<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >\n | undefined\n >(() => {\n if (hasMultipleChoices) {\n return defaultValue === undefined\n ? ([] as AutocompleteValue<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >)\n : defaultValue;\n }\n return defaultValue ?? undefined;\n }, [defaultValue, hasMultipleChoices]);\n\n const [localValue, setLocalValue] = useControlledState({\n controlledValue: value,\n uncontrolledValue: defaultValuesProp,\n });\n\n const [localInputValue, setLocalInputValue] = useControlledState({\n controlledValue: inputValue,\n uncontrolledValue: undefined,\n });\n\n const onChange = useCallback<\n NonNullable<\n UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onChange\"]\n >\n >(\n (event, value, reason, details) => {\n setLocalValue(value);\n onChangeProp?.(event, value, reason, details);\n },\n [onChangeProp, setLocalValue]\n );\n\n const onInputChange = useCallback<\n NonNullable<\n UseAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"onInputChange\"]\n >\n >(\n (event, value, reason) => {\n setLocalInputValue(value);\n onInputChangeProp?.(event, value, reason);\n },\n [onInputChangeProp, setLocalInputValue]\n );\n\n return (\n <MuiAutocomplete\n // AutoComplete is wrapped in a div within MUI which does not get the disabled attr. So this aria-disabled gets set in the div\n aria-disabled={isDisabled}\n data-se={testId}\n defaultValue={defaultValuesProp}\n disableCloseOnSelect={hasMultipleChoices}\n disabled={isDisabled}\n freeSolo={isCustomValueAllowed}\n filterSelectedOptions={true}\n id={idOverride}\n ListboxComponent={ListboxComponent}\n loading={isLoading}\n multiple={hasMultipleChoices}\n onBlur={onBlur}\n onChange={onChange}\n onInputChange={onInputChange}\n onFocus={onFocus}\n options={options}\n readOnly={isReadOnly}\n renderInput={renderInput}\n value={localValue}\n inputValue={localInputValue}\n isOptionEqualToValue={getIsOptionEqualToValue}\n />\n );\n};\n\n// Need the `typeof Autocomplete` because generics don't get passed through\nconst MemoizedAutocomplete = memo(\n VirtualizedAutocomplete\n) as typeof VirtualizedAutocomplete;\n// @ts-expect-error displayName is expected to not be on `typeof Autocomplete`\nMemoizedAutocomplete.displayName = \"Autocomplete\";\n\nexport { MemoizedAutocomplete as VirtualizedAutocomplete };\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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ACD,CAAC/B,iBAAiB,EAAE6B,kBAAkB,CACxC,CAAC;EAED,OACEpD,IAAA,CAAAwD,aAAA;IAEE,iBAAe9C,UAAW;IAC1B,WAASkB,MAAO;IAChBzB,YAAY,EAAE0C,iBAAkB;IAChCY,oBAAoB,EAAEpD,kBAAmB;IACzCqD,QAAQ,EAAEhD,UAAW;IACrBiD,QAAQ,EAAElD,oBAAqB;IAC/BmD,qBAAqB,EAAE,IAAK;IAC5BtD,EAAE,EAAEC,UAAW;IACfS,gBAAgB,EAAEA,gBAAiB;IACnC6C,OAAO,EAAElD,SAAU;IACnBmD,QAAQ,EAAEzD,kBAAmB;IAC7Bc,MAAM,EAAEA,MAAO;IACfC,QAAQ,EAAEA,QAAS;IACnBE,aAAa,EAAEA,aAAc;IAC7BE,OAAO,EAAEA,OAAQ;IACjBC,OAAO,EAAEA,OAAQ;IACjBsC,QAAQ,EAAElD,UAAW;IACrBgB,WAAW,EAAEA,WAAY;IACzBH,KAAK,EAAEqB,UAAW;IAClBvC,UAAU,EAAE2C,eAAgB;IAC5Ba,oBAAoB,EAAErC;EAAwB,CAC/C,CAAC;AAEN,CAAC;AAGD,MAAMsC,oBAAoB,GAAGvE,IAAI,CAC/BO,uBACF,CAAmC;AAEnCgE,oBAAoB,CAACC,WAAW,GAAG,cAAc;AAEjD,SAASD,oBAAoB,IAAIhE,uBAAuB"}
@@ -18,4 +18,5 @@ export * from "./materialReactTableTypes.js";
18
18
  export * from "./PaginatedTable.js";
19
19
  export * from "./StaticTable.js";
20
20
  export * from "./GroupPicker.js";
21
+ export * from "./VirtualizedAutocomplete.js";
21
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["AdapterDateFns","LocalizationProvider"],"sources":["../../src/labs/index.ts"],"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\nexport { AdapterDateFns } from \"@mui/x-date-pickers/AdapterDateFns\";\nexport { LocalizationProvider } from \"@mui/x-date-pickers\";\nexport type { LocalizationProviderProps } from \"@mui/x-date-pickers\";\n\nexport type { MRT_ColumnDef as TableColumn } from \"material-react-table\";\n\nexport * from \"./DatePicker\";\nexport * from \"./datePickerTheme\";\n\nexport * from \"./materialReactTableTypes\";\nexport * from \"./PaginatedTable\";\nexport * from \"./StaticTable\";\nexport * from \"./GroupPicker\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,cAAc,QAAQ,oCAAoC;AACnE,SAASC,oBAAoB,QAAQ,qBAAqB;AAAC;AAAA;AAAA;AAAA;AAAA;AAAA"}
1
+ {"version":3,"file":"index.js","names":["AdapterDateFns","LocalizationProvider"],"sources":["../../src/labs/index.ts"],"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\nexport { AdapterDateFns } from \"@mui/x-date-pickers/AdapterDateFns\";\nexport { LocalizationProvider } from \"@mui/x-date-pickers\";\nexport type { LocalizationProviderProps } from \"@mui/x-date-pickers\";\n\nexport type { MRT_ColumnDef as TableColumn } from \"material-react-table\";\n\nexport * from \"./DatePicker\";\nexport * from \"./datePickerTheme\";\n\nexport * from \"./materialReactTableTypes\";\nexport * from \"./PaginatedTable\";\nexport * from \"./StaticTable\";\nexport * from \"./GroupPicker\";\nexport * from \"./VirtualizedAutocomplete\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,cAAc,QAAQ,oCAAoC;AACnE,SAASC,oBAAoB,QAAQ,qBAAqB;AAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA"}
@@ -9,14 +9,23 @@
9
9
  *
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
- import { AutocompleteProps as MuiAutocompleteProps } from "@mui/material";
12
+ import { AutocompleteProps as MuiAutocompleteProps, UseAutocompleteProps } from "@mui/material";
13
13
  import { FieldComponentProps } from "./FieldComponentProps";
14
14
  import type { SeleniumProps } from "./SeleniumProps";
15
15
  export type AutocompleteProps<OptionType, HasMultipleChoices extends boolean | undefined, IsCustomValueAllowed extends boolean | undefined> = {
16
+ /**
17
+ * The default value. Use when the component is not controlled.
18
+ * @default props.multiple ? [] : null
19
+ */
20
+ defaultValue?: UseAutocompleteProps<OptionType, HasMultipleChoices, undefined, IsCustomValueAllowed>["defaultValue"];
16
21
  /**
17
22
  * Enables multiple choice selection
18
23
  */
19
24
  hasMultipleChoices?: MuiAutocompleteProps<OptionType, HasMultipleChoices, undefined, IsCustomValueAllowed>["multiple"];
25
+ /**
26
+ * The value for the input
27
+ */
28
+ inputValue?: UseAutocompleteProps<OptionType, HasMultipleChoices, undefined, IsCustomValueAllowed>["inputValue"];
20
29
  /**
21
30
  * Allows the input of custom values
22
31
  */
@@ -44,7 +53,7 @@ export type AutocompleteProps<OptionType, HasMultipleChoices extends boolean | u
44
53
  /**
45
54
  * Callback fired when a selection is made.
46
55
  */
47
- onChange?: MuiAutocompleteProps<OptionType, HasMultipleChoices, undefined, IsCustomValueAllowed>["onChange"];
56
+ onChange?: UseAutocompleteProps<OptionType, HasMultipleChoices, undefined, IsCustomValueAllowed>["onChange"];
48
57
  /**
49
58
  * Callback fired when the textbox receives typed characters.
50
59
  */
@@ -56,12 +65,21 @@ export type AutocompleteProps<OptionType, HasMultipleChoices extends boolean | u
56
65
  /**
57
66
  * The options for the Autocomplete input
58
67
  */
59
- options: MuiAutocompleteProps<OptionType, HasMultipleChoices, undefined, IsCustomValueAllowed>["options"];
68
+ options: ReadonlyArray<OptionType>;
60
69
  /**
61
70
  * The value of the Autocomplete input
62
71
  */
63
- value?: MuiAutocompleteProps<OptionType, HasMultipleChoices, undefined, IsCustomValueAllowed>["value"];
72
+ value?: UseAutocompleteProps<OptionType, HasMultipleChoices, undefined, IsCustomValueAllowed>["value"];
73
+ /**
74
+ * Used to determine if the option represents the given value. Uses strict equality by default if none provided.
75
+ * Both arguments need to be handled, an option can only match with one value.
76
+ * option: the option to test
77
+ * value: the value to test against
78
+ *
79
+ * You will need to implement this function if your `option` items are objects.
80
+ */
81
+ getIsOptionEqualToValue?: (option: OptionType, value: OptionType) => boolean;
64
82
  } & Pick<FieldComponentProps, "errorMessage" | "hint" | "id" | "isOptional" | "name"> & SeleniumProps;
65
- declare const MemoizedAutocomplete: <OptionType, HasMultipleChoices extends boolean | undefined, IsCustomValueAllowed extends boolean | undefined>({ errorMessage, hasMultipleChoices, id: idOverride, isCustomValueAllowed, isDisabled, isLoading, isOptional, isReadOnly, hint, label, name: nameOverride, onBlur, onChange, onInputChange, onFocus, options, value, testId, }: AutocompleteProps<OptionType, HasMultipleChoices, IsCustomValueAllowed>) => JSX.Element;
83
+ declare const MemoizedAutocomplete: <OptionType, HasMultipleChoices extends boolean | undefined, IsCustomValueAllowed extends boolean | undefined>({ defaultValue, errorMessage, hasMultipleChoices, id: idOverride, inputValue, isCustomValueAllowed, isDisabled, isLoading, isOptional, isReadOnly, hint, label, name: nameOverride, onBlur, onChange: onChangeProp, onInputChange: onInputChangeProp, onFocus, options, value, getIsOptionEqualToValue, testId, }: AutocompleteProps<OptionType, HasMultipleChoices, IsCustomValueAllowed>) => JSX.Element;
66
84
  export { MemoizedAutocomplete as Autocomplete };
67
85
  //# sourceMappingURL=Autocomplete.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Autocomplete.d.ts","sourceRoot":"","sources":["../../src/Autocomplete.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAEL,iBAAiB,IAAI,oBAAoB,EAE1C,MAAM,eAAe,CAAC;AAIvB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,MAAM,iBAAiB,CAC3B,UAAU,EACV,kBAAkB,SAAS,OAAO,GAAG,SAAS,EAC9C,oBAAoB,SAAS,OAAO,GAAG,SAAS,IAC9C;IACF;;OAEG;IACH,kBAAkB,CAAC,EAAE,oBAAoB,CACvC,UAAU,EACV,kBAAkB,EAClB,SAAS,EACT,oBAAoB,CACrB,CAAC,UAAU,CAAC,CAAC;IACd;;OAEG;IACH,oBAAoB,CAAC,EAAE,oBAAoB,CACzC,UAAU,EACV,kBAAkB,EAClB,SAAS,EACT,oBAAoB,CACrB,CAAC,UAAU,CAAC,CAAC;IACd;;OAEG;IACH,UAAU,CAAC,EAAE,oBAAoB,CAC/B,UAAU,EACV,kBAAkB,EAClB,SAAS,EACT,oBAAoB,CACrB,CAAC,UAAU,CAAC,CAAC;IACd;;OAEG;IACH,SAAS,CAAC,EAAE,oBAAoB,CAC9B,UAAU,EACV,kBAAkB,EAClB,SAAS,EACT,oBAAoB,CACrB,CAAC,SAAS,CAAC,CAAC;IACb;;OAEG;IACH,UAAU,CAAC,EAAE,oBAAoB,CAC/B,UAAU,EACV,kBAAkB,EAClB,SAAS,EACT,oBAAoB,CACrB,CAAC,UAAU,CAAC,CAAC;IACd;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,oBAAoB,CAC3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EACT,oBAAoB,CACrB,CAAC,UAAU,CAAC,CAAC;IACd;;OAEG;IACH,aAAa,CAAC,EAAE,oBAAoB,CAClC,UAAU,EACV,kBAAkB,EAClB,SAAS,EACT,oBAAoB,CACrB,CAAC,eAAe,CAAC,CAAC;IACnB;;OAEG;IACH,OAAO,CAAC,EAAE,oBAAoB,CAC5B,UAAU,EACV,kBAAkB,EAClB,SAAS,EACT,oBAAoB,CACrB,CAAC,SAAS,CAAC,CAAC;IACb;;OAEG;IACH,OAAO,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IACnC;;OAEG;IACH,KAAK,CAAC,EAAE,oBAAoB,CAC1B,UAAU,EACV,kBAAkB,EAClB,SAAS,EACT,oBAAoB,CACrB,CAAC,OAAO,CAAC,CAAC;IAEX;;;;;;;OAOG;IACH,uBAAuB,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC;CAC9E,GAAG,IAAI,CACN,mBAAmB,EACnB,cAAc,GAAG,MAAM,GAAG,IAAI,GAAG,YAAY,GAAG,MAAM,CACvD,GACC,aAAa,CAAC;AA8JhB,QAAA,MAAM,oBAAoB,2fAA4C,CAAC;AAIvE,OAAO,EAAE,oBAAoB,IAAI,YAAY,EAAE,CAAC"}
@@ -9,5 +9,6 @@
9
9
  *
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
- export declare const CssBaseline: () => JSX.Element;
12
+ import { CssBaselineProps as MuiCssBaselineProps } from "@mui/material";
13
+ export declare const CssBaseline: (props: MuiCssBaselineProps) => JSX.Element;
13
14
  //# sourceMappingURL=CssBaseline.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CssBaseline.d.ts","sourceRoot":"","sources":["../../src/CssBaseline.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,eAAO,MAAM,WAAW,mBAA2B,CAAC"}
1
+ {"version":3,"file":"CssBaseline.d.ts","sourceRoot":"","sources":["../../src/CssBaseline.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAEL,gBAAgB,IAAI,mBAAmB,EACxC,MAAM,eAAe,CAAC;AAEvB,eAAO,MAAM,WAAW,UAAW,mBAAmB,gBAErD,CAAC"}
@@ -0,0 +1,90 @@
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
+ import { AutocompleteProps as MuiAutocompleteProps, UseAutocompleteProps } from "@mui/material";
14
+ import { FieldComponentProps } from "../FieldComponentProps";
15
+ import type { SeleniumProps } from "../SeleniumProps";
16
+ export type AutocompleteProps<OptionType, HasMultipleChoices extends boolean | undefined, IsCustomValueAllowed extends boolean | undefined> = {
17
+ /**
18
+ * The default value. Use when the component is not controlled.
19
+ * @default props.multiple ? [] : null
20
+ */
21
+ defaultValue?: UseAutocompleteProps<OptionType, HasMultipleChoices, undefined, IsCustomValueAllowed>["defaultValue"];
22
+ /**
23
+ * Enables multiple choice selection
24
+ */
25
+ hasMultipleChoices?: MuiAutocompleteProps<OptionType, HasMultipleChoices, undefined, IsCustomValueAllowed>["multiple"];
26
+ /**
27
+ * The value for the input
28
+ */
29
+ inputValue?: UseAutocompleteProps<OptionType, HasMultipleChoices, undefined, IsCustomValueAllowed>["inputValue"];
30
+ /**
31
+ * Allows the input of custom values
32
+ */
33
+ isCustomValueAllowed?: MuiAutocompleteProps<OptionType, HasMultipleChoices, undefined, IsCustomValueAllowed>["freeSolo"];
34
+ /**
35
+ * Disables the Autocomplete input
36
+ */
37
+ isDisabled?: MuiAutocompleteProps<OptionType, HasMultipleChoices, undefined, IsCustomValueAllowed>["disabled"];
38
+ /**
39
+ * Displays a loading indicator
40
+ */
41
+ isLoading?: MuiAutocompleteProps<OptionType, HasMultipleChoices, undefined, IsCustomValueAllowed>["loading"];
42
+ /**
43
+ * Makes the Autocomplete input read-only
44
+ */
45
+ isReadOnly?: MuiAutocompleteProps<OptionType, HasMultipleChoices, undefined, IsCustomValueAllowed>["readOnly"];
46
+ /**
47
+ * The label text for the autocomplete input
48
+ */
49
+ label: string;
50
+ /**
51
+ * The component used to render the listbox.
52
+ */
53
+ ListboxComponent?: React.JSXElementConstructor<React.HTMLAttributes<HTMLElement>>;
54
+ /**
55
+ * Callback fired when the autocomplete loses focus.
56
+ */
57
+ onBlur?: MuiAutocompleteProps<OptionType, HasMultipleChoices, undefined, IsCustomValueAllowed>["onBlur"];
58
+ /**
59
+ * Callback fired when a selection is made.
60
+ */
61
+ onChange?: UseAutocompleteProps<OptionType, HasMultipleChoices, undefined, IsCustomValueAllowed>["onChange"];
62
+ /**
63
+ * Callback fired when the textbox receives typed characters.
64
+ */
65
+ onInputChange?: MuiAutocompleteProps<OptionType, HasMultipleChoices, undefined, IsCustomValueAllowed>["onInputChange"];
66
+ /**
67
+ * Callback fired when the autocomplete gains focus.
68
+ */
69
+ onFocus?: MuiAutocompleteProps<OptionType, HasMultipleChoices, undefined, IsCustomValueAllowed>["onFocus"];
70
+ /**
71
+ * The options for the Autocomplete input
72
+ */
73
+ options: ReadonlyArray<OptionType>;
74
+ /**
75
+ * The value of the Autocomplete input
76
+ */
77
+ value?: UseAutocompleteProps<OptionType, HasMultipleChoices, undefined, IsCustomValueAllowed>["value"];
78
+ /**
79
+ * Used to determine if the option represents the given value. Uses strict equality by default if none provided.
80
+ * Both arguments need to be handled, an option can only match with one value.
81
+ * option: the option to test
82
+ * value: the value to test against
83
+ *
84
+ * You will need to implement this function if your `option` items are objects.
85
+ */
86
+ getIsOptionEqualToValue?: (option: OptionType, value: OptionType) => boolean;
87
+ } & Pick<FieldComponentProps, "errorMessage" | "hint" | "id" | "isOptional" | "name"> & SeleniumProps;
88
+ declare const MemoizedAutocomplete: <OptionType, HasMultipleChoices extends boolean | undefined, IsCustomValueAllowed extends boolean | undefined>({ defaultValue, errorMessage, hasMultipleChoices, id: idOverride, inputValue, isCustomValueAllowed, isDisabled, isLoading, isOptional, isReadOnly, hint, label, ListboxComponent, name: nameOverride, onBlur, onChange: onChangeProp, onInputChange: onInputChangeProp, onFocus, options, value, getIsOptionEqualToValue, testId, }: AutocompleteProps<OptionType, HasMultipleChoices, IsCustomValueAllowed>) => JSX.Element;
89
+ export { MemoizedAutocomplete as VirtualizedAutocomplete };
90
+ //# sourceMappingURL=VirtualizedAutocomplete.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VirtualizedAutocomplete.d.ts","sourceRoot":"","sources":["../../../src/labs/VirtualizedAutocomplete.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;;AAEH,OAAO,EAEL,iBAAiB,IAAI,oBAAoB,EAEzC,oBAAoB,EAErB,MAAM,eAAe,CAAC;AAIvB,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGtD,MAAM,MAAM,iBAAiB,CAC3B,UAAU,EACV,kBAAkB,SAAS,OAAO,GAAG,SAAS,EAC9C,oBAAoB,SAAS,OAAO,GAAG,SAAS,IAC9C;IACF;;;OAGG;IACH,YAAY,CAAC,EAAE,oBAAoB,CACjC,UAAU,EACV,kBAAkB,EAClB,SAAS,EACT,oBAAoB,CACrB,CAAC,cAAc,CAAC,CAAC;IAClB;;OAEG;IACH,kBAAkB,CAAC,EAAE,oBAAoB,CACvC,UAAU,EACV,kBAAkB,EAClB,SAAS,EACT,oBAAoB,CACrB,CAAC,UAAU,CAAC,CAAC;IACd;;OAEG;IACH,U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AAoB,CACrB,CAAC,SAAS,CAAC,CAAC;IACb;;OAEG;IACH,OAAO,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IACnC;;OAEG;IACH,KAAK,CAAC,EAAE,oBAAoB,CAC1B,UAAU,EACV,kBAAkB,EAClB,SAAS,EACT,oBAAoB,CACrB,CAAC,OAAO,CAAC,CAAC;IAEX;;;;;;;OAOG;IACH,uBAAuB,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC;CAC9E,GAAG,IAAI,CACN,mBAAmB,EACnB,cAAc,GAAG,MAAM,GAAG,IAAI,GAAG,YAAY,GAAG,MAAM,CACvD,GACC,aAAa,CAAC;AAgKhB,QAAA,MAAM,oBAAoB,6gBAES,CAAC;AAIpC,OAAO,EAAE,oBAAoB,IAAI,uBAAuB,EAAE,CAAC"}
@@ -19,4 +19,5 @@ export * from "./materialReactTableTypes";
19
19
  export * from "./PaginatedTable";
20
20
  export * from "./StaticTable";
21
21
  export * from "./GroupPicker";
22
+ export * from "./VirtualizedAutocomplete";
22
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/labs/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,YAAY,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAErE,YAAY,EAAE,aAAa,IAAI,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEzE,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAElC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/labs/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,YAAY,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAErE,YAAY,EAAE,aAAa,IAAI,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEzE,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAElC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,2BAA2B,CAAC"}