@rinzai/zen 0.6.1 → 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.
Files changed (159) hide show
  1. package/LICENSE +27 -0
  2. package/README.md +3 -3
  3. package/dist/alert/index.d.ts +21 -0
  4. package/dist/alert/index.d.ts.map +1 -0
  5. package/dist/alert/index.js +49 -0
  6. package/dist/button/index.d.ts +2 -1
  7. package/dist/button/index.d.ts.map +1 -1
  8. package/dist/button/index.js +43 -12
  9. package/dist/calendar/index.d.ts.map +1 -1
  10. package/dist/calendar/index.js +86 -85
  11. package/dist/chart/donut.d.ts +4 -1
  12. package/dist/chart/donut.d.ts.map +1 -1
  13. package/dist/chart/donut.js +76 -66
  14. package/dist/chart/index.d.ts +8 -2
  15. package/dist/chart/index.d.ts.map +1 -1
  16. package/dist/chart/index.js +192 -182
  17. package/dist/chart/palette.d.ts +11 -0
  18. package/dist/chart/palette.d.ts.map +1 -0
  19. package/dist/chart/palette.js +9 -0
  20. package/dist/chart/tooltip.d.ts +6 -2
  21. package/dist/chart/tooltip.d.ts.map +1 -1
  22. package/dist/chart/tooltip.js +6 -6
  23. package/dist/checkbox/index.d.ts.map +1 -1
  24. package/dist/checkbox/index.js +28 -44
  25. package/dist/chip/index.js +1 -1
  26. package/dist/code-block/index.js +1 -1
  27. package/dist/date-picker/index.d.ts.map +1 -1
  28. package/dist/date-picker/index.js +24 -38
  29. package/dist/disclosure/index.js +1 -1
  30. package/dist/editable-cell/index.js +1 -1
  31. package/dist/field/index.d.ts +1 -1
  32. package/dist/field/index.d.ts.map +1 -1
  33. package/dist/field/index.js +33 -32
  34. package/dist/header/index.d.ts +9 -1
  35. package/dist/header/index.d.ts.map +1 -1
  36. package/dist/header/index.js +17 -9
  37. package/dist/icons/arrow-left.d.ts +3 -0
  38. package/dist/icons/arrow-left.d.ts.map +1 -0
  39. package/dist/icons/arrow-right.d.ts +3 -0
  40. package/dist/icons/arrow-right.d.ts.map +1 -0
  41. package/dist/icons/bars.d.ts +3 -0
  42. package/dist/icons/bars.d.ts.map +1 -0
  43. package/dist/icons/calendar.d.ts +3 -0
  44. package/dist/icons/calendar.d.ts.map +1 -0
  45. package/dist/icons/chart-bar.d.ts +3 -0
  46. package/dist/icons/chart-bar.d.ts.map +1 -0
  47. package/dist/icons/chevron-down.d.ts.map +1 -1
  48. package/dist/icons/chevron-down.js +4 -2
  49. package/dist/icons/chevron-left.d.ts.map +1 -1
  50. package/dist/icons/chevron-left.js +4 -2
  51. package/dist/icons/chevron-right.d.ts.map +1 -1
  52. package/dist/icons/chevron-right.js +4 -2
  53. package/dist/icons/chevron-up.d.ts.map +1 -1
  54. package/dist/icons/chevron-up.js +4 -2
  55. package/dist/icons/ellipsis.d.ts +0 -1
  56. package/dist/icons/ellipsis.d.ts.map +1 -1
  57. package/dist/icons/flag.d.ts +3 -0
  58. package/dist/icons/flag.d.ts.map +1 -0
  59. package/dist/icons/list-bullet.d.ts +3 -0
  60. package/dist/icons/list-bullet.d.ts.map +1 -0
  61. package/dist/icons/lock.d.ts +3 -0
  62. package/dist/icons/lock.d.ts.map +1 -0
  63. package/dist/icons/logout.d.ts +3 -0
  64. package/dist/icons/logout.d.ts.map +1 -0
  65. package/dist/icons/micro/calendar.d.ts +3 -0
  66. package/dist/icons/micro/calendar.d.ts.map +1 -0
  67. package/dist/icons/micro/calendar.js +21 -0
  68. package/dist/icons/micro/check.d.ts +3 -0
  69. package/dist/icons/micro/check.d.ts.map +1 -0
  70. package/dist/icons/micro/check.js +21 -0
  71. package/dist/icons/micro/chevron-down.d.ts +3 -0
  72. package/dist/icons/micro/chevron-down.d.ts.map +1 -0
  73. package/dist/icons/micro/chevron-down.js +21 -0
  74. package/dist/icons/micro/chevron-right.d.ts +3 -0
  75. package/dist/icons/micro/chevron-right.d.ts.map +1 -0
  76. package/dist/icons/micro/chevron-right.js +21 -0
  77. package/dist/icons/micro/exclamation-triangle.d.ts +3 -0
  78. package/dist/icons/micro/exclamation-triangle.d.ts.map +1 -0
  79. package/dist/icons/micro/exclamation-triangle.js +21 -0
  80. package/dist/icons/micro/information-circle.d.ts +3 -0
  81. package/dist/icons/micro/information-circle.d.ts.map +1 -0
  82. package/dist/icons/micro/information-circle.js +21 -0
  83. package/dist/icons/micro/minus.d.ts +3 -0
  84. package/dist/icons/micro/minus.d.ts.map +1 -0
  85. package/dist/icons/micro/minus.js +17 -0
  86. package/dist/icons/micro/moon.d.ts +3 -0
  87. package/dist/icons/micro/moon.d.ts.map +1 -0
  88. package/dist/icons/micro/moon.js +17 -0
  89. package/dist/icons/micro/sun.d.ts +3 -0
  90. package/dist/icons/micro/sun.d.ts.map +1 -0
  91. package/dist/icons/micro/sun.js +17 -0
  92. package/dist/icons/micro/x-mark.d.ts +3 -0
  93. package/dist/icons/micro/x-mark.d.ts.map +1 -0
  94. package/dist/icons/micro/x-mark.js +17 -0
  95. package/dist/icons/search.d.ts.map +1 -1
  96. package/dist/icons/search.js +4 -2
  97. package/dist/icons/settings.d.ts +3 -0
  98. package/dist/icons/settings.d.ts.map +1 -0
  99. package/dist/icons/squares.d.ts +3 -0
  100. package/dist/icons/squares.d.ts.map +1 -0
  101. package/dist/icons/table.d.ts +3 -0
  102. package/dist/icons/table.d.ts.map +1 -0
  103. package/dist/icons/x-mark.d.ts.map +1 -1
  104. package/dist/icons/x-mark.js +4 -2
  105. package/dist/index.d.ts +6 -4
  106. package/dist/index.d.ts.map +1 -1
  107. package/dist/lib.js +56 -61
  108. package/dist/menu/index.d.ts.map +1 -1
  109. package/dist/menu/index.js +67 -60
  110. package/dist/month-picker/index.d.ts.map +1 -1
  111. package/dist/month-picker/index.js +55 -55
  112. package/dist/pills/index.d.ts +1 -1
  113. package/dist/pills/index.d.ts.map +1 -1
  114. package/dist/pills/index.js +6 -2
  115. package/dist/popover/index.js +12 -11
  116. package/dist/select/index.d.ts.map +1 -1
  117. package/dist/select/index.js +96 -102
  118. package/dist/slider/index.d.ts.map +1 -1
  119. package/dist/slider/index.js +1 -1
  120. package/dist/status-pill/index.d.ts +18 -0
  121. package/dist/status-pill/index.d.ts.map +1 -0
  122. package/dist/status-pill/index.js +25 -0
  123. package/dist/tab-bar/index.js +1 -1
  124. package/dist/table/index.js +1 -1
  125. package/dist/tabs/index.d.ts.map +1 -1
  126. package/dist/tabs/index.js +9 -5
  127. package/dist/theme-toggle/index.d.ts +2 -1
  128. package/dist/theme-toggle/index.d.ts.map +1 -1
  129. package/dist/theme-toggle/index.js +35 -32
  130. package/dist/theme.css +62 -1
  131. package/dist/toast/index.d.ts.map +1 -1
  132. package/dist/toast/index.js +119 -106
  133. package/dist/tree/index.d.ts +22 -3
  134. package/dist/tree/index.d.ts.map +1 -1
  135. package/dist/tree/index.js +76 -56
  136. package/dist/utils/date.d.ts +6 -4
  137. package/dist/utils/date.d.ts.map +1 -1
  138. package/dist/utils/date.js +18 -16
  139. package/dist/utils/field-chevron.d.ts.map +1 -1
  140. package/dist/utils/field-chevron.js +5 -14
  141. package/dist/utils/status-icons.d.ts +1 -1
  142. package/dist/utils/status-icons.d.ts.map +1 -1
  143. package/dist/utils/status-icons.js +11 -41
  144. package/dist/utils/styles.d.ts +9 -3
  145. package/dist/utils/styles.d.ts.map +1 -1
  146. package/dist/utils/styles.js +2 -2
  147. package/dist/utils/theme-wave.d.ts +24 -0
  148. package/dist/utils/theme-wave.d.ts.map +1 -0
  149. package/dist/utils/theme-wave.js +219 -0
  150. package/dist/utils/typeahead.d.ts +12 -0
  151. package/dist/utils/typeahead.d.ts.map +1 -0
  152. package/dist/utils/typeahead.js +19 -0
  153. package/dist/zen.css +1 -1
  154. package/package.json +2 -1
  155. package/dist/icons/ellipsis.js +0 -31
  156. package/dist/icons/index.d.ts +0 -9
  157. package/dist/icons/index.d.ts.map +0 -1
  158. package/dist/icons/status.d.ts +0 -2
  159. 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, Inset, Stat, Dialog (and sheets from an edge), ConfirmDialog, Popover, Tooltip, Toast (a stacked deck), Disclosure, Backdrop (aurora, contours or dots, and a pointer light)
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
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, Skeleton, Spinner
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, currency, month and date helpers, `cx` (Tailwind-aware class merging), `cva`
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
 
@@ -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 };
@@ -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;;;;;;;;;;;;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"}
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"}
@@ -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, loading: c = !1, disabled: l, type: u = "button", asChild: d = !1, children: f, ...p }) {
8
- return d ? /* @__PURE__ */ r(e, {
9
- ...p,
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: f
16
+ children: p
16
17
  }) : /* @__PURE__ */ i("button", {
17
- type: u,
18
- disabled: l || c,
19
- "aria-busy": c || void 0,
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
- ...p,
26
- children: [c && /* @__PURE__ */ r(n, {}), f]
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":"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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G;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"}
@@ -1,161 +1,162 @@
1
1
  "use client";
2
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";
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 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(() => {
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 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) => {
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), b.mode === "range") {
20
- let t = b.value;
21
- !t || t.end !== null ? b.onChange({
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
- }) : b.onChange(e < t.start ? {
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 b.onChange(e);
32
+ } else x.onChange(e);
32
33
  }
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)
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(), 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", {
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__ */ v("button", {
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: x,
55
- children: /* @__PURE__ */ v(t, { className: "size-4" })
55
+ className: n,
56
+ children: /* @__PURE__ */ y(r, { className: "size-4" })
56
57
  }),
57
- /* @__PURE__ */ v("button", {
58
+ /* @__PURE__ */ y("button", {
58
59
  type: "button",
59
60
  id: W,
60
61
  "aria-live": "polite",
61
- "aria-label": R === "days" ? `${i(M, S, "long")}, choose month and year` : `${B}, back to 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 ? i(M, S, "long") : `${i(M, S)} – ${i(G, S)}` : B
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__ */ v("button", {
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: x,
73
- children: /* @__PURE__ */ v(n, { className: "size-4" })
73
+ className: n,
74
+ children: /* @__PURE__ */ y(i, { className: "size-4" })
74
75
  })
75
76
  ]
76
77
  });
77
78
  if (R === "months") {
78
- let t = a(S);
79
- return /* @__PURE__ */ y("div", {
79
+ let n = s(S);
80
+ return /* @__PURE__ */ b("div", {
80
81
  className: e("zen__calendar w-fit", D),
81
- children: [$, /* @__PURE__ */ v("div", {
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: 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", {
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": r === M,
91
- "aria-label": i(r, S, "long"),
91
+ "aria-pressed": i === M,
92
+ "aria-label": o(i, S, "long"),
92
93
  onClick: () => {
93
- N(r), U.current = !0, F(c(P, o(P.slice(0, 7), r))), z("days");
94
+ N(i), U.current = !0, F(u(P, c(P.slice(0, 7), i))), z("days");
94
95
  },
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);
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 le = p(S, "narrow"), ue = p(S, "long"), de = Array.from({ length: 7 }, (e, t) => (T + t) % 7);
103
- return /* @__PURE__ */ y("div", {
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__ */ v("div", {
106
+ children: [$, /* @__PURE__ */ y("div", {
106
107
  ref: H,
107
108
  className: "flex gap-4",
108
- onKeyDown: se,
109
+ onKeyDown: ce,
109
110
  onMouseLeave: () => L(null),
110
111
  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", {
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": i(a, S, "long"),
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__ */ v("caption", {
118
+ E > 1 && /* @__PURE__ */ y("caption", {
118
119
  className: "text-muted-foreground pb-1 text-xs font-medium",
119
- children: i(a, S, "long")
120
+ children: o(r, S, "long")
120
121
  }),
121
- /* @__PURE__ */ v("thead", { children: /* @__PURE__ */ v("tr", { children: de.map((e) => /* @__PURE__ */ v("th", {
122
+ /* @__PURE__ */ y("thead", { children: /* @__PURE__ */ y("tr", { children: fe.map((e) => /* @__PURE__ */ y("th", {
122
123
  scope: "col",
123
- abbr: ue[e],
124
+ abbr: de[e],
124
125
  className: "text-muted-foreground size-9 text-xs font-medium",
125
- children: le[e]
126
+ children: ue[e]
126
127
  }, 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", {
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 || (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", {
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": i,
138
- tabIndex: i === J ? 0 : -1,
139
- "aria-label": ee(i, S, "full"),
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": i === j ? "date" : void 0,
143
- onClick: () => oe(i),
143
+ "aria-current": o === j ? "date" : void 0,
144
+ onClick: () => se(o),
144
145
  onFocus: () => {
145
- F(i), Y && L(i);
146
+ F(o), Y && L(o);
146
147
  },
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))
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
- }, i);
152
+ }, o);
152
153
  }) }, n)) })
153
154
  ]
154
- }, a);
155
+ }, r);
155
156
  })
156
157
  })]
157
158
  });
158
159
  }
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
+ 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 { b as default };
162
+ export { x as default };
@@ -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,EAAiB,SAAS,EAAY,MA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