@epilot/spark-ui 0.32.2 → 0.32.3
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/components/accordion.cjs +2 -2
- package/dist/components/accordion.d.ts +1 -1
- package/dist/components/accordion.js +2 -2
- package/dist/components/alert-dialog.cjs +1 -1
- package/dist/components/alert-dialog.js +1 -1
- package/dist/components/attachment.cjs +3 -3
- package/dist/components/attachment.cjs.map +1 -1
- package/dist/components/attachment.js +3 -3
- package/dist/components/attachment.js.map +1 -1
- package/dist/components/autocomplete.cjs +1 -1
- package/dist/components/autocomplete.js +1 -1
- package/dist/components/avatar.js +1 -1
- package/dist/components/badge.cjs +1 -1
- package/dist/components/badge.js +2 -2
- package/dist/components/banner.cjs +1 -1
- package/dist/components/banner.js +1 -1
- package/dist/components/bar-chart.js +1 -1
- package/dist/components/breadcrumbs.cjs +1 -1
- package/dist/components/breadcrumbs.js +1 -1
- package/dist/components/bubble.cjs +2 -2
- package/dist/components/bubble.cjs.map +1 -1
- package/dist/components/bubble.d.cts +1 -1
- package/dist/components/bubble.d.ts +1 -1
- package/dist/components/bubble.js +2 -2
- package/dist/components/bubble.js.map +1 -1
- package/dist/components/button-group.cjs +1 -1
- package/dist/components/button-group.js +2 -2
- package/dist/components/button.cjs +1 -1
- package/dist/components/button.js +2 -2
- package/dist/components/calendar.cjs +3 -3
- package/dist/components/calendar.js +3 -3
- package/dist/components/callout.cjs +2 -2
- package/dist/components/callout.d.ts +1 -1
- package/dist/components/callout.js +2 -2
- package/dist/components/card.cjs +1 -1
- package/dist/components/card.js +1 -1
- package/dist/components/checkbox-group.js +1 -1
- package/dist/components/checkbox.js +1 -1
- package/dist/components/combobox.cjs +70 -25
- package/dist/components/combobox.cjs.map +1 -1
- package/dist/components/combobox.d.cts +2 -5
- package/dist/components/combobox.d.ts +2 -5
- package/dist/components/combobox.js +70 -25
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/dialog.cjs +1 -1
- package/dist/components/dialog.js +1 -1
- package/dist/components/drawer.cjs +1 -1
- package/dist/components/drawer.js +1 -1
- package/dist/components/dropdown-menu.cjs +2 -2
- package/dist/components/dropdown-menu.cjs.map +1 -1
- package/dist/components/dropdown-menu.js +2 -2
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/dropzone.cjs +1 -1
- package/dist/components/dropzone.cjs.map +1 -1
- package/dist/components/dropzone.js +1 -1
- package/dist/components/dropzone.js.map +1 -1
- package/dist/components/empty-state.cjs +1 -1
- package/dist/components/empty-state.d.ts +1 -1
- package/dist/components/empty-state.js +1 -1
- package/dist/components/entity-card.cjs +4 -4
- package/dist/components/entity-card.cjs.map +1 -1
- package/dist/components/entity-card.d.ts +1 -1
- package/dist/components/entity-card.js +4 -4
- package/dist/components/entity-card.js.map +1 -1
- package/dist/components/field.cjs +8 -8
- package/dist/components/field.cjs.map +1 -1
- package/dist/components/field.js +8 -8
- package/dist/components/field.js.map +1 -1
- package/dist/components/hero-metric.cjs +4 -4
- package/dist/components/hero-metric.cjs.map +1 -1
- package/dist/components/hero-metric.js +4 -4
- package/dist/components/hero-metric.js.map +1 -1
- package/dist/components/icon.js +1 -1
- package/dist/components/image-carousel.cjs +2 -2
- package/dist/components/image-carousel.js +3 -3
- package/dist/components/info-block.cjs +1 -1
- package/dist/components/info-block.js +1 -1
- package/dist/components/input-group.cjs +4 -4
- package/dist/components/input-group.cjs.map +1 -1
- package/dist/components/input-group.js +4 -4
- package/dist/components/input-group.js.map +1 -1
- package/dist/components/input-otp.cjs +3 -3
- package/dist/components/input-otp.cjs.map +1 -1
- package/dist/components/input-otp.js +3 -3
- package/dist/components/input-otp.js.map +1 -1
- package/dist/components/input.cjs +3 -3
- package/dist/components/input.cjs.map +1 -1
- package/dist/components/input.js +3 -3
- package/dist/components/input.js.map +1 -1
- package/dist/components/line-chart.cjs +1 -1
- package/dist/components/line-chart.js +2 -2
- package/dist/components/list.cjs +1 -1
- package/dist/components/list.js +1 -1
- package/dist/components/marker.cjs +1 -1
- package/dist/components/marker.js +1 -1
- package/dist/components/message-scroller.cjs +2 -2
- package/dist/components/message-scroller.js +2 -2
- package/dist/components/page-header.cjs +2 -2
- package/dist/components/page-header.js +2 -2
- package/dist/components/pagination.cjs +1 -1
- package/dist/components/pagination.js +1 -1
- package/dist/components/pill.cjs +1 -1
- package/dist/components/pill.js +2 -2
- package/dist/components/popover.cjs +1 -1
- package/dist/components/popover.js +1 -1
- package/dist/components/power-history-chart.cjs +1 -1
- package/dist/components/power-history-chart.js +2 -2
- package/dist/components/power-network.cjs +2 -2
- package/dist/components/power-network.js +2 -2
- package/dist/components/radio-card-group.cjs +2 -2
- package/dist/components/radio-card-group.cjs.map +1 -1
- package/dist/components/radio-card-group.js +2 -2
- package/dist/components/radio-card-group.js.map +1 -1
- package/dist/components/radio.js +1 -1
- package/dist/components/schedule-list.cjs +2 -2
- package/dist/components/schedule-list.cjs.map +1 -1
- package/dist/components/schedule-list.js +2 -2
- package/dist/components/schedule-list.js.map +1 -1
- package/dist/components/select.cjs +2 -2
- package/dist/components/select.js +2 -2
- package/dist/components/separator.cjs +1 -1
- package/dist/components/separator.js +1 -1
- package/dist/components/sheet.cjs +1 -1
- package/dist/components/sheet.js +1 -1
- package/dist/components/skeleton.cjs +1 -1
- package/dist/components/skeleton.js +1 -1
- package/dist/components/solar-forecast-chart.d.ts +1 -1
- package/dist/components/step-indicator.cjs +2 -2
- package/dist/components/step-indicator.js +2 -2
- package/dist/components/stepper.cjs +1 -1
- package/dist/components/stepper.js +1 -1
- package/dist/components/switch-group.js +1 -1
- package/dist/components/switch.js +1 -1
- package/dist/components/table.cjs +1 -1
- package/dist/components/table.js +1 -1
- package/dist/components/tabs.cjs +22 -11
- package/dist/components/tabs.cjs.map +1 -1
- package/dist/components/tabs.d.cts +5 -1
- package/dist/components/tabs.d.ts +5 -1
- package/dist/components/tabs.js +23 -12
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/textarea.cjs +3 -3
- package/dist/components/textarea.cjs.map +1 -1
- package/dist/components/textarea.js +3 -3
- package/dist/components/textarea.js.map +1 -1
- package/dist/components/theme.cjs +1 -1
- package/dist/components/theme.js +2 -2
- package/dist/components/toast.cjs +4 -4
- package/dist/components/toast.cjs.map +1 -1
- package/dist/components/toast.js +4 -4
- package/dist/components/toast.js.map +1 -1
- package/dist/components/toggle-group.js +1 -1
- package/dist/components/toggle.js +1 -1
- package/dist/components/tooltip.cjs +1 -1
- package/dist/components/tooltip.js +1 -1
- package/dist/components/trace.cjs +3 -3
- package/dist/components/trace.cjs.map +1 -1
- package/dist/components/trace.js +3 -3
- package/dist/components/trace.js.map +1 -1
- package/dist/hooks/use-overflow-list.cjs +79 -0
- package/dist/hooks/use-overflow-list.cjs.map +1 -0
- package/dist/hooks/use-overflow-list.d.cts +48 -0
- package/dist/hooks/use-overflow-list.d.ts +48 -0
- package/dist/hooks/use-overflow-list.js +77 -0
- package/dist/hooks/use-overflow-list.js.map +1 -0
- package/dist/lib/calendar-lists.cjs +2 -2
- package/dist/lib/calendar-lists.js +2 -2
- package/dist/lib/date-field.cjs +2 -2
- package/dist/lib/date-field.js +2 -2
- package/dist/lib/input-box-variants.cjs +3 -3
- package/dist/lib/input-box-variants.cjs.map +1 -1
- package/dist/lib/input-box-variants.d.cts +1 -1
- package/dist/lib/input-box-variants.d.ts +1 -1
- package/dist/lib/input-box-variants.js +3 -3
- package/dist/lib/input-box-variants.js.map +1 -1
- package/dist/styles/theme.css +10 -5
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../utils/cn.js";
|
|
3
3
|
import { Button } from "./button.js";
|
|
4
|
-
import * as React$1 from "react";
|
|
5
4
|
import { Cancel, CheckCircle, Info, Warning } from "@epilot/spark-icons";
|
|
6
|
-
import
|
|
5
|
+
import * as React$1 from "react";
|
|
7
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { cva } from "class-variance-authority";
|
|
8
8
|
//#region src/components/callout.tsx
|
|
9
9
|
const calloutVariants = cva("group/callout flex w-full items-start gap-2 rounded-lg px-4 py-3 text-sm transition-colors duration-150 ease-out motion-reduce:transition-none", {
|
|
10
10
|
variants: { variant: {
|
package/dist/components/card.cjs
CHANGED
|
@@ -4,9 +4,9 @@ const require_chunk = require("../chunk-DY84GLCh.cjs");
|
|
|
4
4
|
const require_lib_container_chrome = require("../lib/container-chrome.cjs");
|
|
5
5
|
let react = require("react");
|
|
6
6
|
react = require_chunk.__toESM(react);
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
8
|
let class_variance_authority = require("class-variance-authority");
|
|
8
9
|
let _base_ui_react_use_render = require("@base-ui/react/use-render");
|
|
9
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
10
|
let cn = require("cn");
|
|
11
11
|
//#region src/components/card.tsx
|
|
12
12
|
const cardVariants = (0, class_variance_authority.cva)("relative flex w-full flex-col gap-1 py-3", {
|
package/dist/components/card.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { cn } from "../utils/cn.js";
|
|
3
3
|
import { containerChrome, containerElevatedClasses, containerInteractiveClasses, containerPaddingX, radiusClasses } from "../lib/container-chrome.js";
|
|
4
4
|
import * as React$1 from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
6
|
import { cva } from "class-variance-authority";
|
|
6
7
|
import { useRender } from "@base-ui/react/use-render";
|
|
7
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
//#region src/components/card.tsx
|
|
9
9
|
const cardVariants = cva("relative flex w-full flex-col gap-1 py-3", {
|
|
10
10
|
variants: { variant: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { accentByColor } from "../lib/accent-colors.js";
|
|
3
2
|
import { cn } from "../utils/cn.js";
|
|
3
|
+
import { accentByColor } from "../lib/accent-colors.js";
|
|
4
4
|
import { useFieldSetInvalid } from "./field.js";
|
|
5
5
|
import { selectionListClasses } from "../lib/selection-list.js";
|
|
6
6
|
import "react";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { accentByColor } from "../lib/accent-colors.js";
|
|
3
2
|
import { cn } from "../utils/cn.js";
|
|
3
|
+
import { accentByColor } from "../lib/accent-colors.js";
|
|
4
4
|
import { CheckboxMark, checkboxBoxClasses, checkboxMarkClasses } from "../lib/checkbox-box.js";
|
|
5
5
|
import * as React$1 from "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -4,14 +4,15 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
4
4
|
const require_chunk = require("../chunk-DY84GLCh.cjs");
|
|
5
5
|
const require_components_theme = require("./theme.cjs");
|
|
6
6
|
const require_components_button = require("./button.cjs");
|
|
7
|
-
const require_lib_control_glyphs = require("../lib/control-glyphs.cjs");
|
|
8
|
-
const require_lib_input_box_variants = require("../lib/input-box-variants.cjs");
|
|
9
7
|
const require_components_field = require("./field.cjs");
|
|
8
|
+
const require_lib_input_box_variants = require("../lib/input-box-variants.cjs");
|
|
10
9
|
const require_components_checkbox = require("./checkbox.cjs");
|
|
10
|
+
const require_hooks_use_overflow_list = require("../hooks/use-overflow-list.cjs");
|
|
11
|
+
const require_lib_control_glyphs = require("../lib/control-glyphs.cjs");
|
|
11
12
|
const require_components_pill = require("./pill.cjs");
|
|
13
|
+
let _epilot_spark_icons = require("@epilot/spark-icons");
|
|
12
14
|
let react = require("react");
|
|
13
15
|
react = require_chunk.__toESM(react);
|
|
14
|
-
let _epilot_spark_icons = require("@epilot/spark-icons");
|
|
15
16
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
16
17
|
let _base_ui_react_combobox = require("@base-ui/react/combobox");
|
|
17
18
|
let cn = require("cn");
|
|
@@ -86,30 +87,74 @@ function ComboboxTrigger({ className, children, variant, id: idProp, "aria-descr
|
|
|
86
87
|
})]
|
|
87
88
|
});
|
|
88
89
|
}
|
|
89
|
-
function
|
|
90
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.
|
|
90
|
+
function OverflowPill({ count, label, ...props }) {
|
|
91
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_pill.Pill, {
|
|
92
|
+
className: "shrink-0 in-data-disabled:opacity-50",
|
|
93
|
+
...props,
|
|
94
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
95
|
+
"aria-hidden": "true",
|
|
96
|
+
children: ["+", count]
|
|
97
|
+
}), label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
98
|
+
className: "sr-only",
|
|
99
|
+
children: label
|
|
100
|
+
})]
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
function ComboboxChips({ children, overflowLabel = (count) => `${count} more selected`, ...props }) {
|
|
104
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_combobox.Combobox.Value, { children: (value) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChipsRow, {
|
|
105
|
+
value,
|
|
106
|
+
overflowLabel,
|
|
107
|
+
renderChip: children,
|
|
108
|
+
...props
|
|
109
|
+
}) });
|
|
110
|
+
}
|
|
111
|
+
function ChipsRow({ className, value, max, overflowLabel, placeholder, renderChip, ...rest }) {
|
|
112
|
+
const { ref: consumerRef, ...props } = rest;
|
|
113
|
+
const auto = max === "auto";
|
|
114
|
+
const { containerRef, measureRef, visibleCount } = require_hooks_use_overflow_list.useOverflowList({
|
|
115
|
+
itemCount: value.length,
|
|
116
|
+
enabled: auto
|
|
117
|
+
});
|
|
118
|
+
let content;
|
|
119
|
+
if (value.length === 0) content = typeof placeholder === "string" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
120
|
+
className: "truncate text-gray-placeholder in-data-disabled:text-gray-disabled",
|
|
121
|
+
children: placeholder
|
|
122
|
+
}) : placeholder;
|
|
123
|
+
else {
|
|
124
|
+
const limit = auto ? Math.max(1, visibleCount) : max;
|
|
125
|
+
const shown = limit === void 0 ? value : value.slice(0, limit);
|
|
126
|
+
const hidden = value.length - shown.length;
|
|
127
|
+
content = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [shown.map(renderChip), hidden > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OverflowPill, {
|
|
128
|
+
"data-slot": "combobox-chips-overflow",
|
|
129
|
+
count: hidden,
|
|
130
|
+
label: overflowLabel(hidden)
|
|
131
|
+
})] });
|
|
132
|
+
}
|
|
133
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
134
|
+
ref: (node) => {
|
|
135
|
+
containerRef.current = node;
|
|
136
|
+
if (typeof consumerRef === "function") consumerRef(node);
|
|
137
|
+
else if (consumerRef) consumerRef.current = node;
|
|
138
|
+
},
|
|
91
139
|
"data-slot": "combobox-chips",
|
|
92
|
-
className: (0, cn.cn)("flex min-w-0 flex-1 flex-nowrap items-center gap-1 overflow-hidden", className),
|
|
140
|
+
className: (0, cn.cn)("flex min-w-0 flex-1 flex-nowrap items-center gap-1 overflow-hidden", auto && "relative", className),
|
|
93
141
|
...props,
|
|
94
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
})]
|
|
111
|
-
})] });
|
|
112
|
-
} })
|
|
142
|
+
children: [content, auto && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
143
|
+
ref: measureRef,
|
|
144
|
+
"aria-hidden": "true",
|
|
145
|
+
"data-slot": "combobox-chips-measure",
|
|
146
|
+
className: "pointer-events-none invisible absolute top-0 left-0 flex w-max gap-1",
|
|
147
|
+
children: [value.map((item, index) => {
|
|
148
|
+
const chip = renderChip(item, index);
|
|
149
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
150
|
+
className: "shrink-0",
|
|
151
|
+
children: chip
|
|
152
|
+
}, react.isValidElement(chip) ? chip.key : void 0);
|
|
153
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OverflowPill, {
|
|
154
|
+
"data-slot": "combobox-chips-measure-overflow",
|
|
155
|
+
count: value.length
|
|
156
|
+
})]
|
|
157
|
+
})]
|
|
113
158
|
});
|
|
114
159
|
}
|
|
115
160
|
function ComboboxChip({ className, children, ...props }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.cjs","names":["ComboboxPrimitive","React","useFieldControl","boxChrome","floatingChrome","ChevronDownGlyph","Pill","Add","useFieldContext","ClearGlyph","PortalTheme","Search","buttonVariants","Check","Checkbox"],"sources":["../../src/components/combobox.tsx"],"sourcesContent":["'use client'\n\nimport { Combobox as ComboboxPrimitive } from '@base-ui/react/combobox'\nimport { Add, Check, Search } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { ChevronDownGlyph, ClearGlyph } from '../lib/control-glyphs'\nimport {\n boxChrome,\n FLOATING_BUTTON_SHIFT,\n floatingChrome,\n} from '../lib/input-box-variants'\nimport type { SparkInputStyle } from '../lib/theme-types'\nimport { cn } from '../utils/cn'\nimport { buttonVariants } from './button'\nimport { Checkbox } from './checkbox'\nimport { useFieldContext, useFieldControl } from './field'\nimport { Pill } from './pill'\nimport { PortalTheme } from './theme'\n\nconst Combobox = ComboboxPrimitive.Root\nconst ComboboxValue = ComboboxPrimitive.Value\nconst ComboboxCollection = ComboboxPrimitive.Collection\nconst useComboboxFilter = ComboboxPrimitive.useFilter\nconst useComboboxFilteredItems = ComboboxPrimitive.useFilteredItems\n\ntype ComboboxSelectedGroup<Item> = {\n value: 'selected' | 'items'\n label: string\n items: Item[]\n /** Options left unpicked before the search filters them; ComboboxEmpty reads it. */\n optionCount: number\n}\n\n/** Splits `items` into a group with every pick, never filtered, and a group with the rest. */\nfunction useComboboxSelectedGroups<Item>(\n items: readonly Item[],\n value: readonly Item[],\n {\n selected,\n items: itemsLabel,\n isItemEqualToValue = Object.is,\n }: {\n selected: string\n items: string\n isItemEqualToValue?: (item: Item, value: Item) => boolean\n },\n) {\n const { contains } = useComboboxFilter()\n const isPicked = (item: Item) =>\n value.some((picked) => isItemEqualToValue(item, picked))\n const options = items.filter((item) => !isPicked(item))\n const groups: ComboboxSelectedGroup<Item>[] = [\n {\n value: 'selected',\n label: selected,\n items: [...value],\n optionCount: options.length,\n },\n {\n value: 'items',\n label: itemsLabel,\n items: options,\n optionCount: options.length,\n },\n ]\n const filter = (\n item: Item,\n query: string,\n itemToString?: (item: Item) => string,\n ) => isPicked(item) || contains(item, query, itemToString)\n return { items: groups, filter, isItemEqualToValue }\n}\n\nconst CLEAR_BUTTON =\n \"relative inline-flex size-6 min-h-[24px] min-w-[24px] shrink-0 items-center justify-center rounded-sm p-0 text-gray-light outline-hidden transition-colors hover:text-gray focus-visible:ring-2 focus-visible:ring-(--color-focus-root)! focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 before:absolute before:top-1/2 before:left-1/2 before:size-10 before:-translate-x-1/2 before:-translate-y-1/2 before:content-['']\"\n\nconst ComboboxGroupStateContext = React.createContext({\n disabled: false,\n readOnly: false,\n})\n\n// the trigger is a native <button>, so ComboboxClear sits beside it, not inside it;\n// Base UI's InputGroup is the only part whose state carries readOnly, so its render stays ours\nfunction ComboboxTriggerGroup({\n className,\n ...props\n}: Omit<React.ComponentProps<typeof ComboboxPrimitive.InputGroup>, 'render'>) {\n return (\n <ComboboxPrimitive.InputGroup\n data-slot=\"combobox-trigger-group\"\n className={cn(\n 'relative flex w-full items-center has-[[data-slot=combobox-clear]:not([hidden])]:[&_[data-slot=combobox-trigger]]:pr-15',\n className,\n )}\n {...props}\n render={({ role: _group, ...groupProps }, state) => (\n <ComboboxGroupStateContext.Provider\n value={{ disabled: state.disabled, readOnly: state.readOnly }}\n >\n <div {...groupProps} />\n </ComboboxGroupStateContext.Provider>\n )}\n />\n )\n}\n\nfunction ComboboxTrigger({\n className,\n children,\n variant,\n id: idProp,\n 'aria-describedby': ariaDescribedByProp,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.Trigger> & {\n // input-style override; falls back to Field / <Theme>, then soft (like Input)\n variant?: SparkInputStyle\n}) {\n const { field, id, ariaDescribedBy, ariaInvalid, inputStyle, inputColor } =\n useFieldControl({\n id: idProp,\n ariaDescribedBy: ariaDescribedByProp,\n variant,\n })\n const inset = !variant && field?.labelPosition === 'inset'\n const isGhost = inputStyle === 'ghost' || inset\n const floating = !variant && field?.labelPosition === 'floating'\n return (\n <ComboboxPrimitive.Trigger\n data-slot=\"combobox-trigger\"\n data-floating-control={floating || undefined}\n id={id}\n className={cn(\n 'relative flex w-full min-w-0 items-center gap-1.5 rounded-md px-3 text-left text-base text-gray transition-colors select-none disabled:cursor-not-allowed disabled:text-gray-disabled motion-reduce:transition-none',\n !isGhost && 'h-11',\n boxChrome[isGhost ? 'ghost' : inputStyle][inputColor],\n floating &&\n cn(\n floatingChrome(inputStyle),\n inputStyle !== 'outlined' &&\n '[&_[data-slot=combobox-chevron]]:-translate-y-2 field-floated:[&_[data-slot=combobox-chevron]]:translate-y-0 field-unlabeled:[&_[data-slot=combobox-chevron]]:translate-y-0',\n '[&[data-placeholder]:not(:focus-visible,[data-popup-open])>:not([data-slot=combobox-chevron])]:invisible field-unlabeled:[&[data-placeholder]>*]:visible',\n ),\n 'pr-8',\n // the inset Field shell draws the outline (field.tsx)\n inset && 'focus-visible:outline-hidden',\n className,\n )}\n aria-invalid={ariaInvalid}\n {...props}\n aria-describedby={ariaDescribedBy}\n >\n {children}\n <ChevronDownGlyph\n data-slot=\"combobox-chevron\"\n className={cn(\n 'pointer-events-none absolute shrink-0 text-gray-light transition-transform in-data-popup-open:rotate-180 motion-reduce:transition-none',\n isGhost ? 'right-1' : 'right-3',\n )}\n />\n </ComboboxPrimitive.Trigger>\n )\n}\n\ntype ComboboxChipsProps<Item> = Omit<\n React.ComponentProps<'div'>,\n 'children'\n> & {\n /** Renders one chip per selected value, in pick order. */\n children: (item: Item, index: number) => React.ReactNode\n /** Renders at most this many chips, then a \"+N\" pill for the rest. */\n max?: number\n overflowLabel?: (count: number) => string\n /** Shown while nothing is selected: text, or a `ComboboxAddChip`. */\n placeholder?: React.ReactNode\n}\n\n// one row that never wraps: chips past the row's width are clipped, `max` folds them into \"+N\"\nfunction ComboboxChips<Item>({\n className,\n children,\n max,\n overflowLabel = (count) => `${count} more selected`,\n placeholder,\n ...props\n}: ComboboxChipsProps<Item>) {\n return (\n <div\n data-slot=\"combobox-chips\"\n className={cn(\n 'flex min-w-0 flex-1 flex-nowrap items-center gap-1 overflow-hidden',\n className,\n )}\n {...props}\n >\n <ComboboxPrimitive.Value>\n {(value: Item[]) => {\n if (value.length === 0) {\n return typeof placeholder === 'string' ? (\n <span className=\"truncate text-gray-placeholder in-data-disabled:text-gray-disabled\">\n {placeholder}\n </span>\n ) : (\n placeholder\n )\n }\n const shown = max === undefined ? value : value.slice(0, max)\n const hidden = value.length - shown.length\n return (\n <>\n {shown.map(children)}\n {hidden > 0 && (\n <Pill\n data-slot=\"combobox-chips-overflow\"\n className=\"shrink-0 in-data-disabled:opacity-50\"\n >\n <span aria-hidden=\"true\">+{hidden}</span>\n <span className=\"sr-only\">{overflowLabel(hidden)}</span>\n </Pill>\n )}\n </>\n )\n }}\n </ComboboxPrimitive.Value>\n </div>\n )\n}\n\n// display-only: chips sit inside the trigger button, so nothing in them may be interactive\nfunction ComboboxChip({\n className,\n children,\n ...props\n}: Omit<React.HTMLAttributes<HTMLSpanElement>, 'onClick' | 'color'>) {\n return (\n <Pill\n data-slot=\"combobox-chip\"\n className={cn('min-w-0 shrink in-data-disabled:opacity-50', className)}\n {...props}\n >\n <span className=\"truncate\">{children}</span>\n </Pill>\n )\n}\n\nfunction ComboboxAddChip({\n className,\n children,\n ...props\n}: Omit<React.HTMLAttributes<HTMLSpanElement>, 'onClick' | 'color'>) {\n return (\n <Pill\n data-slot=\"combobox-add-chip\"\n className={cn(\n 'shrink-0 border border-dashed border-spark-a6 bg-transparent pl-1.5 text-spark-a11 in-data-disabled:opacity-50',\n className,\n )}\n {...props}\n >\n <Add aria-hidden className=\"[--spark-icon-size:14px]\" />\n {children}\n </Pill>\n )\n}\n\nfunction ComboboxClear({\n className,\n children,\n onClick,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.Clear>) {\n const group = React.useContext(ComboboxGroupStateContext)\n const field = useFieldContext()\n return (\n <ComboboxPrimitive.Clear\n data-slot=\"combobox-clear\"\n render={(buttonProps, state) => (\n <button\n {...buttonProps}\n hidden={state.disabled || buttonProps.hidden}\n />\n )}\n className={cn(\n CLEAR_BUTTON,\n 'absolute right-8',\n field?.labelPosition === 'floating' &&\n field.inputStyle !== 'outlined' &&\n FLOATING_BUTTON_SHIFT,\n className,\n )}\n onClick={(event) => {\n onClick?.(event)\n // Base UI refocuses the search input, which is unmounted while the popup is closed\n event.currentTarget\n .closest('[data-slot=\"combobox-trigger-group\"]')\n ?.querySelector<HTMLElement>('[data-slot=\"combobox-trigger\"]')\n ?.focus()\n }}\n {...props}\n hidden={group.disabled || group.readOnly || props.hidden}\n >\n {children ?? <ClearGlyph />}\n </ComboboxPrimitive.Clear>\n )\n}\n\ntype ComboboxContentProps = React.ComponentProps<\n typeof ComboboxPrimitive.Popup\n> &\n Pick<\n ComboboxPrimitive.Positioner.Props,\n 'align' | 'alignOffset' | 'side' | 'sideOffset'\n > &\n Pick<ComboboxPrimitive.Portal.Props, 'container'>\n\n// a toggled item changes group and so its index; Enter records it so the remounted\n// item can take the highlight back (Base UI only highlights on hover or arrow keys)\ntype ComboboxToggleTracker = {\n pending: { value: unknown } | null\n values: WeakMap<Element, unknown>\n}\nconst ComboboxToggleContext = React.createContext<ComboboxToggleTracker | null>(\n null,\n)\n\n// a tap leaves Base UI's highlight on a list index, which the next pick moves to another\n// option; without hover the highlight shows only once these keys have moved it\nconst HIGHLIGHT_KEYS = new Set(['ArrowDown', 'ArrowUp', 'Home', 'End'])\n\n// below `sm` the popup is a bottom sheet; `!` beats the positioner's inline position styles\nfunction ComboboxContent({\n className,\n children,\n align = 'start',\n alignOffset,\n side,\n sideOffset = 4,\n container,\n onKeyDownCapture,\n onPointerDownCapture,\n ...props\n}: ComboboxContentProps) {\n const [tracker] = React.useState<ComboboxToggleTracker>(() => ({\n pending: null,\n values: new WeakMap(),\n }))\n return (\n <ComboboxToggleContext.Provider value={tracker}>\n <ComboboxPrimitive.Portal container={container}>\n <PortalTheme>\n <ComboboxPrimitive.Backdrop\n data-slot=\"combobox-backdrop\"\n className=\"fixed top-(--spark-viewport-top,0) right-0 left-0 z-50 h-(--spark-viewport-height,100%) bg-(--color-overlay) transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 motion-reduce:transition-none sm:hidden\"\n />\n <ComboboxPrimitive.Positioner\n align={align}\n alignOffset={alignOffset}\n side={side}\n sideOffset={sideOffset}\n className=\"z-50 max-sm:fixed! max-sm:inset-x-0! max-sm:top-auto! max-sm:bottom-(--spark-viewport-bottom-offset,0)! max-sm:transform-none!\"\n >\n <ComboboxPrimitive.Popup\n data-slot=\"combobox-content\"\n className={cn(\n 'relative isolate z-50 flex max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) origin-(--transform-origin) flex-col overflow-hidden rounded-lg border border-gray-a1 bg-gray-1 p-1 text-gray-a12 shadow-lg dark:bg-gray-3 [[data-high-contrast]_&]:border-gray-a11',\n 'transition-[opacity,scale,translate] duration-100 data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0 motion-reduce:transition-none',\n 'sm:data-[side=bottom]:data-starting-style:-translate-y-2 sm:data-[side=left]:data-starting-style:translate-x-2 sm:data-[side=right]:data-starting-style:-translate-x-2 sm:data-[side=top]:data-starting-style:translate-y-2',\n 'max-sm:max-h-[80dvh] max-sm:w-full max-sm:max-w-none max-sm:rounded-b-none max-sm:border-x-0 max-sm:border-b-0 max-sm:px-4 max-sm:pt-3 max-sm:pb-[calc(env(safe-area-inset-bottom)+var(--spacing)*4)] max-sm:data-ending-style:translate-y-full max-sm:data-ending-style:scale-100 max-sm:data-ending-style:opacity-100 max-sm:data-starting-style:translate-y-full max-sm:data-starting-style:scale-100 max-sm:data-starting-style:opacity-100',\n className,\n )}\n {...props}\n onKeyDownCapture={(event) => {\n onKeyDownCapture?.(event)\n if (HIGHLIGHT_KEYS.has(event.key))\n event.currentTarget.setAttribute('data-keyboard', '')\n }}\n onPointerDownCapture={(event) => {\n onPointerDownCapture?.(event)\n event.currentTarget.removeAttribute('data-keyboard')\n }}\n >\n {children}\n </ComboboxPrimitive.Popup>\n </ComboboxPrimitive.Positioner>\n </PortalTheme>\n </ComboboxPrimitive.Portal>\n </ComboboxToggleContext.Provider>\n )\n}\n\n// Base UI removes the last pick on Backspace in the empty input only inside Chips\nfunction ComboboxInput({\n className,\n onKeyDown,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.Input>) {\n const tracker = React.useContext(ComboboxToggleContext)\n return (\n <ComboboxPrimitive.Chips\n data-slot=\"combobox-search\"\n // Chips adds role=\"toolbar\" for arrow keys between chips; this row holds none\n render={({ role: _toolbar, ...chipsProps }) => <div {...chipsProps} />}\n className=\"-mx-1 -mt-1 mb-1 flex shrink-0 items-center gap-1.5 border-b border-gray-a4 px-2.5 text-gray-light max-sm:mx-0 max-sm:mt-0 max-sm:mb-2 max-sm:rounded-md max-sm:border-b-0 max-sm:bg-gray-a3\"\n >\n <Search aria-hidden className=\"shrink-0 [--spark-icon-size:16px]\" />\n <ComboboxPrimitive.Input\n data-slot=\"combobox-input\"\n className={cn(\n 'h-10 w-full min-w-0 bg-transparent text-base text-gray outline-hidden placeholder:text-gray-placeholder',\n className,\n )}\n onKeyDown={(event) => {\n onKeyDown?.(event)\n if (!tracker || event.key !== 'Enter') return\n const highlighted = event.currentTarget\n .closest('[data-slot=\"combobox-content\"]')\n ?.querySelector('[data-slot=\"combobox-item\"][data-highlighted]')\n if (!highlighted) return\n tracker.pending = { value: tracker.values.get(highlighted) }\n setTimeout(() => {\n tracker.pending = null\n })\n }}\n {...props}\n />\n </ComboboxPrimitive.Chips>\n )\n}\n\n// the bottom sheet's \"Done\"; hidden from `sm` up, where the popup closes on outside press\nfunction ComboboxClose({\n className,\n onClick,\n ...props\n}: React.ComponentProps<'button'>) {\n return (\n <button\n data-slot=\"combobox-close\"\n type=\"button\"\n className={cn(\n buttonVariants({ variant: 'primary' }),\n 'mt-3 w-full shrink-0 sm:hidden',\n className,\n )}\n onClick={(event) => {\n onClick?.(event)\n // Combobox has no Close part; Escape is the key Base UI closes on\n event.currentTarget.dispatchEvent(\n new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }),\n )\n }}\n {...props}\n />\n )\n}\n\nfunction ComboboxList({\n className,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.List>) {\n return (\n <ComboboxPrimitive.List\n data-slot=\"combobox-list\"\n className={cn(\n 'min-h-0 flex-1 overflow-y-auto overscroll-contain outline-hidden data-empty:p-0',\n className,\n )}\n {...props}\n />\n )\n}\n\n// forwardRef keeps refs working for React 18 consumers (ref-as-prop is 19-only)\nconst ComboboxItem = React.forwardRef<\n HTMLDivElement,\n ComboboxPrimitive.Item.Props\n>(function ComboboxItem({ className, value, ...props }, refProp) {\n const tracker = React.useContext(ComboboxToggleContext)\n const ref = React.useRef<HTMLDivElement | null>(null)\n React.useEffect(() => {\n const node = ref.current\n if (!tracker || !node) return\n tracker.values.set(node, value)\n if (!tracker.pending || !Object.is(tracker.pending.value, value)) return\n tracker.pending = null\n // after Base UI has registered the remounted item's new index\n const timer = setTimeout(() =>\n node.dispatchEvent(new MouseEvent('mousemove', { bubbles: true })),\n )\n return () => clearTimeout(timer)\n }, [tracker, value])\n return (\n <ComboboxPrimitive.Item\n ref={(node: HTMLDivElement | null) => {\n ref.current = node\n if (typeof refProp === 'function') refProp(node)\n else if (refProp) refProp.current = node\n }}\n value={value}\n data-slot=\"combobox-item\"\n className={cn(\n 'relative flex w-full cursor-default items-center gap-1.5 rounded-sm px-1.5 py-1.5 text-sm text-gray outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 motion-reduce:transition-none max-sm:gap-3 max-sm:text-base [@media(hover:none)]:[[data-slot=combobox-content]:not([data-keyboard])_&]:data-highlighted:bg-transparent',\n className,\n )}\n {...props}\n />\n )\n})\n\nconst setInert = (node: HTMLElement | null) => {\n node?.setAttribute('inert', '')\n}\n\n// kept mounted so the bottom sheet draws an empty checkbox for unpicked items\nfunction ComboboxItemIndicator({\n className,\n children,\n keepMounted = true,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.ItemIndicator>) {\n return (\n <ComboboxPrimitive.ItemIndicator\n data-slot=\"combobox-item-indicator\"\n keepMounted={keepMounted}\n className={cn('flex shrink-0 items-center justify-center', className)}\n {...props}\n render={\n props.render ??\n ((indicatorProps, { selected }) => (\n <span {...indicatorProps}>\n <span\n className={cn(\n 'flex size-3.5 items-center justify-center max-sm:hidden',\n !selected && 'invisible',\n )}\n >\n {children ?? (\n <Check aria-hidden className=\"[--spark-icon-size:11px]\" />\n )}\n </span>\n {/* the option owns the press and the selected state; this only draws\n it. inert is set on the node as React 18 has no `inert` prop */}\n <span className=\"flex sm:hidden\" ref={setInert}>\n <Checkbox\n checked={selected}\n className=\"my-0 any-pointer-coarse:my-0\"\n readOnly\n render={<span />}\n />\n </span>\n </span>\n ))\n }\n />\n )\n}\n\nconst isSelectedGroup = (\n group: unknown,\n): group is ComboboxSelectedGroup<unknown> =>\n typeof group === 'object' && group !== null && 'optionCount' in group\n\n// with useComboboxSelectedGroups the picks never filter out, so Base UI alone would never\n// see an empty list; \"no matches\" is the options group gone while it had options\nfunction ComboboxEmpty({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.Empty>) {\n const filtered: readonly unknown[] = useComboboxFilteredItems()\n const groups = filtered.filter(isSelectedGroup)\n const noOptionMatches =\n groups.some((group) => group.optionCount > 0) &&\n !groups.some((group) => group.value === 'items')\n return (\n <ComboboxPrimitive.Empty\n data-slot=\"combobox-empty\"\n className={cn(\n 'px-1.5 py-1.5 text-sm text-gray-light empty:p-0',\n className,\n )}\n {...props}\n render={({ children: _baseChildren, ...emptyProps }) => (\n <div {...emptyProps}>\n {filtered.length === 0 || noOptionMatches ? children : null}\n </div>\n )}\n />\n )\n}\n\nfunction ComboboxStatus({\n className,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.Status>) {\n return (\n <ComboboxPrimitive.Status\n data-slot=\"combobox-status\"\n className={cn(\n 'px-1.5 py-1.5 text-sm text-gray-light empty:p-0',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxGroup({\n className,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.Group>) {\n return (\n <ComboboxPrimitive.Group\n data-slot=\"combobox-group\"\n className={cn(\n 'scroll-my-1 [&+&]:mt-1 [&+&]:border-t [&+&]:border-gray-a4 [&+&]:pt-1',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxGroupLabel({\n className,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.GroupLabel>) {\n return (\n <ComboboxPrimitive.GroupLabel\n data-slot=\"combobox-group-label\"\n className={cn(\n 'px-1.5 py-1 text-xs font-medium text-gray-light [[data-high-contrast]_&]:text-gray-a12',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxSeparator({\n className,\n ...props\n}: React.ComponentProps<'div'>) {\n return (\n <div\n aria-hidden=\"true\"\n data-slot=\"combobox-separator\"\n className={cn(\n 'pointer-events-none -mx-1 my-1 h-px bg-gray-a3 [[data-high-contrast]_&]:bg-gray-a6',\n className,\n )}\n {...props}\n />\n )\n}\n\nexport {\n Combobox,\n ComboboxAddChip,\n ComboboxChip,\n ComboboxChips,\n ComboboxClear,\n ComboboxClose,\n ComboboxCollection,\n ComboboxContent,\n ComboboxEmpty,\n ComboboxGroup,\n ComboboxGroupLabel,\n ComboboxInput,\n ComboboxItem,\n ComboboxItemIndicator,\n ComboboxList,\n ComboboxSeparator,\n ComboboxStatus,\n ComboboxTrigger,\n ComboboxTriggerGroup,\n ComboboxValue,\n useComboboxFilter,\n useComboboxFilteredItems,\n useComboboxSelectedGroups,\n}\nexport type { ComboboxSelectedGroup }\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,MAAM,WAAWA,wBAAAA,SAAkB;AACnC,MAAM,gBAAgBA,wBAAAA,SAAkB;AACxC,MAAM,qBAAqBA,wBAAAA,SAAkB;AAC7C,MAAM,oBAAoBA,wBAAAA,SAAkB;AAC5C,MAAM,2BAA2BA,wBAAAA,SAAkB;;AAWnD,SAAS,0BACP,OACA,OACA,EACE,UACA,OAAO,YACP,qBAAqB,OAAO,MAM9B;CACA,MAAM,EAAE,aAAa,kBAAkB;CACvC,MAAM,YAAY,SAChB,MAAM,MAAM,WAAW,mBAAmB,MAAM,MAAM,CAAC;CACzD,MAAM,UAAU,MAAM,QAAQ,SAAS,CAAC,SAAS,IAAI,CAAC;CACtD,MAAM,SAAwC,CAC5C;EACE,OAAO;EACP,OAAO;EACP,OAAO,CAAC,GAAG,KAAK;EAChB,aAAa,QAAQ;CACvB,GACA;EACE,OAAO;EACP,OAAO;EACP,OAAO;EACP,aAAa,QAAQ;CACvB,CACF;CACA,MAAM,UACJ,MACA,OACA,iBACG,SAAS,IAAI,KAAK,SAAS,MAAM,OAAO,YAAY;CACzD,OAAO;EAAE,OAAO;EAAQ;EAAQ;CAAmB;AACrD;AAEA,MAAM,eACJ;AAEF,MAAM,4BAA4BC,MAAM,cAAc;CACpD,UAAU;CACV,UAAU;AACZ,C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S,SAAS,OAAO,eAAe;CAC9C,MAAM,kBACJ,OAAO,MAAM,UAAU,MAAM,cAAc,CAAC,KAC5C,CAAC,OAAO,MAAM,UAAU,MAAM,UAAU,OAAO;CACjD,OACE,iBAAA,GAAA,kBAAA,KAACd,wBAAAA,SAAkB,OAAnB;EACE,aAAU;EACV,YAAA,GAAA,GAAA,IACE,mDACA,SACF;EACA,GAAI;EACJ,SAAS,EAAE,UAAU,eAAe,GAAG,iBACrC,iBAAA,GAAA,kBAAA,KAAC,OAAD;GAAK,GAAI;aACN,SAAS,WAAW,KAAK,kBAAkB,WAAW;EACpD,CAAA;CAER,CAAA;AAEL;AAEA,SAAS,eAAe,EACtB,WACA,GAAG,SACqD;CACxD,OACE,iBAAA,GAAA,kBAAA,KAACA,wBAAAA,SAAkB,QAAnB;EACE,aAAU;EACV,YAAA,GAAA,GAAA,IACE,mDACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,cAAc,EACrB,WACA,GAAG,SACoD;CACvD,OACE,iBAAA,GAAA,kBAAA,KAACA,wBAAAA,SAAkB,OAAnB;EACE,aAAU;EACV,YAAA,GAAA,GAAA,IACE,yEACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,mBAAmB,EAC1B,WACA,GAAG,SACyD;CAC5D,OACE,iBAAA,GAAA,kBAAA,KAACA,wBAAAA,SAAkB,YAAnB;EACE,aAAU;EACV,YAAA,GAAA,GAAA,IACE,0FACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,kBAAkB,EACzB,WACA,GAAG,SAC2B;CAC9B,OACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;EACE,eAAY;EACZ,aAAU;EACV,YAAA,GAAA,GAAA,IACE,sFACA,SACF;EACA,GAAI;CACL,CAAA;AAEL"}
|
|
1
|
+
{"version":3,"file":"combobox.cjs","names":["ComboboxPrimitive","React","useFieldControl","boxChrome","floatingChrome","ChevronDownGlyph","Pill","useOverflowList","Add","useFieldContext","ClearGlyph","PortalTheme","Search","buttonVariants","Check","Checkbox"],"sources":["../../src/components/combobox.tsx"],"sourcesContent":["'use client'\n\nimport { Combobox as ComboboxPrimitive } from '@base-ui/react/combobox'\nimport { Add, Check, Search } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { useOverflowList } from '../hooks/use-overflow-list'\nimport { ChevronDownGlyph, ClearGlyph } from '../lib/control-glyphs'\nimport {\n boxChrome,\n FLOATING_BUTTON_SHIFT,\n floatingChrome,\n} from '../lib/input-box-variants'\nimport type { SparkInputStyle } from '../lib/theme-types'\nimport { cn } from '../utils/cn'\nimport { buttonVariants } from './button'\nimport { Checkbox } from './checkbox'\nimport { useFieldContext, useFieldControl } from './field'\nimport { Pill } from './pill'\nimport { PortalTheme } from './theme'\n\nconst Combobox = ComboboxPrimitive.Root\nconst ComboboxValue = ComboboxPrimitive.Value\nconst ComboboxCollection = ComboboxPrimitive.Collection\nconst useComboboxFilter = ComboboxPrimitive.useFilter\nconst useComboboxFilteredItems = ComboboxPrimitive.useFilteredItems\n\ntype ComboboxSelectedGroup<Item> = {\n value: 'selected' | 'items'\n label: string\n items: Item[]\n /** Options left unpicked before the search filters them; ComboboxEmpty reads it. */\n optionCount: number\n}\n\n/** Splits `items` into a group with every pick, never filtered, and a group with the rest. */\nfunction useComboboxSelectedGroups<Item>(\n items: readonly Item[],\n value: readonly Item[],\n {\n selected,\n items: itemsLabel,\n isItemEqualToValue = Object.is,\n }: {\n selected: string\n items: string\n isItemEqualToValue?: (item: Item, value: Item) => boolean\n },\n) {\n const { contains } = useComboboxFilter()\n const isPicked = (item: Item) =>\n value.some((picked) => isItemEqualToValue(item, picked))\n const options = items.filter((item) => !isPicked(item))\n const groups: ComboboxSelectedGroup<Item>[] = [\n {\n value: 'selected',\n label: selected,\n items: [...value],\n optionCount: options.length,\n },\n {\n value: 'items',\n label: itemsLabel,\n items: options,\n optionCount: options.length,\n },\n ]\n const filter = (\n item: Item,\n query: string,\n itemToString?: (item: Item) => string,\n ) => isPicked(item) || contains(item, query, itemToString)\n return { items: groups, filter, isItemEqualToValue }\n}\n\nconst CLEAR_BUTTON =\n \"relative inline-flex size-6 min-h-[24px] min-w-[24px] shrink-0 items-center justify-center rounded-sm p-0 text-gray-light outline-hidden transition-colors hover:text-gray focus-visible:ring-2 focus-visible:ring-(--color-focus-root)! focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 before:absolute before:top-1/2 before:left-1/2 before:size-10 before:-translate-x-1/2 before:-translate-y-1/2 before:content-['']\"\n\nconst ComboboxGroupStateContext = React.createContext({\n disabled: false,\n readOnly: false,\n})\n\n// the trigger is a native <button>, so ComboboxClear sits beside it, not inside it;\n// Base UI's InputGroup is the only part whose state carries readOnly, so its render stays ours\nfunction ComboboxTriggerGroup({\n className,\n ...props\n}: Omit<React.ComponentProps<typeof ComboboxPrimitive.InputGroup>, 'render'>) {\n return (\n <ComboboxPrimitive.InputGroup\n data-slot=\"combobox-trigger-group\"\n className={cn(\n 'relative flex w-full items-center has-[[data-slot=combobox-clear]:not([hidden])]:[&_[data-slot=combobox-trigger]]:pr-15',\n className,\n )}\n {...props}\n render={({ role: _group, ...groupProps }, state) => (\n <ComboboxGroupStateContext.Provider\n value={{ disabled: state.disabled, readOnly: state.readOnly }}\n >\n <div {...groupProps} />\n </ComboboxGroupStateContext.Provider>\n )}\n />\n )\n}\n\nfunction ComboboxTrigger({\n className,\n children,\n variant,\n id: idProp,\n 'aria-describedby': ariaDescribedByProp,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.Trigger> & {\n // input-style override; falls back to Field / <Theme>, then soft (like Input)\n variant?: SparkInputStyle\n}) {\n const { field, id, ariaDescribedBy, ariaInvalid, inputStyle, inputColor } =\n useFieldControl({\n id: idProp,\n ariaDescribedBy: ariaDescribedByProp,\n variant,\n })\n const inset = !variant && field?.labelPosition === 'inset'\n const isGhost = inputStyle === 'ghost' || inset\n const floating = !variant && field?.labelPosition === 'floating'\n return (\n <ComboboxPrimitive.Trigger\n data-slot=\"combobox-trigger\"\n data-floating-control={floating || undefined}\n id={id}\n className={cn(\n 'relative flex w-full min-w-0 items-center gap-1.5 rounded-md px-3 text-left text-base text-gray transition-colors select-none disabled:cursor-not-allowed disabled:text-gray-disabled motion-reduce:transition-none',\n !isGhost && 'h-11',\n boxChrome[isGhost ? 'ghost' : inputStyle][inputColor],\n floating &&\n cn(\n floatingChrome(inputStyle),\n inputStyle !== 'outlined' &&\n '[&_[data-slot=combobox-chevron]]:-translate-y-2 field-floated:[&_[data-slot=combobox-chevron]]:translate-y-0 field-unlabeled:[&_[data-slot=combobox-chevron]]:translate-y-0',\n '[&[data-placeholder]:not(:focus-visible,[data-popup-open])>:not([data-slot=combobox-chevron])]:invisible field-unlabeled:[&[data-placeholder]>*]:visible',\n ),\n 'pr-8',\n // the inset Field shell draws the outline (field.tsx)\n inset && 'focus-visible:outline-hidden',\n className,\n )}\n aria-invalid={ariaInvalid}\n {...props}\n aria-describedby={ariaDescribedBy}\n >\n {children}\n <ChevronDownGlyph\n data-slot=\"combobox-chevron\"\n className={cn(\n 'pointer-events-none absolute shrink-0 text-gray-light transition-transform in-data-popup-open:rotate-180 motion-reduce:transition-none',\n isGhost ? 'right-1' : 'right-3',\n )}\n />\n </ComboboxPrimitive.Trigger>\n )\n}\n\ntype ComboboxChipsProps<Item> = Omit<\n React.ComponentProps<'div'>,\n 'children'\n> & {\n /** Renders one chip per selected value, in pick order. */\n children: (item: Item, index: number) => React.ReactNode\n /** Renders at most this many chips, then a \"+N\" pill for the rest. `'auto'` measures the row and folds what does not fit; it renders each chip a second time, so chips must stay display-only. */\n max?: number | 'auto'\n overflowLabel?: (count: number) => string\n /** Shown while nothing is selected: text, or a `ComboboxAddChip`. */\n placeholder?: React.ReactNode\n}\n\nfunction OverflowPill({\n count,\n label,\n ...props\n}: { count: number; label?: string } & React.ComponentProps<typeof Pill>) {\n return (\n <Pill className=\"shrink-0 in-data-disabled:opacity-50\" {...props}>\n <span aria-hidden=\"true\">+{count}</span>\n {label && <span className=\"sr-only\">{label}</span>}\n </Pill>\n )\n}\n\nfunction ComboboxChips<Item>({\n children,\n overflowLabel = (count) => `${count} more selected`,\n ...props\n}: ComboboxChipsProps<Item>) {\n return (\n <ComboboxPrimitive.Value>\n {(value: Item[]) => (\n <ChipsRow\n value={value}\n overflowLabel={overflowLabel}\n renderChip={children}\n {...props}\n />\n )}\n </ComboboxPrimitive.Value>\n )\n}\n\n// one row that never wraps: chips past the row's width are clipped, `max` folds them into \"+N\".\n// Own component so the hook's refs are set before its layout effect reads them.\nfunction ChipsRow<Item>({\n className,\n value,\n max,\n overflowLabel,\n placeholder,\n renderChip,\n ...rest\n}: Omit<ComboboxChipsProps<Item>, 'children' | 'overflowLabel'> & {\n value: Item[]\n overflowLabel: (count: number) => string\n renderChip: (item: Item, index: number) => React.ReactNode\n}) {\n const { ref: consumerRef, ...props } = rest\n const auto = max === 'auto'\n const { containerRef, measureRef, visibleCount } = useOverflowList({\n itemCount: value.length,\n enabled: auto,\n })\n\n let content: React.ReactNode\n if (value.length === 0) {\n content =\n typeof placeholder === 'string' ? (\n <span className=\"truncate text-gray-placeholder in-data-disabled:text-gray-disabled\">\n {placeholder}\n </span>\n ) : (\n placeholder\n )\n } else {\n const limit = auto ? Math.max(1, visibleCount) : max\n const shown = limit === undefined ? value : value.slice(0, limit)\n const hidden = value.length - shown.length\n content = (\n <>\n {shown.map(renderChip)}\n {hidden > 0 && (\n <OverflowPill\n data-slot=\"combobox-chips-overflow\"\n count={hidden}\n label={overflowLabel(hidden)}\n />\n )}\n </>\n )\n }\n\n return (\n <div\n ref={(node) => {\n containerRef.current = node\n if (typeof consumerRef === 'function') consumerRef(node)\n else if (consumerRef) consumerRef.current = node\n }}\n data-slot=\"combobox-chips\"\n className={cn(\n 'flex min-w-0 flex-1 flex-nowrap items-center gap-1 overflow-hidden',\n auto && 'relative',\n className,\n )}\n {...props}\n >\n {content}\n {auto && (\n <div\n ref={measureRef}\n aria-hidden=\"true\"\n data-slot=\"combobox-chips-measure\"\n className=\"pointer-events-none invisible absolute top-0 left-0 flex w-max gap-1\"\n >\n {value.map((item, index) => {\n const chip = renderChip(item, index)\n return (\n <span\n key={React.isValidElement(chip) ? chip.key : undefined}\n className=\"shrink-0\"\n >\n {chip}\n </span>\n )\n })}\n <OverflowPill\n data-slot=\"combobox-chips-measure-overflow\"\n count={value.length}\n />\n </div>\n )}\n </div>\n )\n}\n\n// display-only: chips sit inside the trigger button, so nothing in them may be interactive\nfunction ComboboxChip({\n className,\n children,\n ...props\n}: Omit<React.HTMLAttributes<HTMLSpanElement>, 'onClick' | 'color'>) {\n return (\n <Pill\n data-slot=\"combobox-chip\"\n className={cn('min-w-0 shrink in-data-disabled:opacity-50', className)}\n {...props}\n >\n <span className=\"truncate\">{children}</span>\n </Pill>\n )\n}\n\nfunction ComboboxAddChip({\n className,\n children,\n ...props\n}: Omit<React.HTMLAttributes<HTMLSpanElement>, 'onClick' | 'color'>) {\n return (\n <Pill\n data-slot=\"combobox-add-chip\"\n className={cn(\n 'shrink-0 border border-dashed border-spark-a6 bg-transparent pl-1.5 text-spark-a11 in-data-disabled:opacity-50',\n className,\n )}\n {...props}\n >\n <Add aria-hidden className=\"[--spark-icon-size:14px]\" />\n {children}\n </Pill>\n )\n}\n\nfunction ComboboxClear({\n className,\n children,\n onClick,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.Clear>) {\n const group = React.useContext(ComboboxGroupStateContext)\n const field = useFieldContext()\n return (\n <ComboboxPrimitive.Clear\n data-slot=\"combobox-clear\"\n render={(buttonProps, state) => (\n <button\n {...buttonProps}\n hidden={state.disabled || buttonProps.hidden}\n />\n )}\n className={cn(\n CLEAR_BUTTON,\n 'absolute right-8',\n field?.labelPosition === 'floating' &&\n field.inputStyle !== 'outlined' &&\n FLOATING_BUTTON_SHIFT,\n className,\n )}\n onClick={(event) => {\n onClick?.(event)\n // Base UI refocuses the search input, which is unmounted while the popup is closed\n event.currentTarget\n .closest('[data-slot=\"combobox-trigger-group\"]')\n ?.querySelector<HTMLElement>('[data-slot=\"combobox-trigger\"]')\n ?.focus()\n }}\n {...props}\n hidden={group.disabled || group.readOnly || props.hidden}\n >\n {children ?? <ClearGlyph />}\n </ComboboxPrimitive.Clear>\n )\n}\n\ntype ComboboxContentProps = React.ComponentProps<\n typeof ComboboxPrimitive.Popup\n> &\n Pick<\n ComboboxPrimitive.Positioner.Props,\n 'align' | 'alignOffset' | 'side' | 'sideOffset'\n > &\n Pick<ComboboxPrimitive.Portal.Props, 'container'>\n\n// a toggled item changes group and so its index; Enter records it so the remounted\n// item can take the highlight back (Base UI only highlights on hover or arrow keys)\ntype ComboboxToggleTracker = {\n pending: { value: unknown } | null\n values: WeakMap<Element, unknown>\n}\nconst ComboboxToggleContext = React.createContext<ComboboxToggleTracker | null>(\n null,\n)\n\n// a tap leaves Base UI's highlight on a list index, which the next pick moves to another\n// option; without hover the highlight shows only once these keys have moved it\nconst HIGHLIGHT_KEYS = new Set(['ArrowDown', 'ArrowUp', 'Home', 'End'])\n\n// below `sm` the popup is a bottom sheet; `!` beats the positioner's inline position styles\nfunction ComboboxContent({\n className,\n children,\n align = 'start',\n alignOffset,\n side,\n sideOffset = 4,\n container,\n onKeyDownCapture,\n onPointerDownCapture,\n ...props\n}: ComboboxContentProps) {\n const [tracker] = React.useState<ComboboxToggleTracker>(() => ({\n pending: null,\n values: new WeakMap(),\n }))\n return (\n <ComboboxToggleContext.Provider value={tracker}>\n <ComboboxPrimitive.Portal container={container}>\n <PortalTheme>\n <ComboboxPrimitive.Backdrop\n data-slot=\"combobox-backdrop\"\n className=\"fixed top-(--spark-viewport-top,0) right-0 left-0 z-50 h-(--spark-viewport-height,100%) bg-(--color-overlay) transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 motion-reduce:transition-none sm:hidden\"\n />\n <ComboboxPrimitive.Positioner\n align={align}\n alignOffset={alignOffset}\n side={side}\n sideOffset={sideOffset}\n className=\"z-50 max-sm:fixed! max-sm:inset-x-0! max-sm:top-auto! max-sm:bottom-(--spark-viewport-bottom-offset,0)! max-sm:transform-none!\"\n >\n <ComboboxPrimitive.Popup\n data-slot=\"combobox-content\"\n className={cn(\n 'relative isolate z-50 flex max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) origin-(--transform-origin) flex-col overflow-hidden rounded-lg border border-gray-a1 bg-gray-1 p-1 text-gray-a12 shadow-lg dark:bg-gray-3 [[data-high-contrast]_&]:border-gray-a11',\n 'transition-[opacity,scale,translate] duration-100 data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0 motion-reduce:transition-none',\n 'sm:data-[side=bottom]:data-starting-style:-translate-y-2 sm:data-[side=left]:data-starting-style:translate-x-2 sm:data-[side=right]:data-starting-style:-translate-x-2 sm:data-[side=top]:data-starting-style:translate-y-2',\n 'max-sm:max-h-[80dvh] max-sm:w-full max-sm:max-w-none max-sm:rounded-b-none max-sm:border-x-0 max-sm:border-b-0 max-sm:px-4 max-sm:pt-3 max-sm:pb-[calc(env(safe-area-inset-bottom)+var(--spacing)*4)] max-sm:data-ending-style:translate-y-full max-sm:data-ending-style:scale-100 max-sm:data-ending-style:opacity-100 max-sm:data-starting-style:translate-y-full max-sm:data-starting-style:scale-100 max-sm:data-starting-style:opacity-100',\n className,\n )}\n {...props}\n onKeyDownCapture={(event) => {\n onKeyDownCapture?.(event)\n if (HIGHLIGHT_KEYS.has(event.key))\n event.currentTarget.setAttribute('data-keyboard', '')\n }}\n onPointerDownCapture={(event) => {\n onPointerDownCapture?.(event)\n event.currentTarget.removeAttribute('data-keyboard')\n }}\n >\n {children}\n </ComboboxPrimitive.Popup>\n </ComboboxPrimitive.Positioner>\n </PortalTheme>\n </ComboboxPrimitive.Portal>\n </ComboboxToggleContext.Provider>\n )\n}\n\n// Base UI removes the last pick on Backspace in the empty input only inside Chips\nfunction ComboboxInput({\n className,\n onKeyDown,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.Input>) {\n const tracker = React.useContext(ComboboxToggleContext)\n return (\n <ComboboxPrimitive.Chips\n data-slot=\"combobox-search\"\n // Chips adds role=\"toolbar\" for arrow keys between chips; this row holds none\n render={({ role: _toolbar, ...chipsProps }) => <div {...chipsProps} />}\n className=\"-mx-1 -mt-1 mb-1 flex shrink-0 items-center gap-1.5 border-b border-gray-a4 px-2.5 text-gray-light max-sm:mx-0 max-sm:mt-0 max-sm:mb-2 max-sm:rounded-md max-sm:border-b-0 max-sm:bg-gray-a3\"\n >\n <Search aria-hidden className=\"shrink-0 [--spark-icon-size:16px]\" />\n <ComboboxPrimitive.Input\n data-slot=\"combobox-input\"\n className={cn(\n 'h-10 w-full min-w-0 bg-transparent text-base text-gray outline-hidden placeholder:text-gray-placeholder',\n className,\n )}\n onKeyDown={(event) => {\n onKeyDown?.(event)\n if (!tracker || event.key !== 'Enter') return\n const highlighted = event.currentTarget\n .closest('[data-slot=\"combobox-content\"]')\n ?.querySelector('[data-slot=\"combobox-item\"][data-highlighted]')\n if (!highlighted) return\n tracker.pending = { value: tracker.values.get(highlighted) }\n setTimeout(() => {\n tracker.pending = null\n })\n }}\n {...props}\n />\n </ComboboxPrimitive.Chips>\n )\n}\n\n// the bottom sheet's \"Done\"; hidden from `sm` up, where the popup closes on outside press\nfunction ComboboxClose({\n className,\n onClick,\n ...props\n}: React.ComponentProps<'button'>) {\n return (\n <button\n data-slot=\"combobox-close\"\n type=\"button\"\n className={cn(\n buttonVariants({ variant: 'primary' }),\n 'mt-3 w-full shrink-0 sm:hidden',\n className,\n )}\n onClick={(event) => {\n onClick?.(event)\n // Combobox has no Close part; Escape is the key Base UI closes on\n event.currentTarget.dispatchEvent(\n new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }),\n )\n }}\n {...props}\n />\n )\n}\n\nfunction ComboboxList({\n className,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.List>) {\n return (\n <ComboboxPrimitive.List\n data-slot=\"combobox-list\"\n className={cn(\n 'min-h-0 flex-1 overflow-y-auto overscroll-contain outline-hidden data-empty:p-0',\n className,\n )}\n {...props}\n />\n )\n}\n\n// forwardRef keeps refs working for React 18 consumers (ref-as-prop is 19-only)\nconst ComboboxItem = React.forwardRef<\n HTMLDivElement,\n ComboboxPrimitive.Item.Props\n>(function ComboboxItem({ className, value, ...props }, refProp) {\n const tracker = React.useContext(ComboboxToggleContext)\n const ref = React.useRef<HTMLDivElement | null>(null)\n React.useEffect(() => {\n const node = ref.current\n if (!tracker || !node) return\n tracker.values.set(node, value)\n if (!tracker.pending || !Object.is(tracker.pending.value, value)) return\n tracker.pending = null\n // after Base UI has registered the remounted item's new index\n const timer = setTimeout(() =>\n node.dispatchEvent(new MouseEvent('mousemove', { bubbles: true })),\n )\n return () => clearTimeout(timer)\n }, [tracker, value])\n return (\n <ComboboxPrimitive.Item\n ref={(node: HTMLDivElement | null) => {\n ref.current = node\n if (typeof refProp === 'function') refProp(node)\n else if (refProp) refProp.current = node\n }}\n value={value}\n data-slot=\"combobox-item\"\n className={cn(\n 'relative flex w-full cursor-default items-center gap-1.5 rounded-sm px-1.5 py-1.5 text-sm text-gray outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 motion-reduce:transition-none max-sm:gap-3 max-sm:text-base [@media(hover:none)]:[[data-slot=combobox-content]:not([data-keyboard])_&]:data-highlighted:bg-transparent',\n className,\n )}\n {...props}\n />\n )\n})\n\nconst setInert = (node: HTMLElement | null) => {\n node?.setAttribute('inert', '')\n}\n\n// kept mounted so the bottom sheet draws an empty checkbox for unpicked items\nfunction ComboboxItemIndicator({\n className,\n children,\n keepMounted = true,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.ItemIndicator>) {\n return (\n <ComboboxPrimitive.ItemIndicator\n data-slot=\"combobox-item-indicator\"\n keepMounted={keepMounted}\n className={cn('flex shrink-0 items-center justify-center', className)}\n {...props}\n render={\n props.render ??\n ((indicatorProps, { selected }) => (\n <span {...indicatorProps}>\n <span\n className={cn(\n 'flex size-3.5 items-center justify-center max-sm:hidden',\n !selected && 'invisible',\n )}\n >\n {children ?? (\n <Check aria-hidden className=\"[--spark-icon-size:11px]\" />\n )}\n </span>\n {/* the option owns the press and the selected state; this only draws\n it. inert is set on the node as React 18 has no `inert` prop */}\n <span className=\"flex sm:hidden\" ref={setInert}>\n <Checkbox\n checked={selected}\n className=\"my-0 any-pointer-coarse:my-0\"\n readOnly\n render={<span />}\n />\n </span>\n </span>\n ))\n }\n />\n )\n}\n\nconst isSelectedGroup = (\n group: unknown,\n): group is ComboboxSelectedGroup<unknown> =>\n typeof group === 'object' && group !== null && 'optionCount' in group\n\n// with useComboboxSelectedGroups the picks never filter out, so Base UI alone would never\n// see an empty list; \"no matches\" is the options group gone while it had options\nfunction ComboboxEmpty({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.Empty>) {\n const filtered: readonly unknown[] = useComboboxFilteredItems()\n const groups = filtered.filter(isSelectedGroup)\n const noOptionMatches =\n groups.some((group) => group.optionCount > 0) &&\n !groups.some((group) => group.value === 'items')\n return (\n <ComboboxPrimitive.Empty\n data-slot=\"combobox-empty\"\n className={cn(\n 'px-1.5 py-1.5 text-sm text-gray-light empty:p-0',\n className,\n )}\n {...props}\n render={({ children: _baseChildren, ...emptyProps }) => (\n <div {...emptyProps}>\n {filtered.length === 0 || noOptionMatches ? children : null}\n </div>\n )}\n />\n )\n}\n\nfunction ComboboxStatus({\n className,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.Status>) {\n return (\n <ComboboxPrimitive.Status\n data-slot=\"combobox-status\"\n className={cn(\n 'px-1.5 py-1.5 text-sm text-gray-light empty:p-0',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxGroup({\n className,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.Group>) {\n return (\n <ComboboxPrimitive.Group\n data-slot=\"combobox-group\"\n className={cn(\n 'scroll-my-1 [&+&]:mt-1 [&+&]:border-t [&+&]:border-gray-a4 [&+&]:pt-1',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxGroupLabel({\n className,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.GroupLabel>) {\n return (\n <ComboboxPrimitive.GroupLabel\n data-slot=\"combobox-group-label\"\n className={cn(\n 'px-1.5 py-1 text-xs font-medium text-gray-light [[data-high-contrast]_&]:text-gray-a12',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxSeparator({\n className,\n ...props\n}: React.ComponentProps<'div'>) {\n return (\n <div\n aria-hidden=\"true\"\n data-slot=\"combobox-separator\"\n className={cn(\n 'pointer-events-none -mx-1 my-1 h-px bg-gray-a3 [[data-high-contrast]_&]:bg-gray-a6',\n className,\n )}\n {...props}\n />\n )\n}\n\nexport {\n Combobox,\n ComboboxAddChip,\n ComboboxChip,\n ComboboxChips,\n ComboboxClear,\n ComboboxClose,\n ComboboxCollection,\n ComboboxContent,\n ComboboxEmpty,\n ComboboxGroup,\n ComboboxGroupLabel,\n ComboboxInput,\n ComboboxItem,\n ComboboxItemIndicator,\n ComboboxList,\n ComboboxSeparator,\n ComboboxStatus,\n ComboboxTrigger,\n ComboboxTriggerGroup,\n ComboboxValue,\n useComboboxFilter,\n useComboboxFilteredItems,\n useComboboxSelectedGroups,\n}\nexport type { ComboboxSelectedGroup }\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA,MAAM,WAAWA,wBAAAA,SAAkB;AACnC,MAAM,gBAAgBA,wBAAAA,SAAkB;AACxC,MAAM,qBAAqBA,wBAAAA,SAAkB;AAC7C,MAAM,oBAAoBA,wBAAAA,SAAkB;AAC5C,MAAM,2BAA2BA,wBAAAA,SAAkB;;AAWnD,SAAS,0BACP,OACA,OACA,EACE,UACA,OAAO,YACP,qBAAqB,OAAO,MAM9B;CACA,MAAM,EAAE,aAAa,kBAAkB;CACv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AAEL;AAEA,SAAS,kBAAkB,EACzB,WACA,GAAG,SAC2B;CAC9B,OACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;EACE,eAAY;EACZ,aAAU;EACV,YAAA,GAAA,GAAA,IACE,sFACA,SACF;EACA,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -45,17 +45,14 @@ declare function ComboboxTrigger({
|
|
|
45
45
|
variant?: SparkInputStyle;
|
|
46
46
|
}): import("react/jsx-runtime").JSX.Element;
|
|
47
47
|
type ComboboxChipsProps<Item> = Omit<React$1.ComponentProps<'div'>, 'children'> & {
|
|
48
|
-
/** Renders one chip per selected value, in pick order. */children: (item: Item, index: number) => React$1.ReactNode; /** Renders at most this many chips, then a "+N" pill for the rest. */
|
|
49
|
-
max?: number;
|
|
48
|
+
/** Renders one chip per selected value, in pick order. */children: (item: Item, index: number) => React$1.ReactNode; /** Renders at most this many chips, then a "+N" pill for the rest. `'auto'` measures the row and folds what does not fit; it renders each chip a second time, so chips must stay display-only. */
|
|
49
|
+
max?: number | 'auto';
|
|
50
50
|
overflowLabel?: (count: number) => string; /** Shown while nothing is selected: text, or a `ComboboxAddChip`. */
|
|
51
51
|
placeholder?: React$1.ReactNode;
|
|
52
52
|
};
|
|
53
53
|
declare function ComboboxChips<Item>({
|
|
54
|
-
className,
|
|
55
54
|
children,
|
|
56
|
-
max,
|
|
57
55
|
overflowLabel,
|
|
58
|
-
placeholder,
|
|
59
56
|
...props
|
|
60
57
|
}: ComboboxChipsProps<Item>): import("react/jsx-runtime").JSX.Element;
|
|
61
58
|
declare function ComboboxChip({
|
|
@@ -45,17 +45,14 @@ declare function ComboboxTrigger({
|
|
|
45
45
|
variant?: SparkInputStyle;
|
|
46
46
|
}): import("react/jsx-runtime").JSX.Element;
|
|
47
47
|
type ComboboxChipsProps<Item> = Omit<React$1.ComponentProps<'div'>, 'children'> & {
|
|
48
|
-
/** Renders one chip per selected value, in pick order. */children: (item: Item, index: number) => React$1.ReactNode; /** Renders at most this many chips, then a "+N" pill for the rest. */
|
|
49
|
-
max?: number;
|
|
48
|
+
/** Renders one chip per selected value, in pick order. */children: (item: Item, index: number) => React$1.ReactNode; /** Renders at most this many chips, then a "+N" pill for the rest. `'auto'` measures the row and folds what does not fit; it renders each chip a second time, so chips must stay display-only. */
|
|
49
|
+
max?: number | 'auto';
|
|
50
50
|
overflowLabel?: (count: number) => string; /** Shown while nothing is selected: text, or a `ComboboxAddChip`. */
|
|
51
51
|
placeholder?: React$1.ReactNode;
|
|
52
52
|
};
|
|
53
53
|
declare function ComboboxChips<Item>({
|
|
54
|
-
className,
|
|
55
54
|
children,
|
|
56
|
-
max,
|
|
57
55
|
overflowLabel,
|
|
58
|
-
placeholder,
|
|
59
56
|
...props
|
|
60
57
|
}: ComboboxChipsProps<Item>): import("react/jsx-runtime").JSX.Element;
|
|
61
58
|
declare function ComboboxChip({
|
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
import { cn } from "../utils/cn.js";
|
|
4
4
|
import { PortalTheme } from "./theme.js";
|
|
5
5
|
import { buttonVariants } from "./button.js";
|
|
6
|
-
import { ChevronDownGlyph, ClearGlyph } from "../lib/control-glyphs.js";
|
|
7
|
-
import { boxChrome, floatingChrome } from "../lib/input-box-variants.js";
|
|
8
6
|
import { useFieldContext, useFieldControl } from "./field.js";
|
|
7
|
+
import { boxChrome, floatingChrome } from "../lib/input-box-variants.js";
|
|
9
8
|
import { Checkbox } from "./checkbox.js";
|
|
9
|
+
import { useOverflowList } from "../hooks/use-overflow-list.js";
|
|
10
|
+
import { ChevronDownGlyph, ClearGlyph } from "../lib/control-glyphs.js";
|
|
10
11
|
import { Pill } from "./pill.js";
|
|
11
|
-
import * as React$1 from "react";
|
|
12
12
|
import { Add, Check, Search } from "@epilot/spark-icons";
|
|
13
|
+
import * as React$1 from "react";
|
|
13
14
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
14
15
|
import { Combobox as Combobox$1 } from "@base-ui/react/combobox";
|
|
15
16
|
//#region src/components/combobox.tsx
|
|
@@ -83,30 +84,74 @@ function ComboboxTrigger({ className, children, variant, id: idProp, "aria-descr
|
|
|
83
84
|
})]
|
|
84
85
|
});
|
|
85
86
|
}
|
|
86
|
-
function
|
|
87
|
-
return /* @__PURE__ */
|
|
87
|
+
function OverflowPill({ count, label, ...props }) {
|
|
88
|
+
return /* @__PURE__ */ jsxs(Pill, {
|
|
89
|
+
className: "shrink-0 in-data-disabled:opacity-50",
|
|
90
|
+
...props,
|
|
91
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
92
|
+
"aria-hidden": "true",
|
|
93
|
+
children: ["+", count]
|
|
94
|
+
}), label && /* @__PURE__ */ jsx("span", {
|
|
95
|
+
className: "sr-only",
|
|
96
|
+
children: label
|
|
97
|
+
})]
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function ComboboxChips({ children, overflowLabel = (count) => `${count} more selected`, ...props }) {
|
|
101
|
+
return /* @__PURE__ */ jsx(Combobox$1.Value, { children: (value) => /* @__PURE__ */ jsx(ChipsRow, {
|
|
102
|
+
value,
|
|
103
|
+
overflowLabel,
|
|
104
|
+
renderChip: children,
|
|
105
|
+
...props
|
|
106
|
+
}) });
|
|
107
|
+
}
|
|
108
|
+
function ChipsRow({ className, value, max, overflowLabel, placeholder, renderChip, ...rest }) {
|
|
109
|
+
const { ref: consumerRef, ...props } = rest;
|
|
110
|
+
const auto = max === "auto";
|
|
111
|
+
const { containerRef, measureRef, visibleCount } = useOverflowList({
|
|
112
|
+
itemCount: value.length,
|
|
113
|
+
enabled: auto
|
|
114
|
+
});
|
|
115
|
+
let content;
|
|
116
|
+
if (value.length === 0) content = typeof placeholder === "string" ? /* @__PURE__ */ jsx("span", {
|
|
117
|
+
className: "truncate text-gray-placeholder in-data-disabled:text-gray-disabled",
|
|
118
|
+
children: placeholder
|
|
119
|
+
}) : placeholder;
|
|
120
|
+
else {
|
|
121
|
+
const limit = auto ? Math.max(1, visibleCount) : max;
|
|
122
|
+
const shown = limit === void 0 ? value : value.slice(0, limit);
|
|
123
|
+
const hidden = value.length - shown.length;
|
|
124
|
+
content = /* @__PURE__ */ jsxs(Fragment, { children: [shown.map(renderChip), hidden > 0 && /* @__PURE__ */ jsx(OverflowPill, {
|
|
125
|
+
"data-slot": "combobox-chips-overflow",
|
|
126
|
+
count: hidden,
|
|
127
|
+
label: overflowLabel(hidden)
|
|
128
|
+
})] });
|
|
129
|
+
}
|
|
130
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
131
|
+
ref: (node) => {
|
|
132
|
+
containerRef.current = node;
|
|
133
|
+
if (typeof consumerRef === "function") consumerRef(node);
|
|
134
|
+
else if (consumerRef) consumerRef.current = node;
|
|
135
|
+
},
|
|
88
136
|
"data-slot": "combobox-chips",
|
|
89
|
-
className: cn("flex min-w-0 flex-1 flex-nowrap items-center gap-1 overflow-hidden", className),
|
|
137
|
+
className: cn("flex min-w-0 flex-1 flex-nowrap items-center gap-1 overflow-hidden", auto && "relative", className),
|
|
90
138
|
...props,
|
|
91
|
-
children: /* @__PURE__ */
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
})]
|
|
108
|
-
})] });
|
|
109
|
-
} })
|
|
139
|
+
children: [content, auto && /* @__PURE__ */ jsxs("div", {
|
|
140
|
+
ref: measureRef,
|
|
141
|
+
"aria-hidden": "true",
|
|
142
|
+
"data-slot": "combobox-chips-measure",
|
|
143
|
+
className: "pointer-events-none invisible absolute top-0 left-0 flex w-max gap-1",
|
|
144
|
+
children: [value.map((item, index) => {
|
|
145
|
+
const chip = renderChip(item, index);
|
|
146
|
+
return /* @__PURE__ */ jsx("span", {
|
|
147
|
+
className: "shrink-0",
|
|
148
|
+
children: chip
|
|
149
|
+
}, React$1.isValidElement(chip) ? chip.key : void 0);
|
|
150
|
+
}), /* @__PURE__ */ jsx(OverflowPill, {
|
|
151
|
+
"data-slot": "combobox-chips-measure-overflow",
|
|
152
|
+
count: value.length
|
|
153
|
+
})]
|
|
154
|
+
})]
|
|
110
155
|
});
|
|
111
156
|
}
|
|
112
157
|
function ComboboxChip({ className, children, ...props }) {
|