@tipp/ui 2.3.10 → 2.3.11

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 (99) hide show
  1. package/dist/app/index.cjs +4 -3
  2. package/dist/app/index.cjs.map +1 -1
  3. package/dist/app/index.js +85 -85
  4. package/dist/app/platform/coach-question-list.js +31 -31
  5. package/dist/app/platform/contents-card.js +31 -31
  6. package/dist/app/platform/curriculum-card.js +5 -5
  7. package/dist/app/platform/edit-coaching-time.cjs +4 -3
  8. package/dist/app/platform/edit-coaching-time.cjs.map +1 -1
  9. package/dist/app/platform/edit-coaching-time.js +69 -69
  10. package/dist/app/platform/edit-service-type.cjs +4 -3
  11. package/dist/app/platform/edit-service-type.cjs.map +1 -1
  12. package/dist/app/platform/edit-service-type.js +70 -70
  13. package/dist/app/platform/goal-manage-card-edit.cjs +4 -3
  14. package/dist/app/platform/goal-manage-card-edit.cjs.map +1 -1
  15. package/dist/app/platform/goal-manage-card-edit.js +69 -69
  16. package/dist/app/platform/goal-manage-card-read.js +31 -31
  17. package/dist/app/platform/on-offline-radio-card.cjs +77 -76
  18. package/dist/app/platform/on-offline-radio-card.cjs.map +1 -1
  19. package/dist/app/platform/on-offline-radio-card.js +69 -69
  20. package/dist/app/platform/report-card.js +31 -31
  21. package/dist/app/platform/reservation-card.cjs +4 -3
  22. package/dist/app/platform/reservation-card.cjs.map +1 -1
  23. package/dist/app/platform/reservation-card.js +70 -70
  24. package/dist/app/platform/session-card.cjs +4 -3
  25. package/dist/app/platform/session-card.cjs.map +1 -1
  26. package/dist/app/platform/session-card.js +72 -72
  27. package/dist/app/platform/session-review-simple-read.js +31 -31
  28. package/dist/app/platform/userInfos/coaching-customer-info/index.js +34 -34
  29. package/dist/app/platform/userInfos/coaching-customer-info/large.js +31 -31
  30. package/dist/app/platform/userInfos/coaching-customer-info/medium.js +31 -31
  31. package/dist/app/platform/userInfos/coaching-customer-info/small.js +31 -31
  32. package/dist/app/platform/userInfos/session-user-info-detail.js +31 -31
  33. package/dist/app/platform/userInfos/utils.js +30 -30
  34. package/dist/atoms/bullet-text.js +2 -2
  35. package/dist/atoms/dialog.js +2 -2
  36. package/dist/atoms/field-error-wrapper.js +2 -2
  37. package/dist/atoms/index.js +62 -62
  38. package/dist/atoms/list.js +2 -2
  39. package/dist/atoms/pagination.js +3 -3
  40. package/dist/chunk-HHZ4HLP6.js +221 -0
  41. package/dist/chunk-HHZ4HLP6.js.map +1 -0
  42. package/dist/chunk-NMRNR5OA.js +221 -0
  43. package/dist/chunk-NMRNR5OA.js.map +1 -0
  44. package/dist/chunk-QMPSKZJ2.js +221 -0
  45. package/dist/chunk-QMPSKZJ2.js.map +1 -0
  46. package/dist/chunk-WGQGVPGZ.js +222 -0
  47. package/dist/chunk-WGQGVPGZ.js.map +1 -0
  48. package/dist/chunk-YEGT662X.js +221 -0
  49. package/dist/chunk-YEGT662X.js.map +1 -0
  50. package/dist/chunk-ZBZ7IGBT.js +222 -0
  51. package/dist/chunk-ZBZ7IGBT.js.map +1 -0
  52. package/dist/context/index.js +5 -5
  53. package/dist/index.cjs +12 -11
  54. package/dist/index.cjs.map +1 -1
  55. package/dist/index.css +13 -9
  56. package/dist/index.js +127 -127
  57. package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/index.js +18 -18
  58. package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-comp.js +4 -4
  59. package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-body.js +11 -11
  60. package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-footer.js +2 -2
  61. package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-header.js +3 -3
  62. package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-layout.js +2 -2
  63. package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-radio.js +6 -6
  64. package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-satisfaction-option.js +5 -5
  65. package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-satisfaction-text.js +5 -5
  66. package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-text.js +5 -5
  67. package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/complete-review.js +4 -4
  68. package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/index.js +21 -21
  69. package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/start-review.js +6 -6
  70. package/dist/molecules/curriculumV2/CurriculumContents/curriculum-ai-traning.js +3 -3
  71. package/dist/molecules/curriculumV2/CurriculumContents/curriculum-review.js +23 -23
  72. package/dist/molecules/curriculumV2/CurriculumContents/index.js +26 -26
  73. package/dist/molecules/curriculumV2/CurriculumSidebar/Items/curriculum-item-title.js +2 -2
  74. package/dist/molecules/curriculumV2/CurriculumSidebar/Items/section-item.js +4 -4
  75. package/dist/molecules/curriculumV2/CurriculumSidebar/index.js +7 -7
  76. package/dist/molecules/curriculumV2/CurriculumSidebar/sidebar-item.js +5 -5
  77. package/dist/molecules/curriculumV2/curriculum-sub-nav.js +4 -4
  78. package/dist/molecules/curriculumV2/curriculum-v2-layout.js +2 -2
  79. package/dist/molecules/curriculumV2/index.js +33 -33
  80. package/dist/molecules/date-picker/date-picker-button.js +6 -6
  81. package/dist/molecules/date-picker/index.js +5 -5
  82. package/dist/molecules/download-card.js +2 -2
  83. package/dist/molecules/dynamic-field.js +5 -5
  84. package/dist/molecules/dynamic-form.js +6 -6
  85. package/dist/molecules/expand-table/index.cjs +4 -3
  86. package/dist/molecules/expand-table/index.cjs.map +1 -1
  87. package/dist/molecules/expand-table/index.js +5 -5
  88. package/dist/molecules/force-refresh.js +2 -2
  89. package/dist/molecules/ghost-post.js +4 -4
  90. package/dist/molecules/index.cjs +141 -140
  91. package/dist/molecules/index.cjs.map +1 -1
  92. package/dist/molecules/index.js +61 -61
  93. package/dist/molecules/learning-post.js +6 -6
  94. package/dist/molecules/navigation.js +3 -3
  95. package/dist/molecules/one-on-one-guide-list.js +3 -3
  96. package/dist/molecules/stepper.js +4 -4
  97. package/dist/molecules/tag-selector.js +5 -5
  98. package/package.json +1 -1
  99. package/src/molecules/expand-table/index.tsx +13 -12
@@ -1,8 +1,17 @@
1
1
  import "../chunk-HBF6IIVZ.js";
2
2
  import {
3
- Form,
4
- FormItem
5
- } from "../chunk-2OMSNCRH.js";
3
+ ToastContainer,
4
+ toast
5
+ } from "../chunk-EEKOTWBE.js";
6
+ import {
7
+ Skeleton
8
+ } from "../chunk-5H3YPCZK.js";
9
+ import {
10
+ Spinner
11
+ } from "../chunk-FR2GDOU2.js";
12
+ import {
13
+ Strong
14
+ } from "../chunk-74DX4CU7.js";
6
15
  import {
7
16
  Switch
8
17
  } from "../chunk-OYM4XCHQ.js";
@@ -19,9 +28,14 @@ import {
19
28
  TextField
20
29
  } from "../chunk-6NPTJBFE.js";
21
30
  import {
22
- ToastContainer,
23
- toast
24
- } from "../chunk-EEKOTWBE.js";
31
+ RadioCards
32
+ } from "../chunk-6IVCARWS.js";
33
+ import {
34
+ RadioGroup
35
+ } from "../chunk-6DJOIRMF.js";
36
+ import {
37
+ Radio
38
+ } from "../chunk-FPD73OHW.js";
25
39
  import {
26
40
  ScrollArea
27
41
  } from "../chunk-MUPK4L3U.js";
@@ -38,21 +52,21 @@ import {
38
52
  Separator
39
53
  } from "../chunk-HYITAA4J.js";
40
54
  import {
41
- Skeleton
42
- } from "../chunk-5H3YPCZK.js";
55
+ Inset
56
+ } from "../chunk-XQOL7UBI.js";
43
57
  import {
44
- Spinner
45
- } from "../chunk-FR2GDOU2.js";
58
+ Kbd
59
+ } from "../chunk-TULWX7D6.js";
46
60
  import {
47
- Strong
48
- } from "../chunk-74DX4CU7.js";
61
+ Link
62
+ } from "../chunk-DHZVOXFM.js";
49
63
  import {
50
64
  List,
51
65
  useList
52
- } from "../chunk-JIJLOKVN.js";
66
+ } from "../chunk-WV2HN6H4.js";
53
67
  import {
54
68
  Pagination
55
- } from "../chunk-FG3WT6OL.js";
69
+ } from "../chunk-SBJOKO35.js";
56
70
  import {
57
71
  Popover
58
72
  } from "../chunk-5AVBYDPB.js";
@@ -63,14 +77,11 @@ import {
63
77
  Quote
64
78
  } from "../chunk-YO3BQW6S.js";
65
79
  import {
66
- RadioCards
67
- } from "../chunk-6IVCARWS.js";
68
- import {
69
- RadioGroup
70
- } from "../chunk-6DJOIRMF.js";
80
+ Em
81
+ } from "../chunk-2DZ2Y3JI.js";
71
82
  import {
72
- Radio
73
- } from "../chunk-FPD73OHW.js";
83
+ FieldErrorWrapper
84
+ } from "../chunk-VRJR534I.js";
74
85
  import {
75
86
  Grid
76
87
  } from "../chunk-EGEQY3KT.js";
@@ -78,23 +89,20 @@ import {
78
89
  HoverCard
79
90
  } from "../chunk-O3T3TM3V.js";
80
91
  import {
81
- Inset
82
- } from "../chunk-XQOL7UBI.js";
92
+ Code
93
+ } from "../chunk-OHMOP5PV.js";
83
94
  import {
84
- Kbd
85
- } from "../chunk-TULWX7D6.js";
95
+ Collapse
96
+ } from "../chunk-NFDQJVFA.js";
86
97
  import {
87
- Link
88
- } from "../chunk-DHZVOXFM.js";
98
+ Container
99
+ } from "../chunk-Q37G2GS6.js";
89
100
  import {
90
101
  DataList
91
102
  } from "../chunk-VTJZMOSP.js";
92
103
  import {
93
104
  Dialog
94
- } from "../chunk-AH4A53SZ.js";
95
- import {
96
- Heading
97
- } from "../chunk-BESTU2AY.js";
105
+ } from "../chunk-JQ7VQ5SB.js";
98
106
  import {
99
107
  Content,
100
108
  Drawer,
@@ -116,13 +124,17 @@ import {
116
124
  import {
117
125
  Tooltip
118
126
  } from "../chunk-3NUQAVE6.js";
119
- import "../chunk-PT57HCAI.js";
120
127
  import {
121
- Em
122
- } from "../chunk-2DZ2Y3JI.js";
128
+ BulletText
129
+ } from "../chunk-QRI6ARS6.js";
123
130
  import {
124
- FieldErrorWrapper
125
- } from "../chunk-ZOPYFDLO.js";
131
+ Flex
132
+ } from "../chunk-25HMMI7R.js";
133
+ import {
134
+ Button
135
+ } from "../chunk-ZVDAEY5Q.js";
136
+ import "../chunk-LQY4RKWI.js";
137
+ import "../chunk-ZD7MNMED.js";
126
138
  import {
127
139
  Callout
128
140
  } from "../chunk-B6XJN6EC.js";
@@ -139,14 +151,11 @@ import {
139
151
  Checkbox
140
152
  } from "../chunk-VYCYVN3L.js";
141
153
  import {
142
- Code
143
- } from "../chunk-OHMOP5PV.js";
144
- import {
145
- Collapse
146
- } from "../chunk-NFDQJVFA.js";
154
+ AlertDialog
155
+ } from "../chunk-J242TTFH.js";
147
156
  import {
148
- Container
149
- } from "../chunk-Q37G2GS6.js";
157
+ AspectRatio
158
+ } from "../chunk-EAXUQEO5.js";
150
159
  import {
151
160
  AutoSizingInput
152
161
  } from "../chunk-6SYFG6YY.js";
@@ -162,21 +171,6 @@ import {
162
171
  import {
163
172
  Box
164
173
  } from "../chunk-4Y5BEXVN.js";
165
- import {
166
- BulletText
167
- } from "../chunk-Z34HR7RE.js";
168
- import {
169
- Typo
170
- } from "../chunk-PMJIFLDT.js";
171
- import "../chunk-LDBWASUA.js";
172
- import {
173
- Flex
174
- } from "../chunk-25HMMI7R.js";
175
- import {
176
- Button
177
- } from "../chunk-ZVDAEY5Q.js";
178
- import "../chunk-LQY4RKWI.js";
179
- import "../chunk-ZD7MNMED.js";
180
174
  import "../chunk-W5TPOFOO.js";
181
175
  import "../chunk-WJ34ZHTU.js";
182
176
  import "../chunk-ZQE7SP6P.js";
@@ -192,12 +186,18 @@ import "../chunk-YSYJCYHY.js";
192
186
  import "../chunk-5OM2H6RI.js";
193
187
  import "../chunk-ZUYCXCPW.js";
194
188
  import "../chunk-YVFNJE4E.js";
189
+ import "../chunk-PT57HCAI.js";
195
190
  import {
196
- AlertDialog
197
- } from "../chunk-J242TTFH.js";
191
+ Form,
192
+ FormItem
193
+ } from "../chunk-2OMSNCRH.js";
198
194
  import {
199
- AspectRatio
200
- } from "../chunk-EAXUQEO5.js";
195
+ Heading
196
+ } from "../chunk-BESTU2AY.js";
197
+ import {
198
+ Typo
199
+ } from "../chunk-PMJIFLDT.js";
200
+ import "../chunk-LDBWASUA.js";
201
201
  import "../chunk-CRTRMMJ7.js";
202
202
  export {
203
203
  AlertDialog,
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  List,
3
3
  useList
4
- } from "../chunk-JIJLOKVN.js";
4
+ } from "../chunk-WV2HN6H4.js";
5
+ import "../chunk-25HMMI7R.js";
5
6
  import "../chunk-PMJIFLDT.js";
6
7
  import "../chunk-LDBWASUA.js";
7
- import "../chunk-25HMMI7R.js";
8
8
  import "../chunk-CRTRMMJ7.js";
9
9
  export {
10
10
  List,
@@ -1,10 +1,8 @@
1
1
  import {
2
2
  Pagination
3
- } from "../chunk-FG3WT6OL.js";
3
+ } from "../chunk-SBJOKO35.js";
4
4
  import "../chunk-XK6VEVOK.js";
5
5
  import "../chunk-HF6GNDPV.js";
6
- import "../chunk-PMJIFLDT.js";
7
- import "../chunk-LDBWASUA.js";
8
6
  import "../chunk-25HMMI7R.js";
9
7
  import "../chunk-W5TPOFOO.js";
10
8
  import "../chunk-WJ34ZHTU.js";
@@ -21,6 +19,8 @@ import "../chunk-YSYJCYHY.js";
21
19
  import "../chunk-5OM2H6RI.js";
22
20
  import "../chunk-ZUYCXCPW.js";
23
21
  import "../chunk-YVFNJE4E.js";
22
+ import "../chunk-PMJIFLDT.js";
23
+ import "../chunk-LDBWASUA.js";
24
24
  import "../chunk-CRTRMMJ7.js";
25
25
  export {
26
26
  Pagination
@@ -0,0 +1,221 @@
1
+ import {
2
+ Row
3
+ } from "./chunk-JCG2AUFJ.js";
4
+ import {
5
+ Spinner
6
+ } from "./chunk-FR2GDOU2.js";
7
+ import {
8
+ Pagination
9
+ } from "./chunk-FG3WT6OL.js";
10
+ import {
11
+ Typo
12
+ } from "./chunk-PMJIFLDT.js";
13
+ import {
14
+ Flex
15
+ } from "./chunk-25HMMI7R.js";
16
+ import {
17
+ TriangleArrowUpIcon
18
+ } from "./chunk-2O45FRFQ.js";
19
+ import {
20
+ TriangleArrowDownIcon
21
+ } from "./chunk-776WBOKL.js";
22
+
23
+ // src/molecules/expand-table/index.tsx
24
+ import {
25
+ flexRender,
26
+ getCoreRowModel,
27
+ useReactTable,
28
+ getSortedRowModel,
29
+ createColumnHelper,
30
+ getPaginationRowModel
31
+ } from "@tanstack/react-table";
32
+ import { useCallback, useMemo, useState } from "react";
33
+ import { jsx, jsxs } from "react/jsx-runtime";
34
+ var sortButtonColorMapper = {
35
+ card: {
36
+ selected: "var(--iris-10)",
37
+ unselected: "var(--iris-6)"
38
+ },
39
+ sprite: {
40
+ // selected: 'var(--gray-a12)',
41
+ // unselected: 'var(--gray-a6)',
42
+ selected: "var(--iris-10)",
43
+ unselected: "var(--iris-6)"
44
+ },
45
+ "sprite-border": {
46
+ selected: "var(--iris-10)",
47
+ unselected: "var(--iris-6)"
48
+ }
49
+ };
50
+ function ExpandTable(props) {
51
+ const {
52
+ data,
53
+ columns,
54
+ ExpandComp,
55
+ placeholder,
56
+ onRowClick,
57
+ tableStyle,
58
+ showPagination = true,
59
+ isLoading,
60
+ pageIndex = 0,
61
+ pageSize = 10,
62
+ siblingCount = 2,
63
+ getRowStyle,
64
+ getCellStyle,
65
+ variant = "card"
66
+ } = props;
67
+ const defaultAlign = "left";
68
+ const [pagination, setPagination] = useState({
69
+ pageIndex: pageIndex || 0,
70
+ pageSize: pageSize || 9999
71
+ });
72
+ const [sorting, setSorting] = useState([]);
73
+ const { getRowModel, getHeaderGroups, setPageIndex } = useReactTable({
74
+ data: data || [],
75
+ columns,
76
+ getCoreRowModel: getCoreRowModel(),
77
+ getSortedRowModel: getSortedRowModel(),
78
+ state: {
79
+ sorting,
80
+ pagination
81
+ },
82
+ onSortingChange: setSorting,
83
+ getPaginationRowModel: getPaginationRowModel(),
84
+ onPaginationChange: setPagination
85
+ });
86
+ const gridTemplateColumns = useMemo(() => {
87
+ return columns.map((col) => {
88
+ var _a;
89
+ if ((_a = col.meta) == null ? void 0 : _a.autoSize) return `minmax(${col.size || 50}px, 1fr)`;
90
+ return `${col.size || 150}px`;
91
+ }).join(" ");
92
+ }, [columns]);
93
+ const rowModels = getRowModel();
94
+ const onChangePagination = useCallback(
95
+ (page) => {
96
+ setPageIndex(page - 1);
97
+ },
98
+ [setPageIndex]
99
+ );
100
+ const helpCompRender = useCallback(
101
+ (rowLength) => {
102
+ if (isLoading) {
103
+ return /* @__PURE__ */ jsx(
104
+ Flex,
105
+ {
106
+ align: "center",
107
+ height: "100%",
108
+ justify: "center",
109
+ p: "5",
110
+ width: "100%",
111
+ children: /* @__PURE__ */ jsx(Spinner, {})
112
+ }
113
+ );
114
+ }
115
+ if (rowLength === 0) {
116
+ return /* @__PURE__ */ jsx("div", { className: "tr", children: /* @__PURE__ */ jsx(Flex, { align: "center", justify: "center", children: placeholder || /* @__PURE__ */ jsx(Typo, { color: "gray", mb: "6", mt: "6", variant: "body", children: "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4" }) }) }, "expand_placeholder");
117
+ }
118
+ return null;
119
+ },
120
+ [isLoading, placeholder]
121
+ );
122
+ const pageCount = useMemo(() => {
123
+ if (!data) return 0;
124
+ return Math.ceil(data.length / pageSize);
125
+ }, [data, pageSize]);
126
+ return /* @__PURE__ */ jsxs("div", { className: `expand-table-wrapper ${variant}`, children: [
127
+ /* @__PURE__ */ jsxs("div", { className: "expand-table", style: tableStyle, children: [
128
+ /* @__PURE__ */ jsx("div", { className: "thead", children: getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx(
129
+ "div",
130
+ {
131
+ className: "tr",
132
+ style: { gridTemplateColumns },
133
+ children: headerGroup.headers.map((header) => {
134
+ var _a;
135
+ const sortable = header.column.getCanSort();
136
+ const sortedState = header.column.getIsSorted();
137
+ const justifyContent = ((_a = header.column.columnDef.meta) == null ? void 0 : _a.align) || defaultAlign;
138
+ if (sortable) {
139
+ return /* @__PURE__ */ jsx("div", { className: `${justifyContent} th`, children: /* @__PURE__ */ jsxs(
140
+ "button",
141
+ {
142
+ onClick: header.column.getToggleSortingHandler(),
143
+ style: { cursor: "pointer" },
144
+ type: "button",
145
+ children: [
146
+ /* @__PURE__ */ jsx(Typo, { as: "div", variant: "body", children: flexRender(
147
+ header.column.columnDef.header,
148
+ header.getContext()
149
+ ) }),
150
+ /* @__PURE__ */ jsxs(
151
+ Flex,
152
+ {
153
+ direction: "column",
154
+ style: { marginLeft: "var(--space-2)" },
155
+ children: [
156
+ sortedState === false && /* @__PURE__ */ jsx(
157
+ TriangleArrowDownIcon,
158
+ {
159
+ color: sortButtonColorMapper[variant].unselected
160
+ }
161
+ ),
162
+ sortedState === "asc" && /* @__PURE__ */ jsx(
163
+ TriangleArrowUpIcon,
164
+ {
165
+ color: sortButtonColorMapper[variant].selected
166
+ }
167
+ ),
168
+ sortedState === "desc" && /* @__PURE__ */ jsx(
169
+ TriangleArrowDownIcon,
170
+ {
171
+ color: sortButtonColorMapper[variant].selected
172
+ }
173
+ )
174
+ ]
175
+ }
176
+ )
177
+ ]
178
+ }
179
+ ) }, header.id);
180
+ }
181
+ return /* @__PURE__ */ jsx("div", { className: `${justifyContent} th`, children: /* @__PURE__ */ jsx(Typo, { as: "div", variant: "body", children: flexRender(
182
+ header.column.columnDef.header,
183
+ header.getContext()
184
+ ) }) }, header.id);
185
+ })
186
+ },
187
+ headerGroup.id
188
+ )) }),
189
+ /* @__PURE__ */ jsx("scoll", { className: "tbody", children: helpCompRender(rowModels.rows.length) || rowModels.rows.map((row) => {
190
+ return /* @__PURE__ */ jsx(
191
+ Row,
192
+ {
193
+ ExpandComp,
194
+ defaultAlign,
195
+ getCellStyle,
196
+ getRowStyle,
197
+ gridTemplateColumns,
198
+ onRowClick,
199
+ row
200
+ },
201
+ `row_${row.id}`
202
+ );
203
+ }) })
204
+ ] }),
205
+ showPagination ? /* @__PURE__ */ jsx(Flex, { justify: "end", pt: "4", width: "100%", children: /* @__PURE__ */ jsx(
206
+ Pagination,
207
+ {
208
+ count: pageCount,
209
+ onChange: onChangePagination,
210
+ page: pagination.pageIndex + 1,
211
+ siblingCount
212
+ }
213
+ ) }) : null
214
+ ] });
215
+ }
216
+
217
+ export {
218
+ createColumnHelper,
219
+ ExpandTable
220
+ };
221
+ //# sourceMappingURL=chunk-HHZ4HLP6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/molecules/expand-table/index.tsx"],"sourcesContent":["import type {\n ColumnDef,\n SortingState,\n RowData,\n Row as RowType,\n PaginationState,\n} from '@tanstack/react-table';\nimport type { CSSProperties } from 'react';\nimport {\n flexRender,\n getCoreRowModel,\n useReactTable,\n getSortedRowModel,\n createColumnHelper,\n getPaginationRowModel,\n} from '@tanstack/react-table';\nimport React, { useCallback, useMemo, useState } from 'react';\nimport { Flex } from '@/atoms/flex';\nimport { Pagination } from '@/atoms/pagination';\nimport { Spinner } from '@/atoms/spinner';\nimport { Typo } from '@/atoms/typo';\nimport { TriangleArrowDownIcon } from '../../icons/down';\nimport { TriangleArrowUpIcon } from '../../icons/up';\nimport { Row, type ExpandComp, type OnRowClick } from './row';\nimport { ScrollArea } from '@radix-ui/themes';\n\nexport type { ExpandComp, OnRowClick, ColumnDef, RowType as Row };\nexport { createColumnHelper };\n\ntype Variant = 'card' | 'sprite' | 'sprite-border';\nconst sortButtonColorMapper: Record<\n Variant,\n { selected: string; unselected: string }\n> = {\n card: {\n selected: 'var(--iris-10)',\n unselected: 'var(--iris-6)',\n },\n sprite: {\n // selected: 'var(--gray-a12)',\n // unselected: 'var(--gray-a6)',\n selected: 'var(--iris-10)',\n unselected: 'var(--iris-6)',\n },\n 'sprite-border': {\n selected: 'var(--iris-10)',\n unselected: 'var(--iris-6)',\n },\n};\n\nexport interface ExpandTableProps<Datum extends RowData> {\n /** 렌더할 데이터 배열 */\n data?: Datum[];\n /** 테이블 컬럼의 메타 데이터 */\n columns: ColumnDef<Datum>[];\n /** Row의 open이 true인 경우 하단의 collapse에 렌더할 컴포넌트 */\n ExpandComp?: ExpandComp<Datum>;\n /** 데이테가 없을 시 화면에 표시할 컴포넌트 */\n placeholder?: React.ReactNode;\n /** 행 클릭 시 실행할 콜백 */\n onRowClick?: OnRowClick<Datum>;\n getRowStyle?: (data: Datum) => CSSProperties;\n getCellStyle?: (data: Datum) => CSSProperties;\n tableStyle?: CSSProperties;\n isLoading?: boolean;\n\n /** pagination - 표시 유무, 기본값 true */\n showPagination?: boolean;\n /** pagination - 현재 선택된 페이지, 0부터 시작 */\n pageIndex?: number;\n /** pagination - 한 페이지에 표시될 컬럼 개수, 기본값 10 */\n pageSize?: number;\n /** pagination - */\n siblingCount?: number;\n variant?: Variant;\n}\n\nexport function ExpandTable<Datum extends RowData>(\n props: ExpandTableProps<Datum>\n): React.ReactNode {\n const {\n data,\n columns,\n ExpandComp,\n placeholder,\n onRowClick,\n tableStyle,\n showPagination = true,\n isLoading,\n pageIndex = 0,\n pageSize = 10,\n siblingCount = 2,\n getRowStyle,\n getCellStyle,\n variant = 'card',\n } = props;\n const defaultAlign = 'left';\n const [pagination, setPagination] = useState<PaginationState>({\n pageIndex: pageIndex || 0,\n pageSize: pageSize || 9999,\n });\n\n const [sorting, setSorting] = useState<SortingState>([]);\n const { getRowModel, getHeaderGroups, setPageIndex } = useReactTable({\n data: data || [],\n columns,\n getCoreRowModel: getCoreRowModel(),\n getSortedRowModel: getSortedRowModel(),\n state: {\n sorting,\n pagination,\n },\n onSortingChange: setSorting,\n getPaginationRowModel: getPaginationRowModel(),\n onPaginationChange: setPagination,\n });\n\n const gridTemplateColumns = useMemo<string>(() => {\n return columns\n .map((col) => {\n if (col.meta?.autoSize) return `minmax(${col.size || 50}px, 1fr)`;\n return `${col.size || 150}px`;\n })\n .join(' ');\n }, [columns]);\n\n const rowModels = getRowModel();\n\n const onChangePagination = useCallback(\n (page: number) => {\n setPageIndex(page - 1);\n },\n [setPageIndex]\n );\n\n const helpCompRender = useCallback(\n (rowLength: number) => {\n if (isLoading) {\n return (\n <Flex\n align=\"center\"\n height=\"100%\"\n justify=\"center\"\n p=\"5\"\n width=\"100%\"\n >\n <Spinner />\n </Flex>\n );\n }\n if (rowLength === 0) {\n return (\n <div className=\"tr\" key=\"expand_placeholder\">\n <Flex align=\"center\" justify=\"center\">\n {placeholder || (\n <Typo color=\"gray\" mb=\"6\" mt=\"6\" variant=\"body\">\n 데이터가 없습니다\n </Typo>\n )}\n </Flex>\n </div>\n );\n }\n return null;\n },\n [isLoading, placeholder]\n );\n\n const pageCount = useMemo(() => {\n if (!data) return 0;\n return Math.ceil(data.length / pageSize);\n }, [data, pageSize]);\n\n return (\n <div className={`expand-table-wrapper ${variant}`}>\n <div className=\"expand-table\" style={tableStyle}>\n <div className=\"thead\">\n {getHeaderGroups().map((headerGroup) => (\n <div\n className=\"tr\"\n key={headerGroup.id}\n style={{ gridTemplateColumns }}\n >\n {headerGroup.headers.map((header) => {\n const sortable = header.column.getCanSort();\n const sortedState = header.column.getIsSorted();\n const justifyContent =\n header.column.columnDef.meta?.align || defaultAlign;\n\n if (sortable) {\n return (\n <div className={`${justifyContent} th`} key={header.id}>\n <button\n onClick={header.column.getToggleSortingHandler()}\n style={{ cursor: 'pointer' }}\n type=\"button\"\n >\n <Typo as=\"div\" variant=\"body\">\n {flexRender(\n header.column.columnDef.header,\n header.getContext()\n )}\n </Typo>\n <Flex\n direction=\"column\"\n style={{ marginLeft: 'var(--space-2)' }}\n >\n {sortedState === false && (\n <TriangleArrowDownIcon\n color={sortButtonColorMapper[variant].unselected}\n />\n )}\n {sortedState === 'asc' && (\n <TriangleArrowUpIcon\n color={sortButtonColorMapper[variant].selected}\n />\n )}\n {sortedState === 'desc' && (\n <TriangleArrowDownIcon\n color={sortButtonColorMapper[variant].selected}\n />\n )}\n </Flex>\n </button>\n </div>\n );\n }\n\n return (\n <div className={`${justifyContent} th`} key={header.id}>\n <Typo as=\"div\" variant=\"body\">\n {flexRender(\n header.column.columnDef.header,\n header.getContext()\n )}\n </Typo>\n </div>\n );\n })}\n </div>\n ))}\n </div>\n <scoll className=\"tbody\">\n {/* 조건에 따라 placeholder 또는 loading 렌더*/}\n {helpCompRender(rowModels.rows.length) ||\n rowModels.rows.map((row) => {\n return (\n <Row\n ExpandComp={ExpandComp}\n defaultAlign={defaultAlign}\n getCellStyle={getCellStyle}\n getRowStyle={getRowStyle}\n gridTemplateColumns={gridTemplateColumns}\n key={`row_${row.id}`}\n onRowClick={onRowClick}\n row={row}\n />\n );\n })}\n </scoll>\n </div>\n {showPagination ? (\n <Flex justify=\"end\" pt=\"4\" width=\"100%\">\n <Pagination\n count={pageCount}\n onChange={onChangePagination}\n page={pagination.pageIndex + 1}\n siblingCount={siblingCount}\n />\n </Flex>\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAQA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAgB,aAAa,SAAS,gBAAgB;AAkI1C,cAyDY,YAzDZ;AApHZ,IAAM,wBAGF;AAAA,EACF,MAAM;AAAA,IACJ,UAAU;AAAA,IACV,YAAY;AAAA,EACd;AAAA,EACA,QAAQ;AAAA;AAAA;AAAA,IAGN,UAAU;AAAA,IACV,YAAY;AAAA,EACd;AAAA,EACA,iBAAiB;AAAA,IACf,UAAU;AAAA,IACV,YAAY;AAAA,EACd;AACF;AA6BO,SAAS,YACd,OACiB;AACjB,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,iBAAiB;AAAA,IACjB;AAAA,IACA,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA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