@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.vue.js","sources":["../../../../src/presentation/actions/button/Button.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ButtonHTMLAttributes, VNodeChild } from 'vue';\nimport type {\n ColorProp,\n ColorTone,\n PaddingProp,\n RadiusProp,\n SizePreset,\n SizeUnion,\n SizeValue,\n} from '../../../foundation/styles';\nimport type { ButtonVariant, ButtonShape, ButtonVariants } from './Button.variants';\n\n/* Named size presets for variant lookup. Any other string / number / object flows to box-overrides. */\ntype ButtonSizePreset = Extract<SizePreset, 'xs' | 'sm' | 'md' | 'lg' | 'xl'>;\n\n/* `size`: preset (variant class) | number/string (square inline dims) | `{width,height,minWidth,minHeight,boxSize}`.\n Raw/object forms set inline dims only — pair with `padding` if text-bearing. */\nexport type ButtonSize = SizeUnion<ButtonSizePreset>;\n\n/** @internal The type-only surface `ButtonProps` inherits — native attributes plus the variant keys. `onClick` stays\n typed so `@click` compiles under strict templates; the button still gates it at runtime (see `handleClick`). */\ntype ButtonAttributes = Omit<ButtonHTMLAttributes, 'type' | 'disabled' | 'color'> &\n Omit<ButtonVariants, 'size' | 'variant' | 'tone' | 'shape'>;\n\n/** Defines props for the button. */\nexport interface ButtonProps extends /* @vue-ignore */ ButtonAttributes {\n /** The visual surface style. */\n readonly variant?: ButtonVariant;\n\n /** The semantic tone palette. */\n readonly tone?: ColorTone;\n\n /** The button silhouette (default · square · circle). */\n readonly shape?: ButtonShape;\n\n /** The size — preset name OR raw value OR explicit dim object; see `ButtonSize` for details. */\n readonly size?: ButtonSize;\n\n /** The per-instance color override for `tone` — a string derives all slots, an object sets each. */\n readonly color?: ColorProp;\n\n /** The slot before children. Prefer the `leading` named slot. */\n readonly leadingSlot?: VNodeChild;\n\n /** The slot after children. Prefer the `trailing` named slot. */\n readonly trailingSlot?: VNodeChild;\n\n /** The content shown in place of children on hover / focus-visible (CSS-only swap — no JS hover state).\n Idle → children visible; hover/focus-visible → `hoverSlot` visible. Pairs with `variant=\"reveal\"`\n for a reveal-on-hover icon swap. When undefined (and no `hover` slot), children render normally. */\n readonly hoverSlot?: VNodeChild;\n\n /** The indicator replacing the built-in `<Spinner/>` while loading. Prefer the `loading` slot. */\n readonly loadingSlot?: VNodeChild;\n\n /** The action-loading state — a spinner replaces the leading icon, the label stays, it dims and blocks clicks. */\n readonly isLoading?: boolean;\n\n /** The text that replaces the label while loading; omit it to keep the label. Consumer-supplied (i18n). */\n readonly loadingText?: string;\n\n /** The content-loading state — keeps size and radius, masks content; follows a `DataRegion` first load. */\n readonly isSkeleton?: boolean;\n\n /** The disabled state — drops focus order and clicks. Inherited from an enclosing `Field`. */\n readonly isDisabled?: boolean;\n\n /** The full-width state — stretches to fill container width. */\n readonly isFullWidth?: boolean;\n\n /** The multi-line state — allows label wrap; default truncates to single line. */\n readonly isMultiline?: boolean;\n\n /** The as-child flag — renders as the single child element via `Primitive`'s `asChild` merge. */\n readonly asChild?: boolean;\n\n /** The independent padding override (preset token or `{x, y}` object). */\n readonly padding?: PaddingProp;\n\n /** The independent radius override (preset token or raw value). */\n readonly radius?: RadiusProp;\n\n /** The explicit width override. Number = px; string = any CSS unit. */\n readonly width?: SizeValue;\n\n /** The explicit height override. Number = px; string = any CSS unit. */\n readonly height?: SizeValue;\n\n /** The min width reserved so the button doesn't reflow when its label morphs. */\n readonly minWidth?: SizeValue;\n\n /** The min height reserved — symmetric with `minWidth`. */\n readonly minHeight?: SizeValue;\n\n /** The square-size shorthand — fallback for `width` and `height`, which win when both are set. */\n readonly boxSize?: SizeValue;\n\n /** The button type. Default `ButtonType.Button` — NOT browser-default `'submit'`. */\n readonly type?: ButtonType;\n\n /** The long-press duration (ms). Default 500. Out-of-range values trigger a dev warning. */\n readonly longPressDelay?: number;\n\n /** The click-throttle window (ms) — first wins; subsequent swallowed via `preventDefault()`. */\n readonly debounceMs?: number;\n}\n</script>\n\n<script setup lang=\"ts\">\nimport {\n computed,\n defineComponent,\n getCurrentInstance,\n normalizeStyle,\n onBeforeUnmount,\n useAttrs,\n useTemplateRef,\n watch,\n watchEffect,\n type ComponentPublicInstance,\n type StyleValue,\n} from 'vue';\nimport type { ClassValue } from 'clsx';\nimport {\n AriaAttribute,\n composeEventHandlers,\n ButtonType,\n HtmlElement,\n Key,\n PressExtensions,\n type PressEvent,\n} from '../../../foundation/dom';\nimport { cn, ColorExtensions, CssExtensions, type BoxSizeOverrides } from '../../../foundation/styles';\nimport { IsDevelopment } from '../../../foundation/config';\nimport { OptionalExtensions } from '../../../foundation/optionals';\nimport { Primitive } from '../../../foundation/primitives';\nimport { useFormControl } from '../../../foundation/primitives/formControlContext/FormControlContext';\nimport { Spinner } from '../../../foundation/icons';\nimport { useDebounceHandler } from '../../../foundation/async';\nimport { useSkeletonState } from '../../feedback/skeletonState/SkeletonStateContext';\nimport { buttonVariants } from './Button.variants';\n\nconst ComponentName = 'Button';\n\nconst ButtonSizePresets: ReadonlySet<string> = new Set<ButtonSizePreset>(['xs', 'sm', 'md', 'lg', 'xl']);\n\n/* Observable state surfaced via the `data-state` DOM attribute. */\nconst ButtonDataState = {\n Loading: 'loading',\n Skeleton: 'skeleton',\n Disabled: 'disabled',\n} as const;\ntype ButtonDataState = (typeof ButtonDataState)[keyof typeof ButtonDataState];\n\n/* `inheritAttrs: false` because three attrs are *owned*, not forwarded: `class` and `style` fold\n into the component's own `cn()` / style resolution so consumer values still win last (plain\n fallthrough would append outside `cn()`, losing tailwind-merge conflict resolution), and\n `onClick` is intercepted so loading / skeleton / long-press / the debounce window can swallow a\n click before the consumer's handler sees it. Everything else passes straight through. */\n/* The name is spelled out, not `ComponentName`: `defineOptions()` is hoisted out of `setup()`,\n so it cannot reference a locally declared const. */\n/** Renders a button that runs one command, carrying tone and size variants plus loading and skeleton states. */\ndefineOptions({ name: 'Button', inheritAttrs: false });\n\nconst props = withDefaults(defineProps<ButtonProps>(), {\n type: ButtonType.Button,\n longPressDelay: PressExtensions.longPressDelay.default,\n /* Explicit `undefined` defaults keep Vue's boolean casting from turning an absent prop into\n `false` — `isDisabled` must stay undefined to inherit from an enclosing `Field`. */\n isDisabled: undefined,\n isLoading: undefined,\n isSkeleton: undefined,\n isFullWidth: undefined,\n isMultiline: undefined,\n asChild: false,\n /* `VNodeChild` includes `boolean`, so Vue's boolean casting turns an absent node-valued prop\n into `false` rather than `undefined` — which reads as \"supplied\" at every `!== undefined`\n check. An explicit `undefined` default suppresses the cast. */\n leadingSlot: undefined,\n trailingSlot: undefined,\n hoverSlot: undefined,\n loadingSlot: undefined,\n});\n\nconst emit = defineEmits<{\n /** Fires when the press begins — pointer-down OR Space/Enter keydown (first event in a gesture). */\n 'press-start': [event: PressEvent<HTMLButtonElement>];\n\n /** Fires when the press ends — pointer-up/cancel OR Space/Enter keyup. */\n 'press-end': [event: PressEvent<HTMLButtonElement>];\n\n /** Fires when the pointer is held for `longPressDelay` ms. Suppresses the next click. */\n 'long-press': [event: PressEvent<HTMLButtonElement>];\n}>();\n\nconst slots = defineSlots<{\n /** The button's own label. Under `asChild`, the single element the button merges onto. */\n default?(): unknown;\n\n /** The indicator shown while loading. Falls back to `loadingSlot`, then to the built-in `Spinner`. */\n loading?(): unknown;\n\n /** Rendered before the label, for an icon. Falls back to `leadingSlot`. */\n leading?(): unknown;\n\n /** Rendered after the label, for an icon. Falls back to `trailingSlot`. */\n trailing?(): unknown;\n\n /** The content swapped in on hover / focus-visible, overlaying the label. Falls back to `hoverSlot`. */\n hover?(): unknown;\n}>();\n\nconst attrs = useAttrs();\n\n/* Stable render-only wrappers for the node-valued props, so each can render as the fallback of its\n named-slot twin. Stable identity (created once) keeps them from remounting on every render. */\nconst nodeProp = (read: () => VNodeChild) => defineComponent({ render: read });\nconst LeadingSlotProp = nodeProp(() => props.leadingSlot);\nconst TrailingSlotProp = nodeProp(() => props.trailingSlot);\nconst HoverSlotProp = nodeProp(() => props.hoverSlot);\nconst LoadingSlotProp = nodeProp(() => props.loadingSlot);\n\n/* Inherit disabled-state from an enclosing `Field` when the local prop is omitted; standalone when\n no context. Bound to the object, never destructured — every field on it is a live getter. */\nconst formControl = useFormControl();\nconst resolvedDisabled = computed(() => props.isDisabled ?? formControl?.isDisabled ?? false);\n\n/* An absent `isSkeleton` follows the nearest `DataRegion` first load; an explicit one wins either way. */\nconst skeleton = useSkeletonState(() => props.isSkeleton);\nconst skeletonActive = computed(() => skeleton.isSkeleton.value);\nconst loadingActive = computed(() => !skeletonActive.value && !!props.isLoading);\nconst isInactive = computed(() => loadingActive.value || skeletonActive.value || resolvedDisabled.value);\n\n/* The spinner swaps with a leading icon when there is one; without one it centers over the label, whose\n box keeps the button's width. */\nfunction hasLeading(): boolean {\n return slots.leading !== undefined || props.leadingSlot !== undefined;\n}\n\nconst dataState = computed<ButtonDataState | undefined>(() =>\n skeletonActive.value\n ? ButtonDataState.Skeleton\n : loadingActive.value\n ? ButtonDataState.Loading\n : resolvedDisabled.value\n ? ButtonDataState.Disabled\n : undefined,\n);\n\nconst safeLongPressDelay = computed(() =>\n !Number.isFinite(props.longPressDelay) ||\n props.longPressDelay < PressExtensions.longPressDelay.min ||\n props.longPressDelay > PressExtensions.longPressDelay.max\n ? PressExtensions.longPressDelay.default\n : props.longPressDelay,\n);\n\nwatchEffect(() => {\n if (!IsDevelopment) return;\n if (props.isLoading && props.isSkeleton) {\n console.warn(\n `[${ComponentName}] \\`isLoading\\` and \\`isSkeleton\\` are mutually exclusive — \\`isSkeleton\\` takes precedence.`,\n );\n }\n if (safeLongPressDelay.value !== props.longPressDelay) {\n console.warn(\n `[${ComponentName}] longPressDelay=${props.longPressDelay}ms is outside reasonable range (${PressExtensions.longPressDelay.min}–${PressExtensions.longPressDelay.max}ms). Falling back to ${PressExtensions.longPressDelay.default}ms.`,\n );\n }\n if (\n slots.default === undefined &&\n attrs[AriaAttribute.Label] === undefined &&\n attrs[AriaAttribute.LabelledBy] === undefined\n ) {\n console.warn(\n `[${ComponentName}] icon-only button (no text children) is missing an accessible name — pass \\`aria-label\\` or \\`aria-labelledby\\` (Button.standard.md rule 12).`,\n );\n }\n});\n\n/* Parse the union-typed `size` prop into preset (for variant lookup) + box overrides (for inline dims). */\nconst parsedSize = computed(() => CssExtensions.parseSizeUnion<ButtonSizePreset>(props.size, ButtonSizePresets));\n\nconst rootClass = computed(() =>\n cn(\n buttonVariants({\n variant: props.variant,\n tone: props.tone,\n size: parsedSize.value.preset,\n shape: props.shape,\n fullWidth: props.isFullWidth,\n wrap: props.isMultiline,\n }),\n attrs.class as ClassValue,\n ),\n);\n\nconst overrideStyle = computed<StyleValue | undefined>(() => {\n const padStyle = CssExtensions.resolvePadding(props.padding);\n const radStyle = CssExtensions.resolveRadius(props.radius);\n /* BoxLayout overrides — `size` is the base; flat width / height / minWidth / minHeight / boxSize win. */\n const composedBox: BoxSizeOverrides = {\n ...(parsedSize.value.box ?? {}),\n ...(props.width !== undefined ? { width: props.width } : {}),\n ...(props.height !== undefined ? { height: props.height } : {}),\n ...(props.minWidth !== undefined ? { minWidth: props.minWidth } : {}),\n ...(props.minHeight !== undefined ? { minHeight: props.minHeight } : {}),\n ...(props.boxSize !== undefined ? { boxSize: props.boxSize } : {}),\n };\n const boxStyle = CssExtensions.resolveBoxSize(composedBox);\n /* Per-instance color override → sets CSS vars on element, scoped locally. */\n const colorStyle = ColorExtensions.toneColorOverride(props.color, props.tone);\n const consumerStyle = attrs.style as StyleValue | undefined;\n if (!padStyle && !radStyle && !boxStyle && !colorStyle && !consumerStyle) return undefined;\n return normalizeStyle([colorStyle, padStyle, radStyle, boxStyle, consumerStyle]);\n});\n\n// ---------------------------------------------------------------------------\n// Press / long-press / debounce wiring.\n// ---------------------------------------------------------------------------\n\nlet isPressing = false;\nlet longPressTimer: ReturnType<typeof setTimeout> | undefined;\nlet longPressFired = false;\n\nconst instance = getCurrentInstance();\n\n/* React armed the long-press timer only when an `onLongPress` prop was passed. A declared emit has\n no such signal — `emit()` on an unlistened event is a silent no-op, but the fired flag would\n still swallow the following click on every long hold. The listener is read off the incoming\n vnode props at event time (declared-emit listeners are stripped from `attrs`), so an unlistened\n button never arms the timer at all. */\nfunction hasLongPressListener(): boolean {\n return instance?.vnode.props?.onLongPress !== undefined;\n}\n\nonBeforeUnmount(() => {\n if (longPressTimer !== undefined) clearTimeout(longPressTimer);\n});\n\nfunction cancelLongPress(): void {\n if (longPressTimer !== undefined) {\n clearTimeout(longPressTimer);\n longPressTimer = undefined;\n }\n}\n\nwatch(isInactive, (inactive) => {\n if (!inactive) return;\n cancelLongPress();\n isPressing = false;\n longPressFired = false;\n});\n\nfunction endPress(event: PressEvent<HTMLButtonElement>): void {\n if (isPressing) {\n isPressing = false;\n emit('press-end', event);\n }\n}\n\nfunction handlePointerDown(event: PointerEvent): void {\n if (isInactive.value || event.defaultPrevented || (event.button != null && event.button !== 0)) return;\n // Cancel any pending timer, then arm only on the first pointer of a gesture — a second\n // pointer-down must not stack a second long-press timer.\n cancelLongPress();\n if (!isPressing) {\n const pressEvent = event as PressEvent<HTMLButtonElement>;\n isPressing = true;\n longPressFired = false;\n emit('press-start', pressEvent);\n if (hasLongPressListener()) {\n longPressTimer = setTimeout(() => {\n if (isInactive.value) return;\n longPressFired = true;\n emit('long-press', pressEvent);\n longPressTimer = undefined;\n }, safeLongPressDelay.value);\n }\n }\n}\n\nfunction handlePointerUp(event: PointerEvent): void {\n cancelLongPress();\n endPress(event as PressEvent<HTMLButtonElement>);\n}\n\nfunction handlePointerCancel(event: PointerEvent): void {\n cancelLongPress();\n endPress(event as PressEvent<HTMLButtonElement>);\n}\n\nfunction handlePointerLeave(event: PointerEvent): void {\n // The subsequent pointerup may target elsewhere; release this gesture at its boundary.\n cancelLongPress();\n endPress(event as PressEvent<HTMLButtonElement>);\n}\n\nconst isActivationKey = (event: KeyboardEvent) => event.key === Key.Space || event.key === Key.Enter;\n\nfunction handleKeyDown(event: KeyboardEvent): void {\n if (isInactive.value || event.defaultPrevented || event.isComposing) return;\n if (isActivationKey(event) && !event.repeat && !isPressing) {\n isPressing = true;\n longPressFired = false;\n emit('press-start', event as PressEvent<HTMLButtonElement>);\n }\n}\n\nfunction handleKeyUp(event: KeyboardEvent): void {\n if (isActivationKey(event) && isPressing) {\n isPressing = false;\n emit('press-end', event as PressEvent<HTMLButtonElement>);\n }\n}\n\n/**\n * The consumer's listener for one attr, normalised. Vue merges several listeners for the same\n * event into an array (a wrapper component that binds `@click` on top of a forwarded `onClick`\n * produces exactly that), so the raw attr is not always callable.\n */\nfunction toHandler<E extends Event>(value: unknown): ((event: E) => void) | undefined {\n if (typeof value === 'function') return value as (event: E) => void;\n if (!Array.isArray(value)) return undefined;\n const handlers = value.filter((entry): entry is (event: E) => void => typeof entry === 'function');\n if (handlers.length === 0) return undefined;\n return (event) => {\n for (const handler of handlers) handler(event);\n };\n}\n\n// Long-press suppression happens BEFORE this — a suppressed click does NOT advance the throttle window.\nconst debouncedOnClick = useDebounceHandler(\n (event: MouseEvent) => toHandler<MouseEvent>(attrs.onClick)?.(event),\n () => props.debounceMs,\n);\n\nfunction handleClick(event: MouseEvent): void {\n if (event.defaultPrevented) return;\n if (isInactive.value) {\n // Block native activation too — e.g. `type=\"submit\"` must not submit while loading.\n event.preventDefault();\n return;\n }\n if (longPressFired) {\n longPressFired = false;\n event.preventDefault();\n return;\n }\n debouncedOnClick(event);\n}\n\n/* The attrs the component owns rather than forwards — see the `inheritAttrs: false` note above.\n Event names carry the single casing Vue's runtime understands (`on` + the event name with only\n its first letter capitalised); `onPointerDown` would bind a `pointer-down` listener. */\nconst OwnedAttributes: ReadonlySet<string> = new Set([\n 'class',\n 'style',\n 'onClick',\n 'onPointerdown',\n 'onPointerup',\n 'onPointercancel',\n 'onPointerleave',\n 'onKeydown',\n 'onKeyup',\n]);\n\nconst passthroughAttrs = computed(() =>\n Object.fromEntries(Object.entries(attrs).filter(([key]) => !OwnedAttributes.has(key))),\n);\n\n/** The consumer's own listener for an owned event, so it can be chained ahead of the component's. */\nfunction consumerHandler<E extends Event>(name: string): ((event: E) => void) | undefined {\n return toHandler<E>(attrs[name]);\n}\n\n/* Assembled in the React original's spread order: the component's own attributes first, its event\n chain next, consumer attrs last so they still win. */\nconst rootProps = computed(() => ({\n type: props.asChild ? undefined : props.type,\n class: rootClass.value,\n style: overrideStyle.value,\n disabled: OptionalExtensions.from(resolvedDisabled.value, true),\n [AriaAttribute.Busy]: OptionalExtensions.from(loadingActive.value || skeletonActive.value, true),\n [AriaAttribute.Disabled]: OptionalExtensions.from(isInactive.value, true),\n tabindex: OptionalExtensions.from(skeletonActive.value || resolvedDisabled.value, -1),\n 'data-state': dataState.value,\n onClick: handleClick,\n onPointerdown: composeEventHandlers(consumerHandler<PointerEvent>('onPointerdown'), handlePointerDown),\n onPointerup: composeEventHandlers(consumerHandler<PointerEvent>('onPointerup'), handlePointerUp),\n onPointercancel: composeEventHandlers(consumerHandler<PointerEvent>('onPointercancel'), handlePointerCancel),\n onPointerleave: composeEventHandlers(consumerHandler<PointerEvent>('onPointerleave'), handlePointerLeave),\n onKeydown: composeEventHandlers(consumerHandler<KeyboardEvent>('onKeydown'), handleKeyDown),\n onKeyup: composeEventHandlers(consumerHandler<KeyboardEvent>('onKeyup'), handleKeyUp),\n ...passthroughAttrs.value,\n}));\n\nconst root = useTemplateRef<ComponentPublicInstance>('root');\n\n/** The rendered element — the Vue stand-in for the React original's forwarded ref. */\nconst el = computed<HTMLElement | null>(() => {\n const node = root.value?.$el;\n return node instanceof HTMLElement ? node : null;\n});\n\ndefineExpose({ el });\n</script>\n\n<template>\n <!-- Renders an action button — for text and/or icon content. -->\n <Primitive ref=\"root\" :as=\"HtmlElement.Button\" :as-child=\"asChild\" v-bind=\"rootProps\">\n <!-- asChild → the merge target owns its children; leading/trailing/loading chrome is not rendered. -->\n <slot v-if=\"asChild\" />\n\n <template v-else-if=\"loadingActive && (hasLeading() || loadingText !== undefined)\">\n <!-- The spinner stands where the leading icon was; the label (or loadingText) stays readable. -->\n <slot name=\"loading\">\n <LoadingSlotProp v-if=\"loadingSlot !== undefined\" />\n <Spinner v-else />\n </slot>\n <span v-if=\"loadingText !== undefined\">{{ loadingText }}</span>\n <slot v-else />\n <slot name=\"trailing\"><TrailingSlotProp v-if=\"trailingSlot !== undefined\" /></slot>\n </template>\n\n <template v-else-if=\"loadingActive\">\n <!-- No icon to swap: the label turns transparent, keeping the width and the accessible name, and the\n spinner centers over it. -->\n <span class=\"relative inline-flex items-center justify-center\">\n <span class=\"inline-flex items-center gap-2 opacity-0\">\n <slot />\n <slot name=\"trailing\"><TrailingSlotProp v-if=\"trailingSlot !== undefined\" /></slot>\n </span>\n <span class=\"absolute inset-0 inline-flex items-center justify-center\">\n <slot name=\"loading\">\n <LoadingSlotProp v-if=\"loadingSlot !== undefined\" />\n <Spinner v-else />\n </slot>\n </span>\n </span>\n </template>\n\n <template v-else-if=\"hoverSlot !== undefined || $slots.hover\">\n <slot name=\"leading\"><LeadingSlotProp v-if=\"leadingSlot !== undefined\" /></slot>\n <!-- CSS-only hover/focus-visible swap: children occupy the box and reserve its size;\n the hover content overlays it centered. Toggle via `group-hover`/`group-focus-visible`\n on the root `group` — no JS hover state. `aria-hidden` on the hidden layer so AT\n reads one label. -->\n <span class=\"relative inline-flex items-center justify-center\">\n <span class=\"inline-flex items-center justify-center group-hover:invisible group-focus-visible:invisible\">\n <slot />\n </span>\n <span\n aria-hidden=\"true\"\n class=\"invisible absolute inset-0 inline-flex items-center justify-center group-hover:visible group-focus-visible:visible\"\n >\n <slot name=\"hover\"><HoverSlotProp v-if=\"hoverSlot !== undefined\" /></slot>\n </span>\n </span>\n <slot name=\"trailing\"><TrailingSlotProp v-if=\"trailingSlot !== undefined\" /></slot>\n </template>\n\n <template v-else>\n <slot name=\"leading\"><LeadingSlotProp v-if=\"leadingSlot !== undefined\" /></slot>\n <slot />\n <slot name=\"trailing\"><TrailingSlotProp v-if=\"trailingSlot !== undefined\" /></slot>\n </template>\n </Primitive>\n</template>\n"],"names":["_useSlots","_openBlock","_createBlock","_unref","_mergeProps","_renderSlot","_createElementBlock","_Fragment","Spinner","_createElementVNode","$slots"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+IA,UAAM,gBAAgB;AAEtB,UAAM,wCAA6C,IAAsB,CAAC,MAAM,MAAM,MAAM,MAAM,IAAI,CAAC;AAGvG,UAAM,kBAAkB;AAAA,MACtB,SAAS;AAAA,MACT,UAAU;AAAA,MACV,UAAU;AAAA,IAAA;AAcZ,UAAM,QAAQ;AAoBd,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,gBAFkB,QAAA,gBAAgB,uBAAvCH,YAAoDC,MAAA,eAAA,GAAA,EAAA,KAAA,GAAA,mBACpDD,YAAkBC,MAAAK,WAAA,GAAA,EAAA,KAAA,GAAA;AAAA,cAAA;;gBAML,QAAA,cAAc,UAAaE,KAAAA,OAAO,sBAAvDJ,mBAkBWC,UAAA,EAAA,KAAA,KAAA;AAAA,YAjBTF,WAAgF,4BAAhF,MAAgF;AAAA,cAApC,QAAA,gBAAgB,uBAAvCH,YAAoDC,MAAA,eAAA,GAAA,EAAA,KAAA,EAAA,CAAA;;YAKzEM,mBAUO,QAVP,YAUO;AAAA,cATLA,mBAEO,QAFP,YAEO;AAAA,gBADLJ,WAAQ,KAAA,QAAA,SAAA;AAAA,cAAA;cAEVI,mBAKO,QALP,YAKO;AAAA,gBADLJ,WAA0E,0BAA1E,MAA0E;AAAA,kBAAlC,QAAA,cAAc,uBAAnCH,YAAgDC,MAAA,aAAA,GAAA,EAAA,KAAA,EAAA,CAAA;;;;YAGvEE,WAAmF,6BAAnF,MAAmF;AAAA,cAArC,QAAA,iBAAiB,uBAAzCH,YAAsDC,MAAA,gBAAA,GAAA,EAAA,KAAA,EAAA,CAAA;;kCAG9EG,mBAIWC,UAAA,EAAA,KAAA,KAAA;AAAA,YAHTF,WAAgF,4BAAhF,MAAgF;AAAA,cAApC,QAAA,gBAAgB,uBAAvCH,YAAoDC,MAAA,eAAA,GAAA,EAAA,KAAA,EAAA,CAAA;;YACzEE,WAAQ,KAAA,QAAA,SAAA;AAAA,YACRA,WAAmF,6BAAnF,MAAmF;AAAA,cAArC,QAAA,iBAAiB,uBAAzCH,YAAsDC,MAAA,gBAAA,GAAA,EAAA,KAAA,EAAA,CAAA;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"Button.vue.js","sources":["../../../../src/presentation/actions/button/Button.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ButtonHTMLAttributes, VNodeChild } from 'vue';\nimport type {\n ColorProp,\n ColorTone,\n PaddingProp,\n RadiusProp,\n SizePreset,\n SizeUnion,\n SizeValue,\n} from '../../../foundation/styles';\nimport type { ButtonVariant, ButtonShape, ButtonVariants } from './Button.variants';\n\n/* Named size presets for variant lookup. Any other string / number / object flows to box-overrides. */\ntype ButtonSizePreset = Extract<SizePreset, 'xs' | 'sm' | 'md' | 'lg' | 'xl'>;\n\n/* `size`: preset (variant class) | number/string (square inline dims) | `{width,height,minWidth,minHeight,boxSize}`.\n Raw/object forms set inline dims only — pair with `padding` if text-bearing. */\nexport type ButtonSize = SizeUnion<ButtonSizePreset>;\n\n/** @internal The type-only surface `ButtonProps` inherits — native attributes plus the variant keys. `onClick` stays\n typed so `@click` compiles under strict templates; the button still gates it at runtime (see `handleClick`). */\ntype ButtonAttributes = Omit<ButtonHTMLAttributes, 'type' | 'disabled' | 'color'> &\n Omit<ButtonVariants, 'size' | 'variant' | 'tone' | 'shape' | 'unavailable'>;\n\n/** Defines props for the button. */\nexport interface ButtonProps extends /* @vue-ignore */ ButtonAttributes {\n /** The visual surface style. */\n readonly variant?: ButtonVariant;\n\n /** The semantic tone palette. */\n readonly tone?: ColorTone;\n\n /** The button silhouette (default · square · circle). */\n readonly shape?: ButtonShape;\n\n /** The size — preset name OR raw value OR explicit dim object; see `ButtonSize` for details. */\n readonly size?: ButtonSize;\n\n /** The per-instance color override for `tone` — a string derives all slots, an object sets each. */\n readonly color?: ColorProp;\n\n /** The slot before children. Prefer the `leading` named slot. */\n readonly leadingSlot?: VNodeChild;\n\n /** The slot after children. Prefer the `trailing` named slot. */\n readonly trailingSlot?: VNodeChild;\n\n /** The content shown in place of children on hover / focus-visible (CSS-only swap — no JS hover state).\n Idle → children visible; hover/focus-visible → `hoverSlot` visible. Pairs with `variant=\"reveal\"`\n for a reveal-on-hover icon swap. When undefined (and no `hover` slot), children render normally. */\n readonly hoverSlot?: VNodeChild;\n\n /** The indicator replacing the built-in `<Spinner/>` while loading. Prefer the `loading` slot. */\n readonly loadingSlot?: VNodeChild;\n\n /** The action-loading state — a spinner replaces the leading icon, the label stays, it dims and blocks clicks. */\n readonly isLoading?: boolean;\n\n /** The text that replaces the label while loading; omit it to keep the label. Consumer-supplied (i18n). */\n readonly loadingText?: string;\n\n /** The content-loading state — keeps size and radius, masks content; follows a `DataRegion` first load. */\n readonly isSkeleton?: boolean;\n\n /** The disabled state — drops focus order and clicks. Inherited from an enclosing `Field`. */\n readonly isDisabled?: boolean;\n\n /** The unavailable state — keeps its tab stop with `aria-disabled`, swallows presses, and draws a dashed, dimmed\n box; `circle` and `square` shapes add a slash over the icon. Disabled, loading and skeleton states win. */\n readonly isUnavailable?: boolean;\n\n /** The reason shown through `Tooltip` and set as the accessible description while unavailable. Consumer-supplied\n (i18n). Defining it mounts the tooltip wrapper, so keep it defined while `isUnavailable` toggles. */\n readonly unavailableLabel?: string;\n\n /** The full-width state — stretches to fill container width. */\n readonly isFullWidth?: boolean;\n\n /** The multi-line state — allows label wrap; default truncates to single line. */\n readonly isMultiline?: boolean;\n\n /** The as-child flag — renders as the single child element via `Primitive`'s `asChild` merge. */\n readonly asChild?: boolean;\n\n /** The independent padding override (preset token or `{x, y}` object). */\n readonly padding?: PaddingProp;\n\n /** The independent radius override (preset token or raw value). */\n readonly radius?: RadiusProp;\n\n /** The explicit width override. Number = px; string = any CSS unit. */\n readonly width?: SizeValue;\n\n /** The explicit height override. Number = px; string = any CSS unit. */\n readonly height?: SizeValue;\n\n /** The min width reserved so the button doesn't reflow when its label morphs. */\n readonly minWidth?: SizeValue;\n\n /** The min height reserved — symmetric with `minWidth`. */\n readonly minHeight?: SizeValue;\n\n /** The square-size shorthand — fallback for `width` and `height`, which win when both are set. */\n readonly boxSize?: SizeValue;\n\n /** The button type. Default `ButtonType.Button` — NOT browser-default `'submit'`. */\n readonly type?: ButtonType;\n\n /** The long-press duration (ms). Default 500. Out-of-range values trigger a dev warning. */\n readonly longPressDelay?: number;\n\n /** The click-throttle window (ms) — first wins; subsequent swallowed via `preventDefault()`. */\n readonly debounceMs?: number;\n}\n</script>\n\n<script setup lang=\"ts\">\nimport {\n computed,\n defineComponent,\n getCurrentInstance,\n normalizeStyle,\n onBeforeUnmount,\n shallowRef,\n useAttrs,\n useTemplateRef,\n watch,\n watchEffect,\n type ComponentPublicInstance,\n type FunctionalComponent,\n type StyleValue,\n} from 'vue';\nimport type { ClassValue } from 'clsx';\nimport {\n AriaAttribute,\n composeEventHandlers,\n ButtonType,\n HtmlElement,\n Key,\n PressExtensions,\n type PressEvent,\n} from '../../../foundation/dom';\nimport { cn, ColorExtensions, CssExtensions, type BoxSizeOverrides } from '../../../foundation/styles';\nimport { IsDevelopment } from '../../../foundation/config';\nimport { OptionalExtensions } from '../../../foundation/optionals';\nimport { Primitive, Slottable, renderableChildren } from '../../../foundation/primitives';\nimport { useFormControl } from '../../../foundation/primitives/formControlContext/FormControlContext';\nimport { Spinner } from '../../../foundation/icons';\nimport { useDebounceHandler } from '../../../foundation/async';\nimport { useId } from '../../../foundation/identifiers';\nimport { useSkeletonState } from '../../feedback/skeletonState/SkeletonStateContext';\nimport Tooltip from '../../overlays/tooltip/Tooltip.vue';\nimport { buttonVariants } from './Button.variants';\n\nconst ComponentName = 'Button';\n\nconst ButtonSizePresets: ReadonlySet<string> = new Set<ButtonSizePreset>(['xs', 'sm', 'md', 'lg', 'xl']);\n\n/* Observable state surfaced via the `data-state` DOM attribute. */\nconst ButtonDataState = {\n Loading: 'loading',\n Skeleton: 'skeleton',\n Disabled: 'disabled',\n Unavailable: 'unavailable',\n} as const;\ntype ButtonDataState = (typeof ButtonDataState)[keyof typeof ButtonDataState];\n\n/* `inheritAttrs: false` because three attrs are *owned*, not forwarded: `class` and `style` fold\n into the component's own `cn()` / style resolution so consumer values still win last (plain\n fallthrough would append outside `cn()`, losing tailwind-merge conflict resolution), and\n `onClick` is intercepted so loading / skeleton / long-press / the debounce window can swallow a\n click before the consumer's handler sees it. Everything else passes straight through. */\n/* The name is spelled out, not `ComponentName`: `defineOptions()` is hoisted out of `setup()`,\n so it cannot reference a locally declared const. */\n/** Renders a button that runs one command, carrying tone and size variants plus loading and skeleton states. */\ndefineOptions({ name: 'Button', inheritAttrs: false });\n\nconst props = withDefaults(defineProps<ButtonProps>(), {\n type: ButtonType.Button,\n longPressDelay: PressExtensions.longPressDelay.default,\n /* Explicit `undefined` defaults keep Vue's boolean casting from turning an absent prop into\n `false` — `isDisabled` must stay undefined to inherit from an enclosing `Field`. */\n isDisabled: undefined,\n isUnavailable: undefined,\n isLoading: undefined,\n isSkeleton: undefined,\n isFullWidth: undefined,\n isMultiline: undefined,\n asChild: false,\n /* `VNodeChild` includes `boolean`, so Vue's boolean casting turns an absent node-valued prop\n into `false` rather than `undefined` — which reads as \"supplied\" at every `!== undefined`\n check. An explicit `undefined` default suppresses the cast. */\n leadingSlot: undefined,\n trailingSlot: undefined,\n hoverSlot: undefined,\n loadingSlot: undefined,\n});\n\nconst emit = defineEmits<{\n /** Fires when the press begins — pointer-down OR Space/Enter keydown (first event in a gesture). */\n 'press-start': [event: PressEvent<HTMLButtonElement>];\n\n /** Fires when the press ends — pointer-up/cancel OR Space/Enter keyup. */\n 'press-end': [event: PressEvent<HTMLButtonElement>];\n\n /** Fires when the pointer is held for `longPressDelay` ms. Suppresses the next click. */\n 'long-press': [event: PressEvent<HTMLButtonElement>];\n}>();\n\nconst slots = defineSlots<{\n /** The button's own label. Under `asChild`, the single element the button merges onto. */\n default?(): unknown;\n\n /** The indicator shown while loading. Falls back to `loadingSlot`, then to the built-in `Spinner`. */\n loading?(): unknown;\n\n /** Rendered before the label, for an icon. Falls back to `leadingSlot`. */\n leading?(): unknown;\n\n /** Rendered after the label, for an icon. Falls back to `trailingSlot`. */\n trailing?(): unknown;\n\n /** The content swapped in on hover / focus-visible, overlaying the label. Falls back to `hoverSlot`. */\n hover?(): unknown;\n}>();\n\nconst attrs = useAttrs();\n\n/* Stable render-only wrappers for the node-valued props, so each can render as the fallback of its\n named-slot twin. Stable identity (created once) keeps them from remounting on every render. */\nconst nodeProp = (read: () => VNodeChild) => defineComponent({ render: read });\nconst LeadingSlotProp = nodeProp(() => props.leadingSlot);\nconst TrailingSlotProp = nodeProp(() => props.trailingSlot);\nconst HoverSlotProp = nodeProp(() => props.hoverSlot);\nconst LoadingSlotProp = nodeProp(() => props.loadingSlot);\n\n/* Inherit disabled-state from an enclosing `Field` when the local prop is omitted; standalone when\n no context. Bound to the object, never destructured — every field on it is a live getter. */\nconst formControl = useFormControl();\nconst resolvedDisabled = computed(() => props.isDisabled ?? formControl?.isDisabled ?? false);\n\n/* An absent `isSkeleton` follows the nearest `DataRegion` first load; an explicit one wins either way. */\nconst skeleton = useSkeletonState(() => props.isSkeleton);\nconst skeletonActive = computed(() => skeleton.isSkeleton.value);\nconst loadingActive = computed(() => !skeletonActive.value && !!props.isLoading);\n/* Unavailable joins the inactive set — `aria-disabled` arms `Primitive`'s activation guard, which also stops a link\n from navigating — but, unlike disabled, keeps the tab stop so the reason stays reachable. */\nconst isInactive = computed(\n () => loadingActive.value || skeletonActive.value || resolvedDisabled.value || !!props.isUnavailable,\n);\n\n/* The spinner swaps with a leading icon when there is one; without one it centers over the label, whose\n box keeps the button's width. */\nfunction hasLeading(): boolean {\n return slots.leading !== undefined || props.leadingSlot !== undefined;\n}\n\nconst dataState = computed<ButtonDataState | undefined>(() =>\n skeletonActive.value\n ? ButtonDataState.Skeleton\n : loadingActive.value\n ? ButtonDataState.Loading\n : resolvedDisabled.value\n ? ButtonDataState.Disabled\n : props.isUnavailable\n ? ButtonDataState.Unavailable\n : undefined,\n);\n\nconst unavailableShown = computed(() => dataState.value === ButtonDataState.Unavailable);\n\n/* The reason reaches the tooltip and the description only while the unavailable state is the one shown. */\nconst unavailableReason = computed(() =>\n unavailableShown.value && props.unavailableLabel ? props.unavailableLabel : undefined,\n);\n\n/* The hidden copy of the reason, referenced by `aria-describedby` so the description holds without hovering. */\nconst descriptionId = useId('unavailable');\n\n/* An open `Tooltip` adds its own id to `aria-describedby`; the hidden copy steps out meanwhile, so the reason is\n described once. */\nconst tooltipOpen = shallowRef(false);\n\n/* The wrapper while no `unavailableLabel` asks for a `Tooltip`: it renders its single child as is, so the button\n keeps one template and its element root. */\nconst PassThrough: FunctionalComponent = (_props, { slots }) => renderableChildren(slots.default?.())[0] ?? null;\n\nconst wrapperProps = computed(() =>\n props.unavailableLabel === undefined\n ? {}\n : {\n content: props.unavailableLabel,\n isDisabled: unavailableReason.value === undefined,\n 'onUpdate:open': (open: boolean) => {\n tooltipOpen.value = open;\n },\n },\n);\n\nconst describedBy = computed(() => {\n const ids = [attrs[AriaAttribute.DescribedBy] as string | undefined];\n if (unavailableReason.value !== undefined && !tooltipOpen.value) ids.push(descriptionId);\n return ids.filter(Boolean).join(' ') || undefined;\n});\n\nconst safeLongPressDelay = computed(() =>\n !Number.isFinite(props.longPressDelay) ||\n props.longPressDelay < PressExtensions.longPressDelay.min ||\n props.longPressDelay > PressExtensions.longPressDelay.max\n ? PressExtensions.longPressDelay.default\n : props.longPressDelay,\n);\n\nwatchEffect(() => {\n if (!IsDevelopment) return;\n if (props.isLoading && props.isSkeleton) {\n console.warn(\n `[${ComponentName}] \\`isLoading\\` and \\`isSkeleton\\` are mutually exclusive — \\`isSkeleton\\` takes precedence.`,\n );\n }\n if (safeLongPressDelay.value !== props.longPressDelay) {\n console.warn(\n `[${ComponentName}] longPressDelay=${props.longPressDelay}ms is outside reasonable range (${PressExtensions.longPressDelay.min}–${PressExtensions.longPressDelay.max}ms). Falling back to ${PressExtensions.longPressDelay.default}ms.`,\n );\n }\n if (\n slots.default === undefined &&\n attrs[AriaAttribute.Label] === undefined &&\n attrs[AriaAttribute.LabelledBy] === undefined\n ) {\n console.warn(\n `[${ComponentName}] icon-only button (no text children) is missing an accessible name — pass \\`aria-label\\` or \\`aria-labelledby\\` (Button.standard.md rule 12).`,\n );\n }\n});\n\n/* Parse the union-typed `size` prop into preset (for variant lookup) + box overrides (for inline dims). */\nconst parsedSize = computed(() => CssExtensions.parseSizeUnion<ButtonSizePreset>(props.size, ButtonSizePresets));\n\nconst rootClass = computed(() =>\n cn(\n buttonVariants({\n variant: props.variant,\n tone: props.tone,\n size: parsedSize.value.preset,\n shape: props.shape,\n fullWidth: props.isFullWidth,\n wrap: props.isMultiline,\n unavailable: unavailableShown.value,\n }),\n attrs.class as ClassValue,\n ),\n);\n\nconst overrideStyle = computed<StyleValue | undefined>(() => {\n const padStyle = CssExtensions.resolvePadding(props.padding);\n const radStyle = CssExtensions.resolveRadius(props.radius);\n /* BoxLayout overrides — `size` is the base; flat width / height / minWidth / minHeight / boxSize win. */\n const composedBox: BoxSizeOverrides = {\n ...(parsedSize.value.box ?? {}),\n ...(props.width !== undefined ? { width: props.width } : {}),\n ...(props.height !== undefined ? { height: props.height } : {}),\n ...(props.minWidth !== undefined ? { minWidth: props.minWidth } : {}),\n ...(props.minHeight !== undefined ? { minHeight: props.minHeight } : {}),\n ...(props.boxSize !== undefined ? { boxSize: props.boxSize } : {}),\n };\n const boxStyle = CssExtensions.resolveBoxSize(composedBox);\n /* Per-instance color override → sets CSS vars on element, scoped locally. */\n const colorStyle = ColorExtensions.toneColorOverride(props.color, props.tone);\n const consumerStyle = attrs.style as StyleValue | undefined;\n if (!padStyle && !radStyle && !boxStyle && !colorStyle && !consumerStyle) return undefined;\n return normalizeStyle([colorStyle, padStyle, radStyle, boxStyle, consumerStyle]);\n});\n\n// ---------------------------------------------------------------------------\n// Press / long-press / debounce wiring.\n// ---------------------------------------------------------------------------\n\nlet isPressing = false;\nlet longPressTimer: ReturnType<typeof setTimeout> | undefined;\nlet longPressFired = false;\n\nconst instance = getCurrentInstance();\n\n/* React armed the long-press timer only when an `onLongPress` prop was passed. A declared emit has\n no such signal — `emit()` on an unlistened event is a silent no-op, but the fired flag would\n still swallow the following click on every long hold. The listener is read off the incoming\n vnode props at event time (declared-emit listeners are stripped from `attrs`), so an unlistened\n button never arms the timer at all. */\nfunction hasLongPressListener(): boolean {\n return instance?.vnode.props?.onLongPress !== undefined;\n}\n\nonBeforeUnmount(() => {\n if (longPressTimer !== undefined) clearTimeout(longPressTimer);\n});\n\nfunction cancelLongPress(): void {\n if (longPressTimer !== undefined) {\n clearTimeout(longPressTimer);\n longPressTimer = undefined;\n }\n}\n\nwatch(isInactive, (inactive) => {\n if (!inactive) return;\n cancelLongPress();\n isPressing = false;\n longPressFired = false;\n});\n\nfunction endPress(event: PressEvent<HTMLButtonElement>): void {\n if (isPressing) {\n isPressing = false;\n emit('press-end', event);\n }\n}\n\nfunction handlePointerDown(event: PointerEvent): void {\n if (isInactive.value || event.defaultPrevented || (event.button != null && event.button !== 0)) return;\n // Cancel any pending timer, then arm only on the first pointer of a gesture — a second\n // pointer-down must not stack a second long-press timer.\n cancelLongPress();\n if (!isPressing) {\n const pressEvent = event as PressEvent<HTMLButtonElement>;\n isPressing = true;\n longPressFired = false;\n emit('press-start', pressEvent);\n if (hasLongPressListener()) {\n longPressTimer = setTimeout(() => {\n if (isInactive.value) return;\n longPressFired = true;\n emit('long-press', pressEvent);\n longPressTimer = undefined;\n }, safeLongPressDelay.value);\n }\n }\n}\n\nfunction handlePointerUp(event: PointerEvent): void {\n cancelLongPress();\n endPress(event as PressEvent<HTMLButtonElement>);\n}\n\nfunction handlePointerCancel(event: PointerEvent): void {\n cancelLongPress();\n endPress(event as PressEvent<HTMLButtonElement>);\n}\n\nfunction handlePointerLeave(event: PointerEvent): void {\n // The subsequent pointerup may target elsewhere; release this gesture at its boundary.\n cancelLongPress();\n endPress(event as PressEvent<HTMLButtonElement>);\n}\n\nconst isActivationKey = (event: KeyboardEvent) => event.key === Key.Space || event.key === Key.Enter;\n\nfunction handleKeyDown(event: KeyboardEvent): void {\n if (isInactive.value || event.defaultPrevented || event.isComposing) return;\n if (isActivationKey(event) && !event.repeat && !isPressing) {\n isPressing = true;\n longPressFired = false;\n emit('press-start', event as PressEvent<HTMLButtonElement>);\n }\n}\n\nfunction handleKeyUp(event: KeyboardEvent): void {\n if (isActivationKey(event) && isPressing) {\n isPressing = false;\n emit('press-end', event as PressEvent<HTMLButtonElement>);\n }\n}\n\n/**\n * The consumer's listener for one attr, normalised. Vue merges several listeners for the same\n * event into an array (a wrapper component that binds `@click` on top of a forwarded `onClick`\n * produces exactly that), so the raw attr is not always callable.\n */\nfunction toHandler<E extends Event>(value: unknown): ((event: E) => void) | undefined {\n if (typeof value === 'function') return value as (event: E) => void;\n if (!Array.isArray(value)) return undefined;\n const handlers = value.filter((entry): entry is (event: E) => void => typeof entry === 'function');\n if (handlers.length === 0) return undefined;\n return (event) => {\n for (const handler of handlers) handler(event);\n };\n}\n\n// Long-press suppression happens BEFORE this — a suppressed click does NOT advance the throttle window.\nconst debouncedOnClick = useDebounceHandler(\n (event: MouseEvent) => toHandler<MouseEvent>(attrs.onClick)?.(event),\n () => props.debounceMs,\n);\n\nfunction handleClick(event: MouseEvent): void {\n if (event.defaultPrevented) return;\n if (isInactive.value) {\n // Block native activation too — e.g. `type=\"submit\"` must not submit while loading.\n event.preventDefault();\n return;\n }\n if (longPressFired) {\n longPressFired = false;\n event.preventDefault();\n return;\n }\n debouncedOnClick(event);\n}\n\n/* The attrs the component owns rather than forwards — see the `inheritAttrs: false` note above;\n `aria-describedby` is merged with the unavailable reason's id.\n Event names carry the single casing Vue's runtime understands (`on` + the event name with only\n its first letter capitalised); `onPointerDown` would bind a `pointer-down` listener. */\nconst OwnedAttributes: ReadonlySet<string> = new Set([\n 'class',\n 'style',\n AriaAttribute.DescribedBy,\n 'onClick',\n 'onPointerdown',\n 'onPointerup',\n 'onPointercancel',\n 'onPointerleave',\n 'onKeydown',\n 'onKeyup',\n]);\n\nconst passthroughAttrs = computed(() =>\n Object.fromEntries(Object.entries(attrs).filter(([key]) => !OwnedAttributes.has(key))),\n);\n\n/** The consumer's own listener for an owned event, so it can be chained ahead of the component's. */\nfunction consumerHandler<E extends Event>(name: string): ((event: E) => void) | undefined {\n return toHandler<E>(attrs[name]);\n}\n\n/* Assembled in the React original's spread order: the component's own attributes first, its event\n chain next, consumer attrs last so they still win. */\nconst rootProps = computed(() => ({\n type: props.asChild ? undefined : props.type,\n class: rootClass.value,\n style: overrideStyle.value,\n disabled: OptionalExtensions.from(resolvedDisabled.value, true),\n [AriaAttribute.Busy]: OptionalExtensions.from(loadingActive.value || skeletonActive.value, true),\n [AriaAttribute.Disabled]: OptionalExtensions.from(isInactive.value, true),\n [AriaAttribute.DescribedBy]: describedBy.value,\n tabindex: OptionalExtensions.from(skeletonActive.value || resolvedDisabled.value, -1),\n 'data-state': dataState.value,\n onClick: handleClick,\n onPointerdown: composeEventHandlers(consumerHandler<PointerEvent>('onPointerdown'), handlePointerDown),\n onPointerup: composeEventHandlers(consumerHandler<PointerEvent>('onPointerup'), handlePointerUp),\n onPointercancel: composeEventHandlers(consumerHandler<PointerEvent>('onPointercancel'), handlePointerCancel),\n onPointerleave: composeEventHandlers(consumerHandler<PointerEvent>('onPointerleave'), handlePointerLeave),\n onKeydown: composeEventHandlers(consumerHandler<KeyboardEvent>('onKeydown'), handleKeyDown),\n onKeyup: composeEventHandlers(consumerHandler<KeyboardEvent>('onKeyup'), handleKeyUp),\n ...passthroughAttrs.value,\n}));\n\nconst root = useTemplateRef<ComponentPublicInstance>('root');\n\n/** The rendered element — the Vue stand-in for the React original's forwarded ref. */\nconst el = computed<HTMLElement | null>(() => {\n const node = root.value?.$el;\n return node instanceof HTMLElement ? node : null;\n});\n\ndefineExpose({ el });\n</script>\n\n<template>\n <!-- Renders an action button — for text and/or icon content; an `unavailableLabel` wraps it in a `Tooltip`. -->\n <component :is=\"unavailableLabel === undefined ? PassThrough : Tooltip\" v-bind=\"wrapperProps\">\n <Primitive ref=\"root\" :as=\"HtmlElement.Button\" :as-child=\"asChild\" v-bind=\"rootProps\">\n <!-- asChild → the merge target owns its children; leading/trailing/loading chrome is not rendered. With an\n unavailable reason, `Slottable` marks the target so the hidden reason below composes inside it. -->\n <Slottable v-if=\"asChild && unavailableReason !== undefined\"><slot /></Slottable>\n <slot v-else-if=\"asChild\" />\n\n <template v-else-if=\"loadingActive && (hasLeading() || loadingText !== undefined)\">\n <!-- The spinner stands where the leading icon was; the label (or loadingText) stays readable. -->\n <slot name=\"loading\">\n <LoadingSlotProp v-if=\"loadingSlot !== undefined\" />\n <Spinner v-else />\n </slot>\n <span v-if=\"loadingText !== undefined\">{{ loadingText }}</span>\n <slot v-else />\n <slot name=\"trailing\"><TrailingSlotProp v-if=\"trailingSlot !== undefined\" /></slot>\n </template>\n\n <template v-else-if=\"loadingActive\">\n <!-- No icon to swap: the label turns transparent, keeping the width and the accessible name, and the\n spinner centers over it. -->\n <span class=\"relative inline-flex items-center justify-center\">\n <span class=\"inline-flex items-center gap-2 opacity-0\">\n <slot />\n <slot name=\"trailing\"><TrailingSlotProp v-if=\"trailingSlot !== undefined\" /></slot>\n </span>\n <span class=\"absolute inset-0 inline-flex items-center justify-center\">\n <slot name=\"loading\">\n <LoadingSlotProp v-if=\"loadingSlot !== undefined\" />\n <Spinner v-else />\n </slot>\n </span>\n </span>\n </template>\n\n <template v-else-if=\"hoverSlot !== undefined || $slots.hover\">\n <slot name=\"leading\"><LeadingSlotProp v-if=\"leadingSlot !== undefined\" /></slot>\n <!-- CSS-only hover/focus-visible swap: children occupy the box and reserve its size;\n the hover content overlays it centered. Toggle via `group-hover`/`group-focus-visible`\n on the root `group` — no JS hover state. `aria-hidden` on the hidden layer so AT\n reads one label. -->\n <span class=\"relative inline-flex items-center justify-center\">\n <span class=\"inline-flex items-center justify-center group-hover:invisible group-focus-visible:invisible\">\n <slot />\n </span>\n <span\n aria-hidden=\"true\"\n class=\"invisible absolute inset-0 inline-flex items-center justify-center group-hover:visible group-focus-visible:visible\"\n >\n <slot name=\"hover\"><HoverSlotProp v-if=\"hoverSlot !== undefined\" /></slot>\n </span>\n </span>\n <slot name=\"trailing\"><TrailingSlotProp v-if=\"trailingSlot !== undefined\" /></slot>\n </template>\n\n <template v-else>\n <slot name=\"leading\"><LeadingSlotProp v-if=\"leadingSlot !== undefined\" /></slot>\n <slot />\n <slot name=\"trailing\"><TrailingSlotProp v-if=\"trailingSlot !== undefined\" /></slot>\n </template>\n\n <!-- Hidden, so the name computed from content skips it, yet `aria-describedby` still reads it; inside the\n element, so a parent's `:last-child` rules (ButtonGroup) still see the button. -->\n <span v-if=\"unavailableReason !== undefined\" :id=\"descriptionId\" hidden>{{ unavailableReason }}</span>\n </Primitive>\n </component>\n</template>\n"],"names":["_useSlots","slots","_createBlock","_resolveDynamicComponent","Tooltip","_normalizeProps","_guardReactiveProps","_createVNode","_unref","_mergeProps","_renderSlot","_createElementBlock","_Fragment","Spinner","_openBlock","_createElementVNode","$slots"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2JA,UAAM,gBAAgB;AAEtB,UAAM,wCAA6C,IAAsB,CAAC,MAAM,MAAM,MAAM,MAAM,IAAI,CAAC;AAGvG,UAAM,kBAAkB;AAAA,MACtB,SAAS;AAAA,MACT,UAAU;AAAA,MACV,UAAU;AAAA,MACV,aAAa;AAAA,IAAA;AAcf,UAAM,QAAQ;AAqBd,UAAM,OAAO;AAWb,UAAM,QAAQA,SAAA;AAiBd,UAAM,QAAQ,SAAA;AAId,UAAM,WAAW,CAAC,SAA2B,gBAAgB,EAAE,QAAQ,MAAM;AAC7E,UAAM,kBAAkB,SAAS,MAAM,MAAM,WAAW;AACxD,UAAM,mBAAmB,SAAS,MAAM,MAAM,YAAY;AAC1D,UAAM,gBAAgB,SAAS,MAAM,MAAM,SAAS;AACpD,UAAM,kBAAkB,SAAS,MAAM,MAAM,WAAW;AAIxD,UAAM,cAAc,eAAA;AACpB,UAAM,mBAAmB,SAAS,MAAM,MAAM,cAAc,aAAa,cAAc,KAAK;AAG5F,UAAM,WAAW,iBAAiB,MAAM,MAAM,UAAU;AACxD,UAAM,iBAAiB,SAAS,MAAM,SAAS,WAAW,KAAK;AAC/D,UAAM,gBAAgB,SAAS,MAAM,CAAC,eAAe,SAAS,CAAC,CAA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A,GAAA,EAAA,KAAA,EAAA,CAAA;;;;gBAGvEE,WAAmF,6BAAnF,MAAmF;AAAA,kBAArC,QAAA,iBAAiB,uBAAzCR,YAAsDM,MAAA,gBAAA,GAAA,EAAA,KAAA,EAAA,CAAA;;sCAG9EG,mBAIWC,UAAA,EAAA,KAAA,KAAA;AAAA,gBAHTF,WAAgF,4BAAhF,MAAgF;AAAA,kBAApC,QAAA,gBAAgB,uBAAvCR,YAAoDM,MAAA,eAAA,GAAA,EAAA,KAAA,EAAA,CAAA;;gBACzEE,WAAQ,KAAA,QAAA,SAAA;AAAA,gBACRA,WAAmF,6BAAnF,MAAmF;AAAA,kBAArC,QAAA,iBAAiB,uBAAzCR,YAAsDM,MAAA,gBAAA,GAAA,EAAA,KAAA,EAAA,CAAA;;;cAKlE,kBAAA,UAAsB,uBAAlCG,mBAAsG,QAAA;AAAA;gBAAxD,IAAIH,MAAA,aAAA;AAAA,gBAAe,QAAA;AAAA,cAAA,mBAAU,kBAAA,KAAiB,GAAA,GAAA,UAAA;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RefreshButton.vue.js","sources":["../../../../src/presentation/actions/refreshButton/RefreshButton.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ButtonProps } from '../button';\n\n/** @internal The `ButtonProps` this preset decides itself. */\ntype OwnedButtonProp = keyof Pick<ButtonProps, 'isLoading' | 'shape' | 'leadingSlot'>;\n\n/** Defines the forwarded `ButtonProps`, minus the ones the refresh preset sets. */\ntype RefreshButtonAttributes = Omit<ButtonProps, OwnedButtonProp>;\n\n/** Defines props for the one refresh control a region shows. */\nexport interface RefreshButtonProps extends /* @vue-ignore */ RefreshButtonAttributes {\n /** True from the click until the refresh settles — `useRefresh`'s `refreshing`; the icon spins and clicks wait. */\n readonly isRefreshing?: boolean;\n\n /** The visible label, or the accessible name of an icon-only button. Default `\"Refresh\"`, localized. */\n readonly label?: string;\n\n /** Renders the icon alone, square at its size, named by `label`. */\n readonly isIconOnly?: boolean;\n\n /** The visual surface style. Default `outline`; `ghost` inside a panel header. */\n readonly variant?: ButtonProps['variant'];\n\n /** The size step. Default `sm`; `md` beside page-level controls. */\n readonly size?: ButtonProps['size'];\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, useAttrs } from 'vue';\nimport { RefreshCw } from 'lucide-vue-next';\nimport { useLocaleDefaults } from '../../../foundation/i18n';\nimport { Icon } from '../../../foundation/icons';\nimport Button from '../button/Button.vue';\n\n/**\n * Renders the refresh control a region reruns its reads with — a `Button` preset that swaps the refresh icon for the\n * spinner while `isRefreshing`, keeps its label and width, and swallows repeat clicks until the refresh settles. Pair\n * it with `useRefresh` from `@wow-two-beta/fe/query`, which also drives the region's placeholders.\n */\ndefineOptions({ name: 'RefreshButton', inheritAttrs: false });\n\nconst componentProps = withDefaults(defineProps<RefreshButtonProps>(), {\n isRefreshing: false,\n label: undefined,\n isIconOnly: false,\n variant: 'outline',\n size: 'sm',\n});\nconst props = useLocaleDefaults(componentProps, 'RefreshButton', { label: 'Refresh' });\n\nconst attrs = useAttrs();\n\n/** The icon-only form names itself through `aria-label`, and `title` shows the name on hover. */\nconst naming = computed(() =>\n props.isIconOnly ? { 'aria-label': props.label, title: props.label } : ({} as Record<string, string>),\n);\n</script>\n\n<template>\n <Button\n tone=\"neutral\"\n :variant=\"props.variant\"\n :size=\"props.size\"\n :shape=\"props.isIconOnly ? 'square' : 'default'\"\n :is-loading=\"props.isRefreshing\"\n v-bind=\"{ ...naming, ...attrs }\"\n >\n <template #leading><Icon :icon=\"RefreshCw\" :size=\"14\" /></template>\n <template v-if=\"!props.isIconOnly\">{{ props.label }}</template>\n </Button>\n</template>\n"],"names":["_openBlock","_createBlock","Button","_mergeProps","_unref","_createVNode","Icon","_createElementBlock","_Fragment","_createTextVNode","_toDisplayString"],"mappings":";;;;;;;;;;;;;;;;AA0CA,UAAM,iBAAiB;AAOvB,UAAM,QAAQ,kBAAkB,gBAAgB,iBAAiB,EAAE,OAAO,WAAW;AAErF,UAAM,QAAQ,SAAA;AAGd,UAAM,SAAS;AAAA,MAAS,MACtB,MAAM,aAAa,EAAE,cAAc,MAAM,OAAO,OAAO,MAAM,UAAW,CAAA;AAAA,IAAC;;AAKzE,aAAAA,UAAA,GAAAC,YAUSC,aAVTC,WAUS;AAAA,QATP,MAAK;AAAA,QACJ,SAASC,MAAA,KAAA,EAAM;AAAA,QACf,MAAMA,MAAA,KAAA,EAAM;AAAA,QACZ,OAAOA,MAAA,KAAA,EAAM,aAAU,WAAA;AAAA,QACvB,cAAYA,MAAA,KAAA,EAAM;AAAA,MAAA,GACN,EAAA,GAAA,OAAA,UAAWA,MAAA,KAAA,EAAA,CAAK,GAAA;AAAA,QAElB,iBAAQ,MAAqC;AAAA,UAArCC,YAAqCD,MAAAE,WAAA,GAAA;AAAA,YAA9B,MAAMF,MAAA,SAAA;AAAA,YAAY,MAAM;AAAA,UAAA;;
|
|
1
|
+
{"version":3,"file":"RefreshButton.vue.js","sources":["../../../../src/presentation/actions/refreshButton/RefreshButton.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ButtonProps } from '../button';\n\n/** @internal The `ButtonProps` this preset decides itself. */\ntype OwnedButtonProp = keyof Pick<ButtonProps, 'isLoading' | 'shape' | 'leadingSlot'>;\n\n/** Defines the forwarded `ButtonProps`, minus the ones the refresh preset sets. */\ntype RefreshButtonAttributes = Omit<ButtonProps, OwnedButtonProp>;\n\n/** Defines props for the one refresh control a region shows. */\nexport interface RefreshButtonProps extends /* @vue-ignore */ RefreshButtonAttributes {\n /** True from the click until the refresh settles — `useRefresh`'s `refreshing`; the icon spins and clicks wait. */\n readonly isRefreshing?: boolean;\n\n /** The visible label, or the accessible name of an icon-only button. Default `\"Refresh\"`, localized. */\n readonly label?: string;\n\n /** Renders the icon alone, square at its size, named by `label`. */\n readonly isIconOnly?: boolean;\n\n /** The visual surface style. Default `outline`; `ghost` inside a panel header. */\n readonly variant?: ButtonProps['variant'];\n\n /** The size step. Default `sm`; `md` beside page-level controls. */\n readonly size?: ButtonProps['size'];\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, useAttrs } from 'vue';\nimport { RefreshCw } from 'lucide-vue-next';\nimport { useLocaleDefaults } from '../../../foundation/i18n';\nimport { Icon } from '../../../foundation/icons';\nimport Button from '../button/Button.vue';\n\n/**\n * Renders the refresh control a region reruns its reads with — a `Button` preset that swaps the refresh icon for the\n * spinner while `isRefreshing`, keeps its label and width, and swallows repeat clicks until the refresh settles. Pair\n * it with `useRefresh` from `@wow-two-beta/fe/query`, which also drives the region's placeholders.\n */\ndefineOptions({ name: 'RefreshButton', inheritAttrs: false });\n\nconst componentProps = withDefaults(defineProps<RefreshButtonProps>(), {\n isRefreshing: false,\n label: undefined,\n isIconOnly: false,\n variant: 'outline',\n size: 'sm',\n});\nconst props = useLocaleDefaults(componentProps, 'RefreshButton', { label: 'Refresh' });\n\nconst attrs = useAttrs();\n\n/** The icon-only form names itself through `aria-label`, and `title` shows the name on hover. */\nconst naming = computed(() =>\n props.isIconOnly ? { 'aria-label': props.label, title: props.label } : ({} as Record<string, string>),\n);\n</script>\n\n<template>\n <Button\n tone=\"neutral\"\n :variant=\"props.variant\"\n :size=\"props.size\"\n :shape=\"props.isIconOnly ? 'square' : 'default'\"\n :is-loading=\"props.isRefreshing\"\n v-bind=\"{ ...naming, ...attrs }\"\n >\n <template #leading><Icon :icon=\"RefreshCw\" :size=\"14\" /></template>\n <template v-if=\"!props.isIconOnly\">{{ props.label }}</template>\n </Button>\n</template>\n"],"names":["_openBlock","_createBlock","Button","_mergeProps","_unref","_createVNode","Icon","_createElementBlock","_Fragment","_createTextVNode","_toDisplayString"],"mappings":";;;;;;;;;;;;;;;;AA0CA,UAAM,iBAAiB;AAOvB,UAAM,QAAQ,kBAAkB,gBAAgB,iBAAiB,EAAE,OAAO,WAAW;AAErF,UAAM,QAAQ,SAAA;AAGd,UAAM,SAAS;AAAA,MAAS,MACtB,MAAM,aAAa,EAAE,cAAc,MAAM,OAAO,OAAO,MAAM,UAAW,CAAA;AAAA,IAAC;;AAKzE,aAAAA,UAAA,GAAAC,YAUSC,aAVTC,WAUS;AAAA,QATP,MAAK;AAAA,QACJ,SAASC,MAAA,KAAA,EAAM;AAAA,QACf,MAAMA,MAAA,KAAA,EAAM;AAAA,QACZ,OAAOA,MAAA,KAAA,EAAM,aAAU,WAAA;AAAA,QACvB,cAAYA,MAAA,KAAA,EAAM;AAAA,MAAA,GACN,EAAA,GAAA,OAAA,UAAWA,MAAA,KAAA,EAAA,CAAK,GAAA;AAAA,QAElB,iBAAQ,MAAqC;AAAA,UAArCC,YAAqCD,MAAAE,WAAA,GAAA;AAAA,YAA9B,MAAMF,MAAA,SAAA;AAAA,YAAY,MAAM;AAAA,UAAA;;yBATuB,MAC/C;AAAA,UAST,CAAAA,MAAA,KAAA,EAAM,2BAAvBG,mBAA+DC,UAAA,EAAA,KAAA,KAAA;AAAA,YAAzBC,gBAAAC,gBAAAN,MAAA,KAAA,EAAM,KAAK,GAAA,CAAA;AAAA,UAAA;;;;;;;"}
|
|
@@ -19,6 +19,10 @@ export declare const BadgeVariant: {
|
|
|
19
19
|
readonly Surface: "surface";
|
|
20
20
|
/** Refers to a transparent fill with muted text — a state that asks for no attention. */
|
|
21
21
|
readonly Quiet: "quiet";
|
|
22
|
+
/** Refers to a dark translucent wash with light text and a backdrop blur — a pill laid over imagery. */
|
|
23
|
+
readonly Glass: "glass";
|
|
24
|
+
/** Refers to a success-tinted translucent wash with light text and a backdrop blur — a positive pill over imagery. */
|
|
25
|
+
readonly GlassSuccess: "glassSuccess";
|
|
22
26
|
};
|
|
23
27
|
export type BadgeVariant = (typeof BadgeVariant)[keyof typeof BadgeVariant];
|
|
24
28
|
/** Defines the Badge outline's line style; it shows wherever the pill draws a border. */
|
|
@@ -42,6 +46,8 @@ export declare const badgeVariants: import('tailwind-variants').TVReturnType<{
|
|
|
42
46
|
outline: "border border-border text-foreground";
|
|
43
47
|
surface: "bg-card text-foreground";
|
|
44
48
|
quiet: "bg-transparent text-muted-foreground";
|
|
49
|
+
glass: "bg-black/45 text-white backdrop-blur-md";
|
|
50
|
+
glassSuccess: "bg-success-900/60 text-success-50 backdrop-blur-md";
|
|
45
51
|
};
|
|
46
52
|
size: {
|
|
47
53
|
sm: "h-5 gap-1 px-2 text-xs";
|
|
@@ -61,6 +67,10 @@ export declare const badgeVariants: import('tailwind-variants').TVReturnType<{
|
|
|
61
67
|
true: "";
|
|
62
68
|
false: "";
|
|
63
69
|
};
|
|
70
|
+
isShrinkable: {
|
|
71
|
+
true: "min-w-0 shrink whitespace-nowrap";
|
|
72
|
+
false: "";
|
|
73
|
+
};
|
|
64
74
|
}, undefined, "inline-flex max-w-full items-center rounded-full font-medium", {
|
|
65
75
|
variant: {
|
|
66
76
|
neutral: "bg-muted text-foreground";
|
|
@@ -72,6 +82,8 @@ export declare const badgeVariants: import('tailwind-variants').TVReturnType<{
|
|
|
72
82
|
outline: "border border-border text-foreground";
|
|
73
83
|
surface: "bg-card text-foreground";
|
|
74
84
|
quiet: "bg-transparent text-muted-foreground";
|
|
85
|
+
glass: "bg-black/45 text-white backdrop-blur-md";
|
|
86
|
+
glassSuccess: "bg-success-900/60 text-success-50 backdrop-blur-md";
|
|
75
87
|
};
|
|
76
88
|
size: {
|
|
77
89
|
sm: "h-5 gap-1 px-2 text-xs";
|
|
@@ -91,6 +103,10 @@ export declare const badgeVariants: import('tailwind-variants').TVReturnType<{
|
|
|
91
103
|
true: "";
|
|
92
104
|
false: "";
|
|
93
105
|
};
|
|
106
|
+
isShrinkable: {
|
|
107
|
+
true: "min-w-0 shrink whitespace-nowrap";
|
|
108
|
+
false: "";
|
|
109
|
+
};
|
|
94
110
|
}, undefined, import('tailwind-variants').TVReturnTypeLike<{
|
|
95
111
|
variant: {
|
|
96
112
|
neutral: "bg-muted text-foreground";
|
|
@@ -102,6 +118,8 @@ export declare const badgeVariants: import('tailwind-variants').TVReturnType<{
|
|
|
102
118
|
outline: "border border-border text-foreground";
|
|
103
119
|
surface: "bg-card text-foreground";
|
|
104
120
|
quiet: "bg-transparent text-muted-foreground";
|
|
121
|
+
glass: "bg-black/45 text-white backdrop-blur-md";
|
|
122
|
+
glassSuccess: "bg-success-900/60 text-success-50 backdrop-blur-md";
|
|
105
123
|
};
|
|
106
124
|
size: {
|
|
107
125
|
sm: "h-5 gap-1 px-2 text-xs";
|
|
@@ -121,6 +139,10 @@ export declare const badgeVariants: import('tailwind-variants').TVReturnType<{
|
|
|
121
139
|
true: "";
|
|
122
140
|
false: "";
|
|
123
141
|
};
|
|
142
|
+
isShrinkable: {
|
|
143
|
+
true: "min-w-0 shrink whitespace-nowrap";
|
|
144
|
+
false: "";
|
|
145
|
+
};
|
|
124
146
|
}, undefined>>;
|
|
125
147
|
/** The leading icon's box per size step; an icon the caller sizes itself keeps its own size. */
|
|
126
148
|
export declare const badgeLeadingSize: {
|
|
@@ -128,6 +150,6 @@ export declare const badgeLeadingSize: {
|
|
|
128
150
|
readonly md: "[&>svg]:size-3.5";
|
|
129
151
|
readonly lg: "[&>svg]:size-4";
|
|
130
152
|
};
|
|
131
|
-
/** Whether a variant
|
|
153
|
+
/** Whether a variant sets its own text colour, so the detail keeps it instead of turning muted — glass included. */
|
|
132
154
|
export declare function isTintedBadge(variant: BadgeVariant): boolean;
|
|
133
155
|
export type BadgeVariants = VariantProps<typeof badgeVariants>;
|
|
@@ -17,7 +17,11 @@ const BadgeVariant = {
|
|
|
17
17
|
/** Refers to the card fill with the body text — a calm status that lets its icon carry the colour. */
|
|
18
18
|
Surface: "surface",
|
|
19
19
|
/** Refers to a transparent fill with muted text — a state that asks for no attention. */
|
|
20
|
-
Quiet: "quiet"
|
|
20
|
+
Quiet: "quiet",
|
|
21
|
+
/** Refers to a dark translucent wash with light text and a backdrop blur — a pill laid over imagery. */
|
|
22
|
+
Glass: "glass",
|
|
23
|
+
/** Refers to a success-tinted translucent wash with light text and a backdrop blur — a positive pill over imagery. */
|
|
24
|
+
GlassSuccess: "glassSuccess"
|
|
21
25
|
};
|
|
22
26
|
const BadgeBorderStyle = {
|
|
23
27
|
/** Refers to a solid outline. */
|
|
@@ -39,7 +43,10 @@ const badgeVariants = tv({
|
|
|
39
43
|
info: "bg-info-soft text-info-soft-foreground",
|
|
40
44
|
outline: "border border-border text-foreground",
|
|
41
45
|
surface: "bg-card text-foreground",
|
|
42
|
-
quiet: "bg-transparent text-muted-foreground"
|
|
46
|
+
quiet: "bg-transparent text-muted-foreground",
|
|
47
|
+
/* Glass reads over any imagery in either theme: a fixed dark wash and light text, as `Button`'s neutral glass. */
|
|
48
|
+
glass: "bg-black/45 text-white backdrop-blur-md",
|
|
49
|
+
glassSuccess: "bg-success-900/60 text-success-50 backdrop-blur-md"
|
|
43
50
|
},
|
|
44
51
|
size: {
|
|
45
52
|
sm: "h-5 gap-1 px-2 text-xs",
|
|
@@ -58,6 +65,11 @@ const badgeVariants = tv({
|
|
|
58
65
|
hasLeading: {
|
|
59
66
|
true: "",
|
|
60
67
|
false: ""
|
|
68
|
+
},
|
|
69
|
+
/* The pill may shrink below its copy in a flex row; the label then cuts with an ellipsis. */
|
|
70
|
+
isShrinkable: {
|
|
71
|
+
true: "min-w-0 shrink whitespace-nowrap",
|
|
72
|
+
false: ""
|
|
61
73
|
}
|
|
62
74
|
},
|
|
63
75
|
compoundVariants: [
|
|
@@ -68,6 +80,8 @@ const badgeVariants = tv({
|
|
|
68
80
|
{ isOutlined: true, variant: "warning", class: "border-warning/45" },
|
|
69
81
|
{ isOutlined: true, variant: "danger", class: "border-destructive/45" },
|
|
70
82
|
{ isOutlined: true, variant: "info", class: "border-info/40" },
|
|
83
|
+
{ isOutlined: true, variant: "glass", class: "border-white/20" },
|
|
84
|
+
{ isOutlined: true, variant: "glassSuccess", class: "border-success/50" },
|
|
71
85
|
/* A leading icon sits closer to the rounded start than text does. */
|
|
72
86
|
{ hasLeading: true, size: "sm", class: "ps-1" },
|
|
73
87
|
{ hasLeading: true, size: "md", class: "ps-1.5" },
|
|
@@ -78,7 +92,8 @@ const badgeVariants = tv({
|
|
|
78
92
|
size: "md",
|
|
79
93
|
isOutlined: false,
|
|
80
94
|
borderStyle: "solid",
|
|
81
|
-
hasLeading: false
|
|
95
|
+
hasLeading: false,
|
|
96
|
+
isShrinkable: false
|
|
82
97
|
}
|
|
83
98
|
});
|
|
84
99
|
const badgeLeadingSize = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.variants.js","sources":["../../../../src/presentation/display/badge/Badge.variants.ts"],"sourcesContent":["import { tv, Size, type VariantProps } from '../../../foundation/styles';\n\n/** Defines the Badge color treatment. */\nexport const BadgeVariant = {\n /** Refers to the neutral grey fill. */\n Neutral: 'neutral',\n /** Refers to the primary brand tint. */\n Brand: 'brand',\n /** Refers to the positive / confirmation tint. */\n Success: 'success',\n /** Refers to the caution tint. */\n Warning: 'warning',\n /** Refers to the destructive / error tint. */\n Danger: 'danger',\n /** Refers to the informational tint. */\n Info: 'info',\n /** Refers to a bordered, transparent fill. */\n Outline: 'outline',\n /** Refers to the card fill with the body text — a calm status that lets its icon carry the colour. */\n Surface: 'surface',\n /** Refers to a transparent fill with muted text — a state that asks for no attention. */\n Quiet: 'quiet',\n} as const;\n\nexport type BadgeVariant = (typeof BadgeVariant)[keyof typeof BadgeVariant];\n\n/** Defines the Badge outline's line style; it shows wherever the pill draws a border. */\nexport const BadgeBorderStyle = {\n /** Refers to a solid outline. */\n Solid: 'solid',\n /** Refers to a dashed outline — a state that has not happened, such as nothing applied. */\n Dashed: 'dashed',\n /** Refers to a dotted outline — a state nobody can tell, such as unknown. */\n Dotted: 'dotted',\n} as const;\n\nexport type BadgeBorderStyle = (typeof BadgeBorderStyle)[keyof typeof BadgeBorderStyle];\n\nexport const badgeVariants = tv({\n base: 'inline-flex max-w-full items-center rounded-full font-medium',\n variants: {\n variant: {\n neutral: 'bg-muted text-foreground',\n brand: 'bg-primary-soft text-primary-soft-foreground',\n success: 'bg-success-soft text-success-soft-foreground',\n warning: 'bg-warning-soft text-warning-soft-foreground',\n danger: 'bg-destructive-soft text-destructive-soft-foreground',\n info: 'bg-info-soft text-info-soft-foreground',\n outline: 'border border-border text-foreground',\n surface: 'bg-card text-foreground',\n quiet: 'bg-transparent text-muted-foreground',\n },\n size: {\n sm: 'h-5 gap-1 px-2 text-xs',\n md: 'h-6 gap-1.5 px-2.5 text-xs',\n lg: 'h-7 gap-1.5 px-3 text-sm',\n },\n isOutlined: {\n true: 'border',\n false: '',\n },\n borderStyle: {\n solid: '',\n dashed: 'border-dashed',\n dotted: 'border-dotted',\n },\n hasLeading: {\n true: '',\n false: '',\n },\n },\n compoundVariants: [\n /* The outline takes the tint's own colour, a step stronger than its fill; neutral fills keep the plain border. */\n { isOutlined: true, variant: ['neutral', 'surface', 'quiet', 'outline'], class: 'border-border' },\n { isOutlined: true, variant: 'brand', class: 'border-primary/40' },\n { isOutlined: true, variant: 'success', class: 'border-success/40' },\n { isOutlined: true, variant: 'warning', class: 'border-warning/45' },\n { isOutlined: true, variant: 'danger', class: 'border-destructive/45' },\n { isOutlined: true, variant: 'info', class: 'border-info/40' },\n /* A leading icon sits closer to the rounded start than text does. */\n { hasLeading: true, size: 'sm', class: 'ps-1' },\n { hasLeading: true, size: 'md', class: 'ps-1.5' },\n { hasLeading: true, size: 'lg', class: 'ps-2' },\n ],\n defaultVariants: {\n variant: 'neutral',\n size: 'md',\n isOutlined: false,\n borderStyle: 'solid',\n hasLeading: false,\n },\n});\n\n/** The leading icon's box per size step; an icon the caller sizes itself keeps its own size. */\nexport const badgeLeadingSize = {\n sm: '[&>svg]:size-3',\n md: '[&>svg]:size-3.5',\n lg: '[&>svg]:size-4',\n} as const;\n\n/** Whether a variant
|
|
1
|
+
{"version":3,"file":"Badge.variants.js","sources":["../../../../src/presentation/display/badge/Badge.variants.ts"],"sourcesContent":["import { tv, Size, type VariantProps } from '../../../foundation/styles';\n\n/** Defines the Badge color treatment. */\nexport const BadgeVariant = {\n /** Refers to the neutral grey fill. */\n Neutral: 'neutral',\n /** Refers to the primary brand tint. */\n Brand: 'brand',\n /** Refers to the positive / confirmation tint. */\n Success: 'success',\n /** Refers to the caution tint. */\n Warning: 'warning',\n /** Refers to the destructive / error tint. */\n Danger: 'danger',\n /** Refers to the informational tint. */\n Info: 'info',\n /** Refers to a bordered, transparent fill. */\n Outline: 'outline',\n /** Refers to the card fill with the body text — a calm status that lets its icon carry the colour. */\n Surface: 'surface',\n /** Refers to a transparent fill with muted text — a state that asks for no attention. */\n Quiet: 'quiet',\n /** Refers to a dark translucent wash with light text and a backdrop blur — a pill laid over imagery. */\n Glass: 'glass',\n /** Refers to a success-tinted translucent wash with light text and a backdrop blur — a positive pill over imagery. */\n GlassSuccess: 'glassSuccess',\n} as const;\n\nexport type BadgeVariant = (typeof BadgeVariant)[keyof typeof BadgeVariant];\n\n/** Defines the Badge outline's line style; it shows wherever the pill draws a border. */\nexport const BadgeBorderStyle = {\n /** Refers to a solid outline. */\n Solid: 'solid',\n /** Refers to a dashed outline — a state that has not happened, such as nothing applied. */\n Dashed: 'dashed',\n /** Refers to a dotted outline — a state nobody can tell, such as unknown. */\n Dotted: 'dotted',\n} as const;\n\nexport type BadgeBorderStyle = (typeof BadgeBorderStyle)[keyof typeof BadgeBorderStyle];\n\nexport const badgeVariants = tv({\n base: 'inline-flex max-w-full items-center rounded-full font-medium',\n variants: {\n variant: {\n neutral: 'bg-muted text-foreground',\n brand: 'bg-primary-soft text-primary-soft-foreground',\n success: 'bg-success-soft text-success-soft-foreground',\n warning: 'bg-warning-soft text-warning-soft-foreground',\n danger: 'bg-destructive-soft text-destructive-soft-foreground',\n info: 'bg-info-soft text-info-soft-foreground',\n outline: 'border border-border text-foreground',\n surface: 'bg-card text-foreground',\n quiet: 'bg-transparent text-muted-foreground',\n /* Glass reads over any imagery in either theme: a fixed dark wash and light text, as `Button`'s neutral glass. */\n glass: 'bg-black/45 text-white backdrop-blur-md',\n glassSuccess: 'bg-success-900/60 text-success-50 backdrop-blur-md',\n },\n size: {\n sm: 'h-5 gap-1 px-2 text-xs',\n md: 'h-6 gap-1.5 px-2.5 text-xs',\n lg: 'h-7 gap-1.5 px-3 text-sm',\n },\n isOutlined: {\n true: 'border',\n false: '',\n },\n borderStyle: {\n solid: '',\n dashed: 'border-dashed',\n dotted: 'border-dotted',\n },\n hasLeading: {\n true: '',\n false: '',\n },\n /* The pill may shrink below its copy in a flex row; the label then cuts with an ellipsis. */\n isShrinkable: {\n true: 'min-w-0 shrink whitespace-nowrap',\n false: '',\n },\n },\n compoundVariants: [\n /* The outline takes the tint's own colour, a step stronger than its fill; neutral fills keep the plain border. */\n { isOutlined: true, variant: ['neutral', 'surface', 'quiet', 'outline'], class: 'border-border' },\n { isOutlined: true, variant: 'brand', class: 'border-primary/40' },\n { isOutlined: true, variant: 'success', class: 'border-success/40' },\n { isOutlined: true, variant: 'warning', class: 'border-warning/45' },\n { isOutlined: true, variant: 'danger', class: 'border-destructive/45' },\n { isOutlined: true, variant: 'info', class: 'border-info/40' },\n { isOutlined: true, variant: 'glass', class: 'border-white/20' },\n { isOutlined: true, variant: 'glassSuccess', class: 'border-success/50' },\n /* A leading icon sits closer to the rounded start than text does. */\n { hasLeading: true, size: 'sm', class: 'ps-1' },\n { hasLeading: true, size: 'md', class: 'ps-1.5' },\n { hasLeading: true, size: 'lg', class: 'ps-2' },\n ],\n defaultVariants: {\n variant: 'neutral',\n size: 'md',\n isOutlined: false,\n borderStyle: 'solid',\n hasLeading: false,\n isShrinkable: false,\n },\n});\n\n/** The leading icon's box per size step; an icon the caller sizes itself keeps its own size. */\nexport const badgeLeadingSize = {\n sm: '[&>svg]:size-3',\n md: '[&>svg]:size-3.5',\n lg: '[&>svg]:size-4',\n} as const;\n\n/** Whether a variant sets its own text colour, so the detail keeps it instead of turning muted — glass included. */\nexport function isTintedBadge(variant: BadgeVariant): boolean {\n return variant !== 'neutral' && variant !== 'outline' && variant !== 'surface' && variant !== 'quiet';\n}\n\nexport type BadgeVariants = VariantProps<typeof badgeVariants>;\n\n/* Compile-time lock: enum values ≡ tv variant value-set (drift = type error). */\ntype AssertExact<A, B> = [A] extends [B] ? ([B] extends [A] ? true : never) : never;\nconst _assertBadgeVariant: AssertExact<BadgeVariant, NonNullable<VariantProps<typeof badgeVariants>['variant']>> = true;\nconst _assertBadgeBorderStyle: AssertExact<\n BadgeBorderStyle,\n NonNullable<VariantProps<typeof badgeVariants>['borderStyle']>\n> = true;\n/* `size` prop adopts the shared 5-member `Size`; the tv axis only styles sm/md/lg (widening is intentional). */\nconst _assertBadgeSize: [NonNullable<VariantProps<typeof badgeVariants>['size']>] extends [Size] ? true : never = true;\nvoid _assertBadgeVariant;\nvoid _assertBadgeBorderStyle;\nvoid _assertBadgeSize;\n"],"names":[],"mappings":";AAGO,MAAM,eAAe;AAAA;AAAA,EAE1B,SAAS;AAAA;AAAA,EAET,OAAO;AAAA;AAAA,EAEP,SAAS;AAAA;AAAA,EAET,SAAS;AAAA;AAAA,EAET,QAAQ;AAAA;AAAA,EAER,MAAM;AAAA;AAAA,EAEN,SAAS;AAAA;AAAA,EAET,SAAS;AAAA;AAAA,EAET,OAAO;AAAA;AAAA,EAEP,OAAO;AAAA;AAAA,EAEP,cAAc;AAChB;AAKO,MAAM,mBAAmB;AAAA;AAAA,EAE9B,OAAO;AAAA;AAAA,EAEP,QAAQ;AAAA;AAAA,EAER,QAAQ;AACV;AAIO,MAAM,gBAAgB,GAAG;AAAA,EAC9B,MAAM;AAAA,EACN,UAAU;AAAA,IACR,SAAS;AAAA,MACP,SAAS;AAAA,MACT,OAAO;AAAA,MACP,SAAS;AAAA,MACT,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA,MACT,SAAS;AAAA,MACT,OAAO;AAAA;AAAA,MAEP,OAAO;AAAA,MACP,cAAc;AAAA,IAAA;AAAA,IAEhB,MAAM;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,IAAA;A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AAgC;AAC5D,SAAO,YAAY,aAAa,YAAY,aAAa,YAAY,aAAa,YAAY;AAChG;"}
|
|
@@ -15,6 +15,8 @@ export interface BadgeProps {
|
|
|
15
15
|
readonly isSpinning?: boolean;
|
|
16
16
|
/** Draws the pill as its placeholder; defaults to the nearest `DataRegion` first load. */
|
|
17
17
|
readonly isSkeleton?: boolean;
|
|
18
|
+
/** Lets the pill shrink below its copy in a flex row and cuts the label with an ellipsis; the leading icon stays. */
|
|
19
|
+
readonly isShrinkable?: boolean;
|
|
18
20
|
}
|
|
19
21
|
declare const _default: __VLS_WithSlots<import('vue').DefineComponent<BadgeProps, {
|
|
20
22
|
el: Readonly<import('vue').ShallowRef<HTMLSpanElement | null>>;
|
|
@@ -23,6 +25,7 @@ declare const _default: __VLS_WithSlots<import('vue').DefineComponent<BadgeProps
|
|
|
23
25
|
readonly isSkeleton: boolean;
|
|
24
26
|
readonly isOutlined: boolean;
|
|
25
27
|
readonly borderStyle: BadgeBorderStyle;
|
|
28
|
+
readonly isShrinkable: boolean;
|
|
26
29
|
readonly isSpinning: boolean;
|
|
27
30
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, {
|
|
28
31
|
/** The badge copy — React's `children`. */
|
|
@@ -8,7 +8,10 @@ const _hoisted_2 = {
|
|
|
8
8
|
key: 0,
|
|
9
9
|
class: "inline-block w-[4ch]"
|
|
10
10
|
};
|
|
11
|
-
const _hoisted_3 = {
|
|
11
|
+
const _hoisted_3 = {
|
|
12
|
+
"data-badge-label": "",
|
|
13
|
+
class: "min-w-0 truncate"
|
|
14
|
+
};
|
|
12
15
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
13
16
|
...{ name: "Badge", inheritAttrs: false },
|
|
14
17
|
__name: "Badge",
|
|
@@ -19,7 +22,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
19
22
|
borderStyle: { default: "solid" },
|
|
20
23
|
detail: { default: void 0 },
|
|
21
24
|
isSpinning: { type: Boolean, default: false },
|
|
22
|
-
isSkeleton: { type: Boolean, default: void 0 }
|
|
25
|
+
isSkeleton: { type: Boolean, default: void 0 },
|
|
26
|
+
isShrinkable: { type: Boolean, default: false }
|
|
23
27
|
},
|
|
24
28
|
setup(__props, { expose: __expose }) {
|
|
25
29
|
const props = __props;
|
|
@@ -32,6 +36,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
32
36
|
const size = computed(() => props.size === "sm" || props.size === "lg" ? props.size : "md");
|
|
33
37
|
const hasLeading = computed(() => Boolean(slots.leading));
|
|
34
38
|
const hasDetail = computed(() => Boolean(props.detail) || Boolean(slots.detail));
|
|
39
|
+
const hasParts = computed(() => hasLeading.value || hasDetail.value || props.isShrinkable);
|
|
35
40
|
const classes = computed(
|
|
36
41
|
() => cn(
|
|
37
42
|
badgeVariants({
|
|
@@ -39,7 +44,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
39
44
|
size: props.size,
|
|
40
45
|
isOutlined: props.isOutlined,
|
|
41
46
|
borderStyle: props.borderStyle,
|
|
42
|
-
hasLeading: hasLeading.value
|
|
47
|
+
hasLeading: hasLeading.value,
|
|
48
|
+
isShrinkable: props.isShrinkable
|
|
43
49
|
}),
|
|
44
50
|
(hasLeading.value || hasDetail.value) && "whitespace-nowrap",
|
|
45
51
|
attrs.class,
|
|
@@ -68,7 +74,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
68
74
|
"data-skeleton": unref(skeleton).isSkeleton.value || void 0,
|
|
69
75
|
"aria-hidden": unref(skeleton).isSkeleton.value || void 0
|
|
70
76
|
}, rest.value, { class: classes.value }), [
|
|
71
|
-
unref(skeleton).isSkeleton.value && !hasContent() ? (openBlock(), createElementBlock("span", _hoisted_2, " ")) :
|
|
77
|
+
unref(skeleton).isSkeleton.value && !hasContent() ? (openBlock(), createElementBlock("span", _hoisted_2, " ")) : hasParts.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
72
78
|
hasLeading.value ? (openBlock(), createElementBlock("span", {
|
|
73
79
|
key: 0,
|
|
74
80
|
"data-badge-leading": "",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.vue.js","sources":["../../../../src/presentation/display/badge/Badge.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { Size } from '../../../foundation/styles';\nimport type { BadgeBorderStyle, BadgeVariant } from './Badge.variants';\n\nexport interface BadgeProps {\n /** The color treatment. */\n readonly variant?: BadgeVariant;\n /** The size step. */\n readonly size?: Size;\n /** Draws the pill's border in its tint's colour — a status pill rather than a plain label. */\n readonly isOutlined?: boolean;\n /** The border's line style wherever the pill draws one. Default `solid`. */\n readonly borderStyle?: BadgeBorderStyle;\n /** The quieter text after the label — a version, a count, a state's word. The `detail` slot is the rich override. */\n readonly detail?: string;\n /** Turns the leading icon slowly — a state still in progress; it holds still under reduced motion. */\n readonly isSpinning?: boolean;\n /** Draws the pill as its placeholder; defaults to the nearest `DataRegion` first load. */\n readonly isSkeleton?: boolean;\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, useAttrs, useSlots, useTemplateRef } from 'vue';\nimport { cn } from '../../../foundation/styles';\nimport { renderableChildren } from '../../../foundation/primitives';\nimport { useSkeletonState } from '../../feedback/skeletonState/SkeletonStateContext';\nimport { badgeLeadingSize, badgeVariants, isTintedBadge, type BadgeVariants } from './Badge.variants';\n\n/**\n * Renders a non-interactive pill marking a status or category — optionally with a leading icon and a quieter detail\n * after the label, so a status reads by shape as well as colour.\n *\n * Use `Tag` for the clickable pill, `Alert*` for severity-tinted callouts at message scale.\n */\ndefineOptions({ name: 'Badge', inheritAttrs: false });\n\ndefineSlots<{\n /** The badge copy — React's `children`. */\n default(): unknown;\n /** The leading icon; decorative, so the label must carry the meaning. */\n leading?(): unknown;\n /** The rich override for the `detail` prop. */\n detail?(): unknown;\n}>();\n\nconst props = withDefaults(defineProps<BadgeProps>(), {\n isOutlined: false,\n borderStyle: 'solid',\n detail: undefined,\n isSpinning: false,\n isSkeleton: undefined,\n});\n\nconst attrs = useAttrs();\nconst slots = useSlots();\nconst el = useTemplateRef<HTMLSpanElement>('el');\nconst skeleton = useSkeletonState(() => props.isSkeleton);\n\n/** Whether the pill has copy — an empty one still loading keeps a short stand-in width. Read during render. */\nconst hasContent = (): boolean => renderableChildren(slots.default?.()).length > 0;\n\nconst variant = computed(() => props.variant ?? 'neutral');\nconst size = computed(() => (props.size === 'sm' || props.size === 'lg' ? props.size : 'md'));\nconst hasLeading = computed(() => Boolean(slots.leading));\nconst hasDetail = computed(() => Boolean(props.detail) || Boolean(slots.detail));\n\n/* The placeholder merges last: the pill keeps its size, padding and radius while its fill and copy are masked. */\nconst classes = computed(() =>\n cn(\n badgeVariants({\n variant: variant.value,\n size: props.size as BadgeVariants['size'],\n isOutlined: props.isOutlined,\n borderStyle: props.borderStyle,\n hasLeading: hasLeading.value,\n }),\n (hasLeading.value || hasDetail.value) && 'whitespace-nowrap',\n attrs.class as string | undefined,\n skeleton.boxClass.value,\n ),\n);\n\nconst leadingClasses = computed(() =>\n cn(\n 'inline-flex shrink-0',\n badgeLeadingSize[size.value],\n props.isSpinning && 'animate-spin [animation-duration:2s] motion-reduce:animate-none',\n ),\n);\n\n/* A tinted pill keeps its tint on the detail; a neutral one mutes it beside the label. */\nconst detailClasses = computed(() =>\n cn('min-w-0 truncate font-normal tabular-nums', !isTintedBadge(variant.value) && 'text-muted-foreground'),\n);\n\n/** Everything but `class`, which is re-applied through `cn` above. */\nconst rest = computed(() => {\n const { class: _class, ...others } = attrs;\n return others;\n});\n\ndefineExpose({ el });\n</script>\n\n<template>\n <span\n ref=\"el\"\n :data-skeleton=\"skeleton.isSkeleton.value || undefined\"\n :aria-hidden=\"skeleton.isSkeleton.value || undefined\"\n v-bind=\"rest\"\n :class=\"classes\"\n ><span v-if=\"skeleton.isSkeleton.value && !hasContent()\" class=\"inline-block w-[4ch]\"> </span\n ><template v-else-if=\"
|
|
1
|
+
{"version":3,"file":"Badge.vue.js","sources":["../../../../src/presentation/display/badge/Badge.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { Size } from '../../../foundation/styles';\nimport type { BadgeBorderStyle, BadgeVariant } from './Badge.variants';\n\nexport interface BadgeProps {\n /** The color treatment. */\n readonly variant?: BadgeVariant;\n /** The size step. */\n readonly size?: Size;\n /** Draws the pill's border in its tint's colour — a status pill rather than a plain label. */\n readonly isOutlined?: boolean;\n /** The border's line style wherever the pill draws one. Default `solid`. */\n readonly borderStyle?: BadgeBorderStyle;\n /** The quieter text after the label — a version, a count, a state's word. The `detail` slot is the rich override. */\n readonly detail?: string;\n /** Turns the leading icon slowly — a state still in progress; it holds still under reduced motion. */\n readonly isSpinning?: boolean;\n /** Draws the pill as its placeholder; defaults to the nearest `DataRegion` first load. */\n readonly isSkeleton?: boolean;\n /** Lets the pill shrink below its copy in a flex row and cuts the label with an ellipsis; the leading icon stays. */\n readonly isShrinkable?: boolean;\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, useAttrs, useSlots, useTemplateRef } from 'vue';\nimport { cn } from '../../../foundation/styles';\nimport { renderableChildren } from '../../../foundation/primitives';\nimport { useSkeletonState } from '../../feedback/skeletonState/SkeletonStateContext';\nimport { badgeLeadingSize, badgeVariants, isTintedBadge, type BadgeVariants } from './Badge.variants';\n\n/**\n * Renders a non-interactive pill marking a status or category — optionally with a leading icon and a quieter detail\n * after the label, so a status reads by shape as well as colour.\n *\n * Use `Tag` for the clickable pill, `Alert*` for severity-tinted callouts at message scale.\n */\ndefineOptions({ name: 'Badge', inheritAttrs: false });\n\ndefineSlots<{\n /** The badge copy — React's `children`. */\n default(): unknown;\n /** The leading icon; decorative, so the label must carry the meaning. */\n leading?(): unknown;\n /** The rich override for the `detail` prop. */\n detail?(): unknown;\n}>();\n\nconst props = withDefaults(defineProps<BadgeProps>(), {\n isOutlined: false,\n borderStyle: 'solid',\n detail: undefined,\n isSpinning: false,\n isSkeleton: undefined,\n isShrinkable: false,\n});\n\nconst attrs = useAttrs();\nconst slots = useSlots();\nconst el = useTemplateRef<HTMLSpanElement>('el');\nconst skeleton = useSkeletonState(() => props.isSkeleton);\n\n/** Whether the pill has copy — an empty one still loading keeps a short stand-in width. Read during render. */\nconst hasContent = (): boolean => renderableChildren(slots.default?.()).length > 0;\n\nconst variant = computed(() => props.variant ?? 'neutral');\nconst size = computed(() => (props.size === 'sm' || props.size === 'lg' ? props.size : 'md'));\nconst hasLeading = computed(() => Boolean(slots.leading));\nconst hasDetail = computed(() => Boolean(props.detail) || Boolean(slots.detail));\n/** Whether the label sits in its own truncating span: a leading icon or detail beside it, or a shrinkable pill. */\nconst hasParts = computed(() => hasLeading.value || hasDetail.value || props.isShrinkable);\n\n/* The placeholder merges last: the pill keeps its size, padding and radius while its fill and copy are masked. */\nconst classes = computed(() =>\n cn(\n badgeVariants({\n variant: variant.value,\n size: props.size as BadgeVariants['size'],\n isOutlined: props.isOutlined,\n borderStyle: props.borderStyle,\n hasLeading: hasLeading.value,\n isShrinkable: props.isShrinkable,\n }),\n (hasLeading.value || hasDetail.value) && 'whitespace-nowrap',\n attrs.class as string | undefined,\n skeleton.boxClass.value,\n ),\n);\n\nconst leadingClasses = computed(() =>\n cn(\n 'inline-flex shrink-0',\n badgeLeadingSize[size.value],\n props.isSpinning && 'animate-spin [animation-duration:2s] motion-reduce:animate-none',\n ),\n);\n\n/* A tinted pill keeps its tint on the detail; a neutral one mutes it beside the label. */\nconst detailClasses = computed(() =>\n cn('min-w-0 truncate font-normal tabular-nums', !isTintedBadge(variant.value) && 'text-muted-foreground'),\n);\n\n/** Everything but `class`, which is re-applied through `cn` above. */\nconst rest = computed(() => {\n const { class: _class, ...others } = attrs;\n return others;\n});\n\ndefineExpose({ el });\n</script>\n\n<template>\n <span\n ref=\"el\"\n :data-skeleton=\"skeleton.isSkeleton.value || undefined\"\n :aria-hidden=\"skeleton.isSkeleton.value || undefined\"\n v-bind=\"rest\"\n :class=\"classes\"\n ><span v-if=\"skeleton.isSkeleton.value && !hasContent()\" class=\"inline-block w-[4ch]\"> </span\n ><template v-else-if=\"hasParts\"\n ><span v-if=\"hasLeading\" data-badge-leading aria-hidden=\"true\" :class=\"leadingClasses\"\n ><slot name=\"leading\" /></span\n ><span data-badge-label class=\"min-w-0 truncate\"><slot /></span\n ><span v-if=\"hasDetail\" data-detail :class=\"detailClasses\"\n ><slot name=\"detail\">{{ props.detail }}</slot></span\n ></template\n ><slot v-else\n /></span>\n</template>\n"],"names":["_openBlock","_createElementBlock","_mergeProps","_unref","_Fragment","_renderSlot","_createElementVNode","_createTextVNode","_toDisplayString"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,UAAM,QAAQ;AASd,UAAM,QAAQ,SAAA;AACd,UAAM,QAAQ,SAAA;AACd,UAAM,KAAK,eAAgC,IAAI;AAC/C,UAAM,WAAW,iBAAiB,MAAM,MAAM,UAAU;AAGxD,UAAM,aAAa,MAAe,mBAAmB,MAAM,UAAA,CAAW,EAAE,SAAS;AAEjF,UAAM,UAAU,SAAS,MAAM,MAAM,WAAW,SAAS;AACzD,UAAM,OAAO,SAAS,MAAO,MAAM,SAAS,QAAQ,MAAM,SAAS,OAAO,MAAM,OAAO,IAAK;AAC5F,UAAM,aAAa,SAAS,MAAM,QAAQ,MAAM,OAAO,CAAC;AACxD,UAAM,YAAY,SAAS,MAAM,QAAQ,MAAM,MAAM,KAAK,QAAQ,MAAM,MAAM,CAAC;AAE/E,UAAM,WAAW,SAAS,MAAM,WAAW,SAAS,UAAU,SAAS,MAAM,YAAY;AAGzF,UAAM,UAAU;AAAA,MAAS,MACvB;AAAA,QACE,cAAc;AAAA,UACZ,SAAS,QAAQ;AAAA,UACjB,MAAM,MAAM;AAAA,UACZ,YAAY,MAAM;AAAA,UAClB,aAAa,MAAM;AAAA,UACnB,YAAY,WAAW;AAAA,UACvB,cAAc,MAAM;AAAA,QAAA,CACrB;AAAA,SACA,WAAW,SAAS,UAAU,UAAU;AAAA,QACzC,MAAM;AAAA,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KAAA,QAAA,WAAA,CAAA,GAAA,QAAA,QAAA,CAAA;AAAA,MAAA;;;;"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/** Defines when a carousel's arrows show. */
|
|
2
|
+
export declare const CarouselControls: {
|
|
3
|
+
/** Refers to arrows that always show. */
|
|
4
|
+
readonly Always: "always";
|
|
5
|
+
/**
|
|
6
|
+
* Refers to arrows that show while the carousel is hovered or holds focus — and always on a device that cannot
|
|
7
|
+
* hover, where nothing would ever reveal them.
|
|
8
|
+
*/
|
|
9
|
+
readonly Hover: "hover";
|
|
10
|
+
};
|
|
11
|
+
export type CarouselControls = (typeof CarouselControls)[keyof typeof CarouselControls];
|
|
12
|
+
/** Defines the surface a carousel arrow sits on. */
|
|
13
|
+
export declare const CarouselNavVariant: {
|
|
14
|
+
/** Refers to the page-surface chip with a hairline ring — arrows over flat content. */
|
|
15
|
+
readonly Surface: "surface";
|
|
16
|
+
/** Refers to a frosted dark chip with light text — arrows that must read over any photo, in either theme. */
|
|
17
|
+
readonly Glass: "glass";
|
|
18
|
+
};
|
|
19
|
+
export type CarouselNavVariant = (typeof CarouselNavVariant)[keyof typeof CarouselNavVariant];
|
|
20
|
+
/**
|
|
21
|
+
* The step-back / step-forward arrow, shared by `CarouselPrev` and `CarouselNext` — each adds only its side.
|
|
22
|
+
*
|
|
23
|
+
* Opacity is computed here rather than through `disabled:` because a hover-revealed arrow and a dimmed one set the
|
|
24
|
+
* same property under different variants, and the cascade cannot rank `:disabled` against a group hover.
|
|
25
|
+
*/
|
|
26
|
+
export declare const carouselNavVariants: import('tailwind-variants').TVReturnType<{
|
|
27
|
+
variant: {
|
|
28
|
+
surface: "bg-background/80 text-foreground shadow ring-1 ring-border hover:bg-background";
|
|
29
|
+
glass: "border border-white/20 bg-black/35 text-white backdrop-blur-md hover:bg-black/55 active:bg-black/65 [@media(prefers-reduced-transparency:reduce)]:bg-black/70 [@media(prefers-reduced-transparency:reduce)]:backdrop-blur-none";
|
|
30
|
+
};
|
|
31
|
+
controls: {
|
|
32
|
+
always: "";
|
|
33
|
+
hover: "opacity-0 group-hover/carousel:opacity-100 group-focus-within/carousel:opacity-100 [@media(hover:none)]:opacity-100";
|
|
34
|
+
};
|
|
35
|
+
isDisabled: {
|
|
36
|
+
true: "pointer-events-none";
|
|
37
|
+
false: "";
|
|
38
|
+
};
|
|
39
|
+
}, undefined, "absolute top-1/2 inline-flex h-8 w-8 -translate-y-1/2 items-center justify-center rounded-full transition focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring motion-reduce:transition-none", {
|
|
40
|
+
variant: {
|
|
41
|
+
surface: "bg-background/80 text-foreground shadow ring-1 ring-border hover:bg-background";
|
|
42
|
+
glass: "border border-white/20 bg-black/35 text-white backdrop-blur-md hover:bg-black/55 active:bg-black/65 [@media(prefers-reduced-transparency:reduce)]:bg-black/70 [@media(prefers-reduced-transparency:reduce)]:backdrop-blur-none";
|
|
43
|
+
};
|
|
44
|
+
controls: {
|
|
45
|
+
always: "";
|
|
46
|
+
hover: "opacity-0 group-hover/carousel:opacity-100 group-focus-within/carousel:opacity-100 [@media(hover:none)]:opacity-100";
|
|
47
|
+
};
|
|
48
|
+
isDisabled: {
|
|
49
|
+
true: "pointer-events-none";
|
|
50
|
+
false: "";
|
|
51
|
+
};
|
|
52
|
+
}, undefined, import('tailwind-variants').TVReturnTypeLike<{
|
|
53
|
+
variant: {
|
|
54
|
+
surface: "bg-background/80 text-foreground shadow ring-1 ring-border hover:bg-background";
|
|
55
|
+
glass: "border border-white/20 bg-black/35 text-white backdrop-blur-md hover:bg-black/55 active:bg-black/65 [@media(prefers-reduced-transparency:reduce)]:bg-black/70 [@media(prefers-reduced-transparency:reduce)]:backdrop-blur-none";
|
|
56
|
+
};
|
|
57
|
+
controls: {
|
|
58
|
+
always: "";
|
|
59
|
+
hover: "opacity-0 group-hover/carousel:opacity-100 group-focus-within/carousel:opacity-100 [@media(hover:none)]:opacity-100";
|
|
60
|
+
};
|
|
61
|
+
isDisabled: {
|
|
62
|
+
true: "pointer-events-none";
|
|
63
|
+
false: "";
|
|
64
|
+
};
|
|
65
|
+
}, undefined>>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { tv } from "tailwind-variants";
|
|
2
|
+
const CarouselControls = {
|
|
3
|
+
/** Refers to arrows that always show. */
|
|
4
|
+
Always: "always",
|
|
5
|
+
/**
|
|
6
|
+
* Refers to arrows that show while the carousel is hovered or holds focus — and always on a device that cannot
|
|
7
|
+
* hover, where nothing would ever reveal them.
|
|
8
|
+
*/
|
|
9
|
+
Hover: "hover"
|
|
10
|
+
};
|
|
11
|
+
const CarouselNavVariant = {
|
|
12
|
+
/** Refers to the page-surface chip with a hairline ring — arrows over flat content. */
|
|
13
|
+
Surface: "surface",
|
|
14
|
+
/** Refers to a frosted dark chip with light text — arrows that must read over any photo, in either theme. */
|
|
15
|
+
Glass: "glass"
|
|
16
|
+
};
|
|
17
|
+
const carouselNavVariants = tv({
|
|
18
|
+
base: "absolute top-1/2 inline-flex h-8 w-8 -translate-y-1/2 items-center justify-center rounded-full transition focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring motion-reduce:transition-none",
|
|
19
|
+
variants: {
|
|
20
|
+
variant: {
|
|
21
|
+
surface: "bg-background/80 text-foreground shadow ring-1 ring-border hover:bg-background",
|
|
22
|
+
/* The image-overlay glass of the harvest console card: a fixed dark wash reads over any photo; without
|
|
23
|
+
transparency the wash turns solid enough to carry the white glyph alone. */
|
|
24
|
+
glass: "border border-white/20 bg-black/35 text-white backdrop-blur-md hover:bg-black/55 active:bg-black/65 [@media(prefers-reduced-transparency:reduce)]:bg-black/70 [@media(prefers-reduced-transparency:reduce)]:backdrop-blur-none"
|
|
25
|
+
},
|
|
26
|
+
controls: {
|
|
27
|
+
always: "",
|
|
28
|
+
/* `group/carousel` is the root; Tailwind's hover variant applies only where the pointer can hover, so the
|
|
29
|
+
`(hover: none)` arm is what keeps the arrows on a touch screen. */
|
|
30
|
+
hover: "opacity-0 group-hover/carousel:opacity-100 group-focus-within/carousel:opacity-100 [@media(hover:none)]:opacity-100"
|
|
31
|
+
},
|
|
32
|
+
isDisabled: {
|
|
33
|
+
true: "pointer-events-none",
|
|
34
|
+
false: ""
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
compoundVariants: [
|
|
38
|
+
{ controls: "always", isDisabled: true, class: "opacity-40" },
|
|
39
|
+
{
|
|
40
|
+
controls: "hover",
|
|
41
|
+
isDisabled: true,
|
|
42
|
+
class: "group-hover/carousel:opacity-40 group-focus-within/carousel:opacity-40 [@media(hover:none)]:opacity-40"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
defaultVariants: {
|
|
46
|
+
variant: "surface",
|
|
47
|
+
controls: "always",
|
|
48
|
+
isDisabled: false
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
export {
|
|
52
|
+
CarouselControls,
|
|
53
|
+
CarouselNavVariant,
|
|
54
|
+
carouselNavVariants
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=Carousel.variants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Carousel.variants.js","sources":["../../../../src/presentation/display/carousel/Carousel.variants.ts"],"sourcesContent":["import { tv, type VariantProps } from '../../../foundation/styles';\n\n/** Defines when a carousel's arrows show. */\nexport const CarouselControls = {\n /** Refers to arrows that always show. */\n Always: 'always',\n /**\n * Refers to arrows that show while the carousel is hovered or holds focus — and always on a device that cannot\n * hover, where nothing would ever reveal them.\n */\n Hover: 'hover',\n} as const;\n\nexport type CarouselControls = (typeof CarouselControls)[keyof typeof CarouselControls];\n\n/** Defines the surface a carousel arrow sits on. */\nexport const CarouselNavVariant = {\n /** Refers to the page-surface chip with a hairline ring — arrows over flat content. */\n Surface: 'surface',\n /** Refers to a frosted dark chip with light text — arrows that must read over any photo, in either theme. */\n Glass: 'glass',\n} as const;\n\nexport type CarouselNavVariant = (typeof CarouselNavVariant)[keyof typeof CarouselNavVariant];\n\n/**\n * The step-back / step-forward arrow, shared by `CarouselPrev` and `CarouselNext` — each adds only its side.\n *\n * Opacity is computed here rather than through `disabled:` because a hover-revealed arrow and a dimmed one set the\n * same property under different variants, and the cascade cannot rank `:disabled` against a group hover.\n */\nexport const carouselNavVariants = tv({\n base: 'absolute top-1/2 inline-flex h-8 w-8 -translate-y-1/2 items-center justify-center rounded-full transition focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring motion-reduce:transition-none',\n variants: {\n variant: {\n surface: 'bg-background/80 text-foreground shadow ring-1 ring-border hover:bg-background',\n /* The image-overlay glass of the harvest console card: a fixed dark wash reads over any photo; without\n transparency the wash turns solid enough to carry the white glyph alone. */\n glass:\n 'border border-white/20 bg-black/35 text-white backdrop-blur-md hover:bg-black/55 active:bg-black/65 [@media(prefers-reduced-transparency:reduce)]:bg-black/70 [@media(prefers-reduced-transparency:reduce)]:backdrop-blur-none',\n },\n controls: {\n always: '',\n /* `group/carousel` is the root; Tailwind's hover variant applies only where the pointer can hover, so the\n `(hover: none)` arm is what keeps the arrows on a touch screen. */\n hover:\n 'opacity-0 group-hover/carousel:opacity-100 group-focus-within/carousel:opacity-100 [@media(hover:none)]:opacity-100',\n },\n isDisabled: {\n true: 'pointer-events-none',\n false: '',\n },\n },\n compoundVariants: [\n { controls: 'always', isDisabled: true, class: 'opacity-40' },\n {\n controls: 'hover',\n isDisabled: true,\n class: 'group-hover/carousel:opacity-40 group-focus-within/carousel:opacity-40 [@media(hover:none)]:opacity-40',\n },\n ],\n defaultVariants: {\n variant: 'surface',\n controls: 'always',\n isDisabled: false,\n },\n});\n\n/* Compile-time lock: enum values ≡ tv variant value-set (drift = type error). */\ntype AssertExact<A, B> = [A] extends [B] ? ([B] extends [A] ? true : never) : never;\nconst _assertNavVariant: AssertExact<\n CarouselNavVariant,\n NonNullable<VariantProps<typeof carouselNavVariants>['variant']>\n> = true;\nconst _assertControls: AssertExact<\n CarouselControls,\n NonNullable<VariantProps<typeof carouselNavVariants>['controls']>\n> = true;\nvoid _assertNavVariant;\nvoid _assertControls;\n"],"names":[],"mappings":";AAGO,MAAM,mBAAmB;AAAA;AAAA,EAE9B,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA,EAKR,OAAO;AACT;AAKO,MAAM,qBAAqB;AAAA;AAAA,EAEhC,SAAS;AAAA;AAAA,EAET,OAAO;AACT;AAUO,MAAM,sBAAsB,GAAG;AAAA,EACpC,MAAM;AAAA,EACN,UAAU;AAAA,IACR,SAAS;AAAA,MACP,SAAS;AAAA;AAAA;AAAA,MAGT,OACE;AAAA,IAAA;AAAA,IAEJ,UAAU;AAAA,MACR,QAAQ;AAAA;AAAA;AAAA,MAGR,OACE;AAAA,IAAA;AAAA,IAEJ,YAAY;AAAA,MACV,MAAM;AAAA,MACN,OAAO;AAAA,IAAA;AAAA,EACT;AAAA,EAEF,kBAAkB;AAAA,IAChB,EAAE,UAAU,UAAU,YAAY,MAAM,OAAO,aAAA;AAAA,IAC/C;AAAA,MACE,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,OAAO;AAAA,IAAA;AAAA,EACT;AAAA,EAEF,iBAAiB;AAAA,IACf,SAAS;AAAA,IACT,UAAU;AAAA,IACV,YAAY;AAAA,EAAA;AAEhB,CAAC;"}
|