@weing-dev/ui-kit-primitive 0.5.0 → 0.5.2
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 +86 -49
- package/dist/calendar.js +1383 -3790
- package/dist/chart.d.ts +2 -1
- package/dist/chart.js +614 -442
- package/dist/components/Button/Button.d.ts +2 -0
- package/dist/components/Chart/Chart.gradient.d.ts +10 -0
- package/dist/components/Chart/Chart.options.d.ts +7 -2
- package/dist/components/Chart/Chart.type.d.ts +51 -4
- package/dist/components/Chart/charts/RadarChart.d.ts +3 -0
- package/dist/components/FloatingAnchor/FloatingAnchor.context.d.ts +5 -0
- package/dist/components/FloatingAnchor/FloatingAnchor.d.ts +14 -0
- package/dist/components/FloatingAnchor/FloatingAnchor.type.d.ts +41 -0
- package/dist/components/FloatingAnchor/FloatingAnchor.util.d.ts +43 -0
- package/dist/components/Form/Dropdown/Dropdown.type.d.ts +2 -0
- package/dist/components/KanbanBoard/KanbanBoard.d.ts +4 -0
- package/dist/components/KanbanBoard/KanbanBoard.type.d.ts +36 -0
- package/dist/components/Pagination/Pagination.d.ts +4 -1
- package/dist/components/Timeline/Timeline.colors.d.ts +6 -0
- package/dist/components/Timeline/Timeline.d.ts +4 -0
- package/dist/components/Timeline/Timeline.type.d.ts +16 -0
- package/dist/core.esm-CuBlrIcC.js +2859 -0
- package/dist/display.css +1 -1
- package/dist/display.d.ts +4 -0
- package/dist/display.js +2932 -2123
- package/dist/entry/chart.d.ts +2 -1
- package/dist/entry/display.d.ts +4 -0
- package/dist/entry/feedback.d.ts +2 -0
- package/dist/feedback.css +1 -1
- package/dist/feedback.d.ts +2 -0
- package/dist/feedback.js +595 -312
- package/dist/form.css +1 -1
- package/dist/form.js +1740 -1742
- package/dist/index.css +1 -1
- package/dist/index.js +3521 -3522
- package/dist/index.umd.cjs +21 -21
- package/dist/navigation.css +1 -1
- package/dist/navigation.js +297 -296
- package/docs/ui-kit-agent-guide.md +616 -0
- package/package.json +3 -2
|
@@ -14,6 +14,8 @@ declare const Root: (props: ButtonProviderProps & {
|
|
|
14
14
|
radius?: number;
|
|
15
15
|
rounded?: boolean;
|
|
16
16
|
circle?: boolean;
|
|
17
|
+
/** Button.Text/Button.Icon 색을 함께 덮어쓴다. 지정 시 colorType/variant 기본색 대신 적용 */
|
|
18
|
+
textColor?: string;
|
|
17
19
|
} & React.JSX.IntrinsicElements["button"]) => import("react/jsx-runtime").JSX.Element;
|
|
18
20
|
interface IButton {
|
|
19
21
|
Text: typeof Text;
|
|
@@ -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">>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChartData, ChartOptions } from 'chart.js';
|
|
2
|
-
import { CategoricalData, ChartBaseProps, ChartKind, PointStyle, ProportionData } from './Chart.type';
|
|
2
|
+
import { AxisConfig, CategoricalData, ChartBaseProps, ChartKind, PointStyle, ProportionData } from './Chart.type';
|
|
3
3
|
import { ChartAxisTokens } from './Chart.palette';
|
|
4
4
|
import { StyleSources } from './Chart.style';
|
|
5
5
|
export declare const deepMerge: <T>(base: T, over?: Partial<T>) => T;
|
|
@@ -18,7 +18,12 @@ type BuildOptionArgs = {
|
|
|
18
18
|
tokens: ChartAxisTokens;
|
|
19
19
|
/** 종류별 추가 옵션 (indexAxis, cutout, scales stacked 등). 차트별 전용 키 허용 위해 느슨한 타입 */
|
|
20
20
|
extra?: Record<string, unknown>;
|
|
21
|
+
/** 직교좌표 y축 설정 (max/min/단위 포맷). y1 정의 시 우측 보조축(듀얼축) 생성 */
|
|
22
|
+
axes?: {
|
|
23
|
+
y?: AxisConfig;
|
|
24
|
+
y1?: AxisConfig;
|
|
25
|
+
};
|
|
21
26
|
};
|
|
22
27
|
/** 프리셋 → L2(options deep-merge) → L3(rawOptions 통째 대체) */
|
|
23
|
-
export declare const buildOptions: ({ kind, base, tokens, extra }: BuildOptionArgs) => ChartOptions;
|
|
28
|
+
export declare const buildOptions: ({ kind, base, tokens, extra, axes }: BuildOptionArgs) => ChartOptions;
|
|
24
29
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChartOptions } from 'chart.js';
|
|
1
|
+
import { ChartOptions, Plugin } from 'chart.js';
|
|
2
2
|
import { default as React } from 'react';
|
|
3
3
|
/** 단일 시리즈 간편 입력: bar/pie/doughnut 한 줄짜리 */
|
|
4
4
|
export type SimpleDatum = {
|
|
@@ -10,9 +10,24 @@ export type SimpleDatum = {
|
|
|
10
10
|
/** 다중 시리즈 한 줄 */
|
|
11
11
|
export type ChartSeries = {
|
|
12
12
|
name: string;
|
|
13
|
-
|
|
13
|
+
/** null = 데이터 없는 구간(선 끊김). spanGaps 로 이을지 제어 */
|
|
14
|
+
values: (number | null)[];
|
|
14
15
|
/** 이 시리즈만 색 강제 — cascade [2] */
|
|
15
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
|
+
};
|
|
16
31
|
};
|
|
17
32
|
/** 다중 시리즈 입력 */
|
|
18
33
|
export type SeriesData = {
|
|
@@ -44,9 +59,18 @@ export type ChartThemeValue = {
|
|
|
44
59
|
defaults?: ChartStyleDefaults;
|
|
45
60
|
presets?: ChartPreset;
|
|
46
61
|
};
|
|
47
|
-
export type ChartKind = "bar" | "line" | "pie" | "doughnut";
|
|
62
|
+
export type ChartKind = "bar" | "line" | "pie" | "doughnut" | "radar";
|
|
48
63
|
export type LegendOption = boolean | "top" | "bottom" | "left" | "right";
|
|
49
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
|
+
};
|
|
50
74
|
export type ChartBaseProps = {
|
|
51
75
|
title?: string;
|
|
52
76
|
/** true=top, false=숨김, 또는 위치 지정 */
|
|
@@ -73,6 +97,11 @@ export type ChartBaseProps = {
|
|
|
73
97
|
options?: ChartOptions;
|
|
74
98
|
/** L3: 프리셋 무시하고 raw 통째 대체 */
|
|
75
99
|
rawOptions?: ChartOptions;
|
|
100
|
+
/**
|
|
101
|
+
* 커스텀 chart.js 플러그인 (인스턴스 한정 주입). afterDraw/beforeDatasetsDraw 등으로
|
|
102
|
+
* 캔버스에 직접 드로잉. 플러그인 옵션은 L2 `options.plugins.<id>` 로 전달.
|
|
103
|
+
*/
|
|
104
|
+
plugins?: Plugin[];
|
|
76
105
|
};
|
|
77
106
|
export type BarChartProps = ChartBaseProps & {
|
|
78
107
|
data: CategoricalData;
|
|
@@ -81,6 +110,10 @@ export type BarChartProps = ChartBaseProps & {
|
|
|
81
110
|
/** L0 승격 스타일: 막대 모서리 둥글기 */
|
|
82
111
|
barRadius?: number;
|
|
83
112
|
barThickness?: number;
|
|
113
|
+
/** 주 y축 설정 (max/min/단위 포맷) */
|
|
114
|
+
yAxis?: AxisConfig;
|
|
115
|
+
/** 보조 y축 (우측). 정의 시 생성 — 시리즈 `yAxisID:"y1"` 로 연결 (듀얼축) */
|
|
116
|
+
y1Axis?: AxisConfig;
|
|
84
117
|
};
|
|
85
118
|
export type LineChartProps = ChartBaseProps & {
|
|
86
119
|
data: CategoricalData;
|
|
@@ -91,6 +124,10 @@ export type LineChartProps = ChartBaseProps & {
|
|
|
91
124
|
/** L0 승격 스타일 */
|
|
92
125
|
pointStyle?: PointStyle;
|
|
93
126
|
lineWidth?: number;
|
|
127
|
+
/** 주 y축 설정 (max/min/단위 포맷) */
|
|
128
|
+
yAxis?: AxisConfig;
|
|
129
|
+
/** 보조 y축 (우측). 정의 시 생성 — 시리즈 `yAxisID:"y1"` 로 연결 (듀얼축) */
|
|
130
|
+
y1Axis?: AxisConfig;
|
|
94
131
|
};
|
|
95
132
|
export type PieChartProps = ChartBaseProps & {
|
|
96
133
|
data: ProportionData;
|
|
@@ -102,6 +139,14 @@ export type DoughnutChartProps = ChartBaseProps & {
|
|
|
102
139
|
/** 0~1, 도넛 구멍 크기 (기본 0.6) */
|
|
103
140
|
cutout?: number;
|
|
104
141
|
};
|
|
142
|
+
export type RadarChartProps = ChartBaseProps & {
|
|
143
|
+
/** 단일 시리즈(labels+values) 또는 다중 시리즈 모두 허용 */
|
|
144
|
+
data: CategoricalData;
|
|
145
|
+
/** 방사축 최댓값 (suggestedMax). 미지정 시 자동 */
|
|
146
|
+
max?: number;
|
|
147
|
+
/** 다각형 면적 채우기 (기본 true) */
|
|
148
|
+
fill?: boolean;
|
|
149
|
+
};
|
|
105
150
|
/** ChartRenderer가 받는 통합 타입. type으로 좁히면 data가 자동 결정 → `as` 캐스팅 제거 */
|
|
106
151
|
export type AnyChartProps = ({
|
|
107
152
|
type: "bar";
|
|
@@ -111,4 +156,6 @@ export type AnyChartProps = ({
|
|
|
111
156
|
type: "pie";
|
|
112
157
|
} & PieChartProps) | ({
|
|
113
158
|
type: "doughnut";
|
|
114
|
-
} & DoughnutChartProps)
|
|
159
|
+
} & DoughnutChartProps) | ({
|
|
160
|
+
type: "radar";
|
|
161
|
+
} & RadarChartProps);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FloatingAnchorContextValue } from './FloatingAnchor.type';
|
|
3
|
+
export type { Placement, FloatingAnchorContextValue } from './FloatingAnchor.type';
|
|
4
|
+
export declare const FloatingAnchorContext: React.Context<FloatingAnchorContextValue | null>;
|
|
5
|
+
export declare const useFloatingAnchorContext: () => FloatingAnchorContextValue;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { RootProps, TriggerProps, ContentProps } from './FloatingAnchor.type';
|
|
3
|
+
export type { Placement, RootProps, TriggerProps, TriggerRenderProps, ContentProps, } from './FloatingAnchor.type';
|
|
4
|
+
declare const Root: (props: RootProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare const Trigger: (props: TriggerProps) => React.ReactNode;
|
|
6
|
+
/** content 내용 */
|
|
7
|
+
declare const Content: (props: ContentProps) => React.ReactPortal | null;
|
|
8
|
+
interface IFloatingAnchor {
|
|
9
|
+
Root: typeof Root;
|
|
10
|
+
Trigger: typeof Trigger;
|
|
11
|
+
Content: typeof Content;
|
|
12
|
+
}
|
|
13
|
+
declare const FloatingAnchor: IFloatingAnchor;
|
|
14
|
+
export default FloatingAnchor;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type Placement = "top" | "top-start" | "top-end" | "bottom" | "bottom-start" | "bottom-end" | "left" | "left-start" | "left-end" | "right" | "right-start" | "right-end";
|
|
3
|
+
export type FloatingAnchorContextValue = {
|
|
4
|
+
open: boolean;
|
|
5
|
+
setOpen: (open: boolean) => void;
|
|
6
|
+
setAnchorEl: (el: HTMLElement | null) => void;
|
|
7
|
+
setFloatingEl: (el: HTMLElement | null) => void;
|
|
8
|
+
position: {
|
|
9
|
+
top: number;
|
|
10
|
+
left: number;
|
|
11
|
+
} | null;
|
|
12
|
+
contentId: string;
|
|
13
|
+
};
|
|
14
|
+
export type RootProps = {
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
placement?: Placement;
|
|
17
|
+
offset?: number;
|
|
18
|
+
flip?: boolean;
|
|
19
|
+
shift?: boolean;
|
|
20
|
+
open?: boolean;
|
|
21
|
+
defaultOpen?: boolean;
|
|
22
|
+
onOpenChange?: (open: boolean) => void;
|
|
23
|
+
closeOnOutsideClick?: boolean;
|
|
24
|
+
closeOnEscape?: boolean;
|
|
25
|
+
};
|
|
26
|
+
export type TriggerRenderProps = {
|
|
27
|
+
ref: (el: HTMLElement | null) => void;
|
|
28
|
+
className?: string;
|
|
29
|
+
"aria-expanded": boolean;
|
|
30
|
+
"aria-controls": string;
|
|
31
|
+
"aria-haspopup": "dialog";
|
|
32
|
+
onClick: (e: React.MouseEvent) => void;
|
|
33
|
+
};
|
|
34
|
+
export type TriggerProps = {
|
|
35
|
+
children: (props: TriggerRenderProps) => React.ReactNode;
|
|
36
|
+
};
|
|
37
|
+
export type ContentProps = {
|
|
38
|
+
children: React.ReactNode;
|
|
39
|
+
className?: string;
|
|
40
|
+
portalRoot?: HTMLElement | null;
|
|
41
|
+
} & React.HTMLAttributes<HTMLDivElement>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Placement } from './FloatingAnchor.type';
|
|
2
|
+
/**
|
|
3
|
+
* anchorRect: Trigger 요소의 DOMRect
|
|
4
|
+
* floatingRect: Content 요소의 크기 (width, height)
|
|
5
|
+
* offset: anchor와 floating 사이의 간격
|
|
6
|
+
* placement: 요구된 배치 (top, bottom, left, right, top-start, top-end, etc.)
|
|
7
|
+
* 반환값: floating 요소의 top, left 위치
|
|
8
|
+
* 계산 로직: placement에 따라 anchorRect를 기준으로 floatingRect의 위치 계산.
|
|
9
|
+
* 예를 들어, placement가 "top"이면 floating 요소는 anchor 요소의 위에 위치해야 하므로,
|
|
10
|
+
* top은 anchorRect.top - floatingRect.height - offset이 되고,
|
|
11
|
+
* left는 anchorRect.left + (anchorRect.width - floatingRect.width) / 2가 됩니다.
|
|
12
|
+
*/
|
|
13
|
+
export declare const computePosition: (anchorRect: DOMRect, floatingRect: {
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
}, placement: Placement, offset: number) => {
|
|
17
|
+
top: number;
|
|
18
|
+
left: number;
|
|
19
|
+
};
|
|
20
|
+
/** 플립 */
|
|
21
|
+
export declare const flipPlacement: (p: Placement) => Placement;
|
|
22
|
+
/**
|
|
23
|
+
* 주축(main axis)의 넘침량을 반환.
|
|
24
|
+
* 반환값 0이면 주축으로는 넘치지 않음, 양수면 넘친 픽셀 수.
|
|
25
|
+
*/
|
|
26
|
+
export declare const getMainAxisOverflow: (pos: {
|
|
27
|
+
top: number;
|
|
28
|
+
left: number;
|
|
29
|
+
}, size: {
|
|
30
|
+
width: number;
|
|
31
|
+
height: number;
|
|
32
|
+
}, placement: Placement, padding: number) => number;
|
|
33
|
+
/** 뷰포트안에 fit하도록 위치 조정 */
|
|
34
|
+
export declare const shiftIntoViewport: (pos: {
|
|
35
|
+
top: number;
|
|
36
|
+
left: number;
|
|
37
|
+
}, size: {
|
|
38
|
+
width: number;
|
|
39
|
+
height: number;
|
|
40
|
+
}, padding: number) => {
|
|
41
|
+
top: number;
|
|
42
|
+
left: number;
|
|
43
|
+
};
|
|
@@ -23,6 +23,8 @@ export type TriggerProps = React.PropsWithChildren<{
|
|
|
23
23
|
size?: "small" | "medium" | "large";
|
|
24
24
|
leftIcon?: React.ComponentProps<typeof Icon> | null;
|
|
25
25
|
rightIcon?: React.ComponentProps<typeof Icon> | null;
|
|
26
|
+
/** 도메인 강조 보더색. 지정 시 inactive/selected/focused 보더를 이 색으로 통일(error/disabled는 우선 유지) */
|
|
27
|
+
accentColor?: string;
|
|
26
28
|
}>;
|
|
27
29
|
export type MenuRenderProps = {
|
|
28
30
|
open: boolean;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type KanbanColumn = {
|
|
3
|
+
id: string;
|
|
4
|
+
label?: React.ReactNode;
|
|
5
|
+
accentColor?: string;
|
|
6
|
+
};
|
|
7
|
+
export type KanbanBoardProps<T> = {
|
|
8
|
+
columns: KanbanColumn[];
|
|
9
|
+
/** 카드로 표시될 아이템 목록 */
|
|
10
|
+
items: T[];
|
|
11
|
+
/** 아이템 고유 id 추출 */
|
|
12
|
+
getItemId: (item: T) => string;
|
|
13
|
+
/** 아이템이 속한 컬럼 id 추출 */
|
|
14
|
+
getColumnId: (item: T) => string;
|
|
15
|
+
/** 카드 렌더링 — 사용자가 결정 */
|
|
16
|
+
renderCard: (item: T, isSelected: boolean) => React.ReactNode;
|
|
17
|
+
/** 컬럼 헤더 커스텀. 미지정 시 기본 헤더 */
|
|
18
|
+
renderColumnHeader?: (column: KanbanColumn, items: T[]) => React.ReactNode;
|
|
19
|
+
/** 빈 컬럼 표시 텍스트 */
|
|
20
|
+
emptyText?: React.ReactNode;
|
|
21
|
+
/** 선택된 카드 id */
|
|
22
|
+
selectedId?: string | null;
|
|
23
|
+
/** 카드 클릭 시 콜백 */
|
|
24
|
+
onSelect?: (item: T) => void;
|
|
25
|
+
/**
|
|
26
|
+
* 카드의 컬럼(소속) 필드를 갱신한 "새 아이템"을 반환한다. DnD를 쓰려면 필요.
|
|
27
|
+
* 예: (deal, stage) => ({ ...deal, stage })
|
|
28
|
+
*/
|
|
29
|
+
setItemColumn?: (item: T, columnId: string) => T;
|
|
30
|
+
/**
|
|
31
|
+
* DnD로 카드가 이동해 목록이 바뀌면, 재정렬된 새 배열을 받는다.
|
|
32
|
+
* 사용처는 보통 setState만 연결. 예: onItemsChange={setDeals}
|
|
33
|
+
*/
|
|
34
|
+
onItemsChange?: (items: T[]) => void;
|
|
35
|
+
className?: string;
|
|
36
|
+
};
|
|
@@ -16,7 +16,10 @@ type PageListProps = {
|
|
|
16
16
|
}) => React.ReactNode;
|
|
17
17
|
};
|
|
18
18
|
declare const PageList: (props: PageListProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
19
|
-
type RootProps = {
|
|
19
|
+
type RootProps = {
|
|
20
|
+
/** nav에 전달. `--pagination-gap`/`--pagination-item-size`/`--pagination-radius` 등 변수 override 통로 */
|
|
21
|
+
style?: React.CSSProperties;
|
|
22
|
+
} & Omit<PaginationContextType, "currentPage">;
|
|
20
23
|
declare const Root: (props: React.PropsWithChildren<RootProps>) => import("react/jsx-runtime").JSX.Element;
|
|
21
24
|
interface IPagination {
|
|
22
25
|
Root: typeof Root;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TimelineColorToken, TimelineColorValue } from './Timeline.colors';
|
|
2
|
+
export type TimelineEvent = {
|
|
3
|
+
id?: string;
|
|
4
|
+
startHour: string;
|
|
5
|
+
endHour?: string;
|
|
6
|
+
label: string;
|
|
7
|
+
color?: TimelineColorToken | TimelineColorValue;
|
|
8
|
+
};
|
|
9
|
+
export type TimelineProps = {
|
|
10
|
+
events: TimelineEvent[];
|
|
11
|
+
date: string;
|
|
12
|
+
startHour?: number;
|
|
13
|
+
endHour?: number;
|
|
14
|
+
className?: string;
|
|
15
|
+
headerClassName?: string;
|
|
16
|
+
};
|