@manohub/ui 1.0.4 → 1.0.6
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 +8 -2
- package/dist/components/badge/index.d.ts +24 -46
- package/dist/components/badge/index.js +7 -11
- package/dist/components/button/index.d.ts +11 -31
- package/dist/components/capsule/index.d.ts +13 -27
- package/dist/components/card/index.d.ts +28 -62
- package/dist/components/checkbox/index.d.ts +1 -9
- package/dist/components/code-block/index.d.ts +28 -55
- package/dist/components/collapse/index.d.ts +2 -0
- package/dist/components/dialog/index.d.ts +9 -18
- package/dist/components/dialog/index.js +3 -2
- package/dist/components/divider/index.d.ts +1 -12
- package/dist/components/drawer/index.d.ts +7 -15
- package/dist/components/filter/index.d.ts +27 -69
- package/dist/components/filter/index.js +3 -8
- package/dist/components/form/index.d.ts +86 -218
- package/dist/components/form/index.js +5 -12
- package/dist/components/input/bordered.d.ts +4 -6
- package/dist/components/input/index.d.ts +36 -83
- package/dist/components/input/index.js +6 -11
- package/dist/components/input/number-input.d.ts +11 -23
- package/dist/components/layout/index.d.ts +21 -28
- package/dist/components/layout/index.js +5 -8
- package/dist/components/list-view/index.d.ts +10 -43
- package/dist/components/loading/index.d.ts +8 -19
- package/dist/components/nav/index.d.ts +14 -35
- package/dist/components/nav/index.js +1 -3
- package/dist/components/notice/index.d.ts +13 -33
- package/dist/components/notice/index.js +3 -5
- package/dist/components/notification/index.d.ts +0 -9
- package/dist/components/page/index.d.ts +29 -71
- package/dist/components/page/split-resize.d.ts +9 -18
- package/dist/components/pagination/index.d.ts +1 -5
- package/dist/components/panel/index.d.ts +33 -70
- package/dist/components/panel/index.js +1 -4
- package/dist/components/part-padding.d.ts +5 -13
- package/dist/components/query-state/index.d.ts +8 -32
- package/dist/components/radio/index.d.ts +13 -17
- package/dist/components/search/index.d.ts +12 -32
- package/dist/components/select/index.d.ts +30 -49
- package/dist/components/select/index.js +3 -3
- package/dist/components/select/select-panel.d.ts +23 -35
- package/dist/components/select/select-panel.js +5 -10
- package/dist/components/select/select-shared.d.ts +18 -44
- package/dist/components/select/select-tree.d.ts +11 -16
- package/dist/components/select/select-trigger.d.ts +6 -16
- package/dist/components/select/select-trigger.js +5 -11
- package/dist/components/skeleton/index.d.ts +1 -5
- package/dist/components/steps/index.d.ts +55 -111
- package/dist/components/steps/index.js +8 -16
- package/dist/components/switch/index.d.ts +17 -33
- package/dist/components/switch/index.js +2 -4
- package/dist/components/tabbar/index.d.ts +1 -6
- package/dist/components/table/index.d.ts +20 -72
- package/dist/components/table/index.js +4 -8
- package/dist/components/tabs/index.d.ts +22 -44
- package/dist/components/text/index.d.ts +10 -21
- package/dist/components/toast/index.d.ts +4 -13
- package/dist/components/tooltip/index.d.ts +1 -12
- package/dist/components/tree/index.d.ts +51 -101
- package/dist/components/tree/index.js +17 -33
- package/dist/components/upload/index.d.ts +1 -4
- package/dist/index.d.ts +2 -2
- package/dist/services/base.d.ts +32 -8
- package/dist/services/dialog.d.ts +13 -23
- package/dist/services/dialog.js +2 -0
- package/dist/services/index.d.ts +2 -2
- package/dist/services/loading.d.ts +9 -12
- package/dist/services/loading.js +8 -1
- package/dist/services/toast.d.ts +4 -14
- package/dist/styles/components/avatar.css +5 -7
- package/dist/styles/components/avatar.tokens.css +4 -9
- package/dist/styles/components/badge.css +3 -6
- package/dist/styles/components/badge.tokens.css +5 -17
- package/dist/styles/components/button.css +35 -57
- package/dist/styles/components/button.tokens.css +5 -14
- package/dist/styles/components/capsule.css +13 -20
- package/dist/styles/components/capsule.tokens.css +4 -9
- package/dist/styles/components/card.css +13 -24
- package/dist/styles/components/checkbox.css +11 -15
- package/dist/styles/components/checkbox.tokens.css +4 -9
- package/dist/styles/components/code-block.css +30 -40
- package/dist/styles/components/code-block.tokens.css +7 -20
- package/dist/styles/components/collapse.css +6 -10
- package/dist/styles/components/collapse.tokens.css +4 -9
- package/dist/styles/components/dialog.css +19 -27
- package/dist/styles/components/dialog.tokens.css +9 -9
- package/dist/styles/components/divider.css +9 -14
- package/dist/styles/components/divider.tokens.css +4 -9
- package/dist/styles/components/drawer.css +12 -16
- package/dist/styles/components/drawer.tokens.css +7 -9
- package/dist/styles/components/filter.css +13 -24
- package/dist/styles/components/form.css +77 -149
- package/dist/styles/components/form.tokens.css +9 -6
- package/dist/styles/components/input.css +73 -177
- package/dist/styles/components/input.tokens.css +5 -13
- package/dist/styles/components/layout.css +13 -29
- package/dist/styles/components/loading.css +6 -10
- package/dist/styles/components/loading.tokens.css +4 -9
- package/dist/styles/components/notice.css +3 -1
- package/dist/styles/components/notice.tokens.css +8 -6
- package/dist/styles/components/notification.css +9 -12
- package/dist/styles/components/notification.tokens.css +4 -12
- package/dist/styles/components/page.css +32 -48
- package/dist/styles/components/pagination.css +14 -15
- package/dist/styles/components/pagination.tokens.css +4 -9
- package/dist/styles/components/query-state.css +1 -1
- package/dist/styles/components/query-state.tokens.css +6 -0
- package/dist/styles/components/radio.css +12 -25
- package/dist/styles/components/radio.tokens.css +4 -9
- package/dist/styles/components/search.css +8 -18
- package/dist/styles/components/select.css +63 -109
- package/dist/styles/components/select.tokens.css +4 -12
- package/dist/styles/components/skeleton.css +4 -7
- package/dist/styles/components/skeleton.tokens.css +4 -9
- package/dist/styles/components/steps.css +9 -12
- package/dist/styles/components/steps.tokens.css +4 -12
- package/dist/styles/components/switch.css +7 -8
- package/dist/styles/components/switch.tokens.css +4 -9
- package/dist/styles/components/tabbar.css +12 -11
- package/dist/styles/components/tabbar.tokens.css +4 -9
- package/dist/styles/components/table.css +52 -93
- package/dist/styles/components/table.tokens.css +5 -6
- package/dist/styles/components/tag.css +13 -23
- package/dist/styles/components/tag.tokens.css +5 -11
- package/dist/styles/components/text.css +11 -23
- package/dist/styles/components/toast.css +11 -18
- package/dist/styles/components/toast.tokens.css +6 -9
- package/dist/styles/components/tooltip.css +9 -11
- package/dist/styles/components/tooltip.tokens.css +5 -9
- package/dist/styles/components/tree.css +14 -27
- package/dist/styles/components/tree.tokens.css +5 -6
- package/dist/styles/components/upload.css +10 -13
- package/dist/styles/components/upload.tokens.css +4 -9
- package/dist/styles/index.css +27 -50
- package/dist/styles/operations/collapse.css +12 -25
- package/dist/styles/operations/popup.css +41 -79
- package/dist/styles/operations/tabs.css +14 -32
- package/dist/styles/reset.css +0 -61
- package/package.json +2 -2
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Page
|
|
3
|
-
* -
|
|
4
|
-
*
|
|
5
|
-
* - Body mode="scroll":自身 overflow-y auto(详情页长内容)
|
|
6
|
-
* - Body mode="plain":不滚(默认;滚动归区域内容区 / 内容件自持的定高容器)
|
|
7
|
-
* - Split:自身不滚,栏内滚动由内容承担(双栏内用 Panel 的 Body 滚)
|
|
2
|
+
* Page 页面骨架(滚动归属写死,调用方无法违反):`.mh-page` height 100% / 纵向 flex / 自身不滚,Header /
|
|
3
|
+
* Filter / Footer 一律 `flex-shrink: 0`;Body `mode="scroll"` 自身 `overflow-y: auto`(详情页长内容)、
|
|
4
|
+
* `mode="plain"`(默认)不滚;Split 自身不滚,栏内滚动由内容承担(双栏内用 Panel 的 Body 滚)。
|
|
8
5
|
*
|
|
9
|
-
* 页面级行只有 Filter / Header / Body / Footer
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* 100vh 取 window 视口高度,宿主有顶栏即溢出。
|
|
14
|
-
*
|
|
15
|
-
* 与 panel.css 的分工:本文件是**页面级**(唯一),panel.css 是**区域级**(可多个)。
|
|
6
|
+
* 页面级行只有 Filter / Header / Body / Footer 四条:页头右侧的 `extra` **不是页面级行**,它的容器
|
|
7
|
+
* `.mh-page__header-extra` 就在 Header 内部。
|
|
8
|
+
* 统一 `height: 100%` 语义(**不用 100vh**):子应用被注入宿主容器,100vh 取 window 视口高度、宿主有顶栏即溢出。
|
|
9
|
+
* 与 `panel.css` 的分工:本文件是**页面级**(唯一),`panel.css` 是**区域级**(可多个)。
|
|
16
10
|
*/
|
|
17
11
|
|
|
18
12
|
.mh-page {
|
|
@@ -60,15 +54,11 @@
|
|
|
60
54
|
height: 26px;
|
|
61
55
|
}
|
|
62
56
|
|
|
63
|
-
/* 页头右侧自由位(Header 唯一可自定义位,对应 `extra
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
本盒子的高度就等于内容高度(内容比标题行矮时会短一截),自己画背景 / 分隔线就会露出白边。
|
|
69
|
-
拉满后盒子高 = 内容行高(有副标题时同样跟着变高),内部仍按 `align-items: center` 垂直居中。
|
|
70
|
-
注意:这里只到「内容行」的上下边,页头条上下的 14 / 13px 留白是 .mh-page__header 的 padding,
|
|
71
|
-
在 inner 之外,子项不覆盖它(贴满整条要改版式,不是加一条能解决的)。 */
|
|
57
|
+
/* 页头右侧自由位(Header 唯一可自定义位,对应 `extra`):搜索框 / 按钮 / 下拉等水平排列。`align-self: stretch`
|
|
58
|
+
是关键的一条:父级 `__header-inner` 是 `align-items: flex-end`(右侧位与文本块**底边对齐**的既有口径),而
|
|
59
|
+
flex-end **只定位、不拉伸** —— 少了这条,本盒高度就等于内容高度(比标题行矮时短一截),自己画背景 / 分隔线会露
|
|
60
|
+
白边。拉满后盒高 = 内容行高、内部仍垂直居中;注意这里只到「内容行」的上下边:页头条上下的 14 / 13px 留白是
|
|
61
|
+
`.mh-page__header` 的 padding。 */
|
|
72
62
|
.mh-page__header-extra {
|
|
73
63
|
flex-shrink: 0;
|
|
74
64
|
align-self: stretch;
|
|
@@ -85,13 +75,11 @@
|
|
|
85
75
|
color: var(--ui-base-content);
|
|
86
76
|
}
|
|
87
77
|
|
|
88
|
-
/*
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
只不过右位自身被拉伸占满内容行(见 .mh-page__header-extra 的 align-self: stretch),
|
|
94
|
-
所以有副标题时它跟着变高、内容在盒内垂直居中,不在本项里改。 */
|
|
78
|
+
/* 页头副标题(`subTitle`):标题下一行的次要说明,取 caption 档字号与次要色。间距只用 `margin-top: 4` —— 页头条
|
|
79
|
+
的上下留白由 `.mh-page__header` 的 padding 提供,这里只负责标题行与副标题行的距离,有副标题时条目高度自然变高
|
|
80
|
+
(56 → 80),不再另调 padding(避免「有 / 无副标题」两套页头规格)。文本块与右侧位的**底边对齐**仍归
|
|
81
|
+
`__header-inner` 的 flex-end,右位自身被拉伸占满内容行(见 `__header-extra` 的 `align-self: stretch`),故有
|
|
82
|
+
副标题时它跟着变高、内容在盒内垂直居中,不在本项里改。 */
|
|
95
83
|
.mh-page__header-subtitle {
|
|
96
84
|
margin-top: var(--ui-space-1);
|
|
97
85
|
font-size: var(--ui-font-caption);
|
|
@@ -205,10 +193,9 @@
|
|
|
205
193
|
width: 16px;
|
|
206
194
|
}
|
|
207
195
|
|
|
208
|
-
/* 展开按钮:**占满整条把手**(全高全宽)——
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
与收起按钮共用同一套描边 / 底 / 圆角(尺寸不同是有意的:收起按钮钉在分隔线上,只能是小药丸)。 */
|
|
196
|
+
/* 展开按钮:**占满整条把手**(全高全宽)—— 收起态里它是整块侧栏唯一看得见的东西,所以它自己就是那条「带边框的竖条」,
|
|
197
|
+
不是里面再嵌一个小按钮。盒模型走 border-box:1px 描边要算在 16px 里,否则右侧那条边会被把手的 `overflow: hidden`
|
|
198
|
+
裁掉。与收起按钮共用同一套描边 / 底 / 圆角(尺寸不同是有意的:收起按钮钉在分隔线上,只能是小药丸)。 */
|
|
212
199
|
.mh-page__split-rail-btn {
|
|
213
200
|
box-sizing: border-box;
|
|
214
201
|
display: flex;
|
|
@@ -248,11 +235,10 @@
|
|
|
248
235
|
}
|
|
249
236
|
|
|
250
237
|
/* --- 宽度过渡期间**内容不跟着重排**(收起 / 展开都算)---
|
|
251
|
-
内容按 `--mh-page-split-frozen
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
收起/展开是瞬间跳变,也就无所谓过渡期间的重排。 */
|
|
238
|
+
内容按 `--mh-page-split-frozen`(该侧展开时的宽度,组件在收起那一刻实测后下发)定宽排布,多出来的部分由本盒子的
|
|
239
|
+
`overflow: hidden` 裁掉 —— 观感还是「滑出去 / 滑进来」,但栏内的滚动容器(`Panel.Body`、表格包裹层这些
|
|
240
|
+
`overflow: auto` 的件)不会因宽度被压缩而现出滚动条。取不到值时退回 100%(自适应侧栏的容器宽度不可插值,收起 /
|
|
241
|
+
展开本就是瞬间跳变,也就无所谓过渡期重排)。 */
|
|
256
242
|
.mh-page__split-sidebar > * {
|
|
257
243
|
width: var(--mh-page-split-frozen, 100%);
|
|
258
244
|
}
|
|
@@ -385,11 +371,10 @@
|
|
|
385
371
|
opacity: 1;
|
|
386
372
|
}
|
|
387
373
|
|
|
388
|
-
/* --- 收起按钮:**扁高条**(宽 12 / 高 28
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
(同层叠上下文内只有定位元素的 z-index 参与比较,`auto` 视作 0),否则那条 1px 线会横穿按钮中央。 */
|
|
374
|
+
/* --- 收起按钮:**扁高条**(宽 12 / 高 28,跨在分隔线上);默认不可见也不拦事件。两条位置关系都是踩过的坑:
|
|
375
|
+
① 它比 9px 命中带宽,常驻可点会吞掉栏边内容的点击 ⇒ 默认 `opacity: 0` + `pointer-events: none`;② 高亮线是手柄的
|
|
376
|
+
**伪元素**,而伪元素默认绘制在子元素(本按钮)**之上** ⇒ 必须给按钮 `z-index`(同层叠上下文内只有定位元素的
|
|
377
|
+
z-index 参与比较,`auto` 视作 0),否则那条 1px 线会横穿按钮中央。 */
|
|
393
378
|
.mh-page__split-handle-btn {
|
|
394
379
|
position: absolute;
|
|
395
380
|
top: 50%;
|
|
@@ -426,11 +411,10 @@
|
|
|
426
411
|
pointer-events: auto;
|
|
427
412
|
}
|
|
428
413
|
|
|
429
|
-
/* 显式清掉 `:focus` 态的轮廓:上游 farris 有 `button:focus { outline: -webkit-focus-ring-color auto 5px }
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
注:自绘层零 farris,本包之外的样式链若给全局按钮上过焦点环,本规则同样兜住。 */
|
|
414
|
+
/* 显式清掉 `:focus` 态的轮廓:上游 farris 有 `button:focus { outline: -webkit-focus-ring-color auto 5px }`,特异性
|
|
415
|
+
(0,1,1) 高于本按钮基础态的 (0,1,0) —— 只写基础态 `outline: none` 压不住它,鼠标点击(`:focus-visible` 不匹配)
|
|
416
|
+
就会露出那道 5px 深色环。本规则 (0,2,0) 压过上游;焦点反馈只留给紧随其后的 `:focus-visible`(同特异性、顺序在后
|
|
417
|
+
⇒ 它赢)。注:本包之外的样式链若给全局按钮上过焦点环,本规则同样兜住。 */
|
|
434
418
|
.mh-page__split-handle-btn:focus {
|
|
435
419
|
outline: none;
|
|
436
420
|
}
|
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Pagination —— 分页条(总数文案 + 每页条数 + 页码窗口 + 翻页箭头 + 空态 + 简单档)。
|
|
3
3
|
*
|
|
4
|
-
* 出处:设计稿《MH后台-0911》的分页器(`0:4047`
|
|
5
|
-
* 选中页码底 `#eff5ff`、条数选择器 `0:4092
|
|
6
|
-
*
|
|
7
|
-
* ⚠️ 设计给 **28**、规范给 **26**、改前本件取 32 —— 三者都不同;本轮按设计取 28(规范值登记为偏差)。
|
|
4
|
+
* 出处:设计稿《MH后台-0911》的分页器(`0:4047` 页码项 **28×28 / r6 / 白底 / 边 `#e6e6e6`**、
|
|
5
|
+
* 选中页码底 `#eff5ff`、条数选择器 `0:4092`)与规范(圆角控件档 / 字号 13 / 组间 12 / 页码间 4)。
|
|
6
|
+
* ⚠️ 设计给 28、规范给 26、改前本件取 32 —— 三者都不同;本轮按设计取 28(规范值登记为偏差)。
|
|
8
7
|
*
|
|
9
|
-
* **顺序是一维右对齐流**:`共 N 条,` → `每页 N 条 ▾` → `‹ 1 … 10 11 12 … 50
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* 翻页箭头用**两个字形**(上一页 `chevron-left` / 下一页 `chevron-right`),本层不转向:方位由字形自表达
|
|
18
|
-
* (包内硬约束:不得靠 `transform: rotate()` 把别的图标转成方位,`back` 只作"返回"语义)。条数选择器的
|
|
19
|
-
* 折叠指示走操作层 `.mh-popup-caret`(展开时翻向),与本层同样零自画折线。
|
|
8
|
+
* **顺序是一维右对齐流**:`共 N 条,` → `每页 N 条 ▾` → `‹ 1 … 10 11 12 … 50 ›`;别把总数搬到左侧。
|
|
9
|
+
* **不做跳页输入框**:规范没有「跳至第 N 页」的样张,本仓按「不做规范没演示的」处理。
|
|
10
|
+
* **页码项三源等价**(本仓通例):原生 `:has(> input:checked)` / `[data-state='selected']` /
|
|
11
|
+
* 静态档 `.is-selected` —— 原生态给零 JS 用法,组件态给 v-model。
|
|
12
|
+
* 翻页箭头用**两个字形**(`chevron-left` / `chevron-right`),本层不转向:方位由字形自表达
|
|
13
|
+
* (包内硬约束:不得靠 `transform: rotate()` 把别的图标转成方位)。条数选择器的折叠指示走操作层
|
|
14
|
+
* `.mh-popup-caret`,与本层同样零自画折线。
|
|
20
15
|
*/
|
|
21
16
|
|
|
22
17
|
/* 几何只挂在页码条上:令牌在同名 `.tokens.css`(锚 `[data-manohub-ui]`),几何若跟着挂会把空态也排成右对齐的行 */
|
|
@@ -94,6 +89,8 @@
|
|
|
94
89
|
color: var(--ui-pagination-text);
|
|
95
90
|
cursor: pointer;
|
|
96
91
|
white-space: nowrap;
|
|
92
|
+
/* 定位上下文:隐身 input 的包含块必须落在控件内,否则逃出滚动容器裁剪、撑大文档滚动高度 */
|
|
93
|
+
position: relative;
|
|
97
94
|
}
|
|
98
95
|
.mh-pagination__size-option:hover {
|
|
99
96
|
background: var(--ui-pagination-bg-selected);
|
|
@@ -140,6 +137,8 @@
|
|
|
140
137
|
transition-property: background-color, border-color, color;
|
|
141
138
|
transition-duration: 0.15s;
|
|
142
139
|
transition-timing-function: ease;
|
|
140
|
+
/* 定位上下文:隐身 input 的包含块必须落在控件内,否则逃出滚动容器裁剪、撑大文档滚动高度 */
|
|
141
|
+
position: relative;
|
|
143
142
|
}
|
|
144
143
|
/* 滑过 / 按下:只描边转色(底仍透明,规范如此) */
|
|
145
144
|
.mh-pagination__btn:hover,
|
|
@@ -3,16 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* 本件自己的几何 / 尺寸 / 色彩槽位;只服务本件,故不随主题进 `@manohub/theme`。
|
|
5
5
|
*
|
|
6
|
-
* ## 抽出说明
|
|
7
|
-
* 本文件从面文件里抽出(原先混写在 `pagination.css` 顶部):这些是**基础值**,锚在
|
|
8
|
-
* `[data-manohub-ui]` —— 跨包唯一作用域锚,由入口层无条件写在应用容器上,因此**任何落在
|
|
9
|
-
* 容器里的分件都取得到值**,不再依赖「声明在某个组件根类上」这条脆弱假设
|
|
10
|
-
* (历史症状:跨件消费的 `--ui-*-group-*` 取不到值,组内间距变 0)。
|
|
11
6
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
|
|
7
|
+
* 令牌锚 `[data-manohub-ui]`(容器是每个分件的祖先 ⇒ 落在容器里的分件都取得到值)。
|
|
8
|
+
* ⚠️ `.mh-<件>--<档>` 这类**档位改写**留在面文件的修饰符块里(搬走会让档位失效);
|
|
9
|
+
* 新增组件要登记两处:本文件 + `src/styles/index.css`(见其文件头「五处齐备」)。
|
|
10
|
+
*/
|
|
16
11
|
[data-manohub-ui] {
|
|
17
12
|
/* 空态是**独立根节点**(无数据时不渲染页码区)—— 令牌锚在容器上,它照样取得到 */
|
|
18
13
|
/* 单件令牌 */
|
|
@@ -1,33 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Radio —— 单选族的面:普通单选组(`Radio.Group
|
|
2
|
+
* Radio —— 单选族的面:普通单选组(`Radio.Group`,类根 `.mh-radio*`)+ 卡片式单选组
|
|
3
|
+
* (`Radio.Card`,类根 `.mh-radio-card*`),两形态共用一个文件。
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* **为什么同面**:两者是**同一个件的两种组形态**,共用同一套状态协议(选中 / 禁用 / 键盘焦点)
|
|
8
|
-
* 与同一套「框体 + 圆点」几何,差别只在承载形态;拆成两份必然让同一族的选中 / 禁用语义各自漂。
|
|
9
|
-
* 合一后圆点配方只有一处(面二自绘,与面一的框体同色同档),且 `radio.css` 与
|
|
10
|
-
* `components/radio/` 仍是标准的「一组件一面」(护栏 `contract-class-surface.spec.ts`)。
|
|
11
|
-
*
|
|
12
|
-
* ===== 面一:`Radio`(普通单选组)=====
|
|
13
|
-
*
|
|
14
|
-
* 出处:`@aihub/theme` 的 `playground/components/radio.css` 与其令牌 `src/components/checkbox.css`
|
|
15
|
-
* (框体实测、单选为胶囊、未选边框 Ne04、滑过 Th05、选中主色圆点、禁用 Ne05 + Te07、选项间距 16 / 10)。
|
|
16
|
-
*
|
|
17
|
-
* **与 `Radio.Card` 的判据**:选项只有一行文字(或极短说明)→ 面一;
|
|
18
|
-
* 选项需要标题 + 描述 + 整卡可点(卡片式选择)→ 面二。
|
|
19
|
-
* **与 `Capsule` 的判据**:要「按钮形态的分组」→ `Capsule`(本面不实现按钮档,避免两套平铺控件)。
|
|
20
|
-
*
|
|
21
|
-
* **与复选框同族**:圆点由 `border` 从 1px 补间到圆点档画成(盒定尺,无布局位移),
|
|
22
|
-
* 不走字形 mask —— 这是规范的做法(勾/横杠才需要 mask)。
|
|
5
|
+
* **为什么同面**:两者是**同一个件的两种组形态**,共用同一套状态协议(选中 / 禁用 / 键盘焦点)与同一套
|
|
6
|
+
* 「框体 + 圆点」几何,拆成两份必然让同一族的语义各自漂;且 `radio.css` 与 `components/radio/` 仍是
|
|
7
|
+
* 标准的「一组件一面」(护栏 `contract-class-surface.spec.ts`)。
|
|
23
8
|
*
|
|
9
|
+
* 圆点由 `border` 从 1px 补间到圆点档画成(盒定尺,无布局位移),不走字形 mask —— 勾 / 横杠才需要 mask。
|
|
24
10
|
* **尺寸三档只覆盖令牌**(`--ui-radio-size*` / `--ui-radio-dot*`),几何规则只有一份。
|
|
11
|
+
* **状态三源等价**(本仓通例):原生 `input:checked` / `[data-state]` / 静态档 `.is-*` 同一份声明。
|
|
25
12
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* 边界(有意不做):规范 `radio.css` 里的 `.cell-check`(表格选择列)**不在这里实现** ——
|
|
30
|
-
* 表格选择列归表格族,本面不重复实现(否则会出现两套表格选择列外观)。
|
|
13
|
+
* 判据:选项只有一行文字(或极短说明)→ `.Group`;要标题 + 描述 + 整卡可点 → `.Card`;
|
|
14
|
+
* 要「按钮形态的分组」→ `Capsule`(本面不实现按钮档,避免两套平铺控件)。
|
|
15
|
+
* 边界:规范里的 `.cell-check`(表格选择列)**不在这里实现** —— 那是表格族的活,不重复实现两套外观。
|
|
31
16
|
*/
|
|
32
17
|
.mh-radio {
|
|
33
18
|
display: inline-flex;
|
|
@@ -38,6 +23,8 @@
|
|
|
38
23
|
color: var(--ui-base-content);
|
|
39
24
|
cursor: pointer;
|
|
40
25
|
user-select: none;
|
|
26
|
+
/* 定位上下文:隐身 input 的包含块必须落在开关内,否则逃出滚动容器裁剪、撑大文档滚动高度 */
|
|
27
|
+
position: relative;
|
|
41
28
|
}
|
|
42
29
|
|
|
43
30
|
/* 组容器:横向 16 / 纵向 12 */
|
|
@@ -3,16 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* 本件自己的几何 / 尺寸 / 色彩槽位;只服务本件,故不随主题进 `@manohub/theme`。
|
|
5
5
|
*
|
|
6
|
-
* ## 抽出说明
|
|
7
|
-
* 本文件从面文件里抽出(原先混写在 `radio.css` 顶部):这些是**基础值**,锚在
|
|
8
|
-
* `[data-manohub-ui]` —— 跨包唯一作用域锚,由入口层无条件写在应用容器上,因此**任何落在
|
|
9
|
-
* 容器里的分件都取得到值**,不再依赖「声明在某个组件根类上」这条脆弱假设
|
|
10
|
-
* (历史症状:跨件消费的 `--ui-*-group-*` 取不到值,组内间距变 0)。
|
|
11
6
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
|
|
7
|
+
* 令牌锚 `[data-manohub-ui]`(容器是每个分件的祖先 ⇒ 落在容器里的分件都取得到值)。
|
|
8
|
+
* ⚠️ `.mh-<件>--<档>` 这类**档位改写**留在面文件的修饰符块里(搬走会让档位失效);
|
|
9
|
+
* 新增组件要登记两处:本文件 + `src/styles/index.css`(见其文件头「五处齐备」)。
|
|
10
|
+
*/
|
|
16
11
|
[data-manohub-ui] {
|
|
17
12
|
/* 单件令牌 */
|
|
18
13
|
--ui-radio-size: 16px;
|
|
@@ -1,26 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Search —— 搜索框(输入框 + 可选搜索按钮的**组合件面**)。
|
|
3
3
|
*
|
|
4
|
-
* 本面**只声明「一行里怎么摆」**:输入框那一段的面归 `input.css`(框 / 内距 / 清除位 /
|
|
5
|
-
*
|
|
6
|
-
* 也不重画任何控件的框 —— 两份输入框几何必然在改令牌时漂开。
|
|
4
|
+
* 本面**只声明「一行里怎么摆」**:输入框那一段的面归 `input.css`(框 / 内距 / 清除位 / 聚焦 / 禁用全套复用),搜索按钮
|
|
5
|
+
* 的面归 `button.css`。本件没有自己的几何令牌,也不重画任何控件的框。
|
|
7
6
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* - 搜索按钮 `flex: none`:它永远是「那么大」,宽度让给输入框。
|
|
7
|
+
* 两条摆法:输入框 `flex: 1 1 auto` + `min-width: 0`(必须允许收缩,否则会把同行的搜索按钮挤出容器,窄栏里尤其明显);
|
|
8
|
+
* 搜索按钮 `flex: none`(永远「那么大」,宽度让给输入框)。**按钮是可选的**:不传 `searchText` 时只渲染输入框(框内的
|
|
9
|
+
* 放大镜已占住「搜索」语义,再出一个同字形的图标按钮就是同一个意思画两遍),此时 `__btn` 那条摆法无对象。
|
|
12
10
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* **宽度口径**:整行吃控件的同一对令牌(`--ui-control-width` / `--ui-control-min-width`,见主题
|
|
18
|
-
* 的 spacing.css)—— 消费方在容器上定宽即整行定宽;行内那个输入框是 `Input` 的表壳
|
|
19
|
-
* (`class` 落在壳上,是 input 面的既有契约),它在 `input.css` 里同样吃了这两枚令牌,
|
|
20
|
-
* 故这里按导入顺序(本文件在 `input.css` 之后,见 `styles/index.css`)把它**收回**:
|
|
21
|
-
* 输入框的宽度归这一行,重复吃控件的宽度口径会让「240 的输入框 + 右侧按钮」溢出行宽。
|
|
22
|
-
*
|
|
23
|
-
* **类名与面文件名同根**:`.mh-search*`,一律 `mh-` 前缀。
|
|
11
|
+
* **宽度口径**:整行吃控件那对令牌(`--ui-control-width` / `--ui-control-min-width`)。行内那个输入框是 `Input` 的
|
|
12
|
+
* 表壳、它在 `input.css` 里同样吃了这两枚,故这里按导入顺序(本文件在 `input.css` 之后)把它**收回**:宽度归这一行,
|
|
13
|
+
* 重复吃会让「240 的输入框 + 右侧按钮」溢出。类名与面文件名同根(`.mh-search*`)。
|
|
24
14
|
*/
|
|
25
15
|
.mh-search {
|
|
26
16
|
display: flex;
|