@customafk/lunas-ui 0.2.11 → 0.2.13
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/{alert-CI3ANQHC.d.cts → alert-DUC0U7cI.d.mts} +7 -7
- package/dist/{alert-DQHE-pdI.mjs → alert-DjfDTXIK.mjs} +1 -1
- package/dist/{alert-DQHE-pdI.mjs.map → alert-DjfDTXIK.mjs.map} +1 -1
- package/dist/{alert-C1YY0oUh.d.mts → alert-_grSHXD3.d.cts} +6 -6
- package/dist/{alert-BqJVf4wD.cjs → alert-kJbUcjIR.cjs} +1 -1
- package/dist/{alert-BqJVf4wD.cjs.map → alert-kJbUcjIR.cjs.map} +1 -1
- package/dist/{badge-DXeJVvRU.d.mts → badge-BwjhcVgG.d.cts} +6 -6
- package/dist/{badge-PKOZAtox.d.cts → badge-DvElo91N.d.mts} +6 -6
- package/dist/{button-BwvdZSJE.d.cts → button-B46oQvo-.d.mts} +6 -6
- package/dist/{button-BuQ09ya9.d.mts → button-CRujrbey.d.cts} +5 -5
- package/dist/{calendar-B2V4Lv0T.cjs → calendar-BMXIBCsr.cjs} +1 -1
- package/dist/{calendar-B2V4Lv0T.cjs.map → calendar-BMXIBCsr.cjs.map} +1 -1
- package/dist/{calendar-Cw1G0sVL.mjs → calendar-WMJIKojX.mjs} +1 -1
- package/dist/{calendar-Cw1G0sVL.mjs.map → calendar-WMJIKojX.mjs.map} +1 -1
- package/dist/{cms-layout-r9TmK6hi.cjs → cms-layout-BLJpfFpE.cjs} +1 -1
- package/dist/{cms-layout-r9TmK6hi.cjs.map → cms-layout-BLJpfFpE.cjs.map} +1 -1
- package/dist/{cms-layout-Bp6rU_of.mjs → cms-layout-BYzUepEk.mjs} +1 -1
- package/dist/{cms-layout-Bp6rU_of.mjs.map → cms-layout-BYzUepEk.mjs.map} +1 -1
- package/dist/data-display/statistic.d.cts +2 -2
- package/dist/{dialog-CRVNgVZU.d.cts → dialog-BuM8wDKV.d.cts} +12 -12
- package/dist/{dialog-CiCeXhAu.d.mts → dialog-HkbI2x97.d.mts} +12 -12
- package/dist/dialogs/detail-dialog/components/sidebar.d.cts +26 -26
- package/dist/dialogs/detail-dialog/components/sidebar.d.mts +26 -26
- package/dist/features/descriptions/index.d.cts +3 -3
- package/dist/features/descriptions/index.d.mts +7 -7
- package/dist/features/search-modal/index.d.cts +2 -2
- package/dist/features/tables/index.cjs +1 -1
- package/dist/features/tables/index.d.cts +2 -1181
- package/dist/features/tables/index.d.mts +3 -1181
- package/dist/features/tables/index.mjs +1 -1
- package/dist/features/tanstack-form/index.cjs +1 -1
- package/dist/features/tanstack-form/index.d.cts +1 -1
- package/dist/features/tanstack-form/index.d.mts +1 -1
- package/dist/features/tanstack-form/index.mjs +1 -1
- package/dist/{field-DfsTE4Ie.mjs → field-C5HOxxiX.mjs} +2 -2
- package/dist/{field-DfsTE4Ie.mjs.map → field-C5HOxxiX.mjs.map} +1 -1
- package/dist/{field-C51eJ6QN.cjs → field-D1wvj5Wj.cjs} +2 -2
- package/dist/{field-C51eJ6QN.cjs.map → field-D1wvj5Wj.cjs.map} +1 -1
- package/dist/index-B5wgYino.d.cts +1009 -0
- package/dist/{index-Dm0lp7bT.d.mts → index-DNOZLwxL.d.cts} +282 -282
- package/dist/{index-C3SKVvaI.d.cts → index-DaAbyifH.d.mts} +230 -230
- package/dist/index-b6uMbewl.d.mts +1009 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +8 -8
- package/dist/index.d.mts +8 -8
- package/dist/index.mjs +1 -1
- package/dist/{input-CoHHwUwI.d.mts → input-BLyJp8UZ.d.cts} +6 -6
- package/dist/{input-BpZ_mAuD.d.cts → input-BaQTUEQF.d.mts} +5 -5
- package/dist/{label-3vAlNtF9.mjs → label-COqDQDMy.mjs} +1 -1
- package/dist/{label-3vAlNtF9.mjs.map → label-COqDQDMy.mjs.map} +1 -1
- package/dist/{label-zyBJYydC.cjs → label-DYsRdKMt.cjs} +1 -1
- package/dist/{label-zyBJYydC.cjs.map → label-DYsRdKMt.cjs.map} +1 -1
- package/dist/layouts/cms-layout/index.cjs +1 -1
- package/dist/layouts/cms-layout/index.mjs +1 -1
- package/dist/layouts/flex.d.cts +4 -4
- package/dist/layouts/flex.d.mts +4 -4
- package/dist/layouts/payment-layout/index.cjs +1 -1
- package/dist/layouts/payment-layout/index.mjs +1 -1
- package/dist/pages/FeatureDeveloping.d.cts +2 -2
- package/dist/pages/FeatureDeveloping.d.mts +2 -2
- package/dist/pages/FeatureFixing.d.cts +2 -2
- package/dist/pages/FeatureFixing.d.mts +2 -2
- package/dist/pages/NotAuthorized.d.cts +2 -2
- package/dist/pages/NotAuthorized.d.mts +2 -2
- package/dist/pages/NotFound.d.cts +2 -2
- package/dist/pages/NotFound.d.mts +2 -2
- package/dist/{payment-layout-C9pP5HdT.cjs → payment-layout-C8_xrnVn.cjs} +1 -1
- package/dist/{payment-layout-C9pP5HdT.cjs.map → payment-layout-C8_xrnVn.cjs.map} +1 -1
- package/dist/{payment-layout-D-69gOPJ.mjs → payment-layout-CVBTGjMw.mjs} +1 -1
- package/dist/{payment-layout-D-69gOPJ.mjs.map → payment-layout-CVBTGjMw.mjs.map} +1 -1
- package/dist/{popover-CmoqhK17.cjs → popover-AEt-aSy3.cjs} +1 -1
- package/dist/{popover-CmoqhK17.cjs.map → popover-AEt-aSy3.cjs.map} +1 -1
- package/dist/{popover-BFJhuzW3.mjs → popover-OJXFbqJi.mjs} +1 -1
- package/dist/{popover-BFJhuzW3.mjs.map → popover-OJXFbqJi.mjs.map} +1 -1
- package/dist/{radio-group-D5OurBIG.mjs → radio-group-5ktXGXSv.mjs} +1 -1
- package/dist/{radio-group-D5OurBIG.mjs.map → radio-group-5ktXGXSv.mjs.map} +1 -1
- package/dist/{radio-group-DAv2EU3F.cjs → radio-group-C7FAAawm.cjs} +1 -1
- package/dist/{radio-group-DAv2EU3F.cjs.map → radio-group-C7FAAawm.cjs.map} +1 -1
- package/dist/{select-DRCKwnTV.mjs → select-DrHceSnf.mjs} +1 -1
- package/dist/{select-DRCKwnTV.mjs.map → select-DrHceSnf.mjs.map} +1 -1
- package/dist/{select-DfvSMRUq.cjs → select-DzylYFes.cjs} +1 -1
- package/dist/{select-DfvSMRUq.cjs.map → select-DzylYFes.cjs.map} +1 -1
- package/dist/tables-BtcCgpJB.mjs +4 -0
- package/dist/tables-BtcCgpJB.mjs.map +1 -0
- package/dist/tables-DZvtd0HA.cjs +4 -0
- package/dist/tables-DZvtd0HA.cjs.map +1 -0
- package/dist/{tanstack-form-Bb9JXuEq.cjs → tanstack-form-BUjk7DIz.cjs} +2 -2
- package/dist/{tanstack-form-Bb9JXuEq.cjs.map → tanstack-form-BUjk7DIz.cjs.map} +1 -1
- package/dist/{tanstack-form-BwyHENeF.mjs → tanstack-form-DtZdrifK.mjs} +2 -2
- package/dist/{tanstack-form-BwyHENeF.mjs.map → tanstack-form-DtZdrifK.mjs.map} +1 -1
- package/dist/{textarea-CvoBIPlJ.cjs → textarea-DZ86A_cm.cjs} +1 -1
- package/dist/{textarea-CvoBIPlJ.cjs.map → textarea-DZ86A_cm.cjs.map} +1 -1
- package/dist/{textarea-5RD9ToTV.mjs → textarea-Dd1fBf_4.mjs} +1 -1
- package/dist/{textarea-5RD9ToTV.mjs.map → textarea-Dd1fBf_4.mjs.map} +1 -1
- package/dist/typography/paragraph.d.cts +2 -2
- package/dist/typography/paragraph.d.mts +4 -4
- package/dist/typography/title.d.cts +2 -2
- package/dist/typography/title.d.mts +2 -2
- package/dist/ui/alert-dialog.d.cts +12 -12
- package/dist/ui/alert-dialog.d.mts +12 -12
- package/dist/ui/alert.cjs +1 -1
- package/dist/ui/alert.d.cts +1 -1
- package/dist/ui/alert.d.mts +1 -1
- package/dist/ui/alert.mjs +1 -1
- package/dist/ui/aspect-ratio.d.cts +2 -2
- package/dist/ui/aspect-ratio.d.mts +2 -2
- package/dist/ui/avatar.d.cts +4 -4
- package/dist/ui/avatar.d.mts +4 -4
- package/dist/ui/badge.d.cts +1 -1
- package/dist/ui/badge.d.mts +1 -1
- package/dist/ui/breadcrumb.d.cts +8 -8
- package/dist/ui/breadcrumb.d.mts +8 -8
- package/dist/ui/button-group.d.cts +6 -6
- package/dist/ui/button-group.d.mts +4 -4
- package/dist/ui/button.d.cts +1 -1
- package/dist/ui/button.d.mts +1 -1
- package/dist/ui/calendar.cjs +1 -1
- package/dist/ui/calendar.d.cts +4 -4
- package/dist/ui/calendar.d.mts +4 -4
- package/dist/ui/calendar.mjs +1 -1
- package/dist/ui/card.d.cts +8 -8
- package/dist/ui/card.d.mts +8 -8
- package/dist/ui/carousel.d.cts +7 -7
- package/dist/ui/carousel.d.mts +7 -7
- package/dist/ui/checkbox.d.cts +2 -2
- package/dist/ui/checkbox.d.mts +2 -2
- package/dist/ui/collapsible.d.cts +4 -4
- package/dist/ui/collapsible.d.mts +4 -4
- package/dist/ui/command.d.cts +11 -11
- package/dist/ui/command.d.mts +11 -11
- package/dist/ui/context-menu.d.cts +16 -16
- package/dist/ui/context-menu.d.mts +16 -16
- package/dist/ui/dialog.d.cts +1 -1
- package/dist/ui/dialog.d.mts +1 -1
- package/dist/ui/drawer.d.cts +11 -11
- package/dist/ui/drawer.d.mts +11 -11
- package/dist/ui/dropdown-menu.d.cts +16 -16
- package/dist/ui/dropdown-menu.d.mts +16 -16
- package/dist/ui/empty.d.cts +7 -7
- package/dist/ui/empty.d.mts +9 -9
- package/dist/ui/field.cjs +1 -1
- package/dist/ui/field.d.cts +22 -22
- package/dist/ui/field.d.mts +24 -24
- package/dist/ui/field.mjs +1 -1
- package/dist/ui/file-uploader.d.cts +2 -2
- package/dist/ui/file-uploader.d.mts +2 -2
- package/dist/ui/form.cjs +1 -1
- package/dist/ui/form.d.cts +11 -11
- package/dist/ui/form.d.mts +11 -11
- package/dist/ui/form.mjs +1 -1
- package/dist/ui/hover-card.d.cts +4 -4
- package/dist/ui/hover-card.d.mts +4 -4
- package/dist/ui/input-otp.d.cts +5 -5
- package/dist/ui/input-otp.d.mts +5 -5
- package/dist/ui/input.d.cts +1 -1
- package/dist/ui/input.d.mts +1 -1
- package/dist/ui/inputs/search-input.d.cts +3 -3
- package/dist/ui/inputs/search-input.d.mts +3 -3
- package/dist/ui/item.d.cts +14 -14
- package/dist/ui/item.d.mts +14 -14
- package/dist/ui/label.cjs +1 -1
- package/dist/ui/label.d.cts +2 -2
- package/dist/ui/label.d.mts +2 -2
- package/dist/ui/label.mjs +1 -1
- package/dist/ui/menubar.d.cts +17 -17
- package/dist/ui/menubar.d.mts +17 -17
- package/dist/ui/multi-select.d.cts +2 -2
- package/dist/ui/multi-select.d.mts +3 -3
- package/dist/ui/navigation-menu.d.cts +11 -11
- package/dist/ui/navigation-menu.d.mts +9 -9
- package/dist/ui/pagination.d.cts +9 -9
- package/dist/ui/pagination.d.mts +9 -9
- package/dist/ui/popover.cjs +1 -1
- package/dist/ui/popover.d.cts +6 -6
- package/dist/ui/popover.d.mts +6 -6
- package/dist/ui/popover.mjs +1 -1
- package/dist/ui/progress.d.cts +2 -2
- package/dist/ui/progress.d.mts +2 -2
- package/dist/ui/radio-group.cjs +1 -1
- package/dist/ui/radio-group.d.cts +3 -3
- package/dist/ui/radio-group.d.mts +3 -3
- package/dist/ui/radio-group.mjs +1 -1
- package/dist/ui/resizable.d.cts +9 -9
- package/dist/ui/resizable.d.mts +9 -9
- package/dist/ui/scroll-area.d.cts +6 -6
- package/dist/ui/scroll-area.d.mts +6 -6
- package/dist/ui/select.cjs +1 -1
- package/dist/ui/select.d.cts +9 -9
- package/dist/ui/select.d.mts +9 -9
- package/dist/ui/select.mjs +1 -1
- package/dist/ui/separator.d.cts +2 -2
- package/dist/ui/separator.d.mts +2 -2
- package/dist/ui/sheet.d.cts +9 -9
- package/dist/ui/sheet.d.mts +9 -9
- package/dist/ui/sidebar.d.cts +26 -26
- package/dist/ui/sidebar.d.mts +26 -26
- package/dist/ui/skeleton.d.cts +2 -2
- package/dist/ui/skeleton.d.mts +2 -2
- package/dist/ui/slider.d.cts +2 -2
- package/dist/ui/slider.d.mts +2 -2
- package/dist/ui/sonner.d.cts +2 -2
- package/dist/ui/sonner.d.mts +2 -2
- package/dist/ui/spinner.d.cts +2 -2
- package/dist/ui/spinner.d.mts +2 -2
- package/dist/ui/switch.d.cts +2 -2
- package/dist/ui/switch.d.mts +2 -2
- package/dist/ui/table.d.cts +18 -18
- package/dist/ui/table.d.mts +18 -18
- package/dist/ui/tabs.d.cts +5 -5
- package/dist/ui/tabs.d.mts +5 -5
- package/dist/ui/textarea.cjs +1 -1
- package/dist/ui/textarea.d.cts +2 -2
- package/dist/ui/textarea.d.mts +2 -2
- package/dist/ui/textarea.mjs +1 -1
- package/dist/ui/toggle-group.d.cts +3 -3
- package/dist/ui/toggle-group.d.mts +3 -3
- package/dist/ui/toggle.d.cts +4 -4
- package/dist/ui/toggle.d.mts +4 -4
- package/dist/ui/tooltip.d.cts +5 -5
- package/dist/ui/tooltip.d.mts +5 -5
- package/package.json +1 -1
- package/dist/tables-Chn2pQSc.cjs +0 -4
- package/dist/tables-Chn2pQSc.cjs.map +0 -1
- package/dist/tables-eLIhswqW.mjs +0 -4
- package/dist/tables-eLIhswqW.mjs.map +0 -1
|
@@ -0,0 +1,1009 @@
|
|
|
1
|
+
import { t as AnyEntity } from "./types-CDYHkcOk.cjs";
|
|
2
|
+
import { t as Input } from "./input-BLyJp8UZ.cjs";
|
|
3
|
+
import * as react_jsx_runtime332 from "react/jsx-runtime";
|
|
4
|
+
import * as react257 from "react";
|
|
5
|
+
import { AccessorKeyColumnDef, CellContext, Column, ColumnPinningPosition, ColumnPinningState, Header, HeaderGroup, Row, RowSelectionState, Table } from "@tanstack/react-table";
|
|
6
|
+
import { VirtualItem, Virtualizer } from "@tanstack/react-virtual";
|
|
7
|
+
|
|
8
|
+
//#region packages/components/features/tables/components/atoms/badge-display.d.ts
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Renders a pill-shaped badge for a table cell that optionally supports a click
|
|
12
|
+
* action and an inline remove button; falls back to {@link UITableEmpty} when
|
|
13
|
+
* `label` is falsy.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* import { UITableBadgeDisplay } from '@customafk/lunas-ui/features/tables';
|
|
17
|
+
*
|
|
18
|
+
* <UITableBadgeDisplay
|
|
19
|
+
* label="Active"
|
|
20
|
+
* onClick={() => console.log('badge clicked')}
|
|
21
|
+
* onRemove={() => console.log('remove clicked')}
|
|
22
|
+
* />
|
|
23
|
+
*/
|
|
24
|
+
declare const UITableBadgeDisplay: React.FC<{
|
|
25
|
+
/** The text or number to display inside the badge. */
|
|
26
|
+
label: string | number | null | undefined;
|
|
27
|
+
/** Optional callback fired when the badge itself is clicked. */
|
|
28
|
+
onClick?: () => void;
|
|
29
|
+
/** When provided, renders a remove (×) button and fires this callback on click. */
|
|
30
|
+
onRemove?: () => void;
|
|
31
|
+
}>;
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region packages/components/features/tables/components/atoms/boolean-display.d.ts
|
|
34
|
+
/**
|
|
35
|
+
* Displays a green check icon for `true`, a red X icon for `false`, and a
|
|
36
|
+
* double-dash placeholder via {@link UITableEmpty} when the value is
|
|
37
|
+
* `null` or `undefined`.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* import { UITableBooleanDisplay } from '@customafk/lunas-ui/features/tables';
|
|
41
|
+
*
|
|
42
|
+
* <UITableBooleanDisplay value={isActive} />
|
|
43
|
+
*/
|
|
44
|
+
declare const UITableBooleanDisplay: React.FC<{
|
|
45
|
+
/** The boolean value to visualise; `null`/`undefined` renders an empty state. */
|
|
46
|
+
value: boolean | null | undefined;
|
|
47
|
+
}>;
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region packages/components/features/tables/components/atoms/currency-display.d.ts
|
|
50
|
+
/** Props for the {@link UITableCurrencyDisplay} component. */
|
|
51
|
+
type Props$7 = {
|
|
52
|
+
/** The numeric value to format as currency; falsy / `NaN` renders an empty state. */
|
|
53
|
+
value: number | string | null | undefined;
|
|
54
|
+
/** ISO 4217 currency code (default: `'USD'`). */
|
|
55
|
+
currency?: string;
|
|
56
|
+
/**
|
|
57
|
+
* BCP 47 locale used for number formatting (default: `'en-US'`).
|
|
58
|
+
* Controls digit grouping and decimal separators.
|
|
59
|
+
*/
|
|
60
|
+
locale?: string;
|
|
61
|
+
/** How to display the currency symbol — `'symbol'` (default), `'code'`, or `'name'`. */
|
|
62
|
+
display?: 'symbol' | 'code' | 'name';
|
|
63
|
+
/** Font-size variant (default: `'md'`). */
|
|
64
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
65
|
+
/** When `true`, applies a green tint for positive and red tint for negative values. */
|
|
66
|
+
colorize?: boolean;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Formats a numeric value as a locale-aware currency string in a table cell.
|
|
70
|
+
* Always shows exactly two decimal places and uses the browser's `Intl` API for
|
|
71
|
+
* symbol placement. Renders {@link UITableEmpty} when the value is absent or
|
|
72
|
+
* invalid.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* import { UITableCurrencyDisplay } from '@customafk/lunas-ui/features/tables';
|
|
76
|
+
*
|
|
77
|
+
* <UITableCurrencyDisplay value={1234.5} currency="USD" colorize />
|
|
78
|
+
*/
|
|
79
|
+
declare const UITableCurrencyDisplay: react257.MemoExoticComponent<({
|
|
80
|
+
value,
|
|
81
|
+
currency,
|
|
82
|
+
locale,
|
|
83
|
+
display,
|
|
84
|
+
size,
|
|
85
|
+
colorize
|
|
86
|
+
}: Props$7) => react_jsx_runtime332.JSX.Element>;
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region packages/components/features/tables/components/atoms/date-display.d.ts
|
|
89
|
+
/** Props for the {@link UITableDateDisplay} component. */
|
|
90
|
+
type Props$6 = {
|
|
91
|
+
/** The date value to format and display; `null`/`undefined` renders an empty state. */
|
|
92
|
+
date: Date | string | number | null | undefined;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Displays a date as a compact badge in a table cell with a tooltip that shows
|
|
96
|
+
* the full date and time on hover; renders {@link UITableEmpty} when `date` is
|
|
97
|
+
* `null` or `undefined`.
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* import { UITableDateDisplay } from '@customafk/lunas-ui/features/tables';
|
|
101
|
+
*
|
|
102
|
+
* <UITableDateDisplay date={new Date('2024-06-15T10:30:00Z')} />
|
|
103
|
+
*/
|
|
104
|
+
declare const UITableDateDisplay: React.FC<Props$6>;
|
|
105
|
+
//#endregion
|
|
106
|
+
//#region packages/components/features/tables/components/atoms/description-display.d.ts
|
|
107
|
+
/**
|
|
108
|
+
* Renders a two-line-clamped description in a table cell with a tooltip that
|
|
109
|
+
* reveals the full text and its character count; falls back to
|
|
110
|
+
* {@link UITableEmpty} when `content` is `null` or `undefined`.
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* import { UITableDescriptionDisplay } from '@customafk/lunas-ui/features/tables';
|
|
114
|
+
*
|
|
115
|
+
* <UITableDescriptionDisplay content="A detailed description of this record." />
|
|
116
|
+
*/
|
|
117
|
+
declare const UITableDescriptionDisplay: React.FC<{
|
|
118
|
+
/** The text or numeric value to display; `null`/`undefined` renders an empty state. */
|
|
119
|
+
content: string | null | undefined | number;
|
|
120
|
+
}>;
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region packages/components/features/tables/components/atoms/email-display.d.ts
|
|
123
|
+
/** Props for the {@link UITableEmailDisplay} component. */
|
|
124
|
+
type Props$5 = {
|
|
125
|
+
/** The email address to display; `null`/`undefined`/empty renders an empty state. */
|
|
126
|
+
email: string | null | undefined;
|
|
127
|
+
/** When `true`, a `mailto:` anchor wraps the address (default: `true`). */
|
|
128
|
+
linkable?: boolean;
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* Displays an email address in a table cell with a copy-to-clipboard button.
|
|
132
|
+
* Shows a brief checkmark confirmation after copying. Optionally wraps the
|
|
133
|
+
* address in a `mailto:` link. Renders {@link UITableEmpty} when `email` is
|
|
134
|
+
* absent.
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* import { UITableEmailDisplay } from '@customafk/lunas-ui/features/tables';
|
|
138
|
+
*
|
|
139
|
+
* <UITableEmailDisplay email="jane@example.com" />
|
|
140
|
+
*/
|
|
141
|
+
declare const UITableEmailDisplay: React.FC<Props$5>;
|
|
142
|
+
//#endregion
|
|
143
|
+
//#region packages/components/features/tables/components/atoms/list-display.d.ts
|
|
144
|
+
/** Props for the {@link UITableListDisplay} component. */
|
|
145
|
+
type Props$4 = {
|
|
146
|
+
/** Array of strings or numbers to render as inline pills. */
|
|
147
|
+
items: (string | number)[] | null | undefined;
|
|
148
|
+
/**
|
|
149
|
+
* Maximum number of pills shown before a `+N more` overflow badge appears
|
|
150
|
+
* (default: `3`).
|
|
151
|
+
*/
|
|
152
|
+
maxVisible?: number;
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* Renders an array of values as compact inline pills in a table cell. When the
|
|
156
|
+
* list exceeds `maxVisible`, a `+N more` badge is shown; hovering it reveals all
|
|
157
|
+
* remaining items in a tooltip. Renders {@link UITableEmpty} for empty or absent
|
|
158
|
+
* arrays.
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* import { UITableListDisplay } from '@customafk/lunas-ui/features/tables';
|
|
162
|
+
*
|
|
163
|
+
* <UITableListDisplay items={['React', 'TypeScript', 'TailwindCSS', 'Vite']} maxVisible={3} />
|
|
164
|
+
*/
|
|
165
|
+
declare const UITableListDisplay: React.FC<Props$4>;
|
|
166
|
+
//#endregion
|
|
167
|
+
//#region packages/components/features/tables/components/atoms/more-button.d.ts
|
|
168
|
+
/**
|
|
169
|
+
* A vertical-ellipsis icon button that opens a dropdown menu populated from the
|
|
170
|
+
* `items` array; intended for use in table row action columns.
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* import { UITableMoreButton } from '@customafk/lunas-ui/features/tables';
|
|
174
|
+
*
|
|
175
|
+
* <UITableMoreButton
|
|
176
|
+
* items={[
|
|
177
|
+
* { id: 'edit', label: 'Edit', onClick: (id) => console.log(id) },
|
|
178
|
+
* { id: 'delete', label: 'Delete', onClick: (id) => console.log(id) },
|
|
179
|
+
* ]}
|
|
180
|
+
* />
|
|
181
|
+
*/
|
|
182
|
+
declare const UITableMoreButton: React.FC<{
|
|
183
|
+
/**
|
|
184
|
+
* List of menu items to render inside the dropdown.
|
|
185
|
+
* Each item must have a unique `id`, a display `label`, and an `onClick`
|
|
186
|
+
* handler that receives the item's `id`.
|
|
187
|
+
*/
|
|
188
|
+
items?: {
|
|
189
|
+
id: string;
|
|
190
|
+
label: string;
|
|
191
|
+
onClick: (id: string) => void;
|
|
192
|
+
}[];
|
|
193
|
+
/** Reserved for future use; currently unused by the component. */
|
|
194
|
+
onClick?: () => void;
|
|
195
|
+
}>;
|
|
196
|
+
//#endregion
|
|
197
|
+
//#region packages/components/features/tables/components/atoms/name-display.d.ts
|
|
198
|
+
/** Props for the {@link UITableNameDisplay} component. */
|
|
199
|
+
type NameDisplayProps = {
|
|
200
|
+
/** The name string to display; renders an empty placeholder when falsy. */
|
|
201
|
+
name?: string | null | undefined;
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* Renders a clamped, truncated name string inside a tooltip that shows the full
|
|
205
|
+
* text and character count on hover; falls back to {@link UITableEmpty} when the
|
|
206
|
+
* value is absent.
|
|
207
|
+
*
|
|
208
|
+
* @example
|
|
209
|
+
* import { UITableNameDisplay } from '@customafk/lunas-ui/features/tables';
|
|
210
|
+
*
|
|
211
|
+
* <UITableNameDisplay name="John Doe" />
|
|
212
|
+
*/
|
|
213
|
+
declare const UITableNameDisplay: React.FC<NameDisplayProps>;
|
|
214
|
+
//#endregion
|
|
215
|
+
//#region packages/components/features/tables/components/atoms/permalink.d.ts
|
|
216
|
+
/**
|
|
217
|
+
* Renders an external-link anchor with an icon for use in table cells, opening
|
|
218
|
+
* the target URL in a new tab with safe `rel` attributes.
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* import { UITablePermalink } from '@customafk/lunas-ui/features/tables';
|
|
222
|
+
*
|
|
223
|
+
* <UITablePermalink href="https://example.com/records/42" label="View record" />
|
|
224
|
+
*/
|
|
225
|
+
declare const UITablePermalink: React.FC<{
|
|
226
|
+
/** The destination URL the anchor navigates to. */
|
|
227
|
+
href: string;
|
|
228
|
+
/** Optional display text; falls back to the raw `href` when omitted. */
|
|
229
|
+
label?: string;
|
|
230
|
+
}>;
|
|
231
|
+
//#endregion
|
|
232
|
+
//#region packages/components/features/tables/components/atoms/phone-number.d.ts
|
|
233
|
+
/**
|
|
234
|
+
* Formats and displays a phone number string in a table cell using the
|
|
235
|
+
* `(NXX) NXX-XXXX` pattern, with a tooltip that shows the full international
|
|
236
|
+
* dialling representation.
|
|
237
|
+
*
|
|
238
|
+
* @example
|
|
239
|
+
* import { UITablePhoneNumberDisplay } from '@customafk/lunas-ui/features/tables';
|
|
240
|
+
*
|
|
241
|
+
* <UITablePhoneNumberDisplay value="0843456789" />
|
|
242
|
+
*/
|
|
243
|
+
declare const UITablePhoneNumberDisplay: React.FC<React.PropsWithChildren<{
|
|
244
|
+
/** The raw phone number string to format and display. */
|
|
245
|
+
value: string;
|
|
246
|
+
}>>;
|
|
247
|
+
//#endregion
|
|
248
|
+
//#region packages/components/features/tables/components/atoms/progress-display.d.ts
|
|
249
|
+
/** Props for the {@link UITableProgressDisplay} component. */
|
|
250
|
+
type Props$3 = {
|
|
251
|
+
/** Percentage value between 0 and 100; `null`/`undefined` renders an empty state. */
|
|
252
|
+
value: number | null | undefined;
|
|
253
|
+
/** When `true`, shows the numeric percentage next to the bar (default: `true`). */
|
|
254
|
+
showLabel?: boolean;
|
|
255
|
+
/**
|
|
256
|
+
* Color thresholds applied to the progress indicator.
|
|
257
|
+
* - `≥ successThreshold` → green
|
|
258
|
+
* - `≥ warningThreshold` → yellow
|
|
259
|
+
* - otherwise → red
|
|
260
|
+
*
|
|
261
|
+
* Defaults: `successThreshold = 70`, `warningThreshold = 40`.
|
|
262
|
+
*/
|
|
263
|
+
successThreshold?: number;
|
|
264
|
+
warningThreshold?: number;
|
|
265
|
+
};
|
|
266
|
+
/**
|
|
267
|
+
* Renders a horizontal progress bar with an optional percentage label for a
|
|
268
|
+
* table cell. The bar color shifts from red → yellow → green based on
|
|
269
|
+
* configurable thresholds. Renders {@link UITableEmpty} when `value` is absent.
|
|
270
|
+
*
|
|
271
|
+
* @example
|
|
272
|
+
* import { UITableProgressDisplay } from '@customafk/lunas-ui/features/tables';
|
|
273
|
+
*
|
|
274
|
+
* <UITableProgressDisplay value={75} />
|
|
275
|
+
*/
|
|
276
|
+
declare const UITableProgressDisplay: react257.MemoExoticComponent<({
|
|
277
|
+
value,
|
|
278
|
+
showLabel,
|
|
279
|
+
successThreshold,
|
|
280
|
+
warningThreshold
|
|
281
|
+
}: Props$3) => react_jsx_runtime332.JSX.Element>;
|
|
282
|
+
//#endregion
|
|
283
|
+
//#region packages/components/features/tables/components/atoms/remove-button.d.ts
|
|
284
|
+
/**
|
|
285
|
+
* A ghost danger icon button with a trash icon that triggers an async removal
|
|
286
|
+
* handler; displays a descriptive tooltip on hover to confirm the action intent.
|
|
287
|
+
*
|
|
288
|
+
* @example
|
|
289
|
+
* import { UITableRemoveButton } from '@customafk/lunas-ui/features/tables';
|
|
290
|
+
*
|
|
291
|
+
* <UITableRemoveButton
|
|
292
|
+
* title="Remove member from project"
|
|
293
|
+
* onClick={async () => await deleteRow(rowId)}
|
|
294
|
+
* />
|
|
295
|
+
*/
|
|
296
|
+
declare const UITableRemoveButton: React.FC<{
|
|
297
|
+
/** Tooltip label describing what will be removed; defaults to a generic message. */
|
|
298
|
+
title?: string;
|
|
299
|
+
/** Async-compatible callback invoked when the button is clicked. */
|
|
300
|
+
onClick?: () => void | Promise<void>;
|
|
301
|
+
}>;
|
|
302
|
+
//#endregion
|
|
303
|
+
//#region packages/components/features/tables/components/atoms/statistic.d.ts
|
|
304
|
+
/** Props for the {@link UITableStatisticDisplay} component. */
|
|
305
|
+
type Props$2 = {
|
|
306
|
+
/** Character used to separate the integer and fractional parts (default: `'.'`). */
|
|
307
|
+
decimalSeparator?: string;
|
|
308
|
+
/** Character used to separate thousands groups (default: `','`). */
|
|
309
|
+
groupSeparator?: string;
|
|
310
|
+
/** Optional node rendered before the formatted number (e.g. a currency symbol). */
|
|
311
|
+
prefix?: React.ReactNode;
|
|
312
|
+
/** Optional node rendered after the formatted number (e.g. a unit label). */
|
|
313
|
+
suffix?: React.ReactNode;
|
|
314
|
+
/** Number of decimal digits to display. */
|
|
315
|
+
precision?: number;
|
|
316
|
+
/** Rounding strategy applied before formatting (default: `'round'`). */
|
|
317
|
+
roundingMode?: 'round' | 'floor' | 'ceil';
|
|
318
|
+
/** When `true`, pads the fractional part with trailing zeros up to `precision` digits. */
|
|
319
|
+
showTrailingZeros?: boolean;
|
|
320
|
+
/** Font-size variant for the displayed number (default: `'lg'`). */
|
|
321
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
322
|
+
/** The numeric or string value to format; falsy / invalid values render an empty state. */
|
|
323
|
+
value: number | string | null | undefined;
|
|
324
|
+
};
|
|
325
|
+
/**
|
|
326
|
+
* A memoized table-cell component that formats a numeric value with configurable
|
|
327
|
+
* separators, precision, rounding, and size; renders {@link UITableEmpty} when
|
|
328
|
+
* the value is zero, invalid, or absent.
|
|
329
|
+
*
|
|
330
|
+
* @example
|
|
331
|
+
* import { UITableStatisticDisplay } from '@customafk/lunas-ui/features/tables';
|
|
332
|
+
*
|
|
333
|
+
* <UITableStatisticDisplay value={1234567.89} precision={2} prefix="$" size="md" />
|
|
334
|
+
*/
|
|
335
|
+
declare const UITableStatisticDisplay: react257.MemoExoticComponent<({
|
|
336
|
+
decimalSeparator,
|
|
337
|
+
groupSeparator,
|
|
338
|
+
prefix: Prefix,
|
|
339
|
+
suffix: Suffix,
|
|
340
|
+
precision,
|
|
341
|
+
roundingMode,
|
|
342
|
+
showTrailingZeros,
|
|
343
|
+
size,
|
|
344
|
+
value
|
|
345
|
+
}: Props$2) => react_jsx_runtime332.JSX.Element>;
|
|
346
|
+
//#endregion
|
|
347
|
+
//#region packages/components/features/tables/components/atoms/status-display.d.ts
|
|
348
|
+
type BadgeColor = 'primary' | 'secondary' | 'muted' | 'accent' | 'info' | 'success' | 'warning' | 'danger';
|
|
349
|
+
/** Props for the {@link UITableStatusDisplay} component. */
|
|
350
|
+
type Props$1 = {
|
|
351
|
+
/** The status string to display; `null`/`undefined` renders an empty state. */
|
|
352
|
+
value: string | null | undefined;
|
|
353
|
+
/**
|
|
354
|
+
* Maps each status string to a badge color. Any key not present in the map
|
|
355
|
+
* falls back to `defaultColor`.
|
|
356
|
+
*/
|
|
357
|
+
colorMap?: Record<string, BadgeColor>;
|
|
358
|
+
/** Color used when `value` is not found in `colorMap` (default: `'muted'`). */
|
|
359
|
+
defaultColor?: BadgeColor;
|
|
360
|
+
/** Badge variant forwarded to the underlying {@link Badge} (default: `'soft'`). */
|
|
361
|
+
variant?: 'solid' | 'soft' | 'outline';
|
|
362
|
+
};
|
|
363
|
+
/**
|
|
364
|
+
* Renders a color-coded status badge for a table cell. The mapping from status
|
|
365
|
+
* string to badge color is fully configurable via `colorMap`; unknown statuses
|
|
366
|
+
* fall back to `defaultColor`.
|
|
367
|
+
*
|
|
368
|
+
* @example
|
|
369
|
+
* import { UITableStatusDisplay } from '@customafk/lunas-ui/features/tables';
|
|
370
|
+
*
|
|
371
|
+
* <UITableStatusDisplay
|
|
372
|
+
* value="active"
|
|
373
|
+
* colorMap={{ active: 'success', inactive: 'danger', pending: 'warning' }}
|
|
374
|
+
* />
|
|
375
|
+
*/
|
|
376
|
+
declare const UITableStatusDisplay: React.FC<Props$1>;
|
|
377
|
+
//#endregion
|
|
378
|
+
//#region packages/components/features/tables/components/atoms/user.d.ts
|
|
379
|
+
/** Props for the {@link UITableUserDataDisplay} component. */
|
|
380
|
+
type Props = {
|
|
381
|
+
/** Unique identifier used to deterministically generate the avatar background colour. */
|
|
382
|
+
uuid?: string | null | undefined;
|
|
383
|
+
/** Display name shown below the avatar; falls back to `'Unknown User'` when absent. */
|
|
384
|
+
username?: string | null | undefined;
|
|
385
|
+
/** Email address shown as secondary text beneath the username. */
|
|
386
|
+
email?: string | null | undefined;
|
|
387
|
+
};
|
|
388
|
+
/**
|
|
389
|
+
* Renders a user avatar paired with username and email for use in table cells;
|
|
390
|
+
* derives a consistent avatar background colour from the user's `uuid` via a
|
|
391
|
+
* colour-hash utility.
|
|
392
|
+
*
|
|
393
|
+
* @example
|
|
394
|
+
* import { UITableUserDataDisplay } from '@customafk/lunas-ui/features/tables';
|
|
395
|
+
*
|
|
396
|
+
* <UITableUserDataDisplay
|
|
397
|
+
* uuid="a1b2c3d4-e5f6-7890-abcd-ef1234567890"
|
|
398
|
+
* username="Jane Smith"
|
|
399
|
+
* email="jane@example.com"
|
|
400
|
+
* />
|
|
401
|
+
*/
|
|
402
|
+
declare const UITableUserDataDisplay: React.FC<Props>;
|
|
403
|
+
//#endregion
|
|
404
|
+
//#region packages/components/features/tables/types.d.ts
|
|
405
|
+
/**
|
|
406
|
+
* Base constraint for all row data objects used with UITable.
|
|
407
|
+
*
|
|
408
|
+
* Any property key is allowed so that generic column definitions remain
|
|
409
|
+
* flexible, but the optional `subRows` field is the well-known expansion
|
|
410
|
+
* hook understood by TanStack Table's grouped-row model.
|
|
411
|
+
*/
|
|
412
|
+
type RowData<TData extends RowData<AnyEntity>> = {
|
|
413
|
+
/** Allows any property key so column `accessorKey` values type-check. */
|
|
414
|
+
[x: string | number | symbol]: AnyEntity;
|
|
415
|
+
/** Nested child rows used by the grouped/expanded row model. */
|
|
416
|
+
subRows?: TData[] | undefined;
|
|
417
|
+
};
|
|
418
|
+
/** Props for `UITableEmptyDisplay` — controls which placeholder state is shown. */
|
|
419
|
+
type TUITableEmptyDisplay = {
|
|
420
|
+
/** When `true` a loading spinner is shown instead of the empty-box illustration. */
|
|
421
|
+
isFetching?: boolean;
|
|
422
|
+
/** When `true` (and `isFetching` is `false`) the "No data available" illustration is shown. */
|
|
423
|
+
isEmpty?: boolean;
|
|
424
|
+
/** When `true` a "Refetching data..." message is shown below the spinner to indicate a background refresh. */
|
|
425
|
+
isRefetching?: boolean;
|
|
426
|
+
/** CSS height of the overlay container. Defaults to `384px` (`min-h-96`) when omitted. */
|
|
427
|
+
height?: React.CSSProperties['height'];
|
|
428
|
+
};
|
|
429
|
+
/** Props for `UITableWrapper` — all native `<div>` attributes are forwarded. */
|
|
430
|
+
type TUITableWrapper = React.PropsWithChildren<React.ComponentProps<'div'>>;
|
|
431
|
+
/** Props for `UITableInnerWrapper` — all native `<div>` attributes are forwarded. */
|
|
432
|
+
type TUITableInnerWrapper = React.PropsWithChildren<React.ComponentProps<'div'>>;
|
|
433
|
+
/** Props for `UITableInnerTable` — all native `<table>` attributes are forwarded. */
|
|
434
|
+
type TUITableInnerTable = React.PropsWithChildren<React.ComponentProps<'table'>>;
|
|
435
|
+
/** Props for `UITableHead` — all native `<thead>` attributes are forwarded. */
|
|
436
|
+
type TUITableHead = React.PropsWithChildren<React.ComponentProps<'thead'>>;
|
|
437
|
+
/** Props for `UITableHeadCellOption` — the pin/unpin dropdown on a header cell. */
|
|
438
|
+
type TUITableHeadCellOption = {
|
|
439
|
+
/** Current pinning position of the column (`'left'`, `'right'`, or `false`). */
|
|
440
|
+
isPinned?: ColumnPinningPosition;
|
|
441
|
+
/** Whether the column is currently visible; reserved for future hide/show actions. */
|
|
442
|
+
isVisible?: boolean;
|
|
443
|
+
/** Additional CSS classes applied to the dropdown trigger button. */
|
|
444
|
+
className?: string;
|
|
445
|
+
/** Called with `'left'` when the user selects "Pin to Left". */
|
|
446
|
+
onLeftPin?: (pos: ColumnPinningPosition) => void;
|
|
447
|
+
/** Called with `'right'` when the user selects "Pin to Right". */
|
|
448
|
+
onRightPin?: (pos: ColumnPinningPosition) => void;
|
|
449
|
+
/** Called with `false` when the user selects "Unpin". */
|
|
450
|
+
onUnpin?: (pos: ColumnPinningPosition) => void;
|
|
451
|
+
/** Called when the user toggles column visibility via the dropdown. */
|
|
452
|
+
onToggleVisibility?: (props: AnyEntity) => void;
|
|
453
|
+
};
|
|
454
|
+
/** Props for `UITableHeadCellSelect` — the "select all rows" header checkbox cell. */
|
|
455
|
+
type TUITableHeadCellSelect = React.ComponentProps<'th'> & {
|
|
456
|
+
/** Whether the column is pinned to a side (the select cell is always sticky). */
|
|
457
|
+
isPinned?: ColumnPinningPosition;
|
|
458
|
+
/** Reflects `table.getIsAllRowsSelected()` to set the checkbox state. */
|
|
459
|
+
isAllRowsSelected?: boolean;
|
|
460
|
+
/** Calls `table.toggleAllRowsSelected` when the checkbox value changes. */
|
|
461
|
+
onToggleAllRowsSelected?: (value?: boolean) => void;
|
|
462
|
+
};
|
|
463
|
+
/** Props for `UITableHeadRow` — a single header `<tr>` built from a TanStack `HeaderGroup`. */
|
|
464
|
+
type TUITableHeadRow = React.PropsWithChildren<React.ComponentProps<'tr'> & {
|
|
465
|
+
/** The TanStack `HeaderGroup` whose `headers` are rendered as `<th>` cells. */
|
|
466
|
+
headerGroup: HeaderGroup<unknown>;
|
|
467
|
+
/** Forwarded to `UITableHeadCellSelect`; toggles all-row selection. */
|
|
468
|
+
onToggleAllRowsSelected?: (value?: boolean) => void;
|
|
469
|
+
}>;
|
|
470
|
+
/** Props for `UITableHeadCell` — a single data `<th>` with pinning and resize support. */
|
|
471
|
+
type TUITableHeadCell = React.PropsWithChildren<React.ComponentProps<'th'> & {
|
|
472
|
+
/** Whether the column is currently visible (used for future hide/show UI). */
|
|
473
|
+
isVisible?: boolean;
|
|
474
|
+
/** Current pinning position (`'left'`, `'right'`, or `false`). */
|
|
475
|
+
isPinned?: ColumnPinningPosition;
|
|
476
|
+
/** `true` when this is the first cell in the right-pinned group (adds a left border). */
|
|
477
|
+
isFirstCell?: boolean;
|
|
478
|
+
/** `true` when this is the last cell in the left-pinned group (adds a right border). */
|
|
479
|
+
isLastCell?: boolean;
|
|
480
|
+
/** When `false` the pin/unpin option dropdown is hidden (e.g. `actions` column). */
|
|
481
|
+
isOptionsVisible?: boolean;
|
|
482
|
+
/** Column id used to look up the CSS custom property `--header-<id>-size`. */
|
|
483
|
+
headerId?: string;
|
|
484
|
+
/** TanStack `Column` instance used to derive `left`/`right` sticky offsets and size constraints. */
|
|
485
|
+
headerColumn?: Column<unknown, unknown>;
|
|
486
|
+
/** Calls `column.pin` with the chosen `ColumnPinningPosition`. */
|
|
487
|
+
onColumnPin?: (pos: ColumnPinningPosition) => void;
|
|
488
|
+
/** Calls `column.toggleVisibility` when hide/show is triggered from the dropdown. */
|
|
489
|
+
onToggleVisibility?: (value?: boolean) => void;
|
|
490
|
+
}>;
|
|
491
|
+
/** Props for `UITableBody` — the virtual-scroll `<tbody>` container. */
|
|
492
|
+
type TUITableBody = React.PropsWithChildren<React.ComponentProps<'tbody'> & {
|
|
493
|
+
/** When `true` the body renders `null` (loading state is handled by `UITableEmptyDisplay`). */
|
|
494
|
+
isFetching?: boolean;
|
|
495
|
+
/** When `true` the body renders `null` (empty state is handled by `UITableEmptyDisplay`). */
|
|
496
|
+
isEmpty?: boolean;
|
|
497
|
+
/** CSS string for the total virtual height of all rows, e.g. `"4200px"`. */
|
|
498
|
+
height: string;
|
|
499
|
+
}>;
|
|
500
|
+
/** Props for `UITableRow` — a single virtualised data `<tr>`. */
|
|
501
|
+
type TUITableRow = React.ComponentProps<'tr'> & {
|
|
502
|
+
/** The TanStack `Row` object whose visible cells are iterated. */
|
|
503
|
+
row: Row<AnyEntity>;
|
|
504
|
+
/** Whether this row is currently selected (drives `data-selected` attribute). */
|
|
505
|
+
isSelected?: boolean;
|
|
506
|
+
/** Zero-based virtual row index used for `data-index` and passed to `onClickRow`. */
|
|
507
|
+
virtualRowIndex: number;
|
|
508
|
+
/** Pixel offset from the top of the scroll container for the CSS `translateY`. */
|
|
509
|
+
virtualRowStart: number;
|
|
510
|
+
};
|
|
511
|
+
/** Props for `UITableCellSelect` — the per-row selection checkbox `<td>`. */
|
|
512
|
+
type TUITableCellSelect = React.ComponentProps<'td'> & {
|
|
513
|
+
/** Pinning position; the select cell is always rendered sticky regardless. */
|
|
514
|
+
isPinned?: ColumnPinningPosition;
|
|
515
|
+
/** Whether the checkbox should appear checked. */
|
|
516
|
+
isSelected?: boolean;
|
|
517
|
+
/** Calls `row.toggleSelected` when the checkbox value changes. */
|
|
518
|
+
onToggleRowSelected?: (value?: boolean) => void;
|
|
519
|
+
};
|
|
520
|
+
/** Props for `UITableCellActions` — the sticky right-edge actions `<td>`. */
|
|
521
|
+
type TUITableCellActions = React.ComponentProps<'td'> & {
|
|
522
|
+
/** Virtual row index forwarded to the cell renderer via `data-cell`. */
|
|
523
|
+
virtualRowIndex: number;
|
|
524
|
+
/** TanStack `Column` whose `columnDef.cell` is rendered inside the `<td>`. */
|
|
525
|
+
column?: Column<unknown, unknown>;
|
|
526
|
+
/** Returns the `CellContext` passed to `flexRender`. */
|
|
527
|
+
getContext: () => CellContext<unknown, unknown>;
|
|
528
|
+
};
|
|
529
|
+
/** Props for `UITableCell` — a standard data `<td>` with pinning and sizing support. */
|
|
530
|
+
type TUITableCell = React.ComponentProps<'td'> & {
|
|
531
|
+
/** Current pinning position of the column. */
|
|
532
|
+
isPinned?: ColumnPinningPosition;
|
|
533
|
+
/** `true` when this is the first cell in the right-pinned group (adds a left border separator). */
|
|
534
|
+
isFirstCell?: boolean;
|
|
535
|
+
/** `true` when this is the last cell in the left-pinned group (adds a right border separator). */
|
|
536
|
+
isLastCell?: boolean;
|
|
537
|
+
/** Column id used to read `--col-<id>-size` CSS custom property for width. */
|
|
538
|
+
colId?: string;
|
|
539
|
+
/** Unused reserved field for a future per-cell identifier. */
|
|
540
|
+
cellId?: string;
|
|
541
|
+
/** Horizontal alignment of the cell content (`'start'` is the default). */
|
|
542
|
+
position?: 'start' | 'center' | 'end';
|
|
543
|
+
/** TanStack `Column` instance used to derive sticky offsets and content-fit sizing. */
|
|
544
|
+
column?: Column<unknown, unknown>;
|
|
545
|
+
/** Returns the `CellContext` passed to `flexRender`. */
|
|
546
|
+
getContext: () => CellContext<unknown, unknown>;
|
|
547
|
+
};
|
|
548
|
+
/** Props for `UITableFooter` — all native `<tfoot>` attributes are forwarded. */
|
|
549
|
+
type TUITableFooter = React.PropsWithChildren<React.ComponentProps<'tfoot'>>;
|
|
550
|
+
/** Props for `UITableLoadMore` — the append-row "load more" trigger. */
|
|
551
|
+
type TUITableLoadMore = React.PropsWithChildren<React.ComponentProps<'tr'> & {
|
|
552
|
+
/** Virtual index of this synthetic row (appended after the last data row). */
|
|
553
|
+
virtualRowIndex: number;
|
|
554
|
+
/** Pixel offset used for the CSS `translateY` to position the row correctly. */
|
|
555
|
+
virtualRowStart: number;
|
|
556
|
+
/**
|
|
557
|
+
* Async callback that fetches the next page of data.
|
|
558
|
+
* When omitted the component renders `null`.
|
|
559
|
+
*/
|
|
560
|
+
fetchMoreData?: () => void | Promise<void>;
|
|
561
|
+
}>;
|
|
562
|
+
/**
|
|
563
|
+
* Typed column definition accepted by `UITableProvider`.
|
|
564
|
+
*
|
|
565
|
+
* Extends TanStack's `AccessorKeyColumnDef` with a typed `meta` block so that
|
|
566
|
+
* the alignment and auto-fit behaviour can be specified in a type-safe manner.
|
|
567
|
+
*/
|
|
568
|
+
type TUITableColumn<TData extends RowData<TData>> = Pick<AccessorKeyColumnDef<TData, AnyEntity>, 'id' | 'accessorKey' | 'size' | 'maxSize' | 'minSize' | 'header' | 'cell' | 'meta'> & {
|
|
569
|
+
meta?: {
|
|
570
|
+
/** Horizontal alignment of the column's cells and header. Defaults to `'start'`. */
|
|
571
|
+
position?: 'start' | 'center' | 'end';
|
|
572
|
+
/** When `true`, the cell auto-expands to fit its rendered content width. */
|
|
573
|
+
fitContent?: boolean;
|
|
574
|
+
};
|
|
575
|
+
};
|
|
576
|
+
/** A single cell in a CSV export row. */
|
|
577
|
+
type CsvCell = {
|
|
578
|
+
/** Column header label for this cell. */
|
|
579
|
+
label: string;
|
|
580
|
+
/** Cell value — numbers render right-aligned in spreadsheet editors. */
|
|
581
|
+
value: string | number | boolean | null | undefined;
|
|
582
|
+
};
|
|
583
|
+
/**
|
|
584
|
+
* Value shape of the root `TableContext` consumed by toolbar and body
|
|
585
|
+
* components via `useUITableContext`.
|
|
586
|
+
*/
|
|
587
|
+
type TTableContext<TData extends RowData<TData>> = {
|
|
588
|
+
/** Human-readable table title rendered in `UITableTooltip`. */
|
|
589
|
+
title: string;
|
|
590
|
+
/** The TanStack `Table` instance for the current dataset. */
|
|
591
|
+
table: Table<TData>;
|
|
592
|
+
/** `true` when no rows exist after a successful (non-loading) fetch. */
|
|
593
|
+
isEmpty: boolean;
|
|
594
|
+
/** `true` while the initial data fetch is in-flight. */
|
|
595
|
+
isFetching?: boolean;
|
|
596
|
+
/** `true` while a background refetch is running (data is already present). */
|
|
597
|
+
isRefetching?: boolean;
|
|
598
|
+
/** `true` while any data fetch is in-flight; deprecated in favor of `isFetching` and `isRefetching`. */
|
|
599
|
+
isLoading?: boolean;
|
|
600
|
+
/** The rows currently visible when loading data */
|
|
601
|
+
loadingDisplayRow?: number;
|
|
602
|
+
/** Total number of rows in the remote dataset, used for virtual scroll height. */
|
|
603
|
+
totalRows?: number;
|
|
604
|
+
/** Callback that loads the next page; forwarded to `UITableLoadMore`. */
|
|
605
|
+
fetchMoreData?: () => void | Promise<void>;
|
|
606
|
+
/** CSS height of the `UITableEmptyDisplay` overlay. Defaults to `384px` when omitted. */
|
|
607
|
+
emptyDisplayHeight?: React.CSSProperties['height'];
|
|
608
|
+
/** CSV export rows; each row is an ordered array of `{ label, value }` cells. */
|
|
609
|
+
csvData?: CsvCell[][];
|
|
610
|
+
/** File name (without `.csv`) for the downloaded file. Defaults to the table title. */
|
|
611
|
+
csvFileName?: string;
|
|
612
|
+
/** Definitions of all filterable fields shown in the "Add Filter" dropdown. */
|
|
613
|
+
filterDefinitions?: FilterDefinition[];
|
|
614
|
+
/** Called with the full list of active filters whenever filters are added, removed, or updated. */
|
|
615
|
+
onFilterChange?: (filters: ActiveFilter[]) => void;
|
|
616
|
+
};
|
|
617
|
+
/** Context value provided by `UITableInnerWrapperProvider`. */
|
|
618
|
+
type TTableInnerWrapperContext = {
|
|
619
|
+
/** Stable `useId`-generated id on the scrollable inner wrapper `<div>`. */
|
|
620
|
+
innerWrapperId: string;
|
|
621
|
+
};
|
|
622
|
+
/** Context value provided by `UITableInnerTableProvider`. */
|
|
623
|
+
type TTableInnerTableContext = {
|
|
624
|
+
/** The TanStack `Table` instance (typed as `AnyEntity` for the context boundary). */
|
|
625
|
+
table: Table<AnyEntity>;
|
|
626
|
+
/** Stable `useId`-generated id on the `<table>` element. */
|
|
627
|
+
innerTableId: string;
|
|
628
|
+
/** Pre-computed sum of all column sizes used as the `<table>` `minWidth`. */
|
|
629
|
+
totalSize: number;
|
|
630
|
+
};
|
|
631
|
+
/** Context value provided by `UITableHeadRowProvider`. */
|
|
632
|
+
type TTableHeadRowContext = {
|
|
633
|
+
/** Whether every visible row is currently selected. */
|
|
634
|
+
isAllRowsSelected: boolean;
|
|
635
|
+
/** The current `{ left, right }` column pinning map. */
|
|
636
|
+
columnPinningState: ColumnPinningState;
|
|
637
|
+
/** Ordered list of `Header` objects in the left-pinned group. */
|
|
638
|
+
leftPinnedHeaders: Header<AnyEntity, unknown>[];
|
|
639
|
+
/** Ordered list of `Header` objects in the right-pinned group. */
|
|
640
|
+
rightPinnedHeaders: Header<AnyEntity, unknown>[];
|
|
641
|
+
/** Toggles all-row selection; delegates to `table.toggleAllRowsSelected`. */
|
|
642
|
+
onToggleAllRowsSelected?: (value?: boolean) => void;
|
|
643
|
+
};
|
|
644
|
+
/** Context value provided by `UITableBodyProvider`. */
|
|
645
|
+
type TTableBodyContext = {
|
|
646
|
+
/** `true` while data is loading; causes `UITableBody` to render `null`. */
|
|
647
|
+
isFetching: boolean;
|
|
648
|
+
/** `true` while a background refetch is running; passed to `UITableEmptyDisplay`. */
|
|
649
|
+
isRefetching: boolean;
|
|
650
|
+
/** `true` when there are no rows after a successful fetch. */
|
|
651
|
+
isEmpty: boolean;
|
|
652
|
+
/** The current `Record<rowId, boolean>` row-selection map from TanStack state. */
|
|
653
|
+
rowSelectionState: RowSelectionState;
|
|
654
|
+
};
|
|
655
|
+
/** Context value provided by `UITableRowProvider`, consumed by individual `UITableRow` renders. */
|
|
656
|
+
type TTableRowContext<TData extends RowData<TData> = RowData<AnyEntity>, TKey extends keyof TData = keyof TData> = {
|
|
657
|
+
/** The data key whose value is passed as the second argument to `onClickRow`. */
|
|
658
|
+
keyOfClickRow?: TKey;
|
|
659
|
+
/** Whether all rows are selected (drives the select cell's checked state). */
|
|
660
|
+
isAllRowsSelected?: boolean;
|
|
661
|
+
/** The current `{ left, right }` column pinning map used by each cell. */
|
|
662
|
+
columnPinningState: ColumnPinningState;
|
|
663
|
+
/** Called with the virtual row index and the extracted `keyOfClickRow` value. */
|
|
664
|
+
onClickRow?: (rowIndex: number, rowId?: AnyEntity) => void;
|
|
665
|
+
/** Left-pinned headers used to determine border separator placement. */
|
|
666
|
+
leftPinnedHeaders?: Header<TData, unknown>[];
|
|
667
|
+
/** Right-pinned headers used to determine border separator placement. */
|
|
668
|
+
rightPinnedHeaders?: Header<TData, unknown>[];
|
|
669
|
+
};
|
|
670
|
+
/** Context value for the virtualiser, shared between the body and the load-more row. */
|
|
671
|
+
type TTableVirtualizerContext = {
|
|
672
|
+
/** The TanStack Virtual `Virtualizer` instance driving row windowing. */
|
|
673
|
+
rowVirtualizer: Virtualizer<HTMLDivElement, HTMLTableRowElement>;
|
|
674
|
+
/** The currently visible `VirtualItem` slice (index + start offset for each row). */
|
|
675
|
+
virtualItems: VirtualItem[];
|
|
676
|
+
};
|
|
677
|
+
/**
|
|
678
|
+
* Props accepted by `UITableProvider` — the single entry point for configuring
|
|
679
|
+
* a UITable instance.
|
|
680
|
+
*
|
|
681
|
+
* @example
|
|
682
|
+
* ```tsx
|
|
683
|
+
* import { UITableProvider } from '@customafk/lunas-ui/features/tables';
|
|
684
|
+
*
|
|
685
|
+
* <UITableProvider<User>
|
|
686
|
+
* title="Users"
|
|
687
|
+
* data={users}
|
|
688
|
+
* columns={columns}
|
|
689
|
+
* totalRows={total}
|
|
690
|
+
* isFetching={isLoading}
|
|
691
|
+
* leftPinnedColumns={['name']}
|
|
692
|
+
* onClickRow={(index, id) => openDetail(id)}
|
|
693
|
+
* onRowSelection={sel => setSelected(sel)}
|
|
694
|
+
* fetchMoreData={fetchNextPage}
|
|
695
|
+
* >
|
|
696
|
+
* <UITable />
|
|
697
|
+
* </UITableProvider>
|
|
698
|
+
* ```
|
|
699
|
+
*/
|
|
700
|
+
type TableProviderProps<TData extends RowData<TData>, TKey extends keyof TData = keyof TData, TColumns extends ReadonlyArray<TUITableColumn<TData>> = TUITableColumn<TData>[]> = {
|
|
701
|
+
/** Human-readable label shown in `UITableTooltip`. */
|
|
702
|
+
title: string;
|
|
703
|
+
/** Pass `true` while the initial page of data is being fetched. */
|
|
704
|
+
isFetching?: boolean;
|
|
705
|
+
/** Pass `true` while a background refetch is running (stale data remains visible). */
|
|
706
|
+
isRefetching?: boolean;
|
|
707
|
+
/** Pass `true` while any data fetch is in-flight; deprecated in favor of `isFetching` and `isRefetching`. */
|
|
708
|
+
isLoading?: boolean;
|
|
709
|
+
/** The rows currently visible when loading data */
|
|
710
|
+
loadingDisplayRow?: number;
|
|
711
|
+
/** The current page / slice of row data. */
|
|
712
|
+
data: TData[];
|
|
713
|
+
/** Typed column definitions; use `TUITableColumn<TData>` for full type safety. */
|
|
714
|
+
columns: TColumns;
|
|
715
|
+
/** Total number of rows in the remote dataset; required for accurate virtual-scroll height. */
|
|
716
|
+
totalRows?: number;
|
|
717
|
+
/**
|
|
718
|
+
* Async callback invoked by `UITableLoadMore` when the user scrolls to the
|
|
719
|
+
* bottom or clicks "Load More". Omit to hide the load-more row entirely.
|
|
720
|
+
*/
|
|
721
|
+
fetchMoreData?: () => void | Promise<void>;
|
|
722
|
+
/** Column accessor keys to pin on the left (the `select` column is always pinned left). */
|
|
723
|
+
leftPinnedColumns?: Array<TColumns[number]['accessorKey']>;
|
|
724
|
+
/** Column accessor keys (or plain string ids) to pin on the right. */
|
|
725
|
+
rightPinnedColumns?: Array<TColumns[number]['accessorKey']> | string[];
|
|
726
|
+
/** Data key whose value is extracted and passed as the second argument of `onClickRow`. */
|
|
727
|
+
keyOfClickRow?: TTableRowContext<TData, TKey>['keyOfClickRow'];
|
|
728
|
+
/** Called with the virtual row index and the value of `keyOfClickRow` when a row is clicked. */
|
|
729
|
+
onClickRow?: TTableRowContext<TData, TKey>['onClickRow'];
|
|
730
|
+
/** Called with the updated row-selection map after each selection change. */
|
|
731
|
+
onRowSelection?: (rowSelection: RowSelectionState) => void;
|
|
732
|
+
/** Called with the updated column-pinning state after each pin/unpin action. */
|
|
733
|
+
onColumnPinning?: (columnPinning: ColumnPinningState) => void;
|
|
734
|
+
/** CSS height of the `UITableEmptyDisplay` overlay. Defaults to `384px` when omitted. */
|
|
735
|
+
emptyDisplayHeight?: React.CSSProperties['height'];
|
|
736
|
+
/** CSV export rows; each row is an ordered array of `{ label, value }` cells. */
|
|
737
|
+
csvData?: CsvCell[][];
|
|
738
|
+
/** File name (without `.csv`) for the downloaded file. Defaults to the table title. */
|
|
739
|
+
csvFileName?: string;
|
|
740
|
+
/** Definitions of all filterable fields shown in the "Add Filter" dropdown. */
|
|
741
|
+
filterDefinitions?: FilterDefinition[];
|
|
742
|
+
/** Called with the full list of active filters whenever filters are added, removed, or updated. */
|
|
743
|
+
onFilterChange?: (filters: ActiveFilter[]) => void;
|
|
744
|
+
};
|
|
745
|
+
type FilterType = 'tag' | 'date-range' | 'number' | 'text' | 'boolean';
|
|
746
|
+
/** A selectable option for tag/enum filters. */
|
|
747
|
+
type FilterOption = {
|
|
748
|
+
label: string;
|
|
749
|
+
value: string;
|
|
750
|
+
};
|
|
751
|
+
/**
|
|
752
|
+
* Declares a filterable field available in the "Add Filter" dropdown.
|
|
753
|
+
* `options` is required when `type === 'tag'`.
|
|
754
|
+
*/
|
|
755
|
+
type FilterDefinition = {
|
|
756
|
+
id: string;
|
|
757
|
+
label: string;
|
|
758
|
+
type: FilterType;
|
|
759
|
+
options?: FilterOption[];
|
|
760
|
+
};
|
|
761
|
+
type TagFilterValue = {
|
|
762
|
+
type: 'tag';
|
|
763
|
+
values: string[];
|
|
764
|
+
};
|
|
765
|
+
type DateRangeFilterValue = {
|
|
766
|
+
type: 'date-range';
|
|
767
|
+
/** ISO date string, e.g. `"2024-01-01"`. */
|
|
768
|
+
from?: string;
|
|
769
|
+
to?: string;
|
|
770
|
+
};
|
|
771
|
+
type NumberFilterValue = {
|
|
772
|
+
type: 'number';
|
|
773
|
+
operator: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte' | 'between';
|
|
774
|
+
value?: number;
|
|
775
|
+
valueTo?: number;
|
|
776
|
+
};
|
|
777
|
+
type TextFilterValue = {
|
|
778
|
+
type: 'text';
|
|
779
|
+
operator: 'contains' | 'equals' | 'starts-with' | 'ends-with';
|
|
780
|
+
value: string;
|
|
781
|
+
};
|
|
782
|
+
type BooleanFilterValue = {
|
|
783
|
+
type: 'boolean';
|
|
784
|
+
value: boolean | null;
|
|
785
|
+
};
|
|
786
|
+
type FilterValue = TagFilterValue | DateRangeFilterValue | NumberFilterValue | TextFilterValue | BooleanFilterValue;
|
|
787
|
+
/** An active (added) filter instance with its current value. */
|
|
788
|
+
type ActiveFilter = {
|
|
789
|
+
/** Unique instance id for this filter entry. */
|
|
790
|
+
id: string;
|
|
791
|
+
/** References a `FilterDefinition.id`. */
|
|
792
|
+
definitionId: string;
|
|
793
|
+
value: FilterValue;
|
|
794
|
+
};
|
|
795
|
+
/** Context value exposed by `UITableProvider` for the filter panel. */
|
|
796
|
+
type TTableFilterContext = {
|
|
797
|
+
filterDefinitions: FilterDefinition[];
|
|
798
|
+
activeFilters: ActiveFilter[];
|
|
799
|
+
addFilter: (definitionId: string) => void;
|
|
800
|
+
removeFilter: (filterId: string) => void;
|
|
801
|
+
updateFilter: (filterId: string, value: FilterValue) => void;
|
|
802
|
+
};
|
|
803
|
+
//#endregion
|
|
804
|
+
//#region packages/components/features/tables/components/commons/body.d.ts
|
|
805
|
+
declare const UITableBody: react257.NamedExoticComponent<TUITableBody>;
|
|
806
|
+
//#endregion
|
|
807
|
+
//#region packages/components/features/tables/components/commons/cell.d.ts
|
|
808
|
+
declare const UITableCell: react257.NamedExoticComponent<TUITableCell>;
|
|
809
|
+
//#endregion
|
|
810
|
+
//#region packages/components/features/tables/components/commons/cell-actions.d.ts
|
|
811
|
+
declare const UITableCellActions: react257.NamedExoticComponent<TUITableCellActions>;
|
|
812
|
+
//#endregion
|
|
813
|
+
//#region packages/components/features/tables/components/commons/cell-select.d.ts
|
|
814
|
+
declare const UITableCellSelect: react257.NamedExoticComponent<TUITableCellSelect>;
|
|
815
|
+
//#endregion
|
|
816
|
+
//#region packages/components/features/tables/components/commons/empty-display.d.ts
|
|
817
|
+
declare const UITableEmptyDisplay: react257.NamedExoticComponent<TUITableEmptyDisplay>;
|
|
818
|
+
//#endregion
|
|
819
|
+
//#region packages/components/features/tables/components/commons/footer.d.ts
|
|
820
|
+
declare const UITableFooter: react257.NamedExoticComponent<TUITableFooter>;
|
|
821
|
+
//#endregion
|
|
822
|
+
//#region packages/components/features/tables/components/commons/head.d.ts
|
|
823
|
+
declare const UITableHead: react257.NamedExoticComponent<TUITableHead>;
|
|
824
|
+
//#endregion
|
|
825
|
+
//#region packages/components/features/tables/components/commons/head-cell.d.ts
|
|
826
|
+
declare const UITableHeadCell: react257.NamedExoticComponent<TUITableHeadCell>;
|
|
827
|
+
//#endregion
|
|
828
|
+
//#region packages/components/features/tables/components/commons/head-cell-option.d.ts
|
|
829
|
+
declare const UITableHeadCellOption: react257.NamedExoticComponent<TUITableHeadCellOption>;
|
|
830
|
+
//#endregion
|
|
831
|
+
//#region packages/components/features/tables/components/commons/head-cell-select.d.ts
|
|
832
|
+
declare const UITableHeadCellSelect: react257.NamedExoticComponent<TUITableHeadCellSelect>;
|
|
833
|
+
//#endregion
|
|
834
|
+
//#region packages/components/features/tables/components/commons/head-row.d.ts
|
|
835
|
+
declare const UITableHeadRow: react257.NamedExoticComponent<TUITableHeadRow>;
|
|
836
|
+
//#endregion
|
|
837
|
+
//#region packages/components/features/tables/components/commons/inner-table.d.ts
|
|
838
|
+
declare const UITableInnerTable: react257.NamedExoticComponent<TUITableInnerTable>;
|
|
839
|
+
//#endregion
|
|
840
|
+
//#region packages/components/features/tables/components/commons/inner-wrapper.d.ts
|
|
841
|
+
declare const UITableInnerWrapper: react257.NamedExoticComponent<TUITableInnerWrapper>;
|
|
842
|
+
//#endregion
|
|
843
|
+
//#region packages/components/features/tables/components/commons/load-more.d.ts
|
|
844
|
+
declare const UITableLoadMore: react257.NamedExoticComponent<TUITableLoadMore>;
|
|
845
|
+
//#endregion
|
|
846
|
+
//#region packages/components/features/tables/components/commons/row.d.ts
|
|
847
|
+
declare const UITableRow: react257.NamedExoticComponent<TUITableRow>;
|
|
848
|
+
//#endregion
|
|
849
|
+
//#region packages/components/features/tables/components/commons/wrapper.d.ts
|
|
850
|
+
declare const UITableWrapper: react257.NamedExoticComponent<TUITableWrapper>;
|
|
851
|
+
//#endregion
|
|
852
|
+
//#region packages/components/features/tables/components/table.d.ts
|
|
853
|
+
declare const UITableContainer: React.FC<React.PropsWithChildren>;
|
|
854
|
+
//#endregion
|
|
855
|
+
//#region packages/components/features/tables/components/table/filter.d.ts
|
|
856
|
+
/**
|
|
857
|
+
* Collapsible side-panel that lets users toggle column visibility and build
|
|
858
|
+
* row filters without leaving the table view.
|
|
859
|
+
*
|
|
860
|
+
* The panel collapses to a narrow icon strip when no tab is active and expands
|
|
861
|
+
* to at least 64 units when the "Columns" or "Filters" tab is selected.
|
|
862
|
+
*
|
|
863
|
+
* Wire filter capability by passing `filterDefinitions` and `onFilterChange` to
|
|
864
|
+
* the parent `UITableProvider`.
|
|
865
|
+
*
|
|
866
|
+
* @example
|
|
867
|
+
* ```tsx
|
|
868
|
+
* <UITableProvider
|
|
869
|
+
* filterDefinitions={[
|
|
870
|
+
* { id: 'status', label: 'Status', type: 'tag', options: [{ label: 'Active', value: 'active' }] },
|
|
871
|
+
* { id: 'created', label: 'Created At', type: 'date-range' },
|
|
872
|
+
* { id: 'amount', label: 'Amount', type: 'number' },
|
|
873
|
+
* ]}
|
|
874
|
+
* onFilterChange={filters => console.log(filters)}
|
|
875
|
+
* >
|
|
876
|
+
* <ResizablePanelGroup direction="horizontal">
|
|
877
|
+
* <ResizablePanel><UITable /></ResizablePanel>
|
|
878
|
+
* <ResizableHandle />
|
|
879
|
+
* <UITableFilter />
|
|
880
|
+
* </ResizablePanelGroup>
|
|
881
|
+
* </UITableProvider>
|
|
882
|
+
* ```
|
|
883
|
+
*/
|
|
884
|
+
declare const UITableFilter: () => react_jsx_runtime332.JSX.Element;
|
|
885
|
+
//#endregion
|
|
886
|
+
//#region packages/components/features/tables/components/table/provider.d.ts
|
|
887
|
+
/**
|
|
888
|
+
* Root context provider for the UITable component family.
|
|
889
|
+
*
|
|
890
|
+
* Instantiates a TanStack Table instance with virtualisation-friendly settings
|
|
891
|
+
* (column pinning, row selection, row grouping, row expansion) and propagates
|
|
892
|
+
* all derived state through a nested set of memoised context providers so that
|
|
893
|
+
* each layer only re-renders when its own slice of state changes.
|
|
894
|
+
*
|
|
895
|
+
* @example
|
|
896
|
+
* ```tsx
|
|
897
|
+
* import { UITableProvider } from '@customafk/lunas-ui/features/tables';
|
|
898
|
+
*
|
|
899
|
+
* const columns = [
|
|
900
|
+
* { accessorKey: 'name', header: 'Name' },
|
|
901
|
+
* { accessorKey: 'email', header: 'Email' },
|
|
902
|
+
* ];
|
|
903
|
+
*
|
|
904
|
+
* function MyPage() {
|
|
905
|
+
* return (
|
|
906
|
+
* <UITableProvider
|
|
907
|
+
* title="Users"
|
|
908
|
+
* data={users}
|
|
909
|
+
* columns={columns}
|
|
910
|
+
* isFetching={isLoading}
|
|
911
|
+
* onClickRow={(index, id) => console.log(index, id)}
|
|
912
|
+
* >
|
|
913
|
+
* <UITable />
|
|
914
|
+
* </UITableProvider>
|
|
915
|
+
* );
|
|
916
|
+
* }
|
|
917
|
+
* ```
|
|
918
|
+
*/
|
|
919
|
+
declare const UITableProvider: <TData extends RowData<TData> = RowData<AnyEntity>, TKey extends keyof TData = keyof TData, TColumns extends ReadonlyArray<TUITableColumn<TData>> = TUITableColumn<TData>[]>({
|
|
920
|
+
title,
|
|
921
|
+
isFetching,
|
|
922
|
+
isRefetching,
|
|
923
|
+
isLoading,
|
|
924
|
+
loadingDisplayRow,
|
|
925
|
+
data,
|
|
926
|
+
columns,
|
|
927
|
+
totalRows,
|
|
928
|
+
leftPinnedColumns,
|
|
929
|
+
rightPinnedColumns,
|
|
930
|
+
keyOfClickRow,
|
|
931
|
+
onClickRow,
|
|
932
|
+
onRowSelection,
|
|
933
|
+
onColumnPinning,
|
|
934
|
+
fetchMoreData,
|
|
935
|
+
emptyDisplayHeight,
|
|
936
|
+
csvData,
|
|
937
|
+
csvFileName,
|
|
938
|
+
filterDefinitions,
|
|
939
|
+
onFilterChange,
|
|
940
|
+
children
|
|
941
|
+
}: React.PropsWithChildren<TableProviderProps<TData, TKey, TColumns>>) => react_jsx_runtime332.JSX.Element;
|
|
942
|
+
//#endregion
|
|
943
|
+
//#region packages/components/features/tables/components/table/tooltip.d.ts
|
|
944
|
+
/**
|
|
945
|
+
* Debounced search input rendered inside the table toolbar.
|
|
946
|
+
*
|
|
947
|
+
* Fires `onSearch` 500 ms after the user stops typing and delegates all other
|
|
948
|
+
* native input events via the spread `props`.
|
|
949
|
+
*
|
|
950
|
+
* @example
|
|
951
|
+
* ```tsx
|
|
952
|
+
* import { UITableTooltipFilter } from '@customafk/lunas-ui/features/tables';
|
|
953
|
+
*
|
|
954
|
+
* <UITableTooltipFilter
|
|
955
|
+
* placeholder="Search users…"
|
|
956
|
+
* onSearch={value => setQuery(value)}
|
|
957
|
+
* />
|
|
958
|
+
* ```
|
|
959
|
+
*/
|
|
960
|
+
declare const UITableTooltipFilter: React.FC<Omit<React.ComponentProps<typeof Input>, 'className'> & {
|
|
961
|
+
onSearch?: (value: string) => void;
|
|
962
|
+
}>;
|
|
963
|
+
/**
|
|
964
|
+
* Grouped action buttons (create, refresh, download) displayed in the table
|
|
965
|
+
* toolbar.
|
|
966
|
+
*
|
|
967
|
+
* Each button is disabled automatically when the corresponding handler prop is
|
|
968
|
+
* omitted, so only the actions relevant to a given table need to be provided.
|
|
969
|
+
*
|
|
970
|
+
* @example
|
|
971
|
+
* ```tsx
|
|
972
|
+
* import { UITableTooltipActions } from '@customafk/lunas-ui/features/tables';
|
|
973
|
+
*
|
|
974
|
+
* <UITableTooltipActions
|
|
975
|
+
* onCreate={() => setOpenCreate(true)}
|
|
976
|
+
* onRefresh={() => refetch()}
|
|
977
|
+
* />
|
|
978
|
+
* ```
|
|
979
|
+
*/
|
|
980
|
+
declare const UITableTooltipActions: React.FC<{
|
|
981
|
+
onCreate?: () => void;
|
|
982
|
+
onRefresh?: () => void;
|
|
983
|
+
onDownload?: () => void;
|
|
984
|
+
}>;
|
|
985
|
+
/**
|
|
986
|
+
* Outer toolbar shell for the UITable component.
|
|
987
|
+
*
|
|
988
|
+
* Reads the table `title` from `UITableContext` and renders it as a heading
|
|
989
|
+
* above the `children` slot, which typically contains a
|
|
990
|
+
* `UITableTooltipFilter` and/or `UITableTooltipActions`.
|
|
991
|
+
*
|
|
992
|
+
* @example
|
|
993
|
+
* ```tsx
|
|
994
|
+
* import {
|
|
995
|
+
* UITableTooltip,
|
|
996
|
+
* UITableTooltipFilter,
|
|
997
|
+
* UITableTooltipActions,
|
|
998
|
+
* } from '@customafk/lunas-ui/features/tables';
|
|
999
|
+
*
|
|
1000
|
+
* <UITableTooltip>
|
|
1001
|
+
* <UITableTooltipFilter onSearch={setQuery} />
|
|
1002
|
+
* <UITableTooltipActions onCreate={handleCreate} onRefresh={refetch} />
|
|
1003
|
+
* </UITableTooltip>
|
|
1004
|
+
* ```
|
|
1005
|
+
*/
|
|
1006
|
+
declare const UITableTooltip: React.FC<React.PropsWithChildren>;
|
|
1007
|
+
//#endregion
|
|
1008
|
+
export { TUITableInnerTable as $, FilterValue as A, TTableVirtualizerContext as B, ActiveFilter as C, FilterDefinition as D, DateRangeFilterValue as E, TTableFilterContext as F, TUITableColumn as G, TUITableCell as H, TTableHeadRowContext as I, TUITableHead as J, TUITableEmptyDisplay as K, TTableInnerTableContext as L, RowData as M, TTableBodyContext as N, FilterOption as O, TTableContext as P, TUITableHeadRow as Q, TTableInnerWrapperContext as R, UITableBody as S, UITableBadgeDisplay as St, CsvCell as T, TUITableCellActions as U, TUITableBody as V, TUITableCellSelect as W, TUITableHeadCellOption as X, TUITableHeadCell as Y, TUITableHeadCellSelect as Z, UITableFooter as _, UITableEmailDisplay as _t, UITableFilter as a, TagFilterValue as at, UITableCellActions as b, UITableCurrencyDisplay as bt, UITableRow as c, UITableStatusDisplay as ct, UITableInnerTable as d, UITableProgressDisplay as dt, TUITableInnerWrapper as et, UITableHeadRow as f, UITablePhoneNumberDisplay as ft, UITableHead as g, UITableListDisplay as gt, UITableHeadCell as h, UITableMoreButton as ht, UITableProvider as i, TableProviderProps as it, NumberFilterValue as j, FilterType as k, UITableLoadMore as l, UITableStatisticDisplay as lt, UITableHeadCellOption as m, UITableNameDisplay as mt, UITableTooltipActions as n, TUITableRow as nt, UITableContainer as o, TextFilterValue as ot, UITableHeadCellSelect as p, UITablePermalink as pt, TUITableFooter as q, UITableTooltipFilter as r, TUITableWrapper as rt, UITableWrapper as s, UITableUserDataDisplay as st, UITableTooltip as t, TUITableLoadMore as tt, UITableInnerWrapper as u, UITableRemoveButton as ut, UITableEmptyDisplay as v, UITableDescriptionDisplay as vt, BooleanFilterValue as w, UITableCell as x, UITableBooleanDisplay as xt, UITableCellSelect as y, UITableDateDisplay as yt, TTableRowContext as z };
|
|
1009
|
+
//# sourceMappingURL=index-B5wgYino.d.cts.map
|