@igne-agency/react-web-ui 0.3.0 → 0.4.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/README.md +32 -1
- package/dist/components/accordion/accordion.css +24 -19
- package/dist/components/accordion/accordion.d.ts +19 -3
- package/dist/components/accordion/accordion.js +86 -32
- package/dist/components/accordion/accordion.module.js +8 -8
- package/dist/components/active-filters/active-filter-describers.d.ts +1 -1
- package/dist/components/active-filters/active-filter-describers.js +1 -1
- package/dist/components/active-filters/active-filters.d.ts +35 -2
- package/dist/components/active-filters/active-filters.js +57 -52
- package/dist/components/active-filters/index.js +2 -2
- package/dist/components/attachment-tile/attachment-preview.d.ts +11 -9
- package/dist/components/attachment-tile/attachment-preview.js +102 -68
- package/dist/components/attachment-tile/attachment-tile.css +22 -13
- package/dist/components/attachment-tile/attachment-tile.d.ts +51 -6
- package/dist/components/attachment-tile/attachment-tile.js +209 -85
- package/dist/components/attachment-tile/attachment-tile.module.js +10 -10
- package/dist/components/attachment-tile/index.d.ts +1 -1
- package/dist/components/attachment-tile/index.js +2 -2
- package/dist/components/avatar/avatar.d.ts +5 -5
- package/dist/components/avatar/avatar.js +64 -37
- package/dist/components/avatar-group/avatar-group.js +2 -2
- package/dist/components/badge/badge.js +1 -1
- package/dist/components/breadcrumbs/breadcrumbs.d.ts +22 -7
- package/dist/components/breadcrumbs/breadcrumbs.js +189 -170
- package/dist/components/button/button.d.ts +2 -3
- package/dist/components/button/button.js +58 -77
- package/dist/components/button/close-button.d.ts +4 -2
- package/dist/components/button/close-button.js +9 -9
- package/dist/components/checkbox-field/checkbox-field.d.ts +17 -3
- package/dist/components/checkbox-field/checkbox-field.js +108 -131
- package/dist/components/checkbox-field/checkbox.css +26 -34
- package/dist/components/checkbox-field/checkbox.d.ts +51 -8
- package/dist/components/checkbox-field/checkbox.js +221 -57
- package/dist/components/checkbox-field/checkbox.module.js +6 -8
- package/dist/components/checkbox-field/index.d.ts +0 -1
- package/dist/components/checkbox-field/index.js +1 -2
- package/dist/components/checkbox-field/tsf-checkbox-field.d.ts +2 -2
- package/dist/components/checkbox-group-field/checkbox-group-field.d.ts +4 -1
- package/dist/components/checkbox-group-field/checkbox-group-field.js +54 -50
- package/dist/components/checkbox-group-field/checkbox-group.d.ts +7 -2
- package/dist/components/checkbox-group-field/checkbox-group.js +8 -3
- package/dist/components/collapsible/collapsible.css +23 -18
- package/dist/components/collapsible/collapsible.d.ts +18 -3
- package/dist/components/collapsible/collapsible.js +85 -32
- package/dist/components/collapsible/collapsible.module.js +7 -7
- package/dist/components/combobox-field/combobox-field.d.ts +9 -1
- package/dist/components/combobox-field/combobox-field.js +195 -175
- package/dist/components/combobox-field/combobox-items.d.ts +2 -2
- package/dist/components/combobox-field/combobox-items.js +4 -4
- package/dist/components/combobox-field/combobox.css +99 -96
- package/dist/components/combobox-field/combobox.d.ts +94 -15
- package/dist/components/combobox-field/combobox.js +484 -159
- package/dist/components/combobox-field/combobox.module.js +21 -21
- package/dist/components/combobox-field/index.d.ts +0 -1
- package/dist/components/combobox-field/selection.d.ts +4 -1
- package/dist/components/combobox-field/value-state-view.css +7 -3
- package/dist/components/combobox-field/value-state-view.d.ts +4 -2
- package/dist/components/combobox-field/value-state-view.js +15 -15
- package/dist/components/combobox-field/value-state-view.module.js +6 -4
- package/dist/components/composer/composer-attachments.d.ts +11 -3
- package/dist/components/composer/composer-attachments.js +61 -47
- package/dist/components/composer/composer-editor.d.ts +2 -1
- package/dist/components/composer/composer-editor.js +79 -71
- package/dist/components/composer/composer-mentions.js +2 -2
- package/dist/components/composer/composer.d.ts +42 -21
- package/dist/components/composer/composer.js +201 -58
- package/dist/components/composer/mention-text.js +3 -3
- package/dist/components/confirm-dialog/confirm-dialog.d.ts +8 -7
- package/dist/components/confirm-dialog/confirm-dialog.js +10 -9
- package/dist/components/conversation/conversation.context.d.ts +0 -5
- package/dist/components/conversation/conversation.d.ts +63 -29
- package/dist/components/conversation/conversation.js +193 -82
- package/dist/components/conversation/index.d.ts +1 -1
- package/dist/components/date-field/date-field.d.ts +10 -4
- package/dist/components/date-field/date-field.js +57 -43
- package/dist/components/date-field/date-input.d.ts +20 -3
- package/dist/components/date-field/date-input.js +28 -13
- package/dist/components/date-field/index.d.ts +1 -1
- package/dist/components/date-field/tsf-date-field.d.ts +1 -1
- package/dist/components/date-field/tsf-date-field.js +1 -1
- package/dist/components/date-range-field/date-range-field.d.ts +8 -4
- package/dist/components/date-range-field/date-range-field.js +57 -45
- package/dist/components/date-range-field/date-range-input.d.ts +20 -3
- package/dist/components/date-range-field/date-range-input.js +27 -12
- package/dist/components/date-range-field/tsf-date-range-field.d.ts +1 -1
- package/dist/components/date-range-field/tsf-date-range-field.js +1 -1
- package/dist/components/detail-list/detail-list.d.ts +28 -27
- package/dist/components/detail-list/detail-list.js +177 -121
- package/dist/components/dialog/dialog.d.ts +47 -27
- package/dist/components/dialog/dialog.js +101 -38
- package/dist/components/divider/divider.js +1 -1
- package/dist/components/drawer/drawer.d.ts +48 -30
- package/dist/components/drawer/drawer.js +113 -41
- package/dist/components/email-field/email-field.d.ts +5 -3
- package/dist/components/email-field/email-field.js +1 -3
- package/dist/components/email-field/tsf-email-field.d.ts +3 -2
- package/dist/components/empty-message/empty-message.d.ts +3 -3
- package/dist/components/empty-message/empty-message.js +3 -3
- package/dist/components/error-boundary/error-boundary.d.ts +5 -2
- package/dist/components/error-boundary/error-boundary.js +2 -3
- package/dist/components/error-message/error-message.d.ts +1 -1
- package/dist/components/error-message/error-message.js +1 -1
- package/dist/components/error-text/error-text.js +3 -3
- package/dist/components/field/field.d.ts +5 -5
- package/dist/components/field/field.js +9 -9
- package/dist/components/field/index.js +2 -2
- package/dist/components/field/input-parts.js +1 -1
- package/dist/components/field-placeholder/field-placeholder.d.ts +4 -1
- package/dist/components/field-placeholder/field-placeholder.js +41 -26
- package/dist/components/fieldset/field-group.js +1 -1
- package/dist/components/fieldset/fieldset-root.js +1 -1
- package/dist/components/fieldset/fieldset.css +4 -3
- package/dist/components/fieldset/fieldset.js +1 -1
- package/dist/components/fieldset/fieldset.module.js +2 -2
- package/dist/components/file-field/file-field.css +19 -15
- package/dist/components/file-field/file-field.d.ts +10 -1
- package/dist/components/file-field/file-field.js +130 -109
- package/dist/components/file-field/file-field.module.js +6 -4
- package/dist/components/file-field/file-input.d.ts +32 -9
- package/dist/components/file-field/file-input.js +94 -74
- package/dist/components/filter-bar/filter-bar.d.ts +79 -51
- package/dist/components/filter-bar/filter-bar.js +552 -216
- package/dist/components/form/form.d.ts +4 -6
- package/dist/components/form/form.js +6 -8
- package/dist/components/icon/icon.d.ts +5 -10
- package/dist/components/icon/icon.js +4 -6
- package/dist/components/link/link.js +1 -1
- package/dist/components/link-button/link-button.d.ts +1 -2
- package/dist/components/link-button/link-button.js +12 -22
- package/dist/components/loading-message/loading-message.d.ts +2 -2
- package/dist/components/loading-message/loading-message.js +1 -1
- package/dist/components/locale-provider/locale-provider.js +1 -1
- package/dist/components/menu/menu.d.ts +40 -22
- package/dist/components/menu/menu.js +100 -40
- package/dist/components/nav/nav-context.d.ts +0 -1
- package/dist/components/nav/nav-context.js +1 -2
- package/dist/components/nav/nav-item-view.d.ts +7 -7
- package/dist/components/nav/nav-item-view.js +27 -51
- package/dist/components/nav/nav.css +72 -60
- package/dist/components/nav/nav.d.ts +15 -8
- package/dist/components/nav/nav.js +105 -52
- package/dist/components/nav/nav.module.js +14 -14
- package/dist/components/number-field/number-field.d.ts +7 -1
- package/dist/components/number-field/number-field.js +98 -82
- package/dist/components/number-field/number-input.d.ts +53 -4
- package/dist/components/number-field/number-input.js +68 -21
- package/dist/components/number-field/tsf-number-field.d.ts +1 -1
- package/dist/components/number-field/tsf-number-field.js +1 -1
- package/dist/components/otp-field/otp-input.d.ts +25 -0
- package/dist/components/otp-field/otp-input.js +26 -1
- package/dist/components/pagination/pagination.d.ts +82 -23
- package/dist/components/pagination/pagination.js +656 -229
- package/dist/components/password-field/password-field.d.ts +7 -1
- package/dist/components/password-field/password-field.js +117 -126
- package/dist/components/password-field/password-strength.js +1 -1
- package/dist/components/password-field/tsf-password-field.d.ts +1 -1
- package/dist/components/password-field/tsf-password-field.js +1 -1
- package/dist/components/photo-field/photo-field.d.ts +17 -3
- package/dist/components/photo-field/photo-field.js +168 -89
- package/dist/components/photo-field/photo-input-context.d.ts +25 -0
- package/dist/components/photo-field/photo-input-context.js +14 -0
- package/dist/components/photo-field/photo-input.d.ts +58 -23
- package/dist/components/photo-field/photo-input.js +459 -261
- package/dist/components/popover/popover.d.ts +55 -23
- package/dist/components/popover/popover.js +205 -61
- package/dist/components/radio-group-field/radio-group.js +1 -1
- package/dist/components/search-field/search-field.d.ts +7 -5
- package/dist/components/search-field/search-field.js +4 -6
- package/dist/components/search-field/tsf-search-field.d.ts +1 -1
- package/dist/components/search-field/tsf-search-field.js +1 -1
- package/dist/components/segmented-control-field/segmented-control.js +1 -1
- package/dist/components/select-field/select-field.d.ts +7 -1
- package/dist/components/select-field/select-field.js +151 -139
- package/dist/components/select-field/select.d.ts +28 -6
- package/dist/components/select-field/select.js +234 -149
- package/dist/components/skeleton/skeleton.js +1 -1
- package/dist/components/spinner/spinner.css +47 -1
- package/dist/components/spinner/spinner.js +28 -11
- package/dist/components/spinner/spinner.module.js +18 -3
- package/dist/components/stale/stale.d.ts +17 -21
- package/dist/components/stale/stale.js +307 -129
- package/dist/components/status-message/status-message.css +22 -21
- package/dist/components/status-message/status-message.d.ts +10 -5
- package/dist/components/status-message/status-message.js +20 -24
- package/dist/components/status-message/status-message.module.js +6 -6
- package/dist/components/status-message/status-preset.d.ts +4 -5
- package/dist/components/status-message/status-preset.js +3 -3
- package/dist/components/switch-field/switch.js +1 -1
- package/dist/components/tabs/tabs.d.ts +51 -28
- package/dist/components/tabs/tabs.js +219 -144
- package/dist/components/tag/tag.css +23 -21
- package/dist/components/tag/tag.d.ts +17 -15
- package/dist/components/tag/tag.js +140 -65
- package/dist/components/tag/tag.module.js +3 -3
- package/dist/components/tag-group/tag-group.css +30 -27
- package/dist/components/tag-group/tag-group.d.ts +10 -4
- package/dist/components/tag-group/tag-group.js +47 -35
- package/dist/components/tag-group/tag-group.module.js +4 -4
- package/dist/components/text-field/text-field.d.ts +14 -3
- package/dist/components/text-field/text-field.js +154 -133
- package/dist/components/text-field/text-input.d.ts +89 -3
- package/dist/components/text-field/text-input.js +184 -70
- package/dist/components/textarea-field/textarea.js +1 -1
- package/dist/components/time-field/time-input.d.ts +6 -0
- package/dist/components/time-field/time-input.js +6 -0
- package/dist/components/time-zone-provider/time-zone-provider.js +1 -1
- package/dist/components/toast/index.js +2 -2
- package/dist/components/toast/toast-provider.css +38 -34
- package/dist/components/toast/toast-provider.d.ts +65 -3
- package/dist/components/toast/toast-provider.js +313 -148
- package/dist/components/toast/toast-provider.module.js +11 -17
- package/dist/components/toast/toast.d.ts +5 -1
- package/dist/components/toast/toast.js +2 -1
- package/dist/components/toggle-group-field/toggle-group.js +1 -1
- package/dist/components/tooltip/tooltip.d.ts +6 -6
- package/dist/components/tooltip/tooltip.js +7 -7
- package/dist/data-table/data-table-content.d.ts +18 -10
- package/dist/data-table/data-table-content.js +145 -290
- package/dist/data-table/data-table-context.d.ts +4 -2
- package/dist/data-table/data-table-context.js +1 -1
- package/dist/data-table/data-table-parts.d.ts +99 -0
- package/dist/data-table/data-table-parts.js +1182 -0
- package/dist/data-table/data-table-selection.d.ts +7 -3
- package/dist/data-table/data-table-selection.js +62 -37
- package/dist/data-table/data-table.css +100 -95
- package/dist/data-table/data-table.d.ts +49 -25
- package/dist/data-table/data-table.js +95 -83
- package/dist/data-table/data-table.module.js +34 -34
- package/dist/data-table/index.d.ts +2 -1
- package/dist/data-table/index.js +2 -1
- package/dist/data-view/use-data-view.d.ts +2 -2
- package/dist/data-view/use-data-view.js +2 -2
- package/dist/index.js +7 -8
- package/dist/lib/calendar/calendar-navigation.d.ts +9 -2
- package/dist/lib/calendar/calendar-navigation.js +72 -73
- package/dist/lib/calendar/calendar-year.d.ts +4 -3
- package/dist/lib/calendar/calendar-year.js +137 -156
- package/dist/lib/calendar/temporal.d.ts +18 -12
- package/dist/lib/calendar/temporal.js +191 -147
- package/dist/lib/table-storage.d.ts +2 -2
- package/dist/lib/table-storage.js +2 -2
- package/dist/lib/unsaved-changes/leave-guard.js +1 -1
- package/dist/terrazzo/index.d.ts +16 -0
- package/dist/terrazzo/index.js +94 -2
- package/dist/tokens.css +71 -69
- package/package.json +3 -2
- package/tokens/ref.tokens.json +0 -30
- package/tokens/sys.tokens.json +0 -7
- package/dist/assets/spinner.js +0 -28
- package/dist/components/checkbox-field/checkbox-glyph.d.ts +0 -12
- package/dist/components/checkbox-field/checkbox-glyph.js +0 -38
- package/dist/components/combobox-field/combobox-popup-body.d.ts +0 -34
- package/dist/components/combobox-field/combobox-popup-body.js +0 -142
- package/dist/components/conversation/conversation.context.js +0 -4
- package/dist/vendor/@material-design-icons/svg/outlined/add.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/arrow_downward.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/arrow_forward.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/arrow_upward.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/attach_file.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/block.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/calendar_today.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/check.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/check_circle.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/chevron_left.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/chevron_right.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/close.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/content_copy.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/date_range.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/description.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/download.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/error.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/error_outline.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/expand_less.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/expand_more.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/filter_alt.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/filter_alt_off.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/first_page.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/info.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/keyboard_arrow_down.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/last_page.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/mail.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/more_horiz.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/photo_camera.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/remove.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/restart_alt.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/restore.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/search.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/unfold_more.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/upload_file.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/visibility.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/visibility_off.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/warning_amber.js +0 -12
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Row } from "@tanstack/react-table";
|
|
1
|
+
import type { Row as TableRow } from "@tanstack/react-table";
|
|
2
2
|
import { type ReactNode } from "react";
|
|
3
3
|
import type { DataTableFeatures } from "./table-features.ts";
|
|
4
4
|
export type DataTableContentProps<TData extends Record<string, unknown>> = Readonly<{
|
|
@@ -6,22 +6,30 @@ export type DataTableContentProps<TData extends Record<string, unknown>> = Reado
|
|
|
6
6
|
* Renders the expanded content for a row (TanStack expansion API). The
|
|
7
7
|
* returned node is placed in a full-width cell beneath the row.
|
|
8
8
|
*/
|
|
9
|
-
renderSubRow?: (row:
|
|
10
|
-
/** The body when the query matched nothing, such as "No
|
|
9
|
+
renderSubRow?: (row: TableRow<DataTableFeatures, TData>) => ReactNode;
|
|
10
|
+
/** The body when the query matched nothing, such as "No invoices yet." or an `EmptyMessage`. */
|
|
11
11
|
emptyState: ReactNode;
|
|
12
|
-
/** What a failed fetch says, as the body or above rows still on screen, such as "The
|
|
12
|
+
/** What a failed fetch says, as the body or above rows still on screen, such as "The invoices could not be loaded." */
|
|
13
13
|
errorLabel: string;
|
|
14
|
-
/** What is announced while the first page loads, as the table's caption, such as "Loading
|
|
14
|
+
/** What is announced while the first page loads, as the table's caption, such as "Loading invoices". */
|
|
15
15
|
loadingLabel: string;
|
|
16
16
|
/** What the overlay says when a refresh runs long, such as "This is taking longer than usual." */
|
|
17
|
-
slowLabel:
|
|
17
|
+
slowLabel: string;
|
|
18
18
|
/** The retry's label, such as "Try again". */
|
|
19
19
|
retryLabel: string;
|
|
20
|
+
/** The glyph on a header sorted ascending. */
|
|
21
|
+
sortAscendingIcon?: ReactNode;
|
|
22
|
+
/** The glyph on a header sorted descending. */
|
|
23
|
+
sortDescendingIcon?: ReactNode;
|
|
24
|
+
/** The glyph on a sortable header that is not sorted. */
|
|
25
|
+
unsortedIcon?: ReactNode;
|
|
26
|
+
/** Set on the `Scroller`. */
|
|
20
27
|
className?: string;
|
|
21
28
|
}>;
|
|
22
29
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* loading, error, empty, or ready.
|
|
30
|
+
* The whole table from the enclosing `DataTable` instance: its headers, with a
|
|
31
|
+
* sort toggle on every sortable column, and one of four bodies resolved from
|
|
32
|
+
* the injected query state: loading, error, empty, or ready. Compose the parts
|
|
33
|
+
* where the table needs other markup.
|
|
26
34
|
*/
|
|
27
|
-
export declare const DataTableContent: <TData extends Record<string, unknown>>({ renderSubRow, emptyState, errorLabel, loadingLabel, slowLabel, retryLabel, className, }: DataTableContentProps<TData>) => ReactNode;
|
|
35
|
+
export declare const DataTableContent: <TData extends Record<string, unknown>>({ renderSubRow, emptyState, errorLabel, loadingLabel, slowLabel, retryLabel, sortAscendingIcon, sortDescendingIcon, unsortedIcon, className, }: DataTableContentProps<TData>) => ReactNode;
|
|
@@ -1,311 +1,166 @@
|
|
|
1
|
-
import SvgArrowDownward from "../vendor/@material-design-icons/svg/outlined/arrow_downward.js";
|
|
2
|
-
import SvgArrowUpward from "../vendor/@material-design-icons/svg/outlined/arrow_upward.js";
|
|
3
|
-
import SvgUnfoldMore from "../vendor/@material-design-icons/svg/outlined/unfold_more.js";
|
|
4
1
|
import { Button } from "../components/button/button.js";
|
|
5
|
-
import { Icon } from "../components/icon/icon.js";
|
|
6
|
-
import { Skeleton } from "../components/skeleton/skeleton.js";
|
|
7
2
|
import { Stale } from "../components/stale/stale.js";
|
|
8
3
|
import { useDataTable } from "./data-table-context.js";
|
|
9
|
-
import {
|
|
10
|
-
import { useStickyOffsets } from "./use-sticky-offsets.js";
|
|
11
|
-
import data_table_module_default from "./data-table.module.js";
|
|
4
|
+
import { Body, Cell, ErrorMessage, Frame, Head, HeaderCell, HeaderRow, LoadingCaption, PlaceholderRows, RefreshFailed, Row, Scroller, SortButton, StaleOverlay, StateRow, SubRow, Table, useDataTableView } from "./data-table-parts.js";
|
|
12
5
|
import { c } from "react/compiler-runtime";
|
|
13
|
-
import { Fragment } from "react";
|
|
14
|
-
import { Fragment as Fragment$1
|
|
15
|
-
import { clsx } from "clsx";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Fragment as Fragment$1 } from "react";
|
|
16
8
|
// src/data-table/data-table-content.tsx
|
|
17
|
-
var SORT_ICON = {
|
|
18
|
-
asc: SvgArrowUpward,
|
|
19
|
-
desc: SvgArrowDownward
|
|
20
|
-
};
|
|
21
|
-
var ARIA_SORT = {
|
|
22
|
-
asc: "ascending",
|
|
23
|
-
desc: "descending"
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* The `aria-sort` value for a header cell, given its column's sort state.
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* ariaSort("desc"); // -> "descending"
|
|
30
|
-
* ariaSort(false); // -> undefined
|
|
31
|
-
*/
|
|
32
|
-
var ariaSort = (sorted) => sorted === false ? void 0 : ARIA_SORT[sorted];
|
|
33
9
|
/**
|
|
34
|
-
* The
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* <td {...cellProps(cell.column.columnDef.meta, pins.get(cell.column.id))} />
|
|
39
|
-
*/
|
|
40
|
-
var cellProps = (meta, pin) => ({
|
|
41
|
-
"data-fit": meta?.fit ? "true" : void 0,
|
|
42
|
-
"data-numeric": meta?.numeric ? "true" : void 0,
|
|
43
|
-
"data-sticky": pin?.side,
|
|
44
|
-
style: pin === void 0 ? void 0 : pin.side === "start" ? { insetInlineStart: `var(--table-sticky-inset-${pin.index}, 0px)` } : { insetInlineEnd: `var(--table-sticky-end-${pin.index}, 0px)` }
|
|
45
|
-
});
|
|
46
|
-
/**
|
|
47
|
-
* Maps each pinned column's id to the edge it sits at and its position in that
|
|
48
|
-
* edge's group.
|
|
49
|
-
*
|
|
50
|
-
* @example
|
|
51
|
-
* columnPins(columns).get("actions"); // -> { side: "end", index: 0 }
|
|
52
|
-
*/
|
|
53
|
-
var columnPins = (columns) => new Map(["start", "end"].flatMap((side) => columns.filter((column) => column.columnDef.meta?.sticky === side).map((column, index) => [column.id, {
|
|
54
|
-
side,
|
|
55
|
-
index
|
|
56
|
-
}])));
|
|
57
|
-
/**
|
|
58
|
-
* Renders the `<table>` header and body from the enclosing `DataTable`
|
|
59
|
-
* instance, resolving the injected query state into one of four bodies:
|
|
60
|
-
* loading, error, empty, or ready.
|
|
10
|
+
* The whole table from the enclosing `DataTable` instance: its headers, with a
|
|
11
|
+
* sort toggle on every sortable column, and one of four bodies resolved from
|
|
12
|
+
* the injected query state: loading, error, empty, or ready. Compose the parts
|
|
13
|
+
* where the table needs other markup.
|
|
61
14
|
*/
|
|
62
15
|
var DataTableContent = (t0) => {
|
|
63
|
-
const $ = c(
|
|
64
|
-
const { renderSubRow, emptyState, errorLabel, loadingLabel, slowLabel, retryLabel, className } = t0;
|
|
65
|
-
const { table,
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const frameRef = useStickyOffsets([...pins].map(_temp).join(","));
|
|
74
|
-
const t1 = rows.length > 0;
|
|
16
|
+
const $ = c(51);
|
|
17
|
+
const { renderSubRow, emptyState, errorLabel, loadingLabel, slowLabel, retryLabel, sortAscendingIcon, sortDescendingIcon, unsortedIcon, className } = t0;
|
|
18
|
+
const { table, onRetry } = useDataTable();
|
|
19
|
+
const { view } = useDataTableView();
|
|
20
|
+
let t1;
|
|
21
|
+
if ($[0] !== errorLabel) {
|
|
22
|
+
t1 = /* @__PURE__ */ jsx("span", { children: errorLabel });
|
|
23
|
+
$[0] = errorLabel;
|
|
24
|
+
$[1] = t1;
|
|
25
|
+
} else t1 = $[1];
|
|
75
26
|
let t2;
|
|
76
|
-
if ($[
|
|
77
|
-
t2 =
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
$[0] = isFetching;
|
|
83
|
-
$[1] = status;
|
|
84
|
-
$[2] = t1;
|
|
85
|
-
$[3] = t2;
|
|
86
|
-
} else t2 = $[3];
|
|
87
|
-
const { view, stale, refreshFailed } = t2;
|
|
88
|
-
let t3;
|
|
89
|
-
if ($[4] !== errorLabel || $[5] !== onRetry || $[6] !== refreshFailed || $[7] !== retryLabel) {
|
|
90
|
-
t3 = refreshFailed ? /* @__PURE__ */ jsxs("div", {
|
|
91
|
-
className: data_table_module_default.refreshFailed,
|
|
92
|
-
role: "alert",
|
|
93
|
-
children: [/* @__PURE__ */ jsx("span", { children: errorLabel }), onRetry ? /* @__PURE__ */ jsx(Button, {
|
|
94
|
-
variant: "tertiary",
|
|
95
|
-
size: "sm",
|
|
96
|
-
onClick: onRetry,
|
|
97
|
-
children: retryLabel
|
|
98
|
-
}) : null]
|
|
27
|
+
if ($[2] !== onRetry || $[3] !== retryLabel) {
|
|
28
|
+
t2 = onRetry ? /* @__PURE__ */ jsx(Button, {
|
|
29
|
+
variant: "tertiary",
|
|
30
|
+
size: "sm",
|
|
31
|
+
onClick: onRetry,
|
|
32
|
+
children: retryLabel
|
|
99
33
|
}) : null;
|
|
100
|
-
$[
|
|
101
|
-
$[
|
|
102
|
-
$[
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
34
|
+
$[2] = onRetry;
|
|
35
|
+
$[3] = retryLabel;
|
|
36
|
+
$[4] = t2;
|
|
37
|
+
} else t2 = $[4];
|
|
38
|
+
let t3;
|
|
39
|
+
if ($[5] !== t1 || $[6] !== t2) {
|
|
40
|
+
t3 = /* @__PURE__ */ jsxs(RefreshFailed, { children: [t1, t2] });
|
|
41
|
+
$[5] = t1;
|
|
42
|
+
$[6] = t2;
|
|
43
|
+
$[7] = t3;
|
|
44
|
+
} else t3 = $[7];
|
|
106
45
|
let t4;
|
|
107
|
-
if ($[
|
|
108
|
-
t4 =
|
|
109
|
-
$[
|
|
110
|
-
$[
|
|
111
|
-
} else t4 = $[
|
|
46
|
+
if ($[8] !== loadingLabel) {
|
|
47
|
+
t4 = /* @__PURE__ */ jsx(LoadingCaption, { children: loadingLabel });
|
|
48
|
+
$[8] = loadingLabel;
|
|
49
|
+
$[9] = t4;
|
|
50
|
+
} else t4 = $[9];
|
|
112
51
|
let t5;
|
|
113
|
-
if ($[11] !==
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
children:
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
className: data_table_module_default.td,
|
|
145
|
-
colSpan: endPinCount,
|
|
146
|
-
"data-sticky": "end",
|
|
147
|
-
style: { insetInlineEnd: 0 }
|
|
148
|
-
}) : null
|
|
149
|
-
]
|
|
150
|
-
}) : null] }, row.id)) : view === "loading" ? /* @__PURE__ */ jsx(PlaceholderRows, {
|
|
151
|
-
rowCount: table.state.pagination.pageSize,
|
|
152
|
-
columns: leafColumns.map((column) => ({
|
|
153
|
-
id: column.id,
|
|
154
|
-
meta: column.columnDef.meta,
|
|
155
|
-
pin: pins.get(column.id)
|
|
156
|
-
}))
|
|
157
|
-
}) : /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
|
|
158
|
-
colSpan: columnCount,
|
|
159
|
-
className: data_table_module_default.stateCell,
|
|
160
|
-
children: /* @__PURE__ */ jsx(StateBody, {
|
|
161
|
-
view,
|
|
162
|
-
emptyState,
|
|
163
|
-
errorLabel
|
|
164
|
-
})
|
|
165
|
-
}) });
|
|
52
|
+
if ($[10] !== sortAscendingIcon || $[11] !== sortDescendingIcon || $[12] !== table || $[13] !== unsortedIcon) {
|
|
53
|
+
let t6;
|
|
54
|
+
if ($[15] !== sortAscendingIcon || $[16] !== sortDescendingIcon || $[17] !== table.FlexRender || $[18] !== unsortedIcon) {
|
|
55
|
+
t6 = (headerGroup) => /* @__PURE__ */ jsx(HeaderRow, { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx(HeaderCell, {
|
|
56
|
+
header,
|
|
57
|
+
children: header.isPlaceholder ? null : header.column.getCanSort() ? /* @__PURE__ */ jsx(SortButton, {
|
|
58
|
+
header,
|
|
59
|
+
sortAscendingIcon,
|
|
60
|
+
sortDescendingIcon,
|
|
61
|
+
unsortedIcon
|
|
62
|
+
}) : /* @__PURE__ */ jsx(table.FlexRender, { header })
|
|
63
|
+
}, header.id)) }, headerGroup.id);
|
|
64
|
+
$[15] = sortAscendingIcon;
|
|
65
|
+
$[16] = sortDescendingIcon;
|
|
66
|
+
$[17] = table.FlexRender;
|
|
67
|
+
$[18] = unsortedIcon;
|
|
68
|
+
$[19] = t6;
|
|
69
|
+
} else t6 = $[19];
|
|
70
|
+
t5 = table.getHeaderGroups().map(t6);
|
|
71
|
+
$[10] = sortAscendingIcon;
|
|
72
|
+
$[11] = sortDescendingIcon;
|
|
73
|
+
$[12] = table;
|
|
74
|
+
$[13] = unsortedIcon;
|
|
75
|
+
$[14] = t5;
|
|
76
|
+
} else t5 = $[14];
|
|
77
|
+
let t6;
|
|
78
|
+
if ($[20] !== t5) {
|
|
79
|
+
t6 = /* @__PURE__ */ jsx(Head, { children: t5 });
|
|
80
|
+
$[20] = t5;
|
|
81
|
+
$[21] = t6;
|
|
82
|
+
} else t6 = $[21];
|
|
166
83
|
let t7;
|
|
167
|
-
if ($[
|
|
168
|
-
t7 = /* @__PURE__ */
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
84
|
+
if ($[22] !== emptyState || $[23] !== errorLabel || $[24] !== renderSubRow || $[25] !== table || $[26] !== view) {
|
|
85
|
+
t7 = view === "ready" ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Row, {
|
|
86
|
+
row,
|
|
87
|
+
children: row.getAllCells().map(_temp)
|
|
88
|
+
}), renderSubRow && row.getIsExpanded() ? /* @__PURE__ */ jsx(SubRow, { children: renderSubRow(row) }) : null] }, row.id)) : view === "loading" ? /* @__PURE__ */ jsx(PlaceholderRows, {}) : /* @__PURE__ */ jsx(StateRow, { children: view === "error" ? /* @__PURE__ */ jsx(ErrorMessage, { children: errorLabel }) : emptyState });
|
|
89
|
+
$[22] = emptyState;
|
|
90
|
+
$[23] = errorLabel;
|
|
91
|
+
$[24] = renderSubRow;
|
|
92
|
+
$[25] = table;
|
|
93
|
+
$[26] = view;
|
|
94
|
+
$[27] = t7;
|
|
95
|
+
} else t7 = $[27];
|
|
172
96
|
let t8;
|
|
173
|
-
if ($[
|
|
174
|
-
t8 = /* @__PURE__ */ jsx(
|
|
175
|
-
$[
|
|
176
|
-
$[
|
|
177
|
-
} else t8 = $[
|
|
97
|
+
if ($[28] !== t7) {
|
|
98
|
+
t8 = /* @__PURE__ */ jsx(Body, { children: t7 });
|
|
99
|
+
$[28] = t7;
|
|
100
|
+
$[29] = t8;
|
|
101
|
+
} else t8 = $[29];
|
|
178
102
|
let t9;
|
|
179
|
-
if ($[
|
|
180
|
-
t9 =
|
|
103
|
+
if ($[30] !== t4 || $[31] !== t6 || $[32] !== t8) {
|
|
104
|
+
t9 = /* @__PURE__ */ jsxs(Table, { children: [
|
|
105
|
+
t4,
|
|
106
|
+
t6,
|
|
107
|
+
t8
|
|
108
|
+
] });
|
|
109
|
+
$[30] = t4;
|
|
110
|
+
$[31] = t6;
|
|
111
|
+
$[32] = t8;
|
|
112
|
+
$[33] = t9;
|
|
113
|
+
} else t9 = $[33];
|
|
114
|
+
let t10;
|
|
115
|
+
if ($[34] !== className || $[35] !== t9) {
|
|
116
|
+
t10 = /* @__PURE__ */ jsx(Scroller, {
|
|
117
|
+
className,
|
|
118
|
+
children: t9
|
|
119
|
+
});
|
|
120
|
+
$[34] = className;
|
|
121
|
+
$[35] = t9;
|
|
122
|
+
$[36] = t10;
|
|
123
|
+
} else t10 = $[36];
|
|
124
|
+
let t11;
|
|
125
|
+
if ($[37] !== slowLabel) {
|
|
126
|
+
t11 = /* @__PURE__ */ jsx(Stale.Message, { children: slowLabel });
|
|
127
|
+
$[37] = slowLabel;
|
|
128
|
+
$[38] = t11;
|
|
129
|
+
} else t11 = $[38];
|
|
130
|
+
let t12;
|
|
131
|
+
if ($[39] !== onRetry || $[40] !== retryLabel) {
|
|
132
|
+
t12 = onRetry ? /* @__PURE__ */ jsx(Stale.Retry, {
|
|
181
133
|
onRetry,
|
|
182
134
|
children: retryLabel
|
|
183
135
|
}) : null;
|
|
184
|
-
$[
|
|
185
|
-
$[
|
|
186
|
-
$[
|
|
187
|
-
} else
|
|
188
|
-
let
|
|
189
|
-
if ($[
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
className: data_table_module_default.table,
|
|
211
|
-
"aria-busy": view === "loading" ? "true" : void 0,
|
|
212
|
-
children: [
|
|
213
|
-
t5,
|
|
214
|
-
/* @__PURE__ */ jsx("thead", {
|
|
215
|
-
className: data_table_module_default.thead,
|
|
216
|
-
children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx("tr", { children: headerGroup.headers.map((header) => {
|
|
217
|
-
const sorted = header.column.getIsSorted();
|
|
218
|
-
return /* @__PURE__ */ jsx("th", {
|
|
219
|
-
scope: "col",
|
|
220
|
-
colSpan: header.colSpan,
|
|
221
|
-
className: data_table_module_default.th,
|
|
222
|
-
"aria-sort": ariaSort(sorted),
|
|
223
|
-
...cellProps(header.column.columnDef.meta, pins.get(header.column.id)),
|
|
224
|
-
children: header.isPlaceholder ? null : header.column.getCanSort() ? /* @__PURE__ */ jsxs("button", {
|
|
225
|
-
type: "button",
|
|
226
|
-
className: data_table_module_default.sortToggle,
|
|
227
|
-
onClick: () => {
|
|
228
|
-
header.column.toggleSorting();
|
|
229
|
-
table.setPageIndex(0);
|
|
230
|
-
},
|
|
231
|
-
children: [/* @__PURE__ */ jsx(table.FlexRender, { header }), /* @__PURE__ */ jsx(Icon, {
|
|
232
|
-
svg: sorted === false ? SvgUnfoldMore : SORT_ICON[sorted],
|
|
233
|
-
label: "",
|
|
234
|
-
className: sorted === false ? data_table_module_default.sortIconIdle : void 0
|
|
235
|
-
})]
|
|
236
|
-
}) : /* @__PURE__ */ jsx(table.FlexRender, { header })
|
|
237
|
-
}, header.id);
|
|
238
|
-
}) }, headerGroup.id))
|
|
239
|
-
}),
|
|
240
|
-
t7
|
|
241
|
-
]
|
|
242
|
-
})
|
|
243
|
-
})
|
|
244
|
-
}), t10]
|
|
245
|
-
})
|
|
246
|
-
})] });
|
|
247
|
-
};
|
|
248
|
-
/**
|
|
249
|
-
* Inert placeholder rows for a first load: one row per row of the selected page
|
|
250
|
-
* size. A column that declares a `placeholderCell` draws it; every other column
|
|
251
|
-
* gets a skeleton bar.
|
|
252
|
-
*/
|
|
253
|
-
var PlaceholderRows = (t0) => {
|
|
254
|
-
const $ = c(5);
|
|
255
|
-
const { rowCount, columns } = t0;
|
|
256
|
-
let t1;
|
|
257
|
-
if ($[0] !== columns || $[1] !== rowCount) {
|
|
258
|
-
let t2;
|
|
259
|
-
if ($[3] !== columns) {
|
|
260
|
-
t2 = (_, index) => /* @__PURE__ */ jsx("tr", {
|
|
261
|
-
className: data_table_module_default.row,
|
|
262
|
-
"data-stripe": index % 2 === 1 ? "true" : void 0,
|
|
263
|
-
inert: true,
|
|
264
|
-
children: columns.map(_temp2)
|
|
265
|
-
}, index);
|
|
266
|
-
$[3] = columns;
|
|
267
|
-
$[4] = t2;
|
|
268
|
-
} else t2 = $[4];
|
|
269
|
-
t1 = /* @__PURE__ */ jsx(Fragment$1, { children: Array.from({ length: rowCount }, t2) });
|
|
270
|
-
$[0] = columns;
|
|
271
|
-
$[1] = rowCount;
|
|
272
|
-
$[2] = t1;
|
|
273
|
-
} else t1 = $[2];
|
|
274
|
-
return t1;
|
|
136
|
+
$[39] = onRetry;
|
|
137
|
+
$[40] = retryLabel;
|
|
138
|
+
$[41] = t12;
|
|
139
|
+
} else t12 = $[41];
|
|
140
|
+
let t13;
|
|
141
|
+
if ($[42] !== t11 || $[43] !== t12) {
|
|
142
|
+
t13 = /* @__PURE__ */ jsxs(StaleOverlay, { children: [t11, t12] });
|
|
143
|
+
$[42] = t11;
|
|
144
|
+
$[43] = t12;
|
|
145
|
+
$[44] = t13;
|
|
146
|
+
} else t13 = $[44];
|
|
147
|
+
let t14;
|
|
148
|
+
if ($[45] !== t10 || $[46] !== t13) {
|
|
149
|
+
t14 = /* @__PURE__ */ jsxs(Frame, { children: [t10, t13] });
|
|
150
|
+
$[45] = t10;
|
|
151
|
+
$[46] = t13;
|
|
152
|
+
$[47] = t14;
|
|
153
|
+
} else t14 = $[47];
|
|
154
|
+
let t15;
|
|
155
|
+
if ($[48] !== t14 || $[49] !== t3) {
|
|
156
|
+
t15 = /* @__PURE__ */ jsxs(Fragment, { children: [t3, t14] });
|
|
157
|
+
$[48] = t14;
|
|
158
|
+
$[49] = t3;
|
|
159
|
+
$[50] = t15;
|
|
160
|
+
} else t15 = $[50];
|
|
161
|
+
return t15;
|
|
275
162
|
};
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
const { view, emptyState, errorLabel } = t0;
|
|
279
|
-
if (view === "error") {
|
|
280
|
-
let t1;
|
|
281
|
-
if ($[0] !== errorLabel) {
|
|
282
|
-
t1 = /* @__PURE__ */ jsx("span", {
|
|
283
|
-
className: data_table_module_default.errorState,
|
|
284
|
-
role: "alert",
|
|
285
|
-
children: errorLabel
|
|
286
|
-
});
|
|
287
|
-
$[0] = errorLabel;
|
|
288
|
-
$[1] = t1;
|
|
289
|
-
} else t1 = $[1];
|
|
290
|
-
return t1;
|
|
291
|
-
}
|
|
292
|
-
let t1;
|
|
293
|
-
if ($[2] !== emptyState) {
|
|
294
|
-
t1 = /* @__PURE__ */ jsx(Fragment$1, { children: emptyState });
|
|
295
|
-
$[2] = emptyState;
|
|
296
|
-
$[3] = t1;
|
|
297
|
-
} else t1 = $[3];
|
|
298
|
-
return t1;
|
|
299
|
-
};
|
|
300
|
-
function _temp(t0) {
|
|
301
|
-
const [id, pin_0] = t0;
|
|
302
|
-
return `${id}:${pin_0.side}`;
|
|
303
|
-
}
|
|
304
|
-
function _temp2(column) {
|
|
305
|
-
return /* @__PURE__ */ jsx("td", {
|
|
306
|
-
className: data_table_module_default.td,
|
|
307
|
-
...cellProps(column.meta, column.pin),
|
|
308
|
-
children: column.meta?.placeholderCell?.() ?? /* @__PURE__ */ jsx(Skeleton, { className: data_table_module_default.skeletonBar })
|
|
309
|
-
}, column.id);
|
|
163
|
+
function _temp(cell) {
|
|
164
|
+
return /* @__PURE__ */ jsx(Cell, { cell }, cell.id);
|
|
310
165
|
}
|
|
311
166
|
export { DataTableContent };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ReactTable } from "@tanstack/react-table";
|
|
1
|
+
import type { ReactTable, SortingState } from "@tanstack/react-table";
|
|
2
2
|
import { type Context } from "react";
|
|
3
3
|
import type { RowSelectionView } from "../lib/hooks/use-row-selection.ts";
|
|
4
4
|
import type { DataTableStatus } from "./resolve-view.ts";
|
|
@@ -10,6 +10,8 @@ import type { DataTableFeatures } from "./table-features.ts";
|
|
|
10
10
|
*/
|
|
11
11
|
export type DataTableContextValue = Readonly<{
|
|
12
12
|
table: unknown;
|
|
13
|
+
/** The table's sorting, held beside the instance so a part re-renders when it changes. */
|
|
14
|
+
sorting: SortingState;
|
|
13
15
|
status: DataTableStatus;
|
|
14
16
|
isFetching: boolean;
|
|
15
17
|
/** Refetches; the stale overlay and the refresh-failed notice offer it as a retry. */
|
|
@@ -27,7 +29,7 @@ export type DataTableState<TData extends Record<string, unknown>> = Omit<DataTab
|
|
|
27
29
|
* caller's row type. Pass the same `TData` the table was built with.
|
|
28
30
|
*
|
|
29
31
|
* @example
|
|
30
|
-
* const { table } = useDataTable<
|
|
32
|
+
* const { table } = useDataTable<Invoice>();
|
|
31
33
|
* const rows = table.getRowModel().rows;
|
|
32
34
|
*/
|
|
33
35
|
export declare const useDataTable: <TData extends Record<string, unknown> = Record<string, unknown>>() => DataTableState<TData>;
|
|
@@ -9,7 +9,7 @@ var DataTableContext = createContext(null);
|
|
|
9
9
|
* caller's row type. Pass the same `TData` the table was built with.
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
12
|
-
* const { table } = useDataTable<
|
|
12
|
+
* const { table } = useDataTable<Invoice>();
|
|
13
13
|
* const rows = table.getRowModel().rows;
|
|
14
14
|
*/
|
|
15
15
|
var useDataTable = () => {
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
2
|
+
import type { Cell as TableCell, Header as TableHeader, Row as TableRow } from "@tanstack/react-table";
|
|
3
|
+
import type { ComponentProps, ReactElement, ReactNode } from "react";
|
|
4
|
+
import { type StaleOverlayProps } from "../components/stale/stale.tsx";
|
|
5
|
+
import { type ResolvedView } from "./resolve-view.ts";
|
|
6
|
+
import type { DataTableFeatures } from "./table-features.ts";
|
|
7
|
+
/**
|
|
8
|
+
* Which body the enclosing `DataTable` shows, whether its rows are stale, and
|
|
9
|
+
* whether a refresh failed over rows still on screen.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* const { view } = useDataTableView();
|
|
13
|
+
* if (view === "empty") return <DataTable.StateRow>No invoices yet.</DataTable.StateRow>;
|
|
14
|
+
*/
|
|
15
|
+
export declare const useDataTableView: () => ResolvedView;
|
|
16
|
+
export type DataTableRefreshFailedProps = useRender.ComponentProps<"div">;
|
|
17
|
+
/** The alert above rows still on screen when a refresh fails. Renders nothing otherwise. */
|
|
18
|
+
export declare const RefreshFailed: ({ render, className, ref, ...props }: DataTableRefreshFailedProps) => ReactElement | null;
|
|
19
|
+
export type DataTableFrameProps = useRender.ComponentProps<"div">;
|
|
20
|
+
/**
|
|
21
|
+
* The frame that stays put around the scroller: it measures the pinned columns
|
|
22
|
+
* and holds the stale state, so it takes a `Scroller` and a `StaleOverlay`.
|
|
23
|
+
*/
|
|
24
|
+
export declare const Frame: ({ render, className, ref, children, ...props }: DataTableFrameProps) => ReactElement;
|
|
25
|
+
export type DataTableScrollerProps = useRender.ComponentProps<"div">;
|
|
26
|
+
/** The scrolling card that holds the `Table`, dimmed while its rows are stale. */
|
|
27
|
+
export declare const Scroller: ({ render, className, ref, ...props }: DataTableScrollerProps) => ReactNode;
|
|
28
|
+
/** What covers the table once a refresh is slow: its `Stale.Message` and `Stale.Retry`. */
|
|
29
|
+
export declare const StaleOverlay: ({ className, ...props }: StaleOverlayProps) => ReactNode;
|
|
30
|
+
export type DataTableTableProps = useRender.ComponentProps<"table">;
|
|
31
|
+
/** The `<table>`, marked busy while its first page loads. */
|
|
32
|
+
export declare const Table: ({ render, className, ref, ...props }: DataTableTableProps) => ReactElement;
|
|
33
|
+
export type DataTableLoadingCaptionProps = useRender.ComponentProps<"caption">;
|
|
34
|
+
/** What is announced while the first page loads, such as "Loading invoices". Renders nothing otherwise. */
|
|
35
|
+
export declare const LoadingCaption: ({ render, className, ref, ...props }: DataTableLoadingCaptionProps) => ReactElement | null;
|
|
36
|
+
export type DataTableHeadProps = useRender.ComponentProps<"thead">;
|
|
37
|
+
/** The header, stuck to the top of the scroller. */
|
|
38
|
+
export declare const Head: ({ render, className, ref, ...props }: DataTableHeadProps) => ReactElement;
|
|
39
|
+
export type DataTableHeaderRowProps = useRender.ComponentProps<"tr">;
|
|
40
|
+
/** One row of header cells. */
|
|
41
|
+
export declare const HeaderRow: ({ render, ref, ...props }: DataTableHeaderRowProps) => ReactElement;
|
|
42
|
+
export type DataTableHeaderCellProps<TData extends Record<string, unknown>> = useRender.ComponentProps<"th"> & Readonly<{
|
|
43
|
+
/** The header this cell draws. */
|
|
44
|
+
header: TableHeader<DataTableFeatures, TData>;
|
|
45
|
+
}>;
|
|
46
|
+
/**
|
|
47
|
+
* A column header, laid out by its column's `meta` and announcing its sort.
|
|
48
|
+
* It draws the column's header unless given children, such as a `SortButton`.
|
|
49
|
+
*/
|
|
50
|
+
export declare const HeaderCell: <TData extends Record<string, unknown>>({ header, render, className, style: inlineStyle, ref, children, ...props }: DataTableHeaderCellProps<TData>) => ReactElement;
|
|
51
|
+
export type DataTableSortButtonProps<TData extends Record<string, unknown>> = Omit<ComponentProps<"button">, "ref"> & Readonly<{
|
|
52
|
+
/** The header whose column this sorts. */
|
|
53
|
+
header: TableHeader<DataTableFeatures, TData>;
|
|
54
|
+
/** The glyph while the column sorts ascending. */
|
|
55
|
+
sortAscendingIcon?: ReactNode;
|
|
56
|
+
/** The glyph while the column sorts descending. */
|
|
57
|
+
sortDescendingIcon?: ReactNode;
|
|
58
|
+
/** The glyph while the column is not sorted. */
|
|
59
|
+
unsortedIcon?: ReactNode;
|
|
60
|
+
}>;
|
|
61
|
+
/**
|
|
62
|
+
* The header's sort toggle, which returns the table to its first page. It
|
|
63
|
+
* draws the column's header unless given children, followed by the glyph for
|
|
64
|
+
* the column's sort, where one is given.
|
|
65
|
+
*/
|
|
66
|
+
export declare const SortButton: <TData extends Record<string, unknown>>({ header, sortAscendingIcon, sortDescendingIcon, unsortedIcon, className, children, onClick, ...props }: DataTableSortButtonProps<TData>) => ReactNode;
|
|
67
|
+
export type DataTableBodyProps = useRender.ComponentProps<"tbody">;
|
|
68
|
+
/** The body: the page's `Row`s, the `PlaceholderRows` or a `StateRow`. */
|
|
69
|
+
export declare const Body: ({ render, ref, ...props }: DataTableBodyProps) => ReactElement;
|
|
70
|
+
export type DataTableRowProps<TData extends Record<string, unknown>> = useRender.ComponentProps<"tr"> & Readonly<{
|
|
71
|
+
/** The row this draws, which sets its stripe. */
|
|
72
|
+
row: TableRow<DataTableFeatures, TData>;
|
|
73
|
+
}>;
|
|
74
|
+
/** A body row, striped on every other row. */
|
|
75
|
+
export declare const Row: <TData extends Record<string, unknown>>({ row, render, className, ref, ...props }: DataTableRowProps<TData>) => ReactElement;
|
|
76
|
+
export type DataTableCellProps<TData extends Record<string, unknown>> = useRender.ComponentProps<"td"> & Readonly<{
|
|
77
|
+
/** The cell this draws. */
|
|
78
|
+
cell: TableCell<DataTableFeatures, TData>;
|
|
79
|
+
}>;
|
|
80
|
+
/** A body cell, laid out by its column's `meta`. It draws the column's cell unless given children. */
|
|
81
|
+
export declare const Cell: <TData extends Record<string, unknown>>({ cell, render, className, style: inlineStyle, ref, children, ...props }: DataTableCellProps<TData>) => ReactElement;
|
|
82
|
+
export type DataTableSubRowProps = useRender.ComponentProps<"tr">;
|
|
83
|
+
/**
|
|
84
|
+
* The full-width row beneath an expanded row, holding its children. The pinned
|
|
85
|
+
* columns keep their place beside it.
|
|
86
|
+
*/
|
|
87
|
+
export declare const SubRow: ({ render, className, ref, children, ...props }: DataTableSubRowProps) => ReactElement;
|
|
88
|
+
/**
|
|
89
|
+
* Inert placeholder rows for a first load: one row per row of the selected page
|
|
90
|
+
* size. A column that declares a `placeholderCell` draws it; every other column
|
|
91
|
+
* gets a skeleton bar.
|
|
92
|
+
*/
|
|
93
|
+
export declare const PlaceholderRows: () => ReactNode;
|
|
94
|
+
export type DataTableStateRowProps = useRender.ComponentProps<"tr">;
|
|
95
|
+
/** A row across every column for the body's state, such as the empty state or an `ErrorMessage`. */
|
|
96
|
+
export declare const StateRow: ({ render, ref, children, ...props }: DataTableStateRowProps) => ReactElement;
|
|
97
|
+
export type DataTableErrorMessageProps = useRender.ComponentProps<"span">;
|
|
98
|
+
/** What a failed first load says, as an alert. */
|
|
99
|
+
export declare const ErrorMessage: ({ render, className, ref, ...props }: DataTableErrorMessageProps) => ReactElement;
|