@rinzai/zen 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +27 -0
- package/README.md +12 -4
- package/dist/alert/index.d.ts +21 -0
- package/dist/alert/index.d.ts.map +1 -0
- package/dist/alert/index.js +49 -0
- package/dist/button/index.d.ts +2 -1
- package/dist/button/index.d.ts.map +1 -1
- package/dist/button/index.js +43 -12
- package/dist/calendar/index.d.ts.map +1 -1
- package/dist/calendar/index.js +86 -85
- package/dist/chart/donut.d.ts +4 -1
- package/dist/chart/donut.d.ts.map +1 -1
- package/dist/chart/donut.js +81 -60
- package/dist/chart/index.d.ts +8 -2
- package/dist/chart/index.d.ts.map +1 -1
- package/dist/chart/index.js +151 -139
- package/dist/chart/palette.d.ts +11 -0
- package/dist/chart/palette.d.ts.map +1 -0
- package/dist/chart/palette.js +9 -0
- package/dist/chart/tooltip.d.ts +6 -2
- package/dist/chart/tooltip.d.ts.map +1 -1
- package/dist/chart/tooltip.js +6 -6
- package/dist/checkbox/index.d.ts.map +1 -1
- package/dist/checkbox/index.js +28 -44
- package/dist/chip/index.js +1 -1
- package/dist/code-block/index.js +1 -1
- package/dist/combobox/index.d.ts.map +1 -1
- package/dist/combobox/index.js +93 -91
- package/dist/date-picker/index.d.ts.map +1 -1
- package/dist/date-picker/index.js +24 -38
- package/dist/disclosure/index.js +1 -1
- package/dist/editable-cell/index.js +1 -1
- package/dist/field/index.d.ts +1 -1
- package/dist/field/index.d.ts.map +1 -1
- package/dist/field/index.js +33 -32
- package/dist/header/index.d.ts +9 -1
- package/dist/header/index.d.ts.map +1 -1
- package/dist/header/index.js +17 -9
- package/dist/icons/arrow-left.d.ts +3 -0
- package/dist/icons/arrow-left.d.ts.map +1 -0
- package/dist/icons/arrow-right.d.ts +3 -0
- package/dist/icons/arrow-right.d.ts.map +1 -0
- package/dist/icons/bars.d.ts +3 -0
- package/dist/icons/bars.d.ts.map +1 -0
- package/dist/icons/calendar.d.ts +3 -0
- package/dist/icons/calendar.d.ts.map +1 -0
- package/dist/icons/chart-bar.d.ts +3 -0
- package/dist/icons/chart-bar.d.ts.map +1 -0
- package/dist/icons/chevron-down.d.ts.map +1 -1
- package/dist/icons/chevron-down.js +4 -2
- package/dist/icons/chevron-left.d.ts.map +1 -1
- package/dist/icons/chevron-left.js +4 -2
- package/dist/icons/chevron-right.d.ts.map +1 -1
- package/dist/icons/chevron-right.js +4 -2
- package/dist/icons/chevron-up.d.ts.map +1 -1
- package/dist/icons/chevron-up.js +4 -2
- package/dist/icons/ellipsis.d.ts +0 -1
- package/dist/icons/ellipsis.d.ts.map +1 -1
- package/dist/icons/flag.d.ts +3 -0
- package/dist/icons/flag.d.ts.map +1 -0
- package/dist/icons/list-bullet.d.ts +3 -0
- package/dist/icons/list-bullet.d.ts.map +1 -0
- package/dist/icons/lock.d.ts +3 -0
- package/dist/icons/lock.d.ts.map +1 -0
- package/dist/icons/logout.d.ts +3 -0
- package/dist/icons/logout.d.ts.map +1 -0
- package/dist/icons/micro/calendar.d.ts +3 -0
- package/dist/icons/micro/calendar.d.ts.map +1 -0
- package/dist/icons/micro/calendar.js +21 -0
- package/dist/icons/micro/check.d.ts +3 -0
- package/dist/icons/micro/check.d.ts.map +1 -0
- package/dist/icons/micro/check.js +21 -0
- package/dist/icons/micro/chevron-down.d.ts +3 -0
- package/dist/icons/micro/chevron-down.d.ts.map +1 -0
- package/dist/icons/micro/chevron-down.js +21 -0
- package/dist/icons/micro/chevron-right.d.ts +3 -0
- package/dist/icons/micro/chevron-right.d.ts.map +1 -0
- package/dist/icons/micro/chevron-right.js +21 -0
- package/dist/icons/micro/exclamation-triangle.d.ts +3 -0
- package/dist/icons/micro/exclamation-triangle.d.ts.map +1 -0
- package/dist/icons/micro/exclamation-triangle.js +21 -0
- package/dist/icons/micro/information-circle.d.ts +3 -0
- package/dist/icons/micro/information-circle.d.ts.map +1 -0
- package/dist/icons/micro/information-circle.js +21 -0
- package/dist/icons/micro/minus.d.ts +3 -0
- package/dist/icons/micro/minus.d.ts.map +1 -0
- package/dist/icons/micro/minus.js +17 -0
- package/dist/icons/micro/moon.d.ts +3 -0
- package/dist/icons/micro/moon.d.ts.map +1 -0
- package/dist/icons/micro/moon.js +17 -0
- package/dist/icons/micro/sun.d.ts +3 -0
- package/dist/icons/micro/sun.d.ts.map +1 -0
- package/dist/icons/micro/sun.js +17 -0
- package/dist/icons/micro/x-mark.d.ts +3 -0
- package/dist/icons/micro/x-mark.d.ts.map +1 -0
- package/dist/icons/micro/x-mark.js +17 -0
- package/dist/icons/search.d.ts.map +1 -1
- package/dist/icons/search.js +4 -2
- package/dist/icons/settings.d.ts +3 -0
- package/dist/icons/settings.d.ts.map +1 -0
- package/dist/icons/squares.d.ts +3 -0
- package/dist/icons/squares.d.ts.map +1 -0
- package/dist/icons/table.d.ts +3 -0
- package/dist/icons/table.d.ts.map +1 -0
- package/dist/icons/x-mark.d.ts.map +1 -1
- package/dist/icons/x-mark.js +4 -2
- package/dist/index.d.ts +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/lib.js +56 -61
- package/dist/menu/index.d.ts.map +1 -1
- package/dist/menu/index.js +67 -60
- package/dist/meter/index.d.ts +4 -3
- package/dist/meter/index.d.ts.map +1 -1
- package/dist/meter/index.js +9 -8
- package/dist/money-input/index.d.ts +7 -8
- package/dist/money-input/index.d.ts.map +1 -1
- package/dist/money-input/index.js +37 -19
- package/dist/month-picker/index.d.ts.map +1 -1
- package/dist/month-picker/index.js +55 -55
- package/dist/pills/index.d.ts +1 -1
- package/dist/pills/index.d.ts.map +1 -1
- package/dist/pills/index.js +6 -2
- package/dist/popover/index.d.ts.map +1 -1
- package/dist/popover/index.js +15 -13
- package/dist/select/index.d.ts.map +1 -1
- package/dist/select/index.js +96 -102
- package/dist/slider/index.d.ts.map +1 -1
- package/dist/slider/index.js +1 -1
- package/dist/status-pill/index.d.ts +18 -0
- package/dist/status-pill/index.d.ts.map +1 -0
- package/dist/status-pill/index.js +25 -0
- package/dist/tab-bar/index.js +1 -1
- package/dist/table/index.js +1 -1
- package/dist/tabs/index.d.ts.map +1 -1
- package/dist/tabs/index.js +9 -5
- package/dist/theme-toggle/index.d.ts +2 -1
- package/dist/theme-toggle/index.d.ts.map +1 -1
- package/dist/theme-toggle/index.js +35 -32
- package/dist/theme.css +81 -19
- package/dist/toast/index.d.ts.map +1 -1
- package/dist/toast/index.js +119 -106
- package/dist/tooltip/index.d.ts.map +1 -1
- package/dist/tooltip/index.js +45 -43
- package/dist/tree/index.d.ts +22 -3
- package/dist/tree/index.d.ts.map +1 -1
- package/dist/tree/index.js +76 -56
- package/dist/utils/date.d.ts +6 -4
- package/dist/utils/date.d.ts.map +1 -1
- package/dist/utils/date.js +18 -16
- package/dist/utils/field-chevron.d.ts.map +1 -1
- package/dist/utils/field-chevron.js +5 -14
- package/dist/utils/status-icons.d.ts +1 -1
- package/dist/utils/status-icons.d.ts.map +1 -1
- package/dist/utils/status-icons.js +11 -41
- package/dist/utils/styles.d.ts +9 -3
- package/dist/utils/styles.d.ts.map +1 -1
- package/dist/utils/styles.js +2 -2
- package/dist/utils/theme-wave.d.ts +24 -0
- package/dist/utils/theme-wave.d.ts.map +1 -0
- package/dist/utils/theme-wave.js +219 -0
- package/dist/utils/typeahead.d.ts +12 -0
- package/dist/utils/typeahead.d.ts.map +1 -0
- package/dist/utils/typeahead.js +19 -0
- package/dist/utils/useAnchoredPopup.d.ts +23 -7
- package/dist/utils/useAnchoredPopup.d.ts.map +1 -1
- package/dist/utils/useAnchoredPopup.js +86 -30
- package/dist/zen.css +1 -1
- package/package.json +2 -1
- package/dist/icons/ellipsis.js +0 -31
- package/dist/icons/index.d.ts +0 -9
- package/dist/icons/index.d.ts.map +0 -1
- package/dist/icons/status.d.ts +0 -2
- package/dist/icons/status.d.ts.map +0 -1
package/dist/checkbox/index.js
CHANGED
|
@@ -1,61 +1,45 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cx as e } from "../utils/cx.js";
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
3
|
+
import t from "../icons/micro/check.js";
|
|
4
|
+
import { useFieldProps as n } from "../field/index.js";
|
|
5
|
+
import r from "../icons/micro/minus.js";
|
|
6
|
+
import { useEffect as i, useRef as a } from "react";
|
|
7
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
6
8
|
//#region packages/checkbox/index.tsx
|
|
7
|
-
function
|
|
8
|
-
let
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}, [
|
|
12
|
-
let
|
|
13
|
-
className: e("zen__checkbox relative inline-grid size-[1.125rem] shrink-0 place-items-center", !
|
|
9
|
+
function c({ children: c, description: l, indeterminate: u = !1, onChange: d, className: f, ...p }) {
|
|
10
|
+
let m = a(null);
|
|
11
|
+
i(() => {
|
|
12
|
+
m.current && (m.current.indeterminate = u);
|
|
13
|
+
}, [u]);
|
|
14
|
+
let h = n(p), g = /* @__PURE__ */ s("span", {
|
|
15
|
+
className: e("zen__checkbox relative inline-grid size-[1.125rem] shrink-0 place-items-center", !c && f),
|
|
14
16
|
children: [
|
|
15
|
-
/* @__PURE__ */
|
|
16
|
-
ref:
|
|
17
|
+
/* @__PURE__ */ o("input", {
|
|
18
|
+
ref: m,
|
|
17
19
|
type: "checkbox",
|
|
18
|
-
...d,
|
|
19
20
|
...p,
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
...h,
|
|
22
|
+
"aria-checked": u ? "mixed" : void 0,
|
|
23
|
+
onChange: (e) => d?.(e.target.checked),
|
|
22
24
|
className: e("peer border-tint/20 bg-tint/[0.04] m-0 size-full cursor-pointer appearance-none rounded-[5px] border", "outline-hidden transition-[background-color,border-color,box-shadow] duration-200", "hover:enabled:border-tint/35 focus-visible:ring-ring/50 focus-visible:ring-2", "checked:border-primary checked:bg-primary indeterminate:border-primary indeterminate:bg-primary", "checked:shadow-[0_0_14px_-2px_oklch(var(--glow)/0.8)] indeterminate:shadow-[0_0_14px_-2px_oklch(var(--glow)/0.8)]", "aria-invalid:border-destructive disabled:cursor-not-allowed disabled:opacity-50")
|
|
23
25
|
}),
|
|
24
|
-
/* @__PURE__ */
|
|
25
|
-
|
|
26
|
-
fill: "none",
|
|
27
|
-
stroke: "currentColor",
|
|
28
|
-
strokeWidth: "2.2",
|
|
29
|
-
strokeLinecap: "round",
|
|
30
|
-
strokeLinejoin: "round",
|
|
31
|
-
"aria-hidden": !0,
|
|
32
|
-
className: "text-primary-foreground pointer-events-none absolute size-3 opacity-0 transition-opacity duration-150 peer-checked:opacity-100 peer-indeterminate:hidden [&>path]:transition-[stroke-dashoffset] [&>path]:duration-300 [&>path]:ease-out [&>path]:[stroke-dasharray:16] [&>path]:[stroke-dashoffset:16] peer-checked:[&>path]:[stroke-dashoffset:0]",
|
|
33
|
-
children: /* @__PURE__ */ i("path", { d: "m3.5 8.5 3 3 6-7" })
|
|
34
|
-
}),
|
|
35
|
-
/* @__PURE__ */ i("svg", {
|
|
36
|
-
viewBox: "0 0 16 16",
|
|
37
|
-
stroke: "currentColor",
|
|
38
|
-
strokeWidth: "2.2",
|
|
39
|
-
strokeLinecap: "round",
|
|
40
|
-
"aria-hidden": !0,
|
|
41
|
-
className: "text-primary-foreground pointer-events-none absolute hidden size-3 peer-indeterminate:block",
|
|
42
|
-
children: /* @__PURE__ */ i("path", { d: "M4 8h8" })
|
|
43
|
-
})
|
|
26
|
+
/* @__PURE__ */ o(t, { className: "text-primary-foreground pointer-events-none absolute size-3.5 opacity-0 transition-[opacity,clip-path] duration-300 ease-out [clip-path:inset(0_100%_0_0)] peer-checked:opacity-100 peer-checked:[clip-path:inset(0)] peer-indeterminate:hidden" }),
|
|
27
|
+
/* @__PURE__ */ o(r, { className: "text-primary-foreground pointer-events-none absolute hidden size-3.5 peer-indeterminate:block" })
|
|
44
28
|
]
|
|
45
29
|
});
|
|
46
|
-
return
|
|
47
|
-
className: e("inline-flex cursor-pointer items-start gap-2.5 text-sm has-disabled:cursor-not-allowed has-disabled:opacity-60",
|
|
48
|
-
children: [/* @__PURE__ */
|
|
30
|
+
return c ? /* @__PURE__ */ s("label", {
|
|
31
|
+
className: e("inline-flex cursor-pointer items-start gap-2.5 text-sm has-disabled:cursor-not-allowed has-disabled:opacity-60", f),
|
|
32
|
+
children: [/* @__PURE__ */ o("span", {
|
|
49
33
|
className: "mt-px flex",
|
|
50
|
-
children:
|
|
51
|
-
}), /* @__PURE__ */
|
|
34
|
+
children: g
|
|
35
|
+
}), /* @__PURE__ */ s("span", {
|
|
52
36
|
className: "flex flex-col gap-0.5",
|
|
53
|
-
children: [
|
|
37
|
+
children: [c, l && /* @__PURE__ */ o("span", {
|
|
54
38
|
className: "text-muted-foreground text-xs",
|
|
55
|
-
children:
|
|
39
|
+
children: l
|
|
56
40
|
})]
|
|
57
41
|
})]
|
|
58
|
-
}) :
|
|
42
|
+
}) : g;
|
|
59
43
|
}
|
|
60
44
|
//#endregion
|
|
61
|
-
export {
|
|
45
|
+
export { c as default };
|
package/dist/chip/index.js
CHANGED
|
@@ -6,7 +6,7 @@ function n({ pressed: n, className: r, ...i }) {
|
|
|
6
6
|
return /* @__PURE__ */ t("button", {
|
|
7
7
|
type: "button",
|
|
8
8
|
"aria-pressed": n,
|
|
9
|
-
className: e("zen__chip border-tint/10 text-muted-foreground rounded-full border px-3 py-1 text-xs outline-hidden transition-colors", "hover:border-tint/20 hover:text-foreground focus-visible:ring-ring/50 focus-visible:ring-2", "aria-pressed:border-primary/40 aria-pressed:bg-primary/15 aria-pressed:text-foreground", r),
|
|
9
|
+
className: e("zen__chip border-tint/10 text-muted-foreground cursor-pointer rounded-full border px-3 py-1 text-xs outline-hidden transition-colors disabled:cursor-not-allowed", "hover:border-tint/20 hover:text-foreground focus-visible:ring-ring/50 focus-visible:ring-2", "aria-pressed:border-primary/40 aria-pressed:bg-primary/15 aria-pressed:text-foreground", r),
|
|
10
10
|
...i
|
|
11
11
|
});
|
|
12
12
|
}
|
package/dist/code-block/index.js
CHANGED
|
@@ -27,7 +27,7 @@ function a({ code: a, language: o, highlight: s, copyable: c = !0, variant: l =
|
|
|
27
27
|
onClick: async () => {
|
|
28
28
|
await navigator.clipboard?.writeText(f), m(!0);
|
|
29
29
|
},
|
|
30
|
-
className: e("text-muted-foreground hover:bg-tint/[0.07] hover:text-foreground focus-visible:ring-ring/50 absolute top-2.5 right-2.5 rounded-lg px-2.5 py-1 text-xs font-medium outline-hidden transition-[opacity,background-color,color] focus-visible:ring-2", "opacity-0 group-hover:opacity-100 focus-visible:opacity-100", p && "text-primary opacity-100"),
|
|
30
|
+
className: e("text-muted-foreground hover:bg-tint/[0.07] hover:text-foreground focus-visible:ring-ring/50 absolute top-2.5 right-2.5 cursor-pointer rounded-lg px-2.5 py-1 text-xs font-medium outline-hidden transition-[opacity,background-color,color] focus-visible:ring-2", "opacity-0 group-hover:opacity-100 focus-visible:opacity-100", p && "text-primary opacity-100"),
|
|
31
31
|
children: p ? "Copied" : "Copy"
|
|
32
32
|
})]
|
|
33
33
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/combobox/index.tsx"],"names":[],"mappings":"AAaA,OAAO,EAEH,cAAc,EAGd,SAAS,EAOZ,MAAM,OAAO,CAAC;AAkCf;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,+
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/combobox/index.tsx"],"names":[],"mappings":"AAaA,OAAO,EAEH,cAAc,EAGd,SAAS,EAOZ,MAAM,OAAO,CAAC;AAkCf;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,+BAiE1D;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAC5B,WAA8B,EAC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AAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,SAAS,CAAC;CAC1C"}
|
package/dist/combobox/index.js
CHANGED
|
@@ -1,74 +1,71 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cx as e } from "../utils/cx.js";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { POPUP as
|
|
7
|
-
import
|
|
8
|
-
import { CheckIcon as
|
|
9
|
-
import { useField as
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { InputGroupAddon as
|
|
13
|
-
import { FieldChevron as
|
|
14
|
-
import { useVirtualList as
|
|
15
|
-
import { createContext as
|
|
16
|
-
import { Fragment as
|
|
3
|
+
import { anchoredStyle as t, useAnchoredPopup as n } from "../utils/useAnchoredPopup.js";
|
|
4
|
+
import r from "../badge/index.js";
|
|
5
|
+
import i from "../button/index.js";
|
|
6
|
+
import { POPUP as a, TRIGGER as o } from "../utils/styles.js";
|
|
7
|
+
import s from "../collapse/index.js";
|
|
8
|
+
import { CheckIcon as c } from "../utils/status-icons.js";
|
|
9
|
+
import { useField as l } from "../field/index.js";
|
|
10
|
+
import u from "../icons/search.js";
|
|
11
|
+
import d from "../icons/x-mark.js";
|
|
12
|
+
import { InputGroupAddon as f, InputGroupInput as p } from "../input-group/index.js";
|
|
13
|
+
import { FieldChevron as m } from "../utils/field-chevron.js";
|
|
14
|
+
import { useVirtualList as h } from "../utils/useVirtualList.js";
|
|
15
|
+
import { createContext as g, useContext as _, useEffect as v, useMemo as y, useRef as b, useState as x } from "react";
|
|
16
|
+
import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
17
17
|
//#region packages/combobox/index.tsx
|
|
18
|
-
var
|
|
19
|
-
let e =
|
|
18
|
+
var T = g(null), E = () => {
|
|
19
|
+
let e = _(T);
|
|
20
20
|
if (!e) throw Error("Combobox parts must be inside a Combobox");
|
|
21
21
|
return e;
|
|
22
22
|
};
|
|
23
|
-
function
|
|
24
|
-
let { items:
|
|
25
|
-
|
|
23
|
+
function D(e) {
|
|
24
|
+
let { items: t, itemKey: r = (e) => e.key, itemText: i = (e) => e.text, filter: a = (e, t) => i(e).toLowerCase().includes(t.toLowerCase()), selectedItems: o = [], children: s } = e, c = e.multiple === !0, l = c ? e.value : e.value === null ? [] : [e.value], [u, d] = x(""), [f, p] = x(null), m = b(null), h = b(null), g = b(null), _ = b(35), v = y(() => u ? t.filter((e) => a(e, u)) : t, [
|
|
25
|
+
t,
|
|
26
26
|
u,
|
|
27
27
|
a
|
|
28
|
-
]),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
e || (p(null), d(""), C.popupRef.current?.contains(document.activeElement) && h.current?.focus());
|
|
32
|
-
}
|
|
33
|
-
}), T = {
|
|
28
|
+
]), S = n({ onOpenChange: (e) => {
|
|
29
|
+
e || (p(null), d(""), S.popupRef.current?.contains(document.activeElement) && h.current?.focus());
|
|
30
|
+
} }), w = {
|
|
34
31
|
multiple: c,
|
|
35
32
|
keyOf: r,
|
|
36
33
|
textOf: i,
|
|
37
|
-
items:
|
|
34
|
+
items: t,
|
|
38
35
|
selectedItems: o,
|
|
39
|
-
matches:
|
|
36
|
+
matches: v,
|
|
40
37
|
chosen: l,
|
|
41
38
|
toggle: (t) => {
|
|
42
39
|
if (e.multiple === !0) {
|
|
43
40
|
let n = e.value.includes(t);
|
|
44
41
|
e.onValueChange(n ? e.value.filter((e) => e !== t) : [...e.value, t]);
|
|
45
|
-
} else e.onValueChange(t),
|
|
42
|
+
} else e.onValueChange(t), S.setOpen(!1);
|
|
46
43
|
},
|
|
47
44
|
query: u,
|
|
48
45
|
setQuery: d,
|
|
49
46
|
active: f,
|
|
50
47
|
setActive: p,
|
|
51
48
|
create: m,
|
|
52
|
-
popup:
|
|
49
|
+
popup: S,
|
|
53
50
|
triggerRef: h,
|
|
54
51
|
listRef: g,
|
|
55
|
-
optionId: (e) => `${
|
|
52
|
+
optionId: (e) => `${S.id}-option-${e}`,
|
|
56
53
|
itemHeight: _
|
|
57
54
|
};
|
|
58
|
-
return /* @__PURE__ */
|
|
59
|
-
value:
|
|
55
|
+
return /* @__PURE__ */ C(T.Provider, {
|
|
56
|
+
value: w,
|
|
60
57
|
children: s
|
|
61
58
|
});
|
|
62
59
|
}
|
|
63
|
-
function
|
|
64
|
-
let
|
|
65
|
-
return /* @__PURE__ */
|
|
60
|
+
function O({ placeholder: t = "Select an Item", disabled: n, className: r, style: i, children: a, ...s }) {
|
|
61
|
+
let c = E(), { popup: u } = c, d = l(), f = b(!1), p = () => !n && u.setOpen(!0);
|
|
62
|
+
return /* @__PURE__ */ w("div", {
|
|
66
63
|
id: d?.id,
|
|
67
64
|
"aria-labelledby": s["aria-label"] ? void 0 : d?.labelId,
|
|
68
65
|
"aria-invalid": d?.["aria-invalid"],
|
|
69
66
|
...s,
|
|
70
67
|
"aria-describedby": e(d?.["aria-describedby"], s["aria-describedby"]).trim() || void 0,
|
|
71
|
-
ref:
|
|
68
|
+
ref: c.triggerRef,
|
|
72
69
|
role: "combobox",
|
|
73
70
|
tabIndex: n ? -1 : 0,
|
|
74
71
|
"aria-haspopup": "listbox",
|
|
@@ -76,6 +73,7 @@ function D({ placeholder: t = "Select an Item", disabled: n, className: r, style
|
|
|
76
73
|
"aria-controls": u.id,
|
|
77
74
|
"aria-disabled": n || void 0,
|
|
78
75
|
"data-popup-open": u.triggerProps["data-popup-open"],
|
|
76
|
+
"data-zen-anchor": u.triggerProps["data-zen-anchor"],
|
|
79
77
|
style: {
|
|
80
78
|
...u.triggerProps.style,
|
|
81
79
|
...i
|
|
@@ -84,40 +82,40 @@ function D({ placeholder: t = "Select an Item", disabled: n, className: r, style
|
|
|
84
82
|
s.onPointerDown?.(e), f.current = u.open;
|
|
85
83
|
},
|
|
86
84
|
onClick: (e) => {
|
|
87
|
-
s.onClick?.(e), e.preventDefault(), f.current ? u.setOpen(!1) :
|
|
85
|
+
s.onClick?.(e), e.preventDefault(), f.current ? u.setOpen(!1) : p(), f.current = !1;
|
|
88
86
|
},
|
|
89
87
|
onKeyDown: (e) => {
|
|
90
88
|
s.onKeyDown?.(e), [
|
|
91
89
|
"Enter",
|
|
92
90
|
" ",
|
|
93
91
|
"ArrowDown"
|
|
94
|
-
].includes(e.key) && (e.preventDefault(),
|
|
92
|
+
].includes(e.key) && (e.preventDefault(), p());
|
|
95
93
|
},
|
|
96
|
-
className: e(
|
|
97
|
-
children: [/* @__PURE__ */
|
|
94
|
+
className: e(o, "w-56 shrink-0", n ? "cursor-not-allowed opacity-50" : "cursor-pointer", u.open && "border-glow/60 [--glow-border-color:transparent] shadow-[0_0_0_3px_oklch(var(--glow)/0.16),0_0_24px_-6px_oklch(var(--glow)/0.6)]", r),
|
|
95
|
+
children: [/* @__PURE__ */ C("div", {
|
|
98
96
|
className: e("flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm", n ? "text-muted-foreground" : "text-foreground"),
|
|
99
|
-
children:
|
|
100
|
-
}), /* @__PURE__ */
|
|
97
|
+
children: a ?? /* @__PURE__ */ C(k, { placeholder: t })
|
|
98
|
+
}), /* @__PURE__ */ C(m, { open: u.open })]
|
|
101
99
|
});
|
|
102
100
|
}
|
|
103
|
-
function
|
|
104
|
-
let t =
|
|
105
|
-
let
|
|
106
|
-
return
|
|
101
|
+
function k({ placeholder: e }) {
|
|
102
|
+
let t = E(), n = new Map([...t.selectedItems, ...t.items].map((e) => [t.keyOf(e), e])), a = t.chosen.flatMap((e) => {
|
|
103
|
+
let r = n.has(e) ? t.textOf(n.get(e)) : void 0;
|
|
104
|
+
return r ? [{
|
|
107
105
|
key: e,
|
|
108
|
-
text:
|
|
106
|
+
text: r
|
|
109
107
|
}] : [];
|
|
110
108
|
});
|
|
111
|
-
return a.length ? t.multiple ? /* @__PURE__ */
|
|
109
|
+
return a.length ? t.multiple ? /* @__PURE__ */ C(s, {
|
|
112
110
|
items: a.map((e) => e.text),
|
|
113
111
|
data: a,
|
|
114
112
|
badgeVariant: "secondary",
|
|
115
113
|
badgeClassName: "h-6 min-w-min gap-2",
|
|
116
114
|
className: "w-full gap-1",
|
|
117
|
-
children: (e,
|
|
115
|
+
children: (e, n, a) => /* @__PURE__ */ w(r, {
|
|
118
116
|
className: "flex h-6 min-w-min gap-2 pr-1",
|
|
119
117
|
variant: "secondary",
|
|
120
|
-
children: [e, /* @__PURE__ */
|
|
118
|
+
children: [e, /* @__PURE__ */ C(i, {
|
|
121
119
|
"aria-label": `Remove ${e}`,
|
|
122
120
|
onClick: (e) => {
|
|
123
121
|
e.stopPropagation(), a && t.toggle(a.key);
|
|
@@ -125,34 +123,38 @@ function O({ placeholder: e }) {
|
|
|
125
123
|
variant: "icon",
|
|
126
124
|
size: "icon",
|
|
127
125
|
className: "group relative -top-px size-4 rounded-sm p-0.5",
|
|
128
|
-
children: /* @__PURE__ */
|
|
126
|
+
children: /* @__PURE__ */ C(d, { className: "size-3 transition duration-300 group-hover:rotate-90" })
|
|
129
127
|
})]
|
|
130
|
-
}, a?.key ??
|
|
131
|
-
}) : /* @__PURE__ */ S
|
|
128
|
+
}, a?.key ?? n)
|
|
129
|
+
}) : /* @__PURE__ */ C(S, { children: a[0].text }) : /* @__PURE__ */ C("span", {
|
|
132
130
|
className: t.multiple ? "text-muted-foreground" : void 0,
|
|
133
131
|
children: e
|
|
134
132
|
});
|
|
135
133
|
}
|
|
136
|
-
function
|
|
137
|
-
let { popup:
|
|
138
|
-
return /* @__PURE__ */
|
|
139
|
-
...
|
|
140
|
-
|
|
141
|
-
|
|
134
|
+
function A({ className: n, children: r }) {
|
|
135
|
+
let { popup: i } = E();
|
|
136
|
+
return /* @__PURE__ */ C("div", {
|
|
137
|
+
...i.popupProps,
|
|
138
|
+
style: t(i.id, {
|
|
139
|
+
offset: 5,
|
|
140
|
+
width: "match"
|
|
141
|
+
}),
|
|
142
|
+
className: e("zen__popover", a, "overflow-visible p-0", n),
|
|
143
|
+
children: /* @__PURE__ */ C("div", {
|
|
142
144
|
className: "divide-tint/10 flex w-full flex-col divide-y overflow-hidden rounded-xl",
|
|
143
|
-
children:
|
|
145
|
+
children: r
|
|
144
146
|
})
|
|
145
147
|
});
|
|
146
148
|
}
|
|
147
|
-
function
|
|
148
|
-
let n =
|
|
149
|
-
|
|
149
|
+
function j({ placeholder: e = "Search", "aria-label": t = "Search options" }) {
|
|
150
|
+
let n = E(), r = b(null);
|
|
151
|
+
v(() => {
|
|
150
152
|
n.popup.open && r.current?.focus();
|
|
151
153
|
}, [n.popup.open]);
|
|
152
154
|
let i = n.matches.map(n.keyOf);
|
|
153
|
-
return /* @__PURE__ */
|
|
155
|
+
return /* @__PURE__ */ w("div", {
|
|
154
156
|
className: "flex h-10 grow items-center gap-2 px-3",
|
|
155
|
-
children: [/* @__PURE__ */
|
|
157
|
+
children: [/* @__PURE__ */ C(f, { children: /* @__PURE__ */ C(u, {}) }), /* @__PURE__ */ C(p, {
|
|
156
158
|
ref: r,
|
|
157
159
|
placeholder: e,
|
|
158
160
|
"aria-label": t,
|
|
@@ -166,35 +168,35 @@ function A({ placeholder: e = "Search", "aria-label": t = "Search options" }) {
|
|
|
166
168
|
let t = n.active === null ? -1 : i.indexOf(n.active), r = (t) => {
|
|
167
169
|
if (e.preventDefault(), !i.length) return;
|
|
168
170
|
let r = i[(t + i.length) % i.length];
|
|
169
|
-
n.setActive(r),
|
|
171
|
+
n.setActive(r), M(n.listRef.current, i.indexOf(r), n.itemHeight.current);
|
|
170
172
|
};
|
|
171
173
|
e.key === "ArrowDown" ? r(t + 1) : e.key === "ArrowUp" ? r(t === -1 ? i.length - 1 : t - 1) : e.key === "Enter" && (e.preventDefault(), n.active === null ? !i.length && n.query && n.create.current && (n.create.current(n.query), n.setQuery("")) : n.toggle(n.active));
|
|
172
174
|
}
|
|
173
175
|
})]
|
|
174
176
|
});
|
|
175
177
|
}
|
|
176
|
-
var
|
|
178
|
+
var M = (e, t, n) => {
|
|
177
179
|
if (!e || t < 0) return;
|
|
178
180
|
let r = t * n;
|
|
179
181
|
r < e.scrollTop ? e.scrollTop = r : r + n > e.scrollTop + e.clientHeight && (e.scrollTop = r + n - e.clientHeight);
|
|
180
|
-
},
|
|
181
|
-
function
|
|
182
|
-
let r =
|
|
182
|
+
}, N = g(null);
|
|
183
|
+
function P({ renderItem: e, itemHeight: t = 35, children: n }) {
|
|
184
|
+
let r = E();
|
|
183
185
|
r.itemHeight.current = t;
|
|
184
|
-
let i =
|
|
186
|
+
let i = h({
|
|
185
187
|
count: r.matches.length,
|
|
186
188
|
itemHeight: t,
|
|
187
189
|
scrollRef: r.listRef
|
|
188
190
|
});
|
|
189
|
-
return
|
|
191
|
+
return v(() => {
|
|
190
192
|
r.listRef.current && (r.listRef.current.scrollTop = 0);
|
|
191
|
-
}, [r.query, r.listRef]), /* @__PURE__ */
|
|
193
|
+
}, [r.query, r.listRef]), /* @__PURE__ */ w("ul", {
|
|
192
194
|
id: `${r.popup.id}-list`,
|
|
193
195
|
role: "listbox",
|
|
194
196
|
"aria-multiselectable": r.multiple || void 0,
|
|
195
197
|
className: "max-h-72 grow overflow-y-auto py-1 focus:ring-0 focus:outline-hidden",
|
|
196
198
|
ref: r.listRef,
|
|
197
|
-
children: [/* @__PURE__ */
|
|
199
|
+
children: [/* @__PURE__ */ C("div", {
|
|
198
200
|
style: {
|
|
199
201
|
height: `${i.totalSize}px`,
|
|
200
202
|
width: "100%",
|
|
@@ -202,23 +204,23 @@ function N({ renderItem: e, itemHeight: t = 35, children: n }) {
|
|
|
202
204
|
},
|
|
203
205
|
children: i.items.map((t) => {
|
|
204
206
|
let n = r.matches[t.index];
|
|
205
|
-
return /* @__PURE__ */
|
|
207
|
+
return /* @__PURE__ */ C(N.Provider, {
|
|
206
208
|
value: {
|
|
207
209
|
start: t.start,
|
|
208
210
|
size: t.size
|
|
209
211
|
},
|
|
210
|
-
children: e ? e(n) : /* @__PURE__ */
|
|
212
|
+
children: e ? e(n) : /* @__PURE__ */ C(F, { item: n })
|
|
211
213
|
}, r.keyOf(n));
|
|
212
214
|
})
|
|
213
215
|
}), n]
|
|
214
216
|
});
|
|
215
217
|
}
|
|
216
|
-
function
|
|
217
|
-
let i =
|
|
218
|
-
return /* @__PURE__ */
|
|
218
|
+
function F({ item: t, className: n, children: r }) {
|
|
219
|
+
let i = E(), a = _(N), o = i.keyOf(t), s = i.chosen.includes(o);
|
|
220
|
+
return /* @__PURE__ */ w("li", {
|
|
219
221
|
id: i.optionId(o),
|
|
220
222
|
role: "option",
|
|
221
|
-
"aria-selected":
|
|
223
|
+
"aria-selected": s,
|
|
222
224
|
"data-highlighted": i.active === o || void 0,
|
|
223
225
|
style: a ? {
|
|
224
226
|
height: `${a.size}px`,
|
|
@@ -227,28 +229,28 @@ function P({ item: t, className: n, children: r }) {
|
|
|
227
229
|
onMouseMove: () => i.active !== o && i.setActive(o),
|
|
228
230
|
onClick: () => i.toggle(o),
|
|
229
231
|
className: e("hover:bg-muted data-highlighted:bg-muted grid w-full cursor-pointer grid-cols-[1rem_1fr] items-center gap-2 px-3 py-2 text-sm outline-hidden select-none", a && "absolute top-0 left-0", n),
|
|
230
|
-
children: [/* @__PURE__ */
|
|
232
|
+
children: [/* @__PURE__ */ C("span", {
|
|
231
233
|
className: "text-primary col-start-1",
|
|
232
234
|
"aria-hidden": !0,
|
|
233
|
-
children:
|
|
234
|
-
}), /* @__PURE__ */
|
|
235
|
+
children: s && /* @__PURE__ */ C(c, {})
|
|
236
|
+
}), /* @__PURE__ */ C("span", {
|
|
235
237
|
className: "col-start-2 truncate",
|
|
236
238
|
children: r ?? i.textOf(t)
|
|
237
239
|
})]
|
|
238
240
|
});
|
|
239
241
|
}
|
|
240
|
-
function
|
|
241
|
-
let t =
|
|
242
|
-
return !t.query || t.matches.length ? null : /* @__PURE__ */
|
|
242
|
+
function I({ children: e = "No results found" }) {
|
|
243
|
+
let t = E();
|
|
244
|
+
return !t.query || t.matches.length ? null : /* @__PURE__ */ C("li", {
|
|
243
245
|
className: "text-muted-foreground cursor-not-allowed px-3 py-2 text-sm",
|
|
244
246
|
children: e
|
|
245
247
|
});
|
|
246
248
|
}
|
|
247
|
-
function
|
|
248
|
-
let n =
|
|
249
|
-
return
|
|
249
|
+
function L({ onCreate: e, children: t = (e) => `Add ${e}` }) {
|
|
250
|
+
let n = E(), { create: r } = n;
|
|
251
|
+
return v(() => (r.current = e, () => {
|
|
250
252
|
r.current = null;
|
|
251
|
-
}), [r, e]), !n.query || n.matches.length ? null : /* @__PURE__ */
|
|
253
|
+
}), [r, e]), !n.query || n.matches.length ? null : /* @__PURE__ */ C("li", {
|
|
252
254
|
role: "option",
|
|
253
255
|
"aria-selected": !1,
|
|
254
256
|
className: "hover:bg-muted cursor-pointer px-3 py-2 text-sm select-none",
|
|
@@ -259,4 +261,4 @@ function I({ onCreate: e, children: t = (e) => `Add ${e}` }) {
|
|
|
259
261
|
});
|
|
260
262
|
}
|
|
261
263
|
//#endregion
|
|
262
|
-
export {
|
|
264
|
+
export { L as ComboboxCreate, I as ComboboxEmpty, F as ComboboxItem, P as ComboboxList, A as ComboboxPopup, j as ComboboxSearch, O as ComboboxTrigger, D as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/date-picker/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/date-picker/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAA+B,MAAM,iBAAiB,CAAC;AAG/F,OAAO,EAAE,cAAc,EAAa,MAAM,OAAO,CAAC;AAElD;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EAC/B,KAAK,EACL,QAAQ,EACR,MAAM,EACN,GAAG,EACH,GAAG,EACH,UAAU,EACV,YAAY,EACZ,WAA2B,EAC3B,OAAO,EACP,UAAoB,EACpB,GAAG,IAAI,EACV,EAAE,eAAe,+BAsBjB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,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"../field/index.js";
|
|
6
6
|
import { formatDate as a, formatDateRange as o } from "../utils/date.js";
|
|
7
7
|
import s from "../calendar/index.js";
|
|
8
|
-
import
|
|
8
|
+
import c from "../icons/micro/calendar.js";
|
|
9
|
+
import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
9
10
|
//#region packages/date-picker/index.tsx
|
|
10
|
-
function
|
|
11
|
-
return /* @__PURE__ */
|
|
12
|
-
...
|
|
11
|
+
function f({ value: e, onChange: t, locale: n, min: r, max: i, isDisabled: o, weekStartsOn: c, placeholder: l = "Pick a date", onClear: d, clearLabel: f = "Clear", ...p }) {
|
|
12
|
+
return /* @__PURE__ */ u(m, {
|
|
13
|
+
...p,
|
|
13
14
|
shown: e ? a(e, n) : null,
|
|
14
|
-
placeholder:
|
|
15
|
+
placeholder: l,
|
|
15
16
|
label: "Choose date",
|
|
16
17
|
onClear: e ? d : void 0,
|
|
17
18
|
clearLabel: f,
|
|
18
|
-
calendar: (a) => /* @__PURE__ */
|
|
19
|
+
calendar: (a) => /* @__PURE__ */ u(s, {
|
|
19
20
|
autoFocus: !0,
|
|
20
21
|
value: e,
|
|
21
22
|
onChange: (e) => {
|
|
@@ -29,16 +30,16 @@ function d({ value: e, onChange: t, locale: n, min: r, max: i, isDisabled: o, we
|
|
|
29
30
|
})
|
|
30
31
|
});
|
|
31
32
|
}
|
|
32
|
-
function
|
|
33
|
+
function p({ value: e, onChange: t, locale: n, min: r, max: i, isDisabled: c, weekStartsOn: l, months: d = 1, placeholder: f = "Pick dates", onClear: p, clearLabel: h = "Clear", ...g }) {
|
|
33
34
|
let _ = e ? e.end ? o(e.start, e.end, n) : `${a(e.start, n)} – …` : null;
|
|
34
|
-
return /* @__PURE__ */
|
|
35
|
+
return /* @__PURE__ */ u(m, {
|
|
35
36
|
...g,
|
|
36
37
|
shown: _,
|
|
37
38
|
placeholder: f,
|
|
38
39
|
label: "Choose dates",
|
|
39
|
-
onClear: e ?
|
|
40
|
+
onClear: e ? p : void 0,
|
|
40
41
|
clearLabel: h,
|
|
41
|
-
calendar: (a) => /* @__PURE__ */
|
|
42
|
+
calendar: (a) => /* @__PURE__ */ u(s, {
|
|
42
43
|
autoFocus: !0,
|
|
43
44
|
mode: "range",
|
|
44
45
|
value: e,
|
|
@@ -49,21 +50,21 @@ function f({ value: e, onChange: t, locale: n, min: r, max: i, isDisabled: c, we
|
|
|
49
50
|
min: r,
|
|
50
51
|
max: i,
|
|
51
52
|
isDisabled: c,
|
|
52
|
-
weekStartsOn:
|
|
53
|
+
weekStartsOn: l,
|
|
53
54
|
months: d
|
|
54
55
|
})
|
|
55
56
|
});
|
|
56
57
|
}
|
|
57
|
-
function
|
|
58
|
+
function m({ shown: a, placeholder: o, label: s, calendar: c, onClear: f, clearLabel: p, id: m, className: g, disabled: _ = !1, style: v, ...y }) {
|
|
58
59
|
let b = t(), x = i({
|
|
59
60
|
...y,
|
|
60
|
-
id:
|
|
61
|
+
id: m
|
|
61
62
|
}), S = () => b.setOpen(!1);
|
|
62
|
-
return /* @__PURE__ */
|
|
63
|
+
return /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ d("button", {
|
|
63
64
|
type: "button",
|
|
64
65
|
...y,
|
|
65
66
|
...x,
|
|
66
|
-
id:
|
|
67
|
+
id: m,
|
|
67
68
|
disabled: _,
|
|
68
69
|
...b.triggerProps,
|
|
69
70
|
style: {
|
|
@@ -71,42 +72,27 @@ function p({ shown: a, placeholder: o, label: s, calendar: d, onClear: f, clearL
|
|
|
71
72
|
...v
|
|
72
73
|
},
|
|
73
74
|
className: e("zen__date-picker group", r, "w-full", b.open && "border-glow/60 [--glow-border-color:transparent] shadow-[0_0_0_3px_oklch(var(--glow)/0.16),0_0_24px_-6px_oklch(var(--glow)/0.6)]", g),
|
|
74
|
-
children: [/* @__PURE__ */
|
|
75
|
+
children: [/* @__PURE__ */ u("span", {
|
|
75
76
|
className: e("truncate", !a && "text-muted-foreground"),
|
|
76
77
|
children: a ?? o
|
|
77
|
-
}), /* @__PURE__ */
|
|
78
|
-
}), /* @__PURE__ */
|
|
78
|
+
}), /* @__PURE__ */ u(h, {})]
|
|
79
|
+
}), /* @__PURE__ */ d("div", {
|
|
79
80
|
...b.popupProps,
|
|
80
81
|
role: "dialog",
|
|
81
82
|
"aria-label": s,
|
|
82
83
|
className: e("zen__popover", n, "p-3"),
|
|
83
|
-
children: [b.open &&
|
|
84
|
+
children: [b.open && c(S), f && /* @__PURE__ */ u("button", {
|
|
84
85
|
type: "button",
|
|
85
86
|
onClick: () => {
|
|
86
87
|
f(), S();
|
|
87
88
|
},
|
|
88
|
-
className: "border-tint/[0.06] text-muted-foreground hover:text-foreground focus-visible:ring-ring/40 mt-2 w-full rounded-lg border-t px-2 pt-2.5 pb-1.5 text-sm outline-hidden focus-visible:ring-2",
|
|
89
|
+
className: "border-tint/[0.06] text-muted-foreground hover:text-foreground focus-visible:ring-ring/40 mt-2 w-full cursor-pointer rounded-lg border-t px-2 pt-2.5 pb-1.5 text-sm outline-hidden focus-visible:ring-2",
|
|
89
90
|
children: p
|
|
90
91
|
})]
|
|
91
92
|
})] });
|
|
92
93
|
}
|
|
93
|
-
function
|
|
94
|
-
return /* @__PURE__ */ u("
|
|
95
|
-
viewBox: "0 0 16 16",
|
|
96
|
-
fill: "none",
|
|
97
|
-
stroke: "currentColor",
|
|
98
|
-
strokeWidth: "1.5",
|
|
99
|
-
strokeLinecap: "round",
|
|
100
|
-
"aria-hidden": !0,
|
|
101
|
-
className: "text-muted-foreground group-data-popup-open:text-foreground size-4 shrink-0 transition-colors",
|
|
102
|
-
children: [/* @__PURE__ */ l("rect", {
|
|
103
|
-
x: "2.5",
|
|
104
|
-
y: "3.5",
|
|
105
|
-
width: "11",
|
|
106
|
-
height: "10",
|
|
107
|
-
rx: "2"
|
|
108
|
-
}), /* @__PURE__ */ l("path", { d: "M2.5 6.5h11M5.5 2v3M10.5 2v3" })]
|
|
109
|
-
});
|
|
94
|
+
function h() {
|
|
95
|
+
return /* @__PURE__ */ u(c, { className: "text-muted-foreground group-data-popup-open:text-foreground size-4 shrink-0 transition-colors" });
|
|
110
96
|
}
|
|
111
97
|
//#endregion
|
|
112
|
-
export {
|
|
98
|
+
export { p as DateRangePicker, f as default };
|
package/dist/disclosure/index.js
CHANGED
|
@@ -32,7 +32,7 @@ function p({ className: n, onClick: r, children: i, ...a }) {
|
|
|
32
32
|
onClick: (e) => {
|
|
33
33
|
r?.(e), e.defaultPrevented || s(!o);
|
|
34
34
|
},
|
|
35
|
-
className: e("zen__disclosure group text-muted-foreground flex w-fit items-center gap-1.5 rounded-md text-sm font-medium outline-hidden", "hover:text-foreground aria-expanded:text-foreground transition-colors duration-200", "focus-visible:outline-ring/50 focus-visible:outline-2 focus-visible:outline-offset-4", n),
|
|
35
|
+
className: e("zen__disclosure group text-muted-foreground flex w-fit cursor-pointer items-center gap-1.5 rounded-md text-sm font-medium outline-hidden", "hover:text-foreground aria-expanded:text-foreground transition-colors duration-200", "focus-visible:outline-ring/50 focus-visible:outline-2 focus-visible:outline-offset-4", n),
|
|
36
36
|
...a,
|
|
37
37
|
children: [/* @__PURE__ */ c(t, { className: e("text-inherit duration-300 ease-[cubic-bezier(0.2,0.8,0.2,1)]", !o && "-rotate-90") }), i]
|
|
38
38
|
});
|
|
@@ -16,7 +16,7 @@ function i({ children: i, editor: a, label: o, readOnly: s = !1, editing: c, onE
|
|
|
16
16
|
title: u,
|
|
17
17
|
"aria-label": o ? `${o}. Edit` : void 0,
|
|
18
18
|
onClick: () => h(!0),
|
|
19
|
-
className: e("zen__editable-cell hover:bg-primary/10 focus-visible:ring-ring/50 w-full rounded-md px-1.5 py-0.5 text-right tabular-nums transition-colors focus-visible:ring-2 focus-visible:outline-hidden", d),
|
|
19
|
+
className: e("zen__editable-cell hover:bg-primary/10 focus-visible:ring-ring/50 w-full cursor-pointer rounded-md px-1.5 py-0.5 text-right tabular-nums transition-colors focus-visible:ring-2 focus-visible:outline-hidden", d),
|
|
20
20
|
children: i
|
|
21
21
|
});
|
|
22
22
|
}
|
package/dist/field/index.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ export declare function useFieldProps(props: {
|
|
|
42
42
|
* same id as `htmlFor`: Zen's controls with that id pick them up themselves.
|
|
43
43
|
*/
|
|
44
44
|
export default function Field({ label, hint, error, htmlFor, children, className }: FieldProps): import('react').JSX.Element;
|
|
45
|
-
/** A message for a form as a whole: an error in a tinted box, or a quiet note. */
|
|
45
|
+
/** A message for a form as a whole: an error or success in a tinted box, or a quiet note. An Alert, set for forms. */
|
|
46
46
|
export declare function FormMessage({ tone, children, className }: FormMessageProps): import('react').JSX.Element;
|
|
47
47
|
export interface FieldProps {
|
|
48
48
|
label: ReactNode;
|