@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
|
@@ -83,6 +83,7 @@ export declare const kjunMessagesKo: {
|
|
|
83
83
|
increaseQuantity: string;
|
|
84
84
|
decreaseQuantity: string;
|
|
85
85
|
quantity: string;
|
|
86
|
+
hiddenValue: string;
|
|
86
87
|
relativeTimeFallback: (amount: number, unit: string) => string;
|
|
87
88
|
copy: string;
|
|
88
89
|
copied: string;
|
|
@@ -133,6 +134,32 @@ export declare const kjunMessagesKo: {
|
|
|
133
134
|
nextSlide: string;
|
|
134
135
|
goToSlide: (slide: number) => string;
|
|
135
136
|
slideOf: (slide: number, total: number) => string;
|
|
137
|
+
moveUp: (name: string) => string;
|
|
138
|
+
moveDown: (name: string) => string;
|
|
139
|
+
reorderMoved: (name: string, position: number, total: number) => string;
|
|
140
|
+
reorderHandle: (name: string) => string;
|
|
141
|
+
reorderGrabbed: (name: string) => string;
|
|
142
|
+
reorderDropped: (name: string, position: number, total: number) => string;
|
|
143
|
+
reorderCancelled: (name: string) => string;
|
|
144
|
+
tableReorderLocked: string;
|
|
145
|
+
colorPlaceholder: string;
|
|
146
|
+
colorPicker: string;
|
|
147
|
+
colorArea: string;
|
|
148
|
+
colorAreaValue: (saturation: number, brightness: number) => string;
|
|
149
|
+
hue: string;
|
|
150
|
+
hueValue: (degrees: number) => string;
|
|
151
|
+
alpha: string;
|
|
152
|
+
hex: string;
|
|
153
|
+
swatches: string;
|
|
154
|
+
colorNone: string;
|
|
155
|
+
colorValue: (hex: string, alpha?: number) => string;
|
|
156
|
+
increaseSaturation: string;
|
|
157
|
+
decreaseSaturation: string;
|
|
158
|
+
increaseBrightness: string;
|
|
159
|
+
decreaseBrightness: string;
|
|
160
|
+
recentColors: string;
|
|
161
|
+
eyeDropper: string;
|
|
162
|
+
colorAreaHint: string;
|
|
136
163
|
marketData: string;
|
|
137
164
|
metrics: string;
|
|
138
165
|
watchToggle: (name: string, active: boolean) => string;
|
|
@@ -92,6 +92,7 @@ export declare const useKjunMessages: () => {
|
|
|
92
92
|
increaseQuantity: string;
|
|
93
93
|
decreaseQuantity: string;
|
|
94
94
|
quantity: string;
|
|
95
|
+
hiddenValue: string;
|
|
95
96
|
relativeTimeFallback: (amount: number, unit: string) => string;
|
|
96
97
|
copy: string;
|
|
97
98
|
copied: string;
|
|
@@ -142,6 +143,32 @@ export declare const useKjunMessages: () => {
|
|
|
142
143
|
nextSlide: string;
|
|
143
144
|
goToSlide: (slide: number) => string;
|
|
144
145
|
slideOf: (slide: number, total: number) => string;
|
|
146
|
+
moveUp: (name: string) => string;
|
|
147
|
+
moveDown: (name: string) => string;
|
|
148
|
+
reorderMoved: (name: string, position: number, total: number) => string;
|
|
149
|
+
reorderHandle: (name: string) => string;
|
|
150
|
+
reorderGrabbed: (name: string) => string;
|
|
151
|
+
reorderDropped: (name: string, position: number, total: number) => string;
|
|
152
|
+
reorderCancelled: (name: string) => string;
|
|
153
|
+
tableReorderLocked: string;
|
|
154
|
+
colorPlaceholder: string;
|
|
155
|
+
colorPicker: string;
|
|
156
|
+
colorArea: string;
|
|
157
|
+
colorAreaValue: (saturation: number, brightness: number) => string;
|
|
158
|
+
hue: string;
|
|
159
|
+
hueValue: (degrees: number) => string;
|
|
160
|
+
alpha: string;
|
|
161
|
+
hex: string;
|
|
162
|
+
swatches: string;
|
|
163
|
+
colorNone: string;
|
|
164
|
+
colorValue: (hex: string, alpha?: number) => string;
|
|
165
|
+
increaseSaturation: string;
|
|
166
|
+
decreaseSaturation: string;
|
|
167
|
+
increaseBrightness: string;
|
|
168
|
+
decreaseBrightness: string;
|
|
169
|
+
recentColors: string;
|
|
170
|
+
eyeDropper: string;
|
|
171
|
+
colorAreaHint: string;
|
|
145
172
|
marketData: string;
|
|
146
173
|
metrics: string;
|
|
147
174
|
watchToggle: (name: string, active: boolean) => string;
|
|
@@ -92,6 +92,7 @@ export declare const useKjunMessages: () => {
|
|
|
92
92
|
increaseQuantity: string;
|
|
93
93
|
decreaseQuantity: string;
|
|
94
94
|
quantity: string;
|
|
95
|
+
hiddenValue: string;
|
|
95
96
|
relativeTimeFallback: (amount: number, unit: string) => string;
|
|
96
97
|
copy: string;
|
|
97
98
|
copied: string;
|
|
@@ -142,6 +143,32 @@ export declare const useKjunMessages: () => {
|
|
|
142
143
|
nextSlide: string;
|
|
143
144
|
goToSlide: (slide: number) => string;
|
|
144
145
|
slideOf: (slide: number, total: number) => string;
|
|
146
|
+
moveUp: (name: string) => string;
|
|
147
|
+
moveDown: (name: string) => string;
|
|
148
|
+
reorderMoved: (name: string, position: number, total: number) => string;
|
|
149
|
+
reorderHandle: (name: string) => string;
|
|
150
|
+
reorderGrabbed: (name: string) => string;
|
|
151
|
+
reorderDropped: (name: string, position: number, total: number) => string;
|
|
152
|
+
reorderCancelled: (name: string) => string;
|
|
153
|
+
tableReorderLocked: string;
|
|
154
|
+
colorPlaceholder: string;
|
|
155
|
+
colorPicker: string;
|
|
156
|
+
colorArea: string;
|
|
157
|
+
colorAreaValue: (saturation: number, brightness: number) => string;
|
|
158
|
+
hue: string;
|
|
159
|
+
hueValue: (degrees: number) => string;
|
|
160
|
+
alpha: string;
|
|
161
|
+
hex: string;
|
|
162
|
+
swatches: string;
|
|
163
|
+
colorNone: string;
|
|
164
|
+
colorValue: (hex: string, alpha?: number) => string;
|
|
165
|
+
increaseSaturation: string;
|
|
166
|
+
decreaseSaturation: string;
|
|
167
|
+
increaseBrightness: string;
|
|
168
|
+
decreaseBrightness: string;
|
|
169
|
+
recentColors: string;
|
|
170
|
+
eyeDropper: string;
|
|
171
|
+
colorAreaHint: string;
|
|
145
172
|
marketData: string;
|
|
146
173
|
metrics: string;
|
|
147
174
|
watchToggle: (name: string, active: boolean) => string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tabular figures give a leading + or - a whole figure's width (Inter's tnum does), so the sign floats apart
|
|
3
|
+
* from the digits ("- 1.25%"). The sign is split off and drawn with proportional figures, tight to the number,
|
|
4
|
+
* while the digits keep their tabular widths. The text itself is unchanged.
|
|
5
|
+
*/
|
|
6
|
+
export declare function splitNumberSign(value: unknown): [
|
|
7
|
+
sign: string,
|
|
8
|
+
rest: string
|
|
9
|
+
] | null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tabular figures give a leading + or - a whole figure's width (Inter's tnum does), so the sign floats apart
|
|
3
|
+
* from the digits ("- 1.25%"). The sign is split off and drawn with proportional figures, tight to the number,
|
|
4
|
+
* while the digits keep their tabular widths. The text itself is unchanged.
|
|
5
|
+
*/
|
|
6
|
+
export declare function splitNumberSign(value: unknown): [
|
|
7
|
+
sign: string,
|
|
8
|
+
rest: string
|
|
9
|
+
] | null;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** Marks a Popover body with where it can still scroll: `data-scrolled` once it has left the top
|
|
2
|
+
* (the fixed header then draws a divider) and `data-more` while content remains below (the body fades out). */
|
|
3
|
+
export declare function trackPopoverScroll(body: HTMLElement): () => void;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** Marks a Popover body with where it can still scroll: `data-scrolled` once it has left the top
|
|
2
|
+
* (the fixed header then draws a divider) and `data-more` while content remains below (the body fades out). */
|
|
3
|
+
export declare function trackPopoverScroll(body: HTMLElement): () => void;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { type ReorderKey, type ReorderMove } from "./reorder.cjs";
|
|
2
|
+
export interface ReorderHost {
|
|
3
|
+
order: () => readonly ReorderKey[] | undefined;
|
|
4
|
+
disabled: () => boolean;
|
|
5
|
+
/** The section's list element. */
|
|
6
|
+
list: () => HTMLElement | null;
|
|
7
|
+
/** Selects the movable rows' control groups inside list(); a list section's own rows by default. */
|
|
8
|
+
controls?: string;
|
|
9
|
+
/** Selects the root that owns a control group: one whose nearest such root is not list() belongs to a nested table or list. */
|
|
10
|
+
owner?: string;
|
|
11
|
+
text: () => {
|
|
12
|
+
moved: (name: string, position: number, total: number) => string;
|
|
13
|
+
grabbed: (name: string) => string;
|
|
14
|
+
dropped: (name: string, position: number, total: number) => string;
|
|
15
|
+
cancelled: (name: string) => string;
|
|
16
|
+
};
|
|
17
|
+
/** Sets the live region's text. */
|
|
18
|
+
say: (text: string) => void;
|
|
19
|
+
/** The row whose handle holds it (keyboard grab or pointer drag), or null. */
|
|
20
|
+
grabbed: (value: ReorderKey | null) => void;
|
|
21
|
+
/** Asks the app for this order. */
|
|
22
|
+
change: (order: ReorderKey[]) => void;
|
|
23
|
+
/** A finished move: one button press, or a whole grab or drag from where it started to where it ended. */
|
|
24
|
+
moved: (move: ReorderMove) => void;
|
|
25
|
+
}
|
|
26
|
+
interface KeyEvent {
|
|
27
|
+
key: string;
|
|
28
|
+
repeat?: boolean;
|
|
29
|
+
preventDefault: () => void;
|
|
30
|
+
}
|
|
31
|
+
interface PressEvent {
|
|
32
|
+
pointerId: number;
|
|
33
|
+
button: number;
|
|
34
|
+
clientY: number;
|
|
35
|
+
preventDefault: () => void;
|
|
36
|
+
}
|
|
37
|
+
export declare function createReorderSession(host: ReorderHost): {
|
|
38
|
+
/** An up or down button: one step, one finished move. */
|
|
39
|
+
press(value: ReorderKey, direction: -1 | 1, name: string): void;
|
|
40
|
+
/** A key on a row's handle. */
|
|
41
|
+
key(event: KeyEvent, value: ReorderKey, name: string, target?: Element | null): void;
|
|
42
|
+
/** The key press that grabbed or dropped is over; the click a browser may still send for it is ignored. */
|
|
43
|
+
keyUp(): void;
|
|
44
|
+
/** A click without a pointer (a screen reader's press): grabs the row, or drops it when it is held. */
|
|
45
|
+
click(event: {
|
|
46
|
+
detail: number;
|
|
47
|
+
}, value: ReorderKey, name: string, target?: Element | null): void;
|
|
48
|
+
/** A pointer pressing a row's handle starts a drag; the row steps as the pointer passes its neighbours. */
|
|
49
|
+
pointerDown(event: PressEvent, value: ReorderKey, name: string): void;
|
|
50
|
+
/** Called once the DOM shows an order: confirms the pending step, if this order is it. */
|
|
51
|
+
confirm(order: readonly ReorderKey[] | undefined): void;
|
|
52
|
+
/**
|
|
53
|
+
* Moving was turned off. A held row is let go where it is: the app that turned moving off (often to save a step)
|
|
54
|
+
* is not asked for another order. Nothing stays pending.
|
|
55
|
+
*/
|
|
56
|
+
reset(): void;
|
|
57
|
+
/** Moving is on again and its controls are drawn: focus goes to the moved row's control if it could not before. */
|
|
58
|
+
resume(): void;
|
|
59
|
+
dispose(): void;
|
|
60
|
+
};
|
|
61
|
+
export type ReorderSession = ReturnType<typeof createReorderSession>;
|
|
62
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { type ReorderKey, type ReorderMove } from "./reorder.js";
|
|
2
|
+
export interface ReorderHost {
|
|
3
|
+
order: () => readonly ReorderKey[] | undefined;
|
|
4
|
+
disabled: () => boolean;
|
|
5
|
+
/** The section's list element. */
|
|
6
|
+
list: () => HTMLElement | null;
|
|
7
|
+
/** Selects the movable rows' control groups inside list(); a list section's own rows by default. */
|
|
8
|
+
controls?: string;
|
|
9
|
+
/** Selects the root that owns a control group: one whose nearest such root is not list() belongs to a nested table or list. */
|
|
10
|
+
owner?: string;
|
|
11
|
+
text: () => {
|
|
12
|
+
moved: (name: string, position: number, total: number) => string;
|
|
13
|
+
grabbed: (name: string) => string;
|
|
14
|
+
dropped: (name: string, position: number, total: number) => string;
|
|
15
|
+
cancelled: (name: string) => string;
|
|
16
|
+
};
|
|
17
|
+
/** Sets the live region's text. */
|
|
18
|
+
say: (text: string) => void;
|
|
19
|
+
/** The row whose handle holds it (keyboard grab or pointer drag), or null. */
|
|
20
|
+
grabbed: (value: ReorderKey | null) => void;
|
|
21
|
+
/** Asks the app for this order. */
|
|
22
|
+
change: (order: ReorderKey[]) => void;
|
|
23
|
+
/** A finished move: one button press, or a whole grab or drag from where it started to where it ended. */
|
|
24
|
+
moved: (move: ReorderMove) => void;
|
|
25
|
+
}
|
|
26
|
+
interface KeyEvent {
|
|
27
|
+
key: string;
|
|
28
|
+
repeat?: boolean;
|
|
29
|
+
preventDefault: () => void;
|
|
30
|
+
}
|
|
31
|
+
interface PressEvent {
|
|
32
|
+
pointerId: number;
|
|
33
|
+
button: number;
|
|
34
|
+
clientY: number;
|
|
35
|
+
preventDefault: () => void;
|
|
36
|
+
}
|
|
37
|
+
export declare function createReorderSession(host: ReorderHost): {
|
|
38
|
+
/** An up or down button: one step, one finished move. */
|
|
39
|
+
press(value: ReorderKey, direction: -1 | 1, name: string): void;
|
|
40
|
+
/** A key on a row's handle. */
|
|
41
|
+
key(event: KeyEvent, value: ReorderKey, name: string, target?: Element | null): void;
|
|
42
|
+
/** The key press that grabbed or dropped is over; the click a browser may still send for it is ignored. */
|
|
43
|
+
keyUp(): void;
|
|
44
|
+
/** A click without a pointer (a screen reader's press): grabs the row, or drops it when it is held. */
|
|
45
|
+
click(event: {
|
|
46
|
+
detail: number;
|
|
47
|
+
}, value: ReorderKey, name: string, target?: Element | null): void;
|
|
48
|
+
/** A pointer pressing a row's handle starts a drag; the row steps as the pointer passes its neighbours. */
|
|
49
|
+
pointerDown(event: PressEvent, value: ReorderKey, name: string): void;
|
|
50
|
+
/** Called once the DOM shows an order: confirms the pending step, if this order is it. */
|
|
51
|
+
confirm(order: readonly ReorderKey[] | undefined): void;
|
|
52
|
+
/**
|
|
53
|
+
* Moving was turned off. A held row is let go where it is: the app that turned moving off (often to save a step)
|
|
54
|
+
* is not asked for another order. Nothing stays pending.
|
|
55
|
+
*/
|
|
56
|
+
reset(): void;
|
|
57
|
+
/** Moving is on again and its controls are drawn: focus goes to the moved row's control if it could not before. */
|
|
58
|
+
resume(): void;
|
|
59
|
+
dispose(): void;
|
|
60
|
+
};
|
|
61
|
+
export type ReorderSession = ReturnType<typeof createReorderSession>;
|
|
62
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export type ReorderKey = string | number;
|
|
2
|
+
export interface ReorderPlace {
|
|
3
|
+
index: number;
|
|
4
|
+
total: number;
|
|
5
|
+
up: boolean;
|
|
6
|
+
down: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface ReorderMove<T extends ReorderKey = ReorderKey> {
|
|
9
|
+
value: T;
|
|
10
|
+
from: number;
|
|
11
|
+
to: number;
|
|
12
|
+
order: T[];
|
|
13
|
+
}
|
|
14
|
+
/** A copy with the item at `from` moved to `to`; the same array when nothing moves. */
|
|
15
|
+
export declare function reorderMove<T>(order: readonly T[], from: number, to: number): T[];
|
|
16
|
+
/** Where a row sits and which way it can go; null for a row the order does not list. */
|
|
17
|
+
export declare function reorderPlace(order: readonly ReorderKey[] | undefined, value: ReorderKey | undefined): ReorderPlace | null;
|
|
18
|
+
/** One step up (-1) or down (1); null at an end or for an unknown row. */
|
|
19
|
+
export declare function reorderStep<T extends ReorderKey>(order: readonly T[] | undefined, value: T, step: -1 | 1): ReorderMove<T> | null;
|
|
20
|
+
/** The button to focus after a move: the one pressed while it is still usable, else the other; null when neither is. */
|
|
21
|
+
export declare function reorderFocus(order: readonly ReorderKey[] | undefined, value: ReorderKey, step: -1 | 1): "up" | "down" | null;
|
|
22
|
+
/** A move waiting for the app to apply it: the row, where it should land and when it was pressed (ms). */
|
|
23
|
+
export interface ReorderPending {
|
|
24
|
+
value: ReorderKey;
|
|
25
|
+
to: number;
|
|
26
|
+
at: number;
|
|
27
|
+
}
|
|
28
|
+
/** How long a pressed move may wait for its order; after that an order change is someone else's. */
|
|
29
|
+
export declare const REORDER_CONFIRM_MS = 10000;
|
|
30
|
+
/**
|
|
31
|
+
* Whether an order is the pressed move, applied: it shows the row at the place it was sent to, soon enough after the
|
|
32
|
+
* press. An order the app drew again unchanged, or changed for another reason, confirms nothing.
|
|
33
|
+
*/
|
|
34
|
+
export declare function reorderConfirmed(order: readonly ReorderKey[] | undefined, pending: ReorderPending | null, now: number): boolean;
|
|
35
|
+
/** True when a value appears twice: such rows would share one place. */
|
|
36
|
+
export declare function reorderDuplicates(order: readonly ReorderKey[] | undefined): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Which way a dragged row steps for a pointer position: up once the pointer is above the middle of the row before
|
|
39
|
+
* it, down once it is below the middle of the row after it. `rows` are the movable rows' boxes in their current order.
|
|
40
|
+
*/
|
|
41
|
+
export declare function reorderDragStep(pointer: number, rows: readonly {
|
|
42
|
+
top: number;
|
|
43
|
+
height: number;
|
|
44
|
+
}[], index: number): -1 | 0 | 1;
|
|
45
|
+
export type ReorderKeyAction = "grab" | "drop" | "cancel" | "up" | "down" | "leave";
|
|
46
|
+
/** Keys on a row's handle. "leave" (Tab) drops the row and must not be prevented. */
|
|
47
|
+
export declare function reorderKeyAction(key: string, grabbed: boolean): ReorderKeyAction | null;
|
|
48
|
+
/**
|
|
49
|
+
* A row's place for its buttons when only some of the order is on screen (a table page, a filtered list): a step
|
|
50
|
+
* that would pass a row that is not shown is off, so a move never takes the row out of sight.
|
|
51
|
+
*/
|
|
52
|
+
export declare function reorderPlaceAmong(order: readonly ReorderKey[] | undefined, value: ReorderKey | undefined, shown?: ReadonlySet<ReorderKey> | null): ReorderPlace | null;
|
|
53
|
+
/** What is wrong with a reorderable section's `order`, for the console; `model` names the platform's way to receive it. */
|
|
54
|
+
export declare function reorderWarning(order: readonly ReorderKey[] | undefined, model: string): string | null;
|
|
55
|
+
/** A requested step: `focus` is where focus goes once it is applied, and `quiet` skips the sentence. */
|
|
56
|
+
export interface ReorderRequest extends ReorderPending {
|
|
57
|
+
name: string;
|
|
58
|
+
focus: -1 | 1 | "handle";
|
|
59
|
+
quiet: boolean;
|
|
60
|
+
}
|
|
61
|
+
export interface ReorderMovesHost {
|
|
62
|
+
order: () => readonly ReorderKey[] | undefined;
|
|
63
|
+
disabled: () => boolean;
|
|
64
|
+
/** Says a sentence to screen readers; an empty one clears the last. */
|
|
65
|
+
say: (text: string) => void;
|
|
66
|
+
moved: (name: string, position: number, total: number) => string;
|
|
67
|
+
/** Asks the app for this order. */
|
|
68
|
+
change: (order: ReorderKey[]) => void;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The part of reordering every platform shares. The app owns the order, so a step is a request: it waits until an
|
|
72
|
+
* order shows the row at its new place, and only then is it announced. A request the app never applies stops waiting.
|
|
73
|
+
*/
|
|
74
|
+
export declare function createReorderMoves(host: ReorderMovesHost): {
|
|
75
|
+
waiting: () => ReorderRequest | null;
|
|
76
|
+
/** Waits for this request (an order the caller asked for itself), or for nothing. */
|
|
77
|
+
expect(request: ReorderRequest | null): void;
|
|
78
|
+
step(value: ReorderKey, direction: -1 | 1, name: string, focus?: -1 | 1 | "handle", quiet?: boolean): ReorderMove<ReorderKey> | null;
|
|
79
|
+
/** The request this order confirms, announced unless it is quiet or `announce` is off; null when it confirms none. */
|
|
80
|
+
confirm(order: readonly ReorderKey[] | undefined, announce?: boolean): ReorderRequest | null;
|
|
81
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export type ReorderKey = string | number;
|
|
2
|
+
export interface ReorderPlace {
|
|
3
|
+
index: number;
|
|
4
|
+
total: number;
|
|
5
|
+
up: boolean;
|
|
6
|
+
down: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface ReorderMove<T extends ReorderKey = ReorderKey> {
|
|
9
|
+
value: T;
|
|
10
|
+
from: number;
|
|
11
|
+
to: number;
|
|
12
|
+
order: T[];
|
|
13
|
+
}
|
|
14
|
+
/** A copy with the item at `from` moved to `to`; the same array when nothing moves. */
|
|
15
|
+
export declare function reorderMove<T>(order: readonly T[], from: number, to: number): T[];
|
|
16
|
+
/** Where a row sits and which way it can go; null for a row the order does not list. */
|
|
17
|
+
export declare function reorderPlace(order: readonly ReorderKey[] | undefined, value: ReorderKey | undefined): ReorderPlace | null;
|
|
18
|
+
/** One step up (-1) or down (1); null at an end or for an unknown row. */
|
|
19
|
+
export declare function reorderStep<T extends ReorderKey>(order: readonly T[] | undefined, value: T, step: -1 | 1): ReorderMove<T> | null;
|
|
20
|
+
/** The button to focus after a move: the one pressed while it is still usable, else the other; null when neither is. */
|
|
21
|
+
export declare function reorderFocus(order: readonly ReorderKey[] | undefined, value: ReorderKey, step: -1 | 1): "up" | "down" | null;
|
|
22
|
+
/** A move waiting for the app to apply it: the row, where it should land and when it was pressed (ms). */
|
|
23
|
+
export interface ReorderPending {
|
|
24
|
+
value: ReorderKey;
|
|
25
|
+
to: number;
|
|
26
|
+
at: number;
|
|
27
|
+
}
|
|
28
|
+
/** How long a pressed move may wait for its order; after that an order change is someone else's. */
|
|
29
|
+
export declare const REORDER_CONFIRM_MS = 10000;
|
|
30
|
+
/**
|
|
31
|
+
* Whether an order is the pressed move, applied: it shows the row at the place it was sent to, soon enough after the
|
|
32
|
+
* press. An order the app drew again unchanged, or changed for another reason, confirms nothing.
|
|
33
|
+
*/
|
|
34
|
+
export declare function reorderConfirmed(order: readonly ReorderKey[] | undefined, pending: ReorderPending | null, now: number): boolean;
|
|
35
|
+
/** True when a value appears twice: such rows would share one place. */
|
|
36
|
+
export declare function reorderDuplicates(order: readonly ReorderKey[] | undefined): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Which way a dragged row steps for a pointer position: up once the pointer is above the middle of the row before
|
|
39
|
+
* it, down once it is below the middle of the row after it. `rows` are the movable rows' boxes in their current order.
|
|
40
|
+
*/
|
|
41
|
+
export declare function reorderDragStep(pointer: number, rows: readonly {
|
|
42
|
+
top: number;
|
|
43
|
+
height: number;
|
|
44
|
+
}[], index: number): -1 | 0 | 1;
|
|
45
|
+
export type ReorderKeyAction = "grab" | "drop" | "cancel" | "up" | "down" | "leave";
|
|
46
|
+
/** Keys on a row's handle. "leave" (Tab) drops the row and must not be prevented. */
|
|
47
|
+
export declare function reorderKeyAction(key: string, grabbed: boolean): ReorderKeyAction | null;
|
|
48
|
+
/**
|
|
49
|
+
* A row's place for its buttons when only some of the order is on screen (a table page, a filtered list): a step
|
|
50
|
+
* that would pass a row that is not shown is off, so a move never takes the row out of sight.
|
|
51
|
+
*/
|
|
52
|
+
export declare function reorderPlaceAmong(order: readonly ReorderKey[] | undefined, value: ReorderKey | undefined, shown?: ReadonlySet<ReorderKey> | null): ReorderPlace | null;
|
|
53
|
+
/** What is wrong with a reorderable section's `order`, for the console; `model` names the platform's way to receive it. */
|
|
54
|
+
export declare function reorderWarning(order: readonly ReorderKey[] | undefined, model: string): string | null;
|
|
55
|
+
/** A requested step: `focus` is where focus goes once it is applied, and `quiet` skips the sentence. */
|
|
56
|
+
export interface ReorderRequest extends ReorderPending {
|
|
57
|
+
name: string;
|
|
58
|
+
focus: -1 | 1 | "handle";
|
|
59
|
+
quiet: boolean;
|
|
60
|
+
}
|
|
61
|
+
export interface ReorderMovesHost {
|
|
62
|
+
order: () => readonly ReorderKey[] | undefined;
|
|
63
|
+
disabled: () => boolean;
|
|
64
|
+
/** Says a sentence to screen readers; an empty one clears the last. */
|
|
65
|
+
say: (text: string) => void;
|
|
66
|
+
moved: (name: string, position: number, total: number) => string;
|
|
67
|
+
/** Asks the app for this order. */
|
|
68
|
+
change: (order: ReorderKey[]) => void;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The part of reordering every platform shares. The app owns the order, so a step is a request: it waits until an
|
|
72
|
+
* order shows the row at its new place, and only then is it announced. A request the app never applies stops waiting.
|
|
73
|
+
*/
|
|
74
|
+
export declare function createReorderMoves(host: ReorderMovesHost): {
|
|
75
|
+
waiting: () => ReorderRequest | null;
|
|
76
|
+
/** Waits for this request (an order the caller asked for itself), or for nothing. */
|
|
77
|
+
expect(request: ReorderRequest | null): void;
|
|
78
|
+
step(value: ReorderKey, direction: -1 | 1, name: string, focus?: -1 | 1 | "handle", quiet?: boolean): ReorderMove<ReorderKey> | null;
|
|
79
|
+
/** The request this order confirms, announced unless it is quiet or `announce` is off; null when it confirms none. */
|
|
80
|
+
confirm(order: readonly ReorderKey[] | undefined, announce?: boolean): ReorderRequest | null;
|
|
81
|
+
};
|
|
@@ -2,6 +2,20 @@ import { type TypographyRole } from "@kjun-ui/tokens";
|
|
|
2
2
|
type Percent = `${number}%`;
|
|
3
3
|
/** A paragraph that does not look like every other one, with a short last line. */
|
|
4
4
|
export declare function skeletonTextWidths(rows: number): Percent[];
|
|
5
|
+
/** Rows drawn for a count that may come from data: floored, never negative, and at most 100. */
|
|
6
|
+
export declare function skeletonCount(value: number): number;
|
|
7
|
+
/**
|
|
8
|
+
* Line widths for row `index` of a list skeleton, so neighbouring rows differ like real names do.
|
|
9
|
+
* `wide` is for rows whose label column is narrow (market, compact, notification, the market table's identity).
|
|
10
|
+
*/
|
|
11
|
+
export declare function skeletonRowWidths(index: number, wide?: boolean): {
|
|
12
|
+
title: `${number}%`;
|
|
13
|
+
detail: `${number}%`;
|
|
14
|
+
};
|
|
15
|
+
/** A factor for a fixed-width bar (a value, a label), so a column of them does not read as stripes. */
|
|
16
|
+
export declare function skeletonWidthScale(index: number): number;
|
|
17
|
+
/** Bar width for a cell of the table skeleton; row 0 is the header. The first column reads as names, the rest as values. */
|
|
18
|
+
export declare function skeletonTableWidth(row: number, column: number): Percent;
|
|
5
19
|
/** The web line box of a type role; without a role the line takes the surrounding text's line height. */
|
|
6
20
|
export declare function skeletonLineBox(role?: TypographyRole): string;
|
|
7
21
|
/**
|
|
@@ -2,6 +2,20 @@ import { type TypographyRole } from "@kjun-ui/tokens";
|
|
|
2
2
|
type Percent = `${number}%`;
|
|
3
3
|
/** A paragraph that does not look like every other one, with a short last line. */
|
|
4
4
|
export declare function skeletonTextWidths(rows: number): Percent[];
|
|
5
|
+
/** Rows drawn for a count that may come from data: floored, never negative, and at most 100. */
|
|
6
|
+
export declare function skeletonCount(value: number): number;
|
|
7
|
+
/**
|
|
8
|
+
* Line widths for row `index` of a list skeleton, so neighbouring rows differ like real names do.
|
|
9
|
+
* `wide` is for rows whose label column is narrow (market, compact, notification, the market table's identity).
|
|
10
|
+
*/
|
|
11
|
+
export declare function skeletonRowWidths(index: number, wide?: boolean): {
|
|
12
|
+
title: `${number}%`;
|
|
13
|
+
detail: `${number}%`;
|
|
14
|
+
};
|
|
15
|
+
/** A factor for a fixed-width bar (a value, a label), so a column of them does not read as stripes. */
|
|
16
|
+
export declare function skeletonWidthScale(index: number): number;
|
|
17
|
+
/** Bar width for a cell of the table skeleton; row 0 is the header. The first column reads as names, the rest as values. */
|
|
18
|
+
export declare function skeletonTableWidth(row: number, column: number): Percent;
|
|
5
19
|
/** The web line box of a type role; without a role the line takes the surrounding text's line height. */
|
|
6
20
|
export declare function skeletonLineBox(role?: TypographyRole): string;
|
|
7
21
|
/**
|
|
@@ -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>;
|