sh-ui-cli 0.15.0 → 0.21.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/bin/sh-ui.mjs +6 -0
- package/data/changelog/versions.json +354 -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/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 +13 -12
- package/src/list.mjs +3 -11
- package/src/mcp.mjs +308 -0
- package/src/paths.mjs +52 -0
- package/src/remove.mjs +4 -11
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
.sh-ui-pagination {
|
|
2
|
+
display: flex;
|
|
3
|
+
justify-content: center;
|
|
4
|
+
font-size: var(--text-sm);
|
|
5
|
+
color: var(--foreground);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.sh-ui-pagination__content {
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-wrap: wrap;
|
|
11
|
+
align-items: center;
|
|
12
|
+
gap: 0.25rem;
|
|
13
|
+
margin: 0;
|
|
14
|
+
padding: 0;
|
|
15
|
+
list-style: none;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.sh-ui-pagination__item {
|
|
19
|
+
display: inline-flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.sh-ui-pagination__link {
|
|
24
|
+
display: inline-flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
gap: 0.375rem;
|
|
28
|
+
min-width: 2.25rem;
|
|
29
|
+
height: 2.25rem;
|
|
30
|
+
padding: 0 0.75rem;
|
|
31
|
+
border-radius: calc(var(--radius) - 2px);
|
|
32
|
+
border: var(--border-width) solid transparent;
|
|
33
|
+
background: transparent;
|
|
34
|
+
color: var(--foreground);
|
|
35
|
+
text-decoration: none;
|
|
36
|
+
transition:
|
|
37
|
+
background-color var(--duration-fast),
|
|
38
|
+
border-color var(--duration-fast),
|
|
39
|
+
color var(--duration-fast);
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
user-select: none;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.sh-ui-pagination__link[data-size="sm"] {
|
|
45
|
+
min-width: 2rem;
|
|
46
|
+
height: 2rem;
|
|
47
|
+
padding: 0 0.5rem;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.sh-ui-pagination__link:hover {
|
|
51
|
+
background: var(--background-muted);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.sh-ui-pagination__link:focus-visible {
|
|
55
|
+
outline: var(--border-width-strong) solid var(--foreground);
|
|
56
|
+
outline-offset: 2px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.sh-ui-pagination__link[data-active] {
|
|
60
|
+
background: var(--foreground);
|
|
61
|
+
color: var(--background);
|
|
62
|
+
font-weight: var(--weight-medium);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.sh-ui-pagination__link[data-active]:hover {
|
|
66
|
+
background: var(--foreground);
|
|
67
|
+
opacity: 0.9;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.sh-ui-pagination__link[aria-disabled="true"],
|
|
71
|
+
.sh-ui-pagination__link[data-disabled] {
|
|
72
|
+
pointer-events: none;
|
|
73
|
+
opacity: 0.45;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.sh-ui-pagination__nav {
|
|
77
|
+
padding: 0 0.625rem;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.sh-ui-pagination__ellipsis {
|
|
81
|
+
display: inline-flex;
|
|
82
|
+
align-items: center;
|
|
83
|
+
justify-content: center;
|
|
84
|
+
width: 2.25rem;
|
|
85
|
+
height: 2.25rem;
|
|
86
|
+
color: var(--foreground-muted);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.sh-ui-pagination__sr {
|
|
90
|
+
position: absolute;
|
|
91
|
+
width: 1px;
|
|
92
|
+
height: 1px;
|
|
93
|
+
padding: 0;
|
|
94
|
+
margin: -1px;
|
|
95
|
+
overflow: hidden;
|
|
96
|
+
clip: rect(0, 0, 0, 0);
|
|
97
|
+
white-space: nowrap;
|
|
98
|
+
border: 0;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@media (prefers-reduced-motion: reduce) {
|
|
102
|
+
.sh-ui-pagination__link {
|
|
103
|
+
transition: none;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Popover as BasePopover } from "@base-ui-components/react/popover";
|
|
3
|
+
import "./styles.css";
|
|
4
|
+
|
|
5
|
+
type WithStringClassName<T> = Omit<T, "className"> & { className?: string };
|
|
6
|
+
|
|
7
|
+
function cx(...args: (string | undefined | false)[]) {
|
|
8
|
+
return args.filter(Boolean).join(" ");
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 트리거 요소에 떠다니는 가벼운 패널을 띄우는 비모달 컨테이너. 포커스를 가두지 않으므로
|
|
13
|
+
* 짧은 폼·정보 표시에 적합하고, 강제 응답이 필요하면 Dialog를 사용할 것.
|
|
14
|
+
*/
|
|
15
|
+
export const Popover = BasePopover.Root;
|
|
16
|
+
|
|
17
|
+
/** Popover를 여는 트리거. */
|
|
18
|
+
export const PopoverTrigger = BasePopover.Trigger;
|
|
19
|
+
|
|
20
|
+
/** Popover를 닫는 요소. */
|
|
21
|
+
export const PopoverClose = BasePopover.Close;
|
|
22
|
+
|
|
23
|
+
export interface PopoverContentProps
|
|
24
|
+
extends WithStringClassName<React.ComponentPropsWithoutRef<typeof BasePopover.Popup>> {
|
|
25
|
+
/**
|
|
26
|
+
* Trigger 기준 배치 방향. 공간 부족 시 자동으로 반대편으로 뒤집힌다.
|
|
27
|
+
* @default "bottom"
|
|
28
|
+
*/
|
|
29
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
30
|
+
/**
|
|
31
|
+
* 트리거 축에서의 정렬.
|
|
32
|
+
* - `start` — 트리거 시작 가장자리 정렬
|
|
33
|
+
* - `center` — 가운데 (기본)
|
|
34
|
+
* - `end` — 트리거 끝 가장자리 정렬
|
|
35
|
+
*
|
|
36
|
+
* @default "center"
|
|
37
|
+
*/
|
|
38
|
+
align?: "start" | "center" | "end";
|
|
39
|
+
/**
|
|
40
|
+
* Trigger와 Popup 사이 간격(px).
|
|
41
|
+
* @default 8
|
|
42
|
+
*/
|
|
43
|
+
sideOffset?: number;
|
|
44
|
+
/**
|
|
45
|
+
* Portal이 마운트될 DOM 노드.
|
|
46
|
+
* @default document.body
|
|
47
|
+
*/
|
|
48
|
+
container?: React.ComponentPropsWithoutRef<typeof BasePopover.Portal>["container"];
|
|
49
|
+
/**
|
|
50
|
+
* Trigger를 가리키는 화살표 표시 여부.
|
|
51
|
+
* @default false
|
|
52
|
+
*/
|
|
53
|
+
showArrow?: boolean;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Popover의 콘텐츠. 트리거에 자동 위치 조정되어 portal로 마운트된다.
|
|
58
|
+
* `side`/`align`/`sideOffset`로 배치를 미세조정하고, `showArrow`로 화살표를 노출한다.
|
|
59
|
+
*/
|
|
60
|
+
export const PopoverContent = React.forwardRef<HTMLDivElement, PopoverContentProps>(
|
|
61
|
+
function PopoverContent(
|
|
62
|
+
{ className, children, side, align, sideOffset = 8, container, showArrow, ...props },
|
|
63
|
+
ref,
|
|
64
|
+
) {
|
|
65
|
+
return (
|
|
66
|
+
<BasePopover.Portal container={container}>
|
|
67
|
+
<BasePopover.Positioner
|
|
68
|
+
className="sh-ui-popover__positioner"
|
|
69
|
+
side={side}
|
|
70
|
+
align={align}
|
|
71
|
+
sideOffset={sideOffset}
|
|
72
|
+
>
|
|
73
|
+
<BasePopover.Popup
|
|
74
|
+
ref={ref}
|
|
75
|
+
className={cx("sh-ui-popover__content", className)}
|
|
76
|
+
{...props}
|
|
77
|
+
>
|
|
78
|
+
{showArrow && (
|
|
79
|
+
<BasePopover.Arrow className="sh-ui-popover__arrow" />
|
|
80
|
+
)}
|
|
81
|
+
{children}
|
|
82
|
+
</BasePopover.Popup>
|
|
83
|
+
</BasePopover.Positioner>
|
|
84
|
+
</BasePopover.Portal>
|
|
85
|
+
);
|
|
86
|
+
},
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
/** Popover 콘텐츠의 제목. 접근성을 위해 짧은 제목이라도 함께 두는 것을 권장. */
|
|
90
|
+
export const PopoverTitle = React.forwardRef<
|
|
91
|
+
HTMLHeadingElement,
|
|
92
|
+
WithStringClassName<React.ComponentPropsWithoutRef<typeof BasePopover.Title>>
|
|
93
|
+
>(function PopoverTitle({ className, ...props }, ref) {
|
|
94
|
+
return (
|
|
95
|
+
<BasePopover.Title
|
|
96
|
+
ref={ref}
|
|
97
|
+
className={cx("sh-ui-popover__title", className)}
|
|
98
|
+
{...props}
|
|
99
|
+
/>
|
|
100
|
+
);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
/** Popover 콘텐츠의 보조 설명. */
|
|
104
|
+
export const PopoverDescription = React.forwardRef<
|
|
105
|
+
HTMLParagraphElement,
|
|
106
|
+
WithStringClassName<React.ComponentPropsWithoutRef<typeof BasePopover.Description>>
|
|
107
|
+
>(function PopoverDescription({ className, ...props }, ref) {
|
|
108
|
+
return (
|
|
109
|
+
<BasePopover.Description
|
|
110
|
+
ref={ref}
|
|
111
|
+
className={cx("sh-ui-popover__description", className)}
|
|
112
|
+
{...props}
|
|
113
|
+
/>
|
|
114
|
+
);
|
|
115
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
.sh-ui-popover__positioner {
|
|
2
|
+
z-index: var(--z-popover);
|
|
3
|
+
outline: none;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.sh-ui-popover__content {
|
|
7
|
+
min-width: 12rem;
|
|
8
|
+
padding: var(--space-2);
|
|
9
|
+
background: var(--background);
|
|
10
|
+
color: var(--foreground);
|
|
11
|
+
border: 1px solid var(--border);
|
|
12
|
+
border-radius: var(--radius);
|
|
13
|
+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
|
|
14
|
+
outline: none;
|
|
15
|
+
font-size: var(--text-sm);
|
|
16
|
+
line-height: 1.4;
|
|
17
|
+
transform-origin: var(--transform-origin);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.sh-ui-popover__content[data-starting-style],
|
|
21
|
+
.sh-ui-popover__content[data-ending-style] {
|
|
22
|
+
opacity: 0;
|
|
23
|
+
transform: scale(0.96);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.sh-ui-popover__content {
|
|
27
|
+
transition:
|
|
28
|
+
opacity 140ms ease,
|
|
29
|
+
transform 140ms ease;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.sh-ui-popover__content:focus-visible {
|
|
33
|
+
outline: var(--border-width-strong) solid var(--foreground);
|
|
34
|
+
outline-offset: 2px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.sh-ui-popover__arrow {
|
|
38
|
+
color: var(--background);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.sh-ui-popover__arrow svg {
|
|
42
|
+
display: block;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.sh-ui-popover__title {
|
|
46
|
+
margin: 0 0 var(--space-1);
|
|
47
|
+
font-weight: var(--weight-semibold);
|
|
48
|
+
font-size: 0.9375rem;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.sh-ui-popover__description {
|
|
52
|
+
margin: 0;
|
|
53
|
+
color: var(--foreground-muted);
|
|
54
|
+
font-size: 0.8125rem;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@media (prefers-reduced-motion: reduce) {
|
|
58
|
+
.sh-ui-popover__content {
|
|
59
|
+
transition: none;
|
|
60
|
+
}
|
|
61
|
+
.sh-ui-popover__content[data-starting-style],
|
|
62
|
+
.sh-ui-popover__content[data-ending-style] {
|
|
63
|
+
transform: none;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
function clamp(n: number, min: number, max: number) {
|
|
9
|
+
return Math.min(max, Math.max(min, n));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface ProgressProps
|
|
13
|
+
extends Omit<React.HTMLAttributes<HTMLDivElement>, "role"> {
|
|
14
|
+
/** 0~100 사이의 현재 값. 생략 시 indeterminate 모드. */
|
|
15
|
+
value?: number;
|
|
16
|
+
/** 최댓값. 기본 100. */
|
|
17
|
+
max?: number;
|
|
18
|
+
/** 접근성: aria-label (시각적 라벨이 없으면 권장). */
|
|
19
|
+
"aria-label"?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 작업 진행도를 가로 바로 표시. value가 없으면 무한 루프 indeterminate.
|
|
24
|
+
*
|
|
25
|
+
* - determinate: `<Progress value={40} />`
|
|
26
|
+
* - indeterminate: `<Progress aria-label="로딩 중" />`
|
|
27
|
+
*/
|
|
28
|
+
export const Progress = React.forwardRef<HTMLDivElement, ProgressProps>(
|
|
29
|
+
function Progress(
|
|
30
|
+
{ value, max = 100, className, "aria-label": ariaLabel, ...props },
|
|
31
|
+
ref,
|
|
32
|
+
) {
|
|
33
|
+
const isDeterminate = value !== undefined;
|
|
34
|
+
const normalized = isDeterminate ? clamp((value / max) * 100, 0, 100) : 0;
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<div
|
|
38
|
+
ref={ref}
|
|
39
|
+
role="progressbar"
|
|
40
|
+
aria-label={ariaLabel}
|
|
41
|
+
aria-valuemin={isDeterminate ? 0 : undefined}
|
|
42
|
+
aria-valuemax={isDeterminate ? max : undefined}
|
|
43
|
+
aria-valuenow={isDeterminate ? value : undefined}
|
|
44
|
+
data-state={isDeterminate ? "determinate" : "indeterminate"}
|
|
45
|
+
className={cx("sh-ui-progress", className)}
|
|
46
|
+
{...props}
|
|
47
|
+
>
|
|
48
|
+
<div
|
|
49
|
+
className="sh-ui-progress__indicator"
|
|
50
|
+
style={isDeterminate ? { width: `${normalized}%` } : undefined}
|
|
51
|
+
/>
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
},
|
|
55
|
+
);
|
|
56
|
+
Progress.displayName = "Progress";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
.sh-ui-progress {
|
|
2
|
+
position: relative;
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 0.5rem;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
background: var(--background-muted);
|
|
7
|
+
border-radius: 999px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.sh-ui-progress__indicator {
|
|
11
|
+
height: 100%;
|
|
12
|
+
background: var(--primary);
|
|
13
|
+
border-radius: 999px;
|
|
14
|
+
transition: width var(--duration-base) ease;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* indeterminate 모드: 바가 좌우로 왕복 */
|
|
18
|
+
.sh-ui-progress[data-state="indeterminate"] .sh-ui-progress__indicator {
|
|
19
|
+
width: 40%;
|
|
20
|
+
animation: sh-ui-progress-slide 1.2s ease-in-out infinite;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@keyframes sh-ui-progress-slide {
|
|
24
|
+
0% {
|
|
25
|
+
transform: translateX(-100%);
|
|
26
|
+
}
|
|
27
|
+
100% {
|
|
28
|
+
transform: translateX(250%);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@media (prefers-reduced-motion: reduce) {
|
|
33
|
+
.sh-ui-progress__indicator {
|
|
34
|
+
transition: none;
|
|
35
|
+
}
|
|
36
|
+
.sh-ui-progress[data-state="indeterminate"] .sh-ui-progress__indicator {
|
|
37
|
+
/* 움직임 최소화 — 중앙에 정지된 바 */
|
|
38
|
+
animation: none;
|
|
39
|
+
transform: translateX(75%);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Radio as BaseRadio } from "@base-ui-components/react/radio";
|
|
3
|
+
import { RadioGroup as BaseRadioGroup } from "@base-ui-components/react/radio-group";
|
|
4
|
+
import "./styles.css";
|
|
5
|
+
|
|
6
|
+
function cx(...args: (string | undefined | false)[]) {
|
|
7
|
+
return args.filter(Boolean).join(" ");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/* ───────────── Radio ───────────── */
|
|
11
|
+
|
|
12
|
+
export type RadioProps = Omit<
|
|
13
|
+
React.ComponentPropsWithoutRef<typeof BaseRadio.Root>,
|
|
14
|
+
"className"
|
|
15
|
+
> & {
|
|
16
|
+
className?: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* 단일 선택지. 단독으로 쓰지 않고 반드시 `RadioGroup` 안에 두 개 이상을 묶어 사용한다.
|
|
21
|
+
* 단일 선택이지만 즉시 적용되는 설정에는 Switch를, 다중 선택에는 Checkbox를 권장.
|
|
22
|
+
*/
|
|
23
|
+
export const Radio = React.forwardRef<HTMLElement, RadioProps>(
|
|
24
|
+
({ className, ...props }, ref) => (
|
|
25
|
+
<BaseRadio.Root
|
|
26
|
+
ref={ref}
|
|
27
|
+
className={cx("sh-ui-radio", className)}
|
|
28
|
+
{...props}
|
|
29
|
+
>
|
|
30
|
+
<BaseRadio.Indicator className="sh-ui-radio__indicator" />
|
|
31
|
+
</BaseRadio.Root>
|
|
32
|
+
),
|
|
33
|
+
);
|
|
34
|
+
Radio.displayName = "Radio";
|
|
35
|
+
|
|
36
|
+
/* ───────────── RadioGroup ───────────── */
|
|
37
|
+
|
|
38
|
+
export type RadioGroupProps = Omit<
|
|
39
|
+
React.ComponentPropsWithoutRef<typeof BaseRadioGroup>,
|
|
40
|
+
"className"
|
|
41
|
+
> & {
|
|
42
|
+
className?: string;
|
|
43
|
+
/**
|
|
44
|
+
* 그룹 내 항목 배치 방향.
|
|
45
|
+
* - `vertical` — 세로 나열 (기본)
|
|
46
|
+
* - `horizontal` — 가로 나열. 짧은 라벨 2~3개에만 권장
|
|
47
|
+
*
|
|
48
|
+
* @default "vertical"
|
|
49
|
+
*/
|
|
50
|
+
orientation?: "horizontal" | "vertical";
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* 여러 Radio를 묶는 컨테이너. 같은 `name` 아래 단일 선택을 보장하고,
|
|
55
|
+
* 키보드 화살표로 항목 간 이동이 가능하다. 그룹 라벨은 외부 `<Label>`로 제공할 것.
|
|
56
|
+
*/
|
|
57
|
+
export const RadioGroup = React.forwardRef<HTMLDivElement, RadioGroupProps>(
|
|
58
|
+
({ className, orientation = "vertical", ...props }, ref) => (
|
|
59
|
+
<BaseRadioGroup
|
|
60
|
+
ref={ref}
|
|
61
|
+
className={cx("sh-ui-radio-group", className)}
|
|
62
|
+
data-orientation={orientation}
|
|
63
|
+
{...props}
|
|
64
|
+
/>
|
|
65
|
+
),
|
|
66
|
+
);
|
|
67
|
+
RadioGroup.displayName = "RadioGroup";
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/* ───────────── Radio ───────────── */
|
|
2
|
+
|
|
3
|
+
.sh-ui-radio {
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
width: 1.125rem;
|
|
8
|
+
height: 1.125rem;
|
|
9
|
+
border: 1px solid var(--border-strong);
|
|
10
|
+
border-radius: 999px;
|
|
11
|
+
background: var(--background);
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
flex-shrink: 0;
|
|
14
|
+
transition: border-color var(--duration-fast);
|
|
15
|
+
-webkit-tap-highlight-color: transparent;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.sh-ui-radio:hover:not([data-disabled]) {
|
|
19
|
+
border-color: var(--foreground);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.sh-ui-radio:focus-visible {
|
|
23
|
+
outline: var(--border-width-strong) solid var(--foreground);
|
|
24
|
+
outline-offset: 2px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.sh-ui-radio[data-checked] {
|
|
28
|
+
border-color: var(--primary);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.sh-ui-radio[data-disabled] {
|
|
32
|
+
opacity: var(--opacity-disabled);
|
|
33
|
+
cursor: not-allowed;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* 모바일/터치: 최소 탭 영역 */
|
|
37
|
+
@media (hover: none) and (pointer: coarse) {
|
|
38
|
+
.sh-ui-radio {
|
|
39
|
+
width: 1.25rem;
|
|
40
|
+
height: 1.25rem;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* ───────────── Indicator (내부 원) ───────────── */
|
|
45
|
+
|
|
46
|
+
.sh-ui-radio__indicator {
|
|
47
|
+
width: 0.5rem;
|
|
48
|
+
height: 0.5rem;
|
|
49
|
+
border-radius: 999px;
|
|
50
|
+
background: var(--primary);
|
|
51
|
+
transform: scale(0);
|
|
52
|
+
transition: transform var(--duration-fast) ease-out;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.sh-ui-radio[data-checked] .sh-ui-radio__indicator {
|
|
56
|
+
transform: scale(1);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* ───────────── RadioGroup ───────────── */
|
|
60
|
+
|
|
61
|
+
.sh-ui-radio-group {
|
|
62
|
+
display: flex;
|
|
63
|
+
gap: 0.625rem;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.sh-ui-radio-group[data-orientation="vertical"] {
|
|
67
|
+
flex-direction: column;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.sh-ui-radio-group[data-orientation="horizontal"] {
|
|
71
|
+
flex-direction: row;
|
|
72
|
+
flex-wrap: wrap;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@media (prefers-reduced-motion: reduce) {
|
|
76
|
+
.sh-ui-radio,
|
|
77
|
+
.sh-ui-radio__indicator {
|
|
78
|
+
transition: none;
|
|
79
|
+
}
|
|
80
|
+
}
|