@rinzai/zen 0.5.0 → 0.6.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/README.md +2 -2
- package/dist/animated-number/index.js +33 -0
- package/dist/avatar/index.js +38 -0
- package/dist/backdrop/index.d.ts +7 -3
- package/dist/backdrop/index.d.ts.map +1 -1
- package/dist/backdrop/index.js +98 -0
- package/dist/badge/index.d.ts +1 -1
- package/dist/badge/index.js +24 -0
- package/dist/button/index.d.ts +10 -3
- package/dist/button/index.d.ts.map +1 -1
- package/dist/button/index.js +54 -0
- package/dist/calendar/index.d.ts +44 -0
- package/dist/calendar/index.d.ts.map +1 -0
- package/dist/calendar/index.js +161 -0
- package/dist/card/index.d.ts +15 -6
- package/dist/card/index.d.ts.map +1 -1
- package/dist/card/index.js +60 -0
- package/dist/chart/donut.d.ts +30 -0
- package/dist/chart/donut.d.ts.map +1 -0
- package/dist/chart/donut.js +96 -0
- package/dist/chart/index.d.ts +81 -0
- package/dist/chart/index.d.ts.map +1 -0
- package/dist/chart/index.js +362 -0
- package/dist/chart/tooltip.d.ts +25 -0
- package/dist/chart/tooltip.d.ts.map +1 -0
- package/dist/chart/tooltip.js +51 -0
- package/dist/checkbox/index.d.ts +20 -0
- package/dist/checkbox/index.d.ts.map +1 -0
- package/dist/checkbox/index.js +61 -0
- package/dist/chip/index.d.ts +12 -0
- package/dist/chip/index.d.ts.map +1 -0
- package/dist/chip/index.js +14 -0
- package/dist/code-block/index.js +36 -0
- package/dist/collapse/index.d.ts +17 -7
- package/dist/collapse/index.d.ts.map +1 -1
- package/dist/collapse/index.js +82 -0
- package/dist/combobox/index.d.ts +89 -0
- package/dist/combobox/index.d.ts.map +1 -0
- package/dist/combobox/index.js +262 -0
- package/dist/confirm-dialog/index.d.ts.map +1 -1
- package/dist/confirm-dialog/index.js +25 -0
- package/dist/date-picker/index.d.ts +48 -0
- package/dist/date-picker/index.d.ts.map +1 -0
- package/dist/date-picker/index.js +112 -0
- package/dist/dialog/index.d.ts +14 -2
- package/dist/dialog/index.d.ts.map +1 -1
- package/dist/dialog/index.js +77 -0
- package/dist/disclosure/index.d.ts +25 -0
- package/dist/disclosure/index.d.ts.map +1 -0
- package/dist/disclosure/index.js +66 -0
- package/dist/editable-cell/index.js +24 -0
- package/dist/field/index.d.ts +42 -3
- package/dist/field/index.d.ts.map +1 -1
- package/dist/field/index.js +66 -0
- package/dist/header/index.js +17 -0
- package/dist/icons/chevron-down.js +21 -0
- package/dist/icons/chevron-left.js +21 -0
- package/dist/icons/chevron-right.js +21 -0
- package/dist/icons/chevron-up.js +21 -0
- package/dist/icons/ellipsis.d.ts +4 -0
- package/dist/icons/ellipsis.d.ts.map +1 -0
- package/dist/icons/ellipsis.js +31 -0
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/index.d.ts.map +1 -1
- package/dist/icons/search.js +21 -0
- package/dist/icons/x-mark.js +21 -0
- package/dist/index.d.ts +22 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/input/index.d.ts.map +1 -1
- package/dist/input/index.js +16 -0
- package/dist/input-group/index.d.ts.map +1 -1
- package/dist/input-group/index.js +36 -0
- package/dist/inset/index.d.ts +16 -0
- package/dist/inset/index.d.ts.map +1 -0
- package/dist/inset/index.js +23 -0
- package/dist/lib.js +74 -0
- package/dist/menu/index.d.ts +55 -0
- package/dist/menu/index.d.ts.map +1 -0
- package/dist/menu/index.js +118 -0
- package/dist/meter/index.js +41 -0
- package/dist/money-input/index.d.ts +77 -7
- package/dist/money-input/index.d.ts.map +1 -1
- package/dist/money-input/index.js +304 -0
- package/dist/month-picker/index.d.ts +4 -3
- package/dist/month-picker/index.d.ts.map +1 -1
- package/dist/month-picker/index.js +93 -0
- package/dist/page-header/index.js +26 -0
- package/dist/pills/index.d.ts +35 -0
- package/dist/pills/index.d.ts.map +1 -0
- package/dist/pills/index.js +50 -0
- package/dist/popover/index.d.ts +41 -22
- package/dist/popover/index.d.ts.map +1 -1
- package/dist/popover/index.js +75 -0
- package/dist/progress-ring/index.js +49 -0
- package/dist/radio-cards/index.d.ts +34 -0
- package/dist/radio-cards/index.d.ts.map +1 -0
- package/dist/radio-cards/index.js +48 -0
- package/dist/radio-group/index.d.ts +39 -0
- package/dist/radio-group/index.d.ts.map +1 -0
- package/dist/radio-group/index.js +63 -0
- package/dist/segmented/index.d.ts +16 -6
- package/dist/segmented/index.d.ts.map +1 -1
- package/dist/segmented/index.js +58 -0
- package/dist/select/index.d.ts +28 -14
- package/dist/select/index.d.ts.map +1 -1
- package/dist/select/index.js +187 -0
- package/dist/side-nav/index.js +37 -0
- package/dist/skeleton/index.js +12 -0
- package/dist/slider/index.js +34 -0
- package/dist/spinner/index.js +14 -0
- package/dist/tab-bar/index.d.ts +3 -0
- package/dist/tab-bar/index.d.ts.map +1 -1
- package/dist/tab-bar/index.js +34 -0
- package/dist/table/index.js +148 -0
- package/dist/table-of-contents/index.js +37 -0
- package/dist/tabs/index.d.ts +3 -2
- package/dist/tabs/index.d.ts.map +1 -1
- package/dist/tabs/index.js +114 -0
- package/dist/tailwind.css +1 -1
- package/dist/textarea/index.d.ts.map +1 -1
- package/dist/textarea/index.js +16 -0
- package/dist/theme-toggle/index.js +43 -0
- package/dist/theme.css +178 -13
- package/dist/toast/index.d.ts +6 -1
- package/dist/toast/index.d.ts.map +1 -1
- package/dist/toast/index.js +248 -0
- package/dist/toggle/index.d.ts.map +1 -1
- package/dist/toggle/index.js +26 -0
- package/dist/tooltip/index.d.ts +25 -0
- package/dist/tooltip/index.d.ts.map +1 -0
- package/dist/tooltip/index.js +108 -0
- package/dist/tree/index.d.ts.map +1 -1
- package/dist/tree/index.js +135 -0
- package/dist/utils/cva.js +25 -0
- package/dist/utils/cx.js +6 -0
- package/dist/utils/date.d.ts +37 -0
- package/dist/utils/date.d.ts.map +1 -0
- package/dist/utils/date.js +68 -0
- package/dist/utils/field-chevron.js +19 -0
- package/dist/utils/fx.d.ts +30 -0
- package/dist/utils/fx.d.ts.map +1 -0
- package/dist/utils/fx.js +21 -0
- package/dist/utils/graphics.js +33 -0
- package/dist/utils/indicator.d.ts +24 -0
- package/dist/utils/indicator.d.ts.map +1 -0
- package/dist/utils/indicator.js +37 -0
- package/dist/utils/merge.js +305 -0
- package/dist/utils/money.js +73 -0
- package/dist/utils/month.js +46 -0
- package/dist/utils/slot.d.ts +9 -5
- package/dist/utils/slot.d.ts.map +1 -1
- package/dist/utils/slot.js +25 -0
- package/dist/utils/status-icons.js +48 -0
- package/dist/utils/styles.d.ts +6 -6
- package/dist/utils/styles.d.ts.map +1 -1
- package/dist/utils/styles.js +6 -0
- package/dist/utils/theme.js +200 -0
- package/dist/utils/useAnchoredPopup.d.ts +8 -2
- package/dist/utils/useAnchoredPopup.d.ts.map +1 -1
- package/dist/utils/useAnchoredPopup.js +63 -0
- package/dist/utils/useHydrated.js +9 -0
- package/dist/utils/useVirtualList.js +45 -0
- package/dist/variables.css +22 -0
- package/dist/zen.css +1 -1
- package/package.json +9 -4
- package/dist/actions-menu/index.d.ts +0 -18
- package/dist/actions-menu/index.d.ts.map +0 -1
- package/dist/dropdown/index.d.ts +0 -28
- package/dist/dropdown/index.d.ts.map +0 -1
- package/dist/nav-pills/index.d.ts +0 -31
- package/dist/nav-pills/index.d.ts.map +0 -1
- package/dist/zen.js +0 -2970
package/README.md
CHANGED
|
@@ -57,9 +57,9 @@ export default function App() {
|
|
|
57
57
|
## What's inside
|
|
58
58
|
|
|
59
59
|
- **Surfaces:** Card, Stat, Dialog, ConfirmDialog, Popover, Toast, Backdrop (aurora, contours or dots, and a pointer light)
|
|
60
|
-
- **Inputs:** Button, Input, TextArea, InputGroup, MoneyInput, Select,
|
|
60
|
+
- **Inputs:** Button, Input, TextArea, InputGroup, MoneyInput, Select, Combobox, MonthPicker, Segmented, Slider, Toggle, Field
|
|
61
61
|
- **Data:** composable Table with sticky edges and sorting, tree rows, editable cells, virtual rows, Meter, ProgressRing, AnimatedNumber
|
|
62
|
-
- **Navigation:** Header,
|
|
62
|
+
- **Navigation:** Header, Pills, Tabs, TabBar, SideNav, TableOfContents, Menu
|
|
63
63
|
- **Theming:** dark and light, OKLCH tokens, and a theme generator (presets or any hue) that keeps contrast readable
|
|
64
64
|
- **Hooks and utilities:** `useAnchoredPopup`, `useVirtualList`, `useTree`, `useSort`, money and month helpers, `cx` (Tailwind-aware class merging), `cva`
|
|
65
65
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx as e } from "../utils/cx.js";
|
|
3
|
+
import { formatMoney as t } from "../utils/money.js";
|
|
4
|
+
import { useEffect as n, useLayoutEffect as r, useRef as i, useState as a } from "react";
|
|
5
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
6
|
+
//#region packages/animated-number/index.tsx
|
|
7
|
+
var s = typeof window > "u" ? n : r, c = (e) => 1 - (1 - e) ** 3;
|
|
8
|
+
function l({ value: t, format: n = String, duration: r = 650, fromZero: l = !0, className: u }) {
|
|
9
|
+
let [d, f] = a(l ? 0 : t), p = i(l ? 0 : t);
|
|
10
|
+
return s(() => {
|
|
11
|
+
if (window.matchMedia?.("(prefers-reduced-motion: reduce)").matches || document.documentElement.classList.contains("reduce-motion") || r <= 0) {
|
|
12
|
+
p.current = t, f(t);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
let e = p.current, n = performance.now(), i = requestAnimationFrame(function a(o) {
|
|
16
|
+
let s = Math.min(1, (o - n) / r), l = Math.round(e + (t - e) * c(s));
|
|
17
|
+
p.current = l, f(l), s < 1 && (i = requestAnimationFrame(a));
|
|
18
|
+
});
|
|
19
|
+
return () => cancelAnimationFrame(i);
|
|
20
|
+
}, [t, r]), /* @__PURE__ */ o("span", {
|
|
21
|
+
className: e("zen__animated-number tabular-nums", u),
|
|
22
|
+
children: n(d)
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function u({ value: e, currency: n, locale: r, showDecimals: i = !1, ...a }) {
|
|
26
|
+
return /* @__PURE__ */ o(l, {
|
|
27
|
+
value: e,
|
|
28
|
+
format: (e) => t(e, n, r, { showDecimals: i }),
|
|
29
|
+
...a
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { u as AnimatedMoney, l as default };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx as e } from "../utils/cx.js";
|
|
3
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
4
|
+
//#region packages/avatar/index.tsx
|
|
5
|
+
function n({ src: n, name: r, alt: i, className: a }) {
|
|
6
|
+
let o = (r.trim()[0] ?? "?").toUpperCase();
|
|
7
|
+
return /* @__PURE__ */ t("span", {
|
|
8
|
+
role: i ? "img" : void 0,
|
|
9
|
+
"aria-label": i,
|
|
10
|
+
"aria-hidden": !i || void 0,
|
|
11
|
+
className: e("zen__avatar relative inline-grid shrink-0 place-items-center overflow-hidden rounded-full font-semibold select-none", "size-9 text-sm", "text-primary-foreground bg-[radial-gradient(circle_at_30%_25%,oklch(var(--glow)/0.9),oklch(var(--primary)/0.55))]", "shadow-[0_0_0_1px_oklch(var(--tint)/0.12),0_0_18px_-6px_oklch(var(--glow)/calc(0.9*var(--glow-strength)))]", a),
|
|
12
|
+
children: n ? /* @__PURE__ */ t("img", {
|
|
13
|
+
src: n,
|
|
14
|
+
alt: "",
|
|
15
|
+
className: "size-full object-cover",
|
|
16
|
+
draggable: !1
|
|
17
|
+
}) : o
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
var r = class extends Error {};
|
|
21
|
+
async function i(e, t = 160, n = .85) {
|
|
22
|
+
if (!e.type.startsWith("image/")) throw new r("Choose an image file.");
|
|
23
|
+
if (e.size > 20971520) throw new r("That image is too large (over 20 MB).");
|
|
24
|
+
let i;
|
|
25
|
+
try {
|
|
26
|
+
i = await createImageBitmap(e);
|
|
27
|
+
} catch {
|
|
28
|
+
throw new r("That image couldn't be read.");
|
|
29
|
+
}
|
|
30
|
+
let a = Math.min(i.width, i.height), o = document.createElement("canvas");
|
|
31
|
+
o.width = o.height = t;
|
|
32
|
+
let s = o.getContext("2d");
|
|
33
|
+
s.imageSmoothingQuality = "high", s.drawImage(i, (i.width - a) / 2, (i.height - a) / 2, a, a, 0, 0, t, t), i.close();
|
|
34
|
+
let c = o.toDataURL("image/webp", n);
|
|
35
|
+
return c.startsWith("data:image/webp") ? c : o.toDataURL("image/jpeg", n);
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { r as ImageCropError, i as cropImageToSquare, n as default };
|
package/dist/backdrop/index.d.ts
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
1
2
|
/**
|
|
2
3
|
* Fixed page background: slow aurora glows over a faint pattern (topographic
|
|
3
4
|
* contours or a dot grid), with a light that follows the pointer. It also
|
|
4
|
-
* lights `.glow-edge` borders (cards, outline buttons,
|
|
5
|
-
* pointer. Render once, behind everything.
|
|
5
|
+
* lights `.glow-edge` and `.glow-border` borders (cards, outline buttons,
|
|
6
|
+
* dialogs, fields) near the pointer. Render once, behind everything.
|
|
6
7
|
*/
|
|
7
|
-
export default function Backdrop({ pattern, topoSrc }: BackdropProps): import('react').JSX.Element;
|
|
8
|
+
export default function Backdrop({ pattern, topoSrc, className, style }: BackdropProps): import('react').JSX.Element;
|
|
8
9
|
export interface BackdropProps {
|
|
9
10
|
/** Background pattern. Defaults to contours when `topoSrc` is given, dots otherwise. */
|
|
10
11
|
pattern?: 'contours' | 'dots';
|
|
11
12
|
/** URL of a contour-line image (strokes on transparent), used as a mask. */
|
|
12
13
|
topoSrc?: string;
|
|
14
|
+
/** Classes for the backdrop layer (e.g. a view-transition-name). */
|
|
15
|
+
className?: string;
|
|
16
|
+
style?: CSSProperties;
|
|
13
17
|
}
|
|
14
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/backdrop/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/backdrop/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAqB,MAAM,OAAO,CAAC;AAEzD;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,aAAa,+BA4LrF;AAED,MAAM,WAAW,aAAa;IAC1B,wFAAwF;IACxF,OAAO,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;IAC9B,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACzB"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx as e } from "../utils/cx.js";
|
|
3
|
+
import { applyGraphicsMode as t } from "../utils/graphics.js";
|
|
4
|
+
import { useEffect as n, useRef as r } from "react";
|
|
5
|
+
import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
|
+
//#region packages/backdrop/index.tsx
|
|
7
|
+
function s({ pattern: s, topoSrc: c, className: l, style: u }) {
|
|
8
|
+
let d = s ?? (c ? "contours" : "dots"), f = r(null);
|
|
9
|
+
return n(() => {
|
|
10
|
+
let e = document.documentElement, n = f.current, r = 0, i = -9999, a = -9999, o = /* @__PURE__ */ new WeakSet(), s = !0, c = /* @__PURE__ */ new WeakMap(), l = (e, t, n, r = "--gx", i = "--gy") => {
|
|
11
|
+
let a = t + " " + n;
|
|
12
|
+
c.get(e) !== a && (c.set(e, a), e.style.setProperty(r, t), e.style.setProperty(i, n));
|
|
13
|
+
}, u = () => {
|
|
14
|
+
r = 0;
|
|
15
|
+
let e = Array.from(document.querySelectorAll(".glow-edge, .glow-border")), t = e.map((e) => e.getBoundingClientRect()), c = n?.getBoundingClientRect();
|
|
16
|
+
if (n && c) {
|
|
17
|
+
let e = s ? "out" : "in";
|
|
18
|
+
n.dataset.pointer !== e && (n.dataset.pointer = e);
|
|
19
|
+
let t = n.querySelector(".zen-light");
|
|
20
|
+
t && !s && l(t, `${Math.round(i - c.left)}px`, `${Math.round(a - c.top)}px`, "left", "top");
|
|
21
|
+
}
|
|
22
|
+
e.forEach((e, n) => {
|
|
23
|
+
let r = t[n];
|
|
24
|
+
i > r.left - 400 && i < r.right + 400 && a > r.top - 400 && a < r.bottom + 400 ? (l(e, `${Math.round(i - r.left)}px`, `${Math.round(a - r.top)}px`), o.delete(e)) : o.has(e) || (l(e, "-9999px", "-9999px"), o.add(e));
|
|
25
|
+
});
|
|
26
|
+
}, d = () => {
|
|
27
|
+
r ||= requestAnimationFrame(u);
|
|
28
|
+
}, p = (e) => {
|
|
29
|
+
i = e.clientX, a = e.clientY, s = !1, d();
|
|
30
|
+
}, m = () => {
|
|
31
|
+
i = a = -9999, s = !0, d();
|
|
32
|
+
};
|
|
33
|
+
if (window.matchMedia?.("(hover: none), (pointer: coarse)").matches || t() === "lite") return;
|
|
34
|
+
window.addEventListener("pointermove", p, { passive: !0 }), e.addEventListener("pointerleave", m);
|
|
35
|
+
let h = 0, g = () => {
|
|
36
|
+
clearTimeout(h), h = window.setTimeout(d, 120);
|
|
37
|
+
};
|
|
38
|
+
return window.addEventListener("scroll", g, {
|
|
39
|
+
passive: !0,
|
|
40
|
+
capture: !0
|
|
41
|
+
}), window.addEventListener("resize", d, { passive: !0 }), () => {
|
|
42
|
+
window.removeEventListener("pointermove", p), e.removeEventListener("pointerleave", m), window.removeEventListener("scroll", g, { capture: !0 }), clearTimeout(h), window.removeEventListener("resize", d), cancelAnimationFrame(r);
|
|
43
|
+
};
|
|
44
|
+
}, []), n(() => {
|
|
45
|
+
let e = f.current;
|
|
46
|
+
if (!c || !e || typeof document > "u") return;
|
|
47
|
+
let t = "", n = !1, r = 0, i = new Image();
|
|
48
|
+
i.src = c;
|
|
49
|
+
let a = async () => {
|
|
50
|
+
try {
|
|
51
|
+
await i.decode();
|
|
52
|
+
let r = window.devicePixelRatio || 1, a = Math.round(e.clientWidth * r), o = Math.round(e.clientHeight * r);
|
|
53
|
+
if (!a || !o) return;
|
|
54
|
+
let s = document.createElement("canvas");
|
|
55
|
+
s.width = a, s.height = o;
|
|
56
|
+
let c = i.naturalWidth || a, l = i.naturalHeight || o, u = Math.max(a / c, o / l);
|
|
57
|
+
s.getContext("2d")?.drawImage(i, (a - c * u) / 2, (o - l * u) / 2, c * u, l * u);
|
|
58
|
+
let d = await new Promise((e) => s.toBlob(e));
|
|
59
|
+
if (n || !d) return;
|
|
60
|
+
let f = URL.createObjectURL(d);
|
|
61
|
+
e.style.setProperty("--zen-topo", `url("${f}")`), t && URL.revokeObjectURL(t), t = f;
|
|
62
|
+
} catch {}
|
|
63
|
+
};
|
|
64
|
+
a();
|
|
65
|
+
let o = typeof ResizeObserver > "u" ? null : new ResizeObserver(() => {
|
|
66
|
+
clearTimeout(r), r = window.setTimeout(a, 200);
|
|
67
|
+
});
|
|
68
|
+
return o?.observe(e), () => {
|
|
69
|
+
n = !0, clearTimeout(r), o?.disconnect(), t && URL.revokeObjectURL(t), e.style.setProperty("--zen-topo", `url("${c}")`);
|
|
70
|
+
};
|
|
71
|
+
}, [c]), /* @__PURE__ */ o("div", {
|
|
72
|
+
ref: f,
|
|
73
|
+
className: e("zen-backdrop", l),
|
|
74
|
+
"data-pattern": d,
|
|
75
|
+
"aria-hidden": !0,
|
|
76
|
+
style: {
|
|
77
|
+
...c && { "--zen-topo": `url("${c}")` },
|
|
78
|
+
...u
|
|
79
|
+
},
|
|
80
|
+
children: [
|
|
81
|
+
/* @__PURE__ */ a("div", { className: "zen-aurora" }),
|
|
82
|
+
d === "contours" ? /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a("div", { className: "zen-topo" }), /* @__PURE__ */ a("div", {
|
|
83
|
+
className: "zen-topo zen-topo--lit",
|
|
84
|
+
children: /* @__PURE__ */ a("div", { className: "zen-light" })
|
|
85
|
+
})] }) : /* @__PURE__ */ o(i, { children: [
|
|
86
|
+
/* @__PURE__ */ a("div", { className: "zen-dots" }),
|
|
87
|
+
/* @__PURE__ */ a("div", { className: "zen-dots zen-dots--ambient" }),
|
|
88
|
+
/* @__PURE__ */ a("div", {
|
|
89
|
+
className: "zen-dots zen-dots--lit",
|
|
90
|
+
children: /* @__PURE__ */ a("div", { className: "zen-light" })
|
|
91
|
+
})
|
|
92
|
+
] }),
|
|
93
|
+
/* @__PURE__ */ a("div", { className: "zen-vignette" })
|
|
94
|
+
]
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
//#endregion
|
|
98
|
+
export { s as default };
|
package/dist/badge/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { VariantProps } from '../utils/cva';
|
|
|
2
2
|
import { ComponentProps } from 'react';
|
|
3
3
|
export default function Badge({ variant, className, ...rest }: BadgeProps): import('react').JSX.Element;
|
|
4
4
|
declare const badgeVariants: (props?: ({
|
|
5
|
-
variant?: "outline" | "default" | "
|
|
5
|
+
variant?: "outline" | "default" | "destructive" | "secondary" | null | undefined;
|
|
6
6
|
} & ({
|
|
7
7
|
class: import('../utils/cx').ClassValue;
|
|
8
8
|
className?: never;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cva as e } from "../utils/cva.js";
|
|
3
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
4
|
+
//#region packages/badge/index.tsx
|
|
5
|
+
function n({ variant: e, className: n, ...i }) {
|
|
6
|
+
return /* @__PURE__ */ t("span", {
|
|
7
|
+
...i,
|
|
8
|
+
className: r({
|
|
9
|
+
variant: e,
|
|
10
|
+
className: n
|
|
11
|
+
})
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
var r = e("zen__badge inline-flex items-center rounded-md border px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wider uppercase whitespace-nowrap focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-glow/50", {
|
|
15
|
+
variants: { variant: {
|
|
16
|
+
default: "border-glow/30 bg-glow/10 text-primary",
|
|
17
|
+
secondary: "border-tint/10 bg-tint/[0.06] text-foreground",
|
|
18
|
+
destructive: "border-destructive/40 bg-destructive/15 text-destructive",
|
|
19
|
+
outline: "border-tint/10 text-foreground"
|
|
20
|
+
} },
|
|
21
|
+
defaultVariants: { variant: "default" }
|
|
22
|
+
});
|
|
23
|
+
//#endregion
|
|
24
|
+
export { n as default };
|
package/dist/button/index.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { VariantProps } from '../utils/cva';
|
|
2
2
|
import { ComponentProps } from 'react';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* A button in one of Zen's styles. With `asChild`, the styles go onto your own
|
|
5
|
+
* single child element instead, such as a router's Link (`loading` and `type`
|
|
6
|
+
* then don't apply).
|
|
7
|
+
*/
|
|
8
|
+
export default function Button({ className, variant, size, loading, disabled, type, asChild, children, ...rest }: ButtonProps): import('react').JSX.Element;
|
|
4
9
|
export declare const buttonVariants: (props?: ({
|
|
5
|
-
variant?: "outline" | "link" | "default" | "icon" | "
|
|
6
|
-
size?: "default" | "icon" | "sm" | "lg" | null | undefined;
|
|
10
|
+
variant?: "outline" | "link" | "default" | "icon" | "destructive" | "secondary" | "ghost" | null | undefined;
|
|
11
|
+
size?: "default" | "icon" | "sm" | "lg" | "icon-sm" | null | undefined;
|
|
7
12
|
} & ({
|
|
8
13
|
class: import('../utils/cx').ClassValue;
|
|
9
14
|
className?: never;
|
|
@@ -17,5 +22,7 @@ export declare const buttonVariants: (props?: ({
|
|
|
17
22
|
export interface ButtonProps extends ComponentProps<'button'>, VariantProps<typeof buttonVariants> {
|
|
18
23
|
/** Shows a spinner and disables the button while an action runs. */
|
|
19
24
|
loading?: boolean;
|
|
25
|
+
/** Put the button's styles on the single child element (e.g. a link) instead of a <button>. */
|
|
26
|
+
asChild?: boolean;
|
|
20
27
|
}
|
|
21
28
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/button/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/button/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAO,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAC3B,SAAS,EACT,OAAO,EACP,IAAI,EACJ,OAAe,EACf,QAAQ,EACR,IAAe,EACf,OAAe,EACf,QAAQ,EACR,GAAG,IAAI,EACV,EAAE,WAAW,+BAqBb;AAED,eAAO,MAAM,cAAc;;;;;;;;;;;;0BAuC1B,CAAC;AAEF,MAAM,WAAW,WAAY,SAAQ,cAAc,CAAC,QAAQ,CAAC,EAAE,YAAY,CAAC,OAAO,cAAc,CAAC;IAC9F,oEAAoE;IACpE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,+FAA+F;IAC/F,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Slot as e } from "../utils/slot.js";
|
|
3
|
+
import { cva as t } from "../utils/cva.js";
|
|
4
|
+
import n from "../spinner/index.js";
|
|
5
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
6
|
+
//#region packages/button/index.tsx
|
|
7
|
+
function a({ className: t, variant: a, size: s, loading: c = !1, disabled: l, type: u = "button", asChild: d = !1, children: f, ...p }) {
|
|
8
|
+
return d ? /* @__PURE__ */ r(e, {
|
|
9
|
+
...p,
|
|
10
|
+
className: o({
|
|
11
|
+
variant: a,
|
|
12
|
+
size: s,
|
|
13
|
+
className: t
|
|
14
|
+
}),
|
|
15
|
+
children: f
|
|
16
|
+
}) : /* @__PURE__ */ i("button", {
|
|
17
|
+
type: u,
|
|
18
|
+
disabled: l || c,
|
|
19
|
+
"aria-busy": c || void 0,
|
|
20
|
+
className: o({
|
|
21
|
+
variant: a,
|
|
22
|
+
size: s,
|
|
23
|
+
className: t
|
|
24
|
+
}),
|
|
25
|
+
...p,
|
|
26
|
+
children: [c && /* @__PURE__ */ r(n, {}), f]
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
var o = t("zen__button inline-flex items-center justify-center gap-2 rounded-lg text-sm font-medium whitespace-nowrap outline-hidden select-none transition-[background-color,border-color,box-shadow,color,transform] duration-200 ease-out active:scale-[0.97] focus-visible:ring-2 focus-visible:ring-glow/50 disabled:pointer-events-none disabled:opacity-50", {
|
|
30
|
+
variants: {
|
|
31
|
+
variant: {
|
|
32
|
+
default: "bg-primary bg-[linear-gradient(to_bottom,oklch(1_0_0/0.16),transparent)] text-primary-foreground shadow-[0_0_0_1px_oklch(var(--glow)/0.55),0_0_22px_-6px_oklch(var(--glow)/0.7),inset_0_1px_0_hsl(0_0%_100%/0.3)] hover:shadow-[0_0_0_1px_oklch(var(--glow)/0.8),0_0_28px_-4px_oklch(var(--glow)/0.85),inset_0_1px_0_hsl(0_0%_100%/0.35)]",
|
|
33
|
+
secondary: "bg-primary/15 text-foreground shadow-[inset_0_0_0_1px_oklch(var(--primary)/0.25)] hover:bg-primary/25",
|
|
34
|
+
outline: "glow-edge border border-tint/10 bg-tint/[0.03] text-foreground hover:border-tint/20 hover:bg-tint/[0.07]",
|
|
35
|
+
ghost: "text-muted-foreground hover:bg-tint/[0.06] hover:text-foreground",
|
|
36
|
+
destructive: "bg-destructive/90 text-destructive-foreground shadow-[0_0_0_1px_oklch(var(--destructive)/0.6),0_0_22px_-8px_oklch(var(--destructive)/0.7)] hover:bg-destructive",
|
|
37
|
+
link: "h-auto! px-0! text-primary underline-offset-4 hover:underline",
|
|
38
|
+
icon: "text-muted-foreground hover:bg-tint/[0.06] hover:text-foreground"
|
|
39
|
+
},
|
|
40
|
+
size: {
|
|
41
|
+
default: "h-10 px-4",
|
|
42
|
+
sm: "h-8 px-3 text-xs",
|
|
43
|
+
lg: "h-11 px-6",
|
|
44
|
+
icon: "size-9",
|
|
45
|
+
"icon-sm": "size-6 rounded-md"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
defaultVariants: {
|
|
49
|
+
variant: "default",
|
|
50
|
+
size: "default"
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
//#endregion
|
|
54
|
+
export { o as buttonVariants, a as default };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { DateRange, DateString } from '../utils/date';
|
|
2
|
+
import { Month } from '../utils/month';
|
|
3
|
+
/**
|
|
4
|
+
* A month grid to pick a date, or a range of dates, fully keyboard-driven:
|
|
5
|
+
* arrows move by day and week, Home and End to the week's ends, Page Up and
|
|
6
|
+
* Down by month (with Shift, by year). The title opens a year and month grid
|
|
7
|
+
* to jump far. Dates are "YYYY-MM-DD" strings, so they never shift a day with
|
|
8
|
+
* time zones. Inline on a page, or in a popup with DatePicker.
|
|
9
|
+
*/
|
|
10
|
+
export default function Calendar(props: CalendarProps): import('react').JSX.Element;
|
|
11
|
+
interface CalendarBaseProps {
|
|
12
|
+
/** Decides month and weekday names, and the first day of the week, e.g. "en-IN". */
|
|
13
|
+
locale: string;
|
|
14
|
+
/** Earliest date that can be picked ("YYYY-MM-DD"). */
|
|
15
|
+
min?: DateString;
|
|
16
|
+
/** Latest date that can be picked. */
|
|
17
|
+
max?: DateString;
|
|
18
|
+
/** Dates that can't be picked, e.g. weekends or booked days. */
|
|
19
|
+
isDisabled?: (date: DateString) => boolean;
|
|
20
|
+
/** 0 for Sunday … 6 for Saturday. Defaults to the locale's. */
|
|
21
|
+
weekStartsOn?: number;
|
|
22
|
+
/** Months shown side by side (e.g. 2 for ranges). */
|
|
23
|
+
months?: number;
|
|
24
|
+
/** Month shown first ("YYYY-MM"). Defaults to the chosen date's, or this month. */
|
|
25
|
+
defaultMonth?: Month;
|
|
26
|
+
/** Focus the chosen date (or today) when shown, e.g. in a popup. */
|
|
27
|
+
autoFocus?: boolean;
|
|
28
|
+
className?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface CalendarSingleProps extends CalendarBaseProps {
|
|
31
|
+
mode?: 'single';
|
|
32
|
+
/** "YYYY-MM-DD", or null for none. */
|
|
33
|
+
value: DateString | null;
|
|
34
|
+
onChange: (date: DateString) => void;
|
|
35
|
+
}
|
|
36
|
+
export interface CalendarRangeProps extends CalendarBaseProps {
|
|
37
|
+
/** Pick a start and then an end; the days between are highlighted, previewed while pointing. */
|
|
38
|
+
mode: 'range';
|
|
39
|
+
value: DateRange | null;
|
|
40
|
+
onChange: (range: DateRange) => void;
|
|
41
|
+
}
|
|
42
|
+
export type CalendarProps = CalendarSingleProps | CalendarRangeProps;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/calendar/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAGH,KAAK,SAAS,EACd,KAAK,UAAU,EAOlB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAA0B,KAAK,KAAK,EAA6B,MAAM,kBAAkB,CAAC;AAGjG;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAK,EAAE,aAAa,+BAsRpD;AAOD,UAAU,iBAAiB;IACvB,oFAAoF;IACpF,MAAM,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB,sCAAsC;IACtC,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB,gEAAgE;IAChE,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,OAAO,CAAC;IAC3C,+DAA+D;IAC/D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mFAAmF;IACnF,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,oEAAoE;IACpE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB;IAC1D,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,sCAAsC;IACtC,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;CACxC;AAED,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB;IACzD,gGAAgG;IAChG,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;CACxC;AAED,MAAM,MAAM,aAAa,GAAG,mBAAmB,GAAG,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx as e } from "../utils/cx.js";
|
|
3
|
+
import t from "../icons/chevron-left.js";
|
|
4
|
+
import n from "../icons/chevron-right.js";
|
|
5
|
+
import { addMonths as r, formatMonth as i, monthNames as a, monthsBetween as o } from "../utils/month.js";
|
|
6
|
+
import { addDays as s, addMonthsToDate as c, dayOfWeek as l, daysInMonth as u, formatDate as ee, today as d, weekStart as f, weekdayNames as p } from "../utils/date.js";
|
|
7
|
+
import { useEffect as m, useId as h, useRef as g, useState as _ } from "react";
|
|
8
|
+
import { jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
9
|
+
//#region packages/calendar/index.tsx
|
|
10
|
+
function b(b) {
|
|
11
|
+
let { locale: S, min: C, max: w, isDisabled: ne, weekStartsOn: T = f(S), months: E = 1, defaultMonth: re, className: D, autoFocus: ie } = b, O = b.mode === "range" ? b.value : null, k = b.mode === "range" ? null : b.value, A = k ?? O?.start ?? null, j = d(), [M, N] = _(() => re ?? (A ?? j).slice(0, 7)), [P, F] = _(() => A ?? j), [I, L] = _(null), [R, z] = _("days"), [B, V] = _(() => Number(M.slice(0, 4))), H = g(null), U = g(ie ?? !1), W = h(), G = r(M, E - 1), K = (e) => e.slice(0, 7) >= M && e.slice(0, 7) <= G, q = (e) => !!C && e < C || !!w && e > w || !!ne?.(e), J = K(P) ? P : c(P, o(P.slice(0, 7), M));
|
|
12
|
+
m(() => {
|
|
13
|
+
U.current && (U.current = !1, H.current?.querySelector(`[data-date="${J}"]`)?.focus());
|
|
14
|
+
}, [J, R]);
|
|
15
|
+
let ae = (e) => {
|
|
16
|
+
C && e < C && (e = C), w && e > w && (e = w), U.current = !0, F(e), K(e) || N(e < M ? e.slice(0, 7) : r(e.slice(0, 7), -(E - 1)));
|
|
17
|
+
}, oe = (e) => {
|
|
18
|
+
if (!q(e)) {
|
|
19
|
+
if (F(e), b.mode === "range") {
|
|
20
|
+
let t = b.value;
|
|
21
|
+
!t || t.end !== null ? b.onChange({
|
|
22
|
+
start: e,
|
|
23
|
+
end: null
|
|
24
|
+
}) : b.onChange(e < t.start ? {
|
|
25
|
+
start: e,
|
|
26
|
+
end: t.start
|
|
27
|
+
} : {
|
|
28
|
+
start: t.start,
|
|
29
|
+
end: e
|
|
30
|
+
});
|
|
31
|
+
} else b.onChange(e);
|
|
32
|
+
}
|
|
33
|
+
}, se = (e) => {
|
|
34
|
+
let t = J, n = (l(t) - T + 7) % 7, r = {
|
|
35
|
+
ArrowLeft: s(t, -1),
|
|
36
|
+
ArrowRight: s(t, 1),
|
|
37
|
+
ArrowUp: s(t, -7),
|
|
38
|
+
ArrowDown: s(t, 7),
|
|
39
|
+
Home: s(t, -n),
|
|
40
|
+
End: s(t, 6 - n),
|
|
41
|
+
PageUp: c(t, e.shiftKey ? -12 : -1),
|
|
42
|
+
PageDown: c(t, e.shiftKey ? 12 : 1)
|
|
43
|
+
}[e.key];
|
|
44
|
+
r && (e.preventDefault(), ae(r));
|
|
45
|
+
}, Y = O && O.end === null ? O.start : null, ce = Y && I ? I < Y ? [I, Y] : [Y, I] : null, [X, Z] = O?.end ? [O.start, O.end] : ce ?? [null, null], Q = (e) => {
|
|
46
|
+
N((t) => r(t, e));
|
|
47
|
+
}, $ = /* @__PURE__ */ y("div", {
|
|
48
|
+
className: "mb-2 flex items-center justify-between gap-2",
|
|
49
|
+
children: [
|
|
50
|
+
/* @__PURE__ */ v("button", {
|
|
51
|
+
type: "button",
|
|
52
|
+
"aria-label": R === "days" ? "Previous month" : "Previous year",
|
|
53
|
+
onClick: () => R === "days" ? Q(-1) : V((e) => e - 1),
|
|
54
|
+
className: x,
|
|
55
|
+
children: /* @__PURE__ */ v(t, { className: "size-4" })
|
|
56
|
+
}),
|
|
57
|
+
/* @__PURE__ */ v("button", {
|
|
58
|
+
type: "button",
|
|
59
|
+
id: W,
|
|
60
|
+
"aria-live": "polite",
|
|
61
|
+
"aria-label": R === "days" ? `${i(M, S, "long")}, choose month and year` : `${B}, back to days`,
|
|
62
|
+
onClick: () => {
|
|
63
|
+
V(Number(M.slice(0, 4))), z((e) => e === "days" ? "months" : "days");
|
|
64
|
+
},
|
|
65
|
+
className: "hover:bg-tint/[0.07] focus-visible:ring-ring/50 rounded-md px-2 py-1 text-sm font-semibold tabular-nums outline-hidden transition-colors focus-visible:ring-2",
|
|
66
|
+
children: R === "days" ? E === 1 ? i(M, S, "long") : `${i(M, S)} – ${i(G, S)}` : B
|
|
67
|
+
}),
|
|
68
|
+
/* @__PURE__ */ v("button", {
|
|
69
|
+
type: "button",
|
|
70
|
+
"aria-label": R === "days" ? "Next month" : "Next year",
|
|
71
|
+
onClick: () => R === "days" ? Q(1) : V((e) => e + 1),
|
|
72
|
+
className: x,
|
|
73
|
+
children: /* @__PURE__ */ v(n, { className: "size-4" })
|
|
74
|
+
})
|
|
75
|
+
]
|
|
76
|
+
});
|
|
77
|
+
if (R === "months") {
|
|
78
|
+
let t = a(S);
|
|
79
|
+
return /* @__PURE__ */ y("div", {
|
|
80
|
+
className: e("zen__calendar w-fit", D),
|
|
81
|
+
children: [$, /* @__PURE__ */ v("div", {
|
|
82
|
+
className: "grid w-64 grid-cols-3 gap-1",
|
|
83
|
+
role: "group",
|
|
84
|
+
"aria-labelledby": W,
|
|
85
|
+
children: t.map((t, n) => {
|
|
86
|
+
let r = `${B}-${String(n + 1).padStart(2, "0")}`, a = !!C && r < C.slice(0, 7) || !!w && r > w.slice(0, 7);
|
|
87
|
+
return /* @__PURE__ */ v("button", {
|
|
88
|
+
type: "button",
|
|
89
|
+
disabled: a,
|
|
90
|
+
"aria-pressed": r === M,
|
|
91
|
+
"aria-label": i(r, S, "long"),
|
|
92
|
+
onClick: () => {
|
|
93
|
+
N(r), U.current = !0, F(c(P, o(P.slice(0, 7), r))), z("days");
|
|
94
|
+
},
|
|
95
|
+
className: e("rounded-lg py-2 text-sm outline-hidden transition-colors disabled:cursor-not-allowed disabled:opacity-35", "focus-visible:ring-ring/50 focus-visible:ring-2", r === M ? "bg-primary text-primary-foreground" : "hover:bg-tint/[0.07]"),
|
|
96
|
+
children: t
|
|
97
|
+
}, r);
|
|
98
|
+
})
|
|
99
|
+
})]
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
let le = p(S, "narrow"), ue = p(S, "long"), de = Array.from({ length: 7 }, (e, t) => (T + t) % 7);
|
|
103
|
+
return /* @__PURE__ */ y("div", {
|
|
104
|
+
className: e("zen__calendar w-fit", D),
|
|
105
|
+
children: [$, /* @__PURE__ */ v("div", {
|
|
106
|
+
ref: H,
|
|
107
|
+
className: "flex gap-4",
|
|
108
|
+
onKeyDown: se,
|
|
109
|
+
onMouseLeave: () => L(null),
|
|
110
|
+
children: Array.from({ length: E }, (t, n) => {
|
|
111
|
+
let a = r(M, n), o = `${a}-01`, c = `${a}-${u(a)}`, d = s(o, -((l(o) - T + 7) % 7));
|
|
112
|
+
return /* @__PURE__ */ y("table", {
|
|
113
|
+
role: "grid",
|
|
114
|
+
"aria-label": i(a, S, "long"),
|
|
115
|
+
className: "border-separate border-spacing-x-0 border-spacing-y-0.5",
|
|
116
|
+
children: [
|
|
117
|
+
E > 1 && /* @__PURE__ */ v("caption", {
|
|
118
|
+
className: "text-muted-foreground pb-1 text-xs font-medium",
|
|
119
|
+
children: i(a, S, "long")
|
|
120
|
+
}),
|
|
121
|
+
/* @__PURE__ */ v("thead", { children: /* @__PURE__ */ v("tr", { children: de.map((e) => /* @__PURE__ */ v("th", {
|
|
122
|
+
scope: "col",
|
|
123
|
+
abbr: ue[e],
|
|
124
|
+
className: "text-muted-foreground size-9 text-xs font-medium",
|
|
125
|
+
children: le[e]
|
|
126
|
+
}, e)) }) }),
|
|
127
|
+
/* @__PURE__ */ v("tbody", { children: Array.from({ length: 6 }, (t, n) => /* @__PURE__ */ v("tr", { children: Array.from({ length: 7 }, (t, r) => {
|
|
128
|
+
let i = s(d, n * 7 + r), l = i.slice(0, 7) === a;
|
|
129
|
+
if (!l && E > 1) return /* @__PURE__ */ v("td", { role: "gridcell" }, i);
|
|
130
|
+
let u = i === X, f = i === Z, p = !!X && !!Z && i > X && i < Z, m = i === k || i === O?.start || i === O?.end, h = q(i);
|
|
131
|
+
return /* @__PURE__ */ v("td", {
|
|
132
|
+
role: "gridcell",
|
|
133
|
+
"aria-selected": m || p || void 0,
|
|
134
|
+
className: e("p-0", (p || (u || f) && X !== Z) && "bg-primary/15", u && "rounded-l-lg", f && "rounded-r-lg", p && (r === 0 || E > 1 && i === o) && "rounded-l-lg", p && (r === 6 || E > 1 && i === c) && "rounded-r-lg"),
|
|
135
|
+
children: /* @__PURE__ */ v("button", {
|
|
136
|
+
type: "button",
|
|
137
|
+
"data-date": i,
|
|
138
|
+
tabIndex: i === J ? 0 : -1,
|
|
139
|
+
"aria-label": ee(i, S, "full"),
|
|
140
|
+
"aria-pressed": m,
|
|
141
|
+
"aria-disabled": h || void 0,
|
|
142
|
+
"aria-current": i === j ? "date" : void 0,
|
|
143
|
+
onClick: () => oe(i),
|
|
144
|
+
onFocus: () => {
|
|
145
|
+
F(i), Y && L(i);
|
|
146
|
+
},
|
|
147
|
+
onMouseEnter: () => Y && L(i),
|
|
148
|
+
className: e(te, !l && "text-muted-foreground/45", h && "cursor-not-allowed opacity-35", m ? "bg-primary text-primary-foreground shadow-[0_0_20px_-4px_oklch(var(--glow)/0.8)]" : !h && "hover:bg-tint/[0.08]", i === j && "after:bg-primary after:absolute after:bottom-1 after:left-1/2 after:size-1 after:-translate-x-1/2 after:rounded-full", i === j && m && "after:bg-primary-foreground"),
|
|
149
|
+
children: Number(i.slice(8))
|
|
150
|
+
})
|
|
151
|
+
}, i);
|
|
152
|
+
}) }, n)) })
|
|
153
|
+
]
|
|
154
|
+
}, a);
|
|
155
|
+
})
|
|
156
|
+
})]
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
var x = "text-muted-foreground hover:bg-tint/[0.07] hover:text-foreground focus-visible:ring-ring/50 grid size-8 place-items-center rounded-md outline-hidden transition-colors focus-visible:ring-2", te = "relative grid size-9 place-items-center rounded-lg text-sm tabular-nums outline-hidden transition-[background-color,color,box-shadow] duration-150 focus-visible:ring-2 focus-visible:ring-ring/60";
|
|
160
|
+
//#endregion
|
|
161
|
+
export { b as default };
|
package/dist/card/index.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { ComponentProps, ReactNode } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Glass panel whose border catches the pointer light. For a title with an
|
|
4
|
+
* action beside it, start it with a CardHeader holding a CardTitle and the action.
|
|
5
|
+
*/
|
|
6
|
+
export default function Card({ className, ...rest }: CardProps): import('react').JSX.Element;
|
|
7
|
+
/** The top row of a Card: its title, and an action (a button, a menu) at the end. */
|
|
8
|
+
export declare function CardHeader({ className, ...rest }: ComponentProps<'header'>): import('react').JSX.Element;
|
|
9
|
+
/** A line under the CardTitle: what the card is about, or a figure's context ("₹12L at 8.5% · 20 years"). */
|
|
10
|
+
export declare function CardDescription({ className, ...rest }: ComponentProps<'p'>): import('react').JSX.Element;
|
|
11
|
+
/** The card's title: an h4 by default; with `asChild`, your own heading (an h2, say) gets its look. */
|
|
12
|
+
export declare function CardTitle({ asChild, className, children, ...rest }: CardTitleProps): import('react').JSX.Element;
|
|
4
13
|
/** A single figure with a label, e.g. "Revenue $12,400". */
|
|
5
14
|
export declare function Stat({ label, value, hint, tone, className }: StatProps): import('react').JSX.Element;
|
|
6
15
|
/** Row of stats: two columns on phones (an odd last one spans both), three from `sm` up. */
|
|
@@ -8,10 +17,10 @@ export declare function StatRow({ children, className }: {
|
|
|
8
17
|
children: ReactNode;
|
|
9
18
|
className?: string;
|
|
10
19
|
}): import('react').JSX.Element;
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
|
|
20
|
+
export type CardProps = ComponentProps<'section'>;
|
|
21
|
+
export interface CardTitleProps extends ComponentProps<'h4'> {
|
|
22
|
+
/** Put the title's look on your own heading element instead of an h4. */
|
|
23
|
+
asChild?: boolean;
|
|
15
24
|
}
|
|
16
25
|
export interface StatProps {
|
|
17
26
|
label: string;
|
package/dist/card/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/card/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/card/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElD;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,SAAS,+BAO7D;AAED,qFAAqF;AACrF,wBAAgB,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,cAAc,CAAC,QAAQ,CAAC,+BAE1E;AAED,6GAA6G;AAC7G,wBAAgB,eAAe,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,cAAc,CAAC,GAAG,CAAC,+BAE1E;AAED,uGAAuG;AACvG,wBAAgB,SAAS,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,cAAc,+BAIlF;AAED,6DAA6D;AAC7D,wBAAgB,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAgB,EAAE,SAAS,EAAE,EAAE,SAAS,+BAkBlF;AAED,4FAA4F;AAC5F,wBAAgB,OAAO,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,+BAY3F;AAED,MAAM,MAAM,SAAS,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC;AAElD,MAAM,WAAW,cAAe,SAAQ,cAAc,CAAC,IAAI,CAAC;IACxD,yEAAyE;IACzE,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,SAAS;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB"}
|