@xihan-ui/styles 1.0.0 → 2.0.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.
Files changed (171) hide show
  1. package/CHANGELOG.md +5146 -6
  2. package/README.md +22 -2
  3. package/component-tokens.d.ts +4212 -0
  4. package/component-tokens.js +2 -0
  5. package/components.tokens.json +80116 -0
  6. package/css/accordion.css +131 -75
  7. package/css/affix.css +16 -1
  8. package/css/alert.css +114 -67
  9. package/css/anchor.css +99 -27
  10. package/css/approval.css +461 -0
  11. package/css/avatar-group.css +14 -6
  12. package/css/avatar.css +33 -9
  13. package/css/back-top.css +103 -48
  14. package/css/badge.css +42 -14
  15. package/css/bar-code.css +62 -0
  16. package/css/breadcrumb.css +40 -21
  17. package/css/button-group.css +146 -24
  18. package/css/button.css +116 -99
  19. package/css/calendar-picker.css +448 -0
  20. package/css/calendar-range-picker.css +517 -0
  21. package/css/card.css +54 -77
  22. package/css/carousel.css +412 -68
  23. package/css/cascader.css +429 -246
  24. package/css/checkbox-group.css +225 -77
  25. package/css/checkbox.css +174 -37
  26. package/css/clipboard.css +266 -47
  27. package/css/code-view.css +279 -0
  28. package/css/collapsible.css +108 -63
  29. package/css/color-field.css +158 -0
  30. package/css/color-picker.css +172 -184
  31. package/css/color-slider.css +274 -0
  32. package/css/color-swatch-picker.css +243 -0
  33. package/css/color-swatch.css +35 -0
  34. package/css/combobox.css +267 -273
  35. package/css/command.css +399 -0
  36. package/css/context-menu.css +183 -108
  37. package/css/date-field.css +94 -121
  38. package/css/date-picker.css +486 -249
  39. package/css/date-range-picker.css +559 -0
  40. package/css/description.css +51 -0
  41. package/css/descriptions.css +133 -87
  42. package/css/dialog.css +247 -68
  43. package/css/diff-view.css +428 -0
  44. package/css/download-trigger.css +155 -46
  45. package/css/drawer.css +194 -111
  46. package/css/editable.css +172 -152
  47. package/css/empty-state.css +80 -11
  48. package/css/field-array.css +190 -0
  49. package/css/field.css +84 -31
  50. package/css/fieldset.css +51 -18
  51. package/css/file-upload.css +134 -36
  52. package/css/flex.css +20 -1
  53. package/css/float-button.css +238 -57
  54. package/css/floating-panel.css +173 -92
  55. package/css/focus.css +46 -0
  56. package/css/forced-colors.css +93 -0
  57. package/css/form.css +254 -77
  58. package/css/gradient-text.css +34 -10
  59. package/css/grid.css +516 -5
  60. package/css/heatmap.css +87 -29
  61. package/css/highlight.css +20 -5
  62. package/css/hover-card.css +97 -47
  63. package/css/icon-wrapper.css +15 -3
  64. package/css/icon.css +74 -8
  65. package/css/image-cropper.css +143 -29
  66. package/css/image-viewer.css +150 -89
  67. package/css/image.css +30 -1
  68. package/css/infinite-scroll.css +51 -1
  69. package/css/input-group.css +277 -0
  70. package/css/json-viewer.css +102 -45
  71. package/css/kbd.css +72 -0
  72. package/css/label.css +78 -0
  73. package/css/layers.css +5 -0
  74. package/css/layout.css +175 -31
  75. package/css/list.css +24 -3
  76. package/css/listbox.css +208 -67
  77. package/css/loading-bar.css +52 -3
  78. package/css/log.css +144 -9
  79. package/css/markdown-stream.css +149 -0
  80. package/css/marquee.css +27 -1
  81. package/css/masonry.css +7 -0
  82. package/css/matrix-code.css +67 -0
  83. package/css/mention.css +234 -152
  84. package/css/menu.css +180 -83
  85. package/css/menubar.css +204 -136
  86. package/css/message-feed.css +197 -0
  87. package/css/navigation-menu.css +144 -90
  88. package/css/notification.css +178 -100
  89. package/css/number-animation.css +7 -0
  90. package/css/number-field.css +120 -277
  91. package/css/overlay-arrow.css +12 -7
  92. package/css/page-header.css +99 -14
  93. package/css/pagination.css +175 -135
  94. package/css/password-input.css +222 -219
  95. package/css/pin-input.css +101 -67
  96. package/css/pointer.css +36 -0
  97. package/css/popconfirm.css +185 -94
  98. package/css/popover.css +121 -77
  99. package/css/progress.css +60 -12
  100. package/css/prompt-input.css +224 -0
  101. package/css/question-flow.css +513 -0
  102. package/css/radio-group.css +147 -30
  103. package/css/rating.css +193 -43
  104. package/css/reasoning.css +336 -0
  105. package/css/reset.css +84 -6
  106. package/css/resizable.css +237 -0
  107. package/css/scroll-area.css +68 -7
  108. package/css/scrollbar.css +47 -13
  109. package/css/segmented.css +94 -29
  110. package/css/select.css +288 -274
  111. package/css/separator.css +101 -1
  112. package/css/side-nav.css +133 -75
  113. package/css/signature-pad.css +74 -54
  114. package/css/skeleton.css +84 -11
  115. package/css/slider.css +132 -39
  116. package/css/sortable.css +198 -0
  117. package/css/spinner.css +126 -12
  118. package/css/splitter.css +29 -8
  119. package/css/statistic.css +55 -0
  120. package/css/steps.css +206 -72
  121. package/css/switch.css +268 -36
  122. package/css/table.css +695 -118
  123. package/css/tabs.css +604 -42
  124. package/css/tag-group.css +219 -0
  125. package/css/tag.css +118 -28
  126. package/css/tags-input.css +156 -274
  127. package/css/text-field.css +101 -249
  128. package/css/time-field.css +100 -128
  129. package/css/time-picker.css +323 -252
  130. package/css/time-range-picker.css +719 -0
  131. package/css/timeline.css +202 -68
  132. package/css/timer.css +56 -52
  133. package/css/timestamp.css +34 -0
  134. package/css/toast.css +373 -144
  135. package/css/toggle-group.css +309 -76
  136. package/css/toggle.css +116 -85
  137. package/css/tone.css +47 -0
  138. package/css/tool-call.css +421 -0
  139. package/css/toolbar.css +181 -33
  140. package/css/tooltip.css +107 -36
  141. package/css/tour.css +183 -152
  142. package/css/transfer.css +351 -138
  143. package/css/tree-select.css +323 -216
  144. package/css/tree.css +294 -62
  145. package/css/truncate.css +65 -0
  146. package/css/typography.css +228 -5
  147. package/css/undefined.css +10 -1
  148. package/css/virtualizer.css +9 -10
  149. package/css/visually-hidden.css +7 -0
  150. package/css/watermark.css +7 -0
  151. package/family/action-control.css +487 -0
  152. package/family/collection-item.css +721 -0
  153. package/family/field-chrome.css +298 -0
  154. package/family/motion.css +166 -0
  155. package/family/swatch.css +59 -0
  156. package/index.css +41705 -126
  157. package/index.unlayered.css +33692 -17339
  158. package/package.json +51 -17
  159. package/css/calendar.css +0 -367
  160. package/css/code-block.css +0 -91
  161. package/css/composer.css +0 -134
  162. package/css/countdown.css +0 -26
  163. package/css/dynamic-input.css +0 -220
  164. package/css/ellipsis.css +0 -52
  165. package/css/hotkeys.css +0 -90
  166. package/css/popselect.css +0 -391
  167. package/css/qr-code.css +0 -55
  168. package/css/result.css +0 -119
  169. package/css/space.css +0 -117
  170. package/css/thread.css +0 -120
  171. package/css/time.css +0 -25
package/css/select.css CHANGED
@@ -1,29 +1,13 @@
1
- @layer xihan.motion {
2
- /* 动画名的查找只认「文档里有没有这个名字」:引用别处文件里的名字,那份文件不一定在场,
3
- 动画会静默地整个不跑。每份皮肤都能单独引入,所以它用到的关键帧都写在自己身上。 */
4
- @keyframes xh-pop-in {
5
- from {
6
- opacity: 0;
7
- scale: var(--xh-motion-scale-enter);
8
- }
1
+ /*
2
+ * Copyright (c) 2021-Present XiHanFun and contributors.
3
+ * Licensed under the MIT License. See LICENSE in the project root for license information.
4
+ */
9
5
 
10
- to {
11
- opacity: 1;
12
- scale: 1;
13
- }
14
- }
15
- @keyframes xh-pop-out {
16
- from {
17
- opacity: 1;
18
- scale: 1;
19
- }
20
-
21
- to {
22
- opacity: 0;
23
- scale: var(--xh-motion-scale-enter);
24
- }
25
- }
26
- }
6
+ /* Select 独立皮肤同时传递引入字段视觉盒、字段内动作与浮层集合行;full bundle 递归去重。 */
7
+ @import '../family/field-chrome.css';
8
+ @import '../family/action-control.css';
9
+ @import '../family/collection-item.css';
10
+ @import '../family/motion.css';
27
11
 
28
12
  @layer xihan.components {
29
13
  /* 皮肤在场的标记:开发模式下按 scope 探一次,取不到就说明这份皮肤没被引入。 */
@@ -36,9 +20,22 @@
36
20
  /* 落定那一侧的可用高度,由定位引擎经内联自定义属性写进来,内容层继承它限高;
37
21
  引擎没算(尚未落位 / 无引擎)时不额外限高 */
38
22
  --xh-_select-available-h: 100vh;
23
+ /* 落定那一侧的可用宽度,同样由定位引擎经内联自定义属性写进来,行内轴据此夹取;
24
+ 引擎没算(尚未落位 / 无引擎 / 贴边归零)时退到视口宽 */
25
+ --xh-_select-available-w: 100vw;
26
+ /* 触发器实测宽度,由定位引擎经内联自定义属性写进来,内容层拿它当最小宽的下界;
27
+ 引擎没算(尚未落位 / 无引擎)时为 0,max 取静态档,等于不抬宽 */
28
+ --xh-_select-anchor-w: 0px;
29
+ /* WC 嵌套层仍在父层 DOM 内;先截断父 positioner 的方向,再按本层 placement 开一侧。 */
30
+ --xh-_overlay-enter-up: 0;
31
+ --xh-_overlay-enter-down: 0;
32
+ --xh-_overlay-enter-left: 0;
33
+ --xh-_overlay-enter-right: 0;
34
+ /* 列表的自绘条浮在内容之上:轨道不上底色,实色轨道会在列表右缘糊一条竖灰带 */
35
+ --xh-scrollbar-track-bg: transparent;
39
36
 
40
37
  position: fixed;
41
- z-index: var(--xh-select-layer, var(--xh-layer-popover));
38
+ z-index: var(--xh-select-layer, var(--xh-_layer, var(--xh-layer-popover)));
42
39
  /* 空壳不吃指针,交互只发生在 content 上 */
43
40
  pointer-events: none;
44
41
  }
@@ -48,32 +45,42 @@
48
45
  visibility: hidden;
49
46
  }
50
47
 
48
+ /* 进场位移按落定的一侧给。placement 与 translate 都是物理量,不随书写方向翻。 */
49
+ [data-scope='select'][data-part='positioner'][data-placement^='top'] {
50
+ --xh-_overlay-enter-down: 1;
51
+ }
52
+
53
+ [data-scope='select'][data-part='positioner'][data-placement^='bottom'] {
54
+ --xh-_overlay-enter-up: 1;
55
+ }
56
+
57
+ [data-scope='select'][data-part='positioner'][data-placement^='left'] {
58
+ --xh-_overlay-enter-right: 1;
59
+ }
60
+
61
+ [data-scope='select'][data-part='positioner'][data-placement^='right'] {
62
+ --xh-_overlay-enter-left: 1;
63
+ }
64
+
51
65
  /* 私有槽同时声明在根与 positioner 上:浮层被搬到 portal 落点,不是根的后代,继承不过去 */
52
66
  [data-scope='select']:is([data-part='root'], [data-part='positioner']) {
53
- /* 尺寸档只换这五个私有槽,触发器、标题与条目都从这两处继承它们,
54
- 换档不必给每个部件各写一条选择器 */
67
+ /* 尺寸档只换这几个私有槽,触发器与条目都从这两处继承它们,
68
+ 换档不必给每个部件各写一条选择器;形态三档由家族按 control 上的 data-variant 生成,皮肤不再声明 */
55
69
  --xh-_select-h: var(--xh-control-h-md);
56
70
  --xh-_select-px: var(--xh-control-px-md);
57
71
  --xh-_select-item-py: var(--xh-list-option-py-md);
58
72
  --xh-_select-item-px: var(--xh-control-px-md);
59
73
  --xh-_select-gap: var(--xh-control-gap-md);
60
74
  --xh-_select-font-size: var(--xh-control-font-md);
61
- --xh-_select-label-font-size: var(--xh-control-font-md);
62
75
 
63
- /* 形态档只换这三个槽:缺省即 outline(描边 + 画布底) */
64
- --xh-_select-control-bg: var(--xh-bg-canvas);
65
- --xh-_select-control-border: var(--xh-border-control);
66
- --xh-_select-control-border-hover: var(--xh-border-control-hover);
67
-
68
- /* 聚焦环恒用固定环色;强调色随语气走,只落在勾选标记与选中文字上,正文文字色不动。
69
- 没写 data-tone 时 --xh-_tone 没被声明,两处都退回原来的取值 */
70
- --xh-_select-ring: var(--xh-ring-focus);
76
+ /* 语气只落在勾选标记上,单选与多选正文使用同一颜色。 */
71
77
  --xh-_select-accent: var(--xh-_tone, var(--xh-fg-brand));
72
- --xh-_select-item-selected-fg: var(--xh-_tone-fg, var(--xh-fg-brand-strong));
73
78
  }
74
79
 
75
80
  [data-scope='select'][data-part='root'] {
76
- /* 作者塞进指示符槽的图标跟着控件的尺寸档走;它自己写了 size 时仍以作者的为准 */
81
+ /* 作者塞进指示符槽的图标跟着控件的尺寸档走;它自己写了 size 时仍以作者的为准。
82
+ 浮层条目里自绘的状态字形(勾选标记所在的标记盒与盒里的勾)不读这支:它们是指示符,走
83
+ --xh-control-indicator-* 一族——标记盒在自己身上把 --xh-icon-size 改接到盒的尺(§6.5) */
77
84
  --xh-icon-size: var(--xh-select-icon-size, var(--xh-glyph-size-md));
78
85
 
79
86
  display: inline-flex;
@@ -81,6 +88,12 @@
81
88
  gap: var(--xh-select-gap, var(--xh-space-1));
82
89
  /* 隐藏 select 以此为定位基准:它必须留在布局里,原生校验提示要有处可贴 */
83
90
  position: relative;
91
+
92
+ /* 不传尺寸时一律这么宽,宽度不随内容走;父容器给不出这么宽时整件跟着收,地板同步让步,不越出父容器。
93
+ 地板不高过缺省宽:使用者把缺省宽钉到底线以下时不必再放开底线 */
94
+ inline-size: var(--xh-select-control-w, var(--xh-control-w));
95
+ min-inline-size: min(var(--xh-select-control-w, var(--xh-control-w)), var(--xh-select-control-min-w, var(--xh-control-min-w)), 100%);
96
+ max-inline-size: 100%;
84
97
  }
85
98
 
86
99
  /* —— 尺寸 —— */
@@ -92,7 +105,6 @@
92
105
  --xh-_select-item-px: var(--xh-control-px-sm);
93
106
  --xh-_select-gap: var(--xh-control-gap-sm);
94
107
  --xh-_select-font-size: var(--xh-control-font-sm);
95
- --xh-_select-label-font-size: var(--xh-control-font-sm);
96
108
  }
97
109
 
98
110
  /* 图标只跟着盒那一侧换档:浮层里的勾选标记有自己的指示符盒,换成整档图标会撑破它 */
@@ -111,89 +123,43 @@
111
123
  --xh-_select-item-px: var(--xh-control-px-lg);
112
124
  --xh-_select-gap: var(--xh-control-gap-lg);
113
125
  --xh-_select-font-size: var(--xh-control-font-lg);
114
- --xh-_select-label-font-size: var(--xh-control-font-lg);
115
- }
116
-
117
- /* —— 形态 —— */
118
- /* 输入类不做 solid:实心底压着可编辑的值,读起来像块不可点的色板。
119
- 形态只决定描边与底色怎么用,用哪族颜色由 data-tone 决定 */
120
- [data-scope='select']:is([data-part='root'], [data-part='positioner'])[data-variant='outline'] {
121
- --xh-_select-control-bg: var(--xh-bg-canvas);
122
- --xh-_select-control-border: var(--xh-border-control);
123
- --xh-_select-control-border-hover: var(--xh-border-control-hover);
124
- }
125
-
126
- /* 填充式:底色顶替描边,悬停时才浮出一道淡边 */
127
- [data-scope='select']:is([data-part='root'], [data-part='positioner'])[data-variant='subtle'] {
128
- --xh-_select-control-bg: var(--xh-_tone-subtle, var(--xh-bg-subtle));
129
- --xh-_select-control-border: transparent;
130
- --xh-_select-control-border-hover: var(--xh-_tone-border, var(--xh-border-control-hover));
131
- }
132
-
133
- /* 无框:底与常态描边透明,悬停浮出描边,聚焦由焦点环表达 */
134
- [data-scope='select']:is([data-part='root'], [data-part='positioner'])[data-variant='ghost'] {
135
- --xh-_select-control-bg: transparent;
136
- --xh-_select-control-border: transparent;
137
- --xh-_select-control-border-hover: var(--xh-_tone-border, var(--xh-border-control-hover));
138
126
  }
139
127
 
140
128
  [data-scope='select'][data-part='label'] {
141
129
  color: var(--xh-select-label-fg, var(--xh-fg-default));
142
- font-size: var(--xh-select-label-font-size, var(--xh-_select-label-font-size));
130
+ font-size: var(--xh-select-label-font-size, var(--xh-text-label-size));
143
131
  font-weight: var(--xh-select-label-font-weight, var(--xh-text-label-weight));
144
132
  line-height: var(--xh-leading-none);
145
133
  }
146
134
 
147
135
  [data-scope='select'][data-part='label'][data-disabled] {
148
- color: var(--xh-fg-subtle);
136
+ color: var(--xh-select-label-fg-disabled, var(--xh-fg-subtle));
149
137
  }
150
138
 
151
- /* 盒:描边、底色、圆角、控件高度与行内内衬都长在这一层,触发器与清空按钮在里面并排。
152
- 聚焦环也画在它上面,焦点落在哪颗按钮上,看到的都是同一个框亮起来 */
139
+ /* 盒:描边、底色、圆角、控件高度、行内内衬、聚焦环、五态与悬停由 Field Chrome 家族画在这一层,
140
+ 触发器与清空按钮在里面并排;焦点落在哪颗按钮上,看到的都是同一个框亮起来(家族 :focus-within)。
141
+ 组件只映射既有公开槽(shadow 缺省 none:字段静息描边式、无影);盒里是按钮而不是文本光标 */
153
142
  [data-scope='select'][data-part='control'] {
154
- display: inline-flex;
155
- align-items: center;
156
- gap: var(--xh-select-control-gap, var(--xh-_select-gap));
157
- block-size: var(--xh-select-control-h, var(--xh-_select-h));
158
- padding-inline: var(--xh-select-control-px, var(--xh-_select-px));
159
- min-inline-size: var(--xh-select-control-min-w, var(--xh-control-min-w));
160
- border: var(--xh-stroke-thin) solid var(--xh-select-control-border, var(--xh-_select-control-border));
161
- border-radius: var(--xh-select-control-radius, var(--xh-shape-control));
162
- background: var(--xh-select-control-bg, var(--xh-_select-control-bg));
163
- }
164
-
165
- /* hover 只在中性态换描边:invalid 正拿边框颜色说事,被 hover 盖掉那条信息就没了 */
166
- [data-scope='select'][data-part='control']:hover:not([data-disabled], [data-invalid]) {
167
- border-color: var(--xh-select-control-border-hover, var(--xh-_select-control-border-hover));
168
- }
169
-
170
- [data-scope='select'][data-part='control'][data-invalid] {
171
- border-color: var(--xh-select-control-border-invalid, var(--xh-border-invalid));
172
-
173
- /* 校验失败时环也跟着变红:两圈等宽相邻却一红一蓝,读的人不知道哪个才是当前状态 */
174
- --xh-_select-ring: var(--xh-ring-invalid);
175
- }
176
-
177
- /* 焦点落在盒内任一颗按钮上都画同一圈环;禁用时按钮不可聚焦,守卫只是把这条说死 */
178
- [data-scope='select'][data-part='control']:focus-within:not([data-disabled]) {
179
- outline: var(--xh-ring-width) solid var(--xh-_select-ring);
180
- outline-offset: var(--xh-ring-offset);
181
- }
182
-
183
- /* 聚焦态描边色与环共用一族语气色。校验失败时要显式让开,描边保持红色 */
184
- [data-scope='select'][data-part='control']:focus-within:not([data-invalid]) {
185
- border-color: var(--xh-select-control-border-focus, var(--xh-_tone, var(--xh-border-control-focus)));
186
- }
187
-
188
- /* 只读仍可聚焦、浮层仍展得开、条目仍能浏览,所以不置灰,只把底色压下去表示「改不动」 */
189
- [data-scope='select'][data-part='control'][data-readonly] {
190
- background: var(--xh-select-control-bg-readonly, var(--xh-bg-subtle));
191
- }
192
-
193
- [data-scope='select'][data-part='control'][data-disabled] {
194
- background: var(--xh-select-control-bg-disabled, var(--xh-bg-subtle));
195
- color: var(--xh-fg-disabled);
196
- cursor: not-allowed;
143
+ --xh-field-control-height: var(--xh-select-control-h, var(--xh-_select-h));
144
+ --xh-field-control-padding-inline: var(--xh-select-control-px, var(--xh-_select-px));
145
+ --xh-field-control-gap: var(--xh-select-control-gap, var(--xh-_select-gap));
146
+ --xh-field-control-min-inline-size: var(--xh-select-control-min-w, var(--xh-control-min-w));
147
+ --xh-field-control-radius: var(--xh-select-control-radius, var(--xh-shape-control));
148
+ --xh-field-bg-rest: var(--xh-select-control-bg, var(--xh-_field-variant-bg-rest));
149
+ --xh-field-bg-hover: var(--xh-select-control-bg-hover, var(--xh-_field-variant-bg-hover));
150
+ --xh-field-bg-read-only: var(--xh-select-control-bg-readonly, var(--xh-_field-variant-bg-read-only));
151
+ --xh-field-bg-disabled: var(--xh-select-control-bg-disabled, var(--xh-_field-variant-bg-disabled));
152
+ --xh-field-fg-rest: var(--xh-select-control-fg, var(--xh-fg-default));
153
+ --xh-field-border-rest: var(--xh-select-control-border, var(--xh-_field-variant-border-rest));
154
+ --xh-field-border-hover: var(--xh-select-control-border-hover, var(--xh-_field-variant-border-hover));
155
+ --xh-field-border-focus: var(--xh-select-control-border-focus, var(--xh-_field-variant-border-focus));
156
+ --xh-field-border-invalid: var(--xh-select-control-border-invalid, var(--xh-_field-variant-border-invalid));
157
+ --xh-field-ring-focus: var(--xh-ring-focus);
158
+ --xh-field-ring-invalid: var(--xh-ring-invalid);
159
+ --xh-field-shadow-rest: var(--xh-select-control-shadow, none);
160
+ --xh-field-cursor-rest: pointer;
161
+ /* 家族 chrome 会重写 --xh-icon-size,使用者图标槽必须经桥接槽下发才能在盒内生效 */
162
+ --xh-field-glyph-size: var(--xh-select-icon-size, var(--xh-_field-size-glyph-size));
197
163
  }
198
164
 
199
165
  /* 触发器退化成盒里那颗可聚焦的按钮:描边、底色与内衬归盒,它只占满剩余一行 */
@@ -215,106 +181,71 @@
215
181
  cursor: pointer;
216
182
  }
217
183
 
218
- /* 清空按钮:盒里 trigger 的兄弟节点,排在触发器之后,与展开箭头一样宽;清不了时连接层给 hidden */
184
+ /* 清空按钮:盒里 trigger 的兄弟节点,排在触发器之后,与展开箭头一样宽;清不了时连接层给 hidden
185
+ 正方视觉盒、inset 圆角、悬停 100 / 按下 200 与 0.97 按压、粗指针热区与 :focus-visible 关环
186
+ (盒的 :focus-within 已画了一圈)全由 Action Control 的 field-inset ghost 档给,组件只映射既有覆盖槽 */
219
187
  [data-scope='select'][data-part='clear-trigger'] {
220
- display: inline-flex;
221
- flex: none;
222
- align-items: center;
223
- justify-content: center;
224
- inline-size: var(--xh-select-action-size, var(--xh-control-action-size));
225
- block-size: var(--xh-select-action-size, var(--xh-control-action-size));
226
- padding: 0;
227
- border: 0;
228
- border-radius: var(--xh-select-action-radius, var(--xh-shape-control));
229
- background: var(--xh-select-action-bg, transparent);
230
- color: var(--xh-select-action-fg, var(--xh-fg-muted));
231
- font-family: inherit;
232
-
233
- /* 字号行高钉死:继承页面字号会让行框高过按钮,字形被基线顶离正中 */
234
- font-size: var(--xh-select-action-font-size, var(--xh-text-secondary-size));
235
- line-height: var(--xh-leading-none);
236
- cursor: pointer;
237
- user-select: none;
238
- transition: background var(--xh-motion-duration-micro) var(--xh-motion-ease-enter), scale var(--xh-motion-duration-micro) var(--xh-motion-ease-enter);
239
- }
240
-
188
+ --xh-action-visual-size: var(--xh-select-action-size, var(--xh-_action-profile-visual-size));
189
+ --xh-action-min-inline-size: var(--xh-select-action-size, var(--xh-_action-profile-visual-size));
190
+ --xh-action-radius: var(--xh-select-action-radius, var(--xh-shape-inset));
191
+ /* 底色阶梯由 ghost 档给(透明 → 100 → 200),使用者槽只作覆盖入口 */
192
+ --xh-action-bg-rest: var(--xh-select-action-bg, var(--xh-_action-variant-bg-rest));
193
+ --xh-action-bg-hover: var(--xh-select-action-bg-hover, var(--xh-_action-variant-bg-hover));
194
+ --xh-action-bg-pressed: var(--xh-select-action-bg-active, var(--xh-_action-variant-bg-pressed));
195
+ --xh-action-fg-rest: var(--xh-select-action-fg, var(--xh-fg-muted));
196
+ --xh-action-fg-hover: var(--xh-select-action-fg-hover, var(--xh-fg-default));
197
+ --xh-action-border-rest: transparent;
198
+ --xh-action-highlight-rest: transparent;
199
+ --xh-action-shadow-rest: none;
200
+ --xh-action-shadow-hover: none;
201
+ --xh-action-shadow-pressed: none;
202
+ /* 字号钉死:继承页面字号会让行框高过按钮,字形被基线顶离正中 */
203
+ --xh-action-font-size: var(--xh-select-action-font-size, var(--xh-text-secondary-size));
204
+ /* 配方尚未把 profile 字形档灌进 --xh-icon-size,钮内字形先按 field-inset 档逐钮取值 */
205
+ --xh-icon-size: var(--xh-_action-profile-glyph-size);
206
+
207
+ border-width: 0;
208
+ }
209
+
210
+ /* 没值时连接层给的是 hidden 属性;家族那条 display 会把 UA 规则盖掉 */
241
211
  [data-scope='select'][data-part='clear-trigger'][hidden] {
242
212
  display: none;
243
213
  }
244
214
 
245
- [data-scope='select'][data-part='clear-trigger']:hover {
246
- background: var(--xh-select-action-bg-hover, var(--xh-bg-subtle-hover));
247
- color: var(--xh-select-action-fg-hover, var(--xh-fg-default));
248
- }
249
-
250
- [data-scope='select'][data-part='clear-trigger']:active {
251
- background: var(--xh-select-action-bg-active, var(--xh-bg-subtle-active));
252
- scale: var(--xh-motion-scale-press);
253
- }
254
-
255
- /* 清空按钮退出了 Tab 序列(tabindex=-1),正常操作走不到这里;留着是给程序化聚焦兜底,落焦时得看得见 */
256
- [data-scope='select'][data-part='clear-trigger']:focus-visible {
257
- outline: var(--xh-ring-width) solid var(--xh-_select-ring);
258
- outline-offset: var(--xh-ring-offset);
259
- }
260
-
261
- /* 多选标签:淡底小药丸;放触发器里是纯展示,放外面配 item-delete-trigger 可删 */
262
- [data-scope='select'][data-part='tag'] {
215
+ /* 标签行:触发器里收着可见标签与 +N 那一枚的一行,行里每一枚都是 tag(data-scope="tag"),
216
+ 样子归 tag.css,这里只管行怎么排。它是弹性子项,只缩不涨:
217
+ 得允许自己被压缩并把溢出裁掉,否则标签会冲出盒的右缘、把展开箭头挤到盒外;
218
+ 展开箭头靠触发器的 space-between 留在末端,行本身不必撑开 */
219
+ [data-scope='select'][data-part='tag-list'] {
263
220
  display: inline-flex;
221
+ flex: 0 1 auto;
264
222
  align-items: center;
265
- gap: var(--xh-select-tag-gap, var(--xh-space-1));
266
- padding-block: 0;
267
- padding-inline: var(--xh-select-tag-px, var(--xh-space-2));
268
- border-radius: var(--xh-select-tag-radius, var(--xh-shape-pill));
269
- background: var(--xh-select-tag-bg, var(--xh-bg-subtle));
270
- color: var(--xh-select-tag-fg, var(--xh-fg-default));
271
- font-size: var(--xh-select-tag-font-size, var(--xh-text-caption-size));
272
- line-height: var(--xh-leading-normal);
273
- white-space: nowrap;
274
- }
275
-
276
- [data-scope='select'][data-part='tag'][data-disabled] {
277
- color: var(--xh-fg-disabled);
278
- }
279
-
280
- /* 标签内的删除钮:与指示符同尺寸的小钮,贴着标签文字 */
281
- [data-scope='select'][data-part='item-delete-trigger'] {
282
- display: inline-grid;
283
- place-items: center;
284
- inline-size: var(--xh-select-item-delete-size, var(--xh-control-indicator-size));
285
- block-size: var(--xh-select-item-delete-size, var(--xh-control-indicator-size));
286
- padding: 0;
287
- border: none;
288
- border-radius: var(--xh-select-item-delete-radius, var(--xh-shape-inset));
289
- background: none;
290
- color: var(--xh-select-item-delete-fg, var(--xh-fg-subtle));
291
- font-size: inherit;
292
- cursor: pointer;
293
- transition: background var(--xh-motion-duration-micro) var(--xh-motion-ease-enter), scale var(--xh-motion-duration-micro) var(--xh-motion-ease-enter);
223
+ gap: var(--xh-select-tag-list-gap, var(--xh-space-1));
224
+ min-inline-size: 0;
225
+ overflow: hidden;
294
226
  }
295
227
 
296
- [data-scope='select'][data-part='item-delete-trigger'][hidden] {
228
+ /* 无选中时连接层给 hidden,占位文字回来 */
229
+ [data-scope='select'][data-part='tag-list'][hidden] {
297
230
  display: none;
298
231
  }
299
232
 
300
- [data-scope='select'][data-part='item-delete-trigger']:hover {
301
- background: var(--xh-select-item-delete-bg-hover, var(--xh-bg-subtle-hover));
302
- color: var(--xh-select-item-delete-fg-hover, var(--xh-fg-default));
303
- }
304
-
305
- [data-scope='select'][data-part='item-delete-trigger']:active {
306
- background: var(--xh-select-item-delete-bg-active, var(--xh-bg-subtle-active));
307
- scale: var(--xh-motion-scale-press);
233
+ /* 标签行露面时 value-text 让位:两者是触发器里的同一格,占位文字与标签不同屏。
234
+ value-text 留在 DOM 里,trigger 的可及名仍从它取到完整的选中项文本 */
235
+ [data-scope='select'][data-part='trigger']:has([data-part='tag-list']:not([hidden])) [data-part='value-text'] {
236
+ display: none;
308
237
  }
309
238
 
310
- [data-scope='select'][data-part='item-delete-trigger']:focus-visible {
311
- outline: var(--xh-ring-width) solid var(--xh-_select-ring);
312
- outline-offset: var(--xh-ring-offset);
239
+ /* 行里的标签:行装不下时各自缩短,截断落在 tag 自己的 label 上;弹性子项默认最小尺寸是内容尺寸,
240
+ 不归零则长标签把行撑破、省略号永远轮不到。+N 那一枚(带 data-count)不缩,始终完整可见。
241
+ 标签里的删除钮是 tag 的 close-trigger,样子全归 tag.css,这里不画 */
242
+ [data-scope='select'][data-part='tag-list'] > [data-scope='tag'][data-part='root'] {
243
+ flex: 0 1 auto;
244
+ min-inline-size: 0;
313
245
  }
314
246
 
315
- [data-scope='select'][data-part='item-delete-trigger'][data-disabled] {
316
- color: var(--xh-fg-disabled);
317
- cursor: not-allowed;
247
+ [data-scope='select'][data-part='tag-list'] > [data-scope='tag'][data-part='root'][data-count] {
248
+ flex: none;
318
249
  }
319
250
 
320
251
  /* 环画在盒上,按钮自己不再画:两圈套着的环读起来像两个控件 */
@@ -325,7 +256,6 @@
325
256
  /* trigger 是单体控件,用原生 disabled(条目那边一律 aria-disabled) */
326
257
  [data-scope='select'][data-part='trigger']:disabled {
327
258
  color: var(--xh-fg-disabled);
328
- cursor: not-allowed;
329
259
  }
330
260
 
331
261
  /* 盒宽由 control 定,这里得允许自己被压缩:弹性子项默认最小尺寸是内容尺寸,
@@ -343,8 +273,10 @@
343
273
  color: var(--xh-select-placeholder-fg, var(--xh-fg-subtle));
344
274
  }
345
275
 
346
- /* 有值时清空钮顶上来,箭头让位:两个图标并排堆着,用户分不清点哪个 */
347
- [data-scope='select'][data-part='indicator'][data-clearable] {
276
+ /* 有值时清空钮顶上来,箭头让位:两个图标并排堆着,用户分不清点哪个。
277
+ 判据查的是盒里此刻真有一颗没收起的清空钮,不是「有没有值」——
278
+ 作者没摆清空钮时箭头照常留着,不然让了位没人接,指示符整个消失 */
279
+ [data-scope='select'][data-part='control']:has([data-part='clear-trigger']:not([hidden])) [data-part='indicator'] {
348
280
  display: none;
349
281
  }
350
282
 
@@ -357,7 +289,7 @@
357
289
  inline-size: var(--xh-select-action-size, var(--xh-control-action-size));
358
290
  block-size: var(--xh-select-action-size, var(--xh-control-action-size));
359
291
  color: var(--xh-select-indicator-fg, var(--xh-fg-muted));
360
- transition: rotate var(--xh-motion-duration-micro) var(--xh-motion-ease-enter);
292
+ transition: rotate var(--xh-motion-duration-micro) var(--xh-motion-ease-enter-strong);
361
293
  }
362
294
 
363
295
  /* 没写内容就由皮肤画箭头;作者往部件里塞了自己的图形,这条规则即不命中 */
@@ -379,23 +311,44 @@
379
311
  /* 浮层外壳:描边、底色、阴影与整体尺寸归它。它自己不滚——滚的是里面的 list,
380
312
  底部操作区因此留在视口里,不随条目滚走 */
381
313
  [data-scope='select'][data-part='content'] {
314
+ position: relative;
382
315
  display: flex;
383
316
  flex-direction: column;
384
- min-inline-size: var(--xh-select-content-min-w, var(--xh-overlay-menu-min-w));
385
- max-inline-size: var(--xh-select-content-max-w, var(--xh-overlay-max-w));
317
+ /* 下界跟着触发器走,面板不窄于它;可用宽度的夹取写在这一侧:
318
+ min-inline-size 恒压过 max-inline-size,锚点比可用区还宽时只夹 max 等于没夹 */
319
+ min-inline-size: min(
320
+ max(var(--xh-select-content-min-w, var(--xh-overlay-menu-min-w)), var(--xh-_select-anchor-w)),
321
+ var(--xh-_select-available-w)
322
+ );
323
+ /* 静态档与落位后的可用宽度取小:窄视口下面板伸出去,最右侧的内容就点不到了 */
324
+ max-inline-size: min(var(--xh-select-content-max-w, var(--xh-overlay-max-w)), var(--xh-_select-available-w));
386
325
  max-block-size: min(var(--xh-select-content-max-h, var(--xh-overlay-menu-max-h)), var(--xh-_select-available-h));
387
326
  padding-block: var(--xh-select-content-py, var(--xh-space-1));
388
327
  padding-inline: var(--xh-select-content-px, var(--xh-space-1));
389
- border: var(--xh-stroke-thin) solid var(--xh-select-content-border, var(--xh-border-default));
390
- border-radius: var(--xh-select-content-radius, var(--xh-shape-surface));
391
- background: var(--xh-select-content-bg, var(--xh-bg-surface));
392
- color: var(--xh-select-content-fg, var(--xh-fg-default));
393
- box-shadow: var(--xh-select-content-shadow, var(--xh-elevation-floating));
328
+ border: var(--xh-stroke-thin) solid var(--xh-select-content-border, var(--xh-material-frosted-border));
329
+ border-radius: var(--xh-select-content-radius, var(--xh-shape-overlay));
330
+ background: var(--xh-select-content-bg, var(--xh-material-frosted-bg));
331
+ color: var(--xh-select-content-fg, var(--xh-material-frosted-fg));
332
+ box-shadow: var(--xh-select-content-shadow, var(--xh-material-frosted-shadow));
333
+ -webkit-backdrop-filter: var(--xh-select-content-backdrop, var(--xh-material-frosted-backdrop));
334
+ backdrop-filter: var(--xh-select-content-backdrop, var(--xh-material-frosted-backdrop));
394
335
  /* 条目的悬停底色是方角,滚到两端时会探出外壳的圆角 */
395
336
  overflow: hidden;
396
337
  pointer-events: auto;
397
338
  }
398
339
 
340
+ /* 顶光单独叠在真实四边 border 内侧;强制色归零后轮廓仍在。 */
341
+ [data-scope='select'][data-part='content']::before {
342
+ content: '';
343
+ position: absolute;
344
+ inset-block-start: 0;
345
+ inset-inline: 0;
346
+ block-size: var(--xh-stroke-thin);
347
+ border-radius: inherit;
348
+ background: var(--xh-select-content-highlight, var(--xh-material-frosted-highlight));
349
+ pointer-events: none;
350
+ }
351
+
399
352
  /* 列表框本体:只管滚动,留白归外壳。
400
353
  min-block-size: 0 是 flex 子项能真正滚动的前提——不给的话它按内容撑高,
401
354
  外壳的 max-block-size 就只会把溢出的部分裁掉而不是交给它滚 */
@@ -406,6 +359,8 @@
406
359
  gap: var(--xh-select-list-gap, var(--xh-list-option-gap));
407
360
  min-block-size: 0;
408
361
  overflow-y: auto;
362
+ /* 浮层滚动面:滚到头不把页面一起带走 */
363
+ overscroll-behavior: contain;
409
364
  }
410
365
 
411
366
  /* 底部操作区:贴在列表下沿,用一道分隔线与条目断开。
@@ -417,8 +372,8 @@
417
372
  gap: var(--xh-select-footer-gap, var(--xh-space-2));
418
373
  padding-block: var(--xh-select-footer-py, var(--xh-space-2));
419
374
  padding-inline: var(--xh-select-footer-px, var(--xh-space-2));
420
- border-block-start: var(--xh-stroke-thin) solid var(--xh-select-footer-border, var(--xh-border-subtle));
421
- color: var(--xh-select-footer-fg, var(--xh-fg-muted));
375
+ border-block-start: var(--xh-stroke-thin) solid var(--xh-select-footer-border, var(--xh-material-frosted-separator));
376
+ color: var(--xh-select-footer-fg, var(--xh-material-frosted-fg-muted));
422
377
  font-size: var(--xh-select-footer-font-size, var(--xh-text-secondary-size));
423
378
  }
424
379
 
@@ -433,77 +388,140 @@
433
388
  真正的收起由宿主在退场结束后落成内联 display:none(Vue 那边直接不渲染)。
434
389
  其余声明了 display 的角色节点仍补 [hidden],那几处没有退场动画。 */
435
390
 
436
- /* 焦点落在容器上只有一种情形:指针打开、无选中值、还没有任何条目当锚点。
437
- 那一刻它认领着 Tab 位,环画在浮层内沿;有锚点时环长在条目上,容器不再画 */
438
- [data-scope='select'][data-part='list'][tabindex='0']:focus-visible {
439
- outline: var(--xh-ring-width) solid var(--xh-ring-focus);
440
- outline-offset: calc(-1 * var(--xh-ring-width));
441
- }
442
-
443
391
  [data-scope='select'][data-part='list']:not([tabindex='0']):focus-visible {
444
392
  outline: none;
445
393
  }
446
394
 
447
395
  [data-scope='select'][data-part='content'][data-state='open'] {
448
- animation: xh-pop-in var(--xh-motion-duration-enter) var(--xh-motion-ease-enter);
396
+ animation: xh-overlay-slide-in var(--xh-motion-duration-enter) var(--xh-motion-ease-enter-strong);
397
+ /* 只在开着的这一档挂:合成层随 data-state 一起收走,收起后不再占着 */
398
+ will-change: opacity, translate;
449
399
  }
450
400
 
451
401
  /* 退场:收起那一帧 hidden 由退场闸门押后,这里才播得出来。forwards 把末态钉住,
452
402
  免得动画结束到真收起之间闪一下原样 */
453
403
  [data-scope='select'][data-part='content'][data-state='closed'] {
454
- animation: xh-pop-out var(--xh-motion-duration-exit) var(--xh-motion-ease-exit) forwards;
404
+ animation: xh-overlay-slide-out var(--xh-motion-duration-exit) var(--xh-motion-ease-exit) forwards;
405
+ will-change: opacity, translate;
455
406
  }
456
407
 
457
- [data-scope='select'][data-part='item'] {
408
+ /* 空态占位:待在 content 里、list 的兄弟;盒与阴影归 content,这里只画一句居中的次要文字 */
409
+ [data-scope='select'][data-part='empty'] {
410
+ display: block;
411
+ flex: none;
412
+ padding-block: var(--xh-select-empty-py, var(--xh-space-3));
413
+ padding-inline: var(--xh-select-empty-px, var(--xh-_select-item-px));
414
+ color: var(--xh-select-empty-fg, var(--xh-material-frosted-fg-muted));
415
+ font-size: var(--xh-select-empty-font-size, var(--xh-_select-font-size));
416
+ line-height: var(--xh-leading-none);
417
+ text-align: center;
418
+ }
419
+
420
+ /* 上面给了 display,UA 的 [hidden]{display:none} 已被盖掉,这里补回来 */
421
+ [data-scope='select'][data-part='empty'][hidden] {
422
+ display: none;
423
+ }
424
+
425
+ /* 在途占位:与空态占位同一个位置、同一副观感,两者不同屏 */
426
+ [data-scope='select'][data-part='loading'] {
427
+ display: block;
428
+ flex: none;
429
+ padding-block: var(--xh-select-loading-py, var(--xh-space-3));
430
+ padding-inline: var(--xh-select-loading-px, var(--xh-_select-item-px));
431
+ color: var(--xh-select-loading-fg, var(--xh-material-frosted-fg-muted));
432
+ font-size: var(--xh-select-loading-font-size, var(--xh-_select-font-size));
433
+ line-height: var(--xh-leading-none);
434
+ text-align: center;
435
+ }
436
+
437
+ [data-scope='select'][data-part='loading'][hidden] {
438
+ display: none;
439
+ }
440
+
441
+ [data-scope='select'][data-part='group'] {
458
442
  display: flex;
459
- align-items: center;
460
- gap: var(--xh-select-item-gap, var(--xh-_select-gap));
461
- padding-block: var(--xh-select-item-py, var(--xh-_select-item-py));
462
- padding-inline: var(--xh-select-item-px, var(--xh-_select-item-px));
463
- border-radius: var(--xh-select-item-radius, var(--xh-shape-control));
464
- color: var(--xh-select-item-fg, var(--xh-fg-default));
465
- font-size: var(--xh-select-item-font-size, var(--xh-_select-font-size));
466
- /* 行高留出文字的上下伸展空间,行内那层 overflow:hidden 才不会把字削掉 */
467
- line-height: var(--xh-select-item-leading, var(--xh-leading-normal));
468
- white-space: nowrap;
469
- cursor: pointer;
470
- user-select: none;
471
- transition:
472
- background var(--xh-motion-duration-micro) var(--xh-motion-ease-enter),
473
- color var(--xh-motion-duration-micro) var(--xh-motion-ease-enter);
443
+ flex-direction: column;
444
+ gap: var(--xh-select-group-gap, var(--xh-list-option-gap));
474
445
  }
475
446
 
476
- /* 悬停与键盘锚点共用中性灰轻档:条目本身承载焦点,不另画描边 */
477
- [data-scope='select'][data-part='item']:not([data-disabled]):is(:hover, [data-highlighted]) {
478
- background: var(--xh-select-item-bg-hover, var(--xh-bg-subtle));
447
+ [data-scope='select'][data-part='group'][hidden] {
448
+ display: none;
479
449
  }
480
450
 
481
- /* 选中只换文字色与字重,配合行尾的 标记;底色整条通道留给高亮,
482
- 两者因此能同时看见 */
483
- [data-scope='select'][data-part='item'][data-state='checked'] {
484
- color: var(--xh-select-item-fg-selected, var(--xh-_select-item-selected-fg));
485
- font-weight: var(--xh-select-item-font-weight-selected, var(--xh-font-weight-medium));
451
+ /* 后继分组用一条实体细线分段;既有 spacing 槽改管线后的内距,总节奏不另造一套。 */
452
+ [data-scope='select'][data-part='group'] + [data-scope='select'][data-part='group'] {
453
+ padding-block-start: var(--xh-select-group-spacing, var(--xh-space-1_5));
454
+ border-block-start: var(--xh-stroke-thin) solid
455
+ var(--xh-select-group-separator-color, var(--xh-material-frosted-separator));
486
456
  }
487
457
 
488
- /* 键盘走到条目上要画环:轻档底色对白底只有 1.1:1,够不上焦点指示器的对比度要求。
489
- 指针悬停走的是程序化聚焦,鼠标模态下 :focus-visible 不匹配,不会误画 */
490
- [data-scope='select'][data-part='item']:focus-visible {
491
- outline: var(--xh-ring-width) solid var(--xh-ring-focus);
492
- outline-offset: calc(-1 * var(--xh-ring-width));
458
+ /* 分组标题不是选项、进不了导航,画成小号次要文字,
459
+ 内缩与条目对齐(同一个 padding-inline),标题与条目文字才在一条竖线上 */
460
+ [data-scope='select'][data-part='group-label'] {
461
+ display: block;
462
+ padding-block: var(--xh-select-group-label-py, var(--xh-space-1));
463
+ padding-inline: var(--xh-select-group-label-px, var(--xh-_select-item-px));
464
+ color: var(--xh-select-group-label-fg, var(--xh-material-frosted-fg-muted));
465
+ font-size: var(--xh-select-group-label-font-size, var(--xh-text-caption-size));
466
+ font-weight: var(--xh-select-group-label-font-weight, var(--xh-font-weight-medium));
467
+ line-height: var(--xh-leading-none);
468
+ user-select: none;
493
469
  }
494
470
 
495
- [data-scope='select'][data-part='item']:focus:not(:focus-visible) {
496
- outline: none;
471
+ [data-scope='select'][data-part='group-label'][hidden] {
472
+ display: none;
497
473
  }
498
474
 
499
- /* 禁用走 aria-disabled 而非原生 disabled,条目仍可聚焦,样式由 data-disabled 表达 */
500
- [data-scope='select'][data-part='item'][data-disabled] {
501
- color: var(--xh-fg-disabled);
502
- cursor: not-allowed;
475
+ [data-scope='select'][data-part='item'] {
476
+ /* 公开 Select 槽只映射到家族合同;网格、尺寸与状态选择器不在组件皮肤复制。pressed 面与 selected 各态由家族按 overlay 上下文给出。 */
477
+ --xh-collection-block-padding: var(--xh-select-item-py, var(--xh-_select-item-py));
478
+ --xh-collection-inline-padding: var(--xh-select-item-px, var(--xh-_select-item-px));
479
+ --xh-collection-gap: var(--xh-select-item-gap, var(--xh-_select-gap));
480
+ --xh-collection-font-size: var(--xh-select-item-font-size, var(--xh-_select-font-size));
481
+ --xh-collection-radius: var(--xh-select-item-radius, var(--xh-shape-control));
482
+ --xh-collection-fg-rest: var(--xh-select-item-fg, var(--xh-material-frosted-fg));
483
+ --xh-collection-fg-hover: var(--xh-select-item-fg, var(--xh-material-frosted-fg));
484
+ --xh-collection-fg-keyboard-highlight: var(--xh-select-item-fg, var(--xh-material-frosted-fg));
485
+ --xh-collection-fg-selected: var(--xh-select-item-fg-selected, var(--xh-select-item-fg, var(--xh-material-frosted-fg)));
486
+ --xh-collection-fg-selected-highlight: var(--xh-select-item-fg-selected, var(--xh-select-item-fg, var(--xh-material-frosted-fg)));
487
+ --xh-collection-fg-selected-hover: var(--xh-select-item-fg-selected, var(--xh-select-item-fg, var(--xh-material-frosted-fg)));
488
+ --xh-collection-fg-selected-pressed: var(--xh-select-item-fg-selected, var(--xh-select-item-fg, var(--xh-material-frosted-fg)));
489
+ --xh-collection-fg-pressed: var(--xh-select-item-fg, var(--xh-material-frosted-fg));
490
+ --xh-collection-font-weight-selected: var(--xh-select-item-font-weight-selected, var(--xh-font-weight-regular));
491
+ --xh-collection-font-weight-selected-highlight: var(--xh-select-item-font-weight-selected, var(--xh-font-weight-regular));
492
+ --xh-collection-font-weight-selected-hover: var(--xh-select-item-font-weight-selected, var(--xh-font-weight-regular));
493
+ --xh-collection-font-weight-selected-pressed: var(--xh-select-item-font-weight-selected, var(--xh-font-weight-regular));
494
+ --xh-collection-bg-hover: var(--xh-select-item-bg-hover, var(--xh-bg-subtle));
495
+ --xh-collection-bg-keyboard-highlight: var(--xh-select-item-bg-hover, var(--xh-bg-subtle));
496
+ --xh-collection-bg-selected-highlight: var(--xh-select-item-bg-hover, var(--xh-bg-subtle));
497
+ --xh-collection-bg-selected-hover: var(--xh-select-item-bg-hover, var(--xh-bg-subtle));
498
+ --xh-collection-bg-pressed: var(--xh-select-item-bg-pressed, var(--xh-bg-subtle-hover));
499
+ --xh-collection-bg-selected-pressed: var(--xh-select-item-bg-pressed, var(--xh-bg-subtle-hover));
500
+ /* data-highlighted 同时覆盖指针与键盘路径;指针只换面,焦点环在 :focus-visible 下再接回。 */
501
+ --xh-collection-outline-keyboard-highlight: transparent;
502
+ --xh-collection-outline-selected-highlight: transparent;
503
+ --xh-collection-indicator-fg-rest: var(--xh-select-item-check-fg, var(--xh-_select-accent));
504
+ --xh-collection-indicator-fg-checked: var(--xh-select-item-check-fg, var(--xh-_select-accent));
505
+ --xh-collection-indicator-fg-selected: var(--xh-select-item-check-fg, var(--xh-_select-accent));
506
+ --xh-collection-indicator-fg-selected-hover: var(--xh-select-item-check-fg, var(--xh-_select-accent));
507
+ --xh-collection-indicator-fg-selected-highlight: var(--xh-select-item-check-fg, var(--xh-_select-accent));
508
+ --xh-collection-indicator-fg-selected-pressed: var(--xh-select-item-check-fg, var(--xh-_select-accent));
509
+
510
+ /* 行高留出文字的上下伸展空间,行内那层 overflow:hidden 才不会把字削掉 */
511
+ line-height: var(--xh-select-item-leading, var(--xh-leading-normal));
512
+ white-space: nowrap;
513
+ user-select: none;
514
+ }
515
+
516
+ /* 键盘焦点出现时底色立即到位,环不会压在背景过渡的中间帧上。 */
517
+ [data-scope='select'][data-part='item']:focus-visible:not(:hover) {
518
+ --xh-collection-outline-keyboard-highlight: var(--xh-ring-focus);
519
+ --xh-collection-outline-selected-highlight: var(--xh-ring-focus);
520
+
521
+ transition: none;
503
522
  }
504
523
 
505
524
  [data-scope='select'][data-part='item-text'] {
506
- flex: 1;
507
525
  /* 弹性子项默认最小尺寸是内容尺寸,不归零则长文本把行撑破、省略号轮不上 */
508
526
  min-inline-size: 0;
509
527
  overflow: hidden;
@@ -511,18 +529,22 @@
511
529
  text-overflow: ellipsis;
512
530
  }
513
531
 
514
- /* 勾选标记只在选中项上出现;未选中时占位不塌,切换选中不引起行宽抖动 */
532
+ /* 勾选标记只在选中项上出现;未选中时占位不塌,切换选中不引起行宽抖动。
533
+ 盒与盒里的勾是指示符(§6.5):盒按指示符档取尺,并在自己身上把 --xh-icon-size 改接到盒的尺,皮肤画的
534
+ 兜底勾与作者塞进盒里的 XhIcon 读同一把尺、与盒同边长(勾选标记不是勾选格,不取 × 0.75,与 Listbox / Menu 族
535
+ 同口径);不读家族按档下发到行的 --xh-icon-size——那支只管作者放进条目里的图标,按图标档取的 20px 比
536
+ 16 / 14 的指示符档大一圈 */
515
537
  [data-scope='select'][data-part='item-indicator'] {
538
+ --xh-icon-size: var(--xh-select-item-indicator-size, var(--xh-control-indicator-size));
539
+
516
540
  display: inline-flex;
517
- flex: none;
518
541
  align-items: center;
519
542
  justify-content: center;
520
543
  inline-size: var(--xh-select-item-indicator-size, var(--xh-control-indicator-size));
521
- color: var(--xh-select-item-indicator-fg, var(--xh-_select-accent));
522
- visibility: hidden;
544
+ block-size: var(--xh-select-item-indicator-size, var(--xh-control-indicator-size));
523
545
  }
524
546
 
525
- /* 同上:没写内容就由皮肤画勾 */
547
+ /* 同上:没写内容就由皮肤画勾。尺寸读标记盒自己改接过的 --xh-icon-size:与盒同边长,随指示符档换档 */
526
548
  [data-scope='select'][data-part='item-indicator']:empty::before {
527
549
  content: '';
528
550
  display: inline-block;
@@ -534,10 +556,6 @@
534
556
  mask: var(--xh-glyph-mark-check) center / contain no-repeat;
535
557
  }
536
558
 
537
- [data-scope='select'][data-part='item-indicator'][data-state='checked'] {
538
- visibility: visible;
539
- }
540
-
541
559
  /* 表单影子:视觉隐藏但留在布局与表单里,原生校验提示需要一个可定位的框 */
542
560
  [data-scope='select'][data-part='hidden-select'] {
543
561
  pointer-events: none;
@@ -555,27 +573,23 @@
555
573
  mask: var(--xh-glyph-mark-close) center / contain no-repeat;
556
574
  }
557
575
 
558
- [data-scope='select'][data-part='item-delete-trigger']:empty::before {
559
- content: '';
560
- display: inline-block;
561
- inline-size: var(--xh-icon-size, var(--xh-glyph-size-text));
562
- block-size: var(--xh-icon-size, var(--xh-glyph-size-text));
563
- vertical-align: var(--xh-glyph-baseline-shift);
564
- background-color: currentColor;
565
- -webkit-mask: var(--xh-glyph-mark-close) center / contain no-repeat;
566
- mask: var(--xh-glyph-mark-close) center / contain no-repeat;
567
- }
568
-
569
576
  /* 声明过任何 display 就盖掉了 UA 的 [hidden]{display:none},收起态得自己还回去。
570
577
  写在文件末尾:兜底必须排在该部件所有 display 声明之后 */
571
578
  [data-scope='select'][data-part='root'][hidden],
572
579
  [data-scope='select'][data-part='control'][hidden],
573
580
  [data-scope='select'][data-part='trigger'][hidden],
574
- [data-scope='select'][data-part='tag'][hidden],
575
581
  [data-scope='select'][data-part='indicator'][hidden],
576
582
  [data-scope='select'][data-part='list'][hidden],
577
583
  [data-scope='select'][data-part='item'][hidden],
578
584
  [data-scope='select'][data-part='item-indicator'][hidden] {
579
585
  display: none;
580
586
  }
587
+
588
+ @media print {
589
+ /* 打印:定位层与遮罩是交互期才存在的东西,落到纸上只会盖住底下的正文。
590
+ 收起写在这份皮肤里而不是 reset:reset 层排在组件层之前,组件层里任何一条 display 都压得住它。 */
591
+ [data-scope='select'][data-part='positioner'] {
592
+ display: none;
593
+ }
594
+ }
581
595
  }