@okta/odyssey-react-mui 1.9.22 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/Autocomplete.js +3 -1
- package/dist/Autocomplete.js.map +1 -1
- package/dist/CheckboxGroup.js +2 -0
- package/dist/CheckboxGroup.js.map +1 -1
- package/dist/ErrorMessageList.js +45 -0
- package/dist/ErrorMessageList.js.map +1 -0
- package/dist/Field.js +6 -4
- package/dist/Field.js.map +1 -1
- package/dist/FieldComponentProps.js.map +1 -1
- package/dist/FieldError.js +9 -2
- package/dist/FieldError.js.map +1 -1
- package/dist/NativeSelect.js +2 -0
- package/dist/NativeSelect.js.map +1 -1
- package/dist/PasswordField.js +2 -0
- package/dist/PasswordField.js.map +1 -1
- package/dist/RadioGroup.js +2 -0
- package/dist/RadioGroup.js.map +1 -1
- package/dist/Select.js +2 -0
- package/dist/Select.js.map +1 -1
- package/dist/TextField.js +8 -4
- package/dist/TextField.js.map +1 -1
- package/dist/labs/VirtualizedAutocomplete.js +2 -0
- package/dist/labs/VirtualizedAutocomplete.js.map +1 -1
- package/dist/src/Autocomplete.d.ts +2 -2
- package/dist/src/Autocomplete.d.ts.map +1 -1
- package/dist/src/CheckboxGroup.d.ts +2 -2
- package/dist/src/CheckboxGroup.d.ts.map +1 -1
- package/dist/src/ErrorMessageList.d.ts +18 -0
- package/dist/src/ErrorMessageList.d.ts.map +1 -0
- package/dist/src/Field.d.ts +9 -1
- package/dist/src/Field.d.ts.map +1 -1
- package/dist/src/FieldComponentProps.d.ts +4 -0
- package/dist/src/FieldComponentProps.d.ts.map +1 -1
- package/dist/src/FieldError.d.ts +3 -2
- package/dist/src/FieldError.d.ts.map +1 -1
- package/dist/src/NativeSelect.d.ts +1 -1
- package/dist/src/NativeSelect.d.ts.map +1 -1
- package/dist/src/PasswordField.d.ts.map +1 -1
- package/dist/src/RadioGroup.d.ts +2 -2
- package/dist/src/RadioGroup.d.ts.map +1 -1
- package/dist/src/Select.d.ts +2 -2
- package/dist/src/Select.d.ts.map +1 -1
- package/dist/src/TextField.d.ts +12 -2
- package/dist/src/TextField.d.ts.map +1 -1
- package/dist/src/labs/VirtualizedAutocomplete.d.ts +2 -2
- package/dist/src/labs/VirtualizedAutocomplete.d.ts.map +1 -1
- package/dist/tsconfig.production.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/Autocomplete.tsx +12 -1
- package/src/CheckboxGroup.tsx +7 -1
- package/src/ErrorMessageList.tsx +51 -0
- package/src/Field.tsx +22 -4
- package/src/FieldComponentProps.ts +4 -0
- package/src/FieldError.tsx +15 -3
- package/src/NativeSelect.tsx +3 -0
- package/src/PasswordField.tsx +2 -0
- package/src/RadioGroup.tsx +9 -1
- package/src/Select.tsx +3 -0
- package/src/TextField.tsx +14 -5
- package/src/labs/VirtualizedAutocomplete.tsx +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
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.10.0](https://github.com/okta/odyssey/compare/v1.9.23...v1.10.0) (2024-01-19)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- support inputmode prop in TextField ([#2091](https://github.com/okta/odyssey/issues/2091)) ([ac9f17f](https://github.com/okta/odyssey/commit/ac9f17f87e324b9861e794409e72e77f20d267c8))
|
|
11
|
+
|
|
12
|
+
## [1.9.23](https://github.com/okta/odyssey/compare/v1.9.22...v1.9.23) (2024-01-17)
|
|
13
|
+
|
|
14
|
+
**Note:** Version bump only for package @okta/odyssey-react-mui
|
|
15
|
+
|
|
6
16
|
## [1.9.22](https://github.com/okta/odyssey/compare/v1.9.21...v1.9.22) (2024-01-17)
|
|
7
17
|
|
|
8
18
|
**Note:** Version bump only for package @okta/odyssey-react-mui
|
package/dist/Autocomplete.js
CHANGED
|
@@ -19,6 +19,7 @@ const Autocomplete = _ref => {
|
|
|
19
19
|
let {
|
|
20
20
|
defaultValue,
|
|
21
21
|
errorMessage,
|
|
22
|
+
errorMessageList,
|
|
22
23
|
hasMultipleChoices,
|
|
23
24
|
id: idOverride,
|
|
24
25
|
inputValue,
|
|
@@ -76,6 +77,7 @@ const Autocomplete = _ref => {
|
|
|
76
77
|
} = _ref2;
|
|
77
78
|
return _jsx(Field, {
|
|
78
79
|
errorMessage: errorMessage,
|
|
80
|
+
errorMessageList: errorMessageList,
|
|
79
81
|
fieldType: "single",
|
|
80
82
|
hasVisibleLabel: true,
|
|
81
83
|
id: InputLabelProps.htmlFor,
|
|
@@ -105,7 +107,7 @@ const Autocomplete = _ref => {
|
|
|
105
107
|
});
|
|
106
108
|
}
|
|
107
109
|
});
|
|
108
|
-
}, [errorMessage, hint, HintLinkComponent, isOptional, label, nameOverride]);
|
|
110
|
+
}, [errorMessage, errorMessageList, hint, HintLinkComponent, isOptional, label, nameOverride]);
|
|
109
111
|
const onChange = useCallback((event, value, reason, details) => {
|
|
110
112
|
onChangeProp?.(event, value, reason, details);
|
|
111
113
|
}, [onChangeProp]);
|
package/dist/Autocomplete.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Autocomplete.js","names":["memo","useCallback","useMemo","useRef","Field","ComponentControlledState","useInputValues","getControlState","jsx","_jsx","Autocomplete","_ref","defaultValue","errorMessage","hasMultipleChoices","id","idOverride","inputValue","isCustomValueAllowed","isDisabled","isFullWidth","isLoading","isOptional","isReadOnly","hint","HintLinkComponent","label","name","nameOverride","onBlur","onChange","onChangeProp","onInputChange","onInputChangeProp","onFocus","options","value","getIsOptionEqualToValue","testId","translate","controlledStateRef","controlledValue","uncontrolledValue","defaultValueProp","undefined","valueProps","controlState","current","inputValueProp","CONTROLLED","renderInput","_ref2","InputLabelProps","InputProps","params","fieldType","hasVisibleLabel","htmlFor","renderFieldComponent","_ref3","ariaDescribedBy","errorMessageElementId","labelElementId","_InputBase","inputProps","required","event","reason","details","_Autocomplete","disableCloseOnSelect","disabled","freeSolo","filterSelectedOptions","fullWidth","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, useRef } from \"react\";\n\nimport { Field } from \"./Field\";\nimport { FieldComponentProps } from \"./FieldComponentProps\";\nimport type { AllowedProps } from \"./AllowedProps\";\nimport {\n ComponentControlledState,\n useInputValues,\n getControlState,\n} from \"./inputUtils\";\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 */\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\"\n | \"hint\"\n | \"HintLinkComponent\"\n | \"id\"\n | \"isFullWidth\"\n | \"isOptional\"\n | \"name\"\n> &\n AllowedProps;\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 isFullWidth = false,\n isLoading,\n isOptional = false,\n isReadOnly,\n hint,\n HintLinkComponent,\n label,\n name: nameOverride,\n onBlur,\n onChange: onChangeProp,\n onInputChange: onInputChangeProp,\n onFocus,\n options,\n value,\n getIsOptionEqualToValue,\n testId,\n translate,\n}: AutocompleteProps<OptionType, HasMultipleChoices, IsCustomValueAllowed>) => {\n const controlledStateRef = useRef(\n getControlState({ controlledValue: value, uncontrolledValue: defaultValue })\n );\n const defaultValueProp = useMemo<\n | AutocompleteValue<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >\n | undefined\n >(() => {\n if (hasMultipleChoices) {\n if (value === undefined) {\n return defaultValue;\n }\n return [] as AutocompleteValue<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >;\n }\n return value === undefined ? defaultValue : undefined;\n }, [defaultValue, hasMultipleChoices, value]);\n\n const valueProps = useInputValues({\n defaultValue: defaultValueProp,\n value: value,\n controlState: controlledStateRef.current,\n });\n\n const inputValueProp = useMemo(() => {\n if (controlledStateRef.current === ComponentControlledState.CONTROLLED) {\n return { inputValue };\n }\n return undefined;\n }, [inputValue]);\n\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 HintLinkComponent={HintLinkComponent}\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, HintLinkComponent, isOptional, label, nameOverride]\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 onChangeProp?.(event, value, reason, details);\n },\n [onChangeProp]\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 onInputChangeProp?.(event, value, reason);\n },\n [onInputChangeProp]\n );\n\n return (\n <MuiAutocomplete\n {...valueProps}\n {...inputValueProp}\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 fullWidth={isFullWidth}\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 isOptionEqualToValue={getIsOptionEqualToValue}\n translate={translate}\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;A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EAAE+B,MAAM,EAAEC,OAAO,KAAK;IACjCrC,YAAY,GAAGmC,KAAK,EAAE9B,KAAK,EAAE+B,MAAM,EAAEC,OAAO,CAAC;EAC/C,CAAC,EACD,CAACrC,YAAY,CACf,CAAC;EAED,MAAMC,aAAa,GAAG/B,WAAW,CAU/B,CAACiE,KAAK,EAAE9B,KAAK,EAAE+B,MAAM,KAAK;IACxBlC,iBAAiB,GAAGiC,KAAK,EAAE9B,KAAK,EAAE+B,MAAM,CAAC;EAC3C,CAAC,EACD,CAAClC,iBAAiB,CACpB,CAAC;EAED,OACExB,IAAA,CAAA4D,aAAA;IAAA,GACMxB,UAAU;IAAA,GACVG,cAAc;IAElB,iBAAe7B,UAAW;IAC1B,WAASmB,MAAO;IAChBgC,oBAAoB,EAAExD,kBAAmB;IACzCyD,QAAQ,EAAEpD,UAAW;IACrBqD,QAAQ,EAAEtD,oBAAqB;IAC/BuD,qBAAqB,EAAE,IAAK;IAC5B1D,EAAE,EAAEC,UAAW;IACf0D,SAAS,EAAEtD,WAAY;IACvBuD,OAAO,EAAEtD,SAAU;IACnBuD,QAAQ,EAAE9D,kBAAmB;IAC7Be,MAAM,EAAEA,MAAO;IACfC,QAAQ,EAAEA,QAAS;IACnBE,aAAa,EAAEA,aAAc;IAC7BE,OAAO,EAAEA,OAAQ;IACjBC,OAAO,EAAEA,OAAQ;IACjB0C,QAAQ,EAAEtD,UAAW;IACrB2B,WAAW,EAAEA,WAAY;IACzB4B,oBAAoB,EAAEzC,uBAAwB;IAC9CE,SAAS,EAAEA;EAAU,CACtB,CAAC;AAEN,CAAC;AAGD,MAAMwC,oBAAoB,GAAG/E,IAAI,CAACU,YAAY,CAAwB;AAEtEqE,oBAAoB,CAACC,WAAW,GAAG,cAAc;AAEjD,SAASD,oBAAoB,IAAIrE,YAAY"}
|
|
1
|
+
{"version":3,"file":"Autocomplete.js","names":["memo","useCallback","useMemo","useRef","Field","ComponentControlledState","useInputValues","getControlState","jsx","_jsx","Autocomplete","_ref","defaultValue","errorMessage","errorMessageList","hasMultipleChoices","id","idOverride","inputValue","isCustomValueAllowed","isDisabled","isFullWidth","isLoading","isOptional","isReadOnly","hint","HintLinkComponent","label","name","nameOverride","onBlur","onChange","onChangeProp","onInputChange","onInputChangeProp","onFocus","options","value","getIsOptionEqualToValue","testId","translate","controlledStateRef","controlledValue","uncontrolledValue","defaultValueProp","undefined","valueProps","controlState","current","inputValueProp","CONTROLLED","renderInput","_ref2","InputLabelProps","InputProps","params","fieldType","hasVisibleLabel","htmlFor","renderFieldComponent","_ref3","ariaDescribedBy","errorMessageElementId","labelElementId","_InputBase","inputProps","required","event","reason","details","_Autocomplete","disableCloseOnSelect","disabled","freeSolo","filterSelectedOptions","fullWidth","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, useRef } from \"react\";\n\nimport { Field } from \"./Field\";\nimport { FieldComponentProps } from \"./FieldComponentProps\";\nimport type { AllowedProps } from \"./AllowedProps\";\nimport {\n ComponentControlledState,\n useInputValues,\n getControlState,\n} from \"./inputUtils\";\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 */\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\"\n | \"errorMessageList\"\n | \"hint\"\n | \"HintLinkComponent\"\n | \"id\"\n | \"isFullWidth\"\n | \"isOptional\"\n | \"name\"\n> &\n AllowedProps;\n\nconst Autocomplete = <\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined\n>({\n defaultValue,\n errorMessage,\n errorMessageList,\n hasMultipleChoices,\n id: idOverride,\n inputValue,\n isCustomValueAllowed,\n isDisabled,\n isFullWidth = false,\n isLoading,\n isOptional = false,\n isReadOnly,\n hint,\n HintLinkComponent,\n label,\n name: nameOverride,\n onBlur,\n onChange: onChangeProp,\n onInputChange: onInputChangeProp,\n onFocus,\n options,\n value,\n getIsOptionEqualToValue,\n testId,\n translate,\n}: AutocompleteProps<OptionType, HasMultipleChoices, IsCustomValueAllowed>) => {\n const controlledStateRef = useRef(\n getControlState({ controlledValue: value, uncontrolledValue: defaultValue })\n );\n const defaultValueProp = useMemo<\n | AutocompleteValue<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >\n | undefined\n >(() => {\n if (hasMultipleChoices) {\n if (value === undefined) {\n return defaultValue;\n }\n return [] as AutocompleteValue<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >;\n }\n return value === undefined ? defaultValue : undefined;\n }, [defaultValue, hasMultipleChoices, value]);\n\n const valueProps = useInputValues({\n defaultValue: defaultValueProp,\n value: value,\n controlState: controlledStateRef.current,\n });\n\n const inputValueProp = useMemo(() => {\n if (controlledStateRef.current === ComponentControlledState.CONTROLLED) {\n return { inputValue };\n }\n return undefined;\n }, [inputValue]);\n\n const renderInput = useCallback(\n ({ InputLabelProps, InputProps, ...params }) => (\n <Field\n errorMessage={errorMessage}\n errorMessageList={errorMessageList}\n fieldType=\"single\"\n hasVisibleLabel\n id={InputLabelProps.htmlFor}\n hint={hint}\n HintLinkComponent={HintLinkComponent}\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 [\n errorMessage,\n errorMessageList,\n hint,\n HintLinkComponent,\n isOptional,\n label,\n nameOverride,\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 onChangeProp?.(event, value, reason, details);\n },\n [onChangeProp]\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 onInputChangeProp?.(event, value, reason);\n },\n [onInputChangeProp]\n );\n\n return (\n <MuiAutocomplete\n {...valueProps}\n {...inputValueProp}\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 fullWidth={isFullWidth}\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 isOptionEqualToValue={getIsOptionEqualToValue}\n translate={translate}\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,EAAEC,MAAM,QAAQ,OAAO;AAAC,SAElDC,KAAK;AAAA,SAIZC,wBAAwB,EACxBC,cAAc,EACdC,eAAe;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAmJjB,MAAMC,YAAY,GAAGC,IAAA,IA8B0D;EAAA,IA1B7E;IACAC,YAAY;IACZC,YAAY;IACZC,gBAAgB;IAChBC,kBAAkB;IAClBC,EAAE,EAAEC,UAAU;IACdC,UAAU;IACVC,oBAAoB;IACpBC,UAAU;IACVC,WAAW,GAAG,KAAK;IACnBC,SAAS;IACTC,UAAU,GAAG,KAAK;IAClBC,UAAU;IACVC,IAAI;IACJC,iBAAiB;IACjBC,KAAK;IACLC,IAAI,EAAEC,YAAY;IAClBC,MAAM;IACNC,QAAQ,EAAEC,YAAY;IACtBC,aAAa,EAAEC,iBAAiB;IAChCC,OAAO;IACPC,OAAO;IACPC,KAAK;IACLC,uBAAuB;IACvBC,MAAM;IACNC;EACuE,CAAC,GAAA7B,IAAA;EACxE,MAAM8B,kBAAkB,GAAGtC,MAAM,CAC/BI,eAAe,CAAC;IAAEmC,eAAe,EAAEL,KAAK;IAAEM,iBAAiB,EAAE/B;EAAa,CAAC,CAC7E,CAAC;EACD,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,QAAQ,EAAEA,QAAS;IACnBE,aAAa,EAAEA,aAAc;IAC7BE,OAAO,EAAEA,OAAQ;IACjBC,OAAO,EAAEA,OAAQ;IACjB0C,QAAQ,EAAEtD,UAAW;IACrB2B,WAAW,EAAEA,WAAY;IACzB4B,oBAAoB,EAAEzC,uBAAwB;IAC9CE,SAAS,EAAEA;EAAU,CACtB,CAAC;AAEN,CAAC;AAGD,MAAMwC,oBAAoB,GAAGhF,IAAI,CAACU,YAAY,CAAwB;AAEtEsE,oBAAoB,CAACC,WAAW,GAAG,cAAc;AAEjD,SAASD,oBAAoB,IAAItE,YAAY"}
|
package/dist/CheckboxGroup.js
CHANGED
|
@@ -17,6 +17,7 @@ const CheckboxGroup = _ref => {
|
|
|
17
17
|
let {
|
|
18
18
|
children,
|
|
19
19
|
errorMessage,
|
|
20
|
+
errorMessageList,
|
|
20
21
|
hint,
|
|
21
22
|
HintLinkComponent,
|
|
22
23
|
isDisabled,
|
|
@@ -42,6 +43,7 @@ const CheckboxGroup = _ref => {
|
|
|
42
43
|
}, [children, testId, translate]);
|
|
43
44
|
return _jsx(Field, {
|
|
44
45
|
errorMessage: errorMessage,
|
|
46
|
+
errorMessageList: errorMessageList,
|
|
45
47
|
fieldType: "group",
|
|
46
48
|
hasVisibleLabel: true,
|
|
47
49
|
hint: hint,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxGroup.js","names":["memo","useCallback","Field","jsx","_jsx","CheckboxGroup","_ref","children","errorMessage","hint","HintLinkComponent","isDisabled","isRequired","label","testId","translate","renderFieldComponent","_ref2","ariaDescribedBy","errorMessageElementId","labelElementId","_FormGroup","fieldType","hasVisibleLabel","isOptional","MemoizedCheckboxGroup","displayName"],"sources":["../src/CheckboxGroup.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { FormGroup as MuiFormGroup } from \"@mui/material\";\nimport { memo, ReactElement, useCallback } from \"react\";\n\nimport { Checkbox } from \"./Checkbox\";\nimport { Field } from \"./Field\";\nimport { FieldComponentProps } from \"./FieldComponentProps\";\nimport type { AllowedProps } from \"./AllowedProps\";\n\nexport type CheckboxGroupProps = {\n /**\n * A single Checkbox element or an array of Checkbox elements\n */\n children:\n | ReactElement<typeof Checkbox>\n | Array<ReactElement<typeof Checkbox>>;\n /**\n * If `true`, the CheckboxGroup is required\n */\n isRequired?: boolean;\n /**\n * The label text for the CheckboxGroup\n */\n label: string;\n} & Pick<\n FieldComponentProps,\n \"errorMessage\" | \"hint\"
|
|
1
|
+
{"version":3,"file":"CheckboxGroup.js","names":["memo","useCallback","Field","jsx","_jsx","CheckboxGroup","_ref","children","errorMessage","errorMessageList","hint","HintLinkComponent","isDisabled","isRequired","label","testId","translate","renderFieldComponent","_ref2","ariaDescribedBy","errorMessageElementId","labelElementId","_FormGroup","fieldType","hasVisibleLabel","isOptional","MemoizedCheckboxGroup","displayName"],"sources":["../src/CheckboxGroup.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { FormGroup as MuiFormGroup } from \"@mui/material\";\nimport { memo, ReactElement, useCallback } from \"react\";\n\nimport { Checkbox } from \"./Checkbox\";\nimport { Field } from \"./Field\";\nimport { FieldComponentProps } from \"./FieldComponentProps\";\nimport type { AllowedProps } from \"./AllowedProps\";\n\nexport type CheckboxGroupProps = {\n /**\n * A single Checkbox element or an array of Checkbox elements\n */\n children:\n | ReactElement<typeof Checkbox>\n | Array<ReactElement<typeof Checkbox>>;\n /**\n * If `true`, the CheckboxGroup is required\n */\n isRequired?: boolean;\n /**\n * The label text for the CheckboxGroup\n */\n label: string;\n} & Pick<\n FieldComponentProps,\n | \"errorMessage\"\n | \"errorMessageList\"\n | \"hint\"\n | \"HintLinkComponent\"\n | \"isDisabled\"\n> &\n AllowedProps;\n\nconst CheckboxGroup = ({\n children,\n errorMessage,\n errorMessageList,\n hint,\n HintLinkComponent,\n isDisabled,\n isRequired = false,\n label,\n testId,\n translate,\n}: CheckboxGroupProps) => {\n const renderFieldComponent = useCallback(\n ({ ariaDescribedBy, errorMessageElementId, labelElementId }) => (\n <MuiFormGroup\n aria-describedby={ariaDescribedBy}\n aria-errormessage={errorMessageElementId}\n aria-labelledby={labelElementId}\n data-se={testId}\n translate={translate}\n >\n {children}\n </MuiFormGroup>\n ),\n [children, testId, translate]\n );\n\n return (\n <Field\n errorMessage={errorMessage}\n errorMessageList={errorMessageList}\n fieldType=\"group\"\n hasVisibleLabel={true}\n hint={hint}\n HintLinkComponent={HintLinkComponent}\n isDisabled={isDisabled}\n isOptional={!isRequired}\n label={label}\n renderFieldComponent={renderFieldComponent}\n />\n );\n};\n\nconst MemoizedCheckboxGroup = memo(CheckboxGroup);\nMemoizedCheckboxGroup.displayName = \"CheckboxGroup\";\n\nexport { MemoizedCheckboxGroup as CheckboxGroup };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,SAASA,IAAI,EAAgBC,WAAW,QAAQ,OAAO;AAAC,SAG/CC,KAAK;AAAA,SAAAC,GAAA,IAAAC,IAAA;AA6Bd,MAAMC,aAAa,GAAGC,IAAA,IAWI;EAAA,IAXH;IACrBC,QAAQ;IACRC,YAAY;IACZC,gBAAgB;IAChBC,IAAI;IACJC,iBAAiB;IACjBC,UAAU;IACVC,UAAU,GAAG,KAAK;IAClBC,KAAK;IACLC,MAAM;IACNC;EACkB,CAAC,GAAAV,IAAA;EACnB,MAAMW,oBAAoB,GAAGhB,WAAW,CACtCiB,KAAA;IAAA,IAAC;MAAEC,eAAe;MAAEC,qBAAqB;MAAEC;IAAe,CAAC,GAAAH,KAAA;IAAA,OACzDd,IAAA,CAAAkB,UAAA;MACE,oBAAkBH,eAAgB;MAClC,qBAAmBC,qBAAsB;MACzC,mBAAiBC,cAAe;MAChC,WAASN,MAAO;MAChBC,SAAS,EAAEA,SAAU;MAAAT,QAAA,EAEpBA;IAAQ,CACG,CAAC;EAAA,CAChB,EACD,CAACA,QAAQ,EAAEQ,MAAM,EAAEC,SAAS,CAC9B,CAAC;EAED,OACEZ,IAAA,CAACF,KAAK;IACJM,YAAY,EAAEA,YAAa;IAC3BC,gBAAgB,EAAEA,gBAAiB;IACnCc,SAAS,EAAC,OAAO;IACjBC,eAAe,EAAE,IAAK;IACtBd,IAAI,EAAEA,IAAK;IACXC,iBAAiB,EAAEA,iBAAkB;IACrCC,UAAU,EAAEA,UAAW;IACvBa,UAAU,EAAE,CAACZ,UAAW;IACxBC,KAAK,EAAEA,KAAM;IACbG,oBAAoB,EAAEA;EAAqB,CAC5C,CAAC;AAEN,CAAC;AAED,MAAMS,qBAAqB,GAAG1B,IAAI,CAACK,aAAa,CAAC;AACjDqB,qBAAqB,CAACC,WAAW,GAAG,eAAe;AAEnD,SAASD,qBAAqB,IAAIrB,aAAa"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import _List from "@mui/material/List";
|
|
2
|
+
import _ListItem from "@mui/material/ListItem";
|
|
3
|
+
/*!
|
|
4
|
+
* Copyright (c) 2022-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 { useOdysseyDesignTokens } from "./OdysseyDesignTokensContext.js";
|
|
15
|
+
import { memo, useMemo } from "react";
|
|
16
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
+
const listItemStyles = {
|
|
18
|
+
display: "list-item",
|
|
19
|
+
paddingInlineStart: 0
|
|
20
|
+
};
|
|
21
|
+
const ErrorMessageList = _ref => {
|
|
22
|
+
let {
|
|
23
|
+
errorMessages
|
|
24
|
+
} = _ref;
|
|
25
|
+
const odysseyDesignTokens = useOdysseyDesignTokens();
|
|
26
|
+
const listStyles = useMemo(() => ({
|
|
27
|
+
listStyle: "disc",
|
|
28
|
+
paddingInlineStart: odysseyDesignTokens.Spacing4
|
|
29
|
+
}), [odysseyDesignTokens]);
|
|
30
|
+
return _jsx(_List, {
|
|
31
|
+
disablePadding: true,
|
|
32
|
+
dense: true,
|
|
33
|
+
sx: listStyles,
|
|
34
|
+
children: errorMessages.map(errorMessage => _jsx(_ListItem, {
|
|
35
|
+
disablePadding: true,
|
|
36
|
+
dense: true,
|
|
37
|
+
sx: listItemStyles,
|
|
38
|
+
children: errorMessage
|
|
39
|
+
}))
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
const MemoizedErrorMessageList = memo(ErrorMessageList);
|
|
43
|
+
MemoizedErrorMessageList.displayName = "ErrorMessageList";
|
|
44
|
+
export { MemoizedErrorMessageList as ErrorMessageList };
|
|
45
|
+
//# sourceMappingURL=ErrorMessageList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorMessageList.js","names":["useOdysseyDesignTokens","memo","useMemo","jsx","_jsx","listItemStyles","display","paddingInlineStart","ErrorMessageList","_ref","errorMessages","odysseyDesignTokens","listStyles","listStyle","Spacing4","_List","disablePadding","dense","sx","children","map","errorMessage","_ListItem","MemoizedErrorMessageList","displayName"],"sources":["../src/ErrorMessageList.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 { List as MuiList, ListItem as MuiListItem } from \"@mui/material\";\nimport { useOdysseyDesignTokens } from \"./OdysseyDesignTokensContext\";\nimport { memo, useMemo } from \"react\";\n\nexport type ErrorMessageListProps = {\n errorMessages: string[];\n};\n\nconst listItemStyles = {\n display: \"list-item\",\n paddingInlineStart: 0,\n};\n\nconst ErrorMessageList = ({ errorMessages }: ErrorMessageListProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n const listStyles = useMemo(\n () => ({\n listStyle: \"disc\",\n paddingInlineStart: odysseyDesignTokens.Spacing4,\n }),\n [odysseyDesignTokens]\n );\n\n return (\n <MuiList disablePadding dense sx={listStyles}>\n {errorMessages.map((errorMessage) => (\n <MuiListItem disablePadding dense sx={listItemStyles}>\n {errorMessage}\n </MuiListItem>\n ))}\n </MuiList>\n );\n};\n\nconst MemoizedErrorMessageList = memo(ErrorMessageList);\nMemoizedErrorMessageList.displayName = \"ErrorMessageList\";\n\nexport { MemoizedErrorMessageList as ErrorMessageList };\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVA,SAaSA,sBAAsB;AAC/B,SAASC,IAAI,EAAEC,OAAO,QAAQ,OAAO;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAMtC,MAAMC,cAAc,GAAG;EACrBC,OAAO,EAAE,WAAW;EACpBC,kBAAkB,EAAE;AACtB,CAAC;AAED,MAAMC,gBAAgB,GAAGC,IAAA,IAA8C;EAAA,IAA7C;IAAEC;EAAqC,CAAC,GAAAD,IAAA;EAChE,MAAME,mBAAmB,GAAGX,sBAAsB,CAAC,CAAC;EAEpD,MAAMY,UAAU,GAAGV,OAAO,CACxB,OAAO;IACLW,SAAS,EAAE,MAAM;IACjBN,kBAAkB,EAAEI,mBAAmB,CAACG;EAC1C,CAAC,CAAC,EACF,CAACH,mBAAmB,CACtB,CAAC;EAED,OACEP,IAAA,CAAAW,KAAA;IAASC,cAAc;IAACC,KAAK;IAACC,EAAE,EAAEN,UAAW;IAAAO,QAAA,EAC1CT,aAAa,CAACU,GAAG,CAAEC,YAAY,IAC9BjB,IAAA,CAAAkB,SAAA;MAAaN,cAAc;MAACC,KAAK;MAACC,EAAE,EAAEb,cAAe;MAAAc,QAAA,EAClDE;IAAY,CACF,CACd;EAAC,CACK,CAAC;AAEd,CAAC;AAED,MAAME,wBAAwB,GAAGtB,IAAI,CAACO,gBAAgB,CAAC;AACvDe,wBAAwB,CAACC,WAAW,GAAG,kBAAkB;AAEzD,SAASD,wBAAwB,IAAIf,gBAAgB"}
|
package/dist/Field.js
CHANGED
|
@@ -26,6 +26,7 @@ export const fieldTypeValues = ["single", "group"];
|
|
|
26
26
|
const Field = _ref => {
|
|
27
27
|
let {
|
|
28
28
|
errorMessage,
|
|
29
|
+
errorMessageList,
|
|
29
30
|
fieldType,
|
|
30
31
|
hasVisibleLabel,
|
|
31
32
|
hint,
|
|
@@ -43,7 +44,7 @@ const Field = _ref => {
|
|
|
43
44
|
} = useTranslation();
|
|
44
45
|
const id = useUniqueId(idOverride);
|
|
45
46
|
const hintId = hint ? `${id}-hint` : undefined;
|
|
46
|
-
const errorMessageElementId = errorMessage ? `${id}-error` : undefined;
|
|
47
|
+
const errorMessageElementId = errorMessage || errorMessageList ? `${id}-error` : undefined;
|
|
47
48
|
const labelElementId = `${id}-label`;
|
|
48
49
|
const ariaDescribedBy = useMemo(() => [hintId, errorMessageElementId].join(" ").trim() || undefined, [errorMessageElementId, hintId]);
|
|
49
50
|
const {
|
|
@@ -53,7 +54,7 @@ const Field = _ref => {
|
|
|
53
54
|
return _jsxs(_FormControl, {
|
|
54
55
|
component: fieldType === "group" ? "fieldset" : "div",
|
|
55
56
|
disabled: isDisabled,
|
|
56
|
-
error: Boolean(errorMessage),
|
|
57
|
+
error: Boolean(errorMessage) || Array.isArray(errorMessageList) && errorMessageList.length > 0,
|
|
57
58
|
role: isRadioGroup ? "radiogroup" : undefined,
|
|
58
59
|
fullWidth: isFullWidth,
|
|
59
60
|
children: [fieldType === "group" ? _jsxs(_FormLabel, {
|
|
@@ -78,9 +79,10 @@ const Field = _ref => {
|
|
|
78
79
|
errorMessageElementId,
|
|
79
80
|
id,
|
|
80
81
|
labelElementId
|
|
81
|
-
}), errorMessage && _jsx(FieldError, {
|
|
82
|
+
}), (errorMessage || errorMessageList) && _jsx(FieldError, {
|
|
82
83
|
id: errorMessageElementId,
|
|
83
|
-
|
|
84
|
+
message: errorMessage,
|
|
85
|
+
messageList: errorMessageList
|
|
84
86
|
})]
|
|
85
87
|
});
|
|
86
88
|
};
|
package/dist/Field.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.js","names":["memo","useMemo","FieldError","FieldHint","FieldLabel","Typography","useFieldset","useTranslation","useUniqueId","jsxs","_jsxs","jsx","_jsx","fieldTypeValues","Field","_ref","errorMessage","fieldType","hasVisibleLabel","hint","HintLinkComponent","id","idOverride","isDisabled","isDisabledProp","isFullWidth","isRadioGroup","isOptional","label","renderFieldComponent","t","hintId","undefined","errorMessageElementId","labelElementId","ariaDescribedBy","join","trim","isFieldsetDisabled","_FormControl","component","disabled","error","Boolean","role","fullWidth","children","_FormLabel","color","inputId","text","LinkComponent","MemoizedField","displayName"],"sources":["../src/Field.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { memo, ReactElement, useMemo } from \"react\";\n\nimport {\n FormControl as MuiFormControl,\n FormLabel as MuiFormLabel,\n} from \"@mui/material\";\n\nimport { FieldComponentProps } from \"./FieldComponentProps\";\nimport { FieldError } from \"./FieldError\";\nimport { FieldHint } from \"./FieldHint\";\nimport { FieldLabel } from \"./FieldLabel\";\nimport { Typography } from \"./Typography\";\nimport { useFieldset } from \"./FieldsetContext\";\nimport { useTranslation } from \"react-i18next\";\nimport { useUniqueId } from \"./useUniqueId\";\n\nexport const fieldTypeValues = [\"single\", \"group\"] as const;\n\nexport type FieldProps = {\n /**\n * The field type determines how ARIA components are setup. It's important to use this to denote if you expect only one component (like a text field) or multiple (like a radio group).\n */\n fieldType: (typeof fieldTypeValues)[number];\n /**\n * If `true`, the Field label will be shown\n */\n hasVisibleLabel: boolean;\n /**\n * Important for narrowing down the `fieldset` role to \"radiogroup\".\n */\n isRadioGroup?: boolean;\n /**\n * Important for determining if children inherit error state\n */\n isCheckboxGroup?: boolean;\n /**\n * The label for the `input` element.\n */\n label: string;\n /**\n * The short hint displayed in the `input` before the user enters a value.\n */\n placeholder?: string;\n /**\n * Render-props function that sends back ARIA props to your field component.\n */\n renderFieldComponent: ({\n ariaDescribedBy,\n dataSe,\n errorMessageElementId,\n id,\n labelElementId,\n }: {\n ariaDescribedBy?: string;\n dataSe?: string;\n errorMessageElementId?: string;\n id: string;\n labelElementId: string;\n }) => ReactElement;\n};\n\nconst Field = ({\n errorMessage,\n fieldType,\n hasVisibleLabel,\n hint,\n HintLinkComponent,\n id: idOverride,\n isDisabled: isDisabledProp = false,\n isFullWidth = false,\n isRadioGroup = false,\n isOptional = false,\n label,\n renderFieldComponent,\n}: FieldProps &\n Pick<\n FieldComponentProps,\n | \"errorMessage\"\n | \"hint\"\n | \"HintLinkComponent\"\n | \"id\"\n | \"isDisabled\"\n | \"isFullWidth\"\n | \"isOptional\"\n >) => {\n const { t } = useTranslation();\n\n const id = useUniqueId(idOverride);\n const hintId = hint ? `${id}-hint` : undefined;\n const errorMessageElementId
|
|
1
|
+
{"version":3,"file":"Field.js","names":["memo","useMemo","FieldError","FieldHint","FieldLabel","Typography","useFieldset","useTranslation","useUniqueId","jsxs","_jsxs","jsx","_jsx","fieldTypeValues","Field","_ref","errorMessage","errorMessageList","fieldType","hasVisibleLabel","hint","HintLinkComponent","id","idOverride","isDisabled","isDisabledProp","isFullWidth","isRadioGroup","isOptional","label","renderFieldComponent","t","hintId","undefined","errorMessageElementId","labelElementId","ariaDescribedBy","join","trim","isFieldsetDisabled","_FormControl","component","disabled","error","Boolean","Array","isArray","length","role","fullWidth","children","_FormLabel","color","inputId","text","LinkComponent","message","messageList","MemoizedField","displayName"],"sources":["../src/Field.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { memo, ReactElement, useMemo } from \"react\";\n\nimport {\n FormControl as MuiFormControl,\n FormLabel as MuiFormLabel,\n} from \"@mui/material\";\n\nimport { FieldComponentProps } from \"./FieldComponentProps\";\nimport { FieldError } from \"./FieldError\";\nimport { FieldHint } from \"./FieldHint\";\nimport { FieldLabel } from \"./FieldLabel\";\nimport { Typography } from \"./Typography\";\nimport { useFieldset } from \"./FieldsetContext\";\nimport { useTranslation } from \"react-i18next\";\nimport { useUniqueId } from \"./useUniqueId\";\n\nexport const fieldTypeValues = [\"single\", \"group\"] as const;\n\nexport type FieldProps = {\n /**\n * If `error` is not undefined, the `input` will indicate an error.\n */\n errorMessage?: string;\n /**\n * If `error` is not undefined, the `input` will indicate an error.\n */\n errorMessageList?: string[];\n /**\n * The field type determines how ARIA components are setup. It's important to use this to denote if you expect only one component (like a text field) or multiple (like a radio group).\n */\n fieldType: (typeof fieldTypeValues)[number];\n /**\n * If `true`, the Field label will be shown\n */\n hasVisibleLabel: boolean;\n /**\n * Important for narrowing down the `fieldset` role to \"radiogroup\".\n */\n isRadioGroup?: boolean;\n /**\n * Important for determining if children inherit error state\n */\n isCheckboxGroup?: boolean;\n /**\n * The label for the `input` element.\n */\n label: string;\n /**\n * The short hint displayed in the `input` before the user enters a value.\n */\n placeholder?: string;\n /**\n * Render-props function that sends back ARIA props to your field component.\n */\n renderFieldComponent: ({\n ariaDescribedBy,\n dataSe,\n errorMessageElementId,\n id,\n labelElementId,\n }: {\n ariaDescribedBy?: string;\n dataSe?: string;\n errorMessageElementId?: string;\n id: string;\n labelElementId: string;\n }) => ReactElement;\n};\n\nconst Field = ({\n errorMessage,\n errorMessageList,\n fieldType,\n hasVisibleLabel,\n hint,\n HintLinkComponent,\n id: idOverride,\n isDisabled: isDisabledProp = false,\n isFullWidth = false,\n isRadioGroup = false,\n isOptional = false,\n label,\n renderFieldComponent,\n}: FieldProps &\n Pick<\n FieldComponentProps,\n | \"errorMessage\"\n | \"errorMessageList\"\n | \"hint\"\n | \"HintLinkComponent\"\n | \"id\"\n | \"isDisabled\"\n | \"isFullWidth\"\n | \"isOptional\"\n >) => {\n const { t } = useTranslation();\n\n const id = useUniqueId(idOverride);\n const hintId = hint ? `${id}-hint` : undefined;\n const errorMessageElementId =\n errorMessage || errorMessageList ? `${id}-error` : undefined;\n const labelElementId = `${id}-label`;\n\n const ariaDescribedBy = useMemo(\n () => [hintId, errorMessageElementId].join(\" \").trim() || undefined,\n [errorMessageElementId, hintId]\n );\n\n const { isDisabled: isFieldsetDisabled } = useFieldset();\n\n const isDisabled = useMemo(\n () => isDisabledProp || isFieldsetDisabled,\n [isDisabledProp, isFieldsetDisabled]\n );\n\n return (\n <MuiFormControl\n component={fieldType === \"group\" ? \"fieldset\" : \"div\"}\n disabled={isDisabled}\n error={\n Boolean(errorMessage) ||\n (Array.isArray(errorMessageList) && errorMessageList.length > 0)\n }\n role={isRadioGroup ? \"radiogroup\" : undefined}\n fullWidth={isFullWidth}\n >\n {fieldType === \"group\" ? (\n <MuiFormLabel component=\"legend\">\n {label}{\" \"}\n {isOptional && label && (\n <Typography component=\"span\" color=\"textSecondary\">\n ({t(\"fieldlabel.optional.text\")})\n </Typography>\n )}\n </MuiFormLabel>\n ) : (\n <FieldLabel\n hasVisibleLabel={hasVisibleLabel}\n id={labelElementId}\n inputId={id}\n isOptional={isOptional}\n text={label}\n />\n )}\n\n {hint && (\n <FieldHint id={hintId} LinkComponent={HintLinkComponent} text={hint} />\n )}\n\n {renderFieldComponent({\n ariaDescribedBy,\n errorMessageElementId,\n id,\n labelElementId,\n })}\n\n {(errorMessage || errorMessageList) && (\n <FieldError\n id={errorMessageElementId}\n message={errorMessage}\n messageList={errorMessageList}\n />\n )}\n </MuiFormControl>\n );\n};\n\nconst MemoizedField = memo(Field);\nMemoizedField.displayName = \"Field\";\n\nexport { MemoizedField as Field };\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,EAAgBC,OAAO,QAAQ,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AC1BsB,OAAO,EAAExC,YAAa;MACtByC,WAAW,EAAExC;IAAiB,CAC/B,CACF;EAAA,CACa,CAAC;AAErB,CAAC;AAED,MAAMyC,aAAa,GAAG1D,IAAI,CAACc,KAAK,CAAC;AACjC4C,aAAa,CAACC,WAAW,GAAG,OAAO;AAEnC,SAASD,aAAa,IAAI5C,KAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldComponentProps.js","names":[],"sources":["../src/FieldComponentProps.ts"],"sourcesContent":["/*!\n * Copyright (c) 2021-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 { ReactElement } from \"react\";\n\nimport { HintLink } from \"./HintLink\";\n\nexport type FieldComponentProps = {\n /**\n * If `error` is not undefined, the `input` will indicate an error.\n */\n errorMessage?: string;\n /**\n * The helper text content.\n */\n hint?: string;\n /**\n * A `Link` component to provide greater context that is rendered at the end of the `hint` text\n */\n HintLinkComponent?: ReactElement<typeof HintLink>;\n /**\n * The id of the `input` element.\n */\n id?: string;\n /**\n * If `true`, the component is disabled.\n */\n isDisabled?: boolean;\n /**\n * If `true`, the component can stretch to fill the width of the container.\n */\n isFullWidth?: boolean;\n /**\n * If `true`, the `input` element is not required.\n */\n isOptional?: boolean;\n /**\n * It prevents the user from changing the value of the field\n */\n isReadOnly?: boolean;\n /**\n * The name of the `input` element. Defaults to the `id` if not set.\n */\n name?: string;\n};\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"FieldComponentProps.js","names":[],"sources":["../src/FieldComponentProps.ts"],"sourcesContent":["/*!\n * Copyright (c) 2021-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 { ReactElement } from \"react\";\n\nimport { HintLink } from \"./HintLink\";\n\nexport type FieldComponentProps = {\n /**\n * If `error` is not undefined, the `input` will indicate an error.\n */\n errorMessage?: string;\n /**\n * If `error` is not undefined, the `input` will indicate multiple errors.\n */\n errorMessageList?: string[];\n /**\n * The helper text content.\n */\n hint?: string;\n /**\n * A `Link` component to provide greater context that is rendered at the end of the `hint` text\n */\n HintLinkComponent?: ReactElement<typeof HintLink>;\n /**\n * The id of the `input` element.\n */\n id?: string;\n /**\n * If `true`, the component is disabled.\n */\n isDisabled?: boolean;\n /**\n * If `true`, the component can stretch to fill the width of the container.\n */\n isFullWidth?: boolean;\n /**\n * If `true`, the `input` element is not required.\n */\n isOptional?: boolean;\n /**\n * It prevents the user from changing the value of the field\n */\n isReadOnly?: boolean;\n /**\n * The name of the `input` element. Defaults to the `id` if not set.\n */\n name?: string;\n};\n"],"mappings":""}
|
package/dist/FieldError.js
CHANGED
|
@@ -13,14 +13,17 @@ import _FormHelperText from "@mui/material/FormHelperText";
|
|
|
13
13
|
|
|
14
14
|
import { memo } from "react";
|
|
15
15
|
import { ScreenReaderText } from "./ScreenReaderText.js";
|
|
16
|
+
import { ErrorMessageList } from "./ErrorMessageList.js";
|
|
16
17
|
import { useTranslation } from "react-i18next";
|
|
18
|
+
import { Box } from "./Box.js";
|
|
17
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
20
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
21
|
const FieldError = _ref => {
|
|
20
22
|
let {
|
|
21
23
|
id,
|
|
24
|
+
message,
|
|
25
|
+
messageList,
|
|
22
26
|
testId,
|
|
23
|
-
text,
|
|
24
27
|
translate
|
|
25
28
|
} = _ref;
|
|
26
29
|
const {
|
|
@@ -34,7 +37,11 @@ const FieldError = _ref => {
|
|
|
34
37
|
children: [_jsx(ScreenReaderText, {
|
|
35
38
|
translate: translate,
|
|
36
39
|
children: `${t("fielderror.screenreader.text")}:`
|
|
37
|
-
}),
|
|
40
|
+
}), _jsxs(Box, {
|
|
41
|
+
children: [message, messageList && _jsx(ErrorMessageList, {
|
|
42
|
+
errorMessages: messageList
|
|
43
|
+
})]
|
|
44
|
+
})]
|
|
38
45
|
});
|
|
39
46
|
};
|
|
40
47
|
const MemoizedFieldError = memo(FieldError);
|
package/dist/FieldError.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldError.js","names":["memo","ScreenReaderText","useTranslation","jsx","_jsx","jsxs","_jsxs","FieldError","_ref","id","
|
|
1
|
+
{"version":3,"file":"FieldError.js","names":["memo","ScreenReaderText","ErrorMessageList","useTranslation","Box","jsx","_jsx","jsxs","_jsxs","FieldError","_ref","id","message","messageList","testId","translate","t","_FormHelperText","error","children","errorMessages","MemoizedFieldError","displayName"],"sources":["../src/FieldError.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { memo } from \"react\";\n\nimport { FormHelperText } from \"@mui/material\";\nimport { ScreenReaderText } from \"./ScreenReaderText\";\nimport { ErrorMessageList } from \"./ErrorMessageList\";\nimport { useTranslation } from \"react-i18next\";\n\nimport type { AllowedProps } from \"./AllowedProps\";\nimport { Box } from \"./Box\";\n\nexport type FieldErrorProps = {\n id?: string;\n message?: string;\n messageList?: string[];\n} & AllowedProps;\n\nconst FieldError = ({\n id,\n message,\n messageList,\n testId,\n translate,\n}: FieldErrorProps) => {\n const { t } = useTranslation();\n\n return (\n <FormHelperText data-se={testId} error id={id} translate={translate}>\n <ScreenReaderText translate={translate}>{`${t(\n \"fielderror.screenreader.text\"\n )}:`}</ScreenReaderText>\n <Box>\n {message}\n {messageList && <ErrorMessageList errorMessages={messageList} />}\n </Box>\n </FormHelperText>\n );\n};\n\nconst MemoizedFieldError = memo(FieldError);\nMemoizedFieldError.displayName = \"FieldError\";\n\nexport { MemoizedFieldError as FieldError };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,QAAQ,OAAO;AAAC,SAGpBC,gBAAgB;AAAA,SAChBC,gBAAgB;AACzB,SAASC,cAAc,QAAQ,eAAe;AAAC,SAGtCC,GAAG;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAQZ,MAAMC,UAAU,GAAGC,IAAA,IAMI;EAAA,IANH;IAClBC,EAAE;IACFC,OAAO;IACPC,WAAW;IACXC,MAAM;IACNC;EACe,CAAC,GAAAL,IAAA;EAChB,MAAM;IAAEM;EAAE,CAAC,GAAGb,cAAc,CAAC,CAAC;EAE9B,OACEK,KAAA,CAAAS,eAAA;IAAgB,WAASH,MAAO;IAACI,KAAK;IAACP,EAAE,EAAEA,EAAG;IAACI,SAAS,EAAEA,SAAU;IAAAI,QAAA,GAClEb,IAAA,CAACL,gBAAgB;MAACc,SAAS,EAAEA,SAAU;MAAAI,QAAA,EAAG,GAAEH,CAAC,CAC3C,8BACF,CAAE;IAAE,CAAmB,CAAC,EACxBR,KAAA,CAACJ,GAAG;MAAAe,QAAA,GACDP,OAAO,EACPC,WAAW,IAAIP,IAAA,CAACJ,gBAAgB;QAACkB,aAAa,EAAEP;MAAY,CAAE,CAAC;IAAA,CAC7D,CAAC;EAAA,CACQ,CAAC;AAErB,CAAC;AAED,MAAMQ,kBAAkB,GAAGrB,IAAI,CAACS,UAAU,CAAC;AAC3CY,kBAAkB,CAACC,WAAW,GAAG,YAAY;AAE7C,SAASD,kBAAkB,IAAIZ,UAAU"}
|
package/dist/NativeSelect.js
CHANGED
|
@@ -19,6 +19,7 @@ const NativeSelect = forwardRef((_ref, ref) => {
|
|
|
19
19
|
let {
|
|
20
20
|
defaultValue,
|
|
21
21
|
errorMessage,
|
|
22
|
+
errorMessageList,
|
|
22
23
|
hasMultipleChoices: hasMultipleChoicesProp,
|
|
23
24
|
hint,
|
|
24
25
|
HintLinkComponent,
|
|
@@ -77,6 +78,7 @@ const NativeSelect = forwardRef((_ref, ref) => {
|
|
|
77
78
|
}, [children, idOverride, inputValues, hasMultipleChoices, onBlur, onChange, onFocus, ref, testId, translate]);
|
|
78
79
|
return _jsx(Field, {
|
|
79
80
|
errorMessage: errorMessage,
|
|
81
|
+
errorMessageList: errorMessageList,
|
|
80
82
|
fieldType: "single",
|
|
81
83
|
hasVisibleLabel: true,
|
|
82
84
|
hint: hint,
|
package/dist/NativeSelect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeSelect.js","names":["React","forwardRef","memo","useCallback","useMemo","useRef","Field","getControlState","useInputValues","jsx","_jsx","NativeSelect","_ref","ref","defaultValue","errorMessage","hasMultipleChoices","hasMultipleChoicesProp","hint","HintLinkComponent","id","idOverride","isDisabled","isFullWidth","isMultiSelect","isOptional","label","onBlur","onChange","onChangeProp","onFocus","testId","translate","value","children","controlledStateRef","controlledValue","uncontrolledValue","inputValues","controlState","current","event","child","undefined","renderFieldComponent","_ref2","ariaDescribedBy","errorMessageElementId","labelElementId","_Select","inputProps","name","multiple","native","fieldType","hasVisibleLabel","MemoizedNativeSelect","displayName"],"sources":["../src/NativeSelect.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport React, {\n ReactElement,\n forwardRef,\n memo,\n useCallback,\n useMemo,\n useRef,\n} from \"react\";\nimport {\n Select as MuiSelect,\n SelectProps as MuiSelectProps,\n} from \"@mui/material\";\nimport { Field } from \"./Field\";\nimport { FieldComponentProps } from \"./FieldComponentProps\";\nimport type { AllowedProps } from \"./AllowedProps\";\nimport { getControlState, useInputValues } from \"./inputUtils\";\nimport { ForwardRefWithType } from \"./@types/react-augment\";\n\nexport type NativeSelectOption = {\n text: string;\n value?: string;\n type?: \"heading\" | \"option\";\n};\n\nexport type NativeSelectValueType<HasMultipleChoices> =\n HasMultipleChoices extends true ? string[] : string;\n\nexport type NativeSelectProps<\n Value extends NativeSelectValueType<HasMultipleChoices>,\n HasMultipleChoices extends boolean\n> = {\n /**\n * The options or optgroup elements within the NativeSelect\n */\n children?: ReactElement<\"option\"> | ReactElement<\"optgroup\">;\n /**\n * The default value of the NativeSelect. Use when component is uncontrolled\n */\n defaultValue?: Value;\n /**\n * If `true`, the Select allows multiple selections\n */\n hasMultipleChoices?: HasMultipleChoices;\n /**\n * @deprecated Use `hasMultipleChoices` instead\n */\n /** **Deprecated:** use `hasMultipleChoices` */\n isMultiSelect?: HasMultipleChoices;\n /**\n * The label text for the NativeSelect\n */\n label: string;\n /**\n * Callback fired when the NativeSelect loses focus\n */\n onBlur?: MuiSelectProps<Value>[\"onBlur\"];\n /**\n * Callback fired when the value of the NativeSelect changes\n */\n onChange?: MuiSelectProps<Value>[\"onChange\"];\n /**\n * Callback fired when the NativeSelect gains focus\n */\n onFocus?: MuiSelectProps<Value>[\"onFocus\"];\n options: Value;\n /**\n * The value or values selected in the NativeSelect. Use when component is controlled\n */\n value?: Value;\n} & Pick<\n FieldComponentProps,\n | \"errorMessage\"\n | \"hint\"\n | \"HintLinkComponent\"\n | \"id\"\n | \"isDisabled\"\n | \"isFullWidth\"\n | \"isOptional\"\n> &\n AllowedProps;\n\nconst NativeSelect: ForwardRefWithType = forwardRef(\n <\n Value extends NativeSelectValueType<HasMultipleChoices>,\n HasMultipleChoices extends boolean\n >(\n {\n defaultValue,\n errorMessage,\n hasMultipleChoices: hasMultipleChoicesProp,\n hint,\n HintLinkComponent,\n id: idOverride,\n isDisabled = false,\n isFullWidth = false,\n isMultiSelect,\n isOptional = false,\n label,\n onBlur,\n onChange: onChangeProp,\n onFocus,\n testId,\n translate,\n value,\n children,\n }: NativeSelectProps<Value, HasMultipleChoices>,\n ref?: React.Ref<ReactElement>\n ) => {\n const controlledStateRef = useRef(\n getControlState({\n controlledValue: value,\n uncontrolledValue: defaultValue,\n })\n );\n const inputValues = useInputValues({\n defaultValue,\n value,\n controlState: controlledStateRef.current,\n });\n\n const onChange = useCallback<\n NonNullable<MuiSelectProps<Value>[\"onChange\"]>\n >(\n (event, child) => {\n onChangeProp?.(event, child);\n },\n [onChangeProp]\n );\n\n const hasMultipleChoices = useMemo(\n () =>\n hasMultipleChoicesProp === undefined\n ? isMultiSelect\n : hasMultipleChoicesProp,\n [hasMultipleChoicesProp, isMultiSelect]\n );\n const renderFieldComponent = useCallback(\n ({ ariaDescribedBy, errorMessageElementId, labelElementId }) => (\n <MuiSelect\n {...inputValues}\n aria-describedby={ariaDescribedBy}\n children={children}\n data-se={testId}\n id={idOverride}\n inputProps={{\n \"aria-errormessage\": errorMessageElementId,\n \"aria-labelledby\": labelElementId,\n }}\n name={idOverride}\n multiple={hasMultipleChoices}\n native={true}\n onBlur={onBlur}\n onChange={onChange}\n onFocus={onFocus}\n ref={ref}\n translate={translate}\n />\n ),\n [\n children,\n idOverride,\n inputValues,\n hasMultipleChoices,\n onBlur,\n onChange,\n onFocus,\n ref,\n testId,\n translate,\n ]\n );\n\n return (\n <Field\n errorMessage={errorMessage}\n fieldType=\"single\"\n hasVisibleLabel\n hint={hint}\n HintLinkComponent={HintLinkComponent}\n id={idOverride}\n isDisabled={isDisabled}\n isFullWidth={isFullWidth}\n isOptional={isOptional}\n label={label}\n renderFieldComponent={renderFieldComponent}\n />\n );\n }\n);\n\nconst MemoizedNativeSelect = memo(NativeSelect);\nMemoizedNativeSelect.displayName = \"NativeSelect\";\n\nexport { MemoizedNativeSelect as NativeSelect };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IAEVC,UAAU,EACVC,IAAI,EACJC,WAAW,EACXC,OAAO,EACPC,MAAM,QACD,OAAO;AAAC,SAKNC,KAAK;AAAA,SAGLC,eAAe,EAAEC,cAAc;AAAA,SAAAC,GAAA,IAAAC,IAAA;
|
|
1
|
+
{"version":3,"file":"NativeSelect.js","names":["React","forwardRef","memo","useCallback","useMemo","useRef","Field","getControlState","useInputValues","jsx","_jsx","NativeSelect","_ref","ref","defaultValue","errorMessage","errorMessageList","hasMultipleChoices","hasMultipleChoicesProp","hint","HintLinkComponent","id","idOverride","isDisabled","isFullWidth","isMultiSelect","isOptional","label","onBlur","onChange","onChangeProp","onFocus","testId","translate","value","children","controlledStateRef","controlledValue","uncontrolledValue","inputValues","controlState","current","event","child","undefined","renderFieldComponent","_ref2","ariaDescribedBy","errorMessageElementId","labelElementId","_Select","inputProps","name","multiple","native","fieldType","hasVisibleLabel","MemoizedNativeSelect","displayName"],"sources":["../src/NativeSelect.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport React, {\n ReactElement,\n forwardRef,\n memo,\n useCallback,\n useMemo,\n useRef,\n} from \"react\";\nimport {\n Select as MuiSelect,\n SelectProps as MuiSelectProps,\n} from \"@mui/material\";\nimport { Field } from \"./Field\";\nimport { FieldComponentProps } from \"./FieldComponentProps\";\nimport type { AllowedProps } from \"./AllowedProps\";\nimport { getControlState, useInputValues } from \"./inputUtils\";\nimport { ForwardRefWithType } from \"./@types/react-augment\";\n\nexport type NativeSelectOption = {\n text: string;\n value?: string;\n type?: \"heading\" | \"option\";\n};\n\nexport type NativeSelectValueType<HasMultipleChoices> =\n HasMultipleChoices extends true ? string[] : string;\n\nexport type NativeSelectProps<\n Value extends NativeSelectValueType<HasMultipleChoices>,\n HasMultipleChoices extends boolean\n> = {\n /**\n * The options or optgroup elements within the NativeSelect\n */\n children?: ReactElement<\"option\"> | ReactElement<\"optgroup\">;\n /**\n * The default value of the NativeSelect. Use when component is uncontrolled\n */\n defaultValue?: Value;\n /**\n * If `true`, the Select allows multiple selections\n */\n hasMultipleChoices?: HasMultipleChoices;\n /**\n * @deprecated Use `hasMultipleChoices` instead\n */\n /** **Deprecated:** use `hasMultipleChoices` */\n isMultiSelect?: HasMultipleChoices;\n /**\n * The label text for the NativeSelect\n */\n label: string;\n /**\n * Callback fired when the NativeSelect loses focus\n */\n onBlur?: MuiSelectProps<Value>[\"onBlur\"];\n /**\n * Callback fired when the value of the NativeSelect changes\n */\n onChange?: MuiSelectProps<Value>[\"onChange\"];\n /**\n * Callback fired when the NativeSelect gains focus\n */\n onFocus?: MuiSelectProps<Value>[\"onFocus\"];\n options: Value;\n /**\n * The value or values selected in the NativeSelect. Use when component is controlled\n */\n value?: Value;\n} & Pick<\n FieldComponentProps,\n | \"errorMessage\"\n | \"errorMessageList\"\n | \"hint\"\n | \"HintLinkComponent\"\n | \"id\"\n | \"isDisabled\"\n | \"isFullWidth\"\n | \"isOptional\"\n> &\n AllowedProps;\n\nconst NativeSelect: ForwardRefWithType = forwardRef(\n <\n Value extends NativeSelectValueType<HasMultipleChoices>,\n HasMultipleChoices extends boolean\n >(\n {\n defaultValue,\n errorMessage,\n errorMessageList,\n hasMultipleChoices: hasMultipleChoicesProp,\n hint,\n HintLinkComponent,\n id: idOverride,\n isDisabled = false,\n isFullWidth = false,\n isMultiSelect,\n isOptional = false,\n label,\n onBlur,\n onChange: onChangeProp,\n onFocus,\n testId,\n translate,\n value,\n children,\n }: NativeSelectProps<Value, HasMultipleChoices>,\n ref?: React.Ref<ReactElement>\n ) => {\n const controlledStateRef = useRef(\n getControlState({\n controlledValue: value,\n uncontrolledValue: defaultValue,\n })\n );\n const inputValues = useInputValues({\n defaultValue,\n value,\n controlState: controlledStateRef.current,\n });\n\n const onChange = useCallback<\n NonNullable<MuiSelectProps<Value>[\"onChange\"]>\n >(\n (event, child) => {\n onChangeProp?.(event, child);\n },\n [onChangeProp]\n );\n\n const hasMultipleChoices = useMemo(\n () =>\n hasMultipleChoicesProp === undefined\n ? isMultiSelect\n : hasMultipleChoicesProp,\n [hasMultipleChoicesProp, isMultiSelect]\n );\n const renderFieldComponent = useCallback(\n ({ ariaDescribedBy, errorMessageElementId, labelElementId }) => (\n <MuiSelect\n {...inputValues}\n aria-describedby={ariaDescribedBy}\n children={children}\n data-se={testId}\n id={idOverride}\n inputProps={{\n \"aria-errormessage\": errorMessageElementId,\n \"aria-labelledby\": labelElementId,\n }}\n name={idOverride}\n multiple={hasMultipleChoices}\n native={true}\n onBlur={onBlur}\n onChange={onChange}\n onFocus={onFocus}\n ref={ref}\n translate={translate}\n />\n ),\n [\n children,\n idOverride,\n inputValues,\n hasMultipleChoices,\n onBlur,\n onChange,\n onFocus,\n ref,\n testId,\n translate,\n ]\n );\n\n return (\n <Field\n errorMessage={errorMessage}\n errorMessageList={errorMessageList}\n fieldType=\"single\"\n hasVisibleLabel\n hint={hint}\n HintLinkComponent={HintLinkComponent}\n id={idOverride}\n isDisabled={isDisabled}\n isFullWidth={isFullWidth}\n isOptional={isOptional}\n label={label}\n renderFieldComponent={renderFieldComponent}\n />\n );\n }\n);\n\nconst MemoizedNativeSelect = memo(NativeSelect);\nMemoizedNativeSelect.displayName = \"NativeSelect\";\n\nexport { MemoizedNativeSelect as NativeSelect };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IAEVC,UAAU,EACVC,IAAI,EACJC,WAAW,EACXC,OAAO,EACPC,MAAM,QACD,OAAO;AAAC,SAKNC,KAAK;AAAA,SAGLC,eAAe,EAAEC,cAAc;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAmExC,MAAMC,YAAgC,GAAGV,UAAU,CACjD,CAAAW,IAAA,EAyBEC,GAA6B,KAC1B;EAAA,IAtBH;IACEC,YAAY;IACZC,YAAY;IACZC,gBAAgB;IAChBC,kBAAkB,EAAEC,sBAAsB;IAC1CC,IAAI;IACJC,iBAAiB;IACjBC,EAAE,EAAEC,UAAU;IACdC,UAAU,GAAG,KAAK;IAClBC,WAAW,GAAG,KAAK;IACnBC,aAAa;IACbC,UAAU,GAAG,KAAK;IAClBC,KAAK;IACLC,MAAM;IACNC,QAAQ,EAAEC,YAAY;IACtBC,OAAO;IACPC,MAAM;IACNC,SAAS;IACTC,KAAK;IACLC;EAC4C,CAAC,GAAAvB,IAAA;EAG/C,MAAMwB,kBAAkB,GAAG/B,MAAM,CAC/BE,eAAe,CAAC;IACd8B,eAAe,EAAEH,KAAK;IACtBI,iBAAiB,EAAExB;EACrB,CAAC,CACH,CAAC;EACD,MAAMyB,WAAW,GAAG/B,cAAc,CAAC;IACjCM,YAAY;IACZoB,KAAK;IACLM,YAAY,EAAEJ,kBAAk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AK;IACXC,iBAAiB,EAAEA,iBAAkB;IACrCC,EAAE,EAAEC,UAAW;IACfC,UAAU,EAAEA,UAAW;IACvBC,WAAW,EAAEA,WAAY;IACzBE,UAAU,EAAEA,UAAW;IACvBC,KAAK,EAAEA,KAAM;IACbkB,oBAAoB,EAAEA;EAAqB,CAC5C,CAAC;AAEN,CACF,CAAC;AAED,MAAMY,oBAAoB,GAAGvD,IAAI,CAACS,YAAY,CAAC;AAC/C8C,oBAAoB,CAACC,WAAW,GAAG,cAAc;AAEjD,SAASD,oBAAoB,IAAI9C,YAAY"}
|
package/dist/PasswordField.js
CHANGED
|
@@ -23,6 +23,7 @@ const PasswordField = forwardRef((_ref, ref) => {
|
|
|
23
23
|
autoCompleteType,
|
|
24
24
|
defaultValue,
|
|
25
25
|
errorMessage,
|
|
26
|
+
errorMessageList,
|
|
26
27
|
hasInitialFocus,
|
|
27
28
|
hint,
|
|
28
29
|
id: idOverride,
|
|
@@ -112,6 +113,7 @@ const PasswordField = forwardRef((_ref, ref) => {
|
|
|
112
113
|
}, [autoCompleteType, hasInitialFocus, inputValues, t, togglePasswordVisibility, inputType, nameOverride, onChange, onFocus, onBlur, placeholder, isOptional, isReadOnly, hasShowPassword, ref, testId, translate]);
|
|
113
114
|
return _jsx(Field, {
|
|
114
115
|
errorMessage: errorMessage,
|
|
116
|
+
errorMessageList: errorMessageList,
|
|
115
117
|
fieldType: "single",
|
|
116
118
|
hasVisibleLabel: true,
|
|
117
119
|
hint: hint,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasswordField.js","names":["forwardRef","memo","useCallback","useImperativeHandle","useRef","useState","ShowIcon","HideIcon","Field","useTranslation","getControlState","useInputValues","jsx","_jsx","PasswordField","_ref","ref","autoCompleteType","defaultValue","errorMessage","hasInitialFocus","hint","id","idOverride","inputFocusRef","isDisabled","isFullWidth","isOptional","hasShowPassword","isReadOnly","label","name","nameOverride","onChange","onChangeProp","onFocus","onBlur","placeholder","testId","translate","value","t","inputType","setInputType","togglePasswordVisibility","controlledStateRef","controlledValue","uncontrolledValue","inputValues","controlState","current","inputRef","element","focus","event","renderFieldComponent","_ref2","ariaDescribedBy","errorMessageElementId","labelElementId","_InputBase","autoComplete","autoFocus","endAdornment","_InputAdornment","position","children","_IconButton","onClick","inputProps","role","readOnly","required","type","fieldType","hasVisibleLabel","MemoizedPasswordField","displayName"],"sources":["../src/PasswordField.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { InputAdornment, InputBase, IconButton } from \"@mui/material\";\nimport {\n ChangeEventHandler,\n FocusEventHandler,\n forwardRef,\n memo,\n useCallback,\n useImperativeHandle,\n useRef,\n useState,\n} from \"react\";\n\nimport { ShowIcon, HideIcon } from \"./icons.generated\";\nimport { Field } from \"./Field\";\nimport { FieldComponentProps } from \"./FieldComponentProps\";\nimport type { AllowedProps } from \"./AllowedProps\";\nimport { useTranslation } from \"react-i18next\";\nimport { getControlState, useInputValues } from \"./inputUtils\";\nimport { FocusHandle } from \"./@types/react-augment\";\n\nexport type PasswordFieldProps = {\n /**\n * This prop helps users to fill forms faster, especially on mobile devices.\n * The name can be confusing, as it's more like an autofill.\n * You can learn more about it [following the specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill).\n */\n autoCompleteType?: \"current-password\" | \"new-password\";\n /**\n * initial value for input. Use when component in uncontrolled.\n */\n defaultValue?: string;\n /**\n * If `true`, the component will receive focus automatically.\n */\n hasInitialFocus?: boolean;\n /**\n * If `true`, the show/hide icon is not shown to the user\n */\n hasShowPassword?: boolean;\n /**\n * The ref forwarded to the TextField to expose focus()\n */\n inputFocusRef?: React.RefObject<FocusHandle>;\n /**\n * The label for the `input` element.\n */\n label: string;\n /**\n * Callback fired when the `input` element loses focus.\n */\n onBlur?: FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;\n /**\n * Callback fired when the value is changed.\n */\n onChange?: ChangeEventHandler<HTMLTextAreaElement | HTMLInputElement>;\n /**\n * Callback fired when the `input` element get focus.\n */\n onFocus?: FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;\n /**\n * The short hint displayed in the `input` before the user enters a value.\n */\n placeholder?: string;\n /**\n * The value of the `input` element. Use when component is controlled.\n */\n value?: string;\n} & FieldComponentProps &\n AllowedProps;\n\nconst PasswordField = forwardRef<HTMLInputElement, PasswordFieldProps>(\n (\n {\n autoCompleteType,\n defaultValue,\n errorMessage,\n hasInitialFocus,\n hint,\n id: idOverride,\n inputFocusRef,\n isDisabled = false,\n isFullWidth = false,\n isOptional = false,\n hasShowPassword = true,\n isReadOnly,\n label,\n name: nameOverride,\n onChange: onChangeProp,\n onFocus,\n onBlur,\n placeholder,\n testId,\n translate,\n value,\n },\n ref\n ) => {\n const { t } = useTranslation();\n const [inputType, setInputType] = useState(\"password\");\n\n const togglePasswordVisibility = useCallback(() => {\n setInputType((inputType) =>\n inputType === \"password\" ? \"text\" : \"password\"\n );\n }, []);\n\n const controlledStateRef = useRef(\n getControlState({\n controlledValue: value,\n uncontrolledValue: defaultValue,\n })\n );\n const inputValues = useInputValues({\n defaultValue,\n value,\n controlState: controlledStateRef.current,\n });\n\n const inputRef = useRef<HTMLInputElement>(null);\n useImperativeHandle(\n inputFocusRef,\n () => {\n const element = inputRef.current;\n return {\n focus: () => {\n element && element.focus();\n },\n };\n },\n []\n );\n\n const onChange = useCallback<\n ChangeEventHandler<HTMLTextAreaElement | HTMLInputElement>\n >(\n (event) => {\n onChangeProp?.(event);\n },\n [onChangeProp]\n );\n\n const renderFieldComponent = useCallback(\n ({ ariaDescribedBy, errorMessageElementId, id, labelElementId }) => (\n <InputBase\n {...inputValues}\n aria-describedby={ariaDescribedBy}\n autoComplete={inputType === \"password\" ? autoCompleteType : \"off\"}\n /* eslint-disable-next-line jsx-a11y/no-autofocus */\n autoFocus={hasInitialFocus}\n data-se={testId}\n endAdornment={\n hasShowPassword && (\n <InputAdornment position=\"end\">\n <IconButton\n aria-label={\n inputType === \"password\"\n ? t(\"passwordfield.icon.label.show\")\n : t(\"passwordfield.icon.label.hide\")\n }\n onClick={togglePasswordVisibility}\n >\n {inputType === \"password\" ? <ShowIcon /> : <HideIcon />}\n </IconButton>\n </InputAdornment>\n )\n }\n id={id}\n inputProps={{\n \"aria-errormessage\": errorMessageElementId,\n \"aria-labelledby\": labelElementId,\n // role: \"textbox\" Added because password inputs don't have an implicit role assigned. This causes problems with element selection.\n role: \"textbox\",\n }}\n inputRef={inputRef}\n name={nameOverride ?? id}\n onChange={onChange}\n onFocus={onFocus}\n onBlur={onBlur}\n placeholder={placeholder}\n readOnly={isReadOnly}\n ref={ref}\n required={!isOptional}\n translate={translate}\n type={inputType}\n />\n ),\n [\n autoCompleteType,\n hasInitialFocus,\n inputValues,\n t,\n togglePasswordVisibility,\n inputType,\n nameOverride,\n onChange,\n onFocus,\n onBlur,\n placeholder,\n isOptional,\n isReadOnly,\n hasShowPassword,\n ref,\n testId,\n translate,\n ]\n );\n\n return (\n <Field\n errorMessage={errorMessage}\n fieldType=\"single\"\n hasVisibleLabel\n hint={hint}\n id={idOverride}\n isDisabled={isDisabled}\n isFullWidth={isFullWidth}\n isOptional={isOptional}\n label={label}\n renderFieldComponent={renderFieldComponent}\n />\n );\n }\n);\n\nconst MemoizedPasswordField = memo(PasswordField);\nMemoizedPasswordField.displayName = \"PasswordField\";\n\nexport { MemoizedPasswordField as PasswordField };\n"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,SAGEA,UAAU,EACVC,IAAI,EACJC,W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CW,IAAI,EAAE;MACR,CAAE;MACFnB,QAAQ,EAAEA,QAAS;MACnBpB,IAAI,EAAEC,YAAY,IAAIV,EAAG;MACzBW,QAAQ,EAAEA,QAAS;MACnBE,OAAO,EAAEA,OAAQ;MACjBC,MAAM,EAAEA,MAAO;MACfC,WAAW,EAAEA,WAAY;MACzBkC,QAAQ,EAAE1C,UAAW;MACrBb,GAAG,EAAEA,GAAI;MACTwD,QAAQ,EAAE,CAAC7C,UAAW;MACtBY,SAAS,EAAEA,SAAU;MACrBkC,IAAI,EAAE/B;IAAU,CACjB,CAAC;EAAA,CACH,EACD,CACEzB,gBAAgB,EAChBG,eAAe,EACf4B,WAAW,EACXP,CAAC,EACDG,wBAAwB,EACxBF,SAAS,EACTV,YAAY,EACZC,QAAQ,EACRE,OAAO,EACPC,MAAM,EACNC,WAAW,EACXV,UAAU,EACVE,UAAU,EACVD,eAAe,EACfZ,GAAG,EACHsB,MAAM,EACNC,SAAS,CAEb,CAAC;EAED,OACE1B,IAAA,CAACL,KAAK;IACJW,YAAY,EAAEA,YAAa;IAC3BuD,SAAS,EAAC,QAAQ;IAClBC,eAAe;IACftD,IAAI,EAAEA,IAAK;IACXC,EAAE,EAAEC,UAAW;IACfE,UAAU,EAAEA,UAAW;IACvBC,WAAW,EAAEA,WAAY;IACzBC,UAAU,EAAEA,UAAW;IACvBG,KAAK,EAAEA,KAAM;IACbyB,oBAAoB,EAAEA;EAAqB,CAC5C,CAAC;AAEN,CACF,CAAC;AAED,MAAMqB,qBAAqB,GAAG3E,IAAI,CAACa,aAAa,CAAC;AACjD8D,qBAAqB,CAACC,WAAW,GAAG,eAAe;AAEnD,SAASD,qBAAqB,IAAI9D,aAAa"}
|
|
1
|
+
{"version":3,"file":"PasswordField.js","names":["forwardRef","memo","useCallback","useImperativeHandle","useRef","useState","ShowIcon","HideIcon","Field","useTranslation","getControlState","useInputValues","jsx","_jsx","PasswordField","_ref","ref","autoCompleteType","defaultValue","errorMessage","errorMessageList","hasInitialFocus","hint","id","idOverride","inputFocusRef","isDisabled","isFullWidth","isOptional","hasShowPassword","isReadOnly","label","name","nameOverride","onChange","onChangeProp","onFocus","onBlur","placeholder","testId","translate","value","t","inputType","setInputType","togglePasswordVisibility","controlledStateRef","controlledValue","uncontrolledValue","inputValues","controlState","current","inputRef","element","focus","event","renderFieldComponent","_ref2","ariaDescribedBy","errorMessageElementId","labelElementId","_InputBase","autoComplete","autoFocus","endAdornment","_InputAdornment","position","children","_IconButton","onClick","inputProps","role","readOnly","required","type","fieldType","hasVisibleLabel","MemoizedPasswordField","displayName"],"sources":["../src/PasswordField.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { InputAdornment, InputBase, IconButton } from \"@mui/material\";\nimport {\n ChangeEventHandler,\n FocusEventHandler,\n forwardRef,\n memo,\n useCallback,\n useImperativeHandle,\n useRef,\n useState,\n} from \"react\";\n\nimport { ShowIcon, HideIcon } from \"./icons.generated\";\nimport { Field } from \"./Field\";\nimport { FieldComponentProps } from \"./FieldComponentProps\";\nimport type { AllowedProps } from \"./AllowedProps\";\nimport { useTranslation } from \"react-i18next\";\nimport { getControlState, useInputValues } from \"./inputUtils\";\nimport { FocusHandle } from \"./@types/react-augment\";\n\nexport type PasswordFieldProps = {\n /**\n * This prop helps users to fill forms faster, especially on mobile devices.\n * The name can be confusing, as it's more like an autofill.\n * You can learn more about it [following the specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill).\n */\n autoCompleteType?: \"current-password\" | \"new-password\";\n /**\n * initial value for input. Use when component in uncontrolled.\n */\n defaultValue?: string;\n /**\n * If `true`, the component will receive focus automatically.\n */\n hasInitialFocus?: boolean;\n /**\n * If `true`, the show/hide icon is not shown to the user\n */\n hasShowPassword?: boolean;\n /**\n * The ref forwarded to the TextField to expose focus()\n */\n inputFocusRef?: React.RefObject<FocusHandle>;\n /**\n * The label for the `input` element.\n */\n label: string;\n /**\n * Callback fired when the `input` element loses focus.\n */\n onBlur?: FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;\n /**\n * Callback fired when the value is changed.\n */\n onChange?: ChangeEventHandler<HTMLTextAreaElement | HTMLInputElement>;\n /**\n * Callback fired when the `input` element get focus.\n */\n onFocus?: FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;\n /**\n * The short hint displayed in the `input` before the user enters a value.\n */\n placeholder?: string;\n /**\n * The value of the `input` element. Use when component is controlled.\n */\n value?: string;\n} & FieldComponentProps &\n AllowedProps;\n\nconst PasswordField = forwardRef<HTMLInputElement, PasswordFieldProps>(\n (\n {\n autoCompleteType,\n defaultValue,\n errorMessage,\n errorMessageList,\n hasInitialFocus,\n hint,\n id: idOverride,\n inputFocusRef,\n isDisabled = false,\n isFullWidth = false,\n isOptional = false,\n hasShowPassword = true,\n isReadOnly,\n label,\n name: nameOverride,\n onChange: onChangeProp,\n onFocus,\n onBlur,\n placeholder,\n testId,\n translate,\n value,\n },\n ref\n ) => {\n const { t } = useTranslation();\n const [inputType, setInputType] = useState(\"password\");\n\n const togglePasswordVisibility = useCallback(() => {\n setInputType((inputType) =>\n inputType === \"password\" ? \"text\" : \"password\"\n );\n }, []);\n\n const controlledStateRef = useRef(\n getControlState({\n controlledValue: value,\n uncontrolledValue: defaultValue,\n })\n );\n const inputValues = useInputValues({\n defaultValue,\n value,\n controlState: controlledStateRef.current,\n });\n\n const inputRef = useRef<HTMLInputElement>(null);\n useImperativeHandle(\n inputFocusRef,\n () => {\n const element = inputRef.current;\n return {\n focus: () => {\n element && element.focus();\n },\n };\n },\n []\n );\n\n const onChange = useCallback<\n ChangeEventHandler<HTMLTextAreaElement | HTMLInputElement>\n >(\n (event) => {\n onChangeProp?.(event);\n },\n [onChangeProp]\n );\n\n const renderFieldComponent = useCallback(\n ({ ariaDescribedBy, errorMessageElementId, id, labelElementId }) => (\n <InputBase\n {...inputValues}\n aria-describedby={ariaDescribedBy}\n autoComplete={inputType === \"password\" ? autoCompleteType : \"off\"}\n /* eslint-disable-next-line jsx-a11y/no-autofocus */\n autoFocus={hasInitialFocus}\n data-se={testId}\n endAdornment={\n hasShowPassword && (\n <InputAdornment position=\"end\">\n <IconButton\n aria-label={\n inputType === \"password\"\n ? t(\"passwordfield.icon.label.show\")\n : t(\"passwordfield.icon.label.hide\")\n }\n onClick={togglePasswordVisibility}\n >\n {inputType === \"password\" ? <ShowIcon /> : <HideIcon />}\n </IconButton>\n </InputAdornment>\n )\n }\n id={id}\n inputProps={{\n \"aria-errormessage\": errorMessageElementId,\n \"aria-labelledby\": labelElementId,\n // role: \"textbox\" Added because password inputs don't have an implicit role assigned. This causes problems with element selection.\n role: \"textbox\",\n }}\n inputRef={inputRef}\n name={nameOverride ?? id}\n onChange={onChange}\n onFocus={onFocus}\n onBlur={onBlur}\n placeholder={placeholder}\n readOnly={isReadOnly}\n ref={ref}\n required={!isOptional}\n translate={translate}\n type={inputType}\n />\n ),\n [\n autoCompleteType,\n hasInitialFocus,\n inputValues,\n t,\n togglePasswordVisibility,\n inputType,\n nameOverride,\n onChange,\n onFocus,\n onBlur,\n placeholder,\n isOptional,\n isReadOnly,\n hasShowPassword,\n ref,\n testId,\n translate,\n ]\n );\n\n return (\n <Field\n errorMessage={errorMessage}\n errorMessageList={errorMessageList}\n fieldType=\"single\"\n hasVisibleLabel\n hint={hint}\n id={idOverride}\n isDisabled={isDisabled}\n isFullWidth={isFullWidth}\n isOptional={isOptional}\n label={label}\n renderFieldComponent={renderFieldComponent}\n />\n );\n }\n);\n\nconst MemoizedPasswordField = memo(PasswordField);\nMemoizedPasswordField.displayName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IAAI/D,aAAa"}
|
package/dist/RadioGroup.js
CHANGED
|
@@ -19,6 +19,7 @@ const RadioGroup = _ref => {
|
|
|
19
19
|
children,
|
|
20
20
|
defaultValue,
|
|
21
21
|
errorMessage,
|
|
22
|
+
errorMessageList,
|
|
22
23
|
hint,
|
|
23
24
|
HintLinkComponent,
|
|
24
25
|
id: idOverride,
|
|
@@ -64,6 +65,7 @@ const RadioGroup = _ref => {
|
|
|
64
65
|
}, [children, inputValues, nameOverride, onChange, testId, translate]);
|
|
65
66
|
return _jsx(Field, {
|
|
66
67
|
errorMessage: errorMessage,
|
|
68
|
+
errorMessageList: errorMessageList,
|
|
67
69
|
fieldType: "group",
|
|
68
70
|
hasVisibleLabel: false,
|
|
69
71
|
hint: hint,
|
package/dist/RadioGroup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.js","names":["memo","useCallback","useRef","Field","getControlState","useInputValues","jsx","_jsx","RadioGroup","_ref","children","defaultValue","errorMessage","hint","HintLinkComponent","id","idOverride","isDisabled","label","name","nameOverride","onChange","onChangeProp","testId","translate","value","controlledStateRef","controlledValue","uncontrolledValue","inputValues","controlState","current","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, useRef } from \"react\";\n\nimport { Radio, RadioProps } from \"./Radio\";\nimport { Field } from \"./Field\";\nimport { FieldComponentProps } from \"./FieldComponentProps\";\nimport type { AllowedProps } from \"./AllowedProps\";\nimport { getControlState, useInputValues } from \"./inputUtils\";\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\"
|
|
1
|
+
{"version":3,"file":"RadioGroup.js","names":["memo","useCallback","useRef","Field","getControlState","useInputValues","jsx","_jsx","RadioGroup","_ref","children","defaultValue","errorMessage","errorMessageList","hint","HintLinkComponent","id","idOverride","isDisabled","label","name","nameOverride","onChange","onChangeProp","testId","translate","value","controlledStateRef","controlledValue","uncontrolledValue","inputValues","controlState","current","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, useRef } from \"react\";\n\nimport { Radio, RadioProps } from \"./Radio\";\nimport { Field } from \"./Field\";\nimport { FieldComponentProps } from \"./FieldComponentProps\";\nimport type { AllowedProps } from \"./AllowedProps\";\nimport { getControlState, useInputValues } from \"./inputUtils\";\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\"\n | \"errorMessageList\"\n | \"hint\"\n | \"HintLinkComponent\"\n | \"id\"\n | \"isDisabled\"\n | \"name\"\n> &\n AllowedProps;\n\nconst RadioGroup = ({\n children,\n defaultValue,\n errorMessage,\n errorMessageList,\n hint,\n HintLinkComponent,\n id: idOverride,\n isDisabled,\n label,\n name: nameOverride,\n onChange: onChangeProp,\n testId,\n translate,\n value,\n}: RadioGroupProps) => {\n const controlledStateRef = useRef(\n getControlState({ controlledValue: value, uncontrolledValue: defaultValue })\n );\n const inputValues = useInputValues({\n defaultValue,\n value,\n controlState: controlledStateRef.current,\n });\n\n const onChange = useCallback<NonNullable<MuiRadioGroupProps[\"onChange\"]>>(\n (event, value) => {\n onChangeProp?.(event, value);\n },\n [onChangeProp]\n );\n const renderFieldComponent = useCallback(\n ({ ariaDescribedBy, errorMessageElementId, id, labelElementId }) => (\n <MuiRadioGroup\n {...inputValues}\n aria-describedby={ariaDescribedBy}\n aria-errormessage={errorMessageElementId}\n aria-labelledby={labelElementId}\n data-se={testId}\n id={id}\n name={nameOverride ?? id}\n onChange={onChange}\n translate={translate}\n >\n {children}\n </MuiRadioGroup>\n ),\n [children, inputValues, nameOverride, onChange, testId, translate]\n );\n\n return (\n <Field\n errorMessage={errorMessage}\n errorMessageList={errorMessageList}\n fieldType=\"group\"\n hasVisibleLabel={false}\n hint={hint}\n HintLinkComponent={HintLinkComponent}\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,EAAEC,MAAM,QAAQ,OAAO;AAAC,SAGvDC,KAAK;AAAA,SAGLC,eAAe,EAAEC,cAAc;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAmCxC,MAAMC,UAAU,GAAGC,IAAA,IAeI;EAAA,IAfH;IAClBC,QAAQ;IACRC,YAAY;IACZC,YAAY;IACZC,gBAAgB;IAChBC,IAAI;IACJC,iBAAiB;IACjBC,EAAE,EAAEC,UAAU;IACdC,UAAU;IACVC,KAAK;IACLC,IAAI,EAAEC,YAAY;IAClBC,QAAQ,EAAEC,YAAY;IACtBC,MAAM;IACNC,SAAS;IACTC;EACe,CAAC,GAAAjB,IAAA;EAChB,MAAMkB,kBAAkB,GAAGzB,MAAM,CAC/BE,eAAe,CAAC;IAAEwB,eAAe,EAAEF,KAAK;IAAEG,iBAAiB,EAAElB;EAAa,CAAC,CAC7E,CAAC;EACD,MAAMmB,WAAW,GAAGzB,cAAc,CAAC;IACjCM,YAAY;IACZe,KAAK;IACLK,YAAY,EAAEJ,kBAAkB,CAACK;EACnC,CAAC,CAAC;EAEF,MAAMV,QAAQ,GAAGrB,WAAW,CAC1B,CAACgC,KAAK,EAAEP,KAAK,KAAK;IAChBH,YAAY,GAAGU,KAAK,EAAEP,KAAK,CAAC;EAC9B,CAAC,EACD,CAACH,YAAY,CACf,CAAC;EACD,MAAMW,oBAAoB,GAAGjC,WAAW,CACtCkC,KAAA;IAAA,IAAC;MAAEC,eAAe;MAAEC,qBAAqB;MAAErB,EAAE;MAAEsB;IAAe,CAAC,GAAAH,KAAA;IAAA,OAC7D5B,IAAA,CAAAgC,WAAA;MAAA,GACMT,WAAW;MACf,oBAAkBM,eAAgB;MAClC,qBAAmBC,qBAAsB;MACzC,mBAAiBC,cAAe;MAChC,WAASd,MAAO;MAChBR,EAAE,EAAEA,EAAG;MACPI,IAAI,EAAEC,YAAY,IAAIL,EAAG;MACzBM,QAAQ,EAAEA,QAAS;MACnBG,SAAS,EAAEA,SAAU;MAAAf,QAAA,EAEpBA;IAAQ,CACI,CAAC;EAAA,CACjB,EACD,CAACA,QAAQ,EAAEoB,WAAW,EAAET,YAAY,EAAEC,QAAQ,EAAEE,MAAM,EAAEC,SAAS,CACnE,CAAC;EAED,OACElB,IAAA,CAACJ,KAAK;IACJS,YAAY,EAAEA,YAAa;IAC3BC,gBAAgB,EAAEA,gBAAiB;IACnC2B,SAAS,EAAC,OAAO;IACjBC,eAAe,EAAE,KAAM;IACvB3B,IAAI,EAAEA,IAAK;IACXC,iBAAiB,EAAEA,iBAAkB;IACrCC,EAAE,EAAEC,UAAW;IACfC,UAAU,EAAEA,UAAW;IACvBC,KAAK,EAAEA,KAAM;IACbe,oBAAoB,EAAEA;EAAqB,CAC5C,CAAC;AAEN,CAAC;AAED,MAAMQ,kBAAkB,GAAG1C,IAAI,CAACQ,UAAU,CAAC;AAC3CkC,kBAAkB,CAACC,WAAW,GAAG,YAAY;AAE7C,SAASD,kBAAkB,IAAIlC,UAAU"}
|
package/dist/Select.js
CHANGED
|
@@ -30,6 +30,7 @@ const Select = _ref => {
|
|
|
30
30
|
let {
|
|
31
31
|
defaultValue,
|
|
32
32
|
errorMessage,
|
|
33
|
+
errorMessageList,
|
|
33
34
|
hasMultipleChoices: hasMultipleChoicesProp,
|
|
34
35
|
hint,
|
|
35
36
|
HintLinkComponent,
|
|
@@ -156,6 +157,7 @@ const Select = _ref => {
|
|
|
156
157
|
}, [children, inputValues, hasMultipleChoices, nameOverride, onBlur, onChange, onFocus, renderValue, testId, translate]);
|
|
157
158
|
return _jsx(Field, {
|
|
158
159
|
errorMessage: errorMessage,
|
|
160
|
+
errorMessageList: errorMessageList,
|
|
159
161
|
fieldType: "single",
|
|
160
162
|
hasVisibleLabel: true,
|
|
161
163
|
hint: hint,
|