@plexui/vue 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/es/components/DateRangePicker/Calendar.js +19 -18
  2. package/dist/es/components/DateRangePicker/Calendar.js.map +1 -1
  3. package/dist/es/components/DateRangePicker/DateRangePicker.js +5 -0
  4. package/dist/es/components/DateRangePicker/DateRangePicker.js.map +1 -1
  5. package/dist/es/components/DateRangePicker/context.js.map +1 -1
  6. package/dist/es/components/DateRangePicker/index.js.map +1 -1
  7. package/dist/es/components/DateRangePicker/types.js.map +1 -1
  8. package/dist/es/components/Dialog/Dialog.js +46 -11
  9. package/dist/es/components/Dialog/Dialog.js.map +1 -1
  10. package/dist/es/components/Field/Field.js +6 -3
  11. package/dist/es/components/Field/Field.js.map +1 -1
  12. package/dist/es/components/InputGroup/InputGroup.js +0 -1
  13. package/dist/es/components/InputGroup/InputGroup.js.map +1 -1
  14. package/dist/es/components/Menu/Menu.js +27 -5
  15. package/dist/es/components/Menu/Menu.js.map +1 -1
  16. package/dist/es/components/Popover/Popover.js +24 -9
  17. package/dist/es/components/Popover/Popover.js.map +1 -1
  18. package/dist/es/components/Select/Select.js +33 -15
  19. package/dist/es/components/Select/Select.js.map +1 -1
  20. package/dist/es/components/SelectControl/SelectControl.js +7 -4
  21. package/dist/es/components/SelectControl/SelectControl.js.map +1 -1
  22. package/dist/es/components/Transition/TransitionGroup.js +12 -1
  23. package/dist/es/components/Transition/TransitionGroup.js.map +1 -1
  24. package/dist/es/components/Transition/shared.js +30 -1
  25. package/dist/es/components/Transition/shared.js.map +1 -1
  26. package/dist/es/components/Transition/useTransitionChild.js +2 -2
  27. package/dist/es/components/Transition/useTransitionChild.js.map +1 -1
  28. package/dist/es/lib/dateUtils.js +5 -0
  29. package/dist/es/lib/dateUtils.js.map +1 -1
  30. package/dist/es/lib/helpers.js +30 -0
  31. package/dist/es/lib/helpers.js.map +1 -1
  32. package/dist/types/components/DateRangePicker/DateRangePicker.d.ts +23 -1
  33. package/dist/types/components/DateRangePicker/context.d.ts +2 -1
  34. package/dist/types/components/DateRangePicker/index.d.ts +1 -1
  35. package/dist/types/components/DateRangePicker/types.d.ts +2 -0
  36. package/dist/types/components/Field/Field.d.ts +2 -2
  37. package/dist/types/components/Select/Select.d.ts +11 -0
  38. package/dist/types/components/SelectControl/SelectControl.d.ts +11 -0
  39. package/dist/types/components/Transition/TransitionGroup.d.ts +11 -0
  40. package/dist/types/components/Transition/shared.d.ts +23 -0
  41. package/dist/types/components/Transition/useTransitionChild.d.ts +1 -0
  42. package/dist/types/lib/dateUtils.d.ts +5 -0
  43. package/dist/types/lib/helpers.d.ts +13 -0
  44. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../../src/components/Dialog/Dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,CAAC,EACD,MAAM,EACN,eAAe,EACf,SAAS,EACT,OAAO,EACP,GAAG,EACH,KAAK,GAON,MAAM,KAAK,CAAA;AACZ,OAAO,EACL,aAAa,IAAI,iBAAiB,EAClC,iBAAiB,IAAI,qBAAqB,EAC1C,aAAa,IAAI,iBAAiB,EAClC,YAAY,IAAI,gBAAgB,EAChC,UAAU,IAAI,cAAc,EAC5B,WAAW,IAAI,eAAe,EAC9B,uBAAuB,EACvB,gBAAgB,EAChB,KAAK,GACN,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAA;AACxE,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC5E,OAAO,EAAE,mBAAmB,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAA;AAC7G,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM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AC,iBAAiB,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAA;IACjG,CAAC;CACF,CAAC,CAAA","sourcesContent":["import {\n cloneVNode,\n computed,\n createCommentVNode,\n defineComponent,\n h,\n inject,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n watch,\n type ComputedRef,\n type HTMLAttributes,\n type InjectionKey,\n type PropType,\n type Ref,\n type VNode,\n} from \"vue\"\nimport {\n DialogContent as RekaDialogContent,\n DialogDescription as RekaDialogDescription,\n DialogOverlay as RekaDialogOverlay,\n DialogPortal as RekaDialogPortal,\n DialogRoot as RekaDialogRoot,\n DialogTitle as RekaDialogTitle,\n injectDialogRootContext,\n useForwardExpose,\n useId,\n} from \"reka-ui\"\nimport { useEscCloseStack } from \"../../composables/useEscCloseStack.js\"\nimport { preventDefaultHandler, toCssVariables } from \"../../lib/helpers.js\"\nimport { dismissableSurfaces, useDeferredPointerDownOutside } from \"../Popover/deferredPointerDownOutside.js\"\nimport { firstElementChild } from \"../Tooltip/slot.js\"\nimport { TransitionGroup } from \"../Transition/index.js\"\nimport s from \"@plexui/styles/components/Dialog/Dialog.module.css\"\n\n// Vue port of packages/ui/src/components/Dialog/Dialog.tsx on Reka UI\n// (the Vue lineage of Radix, same anatomy). Exports are flat (`Dialog`,\n// `DialogTrigger`, ...) because runtime-compiled templates cannot resolve\n// `Dialog.Trigger` from the `components` option.\n//\n// Where Reka differs from Radix (radix-ui 1.8), the port follows Radix:\n// - The content is labelled and described only while a DialogTitle /\n// DialogDescription is mounted.\n// - A press outside (the overlay) closes it on the click that follows\n// (../Popover/deferredPointerDownOutside.ts); the overlay is a dismiss\n// surface.\n// - The portal renders once mounted, so a closed dialog server-renders\n// nothing.\n\ntype DialogContextValue = {\n open: ComputedRef<boolean>\n setOpen: (nextState: boolean) => void\n /** Mounted DialogTitle / DialogDescription parts (Radix's title and description counts) */\n titleCount: Ref<number>\n descriptionCount: Ref<number>\n}\n\nconst DialogContextKey: InjectionKey<DialogContextValue> = Symbol(\"PlexUIDialog\")\n\nconst useDialogContext = () => {\n const context = inject(DialogContextKey, null)\n\n if (!context) {\n throw new Error(\"Dialog compound components must be used inside <Dialog>\")\n }\n\n return context\n}\n\n/** Modal dialog root. Uncontrolled by default; bind `v-model:open` to control it. */\nexport const Dialog = defineComponent({\n name: \"Dialog\",\n props: {\n open: { type: Boolean, default: undefined },\n },\n emits: {\n \"update:open\": (_open: boolean) => true,\n },\n setup(props, { slots, emit }) {\n const internalOpen = ref(false)\n const isOpen = computed(() => props.open ?? internalOpen.value)\n\n const setOpen = (nextState: boolean) => {\n emit(\"update:open\", nextState)\n internalOpen.value = nextState\n }\n\n provide(DialogContextKey, { open: isOpen, setOpen, titleCount: ref(0), descriptionCount: ref(0) })\n\n return () =>\n h(RekaDialogRoot, { \"open\": isOpen.value, \"onUpdate:open\": setOpen }, { default: () => slots.default?.() })\n },\n})\n\n// Trigger and Close render their child with the dialog wiring merged in,\n// like Reka's `asChild` parts, but run the dialog action after the child's\n// own click handlers and skip it when one called preventDefault() (Radix's\n// composeEventHandlers). Reka's parts run first and cannot be cancelled.\n// Attributes the child sets itself win, as with Radix and Reka slots. The\n// child is the first element, also through a forwarded `<slot />`.\nconst withDialogProps = (\n child: VNode | undefined,\n props: Record<string, unknown>,\n onClick: (event: Event) => void,\n ref?: (el: unknown) => void,\n) => {\n if (!child) return null\n const own = child.props ?? {}\n const extra = Object.fromEntries(Object.entries(props).filter(([key]) => !(key in own)))\n return cloneVNode(child, { ...extra, onClick, ...(ref ? { ref } : {}) }, true)\n}\n\nexport const DialogTrigger = defineComponent({\n name: \"DialogTrigger\",\n setup(_props, { slots }) {\n const rootContext = injectDialogRootContext()\n const { forwardRef, currentElement } = useForwardExpose()\n rootContext.contentId ||= useId(undefined, \"reka-dialog-content\")\n // Focus returns here when the dialog closes\n onMounted(() => {\n rootContext.triggerElement.value = currentElement.value\n })\n\n const onClick = (event: Event) => {\n if (!event.defaultPrevented) rootContext.onOpenToggle()\n }\n\n return () => {\n const open = rootContext.open.value\n return withDialogProps(\n firstElementChild(slots.default?.()),\n {\n \"type\": \"button\",\n \"aria-haspopup\": \"dialog\",\n \"aria-expanded\": open || false,\n \"aria-controls\": open ? rootContext.contentId : undefined,\n \"data-state\": open ? \"open\" : \"closed\",\n },\n onClick,\n forwardRef as (el: unknown) => void,\n )\n }\n },\n})\n\nconst CloseIcon = () =>\n h(\"svg\", { \"class\": s.CloseIcon, \"viewBox\": \"0 0 20 20\", \"width\": \"20\", \"height\": \"20\", \"aria-hidden\": \"true\" }, [\n h(\"path\", {\n fill: \"currentColor\",\n d: \"M5.22 5.22a.75.75 0 0 1 1.06 0L10 8.94l3.72-3.72a.75.75 0 1 1 1.06 1.06L11.06 10l3.72 3.72a.75.75 0 1 1-1.06 1.06L10 11.06l-3.72 3.72a.75.75 0 1 1-1.06-1.06L8.94 10 5.22 6.28a.75.75 0 0 1 0-1.06\",\n }),\n ])\n\n/** Overlay and panel. `class` lands on the panel, like `className` in React. */\nexport const DialogContent = defineComponent({\n name: \"DialogContent\",\n inheritAttrs: false,\n props: {\n /** Panel width; numbers are pixels. @default 480 */\n width: { type: [Number, String] as PropType<number | string>, default: 480 },\n /** Renders the close button in the top corner. @default true */\n showClose: { type: Boolean, default: true },\n /**\n * Rounder panel and a round close button, for dialogs that sit beside pill controls.\n * @default false\n */\n pill: { type: Boolean, default: false },\n /**\n * Where the panel sits: centered, near the top, a sheet along the bottom,\n * a full-height panel on the start or end side, or the whole screen.\n * @default \"center\"\n */\n placement: { type: String as PropType<DialogPlacement>, default: \"center\" },\n /** Placement at 640px and below, such as a bottom sheet on phones. @default placement */\n mobilePlacement: String as PropType<Extract<DialogPlacement, \"center\" | \"bottom\" | \"fullscreen\">>,\n /** Called when focus moves into the dialog on open; `event.preventDefault()` keeps it for you to place. */\n onOpenAutoFocus: Function as PropType<(event: Event) => void>,\n /** Called when focus returns on close; `event.preventDefault()` keeps it elsewhere. */\n onCloseAutoFocus: Function as PropType<(event: Event) => void>,\n },\n setup(props, { slots, attrs }) {\n const { open, setOpen, titleCount, descriptionCount } = useDialogContext()\n // Radix's root makes the content id; Reka's trigger does, so a dialog\n // without one would render `id=\"\"`\n injectDialogRootContext().contentId ||= useId(undefined, \"reka-dialog-content\")\n\n // Escape goes through the shared stack, as in React, so the dialog\n // closes before overlays opened earlier (a forced-open Tooltip)\n useEscCloseStack(open, () => {\n setOpen(false)\n })\n\n // Radix's modal content: a Ctrl+click (macOS right click) does not dismiss\n const outsidePress = useDeferredPointerDownOutside((originalEvent) => {\n if (!originalEvent.ctrlKey) setOpen(false)\n })\n watch(open, (isOpen) => {\n if (!isOpen) outsidePress.reset()\n })\n\n let overlayElement: Element | undefined\n const setOverlayRef = (instance: unknown) => {\n const el = (instance as { $el?: unknown } | null)?.$el\n const element = el instanceof Element ? el : undefined\n if (element === overlayElement) return\n if (overlayElement) dismissableSurfaces.delete(overlayElement)\n overlayElement = element\n if (element) dismissableSurfaces.add(element)\n }\n\n const renderDialog = () =>\n h(\"div\", { key: \"dialog\" }, [\n h(RekaDialogOverlay, { class: s.Overlay, ref: setOverlayRef }),\n h(\n RekaDialogContent,\n {\n \"forceMount\": true,\n \"class\": s.Content,\n \"style\": toCssVariables({ \"dialog-width\": props.width }),\n \"data-placement\": props.placement === \"center\" ? undefined : props.placement,\n \"data-mobile-placement\": props.mobilePlacement,\n \"data-pill\": props.pill ? \"\" : undefined,\n \"onOpenAutoFocus\": props.onOpenAutoFocus,\n \"onCloseAutoFocus\": props.onCloseAutoFocus,\n // Radix labels and describes the content only by mounted parts\n ...(titleCount.value > 0 ? {} : { \"aria-labelledby\": undefined }),\n ...(descriptionCount.value > 0 ? {} : { \"aria-describedby\": undefined }),\n \"onEscapeKeyDown\": preventDefaultHandler,\n \"onPointerDownOutside\": outsidePress.onPointerDownOutside,\n \"onFocusOutside\": outsidePress.onFocusOutside,\n },\n {\n default: () => [\n h(\"div\", { class: [s.Panel, attrs.class] }, [\n props.showClose\n ? h(DialogClose, null, {\n default: () => [\n h(\"button\", { \"type\": \"button\", \"class\": s.CloseButton, \"aria-label\": \"Close dialog\" }, [\n h(CloseIcon),\n ]),\n ],\n })\n : null,\n slots.default?.(),\n ]),\n ],\n },\n ),\n ])\n\n return () =>\n h(RekaDialogPortal, null, {\n default: () => [\n h(\n TransitionGroup,\n { class: s.Transition, enterDuration: 250, exitDuration: 150, disableAnimations: true },\n // `open && <div>` in React: closed still renders the empty wrapper\n { default: () => [open.value ? renderDialog() : createCommentVNode()] },\n ),\n ],\n })\n },\n})\n\nexport const DialogHeader = defineComponent({\n name: \"DialogHeader\",\n setup(_props, { slots }) {\n return () => h(\"div\", { class: s.Header }, slots.default?.())\n },\n})\n\n/** The scrolling part between DialogHeader and DialogFooter: with it, only the body scrolls. */\nexport const DialogBody = defineComponent({\n name: \"DialogBody\",\n inheritAttrs: false,\n setup(_props, { slots, attrs }) {\n return () => h(\"div\", { class: [s.Body, attrs.class] }, slots.default?.())\n },\n})\n\nexport const DialogFooter = defineComponent({\n name: \"DialogFooter\",\n setup(_props, { slots }) {\n return () => h(\"div\", { class: s.Footer }, slots.default?.())\n },\n})\n\n/** Counts a mounted part, as Radix's title and description counts do. */\nconst useMountedCount = (count: Ref<number>) => {\n onMounted(() => {\n count.value++\n })\n onBeforeUnmount(() => {\n count.value--\n })\n}\n\nexport const DialogTitle = defineComponent({\n name: \"DialogTitle\",\n setup(_props, { slots }) {\n useMountedCount(useDialogContext().titleCount)\n return () => h(RekaDialogTitle, { class: s.Title }, { default: () => slots.default?.() })\n },\n})\n\nexport const DialogDescription = defineComponent({\n name: \"DialogDescription\",\n setup(_props, { slots }) {\n useMountedCount(useDialogContext().descriptionCount)\n return () => h(RekaDialogDescription, { class: s.Description }, { default: () => slots.default?.() })\n },\n})\n\nexport const DialogClose = defineComponent({\n name: \"DialogClose\",\n setup(_props, { slots }) {\n const rootContext = injectDialogRootContext()\n const onClick = (event: Event) => {\n if (!event.defaultPrevented) rootContext.onOpenChange(false)\n }\n return () => withDialogProps(firstElementChild(slots.default?.()), { type: \"button\" }, onClick)\n },\n})\n\nexport type DialogProps = InstanceType<typeof Dialog>[\"$props\"]\n\nexport type DialogPlacement = \"center\" | \"top\" | \"bottom\" | \"start\" | \"end\" | \"fullscreen\"\n\n/** DialogContent props; `class` lands on the panel, like `className` in React. */\nexport type DialogContentProps = InstanceType<typeof DialogContent>[\"$props\"] & { class?: HTMLAttributes[\"class\"] }\n"]}
1
+ {"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../../src/components/Dialog/Dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,CAAC,EACD,MAAM,EACN,eAAe,EACf,SAAS,EACT,OAAO,EACP,GAAG,EACH,KAAK,GAON,MAAM,KAAK,CAAA;AACZ,OAAO,EACL,aAAa,IAAI,iBAAiB,EAClC,iBAAiB,IAAI,qBAAqB,EAC1C,aAAa,IAAI,iBAAiB,EAClC,YAAY,IAAI,gBAAgB,EAChC,UAAU,IAAI,cAAc,EAC5B,WAAW,IAAI,eAAe,EAC9B,uBAAuB,EACvB,gBAAgB,EAChB,KAAK,GACN,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAA;AACxE,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC5F,OAAO,EAAE,mBAAmB,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAA;AAC7G,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC3E,OAAO,CAAC,MAAM,oDAAoD,CAAA;AAwBlE,MAAM,gBAAgB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ch,\n type ComputedRef,\n type HTMLAttributes,\n type InjectionKey,\n type PropType,\n type Ref,\n type VNode,\n} from \"vue\"\nimport {\n DialogContent as RekaDialogContent,\n DialogDescription as RekaDialogDescription,\n DialogOverlay as RekaDialogOverlay,\n DialogPortal as RekaDialogPortal,\n DialogRoot as RekaDialogRoot,\n DialogTitle as RekaDialogTitle,\n injectDialogRootContext,\n useForwardExpose,\n useId,\n} from \"reka-ui\"\nimport { useEscCloseStack } from \"../../composables/useEscCloseStack.js\"\nimport { keepMovedFocus, preventDefaultHandler, toCssVariables } from \"../../lib/helpers.js\"\nimport { dismissableSurfaces, useDeferredPointerDownOutside } from \"../Popover/deferredPointerDownOutside.js\"\nimport { firstElementChild } from \"../Tooltip/slot.js\"\nimport { TransitionGroup } from \"../Transition/index.js\"\nimport { overlayTiming, overlayTimingLarge } from \"../Transition/shared.js\"\nimport s from \"@plexui/styles/components/Dialog/Dialog.module.css\"\n\n// Vue port of packages/ui/src/components/Dialog/Dialog.tsx on Reka UI\n// (the Vue lineage of Radix, same anatomy). Exports are flat (`Dialog`,\n// `DialogTrigger`, ...) because runtime-compiled templates cannot resolve\n// `Dialog.Trigger` from the `components` option.\n//\n// Where Reka differs from Radix (radix-ui 1.8), the port follows Radix:\n// - The content is labelled and described only while a DialogTitle /\n// DialogDescription is mounted.\n// - A press outside (the overlay) closes it on the click that follows\n// (../Popover/deferredPointerDownOutside.ts); the overlay is a dismiss\n// surface.\n// - The portal renders once mounted, so a closed dialog server-renders\n// nothing.\n\ntype DialogContextValue = {\n open: ComputedRef<boolean>\n setOpen: (nextState: boolean) => void\n /** Mounted DialogTitle / DialogDescription parts (Radix's title and description counts) */\n titleCount: Ref<number>\n descriptionCount: Ref<number>\n}\n\nconst DialogContextKey: InjectionKey<DialogContextValue> = Symbol(\"PlexUIDialog\")\n\nconst useDialogContext = () => {\n const context = inject(DialogContextKey, null)\n\n if (!context) {\n throw new Error(\"Dialog compound components must be used inside <Dialog>\")\n }\n\n return context\n}\n\n/** Modal dialog root. Uncontrolled by default; bind `v-model:open` to control it. */\nexport const Dialog = defineComponent({\n name: \"Dialog\",\n props: {\n open: { type: Boolean, default: undefined },\n },\n emits: {\n \"update:open\": (_open: boolean) => true,\n },\n setup(props, { slots, emit }) {\n const internalOpen = ref(false)\n const isOpen = computed(() => props.open ?? internalOpen.value)\n\n const setOpen = (nextState: boolean) => {\n emit(\"update:open\", nextState)\n internalOpen.value = nextState\n }\n\n provide(DialogContextKey, { open: isOpen, setOpen, titleCount: ref(0), descriptionCount: ref(0) })\n\n return () =>\n h(RekaDialogRoot, { \"open\": isOpen.value, \"onUpdate:open\": setOpen }, { default: () => slots.default?.() })\n },\n})\n\n// Trigger and Close render their child with the dialog wiring merged in,\n// like Reka's `asChild` parts, but run the dialog action after the child's\n// own click handlers and skip it when one called preventDefault() (Radix's\n// composeEventHandlers). Reka's parts run first and cannot be cancelled.\n// Attributes the child sets itself win, as with Radix and Reka slots. The\n// child is the first element, also through a forwarded `<slot />`.\nconst withDialogProps = (\n child: VNode | undefined,\n props: Record<string, unknown>,\n onClick: (event: Event) => void,\n ref?: (el: unknown) => void,\n) => {\n if (!child) return null\n const own = child.props ?? {}\n const extra = Object.fromEntries(Object.entries(props).filter(([key]) => !(key in own)))\n return cloneVNode(child, { ...extra, onClick, ...(ref ? { ref } : {}) }, true)\n}\n\nexport const DialogTrigger = defineComponent({\n name: \"DialogTrigger\",\n setup(_props, { slots }) {\n const rootContext = injectDialogRootContext()\n const { forwardRef, currentElement } = useForwardExpose()\n rootContext.contentId ||= useId(undefined, \"reka-dialog-content\")\n // Focus returns here when the dialog closes\n onMounted(() => {\n rootContext.triggerElement.value = currentElement.value\n })\n\n const onClick = (event: Event) => {\n if (!event.defaultPrevented) rootContext.onOpenToggle()\n }\n\n return () => {\n const open = rootContext.open.value\n return withDialogProps(\n firstElementChild(slots.default?.()),\n {\n \"type\": \"button\",\n \"aria-haspopup\": \"dialog\",\n \"aria-expanded\": open || false,\n \"aria-controls\": open ? rootContext.contentId : undefined,\n \"data-state\": open ? \"open\" : \"closed\",\n },\n onClick,\n forwardRef as (el: unknown) => void,\n )\n }\n },\n})\n\nconst CloseIcon = () =>\n h(\"svg\", { \"class\": s.CloseIcon, \"viewBox\": \"0 0 20 20\", \"width\": \"20\", \"height\": \"20\", \"aria-hidden\": \"true\" }, [\n h(\"path\", {\n fill: \"currentColor\",\n d: \"M5.22 5.22a.75.75 0 0 1 1.06 0L10 8.94l3.72-3.72a.75.75 0 1 1 1.06 1.06L11.06 10l3.72 3.72a.75.75 0 1 1-1.06 1.06L10 11.06l-3.72 3.72a.75.75 0 1 1-1.06-1.06L8.94 10 5.22 6.28a.75.75 0 0 1 0-1.06\",\n }),\n ])\n\n/** Overlay and panel. `class` lands on the panel, like `className` in React. */\nexport const DialogContent = defineComponent({\n name: \"DialogContent\",\n inheritAttrs: false,\n props: {\n /** Panel width; numbers are pixels. @default 480 */\n width: { type: [Number, String] as PropType<number | string>, default: 480 },\n /** Renders the close button in the top corner. @default true */\n showClose: { type: Boolean, default: true },\n /**\n * Rounder panel and a round close button, for dialogs that sit beside pill controls.\n * @default false\n */\n pill: { type: Boolean, default: false },\n /**\n * Where the panel sits: centered, near the top, a sheet along the bottom,\n * a full-height panel on the start or end side, or the whole screen.\n * @default \"center\"\n */\n placement: { type: String as PropType<DialogPlacement>, default: \"center\" },\n /** Placement at 640px and below, such as a bottom sheet on phones. @default placement */\n mobilePlacement: String as PropType<Extract<DialogPlacement, \"center\" | \"bottom\" | \"fullscreen\">>,\n /** Called when focus moves into the dialog on open; `event.preventDefault()` keeps it for you to place. */\n onOpenAutoFocus: Function as PropType<(event: Event) => void>,\n /** Called when focus returns on close; `event.preventDefault()` keeps it elsewhere. */\n onCloseAutoFocus: Function as PropType<(event: Event) => void>,\n },\n setup(props, { slots, attrs }) {\n const { open, setOpen, titleCount, descriptionCount } = useDialogContext()\n const rootContext = injectDialogRootContext()\n // Radix's root makes the content id; Reka's trigger does, so a dialog\n // without one would render `id=\"\"`\n rootContext.contentId ||= useId(undefined, \"reka-dialog-content\")\n\n // Force-mounted content refocuses Reka's trigger the moment it closes.\n // Focus waits for the exit, as in Radix: the trigger is held back until\n // the content unmounts, where Reka's own close auto focus uses it.\n let closingTrigger: HTMLElement | undefined\n watch(\n open,\n (isOpen) => {\n if (isOpen) {\n if (closingTrigger) rootContext.triggerElement.value = closingTrigger\n closingTrigger = undefined\n } else {\n closingTrigger = rootContext.triggerElement.value\n rootContext.triggerElement.value = undefined\n }\n },\n { flush: \"sync\" },\n )\n const handleCloseAutoFocus = (event: Event) => {\n props.onCloseAutoFocus?.(event)\n keepMovedFocus(event)\n if (closingTrigger) rootContext.triggerElement.value = closingTrigger\n closingTrigger = undefined\n }\n\n // Escape goes through the shared stack, as in React, so the dialog\n // closes before overlays opened earlier (a forced-open Tooltip)\n useEscCloseStack(open, () => {\n setOpen(false)\n })\n\n // Radix's modal content: a Ctrl+click (macOS right click) does not dismiss\n const outsidePress = useDeferredPointerDownOutside((originalEvent) => {\n if (!originalEvent.ctrlKey) setOpen(false)\n })\n watch(open, (isOpen) => {\n if (!isOpen) outsidePress.reset()\n })\n\n let overlayElement: Element | undefined\n const setOverlayRef = (instance: unknown) => {\n const el = (instance as { $el?: unknown } | null)?.$el\n const element = el instanceof Element ? el : undefined\n if (element === overlayElement) return\n if (overlayElement) dismissableSurfaces.delete(overlayElement)\n overlayElement = element\n if (element) dismissableSurfaces.add(element)\n }\n\n const renderDialog = () =>\n h(\"div\", { key: \"dialog\" }, [\n h(RekaDialogOverlay, { class: s.Overlay, forceMount: true, ref: setOverlayRef }),\n h(\n RekaDialogContent,\n {\n \"forceMount\": true,\n \"class\": s.Content,\n \"style\": toCssVariables({ \"dialog-width\": props.width }),\n \"data-placement\": props.placement === \"center\" ? undefined : props.placement,\n \"data-mobile-placement\": props.mobilePlacement,\n \"data-pill\": props.pill ? \"\" : undefined,\n \"onOpenAutoFocus\": props.onOpenAutoFocus,\n \"onCloseAutoFocus\": handleCloseAutoFocus,\n // Radix labels and describes the content only by mounted parts\n ...(titleCount.value > 0 ? {} : { \"aria-labelledby\": undefined }),\n ...(descriptionCount.value > 0 ? {} : { \"aria-describedby\": undefined }),\n \"onEscapeKeyDown\": preventDefaultHandler,\n \"onPointerDownOutside\": outsidePress.onPointerDownOutside,\n \"onFocusOutside\": outsidePress.onFocusOutside,\n },\n {\n default: () => [\n h(\"div\", { class: [s.Panel, attrs.class] }, [\n props.showClose\n ? h(DialogClose, null, {\n default: () => [\n h(\"button\", { \"type\": \"button\", \"class\": s.CloseButton, \"aria-label\": \"Close dialog\" }, [\n h(CloseIcon),\n ]),\n ],\n })\n : null,\n slots.default?.(),\n ]),\n ],\n },\n ),\n ])\n\n return () => {\n const { placement, mobilePlacement } = props\n const crossesScreen =\n placement === \"bottom\" || placement === \"start\" || placement === \"end\" || mobilePlacement === \"bottom\"\n return h(RekaDialogPortal, null, {\n default: () => [\n h(\n TransitionGroup,\n // A dialog mounted open enters too, as `v-if` and `open` together do\n {\n class: s.Transition,\n ...(crossesScreen ? overlayTimingLarge : overlayTiming),\n overlay: true,\n preventInitialTransition: false,\n },\n // `open && <div>` in React: closed still renders the empty wrapper\n { default: () => [open.value ? renderDialog() : createCommentVNode()] },\n ),\n ],\n })\n }\n },\n})\n\nexport const DialogHeader = defineComponent({\n name: \"DialogHeader\",\n setup(_props, { slots }) {\n return () => h(\"div\", { class: s.Header }, slots.default?.())\n },\n})\n\n/** The scrolling part between DialogHeader and DialogFooter: with it, only the body scrolls. */\nexport const DialogBody = defineComponent({\n name: \"DialogBody\",\n inheritAttrs: false,\n setup(_props, { slots, attrs }) {\n return () => h(\"div\", { class: [s.Body, attrs.class] }, slots.default?.())\n },\n})\n\nexport const DialogFooter = defineComponent({\n name: \"DialogFooter\",\n setup(_props, { slots }) {\n return () => h(\"div\", { class: s.Footer }, slots.default?.())\n },\n})\n\n/** Counts a mounted part, as Radix's title and description counts do. */\nconst useMountedCount = (count: Ref<number>) => {\n onMounted(() => {\n count.value++\n })\n onBeforeUnmount(() => {\n count.value--\n })\n}\n\nexport const DialogTitle = defineComponent({\n name: \"DialogTitle\",\n setup(_props, { slots }) {\n useMountedCount(useDialogContext().titleCount)\n return () => h(RekaDialogTitle, { class: s.Title }, { default: () => slots.default?.() })\n },\n})\n\nexport const DialogDescription = defineComponent({\n name: \"DialogDescription\",\n setup(_props, { slots }) {\n useMountedCount(useDialogContext().descriptionCount)\n return () => h(RekaDialogDescription, { class: s.Description }, { default: () => slots.default?.() })\n },\n})\n\nexport const DialogClose = defineComponent({\n name: \"DialogClose\",\n setup(_props, { slots }) {\n const rootContext = injectDialogRootContext()\n const onClick = (event: Event) => {\n if (!event.defaultPrevented) rootContext.onOpenChange(false)\n }\n return () => withDialogProps(firstElementChild(slots.default?.()), { type: \"button\" }, onClick)\n },\n})\n\nexport type DialogProps = InstanceType<typeof Dialog>[\"$props\"]\n\nexport type DialogPlacement = \"center\" | \"top\" | \"bottom\" | \"start\" | \"end\" | \"fullscreen\"\n\n/** DialogContent props; `class` lands on the panel, like `className` in React. */\nexport type DialogContentProps = InstanceType<typeof DialogContent>[\"$props\"] & { class?: HTMLAttributes[\"class\"] }\n"]}
@@ -114,7 +114,7 @@ const FieldComponent = defineComponent({
114
114
  required: { type: Boolean, default: false },
115
115
  /** Layout direction of label and control. @default "vertical" */
116
116
  orientation: { type: String, default: "vertical" },
117
- /** Overrides the generated id set on the control and the label's `for`. */
117
+ /** Overrides the generated id set on the control and the label's `for`. A child's own `id` wins over both. */
118
118
  id: String,
119
119
  /** Optically aligns the control's text with surrounding content; passed to the control. */
120
120
  opticallyAlign: String,
@@ -145,17 +145,20 @@ const FieldComponent = defineComponent({
145
145
  // Resolve the children
146
146
  let resolvedChildren;
147
147
  let childSize;
148
+ // The control's id, which the label's `for` has to match
149
+ let controlId = fieldId;
148
150
  if (slots.default) {
149
151
  const { proxy, state } = trackUse({ ...fieldChildProps, "aria-labelledby": labelId });
150
152
  const nodes = slots.default(proxy);
151
153
  const child = state.used ? undefined : singleElement(nodes);
152
154
  childSize = child?.props?.size;
153
- resolvedChildren = child ? [cloneWithFieldProps(child, fieldChildProps, labelId)] : nodes;
155
+ controlId = child?.props?.id || fieldId;
156
+ resolvedChildren = child ? [cloneWithFieldProps(child, { ...fieldChildProps, id: controlId }, labelId)] : nodes;
154
157
  }
155
158
  const size = props.size ?? (CONTROL_SIZES.has(childSize) ? childSize : "md");
156
159
  const labelAction = slots.labelAction ? slots.labelAction() : props.labelAction;
157
160
  const hasLabelAction = slots.labelAction ? hasContent(labelAction) : !!labelAction;
158
- const labelElement = h("label", { class: s.Label, id: labelId, for: fieldId }, [
161
+ const labelElement = h("label", { class: s.Label, id: labelId, for: controlId }, [
159
162
  slots.label ? slots.label() : props.label,
160
163
  required ? h("span", { "class": s.RequiredIndicator, "aria-hidden": "true" }, "*") : null,
161
164
  ]);
@@ -1 +1 @@
1
- {"version":3,"file":"Field.js","sourceRoot":"","sources":["../../../../src/components/Field/Field.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,EAAE,EAAmB,MAAM,MAAM,CAAA;AAC5C,OAAO,EACL,OAAO,EACP,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,eAAe,EACf,CAAC,EACD,OAAO,EACP,KAAK,GAMN,MAAM,KAAK,CAAA;AAEZ,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,CAAC,MAAM,kDAAkD,CAAA;AAqChE,MAAM,aAAa,GAAyB,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAA;AAE/G,mFAAmF;AACnF,MAAM,QAAQ,GAAG,CAAC,MAAuB,EAAE,EAAE;IAC3C,MAAM,KAAK,GAAG,EAAE,IAAI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AAM,CAAC,MAAM,KAAK,GAAG,cAA4E,CAAA","sourcesContent":["import clsx, { type ClassValue } from \"clsx\"\nimport {\n Comment,\n Fragment,\n Static,\n Text,\n camelize,\n cloneVNode,\n defineComponent,\n h,\n isVNode,\n useId,\n type PropType,\n type SlotsType,\n type VNode,\n type VNodeArrayChildren,\n type VNodeChild,\n} from \"vue\"\nimport type { ControlSize } from \"@plexui/styles/types\"\nimport { FieldError } from \"../FieldError/index.js\"\nimport { hasContent } from \"../../lib/slotContent.js\"\nimport s from \"@plexui/styles/components/Field/Field.module.css\"\n\n// Vue port of packages/ui/src/components/Field/Field.tsx.\n//\n// - `label`, `description` and `errorMessage` take a string prop or a slot of\n// the same name (the slot wins), like React's ReactNode props.\n// - Children: React accepts an element, which Field clones with the field\n// props, or a render prop `(fieldProps) => ReactNode`, which it leaves alone.\n// Both are the default slot here, which receives the field props:\n// - a slot that reads them (`v-slot=\"fieldProps\"` + `v-bind=\"fieldProps\"`,\n// `v-slot=\"{ id }\"`, `(fieldProps) => h(...)`) is the render prop: its\n// content renders as it is.\n// - a slot that does not read them and holds exactly one element or\n// component gets it cloned like React's `cloneElement`: `id` and\n// `opticallyAlign` replace the child's own, `aria-describedby` is joined\n// after the child's own ids, and an explicit `aria-invalid` on the child\n// wins. Template comments do not count as children (JSX comments); the\n// placeholder of a `v-if` that renders nothing does, like `{false}` in a\n// React children array, so `<A v-if=\"x\" /><Input />` is not cloned.\n// - anything else (text, several roots, a `v-for` list) renders as it is,\n// like a React child that is not a single element.\n// - content a wrapper forwards with `<slot />` counts as its own roots, as\n// React's `children` passed on to Field are the elements themselves.\n// - As in React only `class` reaches the root element; other attributes are\n// dropped.\n\nexport type FieldChildProps = {\n id: string\n /** The label's id. Bind it to a control that the label's `for` cannot name, such as a Select trigger. */\n \"aria-labelledby\"?: string\n \"aria-describedby\"?: string\n \"aria-invalid\"?: boolean\n opticallyAlign?: \"start\" | \"end\"\n}\n\ntype Props = Record<string, unknown>\n\nconst CONTROL_SIZES: ReadonlySet<unknown> = new Set([\"3xs\", \"2xs\", \"xs\", \"sm\", \"md\", \"lg\", \"xl\", \"2xl\", \"3xl\"])\n\n/** The slot props, recording whether the slot read them (the render-prop form). */\nconst trackUse = (target: FieldChildProps) => {\n const state = { used: false }\n const proxy = new Proxy(target, {\n get(object, key, receiver) {\n state.used = true\n return Reflect.get(object, key, receiver)\n },\n has(object, key) {\n state.used = true\n return Reflect.has(object, key)\n },\n ownKeys(object) {\n state.used = true\n return Reflect.ownKeys(object)\n },\n getOwnPropertyDescriptor(object, key) {\n state.used = true\n return Reflect.getOwnPropertyDescriptor(object, key)\n },\n })\n return { proxy, state }\n}\n\n/** Like React's `isValidElement` for a slot root: an element or a component. */\nconst isElementVNode = (node: VNode) => {\n const { type } = node\n if (type === Fragment || type === Text || type === Comment || type === Static) return false\n if (typeof type === \"object\" && type !== null && (\"__isTeleport\" in type || \"__isSuspense\" in type)) return false\n return true\n}\n\n/**\n * Template comments (`<!-- note -->`) are no children, like JSX comments.\n * The empty placeholder of a `v-if` that renders nothing (or of a `false`\n * child) still counts, like `{false}` in a React children array.\n */\nconst isTemplateComment = (node: VNodeArrayChildren[number]) =>\n isVNode(node) && node.type === Comment && !!node.children && node.children !== \"v-if\"\n\n/**\n * Unwraps content forwarded through a wrapper's `<slot />`: the fragment\n * `renderSlot` creates, keyed `_<slot name>`.\n */\nconst unwrapForwardedSlots = (nodes: VNodeArrayChildren): VNodeArrayChildren =>\n nodes.flatMap((node) =>\n isVNode(node) &&\n node.type === Fragment &&\n typeof node.key === \"string\" &&\n node.key.startsWith(\"_\") &&\n Array.isArray(node.children)\n ? unwrapForwardedSlots(node.children)\n : [node],\n )\n\n/** The one element a non-render-prop slot holds, if it holds exactly one. */\nconst singleElement = (nodes: VNodeArrayChildren): VNode | undefined => {\n const roots = unwrapForwardedSlots(nodes).filter((node) => !isTemplateComment(node))\n if (roots.length !== 1) return undefined\n const [root] = roots\n return isVNode(root) && isElementVNode(root) ? root : undefined\n}\n\n/** A child prop under its attribute name or its camelCase prop name. */\nconst childProp = (props: Props, name: string) => props[name] ?? props[camelize(name)]\n\n/**\n * `cloneElement(child, fieldProps)` with React Field's merging rules. A child\n * without its own name (`aria-label`, `aria-labelledby`, `label`, a `#label`\n * slot) is also labelled by the field's label, which names triggers `for`\n * cannot reach.\n */\nconst cloneWithFieldProps = (child: VNode, fieldChildProps: FieldChildProps, labelId: string): VNode => {\n const own: Props = { ...(child.props ?? {}) }\n const childDescribedBy = childProp(own, \"aria-describedby\") as string | undefined\n const childInvalid = childProp(own, \"aria-invalid\")\n const childSlots = child.children\n const childNamed =\n childProp(own, \"aria-label\") != null ||\n childProp(own, \"aria-labelledby\") != null ||\n own.label != null ||\n (childSlots != null && typeof childSlots === \"object\" && !Array.isArray(childSlots) && \"label\" in childSlots)\n\n const overrides: Props = {\n ...fieldChildProps,\n // Merge with the child's own associations instead of overwriting them\n \"aria-describedby\": [childDescribedBy, fieldChildProps[\"aria-describedby\"]].filter(Boolean).join(\" \") || undefined,\n \"aria-invalid\": childInvalid ?? fieldChildProps[\"aria-invalid\"],\n ...(!childNamed && { \"aria-labelledby\": labelId }),\n }\n\n // One spelling per prop, so the field's value is the one that applies\n for (const key of Object.keys(overrides)) {\n for (const spelling of [key, camelize(key), key.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`)]) {\n delete own[spelling]\n }\n }\n\n return cloneVNode({ ...child, props: own } as VNode, overrides)\n}\n\nconst FieldComponent = defineComponent({\n name: \"Field\",\n inheritAttrs: false,\n props: {\n /** Label text for the field (or the `label` slot) */\n label: String,\n /** Helper text below the label, linked via `aria-describedby` (or the `description` slot) */\n description: String,\n /**\n * Error message below the control (or the `errorMessage` slot). When set,\n * the control gets `aria-invalid=\"true\"`. Rendered with FieldError.\n */\n errorMessage: String,\n /** Content at the end of the label row, such as a link that acts on the field (or the `labelAction` slot) */\n labelAction: String,\n /** Font size of the label, to match the control's size. @default the child control's `size`, else \"md\" */\n size: String as PropType<ControlSize>,\n /** Shows a required asterisk after the label. Visual only: no `required` attribute. @default false */\n required: { type: Boolean, default: false },\n /** Layout direction of label and control. @default \"vertical\" */\n orientation: { type: String as PropType<\"vertical\" | \"horizontal\">, default: \"vertical\" },\n /** Overrides the generated id set on the control and the label's `for`. */\n id: String,\n /** Optically aligns the control's text with surrounding content; passed to the control. */\n opticallyAlign: String as PropType<\"start\" | \"end\">,\n },\n slots: Object as SlotsType<{\n /** The control. Read the props to render them yourself (React's render prop). */\n default?: (fieldProps: FieldChildProps) => VNodeChild\n label?: () => VNodeChild\n labelAction?: () => VNodeChild\n description?: () => VNodeChild\n errorMessage?: () => VNodeChild\n }>,\n setup(props, { attrs, slots }) {\n const generatedId = useId()\n\n return () => {\n const { required, orientation, opticallyAlign } = props\n const fieldId = props.id || `field-${generatedId}`\n const labelId = `${fieldId}-label`\n\n const description = slots.description ? slots.description() : props.description\n const hasDescription = slots.description ? hasContent(description as VNodeArrayChildren) : !!description\n const errorMessage = slots.errorMessage ? slots.errorMessage() : props.errorMessage\n const hasError = slots.errorMessage ? hasContent(errorMessage as VNodeArrayChildren) : !!errorMessage\n\n const descriptionId = hasDescription ? `${fieldId}-description` : undefined\n const errorId = hasError ? `${fieldId}-error` : undefined\n\n // Build aria-describedby from description + error IDs\n const ariaDescribedBy = [descriptionId, errorId].filter(Boolean).join(\" \") || undefined\n const invalid = hasError\n\n // Props to inject into the child control\n const fieldChildProps: FieldChildProps = {\n \"id\": fieldId,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": invalid || undefined,\n ...(opticallyAlign && { opticallyAlign }),\n }\n\n // Resolve the children\n let resolvedChildren: VNodeArrayChildren | undefined\n let childSize: unknown\n if (slots.default) {\n const { proxy, state } = trackUse({ ...fieldChildProps, \"aria-labelledby\": labelId })\n const nodes = slots.default(proxy) as VNodeArrayChildren\n const child = state.used ? undefined : singleElement(nodes)\n childSize = child?.props?.size\n resolvedChildren = child ? [cloneWithFieldProps(child, fieldChildProps, labelId)] : nodes\n }\n const size = props.size ?? (CONTROL_SIZES.has(childSize) ? (childSize as ControlSize) : \"md\")\n\n const labelAction = slots.labelAction ? slots.labelAction() : props.labelAction\n const hasLabelAction = slots.labelAction ? hasContent(labelAction as VNodeArrayChildren) : !!labelAction\n const labelElement = h(\"label\", { class: s.Label, id: labelId, for: fieldId }, [\n slots.label ? slots.label() : props.label,\n required ? h(\"span\", { \"class\": s.RequiredIndicator, \"aria-hidden\": \"true\" }, \"*\") : null,\n ])\n\n return h(\n \"div\",\n {\n \"class\": clsx(s.Field, attrs.class as ClassValue),\n \"data-size\": size,\n \"data-orientation\": orientation,\n \"data-optically-align\": opticallyAlign,\n },\n [\n h(\"div\", { class: s.LabelGroup }, [\n hasLabelAction\n ? h(\"div\", { class: s.LabelRow }, [labelElement, h(\"div\", { class: s.LabelAction }, [labelAction as VNodeChild])])\n : labelElement,\n hasDescription ? h(\"div\", { class: s.Description, id: descriptionId }, [description as VNodeChild]) : null,\n ]),\n h(\"div\", { class: s.Content }, [\n h(\"div\", { class: s.Control }, resolvedChildren),\n hasError ? h(FieldError, { id: errorId }, () => [errorMessage as VNodeChild]) : null,\n ]),\n ],\n )\n }\n },\n})\n\ntype FieldOwnProps = InstanceType<typeof FieldComponent>[\"$props\"]\n\n/** Field props; `class` reaches the root element. */\nexport type FieldProps = FieldOwnProps & { class?: ClassValue }\n\n/** Form field wrapper with label, description, error and accessibility linking. */\nexport const Field = FieldComponent as typeof FieldComponent & { new (): { $props: FieldProps } }\n"]}
1
+ {"version":3,"file":"Field.js","sourceRoot":"","sources":["../../../../src/components/Field/Field.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,EAAE,EAAmB,MAAM,MAAM,CAAA;AAC5C,OAAO,EACL,OAAO,EACP,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,eAAe,EACf,CAAC,EACD,OAAO,EACP,KAAK,GAMN,MAAM,KAAK,CAAA;AAEZ,OAAO,EAAE,UAAU,EAAE,MAA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CAAC,WAAW,EAAE,EAAE,EAAE,aAAa,EAAE,EAAE,CAAC,WAAyB,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI;iBAC3G,CAAC;gBACF,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE;oBAC7B,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,gBAAgB,CAAC;oBAChD,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,YAA0B,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI;iBACrF,CAAC;aACH,CACF,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAOF,mFAAmF;AACnF,MAAM,CAAC,MAAM,KAAK,GAAG,cAA4E,CAAA","sourcesContent":["import clsx, { type ClassValue } from \"clsx\"\nimport {\n Comment,\n Fragment,\n Static,\n Text,\n camelize,\n cloneVNode,\n defineComponent,\n h,\n isVNode,\n useId,\n type PropType,\n type SlotsType,\n type VNode,\n type VNodeArrayChildren,\n type VNodeChild,\n} from \"vue\"\nimport type { ControlSize } from \"@plexui/styles/types\"\nimport { FieldError } from \"../FieldError/index.js\"\nimport { hasContent } from \"../../lib/slotContent.js\"\nimport s from \"@plexui/styles/components/Field/Field.module.css\"\n\n// Vue port of packages/ui/src/components/Field/Field.tsx.\n//\n// - `label`, `description` and `errorMessage` take a string prop or a slot of\n// the same name (the slot wins), like React's ReactNode props.\n// - Children: React accepts an element, which Field clones with the field\n// props, or a render prop `(fieldProps) => ReactNode`, which it leaves alone.\n// Both are the default slot here, which receives the field props:\n// - a slot that reads them (`v-slot=\"fieldProps\"` + `v-bind=\"fieldProps\"`,\n// `v-slot=\"{ id }\"`, `(fieldProps) => h(...)`) is the render prop: its\n// content renders as it is.\n// - a slot that does not read them and holds exactly one element or\n// component gets it cloned like React's `cloneElement`: `opticallyAlign`\n// replaces the child's own, the child's own `id` stays and the label's\n// `for` follows it, `aria-describedby` is joined after the child's own\n// ids, and an explicit `aria-invalid` on the child wins. Template\n// comments do not count as children (JSX comments); the\n// placeholder of a `v-if` that renders nothing does, like `{false}` in a\n// React children array, so `<A v-if=\"x\" /><Input />` is not cloned.\n// - anything else (text, several roots, a `v-for` list) renders as it is,\n// like a React child that is not a single element.\n// - content a wrapper forwards with `<slot />` counts as its own roots, as\n// React's `children` passed on to Field are the elements themselves.\n// - As in React only `class` reaches the root element; other attributes are\n// dropped.\n\nexport type FieldChildProps = {\n id: string\n /** The label's id. Bind it to a control that the label's `for` cannot name, such as a Select trigger. */\n \"aria-labelledby\"?: string\n \"aria-describedby\"?: string\n \"aria-invalid\"?: boolean\n opticallyAlign?: \"start\" | \"end\"\n}\n\ntype Props = Record<string, unknown>\n\nconst CONTROL_SIZES: ReadonlySet<unknown> = new Set([\"3xs\", \"2xs\", \"xs\", \"sm\", \"md\", \"lg\", \"xl\", \"2xl\", \"3xl\"])\n\n/** The slot props, recording whether the slot read them (the render-prop form). */\nconst trackUse = (target: FieldChildProps) => {\n const state = { used: false }\n const proxy = new Proxy(target, {\n get(object, key, receiver) {\n state.used = true\n return Reflect.get(object, key, receiver)\n },\n has(object, key) {\n state.used = true\n return Reflect.has(object, key)\n },\n ownKeys(object) {\n state.used = true\n return Reflect.ownKeys(object)\n },\n getOwnPropertyDescriptor(object, key) {\n state.used = true\n return Reflect.getOwnPropertyDescriptor(object, key)\n },\n })\n return { proxy, state }\n}\n\n/** Like React's `isValidElement` for a slot root: an element or a component. */\nconst isElementVNode = (node: VNode) => {\n const { type } = node\n if (type === Fragment || type === Text || type === Comment || type === Static) return false\n if (typeof type === \"object\" && type !== null && (\"__isTeleport\" in type || \"__isSuspense\" in type)) return false\n return true\n}\n\n/**\n * Template comments (`<!-- note -->`) are no children, like JSX comments.\n * The empty placeholder of a `v-if` that renders nothing (or of a `false`\n * child) still counts, like `{false}` in a React children array.\n */\nconst isTemplateComment = (node: VNodeArrayChildren[number]) =>\n isVNode(node) && node.type === Comment && !!node.children && node.children !== \"v-if\"\n\n/**\n * Unwraps content forwarded through a wrapper's `<slot />`: the fragment\n * `renderSlot` creates, keyed `_<slot name>`.\n */\nconst unwrapForwardedSlots = (nodes: VNodeArrayChildren): VNodeArrayChildren =>\n nodes.flatMap((node) =>\n isVNode(node) &&\n node.type === Fragment &&\n typeof node.key === \"string\" &&\n node.key.startsWith(\"_\") &&\n Array.isArray(node.children)\n ? unwrapForwardedSlots(node.children)\n : [node],\n )\n\n/** The one element a non-render-prop slot holds, if it holds exactly one. */\nconst singleElement = (nodes: VNodeArrayChildren): VNode | undefined => {\n const roots = unwrapForwardedSlots(nodes).filter((node) => !isTemplateComment(node))\n if (roots.length !== 1) return undefined\n const [root] = roots\n return isVNode(root) && isElementVNode(root) ? root : undefined\n}\n\n/** A child prop under its attribute name or its camelCase prop name. */\nconst childProp = (props: Props, name: string) => props[name] ?? props[camelize(name)]\n\n/**\n * `cloneElement(child, fieldProps)` with React Field's merging rules. A child\n * without its own name (`aria-label`, `aria-labelledby`, `label`, a `#label`\n * slot) is also labelled by the field's label, which names triggers `for`\n * cannot reach.\n */\nconst cloneWithFieldProps = (child: VNode, fieldChildProps: FieldChildProps, labelId: string): VNode => {\n const own: Props = { ...(child.props ?? {}) }\n const childDescribedBy = childProp(own, \"aria-describedby\") as string | undefined\n const childInvalid = childProp(own, \"aria-invalid\")\n const childSlots = child.children\n const childNamed =\n childProp(own, \"aria-label\") != null ||\n childProp(own, \"aria-labelledby\") != null ||\n own.label != null ||\n (childSlots != null && typeof childSlots === \"object\" && !Array.isArray(childSlots) && \"label\" in childSlots)\n\n const overrides: Props = {\n ...fieldChildProps,\n // Merge with the child's own associations instead of overwriting them\n \"aria-describedby\": [childDescribedBy, fieldChildProps[\"aria-describedby\"]].filter(Boolean).join(\" \") || undefined,\n \"aria-invalid\": childInvalid ?? fieldChildProps[\"aria-invalid\"],\n ...(!childNamed && { \"aria-labelledby\": labelId }),\n }\n\n // One spelling per prop, so the field's value is the one that applies\n for (const key of Object.keys(overrides)) {\n for (const spelling of [key, camelize(key), key.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`)]) {\n delete own[spelling]\n }\n }\n\n return cloneVNode({ ...child, props: own } as VNode, overrides)\n}\n\nconst FieldComponent = defineComponent({\n name: \"Field\",\n inheritAttrs: false,\n props: {\n /** Label text for the field (or the `label` slot) */\n label: String,\n /** Helper text below the label, linked via `aria-describedby` (or the `description` slot) */\n description: String,\n /**\n * Error message below the control (or the `errorMessage` slot). When set,\n * the control gets `aria-invalid=\"true\"`. Rendered with FieldError.\n */\n errorMessage: String,\n /** Content at the end of the label row, such as a link that acts on the field (or the `labelAction` slot) */\n labelAction: String,\n /** Font size of the label, to match the control's size. @default the child control's `size`, else \"md\" */\n size: String as PropType<ControlSize>,\n /** Shows a required asterisk after the label. Visual only: no `required` attribute. @default false */\n required: { type: Boolean, default: false },\n /** Layout direction of label and control. @default \"vertical\" */\n orientation: { type: String as PropType<\"vertical\" | \"horizontal\">, default: \"vertical\" },\n /** Overrides the generated id set on the control and the label's `for`. A child's own `id` wins over both. */\n id: String,\n /** Optically aligns the control's text with surrounding content; passed to the control. */\n opticallyAlign: String as PropType<\"start\" | \"end\">,\n },\n slots: Object as SlotsType<{\n /** The control. Read the props to render them yourself (React's render prop). */\n default?: (fieldProps: FieldChildProps) => VNodeChild\n label?: () => VNodeChild\n labelAction?: () => VNodeChild\n description?: () => VNodeChild\n errorMessage?: () => VNodeChild\n }>,\n setup(props, { attrs, slots }) {\n const generatedId = useId()\n\n return () => {\n const { required, orientation, opticallyAlign } = props\n const fieldId = props.id || `field-${generatedId}`\n const labelId = `${fieldId}-label`\n\n const description = slots.description ? slots.description() : props.description\n const hasDescription = slots.description ? hasContent(description as VNodeArrayChildren) : !!description\n const errorMessage = slots.errorMessage ? slots.errorMessage() : props.errorMessage\n const hasError = slots.errorMessage ? hasContent(errorMessage as VNodeArrayChildren) : !!errorMessage\n\n const descriptionId = hasDescription ? `${fieldId}-description` : undefined\n const errorId = hasError ? `${fieldId}-error` : undefined\n\n // Build aria-describedby from description + error IDs\n const ariaDescribedBy = [descriptionId, errorId].filter(Boolean).join(\" \") || undefined\n const invalid = hasError\n\n // Props to inject into the child control\n const fieldChildProps: FieldChildProps = {\n \"id\": fieldId,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": invalid || undefined,\n ...(opticallyAlign && { opticallyAlign }),\n }\n\n // Resolve the children\n let resolvedChildren: VNodeArrayChildren | undefined\n let childSize: unknown\n // The control's id, which the label's `for` has to match\n let controlId = fieldId\n if (slots.default) {\n const { proxy, state } = trackUse({ ...fieldChildProps, \"aria-labelledby\": labelId })\n const nodes = slots.default(proxy) as VNodeArrayChildren\n const child = state.used ? undefined : singleElement(nodes)\n childSize = child?.props?.size\n controlId = (child?.props?.id as string | undefined) || fieldId\n resolvedChildren = child ? [cloneWithFieldProps(child, { ...fieldChildProps, id: controlId }, labelId)] : nodes\n }\n const size = props.size ?? (CONTROL_SIZES.has(childSize) ? (childSize as ControlSize) : \"md\")\n\n const labelAction = slots.labelAction ? slots.labelAction() : props.labelAction\n const hasLabelAction = slots.labelAction ? hasContent(labelAction as VNodeArrayChildren) : !!labelAction\n const labelElement = h(\"label\", { class: s.Label, id: labelId, for: controlId }, [\n slots.label ? slots.label() : props.label,\n required ? h(\"span\", { \"class\": s.RequiredIndicator, \"aria-hidden\": \"true\" }, \"*\") : null,\n ])\n\n return h(\n \"div\",\n {\n \"class\": clsx(s.Field, attrs.class as ClassValue),\n \"data-size\": size,\n \"data-orientation\": orientation,\n \"data-optically-align\": opticallyAlign,\n },\n [\n h(\"div\", { class: s.LabelGroup }, [\n hasLabelAction\n ? h(\"div\", { class: s.LabelRow }, [labelElement, h(\"div\", { class: s.LabelAction }, [labelAction as VNodeChild])])\n : labelElement,\n hasDescription ? h(\"div\", { class: s.Description, id: descriptionId }, [description as VNodeChild]) : null,\n ]),\n h(\"div\", { class: s.Content }, [\n h(\"div\", { class: s.Control }, resolvedChildren),\n hasError ? h(FieldError, { id: errorId }, () => [errorMessage as VNodeChild]) : null,\n ]),\n ],\n )\n }\n },\n})\n\ntype FieldOwnProps = InstanceType<typeof FieldComponent>[\"$props\"]\n\n/** Field props; `class` reaches the root element. */\nexport type FieldProps = FieldOwnProps & { class?: ClassValue }\n\n/** Form field wrapper with label, description, error and accessibility linking. */\nexport const Field = FieldComponent as typeof FieldComponent & { new (): { $props: FieldProps } }\n"]}
@@ -71,7 +71,6 @@ const InputGroupComponent = defineComponent({
71
71
  return () => {
72
72
  const { class: className, onMousedown: _onMousedown, ...restAttrs } = attrs;
73
73
  return h("div", {
74
- "role": "group",
75
74
  "data-slot": "input-group",
76
75
  "data-variant": props.variant,
77
76
  "data-size": props.size,
@@ -1 +1 @@
1
- {"version":3,"file":"InputGroup.js","sourceRoot":"","sources":["../../../../src/components/InputGroup/InputGroup.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,CAAC,EACD,MAAM,EACN,QAAQ,EACR,SAAS,EACT,OAAO,EACP,GAAG,EACH,KAAK,EACL,cAAc,GAMf,MAAM,KAAK,CAAA;AAEZ,OAAO,EAAE,MAAM,EAAsC,MAAM,oBAAoB,CAAA;AAC/E,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AACtE,OAAO,CAAC,MAAM,4DAA4D,CAAA;AAmB1E,MAAM,aAAa,GAAoC,MAAM,CAAC,YAAY,CAAC,CAAA;AAE3E,MAAM,gBAAgB,GAAG,mCAAmC,CAAA;AAE5D,yEAAyE;AACzE,MAAM,aAAa,GAAG,CAAC,QAAiB,EAAE,GAAU,EAAE,EAAE;IACtD,KAAK,MAAM,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,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AAC,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;IACjG,CAAC;CACF,CAAC,CAAA","sourcesContent":["import {\n defineComponent,\n h,\n inject,\n nextTick,\n onMounted,\n provide,\n ref,\n watch,\n withDirectives,\n type HTMLAttributes,\n type InjectionKey,\n type InputHTMLAttributes,\n type PropType,\n type TextareaHTMLAttributes,\n} from \"vue\"\nimport type { ControlSize, Variants } from \"@plexui/styles/types\"\nimport { Button, type ButtonColor, type ButtonProps } from \"../Button/index.js\"\nimport { vDefaultValue, vServerText } from \"../../lib/defaultValue.js\"\nimport s from \"@plexui/styles/components/InputGroup/InputGroup.module.css\"\n\n// Vue port of packages/ui/src/components/InputGroup/InputGroup.tsx.\n// Exports are flat (`InputGroupInput` for `InputGroup.Input`, ...). The group\n// provides its size, pill, disabled and invalid state to the parts, as the\n// React context does. React spreads the remaining props after its own\n// attributes, so caller attributes win; Vue's attribute fallthrough merges\n// them the same way. `InputGroupInput` / `InputGroupTextarea` take\n// `v-model:value` and `default-value` like Input and Textarea (the textarea's\n// text content follows the value and its value is set imperatively, as in\n// Textarea).\n\ntype InputGroupContext = {\n readonly size: ControlSize\n readonly pill: boolean\n readonly disabled: boolean\n readonly invalid: boolean\n}\n\nconst InputGroupKey: InjectionKey<InputGroupContext> = Symbol(\"InputGroup\")\n\nconst CONTROL_SELECTOR = \"[data-slot='input-group-control']\"\n\n// A fallthrough listener is a function or, when merged, an array of them\nconst callListeners = (listener: unknown, evt: Event) => {\n for (const fn of Array.isArray(listener) ? listener : [listener]) {\n if (typeof fn === \"function\") fn(evt)\n }\n}\n\n/** Button size for each group size: the closest Button that fits inside the control */\nconst BUTTON_SIZE: Record<ControlSize, ControlSize> = {\n \"3xs\": \"3xs\",\n \"2xs\": \"3xs\",\n \"xs\": \"3xs\",\n \"sm\": \"3xs\",\n \"md\": \"2xs\",\n \"lg\": \"sm\",\n \"xl\": \"md\",\n \"2xl\": \"lg\",\n \"3xl\": \"xl\",\n}\n\nconst InputGroupComponent = defineComponent({\n name: \"InputGroup\",\n inheritAttrs: false,\n props: {\n /** Visual style of the group. @default \"outline\" */\n variant: { type: String as PropType<Variants<\"outline\" | \"soft\">>, default: \"outline\" },\n /** Controls the size of the group, on the same scale as Input: `3xs` 22px up to `3xl` 48px. @default \"md\" */\n size: { type: String as PropType<ControlSize>, default: \"md\" },\n /** Fully rounded group, with pill buttons inside. @default false */\n pill: { type: Boolean, default: false },\n /** Disables the control and the buttons inside the group. @default false */\n disabled: { type: Boolean, default: false },\n /** Mark the group as invalid. @default false */\n invalid: { type: Boolean, default: false },\n },\n setup(props, { attrs, slots }) {\n provide(InputGroupKey, {\n get size() {\n return props.size\n },\n get pill() {\n return props.pill\n },\n get disabled() {\n return props.disabled\n },\n get invalid() {\n return props.invalid\n },\n })\n\n // Clicks on the frame, icons and text focus the control, as in Input\n const handleMouseDown = (evt: MouseEvent) => {\n callListeners(attrs.onMousedown, evt)\n const control = (evt.currentTarget as HTMLElement).querySelector<HTMLElement>(CONTROL_SELECTOR)\n const { target } = evt\n if (evt.defaultPrevented || !control || !(target instanceof Element) || control.contains(target)) {\n return\n }\n // Buttons, links, menus and other controls in the addons take their own clicks\n if (target.closest(\"button, a, input, textarea, select, [role='button'], [role='menuitem']\")) {\n return\n }\n evt.preventDefault()\n control.focus()\n }\n\n return () => {\n const { class: className, onMousedown: _onMousedown, ...restAttrs } = attrs\n return h(\n \"div\",\n {\n \"role\": \"group\",\n \"data-slot\": \"input-group\",\n \"data-variant\": props.variant,\n \"data-size\": props.size,\n \"data-pill\": props.pill ? \"\" : undefined,\n \"data-disabled\": props.disabled ? \"\" : undefined,\n \"data-invalid\": props.invalid ? \"\" : undefined,\n \"class\": [s.InputGroup, className],\n \"onMousedown\": handleMouseDown,\n ...restAttrs,\n },\n slots.default?.(),\n )\n }\n },\n})\n\ntype InputGroupOwnProps = InstanceType<typeof InputGroupComponent>[\"$props\"]\n\n/** InputGroup props plus the native <div> attributes that fall through to it, as in React. */\nexport type InputGroupProps = InputGroupOwnProps & Omit<HTMLAttributes, keyof InputGroupOwnProps>\n\n/** An input or textarea with icons, text, buttons and menus attached inside one frame. */\nexport const InputGroup = InputGroupComponent as typeof InputGroupComponent & {\n new (): { $props: InputGroupProps }\n}\n\n// `value` / `default-value` / `update:value` for the native control, as in Input\nconst controlProps = {\n /** Controlled value; use with `v-model:value` */\n value: { type: [String, Number] as PropType<string | number>, default: undefined },\n /** Initial value of an uncontrolled control */\n defaultValue: { type: [String, Number] as PropType<string | number>, default: undefined },\n /** Disables the control; defaults to the group's `disabled` */\n disabled: { type: Boolean, default: undefined },\n}\n\nconst useControl = (props: { value?: string | number }, emit: (event: \"update:value\", value: string) => void) => {\n const group = inject(InputGroupKey, null)\n const handleInput = (evt: Event) => {\n const target = evt.currentTarget as HTMLInputElement | HTMLTextAreaElement\n emit(\"update:value\", target.value)\n // Like a React controlled input, a `value` the parent does not update is put back\n void nextTick(() => {\n if (props.value === undefined) return\n const value = String(props.value)\n if (target.value !== value) target.value = value\n })\n }\n return { group, handleInput }\n}\n\nconst InputGroupInputComponent = defineComponent({\n name: \"InputGroupInput\",\n props: {\n ...controlProps,\n /** @default \"text\" */\n type: { type: String, default: \"text\" },\n },\n emits: {\n \"update:value\": (_value: string) => true,\n },\n setup(props, { emit }) {\n const { group, handleInput } = useControl(props, emit)\n return () =>\n withDirectives(\n h(\"input\", {\n \"type\": props.type,\n \"data-slot\": \"input-group-control\",\n \"class\": s.Control,\n \"disabled\": props.disabled ?? group?.disabled,\n // Expose the group's invalid state to assistive tech; an explicit aria-invalid wins\n \"aria-invalid\": group?.invalid || undefined,\n ...(props.value !== undefined ? { value: props.value } : {}),\n \"onInput\": handleInput,\n }),\n [[vDefaultValue, props.value === undefined ? props.defaultValue : undefined]],\n )\n },\n})\n\ntype InputGroupInputOwnProps = InstanceType<typeof InputGroupInputComponent>[\"$props\"]\n\n/** InputGroupInput props plus the native <input> attributes that fall through to it. */\nexport type InputGroupInputProps = InputGroupInputOwnProps &\n Omit<InputHTMLAttributes, keyof InputGroupInputOwnProps | \"size\">\n\n/** The native <input> of the group, without its own frame (React `InputGroup.Input`). */\nexport const InputGroupInput = InputGroupInputComponent as typeof InputGroupInputComponent & {\n new (): { $props: InputGroupInputProps }\n}\n\nconst InputGroupTextareaComponent = defineComponent({\n name: \"InputGroupTextarea\",\n props: {\n ...controlProps,\n /** @default 3 */\n rows: { type: [Number, String] as PropType<number | string>, default: 3 },\n },\n emits: {\n \"update:value\": (_value: string) => true,\n },\n setup(props, { emit }) {\n const group = inject(InputGroupKey, null)\n const textareaRef = ref<HTMLTextAreaElement | null>(null)\n\n // Set imperatively, like React DOM: a `value` prop would make Vue mirror\n // it into a `value` attribute, which React never renders\n const syncValue = () => {\n const textarea = textareaRef.value\n if (!textarea || props.value === undefined) return\n const value = String(props.value)\n if (textarea.value !== value) textarea.value = value\n }\n onMounted(() => {\n // React's initTextarea: the initial text becomes the (dirty) value\n const textarea = textareaRef.value\n const initialValue = textarea?.textContent ?? \"\"\n if (textarea && initialValue !== \"\") textarea.value = initialValue\n })\n watch(() => props.value, syncValue, { flush: \"post\" })\n\n const handleInput = (evt: Event) => {\n emit(\"update:value\", (evt.currentTarget as HTMLTextAreaElement).value)\n // A controlled value the parent did not update wins over the typed text\n void nextTick(syncValue)\n }\n\n return () => {\n // React keeps the textarea's text content in sync with the controlled\n // value, else with `defaultValue`\n const textContent = String(props.value ?? props.defaultValue ?? \"\")\n return withDirectives(\n h(\"textarea\", {\n \"ref\": textareaRef,\n \"rows\": props.rows,\n \"data-slot\": \"input-group-control\",\n \"class\": s.Control,\n \"disabled\": props.disabled ?? group?.disabled,\n \"aria-invalid\": group?.invalid || undefined,\n textContent,\n \"onInput\": handleInput,\n }),\n [[vServerText, textContent]],\n )\n }\n },\n})\n\ntype InputGroupTextareaOwnProps = InstanceType<typeof InputGroupTextareaComponent>[\"$props\"]\n\n/** InputGroupTextarea props plus the native <textarea> attributes that fall through to it. */\nexport type InputGroupTextareaProps = InputGroupTextareaOwnProps &\n Omit<TextareaHTMLAttributes, keyof InputGroupTextareaOwnProps>\n\n/** The native <textarea> of the group (React `InputGroup.Textarea`). */\nexport const InputGroupTextarea = InputGroupTextareaComponent as typeof InputGroupTextareaComponent & {\n new (): { $props: InputGroupTextareaProps }\n}\n\nexport type InputGroupAddonAlign = \"inline-start\" | \"inline-end\" | \"block-start\" | \"block-end\"\n\n/** Icons, text and buttons beside, above or below the control (React `InputGroup.Addon`). */\nexport const InputGroupAddon = defineComponent({\n name: \"InputGroupAddon\",\n props: {\n /**\n * Where the addon sits: before or after the control on its line, or as a\n * row above or below it.\n * @default \"inline-start\"\n */\n align: { type: String as PropType<InputGroupAddonAlign>, default: \"inline-start\" },\n },\n setup(props, { slots }) {\n return () =>\n h(\n \"div\",\n { \"data-slot\": \"input-group-addon\", \"data-align\": props.align, \"class\": s.Addon },\n slots.default?.(),\n )\n },\n})\n\nexport type InputGroupAddonProps = InstanceType<typeof InputGroupAddon>[\"$props\"] &\n Omit<HTMLAttributes, keyof InstanceType<typeof InputGroupAddon>[\"$props\"]>\n\nconst InputGroupButtonComponent = defineComponent({\n name: \"InputGroupButton\",\n props: {\n /** Color for the button. @default \"secondary\" */\n color: { type: String as PropType<ButtonColor>, default: \"secondary\" },\n /** Style variant. @default \"ghost\" */\n variant: { type: String as PropType<Variants<\"solid\" | \"soft\" | \"outline\" | \"ghost\">>, default: \"ghost\" },\n pill: { type: Boolean, default: undefined },\n disabled: { type: Boolean, default: undefined },\n },\n setup(props, { slots }) {\n const group = inject(InputGroupKey, null)\n return () =>\n h(\n Button,\n {\n color: props.color,\n variant: props.variant,\n size: BUTTON_SIZE[group?.size ?? \"md\"],\n pill: props.pill ?? group?.pill,\n disabled: props.disabled ?? group?.disabled,\n class: s.Button,\n },\n slots,\n )\n },\n})\n\ntype InputGroupButtonOwnProps = InstanceType<typeof InputGroupButtonComponent>[\"$props\"]\n\n/** InputGroupButton props plus the Button props (except `size`) that fall through to it, as in React. */\nexport type InputGroupButtonProps = InputGroupButtonOwnProps &\n Omit<ButtonProps, keyof InputGroupButtonOwnProps | \"size\">\n\n/**\n * A ghost `Button` sized from the group (React `InputGroup.Button`). Takes the\n * Button props except `size`; `pill` and `disabled` default to the group's.\n */\nexport const InputGroupButton = InputGroupButtonComponent as typeof InputGroupButtonComponent & {\n new (): { $props: InputGroupButtonProps }\n}\n\n/** Text and icons inside an addon: prefixes, units, counters (React `InputGroup.Text`). */\nexport const InputGroupText = defineComponent({\n name: \"InputGroupText\",\n setup(_props, { slots }) {\n return () => h(\"span\", { \"data-slot\": \"input-group-text\", \"class\": s.Text }, slots.default?.())\n },\n})\n\nexport type InputGroupTextProps = HTMLAttributes\n"]}
1
+ {"version":3,"file":"InputGroup.js","sourceRoot":"","sources":["../../../../src/components/InputGroup/InputGroup.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,CAAC,EACD,MAAM,EACN,QAAQ,EACR,SAAS,EACT,OAAO,EACP,GAAG,EACH,KAAK,EACL,cAAc,GAMf,MAAM,KAAK,CAAA;AAEZ,OAAO,EAAE,MAAM,EAAsC,MAAM,oBAAoB,CAAA;AAC/E,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AACtE,OAAO,CAAC,MAAM,4DAA4D,CAAA;AAmB1E,MAAM,aAAa,GAAoC,MAAM,CAAC,YAAY,CAAC,CAAA;AAE3E,MAAM,gBAAgB,GAAG,mCAAmC,CAAA;AAE5D,yEAAyE;AACzE,MAAM,aAAa,GAAG,CAAC,QAAiB,EAAE,GAAU,EAAE,EAAE;IACtD,KAAK,MAAM,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC;QACjE,IAAI,OAAO,EAAE,KAAK,UAAU;YAAE,EAAE,CAAC,GAAG,CAAC,CAAA;IACvC,CAAC;AAC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Component,\n h,\n inject,\n nextTick,\n onMounted,\n provide,\n ref,\n watch,\n withDirectives,\n type HTMLAttributes,\n type InjectionKey,\n type InputHTMLAttributes,\n type PropType,\n type TextareaHTMLAttributes,\n} from \"vue\"\nimport type { ControlSize, Variants } from \"@plexui/styles/types\"\nimport { Button, type ButtonColor, type ButtonProps } from \"../Button/index.js\"\nimport { vDefaultValue, vServerText } from \"../../lib/defaultValue.js\"\nimport s from \"@plexui/styles/components/InputGroup/InputGroup.module.css\"\n\n// Vue port of packages/ui/src/components/InputGroup/InputGroup.tsx.\n// Exports are flat (`InputGroupInput` for `InputGroup.Input`, ...). The group\n// provides its size, pill, disabled and invalid state to the parts, as the\n// React context does. React spreads the remaining props after its own\n// attributes, so caller attributes win; Vue's attribute fallthrough merges\n// them the same way. `InputGroupInput` / `InputGroupTextarea` take\n// `v-model:value` and `default-value` like Input and Textarea (the textarea's\n// text content follows the value and its value is set imperatively, as in\n// Textarea).\n\ntype InputGroupContext = {\n readonly size: ControlSize\n readonly pill: boolean\n readonly disabled: boolean\n readonly invalid: boolean\n}\n\nconst InputGroupKey: InjectionKey<InputGroupContext> = Symbol(\"InputGroup\")\n\nconst CONTROL_SELECTOR = \"[data-slot='input-group-control']\"\n\n// A fallthrough listener is a function or, when merged, an array of them\nconst callListeners = (listener: unknown, evt: Event) => {\n for (const fn of Array.isArray(listener) ? listener : [listener]) {\n if (typeof fn === \"function\") fn(evt)\n }\n}\n\n/** Button size for each group size: the closest Button that fits inside the control */\nconst BUTTON_SIZE: Record<ControlSize, ControlSize> = {\n \"3xs\": \"3xs\",\n \"2xs\": \"3xs\",\n \"xs\": \"3xs\",\n \"sm\": \"3xs\",\n \"md\": \"2xs\",\n \"lg\": \"sm\",\n \"xl\": \"md\",\n \"2xl\": \"lg\",\n \"3xl\": \"xl\",\n}\n\nconst InputGroupComponent = defineComponent({\n name: \"InputGroup\",\n inheritAttrs: false,\n props: {\n /** Visual style of the group. @default \"outline\" */\n variant: { type: String as PropType<Variants<\"outline\" | \"soft\">>, default: \"outline\" },\n /** Controls the size of the group, on the same scale as Input: `3xs` 22px up to `3xl` 48px. @default \"md\" */\n size: { type: String as PropType<ControlSize>, default: \"md\" },\n /** Fully rounded group, with pill buttons inside. @default false */\n pill: { type: Boolean, default: false },\n /** Disables the control and the buttons inside the group. @default false */\n disabled: { type: Boolean, default: false },\n /** Mark the group as invalid. @default false */\n invalid: { type: Boolean, default: false },\n },\n setup(props, { attrs, slots }) {\n provide(InputGroupKey, {\n get size() {\n return props.size\n },\n get pill() {\n return props.pill\n },\n get disabled() {\n return props.disabled\n },\n get invalid() {\n return props.invalid\n },\n })\n\n // Clicks on the frame, icons and text focus the control, as in Input\n const handleMouseDown = (evt: MouseEvent) => {\n callListeners(attrs.onMousedown, evt)\n const control = (evt.currentTarget as HTMLElement).querySelector<HTMLElement>(CONTROL_SELECTOR)\n const { target } = evt\n if (evt.defaultPrevented || !control || !(target instanceof Element) || control.contains(target)) {\n return\n }\n // Buttons, links, menus and other controls in the addons take their own clicks\n if (target.closest(\"button, a, input, textarea, select, [role='button'], [role='menuitem']\")) {\n return\n }\n evt.preventDefault()\n control.focus()\n }\n\n return () => {\n const { class: className, onMousedown: _onMousedown, ...restAttrs } = attrs\n return h(\n \"div\",\n {\n \"data-slot\": \"input-group\",\n \"data-variant\": props.variant,\n \"data-size\": props.size,\n \"data-pill\": props.pill ? \"\" : undefined,\n \"data-disabled\": props.disabled ? \"\" : undefined,\n \"data-invalid\": props.invalid ? \"\" : undefined,\n \"class\": [s.InputGroup, className],\n \"onMousedown\": handleMouseDown,\n ...restAttrs,\n },\n slots.default?.(),\n )\n }\n },\n})\n\ntype InputGroupOwnProps = InstanceType<typeof InputGroupComponent>[\"$props\"]\n\n/** InputGroup props plus the native <div> attributes that fall through to it, as in React. */\nexport type InputGroupProps = InputGroupOwnProps & Omit<HTMLAttributes, keyof InputGroupOwnProps>\n\n/** An input or textarea with icons, text, buttons and menus attached inside one frame. */\nexport const InputGroup = InputGroupComponent as typeof InputGroupComponent & {\n new (): { $props: InputGroupProps }\n}\n\n// `value` / `default-value` / `update:value` for the native control, as in Input\nconst controlProps = {\n /** Controlled value; use with `v-model:value` */\n value: { type: [String, Number] as PropType<string | number>, default: undefined },\n /** Initial value of an uncontrolled control */\n defaultValue: { type: [String, Number] as PropType<string | number>, default: undefined },\n /** Disables the control; defaults to the group's `disabled` */\n disabled: { type: Boolean, default: undefined },\n}\n\nconst useControl = (props: { value?: string | number }, emit: (event: \"update:value\", value: string) => void) => {\n const group = inject(InputGroupKey, null)\n const handleInput = (evt: Event) => {\n const target = evt.currentTarget as HTMLInputElement | HTMLTextAreaElement\n emit(\"update:value\", target.value)\n // Like a React controlled input, a `value` the parent does not update is put back\n void nextTick(() => {\n if (props.value === undefined) return\n const value = String(props.value)\n if (target.value !== value) target.value = value\n })\n }\n return { group, handleInput }\n}\n\nconst InputGroupInputComponent = defineComponent({\n name: \"InputGroupInput\",\n props: {\n ...controlProps,\n /** @default \"text\" */\n type: { type: String, default: \"text\" },\n },\n emits: {\n \"update:value\": (_value: string) => true,\n },\n setup(props, { emit }) {\n const { group, handleInput } = useControl(props, emit)\n return () =>\n withDirectives(\n h(\"input\", {\n \"type\": props.type,\n \"data-slot\": \"input-group-control\",\n \"class\": s.Control,\n \"disabled\": props.disabled ?? group?.disabled,\n // Expose the group's invalid state to assistive tech; an explicit aria-invalid wins\n \"aria-invalid\": group?.invalid || undefined,\n ...(props.value !== undefined ? { value: props.value } : {}),\n \"onInput\": handleInput,\n }),\n [[vDefaultValue, props.value === undefined ? props.defaultValue : undefined]],\n )\n },\n})\n\ntype InputGroupInputOwnProps = InstanceType<typeof InputGroupInputComponent>[\"$props\"]\n\n/** InputGroupInput props plus the native <input> attributes that fall through to it. */\nexport type InputGroupInputProps = InputGroupInputOwnProps &\n Omit<InputHTMLAttributes, keyof InputGroupInputOwnProps | \"size\">\n\n/** The native <input> of the group, without its own frame (React `InputGroup.Input`). */\nexport const InputGroupInput = InputGroupInputComponent as typeof InputGroupInputComponent & {\n new (): { $props: InputGroupInputProps }\n}\n\nconst InputGroupTextareaComponent = defineComponent({\n name: \"InputGroupTextarea\",\n props: {\n ...controlProps,\n /** @default 3 */\n rows: { type: [Number, String] as PropType<number | string>, default: 3 },\n },\n emits: {\n \"update:value\": (_value: string) => true,\n },\n setup(props, { emit }) {\n const group = inject(InputGroupKey, null)\n const textareaRef = ref<HTMLTextAreaElement | null>(null)\n\n // Set imperatively, like React DOM: a `value` prop would make Vue mirror\n // it into a `value` attribute, which React never renders\n const syncValue = () => {\n const textarea = textareaRef.value\n if (!textarea || props.value === undefined) return\n const value = String(props.value)\n if (textarea.value !== value) textarea.value = value\n }\n onMounted(() => {\n // React's initTextarea: the initial text becomes the (dirty) value\n const textarea = textareaRef.value\n const initialValue = textarea?.textContent ?? \"\"\n if (textarea && initialValue !== \"\") textarea.value = initialValue\n })\n watch(() => props.value, syncValue, { flush: \"post\" })\n\n const handleInput = (evt: Event) => {\n emit(\"update:value\", (evt.currentTarget as HTMLTextAreaElement).value)\n // A controlled value the parent did not update wins over the typed text\n void nextTick(syncValue)\n }\n\n return () => {\n // React keeps the textarea's text content in sync with the controlled\n // value, else with `defaultValue`\n const textContent = String(props.value ?? props.defaultValue ?? \"\")\n return withDirectives(\n h(\"textarea\", {\n \"ref\": textareaRef,\n \"rows\": props.rows,\n \"data-slot\": \"input-group-control\",\n \"class\": s.Control,\n \"disabled\": props.disabled ?? group?.disabled,\n \"aria-invalid\": group?.invalid || undefined,\n textContent,\n \"onInput\": handleInput,\n }),\n [[vServerText, textContent]],\n )\n }\n },\n})\n\ntype InputGroupTextareaOwnProps = InstanceType<typeof InputGroupTextareaComponent>[\"$props\"]\n\n/** InputGroupTextarea props plus the native <textarea> attributes that fall through to it. */\nexport type InputGroupTextareaProps = InputGroupTextareaOwnProps &\n Omit<TextareaHTMLAttributes, keyof InputGroupTextareaOwnProps>\n\n/** The native <textarea> of the group (React `InputGroup.Textarea`). */\nexport const InputGroupTextarea = InputGroupTextareaComponent as typeof InputGroupTextareaComponent & {\n new (): { $props: InputGroupTextareaProps }\n}\n\nexport type InputGroupAddonAlign = \"inline-start\" | \"inline-end\" | \"block-start\" | \"block-end\"\n\n/** Icons, text and buttons beside, above or below the control (React `InputGroup.Addon`). */\nexport const InputGroupAddon = defineComponent({\n name: \"InputGroupAddon\",\n props: {\n /**\n * Where the addon sits: before or after the control on its line, or as a\n * row above or below it.\n * @default \"inline-start\"\n */\n align: { type: String as PropType<InputGroupAddonAlign>, default: \"inline-start\" },\n },\n setup(props, { slots }) {\n return () =>\n h(\n \"div\",\n { \"data-slot\": \"input-group-addon\", \"data-align\": props.align, \"class\": s.Addon },\n slots.default?.(),\n )\n },\n})\n\nexport type InputGroupAddonProps = InstanceType<typeof InputGroupAddon>[\"$props\"] &\n Omit<HTMLAttributes, keyof InstanceType<typeof InputGroupAddon>[\"$props\"]>\n\nconst InputGroupButtonComponent = defineComponent({\n name: \"InputGroupButton\",\n props: {\n /** Color for the button. @default \"secondary\" */\n color: { type: String as PropType<ButtonColor>, default: \"secondary\" },\n /** Style variant. @default \"ghost\" */\n variant: { type: String as PropType<Variants<\"solid\" | \"soft\" | \"outline\" | \"ghost\">>, default: \"ghost\" },\n pill: { type: Boolean, default: undefined },\n disabled: { type: Boolean, default: undefined },\n },\n setup(props, { slots }) {\n const group = inject(InputGroupKey, null)\n return () =>\n h(\n Button,\n {\n color: props.color,\n variant: props.variant,\n size: BUTTON_SIZE[group?.size ?? \"md\"],\n pill: props.pill ?? group?.pill,\n disabled: props.disabled ?? group?.disabled,\n class: s.Button,\n },\n slots,\n )\n },\n})\n\ntype InputGroupButtonOwnProps = InstanceType<typeof InputGroupButtonComponent>[\"$props\"]\n\n/** InputGroupButton props plus the Button props (except `size`) that fall through to it, as in React. */\nexport type InputGroupButtonProps = InputGroupButtonOwnProps &\n Omit<ButtonProps, keyof InputGroupButtonOwnProps | \"size\">\n\n/**\n * A ghost `Button` sized from the group (React `InputGroup.Button`). Takes the\n * Button props except `size`; `pill` and `disabled` default to the group's.\n */\nexport const InputGroupButton = InputGroupButtonComponent as typeof InputGroupButtonComponent & {\n new (): { $props: InputGroupButtonProps }\n}\n\n/** Text and icons inside an addon: prefixes, units, counters (React `InputGroup.Text`). */\nexport const InputGroupText = defineComponent({\n name: \"InputGroupText\",\n setup(_props, { slots }) {\n return () => h(\"span\", { \"data-slot\": \"input-group-text\", \"class\": s.Text }, slots.default?.())\n },\n})\n\nexport type InputGroupTextProps = HTMLAttributes\n"]}
@@ -1,13 +1,14 @@
1
- import { cloneVNode, computed, createCommentVNode, defineComponent, h, inject, onBeforeUnmount, onMounted, provide, ref, shallowRef, watch, withCtx, } from "vue";
1
+ import { cloneVNode, computed, createCommentVNode, defineComponent, h, inject, markRaw, onBeforeUnmount, onMounted, provide, ref, shallowRef, watch, withCtx, } from "vue";
2
2
  import { DropdownMenuContent as RekaDropdownMenuContent, DropdownMenuPortal as RekaDropdownMenuPortal, DropdownMenuRoot as RekaDropdownMenuRoot, Presence, injectDropdownMenuRootContext, useDirection, useId, } from "reka-ui";
3
3
  import { useEscCloseStack } from "../../composables/useEscCloseStack.js";
4
4
  import { firstElementChild } from "../Tooltip/slot.js";
5
- import { preventDefaultHandler, toCssVariables } from "../../lib/helpers.js";
5
+ import { keepMovedFocus, preventDefaultHandler, toCssVariables } from "../../lib/helpers.js";
6
6
  import { Button } from "../Button/index.js";
7
7
  import { Check, ChevronRight } from "../Icon/index.js";
8
8
  import { useLinkComponent } from "../PlexUIProvider/internal.js";
9
9
  import { composeEventHandlers, mergeSlotProps } from "../Tooltip/slot.js";
10
10
  import { TransitionGroup } from "../Transition/index.js";
11
+ import { createExitGuard, overlayTiming } from "../Transition/shared.js";
11
12
  import { MenuLevelKey, MenuRootInternalsKey, MenuSubInternalsKey, SUB_CLOSE_KEYS, SUB_OPEN_KEYS, box, compose, getCheckedState, getOpenState, isIndeterminate, provideMenuContentContext, selectableItemListeners, splitListeners, trackKeyboardUse, useMenuItemImpl, useMenuItemSelect, useMenuLevel, useMenuRootInternals, useMenuSubInternals, whenMouse, } from "./internal.js";
12
13
  import s from "@plexui/styles/components/Menu/Menu.module.css";
13
14
  const MenuContextKey = Symbol("PlexUIMenu");
@@ -196,6 +197,19 @@ const contentVariables = {
196
197
  "--reka-dropdown-menu-trigger-height": null,
197
198
  };
198
199
  const sizeProp = [Number, String];
200
+ // The element Reka's content renders (`as`), without the `forceMount` Reka
201
+ // forwards down to it. Raw: Reka passes `as` through reactive props, and Vue
202
+ // warns about a component made reactive.
203
+ const MenuContentElement = markRaw(defineComponent({
204
+ name: "MenuContentElement",
205
+ inheritAttrs: false,
206
+ setup(_props, { slots, attrs }) {
207
+ return () => {
208
+ const { forceMount: _forceMount, ...rest } = attrs;
209
+ return h("div", rest, slots.default?.());
210
+ };
211
+ },
212
+ }));
199
213
  /** Content of the root menu, mounted while it is open (Radix's DropdownMenuContent). */
200
214
  const MenuRootContentImpl = defineComponent({
201
215
  name: "MenuRootContentImpl",
@@ -211,6 +225,7 @@ const MenuRootContentImpl = defineComponent({
211
225
  size: String,
212
226
  pill: Boolean,
213
227
  onCloseAutoFocus: { type: Function, required: true },
228
+ exitGuard: { type: Object, required: true },
214
229
  },
215
230
  setup(props, { slots }) {
216
231
  const rootContext = injectDropdownMenuRootContext();
@@ -236,6 +251,7 @@ const MenuRootContentImpl = defineComponent({
236
251
  const event = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, { bubbles: false, cancelable: true });
237
252
  const handleCloseAutoFocus = (closeEvent) => {
238
253
  props.onCloseAutoFocus(closeEvent);
254
+ keepMovedFocus(closeEvent);
239
255
  if (closeEvent.defaultPrevented)
240
256
  return;
241
257
  if (!hasInteractedOutside)
@@ -252,6 +268,7 @@ const MenuRootContentImpl = defineComponent({
252
268
  }, 0);
253
269
  };
254
270
  const onInteractOutside = (event) => {
271
+ props.exitGuard.onInteractOutside(event);
255
272
  if (event.defaultPrevented)
256
273
  return;
257
274
  const originalEvent = event.detail.originalEvent;
@@ -269,6 +286,8 @@ const MenuRootContentImpl = defineComponent({
269
286
  return () => {
270
287
  const isHorizontal = props.layout === "horizontal";
271
288
  return h(RekaDropdownMenuContent, {
289
+ "forceMount": true,
290
+ "as": MenuContentElement,
272
291
  "side": props.side,
273
292
  "sideOffset": props.sideOffset,
274
293
  "align": props.align,
@@ -357,12 +376,13 @@ export const MenuContent = defineComponent({
357
376
  setup(props, { slots, emit }) {
358
377
  const { open } = useMenuContext();
359
378
  const onCloseAutoFocus = (event) => emit("closeAutoFocus", event);
379
+ const exitGuard = createExitGuard();
360
380
  return () => h(RekaDropdownMenuPortal, null, {
361
381
  default: () => [
362
- h(TransitionGroup, { class: s.Menu, enterDuration: 350, exitDuration: 200, disableAnimations: true }, {
382
+ h(TransitionGroup, { class: s.Menu, ...overlayTiming, ...exitGuard.transition, overlay: true }, {
363
383
  default: () => [
364
384
  open.value
365
- ? h(MenuRootContentImpl, { key: "dropdown", ...props, onCloseAutoFocus }, { default: () => slots.default?.() })
385
+ ? h(MenuRootContentImpl, { key: "dropdown", ...props, onCloseAutoFocus, exitGuard }, { default: () => slots.default?.() })
366
386
  : createCommentVNode(),
367
387
  ],
368
388
  }),
@@ -817,6 +837,8 @@ const MenuSubContentImpl = defineComponent({
817
837
  handlers.onKeydown(event);
818
838
  };
819
839
  return () => h(RekaDropdownMenuContent, {
840
+ "forceMount": true,
841
+ "as": MenuContentElement,
820
842
  "side": internals.dir.value === "rtl" ? "left" : "right",
821
843
  "align": "start",
822
844
  "sideOffset": props.sideOffset,
@@ -889,7 +911,7 @@ export const MenuSubContent = defineComponent({
889
911
  const { open } = useSubmenuContext();
890
912
  return () => h(RekaDropdownMenuPortal, null, {
891
913
  default: () => [
892
- h(TransitionGroup, { class: s.Menu, enterDuration: 350, exitDuration: 200, disableAnimations: true }, {
914
+ h(TransitionGroup, { class: s.Menu, ...overlayTiming, overlay: true }, {
893
915
  default: () => [
894
916
  open.value
895
917
  ? h(MenuSubContentImpl, { key: "submenu", ...props }, { default: () => slots.default?.() })