@blinkdotnew/ui 0.4.0 → 0.5.1
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.d.mts +235 -232
- package/dist/index.d.ts +235 -232
- package/dist/index.js +75 -121
- package/dist/index.mjs +74 -120
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import * as React66 from 'react';
|
|
2
3
|
import React66__default, { createContext, useState, useId, useContext, useEffect, useRef, useCallback } from 'react';
|
|
3
|
-
import
|
|
4
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
4
5
|
import { clsx } from 'clsx';
|
|
5
6
|
import { twMerge } from 'tailwind-merge';
|
|
7
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
6
8
|
import { Slot, createSlot } from '@radix-ui/react-slot';
|
|
7
9
|
import { cva } from 'class-variance-authority';
|
|
8
10
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
@@ -13,7 +15,6 @@ import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
|
13
15
|
import * as SliderPrimitive from '@radix-ui/react-slider';
|
|
14
16
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
15
17
|
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
16
|
-
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
17
18
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
18
19
|
import * as ContextMenuPrimitive from '@radix-ui/react-context-menu';
|
|
19
20
|
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
@@ -51,11 +52,32 @@ import * as MenubarPrimitive from '@radix-ui/react-menubar';
|
|
|
51
52
|
import * as ResizablePrimitive from 'react-resizable-panels';
|
|
52
53
|
|
|
53
54
|
// src/provider/blink-ui-provider.tsx
|
|
55
|
+
function cn(...inputs) {
|
|
56
|
+
return twMerge(clsx(inputs));
|
|
57
|
+
}
|
|
58
|
+
var TooltipProvider = TooltipPrimitive.Provider;
|
|
59
|
+
var Tooltip = TooltipPrimitive.Root;
|
|
60
|
+
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
61
|
+
var TooltipContent = React66__default.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
62
|
+
TooltipPrimitive.Content,
|
|
63
|
+
{
|
|
64
|
+
ref,
|
|
65
|
+
sideOffset,
|
|
66
|
+
className: cn(
|
|
67
|
+
"z-50 overflow-hidden rounded-md bg-[hsl(var(--primary))] px-3 py-1.5 text-xs text-[hsl(var(--primary-foreground))] shadow-md",
|
|
68
|
+
"animate-in fade-in-0 zoom-in-95",
|
|
69
|
+
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
70
|
+
"data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2",
|
|
71
|
+
className
|
|
72
|
+
),
|
|
73
|
+
...props
|
|
74
|
+
}
|
|
75
|
+
) }));
|
|
76
|
+
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
54
77
|
var BlinkUIContext = createContext(null);
|
|
55
78
|
function useBlinkUI() {
|
|
56
79
|
const ctx = useContext(BlinkUIContext);
|
|
57
|
-
if (!ctx)
|
|
58
|
-
throw new Error("useBlinkUI must be used within <BlinkUIProvider>");
|
|
80
|
+
if (!ctx) throw new Error("useBlinkUI must be used within <BlinkUIProvider>");
|
|
59
81
|
return ctx;
|
|
60
82
|
}
|
|
61
83
|
function BlinkUIProvider({
|
|
@@ -83,10 +105,7 @@ function BlinkUIProvider({
|
|
|
83
105
|
root.classList.add(`theme-${theme}`);
|
|
84
106
|
root.classList.add(resolvedDark ? "dark" : "light");
|
|
85
107
|
}, [theme, resolvedDark]);
|
|
86
|
-
return /* @__PURE__ */ jsx(BlinkUIContext.Provider, { value: { theme, darkMode, resolvedDark, setTheme, setDarkMode }, children });
|
|
87
|
-
}
|
|
88
|
-
function cn(...inputs) {
|
|
89
|
-
return twMerge(clsx(inputs));
|
|
108
|
+
return /* @__PURE__ */ jsx(BlinkUIContext.Provider, { value: { theme, darkMode, resolvedDark, setTheme, setDarkMode }, children: /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 0, children }) });
|
|
90
109
|
}
|
|
91
110
|
var buttonVariants = cva(
|
|
92
111
|
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium font-sans transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
@@ -467,25 +486,6 @@ var PopoverContent = React66__default.forwardRef(({ className, align = "center",
|
|
|
467
486
|
}
|
|
468
487
|
) }));
|
|
469
488
|
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
470
|
-
var TooltipProvider = TooltipPrimitive.Provider;
|
|
471
|
-
var Tooltip = TooltipPrimitive.Root;
|
|
472
|
-
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
473
|
-
var TooltipContent = React66__default.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
474
|
-
TooltipPrimitive.Content,
|
|
475
|
-
{
|
|
476
|
-
ref,
|
|
477
|
-
sideOffset,
|
|
478
|
-
className: cn(
|
|
479
|
-
"z-50 overflow-hidden rounded-md bg-[hsl(var(--primary))] px-3 py-1.5 text-xs text-[hsl(var(--primary-foreground))] shadow-md",
|
|
480
|
-
"animate-in fade-in-0 zoom-in-95",
|
|
481
|
-
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
482
|
-
"data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2",
|
|
483
|
-
className
|
|
484
|
-
),
|
|
485
|
-
...props
|
|
486
|
-
}
|
|
487
|
-
) }));
|
|
488
|
-
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
489
489
|
var DropdownMenu = DropdownMenuPrimitive.Root;
|
|
490
490
|
var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
491
491
|
var DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
@@ -893,8 +893,7 @@ var SidebarItem = React66__default.forwardRef(
|
|
|
893
893
|
!collapsed && /* @__PURE__ */ jsx("span", { className: "flex-1 min-w-0 truncate", children: label }),
|
|
894
894
|
!collapsed && badge !== void 0 && /* @__PURE__ */ jsx("span", { className: "text-[10px] px-1.5 py-0.5 rounded-full bg-[hsl(var(--primary))] bg-opacity-10 text-[hsl(var(--primary))] shrink-0 font-medium", children: badge })
|
|
895
895
|
] });
|
|
896
|
-
if (href)
|
|
897
|
-
return /* @__PURE__ */ jsx("a", { href, className: cls, onClick, children: inner });
|
|
896
|
+
if (href) return /* @__PURE__ */ jsx("a", { href, className: cls, onClick, children: inner });
|
|
898
897
|
return /* @__PURE__ */ jsx("div", { ref, role: "button", tabIndex: 0, className: cls, onClick, ...props, children: inner });
|
|
899
898
|
}
|
|
900
899
|
);
|
|
@@ -1131,10 +1130,8 @@ FieldError.displayName = "FieldError";
|
|
|
1131
1130
|
function getStrength(value) {
|
|
1132
1131
|
const has = (re) => re.test(value);
|
|
1133
1132
|
const score = [value.length >= 8, has(/[A-Z]/), has(/[0-9]/), has(/[^A-Za-z0-9]/)].filter(Boolean).length;
|
|
1134
|
-
if (score <= 1)
|
|
1135
|
-
|
|
1136
|
-
if (score <= 3)
|
|
1137
|
-
return { level: "medium", width: "w-2/3", color: "bg-yellow-500" };
|
|
1133
|
+
if (score <= 1) return { level: "weak", width: "w-1/3", color: "bg-[hsl(var(--destructive))]" };
|
|
1134
|
+
if (score <= 3) return { level: "medium", width: "w-2/3", color: "bg-yellow-500" };
|
|
1138
1135
|
return { level: "strong", width: "w-full", color: "bg-green-500" };
|
|
1139
1136
|
}
|
|
1140
1137
|
var PasswordInput = React66__default.forwardRef(
|
|
@@ -1178,13 +1175,11 @@ var SearchInput = React66__default.forwardRef(
|
|
|
1178
1175
|
const isControlled = valueProp !== void 0;
|
|
1179
1176
|
const value = isControlled ? String(valueProp) : String(internalValue);
|
|
1180
1177
|
function handleChange(e) {
|
|
1181
|
-
if (!isControlled)
|
|
1182
|
-
setInternalValue(e.target.value);
|
|
1178
|
+
if (!isControlled) setInternalValue(e.target.value);
|
|
1183
1179
|
onChange?.(e.target.value);
|
|
1184
1180
|
}
|
|
1185
1181
|
function handleClear() {
|
|
1186
|
-
if (!isControlled)
|
|
1187
|
-
setInternalValue("");
|
|
1182
|
+
if (!isControlled) setInternalValue("");
|
|
1188
1183
|
onChange?.("");
|
|
1189
1184
|
onClear?.();
|
|
1190
1185
|
}
|
|
@@ -1220,10 +1215,8 @@ var SearchInput = React66__default.forwardRef(
|
|
|
1220
1215
|
);
|
|
1221
1216
|
SearchInput.displayName = "SearchInput";
|
|
1222
1217
|
function formatBytes(bytes) {
|
|
1223
|
-
if (bytes < 1024)
|
|
1224
|
-
|
|
1225
|
-
if (bytes < 1024 * 1024)
|
|
1226
|
-
return `${(bytes / 1024).toFixed(1)} KB`;
|
|
1218
|
+
if (bytes < 1024) return `${bytes} B`;
|
|
1219
|
+
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
1227
1220
|
return `${(bytes / 1024 / 1024).toFixed(1)} MB`;
|
|
1228
1221
|
}
|
|
1229
1222
|
function filterBySize(files, maxSize) {
|
|
@@ -1233,16 +1226,14 @@ function FileUpload({ accept, multiple, maxSize, onFiles, className, disabled })
|
|
|
1233
1226
|
const inputRef = useRef(null);
|
|
1234
1227
|
const [dragging, setDragging] = useState(false);
|
|
1235
1228
|
function handleFiles(raw) {
|
|
1236
|
-
if (!raw)
|
|
1237
|
-
return;
|
|
1229
|
+
if (!raw) return;
|
|
1238
1230
|
const files = filterBySize(Array.from(raw), maxSize);
|
|
1239
1231
|
onFiles?.(files);
|
|
1240
1232
|
}
|
|
1241
1233
|
function handleDrop(e) {
|
|
1242
1234
|
e.preventDefault();
|
|
1243
1235
|
setDragging(false);
|
|
1244
|
-
if (!disabled)
|
|
1245
|
-
handleFiles(e.dataTransfer.files);
|
|
1236
|
+
if (!disabled) handleFiles(e.dataTransfer.files);
|
|
1246
1237
|
}
|
|
1247
1238
|
return /* @__PURE__ */ jsxs(
|
|
1248
1239
|
"div",
|
|
@@ -1253,8 +1244,7 @@ function FileUpload({ accept, multiple, maxSize, onFiles, className, disabled })
|
|
|
1253
1244
|
onKeyDown: (e) => e.key === "Enter" && !disabled && inputRef.current?.click(),
|
|
1254
1245
|
onDragOver: (e) => {
|
|
1255
1246
|
e.preventDefault();
|
|
1256
|
-
if (!disabled)
|
|
1257
|
-
setDragging(true);
|
|
1247
|
+
if (!disabled) setDragging(true);
|
|
1258
1248
|
},
|
|
1259
1249
|
onDragLeave: () => setDragging(false),
|
|
1260
1250
|
onDrop: handleDrop,
|
|
@@ -1290,8 +1280,7 @@ function FileUpload({ accept, multiple, maxSize, onFiles, className, disabled })
|
|
|
1290
1280
|
);
|
|
1291
1281
|
}
|
|
1292
1282
|
function FileUploadPreview({ files, onRemove, className }) {
|
|
1293
|
-
if (!files.length)
|
|
1294
|
-
return null;
|
|
1283
|
+
if (!files.length) return null;
|
|
1295
1284
|
return /* @__PURE__ */ jsx("ul", { className: cn("flex flex-col gap-1", className), children: files.map((file, i) => /* @__PURE__ */ jsxs("li", { className: "flex items-center justify-between rounded-md border border-[hsl(var(--border))] px-3 py-2 text-sm", children: [
|
|
1296
1285
|
/* @__PURE__ */ jsx("span", { className: "min-w-0 truncate text-[hsl(var(--foreground))]", children: file.name }),
|
|
1297
1286
|
/* @__PURE__ */ jsxs("div", { className: "ml-2 flex shrink-0 items-center gap-2", children: [
|
|
@@ -1327,8 +1316,7 @@ function CalendarGrid({ year, month, selected, onSelect }) {
|
|
|
1327
1316
|
return /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-7 gap-0.5", children: [
|
|
1328
1317
|
DAYS.map((d) => /* @__PURE__ */ jsx("div", { className: "py-1 text-center text-xs font-medium text-[hsl(var(--muted-foreground))]", children: d }, d)),
|
|
1329
1318
|
cells.map((day, i) => {
|
|
1330
|
-
if (!day)
|
|
1331
|
-
return /* @__PURE__ */ jsx("div", {}, i);
|
|
1319
|
+
if (!day) return /* @__PURE__ */ jsx("div", {}, i);
|
|
1332
1320
|
const date = new Date(year, month, day);
|
|
1333
1321
|
const isToday = isSameDay(date, today);
|
|
1334
1322
|
const isSelected = selected && isSameDay(date, selected);
|
|
@@ -1426,15 +1414,13 @@ function FormMessage({ className, children, name }) {
|
|
|
1426
1414
|
const { formState } = useFormContext();
|
|
1427
1415
|
const error = name ? formState.errors[name] : void 0;
|
|
1428
1416
|
const message = error?.message ? String(error.message) : children;
|
|
1429
|
-
if (!message)
|
|
1430
|
-
return null;
|
|
1417
|
+
if (!message) return null;
|
|
1431
1418
|
return /* @__PURE__ */ jsx("p", { className: cn("text-xs text-[hsl(var(--destructive))]", className), children: message });
|
|
1432
1419
|
}
|
|
1433
1420
|
var StepFormContext = createContext(null);
|
|
1434
1421
|
function useStepForm() {
|
|
1435
1422
|
const ctx = useContext(StepFormContext);
|
|
1436
|
-
if (!ctx)
|
|
1437
|
-
throw new Error("useStepForm must be used within StepForm");
|
|
1423
|
+
if (!ctx) throw new Error("useStepForm must be used within StepForm");
|
|
1438
1424
|
return ctx;
|
|
1439
1425
|
}
|
|
1440
1426
|
function StepForm({ steps, onSubmit, children, className }) {
|
|
@@ -1497,8 +1483,7 @@ function ArrayField({
|
|
|
1497
1483
|
className
|
|
1498
1484
|
}) {
|
|
1499
1485
|
function add() {
|
|
1500
|
-
if (maxItems && value.length >= maxItems)
|
|
1501
|
-
return;
|
|
1486
|
+
if (maxItems && value.length >= maxItems) return;
|
|
1502
1487
|
onChange([...value, defaultItem]);
|
|
1503
1488
|
}
|
|
1504
1489
|
function remove(index) {
|
|
@@ -1568,10 +1553,8 @@ function toLabel(key) {
|
|
|
1568
1553
|
return key.replace(/([A-Z])/g, " $1").replace(/^./, (s) => s.toUpperCase());
|
|
1569
1554
|
}
|
|
1570
1555
|
function getInputType(field) {
|
|
1571
|
-
if (field instanceof z.ZodEmail)
|
|
1572
|
-
|
|
1573
|
-
if (field instanceof z.ZodURL)
|
|
1574
|
-
return "url";
|
|
1556
|
+
if (field instanceof z.ZodEmail) return "email";
|
|
1557
|
+
if (field instanceof z.ZodURL) return "url";
|
|
1575
1558
|
return "text";
|
|
1576
1559
|
}
|
|
1577
1560
|
function unwrapOptional(field) {
|
|
@@ -1639,8 +1622,7 @@ function AutoForm({ schema, onSubmit, defaultValues, submitLabel = "Submit" }) {
|
|
|
1639
1622
|
] });
|
|
1640
1623
|
}
|
|
1641
1624
|
function DataTableColumnHeader({ column, title }) {
|
|
1642
|
-
if (!column.getCanSort())
|
|
1643
|
-
return /* @__PURE__ */ jsx("span", { children: title });
|
|
1625
|
+
if (!column.getCanSort()) return /* @__PURE__ */ jsx("span", { children: title });
|
|
1644
1626
|
const sorted = column.getIsSorted();
|
|
1645
1627
|
return /* @__PURE__ */ jsxs(
|
|
1646
1628
|
"button",
|
|
@@ -1680,8 +1662,7 @@ function DataTablePagination({ table }) {
|
|
|
1680
1662
|
] });
|
|
1681
1663
|
}
|
|
1682
1664
|
function DataTableToolbar({ table, searchColumn }) {
|
|
1683
|
-
if (!searchColumn)
|
|
1684
|
-
return null;
|
|
1665
|
+
if (!searchColumn) return null;
|
|
1685
1666
|
return /* @__PURE__ */ jsx("div", { className: "py-3", children: /* @__PURE__ */ jsx(
|
|
1686
1667
|
Input,
|
|
1687
1668
|
{
|
|
@@ -1705,8 +1686,7 @@ function DataTable({ columns, data, pageSize = 10, searchable, searchColumn, loa
|
|
|
1705
1686
|
initialState: { pagination: { pageSize } },
|
|
1706
1687
|
state: { sorting }
|
|
1707
1688
|
});
|
|
1708
|
-
if (loading)
|
|
1709
|
-
return /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Array.from({ length: 5 }).map((_, i) => /* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-full" }, i)) });
|
|
1689
|
+
if (loading) return /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Array.from({ length: 5 }).map((_, i) => /* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-full" }, i)) });
|
|
1710
1690
|
return /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
|
|
1711
1691
|
searchable && /* @__PURE__ */ jsx(DataTableToolbar, { table, searchColumn }),
|
|
1712
1692
|
/* @__PURE__ */ jsx("div", { className: "rounded-md border border-[hsl(var(--border))] overflow-hidden", children: /* @__PURE__ */ jsxs("table", { className: "w-full text-sm", children: [
|
|
@@ -1736,10 +1716,8 @@ function EditableCell({ value: initial, onSave }) {
|
|
|
1736
1716
|
onChange: (e) => setVal(e.target.value),
|
|
1737
1717
|
onBlur: commit,
|
|
1738
1718
|
onKeyDown: (e) => {
|
|
1739
|
-
if (e.key === "Enter")
|
|
1740
|
-
|
|
1741
|
-
if (e.key === "Escape")
|
|
1742
|
-
setEditing(false);
|
|
1719
|
+
if (e.key === "Enter") commit();
|
|
1720
|
+
if (e.key === "Escape") setEditing(false);
|
|
1743
1721
|
}
|
|
1744
1722
|
}
|
|
1745
1723
|
);
|
|
@@ -1758,8 +1736,7 @@ function DataGrid({ columns, data: initialData, onDataChange, editable, classNam
|
|
|
1758
1736
|
const [rowSelection, setRowSelection] = React66__default.useState({});
|
|
1759
1737
|
const columnResizeMode = "onChange";
|
|
1760
1738
|
const editableColumns = React66__default.useMemo(() => {
|
|
1761
|
-
if (!editable)
|
|
1762
|
-
return columns;
|
|
1739
|
+
if (!editable) return columns;
|
|
1763
1740
|
return columns.map((col) => ({
|
|
1764
1741
|
...col,
|
|
1765
1742
|
cell: (info) => /* @__PURE__ */ jsx(
|
|
@@ -2068,8 +2045,7 @@ function Banner({
|
|
|
2068
2045
|
onDismiss?.();
|
|
2069
2046
|
}, 200);
|
|
2070
2047
|
};
|
|
2071
|
-
if (dismissed)
|
|
2072
|
-
return null;
|
|
2048
|
+
if (dismissed) return null;
|
|
2073
2049
|
return /* @__PURE__ */ jsxs(
|
|
2074
2050
|
"div",
|
|
2075
2051
|
{
|
|
@@ -2199,8 +2175,7 @@ function Breadcrumb({ children, className }) {
|
|
|
2199
2175
|
const withSeparators = [];
|
|
2200
2176
|
items.forEach((item, i) => {
|
|
2201
2177
|
withSeparators.push(item);
|
|
2202
|
-
if (i < items.length - 1)
|
|
2203
|
-
withSeparators.push(/* @__PURE__ */ jsx(BreadcrumbSeparator, {}, `sep-${i}`));
|
|
2178
|
+
if (i < items.length - 1) withSeparators.push(/* @__PURE__ */ jsx(BreadcrumbSeparator, {}, `sep-${i}`));
|
|
2204
2179
|
});
|
|
2205
2180
|
return /* @__PURE__ */ jsx("nav", { "aria-label": "breadcrumb", children: /* @__PURE__ */ jsx("ol", { className: cn("flex flex-wrap items-center gap-1", className), children: withSeparators }) });
|
|
2206
2181
|
}
|
|
@@ -2223,8 +2198,7 @@ function AddFilterPopover({ filters, onAdd }) {
|
|
|
2223
2198
|
const def = filters.find((f) => f.key === key);
|
|
2224
2199
|
const ops = def?.type === "number" ? numOps : textOps;
|
|
2225
2200
|
const handleAdd = () => {
|
|
2226
|
-
if (!key || !val)
|
|
2227
|
-
return;
|
|
2201
|
+
if (!key || !val) return;
|
|
2228
2202
|
onAdd({ key, operator: op || ops[0], value: val });
|
|
2229
2203
|
setKey("");
|
|
2230
2204
|
setOp("");
|
|
@@ -2269,8 +2243,7 @@ function Filters({ filters, value, onChange, className }) {
|
|
|
2269
2243
|
] });
|
|
2270
2244
|
}
|
|
2271
2245
|
function BulkActions({ count, actions, onClear, className }) {
|
|
2272
|
-
if (count === 0)
|
|
2273
|
-
return null;
|
|
2246
|
+
if (count === 0) return null;
|
|
2274
2247
|
return /* @__PURE__ */ jsxs("div", { className: cn("fixed bottom-6 left-1/2 -translate-x-1/2 z-50 flex items-center gap-2 rounded-full border border-[hsl(var(--border))] bg-[hsl(var(--card))] px-4 py-2 shadow-lg", className), children: [
|
|
2275
2248
|
/* @__PURE__ */ jsxs("span", { className: "text-sm font-medium text-[hsl(var(--foreground))] pr-2 border-r border-[hsl(var(--border))]", children: [
|
|
2276
2249
|
count,
|
|
@@ -2323,8 +2296,7 @@ function ToggleButtonGroup(props) {
|
|
|
2323
2296
|
}
|
|
2324
2297
|
};
|
|
2325
2298
|
return /* @__PURE__ */ jsx("div", { className: cn("inline-flex items-center gap-1 rounded-md border border-[hsl(var(--border))] bg-[hsl(var(--muted)/0.4)] p-0.5", className), children: React66__default.Children.map(children, (child) => {
|
|
2326
|
-
if (!React66__default.isValidElement(child))
|
|
2327
|
-
return child;
|
|
2299
|
+
if (!React66__default.isValidElement(child)) return child;
|
|
2328
2300
|
const tb = child;
|
|
2329
2301
|
return React66__default.cloneElement(tb, {
|
|
2330
2302
|
pressed: isPressed(tb.props.value),
|
|
@@ -2386,8 +2358,7 @@ function CommandBar({ open, onOpenChange, children, placeholder = "Search comman
|
|
|
2386
2358
|
return;
|
|
2387
2359
|
}
|
|
2388
2360
|
const focusable = items.current?.querySelectorAll("button");
|
|
2389
|
-
if (!focusable?.length)
|
|
2390
|
-
return;
|
|
2361
|
+
if (!focusable?.length) return;
|
|
2391
2362
|
const arr = Array.from(focusable);
|
|
2392
2363
|
const idx = arr.indexOf(document.activeElement);
|
|
2393
2364
|
if (e.key === "ArrowDown") {
|
|
@@ -2469,18 +2440,14 @@ function Kanban({ columns: initialColumns, onMoveCard, className }) {
|
|
|
2469
2440
|
const onDragEnd = ({ active, over }) => {
|
|
2470
2441
|
setActiveCard(null);
|
|
2471
2442
|
setOverColId(null);
|
|
2472
|
-
if (!over || active.id === over.id)
|
|
2473
|
-
return;
|
|
2443
|
+
if (!over || active.id === over.id) return;
|
|
2474
2444
|
const fromCol = findColByCard(active.id);
|
|
2475
2445
|
const toCol = cols.find((c) => c.id === over.id) ?? findColByCard(over.id);
|
|
2476
|
-
if (!fromCol || !toCol || fromCol.id === toCol.id)
|
|
2477
|
-
return;
|
|
2446
|
+
if (!fromCol || !toCol || fromCol.id === toCol.id) return;
|
|
2478
2447
|
const card = fromCol.cards.find((c) => c.id === active.id);
|
|
2479
2448
|
setCols((prev) => prev.map((c) => {
|
|
2480
|
-
if (c.id === fromCol.id)
|
|
2481
|
-
|
|
2482
|
-
if (c.id === toCol.id)
|
|
2483
|
-
return { ...c, cards: [...c.cards, card] };
|
|
2449
|
+
if (c.id === fromCol.id) return { ...c, cards: c.cards.filter((card2) => card2.id !== active.id) };
|
|
2450
|
+
if (c.id === toCol.id) return { ...c, cards: [...c.cards, card] };
|
|
2484
2451
|
return c;
|
|
2485
2452
|
}));
|
|
2486
2453
|
onMoveCard?.(active.id, fromCol.id, toCol.id);
|
|
@@ -2652,8 +2619,7 @@ function LineChart({
|
|
|
2652
2619
|
] }) }) });
|
|
2653
2620
|
}
|
|
2654
2621
|
function buildPath(data, w, h) {
|
|
2655
|
-
if (data.length < 2)
|
|
2656
|
-
return "";
|
|
2622
|
+
if (data.length < 2) return "";
|
|
2657
2623
|
const min = Math.min(...data);
|
|
2658
2624
|
const max = Math.max(...data);
|
|
2659
2625
|
const range = max - min || 1;
|
|
@@ -2674,8 +2640,7 @@ function Sparkline({
|
|
|
2674
2640
|
className
|
|
2675
2641
|
}) {
|
|
2676
2642
|
const path = buildPath(data, width, height);
|
|
2677
|
-
if (!path)
|
|
2678
|
-
return null;
|
|
2643
|
+
if (!path) return null;
|
|
2679
2644
|
const min = Math.min(...data);
|
|
2680
2645
|
const max = Math.max(...data);
|
|
2681
2646
|
const range = max - min || 1;
|
|
@@ -2727,8 +2692,7 @@ function Beacon({ color = "primary", size = "md", children, className }) {
|
|
|
2727
2692
|
var TourContext = createContext(null);
|
|
2728
2693
|
function useTour() {
|
|
2729
2694
|
const ctx = useContext(TourContext);
|
|
2730
|
-
if (!ctx)
|
|
2731
|
-
throw new Error("useTour must be used within <Tour>");
|
|
2695
|
+
if (!ctx) throw new Error("useTour must be used within <Tour>");
|
|
2732
2696
|
return ctx;
|
|
2733
2697
|
}
|
|
2734
2698
|
function Tour({ totalSteps, children }) {
|
|
@@ -2743,15 +2707,11 @@ function Tour({ totalSteps, children }) {
|
|
|
2743
2707
|
const prev = useCallback(() => setCurrentStep((s) => Math.max(s - 1, 0)), []);
|
|
2744
2708
|
const goTo = useCallback((step) => setCurrentStep(Math.max(0, Math.min(step, totalSteps - 1))), [totalSteps]);
|
|
2745
2709
|
useEffect(() => {
|
|
2746
|
-
if (!isActive)
|
|
2747
|
-
return;
|
|
2710
|
+
if (!isActive) return;
|
|
2748
2711
|
const onKey = (e) => {
|
|
2749
|
-
if (e.key === "Escape")
|
|
2750
|
-
|
|
2751
|
-
if (e.key === "
|
|
2752
|
-
next();
|
|
2753
|
-
if (e.key === "ArrowLeft")
|
|
2754
|
-
prev();
|
|
2712
|
+
if (e.key === "Escape") stop();
|
|
2713
|
+
if (e.key === "ArrowRight") next();
|
|
2714
|
+
if (e.key === "ArrowLeft") prev();
|
|
2755
2715
|
};
|
|
2756
2716
|
window.addEventListener("keydown", onKey);
|
|
2757
2717
|
return () => window.removeEventListener("keydown", onKey);
|
|
@@ -3290,8 +3250,7 @@ function InviteModal({ className }) {
|
|
|
3290
3250
|
const [role, setRole] = useState("Member");
|
|
3291
3251
|
const [pending, setPending] = useState(PENDING);
|
|
3292
3252
|
const invite = () => {
|
|
3293
|
-
if (!email.trim())
|
|
3294
|
-
return;
|
|
3253
|
+
if (!email.trim()) return;
|
|
3295
3254
|
setPending((p) => [...p, { email: email.trim(), role }]);
|
|
3296
3255
|
setEmail("");
|
|
3297
3256
|
};
|
|
@@ -3340,8 +3299,7 @@ function ManageTagsModal({ className }) {
|
|
|
3340
3299
|
const [newTag, setNewTag] = useState("");
|
|
3341
3300
|
const [colorIdx, setColorIdx] = useState(0);
|
|
3342
3301
|
const addTag = () => {
|
|
3343
|
-
if (!newTag.trim())
|
|
3344
|
-
return;
|
|
3302
|
+
if (!newTag.trim()) return;
|
|
3345
3303
|
const id = `tag-${Date.now()}`;
|
|
3346
3304
|
setTags((t) => [...t, { id, name: newTag.trim(), color: COLORS[colorIdx % COLORS.length] }]);
|
|
3347
3305
|
setNewTag("");
|
|
@@ -3604,8 +3562,7 @@ function ChatDetail({ className }) {
|
|
|
3604
3562
|
const [messages, setMessages] = useState(INITIAL_MESSAGES);
|
|
3605
3563
|
const [input, setInput] = useState("");
|
|
3606
3564
|
const send = () => {
|
|
3607
|
-
if (!input.trim())
|
|
3608
|
-
return;
|
|
3565
|
+
if (!input.trim()) return;
|
|
3609
3566
|
const now = (/* @__PURE__ */ new Date()).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
|
|
3610
3567
|
setMessages((m) => [...m, { id: `${Date.now()}`, author: "You", initials: "JD", text: input.trim(), time: now, self: true }]);
|
|
3611
3568
|
setInput("");
|
|
@@ -4240,11 +4197,9 @@ var Label4 = React66.forwardRef((props, forwardedRef) => {
|
|
|
4240
4197
|
ref: forwardedRef,
|
|
4241
4198
|
onMouseDown: (event) => {
|
|
4242
4199
|
const target = event.target;
|
|
4243
|
-
if (target.closest("button, input, select, textarea"))
|
|
4244
|
-
return;
|
|
4200
|
+
if (target.closest("button, input, select, textarea")) return;
|
|
4245
4201
|
props.onMouseDown?.(event);
|
|
4246
|
-
if (!event.defaultPrevented && event.detail > 1)
|
|
4247
|
-
event.preventDefault();
|
|
4202
|
+
if (!event.defaultPrevented && event.detail > 1) event.preventDefault();
|
|
4248
4203
|
}
|
|
4249
4204
|
}
|
|
4250
4205
|
);
|
|
@@ -4869,8 +4824,7 @@ function CalendarDayButton({
|
|
|
4869
4824
|
const defaultClassNames = getDefaultClassNames();
|
|
4870
4825
|
const ref = React66.useRef(null);
|
|
4871
4826
|
React66.useEffect(() => {
|
|
4872
|
-
if (modifiers.focused)
|
|
4873
|
-
ref.current?.focus();
|
|
4827
|
+
if (modifiers.focused) ref.current?.focus();
|
|
4874
4828
|
}, [modifiers.focused]);
|
|
4875
4829
|
return /* @__PURE__ */ jsx(
|
|
4876
4830
|
Button,
|
|
@@ -5544,5 +5498,5 @@ function Spinner({ className, ...props }) {
|
|
|
5544
5498
|
}
|
|
5545
5499
|
|
|
5546
5500
|
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AppShell, AppShellMain, AppShellSidebar, AreaChart, ArrayField, AspectRatio, AutoForm, Avatar, AvatarFallback, AvatarImage, Badge, Banner, BarChart, Beacon, BlinkUIProvider, Breadcrumb, BreadcrumbItem, BreadcrumbPage, BreadcrumbSeparator, BulkActions, Button, Calendar3 as Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, ChartContainer, ChartLegend, ChartLegendContent, ChartTooltip, ChartTooltipContent, ChatDetail, Checkbox, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, CommandBar, CommandBarEmpty, CommandBarGroup, CommandBarItem, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, Command as CommandPrimitive, CommandSeparator, Container, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DataGrid, DataTable, DataTableColumnHeader, DataTablePagination, DataTableToolbar, DatePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, EmptyStateIcon, FeedbackModal, Field, FieldDescription, FieldError, FieldLabel, FileCards, FileUpload, FileUploadPreview, FilesList, FilterBadge, Filters, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, HStack, HotkeyBadge, Hotkeys, HoverCard, HoverCardContent, HoverCardTrigger, IconBadge, Input, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, IntegrationCard, InviteModal, Kanban, KanbanCard, KanbanColumn, Label5 as Label, LineChart, LoadingOverlay, ManageTagsModal, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, MessagesCard, MetricCard, MetricCardWithButton, MetricCardWithIcon, MobileSidebarTrigger, Navbar, NavbarBrand, NavbarContent, NavbarItem, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NotificationSettings, ObjectField, OrgMenu, Page, PageActions, PageBody, PageDescription, PageHeader, PageTitle, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PasswordInput, Persona, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, PropertyItem, PropertyList, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, ResizeBox, ResizeHandle, RolesMenu, ScrollArea, ScrollBar, SearchInput, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectUsersModal, SelectValue, Separator4 as Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupLabel, SidebarHeader, SidebarItem, SidebarLayoutDashboard, SidebarLayoutGroups, SidebarLayoutMinimal, SidebarLayoutSearch, SidebarLayoutUser, SidebarSeparator, Skeleton, Slider, SortableTaskList, Sparkline, Spinner, SplitPage, SplitPageDetail, SplitPageList, Stack, StackedLayoutBranded, StackedLayoutTabs, Stat, StatGroup, StepForm, StepFormNavigation, StepFormStep, Stepper, StructuredList, StructuredListItem, StructuredListSection, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TaskCard, TaskCardWithLabels, Textarea, Timeline, TimelineConnector, TimelineContent, TimelineItem, Toaster, Toggle, ToggleButton, ToggleButtonGroup, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Tour, TourStep, UserMenu, VStack, WorkspaceMembers, badgeVariants, buttonVariants, cn, navigationMenuTriggerStyle, toggleVariants, useAppShell, useBlinkUI, useCommandBar, useFormField, useTour };
|
|
5547
|
-
//# sourceMappingURL=
|
|
5501
|
+
//# sourceMappingURL=index.mjs.map
|
|
5548
5502
|
//# sourceMappingURL=index.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blinkdotnew/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Blink UI SDK — production-quality React component library for SaaS apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"blink",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"src/styles.css"
|
|
41
41
|
],
|
|
42
42
|
"scripts": {
|
|
43
|
-
"build": "tsup",
|
|
43
|
+
"build": "tsup && node scripts/prepend-use-client.mjs",
|
|
44
44
|
"dev": "tsup --watch",
|
|
45
45
|
"storybook": "storybook dev -p 6006",
|
|
46
46
|
"build-storybook": "storybook build",
|