@epam/ai-dial-ui-kit 0.16.0-dev.68 → 0.16.0-dev.69
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/dist/CHANGELOG.md +5 -0
- package/dist/{DateCellRenderer-DMq0adkA.cjs → DateCellRenderer-VFKHZI-J.cjs} +23 -23
- package/dist/components/New/Grid/Grid.js +201 -182
- package/dist/components/New/Grid/components/GridEmptyState.js +13 -0
- package/dist/components/New/Select/Select.js +112 -109
- package/dist/components-manifest.json +50 -11
- package/dist/dial-ui-kit.cjs +3 -3
- package/dist/grid.cjs +1 -1
- package/dist/migration-guides/0.16.0/grid-empty-state-pattern.md +100 -0
- package/dist/migration-guides/README.md +1 -0
- package/dist/src/components/New/Grid/Grid.d.ts +42 -7
- package/dist/src/components/New/Grid/components/GridEmptyState.d.ts +21 -0
- package/dist/src/components/New/NoDataContent/NoDataContent.d.ts +8 -0
- package/dist/src/components/New/Select/Select.d.ts +6 -0
- package/dist/src/components/New/constants/icon.d.ts +2 -2
- package/package.json +1 -1
package/dist/grid.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./DateCellRenderer-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./DateCellRenderer-VFKHZI-J.cjs");exports.DEFAULT_DATE_FORMAT_OPTIONS=e.DEFAULT_DATE_FORMAT_OPTIONS;exports.DEFAULT_DATE_LOCALE=e.DEFAULT_LOCALE;exports.DateCellRenderer=e.DateCellRenderer;exports.GRID_ALIGN_RIGHT_CLASS=e.GRID_ALIGN_RIGHT_CLASS;exports.GRID_ROOT_CLASS=e.GRID_ROOT_CLASS;exports.GRID_ROW_HEIGHT=e.ROW_HEIGHT;exports.GRID_SELECTION_COLUMN_ID=e.GRID_SELECTION_COLUMN_ID;exports.GRID_THEME_PARAMS=e.GRID_THEME_PARAMS;exports.Grid=e.Grid;exports.GridAppearance=e.GridAppearance;exports.GridColorScheme=e.GridColorScheme;exports.GridSelectionMode=e.GridSelectionMode;exports.baseColumnComparator=e.baseColumnComparator;exports.checkColDefsChanges=e.checkColDefsChanges;exports.convertToDate=e.convertToDate;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Migrating the `Grid` empty state to the Patterns 2.0 empty-state behaviour — v0.15 → v0.16.0
|
|
2
|
+
|
|
3
|
+
## Why this changed
|
|
4
|
+
|
|
5
|
+
The Patterns 2.0 empty-state spec has two cases: a list with nothing in it
|
|
6
|
+
yet ("No [entities] yet", optionally with an action) and a list that a
|
|
7
|
+
search or filter emptied ("No [entities] found", announced). The `Grid` drew
|
|
8
|
+
neither correctly:
|
|
9
|
+
|
|
10
|
+
- it showed a 100px `IconZoomCancel` instead of the shared placeholder-list
|
|
11
|
+
card every other empty list uses;
|
|
12
|
+
- its default copy ("No results found" / "Sorry, we couldn't find any results
|
|
13
|
+
for your search.") talked about a search even when the grid simply had no
|
|
14
|
+
rows;
|
|
15
|
+
- it announced the no-rows message as a `role="status"` region every time,
|
|
16
|
+
including on first load;
|
|
17
|
+
- when the column filters left no rows, ag-Grid's own unstyled
|
|
18
|
+
no-matching-rows overlay appeared, because only the no-rows overlay was
|
|
19
|
+
replaced;
|
|
20
|
+
- there was no way to put an action under the message.
|
|
21
|
+
|
|
22
|
+
## What changed
|
|
23
|
+
|
|
24
|
+
| Before | After |
|
|
25
|
+
| ---------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
|
|
26
|
+
| Default illustration `IconZoomCancel` | The shared `NoDataContent` card; `emptyStateIcon` still overrides it |
|
|
27
|
+
| `emptyStateTitle` default `'No results found'` | `'No items yet'` |
|
|
28
|
+
| `emptyStateDescription` default `"Sorry, we couldn't find any…"` | `'Items will appear here once they are added.'` |
|
|
29
|
+
| No-rows message always announced (`role="status"`) | Announced only with `emptyStateLive` |
|
|
30
|
+
| Column filters leaving no rows show ag-Grid's default overlay | `filteredEmptyStateTitle` (`'No items found'`) / `filteredEmptyStateDescription`, always announced |
|
|
31
|
+
| No action | `emptyStateAction`, shown when there are no rows |
|
|
32
|
+
| `noRowsOverlayComponent` set by the grid | `overlayComponentSelector` + `overlayComponentParams` set by the grid |
|
|
33
|
+
|
|
34
|
+
## Step-by-step migration
|
|
35
|
+
|
|
36
|
+
### 1. Find all usages
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
grep -rnE "<Grid\b" src/
|
|
40
|
+
grep -rnE "emptyState(Title|Description|Icon)" src/
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 2. Name your entities in the copy
|
|
44
|
+
|
|
45
|
+
The defaults are generic. Pass the entity in both cases:
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
<Grid
|
|
49
|
+
columnDefs={columns}
|
|
50
|
+
rowData={files}
|
|
51
|
+
emptyStateTitle="No files yet"
|
|
52
|
+
emptyStateDescription="Files will appear here once you upload one."
|
|
53
|
+
emptyStateAction={<OutlinedButton label="Upload" onClick={upload} />}
|
|
54
|
+
filteredEmptyStateTitle="No files found"
|
|
55
|
+
/>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 3. A host that filters `rowData` itself
|
|
59
|
+
|
|
60
|
+
If your search box lives outside the grid and you pass the filtered rows in,
|
|
61
|
+
the grid sees no rows at all, not a filter. Switch the copy on the query and
|
|
62
|
+
turn on the announcement:
|
|
63
|
+
|
|
64
|
+
**Before:**
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
<Grid rowData={visibleFiles} emptyStateTitle="No files found" />
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**After:**
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
<Grid
|
|
74
|
+
rowData={visibleFiles}
|
|
75
|
+
emptyStateTitle={query ? 'No files found' : 'No files yet'}
|
|
76
|
+
emptyStateDescription={
|
|
77
|
+
query
|
|
78
|
+
? 'Try a different search term.'
|
|
79
|
+
: 'Files will appear here once you upload one.'
|
|
80
|
+
}
|
|
81
|
+
emptyStateLive={!!query}
|
|
82
|
+
/>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 4. Drop a custom illustration
|
|
86
|
+
|
|
87
|
+
Remove `emptyStateIcon` unless the grid is not a list of things the user owns
|
|
88
|
+
— every empty list should show the same card.
|
|
89
|
+
|
|
90
|
+
### 5. Tests
|
|
91
|
+
|
|
92
|
+
A test that found the empty grid with `getByRole('status')` now needs
|
|
93
|
+
`emptyStateLive`, a column filter that leaves no rows, or a text query.
|
|
94
|
+
|
|
95
|
+
### 6. Overriding the overlay yourself
|
|
96
|
+
|
|
97
|
+
If you passed `additionalGridOptions.noRowsOverlayComponent`, the grid's
|
|
98
|
+
`overlayComponentSelector` now takes precedence for the no-rows and
|
|
99
|
+
no-matching-rows overlays. Pass your own `overlayComponentSelector` in
|
|
100
|
+
`additionalGridOptions` instead.
|
|
@@ -34,6 +34,7 @@ migration-guides/
|
|
|
34
34
|
| 0.16.0 | [legacy-file-manager-removal](0.16.0/legacy-file-manager-removal.md) | Legacy `DialFileManager`, its helpers and the `./file-manager` subpath removed; import them from `@epam/ai-dial-react-file-manager` |
|
|
35
35
|
| 0.16.0 | [caption-text-no-alert-role](0.16.0/caption-text-no-alert-role.md) | `CaptionText` / `ErrorText` drop `role="alert"`; 2.0 fields link their error and caption through `aria-describedby` |
|
|
36
36
|
| 0.16.0 | [legacy-analytics-and-steps-removal](0.16.0/legacy-analytics-and-steps-removal.md) | Legacy `DialAnalytics*` components and 1.0 `DialSteps` removed; use the 2.0 `Analytics*` components and `Steps` |
|
|
37
|
+
| 0.16.0 | [grid-empty-state-pattern](0.16.0/grid-empty-state-pattern.md) | `Grid` empty state: shared illustration, "yet"/"found" copy with new `filteredEmptyState*`, `emptyStateAction` and `emptyStateLive`; no-rows message no longer announced by default |
|
|
37
38
|
| 0.16.0 | [unused-legacy-components-removal](0.16.0/unused-legacy-components-removal.md) | 34 unused 1.0 components (`DialSelect`, `DialPopup`, `DialGrid`, `LazyDialJsonEditor` …) and `DialSchemaRenderer` removed in favour of their 2.0 counterparts; Monaco is no longer a peer |
|
|
38
39
|
|
|
39
40
|
---
|
|
@@ -34,12 +34,26 @@ export interface GridProps<T extends object = Record<string, unknown>> {
|
|
|
34
34
|
alternateOddRowColors?: boolean;
|
|
35
35
|
/** Placeholder of the column filter inputs. */
|
|
36
36
|
filterPlaceholder?: string;
|
|
37
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* Illustration of both empty states. Defaults to the shared placeholder-list
|
|
39
|
+
* card of `NoDataContent`; leave it unset so every empty list looks the same.
|
|
40
|
+
*/
|
|
38
41
|
emptyStateIcon?: ReactNode;
|
|
39
|
-
/** Headline
|
|
42
|
+
/** Headline when there are no rows, as "No [entities] yet". */
|
|
40
43
|
emptyStateTitle?: string;
|
|
41
|
-
/** Secondary line
|
|
44
|
+
/** Secondary line when there are no rows, as "[Entities] will appear here once [condition]." */
|
|
42
45
|
emptyStateDescription?: string;
|
|
46
|
+
/** Way forward when there are no rows, such as a create button. */
|
|
47
|
+
emptyStateAction?: ReactNode;
|
|
48
|
+
/**
|
|
49
|
+
* Announces the no-rows message. Turn it on when the host filters `rowData`
|
|
50
|
+
* itself, so the grid is empty because of a search. Defaults to `false`.
|
|
51
|
+
*/
|
|
52
|
+
emptyStateLive?: boolean;
|
|
53
|
+
/** Headline when the column filters leave no rows, as "No [entities] found". */
|
|
54
|
+
filteredEmptyStateTitle?: string;
|
|
55
|
+
/** Secondary line when the column filters leave no rows. */
|
|
56
|
+
filteredEmptyStateDescription?: string;
|
|
43
57
|
/** Shows the loading overlay. Defaults to `false`. */
|
|
44
58
|
loading?: boolean;
|
|
45
59
|
/** Draws a border around the grid. Defaults to `true`. */
|
|
@@ -75,6 +89,13 @@ export interface GridProps<T extends object = Record<string, unknown>> {
|
|
|
75
89
|
* columns sized to the available width, a row context menu, truncation
|
|
76
90
|
* tooltips, and an empty state.
|
|
77
91
|
*
|
|
92
|
+
* The empty state follows the Patterns 2.0 empty-state behaviour and has two
|
|
93
|
+
* forms. A grid with no rows says "No [entities] yet" and can offer an action;
|
|
94
|
+
* a grid whose column filters leave nothing says "No [entities] found" and is
|
|
95
|
+
* announced, since the user has just changed a filter. A host that filters
|
|
96
|
+
* `rowData` itself passes the "found" copy as `emptyStateTitle` and sets
|
|
97
|
+
* `emptyStateLive`.
|
|
98
|
+
*
|
|
78
99
|
* The selection column renders the 2.0 `Checkbox` and `Radio` instead of
|
|
79
100
|
* ag-Grid's own inputs, so selection looks and behaves like every other control
|
|
80
101
|
* in the kit and the select-all reaches the `mixed` state when the selection is
|
|
@@ -107,6 +128,16 @@ export interface GridProps<T extends object = Record<string, unknown>> {
|
|
|
107
128
|
* getContextMenuItems={(row) => [{ key: 'edit', label: 'Edit' }]}
|
|
108
129
|
* />
|
|
109
130
|
*
|
|
131
|
+
* // An empty grid with a way forward
|
|
132
|
+
* <Grid<Product>
|
|
133
|
+
* columnDefs={columns}
|
|
134
|
+
* rowData={[]}
|
|
135
|
+
* emptyStateTitle="No products yet"
|
|
136
|
+
* emptyStateDescription="Products will appear here once you add one."
|
|
137
|
+
* emptyStateAction={<OutlinedButton label="Add product" onClick={addProduct} />}
|
|
138
|
+
* filteredEmptyStateTitle="No products found"
|
|
139
|
+
* />
|
|
140
|
+
*
|
|
110
141
|
* // Dark native controls, including the date-filter calendar
|
|
111
142
|
* <Grid<Product> columnDefs={columns} rowData={products} colorScheme={GridColorScheme.Dark} />
|
|
112
143
|
* ```
|
|
@@ -125,9 +156,13 @@ export interface GridProps<T extends object = Record<string, unknown>> {
|
|
|
125
156
|
* @param [getRowId] - Extracts the unique id of a row. Defaults to its `id` field.
|
|
126
157
|
* @param [alternateOddRowColors=false] - Tints odd rows.
|
|
127
158
|
* @param [filterPlaceholder='Enter value'] - Placeholder of the column filter inputs.
|
|
128
|
-
* @param [emptyStateIcon] - Illustration of
|
|
129
|
-
* @param [emptyStateTitle='No
|
|
130
|
-
* @param [emptyStateDescription] - Secondary line
|
|
159
|
+
* @param [emptyStateIcon] - Illustration of both empty states. Defaults to the shared placeholder-list card.
|
|
160
|
+
* @param [emptyStateTitle='No items yet'] - Headline when there are no rows.
|
|
161
|
+
* @param [emptyStateDescription='Items will appear here once they are added.'] - Secondary line when there are no rows.
|
|
162
|
+
* @param [emptyStateAction] - Way forward when there are no rows.
|
|
163
|
+
* @param [emptyStateLive=false] - Announce the no-rows message; for a host that filters `rowData` itself.
|
|
164
|
+
* @param [filteredEmptyStateTitle='No items found'] - Headline when the column filters leave no rows.
|
|
165
|
+
* @param [filteredEmptyStateDescription='Try a different search term or check your filters.'] - Secondary line when the column filters leave no rows.
|
|
131
166
|
* @param [loading=false] - Shows the loading overlay.
|
|
132
167
|
* @param [wrapperBorder=true] - Draws a border around the grid.
|
|
133
168
|
* @param [withoutHeaderBorders=false] - Hides the vertical borders between header cells.
|
|
@@ -138,4 +173,4 @@ export interface GridProps<T extends object = Record<string, unknown>> {
|
|
|
138
173
|
* @param [colorScheme='light'] - AG Grid color scheme. `dark` paints native controls dark.
|
|
139
174
|
* @param [appearance='default'] - Visual treatment; `chat` draws the borderless "Chat table".
|
|
140
175
|
*/
|
|
141
|
-
export declare const Grid: <T extends object>({ columnDefs, rowData, additionalGridOptions, getContextMenuItems, className, ariaLabel, wrapCustomCellRenderers, disabledRowIds, selectedRowIds, onSelectionChange, onGridApiChange, getRowId, alternateOddRowColors, filterPlaceholder, emptyStateIcon, emptyStateTitle, emptyStateDescription, loading, wrapperBorder, withoutHeaderBorders, allowDisabledContextMenu, selectionMode, selectRowLabel, selectAllLabel, colorScheme, appearance, }: GridProps<T>) => import('react/jsx-runtime').JSX.Element;
|
|
176
|
+
export declare const Grid: <T extends object>({ columnDefs, rowData, additionalGridOptions, getContextMenuItems, className, ariaLabel, wrapCustomCellRenderers, disabledRowIds, selectedRowIds, onSelectionChange, onGridApiChange, getRowId, alternateOddRowColors, filterPlaceholder, emptyStateIcon, emptyStateTitle, emptyStateDescription, emptyStateAction, emptyStateLive, filteredEmptyStateTitle, filteredEmptyStateDescription, loading, wrapperBorder, withoutHeaderBorders, allowDisabledContextMenu, selectionMode, selectRowLabel, selectAllLabel, colorScheme, appearance, }: GridProps<T>) => import('react/jsx-runtime').JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IOverlayParams, OverlaySelectorFunc } from 'ag-grid-community';
|
|
2
|
+
import { NoDataContentProps } from '../../NoDataContent/NoDataContent';
|
|
3
|
+
/** What the grid shows for each of its two empty states. */
|
|
4
|
+
export interface GridEmptyStateParams {
|
|
5
|
+
/** The grid has no rows at all. */
|
|
6
|
+
empty: NoDataContentProps;
|
|
7
|
+
/** The grid has rows, but its column filters leave none of them. */
|
|
8
|
+
filtered: NoDataContentProps;
|
|
9
|
+
}
|
|
10
|
+
export type GridEmptyStateProps = IOverlayParams & GridEmptyStateParams;
|
|
11
|
+
/**
|
|
12
|
+
* The grid's no-rows and no-matching-rows overlays, both drawn with
|
|
13
|
+
* {@link NoDataContent} so an empty grid looks like every other empty list.
|
|
14
|
+
*/
|
|
15
|
+
export declare const GridEmptyState: ({ overlayType, empty, filtered, }: GridEmptyStateProps) => import('react/jsx-runtime').JSX.Element;
|
|
16
|
+
/**
|
|
17
|
+
* Hands the two empty overlays to {@link GridEmptyState} and leaves the rest —
|
|
18
|
+
* loading, exporting — to ag-Grid. The selector is read once, so what the
|
|
19
|
+
* overlay shows travels in `overlayComponentParams`, which ag-Grid refreshes.
|
|
20
|
+
*/
|
|
21
|
+
export declare const selectGridEmptyStateOverlay: OverlaySelectorFunc;
|
|
@@ -29,6 +29,14 @@ export interface NoDataContentProps {
|
|
|
29
29
|
* secondary line and an optional action. The icon is decorative, so it is
|
|
30
30
|
* hidden from assistive tech and the text carries the message on its own.
|
|
31
31
|
*
|
|
32
|
+
* Copy follows the Patterns 2.0 empty-state behaviour:
|
|
33
|
+
* - default: "No [entities] yet" / "[Entities] will appear here once [condition]."
|
|
34
|
+
* - Shared with me: "No [entities] yet" / "[Entities] other people share with you will show up here."
|
|
35
|
+
* - after a search or filter: "No [entities] found" / "Try a different search
|
|
36
|
+
* term or check your filters." — drop the part the list does not have — with `live`.
|
|
37
|
+
*
|
|
38
|
+
* Leave `icon` unset in a list, so every empty list shows the same card.
|
|
39
|
+
*
|
|
32
40
|
* @example
|
|
33
41
|
* ```tsx
|
|
34
42
|
* <NoDataContent
|
|
@@ -41,6 +41,10 @@ export interface SelectProps {
|
|
|
41
41
|
emptyStateTitle?: string;
|
|
42
42
|
emptyStateDescription?: string;
|
|
43
43
|
emptyStateIcon?: ReactNode;
|
|
44
|
+
/** Title when the search leaves no options, as "No [entities] found". Falls back to `emptyStateTitle`. */
|
|
45
|
+
filteredEmptyStateTitle?: string;
|
|
46
|
+
/** Description when the search leaves no options. Falls back to `emptyStateDescription`. */
|
|
47
|
+
filteredEmptyStateDescription?: string;
|
|
44
48
|
disabled?: boolean;
|
|
45
49
|
className?: string;
|
|
46
50
|
fieldClassName?: string;
|
|
@@ -113,6 +117,8 @@ export interface SelectProps {
|
|
|
113
117
|
* @param [emptyStateTitle="No options available"] - Title text when there are no options.
|
|
114
118
|
* @param [emptyStateDescription] - Description text when there are no options.
|
|
115
119
|
* @param [emptyStateIcon] - Icon to display when there are no options.
|
|
120
|
+
* @param [filteredEmptyStateTitle] - Title when the search leaves no options, as "No [entities] found". Falls back to `emptyStateTitle`; the message is announced.
|
|
121
|
+
* @param [filteredEmptyStateDescription] - Description when the search leaves no options, as "Try a different search term". Falls back to `emptyStateDescription`.
|
|
116
122
|
* @param [invalid] - Whether the select is in an invalid state, affecting styling.
|
|
117
123
|
* @param [disabled=false] - Disable the control.
|
|
118
124
|
* @param [className] - Additional CSS classes for the outer container.
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* icon, a menu item, a segmented-control segment — can match the ones the
|
|
14
14
|
* components draw themselves.
|
|
15
15
|
*
|
|
16
|
-
* Two deliberate departures inside the library:
|
|
17
|
-
* (`NoDataContent
|
|
16
|
+
* Two deliberate departures inside the library: an icon passed as an
|
|
17
|
+
* empty-state illustration (`NoDataContent`'s `icon`) uses a much lighter stroke,
|
|
18
18
|
* since a 1.5px line reads as a drawing at 16px and as a fence at 100px; and
|
|
19
19
|
* the checkbox glyph uses a heavier one, because it is a control mark sized to
|
|
20
20
|
* a 14px box rather than an icon from the set.
|