@kjun-ui/react 0.17.0 → 0.19.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 +4267 -1765
- package/dist/index.js +4272 -1767
- package/dist/styles.css +1612 -577
- 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 +31 -8
- package/dist/types/packages/react/src/app-navigation.d.ts +31 -8
- 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 +15 -3
- package/dist/types/packages/react/src/display.d.ts +15 -3
- package/dist/types/packages/react/src/drawer.d.cts +3 -5
- package/dist/types/packages/react/src/drawer.d.ts +3 -5
- 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/fab.d.cts +3 -3
- package/dist/types/packages/react/src/fab.d.ts +3 -3
- package/dist/types/packages/react/src/feedback.d.cts +12 -3
- package/dist/types/packages/react/src/feedback.d.ts +12 -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 +10 -6
- package/dist/types/packages/react/src/index.d.ts +10 -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/layout-primitives.d.cts +24 -24
- package/dist/types/packages/react/src/layout-primitives.d.ts +24 -24
- 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/modal.d.cts +3 -1
- package/dist/types/packages/react/src/modal.d.ts +3 -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/provider.d.cts +4 -1
- package/dist/types/packages/react/src/provider.d.ts +4 -1
- 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/skeleton-phase.d.cts +2 -0
- package/dist/types/packages/react/src/skeleton-phase.d.ts +2 -0
- package/dist/types/packages/react/src/skeletons.d.cts +19 -4
- package/dist/types/packages/react/src/skeletons.d.ts +19 -4
- package/dist/types/packages/react/src/table-cards.d.cts +6 -3
- package/dist/types/packages/react/src/table-cards.d.ts +6 -3
- 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 +10 -0
- package/dist/types/packages/react/src/table-list.d.ts +10 -0
- package/dist/types/packages/react/src/table-model.d.cts +2 -0
- package/dist/types/packages/react/src/table-model.d.ts +2 -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/table-totals.d.cts +5 -0
- package/dist/types/packages/react/src/table-totals.d.ts +5 -0
- 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/packages/react/src/toast-stack.d.cts +7 -2
- package/dist/types/packages/react/src/toast-stack.d.ts +7 -2
- 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/chart-skeleton.d.cts +15 -3
- package/dist/types/shared/package-runtime/chart-skeleton.d.ts +15 -3
- package/dist/types/shared/package-runtime/drawer-geometry.d.cts +2 -3
- package/dist/types/shared/package-runtime/drawer-geometry.d.ts +2 -3
- package/dist/types/shared/package-runtime/feedback-dialog.d.cts +5 -4
- package/dist/types/shared/package-runtime/feedback-dialog.d.ts +5 -4
- package/dist/types/shared/package-runtime/feedback-motion.d.cts +2 -5
- package/dist/types/shared/package-runtime/feedback-motion.d.ts +2 -5
- package/dist/types/shared/package-runtime/feedback-prompt.d.cts +58 -0
- package/dist/types/shared/package-runtime/feedback-prompt.d.ts +58 -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/market-layout.d.cts +0 -1
- package/dist/types/shared/package-runtime/market-layout.d.ts +0 -1
- package/dist/types/shared/package-runtime/messages/ko.d.cts +45 -5
- package/dist/types/shared/package-runtime/messages/ko.d.ts +45 -5
- package/dist/types/shared/package-runtime/messages-context.d.cts +45 -5
- package/dist/types/shared/package-runtime/messages-context.d.ts +45 -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/safe-area.d.cts +20 -0
- package/dist/types/shared/package-runtime/safe-area.d.ts +20 -0
- 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/skeleton-text.d.cts +12 -0
- package/dist/types/shared/package-runtime/skeleton-text.d.ts +12 -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/stable-value.d.cts +3 -0
- package/dist/types/shared/package-runtime/stable-value.d.ts +3 -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 +67 -5
- package/dist/types/shared/package-runtime/table-presentation.d.ts +67 -5
- package/dist/types/shared/package-runtime/table.d.cts +24 -2
- package/dist/types/shared/package-runtime/table.d.ts +24 -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/dist/types/shared/package-runtime/toast-entry.d.cts +3 -0
- package/dist/types/shared/package-runtime/toast-entry.d.ts +3 -0
- package/dist/types/shared/package-runtime/toast-placement.d.cts +4 -0
- package/dist/types/shared/package-runtime/toast-placement.d.ts +4 -0
- package/dist/types/shared/package-runtime/toast-presence.d.cts +12 -0
- package/dist/types/shared/package-runtime/toast-presence.d.ts +12 -0
- package/dist/types/shared/package-runtime/toast-presentation.d.cts +42 -0
- package/dist/types/shared/package-runtime/toast-presentation.d.ts +42 -0
- package/dist/types/shared/package-runtime/toast-swipe.d.cts +20 -0
- package/dist/types/shared/package-runtime/toast-swipe.d.ts +20 -0
- package/dist/types/shared/package-runtime/use-toast-stack.d.cts +22 -0
- package/dist/types/shared/package-runtime/use-toast-stack.d.ts +22 -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
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type NavigationBadge = string | number | boolean;
|
|
2
|
+
export declare const navigationBadgeMaximum = 99;
|
|
3
|
+
/** The text a count badge shows, or null when there is nothing to count. */
|
|
4
|
+
export declare function badgeCount(count: number | null | undefined, max?: number): string | null;
|
|
5
|
+
export declare function navigationBadge(badge: NavigationBadge | null | undefined, max?: number): {
|
|
6
|
+
dot: boolean;
|
|
7
|
+
text: string;
|
|
8
|
+
} | null;
|
|
9
|
+
/** What a badge says to a screen reader: "new" for a dot, the full count for a number, or its text; "" for none. */
|
|
10
|
+
export declare function badgeSpoken(badge: NavigationBadge | null | undefined, newContent: string, newCount?: (count: number) => string): string;
|
|
11
|
+
/** The destination's accessible name: its label, then what its badge says. */
|
|
12
|
+
export declare function navigationLabel(label: string, badge: NavigationBadge | null | undefined, newContent: string, newCount?: (count: number) => string): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type NavigationBadge = string | number | boolean;
|
|
2
|
+
export declare const navigationBadgeMaximum = 99;
|
|
3
|
+
/** The text a count badge shows, or null when there is nothing to count. */
|
|
4
|
+
export declare function badgeCount(count: number | null | undefined, max?: number): string | null;
|
|
5
|
+
export declare function navigationBadge(badge: NavigationBadge | null | undefined, max?: number): {
|
|
6
|
+
dot: boolean;
|
|
7
|
+
text: string;
|
|
8
|
+
} | null;
|
|
9
|
+
/** What a badge says to a screen reader: "new" for a dot, the full count for a number, or its text; "" for none. */
|
|
10
|
+
export declare function badgeSpoken(badge: NavigationBadge | null | undefined, newContent: string, newCount?: (count: number) => string): string;
|
|
11
|
+
/** The destination's accessible name: its label, then what its badge says. */
|
|
12
|
+
export declare function navigationLabel(label: string, badge: NavigationBadge | null | undefined, newContent: string, newCount?: (count: number) => string): string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare function useInitialTab(value: string, candidate: string | undefined, change: (name: string) => void): void;
|
|
2
2
|
export declare function useAccordionState(multiple: boolean): {
|
|
3
|
-
opened:
|
|
3
|
+
opened: ReadonlySet<string>;
|
|
4
4
|
toggle: (id: string) => void;
|
|
5
5
|
register: (id: string, defaultOpen: boolean) => () => void;
|
|
6
6
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare function useInitialTab(value: string, candidate: string | undefined, change: (name: string) => void): void;
|
|
2
2
|
export declare function useAccordionState(multiple: boolean): {
|
|
3
|
-
opened:
|
|
3
|
+
opened: ReadonlySet<string>;
|
|
4
4
|
toggle: (id: string) => void;
|
|
5
5
|
register: (id: string, defaultOpen: boolean) => () => void;
|
|
6
6
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface KjunSafeArea {
|
|
2
|
+
/** Top inset in px (status bar, notch). */
|
|
3
|
+
top?: number;
|
|
4
|
+
/** Bottom inset in px (home indicator). */
|
|
5
|
+
bottom?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface ResolvedSafeArea {
|
|
8
|
+
top: number;
|
|
9
|
+
bottom: number;
|
|
10
|
+
}
|
|
11
|
+
/** A provider's own values, else the parent's, never negative. */
|
|
12
|
+
export declare function resolveSafeArea(area?: KjunSafeArea, parent?: ResolvedSafeArea): ResolvedSafeArea;
|
|
13
|
+
/**
|
|
14
|
+
* Web: a provider that receives a safe area writes it as CSS variables; without one, components fall back to the
|
|
15
|
+
* browser's env(safe-area-inset-*) (which needs viewport-fit=cover). Nested providers inherit their parent's values.
|
|
16
|
+
*/
|
|
17
|
+
export declare function safeAreaVars(area?: KjunSafeArea): Record<string, string>;
|
|
18
|
+
/** The web inset for an edge component; safeArea={false} drops it where the app already reserved the space. */
|
|
19
|
+
export declare const webSafeTop: (on?: boolean) => "var(--_kjun-safe-area-top)" | "0px";
|
|
20
|
+
export declare const webSafeBottom: (on?: boolean) => "0px" | "var(--_kjun-safe-area-bottom)";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface KjunSafeArea {
|
|
2
|
+
/** Top inset in px (status bar, notch). */
|
|
3
|
+
top?: number;
|
|
4
|
+
/** Bottom inset in px (home indicator). */
|
|
5
|
+
bottom?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface ResolvedSafeArea {
|
|
8
|
+
top: number;
|
|
9
|
+
bottom: number;
|
|
10
|
+
}
|
|
11
|
+
/** A provider's own values, else the parent's, never negative. */
|
|
12
|
+
export declare function resolveSafeArea(area?: KjunSafeArea, parent?: ResolvedSafeArea): ResolvedSafeArea;
|
|
13
|
+
/**
|
|
14
|
+
* Web: a provider that receives a safe area writes it as CSS variables; without one, components fall back to the
|
|
15
|
+
* browser's env(safe-area-inset-*) (which needs viewport-fit=cover). Nested providers inherit their parent's values.
|
|
16
|
+
*/
|
|
17
|
+
export declare function safeAreaVars(area?: KjunSafeArea): Record<string, string>;
|
|
18
|
+
/** The web inset for an edge component; safeArea={false} drops it where the app already reserved the space. */
|
|
19
|
+
export declare const webSafeTop: (on?: boolean) => "var(--_kjun-safe-area-top)" | "0px";
|
|
20
|
+
export declare const webSafeBottom: (on?: boolean) => "0px" | "var(--_kjun-safe-area-bottom)";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type ScrollFadeDirection = "horizontal" | "vertical";
|
|
2
|
+
export interface ScrollEdges {
|
|
3
|
+
start: boolean;
|
|
4
|
+
end: boolean;
|
|
5
|
+
}
|
|
6
|
+
interface ScrollBox {
|
|
7
|
+
scrollLeft: number;
|
|
8
|
+
scrollTop: number;
|
|
9
|
+
clientWidth: number;
|
|
10
|
+
clientHeight: number;
|
|
11
|
+
scrollWidth: number;
|
|
12
|
+
scrollHeight: number;
|
|
13
|
+
}
|
|
14
|
+
/** Edges in reading order: in a right-to-left layout scrollLeft runs from 0 to negative and the start is on the right. */
|
|
15
|
+
export declare function scrollEdges(el: ScrollBox, direction: ScrollFadeDirection, rtl?: boolean): ScrollEdges;
|
|
16
|
+
export declare const sameEdges: (a: ScrollEdges, b: ScrollEdges) => boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Watches a scroller for anything that can move its edges: its size, its children's sizes, children added or
|
|
19
|
+
* removed, images loading late and web fonts arriving. Reports only when an edge changes.
|
|
20
|
+
*/
|
|
21
|
+
export declare function trackScrollFade(el: HTMLElement, direction: () => ScrollFadeDirection, onEdges: (edges: ScrollEdges) => void): {
|
|
22
|
+
update: () => void;
|
|
23
|
+
destroy: () => void;
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type ScrollFadeDirection = "horizontal" | "vertical";
|
|
2
|
+
export interface ScrollEdges {
|
|
3
|
+
start: boolean;
|
|
4
|
+
end: boolean;
|
|
5
|
+
}
|
|
6
|
+
interface ScrollBox {
|
|
7
|
+
scrollLeft: number;
|
|
8
|
+
scrollTop: number;
|
|
9
|
+
clientWidth: number;
|
|
10
|
+
clientHeight: number;
|
|
11
|
+
scrollWidth: number;
|
|
12
|
+
scrollHeight: number;
|
|
13
|
+
}
|
|
14
|
+
/** Edges in reading order: in a right-to-left layout scrollLeft runs from 0 to negative and the start is on the right. */
|
|
15
|
+
export declare function scrollEdges(el: ScrollBox, direction: ScrollFadeDirection, rtl?: boolean): ScrollEdges;
|
|
16
|
+
export declare const sameEdges: (a: ScrollEdges, b: ScrollEdges) => boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Watches a scroller for anything that can move its edges: its size, its children's sizes, children added or
|
|
19
|
+
* removed, images loading late and web fonts arriving. Reports only when an edge changes.
|
|
20
|
+
*/
|
|
21
|
+
export declare function trackScrollFade(el: HTMLElement, direction: () => ScrollFadeDirection, onEdges: (edges: ScrollEdges) => void): {
|
|
22
|
+
update: () => void;
|
|
23
|
+
destroy: () => void;
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type TypographyRole } from "@kjun-ui/tokens";
|
|
2
|
+
type Percent = `${number}%`;
|
|
3
|
+
/** A paragraph that does not look like every other one, with a short last line. */
|
|
4
|
+
export declare function skeletonTextWidths(rows: number): Percent[];
|
|
5
|
+
/** The web line box of a type role; without a role the line takes the surrounding text's line height. */
|
|
6
|
+
export declare function skeletonLineBox(role?: TypographyRole): string;
|
|
7
|
+
/**
|
|
8
|
+
* A negative animation delay that puts a skeleton mounted now on the same pulse as every other one,
|
|
9
|
+
* so skeletons that appear at different times still brighten and dim together.
|
|
10
|
+
*/
|
|
11
|
+
export declare function skeletonPhase(now?: number): string;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type TypographyRole } from "@kjun-ui/tokens";
|
|
2
|
+
type Percent = `${number}%`;
|
|
3
|
+
/** A paragraph that does not look like every other one, with a short last line. */
|
|
4
|
+
export declare function skeletonTextWidths(rows: number): Percent[];
|
|
5
|
+
/** The web line box of a type role; without a role the line takes the surrounding text's line height. */
|
|
6
|
+
export declare function skeletonLineBox(role?: TypographyRole): string;
|
|
7
|
+
/**
|
|
8
|
+
* A negative animation delay that puts a skeleton mounted now on the same pulse as every other one,
|
|
9
|
+
* so skeletons that appear at different times still brighten and dim together.
|
|
10
|
+
*/
|
|
11
|
+
export declare function skeletonPhase(now?: number): string;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export interface SparkPoint {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
}
|
|
5
|
+
export interface SparkBar {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
last: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface SparklineGeometry {
|
|
13
|
+
/** Unbroken runs of finite values; a run of one value is drawn as a dot. */
|
|
14
|
+
segments: SparkPoint[][];
|
|
15
|
+
/** Closed area polygons ("x,y x,y …") under each run of two or more points. */
|
|
16
|
+
areas: string[];
|
|
17
|
+
end?: SparkPoint;
|
|
18
|
+
baselineY?: number;
|
|
19
|
+
bars: SparkBar[];
|
|
20
|
+
/** Direction for the color: the last value against the baseline, or else the first value. */
|
|
21
|
+
direction: -1 | 0 | 1;
|
|
22
|
+
empty: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface SparklineOptions {
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
strokeWidth: number;
|
|
28
|
+
/** Token defaults; tests pass their own. */
|
|
29
|
+
dotRadius?: number;
|
|
30
|
+
barGap?: number;
|
|
31
|
+
barMinHeight?: number;
|
|
32
|
+
variant?: "line" | "bar";
|
|
33
|
+
baseline?: number;
|
|
34
|
+
min?: number;
|
|
35
|
+
max?: number;
|
|
36
|
+
endDot?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export declare function sparklineGeometry(data: readonly number[], options: SparklineOptions): SparklineGeometry;
|
|
39
|
+
/** One vertical range for every row of a column, so their sparklines compare on the same scale. */
|
|
40
|
+
export type SparklineTone = "text-tertiary" | "success" | "danger" | "price-up" | "price-down";
|
|
41
|
+
/** The color role for a direction: price up/down, or success/danger for status, and quiet when flat. */
|
|
42
|
+
export declare function sparklineTone(direction: -1 | 0 | 1, semantic?: "price" | "status"): SparklineTone;
|
|
43
|
+
/** The dash pattern for the empty line and the baseline. */
|
|
44
|
+
export declare const sparklineDash: () => string;
|
|
45
|
+
export declare function sparklineRange(series: readonly unknown[], baselines?: readonly unknown[]): {
|
|
46
|
+
min?: number;
|
|
47
|
+
max?: number;
|
|
48
|
+
};
|
|
49
|
+
export interface SparklineColumn {
|
|
50
|
+
key: string;
|
|
51
|
+
baselineKey?: string;
|
|
52
|
+
sharedRange?: boolean;
|
|
53
|
+
}
|
|
54
|
+
/** Sparkline props for one market row: its series, its reference value and (optionally) the column's shared range. */
|
|
55
|
+
export declare function sparklineCell<Row extends object>(rows: readonly Row[], row: Row, column: SparklineColumn, read: (row: Row, key: string) => unknown): {
|
|
56
|
+
data: number[];
|
|
57
|
+
baseline: number | undefined;
|
|
58
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export interface SparkPoint {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
}
|
|
5
|
+
export interface SparkBar {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
last: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface SparklineGeometry {
|
|
13
|
+
/** Unbroken runs of finite values; a run of one value is drawn as a dot. */
|
|
14
|
+
segments: SparkPoint[][];
|
|
15
|
+
/** Closed area polygons ("x,y x,y …") under each run of two or more points. */
|
|
16
|
+
areas: string[];
|
|
17
|
+
end?: SparkPoint;
|
|
18
|
+
baselineY?: number;
|
|
19
|
+
bars: SparkBar[];
|
|
20
|
+
/** Direction for the color: the last value against the baseline, or else the first value. */
|
|
21
|
+
direction: -1 | 0 | 1;
|
|
22
|
+
empty: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface SparklineOptions {
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
strokeWidth: number;
|
|
28
|
+
/** Token defaults; tests pass their own. */
|
|
29
|
+
dotRadius?: number;
|
|
30
|
+
barGap?: number;
|
|
31
|
+
barMinHeight?: number;
|
|
32
|
+
variant?: "line" | "bar";
|
|
33
|
+
baseline?: number;
|
|
34
|
+
min?: number;
|
|
35
|
+
max?: number;
|
|
36
|
+
endDot?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export declare function sparklineGeometry(data: readonly number[], options: SparklineOptions): SparklineGeometry;
|
|
39
|
+
/** One vertical range for every row of a column, so their sparklines compare on the same scale. */
|
|
40
|
+
export type SparklineTone = "text-tertiary" | "success" | "danger" | "price-up" | "price-down";
|
|
41
|
+
/** The color role for a direction: price up/down, or success/danger for status, and quiet when flat. */
|
|
42
|
+
export declare function sparklineTone(direction: -1 | 0 | 1, semantic?: "price" | "status"): SparklineTone;
|
|
43
|
+
/** The dash pattern for the empty line and the baseline. */
|
|
44
|
+
export declare const sparklineDash: () => string;
|
|
45
|
+
export declare function sparklineRange(series: readonly unknown[], baselines?: readonly unknown[]): {
|
|
46
|
+
min?: number;
|
|
47
|
+
max?: number;
|
|
48
|
+
};
|
|
49
|
+
export interface SparklineColumn {
|
|
50
|
+
key: string;
|
|
51
|
+
baselineKey?: string;
|
|
52
|
+
sharedRange?: boolean;
|
|
53
|
+
}
|
|
54
|
+
/** Sparkline props for one market row: its series, its reference value and (optionally) the column's shared range. */
|
|
55
|
+
export declare function sparklineCell<Row extends object>(rows: readonly Row[], row: Row, column: SparklineColumn, read: (row: Row, key: string) => unknown): {
|
|
56
|
+
data: number[];
|
|
57
|
+
baseline: number | undefined;
|
|
58
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type TableSummaryKind = "sum" | "count" | "average" | "min" | "max";
|
|
2
|
+
export interface TableRowGroup<Row extends object> {
|
|
3
|
+
key: string;
|
|
4
|
+
value: unknown;
|
|
5
|
+
rows: Row[];
|
|
6
|
+
}
|
|
7
|
+
/** Groups keep the order their first row appears in, so a sorted table sorts inside each group. */
|
|
8
|
+
export declare function groupTableRows<Row extends object>(rows: readonly Row[], groupBy?: string | null): TableRowGroup<Row>[] | null;
|
|
9
|
+
/** count counts rows; the other kinds read finite numbers only and give null when a column has none. */
|
|
10
|
+
export declare function summarizeColumn<Row extends object>(rows: readonly Row[], key: string, kind: TableSummaryKind): number | null;
|
|
11
|
+
export declare function formatSummary(value: number | null, kind: TableSummaryKind, locale?: string): string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type TableSummaryKind = "sum" | "count" | "average" | "min" | "max";
|
|
2
|
+
export interface TableRowGroup<Row extends object> {
|
|
3
|
+
key: string;
|
|
4
|
+
value: unknown;
|
|
5
|
+
rows: Row[];
|
|
6
|
+
}
|
|
7
|
+
/** Groups keep the order their first row appears in, so a sorted table sorts inside each group. */
|
|
8
|
+
export declare function groupTableRows<Row extends object>(rows: readonly Row[], groupBy?: string | null): TableRowGroup<Row>[] | null;
|
|
9
|
+
/** count counts rows; the other kinds read finite numbers only and give null when a column has none. */
|
|
10
|
+
export declare function summarizeColumn<Row extends object>(rows: readonly Row[], key: string, kind: TableSummaryKind): number | null;
|
|
11
|
+
export declare function formatSummary(value: number | null, kind: TableSummaryKind, locale?: string): string;
|
|
@@ -1,15 +1,38 @@
|
|
|
1
1
|
import type { TableSort } from "@kjun-ui/tokens";
|
|
2
2
|
export declare function getValue(row: object, key: string): unknown;
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* One ascending order for every column: dates by time, numbers numerically, text by the locale with numbers inside it
|
|
5
|
+
* ("item2" before "item10"), booleans false first. Empty values are left for the caller to put last.
|
|
6
|
+
*/
|
|
7
|
+
export declare function compareTableValues(x: unknown, y: unknown, locale?: string): number;
|
|
8
|
+
/** A column's own order for its cell values, replacing the shared one. */
|
|
9
|
+
export type TableCompare = (a: unknown, b: unknown) => number;
|
|
10
|
+
export declare function sortTableRows<Row extends object>(data: readonly Row[], sort: TableSort, { sortable, sortMode, compare, locale }: {
|
|
4
11
|
sortable?: boolean;
|
|
5
12
|
sortMode?: "client" | "server";
|
|
13
|
+
compare?: TableCompare;
|
|
14
|
+
locale?: string;
|
|
6
15
|
}): readonly Row[];
|
|
7
16
|
export declare const tableRowKey: (row: object, rowKey: string, index?: number) => string | number;
|
|
17
|
+
/** What tells rows apart for selection: the rowKey value, or the row object itself when it has none. */
|
|
18
|
+
export declare const tableRowIdentity: (row: object, rowKey: string) => unknown;
|
|
8
19
|
export declare function tableSelection<Row extends object>(rows: readonly Row[], selected: readonly Row[], rowKey: string): {
|
|
9
20
|
isSelected: (row: Row) => boolean;
|
|
10
21
|
all: boolean;
|
|
11
22
|
some: boolean;
|
|
12
23
|
};
|
|
13
24
|
export declare const toggleSelectedRow: <Row extends object>(selected: readonly Row[], row: Row, rowKey: string) => Row[];
|
|
14
|
-
|
|
25
|
+
/**
|
|
26
|
+
* The header checkbox: with every shown row selected it clears just those rows, otherwise it adds the shown rows
|
|
27
|
+
* that are missing. Rows selected on other pages or outside the current search stay selected.
|
|
28
|
+
*/
|
|
29
|
+
export declare function toggleAllRows<Row extends object>(rows: readonly Row[], selected: readonly Row[], rowKey: string, all: boolean): Row[];
|
|
30
|
+
/** Each row's position in the sorted rows, so grouped bodies need not search for it. */
|
|
31
|
+
export declare const tableRowIndex: <Row extends object>(rows: readonly Row[]) => (row: Row) => number;
|
|
15
32
|
export declare const toggleExpandedRow: (expanded: readonly (string | number)[], id: string | number, single: boolean) => (string | number)[];
|
|
33
|
+
/** A row's name for its checkbox: the title column's text ("행 선택 한빛테크"), or its position when that is not text. */
|
|
34
|
+
export declare function tableRowLabel(row: object, titleKey: string | undefined, index: number): string | number;
|
|
35
|
+
/** The scroller a page-level sticky header sticks under: the nearest scrolling ancestor, or the viewport (null). */
|
|
36
|
+
export declare function stickyScroller(element: Element | null): Element | null;
|
|
37
|
+
/** Whether rows have scrolled under a page-level sticky header, measured against its own scroller. */
|
|
38
|
+
export declare function stickyHeaderStuck(table: Element | null, offset: number): boolean;
|
|
@@ -1,15 +1,38 @@
|
|
|
1
1
|
import type { TableSort } from "@kjun-ui/tokens";
|
|
2
2
|
export declare function getValue(row: object, key: string): unknown;
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* One ascending order for every column: dates by time, numbers numerically, text by the locale with numbers inside it
|
|
5
|
+
* ("item2" before "item10"), booleans false first. Empty values are left for the caller to put last.
|
|
6
|
+
*/
|
|
7
|
+
export declare function compareTableValues(x: unknown, y: unknown, locale?: string): number;
|
|
8
|
+
/** A column's own order for its cell values, replacing the shared one. */
|
|
9
|
+
export type TableCompare = (a: unknown, b: unknown) => number;
|
|
10
|
+
export declare function sortTableRows<Row extends object>(data: readonly Row[], sort: TableSort, { sortable, sortMode, compare, locale }: {
|
|
4
11
|
sortable?: boolean;
|
|
5
12
|
sortMode?: "client" | "server";
|
|
13
|
+
compare?: TableCompare;
|
|
14
|
+
locale?: string;
|
|
6
15
|
}): readonly Row[];
|
|
7
16
|
export declare const tableRowKey: (row: object, rowKey: string, index?: number) => string | number;
|
|
17
|
+
/** What tells rows apart for selection: the rowKey value, or the row object itself when it has none. */
|
|
18
|
+
export declare const tableRowIdentity: (row: object, rowKey: string) => unknown;
|
|
8
19
|
export declare function tableSelection<Row extends object>(rows: readonly Row[], selected: readonly Row[], rowKey: string): {
|
|
9
20
|
isSelected: (row: Row) => boolean;
|
|
10
21
|
all: boolean;
|
|
11
22
|
some: boolean;
|
|
12
23
|
};
|
|
13
24
|
export declare const toggleSelectedRow: <Row extends object>(selected: readonly Row[], row: Row, rowKey: string) => Row[];
|
|
14
|
-
|
|
25
|
+
/**
|
|
26
|
+
* The header checkbox: with every shown row selected it clears just those rows, otherwise it adds the shown rows
|
|
27
|
+
* that are missing. Rows selected on other pages or outside the current search stay selected.
|
|
28
|
+
*/
|
|
29
|
+
export declare function toggleAllRows<Row extends object>(rows: readonly Row[], selected: readonly Row[], rowKey: string, all: boolean): Row[];
|
|
30
|
+
/** Each row's position in the sorted rows, so grouped bodies need not search for it. */
|
|
31
|
+
export declare const tableRowIndex: <Row extends object>(rows: readonly Row[]) => (row: Row) => number;
|
|
15
32
|
export declare const toggleExpandedRow: (expanded: readonly (string | number)[], id: string | number, single: boolean) => (string | number)[];
|
|
33
|
+
/** A row's name for its checkbox: the title column's text ("행 선택 한빛테크"), or its position when that is not text. */
|
|
34
|
+
export declare function tableRowLabel(row: object, titleKey: string | undefined, index: number): string | number;
|
|
35
|
+
/** The scroller a page-level sticky header sticks under: the nearest scrolling ancestor, or the viewport (null). */
|
|
36
|
+
export declare function stickyScroller(element: Element | null): Element | null;
|
|
37
|
+
/** Whether rows have scrolled under a page-level sticky header, measured against its own scroller. */
|
|
38
|
+
export declare function stickyHeaderStuck(table: Element | null, offset: number): boolean;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
import type { TableColumn, TableCardSection, TableProps, useTableModel } from "./table.cjs";
|
|
2
|
+
import type { TableColumn, TableCardSection, TableProps, TableSort, 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;
|
|
@@ -9,40 +13,89 @@ export declare function tablePresentation<Row extends object>(props: TableProps<
|
|
|
9
13
|
actions: TableColumn<Row> | undefined;
|
|
10
14
|
inline: TableColumn<Row>[];
|
|
11
15
|
sections: TableCardSection[];
|
|
16
|
+
highlight: TableColumn<Row> | undefined;
|
|
17
|
+
cardLayout: "rows" | "stacked" | "tiles";
|
|
18
|
+
tiles: boolean;
|
|
19
|
+
/** The actions column in the card's footer row (an inline one sits in the header instead). */
|
|
20
|
+
footerActions: TableColumn<Row> | undefined;
|
|
21
|
+
/** One footer row holds the expand toggle and the row actions. */
|
|
22
|
+
cardFooter: boolean;
|
|
23
|
+
/** A section's field arrangement: rows cards put every field on a label-value line. */
|
|
24
|
+
cardBody(section: TableCardSection): "metrics" | "grid" | "stack" | "rows";
|
|
12
25
|
columnsForSection(row: Row, section: TableCardSection): TableColumn<Row>[];
|
|
13
26
|
};
|
|
27
|
+
/** Narrow layouts have no header row to sort by, so the toolbar offers each sortable column in both orders. */
|
|
28
|
+
export declare function tableSortOptions<Row extends object>(props: TableProps<Row, unknown>, messages: {
|
|
29
|
+
defaultOrder: string;
|
|
30
|
+
ascending: string;
|
|
31
|
+
descending: string;
|
|
32
|
+
}): {
|
|
33
|
+
value: string;
|
|
34
|
+
label: string;
|
|
35
|
+
}[];
|
|
36
|
+
export declare const tableSortValue: (sort: TableSort) => string;
|
|
37
|
+
export declare function tableSortFromValue(value: unknown): TableSort;
|
|
14
38
|
export declare function columnFormat<Format>(column: {
|
|
15
39
|
key: string;
|
|
16
40
|
format?: Format;
|
|
17
41
|
}): Format | undefined;
|
|
18
|
-
|
|
42
|
+
/** locale is the KjunProvider locale, so numbers group the way the app's language does. */
|
|
43
|
+
export declare function tableCellValue<Row extends object>(props: TableProps<Row, unknown>, column: TableColumn<Row>, row: Row, index: number, locale?: string): {
|
|
19
44
|
value: unknown;
|
|
20
45
|
body: ReactNode;
|
|
21
46
|
};
|
|
47
|
+
/** A summary cell: the app's function, or the kind computed and shown through the column's format. */
|
|
48
|
+
export declare function tableSummaryValue<Row extends object>(props: TableProps<Row, unknown>, column: TableColumn<Row>, rows: Row[], locale?: string): ReactNode;
|
|
49
|
+
/** Narrow layouts keep the summary as one closing block: each summarized column's label and total. */
|
|
50
|
+
export interface TableTotal {
|
|
51
|
+
key: string;
|
|
52
|
+
label: string;
|
|
53
|
+
value: ReactNode;
|
|
54
|
+
}
|
|
55
|
+
export declare function tableTotals<Row extends object>(props: TableProps<Row, unknown>, rows: Row[], locale?: string): TableTotal[];
|
|
56
|
+
/** A group's accessible name: its label when that is text, else the grouped value. */
|
|
57
|
+
export declare function tableGroupName<Row extends object>(label: unknown, group: TableRowGroup<Row>): string;
|
|
58
|
+
export interface TableGroupingProps<Row extends object> {
|
|
59
|
+
groups: TableRowGroup<Row>[] | null;
|
|
60
|
+
collapsed: string[];
|
|
61
|
+
toggleGroup: (key: string) => void;
|
|
62
|
+
groupLabel: (group: TableRowGroup<Row>) => ReactNode;
|
|
63
|
+
summary: ((column: TableColumn<Row>, rows: Row[]) => ReactNode) | null;
|
|
64
|
+
}
|
|
65
|
+
/** 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";
|
|
22
67
|
export interface TableRowsProps<Row extends object> {
|
|
23
68
|
initialLoading: boolean;
|
|
24
69
|
skeletonRows: number;
|
|
25
70
|
/** A loadingDelay is still running: the skeleton keeps its space but stays out of sight. */
|
|
26
71
|
skeletonHidden?: boolean;
|
|
27
|
-
state: Pick<ReturnType<typeof useTableModel<Row>>, "rows" | "key" | "expanded" | "selectedRow">;
|
|
72
|
+
state: Pick<ReturnType<typeof useTableModel<Row>>, "rows" | "rowIndex" | "key" | "expanded" | "selectedRow">;
|
|
28
73
|
onRowClick: TableProps<Row>["onRowClick"];
|
|
29
74
|
selectable: boolean;
|
|
30
75
|
expandable: boolean;
|
|
31
76
|
checkbox: (row: Row, index: number) => ReactNode;
|
|
32
77
|
expand: (row: Row, index: number) => ReactNode;
|
|
33
|
-
cell: (column: TableColumn<Row>, row: Row, index: number, role?:
|
|
78
|
+
cell: (column: TableColumn<Row>, row: Row, index: number, role?: TableCellRole) => ReactNode;
|
|
34
79
|
renderExpand: TableProps<Row>["renderExpand"];
|
|
35
80
|
emptyContent: ReactNode;
|
|
36
81
|
emptyText: string;
|
|
37
82
|
}
|
|
38
83
|
export interface TableCardsProps<Row extends object> extends TableRowsProps<Row> {
|
|
39
84
|
layout: ReturnType<typeof tablePresentation<Row>>;
|
|
85
|
+
totals?: TableTotal[];
|
|
86
|
+
/** groupBy groups: each one opens with a header line (label, count and, with two or more rows, its subtotals) above its cards. */
|
|
87
|
+
groups?: TableRowGroup<Row>[] | null;
|
|
88
|
+
groupLabel?: (group: TableRowGroup<Row>) => ReactNode;
|
|
89
|
+
groupTotals?: (rows: Row[]) => TableTotal[];
|
|
90
|
+
/** The cell's plain text, for a value read out with its label where the label is not drawn (tile highlight on Native). */
|
|
91
|
+
cellText?: (column: TableColumn<Row>, row: Row, index: number) => string | undefined;
|
|
40
92
|
}
|
|
41
|
-
export interface TableGridProps<Row extends object, Height> extends TableRowsProps<Row> {
|
|
93
|
+
export interface TableGridProps<Row extends object, Height> extends TableRowsProps<Row>, TableGroupingProps<Row> {
|
|
42
94
|
state: TableRowsProps<Row>["state"] & Pick<ReturnType<typeof useTableModel<Row>>, "all" | "some" | "toggleAll" | "sort" | "sortColumn">;
|
|
43
95
|
visible: TableColumn<Row>[];
|
|
44
96
|
maxHeight?: Height;
|
|
45
97
|
stickyHeader: boolean;
|
|
98
|
+
stickyOffset?: number;
|
|
46
99
|
sortable?: boolean;
|
|
47
100
|
compact: boolean;
|
|
48
101
|
striped: boolean;
|
|
@@ -51,6 +104,8 @@ export interface TableGridProps<Row extends object, Height> extends TableRowsPro
|
|
|
51
104
|
export interface TableToolbarProps<Row extends object> {
|
|
52
105
|
selectable: boolean;
|
|
53
106
|
selected: Row[];
|
|
107
|
+
/** Every visible row is selected: the bar drops its select-all action. */
|
|
108
|
+
allSelected: boolean;
|
|
54
109
|
toggleAll: () => void;
|
|
55
110
|
clearSelection: () => void;
|
|
56
111
|
renderSelectionToolbar: TableProps<Row>["renderSelectionToolbar"];
|
|
@@ -59,4 +114,11 @@ export interface TableToolbarProps<Row extends object> {
|
|
|
59
114
|
searchChange: (value: string) => void;
|
|
60
115
|
searchPlaceholder: string;
|
|
61
116
|
toolbar: ReactNode;
|
|
117
|
+
/** Narrow layouts only: the sort choices (tableSortOptions), the chosen one and the change. */
|
|
118
|
+
sortOptions?: {
|
|
119
|
+
value: string;
|
|
120
|
+
label: string;
|
|
121
|
+
}[];
|
|
122
|
+
sortValue?: string;
|
|
123
|
+
sortChange?: (value: string) => void;
|
|
62
124
|
}
|