@photon-ai/pho-ui 4.13.0 → 4.14.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/chunks/{command-D5g49VqR.js → command-kB5bMvM1.js} +2 -2
- package/dist/chunks/{command-D5g49VqR.js.map → command-kB5bMvM1.js.map} +1 -1
- package/dist/chunks/{dialog-ChS0tdHa.js → dialog-12foDiQb.js} +4 -4
- package/dist/chunks/{dialog-ChS0tdHa.js.map → dialog-12foDiQb.js.map} +1 -1
- package/dist/chunks/{filter-bar-C4sPEjw1.js → filter-bar-DuZXXvdm.js} +2 -2
- package/dist/chunks/{filter-bar-C4sPEjw1.js.map → filter-bar-DuZXXvdm.js.map} +1 -1
- package/dist/chunks/select-COFV0NLb.js +109 -0
- package/dist/chunks/select-COFV0NLb.js.map +1 -0
- package/dist/components/command.js +1 -1
- package/dist/components/dialog.js +1 -1
- package/dist/components/filter-bar.js +1 -1
- package/dist/components/scope.js +342 -258
- package/dist/components/scope.js.map +1 -1
- package/dist/components/select.js +2 -106
- package/dist/index.js +2 -2
- package/dist/src/components/scope/index.d.ts +1 -1
- package/dist/src/components/scope/scope.d.ts +19 -1
- package/package.json +1 -1
- package/dist/components/select.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope.js","names":[],"sources":["../../src/components/scope/scope.tsx"],"sourcesContent":["import {\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type ComponentProps,\n type KeyboardEvent,\n type Ref,\n type RefObject,\n} from \"react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\nimport { Tooltip as BaseTooltip } from \"@base-ui/react/tooltip\";\nimport { CloseButton, buttonVariants } from \"../button\";\nimport { Checkbox } from \"../checkbox\";\nimport { Skeleton } from \"../skeleton\";\nimport { Tooltip } from \"../tooltip\";\nimport { revealIn } from \"../../motion\";\nimport { cn } from \"../../utils/cn\";\nimport { GhostSearch } from \"../../utils/ghost-search\";\n\n/**\n * Scope — pick what something covers out of a catalog: the events a webhook\n * destination receives, the permissions an app or key holds. A searchable,\n * grouped checklist with a catch-all row; `collapsible` folds it to a\n * two-line summary for a resource that already exists, opening on click.\n */\n\nexport interface ScopeItem {\n /**\n * What the selection holds — an event type, a permission id. It is also\n * the row's name unless `label` says otherwise.\n */\n value: string;\n /** The row's name, when it shouldn't be the value itself. */\n label?: string;\n /** One line on what it covers. Searched along with the name. */\n description?: string;\n /**\n * The group it files under — the resource, the namespace. Groups keep\n * the order they first appear in; items without one come first.\n */\n group?: string;\n}\n\nexport interface ScopeAll {\n /** The row's name — `All events`. */\n label: string;\n /** What choosing it means — `Every current and future event.` */\n description?: string;\n /**\n * A wildcard the selection holds in place of the items — `*`. With it,\n * the row stands for every item, now and later: choosing it sets the\n * selection to `[value]`, and leaving it spells every item out by name so\n * the reader prunes from there, never from nothing. Without it, the row\n * selects every item listed.\n */\n value?: string;\n}\n\nexport interface ScopeProps extends Omit<\n ComponentProps<\"div\">,\n \"defaultValue\" | \"onChange\" | \"children\"\n> {\n /** The catalog — everything that can be picked, in display order. */\n items: readonly ScopeItem[];\n /** The selected values, controlled. */\n value?: readonly string[];\n /** The selected values at first, uncontrolled. */\n defaultValue?: readonly string[];\n /**\n * Called with the next selection, in catalog order (values no longer in\n * the catalog follow in the order they were held).\n */\n onValueChange?: (value: string[]) => void;\n /** The catch-all row at the top. Leave it out for no such row. */\n all?: ScopeAll;\n /** The search field's placeholder, which also names it. @default \"Search\" */\n placeholder?: string;\n /**\n * Fold to a two-line summary of the selection, opening to the full list\n * on click — for a resource that already exists, where the scope is read\n * far more often than it changes. The page saves the change (its \"Save\n * changes\" below the card) and folds the list through `open`; the ✕ in\n * the search row, or `Escape` on an empty search, drops the edit: the\n * selection goes back to what it was when the list opened, and folds.\n */\n collapsible?: boolean;\n /** Whether the collapsible list is open, controlled. */\n open?: boolean;\n /** Whether the collapsible list starts open. @default false */\n defaultOpen?: boolean;\n /** Called when the collapsible list opens or folds. */\n onOpenChange?: (open: boolean) => void;\n /** The catalog is on its way: bones in place of rows. */\n loading?: boolean;\n /**\n * Read-only: the list can be searched but not changed, and a folded one\n * stays folded. Held open by `open` (a save in flight), nothing in it\n * changes the selection, the ✕ and Escape included.\n */\n disabled?: boolean;\n ref?: Ref<HTMLDivElement>;\n}\n\n/* ------------------------------- class map ------------------------------- */\n\n/**\n * The card: the BasicPage card's stroke, corner, and fill. `overflow-clip`\n * rounds a hovered edge row into the corners without making the card a\n * scroll container. The rows lay out by the card's width, not the\n * viewport's: it is measured (`data-wide`, `data-roomy`) rather than made a\n * CSS query container, because Chromium drops a query container's\n * children from layout when a `Reveal` mounts beside it in a Base UI form\n * (a BasicPage `Footer` appearing under the card left it 2px tall).\n *\n * Its words stand `--scope-inset` in from its edges, which is the page's\n * choice inset (the one `RadioCard` and `CheckboxCard` pad by): 20px when\n * the card stands on a `BasicPage.Stack`, on the headings' line like any\n * card's rows; 12px inside a sheet, a card, or a dialog, where it is a\n * field among fields and its words line up with theirs.\n */\nconst SCOPE_SURFACE =\n \"group/scope w-full min-w-0 overflow-clip rounded-base border border-pho-secondary bg-pho-primary [--scope-inset:var(--choice-card-inset,0.75rem)]\";\n\n/** The side padding every row of the card shares. */\nconst SCOPE_INSET = \"px-[var(--scope-inset)]\";\n\n/**\n * The search, the card's first row: no box of its own. The magnifier stands\n * on the checkbox column and the query on the names' line, the count at the\n * row's end and, on a collapsible list, the ✕ that drops the edit after it,\n * its glyph as far in from the right edge as the magnifier's from the left.\n * 44px with the hairline below, the DataTable toolbar band's height.\n */\nconst SCOPE_SEARCH_ROW =\n \"flex min-h-11 items-center gap-3 border-b border-pho-secondary px-[var(--scope-inset)]\";\n\n/**\n * Two columns once the card is wide enough: the names, as wide as the\n * longest (never past 45%), then the descriptions on one shared edge.\n * Narrower, each row stacks its description under its name.\n */\nconst SCOPE_LIST =\n \"grid grid-cols-1 group-data-[wide]/scope:grid-cols-[fit-content(45%)_minmax(0,1fr)] group-data-[wide]/scope:gap-x-4\";\n\n/** A group: its band and its rows, on the list's columns. */\nconst SCOPE_GROUP =\n \"col-span-full grid grid-cols-subgrid border-t border-pho-secondary first:border-t-0\";\n\n/**\n * One row: 36px on the wide layout — a 20px line and 8px either side. Only\n * the stacked layout's row gap is set: the columns' gap is the list's, and\n * a subgrid that set its own would let a long name run into its\n * description.\n */\nconst SCOPE_ROW =\n \"group col-span-full flex min-w-0 cursor-pointer flex-col gap-y-0.5 px-[var(--scope-inset)] py-2 transition-colors select-none hover:bg-pho-primary-hover group-data-[wide]/scope:grid group-data-[wide]/scope:grid-cols-subgrid group-data-[wide]/scope:items-center data-[disabled]:cursor-not-allowed data-[disabled]:hover:bg-transparent\";\n\n/** A bone row: a row's layout, nothing to hover or click. */\nconst SCOPE_BONE_ROW =\n \"col-span-full flex min-w-0 flex-col gap-y-0.5 px-[var(--scope-inset)] py-2 group-data-[wide]/scope:grid group-data-[wide]/scope:grid-cols-subgrid group-data-[wide]/scope:items-center\";\n\n/**\n * A group's band — DataTable's section wash, thinner than the rows it\n * heads, with the group's own checkbox on the rows' checkbox column.\n */\nconst SCOPE_GROUP_BAND =\n \"group col-span-full flex h-8 min-w-0 cursor-pointer items-center gap-2 border-b border-pho-secondary bg-pho-page px-[var(--scope-inset)] text-xs font-medium text-pho-secondary select-none data-[disabled]:cursor-not-allowed\";\n\n/**\n * A description: under the name (two lines at most) on the narrow layout,\n * one line in its own column on the wide one — the rest opens on hover.\n */\nconst SCOPE_DESCRIPTION =\n \"line-clamp-2 min-w-0 pl-6 text-xs text-pho-description group-data-[wide]/scope:block group-data-[wide]/scope:truncate group-data-[wide]/scope:pl-0\";\n\n/** The folded summary: two lines, the whole card its hit target. */\nconst SCOPE_SUMMARY =\n \"flex w-full min-w-0 items-center gap-3 py-2.5 pr-2 pl-[var(--scope-inset)] text-left outline-pho-brand focus-visible:outline-2 focus-visible:-outline-offset-2\";\n\n/** Two columns (names, then descriptions) from this card width up. */\nconst WIDE_REM = 34;\n/** The count stands in the search row from this card width up. */\nconst ROOMY_REM = 18;\n\n/**\n * The card's width against the two breakpoints, measured before paint and\n * followed as it changes. Desktop-first until measured, so a server render\n * shows the common layout.\n */\nfunction useCardWidth(ref: RefObject<HTMLElement | null>) {\n const [size, setSize] = useState({ wide: true, roomy: true });\n useLayoutEffect(() => {\n const node = ref.current;\n if (node == null) return;\n const measure = () => {\n const rem =\n parseFloat(getComputedStyle(document.documentElement).fontSize) || 16;\n const width = node.getBoundingClientRect().width;\n const next = {\n wide: width >= WIDE_REM * rem,\n roomy: width >= ROOMY_REM * rem,\n };\n setSize((current) =>\n current.wide === next.wide && current.roomy === next.roomy\n ? current\n : next,\n );\n };\n measure();\n const observer = new ResizeObserver(measure);\n observer.observe(node);\n return () => observer.disconnect();\n }, [ref]);\n return size;\n}\n\n/* -------------------------------- model --------------------------------- */\n\ninterface ScopeGroup {\n label: string | null;\n items: ScopeItem[];\n}\n\n/** Items by group, groups in first-appearance order, ungrouped first. */\nfunction groupItems(items: readonly ScopeItem[]): ScopeGroup[] {\n const groups: ScopeGroup[] = [];\n const byLabel = new Map<string | null, ScopeGroup>();\n for (const item of items) {\n const label = item.group ?? null;\n let group = byLabel.get(label);\n if (!group) {\n group = { label, items: [] };\n byLabel.set(label, group);\n groups.push(group);\n }\n group.items.push(item);\n }\n return [\n ...groups.filter((group) => group.label === null),\n ...groups.filter((group) => group.label !== null),\n ];\n}\n\n/**\n * Lowercase, with the separators ids are written in (`.`, `:`, `-`, `_`,\n * `/`) read as spaces — `call ended` finds `call.ended`.\n */\nfunction normalize(text: string): string {\n return text.toLowerCase().replace(/[.:\\-_/]/g, \" \");\n}\n\nfunction tokenize(query: string): string[] {\n return normalize(query).split(/\\s+/).filter(Boolean);\n}\n\n/** Every word of the query somewhere in the group, name, or description. */\nfunction matches(\n tokens: readonly string[],\n ...fields: (string | null | undefined)[]\n) {\n const haystack = normalize(fields.filter(Boolean).join(\" \"));\n return tokens.every((token) => haystack.includes(token));\n}\n\nfunction nameOf(item: ScopeItem): string {\n return item.label ?? item.value;\n}\n\n/** The same values, whatever their order. */\nfunction sameSelection(a: readonly string[], b: readonly string[]): boolean {\n if (a.length !== b.length) return false;\n const held = new Set(a);\n return b.every((value) => held.has(value));\n}\n\n/** Whether a description shows whole, measured when the pointer asks. */\nfunction isClipped(target: EventTarget | null | undefined): boolean {\n if (!(target instanceof Element)) return false;\n const text = target.closest<HTMLElement>(\"[data-scope-description]\");\n if (text == null) return false;\n return (\n text.scrollWidth > text.clientWidth + 1 ||\n text.scrollHeight > text.clientHeight + 1\n );\n}\n\n/* ------------------------------- component ------------------------------- */\n\n/**\n * A searchable, grouped checklist for choosing what something covers.\n *\n * Every row is one line on a wide card — the name, then its description in\n * a second column that opens whole on hover when it doesn't fit. Groups are\n * thin tinted bands carrying a checkbox for the whole group (mixed when\n * partly chosen). The search matches names, descriptions, and group names,\n * word by word; while it holds a query the catch-all row steps aside and a\n * group's checkbox covers the rows it shows.\n *\n * With `collapsible`, the card rests as a summary — whole groups by name,\n * the rest by item, over a count — and opens in place, the search taking\n * focus, when clicked; its ✕ drops the edit and folds it back, the page's\n * own save below the card commits it. Values the catalog no longer offers keep a row\n * under \"No longer offered\": they can be removed, never added in bulk.\n */\nexport function Scope({\n items,\n value: valueProp,\n defaultValue,\n onValueChange,\n all,\n placeholder = \"Search\",\n collapsible = false,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n loading = false,\n disabled = false,\n className,\n ref,\n ...props\n}: ScopeProps) {\n const [innerValue, setInnerValue] = useState<readonly string[]>(\n defaultValue ?? [],\n );\n const value = valueProp ?? innerValue;\n const [innerOpen, setInnerOpen] = useState(defaultOpen);\n const open = collapsible ? (openProp ?? innerOpen) : true;\n const [query, setQuery] = useState(\"\");\n\n const reduceMotion = useReducedMotion();\n const cardRef = useRef<HTMLDivElement | null>(null);\n const { wide, roomy } = useCardWidth(cardRef);\n const baseId = useId();\n const listId = `${baseId}-list`;\n const searchRef = useRef<HTMLInputElement | null>(null);\n const summaryRef = useRef<HTMLButtonElement | null>(null);\n // Where focus goes once the next face has mounted — set only by our own\n // controls, so a host flipping `open` doesn't pull focus around.\n const focusNext = useRef<\"search\" | \"summary\" | null>(null);\n const handle = useMemo(() => BaseTooltip.createHandle<string>(), []);\n\n const groups = useMemo(() => groupItems(items), [items]);\n const offered = useMemo(\n () => new Set(items.map((item) => item.value)),\n [items],\n );\n // Ids go by catalog position: values may hold characters an id shouldn't.\n const position = useMemo(\n () => new Map(items.map((item, index) => [item.value, index])),\n [items],\n );\n const groupPosition = useMemo(\n () => new Map(groups.map((group, index) => [group.label, index])),\n [groups],\n );\n\n // Values held that the catalog doesn't offer. Remembered while mounted,\n // so one unticked stays on the list and can be ticked back.\n const retiredSeen = useRef<string[]>([]);\n for (const held of value) {\n if (\n held !== all?.value &&\n !offered.has(held) &&\n !retiredSeen.current.includes(held)\n ) {\n retiredSeen.current.push(held);\n }\n }\n const retired = retiredSeen.current.filter((held) => !offered.has(held));\n\n const wildcard = all?.value;\n const selected = new Set(value);\n const everything = wildcard !== undefined && selected.has(wildcard);\n const isOn = (item: string) =>\n everything ? offered.has(item) : selected.has(item);\n const offeredOn = items.filter((item) => isOn(item.value)).length;\n const retiredOn = retired.filter((held) => selected.has(held)).length;\n\n const setValue = (next: string[]) => {\n if (valueProp === undefined) setInnerValue(next);\n onValueChange?.(next);\n };\n /** Catalog order, then what's no longer offered in the order it was held. */\n const emit = (next: Set<string>) =>\n setValue([\n ...items.filter((item) => next.has(item.value)).map((item) => item.value),\n ...retired.filter((held) => next.has(held)),\n ]);\n /** The selection by name — under the wildcard, every item it stands for. */\n const explicit = () =>\n everything\n ? new Set(items.map((item) => item.value))\n : new Set(value.filter((held) => held !== wildcard));\n const toggle = (values: readonly string[], on: boolean) => {\n const next = explicit();\n for (const item of values) {\n if (on) next.add(item);\n else next.delete(item);\n }\n emit(next);\n };\n const toggleAll = (on: boolean) => {\n if (wildcard === undefined) {\n toggle(\n items.map((item) => item.value),\n on,\n );\n } else if (on) {\n setValue([wildcard]);\n } else {\n emit(new Set(items.map((item) => item.value)));\n }\n };\n\n const setOpen = (next: boolean) => {\n if (openProp === undefined) setInnerOpen(next);\n onOpenChange?.(next);\n };\n const unfold = () => {\n focusNext.current = \"search\";\n setOpen(true);\n };\n const fold = () => {\n focusNext.current = \"summary\";\n setQuery(\"\");\n setOpen(false);\n };\n\n // The selection as it stood when the list opened, whoever opened it:\n // dismissing the edit puts it back.\n const valueRef = useRef(value);\n valueRef.current = value;\n const openedWith = useRef<readonly string[] | null>(open ? value : null);\n useEffect(() => {\n openedWith.current = open ? valueRef.current : null;\n // Folded by the page (after its save) or by the ✕, the next opening\n // starts from the whole list.\n if (!open) setQuery(\"\");\n }, [open]);\n /** The ✕ (or Escape): the edit is dropped and the list folds. */\n const dismiss = () => {\n const before = openedWith.current;\n if (before != null && !sameSelection(before, valueRef.current)) {\n setValue([...before]);\n }\n fold();\n };\n\n // Focus lands once the face can take it: it fades in, and a field asked\n // to focus on its first frame may still refuse. Try a frame at a time.\n useEffect(() => {\n const target = focusNext.current;\n if (target == null) return;\n focusNext.current = null;\n let frame = 0;\n let tries = 0;\n const attempt = () => {\n const node = target === \"search\" ? searchRef.current : summaryRef.current;\n if (node == null) return;\n node.focus();\n if (document.activeElement !== node && tries++ < 5) {\n frame = requestAnimationFrame(attempt);\n }\n };\n frame = requestAnimationFrame(attempt);\n return () => cancelAnimationFrame(frame);\n }, [open]);\n\n const onSearchKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n // A search, not the form's submit.\n if (event.key === \"Enter\") event.preventDefault();\n if (event.key !== \"Escape\") return;\n if (query !== \"\") {\n // Ours — not an enclosing dialog's or aside's close.\n event.preventDefault();\n setQuery(\"\");\n } else if (collapsible && !disabled) {\n event.preventDefault();\n dismiss();\n }\n };\n\n const tokens = tokenize(query);\n const searching = tokens.length > 0;\n const shownGroups = groups\n .map((group) => ({\n ...group,\n items: searching\n ? group.items.filter((item) =>\n matches(\n tokens,\n group.label,\n item.value,\n item.label,\n item.description,\n ),\n )\n : group.items,\n }))\n .filter((group) => group.items.length > 0);\n const shownRetired = searching\n ? retired.filter((held) => matches(tokens, held))\n : retired;\n\n // The count reads the catalog: under the wildcard every item is in and\n // more will be, so it steps aside for the catch-all's own words.\n const count =\n everything || items.length === 0 ? null : `${offeredOn} of ${items.length}`;\n\n const summary = (() => {\n if (everything && all) {\n return { title: all.label, detail: all.description ?? \"\" };\n }\n if (\n all &&\n wildcard === undefined &&\n items.length > 0 &&\n offeredOn === items.length &&\n retiredOn === 0\n ) {\n return { title: all.label, detail: all.description ?? count ?? \"\" };\n }\n // Whole groups by name, the rest item by item. A group of one is just\n // its item: the id says more than the heading over it.\n const names: string[] = [];\n for (const group of groups) {\n const on = group.items.filter((item) => isOn(item.value));\n if (\n group.label !== null &&\n group.items.length > 1 &&\n on.length === group.items.length\n ) {\n names.push(group.label);\n } else {\n names.push(...on.map(nameOf));\n }\n }\n names.push(...retired.filter((held) => selected.has(held)));\n return {\n title: names.length > 0 ? names.join(\", \") : \"None\",\n detail: count ?? \"\",\n };\n })();\n\n const rowDisabled = disabled || loading;\n // Every block that comes and goes (the folded face and the open one,\n // bones and rows, a group or a row a search sets aside) opens and closes\n // on `BasicPage.Reveal`'s motion.\n const reveal = revealIn(reduceMotion);\n\n /**\n * One row. A retired row is a value the catalog no longer offers: its\n * name goes quiet and it has no description to show.\n */\n const renderRow = (item: ScopeItem, retiredRow = false) => {\n const rowId = retiredRow\n ? `${baseId}-r${retired.indexOf(item.value)}`\n : `${baseId}-i${position.get(item.value)}`;\n const nameId = `${rowId}-name`;\n const descriptionId = `${rowId}-description`;\n return (\n <motion.label\n key={item.value}\n {...reveal}\n className={cn(SCOPE_ROW, \"overflow-hidden\")}\n data-scope-row=\"\"\n data-disabled={rowDisabled || undefined}\n >\n <span className=\"flex min-w-0 items-center gap-2\">\n <Checkbox\n size=\"sm\"\n checked={isOn(item.value)}\n disabled={rowDisabled}\n aria-labelledby={nameId}\n aria-describedby={item.description ? descriptionId : undefined}\n onCheckedChange={(on: boolean) => toggle([item.value], on)}\n />\n <span\n id={nameId}\n className={cn(\n \"truncate text-base\",\n retiredRow ? \"text-pho-description\" : \"text-pho-secondary\",\n )}\n >\n {nameOf(item)}\n </span>\n </span>\n {item.description ? (\n <Tooltip.Trigger\n handle={handle}\n payload={item.description}\n render={\n <span\n id={descriptionId}\n data-scope-description=\"\"\n className={SCOPE_DESCRIPTION}\n />\n }\n >\n {item.description}\n </Tooltip.Trigger>\n ) : null}\n </motion.label>\n );\n };\n\n const renderGroup = (group: ScopeGroup) => {\n // Ungrouped items stand on the list's own columns.\n if (group.label === null) {\n return group.items.map((item) => renderRow(item));\n }\n const labelId = `${baseId}-g${groupPosition.get(group.label)}`;\n const members = group.items.map((item) => item.value);\n const on = members.filter(isOn).length;\n const checked = on === members.length;\n return (\n <motion.div\n key={`group:${group.label}`}\n {...reveal}\n // A fieldset's min-content width and legend layout don't sit on the\n // list's grid; the role says the same.\n // oxlint-disable-next-line jsx-a11y/prefer-tag-over-role\n role=\"group\"\n aria-labelledby={labelId}\n className={cn(SCOPE_GROUP, \"overflow-hidden\")}\n >\n <label\n className={SCOPE_GROUP_BAND}\n data-disabled={rowDisabled || undefined}\n >\n <Checkbox\n size=\"sm\"\n checked={checked}\n indeterminate={on > 0 && !checked}\n disabled={rowDisabled}\n aria-labelledby={labelId}\n onCheckedChange={(next: boolean) => toggle(members, next)}\n />\n <span id={labelId} className=\"truncate\">\n {group.label}\n </span>\n {/* The rows it heads — while searching, the ones that match. */}\n <span className=\"text-pho-description tabular-nums\">\n {members.length}\n </span>\n </label>\n <AnimatePresence initial={false}>\n {group.items.map((item) => renderRow(item))}\n </AnimatePresence>\n </motion.div>\n );\n };\n\n const retiredGroup =\n shownRetired.length > 0 ? (\n <motion.div\n key=\"retired\"\n {...reveal}\n // oxlint-disable-next-line jsx-a11y/prefer-tag-over-role\n role=\"group\"\n aria-labelledby={`${baseId}-retired`}\n className={cn(SCOPE_GROUP, \"overflow-hidden\")}\n >\n <div className={cn(SCOPE_GROUP_BAND, \"cursor-default\")}>\n {/* The checkbox column stays: nothing here is added in bulk. */}\n <span aria-hidden className=\"size-4 shrink-0\" />\n <span id={`${baseId}-retired`} className=\"truncate\">\n No longer offered\n </span>\n </div>\n <AnimatePresence initial={false}>\n {shownRetired.map((held) => renderRow({ value: held }, true))}\n </AnimatePresence>\n </motion.div>\n ) : null;\n\n const allRow = all ? (\n <motion.label\n key=\"all\"\n {...reveal}\n className={cn(SCOPE_ROW, \"overflow-hidden\")}\n data-scope-row=\"\"\n data-disabled={\n rowDisabled || (everything && items.length === 0) || undefined\n }\n >\n <span className=\"flex min-w-0 items-center gap-2\">\n <Checkbox\n size=\"sm\"\n checked={\n wildcard === undefined\n ? items.length > 0 && offeredOn === items.length\n : everything\n }\n indeterminate={\n wildcard === undefined\n ? offeredOn > 0 && offeredOn < items.length\n : !everything && offeredOn + retiredOn > 0\n }\n // With no catalog to spell out, leaving the wildcard could only\n // mean nothing.\n disabled={rowDisabled || (everything && items.length === 0)}\n aria-labelledby={`${baseId}-all`}\n aria-describedby={\n all.description ? `${baseId}-all-description` : undefined\n }\n onCheckedChange={(on: boolean) => toggleAll(on)}\n />\n <span\n id={`${baseId}-all`}\n className=\"text-pho-primary truncate text-base font-medium\"\n >\n {all.label}\n </span>\n </span>\n {all.description ? (\n <span id={`${baseId}-all-description`} className={SCOPE_DESCRIPTION}>\n {all.description}\n </span>\n ) : null}\n </motion.label>\n ) : null;\n\n const nothing =\n searching && shownGroups.length === 0 && shownRetired.length === 0 ? (\n <motion.p\n key=\"nothing\"\n {...reveal}\n className={cn(\n \"text-pho-description col-span-full overflow-hidden text-center text-base\",\n SCOPE_INSET,\n )}\n >\n <span className=\"block py-6\">Nothing matches “{query}”.</span>\n </motion.p>\n ) : null;\n\n const list = (\n <motion.div\n key=\"list\"\n {...reveal}\n id={listId}\n className={cn(SCOPE_LIST, \"overflow-hidden\")}\n >\n <AnimatePresence initial={false}>\n {!searching ? allRow : null}\n {shownGroups.map(renderGroup)}\n {retiredGroup}\n {nothing}\n </AnimatePresence>\n </motion.div>\n );\n\n // The bones are the list's own shape — the catch-all row, a group's\n // band, rows with their descriptions — so the rows open into it.\n const bones = (\n <motion.div\n key=\"bones\"\n {...reveal}\n aria-hidden\n className={cn(SCOPE_LIST, \"overflow-hidden\")}\n >\n {[\n { band: false, name: \"w-20\", text: \"w-44\" },\n { band: true, name: \"w-12\", text: \"\" },\n { band: false, name: \"w-28\", text: \"w-56\" },\n { band: false, name: \"w-32\", text: \"w-48\" },\n { band: false, name: \"w-24\", text: \"w-60\" },\n ].map((bone, index) =>\n bone.band ? (\n <div\n key={index}\n className={cn(\n \"border-pho-secondary bg-pho-page col-span-full flex h-8 items-center gap-2 border-y\",\n SCOPE_INSET,\n )}\n >\n <Skeleton className=\"size-4 rounded-sm\" />\n <Skeleton className={cn(\"h-3\", bone.name)} />\n </div>\n ) : (\n <div key={index} className={SCOPE_BONE_ROW}>\n <span className=\"flex h-5 min-w-0 items-center gap-2\">\n <Skeleton className=\"size-4 shrink-0 rounded-sm\" />\n <Skeleton className={cn(\"h-3.5 max-w-full\", bone.name)} />\n </span>\n <span className=\"flex h-4.5 items-center pl-6 group-data-[wide]/scope:pl-0\">\n <Skeleton className={cn(\"h-3 max-w-full\", bone.text)} />\n </span>\n </div>\n ),\n )}\n </motion.div>\n );\n\n const picker = (\n <motion.div key=\"picker\" {...reveal} className=\"overflow-hidden\">\n <div className={SCOPE_SEARCH_ROW}>\n <GhostSearch\n ref={searchRef}\n value={query}\n onChange={setQuery}\n onClear={() => setQuery(\"\")}\n onKeyDown={onSearchKeyDown}\n placeholder={placeholder}\n aria-label={placeholder}\n aria-controls={loading ? undefined : listId}\n disabled={loading}\n trailing={\n count != null && !loading ? (\n // A card too narrow for both gives the room to the query; the\n // folded summary carries the count there.\n <span className=\"hidden group-data-[roomy]/scope:inline\">\n {count}\n </span>\n ) : undefined\n }\n autoComplete=\"off\"\n spellCheck={false}\n />\n {collapsible ? (\n <CloseButton\n size=\"sm\"\n label=\"Cancel\"\n // Held open while the page saves: dropping the edit now would\n // show the old selection under a save that sends the new one.\n disabled={disabled}\n onClick={dismiss}\n // Out by its own padding: the ✕ stands as far from the right\n // edge as the magnifier from the left. Its ring inside, as a\n // Button's: the blocks around it clip.\n className=\"-mr-2 shrink-0 focus-visible:-outline-offset-2\"\n />\n ) : null}\n </div>\n <AnimatePresence initial={false}>\n {loading ? bones : list}\n </AnimatePresence>\n </motion.div>\n );\n\n // The bones stand in the two lines' own boxes, so the card keeps its\n // height when the words arrive.\n const summaryText = loading ? (\n <span className=\"flex min-w-0 flex-1 flex-col\">\n <span className=\"flex h-5 items-center\">\n <Skeleton className=\"h-3.5 w-48 max-w-full\" />\n </span>\n <span className=\"flex h-4.5 items-center\">\n <Skeleton className=\"h-3 w-16\" />\n </span>\n </span>\n ) : (\n <span className=\"flex min-w-0 flex-1 flex-col\">\n <span className=\"text-pho-primary truncate text-base\">\n {summary.title}\n </span>\n {summary.detail ? (\n <span className=\"text-pho-description truncate text-xs tabular-nums\">\n {summary.detail}\n </span>\n ) : null}\n </span>\n );\n\n const folded = (\n <motion.div key=\"folded\" {...reveal} className=\"overflow-hidden\">\n {disabled || loading ? (\n <div className={SCOPE_SUMMARY}>{summaryText}</div>\n ) : (\n <button\n ref={summaryRef}\n type=\"button\"\n aria-expanded={false}\n className={cn(\n SCOPE_SUMMARY,\n \"group hover:bg-pho-primary-hover cursor-pointer transition-colors\",\n )}\n onClick={unfold}\n >\n {summaryText}\n <span\n aria-hidden\n className={buttonVariants({\n variant: \"ghost\",\n size: \"sm\",\n className:\n \"group-hover:bg-pho-ghost-hover group-hover:text-pho-secondary-hover pointer-events-none shrink-0\",\n })}\n >\n Edit\n </span>\n </button>\n )}\n </motion.div>\n );\n\n return (\n <div\n // oxlint-disable-next-line jsx-a11y/prefer-tag-over-role\n role=\"group\"\n aria-busy={loading || undefined}\n data-scope=\"\"\n data-open={open ? \"\" : undefined}\n data-wide={wide ? \"\" : undefined}\n data-roomy={roomy ? \"\" : undefined}\n className={cn(SCOPE_SURFACE, className)}\n {...props}\n ref={(node: HTMLDivElement | null) => {\n cardRef.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref != null) ref.current = node;\n }}\n >\n {/* Folding and opening, the faces trade places on Reveal's motion:\n the one leaving closes as the one arriving opens, and the card's\n height is theirs. */}\n <AnimatePresence initial={false}>\n {open ? picker : folded}\n </AnimatePresence>\n <Tooltip.Root\n handle={handle}\n onOpenChange={(next, details) => {\n // Only a description the row cuts short opens.\n if (next && !isClipped(details.event?.target)) details.cancel();\n }}\n >\n {({ payload }) => (\n <Tooltip.Portal>\n <Tooltip.Positioner side=\"top\" align=\"start\">\n <Tooltip.Popup className=\"max-w-80 font-normal\">\n {payload}\n </Tooltip.Popup>\n </Tooltip.Positioner>\n </Tooltip.Portal>\n )}\n </Tooltip.Root>\n </div>\n );\n}\n\nScope.displayName = \"Scope\";\n"],"mappings":";;;;;;;;;;;;;AA2HA,IAAM,KACJ,qJAGI,KAAc,2BASd,KACJ,0FAOI,KACJ,uHAGI,KACJ,uFAQI,KACJ,gVAGI,KACJ,0LAMI,KACJ,kOAMI,KACJ,sJAGI,KACJ,kKAGI,KAAW,IAEX,KAAY;AAOlB,SAAS,GAAa,GAAoC;AACxD,QAAM,CAAC,GAAM,CAAA,IAAW,EAAS;AAAA,IAAE,MAAM;AAAA,IAAM,OAAO;AAAA,EAAK,CAAC;AAC5D,SAAA,GAAA,MAAsB;AACpB,UAAM,IAAO,EAAI;AACjB,QAAI,KAAQ,KAAM;AAClB,UAAM,IAAA,MAAgB;AACpB,YAAM,IACJ,WAAW,iBAAiB,SAAS,eAAe,EAAE,QAAQ,KAAK,IAC/D,IAAQ,EAAK,sBAAsB,EAAE,OACrC,IAAO;AAAA,QACX,MAAM,KAAS,KAAW;AAAA,QAC1B,OAAO,KAAS,KAAY;AAAA,MAC9B;AACA,MAAA,EAAA,CAA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QAAI,KAAQ,CAAC,GAAU,EAAQ,OAAO,MAAM,KAAG,EAAQ,OAAO;AAAA,MAChE;AAAA,MAEE,UAAA,CAAA,EAAE,SAAA,EAAA,MACF,gBAAA,EAAC,EAAQ,QAAT,EAAA,UACE,gBAAA,EAAC,EAAQ,YAAT;AAAA,QAAoB,MAAK;AAAA,QAAM,OAAM;AAAA,QACnC,UAAA,gBAAA,EAAC,EAAQ,OAAT;AAAA,UAAe,WAAU;AAAA,UACtB,UAAA;AAAA,QACY,CAAA;AAAA,MACG,CAAA,EACN,CAAA;AAAA,IAEN,CAAA,CACX;AAAA;AAET;AAEA,GAAM,cAAc"}
|
|
1
|
+
{"version":3,"file":"scope.js","names":[],"sources":["../../src/components/scope/scope.tsx"],"sourcesContent":["import {\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type ComponentProps,\n type KeyboardEvent,\n type Ref,\n type RefObject,\n} from \"react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\nimport { Field as BaseField } from \"@base-ui/react/field\";\nimport { Tooltip as BaseTooltip } from \"@base-ui/react/tooltip\";\nimport { IconCheck, IconChevronDown } from \"@tabler/icons-react\";\nimport { CloseButton, buttonVariants } from \"../button\";\nimport { Checkbox } from \"../checkbox\";\nimport { Select } from \"../select\";\nimport { Skeleton } from \"../skeleton\";\nimport { Tooltip } from \"../tooltip\";\nimport { revealIn } from \"../../motion\";\nimport { cn } from \"../../utils/cn\";\nimport { GhostSearch } from \"../../utils/ghost-search\";\n\n/**\n * Scope — pick what something covers out of a catalog: the events a webhook\n * destination receives, the permissions an app or key holds. A searchable,\n * grouped checklist with a catch-all row; `collapsible` folds it to a\n * two-line summary for a resource that already exists, opening on click.\n */\n\nexport interface ScopeItem {\n /**\n * What the selection holds — an event type, a permission id. It is also\n * the row's name unless `label` says otherwise.\n */\n value: string;\n /** The row's name, when it shouldn't be the value itself. */\n label?: string;\n /** One line on what it covers. Searched along with the name. */\n description?: string;\n /**\n * The group it files under — the resource, the namespace. Groups keep\n * the order they first appear in; items without one come first.\n */\n group?: string;\n}\n\nexport interface ScopeAll {\n /** The row's name — `All events`. */\n label: string;\n /** What choosing it means — `Every current and future event.` */\n description?: string;\n /**\n * A wildcard the selection holds in place of the items — `*`. With it,\n * the row stands for every item, now and later: choosing it sets the\n * selection to `[value]`, and leaving it spells every item out by name so\n * the reader prunes from there, never from nothing. Without it, the row\n * selects every item listed.\n */\n value?: string;\n}\n\nexport interface ScopePreset {\n /**\n * Its name: in the search row's picker, and on a folded list whose\n * selection is exactly this one — `Read only`.\n */\n label: string;\n /** What it covers, under its name in the picker and on the folded list. */\n description?: string;\n /** The selection it stands for. */\n value: readonly string[];\n}\n\nexport interface ScopeProps extends Omit<\n ComponentProps<\"div\">,\n \"defaultValue\" | \"onChange\" | \"children\"\n> {\n /** The catalog — everything that can be picked, in display order. */\n items: readonly ScopeItem[];\n /** The selected values, controlled. */\n value?: readonly string[];\n /** The selected values at first, uncontrolled. */\n defaultValue?: readonly string[];\n /**\n * Called with the next selection, in catalog order (values no longer in\n * the catalog follow in the order they were held).\n */\n onValueChange?: (value: string[]) => void;\n /** The catch-all row at the top. Leave it out for no such row. */\n all?: ScopeAll;\n /**\n * Named selections to start from, picked at the search row's end. One\n * chosen sets the list to its values; values the catalog doesn't offer\n * stay as they are. A selection that is exactly a preset goes by its\n * name there and on the folded list; any other reads Custom.\n */\n presets?: readonly ScopePreset[];\n /** The search field's placeholder, which also names it. @default \"Search\" */\n placeholder?: string;\n /**\n * Fold to a two-line summary of the selection, opening to the full list\n * on click — for a resource that already exists, where the scope is read\n * far more often than it changes. The page saves the change (its \"Save\n * changes\" below the card) and folds the list through `open`; the ✕ in\n * the search row, or `Escape` on an empty search, drops the edit: the\n * selection goes back to what it was when the list opened, and folds.\n */\n collapsible?: boolean;\n /** Whether the collapsible list is open, controlled. */\n open?: boolean;\n /** Whether the collapsible list starts open. @default false */\n defaultOpen?: boolean;\n /** Called when the collapsible list opens or folds. */\n onOpenChange?: (open: boolean) => void;\n /** The catalog is on its way: bones in place of rows. */\n loading?: boolean;\n /**\n * Read-only: the list can be searched but not changed, and a folded one\n * stays folded. Held open by `open` (a save in flight), nothing in it\n * changes the selection, the ✕ and Escape included.\n */\n disabled?: boolean;\n ref?: Ref<HTMLDivElement>;\n}\n\n/* ------------------------------- class map ------------------------------- */\n\n/**\n * The card: the BasicPage card's stroke, corner, and fill. `overflow-clip`\n * rounds a hovered edge row into the corners without making the card a\n * scroll container. The rows lay out by the card's width, not the\n * viewport's: it is measured (`data-wide`, `data-roomy`) rather than made a\n * CSS query container, because Chromium drops a query container's\n * children from layout when a `Reveal` mounts beside it in a Base UI form\n * (a BasicPage `Footer` appearing under the card left it 2px tall).\n *\n * Positioned: a face (or the bones) leaving steps out of the flow and fades\n * where it stood, clipped by the card as the one arriving takes its place.\n *\n * Its words stand `--scope-inset` in from its edges, which is the page's\n * choice inset (the one `RadioCard` and `CheckboxCard` pad by): 20px when\n * the card stands on a `BasicPage.Stack`, on the headings' line like any\n * card's rows; 12px inside a sheet, a card, or a dialog, where it is a\n * field among fields and its words line up with theirs.\n */\nconst SCOPE_SURFACE =\n \"group/scope relative w-full min-w-0 overflow-clip rounded-base border border-pho-secondary bg-pho-primary [--scope-inset:var(--choice-card-inset,0.75rem)]\";\n\n/** The side padding every row of the card shares. */\nconst SCOPE_INSET = \"px-[var(--scope-inset)]\";\n\n/**\n * The search, the card's first row: no box of its own. The magnifier stands\n * on the checkbox column and the query on the names' line, the count at the\n * row's end and, on a collapsible list, the ✕ that drops the edit after it,\n * its glyph as far in from the right edge as the magnifier's from the left.\n * 44px with the hairline below, the DataTable toolbar band's height.\n */\nconst SCOPE_SEARCH_ROW =\n \"flex min-h-11 items-center gap-3 border-b border-pho-secondary px-[var(--scope-inset)]\";\n\n/**\n * The preset picker at the search row's end: a `Select` on its inline face,\n * dressed as a ghost pill like the ✕ beside it — no box in the band, as\n * DataTable's toolbar filters. The ✕'s geometry: 8px round the chevron,\n * the pill hanging that far past the words' edge so the chevron mirrors the\n * magnifier's inset, never onto the card's border; the label side 4px\n * wider, a Button's icon-side tuck. It draws its own focus ring, the row\n * having none to lend it.\n */\nconst SCOPE_PRESET_TRIGGER =\n \"text-pho-secondary hover:bg-pho-ghost-hover hover:text-pho-secondary-hover data-[popup-open]:bg-pho-ghost-hover outline-pho-brand shrink-0 gap-1.5 rounded-full py-1.5 pr-2 pl-3 font-medium focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-solid\";\n\n/** The picker's value for a selection no preset names. */\nconst CUSTOM = \"custom\";\n\n/**\n * Two columns once the card is wide enough: the names, as wide as the\n * longest (never past 45%), then the descriptions on one shared edge.\n * Narrower, each row stacks its description under its name.\n */\nconst SCOPE_LIST =\n \"grid grid-cols-1 group-data-[wide]/scope:grid-cols-[fit-content(45%)_minmax(0,1fr)] group-data-[wide]/scope:gap-x-4\";\n\n/** A group: its band and its rows, on the list's columns. */\nconst SCOPE_GROUP =\n \"col-span-full grid grid-cols-subgrid border-t border-pho-secondary first:border-t-0\";\n\n/**\n * One row: 36px on the wide layout — a 20px line and 8px either side. Only\n * the stacked layout's row gap is set: the columns' gap is the list's, and\n * a subgrid that set its own would let a long name run into its\n * description.\n */\nconst SCOPE_ROW =\n \"group col-span-full flex min-w-0 cursor-pointer flex-col gap-y-0.5 px-[var(--scope-inset)] py-2 transition-colors select-none hover:bg-pho-primary-hover group-data-[wide]/scope:grid group-data-[wide]/scope:grid-cols-subgrid group-data-[wide]/scope:items-center data-[disabled]:cursor-not-allowed data-[disabled]:hover:bg-transparent\";\n\n/** A bone row: a row's layout, nothing to hover or click. */\nconst SCOPE_BONE_ROW =\n \"col-span-full flex min-w-0 flex-col gap-y-0.5 px-[var(--scope-inset)] py-2 group-data-[wide]/scope:grid group-data-[wide]/scope:grid-cols-subgrid group-data-[wide]/scope:items-center\";\n\n/**\n * A group's band — DataTable's section wash, thinner than the rows it\n * heads, with the group's own checkbox on the rows' checkbox column.\n */\nconst SCOPE_GROUP_BAND =\n \"group col-span-full flex h-8 min-w-0 cursor-pointer items-center gap-2 border-b border-pho-secondary bg-pho-page px-[var(--scope-inset)] text-xs font-medium text-pho-secondary select-none data-[disabled]:cursor-not-allowed\";\n\n/**\n * A description: under the name (two lines at most) on the narrow layout,\n * one line in its own column on the wide one — the rest opens on hover.\n */\nconst SCOPE_DESCRIPTION =\n \"line-clamp-2 min-w-0 pl-6 text-xs text-pho-description group-data-[wide]/scope:block group-data-[wide]/scope:truncate group-data-[wide]/scope:pl-0\";\n\n/** The folded summary: two lines, the whole card its hit target. */\nconst SCOPE_SUMMARY =\n \"flex w-full min-w-0 items-center gap-3 py-2.5 pr-2 pl-[var(--scope-inset)] text-left outline-pho-brand focus-visible:outline-2 focus-visible:-outline-offset-2\";\n\n/** Two columns (names, then descriptions) from this card width up. */\nconst WIDE_REM = 34;\n/** The count stands in the search row from this card width up. */\nconst ROOMY_REM = 18;\n\n/**\n * The card's width against the two breakpoints, measured before paint and\n * followed as it changes. Desktop-first until measured, so a server render\n * shows the common layout.\n *\n * Its heights ride along for the next swap: the face standing now (the\n * card's inner height), and the list or the bones, whichever shows. What\n * takes their place opens from there.\n */\nfunction useCardSize(ref: RefObject<HTMLElement | null>) {\n const [size, setSize] = useState({ wide: true, roomy: true });\n const heights = useRef({ face: 0, list: 0, bones: 0 });\n useLayoutEffect(() => {\n const node = ref.current;\n if (node == null) return;\n const measure = () => {\n heights.current.face = node.clientHeight;\n const list = node.querySelector<HTMLElement>(\"[data-scope-list]\");\n if (list != null) heights.current.list = list.offsetHeight;\n const bones = node.querySelector<HTMLElement>(\"[data-scope-bones]\");\n if (bones != null) heights.current.bones = bones.offsetHeight;\n const rem =\n parseFloat(getComputedStyle(document.documentElement).fontSize) || 16;\n const width = node.getBoundingClientRect().width;\n const next = {\n wide: width >= WIDE_REM * rem,\n roomy: width >= ROOMY_REM * rem,\n };\n setSize((current) =>\n current.wide === next.wide && current.roomy === next.roomy\n ? current\n : next,\n );\n };\n measure();\n const observer = new ResizeObserver(measure);\n observer.observe(node);\n return () => observer.disconnect();\n }, [ref]);\n return { ...size, heights };\n}\n\n/* -------------------------------- model --------------------------------- */\n\ninterface ScopeGroup {\n label: string | null;\n items: ScopeItem[];\n}\n\n/** Items by group, groups in first-appearance order, ungrouped first. */\nfunction groupItems(items: readonly ScopeItem[]): ScopeGroup[] {\n const groups: ScopeGroup[] = [];\n const byLabel = new Map<string | null, ScopeGroup>();\n for (const item of items) {\n const label = item.group ?? null;\n let group = byLabel.get(label);\n if (!group) {\n group = { label, items: [] };\n byLabel.set(label, group);\n groups.push(group);\n }\n group.items.push(item);\n }\n return [\n ...groups.filter((group) => group.label === null),\n ...groups.filter((group) => group.label !== null),\n ];\n}\n\n/**\n * Lowercase, with the separators ids are written in (`.`, `:`, `-`, `_`,\n * `/`) read as spaces — `call ended` finds `call.ended`.\n */\nfunction normalize(text: string): string {\n return text.toLowerCase().replace(/[.:\\-_/]/g, \" \");\n}\n\nfunction tokenize(query: string): string[] {\n return normalize(query).split(/\\s+/).filter(Boolean);\n}\n\n/** Every word of the query somewhere in the group, name, or description. */\nfunction matches(\n tokens: readonly string[],\n ...fields: (string | null | undefined)[]\n) {\n const haystack = normalize(fields.filter(Boolean).join(\" \"));\n return tokens.every((token) => haystack.includes(token));\n}\n\nfunction nameOf(item: ScopeItem): string {\n return item.label ?? item.value;\n}\n\n/** The same values, whatever their order. */\nfunction sameSelection(a: readonly string[], b: readonly string[]): boolean {\n if (a.length !== b.length) return false;\n const held = new Set(a);\n return b.every((value) => held.has(value));\n}\n\n/**\n * Reveal for a block taking another's place: it opens from the height the\n * other stood at rather than from none, while the other steps out of the\n * flow (`popLayout`) and fades where it stood. The card moves at its bottom\n * edge only, so the new block unfolds from the top down, and what it loses\n * rolls up under the top.\n */\nfunction takeOver(reveal: ReturnType<typeof revealIn>, from: number) {\n return {\n ...reveal,\n initial: { ...reveal.initial, height: from },\n exit: { opacity: 0 },\n };\n}\n\n/** Whether a description shows whole, measured when the pointer asks. */\nfunction isClipped(target: EventTarget | null | undefined): boolean {\n if (!(target instanceof Element)) return false;\n const text = target.closest<HTMLElement>(\"[data-scope-description]\");\n if (text == null) return false;\n return (\n text.scrollWidth > text.clientWidth + 1 ||\n text.scrollHeight > text.clientHeight + 1\n );\n}\n\n/* ------------------------------- component ------------------------------- */\n\n/**\n * A searchable, grouped checklist for choosing what something covers.\n *\n * Every row is one line on a wide card — the name, then its description in\n * a second column that opens whole on hover when it doesn't fit. Groups are\n * thin tinted bands carrying a checkbox for the whole group (mixed when\n * partly chosen). The search matches names, descriptions, and group names,\n * word by word; while it holds a query the catch-all row steps aside and a\n * group's checkbox covers the rows it shows.\n *\n * With `collapsible`, the card rests as a summary — whole groups by name,\n * the rest by item, over a count — and opens in place, the search taking\n * focus, when clicked; its ✕ drops the edit and folds it back, the page's\n * own save below the card commits it. Values the catalog no longer offers keep a row\n * under \"No longer offered\": they can be removed, never added in bulk.\n */\nexport function Scope({\n items,\n value: valueProp,\n defaultValue,\n onValueChange,\n all,\n presets,\n placeholder = \"Search\",\n collapsible = false,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n loading = false,\n disabled = false,\n className,\n ref,\n ...props\n}: ScopeProps) {\n const [innerValue, setInnerValue] = useState<readonly string[]>(\n defaultValue ?? [],\n );\n const value = valueProp ?? innerValue;\n const [innerOpen, setInnerOpen] = useState(defaultOpen);\n const open = collapsible ? (openProp ?? innerOpen) : true;\n const [query, setQuery] = useState(\"\");\n\n const reduceMotion = useReducedMotion();\n const cardRef = useRef<HTMLDivElement | null>(null);\n const { wide, roomy, heights } = useCardSize(cardRef);\n const baseId = useId();\n const listId = `${baseId}-list`;\n const searchRef = useRef<HTMLInputElement | null>(null);\n const summaryRef = useRef<HTMLButtonElement | null>(null);\n // Where focus goes once the next face has mounted — set only by our own\n // controls, so a host flipping `open` doesn't pull focus around.\n const focusNext = useRef<\"search\" | \"summary\" | null>(null);\n const handle = useMemo(() => BaseTooltip.createHandle<string>(), []);\n\n const groups = useMemo(() => groupItems(items), [items]);\n const offered = useMemo(\n () => new Set(items.map((item) => item.value)),\n [items],\n );\n // Ids go by catalog position: values may hold characters an id shouldn't.\n const position = useMemo(\n () => new Map(items.map((item, index) => [item.value, index])),\n [items],\n );\n const groupPosition = useMemo(\n () => new Map(groups.map((group, index) => [group.label, index])),\n [groups],\n );\n\n // Values held that the catalog doesn't offer. Remembered while mounted,\n // so one unticked stays on the list and can be ticked back.\n const retiredSeen = useRef<string[]>([]);\n for (const held of value) {\n if (\n held !== all?.value &&\n !offered.has(held) &&\n !retiredSeen.current.includes(held)\n ) {\n retiredSeen.current.push(held);\n }\n }\n const retired = retiredSeen.current.filter((held) => !offered.has(held));\n\n const wildcard = all?.value;\n const selected = new Set(value);\n const everything = wildcard !== undefined && selected.has(wildcard);\n const isOn = (item: string) =>\n everything ? offered.has(item) : selected.has(item);\n const offeredOn = items.filter((item) => isOn(item.value)).length;\n const retiredOn = retired.filter((held) => selected.has(held)).length;\n\n const setValue = (next: string[]) => {\n if (valueProp === undefined) setInnerValue(next);\n onValueChange?.(next);\n };\n /** Catalog order, then what's no longer offered in the order it was held. */\n const emit = (next: Set<string>) =>\n setValue([\n ...items.filter((item) => next.has(item.value)).map((item) => item.value),\n ...retired.filter((held) => next.has(held)),\n ]);\n /** The selection by name — under the wildcard, every item it stands for. */\n const explicit = () =>\n everything\n ? new Set(items.map((item) => item.value))\n : new Set(value.filter((held) => held !== wildcard));\n const toggle = (values: readonly string[], on: boolean) => {\n const next = explicit();\n for (const item of values) {\n if (on) next.add(item);\n else next.delete(item);\n }\n emit(next);\n };\n const toggleAll = (on: boolean) => {\n if (wildcard === undefined) {\n toggle(\n items.map((item) => item.value),\n on,\n );\n } else if (on) {\n setValue([wildcard]);\n } else {\n emit(new Set(items.map((item) => item.value)));\n }\n };\n\n // Presets name selections among what the catalog offers (and the\n // wildcard): what it no longer offers sits outside every one of them.\n const named = (values: readonly string[]) =>\n values.filter((held) => held === wildcard || offered.has(held));\n const preset =\n loading || items.length === 0\n ? undefined\n : presets?.find((option) => {\n const its = named(option.value);\n return its.length > 0 && sameSelection(its, named(value));\n });\n const choosePreset = (option: ScopePreset) => {\n const its = named(option.value);\n if (wildcard !== undefined && its.includes(wildcard)) {\n setValue([wildcard]);\n } else {\n emit(new Set([...its, ...retired.filter((held) => selected.has(held))]));\n }\n };\n\n const setOpen = (next: boolean) => {\n if (openProp === undefined) setInnerOpen(next);\n onOpenChange?.(next);\n };\n const unfold = () => {\n focusNext.current = \"search\";\n setOpen(true);\n };\n const fold = () => {\n focusNext.current = \"summary\";\n setQuery(\"\");\n setOpen(false);\n };\n\n // The selection as it stood when the list opened, whoever opened it:\n // dismissing the edit puts it back.\n const valueRef = useRef(value);\n valueRef.current = value;\n const openedWith = useRef<readonly string[] | null>(open ? value : null);\n useEffect(() => {\n openedWith.current = open ? valueRef.current : null;\n // Folded by the page (after its save) or by the ✕, the next opening\n // starts from the whole list.\n if (!open) setQuery(\"\");\n }, [open]);\n /** The ✕ (or Escape): the edit is dropped and the list folds. */\n const dismiss = () => {\n const before = openedWith.current;\n if (before != null && !sameSelection(before, valueRef.current)) {\n setValue([...before]);\n }\n fold();\n };\n\n // Focus lands once the face can take it: it fades in, and a field asked\n // to focus on its first frame may still refuse. Try a frame at a time.\n useEffect(() => {\n const target = focusNext.current;\n if (target == null) return;\n focusNext.current = null;\n let frame = 0;\n let tries = 0;\n const attempt = () => {\n const node = target === \"search\" ? searchRef.current : summaryRef.current;\n if (node == null) return;\n // Not scrolled into view: the face opening around it would scroll\n // inside its own clip and jump when it settles.\n node.focus({ preventScroll: true });\n if (document.activeElement !== node && tries++ < 5) {\n frame = requestAnimationFrame(attempt);\n }\n };\n frame = requestAnimationFrame(attempt);\n return () => cancelAnimationFrame(frame);\n }, [open]);\n\n const onSearchKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n // A search, not the form's submit.\n if (event.key === \"Enter\") event.preventDefault();\n if (event.key !== \"Escape\") return;\n if (query !== \"\") {\n // Ours — not an enclosing dialog's or aside's close.\n event.preventDefault();\n setQuery(\"\");\n } else if (collapsible && !disabled) {\n event.preventDefault();\n dismiss();\n }\n };\n\n const tokens = tokenize(query);\n const searching = tokens.length > 0;\n const shownGroups = groups\n .map((group) => ({\n ...group,\n items: searching\n ? group.items.filter((item) =>\n matches(\n tokens,\n group.label,\n item.value,\n item.label,\n item.description,\n ),\n )\n : group.items,\n }))\n .filter((group) => group.items.length > 0);\n const shownRetired = searching\n ? retired.filter((held) => matches(tokens, held))\n : retired;\n\n // The count reads the catalog: under the wildcard every item is in and\n // more will be, so it steps aside for the catch-all's own words.\n const count =\n everything || items.length === 0 ? null : `${offeredOn} of ${items.length}`;\n\n const summary = (() => {\n if (everything && all) {\n return { title: all.label, detail: all.description ?? \"\" };\n }\n if (preset && retiredOn === 0) {\n return { title: preset.label, detail: preset.description ?? count ?? \"\" };\n }\n if (\n all &&\n wildcard === undefined &&\n items.length > 0 &&\n offeredOn === items.length &&\n retiredOn === 0\n ) {\n return { title: all.label, detail: all.description ?? count ?? \"\" };\n }\n // Whole groups by name, the rest item by item. A group of one is just\n // its item: the id says more than the heading over it.\n const names: string[] = [];\n for (const group of groups) {\n const on = group.items.filter((item) => isOn(item.value));\n if (\n group.label !== null &&\n group.items.length > 1 &&\n on.length === group.items.length\n ) {\n names.push(group.label);\n } else {\n names.push(...on.map(nameOf));\n }\n }\n names.push(...retired.filter((held) => selected.has(held)));\n return {\n title: names.length > 0 ? names.join(\", \") : \"None\",\n detail: count ?? \"\",\n };\n })();\n\n const rowDisabled = disabled || loading;\n // Every block that comes and goes (the folded face and the open one,\n // bones and rows, a group or a row a search sets aside) opens and closes\n // on `BasicPage.Reveal`'s motion.\n const reveal = revealIn(reduceMotion);\n\n /**\n * One row. A retired row is a value the catalog no longer offers: its\n * name goes quiet and it has no description to show.\n */\n const renderRow = (item: ScopeItem, retiredRow = false) => {\n const rowId = retiredRow\n ? `${baseId}-r${retired.indexOf(item.value)}`\n : `${baseId}-i${position.get(item.value)}`;\n const nameId = `${rowId}-name`;\n const descriptionId = `${rowId}-description`;\n return (\n <motion.label\n key={item.value}\n {...reveal}\n className={cn(SCOPE_ROW, \"overflow-hidden\")}\n data-scope-row=\"\"\n data-disabled={rowDisabled || undefined}\n >\n <span className=\"flex min-w-0 items-center gap-2\">\n <Checkbox\n size=\"sm\"\n checked={isOn(item.value)}\n disabled={rowDisabled}\n aria-labelledby={nameId}\n aria-describedby={item.description ? descriptionId : undefined}\n onCheckedChange={(on: boolean) => toggle([item.value], on)}\n />\n <span\n id={nameId}\n className={cn(\n \"truncate text-base\",\n retiredRow ? \"text-pho-description\" : \"text-pho-secondary\",\n )}\n >\n {nameOf(item)}\n </span>\n </span>\n {item.description ? (\n <Tooltip.Trigger\n handle={handle}\n payload={item.description}\n render={\n <span\n id={descriptionId}\n data-scope-description=\"\"\n className={SCOPE_DESCRIPTION}\n />\n }\n >\n {item.description}\n </Tooltip.Trigger>\n ) : null}\n </motion.label>\n );\n };\n\n const renderGroup = (group: ScopeGroup) => {\n // Ungrouped items stand on the list's own columns.\n if (group.label === null) {\n return group.items.map((item) => renderRow(item));\n }\n const labelId = `${baseId}-g${groupPosition.get(group.label)}`;\n const members = group.items.map((item) => item.value);\n const on = members.filter(isOn).length;\n const checked = on === members.length;\n return (\n <motion.div\n key={`group:${group.label}`}\n {...reveal}\n // A fieldset's min-content width and legend layout don't sit on the\n // list's grid; the role says the same.\n // oxlint-disable-next-line jsx-a11y/prefer-tag-over-role\n role=\"group\"\n aria-labelledby={labelId}\n className={cn(SCOPE_GROUP, \"overflow-hidden\")}\n >\n <label\n className={SCOPE_GROUP_BAND}\n data-disabled={rowDisabled || undefined}\n >\n <Checkbox\n size=\"sm\"\n checked={checked}\n indeterminate={on > 0 && !checked}\n disabled={rowDisabled}\n aria-labelledby={labelId}\n onCheckedChange={(next: boolean) => toggle(members, next)}\n />\n <span id={labelId} className=\"truncate\">\n {group.label}\n </span>\n {/* The rows it heads — while searching, the ones that match. */}\n <span className=\"text-pho-description tabular-nums\">\n {members.length}\n </span>\n </label>\n <AnimatePresence initial={false}>\n {group.items.map((item) => renderRow(item))}\n </AnimatePresence>\n </motion.div>\n );\n };\n\n const retiredGroup =\n shownRetired.length > 0 ? (\n <motion.div\n key=\"retired\"\n {...reveal}\n // oxlint-disable-next-line jsx-a11y/prefer-tag-over-role\n role=\"group\"\n aria-labelledby={`${baseId}-retired`}\n className={cn(SCOPE_GROUP, \"overflow-hidden\")}\n >\n <div className={cn(SCOPE_GROUP_BAND, \"cursor-default\")}>\n {/* The checkbox column stays: nothing here is added in bulk. */}\n <span aria-hidden className=\"size-4 shrink-0\" />\n <span id={`${baseId}-retired`} className=\"truncate\">\n No longer offered\n </span>\n </div>\n <AnimatePresence initial={false}>\n {shownRetired.map((held) => renderRow({ value: held }, true))}\n </AnimatePresence>\n </motion.div>\n ) : null;\n\n const allRow = all ? (\n <motion.label\n key=\"all\"\n {...reveal}\n className={cn(SCOPE_ROW, \"overflow-hidden\")}\n data-scope-row=\"\"\n data-disabled={\n rowDisabled || (everything && items.length === 0) || undefined\n }\n >\n <span className=\"flex min-w-0 items-center gap-2\">\n <Checkbox\n size=\"sm\"\n checked={\n wildcard === undefined\n ? items.length > 0 && offeredOn === items.length\n : everything\n }\n indeterminate={\n wildcard === undefined\n ? offeredOn > 0 && offeredOn < items.length\n : !everything && offeredOn + retiredOn > 0\n }\n // With no catalog to spell out, leaving the wildcard could only\n // mean nothing.\n disabled={rowDisabled || (everything && items.length === 0)}\n aria-labelledby={`${baseId}-all`}\n aria-describedby={\n all.description ? `${baseId}-all-description` : undefined\n }\n onCheckedChange={(on: boolean) => toggleAll(on)}\n />\n <span\n id={`${baseId}-all`}\n className=\"text-pho-primary truncate text-base font-medium\"\n >\n {all.label}\n </span>\n </span>\n {all.description ? (\n <span id={`${baseId}-all-description`} className={SCOPE_DESCRIPTION}>\n {all.description}\n </span>\n ) : null}\n </motion.label>\n ) : null;\n\n const nothing =\n searching && shownGroups.length === 0 && shownRetired.length === 0 ? (\n <motion.p\n key=\"nothing\"\n {...reveal}\n className={cn(\n \"text-pho-description col-span-full overflow-hidden text-center text-base\",\n SCOPE_INSET,\n )}\n >\n <span className=\"block py-6\">Nothing matches “{query}”.</span>\n </motion.p>\n ) : null;\n\n const list = (\n <motion.div\n key=\"list\"\n {...takeOver(reveal, heights.current.bones)}\n id={listId}\n data-scope-list=\"\"\n className={cn(SCOPE_LIST, \"overflow-hidden\")}\n >\n <AnimatePresence initial={false}>\n {!searching ? allRow : null}\n {shownGroups.map(renderGroup)}\n {retiredGroup}\n {nothing}\n </AnimatePresence>\n </motion.div>\n );\n\n // The bones are the list's own shape — the catch-all row, a group's\n // band, rows with their descriptions — so the rows open into it.\n const bones = (\n <motion.div\n key=\"bones\"\n // Back to bones (the catalog reloading), they open from the list's\n // height while the rows fade where they stood.\n {...takeOver(reveal, heights.current.list)}\n data-scope-bones=\"\"\n aria-hidden\n className={cn(SCOPE_LIST, \"overflow-hidden\")}\n >\n {[\n { band: false, name: \"w-20\", text: \"w-44\" },\n { band: true, name: \"w-12\", text: \"\" },\n { band: false, name: \"w-28\", text: \"w-56\" },\n { band: false, name: \"w-32\", text: \"w-48\" },\n { band: false, name: \"w-24\", text: \"w-60\" },\n ].map((bone, index) =>\n bone.band ? (\n <div\n key={index}\n className={cn(\n \"border-pho-secondary bg-pho-page col-span-full flex h-8 items-center gap-2 border-y\",\n SCOPE_INSET,\n )}\n >\n <Skeleton className=\"size-4 rounded-sm\" />\n <Skeleton className={cn(\"h-3\", bone.name)} />\n </div>\n ) : (\n <div key={index} className={SCOPE_BONE_ROW}>\n <span className=\"flex h-5 min-w-0 items-center gap-2\">\n <Skeleton className=\"size-4 shrink-0 rounded-sm\" />\n <Skeleton className={cn(\"h-3.5 max-w-full\", bone.name)} />\n </span>\n <span className=\"flex h-4.5 items-center pl-6 group-data-[wide]/scope:pl-0\">\n <Skeleton className={cn(\"h-3 max-w-full\", bone.text)} />\n </span>\n </div>\n ),\n )}\n </motion.div>\n );\n\n const presetPicker =\n presets != null && presets.length > 0 ? (\n // A field of its own: inside a host `Field` (the page's Permissions)\n // the select would take that field's label for its name, its\n // description, and its name in the form. Laid out as its trigger.\n <BaseField.Root className=\"contents\">\n <Select.Root\n items={[\n ...presets.map((option, index) => ({\n value: `preset:${index}`,\n label: option.label,\n })),\n { value: CUSTOM, label: \"Custom\" },\n ]}\n value={preset ? `preset:${presets.indexOf(preset)}` : CUSTOM}\n onValueChange={(next) => {\n const option =\n presets[Number(String(next).slice(\"preset:\".length))];\n if (option != null && option !== preset) choosePreset(option);\n }}\n disabled={disabled || loading}\n >\n <Select.Trigger\n variant=\"inline\"\n aria-label=\"Preset\"\n // Last in the row, out by its padding (see the class); before\n // the ✕, a little closer to it.\n className={cn(\n SCOPE_PRESET_TRIGGER,\n collapsible ? \"-mr-1\" : \"-mr-2\",\n )}\n >\n <Select.Value />\n <Select.Icon>\n <IconChevronDown />\n </Select.Icon>\n </Select.Trigger>\n <Select.Portal>\n <Select.Positioner align=\"end\">\n <Select.Popup>\n <Select.List>\n {presets.map((option, index) => (\n <Select.Item key={index} value={`preset:${index}`}>\n <Select.ItemIndicator>\n <IconCheck />\n </Select.ItemIndicator>\n <Select.ItemText>{option.label}</Select.ItemText>\n {option.description ? (\n <span className=\"text-pho-description col-start-2 text-xs\">\n {option.description}\n </span>\n ) : null}\n </Select.Item>\n ))}\n {/* Not picked, only shown: what a hand-made selection reads. */}\n <Select.Item value={CUSTOM} disabled>\n <Select.ItemIndicator>\n <IconCheck />\n </Select.ItemIndicator>\n <Select.ItemText>Custom</Select.ItemText>\n </Select.Item>\n </Select.List>\n </Select.Popup>\n </Select.Positioner>\n </Select.Portal>\n </Select.Root>\n </BaseField.Root>\n ) : null;\n\n const picker = (\n <motion.div\n key=\"picker\"\n {...takeOver(reveal, heights.current.face)}\n className=\"overflow-hidden\"\n >\n <div className={SCOPE_SEARCH_ROW}>\n <GhostSearch\n ref={searchRef}\n value={query}\n onChange={setQuery}\n onClear={() => setQuery(\"\")}\n onKeyDown={onSearchKeyDown}\n placeholder={placeholder}\n aria-label={placeholder}\n aria-controls={loading ? undefined : listId}\n disabled={loading}\n trailing={\n count != null && !loading ? (\n // A card too narrow for both gives the room to the query; the\n // folded summary carries the count there.\n <span className=\"hidden group-data-[roomy]/scope:inline\">\n {count}\n </span>\n ) : undefined\n }\n autoComplete=\"off\"\n spellCheck={false}\n />\n {presetPicker}\n {collapsible ? (\n <CloseButton\n size=\"sm\"\n label=\"Cancel\"\n // Held open while the page saves: dropping the edit now would\n // show the old selection under a save that sends the new one.\n disabled={disabled}\n onClick={dismiss}\n // Out by its own padding: the ✕ stands as far from the right\n // edge as the magnifier from the left. Its ring inside, as a\n // Button's: the blocks around it clip.\n className=\"-mr-2 shrink-0 focus-visible:-outline-offset-2\"\n />\n ) : null}\n </div>\n <AnimatePresence initial={false} mode=\"popLayout\">\n {loading ? bones : list}\n </AnimatePresence>\n </motion.div>\n );\n\n // The bones stand in the two lines' own boxes, so the card keeps its\n // height when the words arrive.\n const summaryText = loading ? (\n <span className=\"flex min-w-0 flex-1 flex-col\">\n <span className=\"flex h-5 items-center\">\n <Skeleton className=\"h-3.5 w-48 max-w-full\" />\n </span>\n <span className=\"flex h-4.5 items-center\">\n <Skeleton className=\"h-3 w-16\" />\n </span>\n </span>\n ) : (\n <span className=\"flex min-w-0 flex-1 flex-col\">\n <span className=\"text-pho-primary truncate text-base\">\n {summary.title}\n </span>\n {summary.detail ? (\n <span className=\"text-pho-description truncate text-xs tabular-nums\">\n {summary.detail}\n </span>\n ) : null}\n </span>\n );\n\n const folded = (\n <motion.div\n key=\"folded\"\n {...takeOver(reveal, heights.current.face)}\n className=\"overflow-hidden\"\n >\n {disabled || loading ? (\n <div className={SCOPE_SUMMARY}>{summaryText}</div>\n ) : (\n <button\n ref={summaryRef}\n type=\"button\"\n aria-expanded={false}\n className={cn(\n SCOPE_SUMMARY,\n \"group hover:bg-pho-primary-hover cursor-pointer transition-colors\",\n )}\n onClick={unfold}\n >\n {summaryText}\n <span\n aria-hidden\n className={buttonVariants({\n variant: \"ghost\",\n size: \"sm\",\n className:\n \"group-hover:bg-pho-ghost-hover group-hover:text-pho-secondary-hover pointer-events-none shrink-0\",\n })}\n >\n Edit\n </span>\n </button>\n )}\n </motion.div>\n );\n\n return (\n <div\n // oxlint-disable-next-line jsx-a11y/prefer-tag-over-role\n role=\"group\"\n aria-busy={loading || undefined}\n data-scope=\"\"\n data-open={open ? \"\" : undefined}\n data-wide={wide ? \"\" : undefined}\n data-roomy={roomy ? \"\" : undefined}\n className={cn(SCOPE_SURFACE, className)}\n {...props}\n ref={(node: HTMLDivElement | null) => {\n cardRef.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref != null) ref.current = node;\n }}\n >\n {/* Folding and opening, the faces trade places on Reveal's motion:\n the one arriving opens from the height the other stood at, the\n other fades where it stood. The card moves at its bottom edge, so\n the list unfolds from the top down and rolls back up under it. */}\n <AnimatePresence initial={false} mode=\"popLayout\">\n {open ? picker : folded}\n </AnimatePresence>\n <Tooltip.Root\n handle={handle}\n onOpenChange={(next, details) => {\n // Only a description the row cuts short opens.\n if (next && !isClipped(details.event?.target)) details.cancel();\n }}\n >\n {({ payload }) => (\n <Tooltip.Portal>\n <Tooltip.Positioner side=\"top\" align=\"start\">\n <Tooltip.Popup className=\"max-w-80 font-normal\">\n {payload}\n </Tooltip.Popup>\n </Tooltip.Positioner>\n </Tooltip.Portal>\n )}\n </Tooltip.Root>\n </div>\n );\n}\n\nScope.displayName = \"Scope\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAoJA,IAAM,KACJ,8JAGI,KAAc,2BASd,KACJ,0FAWI,KACJ,oRAGI,KAAS,UAOT,KACJ,uHAGI,KACJ,uFAQI,KACJ,gVAGI,KACJ,0LAMI,KACJ,kOAMI,KACJ,sJAGI,KACJ,kKAGI,KAAW,IAEX,KAAY;AAWlB,SAAS,GAAY,GAAoC;AACvD,QAAM,CAAC,G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Q,CAAC,GAAU,EAAQ,OAAO,MAAM,KAAG,EAAQ,OAAO;AAAA,MAChE;AAAA,MAEE,UAAA,CAAA,EAAE,SAAA,EAAA,MACF,gBAAA,EAAC,EAAQ,QAAT,EAAA,UACE,gBAAA,EAAC,EAAQ,YAAT;AAAA,QAAoB,MAAK;AAAA,QAAM,OAAM;AAAA,QACnC,UAAA,gBAAA,EAAC,EAAQ,OAAT;AAAA,UAAe,WAAU;AAAA,UACtB,UAAA;AAAA,QACY,CAAA;AAAA,MACG,CAAA,EACN,CAAA;AAAA,IAEN,CAAA,CACX;AAAA;AAET;AAEA,GAAM,cAAc"}
|
|
@@ -1,109 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { t
|
|
3
|
-
import { SPRING_PRESS_INLINE as p } from "../motion.js";
|
|
4
|
-
import { r as u } from "../chunks/use-press-pulse-IbNstUT0.js";
|
|
5
|
-
import { t as m } from "../chunks/IconCheck-D2WuculQ.js";
|
|
6
|
-
import { createContext as g, useContext as h } from "react";
|
|
7
|
-
import { jsx as r } from "react/jsx-runtime";
|
|
8
|
-
import { motion as f } from "motion/react";
|
|
9
|
-
import { Select as o } from "@base-ui/react/select";
|
|
10
|
-
var l = g(!1), y = 0.99, b = p;
|
|
11
|
-
function x({ multiple: e = !1, ...t }) {
|
|
12
|
-
return /* @__PURE__ */ r(l.Provider, {
|
|
13
|
-
value: !!e,
|
|
14
|
-
children: /* @__PURE__ */ r(o.Root, {
|
|
15
|
-
multiple: e,
|
|
16
|
-
...t
|
|
17
|
-
})
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
var v = o.Value, I = o.Portal, N = o.List, P = o.Group, S = a("flex cursor-pointer items-center justify-between gap-2 text-base select-none", "transition-[color,background-color,box-shadow,outline-color] duration-150 ease-out", "data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50", "[&_svg]:text-pho-secondary [&_svg]:size-4");
|
|
21
|
-
function w({ className: e, disabled: t, variant: n = "default", onPointerDown: s, ...i }) {
|
|
22
|
-
const c = n === "inline", { motionProps: d } = u({
|
|
23
|
-
scale: c ? y : 0.98,
|
|
24
|
-
transition: c ? b : void 0,
|
|
25
|
-
disabled: !!t
|
|
26
|
-
});
|
|
27
|
-
return /* @__PURE__ */ r(o.Trigger, {
|
|
28
|
-
disabled: t,
|
|
29
|
-
onPointerDown: s,
|
|
30
|
-
render: /* @__PURE__ */ r(f.button, { ...d }),
|
|
31
|
-
className: a(S, c ? "rounded-base min-w-0 bg-transparent focus-visible:outline-none" : a("bg-pho-primary ring-pho-primary text-pho-primary rounded-base min-w-44 px-3 py-2 ring-1 ring-inset focus-visible:outline-none", "data-[popup-open]:ring-pho-brand focus-visible:ring-pho-brand focus-visible:ring-2 data-[popup-open]:ring-2"), e),
|
|
32
|
-
...i
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
function _({ className: e, ...t }) {
|
|
36
|
-
return /* @__PURE__ */ r(o.Icon, {
|
|
37
|
-
className: a("flex shrink-0 items-center", e),
|
|
38
|
-
...t
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
function E({ className: e, sideOffset: t = 6, align: n = "start", alignItemWithTrigger: s = !1, ...i }) {
|
|
42
|
-
return /* @__PURE__ */ r(o.Positioner, {
|
|
43
|
-
sideOffset: t,
|
|
44
|
-
align: n,
|
|
45
|
-
alignItemWithTrigger: s,
|
|
46
|
-
className: a("z-50 outline-none", e),
|
|
47
|
-
...i
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
function R({ className: e, ...t }) {
|
|
51
|
-
return /* @__PURE__ */ r(o.Popup, {
|
|
52
|
-
className: a("bg-pho-primary text-pho-primary shadow-pho-lg ring-pho-secondary rounded-base max-h-[var(--available-height)] min-w-[var(--anchor-width)] origin-[var(--transform-origin)] overflow-y-auto p-1 ring-1 outline-none ring-inset", "transition-[transform,opacity] duration-[140ms] ease-[cubic-bezier(0.34,1.3,0.64,1)]", "data-[starting-style]:scale-95 data-[starting-style]:opacity-0", "data-[ending-style]:scale-95 data-[ending-style]:opacity-0 data-[ending-style]:duration-100 data-[ending-style]:ease-out", e),
|
|
53
|
-
...t
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
function G({ className: e, ...t }) {
|
|
57
|
-
return /* @__PURE__ */ r(o.Item, {
|
|
58
|
-
className: a("group/pho-item text-pho-secondary grid cursor-pointer grid-cols-[1rem_1fr] items-center gap-2 rounded-[calc(var(--radius-base)-4px)] py-1.5 pr-2.5 pl-2 text-base outline-none select-none", "data-[highlighted]:bg-pho-ghost-hover data-[highlighted]:text-pho-primary data-[disabled]:opacity-50", e),
|
|
59
|
-
...t
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
function L({ className: e, ...t }) {
|
|
63
|
-
return /* @__PURE__ */ r(o.ItemText, {
|
|
64
|
-
className: a("col-start-2 min-w-0", e),
|
|
65
|
-
...t
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
function z({ className: e, children: t, ...n }) {
|
|
69
|
-
const s = h(l), i = t ?? /* @__PURE__ */ r(m, {});
|
|
70
|
-
return s ? /* @__PURE__ */ r("span", {
|
|
71
|
-
"aria-hidden": !0,
|
|
72
|
-
className: a("col-start-1 flex size-4 shrink-0 items-center justify-center rounded-sm ring-1 ring-inset", "bg-pho-primary ring-pho-primary text-pho-on-brand", "transition-[background-color,box-shadow,color] duration-150 ease-out", "group-data-[selected]/pho-item:bg-pho-brand-solid group-data-[selected]/pho-item:ring-transparent"),
|
|
73
|
-
children: /* @__PURE__ */ r(o.ItemIndicator, {
|
|
74
|
-
className: a("flex items-center justify-center [&>svg]:size-3", "transition-[transform,opacity] duration-150 ease-out", "data-[starting-style]:scale-50 data-[starting-style]:opacity-0", "data-[ending-style]:scale-50 data-[ending-style]:opacity-0", e),
|
|
75
|
-
...n,
|
|
76
|
-
children: i
|
|
77
|
-
})
|
|
78
|
-
}) : /* @__PURE__ */ r(o.ItemIndicator, {
|
|
79
|
-
className: a("text-pho-brand col-start-1 flex size-4 items-center justify-center [&>svg]:size-4", e),
|
|
80
|
-
...n,
|
|
81
|
-
children: i
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
function k({ className: e, ...t }) {
|
|
85
|
-
return /* @__PURE__ */ r(o.GroupLabel, {
|
|
86
|
-
className: a("text-pho-secondary px-2.5 py-1.5 text-xs font-medium", e),
|
|
87
|
-
...t
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
var q = {
|
|
91
|
-
Root: x,
|
|
92
|
-
Trigger: w,
|
|
93
|
-
Value: v,
|
|
94
|
-
Icon: _,
|
|
95
|
-
Portal: I,
|
|
96
|
-
Positioner: E,
|
|
97
|
-
Popup: R,
|
|
98
|
-
List: N,
|
|
99
|
-
Item: G,
|
|
100
|
-
ItemText: L,
|
|
101
|
-
ItemIndicator: z,
|
|
102
|
-
Group: P,
|
|
103
|
-
GroupLabel: k
|
|
104
|
-
};
|
|
2
|
+
import { t } from "../chunks/select-COFV0NLb.js";
|
|
105
3
|
export {
|
|
106
|
-
|
|
4
|
+
t as Select
|
|
107
5
|
};
|
|
108
|
-
|
|
109
|
-
//# sourceMappingURL=select.js.map
|
package/dist/index.js
CHANGED
|
@@ -16,14 +16,14 @@ import { n as Es, t as _s } from "./chunks/date-picker-CZbcNIe-.js";
|
|
|
16
16
|
import { n as ms, t as As } from "./chunks/copy-button-D8XyP0oR.js";
|
|
17
17
|
import { a as Ts, c as ps, d as Rs, i as ls, l as Cs, n as us, o as Bs, r as fs, s as Ns, t as Ls, u as Ps } from "./chunks/sidebar-BP39w1iA.js";
|
|
18
18
|
import { t as Ds } from "./chunks/input-fFWvPJOf.js";
|
|
19
|
-
import { i as ds, n as Vs, r as gs, t as hs } from "./chunks/filter-bar-
|
|
19
|
+
import { i as ds, n as Vs, r as gs, t as hs } from "./chunks/filter-bar-DuZXXvdm.js";
|
|
20
20
|
import { i as Us } from "./chunks/data-table-hzZb7Otx.js";
|
|
21
21
|
import { n as bs, t as Fs } from "./chunks/stat-hnNqjWVG.js";
|
|
22
22
|
import { t as ks } from "./chunks/calendar-4OFiCLAv.js";
|
|
23
23
|
import { t as Ws } from "./chunks/close-button-GvqWbLl0.js";
|
|
24
24
|
import { t as Hs } from "./chunks/input-group-fc9_jD4d.js";
|
|
25
25
|
import { n as xs, t as zs } from "./chunks/card-N-tvFsuV.js";
|
|
26
|
-
import { n as Ys, t as Zs } from "./chunks/dialog-
|
|
26
|
+
import { n as Ys, t as Zs } from "./chunks/dialog-12foDiQb.js";
|
|
27
27
|
import { i as Js, n as Qs, r as qs, t as $s } from "./chunks/status-view-C8tabjDu.js";
|
|
28
28
|
import { t as st } from "./chunks/description-list-8qm83WZB.js";
|
|
29
29
|
import { a as rt, c as ot, d as et, f as it, i as St, l as Et, m as _t, n as nt, o as mt, p as At, r as It, s as Tt, t as pt, u as Rt } from "./chunks/basic-page-6dDfY33L.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Scope, type ScopeProps, type ScopeItem, type ScopeAll } from './scope';
|
|
1
|
+
export { Scope, type ScopeProps, type ScopeItem, type ScopeAll, type ScopePreset, } from './scope';
|
|
@@ -35,6 +35,17 @@ export interface ScopeAll {
|
|
|
35
35
|
*/
|
|
36
36
|
value?: string;
|
|
37
37
|
}
|
|
38
|
+
export interface ScopePreset {
|
|
39
|
+
/**
|
|
40
|
+
* Its name: in the search row's picker, and on a folded list whose
|
|
41
|
+
* selection is exactly this one — `Read only`.
|
|
42
|
+
*/
|
|
43
|
+
label: string;
|
|
44
|
+
/** What it covers, under its name in the picker and on the folded list. */
|
|
45
|
+
description?: string;
|
|
46
|
+
/** The selection it stands for. */
|
|
47
|
+
value: readonly string[];
|
|
48
|
+
}
|
|
38
49
|
export interface ScopeProps extends Omit<ComponentProps<"div">, "defaultValue" | "onChange" | "children"> {
|
|
39
50
|
/** The catalog — everything that can be picked, in display order. */
|
|
40
51
|
items: readonly ScopeItem[];
|
|
@@ -49,6 +60,13 @@ export interface ScopeProps extends Omit<ComponentProps<"div">, "defaultValue" |
|
|
|
49
60
|
onValueChange?: (value: string[]) => void;
|
|
50
61
|
/** The catch-all row at the top. Leave it out for no such row. */
|
|
51
62
|
all?: ScopeAll;
|
|
63
|
+
/**
|
|
64
|
+
* Named selections to start from, picked at the search row's end. One
|
|
65
|
+
* chosen sets the list to its values; values the catalog doesn't offer
|
|
66
|
+
* stay as they are. A selection that is exactly a preset goes by its
|
|
67
|
+
* name there and on the folded list; any other reads Custom.
|
|
68
|
+
*/
|
|
69
|
+
presets?: readonly ScopePreset[];
|
|
52
70
|
/** The search field's placeholder, which also names it. @default "Search" */
|
|
53
71
|
placeholder?: string;
|
|
54
72
|
/**
|
|
@@ -92,7 +110,7 @@ export interface ScopeProps extends Omit<ComponentProps<"div">, "defaultValue" |
|
|
|
92
110
|
* own save below the card commits it. Values the catalog no longer offers keep a row
|
|
93
111
|
* under "No longer offered": they can be removed, never added in bulk.
|
|
94
112
|
*/
|
|
95
|
-
export declare function Scope({ items, value: valueProp, defaultValue, onValueChange, all, placeholder, collapsible, open: openProp, defaultOpen, onOpenChange, loading, disabled, className, ref, ...props }: ScopeProps): import("react").JSX.Element;
|
|
113
|
+
export declare function Scope({ items, value: valueProp, defaultValue, onValueChange, all, presets, placeholder, collapsible, open: openProp, defaultOpen, onOpenChange, loading, disabled, className, ref, ...props }: ScopeProps): import("react").JSX.Element;
|
|
96
114
|
export declare namespace Scope {
|
|
97
115
|
var displayName: string;
|
|
98
116
|
}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","names":[],"sources":["../../src/components/select/select.tsx"],"sourcesContent":["import {\n createContext,\n useContext,\n type ComponentProps,\n type ElementType,\n type ReactNode,\n} from \"react\";\nimport { Select as BaseSelect } from \"@base-ui/react/select\";\nimport { SPRING_PRESS_INLINE } from \"../../motion\";\nimport { motion } from \"motion/react\";\nimport { IconCheck } from \"@tabler/icons-react\";\nimport { cn } from \"../../utils/cn\";\nimport { usePressPulse } from \"../../utils/use-press-pulse\";\n\n/** Override Base UI's `string | (state) => string` className with plain string. */\ntype StyledProps<T extends ElementType> = Omit<\n ComponentProps<T>,\n \"className\"\n> & {\n className?: string;\n};\n\n/** Lets `ItemIndicator` know whether the Root is in `multiple` mode. */\nconst SelectMultipleContext = createContext(false);\n\nexport type SelectTriggerVariant = \"default\" | \"inline\";\n\n// Inline rides someone else's surface, so its pulse is shallower and snappier\n// than the default field's (0.98 / stiffness 700) — felt, not seen moving.\nconst INLINE_PRESS_SCALE = 0.99;\nconst INLINE_PRESS_SPRING = SPRING_PRESS_INLINE;\n\nfunction Root({\n multiple = false,\n ...props\n}: ComponentProps<typeof BaseSelect.Root>) {\n return (\n <SelectMultipleContext.Provider value={Boolean(multiple)}>\n <BaseSelect.Root multiple={multiple} {...props} />\n </SelectMultipleContext.Provider>\n );\n}\n\nconst Value = BaseSelect.Value;\nconst Portal = BaseSelect.Portal;\nconst List = BaseSelect.List;\nconst Group = BaseSelect.Group;\n\n// Shared by both Trigger variants — layout, easing, disabled, icon tone.\nconst TRIGGER_BASE = cn(\n \"flex cursor-pointer items-center justify-between gap-2 text-base select-none\",\n // Colors/stroke ease briefly; transform stays out (Motion owns it).\n \"transition-[color,background-color,box-shadow,outline-color] duration-150 ease-out\",\n \"data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50\",\n \"[&_svg]:text-pho-secondary [&_svg]:size-4\",\n);\n\nfunction Trigger({\n className,\n disabled,\n variant = \"default\",\n onPointerDown,\n ...props\n}: StyledProps<typeof BaseSelect.Trigger> & {\n /**\n * `inline` drops the field chrome (ring, background, padding, min-width)\n * to ride a host surface — an Input Group addon, a toolbar — which then\n * carries the focus/open treatment. The press pulse moves to the arrow.\n * @default \"default\"\n */\n variant?: SelectTriggerVariant;\n}) {\n // One-shot press pulse (fires on pointer-down, always completes) — the\n // Effect Button gesture family adapted for a field-sized control. Both\n // variants pulse the whole trigger; inline is shallower and quicker.\n const inline = variant === \"inline\";\n const { motionProps } = usePressPulse({\n scale: inline ? INLINE_PRESS_SCALE : 0.98,\n transition: inline ? INLINE_PRESS_SPRING : undefined,\n disabled: Boolean(disabled),\n });\n\n return (\n <BaseSelect.Trigger\n disabled={disabled}\n onPointerDown={onPointerDown}\n // Motion owns transform; a caller-supplied `render` in props still wins.\n render={<motion.button {...motionProps} />}\n className={cn(\n TRIGGER_BASE,\n inline\n ? // Chrome-free: no surface of its own, text inherits the host\n // tone, and the host shows focus (e.g. Input Group's shared ring).\n \"rounded-base min-w-0 bg-transparent focus-visible:outline-none\"\n : cn(\n // Flat field surface — shadows are reserved for floating\n // layers; the 15% ring-pho-primary hairline is the input edge.\n \"bg-pho-primary ring-pho-primary text-pho-primary rounded-base min-w-44 px-3 py-2 ring-1 ring-inset focus-visible:outline-none\",\n // Open or focused, the edge is Input's: the brand ring at 2px,\n // inset, in place of the hairline.\n \"data-[popup-open]:ring-pho-brand focus-visible:ring-pho-brand focus-visible:ring-2 data-[popup-open]:ring-2\",\n ),\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction Icon({ className, ...props }: StyledProps<typeof BaseSelect.Icon>) {\n return (\n <BaseSelect.Icon\n className={cn(\"flex shrink-0 items-center\", className)}\n {...props}\n />\n );\n}\n\nfunction Positioner({\n className,\n sideOffset = 6,\n align = \"start\",\n alignItemWithTrigger = false,\n ...props\n}: StyledProps<typeof BaseSelect.Positioner>) {\n return (\n <BaseSelect.Positioner\n sideOffset={sideOffset}\n align={align}\n // Base UI defaults to the macOS-style overlap (popup covers the trigger\n // so the selected item sits on the value text) — disorienting in a page\n // flow, so Pho drops the list below the field like a menu instead.\n alignItemWithTrigger={alignItemWithTrigger}\n className={cn(\"z-50 outline-none\", className)}\n {...props}\n />\n );\n}\n\nfunction Popup({ className, ...props }: StyledProps<typeof BaseSelect.Popup>) {\n return (\n <BaseSelect.Popup\n className={cn(\n // Floating layer: keeps its elevation shadow, edged with the site\n // hairline (ring-pho-secondary, #eee/#202020).\n \"bg-pho-primary text-pho-primary shadow-pho-lg ring-pho-secondary rounded-base max-h-[var(--available-height)] min-w-[var(--anchor-width)] origin-[var(--transform-origin)] overflow-y-auto p-1 ring-1 outline-none ring-inset\",\n // Effect-Button animation family, faster: the open springs from the\n // trigger edge with a slight overshoot; close is a quick ease-out.\n \"transition-[transform,opacity] duration-[140ms] ease-[cubic-bezier(0.34,1.3,0.64,1)]\",\n \"data-[starting-style]:scale-95 data-[starting-style]:opacity-0\",\n \"data-[ending-style]:scale-95 data-[ending-style]:opacity-0 data-[ending-style]:duration-100 data-[ending-style]:ease-out\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction Item({ className, ...props }: StyledProps<typeof BaseSelect.Item>) {\n return (\n <BaseSelect.Item\n className={cn(\n // Fixed 1rem leading column: the selection mark lives there, so every\n // label starts at the same x whether or not it is selected.\n // `group/pho-item` feeds the multiple-mode checkbox indicator.\n \"group/pho-item text-pho-secondary grid cursor-pointer grid-cols-[1rem_1fr] items-center gap-2 rounded-[calc(var(--radius-base)-4px)] py-1.5 pr-2.5 pl-2 text-base outline-none select-none\",\n // Secondary at rest; highlight lifts to primary + ghost wash (Menu idiom).\n \"data-[highlighted]:bg-pho-ghost-hover data-[highlighted]:text-pho-primary data-[disabled]:opacity-50\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction ItemText({\n className,\n ...props\n}: StyledProps<typeof BaseSelect.ItemText>) {\n return (\n <BaseSelect.ItemText\n // Pin to column 2: when the single-select indicator unmounts, grid\n // auto-placement would otherwise pull the label into the mark column.\n className={cn(\"col-start-2 min-w-0\", className)}\n {...props}\n />\n );\n}\n\n/**\n * Leading selection mark, mode-aware. Single: a brand check that appears in\n * the reserved column. Multiple: an always-visible checkbox box that fills\n * with the same quiet fill/stroke ease as the standalone Checkbox.\n */\nfunction ItemIndicator({\n className,\n children,\n ...props\n}: StyledProps<typeof BaseSelect.ItemIndicator> & { children?: ReactNode }) {\n const multiple = useContext(SelectMultipleContext);\n const mark = children ?? <IconCheck />;\n\n if (multiple) {\n return (\n <span\n aria-hidden\n className={cn(\n \"col-start-1 flex size-4 shrink-0 items-center justify-center rounded-sm ring-1 ring-inset\",\n \"bg-pho-primary ring-pho-primary text-pho-on-brand\",\n // Fill + stroke ease together on toggle — Checkbox's transition.\n \"transition-[background-color,box-shadow,color] duration-150 ease-out\",\n \"group-data-[selected]/pho-item:bg-pho-brand-solid group-data-[selected]/pho-item:ring-transparent\",\n )}\n >\n <BaseSelect.ItemIndicator\n className={cn(\n \"flex items-center justify-center [&>svg]:size-3\",\n // Glyph pops with the fill; exits on the same path.\n \"transition-[transform,opacity] duration-150 ease-out\",\n \"data-[starting-style]:scale-50 data-[starting-style]:opacity-0\",\n \"data-[ending-style]:scale-50 data-[ending-style]:opacity-0\",\n className,\n )}\n {...props}\n >\n {mark}\n </BaseSelect.ItemIndicator>\n </span>\n );\n }\n\n return (\n <BaseSelect.ItemIndicator\n className={cn(\n \"text-pho-brand col-start-1 flex size-4 items-center justify-center [&>svg]:size-4\",\n className,\n )}\n {...props}\n >\n {mark}\n </BaseSelect.ItemIndicator>\n );\n}\n\nfunction GroupLabel({\n className,\n ...props\n}: StyledProps<typeof BaseSelect.GroupLabel>) {\n return (\n <BaseSelect.GroupLabel\n className={cn(\n \"text-pho-secondary px-2.5 py-1.5 text-xs font-medium\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/**\n * Select built on Base UI `Select` — pick one option (or several with\n * `multiple`) from a list that opens below the trigger on click; the pattern\n * other design systems call a picker. Pass `items` to `Select.Root`, render an\n * `Item` per option, and show the selection with `Select.Value`. For a short,\n * always-visible set use `RadioGroup`; to filter a long list by typing use\n * `Combobox`.\n */\nexport const Select = {\n Root,\n Trigger,\n Value,\n Icon,\n Portal,\n Positioner,\n Popup,\n List,\n Item,\n ItemText,\n ItemIndicator,\n Group,\n GroupLabel,\n};\n"],"mappings":";;;;;;;;;AAuBA,IAAM,IAAwB,EAAc,EAAK,GAM3C,IAAqB,MACrB,IAAsB;AAE5B,SAAS,EAAK,EACZ,UA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