@qtalo/qt-ui-library 0.1.1 → 0.1.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/README.md +82 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +30 -19
- package/dist/index.js +158 -94
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
- package/src/styles/styles.css +376 -0
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import clsx from "clsx";
|
|
2
2
|
import { twMerge } from "tailwind-merge";
|
|
3
|
-
import { Children, Fragment, cloneElement, createContext, isValidElement, useCallback, useContext, useEffect,
|
|
3
|
+
import { Children, Fragment, cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { createPortal } from "react-dom";
|
|
6
6
|
import { tv } from "tailwind-variants";
|
|
@@ -142,13 +142,13 @@ function Button({ className: r, children: M, ...N }) {
|
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
144
|
function Checkbox({ checked: r, defaultChecked: M, icon: N, indeterminate: P, indeterminateIcon: F, onChange: I, disabled: L, children: R, className: z }) {
|
|
145
|
-
let V = useRef(null), [H,
|
|
145
|
+
let V = useRef(null), [H, G] = useState(M ?? !1), q = r ?? H;
|
|
146
146
|
useEffect(() => {
|
|
147
147
|
V.current && (V.current.indeterminate = !!P);
|
|
148
148
|
}, [P]);
|
|
149
149
|
function J(M) {
|
|
150
150
|
let N = M.target.checked;
|
|
151
|
-
r === void 0 &&
|
|
151
|
+
r === void 0 && G(N), I?.(N);
|
|
152
152
|
}
|
|
153
153
|
return /* @__PURE__ */ jsxs("label", {
|
|
154
154
|
className: cn("relative inline-flex w-fit cursor-pointer items-center gap-2 select-none", L && "pointer-events-none opacity-50", z),
|
|
@@ -163,12 +163,12 @@ function Checkbox({ checked: r, defaultChecked: M, icon: N, indeterminate: P, in
|
|
|
163
163
|
}),
|
|
164
164
|
/* @__PURE__ */ jsx("span", {
|
|
165
165
|
role: "checkbox",
|
|
166
|
-
"aria-checked": P ? "mixed" :
|
|
166
|
+
"aria-checked": P ? "mixed" : q,
|
|
167
167
|
tabIndex: -1,
|
|
168
|
-
"data-state": P ? "indeterminate" :
|
|
168
|
+
"data-state": P ? "indeterminate" : q ? "checked" : "unchecked",
|
|
169
169
|
className: "checkbox-box inline-flex items-center justify-center",
|
|
170
170
|
children: /* @__PURE__ */ jsx("span", {
|
|
171
|
-
className: cn("checkbox-icon", !(
|
|
171
|
+
className: cn("checkbox-icon", !(q || P) && "opacity-0"),
|
|
172
172
|
children: P ? F ?? "—" : N ?? "✓"
|
|
173
173
|
})
|
|
174
174
|
}),
|
|
@@ -186,16 +186,16 @@ function useDropdown() {
|
|
|
186
186
|
return r;
|
|
187
187
|
}
|
|
188
188
|
function Dropdown({ trigger: r, children: M, align: N = "start", disabled: P = !1 }) {
|
|
189
|
-
let [F, I] = useState(!1), L = useRef(null), R = useRef(null), z = useRef(null), [
|
|
189
|
+
let [F, I] = useState(!1), L = useRef(null), R = useRef(null), z = useRef(null), [H, G] = useState(null);
|
|
190
190
|
useLayoutEffect(() => {
|
|
191
191
|
if (!F || !L.current || !R.current) return;
|
|
192
192
|
let r = L.current.getBoundingClientRect(), M = R.current.getBoundingClientRect(), P = r.left;
|
|
193
|
-
N === "end" && (P = r.right - M.width),
|
|
193
|
+
N === "end" && (P = r.right - M.width), G({
|
|
194
194
|
top: r.bottom,
|
|
195
195
|
left: P
|
|
196
196
|
});
|
|
197
197
|
}, [F, N]);
|
|
198
|
-
function
|
|
198
|
+
function J() {
|
|
199
199
|
z.current &&= (clearTimeout(z.current), null), I(!0);
|
|
200
200
|
}
|
|
201
201
|
function Y() {
|
|
@@ -215,20 +215,22 @@ function Dropdown({ trigger: r, children: M, align: N = "start", disabled: P = !
|
|
|
215
215
|
value: { close: () => I(!1) },
|
|
216
216
|
children: [/* @__PURE__ */ jsx("div", {
|
|
217
217
|
ref: L,
|
|
218
|
-
className: "inline-
|
|
219
|
-
onMouseEnter:
|
|
218
|
+
className: "inline-flex",
|
|
219
|
+
onMouseEnter: J,
|
|
220
220
|
onMouseLeave: Y,
|
|
221
221
|
onClick: () => I((r) => !r),
|
|
222
|
+
"aria-haspopup": "menu",
|
|
223
|
+
"aria-expanded": F,
|
|
222
224
|
children: r
|
|
223
225
|
}), F && !P && createPortal(/* @__PURE__ */ jsx("div", {
|
|
224
226
|
ref: R,
|
|
225
|
-
onMouseEnter:
|
|
227
|
+
onMouseEnter: J,
|
|
226
228
|
onMouseLeave: Y,
|
|
227
229
|
style: {
|
|
228
230
|
position: "fixed",
|
|
229
|
-
top:
|
|
230
|
-
left:
|
|
231
|
-
visibility:
|
|
231
|
+
top: H?.top ?? 0,
|
|
232
|
+
left: H?.left ?? 0,
|
|
233
|
+
visibility: H ? "visible" : "hidden",
|
|
232
234
|
zIndex: 1e3
|
|
233
235
|
},
|
|
234
236
|
children: M
|
|
@@ -367,12 +369,12 @@ function getVerticalAlign(r, M, N) {
|
|
|
367
369
|
return N === "start" ? r.top : N === "end" ? r.bottom - M.height : r.top + r.height / 2 - M.height / 2;
|
|
368
370
|
}
|
|
369
371
|
function Tooltip({ children: r, content: M, position: N = "top", delay: P = 120, className: F }) {
|
|
370
|
-
let I = useRef(null), L = useRef(null), R = useRef(null), [z,
|
|
372
|
+
let I = useRef(null), L = useRef(null), R = useRef(null), [z, H] = useState(!1), [J, Y] = useState(null), X = () => {
|
|
371
373
|
R.current &&= (clearTimeout(R.current), null), R.current = window.setTimeout(() => {
|
|
372
|
-
|
|
374
|
+
H(!0);
|
|
373
375
|
}, P);
|
|
374
376
|
}, Z = () => {
|
|
375
|
-
R.current &&= (clearTimeout(R.current), null),
|
|
377
|
+
R.current &&= (clearTimeout(R.current), null), H(!1);
|
|
376
378
|
};
|
|
377
379
|
return useLayoutEffect(() => {
|
|
378
380
|
if (!z || !I.current || !L.current) return;
|
|
@@ -396,9 +398,9 @@ function Tooltip({ children: r, content: M, position: N = "top", delay: P = 120,
|
|
|
396
398
|
role: "tooltip",
|
|
397
399
|
style: {
|
|
398
400
|
position: "fixed",
|
|
399
|
-
top:
|
|
400
|
-
left:
|
|
401
|
-
visibility:
|
|
401
|
+
top: J?.top ?? 0,
|
|
402
|
+
left: J?.left ?? 0,
|
|
403
|
+
visibility: J ? "visible" : "hidden",
|
|
402
404
|
zIndex: 1e3
|
|
403
405
|
},
|
|
404
406
|
className: cn(F),
|
|
@@ -644,7 +646,7 @@ function GoogleCalendarIcon(r) {
|
|
|
644
646
|
});
|
|
645
647
|
}
|
|
646
648
|
function JiraIcon(r) {
|
|
647
|
-
let M =
|
|
649
|
+
let M = "jira-gradient-0", N = "jira-gradient-1";
|
|
648
650
|
return /* @__PURE__ */ jsxs(Icon, {
|
|
649
651
|
viewBox: "0 0 20 20",
|
|
650
652
|
...r,
|
|
@@ -655,14 +657,14 @@ function JiraIcon(r) {
|
|
|
655
657
|
}),
|
|
656
658
|
/* @__PURE__ */ jsx("path", {
|
|
657
659
|
d: "M13.08 6.36H6.34C6.34 8.04 7.7 9.4 9.38 9.4H10.62V10.6C10.62 12.28 11.98 13.64 13.66 13.64V6.94C13.66 6.62 13.4 6.36 13.08 6.36Z",
|
|
658
|
-
fill: `url(#${
|
|
660
|
+
fill: `url(#${M})`
|
|
659
661
|
}),
|
|
660
662
|
/* @__PURE__ */ jsx("path", {
|
|
661
663
|
d: "M9.74 9.72H3C3 11.4 4.36 12.76 6.04 12.76H7.28V13.96C7.28 15.64 8.64 17 10.32 17V10.3C10.32 9.98 10.06 9.72 9.74 9.72Z",
|
|
662
|
-
fill: `url(#${
|
|
664
|
+
fill: `url(#${N})`
|
|
663
665
|
}),
|
|
664
666
|
/* @__PURE__ */ jsxs("defs", { children: [/* @__PURE__ */ jsxs("linearGradient", {
|
|
665
|
-
id:
|
|
667
|
+
id: M,
|
|
666
668
|
x1: "16.73",
|
|
667
669
|
y1: "3.02",
|
|
668
670
|
x2: "11.22",
|
|
@@ -676,7 +678,7 @@ function JiraIcon(r) {
|
|
|
676
678
|
stopColor: "#2684FF"
|
|
677
679
|
})]
|
|
678
680
|
}), /* @__PURE__ */ jsxs("linearGradient", {
|
|
679
|
-
id:
|
|
681
|
+
id: N,
|
|
680
682
|
x1: "10.37",
|
|
681
683
|
y1: "9.75",
|
|
682
684
|
x2: "7.06",
|
|
@@ -1499,9 +1501,10 @@ function SystemIcon(r) {
|
|
|
1499
1501
|
}) })
|
|
1500
1502
|
});
|
|
1501
1503
|
}
|
|
1502
|
-
function Badge({ icon: r, label: M, action: N, className: P }) {
|
|
1504
|
+
function Badge({ icon: r, label: M, action: N, className: P, ...F }) {
|
|
1503
1505
|
return /* @__PURE__ */ jsxs("div", {
|
|
1504
1506
|
className: cn("w-fit", P),
|
|
1507
|
+
...F,
|
|
1505
1508
|
children: [
|
|
1506
1509
|
r,
|
|
1507
1510
|
M,
|
|
@@ -1673,7 +1676,7 @@ function Avatar({ name: r, size: M = "sm", className: N }) {
|
|
|
1673
1676
|
}
|
|
1674
1677
|
var statusBadgeStyles = tv({
|
|
1675
1678
|
slots: {
|
|
1676
|
-
root: "flex items-center gap-1 rounded-full border
|
|
1679
|
+
root: "relative flex items-center gap-1 rounded-full border",
|
|
1677
1680
|
text: "truncate text-xs font-semibold whitespace-nowrap"
|
|
1678
1681
|
},
|
|
1679
1682
|
variants: { status: {
|
|
@@ -1694,40 +1697,45 @@ var statusBadgeStyles = tv({
|
|
|
1694
1697
|
fire: {
|
|
1695
1698
|
icon: FireIcon,
|
|
1696
1699
|
label: "Fire",
|
|
1697
|
-
|
|
1700
|
+
compact: "icon-action",
|
|
1701
|
+
normal: "icon-label-action"
|
|
1698
1702
|
},
|
|
1699
1703
|
insight: {
|
|
1700
1704
|
icon: InsightIcon,
|
|
1701
1705
|
label: "Insight",
|
|
1702
|
-
|
|
1706
|
+
compact: "label-only",
|
|
1707
|
+
normal: "icon-label"
|
|
1703
1708
|
},
|
|
1704
1709
|
done: {
|
|
1705
|
-
icon:
|
|
1710
|
+
icon: CheckCircleIcon,
|
|
1706
1711
|
label: "Done",
|
|
1707
|
-
|
|
1712
|
+
compact: "icon-action",
|
|
1713
|
+
normal: "icon-label-action"
|
|
1708
1714
|
}
|
|
1709
1715
|
};
|
|
1710
|
-
function StatusBadge({ className: r, label: M, status: N, onAction: P }) {
|
|
1711
|
-
let F = STATUS_CONFIG[N],
|
|
1716
|
+
function StatusBadge({ className: r, label: M, status: N, onAction: P, density: F = "normal" }) {
|
|
1717
|
+
let [I, L] = useState(!1), R = F === "compact", z = STATUS_CONFIG[N], B = R ? z.compact : z.normal, V = statusBadgeStyles({ status: N }), H = B.includes("icon"), U = B.includes("label"), G = B.includes("action") && P;
|
|
1712
1718
|
return /* @__PURE__ */ jsx(Badge, {
|
|
1713
|
-
className: cn(
|
|
1714
|
-
icon: /* @__PURE__ */ jsx(
|
|
1719
|
+
className: cn(V.root(), R ? "h-6 w-6" : "py-1 pr-2.5 pl-2", r),
|
|
1720
|
+
icon: H ? /* @__PURE__ */ jsx(z.icon, {
|
|
1715
1721
|
size: 16,
|
|
1716
|
-
className:
|
|
1717
|
-
}),
|
|
1718
|
-
label: /* @__PURE__ */ jsx("span", {
|
|
1719
|
-
className:
|
|
1720
|
-
children:
|
|
1721
|
-
}),
|
|
1722
|
-
action:
|
|
1722
|
+
className: cn(V.text(), R && G && "absolute inset-0 m-auto", R && G && I && "opacity-0")
|
|
1723
|
+
}) : void 0,
|
|
1724
|
+
label: U ? /* @__PURE__ */ jsx("span", {
|
|
1725
|
+
className: cn(V.text(), R && "absolute inset-0 flex items-center justify-center text-center text-[10px]"),
|
|
1726
|
+
children: M ?? z.label
|
|
1727
|
+
}) : void 0,
|
|
1728
|
+
action: G ? /* @__PURE__ */ jsx(Button, {
|
|
1723
1729
|
onClick: P,
|
|
1724
1730
|
"aria-label": "Dismiss status",
|
|
1725
|
-
className: "group",
|
|
1731
|
+
className: cn("group", R ? cn("absolute inset-0 m-auto transition-opacity", I ? "opacity-100" : "opacity-0") : void 0),
|
|
1726
1732
|
children: /* @__PURE__ */ jsx(CloseIcon, {
|
|
1727
1733
|
size: 16,
|
|
1728
|
-
className: cn("group-hover:scale-90"
|
|
1734
|
+
className: cn(V.text(), "group-hover:scale-90")
|
|
1729
1735
|
})
|
|
1730
|
-
}) : void 0
|
|
1736
|
+
}) : void 0,
|
|
1737
|
+
onMouseEnter: R ? () => L(!0) : void 0,
|
|
1738
|
+
onMouseLeave: R ? () => L(!1) : void 0
|
|
1731
1739
|
});
|
|
1732
1740
|
}
|
|
1733
1741
|
function IconButton({ icon: r, ...M }) {
|
|
@@ -1747,7 +1755,7 @@ function InfoTooltip({ className: r, ...M }) {
|
|
|
1747
1755
|
});
|
|
1748
1756
|
}
|
|
1749
1757
|
function BulkActions({ totalItems: r = 0, selectedItems: M = 0, onSelectAll: N, actions: P, defaultDensity: F = "normal", onDensityChange: I, className: L }) {
|
|
1750
|
-
let R = r > 0, z = R && M === r, B = R && M > 0 && M < r, V = z ? `All (${r})` : B ? `${M}/${r} selected` : `Select all (${r})`, [H, U] = useState(F ?? "normal"),
|
|
1758
|
+
let R = r > 0, z = R && M === r, B = R && M > 0 && M < r, V = z ? `All (${r})` : B ? `${M}/${r} selected` : `Select all (${r})`, [H, U] = useState(F ?? "normal"), q = () => {
|
|
1751
1759
|
N(!z);
|
|
1752
1760
|
};
|
|
1753
1761
|
function J(r) {
|
|
@@ -1822,7 +1830,7 @@ function BulkActions({ totalItems: r = 0, selectedItems: M = 0, onSelectAll: N,
|
|
|
1822
1830
|
children: /* @__PURE__ */ jsx(Checkbox, {
|
|
1823
1831
|
checked: z,
|
|
1824
1832
|
indeterminate: B,
|
|
1825
|
-
onChange:
|
|
1833
|
+
onChange: q,
|
|
1826
1834
|
icon: /* @__PURE__ */ jsx(CheckboxIcon, {
|
|
1827
1835
|
size: 16,
|
|
1828
1836
|
className: "text-white-variant-7"
|
|
@@ -2064,7 +2072,7 @@ function ActionMenu({ trigger: r, children: M, className: N, ...P }) {
|
|
|
2064
2072
|
});
|
|
2065
2073
|
}
|
|
2066
2074
|
function CalendarPanel({ mode: r, selectedDate: M, selectedRange: N, onDateSelect: P, onRangeSelect: F }) {
|
|
2067
|
-
let { close: I } = useDropdown(), L = useMemo(() => /* @__PURE__ */ new Date(), []), [R, z] = useState(null), V = useRef(M),
|
|
2075
|
+
let { close: I } = useDropdown(), L = useMemo(() => /* @__PURE__ */ new Date(), []), [R, z] = useState(null), V = useRef(M), G = useRef(N), [q, J] = useState(() => {
|
|
2068
2076
|
let P = r === "single" ? M ?? L : N.startDate ?? N.endDate ?? L;
|
|
2069
2077
|
return {
|
|
2070
2078
|
year: P.getFullYear(),
|
|
@@ -2072,7 +2080,7 @@ function CalendarPanel({ mode: r, selectedDate: M, selectedRange: N, onDateSelec
|
|
|
2072
2080
|
};
|
|
2073
2081
|
});
|
|
2074
2082
|
useEffect(() => {
|
|
2075
|
-
(r === "single" && M && (!V.current || M.getTime() !== V.current.getTime()) || r === "range" && (N.startDate?.getTime() !==
|
|
2083
|
+
(r === "single" && M && (!V.current || M.getTime() !== V.current.getTime()) || r === "range" && (N.startDate?.getTime() !== G.current.startDate?.getTime() || N.endDate?.getTime() !== G.current.endDate?.getTime())) && queueMicrotask(() => {
|
|
2076
2084
|
if (r === "single" && M) J({
|
|
2077
2085
|
year: M.getFullYear(),
|
|
2078
2086
|
month: M.getMonth()
|
|
@@ -2084,16 +2092,16 @@ function CalendarPanel({ mode: r, selectedDate: M, selectedRange: N, onDateSelec
|
|
|
2084
2092
|
month: r.getMonth()
|
|
2085
2093
|
});
|
|
2086
2094
|
}
|
|
2087
|
-
}), V.current = M,
|
|
2095
|
+
}), V.current = M, G.current = N;
|
|
2088
2096
|
}, [
|
|
2089
2097
|
r,
|
|
2090
2098
|
M,
|
|
2091
2099
|
N
|
|
2092
2100
|
]);
|
|
2093
|
-
let Y = useMemo(() => generateCalendarDays(
|
|
2101
|
+
let Y = useMemo(() => generateCalendarDays(q.year, q.month), [q.year, q.month]);
|
|
2094
2102
|
function X(M) {
|
|
2095
2103
|
let L = M.getMonth(), R = M.getFullYear();
|
|
2096
|
-
if ((L !==
|
|
2104
|
+
if ((L !== q.month || R !== q.year) && J({
|
|
2097
2105
|
year: R,
|
|
2098
2106
|
month: L
|
|
2099
2107
|
}), r === "single") P(M), I();
|
|
@@ -2145,9 +2153,9 @@ function CalendarPanel({ mode: r, selectedDate: M, selectedRange: N, onDateSelec
|
|
|
2145
2153
|
/* @__PURE__ */ jsxs("div", {
|
|
2146
2154
|
className: "text-[10px] font-bold text-neutral-900",
|
|
2147
2155
|
children: [
|
|
2148
|
-
getMonthName(
|
|
2156
|
+
getMonthName(q.month),
|
|
2149
2157
|
" ",
|
|
2150
|
-
|
|
2158
|
+
q.year
|
|
2151
2159
|
]
|
|
2152
2160
|
}),
|
|
2153
2161
|
/* @__PURE__ */ jsx(IconButton, {
|
|
@@ -2249,14 +2257,14 @@ function DatePicker({ mode: r = "single", value: M, defaultValue: N, onChange: P
|
|
|
2249
2257
|
startDate: null,
|
|
2250
2258
|
endDate: null
|
|
2251
2259
|
};
|
|
2252
|
-
function
|
|
2260
|
+
function K(M) {
|
|
2253
2261
|
r === "single" && (V || R(M), P?.(M));
|
|
2254
2262
|
}
|
|
2255
2263
|
function q(M) {
|
|
2256
2264
|
r === "range" && (V || B(M), P?.(M));
|
|
2257
2265
|
}
|
|
2258
2266
|
function J() {
|
|
2259
|
-
r === "single" ?
|
|
2267
|
+
r === "single" ? K(null) : q({
|
|
2260
2268
|
startDate: null,
|
|
2261
2269
|
endDate: null
|
|
2262
2270
|
});
|
|
@@ -2273,7 +2281,7 @@ function DatePicker({ mode: r = "single", value: M, defaultValue: N, onChange: P
|
|
|
2273
2281
|
mode: r,
|
|
2274
2282
|
selectedDate: H,
|
|
2275
2283
|
selectedRange: U,
|
|
2276
|
-
onDateSelect:
|
|
2284
|
+
onDateSelect: K,
|
|
2277
2285
|
onRangeSelect: q
|
|
2278
2286
|
})
|
|
2279
2287
|
}) });
|
|
@@ -2357,6 +2365,10 @@ function IntegrationBar({ orientation: r = "vertical", children: M, onAddMore: N
|
|
|
2357
2365
|
})
|
|
2358
2366
|
});
|
|
2359
2367
|
}
|
|
2368
|
+
const PREVIEW_CARD_HEIGHT_SIZE = {
|
|
2369
|
+
normal: 165,
|
|
2370
|
+
compact: 60
|
|
2371
|
+
};
|
|
2360
2372
|
var PREVIEW_ACTION_CONFIG = {
|
|
2361
2373
|
fire: {
|
|
2362
2374
|
className: "group",
|
|
@@ -2386,23 +2398,55 @@ var PREVIEW_ACTION_CONFIG = {
|
|
|
2386
2398
|
})
|
|
2387
2399
|
}
|
|
2388
2400
|
};
|
|
2389
|
-
function
|
|
2401
|
+
function PreviewCheckbox({ checked: r, onCheckedChange: M }) {
|
|
2402
|
+
return /* @__PURE__ */ jsx(StopPropagation, { children: /* @__PURE__ */ jsx(Checkbox, {
|
|
2403
|
+
checked: r,
|
|
2404
|
+
onChange: M,
|
|
2405
|
+
icon: /* @__PURE__ */ jsx(CheckboxIcon, {
|
|
2406
|
+
size: 16,
|
|
2407
|
+
className: "text-white-variant-7"
|
|
2408
|
+
}),
|
|
2409
|
+
className: cn("[&_.checkbox-box]:rounded", "[&_.checkbox-box]:border", "[&_.checkbox-box]:border-neutral-600", "[&_.checkbox-box]:bg-white", "[&_.checkbox-box[data-state=checked]]:border-primary-500", "[&_.checkbox-box[data-state=checked]]:bg-primary-500", "[&_.checkbox-box[data-state=indeterminate]]:h-[18px]", "[&_.checkbox-box[data-state=indeterminate]]:w-[18px]", "[&_.checkbox-label]:flex", "[&_.checkbox-label]:items-center", "[&_.checkbox-label]:gap-1", "[&_.checkbox-label]:text-xs", "[&_.checkbox-label]:font-medium", "[&_.checkbox-label]:text-neutral-900")
|
|
2410
|
+
}) });
|
|
2411
|
+
}
|
|
2412
|
+
function PreviewStatusesList({ statuses: r, density: M }) {
|
|
2413
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2414
|
+
className: "flex gap-2",
|
|
2415
|
+
children: /* @__PURE__ */ jsx(StopPropagation, { children: Object.keys(r).map((N) => {
|
|
2416
|
+
let P = r[N];
|
|
2417
|
+
return P ? /* @__PURE__ */ jsx(StatusBadge, {
|
|
2418
|
+
status: N,
|
|
2419
|
+
label: P.label,
|
|
2420
|
+
onAction: P.onAction,
|
|
2421
|
+
density: M
|
|
2422
|
+
}, N) : null;
|
|
2423
|
+
}) })
|
|
2424
|
+
});
|
|
2425
|
+
}
|
|
2426
|
+
function PreviewActionsList({ actions: r }) {
|
|
2427
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2428
|
+
className: "flex gap-2",
|
|
2429
|
+
children: /* @__PURE__ */ jsx(StopPropagation, { children: Object.keys(r).map((M) => {
|
|
2430
|
+
let N = r[M];
|
|
2431
|
+
return N ? /* @__PURE__ */ jsx(IconButton, {
|
|
2432
|
+
...PREVIEW_ACTION_CONFIG[M],
|
|
2433
|
+
onClick: N.onClick
|
|
2434
|
+
}, M) : null;
|
|
2435
|
+
}) })
|
|
2436
|
+
});
|
|
2437
|
+
}
|
|
2438
|
+
function PreviewCard({ icon: r, sender: M, title: N, content: P, timestamp: F, workspace: I, read: L = !1, selected: R = !1, onSelect: z, checked: B = !1, onCheckedChange: V, statuses: H = {}, actions: U = {}, density: W = "normal" }) {
|
|
2390
2439
|
return /* @__PURE__ */ jsx(Card, {
|
|
2391
2440
|
as: Pressable,
|
|
2392
2441
|
onPress: z,
|
|
2393
|
-
className: cn("rounded-lg border-[1.5px] border-primary-400 bg-white-variant-5 p-4 hover:bg-primary-light", L && "border-neutral-400", R && "border-primary-500 bg-primary-light"),
|
|
2394
|
-
children: /* @__PURE__ */ jsxs(CardLayout, {
|
|
2442
|
+
className: cn("w-full rounded-lg border-[1.5px] border-primary-400 bg-white-variant-5 p-4 hover:bg-primary-light", L && "border-neutral-400", R && "border-primary-500 bg-primary-light", W === "normal" ? `h-[${PREVIEW_CARD_HEIGHT_SIZE.normal}px]` : `h-[${PREVIEW_CARD_HEIGHT_SIZE.compact}px]`),
|
|
2443
|
+
children: W === "normal" ? /* @__PURE__ */ jsxs(CardLayout, {
|
|
2395
2444
|
className: "gap-x-2 gap-y-1",
|
|
2396
2445
|
children: [
|
|
2397
|
-
/* @__PURE__ */ jsx(CardSidebar, { children: /* @__PURE__ */ jsx(
|
|
2446
|
+
/* @__PURE__ */ jsx(CardSidebar, { children: /* @__PURE__ */ jsx(PreviewCheckbox, {
|
|
2398
2447
|
checked: B,
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
size: 16,
|
|
2402
|
-
className: "text-white-variant-7"
|
|
2403
|
-
}),
|
|
2404
|
-
className: cn("[&_.checkbox-box]:rounded", "[&_.checkbox-box]:border", "[&_.checkbox-box]:border-neutral-600", "[&_.checkbox-box]:bg-white", "[&_.checkbox-box[data-state=checked]]:border-primary-500", "[&_.checkbox-box[data-state=checked]]:bg-primary-500", "[&_.checkbox-box[data-state=indeterminate]]:h-[18px]", "[&_.checkbox-box[data-state=indeterminate]]:w-[18px]", "[&_.checkbox-label]:flex", "[&_.checkbox-label]:items-center", "[&_.checkbox-label]:gap-1", "[&_.checkbox-label]:text-xs", "[&_.checkbox-label]:font-medium", "[&_.checkbox-label]:text-neutral-900")
|
|
2405
|
-
}) }) }),
|
|
2448
|
+
onCheckedChange: V
|
|
2449
|
+
}) }),
|
|
2406
2450
|
/* @__PURE__ */ jsxs(CardHeader, {
|
|
2407
2451
|
className: "grid grid-cols-[auto_minmax(0,1fr)_auto_auto] items-center gap-2",
|
|
2408
2452
|
children: [
|
|
@@ -2431,30 +2475,50 @@ function PreviewCard({ icon: r, sender: M, title: N, content: P, timestamp: F, w
|
|
|
2431
2475
|
}),
|
|
2432
2476
|
/* @__PURE__ */ jsxs(CardFooter, {
|
|
2433
2477
|
className: "mt-3 grid grid-cols-[minmax(0,1fr)_auto] items-center gap-1",
|
|
2434
|
-
children: [H
|
|
2435
|
-
className: "flex gap-2",
|
|
2436
|
-
children: /* @__PURE__ */ jsx(StopPropagation, { children: Object.keys(H).map((r) => {
|
|
2437
|
-
let M = H[r];
|
|
2438
|
-
return M ? /* @__PURE__ */ jsx(StatusBadge, {
|
|
2439
|
-
status: r,
|
|
2440
|
-
label: M.label,
|
|
2441
|
-
onAction: M.onAction
|
|
2442
|
-
}, r) : null;
|
|
2443
|
-
}) })
|
|
2444
|
-
}), U && /* @__PURE__ */ jsx("div", {
|
|
2445
|
-
className: "flex gap-2",
|
|
2446
|
-
children: /* @__PURE__ */ jsx(StopPropagation, { children: Object.keys(U).map((r) => {
|
|
2447
|
-
let M = U[r];
|
|
2448
|
-
if (!M) return null;
|
|
2449
|
-
let N = PREVIEW_ACTION_CONFIG[r];
|
|
2450
|
-
return /* @__PURE__ */ jsx(IconButton, {
|
|
2451
|
-
...N,
|
|
2452
|
-
onClick: M.onClick
|
|
2453
|
-
}, r);
|
|
2454
|
-
}) })
|
|
2455
|
-
})]
|
|
2478
|
+
children: [/* @__PURE__ */ jsx(PreviewStatusesList, { statuses: H }), /* @__PURE__ */ jsx(PreviewActionsList, { actions: U })]
|
|
2456
2479
|
})
|
|
2457
2480
|
]
|
|
2481
|
+
}) : /* @__PURE__ */ jsxs(CardLayout, {
|
|
2482
|
+
className: "grid grid-cols-[auto_1fr] grid-rows-1 gap-x-2",
|
|
2483
|
+
children: [/* @__PURE__ */ jsx(CardSidebar, {
|
|
2484
|
+
className: "flex items-center justify-center",
|
|
2485
|
+
children: /* @__PURE__ */ jsx(PreviewCheckbox, {
|
|
2486
|
+
checked: B,
|
|
2487
|
+
onCheckedChange: V
|
|
2488
|
+
})
|
|
2489
|
+
}), /* @__PURE__ */ jsxs(CardHeader, {
|
|
2490
|
+
className: "grid grid-cols-[auto_auto_minmax(0,1fr)_auto_auto_auto] items-center gap-2",
|
|
2491
|
+
children: [
|
|
2492
|
+
r,
|
|
2493
|
+
/* @__PURE__ */ jsx(PreviewStatusesList, {
|
|
2494
|
+
statuses: H,
|
|
2495
|
+
density: W
|
|
2496
|
+
}),
|
|
2497
|
+
/* @__PURE__ */ jsxs("div", {
|
|
2498
|
+
className: cn("flex min-w-0 items-center gap-2 text-sm font-bold whitespace-nowrap text-neutral-900", L && "font-medium"),
|
|
2499
|
+
children: [
|
|
2500
|
+
M,
|
|
2501
|
+
/* @__PURE__ */ jsx("span", {
|
|
2502
|
+
className: "shrink-0 text-sm text-neutral-500",
|
|
2503
|
+
children: "•"
|
|
2504
|
+
}),
|
|
2505
|
+
/* @__PURE__ */ jsx("span", {
|
|
2506
|
+
className: "truncate",
|
|
2507
|
+
children: N
|
|
2508
|
+
})
|
|
2509
|
+
]
|
|
2510
|
+
}),
|
|
2511
|
+
/* @__PURE__ */ jsx(PreviewActionsList, { actions: U }),
|
|
2512
|
+
/* @__PURE__ */ jsx("span", {
|
|
2513
|
+
className: "text-xs leading-tight font-semibold tracking-wide whitespace-nowrap text-neutral-800",
|
|
2514
|
+
children: F
|
|
2515
|
+
}),
|
|
2516
|
+
/* @__PURE__ */ jsx(InfoTooltip, {
|
|
2517
|
+
content: I,
|
|
2518
|
+
children: /* @__PURE__ */ jsx(Avatar, { name: I })
|
|
2519
|
+
})
|
|
2520
|
+
]
|
|
2521
|
+
})]
|
|
2458
2522
|
})
|
|
2459
2523
|
});
|
|
2460
2524
|
}
|
|
@@ -2463,7 +2527,7 @@ function SearchInput({ value: r, defaultValue: M, placeholder: N = "Search...",
|
|
|
2463
2527
|
function U(r) {
|
|
2464
2528
|
B || z(r), P?.(r);
|
|
2465
2529
|
}
|
|
2466
|
-
function
|
|
2530
|
+
function G() {
|
|
2467
2531
|
B || z(""), P?.(""), F?.();
|
|
2468
2532
|
}
|
|
2469
2533
|
return /* @__PURE__ */ jsxs("fieldset", {
|
|
@@ -2488,13 +2552,13 @@ function SearchInput({ value: r, defaultValue: M, placeholder: N = "Search...",
|
|
|
2488
2552
|
size: 16,
|
|
2489
2553
|
className: "text-neutral-700"
|
|
2490
2554
|
}),
|
|
2491
|
-
onClick:
|
|
2555
|
+
onClick: G,
|
|
2492
2556
|
"aria-label": "Clear search",
|
|
2493
2557
|
className: "rounded p-0 transition-opacity hover:opacity-70"
|
|
2494
2558
|
})
|
|
2495
2559
|
]
|
|
2496
2560
|
});
|
|
2497
2561
|
}
|
|
2498
|
-
export { AVATAR_COLOR, AVATAR_COLOR_KEYS, Accordion, AccordionContent, AccordionItem, AccordionTrigger, AccountIcon, ActionMenu, ActionMenuItem, AddIcon, AirtableIcon, ArrowIcon, AsanaIcon, Avatar, Badge, BulkActions, Button, CalendarIcon, Card, CardContent, CardFooter, CardHeader, CardLayout, CardSidebar, CardTitle, CheckCircleEmptyIcon, CheckCircleIcon, Checkbox, CheckboxIcon, ClickUpIcon, CloseIcon, CompactDensityIcon, CopyIcon, DarkIcon, DatePicker, Divider, Dropdown, DropdownContext, DropdownMenu, DropdownMenuItem, ExternalLinkIcon, FilterBar, FilterButton, FireIcon, GmailIcon, GoogleCalendarIcon, Icon, IconButton, IconCountButton, InfoTooltip, Input, InsightIcon, IntegrationBar, JiraIcon, LightIcon, LogoIcon, MinusIcon, MoreIcon, NormalDensityIcon, NotFireIcon, OutlookCalendarIcon, OutlookIcon, Pressable, PreviewCard, ReadIcon, SearchIcon, SearchInput, SlackIcon, StatusBadge, StopPropagation, SummaryIcon, SystemIcon, TeamsIcon, Toaster, Tooltip, UnreadIcon, capitalize, cn, colors, formatDate, formatDateRange, generateCalendarDays, getDaysInMonth, getFirstDayOfMonth, getInitials, getMonthName, getWeekdays, isDateBefore, isDateInRange, isSameDay, isToday, parseDate, pickColorFromPalette, stringHash, toMondayBased, toast, toastStore, useAccordion, useDropdown, useLongPress };
|
|
2562
|
+
export { AVATAR_COLOR, AVATAR_COLOR_KEYS, Accordion, AccordionContent, AccordionItem, AccordionTrigger, AccountIcon, ActionMenu, ActionMenuItem, AddIcon, AirtableIcon, ArrowIcon, AsanaIcon, Avatar, Badge, BulkActions, Button, CalendarIcon, Card, CardContent, CardFooter, CardHeader, CardLayout, CardSidebar, CardTitle, CheckCircleEmptyIcon, CheckCircleIcon, Checkbox, CheckboxIcon, ClickUpIcon, CloseIcon, CompactDensityIcon, CopyIcon, DarkIcon, DatePicker, Divider, Dropdown, DropdownContext, DropdownMenu, DropdownMenuItem, ExternalLinkIcon, FilterBar, FilterButton, FireIcon, GmailIcon, GoogleCalendarIcon, Icon, IconButton, IconCountButton, InfoTooltip, Input, InsightIcon, IntegrationBar, JiraIcon, LightIcon, LogoIcon, MinusIcon, MoreIcon, NormalDensityIcon, NotFireIcon, OutlookCalendarIcon, OutlookIcon, PREVIEW_CARD_HEIGHT_SIZE, Pressable, PreviewCard, ReadIcon, SearchIcon, SearchInput, SlackIcon, StatusBadge, StopPropagation, SummaryIcon, SystemIcon, TeamsIcon, Toaster, Tooltip, UnreadIcon, capitalize, cn, colors, formatDate, formatDateRange, generateCalendarDays, getDaysInMonth, getFirstDayOfMonth, getInitials, getMonthName, getWeekdays, isDateBefore, isDateInRange, isSameDay, isToday, parseDate, pickColorFromPalette, stringHash, toMondayBased, toast, toastStore, useAccordion, useDropdown, useLongPress };
|
|
2499
2563
|
|
|
2500
2564
|
//# sourceMappingURL=index.js.map
|