@humain/ui 2.2.6 → 2.2.9
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/dist/index101.js +2 -2
- package/dist/index101.js.map +1 -1
- package/dist/index103.js +3 -3
- package/dist/index103.js.map +1 -1
- package/dist/index108.js +1 -1
- package/dist/index108.js.map +1 -1
- package/dist/index117.js +1 -1
- package/dist/index117.js.map +1 -1
- package/dist/index122.js +6 -6
- package/dist/index122.js.map +1 -1
- package/dist/index126.js +1 -1
- package/dist/index126.js.map +1 -1
- package/dist/index130.js +2 -2
- package/dist/index130.js.map +1 -1
- package/dist/index146.js +4 -4
- package/dist/index146.js.map +1 -1
- package/dist/index152.js +1 -1
- package/dist/index152.js.map +1 -1
- package/dist/index154.js +2 -2
- package/dist/index154.js.map +1 -1
- package/dist/index166.js +1 -1
- package/dist/index166.js.map +1 -1
- package/dist/index168.js +1 -1
- package/dist/index168.js.map +1 -1
- package/dist/index169.js +1 -1
- package/dist/index169.js.map +1 -1
- package/dist/index173.js +2 -2
- package/dist/index173.js.map +1 -1
- package/dist/index175.js +4 -4
- package/dist/index175.js.map +1 -1
- package/dist/index176.js +2 -2
- package/dist/index176.js.map +1 -1
- package/dist/index177.js +2 -2
- package/dist/index177.js.map +1 -1
- package/dist/index184.js +1 -1
- package/dist/index184.js.map +1 -1
- package/dist/index191.js +3 -3
- package/dist/index191.js.map +1 -1
- package/dist/index192.js +2 -2
- package/dist/index192.js.map +1 -1
- package/dist/index201.js +2 -2
- package/dist/index201.js.map +1 -1
- package/dist/index204.js +4 -4
- package/dist/index204.js.map +1 -1
- package/dist/index228.js +1 -1
- package/dist/index228.js.map +1 -1
- package/dist/index229.js +1 -1
- package/dist/index229.js.map +1 -1
- package/dist/index24.js +2 -2
- package/dist/index24.js.map +1 -1
- package/dist/index5.js +1 -1
- package/dist/index5.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/wc/AICodeBlock.js +41 -41
- package/dist/wc/AICodeBlock.js.map +1 -1
- package/dist/wc/AIMermaidDiagram.js +7 -7
- package/dist/wc/AIMermaidDiagram.js.map +1 -1
- package/dist/wc/AIMessage.js +6 -6
- package/dist/wc/AIMessage.js.map +1 -1
- package/dist/wc/AISource.js +2 -2
- package/dist/wc/AISource.js.map +1 -1
- package/dist/wc/AIToolCall.js +1 -1
- package/dist/wc/AIToolCall.js.map +1 -1
- package/dist/wc/Breadcrumb.js +43 -43
- package/dist/wc/Breadcrumb.js.map +1 -1
- package/dist/wc/DropdownMenu.js +9 -9
- package/dist/wc/DropdownMenu.js.map +1 -1
- package/dist/wc/Kbd.js +22 -22
- package/dist/wc/Kbd.js.map +1 -1
- package/dist/wc/button.js +7 -7
- package/dist/wc/button.js.map +1 -1
- package/dist/wc/close-button.js +19 -19
- package/dist/wc/close-button.js.map +1 -1
- package/dist/wc/hf-ai-prompt-suggestion.js +14 -14
- package/dist/wc/hf-ai-prompt-suggestion.js.map +1 -1
- package/dist/wc/hf-ai-reasoning-block.js +13 -13
- package/dist/wc/hf-ai-reasoning-block.js.map +1 -1
- package/dist/wc/hf-ai-steps.js +53 -53
- package/dist/wc/hf-ai-steps.js.map +1 -1
- package/dist/wc/hf-ai-system-message.js +26 -26
- package/dist/wc/hf-ai-system-message.js.map +1 -1
- package/dist/wc/hf-code-snippet.js +35 -35
- package/dist/wc/hf-code-snippet.js.map +1 -1
- package/dist/wc/hf-command-menu.js +39 -39
- package/dist/wc/hf-command-menu.js.map +1 -1
- package/dist/wc/hf-data-table.js +3 -3
- package/dist/wc/hf-data-table.js.map +1 -1
- package/dist/wc/hf-display-value.js +50 -50
- package/dist/wc/hf-display-value.js.map +1 -1
- package/dist/wc/hf-nav-account-menu.js +5 -5
- package/dist/wc/hf-nav-account-menu.js.map +1 -1
- package/dist/wc/hf-rich-textarea.js +1 -1
- package/dist/wc/hf-rich-textarea.js.map +1 -1
- package/dist/wc/hf-steps.js +8 -8
- package/dist/wc/hf-steps.js.map +1 -1
- package/dist/wc/markdown-renderer.js +1 -1
- package/dist/wc/markdown-renderer.js.map +1 -1
- package/dist/wc/selection-group.js +26 -26
- package/dist/wc/selection-group.js.map +1 -1
- package/dist/wc/syntax-highlight.js +4 -4
- package/dist/wc/syntax-highlight.js.map +1 -1
- package/dist/wc/workflow-step-renderer.js +51 -51
- package/dist/wc/workflow-step-renderer.js.map +1 -1
- package/dist/wc-react/AICodeBlock.js +17 -17
- package/dist/wc-react/AICodeBlock.js.map +1 -1
- package/dist/wc-react/AIMermaidDiagram.js +16 -16
- package/dist/wc-react/AIMermaidDiagram.js.map +1 -1
- package/dist/wc-react/AIMessage.js +7 -7
- package/dist/wc-react/AIMessage.js.map +1 -1
- package/dist/wc-react/AISource.js +41 -41
- package/dist/wc-react/AISource.js.map +1 -1
- package/dist/wc-react/AIToolCall.js +6 -6
- package/dist/wc-react/AIToolCall.js.map +1 -1
- package/dist/wc-react/Breadcrumb.js +18 -18
- package/dist/wc-react/Breadcrumb.js.map +1 -1
- package/dist/wc-react/DropdownMenu.js +27 -27
- package/dist/wc-react/DropdownMenu.js.map +1 -1
- package/dist/wc-react/Kbd.js +17 -17
- package/dist/wc-react/Kbd.js.map +1 -1
- package/dist/wc-react/button.js +12 -12
- package/dist/wc-react/button.js.map +1 -1
- package/dist/wc-react/close-button.js +19 -19
- package/dist/wc-react/close-button.js.map +1 -1
- package/dist/wc-react/hf-ai-prompt-suggestion.js +1 -1
- package/dist/wc-react/hf-ai-prompt-suggestion.js.map +1 -1
- package/dist/wc-react/hf-ai-reasoning-block.js +1 -1
- package/dist/wc-react/hf-ai-reasoning-block.js.map +1 -1
- package/dist/wc-react/hf-ai-steps.js +33 -33
- package/dist/wc-react/hf-ai-steps.js.map +1 -1
- package/dist/wc-react/hf-ai-system-message.js +9 -9
- package/dist/wc-react/hf-ai-system-message.js.map +1 -1
- package/dist/wc-react/hf-code-snippet.js +3 -3
- package/dist/wc-react/hf-code-snippet.js.map +1 -1
- package/dist/wc-react/hf-command-menu.js +56 -56
- package/dist/wc-react/hf-command-menu.js.map +1 -1
- package/dist/wc-react/hf-data-table.js +3 -3
- package/dist/wc-react/hf-data-table.js.map +1 -1
- package/dist/wc-react/hf-display-value.js +58 -58
- package/dist/wc-react/hf-display-value.js.map +1 -1
- package/dist/wc-react/hf-nav-account-menu.js +7 -7
- package/dist/wc-react/hf-nav-account-menu.js.map +1 -1
- package/dist/wc-react/hf-rich-textarea.js +5 -5
- package/dist/wc-react/hf-rich-textarea.js.map +1 -1
- package/dist/wc-react/hf-steps.js +2 -2
- package/dist/wc-react/hf-steps.js.map +1 -1
- package/dist/wc-react/markdown-renderer.js +1 -1
- package/dist/wc-react/markdown-renderer.js.map +1 -1
- package/dist/wc-react/selection-group.js +7 -7
- package/dist/wc-react/selection-group.js.map +1 -1
- package/dist/wc-react/syntax-highlight.js +4 -4
- package/dist/wc-react/syntax-highlight.js.map +1 -1
- package/dist/wc-react/workflow-step-renderer.js +44 -44
- package/dist/wc-react/workflow-step-renderer.js.map +1 -1
- package/package.json +1 -1
- package/skills/humain-ui/SKILL.md +1 -1
- package/skills/humain-ui-wc/SKILL.md +1 -1
- package/skills/humain-ui-wc.skill +0 -0
- package/skills/humain-ui.skill +0 -0
- package/src/tokens.css +4 -0
|
@@ -5,20 +5,20 @@ import { t as y } from "./minus.js";
|
|
|
5
5
|
import { t as b } from "./dist.js";
|
|
6
6
|
var u = /* @__PURE__ */ p(v(), 1), i = h();
|
|
7
7
|
function E(a = {}) {
|
|
8
|
-
const { value:
|
|
9
|
-
return [c ?
|
|
10
|
-
c || t(n),
|
|
11
|
-
}, [c,
|
|
8
|
+
const { value: e, defaultValue: o, onValueChange: r } = a, [d, t] = u.useState(o), c = e !== void 0;
|
|
9
|
+
return [c ? e : d, u.useCallback((n) => {
|
|
10
|
+
c || t(n), r?.(n);
|
|
11
|
+
}, [c, r])];
|
|
12
12
|
}
|
|
13
13
|
function F(a = {}) {
|
|
14
|
-
const { value:
|
|
14
|
+
const { value: e, defaultValue: o = [], onValueChange: r } = a, [d, t] = u.useState(o), c = e !== void 0, n = c ? e : d;
|
|
15
15
|
return [n, u.useCallback((l, f) => {
|
|
16
|
-
const
|
|
17
|
-
c || t(
|
|
16
|
+
const m = f ? [...n, l] : n.filter((x) => x !== l);
|
|
17
|
+
c || t(m), r?.(m);
|
|
18
18
|
}, [
|
|
19
19
|
c,
|
|
20
20
|
n,
|
|
21
|
-
|
|
21
|
+
r
|
|
22
22
|
])];
|
|
23
23
|
}
|
|
24
24
|
var k = {
|
|
@@ -102,7 +102,7 @@ var k = {
|
|
|
102
102
|
sm: "text-sm",
|
|
103
103
|
md: "text-sm",
|
|
104
104
|
lg: "text-base"
|
|
105
|
-
},
|
|
105
|
+
}, g = {
|
|
106
106
|
sm: "size-3",
|
|
107
107
|
md: "size-3.5",
|
|
108
108
|
lg: "size-4"
|
|
@@ -119,27 +119,27 @@ function j({ className: a }) {
|
|
|
119
119
|
children: /* @__PURE__ */ (0, i.jsx)("path", { d: S })
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
|
-
var V = u.forwardRef(({ type: a, checked:
|
|
122
|
+
var V = u.forwardRef(({ type: a, checked: e = !1, disabled: o = !1, size: r = "sm", color: d = "primary", className: t, indeterminate: c = !1 }, n) => {
|
|
123
123
|
const l = k[d];
|
|
124
124
|
return a === "checkbox" ? /* @__PURE__ */ (0, i.jsx)("span", {
|
|
125
125
|
ref: n,
|
|
126
126
|
"data-slot": "selection-indicator",
|
|
127
127
|
"data-type": "checkbox",
|
|
128
|
-
"data-checked":
|
|
129
|
-
className: s(C({ size:
|
|
128
|
+
"data-checked": e,
|
|
129
|
+
className: s(C({ size: r }), e ? s(l.indicatorChecked, l.border, l.text, "border", "delight-check-bounce") : "border-border bg-background", o && "opacity-50", t),
|
|
130
130
|
"aria-hidden": "true",
|
|
131
|
-
children:
|
|
132
|
-
className: s(
|
|
131
|
+
children: e && (c ? /* @__PURE__ */ (0, i.jsx)(y, {
|
|
132
|
+
className: s(g[r], "animate-[scale-in_150ms_ease-out] motion-reduce:animate-none"),
|
|
133
133
|
strokeWidth: 3
|
|
134
|
-
}) : /* @__PURE__ */ (0, i.jsx)(j, { className:
|
|
134
|
+
}) : /* @__PURE__ */ (0, i.jsx)(j, { className: g[r] }))
|
|
135
135
|
}) : /* @__PURE__ */ (0, i.jsx)("span", {
|
|
136
136
|
ref: n,
|
|
137
137
|
"data-slot": "selection-indicator",
|
|
138
138
|
"data-type": "radio",
|
|
139
|
-
"data-checked":
|
|
140
|
-
className: s(z({ size:
|
|
139
|
+
"data-checked": e,
|
|
140
|
+
className: s(z({ size: r }), "transition-[background-color,border-color] duration-150 motion-reduce:transition-none", e ? s(l.indicatorChecked, "border-transparent") : "border-border bg-background", o && "opacity-50", t),
|
|
141
141
|
"aria-hidden": "true",
|
|
142
|
-
children: /* @__PURE__ */ (0, i.jsx)("span", { className: s("bg-background rounded-full transition-transform duration-150 ease-out motion-reduce:transition-none", w[
|
|
142
|
+
children: /* @__PURE__ */ (0, i.jsx)("span", { className: s("bg-background rounded-full transition-transform duration-150 ease-out motion-reduce:transition-none", w[r], e ? "scale-100" : "scale-0") })
|
|
143
143
|
});
|
|
144
144
|
});
|
|
145
145
|
V.displayName = "SelectionIndicator";
|
|
@@ -151,15 +151,15 @@ var I = {
|
|
|
151
151
|
sm: "size-4",
|
|
152
152
|
md: "size-5",
|
|
153
153
|
lg: "size-6"
|
|
154
|
-
}, _ = u.forwardRef(({ children: a, size:
|
|
155
|
-
const d = I[
|
|
154
|
+
}, _ = u.forwardRef(({ children: a, size: e = "sm", className: o }, r) => {
|
|
155
|
+
const d = I[e], t = N[e];
|
|
156
156
|
return /* @__PURE__ */ (0, i.jsx)("div", {
|
|
157
|
-
ref:
|
|
157
|
+
ref: r,
|
|
158
158
|
"data-slot": "featured-icon",
|
|
159
|
-
className: s("shrink-0 rounded-md border border-border bg-card/60", "flex items-center justify-center", "dark:
|
|
159
|
+
className: s("shrink-0 rounded-md border border-border bg-card/60", "flex items-center justify-center", "dark:border-border", d, o),
|
|
160
160
|
style: { boxShadow: "var(--shadow-inset-ring)" },
|
|
161
161
|
children: /* @__PURE__ */ (0, i.jsx)("div", {
|
|
162
|
-
className: s("text-secondary-foreground
|
|
162
|
+
className: s("text-secondary-foreground", t),
|
|
163
163
|
children: a
|
|
164
164
|
})
|
|
165
165
|
});
|
|
@@ -178,13 +178,13 @@ var M = {
|
|
|
178
178
|
sm: "size-[10px]",
|
|
179
179
|
md: "size-3",
|
|
180
180
|
lg: "size-3.5"
|
|
181
|
-
}, D = u.forwardRef(({ color: a, size:
|
|
181
|
+
}, D = u.forwardRef(({ color: a, size: e = "sm", className: o }, r) => {
|
|
182
182
|
if (!a) return null;
|
|
183
183
|
const d = M[a], t = a.startsWith("#");
|
|
184
184
|
return /* @__PURE__ */ (0, i.jsx)("span", {
|
|
185
|
-
ref:
|
|
185
|
+
ref: r,
|
|
186
186
|
"data-slot": "color-dot",
|
|
187
|
-
className: s("shrink-0 rounded-full", R[
|
|
187
|
+
className: s("shrink-0 rounded-full", R[e], !t && d, o),
|
|
188
188
|
style: t ? { backgroundColor: a } : void 0,
|
|
189
189
|
"aria-hidden": "true"
|
|
190
190
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selection-group.js","names":[],"sources":["../../src/components/ui/selection-group.tsx"],"sourcesContent":["'use client';\n\nimport { cva } from 'class-variance-authority';\nimport { Minus } from 'lucide-react';\nimport * as React from 'react';\nimport { cn } from '@/lib/utils';\n\n// =============================================================================\n// Types\n// =============================================================================\n\nexport type SelectionColor =\n | 'primary'\n | 'secondary'\n | 'success'\n | 'warning'\n | 'info'\n | 'destructive';\n\nexport type SelectionSize = 'sm' | 'md' | 'lg';\n\nexport type SelectionVariant =\n | 'default'\n | 'card'\n | 'pill'\n | 'stacked'\n | 'icon-simple'\n | 'icon-card'\n | 'avatar'\n | 'payment'\n | 'simple'\n | 'chip';\n\nexport interface SelectionItem {\n /** Unique value for the option */\n value: string;\n /** Display label */\n label: string;\n /** Whether this option is disabled */\n disabled?: boolean;\n /** Secondary text (e.g., \"$10/month\") */\n subtext?: string;\n /** Supporting description text */\n description?: string;\n /** Leading icon component */\n icon?: React.ReactNode;\n /** Avatar element */\n avatar?: React.ReactNode;\n /** Image URL */\n image?: string;\n /** Alt text for the image (defaults to \"\" if omitted) */\n imageAlt?: string;\n /** Position of the image */\n imagePosition?: 'top' | 'left' | 'trailing';\n /** Badge element */\n badge?: React.ReactNode;\n /** Dot color for chip variant (named color or hex) */\n dotColor?: string;\n /** Price display (e.g., \"$10\") */\n price?: string;\n /** Price period (e.g., \"per month\") */\n pricePeriod?: string;\n /** Payment icon element */\n paymentIcon?: React.ReactNode;\n /** Action buttons */\n actions?: React.ReactNode;\n}\n\n// =============================================================================\n// Hooks\n// =============================================================================\n\ninterface UseSelectionStateOptions {\n /** Controlled value */\n value?: string;\n /** Default value for uncontrolled mode */\n defaultValue?: string;\n /** Callback when value changes */\n onValueChange?: (value: string) => void;\n}\n\n/**\n * Hook for managing single selection state (radio behavior).\n * Supports both controlled and uncontrolled modes.\n */\nexport function useSelectionState(\n options: UseSelectionStateOptions = {},\n): [string | undefined, (value: string) => void] {\n const { value: controlledValue, defaultValue, onValueChange } = options;\n\n const [internalValue, setInternalValue] = React.useState<string | undefined>(\n defaultValue,\n );\n\n const isControlled = controlledValue !== undefined;\n const selectedValue = isControlled ? controlledValue : internalValue;\n\n const setValue = React.useCallback(\n (newValue: string) => {\n if (!isControlled) {\n setInternalValue(newValue);\n }\n onValueChange?.(newValue);\n },\n [isControlled, onValueChange],\n );\n\n return [selectedValue, setValue];\n}\n\ninterface UseMultiSelectionStateOptions {\n /** Controlled value */\n value?: string[];\n /** Default value for uncontrolled mode */\n defaultValue?: string[];\n /** Callback when value changes */\n onValueChange?: (value: string[]) => void;\n}\n\n/**\n * Hook for managing multi selection state (checkbox behavior).\n * Supports both controlled and uncontrolled modes.\n */\nexport function useMultiSelectionState(\n options: UseMultiSelectionStateOptions = {},\n): [string[], (value: string, checked: boolean) => void] {\n const { value: controlledValue, defaultValue = [], onValueChange } = options;\n\n const [internalValue, setInternalValue] =\n React.useState<string[]>(defaultValue);\n\n const isControlled = controlledValue !== undefined;\n const selectedValues = isControlled ? controlledValue : internalValue;\n\n const setValue = React.useCallback(\n (itemValue: string, checked: boolean) => {\n const newValue = checked\n ? [...selectedValues, itemValue]\n : selectedValues.filter((v) => v !== itemValue);\n\n if (!isControlled) {\n setInternalValue(newValue);\n }\n onValueChange?.(newValue);\n },\n [isControlled, selectedValues, onValueChange],\n );\n\n return [selectedValues, setValue];\n}\n\n// =============================================================================\n// Color Mappings\n// =============================================================================\n\nexport const selectionColorClasses: Record<\n SelectionColor,\n {\n indicator: string;\n indicatorChecked: string;\n border: string;\n bg: string;\n text: string;\n }\n> = {\n primary: {\n indicator: 'border-primary',\n indicatorChecked: 'bg-primary',\n border: 'border-primary',\n bg: 'bg-primary',\n text: 'text-primary-foreground',\n },\n secondary: {\n indicator: 'border-secondary',\n indicatorChecked: 'bg-secondary',\n border: 'border-secondary',\n bg: 'bg-secondary',\n text: 'text-secondary-foreground',\n },\n success: {\n indicator: 'border-success',\n indicatorChecked: 'bg-success',\n border: 'border-success',\n bg: 'bg-success',\n text: 'text-primary-foreground',\n },\n warning: {\n indicator: 'border-warning',\n indicatorChecked: 'bg-warning',\n border: 'border-warning',\n bg: 'bg-warning',\n text: 'text-primary-foreground',\n },\n info: {\n indicator: 'border-info',\n indicatorChecked: 'bg-info',\n border: 'border-info',\n bg: 'bg-info',\n text: 'text-primary-foreground',\n },\n destructive: {\n indicator: 'border-destructive',\n indicatorChecked: 'bg-destructive',\n border: 'border-destructive',\n bg: 'bg-destructive',\n text: 'text-primary-foreground',\n },\n};\n\n// =============================================================================\n// CVA Variants\n// =============================================================================\n\n/**\n * Selection group container variants.\n * Used for the outer wrapper of a group of selection items.\n */\nexport const selectionGroupVariants = cva('flex', {\n variants: {\n orientation: {\n horizontal: 'flex-row flex-wrap',\n vertical: 'flex-col',\n },\n gap: {\n sm: 'gap-2',\n md: 'gap-3',\n lg: 'gap-4',\n },\n },\n defaultVariants: {\n orientation: 'horizontal',\n gap: 'md',\n },\n});\n\n/**\n * Selection indicator variants (for both radio and checkbox).\n * Renders as a rounded indicator with border.\n */\nexport const selectionIndicatorVariants = cva(\n 'shrink-0 rounded-full border-2 transition-all flex items-center justify-center',\n {\n variants: {\n size: {\n sm: 'size-4',\n md: 'size-5',\n lg: 'size-6',\n },\n },\n defaultVariants: {\n size: 'sm',\n },\n },\n);\n\n/**\n * Checkbox indicator variants (square with rounded corners).\n */\nexport const checkboxIndicatorVariants = cva(\n 'shrink-0 border transition-[border-color,background-color,color,box-shadow] duration-200 ease-out motion-reduce:transition-none flex items-center justify-center',\n {\n variants: {\n size: {\n sm: 'size-4 rounded-[4px]',\n md: 'size-5 rounded-[5px]',\n lg: 'size-6 rounded-[6px]',\n },\n },\n defaultVariants: {\n size: 'sm',\n },\n },\n);\n\n/**\n * Inner dot sizes for radio indicators when checked.\n */\nexport const innerDotSizes: Record<SelectionSize, string> = {\n sm: 'size-1.5',\n md: 'size-2',\n lg: 'size-2.5',\n};\n\n/**\n * Text size classes for selection labels.\n */\nexport const textSizeClasses: Record<SelectionSize, string> = {\n sm: 'text-sm',\n md: 'text-sm',\n lg: 'text-base',\n};\n\n/**\n * Icon size classes for checkbox indicators.\n */\nexport const iconSizeClasses: Record<SelectionSize, string> = {\n sm: 'size-3',\n md: 'size-3.5',\n lg: 'size-4',\n};\n\n// =============================================================================\n// Draw-on checkmark SVG (shared delight animation)\n// =============================================================================\n\nexport const CHECKMARK_PATH = 'M4 12l5 5L20 6';\n\nexport function DrawCheck({ className }: { className?: string }) {\n return (\n <svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={3}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={cn(className, 'delight-check-draw')}\n >\n <path d={CHECKMARK_PATH} />\n </svg>\n );\n}\n\n// =============================================================================\n// SelectionIndicator Component\n// =============================================================================\n\nexport interface SelectionIndicatorProps {\n /** Type of indicator to render */\n type: 'checkbox' | 'radio';\n /** Whether the indicator is checked */\n checked?: boolean;\n /** Whether the indicator is disabled */\n disabled?: boolean;\n /** Size of the indicator */\n size?: SelectionSize;\n /** Color of the indicator */\n color?: SelectionColor;\n /** Additional CSS classes */\n className?: string;\n /** Whether the checkbox is in indeterminate state (checkbox only) */\n indeterminate?: boolean;\n}\n\n/**\n * SelectionIndicator renders either a checkbox or radio indicator based on type.\n * For checkbox: renders a check icon when checked.\n * For radio: renders an inner dot when checked.\n */\nconst SelectionIndicator = React.forwardRef<\n HTMLSpanElement,\n SelectionIndicatorProps\n>(\n (\n {\n type,\n checked = false,\n disabled = false,\n size = 'sm',\n color = 'primary',\n className,\n indeterminate = false,\n },\n ref,\n ) => {\n const colors = selectionColorClasses[color];\n\n if (type === 'checkbox') {\n return (\n <span\n ref={ref}\n data-slot=\"selection-indicator\"\n data-type=\"checkbox\"\n data-checked={checked}\n className={cn(\n checkboxIndicatorVariants({ size }),\n checked\n ? cn(\n colors.indicatorChecked,\n colors.border,\n colors.text,\n 'border',\n 'delight-check-bounce',\n )\n : 'border-border bg-background',\n disabled && 'opacity-50',\n className,\n )}\n aria-hidden=\"true\"\n >\n {checked &&\n (indeterminate ? (\n <Minus\n className={cn(\n iconSizeClasses[size],\n 'animate-[scale-in_150ms_ease-out] motion-reduce:animate-none',\n )}\n strokeWidth={3}\n />\n ) : (\n <DrawCheck className={iconSizeClasses[size]} />\n ))}\n </span>\n );\n }\n\n // Radio type\n return (\n <span\n ref={ref}\n data-slot=\"selection-indicator\"\n data-type=\"radio\"\n data-checked={checked}\n className={cn(\n selectionIndicatorVariants({ size }),\n 'transition-[background-color,border-color] duration-150 motion-reduce:transition-none',\n checked\n ? cn(colors.indicatorChecked, 'border-transparent')\n : 'border-border bg-background',\n disabled && 'opacity-50',\n className,\n )}\n aria-hidden=\"true\"\n >\n <span\n className={cn(\n 'bg-background rounded-full transition-transform duration-150 ease-out motion-reduce:transition-none',\n innerDotSizes[size],\n checked ? 'scale-100' : 'scale-0',\n )}\n />\n </span>\n );\n },\n);\n\nSelectionIndicator.displayName = 'SelectionIndicator';\n\n// =============================================================================\n// FeaturedIcon Component\n// =============================================================================\n\nexport interface FeaturedIconProps {\n /** The icon content to display */\n children: React.ReactNode;\n /** Size of the featured icon container */\n size?: SelectionSize;\n /** Additional CSS classes */\n className?: string;\n}\n\n// Hoisted outside component to avoid recreation on every render\nconst featuredIconContainerSizes: Record<SelectionSize, string> = {\n sm: 'size-8',\n md: 'size-10',\n lg: 'size-12',\n};\n\nconst featuredIconInnerSizes: Record<SelectionSize, string> = {\n sm: 'size-4',\n md: 'size-5',\n lg: 'size-6',\n};\n\n/**\n * FeaturedIcon is a container for icons with border and shadow.\n * Used in icon-simple and icon-card variants.\n */\nconst FeaturedIcon = React.forwardRef<HTMLDivElement, FeaturedIconProps>(\n ({ children, size = 'sm', className }, ref) => {\n const containerSize = featuredIconContainerSizes[size];\n const innerSize = featuredIconInnerSizes[size];\n\n return (\n <div\n ref={ref}\n data-slot=\"featured-icon\"\n className={cn(\n 'shrink-0 rounded-md border border-border bg-card/60',\n 'flex items-center justify-center',\n 'dark:bg-foreground/60 dark:border-border',\n containerSize,\n className,\n )}\n style={{\n boxShadow: 'var(--shadow-inset-ring)',\n }}\n >\n <div\n className={cn(\n 'text-secondary-foreground dark:text-text-quaternary',\n innerSize,\n )}\n >\n {children}\n </div>\n </div>\n );\n },\n);\n\nFeaturedIcon.displayName = 'FeaturedIcon';\n\n// =============================================================================\n// ColorDot Component\n// =============================================================================\n\nexport type ColorDotColor =\n | 'gray'\n | 'orange'\n | 'red'\n | 'darkRed'\n | 'brand'\n | 'success'\n | 'warning'\n | 'error'\n | string; // Allow custom hex colors\n\nconst dotColorMap: Record<string, string> = {\n gray: 'bg-muted',\n orange: 'bg-warning',\n red: 'bg-destructive',\n darkRed: 'bg-destructive-hover',\n brand: 'bg-primary/10',\n success: 'bg-success/10',\n warning: 'bg-warning/10',\n error: 'bg-destructive/10',\n};\n\nconst dotSizeMap: Record<SelectionSize, string> = {\n sm: 'size-[10px]',\n md: 'size-3',\n lg: 'size-3.5',\n};\n\nexport interface ColorDotProps {\n /** Color of the dot (named color or hex) */\n color?: ColorDotColor;\n /** Size of the dot */\n size?: SelectionSize;\n /** Additional CSS classes */\n className?: string;\n}\n\n/**\n * ColorDot renders a colored dot for chip variant.\n * Supports named colors (gray, orange, red, etc.) and hex colors.\n */\nconst ColorDot = React.forwardRef<HTMLSpanElement, ColorDotProps>(\n ({ color, size = 'sm', className }, ref) => {\n if (!color) return null;\n\n const colorClass = dotColorMap[color];\n const isHexColor = color.startsWith('#');\n\n return (\n <span\n ref={ref}\n data-slot=\"color-dot\"\n className={cn(\n 'shrink-0 rounded-full',\n dotSizeMap[size],\n !isHexColor && colorClass,\n className,\n )}\n style={isHexColor ? { backgroundColor: color } : undefined}\n aria-hidden=\"true\"\n />\n );\n },\n);\n\nColorDot.displayName = 'ColorDot';\n\n// =============================================================================\n// Exports\n// =============================================================================\n\nexport { ColorDot, FeaturedIcon, SelectionIndicator };\n"],"mappings":";;;;;;AAqFA,SAAgB,EACd,IAAoC,CAAC,GACU;AAC/C,QAAM,EAAE,OAAO,GAAiB,cAAA,GAAc,eAAA,EAAA,IAAkB,GAE1D,CAAC,GAAe,CAAA,IAAA,EAA0B,SAC9C,CACF,GAEM,IAAe,MAAoB;AAazC,SAAO,CAZe,IAAe,IAAkB,GAAA,EAEhC,YAAA,CACpB,MAAqB;AACpB,IAAK,KACH,EAAiB,CAAQ,GAE3B,IAAgB,CAAQ;AAAA,EAC1B,GACA,CAAC,GAAc,CAAa,CAGP,CAAQ;AACjC;AAeA,SAAgB,EACd,IAAyC,CAAC,GACa;AACvD,QAAM,EAAE,OAAO,GAAiB,cAAA,IAAe,CAAC,GAAG,eAAA,EAAA,IAAkB,GAE/D,CAAC,GAAe,CAAA,IAAA,EACd,SAAmB,CAAY,G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AAW,EACT,uDACA,oCACA,4CACA,GACA,CACF;AAAA,IACA,OAAO,EACL,WAAW,2BACb;AAAA,cAEA,oBAAA,EAAA,KAAC,OAAD;AAAA,MACE,WAAW,EACT,uDACA,CACF;AAAA,MAEC,UAAA;AAAA,IACE,CAAA;AAAA,EACF,CAAA;AAET,CACF;AAEA,EAAa,cAAc;AAiB3B,IAAM,IAAsC;AAAA,EAC1C,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,SAAS;AAAA,EACT,OAAO;AAAA,EACP,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AACT,GAEM,IAA4C;AAAA,EAChD,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN,GAeM,IAAA,EAAiB,WAAA,CACpB,EAAE,OAAA,GAAO,MAAA,IAAO,MAAM,WAAA,EAAA,GAAa,MAAQ;AAC1C,MAAI,CAAC,EAAO,QAAO;AAEnB,QAAM,IAAa,EAAY,CAAA,GACzB,IAAa,EAAM,WAAW,GAAG;AAEvC,SACE,oBAAA,EAAA,KAAC,QAAD;AAAA,IACO,KAAA;AAAA,IACL,aAAU;AAAA,IACV,WAAW,EACT,yBACA,EAAW,CAAA,GACX,CAAC,KAAc,GACf,CACF;AAAA,IACA,OAAO,IAAa,EAAE,iBAAiB,EAAM,IAAI;AAAA,IACjD,eAAY;AAAA,EACb,CAAA;AAEL,CACF;AAEA,EAAS,cAAc"}
|
|
1
|
+
{"version":3,"file":"selection-group.js","names":[],"sources":["../../src/components/ui/selection-group.tsx"],"sourcesContent":["'use client';\n\nimport { cva } from 'class-variance-authority';\nimport { Minus } from 'lucide-react';\nimport * as React from 'react';\nimport { cn } from '@/lib/utils';\n\n// =============================================================================\n// Types\n// =============================================================================\n\nexport type SelectionColor =\n | 'primary'\n | 'secondary'\n | 'success'\n | 'warning'\n | 'info'\n | 'destructive';\n\nexport type SelectionSize = 'sm' | 'md' | 'lg';\n\nexport type SelectionVariant =\n | 'default'\n | 'card'\n | 'pill'\n | 'stacked'\n | 'icon-simple'\n | 'icon-card'\n | 'avatar'\n | 'payment'\n | 'simple'\n | 'chip';\n\nexport interface SelectionItem {\n /** Unique value for the option */\n value: string;\n /** Display label */\n label: string;\n /** Whether this option is disabled */\n disabled?: boolean;\n /** Secondary text (e.g., \"$10/month\") */\n subtext?: string;\n /** Supporting description text */\n description?: string;\n /** Leading icon component */\n icon?: React.ReactNode;\n /** Avatar element */\n avatar?: React.ReactNode;\n /** Image URL */\n image?: string;\n /** Alt text for the image (defaults to \"\" if omitted) */\n imageAlt?: string;\n /** Position of the image */\n imagePosition?: 'top' | 'left' | 'trailing';\n /** Badge element */\n badge?: React.ReactNode;\n /** Dot color for chip variant (named color or hex) */\n dotColor?: string;\n /** Price display (e.g., \"$10\") */\n price?: string;\n /** Price period (e.g., \"per month\") */\n pricePeriod?: string;\n /** Payment icon element */\n paymentIcon?: React.ReactNode;\n /** Action buttons */\n actions?: React.ReactNode;\n}\n\n// =============================================================================\n// Hooks\n// =============================================================================\n\ninterface UseSelectionStateOptions {\n /** Controlled value */\n value?: string;\n /** Default value for uncontrolled mode */\n defaultValue?: string;\n /** Callback when value changes */\n onValueChange?: (value: string) => void;\n}\n\n/**\n * Hook for managing single selection state (radio behavior).\n * Supports both controlled and uncontrolled modes.\n */\nexport function useSelectionState(\n options: UseSelectionStateOptions = {},\n): [string | undefined, (value: string) => void] {\n const { value: controlledValue, defaultValue, onValueChange } = options;\n\n const [internalValue, setInternalValue] = React.useState<string | undefined>(\n defaultValue,\n );\n\n const isControlled = controlledValue !== undefined;\n const selectedValue = isControlled ? controlledValue : internalValue;\n\n const setValue = React.useCallback(\n (newValue: string) => {\n if (!isControlled) {\n setInternalValue(newValue);\n }\n onValueChange?.(newValue);\n },\n [isControlled, onValueChange],\n );\n\n return [selectedValue, setValue];\n}\n\ninterface UseMultiSelectionStateOptions {\n /** Controlled value */\n value?: string[];\n /** Default value for uncontrolled mode */\n defaultValue?: string[];\n /** Callback when value changes */\n onValueChange?: (value: string[]) => void;\n}\n\n/**\n * Hook for managing multi selection state (checkbox behavior).\n * Supports both controlled and uncontrolled modes.\n */\nexport function useMultiSelectionState(\n options: UseMultiSelectionStateOptions = {},\n): [string[], (value: string, checked: boolean) => void] {\n const { value: controlledValue, defaultValue = [], onValueChange } = options;\n\n const [internalValue, setInternalValue] =\n React.useState<string[]>(defaultValue);\n\n const isControlled = controlledValue !== undefined;\n const selectedValues = isControlled ? controlledValue : internalValue;\n\n const setValue = React.useCallback(\n (itemValue: string, checked: boolean) => {\n const newValue = checked\n ? [...selectedValues, itemValue]\n : selectedValues.filter((v) => v !== itemValue);\n\n if (!isControlled) {\n setInternalValue(newValue);\n }\n onValueChange?.(newValue);\n },\n [isControlled, selectedValues, onValueChange],\n );\n\n return [selectedValues, setValue];\n}\n\n// =============================================================================\n// Color Mappings\n// =============================================================================\n\nexport const selectionColorClasses: Record<\n SelectionColor,\n {\n indicator: string;\n indicatorChecked: string;\n border: string;\n bg: string;\n text: string;\n }\n> = {\n primary: {\n indicator: 'border-primary',\n indicatorChecked: 'bg-primary',\n border: 'border-primary',\n bg: 'bg-primary',\n text: 'text-primary-foreground',\n },\n secondary: {\n indicator: 'border-secondary',\n indicatorChecked: 'bg-secondary',\n border: 'border-secondary',\n bg: 'bg-secondary',\n text: 'text-secondary-foreground',\n },\n success: {\n indicator: 'border-success',\n indicatorChecked: 'bg-success',\n border: 'border-success',\n bg: 'bg-success',\n text: 'text-primary-foreground',\n },\n warning: {\n indicator: 'border-warning',\n indicatorChecked: 'bg-warning',\n border: 'border-warning',\n bg: 'bg-warning',\n text: 'text-primary-foreground',\n },\n info: {\n indicator: 'border-info',\n indicatorChecked: 'bg-info',\n border: 'border-info',\n bg: 'bg-info',\n text: 'text-primary-foreground',\n },\n destructive: {\n indicator: 'border-destructive',\n indicatorChecked: 'bg-destructive',\n border: 'border-destructive',\n bg: 'bg-destructive',\n text: 'text-primary-foreground',\n },\n};\n\n// =============================================================================\n// CVA Variants\n// =============================================================================\n\n/**\n * Selection group container variants.\n * Used for the outer wrapper of a group of selection items.\n */\nexport const selectionGroupVariants = cva('flex', {\n variants: {\n orientation: {\n horizontal: 'flex-row flex-wrap',\n vertical: 'flex-col',\n },\n gap: {\n sm: 'gap-2',\n md: 'gap-3',\n lg: 'gap-4',\n },\n },\n defaultVariants: {\n orientation: 'horizontal',\n gap: 'md',\n },\n});\n\n/**\n * Selection indicator variants (for both radio and checkbox).\n * Renders as a rounded indicator with border.\n */\nexport const selectionIndicatorVariants = cva(\n 'shrink-0 rounded-full border-2 transition-all flex items-center justify-center',\n {\n variants: {\n size: {\n sm: 'size-4',\n md: 'size-5',\n lg: 'size-6',\n },\n },\n defaultVariants: {\n size: 'sm',\n },\n },\n);\n\n/**\n * Checkbox indicator variants (square with rounded corners).\n */\nexport const checkboxIndicatorVariants = cva(\n 'shrink-0 border transition-[border-color,background-color,color,box-shadow] duration-200 ease-out motion-reduce:transition-none flex items-center justify-center',\n {\n variants: {\n size: {\n sm: 'size-4 rounded-[4px]',\n md: 'size-5 rounded-[5px]',\n lg: 'size-6 rounded-[6px]',\n },\n },\n defaultVariants: {\n size: 'sm',\n },\n },\n);\n\n/**\n * Inner dot sizes for radio indicators when checked.\n */\nexport const innerDotSizes: Record<SelectionSize, string> = {\n sm: 'size-1.5',\n md: 'size-2',\n lg: 'size-2.5',\n};\n\n/**\n * Text size classes for selection labels.\n */\nexport const textSizeClasses: Record<SelectionSize, string> = {\n sm: 'text-sm',\n md: 'text-sm',\n lg: 'text-base',\n};\n\n/**\n * Icon size classes for checkbox indicators.\n */\nexport const iconSizeClasses: Record<SelectionSize, string> = {\n sm: 'size-3',\n md: 'size-3.5',\n lg: 'size-4',\n};\n\n// =============================================================================\n// Draw-on checkmark SVG (shared delight animation)\n// =============================================================================\n\nexport const CHECKMARK_PATH = 'M4 12l5 5L20 6';\n\nexport function DrawCheck({ className }: { className?: string }) {\n return (\n <svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={3}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={cn(className, 'delight-check-draw')}\n >\n <path d={CHECKMARK_PATH} />\n </svg>\n );\n}\n\n// =============================================================================\n// SelectionIndicator Component\n// =============================================================================\n\nexport interface SelectionIndicatorProps {\n /** Type of indicator to render */\n type: 'checkbox' | 'radio';\n /** Whether the indicator is checked */\n checked?: boolean;\n /** Whether the indicator is disabled */\n disabled?: boolean;\n /** Size of the indicator */\n size?: SelectionSize;\n /** Color of the indicator */\n color?: SelectionColor;\n /** Additional CSS classes */\n className?: string;\n /** Whether the checkbox is in indeterminate state (checkbox only) */\n indeterminate?: boolean;\n}\n\n/**\n * SelectionIndicator renders either a checkbox or radio indicator based on type.\n * For checkbox: renders a check icon when checked.\n * For radio: renders an inner dot when checked.\n */\nconst SelectionIndicator = React.forwardRef<\n HTMLSpanElement,\n SelectionIndicatorProps\n>(\n (\n {\n type,\n checked = false,\n disabled = false,\n size = 'sm',\n color = 'primary',\n className,\n indeterminate = false,\n },\n ref,\n ) => {\n const colors = selectionColorClasses[color];\n\n if (type === 'checkbox') {\n return (\n <span\n ref={ref}\n data-slot=\"selection-indicator\"\n data-type=\"checkbox\"\n data-checked={checked}\n className={cn(\n checkboxIndicatorVariants({ size }),\n checked\n ? cn(\n colors.indicatorChecked,\n colors.border,\n colors.text,\n 'border',\n 'delight-check-bounce',\n )\n : 'border-border bg-background',\n disabled && 'opacity-50',\n className,\n )}\n aria-hidden=\"true\"\n >\n {checked &&\n (indeterminate ? (\n <Minus\n className={cn(\n iconSizeClasses[size],\n 'animate-[scale-in_150ms_ease-out] motion-reduce:animate-none',\n )}\n strokeWidth={3}\n />\n ) : (\n <DrawCheck className={iconSizeClasses[size]} />\n ))}\n </span>\n );\n }\n\n // Radio type\n return (\n <span\n ref={ref}\n data-slot=\"selection-indicator\"\n data-type=\"radio\"\n data-checked={checked}\n className={cn(\n selectionIndicatorVariants({ size }),\n 'transition-[background-color,border-color] duration-150 motion-reduce:transition-none',\n checked\n ? cn(colors.indicatorChecked, 'border-transparent')\n : 'border-border bg-background',\n disabled && 'opacity-50',\n className,\n )}\n aria-hidden=\"true\"\n >\n <span\n className={cn(\n 'bg-background rounded-full transition-transform duration-150 ease-out motion-reduce:transition-none',\n innerDotSizes[size],\n checked ? 'scale-100' : 'scale-0',\n )}\n />\n </span>\n );\n },\n);\n\nSelectionIndicator.displayName = 'SelectionIndicator';\n\n// =============================================================================\n// FeaturedIcon Component\n// =============================================================================\n\nexport interface FeaturedIconProps {\n /** The icon content to display */\n children: React.ReactNode;\n /** Size of the featured icon container */\n size?: SelectionSize;\n /** Additional CSS classes */\n className?: string;\n}\n\n// Hoisted outside component to avoid recreation on every render\nconst featuredIconContainerSizes: Record<SelectionSize, string> = {\n sm: 'size-8',\n md: 'size-10',\n lg: 'size-12',\n};\n\nconst featuredIconInnerSizes: Record<SelectionSize, string> = {\n sm: 'size-4',\n md: 'size-5',\n lg: 'size-6',\n};\n\n/**\n * FeaturedIcon is a container for icons with border and shadow.\n * Used in icon-simple and icon-card variants.\n */\nconst FeaturedIcon = React.forwardRef<HTMLDivElement, FeaturedIconProps>(\n ({ children, size = 'sm', className }, ref) => {\n const containerSize = featuredIconContainerSizes[size];\n const innerSize = featuredIconInnerSizes[size];\n\n return (\n <div\n ref={ref}\n data-slot=\"featured-icon\"\n className={cn(\n 'shrink-0 rounded-md border border-border bg-card/60',\n 'flex items-center justify-center',\n 'dark:border-border',\n containerSize,\n className,\n )}\n style={{\n boxShadow: 'var(--shadow-inset-ring)',\n }}\n >\n <div className={cn('text-secondary-foreground', innerSize)}>\n {children}\n </div>\n </div>\n );\n },\n);\n\nFeaturedIcon.displayName = 'FeaturedIcon';\n\n// =============================================================================\n// ColorDot Component\n// =============================================================================\n\nexport type ColorDotColor =\n | 'gray'\n | 'orange'\n | 'red'\n | 'darkRed'\n | 'brand'\n | 'success'\n | 'warning'\n | 'error'\n | string; // Allow custom hex colors\n\nconst dotColorMap: Record<string, string> = {\n gray: 'bg-muted',\n orange: 'bg-warning',\n red: 'bg-destructive',\n darkRed: 'bg-destructive-hover',\n brand: 'bg-primary/10',\n success: 'bg-success/10',\n warning: 'bg-warning/10',\n error: 'bg-destructive/10',\n};\n\nconst dotSizeMap: Record<SelectionSize, string> = {\n sm: 'size-[10px]',\n md: 'size-3',\n lg: 'size-3.5',\n};\n\nexport interface ColorDotProps {\n /** Color of the dot (named color or hex) */\n color?: ColorDotColor;\n /** Size of the dot */\n size?: SelectionSize;\n /** Additional CSS classes */\n className?: string;\n}\n\n/**\n * ColorDot renders a colored dot for chip variant.\n * Supports named colors (gray, orange, red, etc.) and hex colors.\n */\nconst ColorDot = React.forwardRef<HTMLSpanElement, ColorDotProps>(\n ({ color, size = 'sm', className }, ref) => {\n if (!color) return null;\n\n const colorClass = dotColorMap[color];\n const isHexColor = color.startsWith('#');\n\n return (\n <span\n ref={ref}\n data-slot=\"color-dot\"\n className={cn(\n 'shrink-0 rounded-full',\n dotSizeMap[size],\n !isHexColor && colorClass,\n className,\n )}\n style={isHexColor ? { backgroundColor: color } : undefined}\n aria-hidden=\"true\"\n />\n );\n },\n);\n\nColorDot.displayName = 'ColorDot';\n\n// =============================================================================\n// Exports\n// =============================================================================\n\nexport { ColorDot, FeaturedIcon, SelectionIndicator };\n"],"mappings":";;;;;;AAqFA,SAAgB,EACd,IAAoC,CAAC,GACU;AAC/C,QAAM,EAAE,OAAO,GAAiB,cAAA,GAAc,eAAA,EAAA,IAAkB,GAE1D,CAAC,GAAe,CAAA,IAAA,EAA0B,SAC9C,CACF,GAEM,IAAe,MAAoB;AAazC,SAAO,CAZe,IAAe,IAAkB,GAAA,EAEhC,YAAA,CACpB,MAAqB;AACpB,IAAK,KACH,EAAiB,CAAQ,GAE3B,IAAgB,CAAQ;AAAA,EAC1B,GACA,CAAC,GAAc,CAAa,CAGP,CAAQ;AACjC;AAeA,SAAgB,EACd,IAAyC,CAAC,GACa;AACvD,QAAM,EAAE,OA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C,IAAY,EAAuB,CAAA;AAEzC,SACE,oBAAA,EAAA,KAAC,OAAD;AAAA,IACO,KAAA;AAAA,IACL,aAAU;AAAA,IACV,WAAW,EACT,uDACA,oCACA,sBACA,GACA,CACF;AAAA,IACA,OAAO,EACL,WAAW,2BACb;AAAA,cAEA,oBAAA,EAAA,KAAC,OAAD;AAAA,MAAK,WAAW,EAAG,6BAA6B,CAAS;AAAA,MACtD,UAAA;AAAA,IACE,CAAA;AAAA,EACF,CAAA;AAET,CACF;AAEA,EAAa,cAAc;AAiB3B,IAAM,IAAsC;AAAA,EAC1C,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,SAAS;AAAA,EACT,OAAO;AAAA,EACP,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AACT,GAEM,IAA4C;AAAA,EAChD,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN,GAeM,IAAA,EAAiB,WAAA,CACpB,EAAE,OAAA,GAAO,MAAA,IAAO,MAAM,WAAA,EAAA,GAAa,MAAQ;AAC1C,MAAI,CAAC,EAAO,QAAO;AAEnB,QAAM,IAAa,EAAY,CAAA,GACzB,IAAa,EAAM,WAAW,GAAG;AAEvC,SACE,oBAAA,EAAA,KAAC,QAAD;AAAA,IACO,KAAA;AAAA,IACL,aAAU;AAAA,IACV,WAAW,EACT,yBACA,EAAW,CAAA,GACX,CAAC,KAAc,GACf,CACF;AAAA,IACA,OAAO,IAAa,EAAE,iBAAiB,EAAM,IAAI;AAAA,IACjD,eAAY;AAAA,EACb,CAAA;AAEL,CACF;AAEA,EAAS,cAAc"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
var r = {
|
|
2
2
|
"--sh-class": "var(--blue-700)",
|
|
3
3
|
"--sh-identifier": "var(--foreground)",
|
|
4
|
-
"--sh-sign": "var(--
|
|
4
|
+
"--sh-sign": "var(--secondary-foreground)",
|
|
5
5
|
"--sh-property": "var(--pink-600)",
|
|
6
6
|
"--sh-entity": "var(--purple-700)",
|
|
7
7
|
"--sh-jsxliterals": "var(--cyan-700)",
|
|
8
8
|
"--sh-string": "var(--green-700)",
|
|
9
9
|
"--sh-keyword": "var(--indigo-700)",
|
|
10
|
-
"--sh-comment": "var(--
|
|
11
|
-
},
|
|
10
|
+
"--sh-comment": "var(--secondary-foreground)"
|
|
11
|
+
}, s = {
|
|
12
12
|
"--sh-class": "var(--blue-200)",
|
|
13
13
|
"--sh-identifier": "var(--primary-foreground)",
|
|
14
14
|
"--sh-sign": "var(--primary-foreground)",
|
|
@@ -21,7 +21,7 @@ var r = {
|
|
|
21
21
|
};
|
|
22
22
|
export {
|
|
23
23
|
r as n,
|
|
24
|
-
|
|
24
|
+
s as t
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
//# sourceMappingURL=syntax-highlight.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syntax-highlight.js","names":[],"sources":["../../src/lib/syntax-highlight.ts"],"sourcesContent":["import type * as React from 'react';\n\nexport const SUGAR_HIGH_STYLE = {\n '--sh-class': 'var(--blue-700)',\n '--sh-identifier': 'var(--foreground)',\n '--sh-sign': 'var(--
|
|
1
|
+
{"version":3,"file":"syntax-highlight.js","names":[],"sources":["../../src/lib/syntax-highlight.ts"],"sourcesContent":["import type * as React from 'react';\n\nexport const SUGAR_HIGH_STYLE = {\n '--sh-class': 'var(--blue-700)',\n '--sh-identifier': 'var(--foreground)',\n '--sh-sign': 'var(--secondary-foreground)',\n '--sh-property': 'var(--pink-600)',\n '--sh-entity': 'var(--purple-700)',\n '--sh-jsxliterals': 'var(--cyan-700)',\n '--sh-string': 'var(--green-700)',\n '--sh-keyword': 'var(--indigo-700)',\n '--sh-comment': 'var(--secondary-foreground)',\n} as React.CSSProperties;\n\nexport const INVERTED_SUGAR_HIGH_STYLE = {\n '--sh-class': 'var(--blue-200)',\n '--sh-identifier': 'var(--primary-foreground)',\n '--sh-sign': 'var(--primary-foreground)',\n '--sh-property': 'var(--pink-300)',\n '--sh-entity': 'var(--purple-300)',\n '--sh-jsxliterals': 'var(--cyan-300)',\n '--sh-string': 'var(--green-300)',\n '--sh-keyword': 'var(--indigo-300)',\n '--sh-comment': 'var(--primary-foreground)',\n} as React.CSSProperties;\n"],"mappings":"AAEA,IAAa,IAAmB;AAAA,EAC9B,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,aAAa;AAAA,EACb,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,oBAAoB;AAAA,EACpB,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,gBAAgB;AAClB,GAEa,IAA4B;AAAA,EACvC,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,aAAa;AAAA,EACb,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,oBAAoB;AAAA,EACpB,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,gBAAgB;AAClB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as $ } from "./rolldown-runtime.js";
|
|
2
|
-
import { i as
|
|
2
|
+
import { i as L, t as A } from "./vendor/react.js";
|
|
3
3
|
import { n as f, t as R } from "./utils.js";
|
|
4
4
|
import { t as M } from "./createLucideIcon.js";
|
|
5
|
-
import { t as
|
|
5
|
+
import { t as q } from "./check.js";
|
|
6
6
|
import { t as V } from "./chevron-down.js";
|
|
7
7
|
import { t as P } from "./chevron-right.js";
|
|
8
8
|
import { t as W } from "./circle-alert.js";
|
|
@@ -57,15 +57,15 @@ var O = [
|
|
|
57
57
|
height: "18",
|
|
58
58
|
rx: "1",
|
|
59
59
|
key: "1wsw3u"
|
|
60
|
-
}]], G = M("pause", U), c = /* @__PURE__ */ $(
|
|
60
|
+
}]], G = M("pause", U), c = /* @__PURE__ */ $(L(), 1);
|
|
61
61
|
function H(e) {
|
|
62
62
|
const r = Math.max(0, Math.round(e));
|
|
63
63
|
if (r < 1e3) return `${r}ms`;
|
|
64
|
-
const
|
|
65
|
-
return n > 0 ? [n ? `${n}h` : "", s ? `${s}m` : ""].filter(Boolean).join(" ") : s > 0 ? `${s}m${d ? ` ${d}s` : ""}` : `${
|
|
64
|
+
const o = Math.round(r / 1e3), n = Math.floor(o / 3600), s = Math.floor(o % 3600 / 60), d = o % 60;
|
|
65
|
+
return n > 0 ? [n ? `${n}h` : "", s ? `${s}m` : ""].filter(Boolean).join(" ") : s > 0 ? `${s}m${d ? ` ${d}s` : ""}` : `${o}s`;
|
|
66
66
|
}
|
|
67
|
-
var t =
|
|
68
|
-
pending: "text-
|
|
67
|
+
var t = A(), J = {
|
|
68
|
+
pending: "text-secondary-foreground",
|
|
69
69
|
running: "text-primary",
|
|
70
70
|
suspended: "text-warning",
|
|
71
71
|
completed: "text-success",
|
|
@@ -100,11 +100,11 @@ var t = L(), J = {
|
|
|
100
100
|
}
|
|
101
101
|
};
|
|
102
102
|
function j(e, r) {
|
|
103
|
-
const
|
|
104
|
-
return r.flatMap((n) =>
|
|
103
|
+
const o = new Set(e);
|
|
104
|
+
return r.flatMap((n) => o.has(n.id) ? [n.id] : []);
|
|
105
105
|
}
|
|
106
106
|
function Z(e, r) {
|
|
107
|
-
return e.length === r.length && e.every((
|
|
107
|
+
return e.length === r.length && e.every((o, n) => o === r[n]);
|
|
108
108
|
}
|
|
109
109
|
function ee(e) {
|
|
110
110
|
return typeof e == "object" && e !== null && Symbol.iterator in e && typeof e[Symbol.iterator] == "function";
|
|
@@ -114,14 +114,14 @@ function te(e) {
|
|
|
114
114
|
}
|
|
115
115
|
var z = /* @__PURE__ */ new WeakMap();
|
|
116
116
|
function re(e, r) {
|
|
117
|
-
const
|
|
117
|
+
const o = [];
|
|
118
118
|
let n = !1, s = !Array.isArray(e);
|
|
119
119
|
for (let d = r.next(); !d.done; d = r.next()) {
|
|
120
120
|
const u = S(d.value);
|
|
121
|
-
|
|
121
|
+
o.push(u.content), n ||= u.hasRenderableContent, s ||= u.changed;
|
|
122
122
|
}
|
|
123
123
|
return {
|
|
124
|
-
content: s ?
|
|
124
|
+
content: s ? o : e,
|
|
125
125
|
hasRenderableContent: n,
|
|
126
126
|
changed: s
|
|
127
127
|
};
|
|
@@ -151,13 +151,13 @@ function S(e) {
|
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
153
|
if (ee(e)) {
|
|
154
|
-
const r = e[Symbol.iterator](),
|
|
155
|
-
if (
|
|
156
|
-
const s = z.get(
|
|
154
|
+
const r = e[Symbol.iterator](), o = te(r) ? r : null;
|
|
155
|
+
if (o !== null) {
|
|
156
|
+
const s = z.get(o);
|
|
157
157
|
if (s !== void 0) return s;
|
|
158
158
|
}
|
|
159
159
|
const n = re(e, r);
|
|
160
|
-
return
|
|
160
|
+
return o !== null && z.set(o, n), n;
|
|
161
161
|
}
|
|
162
162
|
return {
|
|
163
163
|
content: e,
|
|
@@ -168,7 +168,7 @@ function S(e) {
|
|
|
168
168
|
function ne(e) {
|
|
169
169
|
return e?.trim() ? e : void 0;
|
|
170
170
|
}
|
|
171
|
-
function
|
|
171
|
+
function oe(e) {
|
|
172
172
|
switch (e) {
|
|
173
173
|
case "pending":
|
|
174
174
|
return "Pending";
|
|
@@ -184,8 +184,8 @@ function ae(e) {
|
|
|
184
184
|
return R(e);
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
|
-
function _({ status: e, index: r, className:
|
|
188
|
-
const n = f(X({ status: e }),
|
|
187
|
+
function _({ status: e, index: r, className: o }) {
|
|
188
|
+
const n = f(X({ status: e }), o);
|
|
189
189
|
switch (e) {
|
|
190
190
|
case "pending":
|
|
191
191
|
return /* @__PURE__ */ (0, t.jsx)("div", {
|
|
@@ -212,7 +212,7 @@ function _({ status: e, index: r, className: a }) {
|
|
|
212
212
|
return /* @__PURE__ */ (0, t.jsx)("div", {
|
|
213
213
|
"data-slot": "workflow-step-icon",
|
|
214
214
|
className: f(n, "delight-check-bounce motion-reduce:!animate-none"),
|
|
215
|
-
children: /* @__PURE__ */ (0, t.jsx)(
|
|
215
|
+
children: /* @__PURE__ */ (0, t.jsx)(q, { className: "size-3" })
|
|
216
216
|
});
|
|
217
217
|
case "error":
|
|
218
218
|
return /* @__PURE__ */ (0, t.jsx)("div", {
|
|
@@ -225,8 +225,8 @@ function _({ status: e, index: r, className: a }) {
|
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
227
|
_.displayName = "WorkflowStepStatusIcon";
|
|
228
|
-
function D({ step: e, index: r, isLast:
|
|
229
|
-
const
|
|
228
|
+
function D({ step: e, index: r, isLast: o, appearance: n = "contained", itemSlot: s = "workflow-step-item", expandable: d = !0, expanded: u, active: b = !1, onExpandedChange: C }) {
|
|
229
|
+
const y = c.useId(), l = c.useId(), p = S(e.content), k = p.hasRenderableContent, h = ne(e.error), m = h !== void 0, x = k || m, g = x && d, N = K(), v = Y[n], i = { duration: N ? 0 : 0.2 }, a = /* @__PURE__ */ (0, t.jsxs)(t.Fragment, { children: [
|
|
230
230
|
/* @__PURE__ */ (0, t.jsx)(_, {
|
|
231
231
|
status: e.status,
|
|
232
232
|
index: r
|
|
@@ -242,24 +242,24 @@ function D({ step: e, index: r, isLast: a, appearance: n = "contained", itemSlot
|
|
|
242
242
|
children: e.contextLabel
|
|
243
243
|
}),
|
|
244
244
|
/* @__PURE__ */ (0, t.jsx)("span", {
|
|
245
|
-
className: f("text-sm font-medium", e.status === "pending" ? "text-
|
|
245
|
+
className: f("text-sm font-medium", e.status === "pending" ? "text-secondary-foreground" : "text-foreground"),
|
|
246
246
|
children: e.title
|
|
247
247
|
}),
|
|
248
248
|
/* @__PURE__ */ (0, t.jsx)("span", {
|
|
249
249
|
className: "text-xs text-secondary-foreground",
|
|
250
|
-
children:
|
|
250
|
+
children: oe(e.status)
|
|
251
251
|
}),
|
|
252
252
|
e.durationMs !== void 0 && /* @__PURE__ */ (0, t.jsx)("span", {
|
|
253
|
-
className: "text-xs text-
|
|
253
|
+
className: "text-xs text-secondary-foreground",
|
|
254
254
|
children: H(e.durationMs)
|
|
255
255
|
})
|
|
256
256
|
]
|
|
257
257
|
}), e.description && /* @__PURE__ */ (0, t.jsx)("p", {
|
|
258
|
-
className: "mt-0.5 text-xs text-
|
|
258
|
+
className: "mt-0.5 text-xs text-secondary-foreground",
|
|
259
259
|
children: e.description
|
|
260
260
|
})]
|
|
261
261
|
}),
|
|
262
|
-
|
|
262
|
+
g && /* @__PURE__ */ (0, t.jsx)("div", {
|
|
263
263
|
className: "shrink-0",
|
|
264
264
|
children: u ? /* @__PURE__ */ (0, t.jsx)(V, { className: "size-4 text-muted-foreground" }) : /* @__PURE__ */ (0, t.jsx)(P, { className: "size-4 text-muted-foreground rtl:rotate-180" })
|
|
265
265
|
})
|
|
@@ -268,27 +268,27 @@ function D({ step: e, index: r, isLast: a, appearance: n = "contained", itemSlot
|
|
|
268
268
|
"data-slot": s,
|
|
269
269
|
"data-step-status": e.status,
|
|
270
270
|
"data-appearance": n,
|
|
271
|
-
className: f(
|
|
271
|
+
className: f(v.rootClassName, v.hasDivider && !o && "border-b border-border"),
|
|
272
272
|
children: [
|
|
273
|
-
|
|
273
|
+
g ? /* @__PURE__ */ (0, t.jsx)("button", {
|
|
274
274
|
type: "button",
|
|
275
275
|
onClick: C,
|
|
276
276
|
"aria-current": b ? "step" : void 0,
|
|
277
277
|
"aria-expanded": u,
|
|
278
|
-
"aria-controls":
|
|
278
|
+
"aria-controls": y,
|
|
279
279
|
"aria-describedby": m ? l : void 0,
|
|
280
280
|
className: f(I({ status: e.status }), "w-full cursor-pointer hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-ring"),
|
|
281
|
-
children:
|
|
281
|
+
children: a
|
|
282
282
|
}) : /* @__PURE__ */ (0, t.jsx)("div", {
|
|
283
283
|
"aria-current": b ? "step" : void 0,
|
|
284
284
|
"aria-describedby": m ? l : void 0,
|
|
285
285
|
className: f(I({ status: e.status }), "w-full"),
|
|
286
|
-
children:
|
|
286
|
+
children: a
|
|
287
287
|
}),
|
|
288
288
|
/* @__PURE__ */ (0, t.jsx)(F, {
|
|
289
289
|
initial: !1,
|
|
290
290
|
children: u && x && /* @__PURE__ */ (0, t.jsx)(B.div, {
|
|
291
|
-
id:
|
|
291
|
+
id: y,
|
|
292
292
|
"data-slot": "workflow-step-panel",
|
|
293
293
|
initial: {
|
|
294
294
|
height: 0,
|
|
@@ -315,7 +315,7 @@ function D({ step: e, index: r, isLast: a, appearance: n = "contained", itemSlot
|
|
|
315
315
|
children: h
|
|
316
316
|
})]
|
|
317
317
|
})
|
|
318
|
-
}),
|
|
318
|
+
}), k && /* @__PURE__ */ (0, t.jsx)("div", {
|
|
319
319
|
className: m ? "mt-3" : void 0,
|
|
320
320
|
children: p.content
|
|
321
321
|
})]
|
|
@@ -327,7 +327,7 @@ function D({ step: e, index: r, isLast: a, appearance: n = "contained", itemSlot
|
|
|
327
327
|
className: "sr-only",
|
|
328
328
|
children: h
|
|
329
329
|
}),
|
|
330
|
-
|
|
330
|
+
v.hasConnector && !o && /* @__PURE__ */ (0, t.jsx)("div", {
|
|
331
331
|
"data-slot": "workflow-step-connector",
|
|
332
332
|
"aria-hidden": "true",
|
|
333
333
|
className: "absolute top-8 -bottom-3 start-6 w-px bg-border"
|
|
@@ -336,37 +336,37 @@ function D({ step: e, index: r, isLast: a, appearance: n = "contained", itemSlot
|
|
|
336
336
|
});
|
|
337
337
|
}
|
|
338
338
|
D.displayName = "WorkflowStepItem";
|
|
339
|
-
function se({ steps: e, appearance: r = "contained", itemSlot:
|
|
340
|
-
const l = d !== void 0, p = l ? [...d] : void 0, [
|
|
339
|
+
function se({ steps: e, appearance: r = "contained", itemSlot: o = "workflow-step-item", expandable: n = !0, activeStepId: s, expandedStepIds: d, defaultExpandedStepIds: u = [], onExpandedStepIdsChange: b, className: C, renderItems: y = !0 }) {
|
|
340
|
+
const l = d !== void 0, p = l ? [...d] : void 0, [k, h] = c.useState(() => j(u, e)), m = c.useRef(p ?? []), x = c.useRef(l), g = j(l ? d : k, e), N = new Set(g);
|
|
341
341
|
c.useLayoutEffect(() => {
|
|
342
342
|
p !== void 0 && (m.current = p);
|
|
343
343
|
}, [p]), c.useLayoutEffect(() => {
|
|
344
344
|
const i = x.current;
|
|
345
|
-
x.current = l, !l && h((
|
|
346
|
-
const w = j(i ? m.current :
|
|
347
|
-
return Z(w,
|
|
345
|
+
x.current = l, !l && h((a) => {
|
|
346
|
+
const w = j(i ? m.current : a, e);
|
|
347
|
+
return Z(w, a) ? a : w;
|
|
348
348
|
});
|
|
349
349
|
}, [l, e]);
|
|
350
|
-
const
|
|
351
|
-
const
|
|
352
|
-
|
|
353
|
-
const w = j([...
|
|
350
|
+
const v = (i) => {
|
|
351
|
+
const a = new Set(g);
|
|
352
|
+
a.has(i) ? a.delete(i) : a.add(i);
|
|
353
|
+
const w = j([...a], e);
|
|
354
354
|
l || h([...w]), b?.([...w]);
|
|
355
355
|
};
|
|
356
|
-
return
|
|
356
|
+
return y ? /* @__PURE__ */ (0, t.jsx)("ol", {
|
|
357
357
|
"data-slot": "workflow-step-list",
|
|
358
358
|
"data-appearance": r,
|
|
359
359
|
className: f("m-0 list-none p-0", C),
|
|
360
|
-
children: e.map((i,
|
|
360
|
+
children: e.map((i, a) => /* @__PURE__ */ (0, t.jsx)("li", { children: /* @__PURE__ */ (0, t.jsx)(D, {
|
|
361
361
|
step: i,
|
|
362
|
-
index:
|
|
363
|
-
isLast:
|
|
362
|
+
index: a,
|
|
363
|
+
isLast: a === e.length - 1,
|
|
364
364
|
appearance: r,
|
|
365
|
-
itemSlot:
|
|
365
|
+
itemSlot: o,
|
|
366
366
|
expandable: n,
|
|
367
367
|
expanded: N.has(i.id),
|
|
368
368
|
active: s === i.id,
|
|
369
|
-
onExpandedChange: () =>
|
|
369
|
+
onExpandedChange: () => v(i.id)
|
|
370
370
|
}) }, i.id))
|
|
371
371
|
}) : null;
|
|
372
372
|
}
|