@betterinternship/components 3.3.4 → 3.3.5
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import Link from 'next/link';
|
|
3
3
|
import { cn } from '../utils.js';
|
|
4
4
|
import { Spinner } from './loader.js';
|
|
@@ -37,16 +37,18 @@ function Button({ variant = 'solid', scheme, size = 'md', shape, className, icon
|
|
|
37
37
|
return jsx(Link, { ...linkProps, className: classes, children: content });
|
|
38
38
|
}
|
|
39
39
|
const { type = 'button', disabled, loading = false, href: _href, ...buttonProps } = props;
|
|
40
|
-
|
|
40
|
+
// Loading: only a centred spinner. The content stays in place, transparent,
|
|
41
|
+
// so the button keeps its size and its accessible name.
|
|
42
|
+
return jsx("button", { ...buttonProps, type: type, className: cn(classes, loading && 'relative'), disabled: disabled || loading, "aria-busy": loading || buttonProps['aria-busy'], children: loading ? jsxs(Fragment, { children: [jsx("span", { className: "inline-flex items-center gap-[inherit] opacity-0", children: content }), jsx(Spinner, { decorative: true, className: "absolute inset-0" })] }) : content });
|
|
41
43
|
}
|
|
42
44
|
const iconSizes = {
|
|
43
45
|
xs: 'size-8', sm: 'size-9', md: 'size-11', lg: 'size-12', xl: 'size-13', '2xl': 'size-14',
|
|
44
46
|
};
|
|
45
47
|
function ExpandingButton({ icon, label, size = 'md', loading, ...props }) {
|
|
46
|
-
return jsxs(Button, { "aria-label": label, ...props, size: size, loading: loading, className: cn('gap-0 px-3', props.className), children: [
|
|
48
|
+
return jsxs(Button, { "aria-label": label, ...props, size: size, loading: loading, className: cn('gap-0 px-3', props.className), children: [jsx("span", { "aria-hidden": "true", className: "inline-flex", children: icon }), jsx("span", { className: "ml-0 max-w-0 overflow-hidden whitespace-nowrap opacity-0 pointer-fine:group-hover/button:ml-2 pointer-fine:group-hover/button:max-w-40 pointer-fine:group-hover/button:opacity-100 group-focus-visible/button:ml-2 group-focus-visible/button:max-w-40 group-focus-visible/button:opacity-100 motion-safe:transition-[max-width,margin,opacity] motion-safe:duration-interactive motion-safe:ease-out-strong motion-reduce:transition-none", children: label })] });
|
|
47
49
|
}
|
|
48
50
|
function FilterChip({ selected = false, icon, children, loading, ...props }) {
|
|
49
|
-
return jsxs(Button, { ...props, variant: "outline", scheme: selected ? 'secondary' : 'neutral', size: "md", shape: "pill", "aria-pressed": selected, loading: loading, className: cn('w-max max-w-full gap-2.5 px-5 py-3 text-base leading-[1.4]', selected && 'font-semibold'), children: [
|
|
51
|
+
return jsxs(Button, { ...props, variant: "outline", scheme: selected ? 'secondary' : 'neutral', size: "md", shape: "pill", "aria-pressed": selected, loading: loading, className: cn('w-max max-w-full gap-2.5 px-5 py-3 text-base leading-[1.4]', selected && 'font-semibold'), children: [icon, children] });
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
export { Button, ExpandingButton, FilterChip, buttonClassName };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","sources":["../../src/components/button.tsx"],"sourcesContent":["import Link from 'next/link';\nimport type { ComponentPropsWithRef, ReactNode } from 'react';\nimport { cn } from '@/utils';\nimport { Spinner } from './loader';\nimport { interactiveControlClassName, interactiveControlTransitionClassName } from '@/lib/interaction-styles';\n\nexport type ButtonVariant = 'solid' | 'outline' | 'ghost' | 'link';\nexport type ButtonScheme = 'primary' | 'secondary' | 'neutral' | 'destructive' | 'success';\nexport type ButtonSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\nexport type ButtonShape = 'rounded' | 'pill';\n\ntype ButtonAppearance = {\n /** Visual treatment. */\n variant?: ButtonVariant;\n /** Semantic color, independent of the fill treatment. Defaults to primary, or neutral for outline/ghost. */\n scheme?: ButtonScheme;\n /** Standard control size: 32px, 36px, 44px, 48px, 52px, or 56px minimum height. */\n size?: ButtonSize;\n /** Corner treatment. Landing presets keep their original shape when omitted. */\n shape?: ButtonShape;\n /** Additional classes, merged after the component's appearance classes. */\n className?: string;\n};\n\nconst schemes: Record<ButtonScheme, string> = {\n primary: '[--btn-fill:var(--color-landing-blue)] [--btn-on:white] [--btn-hover:var(--color-landing-blue-hover)] [--btn-ink:var(--color-landing-blue-hover)] [--btn-soft:var(--color-landing-tint)] [--btn-border:var(--color-landing-blue)]',\n secondary: '[--btn-fill:var(--color-landing-secondary-tint)] [--btn-on:var(--color-landing-secondary-deep)] [--btn-hover:var(--color-brand-secondary-hover)] [--btn-ink:var(--color-landing-secondary-deep)] [--btn-soft:var(--color-landing-secondary-tint)] [--btn-border:var(--color-landing-secondary-border)]',\n neutral: '[--btn-fill:var(--color-v2-surface-subtle)] [--btn-on:var(--color-landing-nav)] [--btn-hover:var(--color-landing-border)] [--btn-ink:var(--color-landing-nav)] [--btn-soft:rgb(55_65_81_/_6%)] [--btn-border:var(--color-landing-control)]',\n destructive: '[--btn-fill:var(--color-v2-destructive)] [--btn-on:white] [--btn-hover:var(--color-brand-destructive-hover)] [--btn-ink:var(--color-brand-destructive-hover)] [--btn-soft:var(--color-brand-destructive-soft)] [--btn-border:var(--color-v2-destructive)]',\n success: '[--btn-fill:var(--color-brand-success)] [--btn-on:white] [--btn-hover:var(--color-brand-success-hover)] [--btn-ink:var(--color-brand-success)] [--btn-soft:var(--color-brand-success-soft)] [--btn-border:var(--color-brand-success)]',\n};\nconst treatments: Record<ButtonVariant, string> = {\n solid: cn('border border-[var(--btn-border)] bg-[var(--btn-fill)] font-semibold text-[var(--btn-on)] enabled:pointer-fine:hover:border-[var(--btn-hover)] enabled:pointer-fine:hover:bg-[var(--btn-hover)] [&:is(a):hover]:bg-[var(--btn-hover)]', interactiveControlClassName),\n outline: cn('border border-[var(--btn-border)] bg-transparent text-[var(--btn-ink)] enabled:hover:bg-[var(--btn-soft)] [&:is(a):hover]:bg-[var(--btn-soft)]', interactiveControlClassName),\n ghost: 'border border-transparent bg-transparent text-[var(--btn-ink)] enabled:hover:bg-[var(--btn-soft)] [&:is(a):hover]:bg-[var(--btn-soft)]',\n link: 'border-0 bg-transparent text-[var(--btn-ink)] underline-offset-4 enabled:hover:underline [&:is(a):hover]:underline',\n};\nconst sizes: Record<ButtonSize, string> = {\n xs: 'min-h-8 px-2 text-xs leading-[1.5]',\n sm: 'min-h-9 px-3 text-sm leading-[1.5]',\n md: 'min-h-11 px-5 text-sm leading-[1.5]',\n lg: 'min-h-12 px-6 text-base leading-[1.5]',\n xl: 'min-h-13 px-7 text-base leading-[1.5]',\n '2xl': 'min-h-14 px-8 text-lg leading-[1.5]',\n};\n\n/** Shared styling for action and navigation controls. Colors never change the fill treatment. */\nexport function buttonClassName({variant = 'solid', scheme, size = 'md', shape, className}: ButtonAppearance = {}) {\n return cn(\n 'group group/button inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-control-lg font-[550] focus-visible:outline-3 focus-visible:outline-offset-4 focus-visible:outline-landing-blue disabled:pointer-events-none disabled:opacity-50 aria-disabled:cursor-default aria-busy:cursor-wait [&_svg]:shrink-0',\n interactiveControlTransitionClassName,\n schemes[scheme ?? (['outline', 'ghost'].includes(variant) ? 'neutral' : 'primary')],\n treatments[variant], sizes[size],\n variant === 'outline' && (scheme === undefined || scheme === 'neutral') && 'enabled:hover:border-landing-control-hover enabled:hover:text-landing-nav-hover [&:is(a):hover]:border-landing-control-hover',\n variant === 'outline' && scheme === 'secondary' && 'bg-[var(--btn-soft)]',\n shape === 'pill' && 'rounded-full', shape === 'rounded' && 'rounded-control-lg', className,\n );\n}\n\ntype IconOnlyProps = { iconOnly?: false } | { iconOnly: true; 'aria-label': string };\ntype ActionButtonProps = ComponentPropsWithRef<'button'> & ButtonAppearance & {\n href?: never;\n /** Shows a progress indicator, exposes aria-busy, and disables the action while work is pending. */\n loading?: boolean;\n};\ntype NavigationButtonProps = Omit<ComponentPropsWithRef<typeof Link>, 'className'> & ButtonAppearance & {\n loading?: never;\n disabled?: never;\n};\nexport type ButtonProps = ActionButtonProps;\nexport type UnifiedButtonProps = (ActionButtonProps | NavigationButtonProps) & IconOnlyProps;\n\nexport function Button({variant = 'solid', scheme, size = 'md', shape, className, iconOnly = false, children, ...props}: UnifiedButtonProps) {\n const classes = buttonClassName({variant, scheme, size, shape, className: cn(iconOnly && [iconSizes[size], 'gap-0 p-0'], className)});\n const content = iconOnly ? <span aria-hidden=\"true\" className=\"inline-flex\">{children}</span> : children;\n if (props.href !== undefined) {\n const { loading: _loading, disabled: _disabled, ...linkProps } = props as NavigationButtonProps;\n return <Link {...linkProps} className={classes}>{content}</Link>;\n }\n const {type = 'button', disabled, loading = false, href: _href, ...buttonProps} = props as ActionButtonProps;\n return <button {...buttonProps} type={type} className={classes} disabled={disabled || loading} aria-busy={loading || buttonProps['aria-busy']}>\n {loading && <Spinner decorative />}{(!iconOnly || !loading) && content}\n </button>;\n}\n\n\ntype IconSize = ButtonSize;\nconst iconSizes: Record<IconSize, string> = {\n xs: 'size-8', sm: 'size-9', md: 'size-11', lg: 'size-12', xl: 'size-13', '2xl': 'size-14',\n};\n\nexport type ExpandingButtonProps = Omit<ActionButtonProps, 'children' | 'size'> & {\n /** Leading icon. */\n icon: ReactNode;\n /** Action label, revealed on hover/focus and always visible on touch screens. */\n label: string;\n /** Standard control size. */\n size?: IconSize;\n};\nexport function ExpandingButton({icon, label, size = 'md', loading, ...props}: ExpandingButtonProps) {\n return <Button aria-label={label} {...props} size={size} loading={loading} className={cn('gap-0 px-3', props.className)}>\n {!loading && <span aria-hidden=\"true\" className=\"inline-flex\">{icon}</span>}\n {/* Icon only at rest. With a mouse the label slides out on hover; on\n touch there's no hover, so it stays an icon button. Keyboard focus and\n loading show the label on any device (loading hides the icon). */}\n <span className=\"ml-0 max-w-0 overflow-hidden whitespace-nowrap opacity-0 pointer-fine:group-hover/button:ml-2 pointer-fine:group-hover/button:max-w-40 pointer-fine:group-hover/button:opacity-100 group-focus-visible/button:ml-2 group-focus-visible/button:max-w-40 group-focus-visible/button:opacity-100 group-aria-busy/button:ml-2 group-aria-busy/button:max-w-40 group-aria-busy/button:opacity-100 motion-safe:transition-[max-width,margin,opacity] motion-safe:duration-interactive motion-safe:ease-out-strong motion-reduce:transition-none\">{label}</span>\n </Button>;\n}\n\nexport type FilterChipProps = Omit<ActionButtonProps, 'variant' | 'scheme' | 'size' | 'shape' | 'aria-pressed'> & {\n /** Controlled selection state; onClick belongs to the caller. */\n selected?: boolean;\n /** Optional leading icon. */\n icon?: ReactNode;\n};\nexport function FilterChip({selected = false, icon, children, loading, ...props}: FilterChipProps) {\n return <Button {...props} variant=\"outline\" scheme={selected ? 'secondary' : 'neutral'} size=\"md\" shape=\"pill\" aria-pressed={selected} loading={loading} className={cn('w-max max-w-full gap-2.5 px-5 py-3 text-base leading-[1.4]', selected && 'font-semibold')}>\n {!loading && icon}{children}\n </Button>;\n}\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;AAwBA,MAAM,OAAO,GAAiC;AAC5C,IAAA,OAAO,EAAE,mOAAmO;AAC5O,IAAA,SAAS,EAAE,wSAAwS;AACnT,IAAA,OAAO,EAAE,4OAA4O;AACrP,IAAA,WAAW,EAAE,2PAA2P;AACxQ,IAAA,OAAO,EAAE,uOAAuO;CACjP;AACD,MAAM,UAAU,GAAkC;AAChD,IAAA,KAAK,EAAE,EAAE,CAAC,uOAAuO,EAAE,2BAA2B,CAAC;AAC/Q,IAAA,OAAO,EAAE,EAAE,CAAC,gJAAgJ,EAAE,2BAA2B,CAAC;AAC1L,IAAA,KAAK,EAAE,wIAAwI;AAC/I,IAAA,IAAI,EAAE,oHAAoH;CAC3H;AACD,MAAM,KAAK,GAA+B;AACxC,IAAA,EAAE,EAAE,oCAAoC;AACxC,IAAA,EAAE,EAAE,oCAAoC;AACxC,IAAA,EAAE,EAAE,qCAAqC;AACzC,IAAA,EAAE,EAAE,uCAAuC;AAC3C,IAAA,EAAE,EAAE,uCAAuC;AAC3C,IAAA,KAAK,EAA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AAI,EAAA,CAAQ,EAI3EA,cAAM,SAAS,EAAC,2gBAA2gB,EAAA,QAAA,EAAE,KAAK,EAAA,CAAQ,CAAA,EAAA,CACniB;AACX;SAQgB,UAAU,CAAC,EAAC,QAAQ,GAAG,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,KAAK,EAAkB,EAAA;IAC/F,OAAOC,IAAA,CAAC,MAAM,EAAA,EAAA,GAAK,KAAK,EAAE,OAAO,EAAC,SAAS,EAAC,MAAM,EAAE,QAAQ,GAAG,WAAW,GAAG,SAAS,EAAE,IAAI,EAAC,IAAI,EAAC,KAAK,EAAC,MAAM,EAAA,cAAA,EAAe,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,CAAC,4DAA4D,EAAE,QAAQ,IAAI,eAAe,CAAC,EAAA,QAAA,EAAA,CAC9P,CAAC,OAAO,IAAI,IAAI,EAAE,QAAQ,CAAA,EAAA,CACpB;AACX;;;;"}
|
|
1
|
+
{"version":3,"file":"button.js","sources":["../../src/components/button.tsx"],"sourcesContent":["import Link from 'next/link';\nimport type { ComponentPropsWithRef, ReactNode } from 'react';\nimport { cn } from '@/utils';\nimport { Spinner } from './loader';\nimport { interactiveControlClassName, interactiveControlTransitionClassName } from '@/lib/interaction-styles';\n\nexport type ButtonVariant = 'solid' | 'outline' | 'ghost' | 'link';\nexport type ButtonScheme = 'primary' | 'secondary' | 'neutral' | 'destructive' | 'success';\nexport type ButtonSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\nexport type ButtonShape = 'rounded' | 'pill';\n\ntype ButtonAppearance = {\n /** Visual treatment. */\n variant?: ButtonVariant;\n /** Semantic color, independent of the fill treatment. Defaults to primary, or neutral for outline/ghost. */\n scheme?: ButtonScheme;\n /** Standard control size: 32px, 36px, 44px, 48px, 52px, or 56px minimum height. */\n size?: ButtonSize;\n /** Corner treatment. Landing presets keep their original shape when omitted. */\n shape?: ButtonShape;\n /** Additional classes, merged after the component's appearance classes. */\n className?: string;\n};\n\nconst schemes: Record<ButtonScheme, string> = {\n primary: '[--btn-fill:var(--color-landing-blue)] [--btn-on:white] [--btn-hover:var(--color-landing-blue-hover)] [--btn-ink:var(--color-landing-blue-hover)] [--btn-soft:var(--color-landing-tint)] [--btn-border:var(--color-landing-blue)]',\n secondary: '[--btn-fill:var(--color-landing-secondary-tint)] [--btn-on:var(--color-landing-secondary-deep)] [--btn-hover:var(--color-brand-secondary-hover)] [--btn-ink:var(--color-landing-secondary-deep)] [--btn-soft:var(--color-landing-secondary-tint)] [--btn-border:var(--color-landing-secondary-border)]',\n neutral: '[--btn-fill:var(--color-v2-surface-subtle)] [--btn-on:var(--color-landing-nav)] [--btn-hover:var(--color-landing-border)] [--btn-ink:var(--color-landing-nav)] [--btn-soft:rgb(55_65_81_/_6%)] [--btn-border:var(--color-landing-control)]',\n destructive: '[--btn-fill:var(--color-v2-destructive)] [--btn-on:white] [--btn-hover:var(--color-brand-destructive-hover)] [--btn-ink:var(--color-brand-destructive-hover)] [--btn-soft:var(--color-brand-destructive-soft)] [--btn-border:var(--color-v2-destructive)]',\n success: '[--btn-fill:var(--color-brand-success)] [--btn-on:white] [--btn-hover:var(--color-brand-success-hover)] [--btn-ink:var(--color-brand-success)] [--btn-soft:var(--color-brand-success-soft)] [--btn-border:var(--color-brand-success)]',\n};\nconst treatments: Record<ButtonVariant, string> = {\n solid: cn('border border-[var(--btn-border)] bg-[var(--btn-fill)] font-semibold text-[var(--btn-on)] enabled:pointer-fine:hover:border-[var(--btn-hover)] enabled:pointer-fine:hover:bg-[var(--btn-hover)] [&:is(a):hover]:bg-[var(--btn-hover)]', interactiveControlClassName),\n outline: cn('border border-[var(--btn-border)] bg-transparent text-[var(--btn-ink)] enabled:hover:bg-[var(--btn-soft)] [&:is(a):hover]:bg-[var(--btn-soft)]', interactiveControlClassName),\n ghost: 'border border-transparent bg-transparent text-[var(--btn-ink)] enabled:hover:bg-[var(--btn-soft)] [&:is(a):hover]:bg-[var(--btn-soft)]',\n link: 'border-0 bg-transparent text-[var(--btn-ink)] underline-offset-4 enabled:hover:underline [&:is(a):hover]:underline',\n};\nconst sizes: Record<ButtonSize, string> = {\n xs: 'min-h-8 px-2 text-xs leading-[1.5]',\n sm: 'min-h-9 px-3 text-sm leading-[1.5]',\n md: 'min-h-11 px-5 text-sm leading-[1.5]',\n lg: 'min-h-12 px-6 text-base leading-[1.5]',\n xl: 'min-h-13 px-7 text-base leading-[1.5]',\n '2xl': 'min-h-14 px-8 text-lg leading-[1.5]',\n};\n\n/** Shared styling for action and navigation controls. Colors never change the fill treatment. */\nexport function buttonClassName({variant = 'solid', scheme, size = 'md', shape, className}: ButtonAppearance = {}) {\n return cn(\n 'group group/button inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-control-lg font-[550] focus-visible:outline-3 focus-visible:outline-offset-4 focus-visible:outline-landing-blue disabled:pointer-events-none disabled:opacity-50 aria-disabled:cursor-default aria-busy:cursor-wait [&_svg]:shrink-0',\n interactiveControlTransitionClassName,\n schemes[scheme ?? (['outline', 'ghost'].includes(variant) ? 'neutral' : 'primary')],\n treatments[variant], sizes[size],\n variant === 'outline' && (scheme === undefined || scheme === 'neutral') && 'enabled:hover:border-landing-control-hover enabled:hover:text-landing-nav-hover [&:is(a):hover]:border-landing-control-hover',\n variant === 'outline' && scheme === 'secondary' && 'bg-[var(--btn-soft)]',\n shape === 'pill' && 'rounded-full', shape === 'rounded' && 'rounded-control-lg', className,\n );\n}\n\ntype IconOnlyProps = { iconOnly?: false } | { iconOnly: true; 'aria-label': string };\ntype ActionButtonProps = ComponentPropsWithRef<'button'> & ButtonAppearance & {\n href?: never;\n /** Shows a progress indicator, exposes aria-busy, and disables the action while work is pending. */\n loading?: boolean;\n};\ntype NavigationButtonProps = Omit<ComponentPropsWithRef<typeof Link>, 'className'> & ButtonAppearance & {\n loading?: never;\n disabled?: never;\n};\nexport type ButtonProps = ActionButtonProps;\nexport type UnifiedButtonProps = (ActionButtonProps | NavigationButtonProps) & IconOnlyProps;\n\nexport function Button({variant = 'solid', scheme, size = 'md', shape, className, iconOnly = false, children, ...props}: UnifiedButtonProps) {\n const classes = buttonClassName({variant, scheme, size, shape, className: cn(iconOnly && [iconSizes[size], 'gap-0 p-0'], className)});\n const content = iconOnly ? <span aria-hidden=\"true\" className=\"inline-flex\">{children}</span> : children;\n if (props.href !== undefined) {\n const { loading: _loading, disabled: _disabled, ...linkProps } = props as NavigationButtonProps;\n return <Link {...linkProps} className={classes}>{content}</Link>;\n }\n const {type = 'button', disabled, loading = false, href: _href, ...buttonProps} = props as ActionButtonProps;\n // Loading: only a centred spinner. The content stays in place, transparent,\n // so the button keeps its size and its accessible name.\n return <button {...buttonProps} type={type} className={cn(classes, loading && 'relative')} disabled={disabled || loading} aria-busy={loading || buttonProps['aria-busy']}>\n {loading ? <>\n <span className=\"inline-flex items-center gap-[inherit] opacity-0\">{content}</span>\n <Spinner decorative className=\"absolute inset-0\" />\n </> : content}\n </button>;\n}\n\n\ntype IconSize = ButtonSize;\nconst iconSizes: Record<IconSize, string> = {\n xs: 'size-8', sm: 'size-9', md: 'size-11', lg: 'size-12', xl: 'size-13', '2xl': 'size-14',\n};\n\nexport type ExpandingButtonProps = Omit<ActionButtonProps, 'children' | 'size'> & {\n /** Leading icon. */\n icon: ReactNode;\n /** Action label, revealed on hover/focus and always visible on touch screens. */\n label: string;\n /** Standard control size. */\n size?: IconSize;\n};\nexport function ExpandingButton({icon, label, size = 'md', loading, ...props}: ExpandingButtonProps) {\n return <Button aria-label={label} {...props} size={size} loading={loading} className={cn('gap-0 px-3', props.className)}>\n <span aria-hidden=\"true\" className=\"inline-flex\">{icon}</span>\n {/* Icon only at rest. With a mouse the label slides out on hover; on\n touch there's no hover, so it stays an icon button. Keyboard focus\n shows the label on any device. Loading shows Button's spinner. */}\n <span className=\"ml-0 max-w-0 overflow-hidden whitespace-nowrap opacity-0 pointer-fine:group-hover/button:ml-2 pointer-fine:group-hover/button:max-w-40 pointer-fine:group-hover/button:opacity-100 group-focus-visible/button:ml-2 group-focus-visible/button:max-w-40 group-focus-visible/button:opacity-100 motion-safe:transition-[max-width,margin,opacity] motion-safe:duration-interactive motion-safe:ease-out-strong motion-reduce:transition-none\">{label}</span>\n </Button>;\n}\n\nexport type FilterChipProps = Omit<ActionButtonProps, 'variant' | 'scheme' | 'size' | 'shape' | 'aria-pressed'> & {\n /** Controlled selection state; onClick belongs to the caller. */\n selected?: boolean;\n /** Optional leading icon. */\n icon?: ReactNode;\n};\nexport function FilterChip({selected = false, icon, children, loading, ...props}: FilterChipProps) {\n return <Button {...props} variant=\"outline\" scheme={selected ? 'secondary' : 'neutral'} size=\"md\" shape=\"pill\" aria-pressed={selected} loading={loading} className={cn('w-max max-w-full gap-2.5 px-5 py-3 text-base leading-[1.4]', selected && 'font-semibold')}>\n {icon}{children}\n </Button>;\n}\n"],"names":["_jsx","_jsxs","_Fragment"],"mappings":";;;;;;AAwBA,MAAM,OAAO,GAAiC;AAC5C,IAAA,OAAO,EAAE,mOAAmO;AAC5O,IAAA,SAAS,EAAE,wSAAwS;AACnT,IAAA,OAAO,EAAE,4OAA4O;AACrP,IAAA,WAAW,EAAE,2PAA2P;AACxQ,IAAA,OAAO,EAAE,uOAAuO;CACjP;AACD,MAAM,UAAU,GAAkC;AAChD,IAAA,KAAK,EAAE,EAAE,CAAC,uOAAuO,EAAE,2BAA2B,CAAC;AAC/Q,IAAA,OAAO,EAAE,EAAE,CAAC,gJAAgJ,EAAE,2BAA2B,CAAC;AAC1L,IAAA,KAAK,EAAE,wIAAwI;AAC/I,IAAA,IAAI,EAAE,oHAAoH;CAC3H;AACD,MAAM,KAAK,GAA+B;AACxC,IAAA,EAAE,EAAE,oCAAoC;AACxC,IAAA,EAAE,EAAE,oCAAoC;AACxC,IAAA,EAAE,EAAE,qCAAqC;AACzC,IAAA,EAAE,EAAE,uCAAuC;AAC3C,IAAA,EAAE,EAAE,uCAAuC;AAC3C,I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