@devalok/shilp-sutra 0.57.0 → 0.59.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/MIGRATION.md +91 -0
- package/dist/_chunks/badge-group.js +75 -188
- package/dist/_chunks/badge-group.js.map +1 -1
- package/dist/_chunks/chat.js +244 -243
- package/dist/_chunks/chat.js.map +1 -1
- package/dist/_chunks/image-preview.js +71 -70
- package/dist/_chunks/image-preview.js.map +1 -1
- package/dist/_chunks/motion-preference.js +15 -0
- package/dist/_chunks/motion-preference.js.map +1 -0
- package/dist/_chunks/motion-provider.js +1 -1
- package/dist/_chunks/motion-provider.js.map +1 -1
- package/dist/_chunks/popover.js +50 -49
- package/dist/_chunks/popover.js.map +1 -1
- package/dist/_chunks/primitives-internal.js +29 -29
- package/dist/_chunks/primitives-internal.js.map +1 -1
- package/dist/_chunks/shared.js +48 -47
- package/dist/_chunks/shared.js.map +1 -1
- package/dist/_chunks/success.js +34 -34
- package/dist/_chunks/tree-view.js +1 -1
- package/dist/_chunks/tree-view.js.map +1 -1
- package/dist/ai/block-renderer.js +8 -8
- package/dist/ai/command-bar.js +65 -65
- package/dist/ai/command-bar.js.map +1 -1
- package/dist/ai/conversation.js +35 -35
- package/dist/ai/conversation.js.map +1 -1
- package/dist/ai/index.js +4 -4
- package/dist/composed/activity-feed.d.ts.map +1 -1
- package/dist/composed/activity-feed.js +108 -107
- package/dist/composed/activity-feed.js.map +1 -1
- package/dist/composed/command-palette.js +137 -137
- package/dist/composed/command-palette.js.map +1 -1
- package/dist/composed/content-card.js +1 -1
- package/dist/composed/content-card.js.map +1 -1
- package/dist/composed/date-picker/index.js +5 -5
- package/dist/composed/date-picker/index.js.map +1 -1
- package/dist/composed/empty-state.js +4 -4
- package/dist/composed/file-preview/image-preview.d.ts.map +1 -1
- package/dist/composed/file-preview/shared.d.ts.map +1 -1
- package/dist/composed/file-preview/video-preview.d.ts.map +1 -1
- package/dist/composed/file-preview.js +151 -150
- package/dist/composed/file-preview.js.map +1 -1
- package/dist/composed/filter-bar.d.ts.map +1 -1
- package/dist/composed/filter-bar.js +53 -52
- package/dist/composed/filter-bar.js.map +1 -1
- package/dist/composed/form-section.d.ts.map +1 -1
- package/dist/composed/form-section.js +38 -37
- package/dist/composed/form-section.js.map +1 -1
- package/dist/composed/master-detail.d.ts.map +1 -1
- package/dist/composed/master-detail.js +1 -1
- package/dist/composed/master-detail.js.map +1 -1
- package/dist/composed/multi-select-popover.d.ts.map +1 -1
- package/dist/composed/multi-select-popover.js +109 -108
- package/dist/composed/multi-select-popover.js.map +1 -1
- package/dist/composed/rich-chat-input/attachment-strip.d.ts.map +1 -1
- package/dist/composed/rich-chat-input/reply-banner.d.ts.map +1 -1
- package/dist/composed/rich-chat-input/schedule-send.d.ts.map +1 -1
- package/dist/composed/rich-chat-input.d.ts.map +1 -1
- package/dist/composed/rich-chat-input.js +467 -466
- package/dist/composed/rich-chat-input.js.map +1 -1
- package/dist/composed/rich-text-editor.js +3 -3
- package/dist/composed/rich-text-editor.js.map +1 -1
- package/dist/composed/schedule-view.js +2 -2
- package/dist/composed/schedule-view.js.map +1 -1
- package/dist/composed/status-badge.d.ts.map +1 -1
- package/dist/composed/status-badge.js +29 -28
- package/dist/composed/status-badge.js.map +1 -1
- package/dist/motion/index.d.ts +1 -0
- package/dist/motion/index.d.ts.map +1 -1
- package/dist/motion/index.js +2 -15
- package/dist/motion/motion-preference.d.ts +36 -0
- package/dist/motion/motion-preference.d.ts.map +1 -0
- package/dist/motion/motion-provider.d.ts +2 -1
- package/dist/motion/motion-provider.d.ts.map +1 -1
- package/dist/motion/primitives-index.js +103 -102
- package/dist/motion/primitives-index.js.map +1 -1
- package/dist/motion/primitives.d.ts.map +1 -1
- package/dist/shell/bottom-navbar.js +19 -19
- package/dist/shell/bottom-navbar.js.map +1 -1
- package/dist/shell/index.d.ts +1 -1
- package/dist/shell/index.d.ts.map +1 -1
- package/dist/shell/notification-center.d.ts +17 -0
- package/dist/shell/notification-center.d.ts.map +1 -1
- package/dist/shell/notification-center.js +109 -104
- package/dist/shell/notification-center.js.map +1 -1
- package/dist/shell/notification-preferences.js +1 -1
- package/dist/shell/notification-preferences.js.map +1 -1
- package/dist/shell/top-bar.js +1 -1
- package/dist/shell/top-bar.js.map +1 -1
- package/dist/tokens/index.css +1 -0
- package/dist/tokens/palettes.css +292 -0
- package/dist/tokens/semantic.css +72 -8
- package/dist/tokens/shilp-sutra.css +1 -0
- package/dist/tokens/utilities.css +10 -7
- package/dist/ui/accordion.d.ts.map +1 -1
- package/dist/ui/accordion.js +27 -26
- package/dist/ui/accordion.js.map +1 -1
- package/dist/ui/alert-dialog.d.ts.map +1 -1
- package/dist/ui/alert-dialog.js +60 -59
- package/dist/ui/alert-dialog.js.map +1 -1
- package/dist/ui/alert.d.ts.map +1 -1
- package/dist/ui/alert.js +55 -113
- package/dist/ui/alert.js.map +1 -1
- package/dist/ui/autocomplete.js +80 -80
- package/dist/ui/autocomplete.js.map +1 -1
- package/dist/ui/avatar.d.ts.map +1 -1
- package/dist/ui/avatar.js +69 -68
- package/dist/ui/avatar.js.map +1 -1
- package/dist/ui/badge-indicator.d.ts +4 -8
- package/dist/ui/badge-indicator.d.ts.map +1 -1
- package/dist/ui/badge-indicator.js +3 -8
- package/dist/ui/badge-indicator.js.map +1 -1
- package/dist/ui/badge.d.ts +8 -1
- package/dist/ui/badge.d.ts.map +1 -1
- package/dist/ui/banner.d.ts.map +1 -1
- package/dist/ui/banner.js +42 -40
- package/dist/ui/banner.js.map +1 -1
- package/dist/ui/button-group.d.ts.map +1 -1
- package/dist/ui/button-group.js +3 -23
- package/dist/ui/button-group.js.map +1 -1
- package/dist/ui/button.d.ts +10 -1
- package/dist/ui/button.d.ts.map +1 -1
- package/dist/ui/button.js +79 -212
- package/dist/ui/button.js.map +1 -1
- package/dist/ui/card.d.ts.map +1 -1
- package/dist/ui/card.js +75 -72
- package/dist/ui/card.js.map +1 -1
- package/dist/ui/charts/radar-chart.d.ts.map +1 -1
- package/dist/ui/charts/radar-chart.js +1 -1
- package/dist/ui/charts/radar-chart.js.map +1 -1
- package/dist/ui/chat/message-list.d.ts.map +1 -1
- package/dist/ui/chat/message.d.ts.map +1 -1
- package/dist/ui/chat/typing-indicator.d.ts.map +1 -1
- package/dist/ui/code.js +1 -1
- package/dist/ui/code.js.map +1 -1
- package/dist/ui/color-input.d.ts.map +1 -1
- package/dist/ui/color-input.js +151 -150
- package/dist/ui/color-input.js.map +1 -1
- package/dist/ui/combobox.d.ts +14 -0
- package/dist/ui/combobox.d.ts.map +1 -1
- package/dist/ui/combobox.js +152 -148
- package/dist/ui/combobox.js.map +1 -1
- package/dist/ui/context-menu.d.ts.map +1 -1
- package/dist/ui/context-menu.js +70 -69
- package/dist/ui/context-menu.js.map +1 -1
- package/dist/ui/data-table-body.js +2 -2
- package/dist/ui/data-table-body.js.map +1 -1
- package/dist/ui/data-table-context.js +2 -2
- package/dist/ui/data-table-context.js.map +1 -1
- package/dist/ui/data-table-header.d.ts.map +1 -1
- package/dist/ui/data-table-header.js +41 -40
- package/dist/ui/data-table-header.js.map +1 -1
- package/dist/ui/data-table-pagination.js +2 -2
- package/dist/ui/data-table-pagination.js.map +1 -1
- package/dist/ui/dialog.d.ts.map +1 -1
- package/dist/ui/dialog.js +61 -60
- package/dist/ui/dialog.js.map +1 -1
- package/dist/ui/dot.d.ts.map +1 -1
- package/dist/ui/dot.js +10 -41
- package/dist/ui/dot.js.map +1 -1
- package/dist/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/ui/dropdown-menu.js +79 -78
- package/dist/ui/dropdown-menu.js.map +1 -1
- package/dist/ui/file-upload.d.ts.map +1 -1
- package/dist/ui/file-upload.js +116 -115
- package/dist/ui/file-upload.js.map +1 -1
- package/dist/ui/form.d.ts.map +1 -1
- package/dist/ui/form.js +27 -26
- package/dist/ui/form.js.map +1 -1
- package/dist/ui/hover-card.d.ts.map +1 -1
- package/dist/ui/hover-card.js +26 -25
- package/dist/ui/hover-card.js.map +1 -1
- package/dist/ui/icon.js +7 -7
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +3 -3
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/input.js +1 -1
- package/dist/ui/input.js.map +1 -1
- package/dist/ui/menubar.d.ts.map +1 -1
- package/dist/ui/menubar.js +73 -72
- package/dist/ui/menubar.js.map +1 -1
- package/dist/ui/navigation-menu.d.ts.map +1 -1
- package/dist/ui/navigation-menu.js +80 -79
- package/dist/ui/navigation-menu.js.map +1 -1
- package/dist/ui/popover.d.ts.map +1 -1
- package/dist/ui/progress.d.ts.map +1 -1
- package/dist/ui/progress.js +72 -68
- package/dist/ui/progress.js.map +1 -1
- package/dist/ui/radio.d.ts.map +1 -1
- package/dist/ui/radio.js +32 -31
- package/dist/ui/radio.js.map +1 -1
- package/dist/ui/search-input.d.ts.map +1 -1
- package/dist/ui/search-input.js +28 -27
- package/dist/ui/search-input.js.map +1 -1
- package/dist/ui/select.d.ts.map +1 -1
- package/dist/ui/select.js +64 -63
- package/dist/ui/select.js.map +1 -1
- package/dist/ui/sidebar.d.ts.map +1 -1
- package/dist/ui/sidebar.js +4 -4
- package/dist/ui/sidebar.js.map +1 -1
- package/dist/ui/slider.d.ts +63 -9
- package/dist/ui/slider.d.ts.map +1 -1
- package/dist/ui/slider.js +74 -32
- package/dist/ui/slider.js.map +1 -1
- package/dist/ui/split-button.d.ts +8 -2
- package/dist/ui/split-button.d.ts.map +1 -1
- package/dist/ui/split-button.js +49 -95
- package/dist/ui/split-button.js.map +1 -1
- package/dist/ui/stat-card.d.ts.map +1 -1
- package/dist/ui/stat-card.js +89 -88
- package/dist/ui/stat-card.js.map +1 -1
- package/dist/ui/stat-flash.js +16 -16
- package/dist/ui/stepper.d.ts.map +1 -1
- package/dist/ui/stepper.js +63 -62
- package/dist/ui/stepper.js.map +1 -1
- package/dist/ui/table.js +3 -3
- package/dist/ui/table.js.map +1 -1
- package/dist/ui/tabs.d.ts.map +1 -1
- package/dist/ui/tabs.js +67 -66
- package/dist/ui/tabs.js.map +1 -1
- package/dist/ui/textarea.js +1 -1
- package/dist/ui/textarea.js.map +1 -1
- package/dist/ui/toast.d.ts.map +1 -1
- package/dist/ui/toast.js +195 -194
- package/dist/ui/toast.js.map +1 -1
- package/dist/ui/toggle.d.ts.map +1 -1
- package/dist/ui/toggle.js +24 -22
- package/dist/ui/toggle.js.map +1 -1
- package/dist/ui/tooltip.d.ts.map +1 -1
- package/dist/ui/tooltip.js +37 -36
- package/dist/ui/tooltip.js.map +1 -1
- package/dist/ui/tree-view/tree-item.d.ts.map +1 -1
- package/docs/recipes/customize-brand.md +58 -0
- package/docs/recipes/install-astro.md +1 -1
- package/docs/recipes/install-next-app-router.md +1 -1
- package/docs/recipes/install-next-pages.md +22 -1
- package/docs/recipes/install-remix.md +1 -1
- package/docs/recipes/install-tanstack-start.md +1 -1
- package/docs/recipes/install-vite.md +2 -1
- package/docs/recipes/server-components.md +7 -4
- package/docs/recipes/troubleshoot.md +1 -0
- package/llms.txt +1 -1
- package/mcp-manifest.json +9 -4
- package/package.json +3 -2
- package/skill/SKILL.md +1 -1
- package/skill/references/components.md +1 -1
- package/skill/references/customize-brand.md +58 -0
- package/skill/references/server-components.md +7 -4
- package/skill/references/setup-astro.md +1 -1
- package/skill/references/setup-next-app-router.md +1 -1
- package/skill/references/setup-next-pages.md +22 -1
- package/skill/references/setup-remix.md +1 -1
- package/skill/references/setup-tanstack-start.md +1 -1
- package/skill/references/setup-vite.md +2 -1
- package/skill/references/troubleshoot.md +1 -0
- package/dist/motion/check-motion-provider.d.ts +0 -2
- package/dist/motion/check-motion-provider.d.ts.map +0 -1
- package/dist/motion/index.js.map +0 -1
package/dist/ui/slider.js
CHANGED
|
@@ -21,45 +21,87 @@ var u = l("relative w-full grow overflow-hidden rounded-pill bg-surface-panel-ho
|
|
|
21
21
|
lg: "h-8 w-8 border-[3px]"
|
|
22
22
|
},
|
|
23
23
|
color: {
|
|
24
|
-
accent: "border-
|
|
25
|
-
success: "border-
|
|
26
|
-
warning: "border-
|
|
27
|
-
error: "border-
|
|
24
|
+
accent: "border-palette-border-strong focus-visible:ring-palette-solid",
|
|
25
|
+
success: "border-palette-border-strong focus-visible:ring-palette-solid",
|
|
26
|
+
warning: "border-palette-border-strong focus-visible:ring-palette-solid",
|
|
27
|
+
error: "border-palette-border-strong focus-visible:ring-palette-solid"
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
defaultVariants: {
|
|
31
31
|
size: "md",
|
|
32
32
|
color: "accent"
|
|
33
33
|
}
|
|
34
|
-
}), f =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
let
|
|
34
|
+
}), f = "bg-palette-solid";
|
|
35
|
+
function p(e) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
p.displayName = "Slider.Mark";
|
|
39
|
+
function m(e, t) {
|
|
40
|
+
let n = [];
|
|
41
|
+
for (let t of e ?? []) n.push(typeof t == "number" ? { value: t } : t);
|
|
42
|
+
return o.Children.forEach(t, (e) => {
|
|
43
|
+
if (!o.isValidElement(e) || e.type !== p) return;
|
|
44
|
+
let t = e.props;
|
|
45
|
+
n.push({
|
|
46
|
+
value: t.value,
|
|
47
|
+
label: t.children ?? t.label
|
|
48
|
+
});
|
|
49
|
+
}), n.sort((e, t) => e.value - t.value);
|
|
50
|
+
}
|
|
51
|
+
var h = o.forwardRef(({ className: l, "aria-label": p, value: h, defaultValue: g, size: _ = "md", color: v = "accent", marks: y, showValue: b = !1, formatValue: x, children: S, ...C }, w) => {
|
|
52
|
+
let T = _ ?? "md", E = v ?? "accent", D = t(), O = D.state === "error", k = C["aria-describedby"] ?? D.helperTextId, A = C["aria-required"] ?? D.required, j = h ?? g ?? [0], M = j.length, N = C.min ?? 0, P = (C.max ?? 100) - N || 1, F = m(y, S), I = F.length > 0, L = b === !0 ? "always" : b || void 0, [R, z] = o.useState(j), B = h ?? R, V = o.useCallback((e) => {
|
|
53
|
+
z(e), C.onValueChange?.(e);
|
|
54
|
+
}, [C]), [H, U] = o.useState(!1), W = L === "always" || L === "interact" && H;
|
|
41
55
|
return /* @__PURE__ */ c(r, {
|
|
42
|
-
ref:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"aria-
|
|
47
|
-
"aria-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
ref: w,
|
|
57
|
+
"data-palette": E,
|
|
58
|
+
value: h,
|
|
59
|
+
defaultValue: g,
|
|
60
|
+
"aria-invalid": O || void 0,
|
|
61
|
+
"aria-describedby": k,
|
|
62
|
+
"aria-required": A || void 0,
|
|
63
|
+
className: e("relative flex w-full touch-none select-none items-center", I && "mb-ds-05", l),
|
|
64
|
+
...C,
|
|
65
|
+
onValueChange: V,
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ s(a, {
|
|
68
|
+
className: u({ size: T }),
|
|
69
|
+
children: /* @__PURE__ */ s(n, { className: e("absolute h-full", f) })
|
|
70
|
+
}),
|
|
71
|
+
I && /* @__PURE__ */ s("div", {
|
|
72
|
+
"aria-hidden": "true",
|
|
73
|
+
className: "pointer-events-none absolute inset-x-0 top-full",
|
|
74
|
+
children: F.map((e) => /* @__PURE__ */ c("div", {
|
|
75
|
+
className: "absolute flex -translate-x-1/2 flex-col items-center gap-ds-01",
|
|
76
|
+
style: { insetInlineStart: `${(e.value - N) / P * 100}%` },
|
|
77
|
+
children: [/* @__PURE__ */ s("span", { className: "h-ds-02 w-px bg-surface-border-strong" }), e.label !== null && /* @__PURE__ */ s("span", {
|
|
78
|
+
className: "text-label-xs text-surface-fg-subtle tabular-nums",
|
|
79
|
+
children: e.label ?? e.value
|
|
80
|
+
})]
|
|
81
|
+
}, e.value))
|
|
82
|
+
}),
|
|
83
|
+
Array.from({ length: M }, (t, n) => /* @__PURE__ */ s(i, {
|
|
84
|
+
onPointerDown: () => U(!0),
|
|
85
|
+
onPointerUp: () => U(!1),
|
|
86
|
+
onFocus: () => U(!0),
|
|
87
|
+
onBlur: () => U(!1),
|
|
88
|
+
"aria-label": M === 1 ? p : void 0,
|
|
89
|
+
"aria-labelledby": M === 1 && !p ? D.labelId : void 0,
|
|
90
|
+
className: d({
|
|
91
|
+
size: T,
|
|
92
|
+
color: E
|
|
93
|
+
}),
|
|
94
|
+
children: L && /* @__PURE__ */ s("span", {
|
|
95
|
+
"aria-hidden": "true",
|
|
96
|
+
"data-visible": W || void 0,
|
|
97
|
+
className: e("pointer-events-none absolute bottom-full left-1/2 mb-ds-02 -translate-x-1/2", "rounded-control-inner bg-palette-solid px-ds-02 py-ds-01", "text-label-xs tabular-nums text-palette-fg", "transition-opacity duration-fast-02 ease-productive-standard", "opacity-0 data-[visible]:opacity-100"),
|
|
98
|
+
children: x ? x(B[n]) : B[n]
|
|
99
|
+
})
|
|
100
|
+
}, n))
|
|
101
|
+
]
|
|
61
102
|
});
|
|
62
103
|
});
|
|
63
|
-
|
|
104
|
+
h.displayName = r.displayName;
|
|
105
|
+
var g = Object.assign(h, { Mark: p });
|
|
64
106
|
//#endregion
|
|
65
|
-
export {
|
|
107
|
+
export { g as Slider, d as sliderThumbVariants, u as sliderTrackVariants };
|
package/dist/ui/slider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slider.js","names":[],"sources":["../../src/ui/slider.tsx"],"sourcesContent":["'use client'\n\nimport * as SliderPrimitive from '@primitives/react-slider'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { useFormField } from './form'\nimport { cn } from './lib/utils'\n\nconst sliderTrackVariants = cva(\n 'relative w-full grow overflow-hidden rounded-pill bg-surface-panel-hover',\n {\n variants: {\n size: {\n sm: 'h-ds-02',\n md: 'h-ds-02b',\n lg: 'h-[10px]',\n },\n },\n defaultVariants: { size: 'md' },\n },\n)\n\nconst sliderThumbVariants = cva(\n 'touch-target block rounded-pill bg-surface-overlay shadow-raised transition-[color,transform,box-shadow] duration-fast-02 ease-productive-standard hover:shadow-raised-hover active:scale-[1.15] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-action-disabled',\n {\n variants: {\n size: {\n sm: 'h-4 w-4 border',\n md: 'h-6 w-6 border-2',\n lg: 'h-8 w-8 border-[3px]',\n },\n color: {\n accent: 'border-accent-7 focus-visible:ring-accent-9',\n success: 'border-success-7 focus-visible:ring-success-9',\n warning: 'border-warning-7 focus-visible:ring-warning-9',\n error: 'border-error-7 focus-visible:ring-error-9',\n },\n },\n defaultVariants: { size: 'md', color: 'accent' },\n },\n)\n\nconst sliderRangeColorMap: Record<string, string> = {\n accent: 'bg-accent-9',\n success: 'bg-success-9',\n warning: 'bg-warning-9',\n error: 'bg-error-9',\n}\n\nexport type SliderSize = NonNullable<VariantProps<typeof sliderTrackVariants>['size']>\nexport type SliderColor = NonNullable<VariantProps<typeof sliderThumbVariants>['color']>\n\nexport interface SliderProps\n extends Omit<React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root>, 'color'> {\n /** Size of the slider. Controls track height and thumb diameter. */\n size?: SliderSize\n /** Color of the range fill and thumb border. */\n color?: SliderColor\n}\n\n/**\n * A Radix-powered slider supporting single or multiple thumbs.\n *\n * Pass `defaultValue={[50]}` for a single thumb, or `defaultValue={[25, 75]}`\n * for a range slider with two thumbs. One `<Thumb>` is rendered per value entry.\n *\n * When using multiple thumbs, provide per-thumb labels via the `aria-label` array\n * on the `value`/`defaultValue` entries, or wrap each in a labelled form field.\n *\n * **Sizes:** `sm` | `md` (default) | `lg`\n *\n * **Colors:** `accent` (default) | `success` | `warning` | `error`\n */\nconst Slider = React.forwardRef<\n React.ElementRef<typeof SliderPrimitive.Root>,\n SliderProps\n>(({ className, 'aria-label': ariaLabel, value, defaultValue, size: sizeProp = 'md', color: colorProp = 'accent', ...props }, ref) => {\n const size = sizeProp ?? 'md'\n const color = colorProp ?? 'accent'\n const fieldCtx = useFormField()\n const isError = fieldCtx.state === 'error'\n const ariaDescribedBy = props['aria-describedby'] ?? fieldCtx.helperTextId\n const ariaRequired = props['aria-required'] ?? fieldCtx.required\n\n // Determine how many thumbs to render from controlled or default value\n const thumbCount = (value ?? defaultValue ?? [0]).length\n\n return (\n <SliderPrimitive.Root\n ref={ref}\n value={value}\n defaultValue={defaultValue}\n aria-invalid={isError || undefined}\n aria-describedby={ariaDescribedBy}\n aria-required={ariaRequired || undefined}\n className={cn(\n 'relative flex w-full touch-none select-none items-center',\n className,\n )}\n {...props}\n >\n <SliderPrimitive.Track className={sliderTrackVariants({ size })}>\n <SliderPrimitive.Range className={cn('absolute h-full', sliderRangeColorMap[color])} />\n </SliderPrimitive.Track>\n {Array.from({ length: thumbCount }, (_, i) => (\n <SliderPrimitive.Thumb\n key={i}\n aria-label={thumbCount === 1 ? (ariaLabel as string | undefined) : undefined}\n // `role=\"slider\"` lives on the THUMB, and Radix renders Root as a\n // <span> — not a labellable element — so `<Label htmlFor>` cannot name\n // this control the way it names Input/Select. Without an explicit\n // aria-label the thumb had NO accessible name even inside\n // FormField + Label. Point it at the field's label instead.\n //\n // Single-thumb only: with a range, one label cannot disambiguate the\n // two thumbs, so the consumer must name each (`aria-label` per thumb).\n aria-labelledby={\n thumbCount === 1 && !ariaLabel ? fieldCtx.labelId : undefined\n }\n className={sliderThumbVariants({ size, color })}\n />\n ))}\n </SliderPrimitive.Root>\n )\n})\nSlider.displayName = SliderPrimitive.Root.displayName\n\nexport { Slider, sliderThumbVariants,sliderTrackVariants }\n"],"mappings":";;;;;;;;AASA,IAAM,IAAsB,EAC1B,4EACA;CACE,UAAU,EACR,MAAM;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;CACN,EACF;CACA,iBAA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ources":["../../src/ui/slider.tsx"],"sourcesContent":["'use client'\n\nimport * as SliderPrimitive from '@primitives/react-slider'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { useFormField } from './form'\nimport { cn } from './lib/utils'\n\nconst sliderTrackVariants = cva(\n 'relative w-full grow overflow-hidden rounded-pill bg-surface-panel-hover',\n {\n variants: {\n size: {\n sm: 'h-ds-02',\n md: 'h-ds-02b',\n lg: 'h-[10px]',\n },\n },\n defaultVariants: { size: 'md' },\n },\n)\n\nconst sliderThumbVariants = cva(\n 'touch-target block rounded-pill bg-surface-overlay shadow-raised transition-[color,transform,box-shadow] duration-fast-02 ease-productive-standard hover:shadow-raised-hover active:scale-[1.15] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-action-disabled',\n {\n variants: {\n size: {\n sm: 'h-4 w-4 border',\n md: 'h-6 w-6 border-2',\n lg: 'h-8 w-8 border-[3px]',\n },\n // The thumb keeps the OLD step-7 edge while every container in the system\n // moved to step 4. PALETTE-EDGE-WHISPER was reasoned about card edges —\n // an object you are meant to notice but not look at. A slider handle is\n // the opposite: it is the thing you aim at, and it is the only part of the\n // control that moves. Step 4 measured 1.37–1.49:1 against white; step 7 is\n // 2.31–2.86:1. Recorded as SLIDER-THUMB-EDGE-STEP-7 in the register.\n color: {\n accent: 'border-palette-border-strong focus-visible:ring-palette-solid',\n success: 'border-palette-border-strong focus-visible:ring-palette-solid',\n warning: 'border-palette-border-strong focus-visible:ring-palette-solid',\n error: 'border-palette-border-strong focus-visible:ring-palette-solid',\n },\n },\n defaultVariants: { size: 'md', color: 'accent' },\n },\n)\n\n/** The filled portion of the track — one role for every colour. */\nconst SLIDER_RANGE_FILL = 'bg-palette-solid'\n\nexport type SliderSize = NonNullable<VariantProps<typeof sliderTrackVariants>['size']>\nexport type SliderColor = NonNullable<VariantProps<typeof sliderThumbVariants>['color']>\n\n/** One tick on the scale. A bare number is shorthand for `{ value: n, label: n }`. */\nexport interface SliderMark {\n /** Position on the scale, in the slider's own units (between `min` and `max`). */\n value: number\n /**\n * What to print under the tick. Defaults to the value itself. Pass `null`\n * for a tick with no caption.\n */\n label?: React.ReactNode\n}\n\nexport interface SliderMarkProps extends SliderMark {\n /** Caption for this tick. Overrides `label`. */\n children?: React.ReactNode\n}\n\n/**\n * A single tick, as a child of `Slider`.\n *\n * ```tsx\n * <Slider>\n * <Slider.Mark value={30}>Launch</Slider.Mark>\n * </Slider>\n * ```\n *\n * Never rendered directly — `Slider` reads the props off it and draws the tick\n * itself, because a tick has to be positioned against the track. Returning\n * `null` keeps it out of the DOM if someone renders one outside a Slider.\n */\nfunction SliderMarkComponent(_props: SliderMarkProps): React.ReactElement | null {\n return null\n}\nSliderMarkComponent.displayName = 'Slider.Mark'\n\nexport interface SliderProps\n extends Omit<React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root>, 'color'> {\n /** Size of the slider. Controls track height and thumb diameter. */\n size?: SliderSize\n /** Color of the range fill and thumb border. */\n color?: SliderColor\n /**\n * Tick marks along the scale. Numbers are shorthand, so\n * `marks={[0, 50, 100]}` is the common case in one line. For custom captions\n * use objects, or the `Slider.Mark` children form.\n */\n marks?: Array<number | SliderMark>\n /**\n * Show the current value in a bubble above the thumb.\n *\n * - `false` (default) — no bubble.\n * - `'always'` — always visible.\n * - `'interact'` — only while the thumb is focused or being dragged, which\n * keeps a dense form quiet until someone is actually using the control.\n *\n * `true` is accepted as an alias for `'always'`.\n */\n showValue?: boolean | 'always' | 'interact'\n /** Format the bubble's text. Defaults to the raw number. */\n formatValue?: (value: number) => React.ReactNode\n}\n\n/** Normalise the two authoring forms into one list, sorted by position. */\nfunction collectMarks(\n marks: SliderProps['marks'],\n children: React.ReactNode,\n): SliderMark[] {\n const out: SliderMark[] = []\n for (const m of marks ?? []) {\n out.push(typeof m === 'number' ? { value: m } : m)\n }\n React.Children.forEach(children, (child) => {\n if (!React.isValidElement(child) || child.type !== SliderMarkComponent) return\n const p = child.props as SliderMarkProps\n out.push({ value: p.value, label: p.children ?? p.label })\n })\n return out.sort((a, b) => a.value - b.value)\n}\n\n/**\n * A Radix-powered slider supporting single or multiple thumbs.\n *\n * Pass `defaultValue={[50]}` for a single thumb, or `defaultValue={[25, 75]}`\n * for a range slider with two thumbs. One `<Thumb>` is rendered per value entry.\n *\n * When using multiple thumbs, provide per-thumb labels via the `aria-label` array\n * on the `value`/`defaultValue` entries, or wrap each in a labelled form field.\n *\n * **Sizes:** `sm` | `md` (default) | `lg`\n *\n * **Colors:** `accent` (default) | `success` | `warning` | `error`\n */\nconst SliderRoot = React.forwardRef<\n React.ElementRef<typeof SliderPrimitive.Root>,\n SliderProps\n>(({ className, 'aria-label': ariaLabel, value, defaultValue, size: sizeProp = 'md', color: colorProp = 'accent', marks, showValue = false, formatValue, children, ...props }, ref) => {\n const size = sizeProp ?? 'md'\n const color = colorProp ?? 'accent'\n const fieldCtx = useFormField()\n const isError = fieldCtx.state === 'error'\n const ariaDescribedBy = props['aria-describedby'] ?? fieldCtx.helperTextId\n const ariaRequired = props['aria-required'] ?? fieldCtx.required\n\n // Determine how many thumbs to render from controlled or default value\n const resolvedValue = value ?? defaultValue ?? [0]\n const thumbCount = resolvedValue.length\n\n const min = props.min ?? 0\n const max = props.max ?? 100\n const span = max - min || 1\n\n const allMarks = collectMarks(marks, children)\n const hasMarks = allMarks.length > 0\n const bubble = showValue === true ? 'always' : showValue || undefined\n\n // Uncontrolled sliders move without re-rendering us, so the bubble has to\n // track the primitive's own state rather than the `value` prop.\n const [liveValues, setLiveValues] = React.useState<number[]>(resolvedValue)\n const shownValues = value ?? liveValues\n const handleValueChange = React.useCallback(\n (next: number[]) => {\n setLiveValues(next)\n props.onValueChange?.(next)\n },\n [props],\n )\n const [interacting, setInteracting] = React.useState(false)\n const bubbleVisible = bubble === 'always' || (bubble === 'interact' && interacting)\n\n return (\n <SliderPrimitive.Root\n ref={ref}\n // One palette for the whole control, so the track fill and the thumb\n // edge can never disagree.\n data-palette={color}\n value={value}\n defaultValue={defaultValue}\n aria-invalid={isError || undefined}\n aria-describedby={ariaDescribedBy}\n aria-required={ariaRequired || undefined}\n className={cn(\n 'relative flex w-full touch-none select-none items-center',\n // Ticks sit under the track, so the control needs room for them or the\n // captions collide with whatever follows in the form.\n hasMarks && 'mb-ds-05',\n className,\n )}\n {...props}\n onValueChange={handleValueChange}\n >\n <SliderPrimitive.Track className={sliderTrackVariants({ size })}>\n <SliderPrimitive.Range className={cn('absolute h-full', SLIDER_RANGE_FILL)} />\n </SliderPrimitive.Track>\n\n {/* Ticks. Decorative — the value is already announced by the thumb's\n role=\"slider\", so a screen reader reading these too would just be\n noise. */}\n {hasMarks && (\n <div aria-hidden=\"true\" className=\"pointer-events-none absolute inset-x-0 top-full\">\n {allMarks.map((m) => (\n <div\n key={m.value}\n className=\"absolute flex -translate-x-1/2 flex-col items-center gap-ds-01\"\n style={{ insetInlineStart: `${((m.value - min) / span) * 100}%` }}\n >\n <span className=\"h-ds-02 w-px bg-surface-border-strong\" />\n {m.label !== null && (\n <span className=\"text-label-xs text-surface-fg-subtle tabular-nums\">\n {m.label ?? m.value}\n </span>\n )}\n </div>\n ))}\n </div>\n )}\n\n {Array.from({ length: thumbCount }, (_, i) => (\n <SliderPrimitive.Thumb\n key={i}\n onPointerDown={() => setInteracting(true)}\n onPointerUp={() => setInteracting(false)}\n onFocus={() => setInteracting(true)}\n onBlur={() => setInteracting(false)}\n aria-label={thumbCount === 1 ? (ariaLabel as string | undefined) : undefined}\n // `role=\"slider\"` lives on the THUMB, and Radix renders Root as a\n // <span> — not a labellable element — so `<Label htmlFor>` cannot name\n // this control the way it names Input/Select. Without an explicit\n // aria-label the thumb had NO accessible name even inside\n // FormField + Label. Point it at the field's label instead.\n //\n // Single-thumb only: with a range, one label cannot disambiguate the\n // two thumbs, so the consumer must name each (`aria-label` per thumb).\n aria-labelledby={\n thumbCount === 1 && !ariaLabel ? fieldCtx.labelId : undefined\n }\n className={sliderThumbVariants({ size, color })}\n >\n {/* Rendered INSIDE the thumb so it tracks the handle for free —\n positioning a sibling would mean duplicating Radix's own maths and\n re-deriving it on every drag. */}\n {bubble && (\n <span\n aria-hidden=\"true\"\n data-visible={bubbleVisible || undefined}\n className={cn(\n 'pointer-events-none absolute bottom-full left-1/2 mb-ds-02 -translate-x-1/2',\n 'rounded-control-inner bg-palette-solid px-ds-02 py-ds-01',\n 'text-label-xs tabular-nums text-palette-fg',\n 'transition-opacity duration-fast-02 ease-productive-standard',\n 'opacity-0 data-[visible]:opacity-100',\n )}\n >\n {formatValue ? formatValue(shownValues[i]) : shownValues[i]}\n </span>\n )}\n </SliderPrimitive.Thumb>\n ))}\n </SliderPrimitive.Root>\n )\n})\nSliderRoot.displayName = SliderPrimitive.Root.displayName\n\n/**\n * Slider with an optional scale.\n *\n * Two ways to declare ticks, because the common case should be one line and the\n * custom case should still be possible:\n *\n * ```tsx\n * <Slider marks={[0, 25, 50, 75, 100]} />\n *\n * <Slider showValue=\"interact\">\n * <Slider.Mark value={0}>Off</Slider.Mark>\n * <Slider.Mark value={80}>Recommended</Slider.Mark>\n * </Slider>\n * ```\n */\nconst Slider = Object.assign(SliderRoot, { Mark: SliderMarkComponent })\n\n// The Mark component is reached as `Slider.Mark`, not exported standalone — a\n// second export named SliderMark would collide with the SliderMark interface,\n// which is the more useful public name (it types the `marks` prop).\nexport { Slider, sliderThumbVariants,sliderTrackVariants }\n"],"mappings":";;;;;;;;AASA,IAAM,IAAsB,EAC1B,4EACA;CACE,UAAU,EACR,MAAM;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;CACN,EACF;CACA,iBAAiB,EAAE,MAAM,KAAK;AAChC,CACF,GAEM,IAAsB,EAC1B,gVACA;CACE,UAAU;EACR,MAAM;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;EACN;EAOA,OAAO;GACL,QAAQ;GACR,SAAS;GACT,SAAS;GACT,OAAO;EACT;CACF;CACA,iBAAiB;EAAE,MAAM;EAAM,OAA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AEa,GArChB,CAqCgB,CACxB;EACmB;;AAE1B,CAAC;AACD,EAAW,cAAA,EAAmC;AAiB9C,IAAM,IAAS,OAAO,OAAO,GAAY,EAAE,MAAM,EAAoB,CAAC"}
|
|
@@ -29,8 +29,14 @@ export interface SplitButtonProps {
|
|
|
29
29
|
onOpenChange?: (open: boolean) => void;
|
|
30
30
|
/** @default 'solid' */
|
|
31
31
|
variant?: SplitButtonVariant;
|
|
32
|
-
/**
|
|
33
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Palette name. The six built-ins are unchanged; any palette registered in
|
|
34
|
+
* CSS (`[data-palette='…']`) now works too. Widened from a closed union, so
|
|
35
|
+
* every existing value still type-checks.
|
|
36
|
+
*
|
|
37
|
+
* @default 'accent'
|
|
38
|
+
*/
|
|
39
|
+
color?: SplitButtonColor | (string & {});
|
|
34
40
|
/** @default 'md' */
|
|
35
41
|
size?: SplitButtonSize;
|
|
36
42
|
/** Disable both halves. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split-button.d.ts","sourceRoot":"","sources":["../../src/ui/split-button.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAMzC;;;;;;;;;;GAUG;AACH,MAAM,MAAM,oBAAoB,GAC5B,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GACnC,WAAW,GAAG,SAAS,GACvB,aAAa,GAAG,WAAW,GAC3B,cAAc,GAAG,YAAY,GAC7B,YAAY,GAAG,UAAU,CAAA;AAE7B,KAAK,kBAAkB,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAA;AACtD,KAAK,gBAAgB,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,cAAc,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;AACjF,KAAK,eAAe,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
5
|
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
6
6
|
//#region src/ui/split-button.tsx
|
|
7
7
|
var c = {
|
|
8
|
-
solid:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
success: "bg-success-11/20",
|
|
12
|
-
warning: "bg-warning-11/20",
|
|
13
|
-
info: "bg-info-11/20",
|
|
14
|
-
neutral: "bg-neutral-8/30"
|
|
15
|
-
},
|
|
16
|
-
soft: {
|
|
17
|
-
accent: "bg-accent-6",
|
|
18
|
-
error: "bg-error-6",
|
|
19
|
-
success: "bg-success-6",
|
|
20
|
-
warning: "bg-warning-6",
|
|
21
|
-
info: "bg-info-6",
|
|
22
|
-
neutral: "bg-surface-border"
|
|
23
|
-
},
|
|
24
|
-
outline: {
|
|
25
|
-
accent: "bg-accent-7",
|
|
26
|
-
error: "bg-error-7",
|
|
27
|
-
success: "bg-success-7",
|
|
28
|
-
warning: "bg-warning-7",
|
|
29
|
-
info: "bg-info-7",
|
|
30
|
-
neutral: "bg-surface-border-strong"
|
|
31
|
-
}
|
|
8
|
+
solid: "bg-palette-solid-active/20",
|
|
9
|
+
soft: "bg-palette-border-subtle",
|
|
10
|
+
outline: "bg-palette-border"
|
|
32
11
|
}, l = {
|
|
12
|
+
solid: "bg-neutral-8/30",
|
|
13
|
+
soft: "bg-surface-border"
|
|
14
|
+
}, u = {
|
|
33
15
|
xs: "h-ds-xs-plus",
|
|
34
16
|
sm: "h-ds-sm",
|
|
35
17
|
md: "h-ds-md",
|
|
36
18
|
"icon-xs": "h-ds-xs-plus",
|
|
37
19
|
"icon-sm": "h-ds-sm",
|
|
38
20
|
"icon-md": "h-ds-md"
|
|
39
|
-
},
|
|
21
|
+
}, d = {
|
|
40
22
|
xs: "text-body-sm",
|
|
41
23
|
sm: "text-body-sm",
|
|
42
24
|
md: "text-body-md",
|
|
43
25
|
"icon-xs": "text-body-sm",
|
|
44
26
|
"icon-sm": "text-body-sm",
|
|
45
27
|
"icon-md": "text-body-md"
|
|
46
|
-
},
|
|
28
|
+
}, f = {
|
|
47
29
|
xs: "px-ds-03 gap-1",
|
|
48
30
|
sm: "px-ds-04 gap-1.5",
|
|
49
31
|
md: "px-ds-05 gap-2",
|
|
50
32
|
"icon-xs": "px-ds-02",
|
|
51
33
|
"icon-sm": "px-ds-03",
|
|
52
34
|
"icon-md": "px-ds-04"
|
|
53
|
-
},
|
|
35
|
+
}, p = {
|
|
54
36
|
xs: "px-ds-02",
|
|
55
37
|
sm: "px-ds-02",
|
|
56
38
|
md: "px-ds-03",
|
|
57
39
|
"icon-xs": "px-ds-01",
|
|
58
40
|
"icon-sm": "px-ds-02",
|
|
59
41
|
"icon-md": "px-ds-02"
|
|
60
|
-
},
|
|
42
|
+
}, m = {
|
|
61
43
|
xs: "rounded-control",
|
|
62
44
|
sm: "rounded-control",
|
|
63
45
|
md: "rounded-control",
|
|
64
46
|
"icon-xs": "rounded-control",
|
|
65
47
|
"icon-sm": "rounded-control",
|
|
66
48
|
"icon-md": "rounded-control"
|
|
49
|
+
}, h = {
|
|
50
|
+
solid: "bg-palette-solid text-palette-fg hover:bg-palette-solid-hover active:bg-palette-solid-active",
|
|
51
|
+
soft: "bg-palette-soft text-palette-text hover:bg-palette-soft-hover active:bg-palette-soft-active",
|
|
52
|
+
outline: "bg-transparent text-palette-text hover:bg-palette-soft active:bg-palette-soft-hover"
|
|
67
53
|
};
|
|
68
|
-
function
|
|
69
|
-
let n =
|
|
70
|
-
|
|
71
|
-
accent: "bg-accent-9 text-accent-fg hover:bg-accent-10 active:bg-accent-11",
|
|
72
|
-
error: "bg-error-9 text-error-fg hover:bg-error-10 active:bg-error-11",
|
|
73
|
-
success: "bg-success-9 text-success-fg hover:bg-success-10 active:bg-success-11",
|
|
74
|
-
warning: "bg-warning-9 text-warning-fg hover:bg-warning-10 active:bg-warning-11",
|
|
75
|
-
info: "bg-info-9 text-info-fg hover:bg-info-10 active:bg-info-11",
|
|
76
|
-
neutral: "bg-neutral-5 text-surface-fg hover:bg-neutral-7 active:bg-neutral-8"
|
|
77
|
-
},
|
|
78
|
-
soft: {
|
|
79
|
-
accent: "bg-accent-3 text-accent-11 hover:bg-accent-4 active:bg-accent-5",
|
|
80
|
-
error: "bg-error-3 text-error-11 hover:bg-error-4 active:bg-error-5",
|
|
81
|
-
success: "bg-success-3 text-success-11 hover:bg-success-4 active:bg-success-5",
|
|
82
|
-
warning: "bg-warning-3 text-warning-11 hover:bg-warning-4 active:bg-warning-5",
|
|
83
|
-
info: "bg-info-3 text-info-11 hover:bg-info-4 active:bg-info-5",
|
|
84
|
-
neutral: "bg-surface-panel-hover text-surface-fg-muted hover:bg-surface-panel-active active:bg-neutral-5"
|
|
85
|
-
},
|
|
86
|
-
outline: {
|
|
87
|
-
accent: "bg-transparent text-accent-11 hover:bg-accent-3 active:bg-accent-4",
|
|
88
|
-
error: "bg-transparent text-error-11 hover:bg-error-3 active:bg-error-4",
|
|
89
|
-
success: "bg-transparent text-success-11 hover:bg-success-3 active:bg-success-4",
|
|
90
|
-
warning: "bg-transparent text-warning-11 hover:bg-warning-3 active:bg-warning-4",
|
|
91
|
-
info: "bg-transparent text-info-11 hover:bg-info-3 active:bg-info-4",
|
|
92
|
-
neutral: "bg-transparent text-surface-fg hover:bg-surface-panel-hover active:bg-surface-panel-active"
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
return n[e][t] ?? n[e].accent;
|
|
54
|
+
function g(e, t) {
|
|
55
|
+
let n = e === "outline" && t === "neutral" ? " text-surface-fg" : "";
|
|
56
|
+
return h[e] + n;
|
|
96
57
|
}
|
|
97
|
-
function
|
|
98
|
-
|
|
99
|
-
accent: "border-accent-7",
|
|
100
|
-
error: "border-error-7",
|
|
101
|
-
success: "border-success-7",
|
|
102
|
-
warning: "border-warning-7",
|
|
103
|
-
info: "border-info-7",
|
|
104
|
-
neutral: "border-surface-border-interactive"
|
|
105
|
-
};
|
|
106
|
-
return t[e] ?? t.accent;
|
|
58
|
+
function _(e) {
|
|
59
|
+
return e === "neutral" ? "border-surface-border-interactive" : "border-palette-border";
|
|
107
60
|
}
|
|
108
|
-
function
|
|
61
|
+
function v({ className: e }) {
|
|
109
62
|
return /* @__PURE__ */ o("svg", {
|
|
110
63
|
width: "12",
|
|
111
64
|
height: "12",
|
|
@@ -122,53 +75,54 @@ function g({ className: e }) {
|
|
|
122
75
|
})
|
|
123
76
|
});
|
|
124
77
|
}
|
|
125
|
-
var
|
|
126
|
-
let [
|
|
127
|
-
let [e, t] =
|
|
78
|
+
var y = i.forwardRef(function({ children: h, onClick: y, dropdownContent: b, open: x, onOpenChange: S, variant: C = "solid", color: w = "accent", size: T = "md", disabled: E = !1, "aria-label": D, dropdownLabel: O = "More options", dropdownIcon: k, triggerSide: A = "right", placement: j = "top-end", triggerWidth: M, className: N }, P) {
|
|
79
|
+
let [F, I] = i.useMemo(() => {
|
|
80
|
+
let [e, t] = j.split("-");
|
|
128
81
|
return [e, t === "start" ? "start" : t === "end" ? "end" : "center"];
|
|
129
|
-
}, [
|
|
82
|
+
}, [j]), L = g(C, w), R = (w === "neutral" ? l[C] : void 0) ?? c[C], z = M == null ? void 0 : { width: typeof M == "number" ? `${M}px` : M }, B = /* @__PURE__ */ o(r, {
|
|
130
83
|
asChild: !0,
|
|
131
84
|
children: /* @__PURE__ */ o("button", {
|
|
132
85
|
type: "button",
|
|
133
|
-
disabled:
|
|
134
|
-
"aria-label":
|
|
135
|
-
className: e("inline-flex items-center justify-center select-none", "transition-colors duration-fast-01 ease-productive-standard", "focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-inset", "disabled:pointer-events-none disabled:opacity-action-disabled",
|
|
136
|
-
style:
|
|
137
|
-
children:
|
|
86
|
+
disabled: E,
|
|
87
|
+
"aria-label": O,
|
|
88
|
+
className: e("inline-flex items-center justify-center select-none", "transition-colors duration-fast-01 ease-productive-standard", "focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-inset", "disabled:pointer-events-none disabled:opacity-action-disabled", L, u[T], p[T]),
|
|
89
|
+
style: z,
|
|
90
|
+
children: k ?? /* @__PURE__ */ o(v, {})
|
|
138
91
|
})
|
|
139
92
|
});
|
|
140
93
|
return /* @__PURE__ */ s(t, {
|
|
141
|
-
open:
|
|
142
|
-
onOpenChange:
|
|
94
|
+
open: x,
|
|
95
|
+
onOpenChange: S,
|
|
143
96
|
children: [/* @__PURE__ */ o("div", {
|
|
144
|
-
ref:
|
|
97
|
+
ref: P,
|
|
145
98
|
role: "group",
|
|
146
|
-
"aria-label":
|
|
147
|
-
|
|
99
|
+
"aria-label": D ?? void 0,
|
|
100
|
+
"data-palette": w,
|
|
101
|
+
className: e("relative inline-flex", N),
|
|
148
102
|
children: /* @__PURE__ */ s("div", {
|
|
149
|
-
className: e("inline-flex items-stretch overflow-hidden",
|
|
103
|
+
className: e("inline-flex items-stretch overflow-hidden", m[T], C === "solid" && "shadow-raised", C === "outline" && `border ${_(w)}`),
|
|
150
104
|
children: [
|
|
151
|
-
|
|
105
|
+
A === "left" && /* @__PURE__ */ s(a, { children: [B, /* @__PURE__ */ o("div", { className: e("w-px self-stretch", R) })] }),
|
|
152
106
|
/* @__PURE__ */ o("button", {
|
|
153
107
|
type: "button",
|
|
154
|
-
onClick:
|
|
155
|
-
disabled:
|
|
156
|
-
"aria-label":
|
|
157
|
-
className: e("inline-flex items-center justify-center font-semibold select-none whitespace-nowrap", "transition-[colors,transform] duration-fast-01 ease-productive-standard", "active:scale-[0.97]", "focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-inset", "disabled:pointer-events-none disabled:opacity-action-disabled",
|
|
158
|
-
children:
|
|
108
|
+
onClick: y,
|
|
109
|
+
disabled: E,
|
|
110
|
+
"aria-label": D,
|
|
111
|
+
className: e("inline-flex items-center justify-center font-semibold select-none whitespace-nowrap", "transition-[colors,transform] duration-fast-01 ease-productive-standard", "active:scale-[0.97]", "focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-inset", "disabled:pointer-events-none disabled:opacity-action-disabled", L, u[T], d[T], f[T]),
|
|
112
|
+
children: h
|
|
159
113
|
}),
|
|
160
|
-
|
|
114
|
+
A === "right" && /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("div", { className: e("w-px self-stretch", R) }), B] })
|
|
161
115
|
]
|
|
162
116
|
})
|
|
163
|
-
}),
|
|
164
|
-
side:
|
|
165
|
-
align:
|
|
117
|
+
}), b && /* @__PURE__ */ o(n, {
|
|
118
|
+
side: F,
|
|
119
|
+
align: I,
|
|
166
120
|
sideOffset: 8,
|
|
167
121
|
className: "w-auto min-w-[10rem] p-ds-01",
|
|
168
|
-
children:
|
|
122
|
+
children: b
|
|
169
123
|
})]
|
|
170
124
|
});
|
|
171
125
|
});
|
|
172
|
-
|
|
126
|
+
y.displayName = "SplitButton";
|
|
173
127
|
//#endregion
|
|
174
|
-
export {
|
|
128
|
+
export { y as SplitButton };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split-button.js","names":[],"sources":["../../src/ui/split-button.tsx"],"sourcesContent":["'use client'\n\nimport { type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { buttonVariants } from './button'\nimport { cn } from './lib/utils'\nimport { Popover, PopoverContent, PopoverTrigger } from './popover'\n\n// ── Types ───────────────────────────────────────────────────────\n\n/**\n * Placement of the dropdown panel, in floating-ui's vocabulary.\n *\n * Declared here rather than imported from `@floating-ui/dom`: that package is\n * bundled into dist at runtime but is NOT a consumer dependency, so a type\n * import leaks an unresolvable specifier into the published .d.ts —\n * `error TS2307: Cannot find module '@floating-ui/dom'` for anyone type-checking\n * declarations. The union is stable and two lines; borrowing it is not worth an\n * install. (This component no longer calls floating-ui at all — see the Radix\n * Popover mapping below.)\n */\nexport type SplitButtonPlacement =\n | 'top' | 'right' | 'bottom' | 'left'\n | 'top-start' | 'top-end'\n | 'right-start' | 'right-end'\n | 'bottom-start' | 'bottom-end'\n | 'left-start' | 'left-end'\n\ntype SplitButtonVariant = 'solid' | 'soft' | 'outline'\ntype SplitButtonColor = NonNullable<VariantProps<typeof buttonVariants>['color']>\ntype SplitButtonSize = 'xs' | 'sm' | 'md' | 'icon-xs' | 'icon-sm' | 'icon-md'\n\nexport interface SplitButtonProps {\n /** Primary action content (left side). */\n children: React.ReactNode\n /** Primary click handler (left side). */\n onClick: (e: React.MouseEvent<HTMLButtonElement>) => void\n /** Content rendered inside the floating dropdown panel. */\n dropdownContent?: React.ReactNode\n /** Controlled open state. */\n open?: boolean\n /** Called when open state changes. Uncontrolled if omitted. */\n onOpenChange?: (open: boolean) => void\n /** @default 'solid' */\n variant?: SplitButtonVariant\n /** @default 'accent' */\n color?: SplitButtonColor\n /** @default 'md' */\n size?: SplitButtonSize\n /** Disable both halves. */\n disabled?: boolean\n /** aria-label for the primary button. */\n 'aria-label'?: string\n /** aria-label for the dropdown trigger. @default 'More options' */\n dropdownLabel?: string\n /** Custom icon for the dropdown trigger. Defaults to chevron-down. */\n dropdownIcon?: React.ReactNode\n /** Which side the dropdown trigger sits on. @default 'right' */\n triggerSide?: 'left' | 'right'\n /** Preferred placement for the dropdown panel. @default 'top-end' */\n placement?: SplitButtonPlacement\n /** Width of the trigger (chevron) half. @default 'auto' */\n triggerWidth?: number | string\n className?: string\n}\n\n// ── Styling maps ────────────────────────────────────────────────\n\nconst dividerColor: Record<SplitButtonVariant, Record<string, string>> = {\n solid: {\n accent: 'bg-accent-11/20', error: 'bg-error-11/20', success: 'bg-success-11/20',\n warning: 'bg-warning-11/20', info: 'bg-info-11/20', neutral: 'bg-neutral-8/30',\n },\n soft: {\n accent: 'bg-accent-6', error: 'bg-error-6', success: 'bg-success-6',\n warning: 'bg-warning-6', info: 'bg-info-6', neutral: 'bg-surface-border',\n },\n outline: {\n accent: 'bg-accent-7', error: 'bg-error-7', success: 'bg-success-7',\n warning: 'bg-warning-7', info: 'bg-info-7', neutral: 'bg-surface-border-strong',\n },\n}\n\nconst heightClass: Record<SplitButtonSize, string> = {\n xs: 'h-ds-xs-plus', sm: 'h-ds-sm', md: 'h-ds-md',\n 'icon-xs': 'h-ds-xs-plus', 'icon-sm': 'h-ds-sm', 'icon-md': 'h-ds-md',\n}\n\nconst textClass: Record<SplitButtonSize, string> = {\n xs: 'text-body-sm', sm: 'text-body-sm', md: 'text-body-md',\n 'icon-xs': 'text-body-sm', 'icon-sm': 'text-body-sm', 'icon-md': 'text-body-md',\n}\n\nconst primaryPadding: Record<SplitButtonSize, string> = {\n xs: 'px-ds-03 gap-1', sm: 'px-ds-04 gap-1.5', md: 'px-ds-05 gap-2',\n 'icon-xs': 'px-ds-02', 'icon-sm': 'px-ds-03', 'icon-md': 'px-ds-04',\n}\n\nconst triggerPadding: Record<SplitButtonSize, string> = {\n xs: 'px-ds-02', sm: 'px-ds-02', md: 'px-ds-03',\n 'icon-xs': 'px-ds-01', 'icon-sm': 'px-ds-02', 'icon-md': 'px-ds-02',\n}\n\nconst radiusClass: Record<SplitButtonSize, string> = {\n xs: 'rounded-control', sm: 'rounded-control', md: 'rounded-control',\n 'icon-xs': 'rounded-control', 'icon-sm': 'rounded-control', 'icon-md': 'rounded-control',\n}\n\nfunction getHalfClasses(variant: SplitButtonVariant, color: string): string {\n const map: Record<SplitButtonVariant, Record<string, string>> = {\n solid: {\n accent: 'bg-accent-9 text-accent-fg hover:bg-accent-10 active:bg-accent-11',\n error: 'bg-error-9 text-error-fg hover:bg-error-10 active:bg-error-11',\n success: 'bg-success-9 text-success-fg hover:bg-success-10 active:bg-success-11',\n warning: 'bg-warning-9 text-warning-fg hover:bg-warning-10 active:bg-warning-11',\n info: 'bg-info-9 text-info-fg hover:bg-info-10 active:bg-info-11',\n neutral: 'bg-neutral-5 text-surface-fg hover:bg-neutral-7 active:bg-neutral-8',\n },\n soft: {\n accent: 'bg-accent-3 text-accent-11 hover:bg-accent-4 active:bg-accent-5',\n error: 'bg-error-3 text-error-11 hover:bg-error-4 active:bg-error-5',\n success: 'bg-success-3 text-success-11 hover:bg-success-4 active:bg-success-5',\n warning: 'bg-warning-3 text-warning-11 hover:bg-warning-4 active:bg-warning-5',\n info: 'bg-info-3 text-info-11 hover:bg-info-4 active:bg-info-5',\n neutral: 'bg-surface-panel-hover text-surface-fg-muted hover:bg-surface-panel-active active:bg-neutral-5',\n },\n outline: {\n accent: 'bg-transparent text-accent-11 hover:bg-accent-3 active:bg-accent-4',\n error: 'bg-transparent text-error-11 hover:bg-error-3 active:bg-error-4',\n success: 'bg-transparent text-success-11 hover:bg-success-3 active:bg-success-4',\n warning: 'bg-transparent text-warning-11 hover:bg-warning-3 active:bg-warning-4',\n info: 'bg-transparent text-info-11 hover:bg-info-3 active:bg-info-4',\n neutral: 'bg-transparent text-surface-fg hover:bg-surface-panel-hover active:bg-surface-panel-active',\n },\n }\n return map[variant][color] ?? map[variant].accent\n}\n\nfunction getOutlineBorderColor(color: string): string {\n const map: Record<string, string> = {\n accent: 'border-accent-7', error: 'border-error-7', success: 'border-success-7',\n warning: 'border-warning-7', info: 'border-info-7', neutral: 'border-surface-border-interactive',\n }\n return map[color] ?? map.accent\n}\n\n// ── Chevron SVG ─────────────────────────────────────────────────\n\nfunction ChevronDown({ className }: { className?: string }) {\n return (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\" className={className} aria-hidden=\"true\">\n <path d=\"M3 4.5L6 7.5L9 4.5\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n )\n}\n\n// ── Component ───────────────────────────────────────────────────\n\nconst SplitButton = React.forwardRef<HTMLDivElement, SplitButtonProps>(\n function SplitButton(\n {\n children,\n onClick,\n dropdownContent,\n open: openProp,\n onOpenChange,\n variant = 'solid',\n color = 'accent',\n size = 'md',\n disabled = false,\n 'aria-label': ariaLabel,\n dropdownLabel = 'More options',\n dropdownIcon,\n triggerSide = 'right',\n placement: placementProp = 'top-end',\n triggerWidth,\n className,\n },\n ref,\n ) {\n // Map the floating-ui `placement` (e.g. 'top-end') to Radix side + align.\n // Positioning, focus-in/return, outside-click, and Escape all come from the\n // Popover primitive now — no hand-rolled floating-ui / listeners.\n const [side, align] = React.useMemo(() => {\n const [s, a] = placementProp.split('-')\n return [\n s as 'top' | 'right' | 'bottom' | 'left',\n (a === 'start' ? 'start' : a === 'end' ? 'end' : 'center') as\n | 'start'\n | 'center'\n | 'end',\n ]\n }, [placementProp])\n\n const halfClasses = getHalfClasses(variant, color)\n const divider = dividerColor[variant][color] ?? dividerColor[variant].accent\n\n const triggerStyle = triggerWidth != null\n ? { width: typeof triggerWidth === 'number' ? `${triggerWidth}px` : triggerWidth }\n : undefined\n\n // Dropdown trigger (the chevron half). PopoverTrigger wires aria-haspopup /\n // aria-expanded / focus-return for us.\n const dropdownTrigger = (\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n disabled={disabled}\n aria-label={dropdownLabel}\n className={cn(\n 'inline-flex items-center justify-center select-none',\n 'transition-colors duration-fast-01 ease-productive-standard',\n 'focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-inset',\n 'disabled:pointer-events-none disabled:opacity-action-disabled',\n halfClasses,\n heightClass[size],\n triggerPadding[size],\n )}\n style={triggerStyle}\n >\n {dropdownIcon ?? <ChevronDown />}\n </button>\n </PopoverTrigger>\n )\n\n return (\n <Popover open={openProp} onOpenChange={onOpenChange}>\n {/* Button group */}\n <div\n ref={ref}\n role=\"group\"\n aria-label={ariaLabel ?? undefined}\n className={cn('relative inline-flex', className)}\n >\n <div\n className={cn(\n 'inline-flex items-stretch overflow-hidden',\n radiusClass[size],\n variant === 'solid' && 'shadow-raised',\n variant === 'outline' && `border ${getOutlineBorderColor(color)}`,\n )}\n >\n {triggerSide === 'left' && (\n <>\n {dropdownTrigger}\n <div className={cn('w-px self-stretch', divider)} />\n </>\n )}\n\n {/* Primary action */}\n <button\n type=\"button\"\n onClick={onClick}\n disabled={disabled}\n aria-label={ariaLabel}\n className={cn(\n 'inline-flex items-center justify-center font-semibold select-none whitespace-nowrap',\n 'transition-[colors,transform] duration-fast-01 ease-productive-standard',\n 'active:scale-[0.97]',\n 'focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-inset',\n 'disabled:pointer-events-none disabled:opacity-action-disabled',\n halfClasses,\n heightClass[size],\n textClass[size],\n primaryPadding[size],\n )}\n >\n {children}\n </button>\n\n {triggerSide === 'right' && (\n <>\n <div className={cn('w-px self-stretch', divider)} />\n {dropdownTrigger}\n </>\n )}\n </div>\n </div>\n\n {/* Dropdown panel — Popover handles focus, Escape, outside-click, return */}\n {dropdownContent && (\n <PopoverContent\n side={side}\n align={align}\n sideOffset={8}\n className=\"w-auto min-w-[10rem] p-ds-01\"\n >\n {dropdownContent}\n </PopoverContent>\n )}\n </Popover>\n )\n },\n)\n\nSplitButton.displayName = 'SplitButton'\n\nexport { SplitButton }\nexport type { SplitButtonColor, SplitButtonSize,SplitButtonVariant }\n"],"mappings":";;;;;;AAqEA,IAAM,IAAmE;CACvE,OAAO;EACL,QAAQ;EAAmB,OAAO;EAAkB,SAAS;EAC7D,SAAS;EAAoB,MAAM;EAAiB,SAAS;CAC/D;CACA,MAAM;EACJ,QAAQ;EAAe,OAAO;EAAc,SAAS;EACrD,SAAS;EAAgB,MAAM;EAAa,SAAS;CACvD;CACA,SAAS;EACP,QAAQ;EAAe,OAAO;EAAc,SAAS;EACrD,SAAS;EAAgB,MAAM;EAAa,SAAS;CACvD;AACF,GAEM,IAA+C;CACnD,IAAI;CAAgB,IAAI;CAAW,IAAI;CACvC,WAAW;CAAgB,WAAW;CAAW,WAAW;AAC9D,GAEM,IAA6C;CACjD,IAAI;CAAgB,IAAI;CAAgB,IAAI;CAC5C,WAAW;CAAgB,WAAW;CAAgB,WAAW;AACnE,GAEM,IAAkD;CACtD,IAAI;CAAkB,IAAI;CAAoB,IAAI;CAClD,WAAW;CAAY,WAAW;CAAY,WAAW;AAC3D,GAE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AAD;GACQ;GACC;GACP,YAAY;GACZ,WAAU;aAET;EACa,CAAA,CAEX;;AAEb,CACF;AAEA,EAAY,cAAc"}
|
|
1
|
+
{"version":3,"file":"split-button.js","names":[],"sources":["../../src/ui/split-button.tsx"],"sourcesContent":["'use client'\n\nimport { type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { buttonVariants } from './button'\nimport { cn } from './lib/utils'\nimport { Popover, PopoverContent, PopoverTrigger } from './popover'\n\n// ── Types ───────────────────────────────────────────────────────\n\n/**\n * Placement of the dropdown panel, in floating-ui's vocabulary.\n *\n * Declared here rather than imported from `@floating-ui/dom`: that package is\n * bundled into dist at runtime but is NOT a consumer dependency, so a type\n * import leaks an unresolvable specifier into the published .d.ts —\n * `error TS2307: Cannot find module '@floating-ui/dom'` for anyone type-checking\n * declarations. The union is stable and two lines; borrowing it is not worth an\n * install. (This component no longer calls floating-ui at all — see the Radix\n * Popover mapping below.)\n */\nexport type SplitButtonPlacement =\n | 'top' | 'right' | 'bottom' | 'left'\n | 'top-start' | 'top-end'\n | 'right-start' | 'right-end'\n | 'bottom-start' | 'bottom-end'\n | 'left-start' | 'left-end'\n\ntype SplitButtonVariant = 'solid' | 'soft' | 'outline'\ntype SplitButtonColor = NonNullable<VariantProps<typeof buttonVariants>['color']>\ntype SplitButtonSize = 'xs' | 'sm' | 'md' | 'icon-xs' | 'icon-sm' | 'icon-md'\n\nexport interface SplitButtonProps {\n /** Primary action content (left side). */\n children: React.ReactNode\n /** Primary click handler (left side). */\n onClick: (e: React.MouseEvent<HTMLButtonElement>) => void\n /** Content rendered inside the floating dropdown panel. */\n dropdownContent?: React.ReactNode\n /** Controlled open state. */\n open?: boolean\n /** Called when open state changes. Uncontrolled if omitted. */\n onOpenChange?: (open: boolean) => void\n /** @default 'solid' */\n variant?: SplitButtonVariant\n /**\n * Palette name. The six built-ins are unchanged; any palette registered in\n * CSS (`[data-palette='…']`) now works too. Widened from a closed union, so\n * every existing value still type-checks.\n *\n * @default 'accent'\n */\n color?: SplitButtonColor | (string & {})\n /** @default 'md' */\n size?: SplitButtonSize\n /** Disable both halves. */\n disabled?: boolean\n /** aria-label for the primary button. */\n 'aria-label'?: string\n /** aria-label for the dropdown trigger. @default 'More options' */\n dropdownLabel?: string\n /** Custom icon for the dropdown trigger. Defaults to chevron-down. */\n dropdownIcon?: React.ReactNode\n /** Which side the dropdown trigger sits on. @default 'right' */\n triggerSide?: 'left' | 'right'\n /** Preferred placement for the dropdown panel. @default 'top-end' */\n placement?: SplitButtonPlacement\n /** Width of the trigger (chevron) half. @default 'auto' */\n triggerWidth?: number | string\n className?: string\n}\n\n// ── Styling maps ────────────────────────────────────────────────\n\n// The hairline between the two halves. One line per variant instead of one\n// per variant × colour — the hue arrives via `data-palette` on the group.\nconst dividerColor: Record<SplitButtonVariant, string> = {\n solid: 'bg-palette-solid-active/20',\n soft: 'bg-palette-border-subtle',\n outline: 'bg-palette-border',\n}\n\n// `neutral` diverges from the roles here, and both cases predate this work:\n// its solid divider is 30% rather than 20% (a flat grey needs more presence\n// than a saturated one to read at 1px), and its soft divider sits on\n// `surface-border` rather than the subtle tier the role resolves to.\nconst neutralDivider: Partial<Record<SplitButtonVariant, string>> = {\n solid: 'bg-neutral-8/30',\n soft: 'bg-surface-border',\n}\n\nconst heightClass: Record<SplitButtonSize, string> = {\n xs: 'h-ds-xs-plus', sm: 'h-ds-sm', md: 'h-ds-md',\n 'icon-xs': 'h-ds-xs-plus', 'icon-sm': 'h-ds-sm', 'icon-md': 'h-ds-md',\n}\n\nconst textClass: Record<SplitButtonSize, string> = {\n xs: 'text-body-sm', sm: 'text-body-sm', md: 'text-body-md',\n 'icon-xs': 'text-body-sm', 'icon-sm': 'text-body-sm', 'icon-md': 'text-body-md',\n}\n\nconst primaryPadding: Record<SplitButtonSize, string> = {\n xs: 'px-ds-03 gap-1', sm: 'px-ds-04 gap-1.5', md: 'px-ds-05 gap-2',\n 'icon-xs': 'px-ds-02', 'icon-sm': 'px-ds-03', 'icon-md': 'px-ds-04',\n}\n\nconst triggerPadding: Record<SplitButtonSize, string> = {\n xs: 'px-ds-02', sm: 'px-ds-02', md: 'px-ds-03',\n 'icon-xs': 'px-ds-01', 'icon-sm': 'px-ds-02', 'icon-md': 'px-ds-02',\n}\n\nconst radiusClass: Record<SplitButtonSize, string> = {\n xs: 'rounded-control', sm: 'rounded-control', md: 'rounded-control',\n 'icon-xs': 'rounded-control', 'icon-sm': 'rounded-control', 'icon-md': 'rounded-control',\n}\n\n// Three lines, not eighteen. Colour comes from `data-palette`.\nconst halfClasses: Record<SplitButtonVariant, string> = {\n solid:\n 'bg-palette-solid text-palette-fg hover:bg-palette-solid-hover active:bg-palette-solid-active',\n soft: 'bg-palette-soft text-palette-text hover:bg-palette-soft-hover active:bg-palette-soft-active',\n outline:\n 'bg-transparent text-palette-text hover:bg-palette-soft active:bg-palette-soft-hover',\n}\n\nfunction getHalfClasses(variant: SplitButtonVariant, color: string): string {\n // Same exception Button carries: on neutral, an outlined control's label\n // wants full contrast rather than the muted text role.\n const neutralOutline = variant === 'outline' && color === 'neutral' ? ' text-surface-fg' : ''\n return halfClasses[variant] + neutralOutline\n}\n\nfunction getOutlineBorderColor(color: string): string {\n // An outlined control's edge owes WCAG 1.4.11, so neutral takes the\n // interactive border tier rather than the decorative one the role resolves\n // to. The chromatic palettes already satisfy it from their own ramp.\n return color === 'neutral' ? 'border-surface-border-interactive' : 'border-palette-border'\n}\n\n// ── Chevron SVG ─────────────────────────────────────────────────\n\nfunction ChevronDown({ className }: { className?: string }) {\n return (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\" className={className} aria-hidden=\"true\">\n <path d=\"M3 4.5L6 7.5L9 4.5\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n )\n}\n\n// ── Component ───────────────────────────────────────────────────\n\nconst SplitButton = React.forwardRef<HTMLDivElement, SplitButtonProps>(\n function SplitButton(\n {\n children,\n onClick,\n dropdownContent,\n open: openProp,\n onOpenChange,\n variant = 'solid',\n color = 'accent',\n size = 'md',\n disabled = false,\n 'aria-label': ariaLabel,\n dropdownLabel = 'More options',\n dropdownIcon,\n triggerSide = 'right',\n placement: placementProp = 'top-end',\n triggerWidth,\n className,\n },\n ref,\n ) {\n // Map the floating-ui `placement` (e.g. 'top-end') to Radix side + align.\n // Positioning, focus-in/return, outside-click, and Escape all come from the\n // Popover primitive now — no hand-rolled floating-ui / listeners.\n const [side, align] = React.useMemo(() => {\n const [s, a] = placementProp.split('-')\n return [\n s as 'top' | 'right' | 'bottom' | 'left',\n (a === 'start' ? 'start' : a === 'end' ? 'end' : 'center') as\n | 'start'\n | 'center'\n | 'end',\n ]\n }, [placementProp])\n\n const halfClassNames = getHalfClasses(variant, color)\n const divider =\n (color === 'neutral' ? neutralDivider[variant] : undefined) ?? dividerColor[variant]\n\n const triggerStyle = triggerWidth != null\n ? { width: typeof triggerWidth === 'number' ? `${triggerWidth}px` : triggerWidth }\n : undefined\n\n // Dropdown trigger (the chevron half). PopoverTrigger wires aria-haspopup /\n // aria-expanded / focus-return for us.\n const dropdownTrigger = (\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n disabled={disabled}\n aria-label={dropdownLabel}\n className={cn(\n 'inline-flex items-center justify-center select-none',\n 'transition-colors duration-fast-01 ease-productive-standard',\n 'focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-inset',\n 'disabled:pointer-events-none disabled:opacity-action-disabled',\n halfClassNames,\n heightClass[size],\n triggerPadding[size],\n )}\n style={triggerStyle}\n >\n {dropdownIcon ?? <ChevronDown />}\n </button>\n </PopoverTrigger>\n )\n\n return (\n <Popover open={openProp} onOpenChange={onOpenChange}>\n {/* Button group */}\n <div\n ref={ref}\n role=\"group\"\n aria-label={ariaLabel ?? undefined}\n // One palette for the whole group: both halves and the hairline\n // between them inherit it, so they can never disagree.\n data-palette={color}\n className={cn('relative inline-flex', className)}\n >\n <div\n className={cn(\n 'inline-flex items-stretch overflow-hidden',\n radiusClass[size],\n variant === 'solid' && 'shadow-raised',\n variant === 'outline' && `border ${getOutlineBorderColor(color)}`,\n )}\n >\n {triggerSide === 'left' && (\n <>\n {dropdownTrigger}\n <div className={cn('w-px self-stretch', divider)} />\n </>\n )}\n\n {/* Primary action */}\n <button\n type=\"button\"\n onClick={onClick}\n disabled={disabled}\n aria-label={ariaLabel}\n className={cn(\n 'inline-flex items-center justify-center font-semibold select-none whitespace-nowrap',\n 'transition-[colors,transform] duration-fast-01 ease-productive-standard',\n 'active:scale-[0.97]',\n 'focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-inset',\n 'disabled:pointer-events-none disabled:opacity-action-disabled',\n halfClassNames,\n heightClass[size],\n textClass[size],\n primaryPadding[size],\n )}\n >\n {children}\n </button>\n\n {triggerSide === 'right' && (\n <>\n <div className={cn('w-px self-stretch', divider)} />\n {dropdownTrigger}\n </>\n )}\n </div>\n </div>\n\n {/* Dropdown panel — Popover handles focus, Escape, outside-click, return */}\n {dropdownContent && (\n <PopoverContent\n side={side}\n align={align}\n sideOffset={8}\n className=\"w-auto min-w-[10rem] p-ds-01\"\n >\n {dropdownContent}\n </PopoverContent>\n )}\n </Popover>\n )\n },\n)\n\nSplitButton.displayName = 'SplitButton'\n\nexport { SplitButton }\nexport type { SplitButtonColor, SplitButtonSize,SplitButtonVariant }\n"],"mappings":";;;;;;AA6EA,IAAM,IAAmD;CACvD,OAAO;CACP,MAAM;CACN,SAAS;AACX,GAMM,IAA8D;CAClE,OAAO;CACP,MAAM;AACR,GAEM,IAA+C;CACnD,IAAI;CAAgB,IAAI;CAAW,IAAI;CACvC,WAAW;CAAgB,WAAW;CAAW,WAAW;AAC9D,GAEM,IAA6C;CACjD,IAAI;CAAgB,IAAI;CAAgB,IAAI;CAC5C,WAAW;CAAgB,WAAW;CAAgB,WAAW;AACnE,GAEM,IAAkD;CACtD,IAAI;CAAkB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A,EAAE,OAAO,OAAO,KAAiB,WAAW,GAAG,EAAa,MAAM,EAAa,GAK7E,IACJ,kBAAC,GAAD;EAAgB,SAAA;YACd,kBAAC,UAAD;GACE,MAAK;GACK;GACV,cAAY;GACZ,WAAW,EACT,uDACA,+DACA,0GACA,iEACA,GACA,EAAY,IACZ,EAAe,EACjB;GACA,OAAO;aAEN,KAAgB,kBAAC,GAAD,CAAc,CAAA;EACzB,CAAA;CACM,CAAA;CAGlB,OACE,kBAAC,GAAD;EAAS,MAAM;EAAwB;YAAvC,CAEE,kBAAC,OAAD;GACO;GACL,MAAK;GACL,cAAY,KAAa,KAAA;GAGzB,gBAAc;GACd,WAAW,EAAG,wBAAwB,CAAS;aAE/C,kBAAC,OAAD;IACE,WAAW,EACT,6CACA,EAAY,IACZ,MAAY,WAAW,iBACvB,MAAY,aAAa,UAAU,EAAsB,CAAK,GAChE;cANF;KAQG,MAAgB,UACf,kBAAA,GAAA,EAAA,UAAA,CACG,GACD,kBAAC,OAAD,EAAK,WAAW,EAAG,qBAAqB,CAAO,EAAI,CAAA,CACnD,EAAA,CAAA;KAIJ,kBAAC,UAAD;MACE,MAAK;MACI;MACC;MACV,cAAY;MACZ,WAAW,EACT,uFACA,2EACA,uBACA,0GACA,iEACA,GACA,EAAY,IACZ,EAAU,IACV,EAAe,EACjB;MAEC;KACK,CAAA;KAEP,MAAgB,WACf,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,OAAD,EAAK,WAAW,EAAG,qBAAqB,CAAO,EAAI,CAAA,GAClD,CACD,EAAA,CAAA;IAED;;EACF,CAAA,GAGJ,KACC,kBAAC,GAAD;GACQ;GACC;GACP,YAAY;GACZ,WAAU;aAET;EACa,CAAA,CAEX;;AAEb,CACF;AAEA,EAAY,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stat-card.d.ts","sourceRoot":"","sources":["../../src/ui/stat-card.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAA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