@plexui/vue 0.21.0 → 0.23.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/Alert/Alert.js +16 -4
- package/dist/es/components/Alert/Alert.js.map +1 -1
- package/dist/es/components/ColorPicker/ColorPicker.js +13 -9
- package/dist/es/components/ColorPicker/ColorPicker.js.map +1 -1
- package/dist/es/components/ColorPicker/ColorWell.js +5 -3
- package/dist/es/components/ColorPicker/ColorWell.js.map +1 -1
- package/dist/es/components/ColorPicker/shared.js +5 -4
- package/dist/es/components/ColorPicker/shared.js.map +1 -1
- package/dist/es/components/ContextMenu/ContextMenu.js +9 -9
- package/dist/es/components/ContextMenu/ContextMenu.js.map +1 -1
- package/dist/es/components/ContextMenu/shared.js +25 -5
- package/dist/es/components/ContextMenu/shared.js.map +1 -1
- package/dist/es/components/DataTable/columnHelpers.js +88 -6
- package/dist/es/components/DataTable/columnHelpers.js.map +1 -1
- package/dist/es/components/DatePicker/DatePicker.js +3 -3
- package/dist/es/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/es/components/DatePicker/useCalendarCollisionPadding.js +25 -0
- package/dist/es/components/DatePicker/useCalendarCollisionPadding.js.map +1 -0
- package/dist/es/components/DateRangePicker/DateRangePicker.js +3 -3
- package/dist/es/components/DateRangePicker/DateRangePicker.js.map +1 -1
- package/dist/es/components/Dialog/Dialog.js +2 -2
- package/dist/es/components/Dialog/Dialog.js.map +1 -1
- package/dist/es/components/Input/Input.js +3 -0
- package/dist/es/components/Input/Input.js.map +1 -1
- package/dist/es/components/Menu/Menu.js +10 -1
- package/dist/es/components/Menu/Menu.js.map +1 -1
- package/dist/es/components/PhoneLayout/PhoneLayout.js +9 -1
- package/dist/es/components/PhoneLayout/PhoneLayout.js.map +1 -1
- package/dist/es/components/Popover/Popover.js +2 -2
- package/dist/es/components/Popover/Popover.js.map +1 -1
- package/dist/es/components/ProgressSteps/ProgressSteps.js +7 -3
- package/dist/es/components/ProgressSteps/ProgressSteps.js.map +1 -1
- package/dist/es/components/ProgressSteps/index.js.map +1 -1
- package/dist/es/components/Select/Select.js +178 -32
- package/dist/es/components/Select/Select.js.map +1 -1
- package/dist/es/components/SelectControl/SelectControl.js +3 -1
- package/dist/es/components/SelectControl/SelectControl.js.map +1 -1
- package/dist/es/components/Slider/Slider.js +24 -11
- package/dist/es/components/Slider/Slider.js.map +1 -1
- package/dist/es/components/Slider/sliderPrimitive.js +5 -2
- package/dist/es/components/Slider/sliderPrimitive.js.map +1 -1
- package/dist/es/components/Sortable/Sortable.js +1 -1
- package/dist/es/components/Sortable/Sortable.js.map +1 -1
- package/dist/es/components/StatCard/index.js +4 -1
- package/dist/es/components/StatCard/index.js.map +1 -1
- package/dist/es/components/{StatCard/StatCard.js → StatsCard/StatsCard.js} +32 -27
- package/dist/es/components/StatsCard/StatsCard.js.map +1 -0
- package/dist/es/components/StatsCard/index.js +2 -0
- package/dist/es/components/StatsCard/index.js.map +1 -0
- package/dist/es/components/SwipeActions/SwipeActions.js +32 -5
- package/dist/es/components/SwipeActions/SwipeActions.js.map +1 -1
- package/dist/es/components/TabBar/TabBar.js +52 -21
- package/dist/es/components/TabBar/TabBar.js.map +1 -1
- package/dist/es/components/Tabs/Tabs.js +229 -6
- package/dist/es/components/Tabs/Tabs.js.map +1 -1
- package/dist/es/components/Toolbar/Toolbar.js.map +1 -1
- package/dist/es/lib/menuTriggerCover.js +40 -3
- package/dist/es/lib/menuTriggerCover.js.map +1 -1
- package/dist/types/components/ColorPicker/ColorPicker.d.ts +3 -2
- package/dist/types/components/ColorPicker/shared.d.ts +5 -4
- package/dist/types/components/ContextMenu/shared.d.ts +28 -6
- package/dist/types/components/DatePicker/useCalendarCollisionPadding.d.ts +9 -0
- package/dist/types/components/Dialog/Dialog.d.ts +2 -2
- package/dist/types/components/PhoneLayout/PhoneLayout.d.ts +5 -0
- package/dist/types/components/Popover/Popover.d.ts +5 -5
- package/dist/types/components/ProgressSteps/ProgressSteps.d.ts +17 -3
- package/dist/types/components/ProgressSteps/index.d.ts +1 -1
- package/dist/types/components/Select/Select.d.ts +19 -8
- package/dist/types/components/StatCard/index.d.ts +9 -1
- package/dist/types/components/{StatCard/StatCard.d.ts → StatsCard/StatsCard.d.ts} +19 -19
- package/dist/types/components/StatsCard/index.d.ts +1 -0
- package/dist/types/components/SwipeActions/SwipeActions.d.ts +4 -4
- package/dist/types/components/TabBar/TabBar.d.ts +34 -0
- package/dist/types/components/Tabs/Tabs.d.ts +33 -2
- package/dist/types/components/Toolbar/Toolbar.d.ts +1 -1
- package/dist/types/lib/menuTriggerCover.d.ts +16 -2
- package/package.json +2 -2
- package/dist/es/components/DatePicker/useCalendarGutter.js +0 -14
- package/dist/es/components/DatePicker/useCalendarGutter.js.map +0 -1
- package/dist/es/components/StatCard/StatCard.js.map +0 -1
- package/dist/types/components/DatePicker/useCalendarGutter.d.ts +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwipeActions.js","sourceRoot":"","sources":["../../../../src/components/SwipeActions/SwipeActions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,EAAE,eAAe,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAiC,MAAM,KAAK,CAAA;AACpI,OAAO,CAAC,MAAM,gEAAgE,CAAA;AA8B9E,gGAAgG;AAChG,MAAM,IAAI,GAAG,EAAE,CAAA;AAEf,uGAAuG;AACvG,MAAM,UAAU,GAA0B,EAAE,GAAG,EAAE,YAAY,EAAE,CAAA;AAE/D,uDAAuD;AACvD,MAAM,QAAQ,GAAG,4FAA4F,CAAA;AAgB7G,iFAAiF;AACjF,IAAI,YAAY,GAAwB,IAAI,CAAA;AAE5C,6HAA6H;AAC7H,MAAM,OAAO,GAAG,CAAC,OAAgB,EAAE,SAAiB,EAAE,EAAE;IACtD,IAAI,CAAC;QACH,OAAO,CAAC,iBAAiB,EAAE,CAAC,SAAS,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B,sBAAsB,EAAE,KAAK,CAAC,cAAc;YAC5C,eAAe,EAAE,QAAQ,CAAC,KAAK;YAC/B,cAAc,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;YAC9C,WAAW,EAAE,aAAa;YAC1B,YAAY,EAAE,cAAc;SAC7B,EAAE;YACD,UAAU,CAAC,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC;YACpC,CAAC,CAAC,KAAK,EAAE;gBACP,OAAO,EAAE,CAAC,CAAC,OAAO;gBAClB,oBAAoB,EAAE,EAAE;gBACxB,OAAO,EAAE,MAAM,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,wBAAwB,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS;gBACvH,eAAe,EAAE,iBAAiB;gBAClC,eAAe,EAAE,iBAAiB;gBAClC,sBAAsB,EAAE,wBAAwB;gBAChD,gBAAgB,EAAE,kBAAkB;aACrC,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;YACrB,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC;SACvC,CAAC,CAAA;IACJ,CAAC;CACF,CAAC,CAAA;AAOF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,qBAAqB,CAAA","sourcesContent":["import { computed, defineComponent, h, onBeforeUnmount, onMounted, onUpdated, ref, watch, type Component, type PropType } from \"vue\"\nimport s from \"@plexui/styles/components/SwipeActions/SwipeActions.module.css\"\n\n// Vue port of packages/ui/src/components/SwipeActions/SwipeActions.tsx: the same row, sides, gesture, full swipe,\n// keys and focus. The content of the row is the default slot; an action's `Icon` is a component, as in Select.\n\nexport type SwipeActionColor =\n | \"primary\"\n | \"secondary\"\n | \"danger\"\n | \"success\"\n | \"info\"\n | \"discovery\"\n | \"caution\"\n | \"warning\"\n\nexport type SwipeAction = {\n /** Unique ID of the action within its side */\n id: string\n /** Name of the action: shown with `labelPlacement` `\"inside\"` or `\"below\"` (and on an action without an icon), and its accessible name always */\n label: string\n /** Icon of the action */\n Icon?: Component\n /** Solid color of the action. @default \"secondary\" */\n color?: SwipeActionColor\n /** Called when the action is pressed, or by a full swipe when it is the first action of its side */\n onSelect?: () => void\n}\n\nexport type SwipeActionsSide = \"leading\" | \"trailing\"\n\n/** A finger has to travel this far, and farther across than down, before the row follows it. */\nconst SLOP = 10\n\n/** The width an open row moves by is the border box of its actions, edge and content gaps included. */\nconst BORDER_BOX: ResizeObserverOptions = { box: \"border-box\" }\n\n/** Controls that take a horizontal drag themselves. */\nconst OWN_DRAG = 'input, textarea, select, [contenteditable]:not([contenteditable=\"false\"]), [role=\"slider\"]'\n\ntype Gesture = {\n pointerId: number\n x: number\n y: number\n start: number\n /** Undecided while within the slop, then a swipe (true) or a scroll (false). */\n swiping: boolean | undefined\n rtl: boolean\n widths: Record<SwipeActionsSide, number>\n rowWidth: number\n /** Removes the listeners for the end of the gesture. */\n detach: () => void\n}\n\n/** The open row: opening another one closes it, as a list keeps one row open. */\nlet closeOpenRow: (() => void) | null = null\n\n/** The row keeps the finger past its edges; a pointer that is no longer active (it lifted between events) cannot be held. */\nconst capture = (element: Element, pointerId: number) => {\n try {\n element.setPointerCapture?.(pointerId)\n } catch {\n // The swipe goes on with the events the row still gets.\n }\n}\n\nconst sideOf = (offset: number): SwipeActionsSide | undefined =>\n offset > 0 ? \"leading\" : offset < 0 ? \"trailing\" : undefined\n\n/**\n * Where the content goes for a swipe of `raw` px toward the trailing edge (negative: toward the leading edge), and\n * whether that is a full swipe. A side without actions stays shut. Past its actions the content follows the finger\n * where a full swipe is allowed, and a third as fast where it is not; past the middle between the open actions and\n * the far edge of the row the swipe is full.\n */\nexport const swipeActionsOffset = (\n raw: number,\n widths: Record<SwipeActionsSide, number>,\n rowWidth: number,\n fullSwipe: boolean,\n): { offset: number; full: boolean } => {\n const side = sideOf(raw)\n const width = side ? widths[side] : 0\n if (!side || !(width > 0)) return { offset: 0, full: false }\n const sign = Math.sign(raw)\n const distance = Math.abs(raw)\n if (distance <= width) return { offset: raw, full: false }\n if (!fullSwipe) return { offset: sign * (width + (distance - width) / 3), full: false }\n const travel = Math.min(distance, Math.max(width, rowWidth))\n return { offset: sign * travel, full: travel >= (width + rowWidth) / 2 }\n}\n\nconst SwipeActionsComponent = defineComponent({\n name: \"SwipeActions\",\n inheritAttrs: false,\n props: {\n /** Actions revealed by a swipe toward the trailing edge, the first one at the leading edge */\n leading: { type: Array as PropType<SwipeAction[]>, default: () => [] },\n /** Actions revealed by a swipe toward the leading edge, the first one at the trailing edge */\n trailing: { type: Array as PropType<SwipeAction[]>, default: () => [] },\n /** Where the actions show their labels: `\"hidden\"` (symbols only), `\"inside\"` the capsule, or `\"below\"` it (for rows of 68px and taller). @default \"hidden\" */\n labelPlacement: { type: String as PropType<\"hidden\" | \"inside\" | \"below\">, default: \"hidden\" },\n /** A swipe past the middle between the open actions and the far edge runs the first action of that side. @default true */\n fullSwipe: { type: Boolean, default: true },\n },\n setup(props, { attrs, slots }) {\n const offset = ref(0)\n const full = ref(false)\n const swiping = ref(false)\n const rtl = ref(false)\n const root = ref<HTMLElement | null>(null)\n const sides: Record<SwipeActionsSide, HTMLElement | null> = { leading: null, trailing: null }\n let gesture: Gesture | null = null\n let suppressClick = false\n let observer: ResizeObserver | null = null\n const revealed = computed(() => sideOf(offset.value))\n\n const widthOf = (side: SwipeActionsSide) => sides[side]?.getBoundingClientRect().width ?? 0\n\n const isRtl = () => !!root.value && getComputedStyle(root.value).direction === \"rtl\"\n\n const move = (next: number, nextFull = false) => {\n offset.value = next\n full.value = nextFull\n }\n\n /** Lets go of the gesture: the listeners for its end go, and the row no longer follows the finger. */\n const release = () => {\n const state = gesture\n gesture = null\n state?.detach()\n return state\n }\n\n const close = () => {\n if (closeOpenRow === closer) closeOpenRow = null\n move(0)\n }\n\n /** One function for the life of the row, so the list knows which row is open; another row that opens ends this one's gesture too. */\n const closer = () => {\n const state = release()\n if (state) {\n swiping.value = false\n // The finger of the ended swipe still lifts over this row: its click is not a click on the content.\n if (state.swiping) suppressClick = true\n }\n close()\n }\n\n /** This row takes the place of the open one. */\n const claim = () => {\n if (closeOpenRow && closeOpenRow !== closer) closeOpenRow()\n closeOpenRow = closer\n }\n\n /** Shows a side as wide as its actions (`width` when known), or closes the row when that side has none (any more). */\n const open = (side: SwipeActionsSide, width = widthOf(side)) => {\n if (!(width > 0)) return close()\n claim()\n rtl.value = isRtl()\n move(side === \"leading\" ? width : -width)\n }\n\n /** An open row follows its actions: more of them, other labels or another width move it to their new width. */\n const sync = () => {\n const side = sideOf(offset.value)\n if (!side || gesture?.swiping || full.value) return\n const width = widthOf(side)\n if (!(width > 0)) return close()\n const target = side === \"leading\" ? width : -width\n if (target !== offset.value) move(target)\n }\n\n // After each render, and whenever the actions change size, an open row takes their width.\n const observeSides = () => {\n for (const element of [sides.leading, sides.trailing]) if (element) observer?.observe(element, BORDER_BOX)\n }\n onMounted(() => {\n if (typeof ResizeObserver !== \"undefined\") observer = new ResizeObserver(sync)\n observeSides()\n })\n onUpdated(() => {\n sync()\n observeSides()\n })\n\n // A press anywhere outside the open row closes it.\n const handleOutsidePointerDown = (event: PointerEvent) => {\n if (event.target instanceof Node && root.value?.contains(event.target)) return\n close()\n }\n watch([revealed, swiping], ([side, moving]) => {\n document.removeEventListener(\"pointerdown\", handleOutsidePointerDown, true)\n if (side && !moving) document.addEventListener(\"pointerdown\", handleOutsidePointerDown, true)\n })\n\n // The open row lets go of the list, and of the finger, when it goes away.\n onBeforeUnmount(() => {\n document.removeEventListener(\"pointerdown\", handleOutsidePointerDown, true)\n observer?.disconnect()\n observer = null\n release()\n if (closeOpenRow === closer) closeOpenRow = null\n })\n\n const settle = (state: Gesture) => {\n const side = sideOf(offset.value)\n if (!side) return close()\n if (full.value) {\n (side === \"leading\" ? props.leading : props.trailing)[0]?.onSelect?.()\n return close()\n }\n // The widths from the start of the swipe: a full swipe may have stretched the actions since.\n if (Math.abs(offset.value) >= state.widths[side] / 2) open(side, state.widths[side])\n else close()\n }\n\n /** The finger lifted (anywhere): a swipe settles, a press on an open row closes it. */\n const finish = () => {\n const state = release()\n if (!state) return\n if (state.swiping) {\n suppressClick = true\n swiping.value = false\n settle(state)\n } else if (state.start !== 0) {\n if (state.swiping === undefined) suppressClick = true\n close()\n }\n }\n\n /** The browser took the gesture (a scroll) or the row lost the finger: the row goes back to where it was. */\n const cancel = () => {\n const state = release()\n if (!state) return\n swiping.value = false\n const side = sideOf(state.start)\n if (state.swiping && side) open(side, state.widths[side])\n else close()\n }\n\n const handlePointerDown = (event: PointerEvent) => {\n if (event.button !== 0 || gesture) return\n // A new press of the primary pointer starts clean: a swipe that another row ended and that was then cancelled leaves\n // no click to swallow. Another finger's press keeps it, as only the primary pointer clicks.\n if (event.isPrimary) suppressClick = false\n if (props.leading.length < 1 && props.trailing.length < 1) return\n // A drag in a text field or along a slider belongs to that control.\n if (event.target instanceof Element && event.target.closest(OWN_DRAG)) return\n const pointerId = event.pointerId\n // The end of the gesture is heard wherever the finger lifts, inside the row or not.\n const handleUp = (end: PointerEvent) => {\n if (end.pointerId === pointerId) finish()\n }\n const handleCancel = (end: PointerEvent) => {\n if (end.pointerId === pointerId) cancel()\n }\n window.addEventListener(\"pointerup\", handleUp, true)\n window.addEventListener(\"pointercancel\", handleCancel, true)\n gesture = {\n pointerId,\n x: event.clientX,\n y: event.clientY,\n start: offset.value,\n swiping: undefined,\n rtl: isRtl(),\n widths: { leading: widthOf(\"leading\"), trailing: widthOf(\"trailing\") },\n rowWidth: root.value?.clientWidth ?? 0,\n detach: () => {\n window.removeEventListener(\"pointerup\", handleUp, true)\n window.removeEventListener(\"pointercancel\", handleCancel, true)\n },\n }\n }\n\n const handlePointerMove = (event: PointerEvent) => {\n const state = gesture\n if (!state || state.pointerId !== event.pointerId || state.swiping === false) return\n const across = (event.clientX - state.x) * (state.rtl ? -1 : 1)\n const down = event.clientY - state.y\n if (state.swiping === undefined) {\n if (Math.abs(across) < SLOP && Math.abs(down) < SLOP) return\n if (Math.abs(across) <= Math.abs(down)) {\n state.swiping = false\n return\n }\n state.swiping = true\n const target = event.currentTarget\n if (target instanceof Element) capture(target, event.pointerId)\n window.getSelection?.()?.removeAllRanges()\n claim()\n rtl.value = state.rtl\n swiping.value = true\n }\n const next = swipeActionsOffset(state.start + across, state.widths, state.rowWidth, props.fullSwipe)\n move(next.offset, next.full)\n }\n\n /** The content lost the finger it held. A child that loses the finger to the content (as a touch moves its implicit capture) ends nothing. */\n const handleLostPointerCapture = (event: PointerEvent) => {\n if (event.target === event.currentTarget && gesture?.pointerId === event.pointerId) cancel()\n }\n\n /** A swipe or a press that closed the row is not a click on the content; a click from the keys still is. */\n const handleClickCapture = (event: MouseEvent) => {\n if (!suppressClick || event.detail === 0) return\n suppressClick = false\n event.preventDefault()\n event.stopPropagation()\n }\n\n /** The focus on an action shows its side; on the content it closes the row. */\n const handleFocusIn = (event: FocusEvent) => {\n if (gesture?.swiping) return\n const target = event.target\n const side = ([\"leading\", \"trailing\"] as const).find((name) => target instanceof Node && !!sides[name]?.contains(target))\n if (side) {\n if (sideOf(offset.value) !== side) open(side)\n } else if (offset.value !== 0) {\n close()\n }\n }\n\n const handleFocusOut = (event: FocusEvent) => {\n if (gesture?.swiping) return\n if (event.relatedTarget instanceof Node && root.value?.contains(event.relatedTarget)) return\n if (offset.value !== 0) close()\n }\n\n const select = (action: SwipeAction, event: MouseEvent) => {\n action.onSelect?.()\n // A press closes the row, as iOS does. From the keys the action keeps the focus, so its side stays open until\n // the focus leaves the row.\n if (event.detail === 0) return\n const target = event.currentTarget\n if (target instanceof HTMLElement) target.blur()\n close()\n }\n\n const renderSide = (side: SwipeActionsSide, actions: SwipeAction[]) => {\n if (actions.length < 1) return null\n const shown = side === \"leading\" ? actions : [...actions].reverse()\n const isFull = full.value && revealed.value === side\n return h(\"div\", {\n \"ref\": (element: unknown) => {\n sides[side] = element instanceof HTMLElement ? element : null\n },\n \"class\": s.Actions,\n \"data-side\": side,\n \"data-full\": isFull ? \"\" : undefined,\n \"style\": isFull ? { width: `${Math.abs(offset.value)}px` } : undefined,\n }, shown.map((action) => {\n const color = action.color ?? \"secondary\"\n const labelInside = props.labelPlacement === \"inside\" || !action.Icon\n const labelBelow = props.labelPlacement === \"below\" && !!action.Icon\n return h(\"button\", {\n \"key\": action.id,\n \"type\": \"button\",\n \"class\": s.Action,\n \"data-color\": color,\n \"data-first\": action === actions[0] ? \"\" : undefined,\n \"aria-label\": labelInside || labelBelow ? undefined : action.label,\n \"onClick\": (event: MouseEvent) => select(action, event),\n }, [\n h(\"span\", { class: s.Capsule }, [\n action.Icon ? h(action.Icon, { \"class\": s.Icon, \"aria-hidden\": \"true\" }) : null,\n labelInside ? h(\"span\", { class: s.Label }, action.label) : null,\n ]),\n labelBelow ? h(\"span\", { class: s.Caption }, action.label) : null,\n ])\n }))\n }\n\n return () => h(\"div\", {\n ...attrs,\n \"ref\": root,\n \"class\": [s.SwipeActions, attrs.class],\n \"data-row\": \"\",\n \"data-swipe-actions\": \"\",\n \"data-label-placement\": props.labelPlacement,\n \"data-revealed\": revealed.value,\n \"data-swiping\": swiping.value ? \"\" : undefined,\n \"onFocusin\": handleFocusIn,\n \"onFocusout\": handleFocusOut,\n }, [\n renderSide(\"leading\", props.leading),\n h(\"div\", {\n \"class\": s.Content,\n \"data-swipe-content\": \"\",\n \"style\": offset.value !== 0 ? { \"--swipe-actions-offset\": `${rtl.value ? -offset.value : offset.value}px` } : undefined,\n \"onPointerdown\": handlePointerDown,\n \"onPointermove\": handlePointerMove,\n \"onLostpointercapture\": handleLostPointerCapture,\n \"onClickCapture\": handleClickCapture,\n }, slots.default?.()),\n renderSide(\"trailing\", props.trailing),\n ])\n },\n})\n\ntype SwipeActionsOwnProps = InstanceType<typeof SwipeActionsComponent>[\"$props\"]\n\n/** SwipeActions props. */\nexport type SwipeActionsProps = SwipeActionsOwnProps\n\n/**\n * Actions behind a row of a list, as the swipe actions of an iOS list: a swipe toward the leading edge reveals the\n * trailing actions, a swipe toward the trailing edge the leading ones, and a full swipe runs the first action of\n * that side. The row is a `data-row` of a FieldGroup. Each action is also a button in the order of the screen, and\n * the focus on one shows its side.\n */\nexport const SwipeActions = SwipeActionsComponent\n"]}
|
|
1
|
+
{"version":3,"file":"SwipeActions.js","sourceRoot":"","sources":["../../../../src/components/SwipeActions/SwipeActions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,EAAE,eAAe,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAiC,MAAM,KAAK,CAAA;AACpI,OAAO,CAAC,MAAM,gEAAgE,CAAA;AA8B9E,gGAAgG;AAChG,MAAM,IAAI,GAAG,EAAE,CAAA;AAEf,uGAAuG;AACvG,MAAM,UAAU,GAA0B,EAAE,GAAG,EAAE,YAAY,EAAE,CAAA;AAE/D,uDAAuD;AACvD,MAAM,QAAQ,GAAG,4FAA4F,CAAA;AAgB7G,iFAAiF;AACjF,IAAI,YAAY,GAAwB,IAAI,CAAA;AAE5C,6HAA6H;AAC7H,MAAM,OAAO,GAAG,CAAC,OAAgB,EAAE,SAAiB,EAAE,EAAE;IACtD,IAAI,CAAC;QACH,OAAO,CAAC,iBAAiB,EAAE,CAAC,SAAS,CAAC,CAAA;IACxC,CAAC;IAAC,MAAM,CAAC;QACP,wDAAwD;IAC1D,CAAC;AACH,CAAC,CAAA;AAED,MAAM,MAAM,GAAG,CAAC,MAAc,EAAgC,EAAE,CAC9D,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAA;AAE9D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CACh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E,wBAAwB,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS;gBACvH,eAAe,EAAE,iBAAiB;gBAClC,eAAe,EAAE,iBAAiB;gBAClC,sBAAsB,EAAE,wBAAwB;gBAChD,gBAAgB,EAAE,kBAAkB;aACrC,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;YACrB,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC;SACvC,CAAC,CAAA;IACJ,CAAC;CACF,CAAC,CAAA;AAOF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,qBAAqB,CAAA","sourcesContent":["import { computed, defineComponent, h, onBeforeUnmount, onMounted, onUpdated, ref, watch, type Component, type PropType } from \"vue\"\nimport s from \"@plexui/styles/components/SwipeActions/SwipeActions.module.css\"\n\n// Vue port of packages/ui/src/components/SwipeActions/SwipeActions.tsx: the same row, sides, gesture, full swipe,\n// keys and focus. The content of the row is the default slot; an action's `Icon` is a component, as in Select.\n\nexport type SwipeActionColor =\n | \"primary\"\n | \"secondary\"\n | \"danger\"\n | \"success\"\n | \"info\"\n | \"discovery\"\n | \"caution\"\n | \"warning\"\n\nexport type SwipeAction = {\n /** Unique ID of the action within its side */\n id: string\n /** Name of the action: shown with `labelPlacement` `\"inside\"` or `\"below\"` (and on an action without an icon), and its accessible name always */\n label: string\n /** Icon of the action */\n Icon?: Component\n /** Solid color of the action. @default \"secondary\" */\n color?: SwipeActionColor\n /** Called when the action is pressed, or by a full swipe when it is the first action of its side */\n onSelect?: () => void\n}\n\nexport type SwipeActionsSide = \"leading\" | \"trailing\"\n\n/** A finger has to travel this far, and farther across than down, before the row follows it. */\nconst SLOP = 10\n\n/** The width an open row moves by is the border box of its actions, edge and content gaps included. */\nconst BORDER_BOX: ResizeObserverOptions = { box: \"border-box\" }\n\n/** Controls that take a horizontal drag themselves. */\nconst OWN_DRAG = 'input, textarea, select, [contenteditable]:not([contenteditable=\"false\"]), [role=\"slider\"]'\n\ntype Gesture = {\n pointerId: number\n x: number\n y: number\n start: number\n /** Undecided while within the slop, then a swipe (true) or a scroll (false). */\n swiping: boolean | undefined\n rtl: boolean\n widths: Record<SwipeActionsSide, number>\n rowWidth: number\n /** Removes the listeners for the end of the gesture. */\n detach: () => void\n}\n\n/** The open row: opening another one closes it, as a list keeps one row open. */\nlet closeOpenRow: (() => void) | null = null\n\n/** The row keeps the finger past its edges; a pointer that is no longer active (it lifted between events) cannot be held. */\nconst capture = (element: Element, pointerId: number) => {\n try {\n element.setPointerCapture?.(pointerId)\n } catch {\n // The swipe goes on with the events the row still gets.\n }\n}\n\nconst sideOf = (offset: number): SwipeActionsSide | undefined =>\n offset > 0 ? \"leading\" : offset < 0 ? \"trailing\" : undefined\n\n/**\n * Where the content goes for a swipe of `raw` px toward the trailing edge (negative: toward the leading edge), and\n * whether that is a full swipe. A side without actions stays shut. Past its actions the content follows the finger\n * where a full swipe is allowed, and a third as fast where it is not; past the middle between the open actions and\n * the far edge of the row the swipe is full.\n */\nexport const swipeActionsOffset = (\n raw: number,\n widths: Record<SwipeActionsSide, number>,\n rowWidth: number,\n fullSwipe: boolean,\n): { offset: number; full: boolean } => {\n const side = sideOf(raw)\n const width = side ? widths[side] : 0\n if (!side || !(width > 0)) return { offset: 0, full: false }\n const sign = Math.sign(raw)\n const distance = Math.abs(raw)\n if (distance <= width) return { offset: raw, full: false }\n if (!fullSwipe) return { offset: sign * (width + (distance - width) / 3), full: false }\n const travel = Math.min(distance, Math.max(width, rowWidth))\n return { offset: sign * travel, full: travel >= (width + rowWidth) / 2 }\n}\n\nconst SwipeActionsComponent = defineComponent({\n name: \"SwipeActions\",\n inheritAttrs: false,\n props: {\n /** Actions revealed by a swipe toward the trailing edge, the first one at the leading edge */\n leading: { type: Array as PropType<SwipeAction[]>, default: () => [] },\n /** Actions revealed by a swipe toward the leading edge, the first one at the trailing edge */\n trailing: { type: Array as PropType<SwipeAction[]>, default: () => [] },\n /** Where the actions show their labels: `\"hidden\"` (symbols only), `\"inside\"` the capsule, or `\"below\"` it (for rows of 60px and taller, as iOS sets them). @default \"hidden\" */\n labelPlacement: { type: String as PropType<\"hidden\" | \"inside\" | \"below\">, default: \"hidden\" },\n /** A swipe past the middle between the open actions and the far edge runs the first action of that side. @default true */\n fullSwipe: { type: Boolean, default: true },\n },\n setup(props, { attrs, slots }) {\n const offset = ref(0)\n const full = ref(false)\n const swiping = ref(false)\n const rtl = ref(false)\n const round = ref(false)\n const root = ref<HTMLElement | null>(null)\n const sides: Record<SwipeActionsSide, HTMLElement | null> = { leading: null, trailing: null }\n let gesture: Gesture | null = null\n let suppressClick = false\n let observer: ResizeObserver | null = null\n const revealed = computed(() => sideOf(offset.value))\n\n const widthOf = (side: SwipeActionsSide) => sides[side]?.getBoundingClientRect().width ?? 0\n\n const isRtl = () => !!root.value && getComputedStyle(root.value).direction === \"rtl\"\n\n const move = (next: number, nextFull = false) => {\n offset.value = next\n full.value = nextFull\n }\n\n /** Lets go of the gesture: the listeners for its end go, and the row no longer follows the finger. */\n const release = () => {\n const state = gesture\n gesture = null\n state?.detach()\n return state\n }\n\n const close = () => {\n if (closeOpenRow === closer) closeOpenRow = null\n move(0)\n }\n\n /** One function for the life of the row, so the list knows which row is open; another row that opens ends this one's gesture too. */\n const closer = () => {\n const state = release()\n if (state) {\n swiping.value = false\n // The finger of the ended swipe still lifts over this row: its click is not a click on the content.\n if (state.swiping) suppressClick = true\n }\n close()\n }\n\n /** This row takes the place of the open one. */\n const claim = () => {\n if (closeOpenRow && closeOpenRow !== closer) closeOpenRow()\n closeOpenRow = closer\n }\n\n /** Shows a side as wide as its actions (`width` when known), or closes the row when that side has none (any more). */\n const open = (side: SwipeActionsSide, width = widthOf(side)) => {\n if (!(width > 0)) return close()\n claim()\n rtl.value = isRtl()\n move(side === \"leading\" ? width : -width)\n }\n\n /** An open row follows its actions: more of them, other labels or another width move it to their new width. */\n const sync = () => {\n const side = sideOf(offset.value)\n if (!side || gesture?.swiping || full.value) return\n const width = widthOf(side)\n if (!(width > 0)) return close()\n const target = side === \"leading\" ? width : -width\n if (target !== offset.value) move(target)\n }\n\n /**\n * A symbol that has grown as tall as its circle (its max-height) is one, as iOS draws a circle from there. The\n * measure is a capsule that is laid out: a full swipe hides all but the first action of its side, and while none\n * is laid out the shape stays.\n */\n const fit = () => {\n const capsules = [...(root.value?.querySelectorAll<HTMLElement>('[data-shape=\"symbol\"] > :first-child') ?? [])]\n if (capsules.length < 1) {\n round.value = false\n return\n }\n const capsule = capsules.find((element) => element.getBoundingClientRect().height > 0)\n if (!capsule) return\n const max = parseFloat(getComputedStyle(capsule).maxHeight)\n round.value = max > 0 && capsule.getBoundingClientRect().height >= max - 0.5\n }\n\n // After each render, and whenever the actions change size, an open row takes their width and a symbol its shape.\n const observeSides = () => {\n for (const element of [sides.leading, sides.trailing]) if (element) observer?.observe(element, BORDER_BOX)\n }\n onMounted(() => {\n if (typeof ResizeObserver !== \"undefined\") observer = new ResizeObserver(() => {\n fit()\n sync()\n })\n fit()\n observeSides()\n })\n onUpdated(() => {\n fit()\n sync()\n observeSides()\n })\n\n // A press anywhere outside the open row closes it.\n const handleOutsidePointerDown = (event: PointerEvent) => {\n if (event.target instanceof Node && root.value?.contains(event.target)) return\n close()\n }\n watch([revealed, swiping], ([side, moving]) => {\n document.removeEventListener(\"pointerdown\", handleOutsidePointerDown, true)\n if (side && !moving) document.addEventListener(\"pointerdown\", handleOutsidePointerDown, true)\n })\n\n // The open row lets go of the list, and of the finger, when it goes away.\n onBeforeUnmount(() => {\n document.removeEventListener(\"pointerdown\", handleOutsidePointerDown, true)\n observer?.disconnect()\n observer = null\n release()\n if (closeOpenRow === closer) closeOpenRow = null\n })\n\n const settle = (state: Gesture) => {\n const side = sideOf(offset.value)\n if (!side) return close()\n if (full.value) {\n (side === \"leading\" ? props.leading : props.trailing)[0]?.onSelect?.()\n return close()\n }\n // The widths from the start of the swipe: a full swipe may have stretched the actions since.\n if (Math.abs(offset.value) >= state.widths[side] / 2) open(side, state.widths[side])\n else close()\n }\n\n /** The finger lifted (anywhere): a swipe settles, a press on an open row closes it. */\n const finish = () => {\n const state = release()\n if (!state) return\n if (state.swiping) {\n suppressClick = true\n swiping.value = false\n settle(state)\n } else if (state.start !== 0) {\n if (state.swiping === undefined) suppressClick = true\n close()\n }\n }\n\n /** The browser took the gesture (a scroll) or the row lost the finger: the row goes back to where it was. */\n const cancel = () => {\n const state = release()\n if (!state) return\n swiping.value = false\n const side = sideOf(state.start)\n if (state.swiping && side) open(side, state.widths[side])\n else close()\n }\n\n const handlePointerDown = (event: PointerEvent) => {\n if (event.button !== 0 || gesture) return\n // A new press of the primary pointer starts clean: a swipe that another row ended and that was then cancelled leaves\n // no click to swallow. Another finger's press keeps it, as only the primary pointer clicks.\n if (event.isPrimary) suppressClick = false\n if (props.leading.length < 1 && props.trailing.length < 1) return\n // A drag in a text field or along a slider belongs to that control.\n if (event.target instanceof Element && event.target.closest(OWN_DRAG)) return\n const pointerId = event.pointerId\n // The end of the gesture is heard wherever the finger lifts, inside the row or not.\n const handleUp = (end: PointerEvent) => {\n if (end.pointerId === pointerId) finish()\n }\n const handleCancel = (end: PointerEvent) => {\n if (end.pointerId === pointerId) cancel()\n }\n window.addEventListener(\"pointerup\", handleUp, true)\n window.addEventListener(\"pointercancel\", handleCancel, true)\n gesture = {\n pointerId,\n x: event.clientX,\n y: event.clientY,\n start: offset.value,\n swiping: undefined,\n rtl: isRtl(),\n widths: { leading: widthOf(\"leading\"), trailing: widthOf(\"trailing\") },\n rowWidth: root.value?.clientWidth ?? 0,\n detach: () => {\n window.removeEventListener(\"pointerup\", handleUp, true)\n window.removeEventListener(\"pointercancel\", handleCancel, true)\n },\n }\n }\n\n const handlePointerMove = (event: PointerEvent) => {\n const state = gesture\n if (!state || state.pointerId !== event.pointerId || state.swiping === false) return\n const across = (event.clientX - state.x) * (state.rtl ? -1 : 1)\n const down = event.clientY - state.y\n if (state.swiping === undefined) {\n if (Math.abs(across) < SLOP && Math.abs(down) < SLOP) return\n if (Math.abs(across) <= Math.abs(down)) {\n state.swiping = false\n return\n }\n state.swiping = true\n const target = event.currentTarget\n if (target instanceof Element) capture(target, event.pointerId)\n window.getSelection?.()?.removeAllRanges()\n claim()\n rtl.value = state.rtl\n swiping.value = true\n }\n const next = swipeActionsOffset(state.start + across, state.widths, state.rowWidth, props.fullSwipe)\n move(next.offset, next.full)\n }\n\n /** The content lost the finger it held. A child that loses the finger to the content (as a touch moves its implicit capture) ends nothing. */\n const handleLostPointerCapture = (event: PointerEvent) => {\n if (event.target === event.currentTarget && gesture?.pointerId === event.pointerId) cancel()\n }\n\n /** A swipe or a press that closed the row is not a click on the content; a click from the keys still is. */\n const handleClickCapture = (event: MouseEvent) => {\n if (!suppressClick || event.detail === 0) return\n suppressClick = false\n event.preventDefault()\n event.stopPropagation()\n }\n\n /** The focus on an action shows its side; on the content it closes the row. */\n const handleFocusIn = (event: FocusEvent) => {\n if (gesture?.swiping) return\n const target = event.target\n const side = ([\"leading\", \"trailing\"] as const).find((name) => target instanceof Node && !!sides[name]?.contains(target))\n if (side) {\n if (sideOf(offset.value) !== side) open(side)\n } else if (offset.value !== 0) {\n close()\n }\n }\n\n const handleFocusOut = (event: FocusEvent) => {\n if (gesture?.swiping) return\n if (event.relatedTarget instanceof Node && root.value?.contains(event.relatedTarget)) return\n if (offset.value !== 0) close()\n }\n\n const select = (action: SwipeAction, event: MouseEvent) => {\n action.onSelect?.()\n // A press closes the row, as iOS does. From the keys the action keeps the focus, so its side stays open until\n // the focus leaves the row.\n if (event.detail === 0) return\n const target = event.currentTarget\n if (target instanceof HTMLElement) target.blur()\n close()\n }\n\n const renderSide = (side: SwipeActionsSide, actions: SwipeAction[]) => {\n if (actions.length < 1) return null\n const shown = side === \"leading\" ? actions : [...actions].reverse()\n const isFull = full.value && revealed.value === side\n return h(\"div\", {\n \"ref\": (element: unknown) => {\n sides[side] = element instanceof HTMLElement ? element : null\n },\n \"class\": s.Actions,\n \"data-side\": side,\n \"data-full\": isFull ? \"\" : undefined,\n \"style\": isFull ? { width: `${Math.abs(offset.value)}px` } : undefined,\n }, shown.map((action) => {\n const color = action.color ?? \"secondary\"\n // A label alone (text), a symbol with its label inside (label), or a symbol with its label hidden or below.\n const shape = !action.Icon ? \"text\" : props.labelPlacement === \"inside\" ? \"label\" : \"symbol\"\n const labelInside = shape !== \"symbol\"\n const labelBelow = shape === \"symbol\" && props.labelPlacement === \"below\"\n return h(\"button\", {\n \"key\": action.id,\n \"type\": \"button\",\n \"class\": s.Action,\n \"data-color\": color,\n \"data-shape\": shape,\n \"data-first\": action === actions[0] ? \"\" : undefined,\n \"aria-label\": labelInside || labelBelow ? undefined : action.label,\n \"onClick\": (event: MouseEvent) => select(action, event),\n }, [\n h(\"span\", { class: s.Capsule }, [\n action.Icon ? h(action.Icon, { \"class\": s.Icon, \"aria-hidden\": \"true\" }) : null,\n labelInside ? h(\"span\", { class: s.Label }, action.label) : null,\n ]),\n labelBelow ? h(\"span\", { class: s.Caption }, action.label) : null,\n ])\n }))\n }\n\n return () => h(\"div\", {\n ...attrs,\n \"ref\": root,\n \"class\": [s.SwipeActions, attrs.class],\n \"data-row\": \"\",\n \"data-swipe-actions\": \"\",\n \"data-label-placement\": props.labelPlacement,\n \"data-round\": round.value ? \"\" : undefined,\n \"data-revealed\": revealed.value,\n \"data-swiping\": swiping.value ? \"\" : undefined,\n \"onFocusin\": handleFocusIn,\n \"onFocusout\": handleFocusOut,\n }, [\n renderSide(\"leading\", props.leading),\n h(\"div\", {\n \"class\": s.Content,\n \"data-swipe-content\": \"\",\n \"style\": offset.value !== 0 ? { \"--swipe-actions-offset\": `${rtl.value ? -offset.value : offset.value}px` } : undefined,\n \"onPointerdown\": handlePointerDown,\n \"onPointermove\": handlePointerMove,\n \"onLostpointercapture\": handleLostPointerCapture,\n \"onClickCapture\": handleClickCapture,\n }, slots.default?.()),\n renderSide(\"trailing\", props.trailing),\n ])\n },\n})\n\ntype SwipeActionsOwnProps = InstanceType<typeof SwipeActionsComponent>[\"$props\"]\n\n/** SwipeActions props. */\nexport type SwipeActionsProps = SwipeActionsOwnProps\n\n/**\n * Actions behind a row of a list, as the swipe actions of an iOS list: a swipe toward the leading edge reveals the\n * trailing actions, a swipe toward the trailing edge the leading ones, and a full swipe runs the first action of\n * that side. The row is a `data-row` of a FieldGroup. Each action is also a button in the order of the screen, and\n * the focus on one shows its side.\n */\nexport const SwipeActions = SwipeActionsComponent\n"]}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { computed, defineComponent, h, inject, onBeforeUnmount, onMounted, provide, ref, watch, } from "vue";
|
|
2
2
|
import s from "@plexui/styles/components/TabBar/TabBar.module.css";
|
|
3
3
|
import { Search as SearchIcon } from "../Icon/index.js";
|
|
4
|
+
import { hasContent } from "../../lib/slotContent.js";
|
|
4
5
|
import { TOOLBAR_HOST } from "../Toolbar/Toolbar.js";
|
|
5
6
|
// Vue port of packages/ui/src/components/TabBar/TabBar.tsx. Exports are flat (`TabBarItem` for `TabBar.Item`);
|
|
6
|
-
// the symbol of an item is its `icon` slot
|
|
7
|
-
// (`v-model:value`), `minimized` + `onMinimizedChange`
|
|
7
|
+
// the symbol of an item is its `icon` slot, and React's `accessory` is the bar's `accessory` slot. React's
|
|
8
|
+
// `value` + `onValueChange` become `value` + `update:value` (`v-model:value`), `minimized` + `onMinimizedChange`
|
|
9
|
+
// become `minimized` + `update:minimized`.
|
|
8
10
|
/** A scroll of at least this many pixels in one direction minimizes or expands the bar. */
|
|
9
11
|
const MINIMIZE_AFTER = 8;
|
|
10
12
|
const TAB_BAR = Symbol("TabBar");
|
|
13
|
+
/** A badge shows unless it is empty: no value, an empty text or a count of 0 (iOS hides `.badge(0)`). */
|
|
14
|
+
const hasBadge = (badge) => badge != null && badge !== "" && badge !== 0;
|
|
11
15
|
const TabBarItemComponent = defineComponent({
|
|
12
16
|
name: "TabBarItem",
|
|
13
17
|
inheritAttrs: false,
|
|
@@ -18,6 +22,11 @@ const TabBarItemComponent = defineComponent({
|
|
|
18
22
|
label: { type: String, required: true },
|
|
19
23
|
/** Makes the tab a link to this URL. */
|
|
20
24
|
href: String,
|
|
25
|
+
/**
|
|
26
|
+
* A count or a short word in a red capsule over the symbol, as an iOS tab badge; it is read after the label.
|
|
27
|
+
* A count of 0 shows none, as on iOS.
|
|
28
|
+
*/
|
|
29
|
+
badge: { type: [String, Number], default: undefined },
|
|
21
30
|
/** When `true`, the tab cannot be selected. */
|
|
22
31
|
disabled: { type: Boolean, default: false },
|
|
23
32
|
/** @internal The search and the prominent tab show their symbol only. */
|
|
@@ -48,6 +57,8 @@ const TabBarItemComponent = defineComponent({
|
|
|
48
57
|
const content = [
|
|
49
58
|
h("span", { "class": s.Icon, "aria-hidden": "true" }, slots.icon?.()),
|
|
50
59
|
props.hideLabel ? null : h("span", { class: s.Label }, props.label),
|
|
60
|
+
// The space keeps the accessible name "Inbox 3", not "Inbox3".
|
|
61
|
+
...(hasBadge(props.badge) ? [" ", h("span", { class: s.Badge }, props.badge)] : []),
|
|
51
62
|
];
|
|
52
63
|
const shared = {
|
|
53
64
|
"class": [s.Item, attrs.class],
|
|
@@ -169,30 +180,50 @@ const TabBarComponent = defineComponent({
|
|
|
169
180
|
observer?.disconnect();
|
|
170
181
|
host?.setHeight?.("bottom", undefined);
|
|
171
182
|
});
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
183
|
+
// Minimizing or expanding moves the accessory past the tabs. A keyed diff moves the DOM node, and a moved node
|
|
184
|
+
// that holds the focus sends it to the body (React restores it after its commit); the bar puts it back.
|
|
185
|
+
let focused = null;
|
|
186
|
+
watch(minimized, () => {
|
|
187
|
+
const active = document.activeElement;
|
|
188
|
+
focused = active instanceof HTMLElement && element.value?.contains(active) ? active : null;
|
|
189
|
+
}, { flush: "pre" });
|
|
190
|
+
watch(minimized, () => {
|
|
191
|
+
const target = focused;
|
|
192
|
+
focused = null;
|
|
193
|
+
if (target?.isConnected && document.activeElement !== target)
|
|
194
|
+
target.focus({ preventScroll: true });
|
|
195
|
+
}, { flush: "post" });
|
|
196
|
+
return () => {
|
|
197
|
+
// An accessory slot that renders nothing (a `v-if` inside it) leaves no empty capsule, as React's `false`.
|
|
198
|
+
const accessory = slots.accessory?.();
|
|
199
|
+
const accessoryCapsule = hasContent(accessory) ? h("div", { key: "accessory", class: s.Accessory }, accessory) : null;
|
|
200
|
+
const tabs = h("div", { key: "tabs", class: s.Tabs }, [
|
|
185
201
|
slots.default?.(),
|
|
186
202
|
props.search && props.prominent
|
|
187
203
|
? h(TabBarItem, { value: props.search.value, label: props.search.label ?? "Search" }, { icon: () => h(SearchIcon) })
|
|
188
204
|
: null,
|
|
189
|
-
])
|
|
190
|
-
props.prominent
|
|
191
|
-
? h(TabBarItem, { class: s.Prominent, value: props.prominent.value, label: props.prominent.label, hideLabel: true }, { icon: () => slots["prominent-icon"]?.() })
|
|
205
|
+
]);
|
|
206
|
+
const circle = props.prominent
|
|
207
|
+
? h(TabBarItem, { key: "prominent", class: s.Prominent, value: props.prominent.value, label: props.prominent.label, hideLabel: true }, { icon: () => slots["prominent-icon"]?.() })
|
|
192
208
|
: props.search
|
|
193
|
-
? h(TabBarItem, { class: s.Search, value: props.search.value, label: props.search.label ?? "Search", hideLabel: true }, { icon: () => h(SearchIcon) })
|
|
194
|
-
: null
|
|
195
|
-
|
|
209
|
+
? h(TabBarItem, { key: "search", class: s.Search, value: props.search.value, label: props.search.label ?? "Search", hideLabel: true }, { icon: () => h(SearchIcon) })
|
|
210
|
+
: null;
|
|
211
|
+
// The accessory is read where it stands: above the tabs, and minimized between the two circles. The keys move
|
|
212
|
+
// it there without remounting its content.
|
|
213
|
+
return h("nav", {
|
|
214
|
+
...attrs,
|
|
215
|
+
"ref": element,
|
|
216
|
+
"aria-label": props.ariaLabel,
|
|
217
|
+
"class": [s.TabBar, attrs.class],
|
|
218
|
+
"data-host": host?.kind,
|
|
219
|
+
"data-background": props.background,
|
|
220
|
+
"data-content-below": host?.contentBelow?.value ? "" : undefined,
|
|
221
|
+
"data-minimized": minimized.value ? "" : undefined,
|
|
222
|
+
"data-search": props.search && !props.prominent ? "" : undefined,
|
|
223
|
+
"data-prominent": props.prominent ? "" : undefined,
|
|
224
|
+
"data-accessory": accessoryCapsule ? "" : undefined,
|
|
225
|
+
}, minimized.value ? [tabs, accessoryCapsule, circle] : [accessoryCapsule, tabs, circle]);
|
|
226
|
+
};
|
|
196
227
|
},
|
|
197
228
|
});
|
|
198
229
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabBar.js","sourceRoot":"","sources":["../../../../src/components/TabBar/TabBar.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,CAAC,EACD,MAAM,EACN,eAAe,EACf,SAAS,EACT,OAAO,EACP,GAAG,EACH,KAAK,GAIN,MAAM,KAAK,CAAA;AACZ,OAAO,CAAC,MAAM,oDAAoD,CAAA;AAClE,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,YAAY,EAAsB,MAAM,uBAAuB,CAAA;AAExE,+GAA+G;AAC/G,8GAA8G;AAC9G,gGAAgG;AAEhG,2FAA2F;AAC3F,MAAM,cAAc,GAAG,CAAC,CAAA;AASxB,MAAM,OAAO,GAAgC,MAAM,CAAC,QAAQ,CAAC,CAAA;AAiB7D,MAAM,mBAAmB,GAAG,eAAe,CAAC;IAC1C,IAAI,EAAE,YAAY;IAClB,YAAY,EAAE,KAAK;IACnB,KAAK,EAAE;QACL,4BAA4B;QAC5B,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAA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,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC;oBACtJ,CAAC,CAAC,IAAI;SACX,CAAC,CAAA;IACJ,CAAC;CACF,CAAC,CAAA;AAKF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,eAAe,CAAA","sourcesContent":["import {\n computed,\n defineComponent,\n h,\n inject,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n watch,\n type ComputedRef,\n type InjectionKey,\n type PropType,\n} from \"vue\"\nimport s from \"@plexui/styles/components/TabBar/TabBar.module.css\"\nimport { Search as SearchIcon } from \"../Icon/index.js\"\nimport { TOOLBAR_HOST, type BarBackground } from \"../Toolbar/Toolbar.js\"\n\n// Vue port of packages/ui/src/components/TabBar/TabBar.tsx. Exports are flat (`TabBarItem` for `TabBar.Item`);\n// the symbol of an item is its `icon` slot. React's `value` + `onValueChange` become `value` + `update:value`\n// (`v-model:value`), `minimized` + `onMinimizedChange` become `minimized` + `update:minimized`.\n\n/** A scroll of at least this many pixels in one direction minimizes or expands the bar. */\nconst MINIMIZE_AFTER = 8\n\ntype TabBarContext = {\n value: ComputedRef<string | undefined>\n minimized: ComputedRef<boolean>\n select: (value: string) => void\n expand: () => void\n}\n\nconst TAB_BAR: InjectionKey<TabBarContext> = Symbol(\"TabBar\")\n\nexport type TabBarSearch = {\n /** The value of the search tab. */\n value: string\n /** Accessible name of the search tab. @default \"Search\" */\n label?: string\n}\n\n/** The prominent tab of a `TabBar`; its symbol is the `prominent-icon` slot of the bar (React `prominent.icon`). */\nexport type TabBarProminent = {\n /** The value of the prominent tab. */\n value: string\n /** Accessible name of the prominent tab: its circle shows the symbol only. */\n label: string\n}\n\nconst TabBarItemComponent = defineComponent({\n name: \"TabBarItem\",\n inheritAttrs: false,\n props: {\n /** The value of the tab. */\n value: { type: String, required: true },\n /** The label under the symbol, and the accessible name of the tab. */\n label: { type: String, required: true },\n /** Makes the tab a link to this URL. */\n href: String,\n /** When `true`, the tab cannot be selected. */\n disabled: { type: Boolean, default: false },\n /** @internal The search and the prominent tab show their symbol only. */\n hideLabel: { type: Boolean, default: false },\n },\n emits: {\n /** The tab was pressed, before it is selected */\n click: (event: MouseEvent) => event instanceof MouseEvent,\n },\n setup(props, { attrs, emit, slots }) {\n const context = inject(TAB_BAR, null)\n if (!context) throw new Error(\"TabBarItem must be used within TabBar\")\n const selected = computed(() => context.value.value === props.value)\n // A minimized bar shows the selected tab only; pressing it brings the other tabs back.\n const collapsed = computed(() => context.minimized.value && selected.value && !props.hideLabel)\n const handleClick = (event: MouseEvent) => {\n emit(\"click\", event)\n if (event.defaultPrevented || props.disabled) return\n if (collapsed.value) {\n event.preventDefault()\n return context.expand()\n }\n context.select(props.value)\n }\n return () => {\n const content = [\n h(\"span\", { \"class\": s.Icon, \"aria-hidden\": \"true\" }, slots.icon?.()),\n props.hideLabel ? null : h(\"span\", { class: s.Label }, props.label),\n ]\n const shared = {\n \"class\": [s.Item, attrs.class],\n \"aria-current\": selected.value ? \"page\" : undefined,\n \"aria-label\": props.hideLabel ? props.label : undefined,\n \"aria-expanded\": collapsed.value ? false : undefined,\n \"data-selected\": selected.value ? \"\" : undefined,\n \"data-disabled\": props.disabled ? \"\" : undefined,\n \"data-value\": props.value,\n \"onClick\": handleClick,\n }\n if (props.href !== undefined && !props.disabled) return h(\"a\", { href: props.href, ...shared }, content)\n return h(\"button\", { type: \"button\", disabled: props.disabled, ...shared }, content)\n }\n },\n})\n\n/** Props of `TabBarItem`. */\nexport type TabBarItemProps = InstanceType<typeof TabBarItemComponent>[\"$props\"]\n\n/** One tab of a `TabBar` (React `TabBar.Item`): its `icon` slot holds the symbol, a PlexUI icon. */\nexport const TabBarItem = TabBarItemComponent\n\nconst TabBarComponent = defineComponent({\n name: \"TabBar\",\n inheritAttrs: false,\n props: {\n /** The controlled value of the selected tab. Bind with `v-model:value`. */\n value: { type: String, default: undefined },\n /** The selected tab when it is initially rendered. */\n defaultValue: { type: String, default: undefined },\n /** A search tab in a glass circle of its own at the trailing end, as the iOS 26 separate search tab. */\n search: { type: Object as PropType<TabBarSearch>, default: undefined },\n /**\n * The one destination the app lifts out of the capsule, a cart or a library, in a glass circle of its own at\n * the trailing end, as the iOS 27 prominent tab role; its symbol is the `prominent-icon` slot. It takes the\n * circle of the search tab: with both, search is the last tab of the capsule, as iOS gives search that place\n * only when no other tab is prominent.\n */\n prominent: { type: Object as PropType<TabBarProminent>, default: undefined },\n /**\n * `onScrollDown` minimizes the bar to the selected tab while the content of the `Page` scrolls down and\n * expands it when the content scrolls back up; a tap on the minimized tab expands it too. @default \"never\"\n */\n minimizeBehavior: { type: String as PropType<\"never\" | \"onScrollDown\">, default: \"never\" },\n /** Controlled minimized state. Bind with `v-model:minimized`. */\n minimized: { type: Boolean, default: undefined },\n /** The minimized state when it is initially rendered. @default false */\n defaultMinimized: { type: Boolean, default: false },\n /** How the bar meets the content scrolled under it; see `BarBackground`. @default \"soft\" */\n background: { type: String as PropType<BarBackground>, default: \"soft\" },\n /** Accessible name of the navigation. @default \"Tabs\" */\n ariaLabel: { type: String, default: \"Tabs\" },\n },\n emits: {\n /** A tab was selected */\n \"update:value\": (value: string) => typeof value === \"string\",\n /** A tab was selected (React `onValueChange`) */\n \"valueChange\": (value: string) => typeof value === \"string\",\n /** The bar minimized or expanded */\n \"update:minimized\": (minimized: boolean) => typeof minimized === \"boolean\",\n },\n setup(props, { attrs, emit, slots }) {\n const host = inject(TOOLBAR_HOST, null)\n const internalValue = ref(props.defaultValue)\n const value = computed(() => props.value ?? internalValue.value)\n const internalMinimized = ref(props.defaultMinimized)\n const minimized = computed(() => props.minimized ?? internalMinimized.value)\n\n const select = (next: string) => {\n if (props.value === undefined) internalValue.value = next\n emit(\"update:value\", next)\n emit(\"valueChange\", next)\n }\n const setMinimized = (next: boolean) => {\n if (next === minimized.value) return\n if (props.minimized === undefined) internalMinimized.value = next\n emit(\"update:minimized\", next)\n }\n provide(TAB_BAR, { value, minimized, select, expand: () => setMinimized(false) })\n\n // The bar follows the Page content: down by MINIMIZE_AFTER minimizes it, up by as much (or the top) expands it.\n let unsubscribe: (() => void) | undefined\n const follow = () => {\n unsubscribe?.()\n unsubscribe = undefined\n if (props.minimizeBehavior !== \"onScrollDown\" || !host?.subscribeScroll) return\n let anchor = 0\n unsubscribe = host.subscribeScroll((scrollTop) => {\n if (scrollTop <= 0) {\n anchor = 0\n return setMinimized(false)\n }\n const delta = scrollTop - anchor\n if (minimized.value ? delta < 0 : delta > 0) {\n if (Math.abs(delta) >= MINIMIZE_AFTER) {\n anchor = scrollTop\n setMinimized(!minimized.value)\n }\n return\n }\n anchor = scrollTop\n })\n }\n watch(() => props.minimizeBehavior, follow, { immediate: true })\n\n // Like a bottom Toolbar, the bar reserves its height on the Page; a desktop layout hides it.\n const element = ref<HTMLElement | null>(null)\n let observer: ResizeObserver | undefined\n onMounted(() => {\n const bar = element.value\n const setHeight = host?.setHeight\n if (!bar || !setHeight) return\n const update = () => setHeight(\"bottom\", bar.offsetHeight || undefined)\n update()\n observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n observer?.observe(bar, { box: \"border-box\" })\n })\n onBeforeUnmount(() => {\n unsubscribe?.()\n observer?.disconnect()\n host?.setHeight?.(\"bottom\", undefined)\n })\n\n return () => h(\"nav\", {\n ...attrs,\n \"ref\": element,\n \"aria-label\": props.ariaLabel,\n \"class\": [s.TabBar, attrs.class],\n \"data-host\": host?.kind,\n \"data-background\": props.background,\n \"data-content-below\": host?.contentBelow?.value ? \"\" : undefined,\n \"data-minimized\": minimized.value ? \"\" : undefined,\n \"data-search\": props.search && !props.prominent ? \"\" : undefined,\n \"data-prominent\": props.prominent ? \"\" : undefined,\n }, [\n h(\"div\", { class: s.Tabs }, [\n slots.default?.(),\n props.search && props.prominent\n ? h(TabBarItem, { value: props.search.value, label: props.search.label ?? \"Search\" }, { icon: () => h(SearchIcon) })\n : null,\n ]),\n props.prominent\n ? h(TabBarItem, { class: s.Prominent, value: props.prominent.value, label: props.prominent.label, hideLabel: true }, { icon: () => slots[\"prominent-icon\"]?.() })\n : props.search\n ? h(TabBarItem, { class: s.Search, value: props.search.value, label: props.search.label ?? \"Search\", hideLabel: true }, { icon: () => h(SearchIcon) })\n : null,\n ])\n },\n})\n\n/** Props of `TabBar`. */\nexport type TabBarProps = InstanceType<typeof TabBarComponent>[\"$props\"]\n\n/**\n * The tab bar of a phone screen after the iOS 26 kit Tab Bar - iPhone (507:24689): two to five tabs, each a\n * symbol over a label, in a floating glass capsule at the bottom, the selected tab on a pill, and an optional\n * search or prominent tab in a circle of its own. It minimizes to the selected tab while the content scrolls\n * down. A desktop layout navigates with a Sidebar or Tabs, so the bar never renders from 768px up.\n */\nexport const TabBar = TabBarComponent\n"]}
|
|
1
|
+
{"version":3,"file":"TabBar.js","sourceRoot":"","sources":["../../../../src/components/TabBar/TabBar.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,CAAC,EACD,MAAM,EACN,eAAe,EACf,SAAS,EACT,OAAO,EACP,GAAG,EACH,KAAK,GAIN,MAAM,KAAK,CAAA;AACZ,OAAO,CAAC,MAAM,oDAAoD,CAAA;AAClE,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAE,YAAY,EAAsB,MAAM,uBAAuB,CAAA;AAExE,+GAA+G;AAC/G,2GAA2G;AAC3G,iHAAiH;AACjH,2CAA2C;AAE3C,2FAA2F;AAC3F,MAAM,cAAc,GAAG,CAAC,CAAA;AASxB,MAAM,OAAO,GAAgC,MAAM,CAAC,QAAQ,CAAC,CAAA;AAiB7D,yGAAyG;AACzG,MAAM,QAAQ,GAAG,CAAC,KAAyC,EAAE,EAAE,CAAC,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,CAAC,CAAA;AAE5G,MAAM,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,EAAE,KAAK,CAAC,KAAK,CAAC;gBAChC,WAAW,EAAE,IAAI,EAAE,IAAI;gBACvB,iBAAiB,EAAE,KAAK,CAAC,UAAU;gBACnC,oBAAoB,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;gBAChE,gBAAgB,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;gBAClD,aAAa,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;gBAChE,gBAAgB,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;gBAClD,gBAAgB,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;aACpD,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,gBAAgB,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAA;QAC3F,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAKF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,eAAe,CAAA","sourcesContent":["import {\n computed,\n defineComponent,\n h,\n inject,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n watch,\n type ComputedRef,\n type InjectionKey,\n type PropType,\n} from \"vue\"\nimport s from \"@plexui/styles/components/TabBar/TabBar.module.css\"\nimport { Search as SearchIcon } from \"../Icon/index.js\"\nimport { hasContent } from \"../../lib/slotContent.js\"\nimport { TOOLBAR_HOST, type BarBackground } from \"../Toolbar/Toolbar.js\"\n\n// Vue port of packages/ui/src/components/TabBar/TabBar.tsx. Exports are flat (`TabBarItem` for `TabBar.Item`);\n// the symbol of an item is its `icon` slot, and React's `accessory` is the bar's `accessory` slot. React's\n// `value` + `onValueChange` become `value` + `update:value` (`v-model:value`), `minimized` + `onMinimizedChange`\n// become `minimized` + `update:minimized`.\n\n/** A scroll of at least this many pixels in one direction minimizes or expands the bar. */\nconst MINIMIZE_AFTER = 8\n\ntype TabBarContext = {\n value: ComputedRef<string | undefined>\n minimized: ComputedRef<boolean>\n select: (value: string) => void\n expand: () => void\n}\n\nconst TAB_BAR: InjectionKey<TabBarContext> = Symbol(\"TabBar\")\n\nexport type TabBarSearch = {\n /** The value of the search tab. */\n value: string\n /** Accessible name of the search tab. @default \"Search\" */\n label?: string\n}\n\n/** The prominent tab of a `TabBar`; its symbol is the `prominent-icon` slot of the bar (React `prominent.icon`). */\nexport type TabBarProminent = {\n /** The value of the prominent tab. */\n value: string\n /** Accessible name of the prominent tab: its circle shows the symbol only. */\n label: string\n}\n\n/** A badge shows unless it is empty: no value, an empty text or a count of 0 (iOS hides `.badge(0)`). */\nconst hasBadge = (badge: string | number | null | undefined) => badge != null && badge !== \"\" && badge !== 0\n\nconst TabBarItemComponent = defineComponent({\n name: \"TabBarItem\",\n inheritAttrs: false,\n props: {\n /** The value of the tab. */\n value: { type: String, required: true },\n /** The label under the symbol, and the accessible name of the tab. */\n label: { type: String, required: true },\n /** Makes the tab a link to this URL. */\n href: String,\n /**\n * A count or a short word in a red capsule over the symbol, as an iOS tab badge; it is read after the label.\n * A count of 0 shows none, as on iOS.\n */\n badge: { type: [String, Number], default: undefined },\n /** When `true`, the tab cannot be selected. */\n disabled: { type: Boolean, default: false },\n /** @internal The search and the prominent tab show their symbol only. */\n hideLabel: { type: Boolean, default: false },\n },\n emits: {\n /** The tab was pressed, before it is selected */\n click: (event: MouseEvent) => event instanceof MouseEvent,\n },\n setup(props, { attrs, emit, slots }) {\n const context = inject(TAB_BAR, null)\n if (!context) throw new Error(\"TabBarItem must be used within TabBar\")\n const selected = computed(() => context.value.value === props.value)\n // A minimized bar shows the selected tab only; pressing it brings the other tabs back.\n const collapsed = computed(() => context.minimized.value && selected.value && !props.hideLabel)\n const handleClick = (event: MouseEvent) => {\n emit(\"click\", event)\n if (event.defaultPrevented || props.disabled) return\n if (collapsed.value) {\n event.preventDefault()\n return context.expand()\n }\n context.select(props.value)\n }\n return () => {\n const content = [\n h(\"span\", { \"class\": s.Icon, \"aria-hidden\": \"true\" }, slots.icon?.()),\n props.hideLabel ? null : h(\"span\", { class: s.Label }, props.label),\n // The space keeps the accessible name \"Inbox 3\", not \"Inbox3\".\n ...(hasBadge(props.badge) ? [\" \", h(\"span\", { class: s.Badge }, props.badge)] : []),\n ]\n const shared = {\n \"class\": [s.Item, attrs.class],\n \"aria-current\": selected.value ? \"page\" : undefined,\n \"aria-label\": props.hideLabel ? props.label : undefined,\n \"aria-expanded\": collapsed.value ? false : undefined,\n \"data-selected\": selected.value ? \"\" : undefined,\n \"data-disabled\": props.disabled ? \"\" : undefined,\n \"data-value\": props.value,\n \"onClick\": handleClick,\n }\n if (props.href !== undefined && !props.disabled) return h(\"a\", { href: props.href, ...shared }, content)\n return h(\"button\", { type: \"button\", disabled: props.disabled, ...shared }, content)\n }\n },\n})\n\n/** Props of `TabBarItem`. */\nexport type TabBarItemProps = InstanceType<typeof TabBarItemComponent>[\"$props\"]\n\n/** One tab of a `TabBar` (React `TabBar.Item`): its `icon` slot holds the symbol, a PlexUI icon. */\nexport const TabBarItem = TabBarItemComponent\n\nconst TabBarComponent = defineComponent({\n name: \"TabBar\",\n inheritAttrs: false,\n props: {\n /** The controlled value of the selected tab. Bind with `v-model:value`. */\n value: { type: String, default: undefined },\n /** The selected tab when it is initially rendered. */\n defaultValue: { type: String, default: undefined },\n /** A search tab in a glass circle of its own at the trailing end, as the iOS 26 separate search tab. */\n search: { type: Object as PropType<TabBarSearch>, default: undefined },\n /**\n * The one destination the app lifts out of the capsule, a cart or a library, in a glass circle of its own at\n * the trailing end, as the iOS 27 prominent tab role; its symbol is the `prominent-icon` slot. It takes the\n * circle of the search tab: with both, search is the last tab of the capsule, as iOS gives search that place\n * only when no other tab is prominent.\n */\n prominent: { type: Object as PropType<TabBarProminent>, default: undefined },\n /**\n * `onScrollDown` minimizes the bar to the selected tab while the content of the `Page` scrolls down and\n * expands it when the content scrolls back up; a tap on the minimized tab expands it too. @default \"never\"\n */\n minimizeBehavior: { type: String as PropType<\"never\" | \"onScrollDown\">, default: \"never\" },\n /** Controlled minimized state. Bind with `v-model:minimized`. */\n minimized: { type: Boolean, default: undefined },\n /** The minimized state when it is initially rendered. @default false */\n defaultMinimized: { type: Boolean, default: false },\n /** How the bar meets the content scrolled under it; see `BarBackground`. @default \"soft\" */\n background: { type: String as PropType<BarBackground>, default: \"soft\" },\n /** Accessible name of the navigation. @default \"Tabs\" */\n ariaLabel: { type: String, default: \"Tabs\" },\n },\n emits: {\n /** A tab was selected */\n \"update:value\": (value: string) => typeof value === \"string\",\n /** A tab was selected (React `onValueChange`) */\n \"valueChange\": (value: string) => typeof value === \"string\",\n /** The bar minimized or expanded */\n \"update:minimized\": (minimized: boolean) => typeof minimized === \"boolean\",\n },\n setup(props, { attrs, emit, slots }) {\n const host = inject(TOOLBAR_HOST, null)\n const internalValue = ref(props.defaultValue)\n const value = computed(() => props.value ?? internalValue.value)\n const internalMinimized = ref(props.defaultMinimized)\n const minimized = computed(() => props.minimized ?? internalMinimized.value)\n\n const select = (next: string) => {\n if (props.value === undefined) internalValue.value = next\n emit(\"update:value\", next)\n emit(\"valueChange\", next)\n }\n const setMinimized = (next: boolean) => {\n if (next === minimized.value) return\n if (props.minimized === undefined) internalMinimized.value = next\n emit(\"update:minimized\", next)\n }\n provide(TAB_BAR, { value, minimized, select, expand: () => setMinimized(false) })\n\n // The bar follows the Page content: down by MINIMIZE_AFTER minimizes it, up by as much (or the top) expands it.\n let unsubscribe: (() => void) | undefined\n const follow = () => {\n unsubscribe?.()\n unsubscribe = undefined\n if (props.minimizeBehavior !== \"onScrollDown\" || !host?.subscribeScroll) return\n let anchor = 0\n unsubscribe = host.subscribeScroll((scrollTop) => {\n if (scrollTop <= 0) {\n anchor = 0\n return setMinimized(false)\n }\n const delta = scrollTop - anchor\n if (minimized.value ? delta < 0 : delta > 0) {\n if (Math.abs(delta) >= MINIMIZE_AFTER) {\n anchor = scrollTop\n setMinimized(!minimized.value)\n }\n return\n }\n anchor = scrollTop\n })\n }\n watch(() => props.minimizeBehavior, follow, { immediate: true })\n\n // Like a bottom Toolbar, the bar reserves its height on the Page; a desktop layout hides it.\n const element = ref<HTMLElement | null>(null)\n let observer: ResizeObserver | undefined\n onMounted(() => {\n const bar = element.value\n const setHeight = host?.setHeight\n if (!bar || !setHeight) return\n const update = () => setHeight(\"bottom\", bar.offsetHeight || undefined)\n update()\n observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n observer?.observe(bar, { box: \"border-box\" })\n })\n onBeforeUnmount(() => {\n unsubscribe?.()\n observer?.disconnect()\n host?.setHeight?.(\"bottom\", undefined)\n })\n\n // Minimizing or expanding moves the accessory past the tabs. A keyed diff moves the DOM node, and a moved node\n // that holds the focus sends it to the body (React restores it after its commit); the bar puts it back.\n let focused: HTMLElement | null = null\n watch(minimized, () => {\n const active = document.activeElement\n focused = active instanceof HTMLElement && element.value?.contains(active) ? active : null\n }, { flush: \"pre\" })\n watch(minimized, () => {\n const target = focused\n focused = null\n if (target?.isConnected && document.activeElement !== target) target.focus({ preventScroll: true })\n }, { flush: \"post\" })\n\n return () => {\n // An accessory slot that renders nothing (a `v-if` inside it) leaves no empty capsule, as React's `false`.\n const accessory = slots.accessory?.()\n const accessoryCapsule = hasContent(accessory) ? h(\"div\", { key: \"accessory\", class: s.Accessory }, accessory) : null\n const tabs = h(\"div\", { key: \"tabs\", class: s.Tabs }, [\n slots.default?.(),\n props.search && props.prominent\n ? h(TabBarItem, { value: props.search.value, label: props.search.label ?? \"Search\" }, { icon: () => h(SearchIcon) })\n : null,\n ])\n const circle = props.prominent\n ? h(TabBarItem, { key: \"prominent\", class: s.Prominent, value: props.prominent.value, label: props.prominent.label, hideLabel: true }, { icon: () => slots[\"prominent-icon\"]?.() })\n : props.search\n ? h(TabBarItem, { key: \"search\", class: s.Search, value: props.search.value, label: props.search.label ?? \"Search\", hideLabel: true }, { icon: () => h(SearchIcon) })\n : null\n // The accessory is read where it stands: above the tabs, and minimized between the two circles. The keys move\n // it there without remounting its content.\n return h(\"nav\", {\n ...attrs,\n \"ref\": element,\n \"aria-label\": props.ariaLabel,\n \"class\": [s.TabBar, attrs.class],\n \"data-host\": host?.kind,\n \"data-background\": props.background,\n \"data-content-below\": host?.contentBelow?.value ? \"\" : undefined,\n \"data-minimized\": minimized.value ? \"\" : undefined,\n \"data-search\": props.search && !props.prominent ? \"\" : undefined,\n \"data-prominent\": props.prominent ? \"\" : undefined,\n \"data-accessory\": accessoryCapsule ? \"\" : undefined,\n }, minimized.value ? [tabs, accessoryCapsule, circle] : [accessoryCapsule, tabs, circle])\n }\n },\n})\n\n/** Props of `TabBar`. */\nexport type TabBarProps = InstanceType<typeof TabBarComponent>[\"$props\"]\n\n/**\n * The tab bar of a phone screen after the iOS 26 kit Tab Bar - iPhone (507:24689): two to five tabs, each a\n * symbol over a label, in a floating glass capsule at the bottom, the selected tab on a pill, and an optional\n * search or prominent tab in a circle of its own. It minimizes to the selected tab while the content scrolls\n * down. A desktop layout navigates with a Sidebar or Tabs, so the bar never renders from 768px up.\n */\nexport const TabBar = TabBarComponent\n"]}
|