@manohub/ui 1.1.5 → 1.2.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 (38) hide show
  1. package/dist/components/button/index.d.ts +12 -12
  2. package/dist/components/capsule/index.d.ts +1 -1
  3. package/dist/components/code-block/index.d.ts +5 -5
  4. package/dist/components/date-picker/date-panel.d.ts +1 -1
  5. package/dist/components/date-picker/index.d.ts +6 -6
  6. package/dist/components/dialog/index.d.ts +2 -12
  7. package/dist/components/dialog/index.js +8 -7
  8. package/dist/components/drawer/index.js +7 -1
  9. package/dist/components/filter/index.d.ts +2 -2
  10. package/dist/components/form/index.d.ts +4 -4
  11. package/dist/components/input/index.d.ts +10 -10
  12. package/dist/components/input/number-input.d.ts +2 -2
  13. package/dist/components/list/list.d.ts +1 -1
  14. package/dist/components/list/tree.d.ts +1 -1
  15. package/dist/components/list-view/index.d.ts +2 -2
  16. package/dist/components/notice/index.d.ts +2 -2
  17. package/dist/components/notification/index.d.ts +1 -1
  18. package/dist/components/page/index.d.ts +2 -4
  19. package/dist/components/page/index.js +9 -2
  20. package/dist/components/panel/index.d.ts +2 -2
  21. package/dist/components/panel/index.js +10 -3
  22. package/dist/components/query-state/index.d.ts +1 -3
  23. package/dist/components/radio/index.d.ts +7 -7
  24. package/dist/components/scrollbar/index.d.ts +50 -0
  25. package/dist/components/scrollbar/index.js +187 -0
  26. package/dist/components/select/select-list.d.ts +1 -3
  27. package/dist/components/tabbar/index.d.ts +1 -1
  28. package/dist/components/table/index.js +10 -3
  29. package/dist/components/tabs/index.d.ts +3 -3
  30. package/dist/components/toast/index.d.ts +4 -4
  31. package/dist/styles/components/dialog.css +21 -6
  32. package/dist/styles/components/drawer.css +18 -5
  33. package/dist/styles/components/page.css +20 -3
  34. package/dist/styles/components/panel.css +17 -0
  35. package/dist/styles/components/scrollbar.css +63 -0
  36. package/dist/styles/components/table.css +33 -4
  37. package/dist/styles/index.css +1 -0
  38. package/package.json +2 -2
@@ -46,11 +46,28 @@
46
46
  min-width: 0;
47
47
  }
48
48
 
49
+ /* 内容区:**定位父**(浮层滚动条的宿主),自己不滚 —— 滚动交给里面的 `.mh-panel__scroll`。
50
+ 为什么要两层:浮层是 `position: absolute` 的兄弟节点,挂在滚动盒自己身上会跟着内容滚走(Table 满高档同款结构)。
51
+ 内距(`padding` prop)**落在滚动盒上**(见下条):原生滚动条的可视范围本来就含内距,
52
+ 拇指长度要按同一口径算才与原生一致;Body 因此只做定位父,不吃内距。 */
49
53
  .mh-panel__body {
54
+ position: relative;
50
55
  flex: 1;
51
56
  min-height: 0;
52
57
  min-width: 0;
58
+ overflow: hidden;
59
+ }
60
+
61
+ /* 区域内唯一的滚动盒:原生条两轴归零(白缝成因见 `scrollbar.css` 头),拇指由浮层画。
62
+ 内距下发在这一层(`PanelBody` 的 `padding` prop → 行内 style):滚动条轨道与可视范围因此同一口径 */
63
+ .mh-panel__scroll {
64
+ height: 100%;
53
65
  overflow: auto;
66
+ scrollbar-width: none;
67
+ }
68
+ .mh-panel__scroll::-webkit-scrollbar {
69
+ width: 0;
70
+ height: 0;
54
71
  }
55
72
 
56
73
  /* 面板页脚:区域内**常驻**控件(本区域表格的分页条等),不随内容滚动。
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Scrollbar —— **浮层滚动条的面**(跨件原语,配 `components/scrollbar/` 的 `useOverlayScrollbar`)。
3
+ *
4
+ * 三件事由本文件定死:拇指多大 / 离框多远 / 什么时候显。
5
+ * 消费方(`Table` 满高档、`Panel.Body`)只负责两件:滚动盒把原生条归零、把 `render()` 的输出放进定位父。
6
+ *
7
+ * 为什么不用原生条(出处见组件头):`scrollbar-gutter: stable` 会给任何滚动容器**永久**预留一条槽,
8
+ * 槽里没人上色 ⇒ 内容的分隔线在槽左缘截断成一条贯穿到底的白缝;改回 `auto` 又会在滚动条出入时整块缩 6px。
9
+ * 归零之后 `offsetWidth - clientWidth` 恒等于 0,两个毛病一起消失 —— 代价是拇指得自己画。
10
+ *
11
+ * ⚠️ 6px / 2px / 24px 是**面内字面量**,不新开 `--ui-scrollbar-*` 令牌:6px 与 `kit/index.css` 的滚动条皮肤
12
+ * 同值(那里同样登记了「等设计给值再开槽位」),2px 是微内缩、24px 是拇指下限 —— 都属于「没人会去改的值」。
13
+ */
14
+
15
+ /* 浮层定位盒:铺满**定位父**(滚动盒的兄弟),自己不吃指针 —— 轨道点击翻页明确不做(见组件头第 3 条)。 */
16
+ .mh-scrollbar {
17
+ position: absolute;
18
+ inset: 2px; /* 离外框 2px:视觉上是「浮在帧内」而不是「镶在框上」 */
19
+ z-index: 2; /* 压过固定列一类 sticky 内容(它们用 z-index: 1);加载罩另给更高一档 */
20
+ pointer-events: none;
21
+ }
22
+
23
+ .mh-scrollbar__thumb {
24
+ position: absolute;
25
+ background: var(--ui-base-400);
26
+ border-radius: var(--ui-radius-full);
27
+ opacity: 0; /* 静止不显:浮层不该常驻挡内容 */
28
+ transition: opacity 0.2s ease, background-color 0.15s ease;
29
+ pointer-events: none;
30
+ touch-action: none; /* 触屏上拖拇指才不会被当成滚动手势 */
31
+ }
32
+
33
+ /* 显形档:组件在「滚动 / 指针进入」时挂 `is-visible`,停手 800ms 后摘掉(淡出即上面那 0.2s) */
34
+ .mh-scrollbar.is-visible .mh-scrollbar__thumb {
35
+ opacity: 1;
36
+ pointer-events: auto;
37
+ cursor: grab;
38
+ }
39
+
40
+ /* 悬停 / 拖动提一档深浅:`--ui-base-400`(比线色深、比字色浅的中性档)→ `--ui-base-content-subtle` */
41
+ .mh-scrollbar__thumb:hover,
42
+ .mh-scrollbar.is-dragging .mh-scrollbar__thumb {
43
+ background: var(--ui-base-content-subtle);
44
+ }
45
+ .mh-scrollbar.is-dragging .mh-scrollbar__thumb {
46
+ cursor: grabbing;
47
+ }
48
+
49
+ /* 竖轴:贴右缘;`height` 与 `translateY` 由组件逐帧下发(轨道长取本盒的 clientHeight) */
50
+ .mh-scrollbar__thumb--y {
51
+ top: 0;
52
+ right: 0;
53
+ width: 6px;
54
+ min-height: 24px; /* 行数极多时也抓得住(与组件里的 SCROLLBAR_MIN 同值) */
55
+ }
56
+
57
+ /* 横轴:贴下缘。会压住内容最后一行右侧 6px —— 与「不做轨道点击」同一取舍:浮层不占内容空间 */
58
+ .mh-scrollbar__thumb--x {
59
+ left: 0;
60
+ bottom: 0;
61
+ height: 6px;
62
+ min-width: 24px;
63
+ }
@@ -10,7 +10,7 @@
10
10
  * ⚠️ **单元格左右内距保持 16(`--ui-space-4`)**:设计稿可量的只有「勾选框距表左 20」,而它量的是**内容盒**
11
11
  * (勾选列 40 宽 + 居中时内容盒落在 13 处),无法唯一反推内距,故不作推测性改动。
12
12
  *
13
- * 四条必须照做的**结构**决定(做错就与规范不是一回事):
13
+ * 五条必须照做的**结构**决定(做错就与规范不是一回事):
14
14
  * 1. **边框模型**:默认是外框 + 表头下分割线 + 每行底线(末行去线)⇒ `border-collapse: separate` +
15
15
  * `border-spacing: 0`(圆角只在 separate 下渲染得出来);`--borderless` 才切回 `collapse` 并去外框。
16
16
  * **三条线之外的边一律显式清零**(`border: 0` 写在 `th` / `td` / `tr` 上,不是冗余):特异性只在**同一
@@ -23,12 +23,18 @@
23
23
  * 勾选列内**:不限列时功能列里任何「内部本来就是 checkbox」的件都会命中 —— `Switch` 内部正是
24
24
  * `<input type="checkbox">`,于是「启用」这类**功能值**会把整行点亮。
25
25
  * 4. **固定列必须自带底**(`background: var(--ui-base-100)`):它是 sticky 的,不遮挡就会被滚过的单元格透出。
26
+ * 5. **滚动条是自绘浮层,不用原生条**:原生条要么常驻槽留白缝、要么出入时改列宽;归零后两轴都不占位、
27
+ * 表头不用补偿。拇指本身是**跨件原语**(`scrollbar.css` + `useOverlayScrollbar`,Panel.Body 也在用),
28
+ * 本件只提供定位父 `.mh-table__body` 与归零的滚动盒。
26
29
  *
27
30
  * **不做**:排序与列宽拖拽的**算法**(规范只给 `↕` 字形与 3×40 拖拽线两处视觉),也不做空态 / 加载态
28
31
  * (三态归 `QueryState`)。
29
32
  */
33
+ /* 包裹层:**定位父**(两档共用)—— 浮层滚动条必须挂在滚动盒的兄弟节点上,不能挂在滚动盒自己身上
34
+ (`position: absolute` 的兄弟才不随内容滚走)。2026-10-19 起非满高也走「定位父 + 滚动盒」两层,
35
+ 与满高档结构完全一致;本层因此不再滚。 */
30
36
  .mh-table-wrapper {
31
- overflow: auto;
37
+ overflow: hidden;
32
38
  }
33
39
  /* ===== 满高档(两表结构:表头盒 + 表体滚动盒)=====
34
40
  * 外框从表移交给包裹层(表自己不再画框),**表头不在滚动盒里** —— 表头固定是结构给的,不靠 sticky。 */
@@ -55,18 +61,40 @@
55
61
  flex: 1 1 auto;
56
62
  min-height: 0;
57
63
  }
58
- /* 表体滚动盒:满高档唯一的滚动落点 */
64
+ /* ===== 滚动条:原生条归零(见文件头第 5 条)=====
65
+ * 为什么不用原生条:`scrollbar-gutter: stable` 会给**任何**滚动容器永久预留一条槽,而槽里没人上色
66
+ * ⇒ 表头底 / 行线 / 斑马底 / 选中底全在槽左缘截断,露出一条贯穿到底的白缝(实测 6px,与 `kit/index.css`
67
+ * 的滚动条皮肤同宽)。换成「不预留」(`auto`)则滚动条一出没就整表缩 6px,两表结构下必然错列,只能靠 JS 补。
68
+ * 归零原生条后 `offsetWidth - clientWidth` 恒等于 **0**:白缝没有、列宽不跳、表头补偿也恒为 0(竖轴横轴同一条判据)。
69
+ * 拇指的面与行为在 `scrollbar.css` / `components/scrollbar`(跨件原语)。 */
59
70
  .mh-table-scroll {
60
71
  height: 100%;
61
72
  max-height: var(--ui-table-scroll-height); /* 基础上限;「占满父级」档由下面那条解除 */
62
73
  overflow: auto;
63
- scrollbar-gutter: stable; /* 滚动条槽常驻:表体宽度不随内容长短跳变 */
74
+ scrollbar-width: none; /* FF:整条滚动条归零 */
75
+ }
76
+ .mh-table-scroll::-webkit-scrollbar {
77
+ width: 0;
78
+ height: 0;
64
79
  }
65
80
  /* 满高档:滚动范围由包裹层高度(或调用方给的内联上限)决定 */
66
81
  .mh-table-wrapper--fill > .mh-table__body > .mh-table-scroll {
67
82
  max-height: none;
68
83
  }
69
84
 
85
+ /* 非满高档(`--auto` 一对修饰档):高度链「包裹层 → 表体盒 → 滚动盒」逐层 100%。
86
+ 包裹层**有定高**(消费方给 height / flex 撑起)⇒ 滚动盒拿到确定高度、超出就滚;
87
+ 包裹层**没定高**(缺省,内容撑起)⇒ 百分比对不定高解析成 auto,高度由内容决定、不滚。
88
+ ⚠️ 那 132 的「基础上限」是满高档的兜底,不能套到非满高(会把普通表裁成 132 高)。 */
89
+ .mh-table__body--auto {
90
+ height: 100%;
91
+ }
92
+ .mh-table-scroll--auto {
93
+ max-height: none;
94
+ }
95
+
96
+ /* 浮层滚动条的面在 `scrollbar.css`(跨件原语,Table / Panel 共用):本件只负责把原生条归零 +
97
+ 把 `useOverlayScrollbar` 的输出放进 `.mh-table__body`(定位父)。 */
70
98
  /* 几何只挂在 `<table>` 上:令牌在同名 `.tokens.css`(锚 `[data-manohub-ui]`),几何若跟着挂会给包裹层加边框与圆角 */
71
99
  .mh-table {
72
100
  width: 100%;
@@ -425,6 +453,7 @@
425
453
  .mh-table__loading {
426
454
  position: absolute;
427
455
  inset: 0;
456
+ z-index: 3; /* 压住浮层滚动条(z-index: 2):加载中不该还能看见拇指 */
428
457
  display: flex;
429
458
  align-items: flex-start;
430
459
  justify-content: center;
@@ -83,6 +83,7 @@
83
83
  @import './operations/tabs.css';
84
84
 
85
85
  /* 容器与分区 */
86
+ @import './components/scrollbar.css'; /* 跨件原语(浮层滚动条):被 page / panel / table 消费,先于它们 */
86
87
  @import './components/page.css'; /* 页面级骨架(唯一;区域级是 Panel) */
87
88
  @import './components/panel.css';
88
89
  @import './components/collapse.css'; /* Collapse 的头行皮肤(行为在 operations/collapse.css) */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manohub/ui",
3
- "version": "1.1.5",
3
+ "version": "1.2.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "AIHub 自绘组件层:不依赖 farris 的手写 Vue TSX 组件 + 自带令牌层(Farris 规范视觉 · daisyUI 式语义令牌 · shadcn 式 API 词汇)。",
@@ -35,7 +35,7 @@
35
35
  "vue": "^3.5.0"
36
36
  },
37
37
  "dependencies": {
38
- "@manohub/icon": "^1.1.5"
38
+ "@manohub/icon": "^1.2.0"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/node": "^24.0.0",