@okta/odyssey-react-mui 1.14.3 → 1.14.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.
- package/CHANGELOG.md +4 -0
- package/dist/DataTable/DataTable.js +330 -0
- package/dist/DataTable/DataTable.js.map +1 -0
- package/dist/DataTable/DataTableRowActions.js +89 -0
- package/dist/DataTable/DataTableRowActions.js.map +1 -0
- package/dist/DataTable/DataTableSettings.js +72 -0
- package/dist/DataTable/DataTableSettings.js.map +1 -0
- package/dist/DataTable/constants.js +14 -0
- package/dist/DataTable/constants.js.map +1 -0
- package/dist/DataTable/index.js +14 -0
- package/dist/DataTable/index.js.map +1 -0
- package/dist/DataTable/reorderDataRowsLocally.js +26 -0
- package/dist/DataTable/reorderDataRowsLocally.js.map +1 -0
- package/dist/DataTable/useRowReordering.js +179 -0
- package/dist/DataTable/useRowReordering.js.map +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/labs/DataFilters.js +42 -14
- package/dist/labs/DataFilters.js.map +1 -1
- package/dist/labs/DataTable.js +16 -11
- package/dist/labs/DataTable.js.map +1 -1
- package/dist/labs/index.js +0 -1
- package/dist/labs/index.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui.js +18 -1
- package/dist/properties/ts/odyssey-react-mui.js.map +1 -1
- package/dist/src/DataTable/DataTable.d.ts +133 -0
- package/dist/src/DataTable/DataTable.d.ts.map +1 -0
- package/dist/src/DataTable/DataTableRowActions.d.ts +30 -0
- package/dist/src/DataTable/DataTableRowActions.d.ts.map +1 -0
- package/dist/src/DataTable/DataTableSettings.d.ts +27 -0
- package/dist/src/DataTable/DataTableSettings.d.ts.map +1 -0
- package/dist/src/DataTable/constants.d.ts +13 -0
- package/dist/src/DataTable/constants.d.ts.map +1 -0
- package/dist/src/DataTable/index.d.ts +15 -0
- package/dist/src/DataTable/index.d.ts.map +1 -0
- package/dist/src/DataTable/reorderDataRowsLocally.d.ts +26 -0
- package/dist/src/DataTable/reorderDataRowsLocally.d.ts.map +1 -0
- package/dist/src/DataTable/useRowReordering.d.ts +56 -0
- package/dist/src/DataTable/useRowReordering.d.ts.map +1 -0
- package/dist/src/OdysseyTranslationProvider.d.ts +1 -1
- package/dist/src/OdysseyTranslationProvider.d.ts.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/labs/DataFilters.d.ts.map +1 -1
- package/dist/src/labs/DataTable.d.ts +2 -2
- package/dist/src/labs/DataTable.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/properties/ts/odyssey-react-mui.d.ts +18 -1
- package/dist/src/properties/ts/odyssey-react-mui.d.ts.map +1 -1
- package/dist/src/theme/components.d.ts.map +1 -1
- package/dist/theme/components.js +37 -18
- package/dist/theme/components.js.map +1 -1
- package/dist/tsconfig.production.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/DataTable/DataTable.tsx +538 -0
- package/src/DataTable/DataTableRowActions.tsx +124 -0
- package/src/DataTable/DataTableSettings.tsx +109 -0
- package/src/DataTable/constants.ts +13 -0
- package/src/DataTable/index.tsx +22 -0
- package/src/DataTable/reorderDataRowsLocally.tsx +48 -0
- package/src/DataTable/useRowReordering.tsx +233 -0
- package/src/index.ts +1 -0
- package/src/labs/DataFilters.tsx +60 -17
- package/src/labs/DataTable.tsx +24 -11
- package/src/labs/index.ts +0 -1
- package/src/properties/odyssey-react-mui.properties +19 -2
- package/src/properties/ts/odyssey-react-mui.ts +1 -1
- package/src/theme/components.tsx +43 -16
package/src/labs/DataTable.tsx
CHANGED
|
@@ -57,6 +57,7 @@ import { Button } from "../Button";
|
|
|
57
57
|
import { Box } from "../Box";
|
|
58
58
|
import { MenuButton, MenuItem } from "..";
|
|
59
59
|
import { ArrowUnsortedIcon } from "../icons.generated";
|
|
60
|
+
import { useTranslation } from "react-i18next";
|
|
60
61
|
|
|
61
62
|
export const densityValues = ["comfortable", "spacious", "compact"] as const;
|
|
62
63
|
|
|
@@ -68,7 +69,7 @@ export type {
|
|
|
68
69
|
|
|
69
70
|
// The shape of the table columns,
|
|
70
71
|
// with props named to match their MRT_ColumnDef counterparts
|
|
71
|
-
export type
|
|
72
|
+
export type DataTableColumn = {
|
|
72
73
|
/**
|
|
73
74
|
* The unique ID of the column
|
|
74
75
|
*/
|
|
@@ -130,7 +131,7 @@ export type DataTableProps = {
|
|
|
130
131
|
/**
|
|
131
132
|
* The columns that make up the table
|
|
132
133
|
*/
|
|
133
|
-
columns:
|
|
134
|
+
columns: DataTableColumn[];
|
|
134
135
|
/**
|
|
135
136
|
* The data that goes into the table, which will be displayed
|
|
136
137
|
* as the table rows
|
|
@@ -310,6 +311,7 @@ const DataTable = ({
|
|
|
310
311
|
hasSorting,
|
|
311
312
|
}: DataTableProps) => {
|
|
312
313
|
const odysseyDesignTokens = useOdysseyDesignTokens();
|
|
314
|
+
const { t } = useTranslation();
|
|
313
315
|
const [draggingRow, setDraggingRow] = useState<MRT_Row<MRT_RowData> | null>();
|
|
314
316
|
const [showSkeletons, setShowSkeletons] = useState<boolean>(true);
|
|
315
317
|
const [data, setData] =
|
|
@@ -550,17 +552,29 @@ const DataTable = ({
|
|
|
550
552
|
[draggingRow],
|
|
551
553
|
);
|
|
552
554
|
|
|
553
|
-
const
|
|
554
|
-
|
|
555
|
-
data: data,
|
|
556
|
-
state: {
|
|
555
|
+
const tableState = useMemo(
|
|
556
|
+
() => ({
|
|
557
557
|
density,
|
|
558
558
|
sorting,
|
|
559
559
|
globalFilter,
|
|
560
560
|
columnVisibility,
|
|
561
561
|
rowSelection,
|
|
562
562
|
showSkeletons,
|
|
563
|
-
},
|
|
563
|
+
}),
|
|
564
|
+
[
|
|
565
|
+
density,
|
|
566
|
+
sorting,
|
|
567
|
+
globalFilter,
|
|
568
|
+
columnVisibility,
|
|
569
|
+
rowSelection,
|
|
570
|
+
showSkeletons,
|
|
571
|
+
],
|
|
572
|
+
);
|
|
573
|
+
|
|
574
|
+
const table = useMaterialReactTable({
|
|
575
|
+
columns: columns,
|
|
576
|
+
data: data,
|
|
577
|
+
state: tableState,
|
|
564
578
|
rowVirtualizerInstanceRef: rowVirtualizerInstanceRef,
|
|
565
579
|
rowVirtualizerOptions: { overscan: 4 },
|
|
566
580
|
enableRowVirtualization:
|
|
@@ -648,9 +662,8 @@ const DataTable = ({
|
|
|
648
662
|
}),
|
|
649
663
|
|
|
650
664
|
muiRowDragHandleProps: ({ table, row }) => ({
|
|
651
|
-
title: "
|
|
652
|
-
"aria-label":
|
|
653
|
-
"Drag row to reorder. Or, press space or enter to start and stop reordering and esc to cancel.",
|
|
665
|
+
title: t("table.draghandle.tooltip"),
|
|
666
|
+
"aria-label": t("table.draghandle.arialabel"),
|
|
654
667
|
onKeyDown: (event) => handleDragHandleKeyDown({ table, row, event }),
|
|
655
668
|
onBlur: () => {
|
|
656
669
|
resetDraggingAndHoveredRow(table);
|
|
@@ -680,7 +693,7 @@ const DataTable = ({
|
|
|
680
693
|
endIcon={<MoreIcon />}
|
|
681
694
|
size="small"
|
|
682
695
|
buttonVariant="floating"
|
|
683
|
-
ariaLabel="
|
|
696
|
+
ariaLabel={t("table.moreactions.arialabel")}
|
|
684
697
|
menuAlignment="right"
|
|
685
698
|
>
|
|
686
699
|
{rowActionMenuItems && (
|
package/src/labs/index.ts
CHANGED
|
@@ -4,16 +4,33 @@ close.text = close
|
|
|
4
4
|
fielderror.screenreader.text = Error
|
|
5
5
|
fieldlabel.optional.text = Optional
|
|
6
6
|
fieldlabel.required.text = Required
|
|
7
|
-
|
|
7
|
+
filters.clear.label = Clear filters
|
|
8
|
+
filters.filter.any = Any
|
|
9
|
+
filters.filter.clear = Clear filter
|
|
10
|
+
filters.filters.arialabel = Filters
|
|
11
|
+
filters.menuitem.any = Any {{label}}
|
|
12
|
+
filters.menuitem.selected = {{selected}} selected
|
|
13
|
+
filters.search.label = Search
|
|
8
14
|
passwordfield.icon.label.hide = Hide password
|
|
15
|
+
passwordfield.icon.label.show = Show password
|
|
9
16
|
severity.error = error
|
|
10
17
|
severity.info = info
|
|
11
18
|
severity.success = success
|
|
12
19
|
severity.warning = warning
|
|
13
20
|
switch.active = Active
|
|
14
21
|
switch.inactive = Inactive
|
|
22
|
+
table.actions = Actions
|
|
23
|
+
table.columnvisibility.arialabel = Show/hide columns
|
|
24
|
+
table.density.arialabel = Table density
|
|
25
|
+
table.draghandle.arialabel = Drag row to reorder. Or, press space or enter to start and stop reordering and esc to cancel.
|
|
26
|
+
table.draghandle.tooltip = Drag row or press space/enter key to start and stop reordering
|
|
15
27
|
table.error = Error loading data.
|
|
16
28
|
table.fetchedrows.text = Fetched {{totalRows}} row
|
|
17
29
|
table.fetchedrows.text_plural = Fetched {{totalRows}} total rows
|
|
30
|
+
table.moreactions.arialabel = More actions
|
|
31
|
+
table.reorder.backward = Send backward
|
|
32
|
+
table.reorder.forward = Bring forward
|
|
33
|
+
table.reorder.toback = Send to back
|
|
34
|
+
table.reorder.tofront = Bring to front
|
|
18
35
|
table.rows.text = {{totalRows}} row
|
|
19
|
-
table.rows.text_plural = {{totalRows}} rows
|
|
36
|
+
table.rows.text_plural = {{totalRows}} rows
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const translation = {"breadcrumbs.home.text":"Home","breadcrumbs.label.text":"Breadcrumbs","close.text":"close","fielderror.screenreader.text":"Error","fieldlabel.optional.text":"Optional","fieldlabel.required.text":"Required","passwordfield.icon.label.
|
|
1
|
+
export const translation = {"breadcrumbs.home.text":"Home","breadcrumbs.label.text":"Breadcrumbs","close.text":"close","fielderror.screenreader.text":"Error","fieldlabel.optional.text":"Optional","fieldlabel.required.text":"Required","filters.clear.label":"Clear filters","filters.filter.any":"Any","filters.filter.clear":"Clear filter","filters.filters.arialabel":"Filters","filters.menuitem.any":"Any {{label}}","filters.menuitem.selected":"{{selected}} selected","filters.search.label":"Search","passwordfield.icon.label.hide":"Hide password","passwordfield.icon.label.show":"Show password","severity.error":"error","severity.info":"info","severity.success":"success","severity.warning":"warning","switch.active":"Active","switch.inactive":"Inactive","table.actions":"Actions","table.columnvisibility.arialabel":"Show/hide columns","table.density.arialabel":"Table density","table.draghandle.arialabel":"Drag row to reorder. Or, press space or enter to start and stop reordering and esc to cancel.","table.draghandle.tooltip":"Drag row or press space/enter key to start and stop reordering","table.error":"Error loading data.","table.fetchedrows.text":"Fetched {{totalRows}} row","table.fetchedrows.text_plural":"Fetched {{totalRows}} total rows","table.moreactions.arialabel":"More actions","table.reorder.backward":"Send backward","table.reorder.forward":"Bring forward","table.reorder.toback":"Send to back","table.reorder.tofront":"Bring to front","table.rows.text":"{{totalRows}} row","table.rows.text_plural":"{{totalRows}} rows"};
|
package/src/theme/components.tsx
CHANGED
|
@@ -809,7 +809,7 @@ export const components = ({
|
|
|
809
809
|
}),
|
|
810
810
|
},
|
|
811
811
|
|
|
812
|
-
"&.Mui-checked": {
|
|
812
|
+
"&.Mui-checked, &.MuiCheckbox-indeterminate": {
|
|
813
813
|
backgroundColor: odysseyTokens.PalettePrimaryMain,
|
|
814
814
|
borderColor: odysseyTokens.PalettePrimaryMain,
|
|
815
815
|
|
|
@@ -1993,6 +1993,9 @@ export const components = ({
|
|
|
1993
1993
|
},
|
|
1994
1994
|
},
|
|
1995
1995
|
MuiMenu: {
|
|
1996
|
+
defaultProps: {
|
|
1997
|
+
elevation: 2,
|
|
1998
|
+
},
|
|
1996
1999
|
styleOverrides: {
|
|
1997
2000
|
list: {
|
|
1998
2001
|
paddingBlock: odysseyTokens.Spacing2,
|
|
@@ -2015,7 +2018,7 @@ export const components = ({
|
|
|
2015
2018
|
minHeight: "unset",
|
|
2016
2019
|
paddingBlock: odysseyTokens.Spacing3,
|
|
2017
2020
|
paddingInline: odysseyTokens.Spacing4,
|
|
2018
|
-
borderRadius: odysseyTokens.
|
|
2021
|
+
borderRadius: odysseyTokens.BorderRadiusMain,
|
|
2019
2022
|
|
|
2020
2023
|
[`& .${formControlLabelClasses.root}`]: {
|
|
2021
2024
|
gap: "unset",
|
|
@@ -2043,6 +2046,14 @@ export const components = ({
|
|
|
2043
2046
|
},
|
|
2044
2047
|
},
|
|
2045
2048
|
|
|
2049
|
+
"&.isVisiblySelected": {
|
|
2050
|
+
backgroundColor: `${odysseyTokens.PalettePrimaryLighter} !important`,
|
|
2051
|
+
|
|
2052
|
+
[`& .${typographyClasses.root}`]: {
|
|
2053
|
+
color: odysseyTokens.HueBlue600,
|
|
2054
|
+
},
|
|
2055
|
+
},
|
|
2056
|
+
|
|
2046
2057
|
[`&.${menuItemClasses.selected}`]: {
|
|
2047
2058
|
backgroundColor: "transparent",
|
|
2048
2059
|
color: odysseyTokens.TypographyColorAction,
|
|
@@ -2517,12 +2528,14 @@ export const components = ({
|
|
|
2517
2528
|
|
|
2518
2529
|
[`.${tableHeadClasses.root} &`]: {
|
|
2519
2530
|
color: odysseyTokens.TypographyColorHeading,
|
|
2520
|
-
fontSize:
|
|
2531
|
+
fontSize: `0.71428571rem`,
|
|
2521
2532
|
lineHeight: odysseyTokens.TypographyLineHeightBody,
|
|
2522
2533
|
fontWeight: odysseyTokens.TypographyWeightBodyBold,
|
|
2523
2534
|
textTransform: "uppercase",
|
|
2524
2535
|
backgroundColor: odysseyTokens.HueNeutral50,
|
|
2525
2536
|
borderBottom: 0,
|
|
2537
|
+
height: `${odysseyTokens.Spacing7} !important`,
|
|
2538
|
+
paddingBlock: `${odysseyTokens.Spacing3} !important`,
|
|
2526
2539
|
},
|
|
2527
2540
|
|
|
2528
2541
|
[`.${tableHeadClasses.root} &:first-of-type`]: {
|
|
@@ -2535,10 +2548,11 @@ export const components = ({
|
|
|
2535
2548
|
borderBottomRightRadius: odysseyTokens.Spacing2,
|
|
2536
2549
|
},
|
|
2537
2550
|
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2551
|
+
[`.${tableHeadClasses.root} .ods-actions-cell + &:last-of-type, .${tableBodyClasses.root} .ods-actions-cell + &:last-of-type`]:
|
|
2552
|
+
{
|
|
2553
|
+
flexGrow: 0,
|
|
2554
|
+
width: odysseyTokens.Spacing2,
|
|
2555
|
+
},
|
|
2542
2556
|
|
|
2543
2557
|
...(ownerState.variant === "number" && {
|
|
2544
2558
|
textAlign: "end",
|
|
@@ -2571,14 +2585,21 @@ export const components = ({
|
|
|
2571
2585
|
textAlign: "justify",
|
|
2572
2586
|
}),
|
|
2573
2587
|
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2588
|
+
...(ownerState.variant !== "head" && {
|
|
2589
|
+
["&.MuiTableCell-compact"]: {
|
|
2590
|
+
// TODO: Find a way to tokenize these values.
|
|
2591
|
+
// We can't currently because these are between existing token
|
|
2592
|
+
// values, but we need these precise values to match design.
|
|
2593
|
+
// We use rems so this can scale with the text size.
|
|
2594
|
+
padding: "0.4285714286rem",
|
|
2595
|
+
height: "2.5714285714rem",
|
|
2596
|
+
},
|
|
2578
2597
|
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2598
|
+
["&.MuiTableCell-spacious"]: {
|
|
2599
|
+
padding: odysseyTokens.Spacing4,
|
|
2600
|
+
height: odysseyTokens.Spacing9,
|
|
2601
|
+
},
|
|
2602
|
+
}),
|
|
2582
2603
|
|
|
2583
2604
|
[`& .${checkboxClasses.root}`]: {
|
|
2584
2605
|
width: `${odysseyTokens.TypographyLineHeightUi}rem`,
|
|
@@ -2587,10 +2608,16 @@ export const components = ({
|
|
|
2587
2608
|
},
|
|
2588
2609
|
|
|
2589
2610
|
[`& .${dividerClasses.vertical}`]: {
|
|
2590
|
-
borderStyle: "none none none
|
|
2591
|
-
borderWidth:
|
|
2611
|
+
borderStyle: "none none none solid",
|
|
2612
|
+
borderWidth: 1,
|
|
2592
2613
|
borderRadius: 0,
|
|
2593
2614
|
marginRight: 2,
|
|
2615
|
+
borderColor: odysseyTokens.HueNeutral400,
|
|
2616
|
+
height: 18,
|
|
2617
|
+
},
|
|
2618
|
+
|
|
2619
|
+
["&.ods-drag-handle svg"]: {
|
|
2620
|
+
color: odysseyTokens.HueNeutral500,
|
|
2594
2621
|
},
|
|
2595
2622
|
}),
|
|
2596
2623
|
},
|