@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.
Files changed (65) hide show
  1. package/README.md +2 -2
  2. package/dist/components/button/Button.cjs +1 -1
  3. package/dist/components/button/Button.d.ts +3 -0
  4. package/dist/components/button/Button.esm.js +17 -5
  5. package/dist/components/button/types.d.ts +3 -1
  6. package/dist/components/button/utils.cjs +1 -1
  7. package/dist/components/button/utils.d.ts +2 -2
  8. package/dist/components/button/utils.esm.js +6 -2
  9. package/dist/components/progress/Progress.cjs +1 -1
  10. package/dist/components/progress/Progress.d.ts +3 -4
  11. package/dist/components/progress/Progress.esm.js +5 -5
  12. package/dist/components/progress/types.d.ts +2 -2
  13. package/dist/components/select/MultiSelect.cjs +1 -1
  14. package/dist/components/select/MultiSelect.esm.js +140 -138
  15. package/dist/components/select/Select.cjs +1 -1
  16. package/dist/components/select/Select.esm.js +190 -182
  17. package/dist/components/select/types.d.ts +7 -0
  18. package/dist/components/slider/Slider.cjs +1 -0
  19. package/dist/components/slider/Slider.d.ts +6 -0
  20. package/dist/components/slider/Slider.esm.js +36 -0
  21. package/dist/components/slider/index.d.ts +2 -0
  22. package/dist/components/slider/types.d.ts +15 -0
  23. package/dist/components/slider/utils.cjs +1 -0
  24. package/dist/components/slider/utils.d.ts +3 -0
  25. package/dist/components/slider/utils.esm.js +15 -0
  26. package/dist/components/table/accordion-table.cjs +1 -1
  27. package/dist/components/table/accordion-table.esm.js +194 -180
  28. package/dist/components/table/components/SortHeader.cjs +1 -0
  29. package/dist/components/table/components/SortHeader.d.ts +10 -0
  30. package/dist/components/table/components/SortHeader.esm.js +27 -0
  31. package/dist/components/table/components/SortableHeaderCell.cjs +1 -1
  32. package/dist/components/table/components/SortableHeaderCell.d.ts +10 -2
  33. package/dist/components/table/components/SortableHeaderCell.esm.js +54 -26
  34. package/dist/components/table/hooks/sort-state.cjs +1 -0
  35. package/dist/components/table/hooks/sort-state.d.ts +5 -0
  36. package/dist/components/table/hooks/sort-state.esm.js +21 -0
  37. package/dist/components/table/hooks/useTableSort.cjs +1 -1
  38. package/dist/components/table/hooks/useTableSort.d.ts +6 -3
  39. package/dist/components/table/hooks/useTableSort.esm.js +18 -19
  40. package/dist/components/table/paginated-table.d.ts +2 -0
  41. package/dist/components/table/table.cjs +1 -1
  42. package/dist/components/table/table.d.ts +2 -0
  43. package/dist/components/table/table.esm.js +119 -104
  44. package/dist/components/table/types.d.ts +11 -4
  45. package/dist/components/tabs/Tabs.cjs +1 -0
  46. package/dist/components/tabs/Tabs.d.ts +8 -0
  47. package/dist/components/tabs/Tabs.esm.js +53 -0
  48. package/dist/components/tabs/index.d.ts +2 -0
  49. package/dist/components/tabs/navigation.cjs +1 -0
  50. package/dist/components/tabs/navigation.d.ts +2 -0
  51. package/dist/components/tabs/navigation.esm.js +18 -0
  52. package/dist/components/tabs/types.d.ts +20 -0
  53. package/dist/index.cjs +1 -1
  54. package/dist/index.d.ts +2 -0
  55. package/dist/index.esm.js +3 -1
  56. package/dist/node_modules/lucide-react/dist/esm/icons/arrow-down.cjs +1 -0
  57. package/dist/node_modules/lucide-react/dist/esm/icons/arrow-down.esm.js +10 -0
  58. package/dist/node_modules/lucide-react/dist/esm/icons/arrow-up-down.cjs +1 -0
  59. package/dist/node_modules/lucide-react/dist/esm/icons/arrow-up-down.esm.js +21 -0
  60. package/dist/node_modules/lucide-react/dist/esm/icons/arrow-up.cjs +1 -0
  61. package/dist/node_modules/lucide-react/dist/esm/icons/arrow-up.esm.js +10 -0
  62. package/dist/tokens.css +78 -5
  63. package/dist/ui.css +1 -1
  64. package/llms.txt +9 -6
  65. 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 { useColumnResize as o } from "./hooks/useColumnResize.esm.js";
8
- import { useFillEmptyRows as s } from "../../hooks/useFillEmptyRows.esm.js";
9
- import { useTableSort as ee } from "./hooks/useTableSort.esm.js";
10
- import { getColumnAlignClasses as c, getHoverableRowClasses as te, getSelectedRowClasses as ne, getStripedRowClasses as re, getTableBaseClasses as ie, getTableCellClasses as l, getTableHeaderCellClasses as u, getTableHeaderClasses as ae, getTableSizeClasses as oe, getTableVariantClasses as se } from "./utils.esm.js";
11
- import { KeyboardNavButton as d } from "./components/KeyboardNavButton.esm.js";
12
- import { PageJumpInput as f } from "./components/PageJumpInput.esm.js";
13
- import { Pagination as ce } from "./components/Pagination.esm.js";
14
- import { Fragment as le, forwardRef as p, useLayoutEffect as ue, useMemo as m, useRef as h, useState as de } from "react";
15
- import { Fragment as fe, jsx as g, jsxs as _ } from "react/jsx-runtime";
16
- import { DndContext as pe, KeyboardSensor as me, PointerSensor as he, closestCenter as ge, useSensor as v, useSensors as _e } from "@dnd-kit/core";
17
- import { SortableContext as ve, arrayMove as ye, horizontalListSortingStrategy as be, sortableKeyboardCoordinates as xe } from "@dnd-kit/sortable";
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 Se = [
21
+ var Ee = [
20
22
  30,
21
23
  50,
22
24
  100
23
- ], y = 36, b = p((p, b) => {
24
- let { data: x, columns: S, rowHeight: C, loading: Ce = !1, emptyMessage: we = "데이터가 없어요", onRowClick: w, selectedRows: T = [], onRowSelect: E, enableRowSelection: D = !1, enableSelectAll: O = !1, rowCompare: k, enableSorting: A = !1, serverSideSorting: j = !1, onSortChange: Te, initialSort: Ee, variant: De = "default", size: Oe = "medium", stickyHeader: M = !0, height: N, maxHeight: P, currentPage: F, totalPages: I, onPageChange: L, pageSize: R, pageSizeOptions: ke = Se, onPageSizeChange: z, totalElements: B, storageKey: Ae, columnState: V, fillEmptyRows: H = !0, enableKeyboardPagination: U = !0, expandable: W, className: je = "", "data-testid": G, ...Me } = p, K = !!W, q = W?.stickyDetail ?? !0, { sort: Ne, sortedData: Pe } = ee({
25
- initialSort: Ee,
26
- serverSide: j,
27
- onSort: Te || void 0
28
- }), J = m(() => !A || j ? x : Pe(x, (e, t) => {
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
- j,
39
- Ne,
40
- Pe,
50
+ M,
51
+ K,
52
+ Ve,
41
53
  S
42
- ]), Fe = h(null), Y = h(null), Ie = h(null), Le = h(null), [Re, ze] = de(0), Be = !!V, Ve = _e(v(he, { activationConstraint: { distance: 5 } }), v(me, { coordinateGetter: xe })), He = (e) => {
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(ye(r, i, a));
47
- }, X = m(() => {
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: Ue, handleDoubleClick: We, getColumnWidth: Z, measureRef: Ge } = o({
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: Fe,
70
+ tableRef: Ge,
59
71
  ...V ? {
60
72
  controlledWidths: V.columnWidths,
61
73
  onColumnWidthsChange: V.onColumnWidthsChange
62
- } : { storageKey: Ae }
63
- }), Ke = ie(), qe = se(De), Je = oe(Oe), Ye = m(() => {
74
+ } : { storageKey: Ie }
75
+ }), nt = se(), rt = ue(Me), it = le(Ne), at = h(() => {
64
76
  let e = {};
65
- return N && (e.height = typeof N == "number" ? `${N}px` : N), P && (e.maxHeight = typeof P == "number" ? `${P}px` : P), e;
66
- }, [N, P]), { emptyRowCount: Xe, measuredRowHeight: Ze } = s({
67
- enabled: H,
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: Ie,
70
- tbodyRef: Le,
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
- ue(() => {
77
- if (!q || !K) return;
88
+ pe(() => {
89
+ if (!G || !W) return;
78
90
  let e = Y.current;
79
91
  if (!e) return;
80
92
  let t = () => {
81
- ze((t) => t === e.clientWidth ? t : e.clientWidth);
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
- }, [q, K]);
87
- let Qe = (e) => {
88
- e.altKey || e.metaKey || e.ctrlKey || e.shiftKey || (e.key === "ArrowLeft" && F > 1 ? (e.preventDefault(), L(F - 1)) : e.key === "ArrowRight" && F < I && (e.preventDefault(), L(F + 1)));
89
- }, Q = (e) => !D || T.length === 0 ? !1 : k ? T.some((t) => k(t, e)) : T.some((t) => t === e), $e = m(() => !D || !O || J.length === 0 ? !1 : J.every((e) => Q(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
- ]), et = () => {
95
- !D || !E || ($e ? J.forEach((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
- }, tt = (t, n) => {
101
- let r = [re(n)];
102
- return Q(t) && r.push(ne()), (w || K) && r.push(te()), e(r);
103
- }, nt = !!z || B !== void 0 || typeof I == "number" && I > 0, $ = (e) => {
104
- W && W.onToggle(W.getRowId(e));
105
- }, rt = (e, t) => {
106
- K && (e.key === " " || e.key === "Enter") && (e.preventDefault(), $(t));
107
- }, it = (D && O ? 1 : 0) + +!!K + X.length + 1;
108
- return Ce ? /* @__PURE__ */ g("div", {
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", je),
111
- style: Ye,
112
- "data-testid": G,
113
- ...Me,
114
- children: /* @__PURE__ */ g(r, {
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__ */ _("div", {
130
+ }) : /* @__PURE__ */ v("div", {
119
131
  ref: b,
120
- className: e("isolate relative flex flex-col min-h-0", je),
121
- style: Ye,
122
- "data-testid": G,
123
- ...Me,
124
- children: [/* @__PURE__ */ g("div", {
125
- ref: Ge,
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__ */ _("div", {
143
+ }), /* @__PURE__ */ v("div", {
132
144
  className: "flex flex-1 flex-col min-h-0",
133
- children: [/* @__PURE__ */ g("div", {
145
+ children: [/* @__PURE__ */ _("div", {
134
146
  ref: Y,
135
147
  className: "overflow-auto flex-1 bg-bg-page",
136
- children: J.length === 0 ? /* @__PURE__ */ g("div", {
148
+ children: J.length === 0 ? /* @__PURE__ */ _("div", {
137
149
  className: "flex items-center justify-center p-8 h-full",
138
- children: /* @__PURE__ */ g("p", {
150
+ children: /* @__PURE__ */ _("p", {
139
151
  className: "text-fg-muted",
140
- children: we
152
+ children: Oe
141
153
  })
142
- }) : /* @__PURE__ */ g(pe, {
143
- sensors: Ve,
144
- collisionDetection: ge,
145
- onDragEnd: He,
146
- children: /* @__PURE__ */ _("table", {
147
- ref: Fe,
148
- className: e(Ke, qe, Je),
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__ */ _("colgroup", { children: [
156
- D && O && /* @__PURE__ */ g("col", { style: { width: "48px" } }),
157
- K && /* @__PURE__ */ g("col", { style: { width: `${y}px` } }),
158
- X.map((e) => /* @__PURE__ */ g("col", {
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__ */ g("col", { style: { width: "100%" } })
174
+ /* @__PURE__ */ _("col", { style: { width: "100%" } })
163
175
  ] }),
164
- /* @__PURE__ */ g("thead", {
165
- ref: Ie,
166
- className: ae(),
176
+ /* @__PURE__ */ _("thead", {
177
+ ref: Ke,
178
+ className: ce(),
167
179
  style: {
168
- position: M ? "sticky" : "relative",
169
- top: M ? 0 : void 0,
170
- zIndex: M ? 20 : void 0
180
+ position: N ? "sticky" : "relative",
181
+ top: N ? 0 : void 0,
182
+ zIndex: N ? 20 : void 0
171
183
  },
172
- children: /* @__PURE__ */ _("tr", { children: [
173
- D && O && /* @__PURE__ */ g("th", {
174
- className: e(u(), c("center"), "border-r-0 w-12"),
175
- children: /* @__PURE__ */ g(t.Circle, {
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: $e,
179
- onCheckedChange: et
190
+ checked: lt,
191
+ onCheckedChange: ut
180
192
  })
181
193
  }),
182
- K && /* @__PURE__ */ g("th", {
194
+ W && /* @__PURE__ */ _("th", {
183
195
  "aria-hidden": "true",
184
- className: e(u(), "border-r-0"),
196
+ className: e(d(), "border-r-0"),
185
197
  style: { width: `${y}px` }
186
198
  }),
187
- /* @__PURE__ */ g(ve, {
199
+ /* @__PURE__ */ _(Se, {
188
200
  items: X.map((e) => e.key),
189
- strategy: be,
201
+ strategy: we,
190
202
  children: X.map((t) => {
191
- let n = !Be || t.excludeFromPreset === !0;
192
- return /* @__PURE__ */ _(a, {
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
- className: e(u(), c("center"), "relative", t.sticky && "sticky left-0 z-20 bg-bg-table-header", t.hideOnMobile && "hidden md:table-cell"),
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__ */ g("div", {
215
+ children: [/* @__PURE__ */ _("div", {
202
216
  className: "flex items-center justify-center w-full pr-1 select-none",
203
- children: /* @__PURE__ */ g("span", { children: t.header })
204
- }), t.excludeFromPreset !== !0 && /* @__PURE__ */ g("div", {
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(), Ue(t.key, e);
222
+ e.preventDefault(), e.stopPropagation(), $e(t.key, e);
209
223
  },
210
224
  onDoubleClick: (e) => {
211
- e.preventDefault(), e.stopPropagation(), We(t.key, e);
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__ */ g("th", {
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__ */ _("tbody", {
229
- ref: Le,
242
+ /* @__PURE__ */ v("tbody", {
243
+ ref: qe,
230
244
  children: [J.map((r, i) => {
231
- let a = Q(r), o = W ? W.getRowId(r) : void 0, s = W ? W.expandedIds.has(o) : !1;
232
- return /* @__PURE__ */ _(le, { children: [/* @__PURE__ */ _("tr", {
233
- className: tt(r, i),
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), K && $(r);
254
+ w?.(r, i), W && $(r);
241
255
  },
242
- onKeyDown: (e) => rt(e, r),
243
- tabIndex: K ? 0 : void 0,
244
- role: K ? "button" : void 0,
245
- "aria-expanded": K ? s : void 0,
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__ */ g("td", {
249
- className: e(l(), c("center"), "border-r-0 w-12"),
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__ */ g(t.Circle, {
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
- K && /* @__PURE__ */ g("td", {
258
- className: e(l(), c("center"), "border-r-0"),
271
+ W && /* @__PURE__ */ _("td", {
272
+ className: e(u(), c("center"), "border-r-0"),
259
273
  style: { width: `${y}px` },
260
- children: /* @__PURE__ */ g(n, {
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", s && "rotate-90")
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__ */ g("td", {
268
- className: e(l(), c(t.align), a && "border-r-0", t.sticky && "sticky left-0 z-10 bg-inherit", t.hideOnMobile && "hidden md:table-cell"),
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__ */ g("td", {
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
- }), K && /* @__PURE__ */ g("tr", {
300
+ }), W && /* @__PURE__ */ _("tr", {
287
301
  "data-expanded-row": !0,
288
302
  className: "bg-bg-surface",
289
- children: /* @__PURE__ */ g("td", {
290
- colSpan: it,
303
+ children: /* @__PURE__ */ _("td", {
304
+ colSpan: mt,
291
305
  className: "p-0 border-b border-border-table-cell text-fg-default",
292
- children: /* @__PURE__ */ g("div", {
293
- className: q ? "sticky left-0" : void 0,
294
- style: q && Re > 0 ? { width: `${Re}px` } : void 0,
295
- children: /* @__PURE__ */ g("div", {
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: s ? "1fr" : "0fr",
299
- opacity: +!!s
312
+ gridTemplateRows: o ? "1fr" : "0fr",
313
+ opacity: +!!o
300
314
  },
301
- "aria-hidden": !s,
302
- children: /* @__PURE__ */ g("div", {
315
+ "aria-hidden": !o,
316
+ children: /* @__PURE__ */ _("div", {
303
317
  className: "overflow-hidden",
304
- children: W.renderRow(r)
318
+ children: H.renderRow(r)
305
319
  })
306
320
  })
307
321
  })
308
322
  })
309
323
  })] }, i);
310
- }), H && Array.from({ length: Xe }).map((t, n) => {
311
- let r = J.length + n, i = C ?? Ze ?? void 0;
312
- return /* @__PURE__ */ _("tr", {
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: re(r),
329
+ className: l(r),
316
330
  style: i ? { height: `${i}px` } : void 0,
317
331
  children: [
318
- D && O && /* @__PURE__ */ g("td", {
319
- className: e(l(), "border-r-0 w-12"),
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
- K && /* @__PURE__ */ g("td", {
323
- className: e(l(), "border-r-0"),
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__ */ g("td", {
332
- className: e(l(), r && "border-r-0", t.hideOnMobile && "hidden md:table-cell"),
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__ */ g("td", {
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
- }), nt && /* @__PURE__ */ _("nav", {
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__ */ _("div", {
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__ */ _("span", { children: [
372
+ B !== void 0 && /* @__PURE__ */ v("span", { children: [
359
373
  "총 ",
360
374
  B.toLocaleString(),
361
375
  "건"
362
376
  ] }),
363
- z && R !== void 0 && /* @__PURE__ */ _("div", {
377
+ z && Pe !== void 0 && /* @__PURE__ */ v("div", {
364
378
  className: "flex items-center gap-1",
365
- children: [/* @__PURE__ */ g("span", {
379
+ children: [/* @__PURE__ */ _("span", {
366
380
  className: "text-fg-muted",
367
381
  children: "페이지당"
368
- }), /* @__PURE__ */ g("div", {
382
+ }), /* @__PURE__ */ _("div", {
369
383
  className: "w-20",
370
- children: /* @__PURE__ */ g(i, {
384
+ children: /* @__PURE__ */ _(i, {
371
385
  variant: "box",
372
386
  selectSize: "mini",
373
- value: String(R),
387
+ value: String(Pe),
374
388
  onChange: (e) => z(Number(e)),
375
- options: ke.map((e) => ({
389
+ options: Fe.map((e) => ({
376
390
  value: String(e),
377
391
  label: String(e)
378
392
  })),
379
- "data-testid": G ? `${G}-page-size` : void 0
393
+ "data-testid": U ? `${U}-page-size` : void 0
380
394
  })
381
395
  })]
382
396
  }),
383
- /* @__PURE__ */ g("div", {
397
+ /* @__PURE__ */ _("div", {
384
398
  className: "contents @min-[640px]/pagebar:hidden",
385
- children: I !== void 0 && F !== void 0 && L && I > 1 && /* @__PURE__ */ _(fe, { children: [/* @__PURE__ */ g(f, {
386
- currentPage: F,
387
- totalPages: I,
388
- onPageChange: L,
389
- "data-testid": G ? `${G}-page-jump` : void 0
390
- }), U && /* @__PURE__ */ g(d, { onKeyDown: Qe })] })
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__ */ _("div", {
407
+ }), /* @__PURE__ */ v("div", {
394
408
  className: "flex items-center gap-3",
395
- children: [/* @__PURE__ */ g("div", {
409
+ children: [/* @__PURE__ */ _("div", {
396
410
  className: "hidden @min-[640px]/pagebar:contents",
397
- children: I !== void 0 && F !== void 0 && L && I > 1 && /* @__PURE__ */ _(fe, { children: [/* @__PURE__ */ g(f, {
398
- currentPage: F,
399
- totalPages: I,
400
- onPageChange: L,
401
- "data-testid": G ? `${G}-page-jump` : void 0
402
- }), U && /* @__PURE__ */ g(d, { onKeyDown: Qe })] })
403
- }), I !== void 0 && F !== void 0 && L && /* @__PURE__ */ g(ce, {
404
- currentPage: F,
405
- totalPages: I,
406
- onPageChange: L,
407
- hasPreviousPage: F > 1,
408
- hasNextPage: F < I,
409
- "data-testid": G ? `${G}-pagination` : void 0
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 };