sh-ui-cli 0.15.0 → 0.21.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.
- package/bin/sh-ui.mjs +6 -0
- package/data/changelog/versions.json +366 -0
- package/data/registry/flutter/foundation/sh_ui_tokens.dart +385 -0
- package/data/registry/flutter/registry.json +336 -0
- package/data/registry/flutter/widgets/sh_ui_accordion.dart +255 -0
- package/data/registry/flutter/widgets/sh_ui_app_shell.dart +267 -0
- package/data/registry/flutter/widgets/sh_ui_avatar.dart +95 -0
- package/data/registry/flutter/widgets/sh_ui_badge.dart +82 -0
- package/data/registry/flutter/widgets/sh_ui_breadcrumb.dart +107 -0
- package/data/registry/flutter/widgets/sh_ui_button.dart +201 -0
- package/data/registry/flutter/widgets/sh_ui_card.dart +159 -0
- package/data/registry/flutter/widgets/sh_ui_carousel.dart +204 -0
- package/data/registry/flutter/widgets/sh_ui_checkbox.dart +154 -0
- package/data/registry/flutter/widgets/sh_ui_color_picker.dart +264 -0
- package/data/registry/flutter/widgets/sh_ui_combobox.dart +614 -0
- package/data/registry/flutter/widgets/sh_ui_context_menu.dart +71 -0
- package/data/registry/flutter/widgets/sh_ui_date_picker.dart +648 -0
- package/data/registry/flutter/widgets/sh_ui_dialog.dart +567 -0
- package/data/registry/flutter/widgets/sh_ui_dropdown_menu.dart +251 -0
- package/data/registry/flutter/widgets/sh_ui_file_upload.dart +200 -0
- package/data/registry/flutter/widgets/sh_ui_header.dart +488 -0
- package/data/registry/flutter/widgets/sh_ui_input.dart +664 -0
- package/data/registry/flutter/widgets/sh_ui_label.dart +145 -0
- package/data/registry/flutter/widgets/sh_ui_menubar.dart +98 -0
- package/data/registry/flutter/widgets/sh_ui_pagination.dart +276 -0
- package/data/registry/flutter/widgets/sh_ui_popover.dart +248 -0
- package/data/registry/flutter/widgets/sh_ui_progress.dart +47 -0
- package/data/registry/flutter/widgets/sh_ui_radio.dart +108 -0
- package/data/registry/flutter/widgets/sh_ui_select.dart +904 -0
- package/data/registry/flutter/widgets/sh_ui_separator.dart +42 -0
- package/data/registry/flutter/widgets/sh_ui_sidebar.dart +1116 -0
- package/data/registry/flutter/widgets/sh_ui_skeleton.dart +129 -0
- package/data/registry/flutter/widgets/sh_ui_slider.dart +147 -0
- package/data/registry/flutter/widgets/sh_ui_spinner.dart +56 -0
- package/data/registry/flutter/widgets/sh_ui_switch.dart +109 -0
- package/data/registry/flutter/widgets/sh_ui_tabs.dart +329 -0
- package/data/registry/flutter/widgets/sh_ui_textarea.dart +126 -0
- package/data/registry/flutter/widgets/sh_ui_toast.dart +362 -0
- package/data/registry/flutter/widgets/sh_ui_toggle.dart +229 -0
- package/data/registry/flutter/widgets/sh_ui_tooltip.dart +62 -0
- package/data/registry/react/components/accordion/index.tsx +85 -0
- package/data/registry/react/components/accordion/styles.css +94 -0
- package/data/registry/react/components/animations/animations.css +51 -0
- package/data/registry/react/components/avatar/index.tsx +75 -0
- package/data/registry/react/components/avatar/styles.css +36 -0
- package/data/registry/react/components/badge/index.tsx +42 -0
- package/data/registry/react/components/badge/styles.css +57 -0
- package/data/registry/react/components/base/base.css +102 -0
- package/data/registry/react/components/breadcrumb/index.tsx +154 -0
- package/data/registry/react/components/breadcrumb/styles.css +82 -0
- package/data/registry/react/components/breakpoints/breakpoints.css +17 -0
- package/data/registry/react/components/button/index.tsx +47 -0
- package/data/registry/react/components/button/styles.css +93 -0
- package/data/registry/react/components/card/index.tsx +86 -0
- package/data/registry/react/components/card/styles.css +73 -0
- package/data/registry/react/components/carousel/index.tsx +432 -0
- package/data/registry/react/components/carousel/styles.css +155 -0
- package/data/registry/react/components/checkbox/index.tsx +98 -0
- package/data/registry/react/components/checkbox/styles.css +75 -0
- package/data/registry/react/components/code-panel/copy.tsx +56 -0
- package/data/registry/react/components/code-panel/index.tsx +193 -0
- package/data/registry/react/components/code-panel/styles.css +124 -0
- package/data/registry/react/components/color-picker/index.tsx +466 -0
- package/data/registry/react/components/color-picker/styles.css +166 -0
- package/data/registry/react/components/combobox/index.tsx +167 -0
- package/data/registry/react/components/combobox/styles.css +151 -0
- package/data/registry/react/components/context-menu/index.tsx +253 -0
- package/data/registry/react/components/context-menu/styles.css +140 -0
- package/data/registry/react/components/date-picker/index.tsx +757 -0
- package/data/registry/react/components/date-picker/styles.css +279 -0
- package/data/registry/react/components/dialog/index.tsx +97 -0
- package/data/registry/react/components/dialog/styles.css +127 -0
- package/data/registry/react/components/dropdown-menu/index.tsx +257 -0
- package/data/registry/react/components/dropdown-menu/styles.css +150 -0
- package/data/registry/react/components/file-upload/index.tsx +489 -0
- package/data/registry/react/components/file-upload/styles.css +170 -0
- package/data/registry/react/components/focus-ring/focus-ring.css +23 -0
- package/data/registry/react/components/form/context.ts +92 -0
- package/data/registry/react/components/form/field.test.tsx +230 -0
- package/data/registry/react/components/form/field.tsx +236 -0
- package/data/registry/react/components/form/focus-first-error.ts +54 -0
- package/data/registry/react/components/form/form.section.test.tsx +58 -0
- package/data/registry/react/components/form/form.test.tsx +146 -0
- package/data/registry/react/components/form/form.tsx +180 -0
- package/data/registry/react/components/form/index.tsx +61 -0
- package/data/registry/react/components/form/steps.test.tsx +106 -0
- package/data/registry/react/components/form/steps.tsx +193 -0
- package/data/registry/react/components/form/store.test.ts +206 -0
- package/data/registry/react/components/form/store.ts +318 -0
- package/data/registry/react/components/form/styles.css +47 -0
- package/data/registry/react/components/form/types.ts +104 -0
- package/data/registry/react/components/form/use-sh-ui-form.ts +15 -0
- package/data/registry/react/components/form/utils.test.ts +44 -0
- package/data/registry/react/components/form/utils.ts +49 -0
- package/data/registry/react/components/form/validation.test.ts +67 -0
- package/data/registry/react/components/form/validation.ts +64 -0
- package/data/registry/react/components/form-rhf/README.md +27 -0
- package/data/registry/react/components/form-rhf/index.tsx +289 -0
- package/data/registry/react/components/form-rhf/rhf.test.tsx +42 -0
- package/data/registry/react/components/form-tanstack/README.md +27 -0
- package/data/registry/react/components/form-tanstack/index.tsx +352 -0
- package/data/registry/react/components/form-tanstack/tanstack.test.tsx +45 -0
- package/data/registry/react/components/form-yup/README.md +22 -0
- package/data/registry/react/components/form-yup/index.tsx +50 -0
- package/data/registry/react/components/form-yup/yup.test.ts +27 -0
- package/data/registry/react/components/header/index.tsx +257 -0
- package/data/registry/react/components/header/styles.css +190 -0
- package/data/registry/react/components/input/index.tsx +517 -0
- package/data/registry/react/components/input/styles.css +203 -0
- package/data/registry/react/components/label/index.tsx +54 -0
- package/data/registry/react/components/label/styles.css +90 -0
- package/data/registry/react/components/menubar/index.tsx +34 -0
- package/data/registry/react/components/menubar/styles.css +45 -0
- package/data/registry/react/components/pagination/index.tsx +271 -0
- package/data/registry/react/components/pagination/styles.css +105 -0
- package/data/registry/react/components/popover/index.tsx +115 -0
- package/data/registry/react/components/popover/styles.css +65 -0
- package/data/registry/react/components/progress/index.tsx +56 -0
- package/data/registry/react/components/progress/styles.css +41 -0
- package/data/registry/react/components/radio/index.tsx +67 -0
- package/data/registry/react/components/radio/styles.css +80 -0
- package/data/registry/react/components/select/index.tsx +236 -0
- package/data/registry/react/components/select/styles.css +193 -0
- package/data/registry/react/components/separator/index.tsx +48 -0
- package/data/registry/react/components/separator/styles.css +15 -0
- package/data/registry/react/components/sidebar/index.tsx +1084 -0
- package/data/registry/react/components/sidebar/styles.css +502 -0
- package/data/registry/react/components/skeleton/index.tsx +24 -0
- package/data/registry/react/components/skeleton/styles.css +24 -0
- package/data/registry/react/components/slider/index.tsx +300 -0
- package/data/registry/react/components/slider/styles.css +64 -0
- package/data/registry/react/components/spinner/index.tsx +40 -0
- package/data/registry/react/components/spinner/styles.css +37 -0
- package/data/registry/react/components/switch/index.tsx +41 -0
- package/data/registry/react/components/switch/styles.css +83 -0
- package/data/registry/react/components/tabs/index.tsx +93 -0
- package/data/registry/react/components/tabs/styles.css +148 -0
- package/data/registry/react/components/textarea/index.tsx +25 -0
- package/data/registry/react/components/textarea/styles.css +54 -0
- package/data/registry/react/components/theme/index.tsx +91 -0
- package/data/registry/react/components/toast/index.tsx +257 -0
- package/data/registry/react/components/toast/styles.css +290 -0
- package/data/registry/react/components/toggle/index.tsx +133 -0
- package/data/registry/react/components/toggle/styles.css +85 -0
- package/data/registry/react/components/tooltip/index.tsx +85 -0
- package/data/registry/react/components/tooltip/styles.css +44 -0
- package/data/registry/react/components/z-index/z-index.css +16 -0
- package/data/registry/react/hooks/use-active-section.ts +104 -0
- package/data/registry/react/hooks/use-media-query.ts +27 -0
- package/data/registry/react/lib/cn.ts +39 -0
- package/data/registry/react/peer-versions.json +10 -0
- package/data/registry/react/registry.json +835 -0
- package/data/summaries/flutter.json +42 -0
- package/data/summaries/react.json +50 -0
- package/data/tokens/build.mjs +553 -0
- package/data/tokens/src/primitives.json +146 -0
- package/data/tokens/src/semantic.json +146 -0
- package/package.json +9 -2
- package/src/add.mjs +41 -15
- package/src/list.mjs +3 -11
- package/src/mcp.mjs +308 -0
- package/src/paths.mjs +59 -0
- package/src/remove.mjs +4 -11
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Accordion as BaseAccordion } from "@base-ui-components/react/accordion";
|
|
3
|
+
import "./styles.css";
|
|
4
|
+
|
|
5
|
+
function cx(...args: (string | undefined | false)[]) {
|
|
6
|
+
return args.filter(Boolean).join(" ");
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
type WithStringClassName<T> = Omit<T, "className"> & { className?: string };
|
|
10
|
+
|
|
11
|
+
export const Accordion = React.forwardRef<
|
|
12
|
+
HTMLDivElement,
|
|
13
|
+
WithStringClassName<React.ComponentPropsWithoutRef<typeof BaseAccordion.Root>>
|
|
14
|
+
>(({ className, ...props }, ref) => (
|
|
15
|
+
<BaseAccordion.Root
|
|
16
|
+
ref={ref}
|
|
17
|
+
className={cx("sh-ui-accordion", className)}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
));
|
|
21
|
+
Accordion.displayName = "Accordion";
|
|
22
|
+
|
|
23
|
+
export const AccordionItem = React.forwardRef<
|
|
24
|
+
HTMLDivElement,
|
|
25
|
+
WithStringClassName<React.ComponentPropsWithoutRef<typeof BaseAccordion.Item>>
|
|
26
|
+
>(({ className, ...props }, ref) => (
|
|
27
|
+
<BaseAccordion.Item
|
|
28
|
+
ref={ref}
|
|
29
|
+
className={cx("sh-ui-accordion__item", className)}
|
|
30
|
+
{...props}
|
|
31
|
+
/>
|
|
32
|
+
));
|
|
33
|
+
AccordionItem.displayName = "AccordionItem";
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Trigger: 헤더 버튼. 우측에 chevron이 자동으로 붙고 expanded 상태에서 회전한다.
|
|
37
|
+
* Base UI의 AccordionHeader(h3)로 감싸 의미론적 헤더 구조를 유지한다.
|
|
38
|
+
*/
|
|
39
|
+
export const AccordionTrigger = React.forwardRef<
|
|
40
|
+
HTMLButtonElement,
|
|
41
|
+
WithStringClassName<
|
|
42
|
+
React.ComponentPropsWithoutRef<typeof BaseAccordion.Trigger>
|
|
43
|
+
>
|
|
44
|
+
>(({ className, children, ...props }, ref) => (
|
|
45
|
+
<BaseAccordion.Header className="sh-ui-accordion__header">
|
|
46
|
+
<BaseAccordion.Trigger
|
|
47
|
+
ref={ref}
|
|
48
|
+
className={cx("sh-ui-accordion__trigger", className)}
|
|
49
|
+
{...props}
|
|
50
|
+
>
|
|
51
|
+
<span className="sh-ui-accordion__trigger-label">{children}</span>
|
|
52
|
+
<svg
|
|
53
|
+
className="sh-ui-accordion__chevron"
|
|
54
|
+
width="16"
|
|
55
|
+
height="16"
|
|
56
|
+
viewBox="0 0 16 16"
|
|
57
|
+
fill="none"
|
|
58
|
+
aria-hidden="true"
|
|
59
|
+
>
|
|
60
|
+
<path
|
|
61
|
+
d="M4 6l4 4 4-4"
|
|
62
|
+
stroke="currentColor"
|
|
63
|
+
strokeWidth="1.5"
|
|
64
|
+
strokeLinecap="round"
|
|
65
|
+
strokeLinejoin="round"
|
|
66
|
+
/>
|
|
67
|
+
</svg>
|
|
68
|
+
</BaseAccordion.Trigger>
|
|
69
|
+
</BaseAccordion.Header>
|
|
70
|
+
));
|
|
71
|
+
AccordionTrigger.displayName = "AccordionTrigger";
|
|
72
|
+
|
|
73
|
+
export const AccordionContent = React.forwardRef<
|
|
74
|
+
HTMLDivElement,
|
|
75
|
+
WithStringClassName<React.ComponentPropsWithoutRef<typeof BaseAccordion.Panel>>
|
|
76
|
+
>(({ className, children, ...props }, ref) => (
|
|
77
|
+
<BaseAccordion.Panel
|
|
78
|
+
ref={ref}
|
|
79
|
+
className={cx("sh-ui-accordion__panel", className)}
|
|
80
|
+
{...props}
|
|
81
|
+
>
|
|
82
|
+
<div className="sh-ui-accordion__content">{children}</div>
|
|
83
|
+
</BaseAccordion.Panel>
|
|
84
|
+
));
|
|
85
|
+
AccordionContent.displayName = "AccordionContent";
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
.sh-ui-accordion {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
width: 100%;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.sh-ui-accordion__item {
|
|
8
|
+
border-bottom: 1px solid var(--border);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.sh-ui-accordion__item:first-child {
|
|
12
|
+
border-top: 1px solid var(--border);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.sh-ui-accordion__header {
|
|
16
|
+
margin: 0;
|
|
17
|
+
font: inherit;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.sh-ui-accordion__trigger {
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
justify-content: space-between;
|
|
24
|
+
gap: var(--space-4);
|
|
25
|
+
width: 100%;
|
|
26
|
+
padding: var(--space-4) var(--space-1);
|
|
27
|
+
background: transparent;
|
|
28
|
+
border: none;
|
|
29
|
+
color: var(--foreground);
|
|
30
|
+
font-size: 0.9375rem;
|
|
31
|
+
font-weight: var(--weight-medium);
|
|
32
|
+
line-height: 1.4;
|
|
33
|
+
text-align: left;
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
-webkit-tap-highlight-color: transparent;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.sh-ui-accordion__trigger:hover .sh-ui-accordion__trigger-label {
|
|
39
|
+
text-decoration: underline;
|
|
40
|
+
text-underline-offset: 3px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.sh-ui-accordion__trigger:focus-visible {
|
|
44
|
+
outline: var(--border-width-strong) solid var(--foreground);
|
|
45
|
+
outline-offset: 2px;
|
|
46
|
+
border-radius: calc(var(--radius) - 2px);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.sh-ui-accordion__trigger[disabled],
|
|
50
|
+
.sh-ui-accordion__trigger[data-disabled] {
|
|
51
|
+
cursor: not-allowed;
|
|
52
|
+
color: var(--foreground-muted);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.sh-ui-accordion__trigger-label {
|
|
56
|
+
min-width: 0;
|
|
57
|
+
overflow-wrap: anywhere;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.sh-ui-accordion__chevron {
|
|
61
|
+
flex-shrink: 0;
|
|
62
|
+
color: var(--foreground-muted);
|
|
63
|
+
transition: transform 180ms var(--ease-standard);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.sh-ui-accordion__trigger[data-panel-open] .sh-ui-accordion__chevron {
|
|
67
|
+
transform: rotate(180deg);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* 패널: Base UI가 --accordion-panel-height CSS 변수를 제공. grid trick으로 열림/닫힘 전환. */
|
|
71
|
+
.sh-ui-accordion__panel {
|
|
72
|
+
overflow: hidden;
|
|
73
|
+
height: var(--accordion-panel-height);
|
|
74
|
+
transition: height var(--duration-slow) var(--ease-standard);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.sh-ui-accordion__panel[data-starting-style],
|
|
78
|
+
.sh-ui-accordion__panel[data-ending-style] {
|
|
79
|
+
height: 0;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.sh-ui-accordion__content {
|
|
83
|
+
padding: 0 var(--space-1) var(--space-4);
|
|
84
|
+
font-size: var(--text-sm);
|
|
85
|
+
line-height: 1.6;
|
|
86
|
+
color: var(--foreground-muted);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
@media (prefers-reduced-motion: reduce) {
|
|
90
|
+
.sh-ui-accordion__panel,
|
|
91
|
+
.sh-ui-accordion__chevron {
|
|
92
|
+
transition: none;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/* sh-ui 공용 애니메이션 — Sidebar drawer, Dialog, Toast 등에서 재사용한다.
|
|
2
|
+
*
|
|
3
|
+
* 사용 예:
|
|
4
|
+
* .my-sheet[data-state="open"] {
|
|
5
|
+
* animation: sh-ui-slide-in-from-left var(--ease-duration) var(--ease-out);
|
|
6
|
+
* }
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
:root {
|
|
10
|
+
--ease-duration: 200ms;
|
|
11
|
+
--ease-out: cubic-bezier(0.16, 1, 0.3, 1);
|
|
12
|
+
--ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/* fade */
|
|
16
|
+
@keyframes sh-ui-fade-in {
|
|
17
|
+
from { opacity: 0; }
|
|
18
|
+
to { opacity: 1; }
|
|
19
|
+
}
|
|
20
|
+
@keyframes sh-ui-fade-out {
|
|
21
|
+
from { opacity: 1; }
|
|
22
|
+
to { opacity: 0; }
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* slide from edges */
|
|
26
|
+
@keyframes sh-ui-slide-in-from-left {
|
|
27
|
+
from { transform: translateX(-100%); }
|
|
28
|
+
to { transform: translateX(0); }
|
|
29
|
+
}
|
|
30
|
+
@keyframes sh-ui-slide-in-from-right {
|
|
31
|
+
from { transform: translateX(100%); }
|
|
32
|
+
to { transform: translateX(0); }
|
|
33
|
+
}
|
|
34
|
+
@keyframes sh-ui-slide-in-from-top {
|
|
35
|
+
from { transform: translateY(-100%); }
|
|
36
|
+
to { transform: translateY(0); }
|
|
37
|
+
}
|
|
38
|
+
@keyframes sh-ui-slide-in-from-bottom {
|
|
39
|
+
from { transform: translateY(100%); }
|
|
40
|
+
to { transform: translateY(0); }
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* zoom (Dialog/Popover에 어울림) */
|
|
44
|
+
@keyframes sh-ui-zoom-in {
|
|
45
|
+
from { opacity: 0; transform: scale(0.95); }
|
|
46
|
+
to { opacity: 1; transform: scale(1); }
|
|
47
|
+
}
|
|
48
|
+
@keyframes sh-ui-zoom-out {
|
|
49
|
+
from { opacity: 1; transform: scale(1); }
|
|
50
|
+
to { opacity: 0; transform: scale(0.95); }
|
|
51
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Avatar as BaseAvatar } from "@base-ui-components/react/avatar";
|
|
3
|
+
import "./styles.css";
|
|
4
|
+
|
|
5
|
+
type WithStringClassName<T> = Omit<T, "className"> & { className?: string };
|
|
6
|
+
|
|
7
|
+
function cx(...args: (string | undefined | false | null)[]) {
|
|
8
|
+
return args.filter(Boolean).join(" ");
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type AvatarSize = "sm" | "md" | "lg" | "xl";
|
|
12
|
+
|
|
13
|
+
export interface AvatarProps
|
|
14
|
+
extends WithStringClassName<
|
|
15
|
+
React.ComponentPropsWithoutRef<typeof BaseAvatar.Root>
|
|
16
|
+
> {
|
|
17
|
+
/**
|
|
18
|
+
* 크기.
|
|
19
|
+
* - `sm` (24px) — 댓글·리스트 행
|
|
20
|
+
* - `md` (32px) — 일반 (기본)
|
|
21
|
+
* - `lg` (40px) — 헤더·프로필 카드
|
|
22
|
+
* - `xl` (56px) — 프로필 페이지
|
|
23
|
+
*
|
|
24
|
+
* @default "md"
|
|
25
|
+
*/
|
|
26
|
+
size?: AvatarSize;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* 사용자/엔티티를 대표하는 원형 이미지. `Avatar` 안에 `AvatarImage`와
|
|
31
|
+
* `AvatarFallback`을 함께 둬, 이미지 로드 실패 시 자동으로 fallback이 표시되도록 한다.
|
|
32
|
+
*/
|
|
33
|
+
export const Avatar = React.forwardRef<HTMLSpanElement, AvatarProps>(
|
|
34
|
+
function Avatar({ className, size = "md", ...props }, ref) {
|
|
35
|
+
return (
|
|
36
|
+
<BaseAvatar.Root
|
|
37
|
+
ref={ref}
|
|
38
|
+
className={cx("sh-ui-avatar", `sh-ui-avatar--${size}`, className)}
|
|
39
|
+
{...props}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
},
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
/** Avatar 내부의 실제 이미지. 로드 실패 시 자동으로 가려지고 fallback이 노출된다. */
|
|
46
|
+
export const AvatarImage = React.forwardRef<
|
|
47
|
+
HTMLImageElement,
|
|
48
|
+
WithStringClassName<
|
|
49
|
+
React.ComponentPropsWithoutRef<typeof BaseAvatar.Image>
|
|
50
|
+
>
|
|
51
|
+
>(function AvatarImage({ className, ...props }, ref) {
|
|
52
|
+
return (
|
|
53
|
+
<BaseAvatar.Image
|
|
54
|
+
ref={ref}
|
|
55
|
+
className={cx("sh-ui-avatar__image", className)}
|
|
56
|
+
{...props}
|
|
57
|
+
/>
|
|
58
|
+
);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
/** 이미지가 로드되지 않을 때 표시되는 대체 콘텐츠. 이니셜이나 아이콘을 권장. */
|
|
62
|
+
export const AvatarFallback = React.forwardRef<
|
|
63
|
+
HTMLSpanElement,
|
|
64
|
+
WithStringClassName<
|
|
65
|
+
React.ComponentPropsWithoutRef<typeof BaseAvatar.Fallback>
|
|
66
|
+
>
|
|
67
|
+
>(function AvatarFallback({ className, ...props }, ref) {
|
|
68
|
+
return (
|
|
69
|
+
<BaseAvatar.Fallback
|
|
70
|
+
ref={ref}
|
|
71
|
+
className={cx("sh-ui-avatar__fallback", className)}
|
|
72
|
+
{...props}
|
|
73
|
+
/>
|
|
74
|
+
);
|
|
75
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
.sh-ui-avatar {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: inline-flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
flex-shrink: 0;
|
|
7
|
+
vertical-align: middle;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
border-radius: 999px;
|
|
10
|
+
background: var(--background-muted);
|
|
11
|
+
color: var(--foreground-muted);
|
|
12
|
+
font-weight: var(--weight-medium);
|
|
13
|
+
user-select: none;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.sh-ui-avatar--sm { width: 1.75rem; height: 1.75rem; font-size: var(--text-xs); }
|
|
17
|
+
.sh-ui-avatar--md { width: 2.5rem; height: 2.5rem; font-size: 0.8125rem; }
|
|
18
|
+
.sh-ui-avatar--lg { width: 3rem; height: 3rem; font-size: var(--text-sm); }
|
|
19
|
+
.sh-ui-avatar--xl { width: 4rem; height: 4rem; font-size: var(--text-base); }
|
|
20
|
+
|
|
21
|
+
.sh-ui-avatar__image {
|
|
22
|
+
width: 100%;
|
|
23
|
+
height: 100%;
|
|
24
|
+
object-fit: cover;
|
|
25
|
+
display: block;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.sh-ui-avatar__fallback {
|
|
29
|
+
display: inline-flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
justify-content: center;
|
|
32
|
+
width: 100%;
|
|
33
|
+
height: 100%;
|
|
34
|
+
text-transform: uppercase;
|
|
35
|
+
letter-spacing: 0.02em;
|
|
36
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import "./styles.css";
|
|
3
|
+
|
|
4
|
+
function cx(...args: (string | undefined | false | null)[]) {
|
|
5
|
+
return args.filter(Boolean).join(" ");
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type BadgeVariant =
|
|
9
|
+
| "primary"
|
|
10
|
+
| "secondary"
|
|
11
|
+
| "success"
|
|
12
|
+
| "warning"
|
|
13
|
+
| "danger"
|
|
14
|
+
| "outline";
|
|
15
|
+
|
|
16
|
+
export type BadgeSize = "sm" | "md";
|
|
17
|
+
|
|
18
|
+
export interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
19
|
+
variant?: BadgeVariant;
|
|
20
|
+
size?: BadgeSize;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 상태·카테고리·수량 등을 짧게 표기하는 인라인 라벨. 의미 전달이 색에만
|
|
25
|
+
* 의존하지 않도록 텍스트나 아이콘과 함께 사용할 것.
|
|
26
|
+
*/
|
|
27
|
+
export const Badge = React.forwardRef<HTMLSpanElement, BadgeProps>(
|
|
28
|
+
function Badge({ className, variant = "primary", size = "md", ...props }, ref) {
|
|
29
|
+
return (
|
|
30
|
+
<span
|
|
31
|
+
ref={ref}
|
|
32
|
+
className={cx(
|
|
33
|
+
"sh-ui-badge",
|
|
34
|
+
`sh-ui-badge--${variant}`,
|
|
35
|
+
`sh-ui-badge--${size}`,
|
|
36
|
+
className,
|
|
37
|
+
)}
|
|
38
|
+
{...props}
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
41
|
+
},
|
|
42
|
+
);
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
.sh-ui-badge {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
gap: 0.25rem;
|
|
5
|
+
padding: 0 0.5rem;
|
|
6
|
+
border: 1px solid transparent;
|
|
7
|
+
border-radius: 999px;
|
|
8
|
+
font-weight: var(--weight-medium);
|
|
9
|
+
line-height: 1;
|
|
10
|
+
white-space: nowrap;
|
|
11
|
+
vertical-align: middle;
|
|
12
|
+
user-select: none;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/* sizes */
|
|
16
|
+
.sh-ui-badge--sm {
|
|
17
|
+
height: 1.25rem;
|
|
18
|
+
font-size: 0.6875rem;
|
|
19
|
+
padding: 0 0.375rem;
|
|
20
|
+
}
|
|
21
|
+
.sh-ui-badge--md {
|
|
22
|
+
height: 1.5rem;
|
|
23
|
+
font-size: var(--text-xs);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* variants */
|
|
27
|
+
.sh-ui-badge--primary {
|
|
28
|
+
background: var(--primary);
|
|
29
|
+
color: var(--primary-foreground);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.sh-ui-badge--secondary {
|
|
33
|
+
background: var(--background-muted);
|
|
34
|
+
color: var(--foreground);
|
|
35
|
+
border-color: var(--border);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.sh-ui-badge--success {
|
|
39
|
+
background: var(--success, #16a34a);
|
|
40
|
+
color: #fff;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.sh-ui-badge--warning {
|
|
44
|
+
background: var(--warning, #d97706);
|
|
45
|
+
color: #fff;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.sh-ui-badge--danger {
|
|
49
|
+
background: var(--danger);
|
|
50
|
+
color: var(--danger-foreground, #fff);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.sh-ui-badge--outline {
|
|
54
|
+
background: transparent;
|
|
55
|
+
color: var(--foreground);
|
|
56
|
+
border-color: var(--border-strong);
|
|
57
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/* sh-ui / base — 모바일 안전 기본값 + 공통 리셋.
|
|
2
|
+
*
|
|
3
|
+
* 사용: 글로벌 CSS에서 tokens.css 바로 뒤에 import.
|
|
4
|
+
* @import "./styles/tokens.css";
|
|
5
|
+
* @import "./styles/base.css";
|
|
6
|
+
*
|
|
7
|
+
* 목적:
|
|
8
|
+
* 1. box-sizing, margin 제거 등 일반적 리셋
|
|
9
|
+
* 2. 모바일에서 자식 min-content가 뷰포트를 밀어 가로 스크롤이 생기는 사고 방지
|
|
10
|
+
* 3. 미디어 요소가 부모를 넘치지 않도록 기본 제한
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
*,
|
|
14
|
+
*::before,
|
|
15
|
+
*::after {
|
|
16
|
+
box-sizing: border-box;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
html,
|
|
20
|
+
body {
|
|
21
|
+
margin: 0;
|
|
22
|
+
padding: 0;
|
|
23
|
+
/* 참고: `overflow-x: hidden`을 body에 걸면 position:sticky 자식이
|
|
24
|
+
viewport 대신 body를 스크롤 조상으로 인식해 고장난다.
|
|
25
|
+
가로 오버플로는 아래 `main/section/article { min-width: 0 }` 규칙이 실제 원인을 차단. */
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
body {
|
|
29
|
+
min-height: 100svh;
|
|
30
|
+
background: var(--background);
|
|
31
|
+
color: var(--foreground);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* 미디어: 부모 폭을 절대 넘지 않도록. height: auto로 비율 유지. */
|
|
35
|
+
img,
|
|
36
|
+
svg,
|
|
37
|
+
video,
|
|
38
|
+
canvas,
|
|
39
|
+
audio,
|
|
40
|
+
iframe,
|
|
41
|
+
embed,
|
|
42
|
+
object {
|
|
43
|
+
display: block;
|
|
44
|
+
max-width: 100%;
|
|
45
|
+
height: auto;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* flex/grid 자식의 min-width: auto가 부모를 확장시키는 사고 방지.
|
|
49
|
+
(의도적으로 콘텐츠 크기만큼 커져야 하는 경우 해당 요소에서 min-width: auto로 복원) */
|
|
50
|
+
main,
|
|
51
|
+
section,
|
|
52
|
+
article,
|
|
53
|
+
aside,
|
|
54
|
+
header,
|
|
55
|
+
footer,
|
|
56
|
+
nav {
|
|
57
|
+
min-width: 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* 텍스트 요소 기본 래핑 — 긴 URL/토큰이 부모를 밀지 않게. */
|
|
61
|
+
p,
|
|
62
|
+
li,
|
|
63
|
+
dd,
|
|
64
|
+
dt {
|
|
65
|
+
overflow-wrap: anywhere;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* 공용 컨테이너: 본문 래퍼. 모바일/데스크탑 모두에서 안전한 기본 폭 관리. */
|
|
69
|
+
.sh-ui-container {
|
|
70
|
+
width: 100%;
|
|
71
|
+
max-width: 64rem;
|
|
72
|
+
min-width: 0;
|
|
73
|
+
margin-inline: auto;
|
|
74
|
+
padding-inline: 1.5rem;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@media (max-width: 40rem) {
|
|
78
|
+
.sh-ui-container {
|
|
79
|
+
padding-inline: 1rem;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* 터치 대상 최소 44×44px (WCAG 2.5.5) 가이드.
|
|
84
|
+
버튼/링크가 과도하게 작아지지 않도록 안전 하한. */
|
|
85
|
+
button,
|
|
86
|
+
[role="button"],
|
|
87
|
+
a {
|
|
88
|
+
-webkit-tap-highlight-color: transparent;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* 모션 감소 선호(운영체제 설정) 존중 — WCAG 2.3.3.
|
|
92
|
+
애니메이션·전환을 거의 0으로 줄이고 스크롤 동작도 즉시로. */
|
|
93
|
+
@media (prefers-reduced-motion: reduce) {
|
|
94
|
+
*,
|
|
95
|
+
*::before,
|
|
96
|
+
*::after {
|
|
97
|
+
animation-duration: 0.01ms !important;
|
|
98
|
+
animation-iteration-count: 1 !important;
|
|
99
|
+
transition-duration: 0.01ms !important;
|
|
100
|
+
scroll-behavior: auto !important;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import "./styles.css";
|
|
3
|
+
|
|
4
|
+
function cx(...args: (string | undefined | false | null)[]) {
|
|
5
|
+
return args.filter(Boolean).join(" ");
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/* ───────── Breadcrumb (nav) ─────────
|
|
9
|
+
* 시맨틱: <nav aria-label="Breadcrumb"><ol>...</ol></nav>.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 현재 페이지의 위치를 사이트 계층 위에서 보여주는 내비게이션. 항상 `BreadcrumbList`로
|
|
14
|
+
* 감싸고, 마지막 항목은 링크 대신 `BreadcrumbPage`로 표기해 현재 위치를 알린다.
|
|
15
|
+
*/
|
|
16
|
+
export const Breadcrumb = React.forwardRef<
|
|
17
|
+
HTMLElement,
|
|
18
|
+
React.HTMLAttributes<HTMLElement>
|
|
19
|
+
>(function Breadcrumb({ className, ...props }, ref) {
|
|
20
|
+
return (
|
|
21
|
+
<nav
|
|
22
|
+
ref={ref}
|
|
23
|
+
aria-label="Breadcrumb"
|
|
24
|
+
className={cx("sh-ui-breadcrumb", className)}
|
|
25
|
+
{...props}
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
/* ───────── List (ol) ───────── */
|
|
31
|
+
|
|
32
|
+
/** 항목들을 담는 정렬 리스트(`<ol>`). Breadcrumb 직계 자식으로 사용. */
|
|
33
|
+
export const BreadcrumbList = React.forwardRef<
|
|
34
|
+
HTMLOListElement,
|
|
35
|
+
React.OlHTMLAttributes<HTMLOListElement>
|
|
36
|
+
>(function BreadcrumbList({ className, ...props }, ref) {
|
|
37
|
+
return (
|
|
38
|
+
<ol
|
|
39
|
+
ref={ref}
|
|
40
|
+
className={cx("sh-ui-breadcrumb__list", className)}
|
|
41
|
+
{...props}
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
/* ───────── Item (li) ───────── */
|
|
47
|
+
|
|
48
|
+
/** 한 단계의 항목(`<li>`). 안에 `BreadcrumbLink` 또는 `BreadcrumbPage`를 둔다. */
|
|
49
|
+
export const BreadcrumbItem = React.forwardRef<
|
|
50
|
+
HTMLLIElement,
|
|
51
|
+
React.LiHTMLAttributes<HTMLLIElement>
|
|
52
|
+
>(function BreadcrumbItem({ className, ...props }, ref) {
|
|
53
|
+
return (
|
|
54
|
+
<li
|
|
55
|
+
ref={ref}
|
|
56
|
+
className={cx("sh-ui-breadcrumb__item", className)}
|
|
57
|
+
{...props}
|
|
58
|
+
/>
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
/* ───────── Link ───────── */
|
|
63
|
+
|
|
64
|
+
/** 상위 단계로 이동하는 링크. 라우터 사용 시 `asChild` 패턴 대신 직접 `<a>` 속성으로 전달. */
|
|
65
|
+
export const BreadcrumbLink = React.forwardRef<
|
|
66
|
+
HTMLAnchorElement,
|
|
67
|
+
React.AnchorHTMLAttributes<HTMLAnchorElement>
|
|
68
|
+
>(function BreadcrumbLink({ className, ...props }, ref) {
|
|
69
|
+
return (
|
|
70
|
+
<a
|
|
71
|
+
ref={ref}
|
|
72
|
+
className={cx("sh-ui-breadcrumb__link", className)}
|
|
73
|
+
{...props}
|
|
74
|
+
/>
|
|
75
|
+
);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
/* ───────── Page (현재 위치 — 링크 아님) ───────── */
|
|
79
|
+
|
|
80
|
+
/** 마지막(현재) 항목. 링크가 아니므로 `aria-current="page"`가 자동 부여된다. */
|
|
81
|
+
export const BreadcrumbPage = React.forwardRef<
|
|
82
|
+
HTMLSpanElement,
|
|
83
|
+
React.HTMLAttributes<HTMLSpanElement>
|
|
84
|
+
>(function BreadcrumbPage({ className, ...props }, ref) {
|
|
85
|
+
return (
|
|
86
|
+
<span
|
|
87
|
+
ref={ref}
|
|
88
|
+
role="link"
|
|
89
|
+
aria-current="page"
|
|
90
|
+
aria-disabled="true"
|
|
91
|
+
className={cx("sh-ui-breadcrumb__page", className)}
|
|
92
|
+
{...props}
|
|
93
|
+
/>
|
|
94
|
+
);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
/* ───────── Separator ───────── */
|
|
98
|
+
|
|
99
|
+
/** 항목 사이 구분자. 기본은 `>` 아이콘이며 children으로 교체 가능. 스크린리더에서는 무시된다. */
|
|
100
|
+
export const BreadcrumbSeparator = React.forwardRef<
|
|
101
|
+
HTMLLIElement,
|
|
102
|
+
React.LiHTMLAttributes<HTMLLIElement>
|
|
103
|
+
>(function BreadcrumbSeparator({ className, children, ...props }, ref) {
|
|
104
|
+
return (
|
|
105
|
+
<li
|
|
106
|
+
ref={ref}
|
|
107
|
+
role="presentation"
|
|
108
|
+
aria-hidden="true"
|
|
109
|
+
className={cx("sh-ui-breadcrumb__separator", className)}
|
|
110
|
+
{...props}
|
|
111
|
+
>
|
|
112
|
+
{children ?? <ChevronRightIcon />}
|
|
113
|
+
</li>
|
|
114
|
+
);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
/* ───────── Ellipsis — 중간 항목 축약 ───────── */
|
|
118
|
+
|
|
119
|
+
/** 깊은 경로에서 중간 항목들을 축약하는 점 3개 표시. 클릭 가능한 전체 경로 메뉴와 함께 쓰면 유용. */
|
|
120
|
+
export const BreadcrumbEllipsis = React.forwardRef<
|
|
121
|
+
HTMLSpanElement,
|
|
122
|
+
React.HTMLAttributes<HTMLSpanElement>
|
|
123
|
+
>(function BreadcrumbEllipsis({ className, ...props }, ref) {
|
|
124
|
+
return (
|
|
125
|
+
<span
|
|
126
|
+
ref={ref}
|
|
127
|
+
role="presentation"
|
|
128
|
+
aria-hidden="true"
|
|
129
|
+
className={cx("sh-ui-breadcrumb__ellipsis", className)}
|
|
130
|
+
{...props}
|
|
131
|
+
>
|
|
132
|
+
<svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor" aria-hidden>
|
|
133
|
+
<circle cx="3" cy="8" r="1.25" />
|
|
134
|
+
<circle cx="8" cy="8" r="1.25" />
|
|
135
|
+
<circle cx="13" cy="8" r="1.25" />
|
|
136
|
+
</svg>
|
|
137
|
+
<span className="sh-ui-breadcrumb__ellipsis-sr">더 보기</span>
|
|
138
|
+
</span>
|
|
139
|
+
);
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
function ChevronRightIcon() {
|
|
143
|
+
return (
|
|
144
|
+
<svg width="14" height="14" viewBox="0 0 16 16" fill="none" aria-hidden>
|
|
145
|
+
<path
|
|
146
|
+
d="M6 4l4 4-4 4"
|
|
147
|
+
stroke="currentColor"
|
|
148
|
+
strokeWidth="1.5"
|
|
149
|
+
strokeLinecap="round"
|
|
150
|
+
strokeLinejoin="round"
|
|
151
|
+
/>
|
|
152
|
+
</svg>
|
|
153
|
+
);
|
|
154
|
+
}
|