@pibit.ai/cure-design-system 0.6.27 → 0.6.28
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/hooks/use-escape-layer.d.ts +10 -0
- package/dist/hooks/use-escape-layer.d.ts.map +1 -0
- package/dist/hooks/use-escape-layer.js +35 -0
- package/dist/patterns/drawer/drawer.d.ts.map +1 -1
- package/dist/patterns/drawer/drawer.js +104 -93
- package/dist/patterns/expandable-drawer/expandable-drawer.js +9 -9
- package/dist/patterns/filters/checklist-select.js +36 -36
- package/dist/patterns/filters/filter-list-section.js +44 -44
- package/dist/patterns/filters/status-filter-dropdown.d.ts.map +1 -1
- package/dist/patterns/filters/status-filter-dropdown.js +83 -74
- package/dist/patterns/modal/modal-wrapper.d.ts.map +1 -1
- package/dist/patterns/modal/modal-wrapper.js +32 -46
- package/dist/patterns/sub-sidebar/sub-sidebar.d.ts.map +1 -1
- package/dist/patterns/sub-sidebar/sub-sidebar.js +93 -86
- package/dist/patterns/tabs/tabs.d.ts.map +1 -1
- package/dist/patterns/tabs/tabs.js +1 -4
- package/dist/styles/components.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Wrap a layer's children in this, with the depth `useEscapeLayer` returned, so layers inside it nest. */
|
|
2
|
+
export declare const EscapeLayerProvider: import('react').Provider<number>;
|
|
3
|
+
/**
|
|
4
|
+
* While `isActive`, registers this overlay for Escape; Escape then calls `onEscape` when this is the
|
|
5
|
+
* innermost open layer. Pass `onEscape: null` for a layer that must swallow Escape without closing
|
|
6
|
+
* (a non-dismissable modal). The callback is read through a ref, so an inline function is fine.
|
|
7
|
+
* Returns this layer's depth for `EscapeLayerProvider`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useEscapeLayer(isActive: boolean, onEscape: (() => void) | null): number;
|
|
10
|
+
//# sourceMappingURL=use-escape-layer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-escape-layer.d.ts","sourceRoot":"","sources":["../../src/hooks/use-escape-layer.ts"],"names":[],"mappings":"AA0BA,2GAA2G;AAC3G,eAAO,MAAM,mBAAmB,kCAA4B,CAAC;AAE7D;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,GAAG,MAAM,CAsBvF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createContext as l, useContext as p, useRef as f, useEffect as a } from "react";
|
|
2
|
+
const s = [];
|
|
3
|
+
let h = 0, u = !1;
|
|
4
|
+
const y = () => {
|
|
5
|
+
u || typeof document > "u" || (document.addEventListener("keydown", (r) => {
|
|
6
|
+
if (r.key !== "Escape" || s.length === 0 || r.defaultPrevented) return;
|
|
7
|
+
s.reduce((t, e) => e.depth > t.depth || e.depth === t.depth && e.order > t.order ? e : t).close();
|
|
8
|
+
}), u = !0);
|
|
9
|
+
}, i = l(0), m = i.Provider;
|
|
10
|
+
function x(r, o) {
|
|
11
|
+
const t = p(i) + 1, e = f(o);
|
|
12
|
+
e.current = o;
|
|
13
|
+
const c = o !== null;
|
|
14
|
+
return a(() => {
|
|
15
|
+
if (!r) return;
|
|
16
|
+
y();
|
|
17
|
+
const d = {
|
|
18
|
+
close: c ? () => {
|
|
19
|
+
var n;
|
|
20
|
+
return (n = e.current) == null ? void 0 : n.call(e);
|
|
21
|
+
} : () => {
|
|
22
|
+
},
|
|
23
|
+
depth: t,
|
|
24
|
+
order: ++h
|
|
25
|
+
};
|
|
26
|
+
return s.push(d), () => {
|
|
27
|
+
const n = s.indexOf(d);
|
|
28
|
+
n >= 0 && s.splice(n, 1);
|
|
29
|
+
};
|
|
30
|
+
}, [r, c, t]), t;
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
m as EscapeLayerProvider,
|
|
34
|
+
x as useEscapeLayer
|
|
35
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../../src/patterns/drawer/drawer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../../src/patterns/drawer/drawer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmC,MAAM,OAAO,CAAC;AAYxD,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,8GAA8G;IAC9G,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACxB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,wFAAwF;IACxF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,wEAAwE;IACxE,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/C,yEAAyE;IACzE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6FAA6F;IAC7F,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iDAAiD;IACjD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oCAAoC;IACpC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,4DAA4D;IAC5D,sBAAsB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,iFAAiF;IACjF,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,sBAAsB,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACjD,0CAA0C;IAC1C,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA6QxC,CAAC"}
|
|
@@ -1,150 +1,161 @@
|
|
|
1
|
-
import { jsxs as l, Fragment as
|
|
2
|
-
import { Minimize01 as
|
|
3
|
-
import { useId as
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import { jsxs as l, Fragment as dt, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Minimize01 as M, Expand01 as j, X as ut } from "@untitledui/icons";
|
|
3
|
+
import { useId as mt, useRef as X, useEffect as q } from "react";
|
|
4
|
+
import { useEscapeLayer as ft, EscapeLayerProvider as vt } from "../../hooks/use-escape-layer.js";
|
|
5
|
+
import { ClickAwayListener as yt } from "../click-away/click-away-listener.js";
|
|
6
|
+
const kt = ({
|
|
7
|
+
isOpen: o,
|
|
8
|
+
onClose: y,
|
|
9
|
+
title: p,
|
|
10
|
+
subtitle: I,
|
|
11
|
+
children: A,
|
|
12
|
+
width: _ = "max-w-lg",
|
|
13
|
+
footer: K,
|
|
14
|
+
showDefaultFooter: T = !1,
|
|
15
|
+
className: B = "",
|
|
16
|
+
side: i = "right",
|
|
17
|
+
style: U,
|
|
18
|
+
leftOffset: $ = 0,
|
|
19
|
+
headerClassName: V = "",
|
|
20
|
+
bodyClassName: Y = "",
|
|
20
21
|
header: d = null,
|
|
21
|
-
onClickOutside:
|
|
22
|
-
showBackDrop:
|
|
23
|
-
footerClassName:
|
|
24
|
-
expanded:
|
|
22
|
+
onClickOutside: G,
|
|
23
|
+
showBackDrop: H = !1,
|
|
24
|
+
footerClassName: J = "",
|
|
25
|
+
expanded: c = !1,
|
|
25
26
|
onExpandedChange: u,
|
|
26
|
-
maxWidth:
|
|
27
|
-
resizableWidth:
|
|
28
|
-
minResizableWidth:
|
|
29
|
-
maxResizableWidth:
|
|
30
|
-
onResizableWidthChange:
|
|
31
|
-
headerActions:
|
|
32
|
-
fullscreenOpen:
|
|
27
|
+
maxWidth: h = "90vw",
|
|
28
|
+
resizableWidth: s,
|
|
29
|
+
minResizableWidth: x = 476,
|
|
30
|
+
maxResizableWidth: Q,
|
|
31
|
+
onResizableWidthChange: a,
|
|
32
|
+
headerActions: Z,
|
|
33
|
+
fullscreenOpen: b = !1,
|
|
33
34
|
onFullscreenOpenChange: m,
|
|
34
|
-
"data-testid":
|
|
35
|
+
"data-testid": F
|
|
35
36
|
}) => {
|
|
36
|
-
const f = u !== void 0,
|
|
37
|
-
|
|
37
|
+
const f = u !== void 0, z = m !== void 0, v = s !== void 0 && a !== void 0, w = Math.max(Q ?? Number.POSITIVE_INFINITY, x), N = o && v, g = (t) => Math.min(Math.max(t, x), w), E = mt(), S = X(null), C = ft(o, y);
|
|
38
|
+
q(() => {
|
|
39
|
+
if (!o) return;
|
|
40
|
+
const t = document.activeElement, r = S.current;
|
|
41
|
+
return r && !r.contains(document.activeElement) && r.focus({ preventScroll: !0 }), () => {
|
|
42
|
+
(!document.activeElement || document.activeElement === document.body || !!(r != null && r.contains(document.activeElement))) && (t != null && t.isConnected) && t.focus({ preventScroll: !0 });
|
|
43
|
+
};
|
|
44
|
+
}, [o]);
|
|
45
|
+
const n = X(null);
|
|
46
|
+
q(() => () => {
|
|
38
47
|
var t;
|
|
39
|
-
return (t =
|
|
48
|
+
return (t = n.current) == null ? void 0 : t.call(n);
|
|
40
49
|
}, []);
|
|
41
|
-
const
|
|
42
|
-
if (!
|
|
50
|
+
const R = (t) => {
|
|
51
|
+
if (!N || s === void 0) return;
|
|
43
52
|
t.preventDefault(), t.stopPropagation();
|
|
44
|
-
const
|
|
53
|
+
const r = t.clientX, D = s, ct = document.body.style.cursor, nt = document.body.style.userSelect;
|
|
45
54
|
document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
document.body.style.cursor =
|
|
55
|
+
const P = (it) => {
|
|
56
|
+
a == null || a(g(D + r - it.clientX));
|
|
57
|
+
}, k = () => {
|
|
58
|
+
document.body.style.cursor = ct, document.body.style.userSelect = nt, window.removeEventListener("pointermove", P), window.removeEventListener("pointerup", k), n.current = null;
|
|
50
59
|
};
|
|
51
|
-
|
|
52
|
-
},
|
|
53
|
-
if (!
|
|
54
|
-
const
|
|
55
|
-
t.key === "ArrowLeft" && (t.preventDefault(),
|
|
56
|
-
},
|
|
57
|
-
const t = { ...
|
|
58
|
-
if (
|
|
59
|
-
const
|
|
60
|
-
t.transform = `translateX(${
|
|
60
|
+
n.current = k, window.addEventListener("pointermove", P), window.addEventListener("pointerup", k);
|
|
61
|
+
}, O = (t) => {
|
|
62
|
+
if (!N || s === void 0) return;
|
|
63
|
+
const r = t.shiftKey ? 50 : 16;
|
|
64
|
+
t.key === "ArrowLeft" && (t.preventDefault(), a == null || a(g(s + r))), t.key === "ArrowRight" && (t.preventDefault(), a == null || a(g(s - r)));
|
|
65
|
+
}, W = i === "left" ? o ? "left-4" : "left-0" : o ? "right-[6px]" : "right-0", L = i === "left" && $ > 0, tt = (() => {
|
|
66
|
+
const t = { ...U };
|
|
67
|
+
if (L) {
|
|
68
|
+
const r = o ? `${$}px` : "calc(-100%)";
|
|
69
|
+
t.transform = `translateX(${r})`;
|
|
61
70
|
}
|
|
62
|
-
return
|
|
63
|
-
})(),
|
|
64
|
-
${
|
|
71
|
+
return v && s !== void 0 ? (t.width = s, t.maxWidth = s) : f && (t.width = c ? h : "32rem", t.maxWidth = c ? h : "32rem"), t;
|
|
72
|
+
})(), et = L ? "" : i === "left" ? o ? "translate-x-0" : "-translate-x-full" : o ? "translate-x-0" : "translate-x-full", rt = `
|
|
73
|
+
${W}
|
|
65
74
|
fixed h-[calc(100vh-12px)] my-[6px] bottom-0
|
|
66
|
-
${
|
|
75
|
+
${v || f ? "" : `w-full ${_}`}
|
|
67
76
|
transform transition-transform duration-300 ease-in-out z-[100]
|
|
68
|
-
${
|
|
69
|
-
${
|
|
77
|
+
${v ? "" : "transition-[width] duration-300 ease-in-out"}
|
|
78
|
+
${et} ${B}`, ot = {
|
|
70
79
|
backgroundImage: "linear-gradient(90deg, rgba(6, 132, 240, 0.1) 0%, rgba(6, 132, 240, 0.1) 100%), linear-gradient(0deg, rgba(255, 255, 255, 0) 60.66%, rgba(255, 255, 255, 0.5) 100%), linear-gradient(90deg, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0.3) 100%)"
|
|
71
|
-
},
|
|
72
|
-
return /* @__PURE__ */ l(
|
|
73
|
-
|
|
74
|
-
/* @__PURE__ */
|
|
80
|
+
}, st = `flex items-center justify-between pl-6 pr-2 border-b border-secondary gap-2 py-4 ${V} h-[60px]`, at = `px-5 pb-3 overflow-y-auto flex-grow ${Y}`, lt = `p-4 ${J}`;
|
|
81
|
+
return /* @__PURE__ */ l(dt, { children: [
|
|
82
|
+
o && H && /* @__PURE__ */ e("div", { className: "fixed inset-0 z-[99] bg-black/40", onClick: G, "aria-hidden": "true" }),
|
|
83
|
+
/* @__PURE__ */ e("div", { className: o ? "w-[100vw-64px] h-[100vh] fixed inset-0 z-[9999]" : "hidden", children: /* @__PURE__ */ e(yt, { onClickAway: y, as: "div", children: /* @__PURE__ */ e(
|
|
75
84
|
"div",
|
|
76
85
|
{
|
|
77
|
-
|
|
78
|
-
|
|
86
|
+
ref: S,
|
|
87
|
+
tabIndex: -1,
|
|
88
|
+
className: `${rt} outline-none`,
|
|
89
|
+
style: tt,
|
|
79
90
|
role: "dialog",
|
|
80
91
|
"aria-modal": "true",
|
|
81
|
-
"aria-labelledby": d ? void 0 :
|
|
82
|
-
"aria-label": d &&
|
|
83
|
-
"data-testid":
|
|
92
|
+
"aria-labelledby": d ? void 0 : E,
|
|
93
|
+
"aria-label": d && p ? p : void 0,
|
|
94
|
+
"data-testid": F,
|
|
84
95
|
onClick: (t) => t.stopPropagation(),
|
|
85
96
|
children: /* @__PURE__ */ l(
|
|
86
97
|
"div",
|
|
87
98
|
{
|
|
88
|
-
className: `relative h-full w-full backdrop-blur-[3px] rounded-2xl p-2 ${
|
|
89
|
-
style:
|
|
99
|
+
className: `relative h-full w-full backdrop-blur-[3px] rounded-2xl p-2 ${i === "right" ? "border-l border-t border-b border-white" : "border border-white"}`,
|
|
100
|
+
style: ot,
|
|
90
101
|
children: [
|
|
91
|
-
|
|
102
|
+
N && /* @__PURE__ */ e(
|
|
92
103
|
"div",
|
|
93
104
|
{
|
|
94
105
|
role: "separator",
|
|
95
106
|
"aria-label": "Resize drawer",
|
|
96
107
|
"aria-orientation": "vertical",
|
|
97
|
-
"aria-valuemin":
|
|
98
|
-
"aria-valuemax": Number.isFinite(
|
|
99
|
-
"aria-valuenow": Math.round(
|
|
108
|
+
"aria-valuemin": x,
|
|
109
|
+
"aria-valuemax": Number.isFinite(w) ? w : void 0,
|
|
110
|
+
"aria-valuenow": Math.round(s),
|
|
100
111
|
tabIndex: 0,
|
|
101
|
-
onPointerDown:
|
|
102
|
-
onKeyDown:
|
|
103
|
-
className: "absolute left-0 top-0 z-10 h-full w-2 -translate-x-1 cursor-col-resize touch-none focus-visible:
|
|
112
|
+
onPointerDown: R,
|
|
113
|
+
onKeyDown: O,
|
|
114
|
+
className: "absolute left-0 top-0 z-10 h-full w-2 -translate-x-1 cursor-col-resize touch-none rounded-full outline-none focus-visible:bg-brand-solid"
|
|
104
115
|
}
|
|
105
116
|
),
|
|
106
117
|
/* @__PURE__ */ l("div", { className: "h-full w-full bg-white rounded-lg overflow-hidden flex flex-col", children: [
|
|
107
|
-
d || /* @__PURE__ */ l("header", { className:
|
|
118
|
+
d || /* @__PURE__ */ l("header", { className: st, children: [
|
|
108
119
|
/* @__PURE__ */ l("div", { className: `flex-1 flex flex-col gap-0 ${f ? "pr-2" : "pr-16"}`, children: [
|
|
109
|
-
/* @__PURE__ */
|
|
110
|
-
|
|
120
|
+
/* @__PURE__ */ e("h2", { id: E, className: "text-lg font-semibold leading-7 text-[#06060a]", children: p }),
|
|
121
|
+
I && /* @__PURE__ */ e("p", { className: "text-sm text-secondary", children: I })
|
|
111
122
|
] }),
|
|
112
123
|
/* @__PURE__ */ l("div", { className: "flex items-center gap-1", children: [
|
|
113
|
-
|
|
114
|
-
|
|
124
|
+
Z,
|
|
125
|
+
z && /* @__PURE__ */ e(
|
|
115
126
|
"button",
|
|
116
127
|
{
|
|
117
128
|
type: "button",
|
|
118
|
-
onClick: () => m == null ? void 0 : m(!
|
|
129
|
+
onClick: () => m == null ? void 0 : m(!b),
|
|
119
130
|
className: "flex items-center justify-center p-2 rounded-lg hover:bg-primary_hover transition-colors cursor-pointer",
|
|
120
|
-
"aria-label":
|
|
121
|
-
children:
|
|
131
|
+
"aria-label": b ? "Exit full screen" : "Open full screen",
|
|
132
|
+
children: b ? /* @__PURE__ */ e(M, { size: 20, className: "text-fg-quaternary", strokeWidth: 1.67 }) : /* @__PURE__ */ e(j, { size: 20, className: "text-fg-quaternary", strokeWidth: 1.67 })
|
|
122
133
|
}
|
|
123
134
|
),
|
|
124
|
-
f && /* @__PURE__ */
|
|
135
|
+
f && /* @__PURE__ */ e(
|
|
125
136
|
"button",
|
|
126
137
|
{
|
|
127
138
|
type: "button",
|
|
128
|
-
onClick: () => u == null ? void 0 : u(!
|
|
139
|
+
onClick: () => u == null ? void 0 : u(!c),
|
|
129
140
|
className: "flex items-center justify-center p-2 rounded-lg hover:bg-primary_hover transition-colors cursor-pointer",
|
|
130
|
-
"aria-label":
|
|
131
|
-
children:
|
|
141
|
+
"aria-label": c ? "Collapse sidebar" : "Expand sidebar",
|
|
142
|
+
children: c ? /* @__PURE__ */ e(M, { size: 20, className: "text-fg-quaternary", strokeWidth: 1.67 }) : /* @__PURE__ */ e(j, { size: 20, className: "text-fg-quaternary", strokeWidth: 1.67 })
|
|
132
143
|
}
|
|
133
144
|
),
|
|
134
|
-
/* @__PURE__ */
|
|
145
|
+
/* @__PURE__ */ e(
|
|
135
146
|
"button",
|
|
136
147
|
{
|
|
137
148
|
type: "button",
|
|
138
|
-
onClick:
|
|
149
|
+
onClick: y,
|
|
139
150
|
"aria-label": "Close",
|
|
140
151
|
className: "flex items-center justify-center p-2 rounded-lg hover:bg-primary_hover transition-colors cursor-pointer",
|
|
141
|
-
children: /* @__PURE__ */
|
|
152
|
+
children: /* @__PURE__ */ e(ut, { size: 20, className: "text-fg-quaternary", strokeWidth: 1.67 })
|
|
142
153
|
}
|
|
143
154
|
)
|
|
144
155
|
] })
|
|
145
156
|
] }),
|
|
146
|
-
/* @__PURE__ */
|
|
147
|
-
|
|
157
|
+
/* @__PURE__ */ e("main", { className: at, children: /* @__PURE__ */ e(vt, { value: C, children: A }) }),
|
|
158
|
+
T && /* @__PURE__ */ e("footer", { className: lt, children: K })
|
|
148
159
|
] })
|
|
149
160
|
]
|
|
150
161
|
}
|
|
@@ -154,5 +165,5 @@ const xt = ({
|
|
|
154
165
|
] });
|
|
155
166
|
};
|
|
156
167
|
export {
|
|
157
|
-
|
|
168
|
+
kt as Drawer
|
|
158
169
|
};
|
|
@@ -4,7 +4,7 @@ import { useState as U, useId as Y, useRef as G, useEffect as J } from "react";
|
|
|
4
4
|
import { motion as Q } from "../../node_modules/framer-motion/dist/es/render/components/motion/proxy.js";
|
|
5
5
|
const Z = 512, W = "calc(100vw - 140px)", C = { type: "tween", duration: 0.3, ease: "easeInOut" }, se = ({
|
|
6
6
|
state: o,
|
|
7
|
-
onClose:
|
|
7
|
+
onClose: I,
|
|
8
8
|
header: s,
|
|
9
9
|
title: u = "",
|
|
10
10
|
subtitle: y,
|
|
@@ -23,7 +23,7 @@ const Z = 512, W = "calc(100vw - 140px)", C = { type: "tween", duration: 0.3, ea
|
|
|
23
23
|
}) => {
|
|
24
24
|
const [w, L] = U(!1), m = o !== "hidden";
|
|
25
25
|
m && !w && L(!0);
|
|
26
|
-
const N = c !== void 0, b = o === "expanded", l = o === "hidden" ? 0 : o === "expanded" ? k : R ?? D, f = Math.max(M ?? Number.POSITIVE_INFINITY, a), p = o === "normal" && m && typeof l == "number" && r !== void 0, v = (e) => Math.min(Math.max(e, a), f),
|
|
26
|
+
const N = c !== void 0, b = o === "expanded", l = o === "hidden" ? 0 : o === "expanded" ? k : R ?? D, f = Math.max(M ?? Number.POSITIVE_INFINITY, a), p = o === "normal" && m && typeof l == "number" && r !== void 0, v = (e) => Math.min(Math.max(e, a), f), g = Y(), i = G(null);
|
|
27
27
|
J(() => () => {
|
|
28
28
|
var e;
|
|
29
29
|
return (e = i.current) == null ? void 0 : e.call(i);
|
|
@@ -33,12 +33,12 @@ const Z = 512, W = "calc(100vw - 140px)", C = { type: "tween", duration: 0.3, ea
|
|
|
33
33
|
e.preventDefault(), e.stopPropagation();
|
|
34
34
|
const d = e.clientX, $ = l, O = document.body.style.cursor, q = document.body.style.userSelect;
|
|
35
35
|
document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
|
|
36
|
-
const
|
|
36
|
+
const h = (B) => {
|
|
37
37
|
r == null || r(v($ + d - B.clientX));
|
|
38
38
|
}, x = () => {
|
|
39
|
-
document.body.style.cursor = O, document.body.style.userSelect = q, window.removeEventListener("pointermove",
|
|
39
|
+
document.body.style.cursor = O, document.body.style.userSelect = q, window.removeEventListener("pointermove", h), window.removeEventListener("pointerup", x), i.current = null;
|
|
40
40
|
};
|
|
41
|
-
i.current = x, window.addEventListener("pointermove",
|
|
41
|
+
i.current = x, window.addEventListener("pointermove", h), window.addEventListener("pointerup", x);
|
|
42
42
|
}, X = (e) => {
|
|
43
43
|
if (!p || typeof l != "number") return;
|
|
44
44
|
const d = e.shiftKey ? 50 : 16;
|
|
@@ -60,7 +60,7 @@ const Z = 512, W = "calc(100vw - 140px)", C = { type: "tween", duration: 0.3, ea
|
|
|
60
60
|
"div",
|
|
61
61
|
{
|
|
62
62
|
role: "region",
|
|
63
|
-
"aria-labelledby": s == null ?
|
|
63
|
+
"aria-labelledby": s == null ? g : void 0,
|
|
64
64
|
"aria-label": s != null && u ? u : void 0,
|
|
65
65
|
className: "h-full w-full min-w-0 flex flex-col rounded-2xl border-l border-t border-b border-white backdrop-blur-[3px] p-2",
|
|
66
66
|
style: _,
|
|
@@ -77,13 +77,13 @@ const Z = 512, W = "calc(100vw - 140px)", C = { type: "tween", duration: 0.3, ea
|
|
|
77
77
|
tabIndex: 0,
|
|
78
78
|
onPointerDown: T,
|
|
79
79
|
onKeyDown: X,
|
|
80
|
-
className: "absolute left-0 top-0 z-10 h-full w-2 -translate-x-1 cursor-col-resize touch-none focus-visible:
|
|
80
|
+
className: "absolute left-0 top-0 z-10 h-full w-2 -translate-x-1 cursor-col-resize touch-none rounded-full outline-none focus-visible:bg-brand-solid"
|
|
81
81
|
}
|
|
82
82
|
),
|
|
83
83
|
/* @__PURE__ */ n("div", { className: "h-full w-full bg-white rounded-lg overflow-hidden flex flex-col min-w-0", children: [
|
|
84
84
|
s ?? /* @__PURE__ */ n("header", { className: j, children: [
|
|
85
85
|
/* @__PURE__ */ n("div", { className: `flex-1 flex flex-col gap-0 min-w-0 ${N ? "pr-2" : "pr-16"}`, children: [
|
|
86
|
-
/* @__PURE__ */ t("h2", { id:
|
|
86
|
+
/* @__PURE__ */ t("h2", { id: g, className: "text-lg font-semibold leading-7 text-[#06060a] truncate", children: u }),
|
|
87
87
|
y && /* @__PURE__ */ t("p", { className: "text-sm text-secondary truncate", children: y })
|
|
88
88
|
] }),
|
|
89
89
|
/* @__PURE__ */ n("div", { className: "flex items-center gap-1 flex-shrink-0", children: [
|
|
@@ -102,7 +102,7 @@ const Z = 512, W = "calc(100vw - 140px)", C = { type: "tween", duration: 0.3, ea
|
|
|
102
102
|
"button",
|
|
103
103
|
{
|
|
104
104
|
type: "button",
|
|
105
|
-
onClick:
|
|
105
|
+
onClick: I,
|
|
106
106
|
className: "flex items-center justify-center p-2 rounded-lg hover:bg-primary_hover transition-colors cursor-pointer",
|
|
107
107
|
"aria-label": "Close",
|
|
108
108
|
children: /* @__PURE__ */ t(F, { size: 20, className: "text-fg-quaternary", strokeWidth: 1.67 })
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { MinusSquare as
|
|
3
|
-
import { cx as
|
|
4
|
-
import { Checkbox as
|
|
5
|
-
import { Button as
|
|
1
|
+
import { jsxs as i, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { MinusSquare as N } from "@untitledui/icons";
|
|
3
|
+
import { cx as f } from "../../utils/cn.js";
|
|
4
|
+
import { Checkbox as h } from "../../primitives/checkbox/checkbox.js";
|
|
5
|
+
import { Button as b } from "../../primitives/button/button.js";
|
|
6
6
|
function D({
|
|
7
|
-
options:
|
|
7
|
+
options: p,
|
|
8
8
|
selectedKeys: c,
|
|
9
9
|
onChange: l,
|
|
10
10
|
onApply: d,
|
|
11
11
|
onReset: m,
|
|
12
|
-
onClose:
|
|
13
|
-
className:
|
|
12
|
+
onClose: o,
|
|
13
|
+
className: y
|
|
14
14
|
}) {
|
|
15
|
-
const
|
|
16
|
-
|
|
15
|
+
const s = p.map((e) => e.key).filter(Boolean), t = new Set(c), u = s.length > 0 && t.size === s.length, x = t.size > 0 && t.size < s.length, n = () => {
|
|
16
|
+
u || x ? l == null || l([]) : l == null || l(s);
|
|
17
17
|
}, k = (e) => {
|
|
18
|
-
const
|
|
19
|
-
|
|
18
|
+
const a = new Set(c);
|
|
19
|
+
a.has(e) ? a.delete(e) : a.add(e), l == null || l(Array.from(a));
|
|
20
20
|
}, S = () => {
|
|
21
|
-
d == null || d(c),
|
|
22
|
-
},
|
|
21
|
+
d == null || d(c), o == null || o();
|
|
22
|
+
}, v = () => {
|
|
23
23
|
m == null || m();
|
|
24
24
|
};
|
|
25
|
-
return /* @__PURE__ */
|
|
25
|
+
return /* @__PURE__ */ i(
|
|
26
26
|
"div",
|
|
27
27
|
{
|
|
28
|
-
className:
|
|
28
|
+
className: f(
|
|
29
29
|
"flex flex-col rounded-xl bg-primary shadow-sm ring-1 ring-primary",
|
|
30
|
-
|
|
30
|
+
y
|
|
31
31
|
),
|
|
32
32
|
"data-slot": "checklist-select",
|
|
33
33
|
children: [
|
|
34
|
-
/* @__PURE__ */
|
|
35
|
-
/* @__PURE__ */
|
|
34
|
+
/* @__PURE__ */ i("div", { className: "flex flex-col gap-0 p-3", children: [
|
|
35
|
+
/* @__PURE__ */ i(
|
|
36
36
|
"label",
|
|
37
37
|
{
|
|
38
|
-
className:
|
|
38
|
+
className: f(
|
|
39
39
|
"flex cursor-pointer items-center gap-3 rounded-md py-2 pr-2 pl-0 outline-hidden",
|
|
40
40
|
"hover:bg-primary_hover"
|
|
41
41
|
),
|
|
42
42
|
children: [
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
x ? /* @__PURE__ */ r(
|
|
44
|
+
N,
|
|
45
45
|
{
|
|
46
46
|
size: 18,
|
|
47
|
-
className: "text-utility-brand-600",
|
|
48
|
-
onClick:
|
|
47
|
+
className: "text-utility-brand-600 rounded-sm outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring",
|
|
48
|
+
onClick: n,
|
|
49
49
|
cursor: "pointer",
|
|
50
50
|
"aria-hidden": !1,
|
|
51
51
|
role: "checkbox",
|
|
@@ -53,14 +53,14 @@ function D({
|
|
|
53
53
|
"aria-label": "Select all options",
|
|
54
54
|
tabIndex: 0,
|
|
55
55
|
onKeyDown: (e) => {
|
|
56
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
56
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), n());
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
) : /* @__PURE__ */ r(
|
|
60
|
-
|
|
60
|
+
h,
|
|
61
61
|
{
|
|
62
|
-
isSelected:
|
|
63
|
-
onChange:
|
|
62
|
+
isSelected: u,
|
|
63
|
+
onChange: n,
|
|
64
64
|
size: "sm",
|
|
65
65
|
"aria-label": "Select all options"
|
|
66
66
|
}
|
|
@@ -69,18 +69,18 @@ function D({
|
|
|
69
69
|
]
|
|
70
70
|
}
|
|
71
71
|
),
|
|
72
|
-
|
|
72
|
+
p.map((e) => /* @__PURE__ */ i(
|
|
73
73
|
"label",
|
|
74
74
|
{
|
|
75
|
-
className:
|
|
75
|
+
className: f(
|
|
76
76
|
"flex cursor-pointer items-center gap-3 rounded-md py-2 pr-2 pl-0 outline-hidden",
|
|
77
77
|
"hover:bg-primary_hover"
|
|
78
78
|
),
|
|
79
79
|
children: [
|
|
80
80
|
/* @__PURE__ */ r(
|
|
81
|
-
|
|
81
|
+
h,
|
|
82
82
|
{
|
|
83
|
-
isSelected:
|
|
83
|
+
isSelected: t.has(e.key),
|
|
84
84
|
onChange: () => k(e.key),
|
|
85
85
|
size: "sm",
|
|
86
86
|
"aria-label": e.value
|
|
@@ -92,19 +92,19 @@ function D({
|
|
|
92
92
|
e.key
|
|
93
93
|
))
|
|
94
94
|
] }),
|
|
95
|
-
/* @__PURE__ */
|
|
95
|
+
/* @__PURE__ */ i("div", { className: "flex gap-2 border-primary p-3", children: [
|
|
96
96
|
/* @__PURE__ */ r(
|
|
97
|
-
|
|
97
|
+
b,
|
|
98
98
|
{
|
|
99
99
|
size: "xs",
|
|
100
100
|
color: "secondary",
|
|
101
101
|
className: "flex-1 bg-secondary border-none text-primary",
|
|
102
|
-
onClick:
|
|
102
|
+
onClick: v,
|
|
103
103
|
children: "Reset"
|
|
104
104
|
}
|
|
105
105
|
),
|
|
106
106
|
/* @__PURE__ */ r(
|
|
107
|
-
|
|
107
|
+
b,
|
|
108
108
|
{
|
|
109
109
|
size: "xs",
|
|
110
110
|
color: "primary",
|