@vllnt/ui 0.2.1-canary.7978485 → 0.2.1-canary.84e9131
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.
|
@@ -58,6 +58,38 @@ function ComboboxOptionItem({
|
|
|
58
58
|
}
|
|
59
59
|
);
|
|
60
60
|
}
|
|
61
|
+
function ComboboxListPanel({
|
|
62
|
+
className,
|
|
63
|
+
commandClassName,
|
|
64
|
+
emptyText,
|
|
65
|
+
listboxId,
|
|
66
|
+
onSelect,
|
|
67
|
+
options,
|
|
68
|
+
resolvedValue,
|
|
69
|
+
searchPlaceholder
|
|
70
|
+
}) {
|
|
71
|
+
return /* @__PURE__ */ jsx(
|
|
72
|
+
PopoverContent,
|
|
73
|
+
{
|
|
74
|
+
className: cn("w-[var(--radix-popover-trigger-width)] p-0", className),
|
|
75
|
+
children: /* @__PURE__ */ jsxs(Command, { className: commandClassName, children: [
|
|
76
|
+
/* @__PURE__ */ jsx(CommandInput, { placeholder: searchPlaceholder }),
|
|
77
|
+
/* @__PURE__ */ jsxs(CommandList, { id: listboxId, children: [
|
|
78
|
+
/* @__PURE__ */ jsx(CommandEmpty, { children: emptyText }),
|
|
79
|
+
/* @__PURE__ */ jsx(CommandGroup, { children: options.map((option) => /* @__PURE__ */ jsx(
|
|
80
|
+
ComboboxOptionItem,
|
|
81
|
+
{
|
|
82
|
+
onSelect,
|
|
83
|
+
option,
|
|
84
|
+
selectedValue: resolvedValue
|
|
85
|
+
},
|
|
86
|
+
option.value
|
|
87
|
+
)) })
|
|
88
|
+
] })
|
|
89
|
+
] })
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
}
|
|
61
93
|
const Combobox = React.forwardRef(
|
|
62
94
|
({
|
|
63
95
|
className,
|
|
@@ -71,6 +103,7 @@ const Combobox = React.forwardRef(
|
|
|
71
103
|
value
|
|
72
104
|
}, reference) => {
|
|
73
105
|
const [open, setOpen] = React.useState(false);
|
|
106
|
+
const listboxId = React.useId();
|
|
74
107
|
const { resolvedValue, setResolvedValue } = useComboboxValue(
|
|
75
108
|
value,
|
|
76
109
|
onValueChange
|
|
@@ -86,7 +119,9 @@ const Combobox = React.forwardRef(
|
|
|
86
119
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
87
120
|
Button,
|
|
88
121
|
{
|
|
122
|
+
"aria-controls": listboxId,
|
|
89
123
|
"aria-expanded": open,
|
|
124
|
+
"aria-haspopup": "listbox",
|
|
90
125
|
className: cn("w-full justify-between", triggerClassName),
|
|
91
126
|
ref: reference,
|
|
92
127
|
role: "combobox",
|
|
@@ -98,27 +133,16 @@ const Combobox = React.forwardRef(
|
|
|
98
133
|
}
|
|
99
134
|
) }),
|
|
100
135
|
/* @__PURE__ */ jsx(
|
|
101
|
-
|
|
136
|
+
ComboboxListPanel,
|
|
102
137
|
{
|
|
103
|
-
className
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
/* @__PURE__ */ jsx(CommandGroup, { children: options.map((option) => /* @__PURE__ */ jsx(
|
|
112
|
-
ComboboxOptionItem,
|
|
113
|
-
{
|
|
114
|
-
onSelect: handleSelect,
|
|
115
|
-
option,
|
|
116
|
-
selectedValue: resolvedValue
|
|
117
|
-
},
|
|
118
|
-
option.value
|
|
119
|
-
)) })
|
|
120
|
-
] })
|
|
121
|
-
] })
|
|
138
|
+
className,
|
|
139
|
+
commandClassName,
|
|
140
|
+
emptyText,
|
|
141
|
+
listboxId,
|
|
142
|
+
onSelect: handleSelect,
|
|
143
|
+
options,
|
|
144
|
+
resolvedValue,
|
|
145
|
+
searchPlaceholder
|
|
122
146
|
}
|
|
123
147
|
)
|
|
124
148
|
] });
|
package/package.json
CHANGED