@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.cjs
CHANGED
|
@@ -1232,84 +1232,107 @@ var PopoverContent = React36__namespace.forwardRef(({ className, align = "center
|
|
|
1232
1232
|
}
|
|
1233
1233
|
) }));
|
|
1234
1234
|
PopoverContent.displayName = PopoverPrimitive__namespace.Content.displayName;
|
|
1235
|
-
var Combobox = React36__namespace.forwardRef(
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
let newValue;
|
|
1257
|
-
if (Array.isArray(value)) {
|
|
1258
|
-
newValue = value.includes(currentValue) ? value.filter((v) => v !== currentValue) : [...value, currentValue];
|
|
1259
|
-
} else {
|
|
1260
|
-
newValue = currentValue === value ? "" : currentValue;
|
|
1261
|
-
}
|
|
1262
|
-
setValue(newValue);
|
|
1263
|
-
onValueChange?.(newValue);
|
|
1264
|
-
onSelect?.(newValue);
|
|
1265
|
-
setOpen(false);
|
|
1266
|
-
}, [value, onValueChange, onSelect]);
|
|
1267
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(PopoverPrimitive.Popover, { open, onOpenChange: setOpen, children: [
|
|
1268
|
-
/* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive.PopoverTrigger, { asChild: true, children: asChild ? children : /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1269
|
-
Button,
|
|
1270
|
-
{
|
|
1271
|
-
variant: "outline",
|
|
1272
|
-
role: "combobox",
|
|
1273
|
-
"aria-expanded": open,
|
|
1274
|
-
className: cn("w-full justify-between", className),
|
|
1275
|
-
children: [
|
|
1276
|
-
/* @__PURE__ */ jsxRuntime.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 }),
|
|
1277
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactIcons.ChevronDownIcon, { className: "opacity-50" })
|
|
1278
|
-
]
|
|
1235
|
+
var Combobox = React36__namespace.forwardRef(
|
|
1236
|
+
({
|
|
1237
|
+
options,
|
|
1238
|
+
placeholder = "Select option...",
|
|
1239
|
+
searchPlaceholder = "Search...",
|
|
1240
|
+
emptyMessage = "No option found.",
|
|
1241
|
+
className,
|
|
1242
|
+
value: controlledValue,
|
|
1243
|
+
onValueChange,
|
|
1244
|
+
onSelect,
|
|
1245
|
+
asChild,
|
|
1246
|
+
children
|
|
1247
|
+
}, ref) => {
|
|
1248
|
+
const [open, setOpen] = React36__namespace.useState(false);
|
|
1249
|
+
const [value, setValue] = React36__namespace.useState(
|
|
1250
|
+
controlledValue || (Array.isArray(controlledValue) ? [] : "")
|
|
1251
|
+
);
|
|
1252
|
+
const [search, setSearch] = React36__namespace.useState("");
|
|
1253
|
+
React36__namespace.useEffect(() => {
|
|
1254
|
+
if (controlledValue !== void 0) {
|
|
1255
|
+
setValue(controlledValue);
|
|
1279
1256
|
}
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1257
|
+
}, [controlledValue]);
|
|
1258
|
+
const handleSelect = React36__namespace.useCallback(
|
|
1259
|
+
(currentValue) => {
|
|
1260
|
+
let newValue;
|
|
1261
|
+
if (Array.isArray(value)) {
|
|
1262
|
+
newValue = value.includes(currentValue) ? value.filter((v) => v !== currentValue) : [...value, currentValue];
|
|
1263
|
+
} else {
|
|
1264
|
+
newValue = currentValue === value ? "" : currentValue;
|
|
1265
|
+
}
|
|
1266
|
+
setValue(newValue);
|
|
1267
|
+
onValueChange?.(newValue);
|
|
1268
|
+
onSelect?.(newValue);
|
|
1269
|
+
setOpen(false);
|
|
1270
|
+
},
|
|
1271
|
+
[value, onValueChange, onSelect]
|
|
1272
|
+
);
|
|
1273
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(PopoverPrimitive.Popover, { open, onOpenChange: setOpen, children: [
|
|
1274
|
+
/* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive.PopoverTrigger, { asChild: true, children: asChild ? children : /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1275
|
+
Button,
|
|
1276
|
+
{
|
|
1277
|
+
variant: "outline",
|
|
1278
|
+
role: "combobox",
|
|
1279
|
+
"aria-expanded": open,
|
|
1280
|
+
className: cn("w-full justify-between", className),
|
|
1281
|
+
children: [
|
|
1282
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground font-normal", children: Array.isArray(value) ? value.map(
|
|
1283
|
+
(val) => options.find((option) => option.value === val)?.label
|
|
1284
|
+
).join(", ") : options.find((option) => option.value === value)?.label || placeholder }),
|
|
1285
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactIcons.ChevronDownIcon, { className: "opacity-50" })
|
|
1286
|
+
]
|
|
1287
|
+
}
|
|
1288
|
+
) }),
|
|
1289
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1290
|
+
PopoverContent,
|
|
1291
|
+
{
|
|
1292
|
+
className: cn("w-full p-0 !rounded-xl border-none", className),
|
|
1293
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(Command, { className: "rounded-xl border", children: [
|
|
1294
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1295
|
+
CommandInput,
|
|
1296
|
+
{
|
|
1297
|
+
value: search,
|
|
1298
|
+
onValueChange: setSearch,
|
|
1299
|
+
placeholder: searchPlaceholder,
|
|
1300
|
+
className: "h-9 w-full"
|
|
1301
|
+
}
|
|
1302
|
+
),
|
|
1303
|
+
/* @__PURE__ */ jsxRuntime.jsxs(CommandList, { children: [
|
|
1304
|
+
/* @__PURE__ */ jsxRuntime.jsx(CommandEmpty, { children: emptyMessage }),
|
|
1305
|
+
/* @__PURE__ */ jsxRuntime.jsx(CommandGroup, { children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1306
|
+
CommandItem,
|
|
1298
1307
|
{
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
)
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1308
|
+
keywords: [option.label],
|
|
1309
|
+
className: "rounded-lg",
|
|
1310
|
+
value: option.value,
|
|
1311
|
+
onSelect: () => handleSelect(option.value),
|
|
1312
|
+
onKeyUp: (e) => e.key === "Enter" && handleSelect(option.value),
|
|
1313
|
+
onKeyDown: (e) => e.key === "Enter" && handleSelect(option.value),
|
|
1314
|
+
children: [
|
|
1315
|
+
option.label,
|
|
1316
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1317
|
+
reactIcons.CheckIcon,
|
|
1318
|
+
{
|
|
1319
|
+
className: cn(
|
|
1320
|
+
"ml-auto",
|
|
1321
|
+
Array.isArray(value) ? value.includes(option.value) ? "opacity-100" : "opacity-0" : value === option.value ? "opacity-100" : "opacity-0"
|
|
1322
|
+
)
|
|
1323
|
+
}
|
|
1324
|
+
)
|
|
1325
|
+
]
|
|
1326
|
+
},
|
|
1327
|
+
`${option.value}-${option.label}`
|
|
1328
|
+
)) })
|
|
1329
|
+
] })
|
|
1330
|
+
] })
|
|
1331
|
+
}
|
|
1332
|
+
)
|
|
1333
|
+
] });
|
|
1334
|
+
}
|
|
1335
|
+
);
|
|
1313
1336
|
Combobox.displayName = "Combobox";
|
|
1314
1337
|
var ContextMenu = ContextMenuPrimitive__namespace.Root;
|
|
1315
1338
|
var ContextMenuTrigger = ContextMenuPrimitive__namespace.Trigger;
|
|
@@ -2878,7 +2901,7 @@ var Separator5 = React36__namespace.forwardRef(
|
|
|
2878
2901
|
decorative,
|
|
2879
2902
|
orientation,
|
|
2880
2903
|
className: cn(
|
|
2881
|
-
"shrink-0 bg-
|
|
2904
|
+
"shrink-0 bg-border",
|
|
2882
2905
|
orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
|
|
2883
2906
|
className
|
|
2884
2907
|
),
|
|
@@ -3800,7 +3823,7 @@ var Table = React36__namespace.forwardRef(
|
|
|
3800
3823
|
"div",
|
|
3801
3824
|
{
|
|
3802
3825
|
className: cn(
|
|
3803
|
-
"relative w-full rounded-xl border border-border overflow-auto",
|
|
3826
|
+
"relative w-full rounded-xl bg-background border border-border overflow-auto",
|
|
3804
3827
|
containerClassName
|
|
3805
3828
|
),
|
|
3806
3829
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|