@okta/odyssey-react-mui 1.14.4 → 1.14.6
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 +8 -0
- package/dist/Badge.js +1 -1
- package/dist/Badge.js.map +1 -1
- package/dist/DataTable/DataTable.js +178 -58
- package/dist/DataTable/DataTable.js.map +1 -1
- package/dist/DataTable/DataTableEmptyState.js +55 -0
- package/dist/DataTable/DataTableEmptyState.js.map +1 -0
- package/dist/DataTable/DataTablePagination.js +221 -0
- package/dist/DataTable/DataTablePagination.js.map +1 -0
- package/dist/DataTable/DataTableRowActions.js +34 -24
- package/dist/DataTable/DataTableRowActions.js.map +1 -1
- package/dist/DataTable/DataTableSettings.js +22 -10
- package/dist/DataTable/DataTableSettings.js.map +1 -1
- package/dist/DataTable/constants.js +1 -0
- package/dist/DataTable/constants.js.map +1 -1
- package/dist/DataTable/index.js +1 -0
- package/dist/DataTable/index.js.map +1 -1
- package/dist/DataTable/useRowReordering.js +3 -3
- package/dist/DataTable/useRowReordering.js.map +1 -1
- package/dist/DataTable/useScrollIndication.js +70 -0
- package/dist/DataTable/useScrollIndication.js.map +1 -0
- package/dist/Field.js.map +1 -1
- package/dist/Fieldset.js +17 -14
- package/dist/Fieldset.js.map +1 -1
- package/dist/Form.js +33 -23
- package/dist/Form.js.map +1 -1
- package/dist/MenuButton.js +1 -1
- package/dist/MenuButton.js.map +1 -1
- package/dist/SearchField.js +2 -2
- package/dist/SearchField.js.map +1 -1
- package/dist/labs/DataFilters.js +6 -2
- package/dist/labs/DataFilters.js.map +1 -1
- package/dist/labs/DataTable.js +3 -3
- package/dist/labs/DataTable.js.map +1 -1
- package/dist/labs/FileUpload.js +195 -0
- package/dist/labs/FileUpload.js.map +1 -0
- package/dist/labs/FileUploadIllustration.js +54 -0
- package/dist/labs/FileUploadIllustration.js.map +1 -0
- package/dist/labs/FileUploadPreview.js +109 -0
- package/dist/labs/FileUploadPreview.js.map +1 -0
- package/dist/labs/index.js +1 -0
- package/dist/labs/index.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui.js +12 -0
- package/dist/properties/ts/odyssey-react-mui.js.map +1 -1
- package/dist/src/DataTable/DataTable.d.ts +36 -18
- package/dist/src/DataTable/DataTable.d.ts.map +1 -1
- package/dist/src/DataTable/DataTableEmptyState.d.ts +21 -0
- package/dist/src/DataTable/DataTableEmptyState.d.ts.map +1 -0
- package/dist/src/DataTable/DataTablePagination.d.ts +33 -0
- package/dist/src/DataTable/DataTablePagination.d.ts.map +1 -0
- package/dist/src/DataTable/DataTableRowActions.d.ts.map +1 -1
- package/dist/src/DataTable/DataTableSettings.d.ts.map +1 -1
- package/dist/src/DataTable/constants.d.ts +1 -0
- package/dist/src/DataTable/constants.d.ts.map +1 -1
- package/dist/src/DataTable/index.d.ts +2 -1
- package/dist/src/DataTable/index.d.ts.map +1 -1
- package/dist/src/DataTable/useRowReordering.d.ts.map +1 -1
- package/dist/src/DataTable/useScrollIndication.d.ts +22 -0
- package/dist/src/DataTable/useScrollIndication.d.ts.map +1 -0
- package/dist/src/Field.d.ts +8 -7
- package/dist/src/Field.d.ts.map +1 -1
- package/dist/src/Fieldset.d.ts.map +1 -1
- package/dist/src/Form.d.ts.map +1 -1
- package/dist/src/OdysseyTranslationProvider.d.ts +1 -1
- package/dist/src/OdysseyTranslationProvider.d.ts.map +1 -1
- package/dist/src/SearchField.d.ts.map +1 -1
- package/dist/src/labs/DataFilters.d.ts +5 -1
- package/dist/src/labs/DataFilters.d.ts.map +1 -1
- package/dist/src/labs/DataTable.d.ts.map +1 -1
- package/dist/src/labs/FileUpload.d.ts +40 -0
- package/dist/src/labs/FileUpload.d.ts.map +1 -0
- package/dist/src/labs/FileUploadIllustration.d.ts +15 -0
- package/dist/src/labs/FileUploadIllustration.d.ts.map +1 -0
- package/dist/src/labs/FileUploadPreview.d.ts +21 -0
- package/dist/src/labs/FileUploadPreview.d.ts.map +1 -0
- package/dist/src/labs/index.d.ts +4 -0
- package/dist/src/labs/index.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui.d.ts +12 -0
- 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 +10 -1
- package/dist/theme/components.js.map +1 -1
- package/dist/tsconfig.production.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/Badge.tsx +1 -1
- package/src/DataTable/DataTable.tsx +293 -85
- package/src/DataTable/DataTableEmptyState.tsx +62 -0
- package/src/DataTable/DataTablePagination.tsx +289 -0
- package/src/DataTable/DataTableRowActions.tsx +35 -37
- package/src/DataTable/DataTableSettings.tsx +43 -17
- package/src/DataTable/constants.ts +1 -0
- package/src/DataTable/index.tsx +7 -1
- package/src/DataTable/useRowReordering.tsx +5 -3
- package/src/DataTable/useScrollIndication.tsx +118 -0
- package/src/Field.tsx +9 -7
- package/src/Fieldset.tsx +24 -18
- package/src/Form.tsx +43 -27
- package/src/MenuButton.tsx +1 -1
- package/src/SearchField.tsx +1 -2
- package/src/labs/DataFilters.tsx +9 -0
- package/src/labs/DataTable.tsx +5 -9
- package/src/labs/FileUpload.tsx +301 -0
- package/src/labs/FileUploadIllustration.tsx +66 -0
- package/src/labs/FileUploadPreview.tsx +150 -0
- package/src/labs/index.ts +4 -2
- package/src/properties/odyssey-react-mui.properties +18 -0
- package/src/properties/ts/odyssey-react-mui.ts +1 -1
- package/src/theme/components.tsx +9 -0
|
@@ -0,0 +1,150 @@
|
|
|
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 { memo, useCallback } from "react";
|
|
14
|
+
import styled from "@emotion/styled";
|
|
15
|
+
import { IconButton } from "@mui/material";
|
|
16
|
+
import { useTranslation } from "react-i18next";
|
|
17
|
+
|
|
18
|
+
import { FileUploadProps } from "./FileUpload";
|
|
19
|
+
import {
|
|
20
|
+
useOdysseyDesignTokens,
|
|
21
|
+
DesignTokens,
|
|
22
|
+
} from "../OdysseyDesignTokensContext";
|
|
23
|
+
import { DeleteIcon } from "../icons.generated";
|
|
24
|
+
import { MuiPropsContext, MuiPropsContextType } from "../MuiPropsContext";
|
|
25
|
+
import { Tooltip } from "../Tooltip";
|
|
26
|
+
|
|
27
|
+
const PreviewContainer = styled.div<{
|
|
28
|
+
isDisabled: FileUploadProps["isDisabled"];
|
|
29
|
+
odysseyDesignTokens: DesignTokens;
|
|
30
|
+
}>(({ isDisabled, odysseyDesignTokens }) => ({
|
|
31
|
+
color: isDisabled ? odysseyDesignTokens.TypographyColorDisabled : "inherit",
|
|
32
|
+
marginBlockStart: odysseyDesignTokens.Spacing2,
|
|
33
|
+
pointerEvents: isDisabled ? "none" : "auto",
|
|
34
|
+
}));
|
|
35
|
+
|
|
36
|
+
const UploadedFileContainer = styled.div<{ odysseyDesignTokens: DesignTokens }>(
|
|
37
|
+
{
|
|
38
|
+
display: "flex",
|
|
39
|
+
justifyContent: "space-between",
|
|
40
|
+
alignItems: "center",
|
|
41
|
+
|
|
42
|
+
button: {
|
|
43
|
+
transform: "scale(0)",
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
"&:hover, &:focus-within, &:focus": {
|
|
47
|
+
button: {
|
|
48
|
+
transform: "scale(1)",
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
({ odysseyDesignTokens }) => ({
|
|
53
|
+
padding: `${odysseyDesignTokens.Spacing1} ${odysseyDesignTokens.Spacing2}`,
|
|
54
|
+
borderRadius: odysseyDesignTokens.BorderRadiusMain,
|
|
55
|
+
transition: `background-color ${odysseyDesignTokens.TransitionTimingMain}`,
|
|
56
|
+
|
|
57
|
+
"&:hover, &:focus-within": {
|
|
58
|
+
backgroundColor: odysseyDesignTokens.HueNeutral100,
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
"&:focus": {
|
|
62
|
+
borderColor: odysseyDesignTokens.FocusOutlineColorPrimary,
|
|
63
|
+
boxShadow: `0 0 0 2px ${odysseyDesignTokens.FocusOutlineColorPrimary}`,
|
|
64
|
+
outline: `${odysseyDesignTokens.FocusOutlineWidthMain} ${odysseyDesignTokens.FocusOutlineStyle} transparent`,
|
|
65
|
+
},
|
|
66
|
+
}),
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
type UploadedFileProps = {
|
|
70
|
+
name: string;
|
|
71
|
+
onFileRemove?: (name: string) => void;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const UploadedFile = ({ name, onFileRemove }: UploadedFileProps) => {
|
|
75
|
+
const { t } = useTranslation();
|
|
76
|
+
const odysseyDesignTokens = useOdysseyDesignTokens();
|
|
77
|
+
|
|
78
|
+
const deleteHandler = useCallback(() => {
|
|
79
|
+
onFileRemove?.(name);
|
|
80
|
+
}, [onFileRemove, name]);
|
|
81
|
+
|
|
82
|
+
const renderDeleteButton = useCallback(
|
|
83
|
+
(muiProps: MuiPropsContextType) => {
|
|
84
|
+
return (
|
|
85
|
+
<IconButton
|
|
86
|
+
{...muiProps}
|
|
87
|
+
aria-label={t("fileupload.removefile.text")}
|
|
88
|
+
onClick={deleteHandler}
|
|
89
|
+
size="small"
|
|
90
|
+
>
|
|
91
|
+
<DeleteIcon />
|
|
92
|
+
</IconButton>
|
|
93
|
+
);
|
|
94
|
+
},
|
|
95
|
+
[deleteHandler, t],
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<UploadedFileContainer
|
|
100
|
+
// tabindex added to make this element focusable
|
|
101
|
+
tabIndex={0}
|
|
102
|
+
odysseyDesignTokens={odysseyDesignTokens}
|
|
103
|
+
>
|
|
104
|
+
{name}
|
|
105
|
+
<Tooltip
|
|
106
|
+
ariaType="description"
|
|
107
|
+
placement="top"
|
|
108
|
+
text={t("fileupload.removefile.text")}
|
|
109
|
+
>
|
|
110
|
+
<MuiPropsContext.Consumer>
|
|
111
|
+
{renderDeleteButton}
|
|
112
|
+
</MuiPropsContext.Consumer>
|
|
113
|
+
</Tooltip>
|
|
114
|
+
</UploadedFileContainer>
|
|
115
|
+
);
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
type FileUploadPreviewProps = {
|
|
119
|
+
fileNames: string[];
|
|
120
|
+
isDisabled: FileUploadProps["isDisabled"];
|
|
121
|
+
onFileRemove?: (name: string) => void;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const FileUploadPreview = ({
|
|
125
|
+
fileNames,
|
|
126
|
+
isDisabled,
|
|
127
|
+
onFileRemove,
|
|
128
|
+
}: FileUploadPreviewProps) => {
|
|
129
|
+
const odysseyDesignTokens = useOdysseyDesignTokens();
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<PreviewContainer
|
|
133
|
+
isDisabled={isDisabled}
|
|
134
|
+
odysseyDesignTokens={odysseyDesignTokens}
|
|
135
|
+
>
|
|
136
|
+
{fileNames?.map((name, index) => (
|
|
137
|
+
<UploadedFile
|
|
138
|
+
key={`${index}-${name}`}
|
|
139
|
+
onFileRemove={onFileRemove}
|
|
140
|
+
name={name}
|
|
141
|
+
/>
|
|
142
|
+
))}
|
|
143
|
+
</PreviewContainer>
|
|
144
|
+
);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const MemoizedFileUploadPreview = memo(FileUploadPreview);
|
|
148
|
+
MemoizedFileUploadPreview.displayName = "FileUploadPreview";
|
|
149
|
+
|
|
150
|
+
export { MemoizedFileUploadPreview as FileUploadPreview };
|
package/src/labs/index.ts
CHANGED
|
@@ -17,13 +17,15 @@ export type { LocalizationProviderProps } from "@mui/x-date-pickers";
|
|
|
17
17
|
export * from "./DatePicker";
|
|
18
18
|
export * from "./datePickerTheme";
|
|
19
19
|
|
|
20
|
+
/** @deprecated Will be removed in a future Odyssey version in lieu of the one shipping with DataTable */
|
|
20
21
|
export * from "./DataTablePagination";
|
|
21
22
|
export * from "./DataFilters";
|
|
22
|
-
|
|
23
23
|
export * from "./Drawer";
|
|
24
|
-
|
|
24
|
+
export * from "./FileUpload";
|
|
25
25
|
export * from "./materialReactTableTypes";
|
|
26
|
+
/** @deprecated Will be removed in a future Odyssey version in lieu of DataTable */
|
|
26
27
|
export * from "./StaticTable";
|
|
28
|
+
/** @deprecated Will be removed in a future Odyssey version in lieu of DataTable */
|
|
27
29
|
export * from "./PaginatedTable";
|
|
28
30
|
|
|
29
31
|
export * from "./GroupPicker";
|
|
@@ -11,6 +11,10 @@ filters.filters.arialabel = Filters
|
|
|
11
11
|
filters.menuitem.any = Any {{label}}
|
|
12
12
|
filters.menuitem.selected = {{selected}} selected
|
|
13
13
|
filters.search.label = Search
|
|
14
|
+
fileupload.button.text = Add files
|
|
15
|
+
fileupload.prompt.text = Drag and drop files here or click to add files
|
|
16
|
+
fileupload.removefile.text = Remove file
|
|
17
|
+
passwordfield.icon.label.hide = Hide password
|
|
14
18
|
passwordfield.icon.label.hide = Hide password
|
|
15
19
|
passwordfield.icon.label.show = Show password
|
|
16
20
|
severity.error = error
|
|
@@ -24,10 +28,24 @@ table.columnvisibility.arialabel = Show/hide columns
|
|
|
24
28
|
table.density.arialabel = Table density
|
|
25
29
|
table.draghandle.arialabel = Drag row to reorder. Or, press space or enter to start and stop reordering and esc to cancel.
|
|
26
30
|
table.draghandle.tooltip = Drag row or press space/enter key to start and stop reordering
|
|
31
|
+
table.actions = Actions
|
|
32
|
+
table.columnvisibility.arialabel = Show/hide columns
|
|
33
|
+
table.density.arialabel = Table density
|
|
34
|
+
table.draghandle.arialabel = Drag row to reorder. Or, press space or enter to start and stop reordering and esc to cancel.
|
|
35
|
+
table.draghandle.tooltip = Drag row or press space/enter key to start and stop reordering
|
|
27
36
|
table.error = Error loading data.
|
|
28
37
|
table.fetchedrows.text = Fetched {{totalRows}} row
|
|
29
38
|
table.fetchedrows.text_plural = Fetched {{totalRows}} total rows
|
|
30
39
|
table.moreactions.arialabel = More actions
|
|
40
|
+
table.noresults.heading = There are no results.
|
|
41
|
+
table.noresults.text = Try a different query.
|
|
42
|
+
table.pagination.loadmore = Show more
|
|
43
|
+
table.pagination.next = Next page
|
|
44
|
+
table.pagination.previous = Previous page
|
|
45
|
+
table.pagination.page = Page
|
|
46
|
+
table.pagination.rowsperpage = Rows per page
|
|
47
|
+
table.pagination.rowswithtotal = {{firstRow}}-{{lastRow}} of {{totalRows}} rows
|
|
48
|
+
table.pagination.rowswithouttotal = {{firstRow}}-{{lastRow}} rows
|
|
31
49
|
table.reorder.backward = Send backward
|
|
32
50
|
table.reorder.forward = Bring forward
|
|
33
51
|
table.reorder.toback = Send to back
|
|
@@ -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","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"};
|
|
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","fileupload.button.text":"Add files","fileupload.prompt.text":"Drag and drop files here or click to add files","fileupload.removefile.text":"Remove file","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.noresults.heading":"There are no results.","table.noresults.text":"Try a different query.","table.pagination.loadmore":"Show more","table.pagination.next":"Next page","table.pagination.previous":"Previous page","table.pagination.page":"Page","table.pagination.rowsperpage":"Rows per page","table.pagination.rowswithtotal":"{{firstRow}}-{{lastRow}} of {{totalRows}} rows","table.pagination.rowswithouttotal":"{{firstRow}}-{{lastRow}} rows","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
|
@@ -1698,6 +1698,15 @@ export const components = ({
|
|
|
1698
1698
|
styleOverrides: {
|
|
1699
1699
|
root: {
|
|
1700
1700
|
padding: odysseyTokens.Spacing1,
|
|
1701
|
+
borderRadius: odysseyTokens.BorderRadiusMain,
|
|
1702
|
+
"&:hover": {
|
|
1703
|
+
backgroundColor: odysseyTokens.HueNeutral100,
|
|
1704
|
+
},
|
|
1705
|
+
"&:focus-visible": {
|
|
1706
|
+
boxShadow: `0 0 0 2px ${odysseyTokens.HueNeutralWhite}, 0 0 0 4px ${odysseyTokens.PalettePrimaryMain}`,
|
|
1707
|
+
outline: "2px solid transparent",
|
|
1708
|
+
outlineOffset: "1px",
|
|
1709
|
+
},
|
|
1701
1710
|
},
|
|
1702
1711
|
},
|
|
1703
1712
|
},
|