fancy-ui-vue 0.1.1 → 0.3.0
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/PORTING.md +123 -2
- package/README.md +40 -13
- package/dist/components/accordion/Accordion.vue.d.ts +44 -0
- package/dist/components/accordion/Accordion.vue.js +88 -0
- package/dist/components/accordion/Accordion.vue2.js +4 -0
- package/dist/components/accordion/AccordionContent.vue.d.ts +25 -0
- package/dist/components/accordion/AccordionContent.vue.js +42 -0
- package/dist/components/accordion/AccordionContent.vue2.js +4 -0
- package/dist/components/accordion/AccordionItem.vue.d.ts +21 -0
- package/dist/components/accordion/AccordionItem.vue.js +66 -0
- package/dist/components/accordion/AccordionItem.vue2.js +4 -0
- package/dist/components/accordion/AccordionTrigger.vue.d.ts +24 -0
- package/dist/components/accordion/AccordionTrigger.vue.js +83 -0
- package/dist/components/accordion/AccordionTrigger.vue2.js +4 -0
- package/dist/components/accordion/accordion-core.d.ts +35 -0
- package/dist/components/accordion/accordion-core.js +44 -0
- package/dist/components/accordion/index.d.ts +11 -0
- package/dist/components/accordion/types.d.ts +45 -0
- package/dist/components/accordion/types.js +7 -0
- package/dist/components/alert-dialog/AlertDialog.vue.js +22 -3
- package/dist/components/animated-testimonials/AnimatedTestimonials.vue.js +3 -3
- package/dist/components/apple-card-carousel/AppleCard.vue.js +1 -1
- package/dist/components/autocomplete/Autocomplete.vue.js +1 -1
- package/dist/components/autocomplete/Autocomplete.vue2.js +22 -15
- package/dist/components/avatar/Avatar.vue.d.ts +27 -0
- package/dist/components/avatar/Avatar.vue.js +119 -0
- package/dist/components/avatar/Avatar.vue2.js +4 -0
- package/dist/components/avatar/avatar-core.d.ts +40 -0
- package/dist/components/avatar/avatar-core.js +57 -0
- package/dist/components/avatar/index.d.ts +2 -0
- package/dist/components/badge/Badge.vue.d.ts +21 -0
- package/dist/components/badge/Badge.vue.js +46 -0
- package/dist/components/badge/Badge.vue2.js +4 -0
- package/dist/components/badge/index.d.ts +2 -0
- package/dist/components/bento-grid/BentoFrame.vue.js +1 -1
- package/dist/components/bento-grid/BentoFrame.vue2.js +6 -5
- package/dist/components/bento-grid/BentoGrid.vue.js +1 -1
- package/dist/components/bento-grid/BentoGrid.vue2.js +12 -12
- package/dist/components/bento-grid/BentoGridCard.vue.js +6 -5
- package/dist/components/bento-grid/BentoGridItem.vue.js +6 -5
- package/dist/components/bg-falling-stars/FallingStarsBg.vue.d.ts +1 -1
- package/dist/components/bg-falling-stars/FallingStarsBg.vue.js +1 -1
- package/dist/components/bg-falling-stars/bg-falling-stars-core.d.ts +1 -1
- package/dist/components/bg-falling-stars/bg-falling-stars-core.js +47 -12
- package/dist/components/book/Book.vue.js +8 -9
- package/dist/components/book/BookDescription.vue.js +6 -5
- package/dist/components/book/BookHeader.vue.js +6 -5
- package/dist/components/book/BookTitle.vue.js +6 -5
- package/dist/components/box-reveal/BoxReveal.vue.js +6 -5
- package/dist/components/button/Button.vue.d.ts +6 -4
- package/dist/components/button/Button.vue.js +1 -1
- package/dist/components/button/Button.vue2.js +50 -22
- package/dist/components/card-3d/CardContainer.vue.js +1 -1
- package/dist/components/card-3d/CardItem.vue.js +1 -1
- package/dist/components/card-spotlight/CardSpotlight.vue.js +1 -1
- package/dist/components/chat-message/ChatMessageAction.vue.d.ts +4 -2
- package/dist/components/chat-message/ChatMessageAction.vue.js +4 -2
- package/dist/components/checkbox/Checkbox.vue.d.ts +2 -0
- package/dist/components/checkbox/Checkbox.vue.js +1 -1
- package/dist/components/checkbox/Checkbox.vue2.js +17 -7
- package/dist/components/collapsible/Collapsible.vue.d.ts +31 -0
- package/dist/components/collapsible/Collapsible.vue.js +60 -0
- package/dist/components/collapsible/Collapsible.vue2.js +4 -0
- package/dist/components/collapsible/CollapsibleContent.vue.d.ts +26 -0
- package/dist/components/collapsible/CollapsibleContent.vue.js +81 -0
- package/dist/components/collapsible/CollapsibleContent.vue2.js +4 -0
- package/dist/components/collapsible/CollapsibleTrigger.vue.d.ts +21 -0
- package/dist/components/collapsible/CollapsibleTrigger.vue.js +57 -0
- package/dist/components/collapsible/CollapsibleTrigger.vue2.js +4 -0
- package/dist/components/collapsible/collapsible-core.d.ts +47 -0
- package/dist/components/collapsible/collapsible-core.js +40 -0
- package/dist/components/collapsible/index.d.ts +8 -0
- package/dist/components/collapsible/types.d.ts +24 -0
- package/dist/components/collapsible/types.js +5 -0
- package/dist/components/combobox/Combobox.vue.js +1 -1
- package/dist/components/combobox/Combobox.vue2.js +24 -16
- package/dist/components/command-menu/CommandMenu.vue.d.ts +5 -0
- package/dist/components/command-menu/CommandMenu.vue.js +1 -1
- package/dist/components/command-menu/CommandMenu.vue2.js +5 -2
- package/dist/components/compare/Compare.vue.d.ts +15 -5
- package/dist/components/compare/Compare.vue.js +1 -1
- package/dist/components/compare/Compare.vue2.js +28 -13
- package/dist/components/composer/ComposerInput.vue.js +1 -1
- package/dist/components/composer/ComposerInput.vue2.js +11 -11
- package/dist/components/composer/ComposerModelPicker.vue.d.ts +4 -0
- package/dist/components/composer/ComposerModelPicker.vue.js +1 -1
- package/dist/components/composer/ComposerModelPicker.vue2.js +29 -15
- package/dist/components/composer/ComposerSubmit.vue.d.ts +2 -0
- package/dist/components/composer/ComposerSubmit.vue.js +16 -15
- package/dist/components/confetti/ConfettiButton.vue.d.ts +9 -2
- package/dist/components/confetti/ConfettiButton.vue.js +24 -6
- package/dist/components/container-text-flip/ContainerTextFlip.vue.js +1 -1
- package/dist/components/container-text-flip/ContainerTextFlip.vue2.js +12 -13
- package/dist/components/copy-button/CopyButton.vue.d.ts +5 -0
- package/dist/components/copy-button/CopyButton.vue.js +1 -1
- package/dist/components/copy-button/CopyButton.vue2.js +72 -11
- package/dist/components/datamosh-transition/DatamoshTransition.vue.d.ts +6 -2
- package/dist/components/datamosh-transition/DatamoshTransition.vue.js +7 -4
- package/dist/components/date-picker/DatePicker.vue.js +1 -1
- package/dist/components/date-picker/DatePicker.vue2.js +27 -21
- package/dist/components/dialog/Dialog.vue.js +20 -1
- package/dist/components/dialog/DialogSurface.vue.js +1 -1
- package/dist/components/dialog/DialogSurface.vue2.js +5 -2
- package/dist/components/dialog/types.d.ts +2 -0
- package/dist/components/direction-aware-hover/DirectionAwareHover.vue.js +1 -1
- package/dist/components/direction-aware-hover/DirectionAwareHover.vue2.js +9 -7
- package/dist/components/displacement-text/DisplacementText.vue.d.ts +4 -1
- package/dist/components/displacement-text/DisplacementText.vue.js +38 -11
- package/dist/components/displacement-text/displacement-text-core.d.ts +94 -4
- package/dist/components/displacement-text/displacement-text-core.js +287 -97
- package/dist/components/drawer/Drawer.vue.d.ts +5 -0
- package/dist/components/drawer/Drawer.vue.js +1 -1
- package/dist/components/drawer/Drawer.vue2.js +5 -2
- package/dist/components/dropdown-menu/DropdownMenuContent.vue.js +2 -1
- package/dist/components/dropdown-menu/DropdownMenuItem.vue.d.ts +4 -0
- package/dist/components/dropdown-menu/DropdownMenuItem.vue.js +17 -10
- package/dist/components/dropdown-menu/DropdownMenuSubTrigger.vue.d.ts +8 -0
- package/dist/components/dropdown-menu/DropdownMenuSubTrigger.vue.js +28 -13
- package/dist/components/dropdown-menu/DropdownMenuTrigger.vue.d.ts +4 -0
- package/dist/components/dropdown-menu/DropdownMenuTrigger.vue.js +1 -1
- package/dist/components/dropdown-menu/DropdownMenuTrigger.vue2.js +20 -10
- package/dist/components/editorial-engine/EditorialEngine.vue.js +1 -1
- package/dist/components/editorial-engine/engine.js +13 -0
- package/dist/components/file-upload/FileUpload.vue.d.ts +2 -0
- package/dist/components/file-upload/FileUpload.vue.js +1 -1
- package/dist/components/file-upload/FileUpload.vue2.js +20 -10
- package/dist/components/fireworks-hdr/FireworksHdr.vue.js +2 -2
- package/dist/components/flickering-grid/FlickeringGrid.vue.d.ts +1 -1
- package/dist/components/flickering-grid/FlickeringGrid.vue.js +1 -1
- package/dist/components/flickering-grid/flickering-grid-core.d.ts +1 -1
- package/dist/components/flickering-grid/flickering-grid-core.js +51 -9
- package/dist/components/flip-card/FlipCard.vue.d.ts +3 -1
- package/dist/components/flip-card/FlipCard.vue.js +1 -1
- package/dist/components/flip-card/FlipCard.vue2.js +5 -3
- package/dist/components/fluid-cursor/FluidCursor.vue.js +37 -9
- package/dist/components/fluid-cursor/fluid-cursor-core.js +3 -3
- package/dist/components/fluid-cursor/webgpu-engine.js +3 -3
- package/dist/components/focus/Focus.vue.js +1 -1
- package/dist/components/focus/Focus.vue2.js +2 -2
- package/dist/components/follow-button/FollowButton.vue.d.ts +69 -0
- package/dist/components/follow-button/FollowButton.vue.js +7 -0
- package/dist/components/follow-button/FollowButton.vue2.js +239 -0
- package/dist/components/follow-button/follow-core.d.ts +83 -0
- package/dist/components/follow-button/follow-core.js +92 -0
- package/dist/components/follow-button/index.d.ts +2 -0
- package/dist/components/frosted-glass/FrostedGlass.vue.js +1 -1
- package/dist/components/glare-card/GlareCard.vue.js +1 -1
- package/dist/components/glare-card/GlareCard.vue2.js +4 -4
- package/dist/components/glowing-effect/GlowingEffect.vue.js +3 -3
- package/dist/components/glowing-effect/glowing-effect-core.js +4 -1
- package/dist/components/gradient-button/GradientButton.vue.d.ts +6 -4
- package/dist/components/gradient-button/GradientButton.vue.js +1 -1
- package/dist/components/gradient-button/GradientButton.vue2.js +13 -3
- package/dist/components/icon-button/IconButton.vue.d.ts +6 -4
- package/dist/components/icon-button/IconButton.vue.js +11 -8
- package/dist/components/image-trail-cursor/ImageTrailCursor.vue.js +17 -7
- package/dist/components/image-trail-cursor/trail-variants.js +3 -6
- package/dist/components/inline-citation/InlineCitation.vue.js +1 -1
- package/dist/components/inline-citation/InlineCitation.vue2.js +20 -14
- package/dist/components/input/Input.vue.js +1 -1
- package/dist/components/input/Input.vue2.js +18 -8
- package/dist/components/interactive-grid-pattern/InteractiveGridPattern.vue.js +1 -1
- package/dist/components/interactive-grid-pattern/InteractiveGridPattern.vue2.js +1 -1
- package/dist/components/interactive-hover-button/InteractiveHoverButton.vue.d.ts +6 -3
- package/dist/components/interactive-hover-button/InteractiveHoverButton.vue.js +1 -1
- package/dist/components/interactive-hover-button/InteractiveHoverButton.vue2.js +12 -2
- package/dist/components/letter-pullup/LetterPullup.vue.js +4 -4
- package/dist/components/line-hover-link/LineHoverLink.vue.js +1 -1
- package/dist/components/line-hover-link/LineHoverLink.vue2.js +5 -6
- package/dist/components/link/Link.vue.d.ts +4 -2
- package/dist/components/link/Link.vue.js +1 -1
- package/dist/components/link/Link.vue2.js +11 -8
- package/dist/components/mosaic-glow/MosaicGlow.vue.d.ts +6 -0
- package/dist/components/mosaic-glow/MosaicGlow.vue.js +53 -9
- package/dist/components/mosaic-glow/mosaic-glow-core.d.ts +30 -0
- package/dist/components/mosaic-glow/mosaic-glow-core.js +27 -0
- package/dist/components/mosaic-glow/mosaic-glow-hdr.d.ts +24 -0
- package/dist/components/mosaic-glow/mosaic-glow-hdr.js +200 -0
- package/dist/components/navbar/NavbarLink.vue.d.ts +4 -2
- package/dist/components/navbar/NavbarLink.vue.js +1 -1
- package/dist/components/navbar/NavbarLink.vue2.js +16 -13
- package/dist/components/navigation-menu/NavigationMenu.vue.js +6 -3
- package/dist/components/navigation-menu/NavigationMenuLink.vue.js +1 -1
- package/dist/components/navigation-menu/NavigationMenuLink.vue2.js +8 -8
- package/dist/components/navigation-menu/NavigationMenuTrigger.vue.d.ts +15 -0
- package/dist/components/navigation-menu/NavigationMenuTrigger.vue.js +1 -1
- package/dist/components/navigation-menu/NavigationMenuTrigger.vue2.js +36 -15
- package/dist/components/neon-border/NeonBorder.vue.js +1 -1
- package/dist/components/neon-border/NeonBorder.vue2.js +10 -11
- package/dist/components/number-input/NumberInput.vue.js +1 -1
- package/dist/components/number-input/NumberInput.vue2.js +22 -12
- package/dist/components/password-input/PasswordInput.vue.js +1 -1
- package/dist/components/password-input/PasswordInput.vue2.js +18 -11
- package/dist/components/pixel-loader/PixelLoader.vue.js +1 -1
- package/dist/components/pixel-loader/PixelLoader.vue2.js +6 -6
- package/dist/components/popover/Popover.vue.d.ts +4 -0
- package/dist/components/popover/Popover.vue.js +1 -1
- package/dist/components/popover/Popover.vue2.js +8 -6
- package/dist/components/popover/PopoverContent.vue.js +6 -2
- package/dist/components/pulse-beam/PulseBeam.vue.d.ts +6 -2
- package/dist/components/pulse-beam/PulseBeam.vue.js +1 -1
- package/dist/components/pulse-beam/PulseBeam.vue2.js +7 -4
- package/dist/components/radio-group/RadioGroup.vue.js +12 -11
- package/dist/components/radio-group/RadioGroupItem.vue.d.ts +2 -0
- package/dist/components/radio-group/RadioGroupItem.vue.js +1 -1
- package/dist/components/radio-group/RadioGroupItem.vue2.js +20 -7
- package/dist/components/rainbow-button/RainbowButton.vue.d.ts +11 -2
- package/dist/components/rainbow-button/RainbowButton.vue.js +1 -1
- package/dist/components/rainbow-button/RainbowButton.vue2.js +35 -18
- package/dist/components/ripple-button/RippleButton.vue.d.ts +6 -4
- package/dist/components/ripple-button/RippleButton.vue.js +1 -1
- package/dist/components/ripple-button/RippleButton.vue2.js +10 -5
- package/dist/components/search-input/SearchInput.vue.js +1 -1
- package/dist/components/search-input/SearchInput.vue2.js +19 -9
- package/dist/components/select/Select.vue.d.ts +1 -1
- package/dist/components/select/Select.vue.js +1 -1
- package/dist/components/select/Select.vue2.js +25 -17
- package/dist/components/sheet/Sheet.vue.d.ts +5 -0
- package/dist/components/sheet/Sheet.vue.js +5 -2
- package/dist/components/shimmer-button/ShimmerButton.vue.d.ts +2 -2
- package/dist/components/shimmer-button/ShimmerButton.vue.js +1 -1
- package/dist/components/shimmer-button/ShimmerButton.vue2.js +14 -6
- package/dist/components/sidebar/SidebarItem.vue.d.ts +4 -2
- package/dist/components/sidebar/SidebarItem.vue.js +1 -1
- package/dist/components/sidebar/SidebarItem.vue2.js +4 -2
- package/dist/components/slider/Slider.vue.d.ts +4 -0
- package/dist/components/slider/Slider.vue.js +1 -1
- package/dist/components/slider/Slider.vue2.js +20 -8
- package/dist/components/sources/SourcesTrigger.vue.js +1 -1
- package/dist/components/sources/SourcesTrigger.vue2.js +11 -11
- package/dist/components/sparkles/sparkles-core.d.ts +1 -1
- package/dist/components/sparkles/sparkles-core.js +36 -2
- package/dist/components/switch/Switch.vue.d.ts +2 -0
- package/dist/components/switch/Switch.vue.js +1 -1
- package/dist/components/switch/Switch.vue2.js +16 -6
- package/dist/components/tabs/TabsTrigger.vue.d.ts +6 -0
- package/dist/components/tabs/TabsTrigger.vue.js +1 -1
- package/dist/components/tabs/TabsTrigger.vue2.js +28 -15
- package/dist/components/terminal-block/TerminalBlock.vue.js +1 -1
- package/dist/components/terminal-block/TerminalBlock.vue2.js +10 -9
- package/dist/components/text-reveal-card/TextRevealCard.vue.js +1 -2
- package/dist/components/textarea/Textarea.vue.js +1 -1
- package/dist/components/textarea/Textarea.vue2.js +19 -12
- package/dist/components/tick-nav/TickNav.vue.d.ts +71 -0
- package/dist/components/tick-nav/TickNav.vue.js +7 -0
- package/dist/components/tick-nav/TickNav.vue2.js +285 -0
- package/dist/components/tick-nav/index.d.ts +3 -0
- package/dist/components/tick-nav/tick-nav-core.d.ts +102 -0
- package/dist/components/tick-nav/tick-nav-core.js +398 -0
- package/dist/components/tick-nav/tick-nav-hdr.d.ts +60 -0
- package/dist/components/tick-nav/tick-nav-hdr.js +284 -0
- package/dist/components/tick-nav/types.d.ts +13 -0
- package/dist/components/time-picker/TimePicker.vue.js +1 -1
- package/dist/components/time-picker/TimePicker.vue2.js +25 -17
- package/dist/components/toast/Toast.vue.js +1 -1
- package/dist/components/toast/Toast.vue2.js +16 -4
- package/dist/components/toast/index.d.ts +1 -1
- package/dist/components/toast/store.d.ts +23 -0
- package/dist/components/toast/store.js +35 -7
- package/dist/components/toggle/Toggle.vue.d.ts +12 -0
- package/dist/components/toggle/Toggle.vue.js +1 -1
- package/dist/components/toggle/Toggle.vue2.js +27 -11
- package/dist/components/toggle-group/ToggleGroup.vue.d.ts +11 -0
- package/dist/components/toggle-group/ToggleGroup.vue.js +1 -1
- package/dist/components/toggle-group/ToggleGroup.vue2.js +16 -3
- package/dist/components/toggle-group/ToggleGroupItem.vue.d.ts +6 -0
- package/dist/components/toggle-group/ToggleGroupItem.vue.js +1 -1
- package/dist/components/toggle-group/ToggleGroupItem.vue2.js +27 -14
- package/dist/components/tooltip/Tooltip.vue.js +13 -0
- package/dist/components/typing-indicator/TypingIndicator.vue.js +1 -1
- package/dist/components/typing-indicator/TypingIndicator.vue2.js +7 -6
- package/dist/index.d.ts +6 -0
- package/dist/index.js +440 -413
- package/dist/internals/anchor-position.js +3 -0
- package/dist/internals/call-listener.d.ts +11 -0
- package/dist/internals/call-listener.js +31 -0
- package/dist/internals/dismissable.d.ts +17 -0
- package/dist/internals/dismissable.js +44 -1
- package/dist/internals/env.d.ts +1 -0
- package/dist/internals/env.js +11 -0
- package/dist/internals/focus-trap.js +29 -4
- package/dist/internals/merge-ids.d.ts +6 -0
- package/dist/internals/merge-ids.js +11 -0
- package/dist/internals/motion/presence-core.d.ts +1 -1
- package/dist/sound/engine.js +23 -9
- package/dist/sound/themes.d.ts +4 -3
- package/dist/sound/themes.js +49 -211
- package/dist/sound/types.d.ts +9 -1
- package/dist/sound/types.js +2 -2
- package/dist/styles.css +974 -571
- package/package.json +2 -2
- package/tailwind.css +9 -9
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { defineComponent, useTemplateRef, computed, createElementBlock, openBlock,
|
|
1
|
+
import { defineComponent, useAttrs, useTemplateRef, computed, createElementBlock, openBlock, mergeProps, unref, createCommentVNode, renderSlot, createVNode, Transition, withCtx } from "vue";
|
|
2
|
+
import { callListener } from "../../internals/call-listener.js";
|
|
2
3
|
import { cn } from "../../utils.js";
|
|
3
4
|
import { sound } from "../../sound/sound.js";
|
|
5
|
+
import { useSoundFeedback } from "../../sound/use-sound-feedback.js";
|
|
4
6
|
import { prefersReducedMotion } from "../../internals/motion/anchored.js";
|
|
5
7
|
import { DURATIONS } from "../../internals/motion/tokens.js";
|
|
6
8
|
import { linear } from "../../internals/motion/easing.js";
|
|
@@ -39,11 +41,22 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
39
41
|
rel: { default: () => void 0 },
|
|
40
42
|
fullWidth: { type: Boolean, default: false },
|
|
41
43
|
label: { default: () => void 0 },
|
|
42
|
-
|
|
44
|
+
onClick: { type: [Function, Array] },
|
|
45
|
+
onclick: { type: [Function, Array] },
|
|
43
46
|
class: { type: [Boolean, null, String, Object, Array] },
|
|
44
47
|
sound: { type: Boolean, default: false }
|
|
45
48
|
},
|
|
46
49
|
setup(__props, { expose: __expose }) {
|
|
50
|
+
const attrs = useAttrs();
|
|
51
|
+
function forwarded() {
|
|
52
|
+
const blocked = __props.disabled || __props.loading;
|
|
53
|
+
if (!blocked && !__props.href) return attrs;
|
|
54
|
+
return Object.fromEntries(
|
|
55
|
+
Object.entries(attrs).filter(
|
|
56
|
+
([key]) => !(blocked && /^onClick/.test(key)) && !(__props.href && (/^onAuxclick$/i.test(key) || blocked && /^onAuxclick/i.test(key)))
|
|
57
|
+
)
|
|
58
|
+
);
|
|
59
|
+
}
|
|
47
60
|
const el = useTemplateRef("el");
|
|
48
61
|
__expose({ ref: el });
|
|
49
62
|
const SIZE_CLASSES = {
|
|
@@ -77,7 +90,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
77
90
|
// `data-disabled` covers the anchor branch, which has no native `:disabled`
|
|
78
91
|
// pseudo-class to hang the same dimmed treatment off. It tracks `disabled`
|
|
79
92
|
// alone, never `loading` — `aria-disabled` also goes true while loading (see
|
|
80
|
-
// `
|
|
93
|
+
// `anchorBlocked` below), but the mockup's loading swatch is explicitly not
|
|
81
94
|
// dimmed, so the visual hook and the a11y attribute must stay two different
|
|
82
95
|
// things even though they overlap when `disabled` is set.
|
|
83
96
|
"disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
@@ -95,7 +108,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
95
108
|
tokens.add("noreferrer");
|
|
96
109
|
return [...tokens].join(" ");
|
|
97
110
|
});
|
|
98
|
-
const anchorInert = computed(() => __props.disabled
|
|
111
|
+
const anchorInert = computed(() => __props.disabled);
|
|
112
|
+
const anchorBlocked = computed(() => __props.disabled || __props.loading);
|
|
113
|
+
useSoundFeedback(el, () => ({
|
|
114
|
+
on: __props.sound ? { pointerenter: "hover" } : {},
|
|
115
|
+
disabled: anchorBlocked.value
|
|
116
|
+
}));
|
|
99
117
|
function leadFade() {
|
|
100
118
|
return prefersReducedMotion() ? 0 : DURATIONS.micro;
|
|
101
119
|
}
|
|
@@ -119,30 +137,39 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
119
137
|
leadRuns.get(node)?.abort();
|
|
120
138
|
leadRuns.delete(node);
|
|
121
139
|
}
|
|
140
|
+
function handleAuxClick(event) {
|
|
141
|
+
if (__props.disabled || __props.loading) {
|
|
142
|
+
event.preventDefault();
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
callListener(attrs.onAuxclick ?? attrs.onAuxClick, event);
|
|
146
|
+
}
|
|
122
147
|
function handleClick(event) {
|
|
123
148
|
if (__props.disabled || __props.loading) {
|
|
124
149
|
event.preventDefault();
|
|
125
150
|
return;
|
|
126
151
|
}
|
|
127
152
|
if (__props.sound) sound.play("press");
|
|
128
|
-
__props.onclick
|
|
153
|
+
callListener(__props.onClick ?? __props.onclick, event);
|
|
129
154
|
}
|
|
130
155
|
return (_ctx, _cache) => {
|
|
131
|
-
return __props.href ? (openBlock(), createElementBlock("a", {
|
|
156
|
+
return __props.href ? (openBlock(), createElementBlock("a", mergeProps({
|
|
132
157
|
key: 0,
|
|
133
158
|
ref_key: "el",
|
|
134
|
-
ref: el
|
|
135
|
-
|
|
159
|
+
ref: el
|
|
160
|
+
}, forwarded(), {
|
|
161
|
+
class: classes.value,
|
|
136
162
|
href: anchorInert.value ? void 0 : __props.href,
|
|
137
163
|
target: anchorInert.value ? void 0 : __props.target,
|
|
138
164
|
rel: resolvedRel.value,
|
|
139
|
-
"aria-label": __props.label,
|
|
140
|
-
"data-disabled": __props.disabled ? "true" :
|
|
141
|
-
"aria-disabled":
|
|
142
|
-
"aria-busy": __props.loading ? "true" :
|
|
143
|
-
tabindex: anchorInert.value ? -1 :
|
|
144
|
-
onClick: handleClick
|
|
145
|
-
|
|
165
|
+
"aria-label": __props.label ?? unref(attrs)["aria-label"],
|
|
166
|
+
"data-disabled": __props.disabled ? "true" : unref(attrs)["data-disabled"],
|
|
167
|
+
"aria-disabled": anchorBlocked.value ? "true" : unref(attrs)["aria-disabled"],
|
|
168
|
+
"aria-busy": __props.loading ? "true" : unref(attrs)["aria-busy"],
|
|
169
|
+
tabindex: anchorInert.value ? -1 : unref(attrs).tabindex,
|
|
170
|
+
onClick: handleClick,
|
|
171
|
+
onAuxclick: handleAuxClick
|
|
172
|
+
}), [
|
|
146
173
|
__props.loading || _ctx.$slots.iconStart ? (openBlock(), createElementBlock("span", {
|
|
147
174
|
key: 0,
|
|
148
175
|
class: "ft-btn-lead",
|
|
@@ -165,17 +192,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
165
192
|
], 8, _hoisted_2)) : createCommentVNode("", true),
|
|
166
193
|
renderSlot(_ctx.$slots, "default", {}, void 0, true),
|
|
167
194
|
renderSlot(_ctx.$slots, "iconEnd", {}, void 0, true)
|
|
168
|
-
],
|
|
195
|
+
], 16, _hoisted_1)) : (openBlock(), createElementBlock("button", mergeProps({
|
|
169
196
|
key: 1,
|
|
170
197
|
ref_key: "el",
|
|
171
|
-
ref: el
|
|
172
|
-
|
|
198
|
+
ref: el
|
|
199
|
+
}, forwarded(), {
|
|
200
|
+
class: classes.value,
|
|
173
201
|
type: __props.type,
|
|
174
202
|
disabled: __props.disabled,
|
|
175
|
-
"aria-label": __props.label,
|
|
176
|
-
"aria-busy": __props.loading ? "true" :
|
|
203
|
+
"aria-label": __props.label ?? unref(attrs)["aria-label"],
|
|
204
|
+
"aria-busy": __props.loading ? "true" : unref(attrs)["aria-busy"],
|
|
177
205
|
onClick: handleClick
|
|
178
|
-
}, [
|
|
206
|
+
}), [
|
|
179
207
|
__props.loading || _ctx.$slots.iconStart ? (openBlock(), createElementBlock("span", {
|
|
180
208
|
key: 0,
|
|
181
209
|
class: "ft-btn-lead",
|
|
@@ -198,7 +226,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
198
226
|
], 8, _hoisted_6)) : createCommentVNode("", true),
|
|
199
227
|
renderSlot(_ctx.$slots, "default", {}, void 0, true),
|
|
200
228
|
renderSlot(_ctx.$slots, "iconEnd", {}, void 0, true)
|
|
201
|
-
],
|
|
229
|
+
], 16, _hoisted_5));
|
|
202
230
|
};
|
|
203
231
|
}
|
|
204
232
|
});
|
|
@@ -39,7 +39,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
39
39
|
ref: containerRef,
|
|
40
40
|
class: normalizeClass(
|
|
41
41
|
unref(cn)(
|
|
42
|
-
"relative flex items-center justify-center transition-all duration-200
|
|
42
|
+
"relative flex items-center justify-center ease-linear motion-safe:transition-all motion-safe:duration-200",
|
|
43
43
|
__props.class
|
|
44
44
|
)
|
|
45
45
|
),
|
|
@@ -21,7 +21,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
21
21
|
);
|
|
22
22
|
return (_ctx, _cache) => {
|
|
23
23
|
return openBlock(), createBlock(resolveDynamicComponent(__props.as), {
|
|
24
|
-
class: normalizeClass(unref(cn)("w-fit transition duration-500
|
|
24
|
+
class: normalizeClass(unref(cn)("w-fit ease-in-out motion-safe:transition motion-safe:duration-500", __props.class)),
|
|
25
25
|
style: normalizeStyle({ transform: transform.value })
|
|
26
26
|
}, {
|
|
27
27
|
default: withCtx(() => [
|
|
@@ -43,7 +43,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
43
43
|
renderSlot(_ctx.$slots, "default")
|
|
44
44
|
], 2),
|
|
45
45
|
createElementVNode("div", {
|
|
46
|
-
class: "pointer-events-none absolute inset-0 rounded-xl opacity-0
|
|
46
|
+
class: "pointer-events-none absolute inset-0 rounded-xl opacity-0 group-hover:opacity-100 motion-safe:transition-opacity motion-safe:duration-300",
|
|
47
47
|
style: normalizeStyle({ background: backgroundStyle.value, opacity: __props.gradientOpacity })
|
|
48
48
|
}, null, 4)
|
|
49
49
|
], 34);
|
|
@@ -5,8 +5,10 @@ import type { HTMLAttributes } from "vue";
|
|
|
5
5
|
export interface ChatMessageActionProps {
|
|
6
6
|
/** Accessible name and tooltip. Required — the icon alone names nothing. */
|
|
7
7
|
label: string;
|
|
8
|
-
/** Called on click, before any confirmation label swaps in. */
|
|
9
|
-
|
|
8
|
+
/** Called on click, before any confirmation label swaps in. `@click` reaches it. */
|
|
9
|
+
onClick?: ((event: MouseEvent) => void) | ((event: MouseEvent) => void)[];
|
|
10
|
+
/** @deprecated Use `@click` / `onClick`. Only called when `onClick` is absent. */
|
|
11
|
+
onclick?: ((event: MouseEvent) => void) | ((event: MouseEvent) => void)[];
|
|
10
12
|
/** Pressed state for a toggle. Omit entirely for a plain button. */
|
|
11
13
|
active?: boolean;
|
|
12
14
|
/** Swapped in as the label for two seconds after a click, e.g. "Copied". */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { defineComponent, inject, ref, onBeforeUnmount, computed, createElementBlock, openBlock, normalizeClass, unref, renderSlot, createCommentVNode } from "vue";
|
|
2
|
+
import { callListener } from "../../internals/call-listener.js";
|
|
2
3
|
import { cn } from "../../utils.js";
|
|
3
4
|
import { CHAT_MESSAGE_CONTEXT_KEY } from "./types.js";
|
|
4
5
|
import { useSoundCue } from "../../sound/use-sound.js";
|
|
@@ -8,7 +9,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
8
9
|
__name: "ChatMessageAction",
|
|
9
10
|
props: {
|
|
10
11
|
label: {},
|
|
11
|
-
|
|
12
|
+
onClick: { type: [Function, Array] },
|
|
13
|
+
onclick: { type: [Function, Array] },
|
|
12
14
|
active: { type: Boolean, default: () => void 0 },
|
|
13
15
|
confirmLabel: {},
|
|
14
16
|
class: { type: [Boolean, null, String, Object, Array] }
|
|
@@ -28,7 +30,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
28
30
|
onBeforeUnmount(clearTimer);
|
|
29
31
|
function handleClick(event) {
|
|
30
32
|
playCue("press");
|
|
31
|
-
__props.onclick
|
|
33
|
+
callListener(__props.onClick ?? __props.onclick, event);
|
|
32
34
|
if (!__props.confirmLabel) return;
|
|
33
35
|
confirmed.value = true;
|
|
34
36
|
clearTimer();
|
|
@@ -2,6 +2,8 @@ import type { HTMLAttributes } from "vue";
|
|
|
2
2
|
export interface CheckboxProps {
|
|
3
3
|
/** Called with the new checked value whenever the box is activated. */
|
|
4
4
|
onCheckedChange?: (checked: boolean) => void;
|
|
5
|
+
/** A consumer `@change`, run once after the internal toggle. */
|
|
6
|
+
onChange?: (event: Event) => void;
|
|
5
7
|
/** Blocks interaction; excluded from form submission. Overridden by a surrounding FormField. */
|
|
6
8
|
disabled?: boolean;
|
|
7
9
|
/** Native `required`. Overridden by a surrounding FormField. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _sfc_main from "./Checkbox.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
4
|
+
const Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-bf446b0b"]]);
|
|
5
5
|
export {
|
|
6
6
|
Checkbox as default
|
|
7
7
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, mergeModels, useModel, useTemplateRef, computed, onMounted, watch, createElementBlock, openBlock, normalizeClass, createElementVNode, renderSlot, unref } from "vue";
|
|
1
|
+
import { defineComponent, mergeModels, useAttrs, useModel, useTemplateRef, computed, onMounted, watch, createElementBlock, openBlock, normalizeClass, createElementVNode, renderSlot, mergeProps, unref } from "vue";
|
|
2
2
|
import { cn } from "../../utils.js";
|
|
3
3
|
import { useField } from "../../internals/field.js";
|
|
4
4
|
import { sound } from "../../sound/sound.js";
|
|
@@ -9,6 +9,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
9
9
|
__name: "Checkbox",
|
|
10
10
|
props: /* @__PURE__ */ mergeModels({
|
|
11
11
|
onCheckedChange: { type: Function },
|
|
12
|
+
onChange: { type: Function },
|
|
12
13
|
disabled: { type: Boolean, default: false },
|
|
13
14
|
required: { type: Boolean, default: false },
|
|
14
15
|
invalid: { type: Boolean, default: false },
|
|
@@ -26,6 +27,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
26
27
|
}),
|
|
27
28
|
emits: ["update:checked", "update:indeterminate"],
|
|
28
29
|
setup(__props, { expose: __expose }) {
|
|
30
|
+
const attrs = useAttrs();
|
|
29
31
|
const checked = useModel(__props, "checked");
|
|
30
32
|
const indeterminate = useModel(__props, "indeterminate");
|
|
31
33
|
const el = useTemplateRef("ref");
|
|
@@ -40,6 +42,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
40
42
|
}
|
|
41
43
|
onMounted(syncIndeterminate);
|
|
42
44
|
watch([el, indeterminate], syncIndeterminate, { flush: "post" });
|
|
45
|
+
function callListener(listener, ...args) {
|
|
46
|
+
if (Array.isArray(listener)) {
|
|
47
|
+
for (const fn of listener) if (typeof fn === "function") fn(...args);
|
|
48
|
+
} else if (typeof listener === "function") {
|
|
49
|
+
listener(...args);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
43
52
|
function handleChange(event) {
|
|
44
53
|
const input = event.currentTarget;
|
|
45
54
|
if (effectiveDisabled.value) {
|
|
@@ -51,6 +60,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
51
60
|
indeterminate.value = false;
|
|
52
61
|
if (__props.sound) sound.play(next ? "toggle-on" : "toggle-off");
|
|
53
62
|
__props.onCheckedChange?.(next);
|
|
63
|
+
callListener(__props.onChange, event);
|
|
54
64
|
}
|
|
55
65
|
const wrapperClasses = computed(
|
|
56
66
|
() => cn(
|
|
@@ -64,7 +74,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
64
74
|
class: normalizeClass(wrapperClasses.value)
|
|
65
75
|
}, [
|
|
66
76
|
createElementVNode("span", _hoisted_1, [
|
|
67
|
-
createElementVNode("input", {
|
|
77
|
+
createElementVNode("input", mergeProps(unref(attrs), {
|
|
68
78
|
ref: "ref",
|
|
69
79
|
type: "checkbox",
|
|
70
80
|
class: "ft-checkbox-control border-input",
|
|
@@ -75,12 +85,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
75
85
|
disabled: effectiveDisabled.value,
|
|
76
86
|
required: effectiveRequired.value,
|
|
77
87
|
"aria-checked": indeterminate.value ? "mixed" : checked.value,
|
|
78
|
-
"aria-invalid": effectiveInvalid.value ? "true" :
|
|
79
|
-
"aria-describedby": unref(field)?.describedBy,
|
|
80
|
-
"aria-label": __props.label,
|
|
81
|
-
"data-invalid": effectiveInvalid.value ? "true" :
|
|
88
|
+
"aria-invalid": effectiveInvalid.value ? "true" : unref(attrs)["aria-invalid"],
|
|
89
|
+
"aria-describedby": [unref(field)?.describedBy, unref(attrs)["aria-describedby"]].filter(Boolean).join(" ") || void 0,
|
|
90
|
+
"aria-label": __props.label ?? unref(attrs)["aria-label"],
|
|
91
|
+
"data-invalid": effectiveInvalid.value ? "true" : unref(attrs)["data-invalid"],
|
|
82
92
|
onChange: handleChange
|
|
83
|
-
}, null,
|
|
93
|
+
}), null, 16, _hoisted_2),
|
|
84
94
|
_cache[0] || (_cache[0] = createElementVNode("svg", {
|
|
85
95
|
class: "ft-checkbox-mark",
|
|
86
96
|
viewBox: "0 0 18 18",
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "vue";
|
|
2
|
+
export interface CollapsibleProps {
|
|
3
|
+
/** Called with the new state each time the trigger toggles it. */
|
|
4
|
+
onOpenChange?: (open: boolean) => void;
|
|
5
|
+
/** Makes the trigger inert. A bound `open` can still be changed from outside. */
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
/** Additional CSS classes. */
|
|
8
|
+
class?: HTMLAttributes["class"];
|
|
9
|
+
}
|
|
10
|
+
declare const _default: typeof __VLS_export;
|
|
11
|
+
export default _default;
|
|
12
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CollapsibleProps & {
|
|
13
|
+
/** Whether the content is expanded, bindable. Defaults to `false`. */
|
|
14
|
+
open?: boolean;
|
|
15
|
+
}, {
|
|
16
|
+
ref: Readonly<import("vue").ShallowRef<HTMLDivElement | null>>;
|
|
17
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
18
|
+
"update:open": (value: boolean) => any;
|
|
19
|
+
}, string, import("vue").PublicProps, Readonly<CollapsibleProps & {
|
|
20
|
+
/** Whether the content is expanded, bindable. Defaults to `false`. */
|
|
21
|
+
open?: boolean;
|
|
22
|
+
}> & Readonly<{
|
|
23
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
24
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
25
|
+
default?(): unknown;
|
|
26
|
+
}>;
|
|
27
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
28
|
+
new (): {
|
|
29
|
+
$slots: S;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { defineComponent, mergeModels, useAttrs, useModel, useTemplateRef, createElementBlock, openBlock, mergeProps, unref, renderSlot } from "vue";
|
|
2
|
+
import { cn } from "../../utils.js";
|
|
3
|
+
import { useFancyId } from "../../internals/use-id.js";
|
|
4
|
+
import { COLLAPSIBLE_KEY } from "./types.js";
|
|
5
|
+
const _hoisted_1 = ["data-state", "data-disabled"];
|
|
6
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
|
+
...{ name: "Collapsible", inheritAttrs: false },
|
|
8
|
+
__name: "Collapsible",
|
|
9
|
+
props: /* @__PURE__ */ mergeModels({
|
|
10
|
+
onOpenChange: { type: Function },
|
|
11
|
+
disabled: { type: Boolean, default: false },
|
|
12
|
+
class: { type: [Boolean, null, String, Object, Array] }
|
|
13
|
+
}, {
|
|
14
|
+
"open": { type: Boolean, ...{ default: false } },
|
|
15
|
+
"openModifiers": {}
|
|
16
|
+
}),
|
|
17
|
+
emits: ["update:open"],
|
|
18
|
+
setup(__props, { expose: __expose }) {
|
|
19
|
+
const attrs = useAttrs();
|
|
20
|
+
const open = useModel(__props, "open");
|
|
21
|
+
const el = useTemplateRef("el");
|
|
22
|
+
__expose({ ref: el });
|
|
23
|
+
const uid = useFancyId();
|
|
24
|
+
const context = {
|
|
25
|
+
get open() {
|
|
26
|
+
return open.value;
|
|
27
|
+
},
|
|
28
|
+
get disabled() {
|
|
29
|
+
return __props.disabled;
|
|
30
|
+
},
|
|
31
|
+
// The only place `open` changes from inside. A plain function, not a
|
|
32
|
+
// watcher: writing `open` from one would read and write the same state in
|
|
33
|
+
// one pass and fight a caller's own `v-model:open`.
|
|
34
|
+
toggle() {
|
|
35
|
+
if (__props.disabled) return;
|
|
36
|
+
const next = !open.value;
|
|
37
|
+
open.value = next;
|
|
38
|
+
__props.onOpenChange?.(next);
|
|
39
|
+
},
|
|
40
|
+
triggerId: `${uid}-trigger`,
|
|
41
|
+
contentId: `${uid}-content`
|
|
42
|
+
};
|
|
43
|
+
COLLAPSIBLE_KEY.provide(context);
|
|
44
|
+
return (_ctx, _cache) => {
|
|
45
|
+
return openBlock(), createElementBlock("div", mergeProps({
|
|
46
|
+
ref_key: "el",
|
|
47
|
+
ref: el
|
|
48
|
+
}, unref(attrs), {
|
|
49
|
+
class: unref(cn)("ft-collapsible", __props.class),
|
|
50
|
+
"data-state": open.value ? "open" : "closed",
|
|
51
|
+
"data-disabled": __props.disabled ? "" : void 0
|
|
52
|
+
}), [
|
|
53
|
+
renderSlot(_ctx.$slots, "default")
|
|
54
|
+
], 16, _hoisted_1);
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
export {
|
|
59
|
+
_sfc_main as default
|
|
60
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "vue";
|
|
2
|
+
export interface CollapsibleContentProps {
|
|
3
|
+
/**
|
|
4
|
+
* Keeps the children mounted while the content is closed. On by default: a
|
|
5
|
+
* closed panel stays in the DOM (inert and hidden) so server-rendered
|
|
6
|
+
* markup, find-in-page and form state survive. Pass `false` to unmount the
|
|
7
|
+
* children once the collapse has finished and mount them again on open, for
|
|
8
|
+
* content that should not run while closed (an iframe, a video).
|
|
9
|
+
* Defaults to `true`, unlike `TabsContent`: the trigger's `aria-controls` always points at an element that exists, the closed markup is server-rendered, and nothing has to be measured.
|
|
10
|
+
*/
|
|
11
|
+
forceMount?: boolean;
|
|
12
|
+
/** Additional CSS classes, merged onto the inner body so padding collapses with the panel. */
|
|
13
|
+
class?: HTMLAttributes["class"];
|
|
14
|
+
}
|
|
15
|
+
declare const _default: typeof __VLS_export;
|
|
16
|
+
export default _default;
|
|
17
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CollapsibleContentProps, {
|
|
18
|
+
ref: Readonly<import("vue").ShallowRef<HTMLDivElement | null>>;
|
|
19
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CollapsibleContentProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
20
|
+
default?(): unknown;
|
|
21
|
+
}>;
|
|
22
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
23
|
+
new (): {
|
|
24
|
+
$slots: S;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { defineComponent, useAttrs, useTemplateRef, computed, ref, watch, onBeforeUnmount, createElementBlock, openBlock, mergeProps, unref, createElementVNode, normalizeClass, renderSlot, createCommentVNode } from "vue";
|
|
2
|
+
import { cn } from "../../utils.js";
|
|
3
|
+
import { COLLAPSIBLE_KEY } from "./types.js";
|
|
4
|
+
import { settleDelayMs, prefersReducedMotionNow, isCollapseEnd } from "./collapsible-core.js";
|
|
5
|
+
const _hoisted_1 = ["id", "data-state", "inert"];
|
|
6
|
+
const _hoisted_2 = { class: "min-h-0 overflow-hidden" };
|
|
7
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
8
|
+
...{ name: "CollapsibleContent", inheritAttrs: false },
|
|
9
|
+
__name: "CollapsibleContent",
|
|
10
|
+
props: {
|
|
11
|
+
forceMount: { type: Boolean, default: true },
|
|
12
|
+
class: { type: [Boolean, null, String, Object, Array] }
|
|
13
|
+
},
|
|
14
|
+
setup(__props, { expose: __expose }) {
|
|
15
|
+
const attrs = useAttrs();
|
|
16
|
+
const el = useTemplateRef("el");
|
|
17
|
+
__expose({ ref: el });
|
|
18
|
+
const context = COLLAPSIBLE_KEY.useOptional();
|
|
19
|
+
const open = computed(() => context?.open ?? false);
|
|
20
|
+
const settled = ref(!(context?.open ?? false));
|
|
21
|
+
const hidden = computed(() => settled.value && !open.value);
|
|
22
|
+
let timer;
|
|
23
|
+
function clearTimer() {
|
|
24
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
25
|
+
timer = void 0;
|
|
26
|
+
}
|
|
27
|
+
watch(
|
|
28
|
+
open,
|
|
29
|
+
(isOpen) => {
|
|
30
|
+
clearTimer();
|
|
31
|
+
if (isOpen) {
|
|
32
|
+
settled.value = false;
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (settled.value) return;
|
|
36
|
+
const node = el.value;
|
|
37
|
+
const delay = settleDelayMs(node ? getComputedStyle(node) : null, prefersReducedMotionNow());
|
|
38
|
+
if (delay === 0) {
|
|
39
|
+
settled.value = true;
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
timer = setTimeout(() => {
|
|
43
|
+
timer = void 0;
|
|
44
|
+
settled.value = true;
|
|
45
|
+
}, delay);
|
|
46
|
+
},
|
|
47
|
+
{ flush: "post" }
|
|
48
|
+
);
|
|
49
|
+
onBeforeUnmount(clearTimer);
|
|
50
|
+
function handleTransitionEnd(event) {
|
|
51
|
+
if (isCollapseEnd(event) && !open.value) {
|
|
52
|
+
clearTimer();
|
|
53
|
+
settled.value = true;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return (_ctx, _cache) => {
|
|
57
|
+
return openBlock(), createElementBlock("div", mergeProps({
|
|
58
|
+
ref_key: "el",
|
|
59
|
+
ref: el,
|
|
60
|
+
onTransitionend: handleTransitionEnd
|
|
61
|
+
}, unref(attrs), {
|
|
62
|
+
id: unref(context)?.contentId ?? unref(attrs).id,
|
|
63
|
+
class: "ft-collapsible-content grid grid-rows-[0fr] transition-[grid-template-rows] duration-[var(--ft-collapsible-duration,240ms)] ease-[cubic-bezier(0.16,1,0.3,1)] data-[state=open]:grid-rows-[1fr] motion-reduce:transition-none",
|
|
64
|
+
"data-state": open.value ? "open" : "closed",
|
|
65
|
+
inert: open.value ? void 0 : true,
|
|
66
|
+
style: hidden.value ? { visibility: "hidden" } : void 0
|
|
67
|
+
}), [
|
|
68
|
+
createElementVNode("div", _hoisted_2, [
|
|
69
|
+
createElementVNode("div", {
|
|
70
|
+
class: normalizeClass(unref(cn)("ft-collapsible-body", __props.class))
|
|
71
|
+
}, [
|
|
72
|
+
__props.forceMount || !hidden.value ? renderSlot(_ctx.$slots, "default", {}, void 0, void 0, 0) : createCommentVNode("", true)
|
|
73
|
+
], 2)
|
|
74
|
+
])
|
|
75
|
+
], 16, _hoisted_1);
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
export {
|
|
80
|
+
_sfc_main as default
|
|
81
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "vue";
|
|
2
|
+
export interface CollapsibleTriggerProps {
|
|
3
|
+
/** Disables this trigger on top of the root's own `disabled`. */
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
/** Additional CSS classes. */
|
|
6
|
+
class?: HTMLAttributes["class"];
|
|
7
|
+
/** Called after the component's own handling, never while disabled. */
|
|
8
|
+
onClick?: ((event: MouseEvent) => void) | ((event: MouseEvent) => void)[];
|
|
9
|
+
}
|
|
10
|
+
declare const _default: typeof __VLS_export;
|
|
11
|
+
export default _default;
|
|
12
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CollapsibleTriggerProps, {
|
|
13
|
+
ref: Readonly<import("vue").ShallowRef<HTMLButtonElement | null>>;
|
|
14
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CollapsibleTriggerProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
15
|
+
default?(): unknown;
|
|
16
|
+
}>;
|
|
17
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
18
|
+
new (): {
|
|
19
|
+
$slots: S;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { defineComponent, useAttrs, useTemplateRef, computed, createElementBlock, openBlock, mergeProps, unref, renderSlot } from "vue";
|
|
2
|
+
import { callListener } from "../../internals/call-listener.js";
|
|
3
|
+
import { cn } from "../../utils.js";
|
|
4
|
+
import { COLLAPSIBLE_KEY } from "./types.js";
|
|
5
|
+
const _hoisted_1 = ["id", "disabled", "aria-expanded", "aria-controls", "data-state", "data-disabled"];
|
|
6
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
|
+
...{ name: "CollapsibleTrigger", inheritAttrs: false },
|
|
8
|
+
__name: "CollapsibleTrigger",
|
|
9
|
+
props: {
|
|
10
|
+
disabled: { type: Boolean, default: false },
|
|
11
|
+
class: { type: [Boolean, null, String, Object, Array] },
|
|
12
|
+
onClick: { type: [Function, Array] }
|
|
13
|
+
},
|
|
14
|
+
setup(__props, { expose: __expose }) {
|
|
15
|
+
const attrs = useAttrs();
|
|
16
|
+
const el = useTemplateRef("el");
|
|
17
|
+
__expose({ ref: el });
|
|
18
|
+
const context = COLLAPSIBLE_KEY.useOptional();
|
|
19
|
+
const isDisabled = computed(() => __props.disabled || (context?.disabled ?? false));
|
|
20
|
+
const isOpen = computed(() => context?.open ?? false);
|
|
21
|
+
function forwarded() {
|
|
22
|
+
if (!isDisabled.value) return attrs;
|
|
23
|
+
return Object.fromEntries(Object.entries(attrs).filter(([key]) => !/^onClick/.test(key)));
|
|
24
|
+
}
|
|
25
|
+
function handleClick(event) {
|
|
26
|
+
if (isDisabled.value) return;
|
|
27
|
+
context?.toggle();
|
|
28
|
+
callListener(__props.onClick, event);
|
|
29
|
+
}
|
|
30
|
+
return (_ctx, _cache) => {
|
|
31
|
+
return openBlock(), createElementBlock("button", mergeProps({
|
|
32
|
+
ref_key: "el",
|
|
33
|
+
ref: el,
|
|
34
|
+
onClick: handleClick
|
|
35
|
+
}, forwarded(), {
|
|
36
|
+
type: "button",
|
|
37
|
+
id: unref(context)?.triggerId ?? unref(attrs).id,
|
|
38
|
+
class: unref(cn)(
|
|
39
|
+
"ft-collapsible-trigger cursor-pointer",
|
|
40
|
+
"focus-visible:ring-ring focus-visible:ring-2 focus-visible:outline-none",
|
|
41
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
42
|
+
__props.class
|
|
43
|
+
),
|
|
44
|
+
disabled: isDisabled.value,
|
|
45
|
+
"aria-expanded": unref(context) ? isOpen.value : unref(attrs)["aria-expanded"],
|
|
46
|
+
"aria-controls": unref(context)?.contentId ?? unref(attrs)["aria-controls"],
|
|
47
|
+
"data-state": unref(context) ? isOpen.value ? "open" : "closed" : void 0,
|
|
48
|
+
"data-disabled": isDisabled.value ? "" : void 0
|
|
49
|
+
}), [
|
|
50
|
+
renderSlot(_ctx.$slots, "default")
|
|
51
|
+
], 16, _hoisted_1);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
export {
|
|
56
|
+
_sfc_main as default
|
|
57
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The framework-free half of the collapse motion, shared byte for byte by the
|
|
3
|
+
* Svelte, React and Vue packages.
|
|
4
|
+
*
|
|
5
|
+
* `CollapsibleContent` animates `grid-template-rows` between `0fr` and `1fr`
|
|
6
|
+
* and has to know when that transition is over, to take the panel out of the
|
|
7
|
+
* tab order and the accessibility tree. `transitionend` is the signal, but it
|
|
8
|
+
* never arrives when the transition did not run: reduced motion, a stylesheet
|
|
9
|
+
* that declares no duration, a panel inside a hidden ancestor. These helpers
|
|
10
|
+
* turn the element's own computed transition into a deadline so the panel
|
|
11
|
+
* settles in every one of those cases, and never earlier than its animation.
|
|
12
|
+
*/
|
|
13
|
+
/** The media query that switches the motion off. */
|
|
14
|
+
export declare const REDUCED_MOTION_QUERY = "(prefers-reduced-motion: reduce)";
|
|
15
|
+
/**
|
|
16
|
+
* Milliseconds assumed when the element declares no transition timing at all
|
|
17
|
+
* (a computed style that is empty, as in a test DOM with no stylesheet).
|
|
18
|
+
*/
|
|
19
|
+
export declare const DEFAULT_SETTLE_MS = 300;
|
|
20
|
+
/** Slack added on top of a declared transition so `transitionend` wins the race. */
|
|
21
|
+
export declare const SETTLE_SLACK_MS = 60;
|
|
22
|
+
/** The `transitionend` property name of the collapse. */
|
|
23
|
+
export declare const COLLAPSE_PROPERTY = "grid-template-rows";
|
|
24
|
+
/** One-shot read of the user's motion preference; `false` where `matchMedia` is missing. */
|
|
25
|
+
export declare function prefersReducedMotionNow(): boolean;
|
|
26
|
+
/** `"0.2s, 150ms"` to `[200, 150]`; a token that is not a time becomes `NaN`. */
|
|
27
|
+
export declare function parseTimeList(value: string): number[];
|
|
28
|
+
/** The slice of a computed style the deadline reads. */
|
|
29
|
+
export interface TransitionTiming {
|
|
30
|
+
transitionDuration: string;
|
|
31
|
+
transitionDelay: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* How long to wait for `transitionend` before settling the panel anyway.
|
|
35
|
+
*
|
|
36
|
+
* `0` means "settle now": the user asked for reduced motion, or the element's
|
|
37
|
+
* longest declared transition lasts no time at all, so no event will come.
|
|
38
|
+
* Anything else is the declared duration plus its delay plus a little slack;
|
|
39
|
+
* an element that declares nothing waits `DEFAULT_SETTLE_MS`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function settleDelayMs(timing: TransitionTiming | null, reduced: boolean): number;
|
|
42
|
+
/** Whether a `transitionend` is the collapse of this very panel, not a child's or another property's. */
|
|
43
|
+
export declare function isCollapseEnd(event: {
|
|
44
|
+
target: unknown;
|
|
45
|
+
currentTarget: unknown;
|
|
46
|
+
propertyName: string;
|
|
47
|
+
}): boolean;
|