@okta/odyssey-react-mui 1.14.8 → 1.15.8
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 +50 -0
- package/dist/Autocomplete.js +84 -2
- package/dist/Autocomplete.js.map +1 -1
- package/dist/Breadcrumbs.js +10 -1
- package/dist/Breadcrumbs.js.map +1 -1
- package/dist/Button.js +2 -2
- package/dist/Button.js.map +1 -1
- package/dist/Callout.js.map +1 -1
- package/dist/Checkbox.js +8 -4
- package/dist/Checkbox.js.map +1 -1
- package/dist/CheckboxGroup.js.map +1 -1
- package/dist/DataTable/DataTable.js +37 -9
- package/dist/DataTable/DataTable.js.map +1 -1
- package/dist/MenuButton.js.map +1 -1
- package/dist/RadioGroup.js.map +1 -1
- package/dist/Select.js +3 -4
- package/dist/Select.js.map +1 -1
- package/dist/Tabs.js +21 -0
- package/dist/Tabs.js.map +1 -1
- package/dist/Tile.js +14 -18
- package/dist/Tile.js.map +1 -1
- package/dist/labs/DataFilters.js +98 -97
- package/dist/labs/DataFilters.js.map +1 -1
- package/dist/labs/index.js +0 -1
- package/dist/labs/index.js.map +1 -1
- package/dist/src/Autocomplete.d.ts +7 -1
- package/dist/src/Autocomplete.d.ts.map +1 -1
- package/dist/src/Breadcrumbs.d.ts.map +1 -1
- package/dist/src/Button.d.ts +31 -15
- package/dist/src/Button.d.ts.map +1 -1
- package/dist/src/Callout.d.ts +1 -1
- package/dist/src/Checkbox.d.ts.map +1 -1
- package/dist/src/CheckboxGroup.d.ts +2 -3
- package/dist/src/CheckboxGroup.d.ts.map +1 -1
- package/dist/src/DataTable/DataTable.d.ts +6 -2
- package/dist/src/DataTable/DataTable.d.ts.map +1 -1
- package/dist/src/MenuButton.d.ts +3 -4
- package/dist/src/MenuButton.d.ts.map +1 -1
- package/dist/src/RadioGroup.d.ts +3 -3
- package/dist/src/RadioGroup.d.ts.map +1 -1
- package/dist/src/Select.d.ts.map +1 -1
- package/dist/src/Tabs.d.ts.map +1 -1
- package/dist/src/Tile.d.ts.map +1 -1
- package/dist/src/labs/DataFilters.d.ts +9 -1
- package/dist/src/labs/DataFilters.d.ts.map +1 -1
- package/dist/src/labs/index.d.ts +0 -1
- package/dist/src/labs/index.d.ts.map +1 -1
- package/dist/src/theme/components.d.ts.map +1 -1
- package/dist/theme/components.js +15 -7
- package/dist/theme/components.js.map +1 -1
- package/dist/tsconfig.production.tsbuildinfo +1 -1
- package/package.json +9 -7
- package/src/Autocomplete.tsx +124 -1
- package/src/Breadcrumbs.tsx +9 -1
- package/src/Button.tsx +32 -16
- package/src/Callout.tsx +1 -1
- package/src/Checkbox.tsx +4 -3
- package/src/CheckboxGroup.tsx +2 -5
- package/src/DataTable/DataTable.tsx +75 -13
- package/src/MenuButton.tsx +11 -21
- package/src/RadioGroup.tsx +3 -3
- package/src/Select.tsx +5 -2
- package/src/Tabs.tsx +40 -1
- package/src/Tile.tsx +12 -14
- package/src/labs/DataFilters.tsx +211 -177
- package/src/labs/index.ts +0 -1
- package/src/theme/components.tsx +16 -7
- package/dist/labs/VirtualizedAutocomplete.js +0 -134
- package/dist/labs/VirtualizedAutocomplete.js.map +0 -1
- package/dist/src/labs/VirtualizedAutocomplete.d.ts +0 -90
- package/dist/src/labs/VirtualizedAutocomplete.d.ts.map +0 -1
- package/src/labs/VirtualizedAutocomplete.tsx +0 -365
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,56 @@
|
|
|
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.15.8](https://github.com/okta/odyssey/compare/v1.15.7...v1.15.8) (2024-03-22)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @okta/odyssey-react-mui
|
|
9
|
+
|
|
10
|
+
## [1.15.7](https://github.com/okta/odyssey/compare/v1.15.6...v1.15.7) (2024-03-20)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- add official support for lists in Callout ([63d3175](https://github.com/okta/odyssey/commit/63d317580e2a118ea3b3d37d3991de95f0a65120))
|
|
15
|
+
|
|
16
|
+
## [1.15.6](https://github.com/okta/odyssey/compare/v1.15.5...v1.15.6) (2024-03-19)
|
|
17
|
+
|
|
18
|
+
**Note:** Version bump only for package @okta/odyssey-react-mui
|
|
19
|
+
|
|
20
|
+
## [1.15.5](https://github.com/okta/odyssey/compare/v1.15.4...v1.15.5) (2024-03-19)
|
|
21
|
+
|
|
22
|
+
**Note:** Version bump only for package @okta/odyssey-react-mui
|
|
23
|
+
|
|
24
|
+
## [1.15.4](https://github.com/okta/odyssey/compare/v1.15.3...v1.15.4) (2024-03-18)
|
|
25
|
+
|
|
26
|
+
**Note:** Version bump only for package @okta/odyssey-react-mui
|
|
27
|
+
|
|
28
|
+
## [1.15.3](https://github.com/okta/odyssey/compare/v1.15.2...v1.15.3) (2024-03-18)
|
|
29
|
+
|
|
30
|
+
**Note:** Version bump only for package @okta/odyssey-react-mui
|
|
31
|
+
|
|
32
|
+
## [1.15.2](https://github.com/okta/odyssey/compare/v1.15.1...v1.15.2) (2024-03-13)
|
|
33
|
+
|
|
34
|
+
**Note:** Version bump only for package @okta/odyssey-react-mui
|
|
35
|
+
|
|
36
|
+
## [1.15.1](https://github.com/okta/odyssey/compare/v1.15.0...v1.15.1) (2024-03-12)
|
|
37
|
+
|
|
38
|
+
### Bug Fixes
|
|
39
|
+
|
|
40
|
+
- upgrade react types to fix component type from memo wrapper ([#2144](https://github.com/okta/odyssey/issues/2144)) ([ead53ee](https://github.com/okta/odyssey/commit/ead53ee7b2485569b711474a936cf7204cef7ee8))
|
|
41
|
+
|
|
42
|
+
## [1.15.0](https://github.com/okta/odyssey/compare/v1.14.10...v1.15.0) (2024-03-12)
|
|
43
|
+
|
|
44
|
+
### Features
|
|
45
|
+
|
|
46
|
+
- allow virtualization of autocomplete ([#2122](https://github.com/okta/odyssey/issues/2122)) ([a8d8c3c](https://github.com/okta/odyssey/commit/a8d8c3c895f539c61be15224e12d9fb0762fdf10))
|
|
47
|
+
|
|
48
|
+
## [1.14.10](https://github.com/okta/odyssey/compare/v1.14.9...v1.14.10) (2024-03-11)
|
|
49
|
+
|
|
50
|
+
**Note:** Version bump only for package @okta/odyssey-react-mui
|
|
51
|
+
|
|
52
|
+
## [1.14.9](https://github.com/okta/odyssey/compare/v1.14.8...v1.14.9) (2024-03-08)
|
|
53
|
+
|
|
54
|
+
**Note:** Version bump only for package @okta/odyssey-react-mui
|
|
55
|
+
|
|
6
56
|
## [1.14.8](https://github.com/okta/odyssey/compare/v1.14.7...v1.14.8) (2024-03-08)
|
|
7
57
|
|
|
8
58
|
**Note:** Version bump only for package @okta/odyssey-react-mui
|
package/dist/Autocomplete.js
CHANGED
|
@@ -11,10 +11,18 @@ import _InputBase from "@mui/material/InputBase";
|
|
|
11
11
|
*
|
|
12
12
|
* See the License for the specific language governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
|
-
import { memo, useCallback, useMemo, useRef } from "react";
|
|
14
|
+
import { createContext, forwardRef, memo, useCallback, useContext, useEffect, useMemo, useRef } from "react";
|
|
15
|
+
import styled from "@emotion/styled";
|
|
16
|
+
import { VariableSizeList } from "react-window";
|
|
17
|
+
import _AutoSizer from "react-virtualized-auto-sizer";
|
|
18
|
+
const AutoSizer = _AutoSizer;
|
|
15
19
|
import { Field } from "./Field.js";
|
|
16
20
|
import { ComponentControlledState, useInputValues, getControlState } from "./inputUtils.js";
|
|
17
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
+
const ListboxContainer = styled.div`
|
|
23
|
+
width: 100%;
|
|
24
|
+
height: 100%;
|
|
25
|
+
`;
|
|
18
26
|
const Autocomplete = ({
|
|
19
27
|
ariaDescribedBy,
|
|
20
28
|
defaultValue,
|
|
@@ -29,6 +37,7 @@ const Autocomplete = ({
|
|
|
29
37
|
isLoading,
|
|
30
38
|
isOptional = false,
|
|
31
39
|
isReadOnly,
|
|
40
|
+
isVirtualized: isVirtualizedProp = false,
|
|
32
41
|
hint,
|
|
33
42
|
HintLinkComponent,
|
|
34
43
|
label,
|
|
@@ -47,6 +56,7 @@ const Autocomplete = ({
|
|
|
47
56
|
controlledValue: value,
|
|
48
57
|
uncontrolledValue: defaultValue
|
|
49
58
|
}));
|
|
59
|
+
const isVirtualized = useRef(Boolean(isVirtualizedProp));
|
|
50
60
|
const defaultValueProp = useMemo(() => {
|
|
51
61
|
if (hasMultipleChoices) {
|
|
52
62
|
if (value === undefined) {
|
|
@@ -80,6 +90,7 @@ const Autocomplete = ({
|
|
|
80
90
|
fieldType: "single",
|
|
81
91
|
hasVisibleLabel: true,
|
|
82
92
|
id: InputLabelProps.htmlFor,
|
|
93
|
+
isFullWidth: isFullWidth,
|
|
83
94
|
hint: hint,
|
|
84
95
|
HintLinkComponent: HintLinkComponent,
|
|
85
96
|
label: label,
|
|
@@ -103,7 +114,75 @@ const Autocomplete = ({
|
|
|
103
114
|
name: nameOverride ?? id,
|
|
104
115
|
required: !isOptional
|
|
105
116
|
})
|
|
106
|
-
}), [ariaDescribedBy, errorMessage, errorMessageList, hint, HintLinkComponent, isOptional, label, nameOverride, testId]);
|
|
117
|
+
}), [ariaDescribedBy, errorMessage, errorMessageList, hint, HintLinkComponent, isFullWidth, isOptional, label, nameOverride, testId]);
|
|
118
|
+
const renderVirtualizedRow = ({
|
|
119
|
+
data,
|
|
120
|
+
index,
|
|
121
|
+
style
|
|
122
|
+
}) => {
|
|
123
|
+
const baseOption = data[index];
|
|
124
|
+
const optionItem = {
|
|
125
|
+
...baseOption,
|
|
126
|
+
props: {
|
|
127
|
+
...baseOption.props,
|
|
128
|
+
style
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
return optionItem;
|
|
132
|
+
};
|
|
133
|
+
const OuterListboxContext = createContext({});
|
|
134
|
+
const OuterListboxElementType = forwardRef((props, ref) => {
|
|
135
|
+
const outerProps = useContext(OuterListboxContext);
|
|
136
|
+
return _jsx("div", {
|
|
137
|
+
ref: ref,
|
|
138
|
+
...props,
|
|
139
|
+
...outerProps
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
function useResetCache(length) {
|
|
143
|
+
const ref = useRef(null);
|
|
144
|
+
useEffect(() => {
|
|
145
|
+
if (ref.current) {
|
|
146
|
+
ref.current.resetAfterIndex(0, true);
|
|
147
|
+
}
|
|
148
|
+
}, [length]);
|
|
149
|
+
return ref;
|
|
150
|
+
}
|
|
151
|
+
const ListboxComponent = forwardRef(function (props, ref) {
|
|
152
|
+
const {
|
|
153
|
+
children,
|
|
154
|
+
...other
|
|
155
|
+
} = props;
|
|
156
|
+
const itemData = children.flatMap(item => [item].concat(item.children || []));
|
|
157
|
+
const optionHeight = 45;
|
|
158
|
+
const overscanRowCount = 8;
|
|
159
|
+
const itemSize = useCallback(() => optionHeight, []);
|
|
160
|
+
const gridRef = useResetCache(itemData.length);
|
|
161
|
+
const renderWindow = useCallback(({
|
|
162
|
+
height,
|
|
163
|
+
width
|
|
164
|
+
}) => _jsx(VariableSizeList, {
|
|
165
|
+
innerElementType: "ul",
|
|
166
|
+
itemData: itemData,
|
|
167
|
+
itemCount: itemData.length,
|
|
168
|
+
itemSize: itemSize,
|
|
169
|
+
height: height,
|
|
170
|
+
width: width,
|
|
171
|
+
ref: gridRef,
|
|
172
|
+
outerElementType: OuterListboxElementType,
|
|
173
|
+
overscanCount: overscanRowCount,
|
|
174
|
+
children: renderVirtualizedRow
|
|
175
|
+
}), [itemData, gridRef, itemSize]);
|
|
176
|
+
return _jsx(ListboxContainer, {
|
|
177
|
+
ref: ref,
|
|
178
|
+
children: _jsx(OuterListboxContext.Provider, {
|
|
179
|
+
value: other,
|
|
180
|
+
children: _jsx(AutoSizer, {
|
|
181
|
+
children: renderWindow
|
|
182
|
+
})
|
|
183
|
+
})
|
|
184
|
+
});
|
|
185
|
+
});
|
|
107
186
|
const onChange = useCallback((event, value, reason, details) => {
|
|
108
187
|
onChangeProp?.(event, value, reason, details);
|
|
109
188
|
}, [onChangeProp]);
|
|
@@ -113,6 +192,9 @@ const Autocomplete = ({
|
|
|
113
192
|
return _jsx(_Autocomplete, {
|
|
114
193
|
...valueProps,
|
|
115
194
|
...inputValueProp,
|
|
195
|
+
...(isVirtualized.current && {
|
|
196
|
+
ListboxComponent
|
|
197
|
+
}),
|
|
116
198
|
"aria-disabled": isDisabled,
|
|
117
199
|
disableCloseOnSelect: hasMultipleChoices,
|
|
118
200
|
disabled: isDisabled,
|
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","ariaDescribedBy","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","InputLabelProps","InputProps","params","fieldType","hasVisibleLabel","htmlFor","renderFieldComponent","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 AutocompleteRenderInputParams,\n} from \"@mui/material\";\nimport { memo, useCallback, useMemo, useRef } from \"react\";\n\nimport { Field } from \"./Field\";\nimport { FieldComponentProps } from \"./FieldComponentProps\";\nimport type { HtmlProps } from \"./HtmlProps\";\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 Pick<HtmlProps, \"ariaDescribedBy\" | \"testId\" | \"translate\">;\n\nconst Autocomplete = <\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n>({\n ariaDescribedBy,\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({\n controlledValue: value,\n uncontrolledValue: defaultValue,\n }),\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 ({\n InputLabelProps,\n InputProps,\n ...params\n }: AutocompleteRenderInputParams) => (\n <Field\n ariaDescribedBy={ariaDescribedBy}\n errorMessage={errorMessage}\n errorMessageList={errorMessageList}\n fieldType=\"single\"\n hasVisibleLabel\n //@ts-expect-error htmlFor does not exist ont he InputLabelProps for autocomplete\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 \"data-se\": testId,\n }}\n aria-describedby={ariaDescribedBy}\n id={id}\n name={nameOverride ?? id}\n required={!isOptional}\n />\n )}\n />\n ),\n [\n ariaDescribedBy,\n errorMessage,\n errorMessageList,\n hint,\n HintLinkComponent,\n isOptional,\n label,\n nameOverride,\n testId,\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 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;AAUA,SAASA,IAAI,EAAEC,WAAW,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAAC,SAElDC,KAAK;AAAA,SAIZC,wBAAwB,EACxBC,cAAc,EACdC,e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C/C,CAAC,EACD,CAAClC,YAAY,CACf,CAAC;EAED,MAAMC,aAAa,GAAGhC,WAAW,CAU/B,CAAC+D,KAAK,EAAE3B,KAAK,EAAE4B,MAAM,KAAK;IACxB/B,iBAAiB,GAAG8B,KAAK,EAAE3B,KAAK,EAAE4B,MAAM,CAAC;EAC3C,CAAC,EACD,CAAC/B,iBAAiB,CACpB,CAAC;EAED,OACEzB,IAAA,CAAA0D,aAAA;IAAA,GACMrB,UAAU;IAAA,GACVG,cAAc;IAElB,iBAAe7B,UAAW;IAC1BgD,oBAAoB,EAAErD,kBAAmB;IACzCsD,QAAQ,EAAEjD,UAAW;IACrBkD,QAAQ,EAAEnD,oBAAqB;IAC/BoD,qBAAqB,EAAE,IAAK;IAC5BvD,EAAE,EAAEC,UAAW;IACfuD,SAAS,EAAEnD,WAAY;IACvBoD,OAAO,EAAEnD,SAAU;IACnBoD,QAAQ,EAAE3D,kBAAmB;IAC7Be,MAAM,EAAEA,MAAO;IACfC,QAAQ,EAAEA,QAAS;IACnBE,aAAa,EAAEA,aAAc;IAC7BE,OAAO,EAAEA,OAAQ;IACjBC,OAAO,EAAEA,OAAQ;IACjBuC,QAAQ,EAAEnD,UAAW;IACrB2B,WAAW,EAAEA,WAAY;IACzByB,oBAAoB,EAAEtC,uBAAwB;IAC9CE,SAAS,EAAEA;EAAU,CACtB,CAAC;AAEN,CAAC;AAGD,MAAMqC,oBAAoB,GAAG7E,IAAI,CAACU,YAAY,CAAwB;AAEtEmE,oBAAoB,CAACC,WAAW,GAAG,cAAc;AAEjD,SAASD,oBAAoB,IAAInE,YAAY"}
|
|
1
|
+
{"version":3,"file":"Autocomplete.js","names":["createContext","forwardRef","memo","useCallback","useContext","useEffect","useMemo","useRef","styled","VariableSizeList","_AutoSizer","AutoSizer","Field","ComponentControlledState","useInputValues","getControlState","jsx","_jsx","ListboxContainer","div","Autocomplete","ariaDescribedBy","defaultValue","errorMessage","errorMessageList","hasMultipleChoices","id","idOverride","inputValue","isCustomValueAllowed","isDisabled","isFullWidth","isLoading","isOptional","isReadOnly","isVirtualized","isVirtualizedProp","hint","HintLinkComponent","label","name","nameOverride","onBlur","onChange","onChangeProp","onInputChange","onInputChangeProp","onFocus","options","value","getIsOptionEqualToValue","testId","translate","controlledStateRef","controlledValue","uncontrolledValue","Boolean","defaultValueProp","undefined","valueProps","controlState","current","inputValueProp","CONTROLLED","renderInput","InputLabelProps","InputProps","params","fieldType","hasVisibleLabel","htmlFor","renderFieldComponent","errorMessageElementId","labelElementId","_InputBase","inputProps","required","renderVirtualizedRow","data","index","style","baseOption","optionItem","props","OuterListboxContext","OuterListboxElementType","ref","outerProps","useResetCache","length","resetAfterIndex","ListboxComponent","children","other","itemData","flatMap","item","concat","optionHeight","overscanRowCount","itemSize","gridRef","renderWindow","height","width","innerElementType","itemCount","outerElementType","overscanCount","Provider","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 AutocompleteRenderInputParams,\n} from \"@mui/material\";\nimport {\n createContext,\n FC,\n forwardRef,\n HTMLAttributes,\n memo,\n ReactElement,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n} from \"react\";\nimport styled from \"@emotion/styled\";\nimport { VariableSizeList, ListChildComponentProps } from \"react-window\";\nimport _AutoSizer, {\n Props as AutoSizerProps,\n Size as AutoSizerSize,\n} from \"react-virtualized-auto-sizer\";\n\n// This is required to get around a react-types issue for \"AutoSizer is not a valid JSX element.\"\n// @see https://github.com/bvaughn/react-virtualized/issues/1739#issuecomment-1291444246\nconst AutoSizer = _AutoSizer as unknown as FC<AutoSizerProps>;\n\nimport { Field } from \"./Field\";\nimport { FieldComponentProps } from \"./FieldComponentProps\";\nimport type { HtmlProps } from \"./HtmlProps\";\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\n /**\n * If this component is required to display a virtualized list of options,\n * then this value needs to be set to true.\n * It is recommended if you're options are on the order of 10's of hundreds or more.\n */\n isVirtualized?: boolean;\n} & Pick<\n FieldComponentProps,\n | \"errorMessage\"\n | \"errorMessageList\"\n | \"hint\"\n | \"HintLinkComponent\"\n | \"id\"\n | \"isFullWidth\"\n | \"isOptional\"\n | \"name\"\n> &\n Pick<HtmlProps, \"ariaDescribedBy\" | \"testId\" | \"translate\">;\n\nconst ListboxContainer = styled.div`\n width: 100%;\n height: 100%;\n`;\n\nconst Autocomplete = <\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n>({\n ariaDescribedBy,\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 isVirtualized: isVirtualizedProp = false,\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({\n controlledValue: value,\n uncontrolledValue: defaultValue,\n }),\n );\n\n const isVirtualized = useRef(Boolean(isVirtualizedProp));\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 ({\n InputLabelProps,\n InputProps,\n ...params\n }: AutocompleteRenderInputParams) => (\n <Field\n ariaDescribedBy={ariaDescribedBy}\n errorMessage={errorMessage}\n errorMessageList={errorMessageList}\n fieldType=\"single\"\n hasVisibleLabel\n //@ts-expect-error htmlFor does not exist ont he InputLabelProps for autocomplete\n id={InputLabelProps.htmlFor}\n isFullWidth={isFullWidth}\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 \"data-se\": testId,\n }}\n aria-describedby={ariaDescribedBy}\n id={id}\n name={nameOverride ?? id}\n required={!isOptional}\n />\n )}\n />\n ),\n [\n ariaDescribedBy,\n errorMessage,\n errorMessageList,\n hint,\n HintLinkComponent,\n isFullWidth,\n isOptional,\n label,\n nameOverride,\n testId,\n ],\n );\n\n const renderVirtualizedRow = ({\n data,\n index,\n style,\n }: ListChildComponentProps) => {\n const baseOption = data[index];\n /**\n * react-window calculates the absolute positions of the list items, via an inline style, so\n * we need to add it to each list item that is being rendered in the viewable list window.\n * See here if you need to know more: https://github.com/bvaughn/react-window?tab=readme-ov-file#why-is-my-list-blank-when-i-scroll\n */\n const optionItem = { ...baseOption, props: { ...baseOption.props, style } };\n return optionItem;\n };\n\n const OuterListboxContext = createContext({});\n\n const OuterListboxElementType = forwardRef<HTMLDivElement>((props, ref) => {\n const outerProps = useContext(OuterListboxContext);\n return <div ref={ref} {...props} {...outerProps} />;\n });\n\n function useResetCache(length: number) {\n const ref = useRef<VariableSizeList>(null);\n useEffect(() => {\n if (ref.current) {\n ref.current.resetAfterIndex(0, true);\n }\n }, [length]);\n return ref;\n }\n\n const ListboxComponent = forwardRef<\n HTMLDivElement,\n HTMLAttributes<HTMLElement>\n >(function (props, ref) {\n const { children, ...other } = props;\n const itemData: ReactElement[] = (children as ReactElement[]).flatMap(\n (item: ReactElement & { children?: ReactElement[] }) =>\n [item].concat(item.children || []),\n );\n\n // the height of an Odyssey autocomplete option item that is used to calculate height of window\n const optionHeight = 45; //px\n\n // The number of items (rows or columns) to render outside of the visible area for performance and scrolling reasons\n const overscanRowCount = 8;\n\n const itemSize = useCallback(() => optionHeight, []);\n\n const gridRef = useResetCache(itemData.length);\n\n const renderWindow = useCallback(\n ({ height, width }: AutoSizerSize) => (\n <VariableSizeList\n innerElementType=\"ul\"\n itemData={itemData}\n itemCount={itemData.length}\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n itemSize={itemSize}\n height={height}\n width={width}\n ref={gridRef}\n outerElementType={OuterListboxElementType}\n overscanCount={overscanRowCount}\n >\n {renderVirtualizedRow}\n </VariableSizeList>\n ),\n [itemData, gridRef, itemSize],\n );\n\n return (\n <ListboxContainer ref={ref}>\n <OuterListboxContext.Provider value={other}>\n <AutoSizer>{renderWindow}</AutoSizer>\n </OuterListboxContext.Provider>\n </ListboxContainer>\n );\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 // conditionally provide the ListboxComponent if this needs to be virtualized\n {...(isVirtualized.current && { ListboxComponent })}\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 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;AAUA,SACEA,aAAa,EAEbC,UAAU,EAEVC,IAAI,EAEJC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,MAAM,QACD,OAAO;AACd,OAAOC,MAAM,MAAM,iBAAiB;AACpC,SAASC,gBAAgB,QAAiC,cAAc;AACxE,OAAOC,UAAU,MAGV,8BAA8B;AAIrC,MAAMC,SAAS,GAAGD,UAA2C;AAAC,SAErDE,KAAK;AAAA,SAIZC,wBAAwB,EACxBC,cAAc,EACdC,eAAe;AAAA,SAAAC,GAAA,IAAAC,IAAA;AA0JjB,MAAMC,gBAAgB,GAAGV,MAAM,CAACW,GAAI;AACpC;AACA;AACA,CAAC;AAED,MAAMC,YAAY,GAAGA,CAInB;EACAC,eAAe;EACfC,YAAY;EACZC,YAAY;EACZC,gBAAgB;EAChBC,kBAAkB;EAClBC,EAAE,EAAEC,UAAU;EACdC,UAAU;EACVC,oBAAoB;EACpBC,UAAU;EACVC,WAAW,GAAG,KAAK;EACnBC,SAAS;EACTC,UAAU,GAAG,KAAK;EAClBC,UAAU;EACVC,aAAa,EAAEC,iBAAiB,GAAG,KAAK;EACxCC,IAAI;EACJC,iBAAiB;EACjBC,KAAK;EACLC,IAAI,EAAEC,YAAY;EAClBC,MAAM;EACNC,QAAQ,EAAEC,YAAY;EACtBC,aAAa,EAAEC,iBAAiB;EAChCC,OAAO;EACPC,OAAO;EACPC,KAAK;EACLC,uBAAuB;EACvBC,MAAM;EACNC;AACuE,CAAC,KAAK;EAC7E,MAAMC,kBAAkB,GAAG9C,MAAM,CAC/BQ,eAAe,CAAC;IACduC,eAAe,EAAEL,KAAK;IACtBM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,UAAW;IACrB8B,WAAW,EAAEA,WAAY;IACzB0D,oBAAoB,EAAExE,uBAAwB;IAC9CE,SAAS,EAAEA;EAAU,CACtB,CAAC;AAEN,CAAC;AAGD,MAAMuE,oBAAoB,GAAGzH,IAAI,CAACkB,YAAY,CAAwB;AAEtEuG,oBAAoB,CAACC,WAAW,GAAG,cAAc;AAEjD,SAASD,oBAAoB,IAAIvG,YAAY"}
|
package/dist/Breadcrumbs.js
CHANGED
|
@@ -17,12 +17,19 @@ import { createContext, memo, useCallback, useContext, useMemo, useState } from
|
|
|
17
17
|
import { GroupIcon, HomeIcon, UserIcon } from "./icons.generated/index.js";
|
|
18
18
|
import { Subordinate } from "./Typography.js";
|
|
19
19
|
import { useTranslation } from "react-i18next";
|
|
20
|
+
import styled from "@emotion/styled";
|
|
20
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
22
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
22
23
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
24
|
export const BreadcrumbContext = createContext({
|
|
24
25
|
breadcrumbType: "listItem"
|
|
25
26
|
});
|
|
27
|
+
const BreadcrumbContent = styled.span`
|
|
28
|
+
white-space: nowrap;
|
|
29
|
+
overflow: hidden;
|
|
30
|
+
max-width: 10rem;
|
|
31
|
+
text-overflow: ellipsis;
|
|
32
|
+
`;
|
|
26
33
|
export const Breadcrumb = ({
|
|
27
34
|
children,
|
|
28
35
|
href,
|
|
@@ -32,7 +39,9 @@ export const Breadcrumb = ({
|
|
|
32
39
|
breadcrumbType
|
|
33
40
|
} = useContext(BreadcrumbContext);
|
|
34
41
|
const breadcrumbContent = _jsxs(_Fragment, {
|
|
35
|
-
children: [iconName === "group" ? _jsx(GroupIcon, {}) : iconName === "user" ? _jsx(UserIcon, {}) : null,
|
|
42
|
+
children: [iconName === "group" ? _jsx(GroupIcon, {}) : iconName === "user" ? _jsx(UserIcon, {}) : null, _jsx(BreadcrumbContent, {
|
|
43
|
+
children: children
|
|
44
|
+
})]
|
|
36
45
|
});
|
|
37
46
|
if (breadcrumbType === "menuItem") {
|
|
38
47
|
return _jsx(_MenuItem, {
|
package/dist/Breadcrumbs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Breadcrumbs.js","names":["createContext","memo","useCallback","useContext","useMemo","useState","GroupIcon","HomeIcon","UserIcon","Subordinate","useTranslation","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","BreadcrumbContext","breadcrumbType","Breadcrumb","children","href","iconName","breadcrumbContent","_MenuItem","color","_ButtonBase","breadcrumbProviderValue","currentPage","listItem","menuItem","defaultTruncationValue","BreadcrumbList","homeHref","maxVisibleItems","maxVisibleItemsProp","testId","translate","t","anchorEl","setAnchorEl","Math","min","max","length","breadcrumbSections","beforeMenu","insideMenu","remainingBreadcrumbs","menuStart","floor","menuLength","slice","onMenuButtonClick","event","currentTarget","onCloseMenu","_Breadcrumbs","maxItems","map","breadcrumb","Provider","value","onClick","_Menu","open","Boolean","onClose","anchorOrigin","horizontal","vertical","MenuListProps","sx","minWidth","i","MemoizedBreadcrumbList","displayName"],"sources":["../src/Breadcrumbs.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 ButtonBase,\n Menu,\n MenuItem,\n Breadcrumbs as MuiBreadcrumbs,\n} from \"@mui/material\";\nimport {\n MouseEventHandler,\n ReactElement,\n createContext,\n memo,\n useCallback,\n useContext,\n useMemo,\n useState,\n} from \"react\";\nimport { GroupIcon, HomeIcon, UserIcon } from \"./icons.generated\";\nimport { Subordinate } from \"./Typography\";\nimport { useTranslation } from \"react-i18next\";\nimport { HtmlProps } from \"./HtmlProps\";\n\nexport type BreadcrumbType = \"listItem\" | \"menuItem\" | \"currentPage\";\n\nexport type BreadcrumbProps = {\n children?: string;\n href: string;\n iconName?: \"user\" | \"group\";\n};\n\nexport type BreadcrumbsProps = {\n children: ReactElement<typeof Breadcrumb>[];\n homeHref?: string;\n maxVisibleItems?: number;\n} & Pick<HtmlProps, \"testId\" | \"translate\">;\n\nexport type BreadcrumbContextType = {\n breadcrumbType: BreadcrumbType;\n};\n\nexport const BreadcrumbContext = createContext<BreadcrumbContextType>({\n breadcrumbType: \"listItem\",\n});\n\nexport const Breadcrumb = ({ children, href, iconName }: BreadcrumbProps) => {\n const { breadcrumbType } = useContext(BreadcrumbContext);\n\n const breadcrumbContent = (\n <>\n {iconName === \"group\" ? (\n <GroupIcon />\n ) : iconName === \"user\" ? (\n <UserIcon />\n ) : null}\n {children}\n </>\n );\n\n if (breadcrumbType === \"menuItem\") {\n return <MenuItem href={href}>{breadcrumbContent}</MenuItem>;\n }\n\n if (breadcrumbType === \"currentPage\") {\n return <Subordinate color=\"textPrimary\">{breadcrumbContent}</Subordinate>;\n }\n\n // breadcrumbType === \"listItem\" is the default\n // Provided here without a conditional to get TS to be quiet\n // about potential undefined returns\n return <ButtonBase href={href}>{breadcrumbContent}</ButtonBase>;\n};\n\nconst breadcrumbProviderValue: Record<\n BreadcrumbType,\n { breadcrumbType: BreadcrumbType }\n> = {\n currentPage: {\n breadcrumbType: \"currentPage\",\n },\n listItem: {\n breadcrumbType: \"listItem\",\n },\n menuItem: {\n breadcrumbType: \"menuItem\",\n },\n};\n\nconst defaultTruncationValue = 5;\n\nconst BreadcrumbList = ({\n children,\n homeHref,\n maxVisibleItems: maxVisibleItemsProp = defaultTruncationValue,\n testId,\n translate,\n}: BreadcrumbsProps) => {\n const { t } = useTranslation();\n\n const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);\n\n const maxVisibleItems = useMemo(\n () => Math.min(Math.max(maxVisibleItemsProp, 0), children.length),\n [maxVisibleItemsProp, children],\n );\n\n const breadcrumbSections = useMemo(() => {\n if (children.length <= maxVisibleItems) {\n return {\n beforeMenu: [],\n insideMenu: [],\n remainingBreadcrumbs: children,\n };\n } else {\n const menuStart = Math.floor(maxVisibleItems / 2);\n const menuLength = children.length - maxVisibleItems;\n\n return {\n beforeMenu: children.slice(0, menuStart),\n insideMenu: children.slice(menuStart, menuStart + menuLength),\n remainingBreadcrumbs: children.slice(menuStart + menuLength),\n };\n }\n }, [children, maxVisibleItems]);\n\n const onMenuButtonClick = useCallback<MouseEventHandler<HTMLButtonElement>>(\n (event) => setAnchorEl(event.currentTarget),\n [],\n );\n const onCloseMenu = useCallback(() => {\n setAnchorEl(null);\n }, []);\n\n return (\n <MuiBreadcrumbs\n maxItems={children.length + 1}\n aria-label={t(\"breadcrumbs.label.text\")}\n data-se={testId}\n translate={translate}\n >\n {homeHref && (\n <ButtonBase href={homeHref} aria-label={t(\"breadcrumbs.home.text\")}>\n <HomeIcon />\n </ButtonBase>\n )}\n\n {breadcrumbSections.beforeMenu.map((breadcrumb) => (\n <BreadcrumbContext.Provider value={breadcrumbProviderValue.listItem}>\n {breadcrumb}\n </BreadcrumbContext.Provider>\n ))}\n\n {breadcrumbSections.insideMenu.length > 0 && (\n <>\n <ButtonBase onClick={onMenuButtonClick}>...</ButtonBase>\n <Menu\n open={Boolean(anchorEl)}\n onClose={onCloseMenu}\n anchorEl={anchorEl}\n anchorOrigin={{ horizontal: \"left\", vertical: \"bottom\" }}\n MenuListProps={{\n sx: {\n minWidth: 180,\n },\n }}\n >\n <BreadcrumbContext.Provider\n value={breadcrumbProviderValue.menuItem}\n >\n {breadcrumbSections.insideMenu}\n </BreadcrumbContext.Provider>\n </Menu>\n </>\n )}\n\n {breadcrumbSections.remainingBreadcrumbs.map((breadcrumb, i) => {\n if (i === breadcrumbSections.remainingBreadcrumbs.length - 1) {\n return (\n <BreadcrumbContext.Provider\n value={breadcrumbProviderValue.currentPage}\n >\n {breadcrumb}\n </BreadcrumbContext.Provider>\n );\n }\n return (\n <BreadcrumbContext.Provider value={breadcrumbProviderValue.listItem}>\n {breadcrumb}\n </BreadcrumbContext.Provider>\n );\n })}\n </MuiBreadcrumbs>\n );\n};\n\nconst MemoizedBreadcrumbList = memo(BreadcrumbList);\nMemoizedBreadcrumbList.displayName = \"BreadcrumbList\";\n\nexport { MemoizedBreadcrumbList as BreadcrumbList };\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAQA,SAGEA,aAAa,EACbC,IAAI,EACJC,WAAW,EACXC,UAAU,EACVC,OAAO,EACPC,QAAQ,QACH,OAAO;AAAC,SACNC,SAAS,EAAEC,QAAQ,EAAEC,QAAQ;AAAA,SAC7BC,WAAW;AACpB,SAASC,cAAc,QAAQ,eAAe;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAqB/C,OAAO,MAAMC,iBAAiB,GAAGjB,aAAa,CAAwB;EACpEkB,cAAc,EAAE;AAClB,CAAC,CAAC;AAEF,OAAO,MAAMC,UAAU,GAAGA,CAAC;EAAEC,QAAQ;EAAEC,IAAI;EAAEC;AAA0B,CAAC,KAAK;EAC3E,MAAM;IAAEJ;EAAe,CAAC,GAAGf,UAAU,CAACc,iBAAiB,CAAC;EAExD,MAAMM,iBAAiB,GACrBP,KAAA,CAAAF,SAAA;IAAAM,QAAA,GACGE,QAAQ,KAAK,OAAO,GACnBV,IAAA,CAACN,SAAS,IAAE,CAAC,GACXgB,QAAQ,KAAK,MAAM,GACrBV,IAAA,CAACJ,QAAQ,IAAE,CAAC,GACV,IAAI,EACPY,QAAQ;EAAA,CACT,CACH;EAED,IAAIF,cAAc,KAAK,UAAU,EAAE;IACjC,OAAON,IAAA,CAAAY,SAAA;MAAUH,I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sB,IAAI3C,cAAc"}
|
|
1
|
+
{"version":3,"file":"Breadcrumbs.js","names":["createContext","memo","useCallback","useContext","useMemo","useState","GroupIcon","HomeIcon","UserIcon","Subordinate","useTranslation","styled","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","BreadcrumbContext","breadcrumbType","BreadcrumbContent","span","Breadcrumb","children","href","iconName","breadcrumbContent","_MenuItem","color","_ButtonBase","breadcrumbProviderValue","currentPage","listItem","menuItem","defaultTruncationValue","BreadcrumbList","homeHref","maxVisibleItems","maxVisibleItemsProp","testId","translate","t","anchorEl","setAnchorEl","Math","min","max","length","breadcrumbSections","beforeMenu","insideMenu","remainingBreadcrumbs","menuStart","floor","menuLength","slice","onMenuButtonClick","event","currentTarget","onCloseMenu","_Breadcrumbs","maxItems","map","breadcrumb","Provider","value","onClick","_Menu","open","Boolean","onClose","anchorOrigin","horizontal","vertical","MenuListProps","sx","minWidth","i","MemoizedBreadcrumbList","displayName"],"sources":["../src/Breadcrumbs.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 ButtonBase,\n Menu,\n MenuItem,\n Breadcrumbs as MuiBreadcrumbs,\n} from \"@mui/material\";\nimport {\n MouseEventHandler,\n ReactElement,\n createContext,\n memo,\n useCallback,\n useContext,\n useMemo,\n useState,\n} from \"react\";\nimport { GroupIcon, HomeIcon, UserIcon } from \"./icons.generated\";\nimport { Subordinate } from \"./Typography\";\nimport { useTranslation } from \"react-i18next\";\nimport { HtmlProps } from \"./HtmlProps\";\nimport styled from \"@emotion/styled\";\n\nexport type BreadcrumbType = \"listItem\" | \"menuItem\" | \"currentPage\";\n\nexport type BreadcrumbProps = {\n children?: string;\n href: string;\n iconName?: \"user\" | \"group\";\n};\n\nexport type BreadcrumbsProps = {\n children: ReactElement<typeof Breadcrumb>[];\n homeHref?: string;\n maxVisibleItems?: number;\n} & Pick<HtmlProps, \"testId\" | \"translate\">;\n\nexport type BreadcrumbContextType = {\n breadcrumbType: BreadcrumbType;\n};\n\nexport const BreadcrumbContext = createContext<BreadcrumbContextType>({\n breadcrumbType: \"listItem\",\n});\n\nconst BreadcrumbContent = styled.span`\n white-space: nowrap;\n overflow: hidden;\n max-width: 10rem;\n text-overflow: ellipsis;\n`;\n\nexport const Breadcrumb = ({ children, href, iconName }: BreadcrumbProps) => {\n const { breadcrumbType } = useContext(BreadcrumbContext);\n\n const breadcrumbContent = (\n <>\n {iconName === \"group\" ? (\n <GroupIcon />\n ) : iconName === \"user\" ? (\n <UserIcon />\n ) : null}\n <BreadcrumbContent>{children}</BreadcrumbContent>\n </>\n );\n\n if (breadcrumbType === \"menuItem\") {\n return <MenuItem href={href}>{breadcrumbContent}</MenuItem>;\n }\n\n if (breadcrumbType === \"currentPage\") {\n return <Subordinate color=\"textPrimary\">{breadcrumbContent}</Subordinate>;\n }\n\n // breadcrumbType === \"listItem\" is the default\n // Provided here without a conditional to get TS to be quiet\n // about potential undefined returns\n return <ButtonBase href={href}>{breadcrumbContent}</ButtonBase>;\n};\n\nconst breadcrumbProviderValue: Record<\n BreadcrumbType,\n { breadcrumbType: BreadcrumbType }\n> = {\n currentPage: {\n breadcrumbType: \"currentPage\",\n },\n listItem: {\n breadcrumbType: \"listItem\",\n },\n menuItem: {\n breadcrumbType: \"menuItem\",\n },\n};\n\nconst defaultTruncationValue = 5;\n\nconst BreadcrumbList = ({\n children,\n homeHref,\n maxVisibleItems: maxVisibleItemsProp = defaultTruncationValue,\n testId,\n translate,\n}: BreadcrumbsProps) => {\n const { t } = useTranslation();\n\n const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);\n\n const maxVisibleItems = useMemo(\n () => Math.min(Math.max(maxVisibleItemsProp, 0), children.length),\n [maxVisibleItemsProp, children],\n );\n\n const breadcrumbSections = useMemo(() => {\n if (children.length <= maxVisibleItems) {\n return {\n beforeMenu: [],\n insideMenu: [],\n remainingBreadcrumbs: children,\n };\n } else {\n const menuStart = Math.floor(maxVisibleItems / 2);\n const menuLength = children.length - maxVisibleItems;\n\n return {\n beforeMenu: children.slice(0, menuStart),\n insideMenu: children.slice(menuStart, menuStart + menuLength),\n remainingBreadcrumbs: children.slice(menuStart + menuLength),\n };\n }\n }, [children, maxVisibleItems]);\n\n const onMenuButtonClick = useCallback<MouseEventHandler<HTMLButtonElement>>(\n (event) => setAnchorEl(event.currentTarget),\n [],\n );\n const onCloseMenu = useCallback(() => {\n setAnchorEl(null);\n }, []);\n\n return (\n <MuiBreadcrumbs\n maxItems={children.length + 1}\n aria-label={t(\"breadcrumbs.label.text\")}\n data-se={testId}\n translate={translate}\n >\n {homeHref && (\n <ButtonBase href={homeHref} aria-label={t(\"breadcrumbs.home.text\")}>\n <HomeIcon />\n </ButtonBase>\n )}\n\n {breadcrumbSections.beforeMenu.map((breadcrumb) => (\n <BreadcrumbContext.Provider value={breadcrumbProviderValue.listItem}>\n {breadcrumb}\n </BreadcrumbContext.Provider>\n ))}\n\n {breadcrumbSections.insideMenu.length > 0 && (\n <>\n <ButtonBase onClick={onMenuButtonClick}>...</ButtonBase>\n <Menu\n open={Boolean(anchorEl)}\n onClose={onCloseMenu}\n anchorEl={anchorEl}\n anchorOrigin={{ horizontal: \"left\", vertical: \"bottom\" }}\n MenuListProps={{\n sx: {\n minWidth: 180,\n },\n }}\n >\n <BreadcrumbContext.Provider\n value={breadcrumbProviderValue.menuItem}\n >\n {breadcrumbSections.insideMenu}\n </BreadcrumbContext.Provider>\n </Menu>\n </>\n )}\n\n {breadcrumbSections.remainingBreadcrumbs.map((breadcrumb, i) => {\n if (i === breadcrumbSections.remainingBreadcrumbs.length - 1) {\n return (\n <BreadcrumbContext.Provider\n value={breadcrumbProviderValue.currentPage}\n >\n {breadcrumb}\n </BreadcrumbContext.Provider>\n );\n }\n return (\n <BreadcrumbContext.Provider value={breadcrumbProviderValue.listItem}>\n {breadcrumb}\n </BreadcrumbContext.Provider>\n );\n })}\n </MuiBreadcrumbs>\n );\n};\n\nconst MemoizedBreadcrumbList = memo(BreadcrumbList);\nMemoizedBreadcrumbList.displayName = \"BreadcrumbList\";\n\nexport { MemoizedBreadcrumbList as BreadcrumbList };\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAQA,SAGEA,aAAa,EACbC,IAAI,EACJC,WAAW,EACXC,UAAU,EACVC,OAAO,EACPC,QAAQ,QACH,OAAO;AAAC,SACNC,SAAS,EAAEC,QAAQ,EAAEC,QAAQ;AAAA,SAC7BC,WAAW;AACpB,SAASC,cAAc,QAAQ,eAAe;AAE9C,OAAOC,MAAM,MAAM,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAoBrC,OAAO,MAAMC,iBAAiB,GAAGlB,aAAa,CAAwB;EACpEmB,cAAc,EAAE;AAClB,CAAC,CAAC;AAEF,MAAMC,iBAAiB,GAAGT,MAAM,CAACU,IAAK;AACtC;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,UAAU,GAAGA,CAAC;EAAEC,QAAQ;EAAEC,IAAI;EAAEC;AAA0B,CAAC,KAAK;EAC3E,MAAM;IAAEN;EAAe,CAAC,GAAGhB,UAAU,CAACe,iBAAiB,CAAC;EAExD,MAAMQ,iBAAiB,GACrBT,KAAA,CAAAF,SAAA;IAAAQ,QAAA,GACGE,QAAQ,KAAK,OAAO,GACnBZ,IAAA,CAACP,SAAS,IAAE,CAAC,GACXmB,QAAQ,KAAK,MAAM,GACrBZ,IAAA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;QAAAT,QAAA,EACjEwC;MAAU,CACe,CAAC;IAEjC,CAAC,CAAC;EAAA,CACY,CAAC;AAErB,CAAC;AAED,MAAMe,sBAAsB,GAAG7E,IAAI,CAACkC,cAAc,CAAC;AACnD2C,sBAAsB,CAACC,WAAW,GAAG,gBAAgB;AAErD,SAASD,sBAAsB,IAAI3C,cAAc"}
|
package/dist/Button.js
CHANGED
|
@@ -66,7 +66,7 @@ const Button = ({
|
|
|
66
66
|
"data-se": testId,
|
|
67
67
|
disabled: isDisabled,
|
|
68
68
|
endIcon: endIcon,
|
|
69
|
-
fullWidth:
|
|
69
|
+
fullWidth: isFullWidth,
|
|
70
70
|
id: id,
|
|
71
71
|
onClick: onClick,
|
|
72
72
|
ref: localButtonRef,
|
|
@@ -78,7 +78,7 @@ const Button = ({
|
|
|
78
78
|
variant: variant,
|
|
79
79
|
children: label
|
|
80
80
|
});
|
|
81
|
-
}, [ariaControls, ariaDescribedBy, ariaExpanded, ariaHasPopup, ariaLabel, ariaLabelledBy, endIcon, id, isDisabled, isFullWidth,
|
|
81
|
+
}, [ariaControls, ariaDescribedBy, ariaExpanded, ariaHasPopup, ariaLabel, ariaLabelledBy, endIcon, id, isDisabled, isFullWidth, label, onClick, size, startIcon, tabIndex, testId, translate, type, variant]);
|
|
82
82
|
if (tooltipText) {
|
|
83
83
|
return _jsx(Tooltip, {
|
|
84
84
|
ariaType: "description",
|
package/dist/Button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","names":["memo","useCallback","useImperativeHandle","useMemo","useRef","useButton","MuiPropsContext","useMuiProps","Tooltip","jsx","_jsx","buttonSizeValues","buttonTypeValues","buttonVariantValues","Button","ariaControls","ariaDescribedBy","ariaExpanded","ariaHasPopup","ariaLabel","ariaLabelledBy","buttonRef","endIcon","id","isDisabled","isFullWidth","isFullWidthProp","label","onClick","size","startIcon","tabIndex","testId","tooltipText","translate","type","variant","variantProp","muiProps","localButtonRef","buttonContext","focus","current","renderButton","ref","_Button","disabled","fullWidth","children","ariaType","placement","text","Consumer","MemoizedButton","displayName"],"sources":["../src/Button.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { Button as MuiButton } from \"@mui/material\";\nimport type { ButtonProps as MuiButtonProps } from \"@mui/material\";\nimport {\n memo,\n ReactElement,\n useCallback,\n useImperativeHandle,\n useMemo,\n useRef,\n} from \"react\";\n\nimport { useButton } from \"./ButtonContext\";\nimport type { HtmlProps } from \"./HtmlProps\";\nimport { FocusHandle } from \"./inputUtils\";\nimport {\n MuiPropsContext,\n MuiPropsContextType,\n useMuiProps,\n} from \"./MuiPropsContext\";\nimport { Tooltip } from \"./Tooltip\";\n\nexport const buttonSizeValues = [\"small\", \"medium\", \"large\"] as const;\nexport const buttonTypeValues = [\"button\", \"submit\", \"reset\"] as const;\nexport const buttonVariantValues = [\n \"primary\",\n \"secondary\",\n \"danger\",\n \"floating\",\n] as const;\n\nexport type ButtonProps = {\n /**\n * The ref forwarded to the Button\n */\n buttonRef?: React.RefObject<FocusHandle>;\n /**\n * The
|
|
1
|
+
{"version":3,"file":"Button.js","names":["memo","useCallback","useImperativeHandle","useMemo","useRef","useButton","MuiPropsContext","useMuiProps","Tooltip","jsx","_jsx","buttonSizeValues","buttonTypeValues","buttonVariantValues","Button","ariaControls","ariaDescribedBy","ariaExpanded","ariaHasPopup","ariaLabel","ariaLabelledBy","buttonRef","endIcon","id","isDisabled","isFullWidth","isFullWidthProp","label","onClick","size","startIcon","tabIndex","testId","tooltipText","translate","type","variant","variantProp","muiProps","localButtonRef","buttonContext","focus","current","renderButton","ref","_Button","disabled","fullWidth","children","ariaType","placement","text","Consumer","MemoizedButton","displayName"],"sources":["../src/Button.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { Button as MuiButton } from \"@mui/material\";\nimport type { ButtonProps as MuiButtonProps } from \"@mui/material\";\nimport {\n HTMLAttributes,\n memo,\n ReactElement,\n useCallback,\n useImperativeHandle,\n useMemo,\n useRef,\n} from \"react\";\n\nimport { useButton } from \"./ButtonContext\";\nimport type { HtmlProps } from \"./HtmlProps\";\nimport { FocusHandle } from \"./inputUtils\";\nimport {\n MuiPropsContext,\n MuiPropsContextType,\n useMuiProps,\n} from \"./MuiPropsContext\";\nimport { Tooltip } from \"./Tooltip\";\n\nexport const buttonSizeValues = [\"small\", \"medium\", \"large\"] as const;\nexport const buttonTypeValues = [\"button\", \"submit\", \"reset\"] as const;\nexport const buttonVariantValues = [\n \"primary\",\n \"secondary\",\n \"danger\",\n \"floating\",\n] as const;\n\nexport type ButtonProps = {\n /**\n * The ref forwarded to the Button\n */\n buttonRef?: React.RefObject<FocusHandle>;\n /**\n * The ID of the Button\n */\n id?: string;\n /**\n * Determines whether the Button is disabled\n */\n isDisabled?: boolean;\n /**\n * Determines whether the Button should take up the full available width\n */\n isFullWidth?: boolean;\n /**\n * The click event handler for the Button\n */\n onClick?: MuiButtonProps[\"onClick\"];\n /**\n * The size of the button\n */\n size?: (typeof buttonSizeValues)[number];\n tabIndex?: HTMLAttributes<HTMLElement>[\"tabIndex\"];\n /**\n * The tooltip text for the Button if it's icon-only\n */\n tooltipText?: string;\n /**\n * The type of the HTML button element\n */\n type?: (typeof buttonTypeValues)[number];\n /**\n * The variant of the Button\n */\n variant: (typeof buttonVariantValues)[number] | \"tertiary\";\n} & (\n | {\n /**\n * The icon element to display at the end of the Button\n */\n endIcon?: ReactElement;\n /**\n * The text content of the Button\n */\n label: string;\n /**\n * The icon element to display at the start of the Button\n */\n startIcon?: ReactElement;\n }\n | {\n /**\n * The icon element to display at the end of the Button\n */\n endIcon?: ReactElement;\n /**\n * The text content of the Button\n */\n label?: string | \"\" | undefined;\n /**\n * The icon element to display at the start of the Button\n */\n startIcon: ReactElement;\n }\n | {\n /**\n * The icon element to display at the end of the Button\n */\n endIcon: ReactElement;\n /**\n * The text content of the Button\n */\n label?: never;\n /**\n * The icon element to display at the start of the Button\n */\n startIcon?: ReactElement;\n }\n) &\n Pick<\n HtmlProps,\n | \"ariaControls\"\n | \"ariaDescribedBy\"\n | \"ariaExpanded\"\n | \"ariaHasPopup\"\n | \"ariaLabel\"\n | \"ariaLabelledBy\"\n | \"tabIndex\"\n | \"testId\"\n | \"translate\"\n >;\n\nconst Button = ({\n ariaControls,\n ariaDescribedBy,\n ariaExpanded,\n ariaHasPopup,\n ariaLabel,\n ariaLabelledBy,\n buttonRef,\n endIcon,\n id,\n isDisabled,\n isFullWidth: isFullWidthProp,\n label = \"\",\n onClick,\n size = \"medium\",\n startIcon,\n tabIndex,\n testId,\n tooltipText,\n translate,\n type = \"button\",\n variant: variantProp,\n}: ButtonProps) => {\n const muiProps = useMuiProps();\n\n // We're deprecating the \"tertiary\" variant, so map it to\n // \"secondary\" in lieu of making a breaking change\n const variant = variantProp === \"tertiary\" ? \"secondary\" : variantProp;\n const localButtonRef = useRef<HTMLButtonElement>(null);\n const buttonContext = useButton();\n const isFullWidth = useMemo(\n () =>\n buttonContext.isFullWidth ? buttonContext.isFullWidth : isFullWidthProp,\n [buttonContext, isFullWidthProp],\n );\n\n useImperativeHandle(\n buttonRef,\n () => {\n return {\n focus: () => {\n localButtonRef.current?.focus();\n },\n };\n },\n [],\n );\n\n const renderButton = useCallback(\n (muiProps: MuiPropsContextType) => {\n //@ts-expect-error ref is not an optional prop on the props context type\n muiProps?.ref?.(localButtonRef.current);\n\n return (\n <MuiButton\n {...muiProps}\n aria-controls={ariaControls}\n aria-describedby={ariaDescribedBy}\n aria-expanded={ariaExpanded}\n aria-haspopup={ariaHasPopup}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n data-se={testId}\n disabled={isDisabled}\n endIcon={endIcon}\n fullWidth={isFullWidth}\n id={id}\n onClick={onClick}\n ref={localButtonRef}\n size={size}\n startIcon={startIcon}\n tabIndex={tabIndex}\n translate={translate}\n type={type}\n variant={variant}\n >\n {label}\n </MuiButton>\n );\n },\n [\n ariaControls,\n ariaDescribedBy,\n ariaExpanded,\n ariaHasPopup,\n ariaLabel,\n ariaLabelledBy,\n endIcon,\n id,\n isDisabled,\n isFullWidth,\n label,\n onClick,\n size,\n startIcon,\n tabIndex,\n testId,\n translate,\n type,\n variant,\n ],\n );\n\n if (tooltipText) {\n return (\n <Tooltip ariaType=\"description\" placement=\"top\" text={tooltipText}>\n <MuiPropsContext.Consumer>{renderButton}</MuiPropsContext.Consumer>\n </Tooltip>\n );\n }\n\n return renderButton(muiProps);\n};\n\nconst MemoizedButton = memo(Button);\nMemoizedButton.displayName = \"Button\";\n\nexport { MemoizedButton as Button };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA,SAEEA,IAAI,EAEJC,WAAW,EACXC,mBAAmB,EACnBC,OAAO,EACPC,MAAM,QACD,OAAO;AAAC,SAENC,SAAS;AAAA,SAIhBC,eAAe,EAEfC,WAAW;AAAA,SAEJC,OAAO;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAEhB,OAAO,MAAMC,gBAAgB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,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ED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Callout.js","names":["memo","ScreenReaderText","useTranslation","Paragraph","useOdysseyDesignTokens","styled","jsx","_jsx","jsxs","_jsxs","calloutRoleValues","calloutSeverityValues","ContentContainer","shouldForwardProp","prop","odysseyDesignTokens","marginBlockStart","Spacing4","Callout","children","linkText","linkUrl","role","severity","testId","text","title","translate","t","_Alert","variant","_AlertTitle","_Box","component","_Link","href","MemoizedCallout","displayName"],"sources":["../src/Callout.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, ReactNode } from \"react\";\nimport { Alert, AlertTitle, Box, Link as MuiLink } from \"@mui/material\";\nimport { ScreenReaderText } from \"./ScreenReaderText\";\nimport { useTranslation } from \"react-i18next\";\n\nimport type { HtmlProps } from \"./HtmlProps\";\nimport { Paragraph } from \"./Typography\";\n\nimport {\n DesignTokens,\n useOdysseyDesignTokens,\n} from \"./OdysseyDesignTokensContext\";\nimport styled from \"@emotion/styled\";\n\nexport const calloutRoleValues = [\"status\", \"alert\"] as const;\nexport const calloutSeverityValues = [\n \"success\",\n \"info\",\n \"warning\",\n \"error\",\n] as const;\n\nexport type CalloutProps = {\n /**\n *
|
|
1
|
+
{"version":3,"file":"Callout.js","names":["memo","ScreenReaderText","useTranslation","Paragraph","useOdysseyDesignTokens","styled","jsx","_jsx","jsxs","_jsxs","calloutRoleValues","calloutSeverityValues","ContentContainer","shouldForwardProp","prop","odysseyDesignTokens","marginBlockStart","Spacing4","Callout","children","linkText","linkUrl","role","severity","testId","text","title","translate","t","_Alert","variant","_AlertTitle","_Box","component","_Link","href","MemoizedCallout","displayName"],"sources":["../src/Callout.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, ReactNode } from \"react\";\nimport { Alert, AlertTitle, Box, Link as MuiLink } from \"@mui/material\";\nimport { ScreenReaderText } from \"./ScreenReaderText\";\nimport { useTranslation } from \"react-i18next\";\n\nimport type { HtmlProps } from \"./HtmlProps\";\nimport { Paragraph } from \"./Typography\";\n\nimport {\n DesignTokens,\n useOdysseyDesignTokens,\n} from \"./OdysseyDesignTokensContext\";\nimport styled from \"@emotion/styled\";\n\nexport const calloutRoleValues = [\"status\", \"alert\"] as const;\nexport const calloutSeverityValues = [\n \"success\",\n \"info\",\n \"warning\",\n \"error\",\n] as const;\n\nexport type CalloutProps = {\n /**\n * Used to optionally pass a text list to the component\n */\n children?: ReactNode;\n /**\n * Sets the ARIA role of the Callout\n * (\"status\" for something that dynamically updates, \"alert\" for errors, null for something\n * unchanging)\n */\n role?: (typeof calloutRoleValues)[number];\n /**\n * Determine the color and icon of the Callout\n */\n severity: (typeof calloutSeverityValues)[number];\n /**\n * The text content of the Callout\n */\n text?: string;\n /**\n * The title of the Callout\n */\n title?: string;\n} & (\n | {\n text: string;\n children?: never;\n }\n | {\n text?: never;\n children: ReactNode;\n }\n) &\n (\n | {\n /**\n * If linkUrl is not undefined, this is the text of the link.\n * If left blank, it defaults to \"Learn more\".\n * Note that linkText does nothing if linkUrl is not defined\n */\n linkUrl: string;\n /**\n * If defined, the Toast will include a link to the URL\n */\n linkText: string;\n }\n | {\n linkUrl?: never;\n linkText?: never;\n }\n ) &\n Pick<HtmlProps, \"testId\" | \"translate\">;\n\nconst ContentContainer = styled(\"div\", {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})(({ odysseyDesignTokens }: { odysseyDesignTokens: DesignTokens }) => ({\n \"& > * + *\": {\n marginBlockStart: odysseyDesignTokens.Spacing4,\n },\n}));\n\nconst Callout = ({\n children,\n linkText,\n linkUrl,\n role,\n severity,\n testId,\n text,\n title,\n translate,\n}: CalloutProps) => {\n const { t } = useTranslation();\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n return (\n <Alert data-se={testId} role={role} severity={severity} variant=\"callout\">\n <ScreenReaderText translate={translate}>\n {t(`severity.${severity}`)}\n </ScreenReaderText>\n {title && <AlertTitle translate={translate}>{title}</AlertTitle>}\n <ContentContainer odysseyDesignTokens={odysseyDesignTokens}>\n {children && <Box component=\"div\">{children}</Box>}\n {text && <Paragraph>{text}</Paragraph>}\n {linkUrl && (\n <Box>\n <MuiLink href={linkUrl} variant=\"monochrome\">\n {linkText}\n </MuiLink>\n </Box>\n )}\n </ContentContainer>\n </Alert>\n );\n};\n\nconst MemoizedCallout = memo(Callout);\nMemoizedCallout.displayName = \"Callout\";\n\nexport { MemoizedCallout as Callout };\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,QAAmB,OAAO;AAAC,SAE/BC,gBAAgB;AACzB,SAASC,cAAc,QAAQ,eAAe;AAAC,SAGtCC,SAAS;AAAA,SAIhBC,sBAAsB;AAExB,OAAOC,MAAM,MAAM,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAErC,OAAO,MAAMC,iBAAiB,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAU;AAC7D,OAAO,MAAMC,qBAAqB,GAAG,CACnC,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AAA,EACEZ,IAAA,CAAA2B,KAAA;UAASC,IAAI,EAAEd,OAAQ;UAACS,OAAO,EAAC,YAAY;UAAAX,QAAA,EACzCC;QAAQ,CACF;MAAC,CACP,CACN;IAAA,CACe,CAAC;EAAA,CACd,CAAC;AAEZ,CAAC;AAED,MAAMgB,eAAe,GAAGpC,IAAI,CAACkB,OAAO,CAAC;AACrCkB,eAAe,CAACC,WAAW,GAAG,SAAS;AAEvC,SAASD,eAAe,IAAIlB,OAAO"}
|
package/dist/Checkbox.js
CHANGED
|
@@ -17,9 +17,9 @@ import { useTranslation } from "react-i18next";
|
|
|
17
17
|
import { memo, useCallback, useMemo, useRef, useImperativeHandle } from "react";
|
|
18
18
|
import { ComponentControlledState, getControlState } from "./inputUtils.js";
|
|
19
19
|
import { Typography } from "./Typography.js";
|
|
20
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
21
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
22
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
22
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
23
|
export const checkboxValidityValues = ["valid", "invalid", "inherit"];
|
|
24
24
|
const Checkbox = ({
|
|
25
25
|
ariaLabel,
|
|
@@ -68,7 +68,10 @@ const Checkbox = ({
|
|
|
68
68
|
}, []);
|
|
69
69
|
const label = useMemo(() => {
|
|
70
70
|
return _jsxs(_Fragment, {
|
|
71
|
-
children: [
|
|
71
|
+
children: [_jsx(Typography, {
|
|
72
|
+
component: "span",
|
|
73
|
+
children: labelProp
|
|
74
|
+
}), isRequired && _jsxs(_Fragment, {
|
|
72
75
|
children: [" ", _jsxs(Typography, {
|
|
73
76
|
component: "span",
|
|
74
77
|
color: "textSecondary",
|
|
@@ -101,10 +104,11 @@ const Checkbox = ({
|
|
|
101
104
|
inputProps: {
|
|
102
105
|
"data-se": testId
|
|
103
106
|
},
|
|
107
|
+
disabled: isDisabled,
|
|
104
108
|
inputRef: localInputRef,
|
|
105
|
-
sx:
|
|
109
|
+
sx: {
|
|
106
110
|
marginBlockStart: "2px"
|
|
107
|
-
}
|
|
111
|
+
}
|
|
108
112
|
}),
|
|
109
113
|
disabled: isDisabled,
|
|
110
114
|
id: idOverride,
|
package/dist/Checkbox.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","names":["useTranslation","memo","useCallback","useMemo","useRef","useImperativeHandle","ComponentControlledState","getControlState","Typography","
|
|
1
|
+
{"version":3,"file":"Checkbox.js","names":["useTranslation","memo","useCallback","useMemo","useRef","useImperativeHandle","ComponentControlledState","getControlState","Typography","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","checkboxValidityValues","Checkbox","ariaLabel","ariaLabelledBy","id","idOverride","inputRef","isChecked","isDefaultChecked","isDisabled","isIndeterminate","isRequired","label","labelProp","hint","name","nameOverride","onChange","onChangeProp","onBlur","onBlurProp","testId","translate","validity","value","t","controlledStateRef","controlledValue","uncontrolledValue","inputValues","current","CONTROLLED","checked","defaultChecked","localInputRef","focus","children","component","color","_FormHelperText","event","_FormControlLabel","sx","alignItems","className","control","_Checkbox","indeterminate","required","inputProps","disabled","marginBlockStart","MemoizedCheckbox","displayName"],"sources":["../src/Checkbox.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { useTranslation } from \"react-i18next\";\nimport { memo, useCallback, useMemo, useRef, useImperativeHandle } from \"react\";\nimport {\n Checkbox as MuiCheckbox,\n CheckboxProps as MuiCheckboxProps,\n FormControlLabel,\n FormControlLabelProps as MuiFormControlLabelProps,\n FormHelperText,\n} from \"@mui/material\";\n\nimport { CheckedFieldProps } from \"./FormCheckedProps\";\nimport type { HtmlProps } from \"./HtmlProps\";\nimport {\n ComponentControlledState,\n FocusHandle,\n getControlState,\n} from \"./inputUtils\";\nimport { FieldComponentProps } from \"./FieldComponentProps\";\nimport { Typography } from \"./Typography\";\n\nexport const checkboxValidityValues = [\"valid\", \"invalid\", \"inherit\"] as const;\n\nexport type CheckboxProps = {\n /**\n * The ref forwarded to the Checkbox\n */\n inputRef?: React.RefObject<FocusHandle>;\n /**\n * Determines whether the Checkbox is in an indeterminate state\n */\n isIndeterminate?: boolean;\n /**\n * Determines whether the Checkbox is required\n */\n isRequired?: boolean;\n /**\n * The label text for the Checkbox\n */\n label?: string;\n /**\n * The checkbox validity, if different from its enclosing group. Defaults to \"inherit\".\n */\n validity?: (typeof checkboxValidityValues)[number];\n /**\n * The value attribute of the Checkbox\n */\n value?: string;\n /**\n * Callback fired when the blur event happens. Provides event value.\n */\n onBlur?: MuiFormControlLabelProps[\"onBlur\"];\n} & Pick<FieldComponentProps, \"hint\" | \"id\" | \"isDisabled\" | \"name\"> &\n CheckedFieldProps<MuiCheckboxProps> &\n Pick<HtmlProps, \"ariaLabel\" | \"ariaLabelledBy\" | \"testId\" | \"translate\">;\n\nconst Checkbox = ({\n ariaLabel,\n ariaLabelledBy,\n id: idOverride,\n inputRef,\n isChecked,\n isDefaultChecked,\n isDisabled,\n isIndeterminate,\n isRequired,\n label: labelProp,\n hint,\n name: nameOverride,\n onChange: onChangeProp,\n onBlur: onBlurProp,\n testId,\n translate,\n validity = \"inherit\",\n value,\n}: CheckboxProps) => {\n const { t } = useTranslation();\n const controlledStateRef = useRef(\n getControlState({\n controlledValue: isChecked,\n uncontrolledValue: isDefaultChecked,\n }),\n );\n const inputValues = useMemo(() => {\n if (controlledStateRef.current === ComponentControlledState.CONTROLLED) {\n return { checked: isChecked };\n }\n return { defaultChecked: isDefaultChecked };\n }, [isDefaultChecked, isChecked]);\n\n const localInputRef = useRef<HTMLInputElement>(null);\n useImperativeHandle(\n inputRef,\n () => {\n return {\n focus: () => {\n localInputRef.current?.focus();\n },\n };\n },\n [],\n );\n\n const label = useMemo(() => {\n return (\n <>\n <Typography component=\"span\">{labelProp}</Typography>\n {isRequired && (\n <>\n {\" \"}\n <Typography component=\"span\" color=\"textSecondary\">\n ({t(\"fieldlabel.required.text\")})\n </Typography>\n </>\n )}\n {hint && <FormHelperText translate={translate}>{hint}</FormHelperText>}\n </>\n );\n }, [isRequired, labelProp, hint, t, translate]);\n\n const onChange = useCallback<NonNullable<MuiCheckboxProps[\"onChange\"]>>(\n (event, checked) => {\n onChangeProp?.(event, checked);\n },\n [onChangeProp],\n );\n\n const onBlur = useCallback<NonNullable<MuiFormControlLabelProps[\"onBlur\"]>>(\n (event) => {\n onBlurProp?.(event);\n },\n [onBlurProp],\n );\n\n return (\n <FormControlLabel\n sx={{ alignItems: \"flex-start\" }}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n className={\n validity === \"invalid\"\n ? \"Mui-error\"\n : validity === \"valid\"\n ? \"Mui-valid\"\n : \"\"\n }\n control={\n <MuiCheckbox\n {...inputValues}\n indeterminate={isIndeterminate}\n onChange={onChange}\n required={isRequired}\n inputProps={{\n \"data-se\": testId,\n }}\n disabled={isDisabled}\n inputRef={localInputRef}\n sx={{\n marginBlockStart: \"2px\",\n }}\n />\n }\n disabled={isDisabled}\n id={idOverride}\n label={label}\n name={nameOverride ?? idOverride}\n value={value}\n required={isRequired}\n onBlur={onBlur}\n translate={translate}\n />\n );\n};\n\nconst MemoizedCheckbox = memo(Checkbox);\nMemoizedCheckbox.displayName = \"Checkbox\";\n\nexport { MemoizedCheckbox as Checkbox };\n"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,cAAc,QAAQ,eAAe;AAC9C,SAASC,IAAI,EAAEC,WAAW,EAAEC,O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KAAK,OAAO,GAClB,WAAW,GACX,EACP;IACDsB,OAAO,EACLlD,IAAA,CAAAmD,SAAA;MAAA,GACMjB,WAAW;MACfkB,aAAa,EAAErC,eAAgB;MAC/BO,QAAQ,EAAEA,QAAS;MACnB+B,QAAQ,EAAErC,UAAW;MACrBsC,UAAU,EAAE;QACV,SAAS,EAAE5B;MACb,CAAE;MACF6B,QAAQ,EAAEzC,UAAW;MACrBH,QAAQ,EAAE4B,aAAc;MACxBQ,EAAE,EAAE;QACFS,gBAAgB,EAAE;MACpB;IAAE,CACH,CACF;IACDD,QAAQ,EAAEzC,UAAW;IACrBL,EAAE,EAAEC,UAAW;IACfO,KAAK,EAAEA,KAAM;IACbG,IAAI,EAAEC,YAAY,IAAIX,UAAW;IACjCmB,KAAK,EAAEA,KAAM;IACbwB,QAAQ,EAAErC,UAAW;IACrBQ,MAAM,EAAEA,MAAO;IACfG,SAAS,EAAEA;EAAU,CACtB,CAAC;AAEN,CAAC;AAED,MAAM8B,gBAAgB,GAAGlE,IAAI,CAACe,QAAQ,CAAC;AACvCmD,gBAAgB,CAACC,WAAW,GAAG,UAAU;AAEzC,SAASD,gBAAgB,IAAInD,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxGroup.js","names":["memo","useCallback","Field","jsx","_jsx","CheckboxGroup","ariaDescribedBy","children","errorMessage","errorMessageList","hint","HintLinkComponent","id","idOverride","isDisabled","isRequired","label","testId","translate","renderFieldComponent","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,
|
|
1
|
+
{"version":3,"file":"CheckboxGroup.js","names":["memo","useCallback","Field","jsx","_jsx","CheckboxGroup","ariaDescribedBy","children","errorMessage","errorMessageList","hint","HintLinkComponent","id","idOverride","isDisabled","isRequired","label","testId","translate","renderFieldComponent","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, ReactNode, useCallback } from \"react\";\n\nimport { Field } from \"./Field\";\nimport {\n FieldComponentProps,\n FieldComponentRenderProps,\n} from \"./FieldComponentProps\";\nimport type { HtmlProps } from \"./HtmlProps\";\n\nexport type CheckboxGroupProps = {\n /**\n * A single Checkbox element or an array of Checkbox elements\n */\n children: ReactNode;\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 | \"id\"\n | \"isDisabled\"\n> &\n Pick<HtmlProps, \"ariaDescribedBy\" | \"testId\" | \"translate\">;\n\ntype CheckboxGroupRenderProps = Pick<\n FieldComponentRenderProps,\n \"id\" | \"labelElementId\"\n> &\n Partial<\n Pick<FieldComponentRenderProps, \"ariaDescribedBy\" | \"errorMessageElementId\">\n >;\n\nconst CheckboxGroup = ({\n ariaDescribedBy,\n children,\n errorMessage,\n errorMessageList,\n hint,\n HintLinkComponent,\n id: idOverride,\n isDisabled,\n isRequired = false,\n label,\n testId,\n translate,\n}: CheckboxGroupProps) => {\n const renderFieldComponent = useCallback(\n ({\n ariaDescribedBy,\n errorMessageElementId,\n id,\n labelElementId,\n }: CheckboxGroupRenderProps) => (\n <MuiFormGroup\n aria-describedby={ariaDescribedBy}\n aria-errormessage={errorMessageElementId}\n aria-labelledby={labelElementId}\n data-se={testId}\n id={id}\n translate={translate}\n >\n {children}\n </MuiFormGroup>\n ),\n [children, testId, translate],\n );\n\n return (\n <Field\n ariaDescribedBy={ariaDescribedBy}\n errorMessage={errorMessage}\n errorMessageList={errorMessageList}\n fieldType=\"group\"\n hasVisibleLabel={true}\n hint={hint}\n HintLinkComponent={HintLinkComponent}\n id={idOverride}\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,EAAaC,WAAW,QAAQ,OAAO;AAAC,SAE5CC,KAAK;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAuCd,MAAMC,aAAa,GAAGA,CAAC;EACrBC,eAAe;EACfC,QAAQ;EACRC,YAAY;EACZC,gBAAgB;EAChBC,IAAI;EACJC,iBAAiB;EACjBC,EAAE,EAAEC,UAAU;EACdC,UAAU;EACVC,UAAU,GAAG,KAAK;EAClBC,KAAK;EACLC,MAAM;EACNC;AACkB,CAAC,KAAK;E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