@rinzai/zen 0.9.0 → 0.10.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/animated-number/index.d.ts +6 -2
- package/dist/animated-number/index.d.ts.map +1 -1
- package/dist/animated-number/index.js +68 -17
- package/dist/calendar-heatmap/index.d.ts +25 -0
- package/dist/calendar-heatmap/index.d.ts.map +1 -0
- package/dist/calendar-heatmap/index.js +48 -0
- package/dist/chart/allocation.d.ts +30 -0
- package/dist/chart/allocation.d.ts.map +1 -0
- package/dist/chart/allocation.js +69 -0
- package/dist/chart/index.d.ts +1 -0
- package/dist/chart/index.d.ts.map +1 -1
- package/dist/chart/index.js +85 -83
- package/dist/code-block/index.d.ts +1 -1
- package/dist/code-block/index.d.ts.map +1 -1
- package/dist/code-block/index.js +31 -22
- package/dist/collapse/index.d.ts +3 -2
- package/dist/collapse/index.d.ts.map +1 -1
- package/dist/collapse/index.js +1 -1
- package/dist/date-picker/index.d.ts +10 -2
- package/dist/date-picker/index.d.ts.map +1 -1
- package/dist/date-picker/index.js +43 -21
- package/dist/dialog/index.d.ts +4 -2
- package/dist/dialog/index.d.ts.map +1 -1
- package/dist/dialog/index.js +69 -113
- package/dist/editable-cell/index.d.ts +2 -1
- package/dist/editable-cell/index.d.ts.map +1 -1
- package/dist/editable-cell/index.js +24 -17
- package/dist/filter-bar/index.d.ts +21 -0
- package/dist/filter-bar/index.d.ts.map +1 -0
- package/dist/filter-bar/index.js +90 -0
- package/dist/icon-picker/index.d.ts +38 -0
- package/dist/icon-picker/index.d.ts.map +1 -0
- package/dist/icon-picker/index.js +112 -0
- package/dist/icons/arrow-left.js +23 -0
- package/dist/icons/micro/arrow-trending-down.d.ts +3 -0
- package/dist/icons/micro/arrow-trending-down.d.ts.map +1 -0
- package/dist/icons/micro/arrow-trending-down.js +21 -0
- package/dist/icons/micro/arrow-trending-up.d.ts +3 -0
- package/dist/icons/micro/arrow-trending-up.d.ts.map +1 -0
- package/dist/icons/micro/arrow-trending-up.js +21 -0
- package/dist/index.d.ts +17 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/kbd/index.d.ts +4 -0
- package/dist/kbd/index.d.ts.map +1 -0
- package/dist/kbd/index.js +12 -0
- package/dist/keypad/index.d.ts +20 -0
- package/dist/keypad/index.d.ts.map +1 -0
- package/dist/keypad/index.js +42 -0
- package/dist/lib.js +92 -77
- package/dist/load-more/index.d.ts +19 -0
- package/dist/load-more/index.d.ts.map +1 -0
- package/dist/load-more/index.js +37 -0
- package/dist/menu/index.d.ts +22 -3
- package/dist/menu/index.d.ts.map +1 -1
- package/dist/menu/index.js +132 -45
- package/dist/meter/index.d.ts +3 -1
- package/dist/meter/index.d.ts.map +1 -1
- package/dist/meter/index.js +19 -14
- package/dist/money-input/index.d.ts +3 -3
- package/dist/page-transition/index.d.ts +10 -0
- package/dist/page-transition/index.d.ts.map +1 -0
- package/dist/page-transition/index.js +16 -0
- package/dist/progress-ring/index.d.ts +4 -1
- package/dist/progress-ring/index.d.ts.map +1 -1
- package/dist/progress-ring/index.js +47 -38
- package/dist/range-slider/index.d.ts +26 -0
- package/dist/range-slider/index.d.ts.map +1 -0
- package/dist/range-slider/index.js +44 -0
- package/dist/repeat-picker/index.d.ts +22 -0
- package/dist/repeat-picker/index.d.ts.map +1 -0
- package/dist/repeat-picker/index.js +115 -0
- package/dist/slider/index.d.ts +2 -0
- package/dist/slider/index.d.ts.map +1 -1
- package/dist/slider/index.js +19 -18
- package/dist/sortable/index.d.ts +33 -0
- package/dist/sortable/index.d.ts.map +1 -0
- package/dist/sortable/index.js +147 -0
- package/dist/table/index.d.ts +5 -1
- package/dist/table/index.d.ts.map +1 -1
- package/dist/table/index.js +90 -58
- package/dist/table/selection.d.ts +55 -0
- package/dist/table/selection.d.ts.map +1 -0
- package/dist/table/selection.js +83 -0
- package/dist/table/swipe.d.ts +18 -0
- package/dist/table/swipe.d.ts.map +1 -0
- package/dist/table/swipe.js +53 -0
- package/dist/tabs/index.d.ts.map +1 -1
- package/dist/tabs/index.js +101 -51
- package/dist/theme-toggle/index.js +6 -6
- package/dist/theme.css +184 -11
- package/dist/toast/index.js +25 -25
- package/dist/toggle/index.d.ts.map +1 -1
- package/dist/toggle/index.js +1 -1
- package/dist/trend/index.d.ts +19 -0
- package/dist/trend/index.d.ts.map +1 -0
- package/dist/trend/index.js +27 -0
- package/dist/utils/date.d.ts +34 -0
- package/dist/utils/date.d.ts.map +1 -1
- package/dist/utils/date.js +45 -12
- package/dist/utils/money.d.ts +3 -1
- package/dist/utils/money.d.ts.map +1 -1
- package/dist/utils/money.js +24 -1
- package/dist/utils/repeat.d.ts +17 -0
- package/dist/utils/repeat.d.ts.map +1 -0
- package/dist/utils/repeat.js +38 -0
- package/dist/utils/swipe.d.ts +29 -0
- package/dist/utils/swipe.d.ts.map +1 -0
- package/dist/utils/swipe.js +85 -0
- package/dist/utils/useAnchoredPopup.d.ts.map +1 -1
- package/dist/utils/useAnchoredPopup.js +3 -9
- package/dist/zen.css +1 -1
- package/package.json +3 -1
package/dist/tabs/index.js
CHANGED
|
@@ -1,37 +1,48 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cx as e } from "../utils/cx.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { reducedMotion as t } from "../utils/motion.js";
|
|
4
|
+
import { PILL as n } from "../utils/styles.js";
|
|
5
|
+
import { useIndicator as r } from "../utils/indicator.js";
|
|
6
|
+
import i, { PillIndicator as a } from "../pills/index.js";
|
|
7
|
+
import { createContext as o, useContext as s, useEffect as c, useId as l, useLayoutEffect as u, useRef as d, useState as f } from "react";
|
|
8
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
8
9
|
//#region packages/tabs/index.tsx
|
|
9
|
-
var
|
|
10
|
-
function
|
|
11
|
-
let t =
|
|
10
|
+
var h = typeof window > "u" ? c : u, g = o(null);
|
|
11
|
+
function _(e) {
|
|
12
|
+
let t = s(g);
|
|
12
13
|
if (!t) throw Error(`<${e}> must be inside <Tabs>`);
|
|
13
14
|
return t;
|
|
14
15
|
}
|
|
15
|
-
function
|
|
16
|
-
let [o,
|
|
17
|
-
|
|
16
|
+
function v({ value: t, defaultValue: n = "", onValueChange: r, className: i, ...a }) {
|
|
17
|
+
let [o, s] = f(n), c = t ?? o, [u, m] = f({ value: c });
|
|
18
|
+
u.value !== c && m({
|
|
19
|
+
value: c,
|
|
20
|
+
before: u.value
|
|
21
|
+
});
|
|
22
|
+
let h = d(null), _ = (e) => {
|
|
23
|
+
let t = h.current;
|
|
24
|
+
return h.current = e, t;
|
|
25
|
+
}, v = l();
|
|
26
|
+
return /* @__PURE__ */ p(g.Provider, {
|
|
18
27
|
value: {
|
|
19
|
-
value:
|
|
28
|
+
value: c,
|
|
29
|
+
before: u.before,
|
|
30
|
+
show: _,
|
|
20
31
|
select: (e) => {
|
|
21
|
-
t === void 0 &&
|
|
32
|
+
t === void 0 && s(e), r?.(e);
|
|
22
33
|
},
|
|
23
|
-
idFor: (e, t) => `${
|
|
34
|
+
idFor: (e, t) => `${v}-${e}-${t.replace(/\s+/g, "-")}`
|
|
24
35
|
},
|
|
25
|
-
children: /* @__PURE__ */
|
|
26
|
-
className: e("zen__tabs flex flex-col gap-4", i),
|
|
36
|
+
children: /* @__PURE__ */ p("div", {
|
|
37
|
+
className: e("zen__tabs relative flex flex-col gap-4", i),
|
|
27
38
|
...a
|
|
28
39
|
})
|
|
29
40
|
});
|
|
30
41
|
}
|
|
31
|
-
var
|
|
32
|
-
function
|
|
33
|
-
|
|
34
|
-
let o =
|
|
42
|
+
var y = o("underline");
|
|
43
|
+
function b({ variant: e = "underline", className: t, children: n, ...r }) {
|
|
44
|
+
_("TabList");
|
|
45
|
+
let o = d(null), s = (e) => {
|
|
35
46
|
let t = Array.from(o.current?.querySelectorAll("[role=\"tab\"]:not(:disabled)") ?? []), n = t.indexOf(document.activeElement);
|
|
36
47
|
if (n === -1) return;
|
|
37
48
|
let r = {
|
|
@@ -44,75 +55,114 @@ function g({ variant: e = "underline", className: t, children: n, ...a }) {
|
|
|
44
55
|
e.preventDefault();
|
|
45
56
|
let i = t[(r + t.length) % t.length];
|
|
46
57
|
i.focus(), i.click();
|
|
47
|
-
},
|
|
58
|
+
}, c = /* @__PURE__ */ p(y.Provider, {
|
|
48
59
|
value: e,
|
|
49
60
|
children: n
|
|
50
61
|
});
|
|
51
|
-
return e === "pills" ? /* @__PURE__ */
|
|
62
|
+
return e === "pills" ? /* @__PURE__ */ m(i, {
|
|
52
63
|
ref: o,
|
|
53
64
|
role: "tablist",
|
|
54
65
|
onKeyDown: s,
|
|
55
66
|
className: t,
|
|
56
|
-
...
|
|
57
|
-
children: [
|
|
58
|
-
}) : /* @__PURE__ */
|
|
67
|
+
...r,
|
|
68
|
+
children: [c, /* @__PURE__ */ p(a, {})]
|
|
69
|
+
}) : /* @__PURE__ */ p(x, {
|
|
59
70
|
ref: o,
|
|
60
71
|
role: "tablist",
|
|
61
72
|
onKeyDown: s,
|
|
62
73
|
className: t,
|
|
63
|
-
...
|
|
64
|
-
children:
|
|
74
|
+
...r,
|
|
75
|
+
children: c
|
|
65
76
|
});
|
|
66
77
|
}
|
|
67
|
-
function
|
|
68
|
-
let o =
|
|
69
|
-
return /* @__PURE__ */
|
|
78
|
+
function x({ ref: t, className: n, children: i, ...a }) {
|
|
79
|
+
let o = d(null), s = r(o, "[role=\"tab\"][aria-selected=\"true\"]");
|
|
80
|
+
return /* @__PURE__ */ m("div", {
|
|
70
81
|
ref: (e) => {
|
|
71
82
|
o.current = e, typeof t == "function" ? t(e) : t && (t.current = e);
|
|
72
83
|
},
|
|
73
|
-
className: e("border-border relative flex gap-1 border-b",
|
|
84
|
+
className: e("border-border relative flex gap-1 border-b", n),
|
|
74
85
|
...a,
|
|
75
|
-
children: [i, s ? /* @__PURE__ */
|
|
86
|
+
children: [i, s ? /* @__PURE__ */ p("span", {
|
|
76
87
|
"aria-hidden": !0,
|
|
77
88
|
className: "zen__tab-bar bg-primary absolute bottom-[-1px] left-0 h-0.5 transition-[translate,width] duration-150 ease-in-out",
|
|
78
89
|
style: {
|
|
79
90
|
width: s.w,
|
|
80
91
|
translate: `${s.x}px 0`
|
|
81
92
|
}
|
|
82
|
-
}, "measured") : /* @__PURE__ */
|
|
93
|
+
}, "measured") : /* @__PURE__ */ p("span", {
|
|
83
94
|
"aria-hidden": !0,
|
|
84
95
|
"data-pending": !0,
|
|
85
96
|
className: "zen__tab-bar hidden"
|
|
86
97
|
}, "pending")]
|
|
87
98
|
});
|
|
88
99
|
}
|
|
89
|
-
function
|
|
90
|
-
let { value:
|
|
91
|
-
return /* @__PURE__ */
|
|
100
|
+
function S({ value: t, className: r, onClick: i, ...a }) {
|
|
101
|
+
let { value: o, select: c, idFor: l } = _("Tab"), u = s(y), d = o === t;
|
|
102
|
+
return /* @__PURE__ */ p("button", {
|
|
92
103
|
type: "button",
|
|
93
104
|
role: "tab",
|
|
94
|
-
id: l("tab",
|
|
95
|
-
"aria-selected":
|
|
96
|
-
"aria-controls": l("panel",
|
|
97
|
-
tabIndex:
|
|
98
|
-
"data-active":
|
|
105
|
+
id: l("tab", t),
|
|
106
|
+
"aria-selected": d,
|
|
107
|
+
"aria-controls": l("panel", t),
|
|
108
|
+
tabIndex: d ? 0 : -1,
|
|
109
|
+
"data-active": d || void 0,
|
|
99
110
|
onClick: (e) => {
|
|
100
|
-
c(
|
|
111
|
+
c(t), i?.(e);
|
|
101
112
|
},
|
|
102
|
-
className: e(
|
|
113
|
+
className: e(u === "pills" ? n : "focus-visible:ring-ring text-muted-foreground hover:text-foreground data-active:text-foreground cursor-pointer px-3 py-2 text-sm whitespace-nowrap outline-hidden select-none focus-visible:ring-1 disabled:cursor-not-allowed", r),
|
|
103
114
|
...a
|
|
104
115
|
});
|
|
105
116
|
}
|
|
106
|
-
function
|
|
107
|
-
let { value:
|
|
108
|
-
return
|
|
117
|
+
function C({ value: n, className: r, ...i }) {
|
|
118
|
+
let { value: a, before: o, show: s, idFor: c } = _("TabPanel"), l = a === n;
|
|
119
|
+
return h(() => {
|
|
120
|
+
if (!l) return;
|
|
121
|
+
let e = document.getElementById(c("panel", n)), r = s(e);
|
|
122
|
+
if (!e || o === void 0 || o === n) return;
|
|
123
|
+
let i = document.getElementById(c("tab", n)), a = document.getElementById(c("tab", o));
|
|
124
|
+
if (!i || !a) return;
|
|
125
|
+
let u = !!(i.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING);
|
|
126
|
+
e.dataset.enter = u ? "end" : "start", t() || T(e, r, u);
|
|
127
|
+
}, [l, o]), l ? /* @__PURE__ */ p("div", {
|
|
109
128
|
role: "tabpanel",
|
|
110
|
-
id:
|
|
111
|
-
"aria-labelledby":
|
|
129
|
+
id: c("panel", n),
|
|
130
|
+
"aria-labelledby": c("tab", n),
|
|
112
131
|
tabIndex: 0,
|
|
113
|
-
className: e("focus-visible:outline-ring/50 outline-hidden focus-visible:outline-2 focus-visible:outline-offset-4",
|
|
114
|
-
...
|
|
132
|
+
className: e("zen__tab-panel focus-visible:outline-ring/50 outline-hidden focus-visible:outline-2 focus-visible:outline-offset-4", r),
|
|
133
|
+
...i
|
|
115
134
|
}) : null;
|
|
116
135
|
}
|
|
136
|
+
var w = {
|
|
137
|
+
duration: 300,
|
|
138
|
+
easing: "cubic-bezier(0.33, 1, 0.68, 1)"
|
|
139
|
+
};
|
|
140
|
+
function T(e, t, n) {
|
|
141
|
+
let r = e.closest(".zen__tabs");
|
|
142
|
+
if (!e.animate) return;
|
|
143
|
+
let i = n === (getComputedStyle(e).direction !== "rtl") ? 1 : -1, a = e.offsetWidth, o = Math.min(a * .25, 208), s = e.offsetHeight, c = s;
|
|
144
|
+
if (t && !t.isConnected && r) {
|
|
145
|
+
let n = e.getBoundingClientRect(), l = r.getBoundingClientRect();
|
|
146
|
+
t.removeAttribute("id"), t.setAttribute("aria-hidden", "true"), t.inert = !0, t.getAnimations().forEach((e) => e.cancel()), Object.assign(t.style, {
|
|
147
|
+
position: "absolute",
|
|
148
|
+
top: `${n.top - l.top}px`,
|
|
149
|
+
left: `${n.left - l.left}px`,
|
|
150
|
+
width: `${a}px`,
|
|
151
|
+
pointerEvents: "none"
|
|
152
|
+
}), r.append(t), c = t.offsetHeight;
|
|
153
|
+
let u = Math.max(0, c - s), d = t.animate({
|
|
154
|
+
translate: ["0 0", `${-i * o}px 0`],
|
|
155
|
+
opacity: [1, 0],
|
|
156
|
+
clipPath: ["inset(0 0 0 0)", i > 0 ? `inset(0 0 ${u}px ${o}px)` : `inset(0 ${o}px ${u}px 0)`]
|
|
157
|
+
}, w);
|
|
158
|
+
d.onfinish = d.oncancel = () => t.remove();
|
|
159
|
+
}
|
|
160
|
+
let l = Math.max(0, s - c);
|
|
161
|
+
e.animate({
|
|
162
|
+
translate: [`${i * o}px 0`, "0 0"],
|
|
163
|
+
opacity: [0, 1],
|
|
164
|
+
clipPath: [i > 0 ? `inset(0 ${o}px ${l}px 0)` : `inset(0 0 ${l}px ${o}px)`, "inset(0 0 0 0)"]
|
|
165
|
+
}, w);
|
|
166
|
+
}
|
|
117
167
|
//#endregion
|
|
118
|
-
export {
|
|
168
|
+
export { S as Tab, b as TabList, C as TabPanel, v as default };
|
|
@@ -4,12 +4,12 @@ import t from "../icons/micro/moon.js";
|
|
|
4
4
|
import n from "../icons/micro/sun.js";
|
|
5
5
|
import { prepareThemeWave as r, themeWave as i } from "../utils/theme-wave.js";
|
|
6
6
|
import { useSyncExternalStore as a } from "react";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { flushSync as o } from "react-dom";
|
|
8
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
9
9
|
//#region packages/theme-toggle/index.tsx
|
|
10
10
|
var c = (e = "theme") => `try{var t=localStorage.getItem(${JSON.stringify(e)}),r=document.documentElement;if(t==='light'||t==='dark'){r.classList.remove('light','dark');r.classList.add(t)}}catch(e){}`;
|
|
11
11
|
function l({ storageKey: e = "theme" }) {
|
|
12
|
-
return /* @__PURE__ */
|
|
12
|
+
return /* @__PURE__ */ s("script", { dangerouslySetInnerHTML: { __html: c(e) } });
|
|
13
13
|
}
|
|
14
14
|
var u = /* @__PURE__ */ new Set();
|
|
15
15
|
function d(e) {
|
|
@@ -25,7 +25,7 @@ function d(e) {
|
|
|
25
25
|
var f = () => document.documentElement.classList.contains("light") ? "light" : "dark";
|
|
26
26
|
function p({ value: c, onChange: l, target: p, storageKey: m = "theme", className: h }) {
|
|
27
27
|
let g = a(d, f, () => "dark"), _ = c ?? g, v = _ === "dark" ? "light" : "dark";
|
|
28
|
-
return /* @__PURE__ */
|
|
28
|
+
return /* @__PURE__ */ s("button", {
|
|
29
29
|
type: "button",
|
|
30
30
|
"aria-label": `Switch to ${v} theme`,
|
|
31
31
|
onPointerEnter: r,
|
|
@@ -38,12 +38,12 @@ function p({ value: c, onChange: l, target: p, storageKey: m = "theme", classNam
|
|
|
38
38
|
localStorage.setItem(m, v);
|
|
39
39
|
} catch {}
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
o(() => {
|
|
42
42
|
l?.(v), u.forEach((e) => e());
|
|
43
43
|
});
|
|
44
44
|
}, e.currentTarget, p?.current),
|
|
45
45
|
className: e("zen__theme-toggle text-muted-foreground hover:bg-tint/[0.06] hover:text-foreground focus-visible:ring-ring/50 grid size-9 cursor-pointer place-items-center rounded-lg outline-hidden focus-visible:ring-2", h),
|
|
46
|
-
children:
|
|
46
|
+
children: s(_ === "dark" ? t : n, { className: "size-4" })
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
//#endregion
|
package/dist/theme.css
CHANGED
|
@@ -957,16 +957,23 @@ html.zen-theme-closing::view-transition-old(zen-theme-area) {
|
|
|
957
957
|
* otherwise be repainted when the animation ends, its icons snapping a pixel
|
|
958
958
|
* away from the text.
|
|
959
959
|
*/
|
|
960
|
-
.zen__popover
|
|
960
|
+
.zen__popover {
|
|
961
|
+
will-change: opacity;
|
|
962
|
+
}
|
|
961
963
|
.zen__dialog {
|
|
962
964
|
will-change: scale;
|
|
963
965
|
}
|
|
966
|
+
/* The gap animates, not scale (which reads as resizing), so a popup flipped above slides the right way. */
|
|
964
967
|
.zen__popover {
|
|
968
|
+
margin-block: calc(var(--zen-anchor-offset, 4) * 1px);
|
|
965
969
|
transition:
|
|
966
970
|
opacity 150ms,
|
|
967
|
-
|
|
968
|
-
overlay
|
|
969
|
-
display
|
|
971
|
+
margin-block 180ms var(--ease-out-soft),
|
|
972
|
+
overlay 180ms allow-discrete,
|
|
973
|
+
display 180ms allow-discrete;
|
|
974
|
+
}
|
|
975
|
+
.zen__popover:not(:popover-open) {
|
|
976
|
+
margin-block: calc((var(--zen-anchor-offset, 4) - 6) * 1px);
|
|
970
977
|
}
|
|
971
978
|
.zen__dialog {
|
|
972
979
|
/*
|
|
@@ -988,7 +995,9 @@ html.zen-theme-closing::view-transition-old(zen-theme-area) {
|
|
|
988
995
|
overlay 150ms allow-discrete,
|
|
989
996
|
display 150ms allow-discrete;
|
|
990
997
|
}
|
|
991
|
-
.zen__popover:not(:popover-open)
|
|
998
|
+
.zen__popover:not(:popover-open) {
|
|
999
|
+
opacity: 0;
|
|
1000
|
+
}
|
|
992
1001
|
.zen__dialog:not([open]) {
|
|
993
1002
|
opacity: 0;
|
|
994
1003
|
scale: 0.95;
|
|
@@ -1039,7 +1048,10 @@ html.zen-theme-closing::view-transition-old(zen-theme-area) {
|
|
|
1039
1048
|
user-select: none;
|
|
1040
1049
|
}
|
|
1041
1050
|
@starting-style {
|
|
1042
|
-
.zen__popover:popover-open
|
|
1051
|
+
.zen__popover:popover-open {
|
|
1052
|
+
opacity: 0;
|
|
1053
|
+
margin-block: calc((var(--zen-anchor-offset, 4) - 6) * 1px);
|
|
1054
|
+
}
|
|
1043
1055
|
.zen__dialog[open] {
|
|
1044
1056
|
opacity: 0;
|
|
1045
1057
|
scale: 0.95;
|
|
@@ -1153,6 +1165,47 @@ html.zen-theme-closing::view-transition-old(zen-theme-area) {
|
|
|
1153
1165
|
.rise > *:nth-child(n + 5) {
|
|
1154
1166
|
animation-delay: 200ms;
|
|
1155
1167
|
}
|
|
1168
|
+
/* A list's rows (a .rise-list's children, e.g. a TableBody's) enter the same way, in quicker steps, as they first show. */
|
|
1169
|
+
.rise-list > * {
|
|
1170
|
+
animation: zen-rise 0.45s var(--ease-out-soft) backwards;
|
|
1171
|
+
}
|
|
1172
|
+
.rise-list > *:nth-child(2) {
|
|
1173
|
+
animation-delay: 35ms;
|
|
1174
|
+
}
|
|
1175
|
+
.rise-list > *:nth-child(3) {
|
|
1176
|
+
animation-delay: 70ms;
|
|
1177
|
+
}
|
|
1178
|
+
.rise-list > *:nth-child(4) {
|
|
1179
|
+
animation-delay: 105ms;
|
|
1180
|
+
}
|
|
1181
|
+
.rise-list > *:nth-child(5) {
|
|
1182
|
+
animation-delay: 140ms;
|
|
1183
|
+
}
|
|
1184
|
+
.rise-list > *:nth-child(6) {
|
|
1185
|
+
animation-delay: 175ms;
|
|
1186
|
+
}
|
|
1187
|
+
.rise-list > *:nth-child(7) {
|
|
1188
|
+
animation-delay: 210ms;
|
|
1189
|
+
}
|
|
1190
|
+
.rise-list > *:nth-child(8) {
|
|
1191
|
+
animation-delay: 245ms;
|
|
1192
|
+
}
|
|
1193
|
+
.rise-list > *:nth-child(9) {
|
|
1194
|
+
animation-delay: 280ms;
|
|
1195
|
+
}
|
|
1196
|
+
.rise-list > *:nth-child(10) {
|
|
1197
|
+
animation-delay: 315ms;
|
|
1198
|
+
}
|
|
1199
|
+
.rise-list > *:nth-child(11) {
|
|
1200
|
+
animation-delay: 350ms;
|
|
1201
|
+
}
|
|
1202
|
+
.rise-list > *:nth-child(12) {
|
|
1203
|
+
animation-delay: 385ms;
|
|
1204
|
+
}
|
|
1205
|
+
/* Past the first screenful, rows (often added later, e.g. by LoadMore) just appear. */
|
|
1206
|
+
.rise-list > *:nth-child(n + 13) {
|
|
1207
|
+
animation: none;
|
|
1208
|
+
}
|
|
1156
1209
|
|
|
1157
1210
|
/*
|
|
1158
1211
|
* Loading placeholders: a soft light sweeping across. The light is a layer
|
|
@@ -1207,6 +1260,53 @@ html.zen-theme-closing::view-transition-old(zen-theme-area) {
|
|
|
1207
1260
|
object-position: top left;
|
|
1208
1261
|
}
|
|
1209
1262
|
|
|
1263
|
+
/* Pages: the old one fades out as the new one rises in (PageTransition). */
|
|
1264
|
+
::view-transition-group(zen-page) {
|
|
1265
|
+
animation-duration: 0.34s;
|
|
1266
|
+
animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
|
|
1267
|
+
}
|
|
1268
|
+
::view-transition-old(zen-page) {
|
|
1269
|
+
animation: zen-page-out 0.16s ease-in both;
|
|
1270
|
+
}
|
|
1271
|
+
::view-transition-new(zen-page) {
|
|
1272
|
+
animation: zen-page-in 0.34s cubic-bezier(0.2, 0.8, 0.2, 1) 0.06s both;
|
|
1273
|
+
}
|
|
1274
|
+
@keyframes zen-page-out {
|
|
1275
|
+
to {
|
|
1276
|
+
opacity: 0;
|
|
1277
|
+
translate: 0 -6px;
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
@keyframes zen-page-in {
|
|
1281
|
+
from {
|
|
1282
|
+
opacity: 0;
|
|
1283
|
+
translate: 0 12px;
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1287
|
+
::view-transition-group(zen-page),
|
|
1288
|
+
::view-transition-old(zen-page),
|
|
1289
|
+
::view-transition-new(zen-page) {
|
|
1290
|
+
animation: none;
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
html.reduce-motion::view-transition-group(zen-page),
|
|
1294
|
+
html.reduce-motion::view-transition-old(zen-page),
|
|
1295
|
+
html.reduce-motion::view-transition-new(zen-page) {
|
|
1296
|
+
animation: none;
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
/* The selection bar rises into view when the first row is selected. */
|
|
1300
|
+
.zen__selection-bar {
|
|
1301
|
+
animation: zen-bar-in 0.3s var(--ease-out-soft) both;
|
|
1302
|
+
}
|
|
1303
|
+
@keyframes zen-bar-in {
|
|
1304
|
+
from {
|
|
1305
|
+
opacity: 0;
|
|
1306
|
+
translate: 0 16px;
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1210
1310
|
/* Content arriving where its placeholder was. */
|
|
1211
1311
|
.zen__reveal {
|
|
1212
1312
|
animation: zen-reveal 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
|
|
@@ -1218,6 +1318,57 @@ html.zen-theme-closing::view-transition-old(zen-theme-area) {
|
|
|
1218
1318
|
}
|
|
1219
1319
|
}
|
|
1220
1320
|
|
|
1321
|
+
/* A progress ring reaching its goal: a ring of glow goes out from the arc as it closes. */
|
|
1322
|
+
.zen__ring-burst {
|
|
1323
|
+
animation: zen-ring-burst 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) 0.5s both;
|
|
1324
|
+
box-shadow: 0 0 18px oklch(var(--glow) / calc(0.6 * var(--glow-k)));
|
|
1325
|
+
}
|
|
1326
|
+
@keyframes zen-ring-burst {
|
|
1327
|
+
from {
|
|
1328
|
+
opacity: 0.9;
|
|
1329
|
+
scale: 1;
|
|
1330
|
+
}
|
|
1331
|
+
to {
|
|
1332
|
+
opacity: 0;
|
|
1333
|
+
scale: 1.45;
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
/* A value just changed by an edit. */
|
|
1338
|
+
.zen__editable-cell[data-changed] {
|
|
1339
|
+
animation: zen-cell-changed 1s cubic-bezier(0.2, 0.8, 0.2, 1);
|
|
1340
|
+
}
|
|
1341
|
+
@keyframes zen-cell-changed {
|
|
1342
|
+
from {
|
|
1343
|
+
background-color: oklch(var(--primary) / 0.22);
|
|
1344
|
+
box-shadow: 0 0 14px oklch(var(--glow) / calc(0.45 * var(--glow-k)));
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
/* A swiped row moves aside for the actions behind it, and settles when let go. */
|
|
1349
|
+
.zen__swipe-row {
|
|
1350
|
+
translate: calc(-1 * var(--zen-row-swipe, 0px)) 0;
|
|
1351
|
+
transition: translate 0.3s var(--ease-out-soft);
|
|
1352
|
+
}
|
|
1353
|
+
.zen__swipe-row:dir(rtl) {
|
|
1354
|
+
translate: var(--zen-row-swipe, 0px) 0;
|
|
1355
|
+
}
|
|
1356
|
+
.zen__swipe-actions {
|
|
1357
|
+
transition: width 0.3s var(--ease-out-soft);
|
|
1358
|
+
}
|
|
1359
|
+
.zen__swipe-row[data-swiping],
|
|
1360
|
+
.zen__swipe-row[data-swiping] > .zen__swipe-actions {
|
|
1361
|
+
transition: none;
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
/* While an item is dragged, the others glide out of its way (not when the list is reordered after). */
|
|
1365
|
+
.zen__sortable[data-sorting] > .zen__sortable-item:not([data-dragging]) {
|
|
1366
|
+
transition:
|
|
1367
|
+
translate 0.2s var(--ease-out-soft),
|
|
1368
|
+
box-shadow 0.2s,
|
|
1369
|
+
scale 0.2s;
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1221
1372
|
/* Time left before a toast goes away. */
|
|
1222
1373
|
.zen__toast-timer {
|
|
1223
1374
|
animation: zen-toast-timer linear forwards;
|
|
@@ -1243,6 +1394,25 @@ html.zen-theme-closing::view-transition-old(zen-theme-area) {
|
|
|
1243
1394
|
animation: zen-pop 0.3s var(--ease-out-soft) backwards;
|
|
1244
1395
|
}
|
|
1245
1396
|
|
|
1397
|
+
@keyframes zen-fade-in {
|
|
1398
|
+
from {
|
|
1399
|
+
opacity: 0;
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
@keyframes zen-chip-in {
|
|
1403
|
+
from {
|
|
1404
|
+
opacity: 0;
|
|
1405
|
+
scale: 0.92;
|
|
1406
|
+
translate: 0 3px;
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
.zen__filter-chip {
|
|
1410
|
+
animation: zen-chip-in 0.28s var(--ease-out-soft) backwards;
|
|
1411
|
+
}
|
|
1412
|
+
.zen__filter-clear {
|
|
1413
|
+
animation: zen-fade-in 0.2s ease-out backwards;
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1246
1416
|
/* CodeInput's caret, in the box typing goes into. */
|
|
1247
1417
|
.zen__code-caret {
|
|
1248
1418
|
animation: zen-caret 1s steps(1) infinite;
|
|
@@ -1294,7 +1464,8 @@ html.zen-theme-closing::view-transition-old(zen-theme-area) {
|
|
|
1294
1464
|
* pixels, not along the path, breaking the line up. Its points only go rightwards,
|
|
1295
1465
|
* so the reveal draws it just the same.
|
|
1296
1466
|
*/
|
|
1297
|
-
.zen__sparkline-draw
|
|
1467
|
+
.zen__sparkline-draw,
|
|
1468
|
+
.zen__chart-sweep {
|
|
1298
1469
|
animation: zen-sparkline-draw 0.9s cubic-bezier(0.3, 0.7, 0.2, 1) both;
|
|
1299
1470
|
}
|
|
1300
1471
|
@keyframes zen-sparkline-draw {
|
|
@@ -1305,8 +1476,8 @@ html.zen-theme-closing::view-transition-old(zen-theme-area) {
|
|
|
1305
1476
|
clip-path: inset(0);
|
|
1306
1477
|
}
|
|
1307
1478
|
}
|
|
1308
|
-
[data-zen-unseen] :is(.zen__chart-draw, .zen__sparkline-draw, .zen__chart-grow, .zen__chart-fade),
|
|
1309
|
-
[data-zen-unseen]:is(.zen__chart-draw, .zen__sparkline-draw, .zen__chart-grow, .zen__chart-fade) {
|
|
1479
|
+
[data-zen-unseen] :is(.zen__chart-draw, .zen__sparkline-draw, .zen__chart-sweep, .zen__chart-grow, .zen__chart-fade),
|
|
1480
|
+
[data-zen-unseen]:is(.zen__chart-draw, .zen__sparkline-draw, .zen__chart-sweep, .zen__chart-grow, .zen__chart-fade) {
|
|
1310
1481
|
animation-play-state: paused;
|
|
1311
1482
|
}
|
|
1312
1483
|
|
|
@@ -1321,7 +1492,8 @@ html.zen-theme-closing::view-transition-old(zen-theme-area) {
|
|
|
1321
1492
|
[class*='zen__'],
|
|
1322
1493
|
[class*='zen__']::before,
|
|
1323
1494
|
[class*='zen__']::backdrop,
|
|
1324
|
-
.rise >
|
|
1495
|
+
.rise > *,
|
|
1496
|
+
.rise-list > * {
|
|
1325
1497
|
animation-duration: 0.01ms !important;
|
|
1326
1498
|
animation-iteration-count: 1 !important;
|
|
1327
1499
|
transition-duration: 0.01ms !important;
|
|
@@ -1332,7 +1504,8 @@ html.reduce-motion .zen-backdrop *::before,
|
|
|
1332
1504
|
html.reduce-motion [class*='zen__'],
|
|
1333
1505
|
html.reduce-motion [class*='zen__']::before,
|
|
1334
1506
|
html.reduce-motion [class*='zen__']::backdrop,
|
|
1335
|
-
html.reduce-motion .rise >
|
|
1507
|
+
html.reduce-motion .rise > *,
|
|
1508
|
+
html.reduce-motion .rise-list > * {
|
|
1336
1509
|
animation-duration: 0.01ms !important;
|
|
1337
1510
|
animation-iteration-count: 1 !important;
|
|
1338
1511
|
transition-duration: 0.01ms !important;
|
package/dist/toast/index.js
CHANGED
|
@@ -4,13 +4,13 @@ import { useGraphicsMode as t } from "../utils/graphics.js";
|
|
|
4
4
|
import { AlertIcon as n, CheckIcon as r, InfoIcon as i } from "../utils/status-icons.js";
|
|
5
5
|
import a from "../icons/micro/x-mark.js";
|
|
6
6
|
import { createContext as o, useCallback as s, useContext as c, useEffect as l, useRef as u, useState as d } from "react";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { createPortal as f } from "react-dom";
|
|
8
|
+
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
9
9
|
//#region packages/toast/index.tsx
|
|
10
10
|
var g = 5e3, _ = 3, v = 300, y = 14, b = .05, x = 10, S = 60, C = .45, w = o(null), T = o(null);
|
|
11
11
|
function E({ children: n, offset: r, viewportClassName: i }) {
|
|
12
12
|
t();
|
|
13
|
-
let [a, o] = d([]), c = u(0),
|
|
13
|
+
let [a, o] = d([]), c = u(0), p = u(/* @__PURE__ */ new Map()), S = u(/* @__PURE__ */ new Set()), [C, E] = d([]), [D, k] = d(!1);
|
|
14
14
|
l(() => k(!0), []);
|
|
15
15
|
let A = s((e) => (E((t) => [...t, e]), () => E((t) => t.filter((t) => t !== e))), []), M = C.at(-1) ?? (D ? document.body : null), [N, P] = d({}), F = s((e, t) => P((n) => n[e] === t ? n : {
|
|
16
16
|
...n,
|
|
@@ -32,7 +32,7 @@ function E({ children: n, offset: r, viewportClassName: i }) {
|
|
|
32
32
|
o((t) => {
|
|
33
33
|
let n = t.filter((t) => t.id !== e);
|
|
34
34
|
return n.length || L(!1), n;
|
|
35
|
-
}), P(({ [e]: t, ...n }) => n),
|
|
35
|
+
}), P(({ [e]: t, ...n }) => n), p.current.delete(e), S.current.delete(e);
|
|
36
36
|
}, v);
|
|
37
37
|
}, []), U = s((e, { description: t, tone: n = "info", action: r, timeout: i } = {}) => {
|
|
38
38
|
let a = c.current++, s = {
|
|
@@ -55,12 +55,12 @@ function E({ children: n, offset: r, viewportClassName: i }) {
|
|
|
55
55
|
height: !G && n > 0 ? q : void 0
|
|
56
56
|
};
|
|
57
57
|
};
|
|
58
|
-
return /* @__PURE__ */
|
|
58
|
+
return /* @__PURE__ */ h(w.Provider, {
|
|
59
59
|
value: U,
|
|
60
|
-
children: [/* @__PURE__ */
|
|
60
|
+
children: [/* @__PURE__ */ m(T.Provider, {
|
|
61
61
|
value: A,
|
|
62
62
|
children: n
|
|
63
|
-
}), M &&
|
|
63
|
+
}), M && f(/* @__PURE__ */ m("section", {
|
|
64
64
|
ref: V,
|
|
65
65
|
popover: "manual",
|
|
66
66
|
tabIndex: -1,
|
|
@@ -77,14 +77,14 @@ function E({ children: n, offset: r, viewportClassName: i }) {
|
|
|
77
77
|
height: Y,
|
|
78
78
|
...r && { "--zen-toast-offset": r }
|
|
79
79
|
},
|
|
80
|
-
children: a.map((e, t) => /* @__PURE__ */
|
|
80
|
+
children: a.map((e, t) => /* @__PURE__ */ m(j, {
|
|
81
81
|
toast: e,
|
|
82
82
|
layout: X(e),
|
|
83
83
|
z: t + 1,
|
|
84
84
|
paused: G,
|
|
85
85
|
onDismiss: H,
|
|
86
86
|
onHeight: F,
|
|
87
|
-
clocks:
|
|
87
|
+
clocks: p.current,
|
|
88
88
|
entered: S.current
|
|
89
89
|
}, e.id))
|
|
90
90
|
}), M)]
|
|
@@ -134,11 +134,11 @@ var A = {
|
|
|
134
134
|
glow: "shadow-[var(--toast-shadow)]"
|
|
135
135
|
}
|
|
136
136
|
};
|
|
137
|
-
function j({ toast: t, layout: n, z: r, paused: i, onDismiss: o, onHeight: s, clocks: c, entered:
|
|
138
|
-
let g = A[t.tone] ?? A.info, _ = g.icon, v = u(null), y = u(null), [b] = d(() => !
|
|
137
|
+
function j({ toast: t, layout: n, z: r, paused: i, onDismiss: o, onHeight: s, clocks: c, entered: f }) {
|
|
138
|
+
let g = A[t.tone] ?? A.info, _ = g.icon, v = u(null), y = u(null), [b] = d(() => !f.has(t.id));
|
|
139
139
|
l(() => {
|
|
140
|
-
v.current?.isConnected &&
|
|
141
|
-
}, [
|
|
140
|
+
v.current?.isConnected && f.add(t.id);
|
|
141
|
+
}, [f, t.id]);
|
|
142
142
|
let [x, w] = d(!1);
|
|
143
143
|
l(() => {
|
|
144
144
|
if (!b) return;
|
|
@@ -186,7 +186,7 @@ function j({ toast: t, layout: n, z: r, paused: i, onDismiss: o, onHeight: s, cl
|
|
|
186
186
|
let n = D.current;
|
|
187
187
|
n && (D.current = null, delete e.currentTarget.dataset.swiping, n.dx > S || n.dx > 0 && n.speed > C ? o(t.id, "swipe") : e.currentTarget.style.setProperty("--zen-swipe", "0px"));
|
|
188
188
|
};
|
|
189
|
-
return /* @__PURE__ */
|
|
189
|
+
return /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ h("div", {
|
|
190
190
|
ref: v,
|
|
191
191
|
role: t.tone === "error" ? "alert" : "status",
|
|
192
192
|
"aria-live": "off",
|
|
@@ -203,27 +203,27 @@ function j({ toast: t, layout: n, z: r, paused: i, onDismiss: o, onHeight: s, cl
|
|
|
203
203
|
height: n.height,
|
|
204
204
|
transform: `translateX(var(--zen-swipe, 0px)) translateY(${n.y}px) scale(${n.scale})`
|
|
205
205
|
},
|
|
206
|
-
children: [/* @__PURE__ */
|
|
206
|
+
children: [/* @__PURE__ */ h("div", {
|
|
207
207
|
ref: y,
|
|
208
208
|
className: "flex items-start gap-3 p-3.5 pr-10 transition-opacity duration-300 group-data-behind:opacity-0",
|
|
209
209
|
children: [
|
|
210
|
-
/* @__PURE__ */
|
|
210
|
+
/* @__PURE__ */ m("span", {
|
|
211
211
|
className: e("mt-0.5 grid size-8 shrink-0 place-items-center rounded-full", g.badge),
|
|
212
212
|
"aria-hidden": !0,
|
|
213
|
-
children: /* @__PURE__ */
|
|
213
|
+
children: /* @__PURE__ */ m(_, { className: "size-4" })
|
|
214
214
|
}),
|
|
215
|
-
/* @__PURE__ */
|
|
215
|
+
/* @__PURE__ */ h("div", {
|
|
216
216
|
className: "flex min-w-0 flex-1 flex-col gap-0.5 pt-0.5",
|
|
217
217
|
children: [
|
|
218
|
-
/* @__PURE__ */
|
|
218
|
+
/* @__PURE__ */ m("div", {
|
|
219
219
|
className: "text-sm font-semibold",
|
|
220
220
|
children: t.title
|
|
221
221
|
}),
|
|
222
|
-
t.description && /* @__PURE__ */
|
|
222
|
+
t.description && /* @__PURE__ */ m("div", {
|
|
223
223
|
className: "text-muted-foreground text-sm leading-5",
|
|
224
224
|
children: t.description
|
|
225
225
|
}),
|
|
226
|
-
t.action && /* @__PURE__ */
|
|
226
|
+
t.action && /* @__PURE__ */ m("button", {
|
|
227
227
|
type: "button",
|
|
228
228
|
onClick: () => {
|
|
229
229
|
t.action?.onClick(), o(t.id);
|
|
@@ -233,15 +233,15 @@ function j({ toast: t, layout: n, z: r, paused: i, onDismiss: o, onHeight: s, cl
|
|
|
233
233
|
})
|
|
234
234
|
]
|
|
235
235
|
}),
|
|
236
|
-
/* @__PURE__ */
|
|
236
|
+
/* @__PURE__ */ m("button", {
|
|
237
237
|
type: "button",
|
|
238
238
|
"aria-label": "Dismiss",
|
|
239
239
|
onClick: () => o(t.id),
|
|
240
240
|
className: "text-muted-foreground hover:bg-tint/[0.07] hover:text-foreground focus-visible:ring-ring/50 absolute top-2.5 right-2.5 grid size-7 cursor-pointer place-items-center rounded-lg outline-hidden transition-colors focus-visible:ring-2",
|
|
241
|
-
children: /* @__PURE__ */
|
|
241
|
+
children: /* @__PURE__ */ m(a, { className: "size-3.5" })
|
|
242
242
|
})
|
|
243
243
|
]
|
|
244
|
-
}), t.timeout > 0 && /* @__PURE__ */
|
|
244
|
+
}), t.timeout > 0 && /* @__PURE__ */ m("span", {
|
|
245
245
|
"aria-hidden": !0,
|
|
246
246
|
className: e("zen__toast-timer absolute bottom-0 left-0 h-0.5 w-full origin-left opacity-60 transition-opacity group-data-behind:opacity-0", g.bar),
|
|
247
247
|
style: {
|
|
@@ -250,7 +250,7 @@ function j({ toast: t, layout: n, z: r, paused: i, onDismiss: o, onHeight: s, cl
|
|
|
250
250
|
animationPlayState: i ? "paused" : void 0
|
|
251
251
|
}
|
|
252
252
|
})]
|
|
253
|
-
}), /* @__PURE__ */
|
|
253
|
+
}), /* @__PURE__ */ m("span", {
|
|
254
254
|
className: "sr-only",
|
|
255
255
|
"aria-live": t.tone === "error" ? "assertive" : "polite",
|
|
256
256
|
"aria-atomic": "true",
|