@okta/odyssey-react-mui 1.26.0 → 1.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/Surface.js +10 -2
- package/dist/Surface.js.map +1 -1
- package/dist/index.scss +1 -1
- package/dist/labs/DataView/DataView.js +6 -0
- package/dist/labs/DataView/DataView.js.map +1 -1
- package/dist/labs/DataView/componentTypes.js.map +1 -1
- package/dist/labs/SideNav/NavAccordion.js +4 -5
- package/dist/labs/SideNav/NavAccordion.js.map +1 -1
- package/dist/labs/SideNav/SideNav.js +167 -93
- package/dist/labs/SideNav/SideNav.js.map +1 -1
- package/dist/labs/SideNav/SideNavItemContent.js +97 -57
- package/dist/labs/SideNav/SideNavItemContent.js.map +1 -1
- package/dist/labs/SideNav/SideNavItemContentContext.js +1 -0
- package/dist/labs/SideNav/SideNavItemContentContext.js.map +1 -1
- package/dist/labs/SideNav/SideNavItemLinkContent.js +2 -2
- package/dist/labs/SideNav/SideNavItemLinkContent.js.map +1 -1
- package/dist/labs/SideNav/SideNavToggleButton.js +5 -5
- package/dist/labs/SideNav/SideNavToggleButton.js.map +1 -1
- package/dist/labs/SideNav/SortableList/SortableItem.js +162 -0
- package/dist/labs/SideNav/SortableList/SortableItem.js.map +1 -0
- package/dist/labs/SideNav/SortableList/SortableList.js +118 -0
- package/dist/labs/SideNav/SortableList/SortableList.js.map +1 -0
- package/dist/labs/SideNav/SortableList/SortableOverlay.js +30 -0
- package/dist/labs/SideNav/SortableList/SortableOverlay.js.map +1 -0
- package/dist/labs/SideNav/types.js.map +1 -1
- package/dist/labs/TopNav/TopNav.js +1 -1
- package/dist/labs/TopNav/TopNav.js.map +1 -1
- package/dist/labs/UiShell/UiShellContent.js +1 -1
- package/dist/labs/UiShell/UiShellContent.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui.js +7 -0
- package/dist/properties/ts/odyssey-react-mui.js.map +1 -1
- package/dist/src/OdysseyTranslationProvider.d.ts +1 -1
- package/dist/src/OdysseyTranslationProvider.d.ts.map +1 -1
- package/dist/src/Surface.d.ts.map +1 -1
- package/dist/src/labs/DataView/DataView.d.ts +1 -1
- package/dist/src/labs/DataView/DataView.d.ts.map +1 -1
- package/dist/src/labs/DataView/componentTypes.d.ts +3 -2
- package/dist/src/labs/DataView/componentTypes.d.ts.map +1 -1
- package/dist/src/labs/SideNav/NavAccordion.d.ts +2 -6
- package/dist/src/labs/SideNav/NavAccordion.d.ts.map +1 -1
- package/dist/src/labs/SideNav/SideNav.d.ts +1 -1
- package/dist/src/labs/SideNav/SideNav.d.ts.map +1 -1
- package/dist/src/labs/SideNav/SideNavItemContent.d.ts +37 -1
- package/dist/src/labs/SideNav/SideNavItemContent.d.ts.map +1 -1
- package/dist/src/labs/SideNav/SideNavItemContentContext.d.ts +1 -0
- package/dist/src/labs/SideNav/SideNavItemContentContext.d.ts.map +1 -1
- package/dist/src/labs/SideNav/SideNavToggleButton.d.ts.map +1 -1
- package/dist/src/labs/SideNav/SortableList/SortableItem.d.ts +26 -0
- package/dist/src/labs/SideNav/SortableList/SortableItem.d.ts.map +1 -0
- package/dist/src/labs/SideNav/SortableList/SortableList.d.ts +36 -0
- package/dist/src/labs/SideNav/SortableList/SortableList.d.ts.map +1 -0
- package/dist/src/labs/SideNav/SortableList/SortableOverlay.d.ts +17 -0
- package/dist/src/labs/SideNav/SortableList/SortableOverlay.d.ts.map +1 -0
- package/dist/src/labs/SideNav/types.d.ts +16 -6
- package/dist/src/labs/SideNav/types.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui.d.ts +7 -0
- package/dist/src/properties/ts/odyssey-react-mui.d.ts.map +1 -1
- package/dist/tsconfig.production.tsbuildinfo +1 -1
- package/i18n.config.json +2 -1
- package/package.json +6 -3
- package/src/Surface.tsx +16 -4
- package/src/labs/DataView/DataView.tsx +6 -0
- package/src/labs/DataView/componentTypes.ts +6 -2
- package/src/labs/SideNav/NavAccordion.tsx +5 -10
- package/src/labs/SideNav/SideNav.test.tsx +8 -8
- package/src/labs/SideNav/SideNav.tsx +232 -119
- package/src/labs/SideNav/SideNavItemContent.tsx +114 -61
- package/src/labs/SideNav/SideNavItemContentContext.tsx +2 -0
- package/src/labs/SideNav/SideNavItemLinkContent.tsx +2 -2
- package/src/labs/SideNav/SideNavToggleButton.tsx +5 -9
- package/src/labs/SideNav/SortableList/SortableItem.tsx +202 -0
- package/src/labs/SideNav/SortableList/SortableList.tsx +122 -0
- package/src/labs/SideNav/SortableList/SortableOverlay.tsx +34 -0
- package/src/labs/SideNav/types.ts +16 -6
- package/src/labs/TopNav/TopNav.tsx +1 -1
- package/src/labs/UiShell/UiShellContent.tsx +1 -1
- package/src/properties/odyssey-react-mui.properties +7 -0
- package/src/properties/ts/odyssey-react-mui.ts +1 -1
package/i18n.config.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
+
"namespace": "enduser",
|
|
2
3
|
"resourceFile": "odyssey-react-mui.properties",
|
|
3
4
|
"resourceFilePath": "packages/odyssey-react-mui/src/properties",
|
|
4
5
|
"translationsFilePath": "packages/odyssey-react-mui/src/properties/translations",
|
|
5
6
|
"commitPrefix": "chore(odyssey-react-mui): ",
|
|
6
7
|
"reviewers": ["okta/eng-globalizationcore", "okta/design-system"],
|
|
7
8
|
"slackChannel": "odyssey",
|
|
8
|
-
"guardian": "
|
|
9
|
+
"guardian": ""
|
|
9
10
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@okta/odyssey-react-mui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.27.0",
|
|
4
4
|
"description": "React MUI components for Odyssey, Okta's design system",
|
|
5
5
|
"author": "Okta, Inc.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -49,6 +49,9 @@
|
|
|
49
49
|
"directory": "packages/odyssey-react-mui"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
+
"@dnd-kit/core": "6.0.3",
|
|
53
|
+
"@dnd-kit/sortable": "7.0.0",
|
|
54
|
+
"@dnd-kit/utilities": "3.2.0",
|
|
52
55
|
"@emotion/cache": "^11.11.0",
|
|
53
56
|
"@emotion/react": "^11.11.4",
|
|
54
57
|
"@emotion/styled": "^11.11.0",
|
|
@@ -58,7 +61,7 @@
|
|
|
58
61
|
"@mui/system": "^5.15.9",
|
|
59
62
|
"@mui/utils": "^5.15.9",
|
|
60
63
|
"@mui/x-date-pickers": "^7.2.0",
|
|
61
|
-
"@okta/odyssey-design-tokens": "^1.
|
|
64
|
+
"@okta/odyssey-design-tokens": "^1.27.0",
|
|
62
65
|
"@types/luxon": "^3.4.2",
|
|
63
66
|
"date-fns": "^2.30.0",
|
|
64
67
|
"dom-accessibility-api": "^0.7.0",
|
|
@@ -74,5 +77,5 @@
|
|
|
74
77
|
"react": "^18.2.0",
|
|
75
78
|
"react-dom": "^18.2.0"
|
|
76
79
|
},
|
|
77
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "929b26fa0b7821e97b67b218cbcfd23e75b3ea1e"
|
|
78
81
|
}
|
package/src/Surface.tsx
CHANGED
|
@@ -19,14 +19,22 @@ import {
|
|
|
19
19
|
useOdysseyDesignTokens,
|
|
20
20
|
} from "./OdysseyDesignTokensContext";
|
|
21
21
|
import { OdysseyThemeProvider } from "./OdysseyThemeProvider";
|
|
22
|
+
import { useContrastModeContext, ContrastMode } from "./useContrastMode";
|
|
22
23
|
|
|
23
24
|
const StyledContainer = styled(MuiPaper, {
|
|
24
|
-
shouldForwardProp: (prop) =>
|
|
25
|
+
shouldForwardProp: (prop) =>
|
|
26
|
+
prop !== "odysseyDesignTokens" && prop !== "contrastMode",
|
|
25
27
|
})<{
|
|
28
|
+
contrastMode: ContrastMode;
|
|
26
29
|
odysseyDesignTokens: DesignTokens;
|
|
27
|
-
}>(({ odysseyDesignTokens }) => ({
|
|
30
|
+
}>(({ contrastMode, odysseyDesignTokens }) => ({
|
|
28
31
|
borderRadius: odysseyDesignTokens.Spacing4,
|
|
29
|
-
padding: odysseyDesignTokens.
|
|
32
|
+
padding: odysseyDesignTokens.Spacing5,
|
|
33
|
+
border:
|
|
34
|
+
contrastMode === "lowContrast"
|
|
35
|
+
? `1px solid ${odysseyDesignTokens.HueNeutral100}`
|
|
36
|
+
: "none",
|
|
37
|
+
boxShadow: "none",
|
|
30
38
|
}));
|
|
31
39
|
|
|
32
40
|
export type SurfaceProps = {
|
|
@@ -35,9 +43,13 @@ export type SurfaceProps = {
|
|
|
35
43
|
|
|
36
44
|
const Surface = ({ children }: SurfaceProps) => {
|
|
37
45
|
const odysseyDesignTokens = useOdysseyDesignTokens();
|
|
46
|
+
const { contrastMode } = useContrastModeContext();
|
|
38
47
|
|
|
39
48
|
return (
|
|
40
|
-
<StyledContainer
|
|
49
|
+
<StyledContainer
|
|
50
|
+
contrastMode={contrastMode}
|
|
51
|
+
odysseyDesignTokens={odysseyDesignTokens}
|
|
52
|
+
>
|
|
41
53
|
<OdysseyThemeProvider>{children}</OdysseyThemeProvider>
|
|
42
54
|
</StyledContainer>
|
|
43
55
|
);
|
|
@@ -101,6 +101,9 @@ const DataView = ({
|
|
|
101
101
|
getRowId: getRowIdProp,
|
|
102
102
|
hasFilters,
|
|
103
103
|
hasPagination,
|
|
104
|
+
hasPageInput,
|
|
105
|
+
hasRowCountInput,
|
|
106
|
+
hasRowCountLabel,
|
|
104
107
|
hasSearch,
|
|
105
108
|
hasSearchSubmitButton,
|
|
106
109
|
hasRowReordering,
|
|
@@ -461,6 +464,9 @@ const DataView = ({
|
|
|
461
464
|
{hasPagination && (
|
|
462
465
|
<Pagination
|
|
463
466
|
currentPageLabel={t("pagination.page")}
|
|
467
|
+
hasPageInput={hasPageInput}
|
|
468
|
+
hasRowCountInput={hasRowCountInput}
|
|
469
|
+
hasRowCountLabel={hasRowCountLabel}
|
|
464
470
|
isDisabled={isEmpty}
|
|
465
471
|
isMoreDisabled={isPaginationMoreDisabled}
|
|
466
472
|
lastRow={lastRowOnPage}
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
MRT_TableOptions,
|
|
19
19
|
MRT_VisibilityState,
|
|
20
20
|
} from "material-react-table";
|
|
21
|
+
import { ReactNode } from "react";
|
|
21
22
|
|
|
22
23
|
import { availableLayouts, availableCardLayouts } from "./constants";
|
|
23
24
|
import { DataFilter } from "../DataFilters";
|
|
@@ -30,8 +31,8 @@ import {
|
|
|
30
31
|
import { DataTableRowActionsProps } from "../../DataTable/DataTableRowActions";
|
|
31
32
|
import { MenuButtonProps } from "../..";
|
|
32
33
|
import { paginationTypeValues } from "../DataTablePagination";
|
|
33
|
-
import { ReactNode } from "react";
|
|
34
34
|
import { DataCardProps } from "./DataCard";
|
|
35
|
+
import { type PaginationProps } from "../../Pagination";
|
|
35
36
|
|
|
36
37
|
export type DataLayout = (typeof availableLayouts)[number];
|
|
37
38
|
export type CardLayout = (typeof availableCardLayouts)[number];
|
|
@@ -90,7 +91,10 @@ export type UniversalProps = {
|
|
|
90
91
|
resultsPerPage?: number;
|
|
91
92
|
searchDelayTime?: number;
|
|
92
93
|
totalRows?: number;
|
|
93
|
-
}
|
|
94
|
+
} & Pick<
|
|
95
|
+
PaginationProps,
|
|
96
|
+
"hasPageInput" | "hasRowCountInput" | "hasRowCountLabel"
|
|
97
|
+
>;
|
|
94
98
|
|
|
95
99
|
export type TableLayoutProps = {
|
|
96
100
|
columns: DataTableColumn<MRT_RowData>[];
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
AccordionSummary as MuiAccordionSummary,
|
|
18
18
|
AccordionProps as MuiAccordionProps,
|
|
19
19
|
} from "@mui/material";
|
|
20
|
-
import { ReactNode, memo } from "react";
|
|
20
|
+
import { PropsWithChildren, ReactNode, memo } from "react";
|
|
21
21
|
|
|
22
22
|
import type { HtmlProps } from "../../HtmlProps";
|
|
23
23
|
import { ChevronDownIcon } from "../../icons.generated";
|
|
@@ -29,10 +29,6 @@ import { Support } from "../../Typography";
|
|
|
29
29
|
import { useUniqueId } from "../../useUniqueId";
|
|
30
30
|
|
|
31
31
|
export type NavAccordionProps = {
|
|
32
|
-
/**
|
|
33
|
-
* The content of the Accordion itself
|
|
34
|
-
*/
|
|
35
|
-
children: ReactNode;
|
|
36
32
|
/**
|
|
37
33
|
* The label text for the AccordionSummary
|
|
38
34
|
*/
|
|
@@ -76,8 +72,7 @@ const AccordionLabelContainer = styled("span", {
|
|
|
76
72
|
isIconVisible: boolean;
|
|
77
73
|
}>(({ odysseyDesignTokens, isIconVisible }) => ({
|
|
78
74
|
width: "100%",
|
|
79
|
-
|
|
80
|
-
fontSize: odysseyDesignTokens.TypographyScale0,
|
|
75
|
+
marginInlineStart: isIconVisible ? odysseyDesignTokens.Spacing3 : 0,
|
|
81
76
|
fontWeight: odysseyDesignTokens.TypographyWeightHeading,
|
|
82
77
|
color: odysseyDesignTokens.TypographyColorHeading,
|
|
83
78
|
}));
|
|
@@ -95,16 +90,16 @@ const AccordionSummaryContainer = styled(MuiAccordionSummary, {
|
|
|
95
90
|
borderRadius: odysseyDesignTokens.BorderRadiusMain,
|
|
96
91
|
paddingBlock: odysseyDesignTokens.Spacing3,
|
|
97
92
|
paddingInline: odysseyDesignTokens.Spacing4,
|
|
98
|
-
lineHeight: 1.5,
|
|
99
93
|
|
|
100
94
|
"&:focus-visible": {
|
|
101
95
|
backgroundColor: "unset",
|
|
102
96
|
outline: "none",
|
|
103
|
-
boxShadow: `inset 0 0 0
|
|
97
|
+
boxShadow: `inset 0 0 0 2px ${odysseyDesignTokens.PalettePrimaryMain}`,
|
|
104
98
|
},
|
|
105
99
|
|
|
106
100
|
...(isCompact && {
|
|
107
101
|
paddingBlock: odysseyDesignTokens.Spacing2,
|
|
102
|
+
minHeight: "unset",
|
|
108
103
|
}),
|
|
109
104
|
|
|
110
105
|
...(!isDisabled && {
|
|
@@ -124,7 +119,7 @@ const NavAccordion = ({
|
|
|
124
119
|
isExpanded,
|
|
125
120
|
translate,
|
|
126
121
|
startIcon,
|
|
127
|
-
}: NavAccordionProps) => {
|
|
122
|
+
}: PropsWithChildren<NavAccordionProps>) => {
|
|
128
123
|
const id = useUniqueId(idOverride);
|
|
129
124
|
const headerId = `${id}-header`;
|
|
130
125
|
const contentId = `${id}-content`;
|
|
@@ -101,12 +101,12 @@ describe("SideNav", () => {
|
|
|
101
101
|
|
|
102
102
|
expect(screen.getByText(menuItemText)).toBeVisible();
|
|
103
103
|
|
|
104
|
-
const collapseButton = screen.getByLabelText("
|
|
104
|
+
const collapseButton = screen.getByLabelText("Close navigation");
|
|
105
105
|
fireEvent.click(collapseButton);
|
|
106
106
|
|
|
107
107
|
expect(screen.getByText(menuItemText)).not.toBeVisible;
|
|
108
108
|
|
|
109
|
-
const expandButton = screen.getByLabelText("
|
|
109
|
+
const expandButton = screen.getByLabelText("Open navigation");
|
|
110
110
|
fireEvent.click(expandButton);
|
|
111
111
|
|
|
112
112
|
expect(screen.getByText(menuItemText)).toBeVisible();
|
|
@@ -133,7 +133,7 @@ describe("SideNav", () => {
|
|
|
133
133
|
</OdysseyProvider>,
|
|
134
134
|
);
|
|
135
135
|
|
|
136
|
-
const collapseButton = screen.getByLabelText("
|
|
136
|
+
const collapseButton = screen.getByLabelText("Close navigation");
|
|
137
137
|
fireEvent.click(collapseButton);
|
|
138
138
|
|
|
139
139
|
expect(mockOnCollapse).toBeCalled();
|
|
@@ -160,10 +160,10 @@ describe("SideNav", () => {
|
|
|
160
160
|
</OdysseyProvider>,
|
|
161
161
|
);
|
|
162
162
|
|
|
163
|
-
const collapseButton = screen.getByLabelText("
|
|
163
|
+
const collapseButton = screen.getByLabelText("Close navigation");
|
|
164
164
|
fireEvent.click(collapseButton);
|
|
165
165
|
|
|
166
|
-
const expandButton = screen.getByLabelText("
|
|
166
|
+
const expandButton = screen.getByLabelText("Open navigation");
|
|
167
167
|
fireEvent.click(expandButton);
|
|
168
168
|
|
|
169
169
|
expect(mockOnExpand).toBeCalled();
|
|
@@ -273,7 +273,7 @@ describe("SideNav", () => {
|
|
|
273
273
|
{
|
|
274
274
|
id: "accordionOuter",
|
|
275
275
|
label: accordionOuter,
|
|
276
|
-
|
|
276
|
+
nestedNavItems: [
|
|
277
277
|
{
|
|
278
278
|
id: "accordionInner",
|
|
279
279
|
href: "#",
|
|
@@ -286,7 +286,7 @@ describe("SideNav", () => {
|
|
|
286
286
|
</OdysseyProvider>,
|
|
287
287
|
);
|
|
288
288
|
|
|
289
|
-
expect(screen.getByRole("
|
|
289
|
+
expect(screen.getByRole("link", { name: menuLinkText })).toBeVisible();
|
|
290
290
|
expect(
|
|
291
291
|
screen.getByRole("button", { name: menuClickableText }),
|
|
292
292
|
).toBeVisible();
|
|
@@ -318,6 +318,6 @@ describe("SideNav", () => {
|
|
|
318
318
|
</OdysseyProvider>,
|
|
319
319
|
);
|
|
320
320
|
|
|
321
|
-
expect(screen.getByRole("
|
|
321
|
+
expect(screen.getByRole("listitem")).toHaveTextContent(`${badgeCount}`);
|
|
322
322
|
});
|
|
323
323
|
});
|