beez-ui 0.6.2 → 0.7.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/CHANGELOG.md +134 -98
- package/README.md +274 -263
- package/dist/components/alert.js +1 -1
- package/dist/components/avatar.d.ts +2 -1
- package/dist/components/avatar.js +4 -3
- package/dist/components/calendar.js +102 -0
- package/dist/components/carousel.js +61 -48
- package/dist/components/checkbox.js +1 -1
- package/dist/components/data-table.js +34 -4
- package/dist/components/dropdown-menu.js +5 -2
- package/dist/components/filter-query-bar.js +11 -6
- package/dist/components/form.d.ts +5 -0
- package/dist/components/form.js +11 -9
- package/dist/components/input-group.js +1 -1
- package/dist/components/input.js +1 -1
- package/dist/components/pagination.d.ts +1 -0
- package/dist/components/pagination.js +9 -4
- package/dist/components/radio-group.js +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/sheet.js +12 -9
- package/dist/components/sidebar.js +9 -5
- package/dist/components/skeleton.d.ts +6 -0
- package/dist/components/skeleton.js +7 -1
- package/dist/components/switch.js +1 -1
- package/dist/components/textarea.js +1 -1
- package/dist/components/typing-animation.js +42 -15
- package/dist/lib/column-filter-value.d.ts +12 -0
- package/dist/lib/column-filter-value.js +52 -0
- package/dist/motion/glide-indicator.d.ts +37 -3
- package/dist/motion/glide-indicator.js +37 -3
- package/dist/motion/motion-slot.js +47 -18
- package/dist/motion/surface-keyframes.js +18 -6
- package/dist/motion/tokens.d.ts +24 -1
- package/dist/motion/tokens.js +23 -0
- package/dist/providers/beez-ui-provider.js +49 -17
- package/dist/styles.css +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { MOTION_DIALOG_DISTANCE, MOTION_EASE, MOTION_SURFACE_CLIP_PERCENT, MOTION_SURFACE_SCALE, MOTION_TIMING, MOTION_TOOLTIP_DISTANCE, SPRING_PANEL, SPRING_TOOLTIP } from "./tokens.js";
|
|
1
|
+
import { MOTION_DIALOG_DISTANCE, MOTION_EASE, MOTION_EASE_DRAWER, MOTION_SURFACE_CLIP_BLEED_PX, MOTION_SURFACE_CLIP_PERCENT, MOTION_SURFACE_SCALE, MOTION_TIMING, MOTION_TOOLTIP_DISTANCE, SPRING_PANEL, SPRING_TOOLTIP } from "./tokens.js";
|
|
2
2
|
const EASE_OUT = [...MOTION_EASE];
|
|
3
|
+
const EASE_DRAWER = [...MOTION_EASE_DRAWER];
|
|
3
4
|
const SIDES = [
|
|
4
5
|
"top",
|
|
5
6
|
"right",
|
|
@@ -48,18 +49,25 @@ function offsetAwayFromTrigger(side, distance) {
|
|
|
48
49
|
y: 0
|
|
49
50
|
};
|
|
50
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Open edges extend the clip past the box, so the ring and drop shadow drawn outside it
|
|
54
|
+
* (Tailwind rings are box-shadows) are never cut while the surface reveals or settles.
|
|
55
|
+
*/
|
|
56
|
+
const OPEN_EDGE = `-${MOTION_SURFACE_CLIP_BLEED_PX}px`;
|
|
57
|
+
/** Fully revealed clip: nothing of the surface, its outline or its shadow is hidden. */
|
|
58
|
+
const REVEALED_CLIP = `inset(${OPEN_EDGE} ${OPEN_EDGE} ${OPEN_EDGE} ${OPEN_EDGE})`;
|
|
51
59
|
/** Collapsed clip anchored at the corner or edge closest to the trigger. */
|
|
52
60
|
function collapsedClip(side, align) {
|
|
53
61
|
const hidden = `${MOTION_SURFACE_CLIP_PERCENT}%`;
|
|
54
62
|
const half = `${MOTION_SURFACE_CLIP_PERCENT / 2}%`;
|
|
55
63
|
/** Maps an alignment to the inset kept on the leading and trailing edges of the cross axis. */
|
|
56
|
-
const crossAxis = (value) => value === "start" ? [
|
|
64
|
+
const crossAxis = (value) => value === "start" ? [OPEN_EDGE, hidden] : value === "end" ? [hidden, OPEN_EDGE] : [half, half];
|
|
57
65
|
if (side === "bottom" || side === "top") {
|
|
58
66
|
const [left, right] = crossAxis(align);
|
|
59
|
-
return side === "bottom" ? `inset(
|
|
67
|
+
return side === "bottom" ? `inset(${OPEN_EDGE} ${right} ${hidden} ${left})` : `inset(${hidden} ${right} ${OPEN_EDGE} ${left})`;
|
|
60
68
|
}
|
|
61
69
|
const [top, bottom] = crossAxis(align);
|
|
62
|
-
return side === "right" ? `inset(${top} ${hidden} ${bottom}
|
|
70
|
+
return side === "right" ? `inset(${top} ${hidden} ${bottom} ${OPEN_EDGE})` : `inset(${top} ${OPEN_EDGE} ${bottom} ${hidden})`;
|
|
63
71
|
}
|
|
64
72
|
/** Edge-panel travel: fully off-screen on the side the sheet is attached to. */
|
|
65
73
|
function sheetOffset(element) {
|
|
@@ -136,7 +144,7 @@ export function surfaceEnter(element, kind) {
|
|
|
136
144
|
};
|
|
137
145
|
// Primitives aligned over their trigger (Select item-aligned) have no side to reveal from.
|
|
138
146
|
if (side) {
|
|
139
|
-
keyframes.clipPath = [collapsedClip(side, align),
|
|
147
|
+
keyframes.clipPath = [collapsedClip(side, align), REVEALED_CLIP];
|
|
140
148
|
}
|
|
141
149
|
return {
|
|
142
150
|
keyframes,
|
|
@@ -190,9 +198,13 @@ export function surfaceExit(element, kind) {
|
|
|
190
198
|
}
|
|
191
199
|
if (kind === "sheet") {
|
|
192
200
|
const offset = sheetOffset(element);
|
|
201
|
+
// A spring would linger at the edge; the drawer curve accelerates the panel away.
|
|
193
202
|
return {
|
|
194
203
|
keyframes: { transform: [transform("0%", "0%"), transform(offset.x, offset.y)] },
|
|
195
|
-
transition:
|
|
204
|
+
transition: {
|
|
205
|
+
duration: MOTION_TIMING.sheetExit,
|
|
206
|
+
ease: EASE_DRAWER
|
|
207
|
+
}
|
|
196
208
|
};
|
|
197
209
|
}
|
|
198
210
|
return {
|
package/dist/motion/tokens.d.ts
CHANGED
|
@@ -16,6 +16,10 @@ export declare const MOTION_TIMING: {
|
|
|
16
16
|
readonly listStagger: 0.035;
|
|
17
17
|
readonly closeEnter: 0.2;
|
|
18
18
|
readonly closeDelay: 0.16;
|
|
19
|
+
readonly sheetExit: 0.24;
|
|
20
|
+
readonly reveal: 0.4;
|
|
21
|
+
readonly monthSwap: 0.24;
|
|
22
|
+
readonly cursorBlink: 1;
|
|
19
23
|
readonly skeleton: 1.8;
|
|
20
24
|
};
|
|
21
25
|
/** Items beyond this position share the last stagger delay, so long lists never lag behind. */
|
|
@@ -47,6 +51,13 @@ export declare const SPRING_LAYOUT: {
|
|
|
47
51
|
readonly damping: 32;
|
|
48
52
|
readonly mass: 0.6;
|
|
49
53
|
};
|
|
54
|
+
/** Keyboard highlight in menus and lists: quick enough to keep up with a held arrow key. */
|
|
55
|
+
export declare const SPRING_HIGHLIGHT: {
|
|
56
|
+
readonly type: "spring";
|
|
57
|
+
readonly stiffness: 700;
|
|
58
|
+
readonly damping: 45;
|
|
59
|
+
readonly mass: 0.5;
|
|
60
|
+
};
|
|
50
61
|
/** Tab indicator glide, tuned to settle without overshooting the list edges. */
|
|
51
62
|
export declare const SPRING_TABS: {
|
|
52
63
|
readonly type: "spring";
|
|
@@ -84,13 +95,25 @@ export declare const MOTION_ITEM_CHECK_SCALE = 0.75;
|
|
|
84
95
|
export declare const MOTION_ICON_SWAP_SCALE = 0.25;
|
|
85
96
|
export declare const MOTION_CLOSE_BUTTON_SCALE = 0.8;
|
|
86
97
|
export declare const MOTION_LIST_ITEM_DISTANCE = 6;
|
|
98
|
+
/** Loaded images settle from a slight zoom, so they develop in place instead of popping in. */
|
|
99
|
+
export declare const MOTION_REVEAL_SCALE = 1.06;
|
|
100
|
+
export declare const MOTION_REVEAL_BLUR_PX = 6;
|
|
101
|
+
/** Calendar months slide just enough to show the direction of navigation. */
|
|
102
|
+
export declare const MOTION_MONTH_DISTANCE = 12;
|
|
103
|
+
/** Skeleton shine travels from fully before the box to fully past it, as a `translate` value. */
|
|
104
|
+
export declare const MOTION_SHIMMER_TRANSLATE: readonly ["-100% 0", "100% 0"];
|
|
105
|
+
/** Hovered interactive cards gain a soft drop shadow; the rest value has the same shape, invisible. */
|
|
106
|
+
export declare const MOTION_CARD_SHADOW_LIFT = "0px 4px 16px 0px rgba(0, 0, 0, 0.08)";
|
|
107
|
+
export declare const MOTION_CARD_SHADOW_REST = "0px 0px 0px 0px rgba(0, 0, 0, 0)";
|
|
87
108
|
export declare const MOTION_SURFACE_SCALE = 0.96;
|
|
88
109
|
/** Fraction of the surface kept hidden by the clip at the start of its reveal, in percent. */
|
|
89
110
|
export declare const MOTION_SURFACE_CLIP_PERCENT = 92;
|
|
111
|
+
/** Room left outside a revealing surface for its ring and drop shadow (`shadow-lg` spans ~22px). */
|
|
112
|
+
export declare const MOTION_SURFACE_CLIP_BLEED_PX = 24;
|
|
90
113
|
export declare const MOTION_TOOLTIP_DISTANCE = 8;
|
|
91
114
|
export declare const MOTION_DIALOG_DISTANCE = 20;
|
|
92
115
|
export declare const MOTION_CONTENT_DISTANCE = 4;
|
|
93
116
|
export declare const MOTION_INVALID_SHAKE_PX: readonly [0, -6, 6, -4, 4, -2, 0];
|
|
94
117
|
/** Time after an item loses its active state during which a new active item still glides from it. */
|
|
95
118
|
export declare const GLIDE_CONTINUITY_MS = 300;
|
|
96
|
-
export type MotionKind = "press" | "subtle-press" | "toggle" | "fade" | "content" | "message" | "card" | "row" | "field" | "thumb" | "check" | "selection" | "item-check" | "rotate" | "list-item" | "icon-swap" | "delayed-pop" | "skeleton" | "link" | "icon" | "tooltip" | "surface" | "dialog" | "sheet" | "overlay";
|
|
119
|
+
export type MotionKind = "press" | "subtle-press" | "toggle" | "fade" | "content" | "message" | "card" | "row" | "field" | "thumb" | "check" | "selection" | "item-check" | "rotate" | "list-item" | "icon-swap" | "delayed-pop" | "skeleton" | "reveal" | "link" | "icon" | "tooltip" | "surface" | "dialog" | "sheet" | "overlay";
|
package/dist/motion/tokens.js
CHANGED
|
@@ -16,6 +16,10 @@ export const MOTION_TIMING = {
|
|
|
16
16
|
listStagger: .035,
|
|
17
17
|
closeEnter: .2,
|
|
18
18
|
closeDelay: .16,
|
|
19
|
+
sheetExit: .24,
|
|
20
|
+
reveal: .4,
|
|
21
|
+
monthSwap: .24,
|
|
22
|
+
cursorBlink: 1,
|
|
19
23
|
skeleton: 1.8
|
|
20
24
|
};
|
|
21
25
|
/** Items beyond this position share the last stagger delay, so long lists never lag behind. */
|
|
@@ -62,6 +66,13 @@ export const SPRING_LAYOUT = {
|
|
|
62
66
|
damping: 32,
|
|
63
67
|
mass: .6
|
|
64
68
|
};
|
|
69
|
+
/** Keyboard highlight in menus and lists: quick enough to keep up with a held arrow key. */
|
|
70
|
+
export const SPRING_HIGHLIGHT = {
|
|
71
|
+
type: "spring",
|
|
72
|
+
stiffness: 700,
|
|
73
|
+
damping: 45,
|
|
74
|
+
mass: .5
|
|
75
|
+
};
|
|
65
76
|
/** Tab indicator glide, tuned to settle without overshooting the list edges. */
|
|
66
77
|
export const SPRING_TABS = {
|
|
67
78
|
type: "spring",
|
|
@@ -99,9 +110,21 @@ export const MOTION_ITEM_CHECK_SCALE = .75;
|
|
|
99
110
|
export const MOTION_ICON_SWAP_SCALE = .25;
|
|
100
111
|
export const MOTION_CLOSE_BUTTON_SCALE = .8;
|
|
101
112
|
export const MOTION_LIST_ITEM_DISTANCE = 6;
|
|
113
|
+
/** Loaded images settle from a slight zoom, so they develop in place instead of popping in. */
|
|
114
|
+
export const MOTION_REVEAL_SCALE = 1.06;
|
|
115
|
+
export const MOTION_REVEAL_BLUR_PX = 6;
|
|
116
|
+
/** Calendar months slide just enough to show the direction of navigation. */
|
|
117
|
+
export const MOTION_MONTH_DISTANCE = 12;
|
|
118
|
+
/** Skeleton shine travels from fully before the box to fully past it, as a `translate` value. */
|
|
119
|
+
export const MOTION_SHIMMER_TRANSLATE = ["-100% 0", "100% 0"];
|
|
120
|
+
/** Hovered interactive cards gain a soft drop shadow; the rest value has the same shape, invisible. */
|
|
121
|
+
export const MOTION_CARD_SHADOW_LIFT = "0px 4px 16px 0px rgba(0, 0, 0, 0.08)";
|
|
122
|
+
export const MOTION_CARD_SHADOW_REST = "0px 0px 0px 0px rgba(0, 0, 0, 0)";
|
|
102
123
|
export const MOTION_SURFACE_SCALE = .96;
|
|
103
124
|
/** Fraction of the surface kept hidden by the clip at the start of its reveal, in percent. */
|
|
104
125
|
export const MOTION_SURFACE_CLIP_PERCENT = 92;
|
|
126
|
+
/** Room left outside a revealing surface for its ring and drop shadow (`shadow-lg` spans ~22px). */
|
|
127
|
+
export const MOTION_SURFACE_CLIP_BLEED_PX = 24;
|
|
105
128
|
export const MOTION_TOOLTIP_DISTANCE = 8;
|
|
106
129
|
export const MOTION_DIALOG_DISTANCE = 20;
|
|
107
130
|
export const MOTION_CONTENT_DISTANCE = 4;
|
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { c as _c } from "react/compiler-runtime";
|
|
3
3
|
/** Shares optional rendering adapters without importing a framework into the core. */
|
|
4
|
-
import { createContext, useContext } from "react";
|
|
4
|
+
import { createContext, useContext, useSyncExternalStore } from "react";
|
|
5
5
|
import { MotionConfig } from "motion/react";
|
|
6
6
|
import { ThemeProvider } from "next-themes";
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
/**
|
|
9
|
+
* next-themes renders an inline script that applies the stored theme before hydration. It only
|
|
10
|
+
* runs when it arrives in server HTML; a script created by a client render never executes, and
|
|
11
|
+
* React 19 warns about it. Client-only renders mark it as a data block, which React accepts.
|
|
12
|
+
*/
|
|
13
|
+
const CLIENT_RENDER_THEME_SCRIPT_PROPS = { type: "application/json" };
|
|
14
|
+
/** Nothing to subscribe to: the value only distinguishes server/hydration from client renders. */
|
|
15
|
+
function subscribeToRenderEnvironment() {
|
|
16
|
+
return () => {};
|
|
17
|
+
}
|
|
8
18
|
/** Native elements remain the implicit fallback for unconfigured adapters. */
|
|
9
19
|
const EMPTY_COMPONENTS = {};
|
|
10
20
|
const AdapterContext = createContext(EMPTY_COMPONENTS);
|
|
11
21
|
/** Merges nested overrides while preserving stable adapter identities. */
|
|
12
22
|
export function BeezUIProvider(t0) {
|
|
13
|
-
const $ = _c(
|
|
23
|
+
const $ = _c(13);
|
|
14
24
|
const { children, components: t1, themeOptions } = t0;
|
|
15
25
|
const components = t1 === undefined ? EMPTY_COMPONENTS : t1;
|
|
16
26
|
const parent = useContext(AdapterContext);
|
|
@@ -27,35 +37,57 @@ export function BeezUIProvider(t0) {
|
|
|
27
37
|
t2 = $[2];
|
|
28
38
|
}
|
|
29
39
|
const value = t2;
|
|
40
|
+
const isClientOnlyRender = useSyncExternalStore(subscribeToRenderEnvironment, _temp, _temp2);
|
|
30
41
|
let t3;
|
|
31
|
-
if ($[3] !==
|
|
32
|
-
t3 =
|
|
42
|
+
if ($[3] !== isClientOnlyRender || $[4] !== themeOptions?.scriptProps) {
|
|
43
|
+
t3 = isClientOnlyRender ? {
|
|
44
|
+
...CLIENT_RENDER_THEME_SCRIPT_PROPS,
|
|
45
|
+
...themeOptions?.scriptProps
|
|
46
|
+
} : themeOptions?.scriptProps;
|
|
47
|
+
$[3] = isClientOnlyRender;
|
|
48
|
+
$[4] = themeOptions?.scriptProps;
|
|
49
|
+
$[5] = t3;
|
|
50
|
+
} else {
|
|
51
|
+
t3 = $[5];
|
|
52
|
+
}
|
|
53
|
+
const scriptProps = t3;
|
|
54
|
+
let t4;
|
|
55
|
+
if ($[6] !== children || $[7] !== value) {
|
|
56
|
+
t4 = /* @__PURE__ */ _jsx(MotionConfig, {
|
|
33
57
|
reducedMotion: "user",
|
|
34
58
|
children: /* @__PURE__ */ _jsx(AdapterContext.Provider, {
|
|
35
59
|
value,
|
|
36
60
|
children
|
|
37
61
|
})
|
|
38
62
|
});
|
|
39
|
-
$[
|
|
40
|
-
$[
|
|
41
|
-
$[
|
|
63
|
+
$[6] = children;
|
|
64
|
+
$[7] = value;
|
|
65
|
+
$[8] = t4;
|
|
42
66
|
} else {
|
|
43
|
-
|
|
67
|
+
t4 = $[8];
|
|
44
68
|
}
|
|
45
|
-
let
|
|
46
|
-
if ($[
|
|
47
|
-
|
|
69
|
+
let t5;
|
|
70
|
+
if ($[9] !== scriptProps || $[10] !== t4 || $[11] !== themeOptions) {
|
|
71
|
+
t5 = /* @__PURE__ */ _jsx(ThemeProvider, {
|
|
48
72
|
attribute: "class",
|
|
49
73
|
...themeOptions,
|
|
50
|
-
|
|
74
|
+
scriptProps,
|
|
75
|
+
children: t4
|
|
51
76
|
});
|
|
52
|
-
$[
|
|
53
|
-
$[
|
|
54
|
-
$[
|
|
77
|
+
$[9] = scriptProps;
|
|
78
|
+
$[10] = t4;
|
|
79
|
+
$[11] = themeOptions;
|
|
80
|
+
$[12] = t5;
|
|
55
81
|
} else {
|
|
56
|
-
|
|
82
|
+
t5 = $[12];
|
|
57
83
|
}
|
|
58
|
-
return
|
|
84
|
+
return t5;
|
|
85
|
+
}
|
|
86
|
+
function _temp2() {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
function _temp() {
|
|
90
|
+
return true;
|
|
59
91
|
}
|
|
60
92
|
/** Reads adapters internally; native components work without a provider. */
|
|
61
93
|
export function useBeezUIComponents() {
|