@kjun-ui/react 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +3279 -1407
- package/dist/index.js +3226 -1353
- package/dist/styles.css +993 -191
- package/dist/types/packages/react/src/actions.d.cts +12 -3
- package/dist/types/packages/react/src/actions.d.ts +12 -3
- package/dist/types/packages/react/src/app-navigation.d.cts +22 -3
- package/dist/types/packages/react/src/app-navigation.d.ts +22 -3
- package/dist/types/packages/react/src/calendar.d.cts +30 -0
- package/dist/types/packages/react/src/calendar.d.ts +30 -0
- package/dist/types/packages/react/src/carousel.d.cts +39 -0
- package/dist/types/packages/react/src/carousel.d.ts +39 -0
- package/dist/types/packages/react/src/controls.d.cts +16 -11
- package/dist/types/packages/react/src/controls.d.ts +16 -11
- package/dist/types/packages/react/src/date-picker.d.cts +34 -6
- package/dist/types/packages/react/src/date-picker.d.ts +34 -6
- package/dist/types/packages/react/src/display.d.cts +7 -1
- package/dist/types/packages/react/src/display.d.ts +7 -1
- package/dist/types/packages/react/src/dropdown.d.cts +35 -3
- package/dist/types/packages/react/src/dropdown.d.ts +35 -3
- package/dist/types/packages/react/src/financial-display.d.cts +10 -1
- package/dist/types/packages/react/src/financial-display.d.ts +10 -1
- package/dist/types/packages/react/src/financial.d.cts +2 -2
- package/dist/types/packages/react/src/financial.d.ts +2 -2
- package/dist/types/packages/react/src/index.d.cts +8 -6
- package/dist/types/packages/react/src/index.d.ts +8 -6
- package/dist/types/packages/react/src/layers.d.cts +1 -1
- package/dist/types/packages/react/src/layers.d.ts +1 -1
- package/dist/types/packages/react/src/list.d.cts +27 -4
- package/dist/types/packages/react/src/list.d.ts +27 -4
- package/dist/types/packages/react/src/market-model.d.cts +8 -1
- package/dist/types/packages/react/src/market-model.d.ts +8 -1
- package/dist/types/packages/react/src/navigation.d.cts +24 -42
- package/dist/types/packages/react/src/navigation.d.ts +24 -42
- package/dist/types/packages/react/src/number-display.d.cts +12 -12
- package/dist/types/packages/react/src/number-display.d.ts +12 -12
- package/dist/types/packages/react/src/popover.d.cts +9 -4
- package/dist/types/packages/react/src/popover.d.ts +9 -4
- package/dist/types/packages/react/src/select-control.d.cts +3 -1
- package/dist/types/packages/react/src/select-control.d.ts +3 -1
- package/dist/types/packages/react/src/select.d.cts +2 -2
- package/dist/types/packages/react/src/select.d.ts +2 -2
- package/dist/types/packages/react/src/table-cards.d.cts +1 -1
- package/dist/types/packages/react/src/table-cards.d.ts +1 -1
- package/dist/types/packages/react/src/table-grid.d.cts +1 -1
- package/dist/types/packages/react/src/table-grid.d.ts +1 -1
- package/dist/types/packages/react/src/table-list.d.cts +14 -0
- package/dist/types/packages/react/src/table-list.d.ts +14 -0
- package/dist/types/packages/react/src/table-model.d.cts +1 -0
- package/dist/types/packages/react/src/table-model.d.ts +1 -0
- package/dist/types/packages/react/src/table-toolbar.d.cts +1 -1
- package/dist/types/packages/react/src/table-toolbar.d.ts +1 -1
- package/dist/types/packages/react/src/tabs.d.cts +38 -0
- package/dist/types/packages/react/src/tabs.d.ts +38 -0
- package/dist/types/packages/react/src/textarea.d.cts +29 -0
- package/dist/types/packages/react/src/textarea.d.ts +29 -0
- package/dist/types/packages/react/src/time-picker.d.cts +10 -1
- package/dist/types/packages/react/src/time-picker.d.ts +10 -1
- package/dist/types/shared/package-runtime/accordion-state.d.cts +11 -0
- package/dist/types/shared/package-runtime/accordion-state.d.ts +11 -0
- package/dist/types/shared/package-runtime/action-size.d.cts +1 -1
- package/dist/types/shared/package-runtime/action-size.d.ts +1 -1
- package/dist/types/shared/package-runtime/alert-action-size.d.cts +2 -0
- package/dist/types/shared/package-runtime/alert-action-size.d.ts +2 -0
- package/dist/types/shared/package-runtime/badge-tone.d.cts +59 -0
- package/dist/types/shared/package-runtime/badge-tone.d.ts +59 -0
- package/dist/types/shared/package-runtime/breadcrumb.d.cts +20 -0
- package/dist/types/shared/package-runtime/breadcrumb.d.ts +20 -0
- package/dist/types/shared/package-runtime/calendar.d.cts +106 -0
- package/dist/types/shared/package-runtime/calendar.d.ts +106 -0
- package/dist/types/shared/package-runtime/carousel-scroll.d.cts +22 -0
- package/dist/types/shared/package-runtime/carousel-scroll.d.ts +22 -0
- package/dist/types/shared/package-runtime/carousel.d.cts +47 -0
- package/dist/types/shared/package-runtime/carousel.d.ts +47 -0
- package/dist/types/shared/package-runtime/center-option.d.cts +1 -0
- package/dist/types/shared/package-runtime/center-option.d.ts +1 -0
- package/dist/types/shared/package-runtime/list-row.d.cts +14 -0
- package/dist/types/shared/package-runtime/list-row.d.ts +14 -0
- package/dist/types/shared/package-runtime/messages/ko.d.cts +38 -5
- package/dist/types/shared/package-runtime/messages/ko.d.ts +38 -5
- package/dist/types/shared/package-runtime/messages-context.d.cts +38 -5
- package/dist/types/shared/package-runtime/messages-context.d.ts +38 -5
- package/dist/types/shared/package-runtime/navigation-badge.d.cts +12 -0
- package/dist/types/shared/package-runtime/navigation-badge.d.ts +12 -0
- package/dist/types/shared/package-runtime/navigation.d.cts +1 -1
- package/dist/types/shared/package-runtime/navigation.d.ts +1 -1
- package/dist/types/shared/package-runtime/scroll-fade.d.cts +25 -0
- package/dist/types/shared/package-runtime/scroll-fade.d.ts +25 -0
- package/dist/types/shared/package-runtime/sparkline.d.cts +58 -0
- package/dist/types/shared/package-runtime/sparkline.d.ts +58 -0
- package/dist/types/shared/package-runtime/table-groups.d.cts +11 -0
- package/dist/types/shared/package-runtime/table-groups.d.ts +11 -0
- package/dist/types/shared/package-runtime/table-model.d.cts +25 -2
- package/dist/types/shared/package-runtime/table-model.d.ts +25 -2
- package/dist/types/shared/package-runtime/table-presentation.d.cts +30 -4
- package/dist/types/shared/package-runtime/table-presentation.d.ts +30 -4
- package/dist/types/shared/package-runtime/table.d.cts +18 -2
- package/dist/types/shared/package-runtime/table.d.ts +18 -2
- package/dist/types/shared/package-runtime/textarea-grow.d.cts +1 -0
- package/dist/types/shared/package-runtime/textarea-grow.d.ts +1 -0
- package/dist/types/shared/package-runtime/textarea.d.cts +53 -0
- package/dist/types/shared/package-runtime/textarea.d.ts +53 -0
- package/dist/types/shared/package-runtime/time-segments.d.cts +25 -0
- package/dist/types/shared/package-runtime/time-segments.d.ts +25 -0
- package/package.json +3 -3
- package/dist/types/shared/package-runtime/relative-time.d.cts +0 -1
- package/dist/types/shared/package-runtime/relative-time.d.ts +0 -1
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import type { TableColumn, TableCardSection, TableProps, useTableModel } from "./table.cjs";
|
|
3
|
+
import { type TableRowGroup } from "./table-groups.cjs";
|
|
3
4
|
export declare function tablePresentation<Row extends object>(props: TableProps<Row, unknown>, mobile: boolean): {
|
|
4
5
|
card: boolean;
|
|
6
|
+
list: boolean;
|
|
7
|
+
listValue: TableColumn<Row> | undefined;
|
|
8
|
+
listMeta: TableColumn<Row> | undefined;
|
|
5
9
|
visible: TableColumn<Row>[];
|
|
6
10
|
title: TableColumn<Row> | undefined;
|
|
7
11
|
subtitle: TableColumn<Row> | undefined;
|
|
@@ -15,34 +19,54 @@ export declare function columnFormat<Format>(column: {
|
|
|
15
19
|
key: string;
|
|
16
20
|
format?: Format;
|
|
17
21
|
}): Format | undefined;
|
|
18
|
-
|
|
22
|
+
/** locale is the KjunProvider locale, so numbers group the way the app's language does. */
|
|
23
|
+
export declare function tableCellValue<Row extends object>(props: TableProps<Row, unknown>, column: TableColumn<Row>, row: Row, index: number, locale?: string): {
|
|
19
24
|
value: unknown;
|
|
20
25
|
body: ReactNode;
|
|
21
26
|
};
|
|
27
|
+
/** A summary cell: the app's function, or the kind computed and shown through the column's format. */
|
|
28
|
+
export declare function tableSummaryValue<Row extends object>(props: TableProps<Row, unknown>, column: TableColumn<Row>, rows: Row[], locale?: string): ReactNode;
|
|
29
|
+
/** Narrow layouts keep the summary as one closing block: each summarized column's label and total. */
|
|
30
|
+
export interface TableTotal {
|
|
31
|
+
key: string;
|
|
32
|
+
label: string;
|
|
33
|
+
value: ReactNode;
|
|
34
|
+
}
|
|
35
|
+
export declare function tableTotals<Row extends object>(props: TableProps<Row, unknown>, rows: Row[], locale?: string): TableTotal[];
|
|
36
|
+
export interface TableGroupingProps<Row extends object> {
|
|
37
|
+
groups: TableRowGroup<Row>[] | null;
|
|
38
|
+
collapsed: string[];
|
|
39
|
+
toggleGroup: (key: string) => void;
|
|
40
|
+
groupLabel: (group: TableRowGroup<Row>) => ReactNode;
|
|
41
|
+
summary: ((column: TableColumn<Row>, rows: Row[]) => ReactNode) | null;
|
|
42
|
+
}
|
|
43
|
+
export type TableCellRole = "title" | "listTitle" | "listMeta" | "listValue";
|
|
22
44
|
export interface TableRowsProps<Row extends object> {
|
|
23
45
|
initialLoading: boolean;
|
|
24
46
|
skeletonRows: number;
|
|
25
47
|
/** A loadingDelay is still running: the skeleton keeps its space but stays out of sight. */
|
|
26
48
|
skeletonHidden?: boolean;
|
|
27
|
-
state: Pick<ReturnType<typeof useTableModel<Row>>, "rows" | "key" | "expanded" | "selectedRow">;
|
|
49
|
+
state: Pick<ReturnType<typeof useTableModel<Row>>, "rows" | "rowIndex" | "key" | "expanded" | "selectedRow">;
|
|
28
50
|
onRowClick: TableProps<Row>["onRowClick"];
|
|
29
51
|
selectable: boolean;
|
|
30
52
|
expandable: boolean;
|
|
31
53
|
checkbox: (row: Row, index: number) => ReactNode;
|
|
32
54
|
expand: (row: Row, index: number) => ReactNode;
|
|
33
|
-
cell: (column: TableColumn<Row>, row: Row, index: number, role?:
|
|
55
|
+
cell: (column: TableColumn<Row>, row: Row, index: number, role?: TableCellRole) => ReactNode;
|
|
34
56
|
renderExpand: TableProps<Row>["renderExpand"];
|
|
35
57
|
emptyContent: ReactNode;
|
|
36
58
|
emptyText: string;
|
|
37
59
|
}
|
|
38
60
|
export interface TableCardsProps<Row extends object> extends TableRowsProps<Row> {
|
|
39
61
|
layout: ReturnType<typeof tablePresentation<Row>>;
|
|
62
|
+
totals?: TableTotal[];
|
|
40
63
|
}
|
|
41
|
-
export interface TableGridProps<Row extends object, Height> extends TableRowsProps<Row> {
|
|
64
|
+
export interface TableGridProps<Row extends object, Height> extends TableRowsProps<Row>, TableGroupingProps<Row> {
|
|
42
65
|
state: TableRowsProps<Row>["state"] & Pick<ReturnType<typeof useTableModel<Row>>, "all" | "some" | "toggleAll" | "sort" | "sortColumn">;
|
|
43
66
|
visible: TableColumn<Row>[];
|
|
44
67
|
maxHeight?: Height;
|
|
45
68
|
stickyHeader: boolean;
|
|
69
|
+
stickyOffset?: number;
|
|
46
70
|
sortable?: boolean;
|
|
47
71
|
compact: boolean;
|
|
48
72
|
striped: boolean;
|
|
@@ -51,6 +75,8 @@ export interface TableGridProps<Row extends object, Height> extends TableRowsPro
|
|
|
51
75
|
export interface TableToolbarProps<Row extends object> {
|
|
52
76
|
selectable: boolean;
|
|
53
77
|
selected: Row[];
|
|
78
|
+
/** Every visible row is selected: the bar drops its select-all action. */
|
|
79
|
+
allSelected: boolean;
|
|
54
80
|
toggleAll: () => void;
|
|
55
81
|
clearSelection: () => void;
|
|
56
82
|
renderSelectionToolbar: TableProps<Row>["renderSelectionToolbar"];
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import type { TableColumn, TableCardSection, TableProps, useTableModel } from "./table.js";
|
|
3
|
+
import { type TableRowGroup } from "./table-groups.js";
|
|
3
4
|
export declare function tablePresentation<Row extends object>(props: TableProps<Row, unknown>, mobile: boolean): {
|
|
4
5
|
card: boolean;
|
|
6
|
+
list: boolean;
|
|
7
|
+
listValue: TableColumn<Row> | undefined;
|
|
8
|
+
listMeta: TableColumn<Row> | undefined;
|
|
5
9
|
visible: TableColumn<Row>[];
|
|
6
10
|
title: TableColumn<Row> | undefined;
|
|
7
11
|
subtitle: TableColumn<Row> | undefined;
|
|
@@ -15,34 +19,54 @@ export declare function columnFormat<Format>(column: {
|
|
|
15
19
|
key: string;
|
|
16
20
|
format?: Format;
|
|
17
21
|
}): Format | undefined;
|
|
18
|
-
|
|
22
|
+
/** locale is the KjunProvider locale, so numbers group the way the app's language does. */
|
|
23
|
+
export declare function tableCellValue<Row extends object>(props: TableProps<Row, unknown>, column: TableColumn<Row>, row: Row, index: number, locale?: string): {
|
|
19
24
|
value: unknown;
|
|
20
25
|
body: ReactNode;
|
|
21
26
|
};
|
|
27
|
+
/** A summary cell: the app's function, or the kind computed and shown through the column's format. */
|
|
28
|
+
export declare function tableSummaryValue<Row extends object>(props: TableProps<Row, unknown>, column: TableColumn<Row>, rows: Row[], locale?: string): ReactNode;
|
|
29
|
+
/** Narrow layouts keep the summary as one closing block: each summarized column's label and total. */
|
|
30
|
+
export interface TableTotal {
|
|
31
|
+
key: string;
|
|
32
|
+
label: string;
|
|
33
|
+
value: ReactNode;
|
|
34
|
+
}
|
|
35
|
+
export declare function tableTotals<Row extends object>(props: TableProps<Row, unknown>, rows: Row[], locale?: string): TableTotal[];
|
|
36
|
+
export interface TableGroupingProps<Row extends object> {
|
|
37
|
+
groups: TableRowGroup<Row>[] | null;
|
|
38
|
+
collapsed: string[];
|
|
39
|
+
toggleGroup: (key: string) => void;
|
|
40
|
+
groupLabel: (group: TableRowGroup<Row>) => ReactNode;
|
|
41
|
+
summary: ((column: TableColumn<Row>, rows: Row[]) => ReactNode) | null;
|
|
42
|
+
}
|
|
43
|
+
export type TableCellRole = "title" | "listTitle" | "listMeta" | "listValue";
|
|
22
44
|
export interface TableRowsProps<Row extends object> {
|
|
23
45
|
initialLoading: boolean;
|
|
24
46
|
skeletonRows: number;
|
|
25
47
|
/** A loadingDelay is still running: the skeleton keeps its space but stays out of sight. */
|
|
26
48
|
skeletonHidden?: boolean;
|
|
27
|
-
state: Pick<ReturnType<typeof useTableModel<Row>>, "rows" | "key" | "expanded" | "selectedRow">;
|
|
49
|
+
state: Pick<ReturnType<typeof useTableModel<Row>>, "rows" | "rowIndex" | "key" | "expanded" | "selectedRow">;
|
|
28
50
|
onRowClick: TableProps<Row>["onRowClick"];
|
|
29
51
|
selectable: boolean;
|
|
30
52
|
expandable: boolean;
|
|
31
53
|
checkbox: (row: Row, index: number) => ReactNode;
|
|
32
54
|
expand: (row: Row, index: number) => ReactNode;
|
|
33
|
-
cell: (column: TableColumn<Row>, row: Row, index: number, role?:
|
|
55
|
+
cell: (column: TableColumn<Row>, row: Row, index: number, role?: TableCellRole) => ReactNode;
|
|
34
56
|
renderExpand: TableProps<Row>["renderExpand"];
|
|
35
57
|
emptyContent: ReactNode;
|
|
36
58
|
emptyText: string;
|
|
37
59
|
}
|
|
38
60
|
export interface TableCardsProps<Row extends object> extends TableRowsProps<Row> {
|
|
39
61
|
layout: ReturnType<typeof tablePresentation<Row>>;
|
|
62
|
+
totals?: TableTotal[];
|
|
40
63
|
}
|
|
41
|
-
export interface TableGridProps<Row extends object, Height> extends TableRowsProps<Row> {
|
|
64
|
+
export interface TableGridProps<Row extends object, Height> extends TableRowsProps<Row>, TableGroupingProps<Row> {
|
|
42
65
|
state: TableRowsProps<Row>["state"] & Pick<ReturnType<typeof useTableModel<Row>>, "all" | "some" | "toggleAll" | "sort" | "sortColumn">;
|
|
43
66
|
visible: TableColumn<Row>[];
|
|
44
67
|
maxHeight?: Height;
|
|
45
68
|
stickyHeader: boolean;
|
|
69
|
+
stickyOffset?: number;
|
|
46
70
|
sortable?: boolean;
|
|
47
71
|
compact: boolean;
|
|
48
72
|
striped: boolean;
|
|
@@ -51,6 +75,8 @@ export interface TableGridProps<Row extends object, Height> extends TableRowsPro
|
|
|
51
75
|
export interface TableToolbarProps<Row extends object> {
|
|
52
76
|
selectable: boolean;
|
|
53
77
|
selected: Row[];
|
|
78
|
+
/** Every visible row is selected: the bar drops its select-all action. */
|
|
79
|
+
allSelected: boolean;
|
|
54
80
|
toggleAll: () => void;
|
|
55
81
|
clearSelection: () => void;
|
|
56
82
|
renderSelectionToolbar: TableProps<Row>["renderSelectionToolbar"];
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { type TableSort, type QueryDisplayProps } from "@kjun-ui/tokens";
|
|
2
2
|
export type { TableSort } from "@kjun-ui/tokens";
|
|
3
3
|
import { type ReactNode } from "react";
|
|
4
|
+
import type { TableSummaryKind } from "./table-groups.cjs";
|
|
5
|
+
export type { TableSummaryKind } from "./table-groups.cjs";
|
|
6
|
+
import { type TableCompare } from "./table-model.cjs";
|
|
4
7
|
export { getValue } from "./table-model.cjs";
|
|
5
8
|
export interface TableColumn<Row extends object = Record<string, unknown>> {
|
|
6
9
|
key: string;
|
|
@@ -9,6 +12,8 @@ export interface TableColumn<Row extends object = Record<string, unknown>> {
|
|
|
9
12
|
width?: number | string;
|
|
10
13
|
align?: "left" | "center" | "right";
|
|
11
14
|
type?: "number" | "date" | "datetime" | "text";
|
|
15
|
+
/** The column's own sort order for two cell values (ascending); by default dates, numbers and text compare naturally. */
|
|
16
|
+
compare?: TableCompare;
|
|
12
17
|
format?: (value: unknown, row: Row) => ReactNode;
|
|
13
18
|
render?: (value: unknown, row: Row, index: number) => ReactNode;
|
|
14
19
|
pill?: boolean;
|
|
@@ -51,12 +56,14 @@ export interface TableProps<Row extends object = Record<string, unknown>, MaxHei
|
|
|
51
56
|
searchable?: boolean;
|
|
52
57
|
searchPlaceholder?: string;
|
|
53
58
|
stickyHeader?: boolean;
|
|
59
|
+
/** Without maxHeight a sticky header sticks under the page scroll; this is its distance from the viewport top (px). */
|
|
60
|
+
stickyOffset?: number;
|
|
54
61
|
maxHeight?: MaxHeight;
|
|
55
62
|
pagination?: TablePagination | null;
|
|
56
63
|
compact?: boolean;
|
|
57
64
|
striped?: boolean;
|
|
58
65
|
ariaLabel?: string;
|
|
59
|
-
responsive?: "card" | "compact" | "none" | null;
|
|
66
|
+
responsive?: "card" | "list" | "compact" | "none" | null;
|
|
60
67
|
mobileColumns?: string[];
|
|
61
68
|
cardTitle?: string | null;
|
|
62
69
|
cardSubtitle?: string | null;
|
|
@@ -67,6 +74,13 @@ export interface TableProps<Row extends object = Record<string, unknown>, MaxHei
|
|
|
67
74
|
rowClass?: string | ((row: Row, index: number) => string);
|
|
68
75
|
selectable?: boolean;
|
|
69
76
|
selected?: Row[];
|
|
77
|
+
/** Row field (dot path) whose values split the rows into collapsible groups. */
|
|
78
|
+
groupBy?: string;
|
|
79
|
+
renderGroupLabel?: (value: unknown, rows: Row[]) => ReactNode;
|
|
80
|
+
/** Per column key: a subtotal under each group and a total row at the end. */
|
|
81
|
+
summary?: Partial<Record<string, TableSummaryKind | ((rows: Row[], column: TableColumn<Row>) => ReactNode)>>;
|
|
82
|
+
/** Shows computed summaries, for columns whose cells are drawn by renderCell rather than a column format. */
|
|
83
|
+
summaryFormat?: (value: number | null, column: TableColumn<Row>, kind: TableSummaryKind) => ReactNode;
|
|
70
84
|
toolbar?: ReactNode;
|
|
71
85
|
emptyContent?: ReactNode;
|
|
72
86
|
renderCell?: (value: unknown, column: TableColumn<Row>, row: Row, index: number) => ReactNode;
|
|
@@ -84,8 +98,10 @@ export interface TableProps<Row extends object = Record<string, unknown>, MaxHei
|
|
|
84
98
|
onSearch?: (query: string) => void;
|
|
85
99
|
onRetry?: () => void;
|
|
86
100
|
}
|
|
87
|
-
|
|
101
|
+
/** locale is the KjunProvider locale for text order; the platform wrapper passes it. */
|
|
102
|
+
export declare function useTableModel<Row extends object>(props: TableProps<Row, unknown>, locale?: string): {
|
|
88
103
|
rows: Row[];
|
|
104
|
+
rowIndex: (row: Row) => number;
|
|
89
105
|
key: (row: Row, index?: number) => string | number;
|
|
90
106
|
sort: TableSort;
|
|
91
107
|
search: string;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { type TableSort, type QueryDisplayProps } from "@kjun-ui/tokens";
|
|
2
2
|
export type { TableSort } from "@kjun-ui/tokens";
|
|
3
3
|
import { type ReactNode } from "react";
|
|
4
|
+
import type { TableSummaryKind } from "./table-groups.js";
|
|
5
|
+
export type { TableSummaryKind } from "./table-groups.js";
|
|
6
|
+
import { type TableCompare } from "./table-model.js";
|
|
4
7
|
export { getValue } from "./table-model.js";
|
|
5
8
|
export interface TableColumn<Row extends object = Record<string, unknown>> {
|
|
6
9
|
key: string;
|
|
@@ -9,6 +12,8 @@ export interface TableColumn<Row extends object = Record<string, unknown>> {
|
|
|
9
12
|
width?: number | string;
|
|
10
13
|
align?: "left" | "center" | "right";
|
|
11
14
|
type?: "number" | "date" | "datetime" | "text";
|
|
15
|
+
/** The column's own sort order for two cell values (ascending); by default dates, numbers and text compare naturally. */
|
|
16
|
+
compare?: TableCompare;
|
|
12
17
|
format?: (value: unknown, row: Row) => ReactNode;
|
|
13
18
|
render?: (value: unknown, row: Row, index: number) => ReactNode;
|
|
14
19
|
pill?: boolean;
|
|
@@ -51,12 +56,14 @@ export interface TableProps<Row extends object = Record<string, unknown>, MaxHei
|
|
|
51
56
|
searchable?: boolean;
|
|
52
57
|
searchPlaceholder?: string;
|
|
53
58
|
stickyHeader?: boolean;
|
|
59
|
+
/** Without maxHeight a sticky header sticks under the page scroll; this is its distance from the viewport top (px). */
|
|
60
|
+
stickyOffset?: number;
|
|
54
61
|
maxHeight?: MaxHeight;
|
|
55
62
|
pagination?: TablePagination | null;
|
|
56
63
|
compact?: boolean;
|
|
57
64
|
striped?: boolean;
|
|
58
65
|
ariaLabel?: string;
|
|
59
|
-
responsive?: "card" | "compact" | "none" | null;
|
|
66
|
+
responsive?: "card" | "list" | "compact" | "none" | null;
|
|
60
67
|
mobileColumns?: string[];
|
|
61
68
|
cardTitle?: string | null;
|
|
62
69
|
cardSubtitle?: string | null;
|
|
@@ -67,6 +74,13 @@ export interface TableProps<Row extends object = Record<string, unknown>, MaxHei
|
|
|
67
74
|
rowClass?: string | ((row: Row, index: number) => string);
|
|
68
75
|
selectable?: boolean;
|
|
69
76
|
selected?: Row[];
|
|
77
|
+
/** Row field (dot path) whose values split the rows into collapsible groups. */
|
|
78
|
+
groupBy?: string;
|
|
79
|
+
renderGroupLabel?: (value: unknown, rows: Row[]) => ReactNode;
|
|
80
|
+
/** Per column key: a subtotal under each group and a total row at the end. */
|
|
81
|
+
summary?: Partial<Record<string, TableSummaryKind | ((rows: Row[], column: TableColumn<Row>) => ReactNode)>>;
|
|
82
|
+
/** Shows computed summaries, for columns whose cells are drawn by renderCell rather than a column format. */
|
|
83
|
+
summaryFormat?: (value: number | null, column: TableColumn<Row>, kind: TableSummaryKind) => ReactNode;
|
|
70
84
|
toolbar?: ReactNode;
|
|
71
85
|
emptyContent?: ReactNode;
|
|
72
86
|
renderCell?: (value: unknown, column: TableColumn<Row>, row: Row, index: number) => ReactNode;
|
|
@@ -84,8 +98,10 @@ export interface TableProps<Row extends object = Record<string, unknown>, MaxHei
|
|
|
84
98
|
onSearch?: (query: string) => void;
|
|
85
99
|
onRetry?: () => void;
|
|
86
100
|
}
|
|
87
|
-
|
|
101
|
+
/** locale is the KjunProvider locale for text order; the platform wrapper passes it. */
|
|
102
|
+
export declare function useTableModel<Row extends object>(props: TableProps<Row, unknown>, locale?: string): {
|
|
88
103
|
rows: Row[];
|
|
104
|
+
rowIndex: (row: Row) => number;
|
|
89
105
|
key: (row: Row, index?: number) => string | number;
|
|
90
106
|
sort: TableSort;
|
|
91
107
|
search: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function growTextarea(element: HTMLTextAreaElement | null, minimum: number, maximum: number): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function growTextarea(element: HTMLTextAreaElement | null, minimum: number, maximum: number): void;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type InputSize } from "@kjun-ui/tokens";
|
|
2
|
+
export declare const textareaMaxRows = 6;
|
|
3
|
+
/** Border-box height for a number of text rows at a field size. */
|
|
4
|
+
export declare function textareaRowsHeight(size: InputSize, rows: number, footer?: boolean): number;
|
|
5
|
+
/** The [minimum, maximum] border-box height; a maximum below the minimum keeps the field at `rows`. */
|
|
6
|
+
export declare function textareaBounds(size: InputSize, rows: number, maxRows: number, footer?: boolean): readonly [
|
|
7
|
+
number,
|
|
8
|
+
number
|
|
9
|
+
];
|
|
10
|
+
/** The counter text; it counts like the maxLength attribute (UTF-16 units), so it agrees with what typing allows. */
|
|
11
|
+
export declare function textareaCount(value: string, maxLength?: number): {
|
|
12
|
+
length: number;
|
|
13
|
+
text: string;
|
|
14
|
+
over: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type TextareaResize = "none" | "vertical" | "horizontal" | "both";
|
|
17
|
+
/** A field the user can drag taller keeps the height they chose, so it does not also grow with its text. */
|
|
18
|
+
export declare const textareaGrows: (minimum: number, maximum: number, resize?: TextareaResize) => boolean;
|
|
19
|
+
/** The text inset: with a footer the wrapper carries the border, so the text keeps the field's own inset. */
|
|
20
|
+
export declare function textareaPadding(size: InputSize, footer: boolean): {
|
|
21
|
+
top: 16 | 12 | 8;
|
|
22
|
+
x: 20 | 16 | 12;
|
|
23
|
+
bottom: 4;
|
|
24
|
+
} | {
|
|
25
|
+
top: 16 | 12 | 8;
|
|
26
|
+
x: number;
|
|
27
|
+
bottom: 16 | 12 | 8;
|
|
28
|
+
};
|
|
29
|
+
/** Whether the composer may send: some text within maxLength, an enabled and editable field, nothing already sending. */
|
|
30
|
+
export declare function textareaCanSubmit({ value, maxLength, disabled, readOnly, submitting }: {
|
|
31
|
+
value: string | null | undefined;
|
|
32
|
+
maxLength?: number;
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
readOnly?: boolean;
|
|
35
|
+
submitting?: boolean;
|
|
36
|
+
}): boolean;
|
|
37
|
+
/** "mod-enter" sends on Ctrl/⌘+Enter; "enter" sends on Enter and leaves Shift+Enter for a new line. */
|
|
38
|
+
export type TextareaSubmitKey = "mod-enter" | "enter";
|
|
39
|
+
/**
|
|
40
|
+
* Whether this key press sends. Korean and other IME input confirm a syllable with Enter, and Safari reports that
|
|
41
|
+
* Enter with isComposing false but keyCode 229, so both mean "still composing".
|
|
42
|
+
*/
|
|
43
|
+
export declare function textareaSubmitKey(event: {
|
|
44
|
+
key: string;
|
|
45
|
+
shiftKey?: boolean;
|
|
46
|
+
metaKey?: boolean;
|
|
47
|
+
ctrlKey?: boolean;
|
|
48
|
+
altKey?: boolean;
|
|
49
|
+
isComposing?: boolean;
|
|
50
|
+
keyCode?: number;
|
|
51
|
+
}, mode?: TextareaSubmitKey): boolean;
|
|
52
|
+
/** Characters left to announce near the limit (the last tenth, at least ten), or null while there is room. */
|
|
53
|
+
export declare function textareaRemaining(value: string, maxLength?: number): number | null;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type InputSize } from "@kjun-ui/tokens";
|
|
2
|
+
export declare const textareaMaxRows = 6;
|
|
3
|
+
/** Border-box height for a number of text rows at a field size. */
|
|
4
|
+
export declare function textareaRowsHeight(size: InputSize, rows: number, footer?: boolean): number;
|
|
5
|
+
/** The [minimum, maximum] border-box height; a maximum below the minimum keeps the field at `rows`. */
|
|
6
|
+
export declare function textareaBounds(size: InputSize, rows: number, maxRows: number, footer?: boolean): readonly [
|
|
7
|
+
number,
|
|
8
|
+
number
|
|
9
|
+
];
|
|
10
|
+
/** The counter text; it counts like the maxLength attribute (UTF-16 units), so it agrees with what typing allows. */
|
|
11
|
+
export declare function textareaCount(value: string, maxLength?: number): {
|
|
12
|
+
length: number;
|
|
13
|
+
text: string;
|
|
14
|
+
over: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type TextareaResize = "none" | "vertical" | "horizontal" | "both";
|
|
17
|
+
/** A field the user can drag taller keeps the height they chose, so it does not also grow with its text. */
|
|
18
|
+
export declare const textareaGrows: (minimum: number, maximum: number, resize?: TextareaResize) => boolean;
|
|
19
|
+
/** The text inset: with a footer the wrapper carries the border, so the text keeps the field's own inset. */
|
|
20
|
+
export declare function textareaPadding(size: InputSize, footer: boolean): {
|
|
21
|
+
top: 16 | 12 | 8;
|
|
22
|
+
x: 20 | 16 | 12;
|
|
23
|
+
bottom: 4;
|
|
24
|
+
} | {
|
|
25
|
+
top: 16 | 12 | 8;
|
|
26
|
+
x: number;
|
|
27
|
+
bottom: 16 | 12 | 8;
|
|
28
|
+
};
|
|
29
|
+
/** Whether the composer may send: some text within maxLength, an enabled and editable field, nothing already sending. */
|
|
30
|
+
export declare function textareaCanSubmit({ value, maxLength, disabled, readOnly, submitting }: {
|
|
31
|
+
value: string | null | undefined;
|
|
32
|
+
maxLength?: number;
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
readOnly?: boolean;
|
|
35
|
+
submitting?: boolean;
|
|
36
|
+
}): boolean;
|
|
37
|
+
/** "mod-enter" sends on Ctrl/⌘+Enter; "enter" sends on Enter and leaves Shift+Enter for a new line. */
|
|
38
|
+
export type TextareaSubmitKey = "mod-enter" | "enter";
|
|
39
|
+
/**
|
|
40
|
+
* Whether this key press sends. Korean and other IME input confirm a syllable with Enter, and Safari reports that
|
|
41
|
+
* Enter with isComposing false but keyCode 229, so both mean "still composing".
|
|
42
|
+
*/
|
|
43
|
+
export declare function textareaSubmitKey(event: {
|
|
44
|
+
key: string;
|
|
45
|
+
shiftKey?: boolean;
|
|
46
|
+
metaKey?: boolean;
|
|
47
|
+
ctrlKey?: boolean;
|
|
48
|
+
altKey?: boolean;
|
|
49
|
+
isComposing?: boolean;
|
|
50
|
+
keyCode?: number;
|
|
51
|
+
}, mode?: TextareaSubmitKey): boolean;
|
|
52
|
+
/** Characters left to announce near the limit (the last tenth, at least ten), or null while there is room. */
|
|
53
|
+
export declare function textareaRemaining(value: string, maxLength?: number): number | null;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { createTimeDomain, TimePrecision } from "@kjun-ui/tokens";
|
|
2
|
+
import type { KjunMessages } from "./messages/ko.cjs";
|
|
3
|
+
type TimeDomain = ReturnType<typeof createTimeDomain>;
|
|
4
|
+
export type HourCycle = 12 | 24;
|
|
5
|
+
export type TimeSegmentOption = {
|
|
6
|
+
value: number;
|
|
7
|
+
label: string;
|
|
8
|
+
};
|
|
9
|
+
export interface TimeSegmentModel {
|
|
10
|
+
key: "period" | "hour" | "minute" | "second";
|
|
11
|
+
label: string;
|
|
12
|
+
value: number | null;
|
|
13
|
+
options: TimeSegmentOption[];
|
|
14
|
+
/** The time after choosing this option; the same value when nothing in the domain matches. */
|
|
15
|
+
pick: (option: number) => string | null;
|
|
16
|
+
}
|
|
17
|
+
export declare function timeSegments(domain: TimeDomain, value: string | null, { precision, hourCycle, messages, periodFirst }: {
|
|
18
|
+
precision: TimePrecision;
|
|
19
|
+
hourCycle?: HourCycle;
|
|
20
|
+
messages: KjunMessages;
|
|
21
|
+
periodFirst?: boolean;
|
|
22
|
+
}): TimeSegmentModel[];
|
|
23
|
+
/** Korean and other East Asian clocks put 오전/오후 before the hour; most others put AM/PM after it. */
|
|
24
|
+
export declare const periodLeads: (language?: string) => boolean;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { createTimeDomain, TimePrecision } from "@kjun-ui/tokens";
|
|
2
|
+
import type { KjunMessages } from "./messages/ko.js";
|
|
3
|
+
type TimeDomain = ReturnType<typeof createTimeDomain>;
|
|
4
|
+
export type HourCycle = 12 | 24;
|
|
5
|
+
export type TimeSegmentOption = {
|
|
6
|
+
value: number;
|
|
7
|
+
label: string;
|
|
8
|
+
};
|
|
9
|
+
export interface TimeSegmentModel {
|
|
10
|
+
key: "period" | "hour" | "minute" | "second";
|
|
11
|
+
label: string;
|
|
12
|
+
value: number | null;
|
|
13
|
+
options: TimeSegmentOption[];
|
|
14
|
+
/** The time after choosing this option; the same value when nothing in the domain matches. */
|
|
15
|
+
pick: (option: number) => string | null;
|
|
16
|
+
}
|
|
17
|
+
export declare function timeSegments(domain: TimeDomain, value: string | null, { precision, hourCycle, messages, periodFirst }: {
|
|
18
|
+
precision: TimePrecision;
|
|
19
|
+
hourCycle?: HourCycle;
|
|
20
|
+
messages: KjunMessages;
|
|
21
|
+
periodFirst?: boolean;
|
|
22
|
+
}): TimeSegmentModel[];
|
|
23
|
+
/** Korean and other East Asian clocks put 오전/오후 before the hour; most others put AM/PM after it. */
|
|
24
|
+
export declare const periodLeads: (language?: string) => boolean;
|
|
25
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kjun-ui/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://ui.kjun.dev",
|
|
6
6
|
"repository": {
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"./package.json": "./package.json"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@kjun-ui/tokens": "0.
|
|
44
|
+
"@kjun-ui/tokens": "0.18.0",
|
|
45
45
|
"react-aria-components": "1.21.1",
|
|
46
|
-
"@kjun-ui/icons": "0.
|
|
46
|
+
"@kjun-ui/icons": "0.18.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"react": "^19.2.3",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { formatRelativeTime } from "./messages/index.cjs";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { formatRelativeTime } from "./messages/index.js";
|