@okta/odyssey-react-mui 1.12.0 → 1.12.4

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.
@@ -0,0 +1,20 @@
1
+ /*!
2
+ * Copyright (c) 2024-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
+ export const normalizedKey = function () {
14
+ const SEPARATOR = "-";
15
+ for (var _len = arguments.length, keyParts = new Array(_len), _key = 0; _key < _len; _key++) {
16
+ keyParts[_key] = arguments[_key];
17
+ }
18
+ return keyParts.join(SEPARATOR).replace(/\W+/g, SEPARATOR).toLowerCase();
19
+ };
20
+ //# sourceMappingURL=useNormalizedKey.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useNormalizedKey.js","names":["normalizedKey","SEPARATOR","_len","arguments","length","keyParts","Array","_key","join","replace","toLowerCase"],"sources":["../src/useNormalizedKey.ts"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nexport const normalizedKey = (...keyParts: string[]): string => {\n const SEPARATOR = \"-\";\n // Joins all strings together with SEPARATOR, replaces any non-alphanumeric character with SEPARATOR and casts all to lowercase\n return keyParts.join(SEPARATOR).replace(/\\W+/g, SEPARATOR).toLowerCase();\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,aAAa,GAAG,SAAAA,CAAA,EAAmC;EAC9D,MAAMC,SAAS,GAAG,GAAG;EAAC,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EADSC,QAAQ,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;IAARF,QAAQ,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;EAAA;EAGvC,OAAOF,QAAQ,CAACG,IAAI,CAACP,SAAS,CAAC,CAACQ,OAAO,CAAC,MAAM,EAAER,SAAS,CAAC,CAACS,WAAW,CAAC,CAAC;AAC1E,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@okta/odyssey-react-mui",
3
- "version": "1.12.0",
3
+ "version": "1.12.4",
4
4
  "description": "React MUI components for Odyssey, Okta's design system",
5
5
  "author": "Okta, Inc.",
6
6
  "license": "Apache-2.0",
@@ -51,7 +51,7 @@
51
51
  "@mui/system": "^5.14.9",
52
52
  "@mui/utils": "^5.11.2",
53
53
  "@mui/x-date-pickers": "^5.0.15",
54
- "@okta/odyssey-design-tokens": "1.12.0",
54
+ "@okta/odyssey-design-tokens": "1.12.4",
55
55
  "date-fns": "^2.30.0",
56
56
  "i18next": "^23.5.1",
57
57
  "material-react-table": "^2.0.2",
@@ -63,5 +63,5 @@
63
63
  "react": ">=17 <19",
64
64
  "react-dom": ">=17 <19"
65
65
  },
66
- "gitHead": "1bffe33f2c5946144232f60f983bfe76b6339453"
66
+ "gitHead": "b5b53ea203c3017a6fd6dc6642a1dfc9a19df7fd"
67
67
  }
@@ -10,6 +10,7 @@
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
12
 
13
+ import { memo } from "react";
13
14
  import { CircularProgress as MuiCircularProgress } from "@mui/material";
14
15
 
15
16
  import type { AllowedProps } from "./AllowedProps";
@@ -26,7 +27,7 @@ export type CircularProgressProps = {
26
27
  value?: number;
27
28
  } & AllowedProps;
28
29
 
29
- export const CircularProgress = ({
30
+ const CircularProgress = ({
30
31
  ariaLabel,
31
32
  testId,
32
33
  value,
@@ -38,3 +39,8 @@ export const CircularProgress = ({
38
39
  aria-label={ariaLabel}
39
40
  />
40
41
  );
42
+
43
+ const MemoizedCircularProgress = memo(CircularProgress);
44
+ MemoizedCircularProgress.displayName = "CircularProgress";
45
+
46
+ export { MemoizedCircularProgress as CircularProgress };
package/src/Select.tsx CHANGED
@@ -40,6 +40,7 @@ import {
40
40
  useInputValues,
41
41
  getControlState,
42
42
  } from "./inputUtils";
43
+ import { normalizedKey } from "./useNormalizedKey";
43
44
 
44
45
  export type SelectOption = {
45
46
  text: string;
@@ -215,7 +216,10 @@ const Select = <
215
216
  typeof option === "object"
216
217
  ? {
217
218
  text: option.text,
218
- value: option.value || option.text,
219
+ value:
220
+ option?.value === ""
221
+ ? option.value
222
+ : option.value || option.text,
219
223
  type: option.type === "heading" ? "heading" : "option",
220
224
  }
221
225
  : { text: option, value: option, type: "option" }
@@ -261,19 +265,25 @@ const Select = <
261
265
  // that will populate the <Select>
262
266
  const children = useMemo(
263
267
  () =>
264
- normalizedOptions.map((option) => {
268
+ normalizedOptions.map((option, index) => {
265
269
  if (option.type === "heading") {
266
270
  return <ListSubheader key={option.text}>{option.text}</ListSubheader>;
267
271
  }
268
272
  return (
269
- <MenuItem key={option.value} value={option.value}>
273
+ <MenuItem
274
+ key={normalizedKey(option.text, index.toString())}
275
+ value={option.value}
276
+ >
270
277
  {hasMultipleChoices && (
271
278
  <MuiCheckbox
272
- checked={internalSelectedValues?.includes(option.value)}
279
+ checked={
280
+ option.value !== undefined &&
281
+ internalSelectedValues?.includes(option.value)
282
+ }
273
283
  />
274
284
  )}
275
285
  {option.text}
276
- {internalSelectedValues === option.value && (
286
+ {internalSelectedValues === option?.value && (
277
287
  <ListItemSecondaryAction>
278
288
  <CheckIcon />
279
289
  </ListItemSecondaryAction>
@@ -291,6 +301,10 @@ const Select = <
291
301
  aria-describedby={ariaDescribedBy}
292
302
  aria-errormessage={errorMessageElementId}
293
303
  children={children}
304
+ data-se={testId}
305
+ displayEmpty={
306
+ inputValues?.value === "" || inputValues?.defaultValue === ""
307
+ }
294
308
  id={id}
295
309
  inputProps={{ "data-se": testId }}
296
310
  inputRef={localInputRef}
package/src/index.ts CHANGED
@@ -52,6 +52,9 @@ export type {
52
52
  ThemeOptions,
53
53
  } from "@mui/material";
54
54
 
55
+ export type { ForwardRefWithType } from "./@types/react-augment";
56
+ export type { FocusHandle } from "./inputUtils";
57
+
55
58
  export { useOdysseyDesignTokens } from "./OdysseyDesignTokensContext";
56
59
 
57
60
  export * from "./Accordion";
@@ -0,0 +1,17 @@
1
+ /*!
2
+ * Copyright (c) 2024-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
+ export const normalizedKey = (...keyParts: string[]): string => {
14
+ const SEPARATOR = "-";
15
+ // Joins all strings together with SEPARATOR, replaces any non-alphanumeric character with SEPARATOR and casts all to lowercase
16
+ return keyParts.join(SEPARATOR).replace(/\W+/g, SEPARATOR).toLowerCase();
17
+ };