@uniai-fe/uds-primitives 0.2.11 → 0.3.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.
Files changed (39) hide show
  1. package/dist/styles.css +1118 -890
  2. package/package.json +1 -1
  3. package/src/components/button/index.tsx +1 -1
  4. package/src/components/button/markup/Base.tsx +1 -1
  5. package/src/components/button/styles/button.scss +32 -0
  6. package/src/components/button/styles/variables.scss +16 -0
  7. package/src/components/button/types/index.ts +3 -179
  8. package/src/components/button/types/{constants.ts → options.ts} +28 -13
  9. package/src/components/button/types/props.ts +264 -0
  10. package/src/components/chip/markup/Chip.tsx +14 -2
  11. package/src/components/chip/styles/chip.scss +154 -0
  12. package/src/components/chip/styles/index.scss +2 -138
  13. package/src/components/chip/styles/variables.scss +26 -0
  14. package/src/components/chip/types/index.ts +2 -52
  15. package/src/components/chip/types/options.ts +38 -0
  16. package/src/components/chip/types/props.ts +115 -0
  17. package/src/components/chip/utils/class-name.ts +36 -0
  18. package/src/components/chip/utils/index.ts +1 -36
  19. package/src/components/form/index.tsx +3 -16
  20. package/src/components/form/markup/form-field/index.tsx +1 -0
  21. package/src/components/form/markup/index.tsx +11 -0
  22. package/src/components/form/styles/index.scss +2 -2
  23. package/src/components/form/utils/index.ts +1 -0
  24. package/src/components/input/markup/foundation/Button.tsx +1 -6
  25. package/src/components/input/markup/text/AuthCode.tsx +3 -1
  26. package/src/components/input/markup/text/Email.tsx +16 -11
  27. package/src/components/input/markup/text/Password.tsx +3 -3
  28. package/src/components/input/markup/text/Phone.tsx +30 -28
  29. package/src/components/input/markup/text/Search.tsx +3 -1
  30. package/src/components/input/types/text.ts +10 -5
  31. package/src/components/input/utils/index.tsx +0 -1
  32. package/src/components/table/markup/Container.tsx +36 -70
  33. package/src/components/table/markup/foundation/Cell.tsx +4 -6
  34. package/src/components/table/styles/foundation.scss +75 -9
  35. package/src/components/table/types/foundation.ts +62 -59
  36. package/src/index.scss +7 -6
  37. package/src/index.tsx +19 -22
  38. package/src/components/button/types/templates.ts +0 -84
  39. package/src/components/input/utils/verification.tsx +0 -35
@@ -2,20 +2,50 @@ import type { ComponentPropsWithoutRef } from "react";
2
2
 
3
3
  export const TABLE_CELL_ALIGN_OPTIONS = ["left", "center", "right"] as const;
4
4
  export const TABLE_CELL_ALIGN_Y_OPTIONS = ["top", "center", "bottom"] as const;
5
+ export const TABLE_CELL_JUSTIFY_CONTENT_OPTIONS = [
6
+ "normal",
7
+ "start",
8
+ "end",
9
+ "flex-start",
10
+ "flex-end",
11
+ "center",
12
+ "left",
13
+ "right",
14
+ "space-between",
15
+ "space-around",
16
+ "space-evenly",
17
+ "stretch",
18
+ ] as const;
19
+ export const TABLE_CELL_ALIGN_ITEMS_OPTIONS = [
20
+ "normal",
21
+ "stretch",
22
+ "center",
23
+ "start",
24
+ "end",
25
+ "flex-start",
26
+ "flex-end",
27
+ "self-start",
28
+ "self-end",
29
+ "baseline",
30
+ ] as const;
5
31
  export const TABLE_CELL_PADDING_OPTIONS = ["default", "none"] as const;
6
32
  export const TABLE_SECTIONS = ["head", "body", "foot"] as const;
7
33
  export const TABLE_LAYOUT_OPTIONS = ["line", "grid"] as const;
8
34
 
9
35
  /**
10
- * Table Types; Cell 정렬 값 타입
11
- * @typedef {"left" | "center" | "right"} TableCellAlign
36
+ * Table Types; Cell 가로 정렬 값 타입
37
+ * @typedef {"left" | "center" | "right" | "normal" | "start" | "end" | "flex-start" | "flex-end" | "space-between" | "space-around" | "space-evenly" | "stretch"} TableCellAlignX
12
38
  */
13
- export type TableCellAlign = (typeof TABLE_CELL_ALIGN_OPTIONS)[number];
39
+ export type TableCellAlignX =
40
+ | (typeof TABLE_CELL_ALIGN_OPTIONS)[number]
41
+ | (typeof TABLE_CELL_JUSTIFY_CONTENT_OPTIONS)[number];
14
42
  /**
15
43
  * Table Types; Cell 세로 정렬 값 타입
16
- * @typedef {"top" | "center" | "bottom"} TableCellAlignY
44
+ * @typedef {"top" | "center" | "bottom" | "normal" | "stretch" | "start" | "end" | "flex-start" | "flex-end" | "self-start" | "self-end" | "baseline"} TableCellAlignY
17
45
  */
18
- export type TableCellAlignY = (typeof TABLE_CELL_ALIGN_Y_OPTIONS)[number];
46
+ export type TableCellAlignY =
47
+ | (typeof TABLE_CELL_ALIGN_Y_OPTIONS)[number]
48
+ | (typeof TABLE_CELL_ALIGN_ITEMS_OPTIONS)[number];
19
49
  /**
20
50
  * Table Types; Cell padding 제어 타입
21
51
  * @typedef {"default" | "none"} TableCellPadding
@@ -53,14 +83,15 @@ export interface TableRootProps extends ComponentPropsWithoutRef<"table"> {
53
83
  export interface TableColgroupProps extends ComponentPropsWithoutRef<"colgroup"> {}
54
84
 
55
85
  /**
56
- * Table Types; Colgroup column item
86
+ * Table Types; Container column data
57
87
  * @property {string} key column 고유 key
58
88
  * @property {number | string} [width] width 값
59
- * @property {string} [dataKey] data-key attr 값
60
- * @property {string} [className] col className
61
- * @property {number} [span] col span
89
+ * @property {string} [dataKey] tbody loop 렌더링 시 데이터 매핑(property key)용 식별자 및 data-key attr 값
90
+ * @property {React.ReactNode} [cellContents] 헤더 셀 콘텐츠
91
+ * @property {"left" | "center" | "right" | "normal" | "start" | "end" | "flex-start" | "flex-end" | "space-between" | "space-around" | "space-evenly" | "stretch"} [alignX] 헤더 가로 정렬(CSS `justify-content` 값과 매핑)
92
+ * @property {"top" | "center" | "bottom" | "normal" | "stretch" | "start" | "end" | "flex-start" | "flex-end" | "self-start" | "self-end" | "baseline"} [alignY] 헤더 세로 정렬(CSS `align-items` 값과 매핑)
62
93
  */
63
- export interface TableColgroupColumn {
94
+ export interface TableColumnData {
64
95
  /**
65
96
  * column 고유 key
66
97
  */
@@ -70,74 +101,43 @@ export interface TableColgroupColumn {
70
101
  */
71
102
  width?: number | string;
72
103
  /**
73
- * data-key attr 값
104
+ * tbody loop 렌더링 시 데이터 매핑(property key)용 식별자 및 data-key attr 값
74
105
  */
75
106
  dataKey?: string;
76
107
  /**
77
108
  * col className
78
109
  */
79
110
  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
111
  /**
103
112
  * 헤더 셀 콘텐츠
104
113
  */
105
- headContent?: React.ReactNode;
106
- /**
107
- * ui-legacy 호환 헤더 콘텐츠
108
- */
109
114
  cellContents?: React.ReactNode;
110
115
  /**
111
- * 서비스 호환 헤더 콘텐츠
116
+ * 헤더 가로 정렬
112
117
  */
113
- cellChildren?: React.ReactNode;
118
+ alignX?: TableCellAlignX;
114
119
  /**
115
- * 헤더 정렬
120
+ * 헤더 세로 정렬
116
121
  */
117
- align?: TableCellAlign;
122
+ alignY?: TableCellAlignY;
118
123
  }
119
124
 
120
125
  /**
121
- * Table Types; Template props
122
- * @property {TableTemplateColumn[]} [columns] colgroup/head 자동 렌더링용 column 데이터
126
+ * Table Types; Container props
127
+ * @property {TableColumnData[]} [columns] colgroup/head 자동 렌더링용 column 데이터
123
128
  * @property {boolean} [isCustomBody] true면 body wrapper 없이 children을 직접 렌더링
124
- * @property {"legacy-rem" | "raw"} [widthMode] number width 해석 방식
125
129
  * @property {React.ReactNode} [footer] footer 노드
126
130
  * @property {React.ReactNode} [children] body 콘텐츠
127
131
  */
128
- export interface TableTemplateProps extends TableRootProps {
132
+ export interface TableContainerProps extends TableRootProps {
129
133
  /**
130
134
  * colgroup/head 자동 렌더링용 column 데이터
131
135
  */
132
- columns?: TableTemplateColumn[];
136
+ columns?: TableColumnData[];
133
137
  /**
134
138
  * true면 body wrapper 없이 children을 직접 렌더링
135
139
  */
136
140
  isCustomBody?: boolean;
137
- /**
138
- * number width 해석 방식
139
- */
140
- widthMode?: "legacy-rem" | "raw";
141
141
  /**
142
142
  * footer 노드
143
143
  */
@@ -201,15 +201,17 @@ export interface TableTdProps extends ComponentPropsWithoutRef<"td"> {}
201
201
  /**
202
202
  * Table Types; Cell content props
203
203
  * @property {"head" | "body" | "foot"} [section] cell 상위 섹션
204
- * @property {"left" | "center" | "right"} [alignX] cell 콘텐츠 가로 정렬
205
- * @property {"top" | "center" | "bottom"} [alignY] cell 콘텐츠 세로 정렬
204
+ * @property {"left" | "center" | "right" | "normal" | "start" | "end" | "flex-start" | "flex-end" | "space-between" | "space-around" | "space-evenly" | "stretch"} [alignX] cell 콘텐츠 가로 정렬(CSS `justify-content` 값과 매핑)
205
+ * @property {"top" | "center" | "bottom" | "normal" | "stretch" | "start" | "end" | "flex-start" | "flex-end" | "self-start" | "self-end" | "baseline"} [alignY] cell 콘텐츠 세로 정렬(CSS `align-items` 값과 매핑)
206
206
  * @property {boolean} [noPadding] true면 cell 내부 padding 제거
207
207
  * @property {"default" | "none"} [padding] cell 내부 padding 제어
208
- * @property {"left" | "center" | "right"} [align] cell 콘텐츠 가로 정렬(호환 alias)
209
208
  * @property {string} [className] cell content className
210
- * @property {React.ReactNode} [children] cell 내부 콘텐츠
209
+ * @property {React.ReactNode} [children] cell 내부 콘텐츠 `span.table-cell-text.table-${section}-cell-text`
211
210
  */
212
- export interface TableCellContentProps extends ComponentPropsWithoutRef<"div"> {
211
+ export interface TableCellContentProps extends Omit<
212
+ ComponentPropsWithoutRef<"div">,
213
+ "children"
214
+ > {
213
215
  /**
214
216
  * cell 상위 섹션
215
217
  */
@@ -217,7 +219,7 @@ export interface TableCellContentProps extends ComponentPropsWithoutRef<"div"> {
217
219
  /**
218
220
  * cell 콘텐츠 가로 정렬
219
221
  */
220
- alignX?: TableCellAlign;
222
+ alignX?: TableCellAlignX;
221
223
  /**
222
224
  * cell 콘텐츠 세로 정렬
223
225
  */
@@ -231,10 +233,11 @@ export interface TableCellContentProps extends ComponentPropsWithoutRef<"div"> {
231
233
  */
232
234
  padding?: TableCellPadding;
233
235
  /**
234
- * cell 콘텐츠 가로 정렬(호환 alias)
235
- * @deprecated `alignX` 사용을 권장한다.
236
+ * cell 내부 콘텐츠 `span.table-cell-text.table-${section}-cell-text`
237
+ * `span.table-cell-text`
238
+ * `.table-${section}-cell-text`
236
239
  */
237
- align?: TableCellAlign;
240
+ children?: React.ReactNode;
238
241
  }
239
242
 
240
243
  /**
package/src/index.scss CHANGED
@@ -4,20 +4,21 @@
4
4
  @use "./components/calendar";
5
5
  @use "./components/checkbox";
6
6
  @use "./components/chip";
7
+ @use "./components/divider";
7
8
  @use "./components/drawer";
8
9
  @use "./components/dropdown";
9
- @use "./components/pop-over";
10
- @use "./components/tooltip";
11
- @use "./components/label";
12
- @use "./components/input";
13
- @use "./components/select";
14
10
  @use "./components/form";
11
+ @use "./components/info-box";
12
+ @use "./components/input";
13
+ @use "./components/label";
15
14
  @use "./components/navigation";
16
15
  @use "./components/pagination";
16
+ @use "./components/pop-over";
17
17
  @use "./components/radio";
18
18
  @use "./components/scrollbar";
19
19
  @use "./components/segmented-control";
20
+ @use "./components/select";
20
21
  @use "./components/spinner";
21
22
  @use "./components/tab";
22
23
  @use "./components/table";
23
- @use "./components/divider";
24
+ @use "./components/tooltip";
package/src/index.tsx CHANGED
@@ -1,34 +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/label";
9
- export * from "./components/input";
9
+ export * from "./components/calendar";
10
10
  export * from "./components/checkbox";
11
- export * from "./components/radio";
12
- export * from "./components/select";
13
- export * from "./components/tab";
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/tooltip";
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/divider";
25
+ export * from "./components/select";
29
26
  export * from "./components/slot";
30
- export * from "./components/info-box";
31
- export * from "./types";
32
-
33
- // 기타 도구
34
- export * from "./components/form";
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
- }
@@ -1,35 +0,0 @@
1
- "use client";
2
-
3
- import InputBaseUtilityButton from "../markup/foundation/Button";
4
- import type { VerificationRequestButtonOptions } from "../types";
5
-
6
- /**
7
- * 인증 요청 버튼의 기본 라벨.
8
- */
9
- const DEFAULT_REQUEST_LABEL = "인증번호 요청";
10
- /**
11
- * 인증 요청 버튼을 렌더링한다.
12
- * @function
13
- * @param {VerificationRequestButtonOptions} options 버튼 옵션
14
- * @returns {React.ReactNode} 버튼 노드
15
- */
16
- export const renderVerificationRequestButton = ({
17
- onRequestCode,
18
- requestButtonDisabled,
19
- requestButtonLabel = DEFAULT_REQUEST_LABEL,
20
- }: VerificationRequestButtonOptions): React.ReactNode => {
21
- // 인증 요청 핸들러가 없으면 버튼 자체를 렌더링하지 않는다.
22
- if (!onRequestCode) {
23
- return null;
24
- }
25
-
26
- return (
27
- <InputBaseUtilityButton
28
- priority="primary"
29
- onClick={onRequestCode}
30
- disabled={requestButtonDisabled}
31
- >
32
- {requestButtonLabel}
33
- </InputBaseUtilityButton>
34
- );
35
- };