@thewrong/ui 0.3.0 → 0.4.0
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 +2 -2
- package/dist/components/button/Button.cjs +1 -1
- package/dist/components/button/Button.d.ts +3 -0
- package/dist/components/button/Button.esm.js +17 -5
- package/dist/components/button/types.d.ts +3 -1
- package/dist/components/button/utils.cjs +1 -1
- package/dist/components/button/utils.d.ts +2 -2
- package/dist/components/button/utils.esm.js +6 -2
- package/dist/components/progress/Progress.cjs +1 -1
- package/dist/components/progress/Progress.d.ts +3 -4
- package/dist/components/progress/Progress.esm.js +5 -5
- package/dist/components/progress/types.d.ts +2 -2
- package/dist/components/select/MultiSelect.cjs +1 -1
- package/dist/components/select/MultiSelect.esm.js +140 -138
- package/dist/components/select/Select.cjs +1 -1
- package/dist/components/select/Select.esm.js +190 -182
- package/dist/components/select/types.d.ts +7 -0
- package/dist/components/slider/Slider.cjs +1 -0
- package/dist/components/slider/Slider.d.ts +6 -0
- package/dist/components/slider/Slider.esm.js +36 -0
- package/dist/components/slider/index.d.ts +2 -0
- package/dist/components/slider/types.d.ts +15 -0
- package/dist/components/slider/utils.cjs +1 -0
- package/dist/components/slider/utils.d.ts +3 -0
- package/dist/components/slider/utils.esm.js +15 -0
- package/dist/components/table/accordion-table.cjs +1 -1
- package/dist/components/table/accordion-table.esm.js +194 -180
- package/dist/components/table/components/SortHeader.cjs +1 -0
- package/dist/components/table/components/SortHeader.d.ts +10 -0
- package/dist/components/table/components/SortHeader.esm.js +27 -0
- package/dist/components/table/components/SortableHeaderCell.cjs +1 -1
- package/dist/components/table/components/SortableHeaderCell.d.ts +10 -2
- package/dist/components/table/components/SortableHeaderCell.esm.js +54 -26
- package/dist/components/table/hooks/sort-state.cjs +1 -0
- package/dist/components/table/hooks/sort-state.d.ts +5 -0
- package/dist/components/table/hooks/sort-state.esm.js +21 -0
- package/dist/components/table/hooks/useTableSort.cjs +1 -1
- package/dist/components/table/hooks/useTableSort.d.ts +6 -3
- package/dist/components/table/hooks/useTableSort.esm.js +18 -19
- package/dist/components/table/paginated-table.d.ts +2 -0
- package/dist/components/table/table.cjs +1 -1
- package/dist/components/table/table.d.ts +2 -0
- package/dist/components/table/table.esm.js +119 -104
- package/dist/components/table/types.d.ts +11 -4
- package/dist/components/tabs/Tabs.cjs +1 -0
- package/dist/components/tabs/Tabs.d.ts +8 -0
- package/dist/components/tabs/Tabs.esm.js +53 -0
- package/dist/components/tabs/index.d.ts +2 -0
- package/dist/components/tabs/navigation.cjs +1 -0
- package/dist/components/tabs/navigation.d.ts +2 -0
- package/dist/components/tabs/navigation.esm.js +18 -0
- package/dist/components/tabs/types.d.ts +20 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +3 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/arrow-down.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/arrow-down.esm.js +10 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/arrow-up-down.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/arrow-up-down.esm.js +21 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/arrow-up.cjs +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/arrow-up.esm.js +10 -0
- package/dist/tokens.css +78 -5
- package/dist/ui.css +1 -1
- package/llms.txt +9 -6
- package/package.json +1 -1
|
@@ -4,28 +4,40 @@ import { ChevronRight as n } from "../../node_modules/lucide-react/dist/esm/icon
|
|
|
4
4
|
import { LoadingSpinner as r } from "../loading-spinner/LoadingSpinner.esm.js";
|
|
5
5
|
import { Select as i } from "../select/Select.esm.js";
|
|
6
6
|
import { SortableHeaderCell as a } from "./components/SortableHeaderCell.esm.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
7
|
+
import { SortHeader as ee } from "./components/SortHeader.esm.js";
|
|
8
|
+
import { ariaSort as o, nextSort as te, sortDirectionFor as s } from "./hooks/sort-state.esm.js";
|
|
9
|
+
import { useColumnResize as ne } from "./hooks/useColumnResize.esm.js";
|
|
10
|
+
import { useFillEmptyRows as re } from "../../hooks/useFillEmptyRows.esm.js";
|
|
11
|
+
import { useTableSort as ie } from "./hooks/useTableSort.esm.js";
|
|
12
|
+
import { getColumnAlignClasses as c, getHoverableRowClasses as ae, getSelectedRowClasses as oe, getStripedRowClasses as l, getTableBaseClasses as se, getTableCellClasses as u, getTableHeaderCellClasses as d, getTableHeaderClasses as ce, getTableSizeClasses as le, getTableVariantClasses as ue } from "./utils.esm.js";
|
|
13
|
+
import { KeyboardNavButton as f } from "./components/KeyboardNavButton.esm.js";
|
|
14
|
+
import { PageJumpInput as p } from "./components/PageJumpInput.esm.js";
|
|
15
|
+
import { Pagination as de } from "./components/Pagination.esm.js";
|
|
16
|
+
import { Fragment as fe, forwardRef as m, useLayoutEffect as pe, useMemo as h, useRef as g, useState as me } from "react";
|
|
17
|
+
import { Fragment as he, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
18
|
+
import { DndContext as ge, KeyboardSensor as _e, PointerSensor as ve, closestCenter as ye, useSensor as be, useSensors as xe } from "@dnd-kit/core";
|
|
19
|
+
import { SortableContext as Se, arrayMove as Ce, horizontalListSortingStrategy as we, sortableKeyboardCoordinates as Te } from "@dnd-kit/sortable";
|
|
18
20
|
//#region src/components/table/accordion-table.tsx
|
|
19
|
-
var
|
|
21
|
+
var Ee = [
|
|
20
22
|
30,
|
|
21
23
|
50,
|
|
22
24
|
100
|
|
23
|
-
], y = 36, b =
|
|
24
|
-
let { data: x, columns: S, rowHeight: C, loading:
|
|
25
|
-
initialSort:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
], y = 36, b = m((m, b) => {
|
|
26
|
+
let { data: x, columns: S, rowHeight: C, loading: De = !1, emptyMessage: Oe = "데이터가 없어요", onRowClick: w, selectedRows: T = [], onRowSelect: E, enableRowSelection: D = !1, enableSelectAll: O = !1, rowCompare: k, enableSorting: A = !1, sortCycle: j = "tri", formatSortLabel: ke, serverSideSorting: M = !1, onSortChange: Ae, initialSort: je, variant: Me = "default", size: Ne = "medium", stickyHeader: N = !0, height: P, maxHeight: F, currentPage: I, totalPages: L, onPageChange: R, pageSize: Pe, pageSizeOptions: Fe = Ee, onPageSizeChange: z, totalElements: B, storageKey: Ie, columnState: V, fillEmptyRows: Le = !0, enableKeyboardPagination: Re = !0, expandable: H, className: ze = "", "data-testid": U, ...Be } = m, W = !!H, G = H?.stickyDetail ?? !0, { sort: K, sortedData: Ve, handleSort: He } = ie({
|
|
27
|
+
initialSort: je,
|
|
28
|
+
cycle: j,
|
|
29
|
+
serverSide: M,
|
|
30
|
+
onSort: Ae || void 0
|
|
31
|
+
}), q = (e) => !!(e.sortable && (A || M)), Ue = (e) => q(e) ? o(s(K, e.key)) : void 0, We = (e) => {
|
|
32
|
+
if (!q(e)) return /* @__PURE__ */ _("span", { children: e.header });
|
|
33
|
+
let t = s(K, e.key), n = te(K, e.key, j)?.direction ?? null;
|
|
34
|
+
return /* @__PURE__ */ _(ee, {
|
|
35
|
+
current: t,
|
|
36
|
+
label: ke?.(e, t, n),
|
|
37
|
+
onSort: () => He(e.key),
|
|
38
|
+
children: e.header
|
|
39
|
+
});
|
|
40
|
+
}, J = h(() => !A || M ? x : Ve(x, (e, t) => {
|
|
29
41
|
let n = S.find((e) => e.key === t);
|
|
30
42
|
if (n?.accessor) {
|
|
31
43
|
let r = n.accessor(e);
|
|
@@ -35,180 +47,182 @@ var Se = [
|
|
|
35
47
|
}), [
|
|
36
48
|
x,
|
|
37
49
|
A,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
50
|
+
M,
|
|
51
|
+
K,
|
|
52
|
+
Ve,
|
|
41
53
|
S
|
|
42
|
-
]),
|
|
54
|
+
]), Ge = g(null), Y = g(null), Ke = g(null), qe = g(null), [Je, Ye] = me(0), Xe = !!V, Ze = xe(be(ve, { activationConstraint: { distance: 5 } }), be(_e, { coordinateGetter: Te })), Qe = (e) => {
|
|
43
55
|
let { active: t, over: n } = e;
|
|
44
56
|
if (!V || !n || t.id === n.id || S.find((e) => e.key === n.id)?.excludeFromPreset) return;
|
|
45
57
|
let r = V.columnOrder, i = r.indexOf(String(t.id)), a = r.indexOf(String(n.id));
|
|
46
|
-
i === -1 || a === -1 || V.onColumnOrderChange(
|
|
47
|
-
}, X =
|
|
58
|
+
i === -1 || a === -1 || V.onColumnOrderChange(Ce(r, i, a));
|
|
59
|
+
}, X = h(() => {
|
|
48
60
|
if (!V) return S.filter((e) => !e.hidden);
|
|
49
61
|
let e = new Map(S.map((e) => [e.key, e])), t = new Set(V.hiddenColumns);
|
|
50
62
|
return V.columnOrder.map((t) => e.get(t)).filter((e) => !!e).filter((e) => !e.hidden && !t.has(e.key));
|
|
51
|
-
}, [S, V]), { handleMouseDown:
|
|
63
|
+
}, [S, V]), { handleMouseDown: $e, handleDoubleClick: et, getColumnWidth: Z, measureRef: tt } = ne({
|
|
52
64
|
columns: X,
|
|
53
65
|
data: J,
|
|
54
66
|
getCellContent: (e, t) => {
|
|
55
67
|
let n = X.find((e) => e.key === t);
|
|
56
68
|
return n?.accessor ? n.accessor(e) : e[t];
|
|
57
69
|
},
|
|
58
|
-
tableRef:
|
|
70
|
+
tableRef: Ge,
|
|
59
71
|
...V ? {
|
|
60
72
|
controlledWidths: V.columnWidths,
|
|
61
73
|
onColumnWidthsChange: V.onColumnWidthsChange
|
|
62
|
-
} : { storageKey:
|
|
63
|
-
}),
|
|
74
|
+
} : { storageKey: Ie }
|
|
75
|
+
}), nt = se(), rt = ue(Me), it = le(Ne), at = h(() => {
|
|
64
76
|
let e = {};
|
|
65
|
-
return
|
|
66
|
-
}, [
|
|
67
|
-
enabled:
|
|
77
|
+
return P && (e.height = typeof P == "number" ? `${P}px` : P), F && (e.maxHeight = typeof F == "number" ? `${F}px` : F), e;
|
|
78
|
+
}, [P, F]), { emptyRowCount: ot, measuredRowHeight: st } = re({
|
|
79
|
+
enabled: Le,
|
|
68
80
|
containerRef: Y,
|
|
69
|
-
theadRef:
|
|
70
|
-
tbodyRef:
|
|
81
|
+
theadRef: Ke,
|
|
82
|
+
tbodyRef: qe,
|
|
71
83
|
excludeRowsSelector: "tr:not([data-empty-row]):not([data-expanded-row])",
|
|
72
84
|
remainingMode: "tbody-height",
|
|
73
85
|
observeTbody: !0,
|
|
74
86
|
deps: [J, X]
|
|
75
87
|
});
|
|
76
|
-
|
|
77
|
-
if (!
|
|
88
|
+
pe(() => {
|
|
89
|
+
if (!G || !W) return;
|
|
78
90
|
let e = Y.current;
|
|
79
91
|
if (!e) return;
|
|
80
92
|
let t = () => {
|
|
81
|
-
|
|
93
|
+
Ye((t) => t === e.clientWidth ? t : e.clientWidth);
|
|
82
94
|
};
|
|
83
95
|
t();
|
|
84
96
|
let n = new ResizeObserver(t);
|
|
85
97
|
return n.observe(e), () => n.disconnect();
|
|
86
|
-
}, [
|
|
87
|
-
let
|
|
88
|
-
e.altKey || e.metaKey || e.ctrlKey || e.shiftKey || (e.key === "ArrowLeft" &&
|
|
89
|
-
}, Q = (e) => !D || T.length === 0 ? !1 : k ? T.some((t) => k(t, e)) : T.some((t) => t === e),
|
|
98
|
+
}, [G, W]);
|
|
99
|
+
let ct = (e) => {
|
|
100
|
+
e.altKey || e.metaKey || e.ctrlKey || e.shiftKey || (e.key === "ArrowLeft" && I > 1 ? (e.preventDefault(), R(I - 1)) : e.key === "ArrowRight" && I < L && (e.preventDefault(), R(I + 1)));
|
|
101
|
+
}, Q = (e) => !D || T.length === 0 ? !1 : k ? T.some((t) => k(t, e)) : T.some((t) => t === e), lt = h(() => !D || !O || J.length === 0 ? !1 : J.every((e) => Q(e)), [
|
|
90
102
|
D,
|
|
91
103
|
O,
|
|
92
104
|
J,
|
|
93
105
|
Q
|
|
94
|
-
]),
|
|
95
|
-
!D || !E || (
|
|
106
|
+
]), ut = () => {
|
|
107
|
+
!D || !E || (lt ? J.forEach((e) => {
|
|
96
108
|
Q(e) && E(e, !1);
|
|
97
109
|
}) : J.forEach((e) => {
|
|
98
110
|
Q(e) || E(e, !0);
|
|
99
111
|
}));
|
|
100
|
-
},
|
|
101
|
-
let r = [
|
|
102
|
-
return Q(t) && r.push(
|
|
103
|
-
},
|
|
104
|
-
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
},
|
|
108
|
-
return
|
|
112
|
+
}, dt = (t, n) => {
|
|
113
|
+
let r = [l(n)];
|
|
114
|
+
return Q(t) && r.push(oe()), (w || W) && r.push(ae()), e(r);
|
|
115
|
+
}, ft = !!z || B !== void 0 || typeof L == "number" && L > 0, $ = (e) => {
|
|
116
|
+
H && H.onToggle(H.getRowId(e));
|
|
117
|
+
}, pt = (e, t) => {
|
|
118
|
+
W && (e.key === " " || e.key === "Enter") && (e.preventDefault(), $(t));
|
|
119
|
+
}, mt = (D && O ? 1 : 0) + +!!W + X.length + 1;
|
|
120
|
+
return De ? /* @__PURE__ */ _("div", {
|
|
109
121
|
ref: b,
|
|
110
|
-
className: e("flex items-center justify-center p-8 flex-1",
|
|
111
|
-
style:
|
|
112
|
-
"data-testid":
|
|
113
|
-
...
|
|
114
|
-
children: /* @__PURE__ */
|
|
122
|
+
className: e("flex items-center justify-center p-8 flex-1", ze),
|
|
123
|
+
style: at,
|
|
124
|
+
"data-testid": U,
|
|
125
|
+
...Be,
|
|
126
|
+
children: /* @__PURE__ */ _(r, {
|
|
115
127
|
message: "데이터를 불러오는 중이에요...",
|
|
116
128
|
className: "min-h-0"
|
|
117
129
|
})
|
|
118
|
-
}) : /* @__PURE__ */
|
|
130
|
+
}) : /* @__PURE__ */ v("div", {
|
|
119
131
|
ref: b,
|
|
120
|
-
className: e("isolate relative flex flex-col min-h-0",
|
|
121
|
-
style:
|
|
122
|
-
"data-testid":
|
|
123
|
-
...
|
|
124
|
-
children: [/* @__PURE__ */
|
|
125
|
-
ref:
|
|
132
|
+
className: e("isolate relative flex flex-col min-h-0", ze),
|
|
133
|
+
style: at,
|
|
134
|
+
"data-testid": U,
|
|
135
|
+
...Be,
|
|
136
|
+
children: [/* @__PURE__ */ _("div", {
|
|
137
|
+
ref: tt,
|
|
126
138
|
className: "absolute invisible whitespace-nowrap",
|
|
127
139
|
style: {
|
|
128
140
|
top: "-9999px",
|
|
129
141
|
left: "-9999px"
|
|
130
142
|
}
|
|
131
|
-
}), /* @__PURE__ */
|
|
143
|
+
}), /* @__PURE__ */ v("div", {
|
|
132
144
|
className: "flex flex-1 flex-col min-h-0",
|
|
133
|
-
children: [/* @__PURE__ */
|
|
145
|
+
children: [/* @__PURE__ */ _("div", {
|
|
134
146
|
ref: Y,
|
|
135
147
|
className: "overflow-auto flex-1 bg-bg-page",
|
|
136
|
-
children: J.length === 0 ? /* @__PURE__ */
|
|
148
|
+
children: J.length === 0 ? /* @__PURE__ */ _("div", {
|
|
137
149
|
className: "flex items-center justify-center p-8 h-full",
|
|
138
|
-
children: /* @__PURE__ */
|
|
150
|
+
children: /* @__PURE__ */ _("p", {
|
|
139
151
|
className: "text-fg-muted",
|
|
140
|
-
children:
|
|
152
|
+
children: Oe
|
|
141
153
|
})
|
|
142
|
-
}) : /* @__PURE__ */
|
|
143
|
-
sensors:
|
|
144
|
-
collisionDetection:
|
|
145
|
-
onDragEnd:
|
|
146
|
-
children: /* @__PURE__ */
|
|
147
|
-
ref:
|
|
148
|
-
className: e(
|
|
154
|
+
}) : /* @__PURE__ */ _(ge, {
|
|
155
|
+
sensors: Ze,
|
|
156
|
+
collisionDetection: ye,
|
|
157
|
+
onDragEnd: Qe,
|
|
158
|
+
children: /* @__PURE__ */ v("table", {
|
|
159
|
+
ref: Ge,
|
|
160
|
+
className: e(nt, rt, it),
|
|
149
161
|
style: {
|
|
150
162
|
tableLayout: "fixed",
|
|
151
163
|
minWidth: "100%",
|
|
152
164
|
width: "100%"
|
|
153
165
|
},
|
|
154
166
|
children: [
|
|
155
|
-
/* @__PURE__ */
|
|
156
|
-
D && O && /* @__PURE__ */
|
|
157
|
-
|
|
158
|
-
X.map((e) => /* @__PURE__ */
|
|
167
|
+
/* @__PURE__ */ v("colgroup", { children: [
|
|
168
|
+
D && O && /* @__PURE__ */ _("col", { style: { width: "48px" } }),
|
|
169
|
+
W && /* @__PURE__ */ _("col", { style: { width: `${y}px` } }),
|
|
170
|
+
X.map((e) => /* @__PURE__ */ _("col", {
|
|
159
171
|
"data-col-key": e.key,
|
|
160
172
|
style: { width: Z(e.key, e.width) }
|
|
161
173
|
}, e.key)),
|
|
162
|
-
/* @__PURE__ */
|
|
174
|
+
/* @__PURE__ */ _("col", { style: { width: "100%" } })
|
|
163
175
|
] }),
|
|
164
|
-
/* @__PURE__ */
|
|
165
|
-
ref:
|
|
166
|
-
className:
|
|
176
|
+
/* @__PURE__ */ _("thead", {
|
|
177
|
+
ref: Ke,
|
|
178
|
+
className: ce(),
|
|
167
179
|
style: {
|
|
168
|
-
position:
|
|
169
|
-
top:
|
|
170
|
-
zIndex:
|
|
180
|
+
position: N ? "sticky" : "relative",
|
|
181
|
+
top: N ? 0 : void 0,
|
|
182
|
+
zIndex: N ? 20 : void 0
|
|
171
183
|
},
|
|
172
|
-
children: /* @__PURE__ */
|
|
173
|
-
D && O && /* @__PURE__ */
|
|
174
|
-
className: e(
|
|
175
|
-
children: /* @__PURE__ */
|
|
184
|
+
children: /* @__PURE__ */ v("tr", { children: [
|
|
185
|
+
D && O && /* @__PURE__ */ _("th", {
|
|
186
|
+
className: e(d(), c("center"), "border-r-0 w-12"),
|
|
187
|
+
children: /* @__PURE__ */ _(t.Circle, {
|
|
176
188
|
id: "accordion-table-select-all",
|
|
177
189
|
size: 20,
|
|
178
|
-
checked:
|
|
179
|
-
onCheckedChange:
|
|
190
|
+
checked: lt,
|
|
191
|
+
onCheckedChange: ut
|
|
180
192
|
})
|
|
181
193
|
}),
|
|
182
|
-
|
|
194
|
+
W && /* @__PURE__ */ _("th", {
|
|
183
195
|
"aria-hidden": "true",
|
|
184
|
-
className: e(
|
|
196
|
+
className: e(d(), "border-r-0"),
|
|
185
197
|
style: { width: `${y}px` }
|
|
186
198
|
}),
|
|
187
|
-
/* @__PURE__ */
|
|
199
|
+
/* @__PURE__ */ _(Se, {
|
|
188
200
|
items: X.map((e) => e.key),
|
|
189
|
-
strategy:
|
|
201
|
+
strategy: we,
|
|
190
202
|
children: X.map((t) => {
|
|
191
|
-
let n = !
|
|
192
|
-
return /* @__PURE__ */
|
|
203
|
+
let n = !Xe || t.excludeFromPreset === !0;
|
|
204
|
+
return /* @__PURE__ */ v(a, {
|
|
193
205
|
id: t.key,
|
|
194
206
|
disabled: n,
|
|
195
207
|
as: "th",
|
|
196
|
-
|
|
208
|
+
"aria-sort": Ue(t),
|
|
209
|
+
hasSortButton: q(t),
|
|
210
|
+
className: e(d(), c("center"), "relative", t.sticky && "sticky left-0 z-20 bg-bg-table-header", t.hideOnMobile && "hidden md:table-cell"),
|
|
197
211
|
style: {
|
|
198
212
|
width: Z(t.key, t.width),
|
|
199
213
|
minWidth: t.minWidth || 50
|
|
200
214
|
},
|
|
201
|
-
children: [/* @__PURE__ */
|
|
215
|
+
children: [/* @__PURE__ */ _("div", {
|
|
202
216
|
className: "flex items-center justify-center w-full pr-1 select-none",
|
|
203
|
-
children:
|
|
204
|
-
}), t.excludeFromPreset !== !0 && /* @__PURE__ */
|
|
217
|
+
children: We(t)
|
|
218
|
+
}), t.excludeFromPreset !== !0 && /* @__PURE__ */ _("div", {
|
|
205
219
|
className: "absolute right-0 top-0 h-full w-4 cursor-col-resize hover:bg-primary/30 active:bg-primary/50 z-50",
|
|
206
220
|
onPointerDown: (e) => e.stopPropagation(),
|
|
207
221
|
onMouseDown: (e) => {
|
|
208
|
-
e.preventDefault(), e.stopPropagation(),
|
|
222
|
+
e.preventDefault(), e.stopPropagation(), $e(t.key, e);
|
|
209
223
|
},
|
|
210
224
|
onDoubleClick: (e) => {
|
|
211
|
-
e.preventDefault(), e.stopPropagation(),
|
|
225
|
+
e.preventDefault(), e.stopPropagation(), et(t.key, e);
|
|
212
226
|
},
|
|
213
227
|
onClick: (e) => {
|
|
214
228
|
e.preventDefault(), e.stopPropagation();
|
|
@@ -219,53 +233,53 @@ var Se = [
|
|
|
219
233
|
}, t.key);
|
|
220
234
|
})
|
|
221
235
|
}),
|
|
222
|
-
/* @__PURE__ */
|
|
236
|
+
/* @__PURE__ */ _("th", {
|
|
223
237
|
"aria-hidden": "true",
|
|
224
238
|
className: "bg-bg-table-header border-b border-l border-border-table-header"
|
|
225
239
|
})
|
|
226
240
|
] })
|
|
227
241
|
}),
|
|
228
|
-
/* @__PURE__ */
|
|
229
|
-
ref:
|
|
242
|
+
/* @__PURE__ */ v("tbody", {
|
|
243
|
+
ref: qe,
|
|
230
244
|
children: [J.map((r, i) => {
|
|
231
|
-
let a = Q(r),
|
|
232
|
-
return /* @__PURE__ */
|
|
233
|
-
className:
|
|
245
|
+
let a = Q(r), ee = H ? H.getRowId(r) : void 0, o = H ? H.expandedIds.has(ee) : !1;
|
|
246
|
+
return /* @__PURE__ */ v(fe, { children: [/* @__PURE__ */ v("tr", {
|
|
247
|
+
className: dt(r, i),
|
|
234
248
|
onClick: (e) => {
|
|
235
249
|
let t = e.target;
|
|
236
250
|
if (t !== e.currentTarget) {
|
|
237
251
|
let n = t.closest("button, a, input, select, textarea, label");
|
|
238
252
|
if (n && e.currentTarget.contains(n)) return;
|
|
239
253
|
}
|
|
240
|
-
w?.(r, i),
|
|
254
|
+
w?.(r, i), W && $(r);
|
|
241
255
|
},
|
|
242
|
-
onKeyDown: (e) =>
|
|
243
|
-
tabIndex:
|
|
244
|
-
role:
|
|
245
|
-
"aria-expanded":
|
|
256
|
+
onKeyDown: (e) => pt(e, r),
|
|
257
|
+
tabIndex: W ? 0 : void 0,
|
|
258
|
+
role: W ? "button" : void 0,
|
|
259
|
+
"aria-expanded": W ? o : void 0,
|
|
246
260
|
style: C ? { height: `${C}px` } : void 0,
|
|
247
261
|
children: [
|
|
248
|
-
D && O && /* @__PURE__ */
|
|
249
|
-
className: e(
|
|
262
|
+
D && O && /* @__PURE__ */ _("td", {
|
|
263
|
+
className: e(u(), c("center"), "border-r-0 w-12"),
|
|
250
264
|
onClick: (e) => e.stopPropagation(),
|
|
251
|
-
children: /* @__PURE__ */
|
|
265
|
+
children: /* @__PURE__ */ _(t.Circle, {
|
|
252
266
|
size: 20,
|
|
253
267
|
checked: a,
|
|
254
268
|
onCheckedChange: (e) => E?.(r, e)
|
|
255
269
|
})
|
|
256
270
|
}),
|
|
257
|
-
|
|
258
|
-
className: e(
|
|
271
|
+
W && /* @__PURE__ */ _("td", {
|
|
272
|
+
className: e(u(), c("center"), "border-r-0"),
|
|
259
273
|
style: { width: `${y}px` },
|
|
260
|
-
children: /* @__PURE__ */
|
|
274
|
+
children: /* @__PURE__ */ _(n, {
|
|
261
275
|
"aria-hidden": "true",
|
|
262
|
-
className: e("mx-auto h-4 w-4 text-fg-muted hover:text-fg-default transition-transform duration-200",
|
|
276
|
+
className: e("mx-auto h-4 w-4 text-fg-muted hover:text-fg-default transition-transform duration-200", o && "rotate-90")
|
|
263
277
|
})
|
|
264
278
|
}),
|
|
265
279
|
X.map((t, n) => {
|
|
266
280
|
let i = t.accessor ? t.accessor(r) : r[t.key], a = n === X.length - 1 && !D;
|
|
267
|
-
return /* @__PURE__ */
|
|
268
|
-
className: e(
|
|
281
|
+
return /* @__PURE__ */ _("td", {
|
|
282
|
+
className: e(u(), c(t.align), a && "border-r-0", t.sticky && "sticky left-0 z-10 bg-inherit", t.hideOnMobile && "hidden md:table-cell"),
|
|
269
283
|
style: {
|
|
270
284
|
width: Z(t.key, t.width),
|
|
271
285
|
minWidth: t.minWidth || 50,
|
|
@@ -278,49 +292,49 @@ var Se = [
|
|
|
278
292
|
children: i
|
|
279
293
|
}, t.key);
|
|
280
294
|
}),
|
|
281
|
-
/* @__PURE__ */
|
|
295
|
+
/* @__PURE__ */ _("td", {
|
|
282
296
|
"aria-hidden": "true",
|
|
283
297
|
className: "border-b border-l border-border-table-cell bg-transparent"
|
|
284
298
|
})
|
|
285
299
|
]
|
|
286
|
-
}),
|
|
300
|
+
}), W && /* @__PURE__ */ _("tr", {
|
|
287
301
|
"data-expanded-row": !0,
|
|
288
302
|
className: "bg-bg-surface",
|
|
289
|
-
children: /* @__PURE__ */
|
|
290
|
-
colSpan:
|
|
303
|
+
children: /* @__PURE__ */ _("td", {
|
|
304
|
+
colSpan: mt,
|
|
291
305
|
className: "p-0 border-b border-border-table-cell text-fg-default",
|
|
292
|
-
children: /* @__PURE__ */
|
|
293
|
-
className:
|
|
294
|
-
style:
|
|
295
|
-
children: /* @__PURE__ */
|
|
306
|
+
children: /* @__PURE__ */ _("div", {
|
|
307
|
+
className: G ? "sticky left-0" : void 0,
|
|
308
|
+
style: G && Je > 0 ? { width: `${Je}px` } : void 0,
|
|
309
|
+
children: /* @__PURE__ */ _("div", {
|
|
296
310
|
className: "grid transition-[grid-template-rows,opacity] duration-200 ease-out",
|
|
297
311
|
style: {
|
|
298
|
-
gridTemplateRows:
|
|
299
|
-
opacity: +!!
|
|
312
|
+
gridTemplateRows: o ? "1fr" : "0fr",
|
|
313
|
+
opacity: +!!o
|
|
300
314
|
},
|
|
301
|
-
"aria-hidden": !
|
|
302
|
-
children: /* @__PURE__ */
|
|
315
|
+
"aria-hidden": !o,
|
|
316
|
+
children: /* @__PURE__ */ _("div", {
|
|
303
317
|
className: "overflow-hidden",
|
|
304
|
-
children:
|
|
318
|
+
children: H.renderRow(r)
|
|
305
319
|
})
|
|
306
320
|
})
|
|
307
321
|
})
|
|
308
322
|
})
|
|
309
323
|
})] }, i);
|
|
310
|
-
}),
|
|
311
|
-
let r = J.length + n, i = C ??
|
|
312
|
-
return /* @__PURE__ */
|
|
324
|
+
}), Le && Array.from({ length: ot }).map((t, n) => {
|
|
325
|
+
let r = J.length + n, i = C ?? st ?? void 0;
|
|
326
|
+
return /* @__PURE__ */ v("tr", {
|
|
313
327
|
"data-empty-row": !0,
|
|
314
328
|
"aria-hidden": "true",
|
|
315
|
-
className:
|
|
329
|
+
className: l(r),
|
|
316
330
|
style: i ? { height: `${i}px` } : void 0,
|
|
317
331
|
children: [
|
|
318
|
-
D && O && /* @__PURE__ */
|
|
319
|
-
className: e(
|
|
332
|
+
D && O && /* @__PURE__ */ _("td", {
|
|
333
|
+
className: e(u(), "border-r-0 w-12"),
|
|
320
334
|
style: i ? { height: `${i}px` } : void 0
|
|
321
335
|
}),
|
|
322
|
-
|
|
323
|
-
className: e(
|
|
336
|
+
W && /* @__PURE__ */ _("td", {
|
|
337
|
+
className: e(u(), "border-r-0"),
|
|
324
338
|
style: {
|
|
325
339
|
width: `${y}px`,
|
|
326
340
|
...i ? { height: `${i}px` } : {}
|
|
@@ -328,8 +342,8 @@ var Se = [
|
|
|
328
342
|
}),
|
|
329
343
|
X.map((t, n) => {
|
|
330
344
|
let r = n === X.length - 1 && !D;
|
|
331
|
-
return /* @__PURE__ */
|
|
332
|
-
className: e(
|
|
345
|
+
return /* @__PURE__ */ _("td", {
|
|
346
|
+
className: e(u(), r && "border-r-0", t.hideOnMobile && "hidden md:table-cell"),
|
|
333
347
|
style: {
|
|
334
348
|
width: Z(t.key, t.width),
|
|
335
349
|
minWidth: t.minWidth || 50,
|
|
@@ -337,7 +351,7 @@ var Se = [
|
|
|
337
351
|
}
|
|
338
352
|
}, t.key);
|
|
339
353
|
}),
|
|
340
|
-
/* @__PURE__ */
|
|
354
|
+
/* @__PURE__ */ _("td", {
|
|
341
355
|
"aria-hidden": "true",
|
|
342
356
|
className: "border-b border-l border-border-table-cell bg-transparent",
|
|
343
357
|
style: i ? { height: `${i}px` } : void 0
|
|
@@ -349,64 +363,64 @@ var Se = [
|
|
|
349
363
|
]
|
|
350
364
|
})
|
|
351
365
|
})
|
|
352
|
-
}),
|
|
366
|
+
}), ft && /* @__PURE__ */ v("nav", {
|
|
353
367
|
"aria-label": "페이지 네비게이션",
|
|
354
368
|
className: "@container/pagebar group/footer flex flex-wrap items-center justify-between gap-x-3 gap-y-2 border-t border-border-subtle px-4 py-2 shrink-0",
|
|
355
|
-
children: [/* @__PURE__ */
|
|
369
|
+
children: [/* @__PURE__ */ v("div", {
|
|
356
370
|
className: "flex flex-wrap items-center gap-x-3 gap-y-2 text-sm text-fg-muted",
|
|
357
371
|
children: [
|
|
358
|
-
B !== void 0 && /* @__PURE__ */
|
|
372
|
+
B !== void 0 && /* @__PURE__ */ v("span", { children: [
|
|
359
373
|
"총 ",
|
|
360
374
|
B.toLocaleString(),
|
|
361
375
|
"건"
|
|
362
376
|
] }),
|
|
363
|
-
z &&
|
|
377
|
+
z && Pe !== void 0 && /* @__PURE__ */ v("div", {
|
|
364
378
|
className: "flex items-center gap-1",
|
|
365
|
-
children: [/* @__PURE__ */
|
|
379
|
+
children: [/* @__PURE__ */ _("span", {
|
|
366
380
|
className: "text-fg-muted",
|
|
367
381
|
children: "페이지당"
|
|
368
|
-
}), /* @__PURE__ */
|
|
382
|
+
}), /* @__PURE__ */ _("div", {
|
|
369
383
|
className: "w-20",
|
|
370
|
-
children: /* @__PURE__ */
|
|
384
|
+
children: /* @__PURE__ */ _(i, {
|
|
371
385
|
variant: "box",
|
|
372
386
|
selectSize: "mini",
|
|
373
|
-
value: String(
|
|
387
|
+
value: String(Pe),
|
|
374
388
|
onChange: (e) => z(Number(e)),
|
|
375
|
-
options:
|
|
389
|
+
options: Fe.map((e) => ({
|
|
376
390
|
value: String(e),
|
|
377
391
|
label: String(e)
|
|
378
392
|
})),
|
|
379
|
-
"data-testid":
|
|
393
|
+
"data-testid": U ? `${U}-page-size` : void 0
|
|
380
394
|
})
|
|
381
395
|
})]
|
|
382
396
|
}),
|
|
383
|
-
/* @__PURE__ */
|
|
397
|
+
/* @__PURE__ */ _("div", {
|
|
384
398
|
className: "contents @min-[640px]/pagebar:hidden",
|
|
385
|
-
children:
|
|
386
|
-
currentPage:
|
|
387
|
-
totalPages:
|
|
388
|
-
onPageChange:
|
|
389
|
-
"data-testid":
|
|
390
|
-
}),
|
|
399
|
+
children: L !== void 0 && I !== void 0 && R && L > 1 && /* @__PURE__ */ v(he, { children: [/* @__PURE__ */ _(p, {
|
|
400
|
+
currentPage: I,
|
|
401
|
+
totalPages: L,
|
|
402
|
+
onPageChange: R,
|
|
403
|
+
"data-testid": U ? `${U}-page-jump` : void 0
|
|
404
|
+
}), Re && /* @__PURE__ */ _(f, { onKeyDown: ct })] })
|
|
391
405
|
})
|
|
392
406
|
]
|
|
393
|
-
}), /* @__PURE__ */
|
|
407
|
+
}), /* @__PURE__ */ v("div", {
|
|
394
408
|
className: "flex items-center gap-3",
|
|
395
|
-
children: [/* @__PURE__ */
|
|
409
|
+
children: [/* @__PURE__ */ _("div", {
|
|
396
410
|
className: "hidden @min-[640px]/pagebar:contents",
|
|
397
|
-
children:
|
|
398
|
-
currentPage:
|
|
399
|
-
totalPages:
|
|
400
|
-
onPageChange:
|
|
401
|
-
"data-testid":
|
|
402
|
-
}),
|
|
403
|
-
}),
|
|
404
|
-
currentPage:
|
|
405
|
-
totalPages:
|
|
406
|
-
onPageChange:
|
|
407
|
-
hasPreviousPage:
|
|
408
|
-
hasNextPage:
|
|
409
|
-
"data-testid":
|
|
411
|
+
children: L !== void 0 && I !== void 0 && R && L > 1 && /* @__PURE__ */ v(he, { children: [/* @__PURE__ */ _(p, {
|
|
412
|
+
currentPage: I,
|
|
413
|
+
totalPages: L,
|
|
414
|
+
onPageChange: R,
|
|
415
|
+
"data-testid": U ? `${U}-page-jump` : void 0
|
|
416
|
+
}), Re && /* @__PURE__ */ _(f, { onKeyDown: ct })] })
|
|
417
|
+
}), L !== void 0 && I !== void 0 && R && /* @__PURE__ */ _(de, {
|
|
418
|
+
currentPage: I,
|
|
419
|
+
totalPages: L,
|
|
420
|
+
onPageChange: R,
|
|
421
|
+
hasPreviousPage: I > 1,
|
|
422
|
+
hasNextPage: I < L,
|
|
423
|
+
"data-testid": U ? `${U}-pagination` : void 0
|
|
410
424
|
})]
|
|
411
425
|
})]
|
|
412
426
|
})]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../../../node_modules/lucide-react/dist/esm/icons/arrow-down.cjs"),t=require("../../../node_modules/lucide-react/dist/esm/icons/arrow-up-down.cjs"),n=require("../../../node_modules/lucide-react/dist/esm/icons/arrow-up.cjs"),r=require("./SortableHeaderCell.cjs");let i=require("react/jsx-runtime");function a({children:a,current:o,label:s,onSort:c}){let l=r.useSortableHeaderKeyboardDrag(),u=o===`asc`?n.ArrowUp:o===`desc`?e.ArrowDown:t.ArrowUpDown;return(0,i.jsxs)(`button`,{ref:l?.setActivatorNodeRef,type:`button`,"aria-label":s,"aria-describedby":l?.descriptionId,"aria-keyshortcuts":l?`Shift+Space`:void 0,onKeyDown:l?.onKeyDown,onClick:e=>{e.stopPropagation(),c()},className:`inline-flex items-center gap-1 cursor-pointer rounded-control-mini focus-visible:outline-none focus-visible:ring-control focus-visible:ring-focus-primary`,children:[a,(0,i.jsx)(u,{"aria-hidden":`true`,className:`size-3.5 shrink-0`})]})}exports.SortHeader=a;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { SortDirection } from '../types.js';
|
|
3
|
+
interface SortHeaderProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
current: SortDirection;
|
|
6
|
+
label?: string;
|
|
7
|
+
onSort: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function SortHeader({ children, current, label, onSort }: SortHeaderProps): import("react").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ArrowDown as e } from "../../../node_modules/lucide-react/dist/esm/icons/arrow-down.esm.js";
|
|
2
|
+
import { ArrowUpDown as t } from "../../../node_modules/lucide-react/dist/esm/icons/arrow-up-down.esm.js";
|
|
3
|
+
import { ArrowUp as n } from "../../../node_modules/lucide-react/dist/esm/icons/arrow-up.esm.js";
|
|
4
|
+
import { useSortableHeaderKeyboardDrag as r } from "./SortableHeaderCell.esm.js";
|
|
5
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/table/components/SortHeader.tsx
|
|
7
|
+
function o({ children: o, current: s, label: c, onSort: l }) {
|
|
8
|
+
let u = r(), d = s === "asc" ? n : s === "desc" ? e : t;
|
|
9
|
+
return /* @__PURE__ */ a("button", {
|
|
10
|
+
ref: u?.setActivatorNodeRef,
|
|
11
|
+
type: "button",
|
|
12
|
+
"aria-label": c,
|
|
13
|
+
"aria-describedby": u?.descriptionId,
|
|
14
|
+
"aria-keyshortcuts": u ? "Shift+Space" : void 0,
|
|
15
|
+
onKeyDown: u?.onKeyDown,
|
|
16
|
+
onClick: (e) => {
|
|
17
|
+
e.stopPropagation(), l();
|
|
18
|
+
},
|
|
19
|
+
className: "inline-flex items-center gap-1 cursor-pointer rounded-control-mini focus-visible:outline-none focus-visible:ring-control focus-visible:ring-focus-primary",
|
|
20
|
+
children: [o, /* @__PURE__ */ i(d, {
|
|
21
|
+
"aria-hidden": "true",
|
|
22
|
+
className: "size-3.5 shrink-0"
|
|
23
|
+
})]
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { o as SortHeader };
|