@uniai-fe/ui-legacy 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/package.json +37 -38
- package/src/button/index.tsx +12 -12
- package/src/components.tsx +2 -2
- package/src/icon/icon.scss +1 -1
- package/src/icon/index.tsx +4 -4
- package/src/icon/styled.tsx +2 -2
- package/src/index.scss +2 -2
- package/src/index.tsx +0 -2
- package/src/types/index.d.ts +2 -2
- package/src/chart/chart.scss +0 -11
- package/src/chart/components/Contents.tsx +0 -17
- package/src/chart/components/control/Button.tsx +0 -39
- package/src/chart/components/control/Container.tsx +0 -27
- package/src/chart/components/control/Provider.tsx +0 -117
- package/src/chart/components/control/index.tsx +0 -12
- package/src/chart/components/custom/ActivePieSector.tsx +0 -29
- package/src/chart/components/graphs/ArcGauge.tsx +0 -58
- package/src/chart/components/graphs/ArcMeter.tsx +0 -112
- package/src/chart/components/graphs/Area.tsx +0 -132
- package/src/chart/components/graphs/Bar.tsx +0 -179
- package/src/chart/components/graphs/Doughnut.tsx +0 -90
- package/src/chart/components/graphs/Line.tsx +0 -123
- package/src/chart/components/graphs/index.tsx +0 -17
- package/src/chart/components/ticks/XAxis.tsx +0 -39
- package/src/chart/components/ticks/index.tsx +0 -7
- package/src/chart/index.tsx +0 -17
- package/src/chart/styled.tsx +0 -3
- package/src/chart/styles/scss/arc-gauge.scss +0 -11
- package/src/chart/styles/scss/arc-meter.scss +0 -6
- package/src/chart/styles/scss/control.scss +0 -34
- package/src/chart/styles/scss/filter.scss +0 -0
- package/src/chart/styles/scss/graph.scss +0 -3
- package/src/chart/styles/scss/legend.scss +0 -35
- package/src/chart/styles/scss/level.color.scss +0 -7
- package/src/chart/styles/scss/tick.scss +0 -48
- package/src/chart/styles/scss/tooltip.scss +0 -70
- package/src/chart/styles/styled/arc-gauge.ts +0 -65
- package/src/chart/styles/styled/arc-meter.ts +0 -42
- package/src/chart/styles/styled/common.ts +0 -14
- package/src/chart/styles/styled/control.ts +0 -31
- package/src/chart/styles/styled/legend.ts +0 -11
- package/src/chart/svg/gauge-track.min.svg +0 -1
- package/src/chart/utils/getLevel.ts +0 -23
- package/src/icon/components/chart/Control.tsx +0 -40
- package/src/icon/components/chart/index.tsx +0 -7
- package/src/icon/components/health-score/HealthScore.tsx +0 -46
- package/src/icon/components/health-score/index.tsx +0 -3
- package/src/icon/styles/scss/chart.scss +0 -3
- package/src/icon/styles/styled/chart.ts +0 -17
- package/src/icon/svg/chart/control/pan-left.svg +0 -4
- package/src/icon/svg/chart/control/pan-right.svg +0 -4
- package/src/icon/svg/chart/control/zoom-in.svg +0 -4
- package/src/icon/svg/chart/control/zoom-out.svg +0 -4
- package/src/styled.template.tsx +0 -5
- package/src/template/compare/compare.scss +0 -1
- package/src/template/compare/components/box/Container.tsx +0 -33
- package/src/template/compare/components/box/TextStrong.tsx +0 -15
- package/src/template/compare/components/box/TextSub.tsx +0 -15
- package/src/template/compare/components/box/index.tsx +0 -11
- package/src/template/compare/components/button/Remove.tsx +0 -28
- package/src/template/compare/components/button/index.tsx +0 -5
- package/src/template/compare/components/chart/Container.tsx +0 -33
- package/src/template/compare/components/chart/graph/Container.tsx +0 -15
- package/src/template/compare/components/chart/graph/Item.tsx +0 -13
- package/src/template/compare/components/chart/index.tsx +0 -16
- package/src/template/compare/components/chart/legend/Container.tsx +0 -23
- package/src/template/compare/components/chart/legend/Section.tsx +0 -31
- package/src/template/compare/components/select-list/Container.tsx +0 -15
- package/src/template/compare/components/select-list/Header.tsx +0 -15
- package/src/template/compare/components/select-list/Item.tsx +0 -15
- package/src/template/compare/components/select-list/List.tsx +0 -18
- package/src/template/compare/components/select-list/index.tsx +0 -13
- package/src/template/compare/index.tsx +0 -13
- package/src/template/compare/styled.tsx +0 -17
- package/src/template/compare/styles/scss/variables.scss +0 -17
- package/src/template/compare/styles/styled-components/chart/graph.ts +0 -26
- package/src/template/compare/styles/styled-components/chart/layout.ts +0 -38
- package/src/template/compare/styles/styled-components/chart/legend.ts +0 -64
- package/src/template/compare/styles/styled-components/common.ts +0 -57
- package/src/template/compare/styles/styled-components/select-list.ts +0 -36
- package/src/template/filter/components/Container.tsx +0 -39
- package/src/template/filter/components/Group.tsx +0 -100
- package/src/template/filter/components/ToggleButton.tsx +0 -27
- package/src/template/filter/index.tsx +0 -5
- package/src/template/filter/styled.tsx +0 -3
- package/src/template/filter/styles/styled-components/filter.ts +0 -66
- package/src/template/health-score/components/Chart.tsx +0 -38
- package/src/template/health-score/index.tsx +0 -3
- package/src/template/health-score/styled.tsx +0 -3
- package/src/template/health-score/styles/styled/chart.ts +0 -26
- package/src/template.tsx +0 -5
- package/src/types/chart/axis.d.ts +0 -15
- package/src/types/chart/control.d.ts +0 -109
- package/src/types/chart/data.d.ts +0 -41
- package/src/types/chart/dot.d.ts +0 -3
- package/src/types/chart/index.d.ts +0 -7
- package/src/types/chart/legend.d.ts +0 -124
- package/src/types/chart/props.d.ts +0 -271
- package/src/types/chart/tick.d.ts +0 -30
- package/src/types/template/compare/chart.d.ts +0 -8
- package/src/types/template/filter.d.ts +0 -39
- package/src/types/template/index.d.ts +0 -2
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniai-fe/ui-legacy",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Legacy UI Toolkit for UNIAI FE Projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
13
|
-
"packageManager": "pnpm@10.
|
|
13
|
+
"packageManager": "pnpm@10.23.0",
|
|
14
14
|
"engines": {
|
|
15
|
-
"node": ">=
|
|
15
|
+
"node": ">=24",
|
|
16
16
|
"pnpm": ">=10"
|
|
17
17
|
},
|
|
18
18
|
"author": {
|
|
@@ -42,15 +42,11 @@
|
|
|
42
42
|
"./types": "./src/types/index.d.ts",
|
|
43
43
|
"./components": "./src/components.tsx",
|
|
44
44
|
"./components/styled": "./src/styled.components.tsx",
|
|
45
|
-
"./template": "./src/template.tsx",
|
|
46
|
-
"./template/styled": "./src/styled.template.tsx",
|
|
47
45
|
"./frame": "./src/frame/index.tsx",
|
|
48
46
|
"./frame/styled": "./src/frame/styled.tsx",
|
|
49
47
|
"./modal": "./src/modal/index.tsx",
|
|
50
48
|
"./icon": "./src/icon/index.tsx",
|
|
51
49
|
"./icon/styled": "./src/icon/styled.tsx",
|
|
52
|
-
"./chart": "./src/chart/index.tsx",
|
|
53
|
-
"./chart/styled": "./src/chart/styled.tsx",
|
|
54
50
|
"./table": "./src/table/index.tsx",
|
|
55
51
|
"./table/styled": "./src/table/styled.tsx",
|
|
56
52
|
"./scss": "./src/index.scss",
|
|
@@ -58,6 +54,10 @@
|
|
|
58
54
|
"./mantine_style": "./src/style-base/mantine.css"
|
|
59
55
|
},
|
|
60
56
|
"peerDependencies": {
|
|
57
|
+
"@mantine/core": ">= 8",
|
|
58
|
+
"@mantine/dates": ">= 8",
|
|
59
|
+
"@mantine/hooks": ">= 8",
|
|
60
|
+
"@mantine/tiptap": ">= 8",
|
|
61
61
|
"@tanstack/react-query": ">= 5",
|
|
62
62
|
"airtable": ">= 0.12",
|
|
63
63
|
"jotai": ">= 2",
|
|
@@ -67,41 +67,41 @@
|
|
|
67
67
|
"styled-components": ">= 6"
|
|
68
68
|
},
|
|
69
69
|
"peerDependenciesMeta": {
|
|
70
|
-
"
|
|
71
|
-
"
|
|
70
|
+
"next": {
|
|
71
|
+
"optional": true
|
|
72
72
|
}
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@dnd-kit/core": "^6.3.1",
|
|
76
76
|
"@dnd-kit/sortable": "^10.0.0",
|
|
77
77
|
"@dnd-kit/utilities": "^3.2.2",
|
|
78
|
-
"@mantine/core": "^8.3.
|
|
79
|
-
"@mantine/dates": "^8.3.
|
|
80
|
-
"@mantine/hooks": "^8.3.
|
|
81
|
-
"@mantine/tiptap": "^8.3.
|
|
82
|
-
"@tanstack/react-query": "^5.90.
|
|
83
|
-
"@tiptap/extension-blockquote": "^3.
|
|
84
|
-
"@tiptap/extension-bold": "^3.
|
|
85
|
-
"@tiptap/extension-code": "^3.
|
|
86
|
-
"@tiptap/extension-code-block": "^3.
|
|
87
|
-
"@tiptap/extension-document": "^3.
|
|
88
|
-
"@tiptap/extension-hard-break": "^3.
|
|
89
|
-
"@tiptap/extension-heading": "^3.
|
|
90
|
-
"@tiptap/extension-horizontal-rule": "^3.
|
|
91
|
-
"@tiptap/extension-italic": "^3.
|
|
92
|
-
"@tiptap/extension-link": "^3.
|
|
93
|
-
"@tiptap/extension-list": "^3.
|
|
94
|
-
"@tiptap/extension-paragraph": "^3.
|
|
95
|
-
"@tiptap/extension-placeholder": "^3.
|
|
96
|
-
"@tiptap/extension-strike": "^3.
|
|
97
|
-
"@tiptap/extension-text": "^3.
|
|
98
|
-
"@tiptap/extension-text-align": "^3.
|
|
99
|
-
"@tiptap/extension-underline": "^3.
|
|
100
|
-
"@tiptap/pm": "^3.
|
|
101
|
-
"@tiptap/react": "^3.
|
|
102
|
-
"@tiptap/starter-kit": "^3.
|
|
78
|
+
"@mantine/core": "^8.3.9",
|
|
79
|
+
"@mantine/dates": "^8.3.9",
|
|
80
|
+
"@mantine/hooks": "^8.3.9",
|
|
81
|
+
"@mantine/tiptap": "^8.3.9",
|
|
82
|
+
"@tanstack/react-query": "^5.90.10",
|
|
83
|
+
"@tiptap/extension-blockquote": "^3.11.0",
|
|
84
|
+
"@tiptap/extension-bold": "^3.11.0",
|
|
85
|
+
"@tiptap/extension-code": "^3.11.0",
|
|
86
|
+
"@tiptap/extension-code-block": "^3.11.0",
|
|
87
|
+
"@tiptap/extension-document": "^3.11.0",
|
|
88
|
+
"@tiptap/extension-hard-break": "^3.11.0",
|
|
89
|
+
"@tiptap/extension-heading": "^3.11.0",
|
|
90
|
+
"@tiptap/extension-horizontal-rule": "^3.11.0",
|
|
91
|
+
"@tiptap/extension-italic": "^3.11.0",
|
|
92
|
+
"@tiptap/extension-link": "^3.11.0",
|
|
93
|
+
"@tiptap/extension-list": "^3.11.0",
|
|
94
|
+
"@tiptap/extension-paragraph": "^3.11.0",
|
|
95
|
+
"@tiptap/extension-placeholder": "^3.11.0",
|
|
96
|
+
"@tiptap/extension-strike": "^3.11.0",
|
|
97
|
+
"@tiptap/extension-text": "^3.11.0",
|
|
98
|
+
"@tiptap/extension-text-align": "^3.11.0",
|
|
99
|
+
"@tiptap/extension-underline": "^3.11.0",
|
|
100
|
+
"@tiptap/pm": "^3.11.0",
|
|
101
|
+
"@tiptap/react": "^3.11.0",
|
|
102
|
+
"@tiptap/starter-kit": "^3.11.0",
|
|
103
103
|
"@types/node": "^24.10.1",
|
|
104
|
-
"@types/react": "^19.2.
|
|
104
|
+
"@types/react": "^19.2.7",
|
|
105
105
|
"@types/react-dom": "^19.2.3",
|
|
106
106
|
"@types/react-flatpickr": "^3.8.11",
|
|
107
107
|
"@uniai-fe/eslint-config": "workspace:*",
|
|
@@ -130,9 +130,8 @@
|
|
|
130
130
|
"react-daum-postcode": "^3.2.0",
|
|
131
131
|
"react-dom": "^19.2.0",
|
|
132
132
|
"react-flatpickr": "3.10.13",
|
|
133
|
-
"react-hook-form": "^7.66.
|
|
134
|
-
"
|
|
135
|
-
"sass": "^1.94.0",
|
|
133
|
+
"react-hook-form": "^7.66.1",
|
|
134
|
+
"sass": "^1.94.2",
|
|
136
135
|
"simplebar-core": "^1.3.2",
|
|
137
136
|
"simplebar-react": "3.3.2",
|
|
138
137
|
"styled-components": "^6.1.19",
|
package/src/button/index.tsx
CHANGED
|
@@ -12,18 +12,18 @@ import ButtonMultipleContainer from "./components/multiple/Container";
|
|
|
12
12
|
import ButtonResetSelected from "./components/base/ResetSelected";
|
|
13
13
|
|
|
14
14
|
const Button = {
|
|
15
|
-
Default: ButtonDefault,
|
|
16
|
-
Expand: ButtonExpand,
|
|
17
|
-
Link: ButtonLink,
|
|
18
|
-
Text: ButtonText,
|
|
19
|
-
Tooltip: ButtonTooltip,
|
|
20
|
-
ArrayAdd: ButtonAddArray,
|
|
21
|
-
ArrayRemove: ButtonRemoveArray,
|
|
22
|
-
SelectBox: ButtonSelectBox,
|
|
23
|
-
Refresh: ButtonRefresh,
|
|
24
|
-
Reset: ButtonReset,
|
|
25
|
-
ResetSelected: ButtonResetSelected,
|
|
26
|
-
Multiple: ButtonMultipleContainer,
|
|
15
|
+
Default: ButtonDefault as typeof ButtonDefault,
|
|
16
|
+
Expand: ButtonExpand as typeof ButtonExpand,
|
|
17
|
+
Link: ButtonLink as typeof ButtonLink,
|
|
18
|
+
Text: ButtonText as typeof ButtonText,
|
|
19
|
+
Tooltip: ButtonTooltip as typeof ButtonTooltip,
|
|
20
|
+
ArrayAdd: ButtonAddArray as typeof ButtonAddArray,
|
|
21
|
+
ArrayRemove: ButtonRemoveArray as typeof ButtonRemoveArray,
|
|
22
|
+
SelectBox: ButtonSelectBox as typeof ButtonSelectBox,
|
|
23
|
+
Refresh: ButtonRefresh as typeof ButtonRefresh,
|
|
24
|
+
Reset: ButtonReset as typeof ButtonReset,
|
|
25
|
+
ResetSelected: ButtonResetSelected as typeof ButtonResetSelected,
|
|
26
|
+
Multiple: ButtonMultipleContainer as typeof ButtonMultipleContainer,
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
export default Button;
|
package/src/components.tsx
CHANGED
|
@@ -11,7 +11,7 @@ import Icon from "./icon";
|
|
|
11
11
|
import Alternate from "./alternate";
|
|
12
12
|
import Delta from "./delta";
|
|
13
13
|
import Dot from "./dot";
|
|
14
|
-
import Chart from "./chart";
|
|
14
|
+
// import Chart from "./chart"; // recharts 버전 충돌로 분리, 그리고 recharts는 deprecated. Apache ECharts로 대체 예정
|
|
15
15
|
import Table from "./table";
|
|
16
16
|
import Form from "./form";
|
|
17
17
|
import Modal from "./modal";
|
|
@@ -32,7 +32,7 @@ export {
|
|
|
32
32
|
Alternate,
|
|
33
33
|
Delta,
|
|
34
34
|
Dot,
|
|
35
|
-
Chart,
|
|
35
|
+
// Chart,
|
|
36
36
|
Table,
|
|
37
37
|
Modal,
|
|
38
38
|
Form,
|
package/src/icon/icon.scss
CHANGED
package/src/icon/index.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import IconArrow from "./components/arrow";
|
|
2
2
|
import IconDelta from "./components/delta";
|
|
3
3
|
import IconNav from "./components/nav";
|
|
4
|
-
import IconHealthScore from "./components/health-score";
|
|
4
|
+
// import IconHealthScore from "./components/health-score";
|
|
5
5
|
import IconCage from "./components/cage";
|
|
6
6
|
import IconPageHeader from "./components/page-header";
|
|
7
7
|
import IconTooltip from "./components/tooltip";
|
|
@@ -10,13 +10,13 @@ import IconButton from "./components/button";
|
|
|
10
10
|
import IconTable from "./components/table";
|
|
11
11
|
import IconInput from "./components/input";
|
|
12
12
|
import IconTabMenu from "./components/tab-menu";
|
|
13
|
-
import IconChart from "./components/chart";
|
|
13
|
+
// import IconChart from "./components/chart";
|
|
14
14
|
|
|
15
15
|
const Icon = {
|
|
16
16
|
Arrow: IconArrow,
|
|
17
17
|
Delta: IconDelta,
|
|
18
18
|
Nav: IconNav,
|
|
19
|
-
HealthScore: IconHealthScore,
|
|
19
|
+
// HealthScore: IconHealthScore,
|
|
20
20
|
Cage: IconCage,
|
|
21
21
|
PageHeader: IconPageHeader,
|
|
22
22
|
Tooltip: IconTooltip,
|
|
@@ -25,7 +25,7 @@ const Icon = {
|
|
|
25
25
|
Table: IconTable,
|
|
26
26
|
Input: IconInput,
|
|
27
27
|
TabMenu: IconTabMenu,
|
|
28
|
-
Chart: IconChart,
|
|
28
|
+
// Chart: IconChart,
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
export default Icon;
|
package/src/icon/styled.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import StyledIconChart from "./styles/styled/chart";
|
|
1
|
+
// import StyledIconChart from "./styles/styled/chart";
|
|
2
2
|
import StyledIconCommon from "./styles/styled/common";
|
|
3
3
|
import StyledIconDelta from "./styles/styled/delta";
|
|
4
4
|
import StyledIconInput from "./styles/styled/input";
|
|
@@ -11,7 +11,7 @@ const StyledIcon = {
|
|
|
11
11
|
pageHeader: StyledIconPageHeader,
|
|
12
12
|
table: StyledIconTable,
|
|
13
13
|
input: StyledIconInput,
|
|
14
|
-
chart: StyledIconChart,
|
|
14
|
+
// chart: StyledIconChart,
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
export default StyledIcon;
|
package/src/index.scss
CHANGED
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
@use "./form-field/input/input.scss";
|
|
12
12
|
@use "./form-field/select/select.scss";
|
|
13
13
|
@use "./frame/frame.scss";
|
|
14
|
-
@use "./chart/chart.scss";
|
|
14
|
+
// @use "./chart/chart.scss";
|
|
15
15
|
@use "./table/table.scss";
|
|
16
16
|
@use "./modal/modal.scss";
|
|
17
17
|
@use "./text-editor/text-editor.scss";
|
|
18
18
|
|
|
19
19
|
// templates
|
|
20
|
-
@use "./template/compare/compare.scss";
|
|
20
|
+
// @use "./template/compare/compare.scss";
|
package/src/index.tsx
CHANGED
package/src/types/index.d.ts
CHANGED
|
@@ -6,9 +6,9 @@ export type * from "./chip";
|
|
|
6
6
|
export type * from "./icon";
|
|
7
7
|
export type * from "./delta";
|
|
8
8
|
export type * from "./modal";
|
|
9
|
-
export type * from "./chart";
|
|
9
|
+
// export type * from "./chart"; // recharts 버전 충돌로 분리, 그리고 recharts는 deprecated. Apache ECharts로 대체 예정
|
|
10
10
|
export type * from "./table";
|
|
11
11
|
export type * from "./tab-menu";
|
|
12
|
-
export type * from "./template";
|
|
12
|
+
// export type * from "./template"; // ui-legacy-template 과 관련된 타입
|
|
13
13
|
export type * from "./weather";
|
|
14
14
|
export type * from "./style-option";
|
package/src/chart/chart.scss
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
@use "./styles/scss/level.color.scss";
|
|
2
|
-
|
|
3
|
-
@use "./styles/scss/tick.scss";
|
|
4
|
-
@use "./styles/scss/graph.scss";
|
|
5
|
-
@use "./styles/scss/legend.scss";
|
|
6
|
-
@use "./styles/scss/tooltip.scss";
|
|
7
|
-
@use "./styles/scss/control.scss";
|
|
8
|
-
@use "./styles/scss/filter.scss";
|
|
9
|
-
|
|
10
|
-
@use "./styles/scss/arc-gauge.scss";
|
|
11
|
-
@use "./styles/scss/arc-meter.scss";
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import StyledChartCommon from "../styles/styled/common";
|
|
4
|
-
|
|
5
|
-
export default function ChartContents({
|
|
6
|
-
className,
|
|
7
|
-
children,
|
|
8
|
-
}: {
|
|
9
|
-
className?: string;
|
|
10
|
-
children: React.ReactNode;
|
|
11
|
-
}) {
|
|
12
|
-
return (
|
|
13
|
-
<StyledChartCommon.container className={className}>
|
|
14
|
-
{children}
|
|
15
|
-
</StyledChartCommon.container>
|
|
16
|
-
);
|
|
17
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { clsx } from "clsx";
|
|
4
|
-
import StyledChartControl from "../../styles/styled/control";
|
|
5
|
-
import Icon from "../../../icon";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* 차트 인터렉션 컨트롤 버튼
|
|
9
|
-
* @component
|
|
10
|
-
* @property {"zoom-in" | "zoom-out" | "pan-left" | "pan-right"} role - 버튼 역할
|
|
11
|
-
* @property {Function} clickEvent - 클릭 이벤트 핸들러
|
|
12
|
-
* @property {string} [className] - 추가 클래스 이름
|
|
13
|
-
* @property {React.ReactNode} [children] - 버튼 내부에 렌더링
|
|
14
|
-
*/
|
|
15
|
-
export default function ChartControlButton({
|
|
16
|
-
className,
|
|
17
|
-
role,
|
|
18
|
-
clickEvent,
|
|
19
|
-
children,
|
|
20
|
-
disabled,
|
|
21
|
-
}: {
|
|
22
|
-
role: "zoom-in" | "zoom-out" | "pan-left" | "pan-right";
|
|
23
|
-
clickEvent: () => void;
|
|
24
|
-
} & Partial<{
|
|
25
|
-
className: string;
|
|
26
|
-
children: React.ReactNode;
|
|
27
|
-
disabled: boolean;
|
|
28
|
-
}>) {
|
|
29
|
-
return (
|
|
30
|
-
<StyledChartControl.button
|
|
31
|
-
type="button"
|
|
32
|
-
className={clsx("chart-control-button", className)}
|
|
33
|
-
disabled={disabled}
|
|
34
|
-
onClick={!disabled ? clickEvent : undefined}
|
|
35
|
-
>
|
|
36
|
-
{children || <Icon.Chart.Control {...{ role, width: 20, height: 20 }} />}
|
|
37
|
-
</StyledChartControl.button>
|
|
38
|
-
);
|
|
39
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { clsx } from "clsx";
|
|
4
|
-
import StyledChartControl from "../../styles/styled/control";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* 차트 인터렉션 컨트롤 컨테이너
|
|
8
|
-
* @component
|
|
9
|
-
* @property {string} [className] - 추가 클래스 이름
|
|
10
|
-
* @property {React.ReactNode} children - 자식 컴포넌트
|
|
11
|
-
*/
|
|
12
|
-
export default function ChartControlContainer({
|
|
13
|
-
className,
|
|
14
|
-
children,
|
|
15
|
-
}: {
|
|
16
|
-
children: React.ReactNode;
|
|
17
|
-
} & Partial<{
|
|
18
|
-
className: string;
|
|
19
|
-
}>) {
|
|
20
|
-
return (
|
|
21
|
-
<StyledChartControl.container
|
|
22
|
-
className={clsx("chart-control-container", className)}
|
|
23
|
-
>
|
|
24
|
-
{children}
|
|
25
|
-
</StyledChartControl.container>
|
|
26
|
-
);
|
|
27
|
-
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
createContext,
|
|
5
|
-
useContext,
|
|
6
|
-
useLayoutEffect,
|
|
7
|
-
useRef,
|
|
8
|
-
useState,
|
|
9
|
-
} from "react";
|
|
10
|
-
import type { ChartControlContext, ChartControlRange } from "../../../types";
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* 차트 컨트롤을 위한 데이터 컨텍스트
|
|
14
|
-
* @context
|
|
15
|
-
* @desc
|
|
16
|
-
* - {object[]} originData 원본 차트 데이터
|
|
17
|
-
* - {{ start: number; end: number; }} indexRange 현재 X축 인덱스 범위
|
|
18
|
-
* - {function} setRange X축 범위 업데이트 함수
|
|
19
|
-
*/
|
|
20
|
-
const ChartControlContext = createContext<ChartControlContext>({
|
|
21
|
-
originData: [],
|
|
22
|
-
indexRange: { start: 0, end: 0 },
|
|
23
|
-
setIndexRange: () => {},
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* 차트 컨트롤을 위한 데이터 컨텍스트 공급자
|
|
28
|
-
* @component
|
|
29
|
-
* @param {object} props
|
|
30
|
-
* @param {object[]} props.originData 원본 차트 데이터
|
|
31
|
-
* @param {React.ReactNode} props.children
|
|
32
|
-
*/
|
|
33
|
-
export default function ChartControlProvider<
|
|
34
|
-
ChartData extends object = object,
|
|
35
|
-
>({
|
|
36
|
-
originData,
|
|
37
|
-
children,
|
|
38
|
-
}: {
|
|
39
|
-
/**
|
|
40
|
-
* 원본 차트 데이터
|
|
41
|
-
* @type {object[]}
|
|
42
|
-
*/
|
|
43
|
-
originData: ChartData[];
|
|
44
|
-
children: React.ReactNode;
|
|
45
|
-
}) {
|
|
46
|
-
const [indexRange, setIndexRange] = useState<ChartControlRange>({
|
|
47
|
-
start: 0,
|
|
48
|
-
end: originData.length > 1 ? originData.length - 1 : 0,
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
// 초기 데이터 로딩 시(0 -> N) 전체 범위로 동기 업데이트하여 깜빡임 방지
|
|
52
|
-
const prevLenRef = useRef<number>(originData.length);
|
|
53
|
-
useLayoutEffect(() => {
|
|
54
|
-
const prev = prevLenRef.current;
|
|
55
|
-
const next = originData.length;
|
|
56
|
-
if (prev === 0 && next > 0) {
|
|
57
|
-
setIndexRange({ start: 0, end: Math.max(0, next - 1) });
|
|
58
|
-
}
|
|
59
|
-
prevLenRef.current = next;
|
|
60
|
-
}, [originData.length]);
|
|
61
|
-
|
|
62
|
-
// 데이터 길이가 변할 때 현재 indexRange를 데이터 범위에 맞춰 정돈
|
|
63
|
-
useLayoutEffect(() => {
|
|
64
|
-
const total = originData.length;
|
|
65
|
-
if (total < 0) return;
|
|
66
|
-
const maxEnd = Math.max(0, total - 1);
|
|
67
|
-
|
|
68
|
-
// 비어있는 경우 0,0 고정
|
|
69
|
-
if (total === 0) {
|
|
70
|
-
if (indexRange.start !== 0 || indexRange.end !== 0)
|
|
71
|
-
setIndexRange({ start: 0, end: 0 });
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// 현재 윈도우 길이 보존 시도
|
|
76
|
-
const length = Math.max(1, indexRange.end - indexRange.start + 1);
|
|
77
|
-
|
|
78
|
-
// 범위를 넘어가면 오른쪽 끝에 맞춰 재정렬
|
|
79
|
-
if (indexRange.end > maxEnd || indexRange.start > maxEnd) {
|
|
80
|
-
const newEnd = maxEnd;
|
|
81
|
-
const newStart = Math.max(0, newEnd - Math.min(length, total) + 1);
|
|
82
|
-
if (newStart !== indexRange.start || newEnd !== indexRange.end)
|
|
83
|
-
setIndexRange({ start: newStart, end: newEnd });
|
|
84
|
-
}
|
|
85
|
-
}, [originData.length, indexRange.start, indexRange.end]);
|
|
86
|
-
|
|
87
|
-
return (
|
|
88
|
-
<ChartControlContext.Provider
|
|
89
|
-
value={{
|
|
90
|
-
originData,
|
|
91
|
-
indexRange,
|
|
92
|
-
setIndexRange,
|
|
93
|
-
}}
|
|
94
|
-
>
|
|
95
|
-
{children}
|
|
96
|
-
</ChartControlContext.Provider>
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* 차트 컨트롤 데이터 컨텍스트를 사용하기 위한 커스텀 훅
|
|
102
|
-
* @hook
|
|
103
|
-
* @desc
|
|
104
|
-
* - {object[]} originData 원본 차트 데이터
|
|
105
|
-
* - {{ start: number; end: number; }} indexRange 현재 X축 인덱스 범위
|
|
106
|
-
* - {function} setIndexRange X축 범위 업데이트 함수
|
|
107
|
-
* @return {ChartControlContext} { originData, indexRange, setIndexRange }
|
|
108
|
-
*/
|
|
109
|
-
export function useChartContext<
|
|
110
|
-
ChartData extends object,
|
|
111
|
-
>(): ChartControlContext<ChartData> {
|
|
112
|
-
const context = useContext(ChartControlContext);
|
|
113
|
-
if (!context) {
|
|
114
|
-
throw new Error("차트 데이터에 대한 컨텍스트를 찾을 수 없습니다.");
|
|
115
|
-
}
|
|
116
|
-
return context as ChartControlContext<ChartData>;
|
|
117
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import ChartControlButton from "./Button";
|
|
2
|
-
import ChartControlContainer from "./Container";
|
|
3
|
-
import ChartControlProvider, { useChartContext } from "./Provider";
|
|
4
|
-
|
|
5
|
-
const ChartControl = {
|
|
6
|
-
Provider: ChartControlProvider,
|
|
7
|
-
useContext: useChartContext,
|
|
8
|
-
Container: ChartControlContainer,
|
|
9
|
-
Button: ChartControlButton,
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export default ChartControl;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { Sector } from "recharts";
|
|
4
|
-
import type { Props } from "recharts/types/shape/Sector";
|
|
5
|
-
|
|
6
|
-
export default function ChartActivePieSector({
|
|
7
|
-
cx,
|
|
8
|
-
cy,
|
|
9
|
-
innerRadius,
|
|
10
|
-
outerRadius,
|
|
11
|
-
startAngle,
|
|
12
|
-
endAngle,
|
|
13
|
-
fill,
|
|
14
|
-
}: Props) {
|
|
15
|
-
return (
|
|
16
|
-
<Sector
|
|
17
|
-
cx={cx}
|
|
18
|
-
cy={cy}
|
|
19
|
-
innerRadius={innerRadius}
|
|
20
|
-
outerRadius={
|
|
21
|
-
typeof outerRadius === "number" ? outerRadius + 2 : outerRadius
|
|
22
|
-
}
|
|
23
|
-
startAngle={startAngle}
|
|
24
|
-
endAngle={endAngle}
|
|
25
|
-
fill={fill}
|
|
26
|
-
cornerRadius={0}
|
|
27
|
-
/>
|
|
28
|
-
);
|
|
29
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { useMemo } from "react";
|
|
4
|
-
import { lengthFormat } from "@uniai-fe/util-functions";
|
|
5
|
-
import StyledArcGauge from "../../styles/styled/arc-gauge";
|
|
6
|
-
import ArcGaugeTrack from "../../svg/gauge-track.min.svg";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* 차트 템플릿; 반원 게이지
|
|
10
|
-
* - 체중균일도 차트 등에 사용
|
|
11
|
-
*/
|
|
12
|
-
export default function ChartArcGauge({
|
|
13
|
-
className,
|
|
14
|
-
value,
|
|
15
|
-
unit,
|
|
16
|
-
}: {
|
|
17
|
-
className?: string;
|
|
18
|
-
value: number | "";
|
|
19
|
-
unit: string;
|
|
20
|
-
}) {
|
|
21
|
-
const v = useMemo((): string => {
|
|
22
|
-
if (typeof value !== "number") return "-";
|
|
23
|
-
return lengthFormat(value, 0);
|
|
24
|
-
}, [value]);
|
|
25
|
-
|
|
26
|
-
const level = useMemo((): number => {
|
|
27
|
-
if (typeof value !== "number") return 0;
|
|
28
|
-
|
|
29
|
-
if (value <= 25) return 1;
|
|
30
|
-
else if (25 < value && value <= 50) return 2;
|
|
31
|
-
else if (50 < value && value <= 75) return 3;
|
|
32
|
-
else if (75 < value) return 4;
|
|
33
|
-
return 0;
|
|
34
|
-
}, [value]);
|
|
35
|
-
|
|
36
|
-
const degree = useMemo((): number => {
|
|
37
|
-
if (typeof value !== "number") return 0;
|
|
38
|
-
|
|
39
|
-
if (value <= 0) return 0;
|
|
40
|
-
else if (value > 100) return 180;
|
|
41
|
-
return ((value * Math.PI) / 180) * 100;
|
|
42
|
-
}, [value]);
|
|
43
|
-
|
|
44
|
-
return (
|
|
45
|
-
<StyledArcGauge.container className={className}>
|
|
46
|
-
<StyledArcGauge.track>
|
|
47
|
-
<ArcGaugeTrack />
|
|
48
|
-
{value !== "" && (
|
|
49
|
-
<StyledArcGauge.point $level={level} $degree={degree} />
|
|
50
|
-
)}
|
|
51
|
-
</StyledArcGauge.track>
|
|
52
|
-
<StyledArcGauge.value>
|
|
53
|
-
<strong>{v}</strong>
|
|
54
|
-
<span>{unit}</span>
|
|
55
|
-
</StyledArcGauge.value>
|
|
56
|
-
</StyledArcGauge.container>
|
|
57
|
-
);
|
|
58
|
-
}
|