@karakuri-ui/react 0.3.10 → 0.3.11
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/components/ui/accordion.d.mts +1 -1
- package/dist/components/ui/accordion.d.ts +1 -1
- package/dist/components/ui/alert.d.mts +2 -2
- package/dist/components/ui/alert.d.ts +2 -2
- package/dist/components/ui/avatar.d.mts +2 -2
- package/dist/components/ui/avatar.d.ts +2 -2
- package/dist/components/ui/badge.d.mts +2 -2
- package/dist/components/ui/badge.d.ts +2 -2
- package/dist/components/ui/badge.js +54 -43
- package/dist/components/ui/badge.js.map +1 -1
- package/dist/components/ui/badge.mjs +55 -44
- package/dist/components/ui/badge.mjs.map +1 -1
- package/dist/components/ui/button.d.mts +3 -3
- package/dist/components/ui/button.d.ts +3 -3
- package/dist/components/ui/button.js +31 -20
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/button.mjs +31 -20
- package/dist/components/ui/button.mjs.map +1 -1
- package/dist/components/ui/card.d.mts +1 -1
- package/dist/components/ui/card.d.ts +1 -1
- package/dist/components/ui/chart.d.mts +1 -1
- package/dist/components/ui/chart.d.ts +1 -1
- package/dist/components/ui/checkbox.d.mts +1 -1
- package/dist/components/ui/checkbox.d.ts +1 -1
- package/dist/components/ui/divider.d.mts +1 -1
- package/dist/components/ui/divider.d.ts +1 -1
- package/dist/components/ui/field.d.mts +1 -1
- package/dist/components/ui/field.d.ts +1 -1
- package/dist/components/ui/icon-button.d.mts +2 -2
- package/dist/components/ui/icon-button.d.ts +2 -2
- package/dist/components/ui/icon-button.js +24 -13
- package/dist/components/ui/icon-button.js.map +1 -1
- package/dist/components/ui/icon-button.mjs +24 -13
- package/dist/components/ui/icon-button.mjs.map +1 -1
- package/dist/components/ui/input.d.mts +3 -3
- package/dist/components/ui/input.d.ts +3 -3
- package/dist/components/ui/metric-card.d.mts +2 -2
- package/dist/components/ui/metric-card.d.ts +2 -2
- package/dist/components/ui/navigation-menu.js +25 -11
- package/dist/components/ui/navigation-menu.js.map +1 -1
- package/dist/components/ui/navigation-menu.mjs +25 -11
- package/dist/components/ui/navigation-menu.mjs.map +1 -1
- package/dist/components/ui/popover.d.mts +1 -1
- package/dist/components/ui/popover.d.ts +1 -1
- package/dist/components/ui/progress.d.mts +1 -1
- package/dist/components/ui/progress.d.ts +1 -1
- package/dist/components/ui/radio-group.d.mts +1 -1
- package/dist/components/ui/radio-group.d.ts +1 -1
- package/dist/components/ui/segmented.d.mts +5 -5
- package/dist/components/ui/segmented.d.ts +5 -5
- package/dist/components/ui/slider.d.mts +1 -1
- package/dist/components/ui/slider.d.ts +1 -1
- package/dist/components/ui/spinner.d.mts +1 -1
- package/dist/components/ui/spinner.d.ts +1 -1
- package/dist/components/ui/switch.d.mts +1 -1
- package/dist/components/ui/switch.d.ts +1 -1
- package/dist/components/ui/tabs.d.mts +1 -1
- package/dist/components/ui/tabs.d.ts +1 -1
- package/dist/components/ui/textarea.d.mts +2 -2
- package/dist/components/ui/textarea.d.ts +2 -2
- package/dist/components/ui/toast.d.mts +1 -1
- package/dist/components/ui/toast.d.ts +1 -1
- package/dist/components/ui/toggle-group.d.mts +2 -2
- package/dist/components/ui/toggle-group.d.ts +2 -2
- package/dist/components/ui/toggle.d.mts +2 -2
- package/dist/components/ui/toggle.d.ts +2 -2
- package/dist/components/ui/tooltip.d.mts +1 -1
- package/dist/components/ui/tooltip.d.ts +1 -1
- package/package.json +5 -5
|
@@ -67,6 +67,16 @@ const buttonVariants = cva(
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
);
|
|
70
|
+
const REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
|
|
71
|
+
function renderInsideChild(children, render) {
|
|
72
|
+
let child = children;
|
|
73
|
+
const resolve = React.use;
|
|
74
|
+
if (typeof child === "object" && child !== null && child.$$typeof === REACT_LAZY_TYPE && typeof resolve === "function") {
|
|
75
|
+
child = resolve(child._payload);
|
|
76
|
+
}
|
|
77
|
+
if (!React.isValidElement(child)) return render(children);
|
|
78
|
+
return React.cloneElement(child, void 0, render(child.props.children));
|
|
79
|
+
}
|
|
70
80
|
const Button = React.forwardRef(
|
|
71
81
|
({
|
|
72
82
|
className,
|
|
@@ -110,6 +120,26 @@ const Button = React.forwardRef(
|
|
|
110
120
|
// icon-only → 20px
|
|
111
121
|
}[size || "default"];
|
|
112
122
|
const selectedStyles = selected ? variant === "outline" ? "bg-background-muted" : variant === "ghost" ? "font-semibold" : "" : "";
|
|
123
|
+
const renderContent = (content) => loading ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
124
|
+
/* @__PURE__ */ jsxs(
|
|
125
|
+
"svg",
|
|
126
|
+
{
|
|
127
|
+
className: cn(iconSizeClass, "animate-spin"),
|
|
128
|
+
fill: "none",
|
|
129
|
+
viewBox: "0 0 24 24",
|
|
130
|
+
"aria-hidden": "true",
|
|
131
|
+
children: [
|
|
132
|
+
/* @__PURE__ */ jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
133
|
+
/* @__PURE__ */ jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
),
|
|
137
|
+
/* @__PURE__ */ jsx("span", { children: content })
|
|
138
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
139
|
+
leftIcon && /* @__PURE__ */ jsx("span", { className: cn(iconSizeClass, "[&>svg]:w-full [&>svg]:h-full"), "aria-hidden": "true", children: leftIcon }),
|
|
140
|
+
content,
|
|
141
|
+
rightIcon && /* @__PURE__ */ jsx("span", { className: cn(iconSizeClass, "[&>svg]:w-full [&>svg]:h-full"), "aria-hidden": "true", children: rightIcon })
|
|
142
|
+
] });
|
|
113
143
|
return /* @__PURE__ */ jsx(
|
|
114
144
|
Comp,
|
|
115
145
|
{
|
|
@@ -119,26 +149,7 @@ const Button = React.forwardRef(
|
|
|
119
149
|
"aria-busy": loading || void 0,
|
|
120
150
|
"aria-pressed": selected || void 0,
|
|
121
151
|
...props,
|
|
122
|
-
children:
|
|
123
|
-
/* @__PURE__ */ jsxs(
|
|
124
|
-
"svg",
|
|
125
|
-
{
|
|
126
|
-
className: cn(iconSizeClass, "animate-spin"),
|
|
127
|
-
fill: "none",
|
|
128
|
-
viewBox: "0 0 24 24",
|
|
129
|
-
"aria-hidden": "true",
|
|
130
|
-
children: [
|
|
131
|
-
/* @__PURE__ */ jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
132
|
-
/* @__PURE__ */ jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
|
|
133
|
-
]
|
|
134
|
-
}
|
|
135
|
-
),
|
|
136
|
-
/* @__PURE__ */ jsx("span", { children })
|
|
137
|
-
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
138
|
-
leftIcon && /* @__PURE__ */ jsx("span", { className: cn(iconSizeClass, "[&>svg]:w-full [&>svg]:h-full"), "aria-hidden": "true", children: leftIcon }),
|
|
139
|
-
children,
|
|
140
|
-
rightIcon && /* @__PURE__ */ jsx("span", { className: cn(iconSizeClass, "[&>svg]:w-full [&>svg]:h-full"), "aria-hidden": "true", children: rightIcon })
|
|
141
|
-
] })
|
|
152
|
+
children: asChild ? renderInsideChild(children, renderContent) : renderContent(children)
|
|
142
153
|
}
|
|
143
154
|
);
|
|
144
155
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/ui/button.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\nimport { useButtonGroup } from './button-group'\n\n// Solid color maps (applied when variant=\"solid\")\nconst solidColorMap = {\n default: 'bg-foreground text-background hover:bg-foreground/90 active:bg-foreground/80',\n primary: 'bg-primary text-primary-foreground hover:bg-primary-hover active:bg-primary-active',\n secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary-hover active:bg-secondary-active',\n destructive: 'bg-error text-error-foreground hover:bg-error-hover active:bg-error-active',\n} as const\n\nexport type ButtonColor = keyof typeof solidColorMap\n\nconst buttonVariants = cva(\n 'inline-flex items-center justify-center whitespace-nowrap transition-all duration-micro focus-visible:focus-ring disabled:pointer-events-none disabled:opacity-50',\n {\n variants: {\n variant: {\n solid: 'font-semibold',\n outline: 'border border-border-form bg-background text-foreground hover:bg-background-muted font-normal',\n ghost: 'text-foreground hover:bg-background-muted font-normal',\n link: 'text-text-link underline-offset-4 hover:underline font-normal',\n },\n size: {\n xs: 'h-7 px-2.5 text-xs gap-1', // 28px height, 10px paddingX, 12px font\n sm: 'h-8 px-3 text-sm gap-2', // 32px height, 12px paddingX, 13px font\n md: 'h-9 px-3.5 text-md gap-2', // 36px height, 14px paddingX, 14px font\n default: 'h-10 px-4 text-md gap-2', // 40px height, 16px paddingX, 14px font\n lg: 'h-12 px-6 text-base gap-2', // 48px height, 24px paddingX, 16px font\n icon: 'h-10 w-10',\n },\n radius: {\n none: 'rounded-none', // 0px - primitive.borderRadius.none\n sm: 'rounded-sm', // 2px - primitive.borderRadius.sm\n base: 'rounded', // 4px - primitive.borderRadius.base\n default: 'rounded-md', // 6px - primitive.borderRadius.md (Figma button default)\n lg: 'rounded-lg', // 8px - primitive.borderRadius.lg\n xl: 'rounded-xl', // 12px - primitive.borderRadius.xl\n '2xl': 'rounded-2xl', // 16px - primitive.borderRadius.2xl\n '3xl': 'rounded-3xl', // 24px - primitive.borderRadius.3xl\n full: 'rounded-full', // 9999px - primitive.borderRadius.full\n },\n fullWidth: {\n true: 'w-full',\n false: 'w-auto',\n },\n },\n defaultVariants: {\n variant: 'solid',\n size: 'default',\n radius: 'default',\n fullWidth: false,\n },\n }\n)\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n /** Solid variant color */\n color?: ButtonColor\n asChild?: boolean\n loading?: boolean\n leftIcon?: React.ReactNode\n rightIcon?: React.ReactNode\n selected?: boolean\n fontWeight?: 'normal' | 'semibold'\n pressEffect?: boolean\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({\n className,\n variant: variantProp,\n color: colorProp,\n size: sizeProp,\n radius: radiusProp,\n fullWidth,\n asChild = false,\n loading = false,\n disabled: disabledProp,\n leftIcon,\n rightIcon,\n selected = false,\n fontWeight: fontWeightProp,\n pressEffect,\n children,\n ...props\n }, ref) => {\n const Comp = asChild ? Slot : 'button'\n const groupContext = useButtonGroup()\n\n // Use context values as fallback, individual props take precedence\n const variant = variantProp ?? groupContext?.variant ?? 'solid'\n const color = colorProp ?? 'default'\n const size = sizeProp ?? groupContext?.size\n const radius = radiusProp ?? groupContext?.radius\n const disabled = disabledProp ?? groupContext?.disabled\n\n // Priority: direct prop > ButtonGroup context > variant default (no class)\n const fontWeight = fontWeightProp ?? groupContext?.fontWeight\n\n // FontWeight class (overrides variant default)\n const fontWeightClass = fontWeight === 'normal' ? 'font-normal' : fontWeight === 'semibold' ? 'font-semibold' : ''\n\n // Icon size for button with text (5-step scale)\n // xs~sm: 14px, md~default~lg: 16px\n const iconSizeClass = {\n xs: 'icon-xs', // 14px\n sm: 'icon-xs', // 14px\n md: 'icon-sm', // 16px\n default: 'icon-sm', // 16px\n lg: 'icon-sm', // 16px\n icon: 'icon-md', // icon-only → 20px\n }[size || 'default']\n\n // Selected styles by variant (used in ButtonGroup)\n const selectedStyles = selected ? (\n variant === 'outline' ? 'bg-background-muted' :\n variant === 'ghost' ? 'font-semibold' : ''\n ) : ''\n\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, radius, fullWidth }), variant === 'solid' && solidColorMap[color], pressEffect !== false && 'active:scale-pressed', fontWeightClass, selectedStyles, className)}\n ref={ref}\n disabled={disabled || loading}\n aria-busy={loading || undefined}\n aria-pressed={selected || undefined}\n {...props}\n >\n {loading ? (\n <>\n <svg\n className={cn(iconSizeClass, 'animate-spin')}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n aria-hidden=\"true\"\n >\n <circle className=\"opacity-25\" cx=\"12\" cy=\"12\" r=\"10\" stroke=\"currentColor\" strokeWidth=\"4\" />\n <path className=\"opacity-75\" fill=\"currentColor\" d=\"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z\" />\n </svg>\n <span>{children}</span>\n </>\n ) : (\n <>\n {leftIcon && <span className={cn(iconSizeClass, '[&>svg]:w-full [&>svg]:h-full')} aria-hidden=\"true\">{leftIcon}</span>}\n {children}\n {rightIcon && <span className={cn(iconSizeClass, '[&>svg]:w-full [&>svg]:h-full')} aria-hidden=\"true\">{rightIcon}</span>}\n </>\n )}\n </Comp>\n )\n }\n)\nButton.displayName = 'Button'\n\nexport { Button, buttonVariants }\n"],"mappings":";AAyIU,mBAOI,KANF,YADF;AAvIV,YAAY,WAAW;AACvB,SAAS,YAAY;AACrB,SAAS,WAA8B;AACvC,SAAS,UAAU;AACnB,SAAS,sBAAsB;AAG/B,MAAM,gBAAgB;AAAA,EACpB,SAAS;AAAA,EACT,SAAS;AAAA,EACT,WAAW;AAAA,EACX,aAAa;AACf;AAIA,MAAM,iBAAiB;AAAA,EACrB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,OAAO;AAAA,QACP,SAAS;AAAA,QACT,OAAO;AAAA,QACP,MAAM;AAAA,MACR;AAAA,MACA,MAAM;AAAA,QACJ,IAAI;AAAA;AAAA,QACJ,IAAI;AAAA;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AA,MACJ,SAAS;AAAA;AAAA,MACT,IAAI;AAAA;AAAA,MACJ,MAAM;AAAA;AAAA,IACR,EAAE,QAAQ,SAAS;AAGnB,UAAM,iBAAiB,WACrB,YAAY,YAAY,wBACxB,YAAY,UAAU,kBAAkB,KACtC;AAEJ,WACE;AAAA,MAAC;AAAA;AAAA,QACC,WAAW,GAAG,eAAe,EAAE,SAAS,MAAM,QAAQ,UAAU,CAAC,GAAG,YAAY,WAAW,cAAc,KAAK,GAAG,gBAAgB,SAAS,wBAAwB,iBAAiB,gBAAgB,SAAS;AAAA,QAC5M;AAAA,QACA,UAAU,YAAY;AAAA,QACtB,aAAW,WAAW;AAAA,QACtB,gBAAc,YAAY;AAAA,QACzB,GAAG;AAAA,QAEH,oBACC,iCACE;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,WAAW,GAAG,eAAe,cAAc;AAAA,cAC3C,MAAK;AAAA,cACL,SAAQ;AAAA,cACR,eAAY;AAAA,cAEZ;AAAA,oCAAC,YAAO,WAAU,cAAa,IAAG,MAAK,IAAG,MAAK,GAAE,MAAK,QAAO,gBAAe,aAAY,KAAI;AAAA,gBAC5F,oBAAC,UAAK,WAAU,cAAa,MAAK,gBAAe,GAAE,mHAAkH;AAAA;AAAA;AAAA,UACvK;AAAA,UACA,oBAAC,UAAM,UAAS;AAAA,WAClB,IAEA,iCACG;AAAA,sBAAY,oBAAC,UAAK,WAAW,GAAG,eAAe,+BAA+B,GAAG,eAAY,QAAQ,oBAAS;AAAA,UAC9G;AAAA,UACA,aAAa,oBAAC,UAAK,WAAW,GAAG,eAAe,+BAA+B,GAAG,eAAY,QAAQ,qBAAU;AAAA,WACnH;AAAA;AAAA,IAEJ;AAAA,EAEJ;AACF;AACA,OAAO,cAAc;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/button.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\nimport { useButtonGroup } from './button-group'\n\n// Solid color maps (applied when variant=\"solid\")\nconst solidColorMap = {\n default: 'bg-foreground text-background hover:bg-foreground/90 active:bg-foreground/80',\n primary: 'bg-primary text-primary-foreground hover:bg-primary-hover active:bg-primary-active',\n secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary-hover active:bg-secondary-active',\n destructive: 'bg-error text-error-foreground hover:bg-error-hover active:bg-error-active',\n} as const\n\nexport type ButtonColor = keyof typeof solidColorMap\n\nconst buttonVariants = cva(\n 'inline-flex items-center justify-center whitespace-nowrap transition-all duration-micro focus-visible:focus-ring disabled:pointer-events-none disabled:opacity-50',\n {\n variants: {\n variant: {\n solid: 'font-semibold',\n outline: 'border border-border-form bg-background text-foreground hover:bg-background-muted font-normal',\n ghost: 'text-foreground hover:bg-background-muted font-normal',\n link: 'text-text-link underline-offset-4 hover:underline font-normal',\n },\n size: {\n xs: 'h-7 px-2.5 text-xs gap-1', // 28px height, 10px paddingX, 12px font\n sm: 'h-8 px-3 text-sm gap-2', // 32px height, 12px paddingX, 13px font\n md: 'h-9 px-3.5 text-md gap-2', // 36px height, 14px paddingX, 14px font\n default: 'h-10 px-4 text-md gap-2', // 40px height, 16px paddingX, 14px font\n lg: 'h-12 px-6 text-base gap-2', // 48px height, 24px paddingX, 16px font\n icon: 'h-10 w-10',\n },\n radius: {\n none: 'rounded-none', // 0px - primitive.borderRadius.none\n sm: 'rounded-sm', // 2px - primitive.borderRadius.sm\n base: 'rounded', // 4px - primitive.borderRadius.base\n default: 'rounded-md', // 6px - primitive.borderRadius.md (Figma button default)\n lg: 'rounded-lg', // 8px - primitive.borderRadius.lg\n xl: 'rounded-xl', // 12px - primitive.borderRadius.xl\n '2xl': 'rounded-2xl', // 16px - primitive.borderRadius.2xl\n '3xl': 'rounded-3xl', // 24px - primitive.borderRadius.3xl\n full: 'rounded-full', // 9999px - primitive.borderRadius.full\n },\n fullWidth: {\n true: 'w-full',\n false: 'w-auto',\n },\n },\n defaultVariants: {\n variant: 'solid',\n size: 'default',\n radius: 'default',\n fullWidth: false,\n },\n }\n)\n\nconst REACT_LAZY_TYPE = Symbol.for('react.lazy')\n\n// asChild: Slot merges props only into a single child element, so icons and\n// wrappers must go inside that child, not next to it. Lazy children (from\n// Server Components) are resolved the same way Radix Slot does.\nfunction renderInsideChild(\n children: React.ReactNode,\n render: (content: React.ReactNode) => React.ReactNode\n): React.ReactNode {\n let child: unknown = children\n const resolve = (React as { use?: (usable: unknown) => unknown }).use\n if (\n typeof child === 'object' && child !== null &&\n (child as { $$typeof?: symbol }).$$typeof === REACT_LAZY_TYPE &&\n typeof resolve === 'function'\n ) {\n child = resolve((child as { _payload: unknown })._payload)\n }\n if (!React.isValidElement<{ children?: React.ReactNode }>(child)) return render(children)\n return React.cloneElement(child, undefined, render(child.props.children))\n}\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n /** Solid variant color */\n color?: ButtonColor\n asChild?: boolean\n loading?: boolean\n leftIcon?: React.ReactNode\n rightIcon?: React.ReactNode\n selected?: boolean\n fontWeight?: 'normal' | 'semibold'\n pressEffect?: boolean\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({\n className,\n variant: variantProp,\n color: colorProp,\n size: sizeProp,\n radius: radiusProp,\n fullWidth,\n asChild = false,\n loading = false,\n disabled: disabledProp,\n leftIcon,\n rightIcon,\n selected = false,\n fontWeight: fontWeightProp,\n pressEffect,\n children,\n ...props\n }, ref) => {\n const Comp = asChild ? Slot : 'button'\n const groupContext = useButtonGroup()\n\n // Use context values as fallback, individual props take precedence\n const variant = variantProp ?? groupContext?.variant ?? 'solid'\n const color = colorProp ?? 'default'\n const size = sizeProp ?? groupContext?.size\n const radius = radiusProp ?? groupContext?.radius\n const disabled = disabledProp ?? groupContext?.disabled\n\n // Priority: direct prop > ButtonGroup context > variant default (no class)\n const fontWeight = fontWeightProp ?? groupContext?.fontWeight\n\n // FontWeight class (overrides variant default)\n const fontWeightClass = fontWeight === 'normal' ? 'font-normal' : fontWeight === 'semibold' ? 'font-semibold' : ''\n\n // Icon size for button with text (5-step scale)\n // xs~sm: 14px, md~default~lg: 16px\n const iconSizeClass = {\n xs: 'icon-xs', // 14px\n sm: 'icon-xs', // 14px\n md: 'icon-sm', // 16px\n default: 'icon-sm', // 16px\n lg: 'icon-sm', // 16px\n icon: 'icon-md', // icon-only → 20px\n }[size || 'default']\n\n // Selected styles by variant (used in ButtonGroup)\n const selectedStyles = selected ? (\n variant === 'outline' ? 'bg-background-muted' :\n variant === 'ghost' ? 'font-semibold' : ''\n ) : ''\n\n const renderContent = (content: React.ReactNode) => loading ? (\n <>\n <svg\n className={cn(iconSizeClass, 'animate-spin')}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n aria-hidden=\"true\"\n >\n <circle className=\"opacity-25\" cx=\"12\" cy=\"12\" r=\"10\" stroke=\"currentColor\" strokeWidth=\"4\" />\n <path className=\"opacity-75\" fill=\"currentColor\" d=\"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z\" />\n </svg>\n <span>{content}</span>\n </>\n ) : (\n <>\n {leftIcon && <span className={cn(iconSizeClass, '[&>svg]:w-full [&>svg]:h-full')} aria-hidden=\"true\">{leftIcon}</span>}\n {content}\n {rightIcon && <span className={cn(iconSizeClass, '[&>svg]:w-full [&>svg]:h-full')} aria-hidden=\"true\">{rightIcon}</span>}\n </>\n )\n\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, radius, fullWidth }), variant === 'solid' && solidColorMap[color], pressEffect !== false && 'active:scale-pressed', fontWeightClass, selectedStyles, className)}\n ref={ref}\n disabled={disabled || loading}\n aria-busy={loading || undefined}\n aria-pressed={selected || undefined}\n {...props}\n >\n {asChild ? renderInsideChild(children, renderContent) : renderContent(children)}\n </Comp>\n )\n }\n)\nButton.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AG,MAAK,IAAG,MAAK,GAAE,MAAK,QAAO,gBAAe,aAAY,KAAI;AAAA,YAC5F,oBAAC,UAAK,WAAU,cAAa,MAAK,gBAAe,GAAE,mHAAkH;AAAA;AAAA;AAAA,MACvK;AAAA,MACA,oBAAC,UAAM,mBAAQ;AAAA,OACjB,IAEA,iCACG;AAAA,kBAAY,oBAAC,UAAK,WAAW,GAAG,eAAe,+BAA+B,GAAG,eAAY,QAAQ,oBAAS;AAAA,MAC9G;AAAA,MACA,aAAa,oBAAC,UAAK,WAAW,GAAG,eAAe,+BAA+B,GAAG,eAAY,QAAQ,qBAAU;AAAA,OACnH;AAGF,WACE;AAAA,MAAC;AAAA;AAAA,QACC,WAAW,GAAG,eAAe,EAAE,SAAS,MAAM,QAAQ,UAAU,CAAC,GAAG,YAAY,WAAW,cAAc,KAAK,GAAG,gBAAgB,SAAS,wBAAwB,iBAAiB,gBAAgB,SAAS;AAAA,QAC5M;AAAA,QACA,UAAU,YAAY;AAAA,QACtB,aAAW,WAAW;AAAA,QACtB,gBAAc,YAAY;AAAA,QACzB,GAAG;AAAA,QAEH,oBAAU,kBAAkB,UAAU,aAAa,IAAI,cAAc,QAAQ;AAAA;AAAA,IAChF;AAAA,EAEJ;AACF;AACA,OAAO,cAAc;","names":[]}
|
|
@@ -6,7 +6,7 @@ type CardSize = 'sm' | 'default' | 'lg';
|
|
|
6
6
|
type CardDirection = 'vertical' | 'horizontal';
|
|
7
7
|
declare const cardVariants: (props?: ({
|
|
8
8
|
variant?: "default" | "outline" | "ghost" | null | undefined;
|
|
9
|
-
size?: "
|
|
9
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
10
10
|
radius?: "sm" | "lg" | "base" | "md" | "xl" | "2xl" | null | undefined;
|
|
11
11
|
direction?: "horizontal" | "vertical" | null | undefined;
|
|
12
12
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
@@ -6,7 +6,7 @@ type CardSize = 'sm' | 'default' | 'lg';
|
|
|
6
6
|
type CardDirection = 'vertical' | 'horizontal';
|
|
7
7
|
declare const cardVariants: (props?: ({
|
|
8
8
|
variant?: "default" | "outline" | "ghost" | null | undefined;
|
|
9
|
-
size?: "
|
|
9
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
10
10
|
radius?: "sm" | "lg" | "base" | "md" | "xl" | "2xl" | null | undefined;
|
|
11
11
|
direction?: "horizontal" | "vertical" | null | undefined;
|
|
12
12
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
@@ -74,7 +74,7 @@ type ChartTooltipContentProps = React.ComponentProps<'div'> & {
|
|
|
74
74
|
labelKey?: string;
|
|
75
75
|
};
|
|
76
76
|
declare function ChartTooltipContent({ active, payload, className, indicator, hideLabel, hideIndicator, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey, }: ChartTooltipContentProps): React.JSX.Element | null;
|
|
77
|
-
declare const ChartLegend:
|
|
77
|
+
declare const ChartLegend: React.MemoExoticComponent<(outsideProps: RechartsPrimitive.LegendProps) => React.ReactPortal | null>;
|
|
78
78
|
type LegendPayloadItem = {
|
|
79
79
|
value?: string;
|
|
80
80
|
type?: string;
|
|
@@ -74,7 +74,7 @@ type ChartTooltipContentProps = React.ComponentProps<'div'> & {
|
|
|
74
74
|
labelKey?: string;
|
|
75
75
|
};
|
|
76
76
|
declare function ChartTooltipContent({ active, payload, className, indicator, hideLabel, hideIndicator, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey, }: ChartTooltipContentProps): React.JSX.Element | null;
|
|
77
|
-
declare const ChartLegend:
|
|
77
|
+
declare const ChartLegend: React.MemoExoticComponent<(outsideProps: RechartsPrimitive.LegendProps) => React.ReactPortal | null>;
|
|
78
78
|
type LegendPayloadItem = {
|
|
79
79
|
value?: string;
|
|
80
80
|
type?: string;
|
|
@@ -9,7 +9,7 @@ declare const checkboxColorMap: {
|
|
|
9
9
|
};
|
|
10
10
|
type CheckboxColor = keyof typeof checkboxColorMap;
|
|
11
11
|
declare const checkboxVariants: (props?: ({
|
|
12
|
-
size?: "
|
|
12
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
13
13
|
radius?: "sm" | "none" | "md" | null | undefined;
|
|
14
14
|
weight?: "bold" | "thin" | null | undefined;
|
|
15
15
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
@@ -9,7 +9,7 @@ declare const checkboxColorMap: {
|
|
|
9
9
|
};
|
|
10
10
|
type CheckboxColor = keyof typeof checkboxColorMap;
|
|
11
11
|
declare const checkboxVariants: (props?: ({
|
|
12
|
-
size?: "
|
|
12
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
13
13
|
radius?: "sm" | "none" | "md" | null | undefined;
|
|
14
14
|
weight?: "bold" | "thin" | null | undefined;
|
|
15
15
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
@@ -6,7 +6,7 @@ declare const dividerVariants: (props?: ({
|
|
|
6
6
|
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
7
7
|
variant?: "solid" | "dashed" | "dotted" | null | undefined;
|
|
8
8
|
color?: "default" | "strong" | "muted" | null | undefined;
|
|
9
|
-
spacing?: "
|
|
9
|
+
spacing?: "default" | "sm" | "lg" | "md" | null | undefined;
|
|
10
10
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
11
11
|
interface DividerProps extends Omit<React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>, 'children' | 'color' | 'orientation'> {
|
|
12
12
|
/** Direction of the divider */
|
|
@@ -6,7 +6,7 @@ declare const dividerVariants: (props?: ({
|
|
|
6
6
|
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
7
7
|
variant?: "solid" | "dashed" | "dotted" | null | undefined;
|
|
8
8
|
color?: "default" | "strong" | "muted" | null | undefined;
|
|
9
|
-
spacing?: "
|
|
9
|
+
spacing?: "default" | "sm" | "lg" | "md" | null | undefined;
|
|
10
10
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
11
11
|
interface DividerProps extends Omit<React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>, 'children' | 'color' | 'orientation'> {
|
|
12
12
|
/** Direction of the divider */
|
|
@@ -22,7 +22,7 @@ type FieldControlKind = 'single' | 'group' | 'labelled';
|
|
|
22
22
|
declare function useFieldContext(): FieldContextValue | null;
|
|
23
23
|
declare function useFieldControl(kind: FieldControlKind, enabled: boolean): void;
|
|
24
24
|
declare const fieldVariants: (props?: ({
|
|
25
|
-
gap?: "
|
|
25
|
+
gap?: "default" | "sm" | "lg" | "none" | "xs" | null | undefined;
|
|
26
26
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
27
27
|
interface FieldProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof fieldVariants> {
|
|
28
28
|
error?: boolean;
|
|
@@ -22,7 +22,7 @@ type FieldControlKind = 'single' | 'group' | 'labelled';
|
|
|
22
22
|
declare function useFieldContext(): FieldContextValue | null;
|
|
23
23
|
declare function useFieldControl(kind: FieldControlKind, enabled: boolean): void;
|
|
24
24
|
declare const fieldVariants: (props?: ({
|
|
25
|
-
gap?: "
|
|
25
|
+
gap?: "default" | "sm" | "lg" | "none" | "xs" | null | undefined;
|
|
26
26
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
27
27
|
interface FieldProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof fieldVariants> {
|
|
28
28
|
error?: boolean;
|
|
@@ -5,8 +5,8 @@ import { ButtonColor } from './button.mjs';
|
|
|
5
5
|
|
|
6
6
|
declare const iconButtonVariants: (props?: ({
|
|
7
7
|
variant?: "outline" | "solid" | "subtle" | "ghost" | null | undefined;
|
|
8
|
-
size?: "
|
|
9
|
-
radius?: "
|
|
8
|
+
size?: "default" | "sm" | "lg" | "md" | "xs" | null | undefined;
|
|
9
|
+
radius?: "default" | "sm" | "lg" | "base" | "none" | "xl" | "2xl" | "3xl" | "full" | null | undefined;
|
|
10
10
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
11
11
|
interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof iconButtonVariants> {
|
|
12
12
|
/** Solid variant color */
|
|
@@ -5,8 +5,8 @@ import { ButtonColor } from './button.js';
|
|
|
5
5
|
|
|
6
6
|
declare const iconButtonVariants: (props?: ({
|
|
7
7
|
variant?: "outline" | "solid" | "subtle" | "ghost" | null | undefined;
|
|
8
|
-
size?: "
|
|
9
|
-
radius?: "
|
|
8
|
+
size?: "default" | "sm" | "lg" | "md" | "xs" | null | undefined;
|
|
9
|
+
radius?: "default" | "sm" | "lg" | "base" | "none" | "xl" | "2xl" | "3xl" | "full" | null | undefined;
|
|
10
10
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
11
11
|
interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof iconButtonVariants> {
|
|
12
12
|
/** Solid variant color */
|
|
@@ -95,6 +95,16 @@ const iconButtonVariants = (0, import_class_variance_authority.cva)(
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
);
|
|
98
|
+
const REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
|
|
99
|
+
function renderInsideChild(children, render) {
|
|
100
|
+
let child = children;
|
|
101
|
+
const resolve = React.use;
|
|
102
|
+
if (typeof child === "object" && child !== null && child.$$typeof === REACT_LAZY_TYPE && typeof resolve === "function") {
|
|
103
|
+
child = resolve(child._payload);
|
|
104
|
+
}
|
|
105
|
+
if (!React.isValidElement(child)) return render(children);
|
|
106
|
+
return React.cloneElement(child, void 0, render(child.props.children));
|
|
107
|
+
}
|
|
98
108
|
const IconButton = React.forwardRef(
|
|
99
109
|
({ className, variant: variantProp, color: colorProp, size: sizeProp, radius: radiusProp, asChild = false, loading, pressEffect, children, disabled: disabledProp, ...props }, ref) => {
|
|
100
110
|
const groupContext = (0, import_button_group.useButtonGroup)();
|
|
@@ -116,6 +126,19 @@ const IconButton = React.forwardRef(
|
|
|
116
126
|
lg: "icon-lg"
|
|
117
127
|
// 24px
|
|
118
128
|
}[size || "default"];
|
|
129
|
+
const renderContent = (content) => loading ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
130
|
+
"svg",
|
|
131
|
+
{
|
|
132
|
+
className: (0, import_utils.cn)(iconSize, "animate-spin"),
|
|
133
|
+
fill: "none",
|
|
134
|
+
viewBox: "0 0 24 24",
|
|
135
|
+
"aria-hidden": "true",
|
|
136
|
+
children: [
|
|
137
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
138
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: (0, import_utils.cn)(iconSize, "[&>svg]:w-full [&>svg]:h-full"), "aria-hidden": "true", children: content });
|
|
119
142
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
120
143
|
Comp,
|
|
121
144
|
{
|
|
@@ -124,19 +147,7 @@ const IconButton = React.forwardRef(
|
|
|
124
147
|
disabled: disabled || loading,
|
|
125
148
|
"aria-busy": loading || void 0,
|
|
126
149
|
...props,
|
|
127
|
-
children:
|
|
128
|
-
"svg",
|
|
129
|
-
{
|
|
130
|
-
className: (0, import_utils.cn)(iconSize, "animate-spin"),
|
|
131
|
-
fill: "none",
|
|
132
|
-
viewBox: "0 0 24 24",
|
|
133
|
-
"aria-hidden": "true",
|
|
134
|
-
children: [
|
|
135
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
136
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
|
|
137
|
-
]
|
|
138
|
-
}
|
|
139
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: (0, import_utils.cn)(iconSize, "[&>svg]:w-full [&>svg]:h-full"), "aria-hidden": "true", children })
|
|
150
|
+
children: asChild ? renderInsideChild(children, renderContent) : renderContent(children)
|
|
140
151
|
}
|
|
141
152
|
);
|
|
142
153
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/ui/icon-button.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\nimport { useButtonGroup } from './button-group'\n\nimport { type ButtonColor } from './button'\n\n// Solid color maps (same as Button)\nconst solidColorMap = {\n default: 'bg-foreground text-background hover:bg-foreground/90 active:bg-foreground/80',\n primary: 'bg-primary text-primary-foreground hover:bg-primary-hover active:bg-primary-active',\n secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary-hover active:bg-secondary-active',\n destructive: 'bg-error text-error-foreground hover:bg-error-hover active:bg-error-active',\n} as const\n\nconst iconButtonVariants = cva(\n 'inline-flex items-center justify-center transition-all duration-micro focus-visible:focus-ring disabled:pointer-events-none disabled:opacity-50',\n {\n variants: {\n variant: {\n solid: '',\n outline: 'border border-border-form bg-background text-foreground hover:bg-background-muted',\n ghost: 'text-foreground hover:bg-background-muted',\n subtle: 'text-text-muted hover:text-foreground',\n },\n size: {\n xs: 'h-7 w-7', // 28px - spacing.7\n sm: 'h-8 w-8', // 32px - spacing.8\n md: 'h-9 w-9', // 36px - spacing.9\n default: 'h-10 w-10', // 40px - spacing.10\n lg: 'h-12 w-12', // 48px - spacing.12\n },\n radius: {\n none: 'rounded-none', // 0px - primitive.borderRadius.none\n sm: 'rounded-sm', // 2px - primitive.borderRadius.sm\n base: 'rounded', // 4px - primitive.borderRadius.base\n default: 'rounded-md', // 6px - primitive.borderRadius.md (Figma button default)\n lg: 'rounded-lg', // 8px - primitive.borderRadius.lg\n xl: 'rounded-xl', // 12px - primitive.borderRadius.xl\n '2xl': 'rounded-2xl', // 16px - primitive.borderRadius.2xl\n '3xl': 'rounded-3xl', // 24px - primitive.borderRadius.3xl\n full: 'rounded-full', // 9999px - primitive.borderRadius.full\n },\n },\n defaultVariants: {\n variant: 'solid',\n size: 'default',\n radius: 'default',\n },\n }\n)\n\nexport interface IconButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof iconButtonVariants> {\n /** Solid variant color */\n color?: ButtonColor\n asChild?: boolean\n loading?: boolean\n pressEffect?: boolean\n}\n\nconst IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(\n ({ className, variant: variantProp, color: colorProp, size: sizeProp, radius: radiusProp, asChild = false, loading, pressEffect, children, disabled: disabledProp, ...props }, ref) => {\n const groupContext = useButtonGroup()\n\n // Priority: direct prop > ButtonGroup context > variant default\n const variant = variantProp ?? groupContext?.variant ?? 'solid'\n const color = colorProp ?? 'default'\n const size = sizeProp ?? groupContext?.size\n const radius = radiusProp ?? groupContext?.radius\n const disabled = disabledProp ?? groupContext?.disabled\n\n const Comp = asChild ? Slot : 'button'\n\n // Icon size for icon-only button (5-step scale)\n // XS: 14px, SM~MD: 16px, Default: 20px, LG: 24px\n const iconSize = {\n xs: 'icon-xs', // 14px\n sm: 'icon-sm', // 16px\n md: 'icon-sm', // 16px\n default: 'icon-md', // 20px\n lg: 'icon-lg', // 24px\n }[size || 'default']\n\n
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/icon-button.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\nimport { useButtonGroup } from './button-group'\n\nimport { type ButtonColor } from './button'\n\n// Solid color maps (same as Button)\nconst solidColorMap = {\n default: 'bg-foreground text-background hover:bg-foreground/90 active:bg-foreground/80',\n primary: 'bg-primary text-primary-foreground hover:bg-primary-hover active:bg-primary-active',\n secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary-hover active:bg-secondary-active',\n destructive: 'bg-error text-error-foreground hover:bg-error-hover active:bg-error-active',\n} as const\n\nconst iconButtonVariants = cva(\n 'inline-flex items-center justify-center transition-all duration-micro focus-visible:focus-ring disabled:pointer-events-none disabled:opacity-50',\n {\n variants: {\n variant: {\n solid: '',\n outline: 'border border-border-form bg-background text-foreground hover:bg-background-muted',\n ghost: 'text-foreground hover:bg-background-muted',\n subtle: 'text-text-muted hover:text-foreground',\n },\n size: {\n xs: 'h-7 w-7', // 28px - spacing.7\n sm: 'h-8 w-8', // 32px - spacing.8\n md: 'h-9 w-9', // 36px - spacing.9\n default: 'h-10 w-10', // 40px - spacing.10\n lg: 'h-12 w-12', // 48px - spacing.12\n },\n radius: {\n none: 'rounded-none', // 0px - primitive.borderRadius.none\n sm: 'rounded-sm', // 2px - primitive.borderRadius.sm\n base: 'rounded', // 4px - primitive.borderRadius.base\n default: 'rounded-md', // 6px - primitive.borderRadius.md (Figma button default)\n lg: 'rounded-lg', // 8px - primitive.borderRadius.lg\n xl: 'rounded-xl', // 12px - primitive.borderRadius.xl\n '2xl': 'rounded-2xl', // 16px - primitive.borderRadius.2xl\n '3xl': 'rounded-3xl', // 24px - primitive.borderRadius.3xl\n full: 'rounded-full', // 9999px - primitive.borderRadius.full\n },\n },\n defaultVariants: {\n variant: 'solid',\n size: 'default',\n radius: 'default',\n },\n }\n)\n\nconst REACT_LAZY_TYPE = Symbol.for('react.lazy')\n\n// asChild: Slot merges props only into a single child element, so the icon\n// wrapper must go inside that child, not around it. Lazy children (from\n// Server Components) are resolved the same way Radix Slot does.\nfunction renderInsideChild(\n children: React.ReactNode,\n render: (content: React.ReactNode) => React.ReactNode\n): React.ReactNode {\n let child: unknown = children\n const resolve = (React as { use?: (usable: unknown) => unknown }).use\n if (\n typeof child === 'object' && child !== null &&\n (child as { $$typeof?: symbol }).$$typeof === REACT_LAZY_TYPE &&\n typeof resolve === 'function'\n ) {\n child = resolve((child as { _payload: unknown })._payload)\n }\n if (!React.isValidElement<{ children?: React.ReactNode }>(child)) return render(children)\n return React.cloneElement(child, undefined, render(child.props.children))\n}\n\nexport interface IconButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof iconButtonVariants> {\n /** Solid variant color */\n color?: ButtonColor\n asChild?: boolean\n loading?: boolean\n pressEffect?: boolean\n}\n\nconst IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(\n ({ className, variant: variantProp, color: colorProp, size: sizeProp, radius: radiusProp, asChild = false, loading, pressEffect, children, disabled: disabledProp, ...props }, ref) => {\n const groupContext = useButtonGroup()\n\n // Priority: direct prop > ButtonGroup context > variant default\n const variant = variantProp ?? groupContext?.variant ?? 'solid'\n const color = colorProp ?? 'default'\n const size = sizeProp ?? groupContext?.size\n const radius = radiusProp ?? groupContext?.radius\n const disabled = disabledProp ?? groupContext?.disabled\n\n const Comp = asChild ? Slot : 'button'\n\n // Icon size for icon-only button (5-step scale)\n // XS: 14px, SM~MD: 16px, Default: 20px, LG: 24px\n const iconSize = {\n xs: 'icon-xs', // 14px\n sm: 'icon-sm', // 16px\n md: 'icon-sm', // 16px\n default: 'icon-md', // 20px\n lg: 'icon-lg', // 24px\n }[size || 'default']\n\n const renderContent = (content: React.ReactNode) => loading ? (\n <svg\n className={cn(iconSize, 'animate-spin')}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n aria-hidden=\"true\"\n >\n <circle className=\"opacity-25\" cx=\"12\" cy=\"12\" r=\"10\" stroke=\"currentColor\" strokeWidth=\"4\" />\n <path className=\"opacity-75\" fill=\"currentColor\" d=\"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z\" />\n </svg>\n ) : (\n <span className={cn(iconSize, '[&>svg]:w-full [&>svg]:h-full')} aria-hidden=\"true\">\n {content}\n </span>\n )\n\n return (\n <Comp\n className={cn(iconButtonVariants({ variant, size, radius }), variant === 'solid' && solidColorMap[color], pressEffect !== false && 'active:scale-pressed', className)}\n ref={ref}\n disabled={disabled || loading}\n aria-busy={loading || undefined}\n {...props}\n >\n {asChild ? renderInsideChild(children, renderContent) : renderContent(children)}\n </Comp>\n )\n }\n)\nIconButton.displayName = 'IconButton'\n\nexport { IconButton, iconButtonVariants }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA+GM;AA7GN,YAAuB;AACvB,wBAAqB;AACrB,sCAAuC;AACvC,mBAAmB;AACnB,0BAA+B;AAK/B,MAAM,gBAAgB;AAAA,EACpB,SAAS;AAAA,EACT,SAAS;AAAA,EACT,WAAW;AAAA,EACX,aAAa;AACf;AAEA,MAAM,yBAAqB;AAAA,EACzB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,OAAO;AAAA,QACP,SAAS;AAAA,QACT,OAAO;AAAA,QACP,QAAQ;AAAA,MACV;AAAA,MACA,MAAM;AAAA,QACJ,IAAI;AAAA;AAAA,QACJ,IAAI;AAAA;AAAA,QACJ,IAAI;AAAA;AAAA,QACJ,SAAS;AAAA;AAAA,QACT,IAAI;AAAA;AAAA,MACN;AAAA,MACA,QAAQ;AAAA,QACN,MAAM;AAAA;AAAA,QACN,IAAI;AAAA;AAAA,QACJ,MAAM;AAAA;AAAA,QACN,SAAS;AAAA;AAAA,QACT,IAAI;AAAA;AAAA,QACJ,IAAI;AAAA;AAAA,QACJ,OAAO;AAAA;AAAA,QACP,OAAO;AAAA;AAAA,QACP,M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AC,YAAO,WAAU,cAAa,IAAG,MAAK,IAAG,MAAK,GAAE,MAAK,QAAO,gBAAe,aAAY,KAAI;AAAA,UAC5F,4CAAC,UAAK,WAAU,cAAa,MAAK,gBAAe,GAAE,mHAAkH;AAAA;AAAA;AAAA,IACvK,IAEA,4CAAC,UAAK,eAAW,iBAAG,UAAU,+BAA+B,GAAG,eAAY,QACzE,mBACH;AAGF,WACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAW,iBAAG,mBAAmB,EAAE,SAAS,MAAM,OAAO,CAAC,GAAG,YAAY,WAAW,cAAc,KAAK,GAAG,gBAAgB,SAAS,wBAAwB,SAAS;AAAA,QACpK;AAAA,QACA,UAAU,YAAY;AAAA,QACtB,aAAW,WAAW;AAAA,QACrB,GAAG;AAAA,QAEH,oBAAU,kBAAkB,UAAU,aAAa,IAAI,cAAc,QAAQ;AAAA;AAAA,IAChF;AAAA,EAEJ;AACF;AACA,WAAW,cAAc;","names":[]}
|
|
@@ -61,6 +61,16 @@ const iconButtonVariants = cva(
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
);
|
|
64
|
+
const REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
|
|
65
|
+
function renderInsideChild(children, render) {
|
|
66
|
+
let child = children;
|
|
67
|
+
const resolve = React.use;
|
|
68
|
+
if (typeof child === "object" && child !== null && child.$$typeof === REACT_LAZY_TYPE && typeof resolve === "function") {
|
|
69
|
+
child = resolve(child._payload);
|
|
70
|
+
}
|
|
71
|
+
if (!React.isValidElement(child)) return render(children);
|
|
72
|
+
return React.cloneElement(child, void 0, render(child.props.children));
|
|
73
|
+
}
|
|
64
74
|
const IconButton = React.forwardRef(
|
|
65
75
|
({ className, variant: variantProp, color: colorProp, size: sizeProp, radius: radiusProp, asChild = false, loading, pressEffect, children, disabled: disabledProp, ...props }, ref) => {
|
|
66
76
|
const groupContext = useButtonGroup();
|
|
@@ -82,6 +92,19 @@ const IconButton = React.forwardRef(
|
|
|
82
92
|
lg: "icon-lg"
|
|
83
93
|
// 24px
|
|
84
94
|
}[size || "default"];
|
|
95
|
+
const renderContent = (content) => loading ? /* @__PURE__ */ jsxs(
|
|
96
|
+
"svg",
|
|
97
|
+
{
|
|
98
|
+
className: cn(iconSize, "animate-spin"),
|
|
99
|
+
fill: "none",
|
|
100
|
+
viewBox: "0 0 24 24",
|
|
101
|
+
"aria-hidden": "true",
|
|
102
|
+
children: [
|
|
103
|
+
/* @__PURE__ */ jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
104
|
+
/* @__PURE__ */ jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
) : /* @__PURE__ */ jsx("span", { className: cn(iconSize, "[&>svg]:w-full [&>svg]:h-full"), "aria-hidden": "true", children: content });
|
|
85
108
|
return /* @__PURE__ */ jsx(
|
|
86
109
|
Comp,
|
|
87
110
|
{
|
|
@@ -90,19 +113,7 @@ const IconButton = React.forwardRef(
|
|
|
90
113
|
disabled: disabled || loading,
|
|
91
114
|
"aria-busy": loading || void 0,
|
|
92
115
|
...props,
|
|
93
|
-
children:
|
|
94
|
-
"svg",
|
|
95
|
-
{
|
|
96
|
-
className: cn(iconSize, "animate-spin"),
|
|
97
|
-
fill: "none",
|
|
98
|
-
viewBox: "0 0 24 24",
|
|
99
|
-
"aria-hidden": "true",
|
|
100
|
-
children: [
|
|
101
|
-
/* @__PURE__ */ jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
102
|
-
/* @__PURE__ */ jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
|
|
103
|
-
]
|
|
104
|
-
}
|
|
105
|
-
) : /* @__PURE__ */ jsx("span", { className: cn(iconSize, "[&>svg]:w-full [&>svg]:h-full"), "aria-hidden": "true", children })
|
|
116
|
+
children: asChild ? renderInsideChild(children, renderContent) : renderContent(children)
|
|
106
117
|
}
|
|
107
118
|
);
|
|
108
119
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/ui/icon-button.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\nimport { useButtonGroup } from './button-group'\n\nimport { type ButtonColor } from './button'\n\n// Solid color maps (same as Button)\nconst solidColorMap = {\n default: 'bg-foreground text-background hover:bg-foreground/90 active:bg-foreground/80',\n primary: 'bg-primary text-primary-foreground hover:bg-primary-hover active:bg-primary-active',\n secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary-hover active:bg-secondary-active',\n destructive: 'bg-error text-error-foreground hover:bg-error-hover active:bg-error-active',\n} as const\n\nconst iconButtonVariants = cva(\n 'inline-flex items-center justify-center transition-all duration-micro focus-visible:focus-ring disabled:pointer-events-none disabled:opacity-50',\n {\n variants: {\n variant: {\n solid: '',\n outline: 'border border-border-form bg-background text-foreground hover:bg-background-muted',\n ghost: 'text-foreground hover:bg-background-muted',\n subtle: 'text-text-muted hover:text-foreground',\n },\n size: {\n xs: 'h-7 w-7', // 28px - spacing.7\n sm: 'h-8 w-8', // 32px - spacing.8\n md: 'h-9 w-9', // 36px - spacing.9\n default: 'h-10 w-10', // 40px - spacing.10\n lg: 'h-12 w-12', // 48px - spacing.12\n },\n radius: {\n none: 'rounded-none', // 0px - primitive.borderRadius.none\n sm: 'rounded-sm', // 2px - primitive.borderRadius.sm\n base: 'rounded', // 4px - primitive.borderRadius.base\n default: 'rounded-md', // 6px - primitive.borderRadius.md (Figma button default)\n lg: 'rounded-lg', // 8px - primitive.borderRadius.lg\n xl: 'rounded-xl', // 12px - primitive.borderRadius.xl\n '2xl': 'rounded-2xl', // 16px - primitive.borderRadius.2xl\n '3xl': 'rounded-3xl', // 24px - primitive.borderRadius.3xl\n full: 'rounded-full', // 9999px - primitive.borderRadius.full\n },\n },\n defaultVariants: {\n variant: 'solid',\n size: 'default',\n radius: 'default',\n },\n }\n)\n\nexport interface IconButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof iconButtonVariants> {\n /** Solid variant color */\n color?: ButtonColor\n asChild?: boolean\n loading?: boolean\n pressEffect?: boolean\n}\n\nconst IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(\n ({ className, variant: variantProp, color: colorProp, size: sizeProp, radius: radiusProp, asChild = false, loading, pressEffect, children, disabled: disabledProp, ...props }, ref) => {\n const groupContext = useButtonGroup()\n\n // Priority: direct prop > ButtonGroup context > variant default\n const variant = variantProp ?? groupContext?.variant ?? 'solid'\n const color = colorProp ?? 'default'\n const size = sizeProp ?? groupContext?.size\n const radius = radiusProp ?? groupContext?.radius\n const disabled = disabledProp ?? groupContext?.disabled\n\n const Comp = asChild ? Slot : 'button'\n\n // Icon size for icon-only button (5-step scale)\n // XS: 14px, SM~MD: 16px, Default: 20px, LG: 24px\n const iconSize = {\n xs: 'icon-xs', // 14px\n sm: 'icon-sm', // 16px\n md: 'icon-sm', // 16px\n default: 'icon-md', // 20px\n lg: 'icon-lg', // 24px\n }[size || 'default']\n\n
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/icon-button.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\nimport { useButtonGroup } from './button-group'\n\nimport { type ButtonColor } from './button'\n\n// Solid color maps (same as Button)\nconst solidColorMap = {\n default: 'bg-foreground text-background hover:bg-foreground/90 active:bg-foreground/80',\n primary: 'bg-primary text-primary-foreground hover:bg-primary-hover active:bg-primary-active',\n secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary-hover active:bg-secondary-active',\n destructive: 'bg-error text-error-foreground hover:bg-error-hover active:bg-error-active',\n} as const\n\nconst iconButtonVariants = cva(\n 'inline-flex items-center justify-center transition-all duration-micro focus-visible:focus-ring disabled:pointer-events-none disabled:opacity-50',\n {\n variants: {\n variant: {\n solid: '',\n outline: 'border border-border-form bg-background text-foreground hover:bg-background-muted',\n ghost: 'text-foreground hover:bg-background-muted',\n subtle: 'text-text-muted hover:text-foreground',\n },\n size: {\n xs: 'h-7 w-7', // 28px - spacing.7\n sm: 'h-8 w-8', // 32px - spacing.8\n md: 'h-9 w-9', // 36px - spacing.9\n default: 'h-10 w-10', // 40px - spacing.10\n lg: 'h-12 w-12', // 48px - spacing.12\n },\n radius: {\n none: 'rounded-none', // 0px - primitive.borderRadius.none\n sm: 'rounded-sm', // 2px - primitive.borderRadius.sm\n base: 'rounded', // 4px - primitive.borderRadius.base\n default: 'rounded-md', // 6px - primitive.borderRadius.md (Figma button default)\n lg: 'rounded-lg', // 8px - primitive.borderRadius.lg\n xl: 'rounded-xl', // 12px - primitive.borderRadius.xl\n '2xl': 'rounded-2xl', // 16px - primitive.borderRadius.2xl\n '3xl': 'rounded-3xl', // 24px - primitive.borderRadius.3xl\n full: 'rounded-full', // 9999px - primitive.borderRadius.full\n },\n },\n defaultVariants: {\n variant: 'solid',\n size: 'default',\n radius: 'default',\n },\n }\n)\n\nconst REACT_LAZY_TYPE = Symbol.for('react.lazy')\n\n// asChild: Slot merges props only into a single child element, so the icon\n// wrapper must go inside that child, not around it. Lazy children (from\n// Server Components) are resolved the same way Radix Slot does.\nfunction renderInsideChild(\n children: React.ReactNode,\n render: (content: React.ReactNode) => React.ReactNode\n): React.ReactNode {\n let child: unknown = children\n const resolve = (React as { use?: (usable: unknown) => unknown }).use\n if (\n typeof child === 'object' && child !== null &&\n (child as { $$typeof?: symbol }).$$typeof === REACT_LAZY_TYPE &&\n typeof resolve === 'function'\n ) {\n child = resolve((child as { _payload: unknown })._payload)\n }\n if (!React.isValidElement<{ children?: React.ReactNode }>(child)) return render(children)\n return React.cloneElement(child, undefined, render(child.props.children))\n}\n\nexport interface IconButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof iconButtonVariants> {\n /** Solid variant color */\n color?: ButtonColor\n asChild?: boolean\n loading?: boolean\n pressEffect?: boolean\n}\n\nconst IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(\n ({ className, variant: variantProp, color: colorProp, size: sizeProp, radius: radiusProp, asChild = false, loading, pressEffect, children, disabled: disabledProp, ...props }, ref) => {\n const groupContext = useButtonGroup()\n\n // Priority: direct prop > ButtonGroup context > variant default\n const variant = variantProp ?? groupContext?.variant ?? 'solid'\n const color = colorProp ?? 'default'\n const size = sizeProp ?? groupContext?.size\n const radius = radiusProp ?? groupContext?.radius\n const disabled = disabledProp ?? groupContext?.disabled\n\n const Comp = asChild ? Slot : 'button'\n\n // Icon size for icon-only button (5-step scale)\n // XS: 14px, SM~MD: 16px, Default: 20px, LG: 24px\n const iconSize = {\n xs: 'icon-xs', // 14px\n sm: 'icon-sm', // 16px\n md: 'icon-sm', // 16px\n default: 'icon-md', // 20px\n lg: 'icon-lg', // 24px\n }[size || 'default']\n\n const renderContent = (content: React.ReactNode) => loading ? (\n <svg\n className={cn(iconSize, 'animate-spin')}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n aria-hidden=\"true\"\n >\n <circle className=\"opacity-25\" cx=\"12\" cy=\"12\" r=\"10\" stroke=\"currentColor\" strokeWidth=\"4\" />\n <path className=\"opacity-75\" fill=\"currentColor\" d=\"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z\" />\n </svg>\n ) : (\n <span className={cn(iconSize, '[&>svg]:w-full [&>svg]:h-full')} aria-hidden=\"true\">\n {content}\n </span>\n )\n\n return (\n <Comp\n className={cn(iconButtonVariants({ variant, size, radius }), variant === 'solid' && solidColorMap[color], pressEffect !== false && 'active:scale-pressed', className)}\n ref={ref}\n disabled={disabled || loading}\n aria-busy={loading || undefined}\n {...props}\n >\n {asChild ? renderInsideChild(children, renderContent) : renderContent(children)}\n </Comp>\n )\n }\n)\nIconButton.displayName = 'IconButton'\n\nexport { IconButton, iconButtonVariants }\n"],"mappings":";AA+GM,SAME,KANF;AA7GN,YAAY,WAAW;AACvB,SAAS,YAAY;AACrB,SAAS,WAA8B;AACvC,SAAS,UAAU;AACnB,SAAS,sBAAsB;AAK/B,MAAM,gBAAgB;AAAA,EACpB,SAAS;AAAA,EACT,SAAS;AAAA,EACT,WAAW;AAAA,EACX,aAAa;AACf;AAEA,MAAM,qBAAqB;AAAA,EACzB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,OAAO;AAAA,QACP,SAAS;AAAA,QACT,OAAO;AAAA,QACP,QAAQ;AAAA,MACV;AAAA,MACA,MAAM;AAAA,QACJ,IAAI;AAAA;AAAA,QACJ,IAAI;AAAA;AAAA,QACJ,IAAI;AAAA;AAAA,QACJ,SAAS;AAAA;AAAA,QACT,IAAI;AAAA;AAAA,MACN;AAAA,MACA,QAAQ;AAAA,QACN,MAAM;AAAA;AAAA,QACN,IAAI;AAAA;AAAA,QACJ,MAAM;AAAA;AAAA,QACN,SAAS;AAAA;AAAA,QACT,IAAI;AAAA;AAAA,QACJ,IAAI;AAAA;AAAA,QACJ,OAAO;AAAA;AAAA,QACP,OAAO;AAAA;AAAA,QACP,MAAM;AAAA;AAAA,MACR;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,SAAS;AAAA,MACT,MAAM;AAAA,MACN,QAAQ;AAAA,IACV;AAAA,EACF;AACF;AAEA,MAAM,kBAAkB,uBAAO,IAAI,YAAY;AAK/C,SAAS,kBACP,UACA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,GAAG,UAAU,+BAA+B,GAAG,eAAY,QACzE,mBACH;AAGF,WACE;AAAA,MAAC;AAAA;AAAA,QACC,WAAW,GAAG,mBAAmB,EAAE,SAAS,MAAM,OAAO,CAAC,GAAG,YAAY,WAAW,cAAc,KAAK,GAAG,gBAAgB,SAAS,wBAAwB,SAAS;AAAA,QACpK;AAAA,QACA,UAAU,YAAY;AAAA,QACtB,aAAW,WAAW;AAAA,QACrB,GAAG;AAAA,QAEH,oBAAU,kBAAkB,UAAU,aAAa,IAAI,cAAc,QAAQ;AAAA;AAAA,IAChF;AAAA,EAEJ;AACF;AACA,WAAW,cAAc;","names":[]}
|
|
@@ -5,9 +5,9 @@ import { VariantProps } from 'class-variance-authority';
|
|
|
5
5
|
declare const inputVariants: (props?: ({
|
|
6
6
|
variant?: "default" | "filled" | null | undefined;
|
|
7
7
|
focusRing?: boolean | null | undefined;
|
|
8
|
-
size?: "
|
|
9
|
-
radius?: "
|
|
10
|
-
state?: "
|
|
8
|
+
size?: "default" | "sm" | "lg" | "xl" | "xs" | null | undefined;
|
|
9
|
+
radius?: "default" | "sm" | "lg" | "base" | "none" | "xl" | "2xl" | "3xl" | "full" | null | undefined;
|
|
10
|
+
state?: "default" | "error" | null | undefined;
|
|
11
11
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
12
12
|
interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'>, VariantProps<typeof inputVariants> {
|
|
13
13
|
leftIcon?: React.ReactNode;
|
|
@@ -5,9 +5,9 @@ import { VariantProps } from 'class-variance-authority';
|
|
|
5
5
|
declare const inputVariants: (props?: ({
|
|
6
6
|
variant?: "default" | "filled" | null | undefined;
|
|
7
7
|
focusRing?: boolean | null | undefined;
|
|
8
|
-
size?: "
|
|
9
|
-
radius?: "
|
|
10
|
-
state?: "
|
|
8
|
+
size?: "default" | "sm" | "lg" | "xl" | "xs" | null | undefined;
|
|
9
|
+
radius?: "default" | "sm" | "lg" | "base" | "none" | "xl" | "2xl" | "3xl" | "full" | null | undefined;
|
|
10
|
+
state?: "default" | "error" | null | undefined;
|
|
11
11
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
12
12
|
interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'>, VariantProps<typeof inputVariants> {
|
|
13
13
|
leftIcon?: React.ReactNode;
|
|
@@ -4,8 +4,8 @@ import { VariantProps } from 'class-variance-authority';
|
|
|
4
4
|
|
|
5
5
|
declare const metricCardVariants: (props?: ({
|
|
6
6
|
variant?: "default" | "ghost" | "elevated" | null | undefined;
|
|
7
|
-
size?: "
|
|
8
|
-
radius?: "
|
|
7
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
8
|
+
radius?: "default" | "sm" | "lg" | "base" | "none" | "xl" | "2xl" | "3xl" | "full" | null | undefined;
|
|
9
9
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
10
|
type MetricCardVariant = 'default' | 'elevated' | 'ghost';
|
|
11
11
|
type MetricCardSize = 'sm' | 'default' | 'lg';
|
|
@@ -4,8 +4,8 @@ import { VariantProps } from 'class-variance-authority';
|
|
|
4
4
|
|
|
5
5
|
declare const metricCardVariants: (props?: ({
|
|
6
6
|
variant?: "default" | "ghost" | "elevated" | null | undefined;
|
|
7
|
-
size?: "
|
|
8
|
-
radius?: "
|
|
7
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
8
|
+
radius?: "default" | "sm" | "lg" | "base" | "none" | "xl" | "2xl" | "3xl" | "full" | null | undefined;
|
|
9
9
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
10
|
type MetricCardVariant = 'default' | 'elevated' | 'ghost';
|
|
11
11
|
type MetricCardSize = 'sm' | 'default' | 'lg';
|
|
@@ -53,6 +53,16 @@ function ChevronDownIcon({ className }) {
|
|
|
53
53
|
function ChevronRightIcon({ className }) {
|
|
54
54
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { className, fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 5l7 7-7 7" }) });
|
|
55
55
|
}
|
|
56
|
+
const REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
|
|
57
|
+
function renderInsideChild(children, render) {
|
|
58
|
+
let child = children;
|
|
59
|
+
const resolve = React.use;
|
|
60
|
+
if (typeof child === "object" && child !== null && child.$$typeof === REACT_LAZY_TYPE && typeof resolve === "function") {
|
|
61
|
+
child = resolve(child._payload);
|
|
62
|
+
}
|
|
63
|
+
if (!React.isValidElement(child)) return render(children);
|
|
64
|
+
return React.cloneElement(child, void 0, render(child.props.children));
|
|
65
|
+
}
|
|
56
66
|
const contentRadiusMap = {
|
|
57
67
|
sm: "rounded",
|
|
58
68
|
// 4px
|
|
@@ -416,8 +426,14 @@ const NavigationMenuLink = React.forwardRef(
|
|
|
416
426
|
);
|
|
417
427
|
}
|
|
418
428
|
const Comp = asChild ? import_react_slot.Slot : "a";
|
|
429
|
+
const iconNode = icon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: (0, import_utils.cn)("shrink-0", s.icon), children: icon });
|
|
430
|
+
const childText = asChild && React.isValidElement(children) ? children.props.children : children;
|
|
419
431
|
if (inContent) {
|
|
420
|
-
|
|
432
|
+
const renderContent2 = (content) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
433
|
+
iconNode,
|
|
434
|
+
!collapsed && content
|
|
435
|
+
] });
|
|
436
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
421
437
|
Comp,
|
|
422
438
|
{
|
|
423
439
|
ref,
|
|
@@ -433,14 +449,15 @@ const NavigationMenuLink = React.forwardRef(
|
|
|
433
449
|
),
|
|
434
450
|
...active ? { "aria-current": "page" } : {},
|
|
435
451
|
...props,
|
|
436
|
-
children:
|
|
437
|
-
icon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: (0, import_utils.cn)("shrink-0", s.icon), children: icon }),
|
|
438
|
-
!collapsed && children
|
|
439
|
-
]
|
|
452
|
+
children: asChild ? renderInsideChild(children, renderContent2) : renderContent2(children)
|
|
440
453
|
}
|
|
441
454
|
);
|
|
442
455
|
}
|
|
443
|
-
|
|
456
|
+
const renderContent = (content) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
457
|
+
iconNode,
|
|
458
|
+
!collapsed && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "truncate", children: content })
|
|
459
|
+
] });
|
|
460
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
444
461
|
Comp,
|
|
445
462
|
{
|
|
446
463
|
ref,
|
|
@@ -455,12 +472,9 @@ const NavigationMenuLink = React.forwardRef(
|
|
|
455
472
|
className
|
|
456
473
|
),
|
|
457
474
|
...active ? { "aria-current": "page" } : {},
|
|
458
|
-
...collapsed && typeof
|
|
475
|
+
...collapsed && typeof childText === "string" ? { title: childText } : {},
|
|
459
476
|
...props,
|
|
460
|
-
children:
|
|
461
|
-
icon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: (0, import_utils.cn)("shrink-0", s.icon), children: icon }),
|
|
462
|
-
!collapsed && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "truncate", children })
|
|
463
|
-
]
|
|
477
|
+
children: asChild ? renderInsideChild(children, renderContent) : renderContent(children)
|
|
464
478
|
}
|
|
465
479
|
);
|
|
466
480
|
}
|