@korioinc/next-core 2.0.47 → 2.0.48
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/dist/components/locale-switcher/index.js +1 -1
- package/dist/components/theme-switcher/index.js +2 -2
- package/dist/components/tooltip/index.d.ts.map +1 -1
- package/dist/components/tooltip/index.js +5 -20
- package/dist/styles/AGENTS.md +288 -117
- package/dist/styles/globals.css +466 -173
- package/package.json +13 -13
|
@@ -53,5 +53,5 @@ export default function LocaleSwitcher({ languages } = {}) {
|
|
|
53
53
|
if (!currentLanguage) {
|
|
54
54
|
return null;
|
|
55
55
|
}
|
|
56
|
-
return (_jsxs(Menu, { as: 'div', className: 'relative', children: [_jsx(MenuButton, { className: 'border-
|
|
56
|
+
return (_jsxs(Menu, { as: 'div', className: 'relative', children: [_jsx(MenuButton, { className: 'glass-border-subtle bg-glass-surface hover:bg-glass-surface-interactive relative inline-flex h-9 w-9 items-center justify-center rounded-md border transition-colors', children: currentLanguage.flag }), _jsx(Transition, { as: Fragment, enter: 'transition ease-out duration-100', enterFrom: 'transform opacity-0 scale-95', enterTo: 'transform opacity-100 scale-100', leave: 'transition ease-in duration-75', leaveFrom: 'transform opacity-100 scale-100', leaveTo: 'transform opacity-0 scale-95', children: _jsx(MenuItems, { anchor: 'bottom end', className: 'glass glass-surface-subtle glass-backdrop-sm glass-shadow-sm glass-border-strong z-100 w-48 rounded-md border ring-1 ring-black/5 [--anchor-gap:8px] focus:outline-none', children: _jsx("div", { className: 'py-1', children: availableLanguages.map((language) => (_jsx(MenuItem, { children: _jsxs("button", { onClick: () => changeLanguage(language.code), className: 'data-[focus]:bg-glass-surface-interactive text-foreground group flex w-full items-center gap-2 px-3 py-2 text-sm transition-colors', children: [language.flag, _jsx("span", { className: 'whitespace-nowrap', children: language.name }), currentLocale === language.code && (_jsx("svg", { className: 'ml-auto h-4 w-4', fill: 'none', stroke: 'currentColor', viewBox: '0 0 24 24', children: _jsx("path", { strokeLinecap: 'round', strokeLinejoin: 'round', strokeWidth: 2, d: 'M5 13l4 4L19 7' }) }))] }) }, language.code))) }) }) })] }));
|
|
57
57
|
}
|
|
@@ -38,8 +38,8 @@ const ThemeSwitcher = () => {
|
|
|
38
38
|
setTheme(nextTheme);
|
|
39
39
|
};
|
|
40
40
|
if (!mounted) {
|
|
41
|
-
return (_jsx("button", { className: 'border-
|
|
41
|
+
return (_jsx("button", { className: 'glass-border-subtle bg-glass-surface relative inline-flex h-9 w-9 items-center justify-center rounded-md border opacity-0', "aria-hidden": 'true', children: _jsx("div", { className: 'h-5 w-5' }) }));
|
|
42
42
|
}
|
|
43
|
-
return (_jsxs("button", { onClick: toggleTheme, className: `border-
|
|
43
|
+
return (_jsxs("button", { onClick: toggleTheme, className: `glass-border-subtle bg-glass-surface hover:bg-glass-surface-interactive relative inline-flex h-9 w-9 items-center justify-center rounded-md border ${canAnimateColors ? 'transition-colors' : ''}`, "aria-label": `Switch theme (current: ${currentThemeLabel})`, title: `Theme: ${currentThemeLabel} (click to change)`, children: [_jsxs("svg", { xmlns: 'http://www.w3.org/2000/svg', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '2', strokeLinecap: 'round', strokeLinejoin: 'round', className: `absolute h-5 w-5 transition-all ${currentTheme === 'light' ? 'scale-100 rotate-0 opacity-100' : 'scale-0 rotate-90 opacity-0'}`, children: [_jsx("circle", { cx: '12', cy: '12', r: '5' }), _jsx("line", { x1: '12', y1: '1', x2: '12', y2: '3' }), _jsx("line", { x1: '12', y1: '21', x2: '12', y2: '23' }), _jsx("line", { x1: '4.22', y1: '4.22', x2: '5.64', y2: '5.64' }), _jsx("line", { x1: '18.36', y1: '18.36', x2: '19.78', y2: '19.78' }), _jsx("line", { x1: '1', y1: '12', x2: '3', y2: '12' }), _jsx("line", { x1: '21', y1: '12', x2: '23', y2: '12' }), _jsx("line", { x1: '4.22', y1: '19.78', x2: '5.64', y2: '18.36' }), _jsx("line", { x1: '18.36', y1: '5.64', x2: '19.78', y2: '4.22' })] }), _jsx("svg", { xmlns: 'http://www.w3.org/2000/svg', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '2', strokeLinecap: 'round', strokeLinejoin: 'round', className: `absolute h-5 w-5 transition-all ${currentTheme === 'dark' ? 'scale-100 rotate-0 opacity-100' : 'scale-0 -rotate-90 opacity-0'}`, children: _jsx("path", { d: 'M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z' }) }), _jsxs("svg", { xmlns: 'http://www.w3.org/2000/svg', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '2', strokeLinecap: 'round', strokeLinejoin: 'round', className: `absolute h-5 w-5 transition-all ${currentTheme === 'system' ? 'scale-100 rotate-0 opacity-100' : 'scale-0 rotate-90 opacity-0'}`, children: [_jsx("rect", { x: '3', y: '4', width: '18', height: '12', rx: '2' }), _jsx("line", { x1: '8', y1: '20', x2: '16', y2: '20' }), _jsx("line", { x1: '12', y1: '16', x2: '12', y2: '20' })] })] }));
|
|
44
44
|
};
|
|
45
45
|
export default ThemeSwitcher;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAa5C,UAAU,YAAY;IACpB,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,EAAE,SAAS,CAAC;CACpB;AAED,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,YAAY,+BAsClE"}
|
|
@@ -1,40 +1,25 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
import { FloatingPortal,
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { FloatingPortal, autoUpdate, flip, offset, shift, useFloating, useHover, useInteractions, } from '@floating-ui/react';
|
|
5
5
|
export default function Tooltip({ children, content }) {
|
|
6
6
|
const [isOpen, setIsOpen] = useState(false);
|
|
7
|
-
const
|
|
8
|
-
const { refs, floatingStyles, context, middlewareData, placement } = useFloating({
|
|
7
|
+
const { refs, floatingStyles, context } = useFloating({
|
|
9
8
|
open: isOpen,
|
|
10
9
|
onOpenChange: setIsOpen,
|
|
11
10
|
placement: 'top',
|
|
12
11
|
strategy: 'fixed',
|
|
13
12
|
middleware: [
|
|
14
|
-
offset(
|
|
13
|
+
offset(6),
|
|
15
14
|
flip({
|
|
16
15
|
fallbackAxisSideDirection: 'start',
|
|
17
16
|
crossAxis: false,
|
|
18
17
|
}),
|
|
19
18
|
shift({ padding: 8 }),
|
|
20
|
-
arrow({ element: arrowRef }),
|
|
21
19
|
],
|
|
22
20
|
whileElementsMounted: autoUpdate,
|
|
23
21
|
});
|
|
24
22
|
const hover = useHover(context);
|
|
25
23
|
const { getReferenceProps, getFloatingProps } = useInteractions([hover]);
|
|
26
|
-
|
|
27
|
-
const staticSide = {
|
|
28
|
-
top: 'bottom',
|
|
29
|
-
right: 'left',
|
|
30
|
-
bottom: 'top',
|
|
31
|
-
left: 'right',
|
|
32
|
-
}[placement.split('-')[0]];
|
|
33
|
-
return (_jsxs("div", { ref: refs.setReference, ...getReferenceProps(), className: 'inline-block', children: [children, isOpen && (_jsx(FloatingPortal, { children: _jsxs("div", { ref: refs.setFloating, style: floatingStyles, className: 'z-100 rounded bg-black px-2 py-1 text-sm text-white shadow-md dark:bg-white dark:text-black', ...getFloatingProps(), children: [content, _jsx("div", { ref: arrowRef, className: 'absolute h-2 w-2 rotate-45 bg-black dark:bg-white', style: {
|
|
34
|
-
left: middlewareData.arrow?.x != null ? `${middlewareData.arrow.x}px` : '',
|
|
35
|
-
top: middlewareData.arrow?.y != null ? `${middlewareData.arrow.y}px` : '',
|
|
36
|
-
right: '',
|
|
37
|
-
bottom: '',
|
|
38
|
-
[staticSide]: '-4px',
|
|
39
|
-
} })] }) }))] }));
|
|
24
|
+
return (_jsxs("div", { ref: refs.setReference, ...getReferenceProps(), className: 'inline-block', children: [children, isOpen && (_jsx(FloatingPortal, { children: _jsx("div", { ref: refs.setFloating, style: floatingStyles, className: 'glass glass-surface-strong glass-texture-subtle glass-border-strong glass-backdrop-lg glass-shadow-lg text-foreground z-100 rounded-lg px-3 py-2 text-sm font-medium', ...getFloatingProps(), children: content }) }))] }));
|
|
40
25
|
}
|
package/dist/styles/AGENTS.md
CHANGED
|
@@ -1,183 +1,354 @@
|
|
|
1
|
-
# Glass
|
|
1
|
+
# Glass Token 기본 컴포넌트 가이드
|
|
2
2
|
|
|
3
|
-
이
|
|
3
|
+
이 디렉터리의 `globals.css`는 패키지 소비 프로젝트에서도 적용되는 glass UI
|
|
4
|
+
토큰의 원본입니다. 컴포넌트 className을 작성할 때는 여기 정의된 glass token
|
|
5
|
+
family를 조합하고, 소비 프로젝트에서 임의 glass 스타일을 새로 만들지
|
|
6
|
+
않습니다.
|
|
4
7
|
|
|
5
|
-
##
|
|
6
|
-
- **오버레이**: `glass` (배경을 얇게 덮고 유리감만 부여)
|
|
7
|
-
- **모달 패널**: `glass-tinted glass-backdrop border-glass-strong`
|
|
8
|
-
- **모달 내부 컨테이너**: `border-glass-strong` + `bg-white/60`(다크는 `dark:bg-slate-900/80`) + `backdrop-blur` 계열
|
|
9
|
-
- **입력/버튼**: `glass border-glass-strong` + hover 시 `hover:bg-glass-tinted`
|
|
8
|
+
## 목표
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
- 기본 컴포넌트가 light/dark 모드에서 같은 역할과 밀도를 갖게 만든다.
|
|
11
|
+
- 큰 화면 영역이 과하게 하얗게 뜨지 않도록 넓은 표면에는 낮은 surface를 쓴다.
|
|
12
|
+
- `rgba`, 임의 `backdrop-blur`, 임의 shadow, arbitrary `[box-shadow]` 대신
|
|
13
|
+
glass token class를 조합한다.
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
`--glass*` 계열은 라이트/다크 각각 별도 값이 있으며, 공통적으로 다음 역할을 가집니다.
|
|
15
|
-
- `--glass`: 유리 레이어 기본 색 (투명도 포함)
|
|
16
|
-
- `--glass-tinted`: 유리의 색 농도 강화 버전
|
|
17
|
-
- `--glass-glow`: 유리의 발광 느낌을 위한 색
|
|
18
|
-
- `--glass-surface`: 실제 표면 색(배경 그라데이션 밑바탕)
|
|
19
|
-
- `--glass-surface-tinted`: 표면 색의 틴트 버전
|
|
20
|
-
- `--glass-border`: 유리 테두리 강도
|
|
21
|
-
- `--glass-border-subtle`: 유리 테두리 약한 버전
|
|
22
|
-
- `--glass-shine`: 유리 하이라이트
|
|
23
|
-
- `--glass-shine-subtle`: 유리 하이라이트 약한 버전
|
|
24
|
-
- `--glass-shadow-color`: 유리 그림자 컬러
|
|
25
|
-
- `--glass-shadow-ambient`: 유리 앰비언트 그림자
|
|
26
|
-
- `--glass-blur`: 백드롭 블러 강도 (기본 8px)
|
|
15
|
+
## Glass Token Family
|
|
27
16
|
|
|
28
|
-
|
|
29
|
-
globals.css 내 `@utility` 정의 기준
|
|
17
|
+
실제 glass token class는 아래 family로만 작성한다.
|
|
30
18
|
|
|
31
|
-
|
|
32
|
-
-
|
|
33
|
-
|
|
19
|
+
```text
|
|
20
|
+
glass [glass-surface-*] [glass-texture*] [glass-border*] [glass-backdrop-*] [glass-shadow-*]
|
|
21
|
+
```
|
|
34
22
|
|
|
35
|
-
|
|
36
|
-
-
|
|
37
|
-
|
|
23
|
+
- `glass`: 기본 유리 표면을 만든다.
|
|
24
|
+
- `glass-surface-*`: 표면의 밝기와 투명도를 고른다. `subtle`, `medium`,
|
|
25
|
+
`strong`, `selected`, `disabled`가 있다.
|
|
26
|
+
- `glass-texture*`: 빛 하이라이트만 얹는다. 표면, 경계, blur를 만들지 않는다.
|
|
27
|
+
- `glass-border*`: 경계, 상단 하이라이트, 안쪽 윤곽선을 만든다. 기본값,
|
|
28
|
+
`faint`, `subtle`, `medium`, `strong`이 있다.
|
|
29
|
+
- `glass-backdrop-*`: 뒤 배경 blur/saturate 단계만 정한다. `sm`, `md`, `lg`가
|
|
30
|
+
있다.
|
|
31
|
+
- `glass-shadow-*`: elevation만 정한다. `sm`, `md`, `lg`가 있다.
|
|
38
32
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
33
|
+
`hover:`, `focus-visible:`, `disabled:`, `rounded-*`, `p-*`, `h-*`, `w-*`,
|
|
34
|
+
`text-*`, `flex`, `grid`는 glass token이 아니라 Tailwind 보조 유틸리티다.
|
|
35
|
+
토큰 조합을 정한 뒤 필요한 상태, 크기, 레이아웃 유틸리티를 붙인다.
|
|
42
36
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
-
|
|
37
|
+
`bg-glass-surface-interactive`, `bg-glass-surface-selected`는 `@theme`에 노출된
|
|
38
|
+
color utility다. hover/focus/selected 배경을 맞출 때 쓰지만,
|
|
39
|
+
`glass-surface-*` utility family와 같은 것으로 설명하지 않는다.
|
|
46
40
|
|
|
47
|
-
|
|
48
|
-
- **역할**: 기존 `bg-*` 색상을 유지한 채 유리 질감만 얹는다.
|
|
49
|
-
- **대상**: 색상 버튼/배지/태그 같이 `bg-*`가 있는 요소.
|
|
41
|
+
## Surface 선택 기준
|
|
50
42
|
|
|
51
|
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
43
|
+
- 넓은 section, form panel, summary panel:
|
|
44
|
+
`glass glass-border glass-backdrop-md glass-shadow-md`
|
|
45
|
+
- 반복 카드, 리스트 row, 낮은 우선순위 block:
|
|
46
|
+
`glass glass-surface-subtle glass-border-subtle glass-backdrop-sm glass-shadow-sm`
|
|
47
|
+
- 버튼 묶음, toolbar, segmented control:
|
|
48
|
+
`glass glass-surface-medium glass-border-medium glass-backdrop-md glass-shadow-md`
|
|
49
|
+
- 선택된 tab, segmented item, selected pill:
|
|
50
|
+
`glass glass-surface-selected glass-texture-subtle glass-border-subtle glass-shadow-sm`
|
|
51
|
+
- 비활성 입력 또는 잠긴 값:
|
|
52
|
+
`glass glass-surface-disabled glass-border-subtle glass-backdrop-sm glass-shadow-sm`
|
|
54
53
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
-
|
|
54
|
+
`glass-surface-medium`은 작은 control group에는 맞지만, page shell이나 넓은
|
|
55
|
+
카드에 반복하면 light mode에서 허옇게 뜬다. 넓은 면적은 기본 `glass` 또는
|
|
56
|
+
`glass-surface-subtle`부터 시작한다.
|
|
58
57
|
|
|
59
|
-
##
|
|
60
|
-
- 유리 표면에는 `border-glass-*`를 **필요할 때만** 붙여 경계를 잡는다.
|
|
61
|
-
- 블러가 필요한 곳에만 `glass-backdrop`을 붙인다.
|
|
62
|
-
- 강조 패널에는 `glass-tinted`, 일반 카드에는 `glass`가 기본.
|
|
63
|
-
- 다크 모드에서는 텍스트/placeholder 대비를 추가로 보정한다 (`dark:*`).
|
|
64
|
-
- **색상 버튼/배지**는 `bg-*` + `glass-overlay` 조합을 기본으로 사용한다.
|
|
58
|
+
## 기본 className 조합
|
|
65
59
|
|
|
66
|
-
|
|
60
|
+
### Panel
|
|
67
61
|
|
|
68
|
-
### 4.1 모달 오버레이
|
|
69
62
|
```tsx
|
|
70
|
-
<
|
|
63
|
+
<section className='glass glass-border glass-backdrop-md glass-shadow-md rounded-xl p-4 sm:p-5'>...</section>
|
|
71
64
|
```
|
|
72
|
-
- **의도**: 배경을 얇게 덮고 유리감만 부여.
|
|
73
65
|
|
|
74
|
-
|
|
66
|
+
폼 영역, 검색 영역, 요약 영역의 기본 표면이다. 페이지 안에서 큰 면적을
|
|
67
|
+
차지하면 `glass-surface-medium`을 추가하지 않는다.
|
|
68
|
+
|
|
69
|
+
### Subtle Card
|
|
70
|
+
|
|
75
71
|
```tsx
|
|
76
|
-
<
|
|
72
|
+
<article className='glass glass-surface-subtle glass-border-subtle glass-backdrop-sm glass-shadow-sm rounded-xl p-4'>
|
|
77
73
|
...
|
|
78
|
-
</
|
|
74
|
+
</article>
|
|
79
75
|
```
|
|
80
|
-
- **의도**: 패널 자체는 틴트 유리 + 배경 블러 + 강한 경계.
|
|
81
76
|
|
|
82
|
-
|
|
77
|
+
반복 카드, 보조 정보, 리스트 row, skeleton의 기본 표면이다. 같은 화면에 여러
|
|
78
|
+
개 반복될 때는 이 조합을 우선한다.
|
|
79
|
+
|
|
80
|
+
### List Row
|
|
81
|
+
|
|
83
82
|
```tsx
|
|
84
|
-
<div className=
|
|
85
|
-
|
|
83
|
+
<div className='glass glass-surface-subtle glass-border-subtle glass-backdrop-sm glass-shadow-sm flex items-center justify-between gap-3 rounded-lg p-3'>
|
|
84
|
+
<span className='text-sm font-medium'>Item</span>
|
|
85
|
+
<span className='text-muted-foreground text-xs'>Meta</span>
|
|
86
86
|
</div>
|
|
87
87
|
```
|
|
88
|
-
- **의도**: 내부 콘텐츠는 더 밝게, 다크 모드 대비 보정.
|
|
89
88
|
|
|
90
|
-
|
|
89
|
+
리스트 안의 개별 행은 card보다 낮은 radius와 padding을 쓴다. 선택 여부는
|
|
90
|
+
row 전체 색을 과하게 올리기보다 badge나 selected surface를 보조로 쓴다.
|
|
91
|
+
|
|
92
|
+
### Button
|
|
93
|
+
|
|
91
94
|
```tsx
|
|
92
|
-
<
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
dark:placeholder:text-slate-400 dark:focus-visible:ring-white/20"
|
|
96
|
-
/>
|
|
95
|
+
<button className='glass glass-surface-medium glass-border-medium glass-backdrop-md glass-shadow-md text-foreground hover:bg-glass-surface-interactive focus-visible:ring-ring/50 inline-flex h-10 items-center justify-center rounded-lg px-4 text-sm font-semibold transition-colors focus-visible:ring-2 focus-visible:outline-none'>
|
|
96
|
+
Button
|
|
97
|
+
</button>
|
|
97
98
|
```
|
|
98
|
-
- **의도**: 유리 표면 + 강한 경계 + 포커스 링 보정.
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
일반 버튼은 control surface라서 `surface-medium`을 쓸 수 있다. 같은 화면에서
|
|
101
|
+
버튼이 많이 반복되면 `surface-subtle`로 낮춘다.
|
|
102
|
+
|
|
103
|
+
### Primary Button
|
|
104
|
+
|
|
101
105
|
```tsx
|
|
102
|
-
<button className=
|
|
103
|
-
|
|
106
|
+
<button className='glass-texture-subtle glass-border-strong bg-primary text-primary-foreground hover:bg-primary/90 focus-visible:ring-ring/50 inline-flex h-10 items-center justify-center rounded-lg border px-4 text-sm font-semibold transition-colors focus-visible:ring-2 focus-visible:outline-none'>
|
|
107
|
+
Save
|
|
104
108
|
</button>
|
|
105
109
|
```
|
|
106
|
-
- **의도**: 기본은 glass, hover에서 tinted로 강조.
|
|
107
110
|
|
|
108
|
-
|
|
111
|
+
primary는 `bg-primary`가 표면 역할을 한다. `glass-surface-*`를 추가하지 않고
|
|
112
|
+
texture와 strong border만 얹는다.
|
|
113
|
+
|
|
114
|
+
### Destructive Button
|
|
115
|
+
|
|
109
116
|
```tsx
|
|
110
|
-
<button className=
|
|
111
|
-
|
|
117
|
+
<button className='glass glass-texture glass-border-medium glass-backdrop-sm glass-shadow-sm bg-destructive/20 text-destructive hover:bg-destructive/30 focus-visible:ring-destructive/40 inline-flex h-10 items-center justify-center rounded-lg px-4 text-sm font-semibold transition-colors focus-visible:ring-2 focus-visible:outline-none'>
|
|
118
|
+
Delete
|
|
119
|
+
</button>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
삭제, 취소, 위험 동작은 의미 색상 배경과 텍스트를 유지한다. glass는 질감,
|
|
123
|
+
경계, elevation만 보강한다.
|
|
124
|
+
|
|
125
|
+
### Disabled Button
|
|
126
|
+
|
|
127
|
+
```tsx
|
|
128
|
+
<button
|
|
129
|
+
disabled
|
|
130
|
+
className='glass glass-surface-subtle glass-border-subtle glass-backdrop-sm glass-shadow-sm text-muted-foreground inline-flex h-10 items-center justify-center rounded-lg px-4 text-sm font-semibold opacity-60 disabled:cursor-not-allowed'>
|
|
131
|
+
Disabled
|
|
112
132
|
</button>
|
|
113
133
|
```
|
|
114
|
-
- **의도**: `bg-*`를 유지하면서 glass 질감만 얹는다.
|
|
115
134
|
|
|
116
|
-
|
|
135
|
+
disabled 상태는 hover/focus 효과를 늘리지 않는다. 잠긴 값이나 비활성 입력은
|
|
136
|
+
`surface-disabled`를 쓴다.
|
|
137
|
+
|
|
138
|
+
### Icon Button
|
|
139
|
+
|
|
140
|
+
```tsx
|
|
141
|
+
<button
|
|
142
|
+
type='button'
|
|
143
|
+
aria-label='Edit'
|
|
144
|
+
className='glass glass-surface-subtle glass-border-subtle glass-backdrop-sm glass-shadow-sm text-foreground hover:bg-glass-surface-interactive focus-visible:ring-ring/50 inline-flex size-10 items-center justify-center rounded-lg transition-colors focus-visible:ring-2 focus-visible:outline-none'>
|
|
145
|
+
<Icon className='size-5' aria-hidden='true' />
|
|
146
|
+
</button>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
아이콘 버튼은 `aria-label`을 필수로 둔다. size는 `size-10`을 기본으로 해서
|
|
150
|
+
일반 `h-10` 버튼과 높이를 맞춘다.
|
|
151
|
+
|
|
152
|
+
### Segmented Control
|
|
153
|
+
|
|
117
154
|
```tsx
|
|
118
|
-
<div
|
|
119
|
-
|
|
120
|
-
|
|
155
|
+
<div
|
|
156
|
+
role='tablist'
|
|
157
|
+
aria-label='Density'
|
|
158
|
+
className='glass glass-surface-medium glass-border-medium glass-backdrop-md glass-shadow-md inline-flex rounded-lg p-1'>
|
|
159
|
+
<button
|
|
160
|
+
type='button'
|
|
161
|
+
role='tab'
|
|
162
|
+
aria-selected='true'
|
|
163
|
+
className='glass glass-surface-selected glass-texture-subtle glass-border-subtle glass-shadow-sm text-foreground rounded-md px-3 py-1.5 text-sm font-semibold'>
|
|
164
|
+
Compact
|
|
121
165
|
</button>
|
|
122
|
-
<button
|
|
123
|
-
|
|
166
|
+
<button
|
|
167
|
+
type='button'
|
|
168
|
+
role='tab'
|
|
169
|
+
aria-selected='false'
|
|
170
|
+
className='text-muted-foreground hover:bg-glass-surface-interactive focus-visible:ring-ring/50 rounded-md px-3 py-1.5 text-sm font-semibold transition-colors focus-visible:ring-2 focus-visible:outline-none'>
|
|
171
|
+
Comfort
|
|
124
172
|
</button>
|
|
125
173
|
</div>
|
|
126
174
|
```
|
|
127
|
-
- **의도**: 탭 선택 상태에서 `bg-*`를 유지한 채 glass 질감을 추가한다.
|
|
128
175
|
|
|
129
|
-
|
|
176
|
+
group 표면은 `surface-medium`, 활성 항목은 `surface-selected`로 분리한다.
|
|
177
|
+
비활성 항목에는 glass를 중복 적용하지 않는다.
|
|
178
|
+
|
|
179
|
+
### Input
|
|
180
|
+
|
|
130
181
|
```tsx
|
|
131
|
-
<
|
|
132
|
-
|
|
133
|
-
|
|
182
|
+
<input
|
|
183
|
+
className='glass glass-surface-subtle glass-border-subtle glass-backdrop-sm glass-shadow-sm text-foreground placeholder:text-muted-foreground/70 focus-visible:bg-glass-surface-selected focus-visible:ring-ring/50 h-10 w-full rounded-lg px-3 text-sm transition-colors outline-none focus-visible:ring-2'
|
|
184
|
+
placeholder='Search'
|
|
185
|
+
/>
|
|
134
186
|
```
|
|
135
|
-
- **의도**: 가장 기본적인 CTA 버튼. glass가 필요 없을 때 사용.
|
|
136
187
|
|
|
137
|
-
|
|
188
|
+
기본 입력은 `surface-subtle`로 낮춘다. 버튼과 나란히 놓이는 검색/필터 입력은
|
|
189
|
+
`h-10`, 테이블이나 인라인 편집 입력은 `h-9`를 쓴다.
|
|
190
|
+
|
|
191
|
+
### Search Input
|
|
192
|
+
|
|
138
193
|
```tsx
|
|
139
|
-
<div className=
|
|
140
|
-
|
|
194
|
+
<div className='glass glass-surface-subtle glass-border-subtle glass-backdrop-sm glass-shadow-sm focus-within:bg-glass-surface-selected focus-within:ring-ring/50 flex h-10 w-full items-center gap-2 rounded-lg px-3 transition-colors focus-within:ring-2'>
|
|
195
|
+
<Icon className='text-muted-foreground size-4 shrink-0' aria-hidden='true' />
|
|
196
|
+
<input className='placeholder:text-muted-foreground/70 min-w-0 flex-1 bg-transparent text-sm outline-none' />
|
|
141
197
|
</div>
|
|
142
198
|
```
|
|
143
|
-
- **의도**: 유리 표면 위에 컬러 배경을 얹어 메시지 톤을 유지한다.
|
|
144
199
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
2. **경계 부여**: `border-glass-strong` 또는 `border-glass-soft`
|
|
148
|
-
3. **배경 블러 필요 여부**: 필요하면 `glass-backdrop`
|
|
149
|
-
4. **다크 보정**: `dark:*`로 텍스트/placeholder 대비 조정
|
|
200
|
+
아이콘이 들어간 검색 입력은 wrapper가 glass 표면을 담당하고, 내부 input은
|
|
201
|
+
`bg-transparent`로 둔다.
|
|
150
202
|
|
|
151
|
-
|
|
203
|
+
### Error Input
|
|
152
204
|
|
|
153
|
-
### 6.1 기본 카드
|
|
154
205
|
```tsx
|
|
155
|
-
<
|
|
156
|
-
|
|
206
|
+
<input
|
|
207
|
+
aria-invalid='true'
|
|
208
|
+
aria-describedby='field-error'
|
|
209
|
+
className='glass glass-backdrop-md glass-shadow-md border-destructive text-foreground focus-visible:ring-destructive/30 h-10 w-full rounded-lg border px-3 text-sm outline-none focus-visible:ring-2'
|
|
210
|
+
/>
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
오류 입력은 glass border 단계보다 `border-destructive`와 오류 focus ring을
|
|
214
|
+
우선한다. 오류 메시지는 `aria-describedby`로 연결한다.
|
|
215
|
+
|
|
216
|
+
### Disabled Input
|
|
217
|
+
|
|
218
|
+
```tsx
|
|
219
|
+
<input
|
|
220
|
+
disabled
|
|
221
|
+
readOnly
|
|
222
|
+
className='glass glass-surface-disabled glass-border-subtle glass-backdrop-sm glass-shadow-sm text-foreground/45 placeholder:text-foreground/35 dark:text-foreground/40 dark:placeholder:text-foreground/30 h-10 w-full cursor-not-allowed rounded-lg px-3 text-sm font-medium disabled:opacity-100'
|
|
223
|
+
/>
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
비활성 입력은 opacity만 낮추지 말고 `surface-disabled`를 쓴다. 값이 잠긴
|
|
227
|
+
상태라면 `readOnly` 여부도 함께 명확히 한다.
|
|
228
|
+
|
|
229
|
+
### Textarea
|
|
230
|
+
|
|
231
|
+
```tsx
|
|
232
|
+
<textarea className='glass glass-surface-subtle glass-border-subtle glass-backdrop-sm glass-shadow-sm text-foreground placeholder:text-muted-foreground/70 focus-visible:bg-glass-surface-selected focus-visible:ring-ring/50 min-h-28 w-full resize-y rounded-lg px-3 py-2.5 text-sm transition-colors outline-none focus-visible:ring-2' />
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
textarea도 input과 같은 표면 규칙을 따른다. placeholder만 label처럼 쓰지
|
|
236
|
+
않고, 실제 label 또는 `aria-label`을 제공한다.
|
|
237
|
+
|
|
238
|
+
### Checkbox Row
|
|
239
|
+
|
|
240
|
+
```tsx
|
|
241
|
+
<label className='glass glass-surface-subtle glass-border-subtle glass-backdrop-sm glass-shadow-sm flex items-center gap-3 rounded-lg p-3 text-sm'>
|
|
242
|
+
<input type='checkbox' className='text-primary size-4 rounded' />
|
|
243
|
+
<span>
|
|
244
|
+
<span className='block font-medium'>Compressed mode</span>
|
|
245
|
+
<span className='text-muted-foreground block text-xs'>Use in dense panels.</span>
|
|
246
|
+
</span>
|
|
247
|
+
</label>
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
checkbox 자체는 표준 form control을 유지하고, 설명이 필요한 선택지만 row에
|
|
251
|
+
glass 표면을 준다.
|
|
252
|
+
|
|
253
|
+
### Status Message
|
|
254
|
+
|
|
255
|
+
```tsx
|
|
256
|
+
<div
|
|
257
|
+
role='status'
|
|
258
|
+
className='glass glass-surface-medium glass-border-medium glass-backdrop-md glass-shadow-md rounded-lg p-4 text-sm'>
|
|
259
|
+
<p className='font-semibold'>Saved</p>
|
|
260
|
+
<p className='text-muted-foreground mt-1'>Changes were applied.</p>
|
|
157
261
|
</div>
|
|
158
262
|
```
|
|
159
|
-
- **의도**: 보조 영역에 은은한 유리감.
|
|
160
263
|
|
|
161
|
-
|
|
264
|
+
일반 상태 메시지는 텍스트 의미를 우선한다. 성공, 안내, 저장 완료처럼 짧게
|
|
265
|
+
노출되는 상태에 쓴다.
|
|
266
|
+
|
|
267
|
+
### Error Message
|
|
268
|
+
|
|
162
269
|
```tsx
|
|
163
|
-
<div
|
|
164
|
-
|
|
270
|
+
<div
|
|
271
|
+
role='alert'
|
|
272
|
+
className='glass-texture border-destructive/50 bg-destructive/10 text-destructive rounded-lg border p-4 text-sm'>
|
|
273
|
+
<p className='font-semibold'>Error</p>
|
|
274
|
+
<p className='mt-1'>Required token is missing.</p>
|
|
165
275
|
</div>
|
|
166
276
|
```
|
|
167
|
-
- **의도**: 시선이 가야 하는 블록에 강한 대비.
|
|
168
277
|
|
|
169
|
-
|
|
278
|
+
오류 표면은 의미 색상 배경과 경계를 우선한다. `glass-surface-medium`으로
|
|
279
|
+
오류를 덮지 않는다.
|
|
280
|
+
|
|
281
|
+
### Badge
|
|
282
|
+
|
|
170
283
|
```tsx
|
|
171
|
-
<
|
|
172
|
-
|
|
173
|
-
</
|
|
284
|
+
<span className='glass glass-texture-subtle glass-border-subtle glass-backdrop-sm bg-muted/45 text-muted-foreground inline-flex items-center rounded-full border px-3 py-1 text-xs font-semibold'>
|
|
285
|
+
Draft
|
|
286
|
+
</span>
|
|
174
287
|
```
|
|
175
|
-
- **의도**: 반복 항목에 동일한 유리 표면 제공.
|
|
176
288
|
|
|
177
|
-
### 6.4 배지/태그
|
|
178
289
|
```tsx
|
|
179
|
-
<span className=
|
|
180
|
-
|
|
290
|
+
<span className='glass glass-texture glass-border-subtle glass-backdrop-sm inline-flex items-center rounded-full border bg-emerald-500/20 px-3 py-1 text-xs font-semibold text-emerald-950 dark:text-emerald-50'>
|
|
291
|
+
Active
|
|
181
292
|
</span>
|
|
182
293
|
```
|
|
183
|
-
|
|
294
|
+
|
|
295
|
+
neutral badge는 muted 배경을 쓰고, semantic badge는 의미 색상과 light/dark
|
|
296
|
+
텍스트 대비를 함께 지정한다.
|
|
297
|
+
|
|
298
|
+
### Skeleton
|
|
299
|
+
|
|
300
|
+
```tsx
|
|
301
|
+
<div className='glass glass-surface-subtle glass-border-subtle glass-backdrop-sm glass-shadow-sm w-full space-y-3 rounded-xl p-4 motion-safe:animate-pulse motion-reduce:animate-none'>
|
|
302
|
+
<div className='bg-muted/70 h-3 w-3/5 rounded-full' />
|
|
303
|
+
<div className='bg-muted/50 h-3 rounded-full' />
|
|
304
|
+
<div className='bg-muted/40 h-3 w-4/5 rounded-full' />
|
|
305
|
+
</div>
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
skeleton은 낮은 표면과 muted block만 쓴다. motion은 `motion-reduce` 대응을
|
|
309
|
+
항상 같이 둔다.
|
|
310
|
+
|
|
311
|
+
### Empty State
|
|
312
|
+
|
|
313
|
+
```tsx
|
|
314
|
+
<div className='glass glass-border glass-backdrop-md glass-shadow-sm text-muted-foreground flex min-h-32 flex-col items-center justify-center rounded-xl p-4 text-center'>
|
|
315
|
+
<p className='text-foreground text-sm font-semibold'>No results</p>
|
|
316
|
+
<p className='mt-1 text-xs'>Adjust your filters.</p>
|
|
317
|
+
</div>
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
empty state는 정보 밀도가 낮으므로 기본 `glass`와 낮은 shadow를 쓴다. 가능한
|
|
321
|
+
다음 행동을 짧은 문장으로 알려준다.
|
|
322
|
+
|
|
323
|
+
## 작성 규칙
|
|
324
|
+
|
|
325
|
+
- 먼저 요소 역할에 맞는 glass token 조합을 고른다.
|
|
326
|
+
- 넓은 표면에는 `surface-medium`을 기본값으로 넣지 않는다.
|
|
327
|
+
- `glass-texture*`만으로 표면을 만들었다고 가정하지 않는다.
|
|
328
|
+
- semantic 상태는 `bg-primary`, `bg-destructive`, `bg-emerald-*`,
|
|
329
|
+
`bg-amber-*`, `bg-sky-*`, `bg-rose-*` 같은 의미 색상을 유지한다.
|
|
330
|
+
- 모든 nested child를 glass card로 만들지 않는다. 역할이 없는 중첩은 spacing,
|
|
331
|
+
divider, typography로 해결한다.
|
|
332
|
+
|
|
333
|
+
## 금지 패턴
|
|
334
|
+
|
|
335
|
+
- `bg-background/45`, `ring-border/15`, 임의 `shadow-sm`, 임의
|
|
336
|
+
`backdrop-blur-*`, arbitrary `[box-shadow]`, inline `rgba()`로 glass를 새로
|
|
337
|
+
만들지 않는다.
|
|
338
|
+
- 기본 className 조합에서 `glass-surface-strong`, `glass-border-strong`,
|
|
339
|
+
`glass-backdrop-lg`, `glass-shadow-lg`를 일반 카드나 패널에 쓰지 않는다.
|
|
340
|
+
- 동일 화면에서 버튼, 입력, badge의 radius와 높이를 제각각 만들지 않는다.
|
|
341
|
+
- placeholder만 label처럼 쓰지 않는다.
|
|
342
|
+
|
|
343
|
+
## Accessibility
|
|
344
|
+
|
|
345
|
+
- interactive element는 `focus-visible:ring-2 focus-visible:outline-none`와
|
|
346
|
+
적절한 `focus-visible:ring-*`를 유지한다.
|
|
347
|
+
- icon-only button은 `aria-label`을 제공하고, 장식 icon에는 `aria-hidden`을
|
|
348
|
+
둔다.
|
|
349
|
+
- input/textarea는 label, `aria-label`, `aria-describedby`, error message를
|
|
350
|
+
상황에 맞게 연결한다.
|
|
351
|
+
- 비활성 상태는 `disabled:cursor-not-allowed`, `disabled:opacity-*`,
|
|
352
|
+
`surface-disabled` 중 역할에 맞는 조합을 쓴다.
|
|
353
|
+
- reduced transparency, high contrast, forced colors fallback은
|
|
354
|
+
`globals.css`가 담당한다. 컴포넌트에서 custom media query로 우회하지 않는다.
|