tembro 6.1.0 → 6.1.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/components/actions/action-menu.d.ts +11 -1
- package/dist/components/display/index.d.ts +0 -2
- package/dist/components/filters/index.d.ts +0 -1
- package/dist/components/inputs/time-picker.d.ts +11 -3
- package/dist/components/modern/file-manager.d.ts +1 -1
- package/dist/components/modern/index.d.ts +3 -1
- package/dist/components/modern/map.cjs +1 -0
- package/dist/components/modern/map.d.ts +29 -0
- package/dist/components/modern/map.js +1 -0
- package/dist/components/modern/media-player.cjs +1 -0
- package/dist/components/modern/media-player.d.ts +21 -0
- package/dist/components/modern/media-player.js +1 -0
- package/dist/components/modern/spreadsheet.cjs +1 -0
- package/dist/components/modern/spreadsheet.d.ts +35 -0
- package/dist/components/modern/spreadsheet.js +1 -0
- package/dist/components/overlay/drawer.d.ts +3 -1
- package/dist/index.d.ts +0 -2
- package/dist/src/components/actions/action-menu.cjs +1 -1
- package/dist/src/components/actions/action-menu.js +47 -39
- package/dist/src/components/actions/copy-button.cjs +1 -1
- package/dist/src/components/actions/copy-button.js +4 -1
- package/dist/src/components/calendar/date-picker.cjs +1 -1
- package/dist/src/components/calendar/date-picker.js +5 -8
- package/dist/src/components/calendar/date-range-picker.cjs +1 -1
- package/dist/src/components/calendar/date-range-picker.js +12 -27
- package/dist/src/components/data-table/data-table.cjs +1 -1
- package/dist/src/components/data-table/data-table.js +172 -171
- package/dist/src/components/display/index.cjs +1 -1
- package/dist/src/components/display/index.js +9 -11
- package/dist/src/components/filters/index.cjs +1 -1
- package/dist/src/components/filters/index.js +2 -3
- package/dist/src/components/inputs/color-picker.cjs +1 -1
- package/dist/src/components/inputs/color-picker.js +63 -46
- package/dist/src/components/inputs/slider.cjs +1 -1
- package/dist/src/components/inputs/slider.js +3 -3
- package/dist/src/components/inputs/tag-input.cjs +1 -1
- package/dist/src/components/inputs/tag-input.js +7 -4
- package/dist/src/components/inputs/time-picker.cjs +1 -1
- package/dist/src/components/inputs/time-picker.js +90 -34
- package/dist/src/components/modern/index.cjs +1 -1
- package/dist/src/components/modern/index.js +6 -4
- package/dist/src/components/modern/map.cjs +1 -0
- package/dist/src/components/modern/map.js +158 -0
- package/dist/src/components/modern/media-player.cjs +1 -0
- package/dist/src/components/modern/media-player.js +176 -0
- package/dist/src/components/modern/resizable-panel.cjs +1 -1
- package/dist/src/components/modern/resizable-panel.js +39 -32
- package/dist/src/components/modern/spreadsheet.cjs +1 -0
- package/dist/src/components/modern/spreadsheet.js +97 -0
- package/dist/src/components/navigation/pagination.cjs +1 -1
- package/dist/src/components/navigation/pagination.js +5 -5
- package/dist/src/components/notifications/toast.cjs +1 -1
- package/dist/src/components/notifications/toast.js +68 -63
- package/dist/src/components/overlay/alert-dialog.cjs +1 -1
- package/dist/src/components/overlay/alert-dialog.js +8 -6
- package/dist/src/components/overlay/drawer.cjs +1 -1
- package/dist/src/components/overlay/drawer.js +38 -20
- package/dist/src/components/ui/checkbox/index.cjs +1 -1
- package/dist/src/components/ui/checkbox/index.js +2 -1
- package/dist/src/components/ui/dialog/index.cjs +1 -1
- package/dist/src/components/ui/dialog/index.js +8 -8
- package/dist/src/components/ui/dropdown-menu/index.cjs +1 -1
- package/dist/src/components/ui/dropdown-menu/index.js +21 -19
- package/dist/src/components/ui/popover/index.cjs +1 -1
- package/dist/src/components/ui/popover/index.js +10 -10
- package/dist/src/components/ui/tabs/index.cjs +1 -1
- package/dist/src/components/ui/tabs/index.js +6 -6
- package/dist/src/components/ui/toggle-group/index.cjs +1 -1
- package/dist/src/components/ui/toggle-group/index.js +2 -2
- package/dist/src/index.cjs +1 -1
- package/dist/src/index.js +80 -83
- package/dist/src/public-component-surface.cjs +1 -1
- package/dist/src/public-component-surface.js +15 -20
- package/package.json +1 -2
- package/packages/cli/dist/index.cjs +58 -178
- package/packages/cli/vendor/src/components/actions/action-menu.tsx +47 -19
- package/packages/cli/vendor/src/components/actions/copy-button.tsx +2 -2
- package/packages/cli/vendor/src/components/calendar/date-picker.tsx +2 -5
- package/packages/cli/vendor/src/components/calendar/date-range-picker.tsx +5 -12
- package/packages/cli/vendor/src/components/data-table/data-table.tsx +45 -34
- package/packages/cli/vendor/src/components/display/index.ts +3 -5
- package/packages/cli/vendor/src/components/filters/index.ts +0 -1
- package/packages/cli/vendor/src/components/inputs/color-picker.tsx +15 -1
- package/packages/cli/vendor/src/components/inputs/slider.tsx +3 -3
- package/packages/cli/vendor/src/components/inputs/tag-input.tsx +4 -4
- package/packages/cli/vendor/src/components/inputs/time-picker.tsx +91 -38
- package/packages/cli/vendor/src/components/modern/file-manager.tsx +1 -1
- package/packages/cli/vendor/src/components/modern/index.ts +3 -1
- package/packages/cli/vendor/src/components/modern/map.tsx +146 -0
- package/packages/cli/vendor/src/components/modern/media-player.tsx +182 -0
- package/packages/cli/vendor/src/components/modern/resizable-panel.tsx +15 -5
- package/packages/cli/vendor/src/components/modern/spreadsheet.tsx +155 -0
- package/packages/cli/vendor/src/components/navigation/pagination.tsx +9 -5
- package/packages/cli/vendor/src/components/notifications/toast.tsx +20 -10
- package/packages/cli/vendor/src/components/overlay/alert-dialog.tsx +3 -5
- package/packages/cli/vendor/src/components/overlay/drawer.tsx +22 -11
- package/packages/cli/vendor/src/components/ui/checkbox/index.tsx +3 -1
- package/packages/cli/vendor/src/components/ui/dialog/index.tsx +4 -4
- package/packages/cli/vendor/src/components/ui/dropdown-menu/index.tsx +18 -22
- package/packages/cli/vendor/src/components/ui/popover/index.tsx +4 -4
- package/packages/cli/vendor/src/components/ui/tabs/index.tsx +8 -3
- package/packages/cli/vendor/src/components/ui/toggle-group/index.tsx +6 -6
- package/packages/cli/vendor/src/index.ts +0 -2
- package/packages/cli/vendor/src/public-component-surface.ts +3 -4
- package/packages/cli/vendor/templates/showcase/src/showcase/data/registry.ts +6 -6
- package/packages/cli/vendor/templates/showcase/src/showcase/layout/HeroSection.tsx +23 -8
- package/packages/cli/vendor/templates/showcase/src/showcase/layout/WorkbenchSidebar.tsx +1 -1
- package/packages/cli/vendor/templates/showcase/src/showcase/sections/PatternsSection.tsx +1 -1
- package/packages/cli/vendor/templates/styles/globals.css +0 -120
- package/registry.json +74 -141
- package/dist/components/display/info-card.cjs +0 -1
- package/dist/components/display/info-card.d.ts +0 -51
- package/dist/components/display/info-card.js +0 -1
- package/dist/components/display/statistic.cjs +0 -1
- package/dist/components/display/statistic.d.ts +0 -25
- package/dist/components/display/statistic.js +0 -1
- package/dist/components/filters/filter-bar.cjs +0 -1
- package/dist/components/filters/filter-bar.d.ts +0 -28
- package/dist/components/filters/filter-bar.js +0 -1
- package/dist/components/modern/image-cropper.cjs +0 -1
- package/dist/components/modern/image-cropper.d.ts +0 -39
- package/dist/components/modern/image-cropper.js +0 -1
- package/dist/components/ui/number-field/index.cjs +0 -1
- package/dist/components/ui/number-field/index.d.ts +0 -18
- package/dist/components/ui/number-field/index.js +0 -1
- package/dist/components/ui/toolbar/index.cjs +0 -1
- package/dist/components/ui/toolbar/index.d.ts +0 -14
- package/dist/components/ui/toolbar/index.js +0 -1
- package/dist/src/components/display/info-card.cjs +0 -1
- package/dist/src/components/display/info-card.js +0 -124
- package/dist/src/components/display/statistic.cjs +0 -1
- package/dist/src/components/display/statistic.js +0 -104
- package/dist/src/components/filters/filter-bar.cjs +0 -1
- package/dist/src/components/filters/filter-bar.js +0 -103
- package/dist/src/components/modern/image-cropper.cjs +0 -1
- package/dist/src/components/modern/image-cropper.js +0 -143
- package/dist/src/components/ui/number-field/index.cjs +0 -1
- package/dist/src/components/ui/number-field/index.js +0 -73
- package/dist/src/components/ui/toolbar/index.cjs +0 -1
- package/dist/src/components/ui/toolbar/index.js +0 -50
- package/packages/cli/vendor/src/components/display/info-card.tsx +0 -195
- package/packages/cli/vendor/src/components/display/statistic.tsx +0 -114
- package/packages/cli/vendor/src/components/filters/filter-bar.tsx +0 -163
- package/packages/cli/vendor/src/components/modern/image-cropper.tsx +0 -226
- package/packages/cli/vendor/src/components/ui/number-field/index.tsx +0 -89
- package/packages/cli/vendor/src/components/ui/toolbar/index.tsx +0 -67
|
@@ -10,191 +10,192 @@ import { DataTableColumnVisibilityMenu as ae } from "./data-table-column-visibil
|
|
|
10
10
|
import { DataTablePagination as oe } from "./data-table-pagination.js";
|
|
11
11
|
import { DataTableToolbar as se } from "./data-table-toolbar.js";
|
|
12
12
|
import { useVirtualizer as ce } from "../../../node_modules/@tanstack/react-virtual/dist/esm/index.js";
|
|
13
|
-
import { DataState as
|
|
14
|
-
import { useIsMobile as
|
|
15
|
-
import * as
|
|
16
|
-
import { Fragment as
|
|
17
|
-
import { flexRender as
|
|
13
|
+
import { DataState as le } from "../display/data-state.js";
|
|
14
|
+
import { useIsMobile as ue } from "../../hooks/use-is-mobile.js";
|
|
15
|
+
import * as s from "react";
|
|
16
|
+
import { Fragment as de, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
17
|
+
import { flexRender as u, getCoreRowModel as fe, getExpandedRowModel as pe, getPaginationRowModel as me, getSortedRowModel as he, useReactTable as ge } from "@tanstack/react-table";
|
|
18
18
|
//#region src/components/data-table/data-table.tsx
|
|
19
|
-
var
|
|
19
|
+
var _e = {
|
|
20
20
|
compact: "h-8 px-2 py-1.5",
|
|
21
21
|
default: "h-10 px-2 py-2",
|
|
22
22
|
comfortable: "h-12 px-3 py-3"
|
|
23
|
-
},
|
|
23
|
+
}, ve = {
|
|
24
24
|
compact: "px-2 py-1.5",
|
|
25
25
|
default: "p-2",
|
|
26
26
|
comfortable: "px-3 py-3"
|
|
27
27
|
};
|
|
28
|
-
function
|
|
28
|
+
function ye(e, t) {
|
|
29
29
|
return typeof t == "function" ? t(e) : t;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function be(e, t) {
|
|
32
32
|
return typeof t == "function" ? t(e) : t;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function xe(e, t) {
|
|
35
35
|
return typeof t == "function" ? t(e) : t;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function Se(e) {
|
|
38
38
|
return e == null || e === "";
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function Ce(e) {
|
|
41
41
|
let t = e.column.columnDef.header;
|
|
42
42
|
return typeof t == "string" ? t : typeof t == "number" ? String(t) : e.column.id === "actions" ? "Actions" : e.column.id;
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
let
|
|
46
|
-
let e =
|
|
47
|
-
return !
|
|
44
|
+
function we({ className: we, columns: Te, data: d, title: f, description: p, features: m, search: h, filters: g, summary: _, toolbarActions: v, rowActions: y, bulkActions: b, onRefresh: x, onExport: S, refreshLabel: Ee = "Refresh", exportLabel: De = "Export", getRowId: Oe, isLoading: C = !1, isError: ke = !1, emptyState: Ae, errorState: je, loadingState: w, loadingVariant: Me = "skeleton", toolbar: T, toolbarProps: E, pagination: D, sorting: Ne, onSortingChange: Pe, columnVisibility: Fe, onColumnVisibilityChange: Ie, rowSelection: Le, onRowSelectionChange: Re, enableRowSelection: ze, renderMobileCard: O, mobileLayout: Be = "auto", onRowClick: k, onRowDoubleClick: Ve, getRowDisabled: A, density: j = "default", striped: M = !1, bordered: N = !1, stickyHeader: P = !1, skeletonRows: He = 6, skeletonCellClassName: Ue, cellFallback: F = "-", tableClassName: We, tableWrapperClassName: Ge, headerCellClassName: Ke, cellClassName: qe, rowClassName: I, renderExpandedRow: Je, expanded: Ye, onExpandedChange: Xe, getRowCanExpand: Ze, columnPinning: Qe, onColumnPinningChange: $e, virtualization: et, ...tt }) {
|
|
45
|
+
let nt = s.useMemo(() => {
|
|
46
|
+
let e = Te;
|
|
47
|
+
return !y || m?.rowActions === !1 ? e : [...e, re({ getActions: y })];
|
|
48
48
|
}, [
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
]),
|
|
53
|
-
pageIndex:
|
|
54
|
-
pageSize:
|
|
55
|
-
} : void 0,
|
|
56
|
-
data:
|
|
57
|
-
columns:
|
|
58
|
-
getRowId:
|
|
59
|
-
getCoreRowModel:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
49
|
+
Te,
|
|
50
|
+
m?.rowActions,
|
|
51
|
+
y
|
|
52
|
+
]), L = D === !1 ? void 0 : D, [rt, it] = s.useState([]), [at, ot] = s.useState({}), [st, ct] = s.useState({}), [lt, ut] = s.useState({}), [dt, ft] = s.useState({}), pt = Ne ?? rt, mt = Fe ?? at, ht = Le ?? st, gt = Ye ?? lt, _t = Qe ?? dt, vt = L ? {
|
|
53
|
+
pageIndex: L.pageIndex,
|
|
54
|
+
pageSize: L.pageSize
|
|
55
|
+
} : void 0, yt = !!(L && L.manual !== !1), R = ge({
|
|
56
|
+
data: d,
|
|
57
|
+
columns: nt,
|
|
58
|
+
getRowId: Oe,
|
|
59
|
+
getCoreRowModel: fe(),
|
|
60
|
+
getSortedRowModel: he(),
|
|
61
|
+
getPaginationRowModel: L && !yt ? me() : void 0,
|
|
62
|
+
manualPagination: yt,
|
|
63
|
+
pageCount: L?.pageCount,
|
|
63
64
|
state: {
|
|
64
|
-
sorting:
|
|
65
|
-
columnVisibility:
|
|
66
|
-
rowSelection:
|
|
67
|
-
pagination:
|
|
68
|
-
expanded:
|
|
69
|
-
|
|
65
|
+
sorting: pt,
|
|
66
|
+
columnVisibility: mt,
|
|
67
|
+
rowSelection: ht,
|
|
68
|
+
pagination: vt,
|
|
69
|
+
expanded: gt,
|
|
70
|
+
columnPinning: _t
|
|
70
71
|
},
|
|
71
|
-
onSortingChange:
|
|
72
|
-
onColumnVisibilityChange:
|
|
73
|
-
onRowSelectionChange:
|
|
74
|
-
onExpandedChange:
|
|
75
|
-
onColumnPinningChange:
|
|
76
|
-
enableRowSelection:
|
|
77
|
-
getRowCanExpand:
|
|
78
|
-
getExpandedRowModel:
|
|
79
|
-
}),
|
|
80
|
-
count: V ?
|
|
81
|
-
getScrollElement: () =>
|
|
72
|
+
onSortingChange: Pe ?? it,
|
|
73
|
+
onColumnVisibilityChange: Ie ?? ot,
|
|
74
|
+
onRowSelectionChange: Re ?? ct,
|
|
75
|
+
onExpandedChange: Xe ?? ut,
|
|
76
|
+
onColumnPinningChange: $e ?? ft,
|
|
77
|
+
enableRowSelection: ze,
|
|
78
|
+
getRowCanExpand: Ze,
|
|
79
|
+
getExpandedRowModel: pe()
|
|
80
|
+
}), z = R.getRowModel().rows, bt = s.useRef(null), B = et === !1 ? void 0 : et, V = !!(B && B.enabled !== !1 && z.length > 0), H = B?.height ?? 480, xt = B?.onRangeChange, U = ce({
|
|
81
|
+
count: V ? z.length : 0,
|
|
82
|
+
getScrollElement: () => bt.current,
|
|
82
83
|
estimateSize: () => B?.estimateRowHeight ?? 48,
|
|
83
|
-
getItemKey: (e) =>
|
|
84
|
+
getItemKey: (e) => z[e]?.id ?? e,
|
|
84
85
|
overscan: B?.overscan ?? 8,
|
|
85
86
|
initialRect: {
|
|
86
87
|
width: 0,
|
|
87
88
|
height: typeof H == "number" ? H : 480
|
|
88
89
|
},
|
|
89
90
|
onChange(e) {
|
|
90
|
-
if (!
|
|
91
|
+
if (!xt) return;
|
|
91
92
|
let t = e.getVirtualItems();
|
|
92
|
-
|
|
93
|
+
xt({
|
|
93
94
|
startIndex: t[0]?.index ?? -1,
|
|
94
95
|
endIndex: t.at(-1)?.index ?? -1
|
|
95
96
|
});
|
|
96
97
|
}
|
|
97
|
-
}),
|
|
98
|
-
key:
|
|
98
|
+
}), St = V ? U.getVirtualItems() : [], W = B?.estimateRowHeight ?? 48, Ct = V ? Math.min(z.length, Math.ceil((typeof H == "number" ? H : 480) / W) + (B?.overscan ?? 8)) : 0, G = St.length > 0 ? St : Array.from({ length: Ct }, (e, t) => ({
|
|
99
|
+
key: z[t]?.id ?? t,
|
|
99
100
|
index: t,
|
|
100
101
|
start: t * W,
|
|
101
102
|
end: (t + 1) * W,
|
|
102
103
|
size: W,
|
|
103
104
|
lane: 0
|
|
104
|
-
})),
|
|
105
|
-
table:
|
|
106
|
-
data:
|
|
105
|
+
})), wt = G[0]?.start ?? 0, Tt = G.length ? Math.max(U.getTotalSize() - G[G.length - 1].end, 0) : 0, K = R.getSelectedRowModel().rows.map((e) => e.original), Et = K.length, q = s.useMemo(() => ({
|
|
106
|
+
table: R,
|
|
107
|
+
data: d,
|
|
107
108
|
selectedRows: K
|
|
108
109
|
}), [
|
|
109
|
-
|
|
110
|
+
d,
|
|
110
111
|
K,
|
|
111
|
-
|
|
112
|
-
]),
|
|
112
|
+
R
|
|
113
|
+
]), Dt = R.getVisibleLeafColumns(), Ot = Math.max(Dt.length, 1), kt = typeof T == "function" ? T(R) : T, At = typeof E == "function" ? E(R) : E, J = typeof g == "function" ? g(q) : g, Y = typeof _ == "function" ? _(q) : _, jt = !!(h && m?.search !== !1), Mt = !!(m?.columnVisibility && R.getAllLeafColumns().some((e) => e.getCanHide())), X = !!(m?.refresh && x), Z = !!(m?.export && S), Nt = !!(m?.bulkActions !== !1 && b?.length), Pt = Mt && !!(f || p || h || J || Y || v || X || Z), Ft = jt && h ? /* @__PURE__ */ c(r, {
|
|
113
114
|
type: "search",
|
|
114
|
-
value:
|
|
115
|
-
onValueChange:
|
|
116
|
-
placeholder:
|
|
117
|
-
wrapperClassName:
|
|
118
|
-
inputClassName:
|
|
119
|
-
disabled:
|
|
120
|
-
clearable:
|
|
121
|
-
clearLabel:
|
|
122
|
-
searchIcon:
|
|
123
|
-
}) : void 0,
|
|
124
|
-
typeof
|
|
125
|
-
|
|
126
|
-
X && /* @__PURE__ */
|
|
115
|
+
value: h.value,
|
|
116
|
+
onValueChange: h.onValueChange,
|
|
117
|
+
placeholder: h.placeholder ?? "Search...",
|
|
118
|
+
wrapperClassName: h.wrapperClassName ?? h.className,
|
|
119
|
+
inputClassName: h.inputClassName,
|
|
120
|
+
disabled: h.disabled,
|
|
121
|
+
clearable: h.clearable,
|
|
122
|
+
clearLabel: h.clearLabel,
|
|
123
|
+
searchIcon: h.searchIcon
|
|
124
|
+
}) : void 0, It = /* @__PURE__ */ l(de, { children: [
|
|
125
|
+
typeof v == "function" ? v(q) : v,
|
|
126
|
+
Pt && /* @__PURE__ */ c(ae, { table: R }),
|
|
127
|
+
X && /* @__PURE__ */ c(t, {
|
|
127
128
|
type: "button",
|
|
128
129
|
variant: "outline",
|
|
129
130
|
size: "sm",
|
|
130
|
-
disabled:
|
|
131
|
-
onClick: () =>
|
|
132
|
-
children:
|
|
131
|
+
disabled: C,
|
|
132
|
+
onClick: () => x?.(q),
|
|
133
|
+
children: Ee
|
|
133
134
|
}),
|
|
134
|
-
Z && /* @__PURE__ */
|
|
135
|
+
Z && /* @__PURE__ */ c(t, {
|
|
135
136
|
type: "button",
|
|
136
137
|
variant: "outline",
|
|
137
138
|
size: "sm",
|
|
138
|
-
onClick: () =>
|
|
139
|
-
children:
|
|
139
|
+
onClick: () => S?.(q),
|
|
140
|
+
children: De
|
|
140
141
|
})
|
|
141
|
-
] }),
|
|
142
|
+
] }), Lt = Nt ? /* @__PURE__ */ c(ie, {
|
|
142
143
|
rows: K,
|
|
143
|
-
actions:
|
|
144
|
+
actions: b ?? [],
|
|
144
145
|
selectedLabel: () => "Actions",
|
|
145
146
|
clearLabel: null,
|
|
146
|
-
onClearSelection: () =>
|
|
147
|
+
onClearSelection: () => R.resetRowSelection(),
|
|
147
148
|
hideWhenEmpty: !1
|
|
148
|
-
}) : void 0,
|
|
149
|
+
}) : void 0, Rt = !!(kt || At || f || p || Ft || J || Y || v || Pt || X || Z || Lt), zt = !!(L && !L.hidden), Q = C && Me === "skeleton", Bt = ue(), Vt = Be !== "scroll" && Bt, Ht = (e, t) => t > 0 ? /* @__PURE__ */ c(o, {
|
|
149
150
|
"aria-hidden": "true",
|
|
150
151
|
className: "pointer-events-none border-0 hover:bg-transparent",
|
|
151
|
-
children: /* @__PURE__ */
|
|
152
|
-
colSpan:
|
|
152
|
+
children: /* @__PURE__ */ c(a, {
|
|
153
|
+
colSpan: Ot,
|
|
153
154
|
className: "border-0 p-0",
|
|
154
155
|
style: { height: t }
|
|
155
156
|
})
|
|
156
|
-
}, e) : null,
|
|
157
|
-
colSpan:
|
|
157
|
+
}, e) : null, Ut = (e) => /* @__PURE__ */ c(o, { children: /* @__PURE__ */ c(a, {
|
|
158
|
+
colSpan: Ot,
|
|
158
159
|
className: "p-0",
|
|
159
160
|
children: e
|
|
160
|
-
}) }),
|
|
161
|
+
}) }), Wt = () => Array.from({ length: Math.max(He, 1) }, (t, n) => /* @__PURE__ */ c(o, {
|
|
161
162
|
"aria-hidden": "true",
|
|
162
|
-
children:
|
|
163
|
-
className: e(
|
|
164
|
-
children: /* @__PURE__ */
|
|
163
|
+
children: Dt.map((t) => /* @__PURE__ */ c(a, {
|
|
164
|
+
className: e(ve[j], N && "border-r last:border-r-0"),
|
|
165
|
+
children: /* @__PURE__ */ c("div", { className: e("h-4 w-full max-w-40 animate-pulse rounded-md bg-muted", n % 3 == 1 && "max-w-24", n % 3 == 2 && "max-w-32", Ue) })
|
|
165
166
|
}, `${t.id}-${n}`))
|
|
166
|
-
}, `skeleton-${n}`)), $ = Q ? null :
|
|
167
|
+
}, `skeleton-${n}`)), $ = Q ? null : C ? /* @__PURE__ */ c(n, {
|
|
167
168
|
status: "loading",
|
|
168
169
|
title: "Loading data...",
|
|
169
|
-
...
|
|
170
|
-
}) :
|
|
170
|
+
...w
|
|
171
|
+
}) : ke ? /* @__PURE__ */ c(le, {
|
|
171
172
|
status: "error",
|
|
172
173
|
title: "Could not load data",
|
|
173
174
|
description: "Please try again.",
|
|
174
175
|
variant: "plain",
|
|
175
|
-
...
|
|
176
|
-
}) :
|
|
176
|
+
...je
|
|
177
|
+
}) : z.length === 0 ? /* @__PURE__ */ c(le, {
|
|
177
178
|
status: "empty",
|
|
178
179
|
variant: "plain",
|
|
179
|
-
...
|
|
180
|
-
}) : null,
|
|
181
|
-
let i =
|
|
182
|
-
return /* @__PURE__ */
|
|
180
|
+
...Ae
|
|
181
|
+
}) : null, Gt = (t, n, r) => {
|
|
182
|
+
let i = A?.(t) ?? !1;
|
|
183
|
+
return /* @__PURE__ */ l(s.Fragment, { children: [/* @__PURE__ */ c(o, {
|
|
183
184
|
ref: r && B?.measureRows !== !1 ? U.measureElement : void 0,
|
|
184
185
|
"data-index": r?.index,
|
|
185
186
|
"data-state": t.getIsSelected() ? "selected" : void 0,
|
|
186
|
-
"data-striped":
|
|
187
|
+
"data-striped": M && n % 2 == 1 ? "true" : void 0,
|
|
187
188
|
"data-disabled": i || void 0,
|
|
188
|
-
className: e(
|
|
189
|
+
className: e(k && !i && "cursor-pointer", !i && "transition-colors hover:bg-[color:color-mix(in_oklch,var(--primary),transparent_96%)] data-[state=selected]:bg-[color:color-mix(in_oklch,var(--primary),transparent_90%)]", i && "pointer-events-none opacity-55", ye(t, I)),
|
|
189
190
|
onClick: () => {
|
|
190
|
-
i ||
|
|
191
|
+
i || k?.(t);
|
|
191
192
|
},
|
|
192
193
|
onDoubleClick: () => {
|
|
193
|
-
i ||
|
|
194
|
+
i || Ve?.(t);
|
|
194
195
|
},
|
|
195
196
|
children: t.getVisibleCells().map((t) => {
|
|
196
|
-
let n =
|
|
197
|
-
return /* @__PURE__ */
|
|
197
|
+
let n = u(t.column.columnDef.cell, t.getContext());
|
|
198
|
+
return /* @__PURE__ */ c(a, {
|
|
198
199
|
style: {
|
|
199
200
|
...t.column.getIsPinned() === "left" ? {
|
|
200
201
|
left: `${t.column.getStart("left")}px`,
|
|
@@ -207,129 +208,129 @@ function xe({ className: xe, columns: p, data: m, title: h, description: g, feat
|
|
|
207
208
|
zIndex: 10
|
|
208
209
|
} : {}
|
|
209
210
|
},
|
|
210
|
-
className: e(
|
|
211
|
-
children:
|
|
211
|
+
className: e(ve[j], t.column.getIsPinned() && "bg-card shadow-[1px_0_0_var(--border)]", N && "border-r last:border-r-0", xe(t, qe)),
|
|
212
|
+
children: Se(n) ? F : n
|
|
212
213
|
}, t.id);
|
|
213
214
|
})
|
|
214
|
-
}), t.getIsExpanded() &&
|
|
215
|
+
}), t.getIsExpanded() && Je ? /* @__PURE__ */ c(o, {
|
|
215
216
|
className: "bg-muted/50 hover:bg-muted/50",
|
|
216
|
-
children: /* @__PURE__ */
|
|
217
|
+
children: /* @__PURE__ */ c(a, {
|
|
217
218
|
colSpan: t.getVisibleCells().length,
|
|
218
|
-
children:
|
|
219
|
+
children: Je(t)
|
|
219
220
|
})
|
|
220
221
|
}) : null] }, t.id);
|
|
221
|
-
},
|
|
222
|
-
let n =
|
|
223
|
-
return /* @__PURE__ */
|
|
222
|
+
}, Kt = (t) => {
|
|
223
|
+
let n = A?.(t) ?? !1, r = t.getVisibleCells();
|
|
224
|
+
return /* @__PURE__ */ c("article", {
|
|
224
225
|
"data-slot": "data-table-mobile-card",
|
|
225
226
|
"data-state": t.getIsSelected() ? "selected" : void 0,
|
|
226
227
|
"data-disabled": n || void 0,
|
|
227
|
-
className: e("grid gap-3 rounded-[var(--aui-card-radius,var(--radius-lg))] border border-[color:var(--aui-card-border,var(--border))] bg-card p-3 shadow-[var(--aui-card-shadow,0_10px_24px_rgba(15,23,42,0.07))]",
|
|
228
|
-
role:
|
|
229
|
-
tabIndex:
|
|
228
|
+
className: e("grid gap-3 rounded-[var(--aui-card-radius,var(--radius-lg))] border border-[color:var(--aui-card-border,var(--border))] bg-card p-3 shadow-[var(--aui-card-shadow,0_10px_24px_rgba(15,23,42,0.07))]", k && !n && "cursor-pointer transition-colors hover:bg-[color:color-mix(in_oklch,var(--primary),transparent_96%)]", n && "pointer-events-none opacity-55", ye(t, I)),
|
|
229
|
+
role: k && !n ? "button" : void 0,
|
|
230
|
+
tabIndex: k && !n ? 0 : void 0,
|
|
230
231
|
onClick: () => {
|
|
231
|
-
n ||
|
|
232
|
+
n || k?.(t);
|
|
232
233
|
},
|
|
233
234
|
onKeyDown: (e) => {
|
|
234
|
-
e.target !== e.currentTarget || n || !
|
|
235
|
+
e.target !== e.currentTarget || n || !k || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), k(t));
|
|
235
236
|
},
|
|
236
237
|
children: r.map((e) => {
|
|
237
|
-
let t =
|
|
238
|
-
return /* @__PURE__ */
|
|
238
|
+
let t = u(e.column.columnDef.cell, e.getContext());
|
|
239
|
+
return /* @__PURE__ */ l("div", {
|
|
239
240
|
"data-slot": "data-table-mobile-cell",
|
|
240
241
|
className: "grid grid-cols-[minmax(7rem,0.42fr)_minmax(0,1fr)] items-start gap-3 text-sm",
|
|
241
|
-
children: [/* @__PURE__ */
|
|
242
|
+
children: [/* @__PURE__ */ c("span", {
|
|
242
243
|
className: "min-w-0 text-xs font-semibold uppercase tracking-wide text-muted-foreground",
|
|
243
|
-
children:
|
|
244
|
-
}), /* @__PURE__ */
|
|
244
|
+
children: Ce(e)
|
|
245
|
+
}), /* @__PURE__ */ c("div", {
|
|
245
246
|
className: "min-w-0 text-right text-foreground/92 [&>*]:ml-auto",
|
|
246
|
-
children:
|
|
247
|
+
children: Se(t) ? F : t
|
|
247
248
|
})]
|
|
248
249
|
}, e.id);
|
|
249
250
|
})
|
|
250
251
|
}, t.id);
|
|
251
252
|
};
|
|
252
|
-
return /* @__PURE__ */
|
|
253
|
+
return /* @__PURE__ */ l("div", {
|
|
253
254
|
"data-slot": "data-table",
|
|
254
|
-
className: e("grid gap-3",
|
|
255
|
-
...
|
|
255
|
+
className: e("grid gap-3", we),
|
|
256
|
+
...tt,
|
|
256
257
|
children: [
|
|
257
|
-
|
|
258
|
-
title:
|
|
259
|
-
description:
|
|
260
|
-
search:
|
|
258
|
+
Rt && (kt ?? /* @__PURE__ */ c(se, {
|
|
259
|
+
title: f,
|
|
260
|
+
description: p,
|
|
261
|
+
search: Ft,
|
|
261
262
|
filters: J,
|
|
262
263
|
summary: Y,
|
|
263
|
-
actions:
|
|
264
|
-
selectionActions:
|
|
265
|
-
selectedCount:
|
|
266
|
-
totalCount:
|
|
264
|
+
actions: It,
|
|
265
|
+
selectionActions: Lt,
|
|
266
|
+
selectedCount: Et,
|
|
267
|
+
totalCount: L ? L.rowCount ?? d.length : d.length,
|
|
267
268
|
variant: "plain",
|
|
268
|
-
...
|
|
269
|
+
...At
|
|
269
270
|
})),
|
|
270
|
-
|
|
271
|
+
Vt && /* @__PURE__ */ c("div", {
|
|
271
272
|
className: "grid gap-3",
|
|
272
|
-
children: $ ?? (Q ? /* @__PURE__ */
|
|
273
|
+
children: $ ?? (Q ? /* @__PURE__ */ c(n, {
|
|
273
274
|
status: "loading",
|
|
274
275
|
title: "Loading data...",
|
|
275
|
-
...
|
|
276
|
-
}) :
|
|
276
|
+
...w
|
|
277
|
+
}) : z.map((e) => /* @__PURE__ */ c(s.Fragment, { children: O ? O(e) : Kt(e) }, e.id)))
|
|
277
278
|
}),
|
|
278
|
-
!
|
|
279
|
+
!Vt && /* @__PURE__ */ l("div", {
|
|
279
280
|
"data-slot": "data-table-wrapper",
|
|
280
281
|
"data-density": j,
|
|
281
|
-
"data-striped":
|
|
282
|
-
"data-bordered":
|
|
282
|
+
"data-striped": M || void 0,
|
|
283
|
+
"data-bordered": N || void 0,
|
|
283
284
|
"data-virtualized": V || void 0,
|
|
284
|
-
className: e("overflow-hidden rounded-[var(--aui-card-radius,var(--radius-lg))] border border-[color:var(--aui-card-border,var(--border))] bg-card shadow-[var(--aui-card-shadow,0_10px_24px_rgba(15,23,42,0.07))] backdrop-blur",
|
|
285
|
-
children: [/* @__PURE__ */
|
|
286
|
-
containerRef:
|
|
285
|
+
className: e("overflow-hidden rounded-[var(--aui-card-radius,var(--radius-lg))] border border-[color:var(--aui-card-border,var(--border))] bg-card shadow-[var(--aui-card-shadow,0_10px_24px_rgba(15,23,42,0.07))] backdrop-blur", Ge),
|
|
286
|
+
children: [/* @__PURE__ */ l(i, {
|
|
287
|
+
containerRef: bt,
|
|
287
288
|
containerStyle: V ? {
|
|
288
289
|
height: H,
|
|
289
290
|
overscrollBehavior: "contain"
|
|
290
291
|
} : void 0,
|
|
291
292
|
containerClassName: e("rounded-none border-0 bg-transparent shadow-none ring-0", V && "overflow-auto"),
|
|
292
|
-
className: e("text-[0.95rem]",
|
|
293
|
-
"aria-rowcount":
|
|
294
|
-
children: [/* @__PURE__ */
|
|
295
|
-
className: e((
|
|
296
|
-
children:
|
|
293
|
+
className: e("text-[0.95rem]", We),
|
|
294
|
+
"aria-rowcount": z.length,
|
|
295
|
+
children: [/* @__PURE__ */ c(ne, {
|
|
296
|
+
className: e((P || V) && "sticky top-0 z-10 shadow-sm backdrop-blur"),
|
|
297
|
+
children: R.getHeaderGroups().map((t) => /* @__PURE__ */ c(o, { children: t.headers.map((t) => /* @__PURE__ */ c(te, {
|
|
297
298
|
style: {
|
|
298
299
|
width: t.getSize(),
|
|
299
300
|
...t.column.getIsPinned() === "left" ? {
|
|
300
301
|
left: `${t.column.getStart("left")}px`,
|
|
301
302
|
position: "sticky",
|
|
302
|
-
zIndex:
|
|
303
|
+
zIndex: P ? 20 : 11
|
|
303
304
|
} : {},
|
|
304
305
|
...t.column.getIsPinned() === "right" ? {
|
|
305
306
|
right: `${t.column.getAfter("right")}px`,
|
|
306
307
|
position: "sticky",
|
|
307
|
-
zIndex:
|
|
308
|
+
zIndex: P ? 20 : 11
|
|
308
309
|
} : {}
|
|
309
310
|
},
|
|
310
|
-
className: e(
|
|
311
|
-
children: t.isPlaceholder ? null :
|
|
311
|
+
className: e(_e[j], "bg-[color:color-mix(in_oklch,var(--card),var(--background)_10%)] text-muted-foreground", (P || V) && "bg-[color:color-mix(in_oklch,var(--card),transparent_12%)] backdrop-blur", t.column.getIsPinned() && "bg-card shadow-[1px_0_0_var(--border)]", N && "border-r last:border-r-0", be(t, Ke)),
|
|
312
|
+
children: t.isPlaceholder ? null : u(t.column.columnDef.header, t.getContext())
|
|
312
313
|
}, t.id)) }, t.id))
|
|
313
|
-
}), /* @__PURE__ */
|
|
314
|
-
|
|
315
|
-
...G.map((e) =>
|
|
316
|
-
|
|
317
|
-
] :
|
|
318
|
-
}),
|
|
319
|
-
pageIndex:
|
|
320
|
-
pageSize:
|
|
321
|
-
pageCount:
|
|
322
|
-
rowCount:
|
|
323
|
-
pageSizeOptions:
|
|
324
|
-
showPageSize:
|
|
325
|
-
labels:
|
|
326
|
-
disabled:
|
|
327
|
-
onPageChange:
|
|
328
|
-
onPageSizeChange:
|
|
314
|
+
}), /* @__PURE__ */ c(ee, { children: $ ? Ut($) : Q ? Wt() : V ? [
|
|
315
|
+
Ht("virtual-top", wt),
|
|
316
|
+
...G.map((e) => Gt(z[e.index], e.index, e)),
|
|
317
|
+
Ht("virtual-bottom", Tt)
|
|
318
|
+
] : z.map((e, t) => Gt(e, t)) })]
|
|
319
|
+
}), zt && L && /* @__PURE__ */ c(oe, {
|
|
320
|
+
pageIndex: L.pageIndex,
|
|
321
|
+
pageSize: L.pageSize,
|
|
322
|
+
pageCount: L.pageCount,
|
|
323
|
+
rowCount: L.rowCount,
|
|
324
|
+
pageSizeOptions: L.pageSizeOptions,
|
|
325
|
+
showPageSize: L.showPageSize,
|
|
326
|
+
labels: L.labels,
|
|
327
|
+
disabled: C,
|
|
328
|
+
onPageChange: L.onPageChange,
|
|
329
|
+
onPageSizeChange: L.onPageSizeChange
|
|
329
330
|
})]
|
|
330
331
|
})
|
|
331
332
|
]
|
|
332
333
|
});
|
|
333
334
|
}
|
|
334
335
|
//#endregion
|
|
335
|
-
export {
|
|
336
|
+
export { we as DataTable };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./data-state.cjs"),t=require("./activity-feed.cjs"),n=require("./avatar.cjs"),r=require("./carousel.cjs"),i=require("./chat.cjs"),a=require("./code-block.cjs"),o=require("./description-list.cjs"),s=require("./kanban.cjs"),c=require("./list.cjs"),l=require("./progress.cjs"),u=require("./
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./data-state.cjs"),t=require("./activity-feed.cjs"),n=require("./avatar.cjs"),r=require("./carousel.cjs"),i=require("./chat.cjs"),a=require("./code-block.cjs"),o=require("./description-list.cjs"),s=require("./kanban.cjs"),c=require("./list.cjs"),l=require("./progress.cjs"),u=require("./status-dot.cjs"),d=require("./status-legend.cjs"),f=require("./timeline.cjs"),p=require("./tree-view.cjs"),m=require("./virtual-list.cjs"),h=require("./qr-code.cjs"),g=require("./tag.cjs"),_=require("./typography.cjs");exports.ActivityFeed=t.ActivityFeed,exports.Avatar=n.Avatar,exports.AvatarGroup=n.AvatarGroup,exports.Blockquote=_.Blockquote,exports.Carousel=r.Carousel,exports.CarouselItem=r.CarouselItem,exports.ChatAttachment=i.ChatAttachment,exports.ChatComposer=i.ChatComposer,exports.ChatHeader=i.ChatHeader,exports.ChatHeaderActions=i.ChatHeaderActions,exports.ChatMessage=i.ChatMessage,exports.ChatMessageList=i.ChatMessageList,exports.ChatShell=i.ChatShell,exports.ChatTypingIndicator=i.ChatTypingIndicator,exports.Chip=g.Chip,exports.CodeBlock=a.CodeBlock,exports.ConversationList=i.ConversationList,exports.DataState=e.DataState,exports.DescriptionList=o.DescriptionList,exports.Heading=_.Heading,exports.KanbanBoard=s.KanbanBoard,exports.List=c.List,exports.ListRow=c.ListRow,exports.Mark=_.Mark,exports.Progress=l.Progress,exports.ProgressCard=l.ProgressCard,exports.QRCode=h.QRCode,exports.QRCodeSvg=h.QRCodeSvg,exports.Spoiler=_.Spoiler,exports.SpoilerSummary=_.SpoilerSummary,exports.StatusDot=u.StatusDot,exports.StatusLegend=d.StatusLegend,exports.Tag=g.Tag,exports.TagGroup=g.TagGroup,exports.Text=_.Text,exports.Timeline=f.Timeline,exports.TreeView=p.TreeView,exports.VirtualList=m.VirtualList,exports.getProgressPercent=l.getProgressPercent;
|
|
@@ -8,14 +8,12 @@ import { DescriptionList as g } from "./description-list.js";
|
|
|
8
8
|
import { KanbanBoard as _ } from "./kanban.js";
|
|
9
9
|
import { List as v, ListRow as y } from "./list.js";
|
|
10
10
|
import { Progress as b, ProgressCard as x, getProgressPercent as S } from "./progress.js";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
import { Blockquote as L, Heading as R, Mark as z, Spoiler as B, SpoilerSummary as V, Text as H } from "./typography.js";
|
|
21
|
-
export { t as ActivityFeed, n as Avatar, r as AvatarGroup, L as Blockquote, i as Carousel, a as CarouselItem, o as ChatAttachment, s as ChatComposer, c as ChatHeader, l as ChatHeaderActions, u as ChatMessage, d as ChatMessageList, f as ChatShell, p as ChatTypingIndicator, P as Chip, h as CodeBlock, m as ConversationList, e as DataState, g as DescriptionList, R as Heading, A as InfoCard, _ as KanbanBoard, v as List, y as ListRow, z as Mark, b as Progress, x as ProgressCard, M as QRCode, N as QRCodeSvg, B as Spoiler, V as SpoilerSummary, C as Statistic, w as StatisticCard, T as StatisticGrid, E as StatusDot, D as StatusLegend, F as Tag, I as TagGroup, H as Text, O as Timeline, k as TreeView, j as VirtualList, S as getProgressPercent };
|
|
11
|
+
import { StatusDot as C } from "./status-dot.js";
|
|
12
|
+
import { StatusLegend as w } from "./status-legend.js";
|
|
13
|
+
import { Timeline as T } from "./timeline.js";
|
|
14
|
+
import { TreeView as E } from "./tree-view.js";
|
|
15
|
+
import { VirtualList as D } from "./virtual-list.js";
|
|
16
|
+
import { QRCode as O, QRCodeSvg as k } from "./qr-code.js";
|
|
17
|
+
import { Chip as A, Tag as j, TagGroup as M } from "./tag.js";
|
|
18
|
+
import { Blockquote as N, Heading as P, Mark as F, Spoiler as I, SpoilerSummary as L, Text as R } from "./typography.js";
|
|
19
|
+
export { t as ActivityFeed, n as Avatar, r as AvatarGroup, N as Blockquote, i as Carousel, a as CarouselItem, o as ChatAttachment, s as ChatComposer, c as ChatHeader, l as ChatHeaderActions, u as ChatMessage, d as ChatMessageList, f as ChatShell, p as ChatTypingIndicator, A as Chip, h as CodeBlock, m as ConversationList, e as DataState, g as DescriptionList, P as Heading, _ as KanbanBoard, v as List, y as ListRow, F as Mark, b as Progress, x as ProgressCard, O as QRCode, k as QRCodeSvg, I as Spoiler, L as SpoilerSummary, C as StatusDot, w as StatusLegend, j as Tag, M as TagGroup, R as Text, T as Timeline, E as TreeView, D as VirtualList, S as getProgressPercent };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./saved-filter-select.cjs");exports.SavedFilterSelect=e.SavedFilterSelect;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export { e as FilterBar, t as SavedFilterSelect };
|
|
1
|
+
import { SavedFilterSelect as e } from "./saved-filter-select.js";
|
|
2
|
+
export { e as SavedFilterSelect };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/utils.cjs");let n=require("react");n=e.__toESM(n,1);let r=require("react/jsx-runtime");var i=/^#?([0-9a-f]{6})([0-9a-f]{2})?$/i;function a(e,t=`#000000`){let n=e.trim().match(i);return n?`#${n[1].toLowerCase()}${n[2]?.toLowerCase()??``}`:t}function o(e){return a(e).slice(0,7)}function s(e){let t=a(e);return t.length===9?Math.round(Number.parseInt(t.slice(7,9),16)/255*100):100}function c(e,t,n){let r=o(e);return n?`${r}${Math.round(Math.min(100,Math.max(0,t))/100*255).toString(16).padStart(2,`0`)}`:r}function l({value:e,defaultValue:a=`#2563eb`,onValueChange:
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/utils.cjs");let n=require("react");n=e.__toESM(n,1);let r=require("react/jsx-runtime");var i=/^#?([0-9a-f]{6})([0-9a-f]{2})?$/i;function a(e,t=`#000000`){let n=e.trim().match(i);return n?`#${n[1].toLowerCase()}${n[2]?.toLowerCase()??``}`:t}function o(e){return a(e).slice(0,7)}function s(e){let t=a(e);return t.length===9?Math.round(Number.parseInt(t.slice(7,9),16)/255*100):100}function c(e,t,n){let r=o(e);return n?`${r}${Math.round(Math.min(100,Math.max(0,t))/100*255).toString(16).padStart(2,`0`)}`:r}function l(e){let t=o(e);return{background:`linear-gradient(90deg, ${t}00 0%, ${t}ff 100%)`}}function u({value:e,defaultValue:a=`#2563eb`,onValueChange:u,swatches:d=[`#0f172a`,`#2563eb`,`#059669`,`#d97706`,`#dc2626`,`#7c3aed`],showAlpha:f=!1,disabled:p=!1,label:m,labels:h,className:g,..._}){let[v,y]=n.useState(()=>c(a,s(a),f)),b=c(e??v,s(e??v),f),[x,S]=n.useState(b);n.useEffect(()=>S(b),[b]);let C=t=>{let n=c(t,s(t),f);e===void 0&&y(n),u?.(n)},w=()=>{if(!i.test(x.trim())){S(b);return}C(x)};return(0,r.jsxs)(`div`,{"data-slot":`color-picker`,className:t.cn(`grid gap-3`,g),..._,children:[m?(0,r.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:m}):null,(0,r.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,r.jsxs)(`label`,{className:`relative size-10 shrink-0 overflow-hidden rounded-md border bg-background shadow-sm focus-within:ring-2 focus-within:ring-ring`,children:[(0,r.jsx)(`span`,{"aria-hidden":`true`,className:`absolute inset-0 bg-[linear-gradient(45deg,#e2e8f0_25%,transparent_25%),linear-gradient(-45deg,#e2e8f0_25%,transparent_25%),linear-gradient(45deg,transparent_75%,#e2e8f0_75%),linear-gradient(-45deg,transparent_75%,#e2e8f0_75%)] bg-[length:10px_10px] bg-[position:0_0,0_5px,5px_-5px,-5px_0]`}),(0,r.jsx)(`span`,{"aria-hidden":`true`,className:`absolute inset-0`,style:{backgroundColor:b}}),(0,r.jsx)(`span`,{className:`sr-only`,children:h?.color??`Choose color`}),(0,r.jsx)(`input`,{type:`color`,"aria-label":h?.color??`Choose color`,value:o(b),disabled:p,className:`absolute -inset-2 size-14 cursor-pointer border-0 bg-transparent p-0 disabled:cursor-not-allowed`,onChange:e=>C(c(e.target.value,s(b),f))})]}),(0,r.jsx)(`input`,{"aria-label":h?.hex??`Hex color`,value:x,disabled:p,spellCheck:!1,className:`h-10 min-w-0 flex-1 rounded-md border bg-background px-3 font-mono text-sm uppercase outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,onChange:e=>S(e.target.value),onBlur:w,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),w()),e.key===`Escape`&&S(b)}})]}),f?(0,r.jsxs)(`label`,{className:`grid grid-cols-[1fr_auto] items-center gap-3 text-xs text-muted-foreground`,children:[(0,r.jsx)(`span`,{className:`sr-only`,children:h?.alpha??`Opacity`}),(0,r.jsx)(`input`,{type:`range`,min:`0`,max:`100`,value:s(b),disabled:p,"aria-label":h?.alpha??`Opacity`,style:l(b),className:`h-2 w-full cursor-pointer appearance-none rounded-full border border-border/70 outline-none focus-visible:ring-4 focus-visible:ring-ring/20 disabled:cursor-not-allowed [&::-webkit-slider-thumb]:size-4 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-background [&::-webkit-slider-thumb]:bg-foreground [&::-webkit-slider-thumb]:shadow-sm`,onChange:e=>C(c(b,Number(e.target.value),!0))}),(0,r.jsxs)(`span`,{className:`w-10 text-right tabular-nums`,children:[s(b),`%`]})]}):null,d.length>0?(0,r.jsx)(`div`,{role:`list`,"aria-label":`Color swatches`,className:`flex flex-wrap gap-2`,children:d.map(e=>{let t=c(e,s(b),f),n=o(t)===o(b);return(0,r.jsx)(`button`,{type:`button`,role:`listitem`,"aria-label":`Use ${e}`,"aria-pressed":n,disabled:p,className:`size-7 rounded-md border border-black/10 shadow-sm outline-none ring-offset-2 focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,style:{backgroundColor:o(t)},onClick:()=>C(t)},e)})}):null]})}exports.ColorPicker=u,exports.getAlphaPercent=s,exports.normalizeHexColor=a,exports.withAlpha=c;
|