@fanvue/ui 3.31.0 → 3.32.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/cjs/components/ChatInput/ChatInput.cjs +6 -5
- package/dist/cjs/components/ChatInput/ChatInput.cjs.map +1 -1
- package/dist/cjs/components/DropdownMenu/DropdownMenuHeader.cjs +190 -0
- package/dist/cjs/components/DropdownMenu/DropdownMenuHeader.cjs.map +1 -0
- package/dist/cjs/components/DropdownMenu/DropdownMenuItem.cjs +213 -0
- package/dist/cjs/components/DropdownMenu/DropdownMenuItem.cjs.map +1 -0
- package/dist/cjs/components/DropdownMenu/DropdownMenuReorderGroup.cjs +438 -0
- package/dist/cjs/components/DropdownMenu/DropdownMenuReorderGroup.cjs.map +1 -0
- package/dist/cjs/components/DropdownMenu/DropdownMenuReorderItem.cjs +197 -0
- package/dist/cjs/components/DropdownMenu/DropdownMenuReorderItem.cjs.map +1 -0
- package/dist/cjs/components/DropdownMenu/DropdownMenuRoot.cjs +221 -0
- package/dist/cjs/components/DropdownMenu/DropdownMenuRoot.cjs.map +1 -0
- package/dist/cjs/components/DropdownMenu/DropdownMenuSelectionItems.cjs +128 -0
- package/dist/cjs/components/DropdownMenu/DropdownMenuSelectionItems.cjs.map +1 -0
- package/dist/cjs/components/DropdownMenu/context.cjs +26 -0
- package/dist/cjs/components/DropdownMenu/context.cjs.map +1 -0
- package/dist/cjs/components/DropdownMenu/reorderShared.cjs +38 -0
- package/dist/cjs/components/DropdownMenu/reorderShared.cjs.map +1 -0
- package/dist/cjs/index.cjs +19 -12
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/components/ChatInput/ChatInput.mjs +2 -1
- package/dist/components/ChatInput/ChatInput.mjs.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenuHeader.mjs +173 -0
- package/dist/components/DropdownMenu/DropdownMenuHeader.mjs.map +1 -0
- package/dist/components/DropdownMenu/DropdownMenuItem.mjs +195 -0
- package/dist/components/DropdownMenu/DropdownMenuItem.mjs.map +1 -0
- package/dist/components/DropdownMenu/DropdownMenuReorderGroup.mjs +421 -0
- package/dist/components/DropdownMenu/DropdownMenuReorderGroup.mjs.map +1 -0
- package/dist/components/DropdownMenu/DropdownMenuReorderItem.mjs +180 -0
- package/dist/components/DropdownMenu/DropdownMenuReorderItem.mjs.map +1 -0
- package/dist/components/DropdownMenu/DropdownMenuRoot.mjs +203 -0
- package/dist/components/DropdownMenu/DropdownMenuRoot.mjs.map +1 -0
- package/dist/components/DropdownMenu/DropdownMenuSelectionItems.mjs +110 -0
- package/dist/components/DropdownMenu/DropdownMenuSelectionItems.mjs.map +1 -0
- package/dist/components/DropdownMenu/context.mjs +9 -0
- package/dist/components/DropdownMenu/context.mjs.map +1 -0
- package/dist/components/DropdownMenu/reorderShared.mjs +21 -0
- package/dist/components/DropdownMenu/reorderShared.mjs.map +1 -0
- package/dist/index.d.ts +121 -1
- package/dist/index.mjs +8 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
- package/dist/cjs/components/DropdownMenu/DropdownMenu.cjs +0 -598
- package/dist/cjs/components/DropdownMenu/DropdownMenu.cjs.map +0 -1
- package/dist/components/DropdownMenu/DropdownMenu.mjs +0 -580
- package/dist/components/DropdownMenu/DropdownMenu.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DropdownMenuItem.cjs","sources":["../../../../src/components/DropdownMenu/DropdownMenuItem.tsx"],"sourcesContent":["import * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { CheckIcon } from \"../Icons/CheckIcon\";\nimport { DropdownMenuVariantContext, ToggleOpenContext } from \"./context\";\n\n/** Vertical placement of a {@link DropdownMenuLabel} within its group. */\nexport type DropdownMenuLabelPosition = \"default\" | \"top\";\n\n/** Props for the {@link DropdownMenuLabel} component. */\nexport interface DropdownMenuLabelProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> {\n /**\n * Vertical placement within the surrounding group. `\"top\"` is used for the\n * first label directly under a header; `\"default\"` adds extra top padding to\n * separate it from preceding items. @default \"default\"\n */\n position?: DropdownMenuLabelPosition;\n}\n\n/** A non-interactive label that groups related items within a menu. */\nexport const DropdownMenuLabel = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.Label>,\n DropdownMenuLabelProps\n>(({ className, position = \"default\", ...props }, ref) => {\n const variant = React.useContext(DropdownMenuVariantContext);\n const labelClassName = cn(\n \"typography-description-12px-regular flex items-center px-3 text-content-secondary\",\n position === \"top\" ? \"py-2\" : \"pt-4 pb-2\",\n className,\n );\n\n // DropdownMenuPrimitive.Label requires Radix menu context, unavailable when\n // the sheet variant renders inside a Drawer (Dialog) instead.\n if (variant === \"sheet\") {\n return <div ref={ref} className={labelClassName} {...props} />;\n }\n\n return <DropdownMenuPrimitive.Label ref={ref} className={labelClassName} {...props} />;\n});\nDropdownMenuLabel.displayName = \"DropdownMenuLabel\";\n\n/**\n * Height preset for a dropdown menu item.\n *\n * `\"40\"` (default) and `\"32\"` are the v2 numeric tokens that mirror the Figma\n * design system. `\"sm\"` and `\"md\"` are deprecated aliases retained for\n * backwards compatibility — `\"sm\"` maps to `\"32\"`, `\"md\"` maps to `\"40\"`.\n */\nexport type DropdownMenuItemSize =\n | \"40\"\n | \"32\"\n /** @deprecated Use `\"32\"` instead. */\n | \"sm\"\n /** @deprecated Use `\"40\"` instead. */\n | \"md\";\n\nconst SIZE_NORMALIZED: Record<DropdownMenuItemSize, \"40\" | \"32\"> = {\n \"40\": \"40\",\n md: \"40\",\n \"32\": \"32\",\n sm: \"32\",\n};\n\nconst ITEM_SIZE_CLASSES: Record<\"40\" | \"32\", string> = {\n \"40\": \"min-h-10 py-2 typography-body-default-16px-regular\",\n \"32\": \"min-h-8 py-[7px] typography-body-small-14px-regular\",\n};\n\n/*\n * 14px at both heights. `V2 Menu Item` draws the count as `Body Small 14px/Regular`\n * in `content-tertiary` (node `21542:8629`), and the 40 row previously stepped up to\n * 16px — which also put the count's line box at 24px against the two-line layout's\n * 18px title leading.\n *\n * Only the 40 row is drawn in Figma: the component set's variants are Type and State\n * with no size axis. The 32 row is ours, and 14px matches the body type it already\n * uses, so both entries agree by construction rather than by design reference.\n */\nconst ITEM_COUNT_TYPOGRAPHY: Record<\"40\" | \"32\", string> = {\n \"40\": \"typography-body-small-14px-regular\",\n \"32\": \"typography-body-small-14px-regular\",\n};\n\n// Background alone can't reliably tell \"selected\" apart from a\n// hovered-but-unselected row across every theme/contrast combination (see the\n// neutral-alphas fix on itemClassName below) — pair it with an explicit\n// indicator, matching SelectItem's check indicator for the same V2 Menu Item\n// spec.\nfunction SelectedCheckIndicator({ hasDescription }: { hasDescription: boolean }) {\n return (\n <CheckIcon\n className={cn(\n \"size-4 shrink-0 text-content-primary\",\n // The two-line layout switches the row to `items-start`, which would hang\n // the tick off the title's line. A leading icon or avatar belongs there —\n // it labels the title — but the tick is a property of the whole row, so it\n // centres against both lines. {@link SelectItem} already does this.\n hasDescription && \"self-center\",\n )}\n />\n );\n}\n\nexport interface DropdownMenuItemProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> {\n /** Height of the menu item row. @default \"40\" */\n size?: DropdownMenuItemSize;\n /** Applies the destructive (error) treatment. Use for irreversible actions. @default false */\n destructive?: boolean;\n /** Icon (or other node) rendered before the label. Ignored when {@link DropdownMenuItemProps.avatar} is set. */\n leadingIcon?: React.ReactNode;\n /**\n * Leading avatar rendered in place of {@link DropdownMenuItemProps.leadingIcon},\n * for rows that represent a person or account. Pass an `Avatar` sized to `24`.\n * Takes precedence over `leadingIcon`.\n */\n avatar?: React.ReactNode;\n /**\n * Icon (or other node) rendered after the label. When\n * {@link DropdownMenuItemProps.selected} is true and no `trailingIcon` is\n * given, the built-in selected check indicator renders in this slot\n * instead — pass a `trailingIcon` to use a custom selected indicator (e.g.\n * a themed tick) rather than the default one.\n */\n trailingIcon?: React.ReactNode;\n /** Trailing count or number (e.g. an unread total) rendered before {@link DropdownMenuItemProps.trailingIcon}. */\n count?: React.ReactNode;\n /**\n * Optional secondary text rendered on a second line below the label. When\n * provided, the row switches to a two-line layout and the leading/trailing\n * icons align to the title line (top) rather than the row's vertical centre.\n */\n description?: React.ReactNode;\n /** Marks the item as the current selection in a single-select menu. @default false */\n selected?: boolean;\n}\n\n/**\n * An individual item within a {@link DropdownMenuContent}.\n *\n * @example\n * ```tsx\n * <DropdownMenuItem>Edit profile</DropdownMenuItem>\n * <DropdownMenuItem destructive>Delete</DropdownMenuItem>\n * <DropdownMenuItem leadingIcon={<EditIcon />}>Edit</DropdownMenuItem>\n *\n * // Feature-rich row with an avatar and a trailing count\n * <DropdownMenuItem avatar={<Avatar size={24} src={src} />} count=\"12\">\n * Jane Doe\n * </DropdownMenuItem>\n *\n * // As a link\n * <DropdownMenuItem asChild>\n * <a href=\"/settings\">Settings</a>\n * </DropdownMenuItem>\n * ```\n */\nexport const DropdownMenuItem = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.Item>,\n DropdownMenuItemProps\n>(\n (\n {\n size = \"40\",\n destructive,\n leadingIcon,\n avatar,\n trailingIcon,\n count,\n description,\n selected,\n className,\n children,\n asChild,\n onSelect,\n disabled,\n ...props\n },\n ref,\n ) => {\n const variant = React.useContext(DropdownMenuVariantContext);\n const toggleOpen = React.useContext(ToggleOpenContext);\n const normalizedSize = SIZE_NORMALIZED[size];\n const hasDescription = description != null;\n const hasAvatar = avatar != null;\n const itemClassName = cn(\n // `text-start` because the sheet variant renders the row as a <button>,\n // whose UA-centred text misaligned it from the popper variant's rows.\n \"group flex w-full cursor-pointer gap-2 rounded-sm px-3 text-start outline-none\",\n hasDescription ? \"items-start\" : \"items-center\",\n // The sheet's header runs the full width of the panel, so its rows have to\n // come in off the edge themselves — 12px here on the panel's own 4px is the\n // design's 16px. `w-auto` lets the column stretch them to the space left\n // over; `w-full` plus a margin would overflow.\n variant === \"sheet\" && \"mx-3 w-auto\",\n ITEM_SIZE_CLASSES[normalizedSize],\n // A 24px avatar would push the compact 32px row past its height with the\n // default padding; tighten it so the avatar variant keeps the 32px contract.\n hasAvatar && !hasDescription && normalizedSize === \"32\" && \"py-1\",\n \"data-[highlighted]:bg-neutral-alphas-50\",\n \"data-[disabled]:cursor-not-allowed data-[disabled]:text-content-disabled\",\n \"disabled:cursor-not-allowed disabled:text-content-disabled\",\n // Sheet-variant asChild items are marked disabled via aria-disabled\n // (see below), not the native disabled attribute or Radix's\n // data-disabled — neither selector above matches them.\n \"aria-disabled:cursor-not-allowed aria-disabled:text-content-disabled\",\n destructive && \"text-error-content\",\n // bg-interaction-hover aliases to the same token as the plain hover\n // background above, so a selected row would be indistinguishable from a\n // hovered-but-unselected one. Use the next step up the neutral-alphas\n // ramp instead (still a subtle overlay, not the heavy filled style).\n selected && [\"bg-neutral-alphas-100\", \"data-[highlighted]:bg-neutral-alphas-200\"],\n className,\n );\n\n // In the two-line (description) layout everything beside the title sits on\n // the title's line, not the centre of the two-line block. A box the height of\n // that line centres each sibling on it whatever its own size — a 16px icon, a\n // 24px avatar, or the count's larger text box. The height is the title's, from\n // `typography-body-small-14px-semibold`; a `pt-*` nudge cannot do this because\n // the correct offset differs per sibling, and the previous `pt-1` was computed\n // against the single-line title's 24px leading, leaving all four 3px low.\n const iconAlignClassName = hasDescription ? \"flex h-[18px] shrink-0 items-center\" : null;\n\n const countNode = count != null && (\n <span\n className={cn(\n \"shrink-0 tabular-nums\",\n iconAlignClassName,\n ITEM_COUNT_TYPOGRAPHY[normalizedSize],\n destructive ? \"text-error-content\" : \"text-content-tertiary\",\n \"group-data-[disabled]:text-content-disabled\",\n )}\n >\n {count}\n </span>\n );\n\n // A caller-supplied trailingIcon always wins the trailing slot — some\n // consumers pass their own selected indicator (e.g. a themed tick) and\n // rely on it being shown as-is rather than replaced. Only fall back to\n // the built-in check indicator when selected and no trailingIcon is given.\n const trailingNode =\n trailingIcon != null ? (\n hasDescription ? (\n <span className={iconAlignClassName!}>{trailingIcon}</span>\n ) : (\n trailingIcon\n )\n ) : (\n selected && <SelectedCheckIndicator hasDescription={hasDescription} />\n );\n\n const itemChildren = (\n <>\n {avatar != null ? (\n <span className={cn(\"shrink-0\", iconAlignClassName)}>{avatar}</span>\n ) : (\n leadingIcon != null &&\n (hasDescription ? (\n <span className={iconAlignClassName!}>{leadingIcon}</span>\n ) : (\n leadingIcon\n ))\n )}\n {hasDescription ? (\n <span className=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n {/*\n * The two-line row sets its own title type rather than inheriting the\n * row's: `V2 Menu Item` pairs a 14px semibold title with the 14px\n * regular description below it, where a single-line row's title is the\n * size's own 16px regular. It also settles the row's height — 18 + 2 +\n * 18 of text inside `py-2` is the design's 54px.\n */}\n <span className=\"typography-body-small-14px-semibold truncate\">{children}</span>\n <span className=\"typography-body-small-14px-regular truncate text-content-secondary\">\n {description}\n </span>\n </span>\n ) : (\n <span className=\"min-w-0 flex-1 truncate\">{children}</span>\n )}\n {countNode}\n {trailingNode}\n </>\n );\n\n // The sheet variant renders inside a Drawer (Dialog), not a Radix menu, so\n // DropdownMenuPrimitive.Item (which requires menu context) can't be used —\n // render a plain option element with equivalent selection semantics instead.\n // asChild goes through the same Slot primitive Radix's own Item uses\n // internally, so a custom element (e.g. a link) gets the option\n // role/handlers merged onto it without needing menu context.\n if (variant === \"sheet\") {\n const Comp = asChild ? Slot : \"button\";\n // Pull the consumer's onClick out of the passthrough spread so the\n // handler below can compose with it instead of the spread order\n // silently overwriting it (an explicit onClick after {...props} always\n // wins over the spread's).\n const { onClick: consumerOnClick, ...restProps } =\n props as React.ComponentPropsWithoutRef<\"button\">;\n const sheetSpecificProps = !asChild\n ? { type: \"button\" as const, disabled }\n : disabled\n ? { \"aria-disabled\": true }\n : {};\n return (\n <Comp\n ref={ref as React.Ref<HTMLButtonElement>}\n {...restProps}\n {...sheetSpecificProps}\n role=\"option\"\n aria-selected={selected}\n className={itemClassName}\n onClick={(event: React.MouseEvent<HTMLButtonElement>) => {\n // A native <button disabled> already blocks its click event, but\n // asChild's element (e.g. a link) has no such enforcement — guard\n // explicitly, and prevent the click's default action (e.g. anchor\n // navigation) since aria-disabled alone doesn't stop it.\n if (disabled) {\n event.preventDefault();\n return;\n }\n consumerOnClick?.(event);\n if (event.defaultPrevented) return;\n // Pass the real native event through, not a fake partial shape —\n // handlers that call any Event API beyond preventDefault (e.g.\n // stopPropagation, composedPath) need it to actually exist. It's\n // still live (currentTarget/target are valid) since we're inside\n // the same synchronous click handler that produced it.\n onSelect?.(event.nativeEvent);\n if (!event.nativeEvent.defaultPrevented) toggleOpen?.(() => false);\n }}\n >\n {asChild ? children : itemChildren}\n </Comp>\n );\n }\n\n if (asChild) {\n return (\n <DropdownMenuPrimitive.Item\n ref={ref}\n asChild\n className={itemClassName}\n disabled={disabled}\n onSelect={onSelect}\n {...props}\n >\n {children}\n </DropdownMenuPrimitive.Item>\n );\n }\n\n return (\n <DropdownMenuPrimitive.Item\n ref={ref}\n className={itemClassName}\n disabled={disabled}\n onSelect={onSelect}\n {...props}\n >\n {itemChildren}\n </DropdownMenuPrimitive.Item>\n );\n },\n);\nDropdownMenuItem.displayName = \"DropdownMenuItem\";\n\n/** Props for the {@link DropdownMenuSeparator} component. */\nexport interface DropdownMenuSeparatorProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator> {}\n\n/** Visual separator between groups of items. */\nexport const DropdownMenuSeparator = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.Separator>,\n DropdownMenuSeparatorProps\n>(({ className, ...props }, ref) => {\n const variant = React.useContext(DropdownMenuVariantContext);\n const separatorClassName = cn(\"my-1 h-px bg-neutral-alphas-200\", className);\n\n // DropdownMenuPrimitive.Separator requires Radix menu context, unavailable\n // when the sheet variant renders inside a Drawer (Dialog) instead. <hr> is a\n // native separator, so it needs no ARIA role.\n if (variant === \"sheet\") {\n return <hr ref={ref as React.Ref<HTMLHRElement>} className={separatorClassName} {...props} />;\n }\n\n return <DropdownMenuPrimitive.Separator ref={ref} className={separatorClassName} {...props} />;\n});\nDropdownMenuSeparator.displayName = \"DropdownMenuSeparator\";\n"],"names":["React","DropdownMenuVariantContext","cn","jsx","DropdownMenuPrimitive","CheckIcon","ToggleOpenContext","jsxs","Fragment","Slot"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBO,MAAM,oBAAoBA,iBAAM,WAGrC,CAAC,EAAE,WAAW,WAAW,WAAW,GAAG,MAAA,GAAS,QAAQ;AACxD,QAAM,UAAUA,iBAAM,WAAWC,kCAA0B;AAC3D,QAAM,iBAAiBC,GAAAA;AAAAA,IACrB;AAAA,IACA,aAAa,QAAQ,SAAS;AAAA,IAC9B;AAAA,EAAA;AAKF,MAAI,YAAY,SAAS;AACvB,0CAAQ,OAAA,EAAI,KAAU,WAAW,gBAAiB,GAAG,OAAO;AAAA,EAC9D;AAEA,SAAOC,2BAAAA,IAACC,iCAAsB,OAAtB,EAA4B,KAAU,WAAW,gBAAiB,GAAG,OAAO;AACtF,CAAC;AACD,kBAAkB,cAAc;AAiBhC,MAAM,kBAA6D;AAAA,EACjE,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,IAAI;AACN;AAEA,MAAM,oBAAiD;AAAA,EACrD,MAAM;AAAA,EACN,MAAM;AACR;AAYA,MAAM,wBAAqD;AAAA,EACzD,MAAM;AAAA,EACN,MAAM;AACR;AAOA,SAAS,uBAAuB,EAAE,kBAA+C;AAC/E,SACED,2BAAAA;AAAAA,IAACE,UAAAA;AAAAA,IAAA;AAAA,MACC,WAAWH,GAAAA;AAAAA,QACT;AAAA;AAAA;AAAA;AAAA;AAAA,QAKA,kBAAkB;AAAA,MAAA;AAAA,IACpB;AAAA,EAAA;AAGN;AAwDO,MAAM,mBAAmBF,iBAAM;AAAA,EAIpC,CACE;AAAA,IACE,OAAO;AAAA,IACP;A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AA,UACC,GAAG;AAAA,UAEH;AAAA,QAAA;AAAA,MAAA;AAAA,IAGP;AAEA,WACED,2BAAAA;AAAAA,MAACC,iCAAsB;AAAA,MAAtB;AAAA,QACC;AAAA,QACA,WAAW;AAAA,QACX;AAAA,QACA;AAAA,QACC,GAAG;AAAA,QAEH,UAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AACA,iBAAiB,cAAc;AAOxB,MAAM,wBAAwBJ,iBAAM,WAGzC,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QAAQ;AAClC,QAAM,UAAUA,iBAAM,WAAWC,kCAA0B;AAC3D,QAAM,qBAAqBC,GAAAA,GAAG,mCAAmC,SAAS;AAK1E,MAAI,YAAY,SAAS;AACvB,0CAAQ,MAAA,EAAG,KAAsC,WAAW,oBAAqB,GAAG,OAAO;AAAA,EAC7F;AAEA,SAAOC,2BAAAA,IAACC,iCAAsB,WAAtB,EAAgC,KAAU,WAAW,oBAAqB,GAAG,OAAO;AAC9F,CAAC;AACD,sBAAsB,cAAc;;;;"}
|
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
5
|
+
const React = require("react");
|
|
6
|
+
const cn = require("../../utils/cn.cjs");
|
|
7
|
+
const context = require("./context.cjs");
|
|
8
|
+
const reorderShared = require("./reorderShared.cjs");
|
|
9
|
+
function _interopNamespaceDefault(e) {
|
|
10
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
11
|
+
if (e) {
|
|
12
|
+
for (const k in e) {
|
|
13
|
+
if (k !== "default") {
|
|
14
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
15
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: () => e[k]
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
n.default = e;
|
|
23
|
+
return Object.freeze(n);
|
|
24
|
+
}
|
|
25
|
+
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
|
|
26
|
+
const REORDER_LIFT_THRESHOLD_PX = 4;
|
|
27
|
+
const REORDER_AUTOSCROLL_ZONE_PX = 32;
|
|
28
|
+
const REORDER_AUTOSCROLL_MAX_STEP_PX = 8;
|
|
29
|
+
const DEFAULT_REORDER_INSTRUCTIONS = "Press the up and down arrow keys to move this item.";
|
|
30
|
+
function findScrollableAncestor(element) {
|
|
31
|
+
let current = element.parentElement;
|
|
32
|
+
while (current !== null) {
|
|
33
|
+
const { overflowY } = getComputedStyle(current);
|
|
34
|
+
if ((overflowY === "auto" || overflowY === "scroll") && current.scrollHeight > current.clientHeight) {
|
|
35
|
+
return current;
|
|
36
|
+
}
|
|
37
|
+
current = current.parentElement;
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
function edgeOvershoot(rect, y) {
|
|
42
|
+
if (y < rect.top + REORDER_AUTOSCROLL_ZONE_PX) return y - (rect.top + REORDER_AUTOSCROLL_ZONE_PX);
|
|
43
|
+
if (y > rect.bottom - REORDER_AUTOSCROLL_ZONE_PX) {
|
|
44
|
+
return y - (rect.bottom - REORDER_AUTOSCROLL_ZONE_PX);
|
|
45
|
+
}
|
|
46
|
+
return 0;
|
|
47
|
+
}
|
|
48
|
+
function useLatestRef(value) {
|
|
49
|
+
const ref = React__namespace.useRef(value);
|
|
50
|
+
React__namespace.useLayoutEffect(() => {
|
|
51
|
+
ref.current = value;
|
|
52
|
+
});
|
|
53
|
+
return ref;
|
|
54
|
+
}
|
|
55
|
+
function shallowEqualArrays(a, b) {
|
|
56
|
+
return a.length === b.length && a.every((value, index) => value === b[index]);
|
|
57
|
+
}
|
|
58
|
+
function defaultReorderAnnouncement({ label, to, total }) {
|
|
59
|
+
return `${label} moved to position ${to + 1} of ${total}`;
|
|
60
|
+
}
|
|
61
|
+
const DropdownMenuReorderGroup = React__namespace.forwardRef(
|
|
62
|
+
({
|
|
63
|
+
values,
|
|
64
|
+
onReorder,
|
|
65
|
+
getAnnouncement = defaultReorderAnnouncement,
|
|
66
|
+
instructions = DEFAULT_REORDER_INSTRUCTIONS,
|
|
67
|
+
className,
|
|
68
|
+
children,
|
|
69
|
+
...props
|
|
70
|
+
}, ref) => {
|
|
71
|
+
const variant = React__namespace.useContext(context.DropdownMenuVariantContext);
|
|
72
|
+
const instructionsId = React__namespace.useId();
|
|
73
|
+
const groupRef = React__namespace.useRef(null);
|
|
74
|
+
const itemsRef = React__namespace.useRef(/* @__PURE__ */ new Map());
|
|
75
|
+
const dragRef = React__namespace.useRef(null);
|
|
76
|
+
const ghostRef = React__namespace.useRef(null);
|
|
77
|
+
const scrollContainerRef = React__namespace.useRef(null);
|
|
78
|
+
const lastPointerRef = React__namespace.useRef(null);
|
|
79
|
+
const autoScrollFrameRef = React__namespace.useRef(null);
|
|
80
|
+
const dragDisposersRef = React__namespace.useRef([]);
|
|
81
|
+
const valuesRef = useLatestRef(values);
|
|
82
|
+
const onReorderRef = useLatestRef(onReorder);
|
|
83
|
+
const getAnnouncementRef = useLatestRef(getAnnouncement);
|
|
84
|
+
const [lifted, setLifted] = React__namespace.useState(null);
|
|
85
|
+
const [dropIndex, setDropIndex] = React__namespace.useState(-1);
|
|
86
|
+
const [announcement, setAnnouncement] = React__namespace.useState("");
|
|
87
|
+
const registerItem = React__namespace.useCallback((value, item) => {
|
|
88
|
+
if (item === null) {
|
|
89
|
+
itemsRef.current.delete(value);
|
|
90
|
+
} else {
|
|
91
|
+
itemsRef.current.set(value, item);
|
|
92
|
+
}
|
|
93
|
+
}, []);
|
|
94
|
+
const positionGhost = React__namespace.useCallback(() => {
|
|
95
|
+
const drag2 = dragRef.current;
|
|
96
|
+
const ghost = ghostRef.current;
|
|
97
|
+
const pointer = lastPointerRef.current;
|
|
98
|
+
if (drag2 === null || ghost === null || pointer === null) return;
|
|
99
|
+
ghost.style.transform = `translate3d(${pointer.x - drag2.offsetX}px, ${pointer.y - drag2.offsetY}px, 0)`;
|
|
100
|
+
}, []);
|
|
101
|
+
const registerGhost = React__namespace.useCallback(
|
|
102
|
+
(element) => {
|
|
103
|
+
ghostRef.current = element;
|
|
104
|
+
if (element !== null) positionGhost();
|
|
105
|
+
},
|
|
106
|
+
[positionGhost]
|
|
107
|
+
);
|
|
108
|
+
const measure = React__namespace.useCallback(
|
|
109
|
+
(drag2) => {
|
|
110
|
+
const group = groupRef.current;
|
|
111
|
+
if (group === null) return;
|
|
112
|
+
const groupTop = group.getBoundingClientRect().top;
|
|
113
|
+
const midpoints = [];
|
|
114
|
+
const edges = [];
|
|
115
|
+
let bottom = groupTop;
|
|
116
|
+
for (const value of valuesRef.current) {
|
|
117
|
+
const rect = itemsRef.current.get(value)?.element.getBoundingClientRect();
|
|
118
|
+
if (rect === void 0) {
|
|
119
|
+
midpoints.push(bottom);
|
|
120
|
+
edges.push(bottom - groupTop);
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
midpoints.push(rect.top + rect.height / 2);
|
|
124
|
+
edges.push(rect.top - groupTop);
|
|
125
|
+
bottom = rect.bottom;
|
|
126
|
+
}
|
|
127
|
+
edges.push(bottom - groupTop);
|
|
128
|
+
drag2.midpoints = midpoints;
|
|
129
|
+
drag2.edges = edges;
|
|
130
|
+
const container = scrollContainerRef.current;
|
|
131
|
+
drag2.scrollTopAtMeasure = container?.scrollTop ?? 0;
|
|
132
|
+
drag2.containerRect = container?.getBoundingClientRect() ?? null;
|
|
133
|
+
},
|
|
134
|
+
[valuesRef]
|
|
135
|
+
);
|
|
136
|
+
const computeDropIndex = React__namespace.useCallback((drag2, clientY) => {
|
|
137
|
+
const container = scrollContainerRef.current;
|
|
138
|
+
const y = clientY + (container === null ? 0 : container.scrollTop - drag2.scrollTopAtMeasure);
|
|
139
|
+
let index = 0;
|
|
140
|
+
for (const midpoint of drag2.midpoints) {
|
|
141
|
+
if (midpoint >= y) break;
|
|
142
|
+
index += 1;
|
|
143
|
+
}
|
|
144
|
+
return index;
|
|
145
|
+
}, []);
|
|
146
|
+
const refreshDropIndex = React__namespace.useCallback(
|
|
147
|
+
(drag2, clientY) => {
|
|
148
|
+
const next = computeDropIndex(drag2, clientY);
|
|
149
|
+
if (next === drag2.dropIndex) return;
|
|
150
|
+
drag2.dropIndex = next;
|
|
151
|
+
setDropIndex(next);
|
|
152
|
+
},
|
|
153
|
+
[computeDropIndex]
|
|
154
|
+
);
|
|
155
|
+
const stopAutoScroll = React__namespace.useCallback(() => {
|
|
156
|
+
if (autoScrollFrameRef.current === null) return;
|
|
157
|
+
cancelAnimationFrame(autoScrollFrameRef.current);
|
|
158
|
+
autoScrollFrameRef.current = null;
|
|
159
|
+
}, []);
|
|
160
|
+
const updateAutoScroll = React__namespace.useCallback(() => {
|
|
161
|
+
const drag2 = dragRef.current;
|
|
162
|
+
const container = scrollContainerRef.current;
|
|
163
|
+
const pointer = lastPointerRef.current;
|
|
164
|
+
if (drag2 === null || !drag2.lifted || container === null || drag2.containerRect === null || pointer === null || edgeOvershoot(drag2.containerRect, pointer.y) === 0) {
|
|
165
|
+
stopAutoScroll();
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
if (autoScrollFrameRef.current !== null) return;
|
|
169
|
+
const step = () => {
|
|
170
|
+
autoScrollFrameRef.current = null;
|
|
171
|
+
const current = dragRef.current;
|
|
172
|
+
const latest = lastPointerRef.current;
|
|
173
|
+
if (current === null || !current.lifted || current.containerRect === null || latest === null) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
const overshoot = edgeOvershoot(current.containerRect, latest.y);
|
|
177
|
+
if (overshoot === 0) return;
|
|
178
|
+
const amount = Math.min(Math.ceil(Math.abs(overshoot) / 4), REORDER_AUTOSCROLL_MAX_STEP_PX);
|
|
179
|
+
const before = container.scrollTop;
|
|
180
|
+
container.scrollTop = before + (overshoot < 0 ? -amount : amount);
|
|
181
|
+
if (container.scrollTop === before) return;
|
|
182
|
+
autoScrollFrameRef.current = requestAnimationFrame(step);
|
|
183
|
+
};
|
|
184
|
+
autoScrollFrameRef.current = requestAnimationFrame(step);
|
|
185
|
+
}, [stopAutoScroll]);
|
|
186
|
+
const clearDrag = React__namespace.useCallback(() => {
|
|
187
|
+
stopAutoScroll();
|
|
188
|
+
for (const dispose of dragDisposersRef.current) dispose();
|
|
189
|
+
dragDisposersRef.current = [];
|
|
190
|
+
const drag2 = dragRef.current;
|
|
191
|
+
dragRef.current = null;
|
|
192
|
+
lastPointerRef.current = null;
|
|
193
|
+
scrollContainerRef.current = null;
|
|
194
|
+
if (drag2?.lifted) {
|
|
195
|
+
setLifted(null);
|
|
196
|
+
setDropIndex(-1);
|
|
197
|
+
}
|
|
198
|
+
}, [stopAutoScroll]);
|
|
199
|
+
const applyReorder = React__namespace.useCallback(
|
|
200
|
+
(value, from, to) => {
|
|
201
|
+
const next = [...valuesRef.current];
|
|
202
|
+
next.splice(from, 1);
|
|
203
|
+
next.splice(to, 0, value);
|
|
204
|
+
const detail = {
|
|
205
|
+
value,
|
|
206
|
+
label: itemsRef.current.get(value)?.label ?? value,
|
|
207
|
+
from,
|
|
208
|
+
to,
|
|
209
|
+
total: next.length
|
|
210
|
+
};
|
|
211
|
+
onReorderRef.current(next, detail);
|
|
212
|
+
setAnnouncement(getAnnouncementRef.current(detail));
|
|
213
|
+
},
|
|
214
|
+
[valuesRef, onReorderRef, getAnnouncementRef]
|
|
215
|
+
);
|
|
216
|
+
const endDrag = React__namespace.useCallback(
|
|
217
|
+
(pointerId, commit) => {
|
|
218
|
+
const drag2 = dragRef.current;
|
|
219
|
+
if (drag2 === null || pointerId !== drag2.pointerId) return;
|
|
220
|
+
clearDrag();
|
|
221
|
+
if (!commit || !drag2.lifted) return;
|
|
222
|
+
const current = valuesRef.current;
|
|
223
|
+
const from = current.indexOf(drag2.value);
|
|
224
|
+
if (from === -1) return;
|
|
225
|
+
const to = Math.max(
|
|
226
|
+
0,
|
|
227
|
+
Math.min(drag2.dropIndex > from ? drag2.dropIndex - 1 : drag2.dropIndex, current.length - 1)
|
|
228
|
+
);
|
|
229
|
+
if (to === from) return;
|
|
230
|
+
applyReorder(drag2.value, from, to);
|
|
231
|
+
},
|
|
232
|
+
[clearDrag, applyReorder, valuesRef]
|
|
233
|
+
);
|
|
234
|
+
const startDrag = React__namespace.useCallback(
|
|
235
|
+
(value, event, element) => {
|
|
236
|
+
if (dragRef.current !== null || groupRef.current === null) return false;
|
|
237
|
+
dragRef.current = {
|
|
238
|
+
value,
|
|
239
|
+
pointerId: event.pointerId,
|
|
240
|
+
element,
|
|
241
|
+
startX: event.clientX,
|
|
242
|
+
startY: event.clientY,
|
|
243
|
+
offsetX: 0,
|
|
244
|
+
offsetY: 0,
|
|
245
|
+
lifted: false,
|
|
246
|
+
dropIndex: -1,
|
|
247
|
+
midpoints: [],
|
|
248
|
+
edges: [],
|
|
249
|
+
scrollTopAtMeasure: 0,
|
|
250
|
+
containerRect: null
|
|
251
|
+
};
|
|
252
|
+
lastPointerRef.current = { x: event.clientX, y: event.clientY };
|
|
253
|
+
const view = element.ownerDocument.defaultView ?? window;
|
|
254
|
+
const onPointerUp = (pointerEvent) => endDrag(pointerEvent.pointerId, true);
|
|
255
|
+
const onPointerCancel = (pointerEvent) => endDrag(pointerEvent.pointerId, false);
|
|
256
|
+
const onKeyDown = (keyEvent) => {
|
|
257
|
+
if (keyEvent.key !== "Escape" || dragRef.current?.lifted !== true) return;
|
|
258
|
+
keyEvent.preventDefault();
|
|
259
|
+
keyEvent.stopPropagation();
|
|
260
|
+
clearDrag();
|
|
261
|
+
};
|
|
262
|
+
view.addEventListener("pointerup", onPointerUp);
|
|
263
|
+
view.addEventListener("pointercancel", onPointerCancel);
|
|
264
|
+
view.addEventListener("keydown", onKeyDown, true);
|
|
265
|
+
dragDisposersRef.current.push(() => {
|
|
266
|
+
view.removeEventListener("pointerup", onPointerUp);
|
|
267
|
+
view.removeEventListener("pointercancel", onPointerCancel);
|
|
268
|
+
view.removeEventListener("keydown", onKeyDown, true);
|
|
269
|
+
});
|
|
270
|
+
return true;
|
|
271
|
+
},
|
|
272
|
+
[endDrag, clearDrag]
|
|
273
|
+
);
|
|
274
|
+
const lift = React__namespace.useCallback(
|
|
275
|
+
(drag2, pointer) => {
|
|
276
|
+
const { element } = drag2;
|
|
277
|
+
const rect = element.getBoundingClientRect();
|
|
278
|
+
drag2.offsetX = drag2.startX - rect.left;
|
|
279
|
+
drag2.offsetY = drag2.startY - rect.top;
|
|
280
|
+
const container = findScrollableAncestor(element);
|
|
281
|
+
scrollContainerRef.current = container;
|
|
282
|
+
if (container !== null) {
|
|
283
|
+
const onScroll = () => {
|
|
284
|
+
const current = dragRef.current;
|
|
285
|
+
const latest = lastPointerRef.current;
|
|
286
|
+
if (current === null || !current.lifted || latest === null) return;
|
|
287
|
+
refreshDropIndex(current, latest.y);
|
|
288
|
+
};
|
|
289
|
+
container.addEventListener("scroll", onScroll, { passive: true });
|
|
290
|
+
dragDisposersRef.current.push(() => container.removeEventListener("scroll", onScroll));
|
|
291
|
+
}
|
|
292
|
+
measure(drag2);
|
|
293
|
+
drag2.lifted = true;
|
|
294
|
+
drag2.dropIndex = computeDropIndex(drag2, pointer.y);
|
|
295
|
+
const surface = element.closest('[role="menu"],[role="dialog"]');
|
|
296
|
+
const surfaceZIndex = surface === null ? "" : getComputedStyle(surface).zIndex;
|
|
297
|
+
setLifted({
|
|
298
|
+
value: drag2.value,
|
|
299
|
+
width: rect.width,
|
|
300
|
+
zIndex: surfaceZIndex === "" || surfaceZIndex === "auto" ? "var(--fanvue-ui-portal-z-index, 50)" : surfaceZIndex
|
|
301
|
+
});
|
|
302
|
+
setDropIndex(drag2.dropIndex);
|
|
303
|
+
},
|
|
304
|
+
[measure, computeDropIndex, refreshDropIndex]
|
|
305
|
+
);
|
|
306
|
+
const updateDrag = React__namespace.useCallback(
|
|
307
|
+
(event) => {
|
|
308
|
+
const drag2 = dragRef.current;
|
|
309
|
+
if (drag2 === null || event.pointerId !== drag2.pointerId) return;
|
|
310
|
+
const pointer = { x: event.clientX, y: event.clientY };
|
|
311
|
+
lastPointerRef.current = pointer;
|
|
312
|
+
if (!drag2.lifted) {
|
|
313
|
+
if (Math.hypot(pointer.x - drag2.startX, pointer.y - drag2.startY) <= REORDER_LIFT_THRESHOLD_PX) {
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
lift(drag2, pointer);
|
|
317
|
+
}
|
|
318
|
+
positionGhost();
|
|
319
|
+
refreshDropIndex(drag2, pointer.y);
|
|
320
|
+
updateAutoScroll();
|
|
321
|
+
},
|
|
322
|
+
[lift, positionGhost, refreshDropIndex, updateAutoScroll]
|
|
323
|
+
);
|
|
324
|
+
const moveItem = React__namespace.useCallback(
|
|
325
|
+
(value, delta) => {
|
|
326
|
+
const current = valuesRef.current;
|
|
327
|
+
const from = current.indexOf(value);
|
|
328
|
+
const to = from + delta;
|
|
329
|
+
if (from === -1 || to < 0 || to >= current.length) return;
|
|
330
|
+
applyReorder(value, from, to);
|
|
331
|
+
},
|
|
332
|
+
[applyReorder, valuesRef]
|
|
333
|
+
);
|
|
334
|
+
React__namespace.useEffect(() => clearDrag, [clearDrag]);
|
|
335
|
+
const previousValuesRef = React__namespace.useRef(values);
|
|
336
|
+
React__namespace.useLayoutEffect(() => {
|
|
337
|
+
if (shallowEqualArrays(previousValuesRef.current, values)) return;
|
|
338
|
+
previousValuesRef.current = values;
|
|
339
|
+
const drag2 = dragRef.current;
|
|
340
|
+
if (drag2 === null) return;
|
|
341
|
+
if (!values.includes(drag2.value)) {
|
|
342
|
+
clearDrag();
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
if (!drag2.lifted) return;
|
|
346
|
+
measure(drag2);
|
|
347
|
+
const pointer = lastPointerRef.current;
|
|
348
|
+
if (pointer !== null) refreshDropIndex(drag2, pointer.y);
|
|
349
|
+
}, [values, clearDrag, measure, refreshDropIndex]);
|
|
350
|
+
React__namespace.useEffect(() => {
|
|
351
|
+
if (variant !== "menu") return;
|
|
352
|
+
const group = groupRef.current;
|
|
353
|
+
const menu = group?.closest('[role="menu"]') ?? null;
|
|
354
|
+
if (group === null || menu === null) return;
|
|
355
|
+
const doc = group.ownerDocument;
|
|
356
|
+
const focusFirstHandle = () => {
|
|
357
|
+
const handle = group.querySelector("button:not(:disabled)");
|
|
358
|
+
if (handle === null) return false;
|
|
359
|
+
handle.focus({ preventScroll: true });
|
|
360
|
+
return true;
|
|
361
|
+
};
|
|
362
|
+
const frame = requestAnimationFrame(() => {
|
|
363
|
+
const active = doc.activeElement;
|
|
364
|
+
const parkedOnMenu = active === null || active === doc.body || active === menu;
|
|
365
|
+
const hasMenuItems = menu.querySelector('[role^="menuitem"]') !== null;
|
|
366
|
+
if (parkedOnMenu && !hasMenuItems) focusFirstHandle();
|
|
367
|
+
});
|
|
368
|
+
const rescueTab = (event) => {
|
|
369
|
+
if (event.key !== "Tab" || event.altKey || event.ctrlKey || event.metaKey) return;
|
|
370
|
+
const active = doc.activeElement;
|
|
371
|
+
if (active !== null && active !== doc.body) return;
|
|
372
|
+
if (menu.getAttribute("data-state") !== "open") return;
|
|
373
|
+
if (focusFirstHandle()) event.preventDefault();
|
|
374
|
+
};
|
|
375
|
+
doc.addEventListener("keydown", rescueTab, true);
|
|
376
|
+
return () => {
|
|
377
|
+
cancelAnimationFrame(frame);
|
|
378
|
+
doc.removeEventListener("keydown", rescueTab, true);
|
|
379
|
+
};
|
|
380
|
+
}, [variant]);
|
|
381
|
+
const actions = React__namespace.useMemo(
|
|
382
|
+
() => ({
|
|
383
|
+
registerItem,
|
|
384
|
+
registerGhost,
|
|
385
|
+
startDrag,
|
|
386
|
+
updateDrag,
|
|
387
|
+
endDrag,
|
|
388
|
+
moveItem,
|
|
389
|
+
instructionsId
|
|
390
|
+
}),
|
|
391
|
+
[registerItem, registerGhost, startDrag, updateDrag, endDrag, moveItem, instructionsId]
|
|
392
|
+
);
|
|
393
|
+
const drag = dragRef.current;
|
|
394
|
+
const liftedFrom = lifted === null ? -1 : values.indexOf(lifted.value);
|
|
395
|
+
const showDropIndicator = lifted !== null && drag !== null && dropIndex !== -1 && dropIndex !== liftedFrom && dropIndex !== liftedFrom + 1;
|
|
396
|
+
return (
|
|
397
|
+
// biome-ignore lint/a11y/useSemanticElements: <fieldset> carries form semantics and default styling we don't want inside a menu; role="group" is the correct ARIA pattern here
|
|
398
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
399
|
+
"div",
|
|
400
|
+
{
|
|
401
|
+
ref: (node) => {
|
|
402
|
+
groupRef.current = node;
|
|
403
|
+
if (typeof ref === "function") {
|
|
404
|
+
ref(node);
|
|
405
|
+
} else if (ref) {
|
|
406
|
+
ref.current = node;
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
role: "group",
|
|
410
|
+
"data-dropdown-menu-tab-stops": "",
|
|
411
|
+
className: cn.cn("relative flex w-full flex-col", className),
|
|
412
|
+
...props,
|
|
413
|
+
children: [
|
|
414
|
+
/* @__PURE__ */ jsxRuntime.jsx(reorderShared.ReorderActionsContext.Provider, { value: actions, children: /* @__PURE__ */ jsxRuntime.jsx(reorderShared.ReorderLiftedContext.Provider, { value: lifted, children }) }),
|
|
415
|
+
showDropIndicator && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
416
|
+
"div",
|
|
417
|
+
{
|
|
418
|
+
"aria-hidden": "true",
|
|
419
|
+
"data-reorder-indicator": "",
|
|
420
|
+
className: "pointer-events-none absolute inset-x-3 z-10 flex -translate-y-1/2 items-center",
|
|
421
|
+
style: { top: drag.edges[dropIndex] },
|
|
422
|
+
children: [
|
|
423
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "size-2 shrink-0 rounded-full bg-content-primary" }),
|
|
424
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "h-0.5 min-w-0 flex-1 rounded-full bg-content-primary" })
|
|
425
|
+
]
|
|
426
|
+
}
|
|
427
|
+
),
|
|
428
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { id: instructionsId, className: "sr-only", children: instructions }),
|
|
429
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { role: "status", "aria-live": "polite", className: "sr-only", children: announcement })
|
|
430
|
+
]
|
|
431
|
+
}
|
|
432
|
+
)
|
|
433
|
+
);
|
|
434
|
+
}
|
|
435
|
+
);
|
|
436
|
+
DropdownMenuReorderGroup.displayName = "DropdownMenuReorderGroup";
|
|
437
|
+
exports.DropdownMenuReorderGroup = DropdownMenuReorderGroup;
|
|
438
|
+
//# sourceMappingURL=DropdownMenuReorderGroup.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DropdownMenuReorderGroup.cjs","sources":["../../../../src/components/DropdownMenu/DropdownMenuReorderGroup.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { DropdownMenuVariantContext } from \"./context\";\nimport {\n type DropdownMenuReorderDetail,\n type RegisteredReorderItem,\n type ReorderActions,\n ReorderActionsContext,\n type ReorderDrag,\n type ReorderLifted,\n ReorderLiftedContext,\n} from \"./reorderShared\";\n\n// Movement, in CSS px, below which a press-and-release on a reorder row still\n// counts as a click rather than a drag lift.\nconst REORDER_LIFT_THRESHOLD_PX = 4;\n\n// Distance from a scrollable menu's top/bottom edge within which a lifted drag\n// auto-scrolls it, and the fastest per-frame scroll step that ramps up as the\n// pointer nears the edge.\nconst REORDER_AUTOSCROLL_ZONE_PX = 32;\nconst REORDER_AUTOSCROLL_MAX_STEP_PX = 8;\n\nconst DEFAULT_REORDER_INSTRUCTIONS = \"Press the up and down arrow keys to move this item.\";\n\nfunction findScrollableAncestor(element: HTMLElement): HTMLElement | null {\n let current = element.parentElement;\n while (current !== null) {\n const { overflowY } = getComputedStyle(current);\n if (\n (overflowY === \"auto\" || overflowY === \"scroll\") &&\n current.scrollHeight > current.clientHeight\n ) {\n return current;\n }\n current = current.parentElement;\n }\n return null;\n}\n\n// How far past the auto-scroll zone the pointer sits: negative above the top\n// zone, positive below the bottom one, 0 when it is clear of both.\nfunction edgeOvershoot(rect: DOMRect, y: number): number {\n if (y < rect.top + REORDER_AUTOSCROLL_ZONE_PX) return y - (rect.top + REORDER_AUTOSCROLL_ZONE_PX);\n if (y > rect.bottom - REORDER_AUTOSCROLL_ZONE_PX) {\n return y - (rect.bottom - REORDER_AUTOSCROLL_ZONE_PX);\n }\n return 0;\n}\n\n// Keeps the latest value of a prop reachable from callbacks that must stay\n// referentially stable (they are handed to imperative listeners and a context).\nfunction useLatestRef<T>(value: T): React.RefObject<T> {\n const ref = React.useRef(value);\n React.useLayoutEffect(() => {\n ref.current = value;\n });\n return ref;\n}\n\nfunction shallowEqualArrays(a: readonly string[], b: readonly string[]): boolean {\n return a.length === b.length && a.every((value, index) => value === b[index]);\n}\nfunction defaultReorderAnnouncement({ label, to, total }: DropdownMenuReorderDetail): string {\n return `${label} moved to position ${to + 1} of ${total}`;\n}\n/** Props for the {@link DropdownMenuReorderGroup} component. */\nexport interface DropdownMenuReorderGroupProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n /**\n * Item values in their current order. Must contain one entry per\n * {@link DropdownMenuReorderItem} child, in the same order the children are\n * rendered.\n */\n values: string[];\n /**\n * Fires after a drop or a keyboard move completes with the new order, plus\n * which item moved and from/to where — enough to call a move-to-position\n * API without diffing the arrays.\n */\n onReorder: (values: string[], detail: DropdownMenuReorderDetail) => void;\n /**\n * Builds the text announced to screen readers after a move. Override to\n * localise it.\n * @default ({ label, to, total }) => `${label} moved to position ${to + 1} of ${total}`\n */\n getAnnouncement?: (detail: DropdownMenuReorderDetail) => string;\n /**\n * Screen-reader instructions attached to every drag handle. Override to\n * localise them.\n * @default \"Press the up and down arrow keys to move this item.\"\n */\n instructions?: string;\n}\n\n/**\n * A drag-to-reorder list of {@link DropdownMenuReorderItem} rows within a\n * dropdown menu — the \"Reorganise\" mode of `V2 Menu Dropdown`. Rows are\n * dragged with the pointer (from anywhere on the row with a mouse, from the\n * drag handle on touch) or moved with ArrowUp/ArrowDown on the focused\n * handle. Works in both the `\"menu\"` and `\"sheet\"` variants — for a long\n * list in a sheet, give the scrolling ancestor `overflow-y-auto` (the sheet\n * only caps its height) so edge auto-scroll has something to scroll.\n *\n * Inside a `\"menu\"`, Tab cycles through the handles and any header actions\n * (Radix menus otherwise swallow Tab), and the first handle takes focus when\n * the menu opens straight into the group.\n *\n * Pair with a {@link DropdownMenuHeader} whose `actions` contains a commit\n * button to exit the reorder mode.\n *\n * @example\n * ```tsx\n * <DropdownMenuReorderGroup\n * values={folders.map((folder) => folder.id)}\n * onReorder={(_, { value, to }) => moveFolder(value, to)}\n * aria-label=\"Reorder folders\"\n * >\n * {folders.map((folder) => (\n * <DropdownMenuReorderItem key={folder.id} value={folder.id} label={folder.name}>\n * {folder.name}\n * </DropdownMenuReorderItem>\n * ))}\n * </DropdownMenuReorderGroup>\n * ```\n */\nexport const DropdownMenuReorderGroup = React.forwardRef<\n HTMLDivElement,\n DropdownMenuReorderGroupProps\n>(\n (\n {\n values,\n onReorder,\n getAnnouncement = defaultReorderAnnouncement,\n instructions = DEFAULT_REORDER_INSTRUCTIONS,\n className,\n children,\n ...props\n },\n ref,\n ) => {\n const variant = React.useContext(DropdownMenuVariantContext);\n const instructionsId = React.useId();\n const groupRef = React.useRef<HTMLDivElement | null>(null);\n const itemsRef = React.useRef(new Map<string, RegisteredReorderItem>());\n const dragRef = React.useRef<ReorderDrag | null>(null);\n const ghostRef = React.useRef<HTMLDivElement | null>(null);\n const scrollContainerRef = React.useRef<HTMLElement | null>(null);\n const lastPointerRef = React.useRef<{ x: number; y: number } | null>(null);\n const autoScrollFrameRef = React.useRef<number | null>(null);\n const dragDisposersRef = React.useRef<Array<() => void>>([]);\n const valuesRef = useLatestRef(values);\n const onReorderRef = useLatestRef(onReorder);\n const getAnnouncementRef = useLatestRef(getAnnouncement);\n const [lifted, setLifted] = React.useState<ReorderLifted | null>(null);\n const [dropIndex, setDropIndex] = React.useState(-1);\n const [announcement, setAnnouncement] = React.useState(\"\");\n\n const registerItem = React.useCallback((value: string, item: RegisteredReorderItem | null) => {\n if (item === null) {\n itemsRef.current.delete(value);\n } else {\n itemsRef.current.set(value, item);\n }\n }, []);\n\n const positionGhost = React.useCallback(() => {\n const drag = dragRef.current;\n const ghost = ghostRef.current;\n const pointer = lastPointerRef.current;\n if (drag === null || ghost === null || pointer === null) return;\n // A transform, not left/top: it moves the ghost on the compositor\n // without invalidating layout, so nothing forces a reflow per move.\n ghost.style.transform = `translate3d(${pointer.x - drag.offsetX}px, ${pointer.y - drag.offsetY}px, 0)`;\n }, []);\n\n const registerGhost = React.useCallback(\n (element: HTMLDivElement | null) => {\n ghostRef.current = element;\n // The ghost mounts in the commit after the lift; place it straight away\n // rather than waiting for the next pointer move.\n if (element !== null) positionGhost();\n },\n [positionGhost],\n );\n\n // Reads every row rect once, in a single batch with no writes in between,\n // so it costs one layout flush per lift instead of one per pointer move.\n const measure = React.useCallback(\n (drag: ReorderDrag) => {\n const group = groupRef.current;\n if (group === null) return;\n const groupTop = group.getBoundingClientRect().top;\n const midpoints: number[] = [];\n const edges: number[] = [];\n let bottom = groupTop;\n for (const value of valuesRef.current) {\n const rect = itemsRef.current.get(value)?.element.getBoundingClientRect();\n if (rect === undefined) {\n midpoints.push(bottom);\n edges.push(bottom - groupTop);\n continue;\n }\n midpoints.push(rect.top + rect.height / 2);\n edges.push(rect.top - groupTop);\n bottom = rect.bottom;\n }\n edges.push(bottom - groupTop);\n drag.midpoints = midpoints;\n drag.edges = edges;\n const container = scrollContainerRef.current;\n drag.scrollTopAtMeasure = container?.scrollTop ?? 0;\n drag.containerRect = container?.getBoundingClientRect() ?? null;\n },\n [valuesRef],\n );\n\n // Rows only move when the container scrolls, so a pointer position in\n // measure-time coordinates is the live one shifted by the scroll delta.\n const computeDropIndex = React.useCallback((drag: ReorderDrag, clientY: number) => {\n const container = scrollContainerRef.current;\n const y = clientY + (container === null ? 0 : container.scrollTop - drag.scrollTopAtMeasure);\n let index = 0;\n for (const midpoint of drag.midpoints) {\n if (midpoint >= y) break;\n index += 1;\n }\n return index;\n }, []);\n\n const refreshDropIndex = React.useCallback(\n (drag: ReorderDrag, clientY: number) => {\n const next = computeDropIndex(drag, clientY);\n if (next === drag.dropIndex) return;\n drag.dropIndex = next;\n setDropIndex(next);\n },\n [computeDropIndex],\n );\n\n const stopAutoScroll = React.useCallback(() => {\n if (autoScrollFrameRef.current === null) return;\n cancelAnimationFrame(autoScrollFrameRef.current);\n autoScrollFrameRef.current = null;\n }, []);\n\n // Runs a frame loop only while the pointer sits in an edge zone of a\n // scrollable container; each frame scrolls one step and the container's\n // scroll event (below) moves the drop target. The loop ends by itself when\n // the pointer leaves the zone or the container runs out of scroll range.\n const updateAutoScroll = React.useCallback(() => {\n const drag = dragRef.current;\n const container = scrollContainerRef.current;\n const pointer = lastPointerRef.current;\n if (\n drag === null ||\n !drag.lifted ||\n container === null ||\n drag.containerRect === null ||\n pointer === null ||\n edgeOvershoot(drag.containerRect, pointer.y) === 0\n ) {\n stopAutoScroll();\n return;\n }\n if (autoScrollFrameRef.current !== null) return;\n const step = () => {\n autoScrollFrameRef.current = null;\n const current = dragRef.current;\n const latest = lastPointerRef.current;\n if (\n current === null ||\n !current.lifted ||\n current.containerRect === null ||\n latest === null\n ) {\n return;\n }\n const overshoot = edgeOvershoot(current.containerRect, latest.y);\n if (overshoot === 0) return;\n const amount = Math.min(Math.ceil(Math.abs(overshoot) / 4), REORDER_AUTOSCROLL_MAX_STEP_PX);\n const before = container.scrollTop;\n container.scrollTop = before + (overshoot < 0 ? -amount : amount);\n // At the end of the scroll range there is nothing more to do until the\n // pointer moves again.\n if (container.scrollTop === before) return;\n autoScrollFrameRef.current = requestAnimationFrame(step);\n };\n autoScrollFrameRef.current = requestAnimationFrame(step);\n }, [stopAutoScroll]);\n\n const clearDrag = React.useCallback(() => {\n stopAutoScroll();\n for (const dispose of dragDisposersRef.current) dispose();\n dragDisposersRef.current = [];\n const drag = dragRef.current;\n dragRef.current = null;\n lastPointerRef.current = null;\n scrollContainerRef.current = null;\n if (drag?.lifted) {\n setLifted(null);\n setDropIndex(-1);\n }\n }, [stopAutoScroll]);\n\n const applyReorder = React.useCallback(\n (value: string, from: number, to: number) => {\n const next = [...valuesRef.current];\n next.splice(from, 1);\n next.splice(to, 0, value);\n const detail: DropdownMenuReorderDetail = {\n value,\n label: itemsRef.current.get(value)?.label ?? value,\n from,\n to,\n total: next.length,\n };\n onReorderRef.current(next, detail);\n setAnnouncement(getAnnouncementRef.current(detail));\n },\n [valuesRef, onReorderRef, getAnnouncementRef],\n );\n\n const endDrag = React.useCallback(\n (pointerId: number, commit: boolean) => {\n const drag = dragRef.current;\n if (drag === null || pointerId !== drag.pointerId) return;\n clearDrag();\n if (!commit || !drag.lifted) return;\n const current = valuesRef.current;\n const from = current.indexOf(drag.value);\n if (from === -1) return;\n const to = Math.max(\n 0,\n Math.min(drag.dropIndex > from ? drag.dropIndex - 1 : drag.dropIndex, current.length - 1),\n );\n if (to === from) return;\n applyReorder(drag.value, from, to);\n },\n [clearDrag, applyReorder, valuesRef],\n );\n\n const startDrag = React.useCallback(\n (value: string, event: React.PointerEvent, element: HTMLDivElement) => {\n // One drag at a time: a second finger cannot hijack the first.\n if (dragRef.current !== null || groupRef.current === null) return false;\n dragRef.current = {\n value,\n pointerId: event.pointerId,\n element,\n startX: event.clientX,\n startY: event.clientY,\n offsetX: 0,\n offsetY: 0,\n lifted: false,\n dropIndex: -1,\n midpoints: [],\n edges: [],\n scrollTopAtMeasure: 0,\n containerRect: null,\n };\n lastPointerRef.current = { x: event.clientX, y: event.clientY };\n\n const view = element.ownerDocument.defaultView ?? window;\n // The row's own pointer handlers end the drag in the normal case. These\n // catch the pointer the row never sees again — the row unmounting\n // mid-drag (a list refetch) or its capture being lost — so a drag can't\n // be left half-finished with its listeners still attached.\n const onPointerUp = (pointerEvent: PointerEvent) => endDrag(pointerEvent.pointerId, true);\n const onPointerCancel = (pointerEvent: PointerEvent) =>\n endDrag(pointerEvent.pointerId, false);\n const onKeyDown = (keyEvent: KeyboardEvent) => {\n // Before the lift a press is still just a press: Escape must keep\n // closing the menu as usual.\n if (keyEvent.key !== \"Escape\" || dragRef.current?.lifted !== true) return;\n // Swallow it entirely so Radix's dismissable layer doesn't also close\n // the whole menu — Escape mid-drag only cancels the drag.\n keyEvent.preventDefault();\n keyEvent.stopPropagation();\n clearDrag();\n };\n view.addEventListener(\"pointerup\", onPointerUp);\n view.addEventListener(\"pointercancel\", onPointerCancel);\n view.addEventListener(\"keydown\", onKeyDown, true);\n dragDisposersRef.current.push(() => {\n view.removeEventListener(\"pointerup\", onPointerUp);\n view.removeEventListener(\"pointercancel\", onPointerCancel);\n view.removeEventListener(\"keydown\", onKeyDown, true);\n });\n return true;\n },\n [endDrag, clearDrag],\n );\n\n const lift = React.useCallback(\n (drag: ReorderDrag, pointer: { x: number; y: number }) => {\n const { element } = drag;\n const rect = element.getBoundingClientRect();\n drag.offsetX = drag.startX - rect.left;\n drag.offsetY = drag.startY - rect.top;\n\n const container = findScrollableAncestor(element);\n scrollContainerRef.current = container;\n if (container !== null) {\n // Covers both edge auto-scroll and the user wheel-scrolling mid-drag:\n // the pointer may not move again, so pointermove alone can't keep the\n // drop target honest.\n const onScroll = () => {\n const current = dragRef.current;\n const latest = lastPointerRef.current;\n if (current === null || !current.lifted || latest === null) return;\n refreshDropIndex(current, latest.y);\n };\n container.addEventListener(\"scroll\", onScroll, { passive: true });\n dragDisposersRef.current.push(() => container.removeEventListener(\"scroll\", onScroll));\n }\n\n measure(drag);\n drag.lifted = true;\n drag.dropIndex = computeDropIndex(drag, pointer.y);\n\n // The ghost is portalled to <body>, outside the menu's stacking context,\n // so it inherits none of the menu's z-index. Match the surface it lifted\n // from (the popper sets its own z, and a consumer may have raised it) —\n // being appended later in the DOM keeps it painted above at equal z.\n const surface = element.closest<HTMLElement>('[role=\"menu\"],[role=\"dialog\"]');\n const surfaceZIndex = surface === null ? \"\" : getComputedStyle(surface).zIndex;\n setLifted({\n value: drag.value,\n width: rect.width,\n zIndex:\n surfaceZIndex === \"\" || surfaceZIndex === \"auto\"\n ? \"var(--fanvue-ui-portal-z-index, 50)\"\n : surfaceZIndex,\n });\n setDropIndex(drag.dropIndex);\n },\n [measure, computeDropIndex, refreshDropIndex],\n );\n\n const updateDrag = React.useCallback(\n (event: React.PointerEvent) => {\n const drag = dragRef.current;\n if (drag === null || event.pointerId !== drag.pointerId) return;\n const pointer = { x: event.clientX, y: event.clientY };\n lastPointerRef.current = pointer;\n if (!drag.lifted) {\n if (\n Math.hypot(pointer.x - drag.startX, pointer.y - drag.startY) <=\n REORDER_LIFT_THRESHOLD_PX\n ) {\n return;\n }\n lift(drag, pointer);\n }\n positionGhost();\n refreshDropIndex(drag, pointer.y);\n updateAutoScroll();\n },\n [lift, positionGhost, refreshDropIndex, updateAutoScroll],\n );\n\n const moveItem = React.useCallback(\n (value: string, delta: number) => {\n const current = valuesRef.current;\n const from = current.indexOf(value);\n const to = from + delta;\n if (from === -1 || to < 0 || to >= current.length) return;\n applyReorder(value, from, to);\n },\n [applyReorder, valuesRef],\n );\n\n // Never leave listeners or a frame loop behind when the group goes away\n // mid-drag (the menu closing, for instance).\n React.useEffect(() => clearDrag, [clearDrag]);\n\n // The list changed under a drag: drop the drag if its row is gone, else\n // re-measure so the indicator tracks the rows' new positions.\n const previousValuesRef = React.useRef(values);\n React.useLayoutEffect(() => {\n if (shallowEqualArrays(previousValuesRef.current, values)) return;\n previousValuesRef.current = values;\n const drag = dragRef.current;\n if (drag === null) return;\n if (!values.includes(drag.value)) {\n clearDrag();\n return;\n }\n if (!drag.lifted) return;\n measure(drag);\n const pointer = lastPointerRef.current;\n if (pointer !== null) refreshDropIndex(drag, pointer.y);\n }, [values, clearDrag, measure, refreshDropIndex]);\n\n // Keyboard reachability inside a Radix menu. Radix parks focus on the menu\n // content when it opens and moves it only between menu items — which\n // these rows are not — so without help a keyboard user could never reach\n // a handle. When the menu opens straight into the group, the first handle\n // takes focus once Radix has finished its own focus work. And if focus has\n // fallen to <body> (the control that switched the menu into reorder mode\n // unmounted under it), Tab lands on the first handle instead of leaving\n // the menu for the page behind it.\n React.useEffect(() => {\n if (variant !== \"menu\") return;\n const group = groupRef.current;\n const menu = group?.closest<HTMLElement>('[role=\"menu\"]') ?? null;\n // Nothing to do outside a menu (the sheet variant, or a bare group).\n if (group === null || menu === null) return;\n const doc = group.ownerDocument;\n const focusFirstHandle = () => {\n const handle = group.querySelector<HTMLElement>(\"button:not(:disabled)\");\n if (handle === null) return false;\n handle.focus({ preventScroll: true });\n return true;\n };\n const frame = requestAnimationFrame(() => {\n const active = doc.activeElement;\n const parkedOnMenu = active === null || active === doc.body || active === menu;\n // A menu that also lists regular items keeps Radix's item-first\n // navigation; only claim focus when the group is all there is.\n const hasMenuItems = menu.querySelector('[role^=\"menuitem\"]') !== null;\n if (parkedOnMenu && !hasMenuItems) focusFirstHandle();\n });\n const rescueTab = (event: KeyboardEvent) => {\n if (event.key !== \"Tab\" || event.altKey || event.ctrlKey || event.metaKey) return;\n const active = doc.activeElement;\n if (active !== null && active !== doc.body) return;\n if (menu.getAttribute(\"data-state\") !== \"open\") return;\n if (focusFirstHandle()) event.preventDefault();\n };\n doc.addEventListener(\"keydown\", rescueTab, true);\n return () => {\n cancelAnimationFrame(frame);\n doc.removeEventListener(\"keydown\", rescueTab, true);\n };\n }, [variant]);\n\n const actions = React.useMemo<ReorderActions>(\n () => ({\n registerItem,\n registerGhost,\n startDrag,\n updateDrag,\n endDrag,\n moveItem,\n instructionsId,\n }),\n [registerItem, registerGhost, startDrag, updateDrag, endDrag, moveItem, instructionsId],\n );\n\n const drag = dragRef.current;\n const liftedFrom = lifted === null ? -1 : values.indexOf(lifted.value);\n const showDropIndicator =\n lifted !== null &&\n drag !== null &&\n dropIndex !== -1 &&\n dropIndex !== liftedFrom &&\n dropIndex !== liftedFrom + 1;\n\n return (\n // biome-ignore lint/a11y/useSemanticElements: <fieldset> carries form semantics and default styling we don't want inside a menu; role=\"group\" is the correct ARIA pattern here\n <div\n ref={(node) => {\n groupRef.current = node;\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n }}\n role=\"group\"\n data-dropdown-menu-tab-stops=\"\"\n className={cn(\"relative flex w-full flex-col\", className)}\n {...props}\n >\n <ReorderActionsContext.Provider value={actions}>\n <ReorderLiftedContext.Provider value={lifted}>{children}</ReorderLiftedContext.Provider>\n </ReorderActionsContext.Provider>\n {showDropIndicator && (\n <div\n aria-hidden=\"true\"\n data-reorder-indicator=\"\"\n className=\"pointer-events-none absolute inset-x-3 z-10 flex -translate-y-1/2 items-center\"\n style={{ top: drag.edges[dropIndex] }}\n >\n <span className=\"size-2 shrink-0 rounded-full bg-content-primary\" />\n <span className=\"h-0.5 min-w-0 flex-1 rounded-full bg-content-primary\" />\n </div>\n )}\n <span id={instructionsId} className=\"sr-only\">\n {instructions}\n </span>\n {/* biome-ignore lint/a11y/useSemanticElements: <output> is not appropriate here; using role=\"status\" for live region announcements */}\n <span role=\"status\" aria-live=\"polite\" className=\"sr-only\">\n {announcement}\n </span>\n </div>\n );\n },\n);\nDropdownMenuReorderGroup.displayName = \"DropdownMenuReorderGroup\";\n"],"names":["React","DropdownMenuVariantContext","drag","jsxs","cn","jsx","ReorderActionsContext","ReorderLiftedContext"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAeA,MAAM,4BAA4B;AAKlC,MAAM,6BAA6B;AACnC,MAAM,iCAAiC;AAEvC,MAAM,+BAA+B;AAErC,SAAS,uBAAuB,SAA0C;AACxE,MAAI,UAAU,QAAQ;AACtB,SAAO,YAAY,MAAM;AACvB,UAAM,EAAE,UAAA,IAAc,iBAAiB,OAAO;AAC9C,SACG,cAAc,UAAU,cAAc,aACvC,QAAQ,eAAe,QAAQ,cAC/B;AACA,aAAO;AAAA,IACT;AACA,cAAU,QA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