@arcfusionz/arc-primitive-ui 0.0.0 → 0.2.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/components/AILoader/AILoader.d.ts +32 -0
- package/dist/components/AILoader/AILoader.js +157 -0
- package/dist/components/AILoader/index.d.ts +2 -0
- package/dist/components/AILoader/index.js +2 -0
- package/dist/components/Accordion/Accordion.d.ts +96 -0
- package/dist/components/Accordion/Accordion.js +149 -0
- package/dist/components/Accordion/index.d.ts +2 -0
- package/dist/components/Accordion/index.js +2 -0
- package/dist/components/Avatar/Avatar.d.ts +152 -0
- package/dist/components/Avatar/Avatar.js +216 -0
- package/dist/components/Avatar/index.d.ts +2 -0
- package/dist/components/Avatar/index.js +2 -0
- package/dist/components/Badge/Badge.d.ts +87 -0
- package/dist/components/Badge/Badge.js +118 -0
- package/dist/components/Badge/index.d.ts +2 -0
- package/dist/components/Badge/index.js +2 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +109 -0
- package/dist/components/Breadcrumb/Breadcrumb.js +182 -0
- package/dist/components/Breadcrumb/index.d.ts +2 -0
- package/dist/components/Breadcrumb/index.js +2 -0
- package/dist/components/Button/Button.d.ts +57 -0
- package/dist/components/Button/Button.js +177 -0
- package/dist/components/Button/index.d.ts +2 -0
- package/dist/components/Button/index.js +2 -0
- package/dist/components/Calendar/Calendar.d.ts +140 -0
- package/dist/components/Calendar/Calendar.js +468 -0
- package/dist/components/Calendar/index.d.ts +2 -0
- package/dist/components/Calendar/index.js +2 -0
- package/dist/components/Checkbox/Checkbox.d.ts +60 -0
- package/dist/components/Checkbox/Checkbox.js +129 -0
- package/dist/components/Checkbox/index.d.ts +2 -0
- package/dist/components/Checkbox/index.js +2 -0
- package/dist/components/Combobox/Combobox.d.ts +251 -0
- package/dist/components/Combobox/Combobox.js +354 -0
- package/dist/components/Combobox/index.d.ts +2 -0
- package/dist/components/Combobox/index.js +2 -0
- package/dist/components/ContextMenu/ContextMenu.d.ts +129 -0
- package/dist/components/ContextMenu/ContextMenu.js +93 -0
- package/dist/components/ContextMenu/index.d.ts +2 -0
- package/dist/components/ContextMenu/index.js +2 -0
- package/dist/components/DatePicker/DatePicker.d.ts +109 -0
- package/dist/components/DatePicker/DatePicker.js +145 -0
- package/dist/components/DatePicker/index.d.ts +2 -0
- package/dist/components/DatePicker/index.js +2 -0
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +107 -0
- package/dist/components/DateRangePicker/DateRangePicker.js +161 -0
- package/dist/components/DateRangePicker/index.d.ts +2 -0
- package/dist/components/DateRangePicker/index.js +2 -0
- package/dist/components/Dialog/Dialog.d.ts +112 -0
- package/dist/components/Dialog/Dialog.js +141 -0
- package/dist/components/Dialog/index.d.ts +2 -0
- package/dist/components/Dialog/index.js +2 -0
- package/dist/components/Drawer/Drawer.d.ts +188 -0
- package/dist/components/Drawer/Drawer.js +268 -0
- package/dist/components/Drawer/index.d.ts +2 -0
- package/dist/components/Drawer/index.js +2 -0
- package/dist/components/Field/Field.d.ts +123 -0
- package/dist/components/Field/Field.js +241 -0
- package/dist/components/Field/FieldContext.d.ts +43 -0
- package/dist/components/Field/FieldContext.js +28 -0
- package/dist/components/Field/index.d.ts +3 -0
- package/dist/components/Field/index.js +3 -0
- package/dist/components/Fieldset/Fieldset.d.ts +43 -0
- package/dist/components/Fieldset/Fieldset.js +48 -0
- package/dist/components/Fieldset/index.d.ts +2 -0
- package/dist/components/Fieldset/index.js +2 -0
- package/dist/components/Form/Form.d.ts +54 -0
- package/dist/components/Form/Form.js +57 -0
- package/dist/components/Form/index.d.ts +2 -0
- package/dist/components/Form/index.js +2 -0
- package/dist/components/Input/Input.d.ts +64 -0
- package/dist/components/Input/Input.js +111 -0
- package/dist/components/Input/index.d.ts +2 -0
- package/dist/components/Input/index.js +2 -0
- package/dist/components/Menu/Menu.d.ts +212 -0
- package/dist/components/Menu/Menu.js +255 -0
- package/dist/components/Menu/index.d.ts +2 -0
- package/dist/components/Menu/index.js +2 -0
- package/dist/components/Popover/Popover.d.ts +122 -0
- package/dist/components/Popover/Popover.js +116 -0
- package/dist/components/Popover/index.d.ts +2 -0
- package/dist/components/Popover/index.js +2 -0
- package/dist/components/Progress/Progress.d.ts +87 -0
- package/dist/components/Progress/Progress.js +73 -0
- package/dist/components/Progress/index.d.ts +2 -0
- package/dist/components/Progress/index.js +2 -0
- package/dist/components/Radio/Radio.d.ts +65 -0
- package/dist/components/Radio/Radio.js +93 -0
- package/dist/components/Radio/index.d.ts +2 -0
- package/dist/components/Radio/index.js +2 -0
- package/dist/components/Select/Select.d.ts +136 -0
- package/dist/components/Select/Select.js +219 -0
- package/dist/components/Select/index.d.ts +2 -0
- package/dist/components/Select/index.js +2 -0
- package/dist/components/Skeleton/Skeleton.d.ts +39 -0
- package/dist/components/Skeleton/Skeleton.js +44 -0
- package/dist/components/Skeleton/index.d.ts +2 -0
- package/dist/components/Skeleton/index.js +2 -0
- package/dist/components/Stepper/Stepper.d.ts +161 -0
- package/dist/components/Stepper/Stepper.js +344 -0
- package/dist/components/Stepper/index.d.ts +2 -0
- package/dist/components/Stepper/index.js +2 -0
- package/dist/components/Switch/Switch.d.ts +56 -0
- package/dist/components/Switch/Switch.js +87 -0
- package/dist/components/Switch/index.d.ts +2 -0
- package/dist/components/Switch/index.js +2 -0
- package/dist/components/Table/Table.d.ts +116 -0
- package/dist/components/Table/Table.js +143 -0
- package/dist/components/Table/index.d.ts +2 -0
- package/dist/components/Table/index.js +2 -0
- package/dist/components/Tabs/Tabs.d.ts +116 -0
- package/dist/components/Tabs/Tabs.js +158 -0
- package/dist/components/Tabs/index.d.ts +2 -0
- package/dist/components/Tabs/index.js +2 -0
- package/dist/components/Timeline/Timeline.d.ts +137 -0
- package/dist/components/Timeline/Timeline.js +243 -0
- package/dist/components/Timeline/index.d.ts +2 -0
- package/dist/components/Timeline/index.js +2 -0
- package/dist/components/Toast/Toast.d.ts +135 -0
- package/dist/components/Toast/Toast.js +314 -0
- package/dist/components/Toast/index.d.ts +2 -0
- package/dist/components/Toast/index.js +2 -0
- package/dist/components/Tooltip/Tooltip.d.ts +104 -0
- package/dist/components/Tooltip/Tooltip.js +95 -0
- package/dist/components/Tooltip/index.d.ts +2 -0
- package/dist/components/Tooltip/index.js +2 -0
- package/dist/components/Typography/Typography.d.ts +38 -0
- package/dist/components/Typography/Typography.js +53 -0
- package/dist/components/Typography/index.d.ts +2 -0
- package/dist/components/Typography/index.js +2 -0
- package/dist/index.d.ts +66 -3398
- package/dist/index.js +34 -5343
- package/dist/lib/cn.d.ts +6 -0
- package/dist/lib/cn.js +9 -0
- package/package.json +6 -2
- package/src/styles/theme.css +341 -341
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { SelectTriggerSize, SelectTriggerVariant } from "../Select/Select.js";
|
|
2
|
+
import "../Select/index.js";
|
|
3
|
+
import { CSSProperties, ComponentPropsWithoutRef, ReactNode } from "react";
|
|
4
|
+
import { Combobox } from "@base-ui/react/combobox";
|
|
5
|
+
//#region src/components/Combobox/Combobox.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Groups the combobox parts and owns value, input text, filtering, and popup
|
|
8
|
+
* state. This is Base UI's `Combobox.Root` re-exported unchanged, so every
|
|
9
|
+
* root feature is available: `value`/`defaultValue`/`onValueChange`,
|
|
10
|
+
* `inputValue`/`onInputValueChange`, `items` (enables filtering and the
|
|
11
|
+
* built-in empty state), `multiple`, `filter`/`filteredItems`/`limit` for
|
|
12
|
+
* custom matching, `name`/`required`/`disabled`/`readOnly` form wiring, and
|
|
13
|
+
* object values via `isItemEqualToValue`/`itemToStringLabel`/
|
|
14
|
+
* `itemToStringValue`. Prefer Combobox over Select once a list is long
|
|
15
|
+
* enough to need filtering (~15+ options); it does not accept free-form
|
|
16
|
+
* text. Advanced `grid` and `virtualized` modes are out of this wrapper's
|
|
17
|
+
* scope — compose `@base-ui/react/combobox` parts directly for those.
|
|
18
|
+
*/
|
|
19
|
+
declare const Combobox$1: typeof Combobox.Root;
|
|
20
|
+
type ComboboxProps<Value = unknown, Multiple extends boolean | undefined = false> = Combobox.Root.Props<Value, Multiple>;
|
|
21
|
+
/** Control height shared by the input group, standalone input, and trigger. */
|
|
22
|
+
type ComboboxSize = "sm" | "md" | "lg";
|
|
23
|
+
declare const useComboboxFilter: typeof Combobox.useFilter;
|
|
24
|
+
declare const useComboboxFilteredItems: typeof Combobox.useFilteredItems;
|
|
25
|
+
interface ComboboxLabelProps extends Omit<ComponentPropsWithoutRef<typeof Combobox.Label>, "className"> {
|
|
26
|
+
className?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Visible label associated automatically with the combobox **trigger** — use
|
|
30
|
+
* it with the trigger-anchored (input-inside-popup) pattern. When the
|
|
31
|
+
* `ComboboxInput` is the form control, label the input instead: a native
|
|
32
|
+
* `<label htmlFor>`, a composed `FieldLabel`, or `aria-label` on the input.
|
|
33
|
+
* Renders a `<div>`; pass `render={<span />}` for inline layouts.
|
|
34
|
+
*/
|
|
35
|
+
declare const ComboboxLabel: import("react").ForwardRefExoticComponent<ComboboxLabelProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
36
|
+
interface ComboboxInputGroupVariantsOptions {
|
|
37
|
+
size?: ComboboxSize;
|
|
38
|
+
className?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Class list for an element styled as the combobox field frame — for
|
|
42
|
+
* combobox-shaped controls that don't come from Base UI (command-palette
|
|
43
|
+
* openers, fake search fields in previews) so every filterable picker
|
|
44
|
+
* shares one look.
|
|
45
|
+
*/
|
|
46
|
+
declare function comboboxInputGroupVariants({ size, className }?: ComboboxInputGroupVariantsOptions): string;
|
|
47
|
+
interface ComboboxInputGroupProps extends Omit<ComponentPropsWithoutRef<typeof Combobox.InputGroup>, "className"> {
|
|
48
|
+
/** Control height. `sm` (32px) meets the WCAG 2.5.8 AA target-size floor; prefer `md`/`lg` for touch-first surfaces. The `ComboboxInput` inside inherits it. With chips the field grows taller as rows wrap. */
|
|
49
|
+
size?: ComboboxSize;
|
|
50
|
+
/** Append the dropdown chevron button after the input — the visual cue that the field holds a predefined list. The popup also opens from clicking the input itself. */
|
|
51
|
+
showTrigger?: boolean;
|
|
52
|
+
/** Append a clear button that appears while there is a selection or typed text to erase. Leave off for required fields that must always hold a value. */
|
|
53
|
+
showClear?: boolean;
|
|
54
|
+
/** Accessible name for the folded clear button — override with localized copy. */
|
|
55
|
+
clearLabel?: string;
|
|
56
|
+
/** Accessible name for the folded chevron button — override with localized copy. */
|
|
57
|
+
triggerLabel?: string;
|
|
58
|
+
className?: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The field frame of an input-anchored combobox: seats the `ComboboxInput`
|
|
62
|
+
* (and selection `ComboboxChips`) inside one border with a single focus
|
|
63
|
+
* ring, and folds in the standard end-of-field buttons — a dropdown chevron
|
|
64
|
+
* (`showTrigger`) and a clear button (`showClear`). The popup anchors to
|
|
65
|
+
* this frame. Give the input an accessible name: a native `<label htmlFor>`,
|
|
66
|
+
* a composed `FieldLabel`, or `aria-label` on `ComboboxInput`.
|
|
67
|
+
*/
|
|
68
|
+
declare const ComboboxInputGroup: import("react").ForwardRefExoticComponent<ComboboxInputGroupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
69
|
+
interface ComboboxInputProps extends Omit<ComponentPropsWithoutRef<typeof Combobox.Input>, "className" | "size"> {
|
|
70
|
+
/** Control height when the input stands alone. Inside a `ComboboxInputGroup` the group's `size` wins; inside a `ComboboxPopup` the fixed search-row style applies. */
|
|
71
|
+
size?: ComboboxSize;
|
|
72
|
+
className?: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The text input that filters the list. Context-aware: bare inside a
|
|
76
|
+
* `ComboboxInputGroup` (the group owns the frame), a pinned search row
|
|
77
|
+
* inside a `ComboboxPopup` (the trigger-anchored pattern), and a standalone
|
|
78
|
+
* `Input`-look field otherwise. Typing filters as you type; ArrowDown opens
|
|
79
|
+
* and moves through options while focus stays in the input.
|
|
80
|
+
*/
|
|
81
|
+
declare const ComboboxInput: import("react").ForwardRefExoticComponent<ComboboxInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
82
|
+
interface ComboboxClearProps extends Omit<ComponentPropsWithoutRef<typeof Combobox.Clear>, "className"> {
|
|
83
|
+
className?: string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Erases the selection and typed text. Renders only while there is
|
|
87
|
+
* something to clear. `ComboboxInputGroup` folds one in via `showClear`;
|
|
88
|
+
* use this part directly for custom field layouts. Icon-only — keep an
|
|
89
|
+
* accessible name (defaults to "Clear selection").
|
|
90
|
+
*/
|
|
91
|
+
declare const ComboboxClear: import("react").ForwardRefExoticComponent<ComboboxClearProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
92
|
+
type ComboboxTriggerVariant = SelectTriggerVariant;
|
|
93
|
+
type ComboboxTriggerSize = SelectTriggerSize;
|
|
94
|
+
type BaseTriggerProps = ComponentPropsWithoutRef<typeof Combobox.Trigger>;
|
|
95
|
+
interface ComboboxTriggerProps extends Omit<BaseTriggerProps, "className"> {
|
|
96
|
+
/** Visual style: `outline` is the input-like default; `ghost` is borderless for toolbars and dense inline filters. */
|
|
97
|
+
variant?: ComboboxTriggerVariant;
|
|
98
|
+
/** Control height. `sm` (32px) meets the WCAG 2.5.8 AA target-size floor; prefer `md`/`lg` for touch-first surfaces. */
|
|
99
|
+
size?: ComboboxTriggerSize;
|
|
100
|
+
/** Stretch to fill the container width — the usual setting inside form layouts. `anchorWidth` takes precedence when both are set. */
|
|
101
|
+
fullWidth?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* CSS width of the trigger (the popup anchor). Accepts a number in pixels
|
|
104
|
+
* or any CSS width such as `"14rem"`, `"100%"`, or `"max-content"`.
|
|
105
|
+
* `"max-content"` keeps the control only as wide as the selected value,
|
|
106
|
+
* padding, and icon. A consumer `style.width` can override this
|
|
107
|
+
* convenience prop.
|
|
108
|
+
*/
|
|
109
|
+
anchorWidth?: CSSProperties["width"];
|
|
110
|
+
/** Replaces the up-down carets. Decorative — hidden from assistive technology. */
|
|
111
|
+
icon?: ReactNode;
|
|
112
|
+
className?: string;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Select-like button anchor for the trigger-anchored pattern: it shows the
|
|
116
|
+
* current `ComboboxValue` and opens a popup whose search input rides along
|
|
117
|
+
* inside (`header` on `ComboboxPopup`). Shares the Select trigger recipe, so
|
|
118
|
+
* value pickers look identical across the system; the up-down carets mark
|
|
119
|
+
* this one as searchable. Its accessible name comes from a sibling
|
|
120
|
+
* `ComboboxLabel` (or a composed `FieldLabel`); without one, pass
|
|
121
|
+
* `aria-label`.
|
|
122
|
+
*/
|
|
123
|
+
declare const ComboboxTrigger: import("react").ForwardRefExoticComponent<ComboboxTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
124
|
+
/**
|
|
125
|
+
* The selected value's text, for use inside `ComboboxTrigger` (set
|
|
126
|
+
* `placeholder` for the empty state) or as a render-function wrapper in the
|
|
127
|
+
* chips pattern. Base UI's `Combobox.Value` re-exported unchanged — it
|
|
128
|
+
* renders no element of its own; the trigger styles the text.
|
|
129
|
+
*/
|
|
130
|
+
declare const ComboboxValue: typeof Combobox.Value;
|
|
131
|
+
type ComboboxValueProps = Combobox.Value.Props;
|
|
132
|
+
type BasePositionerProps = ComponentPropsWithoutRef<typeof Combobox.Positioner>;
|
|
133
|
+
type BaseListProps = ComponentPropsWithoutRef<typeof Combobox.List>;
|
|
134
|
+
type ComboboxAlign = NonNullable<BasePositionerProps["align"]>;
|
|
135
|
+
interface ComboboxPopupProps extends Omit<ComponentPropsWithoutRef<typeof Combobox.Popup>, "className" | "children"> {
|
|
136
|
+
/** Items to render: static nodes, or a function `(item, index) => node` that renders the root's filtered `items`. */
|
|
137
|
+
children?: BaseListProps["children"];
|
|
138
|
+
/** How the popup lines up along the anchor's bottom (or top) edge. */
|
|
139
|
+
align?: ComboboxAlign;
|
|
140
|
+
/** Gap between anchor and popup in pixels. */
|
|
141
|
+
sideOffset?: BasePositionerProps["sideOffset"];
|
|
142
|
+
/** Additional shift along the alignment axis in pixels. */
|
|
143
|
+
alignOffset?: BasePositionerProps["alignOffset"];
|
|
144
|
+
/** Minimum space kept from the viewport (or collision boundary) edges when repositioning. */
|
|
145
|
+
collisionPadding?: BasePositionerProps["collisionPadding"];
|
|
146
|
+
/**
|
|
147
|
+
* Caps the popup's height so long lists scroll inside it — a number is
|
|
148
|
+
* pixels, a string is any CSS length. Whatever the value, the popup never
|
|
149
|
+
* exceeds the space between the anchor and the viewport edge.
|
|
150
|
+
*/
|
|
151
|
+
maxHeight?: number | string;
|
|
152
|
+
/** Portal destination. Defaults to `document.body`. */
|
|
153
|
+
container?: ComponentPropsWithoutRef<typeof Combobox.Portal>["container"];
|
|
154
|
+
/** Pinned content above the list — a `ComboboxInput` here creates the searchable-select (trigger-anchored) pattern. */
|
|
155
|
+
header?: ReactNode;
|
|
156
|
+
/** Live status row above the list for async lists ("Searching…", errors). Announced politely to screen readers; its slot stays mounted, so swap the content rather than the prop's presence. */
|
|
157
|
+
status?: ReactNode;
|
|
158
|
+
/**
|
|
159
|
+
* Shown when filtering leaves no items (requires `items` on the root).
|
|
160
|
+
* Defaults to "No results found." — override with localized copy, or pass
|
|
161
|
+
* `null` to omit the built-in empty state entirely.
|
|
162
|
+
*/
|
|
163
|
+
emptyMessage?: ReactNode;
|
|
164
|
+
/**
|
|
165
|
+
* Applied to the popup panel. Width hooks: the panel is at least as wide
|
|
166
|
+
* as the anchor — set `w-[var(--anchor-width)]` to match it exactly or
|
|
167
|
+
* `w-*`/`max-w-*` for a fixed width. Cap height with the `maxHeight` prop.
|
|
168
|
+
*/
|
|
169
|
+
className?: string;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* The floating option list, with the portal, positioning, scrollable list,
|
|
173
|
+
* and always-mounted status/empty regions folded in. Always drops below the
|
|
174
|
+
* anchor and flips above it only when the space below runs out — never
|
|
175
|
+
* sideways. Long lists scroll inside the popup, up to `maxHeight`.
|
|
176
|
+
*/
|
|
177
|
+
declare const ComboboxPopup: import("react").ForwardRefExoticComponent<ComboboxPopupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
178
|
+
interface ComboboxItemProps extends Omit<ComponentPropsWithoutRef<typeof Combobox.Item>, "className"> {
|
|
179
|
+
className?: string;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* One option in the popup. Children render as the option's label; a check
|
|
183
|
+
* mark appears at the item's right edge while selected. Filtering matches
|
|
184
|
+
* the item's `value` — for object values set `itemToStringLabel` on the
|
|
185
|
+
* root. Keep unavailable options visible but `disabled` so the list stays
|
|
186
|
+
* spatially consistent.
|
|
187
|
+
*/
|
|
188
|
+
declare const ComboboxItem: import("react").ForwardRefExoticComponent<ComboboxItemProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
189
|
+
interface ComboboxGroupProps extends Omit<ComponentPropsWithoutRef<typeof Combobox.Group>, "className"> {
|
|
190
|
+
className?: string;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Groups related options under a `ComboboxGroupLabel`, announced together by
|
|
194
|
+
* assistive technology. With grouped `items` data (`{ value, items }[]`),
|
|
195
|
+
* pass each group's `items` here and render them via `ComboboxCollection`.
|
|
196
|
+
*/
|
|
197
|
+
declare const ComboboxGroup: import("react").ForwardRefExoticComponent<ComboboxGroupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
198
|
+
interface ComboboxGroupLabelProps extends Omit<ComponentPropsWithoutRef<typeof Combobox.GroupLabel>, "className"> {
|
|
199
|
+
className?: string;
|
|
200
|
+
}
|
|
201
|
+
/** Heading for a `ComboboxGroup` — visually a meta caption, wired to the group via `aria-labelledby`. */
|
|
202
|
+
declare const ComboboxGroupLabel: import("react").ForwardRefExoticComponent<ComboboxGroupLabelProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
203
|
+
/**
|
|
204
|
+
* Renders the filtered items of the enclosing `ComboboxGroup` through a
|
|
205
|
+
* function child `(item, index) => node`. Base UI's `Combobox.Collection`
|
|
206
|
+
* re-exported unchanged — it renders no element of its own.
|
|
207
|
+
*/
|
|
208
|
+
declare const ComboboxCollection: typeof Combobox.Collection;
|
|
209
|
+
type ComboboxCollectionProps = Combobox.Collection.Props;
|
|
210
|
+
interface ComboboxSeparatorProps extends Omit<ComponentPropsWithoutRef<typeof Combobox.Separator>, "className"> {
|
|
211
|
+
className?: string;
|
|
212
|
+
}
|
|
213
|
+
/** Divider between option groups, exposed to screen readers as a separator. */
|
|
214
|
+
declare const ComboboxSeparator: import("react").ForwardRefExoticComponent<ComboboxSeparatorProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
215
|
+
interface ComboboxChipsProps extends Omit<ComponentPropsWithoutRef<typeof Combobox.Chips>, "className"> {
|
|
216
|
+
className?: string;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Row of selection chips for a `multiple` combobox, rendered inside the
|
|
220
|
+
* `ComboboxInputGroup` before the input. Compose it with a `ComboboxValue`
|
|
221
|
+
* render function that maps the selected values to `ComboboxChip`s and ends
|
|
222
|
+
* with the `ComboboxInput`, so typing continues after the chips.
|
|
223
|
+
*/
|
|
224
|
+
declare const ComboboxChips: import("react").ForwardRefExoticComponent<ComboboxChipsProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
225
|
+
interface ComboboxChipProps extends Omit<ComponentPropsWithoutRef<typeof Combobox.Chip>, "className"> {
|
|
226
|
+
className?: string;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* One selected value in a `multiple` combobox. ArrowLeft from the input
|
|
230
|
+
* walks the chips and Backspace removes the last one; give each chip an
|
|
231
|
+
* `aria-label` naming its value. Nest a `ComboboxChipRemove` for pointer
|
|
232
|
+
* users.
|
|
233
|
+
*/
|
|
234
|
+
declare const ComboboxChip: import("react").ForwardRefExoticComponent<ComboboxChipProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
235
|
+
interface ComboboxChipRemoveBaseProps extends Omit<ComponentPropsWithoutRef<typeof Combobox.ChipRemove>, "className"> {
|
|
236
|
+
className?: string;
|
|
237
|
+
}
|
|
238
|
+
/** The remove button renders only an icon, so an accessible name naming the value is required. */
|
|
239
|
+
type ComboboxChipRemoveProps = ComboboxChipRemoveBaseProps & ({
|
|
240
|
+
"aria-label": string;
|
|
241
|
+
} | {
|
|
242
|
+
"aria-labelledby": string;
|
|
243
|
+
});
|
|
244
|
+
/**
|
|
245
|
+
* Removes its chip's value from the selection. Icon-only, so an accessible
|
|
246
|
+
* name is required — include the value it removes, e.g.
|
|
247
|
+
* `aria-label={`Remove ${item.label}`}`. Children replace the default × icon.
|
|
248
|
+
*/
|
|
249
|
+
declare const ComboboxChipRemove: import("react").ForwardRefExoticComponent<ComboboxChipRemoveProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
250
|
+
//#endregion
|
|
251
|
+
export { Combobox$1 as Combobox, ComboboxAlign, ComboboxChip, ComboboxChipProps, ComboboxChipRemove, ComboboxChipRemoveProps, ComboboxChips, ComboboxChipsProps, ComboboxClear, ComboboxClearProps, ComboboxCollection, ComboboxCollectionProps, ComboboxGroup, ComboboxGroupLabel, ComboboxGroupLabelProps, ComboboxGroupProps, ComboboxInput, ComboboxInputGroup, ComboboxInputGroupProps, ComboboxInputGroupVariantsOptions, ComboboxInputProps, ComboboxItem, ComboboxItemProps, ComboboxLabel, ComboboxLabelProps, ComboboxPopup, ComboboxPopupProps, ComboboxProps, ComboboxSeparator, ComboboxSeparatorProps, ComboboxSize, ComboboxTrigger, ComboboxTriggerProps, ComboboxTriggerSize, ComboboxTriggerVariant, ComboboxValue, ComboboxValueProps, comboboxInputGroupVariants, useComboboxFilter, useComboboxFilteredItems };
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { inputVariants } from "../Input/Input.js";
|
|
3
|
+
import { selectTriggerVariants } from "../Select/Select.js";
|
|
4
|
+
import { createContext, forwardRef, useContext } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Combobox } from "@base-ui/react/combobox";
|
|
7
|
+
//#region src/components/Combobox/Combobox.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Groups the combobox parts and owns value, input text, filtering, and popup
|
|
10
|
+
* state. This is Base UI's `Combobox.Root` re-exported unchanged, so every
|
|
11
|
+
* root feature is available: `value`/`defaultValue`/`onValueChange`,
|
|
12
|
+
* `inputValue`/`onInputValueChange`, `items` (enables filtering and the
|
|
13
|
+
* built-in empty state), `multiple`, `filter`/`filteredItems`/`limit` for
|
|
14
|
+
* custom matching, `name`/`required`/`disabled`/`readOnly` form wiring, and
|
|
15
|
+
* object values via `isItemEqualToValue`/`itemToStringLabel`/
|
|
16
|
+
* `itemToStringValue`. Prefer Combobox over Select once a list is long
|
|
17
|
+
* enough to need filtering (~15+ options); it does not accept free-form
|
|
18
|
+
* text. Advanced `grid` and `virtualized` modes are out of this wrapper's
|
|
19
|
+
* scope — compose `@base-ui/react/combobox` parts directly for those.
|
|
20
|
+
*/
|
|
21
|
+
const Combobox$1 = Combobox.Root;
|
|
22
|
+
const useComboboxFilter = Combobox.useFilter;
|
|
23
|
+
const useComboboxFilteredItems = Combobox.useFilteredItems;
|
|
24
|
+
function ChevronDownIcon(props) {
|
|
25
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
26
|
+
viewBox: "0 0 24 24",
|
|
27
|
+
fill: "none",
|
|
28
|
+
stroke: "currentColor",
|
|
29
|
+
strokeWidth: 2,
|
|
30
|
+
strokeLinecap: "round",
|
|
31
|
+
strokeLinejoin: "round",
|
|
32
|
+
"aria-hidden": "true",
|
|
33
|
+
...props,
|
|
34
|
+
children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" })
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function ChevronsUpDownIcon(props) {
|
|
38
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
39
|
+
viewBox: "0 0 24 24",
|
|
40
|
+
fill: "none",
|
|
41
|
+
stroke: "currentColor",
|
|
42
|
+
strokeWidth: 2,
|
|
43
|
+
strokeLinecap: "round",
|
|
44
|
+
strokeLinejoin: "round",
|
|
45
|
+
"aria-hidden": "true",
|
|
46
|
+
...props,
|
|
47
|
+
children: /* @__PURE__ */ jsx("path", { d: "m7 15 5 5 5-5M7 9l5-5 5 5" })
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function XIcon(props) {
|
|
51
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
52
|
+
viewBox: "0 0 24 24",
|
|
53
|
+
fill: "none",
|
|
54
|
+
stroke: "currentColor",
|
|
55
|
+
strokeWidth: 2,
|
|
56
|
+
strokeLinecap: "round",
|
|
57
|
+
strokeLinejoin: "round",
|
|
58
|
+
"aria-hidden": "true",
|
|
59
|
+
...props,
|
|
60
|
+
children: /* @__PURE__ */ jsx("path", { d: "M18 6 6 18M6 6l12 12" })
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function CheckIcon(props) {
|
|
64
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
65
|
+
viewBox: "0 0 24 24",
|
|
66
|
+
fill: "none",
|
|
67
|
+
stroke: "currentColor",
|
|
68
|
+
strokeWidth: 2,
|
|
69
|
+
strokeLinecap: "round",
|
|
70
|
+
strokeLinejoin: "round",
|
|
71
|
+
"aria-hidden": "true",
|
|
72
|
+
...props,
|
|
73
|
+
children: /* @__PURE__ */ jsx("path", { d: "m5 13 4 4L19 7" })
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
const ComboboxInputGroupContext = createContext(null);
|
|
77
|
+
const ComboboxPopupContext = createContext(false);
|
|
78
|
+
/**
|
|
79
|
+
* Visible label associated automatically with the combobox **trigger** — use
|
|
80
|
+
* it with the trigger-anchored (input-inside-popup) pattern. When the
|
|
81
|
+
* `ComboboxInput` is the form control, label the input instead: a native
|
|
82
|
+
* `<label htmlFor>`, a composed `FieldLabel`, or `aria-label` on the input.
|
|
83
|
+
* Renders a `<div>`; pass `render={<span />}` for inline layouts.
|
|
84
|
+
*/
|
|
85
|
+
const ComboboxLabel = forwardRef(({ className, ...rest }, ref) => /* @__PURE__ */ jsx(Combobox.Label, {
|
|
86
|
+
ref,
|
|
87
|
+
className: cn("cursor-default font-sans text-sm font-medium text-foreground", className),
|
|
88
|
+
...rest
|
|
89
|
+
}));
|
|
90
|
+
ComboboxLabel.displayName = "ComboboxLabel";
|
|
91
|
+
const fieldButtonClasses = "flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-md text-muted-foreground transition-colors duration-150 hover:bg-primary-50 hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 data-disabled:pointer-events-none data-disabled:opacity-50";
|
|
92
|
+
const inputGroupBaseClasses = "flex w-full min-w-0 flex-wrap items-center cursor-text rounded-md border border-border bg-background font-sans text-foreground transition-colors duration-150 hover:border-slate-300 has-[input:focus-visible]:outline-2 has-[input:focus-visible]:outline-offset-2 has-[input:focus-visible]:outline-ring data-invalid:border-destructive data-invalid:hover:border-destructive data-invalid:has-[input:focus-visible]:outline-destructive has-aria-invalid:border-destructive has-aria-invalid:hover:border-destructive has-aria-invalid:has-[input:focus-visible]:outline-destructive data-readonly:cursor-default data-readonly:bg-surface data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4";
|
|
93
|
+
const inputGroupSizeClasses = {
|
|
94
|
+
sm: "min-h-8 gap-x-1.5 gap-y-1 px-2.5 py-1 text-sm any-pointer-coarse:text-base",
|
|
95
|
+
md: "min-h-10 gap-x-2 gap-y-1 px-3 py-1 text-sm any-pointer-coarse:text-base",
|
|
96
|
+
lg: "min-h-12 gap-x-2 gap-y-1 px-3.5 py-1 text-base [&_svg:not([class*='size-'])]:size-5"
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Class list for an element styled as the combobox field frame — for
|
|
100
|
+
* combobox-shaped controls that don't come from Base UI (command-palette
|
|
101
|
+
* openers, fake search fields in previews) so every filterable picker
|
|
102
|
+
* shares one look.
|
|
103
|
+
*/
|
|
104
|
+
function comboboxInputGroupVariants({ size = "md", className } = {}) {
|
|
105
|
+
return cn(inputGroupBaseClasses, inputGroupSizeClasses[size], className);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* The field frame of an input-anchored combobox: seats the `ComboboxInput`
|
|
109
|
+
* (and selection `ComboboxChips`) inside one border with a single focus
|
|
110
|
+
* ring, and folds in the standard end-of-field buttons — a dropdown chevron
|
|
111
|
+
* (`showTrigger`) and a clear button (`showClear`). The popup anchors to
|
|
112
|
+
* this frame. Give the input an accessible name: a native `<label htmlFor>`,
|
|
113
|
+
* a composed `FieldLabel`, or `aria-label` on `ComboboxInput`.
|
|
114
|
+
*/
|
|
115
|
+
const ComboboxInputGroup = forwardRef(({ size = "md", showTrigger = true, showClear = false, clearLabel = "Clear selection", triggerLabel = "Show options", className, children, ...rest }, ref) => /* @__PURE__ */ jsx(ComboboxInputGroupContext.Provider, {
|
|
116
|
+
value: size,
|
|
117
|
+
children: /* @__PURE__ */ jsxs(Combobox.InputGroup, {
|
|
118
|
+
ref,
|
|
119
|
+
className: cn(comboboxInputGroupVariants({ size }), className),
|
|
120
|
+
...rest,
|
|
121
|
+
children: [
|
|
122
|
+
children,
|
|
123
|
+
showClear && /* @__PURE__ */ jsx(ComboboxClear, {
|
|
124
|
+
"aria-label": clearLabel,
|
|
125
|
+
children: /* @__PURE__ */ jsx(XIcon, {})
|
|
126
|
+
}),
|
|
127
|
+
showTrigger && /* @__PURE__ */ jsx(Combobox.Trigger, {
|
|
128
|
+
"aria-label": triggerLabel,
|
|
129
|
+
className: fieldButtonClasses,
|
|
130
|
+
children: /* @__PURE__ */ jsx(ChevronDownIcon, {})
|
|
131
|
+
})
|
|
132
|
+
]
|
|
133
|
+
})
|
|
134
|
+
}));
|
|
135
|
+
ComboboxInputGroup.displayName = "ComboboxInputGroup";
|
|
136
|
+
const bareInputClasses = "h-6 min-w-16 flex-1 appearance-none rounded-none border-0 bg-transparent p-0 font-sans text-inherit placeholder:text-muted-foreground outline-none disabled:pointer-events-none";
|
|
137
|
+
const popupInputClasses = "h-10 w-full shrink-0 appearance-none rounded-none border-0 border-b border-border bg-transparent px-3 font-sans text-sm any-pointer-coarse:text-base text-foreground placeholder:text-muted-foreground outline-none disabled:pointer-events-none";
|
|
138
|
+
/**
|
|
139
|
+
* The text input that filters the list. Context-aware: bare inside a
|
|
140
|
+
* `ComboboxInputGroup` (the group owns the frame), a pinned search row
|
|
141
|
+
* inside a `ComboboxPopup` (the trigger-anchored pattern), and a standalone
|
|
142
|
+
* `Input`-look field otherwise. Typing filters as you type; ArrowDown opens
|
|
143
|
+
* and moves through options while focus stays in the input.
|
|
144
|
+
*/
|
|
145
|
+
const ComboboxInput = forwardRef(({ size = "md", className, ...rest }, ref) => {
|
|
146
|
+
const groupSize = useContext(ComboboxInputGroupContext);
|
|
147
|
+
const inPopup = useContext(ComboboxPopupContext);
|
|
148
|
+
return /* @__PURE__ */ jsx(Combobox.Input, {
|
|
149
|
+
ref,
|
|
150
|
+
className: cn(groupSize != null ? bareInputClasses : inPopup ? popupInputClasses : inputVariants({ size }), className),
|
|
151
|
+
...rest
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
ComboboxInput.displayName = "ComboboxInput";
|
|
155
|
+
/**
|
|
156
|
+
* Erases the selection and typed text. Renders only while there is
|
|
157
|
+
* something to clear. `ComboboxInputGroup` folds one in via `showClear`;
|
|
158
|
+
* use this part directly for custom field layouts. Icon-only — keep an
|
|
159
|
+
* accessible name (defaults to "Clear selection").
|
|
160
|
+
*/
|
|
161
|
+
const ComboboxClear = forwardRef(({ className, children, ...rest }, ref) => /* @__PURE__ */ jsx(Combobox.Clear, {
|
|
162
|
+
ref,
|
|
163
|
+
"aria-label": "Clear selection",
|
|
164
|
+
className: cn(fieldButtonClasses, className),
|
|
165
|
+
...rest,
|
|
166
|
+
children: children ?? /* @__PURE__ */ jsx(XIcon, {})
|
|
167
|
+
}));
|
|
168
|
+
ComboboxClear.displayName = "ComboboxClear";
|
|
169
|
+
function mergeAnchorWidth(anchorWidth, style) {
|
|
170
|
+
if (anchorWidth == null) return style;
|
|
171
|
+
const anchorStyle = { width: anchorWidth };
|
|
172
|
+
return typeof style === "function" ? (state) => ({
|
|
173
|
+
...anchorStyle,
|
|
174
|
+
...style(state)
|
|
175
|
+
}) : {
|
|
176
|
+
...anchorStyle,
|
|
177
|
+
...style ?? {}
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Select-like button anchor for the trigger-anchored pattern: it shows the
|
|
182
|
+
* current `ComboboxValue` and opens a popup whose search input rides along
|
|
183
|
+
* inside (`header` on `ComboboxPopup`). Shares the Select trigger recipe, so
|
|
184
|
+
* value pickers look identical across the system; the up-down carets mark
|
|
185
|
+
* this one as searchable. Its accessible name comes from a sibling
|
|
186
|
+
* `ComboboxLabel` (or a composed `FieldLabel`); without one, pass
|
|
187
|
+
* `aria-label`.
|
|
188
|
+
*/
|
|
189
|
+
const ComboboxTrigger = forwardRef(({ variant = "outline", size = "md", fullWidth = false, anchorWidth, icon, style, className, children, ...rest }, ref) => /* @__PURE__ */ jsxs(Combobox.Trigger, {
|
|
190
|
+
ref,
|
|
191
|
+
className: cn("group/combobox-trigger", selectTriggerVariants({
|
|
192
|
+
variant,
|
|
193
|
+
size,
|
|
194
|
+
fullWidth
|
|
195
|
+
}), className),
|
|
196
|
+
style: mergeAnchorWidth(anchorWidth, style),
|
|
197
|
+
...rest,
|
|
198
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
199
|
+
className: "min-w-0 truncate text-primary group-data-placeholder/combobox-trigger:text-muted-foreground",
|
|
200
|
+
children
|
|
201
|
+
}), /* @__PURE__ */ jsx(Combobox.Icon, {
|
|
202
|
+
"aria-hidden": "true",
|
|
203
|
+
className: "flex text-muted-foreground",
|
|
204
|
+
children: icon ?? /* @__PURE__ */ jsx(ChevronsUpDownIcon, {})
|
|
205
|
+
})]
|
|
206
|
+
}));
|
|
207
|
+
ComboboxTrigger.displayName = "ComboboxTrigger";
|
|
208
|
+
/**
|
|
209
|
+
* The selected value's text, for use inside `ComboboxTrigger` (set
|
|
210
|
+
* `placeholder` for the empty state) or as a render-function wrapper in the
|
|
211
|
+
* chips pattern. Base UI's `Combobox.Value` re-exported unchanged — it
|
|
212
|
+
* renders no element of its own; the trigger styles the text.
|
|
213
|
+
*/
|
|
214
|
+
const ComboboxValue = Combobox.Value;
|
|
215
|
+
const popupSurfaceClasses = "relative overflow-clip rounded-md border border-border bg-background font-sans text-sm text-foreground shadow-md outline-none";
|
|
216
|
+
const popupBehaviorClasses = "flex max-h-[min(var(--combobox-max-height,9999px),var(--available-height))] flex-col min-w-[var(--anchor-width)] max-w-[var(--available-width)] origin-[var(--transform-origin)] motion-safe:transition-[scale,opacity] motion-safe:duration-150 motion-safe:ease-out data-starting-style:scale-95 data-starting-style:opacity-0 data-ending-style:scale-95 data-ending-style:opacity-0";
|
|
217
|
+
const listClasses = "min-h-0 scroll-py-1 overflow-y-auto overscroll-contain p-1 outline-none data-empty:p-0";
|
|
218
|
+
const statusClasses = "flex shrink-0 items-center gap-2 px-3 py-2 font-sans text-xs text-muted-foreground empty:p-0";
|
|
219
|
+
const emptyClasses = "shrink-0 px-3 py-6 text-center font-sans text-sm text-muted-foreground empty:p-0";
|
|
220
|
+
/**
|
|
221
|
+
* The floating option list, with the portal, positioning, scrollable list,
|
|
222
|
+
* and always-mounted status/empty regions folded in. Always drops below the
|
|
223
|
+
* anchor and flips above it only when the space below runs out — never
|
|
224
|
+
* sideways. Long lists scroll inside the popup, up to `maxHeight`.
|
|
225
|
+
*/
|
|
226
|
+
const ComboboxPopup = forwardRef(({ align = "center", sideOffset = 4, alignOffset = 0, collisionPadding, maxHeight, container, header, status, emptyMessage = "No results found.", className, children, ...rest }, ref) => /* @__PURE__ */ jsx(ComboboxPopupContext.Provider, {
|
|
227
|
+
value: true,
|
|
228
|
+
children: /* @__PURE__ */ jsx(Combobox.Portal, {
|
|
229
|
+
container,
|
|
230
|
+
children: /* @__PURE__ */ jsx(Combobox.Positioner, {
|
|
231
|
+
side: "bottom",
|
|
232
|
+
align,
|
|
233
|
+
sideOffset,
|
|
234
|
+
alignOffset,
|
|
235
|
+
collisionPadding,
|
|
236
|
+
collisionAvoidance: {
|
|
237
|
+
side: "flip",
|
|
238
|
+
fallbackAxisSide: "none"
|
|
239
|
+
},
|
|
240
|
+
className: "z-50 outline-none",
|
|
241
|
+
style: maxHeight != null ? { "--combobox-max-height": typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight } : void 0,
|
|
242
|
+
children: /* @__PURE__ */ jsxs(Combobox.Popup, {
|
|
243
|
+
ref,
|
|
244
|
+
className: cn(popupSurfaceClasses, popupBehaviorClasses, className),
|
|
245
|
+
...rest,
|
|
246
|
+
children: [
|
|
247
|
+
header,
|
|
248
|
+
/* @__PURE__ */ jsx(Combobox.Status, {
|
|
249
|
+
className: statusClasses,
|
|
250
|
+
children: status
|
|
251
|
+
}),
|
|
252
|
+
emptyMessage != null && /* @__PURE__ */ jsx(Combobox.Empty, {
|
|
253
|
+
className: emptyClasses,
|
|
254
|
+
children: emptyMessage
|
|
255
|
+
}),
|
|
256
|
+
/* @__PURE__ */ jsx(Combobox.List, {
|
|
257
|
+
className: listClasses,
|
|
258
|
+
children
|
|
259
|
+
})
|
|
260
|
+
]
|
|
261
|
+
})
|
|
262
|
+
})
|
|
263
|
+
})
|
|
264
|
+
}));
|
|
265
|
+
ComboboxPopup.displayName = "ComboboxPopup";
|
|
266
|
+
const itemClasses = "relative flex cursor-default items-center gap-2 rounded-md py-1.5 pr-8 pl-2 font-sans text-sm text-foreground outline-none select-none scroll-my-1 data-highlighted:bg-primary-50 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4";
|
|
267
|
+
/**
|
|
268
|
+
* One option in the popup. Children render as the option's label; a check
|
|
269
|
+
* mark appears at the item's right edge while selected. Filtering matches
|
|
270
|
+
* the item's `value` — for object values set `itemToStringLabel` on the
|
|
271
|
+
* root. Keep unavailable options visible but `disabled` so the list stays
|
|
272
|
+
* spatially consistent.
|
|
273
|
+
*/
|
|
274
|
+
const ComboboxItem = forwardRef(({ className, children, ...rest }, ref) => /* @__PURE__ */ jsxs(Combobox.Item, {
|
|
275
|
+
ref,
|
|
276
|
+
className: cn(itemClasses, className),
|
|
277
|
+
...rest,
|
|
278
|
+
children: [children, /* @__PURE__ */ jsx(Combobox.ItemIndicator, {
|
|
279
|
+
className: "absolute right-2 flex size-4 items-center justify-center text-primary",
|
|
280
|
+
children: /* @__PURE__ */ jsx(CheckIcon, {})
|
|
281
|
+
})]
|
|
282
|
+
}));
|
|
283
|
+
ComboboxItem.displayName = "ComboboxItem";
|
|
284
|
+
/**
|
|
285
|
+
* Groups related options under a `ComboboxGroupLabel`, announced together by
|
|
286
|
+
* assistive technology. With grouped `items` data (`{ value, items }[]`),
|
|
287
|
+
* pass each group's `items` here and render them via `ComboboxCollection`.
|
|
288
|
+
*/
|
|
289
|
+
const ComboboxGroup = forwardRef(({ className, ...rest }, ref) => /* @__PURE__ */ jsx(Combobox.Group, {
|
|
290
|
+
ref,
|
|
291
|
+
className,
|
|
292
|
+
...rest
|
|
293
|
+
}));
|
|
294
|
+
ComboboxGroup.displayName = "ComboboxGroup";
|
|
295
|
+
/** Heading for a `ComboboxGroup` — visually a meta caption, wired to the group via `aria-labelledby`. */
|
|
296
|
+
const ComboboxGroupLabel = forwardRef(({ className, ...rest }, ref) => /* @__PURE__ */ jsx(Combobox.GroupLabel, {
|
|
297
|
+
ref,
|
|
298
|
+
className: cn("px-2 py-1.5 font-sans text-xs font-medium text-muted-foreground", className),
|
|
299
|
+
...rest
|
|
300
|
+
}));
|
|
301
|
+
ComboboxGroupLabel.displayName = "ComboboxGroupLabel";
|
|
302
|
+
/**
|
|
303
|
+
* Renders the filtered items of the enclosing `ComboboxGroup` through a
|
|
304
|
+
* function child `(item, index) => node`. Base UI's `Combobox.Collection`
|
|
305
|
+
* re-exported unchanged — it renders no element of its own.
|
|
306
|
+
*/
|
|
307
|
+
const ComboboxCollection = Combobox.Collection;
|
|
308
|
+
/** Divider between option groups, exposed to screen readers as a separator. */
|
|
309
|
+
const ComboboxSeparator = forwardRef(({ className, ...rest }, ref) => /* @__PURE__ */ jsx(Combobox.Separator, {
|
|
310
|
+
ref,
|
|
311
|
+
className: cn("-mx-1 my-1 h-px bg-border", className),
|
|
312
|
+
...rest
|
|
313
|
+
}));
|
|
314
|
+
ComboboxSeparator.displayName = "ComboboxSeparator";
|
|
315
|
+
/**
|
|
316
|
+
* Row of selection chips for a `multiple` combobox, rendered inside the
|
|
317
|
+
* `ComboboxInputGroup` before the input. Compose it with a `ComboboxValue`
|
|
318
|
+
* render function that maps the selected values to `ComboboxChip`s and ends
|
|
319
|
+
* with the `ComboboxInput`, so typing continues after the chips.
|
|
320
|
+
*/
|
|
321
|
+
const ComboboxChips = forwardRef(({ className, ...rest }, ref) => /* @__PURE__ */ jsx(Combobox.Chips, {
|
|
322
|
+
ref,
|
|
323
|
+
className: cn("flex min-w-0 flex-1 flex-wrap items-center gap-1", className),
|
|
324
|
+
...rest
|
|
325
|
+
}));
|
|
326
|
+
ComboboxChips.displayName = "ComboboxChips";
|
|
327
|
+
const chipClasses = "flex h-6 min-w-0 cursor-default select-none items-center gap-1 rounded-md bg-muted ps-2 pe-1 font-sans text-sm text-slate-700 data-highlighted:bg-primary-100 focus-within:bg-primary-100 data-disabled:pointer-events-none data-disabled:opacity-50";
|
|
328
|
+
/**
|
|
329
|
+
* One selected value in a `multiple` combobox. ArrowLeft from the input
|
|
330
|
+
* walks the chips and Backspace removes the last one; give each chip an
|
|
331
|
+
* `aria-label` naming its value. Nest a `ComboboxChipRemove` for pointer
|
|
332
|
+
* users.
|
|
333
|
+
*/
|
|
334
|
+
const ComboboxChip = forwardRef(({ className, ...rest }, ref) => /* @__PURE__ */ jsx(Combobox.Chip, {
|
|
335
|
+
ref,
|
|
336
|
+
className: cn(chipClasses, className),
|
|
337
|
+
...rest
|
|
338
|
+
}));
|
|
339
|
+
ComboboxChip.displayName = "ComboboxChip";
|
|
340
|
+
const chipRemoveClasses = "relative inline-flex size-4 shrink-0 cursor-pointer items-center justify-center rounded-full text-current opacity-70 transition-colors duration-150 before:absolute before:-inset-1 hover:bg-current/10 hover:opacity-100 active:bg-current/20 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 data-disabled:pointer-events-none data-disabled:opacity-50";
|
|
341
|
+
/**
|
|
342
|
+
* Removes its chip's value from the selection. Icon-only, so an accessible
|
|
343
|
+
* name is required — include the value it removes, e.g.
|
|
344
|
+
* `aria-label={`Remove ${item.label}`}`. Children replace the default × icon.
|
|
345
|
+
*/
|
|
346
|
+
const ComboboxChipRemove = forwardRef(({ className, children, ...rest }, ref) => /* @__PURE__ */ jsx(Combobox.ChipRemove, {
|
|
347
|
+
ref,
|
|
348
|
+
className: cn(chipRemoveClasses, className),
|
|
349
|
+
...rest,
|
|
350
|
+
children: children ?? /* @__PURE__ */ jsx(XIcon, { className: "size-3" })
|
|
351
|
+
}));
|
|
352
|
+
ComboboxChipRemove.displayName = "ComboboxChipRemove";
|
|
353
|
+
//#endregion
|
|
354
|
+
export { Combobox$1 as Combobox, ComboboxChip, ComboboxChipRemove, ComboboxChips, ComboboxClear, ComboboxCollection, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxInputGroup, ComboboxItem, ComboboxLabel, ComboboxPopup, ComboboxSeparator, ComboboxTrigger, ComboboxValue, comboboxInputGroupVariants, useComboboxFilter, useComboboxFilteredItems };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { Combobox, ComboboxAlign, ComboboxChip, ComboboxChipProps, ComboboxChipRemove, ComboboxChipRemoveProps, ComboboxChips, ComboboxChipsProps, ComboboxClear, ComboboxClearProps, ComboboxCollection, ComboboxCollectionProps, ComboboxGroup, ComboboxGroupLabel, ComboboxGroupLabelProps, ComboboxGroupProps, ComboboxInput, ComboboxInputGroup, ComboboxInputGroupProps, ComboboxInputGroupVariantsOptions, ComboboxInputProps, ComboboxItem, ComboboxItemProps, ComboboxLabel, ComboboxLabelProps, ComboboxPopup, ComboboxPopupProps, ComboboxProps, ComboboxSeparator, ComboboxSeparatorProps, ComboboxSize, ComboboxTrigger, ComboboxTriggerProps, ComboboxTriggerSize, ComboboxTriggerVariant, ComboboxValue, ComboboxValueProps, comboboxInputGroupVariants, useComboboxFilter, useComboboxFilteredItems } from "./Combobox.js";
|
|
2
|
+
export { Combobox, type ComboboxAlign, ComboboxChip, type ComboboxChipProps, ComboboxChipRemove, type ComboboxChipRemoveProps, ComboboxChips, type ComboboxChipsProps, ComboboxClear, type ComboboxClearProps, ComboboxCollection, type ComboboxCollectionProps, ComboboxGroup, ComboboxGroupLabel, type ComboboxGroupLabelProps, type ComboboxGroupProps, ComboboxInput, ComboboxInputGroup, type ComboboxInputGroupProps, type ComboboxInputGroupVariantsOptions, type ComboboxInputProps, ComboboxItem, type ComboboxItemProps, ComboboxLabel, type ComboboxLabelProps, ComboboxPopup, type ComboboxPopupProps, type ComboboxProps, ComboboxSeparator, type ComboboxSeparatorProps, type ComboboxSize, ComboboxTrigger, type ComboboxTriggerProps, type ComboboxTriggerSize, type ComboboxTriggerVariant, ComboboxValue, type ComboboxValueProps, comboboxInputGroupVariants, useComboboxFilter, useComboboxFilteredItems };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { Combobox, ComboboxChip, ComboboxChipRemove, ComboboxChips, ComboboxClear, ComboboxCollection, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxInputGroup, ComboboxItem, ComboboxLabel, ComboboxPopup, ComboboxSeparator, ComboboxTrigger, ComboboxValue, comboboxInputGroupVariants, useComboboxFilter, useComboboxFilteredItems } from "./Combobox.js";
|
|
2
|
+
export { Combobox, ComboboxChip, ComboboxChipRemove, ComboboxChips, ComboboxClear, ComboboxCollection, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxInputGroup, ComboboxItem, ComboboxLabel, ComboboxPopup, ComboboxSeparator, ComboboxTrigger, ComboboxValue, comboboxInputGroupVariants, useComboboxFilter, useComboboxFilteredItems };
|