@agregio-solutions/design-system 1.102.6 → 2.0.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/dist/design-system.cjs +542 -623
- package/dist/design-system.js +7756 -27691
- package/dist/packages/components/Button/doc.md +33 -2
- package/dist/packages/components/Combobox/Combobox.d.ts +2 -2
- package/dist/packages/components/Combobox/doc.md +0 -4
- package/dist/packages/components/DataTable/DataTable.d.ts +15 -6
- package/dist/packages/components/DataTable/DataTableRow/DataTableRow.d.ts +1 -6
- package/dist/packages/components/DataTable/doc.md +495 -389
- package/dist/packages/components/DatePicker/DatePicker.d.ts +2 -2
- package/dist/packages/components/DatePicker/doc.md +0 -1
- package/dist/packages/components/DateRangePicker/DateRangePicker.d.ts +2 -2
- package/dist/packages/components/DateRangePicker/doc.md +0 -1
- package/dist/packages/components/Drawer/Drawer.d.ts +7 -24
- package/dist/packages/components/Drawer/doc.md +136 -106
- package/dist/packages/components/Dropdown/Dropdown.d.ts +1 -7
- package/dist/packages/components/Dropdown/doc.md +2 -29
- package/dist/packages/components/FileUpload/doc.md +0 -2
- package/dist/packages/components/Filter/Filter.d.ts +24 -10
- package/dist/packages/components/Filter/doc.md +31 -1
- package/dist/packages/components/Modal/doc.md +1 -2
- package/dist/packages/components/Navigation/Navigation.d.ts +2 -1
- package/dist/packages/components/Navigation/doc.md +14 -9
- package/dist/packages/components/NavigationItem/NavigationItem.d.ts +4 -0
- package/dist/packages/components/NavigationItem/doc.md +15 -3
- package/dist/packages/components/PageLayout/doc.md +190 -149
- package/dist/packages/components/Select/Select.d.ts +1 -1
- package/dist/packages/components/Select/doc.md +0 -9
- package/dist/packages/components/Slider/Slider.d.ts +3 -9
- package/dist/packages/components/Slider/doc.md +1 -4
- package/dist/packages/components/Tabs/Tab/Tab.d.ts +0 -5
- package/dist/packages/components/TextInput/TextInput.d.ts +2 -2
- package/dist/packages/components/TextInput/doc.md +0 -22
- package/dist/packages/components/TimeField/TimeField.d.ts +2 -2
- package/dist/packages/components/TimeField/doc.md +0 -1
- package/dist/packages/components/TimePicker/TimePicker.d.ts +2 -2
- package/dist/packages/components/Timeline/Timeline.styled.d.ts +15 -20
- package/dist/packages/components/Timeline/components/BlockLineContainer/BlockLineContainer.styled.d.ts +23 -27
- package/dist/packages/components/Timeline/components/GroupLineContainer/GroupLineContainer.styled.d.ts +3 -4
- package/dist/packages/components/Timeline/components/TimelineRange/TimelineRange.styled.d.ts +12 -16
- package/dist/packages/components/Timeline/doc.md +38 -1
- package/dist/packages/components/YearMonthPicker/YearMonthPicker.d.ts +2 -2
- package/dist/packages/components/YearMonthPicker/doc.md +0 -1
- package/dist/packages/ds-design-tokens/index.d.ts +1 -2
- package/dist/packages/ds-design-tokens/src/tokens.style.d.ts +138 -135
- package/dist/packages/index.d.ts +3 -4
- package/dist/packages/internal-components/FormGroupWrapper/FormGroupWrapper.d.ts +0 -12
- package/dist/public_docs/index.md +4 -1
- package/dist/public_docs/migration-guide-v2.md +444 -0
- package/package.json +6 -8
- package/dist/packages/ds-design-tokens/src/fontSize.style.d.ts +0 -60
- package/dist/packages/mui/mui-theme.d.ts +0 -3
|
@@ -32,7 +32,8 @@ export type Props = {
|
|
|
32
32
|
initialIsCollapsed?: boolean;
|
|
33
33
|
/**
|
|
34
34
|
* The current path of the navigation (from the router).
|
|
35
|
-
*
|
|
35
|
+
* Drives the active state of every `NavigationItem`: an item is active when the current path
|
|
36
|
+
* starts with its `href` (`/` is matched exactly), a dropdown when one of its sub links is.
|
|
36
37
|
*/
|
|
37
38
|
currentPath?: string;
|
|
38
39
|
/**
|
|
@@ -17,7 +17,7 @@ import { Meta, StoryObj } from "@storybook/react-vite";
|
|
|
17
17
|
import Navigation from "./Navigation";
|
|
18
18
|
import NavigationItem from "../NavigationItem/NavigationItem";
|
|
19
19
|
import { I18nProvider } from "react-aria-components";
|
|
20
|
-
import { fn } from "storybook/test";
|
|
20
|
+
import { expect, fn, within } from "storybook/test";
|
|
21
21
|
|
|
22
22
|
const meta: Meta<typeof Navigation> = {
|
|
23
23
|
component: Navigation,
|
|
@@ -42,6 +42,7 @@ type Story = StoryObj<typeof meta>;
|
|
|
42
42
|
export const Playground: Story = {
|
|
43
43
|
args: {
|
|
44
44
|
logo: "agregio",
|
|
45
|
+
currentPath: "/item-3",
|
|
45
46
|
onParametersClick: fn(),
|
|
46
47
|
onLogoutClick: fn(),
|
|
47
48
|
children: (
|
|
@@ -57,12 +58,7 @@ export const Playground: Story = {
|
|
|
57
58
|
]}
|
|
58
59
|
/>
|
|
59
60
|
|
|
60
|
-
<NavigationItem
|
|
61
|
-
label="Item 3"
|
|
62
|
-
href="/item-3"
|
|
63
|
-
iconLeft="bolt"
|
|
64
|
-
isActive
|
|
65
|
-
/>
|
|
61
|
+
<NavigationItem label="Item 3" href="/item-3" iconLeft="bolt" />
|
|
66
62
|
</>
|
|
67
63
|
),
|
|
68
64
|
},
|
|
@@ -100,20 +96,29 @@ export const InitialCollapsed: Story = {
|
|
|
100
96
|
export const WithSubItemActive: Story = {
|
|
101
97
|
args: {
|
|
102
98
|
...Playground.args,
|
|
99
|
+
currentPath: "/item-2-2",
|
|
103
100
|
children: (
|
|
104
101
|
<>
|
|
105
102
|
<NavigationItem
|
|
106
103
|
label="Item 1"
|
|
107
104
|
iconLeft="business"
|
|
108
|
-
defaultOpen
|
|
109
105
|
subLinks={[
|
|
110
106
|
{ href: "/item-2-1", label: "Item 1.1" },
|
|
111
|
-
{ href: "/item-2-2", label: "Item 1.2"
|
|
107
|
+
{ href: "/item-2-2", label: "Item 1.2" },
|
|
112
108
|
]}
|
|
113
109
|
/>
|
|
114
110
|
</>
|
|
115
111
|
),
|
|
116
112
|
},
|
|
113
|
+
play: async ({ canvasElement }) => {
|
|
114
|
+
const canvas = within(canvasElement);
|
|
115
|
+
await expect(
|
|
116
|
+
await canvas.findByRole("link", { name: "Item 1.2" }),
|
|
117
|
+
).toHaveAttribute("data-active", "true");
|
|
118
|
+
await expect(
|
|
119
|
+
canvas.getByRole("link", { name: "Item 1.1" }),
|
|
120
|
+
).toHaveAttribute("data-active", "false");
|
|
121
|
+
},
|
|
117
122
|
};
|
|
118
123
|
|
|
119
124
|
export const LotsOfItems: Story = {
|
|
@@ -21,6 +21,7 @@ export type Props = {
|
|
|
21
21
|
/**
|
|
22
22
|
* Whether the navigation item is active (meaning it's the current page).
|
|
23
23
|
* Only used if the navigation item is a link (has an href).
|
|
24
|
+
* @deprecated Pass `currentPath` to `Navigation` instead. Will be removed in V3.
|
|
24
25
|
*/
|
|
25
26
|
isActive?: boolean;
|
|
26
27
|
/**
|
|
@@ -30,6 +31,9 @@ export type Props = {
|
|
|
30
31
|
subLinks?: Array<{
|
|
31
32
|
href: string;
|
|
32
33
|
label: string;
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated Pass `currentPath` to `Navigation` instead. Will be removed in V3.
|
|
36
|
+
*/
|
|
33
37
|
isActive?: boolean;
|
|
34
38
|
/**
|
|
35
39
|
* The component to wrap the sub link in.
|
|
@@ -60,9 +60,15 @@ export const Link: Story = {
|
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
export const ActiveLink: Story = {
|
|
63
|
+
decorators: [
|
|
64
|
+
(Story) => (
|
|
65
|
+
<NavigationProvider currentPath="/some-url">
|
|
66
|
+
<Story />
|
|
67
|
+
</NavigationProvider>
|
|
68
|
+
),
|
|
69
|
+
],
|
|
63
70
|
args: {
|
|
64
71
|
...Link.args,
|
|
65
|
-
isActive: true,
|
|
66
72
|
},
|
|
67
73
|
play: async ({ canvasElement, args }) => {
|
|
68
74
|
const canvas = within(canvasElement);
|
|
@@ -135,14 +141,20 @@ export const LinkCollapsed: Story = {
|
|
|
135
141
|
export const LinkCollapsedActive: Story = {
|
|
136
142
|
decorators: [
|
|
137
143
|
(Story) => (
|
|
138
|
-
<NavigationProvider initialIsCollapsed={true}>
|
|
144
|
+
<NavigationProvider initialIsCollapsed={true} currentPath="/some-url">
|
|
139
145
|
<Story />
|
|
140
146
|
</NavigationProvider>
|
|
141
147
|
),
|
|
142
148
|
],
|
|
143
149
|
args: {
|
|
144
150
|
...Link.args,
|
|
145
|
-
|
|
151
|
+
},
|
|
152
|
+
play: async ({ canvasElement }) => {
|
|
153
|
+
const canvas = within(canvasElement);
|
|
154
|
+
await expect(canvas.getByRole("link")).toHaveAttribute(
|
|
155
|
+
"data-active",
|
|
156
|
+
"true",
|
|
157
|
+
);
|
|
146
158
|
},
|
|
147
159
|
};
|
|
148
160
|
|
|
@@ -33,12 +33,21 @@ import arrayOfLength from "@internal/arrayOfLength/arrayOfLength";
|
|
|
33
33
|
import { I18nProvider } from "react-aria-components";
|
|
34
34
|
import { useMemo } from "react";
|
|
35
35
|
import {
|
|
36
|
+
columnFilteringFeature,
|
|
36
37
|
createColumnHelper,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
createFilteredRowModel,
|
|
39
|
+
createPaginatedRowModel,
|
|
40
|
+
createSortedRowModel,
|
|
41
|
+
filterFn_arrIncludesSome,
|
|
42
|
+
filterFn_equals,
|
|
43
|
+
filterFn_includesString,
|
|
44
|
+
globalFilteringFeature,
|
|
45
|
+
rowPaginationFeature,
|
|
46
|
+
rowSortingFeature,
|
|
47
|
+
sortFn_alphanumeric,
|
|
48
|
+
sortFn_text,
|
|
49
|
+
tableFeatures,
|
|
50
|
+
useTable,
|
|
42
51
|
} from "@tanstack/react-table";
|
|
43
52
|
import DataTableHeader from "../DataTable/DataTableHeader/DataTableHeader";
|
|
44
53
|
import DataTableCell from "../DataTable/DataTableCell/DataTableCell";
|
|
@@ -49,6 +58,26 @@ import Checkbox from "../Checkbox/Checkbox";
|
|
|
49
58
|
import Switch from "../Switch/Switch";
|
|
50
59
|
import DataTable from "../DataTable/DataTable";
|
|
51
60
|
|
|
61
|
+
// Since react-table v9, every feature a table uses has to be registered through
|
|
62
|
+
// `tableFeatures()`, and the column helper is typed from that set.
|
|
63
|
+
const tableFeaturesSet = tableFeatures({
|
|
64
|
+
columnFilteringFeature,
|
|
65
|
+
globalFilteringFeature,
|
|
66
|
+
rowSortingFeature,
|
|
67
|
+
rowPaginationFeature,
|
|
68
|
+
// Register only the built-ins the columns use: the full `filterFns` / `sortFns`
|
|
69
|
+
// registries are deprecated because they pull every built-in into the bundle.
|
|
70
|
+
filterFns: {
|
|
71
|
+
arrIncludesSome: filterFn_arrIncludesSome,
|
|
72
|
+
equals: filterFn_equals,
|
|
73
|
+
includesString: filterFn_includesString,
|
|
74
|
+
},
|
|
75
|
+
sortFns: { alphanumeric: sortFn_alphanumeric, text: sortFn_text },
|
|
76
|
+
filteredRowModel: createFilteredRowModel(),
|
|
77
|
+
sortedRowModel: createSortedRowModel(),
|
|
78
|
+
paginatedRowModel: createPaginatedRowModel(),
|
|
79
|
+
});
|
|
80
|
+
|
|
52
81
|
const meta: Meta<typeof PageLayout> = {
|
|
53
82
|
component: PageLayout,
|
|
54
83
|
parameters: {
|
|
@@ -246,173 +275,185 @@ export const PageLayoutWithDataTable: Story = {
|
|
|
246
275
|
// Here starts the interesting stuff: columns definitions.
|
|
247
276
|
// All the features of the filters comes from those columns definitions
|
|
248
277
|
// Please read carefully each column, they all serve as a different example of how to use the filters
|
|
249
|
-
const columnHelper = createColumnHelper<User>();
|
|
278
|
+
const columnHelper = createColumnHelper<typeof tableFeaturesSet, User>();
|
|
250
279
|
|
|
251
280
|
const columns = useMemo(
|
|
252
|
-
() =>
|
|
253
|
-
columnHelper.
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
<
|
|
277
|
-
<b>Filter by day:</b>
|
|
278
|
-
|
|
279
|
-
{DAYS.map((day) => (
|
|
280
|
-
<Radio
|
|
281
|
-
label={day}
|
|
282
|
-
key={day}
|
|
283
|
-
checked={column.getFilterValue() === day}
|
|
284
|
-
onChange={() => column.setFilterValue(day)}
|
|
285
|
-
/>
|
|
286
|
-
))}
|
|
287
|
-
</div>
|
|
281
|
+
() =>
|
|
282
|
+
columnHelper.columns([
|
|
283
|
+
columnHelper.accessor("firstname", {
|
|
284
|
+
// Here, because there is no "FilterInDrawer" component, there will be nothing in the filter drawer related to the firstname
|
|
285
|
+
// But the firstname can still be filtered by the global filter (search input)
|
|
286
|
+
header: ({ header }) => (
|
|
287
|
+
<DataTableHeader
|
|
288
|
+
onSortClick={header.column.getToggleSortingHandler()}
|
|
289
|
+
sortDirection={header.column.getIsSorted() || "none"}
|
|
290
|
+
text="Firstname"
|
|
291
|
+
/>
|
|
292
|
+
),
|
|
293
|
+
cell: (props) => (
|
|
294
|
+
<DataTableCell>{props.getValue()}</DataTableCell>
|
|
295
|
+
),
|
|
296
|
+
}),
|
|
297
|
+
// Here is an example using a "FilterInDrawer" component that render a radio group to filter the day
|
|
298
|
+
// Please note the "filterFn" is "arrIncludes" for this king of value (Array<string>)
|
|
299
|
+
// Also note the usage of `satisfies TypeTableColumnWithFilter<typeof tableFeaturesSet, User>` to help you type check the column definition (because meta is a custom property)
|
|
300
|
+
// Finally, you will note that the Chips are auto-generated, if you do not want to use them you can set the `skipFilterChips` to true
|
|
301
|
+
columnHelper.accessor("day", {
|
|
302
|
+
id: "Day",
|
|
303
|
+
header: () => <DataTableHeader text="Day" />,
|
|
304
|
+
cell: (props) => (
|
|
305
|
+
<DataTableCell>{props.getValue()}</DataTableCell>
|
|
288
306
|
),
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
+
filterFn: "equals",
|
|
308
|
+
meta: {
|
|
309
|
+
FilterInDrawer: ({ column }) => (
|
|
310
|
+
<div>
|
|
311
|
+
<b>Filter by day:</b>
|
|
312
|
+
|
|
313
|
+
{DAYS.map((day) => (
|
|
314
|
+
<Radio
|
|
315
|
+
label={day}
|
|
316
|
+
key={day}
|
|
317
|
+
checked={column.getFilterValue() === day}
|
|
318
|
+
onChange={() => column.setFilterValue(day)}
|
|
319
|
+
/>
|
|
320
|
+
))}
|
|
321
|
+
</div>
|
|
322
|
+
),
|
|
323
|
+
} satisfies TypeTableColumnWithFilter<
|
|
324
|
+
typeof tableFeaturesSet,
|
|
325
|
+
User
|
|
326
|
+
>,
|
|
327
|
+
}),
|
|
328
|
+
// Here is another example using a "FilterInDrawer" component that render a checkbox group to filter the food
|
|
329
|
+
// Please note the "filterFn" is "arrIncludesSome" -> we want to include all entries that match at least one food
|
|
330
|
+
// Also note the usage of `satisfies TypeTableColumnWithFilter<typeof tableFeaturesSet, User>` to help you type check the column definition (because meta is a custom property)
|
|
331
|
+
// Finally, you will note that the Chips are auto-generated, if you do not want to use them you can set the `skipFilterChips` to true
|
|
332
|
+
columnHelper.accessor("foods", {
|
|
333
|
+
id: "Foods",
|
|
334
|
+
header: () => <DataTableHeader text="Foods" />,
|
|
335
|
+
cell: (props) => (
|
|
336
|
+
<DataTableCell>{props.getValue()?.join(", ")}</DataTableCell>
|
|
337
|
+
),
|
|
338
|
+
filterFn: "arrIncludesSome",
|
|
339
|
+
meta: {
|
|
340
|
+
FilterInDrawer: ({ column }) => (
|
|
341
|
+
<div style={{ marginTop: 8 }}>
|
|
342
|
+
<b>Filter by food (at least one):</b>
|
|
343
|
+
<CheckboxGroup
|
|
344
|
+
value={column.getFilterValue() as any}
|
|
345
|
+
onChange={(value) => column.setFilterValue(value)}
|
|
346
|
+
aria-label="Filter by food (at least one)"
|
|
347
|
+
>
|
|
348
|
+
{ALL_FOODS.map((food) => (
|
|
349
|
+
<div key={food}>
|
|
350
|
+
<Checkbox label={food} value={food} />
|
|
351
|
+
</div>
|
|
352
|
+
))}
|
|
353
|
+
</CheckboxGroup>
|
|
354
|
+
</div>
|
|
355
|
+
),
|
|
356
|
+
} satisfies TypeTableColumnWithFilter<
|
|
357
|
+
typeof tableFeaturesSet,
|
|
358
|
+
User
|
|
359
|
+
>,
|
|
360
|
+
}),
|
|
361
|
+
// Here is another example using a "FilterInDrawer" component that render a select to filter the organization
|
|
362
|
+
// Please note the "filterFn" is a custom function that will filter the data based on the organization id
|
|
363
|
+
// Also note the usage of `satisfies TypeTableColumnWithFilter<typeof tableFeaturesSet, User>` to help you type check the column definition (because meta is a custom property)
|
|
364
|
+
// And most important here, we have a custom meta property `filterChips` that will generate a chip to display the selected organization
|
|
365
|
+
// The Filter can not handle automatic chips when the data is a complex object, so you have to handle that manually
|
|
366
|
+
columnHelper.accessor("organization", {
|
|
367
|
+
id: "Organization",
|
|
368
|
+
header: () => <DataTableHeader text="Organization" />,
|
|
369
|
+
cell: (props) => (
|
|
370
|
+
<DataTableCell>{props.getValue()?.name}</DataTableCell>
|
|
371
|
+
),
|
|
372
|
+
filterFn: (row, _, filterValue) => {
|
|
373
|
+
if (!filterValue) return true;
|
|
374
|
+
return row.original.organization?.id === filterValue;
|
|
375
|
+
},
|
|
376
|
+
meta: {
|
|
377
|
+
filterChips: ({ column }) => {
|
|
378
|
+
const value = column.getFilterValue();
|
|
379
|
+
const organization = ORGANIZATIONS.find(
|
|
380
|
+
(org) => org.id === value,
|
|
381
|
+
);
|
|
382
|
+
if (!organization) return [];
|
|
383
|
+
return [
|
|
384
|
+
{
|
|
385
|
+
value: `Organization: ${organization.name}`,
|
|
386
|
+
onClose: () => column.setFilterValue(null),
|
|
387
|
+
},
|
|
388
|
+
];
|
|
389
|
+
},
|
|
390
|
+
FilterInDrawer: ({ column }) => (
|
|
391
|
+
<Select
|
|
392
|
+
id="organization-select"
|
|
393
|
+
label="Filter by organization:"
|
|
394
|
+
mode="single"
|
|
307
395
|
value={column.getFilterValue() as any}
|
|
308
|
-
onChange={column.setFilterValue}
|
|
309
|
-
|
|
396
|
+
onChange={(value) => column.setFilterValue(value)}
|
|
397
|
+
fullWidth
|
|
398
|
+
wrapperProps={{ style: { marginBottom: 8 } }}
|
|
310
399
|
>
|
|
311
|
-
{
|
|
312
|
-
<
|
|
313
|
-
|
|
314
|
-
|
|
400
|
+
{ORGANIZATIONS.map((organization) => (
|
|
401
|
+
<SelectItem
|
|
402
|
+
text={organization.name}
|
|
403
|
+
id={organization.id}
|
|
404
|
+
key={organization.id}
|
|
405
|
+
/>
|
|
315
406
|
))}
|
|
316
|
-
</
|
|
317
|
-
|
|
407
|
+
</Select>
|
|
408
|
+
),
|
|
409
|
+
} satisfies TypeTableColumnWithFilter<
|
|
410
|
+
typeof tableFeaturesSet,
|
|
411
|
+
User
|
|
412
|
+
>,
|
|
413
|
+
}),
|
|
414
|
+
// Here is an example that uses a filter outside of the drawer.
|
|
415
|
+
// See the "extraLeftContent" prop to see how to connect it to react-table filtering features
|
|
416
|
+
columnHelper.accessor("isActive", {
|
|
417
|
+
header: () => <DataTableHeader text="Active" />,
|
|
418
|
+
cell: (props) => (
|
|
419
|
+
<DataTableCell>{props.getValue() ? "✅" : "❌"}</DataTableCell>
|
|
318
420
|
),
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
// Please note the "filterFn" is a custom function that will filter the data based on the organization id
|
|
323
|
-
// Also note the usage of `satisfies TypeTableColumnWithFilter<User>` to help you type check the column definition (because meta is a custom property)
|
|
324
|
-
// And most important here, we have a custom meta property `filterChips` that will generate a chip to display the selected organization
|
|
325
|
-
// The Filter can not handle automatic chips when the data is a complex object, so you have to handle that manually
|
|
326
|
-
columnHelper.accessor("organization", {
|
|
327
|
-
id: "Organization",
|
|
328
|
-
header: () => <DataTableHeader text="Organization" />,
|
|
329
|
-
cell: (props) => (
|
|
330
|
-
<DataTableCell>{props.getValue()?.name}</DataTableCell>
|
|
331
|
-
),
|
|
332
|
-
filterFn: (row, _, filterValue) => {
|
|
333
|
-
if (!filterValue) return true;
|
|
334
|
-
return row.original.organization?.id === filterValue;
|
|
335
|
-
},
|
|
336
|
-
meta: {
|
|
337
|
-
filterChips: ({ column }) => {
|
|
338
|
-
const value = column.getFilterValue();
|
|
339
|
-
const organization = ORGANIZATIONS.find(
|
|
340
|
-
(org) => org.id === value,
|
|
341
|
-
);
|
|
342
|
-
if (!organization) return [];
|
|
343
|
-
return [
|
|
344
|
-
{
|
|
345
|
-
value: `Organization: ${organization.name}`,
|
|
346
|
-
onClose: () => column.setFilterValue(null),
|
|
347
|
-
},
|
|
348
|
-
];
|
|
421
|
+
filterFn: (row, _, filterValue) => {
|
|
422
|
+
if (!filterValue) return true;
|
|
423
|
+
return !!row.original.isActive;
|
|
349
424
|
},
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
>
|
|
360
|
-
{ORGANIZATIONS.map((organization) => (
|
|
361
|
-
<SelectItem
|
|
362
|
-
text={organization.name}
|
|
363
|
-
id={organization.id}
|
|
364
|
-
key={organization.id}
|
|
365
|
-
/>
|
|
366
|
-
))}
|
|
367
|
-
</Select>
|
|
425
|
+
}),
|
|
426
|
+
// Here is an example of an empty column, for example to display an actions bar
|
|
427
|
+
// You can note that the header is empty, the text is optional
|
|
428
|
+
columnHelper.display({
|
|
429
|
+
id: "actions",
|
|
430
|
+
header: () => <DataTableHeader />,
|
|
431
|
+
cell: () => (
|
|
432
|
+
<DataTableCell>
|
|
433
|
+
<Button mode="secondary" iconLeft="edit" />
|
|
434
|
+
</DataTableCell>
|
|
368
435
|
),
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
// Here is an example that uses a filter outside of the drawer.
|
|
372
|
-
// See the "extraLeftContent" prop to see how to connect it to react-table filtering features
|
|
373
|
-
columnHelper.accessor("isActive", {
|
|
374
|
-
header: () => <DataTableHeader text="Active" />,
|
|
375
|
-
cell: (props) => (
|
|
376
|
-
<DataTableCell>{props.getValue() ? "✅" : "❌"}</DataTableCell>
|
|
377
|
-
),
|
|
378
|
-
filterFn: (row, _, filterValue) => {
|
|
379
|
-
if (!filterValue) return true;
|
|
380
|
-
return !!row.original.isActive;
|
|
381
|
-
},
|
|
382
|
-
}),
|
|
383
|
-
// Here is an example of an empty column, for example to display an actions bar
|
|
384
|
-
// You can note that the header is empty, the text is optional
|
|
385
|
-
columnHelper.display({
|
|
386
|
-
id: "actions",
|
|
387
|
-
header: () => <DataTableHeader />,
|
|
388
|
-
cell: () => (
|
|
389
|
-
<DataTableCell>
|
|
390
|
-
<Button mode="secondary" iconLeft="edit" />
|
|
391
|
-
</DataTableCell>
|
|
392
|
-
),
|
|
393
|
-
}),
|
|
394
|
-
],
|
|
436
|
+
}),
|
|
437
|
+
]),
|
|
395
438
|
[ALL_FOODS, DAYS, ORGANIZATIONS, columnHelper],
|
|
396
439
|
);
|
|
397
440
|
|
|
398
441
|
// And here we define the table as usual
|
|
399
|
-
const table =
|
|
442
|
+
const table = useTable({
|
|
443
|
+
features: tableFeaturesSet,
|
|
400
444
|
data,
|
|
401
445
|
columns,
|
|
402
446
|
initialState: {
|
|
403
447
|
globalFilter: "",
|
|
404
448
|
pagination: {
|
|
449
|
+
pageIndex: 0,
|
|
405
450
|
pageSize: 50,
|
|
406
451
|
},
|
|
407
452
|
},
|
|
408
|
-
getCoreRowModel: getCoreRowModel(),
|
|
409
|
-
getSortedRowModel: getSortedRowModel(),
|
|
410
|
-
getFilteredRowModel: getFilteredRowModel(),
|
|
411
|
-
getPaginationRowModel: getPaginationRowModel(),
|
|
412
453
|
});
|
|
413
454
|
|
|
414
455
|
// Get the pagination state
|
|
415
|
-
const pagination = table.
|
|
456
|
+
const pagination = table.state.pagination;
|
|
416
457
|
|
|
417
458
|
// Render the table using the base DataTable component
|
|
418
459
|
return (
|
|
@@ -446,7 +487,7 @@ export const PageLayoutWithDataTable: Story = {
|
|
|
446
487
|
>
|
|
447
488
|
<>
|
|
448
489
|
<Header title={"Test"} />
|
|
449
|
-
<Filter
|
|
490
|
+
<Filter
|
|
450
491
|
onDownloadClick={() => alert("Download")}
|
|
451
492
|
onSettingsClick={() => alert("Settings")}
|
|
452
493
|
table={table}
|
|
@@ -2,7 +2,7 @@ import { default as React } from 'react';
|
|
|
2
2
|
import { ButtonProps } from 'react-aria-components';
|
|
3
3
|
import { Props as FormGroupWrapperProps } from '../../internal-components/FormGroupWrapper/FormGroupWrapper';
|
|
4
4
|
import { Props as LabelProps } from '../Label/Label';
|
|
5
|
-
interface GenericProps extends Pick<LabelProps, "label" | "labelIconRight" | "labelIconRightTooltip" | "required">, Pick<FormGroupWrapperProps, "
|
|
5
|
+
interface GenericProps extends Pick<LabelProps, "label" | "labelIconRight" | "labelIconRightTooltip" | "required">, Pick<FormGroupWrapperProps, "helperText" | "helperTextIcon" | "errorHelperText" | "errorHelperTextIcon" | "successHelperText" | "successHelperTextIcon" | "warningHelperText" | "warningHelperTextIcon" | "orientation"> {
|
|
6
6
|
/**
|
|
7
7
|
* Required id, used mainly to link the label to the field
|
|
8
8
|
*/
|
|
@@ -26,7 +26,6 @@ const meta: Meta<typeof Select> = {
|
|
|
26
26
|
open: { control: false },
|
|
27
27
|
helperText: { control: { type: "text" } },
|
|
28
28
|
label: { control: { type: "text" } },
|
|
29
|
-
description: { control: { type: "text" } },
|
|
30
29
|
children: { control: false },
|
|
31
30
|
mode: { control: false },
|
|
32
31
|
errorHelperText: { control: { type: "text" } },
|
|
@@ -62,7 +61,6 @@ export const Playground: StoryObj<typeof Select> = {
|
|
|
62
61
|
labelIconRight: "help_outline",
|
|
63
62
|
labelIconRightTooltip: "Additional information",
|
|
64
63
|
required: true,
|
|
65
|
-
description: "[Insert description]",
|
|
66
64
|
name: "my-select",
|
|
67
65
|
helperText: "[Insert helper]",
|
|
68
66
|
helperTextIcon: "help_outline",
|
|
@@ -75,7 +73,6 @@ export const Playground: StoryObj<typeof Select> = {
|
|
|
75
73
|
const canvas = within(canvasElement);
|
|
76
74
|
await canvas.findByTitle("Required");
|
|
77
75
|
await canvas.findByText("[Insert label]");
|
|
78
|
-
await canvas.findByText("[Insert description]");
|
|
79
76
|
await canvas.findByText("[Insert helper]");
|
|
80
77
|
},
|
|
81
78
|
};
|
|
@@ -154,7 +151,6 @@ export const WithHorizontalOrientation: StoryObj<typeof Select> = {
|
|
|
154
151
|
...Playground.args,
|
|
155
152
|
fullWidth: false,
|
|
156
153
|
orientation: "horizontal",
|
|
157
|
-
description: undefined,
|
|
158
154
|
wrapperProps: undefined,
|
|
159
155
|
},
|
|
160
156
|
};
|
|
@@ -229,7 +225,6 @@ const meta: Meta<typeof Select> = {
|
|
|
229
225
|
open: { control: false },
|
|
230
226
|
helperText: { control: { type: "text" } },
|
|
231
227
|
label: { control: { type: "text" } },
|
|
232
|
-
description: { control: { type: "text" } },
|
|
233
228
|
children: { control: false },
|
|
234
229
|
mode: { control: false },
|
|
235
230
|
errorHelperText: { control: { type: "text" } },
|
|
@@ -293,7 +288,6 @@ export const Playground: StoryObj<typeof Select> = {
|
|
|
293
288
|
labelIconRight: "help_outline",
|
|
294
289
|
labelIconRightTooltip: "Additional information",
|
|
295
290
|
required: true,
|
|
296
|
-
description: "[Insert description]",
|
|
297
291
|
helperText: "[Insert helper]",
|
|
298
292
|
helperTextIcon: "help_outline",
|
|
299
293
|
fullWidth: true,
|
|
@@ -305,7 +299,6 @@ export const Playground: StoryObj<typeof Select> = {
|
|
|
305
299
|
const canvas = within(canvasElement);
|
|
306
300
|
await canvas.findByTitle("Required");
|
|
307
301
|
await canvas.findByText("[Insert label]");
|
|
308
|
-
await canvas.findByText("[Insert description]");
|
|
309
302
|
await canvas.findByText("[Insert helper]");
|
|
310
303
|
},
|
|
311
304
|
};
|
|
@@ -360,7 +353,6 @@ export const WithHorizontalOrientation: StoryObj<typeof Select> = {
|
|
|
360
353
|
...Playground.args,
|
|
361
354
|
fullWidth: false,
|
|
362
355
|
orientation: "horizontal",
|
|
363
|
-
description: undefined,
|
|
364
356
|
wrapperProps: undefined,
|
|
365
357
|
},
|
|
366
358
|
};
|
|
@@ -439,7 +431,6 @@ const meta: Meta<typeof Select> = {
|
|
|
439
431
|
open: { control: { type: "boolean" } },
|
|
440
432
|
helperText: { control: { type: "text" } },
|
|
441
433
|
label: { control: { type: "text" } },
|
|
442
|
-
description: { control: { type: "text" } },
|
|
443
434
|
},
|
|
444
435
|
parameters: {
|
|
445
436
|
layout: "centered",
|
|
@@ -62,11 +62,11 @@ export interface Props {
|
|
|
62
62
|
*/
|
|
63
63
|
id?: string;
|
|
64
64
|
/**
|
|
65
|
-
* The style of the wrapper element that contains the slider but also the label,
|
|
65
|
+
* The style of the wrapper element that contains the slider but also the label, helperText, etc.
|
|
66
66
|
*/
|
|
67
67
|
style?: React.CSSProperties;
|
|
68
68
|
/**
|
|
69
|
-
* The className of the wrapper element that contains the slider but also the label,
|
|
69
|
+
* The className of the wrapper element that contains the slider but also the label, helperText, etc.
|
|
70
70
|
*/
|
|
71
71
|
className?: string;
|
|
72
72
|
/**
|
|
@@ -78,18 +78,12 @@ export interface Props {
|
|
|
78
78
|
* Requires `labelIconRight` to be set. When provided, the icon is wrapped in a Tooltip.
|
|
79
79
|
*/
|
|
80
80
|
labelIconRightTooltip?: string;
|
|
81
|
-
/**
|
|
82
|
-
* Optional description to display under the label and above the field
|
|
83
|
-
*/
|
|
84
|
-
description?: string | React.ReactNode;
|
|
85
81
|
/**
|
|
86
82
|
* Helper text displayed below the input field, like additional instructions.
|
|
87
|
-
* @deprecated use `description` instead
|
|
88
83
|
*/
|
|
89
84
|
helperText?: string | React.ReactNode;
|
|
90
85
|
/**
|
|
91
86
|
* Optional icon to display on the left side of the helperText. Only visible if there is a helperText
|
|
92
|
-
* @deprecated will be removed in v2
|
|
93
87
|
*/
|
|
94
88
|
helperTextIcon?: IconName;
|
|
95
89
|
/**
|
|
@@ -113,4 +107,4 @@ export interface Props {
|
|
|
113
107
|
*/
|
|
114
108
|
"aria-label"?: string;
|
|
115
109
|
}
|
|
116
|
-
export default function Slider({ id, label, minValue, maxValue, step, isDisabled, style, className, onChange, onChangeEnd, value: initialValue, thumbLabels, labelIconRight, labelIconRightTooltip,
|
|
110
|
+
export default function Slider({ id, label, minValue, maxValue, step, isDisabled, style, className, onChange, onChangeEnd, value: initialValue, thumbLabels, labelIconRight, labelIconRightTooltip, helperText, helperTextIcon, errorHelperText, errorHelperTextIcon, successHelperText, successHelperTextIcon, isInvalid, withTrackDots, ...otherProps }: Props): React.JSX.Element;
|