@plexui/vue 0.8.0 → 0.9.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/dist/es/components/Badge/Badge.js +1 -1
- package/dist/es/components/Badge/Badge.js.map +1 -1
- package/dist/es/components/Button/Button.js +13 -5
- package/dist/es/components/Button/Button.js.map +1 -1
- package/dist/es/components/Button/ButtonLink.js +7 -1
- package/dist/es/components/Button/ButtonLink.js.map +1 -1
- package/dist/es/components/Button/NavigationButton.js +27 -0
- package/dist/es/components/Button/NavigationButton.js.map +1 -0
- package/dist/es/components/Button/NavigationGlyph.js +27 -0
- package/dist/es/components/Button/NavigationGlyph.js.map +1 -0
- package/dist/es/components/Button/index.js +1 -0
- package/dist/es/components/Button/index.js.map +1 -1
- package/dist/es/components/Checkbox/Checkbox.js +14 -4
- package/dist/es/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/es/components/DateInput/DateInput.js +7 -3
- package/dist/es/components/DateInput/DateInput.js.map +1 -1
- package/dist/es/components/DatePicker/Calendar.js +130 -86
- package/dist/es/components/DatePicker/Calendar.js.map +1 -1
- package/dist/es/components/DatePicker/CalendarNavigationIcon.js +31 -0
- package/dist/es/components/DatePicker/CalendarNavigationIcon.js.map +1 -0
- package/dist/es/components/DatePicker/DatePicker.js +16 -4
- package/dist/es/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/es/components/DatePicker/context.js.map +1 -1
- package/dist/es/components/DatePicker/useCalendarGutter.js +14 -0
- package/dist/es/components/DatePicker/useCalendarGutter.js.map +1 -0
- package/dist/es/components/DateRangePicker/Calendar.js +92 -71
- package/dist/es/components/DateRangePicker/Calendar.js.map +1 -1
- package/dist/es/components/DateRangePicker/DateRangePicker.js +13 -4
- package/dist/es/components/DateRangePicker/DateRangePicker.js.map +1 -1
- package/dist/es/components/DateRangePicker/Trigger.js +1 -0
- package/dist/es/components/DateRangePicker/Trigger.js.map +1 -1
- package/dist/es/components/Dialog/Dialog.js +125 -52
- package/dist/es/components/Dialog/Dialog.js.map +1 -1
- package/dist/es/components/Dialog/index.js.map +1 -1
- package/dist/es/components/Dialog/sheetDrag.js +77 -24
- package/dist/es/components/Dialog/sheetDrag.js.map +1 -1
- package/dist/es/components/Field/Field.js +58 -5
- package/dist/es/components/Field/Field.js.map +1 -1
- package/dist/es/components/FieldGroup/FieldGroup.js +3 -1
- package/dist/es/components/FieldGroup/FieldGroup.js.map +1 -1
- package/dist/es/components/FileUpload/FileUpload.js +50 -11
- package/dist/es/components/FileUpload/FileUpload.js.map +1 -1
- package/dist/es/components/FloatingLabelInput/FloatingLabelInput.js +24 -13
- package/dist/es/components/FloatingLabelInput/FloatingLabelInput.js.map +1 -1
- package/dist/es/components/FloatingLabelSelect/FloatingLabelSelect.js +9 -3
- package/dist/es/components/FloatingLabelSelect/FloatingLabelSelect.js.map +1 -1
- package/dist/es/components/Icon/index.js +1 -0
- package/dist/es/components/Icon/index.js.map +1 -1
- package/dist/es/components/Icon/svg/Disclosure.js +10 -0
- package/dist/es/components/Icon/svg/Disclosure.js.map +1 -0
- package/dist/es/components/Indicator/LoadingIndicator.js +2 -2
- package/dist/es/components/Indicator/LoadingIndicator.js.map +1 -1
- package/dist/es/components/Input/Input.js +15 -5
- package/dist/es/components/Input/Input.js.map +1 -1
- package/dist/es/components/InputGroup/InputGroup.js +3 -1
- package/dist/es/components/InputGroup/InputGroup.js.map +1 -1
- package/dist/es/components/MarkdownEditor/MarkdownEditor.js +126 -151
- package/dist/es/components/MarkdownEditor/MarkdownEditor.js.map +1 -1
- package/dist/es/components/Menu/Menu.js +217 -35
- package/dist/es/components/Menu/Menu.js.map +1 -1
- package/dist/es/components/Menu/internal.js +2 -1
- package/dist/es/components/Menu/internal.js.map +1 -1
- package/dist/es/components/OTPInput/OTPInput.js +7 -4
- package/dist/es/components/OTPInput/OTPInput.js.map +1 -1
- package/dist/es/components/Page/Page.js +93 -14
- package/dist/es/components/Page/Page.js.map +1 -1
- package/dist/es/components/Page/index.js +1 -1
- package/dist/es/components/Page/index.js.map +1 -1
- package/dist/es/components/Popover/Popover.js +16 -6
- package/dist/es/components/Popover/Popover.js.map +1 -1
- package/dist/es/components/Popover/deferredPointerDownOutside.js +6 -0
- package/dist/es/components/Popover/deferredPointerDownOutside.js.map +1 -1
- package/dist/es/components/RadioGroup/RadioGroup.js +31 -13
- package/dist/es/components/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/es/components/Select/Select.js +75 -25
- package/dist/es/components/Select/Select.js.map +1 -1
- package/dist/es/components/SelectControl/SelectControl.js +58 -25
- package/dist/es/components/SelectControl/SelectControl.js.map +1 -1
- package/dist/es/components/SelectControl/index.js +1 -1
- package/dist/es/components/SelectControl/index.js.map +1 -1
- package/dist/es/components/ShimmerText/ShimmerText.js +16 -3
- package/dist/es/components/ShimmerText/ShimmerText.js.map +1 -1
- package/dist/es/components/Slider/Slider.js +56 -16
- package/dist/es/components/Slider/Slider.js.map +1 -1
- package/dist/es/components/Sortable/Sortable.js +20 -13
- package/dist/es/components/Sortable/Sortable.js.map +1 -1
- package/dist/es/components/Switch/Switch.js +6 -3
- package/dist/es/components/Switch/Switch.js.map +1 -1
- package/dist/es/components/Tabs/Tabs.js +12 -11
- package/dist/es/components/Tabs/Tabs.js.map +1 -1
- package/dist/es/components/TagInput/TagInput.js +46 -6
- package/dist/es/components/TagInput/TagInput.js.map +1 -1
- package/dist/es/components/Textarea/Textarea.js +13 -2
- package/dist/es/components/Textarea/Textarea.js.map +1 -1
- package/dist/es/components/Toast/ToastRenderer.js +144 -0
- package/dist/es/components/Toast/ToastRenderer.js.map +1 -0
- package/dist/es/components/Toast/Toaster.js +23 -1
- package/dist/es/components/Toast/Toaster.js.map +1 -1
- package/dist/es/components/Toast/toastLifecycle.js +283 -0
- package/dist/es/components/Toast/toastLifecycle.js.map +1 -0
- package/dist/es/components/Toolbar/Toolbar.js +107 -0
- package/dist/es/components/Toolbar/Toolbar.js.map +1 -0
- package/dist/es/components/Toolbar/index.js +2 -0
- package/dist/es/components/Toolbar/index.js.map +1 -0
- package/dist/es/components/Tooltip/CopyTooltip.js +39 -13
- package/dist/es/components/Tooltip/CopyTooltip.js.map +1 -1
- package/dist/es/components/Tooltip/Tooltip.js +35 -14
- package/dist/es/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/es/composables/useFloatingBoundary.js +48 -0
- package/dist/es/composables/useFloatingBoundary.js.map +1 -0
- package/dist/es/composables/usePhoneSubmenu.js +19 -0
- package/dist/es/composables/usePhoneSubmenu.js.map +1 -0
- package/dist/es/lib/copyToClipboard.js +16 -7
- package/dist/es/lib/copyToClipboard.js.map +1 -1
- package/dist/es/lib/floatingBoundary.js +90 -0
- package/dist/es/lib/floatingBoundary.js.map +1 -0
- package/dist/es/lib/focusRestore.js +56 -0
- package/dist/es/lib/focusRestore.js.map +1 -0
- package/dist/es/lib/helpers.js +0 -18
- package/dist/es/lib/helpers.js.map +1 -1
- package/dist/es/lib/inputMode.js +9 -0
- package/dist/es/lib/inputMode.js.map +1 -0
- package/dist/es/lib/menuInitialFocus.js +100 -0
- package/dist/es/lib/menuInitialFocus.js.map +1 -0
- package/dist/es/lib/menuSubmenuPlacement.js +219 -0
- package/dist/es/lib/menuSubmenuPlacement.js.map +1 -0
- package/dist/es/lib/observeTextareaWidth.js +49 -0
- package/dist/es/lib/observeTextareaWidth.js.map +1 -0
- package/dist/es/lib/selectPress.js +34 -0
- package/dist/es/lib/selectPress.js.map +1 -0
- package/dist/es/lib/sortable.js +74 -20
- package/dist/es/lib/sortable.js.map +1 -1
- package/dist/types/components/Button/Button.d.ts +6 -2
- package/dist/types/components/Button/ButtonLink.d.ts +6 -2
- package/dist/types/components/Button/NavigationButton.d.ts +27 -0
- package/dist/types/components/Button/NavigationGlyph.d.ts +16 -0
- package/dist/types/components/Button/index.d.ts +1 -0
- package/dist/types/components/Checkbox/Checkbox.d.ts +12 -12
- package/dist/types/components/DateInput/DateInput.d.ts +4 -4
- package/dist/types/components/DatePicker/CalendarNavigationIcon.d.ts +6 -0
- package/dist/types/components/DatePicker/DatePicker.d.ts +13 -13
- package/dist/types/components/DatePicker/context.d.ts +1 -0
- package/dist/types/components/DatePicker/useCalendarGutter.d.ts +2 -0
- package/dist/types/components/DateRangePicker/DateRangePicker.d.ts +13 -13
- package/dist/types/components/Dialog/Dialog.d.ts +46 -11
- package/dist/types/components/Dialog/index.d.ts +1 -1
- package/dist/types/components/Field/Field.d.ts +2 -2
- package/dist/types/components/FileUpload/FileUpload.d.ts +6 -6
- package/dist/types/components/FloatingLabelInput/FloatingLabelInput.d.ts +4 -4
- package/dist/types/components/Icon/index.d.ts +1 -0
- package/dist/types/components/Icon/svg/Disclosure.d.ts +3 -0
- package/dist/types/components/Indicator/LoadingIndicator.d.ts +2 -2
- package/dist/types/components/Input/Input.d.ts +2 -2
- package/dist/types/components/MarkdownEditor/MarkdownEditor.d.ts +8 -8
- package/dist/types/components/Menu/Menu.d.ts +18 -25
- package/dist/types/components/OTPInput/OTPInput.d.ts +6 -6
- package/dist/types/components/Page/Page.d.ts +48 -7
- package/dist/types/components/Page/index.d.ts +1 -1
- package/dist/types/components/Popover/Popover.d.ts +17 -6
- package/dist/types/components/RadioGroup/RadioGroup.d.ts +10 -10
- package/dist/types/components/SelectControl/index.d.ts +1 -1
- package/dist/types/components/Sortable/Sortable.d.ts +8 -8
- package/dist/types/components/Switch/Switch.d.ts +34 -12
- package/dist/types/components/Tabs/Tabs.d.ts +6 -6
- package/dist/types/components/TagInput/TagInput.d.ts +4 -4
- package/dist/types/components/Textarea/Textarea.d.ts +2 -2
- package/dist/types/components/Toast/ToastRenderer.d.ts +79 -0
- package/dist/types/components/Toast/Toaster.d.ts +6 -2
- package/dist/types/components/Toast/toastLifecycle.d.ts +90 -0
- package/dist/types/components/Toolbar/Toolbar.d.ts +149 -0
- package/dist/types/components/Toolbar/index.d.ts +1 -0
- package/dist/types/components/Tooltip/CopyTooltip.d.ts +2 -2
- package/dist/types/components/Tooltip/Tooltip.d.ts +6 -6
- package/dist/types/composables/useFloatingBoundary.d.ts +24 -0
- package/dist/types/composables/usePhoneSubmenu.d.ts +3 -0
- package/dist/types/lib/floatingBoundary.d.ts +9 -0
- package/dist/types/lib/focusRestore.d.ts +5 -0
- package/dist/types/lib/helpers.d.ts +0 -4
- package/dist/types/lib/inputMode.d.ts +7 -0
- package/dist/types/lib/menuInitialFocus.d.ts +9 -0
- package/dist/types/lib/menuSubmenuPlacement.d.ts +44 -0
- package/dist/types/lib/observeTextareaWidth.d.ts +2 -0
- package/dist/types/lib/selectPress.d.ts +23 -0
- package/dist/types/lib/sortable.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../../src/components/Menu/internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,GAAG,EAAE,UAAU,EAAkE,MAAM,KAAK,CAAA;AAEvI,8EAA8E;AAC9E,4EAA4E;AAC5E,0EAA0E;AAC1E,0EAA0E;AAC1E,4EAA4E;AAC5E,iCAAiC;AAEjC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;AAC5C,MAAM,UAAU,GAAG,CAAC,WAAW,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAA;AAClD,MAAM,SAAS,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,CAAC,CAAA;AAChD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,GAAG,UAAU,EAAE,GAAG,SAAS,CAAC,CAAA;AAC5D,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;AACjE,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,cAAc,EAAE,YAAY,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,cAAc,EAAE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,GAA4B,EAAE,CAAA;IACxC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACjD,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC;YAAE,SAAS,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;;YAC3C,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;IACxB,CAAC;IACD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAA;AAC5B,CAAC,CAAA","sourcesContent":["import { inject, onBeforeUnmount, provide, ref, shallowRef, type ComputedRef, type InjectionKey, type Ref, type ShallowRef } from \"vue\"\n\n// Radix Menu behaviour (radix-ui DropdownMenu / Menu / RovingFocusGroup) that\n// Reka UI implements differently. Reka keeps the root contexts, the popper,\n// the dismissable layer, the focus scope and the portal; the items, their\n// roving focus, typeahead and the submenu pointer grace area are Radix's,\n// ported here so the DOM (tabindex, data-highlighted, data-orientation) and\n// the handler order match React.\n\nexport const SELECTION_KEYS = [\"Enter\", \" \"]\nconst FIRST_KEYS = [\"ArrowDown\", \"PageUp\", \"Home\"]\nconst LAST_KEYS = [\"ArrowUp\", \"PageDown\", \"End\"]\nexport const FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS]\nexport const isLastKey = (key: string) => LAST_KEYS.includes(key)\nexport const SUB_OPEN_KEYS = { ltr: [...SELECTION_KEYS, \"ArrowRight\"], rtl: [...SELECTION_KEYS, \"ArrowLeft\"] }\nexport const SUB_CLOSE_KEYS = { ltr: [\"ArrowLeft\"], rtl: [\"ArrowRight\"] }\nexport const ITEM_SELECT = \"menu.itemSelect\"\n\nexport type Direction = \"ltr\" | \"rtl\"\nexport type CheckedState = boolean | \"indeterminate\"\ntype Point = { x: number; y: number }\ntype Polygon = Point[]\ntype Side = \"left\" | \"right\"\nexport type GraceIntent = { area: Polygon; side: Side }\n\n/** A `{ current }` box, like a React ref: plain state no render depends on. */\nexport type Box<T> = { current: T }\nexport const box = <T>(current: T): Box<T> => ({ current })\n\n// ---------------------------------------------------------------------------\n// Root (Radix Menu root context)\n\nexport type MenuRootInternals = {\n /** Radix `rootContext.onClose`: closes the whole menu */\n onClose: () => void\n /** Set by keydown, cleared by the next pointer event (Radix's isUsingKeyboardRef) */\n isUsingKeyboard: Box<boolean>\n dir: ComputedRef<Direction>\n modal: () => boolean\n /** The root trigger element, focused when the menu closes */\n trigger: ShallowRef<HTMLElement | null>\n}\n\nexport const MenuRootInternalsKey: InjectionKey<MenuRootInternals> = Symbol(\"PlexUIMenuRootInternals\")\n\nexport const useMenuRootInternals = () => {\n const context = inject(MenuRootInternalsKey, null)\n if (!context) throw new Error(\"Menu components must be wrapped in <Menu />\")\n return context\n}\n\n/** Radix's keyboard tracking: any keydown, until the next pointer event. */\nexport const trackKeyboardUse = (isUsingKeyboard: Box<boolean>) => {\n const handlePointer = () => {\n isUsingKeyboard.current = false\n }\n const handleKeyDown = () => {\n isUsingKeyboard.current = true\n document.addEventListener(\"pointerdown\", handlePointer, { capture: true, once: true })\n document.addEventListener(\"pointermove\", handlePointer, { capture: true, once: true })\n }\n document.addEventListener(\"keydown\", handleKeyDown, { capture: true })\n return () => {\n document.removeEventListener(\"keydown\", handleKeyDown, { capture: true })\n document.removeEventListener(\"pointerdown\", handlePointer, { capture: true })\n document.removeEventListener(\"pointermove\", handlePointer, { capture: true })\n }\n}\n\n// ---------------------------------------------------------------------------\n// One menu level, the root or a submenu (Radix MenuContext)\n\nexport type MenuLevel = {\n open: () => boolean\n /** Radix's controlled `setOpen`: reports a change only when it differs */\n onOpenChange: (open: boolean) => void\n /** The level's content element while it is mounted */\n content: ShallowRef<HTMLElement | null>\n}\n\nexport const MenuLevelKey: InjectionKey<MenuLevel> = Symbol(\"PlexUIMenuLevel\")\n\nexport const useMenuLevel = () => {\n const context = inject(MenuLevelKey, null)\n if (!context) throw new Error(\"Menu components must be wrapped in <Menu />\")\n return context\n}\n\n// ---------------------------------------------------------------------------\n// Submenu (Radix MenuSubContext)\n\nexport type MenuSubInternals = {\n triggerId: string\n contentId: string\n trigger: ShallowRef<HTMLElement | null>\n}\n\nexport const MenuSubInternalsKey: InjectionKey<MenuSubInternals> = Symbol(\"PlexUIMenuSubInternals\")\n\nexport const useMenuSubInternals = () => {\n const context = inject(MenuSubInternalsKey, null)\n if (!context) throw new Error(\"Submenu components must be wrapped in <Sub />\")\n return context\n}\n\n// ---------------------------------------------------------------------------\n// Content (Radix MenuContentContext, the menu collection and the roving focus group)\n\nexport type ItemRecord = {\n id: symbol\n element: () => HTMLElement | null\n disabled: () => boolean\n}\n\nexport type MenuContentContext = {\n register: (item: ItemRecord) => () => void\n /** Items in document order */\n getItems: () => ItemRecord[]\n searchRef: Box<string>\n currentTabStopId: Ref<symbol | null>\n onItemFocus: (id: symbol) => void\n onItemShiftTab: () => void\n onItemEnter: (event: PointerEvent) => void\n onItemLeave: (event: PointerEvent) => void\n onTriggerLeave: (event: PointerEvent) => void\n pointerGraceTimer: Box<number>\n onPointerGraceIntentChange: (intent: GraceIntent | null) => void\n}\n\nexport const MenuContentContextKey: InjectionKey<MenuContentContext> = Symbol(\"PlexUIMenuContent\")\n\nexport const useMenuContentContext = () => {\n const context = inject(MenuContentContextKey, null)\n if (!context) throw new Error(\"Menu items must be rendered inside <MenuContent /> or <MenuSubContent />\")\n return context\n}\n\nconst byDocumentPosition = (a: ItemRecord, b: ItemRecord) => {\n const elementA = a.element()\n const elementB = b.element()\n if (!elementA || !elementB || elementA === elementB) return 0\n return elementA.compareDocumentPosition(elementB) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1\n}\n\n/**\n * State and callbacks of one content element (root or submenu): the item\n * collection, typeahead buffer, current tab stop and pointer grace area.\n */\nexport const provideMenuContentContext = (getContent: () => HTMLElement | null) => {\n const items = new Set<ItemRecord>()\n const searchRef = box(\"\")\n const timer = box(0)\n const currentTabStopId = ref<symbol | null>(null)\n const isTabbingBackOut = ref(false)\n const isClickFocus = box(false)\n const pointerGraceTimer = box(0)\n const pointerGraceIntent = box<GraceIntent | null>(null)\n const pointerDir = box<Side>(\"right\")\n const lastPointerX = box(0)\n\n const isPointerMovingToSubmenu = (event: PointerEvent) => {\n const isMovingTowards = pointerDir.current === pointerGraceIntent.current?.side\n return isMovingTowards && isPointerInGraceArea(event, pointerGraceIntent.current?.area)\n }\n\n const getItems = () => Array.from(items).filter((item) => item.element()).sort(byDocumentPosition)\n\n const context: MenuContentContext = {\n register: (item) => {\n items.add(item)\n return () => items.delete(item)\n },\n getItems,\n searchRef,\n currentTabStopId,\n onItemFocus: (id) => {\n currentTabStopId.value = id\n },\n onItemShiftTab: () => {\n isTabbingBackOut.value = true\n },\n onItemEnter: (event) => {\n if (isPointerMovingToSubmenu(event)) event.preventDefault()\n },\n onItemLeave: (event) => {\n if (isPointerMovingToSubmenu(event)) return\n getContent()?.focus()\n currentTabStopId.value = null\n },\n onTriggerLeave: (event) => {\n if (isPointerMovingToSubmenu(event)) event.preventDefault()\n },\n pointerGraceTimer,\n onPointerGraceIntentChange: (intent) => {\n pointerGraceIntent.current = intent\n },\n }\n\n provide(MenuContentContextKey, context)\n onBeforeUnmount(() => window.clearTimeout(timer.current))\n\n const handleTypeaheadSearch = (key: string) => {\n const search = searchRef.current + key\n const enabled = getItems().filter((item) => !item.disabled())\n const currentItem = document.activeElement\n const textOf = (item: ItemRecord) => (item.element()?.textContent ?? \"\").trim()\n const currentMatch = enabled.find((item) => item.element() === currentItem)\n const values = enabled.map(textOf)\n const nextMatch = getNextMatch(values, search, currentMatch ? textOf(currentMatch) : undefined)\n const newItem = enabled.find((item) => textOf(item) === nextMatch)?.element()\n\n const updateSearch = (value: string) => {\n searchRef.current = value\n window.clearTimeout(timer.current)\n if (value !== \"\") timer.current = window.setTimeout(() => updateSearch(\"\"), 1000)\n }\n updateSearch(search)\n\n if (newItem) {\n setTimeout(() => newItem.focus())\n }\n }\n\n /** Clears the typeahead buffer (Radix: a blur from a portalled child) */\n const resetSearch = () => {\n window.clearTimeout(timer.current)\n searchRef.current = \"\"\n }\n\n /**\n * The content element's own handlers: Radix MenuContentImpl's content\n * props plus the RovingFocusGroup root's, run before Reka's.\n * `isUsingKeyboard` gates the entry focus like MenuContentImpl's\n * `onEntryFocus`.\n */\n const contentHandlers = (isUsingKeyboard: Box<boolean>) => ({\n onKeydown: (event: KeyboardEvent) => {\n // Radix composes this after the items' handlers: it is skipped when one\n // of them already handled the key\n if (event.defaultPrevented) return\n const target = event.target as HTMLElement\n const currentTarget = event.currentTarget as HTMLElement\n const isKeyDownInside = target.closest(\"[data-reka-menu-content]\") === currentTarget\n const isModifierKey = event.ctrlKey || event.altKey || event.metaKey\n const isCharacterKey = event.key.length === 1\n if (isKeyDownInside) {\n // menus should not be navigated using tab key so we prevent it\n if (event.key === \"Tab\") event.preventDefault()\n if (!isModifierKey && isCharacterKey) handleTypeaheadSearch(event.key)\n }\n // focus first/last item based on key pressed\n if (event.target !== getContent()) return\n if (!FIRST_LAST_KEYS.includes(event.key)) return\n event.preventDefault()\n const candidateNodes = getItems()\n .filter((item) => !item.disabled())\n .map((item) => item.element())\n .filter((element): element is HTMLElement => !!element)\n if (isLastKey(event.key)) candidateNodes.reverse()\n focusFirst(candidateNodes)\n },\n onPointermove: whenMouse((event) => {\n const target = event.target as HTMLElement\n const pointerXHasChanged = lastPointerX.current !== event.clientX\n // We don't use `event.movementX` for this check because Safari will\n // always return `0` on a pointer event.\n if ((event.currentTarget as HTMLElement).contains(target) && pointerXHasChanged) {\n pointerDir.current = event.clientX > lastPointerX.current ? \"right\" : \"left\"\n lastPointerX.current = event.clientX\n }\n }),\n // RovingFocusGroup root: entry focus moves to the first item when the\n // content is focused from the keyboard\n onMousedown: () => {\n isClickFocus.current = true\n },\n onFocusin: (event: FocusEvent) => {\n const isKeyboardFocus = !isClickFocus.current\n if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut.value) {\n if (isUsingKeyboard.current) {\n const focusable = getItems().filter((item) => !item.disabled())\n const currentItem = focusable.find((item) => item.id === currentTabStopId.value)\n const candidates = [currentItem, ...focusable].filter((item): item is ItemRecord => !!item)\n focusFirst(candidates.map((item) => item.element()).filter((element): element is HTMLElement => !!element))\n }\n }\n isClickFocus.current = false\n },\n onFocusout: () => {\n isTabbingBackOut.value = false\n },\n })\n\n return { context, contentHandlers, resetSearch }\n}\n\n// ---------------------------------------------------------------------------\n// Radix helpers\n\nexport const whenMouse =\n <E extends PointerEvent>(handler: (event: E) => void) =>\n (event: E) =>\n event.pointerType === \"mouse\" ? handler(event) : undefined\n\nexport const focusFirst = (candidates: HTMLElement[]) => {\n const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement\n for (const candidate of candidates) {\n // if focus is already where we want to go, we don't want to keep going through the candidates\n if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return\n candidate.focus()\n if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return\n }\n}\n\nconst wrapArray = <T>(array: T[], startIndex: number) =>\n array.map((_, index) => array[(startIndex + index) % array.length]!)\n\n/**\n * The next item matching the typeahead search: repeated characters cycle\n * through items starting with that character, and the current match is\n * skipped for a single character so it moves on.\n */\nconst getNextMatch = (values: string[], search: string, currentMatch?: string) => {\n const isRepeated = search.length > 1 && Array.from(search).every((char) => char === search[0])\n const normalizedSearch = isRepeated ? search[0]! : search\n const currentMatchIndex = currentMatch ? values.indexOf(currentMatch) : -1\n let wrappedValues = wrapArray(values, Math.max(currentMatchIndex, 0))\n const excludeCurrentMatch = normalizedSearch.length === 1\n if (excludeCurrentMatch) wrappedValues = wrappedValues.filter((v) => v !== currentMatch)\n const nextMatch = wrappedValues.find((value) => value.toLowerCase().startsWith(normalizedSearch.toLowerCase()))\n return nextMatch !== currentMatch ? nextMatch : undefined\n}\n\nconst isPointInPolygon = (point: Point, polygon: Polygon) => {\n const { x, y } = point\n let inside = false\n for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {\n const ii = polygon[i]!\n const jj = polygon[j]!\n const xi = ii.x\n const yi = ii.y\n const xj = jj.x\n const yj = jj.y\n // prettier-ignore\n const intersect = ((yi > y) !== (yj > y)) && (x < (xj - xi) * (y - yi) / (yj - yi) + xi)\n if (intersect) inside = !inside\n }\n return inside\n}\n\nconst isPointerInGraceArea = (event: PointerEvent, area?: Polygon) => {\n if (!area) return false\n return isPointInPolygon({ x: event.clientX, y: event.clientY }, area)\n}\n\nconst MAP_KEY_TO_FOCUS_INTENT: Record<string, \"first\" | \"last\" | \"prev\" | \"next\"> = {\n ArrowLeft: \"prev\",\n ArrowUp: \"prev\",\n ArrowRight: \"next\",\n ArrowDown: \"next\",\n PageUp: \"first\",\n Home: \"first\",\n PageDown: \"last\",\n End: \"last\",\n}\n\n/** RovingFocusGroup's focus intent for a vertical group */\nexport const getFocusIntent = (event: KeyboardEvent, dir: Direction) => {\n const key =\n dir !== \"rtl\" ? event.key : event.key === \"ArrowLeft\" ? \"ArrowRight\" : event.key === \"ArrowRight\" ? \"ArrowLeft\" : event.key\n if ([\"ArrowLeft\", \"ArrowRight\"].includes(key)) return undefined\n return MAP_KEY_TO_FOCUS_INTENT[key]\n}\n\nexport const getOpenState = (open: boolean) => (open ? \"open\" : \"closed\")\nexport const isIndeterminate = (checked?: CheckedState) => checked === \"indeterminate\"\nexport const getCheckedState = (checked: CheckedState) =>\n isIndeterminate(checked) ? \"indeterminate\" : checked ? \"checked\" : \"unchecked\"\n\n// ---------------------------------------------------------------------------\n// Event handler composition\n\ntype Handler<E extends Event = Event> = (event: E) => void\n\n/** Calls a Vue listener value (a function or an array of them). */\nexport const callListener = (listener: unknown, event: Event) => {\n if (Array.isArray(listener)) for (const fn of listener) (fn as Handler)(event)\n else if (typeof listener === \"function\") (listener as Handler)(event)\n}\n\n/**\n * Calls the listener(s) and tells whether one of them called\n * `preventDefault()`, also on an event that was canceled already.\n */\nconst callListenerTrackingCancel = (listener: unknown, event: Event) => {\n let canceled = false\n const preventDefault = event.preventDefault\n event.preventDefault = function (this: Event) {\n canceled = true\n preventDefault.call(this)\n }\n try {\n callListener(listener, event)\n } finally {\n // Back to the prototype's method\n delete (event as { preventDefault?: unknown }).preventDefault\n }\n return canceled\n}\n\n/**\n * Radix's composeEventHandlers: the consumer's handler runs first, ours only\n * when it did not call preventDefault().\n */\nexport const compose =\n <E extends Event>(consumer: unknown, ours?: Handler<E>, { checkForDefaultPrevented = true } = {}) =>\n (event: E) => {\n callListener(consumer, event)\n if (checkForDefaultPrevented === false || !event.defaultPrevented) ours?.(event)\n }\n\n// ---------------------------------------------------------------------------\n// Items (Radix MenuItemImpl + RovingFocusGroupItem)\n\nexport type ItemImplHandlers = {\n onClick?: Handler<MouseEvent>\n onClickCapture?: Handler<MouseEvent>\n onPointerdown?: Handler<PointerEvent>\n onPointerup?: Handler<PointerEvent>\n onPointermove?: Handler<PointerEvent>\n onPointerleave?: Handler<PointerEvent>\n onKeydown?: Handler<KeyboardEvent>\n onFocusin?: Handler<FocusEvent>\n onFocusout?: Handler<FocusEvent>\n onMousedown?: Handler<MouseEvent>\n}\n\n/**\n * One focusable menu item: registers in the content's collection and\n * returns its attributes plus the handlers of MenuItemImpl and the roving\n * focus item, run after `outer` (the item kind's own handlers) the way Radix\n * composes them.\n */\nexport const useMenuItemImpl = (disabled: () => boolean) => {\n const contentContext = useMenuContentContext()\n const rootInternals = useMenuRootInternals()\n const element = shallowRef<HTMLElement | null>(null)\n const isFocused = ref(false)\n const id = Symbol(\"menu-item\")\n\n const unregister = contentContext.register({ id, element: () => element.value, disabled })\n onBeforeUnmount(unregister)\n\n const setElement = (el: unknown) => {\n const node = el && typeof el === \"object\" && \"$el\" in el ? (el as { $el: unknown }).$el : el\n element.value = node instanceof HTMLElement ? node : null\n }\n\n const attrs = () => ({\n \"role\": \"menuitem\",\n \"tabindex\": contentContext.currentTabStopId.value === id ? 0 : -1,\n \"data-orientation\": \"vertical\",\n \"data-highlighted\": isFocused.value ? \"\" : undefined,\n \"aria-disabled\": disabled() || undefined,\n \"data-disabled\": disabled() ? \"\" : undefined,\n })\n\n const rovingKeydown = (event: KeyboardEvent) => {\n if (event.key === \"Tab\" && event.shiftKey) {\n contentContext.onItemShiftTab()\n return\n }\n if (event.target !== event.currentTarget) return\n const focusIntent = getFocusIntent(event, rootInternals.dir.value)\n if (focusIntent !== undefined) {\n if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return\n event.preventDefault()\n let candidateNodes = contentContext\n .getItems()\n .filter((item) => !item.disabled())\n .map((item) => item.element())\n .filter((node): node is HTMLElement => !!node)\n if (focusIntent === \"last\") candidateNodes.reverse()\n else if (focusIntent === \"prev\" || focusIntent === \"next\") {\n if (focusIntent === \"prev\") candidateNodes.reverse()\n const currentIndex = candidateNodes.indexOf(event.currentTarget as HTMLElement)\n // The menu's roving focus group does not loop\n candidateNodes = candidateNodes.slice(currentIndex + 1)\n }\n setTimeout(() => focusFirst(candidateNodes))\n }\n }\n\n const handlers = (outer: ItemImplHandlers): ItemImplHandlers => ({\n ...outer,\n onPointermove: compose(\n outer.onPointermove,\n whenMouse((event: PointerEvent) => {\n if (disabled()) {\n contentContext.onItemLeave(event)\n } else {\n contentContext.onItemEnter(event)\n if (!event.defaultPrevented) {\n const item = event.currentTarget as HTMLElement\n item.focus({ preventScroll: true })\n }\n }\n }),\n ),\n onPointerleave: compose(\n outer.onPointerleave,\n whenMouse((event: PointerEvent) => contentContext.onItemLeave(event)),\n ),\n onFocusin: (event) => {\n compose(outer.onFocusin, () => {\n isFocused.value = true\n })(event)\n if (!event.defaultPrevented) contentContext.onItemFocus(id)\n },\n onFocusout: compose(outer.onFocusout, () => {\n isFocused.value = false\n }),\n onMousedown: (event) => {\n callListener(outer.onMousedown, event)\n if (event.defaultPrevented) return\n // We prevent focusing non-focusable items on `mousedown`.\n // Even though the item has tabIndex={-1}, that only means take it out of the tab order.\n if (disabled()) event.preventDefault()\n // Safari doesn't focus a button when clicked so we run our logic on mousedown also\n else contentContext.onItemFocus(id)\n },\n onKeydown: compose(outer.onKeydown, rovingKeydown),\n })\n\n return { element, setElement, attrs, handlers, contentContext, rootInternals }\n}\n\n/**\n * Radix MenuItem's select behaviour on top of `useMenuItemImpl`: click,\n * pointer-up selection after a pointer-down elsewhere, Enter / Space.\n */\nexport const useMenuItemSelect = (\n impl: ReturnType<typeof useMenuItemImpl>,\n disabled: () => boolean,\n onSelect: () => ((event: Event) => void) | undefined,\n) => {\n let isPointerDown = false\n\n const handleSelect = () => {\n const menuItem = impl.element.value\n if (!disabled() && menuItem) {\n const itemSelectEvent = new CustomEvent(ITEM_SELECT, { bubbles: true, cancelable: true })\n menuItem.addEventListener(ITEM_SELECT, (event) => onSelect()?.(event), { once: true })\n menuItem.dispatchEvent(itemSelectEvent)\n if (itemSelectEvent.defaultPrevented) {\n isPointerDown = false\n } else {\n impl.rootInternals.onClose()\n }\n }\n }\n\n // Whether the click was canceled before it reached the item (capture phase)\n let canceledBeforeItem = false\n\n /**\n * Handlers of the item itself; `consumer` holds the item's own listeners.\n * `linkComponent`: the item renders a link component (a router link).\n */\n const handlers = (consumer: Record<string, unknown>, linkComponent = false): ItemImplHandlers => ({\n onClickCapture: (event) => {\n callListener(consumer.onClickCapture, event)\n canceledBeforeItem = event.defaultPrevented\n },\n // A canceled click is not selected, as in Radix. A router link component\n // runs its own click handler (which prevents the navigation) before the\n // listeners passed to it, where React's runs after, so a link\n // component's cancel from after the capture phase is its own and is\n // ignored; only the consumer's preventDefault() then skips the selection\n // (also when the link had canceled the event already).\n onClick: (event) => {\n const canceledByLink = linkComponent && event.defaultPrevented && !canceledBeforeItem\n const canceledByConsumer = callListenerTrackingCancel(consumer.onClick, event)\n if (canceledByLink ? canceledByConsumer : event.defaultPrevented) return\n handleSelect()\n },\n onPointerdown: (event) => {\n callListener(consumer.onPointerdown, event)\n isPointerDown = true\n },\n onPointerup: compose(consumer.onPointerup, (event: PointerEvent) => {\n // Pointer down can move to a different menu item which should activate it on pointer up.\n // We dispatch a click for selection to allow composition with click based triggers and to\n // prevent Firefox from getting stuck in text selection mode when the menu closes.\n if (!isPointerDown) (event.currentTarget as HTMLElement | null)?.click()\n }),\n onKeydown: compose(consumer.onKeydown, (event: KeyboardEvent) => {\n const isTypingAhead = impl.contentContext.searchRef.current !== \"\"\n if (disabled() || (isTypingAhead && event.key === \" \")) return\n if (SELECTION_KEYS.includes(event.key)) {\n ;(event.currentTarget as HTMLElement).click()\n /**\n * We prevent default browser behaviour for selection keys as they should trigger\n * a selection only:\n * - prevents space from scrolling the page.\n * - if keydown causes focus to move, prevents keydown from firing on the new target.\n */\n event.preventDefault()\n }\n }),\n })\n\n return { handlers }\n}\n\nconst ITEM_LISTENERS = [\n \"onClick\",\n \"onClickCapture\",\n \"onPointerdown\",\n \"onPointerup\",\n \"onKeydown\",\n \"onPointermove\",\n \"onPointerleave\",\n \"onFocusin\",\n \"onFocusout\",\n \"onMousedown\",\n]\n\n/**\n * Every listener of a selectable item: the element's own `listeners` first,\n * then the item's handlers (the order of Radix's Slot), plus `after`\n * handlers that run between the two for pointer moves and leaves.\n */\nexport const selectableItemListeners = (\n impl: ReturnType<typeof useMenuItemImpl>,\n select: ReturnType<typeof useMenuItemSelect>,\n listeners: Record<string, unknown>,\n after: { onPointermove?: Handler<PointerEvent>; onPointerleave?: Handler<PointerEvent> } = {},\n linkComponent = false,\n) => {\n const own = (key: string) => (event: Event) => callListener(listeners[key], event)\n const chain = (key: \"onPointermove\" | \"onPointerleave\") => (event: PointerEvent) => {\n callListener(listeners[key], event)\n after[key]?.(event)\n }\n const rest = Object.fromEntries(Object.entries(listeners).filter(([key]) => !ITEM_LISTENERS.includes(key)))\n return {\n ...rest,\n ...impl.handlers({\n ...select.handlers(listeners, linkComponent),\n onPointermove: chain(\"onPointermove\"),\n onPointerleave: chain(\"onPointerleave\"),\n onFocusin: own(\"onFocusin\"),\n onFocusout: own(\"onFocusout\"),\n onMousedown: own(\"onMousedown\"),\n }),\n }\n}\n\n/** Splits Vue attrs into listeners (`onX`) and the rest. */\nexport const splitListeners = (attrs: Record<string, unknown>) => {\n const listeners: Record<string, unknown> = {}\n const rest: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(attrs)) {\n if (/^on[A-Z]/.test(key)) listeners[key] = value\n else rest[key] = value\n }\n return { listeners, rest }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../../src/components/Menu/internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,GAAG,EAAE,UAAU,EAAkE,MAAM,KAAK,CAAA;AAEvI,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAEvD,8EAA8E;AAC9E,4EAA4E;AAC5E,0EAA0E;AAC1E,0EAA0E;AAC1E,4EAA4E;AAC5E,iCAAiC;AAEjC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;AAC5C,MAAM,UAAU,GAAG,CAAC,WAAW,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAA;AAClD,MAAM,SAAS,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,CAAC,CAAA;AAChD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,GAAG,UAAU,EAAE,GAAG,SAAS,CAAC,CAAA;AAC5D,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;AACjE,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,cAAc,EAAE,YAAY,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,cAAc,EAAE,WAAW,CAAC,EAAE,CAAA;AAC9G,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,EAAE,CAAA;AACzE,MAAM,CAAC,MAAM,WAAW,GAAG,iBAAiB,CAAA;AA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;YAAE,SAAS,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;;YAC3C,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;IACxB,CAAC;IACD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAA;AAC5B,CAAC,CAAA","sourcesContent":["import { inject, onBeforeUnmount, provide, ref, shallowRef, type ComputedRef, type InjectionKey, type Ref, type ShallowRef } from \"vue\"\n\nimport { isHoverPointer } from \"../../lib/inputMode.js\"\n\n// Radix Menu behaviour (radix-ui DropdownMenu / Menu / RovingFocusGroup) that\n// Reka UI implements differently. Reka keeps the root contexts, the popper,\n// the dismissable layer, the focus scope and the portal; the items, their\n// roving focus, typeahead and the submenu pointer grace area are Radix's,\n// ported here so the DOM (tabindex, data-highlighted, data-orientation) and\n// the handler order match React.\n\nexport const SELECTION_KEYS = [\"Enter\", \" \"]\nconst FIRST_KEYS = [\"ArrowDown\", \"PageUp\", \"Home\"]\nconst LAST_KEYS = [\"ArrowUp\", \"PageDown\", \"End\"]\nexport const FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS]\nexport const isLastKey = (key: string) => LAST_KEYS.includes(key)\nexport const SUB_OPEN_KEYS = { ltr: [...SELECTION_KEYS, \"ArrowRight\"], rtl: [...SELECTION_KEYS, \"ArrowLeft\"] }\nexport const SUB_CLOSE_KEYS = { ltr: [\"ArrowLeft\"], rtl: [\"ArrowRight\"] }\nexport const ITEM_SELECT = \"menu.itemSelect\"\n\nexport type Direction = \"ltr\" | \"rtl\"\nexport type CheckedState = boolean | \"indeterminate\"\ntype Point = { x: number; y: number }\ntype Polygon = Point[]\ntype Side = \"left\" | \"right\"\nexport type GraceIntent = { area: Polygon; side: Side }\n\n/** A `{ current }` box, like a React ref: plain state no render depends on. */\nexport type Box<T> = { current: T }\nexport const box = <T>(current: T): Box<T> => ({ current })\n\n// ---------------------------------------------------------------------------\n// Root (Radix Menu root context)\n\nexport type MenuRootInternals = {\n /** Radix `rootContext.onClose`: closes the whole menu */\n onClose: () => void\n /** Set by keydown, cleared by the next pointer event (Radix's isUsingKeyboardRef) */\n isUsingKeyboard: Box<boolean>\n dir: ComputedRef<Direction>\n modal: () => boolean\n /** The root trigger element, focused when the menu closes */\n trigger: ShallowRef<HTMLElement | null>\n}\n\nexport const MenuRootInternalsKey: InjectionKey<MenuRootInternals> = Symbol(\"PlexUIMenuRootInternals\")\n\nexport const useMenuRootInternals = () => {\n const context = inject(MenuRootInternalsKey, null)\n if (!context) throw new Error(\"Menu components must be wrapped in <Menu />\")\n return context\n}\n\n/** Radix's keyboard tracking: any keydown, until the next pointer event. */\nexport const trackKeyboardUse = (isUsingKeyboard: Box<boolean>) => {\n const handlePointer = () => {\n isUsingKeyboard.current = false\n }\n const handleKeyDown = () => {\n isUsingKeyboard.current = true\n document.addEventListener(\"pointerdown\", handlePointer, { capture: true, once: true })\n document.addEventListener(\"pointermove\", handlePointer, { capture: true, once: true })\n }\n document.addEventListener(\"keydown\", handleKeyDown, { capture: true })\n return () => {\n document.removeEventListener(\"keydown\", handleKeyDown, { capture: true })\n document.removeEventListener(\"pointerdown\", handlePointer, { capture: true })\n document.removeEventListener(\"pointermove\", handlePointer, { capture: true })\n }\n}\n\n// ---------------------------------------------------------------------------\n// One menu level, the root or a submenu (Radix MenuContext)\n\nexport type MenuLevel = {\n open: () => boolean\n /** Radix's controlled `setOpen`: reports a change only when it differs */\n onOpenChange: (open: boolean) => void\n /** The level's content element while it is mounted */\n content: ShallowRef<HTMLElement | null>\n}\n\nexport const MenuLevelKey: InjectionKey<MenuLevel> = Symbol(\"PlexUIMenuLevel\")\n\nexport const useMenuLevel = () => {\n const context = inject(MenuLevelKey, null)\n if (!context) throw new Error(\"Menu components must be wrapped in <Menu />\")\n return context\n}\n\n// ---------------------------------------------------------------------------\n// Submenu (Radix MenuSubContext)\n\nexport type MenuSubInternals = {\n triggerId: string\n contentId: string\n trigger: ShallowRef<HTMLElement | null>\n}\n\nexport const MenuSubInternalsKey: InjectionKey<MenuSubInternals> = Symbol(\"PlexUIMenuSubInternals\")\n\nexport const useMenuSubInternals = () => {\n const context = inject(MenuSubInternalsKey, null)\n if (!context) throw new Error(\"Submenu components must be wrapped in <Sub />\")\n return context\n}\n\n// ---------------------------------------------------------------------------\n// Content (Radix MenuContentContext, the menu collection and the roving focus group)\n\nexport type ItemRecord = {\n id: symbol\n element: () => HTMLElement | null\n disabled: () => boolean\n}\n\nexport type MenuContentContext = {\n register: (item: ItemRecord) => () => void\n /** Items in document order */\n getItems: () => ItemRecord[]\n searchRef: Box<string>\n currentTabStopId: Ref<symbol | null>\n onItemFocus: (id: symbol) => void\n onItemShiftTab: () => void\n onItemEnter: (event: PointerEvent) => void\n onItemLeave: (event: PointerEvent) => void\n onTriggerLeave: (event: PointerEvent) => void\n pointerGraceTimer: Box<number>\n onPointerGraceIntentChange: (intent: GraceIntent | null) => void\n}\n\nexport const MenuContentContextKey: InjectionKey<MenuContentContext> = Symbol(\"PlexUIMenuContent\")\n\nexport const useMenuContentContext = () => {\n const context = inject(MenuContentContextKey, null)\n if (!context) throw new Error(\"Menu items must be rendered inside <MenuContent /> or <MenuSubContent />\")\n return context\n}\n\nconst byDocumentPosition = (a: ItemRecord, b: ItemRecord) => {\n const elementA = a.element()\n const elementB = b.element()\n if (!elementA || !elementB || elementA === elementB) return 0\n return elementA.compareDocumentPosition(elementB) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1\n}\n\n/**\n * State and callbacks of one content element (root or submenu): the item\n * collection, typeahead buffer, current tab stop and pointer grace area.\n */\nexport const provideMenuContentContext = (getContent: () => HTMLElement | null) => {\n const items = new Set<ItemRecord>()\n const searchRef = box(\"\")\n const timer = box(0)\n const currentTabStopId = ref<symbol | null>(null)\n const isTabbingBackOut = ref(false)\n const isClickFocus = box(false)\n const pointerGraceTimer = box(0)\n const pointerGraceIntent = box<GraceIntent | null>(null)\n const pointerDir = box<Side>(\"right\")\n const lastPointerX = box(0)\n\n const isPointerMovingToSubmenu = (event: PointerEvent) => {\n const isMovingTowards = pointerDir.current === pointerGraceIntent.current?.side\n return isMovingTowards && isPointerInGraceArea(event, pointerGraceIntent.current?.area)\n }\n\n const getItems = () => Array.from(items).filter((item) => item.element()).sort(byDocumentPosition)\n\n const context: MenuContentContext = {\n register: (item) => {\n items.add(item)\n return () => items.delete(item)\n },\n getItems,\n searchRef,\n currentTabStopId,\n onItemFocus: (id) => {\n currentTabStopId.value = id\n },\n onItemShiftTab: () => {\n isTabbingBackOut.value = true\n },\n onItemEnter: (event) => {\n if (isPointerMovingToSubmenu(event)) event.preventDefault()\n },\n onItemLeave: (event) => {\n if (isPointerMovingToSubmenu(event)) return\n getContent()?.focus()\n currentTabStopId.value = null\n },\n onTriggerLeave: (event) => {\n if (isPointerMovingToSubmenu(event)) event.preventDefault()\n },\n pointerGraceTimer,\n onPointerGraceIntentChange: (intent) => {\n pointerGraceIntent.current = intent\n },\n }\n\n provide(MenuContentContextKey, context)\n onBeforeUnmount(() => window.clearTimeout(timer.current))\n\n const handleTypeaheadSearch = (key: string) => {\n const search = searchRef.current + key\n const enabled = getItems().filter((item) => !item.disabled())\n const currentItem = document.activeElement\n const textOf = (item: ItemRecord) => (item.element()?.textContent ?? \"\").trim()\n const currentMatch = enabled.find((item) => item.element() === currentItem)\n const values = enabled.map(textOf)\n const nextMatch = getNextMatch(values, search, currentMatch ? textOf(currentMatch) : undefined)\n const newItem = enabled.find((item) => textOf(item) === nextMatch)?.element()\n\n const updateSearch = (value: string) => {\n searchRef.current = value\n window.clearTimeout(timer.current)\n if (value !== \"\") timer.current = window.setTimeout(() => updateSearch(\"\"), 1000)\n }\n updateSearch(search)\n\n if (newItem) {\n setTimeout(() => newItem.focus())\n }\n }\n\n /** Clears the typeahead buffer (Radix: a blur from a portalled child) */\n const resetSearch = () => {\n window.clearTimeout(timer.current)\n searchRef.current = \"\"\n }\n\n /**\n * The content element's own handlers: Radix MenuContentImpl's content\n * props plus the RovingFocusGroup root's, run before Reka's.\n * `isUsingKeyboard` gates the entry focus like MenuContentImpl's\n * `onEntryFocus`.\n */\n const contentHandlers = (isUsingKeyboard: Box<boolean>) => ({\n onKeydown: (event: KeyboardEvent) => {\n // Radix composes this after the items' handlers: it is skipped when one\n // of them already handled the key\n if (event.defaultPrevented) return\n const target = event.target as HTMLElement\n const currentTarget = event.currentTarget as HTMLElement\n const isKeyDownInside = target.closest(\"[data-reka-menu-content]\") === currentTarget\n const isModifierKey = event.ctrlKey || event.altKey || event.metaKey\n const isCharacterKey = event.key.length === 1\n if (isKeyDownInside) {\n // menus should not be navigated using tab key so we prevent it\n if (event.key === \"Tab\") event.preventDefault()\n if (!isModifierKey && isCharacterKey) handleTypeaheadSearch(event.key)\n }\n // focus first/last item based on key pressed\n if (event.target !== getContent()) return\n if (!FIRST_LAST_KEYS.includes(event.key)) return\n event.preventDefault()\n const candidateNodes = getItems()\n .filter((item) => !item.disabled())\n .map((item) => item.element())\n .filter((element): element is HTMLElement => !!element)\n if (isLastKey(event.key)) candidateNodes.reverse()\n focusFirst(candidateNodes)\n },\n onPointermove: whenMouse((event) => {\n const target = event.target as HTMLElement\n const pointerXHasChanged = lastPointerX.current !== event.clientX\n // We don't use `event.movementX` for this check because Safari will\n // always return `0` on a pointer event.\n if ((event.currentTarget as HTMLElement).contains(target) && pointerXHasChanged) {\n pointerDir.current = event.clientX > lastPointerX.current ? \"right\" : \"left\"\n lastPointerX.current = event.clientX\n }\n }),\n // RovingFocusGroup root: entry focus moves to the first item when the\n // content is focused from the keyboard\n onMousedown: () => {\n isClickFocus.current = true\n },\n onFocusin: (event: FocusEvent) => {\n const isKeyboardFocus = !isClickFocus.current\n if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut.value) {\n if (isUsingKeyboard.current) {\n const focusable = getItems().filter((item) => !item.disabled())\n const currentItem = focusable.find((item) => item.id === currentTabStopId.value)\n const candidates = [currentItem, ...focusable].filter((item): item is ItemRecord => !!item)\n focusFirst(candidates.map((item) => item.element()).filter((element): element is HTMLElement => !!element))\n }\n }\n isClickFocus.current = false\n },\n onFocusout: () => {\n isTabbingBackOut.value = false\n },\n })\n\n return { context, contentHandlers, resetSearch }\n}\n\n// ---------------------------------------------------------------------------\n// Radix helpers\n\nexport const whenMouse =\n <E extends PointerEvent>(handler: (event: E) => void) =>\n (event: E) =>\n event.pointerType === \"mouse\" && isHoverPointer(event) ? handler(event) : undefined\n\nexport const focusFirst = (candidates: HTMLElement[]) => {\n const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement\n for (const candidate of candidates) {\n // if focus is already where we want to go, we don't want to keep going through the candidates\n if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return\n candidate.focus()\n if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return\n }\n}\n\nconst wrapArray = <T>(array: T[], startIndex: number) =>\n array.map((_, index) => array[(startIndex + index) % array.length]!)\n\n/**\n * The next item matching the typeahead search: repeated characters cycle\n * through items starting with that character, and the current match is\n * skipped for a single character so it moves on.\n */\nconst getNextMatch = (values: string[], search: string, currentMatch?: string) => {\n const isRepeated = search.length > 1 && Array.from(search).every((char) => char === search[0])\n const normalizedSearch = isRepeated ? search[0]! : search\n const currentMatchIndex = currentMatch ? values.indexOf(currentMatch) : -1\n let wrappedValues = wrapArray(values, Math.max(currentMatchIndex, 0))\n const excludeCurrentMatch = normalizedSearch.length === 1\n if (excludeCurrentMatch) wrappedValues = wrappedValues.filter((v) => v !== currentMatch)\n const nextMatch = wrappedValues.find((value) => value.toLowerCase().startsWith(normalizedSearch.toLowerCase()))\n return nextMatch !== currentMatch ? nextMatch : undefined\n}\n\nconst isPointInPolygon = (point: Point, polygon: Polygon) => {\n const { x, y } = point\n let inside = false\n for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {\n const ii = polygon[i]!\n const jj = polygon[j]!\n const xi = ii.x\n const yi = ii.y\n const xj = jj.x\n const yj = jj.y\n // prettier-ignore\n const intersect = ((yi > y) !== (yj > y)) && (x < (xj - xi) * (y - yi) / (yj - yi) + xi)\n if (intersect) inside = !inside\n }\n return inside\n}\n\nconst isPointerInGraceArea = (event: PointerEvent, area?: Polygon) => {\n if (!area) return false\n return isPointInPolygon({ x: event.clientX, y: event.clientY }, area)\n}\n\nconst MAP_KEY_TO_FOCUS_INTENT: Record<string, \"first\" | \"last\" | \"prev\" | \"next\"> = {\n ArrowLeft: \"prev\",\n ArrowUp: \"prev\",\n ArrowRight: \"next\",\n ArrowDown: \"next\",\n PageUp: \"first\",\n Home: \"first\",\n PageDown: \"last\",\n End: \"last\",\n}\n\n/** RovingFocusGroup's focus intent for a vertical group */\nexport const getFocusIntent = (event: KeyboardEvent, dir: Direction) => {\n const key =\n dir !== \"rtl\" ? event.key : event.key === \"ArrowLeft\" ? \"ArrowRight\" : event.key === \"ArrowRight\" ? \"ArrowLeft\" : event.key\n if ([\"ArrowLeft\", \"ArrowRight\"].includes(key)) return undefined\n return MAP_KEY_TO_FOCUS_INTENT[key]\n}\n\nexport const getOpenState = (open: boolean) => (open ? \"open\" : \"closed\")\nexport const isIndeterminate = (checked?: CheckedState) => checked === \"indeterminate\"\nexport const getCheckedState = (checked: CheckedState) =>\n isIndeterminate(checked) ? \"indeterminate\" : checked ? \"checked\" : \"unchecked\"\n\n// ---------------------------------------------------------------------------\n// Event handler composition\n\ntype Handler<E extends Event = Event> = (event: E) => void\n\n/** Calls a Vue listener value (a function or an array of them). */\nexport const callListener = (listener: unknown, event: Event) => {\n if (Array.isArray(listener)) for (const fn of listener) (fn as Handler)(event)\n else if (typeof listener === \"function\") (listener as Handler)(event)\n}\n\n/**\n * Calls the listener(s) and tells whether one of them called\n * `preventDefault()`, also on an event that was canceled already.\n */\nconst callListenerTrackingCancel = (listener: unknown, event: Event) => {\n let canceled = false\n const preventDefault = event.preventDefault\n event.preventDefault = function (this: Event) {\n canceled = true\n preventDefault.call(this)\n }\n try {\n callListener(listener, event)\n } finally {\n // Back to the prototype's method\n delete (event as { preventDefault?: unknown }).preventDefault\n }\n return canceled\n}\n\n/**\n * Radix's composeEventHandlers: the consumer's handler runs first, ours only\n * when it did not call preventDefault().\n */\nexport const compose =\n <E extends Event>(consumer: unknown, ours?: Handler<E>, { checkForDefaultPrevented = true } = {}) =>\n (event: E) => {\n callListener(consumer, event)\n if (checkForDefaultPrevented === false || !event.defaultPrevented) ours?.(event)\n }\n\n// ---------------------------------------------------------------------------\n// Items (Radix MenuItemImpl + RovingFocusGroupItem)\n\nexport type ItemImplHandlers = {\n onClick?: Handler<MouseEvent>\n onClickCapture?: Handler<MouseEvent>\n onPointerdown?: Handler<PointerEvent>\n onPointerup?: Handler<PointerEvent>\n onPointermove?: Handler<PointerEvent>\n onPointerleave?: Handler<PointerEvent>\n onKeydown?: Handler<KeyboardEvent>\n onFocusin?: Handler<FocusEvent>\n onFocusout?: Handler<FocusEvent>\n onMousedown?: Handler<MouseEvent>\n}\n\n/**\n * One focusable menu item: registers in the content's collection and\n * returns its attributes plus the handlers of MenuItemImpl and the roving\n * focus item, run after `outer` (the item kind's own handlers) the way Radix\n * composes them.\n */\nexport const useMenuItemImpl = (disabled: () => boolean) => {\n const contentContext = useMenuContentContext()\n const rootInternals = useMenuRootInternals()\n const element = shallowRef<HTMLElement | null>(null)\n const isFocused = ref(false)\n const id = Symbol(\"menu-item\")\n\n const unregister = contentContext.register({ id, element: () => element.value, disabled })\n onBeforeUnmount(unregister)\n\n const setElement = (el: unknown) => {\n const node = el && typeof el === \"object\" && \"$el\" in el ? (el as { $el: unknown }).$el : el\n element.value = node instanceof HTMLElement ? node : null\n }\n\n const attrs = () => ({\n \"role\": \"menuitem\",\n \"tabindex\": contentContext.currentTabStopId.value === id ? 0 : -1,\n \"data-orientation\": \"vertical\",\n \"data-highlighted\": isFocused.value ? \"\" : undefined,\n \"aria-disabled\": disabled() || undefined,\n \"data-disabled\": disabled() ? \"\" : undefined,\n })\n\n const rovingKeydown = (event: KeyboardEvent) => {\n if (event.key === \"Tab\" && event.shiftKey) {\n contentContext.onItemShiftTab()\n return\n }\n if (event.target !== event.currentTarget) return\n const focusIntent = getFocusIntent(event, rootInternals.dir.value)\n if (focusIntent !== undefined) {\n if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return\n event.preventDefault()\n let candidateNodes = contentContext\n .getItems()\n .filter((item) => !item.disabled())\n .map((item) => item.element())\n .filter((node): node is HTMLElement => !!node)\n if (focusIntent === \"last\") candidateNodes.reverse()\n else if (focusIntent === \"prev\" || focusIntent === \"next\") {\n if (focusIntent === \"prev\") candidateNodes.reverse()\n const currentIndex = candidateNodes.indexOf(event.currentTarget as HTMLElement)\n // The menu's roving focus group does not loop\n candidateNodes = candidateNodes.slice(currentIndex + 1)\n }\n setTimeout(() => focusFirst(candidateNodes))\n }\n }\n\n const handlers = (outer: ItemImplHandlers): ItemImplHandlers => ({\n ...outer,\n onPointermove: compose(\n outer.onPointermove,\n whenMouse((event: PointerEvent) => {\n if (disabled()) {\n contentContext.onItemLeave(event)\n } else {\n contentContext.onItemEnter(event)\n if (!event.defaultPrevented) {\n const item = event.currentTarget as HTMLElement\n item.focus({ preventScroll: true })\n }\n }\n }),\n ),\n onPointerleave: compose(\n outer.onPointerleave,\n whenMouse((event: PointerEvent) => contentContext.onItemLeave(event)),\n ),\n onFocusin: (event) => {\n compose(outer.onFocusin, () => {\n isFocused.value = true\n })(event)\n if (!event.defaultPrevented) contentContext.onItemFocus(id)\n },\n onFocusout: compose(outer.onFocusout, () => {\n isFocused.value = false\n }),\n onMousedown: (event) => {\n callListener(outer.onMousedown, event)\n if (event.defaultPrevented) return\n // We prevent focusing non-focusable items on `mousedown`.\n // Even though the item has tabIndex={-1}, that only means take it out of the tab order.\n if (disabled()) event.preventDefault()\n // Safari doesn't focus a button when clicked so we run our logic on mousedown also\n else contentContext.onItemFocus(id)\n },\n onKeydown: compose(outer.onKeydown, rovingKeydown),\n })\n\n return { element, setElement, attrs, handlers, contentContext, rootInternals }\n}\n\n/**\n * Radix MenuItem's select behaviour on top of `useMenuItemImpl`: click,\n * pointer-up selection after a pointer-down elsewhere, Enter / Space.\n */\nexport const useMenuItemSelect = (\n impl: ReturnType<typeof useMenuItemImpl>,\n disabled: () => boolean,\n onSelect: () => ((event: Event) => void) | undefined,\n) => {\n let isPointerDown = false\n\n const handleSelect = () => {\n const menuItem = impl.element.value\n if (!disabled() && menuItem) {\n const itemSelectEvent = new CustomEvent(ITEM_SELECT, { bubbles: true, cancelable: true })\n menuItem.addEventListener(ITEM_SELECT, (event) => onSelect()?.(event), { once: true })\n menuItem.dispatchEvent(itemSelectEvent)\n if (itemSelectEvent.defaultPrevented) {\n isPointerDown = false\n } else {\n impl.rootInternals.onClose()\n }\n }\n }\n\n // Whether the click was canceled before it reached the item (capture phase)\n let canceledBeforeItem = false\n\n /**\n * Handlers of the item itself; `consumer` holds the item's own listeners.\n * `linkComponent`: the item renders a link component (a router link).\n */\n const handlers = (consumer: Record<string, unknown>, linkComponent = false): ItemImplHandlers => ({\n onClickCapture: (event) => {\n callListener(consumer.onClickCapture, event)\n canceledBeforeItem = event.defaultPrevented\n },\n // A canceled click is not selected, as in Radix. A router link component\n // runs its own click handler (which prevents the navigation) before the\n // listeners passed to it, where React's runs after, so a link\n // component's cancel from after the capture phase is its own and is\n // ignored; only the consumer's preventDefault() then skips the selection\n // (also when the link had canceled the event already).\n onClick: (event) => {\n const canceledByLink = linkComponent && event.defaultPrevented && !canceledBeforeItem\n const canceledByConsumer = callListenerTrackingCancel(consumer.onClick, event)\n if (canceledByLink ? canceledByConsumer : event.defaultPrevented) return\n handleSelect()\n },\n onPointerdown: (event) => {\n callListener(consumer.onPointerdown, event)\n isPointerDown = true\n },\n onPointerup: compose(consumer.onPointerup, (event: PointerEvent) => {\n // Pointer down can move to a different menu item which should activate it on pointer up.\n // We dispatch a click for selection to allow composition with click based triggers and to\n // prevent Firefox from getting stuck in text selection mode when the menu closes.\n if (!isPointerDown) (event.currentTarget as HTMLElement | null)?.click()\n }),\n onKeydown: compose(consumer.onKeydown, (event: KeyboardEvent) => {\n const isTypingAhead = impl.contentContext.searchRef.current !== \"\"\n if (disabled() || (isTypingAhead && event.key === \" \")) return\n if (SELECTION_KEYS.includes(event.key)) {\n ;(event.currentTarget as HTMLElement).click()\n /**\n * We prevent default browser behaviour for selection keys as they should trigger\n * a selection only:\n * - prevents space from scrolling the page.\n * - if keydown causes focus to move, prevents keydown from firing on the new target.\n */\n event.preventDefault()\n }\n }),\n })\n\n return { handlers }\n}\n\nconst ITEM_LISTENERS = [\n \"onClick\",\n \"onClickCapture\",\n \"onPointerdown\",\n \"onPointerup\",\n \"onKeydown\",\n \"onPointermove\",\n \"onPointerleave\",\n \"onFocusin\",\n \"onFocusout\",\n \"onMousedown\",\n]\n\n/**\n * Every listener of a selectable item: the element's own `listeners` first,\n * then the item's handlers (the order of Radix's Slot), plus `after`\n * handlers that run between the two for pointer moves and leaves.\n */\nexport const selectableItemListeners = (\n impl: ReturnType<typeof useMenuItemImpl>,\n select: ReturnType<typeof useMenuItemSelect>,\n listeners: Record<string, unknown>,\n after: { onPointermove?: Handler<PointerEvent>; onPointerleave?: Handler<PointerEvent> } = {},\n linkComponent = false,\n) => {\n const own = (key: string) => (event: Event) => callListener(listeners[key], event)\n const chain = (key: \"onPointermove\" | \"onPointerleave\") => (event: PointerEvent) => {\n callListener(listeners[key], event)\n after[key]?.(event)\n }\n const rest = Object.fromEntries(Object.entries(listeners).filter(([key]) => !ITEM_LISTENERS.includes(key)))\n return {\n ...rest,\n ...impl.handlers({\n ...select.handlers(listeners, linkComponent),\n onPointermove: chain(\"onPointermove\"),\n onPointerleave: chain(\"onPointerleave\"),\n onFocusin: own(\"onFocusin\"),\n onFocusout: own(\"onFocusout\"),\n onMousedown: own(\"onMousedown\"),\n }),\n }\n}\n\n/** Splits Vue attrs into listeners (`onX`) and the rest. */\nexport const splitListeners = (attrs: Record<string, unknown>) => {\n const listeners: Record<string, unknown> = {}\n const rest: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(attrs)) {\n if (/^on[A-Z]/.test(key)) listeners[key] = value\n else rest[key] = value\n }\n return { listeners, rest }\n}\n"]}
|
|
@@ -38,9 +38,9 @@ export const OTPInput = defineComponent({
|
|
|
38
38
|
autoFocus: { type: Boolean, default: false },
|
|
39
39
|
},
|
|
40
40
|
emits: {
|
|
41
|
-
"update:value": (
|
|
42
|
-
"change": (
|
|
43
|
-
"complete": (
|
|
41
|
+
"update:value": (value) => typeof value === "string",
|
|
42
|
+
"change": (value) => typeof value === "string",
|
|
43
|
+
"complete": (value) => typeof value === "string",
|
|
44
44
|
},
|
|
45
45
|
setup(props, { attrs, emit, expose }) {
|
|
46
46
|
const length = computed(() => Math.max(1, Math.floor(props.length)));
|
|
@@ -100,7 +100,7 @@ export const OTPInput = defineComponent({
|
|
|
100
100
|
const input = inputRefs[clampedIndex];
|
|
101
101
|
if (!input)
|
|
102
102
|
return;
|
|
103
|
-
input.focus();
|
|
103
|
+
input.focus({ preventScroll: true });
|
|
104
104
|
input.setSelectionRange(1, 1);
|
|
105
105
|
};
|
|
106
106
|
// A field cleared from outside (a wrong code wiped by the form) puts the
|
|
@@ -171,6 +171,9 @@ export const OTPInput = defineComponent({
|
|
|
171
171
|
focusCell(Math.min(writeIndex, length.value - 1));
|
|
172
172
|
};
|
|
173
173
|
const handleKeyDown = (index, evt) => {
|
|
174
|
+
// Candidate editing belongs to the IME, including Safari's 229 key.
|
|
175
|
+
if (evt.isComposing || evt.keyCode === 229)
|
|
176
|
+
return;
|
|
174
177
|
if (props.disabled)
|
|
175
178
|
return;
|
|
176
179
|
if (evt.key === "Backspace") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OTPInput.js","sourceRoot":"","sources":["../../../../src/components/OTPInput/OTPInput.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,K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EAAE,GAAG,CAAC;4BAC9D,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC,YAAY,CAAC,KAAK,GAAG,KAAK,CAAC;4BAC7C,QAAQ,EAAE,UAAU;4BACpB,SAAS,EAAE,CAAC,GAAmB,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,CAAC;4BAC3D,YAAY,EAAE,SAAS,KAAK,GAAG,CAAC,EAAE;4BAClC,cAAc,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;4BAChD,kBAAkB,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;4BAC5D,cAAc,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK;yBACtD,CAAC;wBACF,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,YAAY,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI;qBACpG,CACF;iBACF,CAAA;YACH,CAAC,CAAC,CAAC,IAAI,EAAE,CACV;YACD,KAAK,CAAC,YAAY;gBAChB,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,YAAY,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;gBAC9F,CAAC,CAAC,IAAI;SACT,CAAC,CAAA;IACN,CAAC;CACF,CAAC,CAAA","sourcesContent":["import clsx from \"clsx\"\nimport { computed, defineComponent, h, nextTick, onMounted, onUpdated, ref, shallowRef, useId, watch, type PropType } from \"vue\"\nimport { FieldError } from \"../FieldError/index.js\"\nimport s from \"@plexui/styles/components/OTPInput/OTPInput.module.css\"\n\nfunction sanitizeDigits(value: string, length: number): string {\n return value.replace(/\\D/g, \"\").slice(0, length)\n}\n\n// One entry per cell, \"\" when empty\nfunction toCells(value: string, length: number): string[] {\n return Array.from({ length }, (_, index) => value[index] ?? \"\")\n}\n\nfunction shouldShowGap(index: number, grouping: number[]): boolean {\n let pos = 0\n for (const groupSize of grouping) {\n pos += groupSize\n if (index === pos) return true\n }\n return false\n}\n\n/**\n * Port of packages/ui/src/components/OTPInput/OTPInput.tsx. Controlled with\n * `value` (`v-model:value`); emits `update:value` and `change` when the\n * digits change and `complete` when every cell is filled.\n */\nexport const OTPInput = defineComponent({\n name: \"OTPInput\",\n inheritAttrs: false,\n props: {\n /** Number of digit cells. @default 6 */\n length: { type: Number, default: 6 },\n value: String,\n /** Group sizes, e.g. [3, 3] puts a gap after the third cell */\n grouping: Array as PropType<number[]>,\n invalid: { type: Boolean, default: false },\n errorMessage: String,\n disabled: { type: Boolean, default: false },\n autoFocus: { type: Boolean, default: false },\n },\n emits: {\n \"update:value\": (_value: string) => true,\n \"change\": (_value: string) => true,\n \"complete\": (_value: string) => true,\n },\n setup(props, { attrs, emit, expose }) {\n const length = computed(() => Math.max(1, Math.floor(props.length)))\n const controlledValue = computed(() => sanitizeDigits(props.value ?? \"\", length.value))\n const isControlled = computed(() => props.value !== undefined)\n\n // The digit of every cell, so clearing or filling one cell never moves the\n // others; the value is the filled cells' digits in order\n const cells = shallowRef(toCells(controlledValue.value, length.value))\n const focusedIndex = ref(-1)\n\n const rootRef = ref<HTMLDivElement | null>(null)\n const inputRefs: Array<HTMLInputElement | null> = []\n\n expose({ root: rootRef })\n\n const ownCells = computed(() => Array.from({ length: length.value }, (_, index) => cells.value[index] ?? \"\"))\n const currentValue = computed(() => (isControlled.value ? controlledValue.value : ownCells.value.join(\"\")))\n // The cells keep their gaps while they spell the value; any other value\n // (set by the parent) fills the cells from the start\n const digits = computed(() =>\n ownCells.value.join(\"\") === currentValue.value ? ownCells.value : toCells(currentValue.value, length.value),\n )\n\n const errorId = `otp-input-${useId()}-error`\n\n // Inputs mirror `digits` like React's controlled inputs, which undo any\n // typing the state did not take\n const syncInputs = () => {\n digits.value.forEach((digit, index) => {\n const input = inputRefs[index]\n if (input && input.value !== digit) input.value = digit\n })\n }\n onUpdated(syncInputs)\n\n // React's effect on [autoFocus, disabled]: on mount and on either change\n const runAutoFocus = () => {\n if (!props.autoFocus || props.disabled) return\n inputRefs[0]?.focus()\n }\n onMounted(runAutoFocus)\n watch([() => props.autoFocus, () => props.disabled], runAutoFocus, { flush: \"post\" })\n\n // The value the field's own last edit produced, until the value changes:\n // a field the user empties keeps the caret where it is\n let ownValue: string | null = null\n\n const commitDigits = (nextDigits: string[]) => {\n const previous = currentValue.value\n // Kept when controlled too: the parent's value then keeps these gaps\n cells.value = nextDigits\n const nextValue = nextDigits.join(\"\")\n ownValue = nextValue\n if (nextValue !== previous) {\n emit(\"update:value\", nextValue)\n emit(\"change\", nextValue)\n }\n if (nextValue.length === length.value) {\n emit(\"complete\", nextValue)\n }\n void nextTick(syncInputs)\n }\n\n const focusCell = (index: number) => {\n const clampedIndex = Math.max(0, Math.min(index, length.value - 1))\n const input = inputRefs[clampedIndex]\n if (!input) return\n input.focus()\n input.setSelectionRange(1, 1)\n }\n\n // A field cleared from outside (a wrong code wiped by the form) puts the\n // caret back in the first cell, when the focus was in the field already\n let hadValue = currentValue.value.length > 0\n watch(\n [currentValue, () => props.disabled],\n () => {\n const filled = currentValue.value.length > 0\n const fromOutside = ownValue !== currentValue.value\n ownValue = null\n const root = rootRef.value\n if (!filled && hadValue && fromOutside && !props.disabled && root?.contains(document.activeElement)) {\n focusCell(0)\n }\n hadValue = filled\n },\n { flush: \"post\" },\n )\n\n const handleCellClick = (index: number) => {\n if (props.disabled) return\n focusCell(index)\n }\n\n const handlePaste = (index: number, evt: ClipboardEvent) => {\n if (props.disabled) return\n evt.preventDefault()\n const pastedDigits = sanitizeDigits(evt.clipboardData?.getData(\"text\") ?? \"\", length.value)\n if (!pastedDigits) return\n\n const nextDigits = [...digits.value]\n let writeIndex = index\n\n for (const digit of pastedDigits) {\n if (writeIndex >= length.value) break\n nextDigits[writeIndex] = digit\n writeIndex += 1\n }\n\n commitDigits(nextDigits)\n // The cell after the pasted digits\n focusCell(Math.min(writeIndex, length.value - 1))\n }\n\n const handleChange = (index: number, evt: Event) => {\n if (props.disabled) return\n const typedDigits = (evt.currentTarget as HTMLInputElement).value.replace(/\\D/g, \"\")\n\n if (!typedDigits) {\n const nextDigits = [...digits.value]\n nextDigits[index] = \"\"\n commitDigits(nextDigits)\n return\n }\n\n const nextDigits = [...digits.value]\n\n if (typedDigits.length === 1) {\n nextDigits[index] = typedDigits[0]!\n commitDigits(nextDigits)\n if (index < length.value - 1) {\n focusCell(index + 1)\n }\n return\n }\n\n let writeIndex = index\n for (const digit of typedDigits) {\n if (writeIndex >= length.value) break\n nextDigits[writeIndex] = digit\n writeIndex += 1\n }\n\n commitDigits(nextDigits)\n // The cell after the typed digits\n focusCell(Math.min(writeIndex, length.value - 1))\n }\n\n const handleKeyDown = (index: number, evt: KeyboardEvent) => {\n if (props.disabled) return\n\n if (evt.key === \"Backspace\") {\n evt.preventDefault()\n const nextDigits = [...digits.value]\n\n if (nextDigits[index]) {\n nextDigits[index] = \"\"\n commitDigits(nextDigits)\n return\n }\n\n if (index > 0) {\n nextDigits[index - 1] = \"\"\n commitDigits(nextDigits)\n focusCell(index - 1)\n }\n return\n }\n\n if (evt.key === \"Delete\") {\n evt.preventDefault()\n const nextDigits = [...digits.value]\n nextDigits[index] = \"\"\n commitDigits(nextDigits)\n return\n }\n\n if (evt.key === \"ArrowLeft\") {\n evt.preventDefault()\n focusCell(index - 1)\n return\n }\n\n if (evt.key === \"ArrowRight\") {\n evt.preventDefault()\n focusCell(index + 1)\n }\n }\n\n const handleBlur = () => {\n requestAnimationFrame(() => {\n const activeElement = document.activeElement\n const isAnyCellFocused = inputRefs.some((input) => input === activeElement)\n if (!isAnyCellFocused) {\n focusedIndex.value = -1\n }\n })\n }\n\n return () =>\n h(\"div\", { ref: rootRef, class: clsx(s.Root, attrs.class as string | undefined) }, [\n h(\n \"div\",\n { class: s.Cells },\n Array.from({ length: length.value }, (_, index) => {\n const isGroupGap = props.grouping ? shouldShowGap(index, props.grouping) : false\n return [\n isGroupGap ? h(\"div\", { \"class\": s.GroupGap, \"aria-hidden\": \"true\" }) : null,\n h(\n \"div\",\n {\n \"class\": clsx(s.Cell, {\n [s.CellFocused!]: focusedIndex.value === index,\n [s.CellFilled!]: !!digits.value[index],\n }),\n \"data-invalid\": props.invalid ? \"\" : undefined,\n \"data-disabled\": props.disabled ? \"\" : undefined,\n \"onClick\": () => handleCellClick(index),\n },\n [\n h(\"input\", {\n \"ref\": (element: unknown) => {\n inputRefs[index] = element as HTMLInputElement | null\n },\n \"type\": \"text\",\n \"inputmode\": \"numeric\",\n \"pattern\": \"[0-9]\",\n \"maxlength\": 1,\n \"value\": digits.value[index],\n \"disabled\": props.disabled,\n \"class\": s.CellInput,\n \"onInput\": (evt: Event) => handleChange(index, evt),\n \"onKeydown\": (evt: KeyboardEvent) => handleKeyDown(index, evt),\n \"onFocus\": () => (focusedIndex.value = index),\n \"onBlur\": handleBlur,\n \"onPaste\": (evt: ClipboardEvent) => handlePaste(index, evt),\n \"aria-label\": `Digit ${index + 1}`,\n \"aria-invalid\": props.invalid ? true : undefined,\n \"aria-describedby\": props.errorMessage ? errorId : undefined,\n \"autocomplete\": index === 0 ? \"one-time-code\" : \"off\",\n }),\n !digits.value[index] && focusedIndex.value !== index ? h(\"div\", { class: s.DotPlaceholder }) : null,\n ],\n ),\n ]\n }).flat(),\n ),\n props.errorMessage\n ? h(FieldError, { id: errorId, class: s.ErrorMessage }, { default: () => props.errorMessage })\n : null,\n ])\n },\n})\n\nexport type OTPInputProps = InstanceType<typeof OTPInput>[\"$props\"]\n"]}
|
|
1
|
+
{"version":3,"file":"OTPInput.js","sourceRoot":"","sources":["../../../../src/components/OTPInput/OTPInput.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EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,YAAY,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;gBAC9F,CAAC,CAAC,IAAI;SACT,CAAC,CAAA;IACN,CAAC;CACF,CAAC,CAAA","sourcesContent":["import clsx from \"clsx\"\nimport { computed, defineComponent, h, nextTick, onMounted, onUpdated, ref, shallowRef, useId, watch, type PropType } from \"vue\"\nimport { FieldError } from \"../FieldError/index.js\"\nimport s from \"@plexui/styles/components/OTPInput/OTPInput.module.css\"\n\nfunction sanitizeDigits(value: string, length: number): string {\n return value.replace(/\\D/g, \"\").slice(0, length)\n}\n\n// One entry per cell, \"\" when empty\nfunction toCells(value: string, length: number): string[] {\n return Array.from({ length }, (_, index) => value[index] ?? \"\")\n}\n\nfunction shouldShowGap(index: number, grouping: number[]): boolean {\n let pos = 0\n for (const groupSize of grouping) {\n pos += groupSize\n if (index === pos) return true\n }\n return false\n}\n\n/**\n * Port of packages/ui/src/components/OTPInput/OTPInput.tsx. Controlled with\n * `value` (`v-model:value`); emits `update:value` and `change` when the\n * digits change and `complete` when every cell is filled.\n */\nexport const OTPInput = defineComponent({\n name: \"OTPInput\",\n inheritAttrs: false,\n props: {\n /** Number of digit cells. @default 6 */\n length: { type: Number, default: 6 },\n value: String,\n /** Group sizes, e.g. [3, 3] puts a gap after the third cell */\n grouping: Array as PropType<number[]>,\n invalid: { type: Boolean, default: false },\n errorMessage: String,\n disabled: { type: Boolean, default: false },\n autoFocus: { type: Boolean, default: false },\n },\n emits: {\n \"update:value\": (value: string) => typeof value === \"string\",\n \"change\": (value: string) => typeof value === \"string\",\n \"complete\": (value: string) => typeof value === \"string\",\n },\n setup(props, { attrs, emit, expose }) {\n const length = computed(() => Math.max(1, Math.floor(props.length)))\n const controlledValue = computed(() => sanitizeDigits(props.value ?? \"\", length.value))\n const isControlled = computed(() => props.value !== undefined)\n\n // The digit of every cell, so clearing or filling one cell never moves the\n // others; the value is the filled cells' digits in order\n const cells = shallowRef(toCells(controlledValue.value, length.value))\n const focusedIndex = ref(-1)\n\n const rootRef = ref<HTMLDivElement | null>(null)\n const inputRefs: Array<HTMLInputElement | null> = []\n\n expose({ root: rootRef })\n\n const ownCells = computed(() => Array.from({ length: length.value }, (_, index) => cells.value[index] ?? \"\"))\n const currentValue = computed(() => (isControlled.value ? controlledValue.value : ownCells.value.join(\"\")))\n // The cells keep their gaps while they spell the value; any other value\n // (set by the parent) fills the cells from the start\n const digits = computed(() =>\n ownCells.value.join(\"\") === currentValue.value ? ownCells.value : toCells(currentValue.value, length.value),\n )\n\n const errorId = `otp-input-${useId()}-error`\n\n // Inputs mirror `digits` like React's controlled inputs, which undo any\n // typing the state did not take\n const syncInputs = () => {\n digits.value.forEach((digit, index) => {\n const input = inputRefs[index]\n if (input && input.value !== digit) input.value = digit\n })\n }\n onUpdated(syncInputs)\n\n // React's effect on [autoFocus, disabled]: on mount and on either change\n const runAutoFocus = () => {\n if (!props.autoFocus || props.disabled) return\n inputRefs[0]?.focus()\n }\n onMounted(runAutoFocus)\n watch([() => props.autoFocus, () => props.disabled], runAutoFocus, { flush: \"post\" })\n\n // The value the field's own last edit produced, until the value changes:\n // a field the user empties keeps the caret where it is\n let ownValue: string | null = null\n\n const commitDigits = (nextDigits: string[]) => {\n const previous = currentValue.value\n // Kept when controlled too: the parent's value then keeps these gaps\n cells.value = nextDigits\n const nextValue = nextDigits.join(\"\")\n ownValue = nextValue\n if (nextValue !== previous) {\n emit(\"update:value\", nextValue)\n emit(\"change\", nextValue)\n }\n if (nextValue.length === length.value) {\n emit(\"complete\", nextValue)\n }\n void nextTick(syncInputs)\n }\n\n const focusCell = (index: number) => {\n const clampedIndex = Math.max(0, Math.min(index, length.value - 1))\n const input = inputRefs[clampedIndex]\n if (!input) return\n input.focus({ preventScroll: true })\n input.setSelectionRange(1, 1)\n }\n\n // A field cleared from outside (a wrong code wiped by the form) puts the\n // caret back in the first cell, when the focus was in the field already\n let hadValue = currentValue.value.length > 0\n watch(\n [currentValue, () => props.disabled],\n () => {\n const filled = currentValue.value.length > 0\n const fromOutside = ownValue !== currentValue.value\n ownValue = null\n const root = rootRef.value\n if (!filled && hadValue && fromOutside && !props.disabled && root?.contains(document.activeElement)) {\n focusCell(0)\n }\n hadValue = filled\n },\n { flush: \"post\" },\n )\n\n const handleCellClick = (index: number) => {\n if (props.disabled) return\n focusCell(index)\n }\n\n const handlePaste = (index: number, evt: ClipboardEvent) => {\n if (props.disabled) return\n evt.preventDefault()\n const pastedDigits = sanitizeDigits(evt.clipboardData?.getData(\"text\") ?? \"\", length.value)\n if (!pastedDigits) return\n\n const nextDigits = [...digits.value]\n let writeIndex = index\n\n for (const digit of pastedDigits) {\n if (writeIndex >= length.value) break\n nextDigits[writeIndex] = digit\n writeIndex += 1\n }\n\n commitDigits(nextDigits)\n // The cell after the pasted digits\n focusCell(Math.min(writeIndex, length.value - 1))\n }\n\n const handleChange = (index: number, evt: Event) => {\n if (props.disabled) return\n const typedDigits = (evt.currentTarget as HTMLInputElement).value.replace(/\\D/g, \"\")\n\n if (!typedDigits) {\n const nextDigits = [...digits.value]\n nextDigits[index] = \"\"\n commitDigits(nextDigits)\n return\n }\n\n const nextDigits = [...digits.value]\n\n if (typedDigits.length === 1) {\n nextDigits[index] = typedDigits[0]!\n commitDigits(nextDigits)\n if (index < length.value - 1) {\n focusCell(index + 1)\n }\n return\n }\n\n let writeIndex = index\n for (const digit of typedDigits) {\n if (writeIndex >= length.value) break\n nextDigits[writeIndex] = digit\n writeIndex += 1\n }\n\n commitDigits(nextDigits)\n // The cell after the typed digits\n focusCell(Math.min(writeIndex, length.value - 1))\n }\n\n const handleKeyDown = (index: number, evt: KeyboardEvent) => {\n // Candidate editing belongs to the IME, including Safari's 229 key.\n if (evt.isComposing || evt.keyCode === 229) return\n if (props.disabled) return\n\n if (evt.key === \"Backspace\") {\n evt.preventDefault()\n const nextDigits = [...digits.value]\n\n if (nextDigits[index]) {\n nextDigits[index] = \"\"\n commitDigits(nextDigits)\n return\n }\n\n if (index > 0) {\n nextDigits[index - 1] = \"\"\n commitDigits(nextDigits)\n focusCell(index - 1)\n }\n return\n }\n\n if (evt.key === \"Delete\") {\n evt.preventDefault()\n const nextDigits = [...digits.value]\n nextDigits[index] = \"\"\n commitDigits(nextDigits)\n return\n }\n\n if (evt.key === \"ArrowLeft\") {\n evt.preventDefault()\n focusCell(index - 1)\n return\n }\n\n if (evt.key === \"ArrowRight\") {\n evt.preventDefault()\n focusCell(index + 1)\n }\n }\n\n const handleBlur = () => {\n requestAnimationFrame(() => {\n const activeElement = document.activeElement\n const isAnyCellFocused = inputRefs.some((input) => input === activeElement)\n if (!isAnyCellFocused) {\n focusedIndex.value = -1\n }\n })\n }\n\n return () =>\n h(\"div\", { ref: rootRef, class: clsx(s.Root, attrs.class as string | undefined) }, [\n h(\n \"div\",\n { class: s.Cells },\n Array.from({ length: length.value }, (_, index) => {\n const isGroupGap = props.grouping ? shouldShowGap(index, props.grouping) : false\n return [\n isGroupGap ? h(\"div\", { \"class\": s.GroupGap, \"aria-hidden\": \"true\" }) : null,\n h(\n \"div\",\n {\n \"class\": clsx(s.Cell, {\n [s.CellFocused!]: focusedIndex.value === index,\n [s.CellFilled!]: !!digits.value[index],\n }),\n \"data-invalid\": props.invalid ? \"\" : undefined,\n \"data-disabled\": props.disabled ? \"\" : undefined,\n \"onClick\": () => handleCellClick(index),\n },\n [\n h(\"input\", {\n \"ref\": (element: unknown) => {\n inputRefs[index] = element as HTMLInputElement | null\n },\n \"type\": \"text\",\n \"inputmode\": \"numeric\",\n \"pattern\": \"[0-9]\",\n \"maxlength\": 1,\n \"value\": digits.value[index],\n \"disabled\": props.disabled,\n \"class\": s.CellInput,\n \"onInput\": (evt: Event) => handleChange(index, evt),\n \"onKeydown\": (evt: KeyboardEvent) => handleKeyDown(index, evt),\n \"onFocus\": () => (focusedIndex.value = index),\n \"onBlur\": handleBlur,\n \"onPaste\": (evt: ClipboardEvent) => handlePaste(index, evt),\n \"aria-label\": `Digit ${index + 1}`,\n \"aria-invalid\": props.invalid ? true : undefined,\n \"aria-describedby\": props.errorMessage ? errorId : undefined,\n \"autocomplete\": index === 0 ? \"one-time-code\" : \"off\",\n }),\n !digits.value[index] && focusedIndex.value !== index ? h(\"div\", { class: s.DotPlaceholder }) : null,\n ],\n ),\n ]\n }).flat(),\n ),\n props.errorMessage\n ? h(FieldError, { id: errorId, class: s.ErrorMessage }, { default: () => props.errorMessage })\n : null,\n ])\n },\n})\n\nexport type OTPInputProps = InstanceType<typeof OTPInput>[\"$props\"]\n"]}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineComponent, h, inject, mergeProps, onMounted, onBeforeUnmount, provide, ref, } from "vue";
|
|
2
|
+
import { provideFloatingBoundaryScope, useFloatingBoundaryRegistration } from "../../composables/useFloatingBoundary.js";
|
|
3
|
+
import { TOOLBAR_HOST } from "../Toolbar/Toolbar.js";
|
|
2
4
|
import s from "@plexui/styles/components/Page/Page.module.css";
|
|
3
5
|
// A trackpad's small settle at the top must not flash the line.
|
|
4
6
|
const SCROLLED_AFTER = 4;
|
|
@@ -21,10 +23,28 @@ const PageComponent = defineComponent({
|
|
|
21
23
|
* @default "full"
|
|
22
24
|
*/
|
|
23
25
|
width: { type: String, default: "full" },
|
|
26
|
+
/** Mobile canvas and grouped-field palette. @default "plain" */
|
|
27
|
+
surface: { type: String, default: "plain" },
|
|
24
28
|
},
|
|
25
29
|
setup(props, { slots }) {
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
const boundary = provideFloatingBoundaryScope();
|
|
31
|
+
const context = { scrolled: ref(false), footerHeight: ref(0), headerHeight: ref() };
|
|
32
|
+
provide(PAGE_CONTEXT, context);
|
|
33
|
+
// A phone Toolbar replaces the header and footer bars; it reports its own heights.
|
|
34
|
+
const toolbarTop = ref();
|
|
35
|
+
const toolbarBottom = ref();
|
|
36
|
+
provide(TOOLBAR_HOST, {
|
|
37
|
+
kind: "page",
|
|
38
|
+
scrolled: context.scrolled,
|
|
39
|
+
setHeight: (placement, height) => { (placement === "top" ? toolbarTop : toolbarBottom).value = height; },
|
|
40
|
+
});
|
|
41
|
+
return () => h("div", { "ref": boundary.setRoot, "class": s.Page, "data-width": props.width, "data-surface": props.surface,
|
|
42
|
+
style: {
|
|
43
|
+
"--page-footer-height": `${context.footerHeight.value}px`,
|
|
44
|
+
...(context.headerHeight.value !== undefined ? { "--page-header-height": `${context.headerHeight.value}px` } : {}),
|
|
45
|
+
...(toolbarTop.value !== undefined ? { "--page-toolbar-height": `${toolbarTop.value}px` } : {}),
|
|
46
|
+
...(toolbarBottom.value !== undefined ? { "--page-toolbar-bottom-height": `${toolbarBottom.value}px` } : {}),
|
|
47
|
+
} }, slots.default?.());
|
|
28
48
|
},
|
|
29
49
|
});
|
|
30
50
|
export const Page = PageComponent;
|
|
@@ -33,17 +53,29 @@ export const PageHeader = defineComponent({
|
|
|
33
53
|
name: "PageHeader",
|
|
34
54
|
props: {
|
|
35
55
|
/**
|
|
36
|
-
* Shows
|
|
37
|
-
*
|
|
56
|
+
* Shows a divider once the content has scrolled under the header.
|
|
57
|
+
* Turn it off when the content already draws a line of
|
|
38
58
|
* its own at that place.
|
|
39
59
|
* @default true
|
|
40
60
|
*/
|
|
41
61
|
divider: { type: Boolean, default: true },
|
|
62
|
+
background: { type: String, default: "glass" },
|
|
42
63
|
},
|
|
43
64
|
setup(props, { slots }) {
|
|
44
|
-
const scrolled = injectPageContext("PageHeader");
|
|
45
|
-
const
|
|
46
|
-
|
|
65
|
+
const { scrolled, headerHeight } = injectPageContext("PageHeader");
|
|
66
|
+
const element = ref(null);
|
|
67
|
+
let observer;
|
|
68
|
+
onMounted(() => {
|
|
69
|
+
const header = element.value;
|
|
70
|
+
if (!header)
|
|
71
|
+
return;
|
|
72
|
+
const update = () => { headerHeight.value = header.offsetHeight; };
|
|
73
|
+
update();
|
|
74
|
+
observer = typeof ResizeObserver !== "undefined" ? new ResizeObserver(update) : undefined;
|
|
75
|
+
observer?.observe(header, { box: "border-box" });
|
|
76
|
+
});
|
|
77
|
+
onBeforeUnmount(() => { observer?.disconnect(); headerHeight.value = undefined; });
|
|
78
|
+
return () => h("div", { "ref": element, "class": s.Header, "data-background": props.background, "data-scrolled": scrolled.value ? "" : undefined, "data-divider": props.divider ? "" : undefined }, [
|
|
47
79
|
h("div", { class: s.Head }, slots.default?.()),
|
|
48
80
|
]);
|
|
49
81
|
},
|
|
@@ -57,13 +89,39 @@ function part(name, tag, className) {
|
|
|
57
89
|
});
|
|
58
90
|
}
|
|
59
91
|
/** The row of the title and the actions (React `Page.Bar`). */
|
|
60
|
-
export const PageBar =
|
|
92
|
+
export const PageBar = defineComponent({
|
|
93
|
+
name: "PageBar",
|
|
94
|
+
setup(_, { slots }) {
|
|
95
|
+
const element = ref(null);
|
|
96
|
+
let observer;
|
|
97
|
+
let children;
|
|
98
|
+
onMounted(() => {
|
|
99
|
+
const bar = element.value;
|
|
100
|
+
if (!bar)
|
|
101
|
+
return;
|
|
102
|
+
const sides = () => bar.querySelectorAll(`:scope > .${s.Leading}, :scope > .${s.Actions}`);
|
|
103
|
+
const update = () => {
|
|
104
|
+
const width = Math.max(44, ...Array.from(sides(), (side) => side.offsetWidth));
|
|
105
|
+
bar.style.setProperty("--page-bar-side-width", `${width}px`);
|
|
106
|
+
};
|
|
107
|
+
observer = typeof ResizeObserver !== "undefined" ? new ResizeObserver(update) : undefined;
|
|
108
|
+
const observeSides = () => { observer?.disconnect(); sides().forEach((side) => observer?.observe(side, { box: "border-box" })); update(); };
|
|
109
|
+
observeSides();
|
|
110
|
+
children = new MutationObserver(observeSides);
|
|
111
|
+
children.observe(bar, { childList: true });
|
|
112
|
+
});
|
|
113
|
+
onBeforeUnmount(() => { observer?.disconnect(); children?.disconnect(); });
|
|
114
|
+
return () => h("div", { ref: element, class: s.Bar }, slots.default?.());
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
/** Navigation controls on the leading side (React `Page.Leading`). */
|
|
118
|
+
export const PageLeading = part("PageLeading", "div", s.Leading);
|
|
61
119
|
/** Title with what stands beside it, a subtitle under it on a phone (React `Page.Heading`). */
|
|
62
120
|
export const PageHeading = part("PageHeading", "div", s.Heading);
|
|
63
121
|
/** Page heading, an `<h1>` (React `Page.Title`). */
|
|
64
122
|
export const PageTitle = part("PageTitle", "h1", s.Title);
|
|
65
|
-
/** Status of the page, a
|
|
66
|
-
export const PageSubtitle = part("PageSubtitle", "
|
|
123
|
+
/** Status of the page, a flow container for badges and text (React `Page.Subtitle`). */
|
|
124
|
+
export const PageSubtitle = part("PageSubtitle", "div", s.Subtitle);
|
|
67
125
|
/** Buttons on the trailing side of the bar (React `Page.Actions`). */
|
|
68
126
|
export const PageActions = part("PageActions", "div", s.Actions);
|
|
69
127
|
/** The part of the page that scrolls (React `Page.Content`). */
|
|
@@ -79,7 +137,7 @@ export const PageContent = defineComponent({
|
|
|
79
137
|
fill: { type: Boolean, default: false },
|
|
80
138
|
},
|
|
81
139
|
setup(props, { attrs, slots }) {
|
|
82
|
-
const scrolled = injectPageContext("PageContent");
|
|
140
|
+
const { scrolled } = injectPageContext("PageContent");
|
|
83
141
|
const onScroll = (event) => {
|
|
84
142
|
scrolled.value = event.currentTarget.scrollTop > SCROLLED_AFTER;
|
|
85
143
|
};
|
|
@@ -89,8 +147,29 @@ export const PageContent = defineComponent({
|
|
|
89
147
|
/** Actions that remain below the scrolling content (React `Page.Footer`). */
|
|
90
148
|
export const PageFooter = defineComponent({
|
|
91
149
|
name: "PageFooter",
|
|
92
|
-
|
|
93
|
-
|
|
150
|
+
props: { background: { type: String, default: "glass" } },
|
|
151
|
+
setup(props, { slots }) {
|
|
152
|
+
const element = ref(null);
|
|
153
|
+
const { footerHeight } = injectPageContext("PageFooter");
|
|
154
|
+
const boundary = useFloatingBoundaryRegistration();
|
|
155
|
+
const setFooter = (node) => {
|
|
156
|
+
element.value = node instanceof HTMLElement ? node : null;
|
|
157
|
+
boundary?.setFooter(node);
|
|
158
|
+
};
|
|
159
|
+
let observer;
|
|
160
|
+
onMounted(() => {
|
|
161
|
+
const footer = element.value;
|
|
162
|
+
if (!footer)
|
|
163
|
+
return;
|
|
164
|
+
const update = () => { footerHeight.value = footer.offsetHeight; };
|
|
165
|
+
update();
|
|
166
|
+
if (typeof ResizeObserver === "undefined")
|
|
167
|
+
return;
|
|
168
|
+
observer = new ResizeObserver(update);
|
|
169
|
+
observer.observe(footer, { box: "border-box" });
|
|
170
|
+
});
|
|
171
|
+
onBeforeUnmount(() => { observer?.disconnect(); footerHeight.value = 0; });
|
|
172
|
+
return () => h("div", { ref: setFooter, class: s.Footer, "data-background": props.background }, [
|
|
94
173
|
h("div", { class: s.FooterContent }, slots.default?.()),
|
|
95
174
|
]);
|
|
96
175
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Page.js","sourceRoot":"","sources":["../../../../src/components/Page/Page.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,CAAC,EACD,MAAM,EACN,UAAU,EACV,OAAO,EACP,GAAG,GAKJ,MAAM,KAAK,CAAA;AACZ,OAAO,CAAC,MAAM,gDAAgD,CAAA;AAQ9D,gEAAgE;AAChE,MAAM,cAAc,GAAG,CAAC,CAAA;AAExB,MAAM,YAAY,GAA+B,MAAM,CAAC,MAAM,CAAC,CAAA;AAE/D,SAAS,iBAAiB,CAAC,IAAY;IACrC,MAAM,QAAQ,GAAG,MAAM,CAAC,YAAY,EAAE,IAAI,CAAC,CAAA;IAC3C,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,2BAA2B,CAAC,CAAA;IACrD,CAAC;IACD,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED,MAAM,aAAa,GAAG,eAAe,CAAC;IACpC,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE;QACL;;;;;;WAMG;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,MAAM,QAAQ,GAAG,CAAC,KAAY,EAAE,EAAE;YAChC,QAAQ,CAAC,KAAK,GAAI,KAAK,CAAC,aAA6B,CAAC,SAAS,GAAG,cAAc,CAAA;QAClF,CAAC,CAAA;QAED,OAAO,GAAG,EAAE,CACV,CAAC,CACC,KAAK,EACL,UAAU,CACR,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,QAAQ,EAAE,EAC1E,KAAK,CACN,EACD,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CACnD,CAAA;IACL,CAAC;CACF,CAAC,CAAA;AAEF,6EAA6E;AAC7E,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,CAAC;IACxC,IAAI,EAAE,YAAY;IAClB,KAAK,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE;QACrB,OAAO,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE;YACzC,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,aAAa,EAAE,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;SACxD,CAAC,CAAA;IACJ,CAAC;CACF,CAAC,CAAA","sourcesContent":["import {\n computed,\n defineComponent,\n h,\n inject,\n mergeProps,\n provide,\n ref,\n type HTMLAttributes,\n type InjectionKey,\n type PropType,\n type Ref,\n} from \"vue\"\nimport s from \"@plexui/styles/components/Page/Page.module.css\"\n\n// Vue port of packages/ui/src/components/Page/Page.tsx. Exports are flat\n// (`PageHeader` for `Page.Header`, ...). As in React, caller attributes are\n// applied after the page's own (`class` is merged), so they win.\n\nexport type PageWidth = \"full\" | \"wide\" | \"column\"\n\n// A trackpad's small settle at the top must not flash the line.\nconst SCROLLED_AFTER = 4\n\nconst PAGE_CONTEXT: InjectionKey<Ref<boolean>> = Symbol(\"Page\")\n\nfunction injectPageContext(part: string): Ref<boolean> {\n const scrolled = inject(PAGE_CONTEXT, null)\n if (!scrolled) {\n throw new Error(`${part} must be used within Page`)\n }\n return scrolled\n}\n\nconst PageComponent = defineComponent({\n name: \"Page\",\n props: {\n /**\n * Width of the column that header and content share: `\"full\"` (edge to\n * edge, for tables), `\"wide\"` (1280px, centred, for overviews) or `\"column\"`\n * (768px, centred, for settings and forms). Set `--page-width` on the page\n * for any other width.\n * @default \"full\"\n */\n width: { type: String as PropType<PageWidth>, default: \"full\" },\n },\n setup(props, { slots }) {\n provide(PAGE_CONTEXT, ref(false))\n\n return () => h(\"div\", { \"class\": s.Page, \"data-width\": props.width }, slots.default?.())\n },\n})\n\n/** Props of `Page`. */\nexport type PageProps = { width?: PageWidth } & HTMLAttributes\n\nexport const Page = PageComponent as typeof PageComponent & { new (): { $props: PageProps } }\n\n/** The band above the content, one column with it (React `Page.Header`). */\nexport const PageHeader = defineComponent({\n name: \"PageHeader\",\n props: {\n /**\n * Shows the line, and the glass on a phone, once the content has scrolled\n * under the header. Turn it off when the content already draws a line of\n * its own at that place.\n * @default true\n */\n divider: { type: Boolean, default: true },\n },\n setup(props, { slots }) {\n const scrolled = injectPageContext(\"PageHeader\")\n const line = computed(() => props.divider && scrolled.value)\n\n return () =>\n h(\"div\", { \"class\": s.Header, \"data-scrolled\": line.value ? \"\" : undefined }, [\n h(\"div\", { class: s.Head }, slots.default?.()),\n ])\n },\n})\n\nfunction part(name: string, tag: string, className: string) {\n return defineComponent({\n name,\n setup(_, { slots }) {\n return () => h(tag, { class: className }, slots.default?.())\n },\n })\n}\n\n/** The row of the title and the actions (React `Page.Bar`). */\nexport const PageBar = part(\"PageBar\", \"div\", s.Bar)\n/** Title with what stands beside it, a subtitle under it on a phone (React `Page.Heading`). */\nexport const PageHeading = part(\"PageHeading\", \"div\", s.Heading)\n/** Page heading, an `<h1>` (React `Page.Title`). */\nexport const PageTitle = part(\"PageTitle\", \"h1\", s.Title)\n/** Status of the page, a `<p>` (React `Page.Subtitle`). */\nexport const PageSubtitle = part(\"PageSubtitle\", \"p\", s.Subtitle)\n/** Buttons on the trailing side of the bar (React `Page.Actions`). */\nexport const PageActions = part(\"PageActions\", \"div\", s.Actions)\n\n/** The part of the page that scrolls (React `Page.Content`). */\nexport const PageContent = defineComponent({\n name: \"PageContent\",\n inheritAttrs: false,\n props: {\n /**\n * The content fills the page and scrolls inside itself, as a table does:\n * the page stops scrolling from 768px up.\n * @default false\n */\n fill: { type: Boolean, default: false },\n },\n setup(props, { attrs, slots }) {\n const scrolled = injectPageContext(\"PageContent\")\n\n const onScroll = (event: Event) => {\n scrolled.value = (event.currentTarget as HTMLElement).scrollTop > SCROLLED_AFTER\n }\n\n return () =>\n h(\n \"div\",\n mergeProps(\n { \"class\": s.Content, \"data-fill\": props.fill ? \"\" : undefined, onScroll },\n attrs,\n ),\n [h(\"div\", { class: s.Column }, slots.default?.())],\n )\n },\n})\n\n/** Actions that remain below the scrolling content (React `Page.Footer`). */\nexport const PageFooter = defineComponent({\n name: \"PageFooter\",\n setup(_props, { slots }) {\n return () => h(\"div\", { class: s.Footer }, [\n h(\"div\", { class: s.FooterContent }, slots.default?.()),\n ])\n },\n})\n\n/** Props of the Page parts: native attributes of their element. */\nexport type PageSlotProps = HTMLAttributes\n"]}
|
|
1
|
+
{"version":3,"file":"Page.js","sourceRoot":"","sources":["../../../../src/components/Page/Page.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,CAAC,EACD,MAAM,EACN,UAAU,EACV,SAAS,EACT,eAAe,EACf,OAAO,EACP,GAAG,GAKJ,MAAM,KAAK,CAAA;AACZ,OAAO,EAAE,4BAA4B,EAAE,+BAA+B,EAAE,MAAM,0CAA0C,CAAA;AACxH,OAAO,EAAE,YAAY,EAAyB,MAAM,uBAAuB,CAAA;AAC3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KAAK,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,iBAAiB,EAAE,KAAK,CAAC,UAAU,EAAE,EAAE;YAC9F,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,aAAa,EAAE,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;SACxD,CAAC,CAAA;IACJ,CAAC;CACF,CAAC,CAAA","sourcesContent":["import {\n defineComponent,\n h,\n inject,\n mergeProps,\n onMounted,\n onBeforeUnmount,\n provide,\n ref,\n type HTMLAttributes,\n type InjectionKey,\n type PropType,\n type Ref,\n} from \"vue\"\nimport { provideFloatingBoundaryScope, useFloatingBoundaryRegistration } from \"../../composables/useFloatingBoundary.js\"\nimport { TOOLBAR_HOST, type ToolbarPlacement } from \"../Toolbar/Toolbar.js\"\nimport s from \"@plexui/styles/components/Page/Page.module.css\"\n\n// Vue port of packages/ui/src/components/Page/Page.tsx. Exports are flat\n// (`PageHeader` for `Page.Header`, ...). As in React, caller attributes are\n// applied after the page's own (`class` is merged), so they win.\n\nexport type PageBarBackground = \"glass\" | \"solid\"\n\nexport type PageWidth = \"full\" | \"wide\" | \"column\"\n\n// A trackpad's small settle at the top must not flash the line.\nconst SCROLLED_AFTER = 4\n\ntype PageContext = { scrolled: Ref<boolean>; footerHeight: Ref<number>; headerHeight: Ref<number | undefined> }\nconst PAGE_CONTEXT: InjectionKey<PageContext> = Symbol(\"Page\")\n\nfunction injectPageContext(part: string): PageContext {\n const scrolled = inject(PAGE_CONTEXT, null)\n if (!scrolled) {\n throw new Error(`${part} must be used within Page`)\n }\n return scrolled\n}\n\nconst PageComponent = defineComponent({\n name: \"Page\",\n props: {\n /**\n * Width of the column that header and content share: `\"full\"` (edge to\n * edge, for tables), `\"wide\"` (1280px, centred, for overviews) or `\"column\"`\n * (768px, centred, for settings and forms). Set `--page-width` on the page\n * for any other width.\n * @default \"full\"\n */\n width: { type: String as PropType<PageWidth>, default: \"full\" },\n /** Mobile canvas and grouped-field palette. @default \"plain\" */\n surface: { type: String as PropType<\"plain\" | \"grouped\">, default: \"plain\" },\n },\n setup(props, { slots }) {\n const boundary = provideFloatingBoundaryScope()\n const context = { scrolled: ref(false), footerHeight: ref(0), headerHeight: ref<number>() }\n provide(PAGE_CONTEXT, context)\n // A phone Toolbar replaces the header and footer bars; it reports its own heights.\n const toolbarTop = ref<number>()\n const toolbarBottom = ref<number>()\n provide(TOOLBAR_HOST, {\n kind: \"page\",\n scrolled: context.scrolled,\n setHeight: (placement: ToolbarPlacement, height: number | undefined) => { (placement === \"top\" ? toolbarTop : toolbarBottom).value = height },\n })\n return () => h(\"div\", { \"ref\": boundary.setRoot, \"class\": s.Page, \"data-width\": props.width, \"data-surface\": props.surface,\n style: {\n \"--page-footer-height\": `${context.footerHeight.value}px`,\n ...(context.headerHeight.value !== undefined ? { \"--page-header-height\": `${context.headerHeight.value}px` } : {}),\n ...(toolbarTop.value !== undefined ? { \"--page-toolbar-height\": `${toolbarTop.value}px` } : {}),\n ...(toolbarBottom.value !== undefined ? { \"--page-toolbar-bottom-height\": `${toolbarBottom.value}px` } : {}),\n } }, slots.default?.())\n },\n})\n\n/** Props of `Page`. */\nexport type PageProps = { width?: PageWidth; surface?: \"plain\" | \"grouped\" } & HTMLAttributes\n\nexport const Page = PageComponent as typeof PageComponent & { new (): { $props: PageProps } }\n\n/** The band above the content, one column with it (React `Page.Header`). */\nexport const PageHeader = defineComponent({\n name: \"PageHeader\",\n props: {\n /**\n * Shows a divider once the content has scrolled under the header.\n * Turn it off when the content already draws a line of\n * its own at that place.\n * @default true\n */\n divider: { type: Boolean, default: true },\n background: { type: String as PropType<PageBarBackground>, default: \"glass\" },\n },\n setup(props, { slots }) {\n const { scrolled, headerHeight } = injectPageContext(\"PageHeader\")\n const element = ref<HTMLElement | null>(null)\n let observer: ResizeObserver | undefined\n onMounted(() => {\n const header = element.value\n if (!header) return\n const update = () => { headerHeight.value = header.offsetHeight }\n update()\n observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n observer?.observe(header, { box: \"border-box\" })\n })\n onBeforeUnmount(() => { observer?.disconnect(); headerHeight.value = undefined })\n\n return () =>\n h(\"div\", { \"ref\": element, \"class\": s.Header, \"data-background\": props.background, \"data-scrolled\": scrolled.value ? \"\" : undefined, \"data-divider\": props.divider ? \"\" : undefined }, [\n h(\"div\", { class: s.Head }, slots.default?.()),\n ])\n },\n})\n\nfunction part(name: string, tag: string, className: string) {\n return defineComponent({\n name,\n setup(_, { slots }) {\n return () => h(tag, { class: className }, slots.default?.())\n },\n })\n}\n\n/** The row of the title and the actions (React `Page.Bar`). */\nexport const PageBar = defineComponent({\n name: \"PageBar\",\n setup(_, { slots }) {\n const element = ref<HTMLElement | null>(null)\n let observer: ResizeObserver | undefined\n let children: MutationObserver | undefined\n onMounted(() => {\n const bar = element.value\n if (!bar) return\n const sides = () => bar.querySelectorAll<HTMLElement>(`:scope > .${s.Leading}, :scope > .${s.Actions}`)\n const update = () => {\n const width = Math.max(44, ...Array.from(sides(), (side) => side.offsetWidth))\n bar.style.setProperty(\"--page-bar-side-width\", `${width}px`)\n }\n observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n const observeSides = () => { observer?.disconnect(); sides().forEach((side) => observer?.observe(side, { box: \"border-box\" })); update() }\n observeSides()\n children = new MutationObserver(observeSides)\n children.observe(bar, { childList: true })\n })\n onBeforeUnmount(() => { observer?.disconnect(); children?.disconnect() })\n return () => h(\"div\", { ref: element, class: s.Bar }, slots.default?.())\n },\n})\n/** Navigation controls on the leading side (React `Page.Leading`). */\nexport const PageLeading = part(\"PageLeading\", \"div\", s.Leading)\n/** Title with what stands beside it, a subtitle under it on a phone (React `Page.Heading`). */\nexport const PageHeading = part(\"PageHeading\", \"div\", s.Heading)\n/** Page heading, an `<h1>` (React `Page.Title`). */\nexport const PageTitle = part(\"PageTitle\", \"h1\", s.Title)\n/** Status of the page, a flow container for badges and text (React `Page.Subtitle`). */\nexport const PageSubtitle = part(\"PageSubtitle\", \"div\", s.Subtitle)\n/** Buttons on the trailing side of the bar (React `Page.Actions`). */\nexport const PageActions = part(\"PageActions\", \"div\", s.Actions)\n\n/** The part of the page that scrolls (React `Page.Content`). */\nexport const PageContent = defineComponent({\n name: \"PageContent\",\n inheritAttrs: false,\n props: {\n /**\n * The content fills the page and scrolls inside itself, as a table does:\n * the page stops scrolling from 768px up.\n * @default false\n */\n fill: { type: Boolean, default: false },\n },\n setup(props, { attrs, slots }) {\n const { scrolled } = injectPageContext(\"PageContent\")\n\n const onScroll = (event: Event) => {\n scrolled.value = (event.currentTarget as HTMLElement).scrollTop > SCROLLED_AFTER\n }\n\n return () =>\n h(\n \"div\",\n mergeProps(\n { \"class\": s.Content, \"data-fill\": props.fill ? \"\" : undefined, onScroll },\n attrs,\n ),\n [h(\"div\", { class: s.Column }, slots.default?.())],\n )\n },\n})\n\n/** Actions that remain below the scrolling content (React `Page.Footer`). */\nexport const PageFooter = defineComponent({\n name: \"PageFooter\",\n props: { background: { type: String as PropType<PageBarBackground>, default: \"glass\" } },\n setup(props, { slots }) {\n const element = ref<HTMLElement | null>(null)\n const { footerHeight } = injectPageContext(\"PageFooter\")\n const boundary = useFloatingBoundaryRegistration()\n const setFooter = (node: unknown) => {\n element.value = node instanceof HTMLElement ? node : null\n boundary?.setFooter(node)\n }\n let observer: ResizeObserver | undefined\n onMounted(() => {\n const footer = element.value\n if (!footer) return\n const update = () => { footerHeight.value = footer.offsetHeight }\n update()\n if (typeof ResizeObserver === \"undefined\") return\n observer = new ResizeObserver(update)\n observer.observe(footer, { box: \"border-box\" })\n })\n onBeforeUnmount(() => { observer?.disconnect(); footerHeight.value = 0 })\n return () => h(\"div\", { ref: setFooter, class: s.Footer, \"data-background\": props.background }, [\n h(\"div\", { class: s.FooterContent }, slots.default?.()),\n ])\n },\n})\n\n/** Props of the Page parts: native attributes of their element. */\nexport type PageSlotProps = HTMLAttributes\n\nexport type PageFooterProps = PageSlotProps & { background?: PageBarBackground }\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Page, PageActions, PageBar, PageContent, PageFooter, PageHeader, PageHeading, PageSubtitle, PageTitle, } from "./Page.js";
|
|
1
|
+
export { Page, PageActions, PageBar, PageContent, PageFooter, PageHeader, PageHeading, PageLeading, PageSubtitle, PageTitle, } from "./Page.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Page/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,WAAW,EACX,OAAO,EACP,WAAW,EACX,UAAU,EACV,UAAU,EACV,WAAW,EACX,YAAY,EACZ,SAAS,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Page/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,WAAW,EACX,OAAO,EACP,WAAW,EACX,UAAU,EACV,UAAU,EACV,WAAW,EACX,WAAW,EACX,YAAY,EACZ,SAAS,GAMV,MAAM,WAAW,CAAA","sourcesContent":["export {\n Page,\n PageActions,\n PageBar,\n PageContent,\n PageFooter,\n PageHeader,\n PageHeading,\n PageLeading,\n PageSubtitle,\n PageTitle,\n type PageProps,\n type PageFooterProps,\n type PageBarBackground,\n type PageSlotProps,\n type PageWidth,\n} from \"./Page.js\"\n"]}
|