@kjun-ui/react 0.18.0 → 0.20.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 +2285 -1322
- package/dist/index.js +2362 -1397
- package/dist/styles.css +770 -471
- package/dist/types/packages/react/src/app-navigation.d.cts +12 -8
- package/dist/types/packages/react/src/app-navigation.d.ts +12 -8
- package/dist/types/packages/react/src/display.d.cts +8 -2
- package/dist/types/packages/react/src/display.d.ts +8 -2
- 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/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/index.d.cts +2 -0
- package/dist/types/packages/react/src/index.d.ts +2 -0
- 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 +1 -1
- package/dist/types/packages/react/src/list.d.ts +1 -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/provider.d.cts +4 -1
- package/dist/types/packages/react/src/provider.d.ts +4 -1
- 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/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-list.d.cts +2 -6
- package/dist/types/packages/react/src/table-list.d.ts +2 -6
- package/dist/types/packages/react/src/table-model.d.cts +1 -0
- package/dist/types/packages/react/src/table-model.d.ts +1 -0
- package/dist/types/packages/react/src/table-toolbar.d.cts +1 -1
- package/dist/types/packages/react/src/table-toolbar.d.ts +1 -1
- package/dist/types/packages/react/src/table-totals.d.cts +5 -0
- package/dist/types/packages/react/src/table-totals.d.ts +5 -0
- 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/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/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 +7 -0
- package/dist/types/shared/package-runtime/messages/ko.d.ts +7 -0
- package/dist/types/shared/package-runtime/messages-context.d.cts +7 -0
- package/dist/types/shared/package-runtime/messages-context.d.ts +7 -0
- 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/skeleton-text.d.cts +12 -0
- package/dist/types/shared/package-runtime/skeleton-text.d.ts +12 -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/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 +9 -0
- package/dist/types/shared/package-runtime/table-groups.d.ts +9 -0
- package/dist/types/shared/package-runtime/table-presentation.d.cts +40 -2
- package/dist/types/shared/package-runtime/table-presentation.d.ts +40 -2
- package/dist/types/shared/package-runtime/table.d.cts +9 -0
- package/dist/types/shared/package-runtime/table.d.ts +9 -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-table-group-expansion.d.cts +6 -0
- package/dist/types/shared/package-runtime/use-table-group-expansion.d.ts +6 -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
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** Toasts that arrive within one stack move of the last arrival wait for it to finish, then enter together, so a burst
|
|
2
|
+
* shifts the stack once instead of once per toast. Returns how long the newest arrivals still wait (0 = none). */
|
|
3
|
+
export declare function toastEntryDelay(lastEntry: number, now: number, reduced: boolean): number;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Where KjunFeedbackProvider stacks toasts: the top (default) or the bottom of the screen, right-aligned on wide web. */
|
|
2
|
+
export type ToastPlacement = "top" | "bottom";
|
|
3
|
+
/** Toasts enter from, and leave toward, their screen edge. */
|
|
4
|
+
export declare const toastEdgeShift: (placement?: ToastPlacement) => number;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Where KjunFeedbackProvider stacks toasts: the top (default) or the bottom of the screen, right-aligned on wide web. */
|
|
2
|
+
export type ToastPlacement = "top" | "bottom";
|
|
3
|
+
/** Toasts enter from, and leave toward, their screen edge. */
|
|
4
|
+
export declare const toastEdgeShift: (placement?: ToastPlacement) => number;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ToastItem } from "@kjun-ui/tokens";
|
|
2
|
+
export interface PresentedToast {
|
|
3
|
+
toast: ToastItem;
|
|
4
|
+
exiting: boolean;
|
|
5
|
+
born: number;
|
|
6
|
+
}
|
|
7
|
+
/** What the stacks draw from the controller's toasts: a leaving toast stays for its exit motion, and toasts that
|
|
8
|
+
* arrive within one stack move of the last arrival wait, then enter together. Framework wrappers only call sync. */
|
|
9
|
+
export declare function createToastPresence(publish: (items: PresentedToast[]) => void): {
|
|
10
|
+
sync: (toasts: ToastItem[], reduced: boolean) => void;
|
|
11
|
+
destroy(): void;
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ToastItem } from "@kjun-ui/tokens";
|
|
2
|
+
export interface PresentedToast {
|
|
3
|
+
toast: ToastItem;
|
|
4
|
+
exiting: boolean;
|
|
5
|
+
born: number;
|
|
6
|
+
}
|
|
7
|
+
/** What the stacks draw from the controller's toasts: a leaving toast stays for its exit motion, and toasts that
|
|
8
|
+
* arrive within one stack move of the last arrival wait, then enter together. Framework wrappers only call sync. */
|
|
9
|
+
export declare function createToastPresence(publish: (items: PresentedToast[]) => void): {
|
|
10
|
+
sync: (toasts: ToastItem[], reduced: boolean) => void;
|
|
11
|
+
destroy(): void;
|
|
12
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type ToastItem } from "@kjun-ui/tokens";
|
|
2
|
+
export type ToastTone = "success" | "warning" | "danger" | "info";
|
|
3
|
+
/** What every platform draws for one toast; the views only render it. */
|
|
4
|
+
export declare function toastPresentation(toast: ToastItem): {
|
|
5
|
+
tone: ToastTone;
|
|
6
|
+
icon: string;
|
|
7
|
+
compact: boolean;
|
|
8
|
+
closable: boolean;
|
|
9
|
+
sideAction: boolean;
|
|
10
|
+
role: "alert" | "status";
|
|
11
|
+
live: "assertive" | "polite";
|
|
12
|
+
spoken: string;
|
|
13
|
+
};
|
|
14
|
+
/** A horizontal swipe past this distance closes the toast; a shorter one springs back. */
|
|
15
|
+
export declare const toastSwipeDistance: () => 64;
|
|
16
|
+
/** Swipe progress as the card's fade: fully visible at rest, half faded at the closing distance. */
|
|
17
|
+
export declare const toastSwipeOpacity: (dx: number) => number;
|
|
18
|
+
/** Order on screen, nearest the edge toasts enter from first: capsules, then cards, each newest first.
|
|
19
|
+
* The bottom placement mirrors it so the newest stays nearest its own edge. */
|
|
20
|
+
export declare function orderToasts<T extends {
|
|
21
|
+
toast: ToastItem;
|
|
22
|
+
}>(items: T[], placement?: "top" | "bottom"): T[];
|
|
23
|
+
export interface ToastStackItem {
|
|
24
|
+
toast: ToastItem;
|
|
25
|
+
exiting: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** What a stack draws. Toasts waiting beyond maxToasts are counted, not drawn, until the stack is expanded. On a narrow
|
|
28
|
+
* screen several toasts also fold behind one front card (the newest danger toast, else the newest). */
|
|
29
|
+
export declare function toastStackLayout<T extends ToastStackItem>(items: T[], { placement, narrow, expanded }: {
|
|
30
|
+
placement?: "top" | "bottom";
|
|
31
|
+
narrow?: boolean;
|
|
32
|
+
expanded?: boolean;
|
|
33
|
+
}): {
|
|
34
|
+
items: T[];
|
|
35
|
+
folded: boolean;
|
|
36
|
+
behind: number;
|
|
37
|
+
toggle: boolean;
|
|
38
|
+
uniform: boolean;
|
|
39
|
+
unseen: T[];
|
|
40
|
+
};
|
|
41
|
+
/** Card edges drawn behind the stack's last card: one per waiting toast, at most two. */
|
|
42
|
+
export declare const toastPeekDepth: (behind: number) => number;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type ToastItem } from "@kjun-ui/tokens";
|
|
2
|
+
export type ToastTone = "success" | "warning" | "danger" | "info";
|
|
3
|
+
/** What every platform draws for one toast; the views only render it. */
|
|
4
|
+
export declare function toastPresentation(toast: ToastItem): {
|
|
5
|
+
tone: ToastTone;
|
|
6
|
+
icon: string;
|
|
7
|
+
compact: boolean;
|
|
8
|
+
closable: boolean;
|
|
9
|
+
sideAction: boolean;
|
|
10
|
+
role: "alert" | "status";
|
|
11
|
+
live: "assertive" | "polite";
|
|
12
|
+
spoken: string;
|
|
13
|
+
};
|
|
14
|
+
/** A horizontal swipe past this distance closes the toast; a shorter one springs back. */
|
|
15
|
+
export declare const toastSwipeDistance: () => 64;
|
|
16
|
+
/** Swipe progress as the card's fade: fully visible at rest, half faded at the closing distance. */
|
|
17
|
+
export declare const toastSwipeOpacity: (dx: number) => number;
|
|
18
|
+
/** Order on screen, nearest the edge toasts enter from first: capsules, then cards, each newest first.
|
|
19
|
+
* The bottom placement mirrors it so the newest stays nearest its own edge. */
|
|
20
|
+
export declare function orderToasts<T extends {
|
|
21
|
+
toast: ToastItem;
|
|
22
|
+
}>(items: T[], placement?: "top" | "bottom"): T[];
|
|
23
|
+
export interface ToastStackItem {
|
|
24
|
+
toast: ToastItem;
|
|
25
|
+
exiting: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** What a stack draws. Toasts waiting beyond maxToasts are counted, not drawn, until the stack is expanded. On a narrow
|
|
28
|
+
* screen several toasts also fold behind one front card (the newest danger toast, else the newest). */
|
|
29
|
+
export declare function toastStackLayout<T extends ToastStackItem>(items: T[], { placement, narrow, expanded }: {
|
|
30
|
+
placement?: "top" | "bottom";
|
|
31
|
+
narrow?: boolean;
|
|
32
|
+
expanded?: boolean;
|
|
33
|
+
}): {
|
|
34
|
+
items: T[];
|
|
35
|
+
folded: boolean;
|
|
36
|
+
behind: number;
|
|
37
|
+
toggle: boolean;
|
|
38
|
+
uniform: boolean;
|
|
39
|
+
unseen: T[];
|
|
40
|
+
};
|
|
41
|
+
/** Card edges drawn behind the stack's last card: one per waiting toast, at most two. */
|
|
42
|
+
export declare const toastPeekDepth: (behind: number) => number;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Touch and pen swipes sideways on a web toast: past the distance it closes, short of it the card springs back.
|
|
2
|
+
* Vertical moves stay page scrolls, and presses on its buttons stay presses. */
|
|
3
|
+
export declare function attachToastSwipe(card: HTMLElement, { hold, release, close }: {
|
|
4
|
+
hold(): void;
|
|
5
|
+
release(): void;
|
|
6
|
+
close(): void;
|
|
7
|
+
}): () => void;
|
|
8
|
+
/** Focus returns to where it was when the toast appeared, but only if it is inside the leaving toast. */
|
|
9
|
+
export declare function restoreToastFocus(surface: HTMLElement | null, previous: Element | null): void;
|
|
10
|
+
/** The whole web stack holds still while a mouse pointer or focus is on any of its toasts, so cards never move under
|
|
11
|
+
* the hand reaching for them. Touch is left out: a tap sends no pointer-leave until the next tap elsewhere, which would
|
|
12
|
+
* freeze the stack. A press outside the stack calls `outside`, and Escape inside it calls `escape` (both fold it). */
|
|
13
|
+
export declare function attachToastStack(root: HTMLElement, { hold, release, outside, escape }: {
|
|
14
|
+
hold(reason: "pointer" | "focus"): void;
|
|
15
|
+
release(reason: "pointer" | "focus"): void;
|
|
16
|
+
outside(): void;
|
|
17
|
+
escape(): boolean;
|
|
18
|
+
}): () => void;
|
|
19
|
+
/** A swipe that closes a card carries it on in the swipe's direction instead of the usual exit toward the edge. */
|
|
20
|
+
export declare function flingToast(card: HTMLElement, dx: number): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Touch and pen swipes sideways on a web toast: past the distance it closes, short of it the card springs back.
|
|
2
|
+
* Vertical moves stay page scrolls, and presses on its buttons stay presses. */
|
|
3
|
+
export declare function attachToastSwipe(card: HTMLElement, { hold, release, close }: {
|
|
4
|
+
hold(): void;
|
|
5
|
+
release(): void;
|
|
6
|
+
close(): void;
|
|
7
|
+
}): () => void;
|
|
8
|
+
/** Focus returns to where it was when the toast appeared, but only if it is inside the leaving toast. */
|
|
9
|
+
export declare function restoreToastFocus(surface: HTMLElement | null, previous: Element | null): void;
|
|
10
|
+
/** The whole web stack holds still while a mouse pointer or focus is on any of its toasts, so cards never move under
|
|
11
|
+
* the hand reaching for them. Touch is left out: a tap sends no pointer-leave until the next tap elsewhere, which would
|
|
12
|
+
* freeze the stack. A press outside the stack calls `outside`, and Escape inside it calls `escape` (both fold it). */
|
|
13
|
+
export declare function attachToastStack(root: HTMLElement, { hold, release, outside, escape }: {
|
|
14
|
+
hold(reason: "pointer" | "focus"): void;
|
|
15
|
+
release(reason: "pointer" | "focus"): void;
|
|
16
|
+
outside(): void;
|
|
17
|
+
escape(): boolean;
|
|
18
|
+
}): () => void;
|
|
19
|
+
/** A swipe that closes a card carries it on in the swipe's direction instead of the usual exit toward the edge. */
|
|
20
|
+
export declare function flingToast(card: HTMLElement, dx: number): void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type TableRowGroup } from "./table-groups.cjs";
|
|
2
|
+
/** Shared React/Native state; Vue uses the same framework-free transition rules. */
|
|
3
|
+
export declare function useTableGroupExpansion<Row extends object>(groups: TableRowGroup<Row>[] | null, groupBy: string | undefined, expanded: unknown[] | undefined, onChange: ((values: unknown[]) => void) | undefined): {
|
|
4
|
+
collapsed: string[];
|
|
5
|
+
toggleGroup(key: string): void;
|
|
6
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type TableRowGroup } from "./table-groups.js";
|
|
2
|
+
/** Shared React/Native state; Vue uses the same framework-free transition rules. */
|
|
3
|
+
export declare function useTableGroupExpansion<Row extends object>(groups: TableRowGroup<Row>[] | null, groupBy: string | undefined, expanded: unknown[] | undefined, onChange: ((values: unknown[]) => void) | undefined): {
|
|
4
|
+
collapsed: string[];
|
|
5
|
+
toggleGroup(key: string): void;
|
|
6
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { createFeedbackController } from "@kjun-ui/tokens";
|
|
2
|
+
import type { PresentedToast } from "./toast-presence.cjs";
|
|
3
|
+
type Controller = ReturnType<typeof createFeedbackController>;
|
|
4
|
+
/** Stack state shared by the React and Native stacks: what to draw, whether it is expanded, and what screen readers
|
|
5
|
+
* should hear about toasts that are folded or waiting and so have no card of their own to announce them. */
|
|
6
|
+
export declare function useToastStack(items: PresentedToast[], controller: Controller, { placement, narrow }: {
|
|
7
|
+
placement: "top" | "bottom";
|
|
8
|
+
narrow: boolean;
|
|
9
|
+
}): {
|
|
10
|
+
stack: {
|
|
11
|
+
items: PresentedToast[];
|
|
12
|
+
folded: boolean;
|
|
13
|
+
behind: number;
|
|
14
|
+
toggle: boolean;
|
|
15
|
+
uniform: boolean;
|
|
16
|
+
unseen: PresentedToast[];
|
|
17
|
+
};
|
|
18
|
+
expanded: boolean;
|
|
19
|
+
setExpanded: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
20
|
+
announcement: string;
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { createFeedbackController } from "@kjun-ui/tokens";
|
|
2
|
+
import type { PresentedToast } from "./toast-presence.js";
|
|
3
|
+
type Controller = ReturnType<typeof createFeedbackController>;
|
|
4
|
+
/** Stack state shared by the React and Native stacks: what to draw, whether it is expanded, and what screen readers
|
|
5
|
+
* should hear about toasts that are folded or waiting and so have no card of their own to announce them. */
|
|
6
|
+
export declare function useToastStack(items: PresentedToast[], controller: Controller, { placement, narrow }: {
|
|
7
|
+
placement: "top" | "bottom";
|
|
8
|
+
narrow: boolean;
|
|
9
|
+
}): {
|
|
10
|
+
stack: {
|
|
11
|
+
items: PresentedToast[];
|
|
12
|
+
folded: boolean;
|
|
13
|
+
behind: number;
|
|
14
|
+
toggle: boolean;
|
|
15
|
+
uniform: boolean;
|
|
16
|
+
unseen: PresentedToast[];
|
|
17
|
+
};
|
|
18
|
+
expanded: boolean;
|
|
19
|
+
setExpanded: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
20
|
+
announcement: string;
|
|
21
|
+
};
|
|
22
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kjun-ui/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://ui.kjun.dev",
|
|
6
6
|
"repository": {
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"./package.json": "./package.json"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@kjun-ui/tokens": "0.
|
|
44
|
+
"@kjun-ui/tokens": "0.20.0",
|
|
45
45
|
"react-aria-components": "1.21.1",
|
|
46
|
-
"@kjun-ui/icons": "0.
|
|
46
|
+
"@kjun-ui/icons": "0.20.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"react": "^19.2.3",
|