@icen.ai/ui 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -16
- package/dist/base.css +389 -48
- package/dist/behaviors/accordion.mjs +20 -0
- package/dist/behaviors/carousel.mjs +30 -1
- package/dist/behaviors/charts.mjs +168 -0
- package/dist/behaviors/copy.mjs +4 -3
- package/dist/behaviors/datatable.mjs +748 -0
- package/dist/behaviors/input.mjs +20 -1
- package/dist/behaviors/modal.mjs +14 -0
- package/dist/behaviors/nav.mjs +31 -4
- package/dist/behaviors/sidebar.mjs +12 -0
- package/dist/behaviors/slider.mjs +35 -3
- package/dist/behaviors/tabs.mjs +100 -9
- package/dist/behaviors/tag-input.mjs +11 -0
- package/dist/behaviors/theme.mjs +26 -0
- package/dist/behaviors/toast.mjs +83 -15
- package/dist/behaviors/tree.mjs +57 -1
- package/dist/behaviors/upload.mjs +2 -3
- package/dist/cli.mjs +74 -0
- package/dist/components/accordion.mjs +3 -0
- package/dist/components/alert.mjs +2 -0
- package/dist/components/avatar.mjs +2 -0
- package/dist/components/breadcrumb.css +91 -18
- package/dist/components/breadcrumb.mjs +2 -0
- package/dist/components/btn.css +174 -14
- package/dist/components/btn.mjs +2 -0
- package/dist/components/card.css +118 -18
- package/dist/components/card.mjs +2 -0
- package/dist/components/carousel.mjs +3 -0
- package/dist/components/charts.css +225 -33
- package/dist/components/charts.mjs +3 -0
- package/dist/components/content.css +256 -74
- package/dist/components/context-menu.mjs +3 -0
- package/dist/components/datatable.css +343 -0
- package/dist/components/datatable.mjs +4 -0
- package/dist/components/desc.mjs +2 -0
- package/dist/components/dropdown.mjs +3 -0
- package/dist/components/empty.css +50 -10
- package/dist/components/empty.mjs +2 -0
- package/dist/components/feedback.css +158 -47
- package/dist/components/form.css +139 -22
- package/dist/components/input.css +165 -45
- package/dist/components/input.mjs +3 -0
- package/dist/components/kbd.mjs +2 -0
- package/dist/components/layout.mjs +2 -0
- package/dist/components/list.mjs +2 -0
- package/dist/components/media-card.mjs +2 -0
- package/dist/components/media.css +187 -40
- package/dist/components/menu.css +159 -32
- package/dist/components/modal.css +140 -34
- package/dist/components/modal.mjs +3 -0
- package/dist/components/nav.css +134 -32
- package/dist/components/nav.mjs +3 -0
- package/dist/components/pagination.css +105 -19
- package/dist/components/pagination.mjs +2 -0
- package/dist/components/panel.css +61 -6
- package/dist/components/panel.mjs +2 -0
- package/dist/components/pill.css +74 -14
- package/dist/components/pill.mjs +2 -0
- package/dist/components/popover.css +109 -7
- package/dist/components/popover.mjs +3 -0
- package/dist/components/progress.mjs +2 -0
- package/dist/components/rating.mjs +2 -0
- package/dist/components/result.mjs +2 -0
- package/dist/components/segmented.css +199 -50
- package/dist/components/segmented.mjs +2 -0
- package/dist/components/select.css +140 -39
- package/dist/components/select.mjs +3 -0
- package/dist/components/sidebar.css +162 -34
- package/dist/components/sidebar.mjs +3 -0
- package/dist/components/skeleton.mjs +2 -0
- package/dist/components/slider.css +169 -31
- package/dist/components/slider.mjs +3 -0
- package/dist/components/spinner.mjs +2 -0
- package/dist/components/stat.css +103 -8
- package/dist/components/stat.mjs +2 -0
- package/dist/components/steps.css +105 -31
- package/dist/components/steps.mjs +2 -0
- package/dist/components/switch.css +171 -54
- package/dist/components/switch.mjs +2 -0
- package/dist/components/table.css +114 -12
- package/dist/components/table.mjs +2 -0
- package/dist/components/tabs.css +104 -17
- package/dist/components/tabs.mjs +3 -0
- package/dist/components/tag-input.css +119 -23
- package/dist/components/tag-input.mjs +3 -0
- package/dist/components/timeline.mjs +2 -0
- package/dist/components/toast.css +85 -12
- package/dist/components/toast.mjs +3 -0
- package/dist/components/tooltip.css +86 -26
- package/dist/components/tooltip.mjs +2 -0
- package/dist/components/tree.mjs +3 -0
- package/dist/components/upload.css +144 -17
- package/dist/components/upload.mjs +3 -0
- package/dist/index.mjs +623 -42
- package/dist/registry.json +197 -2
- package/dist/retro-effects.css +264 -0
- package/dist/tokens/colors.css +18 -90
- package/dist/tokens/retro-effects.css +264 -0
- package/dist/tokens/style-profiles.css +47 -47
- package/dist/tokens.css +65 -137
- package/dist/ui.css +4861 -1019
- package/package.json +9 -1
package/dist/components/menu.css
CHANGED
|
@@ -1,80 +1,190 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @icen.ai/ui — Component: menu(菜单面板,与 behaviors/dropdown、context-menu 配套)
|
|
3
|
+
*
|
|
3
4
|
* 面板由 JS portal 到 document.body 并按 fixed 定位;data-side 决定进场位移方向。
|
|
4
5
|
* 规格源自 opengal overlay/dropdown + overlay/context-menu。
|
|
6
|
+
*
|
|
7
|
+
* 完整契约(dropdown):
|
|
8
|
+
* <button class="menu-trigger pressable" data-menu-target="id" aria-haspopup="menu" aria-expanded="false">…</button>
|
|
9
|
+
* <div class="menu" id="id" role="menu" data-side="bottom" hidden>
|
|
10
|
+
* <div class="menu-label">组标题(可选)</div>
|
|
11
|
+
* <button class="menu-item [.is-highlighted] [.is-disabled] [.menu-item--danger]" role="menuitem">
|
|
12
|
+
* <span class="menu-item-icon">…svg…</span>
|
|
13
|
+
* <span class="menu-item-label">文本</span>
|
|
14
|
+
* <span class="menu-item-sub">副标题</span>
|
|
15
|
+
* <span class="menu-item-shortcut">⌘S</span>
|
|
16
|
+
* </button>
|
|
17
|
+
* <div class="menu-separator"></div>
|
|
18
|
+
* <button class="menu-item menu-item--checked">
|
|
19
|
+
* <span class="menu-item-check">✓</span>
|
|
20
|
+
* <span class="menu-item-label">已选项</span>
|
|
21
|
+
* </button>
|
|
22
|
+
* </div>
|
|
23
|
+
*
|
|
24
|
+
* context-menu:附加 .menu--context(更窄宽度、更高 z-index)。
|
|
25
|
+
* behavior 维护:键盘箭头导航 + .is-highlighted 跟随、Enter 触发、ESC 关闭、外部点击关闭。
|
|
5
26
|
*/
|
|
6
27
|
|
|
7
28
|
.menu {
|
|
8
|
-
position: fixed;
|
|
9
|
-
|
|
10
|
-
|
|
29
|
+
position: fixed;
|
|
30
|
+
z-index: var(--z-popover);
|
|
31
|
+
min-width: 180px;
|
|
32
|
+
max-width: 320px;
|
|
33
|
+
max-height: min(70vh, 420px);
|
|
34
|
+
overflow-y: auto;
|
|
35
|
+
overscroll-behavior: contain;
|
|
36
|
+
margin: 0;
|
|
37
|
+
padding: var(--density-space-xs);
|
|
11
38
|
background: color-mix(in srgb, var(--token-card-strong) 92%, transparent);
|
|
12
39
|
backdrop-filter: blur(24px);
|
|
40
|
+
-webkit-backdrop-filter: blur(24px);
|
|
13
41
|
border: 1px solid var(--token-outline);
|
|
14
42
|
box-shadow: var(--token-shadow-overlay);
|
|
15
43
|
border-radius: var(--radius-lg);
|
|
16
|
-
animation: icen-menu-in
|
|
44
|
+
animation: icen-menu-in var(--icen-tx-fast);
|
|
17
45
|
}
|
|
18
46
|
.menu[data-side='top'] { animation-name: icen-menu-in-top; }
|
|
47
|
+
.menu[data-side='left'] { animation-name: icen-menu-in-left; }
|
|
48
|
+
.menu[data-side='right'] { animation-name: icen-menu-in-right; }
|
|
19
49
|
|
|
20
|
-
/*
|
|
50
|
+
/* 右键菜单:opengal context-menu 规格沿用 */
|
|
21
51
|
.menu--context {
|
|
22
|
-
min-width: 218px;
|
|
52
|
+
min-width: 218px;
|
|
53
|
+
max-width: 286px;
|
|
54
|
+
z-index: var(--z-tooltip); /* 上下文菜单高于普通 popover,与 tooltip 平齐 */
|
|
23
55
|
animation-duration: 100ms;
|
|
24
56
|
}
|
|
25
57
|
|
|
26
58
|
/* ── 分组标签 / 头(context-menu 的 header 项) ── */
|
|
27
59
|
.menu-label {
|
|
28
|
-
padding:
|
|
29
|
-
|
|
60
|
+
padding: var(--density-space-xs) var(--density-space-sm);
|
|
61
|
+
font-size: var(--density-font-size-xs);
|
|
62
|
+
font-weight: 600;
|
|
63
|
+
text-transform: uppercase;
|
|
64
|
+
letter-spacing: 0.08em;
|
|
30
65
|
color: var(--token-text-faint);
|
|
31
66
|
}
|
|
32
|
-
.menu-header {
|
|
67
|
+
.menu-header {
|
|
68
|
+
padding: var(--density-space-sm) calc(var(--density-space-sm) + 2px) var(--density-space-xs);
|
|
69
|
+
}
|
|
33
70
|
.menu-header-label {
|
|
34
|
-
display: block;
|
|
35
|
-
|
|
71
|
+
display: block;
|
|
72
|
+
overflow: hidden;
|
|
73
|
+
text-overflow: ellipsis;
|
|
74
|
+
white-space: nowrap;
|
|
75
|
+
font-size: var(--density-font-size-sm);
|
|
76
|
+
font-weight: 500;
|
|
77
|
+
line-height: 1.4;
|
|
78
|
+
color: var(--token-text);
|
|
36
79
|
}
|
|
37
80
|
.menu-header-desc {
|
|
38
|
-
display: block;
|
|
39
|
-
|
|
81
|
+
display: block;
|
|
82
|
+
overflow: hidden;
|
|
83
|
+
text-overflow: ellipsis;
|
|
84
|
+
white-space: nowrap;
|
|
85
|
+
font-size: var(--density-font-size-xs);
|
|
86
|
+
line-height: 1.4;
|
|
87
|
+
color: var(--token-text-faint);
|
|
40
88
|
}
|
|
41
89
|
|
|
42
90
|
/* ── 菜单项 ── */
|
|
43
91
|
.menu-item {
|
|
44
|
-
position: relative;
|
|
45
|
-
|
|
46
|
-
|
|
92
|
+
position: relative;
|
|
93
|
+
display: flex;
|
|
94
|
+
align-items: center;
|
|
95
|
+
gap: var(--density-space-xs);
|
|
96
|
+
width: 100%;
|
|
97
|
+
padding: 6px var(--density-space-sm);
|
|
98
|
+
background: none;
|
|
99
|
+
border: 0;
|
|
100
|
+
font: inherit;
|
|
101
|
+
font-size: var(--density-font-size-sm);
|
|
102
|
+
text-align: left;
|
|
47
103
|
color: var(--token-text);
|
|
48
|
-
border-radius: var(--radius-
|
|
104
|
+
border-radius: var(--radius-sm);
|
|
105
|
+
cursor: pointer;
|
|
106
|
+
user-select: none;
|
|
107
|
+
transition:
|
|
108
|
+
background-color var(--icen-tx-fast),
|
|
109
|
+
color var(--icen-tx-fast);
|
|
49
110
|
}
|
|
50
|
-
.menu-item.is-
|
|
51
|
-
background: var(--token-
|
|
111
|
+
.menu-item:hover:not(.is-disabled) {
|
|
112
|
+
background: var(--token-fill-1);
|
|
113
|
+
}
|
|
114
|
+
.menu-item.is-highlighted,
|
|
115
|
+
.menu-item:focus-visible {
|
|
116
|
+
background: var(--token-surface-hover);
|
|
117
|
+
color: var(--token-accent);
|
|
118
|
+
outline: none;
|
|
52
119
|
}
|
|
53
120
|
.menu-item--danger { color: var(--token-error); }
|
|
54
|
-
.menu-item--danger.is-highlighted,
|
|
55
|
-
|
|
121
|
+
.menu-item--danger.is-highlighted,
|
|
122
|
+
.menu-item--danger:focus-visible {
|
|
123
|
+
background: var(--token-error-muted);
|
|
124
|
+
color: var(--token-error);
|
|
125
|
+
}
|
|
126
|
+
.menu-item.is-disabled,
|
|
127
|
+
.menu-item:disabled,
|
|
128
|
+
.menu-item[aria-disabled='true'] {
|
|
129
|
+
opacity: var(--icen-disabled-opacity);
|
|
130
|
+
pointer-events: none;
|
|
56
131
|
}
|
|
57
|
-
.menu-item.is-disabled, .menu-item:disabled { opacity: 0.5; pointer-events: none; }
|
|
58
132
|
|
|
59
133
|
.menu-item-icon {
|
|
60
|
-
display: inline-flex;
|
|
61
|
-
|
|
134
|
+
display: inline-flex;
|
|
135
|
+
align-items: center;
|
|
136
|
+
justify-content: center;
|
|
137
|
+
width: 14px;
|
|
138
|
+
height: 14px;
|
|
139
|
+
flex-shrink: 0;
|
|
140
|
+
}
|
|
141
|
+
.menu-item-icon:empty { width: 14px; height: auto; } /* 无图标时占位 */
|
|
142
|
+
.menu-item-label {
|
|
143
|
+
flex: 1;
|
|
144
|
+
min-width: 0;
|
|
145
|
+
overflow: hidden;
|
|
146
|
+
text-overflow: ellipsis;
|
|
147
|
+
white-space: nowrap;
|
|
148
|
+
}
|
|
149
|
+
.menu-item-sub {
|
|
150
|
+
display: block;
|
|
151
|
+
font-size: var(--density-font-size-xs);
|
|
152
|
+
line-height: 1.3;
|
|
153
|
+
color: var(--token-text-faint);
|
|
154
|
+
margin-top: 2px;
|
|
155
|
+
}
|
|
156
|
+
.menu-item-shortcut {
|
|
157
|
+
font-size: var(--density-font-size-xs);
|
|
158
|
+
color: var(--token-text-faint);
|
|
159
|
+
font-family: var(--font-mono);
|
|
160
|
+
margin-left: var(--density-space-sm);
|
|
161
|
+
}
|
|
162
|
+
.menu-item-chevron {
|
|
163
|
+
width: 12px;
|
|
164
|
+
height: 12px;
|
|
165
|
+
flex-shrink: 0;
|
|
166
|
+
color: var(--token-text-faint);
|
|
62
167
|
}
|
|
63
|
-
.menu-item-icon:empty { width: 16px; height: auto; } /* 无图标时 16px 宽占位 */
|
|
64
|
-
.menu-item-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
|
|
65
|
-
.menu-item-sub { display: block; font-size: 10px; line-height: 1.2; color: var(--token-text-faint); }
|
|
66
|
-
.menu-item-shortcut { font-size: 10px; color: var(--token-text-faint); }
|
|
67
168
|
|
|
68
169
|
/* 勾选项:左勾 ✓ + 缩进 */
|
|
69
170
|
.menu-item-check {
|
|
70
|
-
position: absolute;
|
|
71
|
-
|
|
171
|
+
position: absolute;
|
|
172
|
+
left: var(--density-space-sm);
|
|
173
|
+
top: 50%;
|
|
174
|
+
transform: translateY(-50%);
|
|
175
|
+
color: var(--token-accent);
|
|
176
|
+
font-size: var(--density-font-size-md);
|
|
177
|
+
line-height: 1;
|
|
72
178
|
}
|
|
73
179
|
.menu-item--checked { padding-left: 28px; }
|
|
74
180
|
|
|
75
|
-
.menu-separator {
|
|
181
|
+
.menu-separator {
|
|
182
|
+
margin: var(--density-space-xs) calc(var(--density-space-sm) + 2px);
|
|
183
|
+
height: 1px;
|
|
184
|
+
background: var(--token-line-soft);
|
|
185
|
+
}
|
|
76
186
|
|
|
77
|
-
/* ── 进场:fade + scale(.95→1)
|
|
187
|
+
/* ── 进场:fade + scale(.95→1),按侧别反向位移 8px ── */
|
|
78
188
|
@keyframes icen-menu-in {
|
|
79
189
|
from { opacity: 0; transform: scale(0.95) translateY(-8px); }
|
|
80
190
|
to { opacity: 1; transform: scale(1) translateY(0); }
|
|
@@ -83,3 +193,20 @@
|
|
|
83
193
|
from { opacity: 0; transform: scale(0.95) translateY(8px); }
|
|
84
194
|
to { opacity: 1; transform: scale(1) translateY(0); }
|
|
85
195
|
}
|
|
196
|
+
@keyframes icen-menu-in-left {
|
|
197
|
+
from { opacity: 0; transform: scale(0.95) translateX(8px); }
|
|
198
|
+
to { opacity: 1; transform: scale(1) translateX(0); }
|
|
199
|
+
}
|
|
200
|
+
@keyframes icen-menu-in-right {
|
|
201
|
+
from { opacity: 0; transform: scale(0.95) translateX(-8px); }
|
|
202
|
+
to { opacity: 1; transform: scale(1) translateX(0); }
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
@media (prefers-reduced-motion: reduce) {
|
|
206
|
+
.menu, .menu--context { animation: none; }
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/* 触屏:hover 永久开启(替代 hover 设备的悬停反馈) */
|
|
210
|
+
@media (hover: none) {
|
|
211
|
+
.menu-item:hover:not(.is-disabled) { background: transparent; }
|
|
212
|
+
}
|
|
@@ -1,86 +1,188 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @icen.ai/ui — Component: modal(对话框 + 贴边 Sheet,与 behaviors/modal 配套)
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
*
|
|
4
|
+
* 完整契约:
|
|
5
|
+
* <div class="modal-backdrop" data-modal="id" hidden>
|
|
6
|
+
* <div class="modal [--sm|--lg|--xl|--full] [role=dialog] aria-modal="true" aria-labelledby="title-id">
|
|
7
|
+
* <div class="modal-header">
|
|
8
|
+
* <div>
|
|
9
|
+
* <h2 class="modal-title" id="title-id">标题</h2>
|
|
10
|
+
* <p class="modal-description">副标题(可选)</p>
|
|
11
|
+
</div>
|
|
12
|
+
* <button class="modal-close" aria-label="关闭">…</button>
|
|
13
|
+
* </div>
|
|
14
|
+
* <div class="modal-body">…</div>
|
|
15
|
+
* <div class="modal-footer [modal-footer--between|modal-footer--start|modal-footer--column]">
|
|
16
|
+
* <button class="btn">取消</button>
|
|
17
|
+
* <button class="btn btn-primary">确认</button>
|
|
18
|
+
* </div>
|
|
19
|
+
* </div>
|
|
20
|
+
* </div>
|
|
21
|
+
*
|
|
22
|
+
* Sheet 变体:modal--sheet-left/right/top/bottom(+ sm/lg 尺寸)
|
|
23
|
+
* behavior 维护:focus trap、ESC 关闭、点击 backdrop 关闭、scroll lock。
|
|
6
24
|
*/
|
|
7
25
|
|
|
8
26
|
.modal-backdrop {
|
|
9
|
-
position: fixed;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
27
|
+
position: fixed;
|
|
28
|
+
inset: 0;
|
|
29
|
+
z-index: var(--z-dialog);
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
padding: var(--density-space-md);
|
|
34
|
+
background: color-mix(in srgb, var(--token-text) 45%, transparent);
|
|
35
|
+
backdrop-filter: blur(4px);
|
|
36
|
+
-webkit-backdrop-filter: blur(4px);
|
|
37
|
+
animation: icen-modal-fade-in var(--icen-tx-normal);
|
|
13
38
|
}
|
|
14
39
|
.modal-backdrop[hidden] { display: none; }
|
|
15
40
|
|
|
16
41
|
.modal {
|
|
17
|
-
display: flex;
|
|
18
|
-
|
|
19
|
-
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
overflow: hidden;
|
|
45
|
+
width: 100%;
|
|
46
|
+
max-width: 480px;
|
|
47
|
+
max-height: calc(100vh - 32px);
|
|
48
|
+
background: var(--token-card-strong);
|
|
49
|
+
color: var(--token-text);
|
|
20
50
|
border: 1px solid var(--token-outline);
|
|
21
51
|
box-shadow: var(--token-shadow-overlay);
|
|
22
52
|
border-radius: var(--radius-xl);
|
|
23
|
-
animation: icen-modal-scale-in
|
|
53
|
+
animation: icen-modal-scale-in var(--icen-tx-slow);
|
|
24
54
|
}
|
|
25
55
|
.modal:focus { outline: none; }
|
|
56
|
+
.modal:focus-visible {
|
|
57
|
+
box-shadow: var(--token-shadow-overlay), var(--icen-ring-soft);
|
|
58
|
+
}
|
|
26
59
|
|
|
27
60
|
/* ── 尺寸档 ── */
|
|
28
61
|
.modal--sm { max-width: 360px; }
|
|
29
62
|
.modal--lg { max-width: 640px; }
|
|
30
63
|
.modal--xl { max-width: 800px; }
|
|
31
|
-
.modal--full {
|
|
64
|
+
.modal--full {
|
|
65
|
+
width: calc(100vw - 32px);
|
|
66
|
+
max-width: none;
|
|
67
|
+
height: calc(100vh - 32px);
|
|
68
|
+
max-height: none;
|
|
69
|
+
border-radius: var(--radius-lg);
|
|
70
|
+
}
|
|
32
71
|
|
|
33
72
|
/* ── 头部 / 主体 / 底栏 ── */
|
|
34
73
|
.modal-header {
|
|
35
|
-
display: flex;
|
|
36
|
-
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: flex-start;
|
|
76
|
+
justify-content: space-between;
|
|
77
|
+
gap: var(--density-space-md);
|
|
78
|
+
padding: var(--density-space-lg) var(--density-space-lg) var(--density-space-sm);
|
|
79
|
+
}
|
|
80
|
+
.modal-title {
|
|
81
|
+
margin: 0;
|
|
82
|
+
font-size: var(--density-font-size-lg);
|
|
83
|
+
font-weight: 600;
|
|
84
|
+
line-height: 1.3;
|
|
85
|
+
font-family: var(--font-heading);
|
|
86
|
+
}
|
|
87
|
+
.modal-description {
|
|
88
|
+
margin: 2px 0 0;
|
|
89
|
+
font-size: var(--density-font-size-sm);
|
|
90
|
+
color: var(--token-text-muted);
|
|
91
|
+
line-height: 1.5;
|
|
37
92
|
}
|
|
38
|
-
.modal-title { margin: 0; font-size: 15px; font-weight: 600; }
|
|
39
|
-
.modal-description { margin: 2px 0 0; font-size: 12px; color: var(--token-text-muted); }
|
|
40
93
|
.modal-close {
|
|
41
|
-
display: inline-flex;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
94
|
+
display: inline-flex;
|
|
95
|
+
align-items: center;
|
|
96
|
+
justify-content: center;
|
|
97
|
+
width: 28px;
|
|
98
|
+
height: 28px;
|
|
99
|
+
padding: 0;
|
|
100
|
+
flex-shrink: 0;
|
|
101
|
+
background: none;
|
|
102
|
+
border: 0;
|
|
103
|
+
cursor: pointer;
|
|
104
|
+
color: var(--token-text-faint);
|
|
105
|
+
font-size: 16px;
|
|
106
|
+
line-height: 1;
|
|
107
|
+
border-radius: var(--radius-sm);
|
|
108
|
+
transition:
|
|
109
|
+
background-color var(--icen-tx-fast),
|
|
110
|
+
color var(--icen-tx-fast);
|
|
111
|
+
}
|
|
112
|
+
.modal-close:hover {
|
|
113
|
+
background: var(--token-surface-hover);
|
|
114
|
+
color: var(--token-text);
|
|
115
|
+
}
|
|
116
|
+
.modal-close:focus-visible {
|
|
117
|
+
outline: none;
|
|
118
|
+
box-shadow: var(--icen-ring);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.modal-body {
|
|
122
|
+
flex: 1;
|
|
123
|
+
overflow-y: auto;
|
|
124
|
+
overscroll-behavior: contain;
|
|
125
|
+
padding: 0 var(--density-space-lg) var(--density-space-md);
|
|
126
|
+
font-size: var(--density-font-size-md);
|
|
127
|
+
line-height: 1.6;
|
|
46
128
|
}
|
|
47
|
-
.modal-close:hover { background: var(--token-surface-hover); color: var(--token-text); }
|
|
48
129
|
|
|
49
|
-
.modal-body { flex: 1; overflow-y: auto; padding: 0 24px 20px; }
|
|
50
130
|
.modal-footer {
|
|
51
|
-
display: flex;
|
|
131
|
+
display: flex;
|
|
132
|
+
justify-content: flex-end;
|
|
133
|
+
gap: var(--density-space-sm);
|
|
134
|
+
padding: var(--density-space-md) var(--density-space-lg);
|
|
52
135
|
border-top: 1px solid color-mix(in srgb, var(--token-line-soft) 40%, transparent);
|
|
53
136
|
}
|
|
137
|
+
.modal-footer--start { justify-content: flex-start; }
|
|
138
|
+
.modal-footer--between { justify-content: space-between; }
|
|
139
|
+
.modal-footer--column { flex-direction: column; }
|
|
140
|
+
.modal-footer--column > * { width: 100%; }
|
|
54
141
|
|
|
55
142
|
/* ── Sheet 变体:面板 fixed 贴边,radius 只保留非贴边侧 ── */
|
|
56
|
-
.modal--sheet-left,
|
|
57
|
-
|
|
143
|
+
.modal--sheet-left,
|
|
144
|
+
.modal--sheet-right,
|
|
145
|
+
.modal--sheet-top,
|
|
146
|
+
.modal--sheet-bottom {
|
|
147
|
+
position: fixed;
|
|
148
|
+
max-width: none;
|
|
149
|
+
max-height: none;
|
|
150
|
+
border-radius: 0;
|
|
58
151
|
}
|
|
59
152
|
.modal--sheet-left {
|
|
60
|
-
left: 0; top: 0; bottom: 0;
|
|
153
|
+
left: 0; top: 0; bottom: 0;
|
|
154
|
+
width: 360px;
|
|
155
|
+
height: 100%;
|
|
61
156
|
border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
|
|
62
157
|
animation-name: icen-modal-slide-left;
|
|
63
158
|
}
|
|
64
159
|
.modal--sheet-right {
|
|
65
|
-
right: 0; top: 0; bottom: 0;
|
|
160
|
+
right: 0; top: 0; bottom: 0;
|
|
161
|
+
width: 360px;
|
|
162
|
+
height: 100%;
|
|
66
163
|
border-radius: var(--radius-xl) 0 0 var(--radius-xl);
|
|
67
164
|
animation-name: icen-modal-slide-right;
|
|
68
165
|
}
|
|
69
166
|
.modal--sheet-top {
|
|
70
|
-
top: 0; left: 0; right: 0;
|
|
167
|
+
top: 0; left: 0; right: 0;
|
|
168
|
+
width: 100%;
|
|
169
|
+
height: 300px;
|
|
71
170
|
border-radius: 0 0 var(--radius-xl) var(--radius-xl);
|
|
72
171
|
animation-name: icen-modal-slide-top;
|
|
73
172
|
}
|
|
74
173
|
.modal--sheet-bottom {
|
|
75
|
-
bottom: 0; left: 0; right: 0;
|
|
174
|
+
bottom: 0; left: 0; right: 0;
|
|
175
|
+
width: 100%;
|
|
176
|
+
height: 300px;
|
|
76
177
|
border-radius: var(--radius-xl) var(--radius-xl) 0 0;
|
|
77
178
|
animation-name: icen-modal-slide-bottom;
|
|
78
179
|
}
|
|
79
|
-
.modal--sheet-left.modal--
|
|
80
|
-
.modal--sheet-left.modal--
|
|
81
|
-
.modal--sheet-top.modal--
|
|
180
|
+
.modal--sheet-left.modal--sm, .modal--sheet-right.modal--sm { width: 280px; }
|
|
181
|
+
.modal--sheet-left.modal--lg, .modal--sheet-right.modal--lg { width: 480px; }
|
|
182
|
+
.modal--sheet-top.modal--sm, .modal--sheet-bottom.modal--sm { height: 200px; }
|
|
183
|
+
.modal--sheet-top.modal--lg, .modal--sheet-bottom.modal--lg { height: 50vh; }
|
|
82
184
|
|
|
83
|
-
/* ──
|
|
185
|
+
/* ── 进场动画 ── */
|
|
84
186
|
@keyframes icen-modal-fade-in {
|
|
85
187
|
from { opacity: 0; }
|
|
86
188
|
to { opacity: 1; }
|
|
@@ -105,3 +207,7 @@
|
|
|
105
207
|
from { opacity: 0; transform: translateY(40px); }
|
|
106
208
|
to { opacity: 1; transform: translateY(0); }
|
|
107
209
|
}
|
|
210
|
+
|
|
211
|
+
@media (prefers-reduced-motion: reduce) {
|
|
212
|
+
.modal-backdrop, .modal { animation: none; }
|
|
213
|
+
}
|
package/dist/components/nav.css
CHANGED
|
@@ -1,29 +1,50 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @icen.ai/ui — Component: nav(玻璃顶栏,scroll 收缩配套 behaviors/nav)
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
3
|
+
*
|
|
4
|
+
* 完整契约:
|
|
5
|
+
* <nav class="nav [nav--sticky|nav--fixed] [.is-scrolled]" data-scroll-reactive>
|
|
6
|
+
* <div class="nav-left">…品牌/返回</div>
|
|
7
|
+
* <div class="nav-center">…中间菜单</div>
|
|
8
|
+
* <div class="nav-right">…操作</div>
|
|
9
|
+
* <div class="nav-bottom">…整行补充(可选,会换行)</div>
|
|
10
|
+
* </nav>
|
|
11
|
+
*
|
|
12
|
+
* 按钮:<button class="nav-btn motion pressable [.is-active] [.is-disabled] [.nav-btn--icon]">
|
|
13
|
+
* 三段布局:left/right flex-shrink:0;center flex:1 居中。
|
|
14
|
+
* behavior 维护:scrollY > 12 时挂 .is-scrolled;prefers-reduced-motion 下不监听。
|
|
10
15
|
*/
|
|
11
16
|
|
|
12
17
|
.nav {
|
|
13
|
-
display: flex;
|
|
14
|
-
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
flex-wrap: wrap;
|
|
21
|
+
gap: var(--density-space-sm);
|
|
22
|
+
height: 56px;
|
|
23
|
+
padding: 0 var(--density-space-md);
|
|
15
24
|
background: var(--token-surface-glass);
|
|
16
25
|
backdrop-filter: blur(12px) saturate(1.1);
|
|
17
26
|
-webkit-backdrop-filter: blur(12px) saturate(1.1);
|
|
18
27
|
border-bottom: 1px solid var(--token-outline-soft);
|
|
19
|
-
transition: all var(--
|
|
28
|
+
transition: all var(--icen-tx-slow);
|
|
29
|
+
}
|
|
30
|
+
.nav:has(.nav-bottom) {
|
|
31
|
+
height: auto;
|
|
32
|
+
min-height: 56px;
|
|
33
|
+
}
|
|
34
|
+
.nav--sticky {
|
|
35
|
+
position: sticky;
|
|
36
|
+
top: 0;
|
|
37
|
+
z-index: var(--z-chrome);
|
|
38
|
+
}
|
|
39
|
+
.nav--fixed {
|
|
40
|
+
position: fixed;
|
|
41
|
+
top: 0;
|
|
42
|
+
left: 0;
|
|
43
|
+
right: 0;
|
|
44
|
+
z-index: var(--z-chrome);
|
|
20
45
|
}
|
|
21
|
-
/* 带整行 bottom 时放开固定高度,第一行仍保持 56px */
|
|
22
|
-
.nav:has(.nav-bottom) { height: auto; min-height: 56px; }
|
|
23
|
-
.nav--sticky { position: sticky; top: 0; z-index: var(--z-chrome); }
|
|
24
|
-
.nav--fixed { position: fixed; top: 0; left: 0; right: 0; z-index: var(--z-chrome); }
|
|
25
46
|
|
|
26
|
-
/* scroll-reactive
|
|
47
|
+
/* scroll-reactive:未滚动更透、底边线透明;滚动后底色更实 + blur 加倍 */
|
|
27
48
|
.nav[data-scroll-reactive]:not(.is-scrolled) {
|
|
28
49
|
background: color-mix(in srgb, var(--token-surface-glass) 70%, transparent);
|
|
29
50
|
backdrop-filter: blur(8px);
|
|
@@ -34,26 +55,107 @@
|
|
|
34
55
|
background: color-mix(in srgb, var(--token-surface-glass) 92%, transparent);
|
|
35
56
|
backdrop-filter: blur(16px) saturate(1.2);
|
|
36
57
|
-webkit-backdrop-filter: blur(16px) saturate(1.2);
|
|
58
|
+
box-shadow: var(--token-shadow-elevated);
|
|
37
59
|
}
|
|
38
60
|
|
|
39
|
-
|
|
40
|
-
.nav-
|
|
41
|
-
.nav-
|
|
61
|
+
/* hide-on-scroll 模式:向下滚隐藏,向上滚恢复。仅 sticky/fixed 生效。 */
|
|
62
|
+
.nav.nav--sticky.is-nav-hidden,
|
|
63
|
+
.nav.nav--fixed.is-nav-hidden {
|
|
64
|
+
transform: translateY(-100%);
|
|
65
|
+
box-shadow: none;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.nav-left,
|
|
69
|
+
.nav-right {
|
|
70
|
+
display: flex;
|
|
71
|
+
align-items: center;
|
|
72
|
+
gap: var(--density-space-xs);
|
|
73
|
+
flex-shrink: 0;
|
|
74
|
+
}
|
|
75
|
+
.nav-center {
|
|
76
|
+
flex: 1;
|
|
77
|
+
display: flex;
|
|
78
|
+
align-items: center;
|
|
79
|
+
justify-content: center;
|
|
80
|
+
gap: var(--density-space-xs);
|
|
81
|
+
}
|
|
82
|
+
.nav-bottom { width: 100%; padding-top: var(--density-space-xs); }
|
|
42
83
|
|
|
43
84
|
.nav-btn {
|
|
44
|
-
display: inline-flex;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
85
|
+
display: inline-flex;
|
|
86
|
+
align-items: center;
|
|
87
|
+
gap: var(--density-space-xs);
|
|
88
|
+
border-radius: var(--radius-full);
|
|
89
|
+
padding: 6px var(--density-space-sm);
|
|
90
|
+
font-size: var(--density-font-size-md);
|
|
91
|
+
color: var(--token-text-muted);
|
|
92
|
+
background: none;
|
|
93
|
+
border: 0;
|
|
94
|
+
cursor: pointer;
|
|
95
|
+
-webkit-tap-highlight-color: transparent;
|
|
96
|
+
transition:
|
|
97
|
+
background-color var(--icen-tx-fast),
|
|
98
|
+
color var(--icen-tx-fast);
|
|
99
|
+
}
|
|
100
|
+
.nav-btn > svg {
|
|
101
|
+
width: 14px;
|
|
102
|
+
height: 14px;
|
|
103
|
+
flex-shrink: 0;
|
|
104
|
+
}
|
|
105
|
+
.nav-btn:not(.is-active):hover {
|
|
106
|
+
color: var(--token-text);
|
|
107
|
+
background: var(--token-control-hover);
|
|
108
|
+
}
|
|
109
|
+
.nav-btn:focus-visible {
|
|
110
|
+
outline: none;
|
|
111
|
+
box-shadow: var(--icen-ring);
|
|
112
|
+
}
|
|
113
|
+
.nav-btn.is-active,
|
|
114
|
+
.nav-btn[aria-current='page'] {
|
|
115
|
+
background: var(--token-accent);
|
|
116
|
+
color: var(--token-on-accent, #fff);
|
|
117
|
+
font-weight: 500;
|
|
118
|
+
box-shadow: var(--token-shadow-elevated);
|
|
119
|
+
}
|
|
120
|
+
.nav-btn.is-disabled,
|
|
121
|
+
.nav-btn:disabled,
|
|
122
|
+
.nav-btn[aria-disabled='true'] {
|
|
123
|
+
opacity: var(--icen-disabled-opacity);
|
|
124
|
+
pointer-events: none;
|
|
125
|
+
}
|
|
56
126
|
.nav-btn--icon { padding: 6px 10px; }
|
|
57
|
-
.nav-btn--icon > svg { width:
|
|
127
|
+
.nav-btn--icon > svg { width: 16px; height: 16px; }
|
|
128
|
+
|
|
129
|
+
.nav-divider {
|
|
130
|
+
width: 1px;
|
|
131
|
+
height: 20px;
|
|
132
|
+
margin: 0 2px;
|
|
133
|
+
background: var(--token-outline-soft);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/* 品牌徽标位 */
|
|
137
|
+
.nav-brand {
|
|
138
|
+
display: inline-flex;
|
|
139
|
+
align-items: center;
|
|
140
|
+
gap: var(--density-space-xs);
|
|
141
|
+
font-family: var(--font-heading);
|
|
142
|
+
font-size: var(--density-font-size-md);
|
|
143
|
+
font-weight: 600;
|
|
144
|
+
color: var(--token-text);
|
|
145
|
+
text-decoration: none;
|
|
146
|
+
}
|
|
147
|
+
.nav-brand:hover { text-decoration: none; }
|
|
148
|
+
.nav-brand > svg, .nav-brand > img {
|
|
149
|
+
width: 24px;
|
|
150
|
+
height: 24px;
|
|
151
|
+
}
|
|
58
152
|
|
|
59
|
-
|
|
153
|
+
/* 移动端:缩短高度、收紧间距 */
|
|
154
|
+
@media (max-width: 640px) {
|
|
155
|
+
.nav { height: 48px; min-height: 48px; padding: 0 var(--density-space-sm); }
|
|
156
|
+
.nav-btn { padding: 4px var(--density-space-xs); }
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
@media (prefers-reduced-motion: reduce) {
|
|
160
|
+
.nav, .nav-btn { transition: none; }
|
|
161
|
+
}
|