@luxalgo/vela-ui 0.1.0 → 0.3.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 (124) hide show
  1. package/CHANGELOG.md +89 -0
  2. package/README.md +5 -2
  3. package/dist/badge.js +1 -1
  4. package/dist/bar-chart.js +1 -1
  5. package/dist/button.d.ts +18 -4
  6. package/dist/button.js +4 -3
  7. package/dist/calendar.d.ts +3 -1
  8. package/dist/calendar.js +1 -1
  9. package/dist/callout-bubble.d.ts +6 -1
  10. package/dist/callout-bubble.js +12 -8
  11. package/dist/card.d.ts +52 -0
  12. package/dist/card.js +179 -0
  13. package/dist/checkbox.js +5 -5
  14. package/dist/{chunk-X4YPSIW6.js → chunk-5BJV5FY5.js} +1 -1
  15. package/dist/{chunk-FCO3YZLT.js → chunk-ALAHGSLC.js} +1 -1
  16. package/dist/{chunk-5QHXOAZA.js → chunk-B2EZB5ZG.js} +4 -4
  17. package/dist/{chunk-G7IQLY3A.js → chunk-C3PXY2SW.js} +5 -0
  18. package/dist/chunk-DXDCKZ2M.js +117 -0
  19. package/dist/{chunk-6NXY62JS.js → chunk-FYVQO5TN.js} +1 -1
  20. package/dist/{chunk-V6TTTMTE.js → chunk-GVRX3UAV.js} +4 -1
  21. package/dist/{chunk-XJAPCCOJ.js → chunk-IOOYDSSK.js} +4 -4
  22. package/dist/{chunk-OBLIX3VN.js → chunk-KKS6NEGI.js} +2 -2
  23. package/dist/{chunk-SAPURP46.js → chunk-OJ2SEMN6.js} +3 -3
  24. package/dist/{chunk-2Q4JRINP.js → chunk-OQXFQMZM.js} +3 -3
  25. package/dist/{chunk-AJ2IYSOI.js → chunk-TBXUF5YX.js} +35 -3
  26. package/dist/{chunk-ZB3BZHSN.js → chunk-UEO6W37Z.js} +4 -4
  27. package/dist/{chunk-CH3DV6FD.js → chunk-WWHNUKSZ.js} +5 -5
  28. package/dist/chunk-XBEL4K33.js +142 -0
  29. package/dist/collapsible.d.ts +49 -0
  30. package/dist/collapsible.js +106 -0
  31. package/dist/color-picker.js +5 -5
  32. package/dist/context-menu.js +5 -5
  33. package/dist/css.d.ts +3 -1
  34. package/dist/css.js +1 -1
  35. package/dist/data-table.d.ts +39 -2
  36. package/dist/data-table.js +1 -1
  37. package/dist/date-picker.js +3 -3
  38. package/dist/dialog.d.ts +8 -0
  39. package/dist/dialog.js +15 -5
  40. package/dist/donut.js +1 -1
  41. package/dist/drawer.js +2 -2
  42. package/dist/dropdown-menu.js +4 -4
  43. package/dist/empty.js +2 -2
  44. package/dist/field.js +13 -13
  45. package/dist/glyph-select.js +5 -5
  46. package/dist/h-Bl37qUis.d.ts +24 -0
  47. package/dist/hover-card.d.ts +1 -1
  48. package/dist/hover-card.js +3 -3
  49. package/dist/icons.js +1 -1
  50. package/dist/index.d.ts +10 -2
  51. package/dist/index.js +3 -3
  52. package/dist/input-group.js +4 -3
  53. package/dist/input.js +2 -2
  54. package/dist/item.d.ts +72 -0
  55. package/dist/item.js +131 -0
  56. package/dist/kbd.js +2 -2
  57. package/dist/line-chart.js +1 -1
  58. package/dist/manifest.json +1336 -65
  59. package/dist/month-grid.d.ts +45 -0
  60. package/dist/month-grid.js +157 -0
  61. package/dist/number-input.js +5 -5
  62. package/dist/popover.js +3 -3
  63. package/dist/scatter-chart.js +1 -1
  64. package/dist/select.js +7 -7
  65. package/dist/slider.d.ts +46 -0
  66. package/dist/slider.js +111 -0
  67. package/dist/sort-button.d.ts +41 -0
  68. package/dist/sort-button.js +88 -0
  69. package/dist/sparkline.js +1 -1
  70. package/dist/stat.js +1 -1
  71. package/dist/switch.js +3 -3
  72. package/dist/tabs.d.ts +3 -1
  73. package/dist/tabs.js +13 -8
  74. package/dist/text-area.js +2 -2
  75. package/dist/theme-Ct-q58xz.d.ts +341 -0
  76. package/dist/theme.d.ts +42 -181
  77. package/dist/theme.js +2 -2
  78. package/dist/theme.schema.json +541 -1
  79. package/dist/toast.d.ts +49 -0
  80. package/dist/toast.js +463 -0
  81. package/dist/toggle-group.js +4 -4
  82. package/dist/tooltip.js +2 -2
  83. package/dist/treemap.d.ts +80 -0
  84. package/dist/treemap.js +470 -0
  85. package/docs/theming.md +6 -0
  86. package/docs/writing-a-component.md +4 -1
  87. package/llms.txt +11 -3
  88. package/package.json +1 -1
  89. package/registry/button.ts +105 -21
  90. package/registry/callout-bubble.ts +14 -3
  91. package/registry/card.ts +379 -0
  92. package/registry/collapsible.ts +271 -0
  93. package/registry/dialog.ts +16 -0
  94. package/registry/dropdown-menu.ts +3 -3
  95. package/registry/item.ts +376 -0
  96. package/registry/month-grid.ts +328 -0
  97. package/registry/slider.ts +259 -0
  98. package/registry/sort-button.ts +189 -0
  99. package/registry/tabs.ts +38 -4
  100. package/registry/toast.ts +965 -0
  101. package/registry/treemap.ts +847 -0
  102. package/skills/using-vela-ui-components/SKILL.md +14 -9
  103. package/src/components/button.ts +105 -21
  104. package/src/components/callout-bubble.ts +14 -3
  105. package/src/components/card.ts +379 -0
  106. package/src/components/collapsible.ts +271 -0
  107. package/src/components/dialog.ts +16 -0
  108. package/src/components/dropdown-menu.ts +3 -3
  109. package/src/components/item.ts +376 -0
  110. package/src/components/month-grid.ts +328 -0
  111. package/src/components/slider.ts +259 -0
  112. package/src/components/sort-button.ts +189 -0
  113. package/src/components/tabs.ts +38 -4
  114. package/src/components/toast.ts +965 -0
  115. package/src/components/treemap.ts +847 -0
  116. package/src/lib/calendar.ts +5 -0
  117. package/src/lib/component-index.ts +34 -2
  118. package/src/lib/css.ts +6 -2
  119. package/src/lib/icons.ts +7 -0
  120. package/src/lib/scope.ts +135 -0
  121. package/src/lib/theme.ts +21 -5
  122. package/dist/chunk-EZQXTO6K.js +0 -89
  123. package/dist/chunk-IDA2BT7D.js +0 -29
  124. package/dist/data-table-DtU3FX9j.d.ts +0 -61
@@ -0,0 +1,117 @@
1
+ import { createKbd } from './chunk-FYVQO5TN.js';
2
+ import { iconEl } from './chunk-C3PXY2SW.js';
3
+ import { variants } from './chunk-LZWZV2ZS.js';
4
+ import { h } from './chunk-Q6WTDVH6.js';
5
+ import { t } from './chunk-6QCILIT2.js';
6
+ import { defineComponent } from './chunk-VMCR3S2A.js';
7
+ import { css, defineStyles } from './chunk-XBEL4K33.js';
8
+
9
+ // src/components/button.ts
10
+ var buttonDef = defineComponent({
11
+ name: "button",
12
+ parts: ["root", "icon", "keys"],
13
+ settings: {
14
+ radius: t.radius.md,
15
+ height: "34px",
16
+ "height-xs": "26px",
17
+ "height-sm": "30px",
18
+ "height-lg": "40px",
19
+ "font-size": "14px",
20
+ "font-size-xs": "12px",
21
+ "font-size-sm": "13px"
22
+ }
23
+ });
24
+ var buttonVariants = variants({
25
+ variant: ["default", "outline", "secondary", "ghost", "destructive", "link", "up", "down", "favorite"],
26
+ size: ["default", "xs", "sm", "lg", "icon", "icon-xs", "icon-sm", "icon-lg"]
27
+ });
28
+ var BUTTON_STYLE_ID = "vela-ui-button";
29
+ var BUTTON_CSS = css`@layer vela.ui{[data-slot=button]{cursor:pointer;height:${buttonDef.vars.height};border-radius:${buttonDef.vars.radius};border:1px solid ${t.border.strong};color:${t.fg};font-weight:400;font-size:${buttonDef.vars["font-size"]};white-space:nowrap;transition:background ${t.dur.fast} ease, color ${t.dur.fast} ease, opacity ${t.dur.fast} ease, border-color ${t.dur.fast} ease;background:0 0;padding:0 11px;font-family:inherit}[data-slot=button]:where(:not([hidden])){justify-content:center;align-items:center;gap:6px;display:inline-flex}[data-slot=button]>[data-icon]{flex:none;width:1em;height:1em;font-size:16px}[data-slot=button]>[data-icon]>svg{width:100%;height:100%}[data-slot=button][data-size=xs]>[data-icon],[data-slot=button][data-size=icon-xs]>[data-icon]{font-size:12px}[data-slot=button]>[data-keys]{flex:none;gap:2px}[data-slot=button]>[data-keys]:where(:not([hidden])){display:inline-flex}[data-slot=button]>[data-keys]>[data-slot=kbd]{border-color:${t.border};color:inherit;box-shadow:none;background:0 0}[data-slot=button][data-size=sm],[data-slot=button][data-size=icon-sm]{height:${buttonDef.vars["height-sm"]};font-size:${buttonDef.vars["font-size-sm"]}}[data-slot=button][data-size=xs],[data-slot=button][data-size=icon-xs]{height:${buttonDef.vars["height-xs"]};font-size:${buttonDef.vars["font-size-xs"]};border-radius:${t.radius.sm};padding:0 8px}[data-slot=button][data-size=lg],[data-slot=button][data-size=icon-lg]{height:${buttonDef.vars["height-lg"]};padding:0 14px}[data-slot=button][data-size=icon]{width:${buttonDef.vars.height};padding:0}[data-slot=button][data-size=icon-sm]{width:${buttonDef.vars["height-sm"]};padding:0}[data-slot=button][data-size=icon-xs]{width:${buttonDef.vars["height-xs"]};padding:0}[data-slot=button][data-size=icon-lg]{width:${buttonDef.vars["height-lg"]};padding:0}[data-slot=button]:disabled{cursor:default;opacity:.5}[data-slot=button]:focus-visible{outline:2px solid ${t.focus};outline-offset:1px}[data-slot=button]:not(:disabled):hover,[data-slot=button][aria-expanded=true]{background:${t.hover};color:${t.fg.bright};border-color:${t.fg.muted}}[data-slot=button][data-variant=default]{border-color:${t.selected.bg};background:${t.selected.bg};color:${t.selected.fg}}[data-slot=button][data-variant=default]:not(:disabled):hover,[data-slot=button][data-variant=default][aria-expanded=true]{background:${t.selected.bg};color:${t.selected.fg};opacity:.85;border-color:${t.selected.bg}}[data-slot=button][data-variant=secondary]{background:${t.surface.sunken};border-color:${t.border}}[data-slot=button][data-variant=secondary]:not(:disabled):hover,[data-slot=button][data-variant=secondary][aria-expanded=true]{border-color:${t.border.strong}}[data-slot=button][data-variant=ghost]{color:${t.fg.muted};border-color:#0000}[data-slot=button][data-variant=ghost]:not(:disabled):hover,[data-slot=button][data-variant=ghost][aria-expanded=true]{border-color:#0000}[data-slot=button][data-variant=destructive]{background:color-mix(in srgb, ${t.danger} 14%, transparent);color:${t.danger};border-color:#0000}[data-slot=button][data-variant=destructive]:not(:disabled):hover{background:color-mix(in srgb, ${t.danger} 24%, transparent);color:${t.danger};border-color:#0000}[data-slot=button][data-variant=link]{color:${t.accent};text-underline-offset:4px;background:0 0;border-color:#0000;padding-inline:0}[data-slot=button][data-variant=link]:not(:disabled):hover{color:${t.accent};background:0 0;border-color:#0000;text-decoration:underline}[data-slot=button][data-variant=up],[data-slot=button][data-variant=up]:not(:disabled):hover{background:${t.up};color:${t.fg.onFill};border-color:#0000}[data-slot=button][data-variant=down],[data-slot=button][data-variant=down]:not(:disabled):hover{background:${t.down};color:${t.fg.onFill};border-color:#0000}[data-slot=button][data-variant=up]:not(:disabled):hover,[data-slot=button][data-variant=down]:not(:disabled):hover{opacity:.88}[data-slot=button][data-pressed]{background:${t.active};color:${t.fg.bright}}[data-slot=button][data-variant=favorite]{color:${t.fg.muted};border-color:#0000}[data-slot=button][data-variant=favorite]:not(:disabled):hover{border-color:#0000}[data-slot=button][data-variant=favorite][data-pressed]{color:${t.highlight};background:0 0}[data-slot=button][data-variant=favorite][data-pressed]:where(:not(:disabled)):hover{background:${t.hover};color:${t.highlight}}}`;
30
+ var injectStyles = defineStyles(BUTTON_STYLE_ID, BUTTON_CSS);
31
+ var iconPart = (id, side) => {
32
+ const el = iconEl(id, document);
33
+ el.dataset.slot = buttonDef.slot("icon");
34
+ el.dataset.icon = side;
35
+ return el;
36
+ };
37
+ var keysPart = (keys, side) => keys?.length ? h("span", { slot: buttonDef.slot("keys"), data: { keys: side } }, ...keys.map((key) => createKbd({ text: key }).el)) : null;
38
+ var ButtonImpl = class {
39
+ constructor(props) {
40
+ injectStyles(document);
41
+ const { variant, size } = buttonVariants.resolve(props);
42
+ const favorite = variant === "favorite";
43
+ this.iconOnly = size.startsWith("icon");
44
+ this.label = props.label ?? props.text;
45
+ this.controlled = props.pressed !== void 0;
46
+ this.toggle = this.controlled || props.defaultPressed !== void 0 || props.onPressedChange !== void 0;
47
+ this.pressedState = props.pressed ?? props.defaultPressed ?? (this.toggle ? false : void 0);
48
+ this.icon = props.icon ?? (favorite ? "star" : void 0);
49
+ this.iconPressed = props.iconPressed ?? (favorite ? "star-filled" : void 0);
50
+ this.iconStart = this.icon ? iconPart(this.icon, "inline-start") : null;
51
+ this.shownIcon = this.icon;
52
+ this.textNode = !this.iconOnly && props.text !== void 0 ? document.createTextNode(props.text) : null;
53
+ const onClick = (e) => {
54
+ if (this.toggle) {
55
+ const next = !this.pressedState;
56
+ if (!this.controlled) this.setPressed(next);
57
+ props.onPressedChange?.(next);
58
+ }
59
+ props.onClick?.(e);
60
+ };
61
+ this.el = h(
62
+ "button",
63
+ {
64
+ className: props.className ? `vela-btn ${props.className}` : "vela-btn",
65
+ slot: buttonDef.slot("root"),
66
+ attrs: { type: "button", ...buttonVariants({ variant, size }) },
67
+ on: this.toggle || props.onClick ? { click: onClick } : void 0
68
+ },
69
+ this.iconStart,
70
+ this.iconOnly ? null : keysPart(props.keys, "inline-start"),
71
+ this.textNode,
72
+ this.iconOnly ? null : keysPart(props.keysEnd, "inline-end"),
73
+ props.iconEnd && !this.iconOnly ? iconPart(props.iconEnd, "inline-end") : null
74
+ );
75
+ this.el.disabled = props.disabled ?? false;
76
+ this.paint();
77
+ }
78
+ get pressed() {
79
+ return this.pressedState;
80
+ }
81
+ setPressed(pressed) {
82
+ this.pressedState = pressed;
83
+ this.paint();
84
+ }
85
+ setDisabled(disabled) {
86
+ this.el.disabled = disabled;
87
+ }
88
+ setText(text) {
89
+ this.label = text;
90
+ if (this.textNode) this.textNode.data = text;
91
+ this.paint();
92
+ }
93
+ destroy() {
94
+ }
95
+ paint() {
96
+ const el = this.el;
97
+ if (this.iconStart && this.iconPressed) {
98
+ const icon = this.pressedState ? this.iconPressed : this.icon;
99
+ if (icon !== this.shownIcon) {
100
+ const next = iconPart(icon, "inline-start");
101
+ this.iconStart.replaceWith(next);
102
+ this.iconStart = next;
103
+ this.shownIcon = icon;
104
+ }
105
+ }
106
+ el.toggleAttribute("data-pressed", this.pressedState === true);
107
+ if (this.pressedState === void 0) el.removeAttribute("aria-pressed");
108
+ else el.setAttribute("aria-pressed", String(this.pressedState));
109
+ if (this.iconOnly && this.label !== void 0) el.setAttribute("aria-label", this.label);
110
+ else el.removeAttribute("aria-label");
111
+ }
112
+ };
113
+ function createButton(props = {}) {
114
+ return new ButtonImpl(props);
115
+ }
116
+
117
+ export { BUTTON_CSS, BUTTON_STYLE_ID, buttonDef, buttonVariants, createButton };
@@ -1,7 +1,7 @@
1
1
  import { h } from './chunk-Q6WTDVH6.js';
2
2
  import { t } from './chunk-6QCILIT2.js';
3
3
  import { defineComponent } from './chunk-VMCR3S2A.js';
4
- import { defineStyles, css } from './chunk-IDA2BT7D.js';
4
+ import { defineStyles, css } from './chunk-XBEL4K33.js';
5
5
 
6
6
  // src/components/kbd.ts
7
7
  var kbdDef = defineComponent({
@@ -56,6 +56,9 @@ function weekdayNames(settings) {
56
56
  const dtf = dateFormat(settings, { weekday: "short" });
57
57
  return Array.from({ length: 7 }, (_, d) => stripBidiMarks(dtf.format(Date.UTC(2e3, 0, 2 + d))));
58
58
  }
59
+ function longDate(settings, year, month, day) {
60
+ return stripBidiMarks(dateFormat(settings, { weekday: "long", year: "numeric", month: "long", day: "numeric" }).format(Date.UTC(year, month, day)));
61
+ }
59
62
  function yearLabel(settings, year) {
60
63
  if (settings.english) return localizeDigits(String(year), settings);
61
64
  return stripBidiMarks(dateFormat(settings, { year: "numeric" }).format(Date.UTC(year, 6, 1)));
@@ -76,4 +79,4 @@ function yearBeforeMonth(settings) {
76
79
  return first;
77
80
  }
78
81
 
79
- export { calendarSettings, monthNames, plainInteger, weekdayNames, yearBeforeMonth, yearLabel };
82
+ export { calendarSettings, longDate, monthNames, plainInteger, weekdayNames, yearBeforeMonth, yearLabel };
@@ -1,11 +1,11 @@
1
- import { variants } from './chunk-LZWZV2ZS.js';
2
- import { iconEl } from './chunk-G7IQLY3A.js';
3
- import { nextUid, runMachine, normalizeProps, spreadProps } from './chunk-P4MTEMT7.js';
4
1
  import { ownTeardown } from './chunk-A72NWYNP.js';
2
+ import { nextUid, runMachine, normalizeProps, spreadProps } from './chunk-P4MTEMT7.js';
3
+ import { iconEl } from './chunk-C3PXY2SW.js';
4
+ import { variants } from './chunk-LZWZV2ZS.js';
5
5
  import { h } from './chunk-Q6WTDVH6.js';
6
6
  import { t } from './chunk-6QCILIT2.js';
7
7
  import { defineComponent } from './chunk-VMCR3S2A.js';
8
- import { defineStyles, css } from './chunk-IDA2BT7D.js';
8
+ import { defineStyles, css } from './chunk-XBEL4K33.js';
9
9
  import * as zagSwitch from '@zag-js/switch';
10
10
 
11
11
  function checkboxController(opts = {}) {
@@ -1,12 +1,12 @@
1
1
  import { announceSurface } from './chunk-J2QJATCD.js';
2
2
  import { holdForExit } from './chunk-S7USVSYP.js';
3
- import { floatingLayerHost, ensureUIHost } from './chunk-AJ2IYSOI.js';
3
+ import { floatingLayerHost, ensureUIHost } from './chunk-TBXUF5YX.js';
4
4
  import { viewportRect, insetRect, intersectRects, placePopover } from './chunk-3Q32K4PE.js';
5
5
  import { disposeWithin } from './chunk-A72NWYNP.js';
6
6
  import { h } from './chunk-Q6WTDVH6.js';
7
7
  import { t } from './chunk-6QCILIT2.js';
8
8
  import { defineComponent } from './chunk-VMCR3S2A.js';
9
- import { css, defineStyles } from './chunk-IDA2BT7D.js';
9
+ import { css, defineStyles } from './chunk-XBEL4K33.js';
10
10
  import { pageState } from './chunk-X66RJAIS.js';
11
11
 
12
12
  // src/components/popover.ts
@@ -1,9 +1,9 @@
1
- import { openPopoverTrigger, closeOpenPopovers, Popover } from './chunk-OBLIX3VN.js';
2
- import { iconEl } from './chunk-G7IQLY3A.js';
1
+ import { openPopoverTrigger, closeOpenPopovers, Popover } from './chunk-KKS6NEGI.js';
2
+ import { iconEl } from './chunk-C3PXY2SW.js';
3
3
  import { h } from './chunk-Q6WTDVH6.js';
4
4
  import { t } from './chunk-6QCILIT2.js';
5
5
  import { defineComponent } from './chunk-VMCR3S2A.js';
6
- import { defineStyles, css } from './chunk-IDA2BT7D.js';
6
+ import { defineStyles, css } from './chunk-XBEL4K33.js';
7
7
 
8
8
  // src/components/glyph-select.ts
9
9
  function glyphSelectController(opts) {
@@ -1,13 +1,13 @@
1
- import { openPopoverTrigger, closeOpenPopovers, Popover } from './chunk-OBLIX3VN.js';
2
1
  import { kitTranslator } from './chunk-FVH6L7FM.js';
3
2
  import { msg, textOf } from './chunk-FN2BUFNM.js';
3
+ import { openPopoverTrigger, closeOpenPopovers, Popover } from './chunk-KKS6NEGI.js';
4
4
  import { ACCENT_BRIGHT, ACCENT, BULLISH, BEARISH, WARNING, NEUTRAL } from './chunk-MMTMOV6R.js';
5
- import { nextUid, runMachine, normalizeProps, spreadProps } from './chunk-P4MTEMT7.js';
6
5
  import { ownTeardown, disposeWithin } from './chunk-A72NWYNP.js';
6
+ import { nextUid, runMachine, normalizeProps, spreadProps } from './chunk-P4MTEMT7.js';
7
7
  import { h } from './chunk-Q6WTDVH6.js';
8
8
  import { t } from './chunk-6QCILIT2.js';
9
9
  import { defineComponent } from './chunk-VMCR3S2A.js';
10
- import { defineStyles, css } from './chunk-IDA2BT7D.js';
10
+ import { defineStyles, css } from './chunk-XBEL4K33.js';
11
11
  import * as zagSlider from '@zag-js/slider';
12
12
 
13
13
  function splitColor(color) {
@@ -1,7 +1,7 @@
1
1
  import { STATIC_TOKENS, themeTokens } from './chunk-TAKSIV57.js';
2
2
  import { BEARISH, BULLISH } from './chunk-MMTMOV6R.js';
3
3
  import { declaredComponents } from './chunk-VMCR3S2A.js';
4
- import { acceptCss, isWrittenCss } from './chunk-IDA2BT7D.js';
4
+ import { acceptCss, isWrittenCss } from './chunk-XBEL4K33.js';
5
5
  import { injectLayerOrder, injectStyles } from './chunk-2GQIZM5Z.js';
6
6
  import { parseRgb, contrastRatio, isDarkColor, mix } from './chunk-BXMWQIBO.js';
7
7
 
@@ -16,17 +16,25 @@ var KIT_COMPONENTS = {
16
16
  settings: ["tip-radius", "tip-shadow", "tip-z", "tip-bg"]
17
17
  },
18
18
  button: {
19
- parts: ["root", "icon"],
19
+ parts: ["root", "icon", "keys"],
20
20
  settings: ["radius", "height", "height-xs", "height-sm", "height-lg", "font-size", "font-size-xs", "font-size-sm"]
21
21
  },
22
22
  "callout-bubble": {
23
23
  parts: ["root", "panel", "title", "text", "actions", "button"],
24
24
  settings: ["panel-radius", "button-radius"]
25
25
  },
26
+ card: {
27
+ parts: ["root", "header", "heading", "eyebrow", "title", "trigger", "description", "action", "content", "footer"],
28
+ settings: ["radius", "padding", "padding-sm", "gap", "gap-sm", "background", "border", "inset-background"]
29
+ },
26
30
  checkbox: {
27
31
  parts: ["root", "icon"],
28
32
  settings: ["radius"]
29
33
  },
34
+ collapsible: {
35
+ parts: ["root", "trigger", "icon", "title", "count", "chevron", "content"],
36
+ settings: ["trigger-height", "radius"]
37
+ },
30
38
  "color-picker": {
31
39
  parts: ["root", "trigger", "swatch", "content"],
32
40
  settings: ["swatch-ring", "circle-swatch-radius", "content-radius"]
@@ -79,6 +87,10 @@ var KIT_COMPONENTS = {
79
87
  parts: ["root", "control", "addon", "text"],
80
88
  settings: ["radius", "height", "height-sm", "focus-ring"]
81
89
  },
90
+ item: {
91
+ parts: ["root", "media", "content", "title", "description", "meta", "actions", "group"],
92
+ settings: ["radius", "gap"]
93
+ },
82
94
  kbd: {
83
95
  parts: ["root"],
84
96
  settings: ["radius", "shadow"]
@@ -87,6 +99,10 @@ var KIT_COMPONENTS = {
87
99
  parts: ["root", "label", "area", "line", "dot", "tip"],
88
100
  settings: ["tip-radius", "tip-shadow", "tip-z", "tip-bg", "stroke-width"]
89
101
  },
102
+ "month-grid": {
103
+ parts: ["root", "weekday", "day", "date", "value", "detail", "blank"],
104
+ settings: ["radius", "day-height", "gap", "selected-ring"]
105
+ },
90
106
  "number-input": {
91
107
  parts: ["root", "input", "steps", "step"],
92
108
  settings: ["radius", "step-radius", "focus-ring"]
@@ -103,6 +119,14 @@ var KIT_COMPONENTS = {
103
119
  parts: ["root", "trigger", "value", "icon", "sizer", "native", "content", "viewport", "item", "rail", "thumb"],
104
120
  settings: ["radius", "content-radius", "thumb-radius", "focus-ring"]
105
121
  },
122
+ slider: {
123
+ parts: ["root", "control", "track", "range", "thumb"],
124
+ settings: ["track-height", "thumb-size", "radius", "focus-ring"]
125
+ },
126
+ "sort-button": {
127
+ parts: ["root", "icon", "state"],
128
+ settings: ["radius"]
129
+ },
106
130
  sparkline: {
107
131
  parts: ["root", "area", "baseline", "line"],
108
132
  settings: ["stroke-width"]
@@ -116,13 +140,17 @@ var KIT_COMPONENTS = {
116
140
  settings: ["width", "height", "thumb-size", "width-sm", "height-sm", "thumb-size-sm"]
117
141
  },
118
142
  tabs: {
119
- parts: ["list", "trigger", "icon", "count", "content"],
143
+ parts: ["list", "trigger", "icon", "count", "label", "description", "content"],
120
144
  settings: ["track-radius", "trigger-radius", "filled-radius", "soft-radius", "count-radius"]
121
145
  },
122
146
  "text-area": {
123
147
  parts: ["root", "input"],
124
148
  settings: ["radius", "focus-ring"]
125
149
  },
150
+ toast: {
151
+ parts: ["root", "list", "item", "close", "icon", "content", "title", "description", "cancel", "action"],
152
+ settings: ["width", "radius", "background", "border", "foreground", "description-color", "shadow", "success", "info", "warning", "error"]
153
+ },
126
154
  "toggle-group": {
127
155
  parts: ["root", "item", "icon"],
128
156
  settings: ["radius", "radius-sm", "item-radius", "item-radius-sm"]
@@ -130,6 +158,10 @@ var KIT_COMPONENTS = {
130
158
  tooltip: {
131
159
  parts: ["positioner", "content"],
132
160
  settings: ["radius"]
161
+ },
162
+ treemap: {
163
+ parts: ["root", "crumbs", "crumb", "map", "group", "group-name", "group-value", "tile", "tile-label", "tile-value", "legend", "legend-bar", "tip"],
164
+ settings: ["radius", "up", "down", "tile-bg", "tint-min", "tint-max", "hover-z", "tip-radius", "tip-bg", "tip-shadow", "tip-z"]
133
165
  }
134
166
  };
135
167
 
@@ -1,13 +1,13 @@
1
- import { variants } from './chunk-LZWZV2ZS.js';
2
- import { iconEl } from './chunk-G7IQLY3A.js';
3
1
  import { kitTranslator } from './chunk-FVH6L7FM.js';
4
2
  import { msg, textOf } from './chunk-FN2BUFNM.js';
5
- import { nextUid, runMachine, normalizeProps, spreadProps } from './chunk-P4MTEMT7.js';
6
3
  import { ownTeardown } from './chunk-A72NWYNP.js';
4
+ import { nextUid, runMachine, normalizeProps, spreadProps } from './chunk-P4MTEMT7.js';
5
+ import { iconEl } from './chunk-C3PXY2SW.js';
6
+ import { variants } from './chunk-LZWZV2ZS.js';
7
7
  import { h } from './chunk-Q6WTDVH6.js';
8
8
  import { t } from './chunk-6QCILIT2.js';
9
9
  import { defineComponent } from './chunk-VMCR3S2A.js';
10
- import { css, defineStyles } from './chunk-IDA2BT7D.js';
10
+ import { css, defineStyles } from './chunk-XBEL4K33.js';
11
11
  import * as zagNumber from '@zag-js/number-input';
12
12
 
13
13
  function clampNumber(n, opts) {
@@ -1,12 +1,12 @@
1
- import { variants } from './chunk-LZWZV2ZS.js';
2
- import { openPopoverTrigger, closeOpenPopovers, Popover } from './chunk-OBLIX3VN.js';
3
- import { iconEl } from './chunk-G7IQLY3A.js';
4
- import { nextUid, runMachine, normalizeProps, spreadProps } from './chunk-P4MTEMT7.js';
1
+ import { openPopoverTrigger, closeOpenPopovers, Popover } from './chunk-KKS6NEGI.js';
5
2
  import { ownTeardown } from './chunk-A72NWYNP.js';
3
+ import { nextUid, runMachine, normalizeProps, spreadProps } from './chunk-P4MTEMT7.js';
4
+ import { iconEl } from './chunk-C3PXY2SW.js';
5
+ import { variants } from './chunk-LZWZV2ZS.js';
6
6
  import { addSlot, h } from './chunk-Q6WTDVH6.js';
7
7
  import { t } from './chunk-6QCILIT2.js';
8
8
  import { defineComponent } from './chunk-VMCR3S2A.js';
9
- import { css, defineStyles } from './chunk-IDA2BT7D.js';
9
+ import { css, defineStyles } from './chunk-XBEL4K33.js';
10
10
  import * as zagListbox from '@zag-js/listbox';
11
11
 
12
12
  function selectController(opts) {
@@ -0,0 +1,142 @@
1
+ import { injectLayerOrder, injectStyles } from './chunk-2GQIZM5Z.js';
2
+ import { pageState } from './chunk-X66RJAIS.js';
3
+
4
+ // src/lib/scope.ts
5
+ var KIT_SCOPE = ":where(.vela-ui, .vela-ui *, .vela-ui-layer, .vela-ui-layer *, [data-vela-theme], [data-vela-theme] *)";
6
+ var GROUPING = /^@(?:layer|media|supports|container|scope|starting-style)\b/i;
7
+ var LEGACY_PSEUDO_ELEMENT = /^:(?:before|after|first-line|first-letter)(?![\w-])/i;
8
+ var SPACE = /\s/;
9
+ function skipOpaque(text, i) {
10
+ const c = text[i];
11
+ if (c === "\\") return i + 2;
12
+ if (c === '"' || c === "'") {
13
+ let j = i + 1;
14
+ while (j < text.length && text[j] !== c) j += text[j] === "\\" ? 2 : 1;
15
+ return j + 1;
16
+ }
17
+ if (c === "/" && text[i + 1] === "*") {
18
+ const end = text.indexOf("*/", i + 2);
19
+ return end < 0 ? text.length : end + 2;
20
+ }
21
+ return i;
22
+ }
23
+ function withoutComments(text) {
24
+ let out = "";
25
+ for (let i = 0; i < text.length; ) {
26
+ const next = skipOpaque(text, i);
27
+ if (next === i) out += text[i++];
28
+ else {
29
+ if (text[i] !== "/") out += text.slice(i, next);
30
+ i = next;
31
+ }
32
+ }
33
+ return out;
34
+ }
35
+ function selectorsOf(list) {
36
+ const out = [];
37
+ let depth = 0;
38
+ let start = 0;
39
+ for (let i = 0; i < list.length; ) {
40
+ const next = skipOpaque(list, i);
41
+ if (next !== i) {
42
+ i = next;
43
+ continue;
44
+ }
45
+ const c = list[i];
46
+ if (c === "(" || c === "[") depth += 1;
47
+ else if (c === ")" || c === "]") depth -= 1;
48
+ else if (c === "," && depth === 0) {
49
+ out.push(list.slice(start, i).trim());
50
+ start = i + 1;
51
+ }
52
+ i += 1;
53
+ }
54
+ out.push(list.slice(start).trim());
55
+ return out;
56
+ }
57
+ function scopeSelector(selector) {
58
+ if (!selector || /^[>+~]/.test(selector)) return selector;
59
+ let depth = 0;
60
+ let i = 0;
61
+ while (i < selector.length) {
62
+ const next = skipOpaque(selector, i);
63
+ if (next !== i) {
64
+ i = next;
65
+ continue;
66
+ }
67
+ const c = selector[i];
68
+ if (c === "(" || c === "[") depth += 1;
69
+ else if (c === ")" || c === "]") depth -= 1;
70
+ else if (depth === 0 && (SPACE.test(c) || c === ">" || c === "+" || c === "~")) break;
71
+ else if (depth === 0 && c === ":" && (selector[i + 1] === ":" || LEGACY_PSEUDO_ELEMENT.test(selector.slice(i)))) break;
72
+ i += 1;
73
+ }
74
+ return selector.slice(0, i) + KIT_SCOPE + selector.slice(i);
75
+ }
76
+ function scopeToKit(text) {
77
+ let out = "";
78
+ let copied = 0;
79
+ let start = 0;
80
+ let scoping = true;
81
+ const outer = [];
82
+ for (let i = 0; i < text.length; ) {
83
+ const next = skipOpaque(text, i);
84
+ if (next !== i) {
85
+ i = next;
86
+ continue;
87
+ }
88
+ const c = text[i];
89
+ if (c === ";") {
90
+ start = i + 1;
91
+ } else if (c === "{") {
92
+ const prelude = text.slice(start, i);
93
+ const head = withoutComments(prelude).trim();
94
+ outer.push(scoping);
95
+ if (head.startsWith("@")) {
96
+ scoping && (scoping = GROUPING.test(head));
97
+ } else {
98
+ if (scoping && head) {
99
+ const lead = /^\s*/.exec(prelude)[0];
100
+ const trail = /\s*$/.exec(prelude)[0];
101
+ out += text.slice(copied, start) + lead + selectorsOf(head).map(scopeSelector).join(", ") + trail;
102
+ copied = i;
103
+ }
104
+ scoping = false;
105
+ }
106
+ start = i + 1;
107
+ } else if (c === "}") {
108
+ scoping = outer.pop() ?? true;
109
+ start = i + 1;
110
+ }
111
+ i += 1;
112
+ }
113
+ return out + text.slice(copied);
114
+ }
115
+
116
+ // src/lib/css.ts
117
+ var written = pageState("written-css@1", () => /* @__PURE__ */ new Set());
118
+ function css(strings, ...values) {
119
+ let out = strings[0] ?? "";
120
+ for (let i = 0; i < values.length; i += 1) out += String(values[i]) + (strings[i + 1] ?? "");
121
+ written.add(out);
122
+ return out;
123
+ }
124
+ function isWrittenCss(text) {
125
+ return written.has(text);
126
+ }
127
+ function acceptCss(text) {
128
+ written.add(text);
129
+ }
130
+ function defineStyles(id, text) {
131
+ const injected = /* @__PURE__ */ new WeakMap();
132
+ let scoped;
133
+ return (root = document) => {
134
+ if (injected.get(root)?.isConnected) return;
135
+ injectLayerOrder(root);
136
+ injectStyles(id, scoped ?? (scoped = scopeToKit(text)), root);
137
+ const sheet = root.getElementById?.(id) ?? (root instanceof Document ? null : root.querySelector(`#${CSS.escape(id)}`));
138
+ if (sheet) injected.set(root, sheet);
139
+ };
140
+ }
141
+
142
+ export { acceptCss, css, defineStyles, isWrittenCss };
@@ -0,0 +1,49 @@
1
+ import { a as VariantProps, V as VariantFn } from './variants-B4stUBnY.js';
2
+ import { C as ComponentDef } from './define-D5u3F5Dj.js';
3
+ import './t.js';
4
+
5
+ declare const collapsibleDef: ComponentDef<"collapsible", "title" | "root" | "count" | "icon" | "trigger" | "content" | "chevron", "radius" | "trigger-height">;
6
+ declare const collapsibleVariants: VariantFn<{
7
+ readonly variant: readonly ["default", "label"];
8
+ }>;
9
+ type CollapsibleVariant = (typeof collapsibleVariants.spec.variant)[number];
10
+ interface CollapsibleProps extends VariantProps<typeof collapsibleVariants> {
11
+ /** The header's text. Without `trigger`, the collapsible draws its header with it. */
12
+ title?: string;
13
+ /** After the title, muted: a count, a total. Null shows none. */
14
+ count?: string | number | null;
15
+ /** Icon id from the kit's registry, before the title. */
16
+ icon?: string;
17
+ /** A host element that toggles the content instead of the header (a row's chevron
18
+ * button): it gets `aria-expanded`, `aria-controls` and `data-state`, and a click on it
19
+ * toggles. The root then holds only the content. */
20
+ trigger?: HTMLElement;
21
+ /** The content, or a function that fills the content element. */
22
+ content?: Node | ((content: HTMLElement) => void);
23
+ /** Open when created (default closed). */
24
+ defaultOpen?: boolean;
25
+ /** Opened or closed by the user. */
26
+ onOpenChange?: (open: boolean) => void;
27
+ disabled?: boolean;
28
+ /** Extra class names (layout hooks). */
29
+ className?: string;
30
+ }
31
+ interface CollapsibleHandle {
32
+ readonly el: HTMLElement;
33
+ /** What toggles it: its header, or the host's `trigger`. */
34
+ readonly trigger: HTMLElement;
35
+ /** The element that holds the content. */
36
+ readonly content: HTMLElement;
37
+ readonly open: boolean;
38
+ /** Open or close it without calling `onOpenChange`. */
39
+ setOpen(open: boolean): void;
40
+ /** A new header text (its own header only). */
41
+ setTitle(title: string): void;
42
+ /** A new count (its own header only); null hides it. */
43
+ setCount(count: string | number | null): void;
44
+ setDisabled(disabled: boolean): void;
45
+ destroy(): void;
46
+ }
47
+ declare function createCollapsible(props?: CollapsibleProps): CollapsibleHandle;
48
+
49
+ export { type CollapsibleHandle, type CollapsibleProps, type CollapsibleVariant, collapsibleDef, collapsibleVariants, createCollapsible };
@@ -0,0 +1,106 @@
1
+ import { nextUid } from './chunk-P4MTEMT7.js';
2
+ import { iconEl } from './chunk-C3PXY2SW.js';
3
+ import { variants } from './chunk-LZWZV2ZS.js';
4
+ import { h } from './chunk-Q6WTDVH6.js';
5
+ import { t } from './chunk-6QCILIT2.js';
6
+ import { defineComponent } from './chunk-VMCR3S2A.js';
7
+ import { defineStyles, css } from './chunk-XBEL4K33.js';
8
+ import './chunk-2GQIZM5Z.js';
9
+ import './chunk-BXMWQIBO.js';
10
+ import './chunk-X66RJAIS.js';
11
+
12
+ // src/components/collapsible.ts
13
+ var collapsibleDef = defineComponent({
14
+ name: "collapsible",
15
+ parts: ["root", "trigger", "icon", "title", "count", "chevron", "content"],
16
+ settings: { "trigger-height": "36px", radius: t.radius.md }
17
+ });
18
+ var collapsibleVariants = variants({ variant: ["default", "label"] });
19
+ var injectStyles = defineStyles(
20
+ "vela-ui-collapsible",
21
+ css`@layer vela.ui{[data-slot=collapsible]{min-width:0}[data-slot=collapsible-trigger]:where(:not([hidden])){all:unset;box-sizing:border-box;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;align-items:center;gap:8px;width:100%;display:flex}[data-slot=collapsible-trigger]:where(:not([hidden])):focus-visible{outline:2px solid ${t.focus};outline-offset:-2px}[data-slot=collapsible-trigger]:where(:not([hidden]))[data-disabled]{cursor:default;opacity:.5}[data-slot=collapsible-trigger]:where(:not([hidden]))[data-variant=default]{min-height:${collapsibleDef.vars["trigger-height"]};border-radius:${collapsibleDef.vars.radius};color:${t.fg.bright};transition:background ${t.dur.fast} ease;padding:0 12px;font-size:13px;font-weight:600}[data-slot=collapsible-trigger]:where(:not([hidden]))[data-variant=default]:not([data-disabled]):hover{background:${t.hover}}[data-slot=collapsible-trigger]:where(:not([hidden]))[data-variant=label]{color:${t.fg.muted};letter-spacing:.08em;text-transform:uppercase;transition:color ${t.dur.fast} ease;gap:6px;padding:10px 4px 4px;font-size:10px;font-weight:700}[data-slot=collapsible-trigger]:where(:not([hidden]))[data-variant=label]:not([data-disabled]):hover{color:${t.fg}}[data-slot=collapsible-title]{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}[data-slot=collapsible-count]{color:${t.fg.muted};font-variant-numeric:tabular-nums;flex:none;font-size:12px;font-weight:400}[data-slot=collapsible-count]:is([data-variant=label]>*){color:${t.fg.faint};font-size:inherit;letter-spacing:0;font-weight:600}[data-slot~=collapsible-icon],[data-slot~=collapsible-chevron]{flex:none;width:1em;height:1em;font-size:16px;line-height:0}:is([data-slot~=collapsible-icon],[data-slot~=collapsible-chevron])>svg{width:100%;height:100%}[data-slot=collapsible-chevron]{color:${t.fg.muted};transition:transform ${t.dur.med} ease;font-size:14px}[data-slot=collapsible-chevron]:is([data-variant=default]>*){margin-inline-start:auto}[data-slot=collapsible-chevron]:is([data-variant=label]>*){color:inherit;font-size:12px}[data-slot=collapsible-chevron]:is([data-variant=default][data-state=open]>*){transform:rotate(180deg)}[data-slot=collapsible-chevron]:is([data-variant=label][data-state=closed]>*){transform:rotate(-90deg)}[data-slot=collapsible-chevron]:is([data-variant=label][data-state=closed]>*):is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){transform:rotate(90deg)}}`
22
+ );
23
+ var CollapsibleImpl = class {
24
+ constructor(props) {
25
+ this.props = props;
26
+ this.countEl = null;
27
+ this.onClick = () => {
28
+ if (this.disabled) return;
29
+ this.paint(!this.isOpen);
30
+ this.props.onOpenChange?.(this.isOpen);
31
+ };
32
+ injectStyles(document);
33
+ const variant = collapsibleVariants.resolve(props).variant;
34
+ this.isOpen = props.defaultOpen ?? false;
35
+ this.disabled = props.disabled ?? false;
36
+ const id = nextUid("vela-collapsible");
37
+ this.content = h("div", { slot: collapsibleDef.slot("content"), attrs: { id } });
38
+ if (props.content instanceof Node) this.content.appendChild(props.content);
39
+ else props.content?.(this.content);
40
+ this.own = !props.trigger;
41
+ if (props.trigger) {
42
+ this.trigger = props.trigger;
43
+ this.titleEl = null;
44
+ } else {
45
+ let icon = null;
46
+ if (props.icon) {
47
+ icon = iconEl(props.icon, document);
48
+ icon.dataset.slot = collapsibleDef.slot("icon");
49
+ }
50
+ const chevron = iconEl("chevron-down", document);
51
+ chevron.dataset.slot = collapsibleDef.slot("chevron");
52
+ this.titleEl = h("span", { slot: collapsibleDef.slot("title"), text: props.title ?? "" });
53
+ this.trigger = h(
54
+ "button",
55
+ { slot: collapsibleDef.slot("trigger"), data: { variant }, attrs: { type: "button" } },
56
+ variant === "label" ? chevron : null,
57
+ icon,
58
+ this.titleEl,
59
+ variant === "label" ? null : chevron
60
+ );
61
+ this.setCount(props.count ?? null);
62
+ }
63
+ this.trigger.setAttribute("aria-controls", id);
64
+ this.trigger.addEventListener("click", this.onClick);
65
+ this.el = h("div", { className: props.className, slot: collapsibleDef.slot("root"), data: { variant } }, this.own ? this.trigger : null, this.content);
66
+ this.paint(this.isOpen);
67
+ this.setDisabled(this.disabled);
68
+ }
69
+ get open() {
70
+ return this.isOpen;
71
+ }
72
+ setOpen(open) {
73
+ this.paint(open);
74
+ }
75
+ setTitle(title) {
76
+ if (this.titleEl) this.titleEl.textContent = title;
77
+ }
78
+ setCount(count) {
79
+ if (!this.own) return;
80
+ this.countEl?.remove();
81
+ this.countEl = count === null || count === "" ? null : h("span", { slot: collapsibleDef.slot("count"), text: String(count) });
82
+ if (this.countEl) this.titleEl.after(this.countEl);
83
+ }
84
+ setDisabled(disabled) {
85
+ this.disabled = disabled;
86
+ this.trigger.toggleAttribute("data-disabled", disabled);
87
+ if (this.trigger instanceof HTMLButtonElement) this.trigger.disabled = disabled;
88
+ else if (disabled) this.trigger.setAttribute("aria-disabled", "true");
89
+ else this.trigger.removeAttribute("aria-disabled");
90
+ }
91
+ destroy() {
92
+ this.trigger.removeEventListener("click", this.onClick);
93
+ }
94
+ paint(open) {
95
+ this.isOpen = open;
96
+ const state = open ? "open" : "closed";
97
+ this.trigger.setAttribute("aria-expanded", String(open));
98
+ for (const el of [this.trigger, this.content, this.el]) el?.setAttribute("data-state", state);
99
+ this.content.hidden = !open;
100
+ }
101
+ };
102
+ function createCollapsible(props = {}) {
103
+ return new CollapsibleImpl(props);
104
+ }
105
+
106
+ export { collapsibleDef, collapsibleVariants, createCollapsible };