@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/LICENSE
CHANGED
|
@@ -19,3 +19,30 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
The icons (packages/icons) are Heroicons (https://heroicons.com), generated
|
|
26
|
+
from the heroicons package by scripts/icons.mjs, under this license:
|
|
27
|
+
|
|
28
|
+
MIT License
|
|
29
|
+
|
|
30
|
+
Copyright (c) Tailwind Labs, Inc.
|
|
31
|
+
|
|
32
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
33
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
34
|
+
in the Software without restriction, including without limitation the rights
|
|
35
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
36
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
37
|
+
furnished to do so, subject to the following conditions:
|
|
38
|
+
|
|
39
|
+
The above copyright notice and this permission notice shall be included in all
|
|
40
|
+
copies or substantial portions of the Software.
|
|
41
|
+
|
|
42
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
43
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
44
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
45
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
46
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
47
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
48
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -56,12 +56,12 @@ export default function App() {
|
|
|
56
56
|
|
|
57
57
|
## What's inside
|
|
58
58
|
|
|
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, Combobox, MonthPicker, Segmented, Slider, Toggle, Field
|
|
61
|
-
- **Data:** composable Table with sticky edges and sorting, tree rows, editable cells, virtual rows, Meter, ProgressRing, AnimatedNumber
|
|
59
|
+
- **Surfaces:** Card, Inset, Alert, Stat, Dialog (and sheets from an edge), ConfirmDialog, Popover, Tooltip, Toast (a stacked deck), Disclosure, Backdrop (aurora, contours or dots, and a pointer light)
|
|
60
|
+
- **Inputs:** Button, Input, TextArea, InputGroup, MoneyInput (with currency conversion), Select, Combobox, Calendar, DatePicker, DateRangePicker, MonthPicker, Checkbox, RadioGroup, RadioCards, Segmented, Slider, Toggle, Chip, Field
|
|
61
|
+
- **Data:** Chart (areas, lines, bars) and DonutChart in plain SVG, composable Table with sticky edges and sorting, tree rows, editable cells, virtual rows, Meter, ProgressRing, AnimatedNumber, Badge, StatusPill (a live save status), Skeleton, Spinner
|
|
62
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
|
-
- **Hooks and utilities:** `useAnchoredPopup`, `useVirtualList`, `useTree`, `useSort`, money
|
|
64
|
+
- **Hooks and utilities:** `themeWave` (the theme spreads from the switch like a drop falling into water: ripples, glints and a rainbow edge, drawn on the GPU; `prepareThemeWave` readies it when the pointer reaches your own switch), `useAnchoredPopup`, `useVirtualList`, `useTree`, `useSort`, money, currency, month and date helpers, `cx` (Tailwind-aware class merging), `cva`
|
|
65
65
|
|
|
66
66
|
Every component takes `className`, and a class you pass always overrides the component's default.
|
|
67
67
|
|
|
@@ -84,6 +84,14 @@ import { applyPreset, applyTheme, DEFAULT_THEME } from '@rinzai/zen';
|
|
|
84
84
|
applyTheme(applyPreset(DEFAULT_THEME, 'ocean'));
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
+
## Browser support
|
|
88
|
+
|
|
89
|
+
Chrome and Edge 114+, Safari 17+ and Firefox 128+: the versions with the native Popover API that popups, menus and toasts are built on, and with what Tailwind v4 needs.
|
|
90
|
+
|
|
91
|
+
- **Popups** are placed with CSS anchor positioning where the browser has it (Chrome 129+, Safari 26+, recent Firefox). Elsewhere Zen places them itself, the same way.
|
|
92
|
+
- **Glass** is blurred live where there's a GPU and a mouse. On touch screens, without hardware acceleration, and with the OS's "reduce transparency", surfaces are solid instead.
|
|
93
|
+
- **Motion** such as entry animations is left out where a browser lacks it, and for anyone who prefers reduced motion.
|
|
94
|
+
|
|
87
95
|
## Development
|
|
88
96
|
|
|
89
97
|
```sh
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A message beside the content it's about: a notice, a warning, a failure.
|
|
4
|
+
* A tinted box by default, or with `plain`, just the icon and text in the
|
|
5
|
+
* tone's colour. With a `title`, the title takes the tone and the text under
|
|
6
|
+
* it is quieter. Bad news is announced at once (role="alert"), anything else
|
|
7
|
+
* politely (role="status"); pass `role` to change that, e.g. "note" for a
|
|
8
|
+
* message that doesn't change.
|
|
9
|
+
*/
|
|
10
|
+
export default function Alert({ tone, plain, title, icon, className, children, ...rest }: AlertProps): import('react').JSX.Element;
|
|
11
|
+
export interface AlertProps extends Omit<ComponentProps<'div'>, 'title'> {
|
|
12
|
+
/** `positive` in the accent colour, `negative` in red for bad news. */
|
|
13
|
+
tone?: 'default' | 'positive' | 'negative';
|
|
14
|
+
/** Just the icon and text, no box: for a line inside a form or a card. */
|
|
15
|
+
plain?: boolean;
|
|
16
|
+
/** A first line in the tone's colour; the text under it is quieter. */
|
|
17
|
+
title?: ReactNode;
|
|
18
|
+
/** Replaces the tone's icon (info, check, warning); `null` for none. */
|
|
19
|
+
icon?: ReactNode;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/alert/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAgBlD;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAC1B,IAAgB,EAChB,KAAa,EACb,KAAK,EACL,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,GAAG,IAAI,EACV,EAAE,UAAU,+BA4BZ;AAED,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACpE,uEAAuE;IACvE,IAAI,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;IAC3C,0EAA0E;IAC1E,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,uEAAuE;IACvE,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,wEAAwE;IACxE,IAAI,CAAC,EAAE,SAAS,CAAC;CACpB"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx as e } from "../utils/cx.js";
|
|
3
|
+
import { AlertIcon as t, CheckIcon as n, InfoIcon as r } from "../utils/status-icons.js";
|
|
4
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
|
+
//#region packages/alert/index.tsx
|
|
6
|
+
var o = {
|
|
7
|
+
default: {
|
|
8
|
+
icon: r,
|
|
9
|
+
box: "border-tint/[0.08] bg-tint/[0.03] text-muted-foreground",
|
|
10
|
+
plain: "text-muted-foreground"
|
|
11
|
+
},
|
|
12
|
+
positive: {
|
|
13
|
+
icon: n,
|
|
14
|
+
box: "border-primary/30 bg-primary/10 text-primary",
|
|
15
|
+
plain: "text-primary"
|
|
16
|
+
},
|
|
17
|
+
negative: {
|
|
18
|
+
icon: t,
|
|
19
|
+
box: "border-destructive/35 bg-destructive/10 text-destructive",
|
|
20
|
+
plain: "text-destructive"
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
function s({ tone: t = "default", plain: n = !1, title: r, icon: s, className: c, children: l, ...u }) {
|
|
24
|
+
let d = o[t], f = d.icon;
|
|
25
|
+
return /* @__PURE__ */ a("div", {
|
|
26
|
+
role: t === "negative" ? "alert" : "status",
|
|
27
|
+
...u,
|
|
28
|
+
className: e("zen__alert flex items-start gap-2 text-sm", n ? d.plain : e("rounded-lg border px-3 py-2", d.box), c),
|
|
29
|
+
children: [s !== null && /* @__PURE__ */ i("span", {
|
|
30
|
+
"aria-hidden": !0,
|
|
31
|
+
className: "mt-0.5 flex shrink-0",
|
|
32
|
+
children: s ?? /* @__PURE__ */ i(f, {})
|
|
33
|
+
}), r ? /* @__PURE__ */ a("div", {
|
|
34
|
+
className: "flex min-w-0 flex-col gap-1",
|
|
35
|
+
children: [/* @__PURE__ */ i("p", {
|
|
36
|
+
className: "font-medium",
|
|
37
|
+
children: r
|
|
38
|
+
}), /* @__PURE__ */ i("div", {
|
|
39
|
+
className: "text-muted-foreground",
|
|
40
|
+
children: l
|
|
41
|
+
})]
|
|
42
|
+
}) : /* @__PURE__ */ i("div", {
|
|
43
|
+
className: "min-w-0",
|
|
44
|
+
children: l
|
|
45
|
+
})]
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
export { s as default };
|
package/dist/button/index.d.ts
CHANGED
|
@@ -5,10 +5,11 @@ import { ComponentProps } from 'react';
|
|
|
5
5
|
* single child element instead, such as a router's Link (`loading` and `type`
|
|
6
6
|
* then don't apply).
|
|
7
7
|
*/
|
|
8
|
-
export default function Button({ className, variant, size, loading, disabled, type, asChild, children, ...rest }: ButtonProps): import('react').JSX.Element;
|
|
8
|
+
export default function Button({ className, variant, size, tone, loading, disabled, type, asChild, children, ...rest }: ButtonProps): import('react').JSX.Element;
|
|
9
9
|
export declare const buttonVariants: (props?: ({
|
|
10
10
|
variant?: "outline" | "link" | "default" | "icon" | "destructive" | "secondary" | "ghost" | null | undefined;
|
|
11
11
|
size?: "default" | "icon" | "sm" | "lg" | "icon-sm" | null | undefined;
|
|
12
|
+
tone?: "inherit" | "default" | "destructive" | "muted" | null | undefined;
|
|
12
13
|
} & ({
|
|
13
14
|
class: import('../utils/cx').ClassValue;
|
|
14
15
|
className?: never;
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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,IAAI,EACJ,OAAe,EACf,QAAQ,EACR,IAAe,EACf,OAAe,EACf,QAAQ,EACR,GAAG,IAAI,EACV,EAAE,WAAW,+BAqBb;AAED,eAAO,MAAM,cAAc;;;;;;;;;;;;;0BAwD1B,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"}
|
package/dist/button/index.js
CHANGED
|
@@ -4,29 +4,31 @@ import { cva as t } from "../utils/cva.js";
|
|
|
4
4
|
import n from "../spinner/index.js";
|
|
5
5
|
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
6
6
|
//#region packages/button/index.tsx
|
|
7
|
-
function a({ className: t, variant: a, size: s,
|
|
8
|
-
return
|
|
9
|
-
...
|
|
7
|
+
function a({ className: t, variant: a, size: s, tone: c, loading: l = !1, disabled: u, type: d = "button", asChild: f = !1, children: p, ...m }) {
|
|
8
|
+
return f ? /* @__PURE__ */ r(e, {
|
|
9
|
+
...m,
|
|
10
10
|
className: o({
|
|
11
11
|
variant: a,
|
|
12
12
|
size: s,
|
|
13
|
+
tone: c,
|
|
13
14
|
className: t
|
|
14
15
|
}),
|
|
15
|
-
children:
|
|
16
|
+
children: p
|
|
16
17
|
}) : /* @__PURE__ */ i("button", {
|
|
17
|
-
type:
|
|
18
|
-
disabled:
|
|
19
|
-
"aria-busy":
|
|
18
|
+
type: d,
|
|
19
|
+
disabled: u || l,
|
|
20
|
+
"aria-busy": l || void 0,
|
|
20
21
|
className: o({
|
|
21
22
|
variant: a,
|
|
22
23
|
size: s,
|
|
24
|
+
tone: c,
|
|
23
25
|
className: t
|
|
24
26
|
}),
|
|
25
|
-
...
|
|
26
|
-
children: [
|
|
27
|
+
...m,
|
|
28
|
+
children: [l && /* @__PURE__ */ r(n, {}), p]
|
|
27
29
|
});
|
|
28
30
|
}
|
|
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", {
|
|
31
|
+
var o = t("zen__button inline-flex cursor-pointer 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
32
|
variants: {
|
|
31
33
|
variant: {
|
|
32
34
|
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)]",
|
|
@@ -34,7 +36,7 @@ var o = t("zen__button inline-flex items-center justify-center gap-2 rounded-lg
|
|
|
34
36
|
outline: "glow-edge border border-tint/10 bg-tint/[0.03] text-foreground hover:border-tint/20 hover:bg-tint/[0.07]",
|
|
35
37
|
ghost: "text-muted-foreground hover:bg-tint/[0.06] hover:text-foreground",
|
|
36
38
|
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",
|
|
39
|
+
link: "inline-block h-auto! max-w-full truncate rounded-sm px-0! text-left align-bottom text-[length:inherit] text-primary underline-offset-4 hover:underline active:scale-100",
|
|
38
40
|
icon: "text-muted-foreground hover:bg-tint/[0.06] hover:text-foreground"
|
|
39
41
|
},
|
|
40
42
|
size: {
|
|
@@ -43,11 +45,40 @@ var o = t("zen__button inline-flex items-center justify-center gap-2 rounded-lg
|
|
|
43
45
|
lg: "h-11 px-6",
|
|
44
46
|
icon: "size-9",
|
|
45
47
|
"icon-sm": "size-6 rounded-md"
|
|
48
|
+
},
|
|
49
|
+
tone: {
|
|
50
|
+
default: "",
|
|
51
|
+
muted: "",
|
|
52
|
+
inherit: "",
|
|
53
|
+
destructive: ""
|
|
46
54
|
}
|
|
47
55
|
},
|
|
56
|
+
compoundVariants: [
|
|
57
|
+
{
|
|
58
|
+
variant: "link",
|
|
59
|
+
tone: "muted",
|
|
60
|
+
class: "text-muted-foreground underline hover:text-foreground"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
variant: "link",
|
|
64
|
+
tone: "inherit",
|
|
65
|
+
class: "text-current"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
variant: "link",
|
|
69
|
+
tone: "destructive",
|
|
70
|
+
class: "text-destructive"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
variant: ["ghost", "icon"],
|
|
74
|
+
tone: "destructive",
|
|
75
|
+
class: "hover:bg-destructive/10 hover:text-destructive focus-visible:ring-destructive/40"
|
|
76
|
+
}
|
|
77
|
+
],
|
|
48
78
|
defaultVariants: {
|
|
49
79
|
variant: "default",
|
|
50
|
-
size: "default"
|
|
80
|
+
size: "default",
|
|
81
|
+
tone: "default"
|
|
51
82
|
}
|
|
52
83
|
});
|
|
53
84
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/calendar/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/calendar/index.tsx"],"names":[],"mappings":"AAIA,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,+BAkRpD;AAKD,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"}
|
package/dist/calendar/index.js
CHANGED
|
@@ -1,161 +1,162 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cx as e } from "../utils/cx.js";
|
|
3
|
-
import t from "../
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
3
|
+
import { PICKER_MONTH as t, PICKER_NAV as n } from "../utils/styles.js";
|
|
4
|
+
import r from "../icons/chevron-left.js";
|
|
5
|
+
import i from "../icons/chevron-right.js";
|
|
6
|
+
import { addMonths as a, formatMonth as o, monthNames as s, monthsBetween as c } from "../utils/month.js";
|
|
7
|
+
import { addDays as l, addMonthsToDate as u, dayOfWeek as d, daysInMonth as f, formatDate as ee, today as p, weekStart as m, weekdayNames as h } from "../utils/date.js";
|
|
8
|
+
import { useEffect as g, useId as te, useRef as _, useState as v } from "react";
|
|
9
|
+
import { jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
9
10
|
//#region packages/calendar/index.tsx
|
|
10
|
-
function
|
|
11
|
-
let { locale: S, min: C, max: w, isDisabled:
|
|
12
|
-
|
|
11
|
+
function x(x) {
|
|
12
|
+
let { locale: S, min: C, max: w, isDisabled: re, weekStartsOn: T = m(S), months: E = 1, defaultMonth: ie, className: D, autoFocus: ae } = x, O = x.mode === "range" ? x.value : null, k = x.mode === "range" ? null : x.value, A = k ?? O?.start ?? null, j = p(), [M, N] = v(() => ie ?? (A ?? j).slice(0, 7)), [P, F] = v(() => A ?? j), [I, L] = v(null), [R, z] = v("days"), [B, V] = v(() => Number(M.slice(0, 4))), H = _(null), U = _(ae ?? !1), W = te(), G = a(M, E - 1), K = (e) => e.slice(0, 7) >= M && e.slice(0, 7) <= G, q = (e) => !!C && e < C || !!w && e > w || !!re?.(e), J = K(P) ? P : u(P, c(P.slice(0, 7), M));
|
|
13
|
+
g(() => {
|
|
13
14
|
U.current && (U.current = !1, H.current?.querySelector(`[data-date="${J}"]`)?.focus());
|
|
14
15
|
}, [J, R]);
|
|
15
|
-
let
|
|
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) :
|
|
17
|
-
},
|
|
16
|
+
let oe = (e) => {
|
|
17
|
+
C && e < C && (e = C), w && e > w && (e = w), U.current = !0, F(e), K(e) || N(e < M ? e.slice(0, 7) : a(e.slice(0, 7), -(E - 1)));
|
|
18
|
+
}, se = (e) => {
|
|
18
19
|
if (!q(e)) {
|
|
19
|
-
if (F(e),
|
|
20
|
-
let t =
|
|
21
|
-
!t || t.end !== null ?
|
|
20
|
+
if (F(e), x.mode === "range") {
|
|
21
|
+
let t = x.value;
|
|
22
|
+
!t || t.end !== null ? x.onChange({
|
|
22
23
|
start: e,
|
|
23
24
|
end: null
|
|
24
|
-
}) :
|
|
25
|
+
}) : x.onChange(e < t.start ? {
|
|
25
26
|
start: e,
|
|
26
27
|
end: t.start
|
|
27
28
|
} : {
|
|
28
29
|
start: t.start,
|
|
29
30
|
end: e
|
|
30
31
|
});
|
|
31
|
-
} else
|
|
32
|
+
} else x.onChange(e);
|
|
32
33
|
}
|
|
33
|
-
},
|
|
34
|
-
let t = J, n = (
|
|
35
|
-
ArrowLeft:
|
|
36
|
-
ArrowRight:
|
|
37
|
-
ArrowUp:
|
|
38
|
-
ArrowDown:
|
|
39
|
-
Home:
|
|
40
|
-
End:
|
|
41
|
-
PageUp:
|
|
42
|
-
PageDown:
|
|
34
|
+
}, ce = (e) => {
|
|
35
|
+
let t = J, n = (d(t) - T + 7) % 7, r = {
|
|
36
|
+
ArrowLeft: l(t, -1),
|
|
37
|
+
ArrowRight: l(t, 1),
|
|
38
|
+
ArrowUp: l(t, -7),
|
|
39
|
+
ArrowDown: l(t, 7),
|
|
40
|
+
Home: l(t, -n),
|
|
41
|
+
End: l(t, 6 - n),
|
|
42
|
+
PageUp: u(t, e.shiftKey ? -12 : -1),
|
|
43
|
+
PageDown: u(t, e.shiftKey ? 12 : 1)
|
|
43
44
|
}[e.key];
|
|
44
|
-
r && (e.preventDefault(),
|
|
45
|
-
}, Y = O && O.end === null ? O.start : null,
|
|
46
|
-
N((t) =>
|
|
47
|
-
}, $ = /* @__PURE__ */
|
|
45
|
+
r && (e.preventDefault(), oe(r));
|
|
46
|
+
}, Y = O && O.end === null ? O.start : null, le = Y && I ? I < Y ? [I, Y] : [Y, I] : null, [X, Z] = O?.end ? [O.start, O.end] : le ?? [null, null], Q = (e) => {
|
|
47
|
+
N((t) => a(t, e));
|
|
48
|
+
}, $ = /* @__PURE__ */ b("div", {
|
|
48
49
|
className: "mb-2 flex items-center justify-between gap-2",
|
|
49
50
|
children: [
|
|
50
|
-
/* @__PURE__ */
|
|
51
|
+
/* @__PURE__ */ y("button", {
|
|
51
52
|
type: "button",
|
|
52
53
|
"aria-label": R === "days" ? "Previous month" : "Previous year",
|
|
53
54
|
onClick: () => R === "days" ? Q(-1) : V((e) => e - 1),
|
|
54
|
-
className:
|
|
55
|
-
children: /* @__PURE__ */
|
|
55
|
+
className: n,
|
|
56
|
+
children: /* @__PURE__ */ y(r, { className: "size-4" })
|
|
56
57
|
}),
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
+
/* @__PURE__ */ y("button", {
|
|
58
59
|
type: "button",
|
|
59
60
|
id: W,
|
|
60
61
|
"aria-live": "polite",
|
|
61
|
-
"aria-label": R === "days" ? `${
|
|
62
|
+
"aria-label": R === "days" ? `${o(M, S, "long")}, choose month and year` : `${B}, back to days`,
|
|
62
63
|
onClick: () => {
|
|
63
64
|
V(Number(M.slice(0, 4))), z((e) => e === "days" ? "months" : "days");
|
|
64
65
|
},
|
|
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 ?
|
|
66
|
+
className: "hover:bg-tint/[0.07] focus-visible:ring-ring/50 cursor-pointer rounded-md px-2 py-1 text-sm font-semibold tabular-nums outline-hidden transition-colors focus-visible:ring-2",
|
|
67
|
+
children: R === "days" ? E === 1 ? o(M, S, "long") : `${o(M, S)} – ${o(G, S)}` : B
|
|
67
68
|
}),
|
|
68
|
-
/* @__PURE__ */
|
|
69
|
+
/* @__PURE__ */ y("button", {
|
|
69
70
|
type: "button",
|
|
70
71
|
"aria-label": R === "days" ? "Next month" : "Next year",
|
|
71
72
|
onClick: () => R === "days" ? Q(1) : V((e) => e + 1),
|
|
72
|
-
className:
|
|
73
|
-
children: /* @__PURE__ */
|
|
73
|
+
className: n,
|
|
74
|
+
children: /* @__PURE__ */ y(i, { className: "size-4" })
|
|
74
75
|
})
|
|
75
76
|
]
|
|
76
77
|
});
|
|
77
78
|
if (R === "months") {
|
|
78
|
-
let
|
|
79
|
-
return /* @__PURE__ */
|
|
79
|
+
let n = s(S);
|
|
80
|
+
return /* @__PURE__ */ b("div", {
|
|
80
81
|
className: e("zen__calendar w-fit", D),
|
|
81
|
-
children: [$, /* @__PURE__ */
|
|
82
|
+
children: [$, /* @__PURE__ */ y("div", {
|
|
82
83
|
className: "grid w-64 grid-cols-3 gap-1",
|
|
83
84
|
role: "group",
|
|
84
85
|
"aria-labelledby": W,
|
|
85
|
-
children:
|
|
86
|
-
let
|
|
87
|
-
return /* @__PURE__ */
|
|
86
|
+
children: n.map((n, r) => {
|
|
87
|
+
let i = `${B}-${String(r + 1).padStart(2, "0")}`, a = !!C && i < C.slice(0, 7) || !!w && i > w.slice(0, 7);
|
|
88
|
+
return /* @__PURE__ */ y("button", {
|
|
88
89
|
type: "button",
|
|
89
90
|
disabled: a,
|
|
90
|
-
"aria-pressed":
|
|
91
|
-
"aria-label": i
|
|
91
|
+
"aria-pressed": i === M,
|
|
92
|
+
"aria-label": o(i, S, "long"),
|
|
92
93
|
onClick: () => {
|
|
93
|
-
N(
|
|
94
|
+
N(i), U.current = !0, F(u(P, c(P.slice(0, 7), i))), z("days");
|
|
94
95
|
},
|
|
95
|
-
className: e(
|
|
96
|
-
children:
|
|
97
|
-
},
|
|
96
|
+
className: e(t, i === M && "bg-primary text-primary-foreground hover:bg-primary"),
|
|
97
|
+
children: n
|
|
98
|
+
}, i);
|
|
98
99
|
})
|
|
99
100
|
})]
|
|
100
101
|
});
|
|
101
102
|
}
|
|
102
|
-
let
|
|
103
|
-
return /* @__PURE__ */
|
|
103
|
+
let ue = h(S, "narrow"), de = h(S, "long"), fe = Array.from({ length: 7 }, (e, t) => (T + t) % 7);
|
|
104
|
+
return /* @__PURE__ */ b("div", {
|
|
104
105
|
className: e("zen__calendar w-fit", D),
|
|
105
|
-
children: [$, /* @__PURE__ */
|
|
106
|
+
children: [$, /* @__PURE__ */ y("div", {
|
|
106
107
|
ref: H,
|
|
107
108
|
className: "flex gap-4",
|
|
108
|
-
onKeyDown:
|
|
109
|
+
onKeyDown: ce,
|
|
109
110
|
onMouseLeave: () => L(null),
|
|
110
111
|
children: Array.from({ length: E }, (t, n) => {
|
|
111
|
-
let
|
|
112
|
-
return /* @__PURE__ */
|
|
112
|
+
let r = a(M, n), i = `${r}-01`, s = `${r}-${f(r)}`, c = l(i, -((d(i) - T + 7) % 7));
|
|
113
|
+
return /* @__PURE__ */ b("table", {
|
|
113
114
|
role: "grid",
|
|
114
|
-
"aria-label":
|
|
115
|
+
"aria-label": o(r, S, "long"),
|
|
115
116
|
className: "border-separate border-spacing-x-0 border-spacing-y-0.5",
|
|
116
117
|
children: [
|
|
117
|
-
E > 1 && /* @__PURE__ */
|
|
118
|
+
E > 1 && /* @__PURE__ */ y("caption", {
|
|
118
119
|
className: "text-muted-foreground pb-1 text-xs font-medium",
|
|
119
|
-
children:
|
|
120
|
+
children: o(r, S, "long")
|
|
120
121
|
}),
|
|
121
|
-
/* @__PURE__ */
|
|
122
|
+
/* @__PURE__ */ y("thead", { children: /* @__PURE__ */ y("tr", { children: fe.map((e) => /* @__PURE__ */ y("th", {
|
|
122
123
|
scope: "col",
|
|
123
|
-
abbr:
|
|
124
|
+
abbr: de[e],
|
|
124
125
|
className: "text-muted-foreground size-9 text-xs font-medium",
|
|
125
|
-
children:
|
|
126
|
+
children: ue[e]
|
|
126
127
|
}, e)) }) }),
|
|
127
|
-
/* @__PURE__ */
|
|
128
|
-
let
|
|
129
|
-
if (!
|
|
130
|
-
let
|
|
131
|
-
return /* @__PURE__ */
|
|
128
|
+
/* @__PURE__ */ y("tbody", { children: Array.from({ length: 6 }, (t, n) => /* @__PURE__ */ y("tr", { children: Array.from({ length: 7 }, (t, a) => {
|
|
129
|
+
let o = l(c, n * 7 + a), u = o.slice(0, 7) === r;
|
|
130
|
+
if (!u && E > 1) return /* @__PURE__ */ y("td", { role: "gridcell" }, o);
|
|
131
|
+
let d = o === X, f = o === Z, p = !!X && !!Z && o > X && o < Z, m = o === k || o === O?.start || o === O?.end, h = q(o);
|
|
132
|
+
return /* @__PURE__ */ y("td", {
|
|
132
133
|
role: "gridcell",
|
|
133
134
|
"aria-selected": m || p || void 0,
|
|
134
|
-
className: e("p-0", (p || (
|
|
135
|
-
children: /* @__PURE__ */
|
|
135
|
+
className: e("p-0", (p || (d || f) && X !== Z) && "bg-primary/15", d && "rounded-l-lg", f && "rounded-r-lg", p && (a === 0 || E > 1 && o === i) && "rounded-l-lg", p && (a === 6 || E > 1 && o === s) && "rounded-r-lg"),
|
|
136
|
+
children: /* @__PURE__ */ y("button", {
|
|
136
137
|
type: "button",
|
|
137
|
-
"data-date":
|
|
138
|
-
tabIndex:
|
|
139
|
-
"aria-label": ee(
|
|
138
|
+
"data-date": o,
|
|
139
|
+
tabIndex: o === J ? 0 : -1,
|
|
140
|
+
"aria-label": ee(o, S, "full"),
|
|
140
141
|
"aria-pressed": m,
|
|
141
142
|
"aria-disabled": h || void 0,
|
|
142
|
-
"aria-current":
|
|
143
|
-
onClick: () =>
|
|
143
|
+
"aria-current": o === j ? "date" : void 0,
|
|
144
|
+
onClick: () => se(o),
|
|
144
145
|
onFocus: () => {
|
|
145
|
-
F(
|
|
146
|
+
F(o), Y && L(o);
|
|
146
147
|
},
|
|
147
|
-
onMouseEnter: () => Y && L(
|
|
148
|
-
className: e(
|
|
149
|
-
children: Number(
|
|
148
|
+
onMouseEnter: () => Y && L(o),
|
|
149
|
+
className: e(ne, !u && "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]", o === j && "after:bg-primary after:absolute after:bottom-1 after:left-1/2 after:size-1 after:-translate-x-1/2 after:rounded-full", o === j && m && "after:bg-primary-foreground"),
|
|
150
|
+
children: Number(o.slice(8))
|
|
150
151
|
})
|
|
151
|
-
},
|
|
152
|
+
}, o);
|
|
152
153
|
}) }, n)) })
|
|
153
154
|
]
|
|
154
|
-
},
|
|
155
|
+
}, r);
|
|
155
156
|
})
|
|
156
157
|
})]
|
|
157
158
|
});
|
|
158
159
|
}
|
|
159
|
-
var
|
|
160
|
+
var ne = "relative grid size-9 cursor-pointer 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
161
|
//#endregion
|
|
161
|
-
export {
|
|
162
|
+
export { x as default };
|
package/dist/chart/donut.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { ChartPalette } from './palette';
|
|
2
3
|
/**
|
|
3
4
|
* A ring of parts of a whole (e.g. spending by category), with your content in
|
|
4
5
|
* the middle (e.g. the total). Segments are parted by a small gap, with
|
|
@@ -6,7 +7,7 @@ import { ReactNode } from 'react';
|
|
|
6
7
|
* value. Best for a handful of parts: past about six, use bars. Colours default
|
|
7
8
|
* to the chart palette in order.
|
|
8
9
|
*/
|
|
9
|
-
export default function DonutChart({ items, label, size, thickness, formatValue, children, className, }: DonutChartProps): import('react').JSX.Element;
|
|
10
|
+
export default function DonutChart({ items, label, size, thickness, palette, formatValue, children, className, }: DonutChartProps): import('react').JSX.Element;
|
|
10
11
|
export interface DonutChartProps {
|
|
11
12
|
/** The parts, in order round the ring from 12 o'clock. */
|
|
12
13
|
items: {
|
|
@@ -23,6 +24,8 @@ export interface DonutChartProps {
|
|
|
23
24
|
thickness?: number;
|
|
24
25
|
/** Values in the tooltip and for screen readers. */
|
|
25
26
|
formatValue?: (value: number) => string;
|
|
27
|
+
/** Colours for items that don't give their own: the categorical palette (default), or shades of the theme's glow. */
|
|
28
|
+
palette?: ChartPalette;
|
|
26
29
|
/** Content in the middle, e.g. the total. */
|
|
27
30
|
children?: ReactNode;
|
|
28
31
|
className?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"donut.d.ts","sourceRoot":"","sources":["../../packages/chart/donut.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"donut.d.ts","sourceRoot":"","sources":["../../packages/chart/donut.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAqC,MAAM,OAAO,CAAC;AAErE,OAAO,EAAE,KAAK,YAAY,EAAgB,MAAM,WAAW,CAAC;AAG5D;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EAC/B,KAAK,EACL,KAAK,EACL,IAAU,EACV,SAAgB,EAChB,OAAiB,EACjB,WAAoB,EACpB,QAAQ,EACR,SAAS,GACZ,EAAE,eAAe,+BAiIjB;AA8CD,MAAM,WAAW,eAAe;IAC5B,0DAA0D;IAC1D,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACvE,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,sBAAsB;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACxC,qHAAqH;IACrH,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB"}
|