@constructive-io/ui 0.14.1 → 0.15.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/{ai-B08ufcbD.cjs → ai-DpeOFEwx.cjs} +9 -10
- package/dist/ai-DpeOFEwx.cjs.map +1 -0
- package/dist/{ai-4JrVVL3q.js → ai-b5y3Iqy4.js} +9 -10
- package/dist/ai-b5y3Iqy4.js.map +1 -0
- package/dist/components/ai/index.cjs +1 -1
- package/dist/components/ai/index.js +1 -1
- package/dist/components/autocomplete.cjs +1 -1
- package/dist/components/autocomplete.js +1 -1
- package/dist/components/badge.d.cts +2 -2
- package/dist/components/badge.d.ts +2 -2
- package/dist/components/button.cjs +2 -2
- package/dist/components/button.cjs.map +1 -1
- package/dist/components/button.d.cts +2 -2
- package/dist/components/button.d.ts +2 -2
- package/dist/components/button.js +2 -2
- package/dist/components/button.js.map +1 -1
- package/dist/components/card.d.cts +1 -1
- package/dist/components/card.d.ts +1 -1
- package/dist/components/combobox.cjs +1 -1
- package/dist/components/combobox.js +1 -1
- package/dist/components/command.cjs +1 -1
- package/dist/components/command.js +1 -1
- package/dist/components/dropdown-menu.cjs +8 -7
- package/dist/components/dropdown-menu.cjs.map +1 -1
- package/dist/components/dropdown-menu.js +8 -7
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/input-group.cjs +2 -2
- package/dist/components/input-group.cjs.map +1 -1
- package/dist/components/input-group.js +2 -2
- package/dist/components/input-group.js.map +1 -1
- package/dist/components/input-otp.cjs +5 -2
- package/dist/components/input-otp.cjs.map +1 -1
- package/dist/components/input-otp.js +5 -2
- package/dist/components/input-otp.js.map +1 -1
- package/dist/components/item.d.cts +1 -1
- package/dist/components/item.d.ts +1 -1
- package/dist/components/multi-select.cjs +1 -1
- package/dist/components/multi-select.js +1 -1
- package/dist/components/select.cjs +5 -5
- package/dist/components/select.cjs.map +1 -1
- package/dist/components/select.js +5 -5
- package/dist/components/select.js.map +1 -1
- package/dist/components/sheet.cjs +1 -1
- package/dist/components/sheet.js +1 -1
- package/dist/components/sidebar.cjs +1 -1
- package/dist/components/sidebar.js +1 -1
- package/dist/components/stack/index.d.cts +1 -1
- package/dist/components/stack/index.d.ts +1 -1
- package/dist/components/toggle-group.cjs +6 -2
- package/dist/components/toggle-group.cjs.map +1 -1
- package/dist/components/toggle-group.js +6 -2
- package/dist/components/toggle-group.js.map +1 -1
- package/dist/components/workspace-kit/index.cjs +1 -1
- package/dist/components/workspace-kit/index.js +1 -1
- package/dist/{fluid-highlight-YWFRZXsw.cjs → fluid-highlight-B8olepSM.cjs} +7 -5
- package/dist/fluid-highlight-B8olepSM.cjs.map +1 -0
- package/dist/{fluid-highlight-CNELHV8o.js → fluid-highlight-BXVfWNk9.js} +7 -5
- package/dist/fluid-highlight-BXVfWNk9.js.map +1 -0
- package/dist/{index-B7cT7gZU.d.cts → index-BzLmDsId.d.cts} +3 -3
- package/dist/{index-B7cT7gZU.d.ts → index-BzLmDsId.d.ts} +3 -3
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/{sheet-OxWlnT_G.cjs → sheet-CGFqOAoI.cjs} +2 -2
- package/dist/{sheet-OxWlnT_G.cjs.map → sheet-CGFqOAoI.cjs.map} +1 -1
- package/dist/{sheet-wPF_l9Cn.js → sheet-LOK_d8-K.js} +2 -2
- package/dist/{sheet-wPF_l9Cn.js.map → sheet-LOK_d8-K.js.map} +1 -1
- package/dist/{sidebar-DWl1Azyv.js → sidebar-BNZkdIvO.js} +2 -2
- package/dist/{sidebar-DWl1Azyv.js.map → sidebar-BNZkdIvO.js.map} +1 -1
- package/dist/{sidebar-BEEWmJwC.cjs → sidebar-Bt7qXsqo.cjs} +2 -2
- package/dist/{sidebar-BEEWmJwC.cjs.map → sidebar-Bt7qXsqo.cjs.map} +1 -1
- package/package.json +2 -2
- package/dist/ai-4JrVVL3q.js.map +0 -1
- package/dist/ai-B08ufcbD.cjs.map +0 -1
- package/dist/fluid-highlight-CNELHV8o.js.map +0 -1
- package/dist/fluid-highlight-YWFRZXsw.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.cjs","names":["React","SelectPrimitive","cn","ChevronsUpDownIcon","ChevronUpIcon","FluidHighlight","ChevronDownIcon"],"sources":["../../src/components/select.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Select as SelectPrimitive } from \"@base-ui/react/select\";\nimport {\n ChevronDownIcon,\n ChevronsUpDownIcon,\n ChevronUpIcon,\n} from \"lucide-react\";\n\nimport { useFloatingOverlayPortalProps } from \"@constructive-io/ui/portal\";\nimport { FluidHighlight } from \"../lib/motion/fluid-highlight\";\nimport { cn } from \"../lib/utils\";\n\ntype SelectProps = Omit<SelectPrimitive.Root.Props<string>, \"onValueChange\"> & {\n /** Callback when value changes */\n onValueChange?: (value: string) => void;\n};\n\ntype SelectLabels = Record<string, string>;\n\nconst NO_LABELS: SelectLabels = {};\n\n/** The text a node renders, so an item's label can stand in for its value in the trigger. */\nfunction textOf(node: React.ReactNode): string {\n if (typeof node === \"string\" || typeof node === \"number\") return String(node);\n if (Array.isArray(node)) return node.map(textOf).join(\"\");\n if (React.isValidElement<{ children?: React.ReactNode }>(node)) return textOf(node.props.children);\n return \"\";\n}\n\nfunction collectInto(children: React.ReactNode, labels: SelectLabels) {\n React.Children.forEach(children, (child) => {\n if (!React.isValidElement<{ value?: unknown; children?: React.ReactNode; label?: React.ReactNode; name?: string }>(child)) {\n return;\n }\n const { value, children: inner, label, name } = child.props;\n if (child.type === SelectItem || child.type === SelectRichItem || child.type === SelectFieldItem) {\n const text = child.type === SelectFieldItem ? (name ?? \"\") : textOf(child.type === SelectRichItem ? (label ?? inner) : inner).trim();\n if (typeof value === \"string\" && text) labels[value] = text;\n } else if (inner) {\n collectInto(inner, labels);\n }\n });\n}\n\n/** Reads `value -> label` from the <SelectItem>s declared in `children` (groups, fragments and nested markup included). */\nfunction collectItemLabels(children: React.ReactNode): SelectLabels {\n const labels: SelectLabels = {};\n collectInto(children, labels);\n return Object.keys(labels).length > 0 ? labels : NO_LABELS;\n}\n\nfunction sameLabels(a: SelectLabels, b: SelectLabels): boolean {\n if (a === b) return true;\n const keys = Object.keys(b);\n return keys.length === Object.keys(a).length && keys.every((key) => a[key] === b[key]);\n}\n\n/** Keeps the same object while the labels are unchanged, so Base UI is not handed a new `items` on every render. */\nfunction useStableLabels(next: SelectLabels): SelectLabels {\n const [stable, setStable] = React.useState(next);\n if (sameLabels(stable, next)) return stable;\n // Adjusting state while rendering: React re-renders at once, before anything is committed, and no ref is involved.\n setStable(next);\n return next;\n}\n\n/**\n * Base UI shows the raw `value` in the trigger unless it is given `items`. Pass `items` for full control (the children\n * are then not read at all); without it the labels are read from the <SelectItem>s declared in `children`, so\n * `defaultValue=\"editor\"` shows \"Editor\", not `editor`. Items rendered by a wrapper component are not visible from\n * here: pass `items` when the options come from one.\n */\nfunction Select({ onValueChange, items, children, ...props }: SelectProps) {\n const declared = useStableLabels(items != null ? NO_LABELS : collectItemLabels(children));\n\n return (\n <SelectPrimitive.Root<string>\n items={items ?? (declared === NO_LABELS ? undefined : declared)}\n onValueChange={\n onValueChange\n ? (value, _eventDetails) => {\n // Only call callback when there's an actual value (not null/undefined)\n if (value != null) {\n onValueChange(value);\n }\n }\n : undefined\n }\n {...props}\n >\n {children}\n </SelectPrimitive.Root>\n );\n}\n\ntype SelectTriggerProps = SelectPrimitive.Trigger.Props & {\n size?: \"sm\" | \"default\" | \"lg\";\n};\n\nconst SelectTrigger = React.forwardRef<HTMLButtonElement, SelectTriggerProps>(\n ({ className, size = \"default\", children, ...props }, ref) => {\n return (\n <SelectPrimitive.Trigger\n ref={ref}\n className={cn(\n \"relative inline-flex min-h-9 w-full min-w-[min(9rem,100%)] select-none items-center justify-between gap-2 rounded-md border border-input bg-background bg-clip-padding px-[calc(--spacing(3)-1px)] text-left text-base outline-none ring-ring/35 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-md)-1px)] not-data-disabled:not-focus-visible:not-aria-invalid:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] pointer-coarse:min-h-11 sm:pointer-coarse:min-h-11 focus-visible:border-ring/60 focus-visible:ring-[3px] aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:ring-destructive/16 data-disabled:pointer-events-none data-disabled:opacity-64 sm:min-h-8 sm:text-sm dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border dark:aria-invalid:ring-destructive/24 dark:not-data-disabled:not-focus-visible:not-aria-invalid:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/8%)] [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0 [[data-disabled],:focus-visible,[aria-invalid],[data-pressed]]:shadow-none\",\n size === \"sm\" &&\n \"min-h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] sm:min-h-7\",\n size === \"lg\" && \"min-h-10 sm:min-h-9\",\n className,\n )}\n data-slot=\"select-trigger\"\n {...props}\n >\n {children}\n <SelectPrimitive.Icon data-slot=\"select-icon\">\n <ChevronsUpDownIcon className=\"-me-1 size-4.5 opacity-80 sm:size-4\" />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n );\n }\n);\nSelectTrigger.displayName = \"SelectTrigger\";\n\ntype SelectValueProps = React.ComponentProps<typeof SelectPrimitive.Value>;\n\nfunction SelectValue({ className, placeholder, children, onMouseEnter, title, ...props }: SelectValueProps) {\n return (\n <SelectPrimitive.Value\n className={cn(\n \"flex-1 truncate data-placeholder:text-subtle-foreground\",\n className,\n )}\n data-slot=\"select-value\"\n placeholder={placeholder}\n title={title}\n // A truncated value carries its full text as a tooltip and a value that fits carries none, unless the host set a\n // `title` of its own, which stays.\n onMouseEnter={(event) => {\n if (title === undefined) {\n const element = event.currentTarget;\n element.title = element.scrollWidth > element.clientWidth ? (element.textContent ?? \"\") : \"\";\n }\n onMouseEnter?.(event);\n }}\n {...props}\n >\n {children}\n </SelectPrimitive.Value>\n );\n}\n\ntype SelectPopupProps = SelectPrimitive.Popup.Props & {\n sideOffset?: SelectPrimitive.Positioner.Props[\"sideOffset\"];\n alignItemWithTrigger?: SelectPrimitive.Positioner.Props[\"alignItemWithTrigger\"];\n /** @deprecated Not used in Base UI. Kept for backward compatibility. */\n position?: \"item-aligned\" | \"popper\";\n /** Shown when the list has no items. */\n emptyMessage?: React.ReactNode;\n};\n\nfunction SelectPopup({\n className,\n children,\n sideOffset = 4,\n alignItemWithTrigger = false,\n position: _position,\n emptyMessage = \"No options\",\n ...props\n}: SelectPopupProps) {\n const { container, zIndexClass } = useFloatingOverlayPortalProps();\n\n return (\n <SelectPrimitive.Portal container={container}>\n <SelectPrimitive.Positioner\n alignItemWithTrigger={alignItemWithTrigger}\n className={cn(\"select-none\", zIndexClass)}\n data-slot=\"select-positioner\"\n sideOffset={sideOffset}\n >\n <SelectPrimitive.Popup\n className=\"origin-(--transform-origin) scale-100 opacity-100 transition-[scale,opacity] duration-(--duration-moderate) data-[side=none]:transition-none data-starting-style:scale-98 data-ending-style:scale-98 data-starting-style:opacity-0 data-ending-style:opacity-0 motion-reduce:transition-none\"\n data-slot=\"select-popup\"\n {...props}\n >\n <SelectPrimitive.ScrollUpArrow\n className=\"top-0 flex h-6 w-full cursor-default items-center justify-center before:pointer-events-none before:absolute before:inset-x-px before:top-px before:h-[200%] before:rounded-t-[calc(var(--radius-lg)-1px)] before:bg-linear-to-b before:from-50% before:from-popover\"\n data-slot=\"select-scroll-up-arrow\"\n >\n <ChevronUpIcon className=\"relative size-4.5 sm:size-4\" />\n </SelectPrimitive.ScrollUpArrow>\n <span className=\"relative block h-full rounded-lg border bg-popover bg-clip-padding before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-lg dark:not-in-data-[slot=group]:bg-clip-border\">\n <SelectPrimitive.List\n className={cn(\n // `scroll-py-6` keeps a scrolled-to item clear of the scroll arrows; the empty message only shows\n // while the list holds no option.\n \"relative max-h-(--available-height) min-w-(--anchor-width) scroll-py-6 overflow-y-auto p-1 [&:not(:has([role=option]))>[data-slot=select-empty]]:block\",\n className,\n )}\n data-slot=\"select-list\"\n >\n <FluidHighlight />\n {children}\n <div\n className=\"hidden px-2 py-1.5 text-center text-muted-foreground text-sm\"\n data-slot=\"select-empty\"\n role=\"presentation\"\n >\n {emptyMessage}\n </div>\n </SelectPrimitive.List>\n </span>\n <SelectPrimitive.ScrollDownArrow\n className=\"bottom-0 flex h-6 w-full cursor-default items-center justify-center before:pointer-events-none before:absolute before:inset-x-px before:bottom-px before:h-[200%] before:rounded-b-[calc(var(--radius-lg)-1px)] before:bg-linear-to-t before:from-50% before:from-popover\"\n data-slot=\"select-scroll-down-arrow\"\n >\n <ChevronDownIcon className=\"relative size-4.5 sm:size-4\" />\n </SelectPrimitive.ScrollDownArrow>\n </SelectPrimitive.Popup>\n </SelectPrimitive.Positioner>\n </SelectPrimitive.Portal>\n );\n}\n\nfunction SelectItem({\n className,\n children,\n ...props\n}: SelectPrimitive.Item.Props) {\n return (\n <SelectPrimitive.Item\n className={cn(\n \"relative grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 rounded-sm py-1 ps-2 pe-4 text-base outline-none pointer-coarse:min-h-11 sm:pointer-coarse:min-h-11 data-disabled:pointer-events-none data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n className,\n )}\n data-slot=\"select-item\"\n {...props}\n >\n\t\t<SelectPrimitive.ItemIndicator\n\t\t\tkeepMounted\n\t\t\tclassName={(state) =>\n\t\t\t\tcn(\n\t\t\t\t\t'col-start-1 transition-[opacity,scale,filter] duration-(--duration-slow) ease-out motion-reduce:transition-none',\n\t\t\t\t\tstate.selected ? 'scale-100 opacity-100 blur-0' : 'scale-[0.25] opacity-0 blur-[4px]',\n\t\t\t\t)\n\t\t\t}\n\t\t>\n <svg\n fill=\"none\"\n height=\"24\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"2\"\n viewBox=\"0 0 24 24\"\n width=\"24\"\n xmlns=\"http://www.w3.org/1500/svg\"\n >\n <path d=\"M5.252 12.7 10.2 18.63 18.748 5.37\" />\n </svg>\n </SelectPrimitive.ItemIndicator>\n <SelectPrimitive.ItemText className=\"col-start-2 min-w-0 [overflow-wrap:anywhere]\">\n {children}\n </SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n );\n}\n\nfunction SelectSeparator({\n className,\n ...props\n}: SelectPrimitive.Separator.Props) {\n return (\n <SelectPrimitive.Separator\n className={cn(\"mx-2 my-1 h-px bg-border\", className)}\n data-slot=\"select-separator\"\n {...props}\n />\n );\n}\n\nfunction SelectGroup({ ...props }: SelectPrimitive.Group.Props) {\n return <SelectPrimitive.Group data-slot=\"select-group\" {...props} />;\n}\n\nfunction SelectGroupLabel({ ...props }: SelectPrimitive.GroupLabel.Props) {\n return (\n <SelectPrimitive.GroupLabel\n className=\"px-2 py-1.5 font-medium text-muted-foreground text-xs\"\n data-slot=\"select-group-label\"\n {...props}\n />\n );\n}\n\ntype SelectRichItemProps = SelectPrimitive.Item.Props & {\n /** Main label text */\n label?: React.ReactNode;\n /** Optional description text below the label */\n description?: React.ReactNode;\n /** Optional icon element */\n icon?: React.ReactNode;\n};\n\nfunction SelectRichItem({\n className,\n children,\n label,\n description,\n icon,\n ...props\n}: SelectRichItemProps) {\n return (\n <SelectPrimitive.Item\n className={cn(\n \"relative grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 rounded-sm py-1.5 ps-2 pe-4 text-base outline-none pointer-coarse:min-h-11 sm:pointer-coarse:min-h-11 data-disabled:pointer-events-none data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n className,\n )}\n data-slot=\"select-rich-item\"\n {...props}\n >\n\t\t<SelectPrimitive.ItemIndicator\n\t\t\tkeepMounted\n\t\t\tclassName={(state) =>\n\t\t\t\tcn(\n\t\t\t\t\t'col-start-1 mt-0.5 self-start transition-[opacity,scale,filter] duration-(--duration-slow) ease-out motion-reduce:transition-none',\n\t\t\t\t\tstate.selected ? 'scale-100 opacity-100 blur-0' : 'scale-[0.25] opacity-0 blur-[4px]',\n\t\t\t\t)\n\t\t\t}\n\t\t>\n <svg\n fill=\"none\"\n height=\"24\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"2\"\n viewBox=\"0 0 24 24\"\n width=\"24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M5.252 12.7 10.2 18.63 18.748 5.37\" />\n </svg>\n </SelectPrimitive.ItemIndicator>\n <SelectPrimitive.ItemText className=\"col-start-2 min-w-0 flex flex-col gap-0.5 [overflow-wrap:anywhere]\">\n <span className=\"flex items-center gap-2\">\n {icon}\n {label ?? children}\n </span>\n {description && (\n <span className=\"text-muted-foreground text-xs\">{description}</span>\n )}\n </SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n );\n}\n\ntype SelectFieldItemProps = SelectPrimitive.Item.Props & {\n /** Field name to display */\n name: string;\n /** Field type to display as muted text */\n type?: string;\n};\n\nfunction SelectFieldItem({\n className,\n name,\n type,\n ...props\n}: SelectFieldItemProps) {\n return (\n <SelectPrimitive.Item\n className={cn(\n \"relative grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 rounded-sm py-1 ps-2 pe-4 text-base outline-none pointer-coarse:min-h-11 sm:pointer-coarse:min-h-11 data-disabled:pointer-events-none data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n className,\n )}\n data-slot=\"select-field-item\"\n {...props}\n >\n\t\t<SelectPrimitive.ItemIndicator\n\t\t\tkeepMounted\n\t\t\tclassName={(state) =>\n\t\t\t\tcn(\n\t\t\t\t\t'col-start-1 transition-[opacity,scale,filter] duration-(--duration-slow) ease-out motion-reduce:transition-none',\n\t\t\t\t\tstate.selected ? 'scale-100 opacity-100 blur-0' : 'scale-[0.25] opacity-0 blur-[4px]',\n\t\t\t\t)\n\t\t\t}\n\t\t>\n <svg\n fill=\"none\"\n height=\"24\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"2\"\n viewBox=\"0 0 24 24\"\n width=\"24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M5.252 12.7 10.2 18.63 18.748 5.37\" />\n </svg>\n </SelectPrimitive.ItemIndicator>\n <SelectPrimitive.ItemText className=\"col-start-2 min-w-0 flex items-center justify-between gap-2\">\n <span className=\"truncate\">{name}</span>\n {type && (\n <span className=\"text-muted-foreground text-xs shrink-0\">{type}</span>\n )}\n </SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n );\n}\n\nexport {\n Select,\n SelectTrigger,\n SelectValue,\n SelectPopup,\n SelectPopup as SelectContent,\n SelectItem,\n SelectRichItem,\n SelectFieldItem,\n SelectSeparator,\n SelectGroup,\n SelectGroupLabel,\n SelectGroupLabel as SelectLabel,\n};\n"],"mappings":";;;;;;;;;;;;;;A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CAAC,QAAD;IAAM,WAAU;cAAY;GAAW,IACtC,QACC,2CAAC,QAAD;IAAM,WAAU;cAA0C;GAAW,EAE/C;IACN;;AAE1B"}
|
|
1
|
+
{"version":3,"file":"select.cjs","names":["React","SelectPrimitive","cn","ChevronsUpDownIcon","ChevronUpIcon","FluidHighlight","ChevronDownIcon"],"sources":["../../src/components/select.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Select as SelectPrimitive } from \"@base-ui/react/select\";\nimport {\n ChevronDownIcon,\n ChevronsUpDownIcon,\n ChevronUpIcon,\n} from \"lucide-react\";\n\nimport { useFloatingOverlayPortalProps } from \"@constructive-io/ui/portal\";\nimport { FluidHighlight } from \"../lib/motion/fluid-highlight\";\nimport { cn } from \"../lib/utils\";\n\ntype SelectProps = Omit<SelectPrimitive.Root.Props<string>, \"onValueChange\"> & {\n /** Callback when value changes */\n onValueChange?: (value: string) => void;\n};\n\ntype SelectLabels = Record<string, string>;\n\nconst NO_LABELS: SelectLabels = {};\n\n/** The text a node renders, so an item's label can stand in for its value in the trigger. */\nfunction textOf(node: React.ReactNode): string {\n if (typeof node === \"string\" || typeof node === \"number\") return String(node);\n if (Array.isArray(node)) return node.map(textOf).join(\"\");\n if (React.isValidElement<{ children?: React.ReactNode }>(node)) return textOf(node.props.children);\n return \"\";\n}\n\nfunction collectInto(children: React.ReactNode, labels: SelectLabels) {\n React.Children.forEach(children, (child) => {\n if (!React.isValidElement<{ value?: unknown; children?: React.ReactNode; label?: React.ReactNode; name?: string }>(child)) {\n return;\n }\n const { value, children: inner, label, name } = child.props;\n if (child.type === SelectItem || child.type === SelectRichItem || child.type === SelectFieldItem) {\n const text = child.type === SelectFieldItem ? (name ?? \"\") : textOf(child.type === SelectRichItem ? (label ?? inner) : inner).trim();\n if (typeof value === \"string\" && text) labels[value] = text;\n } else if (inner) {\n collectInto(inner, labels);\n }\n });\n}\n\n/** Reads `value -> label` from the <SelectItem>s declared in `children` (groups, fragments and nested markup included). */\nfunction collectItemLabels(children: React.ReactNode): SelectLabels {\n const labels: SelectLabels = {};\n collectInto(children, labels);\n return Object.keys(labels).length > 0 ? labels : NO_LABELS;\n}\n\nfunction sameLabels(a: SelectLabels, b: SelectLabels): boolean {\n if (a === b) return true;\n const keys = Object.keys(b);\n return keys.length === Object.keys(a).length && keys.every((key) => a[key] === b[key]);\n}\n\n/** Keeps the same object while the labels are unchanged, so Base UI is not handed a new `items` on every render. */\nfunction useStableLabels(next: SelectLabels): SelectLabels {\n const [stable, setStable] = React.useState(next);\n if (sameLabels(stable, next)) return stable;\n // Adjusting state while rendering: React re-renders at once, before anything is committed, and no ref is involved.\n setStable(next);\n return next;\n}\n\n/**\n * Base UI shows the raw `value` in the trigger unless it is given `items`. Pass `items` for full control (the children\n * are then not read at all); without it the labels are read from the <SelectItem>s declared in `children`, so\n * `defaultValue=\"editor\"` shows \"Editor\", not `editor`. Items rendered by a wrapper component are not visible from\n * here: pass `items` when the options come from one.\n */\nfunction Select({ onValueChange, items, children, ...props }: SelectProps) {\n const declared = useStableLabels(items != null ? NO_LABELS : collectItemLabels(children));\n\n return (\n <SelectPrimitive.Root<string>\n items={items ?? (declared === NO_LABELS ? undefined : declared)}\n onValueChange={\n onValueChange\n ? (value, _eventDetails) => {\n // Only call callback when there's an actual value (not null/undefined)\n if (value != null) {\n onValueChange(value);\n }\n }\n : undefined\n }\n {...props}\n >\n {children}\n </SelectPrimitive.Root>\n );\n}\n\ntype SelectTriggerProps = SelectPrimitive.Trigger.Props & {\n size?: \"sm\" | \"default\" | \"lg\";\n};\n\nconst SelectTrigger = React.forwardRef<HTMLButtonElement, SelectTriggerProps>(\n ({ className, size = \"default\", children, ...props }, ref) => {\n return (\n <SelectPrimitive.Trigger\n ref={ref}\n className={cn(\n \"relative inline-flex min-h-9 w-full min-w-[min(9rem,100%)] select-none items-center justify-between gap-2 rounded-md border border-input bg-background bg-clip-padding px-[calc(--spacing(3)-1px)] text-left text-base outline-none ring-ring/35 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-md)-1px)] not-data-disabled:not-focus-visible:not-aria-invalid:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] pointer-coarse:min-h-11 sm:pointer-coarse:min-h-11 focus-visible:border-ring/60 focus-visible:ring-[3px] aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:ring-destructive/16 data-disabled:pointer-events-none data-disabled:opacity-64 sm:min-h-8 sm:text-sm dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border dark:aria-invalid:ring-destructive/24 dark:not-data-disabled:not-focus-visible:not-aria-invalid:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/8%)] [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0 [[data-disabled],:focus-visible,[aria-invalid],[data-pressed]]:shadow-none\",\n size === \"sm\" &&\n \"min-h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] sm:min-h-7\",\n size === \"lg\" && \"min-h-10 sm:min-h-9\",\n className,\n )}\n data-slot=\"select-trigger\"\n {...props}\n >\n {children}\n <SelectPrimitive.Icon data-slot=\"select-icon\">\n <ChevronsUpDownIcon className=\"-me-1 size-4.5 opacity-80 sm:size-4\" />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n );\n }\n);\nSelectTrigger.displayName = \"SelectTrigger\";\n\ntype SelectValueProps = React.ComponentProps<typeof SelectPrimitive.Value>;\n\nfunction SelectValue({ className, placeholder, children, onMouseEnter, title, ...props }: SelectValueProps) {\n return (\n <SelectPrimitive.Value\n className={cn(\n \"flex-1 truncate data-placeholder:text-subtle-foreground\",\n className,\n )}\n data-slot=\"select-value\"\n placeholder={placeholder}\n title={title}\n // A truncated value carries its full text as a tooltip and a value that fits carries none, unless the host set a\n // `title` of its own, which stays.\n onMouseEnter={(event) => {\n if (title === undefined) {\n const element = event.currentTarget;\n element.title = element.scrollWidth > element.clientWidth ? (element.textContent ?? \"\") : \"\";\n }\n onMouseEnter?.(event);\n }}\n {...props}\n >\n {children}\n </SelectPrimitive.Value>\n );\n}\n\ntype SelectPopupProps = SelectPrimitive.Popup.Props & {\n sideOffset?: SelectPrimitive.Positioner.Props[\"sideOffset\"];\n alignItemWithTrigger?: SelectPrimitive.Positioner.Props[\"alignItemWithTrigger\"];\n /** @deprecated Not used in Base UI. Kept for backward compatibility. */\n position?: \"item-aligned\" | \"popper\";\n /** Shown when the list has no items. */\n emptyMessage?: React.ReactNode;\n};\n\nfunction SelectPopup({\n className,\n children,\n sideOffset = 4,\n alignItemWithTrigger = false,\n position: _position,\n emptyMessage = \"No options\",\n ...props\n}: SelectPopupProps) {\n const { container, zIndexClass } = useFloatingOverlayPortalProps();\n\n return (\n <SelectPrimitive.Portal container={container}>\n <SelectPrimitive.Positioner\n alignItemWithTrigger={alignItemWithTrigger}\n className={cn(\"select-none\", zIndexClass)}\n data-slot=\"select-positioner\"\n sideOffset={sideOffset}\n >\n <SelectPrimitive.Popup\n className=\"origin-(--transform-origin) scale-100 opacity-100 transition-[scale,opacity] duration-(--duration-moderate) data-[side=none]:transition-none data-starting-style:scale-98 data-ending-style:scale-98 data-starting-style:opacity-0 data-ending-style:opacity-0 motion-reduce:transition-none\"\n data-slot=\"select-popup\"\n {...props}\n >\n <SelectPrimitive.ScrollUpArrow\n className=\"top-0 flex h-6 w-full cursor-default items-center justify-center before:pointer-events-none before:absolute before:inset-x-px before:top-px before:h-[200%] before:rounded-t-[calc(var(--radius-lg)-1px)] before:bg-linear-to-b before:from-50% before:from-popover\"\n data-slot=\"select-scroll-up-arrow\"\n >\n <ChevronUpIcon className=\"relative size-4.5 sm:size-4\" />\n </SelectPrimitive.ScrollUpArrow>\n <span className=\"relative block h-full rounded-lg border bg-popover bg-clip-padding before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-lg dark:not-in-data-[slot=group]:bg-clip-border\">\n <SelectPrimitive.List\n className={cn(\n // `scroll-py-6` keeps a scrolled-to item clear of the scroll arrows; the empty message only shows\n // while the list holds no option.\n \"relative max-h-(--available-height) min-w-(--anchor-width) scroll-py-6 overflow-y-auto p-1 [&:not(:has([role=option]))>[data-slot=select-empty]]:block\",\n className,\n )}\n data-slot=\"select-list\"\n >\n {/* Items sit 5px inside the 10px popup (1px border + 4px padding), so they are 10px - 5px round. */}\n <FluidHighlight className=\"rounded-[calc(var(--radius-lg)-5px)]\" />\n {children}\n <div\n className=\"hidden px-2 py-1.5 text-center text-muted-foreground text-sm\"\n data-slot=\"select-empty\"\n role=\"presentation\"\n >\n {emptyMessage}\n </div>\n </SelectPrimitive.List>\n </span>\n <SelectPrimitive.ScrollDownArrow\n className=\"bottom-0 flex h-6 w-full cursor-default items-center justify-center before:pointer-events-none before:absolute before:inset-x-px before:bottom-px before:h-[200%] before:rounded-b-[calc(var(--radius-lg)-1px)] before:bg-linear-to-t before:from-50% before:from-popover\"\n data-slot=\"select-scroll-down-arrow\"\n >\n <ChevronDownIcon className=\"relative size-4.5 sm:size-4\" />\n </SelectPrimitive.ScrollDownArrow>\n </SelectPrimitive.Popup>\n </SelectPrimitive.Positioner>\n </SelectPrimitive.Portal>\n );\n}\n\nfunction SelectItem({\n className,\n children,\n ...props\n}: SelectPrimitive.Item.Props) {\n return (\n <SelectPrimitive.Item\n className={cn(\n \"relative grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 rounded-[calc(var(--radius-lg)-5px)] py-1 ps-2 pe-4 text-base outline-none pointer-coarse:min-h-11 sm:pointer-coarse:min-h-11 data-disabled:pointer-events-none data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n className,\n )}\n data-slot=\"select-item\"\n {...props}\n >\n\t\t<SelectPrimitive.ItemIndicator\n\t\t\tkeepMounted\n\t\t\tclassName={(state) =>\n\t\t\t\tcn(\n\t\t\t\t\t'col-start-1 transition-[opacity,scale,filter] duration-(--duration-slow) ease-out motion-reduce:transition-none',\n\t\t\t\t\tstate.selected ? 'scale-100 opacity-100 blur-0' : 'scale-[0.25] opacity-0 blur-[4px]',\n\t\t\t\t)\n\t\t\t}\n\t\t>\n <svg\n fill=\"none\"\n height=\"24\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"2\"\n viewBox=\"0 0 24 24\"\n width=\"24\"\n xmlns=\"http://www.w3.org/1500/svg\"\n >\n <path d=\"M5.252 12.7 10.2 18.63 18.748 5.37\" />\n </svg>\n </SelectPrimitive.ItemIndicator>\n <SelectPrimitive.ItemText className=\"col-start-2 min-w-0 [overflow-wrap:anywhere]\">\n {children}\n </SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n );\n}\n\nfunction SelectSeparator({\n className,\n ...props\n}: SelectPrimitive.Separator.Props) {\n return (\n <SelectPrimitive.Separator\n className={cn(\"mx-2 my-1 h-px bg-border\", className)}\n data-slot=\"select-separator\"\n {...props}\n />\n );\n}\n\nfunction SelectGroup({ ...props }: SelectPrimitive.Group.Props) {\n return <SelectPrimitive.Group data-slot=\"select-group\" {...props} />;\n}\n\nfunction SelectGroupLabel({ ...props }: SelectPrimitive.GroupLabel.Props) {\n return (\n <SelectPrimitive.GroupLabel\n className=\"px-2 py-1.5 font-medium text-muted-foreground text-xs\"\n data-slot=\"select-group-label\"\n {...props}\n />\n );\n}\n\ntype SelectRichItemProps = SelectPrimitive.Item.Props & {\n /** Main label text */\n label?: React.ReactNode;\n /** Optional description text below the label */\n description?: React.ReactNode;\n /** Optional icon element */\n icon?: React.ReactNode;\n};\n\nfunction SelectRichItem({\n className,\n children,\n label,\n description,\n icon,\n ...props\n}: SelectRichItemProps) {\n return (\n <SelectPrimitive.Item\n className={cn(\n \"relative grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 rounded-[calc(var(--radius-lg)-5px)] py-1.5 ps-2 pe-4 text-base outline-none pointer-coarse:min-h-11 sm:pointer-coarse:min-h-11 data-disabled:pointer-events-none data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n className,\n )}\n data-slot=\"select-rich-item\"\n {...props}\n >\n\t\t<SelectPrimitive.ItemIndicator\n\t\t\tkeepMounted\n\t\t\tclassName={(state) =>\n\t\t\t\tcn(\n\t\t\t\t\t'col-start-1 mt-0.5 self-start transition-[opacity,scale,filter] duration-(--duration-slow) ease-out motion-reduce:transition-none',\n\t\t\t\t\tstate.selected ? 'scale-100 opacity-100 blur-0' : 'scale-[0.25] opacity-0 blur-[4px]',\n\t\t\t\t)\n\t\t\t}\n\t\t>\n <svg\n fill=\"none\"\n height=\"24\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"2\"\n viewBox=\"0 0 24 24\"\n width=\"24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M5.252 12.7 10.2 18.63 18.748 5.37\" />\n </svg>\n </SelectPrimitive.ItemIndicator>\n <SelectPrimitive.ItemText className=\"col-start-2 min-w-0 flex flex-col gap-0.5 [overflow-wrap:anywhere]\">\n <span className=\"flex items-center gap-2\">\n {icon}\n {label ?? children}\n </span>\n {description && (\n <span className=\"text-muted-foreground text-xs\">{description}</span>\n )}\n </SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n );\n}\n\ntype SelectFieldItemProps = SelectPrimitive.Item.Props & {\n /** Field name to display */\n name: string;\n /** Field type to display as muted text */\n type?: string;\n};\n\nfunction SelectFieldItem({\n className,\n name,\n type,\n ...props\n}: SelectFieldItemProps) {\n return (\n <SelectPrimitive.Item\n className={cn(\n \"relative grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 rounded-[calc(var(--radius-lg)-5px)] py-1 ps-2 pe-4 text-base outline-none pointer-coarse:min-h-11 sm:pointer-coarse:min-h-11 data-disabled:pointer-events-none data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n className,\n )}\n data-slot=\"select-field-item\"\n {...props}\n >\n\t\t<SelectPrimitive.ItemIndicator\n\t\t\tkeepMounted\n\t\t\tclassName={(state) =>\n\t\t\t\tcn(\n\t\t\t\t\t'col-start-1 transition-[opacity,scale,filter] duration-(--duration-slow) ease-out motion-reduce:transition-none',\n\t\t\t\t\tstate.selected ? 'scale-100 opacity-100 blur-0' : 'scale-[0.25] opacity-0 blur-[4px]',\n\t\t\t\t)\n\t\t\t}\n\t\t>\n <svg\n fill=\"none\"\n height=\"24\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"2\"\n viewBox=\"0 0 24 24\"\n width=\"24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M5.252 12.7 10.2 18.63 18.748 5.37\" />\n </svg>\n </SelectPrimitive.ItemIndicator>\n <SelectPrimitive.ItemText className=\"col-start-2 min-w-0 flex items-center justify-between gap-2\">\n <span className=\"truncate\">{name}</span>\n {type && (\n <span className=\"text-muted-foreground text-xs shrink-0\">{type}</span>\n )}\n </SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n );\n}\n\nexport {\n Select,\n SelectTrigger,\n SelectValue,\n SelectPopup,\n SelectPopup as SelectContent,\n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;IACZ,SAAQ;IACR,OAAM;IACN,OAAM;cAEN,2CAAC,QAAD,EAAM,GAAE,qCAAsC;GAC3C;EACwB,IAC/B,4CAACD,6BAAgB,UAAjB;GAA0B,WAAU;aAApC,CACE,2CAAC,QAAD;IAAM,WAAU;cAAY;GAAW,IACtC,QACC,2CAAC,QAAD;IAAM,WAAU;cAA0C;GAAW,EAE/C;IACN;;AAE1B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { t as cn } from "../utils-BkMLyah9.js";
|
|
4
|
-
import { t as FluidHighlight } from "../fluid-highlight-
|
|
4
|
+
import { t as FluidHighlight } from "../fluid-highlight-BXVfWNk9.js";
|
|
5
5
|
import * as React$1 from "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { ChevronDownIcon, ChevronUpIcon, ChevronsUpDownIcon } from "lucide-react";
|
|
@@ -117,7 +117,7 @@ function SelectPopup({ className, children, sideOffset = 4, alignItemWithTrigger
|
|
|
117
117
|
className: cn("relative max-h-(--available-height) min-w-(--anchor-width) scroll-py-6 overflow-y-auto p-1 [&:not(:has([role=option]))>[data-slot=select-empty]]:block", className),
|
|
118
118
|
"data-slot": "select-list",
|
|
119
119
|
children: [
|
|
120
|
-
/* @__PURE__ */ jsx(FluidHighlight, {}),
|
|
120
|
+
/* @__PURE__ */ jsx(FluidHighlight, { className: "rounded-[calc(var(--radius-lg)-5px)]" }),
|
|
121
121
|
children,
|
|
122
122
|
/* @__PURE__ */ jsx("div", {
|
|
123
123
|
className: "hidden px-2 py-1.5 text-center text-muted-foreground text-sm",
|
|
@@ -140,7 +140,7 @@ function SelectPopup({ className, children, sideOffset = 4, alignItemWithTrigger
|
|
|
140
140
|
}
|
|
141
141
|
function SelectItem({ className, children, ...props }) {
|
|
142
142
|
return /* @__PURE__ */ jsxs(Select$1.Item, {
|
|
143
|
-
className: cn("relative grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 rounded-
|
|
143
|
+
className: cn("relative grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 rounded-[calc(var(--radius-lg)-5px)] py-1 ps-2 pe-4 text-base outline-none pointer-coarse:min-h-11 sm:pointer-coarse:min-h-11 data-disabled:pointer-events-none data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", className),
|
|
144
144
|
"data-slot": "select-item",
|
|
145
145
|
...props,
|
|
146
146
|
children: [/* @__PURE__ */ jsx(Select$1.ItemIndicator, {
|
|
@@ -186,7 +186,7 @@ function SelectGroupLabel({ ...props }) {
|
|
|
186
186
|
}
|
|
187
187
|
function SelectRichItem({ className, children, label, description, icon, ...props }) {
|
|
188
188
|
return /* @__PURE__ */ jsxs(Select$1.Item, {
|
|
189
|
-
className: cn("relative grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 rounded-
|
|
189
|
+
className: cn("relative grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 rounded-[calc(var(--radius-lg)-5px)] py-1.5 ps-2 pe-4 text-base outline-none pointer-coarse:min-h-11 sm:pointer-coarse:min-h-11 data-disabled:pointer-events-none data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", className),
|
|
190
190
|
"data-slot": "select-rich-item",
|
|
191
191
|
...props,
|
|
192
192
|
children: [/* @__PURE__ */ jsx(Select$1.ItemIndicator, {
|
|
@@ -218,7 +218,7 @@ function SelectRichItem({ className, children, label, description, icon, ...prop
|
|
|
218
218
|
}
|
|
219
219
|
function SelectFieldItem({ className, name, type, ...props }) {
|
|
220
220
|
return /* @__PURE__ */ jsxs(Select$1.Item, {
|
|
221
|
-
className: cn("relative grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 rounded-
|
|
221
|
+
className: cn("relative grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 rounded-[calc(var(--radius-lg)-5px)] py-1 ps-2 pe-4 text-base outline-none pointer-coarse:min-h-11 sm:pointer-coarse:min-h-11 data-disabled:pointer-events-none data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", className),
|
|
222
222
|
"data-slot": "select-field-item",
|
|
223
223
|
...props,
|
|
224
224
|
children: [/* @__PURE__ */ jsx(Select$1.ItemIndicator, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","names":["React","SelectPrimitive"],"sources":["../../src/components/select.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Select as SelectPrimitive } from \"@base-ui/react/select\";\nimport {\n ChevronDownIcon,\n ChevronsUpDownIcon,\n ChevronUpIcon,\n} from \"lucide-react\";\n\nimport { useFloatingOverlayPortalProps } from \"@constructive-io/ui/portal\";\nimport { FluidHighlight } from \"../lib/motion/fluid-highlight\";\nimport { cn } from \"../lib/utils\";\n\ntype SelectProps = Omit<SelectPrimitive.Root.Props<string>, \"onValueChange\"> & {\n /** Callback when value changes */\n onValueChange?: (value: string) => void;\n};\n\ntype SelectLabels = Record<string, string>;\n\nconst NO_LABELS: SelectLabels = {};\n\n/** The text a node renders, so an item's label can stand in for its value in the trigger. */\nfunction textOf(node: React.ReactNode): string {\n if (typeof node === \"string\" || typeof node === \"number\") return String(node);\n if (Array.isArray(node)) return node.map(textOf).join(\"\");\n if (React.isValidElement<{ children?: React.ReactNode }>(node)) return textOf(node.props.children);\n return \"\";\n}\n\nfunction collectInto(children: React.ReactNode, labels: SelectLabels) {\n React.Children.forEach(children, (child) => {\n if (!React.isValidElement<{ value?: unknown; children?: React.ReactNode; label?: React.ReactNode; name?: string }>(child)) {\n return;\n }\n const { value, children: inner, label, name } = child.props;\n if (child.type === SelectItem || child.type === SelectRichItem || child.type === SelectFieldItem) {\n const text = child.type === SelectFieldItem ? (name ?? \"\") : textOf(child.type === SelectRichItem ? (label ?? inner) : inner).trim();\n if (typeof value === \"string\" && text) labels[value] = text;\n } else if (inner) {\n collectInto(inner, labels);\n }\n });\n}\n\n/** Reads `value -> label` from the <SelectItem>s declared in `children` (groups, fragments and nested markup included). */\nfunction collectItemLabels(children: React.ReactNode): SelectLabels {\n const labels: SelectLabels = {};\n collectInto(children, labels);\n return Object.keys(labels).length > 0 ? labels : NO_LABELS;\n}\n\nfunction sameLabels(a: SelectLabels, b: SelectLabels): boolean {\n if (a === b) return true;\n const keys = Object.keys(b);\n return keys.length === Object.keys(a).length && keys.every((key) => a[key] === b[key]);\n}\n\n/** Keeps the same object while the labels are unchanged, so Base UI is not handed a new `items` on every render. */\nfunction useStableLabels(next: SelectLabels): SelectLabels {\n const [stable, setStable] = React.useState(next);\n if (sameLabels(stable, next)) return stable;\n // Adjusting state while rendering: React re-renders at once, before anything is committed, and no ref is involved.\n setStable(next);\n return next;\n}\n\n/**\n * Base UI shows the raw `value` in the trigger unless it is given `items`. Pass `items` for full control (the children\n * are then not read at all); without it the labels are read from the <SelectItem>s declared in `children`, so\n * `defaultValue=\"editor\"` shows \"Editor\", not `editor`. Items rendered by a wrapper component are not visible from\n * here: pass `items` when the options come from one.\n */\nfunction Select({ onValueChange, items, children, ...props }: SelectProps) {\n const declared = useStableLabels(items != null ? NO_LABELS : collectItemLabels(children));\n\n return (\n <SelectPrimitive.Root<string>\n items={items ?? (declared === NO_LABELS ? undefined : declared)}\n onValueChange={\n onValueChange\n ? (value, _eventDetails) => {\n // Only call callback when there's an actual value (not null/undefined)\n if (value != null) {\n onValueChange(value);\n }\n }\n : undefined\n }\n {...props}\n >\n {children}\n </SelectPrimitive.Root>\n );\n}\n\ntype SelectTriggerProps = SelectPrimitive.Trigger.Props & {\n size?: \"sm\" | \"default\" | \"lg\";\n};\n\nconst SelectTrigger = React.forwardRef<HTMLButtonElement, SelectTriggerProps>(\n ({ className, size = \"default\", children, ...props }, ref) => {\n return (\n <SelectPrimitive.Trigger\n ref={ref}\n className={cn(\n \"relative inline-flex min-h-9 w-full min-w-[min(9rem,100%)] select-none items-center justify-between gap-2 rounded-md border border-input bg-background bg-clip-padding px-[calc(--spacing(3)-1px)] text-left text-base outline-none ring-ring/35 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-md)-1px)] not-data-disabled:not-focus-visible:not-aria-invalid:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] pointer-coarse:min-h-11 sm:pointer-coarse:min-h-11 focus-visible:border-ring/60 focus-visible:ring-[3px] aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:ring-destructive/16 data-disabled:pointer-events-none data-disabled:opacity-64 sm:min-h-8 sm:text-sm dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border dark:aria-invalid:ring-destructive/24 dark:not-data-disabled:not-focus-visible:not-aria-invalid:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/8%)] [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0 [[data-disabled],:focus-visible,[aria-invalid],[data-pressed]]:shadow-none\",\n size === \"sm\" &&\n \"min-h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] sm:min-h-7\",\n size === \"lg\" && \"min-h-10 sm:min-h-9\",\n className,\n )}\n data-slot=\"select-trigger\"\n {...props}\n >\n {children}\n <SelectPrimitive.Icon data-slot=\"select-icon\">\n <ChevronsUpDownIcon className=\"-me-1 size-4.5 opacity-80 sm:size-4\" />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n );\n }\n);\nSelectTrigger.displayName = \"SelectTrigger\";\n\ntype SelectValueProps = React.ComponentProps<typeof SelectPrimitive.Value>;\n\nfunction SelectValue({ className, placeholder, children, onMouseEnter, title, ...props }: SelectValueProps) {\n return (\n <SelectPrimitive.Value\n className={cn(\n \"flex-1 truncate data-placeholder:text-subtle-foreground\",\n className,\n )}\n data-slot=\"select-value\"\n placeholder={placeholder}\n title={title}\n // A truncated value carries its full text as a tooltip and a value that fits carries none, unless the host set a\n // `title` of its own, which stays.\n onMouseEnter={(event) => {\n if (title === undefined) {\n const element = event.currentTarget;\n element.title = element.scrollWidth > element.clientWidth ? (element.textContent ?? \"\") : \"\";\n }\n onMouseEnter?.(event);\n }}\n {...props}\n >\n {children}\n </SelectPrimitive.Value>\n );\n}\n\ntype SelectPopupProps = SelectPrimitive.Popup.Props & {\n sideOffset?: SelectPrimitive.Positioner.Props[\"sideOffset\"];\n alignItemWithTrigger?: SelectPrimitive.Positioner.Props[\"alignItemWithTrigger\"];\n /** @deprecated Not used in Base UI. Kept for backward compatibility. */\n position?: \"item-aligned\" | \"popper\";\n /** Shown when the list has no items. */\n emptyMessage?: React.ReactNode;\n};\n\nfunction SelectPopup({\n className,\n children,\n sideOffset = 4,\n alignItemWithTrigger = false,\n position: _position,\n emptyMessage = \"No options\",\n ...props\n}: SelectPopupProps) {\n const { container, zIndexClass } = useFloatingOverlayPortalProps();\n\n return (\n <SelectPrimitive.Portal container={container}>\n <SelectPrimitive.Positioner\n alignItemWithTrigger={alignItemWithTrigger}\n className={cn(\"select-none\", zIndexClass)}\n data-slot=\"select-positioner\"\n sideOffset={sideOffset}\n >\n <SelectPrimitive.Popup\n className=\"origin-(--transform-origin) scale-100 opacity-100 transition-[scale,opacity] duration-(--duration-moderate) data-[side=none]:transition-none data-starting-style:scale-98 data-ending-style:scale-98 data-starting-style:opacity-0 data-ending-style:opacity-0 motion-reduce:transition-none\"\n data-slot=\"select-popup\"\n {...props}\n >\n <SelectPrimitive.ScrollUpArrow\n className=\"top-0 flex h-6 w-full cursor-default items-center justify-center before:pointer-events-none before:absolute before:inset-x-px before:top-px before:h-[200%] before:rounded-t-[calc(var(--radius-lg)-1px)] before:bg-linear-to-b before:from-50% before:from-popover\"\n data-slot=\"select-scroll-up-arrow\"\n >\n <ChevronUpIcon className=\"relative size-4.5 sm:size-4\" />\n </SelectPrimitive.ScrollUpArrow>\n <span className=\"relative block h-full rounded-lg border bg-popover bg-clip-padding before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-lg dark:not-in-data-[slot=group]:bg-clip-border\">\n <SelectPrimitive.List\n className={cn(\n // `scroll-py-6` keeps a scrolled-to item clear of the scroll arrows; the empty message only shows\n // while the list holds no option.\n \"relative max-h-(--available-height) min-w-(--anchor-width) scroll-py-6 overflow-y-auto p-1 [&:not(:has([role=option]))>[data-slot=select-empty]]:block\",\n className,\n )}\n data-slot=\"select-list\"\n >\n <FluidHighlight />\n {children}\n <div\n className=\"hidden px-2 py-1.5 text-center text-muted-foreground text-sm\"\n data-slot=\"select-empty\"\n role=\"presentation\"\n >\n {emptyMessage}\n </div>\n </SelectPrimitive.List>\n </span>\n <SelectPrimitive.ScrollDownArrow\n className=\"bottom-0 flex h-6 w-full cursor-default items-center justify-center before:pointer-events-none before:absolute before:inset-x-px before:bottom-px before:h-[200%] before:rounded-b-[calc(var(--radius-lg)-1px)] before:bg-linear-to-t before:from-50% before:from-popover\"\n data-slot=\"select-scroll-down-arrow\"\n >\n <ChevronDownIcon className=\"relative size-4.5 sm:size-4\" />\n </SelectPrimitive.ScrollDownArrow>\n </SelectPrimitive.Popup>\n </SelectPrimitive.Positioner>\n </SelectPrimitive.Portal>\n );\n}\n\nfunction SelectItem({\n className,\n children,\n ...props\n}: SelectPrimitive.Item.Props) {\n return (\n <SelectPrimitive.Item\n className={cn(\n \"relative grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 rounded-sm py-1 ps-2 pe-4 text-base outline-none pointer-coarse:min-h-11 sm:pointer-coarse:min-h-11 data-disabled:pointer-events-none data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n className,\n )}\n data-slot=\"select-item\"\n {...props}\n >\n\t\t<SelectPrimitive.ItemIndicator\n\t\t\tkeepMounted\n\t\t\tclassName={(state) =>\n\t\t\t\tcn(\n\t\t\t\t\t'col-start-1 transition-[opacity,scale,filter] duration-(--duration-slow) ease-out motion-reduce:transition-none',\n\t\t\t\t\tstate.selected ? 'scale-100 opacity-100 blur-0' : 'scale-[0.25] opacity-0 blur-[4px]',\n\t\t\t\t)\n\t\t\t}\n\t\t>\n <svg\n fill=\"none\"\n height=\"24\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"2\"\n viewBox=\"0 0 24 24\"\n width=\"24\"\n xmlns=\"http://www.w3.org/1500/svg\"\n >\n <path d=\"M5.252 12.7 10.2 18.63 18.748 5.37\" />\n </svg>\n </SelectPrimitive.ItemIndicator>\n <SelectPrimitive.ItemText className=\"col-start-2 min-w-0 [overflow-wrap:anywhere]\">\n {children}\n </SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n );\n}\n\nfunction SelectSeparator({\n className,\n ...props\n}: SelectPrimitive.Separator.Props) {\n return (\n <SelectPrimitive.Separator\n className={cn(\"mx-2 my-1 h-px bg-border\", className)}\n data-slot=\"select-separator\"\n {...props}\n />\n );\n}\n\nfunction SelectGroup({ ...props }: SelectPrimitive.Group.Props) {\n return <SelectPrimitive.Group data-slot=\"select-group\" {...props} />;\n}\n\nfunction SelectGroupLabel({ ...props }: SelectPrimitive.GroupLabel.Props) {\n return (\n <SelectPrimitive.GroupLabel\n className=\"px-2 py-1.5 font-medium text-muted-foreground text-xs\"\n data-slot=\"select-group-label\"\n {...props}\n />\n );\n}\n\ntype SelectRichItemProps = SelectPrimitive.Item.Props & {\n /** Main label text */\n label?: React.ReactNode;\n /** Optional description text below the label */\n description?: React.ReactNode;\n /** Optional icon element */\n icon?: React.ReactNode;\n};\n\nfunction SelectRichItem({\n className,\n children,\n label,\n description,\n icon,\n ...props\n}: SelectRichItemProps) {\n return (\n <SelectPrimitive.Item\n className={cn(\n \"relative grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 rounded-sm py-1.5 ps-2 pe-4 text-base outline-none pointer-coarse:min-h-11 sm:pointer-coarse:min-h-11 data-disabled:pointer-events-none data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n className,\n )}\n data-slot=\"select-rich-item\"\n {...props}\n >\n\t\t<SelectPrimitive.ItemIndicator\n\t\t\tkeepMounted\n\t\t\tclassName={(state) =>\n\t\t\t\tcn(\n\t\t\t\t\t'col-start-1 mt-0.5 self-start transition-[opacity,scale,filter] duration-(--duration-slow) ease-out motion-reduce:transition-none',\n\t\t\t\t\tstate.selected ? 'scale-100 opacity-100 blur-0' : 'scale-[0.25] opacity-0 blur-[4px]',\n\t\t\t\t)\n\t\t\t}\n\t\t>\n <svg\n fill=\"none\"\n height=\"24\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"2\"\n viewBox=\"0 0 24 24\"\n width=\"24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M5.252 12.7 10.2 18.63 18.748 5.37\" />\n </svg>\n </SelectPrimitive.ItemIndicator>\n <SelectPrimitive.ItemText className=\"col-start-2 min-w-0 flex flex-col gap-0.5 [overflow-wrap:anywhere]\">\n <span className=\"flex items-center gap-2\">\n {icon}\n {label ?? children}\n </span>\n {description && (\n <span className=\"text-muted-foreground text-xs\">{description}</span>\n )}\n </SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n );\n}\n\ntype SelectFieldItemProps = SelectPrimitive.Item.Props & {\n /** Field name to display */\n name: string;\n /** Field type to display as muted text */\n type?: string;\n};\n\nfunction SelectFieldItem({\n className,\n name,\n type,\n ...props\n}: SelectFieldItemProps) {\n return (\n <SelectPrimitive.Item\n className={cn(\n \"relative grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 rounded-sm py-1 ps-2 pe-4 text-base outline-none pointer-coarse:min-h-11 sm:pointer-coarse:min-h-11 data-disabled:pointer-events-none data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n className,\n )}\n data-slot=\"select-field-item\"\n {...props}\n >\n\t\t<SelectPrimitive.ItemIndicator\n\t\t\tkeepMounted\n\t\t\tclassName={(state) =>\n\t\t\t\tcn(\n\t\t\t\t\t'col-start-1 transition-[opacity,scale,filter] duration-(--duration-slow) ease-out motion-reduce:transition-none',\n\t\t\t\t\tstate.selected ? 'scale-100 opacity-100 blur-0' : 'scale-[0.25] opacity-0 blur-[4px]',\n\t\t\t\t)\n\t\t\t}\n\t\t>\n <svg\n fill=\"none\"\n height=\"24\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"2\"\n viewBox=\"0 0 24 24\"\n width=\"24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M5.252 12.7 10.2 18.63 18.748 5.37\" />\n </svg>\n </SelectPrimitive.ItemIndicator>\n <SelectPrimitive.ItemText className=\"col-start-2 min-w-0 flex items-center justify-between gap-2\">\n <span className=\"truncate\">{name}</span>\n {type && (\n <span className=\"text-muted-foreground text-xs shrink-0\">{type}</span>\n )}\n </SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n );\n}\n\nexport {\n Select,\n SelectTrigger,\n SelectValue,\n SelectPopup,\n SelectPopup as SelectContent,\n SelectItem,\n SelectRichItem,\n SelectFieldItem,\n SelectSeparator,\n SelectGroup,\n SelectGroupLabel,\n SelectGroupLabel as SelectLabel,\n};\n"],"mappings":";;;;;;;;;;;AAqBA,MAAM,YAA0B,CAAC;;AAGjC,SAAS,OAAO,MAA+B;CAC7C,IAAI,OAAO,SAAS,YAAY,OAAO,SAAS,UAAU,OAAO,OAAO,IAAI;CAC5E,IAAI,MAAM,QAAQ,IAAI,GAAG,OAAO,KAAK,IAAI,MAAM,CAAC,CAAC,KAAK,EAAE;CACxD,IAAIA,QAAM,eAA+C,IAAI,GAAG,OAAO,OAAO,KAAK,MAAM,QAAQ;CACjG,OAAO;AACT;AAEA,SAAS,YAAY,UAA2B,QAAsB;CACpE,QAAM,SAAS,QAAQ,WAAW,UAAU;EAC1C,IAAI,CAACA,QAAM,eAAwG,KAAK,GACtH;EAEF,MAAM,EAAE,OAAO,UAAU,OAAO,OAAO,SAAS,MAAM;EACtD,IAAI,MAAM,SAAS,cAAc,MAAM,SAAS,kBAAkB,MAAM,SAAS,iBAAiB;GAChG,MAAM,OAAO,MAAM,SAAS,kBAAmB,QAAQ,KAAM,OAAO,MAAM,SAAS,iBAAkB,SAAS,QAAS,KAA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AM,WAAU;cAAhB,CACG,MACA,SAAS,QACN;OACL,eACC,oBAAC,QAAD;IAAM,WAAU;cAAiC;GAAkB,EAE7C;IACN;;AAE1B;AASA,SAAS,gBAAgB,EACvB,WACA,MACA,MACA,GAAG,SACoB;CACvB,OACE,qBAACA,SAAgB,MAAjB;EACE,WAAW,GACT,ifACA,SACF;EACA,aAAU;EACV,GAAI;YANN,CAQF,oBAACA,SAAgB,eAAjB;GACC;GACA,YAAY,UACX,GACC,mHACA,MAAM,WAAW,iCAAiC,mCACnD;aAGI,oBAAC,OAAD;IACE,MAAK;IACL,QAAO;IACP,QAAO;IACP,eAAc;IACd,gBAAe;IACf,aAAY;IACZ,SAAQ;IACR,OAAM;IACN,OAAM;cAEN,oBAAC,QAAD,EAAM,GAAE,qCAAsC;GAC3C;EACwB,IAC/B,qBAACA,SAAgB,UAAjB;GAA0B,WAAU;aAApC,CACE,oBAAC,QAAD;IAAM,WAAU;cAAY;GAAW,IACtC,QACC,oBAAC,QAAD;IAAM,WAAU;cAA0C;GAAW,EAE/C;IACN;;AAE1B"}
|
|
1
|
+
{"version":3,"file":"select.js","names":["React","SelectPrimitive"],"sources":["../../src/components/select.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Select as SelectPrimitive } from \"@base-ui/react/select\";\nimport {\n ChevronDownIcon,\n ChevronsUpDownIcon,\n ChevronUpIcon,\n} from \"lucide-react\";\n\nimport { useFloatingOverlayPortalProps } from \"@constructive-io/ui/portal\";\nimport { FluidHighlight } from \"../lib/motion/fluid-highlight\";\nimport { cn } from \"../lib/utils\";\n\ntype SelectProps = Omit<SelectPrimitive.Root.Props<string>, \"onValueChange\"> & {\n /** Callback when value changes */\n onValueChange?: (value: string) => void;\n};\n\ntype SelectLabels = Record<string, string>;\n\nconst NO_LABELS: SelectLabels = {};\n\n/** The text a node renders, so an item's label can stand in for its value in the trigger. */\nfunction textOf(node: React.ReactNode): string {\n if (typeof node === \"string\" || typeof node === \"number\") return String(node);\n if (Array.isArray(node)) return node.map(textOf).join(\"\");\n if (React.isValidElement<{ children?: React.ReactNode }>(node)) return textOf(node.props.children);\n return \"\";\n}\n\nfunction collectInto(children: React.ReactNode, labels: SelectLabels) {\n React.Children.forEach(children, (child) => {\n if (!React.isValidElement<{ value?: unknown; children?: React.ReactNode; label?: React.ReactNode; name?: string }>(child)) {\n return;\n }\n const { value, children: inner, label, name } = child.props;\n if (child.type === SelectItem || child.type === SelectRichItem || child.type === SelectFieldItem) {\n const text = child.type === SelectFieldItem ? (name ?? \"\") : textOf(child.type === SelectRichItem ? (label ?? inner) : inner).trim();\n if (typeof value === \"string\" && text) labels[value] = text;\n } else if (inner) {\n collectInto(inner, labels);\n }\n });\n}\n\n/** Reads `value -> label` from the <SelectItem>s declared in `children` (groups, fragments and nested markup included). */\nfunction collectItemLabels(children: React.ReactNode): SelectLabels {\n const labels: SelectLabels = {};\n collectInto(children, labels);\n return Object.keys(labels).length > 0 ? labels : NO_LABELS;\n}\n\nfunction sameLabels(a: SelectLabels, b: SelectLabels): boolean {\n if (a === b) return true;\n const keys = Object.keys(b);\n return keys.length === Object.keys(a).length && keys.every((key) => a[key] === b[key]);\n}\n\n/** Keeps the same object while the labels are unchanged, so Base UI is not handed a new `items` on every render. */\nfunction useStableLabels(next: SelectLabels): SelectLabels {\n const [stable, setStable] = React.useState(next);\n if (sameLabels(stable, next)) return stable;\n // Adjusting state while rendering: React re-renders at once, before anything is committed, and no ref is involved.\n setStable(next);\n return next;\n}\n\n/**\n * Base UI shows the raw `value` in the trigger unless it is given `items`. Pass `items` for full control (the children\n * are then not read at all); without it the labels are read from the <SelectItem>s declared in `children`, so\n * `defaultValue=\"editor\"` shows \"Editor\", not `editor`. Items rendered by a wrapper component are not visible from\n * here: pass `items` when the options come from one.\n */\nfunction Select({ onValueChange, items, children, ...props }: SelectProps) {\n const declared = useStableLabels(items != null ? NO_LABELS : collectItemLabels(children));\n\n return (\n <SelectPrimitive.Root<string>\n items={items ?? (declared === NO_LABELS ? undefined : declared)}\n onValueChange={\n onValueChange\n ? (value, _eventDetails) => {\n // Only call callback when there's an actual value (not null/undefined)\n if (value != null) {\n onValueChange(value);\n }\n }\n : undefined\n }\n {...props}\n >\n {children}\n </SelectPrimitive.Root>\n );\n}\n\ntype SelectTriggerProps = SelectPrimitive.Trigger.Props & {\n size?: \"sm\" | \"default\" | \"lg\";\n};\n\nconst SelectTrigger = React.forwardRef<HTMLButtonElement, SelectTriggerProps>(\n ({ className, size = \"default\", children, ...props }, ref) => {\n return (\n <SelectPrimitive.Trigger\n ref={ref}\n className={cn(\n \"relative inline-flex min-h-9 w-full min-w-[min(9rem,100%)] select-none items-center justify-between gap-2 rounded-md border border-input bg-background bg-clip-padding px-[calc(--spacing(3)-1px)] text-left text-base outline-none ring-ring/35 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-md)-1px)] not-data-disabled:not-focus-visible:not-aria-invalid:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] pointer-coarse:min-h-11 sm:pointer-coarse:min-h-11 focus-visible:border-ring/60 focus-visible:ring-[3px] aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:ring-destructive/16 data-disabled:pointer-events-none data-disabled:opacity-64 sm:min-h-8 sm:text-sm dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border dark:aria-invalid:ring-destructive/24 dark:not-data-disabled:not-focus-visible:not-aria-invalid:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/8%)] [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0 [[data-disabled],:focus-visible,[aria-invalid],[data-pressed]]:shadow-none\",\n size === \"sm\" &&\n \"min-h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] sm:min-h-7\",\n size === \"lg\" && \"min-h-10 sm:min-h-9\",\n className,\n )}\n data-slot=\"select-trigger\"\n {...props}\n >\n {children}\n <SelectPrimitive.Icon data-slot=\"select-icon\">\n <ChevronsUpDownIcon className=\"-me-1 size-4.5 opacity-80 sm:size-4\" />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n );\n }\n);\nSelectTrigger.displayName = \"SelectTrigger\";\n\ntype SelectValueProps = React.ComponentProps<typeof SelectPrimitive.Value>;\n\nfunction SelectValue({ className, placeholder, children, onMouseEnter, title, ...props }: SelectValueProps) {\n return (\n <SelectPrimitive.Value\n className={cn(\n \"flex-1 truncate data-placeholder:text-subtle-foreground\",\n className,\n )}\n data-slot=\"select-value\"\n placeholder={placeholder}\n title={title}\n // A truncated value carries its full text as a tooltip and a value that fits carries none, unless the host set a\n // `title` of its own, which stays.\n onMouseEnter={(event) => {\n if (title === undefined) {\n const element = event.currentTarget;\n element.title = element.scrollWidth > element.clientWidth ? (element.textContent ?? \"\") : \"\";\n }\n onMouseEnter?.(event);\n }}\n {...props}\n >\n {children}\n </SelectPrimitive.Value>\n );\n}\n\ntype SelectPopupProps = SelectPrimitive.Popup.Props & {\n sideOffset?: SelectPrimitive.Positioner.Props[\"sideOffset\"];\n alignItemWithTrigger?: SelectPrimitive.Positioner.Props[\"alignItemWithTrigger\"];\n /** @deprecated Not used in Base UI. Kept for backward compatibility. */\n position?: \"item-aligned\" | \"popper\";\n /** Shown when the list has no items. */\n emptyMessage?: React.ReactNode;\n};\n\nfunction SelectPopup({\n className,\n children,\n sideOffset = 4,\n alignItemWithTrigger = false,\n position: _position,\n emptyMessage = \"No options\",\n ...props\n}: SelectPopupProps) {\n const { container, zIndexClass } = useFloatingOverlayPortalProps();\n\n return (\n <SelectPrimitive.Portal container={container}>\n <SelectPrimitive.Positioner\n alignItemWithTrigger={alignItemWithTrigger}\n className={cn(\"select-none\", zIndexClass)}\n data-slot=\"select-positioner\"\n sideOffset={sideOffset}\n >\n <SelectPrimitive.Popup\n className=\"origin-(--transform-origin) scale-100 opacity-100 transition-[scale,opacity] duration-(--duration-moderate) data-[side=none]:transition-none data-starting-style:scale-98 data-ending-style:scale-98 data-starting-style:opacity-0 data-ending-style:opacity-0 motion-reduce:transition-none\"\n data-slot=\"select-popup\"\n {...props}\n >\n <SelectPrimitive.ScrollUpArrow\n className=\"top-0 flex h-6 w-full cursor-default items-center justify-center before:pointer-events-none before:absolute before:inset-x-px before:top-px before:h-[200%] before:rounded-t-[calc(var(--radius-lg)-1px)] before:bg-linear-to-b before:from-50% before:from-popover\"\n data-slot=\"select-scroll-up-arrow\"\n >\n <ChevronUpIcon className=\"relative size-4.5 sm:size-4\" />\n </SelectPrimitive.ScrollUpArrow>\n <span className=\"relative block h-full rounded-lg border bg-popover bg-clip-padding before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-lg dark:not-in-data-[slot=group]:bg-clip-border\">\n <SelectPrimitive.List\n className={cn(\n // `scroll-py-6` keeps a scrolled-to item clear of the scroll arrows; the empty message only shows\n // while the list holds no option.\n \"relative max-h-(--available-height) min-w-(--anchor-width) scroll-py-6 overflow-y-auto p-1 [&:not(:has([role=option]))>[data-slot=select-empty]]:block\",\n className,\n )}\n data-slot=\"select-list\"\n >\n {/* Items sit 5px inside the 10px popup (1px border + 4px padding), so they are 10px - 5px round. */}\n <FluidHighlight className=\"rounded-[calc(var(--radius-lg)-5px)]\" />\n {children}\n <div\n className=\"hidden px-2 py-1.5 text-center text-muted-foreground text-sm\"\n data-slot=\"select-empty\"\n role=\"presentation\"\n >\n {emptyMessage}\n </div>\n </SelectPrimitive.List>\n </span>\n <SelectPrimitive.ScrollDownArrow\n className=\"bottom-0 flex h-6 w-full cursor-default items-center justify-center before:pointer-events-none before:absolute before:inset-x-px before:bottom-px before:h-[200%] before:rounded-b-[calc(var(--radius-lg)-1px)] before:bg-linear-to-t before:from-50% before:from-popover\"\n data-slot=\"select-scroll-down-arrow\"\n >\n <ChevronDownIcon className=\"relative size-4.5 sm:size-4\" />\n </SelectPrimitive.ScrollDownArrow>\n </SelectPrimitive.Popup>\n </SelectPrimitive.Positioner>\n </SelectPrimitive.Portal>\n );\n}\n\nfunction SelectItem({\n className,\n children,\n ...props\n}: SelectPrimitive.Item.Props) {\n return (\n <SelectPrimitive.Item\n className={cn(\n \"relative grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 rounded-[calc(var(--radius-lg)-5px)] py-1 ps-2 pe-4 text-base outline-none pointer-coarse:min-h-11 sm:pointer-coarse:min-h-11 data-disabled:pointer-events-none data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n className,\n )}\n data-slot=\"select-item\"\n {...props}\n >\n\t\t<SelectPrimitive.ItemIndicator\n\t\t\tkeepMounted\n\t\t\tclassName={(state) =>\n\t\t\t\tcn(\n\t\t\t\t\t'col-start-1 transition-[opacity,scale,filter] duration-(--duration-slow) ease-out motion-reduce:transition-none',\n\t\t\t\t\tstate.selected ? 'scale-100 opacity-100 blur-0' : 'scale-[0.25] opacity-0 blur-[4px]',\n\t\t\t\t)\n\t\t\t}\n\t\t>\n <svg\n fill=\"none\"\n height=\"24\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"2\"\n viewBox=\"0 0 24 24\"\n width=\"24\"\n xmlns=\"http://www.w3.org/1500/svg\"\n >\n <path d=\"M5.252 12.7 10.2 18.63 18.748 5.37\" />\n </svg>\n </SelectPrimitive.ItemIndicator>\n <SelectPrimitive.ItemText className=\"col-start-2 min-w-0 [overflow-wrap:anywhere]\">\n {children}\n </SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n );\n}\n\nfunction SelectSeparator({\n className,\n ...props\n}: SelectPrimitive.Separator.Props) {\n return (\n <SelectPrimitive.Separator\n className={cn(\"mx-2 my-1 h-px bg-border\", className)}\n data-slot=\"select-separator\"\n {...props}\n />\n );\n}\n\nfunction SelectGroup({ ...props }: SelectPrimitive.Group.Props) {\n return <SelectPrimitive.Group data-slot=\"select-group\" {...props} />;\n}\n\nfunction SelectGroupLabel({ ...props }: SelectPrimitive.GroupLabel.Props) {\n return (\n <SelectPrimitive.GroupLabel\n className=\"px-2 py-1.5 font-medium text-muted-foreground text-xs\"\n data-slot=\"select-group-label\"\n {...props}\n />\n );\n}\n\ntype SelectRichItemProps = SelectPrimitive.Item.Props & {\n /** Main label text */\n label?: React.ReactNode;\n /** Optional description text below the label */\n description?: React.ReactNode;\n /** Optional icon element */\n icon?: React.ReactNode;\n};\n\nfunction SelectRichItem({\n className,\n children,\n label,\n description,\n icon,\n ...props\n}: SelectRichItemProps) {\n return (\n <SelectPrimitive.Item\n className={cn(\n \"relative grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 rounded-[calc(var(--radius-lg)-5px)] py-1.5 ps-2 pe-4 text-base outline-none pointer-coarse:min-h-11 sm:pointer-coarse:min-h-11 data-disabled:pointer-events-none data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n className,\n )}\n data-slot=\"select-rich-item\"\n {...props}\n >\n\t\t<SelectPrimitive.ItemIndicator\n\t\t\tkeepMounted\n\t\t\tclassName={(state) =>\n\t\t\t\tcn(\n\t\t\t\t\t'col-start-1 mt-0.5 self-start transition-[opacity,scale,filter] duration-(--duration-slow) ease-out motion-reduce:transition-none',\n\t\t\t\t\tstate.selected ? 'scale-100 opacity-100 blur-0' : 'scale-[0.25] opacity-0 blur-[4px]',\n\t\t\t\t)\n\t\t\t}\n\t\t>\n <svg\n fill=\"none\"\n height=\"24\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"2\"\n viewBox=\"0 0 24 24\"\n width=\"24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M5.252 12.7 10.2 18.63 18.748 5.37\" />\n </svg>\n </SelectPrimitive.ItemIndicator>\n <SelectPrimitive.ItemText className=\"col-start-2 min-w-0 flex flex-col gap-0.5 [overflow-wrap:anywhere]\">\n <span className=\"flex items-center gap-2\">\n {icon}\n {label ?? children}\n </span>\n {description && (\n <span className=\"text-muted-foreground text-xs\">{description}</span>\n )}\n </SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n );\n}\n\ntype SelectFieldItemProps = SelectPrimitive.Item.Props & {\n /** Field name to display */\n name: string;\n /** Field type to display as muted text */\n type?: string;\n};\n\nfunction SelectFieldItem({\n className,\n name,\n type,\n ...props\n}: SelectFieldItemProps) {\n return (\n <SelectPrimitive.Item\n className={cn(\n \"relative grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 rounded-[calc(var(--radius-lg)-5px)] py-1 ps-2 pe-4 text-base outline-none pointer-coarse:min-h-11 sm:pointer-coarse:min-h-11 data-disabled:pointer-events-none data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n className,\n )}\n data-slot=\"select-field-item\"\n {...props}\n >\n\t\t<SelectPrimitive.ItemIndicator\n\t\t\tkeepMounted\n\t\t\tclassName={(state) =>\n\t\t\t\tcn(\n\t\t\t\t\t'col-start-1 transition-[opacity,scale,filter] duration-(--duration-slow) ease-out motion-reduce:transition-none',\n\t\t\t\t\tstate.selected ? 'scale-100 opacity-100 blur-0' : 'scale-[0.25] opacity-0 blur-[4px]',\n\t\t\t\t)\n\t\t\t}\n\t\t>\n <svg\n fill=\"none\"\n height=\"24\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"2\"\n viewBox=\"0 0 24 24\"\n width=\"24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M5.252 12.7 10.2 18.63 18.748 5.37\" />\n </svg>\n </SelectPrimitive.ItemIndicator>\n <SelectPrimitive.ItemText className=\"col-start-2 min-w-0 flex items-center justify-between gap-2\">\n <span className=\"truncate\">{name}</span>\n {type && (\n <span className=\"text-muted-foreground text-xs shrink-0\">{type}</span>\n )}\n </SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n );\n}\n\nexport {\n Select,\n SelectTrigger,\n SelectValue,\n SelectPopup,\n SelectPopup as SelectContent,\n SelectItem,\n SelectRichItem,\n SelectFieldItem,\n SelectSeparator,\n SelectGroup,\n SelectGroupLabel,\n SelectGroupLabel as SelectLabel,\n};\n"],"mappings":";;;;;;;;;;;AAqBA,MAAM,YAA0B,CAAC;;AAGjC,SAAS,OAAO,MAA+B;CAC7C,IAAI,OAAO,SAAS,YAAY,OAAO,SAAS,UAAU,OAAO,OAAO,IAAI;CAC5E,IAAI,MAAM,QAAQ,IAAI,GAAG,OAAO,KAAK,IAAI,MAAM,CAAC,CAAC,KAAK,EAAE;CACxD,IAAIA,QAAM,eAA+C,IAAI,GAAG,OAAO,OAAO,KAAK,MAAM,QAAQ;CACjG,OAAO;AACT;AAEA,SAAS,YAAY,UAA2B,QAAsB;CACpE,QAAM,SAAS,QAAQ,WAAW,UAAU;EAC1C,IAAI,CAACA,QAAM,eAAwG,KAAK,GACtH;EAEF,MAAM,EAAE,OAAO,UAAU,OAAO,OAAO,SAAS,MAAM;EACtD,IAAI,MAAM,SAAS,cAAc,MAAM,SAAS,kBAAkB,MAAM,SAAS,iBAAiB;GAChG,MAAM,OAAO,MAAM,SAAS,kBAAmB,QAAQ,KAAM,OAAO,MAAM,SAAS,iBAA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A0B,WAAU;aAApC,CACE,qBAAC,QAAD;IAAM,WAAU;cAAhB,CACG,MACA,SAAS,QACN;OACL,eACC,oBAAC,QAAD;IAAM,WAAU;cAAiC;GAAkB,EAE7C;IACN;;AAE1B;AASA,SAAS,gBAAgB,EACvB,WACA,MACA,MACA,GAAG,SACoB;CACvB,OACE,qBAACA,SAAgB,MAAjB;EACE,WAAW,GACT,2gBACA,SACF;EACA,aAAU;EACV,GAAI;YANN,CAQF,oBAACA,SAAgB,eAAjB;GACC;GACA,YAAY,UACX,GACC,mHACA,MAAM,WAAW,iCAAiC,mCACnD;aAGI,oBAAC,OAAD;IACE,MAAK;IACL,QAAO;IACP,QAAO;IACP,eAAc;IACd,gBAAe;IACf,aAAY;IACZ,SAAQ;IACR,OAAM;IACN,OAAM;cAEN,oBAAC,QAAD,EAAM,GAAE,qCAAsC;GAC3C;EACwB,IAC/B,qBAACA,SAAgB,UAAjB;GAA0B,WAAU;aAApC,CACE,oBAAC,QAAD;IAAM,WAAU;cAAY;GAAW,IACtC,QACC,oBAAC,QAAD;IAAM,WAAU;cAA0C;GAAW,EAE/C;IACN;;AAE1B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
const require_sheet = require('../sheet-
|
|
4
|
+
const require_sheet = require('../sheet-CGFqOAoI.cjs');
|
|
5
5
|
|
|
6
6
|
exports.SHEET_INDENT = require_sheet.SHEET_INDENT;
|
|
7
7
|
exports.Sheet = require_sheet.Sheet;
|
package/dist/components/sheet.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { a as SheetDescription, c as SheetOverlay, d as SheetTitle, f as SheetTrigger, i as SheetContent, l as SheetPortal, m as useSheetStack, n as Sheet, o as SheetFooter, p as useSheet, r as SheetClose, s as SheetHeader, t as SHEET_INDENT, u as SheetStackProvider } from "../sheet-
|
|
3
|
+
import { a as SheetDescription, c as SheetOverlay, d as SheetTitle, f as SheetTrigger, i as SheetContent, l as SheetPortal, m as useSheetStack, n as Sheet, o as SheetFooter, p as useSheet, r as SheetClose, s as SheetHeader, t as SHEET_INDENT, u as SheetStackProvider } from "../sheet-LOK_d8-K.js";
|
|
4
4
|
|
|
5
5
|
export { SHEET_INDENT, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetStackProvider, SheetTitle, SheetTrigger, useSheet, useSheetStack };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
require('./separator.cjs');
|
|
5
|
-
const require_sidebar = require('../sidebar-
|
|
5
|
+
const require_sidebar = require('../sidebar-Bt7qXsqo.cjs');
|
|
6
6
|
|
|
7
7
|
exports.Sidebar = require_sidebar.Sidebar;
|
|
8
8
|
exports.SidebarContent = require_sidebar.SidebarContent;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import "./separator.js";
|
|
4
|
-
import { C as SidebarTrigger, S as SidebarSeparator, _ as SidebarMenuSub, a as SidebarGroupAction, b as SidebarProvider, c as SidebarHeader, d as SidebarMenu, f as SidebarMenuAction, g as SidebarMenuSkeleton, h as SidebarMenuItem, i as SidebarGroup, l as SidebarInput, m as SidebarMenuButton, n as SidebarContent, o as SidebarGroupContent, p as SidebarMenuBadge, r as SidebarFooter, s as SidebarGroupLabel, t as Sidebar, u as SidebarInset, v as SidebarMenuSubButton, w as useSidebar, x as SidebarRail, y as SidebarMenuSubItem } from "../sidebar-
|
|
4
|
+
import { C as SidebarTrigger, S as SidebarSeparator, _ as SidebarMenuSub, a as SidebarGroupAction, b as SidebarProvider, c as SidebarHeader, d as SidebarMenu, f as SidebarMenuAction, g as SidebarMenuSkeleton, h as SidebarMenuItem, i as SidebarGroup, l as SidebarInput, m as SidebarMenuButton, n as SidebarContent, o as SidebarGroupContent, p as SidebarMenuBadge, r as SidebarFooter, s as SidebarGroupLabel, t as Sidebar, u as SidebarInset, v as SidebarMenuSubButton, w as useSidebar, x as SidebarRail, y as SidebarMenuSubItem } from "../sidebar-BNZkdIvO.js";
|
|
5
5
|
|
|
6
6
|
export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as useStackLayoutMode, A as useIsMobile, B as StackHeaderSlot, C as isCardVisible, D as UsePeekGesturesResult, E as UsePeekGesturesOptions, F as StackCardProps, G as CardStackProvider, H as StackBackdrop, I as UseStackGesturesResult, J as useCardReady, K as useCardIndex, L as useStackGestures, M as DeferredCardContent, N as DeferredCardContentProps, O as usePeekGestures, P as StackCard, Q as useStackContext, R as StackHeader, S as getVisibleCardIndices, T as parseWidthToPixels, U as StackBackdropProps, V as StackHeaderSlotProps, W as CardStackViewport, X as useIsTopCard, Y as useCardStack, Z as useStackCards, _ as getCardOffset, _t as PushOptions, a as createExitTransition, at as CardPushOptions, b as getResponsiveCardOffset, bt as StackState, c as peekDragSpring, ct as CardSpec, d as reducedMotionBackdropVariants, dt as CardStackViewportProps, et as AnimationConfig, f as snapBackSpring, ft as DismissOptions, g as calculateResponsiveOffset, gt as PeekGestureConfig, h as ResponsiveOffsetResult, ht as MobileConfig, i as createEnterTransition, it as CardInjectedProps, j as useStackResponsive, k as UseStackResponsiveResult, l as peekHoverSpring, lt as CardStackApi, m as ResponsiveOffsetConfig, mt as LayoutMode, n as backdropVariants, nt as CardComponent, o as createOffsetTransition, ot as CardRouteDefinition, p as swipeDismissTransition, pt as GestureConfig, q as useCardInjectedProps, r as createCardVariants, rt as CardId, s as createReducedMotionVariants, st as CardRouteMap, t as DEFAULT_ANIMATION_CONFIG, tt as BackdropConfig, u as peekSlideSpring, ut as CardStackProviderProps, v as getCardZIndex, vt as StackAction, w as normalizeWidth, x as getSideBySideOffset, y as getCascadeOffset, yt as StackContextValue, z as StackHeaderProps } from "../../index-
|
|
1
|
+
import { $ as useStackLayoutMode, A as useIsMobile, B as StackHeaderSlot, C as isCardVisible, D as UsePeekGesturesResult, E as UsePeekGesturesOptions, F as StackCardProps, G as CardStackProvider, H as StackBackdrop, I as UseStackGesturesResult, J as useCardReady, K as useCardIndex, L as useStackGestures, M as DeferredCardContent, N as DeferredCardContentProps, O as usePeekGestures, P as StackCard, Q as useStackContext, R as StackHeader, S as getVisibleCardIndices, T as parseWidthToPixels, U as StackBackdropProps, V as StackHeaderSlotProps, W as CardStackViewport, X as useIsTopCard, Y as useCardStack, Z as useStackCards, _ as getCardOffset, _t as PushOptions, a as createExitTransition, at as CardPushOptions, b as getResponsiveCardOffset, bt as StackState, c as peekDragSpring, ct as CardSpec, d as reducedMotionBackdropVariants, dt as CardStackViewportProps, et as AnimationConfig, f as snapBackSpring, ft as DismissOptions, g as calculateResponsiveOffset, gt as PeekGestureConfig, h as ResponsiveOffsetResult, ht as MobileConfig, i as createEnterTransition, it as CardInjectedProps, j as useStackResponsive, k as UseStackResponsiveResult, l as peekHoverSpring, lt as CardStackApi, m as ResponsiveOffsetConfig, mt as LayoutMode, n as backdropVariants, nt as CardComponent, o as createOffsetTransition, ot as CardRouteDefinition, p as swipeDismissTransition, pt as GestureConfig, q as useCardInjectedProps, r as createCardVariants, rt as CardId, s as createReducedMotionVariants, st as CardRouteMap, t as DEFAULT_ANIMATION_CONFIG, tt as BackdropConfig, u as peekSlideSpring, ut as CardStackProviderProps, v as getCardZIndex, vt as StackAction, w as normalizeWidth, x as getSideBySideOffset, y as getCascadeOffset, yt as StackContextValue, z as StackHeaderProps } from "../../index-BzLmDsId.cjs";
|
|
2
2
|
export { type AnimationConfig, type BackdropConfig, type CardComponent, type CardId, type CardInjectedProps, type CardPushOptions, type CardRouteDefinition, type CardRouteMap, type CardSpec, type CardStackApi, CardStackProvider, type CardStackProviderProps, CardStackViewport, type CardStackViewportProps, DEFAULT_ANIMATION_CONFIG, DeferredCardContent, type DeferredCardContentProps, type DismissOptions, type GestureConfig, type LayoutMode, type MobileConfig, type PeekGestureConfig, type PushOptions, type ResponsiveOffsetConfig, type ResponsiveOffsetResult, type StackAction, StackBackdrop, type StackBackdropProps, StackCard, type StackCardProps, type StackContextValue, StackHeader, type StackHeaderProps, StackHeaderSlot, type StackHeaderSlotProps, type StackState, type UsePeekGesturesOptions, type UsePeekGesturesResult, type UseStackGesturesResult, type UseStackResponsiveResult, backdropVariants, calculateResponsiveOffset, createCardVariants, createEnterTransition, createExitTransition, createOffsetTransition, createReducedMotionVariants, getCardOffset, getCardZIndex, getCascadeOffset, getResponsiveCardOffset, getSideBySideOffset, getVisibleCardIndices, isCardVisible, normalizeWidth, parseWidthToPixels, peekDragSpring, peekHoverSpring, peekSlideSpring, reducedMotionBackdropVariants, snapBackSpring, swipeDismissTransition, useCardIndex, useCardInjectedProps, useCardReady, useCardStack, useIsMobile, useIsTopCard, usePeekGestures, useStackCards, useStackContext, useStackGestures, useStackLayoutMode, useStackResponsive };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as useStackLayoutMode, A as useIsMobile, B as StackHeaderSlot, C as isCardVisible, D as UsePeekGesturesResult, E as UsePeekGesturesOptions, F as StackCardProps, G as CardStackProvider, H as StackBackdrop, I as UseStackGesturesResult, J as useCardReady, K as useCardIndex, L as useStackGestures, M as DeferredCardContent, N as DeferredCardContentProps, O as usePeekGestures, P as StackCard, Q as useStackContext, R as StackHeader, S as getVisibleCardIndices, T as parseWidthToPixels, U as StackBackdropProps, V as StackHeaderSlotProps, W as CardStackViewport, X as useIsTopCard, Y as useCardStack, Z as useStackCards, _ as getCardOffset, _t as PushOptions, a as createExitTransition, at as CardPushOptions, b as getResponsiveCardOffset, bt as StackState, c as peekDragSpring, ct as CardSpec, d as reducedMotionBackdropVariants, dt as CardStackViewportProps, et as AnimationConfig, f as snapBackSpring, ft as DismissOptions, g as calculateResponsiveOffset, gt as PeekGestureConfig, h as ResponsiveOffsetResult, ht as MobileConfig, i as createEnterTransition, it as CardInjectedProps, j as useStackResponsive, k as UseStackResponsiveResult, l as peekHoverSpring, lt as CardStackApi, m as ResponsiveOffsetConfig, mt as LayoutMode, n as backdropVariants, nt as CardComponent, o as createOffsetTransition, ot as CardRouteDefinition, p as swipeDismissTransition, pt as GestureConfig, q as useCardInjectedProps, r as createCardVariants, rt as CardId, s as createReducedMotionVariants, st as CardRouteMap, t as DEFAULT_ANIMATION_CONFIG, tt as BackdropConfig, u as peekSlideSpring, ut as CardStackProviderProps, v as getCardZIndex, vt as StackAction, w as normalizeWidth, x as getSideBySideOffset, y as getCascadeOffset, yt as StackContextValue, z as StackHeaderProps } from "../../index-
|
|
1
|
+
import { $ as useStackLayoutMode, A as useIsMobile, B as StackHeaderSlot, C as isCardVisible, D as UsePeekGesturesResult, E as UsePeekGesturesOptions, F as StackCardProps, G as CardStackProvider, H as StackBackdrop, I as UseStackGesturesResult, J as useCardReady, K as useCardIndex, L as useStackGestures, M as DeferredCardContent, N as DeferredCardContentProps, O as usePeekGestures, P as StackCard, Q as useStackContext, R as StackHeader, S as getVisibleCardIndices, T as parseWidthToPixels, U as StackBackdropProps, V as StackHeaderSlotProps, W as CardStackViewport, X as useIsTopCard, Y as useCardStack, Z as useStackCards, _ as getCardOffset, _t as PushOptions, a as createExitTransition, at as CardPushOptions, b as getResponsiveCardOffset, bt as StackState, c as peekDragSpring, ct as CardSpec, d as reducedMotionBackdropVariants, dt as CardStackViewportProps, et as AnimationConfig, f as snapBackSpring, ft as DismissOptions, g as calculateResponsiveOffset, gt as PeekGestureConfig, h as ResponsiveOffsetResult, ht as MobileConfig, i as createEnterTransition, it as CardInjectedProps, j as useStackResponsive, k as UseStackResponsiveResult, l as peekHoverSpring, lt as CardStackApi, m as ResponsiveOffsetConfig, mt as LayoutMode, n as backdropVariants, nt as CardComponent, o as createOffsetTransition, ot as CardRouteDefinition, p as swipeDismissTransition, pt as GestureConfig, q as useCardInjectedProps, r as createCardVariants, rt as CardId, s as createReducedMotionVariants, st as CardRouteMap, t as DEFAULT_ANIMATION_CONFIG, tt as BackdropConfig, u as peekSlideSpring, ut as CardStackProviderProps, v as getCardZIndex, vt as StackAction, w as normalizeWidth, x as getSideBySideOffset, y as getCascadeOffset, yt as StackContextValue, z as StackHeaderProps } from "../../index-BzLmDsId.js";
|
|
2
2
|
export { type AnimationConfig, type BackdropConfig, type CardComponent, type CardId, type CardInjectedProps, type CardPushOptions, type CardRouteDefinition, type CardRouteMap, type CardSpec, type CardStackApi, CardStackProvider, type CardStackProviderProps, CardStackViewport, type CardStackViewportProps, DEFAULT_ANIMATION_CONFIG, DeferredCardContent, type DeferredCardContentProps, type DismissOptions, type GestureConfig, type LayoutMode, type MobileConfig, type PeekGestureConfig, type PushOptions, type ResponsiveOffsetConfig, type ResponsiveOffsetResult, type StackAction, StackBackdrop, type StackBackdropProps, StackCard, type StackCardProps, type StackContextValue, StackHeader, type StackHeaderProps, StackHeaderSlot, type StackHeaderSlotProps, type StackState, type UsePeekGesturesOptions, type UsePeekGesturesResult, type UseStackGesturesResult, type UseStackResponsiveResult, backdropVariants, calculateResponsiveOffset, createCardVariants, createEnterTransition, createExitTransition, createOffsetTransition, createReducedMotionVariants, getCardOffset, getCardZIndex, getCascadeOffset, getResponsiveCardOffset, getSideBySideOffset, getVisibleCardIndices, isCardVisible, normalizeWidth, parseWidthToPixels, peekDragSpring, peekHoverSpring, peekSlideSpring, reducedMotionBackdropVariants, snapBackSpring, swipeDismissTransition, useCardIndex, useCardInjectedProps, useCardReady, useCardStack, useIsMobile, useIsTopCard, usePeekGestures, useStackCards, useStackContext, useStackGestures, useStackLayoutMode, useStackResponsive };
|
|
@@ -5,7 +5,7 @@ const require_rolldown_runtime = require('../rolldown-runtime-D_qnwXdH.cjs');
|
|
|
5
5
|
const require_utils = require('../utils-CzTQ3-VI.cjs');
|
|
6
6
|
const require_text_runs = require('../text-runs-CdmlS5C7.cjs');
|
|
7
7
|
const require_components_toggle = require('./toggle.cjs');
|
|
8
|
-
const require_fluid_highlight = require('../fluid-highlight-
|
|
8
|
+
const require_fluid_highlight = require('../fluid-highlight-B8olepSM.cjs');
|
|
9
9
|
let react = require("react");
|
|
10
10
|
react = require_rolldown_runtime.__toESM(react, 1);
|
|
11
11
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -44,9 +44,13 @@ function ToggleGroup({ className, variant = "default", size = "default", spacing
|
|
|
44
44
|
className: require_utils.cn("group/toggle-group relative inline-flex max-w-full flex-wrap items-center outline-none", "data-[orientation=vertical]:flex-col", spacing > 0 && "data-[orientation=horizontal]:gap-1 data-[orientation=vertical]:gap-1", className),
|
|
45
45
|
...props,
|
|
46
46
|
children: [multiple ? null : spacing === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_fluid_highlight.FluidHighlight, {
|
|
47
|
+
travel: true,
|
|
47
48
|
inset: 2,
|
|
48
49
|
className: "rounded-sm"
|
|
49
|
-
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_fluid_highlight.FluidHighlight, {
|
|
50
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_fluid_highlight.FluidHighlight, {
|
|
51
|
+
travel: true,
|
|
52
|
+
className: "rounded-md"
|
|
53
|
+
}), children]
|
|
50
54
|
})
|
|
51
55
|
});
|
|
52
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle-group.cjs","names":["React","ToggleGroupPrimitive","cn","FluidHighlight","TogglePrimitive","toggleVariants","truncateTextRuns"],"sources":["../../src/components/toggle-group.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Toggle as TogglePrimitive } from '@base-ui/react/toggle';\nimport { ToggleGroup as ToggleGroupPrimitive } from '@base-ui/react/toggle-group';\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nimport { truncateTextRuns } from '../lib/text-runs';\nimport { cn } from '../lib/utils';\nimport { FluidHighlight } from '../lib/motion/fluid-highlight';\nimport { toggleVariants } from './toggle';\n\nconst ToggleGroupContext = React.createContext<{\n\tvariant: VariantProps<typeof toggleVariants>['variant'];\n\tsize: VariantProps<typeof toggleVariants>['size'];\n\tspacing: number;\n\tmultiple: boolean;\n}>({ variant: 'default', size: 'default', spacing: 0, multiple: false });\n\n/**\n * Toggle group. `spacing={0}` (default) renders an attached group — items share\n * borders and only the outer corners keep the radius. `spacing>0` gaps the\n * items so each keeps full rounding. Single-select mode slides a\n * `FluidHighlight` pill under the pressed item; in `multiple` each item paints\n * its own accent fill.\n */\nfunction ToggleGroup({\n\tclassName,\n\tvariant = 'default',\n\tsize = 'default',\n\tspacing = 0,\n\tmultiple = false,\n\tchildren,\n\t...props\n}: React.ComponentProps<typeof ToggleGroupPrimitive> & {\n\tvariant?: VariantProps<typeof toggleVariants>['variant'];\n\tsize?: VariantProps<typeof toggleVariants>['size'];\n\tspacing?: number;\n}) {\n\treturn (\n\t\t<ToggleGroupContext.Provider value={{ variant, size, spacing, multiple }}>\n\t\t\t<ToggleGroupPrimitive\n\t\t\t\tdata-slot=\"toggle-group\"\n\t\t\t\tdata-variant={variant}\n\t\t\t\tdata-size={size}\n\t\t\t\tdata-spacing={spacing}\n\t\t\t\tdata-multiple={multiple || undefined}\n\t\t\t\tmultiple={multiple}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t// `max-w-full flex-wrap`: a long row of labels wraps inside its container instead of widening the page.\n\t\t\t\t\t'group/toggle-group relative inline-flex max-w-full flex-wrap items-center outline-none',\n\t\t\t\t\t'data-[orientation=vertical]:flex-col',\n\t\t\t\t\tspacing > 0 && 'data-[orientation=horizontal]:gap-1 data-[orientation=vertical]:gap-1',\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{multiple ? null : spacing === 0 ? (\n\t\t\t\t\t<FluidHighlight inset={2} className=\"rounded-sm\" />\n\t\t\t\t) : (\n\t\t\t\t\t<FluidHighlight className=\"rounded-md\" />\n\t\t\t\t)}\n\t\t\t\t{children}\n\t\t\t</ToggleGroupPrimitive>\n\t\t</ToggleGroupContext.Provider>\n\t);\n}\n\nfunction ToggleGroupItem({\n\tclassName,\n\tvariant,\n\tsize,\n\tchildren,\n\t...props\n}: React.ComponentProps<typeof TogglePrimitive> & {\n\tvariant?: VariantProps<typeof toggleVariants>['variant'];\n\tsize?: VariantProps<typeof toggleVariants>['size'];\n}) {\n\tconst context = React.useContext(ToggleGroupContext);\n\treturn (\n\t\t<TogglePrimitive\n\t\t\tdata-slot=\"toggle-group-item\"\n\t\t\tclassName={cn(\n\t\t\t\ttoggleVariants({\n\t\t\t\t\tvariant: variant ?? context.variant,\n\t\t\t\t\tsize: size ?? context.size,\n\t\t\t\t}),\n\t\t\t\t'relative shrink-0',\n\t\t\t\t// Attached group (spacing 0): collapse shared borders, square the\n\t\t\t\t// inner corners, keep the outer radius on the first/last item.\n\t\t\t\t// The orientation lives on the group root, not on the items, so these read it from the group. The sliding\n\t\t\t\t// highlight is the group's first child, which is why the ends are `*-of-type` (the items), not `first`/`last`.\n\t\t\t\t'group-data-[spacing=0]/toggle-group:rounded-none',\n\t\t\t\t'group-data-[spacing=0]/toggle-group:group-data-[orientation=horizontal]/toggle-group:-ms-px',\n\t\t\t\t'group-data-[spacing=0]/toggle-group:group-data-[orientation=horizontal]/toggle-group:first-of-type:ms-0 group-data-[spacing=0]/toggle-group:group-data-[orientation=horizontal]/toggle-group:first-of-type:rounded-s-md group-data-[spacing=0]/toggle-group:group-data-[orientation=horizontal]/toggle-group:last-of-type:rounded-e-md',\n\t\t\t\t'group-data-[spacing=0]/toggle-group:group-data-[orientation=vertical]/toggle-group:-mt-px',\n\t\t\t\t'group-data-[spacing=0]/toggle-group:group-data-[orientation=vertical]/toggle-group:first-of-type:mt-0 group-data-[spacing=0]/toggle-group:group-data-[orientation=vertical]/toggle-group:first-of-type:rounded-t-md group-data-[spacing=0]/toggle-group:group-data-[orientation=vertical]/toggle-group:last-of-type:rounded-b-md',\n\t\t\t\t'focus-visible:z-10',\n\t\t\t\t// In single-select the FluidHighlight pill supplies the fill; in\n\t\t\t\t// multiple each item paints its own pressed background.\n\t\t\t\t'group-data-[multiple]/toggle-group:data-[pressed]:bg-accent',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{truncateTextRuns(children).nodes}\n\t\t</TogglePrimitive>\n\t);\n}\n\nexport { ToggleGroup, ToggleGroupItem };\nexport type ToggleGroupProps = React.ComponentProps<typeof ToggleGroupPrimitive>;\nexport type ToggleGroupItemProps = React.ComponentProps<typeof TogglePrimitive>;\n"],"mappings":";;;;;;;;;;;;;;;AAYA,MAAM,qBAAqBA,MAAM,cAK9B;CAAE,SAAS;CAAW,MAAM;CAAW,SAAS;CAAG,UAAU;AAAM,CAAC;;;;;;;;AASvE,SAAS,YAAY,EACpB,WACA,UAAU,WACV,OAAO,WACP,UAAU,GACV,WAAW,OACX,UACA,GAAG,SAKD;CACF,OACC,2CAAC,mBAAmB,UAApB;EAA6B,OAAO;GAAE;GAAS;GAAM;GAAS;EAAS;YACtE,4CAACC,yCAAD;GACC,aAAU;GACV,gBAAc;GACd,aAAW;GACX,gBAAc;GACd,iBAAe,YAAY;GACjB;GACV,WAAWC,iBAEV,0FACA,wCACA,UAAU,KAAK,yEACf,SACD;GACA,GAAI;aAdL,CAgBE,WAAW,OAAO,YAAY,IAC9B,2CAACC,wCAAD;IAAgB,OAAO;IAAG,WAAU;GAAc,
|
|
1
|
+
{"version":3,"file":"toggle-group.cjs","names":["React","ToggleGroupPrimitive","cn","FluidHighlight","TogglePrimitive","toggleVariants","truncateTextRuns"],"sources":["../../src/components/toggle-group.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Toggle as TogglePrimitive } from '@base-ui/react/toggle';\nimport { ToggleGroup as ToggleGroupPrimitive } from '@base-ui/react/toggle-group';\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nimport { truncateTextRuns } from '../lib/text-runs';\nimport { cn } from '../lib/utils';\nimport { FluidHighlight } from '../lib/motion/fluid-highlight';\nimport { toggleVariants } from './toggle';\n\nconst ToggleGroupContext = React.createContext<{\n\tvariant: VariantProps<typeof toggleVariants>['variant'];\n\tsize: VariantProps<typeof toggleVariants>['size'];\n\tspacing: number;\n\tmultiple: boolean;\n}>({ variant: 'default', size: 'default', spacing: 0, multiple: false });\n\n/**\n * Toggle group. `spacing={0}` (default) renders an attached group — items share\n * borders and only the outer corners keep the radius. `spacing>0` gaps the\n * items so each keeps full rounding. Single-select mode slides a\n * `FluidHighlight` pill under the pressed item; in `multiple` each item paints\n * its own accent fill.\n */\nfunction ToggleGroup({\n\tclassName,\n\tvariant = 'default',\n\tsize = 'default',\n\tspacing = 0,\n\tmultiple = false,\n\tchildren,\n\t...props\n}: React.ComponentProps<typeof ToggleGroupPrimitive> & {\n\tvariant?: VariantProps<typeof toggleVariants>['variant'];\n\tsize?: VariantProps<typeof toggleVariants>['size'];\n\tspacing?: number;\n}) {\n\treturn (\n\t\t<ToggleGroupContext.Provider value={{ variant, size, spacing, multiple }}>\n\t\t\t<ToggleGroupPrimitive\n\t\t\t\tdata-slot=\"toggle-group\"\n\t\t\t\tdata-variant={variant}\n\t\t\t\tdata-size={size}\n\t\t\t\tdata-spacing={spacing}\n\t\t\t\tdata-multiple={multiple || undefined}\n\t\t\t\tmultiple={multiple}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t// `max-w-full flex-wrap`: a long row of labels wraps inside its container instead of widening the page.\n\t\t\t\t\t'group/toggle-group relative inline-flex max-w-full flex-wrap items-center outline-none',\n\t\t\t\t\t'data-[orientation=vertical]:flex-col',\n\t\t\t\t\tspacing > 0 && 'data-[orientation=horizontal]:gap-1 data-[orientation=vertical]:gap-1',\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{multiple ? null : spacing === 0 ? (\n\t\t\t\t\t<FluidHighlight travel inset={2} className=\"rounded-sm\" />\n\t\t\t\t) : (\n\t\t\t\t\t<FluidHighlight travel className=\"rounded-md\" />\n\t\t\t\t)}\n\t\t\t\t{children}\n\t\t\t</ToggleGroupPrimitive>\n\t\t</ToggleGroupContext.Provider>\n\t);\n}\n\nfunction ToggleGroupItem({\n\tclassName,\n\tvariant,\n\tsize,\n\tchildren,\n\t...props\n}: React.ComponentProps<typeof TogglePrimitive> & {\n\tvariant?: VariantProps<typeof toggleVariants>['variant'];\n\tsize?: VariantProps<typeof toggleVariants>['size'];\n}) {\n\tconst context = React.useContext(ToggleGroupContext);\n\treturn (\n\t\t<TogglePrimitive\n\t\t\tdata-slot=\"toggle-group-item\"\n\t\t\tclassName={cn(\n\t\t\t\ttoggleVariants({\n\t\t\t\t\tvariant: variant ?? context.variant,\n\t\t\t\t\tsize: size ?? context.size,\n\t\t\t\t}),\n\t\t\t\t'relative shrink-0',\n\t\t\t\t// Attached group (spacing 0): collapse shared borders, square the\n\t\t\t\t// inner corners, keep the outer radius on the first/last item.\n\t\t\t\t// The orientation lives on the group root, not on the items, so these read it from the group. The sliding\n\t\t\t\t// highlight is the group's first child, which is why the ends are `*-of-type` (the items), not `first`/`last`.\n\t\t\t\t'group-data-[spacing=0]/toggle-group:rounded-none',\n\t\t\t\t'group-data-[spacing=0]/toggle-group:group-data-[orientation=horizontal]/toggle-group:-ms-px',\n\t\t\t\t'group-data-[spacing=0]/toggle-group:group-data-[orientation=horizontal]/toggle-group:first-of-type:ms-0 group-data-[spacing=0]/toggle-group:group-data-[orientation=horizontal]/toggle-group:first-of-type:rounded-s-md group-data-[spacing=0]/toggle-group:group-data-[orientation=horizontal]/toggle-group:last-of-type:rounded-e-md',\n\t\t\t\t'group-data-[spacing=0]/toggle-group:group-data-[orientation=vertical]/toggle-group:-mt-px',\n\t\t\t\t'group-data-[spacing=0]/toggle-group:group-data-[orientation=vertical]/toggle-group:first-of-type:mt-0 group-data-[spacing=0]/toggle-group:group-data-[orientation=vertical]/toggle-group:first-of-type:rounded-t-md group-data-[spacing=0]/toggle-group:group-data-[orientation=vertical]/toggle-group:last-of-type:rounded-b-md',\n\t\t\t\t'focus-visible:z-10',\n\t\t\t\t// In single-select the FluidHighlight pill supplies the fill; in\n\t\t\t\t// multiple each item paints its own pressed background.\n\t\t\t\t'group-data-[multiple]/toggle-group:data-[pressed]:bg-accent',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{truncateTextRuns(children).nodes}\n\t\t</TogglePrimitive>\n\t);\n}\n\nexport { ToggleGroup, ToggleGroupItem };\nexport type ToggleGroupProps = React.ComponentProps<typeof ToggleGroupPrimitive>;\nexport type ToggleGroupItemProps = React.ComponentProps<typeof TogglePrimitive>;\n"],"mappings":";;;;;;;;;;;;;;;AAYA,MAAM,qBAAqBA,MAAM,cAK9B;CAAE,SAAS;CAAW,MAAM;CAAW,SAAS;CAAG,UAAU;AAAM,CAAC;;;;;;;;AASvE,SAAS,YAAY,EACpB,WACA,UAAU,WACV,OAAO,WACP,UAAU,GACV,WAAW,OACX,UACA,GAAG,SAKD;CACF,OACC,2CAAC,mBAAmB,UAApB;EAA6B,OAAO;GAAE;GAAS;GAAM;GAAS;EAAS;YACtE,4CAACC,yCAAD;GACC,aAAU;GACV,gBAAc;GACd,aAAW;GACX,gBAAc;GACd,iBAAe,YAAY;GACjB;GACV,WAAWC,iBAEV,0FACA,wCACA,UAAU,KAAK,yEACf,SACD;GACA,GAAI;aAdL,CAgBE,WAAW,OAAO,YAAY,IAC9B,2CAACC,wCAAD;IAAgB;IAAO,OAAO;IAAG,WAAU;GAAc,KAEzD,2CAACA,wCAAD;IAAgB;IAAO,WAAU;GAAc,IAE/C,QACoB;;CACM;AAE/B;AAEA,SAAS,gBAAgB,EACxB,WACA,SACA,MACA,UACA,GAAG,SAID;CACF,MAAM,UAAUH,MAAM,WAAW,kBAAkB;CACnD,OACC,2CAACI,8BAAD;EACC,aAAU;EACV,WAAWF,iBACVG,yCAAe;GACd,SAAS,WAAW,QAAQ;GAC5B,MAAM,QAAQ,QAAQ;EACvB,CAAC,GACD,qBAKA,oDACA,+FACA,0UACA,6FACA,oUACA,sBAGA,+DACA,SACD;EACA,GAAI;YAEHC,mCAAiB,QAAQ,CAAC,CAAC;CACZ;AAEnB"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { t as cn } from "../utils-BkMLyah9.js";
|
|
4
4
|
import { t as truncateTextRuns } from "../text-runs-DqcEO8L_.js";
|
|
5
5
|
import { toggleVariants } from "./toggle.js";
|
|
6
|
-
import { t as FluidHighlight } from "../fluid-highlight-
|
|
6
|
+
import { t as FluidHighlight } from "../fluid-highlight-BXVfWNk9.js";
|
|
7
7
|
import * as React$1 from "react";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { Toggle } from "@base-ui/react/toggle";
|
|
@@ -41,9 +41,13 @@ function ToggleGroup({ className, variant = "default", size = "default", spacing
|
|
|
41
41
|
className: cn("group/toggle-group relative inline-flex max-w-full flex-wrap items-center outline-none", "data-[orientation=vertical]:flex-col", spacing > 0 && "data-[orientation=horizontal]:gap-1 data-[orientation=vertical]:gap-1", className),
|
|
42
42
|
...props,
|
|
43
43
|
children: [multiple ? null : spacing === 0 ? /* @__PURE__ */ jsx(FluidHighlight, {
|
|
44
|
+
travel: true,
|
|
44
45
|
inset: 2,
|
|
45
46
|
className: "rounded-sm"
|
|
46
|
-
}) : /* @__PURE__ */ jsx(FluidHighlight, {
|
|
47
|
+
}) : /* @__PURE__ */ jsx(FluidHighlight, {
|
|
48
|
+
travel: true,
|
|
49
|
+
className: "rounded-md"
|
|
50
|
+
}), children]
|
|
47
51
|
})
|
|
48
52
|
});
|
|
49
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle-group.js","names":["React","ToggleGroupPrimitive","TogglePrimitive"],"sources":["../../src/components/toggle-group.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Toggle as TogglePrimitive } from '@base-ui/react/toggle';\nimport { ToggleGroup as ToggleGroupPrimitive } from '@base-ui/react/toggle-group';\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nimport { truncateTextRuns } from '../lib/text-runs';\nimport { cn } from '../lib/utils';\nimport { FluidHighlight } from '../lib/motion/fluid-highlight';\nimport { toggleVariants } from './toggle';\n\nconst ToggleGroupContext = React.createContext<{\n\tvariant: VariantProps<typeof toggleVariants>['variant'];\n\tsize: VariantProps<typeof toggleVariants>['size'];\n\tspacing: number;\n\tmultiple: boolean;\n}>({ variant: 'default', size: 'default', spacing: 0, multiple: false });\n\n/**\n * Toggle group. `spacing={0}` (default) renders an attached group — items share\n * borders and only the outer corners keep the radius. `spacing>0` gaps the\n * items so each keeps full rounding. Single-select mode slides a\n * `FluidHighlight` pill under the pressed item; in `multiple` each item paints\n * its own accent fill.\n */\nfunction ToggleGroup({\n\tclassName,\n\tvariant = 'default',\n\tsize = 'default',\n\tspacing = 0,\n\tmultiple = false,\n\tchildren,\n\t...props\n}: React.ComponentProps<typeof ToggleGroupPrimitive> & {\n\tvariant?: VariantProps<typeof toggleVariants>['variant'];\n\tsize?: VariantProps<typeof toggleVariants>['size'];\n\tspacing?: number;\n}) {\n\treturn (\n\t\t<ToggleGroupContext.Provider value={{ variant, size, spacing, multiple }}>\n\t\t\t<ToggleGroupPrimitive\n\t\t\t\tdata-slot=\"toggle-group\"\n\t\t\t\tdata-variant={variant}\n\t\t\t\tdata-size={size}\n\t\t\t\tdata-spacing={spacing}\n\t\t\t\tdata-multiple={multiple || undefined}\n\t\t\t\tmultiple={multiple}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t// `max-w-full flex-wrap`: a long row of labels wraps inside its container instead of widening the page.\n\t\t\t\t\t'group/toggle-group relative inline-flex max-w-full flex-wrap items-center outline-none',\n\t\t\t\t\t'data-[orientation=vertical]:flex-col',\n\t\t\t\t\tspacing > 0 && 'data-[orientation=horizontal]:gap-1 data-[orientation=vertical]:gap-1',\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{multiple ? null : spacing === 0 ? (\n\t\t\t\t\t<FluidHighlight inset={2} className=\"rounded-sm\" />\n\t\t\t\t) : (\n\t\t\t\t\t<FluidHighlight className=\"rounded-md\" />\n\t\t\t\t)}\n\t\t\t\t{children}\n\t\t\t</ToggleGroupPrimitive>\n\t\t</ToggleGroupContext.Provider>\n\t);\n}\n\nfunction ToggleGroupItem({\n\tclassName,\n\tvariant,\n\tsize,\n\tchildren,\n\t...props\n}: React.ComponentProps<typeof TogglePrimitive> & {\n\tvariant?: VariantProps<typeof toggleVariants>['variant'];\n\tsize?: VariantProps<typeof toggleVariants>['size'];\n}) {\n\tconst context = React.useContext(ToggleGroupContext);\n\treturn (\n\t\t<TogglePrimitive\n\t\t\tdata-slot=\"toggle-group-item\"\n\t\t\tclassName={cn(\n\t\t\t\ttoggleVariants({\n\t\t\t\t\tvariant: variant ?? context.variant,\n\t\t\t\t\tsize: size ?? context.size,\n\t\t\t\t}),\n\t\t\t\t'relative shrink-0',\n\t\t\t\t// Attached group (spacing 0): collapse shared borders, square the\n\t\t\t\t// inner corners, keep the outer radius on the first/last item.\n\t\t\t\t// The orientation lives on the group root, not on the items, so these read it from the group. The sliding\n\t\t\t\t// highlight is the group's first child, which is why the ends are `*-of-type` (the items), not `first`/`last`.\n\t\t\t\t'group-data-[spacing=0]/toggle-group:rounded-none',\n\t\t\t\t'group-data-[spacing=0]/toggle-group:group-data-[orientation=horizontal]/toggle-group:-ms-px',\n\t\t\t\t'group-data-[spacing=0]/toggle-group:group-data-[orientation=horizontal]/toggle-group:first-of-type:ms-0 group-data-[spacing=0]/toggle-group:group-data-[orientation=horizontal]/toggle-group:first-of-type:rounded-s-md group-data-[spacing=0]/toggle-group:group-data-[orientation=horizontal]/toggle-group:last-of-type:rounded-e-md',\n\t\t\t\t'group-data-[spacing=0]/toggle-group:group-data-[orientation=vertical]/toggle-group:-mt-px',\n\t\t\t\t'group-data-[spacing=0]/toggle-group:group-data-[orientation=vertical]/toggle-group:first-of-type:mt-0 group-data-[spacing=0]/toggle-group:group-data-[orientation=vertical]/toggle-group:first-of-type:rounded-t-md group-data-[spacing=0]/toggle-group:group-data-[orientation=vertical]/toggle-group:last-of-type:rounded-b-md',\n\t\t\t\t'focus-visible:z-10',\n\t\t\t\t// In single-select the FluidHighlight pill supplies the fill; in\n\t\t\t\t// multiple each item paints its own pressed background.\n\t\t\t\t'group-data-[multiple]/toggle-group:data-[pressed]:bg-accent',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{truncateTextRuns(children).nodes}\n\t\t</TogglePrimitive>\n\t);\n}\n\nexport { ToggleGroup, ToggleGroupItem };\nexport type ToggleGroupProps = React.ComponentProps<typeof ToggleGroupPrimitive>;\nexport type ToggleGroupItemProps = React.ComponentProps<typeof TogglePrimitive>;\n"],"mappings":";;;;;;;;;;;;AAYA,MAAM,qBAAqBA,QAAM,cAK9B;CAAE,SAAS;CAAW,MAAM;CAAW,SAAS;CAAG,UAAU;AAAM,CAAC;;;;;;;;AASvE,SAAS,YAAY,EACpB,WACA,UAAU,WACV,OAAO,WACP,UAAU,GACV,WAAW,OACX,UACA,GAAG,SAKD;CACF,OACC,oBAAC,mBAAmB,UAApB;EAA6B,OAAO;GAAE;GAAS;GAAM;GAAS;EAAS;YACtE,qBAACC,eAAD;GACC,aAAU;GACV,gBAAc;GACd,aAAW;GACX,gBAAc;GACd,iBAAe,YAAY;GACjB;GACV,WAAW,GAEV,0FACA,wCACA,UAAU,KAAK,yEACf,SACD;GACA,GAAI;aAdL,CAgBE,WAAW,OAAO,YAAY,IAC9B,oBAAC,gBAAD;IAAgB,OAAO;IAAG,WAAU;GAAc,
|
|
1
|
+
{"version":3,"file":"toggle-group.js","names":["React","ToggleGroupPrimitive","TogglePrimitive"],"sources":["../../src/components/toggle-group.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Toggle as TogglePrimitive } from '@base-ui/react/toggle';\nimport { ToggleGroup as ToggleGroupPrimitive } from '@base-ui/react/toggle-group';\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nimport { truncateTextRuns } from '../lib/text-runs';\nimport { cn } from '../lib/utils';\nimport { FluidHighlight } from '../lib/motion/fluid-highlight';\nimport { toggleVariants } from './toggle';\n\nconst ToggleGroupContext = React.createContext<{\n\tvariant: VariantProps<typeof toggleVariants>['variant'];\n\tsize: VariantProps<typeof toggleVariants>['size'];\n\tspacing: number;\n\tmultiple: boolean;\n}>({ variant: 'default', size: 'default', spacing: 0, multiple: false });\n\n/**\n * Toggle group. `spacing={0}` (default) renders an attached group — items share\n * borders and only the outer corners keep the radius. `spacing>0` gaps the\n * items so each keeps full rounding. Single-select mode slides a\n * `FluidHighlight` pill under the pressed item; in `multiple` each item paints\n * its own accent fill.\n */\nfunction ToggleGroup({\n\tclassName,\n\tvariant = 'default',\n\tsize = 'default',\n\tspacing = 0,\n\tmultiple = false,\n\tchildren,\n\t...props\n}: React.ComponentProps<typeof ToggleGroupPrimitive> & {\n\tvariant?: VariantProps<typeof toggleVariants>['variant'];\n\tsize?: VariantProps<typeof toggleVariants>['size'];\n\tspacing?: number;\n}) {\n\treturn (\n\t\t<ToggleGroupContext.Provider value={{ variant, size, spacing, multiple }}>\n\t\t\t<ToggleGroupPrimitive\n\t\t\t\tdata-slot=\"toggle-group\"\n\t\t\t\tdata-variant={variant}\n\t\t\t\tdata-size={size}\n\t\t\t\tdata-spacing={spacing}\n\t\t\t\tdata-multiple={multiple || undefined}\n\t\t\t\tmultiple={multiple}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t// `max-w-full flex-wrap`: a long row of labels wraps inside its container instead of widening the page.\n\t\t\t\t\t'group/toggle-group relative inline-flex max-w-full flex-wrap items-center outline-none',\n\t\t\t\t\t'data-[orientation=vertical]:flex-col',\n\t\t\t\t\tspacing > 0 && 'data-[orientation=horizontal]:gap-1 data-[orientation=vertical]:gap-1',\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{multiple ? null : spacing === 0 ? (\n\t\t\t\t\t<FluidHighlight travel inset={2} className=\"rounded-sm\" />\n\t\t\t\t) : (\n\t\t\t\t\t<FluidHighlight travel className=\"rounded-md\" />\n\t\t\t\t)}\n\t\t\t\t{children}\n\t\t\t</ToggleGroupPrimitive>\n\t\t</ToggleGroupContext.Provider>\n\t);\n}\n\nfunction ToggleGroupItem({\n\tclassName,\n\tvariant,\n\tsize,\n\tchildren,\n\t...props\n}: React.ComponentProps<typeof TogglePrimitive> & {\n\tvariant?: VariantProps<typeof toggleVariants>['variant'];\n\tsize?: VariantProps<typeof toggleVariants>['size'];\n}) {\n\tconst context = React.useContext(ToggleGroupContext);\n\treturn (\n\t\t<TogglePrimitive\n\t\t\tdata-slot=\"toggle-group-item\"\n\t\t\tclassName={cn(\n\t\t\t\ttoggleVariants({\n\t\t\t\t\tvariant: variant ?? context.variant,\n\t\t\t\t\tsize: size ?? context.size,\n\t\t\t\t}),\n\t\t\t\t'relative shrink-0',\n\t\t\t\t// Attached group (spacing 0): collapse shared borders, square the\n\t\t\t\t// inner corners, keep the outer radius on the first/last item.\n\t\t\t\t// The orientation lives on the group root, not on the items, so these read it from the group. The sliding\n\t\t\t\t// highlight is the group's first child, which is why the ends are `*-of-type` (the items), not `first`/`last`.\n\t\t\t\t'group-data-[spacing=0]/toggle-group:rounded-none',\n\t\t\t\t'group-data-[spacing=0]/toggle-group:group-data-[orientation=horizontal]/toggle-group:-ms-px',\n\t\t\t\t'group-data-[spacing=0]/toggle-group:group-data-[orientation=horizontal]/toggle-group:first-of-type:ms-0 group-data-[spacing=0]/toggle-group:group-data-[orientation=horizontal]/toggle-group:first-of-type:rounded-s-md group-data-[spacing=0]/toggle-group:group-data-[orientation=horizontal]/toggle-group:last-of-type:rounded-e-md',\n\t\t\t\t'group-data-[spacing=0]/toggle-group:group-data-[orientation=vertical]/toggle-group:-mt-px',\n\t\t\t\t'group-data-[spacing=0]/toggle-group:group-data-[orientation=vertical]/toggle-group:first-of-type:mt-0 group-data-[spacing=0]/toggle-group:group-data-[orientation=vertical]/toggle-group:first-of-type:rounded-t-md group-data-[spacing=0]/toggle-group:group-data-[orientation=vertical]/toggle-group:last-of-type:rounded-b-md',\n\t\t\t\t'focus-visible:z-10',\n\t\t\t\t// In single-select the FluidHighlight pill supplies the fill; in\n\t\t\t\t// multiple each item paints its own pressed background.\n\t\t\t\t'group-data-[multiple]/toggle-group:data-[pressed]:bg-accent',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{truncateTextRuns(children).nodes}\n\t\t</TogglePrimitive>\n\t);\n}\n\nexport { ToggleGroup, ToggleGroupItem };\nexport type ToggleGroupProps = React.ComponentProps<typeof ToggleGroupPrimitive>;\nexport type ToggleGroupItemProps = React.ComponentProps<typeof TogglePrimitive>;\n"],"mappings":";;;;;;;;;;;;AAYA,MAAM,qBAAqBA,QAAM,cAK9B;CAAE,SAAS;CAAW,MAAM;CAAW,SAAS;CAAG,UAAU;AAAM,CAAC;;;;;;;;AASvE,SAAS,YAAY,EACpB,WACA,UAAU,WACV,OAAO,WACP,UAAU,GACV,WAAW,OACX,UACA,GAAG,SAKD;CACF,OACC,oBAAC,mBAAmB,UAApB;EAA6B,OAAO;GAAE;GAAS;GAAM;GAAS;EAAS;YACtE,qBAACC,eAAD;GACC,aAAU;GACV,gBAAc;GACd,aAAW;GACX,gBAAc;GACd,iBAAe,YAAY;GACjB;GACV,WAAW,GAEV,0FACA,wCACA,UAAU,KAAK,yEACf,SACD;GACA,GAAI;aAdL,CAgBE,WAAW,OAAO,YAAY,IAC9B,oBAAC,gBAAD;IAAgB;IAAO,OAAO;IAAG,WAAU;GAAc,KAEzD,oBAAC,gBAAD;IAAgB;IAAO,WAAU;GAAc,IAE/C,QACoB;;CACM;AAE/B;AAEA,SAAS,gBAAgB,EACxB,WACA,SACA,MACA,UACA,GAAG,SAID;CACF,MAAM,UAAUD,QAAM,WAAW,kBAAkB;CACnD,OACC,oBAACE,QAAD;EACC,aAAU;EACV,WAAW,GACV,eAAe;GACd,SAAS,WAAW,QAAQ;GAC5B,MAAM,QAAQ,QAAQ;EACvB,CAAC,GACD,qBAKA,oDACA,+FACA,0UACA,6FACA,oUACA,sBAGA,+DACA,SACD;EACA,GAAI;YAEH,iBAAiB,QAAQ,CAAC,CAAC;CACZ;AAEnB"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
3
3
|
const require_rolldown_runtime = require('../../rolldown-runtime-D_qnwXdH.cjs');
|
|
4
4
|
const require_utils = require('../../utils-CzTQ3-VI.cjs');
|
|
5
5
|
const require_initials = require('../../initials-DSkWTOb0.cjs');
|
|
6
|
-
const require_sheet = require('../../sheet-
|
|
6
|
+
const require_sheet = require('../../sheet-CGFqOAoI.cjs');
|
|
7
7
|
const require_components_tooltip = require('../tooltip.cjs');
|
|
8
8
|
const require_components_dropdown_menu = require('../dropdown-menu.cjs');
|
|
9
9
|
const require_use_scroll_fade = require('../../use-scroll-fade-CaHp52u4.cjs');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { t as cn } from "../../utils-BkMLyah9.js";
|
|
3
3
|
import { a as plural, i as nameList, n as formatCount, r as graphemes, t as initials } from "../../initials-kCcHgrSy.js";
|
|
4
|
-
import { d as SheetTitle, i as SheetContent, n as Sheet } from "../../sheet-
|
|
4
|
+
import { d as SheetTitle, i as SheetContent, n as Sheet } from "../../sheet-LOK_d8-K.js";
|
|
5
5
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../tooltip.js";
|
|
6
6
|
import { DropdownMenuTrigger } from "../dropdown-menu.js";
|
|
7
7
|
import { t as useScrollFade } from "../../use-scroll-fade-ilq-o00-.js";
|
|
@@ -92,10 +92,12 @@ function useFluidHighlight(container) {
|
|
|
92
92
|
* container; positioned siblings paint on top. No props needed — it locates
|
|
93
93
|
* its own parent as the tracking container.
|
|
94
94
|
*
|
|
95
|
-
* Appears
|
|
96
|
-
*
|
|
95
|
+
* Appears and moves instantly by default: a list highlight follows the pointer and the
|
|
96
|
+
* arrow keys, the most frequent interactions in a menu, so it must never trail behind
|
|
97
|
+
* them. `travel` slides it on the dial-tunable fast spring tier instead, for a selection
|
|
98
|
+
* indicator the user changes deliberately (a toggle group). Reduced motion never travels.
|
|
97
99
|
*/
|
|
98
|
-
function FluidHighlight({ className, inset = 0 }) {
|
|
100
|
+
function FluidHighlight({ className, inset = 0, travel = false }) {
|
|
99
101
|
const [container, setContainer] = (0, react.useState)(null);
|
|
100
102
|
const state = useFluidHighlight(container);
|
|
101
103
|
const reduce = (0, motion_react.useReducedMotion)();
|
|
@@ -121,7 +123,7 @@ function FluidHighlight({ className, inset = 0 }) {
|
|
|
121
123
|
...rect,
|
|
122
124
|
opacity: state?.visible ? 1 : 0
|
|
123
125
|
} : { opacity: 0 },
|
|
124
|
-
transition: reduce ? { duration: 0 } : {
|
|
126
|
+
transition: reduce || !travel ? { duration: 0 } : {
|
|
125
127
|
type: "spring",
|
|
126
128
|
visualDuration: tier.duration,
|
|
127
129
|
bounce: tier.bounce
|
|
@@ -142,4 +144,4 @@ Object.defineProperty(exports, 'unscaledRect', {
|
|
|
142
144
|
return unscaledRect;
|
|
143
145
|
}
|
|
144
146
|
});
|
|
145
|
-
//# sourceMappingURL=fluid-highlight-
|
|
147
|
+
//# sourceMappingURL=fluid-highlight-B8olepSM.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fluid-highlight-B8olepSM.cjs","names":["useSpringTiers","motion","cn"],"sources":["../src/lib/motion/fluid-highlight.tsx"],"sourcesContent":["'use client';\n\nimport { useCallback, useEffect, useState } from 'react';\nimport { motion, useReducedMotion } from 'motion/react';\n\nimport { cn } from '../utils';\nimport { useSpringTiers } from './tuning';\n\ninterface Rect {\n\ttop: number;\n\tleft: number;\n\twidth: number;\n\theight: number;\n}\n\n/**\n * Base UI toggles a bare `data-highlighted` attribute; cmdk uses\n * `data-selected=\"true\"`; Toggle/ToggleGroup mark the active item with\n * `data-pressed`. The `:not([...=\"false\"])` guards cover components\n * like multi-select that render the attribute explicitly as \"false\".\n */\nconst TARGET_SELECTOR =\n\t'[data-highlighted]:not([data-highlighted=\"false\"]), [data-selected=\"true\"], [data-pressed]:not([data-pressed=\"false\"])';\nconst OBSERVED_ATTRIBUTES = ['data-highlighted', 'data-selected', 'data-pressed'];\n\n/**\n * Where `target` sits inside `container`, in the container's own unscaled pixels. Popups scale in from 95%, and a\n * transform changes no attribute or size to re-measure on, so a rect read on the first frame is shrunken; dividing\n * by the container's current scale gives the size and offset it settles at. Pass `box` when the caller has already\n * measured the container.\n */\nexport function unscaledRect(target: Element, container: HTMLElement, box = container.getBoundingClientRect()): Rect {\n\tconst t = target.getBoundingClientRect();\n\tconst scaleX = box.width / container.offsetWidth || 1;\n\tconst scaleY = box.height / container.offsetHeight || 1;\n\treturn {\n\t\ttop: (t.top - box.top) / scaleY,\n\t\tleft: (t.left - box.left) / scaleX,\n\t\twidth: t.width / scaleX,\n\t\theight: t.height / scaleY,\n\t};\n}\n\n/**\n * Track the highlighted descendant of `container` and return its rect in the\n * container's padding-box coordinates. Updates on highlight changes, DOM\n * mutations, and any nested scroll (scroll doesn't bubble, so capture).\n */\nfunction useFluidHighlight(container: HTMLElement | null): { rect: Rect; visible: boolean } | null {\n\tconst [state, setState] = useState<{ rect: Rect; visible: boolean } | null>(null);\n\n\tuseEffect(() => {\n\t\tif (!container) return;\n\n\t\tconst update = () => {\n\t\t\tconst target = container.querySelector<HTMLElement>(TARGET_SELECTOR);\n\t\t\tif (!target) {\n\t\t\t\tsetState((s) => (s ? { ...s, visible: false } : s));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Unscaled, or a popup still scaling in leaves the highlight at the shrunken size of its first frame.\n\t\t\tconst offset = unscaledRect(target, container);\n\t\t\tsetState({\n\t\t\t\trect: {\n\t\t\t\t\t...offset,\n\t\t\t\t\ttop: offset.top - container.clientTop + container.scrollTop,\n\t\t\t\t\tleft: offset.left - container.clientLeft,\n\t\t\t\t},\n\t\t\t\tvisible: true,\n\t\t\t});\n\t\t};\n\n\t\tupdate();\n\t\tconst observer = new MutationObserver(update);\n\t\tobserver.observe(container, {\n\t\t\tattributes: true,\n\t\t\tattributeFilter: OBSERVED_ATTRIBUTES,\n\t\t\tchildList: true,\n\t\t\tsubtree: true,\n\t\t});\n\t\t// Re-measure on resize too — items can reflow without attribute changes.\n\t\t// ResizeObserver is absent in jsdom and some embedded webviews.\n\t\tconst resizeObserver =\n\t\t\ttypeof ResizeObserver === 'undefined' ? null : new ResizeObserver(update);\n\t\tresizeObserver?.observe(container);\n\t\tcontainer.addEventListener('scroll', update, { capture: true, passive: true });\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t\tresizeObserver?.disconnect();\n\t\t\tcontainer.removeEventListener('scroll', update, { capture: true });\n\t\t};\n\t}, [container]);\n\n\treturn state;\n}\n\n/**\n * Traveling highlight for menu/list popups — slides under whichever item is\n * `[data-highlighted]` (Base UI) or `[data-selected=\"true\"]` (cmdk) instead of\n * flashing a per-item background. Render as the first child of a `relative`\n * container; positioned siblings paint on top. No props needed — it locates\n * its own parent as the tracking container.\n *\n * Appears and moves instantly by default: a list highlight follows the pointer and the\n * arrow keys, the most frequent interactions in a menu, so it must never trail behind\n * them. `travel` slides it on the dial-tunable fast spring tier instead, for a selection\n * indicator the user changes deliberately (a toggle group). Reduced motion never travels.\n */\nexport function FluidHighlight({\n\tclassName,\n\tinset = 0,\n\ttravel = false,\n}: {\n\tclassName?: string;\n\tinset?: number;\n\t/** Slide between targets on a spring (a selection indicator), instead of moving at once. */\n\ttravel?: boolean;\n}) {\n\t// offsetParent is the containing block this span is positioned against —\n\t// measuring the target in the same coordinate space keeps rect math exact\n\t// whether the container itself scrolls or sits inside scrolled content.\n\tconst [container, setContainer] = useState<HTMLElement | null>(null);\n\tconst state = useFluidHighlight(container);\n\tconst reduce = useReducedMotion();\n\tconst tier = useSpringTiers().fast;\n\n\t// Stable, so React doesn't detach and reattach it (and set state again) on every render.\n\tconst mountRef = useCallback((el: HTMLElement | null) => {\n\t\tsetContainer((el?.offsetParent as HTMLElement | null) ?? el?.parentElement ?? null);\n\t}, []);\n\n\tconst rect = state\n\t\t? {\n\t\t\t\ttop: state.rect.top + inset,\n\t\t\t\tleft: state.rect.left + inset,\n\t\t\t\twidth: state.rect.width - inset * 2,\n\t\t\t\theight: state.rect.height - inset * 2,\n\t\t\t}\n\t\t: null;\n\n\treturn (\n\t\t// Remount on idle→tracking so the pill fades in at the target instead of\n\t\t// sliding from (0,0) — `initial` only applies on mount.\n\t\t<motion.span\n\t\t\tkey={state ? 'tracking' : 'idle'}\n\t\t\tref={mountRef}\n\t\t\taria-hidden\n\t\t\tclassName={cn('pointer-events-none absolute rounded-sm bg-accent', className)}\n\t\t\tinitial={rect ? { ...rect, opacity: 0 } : false}\n\t\t\tanimate={rect ? { ...rect, opacity: state?.visible ? 1 : 0 } : { opacity: 0 }}\n\t\t\ttransition={\n\t\t\t\treduce || !travel ? { duration: 0 } : { type: 'spring', visualDuration: tier.duration, bounce: tier.bounce }\n\t\t\t}\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;AAqBA,MAAM,kBACL;AACD,MAAM,sBAAsB;CAAC;CAAoB;CAAiB;AAAc;;;;;;;AAQhF,SAAgB,aAAa,QAAiB,WAAwB,MAAM,UAAU,sBAAsB,GAAS;CACpH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SAMP;CAIF,MAAM,CAAC,WAAW,oCAA6C,IAAI;CACnE,MAAM,QAAQ,kBAAkB,SAAS;CACzC,MAAM,4CAA0B;CAChC,MAAM,OAAOA,8BAAe,CAAC,CAAC;CAG9B,MAAM,mCAAwB,OAA2B;EACxD,aAAc,IAAI,gBAAuC,IAAI,iBAAiB,IAAI;CACnF,GAAG,CAAC,CAAC;CAEL,MAAM,OAAO,QACV;EACA,KAAK,MAAM,KAAK,MAAM;EACtB,MAAM,MAAM,KAAK,OAAO;EACxB,OAAO,MAAM,KAAK,QAAQ,QAAQ;EAClC,QAAQ,MAAM,KAAK,SAAS,QAAQ;CACrC,IACC;CAEH,OAGC,2CAACC,oBAAO,MAAR;EAEC,KAAK;EACL;EACA,WAAWC,iBAAG,qDAAqD,SAAS;EAC5E,SAAS,OAAO;GAAE,GAAG;GAAM,SAAS;EAAE,IAAI;EAC1C,SAAS,OAAO;GAAE,GAAG;GAAM,SAAS,OAAO,UAAU,IAAI;EAAE,IAAI,EAAE,SAAS,EAAE;EAC5E,YACC,UAAU,CAAC,SAAS,EAAE,UAAU,EAAE,IAAI;GAAE,MAAM;GAAU,gBAAgB,KAAK;GAAU,QAAQ,KAAK;EAAO;CAE5G,GATK,QAAQ,aAAa,MAS1B;AAEH"}
|
|
@@ -92,10 +92,12 @@ function useFluidHighlight(container) {
|
|
|
92
92
|
* container; positioned siblings paint on top. No props needed — it locates
|
|
93
93
|
* its own parent as the tracking container.
|
|
94
94
|
*
|
|
95
|
-
* Appears
|
|
96
|
-
*
|
|
95
|
+
* Appears and moves instantly by default: a list highlight follows the pointer and the
|
|
96
|
+
* arrow keys, the most frequent interactions in a menu, so it must never trail behind
|
|
97
|
+
* them. `travel` slides it on the dial-tunable fast spring tier instead, for a selection
|
|
98
|
+
* indicator the user changes deliberately (a toggle group). Reduced motion never travels.
|
|
97
99
|
*/
|
|
98
|
-
function FluidHighlight({ className, inset = 0 }) {
|
|
100
|
+
function FluidHighlight({ className, inset = 0, travel = false }) {
|
|
99
101
|
const [container, setContainer] = useState(null);
|
|
100
102
|
const state = useFluidHighlight(container);
|
|
101
103
|
const reduce = useReducedMotion();
|
|
@@ -121,7 +123,7 @@ function FluidHighlight({ className, inset = 0 }) {
|
|
|
121
123
|
...rect,
|
|
122
124
|
opacity: state?.visible ? 1 : 0
|
|
123
125
|
} : { opacity: 0 },
|
|
124
|
-
transition: reduce ? { duration: 0 } : {
|
|
126
|
+
transition: reduce || !travel ? { duration: 0 } : {
|
|
125
127
|
type: "spring",
|
|
126
128
|
visualDuration: tier.duration,
|
|
127
129
|
bounce: tier.bounce
|
|
@@ -131,4 +133,4 @@ function FluidHighlight({ className, inset = 0 }) {
|
|
|
131
133
|
|
|
132
134
|
//#endregion
|
|
133
135
|
export { unscaledRect as n, FluidHighlight as t };
|
|
134
|
-
//# sourceMappingURL=fluid-highlight-
|
|
136
|
+
//# sourceMappingURL=fluid-highlight-BXVfWNk9.js.map
|