@tipp/ui 0.1.10 → 0.1.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.
@@ -7,7 +7,7 @@ export { CheckboxGroup } from './check-box-group.cjs';
7
7
  export { DatePicker, DatePickerProps } from './date-picker/index.cjs';
8
8
  export { Heading, HeadingProps } from './heading.cjs';
9
9
  export { Link, LinkProps } from './link.cjs';
10
- export { Typo, TypoProps } from './text.cjs';
10
+ export { Typo, TypoProps } from './typo.cjs';
11
11
  export { Collapse, CollapseProps } from './collapse.cjs';
12
12
  import 'react';
13
13
  import 'react-datepicker';
@@ -7,7 +7,7 @@ export { CheckboxGroup } from './check-box-group.js';
7
7
  export { DatePicker, DatePickerProps } from './date-picker/index.js';
8
8
  export { Heading, HeadingProps } from './heading.js';
9
9
  export { Link, LinkProps } from './link.js';
10
- export { Typo, TypoProps } from './text.js';
10
+ export { Typo, TypoProps } from './typo.js';
11
11
  export { Collapse, CollapseProps } from './collapse.js';
12
12
  import 'react';
13
13
  import 'react-datepicker';
@@ -2,6 +2,27 @@ import "../chunk-WN3DQQSJ.js";
2
2
  import {
3
3
  DatePicker
4
4
  } from "../chunk-IIBITN2G.js";
5
+ import {
6
+ TextField
7
+ } from "../chunk-JPIZP2PZ.js";
8
+ import {
9
+ Tooltip
10
+ } from "../chunk-ACVANQJ4.js";
11
+ import {
12
+ Typo
13
+ } from "../chunk-5U2NU566.js";
14
+ import {
15
+ Select
16
+ } from "../chunk-355MU6BH.js";
17
+ import {
18
+ Separator
19
+ } from "../chunk-HYITAA4J.js";
20
+ import {
21
+ Skeleton
22
+ } from "../chunk-5H3YPCZK.js";
23
+ import {
24
+ Strong
25
+ } from "../chunk-74DX4CU7.js";
5
26
  import {
6
27
  Switch
7
28
  } from "../chunk-OYM4XCHQ.js";
@@ -15,14 +36,17 @@ import {
15
36
  TextArea
16
37
  } from "../chunk-ILRUXI2E.js";
17
38
  import {
18
- TextField
19
- } from "../chunk-JPIZP2PZ.js";
39
+ Progress
40
+ } from "../chunk-365QMK4D.js";
20
41
  import {
21
- Tooltip
22
- } from "../chunk-ACVANQJ4.js";
42
+ Quote
43
+ } from "../chunk-YO3BQW6S.js";
23
44
  import {
24
- Typo
25
- } from "../chunk-5U2NU566.js";
45
+ RadioCards
46
+ } from "../chunk-6IVCARWS.js";
47
+ import {
48
+ RadioGroup
49
+ } from "../chunk-6DJOIRMF.js";
26
50
  import {
27
51
  Radio
28
52
  } from "../chunk-FPD73OHW.js";
@@ -36,17 +60,14 @@ import {
36
60
  SegmentedControl
37
61
  } from "../chunk-TVDKGMBI.js";
38
62
  import {
39
- Select
40
- } from "../chunk-355MU6BH.js";
41
- import {
42
- Separator
43
- } from "../chunk-HYITAA4J.js";
63
+ Heading
64
+ } from "../chunk-HLOY6BIP.js";
44
65
  import {
45
- Skeleton
46
- } from "../chunk-5H3YPCZK.js";
66
+ HoverCard
67
+ } from "../chunk-O3T3TM3V.js";
47
68
  import {
48
- Strong
49
- } from "../chunk-74DX4CU7.js";
69
+ IconButton
70
+ } from "../chunk-O3DNDMV3.js";
50
71
  import {
51
72
  Inset
52
73
  } from "../chunk-XQOL7UBI.js";
@@ -60,17 +81,17 @@ import {
60
81
  Popover
61
82
  } from "../chunk-5AVBYDPB.js";
62
83
  import {
63
- Progress
64
- } from "../chunk-365QMK4D.js";
84
+ Collapse
85
+ } from "../chunk-OCJNQGHN.js";
65
86
  import {
66
- Quote
67
- } from "../chunk-YO3BQW6S.js";
87
+ Container
88
+ } from "../chunk-Q37G2GS6.js";
68
89
  import {
69
- RadioCards
70
- } from "../chunk-6IVCARWS.js";
90
+ DataList
91
+ } from "../chunk-VTJZMOSP.js";
71
92
  import {
72
- RadioGroup
73
- } from "../chunk-6DJOIRMF.js";
93
+ Dialog
94
+ } from "../chunk-P6B2PNYI.js";
74
95
  import {
75
96
  DropdownMenu
76
97
  } from "../chunk-YTZSKMX3.js";
@@ -84,14 +105,17 @@ import {
84
105
  Grid
85
106
  } from "../chunk-EGEQY3KT.js";
86
107
  import {
87
- Heading
88
- } from "../chunk-HLOY6BIP.js";
108
+ Box
109
+ } from "../chunk-4Y5BEXVN.js";
89
110
  import {
90
- HoverCard
91
- } from "../chunk-O3T3TM3V.js";
111
+ Button
112
+ } from "../chunk-RET725VL.js";
92
113
  import {
93
- IconButton
94
- } from "../chunk-O3DNDMV3.js";
114
+ Callout
115
+ } from "../chunk-B6XJN6EC.js";
116
+ import {
117
+ Card
118
+ } from "../chunk-FYEASFUU.js";
95
119
  import {
96
120
  CheckboxCards
97
121
  } from "../chunk-MIMJ7LON.js";
@@ -105,17 +129,8 @@ import {
105
129
  Code
106
130
  } from "../chunk-OHMOP5PV.js";
107
131
  import {
108
- Collapse
109
- } from "../chunk-OCJNQGHN.js";
110
- import {
111
- Container
112
- } from "../chunk-Q37G2GS6.js";
113
- import {
114
- DataList
115
- } from "../chunk-VTJZMOSP.js";
116
- import {
117
- Dialog
118
- } from "../chunk-P6B2PNYI.js";
132
+ AlertDialog
133
+ } from "../chunk-J242TTFH.js";
119
134
  import {
120
135
  AspectRatio
121
136
  } from "../chunk-EAXUQEO5.js";
@@ -128,21 +143,6 @@ import {
128
143
  import {
129
144
  Blockquote
130
145
  } from "../chunk-YGL6SWKN.js";
131
- import {
132
- Box
133
- } from "../chunk-4Y5BEXVN.js";
134
- import {
135
- Button
136
- } from "../chunk-RET725VL.js";
137
- import {
138
- Callout
139
- } from "../chunk-B6XJN6EC.js";
140
- import {
141
- Card
142
- } from "../chunk-FYEASFUU.js";
143
- import {
144
- AlertDialog
145
- } from "../chunk-J242TTFH.js";
146
146
  import "../chunk-N552FDTV.js";
147
147
  export {
148
148
  AlertDialog,
@@ -0,0 +1,112 @@
1
+ import {
2
+ Row
3
+ } from "./chunk-ZE5G2S34.js";
4
+ import {
5
+ TriangleArrowDownIcon
6
+ } from "./chunk-BSTJBBEX.js";
7
+ import {
8
+ TriangleArrowUpIcon
9
+ } from "./chunk-NDUKDKGB.js";
10
+ import {
11
+ Typo
12
+ } from "./chunk-5U2NU566.js";
13
+ import {
14
+ Flex
15
+ } from "./chunk-25HMMI7R.js";
16
+
17
+ // src/molecules/expand-table/index.tsx
18
+ import {
19
+ flexRender,
20
+ getCoreRowModel,
21
+ useReactTable,
22
+ getSortedRowModel,
23
+ createColumnHelper
24
+ } from "@tanstack/react-table";
25
+ import { useState } from "react";
26
+ import { jsx, jsxs } from "react/jsx-runtime";
27
+ function ExpandTable(props) {
28
+ const { data, columns, ExpandComp, placeholder, onRowClick } = props;
29
+ const [sorting, setSorting] = useState([]);
30
+ const { getRowModel, getHeaderGroups } = useReactTable({
31
+ data: data || [],
32
+ columns,
33
+ getCoreRowModel: getCoreRowModel(),
34
+ getSortedRowModel: getSortedRowModel(),
35
+ state: {
36
+ sorting
37
+ },
38
+ onSortingChange: setSorting
39
+ });
40
+ const rowModels = getRowModel();
41
+ return /* @__PURE__ */ jsxs("div", { className: "expand-table", children: [
42
+ /* @__PURE__ */ jsx("div", { className: "thead", children: getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx("div", { className: "tr", children: headerGroup.headers.map((header) => {
43
+ const sortable = header.column.getCanSort();
44
+ const sortedState = header.column.getIsSorted();
45
+ return /* @__PURE__ */ jsx(
46
+ "div",
47
+ {
48
+ className: "th",
49
+ style: {
50
+ width: header.getSize()
51
+ },
52
+ children: /* @__PURE__ */ jsxs(
53
+ "button",
54
+ {
55
+ onClick: header.column.getToggleSortingHandler(),
56
+ style: sortable ? { cursor: "pointer" } : void 0,
57
+ type: "button",
58
+ children: [
59
+ /* @__PURE__ */ jsx(Typo, { variant: "body", children: flexRender(
60
+ header.column.columnDef.header,
61
+ header.getContext()
62
+ ) }),
63
+ sortable ? /* @__PURE__ */ jsxs(
64
+ Flex,
65
+ {
66
+ direction: "column",
67
+ style: { marginLeft: "var(--space-2)" },
68
+ children: [
69
+ /* @__PURE__ */ jsx(
70
+ TriangleArrowUpIcon,
71
+ {
72
+ color: sortedState === "asc" ? "var(--iris-10)" : "var(--iris-6)"
73
+ }
74
+ ),
75
+ /* @__PURE__ */ jsx(
76
+ TriangleArrowDownIcon,
77
+ {
78
+ color: sortedState === "desc" ? "var(--iris-10)" : "var(--iris-6)"
79
+ }
80
+ )
81
+ ]
82
+ }
83
+ ) : null
84
+ ]
85
+ }
86
+ )
87
+ },
88
+ header.id
89
+ );
90
+ }) }, headerGroup.id)) }),
91
+ /* @__PURE__ */ jsxs("div", { className: "tbody", children: [
92
+ rowModels.rows.length === 0 && /* @__PURE__ */ jsx("div", { className: "tr", children: /* @__PURE__ */ jsx(Flex, { align: "center", justify: "center", children: placeholder || /* @__PURE__ */ jsx(Typo, { color: "gray", mb: "6", mt: "6", children: "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4" }) }) }, "expand_placeholder"),
93
+ rowModels.rows.map((row) => {
94
+ return /* @__PURE__ */ jsx(
95
+ Row,
96
+ {
97
+ ExpandComp,
98
+ onRowClick,
99
+ row
100
+ },
101
+ `row_${row.id}`
102
+ );
103
+ })
104
+ ] })
105
+ ] });
106
+ }
107
+
108
+ export {
109
+ createColumnHelper,
110
+ ExpandTable
111
+ };
112
+ //# sourceMappingURL=chunk-5IE43F4V.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/molecules/expand-table/index.tsx"],"sourcesContent":["import type { ColumnDef, SortingState, RowData } from '@tanstack/react-table';\nimport type { CSSProperties } from 'react';\nimport {\n flexRender,\n getCoreRowModel,\n useReactTable,\n getSortedRowModel,\n createColumnHelper,\n} from '@tanstack/react-table';\nimport React, { useState } from 'react';\nimport { Flex, Typo } from '../../atoms';\nimport { TriangleArrowDownIcon } from '../../icons/down';\nimport { TriangleArrowUpIcon } from '../../icons/up';\nimport { Row, type ExpandComp, type OnRowClick } from './row';\n\nexport type { ExpandComp, OnRowClick, ColumnDef };\nexport { createColumnHelper };\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 rowStyle?: CSSProperties;\n}\n\nexport function ExpandTable<Datum extends RowData>(\n props: ExpandTableProps<Datum>\n): React.ReactNode {\n const { data, columns, ExpandComp, placeholder, onRowClick } = props;\n\n const [sorting, setSorting] = useState<SortingState>([]);\n const { getRowModel, getHeaderGroups } = useReactTable({\n data: data || [],\n columns,\n getCoreRowModel: getCoreRowModel(),\n getSortedRowModel: getSortedRowModel(),\n state: {\n sorting,\n },\n onSortingChange: setSorting,\n });\n\n const rowModels = getRowModel();\n\n return (\n <div className=\"expand-table\">\n <div className=\"thead\">\n {getHeaderGroups().map((headerGroup) => (\n <div className=\"tr\" key={headerGroup.id}>\n {headerGroup.headers.map((header) => {\n const sortable = header.column.getCanSort();\n const sortedState = header.column.getIsSorted();\n return (\n <div\n className=\"th\"\n key={header.id}\n style={{\n width: header.getSize(),\n }}\n >\n <button\n onClick={header.column.getToggleSortingHandler()}\n style={sortable ? { cursor: 'pointer' } : undefined}\n type=\"button\"\n >\n <Typo variant=\"body\">\n {flexRender(\n header.column.columnDef.header,\n header.getContext()\n )}\n </Typo>\n {sortable ? (\n <Flex\n direction=\"column\"\n style={{ marginLeft: 'var(--space-2)' }}\n >\n <TriangleArrowUpIcon\n color={\n sortedState === 'asc'\n ? 'var(--iris-10)'\n : 'var(--iris-6)'\n }\n />\n <TriangleArrowDownIcon\n color={\n sortedState === 'desc'\n ? 'var(--iris-10)'\n : 'var(--iris-6)'\n }\n />\n </Flex>\n ) : null}\n </button>\n </div>\n );\n })}\n </div>\n ))}\n </div>\n <div className=\"tbody\">\n {/* 데이터가 없을 시 표시되는 노드 */}\n {rowModels.rows.length === 0 && (\n <div className=\"tr\" key=\"expand_placeholder\">\n <Flex align=\"center\" justify=\"center\">\n {placeholder || (\n <Typo color=\"gray\" mb=\"6\" mt=\"6\">\n 데이터가 없습니다\n </Typo>\n )}\n </Flex>\n </div>\n )}\n\n {/* 행을 렌더하는 로직 */}\n {rowModels.rows.map((row) => {\n return (\n <Row\n ExpandComp={ExpandComp}\n key={`row_${row.id}`}\n onRowClick={onRowClick}\n row={row}\n />\n );\n })}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAgB,gBAAgB;AA+DZ,cAOE,YAPF;AAxCb,SAAS,YACd,OACiB;AACjB,QAAM,EAAE,MAAM,SAAS,YAAY,aAAa,WAAW,IAAI;AAE/D,QAAM,CAAC,SAAS,UAAU,IAAI,SAAuB,CAAC,CAAC;AACvD,QAAM,EAAE,aAAa,gBAAgB,IAAI,cAAc;AAAA,IACrD,MAAM,QAAQ,CAAC;AAAA,IACf;AAAA,IACA,iBAAiB,gBAAgB;AAAA,IACjC,mBAAmB,kBAAkB;AAAA,IACrC,OAAO;AAAA,MACL;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,EACnB,CAAC;AAED,QAAM,YAAY,YAAY;AAE9B,SACE,qBAAC,SAAI,WAAU,gBACb;AAAA,wBAAC,SAAI,WAAU,SACZ,0BAAgB,EAAE,IAAI,CAAC,gBACtB,oBAAC,SAAI,WAAU,MACZ,sBAAY,QAAQ,IAAI,CAAC,WAAW;AACnC,YAAM,WAAW,OAAO,OAAO,WAAW;AAC1C,YAAM,cAAc,OAAO,OAAO,YAAY;AAC9C,aACE;AAAA,QAAC;AAAA;AAAA,UACC,WAAU;AAAA,UAEV,OAAO;AAAA,YACL,OAAO,OAAO,QAAQ;AAAA,UACxB;AAAA,UAEA;AAAA,YAAC;AAAA;AAAA,cACC,SAAS,OAAO,OAAO,wBAAwB;AAAA,cAC/C,OAAO,WAAW,EAAE,QAAQ,UAAU,IAAI;AAAA,cAC1C,MAAK;AAAA,cAEL;AAAA,oCAAC,QAAK,SAAQ,QACX;AAAA,kBACC,OAAO,OAAO,UAAU;AAAA,kBACxB,OAAO,WAAW;AAAA,gBACpB,GACF;AAAA,gBACC,WACC;AAAA,kBAAC;AAAA;AAAA,oBACC,WAAU;AAAA,oBACV,OAAO,EAAE,YAAY,iBAAiB;AAAA,oBAEtC;AAAA;AAAA,wBAAC;AAAA;AAAA,0BACC,OACE,gBAAgB,QACZ,mBACA;AAAA;AAAA,sBAER;AAAA,sBACA;AAAA,wBAAC;AAAA;AAAA,0BACC,OACE,gBAAgB,SACZ,mBACA;AAAA;AAAA,sBAER;AAAA;AAAA;AAAA,gBACF,IACE;AAAA;AAAA;AAAA,UACN;AAAA;AAAA,QArCK,OAAO;AAAA,MAsCd;AAAA,IAEJ,CAAC,KA/CsB,YAAY,EAgDrC,CACD,GACH;AAAA,IACA,qBAAC,SAAI,WAAU,SAEZ;AAAA,gBAAU,KAAK,WAAW,KACzB,oBAAC,SAAI,WAAU,MACb,8BAAC,QAAK,OAAM,UAAS,SAAQ,UAC1B,yBACC,oBAAC,QAAK,OAAM,QAAO,IAAG,KAAI,IAAG,KAAI,+DAEjC,GAEJ,KAPsB,oBAQxB;AAAA,MAID,UAAU,KAAK,IAAI,CAAC,QAAQ;AAC3B,eACE;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YAEA;AAAA,YACA;AAAA;AAAA,UAFK,OAAO,IAAI,EAAE;AAAA,QAGpB;AAAA,MAEJ,CAAC;AAAA,OACH;AAAA,KACF;AAEJ;","names":[]}
@@ -0,0 +1,112 @@
1
+ import {
2
+ Row
3
+ } from "./chunk-ZE5G2S34.js";
4
+ import {
5
+ TriangleArrowDownIcon
6
+ } from "./chunk-BSTJBBEX.js";
7
+ import {
8
+ TriangleArrowUpIcon
9
+ } from "./chunk-NDUKDKGB.js";
10
+ import {
11
+ Typo
12
+ } from "./chunk-5U2NU566.js";
13
+ import {
14
+ Flex
15
+ } from "./chunk-25HMMI7R.js";
16
+
17
+ // src/molecules/expand-table/index.tsx
18
+ import {
19
+ flexRender,
20
+ getCoreRowModel,
21
+ useReactTable,
22
+ getSortedRowModel,
23
+ createColumnHelper
24
+ } from "@tanstack/react-table";
25
+ import { useState } from "react";
26
+ import { jsx, jsxs } from "react/jsx-runtime";
27
+ function ExpandTable(props) {
28
+ const { data, columns, ExpandComp, placeholder, onRowClick } = props;
29
+ const [sorting, setSorting] = useState([]);
30
+ const { getRowModel, getHeaderGroups } = useReactTable({
31
+ data: data || [],
32
+ columns,
33
+ getCoreRowModel: getCoreRowModel(),
34
+ getSortedRowModel: getSortedRowModel(),
35
+ state: {
36
+ sorting
37
+ },
38
+ onSortingChange: setSorting
39
+ });
40
+ const rowModels = getRowModel();
41
+ return /* @__PURE__ */ jsxs("div", { className: "expand-table", children: [
42
+ /* @__PURE__ */ jsx("div", { className: "thead", children: getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx("div", { className: "tr", children: headerGroup.headers.map((header) => {
43
+ const sortable = header.column.getCanSort();
44
+ const sortedState = header.column.getIsSorted();
45
+ return /* @__PURE__ */ jsx(
46
+ "div",
47
+ {
48
+ className: "th",
49
+ style: {
50
+ width: header.getSize()
51
+ },
52
+ children: /* @__PURE__ */ jsxs(
53
+ "button",
54
+ {
55
+ onClick: header.column.getToggleSortingHandler(),
56
+ style: sortable ? { cursor: "pointer" } : void 0,
57
+ type: "button",
58
+ children: [
59
+ /* @__PURE__ */ jsx(Typo, { variant: "body", children: flexRender(
60
+ header.column.columnDef.header,
61
+ header.getContext()
62
+ ) }),
63
+ sortable ? /* @__PURE__ */ jsxs(
64
+ Flex,
65
+ {
66
+ direction: "column",
67
+ style: { marginLeft: "var(--space-2)" },
68
+ children: [
69
+ /* @__PURE__ */ jsx(
70
+ TriangleArrowUpIcon,
71
+ {
72
+ color: sortedState === "asc" ? "var(--iris-10)" : "var(--iris-6)"
73
+ }
74
+ ),
75
+ /* @__PURE__ */ jsx(
76
+ TriangleArrowDownIcon,
77
+ {
78
+ color: sortedState === "desc" ? "var(--iris-10)" : "var(--iris-6)"
79
+ }
80
+ )
81
+ ]
82
+ }
83
+ ) : null
84
+ ]
85
+ }
86
+ )
87
+ },
88
+ header.id
89
+ );
90
+ }) }, headerGroup.id)) }),
91
+ /* @__PURE__ */ jsxs("div", { className: "tbody", children: [
92
+ rowModels.rows.length === 0 && /* @__PURE__ */ jsx("div", { className: "tr", children: /* @__PURE__ */ jsx(Flex, { align: "center", justify: "center", children: placeholder || /* @__PURE__ */ jsx(Typo, { color: "gray", mt: "3", mb: "3", children: "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4" }) }) }, "expand_placeholder"),
93
+ rowModels.rows.map((row) => {
94
+ return /* @__PURE__ */ jsx(
95
+ Row,
96
+ {
97
+ ExpandComp,
98
+ onRowClick,
99
+ row
100
+ },
101
+ `row_${row.id}`
102
+ );
103
+ })
104
+ ] })
105
+ ] });
106
+ }
107
+
108
+ export {
109
+ createColumnHelper,
110
+ ExpandTable
111
+ };
112
+ //# sourceMappingURL=chunk-CPCRGFP2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/molecules/expand-table/index.tsx"],"sourcesContent":["import type { ColumnDef, SortingState, RowData } from '@tanstack/react-table';\nimport type { CSSProperties } from 'react';\nimport {\n flexRender,\n getCoreRowModel,\n useReactTable,\n getSortedRowModel,\n createColumnHelper,\n} from '@tanstack/react-table';\nimport React, { useState } from 'react';\nimport { Flex, Typo } from '../../atoms';\nimport { TriangleArrowDownIcon } from '../../icons/down';\nimport { TriangleArrowUpIcon } from '../../icons/up';\nimport { Row, type ExpandComp, type OnRowClick } from './row';\n\nexport type { ExpandComp, OnRowClick, ColumnDef };\nexport { createColumnHelper };\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 rowStyle?: CSSProperties;\n}\n\nexport function ExpandTable<Datum extends RowData>(\n props: ExpandTableProps<Datum>\n): React.ReactNode {\n const { data, columns, ExpandComp, placeholder, onRowClick } = props;\n\n const [sorting, setSorting] = useState<SortingState>([]);\n const { getRowModel, getHeaderGroups } = useReactTable({\n data: data || [],\n columns,\n getCoreRowModel: getCoreRowModel(),\n getSortedRowModel: getSortedRowModel(),\n state: {\n sorting,\n },\n onSortingChange: setSorting,\n });\n\n const rowModels = getRowModel();\n\n return (\n <div className=\"expand-table\">\n <div className=\"thead\">\n {getHeaderGroups().map((headerGroup) => (\n <div className=\"tr\" key={headerGroup.id}>\n {headerGroup.headers.map((header) => {\n const sortable = header.column.getCanSort();\n const sortedState = header.column.getIsSorted();\n return (\n <div\n className=\"th\"\n key={header.id}\n style={{\n width: header.getSize(),\n }}\n >\n <button\n onClick={header.column.getToggleSortingHandler()}\n style={sortable ? { cursor: 'pointer' } : undefined}\n type=\"button\"\n >\n <Typo variant=\"body\">\n {flexRender(\n header.column.columnDef.header,\n header.getContext()\n )}\n </Typo>\n {sortable ? (\n <Flex\n direction=\"column\"\n style={{ marginLeft: 'var(--space-2)' }}\n >\n <TriangleArrowUpIcon\n color={\n sortedState === 'asc'\n ? 'var(--iris-10)'\n : 'var(--iris-6)'\n }\n />\n <TriangleArrowDownIcon\n color={\n sortedState === 'desc'\n ? 'var(--iris-10)'\n : 'var(--iris-6)'\n }\n />\n </Flex>\n ) : null}\n </button>\n </div>\n );\n })}\n </div>\n ))}\n </div>\n <div className=\"tbody\">\n {/* 데이터가 없을 시 표시되는 노드 */}\n {rowModels.rows.length === 0 && (\n <div className=\"tr\" key=\"expand_placeholder\">\n <Flex align=\"center\" justify=\"center\">\n {placeholder || (\n <Typo color=\"gray\" mt=\"3\" mb=\"3\">\n 데이터가 없습니다\n </Typo>\n )}\n </Flex>\n </div>\n )}\n\n {/* 행을 렌더하는 로직 */}\n {rowModels.rows.map((row) => {\n return (\n <Row\n ExpandComp={ExpandComp}\n key={`row_${row.id}`}\n onRowClick={onRowClick}\n row={row}\n />\n );\n })}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAgB,gBAAgB;AA+DZ,cAOE,YAPF;AAxCb,SAAS,YACd,OACiB;AACjB,QAAM,EAAE,MAAM,SAAS,YAAY,aAAa,WAAW,IAAI;AAE/D,QAAM,CAAC,SAAS,UAAU,IAAI,SAAuB,CAAC,CAAC;AACvD,QAAM,EAAE,aAAa,gBAAgB,IAAI,cAAc;AAAA,IACrD,MAAM,QAAQ,CAAC;AAAA,IACf;AAAA,IACA,iBAAiB,gBAAgB;AAAA,IACjC,mBAAmB,kBAAkB;AAAA,IACrC,OAAO;AAAA,MACL;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,EACnB,CAAC;AAED,QAAM,YAAY,YAAY;AAE9B,SACE,qBAAC,SAAI,WAAU,gBACb;AAAA,wBAAC,SAAI,WAAU,SACZ,0BAAgB,EAAE,IAAI,CAAC,gBACtB,oBAAC,SAAI,WAAU,MACZ,sBAAY,QAAQ,IAAI,CAAC,WAAW;AACnC,YAAM,WAAW,OAAO,OAAO,WAAW;AAC1C,YAAM,cAAc,OAAO,OAAO,YAAY;AAC9C,aACE;AAAA,QAAC;AAAA;AAAA,UACC,WAAU;AAAA,UAEV,OAAO;AAAA,YACL,OAAO,OAAO,QAAQ;AAAA,UACxB;AAAA,UAEA;AAAA,YAAC;AAAA;AAAA,cACC,SAAS,OAAO,OAAO,wBAAwB;AAAA,cAC/C,OAAO,WAAW,EAAE,QAAQ,UAAU,IAAI;AAAA,cAC1C,MAAK;AAAA,cAEL;AAAA,oCAAC,QAAK,SAAQ,QACX;AAAA,kBACC,OAAO,OAAO,UAAU;AAAA,kBACxB,OAAO,WAAW;AAAA,gBACpB,GACF;AAAA,gBACC,WACC;AAAA,kBAAC;AAAA;AAAA,oBACC,WAAU;AAAA,oBACV,OAAO,EAAE,YAAY,iBAAiB;AAAA,oBAEtC;AAAA;AAAA,wBAAC;AAAA;AAAA,0BACC,OACE,gBAAgB,QACZ,mBACA;AAAA;AAAA,sBAER;AAAA,sBACA;AAAA,wBAAC;AAAA;AAAA,0BACC,OACE,gBAAgB,SACZ,mBACA;AAAA;AAAA,sBAER;AAAA;AAAA;AAAA,gBACF,IACE;AAAA;AAAA;AAAA,UACN;AAAA;AAAA,QArCK,OAAO;AAAA,MAsCd;AAAA,IAEJ,CAAC,KA/CsB,YAAY,EAgDrC,CACD,GACH;AAAA,IACA,qBAAC,SAAI,WAAU,SAEZ;AAAA,gBAAU,KAAK,WAAW,KACzB,oBAAC,SAAI,WAAU,MACb,8BAAC,QAAK,OAAM,UAAS,SAAQ,UAC1B,yBACC,oBAAC,QAAK,OAAM,QAAO,IAAG,KAAI,IAAG,KAAI,+DAEjC,GAEJ,KAPsB,oBAQxB;AAAA,MAID,UAAU,KAAK,IAAI,CAAC,QAAQ;AAC3B,eACE;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YAEA;AAAA,YACA;AAAA;AAAA,UAFK,OAAO,IAAI,EAAE;AAAA,QAGpB;AAAA,MAEJ,CAAC;AAAA,OACH;AAAA,KACF;AAEJ;","names":[]}
@@ -0,0 +1,112 @@
1
+ import {
2
+ Row
3
+ } from "./chunk-ZE5G2S34.js";
4
+ import {
5
+ TriangleArrowDownIcon
6
+ } from "./chunk-BSTJBBEX.js";
7
+ import {
8
+ TriangleArrowUpIcon
9
+ } from "./chunk-NDUKDKGB.js";
10
+ import {
11
+ Typo
12
+ } from "./chunk-5U2NU566.js";
13
+ import {
14
+ Flex
15
+ } from "./chunk-25HMMI7R.js";
16
+
17
+ // src/molecules/expand-table/index.tsx
18
+ import {
19
+ flexRender,
20
+ getCoreRowModel,
21
+ useReactTable,
22
+ getSortedRowModel,
23
+ createColumnHelper
24
+ } from "@tanstack/react-table";
25
+ import { useState } from "react";
26
+ import { jsx, jsxs } from "react/jsx-runtime";
27
+ function ExpandTable(props) {
28
+ const { data, columns, ExpandComp, placeholder, onRowClick } = props;
29
+ const [sorting, setSorting] = useState([]);
30
+ const { getRowModel, getHeaderGroups } = useReactTable({
31
+ data: data || [],
32
+ columns,
33
+ getCoreRowModel: getCoreRowModel(),
34
+ getSortedRowModel: getSortedRowModel(),
35
+ state: {
36
+ sorting
37
+ },
38
+ onSortingChange: setSorting
39
+ });
40
+ const rowModels = getRowModel();
41
+ return /* @__PURE__ */ jsxs("div", { className: "expand-table", children: [
42
+ /* @__PURE__ */ jsx("div", { className: "thead", children: getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx("div", { className: "tr", children: headerGroup.headers.map((header) => {
43
+ const sortable = header.column.getCanSort();
44
+ const sortedState = header.column.getIsSorted();
45
+ return /* @__PURE__ */ jsx(
46
+ "div",
47
+ {
48
+ className: "th",
49
+ style: {
50
+ width: header.getSize()
51
+ },
52
+ children: /* @__PURE__ */ jsxs(
53
+ "button",
54
+ {
55
+ onClick: header.column.getToggleSortingHandler(),
56
+ style: sortable ? { cursor: "pointer" } : void 0,
57
+ type: "button",
58
+ children: [
59
+ /* @__PURE__ */ jsx(Typo, { variant: "body", children: flexRender(
60
+ header.column.columnDef.header,
61
+ header.getContext()
62
+ ) }),
63
+ sortable ? /* @__PURE__ */ jsxs(
64
+ Flex,
65
+ {
66
+ direction: "column",
67
+ style: { marginLeft: "var(--space-2)" },
68
+ children: [
69
+ /* @__PURE__ */ jsx(
70
+ TriangleArrowUpIcon,
71
+ {
72
+ color: sortedState === "asc" ? "var(--iris-10)" : "var(--iris-6)"
73
+ }
74
+ ),
75
+ /* @__PURE__ */ jsx(
76
+ TriangleArrowDownIcon,
77
+ {
78
+ color: sortedState === "desc" ? "var(--iris-10)" : "var(--iris-6)"
79
+ }
80
+ )
81
+ ]
82
+ }
83
+ ) : null
84
+ ]
85
+ }
86
+ )
87
+ },
88
+ header.id
89
+ );
90
+ }) }, headerGroup.id)) }),
91
+ /* @__PURE__ */ jsxs("div", { className: "tbody", children: [
92
+ rowModels.rows.length === 0 && /* @__PURE__ */ jsx("div", { className: "tr", children: /* @__PURE__ */ jsx(Flex, { align: "center", justify: "center", children: placeholder || /* @__PURE__ */ jsx(Typo, { color: "gray", mb: "3", mt: "3", children: "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4" }) }) }, "expand_placeholder"),
93
+ rowModels.rows.map((row) => {
94
+ return /* @__PURE__ */ jsx(
95
+ Row,
96
+ {
97
+ ExpandComp,
98
+ onRowClick,
99
+ row
100
+ },
101
+ `row_${row.id}`
102
+ );
103
+ })
104
+ ] })
105
+ ] });
106
+ }
107
+
108
+ export {
109
+ createColumnHelper,
110
+ ExpandTable
111
+ };
112
+ //# sourceMappingURL=chunk-NKNON63L.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/molecules/expand-table/index.tsx"],"sourcesContent":["import type { ColumnDef, SortingState, RowData } from '@tanstack/react-table';\nimport type { CSSProperties } from 'react';\nimport {\n flexRender,\n getCoreRowModel,\n useReactTable,\n getSortedRowModel,\n createColumnHelper,\n} from '@tanstack/react-table';\nimport React, { useState } from 'react';\nimport { Flex, Typo } from '../../atoms';\nimport { TriangleArrowDownIcon } from '../../icons/down';\nimport { TriangleArrowUpIcon } from '../../icons/up';\nimport { Row, type ExpandComp, type OnRowClick } from './row';\n\nexport type { ExpandComp, OnRowClick, ColumnDef };\nexport { createColumnHelper };\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 rowStyle?: CSSProperties;\n}\n\nexport function ExpandTable<Datum extends RowData>(\n props: ExpandTableProps<Datum>\n): React.ReactNode {\n const { data, columns, ExpandComp, placeholder, onRowClick } = props;\n\n const [sorting, setSorting] = useState<SortingState>([]);\n const { getRowModel, getHeaderGroups } = useReactTable({\n data: data || [],\n columns,\n getCoreRowModel: getCoreRowModel(),\n getSortedRowModel: getSortedRowModel(),\n state: {\n sorting,\n },\n onSortingChange: setSorting,\n });\n\n const rowModels = getRowModel();\n\n return (\n <div className=\"expand-table\">\n <div className=\"thead\">\n {getHeaderGroups().map((headerGroup) => (\n <div className=\"tr\" key={headerGroup.id}>\n {headerGroup.headers.map((header) => {\n const sortable = header.column.getCanSort();\n const sortedState = header.column.getIsSorted();\n return (\n <div\n className=\"th\"\n key={header.id}\n style={{\n width: header.getSize(),\n }}\n >\n <button\n onClick={header.column.getToggleSortingHandler()}\n style={sortable ? { cursor: 'pointer' } : undefined}\n type=\"button\"\n >\n <Typo variant=\"body\">\n {flexRender(\n header.column.columnDef.header,\n header.getContext()\n )}\n </Typo>\n {sortable ? (\n <Flex\n direction=\"column\"\n style={{ marginLeft: 'var(--space-2)' }}\n >\n <TriangleArrowUpIcon\n color={\n sortedState === 'asc'\n ? 'var(--iris-10)'\n : 'var(--iris-6)'\n }\n />\n <TriangleArrowDownIcon\n color={\n sortedState === 'desc'\n ? 'var(--iris-10)'\n : 'var(--iris-6)'\n }\n />\n </Flex>\n ) : null}\n </button>\n </div>\n );\n })}\n </div>\n ))}\n </div>\n <div className=\"tbody\">\n {/* 데이터가 없을 시 표시되는 노드 */}\n {rowModels.rows.length === 0 && (\n <div className=\"tr\" key=\"expand_placeholder\">\n <Flex align=\"center\" justify=\"center\">\n {placeholder || (\n <Typo color=\"gray\" mb=\"3\" mt=\"3\">\n 데이터가 없습니다\n </Typo>\n )}\n </Flex>\n </div>\n )}\n\n {/* 행을 렌더하는 로직 */}\n {rowModels.rows.map((row) => {\n return (\n <Row\n ExpandComp={ExpandComp}\n key={`row_${row.id}`}\n onRowClick={onRowClick}\n row={row}\n />\n );\n })}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAgB,gBAAgB;AA+DZ,cAOE,YAPF;AAxCb,SAAS,YACd,OACiB;AACjB,QAAM,EAAE,MAAM,SAAS,YAAY,aAAa,WAAW,IAAI;AAE/D,QAAM,CAAC,SAAS,UAAU,IAAI,SAAuB,CAAC,CAAC;AACvD,QAAM,EAAE,aAAa,gBAAgB,IAAI,cAAc;AAAA,IACrD,MAAM,QAAQ,CAAC;AAAA,IACf;AAAA,IACA,iBAAiB,gBAAgB;AAAA,IACjC,mBAAmB,kBAAkB;AAAA,IACrC,OAAO;AAAA,MACL;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,EACnB,CAAC;AAED,QAAM,YAAY,YAAY;AAE9B,SACE,qBAAC,SAAI,WAAU,gBACb;AAAA,wBAAC,SAAI,WAAU,SACZ,0BAAgB,EAAE,IAAI,CAAC,gBACtB,oBAAC,SAAI,WAAU,MACZ,sBAAY,QAAQ,IAAI,CAAC,WAAW;AACnC,YAAM,WAAW,OAAO,OAAO,WAAW;AAC1C,YAAM,cAAc,OAAO,OAAO,YAAY;AAC9C,aACE;AAAA,QAAC;AAAA;AAAA,UACC,WAAU;AAAA,UAEV,OAAO;AAAA,YACL,OAAO,OAAO,QAAQ;AAAA,UACxB;AAAA,UAEA;AAAA,YAAC;AAAA;AAAA,cACC,SAAS,OAAO,OAAO,wBAAwB;AAAA,cAC/C,OAAO,WAAW,EAAE,QAAQ,UAAU,IAAI;AAAA,cAC1C,MAAK;AAAA,cAEL;AAAA,oCAAC,QAAK,SAAQ,QACX;AAAA,kBACC,OAAO,OAAO,UAAU;AAAA,kBACxB,OAAO,WAAW;AAAA,gBACpB,GACF;AAAA,gBACC,WACC;AAAA,kBAAC;AAAA;AAAA,oBACC,WAAU;AAAA,oBACV,OAAO,EAAE,YAAY,iBAAiB;AAAA,oBAEtC;AAAA;AAAA,wBAAC;AAAA;AAAA,0BACC,OACE,gBAAgB,QACZ,mBACA;AAAA;AAAA,sBAER;AAAA,sBACA;AAAA,wBAAC;AAAA;AAAA,0BACC,OACE,gBAAgB,SACZ,mBACA;AAAA;AAAA,sBAER;AAAA;AAAA;AAAA,gBACF,IACE;AAAA;AAAA;AAAA,UACN;AAAA;AAAA,QArCK,OAAO;AAAA,MAsCd;AAAA,IAEJ,CAAC,KA/CsB,YAAY,EAgDrC,CACD,GACH;AAAA,IACA,qBAAC,SAAI,WAAU,SAEZ;AAAA,gBAAU,KAAK,WAAW,KACzB,oBAAC,SAAI,WAAU,MACb,8BAAC,QAAK,OAAM,UAAS,SAAQ,UAC1B,yBACC,oBAAC,QAAK,OAAM,QAAO,IAAG,KAAI,IAAG,KAAI,+DAEjC,GAEJ,KAPsB,oBAQxB;AAAA,MAID,UAAU,KAAK,IAAI,CAAC,QAAQ;AAC3B,eACE;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YAEA;AAAA,YACA;AAAA;AAAA,UAFK,OAAO,IAAI,EAAE;AAAA,QAGpB;AAAA,MAEJ,CAAC;AAAA,OACH;AAAA,KACF;AAEJ;","names":[]}
package/dist/icon.d.cts CHANGED
@@ -1,3 +1,3 @@
1
- export { BookmarkIcon, ChatBubbleIcon, DotsHorizontalIcon, ExclamationTriangleIcon, ExitIcon, InfoCircledIcon, MagnifyingGlassIcon, MixerHorizontalIcon, PlusIcon } from '@radix-ui/react-icons';
1
+ export { BookmarkFilledIcon, BookmarkIcon, ChatBubbleIcon, DotsHorizontalIcon, ExclamationTriangleIcon, ExitIcon, InfoCircledIcon, MagnifyingGlassIcon, MixerHorizontalIcon, PlusIcon } from '@radix-ui/react-icons';
2
2
  import '@radix-ui/themes';
3
3
  import '@radix-ui/themes/dist/cjs/props/index.js';
package/dist/icon.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { BookmarkIcon, ChatBubbleIcon, DotsHorizontalIcon, ExclamationTriangleIcon, ExitIcon, InfoCircledIcon, MagnifyingGlassIcon, MixerHorizontalIcon, PlusIcon } from '@radix-ui/react-icons';
1
+ export { BookmarkFilledIcon, BookmarkIcon, ChatBubbleIcon, DotsHorizontalIcon, ExclamationTriangleIcon, ExitIcon, InfoCircledIcon, MagnifyingGlassIcon, MixerHorizontalIcon, PlusIcon } from '@radix-ui/react-icons';
2
2
  import '@radix-ui/themes';
3
3
  import '@radix-ui/themes/dist/cjs/props/index.js';
package/dist/index.cjs CHANGED
@@ -662,7 +662,7 @@ function ExpandTable(props) {
662
662
  );
663
663
  }) }, headerGroup.id)) }),
664
664
  /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "tbody", children: [
665
- rowModels.rows.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "tr", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_themes19.Flex, { align: "center", justify: "center", children: placeholder || /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Typo, { children: "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4" }) }) }, "expand_placeholder"),
665
+ rowModels.rows.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "tr", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_themes19.Flex, { align: "center", justify: "center", children: placeholder || /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Typo, { color: "gray", mb: "6", mt: "6", children: "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4" }) }) }, "expand_placeholder"),
666
666
  rowModels.rows.map((row) => {
667
667
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
668
668
  Row,