@okta/odyssey-react-mui 0.21.4 → 0.22.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.
Files changed (135) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/Autocomplete.js +58 -0
  3. package/dist/Autocomplete.js.map +1 -0
  4. package/dist/Button.js +46 -0
  5. package/dist/Button.js.map +1 -0
  6. package/dist/Field.js +59 -0
  7. package/dist/Field.js.map +1 -0
  8. package/dist/FieldError.js +34 -0
  9. package/dist/FieldError.js.map +1 -0
  10. package/dist/FieldHint.js +29 -0
  11. package/dist/FieldHint.js.map +1 -0
  12. package/dist/FieldLabel.js +32 -0
  13. package/dist/FieldLabel.js.map +1 -0
  14. package/dist/MenuButton.js +2 -2
  15. package/dist/MenuButton.js.map +1 -1
  16. package/dist/MenuItem.js +0 -1
  17. package/dist/MenuItem.js.map +1 -1
  18. package/dist/PasswordField.js +68 -0
  19. package/dist/PasswordField.js.map +1 -0
  20. package/dist/SearchField.js +54 -0
  21. package/dist/SearchField.js.map +1 -0
  22. package/dist/Tag.js +28 -0
  23. package/dist/Tag.js.map +1 -0
  24. package/dist/TagList.js +26 -0
  25. package/dist/TagList.js.map +1 -0
  26. package/dist/TagListContext.js +16 -0
  27. package/dist/TagListContext.js.map +1 -0
  28. package/dist/TextField.js +26 -61
  29. package/dist/TextField.js.map +1 -1
  30. package/dist/index.js +10 -2
  31. package/dist/index.js.map +1 -1
  32. package/dist/src/Autocomplete.d.ts +27 -0
  33. package/dist/src/Autocomplete.d.ts.map +1 -0
  34. package/dist/src/Button.d.ts +31 -0
  35. package/dist/src/Button.d.ts.map +1 -0
  36. package/dist/src/Field.d.ts +54 -0
  37. package/dist/src/Field.d.ts.map +1 -0
  38. package/dist/src/FieldError.d.ts +19 -0
  39. package/dist/src/FieldError.d.ts.map +1 -0
  40. package/dist/src/FieldHint.d.ts +19 -0
  41. package/dist/src/FieldHint.d.ts.map +1 -0
  42. package/dist/src/FieldLabel.d.ts +23 -0
  43. package/dist/src/FieldLabel.d.ts.map +1 -0
  44. package/dist/src/Icon.d.ts +1 -1
  45. package/dist/src/Link.d.ts +1 -1
  46. package/dist/src/MenuButton.d.ts.map +1 -1
  47. package/dist/src/MenuItem.d.ts +1 -1
  48. package/dist/src/MenuItem.d.ts.map +1 -1
  49. package/dist/src/PasswordField.d.ts +75 -0
  50. package/dist/src/PasswordField.d.ts.map +1 -0
  51. package/dist/src/SearchField.d.ts +59 -0
  52. package/dist/src/SearchField.d.ts.map +1 -0
  53. package/dist/src/Tag.d.ts +22 -0
  54. package/dist/src/Tag.d.ts.map +1 -0
  55. package/dist/src/TagList.d.ts +19 -0
  56. package/dist/src/TagList.d.ts.map +1 -0
  57. package/dist/src/TagListContext.d.ts +18 -0
  58. package/dist/src/TagListContext.d.ts.map +1 -0
  59. package/dist/src/TextField.d.ts +3 -8
  60. package/dist/src/TextField.d.ts.map +1 -1
  61. package/dist/src/iconDictionary/Add.d.ts +1 -1
  62. package/dist/src/iconDictionary/AddCircle.d.ts +1 -1
  63. package/dist/src/iconDictionary/AlertCircle.d.ts +1 -1
  64. package/dist/src/iconDictionary/AlertCircleFilled.d.ts +1 -1
  65. package/dist/src/iconDictionary/AlertTriangleFilled.d.ts +1 -1
  66. package/dist/src/iconDictionary/Anchor.d.ts +1 -1
  67. package/dist/src/iconDictionary/ArrowDown.d.ts +1 -1
  68. package/dist/src/iconDictionary/ArrowLeft.d.ts +1 -1
  69. package/dist/src/iconDictionary/ArrowRight.d.ts +1 -1
  70. package/dist/src/iconDictionary/ArrowUp.d.ts +1 -1
  71. package/dist/src/iconDictionary/ArrowUpDown.d.ts +1 -1
  72. package/dist/src/iconDictionary/Calendar.d.ts +1 -1
  73. package/dist/src/iconDictionary/Check.d.ts +1 -1
  74. package/dist/src/iconDictionary/CheckCircleFilled.d.ts +1 -1
  75. package/dist/src/iconDictionary/ChevronDown.d.ts +1 -1
  76. package/dist/src/iconDictionary/ChevronUp.d.ts +1 -1
  77. package/dist/src/iconDictionary/Close.d.ts +1 -1
  78. package/dist/src/iconDictionary/CloseCircleFilled.d.ts +1 -1
  79. package/dist/src/iconDictionary/Copy.d.ts +1 -1
  80. package/dist/src/iconDictionary/Delete.d.ts +1 -1
  81. package/dist/src/iconDictionary/Download.d.ts +1 -1
  82. package/dist/src/iconDictionary/DragHandle.d.ts +1 -1
  83. package/dist/src/iconDictionary/Edit.d.ts +1 -1
  84. package/dist/src/iconDictionary/ExternalLink.d.ts +1 -1
  85. package/dist/src/iconDictionary/Eye.d.ts +1 -1
  86. package/dist/src/iconDictionary/EyeOff.d.ts +1 -1
  87. package/dist/src/iconDictionary/Filter.d.ts +1 -1
  88. package/dist/src/iconDictionary/Globe.d.ts +1 -1
  89. package/dist/src/iconDictionary/Home.d.ts +1 -1
  90. package/dist/src/iconDictionary/InformationCircle.d.ts +1 -1
  91. package/dist/src/iconDictionary/InformationCircleFilled.d.ts +1 -1
  92. package/dist/src/iconDictionary/Notification.d.ts +1 -1
  93. package/dist/src/iconDictionary/OverflowVertical.d.ts +1 -1
  94. package/dist/src/iconDictionary/QuestionCircle.d.ts +1 -1
  95. package/dist/src/iconDictionary/QuestionCircleFilled.d.ts +1 -1
  96. package/dist/src/iconDictionary/Search.d.ts +1 -1
  97. package/dist/src/iconDictionary/Settings.d.ts +1 -1
  98. package/dist/src/iconDictionary/Subtract.d.ts +1 -1
  99. package/dist/src/iconDictionary/User.d.ts +1 -1
  100. package/dist/src/iconDictionary/UserGroup.d.ts +1 -1
  101. package/dist/src/iconDictionary/index.d.ts +40 -40
  102. package/dist/src/index.d.ts +11 -3
  103. package/dist/src/index.d.ts.map +1 -1
  104. package/dist/src/theme/components.d.ts.map +1 -1
  105. package/dist/src/theme/components.types.d.ts +0 -8
  106. package/dist/src/theme/components.types.d.ts.map +1 -1
  107. package/dist/theme/components.js +217 -124
  108. package/dist/theme/components.js.map +1 -1
  109. package/dist/theme/components.types.js.map +1 -1
  110. package/dist/tsconfig.production.tsbuildinfo +1 -1
  111. package/package.json +3 -3
  112. package/src/Autocomplete.tsx +132 -0
  113. package/src/Button.tsx +75 -0
  114. package/src/Field.tsx +112 -0
  115. package/src/FieldError.tsx +34 -0
  116. package/src/FieldHint.tsx +28 -0
  117. package/src/FieldLabel.tsx +57 -0
  118. package/src/MenuButton.tsx +2 -3
  119. package/src/MenuItem.tsx +0 -1
  120. package/src/OdysseyCacheProvider.test.tsx +1 -1
  121. package/src/PasswordField.tsx +174 -0
  122. package/src/SearchField.tsx +136 -0
  123. package/src/Tag.tsx +41 -0
  124. package/src/TagList.tsx +43 -0
  125. package/src/TagListContext.tsx +23 -0
  126. package/src/TextField.tsx +43 -101
  127. package/src/index.ts +9 -3
  128. package/src/theme/components.tsx +87 -18
  129. package/src/theme/components.types.ts +0 -8
  130. package/dist/PasswordInput.js +0 -87
  131. package/dist/PasswordInput.js.map +0 -1
  132. package/dist/src/PasswordInput.d.ts +0 -21
  133. package/dist/src/PasswordInput.d.ts.map +0 -1
  134. package/src/PasswordInput.test.tsx +0 -51
  135. package/src/PasswordInput.tsx +0 -111
@@ -0,0 +1,136 @@
1
+ /*!
2
+ * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.
3
+ * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
4
+ *
5
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
6
+ * Unless required by applicable law or agreed to in writing, software
7
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
8
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9
+ *
10
+ * See the License for the specific language governing permissions and limitations under the License.
11
+ */
12
+
13
+ import { InputAdornment, InputBase } from "@mui/material";
14
+ import {
15
+ ChangeEventHandler,
16
+ FocusEventHandler,
17
+ forwardRef,
18
+ InputHTMLAttributes,
19
+ memo,
20
+ useCallback,
21
+ } from "react";
22
+
23
+ import { SearchIcon } from "./";
24
+ import { Field } from "./Field";
25
+
26
+ export type SearchFieldProps = {
27
+ /**
28
+ * If `true`, the component will receive focus automatically.
29
+ */
30
+ autoFocus?: boolean;
31
+ /**
32
+ * This prop helps users to fill forms faster, especially on mobile devices.
33
+ * The name can be confusing, as it's more like an autofill.
34
+ * You can learn more about it [following the specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill).
35
+ */
36
+ autoCompleteType?: InputHTMLAttributes<HTMLInputElement>["autoComplete"];
37
+ /**
38
+ * The id of the `input` element.
39
+ */
40
+ id?: string;
41
+ /**
42
+ * If `true`, the component is disabled.
43
+ */
44
+ isDisabled?: boolean;
45
+ /**
46
+ * This label won't show up visually, but it's required for accessibility.
47
+ */
48
+ label: string;
49
+ /**
50
+ * Callback fired when the `input` element loses focus.
51
+ */
52
+ onBlur?: FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
53
+ /**
54
+ * Callback fired when the value is changed.
55
+ */
56
+ onChange?: ChangeEventHandler<HTMLTextAreaElement | HTMLInputElement>;
57
+ /**
58
+ * Callback fired when the `input` element get focus.
59
+ */
60
+ onFocus?: FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
61
+ /**
62
+ * The short hint displayed in the `input` before the user enters a value.
63
+ */
64
+ placeholder?: string;
65
+ /**
66
+ * The value of the `input` element, required for a controlled component.
67
+ */
68
+ value?: string;
69
+ };
70
+
71
+ const SearchField = forwardRef<HTMLInputElement, SearchFieldProps>(
72
+ (
73
+ {
74
+ autoCompleteType,
75
+ autoFocus,
76
+ id: idOverride,
77
+ isDisabled = false,
78
+ label,
79
+ onChange,
80
+ onFocus,
81
+ onBlur,
82
+ placeholder,
83
+ value,
84
+ },
85
+ ref
86
+ ) => {
87
+ const renderFieldComponent = useCallback(
88
+ ({ ariaDescribedBy, id }) => (
89
+ <InputBase
90
+ aria-describedby={ariaDescribedBy}
91
+ autoComplete={autoCompleteType}
92
+ /* eslint-disable-next-line jsx-a11y/no-autofocus */
93
+ autoFocus={autoFocus}
94
+ id={id}
95
+ onChange={onChange}
96
+ onFocus={onFocus}
97
+ onBlur={onBlur}
98
+ placeholder={placeholder}
99
+ ref={ref}
100
+ startAdornment={
101
+ <InputAdornment position="start">
102
+ <SearchIcon />
103
+ </InputAdornment>
104
+ }
105
+ type="search"
106
+ value={value}
107
+ />
108
+ ),
109
+ [
110
+ autoCompleteType,
111
+ autoFocus,
112
+ onChange,
113
+ onFocus,
114
+ onBlur,
115
+ placeholder,
116
+ ref,
117
+ value,
118
+ ]
119
+ );
120
+
121
+ return (
122
+ <Field
123
+ hasVisibleLabel={false}
124
+ id={idOverride}
125
+ isDisabled={isDisabled}
126
+ isRequired={false}
127
+ label={label}
128
+ renderFieldComponent={renderFieldComponent}
129
+ />
130
+ );
131
+ }
132
+ );
133
+
134
+ const MemoizedSearchField = memo(SearchField);
135
+
136
+ export { MemoizedSearchField as SearchField };
package/src/Tag.tsx ADDED
@@ -0,0 +1,41 @@
1
+ /*!
2
+ * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.
3
+ * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
4
+ *
5
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
6
+ * Unless required by applicable law or agreed to in writing, software
7
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
8
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9
+ *
10
+ * See the License for the specific language governing permissions and limitations under the License.
11
+ */
12
+
13
+ import { Chip, ChipProps } from "@mui/material";
14
+ import { memo, useContext } from "react";
15
+ import { TagListContext } from "./TagListContext";
16
+
17
+ export type TagProps = {
18
+ isDisabled?: boolean;
19
+ label: string;
20
+ onClick?: ChipProps["onClick"];
21
+ onRemove?: ChipProps["onDelete"];
22
+ };
23
+
24
+ const Tag = ({ isDisabled, label, onClick, onRemove }: TagProps) => {
25
+ const { chipElementType } = useContext(TagListContext);
26
+
27
+ return (
28
+ <Chip
29
+ label={label}
30
+ clickable={onClick ? true : false}
31
+ component={chipElementType}
32
+ disabled={isDisabled}
33
+ onClick={onClick}
34
+ onDelete={onRemove}
35
+ />
36
+ );
37
+ };
38
+
39
+ const MemoizedTag = memo(Tag);
40
+
41
+ export { MemoizedTag as Tag };
@@ -0,0 +1,43 @@
1
+ /*!
2
+ * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.
3
+ * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
4
+ *
5
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
6
+ * Unless required by applicable law or agreed to in writing, software
7
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
8
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9
+ *
10
+ * See the License for the specific language governing permissions and limitations under the License.
11
+ */
12
+
13
+ import { Tag } from "./";
14
+ import { Stack } from "@mui/material";
15
+ import { memo, ReactElement, useMemo } from "react";
16
+ import { ChipElementType, TagListContext } from "./TagListContext";
17
+
18
+ export type TagListProps = {
19
+ children: ReactElement<typeof Tag> | Array<ReactElement<typeof Tag>>;
20
+ };
21
+
22
+ const TagList = ({ children }: TagListProps) => {
23
+ const providerValue = useMemo<{
24
+ chipElementType: ChipElementType;
25
+ }>(
26
+ () => ({
27
+ chipElementType: "li",
28
+ }),
29
+ []
30
+ );
31
+
32
+ return (
33
+ <Stack component="ul" direction="row" spacing={2}>
34
+ <TagListContext.Provider value={providerValue}>
35
+ {children}
36
+ </TagListContext.Provider>
37
+ </Stack>
38
+ );
39
+ };
40
+
41
+ const MemoizedTagList = memo(TagList);
42
+
43
+ export { MemoizedTagList as TagList };
@@ -0,0 +1,23 @@
1
+ /*!
2
+ * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.
3
+ * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
4
+ *
5
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
6
+ * Unless required by applicable law or agreed to in writing, software
7
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
8
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9
+ *
10
+ * See the License for the specific language governing permissions and limitations under the License.
11
+ */
12
+
13
+ import { createContext } from "react";
14
+
15
+ export type ChipElementType = "li" | "div";
16
+
17
+ export type TagListContextType = {
18
+ chipElementType: ChipElementType;
19
+ };
20
+
21
+ export const TagListContext = createContext<TagListContextType>({
22
+ chipElementType: "div",
23
+ });
package/src/TextField.tsx CHANGED
@@ -10,12 +10,7 @@
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import {
14
- InputAdornment,
15
- InputBase,
16
- InputBaseProps,
17
- InputLabel,
18
- } from "@mui/material";
13
+ import { InputBase } from "@mui/material";
19
14
  import {
20
15
  ChangeEventHandler,
21
16
  FocusEventHandler,
@@ -24,22 +19,9 @@ import {
24
19
  memo,
25
20
  ReactNode,
26
21
  useCallback,
27
- useEffect,
28
- useMemo,
29
- useState,
30
22
  } from "react";
31
23
 
32
- import {
33
- EyeIcon,
34
- EyeOffIcon,
35
- FormControl,
36
- FormHelperText,
37
- IconButton,
38
- SearchIcon,
39
- Typography,
40
- useUniqueId,
41
- ScreenReaderText,
42
- } from "./";
24
+ import { Field } from "./Field";
43
25
 
44
26
  export type TextFieldProps = {
45
27
  /**
@@ -68,10 +50,6 @@ export type TextFieldProps = {
68
50
  * The id of the `input` element.
69
51
  */
70
52
  id?: string;
71
- /**
72
- * Props that go onto the HTML `input` element.
73
- */
74
- inputProps?: InputBaseProps["inputProps"];
75
53
  /**
76
54
  * If `true`, the component is disabled.
77
55
  */
@@ -91,7 +69,7 @@ export type TextFieldProps = {
91
69
  /**
92
70
  * The label for the `input` element.
93
71
  */
94
- label?: string;
72
+ label: string;
95
73
  /**
96
74
  * Callback fired when the `input` element loses focus.
97
75
  */
@@ -119,11 +97,11 @@ export type TextFieldProps = {
119
97
  /**
120
98
  * Type of the `input` element. It should be [a valid HTML5 input type](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Form_%3Cinput%3E_types).
121
99
  */
122
- type?: string;
100
+ type?: "email" | "number" | "tel" | "text" | "url";
123
101
  /**
124
102
  * The value of the `input` element, required for a controlled component.
125
103
  */
126
- value?: unknown;
104
+ value?: string;
127
105
  };
128
106
 
129
107
  const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
@@ -135,15 +113,14 @@ const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
135
113
  errorMessage,
136
114
  hint,
137
115
  id: idOverride,
138
- inputProps = {},
139
116
  isDisabled = false,
140
117
  isMultiline = false,
141
118
  isReadOnly,
142
119
  isRequired = true,
143
120
  label,
121
+ onBlur,
144
122
  onChange,
145
123
  onFocus,
146
- onBlur,
147
124
  optionalLabel,
148
125
  placeholder,
149
126
  startAdornment,
@@ -152,91 +129,56 @@ const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
152
129
  },
153
130
  ref
154
131
  ) => {
155
- const [inputType, setInputType] = useState(type);
156
-
157
- useEffect(() => {
158
- setInputType(type);
159
- }, [type]);
160
-
161
- const togglePasswordVisibility = useCallback(() => {
162
- setInputType((currentType) =>
163
- currentType === "password" ? "text" : "password"
164
- );
165
- }, []);
166
-
167
- const id = useUniqueId(idOverride);
168
- const hintId = hint ? `${id}-hint` : undefined;
169
- const errorId = errorMessage ? `${id}-error` : undefined;
170
- const labelId = label ? `${id}-label` : undefined;
171
-
172
- const localInputProps = useMemo(() => {
173
- const ariaDescribedBy =
174
- errorId && hintId ? `${hintId} ${errorId}` : errorId || hintId;
175
-
176
- return {
177
- ...inputProps,
178
- "aria-describedby":
179
- inputProps["aria-describedby"]?.concat(` ${ariaDescribedBy}`) ??
180
- ariaDescribedBy,
181
- };
182
- }, [errorId, hintId, inputProps]);
183
-
184
- return (
185
- <FormControl disabled={isDisabled} error={Boolean(errorMessage)}>
186
- <InputLabel htmlFor={id} id={labelId}>
187
- {label}
188
- {!isRequired && (
189
- <Typography variant="subtitle1">{optionalLabel}</Typography>
190
- )}
191
- </InputLabel>
192
- {hint && <FormHelperText id={hintId}>{hint}</FormHelperText>}
132
+ const renderFieldComponent = useCallback(
133
+ ({ ariaDescribedBy, id }) => (
193
134
  <InputBase
135
+ aria-describedby={ariaDescribedBy}
194
136
  autoComplete={autoCompleteType}
195
137
  /* eslint-disable-next-line jsx-a11y/no-autofocus */
196
138
  autoFocus={autoFocus}
197
- endAdornment={
198
- type === "password" ? (
199
- <InputAdornment position="end">
200
- <IconButton
201
- aria-label="toggle password visibility"
202
- edge="end"
203
- onClick={togglePasswordVisibility}
204
- >
205
- {inputType === "password" ? <EyeIcon /> : <EyeOffIcon />}
206
- </IconButton>
207
- </InputAdornment>
208
- ) : (
209
- endAdornment
210
- )
211
- }
139
+ endAdornment={endAdornment}
212
140
  id={id}
213
- inputProps={localInputProps}
214
141
  multiline={isMultiline}
142
+ onBlur={onBlur}
215
143
  onChange={onChange}
216
144
  onFocus={onFocus}
217
- onBlur={onBlur}
218
145
  placeholder={placeholder}
219
146
  readOnly={isReadOnly}
220
147
  ref={ref}
221
- startAdornment={
222
- inputType === "search" ? (
223
- <InputAdornment position="start">
224
- <SearchIcon />
225
- </InputAdornment>
226
- ) : (
227
- startAdornment
228
- )
229
- }
230
- type={inputType}
148
+ startAdornment={startAdornment}
149
+ type={type}
231
150
  value={value}
232
151
  />
233
- {errorMessage && (
234
- <FormHelperText error id={errorId}>
235
- <ScreenReaderText>Error:</ScreenReaderText>
236
- {errorMessage}
237
- </FormHelperText>
238
- )}
239
- </FormControl>
152
+ ),
153
+ [
154
+ autoCompleteType,
155
+ autoFocus,
156
+ endAdornment,
157
+ isMultiline,
158
+ onChange,
159
+ onFocus,
160
+ onBlur,
161
+ placeholder,
162
+ isReadOnly,
163
+ ref,
164
+ startAdornment,
165
+ type,
166
+ value,
167
+ ]
168
+ );
169
+
170
+ return (
171
+ <Field
172
+ errorMessage={errorMessage}
173
+ hasVisibleLabel
174
+ hint={hint}
175
+ id={idOverride}
176
+ isDisabled={isDisabled}
177
+ isRequired={isRequired}
178
+ label={label}
179
+ optionalLabel={optionalLabel}
180
+ renderFieldComponent={renderFieldComponent}
181
+ />
240
182
  );
241
183
  }
242
184
  );
package/src/index.ts CHANGED
@@ -14,7 +14,6 @@ export {
14
14
  Alert,
15
15
  AlertTitle,
16
16
  Box,
17
- Button,
18
17
  Chip,
19
18
  createTheme,
20
19
  CssBaseline,
@@ -66,7 +65,6 @@ export type {
66
65
  AlertProps,
67
66
  AlertTitleProps,
68
67
  BoxProps,
69
- ButtonProps,
70
68
  ChipProps,
71
69
  CssBaselineProps,
72
70
  DialogProps,
@@ -122,11 +120,16 @@ export { default as FavoriteIcon } from "@mui/icons-material/Favorite";
122
120
 
123
121
  export { deepmerge, visuallyHidden } from "@mui/utils";
124
122
 
123
+ export * from "./Autocomplete";
125
124
  export * from "./Banner";
125
+ export * from "./Button";
126
126
  export * from "./Checkbox";
127
127
  export * from "./CheckboxGroup";
128
128
  export * from "./CircularProgress";
129
129
  export * from "./createUniqueId";
130
+ export * from "./FieldError";
131
+ export * from "./FieldHint";
132
+ export * from "./FieldLabel";
130
133
  export * from "./Icon";
131
134
  export * from "./iconDictionary";
132
135
  export * from "./Infobox";
@@ -135,11 +138,14 @@ export * from "./MenuButton";
135
138
  export * from "./MenuItem";
136
139
  export * from "./OdysseyCacheProvider";
137
140
  export * from "./OdysseyThemeProvider";
138
- export * from "./PasswordInput";
141
+ export * from "./PasswordField";
139
142
  export * from "./Radio";
140
143
  export * from "./RadioGroup";
141
144
  export * from "./ScreenReaderText";
145
+ export * from "./SearchField";
142
146
  export * from "./Status";
147
+ export * from "./Tag";
148
+ export * from "./TagList";
143
149
  export * from "./TextField";
144
150
  export * from "./theme";
145
151
  export * from "./ThemeProvider";
@@ -36,6 +36,7 @@ import {
36
36
  CheckCircleFilledIcon,
37
37
  ChevronDownIcon,
38
38
  CloseCircleFilledIcon,
39
+ CloseIcon,
39
40
  InformationCircleFilledIcon,
40
41
  SubtractIcon,
41
42
  } from "../iconDictionary";
@@ -144,6 +145,68 @@ export const components: ThemeOptions["components"] = {
144
145
  }),
145
146
  },
146
147
  },
148
+ MuiAutocomplete: {
149
+ defaultProps: {
150
+ autoHighlight: true,
151
+ autoSelect: false,
152
+ blurOnSelect: false,
153
+ clearIcon: <CloseIcon />,
154
+ clearOnEscape: true,
155
+ disableClearable: false,
156
+ disabledItemsFocusable: false,
157
+ disableListWrap: false,
158
+ disablePortal: false,
159
+ filterSelectedOptions: false,
160
+ fullWidth: false,
161
+ handleHomeEndKeys: true,
162
+ includeInputInList: true,
163
+ limitTags: -1,
164
+ openOnFocus: false,
165
+ popupIcon: <ChevronDownIcon />,
166
+ selectOnFocus: true,
167
+ },
168
+ styleOverrides: {
169
+ clearIndicator: ({ theme }) => ({
170
+ marginRight: "unset",
171
+ padding: theme.spacing(1),
172
+ }),
173
+ endAdornment: ({ theme, ownerState }) => ({
174
+ display: "flex",
175
+ gap: theme.spacing(1),
176
+ top: `calc(${theme.spacing(2)} - ${theme.mixins.borderWidth})`,
177
+ right: theme.spacing(2),
178
+ maxHeight: "unset",
179
+ alignItems: "center",
180
+ whiteSpace: "nowrap",
181
+ color: theme.palette.action.active,
182
+
183
+ ...(ownerState.disabled === true && {
184
+ display: "none",
185
+ }),
186
+
187
+ ...(ownerState.readOnly === true && {
188
+ display: "none",
189
+ }),
190
+ }),
191
+ loading: ({ theme }) => ({
192
+ paddingBlock: theme.spacing(3),
193
+ paddingInline: theme.spacing(4),
194
+ }),
195
+ popupIndicator: ({ theme }) => ({
196
+ padding: theme.spacing(1),
197
+ marginRight: "unset",
198
+ }),
199
+ inputRoot: ({ theme, ownerState }) => ({
200
+ ...(ownerState.readOnly === true && {
201
+ backgroundColor: theme.palette.grey[50],
202
+
203
+ [`&:not(:hover)`]: {
204
+ borderColor: "transparent",
205
+ },
206
+ }),
207
+ }),
208
+ },
209
+ },
147
210
  MuiBackdrop: {
148
211
  styleOverrides: {
149
212
  root: ({ ownerState }) => ({
@@ -255,7 +318,7 @@ export const components: ThemeOptions["components"] = {
255
318
  }),
256
319
  },
257
320
  {
258
- props: { size: "s" },
321
+ props: { size: "small" },
259
322
  style: ({ theme }) => ({
260
323
  paddingBlock: `calc(${theme.spacing(2)} - 1px)`,
261
324
  paddingInline: `calc(${theme.spacing(2)} - 1px)`,
@@ -263,7 +326,7 @@ export const components: ThemeOptions["components"] = {
263
326
  }),
264
327
  },
265
328
  {
266
- props: { size: "l" },
329
+ props: { size: "large" },
267
330
  style: ({ theme }) => ({
268
331
  paddingBlock: `calc(${theme.spacing(4)} - 1px)`,
269
332
  paddingInline: `calc(${theme.spacing(4)} - 1px)`,
@@ -468,19 +531,6 @@ export const components: ThemeOptions["components"] = {
468
531
  paddingInlineEnd: theme.spacing(2),
469
532
  }),
470
533
 
471
- [`& .${chipClasses.deleteIcon}`]: {
472
- WebkitTapHighlightColor: "transparent",
473
- color: theme.palette.text.secondary,
474
- fontSize: "1em",
475
- cursor: "pointer",
476
- margin: "0",
477
- marginInlineStart: theme.spacing(2),
478
-
479
- "&:hover": {
480
- color: theme.palette.text.primary,
481
- },
482
- },
483
-
484
534
  [`&.${chipClasses.disabled}`]: {
485
535
  opacity: 1,
486
536
  pointerEvents: "none",
@@ -539,10 +589,32 @@ export const components: ThemeOptions["components"] = {
539
589
  },
540
590
  },
541
591
  }),
592
+
593
+ [`.${inputBaseClasses.root}.${inputBaseClasses.disabled} &`]: {
594
+ backgroundColor: theme.palette.grey[200],
595
+ },
542
596
  }),
597
+
543
598
  label: {
544
599
  padding: 0,
545
600
  },
601
+
602
+ deleteIcon: ({ theme }) => ({
603
+ WebkitTapHighlightColor: "transparent",
604
+ color: theme.palette.text.secondary,
605
+ fontSize: "1em",
606
+ cursor: "pointer",
607
+ margin: "0",
608
+ marginInlineStart: theme.spacing(2),
609
+
610
+ "&:hover": {
611
+ color: theme.palette.text.primary,
612
+ },
613
+
614
+ [`.${inputBaseClasses.root}.${inputBaseClasses.disabled} &`]: {
615
+ display: "none",
616
+ },
617
+ }),
546
618
  },
547
619
  },
548
620
  MuiCircularProgress: {
@@ -1112,9 +1184,6 @@ export const components: ThemeOptions["components"] = {
1112
1184
  },
1113
1185
  },
1114
1186
  MuiInputAdornment: {
1115
- defaultProps: {
1116
- variant: "outlined",
1117
- },
1118
1187
  styleOverrides: {
1119
1188
  root: ({ theme, ownerState }) => ({
1120
1189
  display: "flex",
@@ -33,14 +33,6 @@ declare module "@mui/material/Button" {
33
33
  contained: false;
34
34
  outlined: false;
35
35
  }
36
- interface ButtonPropsSizeOverrides {
37
- s: true;
38
- m: true;
39
- l: true;
40
- small: false;
41
- medium: false;
42
- large: false;
43
- }
44
36
  interface ButtonPropsColorOverrides {
45
37
  inherit: false;
46
38
  primary: false;