@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
package/dist/styles.css
CHANGED
|
@@ -18,24 +18,30 @@
|
|
|
18
18
|
--button-default-gap-small: var(--spacing-gap-1);
|
|
19
19
|
--button-default-gap-medium: var(--spacing-gap-2);
|
|
20
20
|
--button-default-gap-large: var(--spacing-gap-3);
|
|
21
|
+
/* 변경: Figma node(705:13710) 기준 table 버튼 gap을 보정한다. */
|
|
22
|
+
--button-default-gap-table: var(--spacing-gap-1);
|
|
21
23
|
--button-default-padding-inline-base: var(--spacing-padding-4);
|
|
22
24
|
--button-default-padding-inline-small: var(--spacing-padding-6);
|
|
23
25
|
--button-default-padding-inline-medium: var(--spacing-padding-7);
|
|
24
26
|
--button-default-padding-inline-large: var(--spacing-padding-9);
|
|
27
|
+
--button-default-padding-inline-table: var(--spacing-padding-5);
|
|
25
28
|
--button-default-padding-block-base: 0px;
|
|
26
29
|
--button-default-padding-block-small: 0px;
|
|
27
30
|
--button-default-padding-block-medium: 0px;
|
|
28
31
|
--button-default-padding-block-large: 0px;
|
|
32
|
+
--button-default-padding-block-table: 0px;
|
|
29
33
|
/* default button sizing */
|
|
30
34
|
--button-default-width-min-base: var(--theme-size-small-2);
|
|
31
35
|
--button-default-height-small: var(--theme-size-small-3, 32px);
|
|
32
36
|
--button-default-height-medium: var(--theme-size-medium-1, 40px);
|
|
33
37
|
--button-default-height-large: var(--theme-size-medium-2, 48px);
|
|
34
38
|
--button-default-height-xlarge: var(--theme-size-medium-3, 56px);
|
|
39
|
+
--button-default-height-table: var(--theme-size-small-2, 24px);
|
|
35
40
|
--button-default-radius-small: var(--theme-radius-medium-3);
|
|
36
41
|
--button-default-radius-medium: var(--theme-radius-medium-3);
|
|
37
42
|
--button-default-radius-large: var(--theme-radius-large-1);
|
|
38
43
|
--button-default-radius-xlarge: var(--theme-radius-large-2);
|
|
44
|
+
--button-default-radius-table: var(--theme-radius-medium-2);
|
|
39
45
|
/* text buttons */
|
|
40
46
|
--button-text-padding-block-base: var(--spacing-padding-4, 8px);
|
|
41
47
|
--button-text-padding-inline-small: var(--spacing-padding-4, 8px);
|
|
@@ -90,6 +96,16 @@
|
|
|
90
96
|
--button-default-font-body-large-letter-spacing: var(
|
|
91
97
|
--font-body-large-letter-spacing
|
|
92
98
|
);
|
|
99
|
+
/* 변경: table 버튼은 caption-large 스케일(12px)을 사용한다. */
|
|
100
|
+
--button-default-font-caption-large-size: var(--font-caption-large-size);
|
|
101
|
+
/* 변경: table 버튼 텍스트는 font-weight를 400으로 고정한다. */
|
|
102
|
+
--button-default-font-caption-large-weight: 400;
|
|
103
|
+
--button-default-font-caption-large-line-height: var(
|
|
104
|
+
--font-caption-large-line-height
|
|
105
|
+
);
|
|
106
|
+
--button-default-font-caption-large-letter-spacing: var(
|
|
107
|
+
--font-caption-large-letter-spacing
|
|
108
|
+
);
|
|
93
109
|
--button-default-font-weight: 400;
|
|
94
110
|
/* default button colors (priority 기반) */
|
|
95
111
|
--button-default-neutral-foreground: var(--color-neutral-20);
|
|
@@ -166,7 +182,23 @@
|
|
|
166
182
|
--theme-checkbox-icon-disabled-selected: var(--color-common-100);
|
|
167
183
|
--theme-checkbox-focus-ring: rgba(2, 84, 255, 0.32);
|
|
168
184
|
--theme-chip-height: var(--theme-size-small-3, 32px);
|
|
169
|
-
--theme-chip-padding-
|
|
185
|
+
--theme-chip-padding-horizontal: var(--spacing-padding-5, 12px);
|
|
186
|
+
--theme-chip-gap: var(--spacing-gap-1, 4px);
|
|
187
|
+
/* 변경: table chip 수치를 Figma table 액션 셀 기준으로 보정한다. */
|
|
188
|
+
/* 변경: table chip 높이는 button table과 동일하게 24px로 맞춘다. */
|
|
189
|
+
--theme-chip-height-table: 24px;
|
|
190
|
+
--theme-chip-padding-horizontal-table: var(--spacing-padding-5, 12px);
|
|
191
|
+
--theme-chip-padding-left-table: var(--spacing-padding-5, 12px);
|
|
192
|
+
--theme-chip-padding-right-table: var(--spacing-padding-4, 8px);
|
|
193
|
+
/* 변경: table chip은 높이 24px 고정을 위해 수직 padding을 사용하지 않는다. */
|
|
194
|
+
--theme-chip-padding-block-table: 0px;
|
|
195
|
+
--theme-chip-gap-table: var(--spacing-gap-1, 4px);
|
|
196
|
+
--theme-chip-font-size-table: var(--font-caption-large-size, 12px);
|
|
197
|
+
/* 변경: table chip 텍스트는 font-weight를 400으로 고정한다. */
|
|
198
|
+
--theme-chip-font-weight-table: 400;
|
|
199
|
+
--theme-chip-line-height-table: var(--font-caption-large-line-height, 1.5);
|
|
200
|
+
/* 변경: Figma 705:13702 기준으로 table chip radius를 6px로 고정한다. */
|
|
201
|
+
--theme-chip-radius-table: var(--theme-radius-medium-2, 6px);
|
|
170
202
|
--theme-chip-radius: var(--theme-radius-medium-3, 8px);
|
|
171
203
|
--theme-chip-rounded-radius: var(--theme-radius-large-2, 16px);
|
|
172
204
|
--theme-chip-font-family: var(--font-body-medium-family, "Pretendard");
|
|
@@ -948,6 +980,19 @@
|
|
|
948
980
|
line-height: var(--button-default-font-body-large-line-height, var(--font-body-large-line-height, 1.5em));
|
|
949
981
|
letter-spacing: var(--button-default-font-body-large-letter-spacing, var(--font-body-large-letter-spacing, 0px));
|
|
950
982
|
}
|
|
983
|
+
.button:where(.button-size-table) {
|
|
984
|
+
padding-inline: var(--button-default-padding-inline-table, var(--spacing-padding-5, 12px));
|
|
985
|
+
gap: var(--button-default-gap-table, var(--spacing-gap-1, 4px));
|
|
986
|
+
padding-block: var(--button-default-padding-block-table, 0px);
|
|
987
|
+
min-height: var(--button-default-height-table, var(--theme-size-small-2, 24px));
|
|
988
|
+
border-radius: var(--button-default-radius-table, var(--theme-radius-medium-2, 6px));
|
|
989
|
+
}
|
|
990
|
+
.button:where(.button-size-table) span {
|
|
991
|
+
font-size: var(--button-default-font-caption-large-size, var(--font-caption-large-size, 12px));
|
|
992
|
+
font-weight: var(--button-default-font-caption-large-weight, var(--button-default-font-weight, 400));
|
|
993
|
+
line-height: var(--button-default-font-caption-large-line-height, var(--font-caption-large-line-height, 1.5em));
|
|
994
|
+
letter-spacing: var(--button-default-font-caption-large-letter-spacing, var(--font-caption-large-letter-spacing, 0px));
|
|
995
|
+
}
|
|
951
996
|
.button:where(.button-fill-outlined) {
|
|
952
997
|
box-shadow: none;
|
|
953
998
|
}
|
|
@@ -1480,7 +1525,7 @@
|
|
|
1480
1525
|
|
|
1481
1526
|
|
|
1482
1527
|
.chip {
|
|
1483
|
-
--chip-gap: var(--
|
|
1528
|
+
--chip-gap: var(--theme-chip-gap);
|
|
1484
1529
|
--chip-bg: transparent;
|
|
1485
1530
|
--chip-border-color: transparent;
|
|
1486
1531
|
--chip-label-color: var(--color-label-standard, #3d3f43);
|
|
@@ -1489,7 +1534,8 @@
|
|
|
1489
1534
|
justify-content: center;
|
|
1490
1535
|
gap: var(--chip-gap);
|
|
1491
1536
|
height: var(--theme-chip-height);
|
|
1492
|
-
padding-
|
|
1537
|
+
padding-left: var(--theme-chip-padding-horizontal);
|
|
1538
|
+
padding-right: var(--theme-chip-padding-horizontal);
|
|
1493
1539
|
padding-block: 0;
|
|
1494
1540
|
border-radius: var(--theme-chip-radius);
|
|
1495
1541
|
border: 1px solid var(--chip-border-color);
|
|
@@ -1553,8 +1599,34 @@ figure.chip {
|
|
|
1553
1599
|
--chip-bg: var(--color-common-100, #ffffff);
|
|
1554
1600
|
--chip-label-color: var(--color-label-standard, #3d3f43);
|
|
1555
1601
|
--chip-border-color: var(--color-border-assistive, #e4e5e7);
|
|
1556
|
-
padding-
|
|
1557
|
-
padding-
|
|
1602
|
+
padding-left: var(--spacing-padding-4, 8px);
|
|
1603
|
+
padding-right: var(--spacing-padding-2, 4px);
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
.chip:where([data-size=table]) {
|
|
1607
|
+
height: var(--theme-chip-height-table);
|
|
1608
|
+
padding-left: var(--theme-chip-padding-horizontal-table);
|
|
1609
|
+
padding-right: var(--theme-chip-padding-horizontal-table);
|
|
1610
|
+
padding-block: var(--theme-chip-padding-block-table);
|
|
1611
|
+
--chip-gap: var(--theme-chip-gap-table);
|
|
1612
|
+
font-size: var(--theme-chip-font-size-table);
|
|
1613
|
+
font-weight: var(--theme-chip-font-weight-table);
|
|
1614
|
+
line-height: var(--theme-chip-line-height-table);
|
|
1615
|
+
border-radius: var(--theme-chip-radius-table);
|
|
1616
|
+
}
|
|
1617
|
+
|
|
1618
|
+
.chip:where([data-size=table]) .chip-label {
|
|
1619
|
+
line-height: var(--theme-chip-line-height-table);
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1622
|
+
.chip:where([data-size=table][data-kind=input]) {
|
|
1623
|
+
padding-left: var(--theme-chip-padding-left-table);
|
|
1624
|
+
padding-right: var(--theme-chip-padding-right-table);
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
.chip:where([data-size=table][data-kind=input]) .chip-remove-button {
|
|
1628
|
+
width: fit-content;
|
|
1629
|
+
height: fit-content;
|
|
1558
1630
|
}
|
|
1559
1631
|
|
|
1560
1632
|
.chip:where([data-kind=input][data-selected=true]) {
|
|
@@ -1562,7 +1634,7 @@ figure.chip {
|
|
|
1562
1634
|
}
|
|
1563
1635
|
|
|
1564
1636
|
.chip-leading {
|
|
1565
|
-
display:
|
|
1637
|
+
display: flex;
|
|
1566
1638
|
align-items: center;
|
|
1567
1639
|
justify-content: center;
|
|
1568
1640
|
color: inherit;
|
|
@@ -1570,7 +1642,7 @@ figure.chip {
|
|
|
1570
1642
|
}
|
|
1571
1643
|
|
|
1572
1644
|
.chip-label {
|
|
1573
|
-
display:
|
|
1645
|
+
display: flex;
|
|
1574
1646
|
align-items: center;
|
|
1575
1647
|
gap: var(--spacing-gap-1, 4px);
|
|
1576
1648
|
color: inherit;
|
|
@@ -1579,11 +1651,11 @@ figure.chip {
|
|
|
1579
1651
|
}
|
|
1580
1652
|
|
|
1581
1653
|
.chip-remove-button {
|
|
1582
|
-
display:
|
|
1654
|
+
display: flex;
|
|
1583
1655
|
align-items: center;
|
|
1584
1656
|
justify-content: center;
|
|
1585
|
-
width:
|
|
1586
|
-
height:
|
|
1657
|
+
width: fit-content;
|
|
1658
|
+
height: fit-content;
|
|
1587
1659
|
border: none;
|
|
1588
1660
|
background: transparent;
|
|
1589
1661
|
color: var(--color-label-neutral, #797e86);
|
package/package.json
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
* "outlined-xlarge" | "outlined-large" | "outlined-medium" | "outlined-small"
|
|
23
23
|
* } [props.scale="solid-medium"] legacy spacing 식별자. fill/size가 없을 때만 fallback 용도로 사용한다.
|
|
24
24
|
* @param {"solid" | "outlined"} [props.fill] 채움 스타일. scale과 별개로 직접 지정할 수 있다.
|
|
25
|
-
* @param {"xlarge" | "large" | "medium" | "small"} [props.size] 버튼 높이/타이포 스케일.
|
|
25
|
+
* @param {"xlarge" | "large" | "medium" | "small" | "table"} [props.size] 버튼 높이/타이포 스케일. table은 셀 액션용 compact(24px) 규격이다.
|
|
26
26
|
* @param {"primary" | "secondary" | "tertiary"} [props.priority="primary"] semantic color 세트.
|
|
27
27
|
* @param {"default" | "readonly" | "disabled"} [props.state="default"] 내부 state. disabled prop과 조합된다.
|
|
28
28
|
* @param {boolean} [props.block=false] true면 width 100%.
|
|
@@ -450,6 +450,38 @@ $button-priorities: (
|
|
|
450
450
|
var(--theme-radius-large-2, 16px)
|
|
451
451
|
),
|
|
452
452
|
),
|
|
453
|
+
table: (
|
|
454
|
+
padding-inline: var(
|
|
455
|
+
--button-default-padding-inline-table,
|
|
456
|
+
var(--spacing-padding-5, 12px)
|
|
457
|
+
),
|
|
458
|
+
gap: var(--button-default-gap-table, var(--spacing-gap-1, 4px)),
|
|
459
|
+
padding-block: var(--button-default-padding-block-table, 0px),
|
|
460
|
+
text-font-size: var(
|
|
461
|
+
--button-default-font-caption-large-size,
|
|
462
|
+
var(--font-caption-large-size, 12px)
|
|
463
|
+
),
|
|
464
|
+
text-font-weight: var(
|
|
465
|
+
--button-default-font-caption-large-weight,
|
|
466
|
+
var(--button-default-font-weight, 400)
|
|
467
|
+
),
|
|
468
|
+
text-line-height: var(
|
|
469
|
+
--button-default-font-caption-large-line-height,
|
|
470
|
+
var(--font-caption-large-line-height, 1.5em)
|
|
471
|
+
),
|
|
472
|
+
text-letter-spacing: var(
|
|
473
|
+
--button-default-font-caption-large-letter-spacing,
|
|
474
|
+
var(--font-caption-large-letter-spacing, 0px)
|
|
475
|
+
),
|
|
476
|
+
min-height: var(
|
|
477
|
+
--button-default-height-table,
|
|
478
|
+
var(--theme-size-small-2, 24px)
|
|
479
|
+
),
|
|
480
|
+
radius: var(
|
|
481
|
+
--button-default-radius-table,
|
|
482
|
+
var(--theme-radius-medium-2, 6px)
|
|
483
|
+
),
|
|
484
|
+
),
|
|
453
485
|
);
|
|
454
486
|
|
|
455
487
|
@each $size, $tokens in $button-size-map {
|
|
@@ -8,15 +8,19 @@
|
|
|
8
8
|
--button-default-gap-small: var(--spacing-gap-1);
|
|
9
9
|
--button-default-gap-medium: var(--spacing-gap-2);
|
|
10
10
|
--button-default-gap-large: var(--spacing-gap-3);
|
|
11
|
+
/* 변경: Figma node(705:13710) 기준 table 버튼 gap을 보정한다. */
|
|
12
|
+
--button-default-gap-table: var(--spacing-gap-1);
|
|
11
13
|
|
|
12
14
|
--button-default-padding-inline-base: var(--spacing-padding-4);
|
|
13
15
|
--button-default-padding-inline-small: var(--spacing-padding-6);
|
|
14
16
|
--button-default-padding-inline-medium: var(--spacing-padding-7);
|
|
15
17
|
--button-default-padding-inline-large: var(--spacing-padding-9);
|
|
18
|
+
--button-default-padding-inline-table: var(--spacing-padding-5);
|
|
16
19
|
--button-default-padding-block-base: 0px;
|
|
17
20
|
--button-default-padding-block-small: 0px;
|
|
18
21
|
--button-default-padding-block-medium: 0px;
|
|
19
22
|
--button-default-padding-block-large: 0px;
|
|
23
|
+
--button-default-padding-block-table: 0px;
|
|
20
24
|
|
|
21
25
|
/* default button sizing */
|
|
22
26
|
--button-default-width-min-base: var(--theme-size-small-2);
|
|
@@ -25,11 +29,13 @@
|
|
|
25
29
|
--button-default-height-medium: var(--theme-size-medium-1, 40px);
|
|
26
30
|
--button-default-height-large: var(--theme-size-medium-2, 48px);
|
|
27
31
|
--button-default-height-xlarge: var(--theme-size-medium-3, 56px);
|
|
32
|
+
--button-default-height-table: var(--theme-size-small-2, 24px);
|
|
28
33
|
|
|
29
34
|
--button-default-radius-small: var(--theme-radius-medium-3);
|
|
30
35
|
--button-default-radius-medium: var(--theme-radius-medium-3);
|
|
31
36
|
--button-default-radius-large: var(--theme-radius-large-1);
|
|
32
37
|
--button-default-radius-xlarge: var(--theme-radius-large-2);
|
|
38
|
+
--button-default-radius-table: var(--theme-radius-medium-2);
|
|
33
39
|
|
|
34
40
|
/* text buttons */
|
|
35
41
|
--button-text-padding-block-base: var(--spacing-padding-4, 8px);
|
|
@@ -87,6 +93,16 @@
|
|
|
87
93
|
--button-default-font-body-large-letter-spacing: var(
|
|
88
94
|
--font-body-large-letter-spacing
|
|
89
95
|
);
|
|
96
|
+
/* 변경: table 버튼은 caption-large 스케일(12px)을 사용한다. */
|
|
97
|
+
--button-default-font-caption-large-size: var(--font-caption-large-size);
|
|
98
|
+
/* 변경: table 버튼 텍스트는 font-weight를 400으로 고정한다. */
|
|
99
|
+
--button-default-font-caption-large-weight: 400;
|
|
100
|
+
--button-default-font-caption-large-line-height: var(
|
|
101
|
+
--font-caption-large-line-height
|
|
102
|
+
);
|
|
103
|
+
--button-default-font-caption-large-letter-spacing: var(
|
|
104
|
+
--font-caption-large-letter-spacing
|
|
105
|
+
);
|
|
90
106
|
--button-default-font-weight: 400;
|
|
91
107
|
|
|
92
108
|
/* default button colors (priority 기반) */
|
|
@@ -1,181 +1,5 @@
|
|
|
1
|
-
import type { ComponentPropsWithoutRef, ElementType, ReactNode } from "react";
|
|
2
|
-
import type { FormFieldWidth } from "../../form/types";
|
|
3
|
-
|
|
4
1
|
/**
|
|
5
|
-
* Button;
|
|
6
|
-
* @desc
|
|
7
|
-
* - primary: 브랜드 컬러를 사용하는 기본 버튼.
|
|
8
|
-
* - secondary: 보조 강조 색상.
|
|
9
|
-
* - tertiary: 중립/회색 계열 보조 버튼.
|
|
2
|
+
* Button Types; barrel export 전용 파일
|
|
10
3
|
*/
|
|
11
|
-
export type
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Button; fill 옵션
|
|
15
|
-
* @desc
|
|
16
|
-
* - solid: 배경을 채우는 스타일.
|
|
17
|
-
* - outlined: 배경을 비우고 선만 두르는 스타일.
|
|
18
|
-
*/
|
|
19
|
-
export type ButtonFill = "solid" | "outlined";
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Button; size 옵션
|
|
23
|
-
* @desc
|
|
24
|
-
* - xlarge: 데스크톱 주요 CTA.
|
|
25
|
-
* - large: 일반 CTA.
|
|
26
|
-
* - medium: 기본/폼 버튼.
|
|
27
|
-
* - small: 보조/툴바 버튼.
|
|
28
|
-
*/
|
|
29
|
-
export type ButtonSize = "xlarge" | "large" | "medium" | "small";
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* fill/size 조합으로 구성된 scale 식별자.
|
|
33
|
-
* @deprecated
|
|
34
|
-
* @desc
|
|
35
|
-
* - solid-xlarge~solid-small: Solid fill + size 조합.
|
|
36
|
-
* - outlined-xlarge~outlined-small: Outline fill + size 조합.
|
|
37
|
-
*/
|
|
38
|
-
export type ButtonScale =
|
|
39
|
-
| "solid-xlarge"
|
|
40
|
-
| "solid-large"
|
|
41
|
-
| "solid-medium"
|
|
42
|
-
| "solid-small"
|
|
43
|
-
| "outlined-xlarge"
|
|
44
|
-
| "outlined-large"
|
|
45
|
-
| "outlined-medium"
|
|
46
|
-
| "outlined-small";
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Button; state 옵션
|
|
50
|
-
* @desc
|
|
51
|
-
* - default: 일반 상태.
|
|
52
|
-
* - readonly: 조작은 막고 비주얼만 유지.
|
|
53
|
-
* - disabled: 비활성화.
|
|
54
|
-
*/
|
|
55
|
-
export type ButtonState = "default" | "readonly" | "disabled";
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Button; 인터랙션 상태 고정을 위한 data-user-action 옵션
|
|
59
|
-
* @optional
|
|
60
|
-
* @desc
|
|
61
|
-
* - hover: hover 비주얼 강제 노출.
|
|
62
|
-
* - pressed: pressed 비주얼 강제 노출.
|
|
63
|
-
*/
|
|
64
|
-
export type ButtonUserAction = "hover" | "pressed";
|
|
65
|
-
/**
|
|
66
|
-
* @deprecated
|
|
67
|
-
*/
|
|
68
|
-
export type ButtonScaleGroup = ButtonFill;
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Button; <button /> native props 타입
|
|
72
|
-
*/
|
|
73
|
-
type NativeButtonProps = ComponentPropsWithoutRef<"button">;
|
|
74
|
-
/**
|
|
75
|
-
* Button; <a /> native props 타입
|
|
76
|
-
*/
|
|
77
|
-
type AnchorProps = ComponentPropsWithoutRef<"a">;
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Button; 컴포넌트 공통 props 타입
|
|
81
|
-
*/
|
|
82
|
-
type SharedElementProps = Omit<NativeButtonProps, "children"> &
|
|
83
|
-
Omit<AnchorProps, "children">;
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Button 컴포넌트의 공통 props.
|
|
87
|
-
* @property {ElementType} [as] 렌더링할 요소. 기본값은 button.
|
|
88
|
-
* @property {ReactNode} [children] 주 내용. 문자열이면 자동으로 .button-label로 감싼다.
|
|
89
|
-
* @property {ButtonScale} [scale] 레이아웃/spacing 집합. 추후 fill/size 조합으로 대체 예정이다.
|
|
90
|
-
* @property {ButtonFill} fill 채움 스타일. scale 조합보다 우선한다.
|
|
91
|
-
* @property {ButtonSize} size 높이/타이포 스케일. scale 조합보다 우선한다.
|
|
92
|
-
* @property {ButtonPriority} priority semantic color priority.
|
|
93
|
-
* @property {ButtonState} [state] UI 상태. disabled prop과 조합된다.
|
|
94
|
-
* @property {boolean} [block] width:100% 확장 여부.
|
|
95
|
-
* @property {FormFieldWidth} [width] width preset. block보다 우선 적용된다.
|
|
96
|
-
* @property {boolean} [loading] true면 readonly 처리 + aria-busy.
|
|
97
|
-
* @property {ReactNode} [left] 라벨 왼쪽 커스텀 슬롯.
|
|
98
|
-
* @property {ReactNode} [right] 라벨 오른쪽 커스텀 슬롯.
|
|
99
|
-
* @property {ButtonUserAction} ["data-user-action"] Interation 상태 강제 표현용 data attr.
|
|
100
|
-
*/
|
|
101
|
-
export interface ButtonProps extends SharedElementProps {
|
|
102
|
-
/**
|
|
103
|
-
* 렌더링할 요소 타입.
|
|
104
|
-
* 기본값은 button.
|
|
105
|
-
*/
|
|
106
|
-
as?: ElementType;
|
|
107
|
-
/**
|
|
108
|
-
* 버튼 라벨 또는 컨텐츠.
|
|
109
|
-
* 문자열/숫자는 .button-label span으로 감싼다.
|
|
110
|
-
*/
|
|
111
|
-
children?: ReactNode;
|
|
112
|
-
/**
|
|
113
|
-
* @deprecated
|
|
114
|
-
* fill/size를 제공하지 않을 때만 fallback으로 사용한다.
|
|
115
|
-
*/
|
|
116
|
-
scale?: ButtonScale;
|
|
117
|
-
/**
|
|
118
|
-
* @required
|
|
119
|
-
* - primary
|
|
120
|
-
* - secondary
|
|
121
|
-
* - tertiary
|
|
122
|
-
*/
|
|
123
|
-
priority: ButtonPriority;
|
|
124
|
-
/**
|
|
125
|
-
* @required
|
|
126
|
-
* - solid
|
|
127
|
-
* - outlined
|
|
128
|
-
*/
|
|
129
|
-
fill: ButtonFill;
|
|
130
|
-
/**
|
|
131
|
-
* @required
|
|
132
|
-
* - xlarge
|
|
133
|
-
* - large
|
|
134
|
-
* - medium
|
|
135
|
-
* - small
|
|
136
|
-
*/
|
|
137
|
-
size: ButtonSize;
|
|
138
|
-
/**
|
|
139
|
-
* 컴포넌트 내부 state.
|
|
140
|
-
* disabled prop과 병합되어 최종 상태를 결정한다.
|
|
141
|
-
* - default
|
|
142
|
-
* - readonly
|
|
143
|
-
* - disabled
|
|
144
|
-
*/
|
|
145
|
-
state?: ButtonState;
|
|
146
|
-
/**
|
|
147
|
-
* true면 버튼 폭을 100%로 확장한다.
|
|
148
|
-
*/
|
|
149
|
-
block?: boolean;
|
|
150
|
-
/**
|
|
151
|
-
* width preset.
|
|
152
|
-
* block보다 우선 적용된다.
|
|
153
|
-
*/
|
|
154
|
-
width?: FormFieldWidth;
|
|
155
|
-
/**
|
|
156
|
-
* true면 readonly 상태로 전환하고 aria-busy를 설정한다.
|
|
157
|
-
*/
|
|
158
|
-
loading?: boolean;
|
|
159
|
-
/**
|
|
160
|
-
* 라벨 왼쪽 커스텀 슬롯.
|
|
161
|
-
*/
|
|
162
|
-
left?: ReactNode;
|
|
163
|
-
/**
|
|
164
|
-
* 라벨 오른쪽 커스텀 슬롯.
|
|
165
|
-
*/
|
|
166
|
-
right?: ReactNode;
|
|
167
|
-
/**
|
|
168
|
-
* Storybook 등에서 hover/pressed 상태를 강제로 표현하기 위한 data attribute.
|
|
169
|
-
* - hover
|
|
170
|
-
* - pressed
|
|
171
|
-
*/
|
|
172
|
-
"data-user-action"?: ButtonUserAction;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
export type {
|
|
176
|
-
TextButtonProps,
|
|
177
|
-
TextButtonPriority,
|
|
178
|
-
TextButtonSize,
|
|
179
|
-
RoundButtonProps,
|
|
180
|
-
RoundButtonSize,
|
|
181
|
-
} from "./templates";
|
|
4
|
+
export type * from "./props";
|
|
5
|
+
export * from "./options";
|
|
@@ -6,19 +6,32 @@ import type {
|
|
|
6
6
|
ButtonSize,
|
|
7
7
|
ButtonState,
|
|
8
8
|
ButtonUserAction,
|
|
9
|
-
} from "
|
|
9
|
+
} from "./props";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* scale
|
|
12
|
+
* Button Types; scale 구성 객체 타입
|
|
13
|
+
* @property {ButtonFill} fill fill 옵션.
|
|
14
|
+
* @property {ButtonScaleGroup} group scale group 옵션.
|
|
15
|
+
* @property {ButtonSize} size size 옵션.
|
|
13
16
|
* @deprecated
|
|
14
17
|
*/
|
|
15
18
|
type ButtonScaleConfig = {
|
|
19
|
+
/**
|
|
20
|
+
* fill 옵션.
|
|
21
|
+
*/
|
|
16
22
|
fill: ButtonFill;
|
|
23
|
+
/**
|
|
24
|
+
* scale group 옵션.
|
|
25
|
+
*/
|
|
17
26
|
group: ButtonScaleGroup;
|
|
27
|
+
/**
|
|
28
|
+
* size 옵션.
|
|
29
|
+
*/
|
|
18
30
|
size: ButtonSize;
|
|
19
31
|
};
|
|
20
32
|
|
|
21
33
|
/**
|
|
34
|
+
* Button Types; scale 구성 헬퍼
|
|
22
35
|
* @deprecated
|
|
23
36
|
*/
|
|
24
37
|
const createScaleConfig = (
|
|
@@ -32,7 +45,7 @@ const createScaleConfig = (
|
|
|
32
45
|
});
|
|
33
46
|
|
|
34
47
|
/**
|
|
35
|
-
*
|
|
48
|
+
* Button Types; priority 옵션 목록
|
|
36
49
|
*/
|
|
37
50
|
export const BUTTON_PRIORITIES: ButtonPriority[] = [
|
|
38
51
|
"primary",
|
|
@@ -41,7 +54,7 @@ export const BUTTON_PRIORITIES: ButtonPriority[] = [
|
|
|
41
54
|
] as const;
|
|
42
55
|
|
|
43
56
|
/**
|
|
44
|
-
*
|
|
57
|
+
* Button Types; scale 옵션 목록
|
|
45
58
|
* @deprecated
|
|
46
59
|
*/
|
|
47
60
|
export const BUTTON_SCALES: ButtonScale[] = [
|
|
@@ -56,21 +69,23 @@ export const BUTTON_SCALES: ButtonScale[] = [
|
|
|
56
69
|
] as const;
|
|
57
70
|
|
|
58
71
|
/**
|
|
59
|
-
*
|
|
72
|
+
* Button Types; fill 옵션 목록
|
|
60
73
|
*/
|
|
61
74
|
export const BUTTON_FILLS: ButtonFill[] = ["solid", "outlined"] as const;
|
|
62
75
|
/**
|
|
63
|
-
*
|
|
76
|
+
* Button Types; size 옵션 목록
|
|
77
|
+
* table은 Table 셀 내 액션 버튼 전용 size 축이다.
|
|
64
78
|
*/
|
|
65
79
|
export const BUTTON_SIZES: ButtonSize[] = [
|
|
66
80
|
"xlarge",
|
|
67
81
|
"large",
|
|
68
82
|
"medium",
|
|
69
83
|
"small",
|
|
84
|
+
"table",
|
|
70
85
|
] as const;
|
|
71
86
|
|
|
72
87
|
/**
|
|
73
|
-
*
|
|
88
|
+
* Button Types; state 옵션 목록
|
|
74
89
|
*/
|
|
75
90
|
export const BUTTON_STATES: ButtonState[] = [
|
|
76
91
|
"default",
|
|
@@ -79,7 +94,7 @@ export const BUTTON_STATES: ButtonState[] = [
|
|
|
79
94
|
] as const;
|
|
80
95
|
|
|
81
96
|
/**
|
|
82
|
-
* data-user-action
|
|
97
|
+
* Button Types; data-user-action 옵션 목록
|
|
83
98
|
*/
|
|
84
99
|
export const BUTTON_USER_ACTIONS: ButtonUserAction[] = [
|
|
85
100
|
"hover",
|
|
@@ -87,7 +102,7 @@ export const BUTTON_USER_ACTIONS: ButtonUserAction[] = [
|
|
|
87
102
|
] as const;
|
|
88
103
|
|
|
89
104
|
/**
|
|
90
|
-
* scale -> fill/size/group 매핑
|
|
105
|
+
* Button Types; scale -> fill/size/group 매핑
|
|
91
106
|
* @deprecated
|
|
92
107
|
*/
|
|
93
108
|
export const BUTTON_SCALE_CONFIG: Record<ButtonScale, ButtonScaleConfig> = {
|
|
@@ -102,7 +117,7 @@ export const BUTTON_SCALE_CONFIG: Record<ButtonScale, ButtonScaleConfig> = {
|
|
|
102
117
|
};
|
|
103
118
|
|
|
104
119
|
/**
|
|
105
|
-
*
|
|
120
|
+
* Button Types; group -> scale 목록 매핑
|
|
106
121
|
* @deprecated
|
|
107
122
|
*/
|
|
108
123
|
export const BUTTON_SCALE_GROUPS: Record<ButtonScaleGroup, ButtonScale[]> = {
|
|
@@ -116,7 +131,7 @@ export const BUTTON_SCALE_GROUPS: Record<ButtonScaleGroup, ButtonScale[]> = {
|
|
|
116
131
|
};
|
|
117
132
|
|
|
118
133
|
/**
|
|
119
|
-
* Button
|
|
134
|
+
* Button Types; 기본 옵션 값
|
|
120
135
|
*/
|
|
121
136
|
export const DEFAULT_BUTTON_PRIORITY: ButtonPriority = "primary";
|
|
122
137
|
/**
|
|
@@ -127,12 +142,12 @@ export const DEFAULT_BUTTON_FILL: ButtonFill = "solid";
|
|
|
127
142
|
export const DEFAULT_BUTTON_SIZE: ButtonSize = "medium";
|
|
128
143
|
|
|
129
144
|
/**
|
|
130
|
-
* fill/size
|
|
145
|
+
* Button Types; fill/size 조합의 scale 매핑
|
|
131
146
|
* @deprecated
|
|
132
147
|
*/
|
|
133
148
|
export const BUTTON_SCALE_COMBO_MAP: Record<
|
|
134
149
|
ButtonFill,
|
|
135
|
-
Record<ButtonSize, ButtonScale>
|
|
150
|
+
Record<Exclude<ButtonSize, "table">, ButtonScale>
|
|
136
151
|
> = {
|
|
137
152
|
solid: {
|
|
138
153
|
xlarge: "solid-xlarge",
|