@conscience-technology/ctds 0.0.0-stage → 0.1.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/README.md +128 -2
- package/assets/components/AppFrame/AppFrame.module.css +177 -0
- package/assets/components/AppFrame/AppFrame.tsx +93 -0
- package/assets/components/AppFrame/index.ts +6 -0
- package/assets/components/AttachmentChip/AttachmentChip.module.css +71 -0
- package/assets/components/AttachmentChip/AttachmentChip.tsx +74 -0
- package/assets/components/AttachmentChip/index.ts +2 -0
- package/assets/components/AttachmentThumb/AttachmentThumb.module.css +107 -0
- package/assets/components/AttachmentThumb/AttachmentThumb.tsx +91 -0
- package/assets/components/AttachmentThumb/index.ts +2 -0
- package/assets/components/Avatar/Avatar.module.css +167 -0
- package/assets/components/Avatar/Avatar.tsx +228 -0
- package/assets/components/Avatar/index.ts +2 -0
- package/assets/components/AvatarUpload/AvatarUpload.module.css +130 -0
- package/assets/components/AvatarUpload/AvatarUpload.tsx +139 -0
- package/assets/components/AvatarUpload/index.ts +2 -0
- package/assets/components/Badge/Badge.module.css +76 -0
- package/assets/components/Badge/Badge.tsx +68 -0
- package/assets/components/Badge/index.ts +2 -0
- package/assets/components/Breadcrumb/Breadcrumb.module.css +213 -0
- package/assets/components/Breadcrumb/Breadcrumb.tsx +279 -0
- package/assets/components/Breadcrumb/index.ts +8 -0
- package/assets/components/Button/Button.module.css +216 -0
- package/assets/components/Button/Button.tsx +149 -0
- package/assets/components/Button/index.ts +2 -0
- package/assets/components/Callout/Callout.module.css +146 -0
- package/assets/components/Callout/Callout.tsx +138 -0
- package/assets/components/Callout/index.ts +2 -0
- package/assets/components/ChatInput/ChatInput.module.css +241 -0
- package/assets/components/ChatInput/ChatInput.tsx +322 -0
- package/assets/components/ChatInput/ModelSelector.tsx +40 -0
- package/assets/components/ChatInput/SendButton.tsx +41 -0
- package/assets/components/ChatInput/index.ts +10 -0
- package/assets/components/Checkbox/Checkbox.module.css +66 -0
- package/assets/components/Checkbox/Checkbox.tsx +36 -0
- package/assets/components/Checkbox/index.ts +2 -0
- package/assets/components/Chip/Chip.module.css +128 -0
- package/assets/components/Chip/Chip.tsx +103 -0
- package/assets/components/Chip/index.ts +2 -0
- package/assets/components/ChoiceCard/ChoiceCard.module.css +142 -0
- package/assets/components/ChoiceCard/ChoiceCard.tsx +132 -0
- package/assets/components/ChoiceCard/index.ts +2 -0
- package/assets/components/ContextMenu/ContextMenu.module.css +102 -0
- package/assets/components/ContextMenu/ContextMenu.tsx +392 -0
- package/assets/components/ContextMenu/index.ts +9 -0
- package/assets/components/DatePicker/Calendar.tsx +234 -0
- package/assets/components/DatePicker/DESIGN_NOTES.md +106 -0
- package/assets/components/DatePicker/DESIGN_NOTES_TIME.md +125 -0
- package/assets/components/DatePicker/DatePicker.module.css +295 -0
- package/assets/components/DatePicker/DatePicker.tsx +387 -0
- package/assets/components/DatePicker/TimeSelector.tsx +69 -0
- package/assets/components/DatePicker/index.ts +8 -0
- package/assets/components/DatePicker/presets.ts +80 -0
- package/assets/components/DatePicker/utils.ts +148 -0
- package/assets/components/Disclosure/Disclosure.module.css +73 -0
- package/assets/components/Disclosure/Disclosure.tsx +129 -0
- package/assets/components/Disclosure/index.ts +6 -0
- package/assets/components/Drawer/Drawer.module.css +257 -0
- package/assets/components/Drawer/Drawer.tsx +126 -0
- package/assets/components/Drawer/index.ts +7 -0
- package/assets/components/EmptyState/EmptyState.module.css +102 -0
- package/assets/components/EmptyState/EmptyState.tsx +80 -0
- package/assets/components/EmptyState/index.ts +2 -0
- package/assets/components/FileIcon/FileIcon.module.css +66 -0
- package/assets/components/FileIcon/FileIcon.tsx +84 -0
- package/assets/components/FileIcon/fileExtMap.ts +112 -0
- package/assets/components/FileIcon/index.ts +9 -0
- package/assets/components/FilterButton/FilterButton.module.css +130 -0
- package/assets/components/FilterButton/FilterButton.tsx +94 -0
- package/assets/components/FilterButton/index.ts +2 -0
- package/assets/components/GalleryItem/GalleryItem.module.css +220 -0
- package/assets/components/GalleryItem/GalleryItem.tsx +163 -0
- package/assets/components/GalleryItem/index.ts +7 -0
- package/assets/components/Icon/Icon.tsx +616 -0
- package/assets/components/Icon/context.tsx +39 -0
- package/assets/components/Icon/index.ts +4 -0
- package/assets/components/IconButton/IconButton.module.css +109 -0
- package/assets/components/IconButton/IconButton.tsx +110 -0
- package/assets/components/IconButton/index.ts +2 -0
- package/assets/components/Input/Input.module.css +338 -0
- package/assets/components/Input/Input.tsx +371 -0
- package/assets/components/Input/index.ts +2 -0
- package/assets/components/ListItem/ListItem.module.css +318 -0
- package/assets/components/ListItem/ListItem.tsx +262 -0
- package/assets/components/ListItem/index.ts +9 -0
- package/assets/components/MenuItem/MenuItem.module.css +437 -0
- package/assets/components/MenuItem/MenuItem.tsx +529 -0
- package/assets/components/MenuItem/index.ts +8 -0
- package/assets/components/MetricCard/MetricCard.module.css +153 -0
- package/assets/components/MetricCard/MetricCard.tsx +140 -0
- package/assets/components/MetricCard/index.ts +2 -0
- package/assets/components/Modal/Modal.module.css +175 -0
- package/assets/components/Modal/Modal.tsx +98 -0
- package/assets/components/Modal/index.ts +2 -0
- package/assets/components/Onboarding/DocsIndex.tsx +82 -0
- package/assets/components/Onboarding/LayoutBuilder.tsx +160 -0
- package/assets/components/Onboarding/Onboarding.module.css +1394 -0
- package/assets/components/Onboarding/OnboardingAxisPanel.tsx +515 -0
- package/assets/components/Onboarding/OnboardingPage.tsx +1193 -0
- package/assets/components/Onboarding/PresetsGallery.tsx +65 -0
- package/assets/components/Onboarding/actions.ts +250 -0
- package/assets/components/Onboarding/index.ts +8 -0
- package/assets/components/Onboarding/palette.css +40 -0
- package/assets/components/Onboarding/wizardData.ts +265 -0
- package/assets/components/Pagination/Pagination.module.css +82 -0
- package/assets/components/Pagination/Pagination.tsx +248 -0
- package/assets/components/Pagination/index.ts +6 -0
- package/assets/components/ProgressBar/ProgressBar.module.css +64 -0
- package/assets/components/ProgressBar/ProgressBar.tsx +54 -0
- package/assets/components/ProgressBar/index.ts +2 -0
- package/assets/components/QuotationBar/QuotationBar.module.css +61 -0
- package/assets/components/QuotationBar/QuotationBar.tsx +48 -0
- package/assets/components/QuotationBar/index.ts +2 -0
- package/assets/components/Radio/Radio.module.css +63 -0
- package/assets/components/Radio/Radio.tsx +33 -0
- package/assets/components/Radio/index.ts +2 -0
- package/assets/components/Select/Select.module.css +151 -0
- package/assets/components/Select/Select.tsx +425 -0
- package/assets/components/Select/index.ts +10 -0
- package/assets/components/SelectableCard/SelectableCard.module.css +177 -0
- package/assets/components/SelectableCard/SelectableCard.tsx +83 -0
- package/assets/components/SelectableCard/index.ts +2 -0
- package/assets/components/Shortcut/Shortcut.module.css +56 -0
- package/assets/components/Shortcut/Shortcut.tsx +156 -0
- package/assets/components/Shortcut/index.ts +2 -0
- package/assets/components/Sidebar/Sidebar.module.css +242 -0
- package/assets/components/Sidebar/Sidebar.tsx +264 -0
- package/assets/components/Sidebar/index.ts +7 -0
- package/assets/components/SidebarSplit/SidebarSplit.module.css +126 -0
- package/assets/components/SidebarSplit/SidebarSplit.tsx +222 -0
- package/assets/components/SidebarSplit/index.ts +6 -0
- package/assets/components/Slider/Slider.module.css +120 -0
- package/assets/components/Slider/Slider.tsx +88 -0
- package/assets/components/Slider/index.ts +2 -0
- package/assets/components/SplitButton/SplitButton.module.css +190 -0
- package/assets/components/SplitButton/SplitButton.tsx +145 -0
- package/assets/components/SplitButton/index.ts +6 -0
- package/assets/components/Stepper/Stepper.module.css +182 -0
- package/assets/components/Stepper/Stepper.tsx +185 -0
- package/assets/components/Stepper/index.ts +2 -0
- package/assets/components/Switch/Switch.module.css +116 -0
- package/assets/components/Switch/Switch.tsx +58 -0
- package/assets/components/Switch/index.ts +2 -0
- package/assets/components/TableCell/TableCell.module.css +137 -0
- package/assets/components/TableCell/TableCellAvatar.tsx +42 -0
- package/assets/components/TableCell/TableCellBadge.tsx +23 -0
- package/assets/components/TableCell/TableCellIcon.tsx +39 -0
- package/assets/components/TableCell/TableCellImage.tsx +49 -0
- package/assets/components/TableCell/TableCellLink.tsx +33 -0
- package/assets/components/TableCell/TableCellMeter.tsx +55 -0
- package/assets/components/TableCell/TableCellNumber.tsx +43 -0
- package/assets/components/TableCell/TableCellText.tsx +30 -0
- package/assets/components/TableCell/index.ts +23 -0
- package/assets/components/TableHeader/TableHeader.module.css +287 -0
- package/assets/components/TableHeader/TableHeader.tsx +590 -0
- package/assets/components/TableHeader/index.ts +9 -0
- package/assets/components/TableRow/TableRow.module.css +290 -0
- package/assets/components/TableRow/TableRow.tsx +253 -0
- package/assets/components/TableRow/index.ts +8 -0
- package/assets/components/TableRowEdit/TableRowEdit.module.css +126 -0
- package/assets/components/TableRowEdit/TableRowEdit.tsx +247 -0
- package/assets/components/TableRowEdit/index.ts +2 -0
- package/assets/components/TableRowSelect/TableRowSelect.module.css +23 -0
- package/assets/components/TableRowSelect/TableRowSelect.tsx +175 -0
- package/assets/components/TableRowSelect/index.ts +2 -0
- package/assets/components/Tabs/Tabs.module.css +234 -0
- package/assets/components/Tabs/Tabs.tsx +426 -0
- package/assets/components/Tabs/index.ts +9 -0
- package/assets/components/Textarea/Textarea.module.css +318 -0
- package/assets/components/Textarea/Textarea.tsx +426 -0
- package/assets/components/Textarea/index.ts +7 -0
- package/assets/components/ThemeController.tsx +271 -0
- package/assets/components/TimePicker/TimePicker.module.css +317 -0
- package/assets/components/TimePicker/TimePicker.tsx +821 -0
- package/assets/components/TimePicker/index.ts +8 -0
- package/assets/components/TimePicker/utils.ts +115 -0
- package/assets/components/Toast/Toast.module.css +264 -0
- package/assets/components/Toast/Toast.tsx +243 -0
- package/assets/components/Toast/index.ts +15 -0
- package/assets/components/Toolbar/Toolbar.module.css +72 -0
- package/assets/components/Toolbar/Toolbar.tsx +75 -0
- package/assets/components/Toolbar/index.ts +2 -0
- package/assets/components/Tooltip/Tooltip.module.css +42 -0
- package/assets/components/Tooltip/Tooltip.tsx +332 -0
- package/assets/components/Tooltip/index.ts +2 -0
- package/assets/components/Topbar/Topbar.module.css +26 -0
- package/assets/components/Topbar/Topbar.tsx +47 -0
- package/assets/components/Topbar/index.ts +2 -0
- package/assets/components/_cn.ts +3 -0
- package/assets/components/_color.ts +48 -0
- package/assets/components/_data.ts +659 -0
- package/assets/components/_utils.css +19 -0
- package/assets/components/axisOptions.ts +24 -0
- package/assets/components/tokens.css +742 -0
- package/assets/prompts/GUIDE.md +251 -0
- package/assets/prompts/OVERRIDE.md +170 -0
- package/assets/prompts/PRINCIPLES.md +130 -0
- package/assets/prompts/axes/density.md +38 -0
- package/assets/prompts/axes/font.md +36 -0
- package/assets/prompts/axes/hue.md +36 -0
- package/assets/prompts/axes/icon.md +48 -0
- package/assets/prompts/axes/mode.md +50 -0
- package/assets/prompts/axes/motion.md +77 -0
- package/assets/prompts/axes/palette.md +35 -0
- package/assets/prompts/axes/shape.md +33 -0
- package/assets/prompts/axes/voice.md +54 -0
- package/assets/prompts/components/README.md +84 -0
- package/assets/prompts/components/app-frame.md +94 -0
- package/assets/prompts/components/attachment-chip.md +46 -0
- package/assets/prompts/components/attachment-thumb.md +49 -0
- package/assets/prompts/components/avatar.md +86 -0
- package/assets/prompts/components/badge.md +104 -0
- package/assets/prompts/components/breadcrumb.md +77 -0
- package/assets/prompts/components/button.md +99 -0
- package/assets/prompts/components/callout.md +81 -0
- package/assets/prompts/components/chat-input.md +84 -0
- package/assets/prompts/components/checkbox.md +46 -0
- package/assets/prompts/components/chip.md +84 -0
- package/assets/prompts/components/choice-card.md +127 -0
- package/assets/prompts/components/context-menu.md +145 -0
- package/assets/prompts/components/date-picker.md +104 -0
- package/assets/prompts/components/drawer.md +152 -0
- package/assets/prompts/components/empty-state.md +69 -0
- package/assets/prompts/components/file-icon.md +73 -0
- package/assets/prompts/components/filter-button.md +42 -0
- package/assets/prompts/components/form-field.md +74 -0
- package/assets/prompts/components/gallery-item.md +158 -0
- package/assets/prompts/components/icon-button.md +82 -0
- package/assets/prompts/components/icon.md +68 -0
- package/assets/prompts/components/input.md +95 -0
- package/assets/prompts/components/list-item.md +235 -0
- package/assets/prompts/components/menu-item.md +234 -0
- package/assets/prompts/components/metric-card.md +132 -0
- package/assets/prompts/components/modal.md +131 -0
- package/assets/prompts/components/pagination.md +92 -0
- package/assets/prompts/components/progress-bar.md +61 -0
- package/assets/prompts/components/quotation-bar.md +39 -0
- package/assets/prompts/components/radio.md +41 -0
- package/assets/prompts/components/select.md +104 -0
- package/assets/prompts/components/selectable-card.md +67 -0
- package/assets/prompts/components/shortcut.md +76 -0
- package/assets/prompts/components/sidebar.md +107 -0
- package/assets/prompts/components/slider.md +89 -0
- package/assets/prompts/components/split-button.md +71 -0
- package/assets/prompts/components/stepper.md +93 -0
- package/assets/prompts/components/switch.md +86 -0
- package/assets/prompts/components/table-cell.md +87 -0
- package/assets/prompts/components/table-header.md +157 -0
- package/assets/prompts/components/table-row-edit.md +129 -0
- package/assets/prompts/components/table-row-select.md +82 -0
- package/assets/prompts/components/table-row.md +156 -0
- package/assets/prompts/components/tabs.md +122 -0
- package/assets/prompts/components/textarea.md +105 -0
- package/assets/prompts/components/toast.md +149 -0
- package/assets/prompts/components/tooltip.md +71 -0
- package/assets/prompts/components/topbar.md +148 -0
- package/assets/prompts/primitives/emerge.md +43 -0
- package/assets/prompts/primitives/fade.md +31 -0
- package/assets/prompts/primitives/scale.md +32 -0
- package/assets/prompts/primitives/scroll.md +75 -0
- package/assets/prompts/primitives/slide.md +31 -0
- package/assets/prompts/themes/_SCHEMA.md +135 -0
- package/assets/prompts/themes/_TEMPLATE.md +73 -0
- package/assets/prompts/themes/expressive.md +118 -0
- package/assets/prompts/themes/pure.md +87 -0
- package/assets/prompts/themes/spare.md +73 -0
- package/assets/prompts/tokens/breakpoint.md +29 -0
- package/assets/prompts/tokens/color.md +78 -0
- package/assets/prompts/tokens/radius.md +33 -0
- package/assets/prompts/tokens/shadow.md +35 -0
- package/assets/prompts/tokens/spacing.md +86 -0
- package/assets/prompts/tokens/typography.md +76 -0
- package/assets/prompts/tokens/z-index.md +35 -0
- package/assets/public/expressive.png +0 -0
- package/assets/public/pure.png +0 -0
- package/assets/public/spare.png +0 -0
- package/assets/skill/SKILL.md +36 -0
- package/bin/ctds.js +76 -0
- package/package.json +35 -4
- package/src/commands/init.js +215 -0
- package/src/commands/update.js +275 -0
- package/src/utils/assets.js +78 -0
- package/src/utils/deps.js +51 -0
- package/src/utils/detect.js +47 -0
- package/src/utils/diff.js +52 -0
- package/src/utils/hash.js +16 -0
- package/src/utils/log.js +41 -0
- package/src/utils/meta.js +73 -0
- package/src/utils/prompt.js +28 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
forwardRef,
|
|
5
|
+
useRef,
|
|
6
|
+
type ChangeEvent,
|
|
7
|
+
type HTMLAttributes,
|
|
8
|
+
type MouseEvent,
|
|
9
|
+
} from "react";
|
|
10
|
+
|
|
11
|
+
import { Avatar, type AvatarShape, type AvatarSize } from "../Avatar";
|
|
12
|
+
import { Icon } from "../Icon";
|
|
13
|
+
import styles from "./AvatarUpload.module.css";
|
|
14
|
+
|
|
15
|
+
export type AvatarUploadProps = Omit<HTMLAttributes<HTMLDivElement>, "onChange"> & {
|
|
16
|
+
size?: AvatarSize;
|
|
17
|
+
shape?: AvatarShape;
|
|
18
|
+
/** 현재 이미지 URL. 없으면 이니셜/아이콘으로 폴백. */
|
|
19
|
+
src?: string;
|
|
20
|
+
/** 이니셜 추출·접근성 라벨용. */
|
|
21
|
+
name?: string;
|
|
22
|
+
/** 접근성 라벨 (name보다 우선). */
|
|
23
|
+
alt?: string;
|
|
24
|
+
/** 파일 선택 시 호출. */
|
|
25
|
+
onChange?: (file: File) => void;
|
|
26
|
+
/** 있으면 src가 있을 때만 X 버튼 렌더. 클릭 시 호출. */
|
|
27
|
+
onRemove?: () => void;
|
|
28
|
+
/** 허용 MIME. 기본 image/*. */
|
|
29
|
+
accept?: string;
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
/** hover 오버레이 라벨. 기본 "사진 변경". */
|
|
32
|
+
editLabel?: string;
|
|
33
|
+
/** 삭제 버튼 aria-label. 기본 "사진 제거". */
|
|
34
|
+
removeLabel?: string;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const AvatarUpload = forwardRef<HTMLDivElement, AvatarUploadProps>(
|
|
38
|
+
(
|
|
39
|
+
{
|
|
40
|
+
className,
|
|
41
|
+
size = "xl",
|
|
42
|
+
shape = "circle",
|
|
43
|
+
src,
|
|
44
|
+
name,
|
|
45
|
+
alt,
|
|
46
|
+
onChange,
|
|
47
|
+
onRemove,
|
|
48
|
+
accept = "image/*",
|
|
49
|
+
disabled = false,
|
|
50
|
+
editLabel = "사진 변경",
|
|
51
|
+
removeLabel = "사진 제거",
|
|
52
|
+
...rest
|
|
53
|
+
},
|
|
54
|
+
ref,
|
|
55
|
+
) => {
|
|
56
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
57
|
+
|
|
58
|
+
const openPicker = () => {
|
|
59
|
+
if (disabled) return;
|
|
60
|
+
inputRef.current?.click();
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const handleFile = (e: ChangeEvent<HTMLInputElement>) => {
|
|
64
|
+
const file = e.target.files?.[0];
|
|
65
|
+
if (file) onChange?.(file);
|
|
66
|
+
/* 같은 파일 재선택도 change 이벤트가 발생하도록 리셋 */
|
|
67
|
+
e.target.value = "";
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const handleRemove = (e: MouseEvent<HTMLButtonElement>) => {
|
|
71
|
+
e.stopPropagation();
|
|
72
|
+
onRemove?.();
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const cls = [
|
|
76
|
+
styles.root,
|
|
77
|
+
styles[size],
|
|
78
|
+
shape === "rounded" ? styles.rounded : styles.circle,
|
|
79
|
+
disabled ? styles.disabled : "",
|
|
80
|
+
className ?? "",
|
|
81
|
+
]
|
|
82
|
+
.filter(Boolean)
|
|
83
|
+
.join(" ");
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<div ref={ref} className={cls} {...rest}>
|
|
87
|
+
<button
|
|
88
|
+
type="button"
|
|
89
|
+
className={styles.trigger}
|
|
90
|
+
onClick={openPicker}
|
|
91
|
+
disabled={disabled}
|
|
92
|
+
aria-label={editLabel}
|
|
93
|
+
>
|
|
94
|
+
<Avatar size={size} shape={shape} src={src} name={name} alt={alt} />
|
|
95
|
+
<span className={styles.overlay} aria-hidden>
|
|
96
|
+
<Icon name="camera" size={overlayIconSize(size)} />
|
|
97
|
+
</span>
|
|
98
|
+
</button>
|
|
99
|
+
|
|
100
|
+
{src && onRemove && (
|
|
101
|
+
<button
|
|
102
|
+
type="button"
|
|
103
|
+
className={styles.remove}
|
|
104
|
+
onClick={handleRemove}
|
|
105
|
+
disabled={disabled}
|
|
106
|
+
aria-label={removeLabel}
|
|
107
|
+
>
|
|
108
|
+
<Icon name="x" size={removeIconSize(size)} />
|
|
109
|
+
</button>
|
|
110
|
+
)}
|
|
111
|
+
|
|
112
|
+
<input
|
|
113
|
+
ref={inputRef}
|
|
114
|
+
type="file"
|
|
115
|
+
accept={accept}
|
|
116
|
+
className={styles.input}
|
|
117
|
+
onChange={handleFile}
|
|
118
|
+
disabled={disabled}
|
|
119
|
+
tabIndex={-1}
|
|
120
|
+
aria-hidden
|
|
121
|
+
/>
|
|
122
|
+
</div>
|
|
123
|
+
);
|
|
124
|
+
},
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
AvatarUpload.displayName = "AvatarUpload";
|
|
128
|
+
|
|
129
|
+
/* 오버레이 카메라는 Avatar 아이콘보다 조금 작게 — 반쪽 영역에 얹히므로
|
|
130
|
+
Avatar 정중앙 아이콘과 같은 크기면 답답해 보인다. */
|
|
131
|
+
function overlayIconSize(size: AvatarSize): number {
|
|
132
|
+
return { xs: 8, sm: 10, md: 14, lg: 18, xl: 24 }[size];
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function removeIconSize(size: AvatarSize): number {
|
|
136
|
+
return { xs: 8, sm: 10, md: 12, lg: 14, xl: 16 }[size];
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export { AvatarUpload };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/* Badge ────────────────────────────────────────────────────────
|
|
2
|
+
메뉴/리스트/카드/버튼 옆에 붙이는 "카운트·상태 라벨".
|
|
3
|
+
숫자(12·3) 또는 짧은 문자열(new·beta) 모두 대응. 콘텐츠 폭 그대로 흐르되
|
|
4
|
+
1글자 숫자면 min-width로 원형에 가깝게 유지. */
|
|
5
|
+
.root {
|
|
6
|
+
display: inline-flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
flex-shrink: 0;
|
|
10
|
+
font-family: var(--label-font);
|
|
11
|
+
font-weight: var(--font-weight-medium);
|
|
12
|
+
line-height: 1;
|
|
13
|
+
letter-spacing: var(--label-tracking);
|
|
14
|
+
white-space: nowrap;
|
|
15
|
+
/* border 자리를 항상 확보 — variant에 따라 색만 바뀌게 하면 layout shift 없음 */
|
|
16
|
+
border: 1px solid transparent;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/* Sizes ──────────────────────────────────────────────────────── */
|
|
20
|
+
/* 텍스트 크기에 맞춘 사각 라벨. radius는 size 별로 차등.
|
|
21
|
+
높이는 폰트 line-height + 세로 padding으로 자연히 결정. */
|
|
22
|
+
.root { border-radius: var(--radius-xs); }
|
|
23
|
+
.sm {
|
|
24
|
+
padding-block: var(--space-0_5); /* 2 */
|
|
25
|
+
padding-inline: var(--space-1); /* 4 */
|
|
26
|
+
font-size: var(--text-3xs); /* 11 */
|
|
27
|
+
}
|
|
28
|
+
.md {
|
|
29
|
+
padding-block: var(--space-1); /* 4 */
|
|
30
|
+
padding-inline: var(--space-1_5); /* 6 */
|
|
31
|
+
font-size: var(--text-2xs); /* 12 */
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* Shape ──────────────────────────────────────────────────────
|
|
35
|
+
square(기본)은 size별 radius를 그대로 사용, pill은 --radius-full로 강제. */
|
|
36
|
+
.pill { border-radius: var(--radius-full); }
|
|
37
|
+
|
|
38
|
+
/* Variants ───────────────────────────────────────────────────── */
|
|
39
|
+
/* solid — primary로 완전히 채움. 강조 상위 위계.
|
|
40
|
+
위 텍스트/아이콘은 --bg (라이트=흰, 다크=거의 검정) — Button primary와 동일 규칙.
|
|
41
|
+
soft — primary 8% 표면 + --secondary-fg 텍스트.
|
|
42
|
+
Accent=mono일 땐 --secondary-fg가 무채색으로 자동 폴백. */
|
|
43
|
+
.solid {
|
|
44
|
+
background: var(--primary);
|
|
45
|
+
color: var(--bg);
|
|
46
|
+
}
|
|
47
|
+
.soft {
|
|
48
|
+
background: var(--primary-subtle);
|
|
49
|
+
color: var(--secondary-fg);
|
|
50
|
+
}
|
|
51
|
+
/* inverse — 어두운 표면(FilterButton selected 등) 위에 얹는 라벨.
|
|
52
|
+
solid의 정반대: 배경 --bg, 글자 --fg. Mode를 따라 자동 반전됨. */
|
|
53
|
+
.inverse {
|
|
54
|
+
background: var(--bg);
|
|
55
|
+
color: var(--fg);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* Status ─────────────────────────────────────────────────────
|
|
59
|
+
status는 soft 전용. solid는 알림/언리드 강조로 primary만 사용한다.
|
|
60
|
+
soft + status는 상태색 8% 배경 + 상태색 텍스트. */
|
|
61
|
+
.soft.success {
|
|
62
|
+
background: var(--success-subtle);
|
|
63
|
+
color: var(--success);
|
|
64
|
+
}
|
|
65
|
+
.soft.warning {
|
|
66
|
+
background: var(--warning-subtle);
|
|
67
|
+
color: var(--warning);
|
|
68
|
+
}
|
|
69
|
+
.soft.destructive {
|
|
70
|
+
background: var(--destructive-subtle);
|
|
71
|
+
color: var(--destructive);
|
|
72
|
+
}
|
|
73
|
+
.soft.info {
|
|
74
|
+
background: var(--info-subtle);
|
|
75
|
+
color: var(--info);
|
|
76
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { forwardRef, type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
import styles from "./Badge.module.css";
|
|
4
|
+
|
|
5
|
+
export type BadgeSize = "sm" | "md";
|
|
6
|
+
export type BadgeVariant = "solid" | "soft" | "inverse";
|
|
7
|
+
export type BadgeStatus = "success" | "warning" | "destructive" | "info";
|
|
8
|
+
/** 기본은 "square". pill은 웬만하면 쓰지 않는다 —
|
|
9
|
+
* Shape 축이 전역적으로 radius를 조절하므로, 특정 컴포넌트가 pill로 모양을 고정하면
|
|
10
|
+
* 축 스왑 효과가 사라지고 테마 간 톤이 깨진다. 알림·카운터 등 "원형이 의미인" 경우에만 opt-in. */
|
|
11
|
+
export type BadgeShape = "square" | "pill";
|
|
12
|
+
|
|
13
|
+
export type BadgeProps = HTMLAttributes<HTMLSpanElement> & {
|
|
14
|
+
size?: BadgeSize;
|
|
15
|
+
variant?: BadgeVariant;
|
|
16
|
+
status?: BadgeStatus;
|
|
17
|
+
shape?: BadgeShape;
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const sizeClass: Record<BadgeSize, string> = {
|
|
22
|
+
sm: styles.sm,
|
|
23
|
+
md: styles.md,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const variantClass: Record<BadgeVariant, string> = {
|
|
27
|
+
solid: styles.solid,
|
|
28
|
+
soft: styles.soft,
|
|
29
|
+
inverse: styles.inverse,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const statusClass: Record<BadgeStatus, string> = {
|
|
33
|
+
success: styles.success,
|
|
34
|
+
warning: styles.warning,
|
|
35
|
+
destructive: styles.destructive,
|
|
36
|
+
info: styles.info,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const Badge = forwardRef<HTMLSpanElement, BadgeProps>(
|
|
40
|
+
({ className, size = "sm", variant = "solid", status, shape = "square", children, ...rest }, ref) => {
|
|
41
|
+
/* solid/inverse는 알림·강조 전용 — primary·bg 톤만 허용. status와 조합 금지. */
|
|
42
|
+
const effectiveStatus = variant === "soft" ? status : undefined;
|
|
43
|
+
if (process.env.NODE_ENV !== "production" && variant !== "soft" && status) {
|
|
44
|
+
console.warn(
|
|
45
|
+
`[Badge] status는 variant="soft" 전용입니다. solid/inverse는 강조 톤이라 상태색과 조합하지 않습니다.`,
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
const cls = [
|
|
49
|
+
styles.root,
|
|
50
|
+
sizeClass[size],
|
|
51
|
+
variantClass[variant],
|
|
52
|
+
effectiveStatus ? statusClass[effectiveStatus] : "",
|
|
53
|
+
shape === "pill" ? styles.pill : "",
|
|
54
|
+
className ?? "",
|
|
55
|
+
]
|
|
56
|
+
.filter(Boolean)
|
|
57
|
+
.join(" ");
|
|
58
|
+
return (
|
|
59
|
+
<span ref={ref} className={cls} {...rest}>
|
|
60
|
+
{children}
|
|
61
|
+
</span>
|
|
62
|
+
);
|
|
63
|
+
},
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
Badge.displayName = "Badge";
|
|
67
|
+
|
|
68
|
+
export { Badge };
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/* Breadcrumb ──────────────────────────────────────────────────
|
|
2
|
+
Link = Button size=xs · variant=ghost 와 동일한 토큰 조합.
|
|
3
|
+
Current = 링크 아님, --fg-strong로 위계 표시.
|
|
4
|
+
Separator = 무채 아이콘, hover·press 반응 없음.
|
|
5
|
+
|
|
6
|
+
축 반응:
|
|
7
|
+
─ Density → --control-h-xs (Link 높이), --label-sm-size (라벨), --space-scale (gap)
|
|
8
|
+
─ Shape → --radius-xs (Link 라운드)
|
|
9
|
+
─ Motion → --transition-* (hover 색 전환)
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
.root {
|
|
13
|
+
min-width: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.list {
|
|
17
|
+
display: inline-flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
gap: var(--space-0_5);
|
|
20
|
+
margin: 0;
|
|
21
|
+
padding: 0;
|
|
22
|
+
list-style: none;
|
|
23
|
+
min-width: 0;
|
|
24
|
+
flex-wrap: wrap;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.item {
|
|
28
|
+
display: inline-flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
min-width: 0;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* Separator ─── 무채 아이콘. Link/Current 사이 정적 마커. */
|
|
34
|
+
.separator {
|
|
35
|
+
display: inline-flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
color: var(--fg-muted);
|
|
38
|
+
opacity: 0.5;
|
|
39
|
+
/* 아이콘 슬롯. size는 컴포넌트에서 주입. */
|
|
40
|
+
}
|
|
41
|
+
.separator > svg {
|
|
42
|
+
display: block;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* Link ─── Button size=xs · variant=ghost 재현.
|
|
46
|
+
높이·padding·gap·font-size·radius를 xs 토큰으로. hover에만 표면 색. */
|
|
47
|
+
.link {
|
|
48
|
+
display: inline-flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
justify-content: center;
|
|
51
|
+
gap: var(--space-1);
|
|
52
|
+
height: var(--control-h-xs);
|
|
53
|
+
padding-inline: var(--space-1);
|
|
54
|
+
border-radius: var(--radius-xs);
|
|
55
|
+
font-family: var(--label-font);
|
|
56
|
+
font-weight: var(--label-weight);
|
|
57
|
+
font-size: var(--label-sm-size);
|
|
58
|
+
line-height: var(--lh-tight);
|
|
59
|
+
letter-spacing: var(--label-tracking);
|
|
60
|
+
color: var(--fg-muted);
|
|
61
|
+
background: transparent;
|
|
62
|
+
border: 1px solid transparent;
|
|
63
|
+
text-decoration: none;
|
|
64
|
+
white-space: nowrap;
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
user-select: none;
|
|
67
|
+
min-width: 0;
|
|
68
|
+
transition: var(--transition-colors), var(--transition-ring), var(--transition-press);
|
|
69
|
+
}
|
|
70
|
+
.link:hover {
|
|
71
|
+
background: var(--hover);
|
|
72
|
+
color: var(--fg);
|
|
73
|
+
}
|
|
74
|
+
.link:active {
|
|
75
|
+
transform: translateY(var(--space-0_5));
|
|
76
|
+
}
|
|
77
|
+
.link:focus-visible {
|
|
78
|
+
outline: none;
|
|
79
|
+
box-shadow: var(--ring-shadow);
|
|
80
|
+
}
|
|
81
|
+
.link[aria-disabled="true"] {
|
|
82
|
+
cursor: not-allowed;
|
|
83
|
+
color: var(--fg-disabled);
|
|
84
|
+
pointer-events: none;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* Icon-only 변형 — children 없이 leftIcon만 있을 때. 정사각 hit box. */
|
|
88
|
+
.linkIconOnly {
|
|
89
|
+
width: var(--control-h-xs);
|
|
90
|
+
padding-inline: 0;
|
|
91
|
+
gap: 0;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* Current ─── 현재 페이지. Link와 같은 높이/타이포지만 hover·press 없음. */
|
|
95
|
+
.current {
|
|
96
|
+
display: inline-flex;
|
|
97
|
+
align-items: center;
|
|
98
|
+
gap: var(--space-1);
|
|
99
|
+
height: var(--control-h-xs);
|
|
100
|
+
padding-inline: var(--space-1);
|
|
101
|
+
font-family: var(--label-font);
|
|
102
|
+
font-weight: var(--label-weight);
|
|
103
|
+
font-size: var(--label-sm-size);
|
|
104
|
+
line-height: var(--lh-tight);
|
|
105
|
+
letter-spacing: var(--label-tracking);
|
|
106
|
+
color: var(--fg-strong);
|
|
107
|
+
min-width: 0;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* Link · Current 공통 슬롯 ─── */
|
|
111
|
+
.linkIcon {
|
|
112
|
+
display: inline-flex;
|
|
113
|
+
align-items: center;
|
|
114
|
+
justify-content: center;
|
|
115
|
+
flex-shrink: 0;
|
|
116
|
+
opacity: 0.75;
|
|
117
|
+
transition: opacity var(--duration-slow) var(--ease-out);
|
|
118
|
+
}
|
|
119
|
+
.linkIcon > svg {
|
|
120
|
+
display: block;
|
|
121
|
+
}
|
|
122
|
+
.link:hover .linkIcon {
|
|
123
|
+
opacity: 1;
|
|
124
|
+
}
|
|
125
|
+
.linkLabel {
|
|
126
|
+
display: inline-flex;
|
|
127
|
+
align-items: center;
|
|
128
|
+
overflow: hidden;
|
|
129
|
+
text-overflow: ellipsis;
|
|
130
|
+
white-space: nowrap;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/* Ellipsis trigger ─── 클릭 가능한 축약 버튼. Link와 동일 xs · ghost 스펙. */
|
|
134
|
+
.ellipsisTrigger {
|
|
135
|
+
display: inline-flex;
|
|
136
|
+
align-items: center;
|
|
137
|
+
justify-content: center;
|
|
138
|
+
height: var(--control-h-xs);
|
|
139
|
+
padding-inline: var(--space-1);
|
|
140
|
+
border: 1px solid transparent;
|
|
141
|
+
border-radius: var(--radius-xs);
|
|
142
|
+
background: transparent;
|
|
143
|
+
color: var(--fg-muted);
|
|
144
|
+
font-family: var(--label-font);
|
|
145
|
+
font-weight: var(--label-weight);
|
|
146
|
+
font-size: var(--label-sm-size);
|
|
147
|
+
line-height: var(--lh-tight);
|
|
148
|
+
letter-spacing: var(--label-tracking);
|
|
149
|
+
cursor: pointer;
|
|
150
|
+
user-select: none;
|
|
151
|
+
transition: var(--transition-colors), var(--transition-ring), var(--transition-press);
|
|
152
|
+
}
|
|
153
|
+
.ellipsisTrigger:hover {
|
|
154
|
+
background: var(--hover);
|
|
155
|
+
color: var(--fg);
|
|
156
|
+
}
|
|
157
|
+
.ellipsisTrigger:active {
|
|
158
|
+
transform: translateY(var(--space-0_5));
|
|
159
|
+
}
|
|
160
|
+
.ellipsisTrigger:focus-visible {
|
|
161
|
+
outline: none;
|
|
162
|
+
box-shadow: var(--ring-shadow);
|
|
163
|
+
}
|
|
164
|
+
.ellipsisTrigger[data-state="open"] {
|
|
165
|
+
background: var(--hover);
|
|
166
|
+
color: var(--fg);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/* Popover surface ─── Select · ContextMenu와 동일한 팝오버 표면.
|
|
170
|
+
ContextMenu.module.css의 .surface를 composes해 시각 규칙 원본을 재사용. */
|
|
171
|
+
.popoverContent {
|
|
172
|
+
composes: surface from "../ContextMenu/ContextMenu.module.css";
|
|
173
|
+
--breadcrumb-menu-w: calc(var(--space-2) * 24);
|
|
174
|
+
width: max-content;
|
|
175
|
+
min-width: var(--breadcrumb-menu-w);
|
|
176
|
+
max-width: min(
|
|
177
|
+
calc(var(--breadcrumb-menu-w) + var(--space-2) * 8),
|
|
178
|
+
calc(100vw - var(--space-6))
|
|
179
|
+
);
|
|
180
|
+
z-index: var(--z-popover);
|
|
181
|
+
transform-origin: var(--radix-popover-content-transform-origin);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/* Popover list — 스크롤 컨테이너 아님. padding은 surface가 이미 부여. */
|
|
185
|
+
.popoverList {
|
|
186
|
+
list-style: none;
|
|
187
|
+
margin: 0;
|
|
188
|
+
padding: 0;
|
|
189
|
+
display: flex;
|
|
190
|
+
flex-direction: column;
|
|
191
|
+
gap: var(--space-0_5);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/* Popover item 링크/버튼 ── MenuItem을 그대로 감싸 상호작용 표면만 제공.
|
|
195
|
+
시각은 MenuItem에 위임하고 여기서는 UA 스타일만 리셋. */
|
|
196
|
+
.popoverItemLink,
|
|
197
|
+
.popoverItemButton {
|
|
198
|
+
all: unset;
|
|
199
|
+
display: block;
|
|
200
|
+
cursor: pointer;
|
|
201
|
+
color: inherit;
|
|
202
|
+
text-decoration: none;
|
|
203
|
+
border-radius: var(--radius-xs);
|
|
204
|
+
}
|
|
205
|
+
.popoverItemLink:focus-visible,
|
|
206
|
+
.popoverItemButton:focus-visible {
|
|
207
|
+
outline: none;
|
|
208
|
+
box-shadow: var(--ring-shadow);
|
|
209
|
+
}
|
|
210
|
+
.popoverItemButton:disabled,
|
|
211
|
+
.popoverItemLink[aria-disabled="true"] {
|
|
212
|
+
cursor: not-allowed;
|
|
213
|
+
}
|