@rinzai/zen 0.15.0 → 0.16.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 +15 -0
- package/dist/animated-number/index.js +14 -14
- package/dist/breadcrumbs/index.js +14 -14
- package/dist/calendar/index.js +29 -29
- package/dist/calendar-heatmap/index.js +12 -12
- package/dist/canvas/index.js +19 -19
- package/dist/carousel/index.js +24 -24
- package/dist/chart/index.js +7 -7
- package/dist/code-block/index.js +5 -5
- package/dist/collapse/index.js +6 -6
- package/dist/color-picker/index.js +10 -10
- package/dist/combobox/index.js +61 -61
- package/dist/command-palette/index.js +5 -5
- package/dist/confirm-dialog/index.js +4 -4
- package/dist/date-picker/index.js +15 -15
- package/dist/dialog/index.d.ts.map +1 -1
- package/dist/dialog/index.js +45 -65
- package/dist/docs/README.md +4 -4
- package/dist/docs/locale-provider.md +1 -1
- package/dist/docs/menu.md +54 -1
- package/dist/docs/seek-bar.md +30 -1
- package/dist/docs/sortable.md +63 -1
- package/dist/docs/tooltip.md +45 -3
- package/dist/filter-bar/index.js +6 -6
- package/dist/header/index.js +6 -6
- package/dist/icon-picker/index.js +5 -5
- package/dist/keypad/index.js +5 -5
- package/dist/lib.js +7 -7
- package/dist/load-more/index.js +5 -5
- package/dist/menu/index.d.ts +7 -1
- package/dist/menu/index.d.ts.map +1 -1
- package/dist/menu/index.js +217 -174
- package/dist/money-input/index.js +54 -54
- package/dist/month-picker/index.js +11 -11
- package/dist/number-field/index.js +5 -5
- package/dist/pagination/index.js +12 -12
- package/dist/range-slider/index.js +11 -11
- package/dist/repeat-picker/index.js +5 -5
- package/dist/resizable/index.js +22 -22
- package/dist/seek-bar/index.d.ts +3 -1
- package/dist/seek-bar/index.d.ts.map +1 -1
- package/dist/seek-bar/index.js +41 -40
- package/dist/select/index.js +21 -21
- package/dist/sortable/index.d.ts +13 -1
- package/dist/sortable/index.d.ts.map +1 -1
- package/dist/sortable/index.js +74 -55
- package/dist/sortable/shared.js +14 -14
- package/dist/sortable/tree.js +17 -17
- package/dist/sparkline/index.js +4 -4
- package/dist/stepper/index.js +13 -13
- package/dist/table/index.js +26 -26
- package/dist/table/selection.js +9 -9
- package/dist/table-of-contents/index.js +11 -11
- package/dist/tag-input/index.js +5 -5
- package/dist/theme-toggle/index.js +4 -4
- package/dist/theme.css +103 -0
- package/dist/time-field/index.js +21 -21
- package/dist/toast/index.d.ts.map +1 -1
- package/dist/toast/index.js +41 -41
- package/dist/tooltip/index.d.ts +9 -3
- package/dist/tooltip/index.d.ts.map +1 -1
- package/dist/tooltip/index.js +19 -16
- package/dist/tree/index.js +34 -34
- package/dist/trend/index.js +5 -5
- package/dist/utils/messages.d.ts +1 -0
- package/dist/utils/messages.d.ts.map +1 -1
- package/dist/utils/messages.js +1 -0
- package/dist/utils/swipe.d.ts +7 -0
- package/dist/utils/swipe.d.ts.map +1 -1
- package/dist/utils/swipe.js +45 -25
- package/dist/utils/useAnchoredPopup.d.ts +2 -1
- package/dist/utils/useAnchoredPopup.d.ts.map +1 -1
- package/dist/utils/useAnchoredPopup.js +9 -5
- package/dist/utils/useVirtualList.d.ts +6 -1
- package/dist/utils/useVirtualList.d.ts.map +1 -1
- package/dist/utils/useVirtualList.js +12 -12
- package/dist/zen.css +1 -1
- package/package.json +1 -1
package/dist/toast/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { useMessages as e } from "../locale-provider/index.js";
|
|
3
|
+
import { cx as t } from "../utils/cx.js";
|
|
4
|
+
import { useGraphicsMode as n } from "../utils/graphics.js";
|
|
5
5
|
import { AlertIcon as r, CheckIcon as i, InfoIcon as a } from "../utils/status-icons.js";
|
|
6
6
|
import o from "../icons/micro/x-mark.js";
|
|
7
7
|
import { createContext as s, useCallback as c, useContext as l, useEffect as u, useRef as d, useState as f } from "react";
|
|
@@ -10,8 +10,8 @@ import { createPortal as g } from "react-dom";
|
|
|
10
10
|
//#region packages/toast/index.tsx
|
|
11
11
|
var _ = 5e3, v = 3, y = 300, b = 14, x = .05, S = 10, C = 60, w = .45, T = s(null), E = s(null);
|
|
12
12
|
function D({ children: r, offset: i, viewportClassName: a }) {
|
|
13
|
-
let o =
|
|
14
|
-
|
|
13
|
+
let o = e();
|
|
14
|
+
n();
|
|
15
15
|
let [s, l] = f([]), p = d(0), C = d(/* @__PURE__ */ new Map()), w = d(/* @__PURE__ */ new Set()), [D, O] = f([]), [A, j] = f(!1);
|
|
16
16
|
u(() => j(!0), []);
|
|
17
17
|
let N = c((e) => (O((t) => [...t, e]), () => O((t) => t.filter((t) => t !== e))), []), P = D.at(-1) ?? (A ? document.body : null), [F, I] = f({}), L = c((e, t) => I((n) => n[e] === t ? n : {
|
|
@@ -46,7 +46,7 @@ function D({ children: r, offset: i, viewportClassName: a }) {
|
|
|
46
46
|
timeout: i ?? (r ? 1e4 : _)
|
|
47
47
|
};
|
|
48
48
|
return l((e) => [...e, o]), a;
|
|
49
|
-
}, []), K = s.filter((e) => !e.leaving), q = (R || B) && K.length > 0, J = K.at(-1), Y = J ? F[J.id] : void 0, X = K.slice(-3), Z = q ? X.reduce((e, t) => e + (F[t.id] ?? 0), 0) + S * (X.length - 1) : (Y ?? 0) + b * (X.length - 1), Q = (e) => {
|
|
49
|
+
}, []), K = s.filter((e) => !e.leaving), q = (R || B) && K.length > 0, J = K.at(-1), Y = J ? F[J.id] : void 0, X = K.slice(-3), Z = X.length ? q ? X.reduce((e, t) => e + (F[t.id] ?? 0), 0) + S * (X.length - 1) : (Y ?? 0) + b * (X.length - 1) : 0, Q = (e) => {
|
|
50
50
|
let t = K.filter((t) => t.id > e.id), n = t.length;
|
|
51
51
|
return {
|
|
52
52
|
index: n,
|
|
@@ -74,7 +74,7 @@ function D({ children: r, offset: i, viewportClassName: a }) {
|
|
|
74
74
|
onBlur: (e) => {
|
|
75
75
|
e.currentTarget.contains(e.relatedTarget) || V(!1);
|
|
76
76
|
},
|
|
77
|
-
className:
|
|
77
|
+
className: t("zen__toast-viewport fixed top-auto end-4 bottom-[calc(var(--zen-toast-offset,1rem)+env(safe-area-inset-bottom))] start-auto z-50 m-0 w-[calc(100vw-2rem)] overflow-visible border-0 bg-transparent p-0 text-inherit outline-hidden md:bottom-5 md:w-[24rem]", "ease-out-soft transition-[height] duration-300", a),
|
|
78
78
|
style: {
|
|
79
79
|
height: Z,
|
|
80
80
|
...i && { "--zen-toast-offset": i }
|
|
@@ -136,45 +136,45 @@ var j = {
|
|
|
136
136
|
glow: "shadow-[var(--toast-shadow)]"
|
|
137
137
|
}
|
|
138
138
|
};
|
|
139
|
-
function M({ toast:
|
|
140
|
-
let _ =
|
|
139
|
+
function M({ toast: n, layout: r, z: i, paused: a, onDismiss: s, onHeight: c, clocks: l, entered: g }) {
|
|
140
|
+
let _ = e(), v = j[n.tone] ?? j.default, y = v.icon, b = d(null), x = d(null), [S] = f(() => !g.has(n.id));
|
|
141
141
|
u(() => {
|
|
142
|
-
b.current?.isConnected && g.add(
|
|
143
|
-
}, [g,
|
|
142
|
+
b.current?.isConnected && g.add(n.id);
|
|
143
|
+
}, [g, n.id]);
|
|
144
144
|
let [T, E] = f(!1);
|
|
145
145
|
u(() => {
|
|
146
146
|
if (!S) return;
|
|
147
147
|
let e = requestAnimationFrame(() => e = requestAnimationFrame(() => E(!0)));
|
|
148
148
|
return () => cancelAnimationFrame(e);
|
|
149
|
-
}, [S]), l.has(
|
|
149
|
+
}, [S]), l.has(n.id) || l.set(n.id, {
|
|
150
150
|
spent: 0,
|
|
151
151
|
since: null
|
|
152
152
|
});
|
|
153
|
-
let D = l.get(
|
|
153
|
+
let D = l.get(n.id), [O] = f(() => D.spent + (D.since === null ? 0 : Date.now() - D.since));
|
|
154
154
|
u(() => {
|
|
155
155
|
let e = x.current;
|
|
156
156
|
if (!e) return;
|
|
157
|
-
let
|
|
158
|
-
|
|
159
|
-
let r = new ResizeObserver(
|
|
157
|
+
let t = () => c(n.id, e.offsetHeight);
|
|
158
|
+
t();
|
|
159
|
+
let r = new ResizeObserver(t);
|
|
160
160
|
return r.observe(e), () => r.disconnect();
|
|
161
|
-
}, [c,
|
|
162
|
-
if (!
|
|
161
|
+
}, [c, n.id]), u(() => {
|
|
162
|
+
if (!n.timeout || a || n.leaving) return;
|
|
163
163
|
D.since = Date.now();
|
|
164
|
-
let e = setTimeout(() => s(
|
|
164
|
+
let e = setTimeout(() => s(n.id), Math.max(0, n.timeout - D.spent));
|
|
165
165
|
return () => {
|
|
166
166
|
clearTimeout(e), D.since !== null && (D.spent += Date.now() - D.since), D.since = null;
|
|
167
167
|
};
|
|
168
168
|
}, [
|
|
169
169
|
a,
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
170
|
+
n.id,
|
|
171
|
+
n.timeout,
|
|
172
|
+
n.leaving,
|
|
173
173
|
s,
|
|
174
174
|
D
|
|
175
175
|
]);
|
|
176
176
|
let k = d(null), A = (e) => {
|
|
177
|
-
|
|
177
|
+
n.leaving || e.button !== 0 || e.target.closest("button") || (k.current = {
|
|
178
178
|
x: e.clientX,
|
|
179
179
|
dx: 0,
|
|
180
180
|
t: e.timeStamp,
|
|
@@ -185,21 +185,21 @@ function M({ toast: t, layout: r, z: i, paused: a, onDismiss: s, onHeight: c, cl
|
|
|
185
185
|
let t = k.current, n = e.clientX - t.x;
|
|
186
186
|
t.speed = (n - t.dx) / Math.max(1, e.timeStamp - t.t), t.dx = n, t.t = e.timeStamp, e.currentTarget.style.setProperty("--zen-swipe", `${n > 0 ? n : n / 6}px`);
|
|
187
187
|
}, N = (e) => {
|
|
188
|
-
let
|
|
189
|
-
|
|
188
|
+
let t = k.current;
|
|
189
|
+
t && (k.current = null, delete e.currentTarget.dataset.swiping, t.dx > C || t.dx > 0 && t.speed > w ? s(n.id, "swipe") : e.currentTarget.style.setProperty("--zen-swipe", "0px"));
|
|
190
190
|
};
|
|
191
191
|
return /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ h("div", {
|
|
192
192
|
ref: b,
|
|
193
|
-
role:
|
|
193
|
+
role: n.tone === "negative" ? "alert" : "status",
|
|
194
194
|
"aria-live": "off",
|
|
195
195
|
"data-front": r.front || void 0,
|
|
196
196
|
"data-behind": !r.front && r.height !== void 0 || void 0,
|
|
197
|
-
inert: r.hidden || !!
|
|
197
|
+
inert: r.hidden || !!n.leaving,
|
|
198
198
|
onPointerDown: A,
|
|
199
199
|
onPointerMove: M,
|
|
200
200
|
onPointerUp: N,
|
|
201
201
|
onPointerCancel: N,
|
|
202
|
-
className:
|
|
202
|
+
className: t("zen__toast group glass glass-blur glow-edge text-card-foreground absolute! inset-x-0 bottom-0 origin-bottom touch-pan-y overflow-hidden rounded-2xl border select-none", "ease-out-soft transition-[transform,translate,opacity,height] duration-400 data-swiping:transition-none", S && "starting:translate-y-full starting:opacity-0", r.hidden && "opacity-0", n.leaving === "fade" && "translate-y-[35%] opacity-0", n.leaving === "swipe" && "translate-x-full opacity-0", v.ring, v.glow),
|
|
203
203
|
style: {
|
|
204
204
|
zIndex: i,
|
|
205
205
|
height: r.height,
|
|
@@ -210,7 +210,7 @@ function M({ toast: t, layout: r, z: i, paused: a, onDismiss: s, onHeight: c, cl
|
|
|
210
210
|
className: "flex items-start gap-3 p-3.5 pe-10 transition-opacity duration-300 group-data-behind:opacity-0",
|
|
211
211
|
children: [
|
|
212
212
|
/* @__PURE__ */ m("span", {
|
|
213
|
-
className:
|
|
213
|
+
className: t("mt-0.5 grid size-8 shrink-0 place-items-center rounded-full", v.badge),
|
|
214
214
|
"aria-hidden": !0,
|
|
215
215
|
children: /* @__PURE__ */ m(y, { className: "size-4" })
|
|
216
216
|
}),
|
|
@@ -219,44 +219,44 @@ function M({ toast: t, layout: r, z: i, paused: a, onDismiss: s, onHeight: c, cl
|
|
|
219
219
|
children: [
|
|
220
220
|
/* @__PURE__ */ m("div", {
|
|
221
221
|
className: "text-sm font-semibold",
|
|
222
|
-
children:
|
|
222
|
+
children: n.title
|
|
223
223
|
}),
|
|
224
|
-
|
|
224
|
+
n.description && /* @__PURE__ */ m("div", {
|
|
225
225
|
className: "text-muted-foreground text-sm leading-5",
|
|
226
|
-
children:
|
|
226
|
+
children: n.description
|
|
227
227
|
}),
|
|
228
|
-
|
|
228
|
+
n.action && /* @__PURE__ */ m("button", {
|
|
229
229
|
type: "button",
|
|
230
230
|
onClick: () => {
|
|
231
|
-
|
|
231
|
+
n.action?.onClick(), s(n.id);
|
|
232
232
|
},
|
|
233
233
|
className: "border-tint/10 bg-tint/[0.06] hover:bg-tint/[0.12] focus-ring mt-2 cursor-pointer self-start rounded-lg border px-3 py-1 text-xs font-medium outline-hidden transition-colors",
|
|
234
|
-
children:
|
|
234
|
+
children: n.action.label
|
|
235
235
|
})
|
|
236
236
|
]
|
|
237
237
|
}),
|
|
238
238
|
/* @__PURE__ */ m("button", {
|
|
239
239
|
type: "button",
|
|
240
240
|
"aria-label": _.dismiss,
|
|
241
|
-
onClick: () => s(
|
|
241
|
+
onClick: () => s(n.id),
|
|
242
242
|
className: "text-muted-foreground hover:bg-tint/[0.07] hover:text-foreground focus-ring absolute end-2.5 top-2.5 grid size-7 cursor-pointer place-items-center rounded-lg outline-hidden transition-colors",
|
|
243
243
|
children: /* @__PURE__ */ m(o, { className: "size-3.5" })
|
|
244
244
|
})
|
|
245
245
|
]
|
|
246
|
-
}),
|
|
246
|
+
}), n.timeout > 0 && /* @__PURE__ */ m("span", {
|
|
247
247
|
"aria-hidden": !0,
|
|
248
|
-
className:
|
|
248
|
+
className: t("zen__toast-timer absolute start-0 bottom-0 h-0.5 w-full origin-left opacity-60 rtl:origin-right transition-opacity group-data-behind:opacity-0", v.bar),
|
|
249
249
|
style: {
|
|
250
|
-
animationDuration: `${
|
|
250
|
+
animationDuration: `${n.timeout}ms`,
|
|
251
251
|
animationDelay: `${-O}ms`,
|
|
252
252
|
animationPlayState: a ? "paused" : void 0
|
|
253
253
|
}
|
|
254
254
|
})]
|
|
255
255
|
}), /* @__PURE__ */ m("span", {
|
|
256
256
|
className: "sr-only",
|
|
257
|
-
"aria-live":
|
|
257
|
+
"aria-live": n.tone === "negative" ? "assertive" : "polite",
|
|
258
258
|
"aria-atomic": "true",
|
|
259
|
-
children: T && [
|
|
259
|
+
children: T && [n.title, n.description].filter(Boolean).join(". ")
|
|
260
260
|
})] });
|
|
261
261
|
}
|
|
262
262
|
//#endregion
|
package/dist/tooltip/index.d.ts
CHANGED
|
@@ -10,14 +10,20 @@ export default function Tooltip({ children }: {
|
|
|
10
10
|
}): import('react').JSX.Element;
|
|
11
11
|
/** What the tooltip describes: a button by default. With `asChild`, your own focusable element instead. */
|
|
12
12
|
export declare function TooltipTrigger({ asChild, style, onPointerEnter, onPointerLeave, onFocus, onBlur, onKeyDown, children, ...rest }: TooltipTriggerProps): import('react').JSX.Element;
|
|
13
|
-
/**
|
|
14
|
-
|
|
13
|
+
/**
|
|
14
|
+
* The hint: glass, below the trigger (above it if there's no room), centred on
|
|
15
|
+
* it by default. `side="beside"` puts it after the trigger instead (before it
|
|
16
|
+
* if there's no room), as for the icons of a collapsed sidebar.
|
|
17
|
+
*/
|
|
18
|
+
export declare function TooltipContent({ side, align, offset, className, style, onPointerEnter, onPointerLeave, children, ...rest }: TooltipContentProps): import('react').JSX.Element;
|
|
15
19
|
export interface TooltipTriggerProps extends ComponentProps<'button'> {
|
|
16
20
|
/** Put the trigger's props on your own focusable element instead of rendering a button. */
|
|
17
21
|
asChild?: boolean;
|
|
18
22
|
}
|
|
19
23
|
export interface TooltipContentProps extends ComponentProps<'div'> {
|
|
20
|
-
/**
|
|
24
|
+
/** Below the trigger (default; above if there's no room), or beside it (after it; before if there's no room). */
|
|
25
|
+
side?: 'below' | 'beside';
|
|
26
|
+
/** Centred on the trigger (default), or lined up with its start or end edge (beside: its top or bottom). */
|
|
21
27
|
align?: 'start' | 'end' | 'center';
|
|
22
28
|
/** Gap from the trigger, in px. */
|
|
23
29
|
offset?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/tooltip/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAiB,SAAS,EAAsB,MAAM,OAAO,CAAC;AAUrF;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,+BAIrE;AAED,2GAA2G;AAC3G,wBAAgB,cAAc,CAAC,EAC3B,OAAO,EACP,KAAK,EACL,cAAc,EACd,cAAc,EACd,OAAO,EACP,MAAM,EACN,SAAS,EACT,QAAQ,EACR,GAAG,IAAI,EACV,EAAE,mBAAmB,+BAerB;AAED
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/tooltip/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAiB,SAAS,EAAsB,MAAM,OAAO,CAAC;AAUrF;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,+BAIrE;AAED,2GAA2G;AAC3G,wBAAgB,cAAc,CAAC,EAC3B,OAAO,EACP,KAAK,EACL,cAAc,EACd,cAAc,EACd,OAAO,EACP,MAAM,EACN,SAAS,EACT,QAAQ,EACR,GAAG,IAAI,EACV,EAAE,mBAAmB,+BAerB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAC3B,IAAc,EACd,KAAgB,EAChB,MAAU,EACV,SAAS,EACT,KAAK,EACL,cAAc,EACd,cAAc,EACd,QAAQ,EACR,GAAG,IAAI,EACV,EAAE,mBAAmB,+BAyBrB;AAED,MAAM,WAAW,mBAAoB,SAAQ,cAAc,CAAC,QAAQ,CAAC;IACjE,2FAA2F;IAC3F,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,mBAAoB,SAAQ,cAAc,CAAC,KAAK,CAAC;IAC9D,iHAAiH;IACjH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC1B,4GAA4G;IAC5G,KAAK,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;IACnC,mCAAmC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB"}
|
package/dist/tooltip/index.js
CHANGED
|
@@ -48,28 +48,31 @@ function h({ asChild: e, style: t, onPointerEnter: i, onPointerLeave: a, onFocus
|
|
|
48
48
|
children: l
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
-
function g({
|
|
52
|
-
let
|
|
53
|
-
return a(
|
|
54
|
-
...
|
|
55
|
-
ref:
|
|
56
|
-
id:
|
|
51
|
+
function g({ side: t = "below", align: n = "center", offset: r = 5, className: s, style: c, onPointerEnter: l, onPointerLeave: f, children: m, ...h }) {
|
|
52
|
+
let g = p("TooltipContent"), _ = u(null);
|
|
53
|
+
return a(_), /* @__PURE__ */ d("div", {
|
|
54
|
+
...h,
|
|
55
|
+
ref: _,
|
|
56
|
+
id: g.id,
|
|
57
57
|
role: "tooltip",
|
|
58
58
|
popover: "manual",
|
|
59
|
-
...
|
|
60
|
-
onPointerEnter:
|
|
61
|
-
onPointerLeave:
|
|
59
|
+
...g.contentProps({
|
|
60
|
+
onPointerEnter: l,
|
|
61
|
+
onPointerLeave: f
|
|
62
62
|
}),
|
|
63
|
+
"data-zen-beside": t === "beside" ? "" : void 0,
|
|
63
64
|
style: {
|
|
64
|
-
...i(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
...i(g.id, {
|
|
66
|
+
side: t,
|
|
67
|
+
align: n,
|
|
68
|
+
offset: r,
|
|
69
|
+
width: t === "beside" ? void 0 : "at-least"
|
|
68
70
|
}),
|
|
69
|
-
...
|
|
71
|
+
...t === "beside" && { marginBlock: 0 },
|
|
72
|
+
...c
|
|
70
73
|
},
|
|
71
|
-
className: e("zen__popover fixed z-50 overflow-visible p-0", o,
|
|
72
|
-
children:
|
|
74
|
+
className: e("zen__popover fixed z-50 overflow-visible p-0", o, s),
|
|
75
|
+
children: m
|
|
73
76
|
});
|
|
74
77
|
}
|
|
75
78
|
//#endregion
|
package/dist/tree/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import e from "../
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { useMessages as e } from "../locale-provider/index.js";
|
|
3
|
+
import t from "../icons/micro/chevron-right.js";
|
|
4
|
+
import { cx as n } from "../utils/cx.js";
|
|
5
|
+
import { readingKey as r } from "../utils/direction.js";
|
|
6
6
|
import { reducedMotion as i } from "../utils/motion.js";
|
|
7
7
|
import { TableCell as a, TableRow as o } from "../table/index.js";
|
|
8
8
|
import { useCallback as s, useMemo as c, useRef as l, useState as u } from "react";
|
|
9
9
|
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
10
10
|
//#region packages/tree/index.tsx
|
|
11
|
-
function p({ items: e, getKey:
|
|
11
|
+
function p({ items: e, getKey: t, getChildren: a, defaultExpanded: o = !0, rowHeight: d = 36 }) {
|
|
12
12
|
let [f, p] = u(() => /* @__PURE__ */ new Set()), [m, h] = u(null), [g, _] = u(null), v = l(null), y = s((e) => f.has(e) !== o, [f, o]), b = c(() => {
|
|
13
|
-
let
|
|
13
|
+
let n = [], r = (e, i, o) => {
|
|
14
14
|
e.forEach((s, c) => {
|
|
15
|
-
let l =
|
|
16
|
-
|
|
15
|
+
let l = t(s), u = a(s), d = !!u?.length, f = d && y(l);
|
|
16
|
+
n.push({
|
|
17
17
|
item: s,
|
|
18
18
|
key: l,
|
|
19
19
|
depth: i,
|
|
@@ -22,23 +22,23 @@ function p({ items: e, getKey: r, getChildren: a, defaultExpanded: o = !0, rowHe
|
|
|
22
22
|
expanded: f,
|
|
23
23
|
position: c + 1,
|
|
24
24
|
siblings: e.length
|
|
25
|
-
}), f &&
|
|
25
|
+
}), f && r(u, i + 1, l);
|
|
26
26
|
});
|
|
27
27
|
};
|
|
28
|
-
return
|
|
28
|
+
return r(e, 0, null), n;
|
|
29
29
|
}, [
|
|
30
30
|
e,
|
|
31
|
-
|
|
31
|
+
t,
|
|
32
32
|
a,
|
|
33
33
|
y
|
|
34
34
|
]), x = () => {
|
|
35
|
-
let
|
|
35
|
+
let n = [], r = (e) => {
|
|
36
36
|
for (let i of e) {
|
|
37
37
|
let e = a(i);
|
|
38
|
-
e?.length && (
|
|
38
|
+
e?.length && (n.push(t(i)), r(e));
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
|
-
return
|
|
41
|
+
return r(e), n;
|
|
42
42
|
}, S = s((e, t) => p((n) => {
|
|
43
43
|
let r = new Set(n);
|
|
44
44
|
return t === o ? r.delete(e) : r.add(e), r;
|
|
@@ -62,12 +62,12 @@ function p({ items: e, getKey: r, getChildren: a, defaultExpanded: o = !0, rowHe
|
|
|
62
62
|
}
|
|
63
63
|
}, [w, T] = u(null), E = b.some((e) => e.key === w) ? w : b[0]?.key ?? null, D = (e) => e.expanded && g !== e.key, O = (e, t) => {
|
|
64
64
|
if (t.target !== t.currentTarget) return;
|
|
65
|
-
let
|
|
66
|
-
if (a === "ArrowDown") i = b[
|
|
67
|
-
else if (a === "ArrowUp") i = b[
|
|
65
|
+
let n = b.indexOf(e), i, a = r(t.key, t.currentTarget);
|
|
66
|
+
if (a === "ArrowDown") i = b[n + 1];
|
|
67
|
+
else if (a === "ArrowUp") i = b[n - 1];
|
|
68
68
|
else if (a === "Home") i = b[0];
|
|
69
69
|
else if (a === "End") i = b.at(-1);
|
|
70
|
-
else if (a === "ArrowRight" && e.hasChildren) D(e) ? i = b[
|
|
70
|
+
else if (a === "ArrowRight" && e.hasChildren) D(e) ? i = b[n + 1] : C(e.key);
|
|
71
71
|
else if (a === "ArrowLeft") D(e) ? C(e.key) : i = b.find((t) => t.key === e.parentKey);
|
|
72
72
|
else return;
|
|
73
73
|
t.preventDefault(), i && t.currentTarget.closest("[role=\"treegrid\"], table")?.querySelector(`[data-tree-key="${CSS.escape(i.key)}"]`)?.focus();
|
|
@@ -93,7 +93,7 @@ function p({ items: e, getKey: r, getChildren: a, defaultExpanded: o = !0, rowHe
|
|
|
93
93
|
t.target === t.currentTarget && T(e.key);
|
|
94
94
|
},
|
|
95
95
|
onKeyDown: (t) => O(e, t),
|
|
96
|
-
className:
|
|
96
|
+
className: n("outline-hidden focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring/60", m && e.parentKey === m.key && "zen__tree-row-enter", g && e.parentKey === g && "zen__tree-row-exit"),
|
|
97
97
|
style: { "--row-h": `${d - 1}px` },
|
|
98
98
|
onAnimationEnd: (t) => {
|
|
99
99
|
t.animationName === "zen-row-close" && g && e.parentKey === g && v.current?.();
|
|
@@ -107,8 +107,8 @@ function p({ items: e, getKey: r, getChildren: a, defaultExpanded: o = !0, rowHe
|
|
|
107
107
|
rowHeight: d
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
|
-
function m({ row: e, tree:
|
|
111
|
-
let l =
|
|
110
|
+
function m({ row: e, tree: t, className: r, style: i, onFocus: a, onKeyDown: s, ...c }) {
|
|
111
|
+
let l = t.rowProps(e);
|
|
112
112
|
return /* @__PURE__ */ d(o, {
|
|
113
113
|
...c,
|
|
114
114
|
...l,
|
|
@@ -118,41 +118,41 @@ function m({ row: e, tree: n, className: r, style: i, onFocus: a, onKeyDown: s,
|
|
|
118
118
|
onKeyDown: (e) => {
|
|
119
119
|
s?.(e), e.defaultPrevented || l.onKeyDown(e);
|
|
120
120
|
},
|
|
121
|
-
className:
|
|
121
|
+
className: n(l.className, r),
|
|
122
122
|
style: {
|
|
123
123
|
...l.style,
|
|
124
124
|
...i
|
|
125
125
|
}
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
|
-
function h({ numeric: e, className:
|
|
128
|
+
function h({ numeric: e, className: t, children: r, ...i }) {
|
|
129
129
|
return /* @__PURE__ */ d(a, {
|
|
130
130
|
numeric: e,
|
|
131
|
-
className:
|
|
131
|
+
className: n("py-0 whitespace-nowrap", t),
|
|
132
132
|
...i,
|
|
133
133
|
children: /* @__PURE__ */ d("div", {
|
|
134
|
-
className:
|
|
134
|
+
className: n("zen__tree-cell flex h-[var(--row-h)] items-center", e && "justify-end"),
|
|
135
135
|
children: r
|
|
136
136
|
})
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
|
-
function g({ row: e, tree:
|
|
139
|
+
function g({ row: e, tree: t, indent: r = 20, children: i, className: a }) {
|
|
140
140
|
return /* @__PURE__ */ f("div", {
|
|
141
|
-
className:
|
|
141
|
+
className: n("flex min-w-0 flex-1 items-center gap-1", a),
|
|
142
142
|
style: { paddingLeft: e.depth * r },
|
|
143
|
-
children: [e.hasChildren ? /* @__PURE__ */ d(_, { ...
|
|
143
|
+
children: [e.hasChildren ? /* @__PURE__ */ d(_, { ...t.toggleProps(e) }) : /* @__PURE__ */ d("span", { className: "-ms-1 w-6 shrink-0" }), i]
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
|
-
function _({ expanded:
|
|
147
|
-
let s =
|
|
146
|
+
function _({ expanded: r, onToggle: i, className: a, ...o }) {
|
|
147
|
+
let s = e();
|
|
148
148
|
return /* @__PURE__ */ d("button", {
|
|
149
149
|
type: "button",
|
|
150
150
|
onClick: i,
|
|
151
|
-
"aria-label":
|
|
152
|
-
"aria-expanded":
|
|
153
|
-
className:
|
|
151
|
+
"aria-label": r ? s.collapse : s.expand,
|
|
152
|
+
"aria-expanded": r,
|
|
153
|
+
className: n("text-muted-foreground hover:bg-tint/[0.08] hover:text-foreground -ms-1 grid size-6 shrink-0 cursor-pointer place-items-center rounded-md outline-hidden transition-colors focus-ring", a),
|
|
154
154
|
...o,
|
|
155
|
-
children: /* @__PURE__ */ d(
|
|
155
|
+
children: /* @__PURE__ */ d(t, { className: n("zen__tree-chevron size-4 transition-transform duration-200 ease-out rtl:-scale-x-100", r && "rotate-90 rtl:-rotate-90") })
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
158
|
//#endregion
|
package/dist/trend/index.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useLocale as e } from "../locale-provider/index.js";
|
|
3
|
+
import { cx as t } from "../utils/cx.js";
|
|
4
4
|
import n from "../icons/micro/arrow-trending-down.js";
|
|
5
5
|
import r from "../icons/micro/arrow-trending-up.js";
|
|
6
6
|
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
7
7
|
//#region packages/trend/index.tsx
|
|
8
8
|
function o({ value: o, good: s = "up", locale: c, format: l, className: u, children: d, ...f }) {
|
|
9
|
-
let p =
|
|
9
|
+
let p = e(c), m = l ?? ((e) => new Intl.NumberFormat(p, {
|
|
10
10
|
style: "percent",
|
|
11
11
|
maximumFractionDigits: 1,
|
|
12
12
|
signDisplay: "exceptZero"
|
|
13
13
|
}).format(e)), h = o > 0 ? "up" : o < 0 ? "down" : "flat", g = h === "up" ? r : h === "down" ? n : null;
|
|
14
14
|
return /* @__PURE__ */ a("span", {
|
|
15
|
-
className:
|
|
15
|
+
className: t("zen__trend inline-flex items-center gap-1.5 text-xs", u),
|
|
16
16
|
...f,
|
|
17
17
|
children: [/* @__PURE__ */ a("span", {
|
|
18
18
|
"data-direction": h,
|
|
19
|
-
className:
|
|
19
|
+
className: t("inline-flex items-center gap-0.5 rounded-md border px-1.5 py-0.5 font-medium whitespace-nowrap tabular-nums", h === "flat" ? "border-tint/10 bg-tint/[0.06] text-muted-foreground" : h === s ? "border-glow/30 bg-glow/10 text-primary" : "border-destructive/40 bg-destructive/10 text-destructive"),
|
|
20
20
|
children: [g && /* @__PURE__ */ i(g, { className: "size-3.5" }), m(o)]
|
|
21
21
|
}), d && /* @__PURE__ */ i("span", {
|
|
22
22
|
className: "text-muted-foreground",
|
package/dist/utils/messages.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../packages/utils/messages.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,OAAO
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../packages/utils/messages.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,OAAO;;;;;;;mBAQD,MAAM;;;;;;;;;;;;;;gBAgBT,MAAM;;;;;;;;;;;;;gCAeU,MAAM;uBACf,MAAM;;;4CAKe,MAAM,cAAc,MAAM;;wBAG9C,MAAM;;4BAEF,MAAM;;;;;;;;;;;;;;;;;;+BAsBH,MAAM;;2BAEV,MAAM,SAAS,MAAM;;;;;;6BAMnB,MAAM;4BACP,MAAM,QAAQ,MAAM;uBACzB,MAAM,UAAU,MAAM;;;;;;aAQhC,MAAM;;;uBAGI,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,SAAS,MAAM;yBAC9C,MAAM,QAAQ,MAAM;qBACxB,MAAM,QAAQ,MAAM;mBACtB,MAAM;;oBAIL,MAAM;qBACL,MAAM,SAAS,MAAM;oBAEtB,MAAM,SAAS,MAAM;oBACrB,MAAM,SAAS,MAAM;oBACrB,MAAM,UAAU,MAAM;sBACpB,MAAM,SAAS,MAAM;wBACnB,MAAM,SAAS,MAAM,SAAS,MAAM;oBAGxC,MAAM,SAAS,MAAM,UAAU,MAAM;kBACvC,MAAM,KAAK,MAAM,KAAK,MAAM;sBACxB,MAAM;;;;2BAOD,MAAM;;;;uBAMV,MAAM;oBACT,MAAM,QAAQ,MAAM;;;;;;;;;;;;;;qBAgBnB,MAAM;;cAEb,MAAM;;;;;;iBAMH,MAAM,SAAS,MAAM;mBACnB,MAAM;;;;;;mBAQN,MAAM,SAAS,MAAM;CACvC,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,OAAO,OAAO,CAAC"}
|
package/dist/utils/messages.js
CHANGED
package/dist/utils/swipe.d.ts
CHANGED
|
@@ -26,4 +26,11 @@ export interface SwipeHandlers {
|
|
|
26
26
|
* it is swallowed.
|
|
27
27
|
*/
|
|
28
28
|
export declare function useSwipe(ref: RefObject<HTMLElement | null>, direction: SwipeDirection | undefined, handlers: SwipeHandlers): void;
|
|
29
|
+
/**
|
|
30
|
+
* A sheet follows a finger swiping it back to its edge, and closes when let go
|
|
31
|
+
* far enough along or flicked; otherwise it springs back. It's moved by the
|
|
32
|
+
* --zen-swipe custom property (a translate), and --zen-swipe-progress (0 to 1)
|
|
33
|
+
* says how far, for its scrim.
|
|
34
|
+
*/
|
|
35
|
+
export declare function useSheetSwipe(ref: RefObject<HTMLElement | null>, side: 'bottom' | 'left' | 'right' | undefined, close: () => void): void;
|
|
29
36
|
//# sourceMappingURL=swipe.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swipe.d.ts","sourceRoot":"","sources":["../../packages/utils/swipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAqB,MAAM,OAAO,CAAC;AAErD,gEAAgE;AAChE,eAAO,MAAM,WAAW,MAAM,CAAC;AAM/B,MAAM,WAAW,cAAc;IAC3B,sEAAsE;IACtE,IAAI,EAAE,GAAG,GAAG,GAAG,GAAG,QAAQ,CAAC;IAC3B,wFAAwF;IACxF,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC1B,0GAA0G;IAC1G,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1B,+DAA+D;IAC/D,OAAO,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,qFAAqF;IACrF,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,8HAA8H;IAC9H,SAAS,CAAC,EAAE,MAAM,MAAM,CAAC;CAC5B;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CACpB,GAAG,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAClC,SAAS,EAAE,cAAc,GAAG,SAAS,EACrC,QAAQ,EAAE,aAAa,QAkG1B"}
|
|
1
|
+
{"version":3,"file":"swipe.d.ts","sourceRoot":"","sources":["../../packages/utils/swipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAqB,MAAM,OAAO,CAAC;AAErD,gEAAgE;AAChE,eAAO,MAAM,WAAW,MAAM,CAAC;AAM/B,MAAM,WAAW,cAAc;IAC3B,sEAAsE;IACtE,IAAI,EAAE,GAAG,GAAG,GAAG,GAAG,QAAQ,CAAC;IAC3B,wFAAwF;IACxF,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC1B,0GAA0G;IAC1G,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1B,+DAA+D;IAC/D,OAAO,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,qFAAqF;IACrF,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,8HAA8H;IAC9H,SAAS,CAAC,EAAE,MAAM,MAAM,CAAC;CAC5B;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CACpB,GAAG,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAClC,SAAS,EAAE,cAAc,GAAG,SAAS,EACrC,QAAQ,EAAE,aAAa,QAkG1B;AAKD;;;;;GAKG;AACH,wBAAgB,aAAa,CACzB,GAAG,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAClC,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,EAC7C,KAAK,EAAE,MAAM,IAAI,QAuBpB"}
|
package/dist/utils/swipe.js
CHANGED
|
@@ -2,25 +2,25 @@
|
|
|
2
2
|
import { useEffect as e, useRef as t } from "react";
|
|
3
3
|
//#region packages/utils/swipe.ts
|
|
4
4
|
var n = .5, r = 100, i = 8;
|
|
5
|
-
function a(n, a,
|
|
6
|
-
let
|
|
5
|
+
function a(n, a, o) {
|
|
6
|
+
let s = t(o);
|
|
7
7
|
e(() => {
|
|
8
|
-
|
|
8
|
+
s.current = o;
|
|
9
9
|
});
|
|
10
10
|
let u = a?.axis, d = a?.sign;
|
|
11
11
|
e(() => {
|
|
12
12
|
let e = n.current;
|
|
13
13
|
if (!e || !u || !d) return;
|
|
14
|
-
let t = u === "y" ? "y" : "x", a = u === "inline" && getComputedStyle(e).direction === "rtl" ? -d : d,
|
|
15
|
-
let t =
|
|
16
|
-
return
|
|
14
|
+
let t = u === "y" ? "y" : "x", a = u === "inline" && getComputedStyle(e).direction === "rtl" ? -d : d, o = null, f = !1, p = (e) => (t === "y" ? e.clientY - o.y : e.clientX - o.x) * a, m = (e) => t === "y" ? e.clientX - o.x : e.clientY - o.y, h = () => {
|
|
15
|
+
let t = o?.on;
|
|
16
|
+
return o = null, t ? (delete e.dataset.swiping, f = !0, !0) : !1;
|
|
17
17
|
}, g = (n) => {
|
|
18
18
|
if (f = !1, n.pointerType === "touch") {
|
|
19
19
|
if (!n.isPrimary) {
|
|
20
|
-
h() &&
|
|
20
|
+
h() && s.current.cancel();
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
c(n.target, e, t) || (o = {
|
|
24
24
|
id: n.pointerId,
|
|
25
25
|
x: n.clientX,
|
|
26
26
|
y: n.clientY,
|
|
@@ -30,25 +30,25 @@ function a(n, a, c) {
|
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
}, _ = (n) => {
|
|
33
|
-
if (!
|
|
34
|
-
let
|
|
35
|
-
if (!
|
|
36
|
-
if (Math.hypot(
|
|
37
|
-
if (
|
|
38
|
-
|
|
33
|
+
if (!o || n.pointerId !== o.id) return;
|
|
34
|
+
let c = p(n);
|
|
35
|
+
if (!o.on) {
|
|
36
|
+
if (Math.hypot(c, m(n)) < i) return;
|
|
37
|
+
if (c <= 0 || Math.abs(m(n)) * 1.5 > c || l(n.target, t, a)) {
|
|
38
|
+
o = null;
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
o.on = !0, e.dataset.swiping = "", e.setPointerCapture?.(n.pointerId);
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
let u =
|
|
45
|
-
u !== void 0 &&
|
|
43
|
+
o.points = [...o.points.filter(([e]) => n.timeStamp - e < r), [n.timeStamp, c]], s.current.move(c);
|
|
44
|
+
let u = s.current.threshold?.();
|
|
45
|
+
u !== void 0 && c > u !== o.past && (o.past = !o.past, navigator.vibrate?.(8));
|
|
46
46
|
}, v = (e) => {
|
|
47
|
-
if (!
|
|
48
|
-
let t = p(e), [n, i] =
|
|
49
|
-
h() && (e.type === "pointerup" ?
|
|
47
|
+
if (!o || e.pointerId !== o.id) return;
|
|
48
|
+
let t = p(e), [n, i] = o.points.find(([t]) => e.timeStamp - t < r) ?? [e.timeStamp, t], a = (t - i) / Math.max(1, e.timeStamp - n);
|
|
49
|
+
h() && (e.type === "pointerup" ? s.current.release(t, a) : s.current.cancel());
|
|
50
50
|
}, y = (e) => {
|
|
51
|
-
|
|
51
|
+
o?.on && e.preventDefault();
|
|
52
52
|
}, b = (e) => {
|
|
53
53
|
f && (f = !1, e.stopPropagation(), e.preventDefault());
|
|
54
54
|
};
|
|
@@ -61,7 +61,27 @@ function a(n, a, c) {
|
|
|
61
61
|
d
|
|
62
62
|
]);
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
var o = .3;
|
|
65
|
+
function s(t, n, r) {
|
|
66
|
+
let i = n === "bottom" ? "y" : "x", s = n === "left" ? -1 : 1, c = () => i === "y" ? t.current.offsetHeight : t.current.offsetWidth, l = () => {
|
|
67
|
+
t.current?.style.removeProperty("--zen-swipe"), t.current?.style.removeProperty("--zen-swipe-progress");
|
|
68
|
+
};
|
|
69
|
+
e(l, [t, n]), a(t, n ? {
|
|
70
|
+
axis: i,
|
|
71
|
+
sign: s
|
|
72
|
+
} : void 0, {
|
|
73
|
+
move: (e) => {
|
|
74
|
+
let n = e > 0 ? e : e / 6;
|
|
75
|
+
t.current.style.setProperty("--zen-swipe", i === "y" ? `0 ${n}px` : `${n * s}px 0`), t.current.style.setProperty("--zen-swipe-progress", String(Math.max(0, Math.min(1, e / c()))));
|
|
76
|
+
},
|
|
77
|
+
release: (e, t) => {
|
|
78
|
+
e > c() * o || e > 0 && t > .5 ? r() : l();
|
|
79
|
+
},
|
|
80
|
+
cancel: l,
|
|
81
|
+
threshold: () => c() * o
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function c(e, t, n) {
|
|
65
85
|
if (e.closest("input, textarea, select, [contenteditable]:not([contenteditable=\"false\"])")) return !0;
|
|
66
86
|
let r = n === "y" ? /pan-(y|up|down)/ : /pan-(x|left|right)/;
|
|
67
87
|
for (let n = e; n && n !== t; n = n.parentElement) {
|
|
@@ -70,7 +90,7 @@ function o(e, t, n) {
|
|
|
70
90
|
}
|
|
71
91
|
return !1;
|
|
72
92
|
}
|
|
73
|
-
function
|
|
93
|
+
function l(e, t, n) {
|
|
74
94
|
for (let r = e; r; r = r.parentElement) {
|
|
75
95
|
let e = getComputedStyle(r), i = t === "y" ? e.overflowY : e.overflowX;
|
|
76
96
|
if (r === r.ownerDocument.scrollingElement ? i === "hidden" || i === "clip" : !/auto|scroll/.test(i)) continue;
|
|
@@ -82,4 +102,4 @@ function s(e, t, n) {
|
|
|
82
102
|
return !1;
|
|
83
103
|
}
|
|
84
104
|
//#endregion
|
|
85
|
-
export { n as FLICK_SPEED, a as useSwipe };
|
|
105
|
+
export { n as FLICK_SPEED, s as useSheetSwipe, a as useSwipe };
|
|
@@ -35,7 +35,8 @@ export declare function anchorFor(id: string): {
|
|
|
35
35
|
* lined up with its start or end edge, or centred on it; `width` makes it as
|
|
36
36
|
* wide as the trigger, or at least as wide. `side: 'beside'` puts it after the
|
|
37
37
|
* trigger instead (before it if there's no room), its top level with the
|
|
38
|
-
* trigger's, as a submenu opens
|
|
38
|
+
* trigger's, as a submenu opens; `align` then lines up the tops (start), the
|
|
39
|
+
* middles (center, as a tooltip beside an icon) or the bottoms (end). For parts that take their own `align`/`offset`
|
|
39
40
|
* (PopoverContent, MenuContent). The same choices are kept as custom
|
|
40
41
|
* properties, for placing it where anchor positioning isn't supported.
|
|
41
42
|
*/
|