@wow-two-beta/fe 0.0.50 → 0.0.51
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/index.js +392 -383
- package/dist/index.js.map +1 -1
- package/dist/presentation/actions/button/Button.variants.d.ts +12 -0
- package/dist/presentation/actions/button/Button.variants.js +18 -2
- package/dist/presentation/actions/button/Button.variants.js.map +1 -1
- package/dist/presentation/actions/button/Button.vue.d.ts +8 -1
- package/dist/presentation/actions/button/Button.vue.js +106 -58
- package/dist/presentation/actions/button/Button.vue.js.map +1 -1
- package/dist/presentation/actions/refreshButton/RefreshButton.vue.js.map +1 -1
- package/dist/presentation/display/badge/Badge.variants.d.ts +23 -1
- package/dist/presentation/display/badge/Badge.variants.js +18 -3
- package/dist/presentation/display/badge/Badge.variants.js.map +1 -1
- package/dist/presentation/display/badge/Badge.vue.d.ts +3 -0
- package/dist/presentation/display/badge/Badge.vue.js +10 -4
- package/dist/presentation/display/badge/Badge.vue.js.map +1 -1
- package/dist/presentation/display/carousel/Carousel.variants.d.ts +65 -0
- package/dist/presentation/display/carousel/Carousel.variants.js +56 -0
- package/dist/presentation/display/carousel/Carousel.variants.js.map +1 -0
- package/dist/presentation/display/carousel/Carousel.vue.d.ts +7 -0
- package/dist/presentation/display/carousel/Carousel.vue.js +7 -2
- package/dist/presentation/display/carousel/Carousel.vue.js.map +1 -1
- package/dist/presentation/display/carousel/CarouselContext.d.ts +10 -0
- package/dist/presentation/display/carousel/CarouselContext.js.map +1 -1
- package/dist/presentation/display/carousel/CarouselNext.vue.d.ts +6 -2
- package/dist/presentation/display/carousel/CarouselNext.vue.js +12 -4
- package/dist/presentation/display/carousel/CarouselNext.vue.js.map +1 -1
- package/dist/presentation/display/carousel/CarouselPrev.vue.d.ts +6 -2
- package/dist/presentation/display/carousel/CarouselPrev.vue.js +12 -4
- package/dist/presentation/display/carousel/CarouselPrev.vue.js.map +1 -1
- package/dist/presentation/display/carousel/CarouselViewport.vue.d.ts +13 -2
- package/dist/presentation/display/carousel/CarouselViewport.vue.js +54 -2
- package/dist/presentation/display/carousel/CarouselViewport.vue.js.map +1 -1
- package/dist/presentation/display/carousel/index.d.ts +1 -0
- package/dist/presentation/display/index.d.ts +1 -0
- package/dist/presentation/display/index.js +120 -111
- package/dist/presentation/display/index.js.map +1 -1
- package/dist/presentation/display/mediaCard/MediaCard.vue.d.ts +41 -0
- package/dist/presentation/display/mediaCard/MediaCard.vue.js +108 -0
- package/dist/presentation/display/mediaCard/MediaCard.vue.js.map +1 -0
- package/dist/presentation/display/mediaCard/MediaCard2.vue.js +5 -0
- package/dist/presentation/display/mediaCard/MediaCard2.vue.js.map +1 -0
- package/dist/presentation/display/mediaCard/index.d.ts +1 -0
- package/dist/presentation/display/metaInlineText/MetaInlineItem.vue.d.ts +37 -0
- package/dist/presentation/display/metaInlineText/MetaInlineItem.vue.js +72 -0
- package/dist/presentation/display/metaInlineText/MetaInlineItem.vue.js.map +1 -0
- package/dist/presentation/display/metaInlineText/MetaInlineItem2.vue.js +7 -0
- package/dist/presentation/display/metaInlineText/MetaInlineItem2.vue.js.map +1 -0
- package/dist/presentation/display/metaInlineText/index.d.ts +1 -0
- package/dist/presentation/layout/navbar/Navbar.vue.js.map +1 -1
- package/dist/presentation/nav/accountMenu/AccountMenu.vue.d.ts +1 -1
- package/dist/presentation/overlays/hoverCard/HoverCard.vue.d.ts +1 -1
- package/dist/presentation/overlays/tooltip/Tooltip.vue.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -71,6 +71,10 @@ export declare const buttonVariants: import('tailwind-variants').TVReturnType<{
|
|
|
71
71
|
true: "whitespace-normal text-left";
|
|
72
72
|
false: "whitespace-nowrap text-ellipsis overflow-hidden";
|
|
73
73
|
};
|
|
74
|
+
unavailable: {
|
|
75
|
+
true: "relative border-dashed opacity-60 cursor-not-allowed";
|
|
76
|
+
false: "";
|
|
77
|
+
};
|
|
74
78
|
}, undefined, string[], {
|
|
75
79
|
variant: {
|
|
76
80
|
solid: "";
|
|
@@ -110,6 +114,10 @@ export declare const buttonVariants: import('tailwind-variants').TVReturnType<{
|
|
|
110
114
|
true: "whitespace-normal text-left";
|
|
111
115
|
false: "whitespace-nowrap text-ellipsis overflow-hidden";
|
|
112
116
|
};
|
|
117
|
+
unavailable: {
|
|
118
|
+
true: "relative border-dashed opacity-60 cursor-not-allowed";
|
|
119
|
+
false: "";
|
|
120
|
+
};
|
|
113
121
|
}, undefined, import('tailwind-variants').TVReturnTypeLike<{
|
|
114
122
|
variant: {
|
|
115
123
|
solid: "";
|
|
@@ -149,5 +157,9 @@ export declare const buttonVariants: import('tailwind-variants').TVReturnType<{
|
|
|
149
157
|
true: "whitespace-normal text-left";
|
|
150
158
|
false: "whitespace-nowrap text-ellipsis overflow-hidden";
|
|
151
159
|
};
|
|
160
|
+
unavailable: {
|
|
161
|
+
true: "relative border-dashed opacity-60 cursor-not-allowed";
|
|
162
|
+
false: "";
|
|
163
|
+
};
|
|
152
164
|
}, undefined>>;
|
|
153
165
|
export type ButtonVariants = VariantProps<typeof buttonVariants>;
|
|
@@ -100,6 +100,12 @@ const buttonVariants = tv({
|
|
|
100
100
|
wrap: {
|
|
101
101
|
true: "whitespace-normal text-left",
|
|
102
102
|
false: "whitespace-nowrap text-ellipsis overflow-hidden"
|
|
103
|
+
},
|
|
104
|
+
// Unavailable: still a tab stop, but dashed and dimmed. `relative` anchors the slash below and yields to a
|
|
105
|
+
// consumer's own position class through `cn`.
|
|
106
|
+
unavailable: {
|
|
107
|
+
true: "relative border-dashed opacity-60 cursor-not-allowed",
|
|
108
|
+
false: ""
|
|
103
109
|
}
|
|
104
110
|
},
|
|
105
111
|
compoundVariants: [
|
|
@@ -303,7 +309,16 @@ const buttonVariants = tv({
|
|
|
303
309
|
{ variant: "glass-surface", tone: "primary", class: "border-primary/50" },
|
|
304
310
|
{ variant: "glass-surface", tone: "danger", class: "border-destructive/50" },
|
|
305
311
|
{ variant: "glass-surface", tone: "success", class: "border-success/50" },
|
|
306
|
-
{ variant: "glass-surface", tone: "warning", class: "border-warning/50" }
|
|
312
|
+
{ variant: "glass-surface", tone: "warning", class: "border-warning/50" },
|
|
313
|
+
// === UNAVAILABLE === last, so the dashed border's colour beats every tone's own border colour.
|
|
314
|
+
{ unavailable: true, class: "border-current/40" },
|
|
315
|
+
// The icon shapes cross the icon with a slash, drawn by `::after` so the markup stays the consumer's; it keeps
|
|
316
|
+
// the forced text colour, since forced colours would otherwise repaint its fill as `Canvas`.
|
|
317
|
+
{
|
|
318
|
+
unavailable: true,
|
|
319
|
+
shape: ["square", "circle"],
|
|
320
|
+
class: "after:pointer-events-none after:absolute after:inset-x-[20%] after:top-1/2 after:h-0.5 after:-translate-y-1/2 after:rotate-45 after:rounded-full after:bg-current after:[forced-color-adjust:none]"
|
|
321
|
+
}
|
|
307
322
|
],
|
|
308
323
|
defaultVariants: {
|
|
309
324
|
variant: "solid",
|
|
@@ -311,7 +326,8 @@ const buttonVariants = tv({
|
|
|
311
326
|
size: "md",
|
|
312
327
|
shape: "default",
|
|
313
328
|
fullWidth: false,
|
|
314
|
-
wrap: false
|
|
329
|
+
wrap: false,
|
|
330
|
+
unavailable: false
|
|
315
331
|
}
|
|
316
332
|
});
|
|
317
333
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.variants.js","sources":["../../../../src/presentation/actions/button/Button.variants.ts"],"sourcesContent":["import { tv, Tones, ColorTone, type VariantProps } from '../../../foundation/styles';\n\n/** Defines the Button visual surface style. */\nexport const ButtonVariant = {\n /** Refers to an opaque, filled surface. */\n Solid: 'solid',\n /** Refers to a muted/tinted fill. */\n Soft: 'soft',\n /** Refers to a subtle tinted fill + tone-colored border. */\n Surface: 'surface',\n /** Refers to a transparent fill + tone border. */\n Outline: 'outline',\n /** Refers to a borderless, transparent-at-rest button. */\n Ghost: 'ghost',\n /** Refers to a borderless button that reveals a bordered chip on hover/focus. */\n Reveal: 'reveal',\n /** Refers to an inline text link. */\n Link: 'link',\n /** Refers to a translucent glass wash + blur. */\n Glass: 'glass',\n /** Refers to a glass surface with a hairline border. */\n GlassSurface: 'glass-surface',\n} as const;\n\nexport type ButtonVariant = (typeof ButtonVariant)[keyof typeof ButtonVariant];\n\n/** Defines the Button silhouette. */\nexport const ButtonShape = {\n /** Refers to the default (text-width) shape. */\n Default: 'default',\n /** Refers to a square (1:1) icon shape. */\n Square: 'square',\n /** Refers to a circular icon shape. */\n Circle: 'circle',\n} as const;\n\nexport type ButtonShape = (typeof ButtonShape)[keyof typeof ButtonShape];\n\n/** Button visual surface — see Button.standard.md + Button.spec.md. */\nexport const buttonVariants = tv({\n base: [\n // layout\n 'group inline-flex items-center justify-center gap-2',\n // typography\n 'font-medium align-middle',\n // borders (forced-colors fallback)\n 'border border-transparent',\n 'forced-colors:border-[ButtonBorder]',\n // transitions (color only)\n 'transition-colors duration-150 ease-out',\n 'motion-reduce:transition-none',\n // focus\n 'outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background',\n // disabled (native attr handles click-blocking; pointer-events-none would\n // suppress the cursor visual, so we don't add it here)\n 'disabled:opacity-50 disabled:cursor-not-allowed',\n // loading — dimmed and busy, but still focusable (clicks are swallowed in the handler)\n 'data-[state=loading]:opacity-70 data-[state=loading]:cursor-progress',\n // skeleton state — wins over everything; the box keeps its size and radius, motion only when allowed\n 'data-[state=skeleton]:bg-muted! data-[state=skeleton]:bg-none! data-[state=skeleton]:shadow-none! data-[state=skeleton]:text-transparent! data-[state=skeleton]:border-transparent! data-[state=skeleton]:cursor-default! data-[state=skeleton]:!pointer-events-none data-[state=skeleton]:motion-safe:animate-pulse',\n 'data-[state=skeleton]:[&>*]:!invisible',\n // forced colours repaint the fill and show the label — the placeholder keeps a `GrayText` outline instead\n 'data-[state=skeleton]:forced-colors:[forced-color-adjust:none] data-[state=skeleton]:forced-colors:bg-[color:Canvas]! data-[state=skeleton]:forced-colors:outline-1 data-[state=skeleton]:forced-colors:outline-solid data-[state=skeleton]:forced-colors:-outline-offset-1 data-[state=skeleton]:forced-colors:outline-[color:GrayText]',\n ],\n variants: {\n variant: {\n solid: '',\n soft: '',\n surface: '',\n outline: 'bg-transparent',\n ghost: 'bg-transparent',\n // Borderless + transparent at rest; on hover / focus-visible a bordered chip is\n // revealed (border + bg + foreground text). Per-tone reveal target set via\n // compoundVariants below. Pairs with `hoverSlot` for the icon-swap affordance.\n reveal: 'bg-transparent border-transparent',\n link: 'bg-transparent h-auto! p-0! rounded-none! underline-offset-4 hover:underline focus-visible:ring-offset-0',\n // Base = neutral/default tone: dark image-overlay wash + blur. Non-neutral tones resolve\n // through the shared `Tones.glass` palette via compoundVariants below (so tone + color\n // overrides apply). `backdrop-blur-md` stays here for every tone.\n glass: 'backdrop-blur-md',\n 'glass-surface': 'backdrop-blur-md border-white/10',\n },\n tone: {\n primary: '',\n neutral: '',\n danger: '',\n success: '',\n warning: '',\n },\n size: {\n // min-h/min-w floor keeps the hit-target ≥ 24×24 (WCAG 2.2 SC 2.5.8) even when\n // --ui-density-scale < 1 would otherwise shrink it below the floor. Applies to\n // square/circle xs too (the min-h sets the box height; min-w the width).\n xs: 'h-[calc(1.5rem*var(--ui-density-scale,1))] min-h-6 min-w-6 px-[calc(0.5rem*var(--ui-density-scale,1))] text-xs rounded-sm gap-1',\n sm: 'h-[calc(2rem*var(--ui-density-scale,1))] px-[calc(0.75rem*var(--ui-density-scale,1))] text-sm rounded-md gap-1.5',\n md: 'h-[calc(2.5rem*var(--ui-density-scale,1))] px-[calc(1rem*var(--ui-density-scale,1))] text-sm rounded-md gap-2',\n lg: 'h-[calc(3rem*var(--ui-density-scale,1))] px-[calc(1.5rem*var(--ui-density-scale,1))] text-base rounded-lg gap-2',\n xl: 'h-[calc(3.5rem*var(--ui-density-scale,1))] px-[calc(2rem*var(--ui-density-scale,1))] text-base rounded-lg gap-2.5',\n },\n shape: {\n default: '',\n square: 'aspect-square px-0!',\n circle: 'aspect-square px-0! rounded-full!',\n },\n fullWidth: {\n true: 'w-full',\n false: '',\n },\n wrap: {\n true: 'whitespace-normal text-left',\n false: 'whitespace-nowrap text-ellipsis overflow-hidden',\n },\n },\n compoundVariants: [\n // === SOLID × tone ===\n {\n variant: 'solid',\n tone: 'primary',\n class: 'bg-primary text-primary-foreground hover:bg-primary/90 active:bg-primary/95',\n },\n { variant: 'solid', tone: 'neutral', class: 'bg-muted text-foreground hover:bg-muted/80 active:bg-muted/85' },\n {\n variant: 'solid',\n tone: 'danger',\n class: 'bg-destructive text-destructive-foreground hover:bg-destructive/90 active:bg-destructive/95',\n },\n {\n variant: 'solid',\n tone: 'success',\n class: 'bg-success text-success-foreground hover:bg-success/90 active:bg-success/95',\n },\n {\n variant: 'solid',\n tone: 'warning',\n class: 'bg-warning text-warning-foreground hover:bg-warning/90 active:bg-warning/95',\n },\n\n // === SOFT × tone ===\n {\n variant: 'soft',\n tone: 'primary',\n class: 'bg-primary-soft text-primary-soft-foreground hover:bg-primary-soft/80 active:bg-primary-soft/85',\n },\n { variant: 'soft', tone: 'neutral', class: 'bg-muted/60 text-foreground hover:bg-muted/80 active:bg-muted/85' },\n {\n variant: 'soft',\n tone: 'danger',\n class:\n 'bg-destructive-soft text-destructive-soft-foreground hover:bg-destructive-soft/80 active:bg-destructive-soft/85',\n },\n {\n variant: 'soft',\n tone: 'success',\n class: 'bg-success-soft text-success-soft-foreground hover:bg-success-soft/80 active:bg-success-soft/85',\n },\n {\n variant: 'soft',\n tone: 'warning',\n class: 'bg-warning-soft text-warning-soft-foreground hover:bg-warning-soft/80 active:bg-warning-soft/85',\n },\n\n /*\n * `text-{tone}-soft-foreground`, not `text-{tone}`, everywhere the fill is transparent or\n * a light tint (surface · outline · ghost · reveal · link below).\n *\n * `text-{tone}` is the SOLID-fill accent: it is picked to carry the tone at full strength\n * against its own opaque background, and on a light surface it is simply too light —\n * `outline/warning` measured 1.85:1 and `surface/warning` 1.72:1 on this file's own\n * `theme-smart-qr` card. `--color-{tone}-soft-foreground` is the token minted for exactly\n * this pairing, and the `soft` rows below have always used it; these rows were the ones\n * that were missed. Borders stay full-strength `{tone}` so the tone still reads.\n * Matches `foundation/styles/constants/Tones.ts`, which routes `soft` + `outline` the same way.\n */\n // === SURFACE × tone (subtle tinted bg + visible tone-colored border) ===\n {\n variant: 'surface',\n tone: 'primary',\n class: 'bg-primary/5 border-primary/40 text-primary-soft-foreground hover:bg-primary/10 active:bg-primary/15',\n },\n {\n variant: 'surface',\n tone: 'neutral',\n class: 'bg-muted/30 border-border-strong text-foreground hover:bg-muted/50 active:bg-muted/70',\n },\n {\n variant: 'surface',\n tone: 'danger',\n class:\n 'bg-destructive/5 border-destructive/40 text-destructive-soft-foreground hover:bg-destructive/10 active:bg-destructive/15',\n },\n {\n variant: 'surface',\n tone: 'success',\n class: 'bg-success/5 border-success/40 text-success-soft-foreground hover:bg-success/10 active:bg-success/15',\n },\n {\n variant: 'surface',\n tone: 'warning',\n class: 'bg-warning/10 border-warning/40 text-warning-soft-foreground hover:bg-warning/15 active:bg-warning/20',\n },\n\n // === OUTLINE × tone ===\n {\n variant: 'outline',\n tone: 'primary',\n class: 'border-primary/50 text-primary-soft-foreground hover:bg-primary/10 active:bg-primary/15',\n },\n {\n variant: 'outline',\n tone: 'neutral',\n class: 'border-border-strong text-foreground hover:bg-muted/50 active:bg-muted/70',\n },\n {\n variant: 'outline',\n tone: 'danger',\n class: 'border-destructive/50 text-destructive-soft-foreground hover:bg-destructive/10 active:bg-destructive/15',\n },\n {\n variant: 'outline',\n tone: 'success',\n class: 'border-success/50 text-success-soft-foreground hover:bg-success/10 active:bg-success/15',\n },\n {\n variant: 'outline',\n tone: 'warning',\n class: 'border-warning/60 text-warning-soft-foreground hover:bg-warning/10 active:bg-warning/15',\n },\n\n // === GHOST × tone ===\n {\n variant: 'ghost',\n tone: 'primary',\n class: 'text-primary-soft-foreground hover:bg-primary/10 active:bg-primary/15',\n },\n { variant: 'ghost', tone: 'neutral', class: 'text-foreground hover:bg-foreground/10 active:bg-foreground/15' },\n {\n variant: 'ghost',\n tone: 'danger',\n class: 'text-destructive-soft-foreground hover:bg-destructive/10 active:bg-destructive/15',\n },\n {\n variant: 'ghost',\n tone: 'success',\n class: 'text-success-soft-foreground hover:bg-success/10 active:bg-success/15',\n },\n {\n variant: 'ghost',\n tone: 'warning',\n class: 'text-warning-soft-foreground hover:bg-warning/10 active:bg-warning/15',\n },\n\n // === REVEAL × tone (idle: muted transparent · hover/focus-visible: bordered chip revealed) ===\n // Idle text sits at reduced emphasis (muted-foreground / tone-tinted); hover & focus-visible\n // resolve the border + a surface background + full-emphasis foreground so a bordered chip\n // \"appears\". neutral is the common case (borderless icon affordance).\n /* The `/70` idle alpha is the intended de-emphasis and is kept; only the token under it\n changes, which is what lifts idle `warning` off 1.56:1. */\n {\n variant: 'reveal',\n tone: 'primary',\n class:\n 'text-primary-soft-foreground/70 hover:border-border hover:bg-background hover:text-primary-soft-foreground focus-visible:border-border focus-visible:bg-background focus-visible:text-primary-soft-foreground active:bg-muted/70',\n },\n {\n variant: 'reveal',\n tone: 'neutral',\n class:\n 'text-muted-foreground hover:border-border hover:bg-background hover:text-foreground focus-visible:border-border focus-visible:bg-background focus-visible:text-foreground active:bg-muted/70',\n },\n {\n variant: 'reveal',\n tone: 'danger',\n class:\n 'text-destructive-soft-foreground/70 hover:border-border hover:bg-background hover:text-destructive-soft-foreground focus-visible:border-border focus-visible:bg-background focus-visible:text-destructive-soft-foreground active:bg-muted/70',\n },\n {\n variant: 'reveal',\n tone: 'success',\n class:\n 'text-success-soft-foreground/70 hover:border-border hover:bg-background hover:text-success-soft-foreground focus-visible:border-border focus-visible:bg-background focus-visible:text-success-soft-foreground active:bg-muted/70',\n },\n {\n variant: 'reveal',\n tone: 'warning',\n class:\n 'text-warning-soft-foreground/70 hover:border-border hover:bg-background hover:text-warning-soft-foreground focus-visible:border-border focus-visible:bg-background focus-visible:text-warning-soft-foreground active:bg-muted/70',\n },\n\n // === LINK × tone (h/padding/radius cleared by variant) ===\n { variant: 'link', tone: 'primary', class: 'text-primary-soft-foreground' },\n { variant: 'link', tone: 'neutral', class: 'text-foreground' },\n { variant: 'link', tone: 'danger', class: 'text-destructive-soft-foreground' },\n { variant: 'link', tone: 'success', class: 'text-success-soft-foreground' },\n { variant: 'link', tone: 'warning', class: 'text-warning-soft-foreground' },\n\n // === GLASS / GLASS-SURFACE × tone ===\n // neutral = the image-overlay default: fixed dark wash + light text (reads over any imagery).\n {\n variant: ['glass', 'glass-surface'],\n tone: 'neutral',\n class: 'bg-black/45 text-white/70 hover:bg-black/65 hover:text-white active:bg-black/75',\n },\n // Every other tone resolves through the shared `Tones.glass` palette (`bg-{tone}/30 text-{tone}-foreground`)\n // so `tone=\"success\"` and per-instance `color` apply, plus a tone-matched hover / active wash.\n {\n variant: ['glass', 'glass-surface'],\n tone: 'primary',\n class: `${Tones.glass.primary} hover:bg-primary/45 active:bg-primary/55`,\n },\n {\n variant: ['glass', 'glass-surface'],\n tone: 'danger',\n class: `${Tones.glass.danger} hover:bg-destructive/45 active:bg-destructive/55`,\n },\n {\n variant: ['glass', 'glass-surface'],\n tone: 'success',\n class: `${Tones.glass.success} hover:bg-success/45 active:bg-success/55`,\n },\n {\n variant: ['glass', 'glass-surface'],\n tone: 'warning',\n class: `${Tones.glass.warning} hover:bg-warning/45 active:bg-warning/55`,\n },\n // glass-surface non-neutral tones swap the white hairline for a tone-accent border (50% alpha).\n { variant: 'glass-surface', tone: 'primary', class: 'border-primary/50' },\n { variant: 'glass-surface', tone: 'danger', class: 'border-destructive/50' },\n { variant: 'glass-surface', tone: 'success', class: 'border-success/50' },\n { variant: 'glass-surface', tone: 'warning', class: 'border-warning/50' },\n ],\n defaultVariants: {\n variant: 'solid',\n tone: 'primary',\n size: 'md',\n shape: 'default',\n fullWidth: false,\n wrap: false,\n },\n});\n\nexport type ButtonVariants = VariantProps<typeof buttonVariants>;\n\n/* Compile-time lock: enum values ≡ tv variant/tone/shape value-sets (drift = type error). */\ntype AssertExact<A, B> = [A] extends [B] ? ([B] extends [A] ? true : never) : never;\nconst _assertButtonVariant: AssertExact<\n ButtonVariant,\n NonNullable<VariantProps<typeof buttonVariants>['variant']>\n> = true;\nconst _assertButtonTone: AssertExact<ColorTone, NonNullable<VariantProps<typeof buttonVariants>['tone']>> = true;\nconst _assertButtonShape: AssertExact<ButtonShape, NonNullable<VariantProps<typeof buttonVariants>['shape']>> = true;\nvoid _assertButtonVariant;\nvoid _assertButtonTone;\nvoid _assertButtonShape;\n"],"names":[],"mappings":";;AAGO,MAAM,gBAAgB;AAAA;AAAA,EAE3B,OAAO;AAAA;AAAA,EAEP,MAAM;AAAA;AAAA,EAEN,SAAS;AAAA;AAAA,EAET,SAAS;A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,mCAAA;AAAA,IAC1C,EAAE,SAAS,QAAQ,MAAM,WAAW,OAAO,+BAAA;AAAA,IAC3C,EAAE,SAAS,QAAQ,MAAM,WAAW,OAAO,+BAAA;AAAA;AAAA;AAAA,IAI3C;AAAA,MACE,SAAS,CAAC,SAAS,eAAe;AAAA,MAClC,MAAM;AAAA,MACN,OAAO;AAAA,IAAA;AAAA;AAAA;AAAA,IAIT;AAAA,MACE,SAAS,CAAC,SAAS,eAAe;AAAA,MAClC,MAAM;AAAA,MACN,OAAO,GAAG,MAAM,MAAM,OAAO;AAAA,IAAA;AAAA,IAE/B;AAAA,MACE,SAAS,CAAC,SAAS,eAAe;AAAA,MAClC,MAAM;AAAA,MACN,OAAO,GAAG,MAAM,MAAM,MAAM;AAAA,IAAA;AAAA,IAE9B;AAAA,MACE,SAAS,CAAC,SAAS,eAAe;AAAA,MAClC,MAAM;AAAA,MACN,OAAO,GAAG,MAAM,MAAM,OAAO;AAAA,IAAA;AAAA,IAE/B;AAAA,MACE,SAAS,CAAC,SAAS,eAAe;AAAA,MAClC,MAAM;AAAA,MACN,OAAO,GAAG,MAAM,MAAM,OAAO;AAAA,IAAA;AAAA;AAAA,IAG/B,EAAE,SAAS,iBAAiB,MAAM,WAAW,OAAO,oBAAA;AAAA,IACpD,EAAE,SAAS,iBAAiB,MAAM,UAAU,OAAO,wBAAA;AAAA,IACnD,EAAE,SAAS,iBAAiB,MAAM,WAAW,OAAO,oBAAA;AAAA,IACpD,EAAE,SAAS,iBAAiB,MAAM,WAAW,OAAO,oBAAA;AAAA,EAAoB;AAAA,EAE1E,iBAAiB;AAAA,IACf,SAAS;AAAA,IACT,MAAM;AAAA,IACN,MAAM;AAAA,IACN,OAAO;AAAA,IACP,WAAW;AAAA,IACX,MAAM;AAAA,EAAA;AAEV,CAAC;"}
|
|
1
|
+
{"version":3,"file":"Button.variants.js","sources":["../../../../src/presentation/actions/button/Button.variants.ts"],"sourcesContent":["import { tv, Tones, ColorTone, type VariantProps } from '../../../foundation/styles';\n\n/** Defines the Button visual surface style. */\nexport const ButtonVariant = {\n /** Refers to an opaque, filled surface. */\n Solid: 'solid',\n /** Refers to a muted/tinted fill. */\n Soft: 'soft',\n /** Refers to a subtle tinted fill + tone-colored border. */\n Surface: 'surface',\n /** Refers to a transparent fill + tone border. */\n Outline: 'outline',\n /** Refers to a borderless, transparent-at-rest button. */\n Ghost: 'ghost',\n /** Refers to a borderless button that reveals a bordered chip on hover/focus. */\n Reveal: 'reveal',\n /** Refers to an inline text link. */\n Link: 'link',\n /** Refers to a translucent glass wash + blur. */\n Glass: 'glass',\n /** Refers to a glass surface with a hairline border. */\n GlassSurface: 'glass-surface',\n} as const;\n\nexport type ButtonVariant = (typeof ButtonVariant)[keyof typeof ButtonVariant];\n\n/** Defines the Button silhouette. */\nexport const ButtonShape = {\n /** Refers to the default (text-width) shape. */\n Default: 'default',\n /** Refers to a square (1:1) icon shape. */\n Square: 'square',\n /** Refers to a circular icon shape. */\n Circle: 'circle',\n} as const;\n\nexport type ButtonShape = (typeof ButtonShape)[keyof typeof ButtonShape];\n\n/** Button visual surface — see Button.standard.md + Button.spec.md. */\nexport const buttonVariants = tv({\n base: [\n // layout\n 'group inline-flex items-center justify-center gap-2',\n // typography\n 'font-medium align-middle',\n // borders (forced-colors fallback)\n 'border border-transparent',\n 'forced-colors:border-[ButtonBorder]',\n // transitions (color only)\n 'transition-colors duration-150 ease-out',\n 'motion-reduce:transition-none',\n // focus\n 'outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background',\n // disabled (native attr handles click-blocking; pointer-events-none would\n // suppress the cursor visual, so we don't add it here)\n 'disabled:opacity-50 disabled:cursor-not-allowed',\n // loading — dimmed and busy, but still focusable (clicks are swallowed in the handler)\n 'data-[state=loading]:opacity-70 data-[state=loading]:cursor-progress',\n // skeleton state — wins over everything; the box keeps its size and radius, motion only when allowed\n 'data-[state=skeleton]:bg-muted! data-[state=skeleton]:bg-none! data-[state=skeleton]:shadow-none! data-[state=skeleton]:text-transparent! data-[state=skeleton]:border-transparent! data-[state=skeleton]:cursor-default! data-[state=skeleton]:!pointer-events-none data-[state=skeleton]:motion-safe:animate-pulse',\n 'data-[state=skeleton]:[&>*]:!invisible',\n // forced colours repaint the fill and show the label — the placeholder keeps a `GrayText` outline instead\n 'data-[state=skeleton]:forced-colors:[forced-color-adjust:none] data-[state=skeleton]:forced-colors:bg-[color:Canvas]! data-[state=skeleton]:forced-colors:outline-1 data-[state=skeleton]:forced-colors:outline-solid data-[state=skeleton]:forced-colors:-outline-offset-1 data-[state=skeleton]:forced-colors:outline-[color:GrayText]',\n ],\n variants: {\n variant: {\n solid: '',\n soft: '',\n surface: '',\n outline: 'bg-transparent',\n ghost: 'bg-transparent',\n // Borderless + transparent at rest; on hover / focus-visible a bordered chip is\n // revealed (border + bg + foreground text). Per-tone reveal target set via\n // compoundVariants below. Pairs with `hoverSlot` for the icon-swap affordance.\n reveal: 'bg-transparent border-transparent',\n link: 'bg-transparent h-auto! p-0! rounded-none! underline-offset-4 hover:underline focus-visible:ring-offset-0',\n // Base = neutral/default tone: dark image-overlay wash + blur. Non-neutral tones resolve\n // through the shared `Tones.glass` palette via compoundVariants below (so tone + color\n // overrides apply). `backdrop-blur-md` stays here for every tone.\n glass: 'backdrop-blur-md',\n 'glass-surface': 'backdrop-blur-md border-white/10',\n },\n tone: {\n primary: '',\n neutral: '',\n danger: '',\n success: '',\n warning: '',\n },\n size: {\n // min-h/min-w floor keeps the hit-target ≥ 24×24 (WCAG 2.2 SC 2.5.8) even when\n // --ui-density-scale < 1 would otherwise shrink it below the floor. Applies to\n // square/circle xs too (the min-h sets the box height; min-w the width).\n xs: 'h-[calc(1.5rem*var(--ui-density-scale,1))] min-h-6 min-w-6 px-[calc(0.5rem*var(--ui-density-scale,1))] text-xs rounded-sm gap-1',\n sm: 'h-[calc(2rem*var(--ui-density-scale,1))] px-[calc(0.75rem*var(--ui-density-scale,1))] text-sm rounded-md gap-1.5',\n md: 'h-[calc(2.5rem*var(--ui-density-scale,1))] px-[calc(1rem*var(--ui-density-scale,1))] text-sm rounded-md gap-2',\n lg: 'h-[calc(3rem*var(--ui-density-scale,1))] px-[calc(1.5rem*var(--ui-density-scale,1))] text-base rounded-lg gap-2',\n xl: 'h-[calc(3.5rem*var(--ui-density-scale,1))] px-[calc(2rem*var(--ui-density-scale,1))] text-base rounded-lg gap-2.5',\n },\n shape: {\n default: '',\n square: 'aspect-square px-0!',\n circle: 'aspect-square px-0! rounded-full!',\n },\n fullWidth: {\n true: 'w-full',\n false: '',\n },\n wrap: {\n true: 'whitespace-normal text-left',\n false: 'whitespace-nowrap text-ellipsis overflow-hidden',\n },\n // Unavailable: still a tab stop, but dashed and dimmed. `relative` anchors the slash below and yields to a\n // consumer's own position class through `cn`.\n unavailable: {\n true: 'relative border-dashed opacity-60 cursor-not-allowed',\n false: '',\n },\n },\n compoundVariants: [\n // === SOLID × tone ===\n {\n variant: 'solid',\n tone: 'primary',\n class: 'bg-primary text-primary-foreground hover:bg-primary/90 active:bg-primary/95',\n },\n { variant: 'solid', tone: 'neutral', class: 'bg-muted text-foreground hover:bg-muted/80 active:bg-muted/85' },\n {\n variant: 'solid',\n tone: 'danger',\n class: 'bg-destructive text-destructive-foreground hover:bg-destructive/90 active:bg-destructive/95',\n },\n {\n variant: 'solid',\n tone: 'success',\n class: 'bg-success text-success-foreground hover:bg-success/90 active:bg-success/95',\n },\n {\n variant: 'solid',\n tone: 'warning',\n class: 'bg-warning text-warning-foreground hover:bg-warning/90 active:bg-warning/95',\n },\n\n // === SOFT × tone ===\n {\n variant: 'soft',\n tone: 'primary',\n class: 'bg-primary-soft text-primary-soft-foreground hover:bg-primary-soft/80 active:bg-primary-soft/85',\n },\n { variant: 'soft', tone: 'neutral', class: 'bg-muted/60 text-foreground hover:bg-muted/80 active:bg-muted/85' },\n {\n variant: 'soft',\n tone: 'danger',\n class:\n 'bg-destructive-soft text-destructive-soft-foreground hover:bg-destructive-soft/80 active:bg-destructive-soft/85',\n },\n {\n variant: 'soft',\n tone: 'success',\n class: 'bg-success-soft text-success-soft-foreground hover:bg-success-soft/80 active:bg-success-soft/85',\n },\n {\n variant: 'soft',\n tone: 'warning',\n class: 'bg-warning-soft text-warning-soft-foreground hover:bg-warning-soft/80 active:bg-warning-soft/85',\n },\n\n /*\n * `text-{tone}-soft-foreground`, not `text-{tone}`, everywhere the fill is transparent or\n * a light tint (surface · outline · ghost · reveal · link below).\n *\n * `text-{tone}` is the SOLID-fill accent: it is picked to carry the tone at full strength\n * against its own opaque background, and on a light surface it is simply too light —\n * `outline/warning` measured 1.85:1 and `surface/warning` 1.72:1 on this file's own\n * `theme-smart-qr` card. `--color-{tone}-soft-foreground` is the token minted for exactly\n * this pairing, and the `soft` rows below have always used it; these rows were the ones\n * that were missed. Borders stay full-strength `{tone}` so the tone still reads.\n * Matches `foundation/styles/constants/Tones.ts`, which routes `soft` + `outline` the same way.\n */\n // === SURFACE × tone (subtle tinted bg + visible tone-colored border) ===\n {\n variant: 'surface',\n tone: 'primary',\n class: 'bg-primary/5 border-primary/40 text-primary-soft-foreground hover:bg-primary/10 active:bg-primary/15',\n },\n {\n variant: 'surface',\n tone: 'neutral',\n class: 'bg-muted/30 border-border-strong text-foreground hover:bg-muted/50 active:bg-muted/70',\n },\n {\n variant: 'surface',\n tone: 'danger',\n class:\n 'bg-destructive/5 border-destructive/40 text-destructive-soft-foreground hover:bg-destructive/10 active:bg-destructive/15',\n },\n {\n variant: 'surface',\n tone: 'success',\n class: 'bg-success/5 border-success/40 text-success-soft-foreground hover:bg-success/10 active:bg-success/15',\n },\n {\n variant: 'surface',\n tone: 'warning',\n class: 'bg-warning/10 border-warning/40 text-warning-soft-foreground hover:bg-warning/15 active:bg-warning/20',\n },\n\n // === OUTLINE × tone ===\n {\n variant: 'outline',\n tone: 'primary',\n class: 'border-primary/50 text-primary-soft-foreground hover:bg-primary/10 active:bg-primary/15',\n },\n {\n variant: 'outline',\n tone: 'neutral',\n class: 'border-border-strong text-foreground hover:bg-muted/50 active:bg-muted/70',\n },\n {\n variant: 'outline',\n tone: 'danger',\n class: 'border-destructive/50 text-destructive-soft-foreground hover:bg-destructive/10 active:bg-destructive/15',\n },\n {\n variant: 'outline',\n tone: 'success',\n class: 'border-success/50 text-success-soft-foreground hover:bg-success/10 active:bg-success/15',\n },\n {\n variant: 'outline',\n tone: 'warning',\n class: 'border-warning/60 text-warning-soft-foreground hover:bg-warning/10 active:bg-warning/15',\n },\n\n // === GHOST × tone ===\n {\n variant: 'ghost',\n tone: 'primary',\n class: 'text-primary-soft-foreground hover:bg-primary/10 active:bg-primary/15',\n },\n { variant: 'ghost', tone: 'neutral', class: 'text-foreground hover:bg-foreground/10 active:bg-foreground/15' },\n {\n variant: 'ghost',\n tone: 'danger',\n class: 'text-destructive-soft-foreground hover:bg-destructive/10 active:bg-destructive/15',\n },\n {\n variant: 'ghost',\n tone: 'success',\n class: 'text-success-soft-foreground hover:bg-success/10 active:bg-success/15',\n },\n {\n variant: 'ghost',\n tone: 'warning',\n class: 'text-warning-soft-foreground hover:bg-warning/10 active:bg-warning/15',\n },\n\n // === REVEAL × tone (idle: muted transparent · hover/focus-visible: bordered chip revealed) ===\n // Idle text sits at reduced emphasis (muted-foreground / tone-tinted); hover & focus-visible\n // resolve the border + a surface background + full-emphasis foreground so a bordered chip\n // \"appears\". neutral is the common case (borderless icon affordance).\n /* The `/70` idle alpha is the intended de-emphasis and is kept; only the token under it\n changes, which is what lifts idle `warning` off 1.56:1. */\n {\n variant: 'reveal',\n tone: 'primary',\n class:\n 'text-primary-soft-foreground/70 hover:border-border hover:bg-background hover:text-primary-soft-foreground focus-visible:border-border focus-visible:bg-background focus-visible:text-primary-soft-foreground active:bg-muted/70',\n },\n {\n variant: 'reveal',\n tone: 'neutral',\n class:\n 'text-muted-foreground hover:border-border hover:bg-background hover:text-foreground focus-visible:border-border focus-visible:bg-background focus-visible:text-foreground active:bg-muted/70',\n },\n {\n variant: 'reveal',\n tone: 'danger',\n class:\n 'text-destructive-soft-foreground/70 hover:border-border hover:bg-background hover:text-destructive-soft-foreground focus-visible:border-border focus-visible:bg-background focus-visible:text-destructive-soft-foreground active:bg-muted/70',\n },\n {\n variant: 'reveal',\n tone: 'success',\n class:\n 'text-success-soft-foreground/70 hover:border-border hover:bg-background hover:text-success-soft-foreground focus-visible:border-border focus-visible:bg-background focus-visible:text-success-soft-foreground active:bg-muted/70',\n },\n {\n variant: 'reveal',\n tone: 'warning',\n class:\n 'text-warning-soft-foreground/70 hover:border-border hover:bg-background hover:text-warning-soft-foreground focus-visible:border-border focus-visible:bg-background focus-visible:text-warning-soft-foreground active:bg-muted/70',\n },\n\n // === LINK × tone (h/padding/radius cleared by variant) ===\n { variant: 'link', tone: 'primary', class: 'text-primary-soft-foreground' },\n { variant: 'link', tone: 'neutral', class: 'text-foreground' },\n { variant: 'link', tone: 'danger', class: 'text-destructive-soft-foreground' },\n { variant: 'link', tone: 'success', class: 'text-success-soft-foreground' },\n { variant: 'link', tone: 'warning', class: 'text-warning-soft-foreground' },\n\n // === GLASS / GLASS-SURFACE × tone ===\n // neutral = the image-overlay default: fixed dark wash + light text (reads over any imagery).\n {\n variant: ['glass', 'glass-surface'],\n tone: 'neutral',\n class: 'bg-black/45 text-white/70 hover:bg-black/65 hover:text-white active:bg-black/75',\n },\n // Every other tone resolves through the shared `Tones.glass` palette (`bg-{tone}/30 text-{tone}-foreground`)\n // so `tone=\"success\"` and per-instance `color` apply, plus a tone-matched hover / active wash.\n {\n variant: ['glass', 'glass-surface'],\n tone: 'primary',\n class: `${Tones.glass.primary} hover:bg-primary/45 active:bg-primary/55`,\n },\n {\n variant: ['glass', 'glass-surface'],\n tone: 'danger',\n class: `${Tones.glass.danger} hover:bg-destructive/45 active:bg-destructive/55`,\n },\n {\n variant: ['glass', 'glass-surface'],\n tone: 'success',\n class: `${Tones.glass.success} hover:bg-success/45 active:bg-success/55`,\n },\n {\n variant: ['glass', 'glass-surface'],\n tone: 'warning',\n class: `${Tones.glass.warning} hover:bg-warning/45 active:bg-warning/55`,\n },\n // glass-surface non-neutral tones swap the white hairline for a tone-accent border (50% alpha).\n { variant: 'glass-surface', tone: 'primary', class: 'border-primary/50' },\n { variant: 'glass-surface', tone: 'danger', class: 'border-destructive/50' },\n { variant: 'glass-surface', tone: 'success', class: 'border-success/50' },\n { variant: 'glass-surface', tone: 'warning', class: 'border-warning/50' },\n\n // === UNAVAILABLE === last, so the dashed border's colour beats every tone's own border colour.\n { unavailable: true, class: 'border-current/40' },\n // The icon shapes cross the icon with a slash, drawn by `::after` so the markup stays the consumer's; it keeps\n // the forced text colour, since forced colours would otherwise repaint its fill as `Canvas`.\n {\n unavailable: true,\n shape: ['square', 'circle'],\n class:\n 'after:pointer-events-none after:absolute after:inset-x-[20%] after:top-1/2 after:h-0.5 after:-translate-y-1/2 after:rotate-45 after:rounded-full after:bg-current after:[forced-color-adjust:none]',\n },\n ],\n defaultVariants: {\n variant: 'solid',\n tone: 'primary',\n size: 'md',\n shape: 'default',\n fullWidth: false,\n wrap: false,\n unavailable: false,\n },\n});\n\nexport type ButtonVariants = VariantProps<typeof buttonVariants>;\n\n/* Compile-time lock: enum values ≡ tv variant/tone/shape value-sets (drift = type error). */\ntype AssertExact<A, B> = [A] extends [B] ? ([B] extends [A] ? true : never) : never;\nconst _assertButtonVariant: AssertExact<\n ButtonVariant,\n NonNullable<VariantProps<typeof buttonVariants>['variant']>\n> = true;\nconst _assertButtonTone: AssertExact<ColorTone, NonNullable<VariantProps<typeof buttonVariants>['tone']>> = true;\nconst _assertButtonShape: AssertExact<ButtonShape, NonNullable<VariantProps<typeof buttonVariants>['shape']>> = true;\nvoid _assertButtonVariant;\nvoid _assertButtonTone;\nvoid _assertButtonShape;\n"],"names":[],"mappings":";;AAGO,MAAM,gBAAgB;AAAA;AAAA,EAE3B,OAAO;AAAA;AAAA,EAEP,MAAM;AAAA;AAAA,EAEN,SAAS;AAAA;AAAA,EAET,SAAS;AAAA;AAAA,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AA,IACT,MAAM;AAAA,IACN,MAAM;AAAA,IACN,OAAO;AAAA,IACP,WAAW;AAAA,IACX,MAAM;AAAA,IACN,aAAa;AAAA,EAAA;AAEjB,CAAC;"}
|
|
@@ -6,7 +6,7 @@ type ButtonSizePreset = Extract<SizePreset, 'xs' | 'sm' | 'md' | 'lg' | 'xl'>;
|
|
|
6
6
|
export type ButtonSize = SizeUnion<ButtonSizePreset>;
|
|
7
7
|
/** @internal The type-only surface `ButtonProps` inherits — native attributes plus the variant keys. `onClick` stays
|
|
8
8
|
typed so `@click` compiles under strict templates; the button still gates it at runtime (see `handleClick`). */
|
|
9
|
-
type ButtonAttributes = Omit<ButtonHTMLAttributes, 'type' | 'disabled' | 'color'> & Omit<ButtonVariants, 'size' | 'variant' | 'tone' | 'shape'>;
|
|
9
|
+
type ButtonAttributes = Omit<ButtonHTMLAttributes, 'type' | 'disabled' | 'color'> & Omit<ButtonVariants, 'size' | 'variant' | 'tone' | 'shape' | 'unavailable'>;
|
|
10
10
|
/** Defines props for the button. */
|
|
11
11
|
export interface ButtonProps extends /* @vue-ignore */ ButtonAttributes {
|
|
12
12
|
/** The visual surface style. */
|
|
@@ -37,6 +37,12 @@ export interface ButtonProps extends /* @vue-ignore */ ButtonAttributes {
|
|
|
37
37
|
readonly isSkeleton?: boolean;
|
|
38
38
|
/** The disabled state — drops focus order and clicks. Inherited from an enclosing `Field`. */
|
|
39
39
|
readonly isDisabled?: boolean;
|
|
40
|
+
/** The unavailable state — keeps its tab stop with `aria-disabled`, swallows presses, and draws a dashed, dimmed
|
|
41
|
+
box; `circle` and `square` shapes add a slash over the icon. Disabled, loading and skeleton states win. */
|
|
42
|
+
readonly isUnavailable?: boolean;
|
|
43
|
+
/** The reason shown through `Tooltip` and set as the accessible description while unavailable. Consumer-supplied
|
|
44
|
+
(i18n). Defining it mounts the tooltip wrapper, so keep it defined while `isUnavailable` toggles. */
|
|
45
|
+
readonly unavailableLabel?: string;
|
|
40
46
|
/** The full-width state — stretches to fill container width. */
|
|
41
47
|
readonly isFullWidth?: boolean;
|
|
42
48
|
/** The multi-line state — allows label wrap; default truncates to single line. */
|
|
@@ -92,6 +98,7 @@ declare const _default: __VLS_WithSlots<import('vue').DefineComponent<ButtonProp
|
|
|
92
98
|
}> | null;
|
|
93
99
|
readonly isLoading: boolean;
|
|
94
100
|
readonly isSkeleton: boolean;
|
|
101
|
+
readonly isUnavailable: boolean;
|
|
95
102
|
readonly isFullWidth: boolean;
|
|
96
103
|
readonly isMultiline: boolean;
|
|
97
104
|
readonly longPressDelay: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, useSlots, useAttrs, computed, watchEffect, normalizeStyle, getCurrentInstance, onBeforeUnmount, watch, useTemplateRef, openBlock, createBlock,
|
|
1
|
+
import { defineComponent, useSlots, useAttrs, computed, shallowRef, watchEffect, normalizeStyle, getCurrentInstance, onBeforeUnmount, watch, useTemplateRef, openBlock, createBlock, resolveDynamicComponent, normalizeProps, guardReactiveProps, withCtx, createVNode, unref, mergeProps, renderSlot, createElementBlock, Fragment, toDisplayString, createCommentVNode, createElementVNode } from "vue";
|
|
2
2
|
import { composeEventHandlers } from "../../../foundation/dom/ComposeEventHandlers.js";
|
|
3
3
|
import { PressExtensions } from "../../../foundation/dom/PressExtensions.js";
|
|
4
4
|
import { ButtonType, HtmlElement } from "../../../foundation/dom/enums/HtmlValues.js";
|
|
@@ -11,13 +11,16 @@ import { IsDevelopment } from "../../../foundation/config/Environment.js";
|
|
|
11
11
|
import { OptionalExtensions } from "../../../foundation/optionals/OptionalExtensions.js";
|
|
12
12
|
import { useFormControl } from "../../../foundation/primitives/formControlContext/FormControlContext.js";
|
|
13
13
|
import { useDebounceHandler } from "../../../foundation/async/UseDebounceHandler.js";
|
|
14
|
+
import { useId } from "../../../foundation/identifiers/UseId.js";
|
|
14
15
|
import { useSkeletonState } from "../../feedback/skeletonState/SkeletonStateContext.js";
|
|
16
|
+
import _sfc_main$1 from "../../overlays/tooltip/Tooltip.vue.js";
|
|
15
17
|
import { buttonVariants } from "./Button.variants.js";
|
|
16
18
|
import { Primitive } from "../../../foundation/primitives/slot/Primitive.js";
|
|
17
|
-
import
|
|
19
|
+
import { Slottable, renderableChildren } from "../../../foundation/primitives/slot/Slot.js";
|
|
20
|
+
import _sfc_main$2 from "../../../foundation/icons/spinner/Spinner.vue.js";
|
|
18
21
|
const _hoisted_1 = { key: 0 };
|
|
19
22
|
const _hoisted_2 = {
|
|
20
|
-
key:
|
|
23
|
+
key: 3,
|
|
21
24
|
class: "relative inline-flex items-center justify-center"
|
|
22
25
|
};
|
|
23
26
|
const _hoisted_3 = { class: "inline-flex items-center gap-2 opacity-0" };
|
|
@@ -28,6 +31,7 @@ const _hoisted_7 = {
|
|
|
28
31
|
"aria-hidden": "true",
|
|
29
32
|
class: "invisible absolute inset-0 inline-flex items-center justify-center group-hover:visible group-focus-visible:visible"
|
|
30
33
|
};
|
|
34
|
+
const _hoisted_8 = ["id"];
|
|
31
35
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
32
36
|
...{ name: "Button", inheritAttrs: false },
|
|
33
37
|
__name: "Button",
|
|
@@ -45,6 +49,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
45
49
|
loadingText: {},
|
|
46
50
|
isSkeleton: { type: Boolean, default: void 0 },
|
|
47
51
|
isDisabled: { type: Boolean, default: void 0 },
|
|
52
|
+
isUnavailable: { type: Boolean, default: void 0 },
|
|
53
|
+
unavailableLabel: {},
|
|
48
54
|
isFullWidth: { type: Boolean, default: void 0 },
|
|
49
55
|
isMultiline: { type: Boolean, default: void 0 },
|
|
50
56
|
asChild: { type: Boolean, default: false },
|
|
@@ -66,7 +72,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
66
72
|
const ButtonDataState = {
|
|
67
73
|
Loading: "loading",
|
|
68
74
|
Skeleton: "skeleton",
|
|
69
|
-
Disabled: "disabled"
|
|
75
|
+
Disabled: "disabled",
|
|
76
|
+
Unavailable: "unavailable"
|
|
70
77
|
};
|
|
71
78
|
const props = __props;
|
|
72
79
|
const emit = __emit;
|
|
@@ -82,13 +89,36 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
82
89
|
const skeleton = useSkeletonState(() => props.isSkeleton);
|
|
83
90
|
const skeletonActive = computed(() => skeleton.isSkeleton.value);
|
|
84
91
|
const loadingActive = computed(() => !skeletonActive.value && !!props.isLoading);
|
|
85
|
-
const isInactive = computed(
|
|
92
|
+
const isInactive = computed(
|
|
93
|
+
() => loadingActive.value || skeletonActive.value || resolvedDisabled.value || !!props.isUnavailable
|
|
94
|
+
);
|
|
86
95
|
function hasLeading() {
|
|
87
96
|
return slots.leading !== void 0 || props.leadingSlot !== void 0;
|
|
88
97
|
}
|
|
89
98
|
const dataState = computed(
|
|
90
|
-
() => skeletonActive.value ? ButtonDataState.Skeleton : loadingActive.value ? ButtonDataState.Loading : resolvedDisabled.value ? ButtonDataState.Disabled : void 0
|
|
99
|
+
() => skeletonActive.value ? ButtonDataState.Skeleton : loadingActive.value ? ButtonDataState.Loading : resolvedDisabled.value ? ButtonDataState.Disabled : props.isUnavailable ? ButtonDataState.Unavailable : void 0
|
|
100
|
+
);
|
|
101
|
+
const unavailableShown = computed(() => dataState.value === ButtonDataState.Unavailable);
|
|
102
|
+
const unavailableReason = computed(
|
|
103
|
+
() => unavailableShown.value && props.unavailableLabel ? props.unavailableLabel : void 0
|
|
91
104
|
);
|
|
105
|
+
const descriptionId = useId("unavailable");
|
|
106
|
+
const tooltipOpen = shallowRef(false);
|
|
107
|
+
const PassThrough = (_props, { slots: slots2 }) => renderableChildren(slots2.default?.())[0] ?? null;
|
|
108
|
+
const wrapperProps = computed(
|
|
109
|
+
() => props.unavailableLabel === void 0 ? {} : {
|
|
110
|
+
content: props.unavailableLabel,
|
|
111
|
+
isDisabled: unavailableReason.value === void 0,
|
|
112
|
+
"onUpdate:open": (open) => {
|
|
113
|
+
tooltipOpen.value = open;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
const describedBy = computed(() => {
|
|
118
|
+
const ids = [attrs[AriaAttribute.DescribedBy]];
|
|
119
|
+
if (unavailableReason.value !== void 0 && !tooltipOpen.value) ids.push(descriptionId);
|
|
120
|
+
return ids.filter(Boolean).join(" ") || void 0;
|
|
121
|
+
});
|
|
92
122
|
const safeLongPressDelay = computed(
|
|
93
123
|
() => !Number.isFinite(props.longPressDelay) || props.longPressDelay < PressExtensions.longPressDelay.min || props.longPressDelay > PressExtensions.longPressDelay.max ? PressExtensions.longPressDelay.default : props.longPressDelay
|
|
94
124
|
);
|
|
@@ -119,7 +149,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
119
149
|
size: parsedSize.value.preset,
|
|
120
150
|
shape: props.shape,
|
|
121
151
|
fullWidth: props.isFullWidth,
|
|
122
|
-
wrap: props.isMultiline
|
|
152
|
+
wrap: props.isMultiline,
|
|
153
|
+
unavailable: unavailableShown.value
|
|
123
154
|
}),
|
|
124
155
|
attrs.class
|
|
125
156
|
)
|
|
@@ -243,6 +274,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
243
274
|
const OwnedAttributes = /* @__PURE__ */ new Set([
|
|
244
275
|
"class",
|
|
245
276
|
"style",
|
|
277
|
+
AriaAttribute.DescribedBy,
|
|
246
278
|
"onClick",
|
|
247
279
|
"onPointerdown",
|
|
248
280
|
"onPointerup",
|
|
@@ -264,6 +296,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
264
296
|
disabled: OptionalExtensions.from(resolvedDisabled.value, true),
|
|
265
297
|
[AriaAttribute.Busy]: OptionalExtensions.from(loadingActive.value || skeletonActive.value, true),
|
|
266
298
|
[AriaAttribute.Disabled]: OptionalExtensions.from(isInactive.value, true),
|
|
299
|
+
[AriaAttribute.DescribedBy]: describedBy.value,
|
|
267
300
|
tabindex: OptionalExtensions.from(skeletonActive.value || resolvedDisabled.value, -1),
|
|
268
301
|
"data-state": dataState.value,
|
|
269
302
|
onClick: handleClick,
|
|
@@ -282,62 +315,77 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
282
315
|
});
|
|
283
316
|
__expose({ el });
|
|
284
317
|
return (_ctx, _cache) => {
|
|
285
|
-
return openBlock(), createBlock(
|
|
286
|
-
ref_key: "root",
|
|
287
|
-
ref: root,
|
|
288
|
-
as: unref(HtmlElement).Button,
|
|
289
|
-
"as-child": __props.asChild
|
|
290
|
-
}, rootProps.value), {
|
|
318
|
+
return openBlock(), createBlock(resolveDynamicComponent(__props.unavailableLabel === void 0 ? PassThrough : _sfc_main$1), normalizeProps(guardReactiveProps(wrapperProps.value)), {
|
|
291
319
|
default: withCtx(() => [
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
])
|
|
312
|
-
])) : __props.hoverSlot !== void 0 || _ctx.$slots.hover ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
|
|
313
|
-
renderSlot(_ctx.$slots, "leading", {}, () => [
|
|
314
|
-
__props.leadingSlot !== void 0 ? (openBlock(), createBlock(unref(LeadingSlotProp), { key: 0 })) : createCommentVNode("", true)
|
|
315
|
-
]),
|
|
316
|
-
createElementVNode("span", _hoisted_5, [
|
|
317
|
-
createElementVNode("span", _hoisted_6, [
|
|
318
|
-
renderSlot(_ctx.$slots, "default")
|
|
319
|
-
]),
|
|
320
|
-
createElementVNode("span", _hoisted_7, [
|
|
321
|
-
renderSlot(_ctx.$slots, "hover", {}, () => [
|
|
322
|
-
__props.hoverSlot !== void 0 ? (openBlock(), createBlock(unref(HoverSlotProp), { key: 0 })) : createCommentVNode("", true)
|
|
320
|
+
createVNode(unref(Primitive), mergeProps({
|
|
321
|
+
ref_key: "root",
|
|
322
|
+
ref: root,
|
|
323
|
+
as: unref(HtmlElement).Button,
|
|
324
|
+
"as-child": __props.asChild
|
|
325
|
+
}, rootProps.value), {
|
|
326
|
+
default: withCtx(() => [
|
|
327
|
+
__props.asChild && unavailableReason.value !== void 0 ? (openBlock(), createBlock(unref(Slottable), { key: 0 }, {
|
|
328
|
+
default: withCtx(() => [
|
|
329
|
+
renderSlot(_ctx.$slots, "default")
|
|
330
|
+
]),
|
|
331
|
+
_: 3
|
|
332
|
+
})) : __props.asChild ? renderSlot(_ctx.$slots, "default", {}, void 0, void 0, 1) : loadingActive.value && (hasLeading() || __props.loadingText !== void 0) ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
333
|
+
renderSlot(_ctx.$slots, "loading", {}, () => [
|
|
334
|
+
__props.loadingSlot !== void 0 ? (openBlock(), createBlock(unref(LoadingSlotProp), { key: 0 })) : (openBlock(), createBlock(unref(_sfc_main$2), { key: 1 }))
|
|
335
|
+
]),
|
|
336
|
+
__props.loadingText !== void 0 ? (openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(__props.loadingText), 1)) : renderSlot(_ctx.$slots, "default", {}, void 0, void 0, 1),
|
|
337
|
+
renderSlot(_ctx.$slots, "trailing", {}, () => [
|
|
338
|
+
__props.trailingSlot !== void 0 ? (openBlock(), createBlock(unref(TrailingSlotProp), { key: 0 })) : createCommentVNode("", true)
|
|
323
339
|
])
|
|
324
|
-
])
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
340
|
+
], 64)) : loadingActive.value ? (openBlock(), createElementBlock("span", _hoisted_2, [
|
|
341
|
+
createElementVNode("span", _hoisted_3, [
|
|
342
|
+
renderSlot(_ctx.$slots, "default"),
|
|
343
|
+
renderSlot(_ctx.$slots, "trailing", {}, () => [
|
|
344
|
+
__props.trailingSlot !== void 0 ? (openBlock(), createBlock(unref(TrailingSlotProp), { key: 0 })) : createCommentVNode("", true)
|
|
345
|
+
])
|
|
346
|
+
]),
|
|
347
|
+
createElementVNode("span", _hoisted_4, [
|
|
348
|
+
renderSlot(_ctx.$slots, "loading", {}, () => [
|
|
349
|
+
__props.loadingSlot !== void 0 ? (openBlock(), createBlock(unref(LoadingSlotProp), { key: 0 })) : (openBlock(), createBlock(unref(_sfc_main$2), { key: 1 }))
|
|
350
|
+
])
|
|
351
|
+
])
|
|
352
|
+
])) : __props.hoverSlot !== void 0 || _ctx.$slots.hover ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
|
|
353
|
+
renderSlot(_ctx.$slots, "leading", {}, () => [
|
|
354
|
+
__props.leadingSlot !== void 0 ? (openBlock(), createBlock(unref(LeadingSlotProp), { key: 0 })) : createCommentVNode("", true)
|
|
355
|
+
]),
|
|
356
|
+
createElementVNode("span", _hoisted_5, [
|
|
357
|
+
createElementVNode("span", _hoisted_6, [
|
|
358
|
+
renderSlot(_ctx.$slots, "default")
|
|
359
|
+
]),
|
|
360
|
+
createElementVNode("span", _hoisted_7, [
|
|
361
|
+
renderSlot(_ctx.$slots, "hover", {}, () => [
|
|
362
|
+
__props.hoverSlot !== void 0 ? (openBlock(), createBlock(unref(HoverSlotProp), { key: 0 })) : createCommentVNode("", true)
|
|
363
|
+
])
|
|
364
|
+
])
|
|
365
|
+
]),
|
|
366
|
+
renderSlot(_ctx.$slots, "trailing", {}, () => [
|
|
367
|
+
__props.trailingSlot !== void 0 ? (openBlock(), createBlock(unref(TrailingSlotProp), { key: 0 })) : createCommentVNode("", true)
|
|
368
|
+
])
|
|
369
|
+
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 5 }, [
|
|
370
|
+
renderSlot(_ctx.$slots, "leading", {}, () => [
|
|
371
|
+
__props.leadingSlot !== void 0 ? (openBlock(), createBlock(unref(LeadingSlotProp), { key: 0 })) : createCommentVNode("", true)
|
|
372
|
+
]),
|
|
373
|
+
renderSlot(_ctx.$slots, "default"),
|
|
374
|
+
renderSlot(_ctx.$slots, "trailing", {}, () => [
|
|
375
|
+
__props.trailingSlot !== void 0 ? (openBlock(), createBlock(unref(TrailingSlotProp), { key: 0 })) : createCommentVNode("", true)
|
|
376
|
+
])
|
|
377
|
+
], 64)),
|
|
378
|
+
unavailableReason.value !== void 0 ? (openBlock(), createElementBlock("span", {
|
|
379
|
+
key: 6,
|
|
380
|
+
id: unref(descriptionId),
|
|
381
|
+
hidden: ""
|
|
382
|
+
}, toDisplayString(unavailableReason.value), 9, _hoisted_8)) : createCommentVNode("", true)
|
|
332
383
|
]),
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
__props.trailingSlot !== void 0 ? (openBlock(), createBlock(unref(TrailingSlotProp), { key: 0 })) : createCommentVNode("", true)
|
|
336
|
-
])
|
|
337
|
-
], 64))
|
|
384
|
+
_: 3
|
|
385
|
+
}, 16, ["as", "as-child"])
|
|
338
386
|
]),
|
|
339
387
|
_: 3
|
|
340
|
-
}, 16
|
|
388
|
+
}, 16);
|
|
341
389
|
};
|
|
342
390
|
}
|
|
343
391
|
});
|