@wonderflow/react-components 5.3.0 → 5.6.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/core/basic.css +1 -1
- package/core/typography.css +1 -1
- package/core.css +1 -1
- package/dist/components/autocomplete/autocomplete-option.d.ts +1 -1
- package/dist/components/autocomplete/autocomplete-option.d.ts.map +1 -1
- package/dist/components/autocomplete/autocomplete-option.js +1 -1
- package/dist/components/autocomplete/autocomplete.d.ts.map +1 -1
- package/dist/components/button/button.d.ts +1 -1
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/card/card.d.ts.map +1 -1
- package/dist/components/chip/chip.js +1 -1
- package/dist/components/clamp-text/clamp-text.d.ts.map +1 -1
- package/dist/components/container/container.d.ts.map +1 -1
- package/dist/components/datetime/datetime.d.ts +11 -0
- package/dist/components/datetime/datetime.d.ts.map +1 -1
- package/dist/components/disclosure/disclosure.d.ts.map +1 -1
- package/dist/components/disclosure/disclosure.js +12 -7
- package/dist/components/disclosure/disclosure.module.css +1 -1
- package/dist/components/dropdown/dropdown.d.ts +8 -0
- package/dist/components/dropdown/dropdown.d.ts.map +1 -1
- package/dist/components/dropdown/dropdown.js +2 -2
- package/dist/components/icon/icon.d.ts +7 -5
- package/dist/components/icon/icon.d.ts.map +1 -1
- package/dist/components/icon/icon.js +1 -1
- package/dist/components/icon-button/icon-button.d.ts.map +1 -1
- package/dist/components/info-state/info-state.d.ts +1 -1
- package/dist/components/info-state/info-state.d.ts.map +1 -1
- package/dist/components/input-group/input-group.d.ts +8 -8
- package/dist/components/input-group/input-group.d.ts.map +1 -1
- package/dist/components/input-group/input-group.js +1 -1
- package/dist/components/list/list.d.ts.map +1 -1
- package/dist/components/menu/menu-item/menu-item-checkbox.d.ts +1 -2
- package/dist/components/menu/menu-item/menu-item-checkbox.d.ts.map +1 -1
- package/dist/components/menu/menu-item/menu-item-checkbox.js +1 -1
- package/dist/components/menu/menu-item/menu-item.d.ts.map +1 -1
- package/dist/components/menu/menu-item/menu-item.module.css +1 -1
- package/dist/components/menu/menu.d.ts.map +1 -1
- package/dist/components/modal/content/modal-content.js +1 -1
- package/dist/components/prose/prose.d.ts.map +1 -1
- package/dist/components/select/select.d.ts +1 -1
- package/dist/components/select/select.d.ts.map +1 -1
- package/dist/components/selection-controls/checkbox.d.ts.map +1 -1
- package/dist/components/selection-controls/checkbox.js +8 -2
- package/dist/components/selection-controls/selection-controls.module.css +1 -1
- package/dist/components/skeleton/skeleton.d.ts +5 -1
- package/dist/components/skeleton/skeleton.d.ts.map +1 -1
- package/dist/components/skeleton/skeleton.js +4 -6
- package/dist/components/skeleton/skeleton.module.css +1 -1
- package/dist/components/slider/slider.d.ts +5 -5
- package/dist/components/slider/slider.d.ts.map +1 -1
- package/dist/components/slider/slider.js +1 -1
- package/dist/components/snackbar/snackbar.d.ts.map +1 -1
- package/dist/components/split-button/split-button.d.ts +2 -1
- package/dist/components/split-button/split-button.d.ts.map +1 -1
- package/dist/components/split-button/split-button.js +4 -3
- package/dist/components/stack/stack.d.ts +2 -2
- package/dist/components/stack/stack.d.ts.map +1 -1
- package/dist/components/star-meter/star-meter.d.ts +1 -1
- package/dist/components/star-meter/star-meter.d.ts.map +1 -1
- package/dist/components/tab/tab-item.d.ts +1 -1
- package/dist/components/tab/tab-item.d.ts.map +1 -1
- package/dist/components/tab/tab.d.ts.map +1 -1
- package/dist/components/table/index.d.ts +0 -1
- package/dist/components/table/index.d.ts.map +1 -1
- package/dist/components/table/table-cell/index.d.ts +2 -0
- package/dist/components/table/table-cell/index.d.ts.map +1 -0
- package/dist/components/table/table-cell/index.js +1 -0
- package/dist/components/table/table-cell/table-cell.d.ts +18 -0
- package/dist/components/table/table-cell/table-cell.d.ts.map +1 -0
- package/dist/components/table/table-cell/table-cell.js +29 -0
- package/dist/components/table/table-cell/table-cell.module.css +1 -0
- package/dist/components/table/table-checkbox/index.d.ts +2 -0
- package/dist/components/table/table-checkbox/index.d.ts.map +1 -0
- package/dist/components/table/table-checkbox/index.js +1 -0
- package/dist/components/table/table-checkbox/table-checkbox.d.ts +5 -0
- package/dist/components/table/table-checkbox/table-checkbox.d.ts.map +1 -0
- package/dist/components/table/table-checkbox/table-checkbox.js +4 -0
- package/dist/components/table/table-checkbox/table-checkbox.module.css +1 -0
- package/dist/components/table/table-controls/index.d.ts +2 -0
- package/dist/components/table/table-controls/index.d.ts.map +1 -0
- package/dist/components/table/table-controls/index.js +1 -0
- package/dist/components/table/table-controls/toggle-columns.d.ts +9 -0
- package/dist/components/table/table-controls/toggle-columns.d.ts.map +1 -0
- package/dist/components/table/table-controls/toggle-columns.js +23 -0
- package/dist/components/table/table-expand/index.d.ts +3 -0
- package/dist/components/table/table-expand/index.d.ts.map +1 -0
- package/dist/components/table/table-expand/index.js +1 -0
- package/dist/components/table/table-expand/table-expand.d.ts +7 -0
- package/dist/components/table/table-expand/table-expand.d.ts.map +1 -0
- package/dist/components/table/table-expand/table-expand.js +3 -0
- package/dist/components/table/table-expand/table-expand.module.css +1 -0
- package/dist/components/table/table-header/index.d.ts +3 -0
- package/dist/components/table/table-header/index.d.ts.map +1 -0
- package/dist/components/table/table-header/index.js +1 -0
- package/dist/components/table/table-header/table-header.d.ts +7 -0
- package/dist/components/table/table-header/table-header.d.ts.map +1 -0
- package/dist/components/table/table-header/table-header.js +4 -0
- package/dist/components/table/table-header/table-header.module.css +1 -0
- package/dist/components/table/table-pagination/index.d.ts +3 -0
- package/dist/components/table/table-pagination/index.d.ts.map +1 -0
- package/dist/components/table/table-pagination/index.js +1 -0
- package/dist/components/table/table-pagination/table-pagination.d.ts +13 -0
- package/dist/components/table/table-pagination/table-pagination.d.ts.map +1 -0
- package/dist/components/table/table-pagination/table-pagination.js +11 -0
- package/dist/components/table/table-row/index.d.ts +2 -0
- package/dist/components/table/table-row/index.d.ts.map +1 -0
- package/dist/components/table/table-row/index.js +1 -0
- package/dist/components/table/table-row/table-row.d.ts +5 -0
- package/dist/components/table/table-row/table-row.d.ts.map +1 -0
- package/dist/components/table/table-row/table-row.js +6 -0
- package/dist/components/table/table-row/table-row.module.css +1 -0
- package/dist/components/table/table.d.ts +127 -15
- package/dist/components/table/table.d.ts.map +1 -1
- package/dist/components/table/table.js +114 -15
- package/dist/components/table/table.module.css +1 -1
- package/dist/components/table/types.d.ts +21 -0
- package/dist/components/table/types.d.ts.map +1 -0
- package/dist/components/table/types.js +1 -0
- package/dist/components/text/text.d.ts.map +1 -1
- package/dist/components/text/text.module.css +1 -1
- package/dist/components/textfield/textfield.d.ts +2 -2
- package/dist/components/textfield/textfield.d.ts.map +1 -1
- package/dist/components/textfield/textfield.js +1 -1
- package/dist/components/title/title.d.ts.map +1 -1
- package/dist/components/toggle-button/toggle-button.d.ts.map +1 -1
- package/dist/components/tooltip/tooltip.d.ts +1 -1
- package/dist/components/tooltip/tooltip.js +1 -1
- package/package.json +15 -14
- package/dist/components/table/theme.d.ts +0 -3
- package/dist/components/table/theme.d.ts.map +0 -1
- package/dist/components/table/theme.js +0 -78
|
@@ -1,26 +1,138 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { Row, IdType, SortingRule } from 'react-table';
|
|
2
|
+
import { TableHeaderProps } from './table-header';
|
|
3
|
+
import { TablePaginationProps } from './table-pagination';
|
|
4
|
+
import { ReactNode, ComponentType } from 'react';
|
|
5
|
+
import { CustomColumnsType, OptionalDataTypes, PaginationType } from './types';
|
|
6
|
+
export declare type TableProps<T extends object> = PropsWithClass & {
|
|
7
|
+
/**
|
|
8
|
+
* Define the columns and headers of the table.
|
|
9
|
+
*/
|
|
10
|
+
columns: CustomColumnsType<T>;
|
|
11
|
+
/**
|
|
12
|
+
* Pass the data structure to the table. Each object key can be used as `accessor` for a column.
|
|
13
|
+
*/
|
|
14
|
+
data: Array<T & OptionalDataTypes<T>>;
|
|
15
|
+
/**
|
|
16
|
+
* Define the default visibility of the columns. This is an array of columns `id`,
|
|
17
|
+
*/
|
|
18
|
+
defaultHiddenColumns?: Array<IdType<T>>;
|
|
19
|
+
/**
|
|
20
|
+
* Show pagination below the table. This is recommended only for tables with a lot of rows.
|
|
21
|
+
*/
|
|
22
|
+
showPagination?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* The amount of entries to show for each page.
|
|
25
|
+
*/
|
|
26
|
+
itemsPerPage?: number;
|
|
27
|
+
/**
|
|
28
|
+
* The index of the page that should be set as active when the table is rendered.
|
|
29
|
+
*/
|
|
30
|
+
activePageIndex?: number;
|
|
31
|
+
/**
|
|
32
|
+
* The callback that is called when the active page index and page size change.
|
|
33
|
+
* Passing this property along side `showPagination` will enable manual pagination,
|
|
34
|
+
* disabling the automatic one.
|
|
35
|
+
*/
|
|
36
|
+
onDataUpdate?: ({ pageIndex, pageSize }: PaginationType) => Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Set the number of pages to show in the pagination. Used only when doing manual pagination.
|
|
39
|
+
*/
|
|
40
|
+
totalRows?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Set clusters of items to show in a single page. These values are used to
|
|
43
|
+
* compute the select options for the page size dropdown.
|
|
44
|
+
*/
|
|
45
|
+
pageClusters?: TablePaginationProps['clusters'];
|
|
46
|
+
/**
|
|
47
|
+
* Enable row selection. This property will render an additiona column
|
|
48
|
+
* at the start of the table, containing a checkbox.
|
|
49
|
+
*/
|
|
50
|
+
selectableRows?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Callback run when the selected rows change
|
|
53
|
+
*/
|
|
54
|
+
onSelectionChange?(selectedRows?: Row[], selectedRowIds?: Record<IdType<T>, boolean>): void;
|
|
55
|
+
/**
|
|
56
|
+
* If true, disable the automatic column sorting of the table. Turn this on if you want to
|
|
57
|
+
* to control the sorting yourself.
|
|
58
|
+
*/
|
|
59
|
+
isManualSorted?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Callback run when a column is sorted
|
|
62
|
+
*/
|
|
63
|
+
onSortChange?(sorting?: SortingRule<T>[]): void;
|
|
64
|
+
/**
|
|
65
|
+
* Add an alternate style to the table rows
|
|
66
|
+
*/
|
|
67
|
+
stripes?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Set the loading state of the table. This will sho skeleton loaders instead of the actual data.
|
|
70
|
+
*/
|
|
71
|
+
loading?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Enable horizontal separators between the table rows
|
|
74
|
+
*/
|
|
75
|
+
showSeparators?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Add an accessible title to the table component
|
|
78
|
+
*/
|
|
79
|
+
title?: TableHeaderProps['title'];
|
|
80
|
+
/**
|
|
81
|
+
* Hide the header which includes the title and controls.
|
|
82
|
+
* This option is ignored and set to `true` if `selectableRows` is set to `true`.
|
|
83
|
+
*/
|
|
84
|
+
showHeader?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Hide the table header which includes columns names.
|
|
87
|
+
*/
|
|
88
|
+
showTableHead?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Enable the dropdown to choose the visibility of the column
|
|
91
|
+
*/
|
|
92
|
+
columnsControl?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Pass custom actions to the table header
|
|
95
|
+
*/
|
|
96
|
+
actions?: ReactNode;
|
|
97
|
+
/**
|
|
98
|
+
* Set the label for selected items in the table. Default to "Selected items"
|
|
99
|
+
*/
|
|
100
|
+
selectedLabel?: string;
|
|
101
|
+
/**
|
|
102
|
+
* Pass custom components to show when rows are selected.
|
|
103
|
+
*/
|
|
104
|
+
selectedActions?: ReactNode;
|
|
105
|
+
/**
|
|
106
|
+
* Set the table height after which the table will scroll.
|
|
107
|
+
*/
|
|
108
|
+
height?: string;
|
|
109
|
+
/**
|
|
110
|
+
* Set the table background color. This must be set if `height` is set because
|
|
111
|
+
* the color is used as background for sticky headers.
|
|
112
|
+
*/
|
|
113
|
+
background?: string;
|
|
5
114
|
/**
|
|
6
115
|
* A react component that add additional content when the row is expanded.
|
|
7
|
-
* By passing this prop, the row will be expandable.
|
|
116
|
+
* By passing this prop, the row will be expandable. If fuction is passed,
|
|
117
|
+
* the function will be called with the `subRow` data and the function must return
|
|
118
|
+
* a component.
|
|
8
119
|
*/
|
|
9
|
-
|
|
10
|
-
data?: T;
|
|
11
|
-
}>;
|
|
120
|
+
expandableRowComponent?: ComponentType<T>;
|
|
12
121
|
/**
|
|
13
|
-
*
|
|
122
|
+
* A react component that add custom actions to rows. If fuction is passed,
|
|
123
|
+
* the function will be called with the row data and the function must return
|
|
124
|
+
* a component.
|
|
14
125
|
*/
|
|
15
|
-
|
|
126
|
+
actionsRowComponent?: ComponentType<Row<T>>;
|
|
16
127
|
/**
|
|
17
|
-
*
|
|
128
|
+
* Custom component/empty state to show when the table has no data or
|
|
129
|
+
* all columns have been toggled off.
|
|
18
130
|
*/
|
|
19
|
-
|
|
131
|
+
emptyComponent?: ReactNode;
|
|
20
132
|
/**
|
|
21
|
-
* Set
|
|
133
|
+
* Set the initial sorted column and order by passing column id and order.
|
|
22
134
|
*/
|
|
23
|
-
|
|
135
|
+
initialSortBy?: Array<SortingRule<T>>;
|
|
24
136
|
};
|
|
25
|
-
export declare const Table: <T>({ className,
|
|
137
|
+
export declare const Table: <T extends object>({ className, style, columns, data, selectableRows, onSelectionChange, stripes, showSeparators, title, actions, selectedActions, selectedLabel, showHeader, showTableHead, columnsControl, defaultHiddenColumns, height, loading, background, expandableRowComponent, actionsRowComponent: ActionsRowComponent, emptyComponent, showPagination, isManualSorted, onDataUpdate, onSortChange, itemsPerPage, totalRows, activePageIndex, pageClusters, initialSortBy, ...otherProps }: TableProps<T>) => JSX.Element;
|
|
26
138
|
//# sourceMappingURL=table.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/components/table/table.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/components/table/table.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,GAAG,EAAsB,MAAM,EAAE,WAAW,EAC7C,MAAM,aAAa,CAAA;AAIpB,OAAO,EAAe,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAG9D,OAAO,EAAmB,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAK1E,OAAO,EAA2B,SAAS,EAAsB,aAAa,EAAE,MAAM,OAAO,CAAA;AAE7F,OAAO,EAAsC,iBAAiB,EAAmB,iBAAiB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAEnI,oBAAY,UAAU,CAAC,CAAC,SAAS,MAAM,IAAI,cAAc,GAAG;IAC1D;;OAEG;IACH,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC;IAC9B;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;IACtC;;OAEG;IACH,oBAAoB,CAAC,EAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACzC;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;;;OAIG;IACH,YAAY,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACzE;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;OAGG;IACH,YAAY,CAAC,EAAE,oBAAoB,CAAC,UAAU,CAAC,CAAA;IAC/C;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;OAEG;IACH,iBAAiB,CAAC,CAAC,YAAY,CAAC,EAAE,GAAG,EAAE,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;IAC3F;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;OAEG;IACH,YAAY,CAAC,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAA;IAC/C;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;OAEG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAA;IACjC;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;MAEE;IACF,eAAe,CAAC,EAAE,SAAS,CAAA;IAC3B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;;OAKG;IACH,sBAAsB,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IAC1C;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5C;;;OAGG;IACH,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAA;CACtC,CAAA;AAED,eAAO,MAAM,KAAK,qgBAwUjB,CAAA"}
|
|
@@ -1,18 +1,117 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo } from 'react';
|
|
3
|
-
import ReactDataTable from 'react-data-table-component';
|
|
4
|
-
import { Icon, Skeleton, Checkbox } from '../..';
|
|
5
|
-
import { customStyle } from './theme';
|
|
6
|
-
import styles from './table.module.css';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
2
|
import clsx from 'clsx';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
import { useTable, useSortBy, useRowSelect, usePagination, useExpanded } from 'react-table';
|
|
4
|
+
import { TableRow } from './table-row';
|
|
5
|
+
import { TableCell } from './table-cell';
|
|
6
|
+
import { TableCheckbox } from './table-checkbox';
|
|
7
|
+
import { TableHeader } from './table-header';
|
|
8
|
+
import { ToggleColumnsControl } from './table-controls';
|
|
9
|
+
import { TableExpand } from './table-expand';
|
|
10
|
+
import { TablePagination } from './table-pagination';
|
|
11
|
+
import { AnimatePresence, motion } from 'framer-motion';
|
|
12
|
+
import { useUIDSeed } from 'react-uid';
|
|
13
|
+
import styles from './table.module.css';
|
|
14
|
+
import { Fragment, useEffect, useMemo } from 'react';
|
|
15
|
+
import { Text, Stack, IconButton, Skeleton } from '../..';
|
|
16
|
+
export const Table = ({ className, style, columns, data = [], selectableRows, onSelectionChange, stripes, showSeparators = true, title, actions, selectedActions, selectedLabel = 'Selected items', showHeader = false, showTableHead = true, columnsControl = false, defaultHiddenColumns, height, loading, background, expandableRowComponent, actionsRowComponent: ActionsRowComponent, emptyComponent, showPagination, isManualSorted, onDataUpdate, onSortChange, itemsPerPage = 10, totalRows, activePageIndex = 0, pageClusters, initialSortBy = [], ...otherProps }) => {
|
|
17
|
+
const uid = useUIDSeed();
|
|
18
|
+
const hasSomeExpandableRows = useMemo(() => data.some(d => d.subRows), [data]);
|
|
19
|
+
const isManualPaginated = useMemo(() => {
|
|
20
|
+
return Boolean(onDataUpdate && showPagination && totalRows);
|
|
21
|
+
}, [onDataUpdate, showPagination, totalRows]);
|
|
22
|
+
const { getTableProps, getTableBodyProps, headerGroups, rows, page, pageCount, gotoPage, allColumns, prepareRow, selectedFlatRows, visibleColumns, setPageSize, setHiddenColumns, state: { pageSize, pageIndex, selectedRowIds, sortBy } } = useTable({
|
|
23
|
+
columns,
|
|
24
|
+
data,
|
|
25
|
+
manualSortBy: isManualSorted,
|
|
26
|
+
disableMultiSort: true,
|
|
27
|
+
expandSubRows: Boolean(!expandableRowComponent),
|
|
28
|
+
autoResetHiddenColumns: false,
|
|
29
|
+
autoResetPage: false,
|
|
30
|
+
manualPagination: isManualPaginated,
|
|
31
|
+
autoResetSelectedRows: false,
|
|
32
|
+
pageCount: (isManualPaginated && totalRows) ? Math.ceil(totalRows / itemsPerPage) : 10,
|
|
33
|
+
// This `paginateExpandedRows` prop prevent expanded rows to be placed in the next page. But it breaks row selection
|
|
34
|
+
// paginateExpandedRows: !showPagination,
|
|
35
|
+
initialState: {
|
|
36
|
+
sortBy: initialSortBy,
|
|
37
|
+
pageIndex: activePageIndex,
|
|
38
|
+
pageSize: showPagination ? itemsPerPage : undefined,
|
|
39
|
+
hiddenColumns: ['selection', 'expander']
|
|
40
|
+
}
|
|
41
|
+
}, useSortBy, useExpanded, usePagination, useRowSelect, (hooks) => {
|
|
42
|
+
const checkboxColumn = [{
|
|
43
|
+
id: 'selection',
|
|
44
|
+
Header: ({ getToggleAllRowsSelectedProps }) => !loading ? _jsx(TableCheckbox, { ...getToggleAllRowsSelectedProps() }, void 0) : null,
|
|
45
|
+
Cell: ({ row }) => _jsx(TableCheckbox, { ...row.getToggleRowSelectedProps() }, void 0),
|
|
46
|
+
isCollapsed: true,
|
|
47
|
+
hideFromList: true
|
|
48
|
+
}];
|
|
49
|
+
const expanderColumn = [{
|
|
50
|
+
id: 'expander',
|
|
51
|
+
isCollapsed: true,
|
|
52
|
+
hideFromList: true,
|
|
53
|
+
expander: true,
|
|
54
|
+
Header: ({ getToggleAllRowsExpandedProps, isAllRowsExpanded }) => (!loading
|
|
55
|
+
? (_jsx(IconButton, { kind: "flat", dimension: "small", className: styles.ExpandButton, icon: isAllRowsExpanded ? 'chevron-down' : 'chevron-right', ...getToggleAllRowsExpandedProps() }, void 0))
|
|
56
|
+
: null),
|
|
57
|
+
Cell: ({ row }) => row.canExpand
|
|
58
|
+
? (_jsx(IconButton, { kind: "secondary", dimension: "small", icon: row.isExpanded ? 'chevron-down' : 'chevron-right', ...row.getToggleRowExpandedProps() }, void 0))
|
|
59
|
+
: null
|
|
60
|
+
}];
|
|
61
|
+
const actionsColumn = [{
|
|
62
|
+
id: 'actions',
|
|
63
|
+
isCollapsed: true,
|
|
64
|
+
hideFromList: true,
|
|
65
|
+
Cell: ({ row }) => ActionsRowComponent ? _jsx(ActionsRowComponent, { ...row }, void 0) : null
|
|
66
|
+
}];
|
|
67
|
+
hooks.visibleColumns.push((columns) => [
|
|
68
|
+
...checkboxColumn,
|
|
69
|
+
...expanderColumn,
|
|
70
|
+
...actionsColumn,
|
|
71
|
+
...columns
|
|
72
|
+
]);
|
|
73
|
+
});
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
const artificialColumns = defaultHiddenColumns || [];
|
|
76
|
+
if (!selectableRows)
|
|
77
|
+
artificialColumns.push('selection');
|
|
78
|
+
if (!hasSomeExpandableRows)
|
|
79
|
+
artificialColumns.push('expander');
|
|
80
|
+
if (!ActionsRowComponent)
|
|
81
|
+
artificialColumns.push('actions');
|
|
82
|
+
setHiddenColumns(artificialColumns);
|
|
83
|
+
}, [selectableRows, setHiddenColumns, defaultHiddenColumns, expandableRowComponent, hasSomeExpandableRows, ActionsRowComponent]);
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
onSelectionChange && onSelectionChange(selectedFlatRows, selectedRowIds);
|
|
86
|
+
}, [onSelectionChange, selectedFlatRows, selectedRowIds]);
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
onSortChange && onSortChange(sortBy);
|
|
89
|
+
}, [onSortChange, sortBy]);
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
onDataUpdate && onDataUpdate({ pageIndex, pageSize });
|
|
92
|
+
}, [onDataUpdate, pageIndex, pageSize]);
|
|
93
|
+
const rowEntries = useMemo(() => showPagination ? page : rows, [page, rows, showPagination]);
|
|
94
|
+
const filteredVisibleColumns = useMemo(() => visibleColumns.filter((col) => !col.hideFromList), [visibleColumns]);
|
|
95
|
+
const dynamicStyle = {
|
|
96
|
+
'--table-height': height,
|
|
97
|
+
'--table-background': background
|
|
12
98
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
99
|
+
return (_jsxs("div", { className: clsx(styles.Table, className), style: { ...dynamicStyle, ...style }, children: [_jsx(AnimatePresence, { children: selectedFlatRows?.length && (_jsxs(Stack, { as: motion.div, className: styles.Toast, direction: "row", horizontalAlign: "space-between", verticalAlign: "center", horizontalPadding: 16, verticalPadding: 8, fill: false, columnGap: 16, initial: { y: '-16px', opacity: 0 }, animate: {
|
|
100
|
+
y: 0,
|
|
101
|
+
opacity: 1,
|
|
102
|
+
transition: {
|
|
103
|
+
type: 'spring',
|
|
104
|
+
stiffness: 700,
|
|
105
|
+
damping: 30
|
|
106
|
+
}
|
|
107
|
+
}, exit: { y: '-16px', opacity: 0 }, children: [_jsx(Text, { as: "span", size: 14, weight: "bold", children: `${selectedLabel}: ${selectedFlatRows.length}` }, void 0), selectedActions] }, void 0)) }, void 0), (showHeader || selectableRows) && (_jsxs(TableHeader, { title: title, children: [(columnsControl && data.length)
|
|
108
|
+
? (_jsx(ToggleColumnsControl, { columns: allColumns, visibleColumns: filteredVisibleColumns }, void 0))
|
|
109
|
+
: null, actions] }, void 0)), ((data.length || loading) && filteredVisibleColumns.length)
|
|
110
|
+
? (_jsx("div", { className: styles.TableWrapper, "data-table-scrolling": Boolean(height), children: _jsxs("table", { className: styles.TableElement, "data-table-stripes": stripes, "data-table-separators": showSeparators, "data-table-loading": loading, "aria-labelledby": uid('table-title'), ...getTableProps(), ...otherProps, children: [showTableHead && (_jsx("thead", { role: "rowgroup", className: styles.THead, children: headerGroups.map(headerGroup => (_jsx(TableRow, { ...headerGroup.getHeaderGroupProps(), children: headerGroup.headers.map((column) => (_jsx(TableCell, { as: "th", width: column.minWidth === 0 ? undefined : column.minWidth, collapsed: column.isCollapsed, isSorted: column.isSorted, isSortedDesc: column.isSorted && column.isSortedDesc, align: column.align, ...column.getHeaderProps(column.getSortByToggleProps()), children: column.render('Header') }, void 0))) }, void 0))) }, void 0)), _jsx("tbody", { role: "rowgroup", className: styles.TBody, ...getTableBodyProps(), children: loading
|
|
111
|
+
? (_jsx(TableRow, { children: visibleColumns.map(() => (_jsx(TableCell, { children: _jsx(Skeleton, { gap: 16, height: 16, count: 5 }, void 0) }, void 0))) }, void 0))
|
|
112
|
+
: rowEntries.map((row) => {
|
|
113
|
+
prepareRow(row);
|
|
114
|
+
return (_jsxs(Fragment, { children: [_jsx(TableRow, { ...row.getRowProps(), "data-row-expanded": row.isExpanded || undefined, "data-row-depth": row.depth > 0 ? row.depth : undefined, children: row.cells.map((cell) => (_jsx(TableCell, { collapsed: cell.column.isCollapsed, isExpander: cell.column.expander, expanded: row.isExpanded, depth: row.depth, width: cell.column.minWidth === 0 ? undefined : cell.column.minWidth, align: cell.column.align, hasSubrows: !!row.subRows?.length, ...cell.getCellProps(), children: cell.render('Cell') }, void 0))) }, void 0), (row.subRows && row.isExpanded && expandableRowComponent) && row.subRows.map((subRow) => (_jsx(TableRow, { "data-table-row-expander": true, children: _jsx(TableCell, { padding: false, colSpan: 100, children: _jsx(TableExpand, { data: subRow.original, component: expandableRowComponent }, void 0) }, void 0) }, subRow.id)))] }, row.id));
|
|
115
|
+
}) }, void 0)] }, void 0) }, void 0))
|
|
116
|
+
: (_jsx(Stack, { verticalAlign: "center", horizontalAlign: "center", children: emptyComponent || 'No data' }, void 0)), (showPagination && filteredVisibleColumns.length > 0 && !!rows.length) && (_jsx(TablePagination, { clusters: pageClusters, pageSize: pageSize, totalItems: totalRows || rows.length, currentPage: pageIndex, totalPages: pageCount, isManual: Boolean(isManualPaginated && totalRows), onPageSizeChange: newPageSize => setPageSize(newPageSize), onPageClick: (selected) => gotoPage(selected) }, void 0))] }, void 0));
|
|
18
117
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
.Table{position:relative;width:100%;z-index:0}.TableWrapper{-webkit-overflow-scrolling:touch;overflow:auto}.TableWrapper[data-table-scrolling=true]{background:var(--table-background);max-height:var(--table-height);overscroll-behavior:contain}.TableElement{border-collapse:collapse;font-size:.89rem;width:100%}.TableElement[data-table-loading=true]{pointer-events:none;-webkit-user-select:none;user-select:none}.THead{background:var(--table-background);box-shadow:inset 0 -3px 0 var(--dimmed-2);position:sticky;top:0;z-index:2}@media not all and (-webkit-min-device-pixel-ratio:0),not all and (min-resolution:0.001dpcm){@supports (-webkit-appearance:none) and (stroke-color:transparent){.THead{border-bottom:3px solid var(--dimmed-2);box-shadow:none}}}.THead th{padding-bottom:.89rem;padding-top:.89rem}.Toast{-webkit-backdrop-filter:saturate(180%) blur(62px);backdrop-filter:saturate(180%) blur(62px);background-color:var(--global-vibrancy-background);border-radius:.44rem;left:0;min-block-size:3.11rem;position:absolute;right:0;top:0;z-index:4}.ExpandButton{left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Column, CustomHeaderGroup, CustomCell, ColumnInstance } from 'react-table';
|
|
3
|
+
export declare type PaginationType = {
|
|
4
|
+
pageIndex: number;
|
|
5
|
+
pageSize: number;
|
|
6
|
+
};
|
|
7
|
+
export declare type OptionalColumnTypes = {
|
|
8
|
+
isCollapsed?: boolean;
|
|
9
|
+
align?: 'start' | 'center' | 'end';
|
|
10
|
+
hideFromList?: boolean;
|
|
11
|
+
expander?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare type OptionalDataTypes<T> = {
|
|
14
|
+
subRows?: T[];
|
|
15
|
+
actions?: ReactNode | ReactNode[];
|
|
16
|
+
};
|
|
17
|
+
export declare type HeaderGroupType = CustomHeaderGroup<OptionalColumnTypes>;
|
|
18
|
+
export declare type CellType = CustomCell<OptionalColumnTypes>;
|
|
19
|
+
export declare type CustomColumnsType<T extends object> = (Column<T> & OptionalColumnTypes)[];
|
|
20
|
+
export declare type CustomColumnInstanceType = ColumnInstance & OptionalColumnTypes;
|
|
21
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/table/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EACL,MAAM,EAAE,iBAAiB,EAAE,UAAU,EAAE,cAAc,EACtD,MAAM,aAAa,CAAA;AAEpB,oBAAY,cAAc,GAAG;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,oBAAY,mBAAmB,GAAG;IAChC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IACnC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAA;AAED,oBAAY,iBAAiB,CAAC,CAAC,IAAI;IACjC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC;IACd,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,EAAE,CAAC;CACnC,CAAA;AAED,oBAAY,eAAe,GAAG,iBAAiB,CAAC,mBAAmB,CAAC,CAAA;AACpE,oBAAY,QAAQ,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAA;AACtD,oBAAY,iBAAiB,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,mBAAmB,CAAC,EAAE,CAAA;AACrF,oBAAY,wBAAwB,GAAG,cAAc,GAAG,mBAAmB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/components/text/text.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/components/text/text.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAG1C,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAE9D,oBAAY,SAAS,GAAG;IACtB;;;OAGG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;IACnC;;OAEG;IACH,SAAS,CAAC,EAAE,UAAU,GAAG,aAAa,GAAG,QAAQ,GAAG,SAAS,CAAC;IAC9D;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACnB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IACvC;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;CACzC,CAAA;AAED,aAAK,eAAe,GAAG,WAAW,CAAC,mBAAmB,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;AAEvE,eAAO,MAAM,IAAI,iBAoCI,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.Text{font-size:var(--fs-max);max-inline-size:var(--maxW,initial);min-block-size:.01vh;text-align:var(--tAlign)}.Text[data-text-dimmed="5"]{color:var(--dimmed-5)}.Text[data-text-dimmed="6"]{color:var(--dimmed-6)}.Text[data-text-dimmed="7"]{color:var(--dimmed-7)}.Text[data-text-sentiment=positive]{color:var(--highlight-green-foreground)}.Text[data-text-sentiment=informative]{color:var(--highlight-blue-foreground)}.Text[data-text-sentiment=danger]{color:var(--highlight-red-foreground)}.Text[data-text-sentiment=warning]{color:var(--highlight-yellow-foreground)}.Text[data-text-size="14"]{
|
|
1
|
+
.Text{font-size:var(--fs-max);max-inline-size:var(--maxW,initial);min-block-size:.01vh;text-align:var(--tAlign)}.Text[data-text-dimmed="5"]{color:var(--dimmed-5)}.Text[data-text-dimmed="6"]{color:var(--dimmed-6)}.Text[data-text-dimmed="7"]{color:var(--dimmed-7)}.Text[data-text-sentiment=positive]{color:var(--highlight-green-foreground)}.Text[data-text-sentiment=informative]{color:var(--highlight-blue-foreground)}.Text[data-text-sentiment=danger]{color:var(--highlight-red-foreground)}.Text[data-text-sentiment=warning]{color:var(--highlight-yellow-foreground)}.Text[data-text-size="14"]{--fs-min:0.78rem;--fs-max:0.78rem}.Text[data-text-size="16"]{--fs-min:0.78rem;--fs-max:0.89rem}.Text[data-text-size="18"]{--fs-min:0.89rem;--fs-max:1.00rem}.Text[data-text-size="22"]{--fs-min:1.00rem;--fs-max:1.22rem}.Text[data-text-size="28"]{--fs-min:1.22rem;--fs-max:1.56rem}.Text[data-text-weight=thin]{font-weight:100}.Text[data-text-weight=bold]{font-weight:600}.Text[data-text-responsive=true]{font-size:var(--fs-min)}@media (min-width:48em){.Text[data-text-responsive=true]{font-size:var(--fs-max)}}.Text[data-text-line-height=none]{line-height:1}.Text[data-text-line-height=small]{line-height:1.2}.Text[data-text-line-height=large]{line-height:1.5}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseFieldProps, PrimitiveInputType } from './base-field';
|
|
2
2
|
import { ChangeEvent } from 'react';
|
|
3
|
-
import { IconProps } from '
|
|
3
|
+
import { IconProps } from '../..';
|
|
4
4
|
export declare type TextfieldProps = BaseFieldProps & {
|
|
5
5
|
/**
|
|
6
6
|
* Set the icon to show on the left or right side of the input.
|
|
@@ -53,7 +53,7 @@ export declare const Textfield: import("react").ForwardRefExoticComponent<import
|
|
|
53
53
|
/**
|
|
54
54
|
* Set the icon to show on the left or right side of the input.
|
|
55
55
|
*/
|
|
56
|
-
icon?: import("
|
|
56
|
+
icon?: import("packages/icons/dist").IconNames | import("react").ReactElement<HTMLOrSVGElement, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
57
57
|
/**
|
|
58
58
|
* Set in which side of the field the icon should be displayed.
|
|
59
59
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textfield.d.ts","sourceRoot":"","sources":["../../../src/components/textfield/textfield.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,cAAc,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAC5E,OAAO,EAAE,WAAW,EAAmD,MAAM,OAAO,CAAA;AAEpF,OAAO,EAAqC,SAAS,EAAe,MAAM,
|
|
1
|
+
{"version":3,"file":"textfield.d.ts","sourceRoot":"","sources":["../../../src/components/textfield/textfield.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,cAAc,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAC5E,OAAO,EAAE,WAAW,EAAmD,MAAM,OAAO,CAAA;AAEpF,OAAO,EAAqC,SAAS,EAAe,MAAM,cAAc,CAAA;AAIxF,oBAAY,cAAc,GAAG,cAAc,GAAG;IAC5C;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC3B;;OAEG;IACF,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACjC;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,KAAK,CAAC;IACxC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,kBAAkB,CAAC,KAAK,IAAI,CAAA;CAC5D,CAAA;AAED,eAAO,MAAM,SAAS;;;IA9CpB;;OAEG;;IAEH;;OAEG;;IAEH;;;;OAIG;;IAEH;;;;;OAKG;;IAEH;;;OAGG;;IAEH;;OAEG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;OAEG;wBACgB,YAAY,kBAAkB,CAAC,KAAK,IAAI;sDA8G3D,CAAA"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { BaseField } from './base-field';
|
|
3
3
|
import { forwardRef, useCallback, useState, useMemo } from 'react';
|
|
4
4
|
import styles from './textfield.module.css';
|
|
5
|
-
import { Icon, IconButton, Stack, Text } from '
|
|
5
|
+
import { Icon, IconButton, Stack, Text } from '../..';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
import { useUIDSeed } from 'react-uid';
|
|
8
8
|
export const Textfield = forwardRef(({ children, className, disabled = false, icon, label, textarea, readOnly, invalid, id, iconPosition = 'right', dimension = 'regular', type, style, onChange, ...otherProps }, forwardedRef) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"title.d.ts","sourceRoot":"","sources":["../../../src/components/title/title.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"title.d.ts","sourceRoot":"","sources":["../../../src/components/title/title.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAG1C,oBAAY,UAAU,GAAG;IACvB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,SAAS,CAAC;IACtD;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;IACxC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IACvC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAA;AAED,aAAK,gBAAgB,GAAG,WAAW,CAAC,mBAAmB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAE5E,eAAO,MAAM,KAAK,kBA+BI,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle-button.d.ts","sourceRoot":"","sources":["../../../src/components/toggle-button/toggle-button.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,WAAW,EAAmB,MAAM,
|
|
1
|
+
{"version":3,"file":"toggle-button.d.ts","sourceRoot":"","sources":["../../../src/components/toggle-button/toggle-button.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,WAAW,EAAmB,MAAM,cAAc,CAAA;AAExF,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAGlC,oBAAY,iBAAiB,GAAG,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,GAAG;IAChE;;OAEG;IACH,WAAW,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IACrC;;OAEG;IACH,WAAW,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IACtC;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAA;AAED,aAAK,uBAAuB,GAAG,WAAW,CAAC,mBAAmB,CAC5D,WAAW,CAAC,gBAAgB,CAAC,OAAO,UAAU,CAAC,EAC/C,WAAW,CAAC,QAAQ,CAAC,OAAO,UAAU,CAAC,GAAG,iBAAiB,CAC5D,CAAC;AAqBF,eAAO,MAAM,YAAY,yBA4EI,CAAA"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Children, cloneElement, useState, useRef } from 'react';
|
|
3
3
|
import { useUIDSeed } from 'react-uid';
|
|
4
4
|
import { useKeyPress, useFocusWithin } from 'ahooks';
|
|
5
|
-
import { Elevator } from '
|
|
5
|
+
import { Elevator } from '../..';
|
|
6
6
|
import styles from './tooltip.module.css';
|
|
7
7
|
import { usePopperTooltip } from 'react-popper-tooltip';
|
|
8
8
|
export const Tooltip = ({ children, trigger, placement = 'bottom-start', open, style, maxWidth = '40ch', fill = false, interactive = false, delay = 500 }) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wonderflow/react-components",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.6.0",
|
|
4
4
|
"description": "UI components from Wonderflow's Wanda design system",
|
|
5
5
|
"author": "Wonderflow",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"prebuild": "rimraf dist core core.css",
|
|
24
24
|
"build": "run-s build:ts build:css",
|
|
25
25
|
"postbuild": "rimraf dist/**/_mixins.css",
|
|
26
|
-
"build:ts": "tsc",
|
|
26
|
+
"build:ts": "tsc && tsc-alias",
|
|
27
27
|
"build:css": "cpy '**/*.css' '../dist' --parents --cwd=src && postcss dist/*.css \"dist/**/!(utils)/!(_mixins).css\" --replace",
|
|
28
28
|
"postbuild:css": "mv dist/core.css ./core.css && mv dist/core ./core",
|
|
29
29
|
"lint": "run-s lint:styles",
|
|
@@ -56,25 +56,26 @@
|
|
|
56
56
|
"react-dom": "^17.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@babel/core": "7.
|
|
59
|
+
"@babel/core": "7.17.5",
|
|
60
60
|
"@babel/preset-typescript": "7.16.7",
|
|
61
|
-
"@storybook/addon-actions": "6.4.
|
|
62
|
-
"@storybook/addon-essentials": "6.4.
|
|
63
|
-
"@storybook/addon-links": "6.4.
|
|
61
|
+
"@storybook/addon-actions": "6.4.19",
|
|
62
|
+
"@storybook/addon-essentials": "6.4.19",
|
|
63
|
+
"@storybook/addon-links": "6.4.19",
|
|
64
64
|
"@storybook/addon-postcss": "2.0.0",
|
|
65
65
|
"@storybook/addons": "6.5.0-alpha.21",
|
|
66
66
|
"@storybook/builder-webpack5": "6.5.0-alpha.21",
|
|
67
67
|
"@storybook/manager-webpack5": "6.5.0-alpha.21",
|
|
68
|
-
"@storybook/react": "6.4.
|
|
68
|
+
"@storybook/react": "6.4.19",
|
|
69
69
|
"@storybook/theming": "6.5.0-alpha.21",
|
|
70
|
-
"@types/react": "17.0.
|
|
70
|
+
"@types/react": "17.0.39",
|
|
71
71
|
"@types/react-dom": "17.0.11",
|
|
72
|
+
"@types/react-table": "7.7.9",
|
|
72
73
|
"@wonderflow/config": "*",
|
|
73
74
|
"@wonderflow/stylelint-config": "1.1.4",
|
|
74
75
|
"@wonderflow/tokens": "*",
|
|
75
76
|
"babel-loader": "8.2.3",
|
|
76
77
|
"cpy-cli": "3.1.1",
|
|
77
|
-
"postcss": "8.4.
|
|
78
|
+
"postcss": "8.4.7",
|
|
78
79
|
"postcss-cli": "9.1.0",
|
|
79
80
|
"react": "17.0.2",
|
|
80
81
|
"react-dom": "17.0.2",
|
|
@@ -85,17 +86,17 @@
|
|
|
85
86
|
"typescript-plugin-css-modules": "3.4.0"
|
|
86
87
|
},
|
|
87
88
|
"dependencies": {
|
|
88
|
-
"ahooks": "3.1.
|
|
89
|
+
"ahooks": "3.1.10",
|
|
89
90
|
"clsx": "1.1.1",
|
|
90
|
-
"framer-motion": "
|
|
91
|
-
"react-data-table-component": "7.4.7",
|
|
91
|
+
"framer-motion": "6.2.8",
|
|
92
92
|
"react-focus-on": "3.5.4",
|
|
93
93
|
"react-masonry-css": "1.0.16",
|
|
94
|
-
"react-paginate": "8.1.
|
|
94
|
+
"react-paginate": "8.1.2",
|
|
95
95
|
"react-popper-tooltip": "4.3.1",
|
|
96
96
|
"react-roving-tabindex": "3.1.1",
|
|
97
|
+
"react-table": "7.7.0",
|
|
97
98
|
"react-uid": "2.3.1",
|
|
98
99
|
"styled-components": "5.3.3",
|
|
99
|
-
"type-fest": "2.
|
|
100
|
+
"type-fest": "2.12.0"
|
|
100
101
|
}
|
|
101
102
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/components/table/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAwCrE,eAAO,MAAM,WAAW,cAAe,MAAM,KAAG,WAuC9C,CAAA"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { createTheme } from 'react-data-table-component';
|
|
2
|
-
/* Reference: https://github.com/jbetancur/react-data-table-component/blob/master/src/DataTable/themes.ts */
|
|
3
|
-
createTheme('wanda', {
|
|
4
|
-
text: {
|
|
5
|
-
primary: 'var(--foreground-color)',
|
|
6
|
-
secondary: 'var(--dimmed-6)',
|
|
7
|
-
disabled: 'var(--global-disabled-foreground)'
|
|
8
|
-
},
|
|
9
|
-
background: {
|
|
10
|
-
default: 'transparent'
|
|
11
|
-
},
|
|
12
|
-
context: {
|
|
13
|
-
background: 'var(--global-vibrancy-background)',
|
|
14
|
-
text: 'var(--global-vibrancy-foreground)'
|
|
15
|
-
},
|
|
16
|
-
divider: {
|
|
17
|
-
default: 'transparent'
|
|
18
|
-
},
|
|
19
|
-
button: {
|
|
20
|
-
default: 'transparent',
|
|
21
|
-
focus: 'var(--dimmed-1)',
|
|
22
|
-
hover: 'transparent',
|
|
23
|
-
disabled: 'var(--global-disabled-foreground)'
|
|
24
|
-
},
|
|
25
|
-
selected: {
|
|
26
|
-
default: 'var(--highlight-blue-background)',
|
|
27
|
-
text: 'var(--highlight-blue-foreground)'
|
|
28
|
-
},
|
|
29
|
-
highlightOnHover: {
|
|
30
|
-
default: 'var(--dimmed-1)',
|
|
31
|
-
text: 'var(--global-foreground)'
|
|
32
|
-
},
|
|
33
|
-
striped: {
|
|
34
|
-
default: 'var(--dimmed-0)',
|
|
35
|
-
text: 'var(--global-foreground)'
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
/* Reference: https://github.com/jbetancur/react-data-table-component/blob/master/src/DataTable/styles.ts */
|
|
39
|
-
export const customStyle = (rowHeight) => ({
|
|
40
|
-
rows: {
|
|
41
|
-
style: {
|
|
42
|
-
minHeight: rowHeight
|
|
43
|
-
},
|
|
44
|
-
highlightOnHoverStyle: {
|
|
45
|
-
outline: 'none'
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
headRow: {
|
|
49
|
-
style: {
|
|
50
|
-
borderBottom: '3px solid var(--dimmed-2)'
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
headCells: {
|
|
54
|
-
style: {
|
|
55
|
-
fontWeight: 800,
|
|
56
|
-
fontSize: 'var(--headcell-fs)'
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
cells: {
|
|
60
|
-
style: {
|
|
61
|
-
fontSize: 'var(--cell-fs)'
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
pagination: {
|
|
65
|
-
style: {
|
|
66
|
-
fontSize: 'var(--pagination-fs)'
|
|
67
|
-
},
|
|
68
|
-
pageButtonsStyle: {
|
|
69
|
-
color: 'var(--global-foreground)'
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
contextMenu: {
|
|
73
|
-
style: {
|
|
74
|
-
backdropFilter: 'blur(32px)',
|
|
75
|
-
borderRadius: '4px'
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
});
|