@terraware/web-components 3.9.10 → 3.9.12
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/components/AntSwitch/styles.scss +3 -3
- package/components/Autocomplete/styles.scss +52 -52
- package/components/Button/styles.scss +141 -141
- package/components/DatePicker/styles.scss +31 -31
- package/components/DialogBox/styles.scss +35 -35
- package/components/EditableTable/index.d.ts +86 -0
- package/components/EditableTable/index.d.ts.map +1 -0
- package/components/EditableTable/index.js +179 -0
- package/components/ErrorBox/styles.scss +16 -16
- package/components/Icon/styles.scss +9 -9
- package/components/Map/styles.scss +20 -20
- package/components/Markdown/styles.scss +37 -37
- package/components/Message/styles.scss +63 -63
- package/components/MultiSelect/styles.scss +66 -66
- package/components/Navbar/styles.scss +39 -39
- package/components/Pill/styles.scss +10 -10
- package/components/PillList/styles.scss +2 -2
- package/components/PopoverMultiSelect/styles.scss +4 -4
- package/components/ProgressCircle/styles.scss +24 -24
- package/components/Select/styles.scss +107 -107
- package/components/Textfield/styles.scss +108 -108
- package/components/TimelineSlider/styles.scss +18 -18
- package/components/ViewPhotosDialog/styles.scss +3 -3
- package/license-report.html +1 -1
- package/package.json +2 -1
- package/stories/EditableTable.stories.d.ts +14 -0
- package/stories/EditableTable.stories.d.ts.map +1 -0
- package/style-dictionary-dist/terraware.scss +2 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@
|
|
1
|
+
@use '../../style-dictionary-dist/terraware.scss';
|
|
2
2
|
|
|
3
3
|
@font-face {
|
|
4
4
|
font-family: 'Inter';
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
inset: 0px;
|
|
16
16
|
|
|
17
17
|
&--skrim {
|
|
18
|
-
background-color: rgba(
|
|
18
|
+
background-color: rgba(terraware.$tw-clr-base-gray-025, terraware.$tw-opcty-base-060);
|
|
19
19
|
background-image: linear-gradient(
|
|
20
20
|
180deg,
|
|
21
|
-
rgba(
|
|
22
|
-
rgba(
|
|
21
|
+
rgba(terraware.$tw-clr-base-green-050, terraware.$tw-opcty-base-000),
|
|
22
|
+
rgba(terraware.$tw-clr-base-green-050, 0.24)
|
|
23
23
|
);
|
|
24
24
|
height: 100%;
|
|
25
25
|
display: flex;
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
&.mobile {
|
|
34
|
-
margin: 0
|
|
34
|
+
margin: 0 terraware.$tw-spc-base-small;
|
|
35
35
|
.dialog-box {
|
|
36
36
|
&--footer {
|
|
37
37
|
button {
|
|
38
|
-
margin: 0 0
|
|
38
|
+
margin: 0 0 terraware.$tw-spc-base-x-small 0;
|
|
39
39
|
}
|
|
40
40
|
&-container {
|
|
41
41
|
flex-direction: column;
|
|
@@ -54,11 +54,11 @@
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
.dialog-box {
|
|
57
|
-
box-shadow:
|
|
58
|
-
border-radius:
|
|
57
|
+
box-shadow: terraware.$tw-elvtn-base-800;
|
|
58
|
+
border-radius: terraware.$tw-sz-base-small;
|
|
59
59
|
display: flex;
|
|
60
60
|
flex-direction: column;
|
|
61
|
-
background:
|
|
61
|
+
background: terraware.$tw-clr-base-white;
|
|
62
62
|
max-height: calc(100vh - 128px); //64 from top and bottom
|
|
63
63
|
max-width: calc(100vw - 32px);
|
|
64
64
|
margin-top: auto;
|
|
@@ -85,42 +85,42 @@
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
&--header {
|
|
88
|
-
border-bottom: 1px solid
|
|
89
|
-
padding:
|
|
88
|
+
border-bottom: 1px solid terraware.$tw-clr-brdr-tertiary;
|
|
89
|
+
padding: terraware.$tw-spc-base-small terraware.$tw-spc-base-medium;
|
|
90
90
|
display: flex;
|
|
91
91
|
justify-content: space-between;
|
|
92
92
|
align-items: center;
|
|
93
|
-
border-radius:
|
|
93
|
+
border-radius: terraware.$tw-sz-base-small terraware.$tw-sz-base-small 0 0;
|
|
94
94
|
.title {
|
|
95
|
-
font-family:
|
|
96
|
-
font-size:
|
|
97
|
-
font-weight:
|
|
98
|
-
line-height:
|
|
99
|
-
color:
|
|
95
|
+
font-family: terraware.$tw-fnt-dlg-bx-title-font-family;
|
|
96
|
+
font-size: terraware.$tw-fnt-dlg-bx-title-font-size;
|
|
97
|
+
font-weight: terraware.$tw-fnt-dlg-bx-title-font-weight;
|
|
98
|
+
line-height: terraware.$tw-fnt-dlg-bx-title-line-height;
|
|
99
|
+
color: terraware.$tw-clr-txt;
|
|
100
100
|
text-align: center;
|
|
101
101
|
margin: 0;
|
|
102
102
|
width: 100%;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
.icon-close {
|
|
106
|
-
fill:
|
|
107
|
-
height:
|
|
108
|
-
width:
|
|
106
|
+
fill: terraware.$tw-clr-icn-secondary;
|
|
107
|
+
height: terraware.$tw-sz-base-medium;
|
|
108
|
+
width: terraware.$tw-sz-base-medium;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
.MuiButtonBase-root {
|
|
112
|
-
padding:
|
|
112
|
+
padding: terraware.$tw-spc-base-xx-small;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
.close-icon-spacer {
|
|
116
|
-
height: calc(#{
|
|
117
|
-
width: calc(#{
|
|
116
|
+
height: calc(#{terraware.$tw-sz-base-medium} + 2 *#{terraware.$tw-spc-base-xx-small});
|
|
117
|
+
width: calc(#{terraware.$tw-sz-base-medium} + 2 *#{terraware.$tw-spc-base-xx-small});
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
&--body {
|
|
122
|
-
background:
|
|
123
|
-
padding:
|
|
122
|
+
background: terraware.$tw-clr-base-white;
|
|
123
|
+
padding: terraware.$tw-spc-base-medium;
|
|
124
124
|
text-align: center;
|
|
125
125
|
&.scrolled {
|
|
126
126
|
overflow: auto;
|
|
@@ -128,28 +128,28 @@
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
&--body-no-footer {
|
|
131
|
-
padding:
|
|
131
|
+
padding: terraware.$tw-spc-base-medium;
|
|
132
132
|
&.scrolled {
|
|
133
133
|
overflow: auto;
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
&--message {
|
|
138
|
-
font-family:
|
|
139
|
-
font-size:
|
|
140
|
-
font-weight:
|
|
141
|
-
line-height:
|
|
142
|
-
color:
|
|
138
|
+
font-family: terraware.$tw-fnt-dlg-bx-message-font-family;
|
|
139
|
+
font-size: terraware.$tw-fnt-dlg-bx-message-font-size;
|
|
140
|
+
font-weight: terraware.$tw-fnt-dlg-bx-message-font-weight;
|
|
141
|
+
line-height: terraware.$tw-fnt-dlg-bx-message-line-height;
|
|
142
|
+
color: terraware.$tw-clr-txt;
|
|
143
143
|
width: 100%;
|
|
144
144
|
text-align: center;
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
&--footer {
|
|
148
|
-
border-radius: 0 0
|
|
149
|
-
background-color:
|
|
150
|
-
padding:
|
|
148
|
+
border-radius: 0 0 terraware.$tw-sz-base-small terraware.$tw-sz-base-small;
|
|
149
|
+
background-color: terraware.$tw-clr-bg-secondary;
|
|
150
|
+
padding: terraware.$tw-spc-base-medium terraware.$tw-spc-base-medium;
|
|
151
151
|
button + button {
|
|
152
|
-
margin-left:
|
|
152
|
+
margin-left: terraware.$tw-spc-base-x-small;
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { MRT_Cell, MRT_Column, MRT_Row, MRT_TableInstance, MRT_TableOptions } from 'material-react-table';
|
|
3
|
+
export type ColumnEditConfig<TData extends Record<string, any>> = {
|
|
4
|
+
/** Function to call when a cell value is saved (on blur) */
|
|
5
|
+
onSave?: (row: TData, value: any, columnId: string) => void | Promise<void>;
|
|
6
|
+
/** Edit variant: 'text' (default), 'select', or 'custom' */
|
|
7
|
+
editVariant?: 'text' | 'select' | 'custom';
|
|
8
|
+
/** Options for select variant */
|
|
9
|
+
selectOptions?: {
|
|
10
|
+
label: string;
|
|
11
|
+
value: string | number;
|
|
12
|
+
}[];
|
|
13
|
+
/** Custom edit component */
|
|
14
|
+
customEditComponent?: (props: {
|
|
15
|
+
cell: MRT_Cell<TData>;
|
|
16
|
+
row: MRT_Row<TData>;
|
|
17
|
+
column: MRT_Column<TData>;
|
|
18
|
+
table: MRT_TableInstance<TData>;
|
|
19
|
+
}) => JSX.Element;
|
|
20
|
+
};
|
|
21
|
+
export type EditableTableColumn<TData extends Record<string, any>> = {
|
|
22
|
+
id: string;
|
|
23
|
+
/** Column header text */
|
|
24
|
+
header: string;
|
|
25
|
+
/** Key to access data in row object */
|
|
26
|
+
accessorKey?: keyof TData;
|
|
27
|
+
/** Custom accessor function for computed values */
|
|
28
|
+
accessorFn?: (row: TData) => any;
|
|
29
|
+
/** Width of the column in pixels */
|
|
30
|
+
size?: number;
|
|
31
|
+
/** Whether the column is editable. Can be a boolean or a function that receives the row and returns a boolean */
|
|
32
|
+
enableEditing?: boolean | ((row: MRT_Row<TData>) => boolean);
|
|
33
|
+
/** Whether the column can be hidden */
|
|
34
|
+
enableHiding?: boolean;
|
|
35
|
+
/** Edit configuration for this column */
|
|
36
|
+
editConfig?: ColumnEditConfig<TData>;
|
|
37
|
+
/** Custom cell renderer */
|
|
38
|
+
Cell?: (props: {
|
|
39
|
+
cell: MRT_Cell<TData>;
|
|
40
|
+
row: MRT_Row<TData>;
|
|
41
|
+
}) => JSX.Element | null;
|
|
42
|
+
/** Filter variant: 'text', 'select', 'multi-select', 'range', 'date-range' */
|
|
43
|
+
filterVariant?: 'text' | 'select' | 'multi-select' | 'range' | 'date-range';
|
|
44
|
+
/** Options for select/multi-select filters */
|
|
45
|
+
filterSelectOptions?: string[];
|
|
46
|
+
/** Custom filter function */
|
|
47
|
+
filterFn?: 'fuzzy' | 'between' | 'arrIncludesSome' | ((row: TData, columnId: string, filterValue: any) => boolean);
|
|
48
|
+
};
|
|
49
|
+
export type EditableTableProps<TData extends Record<string, any>> = {
|
|
50
|
+
/** Array of column definitions */
|
|
51
|
+
columns: EditableTableColumn<TData>[];
|
|
52
|
+
/** Array of data rows */
|
|
53
|
+
data: TData[];
|
|
54
|
+
/** Whether to enable editing (default: false) */
|
|
55
|
+
enableEditing?: boolean;
|
|
56
|
+
/** Whether to enable column ordering (default: false) */
|
|
57
|
+
enableColumnOrdering?: boolean;
|
|
58
|
+
/** Whether to enable column pinning (default: false) */
|
|
59
|
+
enableColumnPinning?: boolean;
|
|
60
|
+
/** Whether to enable sorting (default: true) */
|
|
61
|
+
enableSorting?: boolean;
|
|
62
|
+
/** Whether to enable global filter/search (default: false) */
|
|
63
|
+
enableGlobalFilter?: boolean;
|
|
64
|
+
/** Whether to enable column filters (default: false) */
|
|
65
|
+
enableColumnFilters?: boolean;
|
|
66
|
+
/** Whether to enable pagination (default: true) */
|
|
67
|
+
enablePagination?: boolean;
|
|
68
|
+
/** Whether to show the bottom toolbar (default: true) */
|
|
69
|
+
enableBottomToolbar?: boolean;
|
|
70
|
+
/** Whether to show the top toolbar (default: true) */
|
|
71
|
+
enableTopToolbar?: boolean;
|
|
72
|
+
initialSorting?: {
|
|
73
|
+
id: string;
|
|
74
|
+
desc: boolean;
|
|
75
|
+
}[];
|
|
76
|
+
/** Callback when a row is clicked */
|
|
77
|
+
onRowClick?: (row: TData) => void;
|
|
78
|
+
/** Custom toolbar actions */
|
|
79
|
+
renderToolbarInternalActions?: (props: {
|
|
80
|
+
table: MRT_TableInstance<TData>;
|
|
81
|
+
}) => JSX.Element;
|
|
82
|
+
/** Additional MRT table options to override defaults */
|
|
83
|
+
tableOptions?: Partial<MRT_TableOptions<TData>>;
|
|
84
|
+
};
|
|
85
|
+
export default function EditableTable<TData extends Record<string, any>>({ columns, data, enableEditing, enableColumnOrdering, enableColumnPinning, enableSorting, enableGlobalFilter, enableColumnFilters, enablePagination, enableBottomToolbar, enableTopToolbar, initialSorting, onRowClick, renderToolbarInternalActions, tableOptions, }: EditableTableProps<TData>): JSX.Element;
|
|
86
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/EditableTable/index.tsx"],"names":[],"mappings":";AAGA,OAAO,EAEL,QAAQ,EACR,UAAU,EAEV,OAAO,EACP,iBAAiB,EACjB,gBAAgB,EAEjB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,MAAM,gBAAgB,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI;IAChE,4DAA4D;IAC5D,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5E,4DAA4D;IAC5D,WAAW,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC3C,iCAAiC;IACjC,aAAa,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,EAAE,CAAC;IAC5D,4BAA4B;IAC5B,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE;QAC5B,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;QACtB,GAAG,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;QACpB,MAAM,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;QAC1B,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC,CAAC;KACjC,KAAK,GAAG,CAAC,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,mBAAmB,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI;IACnE,EAAE,EAAE,MAAM,CAAC;IACX,yBAAyB;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,WAAW,CAAC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
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = EditableTable;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _material = require("@mui/material");
|
|
10
|
+
var _materialReactTable = require("material-react-table");
|
|
11
|
+
function EditableTable(_ref) {
|
|
12
|
+
let {
|
|
13
|
+
columns,
|
|
14
|
+
data,
|
|
15
|
+
enableEditing = false,
|
|
16
|
+
enableColumnOrdering = false,
|
|
17
|
+
enableColumnPinning = false,
|
|
18
|
+
enableSorting = true,
|
|
19
|
+
enableGlobalFilter = false,
|
|
20
|
+
enableColumnFilters = false,
|
|
21
|
+
enablePagination = true,
|
|
22
|
+
enableBottomToolbar = true,
|
|
23
|
+
enableTopToolbar = true,
|
|
24
|
+
initialSorting,
|
|
25
|
+
onRowClick,
|
|
26
|
+
renderToolbarInternalActions,
|
|
27
|
+
tableOptions = {}
|
|
28
|
+
} = _ref;
|
|
29
|
+
const theme = (0, _material.useTheme)();
|
|
30
|
+
|
|
31
|
+
// Convert simplified column definitions to MRT column definitions
|
|
32
|
+
const mrtColumns = (0, _react.useMemo)(() => {
|
|
33
|
+
return columns.map(col => {
|
|
34
|
+
var _col$enableEditing, _col$enableHiding;
|
|
35
|
+
const mrtCol = {
|
|
36
|
+
id: col.id,
|
|
37
|
+
header: col.header,
|
|
38
|
+
accessorKey: col.accessorKey,
|
|
39
|
+
accessorFn: col.accessorFn,
|
|
40
|
+
size: col.size,
|
|
41
|
+
enableEditing: (_col$enableEditing = col.enableEditing) !== null && _col$enableEditing !== void 0 ? _col$enableEditing : enableEditing,
|
|
42
|
+
enableHiding: (_col$enableHiding = col.enableHiding) !== null && _col$enableHiding !== void 0 ? _col$enableHiding : true,
|
|
43
|
+
Cell: col.Cell,
|
|
44
|
+
filterVariant: col.filterVariant,
|
|
45
|
+
filterSelectOptions: col.filterSelectOptions,
|
|
46
|
+
filterFn: col.filterFn,
|
|
47
|
+
enableColumnFilter: col.filterVariant !== undefined
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// Handle edit configuration
|
|
51
|
+
if (col.editConfig) {
|
|
52
|
+
const {
|
|
53
|
+
editVariant = 'text',
|
|
54
|
+
selectOptions,
|
|
55
|
+
customEditComponent,
|
|
56
|
+
onSave
|
|
57
|
+
} = col.editConfig;
|
|
58
|
+
if (editVariant === 'custom' && customEditComponent) {
|
|
59
|
+
mrtCol.Edit = customEditComponent;
|
|
60
|
+
} else if (editVariant === 'select' && selectOptions) {
|
|
61
|
+
mrtCol.editVariant = 'select';
|
|
62
|
+
mrtCol.editSelectOptions = selectOptions;
|
|
63
|
+
const SelectEditComponent = _ref2 => {
|
|
64
|
+
let {
|
|
65
|
+
cell,
|
|
66
|
+
row,
|
|
67
|
+
table: iTable
|
|
68
|
+
} = _ref2;
|
|
69
|
+
const [value, setValue] = _react.default.useState(cell.getValue() || '');
|
|
70
|
+
const handleSave = (0, _react.useCallback)(() => {
|
|
71
|
+
if (onSave) {
|
|
72
|
+
void onSave(row.original, value, col.id);
|
|
73
|
+
}
|
|
74
|
+
iTable.setEditingCell(null);
|
|
75
|
+
}, [value]);
|
|
76
|
+
return /*#__PURE__*/_react.default.createElement(_material.TextField, {
|
|
77
|
+
select: true,
|
|
78
|
+
value: value,
|
|
79
|
+
onChange: e => setValue(e.target.value),
|
|
80
|
+
onBlur: handleSave,
|
|
81
|
+
onKeyDown: e => {
|
|
82
|
+
if (e.key === 'Enter') {
|
|
83
|
+
handleSave();
|
|
84
|
+
} else if (e.key === 'Escape') {
|
|
85
|
+
iTable.setEditingCell(null);
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
size: "small",
|
|
89
|
+
fullWidth: true
|
|
90
|
+
}, selectOptions.map(option => /*#__PURE__*/_react.default.createElement(_material.MenuItem, {
|
|
91
|
+
key: option.value,
|
|
92
|
+
value: option.value
|
|
93
|
+
}, option.label)));
|
|
94
|
+
};
|
|
95
|
+
mrtCol.Edit = SelectEditComponent;
|
|
96
|
+
} else {
|
|
97
|
+
// Default text input with onBlur save
|
|
98
|
+
mrtCol.muiEditTextFieldProps = _ref3 => {
|
|
99
|
+
let {
|
|
100
|
+
row
|
|
101
|
+
} = _ref3;
|
|
102
|
+
return {
|
|
103
|
+
onBlur: event => {
|
|
104
|
+
if (onSave) {
|
|
105
|
+
const value = event.target.value;
|
|
106
|
+
void onSave(row.original, value, col.id);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return mrtCol;
|
|
114
|
+
});
|
|
115
|
+
}, [columns, enableEditing]);
|
|
116
|
+
const initialStateConfig = {
|
|
117
|
+
...(initialSorting ? {
|
|
118
|
+
sorting: initialSorting
|
|
119
|
+
} : {}),
|
|
120
|
+
...(enableColumnFilters ? {
|
|
121
|
+
showColumnFilters: true
|
|
122
|
+
} : {}),
|
|
123
|
+
...(enableGlobalFilter ? {
|
|
124
|
+
showGlobalFilter: true
|
|
125
|
+
} : {})
|
|
126
|
+
};
|
|
127
|
+
const table = (0, _materialReactTable.useMaterialReactTable)({
|
|
128
|
+
columns: mrtColumns,
|
|
129
|
+
data,
|
|
130
|
+
editDisplayMode: 'cell',
|
|
131
|
+
enableColumnOrdering,
|
|
132
|
+
enableColumnPinning,
|
|
133
|
+
enableEditing,
|
|
134
|
+
enableSorting,
|
|
135
|
+
enableGlobalFilter,
|
|
136
|
+
enableColumnFilters,
|
|
137
|
+
enableFilters: enableColumnFilters || enableGlobalFilter,
|
|
138
|
+
enablePagination,
|
|
139
|
+
enableBottomToolbar: enablePagination ? enableBottomToolbar : false,
|
|
140
|
+
enableTopToolbar,
|
|
141
|
+
positionGlobalFilter: enableGlobalFilter ? 'left' : undefined,
|
|
142
|
+
...(Object.keys(initialStateConfig).length > 0 ? {
|
|
143
|
+
initialState: initialStateConfig
|
|
144
|
+
} : {}),
|
|
145
|
+
renderToolbarInternalActions,
|
|
146
|
+
muiTableBodyProps: {
|
|
147
|
+
sx: {
|
|
148
|
+
'& tr:nth-of-type(odd) > td': {
|
|
149
|
+
backgroundColor: theme.palette.TwClrBaseGray025 || theme.palette.grey[50]
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
muiTablePaperProps: {
|
|
154
|
+
elevation: 0
|
|
155
|
+
},
|
|
156
|
+
muiTableBodyRowProps: _ref4 => {
|
|
157
|
+
let {
|
|
158
|
+
row
|
|
159
|
+
} = _ref4;
|
|
160
|
+
return {
|
|
161
|
+
onClick: onRowClick ? () => onRowClick(row.original) : undefined,
|
|
162
|
+
sx: {
|
|
163
|
+
cursor: onRowClick ? 'pointer' : 'default',
|
|
164
|
+
'& td': {
|
|
165
|
+
borderBottom: 'none'
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
},
|
|
170
|
+
// Merge any additional table options
|
|
171
|
+
...tableOptions
|
|
172
|
+
});
|
|
173
|
+
return /*#__PURE__*/_react.default.createElement(_material.Box, {
|
|
174
|
+
minHeight: "160px",
|
|
175
|
+
padding: 2
|
|
176
|
+
}, /*#__PURE__*/_react.default.createElement(_materialReactTable.MaterialReactTable, {
|
|
177
|
+
table: table
|
|
178
|
+
}));
|
|
179
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@
|
|
1
|
+
@use '../../style-dictionary-dist/terraware.scss';
|
|
2
2
|
|
|
3
3
|
@font-face {
|
|
4
4
|
font-family: 'Inter';
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
.error-box {
|
|
9
9
|
display: flex;
|
|
10
10
|
width: 60%;
|
|
11
|
-
margin-top:
|
|
12
|
-
background:
|
|
11
|
+
margin-top: terraware.$tw-spc-base-xx-small;
|
|
12
|
+
background: terraware.$tw-clr-base-red-050;
|
|
13
13
|
padding: 16px;
|
|
14
14
|
margin: 0 auto;
|
|
15
|
-
border: 1px solid
|
|
15
|
+
border: 1px solid terraware.$tw-clr-icn-danger;
|
|
16
16
|
border-radius: 8px;
|
|
17
17
|
flex-direction: column;
|
|
18
18
|
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
.error-text {
|
|
30
|
-
font-family:
|
|
31
|
-
font-size:
|
|
32
|
-
font-weight:
|
|
33
|
-
line-height:
|
|
34
|
-
color:
|
|
30
|
+
font-family: terraware.$tw-fnt-frm-fld-error-text-font-family;
|
|
31
|
+
font-size: terraware.$tw-fnt-base-font-size-body-02;
|
|
32
|
+
font-weight: terraware.$tw-fnt-frm-fld-error-text-font-weight;
|
|
33
|
+
line-height: terraware.$tw-fnt-frm-fld-error-text-line-height;
|
|
34
|
+
color: terraware.$tw-clr-txt;
|
|
35
35
|
display: block;
|
|
36
36
|
width: 100%;
|
|
37
37
|
max-width: 100%;
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
.error-title {
|
|
43
|
-
font-family:
|
|
44
|
-
font-size:
|
|
45
|
-
font-weight:
|
|
46
|
-
line-height:
|
|
47
|
-
color:
|
|
43
|
+
font-family: terraware.$tw-fnt-frm-fld-error-text-font-family;
|
|
44
|
+
font-size: terraware.$tw-fnt-base-font-size-body-02;
|
|
45
|
+
font-weight: terraware.$tw-fnt-base-headline-01-semi-bold-font-weight;
|
|
46
|
+
line-height: terraware.$tw-fnt-frm-fld-error-text-line-height;
|
|
47
|
+
color: terraware.$tw-clr-txt;
|
|
48
48
|
display: block;
|
|
49
49
|
width: 100%;
|
|
50
50
|
max-width: 100%;
|
|
@@ -58,6 +58,6 @@
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
.error-icon {
|
|
61
|
-
fill:
|
|
62
|
-
margin-right:
|
|
61
|
+
fill: terraware.$tw-clr-txt-danger;
|
|
62
|
+
margin-right: terraware.$tw-spc-base-x-small;
|
|
63
63
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@
|
|
1
|
+
@use '../../style-dictionary-dist/terraware.scss';
|
|
2
2
|
|
|
3
3
|
@font-face {
|
|
4
4
|
font-family: 'Inter';
|
|
@@ -20,22 +20,22 @@
|
|
|
20
20
|
|
|
21
21
|
.tw-icon {
|
|
22
22
|
&--small {
|
|
23
|
-
width:
|
|
24
|
-
height:
|
|
23
|
+
width: terraware.$tw-sz-icon-small;
|
|
24
|
+
height: terraware.$tw-sz-icon-small;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
&--medium {
|
|
28
|
-
width:
|
|
29
|
-
height:
|
|
28
|
+
width: terraware.$tw-sz-icon-medium;
|
|
29
|
+
height: terraware.$tw-sz-icon-medium;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
&--large {
|
|
33
|
-
width:
|
|
34
|
-
height:
|
|
33
|
+
width: terraware.$tw-sz-icon-large;
|
|
34
|
+
height: terraware.$tw-sz-icon-large;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
&--xlarge {
|
|
38
|
-
width:
|
|
39
|
-
height:
|
|
38
|
+
width: terraware.$tw-sz-icon-x-large;
|
|
39
|
+
height: terraware.$tw-sz-icon-x-large;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
@
|
|
1
|
+
@use '../../style-dictionary-dist/terraware.scss';
|
|
2
2
|
|
|
3
3
|
.map-container {
|
|
4
|
-
border: 1px solid
|
|
4
|
+
border: 1px solid terraware.$tw-clr-brdr-tertiary;
|
|
5
5
|
border-radius: 8px;
|
|
6
6
|
display: flex;
|
|
7
7
|
overflow: hidden;
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
.map-drawer {
|
|
41
41
|
display: flex;
|
|
42
42
|
flex-direction: column;
|
|
43
|
-
background:
|
|
43
|
+
background: terraware.$tw-clr-base-white;
|
|
44
44
|
|
|
45
45
|
&--mobile {
|
|
46
46
|
width: stretch;
|
|
@@ -56,16 +56,16 @@
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
&--header {
|
|
59
|
-
padding:
|
|
59
|
+
padding: terraware.$tw-spc-base-x-small;
|
|
60
60
|
display: flex;
|
|
61
61
|
justify-content: space-between;
|
|
62
62
|
align-items: center;
|
|
63
63
|
.title {
|
|
64
|
-
font-family:
|
|
65
|
-
font-size:
|
|
66
|
-
font-weight:
|
|
67
|
-
line-height:
|
|
68
|
-
color:
|
|
64
|
+
font-family: terraware.$tw-fnt-mssg-title-font-family;
|
|
65
|
+
font-size: terraware.$tw-fnt-mssg-title-font-size;
|
|
66
|
+
font-weight: terraware.$tw-fnt-mssg-title-font-weight;
|
|
67
|
+
line-height: terraware.$tw-fnt-mssg-title-line-height;
|
|
68
|
+
color: terraware.$tw-clr-txt;
|
|
69
69
|
text-align: center;
|
|
70
70
|
text-overflow: ellipsis;
|
|
71
71
|
overflow: hidden;
|
|
@@ -75,26 +75,26 @@
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
.icon-close {
|
|
78
|
-
fill:
|
|
79
|
-
height:
|
|
80
|
-
width:
|
|
78
|
+
fill: terraware.$tw-clr-icn-secondary;
|
|
79
|
+
height: terraware.$tw-sz-base-medium;
|
|
80
|
+
width: terraware.$tw-sz-base-medium;
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
&--body {
|
|
85
|
-
background:
|
|
86
|
-
padding:
|
|
85
|
+
background: terraware.$tw-clr-base-white;
|
|
86
|
+
padding: terraware.$tw-spc-base-x-small terraware.$tw-spc-base-small;
|
|
87
87
|
text-align: start;
|
|
88
88
|
overflow: auto;
|
|
89
89
|
white-space: pre-wrap;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
&--message {
|
|
93
|
-
font-family:
|
|
94
|
-
font-size:
|
|
95
|
-
font-weight:
|
|
96
|
-
line-height:
|
|
97
|
-
color:
|
|
93
|
+
font-family: terraware.$tw-fnt-dlg-bx-message-font-family;
|
|
94
|
+
font-size: terraware.$tw-fnt-dlg-bx-message-font-size;
|
|
95
|
+
font-weight: terraware.$tw-fnt-dlg-bx-message-font-weight;
|
|
96
|
+
line-height: terraware.$tw-fnt-dlg-bx-message-line-height;
|
|
97
|
+
color: terraware.$tw-clr-txt;
|
|
98
98
|
width: 100%;
|
|
99
99
|
text-align: start;
|
|
100
100
|
}
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
font-size: 10px;
|
|
122
122
|
font-weight: 600;
|
|
123
123
|
line-height: 16px;
|
|
124
|
-
color:
|
|
124
|
+
color: terraware.$tw-clr-txt;
|
|
125
125
|
text-align: center;
|
|
126
126
|
margin: 0;
|
|
127
127
|
width: 100%;
|