@okta/odyssey-react-mui 1.6.19 → 1.6.21

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 (80) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/Button.js +2 -2
  3. package/dist/Button.js.map +1 -1
  4. package/dist/CssBaseline.js +3 -1
  5. package/dist/CssBaseline.js.map +1 -1
  6. package/dist/MenuButton.js +16 -2
  7. package/dist/MenuButton.js.map +1 -1
  8. package/dist/MenuContext.js +2 -1
  9. package/dist/MenuContext.js.map +1 -1
  10. package/dist/MenuItem.js +6 -3
  11. package/dist/MenuItem.js.map +1 -1
  12. package/dist/SearchField.js.map +1 -1
  13. package/dist/icons.generated/ArrowBottom.js +33 -0
  14. package/dist/icons.generated/ArrowBottom.js.map +1 -0
  15. package/dist/icons.generated/ArrowTop.js +33 -0
  16. package/dist/icons.generated/ArrowTop.js.map +1 -0
  17. package/dist/icons.generated/index.js +2 -0
  18. package/dist/icons.generated/index.js.map +1 -1
  19. package/dist/labs/DataFilters.js +366 -0
  20. package/dist/labs/DataFilters.js.map +1 -0
  21. package/dist/labs/DataTable.js +366 -0
  22. package/dist/labs/DataTable.js.map +1 -0
  23. package/dist/labs/DataTablePagination.js +74 -0
  24. package/dist/labs/DataTablePagination.js.map +1 -0
  25. package/dist/labs/PaginatedTable.js +9 -6
  26. package/dist/labs/PaginatedTable.js.map +1 -1
  27. package/dist/labs/StaticTable.js +8 -5
  28. package/dist/labs/StaticTable.js.map +1 -1
  29. package/dist/labs/index.js +4 -1
  30. package/dist/labs/index.js.map +1 -1
  31. package/dist/labs/materialReactTableTypes.js.map +1 -1
  32. package/dist/src/CssBaseline.d.ts +2 -1
  33. package/dist/src/CssBaseline.d.ts.map +1 -1
  34. package/dist/src/MenuButton.d.ts +12 -2
  35. package/dist/src/MenuButton.d.ts.map +1 -1
  36. package/dist/src/MenuContext.d.ts +1 -0
  37. package/dist/src/MenuContext.d.ts.map +1 -1
  38. package/dist/src/MenuItem.d.ts.map +1 -1
  39. package/dist/src/SearchField.d.ts +16 -0
  40. package/dist/src/SearchField.d.ts.map +1 -1
  41. package/dist/src/icons.generated/ArrowBottom.d.ts +16 -0
  42. package/dist/src/icons.generated/ArrowBottom.d.ts.map +1 -0
  43. package/dist/src/icons.generated/ArrowTop.d.ts +16 -0
  44. package/dist/src/icons.generated/ArrowTop.d.ts.map +1 -0
  45. package/dist/src/icons.generated/index.d.ts +2 -0
  46. package/dist/src/icons.generated/index.d.ts.map +1 -1
  47. package/dist/src/labs/DataFilters.d.ts +85 -0
  48. package/dist/src/labs/DataFilters.d.ts.map +1 -0
  49. package/dist/src/labs/DataTable.d.ts +193 -0
  50. package/dist/src/labs/DataTable.d.ts.map +1 -0
  51. package/dist/src/labs/DataTablePagination.d.ts +25 -0
  52. package/dist/src/labs/DataTablePagination.d.ts.map +1 -0
  53. package/dist/src/labs/PaginatedTable.d.ts.map +1 -1
  54. package/dist/src/labs/StaticTable.d.ts.map +1 -1
  55. package/dist/src/labs/index.d.ts +4 -2
  56. package/dist/src/labs/index.d.ts.map +1 -1
  57. package/dist/src/labs/materialReactTableTypes.d.ts +1 -1
  58. package/dist/src/labs/materialReactTableTypes.d.ts.map +1 -1
  59. package/dist/src/theme/components.d.ts.map +1 -1
  60. package/dist/theme/components.js +137 -64
  61. package/dist/theme/components.js.map +1 -1
  62. package/dist/tsconfig.production.tsbuildinfo +1 -1
  63. package/package.json +4 -4
  64. package/src/Button.tsx +2 -2
  65. package/src/CssBaseline.tsx +7 -2
  66. package/src/MenuButton.tsx +50 -8
  67. package/src/MenuContext.ts +2 -0
  68. package/src/MenuItem.tsx +5 -3
  69. package/src/SearchField.tsx +8 -0
  70. package/src/icons.generated/ArrowBottom.tsx +43 -0
  71. package/src/icons.generated/ArrowTop.tsx +43 -0
  72. package/src/icons.generated/index.ts +2 -0
  73. package/src/labs/DataFilters.tsx +601 -0
  74. package/src/labs/DataTable.tsx +681 -0
  75. package/src/labs/DataTablePagination.tsx +88 -0
  76. package/src/labs/PaginatedTable.tsx +35 -33
  77. package/src/labs/StaticTable.tsx +26 -29
  78. package/src/labs/index.ts +6 -3
  79. package/src/labs/{materialReactTableTypes.ts → materialReactTableTypes.tsx} +1 -1
  80. package/src/theme/components.tsx +154 -62
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@okta/odyssey-react-mui",
3
- "version": "1.6.19",
3
+ "version": "1.6.21",
4
4
  "description": "React MUI components for Odyssey, Okta's design system",
5
5
  "author": "Okta, Inc.",
6
6
  "license": "Apache-2.0",
@@ -51,10 +51,10 @@
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.6.19",
54
+ "@okta/odyssey-design-tokens": "1.6.21",
55
55
  "date-fns": "^2.30.0",
56
56
  "i18next": "^23.5.1",
57
- "material-react-table": "^1.14.0",
57
+ "material-react-table": "^2.0.2",
58
58
  "react-i18next": "^12.2.2",
59
59
  "ts-node": "^10.9.1",
60
60
  "word-wrap": "~1.2.5"
@@ -63,5 +63,5 @@
63
63
  "react": ">=17 <19",
64
64
  "react-dom": ">=17 <19"
65
65
  },
66
- "gitHead": "8a5e1cf86a04424f2cba1d27ae94e41ed95e7968"
66
+ "gitHead": "861d33eb34adc8249600d31cb1d8a8edff728e06"
67
67
  }
package/src/Button.tsx CHANGED
@@ -164,13 +164,13 @@ const Button = ({
164
164
 
165
165
  return (
166
166
  <>
167
- {tooltipText && (
167
+ {tooltipText && !isDisabled && (
168
168
  <Tooltip ariaType="description" placement="top" text={tooltipText}>
169
169
  <MuiPropsContext.Consumer>{renderButton}</MuiPropsContext.Consumer>
170
170
  </Tooltip>
171
171
  )}
172
172
 
173
- {!tooltipText && renderButton(muiProps)}
173
+ {(isDisabled || !tooltipText) && renderButton(muiProps)}
174
174
  </>
175
175
  );
176
176
  };
@@ -10,6 +10,11 @@
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import { CssBaseline as MuiCssBaseline } from "@mui/material";
13
+ import {
14
+ CssBaseline as MuiCssBaseline,
15
+ CssBaselineProps as MuiCssBaselineProps,
16
+ } from "@mui/material";
14
17
 
15
- export const CssBaseline = () => <MuiCssBaseline />;
18
+ export const CssBaseline = (props: MuiCssBaselineProps) => (
19
+ <MuiCssBaseline {...props} />
20
+ );
@@ -17,7 +17,12 @@ import {
17
17
  MenuItem,
18
18
  useUniqueId,
19
19
  } from "./";
20
- import { Divider, ListSubheader, Menu } from "@mui/material";
20
+ import {
21
+ Divider,
22
+ ListSubheader,
23
+ Menu as MuiMenu,
24
+ PopoverOrigin,
25
+ } from "@mui/material";
21
26
  import { ChevronDownIcon, MoreIcon } from "./icons.generated";
22
27
  import { memo, type ReactElement, useCallback, useMemo, useState } from "react";
23
28
 
@@ -25,6 +30,8 @@ import { MenuContext, MenuContextType } from "./MenuContext";
25
30
  import { NullElement } from "./NullElement";
26
31
  import type { SeleniumProps } from "./SeleniumProps";
27
32
 
33
+ export const menuAlignmentValues = ["left", "right"] as const;
34
+
28
35
  export type MenuButtonProps = {
29
36
  /**
30
37
  * The ARIA label for the Button
@@ -49,10 +56,13 @@ export type MenuButtonProps = {
49
56
  /**
50
57
  * The <MenuItem> components within the Menu.
51
58
  */
52
- children: Array<
59
+ children:
53
60
  | ReactElement<typeof MenuItem | typeof Divider | typeof ListSubheader>
54
- | NullElement
55
- >;
61
+ | Array<
62
+ | ReactElement<typeof MenuItem | typeof Divider | typeof ListSubheader>
63
+ | NullElement
64
+ >
65
+ | NullElement;
56
66
  /**
57
67
  * The end Icon on the trigggering Button
58
68
  */
@@ -65,6 +75,15 @@ export type MenuButtonProps = {
65
75
  * If the MenuButton is an overflow menu or standard menu.
66
76
  */
67
77
  isOverflow?: boolean;
78
+ /**
79
+ * The horizontal alignment of the menu.
80
+ */
81
+ menuAlignment?: (typeof menuAlignmentValues)[number];
82
+ /**
83
+ * If true (the default), the menu will close when a child MenuItem is clicked.
84
+ * Otherwise, it will remain open.
85
+ */
86
+ shouldCloseOnSelect?: boolean;
68
87
  /**
69
88
  * The size of the button
70
89
  */
@@ -99,9 +118,11 @@ const MenuButton = ({
99
118
  buttonLabel = "",
100
119
  buttonVariant = "secondary",
101
120
  children,
121
+ shouldCloseOnSelect = true,
102
122
  endIcon: endIconProp,
103
123
  id: idOverride,
104
124
  isOverflow,
125
+ menuAlignment = "left",
105
126
  size,
106
127
  testId,
107
128
  tooltipText,
@@ -110,7 +131,7 @@ const MenuButton = ({
110
131
 
111
132
  const isOpen = Boolean(anchorEl);
112
133
 
113
- const closeMenu = useCallback<MenuContextType["closeMenu"]>(() => {
134
+ const closeMenu = useCallback(() => {
114
135
  setAnchorEl(null);
115
136
  }, []);
116
137
 
@@ -129,8 +150,9 @@ const MenuButton = ({
129
150
  () => ({
130
151
  closeMenu,
131
152
  openMenu,
153
+ shouldCloseOnSelect,
132
154
  }),
133
- [closeMenu, openMenu]
155
+ [closeMenu, openMenu, shouldCloseOnSelect]
134
156
  );
135
157
 
136
158
  const endIcon = endIconProp ? (
@@ -141,6 +163,24 @@ const MenuButton = ({
141
163
  <ChevronDownIcon />
142
164
  );
143
165
 
166
+ const anchorOrigin = useMemo(
167
+ () =>
168
+ ({
169
+ horizontal: menuAlignment,
170
+ vertical: "bottom",
171
+ } as PopoverOrigin),
172
+ [menuAlignment]
173
+ );
174
+
175
+ const transformOrigin = useMemo(
176
+ () =>
177
+ ({
178
+ horizontal: menuAlignment,
179
+ vertical: "top",
180
+ } as PopoverOrigin),
181
+ [menuAlignment]
182
+ );
183
+
144
184
  return (
145
185
  <div>
146
186
  <Button
@@ -160,7 +200,9 @@ const MenuButton = ({
160
200
  variant={buttonVariant}
161
201
  />
162
202
 
163
- <Menu
203
+ <MuiMenu
204
+ anchorOrigin={anchorOrigin}
205
+ transformOrigin={transformOrigin}
164
206
  anchorEl={anchorEl}
165
207
  id={`${uniqueId}-menu`}
166
208
  MenuListProps={menuListProps}
@@ -170,7 +212,7 @@ const MenuButton = ({
170
212
  <MenuContext.Provider value={providerValue}>
171
213
  {children}
172
214
  </MenuContext.Provider>
173
- </Menu>
215
+ </MuiMenu>
174
216
  </div>
175
217
  );
176
218
  };
@@ -15,6 +15,7 @@ import { createContext, MouseEventHandler } from "react";
15
15
  export type MenuContextType = {
16
16
  closeMenu: () => void;
17
17
  openMenu: MouseEventHandler<HTMLElement>;
18
+ shouldCloseOnSelect: boolean;
18
19
  };
19
20
 
20
21
  export const MenuContext = createContext<MenuContextType>({
@@ -22,4 +23,5 @@ export const MenuContext = createContext<MenuContextType>({
22
23
  closeMenu: () => {},
23
24
  // eslint-disable-next-line @typescript-eslint/no-empty-function
24
25
  openMenu: () => {},
26
+ shouldCloseOnSelect: true,
25
27
  });
package/src/MenuItem.tsx CHANGED
@@ -63,14 +63,16 @@ const MenuItem = ({
63
63
  value,
64
64
  variant = "default",
65
65
  }: MenuItemProps) => {
66
- const { closeMenu } = useContext(MenuContext);
66
+ const { closeMenu, shouldCloseOnSelect } = useContext(MenuContext);
67
67
 
68
68
  const onClick = useCallback<NonNullable<MuiMenuItemProps["onClick"]>>(
69
69
  (event) => {
70
70
  onClickProp?.(event);
71
- closeMenu();
71
+ if (shouldCloseOnSelect) {
72
+ closeMenu();
73
+ }
72
74
  },
73
- [onClickProp, closeMenu]
75
+ [onClickProp, closeMenu, shouldCloseOnSelect]
74
76
  );
75
77
 
76
78
  return (
@@ -37,6 +37,14 @@ export type SearchFieldProps = {
37
37
  * If `true`, the component will receive focus automatically.
38
38
  */
39
39
  hasInitialFocus?: boolean;
40
+ /**
41
+ * The id of the `input` element.
42
+ */
43
+ id?: string;
44
+ /**
45
+ * If `true`, the component is disabled.
46
+ */
47
+ isDisabled?: boolean;
40
48
  /**
41
49
  * This label won't show up visually, but it's required for accessibility.
42
50
  */
@@ -0,0 +1,43 @@
1
+ /*!
2
+ * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.
3
+ * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
4
+ *
5
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
6
+ * Unless required by applicable law or agreed to in writing, software
7
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
8
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9
+ *
10
+ * See the License for the specific language governing permissions and limitations under the License.
11
+ */
12
+
13
+ // Code automatically generated by svgr; DO NOT EDIT.
14
+
15
+ import { forwardRef } from "react";
16
+ import { SvgIcon, type SvgIconNoChildrenProps } from "../SvgIcon";
17
+
18
+ export type ArrowBottomIconProps = SvgIconNoChildrenProps;
19
+
20
+ export const ArrowBottomIcon = forwardRef<SVGSVGElement, ArrowBottomIconProps>(
21
+ (props, ref) => {
22
+ return (
23
+ <SvgIcon
24
+ viewBox="0 0 24 24"
25
+ fill="none"
26
+ xmlns="http://www.w3.org/2000/svg"
27
+ ref={ref}
28
+ {...props}
29
+ >
30
+ <>
31
+ <path
32
+ fillRule="evenodd"
33
+ clipRule="evenodd"
34
+ d="M18 20.0008L6 20.0008L6 22.0008L18 22.0008L18 20.0008ZM17.7071 13.7079L13.0607 18.3544C12.4749 18.9402 11.5251 18.9402 10.9393 18.3544L6.2929 13.7079L7.70711 12.2937L11 15.5866L11 5.0008L13 5.0008L13 15.5866L16.2929 12.2937L17.7071 13.7079Z"
35
+ fill="currentColor"
36
+ />
37
+ </>
38
+ </SvgIcon>
39
+ );
40
+ }
41
+ );
42
+
43
+ ArrowBottomIcon.displayName = "ArrowBottomIcon";
@@ -0,0 +1,43 @@
1
+ /*!
2
+ * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.
3
+ * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
4
+ *
5
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
6
+ * Unless required by applicable law or agreed to in writing, software
7
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
8
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9
+ *
10
+ * See the License for the specific language governing permissions and limitations under the License.
11
+ */
12
+
13
+ // Code automatically generated by svgr; DO NOT EDIT.
14
+
15
+ import { forwardRef } from "react";
16
+ import { SvgIcon, type SvgIconNoChildrenProps } from "../SvgIcon";
17
+
18
+ export type ArrowTopIconProps = SvgIconNoChildrenProps;
19
+
20
+ export const ArrowTopIcon = forwardRef<SVGSVGElement, ArrowTopIconProps>(
21
+ (props, ref) => {
22
+ return (
23
+ <SvgIcon
24
+ viewBox="0 0 24 24"
25
+ fill="none"
26
+ xmlns="http://www.w3.org/2000/svg"
27
+ ref={ref}
28
+ {...props}
29
+ >
30
+ <>
31
+ <path
32
+ fillRule="evenodd"
33
+ clipRule="evenodd"
34
+ d="M6 4.00073H18V2.00073H6V4.00073ZM6.29289 10.2936L10.9393 5.64713C11.5251 5.06135 12.4749 5.06135 13.0607 5.64713L17.7071 10.2936L16.2929 11.7078L13 8.4149V19.0007H11V8.4149L7.7071 11.7078L6.29289 10.2936Z"
35
+ fill="currentColor"
36
+ />
37
+ </>
38
+ </SvgIcon>
39
+ );
40
+ }
41
+ );
42
+
43
+ ArrowTopIcon.displayName = "ArrowTopIcon";
@@ -15,11 +15,13 @@
15
15
  export * from "./Add";
16
16
  export * from "./AddCircle";
17
17
  export * from "./Apps";
18
+ export * from "./ArrowBottom";
18
19
  export * from "./ArrowDown";
19
20
  export * from "./ArrowLeft";
20
21
  export * from "./ArrowLowerLeft";
21
22
  export * from "./ArrowLowerRight";
22
23
  export * from "./ArrowRight";
24
+ export * from "./ArrowTop";
23
25
  export * from "./ArrowUnsorted";
24
26
  export * from "./ArrowUp";
25
27
  export * from "./ArrowUpperLeft";