@rinzai/zen 0.14.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 +153 -0
- package/README.md +16 -1
- 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.d.ts.map +1 -1
- package/dist/carousel/index.js +29 -29
- 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 +205 -0
- package/dist/docs/accordion.md +122 -0
- package/dist/docs/alert.md +69 -0
- package/dist/docs/animated-number.md +105 -0
- package/dist/docs/avatar.md +91 -0
- package/dist/docs/backdrop.md +94 -0
- package/dist/docs/badge.md +37 -0
- package/dist/docs/breadcrumbs.md +44 -0
- package/dist/docs/button-group.md +76 -0
- package/dist/docs/button.md +131 -0
- package/dist/docs/calendar-heatmap.md +73 -0
- package/dist/docs/calendar.md +101 -0
- package/dist/docs/canvas.md +584 -0
- package/dist/docs/card.md +180 -0
- package/dist/docs/carousel.md +162 -0
- package/dist/docs/chart.md +325 -0
- package/dist/docs/checkbox.md +88 -0
- package/dist/docs/chip.md +52 -0
- package/dist/docs/code-block.md +116 -0
- package/dist/docs/code-input.md +52 -0
- package/dist/docs/collapse.md +46 -0
- package/dist/docs/color-picker.md +145 -0
- package/dist/docs/combobox.md +208 -0
- package/dist/docs/command-palette.md +65 -0
- package/dist/docs/date-picker.md +167 -0
- package/dist/docs/dialog.md +271 -0
- package/dist/docs/disclosure.md +88 -0
- package/dist/docs/editable-cell.md +90 -0
- package/dist/docs/empty-state.md +46 -0
- package/dist/docs/field.md +82 -0
- package/dist/docs/file-drop.md +44 -0
- package/dist/docs/filter-bar.md +66 -0
- package/dist/docs/header.md +51 -0
- package/dist/docs/hover-card.md +110 -0
- package/dist/docs/icon-picker.md +65 -0
- package/dist/docs/input-group.md +89 -0
- package/dist/docs/input.md +33 -0
- package/dist/docs/inset.md +57 -0
- package/dist/docs/kbd.md +34 -0
- package/dist/docs/keypad.md +51 -0
- package/dist/docs/load-more.md +66 -0
- package/dist/docs/locale-provider.md +99 -0
- package/dist/docs/marquee.md +86 -0
- package/dist/docs/menu.md +456 -0
- package/dist/docs/meter.md +102 -0
- package/dist/docs/money-input.md +169 -0
- package/dist/docs/month-picker.md +80 -0
- package/dist/docs/navigation-menu.md +157 -0
- package/dist/docs/number-field.md +129 -0
- package/dist/docs/page-header.md +44 -0
- package/dist/docs/page-transition.md +93 -0
- package/dist/docs/pagination.md +42 -0
- package/dist/docs/pills.md +85 -0
- package/dist/docs/player-bar.md +158 -0
- package/dist/docs/popover.md +200 -0
- package/dist/docs/progress-ring.md +70 -0
- package/dist/docs/radio-cards.md +82 -0
- package/dist/docs/radio-group.md +86 -0
- package/dist/docs/range-slider.md +64 -0
- package/dist/docs/repeat-picker.md +44 -0
- package/dist/docs/resizable.md +107 -0
- package/dist/docs/seek-bar.md +97 -0
- package/dist/docs/segmented.md +89 -0
- package/dist/docs/select.md +148 -0
- package/dist/docs/separator.md +76 -0
- package/dist/docs/side-nav.md +75 -0
- package/dist/docs/skeleton.md +89 -0
- package/dist/docs/slider.md +87 -0
- package/dist/docs/sortable.md +244 -0
- package/dist/docs/sparkline.md +56 -0
- package/dist/docs/spinner.md +69 -0
- package/dist/docs/status-pill.md +81 -0
- package/dist/docs/stepper.md +59 -0
- package/dist/docs/tab-bar.md +78 -0
- package/dist/docs/table-of-contents.md +43 -0
- package/dist/docs/table.md +714 -0
- package/dist/docs/tabs.md +140 -0
- package/dist/docs/tag-input.md +45 -0
- package/dist/docs/textarea.md +25 -0
- package/dist/docs/theme-toggle.md +85 -0
- package/dist/docs/theming.md +193 -0
- package/dist/docs/time-field.md +71 -0
- package/dist/docs/timeline.md +50 -0
- package/dist/docs/toast.md +53 -0
- package/dist/docs/toggle-group.md +83 -0
- package/dist/docs/toggle.md +38 -0
- package/dist/docs/toolbar.md +97 -0
- package/dist/docs/tooltip.md +102 -0
- package/dist/docs/tree.md +295 -0
- package/dist/docs/trend.md +50 -0
- 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/icons/arrow-path.d.ts +3 -0
- package/dist/icons/arrow-path.d.ts.map +1 -0
- package/dist/icons/arrows-right-left.d.ts +3 -0
- package/dist/icons/arrows-right-left.d.ts.map +1 -0
- package/dist/icons/backward.d.ts +3 -0
- package/dist/icons/backward.d.ts.map +1 -0
- package/dist/icons/forward.d.ts +3 -0
- package/dist/icons/forward.d.ts.map +1 -0
- package/dist/icons/heart-solid.d.ts +3 -0
- package/dist/icons/heart-solid.d.ts.map +1 -0
- package/dist/icons/heart.d.ts +3 -0
- package/dist/icons/heart.d.ts.map +1 -0
- package/dist/icons/musical-note.d.ts +3 -0
- package/dist/icons/musical-note.d.ts.map +1 -0
- package/dist/icons/pause.d.ts +3 -0
- package/dist/icons/pause.d.ts.map +1 -0
- package/dist/icons/play.d.ts +3 -0
- package/dist/icons/play.d.ts.map +1 -0
- package/dist/icons/queue-list.d.ts +3 -0
- package/dist/icons/queue-list.d.ts.map +1 -0
- package/dist/icons/speaker-wave.d.ts +3 -0
- package/dist/icons/speaker-wave.d.ts.map +1 -0
- package/dist/icons/speaker-x-mark.d.ts +3 -0
- package/dist/icons/speaker-x-mark.d.ts.map +1 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/keypad/index.js +5 -5
- package/dist/lib.js +86 -80
- package/dist/load-more/index.js +5 -5
- package/dist/marquee/index.d.ts +15 -0
- package/dist/marquee/index.d.ts.map +1 -0
- package/dist/marquee/index.js +90 -0
- package/dist/menu/index.d.ts +7 -1
- package/dist/menu/index.d.ts.map +1 -1
- package/dist/menu/index.js +222 -178
- 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/player-bar/index.d.ts +11 -0
- package/dist/player-bar/index.d.ts.map +1 -0
- package/dist/player-bar/index.js +17 -0
- package/dist/radio-cards/index.d.ts +2 -1
- package/dist/radio-cards/index.d.ts.map +1 -1
- package/dist/radio-cards/index.js +3 -3
- 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 +26 -0
- package/dist/seek-bar/index.d.ts.map +1 -0
- package/dist/seek-bar/index.js +121 -0
- package/dist/segmented/index.d.ts +3 -2
- package/dist/segmented/index.d.ts.map +1 -1
- package/dist/segmented/index.js +19 -18
- package/dist/select/index.js +21 -21
- package/dist/slider/index.d.ts +2 -1
- package/dist/slider/index.d.ts.map +1 -1
- 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/tab-bar/index.d.ts +4 -2
- package/dist/tab-bar/index.d.ts.map +1 -1
- package/dist/tab-bar/index.js +24 -19
- 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/textarea/index.d.ts +6 -2
- package/dist/textarea/index.d.ts.map +1 -1
- package/dist/textarea/index.js +2 -1
- package/dist/theme-toggle/index.js +4 -4
- package/dist/theme.css +143 -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/duration.d.ts +3 -0
- package/dist/utils/duration.d.ts.map +1 -0
- package/dist/utils/duration.js +7 -0
- package/dist/utils/messages.d.ts +3 -0
- package/dist/utils/messages.d.ts.map +1 -1
- package/dist/utils/messages.js +4 -1
- package/dist/utils/slot.d.ts +5 -2
- package/dist/utils/slot.d.ts.map +1 -1
- package/dist/utils/slot.js +16 -11
- 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 +10 -5
- package/dist/utils/useHeightVar.d.ts +7 -0
- package/dist/utils/useHeightVar.d.ts.map +1 -0
- package/dist/utils/useHeightVar.js +17 -0
- package/dist/utils/useMediaPlayer.d.ts +38 -0
- package/dist/utils/useMediaPlayer.d.ts.map +1 -0
- package/dist/utils/useMediaPlayer.js +91 -0
- package/dist/utils/useMediaSession.d.ts +24 -0
- package/dist/utils/useMediaSession.d.ts.map +1 -0
- package/dist/utils/useMediaSession.js +76 -0
- 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 +4 -2
package/dist/table/selection.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useMessages as e } from "../locale-provider/index.js";
|
|
3
|
+
import { cx as t } from "../utils/cx.js";
|
|
4
4
|
import n from "../icons/micro/x-mark.js";
|
|
5
5
|
import r from "../checkbox/index.js";
|
|
6
6
|
import { useRef as i, useState as a } from "react";
|
|
@@ -29,13 +29,13 @@ function c(e) {
|
|
|
29
29
|
})
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
function l({ checked:
|
|
32
|
+
function l({ checked: e, onSelect: n, label: i, className: a, ...s }) {
|
|
33
33
|
return /* @__PURE__ */ o("td", {
|
|
34
|
-
className:
|
|
34
|
+
className: t("border-tint/[0.045] w-10 border-b py-2.5 ps-3 pe-0", a),
|
|
35
35
|
...s,
|
|
36
36
|
children: /* @__PURE__ */ o(r, {
|
|
37
37
|
"aria-label": i,
|
|
38
|
-
checked:
|
|
38
|
+
checked: e,
|
|
39
39
|
onClick: (e) => n(e.currentTarget.checked, e.shiftKey),
|
|
40
40
|
onCheckedChange: () => {},
|
|
41
41
|
className: "touch-target grid"
|
|
@@ -43,9 +43,9 @@ function l({ checked: t, onSelect: n, label: i, className: a, ...s }) {
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
function u({ checked: n, indeterminate: i, onSelect: a, label: s, className: c, ...l }) {
|
|
46
|
-
let u =
|
|
46
|
+
let u = e(), d = s ?? u.selectAll;
|
|
47
47
|
return /* @__PURE__ */ o("th", {
|
|
48
|
-
className:
|
|
48
|
+
className: t("w-10 py-2.5 ps-3 pe-0", c),
|
|
49
49
|
...l,
|
|
50
50
|
children: /* @__PURE__ */ o(r, {
|
|
51
51
|
"aria-label": d,
|
|
@@ -57,11 +57,11 @@ function u({ checked: n, indeterminate: i, onSelect: a, label: s, className: c,
|
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
function d({ count: r, onClear: i, label: a, clearLabel: c, className: l, children: u }) {
|
|
60
|
-
let d =
|
|
60
|
+
let d = e(), f = a ?? d.selectedCount, p = c ?? d.clearSelection;
|
|
61
61
|
return r === 0 ? null : /* @__PURE__ */ s("div", {
|
|
62
62
|
role: "toolbar",
|
|
63
63
|
"aria-label": d.selection,
|
|
64
|
-
className:
|
|
64
|
+
className: t("zen__selection-bar glass glass-blur glow-edge fixed inset-x-0 bottom-6 z-40 mx-auto flex w-fit max-w-[calc(100vw-2rem)] items-center gap-2 rounded-2xl py-2 ps-4 pe-2 shadow-[0_12px_40px_-12px_oklch(0_0_0/0.6)]", l),
|
|
65
65
|
children: [
|
|
66
66
|
/* @__PURE__ */ o("span", {
|
|
67
67
|
className: "text-sm font-medium whitespace-nowrap tabular-nums",
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useMessages as e } from "../locale-provider/index.js";
|
|
3
|
+
import { cx as t } from "../utils/cx.js";
|
|
4
4
|
import { followSectionLink as n } from "../utils/section-link.js";
|
|
5
5
|
import { useEffect as r, useState as i } from "react";
|
|
6
6
|
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
7
|
//#region packages/table-of-contents/index.tsx
|
|
8
8
|
function s({ items: s, title: c, className: l, ...u }) {
|
|
9
|
-
let d =
|
|
9
|
+
let d = e(), f = c ?? d.onThisPage, [p, m] = i();
|
|
10
10
|
return r(() => {
|
|
11
11
|
if (typeof IntersectionObserver > "u") return;
|
|
12
12
|
let e = s.map((e) => document.getElementById(e.id)).filter((e) => !!e), t = /* @__PURE__ */ new Set(), n = new IntersectionObserver((e) => {
|
|
@@ -18,22 +18,22 @@ function s({ items: s, title: c, className: l, ...u }) {
|
|
|
18
18
|
}, [s]), s.length ? /* @__PURE__ */ o("nav", {
|
|
19
19
|
"aria-label": f || d.onThisPage,
|
|
20
20
|
...u,
|
|
21
|
-
className:
|
|
21
|
+
className: t("zen__toc flex flex-col gap-3", l),
|
|
22
22
|
children: [f && /* @__PURE__ */ a("p", {
|
|
23
23
|
className: "text-muted-foreground text-2xs mt-0! tracking-widest uppercase",
|
|
24
24
|
children: f
|
|
25
25
|
}), /* @__PURE__ */ a("ul", {
|
|
26
26
|
className: "border-tint/[0.07] flex flex-col gap-2 border-l text-sm",
|
|
27
|
-
children: s.map((
|
|
28
|
-
className:
|
|
27
|
+
children: s.map((e) => /* @__PURE__ */ a("li", {
|
|
28
|
+
className: t("-ms-px", e.depth === 2 && "ps-3"),
|
|
29
29
|
children: /* @__PURE__ */ a("a", {
|
|
30
|
-
href: `#${
|
|
30
|
+
href: `#${e.id}`,
|
|
31
31
|
onClick: n,
|
|
32
|
-
"aria-current":
|
|
33
|
-
className:
|
|
34
|
-
children:
|
|
32
|
+
"aria-current": e.id === p ? "location" : void 0,
|
|
33
|
+
className: t("text-muted-foreground hover:text-foreground block border-s border-transparent ps-3 transition-colors pointer-coarse:py-1.5", "aria-[current=location]:border-primary aria-[current=location]:text-foreground"),
|
|
34
|
+
children: e.label
|
|
35
35
|
})
|
|
36
|
-
},
|
|
36
|
+
}, e.id))
|
|
37
37
|
})]
|
|
38
38
|
}) : null;
|
|
39
39
|
}
|
package/dist/tag-input/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 { useControllable as n } from "../utils/useControllable.js";
|
|
5
5
|
import { useFieldProps as r } from "../field/index.js";
|
|
6
6
|
import { FIELD as i } from "../utils/styles.js";
|
|
7
7
|
import { FormValue as a } from "../utils/form-value.js";
|
|
@@ -10,7 +10,7 @@ import { useLayoutEffect as s, useRef as c, useState as l } from "react";
|
|
|
10
10
|
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
11
11
|
//#region packages/tag-input/index.tsx
|
|
12
12
|
function f({ value: f, defaultValue: p = [], onValueChange: m, validate: h, removeLabel: g, className: _, disabled: v, name: y, ...b }) {
|
|
13
|
-
let x =
|
|
13
|
+
let x = e(), S = g ?? x.remove, [C, w, T] = n(f, p, m), [E, D] = l(""), O = r(b), k = c(null), A = C.length;
|
|
14
14
|
s(() => {
|
|
15
15
|
let e = k.current;
|
|
16
16
|
e?.parentElement?.contains(document.activeElement) && (e.scrollTop = e.scrollHeight);
|
|
@@ -21,7 +21,7 @@ function f({ value: f, defaultValue: p = [], onValueChange: m, validate: h, remo
|
|
|
21
21
|
t.length !== C.length && w(t);
|
|
22
22
|
};
|
|
23
23
|
return /* @__PURE__ */ d("div", {
|
|
24
|
-
className:
|
|
24
|
+
className: t("zen__tag-input", i, "flex h-auto max-h-36 min-h-10 w-full cursor-text flex-col gap-1.5 py-1.5", "has-[input:focus-visible]:border-glow/60 has-[input:focus-visible]:bg-tint/[0.05] has-[input:focus-visible]:shadow-glow-focus has-[input:focus-visible]:[--glow-border-color:transparent]", v && "cursor-not-allowed opacity-50", _),
|
|
25
25
|
onClick: (e) => e.currentTarget.querySelector("input")?.focus(),
|
|
26
26
|
children: [
|
|
27
27
|
A > 0 && /* @__PURE__ */ u("div", {
|
package/dist/textarea/index.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { ComponentProps } from 'react';
|
|
2
|
-
export default function Textarea(props:
|
|
3
|
-
export type
|
|
2
|
+
export default function Textarea(props: TextareaProps): import('react').JSX.Element;
|
|
3
|
+
export type TextareaProps = ComponentProps<'textarea'>;
|
|
4
|
+
/** @deprecated Renamed Textarea, like the element. */
|
|
5
|
+
export declare const TextArea: typeof Textarea;
|
|
6
|
+
/** @deprecated Renamed TextareaProps. */
|
|
7
|
+
export type TextAreaProps = TextareaProps;
|
|
4
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/textarea/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAK,EAAE,aAAa,+BAiBpD;AAED,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/textarea/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAK,EAAE,aAAa,+BAiBpD;AAED,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC;AAEvD,sDAAsD;AACtD,eAAO,MAAM,QAAQ,iBAAW,CAAC;AACjC,yCAAyC;AACzC,MAAM,MAAM,aAAa,GAAG,aAAa,CAAC"}
|
package/dist/textarea/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useMessages as e } from "../locale-provider/index.js";
|
|
3
|
+
import { cx as t } from "../utils/cx.js";
|
|
4
4
|
import n from "../icons/micro/moon.js";
|
|
5
5
|
import r from "../icons/micro/sun.js";
|
|
6
6
|
import { prepareThemeWave as i, themeWave as a } from "../utils/theme-wave.js";
|
|
@@ -25,7 +25,7 @@ function f(e) {
|
|
|
25
25
|
}
|
|
26
26
|
var p = () => document.documentElement.classList.contains("light") ? "light" : "dark";
|
|
27
27
|
function m({ value: l, onValueChange: u, target: m, storageKey: h = "theme", className: g, ..._ }) {
|
|
28
|
-
let v = o(f, p, () => "dark"), y = l ?? v, b = y === "dark" ? "light" : "dark", x =
|
|
28
|
+
let v = o(f, p, () => "dark"), y = l ?? v, b = y === "dark" ? "light" : "dark", x = e();
|
|
29
29
|
return /* @__PURE__ */ s("button", {
|
|
30
30
|
type: "button",
|
|
31
31
|
"aria-label": b === "dark" ? x.switchToDark : x.switchToLight,
|
|
@@ -44,7 +44,7 @@ function m({ value: l, onValueChange: u, target: m, storageKey: h = "theme", cla
|
|
|
44
44
|
u?.(b), d.forEach((e) => e());
|
|
45
45
|
});
|
|
46
46
|
}, e.currentTarget, m?.current),
|
|
47
|
-
className:
|
|
47
|
+
className: t("zen__theme-toggle text-muted-foreground hover:bg-tint/[0.06] hover:text-foreground grid size-10 cursor-pointer place-items-center rounded-lg outline-hidden focus-ring", g),
|
|
48
48
|
children: s(y === "dark" ? n : r, { className: "size-4" })
|
|
49
49
|
});
|
|
50
50
|
}
|
package/dist/theme.css
CHANGED
|
@@ -1156,6 +1156,109 @@ html.zen-theme-closing::view-transition-old(zen-theme-area) {
|
|
|
1156
1156
|
translate: -100% 0;
|
|
1157
1157
|
}
|
|
1158
1158
|
}
|
|
1159
|
+
/*
|
|
1160
|
+
* A menu as a bottom sheet on phones (MenuContent's `sheet`): across the
|
|
1161
|
+
* bottom of the screen over a scrim, sliding up and following a finger
|
|
1162
|
+
* swiping it back down. A submenu slides in over it from the side, and the
|
|
1163
|
+
* menu moves aside; it slides back out the same way, or goes down with the
|
|
1164
|
+
* menu. Anchoring is set inline, hence !important. --zen-sheet tells the
|
|
1165
|
+
* scripts it's a sheet now (no opening submenus on hover).
|
|
1166
|
+
*/
|
|
1167
|
+
@media (width < theme(--breakpoint-md)) {
|
|
1168
|
+
.zen__popover[data-zen-sheet] {
|
|
1169
|
+
--zen-sheet: 1;
|
|
1170
|
+
position: fixed;
|
|
1171
|
+
position-area: none !important;
|
|
1172
|
+
position-try-fallbacks: none !important;
|
|
1173
|
+
position-visibility: always;
|
|
1174
|
+
/* Edge to edge, over a scrollbar's gutter too. */
|
|
1175
|
+
inset: auto auto 0 0 !important;
|
|
1176
|
+
justify-self: auto !important;
|
|
1177
|
+
width: 100vw !important;
|
|
1178
|
+
min-width: 0 !important;
|
|
1179
|
+
max-height: 85dvh;
|
|
1180
|
+
overflow-y: auto;
|
|
1181
|
+
overscroll-behavior: contain;
|
|
1182
|
+
margin: 0 !important;
|
|
1183
|
+
padding: 0.5rem 0.5rem calc(0.75rem + env(safe-area-inset-bottom));
|
|
1184
|
+
border-width: 1px 0 0;
|
|
1185
|
+
border-radius: 1rem 1rem 0 0;
|
|
1186
|
+
background-color: oklch(var(--card) / 0.9);
|
|
1187
|
+
pointer-events: auto;
|
|
1188
|
+
translate: var(--zen-swipe, 0 0);
|
|
1189
|
+
will-change: translate;
|
|
1190
|
+
transition:
|
|
1191
|
+
translate 320ms var(--ease-out-soft),
|
|
1192
|
+
opacity 200ms,
|
|
1193
|
+
overlay 320ms allow-discrete,
|
|
1194
|
+
display 320ms allow-discrete;
|
|
1195
|
+
}
|
|
1196
|
+
.zen__popover[data-zen-sheet]:not(:popover-open) {
|
|
1197
|
+
translate: 0 100%;
|
|
1198
|
+
}
|
|
1199
|
+
.zen__popover:popover-open .zen__popover[data-zen-sheet][data-zen-beside]:not(:popover-open) {
|
|
1200
|
+
translate: 100% 0;
|
|
1201
|
+
}
|
|
1202
|
+
.zen__popover:popover-open .zen__popover[data-zen-sheet][data-zen-beside]:not(:popover-open):dir(rtl) {
|
|
1203
|
+
translate: -100% 0;
|
|
1204
|
+
}
|
|
1205
|
+
/* Under an open submenu (in the top layer, so it's not moved with it). */
|
|
1206
|
+
.zen__popover[data-zen-sheet]:popover-open:has(.zen__popover[data-zen-sheet]:popover-open) {
|
|
1207
|
+
translate: -30% 0;
|
|
1208
|
+
opacity: 0;
|
|
1209
|
+
pointer-events: none;
|
|
1210
|
+
}
|
|
1211
|
+
.zen__popover[data-zen-sheet]:popover-open:has(.zen__popover[data-zen-sheet]:popover-open):dir(rtl) {
|
|
1212
|
+
translate: 30% 0;
|
|
1213
|
+
}
|
|
1214
|
+
.zen__popover[data-zen-sheet] [role^='menuitem'] {
|
|
1215
|
+
min-height: 3rem;
|
|
1216
|
+
}
|
|
1217
|
+
.zen__popover[data-zen-sheet] .zen__sheet-only {
|
|
1218
|
+
display: revert-layer;
|
|
1219
|
+
}
|
|
1220
|
+
.zen__popover[data-zen-sheet]::backdrop {
|
|
1221
|
+
background: var(--backdrop-scrim, oklch(0 0 0 / 0.5));
|
|
1222
|
+
opacity: calc(1 - var(--zen-swipe-progress, 0));
|
|
1223
|
+
transition:
|
|
1224
|
+
opacity 200ms,
|
|
1225
|
+
overlay 320ms allow-discrete,
|
|
1226
|
+
display 320ms allow-discrete;
|
|
1227
|
+
}
|
|
1228
|
+
.zen__popover[data-zen-sheet]:not(:popover-open)::backdrop {
|
|
1229
|
+
opacity: 0;
|
|
1230
|
+
}
|
|
1231
|
+
/* The menu's scrim is behind a submenu already. */
|
|
1232
|
+
.zen__popover[data-zen-sheet][data-zen-beside]::backdrop {
|
|
1233
|
+
background: none;
|
|
1234
|
+
}
|
|
1235
|
+
.zen__popover[data-zen-sheet][data-swiping],
|
|
1236
|
+
.zen__popover[data-zen-sheet][data-swiping]::backdrop {
|
|
1237
|
+
transition: none;
|
|
1238
|
+
user-select: none;
|
|
1239
|
+
}
|
|
1240
|
+
:root:has(.zen__popover[data-zen-sheet]:popover-open) {
|
|
1241
|
+
overflow: hidden;
|
|
1242
|
+
}
|
|
1243
|
+
@starting-style {
|
|
1244
|
+
.zen__popover[data-zen-sheet]:popover-open {
|
|
1245
|
+
translate: 0 100%;
|
|
1246
|
+
}
|
|
1247
|
+
.zen__popover[data-zen-sheet][data-zen-beside]:popover-open {
|
|
1248
|
+
translate: 100% 0;
|
|
1249
|
+
}
|
|
1250
|
+
.zen__popover[data-zen-sheet][data-zen-beside]:popover-open:dir(rtl) {
|
|
1251
|
+
translate: -100% 0;
|
|
1252
|
+
}
|
|
1253
|
+
.zen__popover[data-zen-sheet]:popover-open::backdrop {
|
|
1254
|
+
opacity: 0;
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
/* What only a sheet shows: its grip, a submenu's way back. */
|
|
1259
|
+
.zen__sheet-only {
|
|
1260
|
+
display: none;
|
|
1261
|
+
}
|
|
1159
1262
|
/*
|
|
1160
1263
|
* The page behind a modal dialog doesn't scroll. Hiding the overflow removes
|
|
1161
1264
|
* the scrollbar, so where the page had one (Dialog sets data-zen-scrollbar),
|
|
@@ -1592,3 +1695,43 @@ html.reduce-motion .rise-list > * {
|
|
|
1592
1695
|
animation-iteration-count: 1 !important;
|
|
1593
1696
|
transition-duration: 0.01ms !important;
|
|
1594
1697
|
}
|
|
1698
|
+
|
|
1699
|
+
/*
|
|
1700
|
+
* Marquee: an ellipsis at rest. While it scrolls (data-moving, set with its
|
|
1701
|
+
* animation) the text is one box to slide, cut off by fades at both edges; the
|
|
1702
|
+
* start's fade grows in as the text leaves it.
|
|
1703
|
+
*/
|
|
1704
|
+
@property --zen-marquee-fade-start {
|
|
1705
|
+
syntax: '<length>';
|
|
1706
|
+
inherits: false;
|
|
1707
|
+
initial-value: 0px;
|
|
1708
|
+
}
|
|
1709
|
+
.zen__marquee {
|
|
1710
|
+
display: block;
|
|
1711
|
+
min-width: 0;
|
|
1712
|
+
overflow: hidden;
|
|
1713
|
+
white-space: nowrap;
|
|
1714
|
+
text-overflow: ellipsis;
|
|
1715
|
+
}
|
|
1716
|
+
.zen__marquee[data-moving] {
|
|
1717
|
+
text-overflow: clip;
|
|
1718
|
+
mask-image: linear-gradient(
|
|
1719
|
+
to right,
|
|
1720
|
+
transparent,
|
|
1721
|
+
#000 var(--zen-marquee-fade-start),
|
|
1722
|
+
#000 calc(100% - 1rem),
|
|
1723
|
+
transparent
|
|
1724
|
+
);
|
|
1725
|
+
}
|
|
1726
|
+
.zen__marquee[data-moving]:dir(rtl) {
|
|
1727
|
+
mask-image: linear-gradient(
|
|
1728
|
+
to left,
|
|
1729
|
+
transparent,
|
|
1730
|
+
#000 var(--zen-marquee-fade-start),
|
|
1731
|
+
#000 calc(100% - 1rem),
|
|
1732
|
+
transparent
|
|
1733
|
+
);
|
|
1734
|
+
}
|
|
1735
|
+
.zen__marquee[data-moving] > .zen__marquee-content {
|
|
1736
|
+
display: inline-block;
|
|
1737
|
+
}
|
package/dist/time-field/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { useLocale as e, useMessages as t } from "../locale-provider/index.js";
|
|
3
|
+
import { cx as n } from "../utils/cx.js";
|
|
4
|
+
import { readingKey as r } from "../utils/direction.js";
|
|
5
|
+
import { useControllable as i } from "../utils/useControllable.js";
|
|
6
6
|
import { useField as a } from "../field/index.js";
|
|
7
7
|
import { FIELD_SIZE as o, FIELD_WITHIN as s } from "../utils/styles.js";
|
|
8
8
|
import { FormValue as c } from "../utils/form-value.js";
|
|
@@ -11,21 +11,21 @@ import { useMemo as u, useRef as d, useState as f } from "react";
|
|
|
11
11
|
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
12
12
|
//#region packages/time-field/index.tsx
|
|
13
13
|
function h({ value: l, defaultValue: h = null, onValueChange: _, step: v = 1, locale: y, name: b, size: x = "default", invalid: S, disabled: C, className: w, onMouseDown: T, ...E }) {
|
|
14
|
-
let D =
|
|
14
|
+
let D = t(), O = a(), k = e(y), A = u(() => new g(k), [k]), [j, M, N] = i(l, h, _), [P, F] = f(null), I = P ?? A.split(j), L = d(""), R = (e) => {
|
|
15
15
|
let t = A.join(e);
|
|
16
16
|
F(t === null ? e : null), t !== j && M(t);
|
|
17
|
-
}, z = (e,
|
|
18
|
-
let
|
|
17
|
+
}, z = (e, t) => {
|
|
18
|
+
let n = r(e.key, e.currentTarget), i = (t) => {
|
|
19
19
|
let n = [...e.currentTarget.parentElement.querySelectorAll("[role=spinbutton]")];
|
|
20
20
|
n[n.indexOf(e.currentTarget) + t]?.focus();
|
|
21
21
|
};
|
|
22
|
-
if (
|
|
23
|
-
if (
|
|
24
|
-
if (
|
|
22
|
+
if (n === "ArrowLeft" || n === "ArrowRight") return e.preventDefault(), i(n === "ArrowLeft" ? -1 : 1);
|
|
23
|
+
if (n === "ArrowUp" || n === "ArrowDown") return e.preventDefault(), L.current = "", R(A.step(I, t, n === "ArrowUp" ? 1 : -1, v));
|
|
24
|
+
if (n === "Backspace" || n === "Delete") return e.preventDefault(), L.current = "", R({
|
|
25
25
|
...I,
|
|
26
|
-
[
|
|
26
|
+
[t === "dayPeriod" ? "period" : t]: null
|
|
27
27
|
});
|
|
28
|
-
if (
|
|
28
|
+
if (t === "dayPeriod") {
|
|
29
29
|
let t = A.periodFor(e.key);
|
|
30
30
|
return t === null ? void 0 : (e.preventDefault(), R({
|
|
31
31
|
...I,
|
|
@@ -35,18 +35,18 @@ function h({ value: l, defaultValue: h = null, onValueChange: _, step: v = 1, lo
|
|
|
35
35
|
let a = A.digit(e.key);
|
|
36
36
|
if (a === null) return;
|
|
37
37
|
e.preventDefault();
|
|
38
|
-
let { n: o, done: s } = A.type(
|
|
38
|
+
let { n: o, done: s } = A.type(t, L.current + a);
|
|
39
39
|
L.current = s ? "" : L.current + a, R({
|
|
40
40
|
...I,
|
|
41
|
-
[
|
|
41
|
+
[t]: o
|
|
42
42
|
}), s && i(1);
|
|
43
|
-
}, B = A.order.map((
|
|
44
|
-
if (
|
|
43
|
+
}, B = A.order.map((e, t) => {
|
|
44
|
+
if (e.type === "literal") return /* @__PURE__ */ p("span", {
|
|
45
45
|
"aria-hidden": !0,
|
|
46
46
|
className: "text-muted-foreground whitespace-pre",
|
|
47
|
-
children:
|
|
48
|
-
},
|
|
49
|
-
let r =
|
|
47
|
+
children: e.value
|
|
48
|
+
}, t);
|
|
49
|
+
let r = e.type, i = r === "dayPeriod" ? I.period : I[r], a = {
|
|
50
50
|
hour: D.hour,
|
|
51
51
|
minute: D.minute,
|
|
52
52
|
dayPeriod: D.dayPeriod
|
|
@@ -62,7 +62,7 @@ function h({ value: l, defaultValue: h = null, onValueChange: _, step: v = 1, lo
|
|
|
62
62
|
"aria-disabled": C || void 0,
|
|
63
63
|
onKeyDown: C ? void 0 : (e) => z(e, r),
|
|
64
64
|
onFocus: () => L.current = "",
|
|
65
|
-
className:
|
|
65
|
+
className: n("zen__time-segment rounded-sm px-0.5 tabular-nums outline-hidden caret-transparent select-none", "focus:bg-primary/20 focus:text-foreground", o === null && "text-muted-foreground"),
|
|
66
66
|
children: o ?? "––"
|
|
67
67
|
}, r);
|
|
68
68
|
});
|
|
@@ -75,7 +75,7 @@ function h({ value: l, defaultValue: h = null, onValueChange: _, step: v = 1, lo
|
|
|
75
75
|
onMouseDown: (e) => {
|
|
76
76
|
T?.(e), !(e.defaultPrevented || e.target.closest("[role=spinbutton]")) && (e.preventDefault(), e.currentTarget.querySelector("[role=spinbutton]")?.focus());
|
|
77
77
|
},
|
|
78
|
-
className:
|
|
78
|
+
className: n("zen__time-field", s, o[x], "w-fit cursor-text gap-0", C && "bg-muted text-muted-foreground cursor-not-allowed opacity-50", "data-invalid:border-destructive", w),
|
|
79
79
|
children: [B, /* @__PURE__ */ p(c, {
|
|
80
80
|
name: b,
|
|
81
81
|
value: j ?? "",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/toast/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAIH,SAAS,EACT,SAAS,EAMZ,MAAM,OAAO,CAAC;AAKf,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AAE5D,MAAM,WAAW,YAAY;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,sCAAsC;IACtC,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC;IAChD,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AA4BD,MAAM,WAAW,kBAAkB;IAC/B,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qEAAqE;IACrE,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,iBAAiB,EAAE,EAAE,kBAAkB,+
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/toast/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAIH,SAAS,EACT,SAAS,EAMZ,MAAM,OAAO,CAAC;AAKf,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AAE5D,MAAM,WAAW,YAAY;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,sCAAsC;IACtC,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC;IAChD,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AA4BD,MAAM,WAAW,kBAAkB;IAC/B,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qEAAqE;IACrE,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,iBAAiB,EAAE,EAAE,kBAAkB,+BAiKhG;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,QAO/E;AAYD,+EAA+E;AAC/E,wBAAgB,QAAQ,YAlNoB,MAAM,YAAY,YAAY,KAAK,MAAM,CAsNpF"}
|
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
|