@plexui/vue 0.31.0 → 0.33.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/DatePicker/Calendar.js +16 -2
- package/dist/es/components/DatePicker/Calendar.js.map +1 -1
- package/dist/es/components/DateRangePicker/Calendar.js +16 -2
- package/dist/es/components/DateRangePicker/Calendar.js.map +1 -1
- package/dist/es/components/Dialog/Dialog.js +7 -2
- package/dist/es/components/Dialog/Dialog.js.map +1 -1
- package/dist/es/components/Field/Field.js +40 -1
- package/dist/es/components/Field/Field.js.map +1 -1
- package/dist/es/components/SwipeActions/SwipeActions.js +222 -20
- package/dist/es/components/SwipeActions/SwipeActions.js.map +1 -1
- package/dist/es/components/SwipeActions/index.js +1 -1
- package/dist/es/components/SwipeActions/index.js.map +1 -1
- package/dist/es/lib/calendarFit.js +80 -0
- package/dist/es/lib/calendarFit.js.map +1 -0
- package/dist/types/components/SwipeActions/SwipeActions.d.ts +8 -0
- package/dist/types/components/SwipeActions/index.d.ts +1 -1
- package/dist/types/lib/calendarFit.d.ts +9 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.js","sourceRoot":"","sources":["../../../../src/components/Field/Field.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,EAAE,EAAmB,MAAM,MAAM,CAAA;AAC5C,OAAO,EACL,OAAO,EACP,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,eAAe,EACf,CAAC,EACD,OAAO,EACP,UAAU,EACV,KAAK,GAMN,MAAM,KAAK,CAAA;AAEZ,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,CAAC,MAAM,kDAAkD,CAAA;AAsChE,MAAM,aAAa,GAAyB,I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AC,CAAC,CAAC,CAAC,CAAC,IAAI;iBACrF,CAAC;gBACF,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI;aAC7E,CACF,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAOF,mFAAmF;AACnF,MAAM,CAAC,MAAM,KAAK,GAAG,cAA4E,CAAA","sourcesContent":["import clsx, { type ClassValue } from \"clsx\"\nimport {\n Comment,\n Fragment,\n Static,\n Text,\n camelize,\n cloneVNode,\n defineComponent,\n h,\n isVNode,\n mergeProps,\n useId,\n type PropType,\n type SlotsType,\n type VNode,\n type VNodeArrayChildren,\n type VNodeChild,\n} from \"vue\"\nimport type { ControlSize } from \"@plexui/styles/types\"\nimport { FieldError } from \"../FieldError/index.js\"\nimport { provideFieldRow } from \"../../lib/fieldRow.js\"\nimport { hasContent } from \"../../lib/slotContent.js\"\nimport s from \"@plexui/styles/components/Field/Field.module.css\"\n\n// Vue port of packages/ui/src/components/Field/Field.tsx.\n//\n// - `label`, `description` and `errorMessage` take a string prop or a slot of\n// the same name (the slot wins), like React's ReactNode props.\n// - Children: React accepts an element, which Field clones with the field\n// props, or a render prop `(fieldProps) => ReactNode`, which it leaves alone.\n// Both are the default slot here, which receives the field props:\n// - a slot that reads them (`v-slot=\"fieldProps\"` + `v-bind=\"fieldProps\"`,\n// `v-slot=\"{ id }\"`, `(fieldProps) => h(...)`) is the render prop: its\n// content renders as it is.\n// - a slot that does not read them and holds exactly one element or\n// component gets it cloned like React's `cloneElement`: `opticallyAlign`\n// replaces the child's own, the child's own `id` stays and the label's\n// `for` follows it, `aria-describedby` is joined after the child's own\n// ids, and an explicit `aria-invalid` on the child wins. Template\n// comments do not count as children (JSX comments); the\n// placeholder of a `v-if` that renders nothing does, like `{false}` in a\n// React children array, so `<A v-if=\"x\" /><Input />` is not cloned.\n// - anything else (text, several roots, a `v-for` list) renders as it is,\n// like a React child that is not a single element.\n// - content a wrapper forwards with `<slot />` counts as its own roots, as\n// React's `children` passed on to Field are the elements themselves.\n// - As in React only `class` reaches the root element; other attributes are\n// dropped. On a `row` they all reach it, as React's rest props do.\n\nexport type FieldChildProps = {\n id: string\n /** The label's id. Bind it to a control that the label's `for` cannot name, such as a Select trigger. */\n \"aria-labelledby\"?: string\n \"aria-describedby\"?: string\n \"aria-invalid\"?: boolean\n opticallyAlign?: \"start\" | \"end\"\n}\n\ntype Props = Record<string, unknown>\n\nconst CONTROL_SIZES: ReadonlySet<unknown> = new Set([\"3xs\", \"2xs\", \"xs\", \"sm\", \"md\", \"lg\", \"xl\", \"2xl\", \"3xl\"])\n\n/** The slot props, recording whether the slot read them (the render-prop form). */\nconst trackUse = (target: FieldChildProps) => {\n const state = { used: false }\n const proxy = new Proxy(target, {\n get(object, key, receiver) {\n state.used = true\n return Reflect.get(object, key, receiver)\n },\n has(object, key) {\n state.used = true\n return Reflect.has(object, key)\n },\n ownKeys(object) {\n state.used = true\n return Reflect.ownKeys(object)\n },\n getOwnPropertyDescriptor(object, key) {\n state.used = true\n return Reflect.getOwnPropertyDescriptor(object, key)\n },\n })\n return { proxy, state }\n}\n\n/** Like React's `isValidElement` for a slot root: an element or a component. */\nconst isElementVNode = (node: VNode) => {\n const { type } = node\n if (type === Fragment || type === Text || type === Comment || type === Static) return false\n if (typeof type === \"object\" && type !== null && (\"__isTeleport\" in type || \"__isSuspense\" in type)) return false\n return true\n}\n\n/**\n * Template comments (`<!-- note -->`) are no children, like JSX comments.\n * The empty placeholder of a `v-if` that renders nothing (or of a `false`\n * child) still counts, like `{false}` in a React children array.\n */\nconst isTemplateComment = (node: VNodeArrayChildren[number]) =>\n isVNode(node) && node.type === Comment && !!node.children && node.children !== \"v-if\"\n\n/**\n * Unwraps content forwarded through a wrapper's `<slot />`: the fragment\n * `renderSlot` creates, keyed `_<slot name>`.\n */\nconst unwrapForwardedSlots = (nodes: VNodeArrayChildren): VNodeArrayChildren =>\n nodes.flatMap((node) =>\n isVNode(node) &&\n node.type === Fragment &&\n typeof node.key === \"string\" &&\n node.key.startsWith(\"_\") &&\n Array.isArray(node.children)\n ? unwrapForwardedSlots(node.children)\n : [node],\n )\n\n/** The one element a non-render-prop slot holds, if it holds exactly one. */\nconst singleElement = (nodes: VNodeArrayChildren): VNode | undefined => {\n const roots = unwrapForwardedSlots(nodes).filter((node) => !isTemplateComment(node))\n if (roots.length !== 1) return undefined\n const [root] = roots\n return isVNode(root) && isElementVNode(root) ? root : undefined\n}\n\n/** A child prop under its attribute name or its camelCase prop name. */\nconst childProp = (props: Props, name: string) => props[name] ?? props[camelize(name)]\n\n/**\n * `cloneElement(child, fieldProps)` with React Field's merging rules. A child\n * without its own name (`aria-label`, `aria-labelledby`, `label`, a `#label`\n * slot) is also labelled by the field's label, which names triggers `for`\n * cannot reach.\n */\nconst cloneWithFieldProps = (child: VNode, fieldChildProps: FieldChildProps, labelId: string): VNode => {\n const own: Props = { ...(child.props ?? {}) }\n const childDescribedBy = childProp(own, \"aria-describedby\") as string | undefined\n const childInvalid = childProp(own, \"aria-invalid\")\n const childSlots = child.children\n const childNamed =\n childProp(own, \"aria-label\") != null ||\n childProp(own, \"aria-labelledby\") != null ||\n own.label != null ||\n (childSlots != null && typeof childSlots === \"object\" && !Array.isArray(childSlots) && \"label\" in childSlots)\n\n const overrides: Props = {\n ...fieldChildProps,\n // Merge with the child's own associations instead of overwriting them\n \"aria-describedby\": [childDescribedBy, fieldChildProps[\"aria-describedby\"]].filter(Boolean).join(\" \") || undefined,\n \"aria-invalid\": childInvalid ?? fieldChildProps[\"aria-invalid\"],\n ...(!childNamed && { \"aria-labelledby\": labelId }),\n }\n\n // One spelling per prop, so the field's value is the one that applies\n for (const key of Object.keys(overrides)) {\n for (const spelling of [key, camelize(key), key.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`)]) {\n delete own[spelling]\n }\n }\n\n return cloneVNode({ ...child, props: own } as VNode, overrides)\n}\n\nconst FieldComponent = defineComponent({\n name: \"Field\",\n inheritAttrs: false,\n props: {\n /** Label text for the field (or the `label` slot) */\n label: String,\n /**\n * Hides the label from view; it still names the control. On a `row` the value or placeholder\n * then starts at the row's edge, as an iOS cell that shows only its value, so the row is\n * vertical unless `orientation` says otherwise. @default false\n */\n hideLabel: { type: Boolean, default: false },\n /** Helper text below the label, linked via `aria-describedby` (or the `description` slot) */\n description: String,\n /**\n * Error message below the control (or the `errorMessage` slot). When set,\n * the control gets `aria-invalid=\"true\"`. Rendered with FieldError.\n */\n errorMessage: String,\n /** Content at the end of the label row, such as a link that acts on the field (or the `labelAction` slot) */\n labelAction: String,\n /** Font size of the label, to match the control's size. @default the child control's `size`, else \"md\" */\n size: String as PropType<ControlSize>,\n /** Shows a required asterisk after the label. Visual only: no `required` attribute. @default false */\n required: { type: Boolean, default: false },\n /** Layout direction of label and control. @default \"horizontal\" on a `row` with a visible label, else \"vertical\" */\n orientation: String as PropType<\"vertical\" | \"horizontal\">,\n /** One line of a FieldGroup. Its non-interactive area focuses the text editor or activates the choice control or popup trigger. @default false */\n row: { type: Boolean, default: false },\n /** On a `row`, the control takes the rest of the line after the label. @default false */\n fill: { type: Boolean, default: false },\n /** Overrides the generated id set on the control and the label's `for`. A child's own `id` wins over both. */\n id: String,\n /** Optically aligns the control's text with surrounding content; passed to the control. */\n opticallyAlign: String as PropType<\"start\" | \"end\">,\n },\n slots: Object as SlotsType<{\n /** The control. Read the props to render them yourself (React's render prop). */\n default?: (fieldProps: FieldChildProps) => VNodeChild\n label?: () => VNodeChild\n labelAction?: () => VNodeChild\n /** On a `row`, a control at the end of the row, such as a button that adds to a list on a `fill` row. On a row whose\n * control is a radio (an info button after a network or a VPN) the radio's mark leads in the icon column. */\n action?: () => VNodeChild\n /** On a `row`, a symbol or an app's picture before the label, as an iOS cell's image (React's `icon`). */\n icon?: () => VNodeChild\n description?: () => VNodeChild\n errorMessage?: () => VNodeChild\n }>,\n setup(props, { attrs, slots }) {\n const generatedId = useId()\n let forwardingRowClick = false\n\n provideFieldRow(() => !!props.row && (props.orientation ?? (props.hideLabel ? \"vertical\" : \"horizontal\")) === \"horizontal\")\n\n return () => {\n const { required, row, opticallyAlign } = props\n const orientation = props.orientation ?? (row && !props.hideLabel ? \"horizontal\" : \"vertical\")\n const fieldId = props.id || `field-${generatedId}`\n const labelId = `${fieldId}-label`\n\n const description = slots.description ? slots.description() : props.description\n const hasDescription = slots.description ? hasContent(description as VNodeArrayChildren) : !!description\n const errorMessage = slots.errorMessage ? slots.errorMessage() : props.errorMessage\n const hasError = slots.errorMessage ? hasContent(errorMessage as VNodeArrayChildren) : !!errorMessage\n\n const descriptionId = hasDescription ? `${fieldId}-description` : undefined\n const errorId = hasError ? `${fieldId}-error` : undefined\n\n // Build aria-describedby from description + error IDs\n const ariaDescribedBy = [descriptionId, errorId].filter(Boolean).join(\" \") || undefined\n const invalid = hasError\n\n // Props to inject into the child control\n const fieldChildProps: FieldChildProps = {\n \"id\": fieldId,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": invalid || undefined,\n ...(opticallyAlign && { opticallyAlign }),\n }\n\n // Resolve the children\n let resolvedChildren: VNodeArrayChildren | undefined\n let childSize: unknown\n // The control's id, which the label's `for` has to match\n let controlId = fieldId\n if (slots.default) {\n const { proxy, state } = trackUse({ ...fieldChildProps, \"aria-labelledby\": labelId })\n const nodes = slots.default(proxy) as VNodeArrayChildren\n const child = state.used ? undefined : singleElement(nodes)\n childSize = child?.props?.size\n controlId = (child?.props?.id as string | undefined) || fieldId\n resolvedChildren = child ? [cloneWithFieldProps(child, { ...fieldChildProps, id: controlId }, labelId)] : nodes\n }\n const size = props.size ?? (CONTROL_SIZES.has(childSize) ? (childSize as ControlSize) : \"md\")\n\n const icon = row && slots.icon ? slots.icon() : null\n const labelAction = slots.labelAction ? slots.labelAction() : props.labelAction\n const hasLabelAction = slots.labelAction ? hasContent(labelAction as VNodeArrayChildren) : !!labelAction\n const labelElement = h(\"label\", { class: s.Label, id: labelId, for: controlId }, [\n slots.label ? slots.label() : props.label,\n required ? h(\"span\", { \"class\": s.RequiredIndicator, \"aria-hidden\": \"true\" }, \"*\") : null,\n ])\n\n return h(\n \"div\",\n mergeProps({\n ...(row && { ...attrs, onClick: undefined }),\n \"class\": clsx(s.Field, attrs.class as ClassValue),\n \"data-slot\": \"field\",\n \"data-size\": size,\n \"data-orientation\": orientation,\n \"data-optically-align\": opticallyAlign,\n \"data-row\": row ? \"\" : undefined,\n \"data-fill\": props.fill ? \"\" : undefined,\n \"data-label-hidden\": props.hideLabel ? \"\" : undefined,\n }, row ? {\n onClick: (event: MouseEvent) => {\n if (forwardingRowClick) return\n for (const handler of Array.isArray(attrs.onClick) ? attrs.onClick : [attrs.onClick]) {\n if (typeof handler === \"function\") handler(event)\n }\n if (event.defaultPrevented) return\n const target = event.target\n const root = event.currentTarget\n // The linked control keeps its state and keyboard behavior. Nested\n // actions, including a Select's clear button, keep their own click.\n if (!(target instanceof Element) || !(root instanceof HTMLElement) ||\n target.closest(\"[data-row]\") !== root ||\n target.closest('button, a, input, select, textarea, [role=\"button\"], [role=\"link\"], [contenteditable]:not([contenteditable=\"false\"])')) return\n const linkedControl = root.ownerDocument.getElementById(controlId)\n if (!linkedControl || linkedControl.closest(\"[data-row]\") !== root) return\n // Select's linked form proxy is inside its popup trigger. An\n // ordinary input never delegates to a sibling Unit popup.\n const control = linkedControl.matches('input[aria-hidden=\"true\"]')\n ? linkedControl.closest<HTMLElement>(':is(button, [role=\"button\"])[aria-haspopup]:not([aria-haspopup=\"false\"])') ?? linkedControl\n : linkedControl\n if (control.matches(':disabled, [disabled], [data-disabled], [aria-disabled=\"true\"], [data-loading], [aria-busy=\"true\"]')) return\n const label = target.closest(\"label\")\n // Native label activation stays native; span popup triggers need\n // forwarding from the Field's own label as well as its whitespace.\n if (label && (label.htmlFor !== linkedControl.id || label.control === linkedControl)) return\n // The row is the hit area for its plain editor. Focus only: a synthetic\n // click would also run input actions or disturb native text selection.\n if (control.matches('textarea, input:not([type]), input[type=\"text\"], input[type=\"email\"], input[type=\"password\"], input[type=\"search\"], input[type=\"tel\"], input[type=\"url\"], input[type=\"number\"]') &&\n !control.matches('[hidden], [aria-hidden=\"true\"]')) {\n control.focus({ preventScroll: true })\n return\n }\n if (!control.matches('button[role=\"radio\"], button[role=\"checkbox\"], button[role=\"switch\"], input[type=\"radio\"], input[type=\"checkbox\"], :is(button, [role=\"button\"])[aria-haspopup]:not([aria-haspopup=\"false\"])')) return\n forwardingRowClick = true\n try {\n control.focus({ preventScroll: true })\n control.click()\n } finally {\n // Form controls can bubble their hidden input click after the render flush.\n queueMicrotask(() => { forwardingRowClick = false })\n }\n },\n } : {}),\n [\n icon && hasContent(icon as VNodeArrayChildren) ? h(\"div\", { class: s.Icon, \"aria-hidden\": \"true\" }, [icon as VNodeChild]) : null,\n h(\"div\", { class: s.LabelGroup }, [\n hasLabelAction\n ? h(\"div\", { class: s.LabelRow }, [labelElement, h(\"div\", { class: s.LabelAction }, [labelAction as VNodeChild])])\n : labelElement,\n hasDescription ? h(\"div\", { class: s.Description, id: descriptionId }, [description as VNodeChild]) : null,\n ]),\n h(\"div\", { class: s.Content }, [\n h(\"div\", { class: s.Control }, resolvedChildren),\n hasError ? h(FieldError, { id: errorId }, () => [errorMessage as VNodeChild]) : null,\n ]),\n row && slots.action ? h(\"div\", { class: s.Action }, [slots.action()]) : null,\n ],\n )\n }\n },\n})\n\ntype FieldOwnProps = InstanceType<typeof FieldComponent>[\"$props\"]\n\n/** Field props; `class` reaches the root element. */\nexport type FieldProps = FieldOwnProps & { class?: ClassValue }\n\n/** Form field wrapper with label, description, error and accessibility linking. */\nexport const Field = FieldComponent as typeof FieldComponent & { new (): { $props: FieldProps } }\n"]}
|
|
1
|
+
{"version":3,"file":"Field.js","sourceRoot":"","sources":["../../../../src/components/Field/Field.ts"],"names":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E,CAAC,CAAC,WAAW,EAAE,EAAE,EAAE,aAAa,EAAE,EAAE,CAAC,WAAyB,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI;iBAC3G,CAAC;gBACF,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE;oBAC7B,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,gBAAgB,CAAC;oBAChD,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,YAA0B,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI;iBACrF,CAAC;gBACF,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI;aAC7E,CACF,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAOF,mFAAmF;AACnF,MAAM,CAAC,MAAM,KAAK,GAAG,cAA4E,CAAA","sourcesContent":["import clsx, { type ClassValue } from \"clsx\"\nimport {\n Comment,\n Fragment,\n Static,\n Text,\n camelize,\n cloneVNode,\n defineComponent,\n h,\n isVNode,\n mergeProps,\n useId,\n type PropType,\n type SlotsType,\n type VNode,\n type VNodeArrayChildren,\n type VNodeChild,\n} from \"vue\"\nimport type { ControlSize } from \"@plexui/styles/types\"\nimport { FieldError } from \"../FieldError/index.js\"\nimport { provideFieldRow } from \"../../lib/fieldRow.js\"\nimport { hasContent } from \"../../lib/slotContent.js\"\nimport s from \"@plexui/styles/components/Field/Field.module.css\"\n\n// Vue port of packages/ui/src/components/Field/Field.tsx.\n//\n// - `label`, `description` and `errorMessage` take a string prop or a slot of\n// the same name (the slot wins), like React's ReactNode props.\n// - Children: React accepts an element, which Field clones with the field\n// props, or a render prop `(fieldProps) => ReactNode`, which it leaves alone.\n// Both are the default slot here, which receives the field props:\n// - a slot that reads them (`v-slot=\"fieldProps\"` + `v-bind=\"fieldProps\"`,\n// `v-slot=\"{ id }\"`, `(fieldProps) => h(...)`) is the render prop: its\n// content renders as it is.\n// - a slot that does not read them and holds exactly one element or\n// component gets it cloned like React's `cloneElement`: `opticallyAlign`\n// replaces the child's own, the child's own `id` stays and the label's\n// `for` follows it, `aria-describedby` is joined after the child's own\n// ids, and an explicit `aria-invalid` on the child wins. Template\n// comments do not count as children (JSX comments); the\n// placeholder of a `v-if` that renders nothing does, like `{false}` in a\n// React children array, so `<A v-if=\"x\" /><Input />` is not cloned.\n// - anything else (text, several roots, a `v-for` list) renders as it is,\n// like a React child that is not a single element.\n// - content a wrapper forwards with `<slot />` counts as its own roots, as\n// React's `children` passed on to Field are the elements themselves.\n// - As in React only `class` reaches the root element; other attributes are\n// dropped. On a `row` they all reach it, as React's rest props do.\n\n// What a row's press can reach: a form control, a popup trigger, a choice\nconst ROW_CONTROL = 'input:not([type=\"hidden\"]):not([aria-hidden=\"true\"]), textarea, select, button, [role=\"button\"], [role=\"switch\"], [role=\"checkbox\"], [role=\"radio\"], [role=\"combobox\"]'\n\n/** The one control inside a wrapper that took the Field's id; a control nested in another (a clear button in a\n * trigger) counts as part of it. */\nfunction soleRowControl(wrapper: HTMLElement): HTMLElement | null {\n const found = Array.from(wrapper.querySelectorAll<HTMLElement>(ROW_CONTROL))\n const outer = found.filter((element) => !found.some((other) => other !== element && other.contains(element)))\n return outer.length === 1 ? outer[0] : null\n}\n\nexport type FieldChildProps = {\n id: string\n /** The label's id. Bind it to a control that the label's `for` cannot name, such as a Select trigger. */\n \"aria-labelledby\"?: string\n \"aria-describedby\"?: string\n \"aria-invalid\"?: boolean\n opticallyAlign?: \"start\" | \"end\"\n}\n\ntype Props = Record<string, unknown>\n\nconst CONTROL_SIZES: ReadonlySet<unknown> = new Set([\"3xs\", \"2xs\", \"xs\", \"sm\", \"md\", \"lg\", \"xl\", \"2xl\", \"3xl\"])\n\n/** The slot props, recording whether the slot read them (the render-prop form). */\nconst trackUse = (target: FieldChildProps) => {\n const state = { used: false }\n const proxy = new Proxy(target, {\n get(object, key, receiver) {\n state.used = true\n return Reflect.get(object, key, receiver)\n },\n has(object, key) {\n state.used = true\n return Reflect.has(object, key)\n },\n ownKeys(object) {\n state.used = true\n return Reflect.ownKeys(object)\n },\n getOwnPropertyDescriptor(object, key) {\n state.used = true\n return Reflect.getOwnPropertyDescriptor(object, key)\n },\n })\n return { proxy, state }\n}\n\n/** Like React's `isValidElement` for a slot root: an element or a component. */\nconst isElementVNode = (node: VNode) => {\n const { type } = node\n if (type === Fragment || type === Text || type === Comment || type === Static) return false\n if (typeof type === \"object\" && type !== null && (\"__isTeleport\" in type || \"__isSuspense\" in type)) return false\n return true\n}\n\n/**\n * Template comments (`<!-- note -->`) are no children, like JSX comments.\n * The empty placeholder of a `v-if` that renders nothing (or of a `false`\n * child) still counts, like `{false}` in a React children array.\n */\nconst isTemplateComment = (node: VNodeArrayChildren[number]) =>\n isVNode(node) && node.type === Comment && !!node.children && node.children !== \"v-if\"\n\n/**\n * Unwraps content forwarded through a wrapper's `<slot />`: the fragment\n * `renderSlot` creates, keyed `_<slot name>`.\n */\nconst unwrapForwardedSlots = (nodes: VNodeArrayChildren): VNodeArrayChildren =>\n nodes.flatMap((node) =>\n isVNode(node) &&\n node.type === Fragment &&\n typeof node.key === \"string\" &&\n node.key.startsWith(\"_\") &&\n Array.isArray(node.children)\n ? unwrapForwardedSlots(node.children)\n : [node],\n )\n\n/** The one element a non-render-prop slot holds, if it holds exactly one. */\nconst singleElement = (nodes: VNodeArrayChildren): VNode | undefined => {\n const roots = unwrapForwardedSlots(nodes).filter((node) => !isTemplateComment(node))\n if (roots.length !== 1) return undefined\n const [root] = roots\n return isVNode(root) && isElementVNode(root) ? root : undefined\n}\n\n/** A child prop under its attribute name or its camelCase prop name. */\nconst childProp = (props: Props, name: string) => props[name] ?? props[camelize(name)]\n\n/**\n * `cloneElement(child, fieldProps)` with React Field's merging rules. A child\n * without its own name (`aria-label`, `aria-labelledby`, `label`, a `#label`\n * slot) is also labelled by the field's label, which names triggers `for`\n * cannot reach.\n */\nconst cloneWithFieldProps = (child: VNode, fieldChildProps: FieldChildProps, labelId: string): VNode => {\n const own: Props = { ...(child.props ?? {}) }\n const childDescribedBy = childProp(own, \"aria-describedby\") as string | undefined\n const childInvalid = childProp(own, \"aria-invalid\")\n const childSlots = child.children\n const childNamed =\n childProp(own, \"aria-label\") != null ||\n childProp(own, \"aria-labelledby\") != null ||\n own.label != null ||\n (childSlots != null && typeof childSlots === \"object\" && !Array.isArray(childSlots) && \"label\" in childSlots)\n\n const overrides: Props = {\n ...fieldChildProps,\n // Merge with the child's own associations instead of overwriting them\n \"aria-describedby\": [childDescribedBy, fieldChildProps[\"aria-describedby\"]].filter(Boolean).join(\" \") || undefined,\n \"aria-invalid\": childInvalid ?? fieldChildProps[\"aria-invalid\"],\n ...(!childNamed && { \"aria-labelledby\": labelId }),\n }\n\n // One spelling per prop, so the field's value is the one that applies\n for (const key of Object.keys(overrides)) {\n for (const spelling of [key, camelize(key), key.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`)]) {\n delete own[spelling]\n }\n }\n\n return cloneVNode({ ...child, props: own } as VNode, overrides)\n}\n\nconst FieldComponent = defineComponent({\n name: \"Field\",\n inheritAttrs: false,\n props: {\n /** Label text for the field (or the `label` slot) */\n label: String,\n /**\n * Hides the label from view; it still names the control. On a `row` the value or placeholder\n * then starts at the row's edge, as an iOS cell that shows only its value, so the row is\n * vertical unless `orientation` says otherwise. @default false\n */\n hideLabel: { type: Boolean, default: false },\n /** Helper text below the label, linked via `aria-describedby` (or the `description` slot) */\n description: String,\n /**\n * Error message below the control (or the `errorMessage` slot). When set,\n * the control gets `aria-invalid=\"true\"`. Rendered with FieldError.\n */\n errorMessage: String,\n /** Content at the end of the label row, such as a link that acts on the field (or the `labelAction` slot) */\n labelAction: String,\n /** Font size of the label, to match the control's size. @default the child control's `size`, else \"md\" */\n size: String as PropType<ControlSize>,\n /** Shows a required asterisk after the label. Visual only: no `required` attribute. @default false */\n required: { type: Boolean, default: false },\n /** Layout direction of label and control. @default \"horizontal\" on a `row` with a visible label, else \"vertical\" */\n orientation: String as PropType<\"vertical\" | \"horizontal\">,\n /** One line of a FieldGroup. Its non-interactive area focuses the text editor or activates the choice control or popup trigger. @default false */\n row: { type: Boolean, default: false },\n /** On a `row`, the control takes the rest of the line after the label. @default false */\n fill: { type: Boolean, default: false },\n /** Overrides the generated id set on the control and the label's `for`. A child's own `id` wins over both. */\n id: String,\n /** Optically aligns the control's text with surrounding content; passed to the control. */\n opticallyAlign: String as PropType<\"start\" | \"end\">,\n },\n slots: Object as SlotsType<{\n /** The control. Read the props to render them yourself (React's render prop). */\n default?: (fieldProps: FieldChildProps) => VNodeChild\n label?: () => VNodeChild\n labelAction?: () => VNodeChild\n /** On a `row`, a control at the end of the row, such as a button that adds to a list on a `fill` row. On a row whose\n * control is a radio (an info button after a network or a VPN) the radio's mark leads in the icon column. */\n action?: () => VNodeChild\n /** On a `row`, a symbol or an app's picture before the label, as an iOS cell's image (React's `icon`). */\n icon?: () => VNodeChild\n description?: () => VNodeChild\n errorMessage?: () => VNodeChild\n }>,\n setup(props, { attrs, slots }) {\n const generatedId = useId()\n let forwardingRowClick = false\n\n provideFieldRow(() => !!props.row && (props.orientation ?? (props.hideLabel ? \"vertical\" : \"horizontal\")) === \"horizontal\")\n\n return () => {\n const { required, row, opticallyAlign } = props\n const orientation = props.orientation ?? (row && !props.hideLabel ? \"horizontal\" : \"vertical\")\n const fieldId = props.id || `field-${generatedId}`\n const labelId = `${fieldId}-label`\n\n const description = slots.description ? slots.description() : props.description\n const hasDescription = slots.description ? hasContent(description as VNodeArrayChildren) : !!description\n const errorMessage = slots.errorMessage ? slots.errorMessage() : props.errorMessage\n const hasError = slots.errorMessage ? hasContent(errorMessage as VNodeArrayChildren) : !!errorMessage\n\n const descriptionId = hasDescription ? `${fieldId}-description` : undefined\n const errorId = hasError ? `${fieldId}-error` : undefined\n\n // Build aria-describedby from description + error IDs\n const ariaDescribedBy = [descriptionId, errorId].filter(Boolean).join(\" \") || undefined\n const invalid = hasError\n\n // Props to inject into the child control\n const fieldChildProps: FieldChildProps = {\n \"id\": fieldId,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": invalid || undefined,\n ...(opticallyAlign && { opticallyAlign }),\n }\n\n // Resolve the children\n let resolvedChildren: VNodeArrayChildren | undefined\n let childSize: unknown\n // The control's id, which the label's `for` has to match\n let controlId = fieldId\n if (slots.default) {\n const { proxy, state } = trackUse({ ...fieldChildProps, \"aria-labelledby\": labelId })\n const nodes = slots.default(proxy) as VNodeArrayChildren\n const child = state.used ? undefined : singleElement(nodes)\n childSize = child?.props?.size\n controlId = (child?.props?.id as string | undefined) || fieldId\n resolvedChildren = child ? [cloneWithFieldProps(child, { ...fieldChildProps, id: controlId }, labelId)] : nodes\n }\n const size = props.size ?? (CONTROL_SIZES.has(childSize) ? (childSize as ControlSize) : \"md\")\n\n const icon = row && slots.icon ? slots.icon() : null\n const labelAction = slots.labelAction ? slots.labelAction() : props.labelAction\n const hasLabelAction = slots.labelAction ? hasContent(labelAction as VNodeArrayChildren) : !!labelAction\n const labelElement = h(\"label\", { class: s.Label, id: labelId, for: controlId }, [\n slots.label ? slots.label() : props.label,\n required ? h(\"span\", { \"class\": s.RequiredIndicator, \"aria-hidden\": \"true\" }, \"*\") : null,\n ])\n\n return h(\n \"div\",\n mergeProps({\n ...(row && { ...attrs, onClick: undefined }),\n \"class\": clsx(s.Field, attrs.class as ClassValue),\n \"data-slot\": \"field\",\n \"data-size\": size,\n \"data-orientation\": orientation,\n \"data-optically-align\": opticallyAlign,\n \"data-row\": row ? \"\" : undefined,\n \"data-fill\": props.fill ? \"\" : undefined,\n \"data-label-hidden\": props.hideLabel ? \"\" : undefined,\n }, row ? {\n onClick: (event: MouseEvent) => {\n if (forwardingRowClick) return\n for (const handler of Array.isArray(attrs.onClick) ? attrs.onClick : [attrs.onClick]) {\n if (typeof handler === \"function\") handler(event)\n }\n if (event.defaultPrevented) return\n const target = event.target\n const root = event.currentTarget\n // The linked control keeps its state and keyboard behavior. Nested\n // actions, including a Select's clear button, keep their own click.\n if (!(target instanceof Element) || !(root instanceof HTMLElement) ||\n target.closest(\"[data-row]\") !== root ||\n target.closest('button, a, input, select, textarea, [role=\"button\"], [role=\"link\"], [contenteditable]:not([contenteditable=\"false\"])')) return\n const linkedControl = root.ownerDocument.getElementById(controlId)\n if (!linkedControl || linkedControl.closest(\"[data-row]\") !== root) return\n // Select's linked form proxy is inside its popup trigger. An\n // ordinary input never delegates to a sibling Unit popup.\n const direct = linkedControl.matches('input[aria-hidden=\"true\"]')\n ? linkedControl.closest<HTMLElement>(':is(button, [role=\"button\"])[aria-haspopup]:not([aria-haspopup=\"false\"])') ?? linkedControl\n : linkedControl\n // A product's own wrapper may take the id (a row component around a Select): the row then reaches the one\n // control inside it, as an iOS cell does; with two controls, or none, the press stays on the row.\n const control = direct === linkedControl && !linkedControl.matches(ROW_CONTROL) ? soleRowControl(linkedControl) : direct\n // A control of a row nested in the wrapper belongs to that row\n if (!control || control.closest(\"[data-row]\") !== root) return\n if (control.matches(':disabled, [disabled], [data-disabled], [aria-disabled=\"true\"], [data-loading], [aria-busy=\"true\"]')) return\n const label = target.closest(\"label\")\n // Native label activation stays native; span popup triggers need\n // forwarding from the Field's own label as well as its whitespace.\n if (label && (label.htmlFor !== linkedControl.id || label.control === linkedControl)) return\n // The row is the hit area for its plain editor. Focus only: a synthetic\n // click would also run input actions or disturb native text selection.\n if (control.matches('textarea, input:not([type]), input[type=\"text\"], input[type=\"email\"], input[type=\"password\"], input[type=\"search\"], input[type=\"tel\"], input[type=\"url\"], input[type=\"number\"]') &&\n !control.matches('[hidden], [aria-hidden=\"true\"]')) {\n control.focus({ preventScroll: true })\n return\n }\n if (!control.matches('button[role=\"radio\"], button[role=\"checkbox\"], button[role=\"switch\"], input[type=\"radio\"], input[type=\"checkbox\"], :is(button, [role=\"button\"])[aria-haspopup]:not([aria-haspopup=\"false\"])')) return\n forwardingRowClick = true\n try {\n control.focus({ preventScroll: true })\n control.click()\n } finally {\n // Form controls can bubble their hidden input click after the render flush.\n queueMicrotask(() => { forwardingRowClick = false })\n }\n },\n } : {}),\n [\n icon && hasContent(icon as VNodeArrayChildren) ? h(\"div\", { class: s.Icon, \"aria-hidden\": \"true\" }, [icon as VNodeChild]) : null,\n h(\"div\", { class: s.LabelGroup }, [\n hasLabelAction\n ? h(\"div\", { class: s.LabelRow }, [labelElement, h(\"div\", { class: s.LabelAction }, [labelAction as VNodeChild])])\n : labelElement,\n hasDescription ? h(\"div\", { class: s.Description, id: descriptionId }, [description as VNodeChild]) : null,\n ]),\n h(\"div\", { class: s.Content }, [\n h(\"div\", { class: s.Control }, resolvedChildren),\n hasError ? h(FieldError, { id: errorId }, () => [errorMessage as VNodeChild]) : null,\n ]),\n row && slots.action ? h(\"div\", { class: s.Action }, [slots.action()]) : null,\n ],\n )\n }\n },\n})\n\ntype FieldOwnProps = InstanceType<typeof FieldComponent>[\"$props\"]\n\n/** Field props; `class` reaches the root element. */\nexport type FieldProps = FieldOwnProps & { class?: ClassValue }\n\n/** Form field wrapper with label, description, error and accessibility linking. */\nexport const Field = FieldComponent as typeof FieldComponent & { new (): { $props: FieldProps } }\n"]}
|
|
@@ -4,8 +4,25 @@ import s from "@plexui/styles/components/SwipeActions/SwipeActions.module.css";
|
|
|
4
4
|
const SLOP = 10;
|
|
5
5
|
/** The width an open row moves by is the border box of its actions, edge and content gaps included. */
|
|
6
6
|
const BORDER_BOX = { box: "border-box" };
|
|
7
|
+
/** A finger lifting faster than this (px/ms) opens the side it moves toward, or closes the row when it moves back, however short the swipe. */
|
|
8
|
+
const FLICK = 0.3;
|
|
9
|
+
/** A finger that stopped this long (ms) before it lifted flicks nothing. */
|
|
10
|
+
const FLICK_WINDOW = 100;
|
|
11
|
+
/** A trackpad swipe (horizontal wheel) ends when no wheel event has come for this long (ms). */
|
|
12
|
+
const WHEEL_IDLE = 120;
|
|
7
13
|
/** Controls that take a horizontal drag themselves. */
|
|
8
14
|
const OWN_DRAG = 'input, textarea, select, [contenteditable]:not([contenteditable="false"]), [role="slider"]';
|
|
15
|
+
/** Whether a wheel over `target` belongs to a control or a box inside the row that scrolls across itself. */
|
|
16
|
+
const scrollsAcross = (target, row) => {
|
|
17
|
+
for (let element = target instanceof Element ? target : null; element && element !== row; element = element.parentElement) {
|
|
18
|
+
if (element.matches(OWN_DRAG))
|
|
19
|
+
return true;
|
|
20
|
+
const overflow = getComputedStyle(element).overflowX;
|
|
21
|
+
if ((overflow === "auto" || overflow === "scroll") && element.scrollWidth > element.clientWidth)
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
return false;
|
|
25
|
+
};
|
|
9
26
|
/** The open row: opening another one closes it, as a list keeps one row open. */
|
|
10
27
|
let closeOpenRow = null;
|
|
11
28
|
/** The row keeps the finger past its edges; a pointer that is no longer active (it lifted between events) cannot be held. */
|
|
@@ -18,6 +35,26 @@ const capture = (element, pointerId) => {
|
|
|
18
35
|
}
|
|
19
36
|
};
|
|
20
37
|
const sideOf = (offset) => offset > 0 ? "leading" : offset < 0 ? "trailing" : undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Where a swipe that ended at `offset` settles: a flick (`velocity` px/ms, toward the trailing edge when positive)
|
|
40
|
+
* opens the side it moves toward and closes the row when it moves back; a slow one opens a side moved past half its
|
|
41
|
+
* `width`.
|
|
42
|
+
*/
|
|
43
|
+
export const swipeActionsSettle = (offset, velocity, width) => {
|
|
44
|
+
if (Math.abs(velocity) >= FLICK)
|
|
45
|
+
return Math.sign(velocity) === Math.sign(offset);
|
|
46
|
+
return Math.abs(offset) >= width / 2;
|
|
47
|
+
};
|
|
48
|
+
/** The duration (ms) the row moves in, none when the motion is reduced. */
|
|
49
|
+
const durationOf = (element) => {
|
|
50
|
+
if (typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches)
|
|
51
|
+
return 0;
|
|
52
|
+
const value = getComputedStyle(element).getPropertyValue("--swipe-actions-duration").trim();
|
|
53
|
+
const time = parseFloat(value);
|
|
54
|
+
if (!Number.isFinite(time))
|
|
55
|
+
return 0;
|
|
56
|
+
return value.endsWith("ms") ? time : time * 1000;
|
|
57
|
+
};
|
|
21
58
|
/**
|
|
22
59
|
* Where the content goes for a swipe of `raw` px toward the trailing edge (negative: toward the leading edge), and
|
|
23
60
|
* whether that is a full swipe. A side without actions stays shut. Past its actions the content follows the finger
|
|
@@ -57,6 +94,13 @@ const SwipeActionsComponent = defineComponent({
|
|
|
57
94
|
const swiping = ref(false);
|
|
58
95
|
const rtl = ref(false);
|
|
59
96
|
const round = ref(false);
|
|
97
|
+
const removing = ref(false);
|
|
98
|
+
const height = ref(undefined);
|
|
99
|
+
/** The timers of a removal and of a trackpad swipe, cleared when the row goes. */
|
|
100
|
+
const timeouts = [];
|
|
101
|
+
let wheelTimer = 0;
|
|
102
|
+
/** A trackpad swipe: where it started, how far it went, the widths at its start. `locked` drops the momentum after it. */
|
|
103
|
+
let wheel = null;
|
|
60
104
|
const root = ref(null);
|
|
61
105
|
const sides = { leading: null, trailing: null };
|
|
62
106
|
let gesture = null;
|
|
@@ -76,7 +120,19 @@ const SwipeActionsComponent = defineComponent({
|
|
|
76
120
|
state?.detach();
|
|
77
121
|
return state;
|
|
78
122
|
};
|
|
123
|
+
/** No action of the row keeps the focus. */
|
|
124
|
+
const blurActions = () => {
|
|
125
|
+
const focused = document.activeElement;
|
|
126
|
+
if (focused instanceof HTMLElement && (sides.leading?.contains(focused) || sides.trailing?.contains(focused)))
|
|
127
|
+
focused.blur();
|
|
128
|
+
};
|
|
79
129
|
const close = () => {
|
|
130
|
+
if (removing.value)
|
|
131
|
+
return;
|
|
132
|
+
// Whatever closes or opens the row (a press, the focus, another row) ends a trackpad swipe and its momentum.
|
|
133
|
+
lockWheel();
|
|
134
|
+
// A closed row hides its actions, so none keeps the focus (Enter would run a hidden action).
|
|
135
|
+
blurActions();
|
|
80
136
|
if (closeOpenRow === closer)
|
|
81
137
|
closeOpenRow = null;
|
|
82
138
|
move(0);
|
|
@@ -90,6 +146,7 @@ const SwipeActionsComponent = defineComponent({
|
|
|
90
146
|
if (state.swiping)
|
|
91
147
|
suppressClick = true;
|
|
92
148
|
}
|
|
149
|
+
lockWheel();
|
|
93
150
|
close();
|
|
94
151
|
};
|
|
95
152
|
/** This row takes the place of the open one. */
|
|
@@ -100,8 +157,11 @@ const SwipeActionsComponent = defineComponent({
|
|
|
100
157
|
};
|
|
101
158
|
/** Shows a side as wide as its actions (`width` when known), or closes the row when that side has none (any more). */
|
|
102
159
|
const open = (side, width = widthOf(side)) => {
|
|
160
|
+
if (removing.value)
|
|
161
|
+
return;
|
|
103
162
|
if (!(width > 0))
|
|
104
163
|
return close();
|
|
164
|
+
lockWheel();
|
|
105
165
|
claim();
|
|
106
166
|
rtl.value = isRtl();
|
|
107
167
|
move(side === "leading" ? width : -width);
|
|
@@ -109,7 +169,7 @@ const SwipeActionsComponent = defineComponent({
|
|
|
109
169
|
/** An open row follows its actions: more of them, other labels or another width move it to their new width. */
|
|
110
170
|
const sync = () => {
|
|
111
171
|
const side = sideOf(offset.value);
|
|
112
|
-
if (!side || gesture?.swiping || full.value)
|
|
172
|
+
if (!side || removing.value || gesture?.swiping || (wheel && wheel !== "locked") || full.value)
|
|
113
173
|
return;
|
|
114
174
|
const width = widthOf(side);
|
|
115
175
|
if (!(width > 0))
|
|
@@ -149,46 +209,164 @@ const SwipeActionsComponent = defineComponent({
|
|
|
149
209
|
});
|
|
150
210
|
fit();
|
|
151
211
|
observeSides();
|
|
212
|
+
// A trackpad swipe has to stop the page's own scroll and back gesture, which a passive listener cannot.
|
|
213
|
+
root.value?.addEventListener("wheel", handleWheel, { passive: false });
|
|
152
214
|
});
|
|
153
215
|
onUpdated(() => {
|
|
154
216
|
fit();
|
|
155
217
|
sync();
|
|
156
218
|
observeSides();
|
|
157
219
|
});
|
|
158
|
-
// A press anywhere outside the open row closes it.
|
|
220
|
+
// A press anywhere outside the open row closes it, while a trackpad moves it too; a finger's own swipe keeps it.
|
|
159
221
|
const handleOutsidePointerDown = (event) => {
|
|
160
222
|
if (event.target instanceof Node && root.value?.contains(event.target))
|
|
161
223
|
return;
|
|
224
|
+
if (gesture?.swiping)
|
|
225
|
+
return;
|
|
162
226
|
close();
|
|
163
227
|
};
|
|
164
|
-
watch(
|
|
228
|
+
watch(revealed, (side) => {
|
|
165
229
|
document.removeEventListener("pointerdown", handleOutsidePointerDown, true);
|
|
166
|
-
if (side
|
|
230
|
+
if (side)
|
|
167
231
|
document.addEventListener("pointerdown", handleOutsidePointerDown, true);
|
|
168
232
|
});
|
|
169
233
|
// The open row lets go of the list, and of the finger, when it goes away.
|
|
170
234
|
onBeforeUnmount(() => {
|
|
171
235
|
document.removeEventListener("pointerdown", handleOutsidePointerDown, true);
|
|
236
|
+
root.value?.removeEventListener("wheel", handleWheel);
|
|
237
|
+
for (const id of timeouts)
|
|
238
|
+
window.clearTimeout(id);
|
|
239
|
+
window.clearTimeout(wheelTimer);
|
|
172
240
|
observer?.disconnect();
|
|
173
241
|
observer = null;
|
|
174
242
|
release();
|
|
175
243
|
if (closeOpenRow === closer)
|
|
176
244
|
closeOpenRow = null;
|
|
177
245
|
});
|
|
178
|
-
|
|
246
|
+
/**
|
|
247
|
+
* A destructive action: the content slides out to the side it was swiped to (the trailing one when pressed from
|
|
248
|
+
* the keys) and the row collapses, then the action runs; a row the list keeps comes back closed.
|
|
249
|
+
*/
|
|
250
|
+
const remove = (action, side) => {
|
|
251
|
+
const element = root.value;
|
|
252
|
+
if (!element || removing.value)
|
|
253
|
+
return;
|
|
254
|
+
const duration = durationOf(element);
|
|
255
|
+
const width = element.clientWidth;
|
|
256
|
+
claim();
|
|
257
|
+
height.value = element.getBoundingClientRect().height;
|
|
258
|
+
rtl.value = isRtl();
|
|
259
|
+
move(side === "leading" ? width : -width, full.value);
|
|
260
|
+
removing.value = true;
|
|
261
|
+
lockWheel();
|
|
262
|
+
timeouts.push(window.setTimeout(() => {
|
|
263
|
+
action.onSelect?.();
|
|
264
|
+
// A row the list dropped is gone by now; one it keeps comes back.
|
|
265
|
+
timeouts.push(window.setTimeout(() => {
|
|
266
|
+
removing.value = false;
|
|
267
|
+
height.value = undefined;
|
|
268
|
+
// An action that keeps the focus (chosen from the keys) keeps its side open, so the focus is never on a hidden action.
|
|
269
|
+
const focused = document.activeElement;
|
|
270
|
+
const side = ["leading", "trailing"].find((name) => !!focused && !!sides[name]?.contains(focused));
|
|
271
|
+
if (side)
|
|
272
|
+
open(side);
|
|
273
|
+
else
|
|
274
|
+
close();
|
|
275
|
+
}));
|
|
276
|
+
}, duration));
|
|
277
|
+
};
|
|
278
|
+
/** Runs an action from its side: a destructive one removes the row first. */
|
|
279
|
+
const run = (action, side) => {
|
|
280
|
+
if (!action)
|
|
281
|
+
return close();
|
|
282
|
+
if (action.role === "destructive")
|
|
283
|
+
return remove(action, side);
|
|
284
|
+
action.onSelect?.();
|
|
285
|
+
close();
|
|
286
|
+
};
|
|
287
|
+
const settle = (state, velocity = 0) => {
|
|
179
288
|
const side = sideOf(offset.value);
|
|
180
289
|
if (!side)
|
|
181
290
|
return close();
|
|
182
|
-
if (full.value)
|
|
183
|
-
(side === "leading" ? props.leading : props.trailing)[0]
|
|
184
|
-
return close();
|
|
185
|
-
}
|
|
291
|
+
if (full.value)
|
|
292
|
+
return run((side === "leading" ? props.leading : props.trailing)[0], side);
|
|
186
293
|
// The widths from the start of the swipe: a full swipe may have stretched the actions since.
|
|
187
|
-
if (
|
|
294
|
+
if (swipeActionsSettle(offset.value, velocity, state.widths[side]))
|
|
188
295
|
open(side, state.widths[side]);
|
|
189
296
|
else
|
|
190
297
|
close();
|
|
191
298
|
};
|
|
299
|
+
/** A trackpad swipe that has not settled yet settles no more, where it stands (a press or a removal takes over). */
|
|
300
|
+
function stopWheel() {
|
|
301
|
+
window.clearTimeout(wheelTimer);
|
|
302
|
+
if (wheel && wheel !== "locked")
|
|
303
|
+
swiping.value = false;
|
|
304
|
+
wheel = null;
|
|
305
|
+
}
|
|
306
|
+
/** Another row took over: this row's trackpad swipe ends here, and the momentum after it moves nothing. */
|
|
307
|
+
function lockWheel() {
|
|
308
|
+
if (!wheel || wheel === "locked")
|
|
309
|
+
return;
|
|
310
|
+
stopWheel();
|
|
311
|
+
wheel = "locked";
|
|
312
|
+
wheelTimer = window.setTimeout(() => {
|
|
313
|
+
wheel = null;
|
|
314
|
+
}, WHEEL_IDLE);
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* A two-finger swipe on a trackpad moves the row as a finger does, without a full swipe (the momentum after the
|
|
318
|
+
* fingers lift would run an action), and settles when the wheel stops. A swipe down scrolls the page.
|
|
319
|
+
*/
|
|
320
|
+
function handleWheel(event) {
|
|
321
|
+
if (event.ctrlKey)
|
|
322
|
+
return;
|
|
323
|
+
const horizontal = Math.abs(event.deltaX) > Math.abs(event.deltaY);
|
|
324
|
+
let state = wheel;
|
|
325
|
+
// The momentum after a swipe keeps the lock until it stops, a removal or not.
|
|
326
|
+
if (state === "locked") {
|
|
327
|
+
window.clearTimeout(wheelTimer);
|
|
328
|
+
if (horizontal)
|
|
329
|
+
event.preventDefault();
|
|
330
|
+
wheelTimer = window.setTimeout(() => {
|
|
331
|
+
wheel = null;
|
|
332
|
+
}, WHEEL_IDLE);
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
if (removing.value || gesture || (props.leading.length < 1 && props.trailing.length < 1))
|
|
336
|
+
return;
|
|
337
|
+
if (!state && (!horizontal || scrollsAcross(event.target, root.value)))
|
|
338
|
+
return;
|
|
339
|
+
window.clearTimeout(wheelTimer);
|
|
340
|
+
event.preventDefault();
|
|
341
|
+
if (!state) {
|
|
342
|
+
// The row moves under the focus: an action that has it lets it go, as a closed row does.
|
|
343
|
+
const start = offset.value;
|
|
344
|
+
blurActions();
|
|
345
|
+
state = { start, across: 0, widths: { leading: widthOf("leading"), trailing: widthOf("trailing") }, rowWidth: root.value?.clientWidth ?? 0 };
|
|
346
|
+
wheel = state;
|
|
347
|
+
claim();
|
|
348
|
+
rtl.value = isRtl();
|
|
349
|
+
swiping.value = true;
|
|
350
|
+
}
|
|
351
|
+
const scale = event.deltaMode === 1 ? 16 : event.deltaMode === 2 ? state.rowWidth : 1;
|
|
352
|
+
// The page scrolls the other way the fingers move: fingers moving left give a positive deltaX.
|
|
353
|
+
state.across -= event.deltaX * scale * (isRtl() ? -1 : 1);
|
|
354
|
+
const next = swipeActionsOffset(state.start + state.across, state.widths, state.rowWidth, false);
|
|
355
|
+
move(next.offset);
|
|
356
|
+
const widths = state.widths;
|
|
357
|
+
wheelTimer = window.setTimeout(() => {
|
|
358
|
+
wheel = "locked";
|
|
359
|
+
swiping.value = false;
|
|
360
|
+
const side = sideOf(offset.value);
|
|
361
|
+
if (side && swipeActionsSettle(offset.value, 0, widths[side]))
|
|
362
|
+
open(side, widths[side]);
|
|
363
|
+
else
|
|
364
|
+
close();
|
|
365
|
+
wheelTimer = window.setTimeout(() => {
|
|
366
|
+
wheel = null;
|
|
367
|
+
}, WHEEL_IDLE);
|
|
368
|
+
}, WHEEL_IDLE);
|
|
369
|
+
}
|
|
192
370
|
/** The finger lifted (anywhere): a swipe settles, a press on an open row closes it. */
|
|
193
371
|
const finish = () => {
|
|
194
372
|
const state = release();
|
|
@@ -197,7 +375,7 @@ const SwipeActionsComponent = defineComponent({
|
|
|
197
375
|
if (state.swiping) {
|
|
198
376
|
suppressClick = true;
|
|
199
377
|
swiping.value = false;
|
|
200
|
-
settle(state);
|
|
378
|
+
settle(state, performance.now() - state.time <= FLICK_WINDOW ? state.velocity : 0);
|
|
201
379
|
}
|
|
202
380
|
else if (state.start !== 0) {
|
|
203
381
|
if (state.swiping === undefined)
|
|
@@ -218,7 +396,7 @@ const SwipeActionsComponent = defineComponent({
|
|
|
218
396
|
close();
|
|
219
397
|
};
|
|
220
398
|
const handlePointerDown = (event) => {
|
|
221
|
-
if (event.button !== 0 || gesture)
|
|
399
|
+
if (event.button !== 0 || gesture || removing.value)
|
|
222
400
|
return;
|
|
223
401
|
// A new press of the primary pointer starts clean: a swipe that another row ended and that was then cancelled leaves
|
|
224
402
|
// no click to swallow. Another finger's press keeps it, as only the primary pointer clicks.
|
|
@@ -226,6 +404,8 @@ const SwipeActionsComponent = defineComponent({
|
|
|
226
404
|
suppressClick = false;
|
|
227
405
|
if (props.leading.length < 1 && props.trailing.length < 1)
|
|
228
406
|
return;
|
|
407
|
+
// Any press ends a trackpad swipe still moving the row, and its momentum.
|
|
408
|
+
lockWheel();
|
|
229
409
|
// A drag in a text field or along a slider belongs to that control.
|
|
230
410
|
if (event.target instanceof Element && event.target.closest(OWN_DRAG))
|
|
231
411
|
return;
|
|
@@ -250,6 +430,9 @@ const SwipeActionsComponent = defineComponent({
|
|
|
250
430
|
rtl: isRtl(),
|
|
251
431
|
widths: { leading: widthOf("leading"), trailing: widthOf("trailing") },
|
|
252
432
|
rowWidth: root.value?.clientWidth ?? 0,
|
|
433
|
+
across: 0,
|
|
434
|
+
time: performance.now(),
|
|
435
|
+
velocity: 0,
|
|
253
436
|
detach: () => {
|
|
254
437
|
window.removeEventListener("pointerup", handleUp, true);
|
|
255
438
|
window.removeEventListener("pointercancel", handleCancel, true);
|
|
@@ -262,6 +445,12 @@ const SwipeActionsComponent = defineComponent({
|
|
|
262
445
|
return;
|
|
263
446
|
const across = (event.clientX - state.x) * (state.rtl ? -1 : 1);
|
|
264
447
|
const down = event.clientY - state.y;
|
|
448
|
+
// The speed is the finger's latest, from every move, the ones within the slop too.
|
|
449
|
+
const now = performance.now();
|
|
450
|
+
if (now > state.time)
|
|
451
|
+
state.velocity = (across - state.across) / (now - state.time);
|
|
452
|
+
state.across = across;
|
|
453
|
+
state.time = now;
|
|
265
454
|
if (state.swiping === undefined) {
|
|
266
455
|
if (Math.abs(across) < SLOP && Math.abs(down) < SLOP)
|
|
267
456
|
return;
|
|
@@ -296,12 +485,14 @@ const SwipeActionsComponent = defineComponent({
|
|
|
296
485
|
};
|
|
297
486
|
/** The focus on an action shows its side; on the content it closes the row. */
|
|
298
487
|
const handleFocusIn = (event) => {
|
|
299
|
-
if (gesture?.swiping)
|
|
488
|
+
if (gesture?.swiping || removing.value)
|
|
300
489
|
return;
|
|
301
490
|
const target = event.target;
|
|
302
491
|
const side = ["leading", "trailing"].find((name) => target instanceof Node && !!sides[name]?.contains(target));
|
|
303
492
|
if (side) {
|
|
304
|
-
|
|
493
|
+
// A trackpad swipe still moving the row ends with the side fully open.
|
|
494
|
+
const wheeling = !!wheel && wheel !== "locked";
|
|
495
|
+
if (wheeling || sideOf(offset.value) !== side)
|
|
305
496
|
open(side);
|
|
306
497
|
}
|
|
307
498
|
else if (offset.value !== 0) {
|
|
@@ -309,22 +500,30 @@ const SwipeActionsComponent = defineComponent({
|
|
|
309
500
|
}
|
|
310
501
|
};
|
|
311
502
|
const handleFocusOut = (event) => {
|
|
312
|
-
if (gesture?.swiping)
|
|
503
|
+
if (gesture?.swiping || removing.value)
|
|
313
504
|
return;
|
|
314
505
|
if (event.relatedTarget instanceof Node && root.value?.contains(event.relatedTarget))
|
|
315
506
|
return;
|
|
316
507
|
if (offset.value !== 0)
|
|
317
508
|
close();
|
|
318
509
|
};
|
|
319
|
-
const select = (action, event) => {
|
|
510
|
+
const select = (action, side, event) => {
|
|
511
|
+
// A row being removed runs nothing more, from the keys either.
|
|
512
|
+
if (removing.value)
|
|
513
|
+
return;
|
|
514
|
+
// A press ends a trackpad swipe still moving the row.
|
|
515
|
+
lockWheel();
|
|
516
|
+
// A pointer leaves no focus on the action, so a row the list keeps closes.
|
|
517
|
+
const target = event.currentTarget;
|
|
518
|
+
if (event.detail !== 0 && target instanceof HTMLElement)
|
|
519
|
+
target.blur();
|
|
520
|
+
if (action.role === "destructive")
|
|
521
|
+
return remove(action, side);
|
|
320
522
|
action.onSelect?.();
|
|
321
523
|
// A press closes the row, as iOS does. From the keys the action keeps the focus, so its side stays open until
|
|
322
524
|
// the focus leaves the row.
|
|
323
525
|
if (event.detail === 0)
|
|
324
526
|
return;
|
|
325
|
-
const target = event.currentTarget;
|
|
326
|
-
if (target instanceof HTMLElement)
|
|
327
|
-
target.blur();
|
|
328
527
|
close();
|
|
329
528
|
};
|
|
330
529
|
const renderSide = (side, actions) => {
|
|
@@ -354,7 +553,7 @@ const SwipeActionsComponent = defineComponent({
|
|
|
354
553
|
"data-shape": shape,
|
|
355
554
|
"data-first": action === actions[0] ? "" : undefined,
|
|
356
555
|
"aria-label": labelInside || labelBelow ? undefined : action.label,
|
|
357
|
-
"onClick": (event) => select(action, event),
|
|
556
|
+
"onClick": (event) => select(action, side, event),
|
|
358
557
|
}, [
|
|
359
558
|
h("span", { class: s.Capsule }, [
|
|
360
559
|
action.Icon ? h(action.Icon, { "class": s.Icon, "aria-hidden": "true" }) : null,
|
|
@@ -374,6 +573,9 @@ const SwipeActionsComponent = defineComponent({
|
|
|
374
573
|
"data-round": round.value ? "" : undefined,
|
|
375
574
|
"data-revealed": revealed.value,
|
|
376
575
|
"data-swiping": swiping.value ? "" : undefined,
|
|
576
|
+
"data-removing": removing.value ? "" : undefined,
|
|
577
|
+
// The row collapses from its height (keyframes in the CSS), so no frame has to pass first.
|
|
578
|
+
"style": height.value !== undefined ? [attrs.style, { "--swipe-actions-row-height": `${height.value}px` }] : attrs.style,
|
|
377
579
|
"onFocusin": handleFocusIn,
|
|
378
580
|
"onFocusout": handleFocusOut,
|
|
379
581
|
}, [
|