@uniai-fe/uds-primitives 0.2.10 → 0.3.0
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/dist/styles.css +82 -10
- package/package.json +1 -1
- package/src/components/button/index.tsx +1 -1
- package/src/components/button/markup/Base.tsx +1 -1
- package/src/components/button/styles/button.scss +32 -0
- package/src/components/button/styles/variables.scss +16 -0
- package/src/components/button/types/index.ts +3 -179
- package/src/components/button/types/{constants.ts → options.ts} +28 -13
- package/src/components/button/types/props.ts +264 -0
- package/src/components/chip/markup/Chip.tsx +14 -2
- package/src/components/chip/styles/chip.scss +154 -0
- package/src/components/chip/styles/index.scss +2 -138
- package/src/components/chip/styles/variables.scss +26 -0
- package/src/components/chip/types/index.ts +2 -52
- package/src/components/chip/types/options.ts +38 -0
- package/src/components/chip/types/props.ts +115 -0
- package/src/components/chip/utils/class-name.ts +36 -0
- package/src/components/chip/utils/index.ts +1 -36
- package/src/components/form/index.tsx +3 -16
- package/src/components/form/markup/form-field/index.tsx +1 -0
- package/src/components/form/markup/index.tsx +11 -0
- package/src/components/form/styles/index.scss +2 -2
- package/src/components/form/utils/index.ts +1 -0
- package/src/components/info-box/img/ban.svg +5 -0
- package/src/components/info-box/img/caution.svg +5 -0
- package/src/components/info-box/img/check.svg +4 -0
- package/src/components/info-box/img/info.svg +6 -0
- package/src/components/info-box/index.scss +1 -0
- package/src/components/info-box/index.tsx +4 -0
- package/src/components/info-box/markup/Icon.tsx +14 -0
- package/src/components/info-box/markup/InfoBox.tsx +65 -0
- package/src/components/info-box/markup/index.ts +2 -0
- package/src/components/info-box/styles/index.scss +2 -0
- package/src/components/info-box/styles/info-box.scss +61 -0
- package/src/components/info-box/styles/variables.scss +33 -0
- package/src/components/info-box/types/index.ts +1 -0
- package/src/components/info-box/types/props.ts +34 -0
- package/src/components/table/markup/Container.tsx +30 -66
- package/src/components/table/types/foundation.ts +10 -45
- package/src/index.tsx +19 -21
- package/src/components/button/types/templates.ts +0 -84
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { forwardRef } from "react";
|
|
2
|
-
import type {
|
|
2
|
+
import type { TableContainerProps } from "../types";
|
|
3
3
|
import TableBody from "./foundation/Body";
|
|
4
4
|
import TableCell from "./foundation/Cell";
|
|
5
5
|
import TableHead from "./foundation/Head";
|
|
@@ -7,33 +7,12 @@ import TableTh from "./foundation/Th";
|
|
|
7
7
|
import TableRoot from "./foundation/Root";
|
|
8
8
|
import TableRow from "./foundation/Row";
|
|
9
9
|
|
|
10
|
-
const resolveHeadContent = (column: TableTemplateColumn): React.ReactNode => {
|
|
11
|
-
if (typeof column.cellContents !== "undefined") {
|
|
12
|
-
return column.cellContents;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
if (typeof column.cellChildren !== "undefined") {
|
|
16
|
-
return column.cellChildren;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
if (typeof column.headContent !== "undefined") {
|
|
20
|
-
return column.headContent;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (typeof column.dataName !== "undefined") {
|
|
24
|
-
return column.dataName;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return column.dataKey;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
10
|
/**
|
|
31
11
|
* Table Preset; 기본 Container 조합 컴포넌트
|
|
32
12
|
* @component
|
|
33
|
-
* @param {
|
|
34
|
-
* @param {
|
|
13
|
+
* @param {TableContainerProps} props
|
|
14
|
+
* @param {TableColumnData[]} [props.columns] colgroup/head 자동 렌더링 column 목록
|
|
35
15
|
* @param {boolean} [props.isCustomBody=false] true면 body wrapper 없이 children 직접 렌더링
|
|
36
|
-
* @param {"legacy-rem" | "raw"} [props.widthMode="legacy-rem"] number width 해석 방식
|
|
37
16
|
* @param {React.ReactNode} [props.footer] footer 노드. `<Table.Foot />`를 직접 전달하는 방식을 권장
|
|
38
17
|
* @param {React.ReactNode} [props.children] table body 콘텐츠
|
|
39
18
|
* @example
|
|
@@ -52,60 +31,45 @@ const resolveHeadContent = (column: TableTemplateColumn): React.ReactNode => {
|
|
|
52
31
|
* {rows}
|
|
53
32
|
* </Table.Container>
|
|
54
33
|
*/
|
|
55
|
-
const TableContainer = forwardRef<HTMLTableElement,
|
|
56
|
-
(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
footer,
|
|
62
|
-
children,
|
|
63
|
-
...tableProps
|
|
64
|
-
},
|
|
65
|
-
ref,
|
|
66
|
-
) => {
|
|
67
|
-
const hasColumns = Array.isArray(columns) && columns.length > 0;
|
|
34
|
+
const TableContainer = forwardRef<HTMLTableElement, TableContainerProps>(
|
|
35
|
+
({ columns, isCustomBody = false, footer, children, ...tableProps }, ref) => {
|
|
36
|
+
// 변경: optional columns를 안전하게 순회하기 위한 기본 배열을 고정한다.
|
|
37
|
+
const resolvedColumns = columns ?? [];
|
|
38
|
+
// 변경: columns 존재 여부만 단일 플래그로 관리해 렌더 분기 가독성을 유지한다.
|
|
39
|
+
const hasColumns = resolvedColumns.length > 0;
|
|
68
40
|
|
|
69
41
|
return (
|
|
70
42
|
<TableRoot {...tableProps} ref={ref}>
|
|
71
43
|
{hasColumns && (
|
|
72
44
|
<colgroup>
|
|
73
|
-
{
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
? {
|
|
90
|
-
width: normalizedWidth,
|
|
91
|
-
}
|
|
92
|
-
: undefined
|
|
93
|
-
}
|
|
94
|
-
width={typeof width === "number" ? width : undefined}
|
|
95
|
-
/>
|
|
96
|
-
);
|
|
97
|
-
})}
|
|
45
|
+
{resolvedColumns.map(({ key, width, dataKey, className }) => (
|
|
46
|
+
<col
|
|
47
|
+
key={`${key}/colgroup`}
|
|
48
|
+
className={className}
|
|
49
|
+
data-key={dataKey}
|
|
50
|
+
style={
|
|
51
|
+
typeof width !== "undefined"
|
|
52
|
+
? {
|
|
53
|
+
// 변경: width는 number|string 값을 그대로 사용하고, 단위 해석은 사용처에서 결정한다.
|
|
54
|
+
width,
|
|
55
|
+
}
|
|
56
|
+
: undefined
|
|
57
|
+
}
|
|
58
|
+
width={typeof width === "number" ? width : undefined}
|
|
59
|
+
/>
|
|
60
|
+
))}
|
|
98
61
|
</colgroup>
|
|
99
62
|
)}
|
|
100
63
|
|
|
101
64
|
{hasColumns && (
|
|
102
65
|
<TableHead>
|
|
103
66
|
<TableRow>
|
|
104
|
-
{
|
|
105
|
-
<TableTh key={`${
|
|
67
|
+
{resolvedColumns.map(({ key, dataKey, align, cellContents }) => (
|
|
68
|
+
<TableTh key={`${key}/head`} data-key={dataKey}>
|
|
106
69
|
{/* 변경: 헤더 셀 여백/정렬도 Cell 레이어에서 일관 제어한다. */}
|
|
107
|
-
<TableCell section="head" alignX={
|
|
108
|
-
{
|
|
70
|
+
<TableCell section="head" alignX={align}>
|
|
71
|
+
{/* 변경: 헤더 콘텐츠는 cellContents 우선, 미지정 시 key를 fallback으로 사용한다. */}
|
|
72
|
+
{typeof cellContents !== "undefined" ? cellContents : key}
|
|
109
73
|
</TableCell>
|
|
110
74
|
</TableTh>
|
|
111
75
|
))}
|
|
@@ -53,14 +53,14 @@ export interface TableRootProps extends ComponentPropsWithoutRef<"table"> {
|
|
|
53
53
|
export interface TableColgroupProps extends ComponentPropsWithoutRef<"colgroup"> {}
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
|
-
* Table Types;
|
|
56
|
+
* Table Types; Container column data
|
|
57
57
|
* @property {string} key column 고유 key
|
|
58
58
|
* @property {number | string} [width] width 값
|
|
59
|
-
* @property {string} [dataKey] data-key attr 값
|
|
60
|
-
* @property {
|
|
61
|
-
* @property {
|
|
59
|
+
* @property {string} [dataKey] tbody loop 렌더링 시 데이터 매핑(property key)용 식별자 및 data-key attr 값
|
|
60
|
+
* @property {React.ReactNode} [cellContents] 헤더 셀 콘텐츠
|
|
61
|
+
* @property {"left" | "center" | "right"} [align] 헤더 정렬
|
|
62
62
|
*/
|
|
63
|
-
export interface
|
|
63
|
+
export interface TableColumnData {
|
|
64
64
|
/**
|
|
65
65
|
* column 고유 key
|
|
66
66
|
*/
|
|
@@ -70,47 +70,17 @@ export interface TableColgroupColumn {
|
|
|
70
70
|
*/
|
|
71
71
|
width?: number | string;
|
|
72
72
|
/**
|
|
73
|
-
* data-key attr 값
|
|
73
|
+
* tbody loop 렌더링 시 데이터 매핑(property key)용 식별자 및 data-key attr 값
|
|
74
74
|
*/
|
|
75
75
|
dataKey?: string;
|
|
76
76
|
/**
|
|
77
77
|
* col className
|
|
78
78
|
*/
|
|
79
79
|
className?: string;
|
|
80
|
-
/**
|
|
81
|
-
* col span 값
|
|
82
|
-
*/
|
|
83
|
-
span?: number;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Table Types; Template column item
|
|
88
|
-
* @property {string} key column 고유 key
|
|
89
|
-
* @property {number | string} [width] width 값
|
|
90
|
-
* @property {string} [dataKey] data-key attr 값
|
|
91
|
-
* @property {string} [dataName] 헤더 식별자
|
|
92
|
-
* @property {React.ReactNode} [headContent] 헤더 셀 콘텐츠
|
|
93
|
-
* @property {React.ReactNode} [cellContents] ui-legacy 호환 헤더 콘텐츠
|
|
94
|
-
* @property {React.ReactNode} [cellChildren] 서비스 호환 헤더 콘텐츠
|
|
95
|
-
* @property {"left" | "center" | "right"} [align] 헤더 정렬
|
|
96
|
-
*/
|
|
97
|
-
export interface TableTemplateColumn extends TableColgroupColumn {
|
|
98
|
-
/**
|
|
99
|
-
* 헤더 식별자
|
|
100
|
-
*/
|
|
101
|
-
dataName?: string;
|
|
102
80
|
/**
|
|
103
81
|
* 헤더 셀 콘텐츠
|
|
104
82
|
*/
|
|
105
|
-
headContent?: React.ReactNode;
|
|
106
|
-
/**
|
|
107
|
-
* ui-legacy 호환 헤더 콘텐츠
|
|
108
|
-
*/
|
|
109
83
|
cellContents?: React.ReactNode;
|
|
110
|
-
/**
|
|
111
|
-
* 서비스 호환 헤더 콘텐츠
|
|
112
|
-
*/
|
|
113
|
-
cellChildren?: React.ReactNode;
|
|
114
84
|
/**
|
|
115
85
|
* 헤더 정렬
|
|
116
86
|
*/
|
|
@@ -118,26 +88,21 @@ export interface TableTemplateColumn extends TableColgroupColumn {
|
|
|
118
88
|
}
|
|
119
89
|
|
|
120
90
|
/**
|
|
121
|
-
* Table Types;
|
|
122
|
-
* @property {
|
|
91
|
+
* Table Types; Container props
|
|
92
|
+
* @property {TableColumnData[]} [columns] colgroup/head 자동 렌더링용 column 데이터
|
|
123
93
|
* @property {boolean} [isCustomBody] true면 body wrapper 없이 children을 직접 렌더링
|
|
124
|
-
* @property {"legacy-rem" | "raw"} [widthMode] number width 해석 방식
|
|
125
94
|
* @property {React.ReactNode} [footer] footer 노드
|
|
126
95
|
* @property {React.ReactNode} [children] body 콘텐츠
|
|
127
96
|
*/
|
|
128
|
-
export interface
|
|
97
|
+
export interface TableContainerProps extends TableRootProps {
|
|
129
98
|
/**
|
|
130
99
|
* colgroup/head 자동 렌더링용 column 데이터
|
|
131
100
|
*/
|
|
132
|
-
columns?:
|
|
101
|
+
columns?: TableColumnData[];
|
|
133
102
|
/**
|
|
134
103
|
* true면 body wrapper 없이 children을 직접 렌더링
|
|
135
104
|
*/
|
|
136
105
|
isCustomBody?: boolean;
|
|
137
|
-
/**
|
|
138
|
-
* number width 해석 방식
|
|
139
|
-
*/
|
|
140
|
-
widthMode?: "legacy-rem" | "raw";
|
|
141
106
|
/**
|
|
142
107
|
* footer 노드
|
|
143
108
|
*/
|
package/src/index.tsx
CHANGED
|
@@ -1,33 +1,31 @@
|
|
|
1
1
|
// Mantine 날짜 생태계와 dayjs 설정을 한 번만 초기화한다.
|
|
2
2
|
import "./init/dayjs";
|
|
3
3
|
import "./init/mantine";
|
|
4
|
-
// ThemeProvider는 foundation provider에서만 export한다(one-source 규칙).
|
|
5
4
|
|
|
6
5
|
// 루트 배럴: 카테고리별 export를 집계한다.
|
|
6
|
+
export * from "./components/alternate";
|
|
7
|
+
export * from "./components/badge";
|
|
7
8
|
export * from "./components/button";
|
|
8
|
-
export * from "./components/
|
|
9
|
-
export * from "./components/input";
|
|
9
|
+
export * from "./components/calendar";
|
|
10
10
|
export * from "./components/checkbox";
|
|
11
|
-
export * from "./components/
|
|
12
|
-
export * from "./components/
|
|
13
|
-
export * from "./components/
|
|
14
|
-
export * from "./components/navigation";
|
|
11
|
+
export * from "./components/chip";
|
|
12
|
+
export * from "./components/divider";
|
|
13
|
+
export * from "./components/drawer";
|
|
15
14
|
export * from "./components/dropdown";
|
|
15
|
+
export * from "./components/form";
|
|
16
|
+
export * from "./components/info-box";
|
|
17
|
+
export * from "./components/input";
|
|
18
|
+
export * from "./components/label";
|
|
19
|
+
export * from "./components/navigation";
|
|
20
|
+
export * from "./components/pagination";
|
|
16
21
|
export * from "./components/pop-over";
|
|
17
|
-
export * from "./components/
|
|
18
|
-
export * from "./components/drawer";
|
|
22
|
+
export * from "./components/radio";
|
|
19
23
|
export * from "./components/scrollbar";
|
|
20
|
-
export * from "./components/calendar";
|
|
21
|
-
export * from "./components/pagination";
|
|
22
|
-
export * from "./components/table";
|
|
23
|
-
export * from "./components/chip";
|
|
24
|
-
export * from "./components/badge";
|
|
25
|
-
export * from "./components/spinner";
|
|
26
|
-
export * from "./components/alternate";
|
|
27
24
|
export * from "./components/segmented-control";
|
|
28
|
-
export * from "./components/
|
|
25
|
+
export * from "./components/select";
|
|
29
26
|
export * from "./components/slot";
|
|
30
|
-
export * from "./
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
export * from "./components/
|
|
27
|
+
export * from "./components/spinner";
|
|
28
|
+
export * from "./components/tab";
|
|
29
|
+
export * from "./components/table";
|
|
30
|
+
export * from "./components/tooltip";
|
|
31
|
+
export type * from "./types";
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import type { ButtonPriority, ButtonProps } from ".";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Button; TextButton size 옵션
|
|
5
|
-
* @desc
|
|
6
|
-
* - `small`
|
|
7
|
-
* - `medium`
|
|
8
|
-
* - `large`
|
|
9
|
-
*/
|
|
10
|
-
export type TextButtonSize = "small" | "medium" | "large";
|
|
11
|
-
/**
|
|
12
|
-
* Button; TextButton priority 옵션
|
|
13
|
-
* @desc
|
|
14
|
-
* - `secondary`
|
|
15
|
-
* - `tertiary`
|
|
16
|
-
*/
|
|
17
|
-
export type TextButtonPriority = Exclude<ButtonPriority, "primary">;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Button; TextButton props
|
|
21
|
-
* @property {ElementType} [as] 렌더링할 요소. 기본값은 button.
|
|
22
|
-
* @property {ReactNode} [children] 주 내용. 문자열이면 자동으로 .button-label로 감싼다.
|
|
23
|
-
* @property {TextButtonSize} size 높이/타이포 스케일. scale 조합보다 우선한다.
|
|
24
|
-
* @property {TextButtonPriority} priority semantic color priority.
|
|
25
|
-
* @property {ButtonState} [state] UI 상태. disabled prop과 조합된다.
|
|
26
|
-
* @property {boolean} [block] width:100% 확장 여부.
|
|
27
|
-
* @property {boolean} [loading] true면 readonly 처리 + aria-busy.
|
|
28
|
-
* @property {ReactNode} [left] 라벨 왼쪽 커스텀 슬롯.
|
|
29
|
-
* @property {ReactNode} [right] 라벨 오른쪽 커스텀 슬롯.
|
|
30
|
-
* @property {ButtonUserAction} ["data-user-action"] Interation 상태 강제 표현용 data attr.
|
|
31
|
-
*/
|
|
32
|
-
export interface TextButtonProps extends Omit<
|
|
33
|
-
ButtonProps,
|
|
34
|
-
"scale" | "priority" | "fill" | "size"
|
|
35
|
-
> {
|
|
36
|
-
/**
|
|
37
|
-
* @required
|
|
38
|
-
* - primary
|
|
39
|
-
* - secondary
|
|
40
|
-
* - tertiary
|
|
41
|
-
*/
|
|
42
|
-
priority: TextButtonPriority;
|
|
43
|
-
/**
|
|
44
|
-
* @required
|
|
45
|
-
* - xlarge
|
|
46
|
-
* - large
|
|
47
|
-
* - medium
|
|
48
|
-
* - small
|
|
49
|
-
*/
|
|
50
|
-
size: TextButtonSize;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Button; RoundButton size 옵션
|
|
55
|
-
* @desc
|
|
56
|
-
* - `small`
|
|
57
|
-
* - `medium`
|
|
58
|
-
* - `large`
|
|
59
|
-
*/
|
|
60
|
-
export type RoundButtonSize = "small" | "medium" | "large";
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Button; RoundButton props
|
|
64
|
-
* @property {ElementType} [as] 렌더링할 요소. 기본값은 button.
|
|
65
|
-
* @property {ReactNode} [children] 주 내용. 문자열이면 자동으로 .button-label로 감싼다.
|
|
66
|
-
* @property {RoundButtonSize} size 높이/타이포 스케일. 템플릿에서 fill/size를 자동 매핑한다.
|
|
67
|
-
* @property {ButtonPriority} priority semantic color priority.
|
|
68
|
-
* @property {ButtonState} [state] UI 상태. disabled prop과 조합된다.
|
|
69
|
-
* @property {boolean} [block] width:100% 확장 여부.
|
|
70
|
-
* @property {boolean} [loading] true면 readonly 처리 + aria-busy.
|
|
71
|
-
* @property {ReactNode} [left] 라벨 왼쪽 커스텀 슬롯.
|
|
72
|
-
* @property {ReactNode} [right] 라벨 오른쪽 커스텀 슬롯.
|
|
73
|
-
* @property {ButtonUserAction} ["data-user-action"] Interation 상태 강제 표현용 data attr.
|
|
74
|
-
*/
|
|
75
|
-
export interface RoundButtonProps extends Omit<
|
|
76
|
-
ButtonProps,
|
|
77
|
-
"scale" | "size" | "fill"
|
|
78
|
-
> {
|
|
79
|
-
/**
|
|
80
|
-
* 라운드 버튼 전용 size 축.
|
|
81
|
-
* 템플릿에서 fill/size를 자동 매핑한다.
|
|
82
|
-
*/
|
|
83
|
-
size: RoundButtonSize;
|
|
84
|
-
}
|