@idbrnd/design-system 1.7.0 → 1.7.3
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 +245 -1
- package/dist/index.js +377 -386
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @idbrnd/design-system
|
|
2
2
|
|
|
3
|
-

|
|
4
4
|

|
|
5
5
|

|
|
6
6
|

|
|
@@ -63,6 +63,11 @@ export default function App() {
|
|
|
63
63
|
- [AvatarStack](#avatarstack)
|
|
64
64
|
- [ContentBadge](#contentbadge)
|
|
65
65
|
- [StateBadge](#statebadge)
|
|
66
|
+
- [Chip](#chip)
|
|
67
|
+
- [Chip](#chip-1)
|
|
68
|
+
- [ChipGroup](#chipgroup)
|
|
69
|
+
- [FilterChip](#filterchip)
|
|
70
|
+
- [FilterBar](#filterbar)
|
|
66
71
|
- [기타](#기타)
|
|
67
72
|
- [Spinner](#spinner)
|
|
68
73
|
|
|
@@ -601,6 +606,7 @@ import { Tooltip } from "@idbrnd/design-system";
|
|
|
601
606
|
- `position`의 첫 번째 단어는 툴팁이 놓이는 방향, 두 번째 단어는 화살표가 치우치는 방향입니다.
|
|
602
607
|
- `content`에 render function을 전달하면 닫기 버튼 등 인터랙션을 구현할 수 있습니다.
|
|
603
608
|
- 툴팁은 `document.body`에 포탈로 렌더링됩니다.
|
|
609
|
+
- 화살표는 회전된 정사각형(`rotate(45deg)`) 방식으로 렌더링됩니다. 툴팁 본체와 겹쳐 배치해 브라우저 줌 축소 시 발생하는 서브픽셀 갭을 방지하며, 개별 `rgba` 대신 부모 `opacity`를 사용해 겹침 영역의 투명도 이중 적용을 방지합니다.
|
|
604
610
|
|
|
605
611
|
---
|
|
606
612
|
|
|
@@ -918,6 +924,189 @@ import { StateBadge } from "@idbrnd/design-system";
|
|
|
918
924
|
|
|
919
925
|
---
|
|
920
926
|
|
|
927
|
+
## Chip
|
|
928
|
+
|
|
929
|
+
`Chip`, `ChipGroup`, `FilterChip`, `FilterBar` 4개의 컴포넌트로 구성됩니다.
|
|
930
|
+
|
|
931
|
+
### Chip
|
|
932
|
+
|
|
933
|
+
기본 칩 버튼 컴포넌트입니다.
|
|
934
|
+
|
|
935
|
+
```tsx
|
|
936
|
+
import { Chip } from "@idbrnd/design-system";
|
|
937
|
+
|
|
938
|
+
// 기본
|
|
939
|
+
<Chip>텍스트</Chip>
|
|
940
|
+
|
|
941
|
+
// variant + selected
|
|
942
|
+
<Chip variant="fill" selected>선택됨</Chip>
|
|
943
|
+
|
|
944
|
+
// 아이콘 포함
|
|
945
|
+
<Chip
|
|
946
|
+
leadingSlot={<img src="/icon.svg" width={16} height={16} alt="" />}
|
|
947
|
+
trailingSlot={<img src="/close.svg" width={16} height={16} alt="" />}
|
|
948
|
+
>
|
|
949
|
+
검색어
|
|
950
|
+
</Chip>
|
|
951
|
+
|
|
952
|
+
// 클릭 핸들러
|
|
953
|
+
<Chip variant="outline" selected={isSelected} onClick={() => setIsSelected(p => !p)}>
|
|
954
|
+
토글
|
|
955
|
+
</Chip>
|
|
956
|
+
```
|
|
957
|
+
|
|
958
|
+
| Prop | Type | Default | Description |
|
|
959
|
+
|------|------|---------|-------------|
|
|
960
|
+
| `variant` | `"fillWeak" \| "fill" \| "outline" \| "outlineSurface"` | `"outline"` | 칩 스타일 |
|
|
961
|
+
| `size` | `"large" \| "medium" \| "small" \| "xsmall"` | `"medium"` | 칩 크기 |
|
|
962
|
+
| `selected` | `boolean` | `false` | 선택 상태 |
|
|
963
|
+
| `disabled` | `boolean` | `false` | 비활성화 |
|
|
964
|
+
| `leadingSlot` | `ReactNode` | — | 텍스트 왼쪽 콘텐츠 |
|
|
965
|
+
| `trailingSlot` | `ReactNode` | — | 텍스트 오른쪽 콘텐츠 |
|
|
966
|
+
| `onClick` | `MouseEventHandler` | — | 클릭 핸들러 |
|
|
967
|
+
| `customStyle` | `CSSProperties` | — | 루트 엘리먼트 인라인 스타일 |
|
|
968
|
+
|
|
969
|
+
---
|
|
970
|
+
|
|
971
|
+
### ChipGroup
|
|
972
|
+
|
|
973
|
+
여러 `Chip`을 묶어서 표시하는 컨테이너입니다.
|
|
974
|
+
|
|
975
|
+
```tsx
|
|
976
|
+
import { Chip, ChipGroup } from "@idbrnd/design-system";
|
|
977
|
+
|
|
978
|
+
// selection — 줄바꿈 다중 선택
|
|
979
|
+
const [selected, setSelected] = useState<DropdownOption[]>([]);
|
|
980
|
+
|
|
981
|
+
function toggle(prev: DropdownOption[], item: DropdownOption) {
|
|
982
|
+
return prev.some(o => o.value === item.value)
|
|
983
|
+
? prev.filter(o => o.value !== item.value)
|
|
984
|
+
: [...prev, item];
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
<ChipGroup type="selection" leadingSlot={<span>카테고리</span>}>
|
|
988
|
+
{categories.map(({ label, value }) => (
|
|
989
|
+
<Chip
|
|
990
|
+
key={value}
|
|
991
|
+
variant="outline"
|
|
992
|
+
selected={selected.some(o => o.value === value)}
|
|
993
|
+
onClick={() => setSelected(prev => toggle(prev, { label, value }))}
|
|
994
|
+
>
|
|
995
|
+
{label}
|
|
996
|
+
</Chip>
|
|
997
|
+
))}
|
|
998
|
+
</ChipGroup>
|
|
999
|
+
|
|
1000
|
+
// suggestion — 가로 드래그 캐러셀 + 그라데이션
|
|
1001
|
+
<ChipGroup type="suggestion" gradient>
|
|
1002
|
+
{suggestions.map(({ label, value }) => (
|
|
1003
|
+
<Chip key={value} variant="fillWeak">{label}</Chip>
|
|
1004
|
+
))}
|
|
1005
|
+
</ChipGroup>
|
|
1006
|
+
```
|
|
1007
|
+
|
|
1008
|
+
| Prop | Type | Default | Description |
|
|
1009
|
+
|------|------|---------|-------------|
|
|
1010
|
+
| `type` | `"selection" \| "suggestion"` | `"selection"` | `selection`: 줄바꿈, `suggestion`: 가로 드래그 캐러셀 |
|
|
1011
|
+
| `size` | `"large" \| "medium" \| "small" \| "xsmall"` | `"medium"` | 칩 간격 크기 |
|
|
1012
|
+
| `gradient` | `boolean` | `false` | `suggestion` 타입에서 스크롤 시 양끝 그라데이션 표시 |
|
|
1013
|
+
| `leadingSlot` | `ReactNode` | — | 칩 목록 앞 텍스트/라벨 |
|
|
1014
|
+
| `leadingElementSlot` | `ReactNode` | — | 칩 목록 앞 구분선 포함 엘리먼트 |
|
|
1015
|
+
| `customStyle` | `CSSProperties` | — | 루트 엘리먼트 인라인 스타일 |
|
|
1016
|
+
|
|
1017
|
+
---
|
|
1018
|
+
|
|
1019
|
+
### FilterChip
|
|
1020
|
+
|
|
1021
|
+
드롭다운 옵션 선택 기능이 내장된 칩입니다. `trailingSlot`을 제외한 `Chip`의 모든 props를 지원합니다.
|
|
1022
|
+
|
|
1023
|
+
```tsx
|
|
1024
|
+
import { FilterChip } from "@idbrnd/design-system";
|
|
1025
|
+
import type { DropdownOption } from "@idbrnd/design-system";
|
|
1026
|
+
|
|
1027
|
+
const [sort, setSort] = useState<DropdownOption | undefined>();
|
|
1028
|
+
|
|
1029
|
+
// 기본
|
|
1030
|
+
<FilterChip
|
|
1031
|
+
variant="outline"
|
|
1032
|
+
options={sortOptions}
|
|
1033
|
+
selectedValue={sort?.value}
|
|
1034
|
+
onSelect={setSort}
|
|
1035
|
+
>
|
|
1036
|
+
{sort?.label ?? "정렬"}
|
|
1037
|
+
</FilterChip>
|
|
1038
|
+
|
|
1039
|
+
// showSelectedLabel — "소속 하의" 형태로 표시, 재클릭 시 선택 해제
|
|
1040
|
+
<FilterChip
|
|
1041
|
+
variant="outline"
|
|
1042
|
+
options={categoryOptions}
|
|
1043
|
+
selectedValue={category?.value}
|
|
1044
|
+
onSelect={setCategory}
|
|
1045
|
+
showSelectedLabel
|
|
1046
|
+
>
|
|
1047
|
+
소속
|
|
1048
|
+
</FilterChip>
|
|
1049
|
+
|
|
1050
|
+
// 검색형 드롭다운 + 너비 고정
|
|
1051
|
+
<FilterChip
|
|
1052
|
+
variant="outline"
|
|
1053
|
+
options={brandOptions}
|
|
1054
|
+
selectedValue={brand?.value}
|
|
1055
|
+
onSelect={setBrand}
|
|
1056
|
+
dropdownType="search"
|
|
1057
|
+
dropdownWidth={280}
|
|
1058
|
+
>
|
|
1059
|
+
{brand?.label ?? "브랜드"}
|
|
1060
|
+
</FilterChip>
|
|
1061
|
+
```
|
|
1062
|
+
|
|
1063
|
+
| Prop | Type | Default | Description |
|
|
1064
|
+
|------|------|---------|-------------|
|
|
1065
|
+
| `options` | `DropdownOption[]` | (필수) | 드롭다운 옵션 목록 |
|
|
1066
|
+
| `onSelect` | `(option: DropdownOption \| undefined) => void` | (필수) | 선택/해제 콜백. 이미 선택된 옵션 재클릭 시 `undefined` 전달 |
|
|
1067
|
+
| `selectedValue` | `string` | — | 현재 선택된 옵션의 `value` |
|
|
1068
|
+
| `dropdownType` | `"basic" \| "search"` | `"basic"` | `search`: 검색 입력란 포함 |
|
|
1069
|
+
| `dropdownAlign` | `"left" \| "center"` | `"left"` | 드롭다운 정렬 방향 |
|
|
1070
|
+
| `dropdownWidth` | `number` | — | 드롭다운 너비 (px) |
|
|
1071
|
+
| `showSelectedLabel` | `boolean` | `false` | `children`을 prefix로, 선택값 label을 옆에 함께 표시 |
|
|
1072
|
+
|
|
1073
|
+
---
|
|
1074
|
+
|
|
1075
|
+
### FilterBar
|
|
1076
|
+
|
|
1077
|
+
`FilterChip`들을 가로 드래그 캐러셀로 배치하는 컨테이너입니다.
|
|
1078
|
+
|
|
1079
|
+
```tsx
|
|
1080
|
+
import { FilterBar, FilterChip } from "@idbrnd/design-system";
|
|
1081
|
+
|
|
1082
|
+
<FilterBar
|
|
1083
|
+
leadingElementSlot={<img src="/filter-icon.svg" width={24} height={24} alt="" />}
|
|
1084
|
+
trailingElementSlot={<button onClick={handleReset}>초기화</button>}
|
|
1085
|
+
>
|
|
1086
|
+
<FilterChip options={sortOptions} selectedValue={sort?.value} onSelect={setSort} showSelectedLabel>
|
|
1087
|
+
정렬
|
|
1088
|
+
</FilterChip>
|
|
1089
|
+
<FilterChip options={categoryOptions} selectedValue={category?.value} onSelect={setCategory} showSelectedLabel>
|
|
1090
|
+
소속
|
|
1091
|
+
</FilterChip>
|
|
1092
|
+
</FilterBar>
|
|
1093
|
+
|
|
1094
|
+
// verticalPadding — 패딩 O, 그라데이션 X
|
|
1095
|
+
<FilterBar verticalPadding>
|
|
1096
|
+
<FilterChip ...>정렬</FilterChip>
|
|
1097
|
+
</FilterBar>
|
|
1098
|
+
```
|
|
1099
|
+
|
|
1100
|
+
| Prop | Type | Default | Description |
|
|
1101
|
+
|------|------|---------|-------------|
|
|
1102
|
+
| `size` | `"large" \| "medium" \| "small" \| "xsmall"` | `"medium"` | 칩 간격 및 슬롯 폰트 크기 |
|
|
1103
|
+
| `verticalPadding` | `boolean` | `false` | `true`: 위아래 8px 패딩, 그라데이션 없음. `false`: 그라데이션 사용 |
|
|
1104
|
+
| `leadingElementSlot` | `ReactNode` | — | 칩 목록 앞 구분선 포함 엘리먼트 |
|
|
1105
|
+
| `trailingElementSlot` | `ReactNode` | — | 칩 목록 뒤 엘리먼트 (초기화 버튼 등) |
|
|
1106
|
+
| `customStyle` | `CSSProperties` | — | 루트 엘리먼트 인라인 스타일 |
|
|
1107
|
+
|
|
1108
|
+
---
|
|
1109
|
+
|
|
921
1110
|
## 기타
|
|
922
1111
|
|
|
923
1112
|
### Spinner
|
|
@@ -946,8 +1135,43 @@ import { Spinner, CustomSpinner, Clip, FadeSpinner } from "@idbrnd/design-system
|
|
|
946
1135
|
|
|
947
1136
|
```tsx
|
|
948
1137
|
import type {
|
|
1138
|
+
// Button
|
|
949
1139
|
FillButtonProps,
|
|
1140
|
+
FillButtonSize,
|
|
1141
|
+
FillButtonVariant,
|
|
1142
|
+
FillButtonWidthType,
|
|
1143
|
+
OutlineButtonProps,
|
|
1144
|
+
OutlineButtonSize,
|
|
1145
|
+
OutlineButtonVariant,
|
|
1146
|
+
OutlineButtonWidthType,
|
|
1147
|
+
TextButtonProps,
|
|
1148
|
+
TextButtonSize,
|
|
1149
|
+
TextButtonVariant,
|
|
1150
|
+
TextButtonWidthType,
|
|
1151
|
+
WeakButtonProps,
|
|
1152
|
+
WeakButtonSize,
|
|
1153
|
+
WeakButtonVariant,
|
|
1154
|
+
WeakButtonWidthType,
|
|
1155
|
+
|
|
1156
|
+
// IconButton
|
|
1157
|
+
BasicIconButtonProps,
|
|
1158
|
+
BasicIconButtonSize,
|
|
1159
|
+
FillIconButtonProps,
|
|
1160
|
+
FillIconButtonSize,
|
|
1161
|
+
FillIconButtonVariant,
|
|
1162
|
+
OutlineIconButtonProps,
|
|
1163
|
+
OutlineIconButtonSize,
|
|
1164
|
+
|
|
1165
|
+
// Input
|
|
950
1166
|
InputProps,
|
|
1167
|
+
InputSize,
|
|
1168
|
+
InputVariant,
|
|
1169
|
+
DesignType,
|
|
1170
|
+
SearchBarProps,
|
|
1171
|
+
SearchBarSize,
|
|
1172
|
+
SearchBarVariant,
|
|
1173
|
+
|
|
1174
|
+
// Control
|
|
951
1175
|
CheckBoxProps,
|
|
952
1176
|
CheckBoxVariant,
|
|
953
1177
|
CheckBoxSize,
|
|
@@ -958,19 +1182,39 @@ import type {
|
|
|
958
1182
|
RadioDensity,
|
|
959
1183
|
ToggleSwitchProps,
|
|
960
1184
|
ToggleSwitchSize,
|
|
1185
|
+
|
|
1186
|
+
// Feedback
|
|
961
1187
|
ToastShowOptions,
|
|
1188
|
+
ToastVariant,
|
|
962
1189
|
SnackbarShowOptions,
|
|
1190
|
+
SnackbarVariant,
|
|
1191
|
+
PushBadgeProps,
|
|
1192
|
+
PushBadgeVariant,
|
|
1193
|
+
ClipProps,
|
|
1194
|
+
CustomSpinnerProps,
|
|
1195
|
+
FadeSpinnerProps,
|
|
1196
|
+
|
|
1197
|
+
// Tooltip
|
|
963
1198
|
TooltipProps,
|
|
964
1199
|
TooltipPosition,
|
|
965
1200
|
TooltipVariant,
|
|
966
1201
|
TooltipTrigger,
|
|
967
1202
|
TooltipContent,
|
|
1203
|
+
|
|
1204
|
+
// Content
|
|
1205
|
+
AvatarProps,
|
|
1206
|
+
AvatarSize,
|
|
1207
|
+
AvatarStackProps,
|
|
1208
|
+
AvatarStackSrc,
|
|
1209
|
+
AvatarStackSize,
|
|
968
1210
|
ContentBadgeProps,
|
|
969
1211
|
ContentBadgeVariant,
|
|
970
1212
|
ContentBadgeSize,
|
|
971
1213
|
StateBadgeProps,
|
|
972
1214
|
StateBadgeVariant,
|
|
973
1215
|
StateBadgeSize,
|
|
1216
|
+
|
|
1217
|
+
// Select & Dropdown
|
|
974
1218
|
SelectProps,
|
|
975
1219
|
SelectVariant,
|
|
976
1220
|
SelectSize,
|