@jk-core/components 1.1.8 → 1.1.10

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.
@@ -16,7 +16,7 @@ interface BreadcrumbsItemProps {
16
16
  * BreadcrumbsItem의 자식 요소로 표시될 텍스트입니다.
17
17
  * 경로를 나타내며, 클릭 시 해당 경로로 이동합니다.
18
18
  */
19
- children?: React.ReactNode;
19
+ children: React.ReactNode;
20
20
  /**
21
21
  * BreadcrumbsItem이 클릭되었을 때 이동할 경로입니다.
22
22
  * 기본값은 '/'로 설정되어 있습니다.
@@ -0,0 +1,8 @@
1
+ interface DividerProps {
2
+ children?: React.ReactNode;
3
+ textAlign?: 'left' | 'center' | 'right';
4
+ variant?: 'full' | 'middle' | 'short';
5
+ orientation?: 'horizontal' | 'vertical';
6
+ }
7
+ export default function Divider({ children, textAlign, variant, orientation, }: DividerProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -1,26 +1,30 @@
1
+ interface TableLabelType {
2
+ text: string | number;
3
+ align?: 'left' | 'center' | 'right';
4
+ }
1
5
  interface TableHeaderType {
2
- label: string;
6
+ label: TableLabelType;
3
7
  width?: string;
4
8
  subWidth?: string[];
5
- subLabel?: string[];
9
+ subLabel?: TableLabelType[];
6
10
  }
7
11
  interface TableBodyType {
8
- head?: string;
9
- labels: string[];
12
+ head?: TableLabelType;
13
+ labels: TableLabelType[];
10
14
  }
11
15
  interface TableProps {
12
16
  /**
13
17
  * 테이블 헤더 설정
14
- * - `label`: 헤더의 라벨 텍스트
18
+ * - `label`: 헤더의 라벨 텍스트, text와 align 속성을 포함한 객체
15
19
  * - `width`: 헤더의 너비, subWidth가 있을 경우 무시됨 (선택적)
16
20
  * - `subWidth`: 서브 헤더의 너비 배열 (선택적)
17
- * - `subLabel`: 서브 헤더의 라벨 배열 (선택적
21
+ * - `subLabel`: 서브 헤더의 라벨, text와 align 속성을 포함한 객체 배열 (선택적)
18
22
  */
19
23
  header: TableHeaderType[];
20
24
  /**
21
25
  * 테이블 바디 설정
22
- * - `head`: 바디의 헤더 텍스트 (선택적)
23
- * - `labels`: 각 행의 라벨 배열
26
+ * - `head`: 바디의 헤더 텍스트, text와 align 속성을 포함한 객체 (선택적)
27
+ * - `labels`: 각 행의 라벨 배열, text와 align 속성을 포함한 객체 배열
24
28
  */
25
29
  body: TableBodyType[];
26
30
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jk-core/components",
3
- "version": "1.1.8",
3
+ "version": "1.1.10",
4
4
  "type": "module",
5
5
  "main": "./dist/index.umd.cjs",
6
6
  "types": "./dist/index.d.ts",
@@ -6,6 +6,7 @@
6
6
  border: 1px solid var(--G-20);
7
7
  transition: margin-bottom 0.25s;
8
8
  border-radius: 5px;
9
+ font-size: 1em;
9
10
 
10
11
  &--visible {
11
12
  margin-bottom: 10px;
@@ -20,7 +21,7 @@
20
21
  justify-content: space-between;
21
22
  align-items: center;
22
23
  padding: 20px 10px;
23
- font-size: 18px;
24
+ font-size: 1.5em;
24
25
  font-weight: 500;
25
26
 
26
27
  &__arrow {
@@ -47,6 +48,6 @@
47
48
 
48
49
  .content {
49
50
  white-space: pre-wrap;
50
- font-size: 16px;
51
+ font-size: 1em;
51
52
  padding: 20px;
52
53
  }
@@ -13,6 +13,7 @@
13
13
  .item {
14
14
  display: flex;
15
15
  align-items: center;
16
+ gap: 5px;
16
17
  color: var(--G-60);
17
18
  font-size: 15px;
18
19
  font-weight: 500;
@@ -20,14 +20,15 @@ export default function Breadcrumbs({ children }: BreadcumbsProps) {
20
20
  <div className={styles.breadcrumbs}>
21
21
  {Array.isArray(children)
22
22
  ? children.map((child, idx) => (
23
- <Fragment key={idx}>
24
- {idx > 0 && (
25
- <div className={styles.separator}>
26
- {'>'}
27
- </div>
28
- )}
29
- {child}
30
- </Fragment>
23
+ (!!child &&
24
+ <Fragment key={idx}>
25
+ {idx > 0 && (
26
+ <div className={styles.separator}>
27
+ {'>'}
28
+ </div>
29
+ )}
30
+ {child}
31
+ </Fragment>)
31
32
  ))
32
33
  : children}
33
34
  </div>
@@ -39,7 +40,7 @@ interface BreadcrumbsItemProps {
39
40
  * BreadcrumbsItem의 자식 요소로 표시될 텍스트입니다.
40
41
  * 경로를 나타내며, 클릭 시 해당 경로로 이동합니다.
41
42
  */
42
- children?: React.ReactNode;
43
+ children: React.ReactNode;
43
44
  /**
44
45
  * BreadcrumbsItem이 클릭되었을 때 이동할 경로입니다.
45
46
  * 기본값은 '/'로 설정되어 있습니다.
@@ -41,12 +41,10 @@
41
41
 
42
42
  .button {
43
43
  position: relative;
44
- width: fit-content;
45
44
  border-radius: 8px;
46
45
  padding: 10px 24px;
47
46
  transition: background-color 0.1s;
48
- font-size: 17px;
49
- font-weight: 500;
47
+ font-size: 1em;
50
48
 
51
49
  &__loading {
52
50
  color: transparent !important;
@@ -34,7 +34,6 @@ export default function Button({
34
34
  return (
35
35
  <button
36
36
  className={cn({
37
- [className]: !!className,
38
37
  [styles.button]: true,
39
38
  [styles.button__loading]: isLoading,
40
39
  [styles.button__disabled]: !!disabled,
@@ -42,6 +41,7 @@ export default function Button({
42
41
  [styles.button__secondary]: grade === 'secondary',
43
42
  [styles.button__primary]: grade === 'primary',
44
43
  [styles.button__cancel]: grade === 'cancel',
44
+ [className]: !!className,
45
45
  })}
46
46
  type="button"
47
47
  disabled={disabled}
@@ -0,0 +1,101 @@
1
+ .divider {
2
+ display: flex;
3
+ align-items: center;
4
+ margin: 16px 0;
5
+ align-self: center;
6
+ justify-self: center;
7
+
8
+ &.vertical {
9
+ flex-direction: column;
10
+ height: 100px;
11
+ width: auto;
12
+ margin: 0 16px;
13
+ }
14
+ }
15
+
16
+ .content {
17
+ display: flex;
18
+ align-items: center;
19
+ width: 100%;
20
+
21
+ &::before,
22
+ &::after {
23
+ content: "";
24
+ flex: 1;
25
+ height: 1px;
26
+ background-color: var(--G-30);
27
+ }
28
+
29
+ .vertical & {
30
+ flex-direction: column;
31
+ height: 100%;
32
+ width: auto;
33
+
34
+ &::before,
35
+ &::after {
36
+ width: 1px;
37
+ height: auto;
38
+ flex: 1;
39
+ }
40
+ }
41
+ }
42
+
43
+ .text {
44
+ padding: 0 16px;
45
+ color: var(--G-70);
46
+ font-size: 14px;
47
+ white-space: nowrap;
48
+
49
+ .vertical & {
50
+ padding: 16px 0;
51
+ writing-mode: vertical-rl;
52
+ }
53
+ }
54
+
55
+ // 텍스트가 없을 때는 전체 라인만 표시
56
+ .noText .content {
57
+ &::before {
58
+ flex: 1;
59
+ }
60
+
61
+ &::after {
62
+ display: none;
63
+ }
64
+ }
65
+
66
+ // 정렬 옵션
67
+ .left .content::before {
68
+ flex: 0.2;
69
+ }
70
+
71
+ .right .content::after {
72
+ flex: 0.2;
73
+ }
74
+
75
+ .center .content::before,
76
+ .center .content::after {
77
+ flex: 1;
78
+ }
79
+
80
+ .full {
81
+ width: 100%;
82
+ height: 100%;
83
+ }
84
+
85
+ .middle {
86
+ width: 80%;
87
+ height: 80%;
88
+ }
89
+
90
+ .short {
91
+ width: 50%;
92
+ height: 50%;
93
+ }
94
+
95
+ .horizontal {
96
+ height: 1px !important;
97
+ }
98
+
99
+ .vertical {
100
+ width: 1px !important;
101
+ }
@@ -0,0 +1,25 @@
1
+ import styles from './Divider.module.scss';
2
+
3
+ interface DividerProps {
4
+ children?: React.ReactNode;
5
+ textAlign?: 'left' | 'center' | 'right';
6
+ variant?: 'full' | 'middle' | 'short';
7
+ orientation?: 'horizontal' | 'vertical';
8
+ }
9
+
10
+ export default function Divider({
11
+ children,
12
+ textAlign = 'center',
13
+ variant = 'full',
14
+ orientation = 'horizontal',
15
+ }: DividerProps) {
16
+ const hasText = Boolean(children);
17
+
18
+ return (
19
+ <div className={`${styles.divider} ${styles[variant]} ${styles[textAlign]} ${styles[orientation]} ${!hasText ? styles.noText : ''}`}>
20
+ <div className={styles.content}>
21
+ {children && <span className={styles.text}>{children}</span>}
22
+ </div>
23
+ </div>
24
+ );
25
+ }
@@ -6,6 +6,7 @@
6
6
  border-radius: 8px;
7
7
  z-index: 0;
8
8
  overflow: hidden;
9
+ font-size: 1em;
9
10
 
10
11
  &--selector {
11
12
  position: absolute;
@@ -28,7 +29,6 @@
28
29
  padding: 8px 5px;
29
30
  color: var(--G-40);
30
31
  transition: color 0.2s;
31
- font-size: 17px;
32
32
  font-weight: 500;
33
33
 
34
34
  & > div {
@@ -24,7 +24,6 @@
24
24
  z-index: 1;
25
25
  }
26
26
 
27
- thead > tr > th:last-child,
28
27
  tbody > tr > td:last-child {
29
28
  border-right: none;
30
29
  }
@@ -33,6 +32,7 @@
33
32
  flex-shrink: 0;
34
33
  background-color: var(--G-5);
35
34
  padding: 10px;
35
+ font-size: 1em;
36
36
  font-weight: 600;
37
37
  color: var(--G-80);
38
38
  border-right: 1px solid var(--G-30);
@@ -1,31 +1,35 @@
1
1
  import { cn } from '@jk-core/utils';
2
2
  import styles from './Table.module.scss';
3
3
 
4
+ interface TableLabelType{
5
+ text: string | number;
6
+ align?: 'left' | 'center' | 'right';
7
+ }
4
8
  interface TableHeaderType {
5
- label: string;
9
+ label: TableLabelType;
6
10
  width?: string;
7
11
  subWidth?: string[];
8
- subLabel?:string[];
12
+ subLabel?:TableLabelType[];
9
13
  }
10
14
 
11
15
  interface TableBodyType{
12
- head?: string;
13
- labels: string[];
16
+ head?: TableLabelType;
17
+ labels: TableLabelType[];
14
18
  }
15
19
 
16
20
  interface TableProps {
17
21
  /**
18
22
  * 테이블 헤더 설정
19
- * - `label`: 헤더의 라벨 텍스트
23
+ * - `label`: 헤더의 라벨 텍스트, text와 align 속성을 포함한 객체
20
24
  * - `width`: 헤더의 너비, subWidth가 있을 경우 무시됨 (선택적)
21
25
  * - `subWidth`: 서브 헤더의 너비 배열 (선택적)
22
- * - `subLabel`: 서브 헤더의 라벨 배열 (선택적
26
+ * - `subLabel`: 서브 헤더의 라벨, text와 align 속성을 포함한 객체 배열 (선택적)
23
27
  */
24
28
  header: TableHeaderType[];
25
29
  /**
26
30
  * 테이블 바디 설정
27
- * - `head`: 바디의 헤더 텍스트 (선택적)
28
- * - `labels`: 각 행의 라벨 배열
31
+ * - `head`: 바디의 헤더 텍스트, text와 align 속성을 포함한 객체 (선택적)
32
+ * - `labels`: 각 행의 라벨 배열, text와 align 속성을 포함한 객체 배열
29
33
  */
30
34
  body: TableBodyType[];
31
35
  /**
@@ -86,17 +90,22 @@ export default function Table({ header, body, rounded, border }: TableProps) {
86
90
  {header.map((col, index) => (
87
91
  <th
88
92
  key={index}
93
+ style={{ textAlign: col.label.align || 'left' }}
89
94
  rowSpan={col.subLabel ? 1 : 2}
90
95
  colSpan={col.subLabel ? col.subLabel.length : undefined}
91
96
  >
92
- {col.label}
97
+ {col.label.text}
93
98
  </th>
94
99
  ))}
95
100
  </tr>
96
101
  {subLabels.length > 0 && (
97
102
  <tr>
98
103
  {subLabels.map((subLabel, index) => (
99
- <th key={index}>{subLabel}</th>
104
+ <th
105
+ style={{ textAlign: subLabel.align || 'left' }}
106
+ key={index}
107
+ >{subLabel.text}
108
+ </th>
100
109
  ))}
101
110
  </tr>
102
111
  )}
@@ -104,10 +113,10 @@ export default function Table({ header, body, rounded, border }: TableProps) {
104
113
  <tbody>
105
114
  {body.map((row, rowIndex) => (
106
115
  <tr key={rowIndex}>
107
- {isBodyWithHead && <th>{row?.head || ''}</th>}
116
+ {isBodyWithHead && <th style={{ textAlign: row?.head?.align || 'left' }}>{row?.head?.text || ''}</th>}
108
117
  {row.labels.map((col, colIndex) => (
109
- <td key={colIndex}>
110
- {col}
118
+ <td style={{ textAlign: col.align || 'left' }} key={colIndex}>
119
+ {col.text}
111
120
  </td>
112
121
  ))}
113
122
  </tr>