@kjun-ui/react 0.19.0 → 0.21.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 +4254 -1690
- package/dist/index.js +4045 -1481
- package/dist/styles.css +1531 -411
- package/dist/types/packages/react/src/app-navigation.d.cts +9 -4
- package/dist/types/packages/react/src/app-navigation.d.ts +9 -4
- package/dist/types/packages/react/src/card-actions-context.d.cts +2 -0
- package/dist/types/packages/react/src/card-actions-context.d.ts +2 -0
- package/dist/types/packages/react/src/card.d.cts +15 -5
- package/dist/types/packages/react/src/card.d.ts +15 -5
- package/dist/types/packages/react/src/chip.d.cts +4 -2
- package/dist/types/packages/react/src/chip.d.ts +4 -2
- package/dist/types/packages/react/src/color-picker-parts.d.cts +58 -0
- package/dist/types/packages/react/src/color-picker-parts.d.ts +58 -0
- package/dist/types/packages/react/src/color-picker.d.cts +51 -0
- package/dist/types/packages/react/src/color-picker.d.ts +51 -0
- package/dist/types/packages/react/src/data-state.d.cts +3 -3
- package/dist/types/packages/react/src/data-state.d.ts +3 -3
- package/dist/types/packages/react/src/display.d.cts +14 -5
- package/dist/types/packages/react/src/display.d.ts +14 -5
- package/dist/types/packages/react/src/fab.d.cts +16 -7
- package/dist/types/packages/react/src/fab.d.ts +16 -7
- package/dist/types/packages/react/src/index.d.cts +4 -0
- package/dist/types/packages/react/src/index.d.ts +4 -0
- package/dist/types/packages/react/src/kpi-hero.d.cts +53 -0
- package/dist/types/packages/react/src/kpi-hero.d.ts +53 -0
- package/dist/types/packages/react/src/kpi-row.d.cts +41 -0
- package/dist/types/packages/react/src/kpi-row.d.ts +41 -0
- package/dist/types/packages/react/src/kpi.d.cts +2 -72
- package/dist/types/packages/react/src/kpi.d.ts +2 -72
- package/dist/types/packages/react/src/list-context.d.cts +8 -0
- package/dist/types/packages/react/src/list-context.d.ts +8 -0
- package/dist/types/packages/react/src/list.d.cts +50 -8
- package/dist/types/packages/react/src/list.d.ts +50 -8
- package/dist/types/packages/react/src/modal.d.cts +5 -2
- package/dist/types/packages/react/src/modal.d.ts +5 -2
- package/dist/types/packages/react/src/navigation.d.cts +2 -1
- package/dist/types/packages/react/src/navigation.d.ts +2 -1
- package/dist/types/packages/react/src/number-display.d.cts +2 -0
- package/dist/types/packages/react/src/number-display.d.ts +2 -0
- package/dist/types/packages/react/src/range-input.d.cts +12 -1
- package/dist/types/packages/react/src/range-input.d.ts +12 -1
- package/dist/types/packages/react/src/reorder-controls.d.cts +43 -0
- package/dist/types/packages/react/src/reorder-controls.d.ts +43 -0
- package/dist/types/packages/react/src/skeletons.d.cts +2 -1
- package/dist/types/packages/react/src/skeletons.d.ts +2 -1
- package/dist/types/packages/react/src/split-pane.d.cts +30 -0
- package/dist/types/packages/react/src/split-pane.d.ts +30 -0
- package/dist/types/packages/react/src/stacked-bar.d.cts +22 -0
- package/dist/types/packages/react/src/stacked-bar.d.ts +22 -0
- 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/zone-gauge.d.cts +28 -0
- package/dist/types/packages/react/src/zone-gauge.d.ts +28 -0
- package/dist/types/shared/package-runtime/alert-action-size.d.cts +1 -0
- package/dist/types/shared/package-runtime/alert-action-size.d.ts +1 -0
- package/dist/types/shared/package-runtime/bottom-bar.d.cts +15 -0
- package/dist/types/shared/package-runtime/bottom-bar.d.ts +15 -0
- package/dist/types/shared/package-runtime/bottom-navigation.d.cts +25 -0
- package/dist/types/shared/package-runtime/bottom-navigation.d.ts +25 -0
- package/dist/types/shared/package-runtime/card-layout.d.cts +34 -0
- package/dist/types/shared/package-runtime/card-layout.d.ts +34 -0
- package/dist/types/shared/package-runtime/chart-skeleton.d.cts +1 -1
- package/dist/types/shared/package-runtime/chart-skeleton.d.ts +1 -1
- package/dist/types/shared/package-runtime/chip-size.d.cts +4 -0
- package/dist/types/shared/package-runtime/chip-size.d.ts +4 -0
- package/dist/types/shared/package-runtime/color-picker-model.d.cts +51 -0
- package/dist/types/shared/package-runtime/color-picker-model.d.ts +51 -0
- package/dist/types/shared/package-runtime/color-picker.d.cts +92 -0
- package/dist/types/shared/package-runtime/color-picker.d.ts +92 -0
- package/dist/types/shared/package-runtime/color.d.cts +22 -0
- package/dist/types/shared/package-runtime/color.d.ts +22 -0
- package/dist/types/shared/package-runtime/distribution.d.cts +133 -0
- package/dist/types/shared/package-runtime/distribution.d.ts +133 -0
- package/dist/types/shared/package-runtime/empty-geometry.d.cts +19 -0
- package/dist/types/shared/package-runtime/empty-geometry.d.ts +19 -0
- package/dist/types/shared/package-runtime/kpi.d.cts +89 -0
- package/dist/types/shared/package-runtime/kpi.d.ts +89 -0
- package/dist/types/shared/package-runtime/layer-state.d.cts +2 -1
- package/dist/types/shared/package-runtime/layer-state.d.ts +2 -1
- package/dist/types/shared/package-runtime/list-leading.d.cts +38 -0
- package/dist/types/shared/package-runtime/list-leading.d.ts +38 -0
- package/dist/types/shared/package-runtime/list-row.d.cts +115 -4
- package/dist/types/shared/package-runtime/list-row.d.ts +115 -4
- package/dist/types/shared/package-runtime/market-layout.d.cts +3 -1
- package/dist/types/shared/package-runtime/market-layout.d.ts +3 -1
- package/dist/types/shared/package-runtime/market-query.d.cts +15 -0
- package/dist/types/shared/package-runtime/market-query.d.ts +15 -0
- package/dist/types/shared/package-runtime/messages/ko.d.cts +27 -0
- package/dist/types/shared/package-runtime/messages/ko.d.ts +27 -0
- package/dist/types/shared/package-runtime/messages-context.d.cts +27 -0
- package/dist/types/shared/package-runtime/messages-context.d.ts +27 -0
- package/dist/types/shared/package-runtime/number-sign.d.cts +9 -0
- package/dist/types/shared/package-runtime/number-sign.d.ts +9 -0
- package/dist/types/shared/package-runtime/popover-scroll.d.cts +3 -0
- package/dist/types/shared/package-runtime/popover-scroll.d.ts +3 -0
- package/dist/types/shared/package-runtime/radio-keyboard.d.cts +2 -0
- package/dist/types/shared/package-runtime/radio-keyboard.d.ts +2 -0
- package/dist/types/shared/package-runtime/reorder-session.d.cts +62 -0
- package/dist/types/shared/package-runtime/reorder-session.d.ts +62 -0
- package/dist/types/shared/package-runtime/reorder.d.cts +81 -0
- package/dist/types/shared/package-runtime/reorder.d.ts +81 -0
- package/dist/types/shared/package-runtime/skeleton-text.d.cts +14 -0
- package/dist/types/shared/package-runtime/skeleton-text.d.ts +14 -0
- package/dist/types/shared/package-runtime/slider-view.d.cts +90 -0
- package/dist/types/shared/package-runtime/slider-view.d.ts +90 -0
- package/dist/types/shared/package-runtime/split-pane.d.cts +46 -0
- package/dist/types/shared/package-runtime/split-pane.d.ts +46 -0
- package/dist/types/shared/package-runtime/table-columns.d.cts +28 -0
- package/dist/types/shared/package-runtime/table-columns.d.ts +28 -0
- package/dist/types/shared/package-runtime/table-groups.d.cts +9 -0
- package/dist/types/shared/package-runtime/table-groups.d.ts +9 -0
- package/dist/types/shared/package-runtime/table-presentation.d.cts +24 -2
- package/dist/types/shared/package-runtime/table-presentation.d.ts +24 -2
- package/dist/types/shared/package-runtime/table.d.cts +32 -0
- package/dist/types/shared/package-runtime/table.d.ts +32 -0
- package/dist/types/shared/package-runtime/use-color-picker.d.cts +51 -0
- package/dist/types/shared/package-runtime/use-color-picker.d.ts +51 -0
- package/dist/types/shared/package-runtime/use-layer.d.cts +4 -2
- package/dist/types/shared/package-runtime/use-layer.d.ts +4 -2
- package/dist/types/shared/package-runtime/use-table-group-expansion.d.cts +6 -0
- package/dist/types/shared/package-runtime/use-table-group-expansion.d.ts +6 -0
- package/package.json +3 -3
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
export interface KjunSliderMark {
|
|
2
|
+
value: number;
|
|
3
|
+
/** Drawn beside the rail; leave it out for a dot only. Pressing a label moves the nearer thumb there. */
|
|
4
|
+
label?: string;
|
|
5
|
+
}
|
|
6
|
+
export type SliderMarks = boolean | KjunSliderMark[];
|
|
7
|
+
export type SliderOrientation = "horizontal" | "vertical";
|
|
8
|
+
/**
|
|
9
|
+
* Without formatValue the value follows the locale's number grouping with as many decimals as min and step use, so
|
|
10
|
+
* 0.5 steps read 1.0 · 1.5 and the text keeps its width while dragging. Formatters are cached per locale and precision.
|
|
11
|
+
*/
|
|
12
|
+
export declare function sliderFormatter(formatValue: ((value: number) => string) | undefined, locale?: string, min?: number, step?: number): (value: number) => string;
|
|
13
|
+
/** The visible value: formatRange for a range when given, else two equal values read as one. */
|
|
14
|
+
export declare function sliderValueText(values: readonly number[], format: (value: number) => string, formatRange?: (start: number, end: number) => string): string;
|
|
15
|
+
/**
|
|
16
|
+
* marks={true} puts a dot on every step (up to 24 of them); an array places dots, and labels, at the given values.
|
|
17
|
+
* The rail's own ends need no dot, so marks at min and max keep only their labels.
|
|
18
|
+
*/
|
|
19
|
+
export declare function sliderMarks(marks: SliderMarks | undefined, min: number, max: number, step: number, values: readonly number[], layout?: SliderLayout): {
|
|
20
|
+
fraction: number;
|
|
21
|
+
/** Offset from the left (or the top when vertical), like the thumbs. */
|
|
22
|
+
position: number;
|
|
23
|
+
active: boolean;
|
|
24
|
+
dot: boolean;
|
|
25
|
+
edge: "end" | "start" | undefined;
|
|
26
|
+
value: number;
|
|
27
|
+
/** Drawn beside the rail; leave it out for a dot only. Pressing a label moves the nearer thumb there. */
|
|
28
|
+
label?: string;
|
|
29
|
+
}[];
|
|
30
|
+
export interface SliderLayout {
|
|
31
|
+
rtl?: boolean;
|
|
32
|
+
vertical?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export declare function localeIsRtl(locale?: string): boolean;
|
|
35
|
+
/** A fraction as an offset from the left (or the top): right-to-left and vertical sliders run the other way, like React Aria. */
|
|
36
|
+
export declare function sliderAxis(fraction: number, { rtl, vertical }?: SliderLayout): number;
|
|
37
|
+
/**
|
|
38
|
+
* The fill as leading and trailing offsets (percent of the track, from the left/top and from the right/bottom). null is
|
|
39
|
+
* the rail's own end, half a thumb past the track: a single slider fills from there, a range between its thumbs.
|
|
40
|
+
*/
|
|
41
|
+
export declare function sliderFillBox(fractions: readonly number[], layout?: SliderLayout): {
|
|
42
|
+
lead: number | null;
|
|
43
|
+
trail: number | null;
|
|
44
|
+
};
|
|
45
|
+
/** PageUp/PageDown move a tenth of the range, on the step grid and at least one step, like React Aria. */
|
|
46
|
+
export declare function sliderPageSize(min: number, max: number, step: number): number;
|
|
47
|
+
/** The key's next value, or null. Right-to-left layouts swap the meaning of the horizontal arrows. */
|
|
48
|
+
export declare function sliderKeyValue(key: string, value: number, min: number, max: number, step: number, rtl?: boolean): number | null;
|
|
49
|
+
/** The value under a pointer, from its offset along the track (from the left, or the top when vertical). */
|
|
50
|
+
export declare function sliderValueAt(offset: number, length: number, min: number, max: number, { rtl, vertical }?: {
|
|
51
|
+
rtl?: boolean | undefined;
|
|
52
|
+
vertical?: boolean | undefined;
|
|
53
|
+
}): number;
|
|
54
|
+
/** Where each thumb sits (0–1). Invalid settings keep the app's values in view, clamped to the given range when it has one. */
|
|
55
|
+
export declare function sliderFractions(values: readonly number[], min: number, max: number): number[];
|
|
56
|
+
/** Overlapping range thumbs: the one that can still move goes on top (the start thumb near the top end, the end thumb elsewhere). */
|
|
57
|
+
export declare function sliderFrontThumb(values: readonly number[], min: number, max: number): 0 | 1 | null;
|
|
58
|
+
/** The thumb a press moves: the nearer one, or with both on one value, the side of the press ("pending" when on the value itself). */
|
|
59
|
+
export declare function sliderPick(values: readonly number[], number: number, snapped: number): {
|
|
60
|
+
index: 0 | 1;
|
|
61
|
+
pending: boolean;
|
|
62
|
+
};
|
|
63
|
+
export interface SliderSessionOptions {
|
|
64
|
+
min(): number;
|
|
65
|
+
max(): number;
|
|
66
|
+
step(): number;
|
|
67
|
+
snap(value: number): number;
|
|
68
|
+
blocked(): boolean;
|
|
69
|
+
emit(values: number[]): void;
|
|
70
|
+
commit(values: number[]): void;
|
|
71
|
+
/** Moves keyboard focus to the thumb a press or a direction choice picked. */
|
|
72
|
+
focus?(index: number): void;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* One slider's value changes: clamping against the other thumb, the overlapping-thumb direction choice, and one commit
|
|
76
|
+
* per gesture or key. `sync` takes the app's values between gestures; during a gesture the session leads them.
|
|
77
|
+
*/
|
|
78
|
+
export declare function createSliderSession(initial: readonly number[], options: SliderSessionOptions): {
|
|
79
|
+
readonly values: number[];
|
|
80
|
+
readonly active: number | null;
|
|
81
|
+
sync(values: readonly number[]): void;
|
|
82
|
+
update: (index: number, number: number) => void;
|
|
83
|
+
commit: () => void;
|
|
84
|
+
press(number: number): number | null;
|
|
85
|
+
move(number: number): number | null;
|
|
86
|
+
release(): void;
|
|
87
|
+
cancel(): void;
|
|
88
|
+
key(index: number, key: string, rtl?: boolean): boolean;
|
|
89
|
+
};
|
|
90
|
+
export type SliderSession = ReturnType<typeof createSliderSession>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export type SplitDirection = "horizontal" | "vertical";
|
|
2
|
+
export type SplitMin = readonly [
|
|
3
|
+
number,
|
|
4
|
+
number
|
|
5
|
+
];
|
|
6
|
+
export type SplitMax = readonly [
|
|
7
|
+
number | null,
|
|
8
|
+
number | null
|
|
9
|
+
];
|
|
10
|
+
export interface SplitLimits {
|
|
11
|
+
low: number;
|
|
12
|
+
high: number;
|
|
13
|
+
}
|
|
14
|
+
export type SplitKeyAction = "decrease" | "increase" | "min" | "max" | "reset";
|
|
15
|
+
/** Pixels one arrow key press moves the handle. */
|
|
16
|
+
export declare const SPLIT_KEY_STEP = 16;
|
|
17
|
+
/**
|
|
18
|
+
* The first pane's allowed pixels. Minimums beat maximums, and when the container is narrower than both minimums the
|
|
19
|
+
* first pane keeps its minimum (or all the room, if even that does not fit), so panes never overlap or go negative.
|
|
20
|
+
*/
|
|
21
|
+
export declare function splitLimits(total: number, handle: number, min?: SplitMin, max?: SplitMax): SplitLimits;
|
|
22
|
+
export declare function splitClamp(px: number, limits: SplitLimits): number;
|
|
23
|
+
export declare function splitFromRatio(ratio: number, total: number, handle: number): number;
|
|
24
|
+
/** Four decimals: enough for a pixel on any screen, and stable to store. */
|
|
25
|
+
export declare function splitToRatio(px: number, total: number, handle: number): number;
|
|
26
|
+
/** The wanted ratio as the first pane's pixels inside the limits. */
|
|
27
|
+
export declare function splitResolve(ratio: number, total: number, handle: number, min?: SplitMin, max?: SplitMax): number;
|
|
28
|
+
/** A whole percent for aria-valuenow, aria-valuemin and aria-valuemax. */
|
|
29
|
+
export declare function splitPercent(px: number, total: number, handle: number): number;
|
|
30
|
+
/**
|
|
31
|
+
* The first pane's pixels during a drag: where it started plus how far the pointer has moved. scale is layout pixels
|
|
32
|
+
* per viewport pixel (1 unless an ancestor is transformed), and right to left the pane grows as the pointer moves left.
|
|
33
|
+
*/
|
|
34
|
+
export declare function splitDrag(startPx: number, startPointer: number, pointer: number, scale: number, rtl: boolean | undefined): number;
|
|
35
|
+
/** A usable share: a missing or non-finite size falls back, and the rest is kept inside 0–1. */
|
|
36
|
+
export declare function splitShare(size: number | undefined, fallback?: number): number;
|
|
37
|
+
/** Browser shortcuts (Alt+Left, Ctrl+Home) keep their meaning on a focused handle. */
|
|
38
|
+
export declare function splitKeyHeld(event: {
|
|
39
|
+
altKey?: boolean;
|
|
40
|
+
ctrlKey?: boolean;
|
|
41
|
+
metaKey?: boolean;
|
|
42
|
+
}): boolean;
|
|
43
|
+
/** rtl is read by truth: Native Web has no reading direction to report and passes undefined. */
|
|
44
|
+
export declare function splitKeyAction(key: string, direction: SplitDirection, rtl: boolean | undefined): SplitKeyAction | null;
|
|
45
|
+
/** The first pane's pixels after a key action; resetPx is the default size in pixels. */
|
|
46
|
+
export declare function splitKeyTarget(action: SplitKeyAction, px: number, limits: SplitLimits, resetPx: number): number;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export type SplitDirection = "horizontal" | "vertical";
|
|
2
|
+
export type SplitMin = readonly [
|
|
3
|
+
number,
|
|
4
|
+
number
|
|
5
|
+
];
|
|
6
|
+
export type SplitMax = readonly [
|
|
7
|
+
number | null,
|
|
8
|
+
number | null
|
|
9
|
+
];
|
|
10
|
+
export interface SplitLimits {
|
|
11
|
+
low: number;
|
|
12
|
+
high: number;
|
|
13
|
+
}
|
|
14
|
+
export type SplitKeyAction = "decrease" | "increase" | "min" | "max" | "reset";
|
|
15
|
+
/** Pixels one arrow key press moves the handle. */
|
|
16
|
+
export declare const SPLIT_KEY_STEP = 16;
|
|
17
|
+
/**
|
|
18
|
+
* The first pane's allowed pixels. Minimums beat maximums, and when the container is narrower than both minimums the
|
|
19
|
+
* first pane keeps its minimum (or all the room, if even that does not fit), so panes never overlap or go negative.
|
|
20
|
+
*/
|
|
21
|
+
export declare function splitLimits(total: number, handle: number, min?: SplitMin, max?: SplitMax): SplitLimits;
|
|
22
|
+
export declare function splitClamp(px: number, limits: SplitLimits): number;
|
|
23
|
+
export declare function splitFromRatio(ratio: number, total: number, handle: number): number;
|
|
24
|
+
/** Four decimals: enough for a pixel on any screen, and stable to store. */
|
|
25
|
+
export declare function splitToRatio(px: number, total: number, handle: number): number;
|
|
26
|
+
/** The wanted ratio as the first pane's pixels inside the limits. */
|
|
27
|
+
export declare function splitResolve(ratio: number, total: number, handle: number, min?: SplitMin, max?: SplitMax): number;
|
|
28
|
+
/** A whole percent for aria-valuenow, aria-valuemin and aria-valuemax. */
|
|
29
|
+
export declare function splitPercent(px: number, total: number, handle: number): number;
|
|
30
|
+
/**
|
|
31
|
+
* The first pane's pixels during a drag: where it started plus how far the pointer has moved. scale is layout pixels
|
|
32
|
+
* per viewport pixel (1 unless an ancestor is transformed), and right to left the pane grows as the pointer moves left.
|
|
33
|
+
*/
|
|
34
|
+
export declare function splitDrag(startPx: number, startPointer: number, pointer: number, scale: number, rtl: boolean | undefined): number;
|
|
35
|
+
/** A usable share: a missing or non-finite size falls back, and the rest is kept inside 0–1. */
|
|
36
|
+
export declare function splitShare(size: number | undefined, fallback?: number): number;
|
|
37
|
+
/** Browser shortcuts (Alt+Left, Ctrl+Home) keep their meaning on a focused handle. */
|
|
38
|
+
export declare function splitKeyHeld(event: {
|
|
39
|
+
altKey?: boolean;
|
|
40
|
+
ctrlKey?: boolean;
|
|
41
|
+
metaKey?: boolean;
|
|
42
|
+
}): boolean;
|
|
43
|
+
/** rtl is read by truth: Native Web has no reading direction to report and passes undefined. */
|
|
44
|
+
export declare function splitKeyAction(key: string, direction: SplitDirection, rtl: boolean | undefined): SplitKeyAction | null;
|
|
45
|
+
/** The first pane's pixels after a key action; resetPx is the default size in pixels. */
|
|
46
|
+
export declare function splitKeyTarget(action: SplitKeyAction, px: number, limits: SplitLimits, resetPx: number): number;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface TableColumnGroup {
|
|
2
|
+
/** The label over the group's columns. */
|
|
3
|
+
label: string;
|
|
4
|
+
/** Keys of the columns it spans; they are drawn where `columns` puts them. */
|
|
5
|
+
columns: string[];
|
|
6
|
+
}
|
|
7
|
+
export type TableHeaderCell<Column> = {
|
|
8
|
+
kind: "group";
|
|
9
|
+
key: string;
|
|
10
|
+
label: string;
|
|
11
|
+
span: number;
|
|
12
|
+
columns: Column[];
|
|
13
|
+
} | {
|
|
14
|
+
kind: "column";
|
|
15
|
+
column: Column;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* The header's top row when groups apply: a group over each run of its shown columns, and the other columns standing
|
|
19
|
+
* alone across both rows. null when no group holds a shown column, so the header stays one row.
|
|
20
|
+
*/
|
|
21
|
+
export declare function tableHeaderRows<Column extends {
|
|
22
|
+
key: string;
|
|
23
|
+
}>(visible: readonly Column[], groups?: readonly TableColumnGroup[] | null): TableHeaderCell<Column>[] | null;
|
|
24
|
+
/**
|
|
25
|
+
* Each shown column's span in one row: a number above zero draws the cell over that many columns (never past the
|
|
26
|
+
* row's end), 0 marks a column a previous cell covers. A span that is not a whole number above one counts as 1.
|
|
27
|
+
*/
|
|
28
|
+
export declare function tableSpans<Column>(columns: readonly Column[], span?: ((column: Column) => number | null | undefined) | null): number[];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface TableColumnGroup {
|
|
2
|
+
/** The label over the group's columns. */
|
|
3
|
+
label: string;
|
|
4
|
+
/** Keys of the columns it spans; they are drawn where `columns` puts them. */
|
|
5
|
+
columns: string[];
|
|
6
|
+
}
|
|
7
|
+
export type TableHeaderCell<Column> = {
|
|
8
|
+
kind: "group";
|
|
9
|
+
key: string;
|
|
10
|
+
label: string;
|
|
11
|
+
span: number;
|
|
12
|
+
columns: Column[];
|
|
13
|
+
} | {
|
|
14
|
+
kind: "column";
|
|
15
|
+
column: Column;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* The header's top row when groups apply: a group over each run of its shown columns, and the other columns standing
|
|
19
|
+
* alone across both rows. null when no group holds a shown column, so the header stays one row.
|
|
20
|
+
*/
|
|
21
|
+
export declare function tableHeaderRows<Column extends {
|
|
22
|
+
key: string;
|
|
23
|
+
}>(visible: readonly Column[], groups?: readonly TableColumnGroup[] | null): TableHeaderCell<Column>[] | null;
|
|
24
|
+
/**
|
|
25
|
+
* Each shown column's span in one row: a number above zero draws the cell over that many columns (never past the
|
|
26
|
+
* row's end), 0 marks a column a previous cell covers. A span that is not a whole number above one counts as 1.
|
|
27
|
+
*/
|
|
28
|
+
export declare function tableSpans<Column>(columns: readonly Column[], span?: ((column: Column) => number | null | undefined) | null): number[];
|
|
@@ -4,8 +4,17 @@ export interface TableRowGroup<Row extends object> {
|
|
|
4
4
|
value: unknown;
|
|
5
5
|
rows: Row[];
|
|
6
6
|
}
|
|
7
|
+
export declare const tableGroupKey: (value: unknown) => string;
|
|
7
8
|
/** Groups keep the order their first row appears in, so a sorted table sorts inside each group. */
|
|
8
9
|
export declare function groupTableRows<Row extends object>(rows: readonly Row[], groupBy?: string | null): TableRowGroup<Row>[] | null;
|
|
10
|
+
/** undefined uses internal collapsed keys; a supplied array contains the original groupBy values. */
|
|
11
|
+
export declare function tableGroupExpansion<Row extends object>(groups: TableRowGroup<Row>[] | null, expanded: unknown[] | undefined, internalCollapsed: string[]): {
|
|
12
|
+
collapsed: string[];
|
|
13
|
+
toggle(key: string): {
|
|
14
|
+
expanded: unknown[];
|
|
15
|
+
collapsed: string[];
|
|
16
|
+
} | null;
|
|
17
|
+
};
|
|
9
18
|
/** count counts rows; the other kinds read finite numbers only and give null when a column has none. */
|
|
10
19
|
export declare function summarizeColumn<Row extends object>(rows: readonly Row[], key: string, kind: TableSummaryKind): number | null;
|
|
11
20
|
export declare function formatSummary(value: number | null, kind: TableSummaryKind, locale?: string): string;
|
|
@@ -4,8 +4,17 @@ export interface TableRowGroup<Row extends object> {
|
|
|
4
4
|
value: unknown;
|
|
5
5
|
rows: Row[];
|
|
6
6
|
}
|
|
7
|
+
export declare const tableGroupKey: (value: unknown) => string;
|
|
7
8
|
/** Groups keep the order their first row appears in, so a sorted table sorts inside each group. */
|
|
8
9
|
export declare function groupTableRows<Row extends object>(rows: readonly Row[], groupBy?: string | null): TableRowGroup<Row>[] | null;
|
|
10
|
+
/** undefined uses internal collapsed keys; a supplied array contains the original groupBy values. */
|
|
11
|
+
export declare function tableGroupExpansion<Row extends object>(groups: TableRowGroup<Row>[] | null, expanded: unknown[] | undefined, internalCollapsed: string[]): {
|
|
12
|
+
collapsed: string[];
|
|
13
|
+
toggle(key: string): {
|
|
14
|
+
expanded: unknown[];
|
|
15
|
+
collapsed: string[];
|
|
16
|
+
} | null;
|
|
17
|
+
};
|
|
9
18
|
/** count counts rows; the other kinds read finite numbers only and give null when a column has none. */
|
|
10
19
|
export declare function summarizeColumn<Row extends object>(rows: readonly Row[], key: string, kind: TableSummaryKind): number | null;
|
|
11
20
|
export declare function formatSummary(value: number | null, kind: TableSummaryKind, locale?: string): string;
|
|
@@ -20,9 +20,21 @@ export declare function tablePresentation<Row extends object>(props: TableProps<
|
|
|
20
20
|
footerActions: TableColumn<Row> | undefined;
|
|
21
21
|
/** One footer row holds the expand toggle and the row actions. */
|
|
22
22
|
cardFooter: boolean;
|
|
23
|
+
/** A reorderable card's move buttons end the title line unless a footer row already exists; then they join it. */
|
|
24
|
+
headerMover: boolean;
|
|
23
25
|
/** A section's field arrangement: rows cards put every field on a label-value line. */
|
|
24
26
|
cardBody(section: TableCardSection): "metrics" | "grid" | "stack" | "rows";
|
|
25
|
-
|
|
27
|
+
/**
|
|
28
|
+
* A section's fields for one row, in order. Spans are the grid's own (worked out once per row over the columns as
|
|
29
|
+
* shown), so a card leaves out exactly the fields the grid covers. A cell that spans other columns is a note about
|
|
30
|
+
* them, not the first column's value: it takes the whole line under its section's name (a column group's label),
|
|
31
|
+
* or no name without one.
|
|
32
|
+
*/
|
|
33
|
+
cardFields(row: Row, section: TableCardSection): {
|
|
34
|
+
column: TableColumn<Row>;
|
|
35
|
+
label: string;
|
|
36
|
+
full: boolean;
|
|
37
|
+
}[];
|
|
26
38
|
};
|
|
27
39
|
/** Narrow layouts have no header row to sort by, so the toolbar offers each sortable column in both orders. */
|
|
28
40
|
export declare function tableSortOptions<Row extends object>(props: TableProps<Row, unknown>, messages: {
|
|
@@ -63,7 +75,9 @@ export interface TableGroupingProps<Row extends object> {
|
|
|
63
75
|
summary: ((column: TableColumn<Row>, rows: Row[]) => ReactNode) | null;
|
|
64
76
|
}
|
|
65
77
|
/** Card parts: a card value starts at its label (cardValue) or ends a label-value line (cardRowValue); tiles use smaller titles and highlights. */
|
|
66
|
-
export type TableCellRole = "title" | "listTitle" | "listMeta" | "listValue" | "cardValue" | "cardRowValue" | "cardSubtitle" | "cardHighlight" | "tileTitle" | "tileHighlight";
|
|
78
|
+
export type TableCellRole = "title" | "listTitle" | "listMeta" | "listValue" | "cardValue" | "cardRowValue" | "cardSubtitle" | "cardHighlight" | "tileTitle" | "tileHighlight" | "merged";
|
|
79
|
+
/** A narrow layout's title opens the row when the row is clickable, so a cell drawn there is then never a button of its own. */
|
|
80
|
+
export declare const tableOpenerRole: (role?: TableCellRole) => role is "title" | "listTitle" | "tileTitle";
|
|
67
81
|
export interface TableRowsProps<Row extends object> {
|
|
68
82
|
initialLoading: boolean;
|
|
69
83
|
skeletonRows: number;
|
|
@@ -75,6 +89,8 @@ export interface TableRowsProps<Row extends object> {
|
|
|
75
89
|
expandable: boolean;
|
|
76
90
|
checkbox: (row: Row, index: number) => ReactNode;
|
|
77
91
|
expand: (row: Row, index: number) => ReactNode;
|
|
92
|
+
/** A reorderable table's move buttons for a row: the grid's last column, a card's footer or a list row's end. */
|
|
93
|
+
mover?: (row: Row, index: number) => ReactNode;
|
|
78
94
|
cell: (column: TableColumn<Row>, row: Row, index: number, role?: TableCellRole) => ReactNode;
|
|
79
95
|
renderExpand: TableProps<Row>["renderExpand"];
|
|
80
96
|
emptyContent: ReactNode;
|
|
@@ -85,12 +101,18 @@ export interface TableCardsProps<Row extends object> extends TableRowsProps<Row>
|
|
|
85
101
|
totals?: TableTotal[];
|
|
86
102
|
/** groupBy groups: each one opens with a header line (label, count and, with two or more rows, its subtotals) above its cards. */
|
|
87
103
|
groups?: TableRowGroup<Row>[] | null;
|
|
104
|
+
collapsed?: string[];
|
|
105
|
+
toggleGroup?: (key: string) => void;
|
|
88
106
|
groupLabel?: (group: TableRowGroup<Row>) => ReactNode;
|
|
89
107
|
groupTotals?: (rows: Row[]) => TableTotal[];
|
|
90
108
|
/** The cell's plain text, for a value read out with its label where the label is not drawn (tile highlight on Native). */
|
|
91
109
|
cellText?: (column: TableColumn<Row>, row: Row, index: number) => string | undefined;
|
|
92
110
|
}
|
|
93
111
|
export interface TableGridProps<Row extends object, Height> extends TableRowsProps<Row>, TableGroupingProps<Row> {
|
|
112
|
+
/** Labels over runs of columns (TableProps.columnGroups). */
|
|
113
|
+
columnGroups?: TableProps<Row>["columnGroups"];
|
|
114
|
+
/** How many columns a row's cell covers (TableProps.cellSpan). */
|
|
115
|
+
cellSpan?: TableProps<Row>["cellSpan"];
|
|
94
116
|
state: TableRowsProps<Row>["state"] & Pick<ReturnType<typeof useTableModel<Row>>, "all" | "some" | "toggleAll" | "sort" | "sortColumn">;
|
|
95
117
|
visible: TableColumn<Row>[];
|
|
96
118
|
maxHeight?: Height;
|
|
@@ -20,9 +20,21 @@ export declare function tablePresentation<Row extends object>(props: TableProps<
|
|
|
20
20
|
footerActions: TableColumn<Row> | undefined;
|
|
21
21
|
/** One footer row holds the expand toggle and the row actions. */
|
|
22
22
|
cardFooter: boolean;
|
|
23
|
+
/** A reorderable card's move buttons end the title line unless a footer row already exists; then they join it. */
|
|
24
|
+
headerMover: boolean;
|
|
23
25
|
/** A section's field arrangement: rows cards put every field on a label-value line. */
|
|
24
26
|
cardBody(section: TableCardSection): "metrics" | "grid" | "stack" | "rows";
|
|
25
|
-
|
|
27
|
+
/**
|
|
28
|
+
* A section's fields for one row, in order. Spans are the grid's own (worked out once per row over the columns as
|
|
29
|
+
* shown), so a card leaves out exactly the fields the grid covers. A cell that spans other columns is a note about
|
|
30
|
+
* them, not the first column's value: it takes the whole line under its section's name (a column group's label),
|
|
31
|
+
* or no name without one.
|
|
32
|
+
*/
|
|
33
|
+
cardFields(row: Row, section: TableCardSection): {
|
|
34
|
+
column: TableColumn<Row>;
|
|
35
|
+
label: string;
|
|
36
|
+
full: boolean;
|
|
37
|
+
}[];
|
|
26
38
|
};
|
|
27
39
|
/** Narrow layouts have no header row to sort by, so the toolbar offers each sortable column in both orders. */
|
|
28
40
|
export declare function tableSortOptions<Row extends object>(props: TableProps<Row, unknown>, messages: {
|
|
@@ -63,7 +75,9 @@ export interface TableGroupingProps<Row extends object> {
|
|
|
63
75
|
summary: ((column: TableColumn<Row>, rows: Row[]) => ReactNode) | null;
|
|
64
76
|
}
|
|
65
77
|
/** Card parts: a card value starts at its label (cardValue) or ends a label-value line (cardRowValue); tiles use smaller titles and highlights. */
|
|
66
|
-
export type TableCellRole = "title" | "listTitle" | "listMeta" | "listValue" | "cardValue" | "cardRowValue" | "cardSubtitle" | "cardHighlight" | "tileTitle" | "tileHighlight";
|
|
78
|
+
export type TableCellRole = "title" | "listTitle" | "listMeta" | "listValue" | "cardValue" | "cardRowValue" | "cardSubtitle" | "cardHighlight" | "tileTitle" | "tileHighlight" | "merged";
|
|
79
|
+
/** A narrow layout's title opens the row when the row is clickable, so a cell drawn there is then never a button of its own. */
|
|
80
|
+
export declare const tableOpenerRole: (role?: TableCellRole) => role is "title" | "listTitle" | "tileTitle";
|
|
67
81
|
export interface TableRowsProps<Row extends object> {
|
|
68
82
|
initialLoading: boolean;
|
|
69
83
|
skeletonRows: number;
|
|
@@ -75,6 +89,8 @@ export interface TableRowsProps<Row extends object> {
|
|
|
75
89
|
expandable: boolean;
|
|
76
90
|
checkbox: (row: Row, index: number) => ReactNode;
|
|
77
91
|
expand: (row: Row, index: number) => ReactNode;
|
|
92
|
+
/** A reorderable table's move buttons for a row: the grid's last column, a card's footer or a list row's end. */
|
|
93
|
+
mover?: (row: Row, index: number) => ReactNode;
|
|
78
94
|
cell: (column: TableColumn<Row>, row: Row, index: number, role?: TableCellRole) => ReactNode;
|
|
79
95
|
renderExpand: TableProps<Row>["renderExpand"];
|
|
80
96
|
emptyContent: ReactNode;
|
|
@@ -85,12 +101,18 @@ export interface TableCardsProps<Row extends object> extends TableRowsProps<Row>
|
|
|
85
101
|
totals?: TableTotal[];
|
|
86
102
|
/** groupBy groups: each one opens with a header line (label, count and, with two or more rows, its subtotals) above its cards. */
|
|
87
103
|
groups?: TableRowGroup<Row>[] | null;
|
|
104
|
+
collapsed?: string[];
|
|
105
|
+
toggleGroup?: (key: string) => void;
|
|
88
106
|
groupLabel?: (group: TableRowGroup<Row>) => ReactNode;
|
|
89
107
|
groupTotals?: (rows: Row[]) => TableTotal[];
|
|
90
108
|
/** The cell's plain text, for a value read out with its label where the label is not drawn (tile highlight on Native). */
|
|
91
109
|
cellText?: (column: TableColumn<Row>, row: Row, index: number) => string | undefined;
|
|
92
110
|
}
|
|
93
111
|
export interface TableGridProps<Row extends object, Height> extends TableRowsProps<Row>, TableGroupingProps<Row> {
|
|
112
|
+
/** Labels over runs of columns (TableProps.columnGroups). */
|
|
113
|
+
columnGroups?: TableProps<Row>["columnGroups"];
|
|
114
|
+
/** How many columns a row's cell covers (TableProps.cellSpan). */
|
|
115
|
+
cellSpan?: TableProps<Row>["cellSpan"];
|
|
94
116
|
state: TableRowsProps<Row>["state"] & Pick<ReturnType<typeof useTableModel<Row>>, "all" | "some" | "toggleAll" | "sort" | "sortColumn">;
|
|
95
117
|
visible: TableColumn<Row>[];
|
|
96
118
|
maxHeight?: Height;
|
|
@@ -2,6 +2,8 @@ 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
4
|
import type { TableSummaryKind } from "./table-groups.cjs";
|
|
5
|
+
import type { TableColumnGroup } from "./table-columns.cjs";
|
|
6
|
+
export type { TableColumnGroup } from "./table-columns.cjs";
|
|
5
7
|
export type { TableSummaryKind } from "./table-groups.cjs";
|
|
6
8
|
import { type TableCompare } from "./table-model.cjs";
|
|
7
9
|
export { getValue } from "./table-model.cjs";
|
|
@@ -25,6 +27,12 @@ export interface TableColumn<Row extends object = Record<string, unknown>> {
|
|
|
25
27
|
secondary?: boolean;
|
|
26
28
|
className?: string;
|
|
27
29
|
headerClass?: string;
|
|
30
|
+
/** Makes the cell a button that runs this, instead of opening the row (row clicks and keys stay with the row elsewhere). */
|
|
31
|
+
onCellPress?: (row: Row, index: number) => void;
|
|
32
|
+
/** The cell button's accessible name when its content alone does not say what it does, e.g. "목표가 82,000원, 근거 보기". */
|
|
33
|
+
cellLabel?: (row: Row, index: number) => string;
|
|
34
|
+
/** Web: extra attributes for the grid cell element (data-*, aria-*, title). Native ignores it. */
|
|
35
|
+
cellProps?: (row: Row, index: number) => Record<string, unknown> | undefined;
|
|
28
36
|
}
|
|
29
37
|
export interface TableCardSection {
|
|
30
38
|
key?: string;
|
|
@@ -40,6 +48,27 @@ export interface TablePagination {
|
|
|
40
48
|
}
|
|
41
49
|
export interface TableProps<Row extends object = Record<string, unknown>, MaxHeight = number> extends QueryDisplayProps {
|
|
42
50
|
columns: TableColumn<Row>[];
|
|
51
|
+
/** Labels over runs of columns, by column key: the header gets a second row. Narrow cards use them as sections when cardSections is empty. */
|
|
52
|
+
columnGroups?: TableColumnGroup[];
|
|
53
|
+
/** How many columns a row's cell covers, counting itself (2 merges it with the next column). The covered cells are not drawn. */
|
|
54
|
+
cellSpan?: (row: Row, column: TableColumn<Row>) => number | null | undefined;
|
|
55
|
+
/** Rows listed in `order` get up and down buttons. The app keeps the order, passes `data` in it and saves it. */
|
|
56
|
+
reorderable?: boolean;
|
|
57
|
+
/** The rows' rowKey values in the order shown; a row whose key is not listed cannot move. */
|
|
58
|
+
order?: (string | number)[];
|
|
59
|
+
/** Called with the next order when a row moves; the app applies it. */
|
|
60
|
+
onOrderChange?: (order: (string | number)[]) => void;
|
|
61
|
+
/** The same move in detail: the row's key, where it was and where it went. */
|
|
62
|
+
onReorder?: (move: {
|
|
63
|
+
value: string | number;
|
|
64
|
+
from: number;
|
|
65
|
+
to: number;
|
|
66
|
+
order: (string | number)[];
|
|
67
|
+
}) => void;
|
|
68
|
+
/** Turns the move buttons off. They are also off while the table is sorted by a column or grouped. */
|
|
69
|
+
reorderDisabled?: boolean;
|
|
70
|
+
/** Why moving is off, shown under the table and read with the buttons; a sorted or grouped table says so by default. */
|
|
71
|
+
reorderDisabledText?: string;
|
|
43
72
|
data?: Row[];
|
|
44
73
|
rowKey?: string;
|
|
45
74
|
skeletonRows?: number;
|
|
@@ -80,6 +109,8 @@ export interface TableProps<Row extends object = Record<string, unknown>, MaxHei
|
|
|
80
109
|
selected?: Row[];
|
|
81
110
|
/** Row field (dot path) whose values split the rows into collapsible groups. */
|
|
82
111
|
groupBy?: string;
|
|
112
|
+
/** Original groupBy values of open groups. undefined: internal state, initially all open; []: all closed. */
|
|
113
|
+
expandedGroups?: unknown[];
|
|
83
114
|
renderGroupLabel?: (value: unknown, rows: Row[]) => ReactNode;
|
|
84
115
|
/** Per column key: a subtotal under each group and a total row at the end. */
|
|
85
116
|
summary?: Partial<Record<string, TableSummaryKind | ((rows: Row[], column: TableColumn<Row>) => ReactNode)>>;
|
|
@@ -97,6 +128,7 @@ export interface TableProps<Row extends object = Record<string, unknown>, MaxHei
|
|
|
97
128
|
}) => void;
|
|
98
129
|
onSelectionChange?: (selected: Row[]) => void;
|
|
99
130
|
onExpandedRowsChange?: (keys: (string | number)[]) => void;
|
|
131
|
+
onExpandedGroupsChange?: (values: unknown[]) => void;
|
|
100
132
|
onPageChange?: (page: number) => void;
|
|
101
133
|
onRowClick?: (row: Row, index: number) => void;
|
|
102
134
|
onSearch?: (query: string) => void;
|
|
@@ -2,6 +2,8 @@ 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
4
|
import type { TableSummaryKind } from "./table-groups.js";
|
|
5
|
+
import type { TableColumnGroup } from "./table-columns.js";
|
|
6
|
+
export type { TableColumnGroup } from "./table-columns.js";
|
|
5
7
|
export type { TableSummaryKind } from "./table-groups.js";
|
|
6
8
|
import { type TableCompare } from "./table-model.js";
|
|
7
9
|
export { getValue } from "./table-model.js";
|
|
@@ -25,6 +27,12 @@ export interface TableColumn<Row extends object = Record<string, unknown>> {
|
|
|
25
27
|
secondary?: boolean;
|
|
26
28
|
className?: string;
|
|
27
29
|
headerClass?: string;
|
|
30
|
+
/** Makes the cell a button that runs this, instead of opening the row (row clicks and keys stay with the row elsewhere). */
|
|
31
|
+
onCellPress?: (row: Row, index: number) => void;
|
|
32
|
+
/** The cell button's accessible name when its content alone does not say what it does, e.g. "목표가 82,000원, 근거 보기". */
|
|
33
|
+
cellLabel?: (row: Row, index: number) => string;
|
|
34
|
+
/** Web: extra attributes for the grid cell element (data-*, aria-*, title). Native ignores it. */
|
|
35
|
+
cellProps?: (row: Row, index: number) => Record<string, unknown> | undefined;
|
|
28
36
|
}
|
|
29
37
|
export interface TableCardSection {
|
|
30
38
|
key?: string;
|
|
@@ -40,6 +48,27 @@ export interface TablePagination {
|
|
|
40
48
|
}
|
|
41
49
|
export interface TableProps<Row extends object = Record<string, unknown>, MaxHeight = number> extends QueryDisplayProps {
|
|
42
50
|
columns: TableColumn<Row>[];
|
|
51
|
+
/** Labels over runs of columns, by column key: the header gets a second row. Narrow cards use them as sections when cardSections is empty. */
|
|
52
|
+
columnGroups?: TableColumnGroup[];
|
|
53
|
+
/** How many columns a row's cell covers, counting itself (2 merges it with the next column). The covered cells are not drawn. */
|
|
54
|
+
cellSpan?: (row: Row, column: TableColumn<Row>) => number | null | undefined;
|
|
55
|
+
/** Rows listed in `order` get up and down buttons. The app keeps the order, passes `data` in it and saves it. */
|
|
56
|
+
reorderable?: boolean;
|
|
57
|
+
/** The rows' rowKey values in the order shown; a row whose key is not listed cannot move. */
|
|
58
|
+
order?: (string | number)[];
|
|
59
|
+
/** Called with the next order when a row moves; the app applies it. */
|
|
60
|
+
onOrderChange?: (order: (string | number)[]) => void;
|
|
61
|
+
/** The same move in detail: the row's key, where it was and where it went. */
|
|
62
|
+
onReorder?: (move: {
|
|
63
|
+
value: string | number;
|
|
64
|
+
from: number;
|
|
65
|
+
to: number;
|
|
66
|
+
order: (string | number)[];
|
|
67
|
+
}) => void;
|
|
68
|
+
/** Turns the move buttons off. They are also off while the table is sorted by a column or grouped. */
|
|
69
|
+
reorderDisabled?: boolean;
|
|
70
|
+
/** Why moving is off, shown under the table and read with the buttons; a sorted or grouped table says so by default. */
|
|
71
|
+
reorderDisabledText?: string;
|
|
43
72
|
data?: Row[];
|
|
44
73
|
rowKey?: string;
|
|
45
74
|
skeletonRows?: number;
|
|
@@ -80,6 +109,8 @@ export interface TableProps<Row extends object = Record<string, unknown>, MaxHei
|
|
|
80
109
|
selected?: Row[];
|
|
81
110
|
/** Row field (dot path) whose values split the rows into collapsible groups. */
|
|
82
111
|
groupBy?: string;
|
|
112
|
+
/** Original groupBy values of open groups. undefined: internal state, initially all open; []: all closed. */
|
|
113
|
+
expandedGroups?: unknown[];
|
|
83
114
|
renderGroupLabel?: (value: unknown, rows: Row[]) => ReactNode;
|
|
84
115
|
/** Per column key: a subtotal under each group and a total row at the end. */
|
|
85
116
|
summary?: Partial<Record<string, TableSummaryKind | ((rows: Row[], column: TableColumn<Row>) => ReactNode)>>;
|
|
@@ -97,6 +128,7 @@ export interface TableProps<Row extends object = Record<string, unknown>, MaxHei
|
|
|
97
128
|
}) => void;
|
|
98
129
|
onSelectionChange?: (selected: Row[]) => void;
|
|
99
130
|
onExpandedRowsChange?: (keys: (string | number)[]) => void;
|
|
131
|
+
onExpandedGroupsChange?: (values: unknown[]) => void;
|
|
100
132
|
onPageChange?: (page: number) => void;
|
|
101
133
|
onRowClick?: (row: Row, index: number) => void;
|
|
102
134
|
onSearch?: (query: string) => void;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type ColorSwatchInput, type PickerState } from "./color-picker.cjs";
|
|
2
|
+
export interface ColorPickerModelOptions {
|
|
3
|
+
value?: string | null;
|
|
4
|
+
defaultValue?: string | null;
|
|
5
|
+
onValueChange?: (value: string | null) => void;
|
|
6
|
+
onChangeCommit?: (value: string | null) => void;
|
|
7
|
+
swatches?: ColorSwatchInput[];
|
|
8
|
+
custom: boolean;
|
|
9
|
+
alpha: boolean;
|
|
10
|
+
input: boolean;
|
|
11
|
+
clearable: boolean;
|
|
12
|
+
open?: boolean;
|
|
13
|
+
defaultOpen: boolean;
|
|
14
|
+
onOpenChange?: (open: boolean) => void;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
readOnly?: boolean;
|
|
17
|
+
recentColors?: ColorSwatchInput[];
|
|
18
|
+
onRecentColorsChange?: (colors: string[]) => void;
|
|
19
|
+
eyeDropper?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare function useColorPickerModel(o: ColorPickerModelOptions): {
|
|
22
|
+
value: string | null;
|
|
23
|
+
open: boolean;
|
|
24
|
+
setOpen: (next: boolean) => void;
|
|
25
|
+
state: PickerState;
|
|
26
|
+
swatches: {
|
|
27
|
+
value: string;
|
|
28
|
+
label: string;
|
|
29
|
+
}[];
|
|
30
|
+
recent: {
|
|
31
|
+
value: string;
|
|
32
|
+
label: string;
|
|
33
|
+
}[] | null;
|
|
34
|
+
nothing: boolean;
|
|
35
|
+
showInput: boolean;
|
|
36
|
+
selected: number;
|
|
37
|
+
recentSelected: number;
|
|
38
|
+
pick: (next: string | null) => void;
|
|
39
|
+
moveTo: (next: PickerState) => void;
|
|
40
|
+
pickState: (next: PickerState) => void;
|
|
41
|
+
drag: {
|
|
42
|
+
onStart: () => void;
|
|
43
|
+
onEnd: () => void;
|
|
44
|
+
};
|
|
45
|
+
field: {
|
|
46
|
+
onEdit: (live: string | null) => void;
|
|
47
|
+
onCommit: (next: string | null | "revert") => void;
|
|
48
|
+
};
|
|
49
|
+
canPickScreen: boolean;
|
|
50
|
+
pickFromScreen: () => Promise<void>;
|
|
51
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type ColorSwatchInput, type PickerState } from "./color-picker.js";
|
|
2
|
+
export interface ColorPickerModelOptions {
|
|
3
|
+
value?: string | null;
|
|
4
|
+
defaultValue?: string | null;
|
|
5
|
+
onValueChange?: (value: string | null) => void;
|
|
6
|
+
onChangeCommit?: (value: string | null) => void;
|
|
7
|
+
swatches?: ColorSwatchInput[];
|
|
8
|
+
custom: boolean;
|
|
9
|
+
alpha: boolean;
|
|
10
|
+
input: boolean;
|
|
11
|
+
clearable: boolean;
|
|
12
|
+
open?: boolean;
|
|
13
|
+
defaultOpen: boolean;
|
|
14
|
+
onOpenChange?: (open: boolean) => void;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
readOnly?: boolean;
|
|
17
|
+
recentColors?: ColorSwatchInput[];
|
|
18
|
+
onRecentColorsChange?: (colors: string[]) => void;
|
|
19
|
+
eyeDropper?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare function useColorPickerModel(o: ColorPickerModelOptions): {
|
|
22
|
+
value: string | null;
|
|
23
|
+
open: boolean;
|
|
24
|
+
setOpen: (next: boolean) => void;
|
|
25
|
+
state: PickerState;
|
|
26
|
+
swatches: {
|
|
27
|
+
value: string;
|
|
28
|
+
label: string;
|
|
29
|
+
}[];
|
|
30
|
+
recent: {
|
|
31
|
+
value: string;
|
|
32
|
+
label: string;
|
|
33
|
+
}[] | null;
|
|
34
|
+
nothing: boolean;
|
|
35
|
+
showInput: boolean;
|
|
36
|
+
selected: number;
|
|
37
|
+
recentSelected: number;
|
|
38
|
+
pick: (next: string | null) => void;
|
|
39
|
+
moveTo: (next: PickerState) => void;
|
|
40
|
+
pickState: (next: PickerState) => void;
|
|
41
|
+
drag: {
|
|
42
|
+
onStart: () => void;
|
|
43
|
+
onEnd: () => void;
|
|
44
|
+
};
|
|
45
|
+
field: {
|
|
46
|
+
onEdit: (live: string | null) => void;
|
|
47
|
+
onCommit: (next: string | null | "revert") => void;
|
|
48
|
+
};
|
|
49
|
+
canPickScreen: boolean;
|
|
50
|
+
pickFromScreen: () => Promise<void>;
|
|
51
|
+
};
|