@weing-dev/ui-kit-primitive 0.4.6 → 0.5.1
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 +89 -46
- package/dist/{Icon-DExqF865.js → Icon-DEdvzMs-.js} +1 -1
- package/dist/{color-B71xRiyK.js → baseColor-DYa5_IOB.js} +3 -120
- package/dist/calendar.js +12 -12
- package/dist/chart.css +1 -0
- package/dist/chart.d.ts +7 -2
- package/dist/chart.js +703 -84
- package/dist/color-qJrSCDan.js +155 -0
- package/dist/components/Calendar/Calendar.d.ts +1 -55
- package/dist/components/Calendar/Calendar.type.d.ts +61 -0
- package/dist/components/Cascader/Cascader.d.ts +2 -36
- package/dist/components/Cascader/Cascader.type.d.ts +37 -0
- package/dist/components/Chart/Chart.context.d.ts +9 -0
- package/dist/components/Chart/Chart.gradient.d.ts +10 -0
- package/dist/components/Chart/Chart.hooks.d.ts +4 -0
- package/dist/components/Chart/Chart.options.d.ts +29 -0
- package/dist/components/Chart/Chart.palette.d.ts +20 -0
- package/dist/components/Chart/Chart.preset.d.ts +7 -0
- package/dist/components/Chart/Chart.register.d.ts +1 -0
- package/dist/components/Chart/Chart.style.d.ts +21 -0
- package/dist/components/Chart/Chart.theme.d.ts +9 -0
- package/dist/components/Chart/Chart.type.d.ts +161 -0
- package/dist/components/Chart/ChartFrame.d.ts +14 -0
- package/dist/components/Chart/ChartRenderer.d.ts +11 -0
- package/dist/components/Chart/charts/BarChart.d.ts +3 -0
- package/dist/components/Chart/charts/DoughnutChart.d.ts +3 -0
- package/dist/components/Chart/charts/LineChart.d.ts +3 -0
- package/dist/components/Chart/charts/PieChart.d.ts +3 -0
- package/dist/components/Chart/charts/RadarChart.d.ts +3 -0
- package/dist/components/Form/Dropdown/Dropdown.d.ts +1 -47
- package/dist/components/Form/Dropdown/Dropdown.type.d.ts +48 -0
- package/dist/components/Form/TextArea/TextArea.d.ts +1 -18
- package/dist/components/Form/TextArea/TextArea.type.d.ts +19 -0
- package/dist/components/Form/TextInput/TextInput.d.ts +1 -17
- package/dist/components/Form/TextInput/TextInput.type.d.ts +18 -0
- package/dist/components/TimeInput/TimeInput.d.ts +1 -27
- package/dist/components/TimeInput/TimeInput.type.d.ts +27 -0
- package/dist/display.js +23 -22
- package/dist/entry/chart.d.ts +7 -2
- package/dist/entry/components.d.ts +1 -2
- package/dist/feedback.js +2 -2
- package/dist/form.js +463 -462
- package/dist/icon.js +2 -2
- package/dist/index.js +3806 -3862
- package/dist/index.umd.cjs +24 -24
- package/dist/navigation.js +41 -40
- package/dist/styles/color.d.ts +30 -0
- package/dist/video-player.js +83 -83
- package/docs/subpath-imports.md +80 -0
- package/docs/ui-kit-agent-guide.md +574 -0
- package/package.json +4 -2
- package/dist/components/Chart/Chart.d.ts +0 -19
- /package/dist/components/Cascader/{Cacader.data.d.ts → Cascader.data.d.ts} +0 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { B as e, S as g, T as r } from "./baseColor-DYa5_IOB.js";
|
|
2
|
+
const y = {
|
|
3
|
+
light: {
|
|
4
|
+
textPrimary: e.grey.Grey9,
|
|
5
|
+
textSecondary: e.grey.Grey7,
|
|
6
|
+
textTertiary: e.grey.Grey6,
|
|
7
|
+
textDisabled: e.grey.Grey5,
|
|
8
|
+
backgroundDefault: e.whiteWhite,
|
|
9
|
+
backgroundPaper: e.whiteWhite,
|
|
10
|
+
backgroundSecond: r.grey8,
|
|
11
|
+
backgroundNeutral: e.grey.Grey2,
|
|
12
|
+
shadow8: r.grey8,
|
|
13
|
+
shadow12: r.grey12,
|
|
14
|
+
shadow20: r.grey20,
|
|
15
|
+
componentTextfieldFilled: r.grey8,
|
|
16
|
+
componentTextfieldUnderline: r.grey40,
|
|
17
|
+
componentTextfieldOutline: r.grey24,
|
|
18
|
+
actionHover: r.grey16,
|
|
19
|
+
actionDisabled: r.grey40,
|
|
20
|
+
actionDisabledBackground: r.grey16,
|
|
21
|
+
actionSelected: r.grey16,
|
|
22
|
+
actionFocus: r.grey48,
|
|
23
|
+
textError: e.red.Red6,
|
|
24
|
+
textSuccess: e.lightGreen.LightGreen6,
|
|
25
|
+
actionAction: e.grey.Grey6,
|
|
26
|
+
textWarning: e.gold.Gold6,
|
|
27
|
+
textContrast: e.whiteWhite,
|
|
28
|
+
inheritColor: e.whiteWhite,
|
|
29
|
+
inheritBgcolor: e.grey.Grey9,
|
|
30
|
+
inheritHover: e.grey.Grey8,
|
|
31
|
+
swapDarkLightRed: e.red.Red8,
|
|
32
|
+
swapDarkLightLightGreen: e.lightGreen.LightGreen8,
|
|
33
|
+
swapDarkLightDeepGreen: e.deepGreen.DeepGreen8,
|
|
34
|
+
swapDarkLightCyanBlue: e.cyanBlue.CyanBlue8,
|
|
35
|
+
swapDarkLightPurple: e.purple.Purple8,
|
|
36
|
+
swapDarkLightGold: e.gold.Gold8,
|
|
37
|
+
swapDarkLightBlue: e.blue.Blue8,
|
|
38
|
+
swapDarkLightPrimary: e.deepGreen.DeepGreen8,
|
|
39
|
+
// ── Chart 전역 기본 팔레트([5]) · 보조 토큰 ──
|
|
40
|
+
// 인덱스 키 객체 → buildCssVariables 가 `--chartCategorical0..7` 로 펼침
|
|
41
|
+
chartCategorical: {
|
|
42
|
+
0: e.deepGreen.DeepGreen6,
|
|
43
|
+
// 브랜드 1순위
|
|
44
|
+
1: e.blue.Blue6,
|
|
45
|
+
2: e.gold.Gold6,
|
|
46
|
+
3: e.purple.Purple6,
|
|
47
|
+
4: e.cyanBlue.CyanBlue6,
|
|
48
|
+
5: e.red.Red6,
|
|
49
|
+
6: e.lightGreen.LightGreen6,
|
|
50
|
+
7: e.grey.Grey6
|
|
51
|
+
},
|
|
52
|
+
chartGrid: r.grey24,
|
|
53
|
+
chartAxis: e.grey.Grey6,
|
|
54
|
+
chartLabel: e.grey.Grey7,
|
|
55
|
+
chartTooltipBg: e.grey.Grey9,
|
|
56
|
+
chartTooltipText: e.whiteWhite
|
|
57
|
+
},
|
|
58
|
+
dark: {
|
|
59
|
+
textPrimary: e.whiteWhite,
|
|
60
|
+
textSecondary: e.grey.Grey5,
|
|
61
|
+
textTertiary: e.grey.Grey6,
|
|
62
|
+
textDisabled: e.grey.Grey7,
|
|
63
|
+
backgroundDefault: e.grey.Grey10,
|
|
64
|
+
backgroundPaper: e.grey.Grey9,
|
|
65
|
+
backgroundSecond: e.grey.Grey8,
|
|
66
|
+
backgroundNeutral: r.grey12,
|
|
67
|
+
shadow8: r.black8,
|
|
68
|
+
shadow12: r.black12,
|
|
69
|
+
shadow20: r.black20,
|
|
70
|
+
componentTextfieldFilled: r.grey8,
|
|
71
|
+
componentTextfieldUnderline: r.grey40,
|
|
72
|
+
componentTextfieldOutline: r.grey24,
|
|
73
|
+
actionHover: r.grey16,
|
|
74
|
+
actionDisabled: r.grey40,
|
|
75
|
+
actionDisabledBackground: r.grey20,
|
|
76
|
+
actionSelected: r.grey16,
|
|
77
|
+
actionFocus: r.grey8,
|
|
78
|
+
textError: e.red.Red6,
|
|
79
|
+
textSuccess: e.lightGreen.LightGreen6,
|
|
80
|
+
actionAction: e.grey.Grey5,
|
|
81
|
+
textWarning: e.gold.Gold6,
|
|
82
|
+
textContrast: e.blackBlack,
|
|
83
|
+
inheritColor: e.grey.Grey9,
|
|
84
|
+
inheritBgcolor: e.whiteWhite,
|
|
85
|
+
inheritHover: e.grey.Grey5,
|
|
86
|
+
swapDarkLightRed: e.red.Red4,
|
|
87
|
+
swapDarkLightLightGreen: e.lightGreen.LightGreen4,
|
|
88
|
+
swapDarkLightDeepGreen: e.deepGreen.DeepGreen4,
|
|
89
|
+
swapDarkLightCyanBlue: e.cyanBlue.CyanBlue4,
|
|
90
|
+
swapDarkLightPurple: e.purple.Purple4,
|
|
91
|
+
swapDarkLightGold: e.gold.Gold4,
|
|
92
|
+
swapDarkLightBlue: e.blue.Blue4,
|
|
93
|
+
swapDarkLightPrimary: e.deepGreen.DeepGreen4,
|
|
94
|
+
// ── Chart 전역 기본 팔레트([5]) · 보조 토큰 (다크: 한 톤 밝게) ──
|
|
95
|
+
chartCategorical: {
|
|
96
|
+
0: e.deepGreen.DeepGreen4,
|
|
97
|
+
1: e.blue.Blue4,
|
|
98
|
+
2: e.gold.Gold4,
|
|
99
|
+
3: e.purple.Purple4,
|
|
100
|
+
4: e.cyanBlue.CyanBlue4,
|
|
101
|
+
5: e.red.Red4,
|
|
102
|
+
6: e.lightGreen.LightGreen4,
|
|
103
|
+
7: e.grey.Grey5
|
|
104
|
+
},
|
|
105
|
+
chartGrid: r.white16,
|
|
106
|
+
chartAxis: e.grey.Grey6,
|
|
107
|
+
chartLabel: e.grey.Grey5,
|
|
108
|
+
chartTooltipBg: e.grey.Grey2,
|
|
109
|
+
chartTooltipText: e.grey.Grey9
|
|
110
|
+
},
|
|
111
|
+
primary: {
|
|
112
|
+
pLighter: g.deepGreen.Lighter,
|
|
113
|
+
pLight: g.deepGreen.Light,
|
|
114
|
+
pMain: g.deepGreen.Main,
|
|
115
|
+
pDark: g.deepGreen.Dark,
|
|
116
|
+
pDarker: g.deepGreen.Darker,
|
|
117
|
+
p4: r.deepGreen4,
|
|
118
|
+
p8: r.deepGreen8,
|
|
119
|
+
p12: r.deepGreen12,
|
|
120
|
+
p16: r.deepGreen16,
|
|
121
|
+
p20: r.deepGreen20,
|
|
122
|
+
p24: r.deepGreen24,
|
|
123
|
+
p32: r.deepGreen32,
|
|
124
|
+
p40: r.deepGreen40,
|
|
125
|
+
p48: r.deepGreen48,
|
|
126
|
+
pContrastText: g.whiteMain
|
|
127
|
+
}
|
|
128
|
+
}, d = (t) => {
|
|
129
|
+
const a = Object.keys(t), c = (l, o) => Object.keys(l).reduce((n, p) => {
|
|
130
|
+
const i = l[p];
|
|
131
|
+
return typeof i == "object" ? n.concat(c(i, `${o}${p}`)) : n.concat(`--${o}${p}: ${i};
|
|
132
|
+
`);
|
|
133
|
+
}, "");
|
|
134
|
+
return a.reduce((l, o) => {
|
|
135
|
+
const n = t[o];
|
|
136
|
+
return typeof n == "object" ? l.concat(c(n, o)) : l.concat(`--${o.replace(/_/g, "-")}: ${n};
|
|
137
|
+
`);
|
|
138
|
+
}, "");
|
|
139
|
+
};
|
|
140
|
+
d(y.light), d(y.dark), d(y.primary), d(e), d(g), d(r);
|
|
141
|
+
const s = (t) => `var(--${t.replace(/_/g, "-")})`, h = (t, a) => `var(--${t}${a.replace(/_/g, "-")})`, G = (t, a) => `${t.replace(/_/g, "-")}, ${a})`.replace(/(\))(\\,)/, "$2").replace(/(\d.)/g, "-$1"), u = Object.keys(y.light);
|
|
142
|
+
u.reduce((t, a) => {
|
|
143
|
+
const c = y.light[a];
|
|
144
|
+
if (typeof c != "string") {
|
|
145
|
+
const l = Object.keys(c).reduce((o, n) => {
|
|
146
|
+
const p = c[n];
|
|
147
|
+
return o[n] = Array.isArray(p) ? G(h(a, n.replace(/_/g, "-").replace(/^[a-z]/, (i) => `-${i}`).replace(/([A-Z])/g, (i) => `-${i.toLocaleLowerCase()}`).replace(/(\d.)/g, "-$1")), p[1]) : h(a, n.replace(/_/g, "-").replace(/^[a-z]/, (i) => `-${i}`).replace(/([A-Z])/g, (i) => `-${i.toLocaleLowerCase()}`).replace(/(\d.)/g, "-$1")), o;
|
|
148
|
+
}, {});
|
|
149
|
+
return t[a] = l, t;
|
|
150
|
+
}
|
|
151
|
+
return t[a] = s(a), t;
|
|
152
|
+
}, {});
|
|
153
|
+
export {
|
|
154
|
+
y as c
|
|
155
|
+
};
|
|
@@ -1,64 +1,10 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { CalendarProviderProps } from './Calendar.context';
|
|
4
|
-
type AsBodyProps = {
|
|
5
|
-
columns: dayjs.Dayjs[];
|
|
6
|
-
className?: string;
|
|
7
|
-
columnRender: () => React.ReactNode;
|
|
8
|
-
};
|
|
9
|
-
type ColumnAsProps = {
|
|
10
|
-
date: string;
|
|
11
|
-
visible: boolean;
|
|
12
|
-
className?: string;
|
|
13
|
-
selected: boolean;
|
|
14
|
-
onClick?: (date: string | string[]) => void;
|
|
15
|
-
disabled: boolean;
|
|
16
|
-
between: boolean;
|
|
17
|
-
both: boolean;
|
|
18
|
-
start: boolean;
|
|
19
|
-
end: boolean;
|
|
20
|
-
columns: dayjs.Dayjs[];
|
|
21
|
-
};
|
|
22
|
-
type CalendarBodyProps = {
|
|
23
|
-
as?: (props: AsBodyProps) => React.ReactNode;
|
|
24
|
-
className?: string;
|
|
25
|
-
/** 이전, 다음달 채울지 여부 */
|
|
26
|
-
isFill?: boolean;
|
|
27
|
-
/** column className */
|
|
28
|
-
columnClassName?: string;
|
|
29
|
-
columnAs?: (props: ColumnAsProps) => React.ReactNode;
|
|
30
|
-
};
|
|
2
|
+
import { CalendarBodyProps, DirectionButtonProps, DayTextListProps, HeaderDateProps, RootProps } from './Calendar.type';
|
|
31
3
|
declare const Body: (props: CalendarBodyProps) => string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined;
|
|
32
|
-
type AsDirectionProps = {
|
|
33
|
-
disabled?: boolean;
|
|
34
|
-
};
|
|
35
|
-
type DirectionButtonProps = {
|
|
36
|
-
as?: (props: AsDirectionProps) => React.ReactNode;
|
|
37
|
-
className?: string;
|
|
38
|
-
disabled?: boolean;
|
|
39
|
-
moveValue?: number;
|
|
40
|
-
};
|
|
41
4
|
declare const Next: (props: DirectionButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
42
5
|
declare const Prev: (props: DirectionButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
43
|
-
type AsDayTextProps = {
|
|
44
|
-
columns: (string | undefined)[];
|
|
45
|
-
};
|
|
46
|
-
type DayTextListProps = React.PropsWithChildren<{
|
|
47
|
-
as?: (props: AsDayTextProps) => React.ReactNode;
|
|
48
|
-
/** dayColumn */
|
|
49
|
-
column?: React.ReactElement;
|
|
50
|
-
className?: string;
|
|
51
|
-
}>;
|
|
52
6
|
declare const DayTextList: (props: DayTextListProps) => string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined;
|
|
53
|
-
type HeaderDateProps = {
|
|
54
|
-
className?: string;
|
|
55
|
-
format?: string;
|
|
56
|
-
};
|
|
57
7
|
declare const HeaderDate: (props: HeaderDateProps) => import("react/jsx-runtime").JSX.Element;
|
|
58
|
-
type RootProps = CalendarProviderProps & {
|
|
59
|
-
currentDate?: string;
|
|
60
|
-
className?: string;
|
|
61
|
-
};
|
|
62
8
|
declare const Root: (props: RootProps) => import("react/jsx-runtime").JSX.Element;
|
|
63
9
|
interface ICalendar {
|
|
64
10
|
Root: typeof Root;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { default as dayjs } from 'dayjs';
|
|
3
|
+
import { CalendarProviderProps } from './Calendar.context';
|
|
4
|
+
export type AsBodyProps = {
|
|
5
|
+
columns: dayjs.Dayjs[];
|
|
6
|
+
className?: string;
|
|
7
|
+
columnRender: () => React.ReactNode;
|
|
8
|
+
};
|
|
9
|
+
export type ColumnAsProps = {
|
|
10
|
+
date: string;
|
|
11
|
+
visible: boolean;
|
|
12
|
+
className?: string;
|
|
13
|
+
selected: boolean;
|
|
14
|
+
onClick?: (date: string | string[]) => void;
|
|
15
|
+
disabled: boolean;
|
|
16
|
+
between: boolean;
|
|
17
|
+
both: boolean;
|
|
18
|
+
start: boolean;
|
|
19
|
+
end: boolean;
|
|
20
|
+
columns: dayjs.Dayjs[];
|
|
21
|
+
};
|
|
22
|
+
export type CalendarBodyProps = {
|
|
23
|
+
as?: (props: AsBodyProps) => React.ReactNode;
|
|
24
|
+
className?: string;
|
|
25
|
+
/** 이전, 다음달 채울지 여부 */
|
|
26
|
+
isFill?: boolean;
|
|
27
|
+
/** column className */
|
|
28
|
+
columnClassName?: string;
|
|
29
|
+
columnAs?: (props: ColumnAsProps) => React.ReactNode;
|
|
30
|
+
};
|
|
31
|
+
export type AsDirectionProps = {
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
};
|
|
34
|
+
export type DirectionButtonProps = {
|
|
35
|
+
as?: (props: AsDirectionProps) => React.ReactNode;
|
|
36
|
+
className?: string;
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
moveValue?: number;
|
|
39
|
+
};
|
|
40
|
+
export type AsDayTextProps = {
|
|
41
|
+
columns: (string | undefined)[];
|
|
42
|
+
};
|
|
43
|
+
export type DayTextListProps = React.PropsWithChildren<{
|
|
44
|
+
as?: (props: AsDayTextProps) => React.ReactNode;
|
|
45
|
+
/** dayColumn */
|
|
46
|
+
column?: React.ReactElement;
|
|
47
|
+
className?: string;
|
|
48
|
+
}>;
|
|
49
|
+
export type DayTextProps = React.PropsWithChildren<{
|
|
50
|
+
day?: number;
|
|
51
|
+
children?: React.ReactNode;
|
|
52
|
+
className?: string;
|
|
53
|
+
}>;
|
|
54
|
+
export type HeaderDateProps = {
|
|
55
|
+
className?: string;
|
|
56
|
+
format?: string;
|
|
57
|
+
};
|
|
58
|
+
export type RootProps = CalendarProviderProps & {
|
|
59
|
+
currentDate?: string;
|
|
60
|
+
className?: string;
|
|
61
|
+
};
|
|
@@ -1,44 +1,10 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { CascaderOption, OnSelectProps } from './Cascader.context';
|
|
3
|
+
import { ItemProps, ColumnProps, MenuProps, RootProps } from './Cascader.type';
|
|
3
4
|
import { useCascader } from './Cascader.hook';
|
|
4
|
-
type ItemAsProps = {
|
|
5
|
-
ref: React.RefObject<HTMLDivElement | null>;
|
|
6
|
-
option: CascaderOption;
|
|
7
|
-
level: number;
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
role?: CascaderOption["role"];
|
|
10
|
-
isSelected?: boolean;
|
|
11
|
-
showChildrenCount?: boolean;
|
|
12
|
-
defaultClassName: string;
|
|
13
|
-
onClick: () => void;
|
|
14
|
-
};
|
|
15
|
-
type ItemProps = React.PropsWithChildren<{
|
|
16
|
-
option: CascaderOption;
|
|
17
|
-
level: number;
|
|
18
|
-
as?: (props: ItemAsProps) => React.ReactNode;
|
|
19
|
-
} & React.ComponentProps<"div">>;
|
|
20
5
|
declare const Item: (props: ItemProps) => string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined;
|
|
21
|
-
type ColumnAsProps = {
|
|
22
|
-
defaultClassName: string;
|
|
23
|
-
maxColumnView?: number;
|
|
24
|
-
columnPositionFromParent?: boolean;
|
|
25
|
-
selectedOptionTop?: number[];
|
|
26
|
-
index?: number;
|
|
27
|
-
topOffset?: number;
|
|
28
|
-
};
|
|
29
|
-
type ColumnProps = React.PropsWithChildren<{
|
|
30
|
-
index: number;
|
|
31
|
-
as?: (props: ColumnAsProps) => React.ReactNode;
|
|
32
|
-
} & React.ComponentProps<"div">>;
|
|
33
6
|
declare const Column: (props: React.PropsWithoutRef<ColumnProps>) => string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined;
|
|
34
|
-
type MenuAsProps = {
|
|
35
|
-
defaultClassName: string;
|
|
36
|
-
};
|
|
37
|
-
type MenuProps = React.PropsWithChildren<{
|
|
38
|
-
as?: (props: MenuAsProps) => React.ReactNode;
|
|
39
|
-
} & React.ComponentProps<"div">>;
|
|
40
7
|
declare const Menu: (props: React.PropsWithoutRef<MenuProps>) => string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined;
|
|
41
|
-
type RootProps = Omit<CascaderProviderProps, "selectedOptionTop" | "setSelectedOptionTop"> & Omit<React.ComponentProps<"div">, "onSelect">;
|
|
42
8
|
declare const Root: (props: React.PropsWithoutRef<RootProps>) => import("react/jsx-runtime").JSX.Element;
|
|
43
9
|
interface ICascader {
|
|
44
10
|
Root: typeof Root;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { CascaderOption, CascaderProviderProps } from './Cascader.context';
|
|
3
|
+
export type ItemAsProps = {
|
|
4
|
+
ref: React.RefObject<HTMLDivElement | null>;
|
|
5
|
+
option: CascaderOption;
|
|
6
|
+
level: number;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
role?: CascaderOption["role"];
|
|
9
|
+
isSelected?: boolean;
|
|
10
|
+
showChildrenCount?: boolean;
|
|
11
|
+
defaultClassName: string;
|
|
12
|
+
onClick: () => void;
|
|
13
|
+
};
|
|
14
|
+
export type ItemProps = React.PropsWithChildren<{
|
|
15
|
+
option: CascaderOption;
|
|
16
|
+
level: number;
|
|
17
|
+
as?: (props: ItemAsProps) => React.ReactNode;
|
|
18
|
+
} & React.ComponentProps<"div">>;
|
|
19
|
+
export type ColumnAsProps = {
|
|
20
|
+
defaultClassName: string;
|
|
21
|
+
maxColumnView?: number;
|
|
22
|
+
columnPositionFromParent?: boolean;
|
|
23
|
+
selectedOptionTop?: number[];
|
|
24
|
+
index?: number;
|
|
25
|
+
topOffset?: number;
|
|
26
|
+
};
|
|
27
|
+
export type ColumnProps = React.PropsWithChildren<{
|
|
28
|
+
index: number;
|
|
29
|
+
as?: (props: ColumnAsProps) => React.ReactNode;
|
|
30
|
+
} & React.ComponentProps<"div">>;
|
|
31
|
+
export type MenuAsProps = {
|
|
32
|
+
defaultClassName: string;
|
|
33
|
+
};
|
|
34
|
+
export type MenuProps = React.PropsWithChildren<{
|
|
35
|
+
as?: (props: MenuAsProps) => React.ReactNode;
|
|
36
|
+
} & React.ComponentProps<"div">>;
|
|
37
|
+
export type RootProps = Omit<CascaderProviderProps, "selectedOptionTop" | "setSelectedOptionTop"> & Omit<React.ComponentProps<"div">, "onSelect">;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ChartThemeValue } from './Chart.type';
|
|
3
|
+
/**
|
|
4
|
+
* [3] 앱/화면 단위 테마 Context. 감싸지 않으면 undefined → 위층(토큰)이 그대로 흐른다.
|
|
5
|
+
* Provider 컴포넌트는 Chart.theme.tsx 에 분리(컨벤션: context 파일은 비컴포넌트만).
|
|
6
|
+
*/
|
|
7
|
+
export declare const ChartThemeContext: React.Context<ChartThemeValue | undefined>;
|
|
8
|
+
/** React 19: Context 소비는 React.use 로 통일 */
|
|
9
|
+
export declare const useChartTheme: () => ChartThemeValue | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Color, Scriptable, ScriptableContext } from 'chart.js';
|
|
2
|
+
/**
|
|
3
|
+
* canvas gradient 는 chartArea(레이아웃 결과)가 있어야 만들 수 있어 정적 색으로 못 박는다.
|
|
4
|
+
* chart.js 의 scriptable backgroundColor(렌더 시 ctx 주입)로 lazy 생성한다 —
|
|
5
|
+
* 순수함수 빌더 안에서도 함수만 반환하면 되고 plugin/useEffect 가 불필요하다.
|
|
6
|
+
*
|
|
7
|
+
* 색 토큰을 canvas 가 직접 못 읽는 것과 같은 제약을 같은 패턴(런타임 해석)으로 푼다.
|
|
8
|
+
*/
|
|
9
|
+
/** 세로 방향 그라데이션(상단 from → 하단 to). chartArea 미정(레이아웃 전)이면 from 단색으로 폴백. */
|
|
10
|
+
export declare const verticalGradient: (from: string, to: string) => Scriptable<Color, ScriptableContext<"line">>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ChartData, ChartOptions } from 'chart.js';
|
|
2
|
+
import { AxisConfig, CategoricalData, ChartBaseProps, ChartKind, PointStyle, ProportionData } from './Chart.type';
|
|
3
|
+
import { ChartAxisTokens } from './Chart.palette';
|
|
4
|
+
import { StyleSources } from './Chart.style';
|
|
5
|
+
export declare const deepMerge: <T>(base: T, over?: Partial<T>) => T;
|
|
6
|
+
/** 카테고리형(bar/line) → chart.js ChartData */
|
|
7
|
+
export declare const buildCategoricalData: (data: CategoricalData, sources: StyleSources, opts?: {
|
|
8
|
+
area?: boolean;
|
|
9
|
+
tension?: number;
|
|
10
|
+
pointStyle?: PointStyle;
|
|
11
|
+
lineWidth?: number;
|
|
12
|
+
}) => ChartData;
|
|
13
|
+
/** 비중형(pie/doughnut) → chart.js ChartData */
|
|
14
|
+
export declare const buildProportionData: (data: ProportionData, sources: StyleSources) => ChartData;
|
|
15
|
+
type BuildOptionArgs = {
|
|
16
|
+
kind: ChartKind;
|
|
17
|
+
base: Pick<ChartBaseProps, "title" | "legend" | "height" | "aspectRatio" | "padding" | "valueLabel" | "options" | "rawOptions">;
|
|
18
|
+
tokens: ChartAxisTokens;
|
|
19
|
+
/** 종류별 추가 옵션 (indexAxis, cutout, scales stacked 등). 차트별 전용 키 허용 위해 느슨한 타입 */
|
|
20
|
+
extra?: Record<string, unknown>;
|
|
21
|
+
/** 직교좌표 y축 설정 (max/min/단위 포맷). y1 정의 시 우측 보조축(듀얼축) 생성 */
|
|
22
|
+
axes?: {
|
|
23
|
+
y?: AxisConfig;
|
|
24
|
+
y1?: AxisConfig;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
/** 프리셋 → L2(options deep-merge) → L3(rawOptions 통째 대체) */
|
|
28
|
+
export declare const buildOptions: ({ kind, base, tokens, extra, axes }: BuildOptionArgs) => ChartOptions;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { PaletteInput } from './Chart.type';
|
|
2
|
+
/** 단일 색 토큰 문자열 해석: hex/rgb/hsl/var 는 그대로, 팔레트키는 매핑 */
|
|
3
|
+
export declare const resolveColor: (c: string) => string;
|
|
4
|
+
/** 전역 카테고리컬 팔레트(hex 8색)를 토큰에서 해석 — cascade [5] */
|
|
5
|
+
export declare const useChartPalette: () => string[];
|
|
6
|
+
export type ChartAxisTokens = {
|
|
7
|
+
grid: string;
|
|
8
|
+
axis: string;
|
|
9
|
+
label: string;
|
|
10
|
+
tooltipBg: string;
|
|
11
|
+
tooltipText: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const useChartTokens: () => ChartAxisTokens;
|
|
14
|
+
/**
|
|
15
|
+
* PaletteInput 을 hex 색 배열로 정규화.
|
|
16
|
+
* - "categorical" → 토큰 팔레트
|
|
17
|
+
* - "sequential"/"diverging" → 1차엔 categorical fallback (전용 팔레트는 실수요 시)
|
|
18
|
+
* - string[] → 각 요소를 resolveColor (hex/팔레트키 혼용)
|
|
19
|
+
*/
|
|
20
|
+
export declare const normalizePalette: (input: PaletteInput | undefined, categorical: string[]) => string[] | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ensureChartRegistered: () => void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ChartKind, ChartStyleDefaults, ChartThemeValue, PaletteInput } from './Chart.type';
|
|
2
|
+
/**
|
|
3
|
+
* 스타일 cascade 5층 해석기.
|
|
4
|
+
* [1] datum.color / [2] series.color … 항목·시리즈 단위 색은 옵션 빌더에서 최우선 적용.
|
|
5
|
+
* 본 모듈은 인스턴스/테마/프리셋/토큰 층([2]props·[3]·[4]·[5])을 `??` 로 병합한다.
|
|
6
|
+
* 빈 층(undefined)은 자연 통과 → 런타임 비용 0. [3][4] 는 1차엔 빈 통로(no-op).
|
|
7
|
+
*/
|
|
8
|
+
export type InstanceStyle = ChartStyleDefaults & {
|
|
9
|
+
colors?: PaletteInput;
|
|
10
|
+
};
|
|
11
|
+
export type StyleSources = {
|
|
12
|
+
kind: ChartKind;
|
|
13
|
+
instance?: InstanceStyle;
|
|
14
|
+
theme?: ChartThemeValue;
|
|
15
|
+
preset?: ChartStyleDefaults;
|
|
16
|
+
tokenPalette: string[];
|
|
17
|
+
};
|
|
18
|
+
/** 스칼라 스타일(barRadius·tension·cutout·legend…) cascade. 최종 fallback 은 빌더가 `?? 기본값` 으로 처리 */
|
|
19
|
+
export declare const resolveStyle: <K extends keyof ChartStyleDefaults>(key: K, s: StyleSources) => ChartStyleDefaults[K] | undefined;
|
|
20
|
+
/** 시리즈 index i 의 최종 색 cascade ([2]colors > [3] > [4] > [5]token) */
|
|
21
|
+
export declare const resolveSeriesColor: (i: number, s: StyleSources) => string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ChartThemeValue } from './Chart.type';
|
|
3
|
+
/**
|
|
4
|
+
* [3] 앱/화면 단위 테마 통로. Provider 만 제공하고 기본값은 비워 둔다(no-op).
|
|
5
|
+
* <ChartThemeProvider value={{ palette, defaults, presets }}> 로 하위 차트에 정책 주입.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ChartThemeProvider: ({ value, children, }: React.PropsWithChildren<{
|
|
8
|
+
value: ChartThemeValue;
|
|
9
|
+
}>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { ChartOptions, Plugin } from 'chart.js';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
/** 단일 시리즈 간편 입력: bar/pie/doughnut 한 줄짜리 */
|
|
4
|
+
export type SimpleDatum = {
|
|
5
|
+
label: string;
|
|
6
|
+
value: number;
|
|
7
|
+
/** 이 항목만 색 강제 (팔레트 키 또는 CSS 색) — cascade [1] */
|
|
8
|
+
color?: string;
|
|
9
|
+
};
|
|
10
|
+
/** 다중 시리즈 한 줄 */
|
|
11
|
+
export type ChartSeries = {
|
|
12
|
+
name: string;
|
|
13
|
+
/** null = 데이터 없는 구간(선 끊김). spanGaps 로 이을지 제어 */
|
|
14
|
+
values: (number | null)[];
|
|
15
|
+
/** 이 시리즈만 색 강제 — cascade [2] */
|
|
16
|
+
color?: string;
|
|
17
|
+
/** 이 시리즈가 참조할 y축 id. 보조축 연결 시 "y1" (듀얼축) */
|
|
18
|
+
yAxisID?: string;
|
|
19
|
+
/** 점선 패턴 (예: [4,4]). line 전용 */
|
|
20
|
+
borderDash?: number[];
|
|
21
|
+
/** null 값 구간을 선으로 이을지 여부 (기본 chart.js 기본값=false 동작) */
|
|
22
|
+
spanGaps?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* 면적 gradient 채우기 (line 전용). true=시리즈 색 기반 자동 alpha,
|
|
25
|
+
* {from,to}=명시 색. 켜면 fill 자동 활성.
|
|
26
|
+
*/
|
|
27
|
+
gradient?: boolean | {
|
|
28
|
+
from?: string;
|
|
29
|
+
to?: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
/** 다중 시리즈 입력 */
|
|
33
|
+
export type SeriesData = {
|
|
34
|
+
labels: string[];
|
|
35
|
+
series: ChartSeries[];
|
|
36
|
+
};
|
|
37
|
+
/** 카테고리형(bar/line): 간편형 or 시리즈형 둘 다 허용 */
|
|
38
|
+
export type CategoricalData = SimpleDatum[] | SeriesData;
|
|
39
|
+
/** 비중형(pie/doughnut): 항상 단일 시리즈 */
|
|
40
|
+
export type ProportionData = SimpleDatum[];
|
|
41
|
+
/** 토큰 팔레트 이름 또는 임의 색/팔레트키 배열 */
|
|
42
|
+
export type PaletteInput = "categorical" | "sequential" | "diverging" | string[];
|
|
43
|
+
/** 차트 종류별/테마 단위로 상속시킬 수 있는 스타일 기본값 묶음 */
|
|
44
|
+
export type ChartStyleDefaults = {
|
|
45
|
+
palette?: PaletteInput;
|
|
46
|
+
legend?: LegendOption;
|
|
47
|
+
aspectRatio?: number;
|
|
48
|
+
barRadius?: number;
|
|
49
|
+
tension?: number;
|
|
50
|
+
cutout?: number;
|
|
51
|
+
showTotal?: boolean;
|
|
52
|
+
pointStyle?: PointStyle;
|
|
53
|
+
};
|
|
54
|
+
/** [4] 차트 종류별 기본 정책. 1차엔 최소값만 채우고 나머지는 빈 통로(no-op) */
|
|
55
|
+
export type ChartPreset = Partial<Record<ChartKind, ChartStyleDefaults>>;
|
|
56
|
+
/** [3] 앱/화면 단위 테마. <ChartThemeProvider value={...}> 로 주입 */
|
|
57
|
+
export type ChartThemeValue = {
|
|
58
|
+
palette?: PaletteInput;
|
|
59
|
+
defaults?: ChartStyleDefaults;
|
|
60
|
+
presets?: ChartPreset;
|
|
61
|
+
};
|
|
62
|
+
export type ChartKind = "bar" | "line" | "pie" | "doughnut" | "radar";
|
|
63
|
+
export type LegendOption = boolean | "top" | "bottom" | "left" | "right";
|
|
64
|
+
export type PointStyle = "circle" | "rect" | "triangle" | false;
|
|
65
|
+
/** 직교좌표(bar/line) 축 설정. 듀얼축·단위 포맷 노출 */
|
|
66
|
+
export type AxisConfig = {
|
|
67
|
+
max?: number;
|
|
68
|
+
min?: number;
|
|
69
|
+
/** 눈금 단위 포맷터 (예: (v) => `${v}건`) → ticks.callback */
|
|
70
|
+
tickFormat?: (value: number) => string;
|
|
71
|
+
/** 축 제목 */
|
|
72
|
+
title?: string;
|
|
73
|
+
};
|
|
74
|
+
export type ChartBaseProps = {
|
|
75
|
+
title?: string;
|
|
76
|
+
/** true=top, false=숨김, 또는 위치 지정 */
|
|
77
|
+
legend?: LegendOption;
|
|
78
|
+
/** px. 미지정 시 aspectRatio 사용 (vw/vh 강제 금지) */
|
|
79
|
+
height?: number;
|
|
80
|
+
aspectRatio?: number;
|
|
81
|
+
/** 차트 영역 여백(px). 라벨 잘림 조정 등에 사용. 미지정 시 valueLabel일 때만 기본 여백 적용 */
|
|
82
|
+
padding?: number | {
|
|
83
|
+
top?: number;
|
|
84
|
+
right?: number;
|
|
85
|
+
bottom?: number;
|
|
86
|
+
left?: number;
|
|
87
|
+
};
|
|
88
|
+
loading?: boolean;
|
|
89
|
+
/** 데이터 0건일 때 노출 (기본 문구 내장) */
|
|
90
|
+
empty?: React.ReactNode;
|
|
91
|
+
/** 값 라벨 표시(막대 위/조각 안). true=값 그대로, 함수=포맷터. 켤 때만 datalabels 플러그인 주입 */
|
|
92
|
+
valueLabel?: boolean | ((value: number) => string);
|
|
93
|
+
className?: string;
|
|
94
|
+
/** L1: 시리즈 색 일괄 지정 — cascade [2] */
|
|
95
|
+
colors?: PaletteInput;
|
|
96
|
+
/** L2: 프리셋 위에 deep-merge */
|
|
97
|
+
options?: ChartOptions;
|
|
98
|
+
/** L3: 프리셋 무시하고 raw 통째 대체 */
|
|
99
|
+
rawOptions?: ChartOptions;
|
|
100
|
+
/**
|
|
101
|
+
* 커스텀 chart.js 플러그인 (인스턴스 한정 주입). afterDraw/beforeDatasetsDraw 등으로
|
|
102
|
+
* 캔버스에 직접 드로잉. 플러그인 옵션은 L2 `options.plugins.<id>` 로 전달.
|
|
103
|
+
*/
|
|
104
|
+
plugins?: Plugin[];
|
|
105
|
+
};
|
|
106
|
+
export type BarChartProps = ChartBaseProps & {
|
|
107
|
+
data: CategoricalData;
|
|
108
|
+
orientation?: "vertical" | "horizontal";
|
|
109
|
+
stacked?: boolean;
|
|
110
|
+
/** L0 승격 스타일: 막대 모서리 둥글기 */
|
|
111
|
+
barRadius?: number;
|
|
112
|
+
barThickness?: number;
|
|
113
|
+
/** 주 y축 설정 (max/min/단위 포맷) */
|
|
114
|
+
yAxis?: AxisConfig;
|
|
115
|
+
/** 보조 y축 (우측). 정의 시 생성 — 시리즈 `yAxisID:"y1"` 로 연결 (듀얼축) */
|
|
116
|
+
y1Axis?: AxisConfig;
|
|
117
|
+
};
|
|
118
|
+
export type LineChartProps = ChartBaseProps & {
|
|
119
|
+
data: CategoricalData;
|
|
120
|
+
/** 면적 채우기 */
|
|
121
|
+
area?: boolean;
|
|
122
|
+
/** 곡선 보간 강도 0~1 (기본 0.4) */
|
|
123
|
+
tension?: number;
|
|
124
|
+
/** L0 승격 스타일 */
|
|
125
|
+
pointStyle?: PointStyle;
|
|
126
|
+
lineWidth?: number;
|
|
127
|
+
/** 주 y축 설정 (max/min/단위 포맷) */
|
|
128
|
+
yAxis?: AxisConfig;
|
|
129
|
+
/** 보조 y축 (우측). 정의 시 생성 — 시리즈 `yAxisID:"y1"` 로 연결 (듀얼축) */
|
|
130
|
+
y1Axis?: AxisConfig;
|
|
131
|
+
};
|
|
132
|
+
export type PieChartProps = ChartBaseProps & {
|
|
133
|
+
data: ProportionData;
|
|
134
|
+
};
|
|
135
|
+
export type DoughnutChartProps = ChartBaseProps & {
|
|
136
|
+
data: ProportionData;
|
|
137
|
+
/** 중앙 합계 라벨 */
|
|
138
|
+
showTotal?: boolean;
|
|
139
|
+
/** 0~1, 도넛 구멍 크기 (기본 0.6) */
|
|
140
|
+
cutout?: number;
|
|
141
|
+
};
|
|
142
|
+
export type RadarChartProps = ChartBaseProps & {
|
|
143
|
+
/** 단일 시리즈(labels+values) 또는 다중 시리즈 모두 허용 */
|
|
144
|
+
data: CategoricalData;
|
|
145
|
+
/** 방사축 최댓값 (suggestedMax). 미지정 시 자동 */
|
|
146
|
+
max?: number;
|
|
147
|
+
/** 다각형 면적 채우기 (기본 true) */
|
|
148
|
+
fill?: boolean;
|
|
149
|
+
};
|
|
150
|
+
/** ChartRenderer가 받는 통합 타입. type으로 좁히면 data가 자동 결정 → `as` 캐스팅 제거 */
|
|
151
|
+
export type AnyChartProps = ({
|
|
152
|
+
type: "bar";
|
|
153
|
+
} & BarChartProps) | ({
|
|
154
|
+
type: "line";
|
|
155
|
+
} & LineChartProps) | ({
|
|
156
|
+
type: "pie";
|
|
157
|
+
} & PieChartProps) | ({
|
|
158
|
+
type: "doughnut";
|
|
159
|
+
} & DoughnutChartProps) | ({
|
|
160
|
+
type: "radar";
|
|
161
|
+
} & RadarChartProps);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
type Props = React.PropsWithChildren<{
|
|
3
|
+
height?: number;
|
|
4
|
+
loading?: boolean;
|
|
5
|
+
empty?: React.ReactNode;
|
|
6
|
+
isEmpty?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
}>;
|
|
9
|
+
/**
|
|
10
|
+
* 차트 공통 컨테이너. 부모 레이아웃을 따르며(vw/vh 강제 금지) height 로만 높이를 제어.
|
|
11
|
+
* loading/empty 상태를 라이브러리 밖 표준 UI 로 흡수.
|
|
12
|
+
*/
|
|
13
|
+
export declare const ChartFrame: ({ height, loading, empty, isEmpty, className, children, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|