@nuvia/components 1.4.1 → 1.4.2
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/index.cjs +101 -78
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +101 -78
- package/dist/index.js.map +1 -1
- package/dist/ui/combobox.cjs +99 -76
- package/dist/ui/combobox.cjs.map +1 -1
- package/dist/ui/combobox.js +99 -76
- package/dist/ui/combobox.js.map +1 -1
- package/dist/ui/separator.cjs +1 -1
- package/dist/ui/separator.cjs.map +1 -1
- package/dist/ui/separator.js +1 -1
- package/dist/ui/separator.js.map +1 -1
- package/dist/ui/sidebar.cjs +1 -1
- package/dist/ui/sidebar.cjs.map +1 -1
- package/dist/ui/sidebar.js +1 -1
- package/dist/ui/sidebar.js.map +1 -1
- package/dist/ui/table.cjs +1 -1
- package/dist/ui/table.cjs.map +1 -1
- package/dist/ui/table.js +1 -1
- package/dist/ui/table.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1181,84 +1181,107 @@ var PopoverContent = React36.forwardRef(({ className, align = "center", sideOffs
|
|
|
1181
1181
|
}
|
|
1182
1182
|
) }));
|
|
1183
1183
|
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
1184
|
-
var Combobox = React36.forwardRef(
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
let newValue;
|
|
1206
|
-
if (Array.isArray(value)) {
|
|
1207
|
-
newValue = value.includes(currentValue) ? value.filter((v) => v !== currentValue) : [...value, currentValue];
|
|
1208
|
-
} else {
|
|
1209
|
-
newValue = currentValue === value ? "" : currentValue;
|
|
1210
|
-
}
|
|
1211
|
-
setValue(newValue);
|
|
1212
|
-
onValueChange?.(newValue);
|
|
1213
|
-
onSelect?.(newValue);
|
|
1214
|
-
setOpen(false);
|
|
1215
|
-
}, [value, onValueChange, onSelect]);
|
|
1216
|
-
return /* @__PURE__ */ jsxs(Popover$1, { open, onOpenChange: setOpen, children: [
|
|
1217
|
-
/* @__PURE__ */ jsx(PopoverTrigger$1, { asChild: true, children: asChild ? children : /* @__PURE__ */ jsxs(
|
|
1218
|
-
Button,
|
|
1219
|
-
{
|
|
1220
|
-
variant: "outline",
|
|
1221
|
-
role: "combobox",
|
|
1222
|
-
"aria-expanded": open,
|
|
1223
|
-
className: cn("w-full justify-between", className),
|
|
1224
|
-
children: [
|
|
1225
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground font-normal", children: Array.isArray(value) ? value.map((val) => options.find((option) => option.value === val)?.label).join(", ") : options.find((option) => option.value === value)?.label || placeholder }),
|
|
1226
|
-
/* @__PURE__ */ jsx(ChevronDownIcon, { className: "opacity-50" })
|
|
1227
|
-
]
|
|
1184
|
+
var Combobox = React36.forwardRef(
|
|
1185
|
+
({
|
|
1186
|
+
options,
|
|
1187
|
+
placeholder = "Select option...",
|
|
1188
|
+
searchPlaceholder = "Search...",
|
|
1189
|
+
emptyMessage = "No option found.",
|
|
1190
|
+
className,
|
|
1191
|
+
value: controlledValue,
|
|
1192
|
+
onValueChange,
|
|
1193
|
+
onSelect,
|
|
1194
|
+
asChild,
|
|
1195
|
+
children
|
|
1196
|
+
}, ref) => {
|
|
1197
|
+
const [open, setOpen] = React36.useState(false);
|
|
1198
|
+
const [value, setValue] = React36.useState(
|
|
1199
|
+
controlledValue || (Array.isArray(controlledValue) ? [] : "")
|
|
1200
|
+
);
|
|
1201
|
+
const [search, setSearch] = React36.useState("");
|
|
1202
|
+
React36.useEffect(() => {
|
|
1203
|
+
if (controlledValue !== void 0) {
|
|
1204
|
+
setValue(controlledValue);
|
|
1228
1205
|
}
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1206
|
+
}, [controlledValue]);
|
|
1207
|
+
const handleSelect = React36.useCallback(
|
|
1208
|
+
(currentValue) => {
|
|
1209
|
+
let newValue;
|
|
1210
|
+
if (Array.isArray(value)) {
|
|
1211
|
+
newValue = value.includes(currentValue) ? value.filter((v) => v !== currentValue) : [...value, currentValue];
|
|
1212
|
+
} else {
|
|
1213
|
+
newValue = currentValue === value ? "" : currentValue;
|
|
1214
|
+
}
|
|
1215
|
+
setValue(newValue);
|
|
1216
|
+
onValueChange?.(newValue);
|
|
1217
|
+
onSelect?.(newValue);
|
|
1218
|
+
setOpen(false);
|
|
1219
|
+
},
|
|
1220
|
+
[value, onValueChange, onSelect]
|
|
1221
|
+
);
|
|
1222
|
+
return /* @__PURE__ */ jsxs(Popover$1, { open, onOpenChange: setOpen, children: [
|
|
1223
|
+
/* @__PURE__ */ jsx(PopoverTrigger$1, { asChild: true, children: asChild ? children : /* @__PURE__ */ jsxs(
|
|
1224
|
+
Button,
|
|
1225
|
+
{
|
|
1226
|
+
variant: "outline",
|
|
1227
|
+
role: "combobox",
|
|
1228
|
+
"aria-expanded": open,
|
|
1229
|
+
className: cn("w-full justify-between", className),
|
|
1230
|
+
children: [
|
|
1231
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground font-normal", children: Array.isArray(value) ? value.map(
|
|
1232
|
+
(val) => options.find((option) => option.value === val)?.label
|
|
1233
|
+
).join(", ") : options.find((option) => option.value === value)?.label || placeholder }),
|
|
1234
|
+
/* @__PURE__ */ jsx(ChevronDownIcon, { className: "opacity-50" })
|
|
1235
|
+
]
|
|
1236
|
+
}
|
|
1237
|
+
) }),
|
|
1238
|
+
/* @__PURE__ */ jsx(
|
|
1239
|
+
PopoverContent,
|
|
1240
|
+
{
|
|
1241
|
+
className: cn("w-full p-0 !rounded-xl border-none", className),
|
|
1242
|
+
children: /* @__PURE__ */ jsxs(Command, { className: "rounded-xl border", children: [
|
|
1243
|
+
/* @__PURE__ */ jsx(
|
|
1244
|
+
CommandInput,
|
|
1245
|
+
{
|
|
1246
|
+
value: search,
|
|
1247
|
+
onValueChange: setSearch,
|
|
1248
|
+
placeholder: searchPlaceholder,
|
|
1249
|
+
className: "h-9 w-full"
|
|
1250
|
+
}
|
|
1251
|
+
),
|
|
1252
|
+
/* @__PURE__ */ jsxs(CommandList, { children: [
|
|
1253
|
+
/* @__PURE__ */ jsx(CommandEmpty, { children: emptyMessage }),
|
|
1254
|
+
/* @__PURE__ */ jsx(CommandGroup, { children: options.map((option) => /* @__PURE__ */ jsxs(
|
|
1255
|
+
CommandItem,
|
|
1247
1256
|
{
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
)
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1257
|
+
keywords: [option.label],
|
|
1258
|
+
className: "rounded-lg",
|
|
1259
|
+
value: option.value,
|
|
1260
|
+
onSelect: () => handleSelect(option.value),
|
|
1261
|
+
onKeyUp: (e) => e.key === "Enter" && handleSelect(option.value),
|
|
1262
|
+
onKeyDown: (e) => e.key === "Enter" && handleSelect(option.value),
|
|
1263
|
+
children: [
|
|
1264
|
+
option.label,
|
|
1265
|
+
/* @__PURE__ */ jsx(
|
|
1266
|
+
CheckIcon,
|
|
1267
|
+
{
|
|
1268
|
+
className: cn(
|
|
1269
|
+
"ml-auto",
|
|
1270
|
+
Array.isArray(value) ? value.includes(option.value) ? "opacity-100" : "opacity-0" : value === option.value ? "opacity-100" : "opacity-0"
|
|
1271
|
+
)
|
|
1272
|
+
}
|
|
1273
|
+
)
|
|
1274
|
+
]
|
|
1275
|
+
},
|
|
1276
|
+
`${option.value}-${option.label}`
|
|
1277
|
+
)) })
|
|
1278
|
+
] })
|
|
1279
|
+
] })
|
|
1280
|
+
}
|
|
1281
|
+
)
|
|
1282
|
+
] });
|
|
1283
|
+
}
|
|
1284
|
+
);
|
|
1262
1285
|
Combobox.displayName = "Combobox";
|
|
1263
1286
|
var ContextMenu = ContextMenuPrimitive.Root;
|
|
1264
1287
|
var ContextMenuTrigger = ContextMenuPrimitive.Trigger;
|
|
@@ -2827,7 +2850,7 @@ var Separator5 = React36.forwardRef(
|
|
|
2827
2850
|
decorative,
|
|
2828
2851
|
orientation,
|
|
2829
2852
|
className: cn(
|
|
2830
|
-
"shrink-0 bg-
|
|
2853
|
+
"shrink-0 bg-border",
|
|
2831
2854
|
orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
|
|
2832
2855
|
className
|
|
2833
2856
|
),
|
|
@@ -3749,7 +3772,7 @@ var Table = React36.forwardRef(
|
|
|
3749
3772
|
"div",
|
|
3750
3773
|
{
|
|
3751
3774
|
className: cn(
|
|
3752
|
-
"relative w-full rounded-xl border border-border overflow-auto",
|
|
3775
|
+
"relative w-full rounded-xl bg-background border border-border overflow-auto",
|
|
3753
3776
|
containerClassName
|
|
3754
3777
|
),
|
|
3755
3778
|
children: /* @__PURE__ */ jsx(
|