sh-ui-cli 0.46.0 → 0.48.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/data/changelog/versions.json +25 -0
- package/data/registry/react/components/accordion/index.module.tsx +97 -0
- package/data/registry/react/components/accordion/styles.module.css +111 -0
- package/data/registry/react/components/avatar/index.module.tsx +73 -0
- package/data/registry/react/components/avatar/styles.module.css +36 -0
- package/data/registry/react/components/badge/index.module.tsx +40 -0
- package/data/registry/react/components/badge/styles.module.css +57 -0
- package/data/registry/react/components/breadcrumb/index.module.tsx +152 -0
- package/data/registry/react/components/breadcrumb/styles.module.css +82 -0
- package/data/registry/react/components/calendar/index.module.tsx +806 -0
- package/data/registry/react/components/calendar/styles.module.css +213 -0
- package/data/registry/react/components/carousel/index.module.tsx +430 -0
- package/data/registry/react/components/carousel/styles.module.css +155 -0
- package/data/registry/react/components/checkbox/index.module.tsx +96 -0
- package/data/registry/react/components/checkbox/styles.module.css +75 -0
- package/data/registry/react/components/code-editor/index.module.tsx +230 -0
- package/data/registry/react/components/code-editor/styles.module.css +76 -0
- package/data/registry/react/components/code-panel/index.module.tsx +191 -0
- package/data/registry/react/components/code-panel/styles.module.css +124 -0
- package/data/registry/react/components/color-picker/index.module.tsx +467 -0
- package/data/registry/react/components/color-picker/styles.module.css +166 -0
- package/data/registry/react/components/combobox/index.module.tsx +165 -0
- package/data/registry/react/components/combobox/styles.module.css +151 -0
- package/data/registry/react/components/context-menu/index.module.tsx +251 -0
- package/data/registry/react/components/context-menu/styles.module.css +140 -0
- package/data/registry/react/components/date-picker/index.module.tsx +520 -0
- package/data/registry/react/components/date-picker/styles.module.css +103 -0
- package/data/registry/react/components/dialog/index.module.tsx +95 -0
- package/data/registry/react/components/dialog/styles.module.css +127 -0
- package/data/registry/react/components/dropdown-menu/index.module.tsx +255 -0
- package/data/registry/react/components/dropdown-menu/styles.module.css +150 -0
- package/data/registry/react/components/file-upload/index.module.tsx +487 -0
- package/data/registry/react/components/file-upload/styles.module.css +170 -0
- package/data/registry/react/components/form/index.module.tsx +61 -0
- package/data/registry/react/components/form/styles.module.css +47 -0
- package/data/registry/react/components/header/index.module.tsx +805 -0
- package/data/registry/react/components/header/styles.module.css +350 -0
- package/data/registry/react/components/label/index.module.tsx +52 -0
- package/data/registry/react/components/label/styles.module.css +90 -0
- package/data/registry/react/components/markdown-editor/index.module.tsx +119 -0
- package/data/registry/react/components/markdown-editor/styles.module.css +160 -0
- package/data/registry/react/components/menubar/index.module.tsx +32 -0
- package/data/registry/react/components/menubar/styles.module.css +45 -0
- package/data/registry/react/components/numeric-input/index.module.tsx +148 -0
- package/data/registry/react/components/numeric-input/styles.module.css +56 -0
- package/data/registry/react/components/page-toc/index.module.tsx +174 -0
- package/data/registry/react/components/page-toc/styles.module.css +82 -0
- package/data/registry/react/components/pagination/index.module.tsx +269 -0
- package/data/registry/react/components/pagination/styles.module.css +105 -0
- package/data/registry/react/components/popover/index.module.tsx +113 -0
- package/data/registry/react/components/popover/styles.module.css +65 -0
- package/data/registry/react/components/progress/index.module.tsx +54 -0
- package/data/registry/react/components/progress/styles.module.css +41 -0
- package/data/registry/react/components/radio/index.module.tsx +65 -0
- package/data/registry/react/components/radio/styles.module.css +80 -0
- package/data/registry/react/components/rich-text-editor/index.module.tsx +348 -0
- package/data/registry/react/components/rich-text-editor/styles.module.css +196 -0
- package/data/registry/react/components/select/index.module.tsx +234 -0
- package/data/registry/react/components/select/styles.module.css +193 -0
- package/data/registry/react/components/separator/index.module.tsx +46 -0
- package/data/registry/react/components/separator/styles.module.css +15 -0
- package/data/registry/react/components/sidebar/index.module.tsx +1067 -0
- package/data/registry/react/components/sidebar/styles.module.css +502 -0
- package/data/registry/react/components/skeleton/index.module.tsx +22 -0
- package/data/registry/react/components/skeleton/styles.module.css +24 -0
- package/data/registry/react/components/slider/index.module.tsx +298 -0
- package/data/registry/react/components/slider/styles.module.css +64 -0
- package/data/registry/react/components/spinner/index.module.tsx +38 -0
- package/data/registry/react/components/spinner/styles.module.css +37 -0
- package/data/registry/react/components/switch/index.module.tsx +39 -0
- package/data/registry/react/components/switch/styles.module.css +83 -0
- package/data/registry/react/components/tabs/index.module.tsx +91 -0
- package/data/registry/react/components/tabs/styles.module.css +148 -0
- package/data/registry/react/components/textarea/index.module.tsx +23 -0
- package/data/registry/react/components/textarea/styles.module.css +54 -0
- package/data/registry/react/components/toast/index.module.tsx +258 -0
- package/data/registry/react/components/toast/styles.module.css +290 -0
- package/data/registry/react/components/toggle/index.module.tsx +131 -0
- package/data/registry/react/components/toggle/styles.module.css +85 -0
- package/data/registry/react/components/tooltip/index.module.tsx +83 -0
- package/data/registry/react/components/tooltip/styles.module.css +44 -0
- package/data/registry/react/registry.json +560 -0
- package/package.json +1 -1
- package/src/api.d.ts +4 -3
- package/src/constants.js +4 -3
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Select as BaseSelect } from "@base-ui/react/select";
|
|
5
|
+
import styles from "./styles.module.css";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
import { cn } from "@SH_UI_UTILS@";
|
|
9
|
+
export const Select = BaseSelect.Root;
|
|
10
|
+
|
|
11
|
+
/** shadcn 호환: <SelectValue placeholder="..." /> */
|
|
12
|
+
export function SelectValue({
|
|
13
|
+
placeholder,
|
|
14
|
+
className,
|
|
15
|
+
...props
|
|
16
|
+
}: { placeholder?: string; className?: string } & Omit<
|
|
17
|
+
React.ComponentPropsWithoutRef<typeof BaseSelect.Value>,
|
|
18
|
+
"children"
|
|
19
|
+
>) {
|
|
20
|
+
return (
|
|
21
|
+
<BaseSelect.Value className={cn(styles.select__value, className)} {...props}>
|
|
22
|
+
{(value) =>
|
|
23
|
+
value !== null && value !== undefined && value !== "" ? (
|
|
24
|
+
(value as React.ReactNode)
|
|
25
|
+
) : (
|
|
26
|
+
<span className={styles.select__placeholder}>{placeholder}</span>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
</BaseSelect.Value>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const SelectTrigger = React.forwardRef<
|
|
34
|
+
HTMLButtonElement,
|
|
35
|
+
Omit<React.ComponentPropsWithoutRef<typeof BaseSelect.Trigger>, "className"> & { className?: string }
|
|
36
|
+
>(({ className, children, ...props }, ref) => (
|
|
37
|
+
<BaseSelect.Trigger
|
|
38
|
+
ref={ref}
|
|
39
|
+
className={cn(styles.select__trigger, className)}
|
|
40
|
+
{...props}
|
|
41
|
+
>
|
|
42
|
+
{children}
|
|
43
|
+
<BaseSelect.Icon className={styles.select__icon} aria-hidden>
|
|
44
|
+
<svg viewBox="0 0 16 16" width="14" height="14" fill="none">
|
|
45
|
+
<path
|
|
46
|
+
d="M4 6l4 4 4-4"
|
|
47
|
+
stroke="currentColor"
|
|
48
|
+
strokeWidth="1.5"
|
|
49
|
+
strokeLinecap="round"
|
|
50
|
+
strokeLinejoin="round"
|
|
51
|
+
/>
|
|
52
|
+
</svg>
|
|
53
|
+
</BaseSelect.Icon>
|
|
54
|
+
</BaseSelect.Trigger>
|
|
55
|
+
));
|
|
56
|
+
SelectTrigger.displayName = "SelectTrigger";
|
|
57
|
+
|
|
58
|
+
/** Portal + Positioner + Popup을 한 번에.
|
|
59
|
+
* container: portal이 마운트될 DOM 노드. 기본 body. 토큰 스코프 안에 띄우려면 해당 컨테이너 ref 전달. */
|
|
60
|
+
export const SelectContent = React.forwardRef<
|
|
61
|
+
HTMLDivElement,
|
|
62
|
+
Omit<React.ComponentPropsWithoutRef<typeof BaseSelect.Popup>, "className"> & {
|
|
63
|
+
className?: string;
|
|
64
|
+
container?: React.ComponentPropsWithoutRef<typeof BaseSelect.Portal>["container"];
|
|
65
|
+
}
|
|
66
|
+
>(({ className, children, container, ...props }, ref) => (
|
|
67
|
+
<BaseSelect.Portal container={container}>
|
|
68
|
+
<BaseSelect.Positioner
|
|
69
|
+
className={styles.select__positioner}
|
|
70
|
+
sideOffset={4}
|
|
71
|
+
align="start"
|
|
72
|
+
>
|
|
73
|
+
<BaseSelect.Popup
|
|
74
|
+
ref={ref}
|
|
75
|
+
className={cn(styles.select__content, className)}
|
|
76
|
+
{...props}
|
|
77
|
+
>
|
|
78
|
+
{children}
|
|
79
|
+
</BaseSelect.Popup>
|
|
80
|
+
</BaseSelect.Positioner>
|
|
81
|
+
</BaseSelect.Portal>
|
|
82
|
+
));
|
|
83
|
+
SelectContent.displayName = "SelectContent";
|
|
84
|
+
|
|
85
|
+
export const SelectGroup = BaseSelect.Group;
|
|
86
|
+
|
|
87
|
+
export const SelectLabel = React.forwardRef<
|
|
88
|
+
HTMLDivElement,
|
|
89
|
+
Omit<React.ComponentPropsWithoutRef<typeof BaseSelect.GroupLabel>, "className"> & { className?: string }
|
|
90
|
+
>(({ className, ...props }, ref) => (
|
|
91
|
+
<BaseSelect.GroupLabel
|
|
92
|
+
ref={ref}
|
|
93
|
+
className={cn(styles.select__label, className)}
|
|
94
|
+
{...props}
|
|
95
|
+
/>
|
|
96
|
+
));
|
|
97
|
+
SelectLabel.displayName = "SelectLabel";
|
|
98
|
+
|
|
99
|
+
export const SelectItem = React.forwardRef<
|
|
100
|
+
HTMLDivElement,
|
|
101
|
+
Omit<React.ComponentPropsWithoutRef<typeof BaseSelect.Item>, "className"> & { className?: string }
|
|
102
|
+
>(({ className, children, ...props }, ref) => (
|
|
103
|
+
<BaseSelect.Item
|
|
104
|
+
ref={ref}
|
|
105
|
+
className={cn(styles.select__item, className)}
|
|
106
|
+
{...props}
|
|
107
|
+
>
|
|
108
|
+
<BaseSelect.ItemIndicator className={styles.select__indicator} aria-hidden>
|
|
109
|
+
<svg viewBox="0 0 16 16" width="14" height="14" fill="none">
|
|
110
|
+
<path
|
|
111
|
+
d="M3.5 8.5l3 3 6-7"
|
|
112
|
+
stroke="currentColor"
|
|
113
|
+
strokeWidth="1.75"
|
|
114
|
+
strokeLinecap="round"
|
|
115
|
+
strokeLinejoin="round"
|
|
116
|
+
/>
|
|
117
|
+
</svg>
|
|
118
|
+
</BaseSelect.ItemIndicator>
|
|
119
|
+
<BaseSelect.ItemText className={styles["select__item-text"]}>
|
|
120
|
+
{children}
|
|
121
|
+
</BaseSelect.ItemText>
|
|
122
|
+
</BaseSelect.Item>
|
|
123
|
+
));
|
|
124
|
+
SelectItem.displayName = "SelectItem";
|
|
125
|
+
|
|
126
|
+
export const SelectSeparator = React.forwardRef<
|
|
127
|
+
HTMLDivElement,
|
|
128
|
+
Omit<React.ComponentPropsWithoutRef<typeof BaseSelect.Separator>, "className"> & { className?: string }
|
|
129
|
+
>(({ className, ...props }, ref) => (
|
|
130
|
+
<BaseSelect.Separator
|
|
131
|
+
ref={ref}
|
|
132
|
+
className={cn(styles.select__separator, className)}
|
|
133
|
+
{...props}
|
|
134
|
+
/>
|
|
135
|
+
));
|
|
136
|
+
SelectSeparator.displayName = "SelectSeparator";
|
|
137
|
+
|
|
138
|
+
/* ───────── Multi-select ─────────
|
|
139
|
+
*
|
|
140
|
+
* Base UI Select의 `multiple` 모드를 얇게 래핑한 것.
|
|
141
|
+
* Trigger/Content/Item/Group/Label/Separator는 그대로 재사용한다.
|
|
142
|
+
*/
|
|
143
|
+
|
|
144
|
+
type BaseRootProps = React.ComponentPropsWithoutRef<typeof BaseSelect.Root>;
|
|
145
|
+
|
|
146
|
+
/** 칩 X 버튼 등에서 개별 항목을 제거할 수 있도록 MultiSelect 내부 상태를 expose한다. */
|
|
147
|
+
type MultiSelectCtx = {
|
|
148
|
+
values: string[];
|
|
149
|
+
remove: (value: string) => void;
|
|
150
|
+
clear: () => void;
|
|
151
|
+
};
|
|
152
|
+
const MultiSelectContext = React.createContext<MultiSelectCtx | null>(null);
|
|
153
|
+
export const useMultiSelect = () => {
|
|
154
|
+
const ctx = React.useContext(MultiSelectContext);
|
|
155
|
+
if (!ctx) throw new Error("useMultiSelect는 MultiSelect 하위에서만 사용할 수 있습니다.");
|
|
156
|
+
return ctx;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export const MultiSelect = React.forwardRef<
|
|
160
|
+
HTMLDivElement,
|
|
161
|
+
Omit<BaseRootProps, "multiple" | "value" | "defaultValue" | "onValueChange"> & {
|
|
162
|
+
value?: string[];
|
|
163
|
+
defaultValue?: string[];
|
|
164
|
+
onValueChange?: (value: string[]) => void;
|
|
165
|
+
}
|
|
166
|
+
>(({ value: valueProp, defaultValue, onValueChange, children, ...props }, _ref) => {
|
|
167
|
+
const isControlled = valueProp !== undefined;
|
|
168
|
+
const [internal, setInternal] = React.useState<string[]>(defaultValue ?? []);
|
|
169
|
+
const values = isControlled ? valueProp! : internal;
|
|
170
|
+
|
|
171
|
+
const commit = React.useCallback(
|
|
172
|
+
(next: string[]) => {
|
|
173
|
+
if (!isControlled) setInternal(next);
|
|
174
|
+
onValueChange?.(next);
|
|
175
|
+
},
|
|
176
|
+
[isControlled, onValueChange],
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
const ctx = React.useMemo<MultiSelectCtx>(
|
|
180
|
+
() => ({
|
|
181
|
+
values,
|
|
182
|
+
remove: (v) => commit(values.filter((x) => x !== v)),
|
|
183
|
+
clear: () => commit([]),
|
|
184
|
+
}),
|
|
185
|
+
[values, commit],
|
|
186
|
+
);
|
|
187
|
+
|
|
188
|
+
return (
|
|
189
|
+
<MultiSelectContext.Provider value={ctx}>
|
|
190
|
+
<BaseSelect.Root multiple value={values} onValueChange={commit} {...props}>
|
|
191
|
+
{children}
|
|
192
|
+
</BaseSelect.Root>
|
|
193
|
+
</MultiSelectContext.Provider>
|
|
194
|
+
);
|
|
195
|
+
});
|
|
196
|
+
MultiSelect.displayName = "MultiSelect";
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* 다중 선택 값 표시. 배열이 비면 placeholder, 있으면 join 또는 사용자 정의 renderer.
|
|
200
|
+
*
|
|
201
|
+
* <MultiSelectValue placeholder="과일" /> // "Apple, Banana"
|
|
202
|
+
* <MultiSelectValue placeholder="과일" render={(arr) => ...} /> // 커스텀 (칩 등)
|
|
203
|
+
*/
|
|
204
|
+
export function MultiSelectValue({
|
|
205
|
+
placeholder,
|
|
206
|
+
render,
|
|
207
|
+
separator = ", ",
|
|
208
|
+
className,
|
|
209
|
+
...props
|
|
210
|
+
}: {
|
|
211
|
+
placeholder?: string;
|
|
212
|
+
render?: (
|
|
213
|
+
values: string[],
|
|
214
|
+
handlers: { remove: (value: string) => void; clear: () => void },
|
|
215
|
+
) => React.ReactNode;
|
|
216
|
+
separator?: string;
|
|
217
|
+
className?: string;
|
|
218
|
+
} & Omit<
|
|
219
|
+
React.ComponentPropsWithoutRef<typeof BaseSelect.Value>,
|
|
220
|
+
"children" | "render"
|
|
221
|
+
>) {
|
|
222
|
+
const { remove, clear } = useMultiSelect();
|
|
223
|
+
return (
|
|
224
|
+
<BaseSelect.Value className={cn(styles.select__value, className)} {...props}>
|
|
225
|
+
{(value) => {
|
|
226
|
+
const arr = Array.isArray(value) ? (value as string[]) : [];
|
|
227
|
+
if (arr.length === 0) {
|
|
228
|
+
return <span className={styles.select__placeholder}>{placeholder}</span>;
|
|
229
|
+
}
|
|
230
|
+
return render ? render(arr, { remove, clear }) : arr.join(separator);
|
|
231
|
+
}}
|
|
232
|
+
</BaseSelect.Value>
|
|
233
|
+
);
|
|
234
|
+
}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
.select__trigger {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: space-between;
|
|
5
|
+
gap: var(--space-2);
|
|
6
|
+
min-width: 10rem;
|
|
7
|
+
height: var(--control-md);
|
|
8
|
+
padding: 0 var(--space-3);
|
|
9
|
+
background: var(--background);
|
|
10
|
+
color: var(--foreground);
|
|
11
|
+
border: 1px solid var(--border);
|
|
12
|
+
border-radius: var(--radius);
|
|
13
|
+
font-size: var(--text-sm);
|
|
14
|
+
line-height: 1;
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
transition: border-color var(--duration-fast), background-color var(--duration-fast);
|
|
17
|
+
user-select: none;
|
|
18
|
+
-webkit-tap-highlight-color: transparent;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.select__trigger:hover:not(:disabled) {
|
|
22
|
+
border-color: var(--border-strong);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.select__trigger:focus-visible {
|
|
26
|
+
outline: var(--border-width-strong) solid var(--foreground);
|
|
27
|
+
outline-offset: 2px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.select__trigger[data-popup-open] {
|
|
31
|
+
border-color: var(--border-strong);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.select__trigger:disabled {
|
|
35
|
+
opacity: var(--opacity-disabled);
|
|
36
|
+
pointer-events: none;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.select__value {
|
|
40
|
+
flex: 1 1 auto;
|
|
41
|
+
text-align: left;
|
|
42
|
+
overflow: hidden;
|
|
43
|
+
text-overflow: ellipsis;
|
|
44
|
+
white-space: nowrap;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.select__placeholder {
|
|
48
|
+
color: var(--foreground-subtle);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.select__icon {
|
|
52
|
+
display: inline-flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
justify-content: center;
|
|
55
|
+
color: var(--foreground-muted);
|
|
56
|
+
flex-shrink: 0;
|
|
57
|
+
transition: transform var(--duration-fast);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.select__trigger[data-popup-open] .select__icon {
|
|
61
|
+
transform: rotate(180deg);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* 팝업 */
|
|
65
|
+
.select__positioner {
|
|
66
|
+
outline: none;
|
|
67
|
+
z-index: var(--z-dropdown);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.select__content {
|
|
71
|
+
min-width: var(--anchor-width, 10rem);
|
|
72
|
+
max-height: min(24rem, var(--available-height, 24rem));
|
|
73
|
+
overflow-y: auto;
|
|
74
|
+
padding: var(--space-1);
|
|
75
|
+
background: var(--background);
|
|
76
|
+
color: var(--foreground);
|
|
77
|
+
border: 1px solid var(--border);
|
|
78
|
+
border-radius: var(--radius);
|
|
79
|
+
box-shadow:
|
|
80
|
+
0 4px 6px -1px rgba(0, 0, 0, 0.08),
|
|
81
|
+
0 2px 4px -2px rgba(0, 0, 0, 0.05);
|
|
82
|
+
font-size: var(--text-sm);
|
|
83
|
+
transform-origin: var(--transform-origin);
|
|
84
|
+
animation: sh-ui-select-in 140ms ease-out;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.select__content[data-ending-style] {
|
|
88
|
+
animation: sh-ui-select-out 100ms ease-in forwards;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@keyframes sh-ui-select-in {
|
|
92
|
+
from { opacity: 0; transform: scale(0.96); }
|
|
93
|
+
to { opacity: 1; transform: scale(1); }
|
|
94
|
+
}
|
|
95
|
+
@keyframes sh-ui-select-out {
|
|
96
|
+
from { opacity: 1; transform: scale(1); }
|
|
97
|
+
to { opacity: 0; transform: scale(0.96); }
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.select__label {
|
|
101
|
+
padding: var(--space-2) var(--space-2) var(--space-1);
|
|
102
|
+
font-size: var(--text-xs);
|
|
103
|
+
font-weight: var(--weight-semibold);
|
|
104
|
+
color: var(--foreground-muted);
|
|
105
|
+
text-transform: uppercase;
|
|
106
|
+
letter-spacing: 0.04em;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.select__item {
|
|
110
|
+
display: flex;
|
|
111
|
+
align-items: center;
|
|
112
|
+
gap: var(--space-2);
|
|
113
|
+
padding: 0.5rem 0.75rem;
|
|
114
|
+
border-radius: calc(var(--radius) - 2px);
|
|
115
|
+
cursor: pointer;
|
|
116
|
+
outline: none;
|
|
117
|
+
user-select: none;
|
|
118
|
+
transition: background-color 80ms;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.select__item[data-highlighted],
|
|
122
|
+
.select__item:hover {
|
|
123
|
+
background: var(--background-muted);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.select__item[data-disabled] {
|
|
127
|
+
opacity: var(--opacity-disabled);
|
|
128
|
+
pointer-events: none;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.select__item-text {
|
|
132
|
+
flex: 1;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.select__indicator {
|
|
136
|
+
order: 1;
|
|
137
|
+
margin-left: auto;
|
|
138
|
+
display: inline-flex;
|
|
139
|
+
align-items: center;
|
|
140
|
+
justify-content: center;
|
|
141
|
+
color: var(--foreground);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.select__separator {
|
|
145
|
+
height: 1px;
|
|
146
|
+
background: var(--border);
|
|
147
|
+
margin: var(--space-1) 0;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/* 멀티 셀렉트 값 칩 (MultiSelectValue의 render prop에서 사용) */
|
|
151
|
+
.select__chips {
|
|
152
|
+
display: inline-flex;
|
|
153
|
+
align-items: center;
|
|
154
|
+
gap: var(--space-1);
|
|
155
|
+
flex-wrap: nowrap;
|
|
156
|
+
overflow: hidden;
|
|
157
|
+
}
|
|
158
|
+
.select__chip {
|
|
159
|
+
display: inline-flex;
|
|
160
|
+
align-items: center;
|
|
161
|
+
gap: var(--space-1);
|
|
162
|
+
padding: 0.125rem 0.375rem 0.125rem var(--space-2);
|
|
163
|
+
font-size: var(--text-xs);
|
|
164
|
+
line-height: 1.25rem;
|
|
165
|
+
background: var(--background-muted);
|
|
166
|
+
border-radius: calc(var(--radius) - 2px);
|
|
167
|
+
white-space: nowrap;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.select__chip-remove {
|
|
171
|
+
display: inline-flex;
|
|
172
|
+
align-items: center;
|
|
173
|
+
justify-content: center;
|
|
174
|
+
width: 1rem;
|
|
175
|
+
height: 1rem;
|
|
176
|
+
padding: 0;
|
|
177
|
+
border: 0;
|
|
178
|
+
border-radius: 999px;
|
|
179
|
+
background: transparent;
|
|
180
|
+
color: var(--foreground-muted);
|
|
181
|
+
font-size: var(--text-sm);
|
|
182
|
+
line-height: 1;
|
|
183
|
+
cursor: pointer;
|
|
184
|
+
transition: background-color var(--duration-fast), color var(--duration-fast);
|
|
185
|
+
}
|
|
186
|
+
.select__chip-remove:hover {
|
|
187
|
+
background: var(--background);
|
|
188
|
+
color: var(--foreground);
|
|
189
|
+
}
|
|
190
|
+
.select__chip-remove:focus-visible {
|
|
191
|
+
outline: var(--border-width-strong) solid var(--foreground);
|
|
192
|
+
outline-offset: 1px;
|
|
193
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import styles from "./styles.module.css";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
import { cn } from "@SH_UI_UTILS@";
|
|
6
|
+
export type SeparatorOrientation = "horizontal" | "vertical";
|
|
7
|
+
|
|
8
|
+
export interface SeparatorProps
|
|
9
|
+
extends Omit<React.HTMLAttributes<HTMLDivElement>, "role"> {
|
|
10
|
+
orientation?: SeparatorOrientation;
|
|
11
|
+
/**
|
|
12
|
+
* 의미 없는 시각적 구분선인지 여부. 기본 true(aria-hidden).
|
|
13
|
+
* 스크린리더에도 섹션 구분을 알려야 하면 false.
|
|
14
|
+
*/
|
|
15
|
+
decorative?: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 시각적 구분선. 가로(height=1px) / 세로(width=1px).
|
|
20
|
+
*
|
|
21
|
+
* 의미 있는 구분에는 `decorative={false}`로 role=separator가 붙고, 그렇지 않으면
|
|
22
|
+
* aria-hidden 처리되어 보조 기술에 노출되지 않는다.
|
|
23
|
+
*/
|
|
24
|
+
export const Separator = React.forwardRef<HTMLDivElement, SeparatorProps>(
|
|
25
|
+
function Separator(
|
|
26
|
+
{ className, orientation = "horizontal", decorative = true, ...props },
|
|
27
|
+
ref,
|
|
28
|
+
) {
|
|
29
|
+
return (
|
|
30
|
+
<div
|
|
31
|
+
ref={ref}
|
|
32
|
+
role={decorative ? undefined : "separator"}
|
|
33
|
+
aria-orientation={decorative ? undefined : orientation}
|
|
34
|
+
aria-hidden={decorative || undefined}
|
|
35
|
+
data-orientation={orientation}
|
|
36
|
+
className={cn(
|
|
37
|
+
styles.separator,
|
|
38
|
+
styles[`separator--${orientation}`],
|
|
39
|
+
className,
|
|
40
|
+
)}
|
|
41
|
+
{...props}
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
44
|
+
},
|
|
45
|
+
);
|
|
46
|
+
Separator.displayName = "Separator";
|