@xihan-ui/styles 1.0.0-alpha.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 (114) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/LICENSE +21 -0
  3. package/README.md +27 -0
  4. package/css/accordion.css +108 -0
  5. package/css/affix.css +27 -0
  6. package/css/alert.css +108 -0
  7. package/css/anchor.css +137 -0
  8. package/css/avatar-group.css +82 -0
  9. package/css/avatar.css +55 -0
  10. package/css/back-top.css +61 -0
  11. package/css/badge.css +50 -0
  12. package/css/breadcrumb.css +127 -0
  13. package/css/button-group.css +131 -0
  14. package/css/button.css +98 -0
  15. package/css/calendar.css +219 -0
  16. package/css/card.css +116 -0
  17. package/css/carousel.css +193 -0
  18. package/css/cascader.css +397 -0
  19. package/css/checkbox-group.css +185 -0
  20. package/css/checkbox.css +91 -0
  21. package/css/clipboard.css +133 -0
  22. package/css/code-block.css +81 -0
  23. package/css/collapsible.css +63 -0
  24. package/css/color-picker.css +424 -0
  25. package/css/combobox.css +433 -0
  26. package/css/composer.css +127 -0
  27. package/css/context-menu.css +263 -0
  28. package/css/countdown.css +21 -0
  29. package/css/date-field.css +200 -0
  30. package/css/date-picker.css +231 -0
  31. package/css/descriptions.css +200 -0
  32. package/css/dialog.css +127 -0
  33. package/css/drawer.css +372 -0
  34. package/css/dynamic-input.css +157 -0
  35. package/css/editable.css +249 -0
  36. package/css/ellipsis.css +41 -0
  37. package/css/empty-state.css +78 -0
  38. package/css/field.css +65 -0
  39. package/css/file-upload.css +298 -0
  40. package/css/flex.css +95 -0
  41. package/css/float-button.css +121 -0
  42. package/css/form.css +185 -0
  43. package/css/gradient-text.css +62 -0
  44. package/css/grid.css +428 -0
  45. package/css/highlight.css +21 -0
  46. package/css/hover-card.css +146 -0
  47. package/css/icon-wrapper.css +64 -0
  48. package/css/icon.css +54 -0
  49. package/css/image.css +45 -0
  50. package/css/infinite-scroll.css +22 -0
  51. package/css/layers.css +2 -0
  52. package/css/layout.css +169 -0
  53. package/css/list.css +117 -0
  54. package/css/listbox.css +174 -0
  55. package/css/loading-bar.css +66 -0
  56. package/css/log.css +66 -0
  57. package/css/marquee.css +182 -0
  58. package/css/mention.css +222 -0
  59. package/css/menu.css +144 -0
  60. package/css/menubar.css +271 -0
  61. package/css/motion.css +58 -0
  62. package/css/navigation-menu.css +270 -0
  63. package/css/number-animation.css +32 -0
  64. package/css/number-field.css +219 -0
  65. package/css/page-header.css +85 -0
  66. package/css/pagination.css +148 -0
  67. package/css/pin-input.css +157 -0
  68. package/css/popconfirm.css +150 -0
  69. package/css/popover.css +150 -0
  70. package/css/popselect.css +207 -0
  71. package/css/progress.css +37 -0
  72. package/css/qr-code.css +50 -0
  73. package/css/radio-group.css +101 -0
  74. package/css/rating.css +141 -0
  75. package/css/reset.css +22 -0
  76. package/css/result.css +104 -0
  77. package/css/scroll-area.css +176 -0
  78. package/css/select.css +264 -0
  79. package/css/separator.css +17 -0
  80. package/css/skeleton.css +78 -0
  81. package/css/slider.css +197 -0
  82. package/css/spinner.css +74 -0
  83. package/css/splitter.css +127 -0
  84. package/css/statistic.css +67 -0
  85. package/css/steps.css +252 -0
  86. package/css/switch.css +61 -0
  87. package/css/table.css +404 -0
  88. package/css/tabs.css +157 -0
  89. package/css/tags-input.css +360 -0
  90. package/css/text-field.css +195 -0
  91. package/css/thread.css +107 -0
  92. package/css/time-field.css +200 -0
  93. package/css/time-picker.css +347 -0
  94. package/css/time.css +20 -0
  95. package/css/timeline.css +284 -0
  96. package/css/toast.css +195 -0
  97. package/css/toaster.css +69 -0
  98. package/css/toggle-group.css +160 -0
  99. package/css/toggle.css +103 -0
  100. package/css/tone.css +85 -0
  101. package/css/toolbar.css +114 -0
  102. package/css/tooltip.css +109 -0
  103. package/css/tour.css +305 -0
  104. package/css/transfer.css +318 -0
  105. package/css/tree-select.css +441 -0
  106. package/css/tree.css +204 -0
  107. package/css/typography.css +151 -0
  108. package/css/undefined.css +38 -0
  109. package/css/virtualizer.css +104 -0
  110. package/css/visually-hidden.css +13 -0
  111. package/css/watermark.css +48 -0
  112. package/index.css +113 -0
  113. package/index.unlayered.css +16164 -0
  114. package/package.json +163 -0
package/css/steps.css ADDED
@@ -0,0 +1,252 @@
1
+ @layer xihan.components {
2
+ [data-scope='steps'][data-part='root'] {
3
+ /* 尺寸档只换这三个私有槽,序号圆点、标题与说明都从 root 继承它们,
4
+ 换档不必给每个部件各写一条选择器 */
5
+ --xh-_steps-indicator-size: var(--xh-control-h-sm);
6
+ --xh-_steps-title-font-size: var(--xh-text-label-size);
7
+ --xh-_steps-caption-font-size: var(--xh-font-size-xs);
8
+
9
+ /* 语气落在走过与当前这两步的标记和连接线上:强调色画描边与填充,
10
+ accent-text 是普通底上的强调文字(当前步的序号),on-accent 是实心底上的前景。
11
+ 没写 data-tone 时 --xh-_tone 一族没被声明,三个槽都退回原来的品牌配色 */
12
+ --xh-_steps-accent: var(--xh-_tone, var(--xh-bg-brand));
13
+ --xh-_steps-accent-text: var(--xh-_tone-fg, var(--xh-bg-brand));
14
+ --xh-_steps-on-accent: var(--xh-_tone-on, var(--xh-fg-on-brand));
15
+
16
+ display: flex;
17
+ flex-direction: column;
18
+ gap: var(--xh-steps-gap, var(--xh-stack-gap-md));
19
+ }
20
+
21
+ [data-scope='steps'][data-part='root'][hidden] {
22
+ display: none;
23
+ }
24
+
25
+ /* 纵向:步骤列与面板并排 */
26
+ [data-scope='steps'][data-part='root'][data-orientation='vertical'] {
27
+ flex-direction: row;
28
+ }
29
+
30
+ /* —— 尺寸 —— */
31
+ /* 缺省档写在上面的基础规则里。圆点直径不在 control-h 那把尺上(缺省是 sm 档的 28px),
32
+ 两侧改从 space 档取,缺省档才留得住 */
33
+ [data-scope='steps'][data-part='root'][data-size='sm'] {
34
+ --xh-_steps-indicator-size: var(--xh-space-6);
35
+ --xh-_steps-title-font-size: var(--xh-font-size-sm);
36
+ /* 字号档最小就是 xs,序号与说明不再往下走,故不重声明 caption */
37
+ }
38
+
39
+ [data-scope='steps'][data-part='root'][data-size='lg'] {
40
+ --xh-_steps-indicator-size: var(--xh-space-8);
41
+ --xh-_steps-title-font-size: var(--xh-font-size-lg);
42
+ --xh-_steps-caption-font-size: var(--xh-font-size-sm);
43
+ }
44
+
45
+ [data-scope='steps'][data-part='list'] {
46
+ display: flex;
47
+ align-items: center;
48
+ gap: var(--xh-steps-list-gap, var(--xh-space-2));
49
+ }
50
+
51
+ [data-scope='steps'][data-part='list'][hidden] {
52
+ display: none;
53
+ }
54
+
55
+ [data-scope='steps'][data-part='list'][data-orientation='vertical'] {
56
+ flex-direction: column;
57
+ align-items: stretch;
58
+ }
59
+
60
+ /* 组内无锚点时 list 自己在 Tab 序列里(走到完成位就是这种情形),落焦要看得见 */
61
+ [data-scope='steps'][data-part='list']:focus-visible {
62
+ outline: var(--xh-ring-width) solid var(--xh-ring-focus);
63
+ outline-offset: var(--xh-ring-offset);
64
+ }
65
+
66
+ /* 每一步与它后面那截连接线一起占一格,等分整行;min-inline-size 允许被压缩,
67
+ 标题里的省略号才有生效的余地 */
68
+ [data-scope='steps'][data-part='item'] {
69
+ display: flex;
70
+ flex: 1;
71
+ align-items: center;
72
+ gap: var(--xh-steps-item-gap, var(--xh-space-2));
73
+ min-inline-size: 0;
74
+ }
75
+
76
+ [data-scope='steps'][data-part='item'][hidden] {
77
+ display: none;
78
+ }
79
+
80
+ /* 末步后面没有"下一步",那截连接线不该占地方;作者不写它也一样,写了就替他收掉 */
81
+ [data-scope='steps'][data-part='item']:last-child {
82
+ flex: none;
83
+ }
84
+
85
+ [data-scope='steps'][data-part='item']:last-child [data-scope='steps'][data-part='separator'] {
86
+ display: none;
87
+ }
88
+
89
+ [data-scope='steps'][data-part='item'][data-orientation='vertical'] {
90
+ flex-direction: column;
91
+ flex: none;
92
+ align-items: flex-start;
93
+ }
94
+
95
+ /* 触发器排成两列:序号占左列并跨两行,标题与说明各占右列一行。
96
+ 用 grid 而不是再包一层节点——解剖里没有那个包裹层,作者也不该被逼着多写一个 div。
97
+ 只有说明缺席时右列的第二行是零高,不会留白 */
98
+ [data-scope='steps'][data-part='trigger'] {
99
+ display: grid;
100
+ grid-template-columns: auto minmax(0, 1fr);
101
+ align-items: center;
102
+ column-gap: var(--xh-steps-trigger-gap, var(--xh-control-gap-md));
103
+ padding: var(--xh-steps-trigger-p, var(--xh-space-1));
104
+ border: 0;
105
+ border-radius: var(--xh-steps-trigger-radius, var(--xh-shape-control));
106
+ background: transparent;
107
+ color: inherit;
108
+ font: inherit;
109
+ text-align: start;
110
+ cursor: pointer;
111
+ }
112
+
113
+ [data-scope='steps'][data-part='trigger'][hidden] {
114
+ display: none;
115
+ }
116
+
117
+ [data-scope='steps'][data-part='trigger']:hover:not([data-disabled]) {
118
+ background: var(--xh-steps-trigger-bg-hover, var(--xh-bg-subtle-hover));
119
+ }
120
+
121
+ [data-scope='steps'][data-part='trigger']:focus-visible {
122
+ outline: var(--xh-ring-width) solid var(--xh-ring-focus);
123
+ outline-offset: var(--xh-ring-offset);
124
+ }
125
+
126
+ /* 禁用走 aria-disabled 而非原生 disabled:条目仍要可聚焦(它还得当方向键的起点),
127
+ 所以只能挂 data-disabled,写 :disabled 永远不命中 */
128
+ [data-scope='steps'][data-part='trigger'][data-disabled] {
129
+ cursor: not-allowed;
130
+ }
131
+
132
+ [data-scope='steps'][data-part='item'][data-disabled] [data-scope='steps'][data-part='title'],
133
+ [data-scope='steps'][data-part='item'][data-disabled] [data-scope='steps'][data-part='description'] {
134
+ color: var(--xh-fg-disabled);
135
+ }
136
+
137
+ /* 序号圆点:跨两行贴着左侧,未走到时是一圈描边,走过了才填实 */
138
+ [data-scope='steps'][data-part='indicator'] {
139
+ display: inline-flex;
140
+ grid-row: 1 / span 2;
141
+ flex: none;
142
+ align-items: center;
143
+ justify-content: center;
144
+ inline-size: var(--xh-steps-indicator-size, var(--xh-_steps-indicator-size));
145
+ block-size: var(--xh-steps-indicator-size, var(--xh-_steps-indicator-size));
146
+ border: var(--xh-stroke-thin) solid var(--xh-steps-indicator-border, var(--xh-border-strong));
147
+ border-radius: var(--xh-radius-full);
148
+ background: var(--xh-steps-indicator-bg, transparent);
149
+ color: var(--xh-steps-indicator-fg, var(--xh-fg-muted));
150
+ font-size: var(--xh-steps-indicator-font-size, var(--xh-_steps-caption-font-size));
151
+ font-weight: var(--xh-font-weight-medium);
152
+ /* 等宽数字:1 与 7 的字形宽度在比例字体里并不相同,不定住会让序号左右抖一格 */
153
+ font-variant-numeric: tabular-nums;
154
+ line-height: var(--xh-leading-none);
155
+ transition:
156
+ background var(--xh-motion-duration-micro) var(--xh-motion-ease-enter),
157
+ border-color var(--xh-motion-duration-micro) var(--xh-motion-ease-enter),
158
+ color var(--xh-motion-duration-micro) var(--xh-motion-ease-enter);
159
+ }
160
+
161
+ [data-scope='steps'][data-part='indicator'][hidden] {
162
+ display: none;
163
+ }
164
+
165
+ /* 当前步是空心的品牌色描边,走过的那些是实心——两者一眼分得开,
166
+ 光靠"都填成品牌色"会让人看不出自己停在哪儿 */
167
+ [data-scope='steps'][data-part='indicator'][data-state='current'] {
168
+ border-color: var(--xh-steps-indicator-border-current, var(--xh-_steps-accent));
169
+ color: var(--xh-steps-indicator-fg-current, var(--xh-_steps-accent-text));
170
+ }
171
+
172
+ [data-scope='steps'][data-part='indicator'][data-state='completed'] {
173
+ border-color: var(--xh-steps-indicator-border-completed, var(--xh-_steps-accent));
174
+ background: var(--xh-steps-indicator-bg-completed, var(--xh-_steps-accent));
175
+ color: var(--xh-steps-indicator-fg-completed, var(--xh-_steps-on-accent));
176
+ }
177
+
178
+ [data-scope='steps'][data-part='item'][data-disabled] [data-scope='steps'][data-part='indicator'] {
179
+ border-color: var(--xh-fg-disabled);
180
+ color: var(--xh-fg-disabled);
181
+ }
182
+
183
+ /* 标题与说明都在右列:不给 display,网格布局会替它们块级化,
184
+ [hidden] 时 UA 的 display:none 仍然压得住 */
185
+ [data-scope='steps'][data-part='title'] {
186
+ grid-column: 2;
187
+ color: var(--xh-steps-title-fg, var(--xh-fg-muted));
188
+ font-size: var(--xh-steps-title-font-size, var(--xh-_steps-title-font-size));
189
+ font-weight: var(--xh-steps-title-font-weight, var(--xh-text-label-weight));
190
+ line-height: var(--xh-leading-tight);
191
+ overflow: hidden;
192
+ white-space: nowrap;
193
+ text-overflow: ellipsis;
194
+ }
195
+
196
+ [data-scope='steps'][data-part='title']:is([data-state='current'], [data-state='completed']) {
197
+ color: var(--xh-steps-title-fg-active, var(--xh-fg-default));
198
+ }
199
+
200
+ [data-scope='steps'][data-part='description'] {
201
+ grid-column: 2;
202
+ color: var(--xh-steps-description-fg, var(--xh-fg-subtle));
203
+ font-size: var(--xh-steps-description-font-size, var(--xh-_steps-caption-font-size));
204
+ line-height: var(--xh-leading-tight);
205
+ overflow: hidden;
206
+ white-space: nowrap;
207
+ text-overflow: ellipsis;
208
+ }
209
+
210
+ /* 连接线属于它前面那一步:那一步走过了就整条点亮,进度因此是连续的一条线 */
211
+ [data-scope='steps'][data-part='separator'] {
212
+ flex: 1;
213
+ min-inline-size: var(--xh-steps-separator-min-length, var(--xh-space-4));
214
+ block-size: var(--xh-steps-separator-thickness, var(--xh-stroke-thick));
215
+ border-radius: var(--xh-radius-full);
216
+ background: var(--xh-steps-separator-bg, var(--xh-border-default));
217
+ transition: background var(--xh-motion-duration-micro) var(--xh-motion-ease-enter);
218
+ }
219
+
220
+ [data-scope='steps'][data-part='separator'][hidden] {
221
+ display: none;
222
+ }
223
+
224
+ [data-scope='steps'][data-part='separator'][data-state='completed'] {
225
+ background: var(--xh-steps-separator-bg-completed, var(--xh-_steps-accent));
226
+ }
227
+
228
+ /* 纵向时连接线转成竖的一条,缩进到与序号圆点同一条竖线上 */
229
+ [data-scope='steps'][data-part='separator'][data-orientation='vertical'] {
230
+ flex: none;
231
+ inline-size: var(--xh-steps-separator-thickness, var(--xh-stroke-thick));
232
+ block-size: var(--xh-steps-separator-min-length, var(--xh-space-4));
233
+ /* 圆点半径减去线宽的一半:calc 里的除法要写成乘 0.5,除号在这儿是无效语法 */
234
+ margin-inline-start: calc(
235
+ var(--xh-steps-indicator-size, var(--xh-_steps-indicator-size)) * 0.5
236
+ + var(--xh-steps-trigger-p, var(--xh-space-1))
237
+ - var(--xh-steps-separator-thickness, var(--xh-stroke-thick)) * 0.5
238
+ );
239
+ }
240
+
241
+ /* 面板刻意不给 display:连接层用 hidden 收起,UA 的 [hidden]{display:none} 压得住,
242
+ 不必再拿内联样式去盖 */
243
+ [data-scope='steps'][data-part='content'] {
244
+ padding-block: var(--xh-steps-content-py, var(--xh-stack-gap-md));
245
+ color: var(--xh-steps-content-fg, var(--xh-fg-default));
246
+ }
247
+
248
+ [data-scope='steps'][data-part='content']:focus-visible {
249
+ outline: var(--xh-ring-width) solid var(--xh-ring-focus);
250
+ outline-offset: var(--xh-ring-offset);
251
+ }
252
+ }
package/css/switch.css ADDED
@@ -0,0 +1,61 @@
1
+ @layer xihan.components {
2
+ [data-scope='switch'][data-part='root'] {
3
+ /* 尺寸档只换轨道高度这一个私有槽,其余几何都从它算出来:
4
+ 滑块边长 = 轨道高 − 两条留白,轨道宽 = 两倍轨道高 − 两条留白,滑块行程因此正好等于自身边长 */
5
+ --xh-_switch-track-h: var(--xh-font-size-2xl);
6
+ --xh-_switch-pad: 2px;
7
+ --xh-_switch-thumb-size: calc(var(--xh-_switch-track-h) - var(--xh-_switch-pad) * 2);
8
+
9
+ /* 选中态轨道色随语气走。没写 data-tone 时 --xh-_tone 没被声明,退回原来的品牌色 */
10
+ --xh-_switch-accent: var(--xh-_tone, var(--xh-bg-brand));
11
+
12
+ position: relative;
13
+ display: inline-flex;
14
+ align-items: center;
15
+ inline-size: calc(var(--xh-_switch-track-h) * 2 - var(--xh-_switch-pad) * 2);
16
+ block-size: var(--xh-_switch-track-h);
17
+ padding: var(--xh-_switch-pad);
18
+ border: 0;
19
+ border-radius: var(--xh-shape-pill);
20
+ background: var(--xh-switch-bg, var(--xh-bg-subtle-active));
21
+ cursor: pointer;
22
+ transition: background var(--xh-motion-duration-micro) var(--xh-motion-ease-enter);
23
+ }
24
+
25
+ [data-scope='switch'][data-part='root'][data-state='checked'] {
26
+ background: var(--xh-switch-bg-checked, var(--xh-_switch-accent));
27
+ }
28
+
29
+ [data-scope='switch'][data-part='root'][data-disabled] {
30
+ cursor: not-allowed;
31
+ opacity: var(--xh-state-disabled-opacity);
32
+ }
33
+
34
+ [data-scope='switch'][data-part='root']:focus-visible {
35
+ outline: var(--xh-ring-width) solid var(--xh-ring-focus);
36
+ outline-offset: var(--xh-ring-offset);
37
+ }
38
+
39
+ /* —— 尺寸 —— */
40
+ /* 缺省档写在上面的基础规则里 */
41
+ [data-scope='switch'][data-part='root'][data-size='sm'] {
42
+ --xh-_switch-track-h: var(--xh-font-size-xl);
43
+ }
44
+
45
+ [data-scope='switch'][data-part='root'][data-size='lg'] {
46
+ --xh-_switch-track-h: var(--xh-font-size-3xl);
47
+ }
48
+
49
+ [data-scope='switch'][data-part='thumb'] {
50
+ inline-size: var(--xh-_switch-thumb-size);
51
+ block-size: var(--xh-_switch-thumb-size);
52
+ border-radius: var(--xh-shape-pill);
53
+ background: var(--xh-switch-thumb, var(--xh-bg-canvas));
54
+ box-shadow: var(--xh-elevation-1);
55
+ transition: translate var(--xh-motion-duration-micro) var(--xh-motion-ease-enter);
56
+ }
57
+
58
+ [data-scope='switch'][data-part='thumb'][data-state='checked'] {
59
+ translate: var(--xh-_switch-thumb-size) 0;
60
+ }
61
+ }