@tipp/ui 1.3.2 → 1.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 (79) hide show
  1. package/dist/atoms/field-error-wrapper.js +2 -2
  2. package/dist/atoms/index.cjs +0 -2
  3. package/dist/atoms/index.cjs.map +1 -1
  4. package/dist/atoms/index.js +33 -33
  5. package/dist/atoms/pagination.cjs +0 -2
  6. package/dist/atoms/pagination.cjs.map +1 -1
  7. package/dist/atoms/pagination.d.cts +2 -1
  8. package/dist/atoms/pagination.d.ts +2 -1
  9. package/dist/atoms/pagination.js +2 -2
  10. package/dist/chunk-62IB66PR.js +184 -0
  11. package/dist/chunk-62IB66PR.js.map +1 -0
  12. package/dist/chunk-7AFF4LYR.js +193 -0
  13. package/dist/chunk-7AFF4LYR.js.map +1 -0
  14. package/dist/chunk-7RLG3G7T.js +186 -0
  15. package/dist/chunk-7RLG3G7T.js.map +1 -0
  16. package/dist/chunk-AAMXDT5H.js +164 -0
  17. package/dist/chunk-AAMXDT5H.js.map +1 -0
  18. package/dist/chunk-CFZMZBKT.js +186 -0
  19. package/dist/chunk-CFZMZBKT.js.map +1 -0
  20. package/dist/chunk-FRIZG47J.js +186 -0
  21. package/dist/chunk-FRIZG47J.js.map +1 -0
  22. package/dist/chunk-FSGGYY2H.js +191 -0
  23. package/dist/chunk-FSGGYY2H.js.map +1 -0
  24. package/dist/chunk-G2WTBLEA.js +164 -0
  25. package/dist/chunk-G2WTBLEA.js.map +1 -0
  26. package/dist/chunk-GQ2UAYG2.js +193 -0
  27. package/dist/chunk-GQ2UAYG2.js.map +1 -0
  28. package/dist/chunk-MNIMT6IW.js +186 -0
  29. package/dist/chunk-MNIMT6IW.js.map +1 -0
  30. package/dist/chunk-N2FQDKJE.js +169 -0
  31. package/dist/chunk-N2FQDKJE.js.map +1 -0
  32. package/dist/chunk-N62PCPTB.js +164 -0
  33. package/dist/chunk-N62PCPTB.js.map +1 -0
  34. package/dist/chunk-N6LVZDYO.js +188 -0
  35. package/dist/chunk-N6LVZDYO.js.map +1 -0
  36. package/dist/chunk-NLTCJLYN.js +183 -0
  37. package/dist/chunk-NLTCJLYN.js.map +1 -0
  38. package/dist/chunk-PEPRIOFR.js +191 -0
  39. package/dist/chunk-PEPRIOFR.js.map +1 -0
  40. package/dist/chunk-SHKCVWJI.js +191 -0
  41. package/dist/chunk-SHKCVWJI.js.map +1 -0
  42. package/dist/chunk-TNPXDOME.js +340 -0
  43. package/dist/chunk-TNPXDOME.js.map +1 -0
  44. package/dist/chunk-UU4VN75U.js +185 -0
  45. package/dist/chunk-UU4VN75U.js.map +1 -0
  46. package/dist/chunk-VZ2XRNJY.js +191 -0
  47. package/dist/chunk-VZ2XRNJY.js.map +1 -0
  48. package/dist/chunk-WVYT25TW.js +185 -0
  49. package/dist/chunk-WVYT25TW.js.map +1 -0
  50. package/dist/chunk-XGPMAJED.js +164 -0
  51. package/dist/chunk-XGPMAJED.js.map +1 -0
  52. package/dist/chunk-YQJGVOUT.js +188 -0
  53. package/dist/chunk-YQJGVOUT.js.map +1 -0
  54. package/dist/chunk-ZWNOY7LD.js +192 -0
  55. package/dist/chunk-ZWNOY7LD.js.map +1 -0
  56. package/dist/chunk-ZXLMP5PK.js +185 -0
  57. package/dist/chunk-ZXLMP5PK.js.map +1 -0
  58. package/dist/index.cjs +78 -22
  59. package/dist/index.cjs.map +1 -1
  60. package/dist/index.css +2 -0
  61. package/dist/index.css.map +1 -1
  62. package/dist/index.js +65 -65
  63. package/dist/molecules/date-picker/index.js +2 -2
  64. package/dist/molecules/expand-table/index.cjs +226 -53
  65. package/dist/molecules/expand-table/index.cjs.map +1 -1
  66. package/dist/molecules/expand-table/index.d.cts +9 -0
  67. package/dist/molecules/expand-table/index.d.ts +9 -0
  68. package/dist/molecules/expand-table/index.js +18 -18
  69. package/dist/molecules/expand-table/row.js +15 -15
  70. package/dist/molecules/index.cjs +348 -181
  71. package/dist/molecules/index.cjs.map +1 -1
  72. package/dist/molecules/index.js +23 -23
  73. package/dist/molecules/learning-post.js +4 -4
  74. package/dist/molecules/navigation.js +16 -16
  75. package/dist/molecules/stepper.js +3 -3
  76. package/dist/molecules/tag-selector.js +16 -16
  77. package/package.json +3 -3
  78. package/src/atoms/pagination.tsx +2 -3
  79. package/src/molecules/expand-table/index.tsx +106 -31
package/dist/index.js CHANGED
@@ -1,3 +1,6 @@
1
+ import {
2
+ useThemeContext
3
+ } from "./chunk-MMGP4GEQ.js";
1
4
  import {
2
5
  uiProps
3
6
  } from "./chunk-NVKNDAIN.js";
@@ -11,34 +14,46 @@ import {
11
14
  import "./chunk-6ZAP2Q6K.js";
12
15
  import {
13
16
  DatePicker
14
- } from "./chunk-4AACT3BJ.js";
17
+ } from "./chunk-C3YMRWG2.js";
15
18
  import {
16
19
  ExpandTable,
17
20
  createColumnHelper
18
- } from "./chunk-DYKEZ7NH.js";
21
+ } from "./chunk-YQJGVOUT.js";
19
22
  import "./chunk-X5FVSTHW.js";
20
23
  import {
21
24
  DotNavigation
22
25
  } from "./chunk-EDTEVEJW.js";
23
26
  import {
24
27
  LearningPost
25
- } from "./chunk-GTRSAGDQ.js";
28
+ } from "./chunk-XGPMAJED.js";
26
29
  import {
27
30
  Navigation
28
- } from "./chunk-PPO64OK7.js";
31
+ } from "./chunk-VSGK4POC.js";
29
32
  import {
30
33
  Stepper
31
- } from "./chunk-PF5CPG6R.js";
34
+ } from "./chunk-Y3L7BYDF.js";
32
35
  import {
33
36
  TagSelector
34
- } from "./chunk-MKYNSWMI.js";
37
+ } from "./chunk-P7633BEQ.js";
35
38
  import {
36
39
  ThemeProvider
37
40
  } from "./chunk-BVNXAZ4W.js";
41
+ import "./chunk-PSINRHYW.js";
38
42
  import {
39
- useThemeContext
40
- } from "./chunk-MMGP4GEQ.js";
43
+ EchartDefaultProps
44
+ } from "./chunk-2QFSCWES.js";
45
+ import {
46
+ HorizontalBarChart
47
+ } from "./chunk-SGMO4KBC.js";
48
+ import "./chunk-BSTJBBEX.js";
49
+ import "./chunk-NDUKDKGB.js";
41
50
  import "./chunk-76JGDATZ.js";
51
+ import {
52
+ Spinner
53
+ } from "./chunk-FR2GDOU2.js";
54
+ import {
55
+ Strong
56
+ } from "./chunk-74DX4CU7.js";
42
57
  import {
43
58
  Switch
44
59
  } from "./chunk-OYM4XCHQ.js";
@@ -58,6 +73,12 @@ import {
58
73
  ToastContainer,
59
74
  toast
60
75
  } from "./chunk-CYYWMYE7.js";
76
+ import {
77
+ RadioGroup
78
+ } from "./chunk-6DJOIRMF.js";
79
+ import {
80
+ Radio
81
+ } from "./chunk-FPD73OHW.js";
61
82
  import {
62
83
  ScrollArea
63
84
  } from "./chunk-ZKZDVS7G.js";
@@ -77,17 +98,17 @@ import {
77
98
  Skeleton
78
99
  } from "./chunk-5H3YPCZK.js";
79
100
  import {
80
- Spinner
81
- } from "./chunk-FR2GDOU2.js";
101
+ Inset
102
+ } from "./chunk-XQOL7UBI.js";
82
103
  import {
83
- Strong
84
- } from "./chunk-74DX4CU7.js";
104
+ Kbd
105
+ } from "./chunk-TULWX7D6.js";
85
106
  import {
86
107
  Link
87
108
  } from "./chunk-SIM6HKVI.js";
88
109
  import {
89
110
  Pagination
90
- } from "./chunk-RJMSUTBQ.js";
111
+ } from "./chunk-5X3BCQPR.js";
91
112
  import {
92
113
  Popover
93
114
  } from "./chunk-5AVBYDPB.js";
@@ -101,11 +122,11 @@ import {
101
122
  RadioCards
102
123
  } from "./chunk-6IVCARWS.js";
103
124
  import {
104
- RadioGroup
105
- } from "./chunk-6DJOIRMF.js";
125
+ FieldErrorWrapper
126
+ } from "./chunk-DJN2IEY6.js";
106
127
  import {
107
- Radio
108
- } from "./chunk-FPD73OHW.js";
128
+ Flex
129
+ } from "./chunk-25HMMI7R.js";
109
130
  import {
110
131
  Form
111
132
  } from "./chunk-2CVXGGI5.js";
@@ -122,11 +143,11 @@ import {
122
143
  IconButton
123
144
  } from "./chunk-O3DNDMV3.js";
124
145
  import {
125
- Inset
126
- } from "./chunk-XQOL7UBI.js";
146
+ Collapse
147
+ } from "./chunk-LZJR77Q2.js";
127
148
  import {
128
- Kbd
129
- } from "./chunk-TULWX7D6.js";
149
+ Container
150
+ } from "./chunk-Q37G2GS6.js";
130
151
  import {
131
152
  DataList
132
153
  } from "./chunk-VTJZMOSP.js";
@@ -148,18 +169,18 @@ import {
148
169
  import {
149
170
  Tooltip
150
171
  } from "./chunk-ACVANQJ4.js";
172
+ import {
173
+ Typo
174
+ } from "./chunk-52MVZ6AN.js";
151
175
  import {
152
176
  Em
153
177
  } from "./chunk-2DZ2Y3JI.js";
154
178
  import {
155
- FieldErrorWrapper
156
- } from "./chunk-QDZS4B6A.js";
157
- import {
158
- Typo
159
- } from "./chunk-52MVZ6AN.js";
179
+ Box
180
+ } from "./chunk-4Y5BEXVN.js";
160
181
  import {
161
- Flex
162
- } from "./chunk-25HMMI7R.js";
182
+ Button
183
+ } from "./chunk-P3YCIJUP.js";
163
184
  import {
164
185
  Callout
165
186
  } from "./chunk-B6XJN6EC.js";
@@ -178,36 +199,6 @@ import {
178
199
  import {
179
200
  Code
180
201
  } from "./chunk-OHMOP5PV.js";
181
- import {
182
- Collapse
183
- } from "./chunk-LZJR77Q2.js";
184
- import {
185
- Container
186
- } from "./chunk-Q37G2GS6.js";
187
- import {
188
- AlertDialog
189
- } from "./chunk-J242TTFH.js";
190
- import {
191
- AspectRatio
192
- } from "./chunk-EAXUQEO5.js";
193
- import {
194
- AutoSizingInput
195
- } from "./chunk-YJCCE5WP.js";
196
- import {
197
- Avatar
198
- } from "./chunk-3SSSCLJ5.js";
199
- import {
200
- Badge
201
- } from "./chunk-EWD4AO5N.js";
202
- import {
203
- Blockquote
204
- } from "./chunk-YGL6SWKN.js";
205
- import {
206
- Box
207
- } from "./chunk-4Y5BEXVN.js";
208
- import {
209
- Button
210
- } from "./chunk-P3YCIJUP.js";
211
202
  import {
212
203
  ArchiveIcon,
213
204
  BackpackIcon,
@@ -244,15 +235,24 @@ import {
244
235
  Share1Icon,
245
236
  TrashIcon
246
237
  } from "./chunk-66C4U3BG.js";
247
- import "./chunk-PSINRHYW.js";
248
238
  import {
249
- EchartDefaultProps
250
- } from "./chunk-2QFSCWES.js";
239
+ AlertDialog
240
+ } from "./chunk-J242TTFH.js";
251
241
  import {
252
- HorizontalBarChart
253
- } from "./chunk-SGMO4KBC.js";
254
- import "./chunk-BSTJBBEX.js";
255
- import "./chunk-NDUKDKGB.js";
242
+ AspectRatio
243
+ } from "./chunk-EAXUQEO5.js";
244
+ import {
245
+ AutoSizingInput
246
+ } from "./chunk-YJCCE5WP.js";
247
+ import {
248
+ Avatar
249
+ } from "./chunk-3SSSCLJ5.js";
250
+ import {
251
+ Badge
252
+ } from "./chunk-EWD4AO5N.js";
253
+ import {
254
+ Blockquote
255
+ } from "./chunk-YGL6SWKN.js";
256
256
  import "./chunk-N552FDTV.js";
257
257
  export {
258
258
  AlertDialog,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  DatePicker
3
- } from "../../chunk-4AACT3BJ.js";
3
+ } from "../../chunk-C3YMRWG2.js";
4
+ import "../../chunk-25HMMI7R.js";
4
5
  import "../../chunk-HK224ADT.js";
5
6
  import "../../chunk-O3DNDMV3.js";
6
- import "../../chunk-25HMMI7R.js";
7
7
  import "../../chunk-66C4U3BG.js";
8
8
  import "../../chunk-N552FDTV.js";
9
9
  export {
@@ -64,13 +64,16 @@ __export(expand_table_exports, {
64
64
  });
65
65
  module.exports = __toCommonJS(expand_table_exports);
66
66
  var import_react_table2 = require("@tanstack/react-table");
67
- var import_react4 = require("react");
67
+ var import_react5 = require("react");
68
68
 
69
69
  // src/atoms/flex.tsx
70
70
  var import_themes = require("@radix-ui/themes");
71
71
 
72
- // src/atoms/typo.tsx
72
+ // src/atoms/icon-button.tsx
73
73
  var import_themes2 = require("@radix-ui/themes");
74
+
75
+ // src/atoms/typo.tsx
76
+ var import_themes3 = require("@radix-ui/themes");
74
77
  var import_react = require("react");
75
78
  var import_jsx_runtime = require("react/jsx-runtime");
76
79
  var Typo = (0, import_react.forwardRef)(
@@ -89,7 +92,7 @@ var Typo = (0, import_react.forwardRef)(
89
92
  return "2";
90
93
  }
91
94
  }, [size, variant]);
92
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_themes2.Text, __spreadProps(__spreadValues({}, rest), { ref, size: radixSize, children }));
95
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_themes3.Text, __spreadProps(__spreadValues({}, rest), { ref, size: radixSize, children }));
93
96
  }
94
97
  );
95
98
  Typo.displayName = "Typo";
@@ -116,13 +119,125 @@ function Collapse(props) {
116
119
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "tipp-collapse", ref, children });
117
120
  }
118
121
 
119
- // src/icons/down.tsx
120
- var React3 = __toESM(require("react"), 1);
122
+ // src/atoms/spinner.tsx
123
+ var import_themes4 = require("@radix-ui/themes");
124
+
125
+ // src/atoms/pagination.tsx
126
+ var import_react3 = require("react");
127
+
128
+ // src/icon.ts
129
+ var import_react_icons = require("@radix-ui/react-icons");
130
+
131
+ // src/atoms/pagination.tsx
121
132
  var import_jsx_runtime3 = require("react/jsx-runtime");
122
- var TriangleArrowDownIcon = React3.forwardRef(
133
+ function Pagination(props) {
134
+ const { onChange, count = 0, siblingCount = 2 } = props;
135
+ const [page, setPage] = (0, import_react3.useState)(() => props.page || props.defaultPage || 1);
136
+ const visibleItems = (0, import_react3.useMemo)(() => {
137
+ let start = Math.max(1, page - siblingCount);
138
+ let end = Math.min(count, page + siblingCount);
139
+ if (page - siblingCount <= 0 && end < count) {
140
+ end = Math.min(count, end + Math.abs(page - siblingCount) + 1);
141
+ } else if (page + siblingCount > count && start > 1) {
142
+ start = Math.max(1, start - (page + siblingCount - count));
143
+ }
144
+ return Array.from({ length: end - start + 1 }, (_, i) => i + start);
145
+ }, [count, page, siblingCount]);
146
+ (0, import_react3.useEffect)(() => {
147
+ onChange == null ? void 0 : onChange(page);
148
+ }, [onChange, page]);
149
+ (0, import_react3.useEffect)(() => {
150
+ if (props.page) {
151
+ setPage(props.page);
152
+ }
153
+ }, [props.page]);
154
+ const prev = (0, import_react3.useMemo)(() => {
155
+ const p = page - 1;
156
+ return p < 1 ? void 0 : p;
157
+ }, [page]);
158
+ const next = (0, import_react3.useMemo)(() => {
159
+ const n = page + 1;
160
+ return n > count ? void 0 : n;
161
+ }, [count, page]);
162
+ const onClickPrev = (0, import_react3.useCallback)(() => {
163
+ prev && setPage(prev);
164
+ }, [prev]);
165
+ const onClickNext = (0, import_react3.useCallback)(() => {
166
+ next && setPage(next);
167
+ }, [next]);
168
+ const doublePrev = (0, import_react3.useMemo)(() => {
169
+ if (!visibleItems.length)
170
+ return;
171
+ return Math.max(0, visibleItems[0] - 1);
172
+ }, [visibleItems]);
173
+ const onClickDoublePrev = (0, import_react3.useCallback)(() => {
174
+ doublePrev && setPage(doublePrev);
175
+ }, [doublePrev]);
176
+ const doubleNext = (0, import_react3.useMemo)(() => {
177
+ if (!visibleItems.length)
178
+ return;
179
+ const n = visibleItems[visibleItems.length - 1] + 1;
180
+ if (n > count)
181
+ return;
182
+ return Math.min(count, n);
183
+ }, [count, visibleItems]);
184
+ const onClickDoubleNext = (0, import_react3.useCallback)(() => {
185
+ doubleNext && setPage(doubleNext);
186
+ }, [doubleNext]);
187
+ const iconSize = {
188
+ height: 24,
189
+ width: 24
190
+ };
191
+ const moveButtonProps = {
192
+ variant: "ghost",
193
+ size: "3",
194
+ style: { borderRadius: "50%" }
195
+ };
196
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_themes.Flex, { align: "center", className: "tipp-pagination", gap: "4", children: [
197
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
198
+ import_themes2.IconButton,
199
+ __spreadProps(__spreadValues({
200
+ disabled: !doublePrev,
201
+ onClick: onClickDoublePrev
202
+ }, moveButtonProps), {
203
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_icons.DoubleArrowLeftIcon, __spreadValues({}, iconSize))
204
+ })
205
+ ),
206
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_themes2.IconButton, __spreadProps(__spreadValues({ disabled: !prev, onClick: onClickPrev }, moveButtonProps), { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_icons.ChevronLeftIcon, __spreadValues({}, iconSize)) })),
207
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_themes.Flex, { gap: "1", children: visibleItems.map((item) => {
208
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
209
+ "button",
210
+ {
211
+ className: `page-button ${item === page ? "active" : ""}`,
212
+ onClick: () => {
213
+ setPage(item);
214
+ },
215
+ type: "button",
216
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Typo, { variant: "body", children: item })
217
+ },
218
+ item
219
+ );
220
+ }) }),
221
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_themes2.IconButton, __spreadProps(__spreadValues({ disabled: !next, onClick: onClickNext }, moveButtonProps), { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_icons.ChevronRightIcon, __spreadValues({}, iconSize)) })),
222
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
223
+ import_themes2.IconButton,
224
+ __spreadProps(__spreadValues({
225
+ disabled: !doubleNext,
226
+ onClick: onClickDoubleNext
227
+ }, moveButtonProps), {
228
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_icons.DoubleArrowRightIcon, __spreadValues({}, iconSize))
229
+ })
230
+ )
231
+ ] });
232
+ }
233
+
234
+ // src/icons/down.tsx
235
+ var React4 = __toESM(require("react"), 1);
236
+ var import_jsx_runtime4 = require("react/jsx-runtime");
237
+ var TriangleArrowDownIcon = React4.forwardRef(
123
238
  (_a, forwardedRef) => {
124
239
  var _b = _a, { color = "currentColor" } = _b, props = __objRest(_b, ["color"]);
125
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
240
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
126
241
  "svg",
127
242
  __spreadProps(__spreadValues({
128
243
  fill: "none",
@@ -132,7 +247,7 @@ var TriangleArrowDownIcon = React3.forwardRef(
132
247
  xmlns: "http://www.w3.org/2000/svg"
133
248
  }, props), {
134
249
  ref: forwardedRef,
135
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
250
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
136
251
  "path",
137
252
  {
138
253
  d: "M7.10844 0.8125H0.891554C0.197392 0.8125 -0.177096 1.62672 0.274659 2.15377L3.3831 5.78029C3.70737 6.1586 4.29263 6.1586 4.6169 5.78029L7.72534 2.15377C8.1771 1.62672 7.80261 0.8125 7.10844 0.8125Z",
@@ -146,12 +261,12 @@ var TriangleArrowDownIcon = React3.forwardRef(
146
261
  TriangleArrowDownIcon.displayName = "ArrowDownIcon";
147
262
 
148
263
  // src/icons/up.tsx
149
- var React4 = __toESM(require("react"), 1);
150
- var import_jsx_runtime4 = require("react/jsx-runtime");
151
- var TriangleArrowUpIcon = React4.forwardRef(
264
+ var React5 = __toESM(require("react"), 1);
265
+ var import_jsx_runtime5 = require("react/jsx-runtime");
266
+ var TriangleArrowUpIcon = React5.forwardRef(
152
267
  (_a, forwardedRef) => {
153
268
  var _b = _a, { color = "currentColor" } = _b, props = __objRest(_b, ["color"]);
154
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
269
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
155
270
  "svg",
156
271
  __spreadProps(__spreadValues({
157
272
  fill: "none",
@@ -161,7 +276,7 @@ var TriangleArrowUpIcon = React4.forwardRef(
161
276
  xmlns: "http://www.w3.org/2000/svg"
162
277
  }, props), {
163
278
  ref: forwardedRef,
164
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
279
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
165
280
  "path",
166
281
  {
167
282
  d: "M0.891555 6.1875L7.10845 6.1875C7.80261 6.1875 8.1771 5.37328 7.72534 4.84623L4.6169 1.21971C4.29263 0.841403 3.70737 0.841403 3.3831 1.21971L0.274659 4.84623C-0.177095 5.37328 0.197393 6.1875 0.891555 6.1875Z",
@@ -176,17 +291,17 @@ TriangleArrowUpIcon.displayName = "ArrowUpIcon";
176
291
 
177
292
  // src/molecules/expand-table/row.tsx
178
293
  var import_react_table = require("@tanstack/react-table");
179
- var import_react3 = require("react");
180
- var import_jsx_runtime5 = require("react/jsx-runtime");
294
+ var import_react4 = require("react");
295
+ var import_jsx_runtime6 = require("react/jsx-runtime");
181
296
  function Row(props) {
182
297
  const { row, ExpandComp, gridColTemp } = props;
183
- const [open, setOpen] = (0, import_react3.useState)(false);
184
- const onClickRow = (0, import_react3.useCallback)(() => {
298
+ const [open, setOpen] = (0, import_react4.useState)(false);
299
+ const onClickRow = (0, import_react4.useCallback)(() => {
185
300
  var _a;
186
301
  (_a = props.onRowClick) == null ? void 0 : _a.call(props, row.original);
187
302
  setOpen((prev) => !prev);
188
303
  }, [props, row.original]);
189
- const rowClassName = (0, import_react3.useMemo)(() => {
304
+ const rowClassName = (0, import_react4.useMemo)(() => {
190
305
  const baseCls = ["tr-wrapper"];
191
306
  if (ExpandComp) {
192
307
  baseCls.push("expandable");
@@ -196,8 +311,8 @@ function Row(props) {
196
311
  }
197
312
  return baseCls.join(" ");
198
313
  }, [ExpandComp, props.onRowClick]);
199
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: rowClassName, children: [
200
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
314
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: rowClassName, children: [
315
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
201
316
  "button",
202
317
  {
203
318
  className: "tr",
@@ -208,7 +323,7 @@ function Row(props) {
208
323
  var _a, _b, _c;
209
324
  const autoSize = (_a = cell.column.columnDef.meta) == null ? void 0 : _a.autoSize;
210
325
  const justifyContent = ((_b = cell.column.columnDef.meta) == null ? void 0 : _b.align) || props.defaultAlign;
211
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
326
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
212
327
  "div",
213
328
  {
214
329
  className: "td",
@@ -219,7 +334,7 @@ function Row(props) {
219
334
  },
220
335
  children: [
221
336
  (0, import_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext()),
222
- ((_c = cell.column.columnDef.meta) == null ? void 0 : _c.OpenBtn) ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
337
+ ((_c = cell.column.columnDef.meta) == null ? void 0 : _c.OpenBtn) ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
223
338
  cell.column.columnDef.meta.OpenBtn,
224
339
  {
225
340
  data: row.original,
@@ -235,27 +350,46 @@ function Row(props) {
235
350
  },
236
351
  `tr_${row.id}`
237
352
  ),
238
- ExpandComp ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Collapse, { open, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "expand-comp-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ExpandComp, { row }) }) }) : null
353
+ ExpandComp ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Collapse, { open, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "expand-comp-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ExpandComp, { row }) }) }) : null
239
354
  ] }, `tr-wrapper_${row.id}`);
240
355
  }
241
356
 
242
357
  // src/molecules/expand-table/index.tsx
243
- var import_jsx_runtime6 = require("react/jsx-runtime");
358
+ var import_jsx_runtime7 = require("react/jsx-runtime");
244
359
  function ExpandTable(props) {
245
- const { data, columns, ExpandComp, placeholder, onRowClick, tableStyle } = props;
360
+ const {
361
+ data,
362
+ columns,
363
+ ExpandComp,
364
+ placeholder,
365
+ onRowClick,
366
+ tableStyle,
367
+ showPagination,
368
+ isLoading,
369
+ pageIndex = 0,
370
+ pageSize = 10,
371
+ siblingCount = 2
372
+ } = props;
246
373
  const defaultAlign = "left";
247
- const [sorting, setSorting] = (0, import_react4.useState)([]);
248
- const { getRowModel, getHeaderGroups } = (0, import_react_table2.useReactTable)({
374
+ const [pagination, setPagination] = (0, import_react5.useState)({
375
+ pageIndex: pageIndex || 0,
376
+ pageSize: pageSize || 9999
377
+ });
378
+ const [sorting, setSorting] = (0, import_react5.useState)([]);
379
+ const { getRowModel, getHeaderGroups, setPageIndex } = (0, import_react_table2.useReactTable)({
249
380
  data: data || [],
250
381
  columns,
251
382
  getCoreRowModel: (0, import_react_table2.getCoreRowModel)(),
252
383
  getSortedRowModel: (0, import_react_table2.getSortedRowModel)(),
253
384
  state: {
254
- sorting
385
+ sorting,
386
+ pagination
255
387
  },
256
- onSortingChange: setSorting
388
+ onSortingChange: setSorting,
389
+ getPaginationRowModel: (0, import_react_table2.getPaginationRowModel)(),
390
+ onPaginationChange: setPagination
257
391
  });
258
- const gridColTemp = (0, import_react4.useMemo)(() => {
392
+ const gridColTemp = (0, import_react5.useMemo)(() => {
259
393
  return columns.map((col) => {
260
394
  var _a;
261
395
  if ((_a = col.meta) == null ? void 0 : _a.autoSize)
@@ -264,8 +398,41 @@ function ExpandTable(props) {
264
398
  }).join(" ");
265
399
  }, [columns]);
266
400
  const rowModels = getRowModel();
267
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "expand-table", style: tableStyle, children: [
268
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "thead", children: getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
401
+ const onChangePagination = (0, import_react5.useCallback)(
402
+ (page) => {
403
+ setPageIndex(page - 1);
404
+ },
405
+ [setPageIndex]
406
+ );
407
+ const helpCompRender = (0, import_react5.useCallback)(
408
+ (rowLength) => {
409
+ if (isLoading) {
410
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
411
+ import_themes.Flex,
412
+ {
413
+ align: "center",
414
+ height: "100%",
415
+ justify: "center",
416
+ p: "5",
417
+ width: "100%",
418
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_themes4.Spinner, {})
419
+ }
420
+ );
421
+ }
422
+ if (rowLength === 0) {
423
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "tr", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_themes.Flex, { align: "center", justify: "center", children: placeholder || /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Typo, { color: "gray", mb: "6", mt: "6", variant: "body", children: "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4" }) }) }, "expand_placeholder");
424
+ }
425
+ return null;
426
+ },
427
+ [isLoading, placeholder]
428
+ );
429
+ const pageCount = (0, import_react5.useMemo)(() => {
430
+ if (!data)
431
+ return 0;
432
+ return Math.ceil(data.length / pageSize);
433
+ }, [data, pageSize]);
434
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "expand-table", style: tableStyle, children: [
435
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "thead", children: getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
269
436
  "div",
270
437
  {
271
438
  className: "tr",
@@ -275,30 +442,30 @@ function ExpandTable(props) {
275
442
  const sortable = header.column.getCanSort();
276
443
  const sortedState = header.column.getIsSorted();
277
444
  const justifyContent = ((_a = header.column.columnDef.meta) == null ? void 0 : _a.align) || defaultAlign;
278
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: `${justifyContent} th`, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
445
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: `${justifyContent} th`, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
279
446
  "button",
280
447
  {
281
448
  onClick: header.column.getToggleSortingHandler(),
282
449
  style: sortable ? { cursor: "pointer" } : void 0,
283
450
  type: "button",
284
451
  children: [
285
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Typo, { variant: "body", children: (0, import_react_table2.flexRender)(
452
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Typo, { variant: "body", children: (0, import_react_table2.flexRender)(
286
453
  header.column.columnDef.header,
287
454
  header.getContext()
288
455
  ) }),
289
- sortable ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
456
+ sortable ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
290
457
  import_themes.Flex,
291
458
  {
292
459
  direction: "column",
293
460
  style: { marginLeft: "var(--space-2)" },
294
461
  children: [
295
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
462
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
296
463
  TriangleArrowUpIcon,
297
464
  {
298
465
  color: sortedState === "asc" ? "var(--iris-10)" : "var(--iris-6)"
299
466
  }
300
467
  ),
301
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
468
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
302
469
  TriangleArrowDownIcon,
303
470
  {
304
471
  color: sortedState === "desc" ? "var(--iris-10)" : "var(--iris-6)"
@@ -314,22 +481,28 @@ function ExpandTable(props) {
314
481
  },
315
482
  headerGroup.id
316
483
  )) }),
317
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "tbody", children: [
318
- rowModels.rows.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "tr", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_themes.Flex, { align: "center", justify: "center", children: placeholder || /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Typo, { color: "gray", mb: "6", mt: "6", variant: "body", children: "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4" }) }) }, "expand_placeholder"),
319
- rowModels.rows.map((row) => {
320
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
321
- Row,
322
- {
323
- ExpandComp,
324
- defaultAlign,
325
- gridColTemp,
326
- onRowClick,
327
- row
328
- },
329
- `row_${row.id}`
330
- );
331
- })
332
- ] })
484
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "tbody", children: helpCompRender(rowModels.rows.length) || rowModels.rows.map((row) => {
485
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
486
+ Row,
487
+ {
488
+ ExpandComp,
489
+ defaultAlign,
490
+ gridColTemp,
491
+ onRowClick,
492
+ row
493
+ },
494
+ `row_${row.id}`
495
+ );
496
+ }) }),
497
+ showPagination ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_themes.Flex, { justify: "end", pt: "3", width: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
498
+ Pagination,
499
+ {
500
+ count: pageCount,
501
+ onChange: onChangePagination,
502
+ page: pagination.pageIndex + 1,
503
+ siblingCount
504
+ }
505
+ ) }) : null
333
506
  ] });
334
507
  }
335
508
  // Annotate the CommonJS export names for ESM import in node: