@humain/ui 2.2.7 → 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
package/dist/wc/Kbd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as c } from "./rolldown-runtime.js";
|
|
2
|
-
import { i as
|
|
2
|
+
import { i as f, t as h } from "./vendor/react.js";
|
|
3
3
|
import { n as g } from "./utils.js";
|
|
4
4
|
import { t as p } from "./dist.js";
|
|
5
|
-
var m = /* @__PURE__ */ c(
|
|
5
|
+
var m = /* @__PURE__ */ c(f(), 1), e = h(), v = p("pointer-events-none inline-flex items-center justify-center select-none font-sans font-medium", {
|
|
6
6
|
variants: {
|
|
7
7
|
variant: {
|
|
8
8
|
default: "bg-muted text-muted-foreground border border-border rounded-sm shadow-[var(--shadow-kbd-default)]",
|
|
@@ -10,7 +10,7 @@ var m = /* @__PURE__ */ c(h(), 1), e = f(), v = p("pointer-events-none inline-fl
|
|
|
10
10
|
outline: "bg-transparent border border-border text-muted-foreground rounded-sm shadow-[var(--shadow-kbd-outline)]",
|
|
11
11
|
solid: "bg-card/60 border border-border text-muted-foreground rounded shadow-[var(--shadow-kbd-default)]",
|
|
12
12
|
tooltip: "bg-background/20 text-background dark:bg-background/10 rounded-sm",
|
|
13
|
-
footer: "bg-background border border-border text-
|
|
13
|
+
footer: "bg-background border border-border text-secondary-foreground rounded-md shadow-[var(--shadow-kbd-footer)]"
|
|
14
14
|
},
|
|
15
15
|
size: {
|
|
16
16
|
xs: "h-4 min-w-4 px-0.5 text-[10px]",
|
|
@@ -32,19 +32,19 @@ var m = /* @__PURE__ */ c(h(), 1), e = f(), v = p("pointer-events-none inline-fl
|
|
|
32
32
|
lg: "gap-2"
|
|
33
33
|
} },
|
|
34
34
|
defaultVariants: { gap: "sm" }
|
|
35
|
-
}),
|
|
35
|
+
}), l = m.forwardRef(({ className: r, variant: a, size: s, icon: t, iconAfter: n, children: o, ...i }, d) => /* @__PURE__ */ (0, e.jsxs)("kbd", {
|
|
36
36
|
ref: d,
|
|
37
37
|
"data-slot": "kbd",
|
|
38
38
|
className: g(v({
|
|
39
|
-
variant:
|
|
39
|
+
variant: a,
|
|
40
40
|
size: s
|
|
41
41
|
}), r),
|
|
42
42
|
...i,
|
|
43
43
|
children: [
|
|
44
|
-
|
|
44
|
+
t && /* @__PURE__ */ (0, e.jsx)("span", {
|
|
45
45
|
"aria-hidden": "true",
|
|
46
46
|
className: "shrink-0 [&_svg:not([class*='size-'])]:size-3",
|
|
47
|
-
children:
|
|
47
|
+
children: t
|
|
48
48
|
}),
|
|
49
49
|
o,
|
|
50
50
|
n && /* @__PURE__ */ (0, e.jsx)("span", {
|
|
@@ -54,36 +54,36 @@ var m = /* @__PURE__ */ c(h(), 1), e = f(), v = p("pointer-events-none inline-fl
|
|
|
54
54
|
})
|
|
55
55
|
]
|
|
56
56
|
}));
|
|
57
|
-
|
|
58
|
-
var
|
|
59
|
-
ref:
|
|
57
|
+
l.displayName = "Kbd";
|
|
58
|
+
var x = m.forwardRef(({ className: r, gap: a, ...s }, t) => /* @__PURE__ */ (0, e.jsx)("span", {
|
|
59
|
+
ref: t,
|
|
60
60
|
"data-slot": "kbd-group",
|
|
61
|
-
className: g(w({ gap:
|
|
61
|
+
className: g(w({ gap: a }), r),
|
|
62
62
|
...s
|
|
63
63
|
}));
|
|
64
|
-
|
|
65
|
-
function b(r,
|
|
66
|
-
return `${
|
|
64
|
+
x.displayName = "KbdGroup";
|
|
65
|
+
function b(r, a) {
|
|
66
|
+
return `${a}:${typeof r == "string" ? r : "node"}`;
|
|
67
67
|
}
|
|
68
|
-
var j = m.forwardRef(({ keys: r, separator:
|
|
68
|
+
var j = m.forwardRef(({ keys: r, separator: a, className: s, variant: t, size: n, ...o }, i) => a ? /* @__PURE__ */ (0, e.jsx)(x, {
|
|
69
69
|
ref: i,
|
|
70
70
|
gap: "xs",
|
|
71
71
|
className: s,
|
|
72
|
-
children: r.map((d, u) => /* @__PURE__ */ (0, e.jsxs)(m.Fragment, { children: [/* @__PURE__ */ (0, e.jsx)(
|
|
73
|
-
variant:
|
|
72
|
+
children: r.map((d, u) => /* @__PURE__ */ (0, e.jsxs)(m.Fragment, { children: [/* @__PURE__ */ (0, e.jsx)(l, {
|
|
73
|
+
variant: t,
|
|
74
74
|
size: n,
|
|
75
75
|
...o,
|
|
76
76
|
children: d
|
|
77
77
|
}), u < r.length - 1 && /* @__PURE__ */ (0, e.jsx)("span", {
|
|
78
78
|
className: "text-muted-foreground text-xs",
|
|
79
|
-
children:
|
|
79
|
+
children: a
|
|
80
80
|
})] }, b(d, u)))
|
|
81
|
-
}) : /* @__PURE__ */ (0, e.jsx)(
|
|
81
|
+
}) : /* @__PURE__ */ (0, e.jsx)(x, {
|
|
82
82
|
ref: i,
|
|
83
83
|
gap: "xs",
|
|
84
84
|
className: s,
|
|
85
|
-
children: r.map((d, u) => /* @__PURE__ */ (0, e.jsx)(
|
|
86
|
-
variant:
|
|
85
|
+
children: r.map((d, u) => /* @__PURE__ */ (0, e.jsx)(l, {
|
|
86
|
+
variant: t,
|
|
87
87
|
size: n,
|
|
88
88
|
...o,
|
|
89
89
|
children: d
|
|
@@ -91,7 +91,7 @@ var j = m.forwardRef(({ keys: r, separator: t, className: s, variant: a, size: n
|
|
|
91
91
|
}));
|
|
92
92
|
j.displayName = "Shortcut";
|
|
93
93
|
export {
|
|
94
|
-
|
|
94
|
+
l as t
|
|
95
95
|
};
|
|
96
96
|
|
|
97
97
|
//# sourceMappingURL=Kbd.js.map
|
package/dist/wc/Kbd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Kbd.js","names":[],"sources":["../../src/components/molecules/data/Kbd/Kbd.tsx"],"sourcesContent":["'use client';\n\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport * as React from 'react';\n\nimport { cn } from '@/lib/utils';\n\n// ============================================\n// Variants\n// ============================================\n\nexport const kbdVariants = cva(\n 'pointer-events-none inline-flex items-center justify-center select-none font-sans font-medium',\n {\n variants: {\n variant: {\n default:\n 'bg-muted text-muted-foreground border border-border rounded-sm shadow-[var(--shadow-kbd-default)]',\n ghost: 'bg-transparent text-muted-foreground',\n outline:\n 'bg-transparent border border-border text-muted-foreground rounded-sm shadow-[var(--shadow-kbd-outline)]',\n solid:\n 'bg-card/60 border border-border text-muted-foreground rounded shadow-[var(--shadow-kbd-default)]',\n tooltip:\n 'bg-background/20 text-background dark:bg-background/10 rounded-sm',\n footer:\n 'bg-background border border-border text-
|
|
1
|
+
{"version":3,"file":"Kbd.js","names":[],"sources":["../../src/components/molecules/data/Kbd/Kbd.tsx"],"sourcesContent":["'use client';\n\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport * as React from 'react';\n\nimport { cn } from '@/lib/utils';\n\n// ============================================\n// Variants\n// ============================================\n\nexport const kbdVariants = cva(\n 'pointer-events-none inline-flex items-center justify-center select-none font-sans font-medium',\n {\n variants: {\n variant: {\n default:\n 'bg-muted text-muted-foreground border border-border rounded-sm shadow-[var(--shadow-kbd-default)]',\n ghost: 'bg-transparent text-muted-foreground',\n outline:\n 'bg-transparent border border-border text-muted-foreground rounded-sm shadow-[var(--shadow-kbd-outline)]',\n solid:\n 'bg-card/60 border border-border text-muted-foreground rounded shadow-[var(--shadow-kbd-default)]',\n tooltip:\n 'bg-background/20 text-background dark:bg-background/10 rounded-sm',\n footer:\n 'bg-background border border-border text-secondary-foreground rounded-md shadow-[var(--shadow-kbd-footer)]',\n },\n size: {\n xs: 'h-4 min-w-4 px-0.5 text-[10px]',\n sm: 'h-5 min-w-5 px-1 text-xs',\n md: 'h-6 min-w-6 px-1.5 text-sm',\n lg: 'h-7 min-w-7 px-2 text-sm',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'sm',\n },\n },\n);\n\nexport const kbdGroupVariants = cva('inline-flex items-center', {\n variants: {\n gap: {\n none: 'gap-0',\n xs: 'gap-0.5',\n sm: 'gap-1',\n md: 'gap-1.5',\n lg: 'gap-2',\n },\n },\n defaultVariants: {\n gap: 'sm',\n },\n});\n\n// ============================================\n// Types\n// ============================================\n\nexport interface KbdProps\n extends React.ComponentProps<'kbd'>,\n VariantProps<typeof kbdVariants> {\n /** Icon to display before the key */\n icon?: React.ReactNode;\n /** Icon to display after the key */\n iconAfter?: React.ReactNode;\n}\n\nexport interface KbdGroupProps\n extends React.ComponentProps<'span'>,\n VariantProps<typeof kbdGroupVariants> {}\n\n// ============================================\n// Kbd Component\n// ============================================\n\n/**\n * Keyboard key indicator component for displaying keyboard shortcuts.\n *\n * @example\n * // Basic usage\n * <Kbd>⌘K</Kbd>\n *\n * @example\n * // With variant and size\n * <Kbd variant=\"solid\" size=\"md\">⌘</Kbd>\n *\n * @example\n * // With icon\n * <Kbd icon={<ArrowUp />} />\n */\nconst Kbd = React.forwardRef<HTMLElement, KbdProps>(\n ({ className, variant, size, icon, iconAfter, children, ...props }, ref) => {\n return (\n <kbd\n ref={ref}\n data-slot=\"kbd\"\n className={cn(kbdVariants({ variant, size }), className)}\n {...props}\n >\n {icon && (\n <span\n aria-hidden=\"true\"\n className=\"shrink-0 [&_svg:not([class*='size-'])]:size-3\"\n >\n {icon}\n </span>\n )}\n {children}\n {iconAfter && (\n <span\n aria-hidden=\"true\"\n className=\"shrink-0 [&_svg:not([class*='size-'])]:size-3\"\n >\n {iconAfter}\n </span>\n )}\n </kbd>\n );\n },\n);\nKbd.displayName = 'Kbd';\n\n// ============================================\n// KbdGroup Component\n// ============================================\n\n/**\n * Group multiple Kbd components together with consistent spacing.\n *\n * @example\n * <KbdGroup>\n * <Kbd>⌘</Kbd>\n * <Kbd>K</Kbd>\n * </KbdGroup>\n */\nconst KbdGroup = React.forwardRef<HTMLSpanElement, KbdGroupProps>(\n ({ className, gap, ...props }, ref) => {\n return (\n <span\n ref={ref}\n data-slot=\"kbd-group\"\n className={cn(kbdGroupVariants({ gap }), className)}\n {...props}\n />\n );\n },\n);\nKbdGroup.displayName = 'KbdGroup';\n\n// ============================================\n// Shortcut Component (convenience wrapper)\n// ============================================\n\nexport interface ShortcutProps extends Omit<KbdProps, 'children'> {\n /** Array of keys to display (e.g., ['⌘', 'K']) */\n keys: (string | React.ReactNode)[];\n /** Separator between keys (defaults to none, keys are grouped) */\n separator?: React.ReactNode;\n}\n\nfunction getShortcutPartKey(\n key: string | React.ReactNode,\n position: number,\n): string {\n return `${position}:${typeof key === 'string' ? key : 'node'}`;\n}\n\n/**\n * Convenience component for displaying keyboard shortcuts with multiple keys.\n *\n * @example\n * // Simple shortcut\n * <Shortcut keys={['⌘', 'K']} />\n *\n * @example\n * // With separator\n * <Shortcut keys={['⌘', 'Shift', 'P']} separator=\"+\" />\n */\nconst Shortcut = React.forwardRef<HTMLSpanElement, ShortcutProps>(\n ({ keys, separator, className, variant, size, ...props }, ref) => {\n if (separator) {\n return (\n <KbdGroup ref={ref} gap=\"xs\" className={className}>\n {keys.map((key, position) => (\n <React.Fragment key={getShortcutPartKey(key, position)}>\n <Kbd variant={variant} size={size} {...props}>\n {key}\n </Kbd>\n {position < keys.length - 1 && (\n <span className=\"text-muted-foreground text-xs\">\n {separator}\n </span>\n )}\n </React.Fragment>\n ))}\n </KbdGroup>\n );\n }\n\n return (\n <KbdGroup ref={ref} gap=\"xs\" className={className}>\n {keys.map((key, position) => (\n <Kbd\n key={getShortcutPartKey(key, position)}\n variant={variant}\n size={size}\n {...props}\n >\n {key}\n </Kbd>\n ))}\n </KbdGroup>\n );\n },\n);\nShortcut.displayName = 'Shortcut';\n\n// ============================================\n// Platform-aware helpers\n// ============================================\n\n/**\n * Common keyboard key symbols for macOS\n */\nexport const MAC_KEYS = {\n cmd: '⌘',\n command: '⌘',\n ctrl: '⌃',\n control: '⌃',\n alt: '⌥',\n option: '⌥',\n shift: '⇧',\n enter: '↵',\n return: '↵',\n backspace: '⌫',\n delete: '⌦',\n tab: '⇥',\n esc: 'esc',\n escape: 'esc',\n up: '↑',\n down: '↓',\n left: '←',\n right: '→',\n space: '␣',\n} as const;\n\n/**\n * Common keyboard key symbols for Windows/Linux\n */\nexport const WIN_KEYS = {\n cmd: 'Ctrl',\n command: 'Ctrl',\n ctrl: 'Ctrl',\n control: 'Ctrl',\n alt: 'Alt',\n option: 'Alt',\n shift: 'Shift',\n enter: 'Enter',\n return: 'Enter',\n backspace: 'Backspace',\n delete: 'Delete',\n tab: 'Tab',\n esc: 'Esc',\n escape: 'Esc',\n up: '↑',\n down: '↓',\n left: '←',\n right: '→',\n space: 'Space',\n} as const;\n\n// ============================================\n// Exports\n// ============================================\n\nexport { Kbd, KbdGroup, Shortcut };\n"],"mappings":";;;;4CAWa,IAAc,EACzB,iGACA;AAAA,EACE,UAAU;AAAA,IACR,SAAS;AAAA,MACP,SACE;AAAA,MACF,OAAO;AAAA,MACP,SACE;AAAA,MACF,OACE;AAAA,MACF,SACE;AAAA,MACF,QACE;AAAA,IACJ;AAAA,IACA,MAAM;AAAA,MACJ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Q;AACR,SAAO,GAAG,CAAA,IAAY,OAAO,KAAQ,WAAW,IAAM,MAAA;AACxD;AAaA,IAAM,IAAA,EAAiB,WAAA,CACpB,EAAE,MAAA,GAAM,WAAA,GAAW,WAAA,GAAW,SAAA,GAAS,MAAA,GAAM,GAAG,EAAA,GAAS,MACpD,IAEA,oBAAA,EAAA,KAAC,GAAD;AAAA,EAAe,KAAA;AAAA,EAAK,KAAI;AAAA,EAAgB,WAAA;AAAA,YACrC,EAAK,IAAA,CAAK,GAAK,MACd,oBAAA,EAAA,MAAA,EAAO,UAAP,EAAA,UAAA,CACE,oBAAA,EAAA,KAAC,GAAD;AAAA,IAAc,SAAA;AAAA,IAAe,MAAA;AAAA,IAAM,GAAI;AAAA,cACpC;AAAA,EACE,CAAA,GACJ,IAAW,EAAK,SAAS,KACxB,oBAAA,EAAA,KAAC,QAAD;AAAA,IAAM,WAAU;AAAA,cACb;AAAA,EACG,CAAA,CAEM,EAAA,GATK,EAAmB,GAAK,CAAQ,CASrC,CACjB;AACO,CAAA,IAKZ,oBAAA,EAAA,KAAC,GAAD;AAAA,EAAe,KAAA;AAAA,EAAK,KAAI;AAAA,EAAgB,WAAA;AAAA,YACrC,EAAK,IAAA,CAAK,GAAK,MACd,oBAAA,EAAA,KAAC,GAAD;AAAA,IAEW,SAAA;AAAA,IACH,MAAA;AAAA,IACN,GAAI;AAAA,cAEH;AAAA,EACE,GANE,EAAmB,GAAK,CAAQ,CAMlC,CACN;AACO,CAAA,CAGhB;AACA,EAAS,cAAc"}
|
package/dist/wc/button.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { i as
|
|
1
|
+
import { a as F } from "./rolldown-runtime.js";
|
|
2
|
+
import { i as T, t as q } from "./vendor/react.js";
|
|
3
3
|
import { n } from "./utils.js";
|
|
4
4
|
import { t as R } from "./check.js";
|
|
5
5
|
import { t as M } from "./x.js";
|
|
@@ -7,7 +7,7 @@ import { t as P } from "./useRenderElement.js";
|
|
|
7
7
|
import { t as U } from "./dist.js";
|
|
8
8
|
import { t as W } from "./useButton.js";
|
|
9
9
|
import { n as G, t as V } from "./spinner.js";
|
|
10
|
-
var l = /* @__PURE__ */
|
|
10
|
+
var l = /* @__PURE__ */ F(T(), 1), _ = /* @__PURE__ */ l.forwardRef(function(e, s) {
|
|
11
11
|
const { render: o, className: d, disabled: p = !1, focusableWhenDisabled: x = !1, nativeButton: i = !0, style: j, ...h } = e, { getButtonProps: g, buttonRef: y } = W({
|
|
12
12
|
disabled: p,
|
|
13
13
|
focusableWhenDisabled: x,
|
|
@@ -18,7 +18,7 @@ var l = /* @__PURE__ */ D(F(), 1), _ = /* @__PURE__ */ l.forwardRef(function(e,
|
|
|
18
18
|
ref: [s, y],
|
|
19
19
|
props: [h, g]
|
|
20
20
|
});
|
|
21
|
-
}), a =
|
|
21
|
+
}), a = q(), c = "focus-visible:scale-[1.015] motion-reduce:focus-visible:scale-100", H = U("focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-[3px] aria-invalid:ring-[3px] [&_svg:not([class*='size-'])]:size-4 inline-flex origin-center items-center justify-center whitespace-nowrap transition-[color,background-color,border-color,box-shadow,transform,opacity] duration-200 ease-smooth motion-reduce:transition-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none group/button select-none", {
|
|
22
22
|
variants: {
|
|
23
23
|
appearance: {
|
|
24
24
|
solid: `${c} delight-click-ripple`,
|
|
@@ -349,13 +349,13 @@ var A = l.forwardRef(({ children: r, loading: e = !1, disabled: s, startIcon: o,
|
|
|
349
349
|
}
|
|
350
350
|
l.useEffect(() => {
|
|
351
351
|
if (!t.visible) return;
|
|
352
|
-
const b = t.token,
|
|
352
|
+
const b = t.token, D = setTimeout(() => {
|
|
353
353
|
$((z) => z.token === b ? {
|
|
354
354
|
...z,
|
|
355
355
|
visible: !1
|
|
356
356
|
} : z);
|
|
357
357
|
}, J);
|
|
358
|
-
return () => clearTimeout(
|
|
358
|
+
return () => clearTimeout(D);
|
|
359
359
|
}, [t.visible, t.token]);
|
|
360
360
|
const f = t.visible && !e, m = N === "ai", I = m ? h ?? e : !1, w = n(H({
|
|
361
361
|
appearance: N,
|
|
@@ -424,7 +424,7 @@ function re({ className: r, size: e = "icon-sm", ...s }) {
|
|
|
424
424
|
variant: "secondary",
|
|
425
425
|
size: e,
|
|
426
426
|
iconOnly: !0,
|
|
427
|
-
className: n("text-
|
|
427
|
+
className: n("text-muted-foreground hover:text-secondary-foreground", r),
|
|
428
428
|
"aria-label": "Clear",
|
|
429
429
|
...s,
|
|
430
430
|
children: /* @__PURE__ */ (0, a.jsx)(M, {})
|
package/dist/wc/button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","names":["Button"],"sources":["../../../../../../../../../../../Users/akarim/Documents/test/humain_foundation_ui/node_modules/.bun/@base-ui+react@1.6.0+1c528c44af60ea5b/node_modules/@base-ui/react/button/Button.mjs","../../src/components/ui/button.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useButton } from \"../internals/use-button/useButton.mjs\";\nimport { useRenderElement } from \"../internals/useRenderElement.mjs\";\n/**\n * A button component that can be used to trigger actions.\n * Renders a `<button>` element.\n *\n * Documentation: [Base UI Button](https://base-ui.com/react/components/button)\n */\nexport const Button = /*#__PURE__*/React.forwardRef(function Button(componentProps, forwardedRef) {\n const {\n render,\n className,\n disabled = false,\n focusableWhenDisabled = false,\n nativeButton = true,\n style,\n ...elementProps\n } = componentProps;\n const {\n getButtonProps,\n buttonRef\n } = useButton({\n disabled,\n focusableWhenDisabled,\n native: nativeButton\n });\n const state = {\n disabled\n };\n return useRenderElement('button', componentProps, {\n state,\n ref: [forwardedRef, buttonRef],\n props: [elementProps, getButtonProps]\n });\n});\nif (process.env.NODE_ENV !== \"production\") Button.displayName = \"Button\";","import { Button as ButtonPrimitive } from '@base-ui/react/button';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { Check, X } from 'lucide-react';\nimport * as React from 'react';\nimport { GradientBorder } from '@/components/ui/gradient-border';\nimport { Spinner } from '@/components/ui/spinner';\nimport { cn } from '@/lib/utils';\n\nconst buttonFocusExpansionClassName =\n 'focus-visible:scale-[1.015] motion-reduce:focus-visible:scale-100';\n\nconst buttonVariants = cva(\n \"focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-[3px] aria-invalid:ring-[3px] [&_svg:not([class*='size-'])]:size-4 inline-flex origin-center items-center justify-center whitespace-nowrap transition-[color,background-color,border-color,box-shadow,transform,opacity] duration-200 ease-smooth motion-reduce:transition-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none group/button select-none\",\n {\n variants: {\n appearance: {\n solid: `${buttonFocusExpansionClassName} delight-click-ripple`,\n gradient: `${buttonFocusExpansionClassName} bg-linear-[113deg] hover:opacity-80 delight-click-ripple`,\n soft: `${buttonFocusExpansionClassName} delight-click-ripple`,\n outline: `${buttonFocusExpansionClassName} bg-background shadow-xs`,\n ghost: `${buttonFocusExpansionClassName} bg-transparent`,\n link: 'border-none bg-transparent p-0 h-auto underline-offset-4 hover:underline focus-visible:ring-0 focus-visible:border-transparent',\n ai: `${buttonFocusExpansionClassName} bg-transparent border-0`,\n },\n variant: {\n primary: '',\n secondary: '',\n info: '',\n success: '',\n warning: '',\n destructive: '',\n },\n size: {\n default:\n 'h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2',\n xs: \"h-6 gap-1 px-2 text-xs has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3\",\n sm: 'h-8 gap-1 px-2.5 has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5',\n md: 'h-10 gap-1.5 px-3.5 has-data-[icon=inline-end]:pe-3 has-data-[icon=inline-start]:ps-3',\n lg: 'h-11 gap-2 px-4 has-data-[icon=inline-end]:pe-3.5 has-data-[icon=inline-start]:ps-3.5',\n xl: \"h-12 gap-2 px-4.5 text-base has-data-[icon=inline-end]:pe-4 has-data-[icon=inline-start]:ps-4 [&_svg:not([class*='size-'])]:size-5\",\n '2xl':\n \"h-14 gap-2.5 px-5 text-lg has-data-[icon=inline-end]:pe-4.5 has-data-[icon=inline-start]:ps-4.5 [&_svg:not([class*='size-'])]:size-6\",\n icon: 'size-9',\n 'icon-xs': \"size-6 [&_svg:not([class*='size-'])]:size-3\",\n 'icon-sm': 'size-8',\n 'icon-lg': 'size-10',\n 'icon-xl': \"size-12 [&_svg:not([class*='size-'])]:size-5\",\n 'icon-2xl': \"size-14 [&_svg:not([class*='size-'])]:size-6\",\n },\n shape: {\n rounded: 'rounded-md',\n round: 'rounded-full',\n },\n },\n compoundVariants: [\n // ===== SOLID =====\n {\n appearance: 'solid',\n variant: 'primary',\n className: 'bg-primary text-primary-foreground hover:bg-primary-hover',\n },\n {\n appearance: 'solid',\n variant: 'secondary',\n className:\n 'bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground',\n },\n {\n appearance: 'solid',\n variant: 'info',\n className: 'bg-info text-info-foreground hover:bg-info/80',\n },\n {\n appearance: 'solid',\n variant: 'success',\n className: 'bg-success text-success-foreground hover:bg-success/80',\n },\n {\n appearance: 'solid',\n variant: 'warning',\n className: 'bg-warning text-warning-foreground hover:bg-warning/80',\n },\n {\n appearance: 'solid',\n variant: 'destructive',\n className:\n 'bg-destructive text-destructive-foreground hover:bg-destructive/80',\n },\n\n // ===== GRADIENT =====\n {\n appearance: 'gradient',\n variant: 'primary',\n className:\n 'from-custom-tw-gradient-from to-custom-tw-gradient-to text-primary-foreground hover:from-custom-tw-gradient-to hover:to-custom-tw-gradient-from',\n },\n {\n appearance: 'gradient',\n variant: 'secondary',\n className:\n 'from-secondary to-secondary/60 text-secondary-foreground hover:from-secondary/60 hover:to-secondary',\n },\n {\n appearance: 'gradient',\n variant: 'info',\n className:\n 'from-info to-info/60 text-info-foreground hover:from-info/60 hover:to-info',\n },\n {\n appearance: 'gradient',\n variant: 'success',\n className:\n 'from-success to-success/60 text-success-foreground hover:from-success/60 hover:to-success',\n },\n {\n appearance: 'gradient',\n variant: 'warning',\n className:\n 'from-warning to-warning/60 text-warning-foreground hover:from-warning/60 hover:to-warning',\n },\n {\n appearance: 'gradient',\n variant: 'destructive',\n className:\n 'from-destructive to-destructive/60 text-destructive-foreground hover:from-destructive/60 hover:to-destructive',\n },\n\n // ===== SOFT =====\n {\n appearance: 'soft',\n variant: 'primary',\n className:\n 'bg-primary/10 border-primary text-primary hover:bg-primary/20 hover:text-primary dark:bg-primary/30 dark:border-primary dark:text-primary dark:hover:bg-primary/50 shadow-xs',\n },\n {\n appearance: 'soft',\n variant: 'secondary',\n className:\n 'bg-secondary/10 text-secondary-foreground hover:bg-secondary/20',\n },\n {\n appearance: 'soft',\n variant: 'info',\n className: 'bg-info/10 text-info hover:bg-info/20',\n },\n {\n appearance: 'soft',\n variant: 'success',\n className: 'bg-success/10 text-success hover:bg-success/20',\n },\n {\n appearance: 'soft',\n variant: 'warning',\n className: 'bg-warning/10 text-warning hover:bg-warning/20',\n },\n {\n appearance: 'soft',\n variant: 'destructive',\n className:\n 'bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30',\n },\n\n // ===== OUTLINE =====\n {\n appearance: 'outline',\n className:\n 'bg-card border-border backdrop-blur-[2px] shadow-none supports-backdrop-filter:backdrop-blur-[2px]',\n },\n {\n appearance: 'outline',\n shape: 'rounded',\n className: 'rounded-xl',\n },\n {\n appearance: 'outline',\n size: 'xs',\n className: 'h-[26px] gap-1 px-2',\n },\n {\n appearance: 'outline',\n size: 'sm',\n className: 'h-8 gap-1.5 px-2.5',\n },\n {\n appearance: 'outline',\n size: 'default',\n className: 'h-9 gap-2 px-4',\n },\n {\n appearance: 'outline',\n size: 'md',\n className: 'h-10 gap-2 px-4',\n },\n {\n appearance: 'outline',\n size: 'lg',\n className: 'h-10 gap-2 px-4.5',\n },\n {\n appearance: 'outline',\n variant: 'primary',\n className: 'border-border text-foreground hover:bg-muted/50',\n },\n {\n appearance: 'outline',\n variant: 'secondary',\n className:\n 'border-border text-secondary-foreground hover:bg-muted/50 aria-expanded:bg-muted/50 aria-expanded:text-foreground',\n },\n {\n appearance: 'outline',\n variant: 'info',\n className: 'border-border text-info hover:bg-info/10',\n },\n {\n appearance: 'outline',\n variant: 'success',\n className: 'border-border text-success hover:bg-success/10',\n },\n {\n appearance: 'outline',\n variant: 'warning',\n className: 'border-border text-warning hover:bg-warning/10',\n },\n {\n appearance: 'outline',\n variant: 'destructive',\n className: 'border-border text-destructive hover:bg-destructive/10',\n },\n\n // ===== GHOST =====\n {\n appearance: 'ghost',\n variant: 'primary',\n className: 'text-primary hover:bg-primary/10',\n },\n {\n appearance: 'ghost',\n variant: 'secondary',\n className:\n 'hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground',\n },\n {\n appearance: 'ghost',\n variant: 'info',\n className: 'text-info hover:bg-info/10',\n },\n {\n appearance: 'ghost',\n variant: 'success',\n className: 'text-success hover:bg-success/10',\n },\n {\n appearance: 'ghost',\n variant: 'warning',\n className: 'text-warning hover:bg-warning/10',\n },\n {\n appearance: 'ghost',\n variant: 'destructive',\n className: 'text-destructive hover:bg-destructive/10',\n },\n\n // ===== AI (inner button styling — GradientBorder wraps externally) =====\n {\n appearance: 'ai',\n variant: 'primary',\n className: 'text-primary hover:bg-primary/10',\n },\n {\n appearance: 'ai',\n variant: 'secondary',\n className: 'text-secondary-foreground hover:bg-muted',\n },\n\n // ===== LINK =====\n { appearance: 'link', variant: 'primary', className: 'text-primary' },\n {\n appearance: 'link',\n variant: 'secondary',\n className: 'text-secondary-foreground',\n },\n { appearance: 'link', variant: 'info', className: 'text-info' },\n { appearance: 'link', variant: 'success', className: 'text-success' },\n { appearance: 'link', variant: 'warning', className: 'text-warning' },\n {\n appearance: 'link',\n variant: 'destructive',\n className: 'text-destructive hover:text-destructive/80',\n },\n ],\n defaultVariants: {\n appearance: 'solid',\n variant: 'primary',\n size: 'default',\n shape: 'rounded',\n },\n },\n);\n\ntype DotColor = 'success' | 'error' | 'warning' | 'brand' | 'gray';\n\ntype ButtonAppearance =\n | 'solid'\n | 'gradient'\n | 'soft'\n | 'outline'\n | 'ghost'\n | 'link'\n | 'ai';\ntype ButtonVariant =\n | 'primary'\n | 'secondary'\n | 'info'\n | 'success'\n | 'warning'\n | 'destructive';\ntype ButtonShape = 'rounded' | 'round';\n\n/**\n * Render prop type for polymorphic rendering.\n * Accepts either a React element or a function that receives props and returns an element.\n * @template Props The props to be passed to the rendered element\n */\ntype RenderProp<Props> =\n | React.ReactElement\n | ((props: Props) => React.ReactElement);\n\nexport interface ButtonProps\n extends React.ComponentProps<'button'>,\n Pick<VariantProps<typeof buttonVariants>, 'size'> {\n /** Visual appearance - how the button renders */\n appearance?: ButtonAppearance;\n /** Semantic variant - what the button means */\n variant?: ButtonVariant;\n /** Shape of the button corners */\n shape?: ButtonShape;\n /** Shows a loading spinner and disables the button */\n loading?: boolean;\n /** Set to false when render targets a non-button element. */\n nativeButton?: boolean;\n /** Icon displayed at the start (inline-start) of the button text - respects RTL */\n startIcon?: React.ReactNode;\n /** Icon displayed at the end (inline-end) of the button text - respects RTL */\n endIcon?: React.ReactNode;\n /** Shows a colored dot indicator before the button text */\n dotIndicator?: boolean;\n /** Color of the dot indicator */\n dotColor?: DotColor;\n /** Badge content displayed after the button label. Text badges are styled from the button appearance and variant. */\n badge?: React.ReactNode;\n /** For icon-only buttons - renders just the icon without text wrapper */\n iconOnly?: boolean;\n /** Enables animated gradient border (only for appearance=\"ai\"). Auto-true when loading. */\n animated?: boolean;\n /**\n * Render prop for polymorphic rendering. Accepts either a React element or a render function.\n * Use this to render the button as a different element (e.g., link) while preserving button styles.\n * Note: When render is provided, loading/startIcon/endIcon/dotIndicator/badge are ignored.\n */\n render?: RenderProp<React.ComponentProps<'button'>>;\n}\n\nconst dotColorClasses: Record<DotColor, string> = {\n success: 'bg-success',\n error: 'bg-destructive',\n warning: 'bg-warning',\n brand: 'bg-primary',\n gray: 'bg-muted',\n};\n\nconst devWarnings = new Set<string>();\n\n/** Icon-only size variants for type-safe detection */\nconst ICON_SIZES = [\n 'icon',\n 'icon-xs',\n 'icon-sm',\n 'icon-lg',\n 'icon-xl',\n 'icon-2xl',\n] as const;\n\nconst SUCCESS_FLASH_DURATION_MS = 600;\n\nconst buttonBadgeShapeClasses: Record<ButtonShape, string> = {\n round: 'rounded-full',\n rounded: 'rounded-sm',\n};\n\nconst buttonBadgeWhiteColorClasses: Record<ButtonVariant, string> = {\n primary: 'text-primary',\n secondary: 'text-secondary-foreground',\n info: 'text-info',\n success: 'text-success',\n warning: 'text-warning',\n destructive: 'text-destructive',\n};\n\nconst buttonBadgeSoftColorClasses: Record<ButtonVariant, string> = {\n primary:\n 'bg-soft-primary text-soft-primary-foreground hover:bg-opacity-primary-20 dark:bg-soft-primary dark:text-soft-primary-foreground',\n secondary:\n 'bg-soft-secondary text-soft-secondary-foreground hover:bg-opacity-secondary-20 dark:bg-soft-secondary dark:text-soft-secondary-foreground',\n info: 'bg-soft-info text-soft-info-foreground hover:bg-opacity-info-20 dark:bg-soft-info dark:text-soft-info-foreground',\n success:\n 'bg-soft-success text-soft-success-foreground hover:bg-opacity-success-20 dark:bg-soft-success dark:text-soft-success-foreground',\n warning:\n 'bg-soft-warning text-soft-warning-foreground hover:bg-opacity-warning-20 dark:bg-soft-warning dark:text-soft-warning-foreground',\n destructive:\n 'bg-soft-destructive text-soft-destructive-foreground hover:bg-opacity-destructive-20 dark:bg-soft-destructive dark:text-soft-destructive-foreground',\n};\n\ntype LoadingSuccessState = {\n wasLoading: boolean;\n visible: boolean;\n token: number;\n};\n\nconst Dot = ({\n color = 'success',\n className,\n}: {\n color?: DotColor;\n className?: string;\n}) => (\n <span\n aria-hidden=\"true\"\n className={cn(\n 'size-2 rounded-full shrink-0 delight-breathing',\n dotColorClasses[color],\n className,\n )}\n />\n);\n\nfunction ButtonBadge({\n appearance,\n badge,\n shape,\n variant,\n}: {\n appearance: ButtonAppearance;\n badge: React.ReactNode;\n shape: ButtonShape;\n variant: ButtonVariant;\n}) {\n if (React.isValidElement(badge)) {\n return badge;\n }\n\n if (badge === true || badge === false || badge == null) {\n return null;\n }\n\n const badgeVariant =\n (appearance === 'solid' || appearance === 'gradient') &&\n variant !== 'secondary'\n ? 'white'\n : 'soft';\n\n return (\n <span\n data-slot=\"badge\"\n className={cn(\n 'inline-flex h-5 shrink-0 items-center justify-center gap-1.5 whitespace-nowrap px-2 py-0.5 text-xs font-medium transition-colors [&>svg]:size-3 [&>svg]:shrink-0 [&>svg]:pointer-events-none',\n buttonBadgeShapeClasses[shape],\n badgeVariant === 'white'\n ? 'bg-opacity-white-80 transition-opacity hover:opacity-80 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-current/50'\n : buttonBadgeSoftColorClasses[variant],\n badgeVariant === 'white' && buttonBadgeWhiteColorClasses[variant],\n )}\n >\n {badge}\n </span>\n );\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n children,\n loading = false,\n disabled,\n startIcon,\n endIcon,\n dotIndicator = false,\n dotColor = 'success',\n badge,\n iconOnly = false,\n animated,\n render,\n className,\n appearance = 'solid',\n variant = 'primary',\n shape = 'rounded',\n size = 'default',\n ...props\n },\n ref,\n ) => {\n // Dev-mode warning for icon-only buttons missing accessible label (once)\n if (\n process.env.NODE_ENV !== 'production' &&\n !devWarnings.has('icon-a11y')\n ) {\n const hasIconSize = ICON_SIZES.includes(\n size as (typeof ICON_SIZES)[number],\n );\n if (\n (iconOnly || hasIconSize) &&\n !props['aria-label'] &&\n !props['aria-labelledby']\n ) {\n devWarnings.add('icon-a11y');\n console.warn(\n 'Button: Icon-only buttons require an `aria-label` or `aria-labelledby` for accessibility.',\n );\n }\n }\n\n // Track loading→done transition before paint so the button never commits a\n // stale success state after the loading prop changes.\n const [successState, setSuccessState] = React.useState<LoadingSuccessState>(\n () => ({\n wasLoading: loading,\n visible: false,\n token: 0,\n }),\n );\n\n if (successState.wasLoading !== loading) {\n const shouldFlash = successState.wasLoading && !loading;\n setSuccessState({\n wasLoading: loading,\n visible: shouldFlash,\n token: shouldFlash ? successState.token + 1 : successState.token,\n });\n }\n\n React.useEffect(() => {\n if (!successState.visible) return;\n const token = successState.token;\n const timer = setTimeout(() => {\n setSuccessState((current) =>\n current.token === token ? { ...current, visible: false } : current,\n );\n }, SUCCESS_FLASH_DURATION_MS);\n return () => clearTimeout(timer);\n }, [successState.visible, successState.token]);\n\n const showSuccess = successState.visible && !loading;\n\n const isAi = appearance === 'ai';\n const isAnimated = isAi ? (animated ?? loading) : false;\n\n const buttonClassName = cn(\n buttonVariants({ appearance, variant, shape, size }),\n className,\n );\n\n // When render prop is provided, pass through to primitive\n // (ignores loading/startIcon/endIcon/dotIndicator/badge)\n if (render) {\n return (\n <ButtonPrimitive\n ref={ref}\n data-slot=\"button\"\n className={buttonClassName}\n render={render}\n {...props}\n >\n {children}\n </ButtonPrimitive>\n );\n }\n\n // Determine if this is an icon-only button based on size or explicit prop\n const isIconOnly =\n iconOnly || ICON_SIZES.includes(size as (typeof ICON_SIZES)[number]);\n const shouldComposeBadgeLabel =\n !isIconOnly &&\n !props['aria-label'] &&\n !props['aria-labelledby'] &&\n (typeof children === 'string' || typeof children === 'number') &&\n (typeof badge === 'string' || typeof badge === 'number');\n const buttonProps = shouldComposeBadgeLabel\n ? { ...props, 'aria-label': `${children} ${badge}` }\n : props;\n const buttonBadge = !isIconOnly ? (\n <ButtonBadge\n appearance={appearance}\n badge={badge}\n shape={shape}\n variant={variant}\n />\n ) : null;\n\n // Build the button element (icon-only or full)\n const buttonElement = isIconOnly ? (\n <ButtonPrimitive\n ref={isAi ? undefined : ref}\n data-slot=\"button\"\n disabled={disabled || loading}\n className={cn(buttonClassName, loading && 'relative')}\n {...buttonProps}\n >\n {loading ? (\n <Spinner className=\"delight-fade-in\" />\n ) : showSuccess ? (\n <Check className=\"delight-bounce-in\" />\n ) : (\n children\n )}\n </ButtonPrimitive>\n ) : (\n <ButtonPrimitive\n ref={isAi ? undefined : ref}\n data-slot=\"button\"\n disabled={disabled || loading}\n className={cn(buttonClassName, (loading || showSuccess) && 'relative')}\n {...buttonProps}\n >\n {loading && <Spinner className=\"absolute delight-fade-in\" />}\n {showSuccess && !loading && (\n <Check className=\"absolute delight-bounce-in\" />\n )}\n <span\n className={cn(\n 'flex items-center gap-2',\n (loading || showSuccess) && 'invisible',\n )}\n >\n {dotIndicator && <Dot color={dotColor} />}\n {startIcon}\n {children}\n {endIcon}\n {buttonBadge}\n </span>\n </ButtonPrimitive>\n );\n\n if (isAi) {\n return (\n <GradientBorder\n ref={ref as React.Ref<HTMLDivElement>}\n animated={isAnimated}\n active\n disabled={disabled}\n className=\"w-auto inline-flex motion-reduce:animate-none\"\n innerClassName=\"flex\"\n >\n {buttonElement}\n </GradientBorder>\n );\n }\n\n return buttonElement;\n },\n);\n\nButton.displayName = 'Button';\n\n/**\n * Clear/Close icon button - a ghost button specifically for close/clear actions\n * Commonly used in tags, dialogs, and dismissible elements\n */\nexport interface ClearButtonProps\n extends Omit<\n ButtonProps,\n | 'appearance'\n | 'variant'\n | 'children'\n | 'startIcon'\n | 'endIcon'\n | 'dotIndicator'\n > {\n /** Size of the clear button */\n size?: 'icon-xs' | 'icon-sm' | 'icon' | 'icon-lg' | 'icon-xl' | 'icon-2xl';\n}\n\nfunction ClearButton({\n className,\n size = 'icon-sm',\n ...props\n}: ClearButtonProps) {\n return (\n <Button\n appearance=\"ghost\"\n variant=\"secondary\"\n size={size}\n iconOnly\n className={cn(\n 'text-text-quaternary hover:text-secondary-foreground',\n className,\n )}\n aria-label=\"Clear\"\n {...props}\n >\n <X />\n </Button>\n );\n}\n\nClearButton.displayName = 'ClearButton';\n\nexport type { ButtonAppearance, ButtonShape, ButtonVariant };\nexport { Button, buttonVariants, ClearButton, Dot };\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;mCAWaA,IAAsB,gBAAA,EAAM,WAAW,SAAgB,GAAgB,GAAc;AAChG,QAAM,EACJ,QAAA,GACA,WAAA,GACA,UAAA,IAAW,IACX,uBAAA,IAAwB,IACxB,cAAA,IAAe,IACf,OAAA,GACA,GAAG,EAAA,IACD,GACE,EACJ,gBAAA,GACA,WAAA,EAAA,IACE,EAAU;AAAA,IACZ,UAAA;AAAA,IACA,uBAAA;AAAA,IACA,QAAQ;AAAA,EACV,CAAC;AAID,SAAO,EAAiB,UAAU,GAAgB;AAAA,IAChD,OAAA,EAHA,UAAA,EAGI;AAAA,IACJ,KAAK,CAAC,GAAc,CAAS;AAAA,IAC7B,OAAO,CAAC,GAAc,CAAc;AAAA,EACtC,CAAC;AACH,CAAC,YC7BK,IACJ,qEAEI,IAAiB,EACrB,qrBACA;AAAA,EACE,UAAU;AAAA,IACR,YAAY;AAAA,MACV,OAAO,GAAG,CAAA;AAAA,MACV,UAAU,GAAG,CAAA;AAAA,MACb,MAAM,GAAG,CAAA;AAAA,MACT,SAAS,GAAG,CAAA;AAAA,MACZ,OAAO,GAAG,CAAA;AAAA,MACV,MAAM;AAAA,MACN,IAAI,GAAG,CAAA;AAAA,IACT;AAAA,IACA,SAAS;AAAA,MACP,SAAS;AAAA,MACT,WAAW;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,MACT,SAAS;AAAA,MACT,aAAa;AA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AAgB,oBAAA,EAAA,KAAC,IAAD,EAAK,OAAO,EAAW,CAAA;AAAA,UACvC;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACG;AAAA;IACS;AAAA;AAGnB,SAAI,IAEA,oBAAA,EAAA,KAAC,GAAD;AAAA,IACO,KAAA;AAAA,IACL,UAAU;AAAA,IACV,QAAA;AAAA,IACU,UAAA;AAAA,IACV,WAAU;AAAA,IACV,gBAAe;AAAA,cAEd;AAAA,EACa,CAAA,IAIb;AACT,CACF;AAEA,EAAO,cAAc;AAoBrB,SAAS,GAAY,EACnB,WAAA,GACA,MAAA,IAAO,WACP,GAAG,EAAA,GACgB;AACnB,SACE,oBAAA,EAAA,KAAC,GAAD;AAAA,IACE,YAAW;AAAA,IACX,SAAQ;AAAA,IACF,MAAA;AAAA,IACN,UAAA;AAAA,IACA,WAAW,EACT,wDACA,CACF;AAAA,IACA,cAAW;AAAA,IACX,GAAI;AAAA,cAEJ,oBAAA,EAAA,KAAC,GAAD,CAAI,CAAA;AAAA,EACE,CAAA;AAEZ;AAEA,GAAY,cAAc"}
|
|
1
|
+
{"version":3,"file":"button.js","names":["Button"],"sources":["../../../../../../../../../../../Users/akarim/Documents/test/humain_foundation_ui/node_modules/.bun/@base-ui+react@1.6.0+1c528c44af60ea5b/node_modules/@base-ui/react/button/Button.mjs","../../src/components/ui/button.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useButton } from \"../internals/use-button/useButton.mjs\";\nimport { useRenderElement } from \"../internals/useRenderElement.mjs\";\n/**\n * A button component that can be used to trigger actions.\n * Renders a `<button>` element.\n *\n * Documentation: [Base UI Button](https://base-ui.com/react/components/button)\n */\nexport const Button = /*#__PURE__*/React.forwardRef(function Button(componentProps, forwardedRef) {\n const {\n render,\n className,\n disabled = false,\n focusableWhenDisabled = false,\n nativeButton = true,\n style,\n ...elementProps\n } = componentProps;\n const {\n getButtonProps,\n buttonRef\n } = useButton({\n disabled,\n focusableWhenDisabled,\n native: nativeButton\n });\n const state = {\n disabled\n };\n return useRenderElement('button', componentProps, {\n state,\n ref: [forwardedRef, buttonRef],\n props: [elementProps, getButtonProps]\n });\n});\nif (process.env.NODE_ENV !== \"production\") Button.displayName = \"Button\";","import { Button as ButtonPrimitive } from '@base-ui/react/button';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { Check, X } from 'lucide-react';\nimport * as React from 'react';\nimport { GradientBorder } from '@/components/ui/gradient-border';\nimport { Spinner } from '@/components/ui/spinner';\nimport { cn } from '@/lib/utils';\n\nconst buttonFocusExpansionClassName =\n 'focus-visible:scale-[1.015] motion-reduce:focus-visible:scale-100';\n\nconst buttonVariants = cva(\n \"focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-[3px] aria-invalid:ring-[3px] [&_svg:not([class*='size-'])]:size-4 inline-flex origin-center items-center justify-center whitespace-nowrap transition-[color,background-color,border-color,box-shadow,transform,opacity] duration-200 ease-smooth motion-reduce:transition-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none group/button select-none\",\n {\n variants: {\n appearance: {\n solid: `${buttonFocusExpansionClassName} delight-click-ripple`,\n gradient: `${buttonFocusExpansionClassName} bg-linear-[113deg] hover:opacity-80 delight-click-ripple`,\n soft: `${buttonFocusExpansionClassName} delight-click-ripple`,\n outline: `${buttonFocusExpansionClassName} bg-background shadow-xs`,\n ghost: `${buttonFocusExpansionClassName} bg-transparent`,\n link: 'border-none bg-transparent p-0 h-auto underline-offset-4 hover:underline focus-visible:ring-0 focus-visible:border-transparent',\n ai: `${buttonFocusExpansionClassName} bg-transparent border-0`,\n },\n variant: {\n primary: '',\n secondary: '',\n info: '',\n success: '',\n warning: '',\n destructive: '',\n },\n size: {\n default:\n 'h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2',\n xs: \"h-6 gap-1 px-2 text-xs has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3\",\n sm: 'h-8 gap-1 px-2.5 has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5',\n md: 'h-10 gap-1.5 px-3.5 has-data-[icon=inline-end]:pe-3 has-data-[icon=inline-start]:ps-3',\n lg: 'h-11 gap-2 px-4 has-data-[icon=inline-end]:pe-3.5 has-data-[icon=inline-start]:ps-3.5',\n xl: \"h-12 gap-2 px-4.5 text-base has-data-[icon=inline-end]:pe-4 has-data-[icon=inline-start]:ps-4 [&_svg:not([class*='size-'])]:size-5\",\n '2xl':\n \"h-14 gap-2.5 px-5 text-lg has-data-[icon=inline-end]:pe-4.5 has-data-[icon=inline-start]:ps-4.5 [&_svg:not([class*='size-'])]:size-6\",\n icon: 'size-9',\n 'icon-xs': \"size-6 [&_svg:not([class*='size-'])]:size-3\",\n 'icon-sm': 'size-8',\n 'icon-lg': 'size-10',\n 'icon-xl': \"size-12 [&_svg:not([class*='size-'])]:size-5\",\n 'icon-2xl': \"size-14 [&_svg:not([class*='size-'])]:size-6\",\n },\n shape: {\n rounded: 'rounded-md',\n round: 'rounded-full',\n },\n },\n compoundVariants: [\n // ===== SOLID =====\n {\n appearance: 'solid',\n variant: 'primary',\n className: 'bg-primary text-primary-foreground hover:bg-primary-hover',\n },\n {\n appearance: 'solid',\n variant: 'secondary',\n className:\n 'bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground',\n },\n {\n appearance: 'solid',\n variant: 'info',\n className: 'bg-info text-info-foreground hover:bg-info/80',\n },\n {\n appearance: 'solid',\n variant: 'success',\n className: 'bg-success text-success-foreground hover:bg-success/80',\n },\n {\n appearance: 'solid',\n variant: 'warning',\n className: 'bg-warning text-warning-foreground hover:bg-warning/80',\n },\n {\n appearance: 'solid',\n variant: 'destructive',\n className:\n 'bg-destructive text-destructive-foreground hover:bg-destructive/80',\n },\n\n // ===== GRADIENT =====\n {\n appearance: 'gradient',\n variant: 'primary',\n className:\n 'from-custom-tw-gradient-from to-custom-tw-gradient-to text-primary-foreground hover:from-custom-tw-gradient-to hover:to-custom-tw-gradient-from',\n },\n {\n appearance: 'gradient',\n variant: 'secondary',\n className:\n 'from-secondary to-secondary/60 text-secondary-foreground hover:from-secondary/60 hover:to-secondary',\n },\n {\n appearance: 'gradient',\n variant: 'info',\n className:\n 'from-info to-info/60 text-info-foreground hover:from-info/60 hover:to-info',\n },\n {\n appearance: 'gradient',\n variant: 'success',\n className:\n 'from-success to-success/60 text-success-foreground hover:from-success/60 hover:to-success',\n },\n {\n appearance: 'gradient',\n variant: 'warning',\n className:\n 'from-warning to-warning/60 text-warning-foreground hover:from-warning/60 hover:to-warning',\n },\n {\n appearance: 'gradient',\n variant: 'destructive',\n className:\n 'from-destructive to-destructive/60 text-destructive-foreground hover:from-destructive/60 hover:to-destructive',\n },\n\n // ===== SOFT =====\n {\n appearance: 'soft',\n variant: 'primary',\n className:\n 'bg-primary/10 border-primary text-primary hover:bg-primary/20 hover:text-primary dark:bg-primary/30 dark:border-primary dark:text-primary dark:hover:bg-primary/50 shadow-xs',\n },\n {\n appearance: 'soft',\n variant: 'secondary',\n className:\n 'bg-secondary/10 text-secondary-foreground hover:bg-secondary/20',\n },\n {\n appearance: 'soft',\n variant: 'info',\n className: 'bg-info/10 text-info hover:bg-info/20',\n },\n {\n appearance: 'soft',\n variant: 'success',\n className: 'bg-success/10 text-success hover:bg-success/20',\n },\n {\n appearance: 'soft',\n variant: 'warning',\n className: 'bg-warning/10 text-warning hover:bg-warning/20',\n },\n {\n appearance: 'soft',\n variant: 'destructive',\n className:\n 'bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30',\n },\n\n // ===== OUTLINE =====\n {\n appearance: 'outline',\n className:\n 'bg-card border-border backdrop-blur-[2px] shadow-none supports-backdrop-filter:backdrop-blur-[2px]',\n },\n {\n appearance: 'outline',\n shape: 'rounded',\n className: 'rounded-xl',\n },\n {\n appearance: 'outline',\n size: 'xs',\n className: 'h-[26px] gap-1 px-2',\n },\n {\n appearance: 'outline',\n size: 'sm',\n className: 'h-8 gap-1.5 px-2.5',\n },\n {\n appearance: 'outline',\n size: 'default',\n className: 'h-9 gap-2 px-4',\n },\n {\n appearance: 'outline',\n size: 'md',\n className: 'h-10 gap-2 px-4',\n },\n {\n appearance: 'outline',\n size: 'lg',\n className: 'h-10 gap-2 px-4.5',\n },\n {\n appearance: 'outline',\n variant: 'primary',\n className: 'border-border text-foreground hover:bg-muted/50',\n },\n {\n appearance: 'outline',\n variant: 'secondary',\n className:\n 'border-border text-secondary-foreground hover:bg-muted/50 aria-expanded:bg-muted/50 aria-expanded:text-foreground',\n },\n {\n appearance: 'outline',\n variant: 'info',\n className: 'border-border text-info hover:bg-info/10',\n },\n {\n appearance: 'outline',\n variant: 'success',\n className: 'border-border text-success hover:bg-success/10',\n },\n {\n appearance: 'outline',\n variant: 'warning',\n className: 'border-border text-warning hover:bg-warning/10',\n },\n {\n appearance: 'outline',\n variant: 'destructive',\n className: 'border-border text-destructive hover:bg-destructive/10',\n },\n\n // ===== GHOST =====\n {\n appearance: 'ghost',\n variant: 'primary',\n className: 'text-primary hover:bg-primary/10',\n },\n {\n appearance: 'ghost',\n variant: 'secondary',\n className:\n 'hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground',\n },\n {\n appearance: 'ghost',\n variant: 'info',\n className: 'text-info hover:bg-info/10',\n },\n {\n appearance: 'ghost',\n variant: 'success',\n className: 'text-success hover:bg-success/10',\n },\n {\n appearance: 'ghost',\n variant: 'warning',\n className: 'text-warning hover:bg-warning/10',\n },\n {\n appearance: 'ghost',\n variant: 'destructive',\n className: 'text-destructive hover:bg-destructive/10',\n },\n\n // ===== AI (inner button styling — GradientBorder wraps externally) =====\n {\n appearance: 'ai',\n variant: 'primary',\n className: 'text-primary hover:bg-primary/10',\n },\n {\n appearance: 'ai',\n variant: 'secondary',\n className: 'text-secondary-foreground hover:bg-muted',\n },\n\n // ===== LINK =====\n { appearance: 'link', variant: 'primary', className: 'text-primary' },\n {\n appearance: 'link',\n variant: 'secondary',\n className: 'text-secondary-foreground',\n },\n { appearance: 'link', variant: 'info', className: 'text-info' },\n { appearance: 'link', variant: 'success', className: 'text-success' },\n { appearance: 'link', variant: 'warning', className: 'text-warning' },\n {\n appearance: 'link',\n variant: 'destructive',\n className: 'text-destructive hover:text-destructive/80',\n },\n ],\n defaultVariants: {\n appearance: 'solid',\n variant: 'primary',\n size: 'default',\n shape: 'rounded',\n },\n },\n);\n\ntype DotColor = 'success' | 'error' | 'warning' | 'brand' | 'gray';\n\ntype ButtonAppearance =\n | 'solid'\n | 'gradient'\n | 'soft'\n | 'outline'\n | 'ghost'\n | 'link'\n | 'ai';\ntype ButtonVariant =\n | 'primary'\n | 'secondary'\n | 'info'\n | 'success'\n | 'warning'\n | 'destructive';\ntype ButtonShape = 'rounded' | 'round';\n\n/**\n * Render prop type for polymorphic rendering.\n * Accepts either a React element or a function that receives props and returns an element.\n * @template Props The props to be passed to the rendered element\n */\ntype RenderProp<Props> =\n | React.ReactElement\n | ((props: Props) => React.ReactElement);\n\nexport interface ButtonProps\n extends React.ComponentProps<'button'>,\n Pick<VariantProps<typeof buttonVariants>, 'size'> {\n /** Visual appearance - how the button renders */\n appearance?: ButtonAppearance;\n /** Semantic variant - what the button means */\n variant?: ButtonVariant;\n /** Shape of the button corners */\n shape?: ButtonShape;\n /** Shows a loading spinner and disables the button */\n loading?: boolean;\n /** Set to false when render targets a non-button element. */\n nativeButton?: boolean;\n /** Icon displayed at the start (inline-start) of the button text - respects RTL */\n startIcon?: React.ReactNode;\n /** Icon displayed at the end (inline-end) of the button text - respects RTL */\n endIcon?: React.ReactNode;\n /** Shows a colored dot indicator before the button text */\n dotIndicator?: boolean;\n /** Color of the dot indicator */\n dotColor?: DotColor;\n /** Badge content displayed after the button label. Text badges are styled from the button appearance and variant. */\n badge?: React.ReactNode;\n /** For icon-only buttons - renders just the icon without text wrapper */\n iconOnly?: boolean;\n /** Enables animated gradient border (only for appearance=\"ai\"). Auto-true when loading. */\n animated?: boolean;\n /**\n * Render prop for polymorphic rendering. Accepts either a React element or a render function.\n * Use this to render the button as a different element (e.g., link) while preserving button styles.\n * Note: When render is provided, loading/startIcon/endIcon/dotIndicator/badge are ignored.\n */\n render?: RenderProp<React.ComponentProps<'button'>>;\n}\n\nconst dotColorClasses: Record<DotColor, string> = {\n success: 'bg-success',\n error: 'bg-destructive',\n warning: 'bg-warning',\n brand: 'bg-primary',\n gray: 'bg-muted',\n};\n\nconst devWarnings = new Set<string>();\n\n/** Icon-only size variants for type-safe detection */\nconst ICON_SIZES = [\n 'icon',\n 'icon-xs',\n 'icon-sm',\n 'icon-lg',\n 'icon-xl',\n 'icon-2xl',\n] as const;\n\nconst SUCCESS_FLASH_DURATION_MS = 600;\n\nconst buttonBadgeShapeClasses: Record<ButtonShape, string> = {\n round: 'rounded-full',\n rounded: 'rounded-sm',\n};\n\nconst buttonBadgeWhiteColorClasses: Record<ButtonVariant, string> = {\n primary: 'text-primary',\n secondary: 'text-secondary-foreground',\n info: 'text-info',\n success: 'text-success',\n warning: 'text-warning',\n destructive: 'text-destructive',\n};\n\nconst buttonBadgeSoftColorClasses: Record<ButtonVariant, string> = {\n primary:\n 'bg-soft-primary text-soft-primary-foreground hover:bg-opacity-primary-20 dark:bg-soft-primary dark:text-soft-primary-foreground',\n secondary:\n 'bg-soft-secondary text-soft-secondary-foreground hover:bg-opacity-secondary-20 dark:bg-soft-secondary dark:text-soft-secondary-foreground',\n info: 'bg-soft-info text-soft-info-foreground hover:bg-opacity-info-20 dark:bg-soft-info dark:text-soft-info-foreground',\n success:\n 'bg-soft-success text-soft-success-foreground hover:bg-opacity-success-20 dark:bg-soft-success dark:text-soft-success-foreground',\n warning:\n 'bg-soft-warning text-soft-warning-foreground hover:bg-opacity-warning-20 dark:bg-soft-warning dark:text-soft-warning-foreground',\n destructive:\n 'bg-soft-destructive text-soft-destructive-foreground hover:bg-opacity-destructive-20 dark:bg-soft-destructive dark:text-soft-destructive-foreground',\n};\n\ntype LoadingSuccessState = {\n wasLoading: boolean;\n visible: boolean;\n token: number;\n};\n\nconst Dot = ({\n color = 'success',\n className,\n}: {\n color?: DotColor;\n className?: string;\n}) => (\n <span\n aria-hidden=\"true\"\n className={cn(\n 'size-2 rounded-full shrink-0 delight-breathing',\n dotColorClasses[color],\n className,\n )}\n />\n);\n\nfunction ButtonBadge({\n appearance,\n badge,\n shape,\n variant,\n}: {\n appearance: ButtonAppearance;\n badge: React.ReactNode;\n shape: ButtonShape;\n variant: ButtonVariant;\n}) {\n if (React.isValidElement(badge)) {\n return badge;\n }\n\n if (badge === true || badge === false || badge == null) {\n return null;\n }\n\n const badgeVariant =\n (appearance === 'solid' || appearance === 'gradient') &&\n variant !== 'secondary'\n ? 'white'\n : 'soft';\n\n return (\n <span\n data-slot=\"badge\"\n className={cn(\n 'inline-flex h-5 shrink-0 items-center justify-center gap-1.5 whitespace-nowrap px-2 py-0.5 text-xs font-medium transition-colors [&>svg]:size-3 [&>svg]:shrink-0 [&>svg]:pointer-events-none',\n buttonBadgeShapeClasses[shape],\n badgeVariant === 'white'\n ? 'bg-opacity-white-80 transition-opacity hover:opacity-80 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-current/50'\n : buttonBadgeSoftColorClasses[variant],\n badgeVariant === 'white' && buttonBadgeWhiteColorClasses[variant],\n )}\n >\n {badge}\n </span>\n );\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n children,\n loading = false,\n disabled,\n startIcon,\n endIcon,\n dotIndicator = false,\n dotColor = 'success',\n badge,\n iconOnly = false,\n animated,\n render,\n className,\n appearance = 'solid',\n variant = 'primary',\n shape = 'rounded',\n size = 'default',\n ...props\n },\n ref,\n ) => {\n // Dev-mode warning for icon-only buttons missing accessible label (once)\n if (\n process.env.NODE_ENV !== 'production' &&\n !devWarnings.has('icon-a11y')\n ) {\n const hasIconSize = ICON_SIZES.includes(\n size as (typeof ICON_SIZES)[number],\n );\n if (\n (iconOnly || hasIconSize) &&\n !props['aria-label'] &&\n !props['aria-labelledby']\n ) {\n devWarnings.add('icon-a11y');\n console.warn(\n 'Button: Icon-only buttons require an `aria-label` or `aria-labelledby` for accessibility.',\n );\n }\n }\n\n // Track loading→done transition before paint so the button never commits a\n // stale success state after the loading prop changes.\n const [successState, setSuccessState] = React.useState<LoadingSuccessState>(\n () => ({\n wasLoading: loading,\n visible: false,\n token: 0,\n }),\n );\n\n if (successState.wasLoading !== loading) {\n const shouldFlash = successState.wasLoading && !loading;\n setSuccessState({\n wasLoading: loading,\n visible: shouldFlash,\n token: shouldFlash ? successState.token + 1 : successState.token,\n });\n }\n\n React.useEffect(() => {\n if (!successState.visible) return;\n const token = successState.token;\n const timer = setTimeout(() => {\n setSuccessState((current) =>\n current.token === token ? { ...current, visible: false } : current,\n );\n }, SUCCESS_FLASH_DURATION_MS);\n return () => clearTimeout(timer);\n }, [successState.visible, successState.token]);\n\n const showSuccess = successState.visible && !loading;\n\n const isAi = appearance === 'ai';\n const isAnimated = isAi ? (animated ?? loading) : false;\n\n const buttonClassName = cn(\n buttonVariants({ appearance, variant, shape, size }),\n className,\n );\n\n // When render prop is provided, pass through to primitive\n // (ignores loading/startIcon/endIcon/dotIndicator/badge)\n if (render) {\n return (\n <ButtonPrimitive\n ref={ref}\n data-slot=\"button\"\n className={buttonClassName}\n render={render}\n {...props}\n >\n {children}\n </ButtonPrimitive>\n );\n }\n\n // Determine if this is an icon-only button based on size or explicit prop\n const isIconOnly =\n iconOnly || ICON_SIZES.includes(size as (typeof ICON_SIZES)[number]);\n const shouldComposeBadgeLabel =\n !isIconOnly &&\n !props['aria-label'] &&\n !props['aria-labelledby'] &&\n (typeof children === 'string' || typeof children === 'number') &&\n (typeof badge === 'string' || typeof badge === 'number');\n const buttonProps = shouldComposeBadgeLabel\n ? { ...props, 'aria-label': `${children} ${badge}` }\n : props;\n const buttonBadge = !isIconOnly ? (\n <ButtonBadge\n appearance={appearance}\n badge={badge}\n shape={shape}\n variant={variant}\n />\n ) : null;\n\n // Build the button element (icon-only or full)\n const buttonElement = isIconOnly ? (\n <ButtonPrimitive\n ref={isAi ? undefined : ref}\n data-slot=\"button\"\n disabled={disabled || loading}\n className={cn(buttonClassName, loading && 'relative')}\n {...buttonProps}\n >\n {loading ? (\n <Spinner className=\"delight-fade-in\" />\n ) : showSuccess ? (\n <Check className=\"delight-bounce-in\" />\n ) : (\n children\n )}\n </ButtonPrimitive>\n ) : (\n <ButtonPrimitive\n ref={isAi ? undefined : ref}\n data-slot=\"button\"\n disabled={disabled || loading}\n className={cn(buttonClassName, (loading || showSuccess) && 'relative')}\n {...buttonProps}\n >\n {loading && <Spinner className=\"absolute delight-fade-in\" />}\n {showSuccess && !loading && (\n <Check className=\"absolute delight-bounce-in\" />\n )}\n <span\n className={cn(\n 'flex items-center gap-2',\n (loading || showSuccess) && 'invisible',\n )}\n >\n {dotIndicator && <Dot color={dotColor} />}\n {startIcon}\n {children}\n {endIcon}\n {buttonBadge}\n </span>\n </ButtonPrimitive>\n );\n\n if (isAi) {\n return (\n <GradientBorder\n ref={ref as React.Ref<HTMLDivElement>}\n animated={isAnimated}\n active\n disabled={disabled}\n className=\"w-auto inline-flex motion-reduce:animate-none\"\n innerClassName=\"flex\"\n >\n {buttonElement}\n </GradientBorder>\n );\n }\n\n return buttonElement;\n },\n);\n\nButton.displayName = 'Button';\n\n/**\n * Clear/Close icon button - a ghost button specifically for close/clear actions\n * Commonly used in tags, dialogs, and dismissible elements\n */\nexport interface ClearButtonProps\n extends Omit<\n ButtonProps,\n | 'appearance'\n | 'variant'\n | 'children'\n | 'startIcon'\n | 'endIcon'\n | 'dotIndicator'\n > {\n /** Size of the clear button */\n size?: 'icon-xs' | 'icon-sm' | 'icon' | 'icon-lg' | 'icon-xl' | 'icon-2xl';\n}\n\nfunction ClearButton({\n className,\n size = 'icon-sm',\n ...props\n}: ClearButtonProps) {\n return (\n <Button\n appearance=\"ghost\"\n variant=\"secondary\"\n size={size}\n iconOnly\n className={cn(\n 'text-muted-foreground hover:text-secondary-foreground',\n className,\n )}\n aria-label=\"Clear\"\n {...props}\n >\n <X />\n </Button>\n );\n}\n\nClearButton.displayName = 'ClearButton';\n\nexport type { ButtonAppearance, ButtonShape, ButtonVariant };\nexport { Button, buttonVariants, ClearButton, Dot };\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;mCAWaA,IAAsB,gBAAA,EAAM,WAAW,SAAgB,GAAgB,GAAc;AAChG,QAAM,EACJ,QAAA,GACA,WAAA,GACA,UAAA,IAAW,IACX,uBAAA,IAAwB,IACxB,cAAA,IAAe,IACf,OAAA,GACA,GAAG,EAAA,IACD,GACE,EACJ,gBAAA,GACA,WAAA,EAAA,IACE,EAAU;AAAA,IACZ,UAAA;AAAA,IACA,uBAAA;AAAA,IACA,QAAQ;AAAA,EACV,CAAC;AAID,SAAO,EAAiB,UAAU,GAAgB;AAAA,IAChD,OAAA,EAHA,UAAA,EAGI;AAAA,IACJ,KAAK,CAAC,GAAc,CAAS;AAAA,IAC7B,OAAO,CAAC,GAAc,CAAc;AAAA,EACtC,CAAC;AACH,CAAC,YC7BK,IACJ,qEAEI,IAAiB,EACrB,qrBACA;AAAA,EACE,UAAU;AAAA,IACR,YAAY;AAAA,MACV,OAAO,GAAG,CAAA;AAAA,MACV,UAAU,GAAG,CAAA;AAAA,MACb,MAAM,GAAG,CAAA;AAAA,MACT,SAAS,GAAG,CAAA;AAAA,MACZ,OAAO,GAAG,CAAA;AAAA,MACV,MAAM;AAAA,MACN,IAAI,GAAG,CAAA;AAAA,IACT;AAAA,IACA,SAAS;AAAA,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AAA,EAAA,MAAC,QAAD;AAAA,QACE,WAAW,EACT,4BACC,KAAW,MAAgB,WAC9B;AAAA,kBAJF;AAAA,UAMG,KAAgB,oBAAA,EAAA,KAAC,IAAD,EAAK,OAAO,EAAW,CAAA;AAAA,UACvC;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACG;AAAA;IACS;AAAA;AAGnB,SAAI,IAEA,oBAAA,EAAA,KAAC,GAAD;AAAA,IACO,KAAA;AAAA,IACL,UAAU;AAAA,IACV,QAAA;AAAA,IACU,UAAA;AAAA,IACV,WAAU;AAAA,IACV,gBAAe;AAAA,cAEd;AAAA,EACa,CAAA,IAIb;AACT,CACF;AAEA,EAAO,cAAc;AAoBrB,SAAS,GAAY,EACnB,WAAA,GACA,MAAA,IAAO,WACP,GAAG,EAAA,GACgB;AACnB,SACE,oBAAA,EAAA,KAAC,GAAD;AAAA,IACE,YAAW;AAAA,IACX,SAAQ;AAAA,IACF,MAAA;AAAA,IACN,UAAA;AAAA,IACA,WAAW,EACT,yDACA,CACF;AAAA,IACA,cAAW;AAAA,IACX,GAAI;AAAA,cAEJ,oBAAA,EAAA,KAAC,GAAD,CAAI,CAAA;AAAA,EACE,CAAA;AAEZ;AAEA,GAAY,cAAc"}
|
package/dist/wc/close-button.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { a as u } from "./rolldown-runtime.js";
|
|
2
|
-
import { i as
|
|
2
|
+
import { i as c, t as v } from "./vendor/react.js";
|
|
3
3
|
import { n as i } from "./utils.js";
|
|
4
4
|
import { t as n } from "./x.js";
|
|
5
5
|
import { t as m } from "./dist.js";
|
|
6
|
-
import { t as
|
|
7
|
-
var l = /* @__PURE__ */ u(
|
|
6
|
+
import { t as d } from "./button.js";
|
|
7
|
+
var l = /* @__PURE__ */ u(c(), 1), e = v(), f = m("", {
|
|
8
8
|
variants: { size: {
|
|
9
9
|
sm: "",
|
|
10
10
|
md: "",
|
|
@@ -15,40 +15,40 @@ var l = /* @__PURE__ */ u(d(), 1), t = v(), f = m("", {
|
|
|
15
15
|
sm: "icon-sm",
|
|
16
16
|
md: "icon",
|
|
17
17
|
lg: "icon-lg"
|
|
18
|
-
},
|
|
18
|
+
}, g = l.forwardRef(({ className: s, size: r = "sm", "aria-label": t = "Close", ...a }, o) => /* @__PURE__ */ (0, e.jsxs)(d, {
|
|
19
19
|
ref: o,
|
|
20
20
|
"data-slot": "close-button",
|
|
21
21
|
appearance: "ghost",
|
|
22
22
|
variant: "secondary",
|
|
23
|
-
size: p[
|
|
24
|
-
className: i(f({ size:
|
|
25
|
-
"aria-label":
|
|
26
|
-
...
|
|
27
|
-
children: [/* @__PURE__ */ (0,
|
|
23
|
+
size: p[r ?? "sm"],
|
|
24
|
+
className: i(f({ size: r }), s),
|
|
25
|
+
"aria-label": t,
|
|
26
|
+
...a,
|
|
27
|
+
children: [/* @__PURE__ */ (0, e.jsx)(n, {}), /* @__PURE__ */ (0, e.jsx)("span", {
|
|
28
28
|
className: "sr-only",
|
|
29
|
-
children:
|
|
29
|
+
children: t
|
|
30
30
|
})]
|
|
31
31
|
}));
|
|
32
|
-
|
|
33
|
-
var
|
|
32
|
+
g.displayName = "CloseButton";
|
|
33
|
+
var b = m("flex shrink-0 items-center justify-center rounded-[3px] p-0.5 text-muted-foreground hover:bg-surface-1 hover:text-secondary-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", {
|
|
34
34
|
variants: { size: {
|
|
35
35
|
sm: "[&>svg]:size-2.5",
|
|
36
36
|
md: "[&>svg]:size-3",
|
|
37
37
|
lg: "[&>svg]:size-3.5"
|
|
38
38
|
} },
|
|
39
39
|
defaultVariants: { size: "md" }
|
|
40
|
-
}),
|
|
40
|
+
}), x = l.forwardRef(({ className: s, size: r = "md", "aria-label": t = "Remove", ...a }, o) => /* @__PURE__ */ (0, e.jsx)("button", {
|
|
41
41
|
ref: o,
|
|
42
42
|
type: "button",
|
|
43
43
|
"data-slot": "remove-button",
|
|
44
|
-
className: i(
|
|
45
|
-
"aria-label":
|
|
46
|
-
...
|
|
47
|
-
children: /* @__PURE__ */ (0,
|
|
44
|
+
className: i(b({ size: r }), s),
|
|
45
|
+
"aria-label": t,
|
|
46
|
+
...a,
|
|
47
|
+
children: /* @__PURE__ */ (0, e.jsx)(n, {})
|
|
48
48
|
}));
|
|
49
|
-
|
|
49
|
+
x.displayName = "RemoveButton";
|
|
50
50
|
export {
|
|
51
|
-
|
|
51
|
+
g as t
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
//# sourceMappingURL=close-button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"close-button.js","names":[],"sources":["../../src/components/ui/close-button.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority';\nimport { X } from 'lucide-react';\nimport * as React from 'react';\nimport { Button } from '@/components/ui/button';\nimport { cn } from '@/lib/utils';\n\n/**\n * CloseButton - for modal/overlay close buttons (dialogs, sheets, drawers)\n * Uses Button component with ghost variant, positioned by consumer\n */\nconst closeButtonVariants = cva('', {\n variants: {\n size: {\n sm: '',\n md: '',\n lg: '',\n },\n },\n defaultVariants: {\n size: 'sm',\n },\n});\n\nconst buttonSizeMap = {\n sm: 'icon-sm',\n md: 'icon',\n lg: 'icon-lg',\n} as const;\n\nexport interface CloseButtonProps\n extends Omit<\n React.ComponentProps<typeof Button>,\n 'variant' | 'size' | 'children'\n >,\n VariantProps<typeof closeButtonVariants> {\n /** Accessible label for the close button */\n 'aria-label'?: string;\n}\n\nconst CloseButton = React.forwardRef<HTMLButtonElement, CloseButtonProps>(\n (\n { className, size = 'sm', 'aria-label': ariaLabel = 'Close', ...props },\n ref,\n ) => {\n return (\n <Button\n ref={ref}\n data-slot=\"close-button\"\n appearance=\"ghost\"\n variant=\"secondary\"\n size={buttonSizeMap[size ?? 'sm']}\n className={cn(closeButtonVariants({ size }), className)}\n aria-label={ariaLabel}\n {...props}\n >\n <X />\n <span className=\"sr-only\">{ariaLabel}</span>\n </Button>\n );\n },\n);\n\nCloseButton.displayName = 'CloseButton';\n\n/**\n * RemoveButton - for inline remove buttons (tags, list items, chips)\n * Lightweight button with smaller footprint\n */\nconst removeButtonVariants = cva(\n 'flex shrink-0 items-center justify-center rounded-[3px] p-0.5 text-muted-foreground hover:bg-surface-1 hover:text-
|
|
1
|
+
{"version":3,"file":"close-button.js","names":[],"sources":["../../src/components/ui/close-button.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority';\nimport { X } from 'lucide-react';\nimport * as React from 'react';\nimport { Button } from '@/components/ui/button';\nimport { cn } from '@/lib/utils';\n\n/**\n * CloseButton - for modal/overlay close buttons (dialogs, sheets, drawers)\n * Uses Button component with ghost variant, positioned by consumer\n */\nconst closeButtonVariants = cva('', {\n variants: {\n size: {\n sm: '',\n md: '',\n lg: '',\n },\n },\n defaultVariants: {\n size: 'sm',\n },\n});\n\nconst buttonSizeMap = {\n sm: 'icon-sm',\n md: 'icon',\n lg: 'icon-lg',\n} as const;\n\nexport interface CloseButtonProps\n extends Omit<\n React.ComponentProps<typeof Button>,\n 'variant' | 'size' | 'children'\n >,\n VariantProps<typeof closeButtonVariants> {\n /** Accessible label for the close button */\n 'aria-label'?: string;\n}\n\nconst CloseButton = React.forwardRef<HTMLButtonElement, CloseButtonProps>(\n (\n { className, size = 'sm', 'aria-label': ariaLabel = 'Close', ...props },\n ref,\n ) => {\n return (\n <Button\n ref={ref}\n data-slot=\"close-button\"\n appearance=\"ghost\"\n variant=\"secondary\"\n size={buttonSizeMap[size ?? 'sm']}\n className={cn(closeButtonVariants({ size }), className)}\n aria-label={ariaLabel}\n {...props}\n >\n <X />\n <span className=\"sr-only\">{ariaLabel}</span>\n </Button>\n );\n },\n);\n\nCloseButton.displayName = 'CloseButton';\n\n/**\n * RemoveButton - for inline remove buttons (tags, list items, chips)\n * Lightweight button with smaller footprint\n */\nconst removeButtonVariants = cva(\n 'flex shrink-0 items-center justify-center rounded-[3px] p-0.5 text-muted-foreground hover:bg-surface-1 hover:text-secondary-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',\n {\n variants: {\n size: {\n sm: '[&>svg]:size-2.5',\n md: '[&>svg]:size-3',\n lg: '[&>svg]:size-3.5',\n },\n },\n defaultVariants: {\n size: 'md',\n },\n },\n);\n\nexport interface RemoveButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof removeButtonVariants> {\n /** Accessible label for the remove button */\n 'aria-label'?: string;\n}\n\nconst RemoveButton = React.forwardRef<HTMLButtonElement, RemoveButtonProps>(\n (\n { className, size = 'md', 'aria-label': ariaLabel = 'Remove', ...props },\n ref,\n ) => {\n return (\n <button\n ref={ref}\n type=\"button\"\n data-slot=\"remove-button\"\n className={cn(removeButtonVariants({ size }), className)}\n aria-label={ariaLabel}\n {...props}\n >\n <X />\n </button>\n );\n },\n);\n\nRemoveButton.displayName = 'RemoveButton';\n\nexport { CloseButton, closeButtonVariants, RemoveButton, removeButtonVariants };\n"],"mappings":";;;;;;4CAUM,IAAsB,EAAI,IAAI;AAAA,EAClC,UAAU,EACR,MAAM;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,EACN,EACF;AAAA,EACA,iBAAiB,EACf,MAAM,KACR;AACF,CAAC,GAEK,IAAgB;AAAA,EACpB,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN,GAYM,IAAA,EAAoB,WAAA,CAEtB,EAAE,WAAA,GAAW,MAAA,IAAO,MAAM,cAAc,IAAY,SAAS,GAAG,EAAA,GAChE,MAGE,oBAAA,EAAA,MAAC,GAAD;AAAA,EACO,KAAA;AAAA,EACL,aAAU;AAAA,EACV,YAAW;AAAA,EACX,SAAQ;AAAA,EACR,MAAM,EAAc,KAAQ,IAAA;AAAA,EAC5B,WAAW,EAAG,EAAoB,EAAE,MAAA,EAAK,CAAC,GAAG,CAAS;AAAA,EACtD,cAAY;AAAA,EACZ,GAAI;AAAA,YARN,CAUE,oBAAA,EAAA,KAAC,GAAD,CAAI,CAAA,GACJ,oBAAA,EAAA,KAAC,QAAD;AAAA,IAAM,WAAU;AAAA,cAAW;AAAA,EAAgB,CAAA,CACrC;EAGd;AAEA,EAAY,cAAc;AAM1B,IAAM,IAAuB,EAC3B,oOACA;AAAA,EACE,UAAU,EACR,MAAM;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,EACN,EACF;AAAA,EACA,iBAAiB,EACf,MAAM,KACR;AACF,CACF,GASM,IAAA,EAAqB,WAAA,CAEvB,EAAE,WAAA,GAAW,MAAA,IAAO,MAAM,cAAc,IAAY,UAAU,GAAG,EAAA,GACjE,MAGE,oBAAA,EAAA,KAAC,UAAD;AAAA,EACO,KAAA;AAAA,EACL,MAAK;AAAA,EACL,aAAU;AAAA,EACV,WAAW,EAAG,EAAqB,EAAE,MAAA,EAAK,CAAC,GAAG,CAAS;AAAA,EACvD,cAAY;AAAA,EACZ,GAAI;AAAA,YAEJ,oBAAA,EAAA,KAAC,GAAD,CAAI,CAAA;AACE,CAAA,CAGd;AAEA,EAAa,cAAc"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as v } from "./rolldown-runtime.js";
|
|
2
2
|
import { i as y, n as _, t as C } from "./vendor/react.js";
|
|
3
|
-
import { n as
|
|
3
|
+
import { n as d } from "./utils.js";
|
|
4
4
|
import { c as j, s as g } from "./_shared.js";
|
|
5
5
|
import { t as N } from "./createLucideIcon.js";
|
|
6
6
|
import { t as f } from "./sparkles.js";
|
|
@@ -41,15 +41,15 @@ function S(e, r) {
|
|
|
41
41
|
const t = z(r), n = e.split(new RegExp(`(${t})`, "gi")), s = r.toLowerCase();
|
|
42
42
|
let a = 0;
|
|
43
43
|
return n.map((o) => {
|
|
44
|
-
const
|
|
44
|
+
const c = a;
|
|
45
45
|
return a += o.length, {
|
|
46
|
-
key: `${
|
|
46
|
+
key: `${c}:${o.toLowerCase() === s ? "highlight" : "plain"}:${o}`,
|
|
47
47
|
text: o,
|
|
48
48
|
highlighted: o.toLowerCase() === s
|
|
49
49
|
};
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
function m({ children: e, onClick: r, icon: t, showArrow: n = !1, highlight: s, variant: a, size: o, className:
|
|
52
|
+
function m({ children: e, onClick: r, icon: t, showArrow: n = !1, highlight: s, variant: a, size: o, className: c }) {
|
|
53
53
|
const l = h.useMemo(() => s ? /* @__PURE__ */ (0, i.jsx)("span", { children: S(e, s).map((p) => p.highlighted ? /* @__PURE__ */ (0, i.jsx)("span", {
|
|
54
54
|
className: "text-primary font-medium",
|
|
55
55
|
children: p.text
|
|
@@ -58,10 +58,10 @@ function m({ children: e, onClick: r, icon: t, showArrow: n = !1, highlight: s,
|
|
|
58
58
|
type: "button",
|
|
59
59
|
"data-slot": "ai-prompt-suggestion",
|
|
60
60
|
onClick: r,
|
|
61
|
-
className:
|
|
61
|
+
className: d(E({
|
|
62
62
|
variant: a,
|
|
63
63
|
size: o
|
|
64
|
-
}), "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",
|
|
64
|
+
}), "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring", c),
|
|
65
65
|
children: [
|
|
66
66
|
t && /* @__PURE__ */ (0, i.jsx)("span", {
|
|
67
67
|
className: "shrink-0",
|
|
@@ -82,9 +82,9 @@ function x({ title: e, description: r, icon: t, onClick: n, featured: s = !1, cl
|
|
|
82
82
|
type: "button",
|
|
83
83
|
"data-slot": "ai-prompt-suggestion-card",
|
|
84
84
|
onClick: n,
|
|
85
|
-
className:
|
|
85
|
+
className: d("group flex flex-col items-start gap-2 p-4 rounded-xl border transition-all text-left focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring", s ? "border-primary bg-primary/10 hover:border-primary hover:shadow-md" : "border-border bg-background hover:border-border hover:shadow-md", a),
|
|
86
86
|
children: [t && /* @__PURE__ */ (0, i.jsx)("div", {
|
|
87
|
-
className:
|
|
87
|
+
className: d("size-8 rounded-lg flex items-center justify-center", s ? "bg-primary/20 text-primary" : "bg-accent text-muted-foreground"),
|
|
88
88
|
children: t
|
|
89
89
|
}), /* @__PURE__ */ (0, i.jsxs)("div", {
|
|
90
90
|
className: "space-y-1",
|
|
@@ -92,7 +92,7 @@ function x({ title: e, description: r, icon: t, onClick: n, featured: s = !1, cl
|
|
|
92
92
|
className: "text-sm font-medium text-foreground group-hover:text-primary transition-colors",
|
|
93
93
|
children: e
|
|
94
94
|
}), r && /* @__PURE__ */ (0, i.jsx)("p", {
|
|
95
|
-
className: "text-xs text-
|
|
95
|
+
className: "text-xs text-secondary-foreground line-clamp-2",
|
|
96
96
|
children: r
|
|
97
97
|
})]
|
|
98
98
|
})]
|
|
@@ -100,12 +100,12 @@ function x({ title: e, description: r, icon: t, onClick: n, featured: s = !1, cl
|
|
|
100
100
|
}
|
|
101
101
|
x.displayName = "AIPromptSuggestionCard";
|
|
102
102
|
function I({ suggestions: e, onSelect: r, variant: t = "default", direction: n = "horizontal", max: s, className: a }) {
|
|
103
|
-
const o = P(s),
|
|
103
|
+
const o = P(s), c = o === null ? e : e.slice(0, o);
|
|
104
104
|
return /* @__PURE__ */ (0, i.jsx)("section", {
|
|
105
105
|
"data-slot": "ai-prompt-suggestion-list",
|
|
106
106
|
"aria-label": "Prompt suggestions",
|
|
107
|
-
className:
|
|
108
|
-
children:
|
|
107
|
+
className: d("flex gap-2", n === "horizontal" ? "flex-wrap" : "flex-col", a),
|
|
108
|
+
children: c.map((l) => /* @__PURE__ */ (0, i.jsx)(m, {
|
|
109
109
|
variant: t,
|
|
110
110
|
icon: l.icon,
|
|
111
111
|
onClick: () => r?.(l.text),
|
|
@@ -121,14 +121,14 @@ function L({ actions: e, onSelect: r, variant: t = "card", columns: n = 2, class
|
|
|
121
121
|
4: "grid-cols-4"
|
|
122
122
|
};
|
|
123
123
|
return t === "pill" ? /* @__PURE__ */ (0, i.jsx)("div", {
|
|
124
|
-
className:
|
|
124
|
+
className: d("flex flex-wrap gap-2", s),
|
|
125
125
|
children: e.map((o) => /* @__PURE__ */ (0, i.jsx)(m, {
|
|
126
126
|
icon: o.icon || /* @__PURE__ */ (0, i.jsx)(f, { className: "size-4" }),
|
|
127
127
|
onClick: () => r?.(o.prompt),
|
|
128
128
|
children: o.title
|
|
129
129
|
}, o.id))
|
|
130
130
|
}) : /* @__PURE__ */ (0, i.jsx)("div", {
|
|
131
|
-
className:
|
|
131
|
+
className: d("grid gap-3", a[n], s),
|
|
132
132
|
children: e.map((o) => /* @__PURE__ */ (0, i.jsx)(x, {
|
|
133
133
|
title: o.title,
|
|
134
134
|
description: o.description,
|