@rinzai/zen 0.10.2 → 0.11.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 +3 -3
- package/dist/avatar/index.d.ts +1 -1
- package/dist/avatar/index.d.ts.map +1 -1
- package/dist/avatar/index.js +23 -21
- package/dist/canvas/geometry.d.ts +51 -0
- package/dist/canvas/geometry.d.ts.map +1 -0
- package/dist/canvas/geometry.js +91 -0
- package/dist/canvas/index.d.ts +59 -0
- package/dist/canvas/index.d.ts.map +1 -0
- package/dist/canvas/index.js +303 -0
- package/dist/code-block/index.d.ts.map +1 -1
- package/dist/code-block/index.js +24 -31
- package/dist/color-picker/index.d.ts +36 -0
- package/dist/color-picker/index.d.ts.map +1 -0
- package/dist/color-picker/index.js +210 -0
- package/dist/combobox/index.js +46 -46
- package/dist/date-picker/index.js +5 -5
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/input/index.js +4 -4
- package/dist/input-group/index.js +8 -8
- package/dist/lib.js +84 -80
- package/dist/money-input/index.js +8 -8
- package/dist/month-picker/index.js +11 -11
- package/dist/repeat-picker/index.js +8 -8
- package/dist/select/index.js +16 -16
- package/dist/sortable/index.d.ts.map +1 -1
- package/dist/sortable/index.js +1 -1
- package/dist/tag-input/index.js +4 -4
- package/dist/textarea/index.js +4 -4
- package/dist/utils/color.d.ts +35 -0
- package/dist/utils/color.d.ts.map +1 -0
- package/dist/utils/color.js +66 -0
- package/dist/utils/theme-wave.d.ts.map +1 -1
- package/dist/utils/theme-wave.js +70 -69
- package/dist/utils/theme.d.ts.map +1 -1
- package/dist/utils/theme.js +56 -59
- package/dist/utils/useCopyToClipboard.d.ts +13 -0
- package/dist/utils/useCopyToClipboard.d.ts.map +1 -0
- package/dist/utils/useCopyToClipboard.js +26 -0
- package/dist/zen.css +1 -1
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cx as e } from "../utils/cx.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { useFieldProps as t } from "../field/index.js";
|
|
4
|
+
import { FIELD_WITHIN as n } from "../utils/styles.js";
|
|
5
5
|
import { jsx as r } from "react/jsx-runtime";
|
|
6
6
|
//#region packages/input-group/index.tsx
|
|
7
|
-
function i({ invalid:
|
|
7
|
+
function i({ invalid: t, className: i, onMouseDown: a, ...o }) {
|
|
8
8
|
return /* @__PURE__ */ r("div", {
|
|
9
|
-
"data-invalid":
|
|
10
|
-
className: e("zen__input-group cursor-text",
|
|
9
|
+
"data-invalid": t || void 0,
|
|
10
|
+
className: e("zen__input-group cursor-text", n, "has-disabled:bg-muted has-disabled:text-muted-foreground has-disabled:cursor-not-allowed", "data-invalid:border-destructive data-invalid:focus-within:border-destructive data-invalid:focus-within:shadow-[0_0_0_3px_oklch(var(--destructive)/0.16)]", i),
|
|
11
11
|
onMouseDown: (e) => {
|
|
12
12
|
a?.(e);
|
|
13
13
|
let t = e.target;
|
|
@@ -18,10 +18,10 @@ function i({ invalid: n, className: i, onMouseDown: a, ...o }) {
|
|
|
18
18
|
...o
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
function a({ className:
|
|
22
|
-
let a =
|
|
21
|
+
function a({ className: n, ...i }) {
|
|
22
|
+
let a = t(i);
|
|
23
23
|
return /* @__PURE__ */ r("input", {
|
|
24
|
-
className: e("h-full w-full min-w-0 flex-1 bg-transparent text-sm outline-hidden placeholder:text-[color:oklch(var(--muted-foreground)/var(--zen-placeholder))] disabled:cursor-not-allowed",
|
|
24
|
+
className: e("h-full w-full min-w-0 flex-1 bg-transparent text-sm outline-hidden placeholder:text-[color:oklch(var(--muted-foreground)/var(--zen-placeholder))] disabled:cursor-not-allowed", n),
|
|
25
25
|
...i,
|
|
26
26
|
...a
|
|
27
27
|
});
|
package/dist/lib.js
CHANGED
|
@@ -15,83 +15,87 @@ import D, { StatusPillAction as O } from "./status-pill/index.js";
|
|
|
15
15
|
import k from "./spinner/index.js";
|
|
16
16
|
import A, { buttonVariants as j } from "./button/index.js";
|
|
17
17
|
import M, { CardDescription as N, CardHeader as P, CardTitle as F, Stat as I, StatRow as L } from "./card/index.js";
|
|
18
|
-
import R from "./
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import G from "./
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
import Ce from "./
|
|
36
|
-
import
|
|
37
|
-
import
|
|
38
|
-
import
|
|
39
|
-
import
|
|
40
|
-
import
|
|
41
|
-
import
|
|
42
|
-
import Re from "./
|
|
43
|
-
import
|
|
44
|
-
import
|
|
45
|
-
import
|
|
46
|
-
import {
|
|
47
|
-
import
|
|
48
|
-
import
|
|
49
|
-
import {
|
|
50
|
-
import
|
|
51
|
-
import
|
|
52
|
-
import
|
|
53
|
-
import
|
|
54
|
-
import
|
|
55
|
-
import
|
|
56
|
-
import
|
|
57
|
-
import
|
|
58
|
-
import
|
|
59
|
-
import
|
|
60
|
-
import
|
|
61
|
-
import {
|
|
62
|
-
import {
|
|
63
|
-
import
|
|
64
|
-
import {
|
|
65
|
-
import
|
|
66
|
-
import
|
|
67
|
-
import {
|
|
68
|
-
import
|
|
69
|
-
import
|
|
70
|
-
import
|
|
71
|
-
import {
|
|
72
|
-
import
|
|
73
|
-
import
|
|
74
|
-
import {
|
|
75
|
-
import
|
|
76
|
-
import zn from "./
|
|
77
|
-
import Bn, {
|
|
78
|
-
import
|
|
79
|
-
import
|
|
80
|
-
import
|
|
81
|
-
import qn from "./
|
|
82
|
-
import
|
|
83
|
-
import Xn from "./
|
|
84
|
-
import
|
|
85
|
-
import
|
|
86
|
-
import
|
|
87
|
-
import
|
|
88
|
-
import
|
|
89
|
-
import
|
|
90
|
-
import
|
|
91
|
-
import
|
|
92
|
-
import
|
|
93
|
-
import
|
|
94
|
-
import
|
|
95
|
-
import
|
|
96
|
-
import hr from "./
|
|
97
|
-
|
|
18
|
+
import { Canvas as R, CanvasItem as z } from "./canvas/index.js";
|
|
19
|
+
import { useCopyToClipboard as B } from "./utils/useCopyToClipboard.js";
|
|
20
|
+
import V from "./code-block/index.js";
|
|
21
|
+
import H from "./alert/index.js";
|
|
22
|
+
import U, { FormMessage as W, useField as G, useFieldProps as K } from "./field/index.js";
|
|
23
|
+
import q from "./input/index.js";
|
|
24
|
+
import J from "./slider/index.js";
|
|
25
|
+
import { hexToOklch as Y, oklchToHex as X } from "./utils/color.js";
|
|
26
|
+
import { FieldChevron as Z } from "./utils/field-chevron.js";
|
|
27
|
+
import Q, { ColorPanel as $ } from "./color-picker/index.js";
|
|
28
|
+
import ee from "./chip/index.js";
|
|
29
|
+
import te, { PopoverClose as ne, PopoverContent as re, PopoverTrigger as ie } from "./popover/index.js";
|
|
30
|
+
import ae from "./collapse/index.js";
|
|
31
|
+
import oe, { InputGroupAddon as se, InputGroupInput as ce } from "./input-group/index.js";
|
|
32
|
+
import { useVirtualList as le } from "./utils/useVirtualList.js";
|
|
33
|
+
import ue, { ComboboxCreate as de, ComboboxEmpty as fe, ComboboxItem as pe, ComboboxList as me, ComboboxPopup as he, ComboboxSearch as ge, ComboboxTrigger as _e } from "./combobox/index.js";
|
|
34
|
+
import ve, { useToast as ye, useToastHost as be } from "./toast/index.js";
|
|
35
|
+
import xe, { DialogClose as Se, DialogFooter as Ce, useModal as we } from "./dialog/index.js";
|
|
36
|
+
import Te from "./confirm-dialog/index.js";
|
|
37
|
+
import Ee from "./editable-cell/index.js";
|
|
38
|
+
import De, { DisclosureContent as Oe, DisclosureTrigger as ke } from "./disclosure/index.js";
|
|
39
|
+
import Ae from "./header/index.js";
|
|
40
|
+
import je from "./inset/index.js";
|
|
41
|
+
import Me from "./meter/index.js";
|
|
42
|
+
import { addMonths as Ne, currentMonth as Pe, formatMonth as Fe, fromMonthIndex as Ie, isMonth as Le, monthIndex as Re, monthNames as ze, monthRange as Be, monthsBetween as Ve } from "./utils/month.js";
|
|
43
|
+
import He from "./month-picker/index.js";
|
|
44
|
+
import Ue from "./checkbox/index.js";
|
|
45
|
+
import { paletteColor as We } from "./chart/palette.js";
|
|
46
|
+
import { ChartTooltipCard as Ge } from "./chart/tooltip.js";
|
|
47
|
+
import Ke from "./chart/allocation.js";
|
|
48
|
+
import qe from "./chart/donut.js";
|
|
49
|
+
import Je, { ChartArea as Ye, ChartBar as Xe, ChartLine as Ze, ChartReference as Qe, niceTicks as $e } from "./chart/index.js";
|
|
50
|
+
import et, { Radio as tt } from "./radio-group/index.js";
|
|
51
|
+
import { addDays as nt, addMonthsToDate as rt, commonRanges as it, dayIndex as at, dayOfWeek as ot, daysBetween as st, daysInMonth as ct, formatDate as lt, formatDateRange as ut, fromDayIndex as dt, isDate as ft, today as pt, weekStart as mt, weekdayNames as ht } from "./utils/date.js";
|
|
52
|
+
import gt from "./calendar/index.js";
|
|
53
|
+
import _t, { DateRangePicker as vt } from "./date-picker/index.js";
|
|
54
|
+
import { RateUnavailableError as yt, convertMinor as bt, isRateTable as xt, rateBetween as St } from "./utils/fx.js";
|
|
55
|
+
import Ct, { MoneyConversionHint as wt, MoneyCurrencyMenu as Tt, useMoneyInput as Et } from "./money-input/index.js";
|
|
56
|
+
import Dt, { RadioCard as Ot } from "./radio-cards/index.js";
|
|
57
|
+
import kt, { Pill as At, PillIndicator as jt } from "./pills/index.js";
|
|
58
|
+
import Mt from "./page-header/index.js";
|
|
59
|
+
import Nt from "./progress-ring/index.js";
|
|
60
|
+
import Pt, { SegmentedItem as Ft } from "./segmented/index.js";
|
|
61
|
+
import It, { SelectGroup as Lt, SelectItem as Rt, SelectSeparator as zt } from "./select/index.js";
|
|
62
|
+
import Bt, { SideNavGroup as Vt, SideNavLink as Ht } from "./side-nav/index.js";
|
|
63
|
+
import Ut from "./skeleton/index.js";
|
|
64
|
+
import Wt, { TabBarItem as Gt } from "./tab-bar/index.js";
|
|
65
|
+
import { SelectionBar as Kt, TableSelectCell as qt, TableSelectHead as Jt, useSelection as Yt } from "./table/selection.js";
|
|
66
|
+
import { TableSwipeAction as Xt, TableSwipeRow as Zt } from "./table/swipe.js";
|
|
67
|
+
import Qt, { TableBody as $t, TableCell as en, TableContainer as tn, TableEmpty as nn, TableFooter as rn, TableFooterCell as an, TableHead as on, TableHeader as sn, TableRow as cn, TableSpacerRow as ln, useSort as un } from "./table/index.js";
|
|
68
|
+
import { followSectionLink as dn } from "./utils/section-link.js";
|
|
69
|
+
import fn from "./table-of-contents/index.js";
|
|
70
|
+
import pn, { Tab as mn, TabList as hn, TabPanel as gn } from "./tabs/index.js";
|
|
71
|
+
import { TreeCell as _n, TreeLabel as vn, TreeRow as yn, TreeToggle as bn, useTree as xn } from "./tree/index.js";
|
|
72
|
+
import Sn from "./textarea/index.js";
|
|
73
|
+
import Cn from "./toggle/index.js";
|
|
74
|
+
import wn, { TooltipContent as Tn, TooltipTrigger as En } from "./tooltip/index.js";
|
|
75
|
+
import { DEFAULT_THEME as Dn, INTENSITIES as On, PRESETS as kn, applyPreset as An, applyTheme as jn, contrastRatio as Mn, customize as Nn, normalizeTheme as Pn, oklchToLinearRgb as Fn, resetTheme as In, themeVars as Ln } from "./utils/theme.js";
|
|
76
|
+
import { prepareThemeWave as Rn, themeWave as zn } from "./utils/theme-wave.js";
|
|
77
|
+
import Bn, { ThemeScript as Vn, themeScript as Hn } from "./theme-toggle/index.js";
|
|
78
|
+
import { useHydrated as Un } from "./utils/useHydrated.js";
|
|
79
|
+
import Wn, { Breadcrumb as Gn } from "./breadcrumbs/index.js";
|
|
80
|
+
import Kn from "./code-input/index.js";
|
|
81
|
+
import qn, { useCommandPaletteShortcut as Jn } from "./command-palette/index.js";
|
|
82
|
+
import Yn from "./empty-state/index.js";
|
|
83
|
+
import Xn, { accepts as Zn } from "./file-drop/index.js";
|
|
84
|
+
import Qn, { pageRange as $n } from "./pagination/index.js";
|
|
85
|
+
import er from "./sparkline/index.js";
|
|
86
|
+
import tr, { Step as nr } from "./stepper/index.js";
|
|
87
|
+
import rr from "./tag-input/index.js";
|
|
88
|
+
import ir, { TimelineItem as ar } from "./timeline/index.js";
|
|
89
|
+
import or from "./kbd/index.js";
|
|
90
|
+
import sr from "./range-slider/index.js";
|
|
91
|
+
import cr, { FilterChip as lr } from "./filter-bar/index.js";
|
|
92
|
+
import ur from "./keypad/index.js";
|
|
93
|
+
import dr from "./calendar-heatmap/index.js";
|
|
94
|
+
import fr from "./trend/index.js";
|
|
95
|
+
import pr, { ICON_COLORS as mr } from "./icon-picker/index.js";
|
|
96
|
+
import { describeRepeat as hr, nextOccurrences as gr } from "./utils/repeat.js";
|
|
97
|
+
import _r from "./repeat-picker/index.js";
|
|
98
|
+
import vr from "./load-more/index.js";
|
|
99
|
+
import { SortableHandle as yr, SortableItem as br, SortableList as xr } from "./sortable/index.js";
|
|
100
|
+
import Sr from "./page-transition/index.js";
|
|
101
|
+
export { H as Alert, Ke as AllocationBar, b as AnimatedMoney, y as AnimatedNumber, x as Avatar, w as Backdrop, E as Badge, Gn as Breadcrumb, Wn as Breadcrumbs, A as Button, gt as Calendar, dr as CalendarHeatmap, R as Canvas, z as CanvasItem, M as Card, N as CardDescription, P as CardHeader, F as CardTitle, Je as Chart, Ye as ChartArea, Xe as ChartBar, Ze as ChartLine, Qe as ChartReference, Ge as ChartTooltipCard, Ue as Checkbox, ee as Chip, V as CodeBlock, Kn as CodeInput, ae as Collapse, $ as ColorPanel, Q as ColorPicker, ue as Combobox, de as ComboboxCreate, fe as ComboboxEmpty, pe as ComboboxItem, me as ComboboxList, he as ComboboxPopup, ge as ComboboxSearch, _e as ComboboxTrigger, qn as CommandPalette, Te as ConfirmDialog, Dn as DEFAULT_THEME, _t as DatePicker, vt as DateRangePicker, xe as Dialog, Se as DialogClose, Ce as DialogFooter, De as Disclosure, Oe as DisclosureContent, ke as DisclosureTrigger, qe as DonutChart, Ee as EditableCell, Yn as EmptyState, U as Field, Z as FieldChevron, Xn as FileDrop, cr as FilterBar, lr as FilterChip, W as FormMessage, Ae as Header, mr as ICON_COLORS, On as INTENSITIES, pr as IconPicker, S as ImageCropError, q as Input, oe as InputGroup, se as InputGroupAddon, ce as InputGroupInput, je as Inset, or as Kbd, ur as Keypad, vr as LoadMore, i as Menu, a as MenuContent, o as MenuContextTrigger, s as MenuHeader, c as MenuItem, l as MenuSeparator, u as MenuTrigger, Me as Meter, wt as MoneyConversionHint, Tt as MoneyCurrencyMenu, Ct as MoneyInput, d as MoneyParseError, He as MonthPicker, kn as PRESETS, Mt as PageHeader, Sr as PageTransition, Qn as Pagination, At as Pill, jt as PillIndicator, kt as Pills, te as Popover, ne as PopoverClose, re as PopoverContent, ie as PopoverTrigger, Nt as ProgressRing, tt as Radio, Ot as RadioCard, Dt as RadioCards, et as RadioGroup, sr as RangeSlider, yt as RateUnavailableError, _r as RepeatPicker, Pt as Segmented, Ft as SegmentedItem, It as Select, Lt as SelectGroup, Rt as SelectItem, zt as SelectSeparator, Kt as SelectionBar, Bt as SideNav, Vt as SideNavGroup, Ht as SideNavLink, Ut as Skeleton, J as Slider, yr as SortableHandle, br as SortableItem, xr as SortableList, er as Sparkline, k as Spinner, I as Stat, L as StatRow, D as StatusPill, O as StatusPillAction, nr as Step, tr as Stepper, mn as Tab, Wt as TabBar, Gt as TabBarItem, hn as TabList, gn as TabPanel, Qt as Table, $t as TableBody, en as TableCell, tn as TableContainer, nn as TableEmpty, rn as TableFooter, an as TableFooterCell, on as TableHead, sn as TableHeader, fn as TableOfContents, cn as TableRow, qt as TableSelectCell, Jt as TableSelectHead, ln as TableSpacerRow, Xt as TableSwipeAction, Zt as TableSwipeRow, pn as Tabs, rr as TagInput, Sn as TextArea, Vn as ThemeScript, Bn as ThemeToggle, ir as Timeline, ar as TimelineItem, ve as ToastProvider, Cn as Toggle, wn as Tooltip, Tn as TooltipContent, En as TooltipTrigger, _n as TreeCell, vn as TreeLabel, yn as TreeRow, bn as TreeToggle, fr as Trend, Zn as accepts, nt as addDays, Ne as addMonths, rt as addMonthsToDate, t as applyGraphicsMode, An as applyPreset, jn as applyTheme, j as buttonVariants, it as commonRanges, Mn as contrastRatio, bt as convertMinor, C as cropImageToSquare, f as currencySymbol, Pe as currentMonth, Nn as customize, T as cva, e as cx, at as dayIndex, ot as dayOfWeek, st as daysBetween, ct as daysInMonth, hr as describeRepeat, n as detectGraphicsMode, dn as followSectionLink, p as formatAmount, lt as formatDate, ut as formatDateRange, m as formatMoney, Fe as formatMonth, dt as fromDayIndex, Ie as fromMonthIndex, Y as hexToOklch, ft as isDate, Le as isMonth, xt as isRateTable, h as minorDigits, Re as monthIndex, ze as monthNames, Be as monthRange, Ve as monthsBetween, gr as nextOccurrences, $e as niceTicks, Pn as normalizeTheme, X as oklchToHex, Fn as oklchToLinearRgb, $n as pageRange, We as paletteColor, g as parseMoney, _ as parseMoneyInput, Rn as prepareThemeWave, St as rateBetween, v as reducedMotion, In as resetTheme, Hn as themeScript, Ln as themeVars, zn as themeWave, pt as today, r as useAnchoredPopup, Jn as useCommandPaletteShortcut, B as useCopyToClipboard, G as useField, K as useFieldProps, Un as useHydrated, we as useModal, Et as useMoneyInput, Yt as useSelection, un as useSort, ye as useToast, be as useToastHost, xn as useTree, le as useVirtualList, mt as weekStart, ht as weekdayNames };
|
|
@@ -4,13 +4,13 @@ import t, { MenuContent as n, MenuItem as r, MenuSeparator as i, MenuTrigger as
|
|
|
4
4
|
import { currencySymbol as o, formatAmount as s, formatMoney as c, minorDigits as l, parseMoneyInput as u } from "../utils/money.js";
|
|
5
5
|
import d from "../spinner/index.js";
|
|
6
6
|
import { AlertIcon as f, InfoIcon as p } from "../utils/status-icons.js";
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
7
|
+
import { FieldChevron as m } from "../utils/field-chevron.js";
|
|
8
|
+
import h, { InputGroupAddon as g, InputGroupInput as _ } from "../input-group/index.js";
|
|
9
9
|
import { convertMinor as v, rateBetween as y } from "../utils/fx.js";
|
|
10
10
|
import { useEffect as b, useId as x, useRef as S, useState as C } from "react";
|
|
11
11
|
import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
|
|
12
12
|
//#region packages/money-input/index.tsx
|
|
13
|
-
function D({ value: t, onChange: n, currency: r, locale: i, allowNegative: a, allowEmpty: o, live: s, onCancel: c, convert: l, start: u, end: d, compact: p = !1, disabled:
|
|
13
|
+
function D({ value: t, onChange: n, currency: r, locale: i, allowNegative: a, allowEmpty: o, live: s, onCancel: c, convert: l, start: u, end: d, compact: p = !1, disabled: m = !1, className: v, onFocus: y, onBlur: b, onKeyDown: x, "aria-describedby": S, ...C }) {
|
|
14
14
|
let w = A({
|
|
15
15
|
value: t,
|
|
16
16
|
onChange: n,
|
|
@@ -24,17 +24,17 @@ function D({ value: t, onChange: n, currency: r, locale: i, allowNegative: a, al
|
|
|
24
24
|
}), D = !!w.conversion?.foreign;
|
|
25
25
|
return /* @__PURE__ */ E("div", {
|
|
26
26
|
className: e("zen__money-input flex flex-col gap-1", v),
|
|
27
|
-
children: [/* @__PURE__ */ E(
|
|
27
|
+
children: [/* @__PURE__ */ E(h, {
|
|
28
28
|
invalid: !!w.error,
|
|
29
29
|
"data-foreign": D || void 0,
|
|
30
30
|
className: e(p && "h-7", "data-foreign:border-primary/50"),
|
|
31
31
|
children: [
|
|
32
|
-
u ?? (w.conversion && !
|
|
32
|
+
u ?? (w.conversion && !m ? /* @__PURE__ */ T(O, { money: w }) : /* @__PURE__ */ T(g, {
|
|
33
33
|
"aria-hidden": !0,
|
|
34
34
|
"data-slot": "symbol",
|
|
35
35
|
children: w.symbol
|
|
36
36
|
})),
|
|
37
|
-
/* @__PURE__ */ T(
|
|
37
|
+
/* @__PURE__ */ T(_, {
|
|
38
38
|
...C,
|
|
39
39
|
...w.inputProps,
|
|
40
40
|
onFocus: (e) => {
|
|
@@ -47,7 +47,7 @@ function D({ value: t, onChange: n, currency: r, locale: i, allowNegative: a, al
|
|
|
47
47
|
w.inputProps.onKeyDown(e), x?.(e);
|
|
48
48
|
},
|
|
49
49
|
"aria-describedby": e(w.inputProps["aria-describedby"], S) || void 0,
|
|
50
|
-
disabled:
|
|
50
|
+
disabled: m,
|
|
51
51
|
className: e("tabular-nums", p ? "text-right" : "text-left")
|
|
52
52
|
}),
|
|
53
53
|
d
|
|
@@ -65,7 +65,7 @@ function O({ money: s, className: c }) {
|
|
|
65
65
|
return l ? /* @__PURE__ */ E(t, { children: [/* @__PURE__ */ E(a, {
|
|
66
66
|
"aria-label": `Currency: ${l.currency}. Change to enter another currency`,
|
|
67
67
|
className: e("group/currency hover:bg-tint/[0.07] focus-visible:ring-ring/50 -ml-1 flex shrink-0 items-center gap-0.5 rounded-md px-1 py-0.5 text-sm outline-hidden focus-visible:ring-2", l.foreign ? "text-primary" : "text-muted-foreground", c),
|
|
68
|
-
children: [l.foreign ? l.currency : s.symbol, /* @__PURE__ */ T(
|
|
68
|
+
children: [l.foreign ? l.currency : s.symbol, /* @__PURE__ */ T(m, { className: "text-inherit duration-150 group-data-popup-open/currency:rotate-180" })]
|
|
69
69
|
}), /* @__PURE__ */ E(n, {
|
|
70
70
|
align: "start",
|
|
71
71
|
offset: 8,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cx as e } from "../utils/cx.js";
|
|
3
3
|
import { useAnchoredPopup as t } from "../utils/useAnchoredPopup.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { useFieldProps as n } from "../field/index.js";
|
|
5
|
+
import { PICKER_MONTH as r, PICKER_NAV as i, PLACEHOLDER as a, POPUP as o, TRIGGER as s } from "../utils/styles.js";
|
|
6
6
|
import { FieldChevron as c } from "../utils/field-chevron.js";
|
|
7
7
|
import l from "../icons/chevron-left.js";
|
|
8
8
|
import u from "../icons/chevron-right.js";
|
|
@@ -11,7 +11,7 @@ import { useState as p } from "react";
|
|
|
11
11
|
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
12
12
|
//#region packages/month-picker/index.tsx
|
|
13
13
|
function _({ value: _, onChange: v, locale: y, min: b, max: x, id: S, className: C, disabled: w = !1, placeholder: T = "Pick a month", onClear: E, clearLabel: D = "Clear", style: O, ...k }) {
|
|
14
|
-
let [A, j] = p(() => Number((_ ?? (/* @__PURE__ */ new Date()).toISOString()).slice(0, 4))), M = t({ onOpenChange: (e) => e && _ && j(Number(_.slice(0, 4))) }), N =
|
|
14
|
+
let [A, j] = p(() => Number((_ ?? (/* @__PURE__ */ new Date()).toISOString()).slice(0, 4))), M = t({ onOpenChange: (e) => e && _ && j(Number(_.slice(0, 4))) }), N = n({
|
|
15
15
|
...k,
|
|
16
16
|
id: S
|
|
17
17
|
}), P = f(y), F = (e) => (!b || e >= b) && (!x || e <= x);
|
|
@@ -26,16 +26,16 @@ function _({ value: _, onChange: v, locale: y, min: b, max: x, id: S, className:
|
|
|
26
26
|
...M.triggerProps.style,
|
|
27
27
|
...O
|
|
28
28
|
},
|
|
29
|
-
className: e("zen__month-picker group",
|
|
29
|
+
className: e("zen__month-picker group", s, "w-full", M.open && "border-glow/60 [--glow-border-color:transparent] shadow-glow-focus", C),
|
|
30
30
|
children: [/* @__PURE__ */ h("span", {
|
|
31
|
-
className: _ ? void 0 :
|
|
31
|
+
className: _ ? void 0 : a,
|
|
32
32
|
children: _ ? d(_, y) : T
|
|
33
33
|
}), /* @__PURE__ */ h(c, { open: M.open })]
|
|
34
34
|
}), /* @__PURE__ */ g("div", {
|
|
35
35
|
...M.popupProps,
|
|
36
36
|
role: "dialog",
|
|
37
37
|
"aria-label": "Choose month",
|
|
38
|
-
className: e("zen__popover",
|
|
38
|
+
className: e("zen__popover", o, "w-64 p-3"),
|
|
39
39
|
children: [
|
|
40
40
|
/* @__PURE__ */ g("div", {
|
|
41
41
|
className: "mb-2 flex items-center justify-between",
|
|
@@ -44,7 +44,7 @@ function _({ value: _, onChange: v, locale: y, min: b, max: x, id: S, className:
|
|
|
44
44
|
type: "button",
|
|
45
45
|
"aria-label": "Previous year",
|
|
46
46
|
onClick: () => j((e) => e - 1),
|
|
47
|
-
className:
|
|
47
|
+
className: i,
|
|
48
48
|
children: /* @__PURE__ */ h(l, { className: "size-4" })
|
|
49
49
|
}),
|
|
50
50
|
/* @__PURE__ */ h("span", {
|
|
@@ -56,15 +56,15 @@ function _({ value: _, onChange: v, locale: y, min: b, max: x, id: S, className:
|
|
|
56
56
|
type: "button",
|
|
57
57
|
"aria-label": "Next year",
|
|
58
58
|
onClick: () => j((e) => e + 1),
|
|
59
|
-
className:
|
|
59
|
+
className: i,
|
|
60
60
|
children: /* @__PURE__ */ h(u, { className: "size-4" })
|
|
61
61
|
})
|
|
62
62
|
]
|
|
63
63
|
}),
|
|
64
64
|
/* @__PURE__ */ h("div", {
|
|
65
65
|
className: "grid grid-cols-3 gap-1",
|
|
66
|
-
children: P.map((t,
|
|
67
|
-
let i = `${A}-${String(
|
|
66
|
+
children: P.map((t, n) => {
|
|
67
|
+
let i = `${A}-${String(n + 1).padStart(2, "0")}`, a = i === _;
|
|
68
68
|
return /* @__PURE__ */ h("button", {
|
|
69
69
|
type: "button",
|
|
70
70
|
disabled: !F(i),
|
|
@@ -73,7 +73,7 @@ function _({ value: _, onChange: v, locale: y, min: b, max: x, id: S, className:
|
|
|
73
73
|
onClick: () => {
|
|
74
74
|
v(i), M.setOpen(!1);
|
|
75
75
|
},
|
|
76
|
-
className: e(
|
|
76
|
+
className: e(r, a && "bg-primary text-primary-foreground hover:bg-primary"),
|
|
77
77
|
children: t
|
|
78
78
|
}, i);
|
|
79
79
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cx as e } from "../utils/cx.js";
|
|
3
|
-
import t from "../
|
|
4
|
-
import n from "../
|
|
3
|
+
import t from "../input/index.js";
|
|
4
|
+
import n from "../chip/index.js";
|
|
5
5
|
import { dayOfWeek as r, formatDate as i, weekStart as a, weekdayNames as o } from "../utils/date.js";
|
|
6
6
|
import s, { SelectItem as c } from "../select/index.js";
|
|
7
7
|
import { describeRepeat as l, nextOccurrences as u } from "../utils/repeat.js";
|
|
@@ -32,7 +32,7 @@ function g({ value: g, onChange: _, locale: v, start: y, weekStartsOn: b = a(v),
|
|
|
32
32
|
className: "text-muted-foreground",
|
|
33
33
|
children: "Every"
|
|
34
34
|
}),
|
|
35
|
-
/* @__PURE__ */ p(
|
|
35
|
+
/* @__PURE__ */ p(t, {
|
|
36
36
|
"aria-label": "How many",
|
|
37
37
|
inputMode: "numeric",
|
|
38
38
|
value: C,
|
|
@@ -69,13 +69,13 @@ function g({ value: g, onChange: _, locale: v, start: y, weekStartsOn: b = a(v),
|
|
|
69
69
|
"aria-label": "On",
|
|
70
70
|
className: "flex flex-wrap gap-1.5",
|
|
71
71
|
children: E.map((e) => {
|
|
72
|
-
let
|
|
73
|
-
return /* @__PURE__ */ p(
|
|
74
|
-
pressed:
|
|
72
|
+
let t = D.includes(e);
|
|
73
|
+
return /* @__PURE__ */ p(n, {
|
|
74
|
+
pressed: t,
|
|
75
75
|
onClick: () => {
|
|
76
|
-
|
|
76
|
+
t && D.length === 1 || _({
|
|
77
77
|
...g,
|
|
78
|
-
weekdays:
|
|
78
|
+
weekdays: t ? D.filter((t) => t !== e) : [...D, e]
|
|
79
79
|
});
|
|
80
80
|
},
|
|
81
81
|
children: T[e]
|
package/dist/select/index.js
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
import { cx as e } from "../utils/cx.js";
|
|
3
3
|
import { useTypeahead as t } from "../utils/typeahead.js";
|
|
4
4
|
import { useAnchoredPopup as n } from "../utils/useAnchoredPopup.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { CheckIcon as r } from "../utils/status-icons.js";
|
|
6
|
+
import { useFieldProps as i } from "../field/index.js";
|
|
7
|
+
import { POPUP as a, TRIGGER as o } from "../utils/styles.js";
|
|
8
8
|
import { FieldChevron as s } from "../utils/field-chevron.js";
|
|
9
9
|
import { Children as c, Fragment as l, createContext as u, isValidElement as d, useCallback as f, useContext as p, useEffect as m, useId as h, useLayoutEffect as g, useRef as _, useState as v } from "react";
|
|
10
10
|
import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
11
11
|
//#region packages/select/index.tsx
|
|
12
12
|
var S = u(null);
|
|
13
|
-
function C({ value:
|
|
14
|
-
let k = _(null), A = h(), j = p ?? A, M =
|
|
13
|
+
function C({ value: r, onChange: c, placeholder: l = "Select…", disabled: u = !1, name: d, id: p, className: g, listClassName: C, children: T, style: E, onKeyDown: D, ...O }) {
|
|
14
|
+
let k = _(null), A = h(), j = p ?? A, M = i({
|
|
15
15
|
...O,
|
|
16
16
|
id: p
|
|
17
17
|
}), [N, P] = v(null), F = t(), [I, L] = v(/* @__PURE__ */ new Map()), R = () => Array.from(k.current?.querySelectorAll("[role=\"option\"]") ?? []).map((e) => ({
|
|
@@ -23,7 +23,7 @@ function C({ value: a, onChange: c, placeholder: l = "Select…", disabled: u =
|
|
|
23
23
|
onOpenChange: (e) => {
|
|
24
24
|
if (!e) return;
|
|
25
25
|
let t = R();
|
|
26
|
-
P(t.find((e) => e.value ===
|
|
26
|
+
P(t.find((e) => e.value === r)?.value ?? t.find((e) => !e.disabled)?.value ?? null);
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
29
|
m(() => {
|
|
@@ -36,7 +36,7 @@ function C({ value: a, onChange: c, placeholder: l = "Select…", disabled: u =
|
|
|
36
36
|
return n.delete(e), n;
|
|
37
37
|
})), []), H = new Map(I);
|
|
38
38
|
w(T, H);
|
|
39
|
-
let U =
|
|
39
|
+
let U = r === null ? void 0 : H.get(r), W = (e, t, n = R()) => {
|
|
40
40
|
let r = e === null ? t === 1 ? -1 : n.length : n.findIndex((t) => t.value === e);
|
|
41
41
|
for (let e = 1; e <= n.length; e++) {
|
|
42
42
|
let i = (r + t * e + n.length * 2) % n.length;
|
|
@@ -79,7 +79,7 @@ function C({ value: a, onChange: c, placeholder: l = "Select…", disabled: u =
|
|
|
79
79
|
onKeyDown: (e) => {
|
|
80
80
|
D?.(e), ["ArrowDown", "ArrowUp"].includes(e.key) && !z.open && (e.preventDefault(), z.setOpen(!0));
|
|
81
81
|
},
|
|
82
|
-
className: e("zen__select group",
|
|
82
|
+
className: e("zen__select group", o, "w-full", z.open && "border-glow/60 [--glow-border-color:transparent] shadow-glow-focus", g),
|
|
83
83
|
children: [/* @__PURE__ */ b("span", {
|
|
84
84
|
className: e("truncate", U === void 0 && "text-[color:oklch(var(--muted-foreground)/var(--zen-placeholder))]"),
|
|
85
85
|
children: U ?? l
|
|
@@ -88,11 +88,11 @@ function C({ value: a, onChange: c, placeholder: l = "Select…", disabled: u =
|
|
|
88
88
|
d && /* @__PURE__ */ b("input", {
|
|
89
89
|
type: "hidden",
|
|
90
90
|
name: d,
|
|
91
|
-
value:
|
|
91
|
+
value: r ?? ""
|
|
92
92
|
}),
|
|
93
93
|
/* @__PURE__ */ b("div", {
|
|
94
94
|
...z.popupProps,
|
|
95
|
-
className: e("zen__popover",
|
|
95
|
+
className: e("zen__popover", a, "overflow-visible py-1", C),
|
|
96
96
|
children: /* @__PURE__ */ b("div", {
|
|
97
97
|
ref: k,
|
|
98
98
|
role: "listbox",
|
|
@@ -104,7 +104,7 @@ function C({ value: a, onChange: c, placeholder: l = "Select…", disabled: u =
|
|
|
104
104
|
className: "max-h-72 overflow-y-auto outline-hidden",
|
|
105
105
|
children: /* @__PURE__ */ b(S.Provider, {
|
|
106
106
|
value: {
|
|
107
|
-
value:
|
|
107
|
+
value: r,
|
|
108
108
|
active: N,
|
|
109
109
|
setActive: P,
|
|
110
110
|
choose: B,
|
|
@@ -128,7 +128,7 @@ function w(e, t) {
|
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
130
|
var T = (e) => typeof e == "string" || typeof e == "number" ? String(e) : Array.isArray(e) ? e.map(T).join("") : "";
|
|
131
|
-
function E({ value: t, label: n, disabled:
|
|
131
|
+
function E({ value: t, label: n, disabled: i, className: a, children: o }) {
|
|
132
132
|
let s = p(S);
|
|
133
133
|
if (!s) throw Error("SelectItem must be inside a Select");
|
|
134
134
|
let c = _(null), l = n ?? T(o), u = s.register;
|
|
@@ -145,15 +145,15 @@ function E({ value: t, label: n, disabled: r, className: i, children: o }) {
|
|
|
145
145
|
"data-value": t,
|
|
146
146
|
"data-label": l || void 0,
|
|
147
147
|
"aria-selected": d,
|
|
148
|
-
"aria-disabled":
|
|
148
|
+
"aria-disabled": i || void 0,
|
|
149
149
|
"data-highlighted": s.active === t || void 0,
|
|
150
|
-
onMouseMove: () => !
|
|
150
|
+
onMouseMove: () => !i && s.setActive(t),
|
|
151
151
|
onClick: () => s.choose(t),
|
|
152
|
-
className: e("grid cursor-pointer grid-cols-[1rem_1fr] items-center gap-2 px-3 py-2 text-sm outline-hidden select-none", "data-highlighted:bg-muted aria-disabled:cursor-not-allowed aria-disabled:opacity-50",
|
|
152
|
+
className: e("grid cursor-pointer grid-cols-[1rem_1fr] items-center gap-2 px-3 py-2 text-sm outline-hidden select-none", "data-highlighted:bg-muted aria-disabled:cursor-not-allowed aria-disabled:opacity-50", a),
|
|
153
153
|
children: [/* @__PURE__ */ b("span", {
|
|
154
154
|
className: "text-primary col-start-1",
|
|
155
155
|
"aria-hidden": !0,
|
|
156
|
-
children: d && /* @__PURE__ */ b(
|
|
156
|
+
children: d && /* @__PURE__ */ b(r, {})
|
|
157
157
|
}), /* @__PURE__ */ b("span", {
|
|
158
158
|
className: "col-start-2 truncate",
|
|
159
159
|
children: o
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/sortable/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EACH,cAAc,EASjB,MAAM,OAAO,CAAC;AA2Bf;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,iBAAiB,+BAuJhG;AAED,+EAA+E;AAC/E,wBAAgB,YAAY,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,iBAAiB,+
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/sortable/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EACH,cAAc,EASjB,MAAM,OAAO,CAAC;AA2Bf;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,iBAAiB,+BAuJhG;AAED,+EAA+E;AAC/E,wBAAgB,YAAY,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,iBAAiB,+BAczE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,mBAAmB,+BAwB9F;AAUD,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC;IAC7E,gCAAgC;IAChC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CACvC;AAED,MAAM,WAAW,iBAAkB,SAAQ,cAAc,CAAC,IAAI,CAAC;IAC3D,EAAE,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC;IAC7E,6CAA6C;IAC7C,EAAE,EAAE,MAAM,CAAC;IACX,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;CACjB"}
|
package/dist/sortable/index.js
CHANGED
|
@@ -108,7 +108,7 @@ function _({ id: t, className: n, ...r }) {
|
|
|
108
108
|
return /* @__PURE__ */ c("li", {
|
|
109
109
|
"data-sortable-id": t,
|
|
110
110
|
"data-lifted": i === t || void 0,
|
|
111
|
-
className: e("zen__sortable-item relative transition-[box-shadow,scale] duration-200 data-dragging:z-10 data-dragging:scale-[1.02] data-dragging:shadow-[0_12px_32px_-12px_oklch(0_0_0/0.6)] data-lifted:z-10 data-lifted:shadow-[0_0_0_2px_oklch(var(--primary)/0.6)]", n),
|
|
111
|
+
className: e("zen__sortable-item relative transition-[box-shadow,scale,background-color] duration-200 data-dragging:bg-card data-lifted:bg-card data-dragging:z-10 data-dragging:rounded-xl data-dragging:scale-[1.02] data-dragging:shadow-[0_0_0_1px_oklch(var(--tint)/0.08),0_12px_32px_-12px_oklch(0_0_0/0.6)] data-lifted:z-10 data-lifted:rounded-xl data-lifted:shadow-[0_0_0_2px_oklch(var(--primary)/0.6)]", n),
|
|
112
112
|
...r
|
|
113
113
|
});
|
|
114
114
|
}
|
package/dist/tag-input/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cx as e } from "../utils/cx.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { useFieldProps as t } from "../field/index.js";
|
|
4
|
+
import { FIELD as n } from "../utils/styles.js";
|
|
5
5
|
import r from "../icons/micro/x-mark.js";
|
|
6
6
|
import { useLayoutEffect as i, useRef as a, useState as o } from "react";
|
|
7
7
|
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
8
8
|
//#region packages/tag-input/index.tsx
|
|
9
9
|
function l({ value: l, defaultValue: u = [], onValueChange: d, validate: f, removeLabel: p = (e) => `Remove ${e}`, className: m, disabled: h, ...g }) {
|
|
10
|
-
let [_, v] = o(u), y = l ?? _, [b, x] = o(""), S =
|
|
10
|
+
let [_, v] = o(u), y = l ?? _, [b, x] = o(""), S = t(g), C = a(null), w = y.length;
|
|
11
11
|
i(() => {
|
|
12
12
|
let e = C.current;
|
|
13
13
|
e?.parentElement?.contains(document.activeElement) && (e.scrollTop = e.scrollHeight);
|
|
@@ -20,7 +20,7 @@ function l({ value: l, defaultValue: u = [], onValueChange: d, validate: f, remo
|
|
|
20
20
|
t.length !== y.length && T(t);
|
|
21
21
|
};
|
|
22
22
|
return /* @__PURE__ */ c("div", {
|
|
23
|
-
className: e("zen__tag-input",
|
|
23
|
+
className: e("zen__tag-input", n, "flex h-auto max-h-36 min-h-10 w-full cursor-text flex-col gap-1.5 py-1.5", "has-[input:focus-visible]:border-glow/60 has-[input:focus-visible]:bg-tint/[0.05] has-[input:focus-visible]:shadow-glow-focus has-[input:focus-visible]:[--glow-border-color:transparent]", h && "cursor-not-allowed opacity-50", m),
|
|
24
24
|
onClick: (e) => e.currentTarget.querySelector("input")?.focus(),
|
|
25
25
|
children: [w > 0 && /* @__PURE__ */ s("div", {
|
|
26
26
|
ref: C,
|
package/dist/textarea/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cx as e } from "../utils/cx.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { useFieldProps as t } from "../field/index.js";
|
|
4
|
+
import { FIELD as n } from "../utils/styles.js";
|
|
5
5
|
import { jsx as r } from "react/jsx-runtime";
|
|
6
6
|
//#region packages/textarea/index.tsx
|
|
7
7
|
function i(i) {
|
|
8
|
-
let { className: a, ...o } = i, s =
|
|
8
|
+
let { className: a, ...o } = i, s = t(o);
|
|
9
9
|
return /* @__PURE__ */ r("textarea", {
|
|
10
|
-
className: e("zen__textarea",
|
|
10
|
+
className: e("zen__textarea", n.replace("h-10", ""), "h-32 w-full resize-y py-2", "read-only:text-foreground read-only:cursor-default read-only:border-none! read-only:bg-transparent read-only:shadow-none! read-only:outline-hidden!", a),
|
|
11
11
|
...o,
|
|
12
12
|
...s
|
|
13
13
|
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** A colour in OKLCH: lightness 0–1, chroma, hue in degrees, and alpha 0–1. */
|
|
2
|
+
export interface Oklch {
|
|
3
|
+
l: number;
|
|
4
|
+
c: number;
|
|
5
|
+
h: number;
|
|
6
|
+
alpha: number;
|
|
7
|
+
}
|
|
8
|
+
/** Hue in degrees, saturation and value 0–1, alpha 0–1. */
|
|
9
|
+
export interface Hsv {
|
|
10
|
+
h: number;
|
|
11
|
+
s: number;
|
|
12
|
+
v: number;
|
|
13
|
+
a: number;
|
|
14
|
+
}
|
|
15
|
+
type Rgba = [number, number, number, number];
|
|
16
|
+
/** "#rgb", "#rgba", "#rrggbb" or "#rrggbbaa" → sRGB and alpha, 0–1; null if it isn't one. */
|
|
17
|
+
export declare function parseHex(hex: string): Rgba | null;
|
|
18
|
+
/** sRGB and alpha, 0–1 → "#rrggbb", or "#rrggbbaa" when not opaque. */
|
|
19
|
+
export declare function formatHex([r, g, b, a]: readonly number[]): string;
|
|
20
|
+
export declare function hexToHsv(hex: string): Hsv | null;
|
|
21
|
+
export declare function hsvToHex({ h, s, v, a }: Hsv): string;
|
|
22
|
+
/** sRGB 0–1 → linear light. */
|
|
23
|
+
export declare const srgbToLinear: (c: number) => number;
|
|
24
|
+
/** Linear light → sRGB 0–1. */
|
|
25
|
+
export declare const linearToSrgb: (c: number) => number;
|
|
26
|
+
/** OKLCH → linear sRGB, clamped to gamut. */
|
|
27
|
+
export declare function oklchToLinear(l: number, c: number, h: number): [number, number, number];
|
|
28
|
+
/** A hex colour in OKLCH, e.g. to give its hue and chroma to the theme engine; null if it isn't one. */
|
|
29
|
+
export declare function hexToOklch(hex: string): Oklch | null;
|
|
30
|
+
/** OKLCH as hex; colours outside sRGB are clamped to it. */
|
|
31
|
+
export declare function oklchToHex({ l, c, h, alpha }: Omit<Oklch, 'alpha'> & {
|
|
32
|
+
alpha?: number;
|
|
33
|
+
}): string;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=color.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../packages/utils/color.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,MAAM,WAAW,KAAK;IAClB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,2DAA2D;AAC3D,MAAM,WAAW,GAAG;IAChB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACb;AAED,KAAK,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAI7C,6FAA6F;AAC7F,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAOjD;AAED,uEAAuE;AACvE,wBAAgB,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAK,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAMrE;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,GAAG,IAAI,CAahD;AAED,wBAAgB,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,GAAG,MAAM,CAMpD;AAED,+BAA+B;AAC/B,eAAO,MAAM,YAAY,GAAI,GAAG,MAAM,WAA8D,CAAC;AACrG,+BAA+B;AAC/B,eAAO,MAAM,YAAY,GAAI,GAAG,MAAM,WAAkE,CAAC;AAEzG,6CAA6C;AAC7C,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAWvF;AAED,wGAAwG;AACxG,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,CAcpD;AAED,4DAA4D;AAC5D,wBAAgB,UAAU,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAS,EAAE,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAEpG"}
|