@manohub/ui 0.10.5 → 1.0.1

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 (86) hide show
  1. package/README.md +155 -155
  2. package/dist/components/form/index.js +8 -1
  3. package/dist/components/input/bordered.d.ts +15 -0
  4. package/dist/components/input/bordered.js +8 -0
  5. package/dist/components/input/index.d.ts +82 -31
  6. package/dist/components/input/index.js +16 -6
  7. package/dist/components/input/number-input.d.ts +239 -0
  8. package/dist/components/input/number-input.js +240 -0
  9. package/dist/components/select/index.d.ts +19 -0
  10. package/dist/components/select/index.js +10 -0
  11. package/dist/components/select/select-tree.d.ts +11 -0
  12. package/dist/components/select/select-tree.js +6 -0
  13. package/dist/components/select/select-trigger.d.ts +17 -0
  14. package/dist/components/select/select-trigger.js +9 -0
  15. package/dist/components/table/index.d.ts +85 -10
  16. package/dist/components/table/index.js +38 -9
  17. package/dist/index.d.ts +2 -2
  18. package/dist/index.js +2 -0
  19. package/dist/styles/components/avatar.css +131 -131
  20. package/dist/styles/components/avatar.tokens.css +24 -24
  21. package/dist/styles/components/badge.css +266 -266
  22. package/dist/styles/components/badge.tokens.css +24 -24
  23. package/dist/styles/components/button.css +460 -460
  24. package/dist/styles/components/capsule.css +128 -128
  25. package/dist/styles/components/capsule.tokens.css +27 -27
  26. package/dist/styles/components/card.css +198 -198
  27. package/dist/styles/components/checkbox.css +145 -145
  28. package/dist/styles/components/checkbox.tokens.css +26 -26
  29. package/dist/styles/components/code-block.css +216 -216
  30. package/dist/styles/components/code-block.tokens.css +40 -40
  31. package/dist/styles/components/collapse.css +62 -62
  32. package/dist/styles/components/collapse.tokens.css +20 -20
  33. package/dist/styles/components/dialog.css +158 -158
  34. package/dist/styles/components/dialog.tokens.css +24 -24
  35. package/dist/styles/components/divider.css +75 -75
  36. package/dist/styles/components/divider.tokens.css +22 -22
  37. package/dist/styles/components/drawer.css +143 -143
  38. package/dist/styles/components/drawer.tokens.css +22 -22
  39. package/dist/styles/components/filter.css +29 -29
  40. package/dist/styles/components/form.css +456 -425
  41. package/dist/styles/components/form.tokens.css +19 -15
  42. package/dist/styles/components/input.css +659 -538
  43. package/dist/styles/components/input.tokens.css +43 -43
  44. package/dist/styles/components/layout.css +200 -200
  45. package/dist/styles/components/list-view.css +244 -244
  46. package/dist/styles/components/loading.css +76 -76
  47. package/dist/styles/components/loading.tokens.css +23 -23
  48. package/dist/styles/components/nav.css +48 -48
  49. package/dist/styles/components/notice.css +153 -153
  50. package/dist/styles/components/notice.tokens.css +17 -17
  51. package/dist/styles/components/notification.css +159 -159
  52. package/dist/styles/components/notification.tokens.css +37 -37
  53. package/dist/styles/components/page.css +473 -473
  54. package/dist/styles/components/pagination.css +303 -303
  55. package/dist/styles/components/pagination.tokens.css +32 -32
  56. package/dist/styles/components/panel.css +77 -77
  57. package/dist/styles/components/query-state.css +88 -88
  58. package/dist/styles/components/radio.css +271 -271
  59. package/dist/styles/components/radio.tokens.css +26 -26
  60. package/dist/styles/components/search.css +34 -34
  61. package/dist/styles/components/select.css +326 -326
  62. package/dist/styles/components/select.tokens.css +44 -44
  63. package/dist/styles/components/skeleton.css +60 -60
  64. package/dist/styles/components/skeleton.tokens.css +27 -27
  65. package/dist/styles/components/steps.css +205 -205
  66. package/dist/styles/components/steps.tokens.css +44 -44
  67. package/dist/styles/components/switch.css +165 -165
  68. package/dist/styles/components/switch.tokens.css +26 -26
  69. package/dist/styles/components/tabbar.css +235 -235
  70. package/dist/styles/components/tabbar.tokens.css +30 -30
  71. package/dist/styles/components/table.css +510 -504
  72. package/dist/styles/components/table.tokens.css +44 -44
  73. package/dist/styles/components/tag.css +127 -127
  74. package/dist/styles/components/tag.tokens.css +24 -24
  75. package/dist/styles/components/toast.css +185 -185
  76. package/dist/styles/components/toast.tokens.css +26 -26
  77. package/dist/styles/components/tooltip.css +89 -89
  78. package/dist/styles/components/tooltip.tokens.css +25 -25
  79. package/dist/styles/components/tree.css +173 -173
  80. package/dist/styles/components/upload.css +151 -151
  81. package/dist/styles/components/upload.tokens.css +27 -27
  82. package/dist/styles/index.css +153 -153
  83. package/dist/styles/operations/collapse.css +84 -84
  84. package/dist/styles/operations/popup.css +193 -193
  85. package/dist/styles/operations/tabs.css +82 -82
  86. package/package.json +62 -62
@@ -1,165 +1,165 @@
1
- /**
2
- * Switch —— 开关(两档尺寸:表格档 36×18 / 表单档 50×24)。
3
- *
4
- * 出处:`@aihub/theme` 的 `playground/components/switch.css` 与 `src/components/switch.css`
5
- * (轨道 36×18、滑块 14、内距 2;表单档 50×24、滑块 18、内距 3;未选中底 Ne04、选中主色;
6
- * 文字与轨道间距 10;禁用整体降透明 0.5)。
7
- *
8
- * **结构固定**:`input` →(可选)`__label` → `__track > __knob` —— 轨道用**通用兄弟** `~` 命中,
9
- * 因为文字可以夹在开关与轨道之间(规范的结构如此),用相邻兄弟 `+` 会漏。
10
- *
11
- * 状态三源等价:原生 `input:checked`(零 JS)/ 组件下发 `[data-state='checked']` / 静态档 `.is-checked`。
12
- *
13
- * **焦点环画在可见轨道上**(隐身开关没有可见焦点),外扩 2px —— 轨道自身无边框,内缩会吃掉滑块。
14
- */
15
- .mh-switch {
16
- display: inline-flex;
17
- align-items: center;
18
- gap: var(--ui-switch-label-gap);
19
- cursor: pointer;
20
- }
21
- /* 隐身开关(1px 盒 + clip-path + appearance:none,与 checkbox / radio 同配方):
22
- 不用 display:none / visibility:hidden —— 那会把键盘与读屏一起关掉。 */
23
- .mh-switch__input {
24
- position: absolute;
25
- width: 1px;
26
- height: 1px;
27
- margin: -1px;
28
- padding: 0;
29
- border: 0;
30
- overflow: hidden;
31
- white-space: nowrap;
32
- clip-path: inset(50%);
33
- appearance: none;
34
- pointer-events: none;
35
- }
36
- .mh-switch__label {
37
- font-size: var(--ui-font-caption);
38
- line-height: var(--ui-line-caption);
39
- color: var(--ui-base-content);
40
- }
41
- .mh-switch__track {
42
- position: relative;
43
- flex: none;
44
- width: var(--ui-switch-track-w);
45
- height: var(--ui-switch-track-h);
46
- border-radius: var(--ui-radius-full);
47
- background: var(--ui-switch-off-bg);
48
- transition: background-color 0.15s ease;
49
- }
50
- .mh-switch__knob {
51
- position: absolute;
52
- top: var(--ui-switch-inset);
53
- left: var(--ui-switch-inset);
54
- width: var(--ui-switch-knob);
55
- height: var(--ui-switch-knob);
56
- border-radius: var(--ui-radius-full);
57
- background: var(--ui-base-100);
58
- box-shadow: var(--ui-shadow-card);
59
- transition: transform 0.15s ease;
60
- }
61
-
62
- /* 选中:三源等价(滑动量 = 轨道宽 − 滑块 − 2×内距,不写死数值) */
63
- .mh-switch.is-checked .mh-switch__track,
64
- .mh-switch[data-state='checked'] .mh-switch__track,
65
- .mh-switch > .mh-switch__input:checked ~ .mh-switch__track {
66
- background: var(--ui-switch-on-bg);
67
- }
68
- .mh-switch.is-checked .mh-switch__knob,
69
- .mh-switch[data-state='checked'] .mh-switch__knob,
70
- .mh-switch > .mh-switch__input:checked ~ .mh-switch__track .mh-switch__knob {
71
- transform: translateX(
72
- calc(var(--ui-switch-track-w) - var(--ui-switch-knob) - 2 * var(--ui-switch-inset))
73
- );
74
- }
75
-
76
- /* 键盘焦点环画在轨道上(外扩 2px) */
77
- .mh-switch > .mh-switch__input:focus-visible ~ .mh-switch__track {
78
- outline: 2px solid var(--ui-primary);
79
- outline-offset: 2px;
80
- }
81
-
82
- /* 禁用:整行不可点 + 整体降透明(原生 disabled 与静态档同款) */
83
- .mh-switch.is-disabled,
84
- .mh-switch:has(.mh-switch__input:disabled) {
85
- opacity: var(--ui-switch-disabled-opacity);
86
- cursor: not-allowed;
87
- }
88
-
89
- /* ===== 尺寸档:sm 28×14 / lg 50×24(只覆盖令牌,不重写几何) ===== */
90
- .mh-switch--sm {
91
- --ui-switch-track-w: 28px;
92
- --ui-switch-track-h: 14px;
93
- --ui-switch-knob: 10px;
94
- --ui-switch-inset: 2px;
95
- }
96
- .mh-switch--form,
97
- .mh-switch--lg {
98
- --ui-switch-track-w: 50px;
99
- --ui-switch-track-h: 24px;
100
- --ui-switch-knob: 18px;
101
- --ui-switch-inset: 3px;
102
- }
103
-
104
- /* ===== 文字位置:用 flex `order` 翻转,不做 DOM 重排 =====
105
- * 换 DOM 顺序会让上面那条 `input:checked ~ track` 兄弟规则立刻失效。 */
106
- .mh-switch--label-right > .mh-switch__label {
107
- order: 1;
108
- }
109
-
110
- /* ===== 轨道内文案(iOS 式:选中时靠左让出滑块,未选中时靠右) ===== */
111
- .mh-switch--with-text {
112
- --ui-switch-track-w: 46px;
113
- }
114
- .mh-switch--sm.mh-switch--with-text {
115
- --ui-switch-track-w: 38px;
116
- }
117
- .mh-switch--lg.mh-switch--with-text {
118
- --ui-switch-track-w: 56px;
119
- }
120
- .mh-switch__track-text {
121
- position: absolute;
122
- top: 0;
123
- bottom: 0;
124
- display: flex;
125
- align-items: center;
126
- font-size: 11px;
127
- line-height: 1;
128
- color: var(--ui-base-100);
129
- white-space: nowrap;
130
- pointer-events: none;
131
- }
132
- .mh-switch.is-checked .mh-switch__track-text,
133
- .mh-switch[data-state='checked'] .mh-switch__track-text,
134
- .mh-switch > .mh-switch__input:checked ~ .mh-switch__track .mh-switch__track-text {
135
- left: calc(var(--ui-switch-inset) + 2px);
136
- right: calc(var(--ui-switch-knob) + 2 * var(--ui-switch-inset));
137
- justify-content: flex-start;
138
- }
139
- .mh-switch:not(.is-checked) .mh-switch__track-text {
140
- left: calc(var(--ui-switch-knob) + 2 * var(--ui-switch-inset));
141
- right: calc(var(--ui-switch-inset) + 2px);
142
- justify-content: flex-end;
143
- }
144
-
145
- /* ===== 加载:轨道内转圈(同时置原生 disabled,真正吞掉点击) ===== */
146
- .mh-switch__spinner {
147
- position: absolute;
148
- top: 50%;
149
- left: 50%;
150
- width: 10px;
151
- height: 10px;
152
- margin: -5px 0 0 -5px;
153
- border: 1.5px solid var(--ui-base-100);
154
- border-top-color: transparent;
155
- border-radius: var(--ui-radius-full);
156
- animation: mh-switch-spin 0.8s linear infinite;
157
- }
158
- @keyframes mh-switch-spin {
159
- to {
160
- transform: rotate(360deg);
161
- }
162
- }
163
- .mh-switch.is-loading {
164
- cursor: progress;
165
- }
1
+ /**
2
+ * Switch —— 开关(两档尺寸:表格档 36×18 / 表单档 50×24)。
3
+ *
4
+ * 出处:`@aihub/theme` 的 `playground/components/switch.css` 与 `src/components/switch.css`
5
+ * (轨道 36×18、滑块 14、内距 2;表单档 50×24、滑块 18、内距 3;未选中底 Ne04、选中主色;
6
+ * 文字与轨道间距 10;禁用整体降透明 0.5)。
7
+ *
8
+ * **结构固定**:`input` →(可选)`__label` → `__track > __knob` —— 轨道用**通用兄弟** `~` 命中,
9
+ * 因为文字可以夹在开关与轨道之间(规范的结构如此),用相邻兄弟 `+` 会漏。
10
+ *
11
+ * 状态三源等价:原生 `input:checked`(零 JS)/ 组件下发 `[data-state='checked']` / 静态档 `.is-checked`。
12
+ *
13
+ * **焦点环画在可见轨道上**(隐身开关没有可见焦点),外扩 2px —— 轨道自身无边框,内缩会吃掉滑块。
14
+ */
15
+ .mh-switch {
16
+ display: inline-flex;
17
+ align-items: center;
18
+ gap: var(--ui-switch-label-gap);
19
+ cursor: pointer;
20
+ }
21
+ /* 隐身开关(1px 盒 + clip-path + appearance:none,与 checkbox / radio 同配方):
22
+ 不用 display:none / visibility:hidden —— 那会把键盘与读屏一起关掉。 */
23
+ .mh-switch__input {
24
+ position: absolute;
25
+ width: 1px;
26
+ height: 1px;
27
+ margin: -1px;
28
+ padding: 0;
29
+ border: 0;
30
+ overflow: hidden;
31
+ white-space: nowrap;
32
+ clip-path: inset(50%);
33
+ appearance: none;
34
+ pointer-events: none;
35
+ }
36
+ .mh-switch__label {
37
+ font-size: var(--ui-font-caption);
38
+ line-height: var(--ui-line-caption);
39
+ color: var(--ui-base-content);
40
+ }
41
+ .mh-switch__track {
42
+ position: relative;
43
+ flex: none;
44
+ width: var(--ui-switch-track-w);
45
+ height: var(--ui-switch-track-h);
46
+ border-radius: var(--ui-radius-full);
47
+ background: var(--ui-switch-off-bg);
48
+ transition: background-color 0.15s ease;
49
+ }
50
+ .mh-switch__knob {
51
+ position: absolute;
52
+ top: var(--ui-switch-inset);
53
+ left: var(--ui-switch-inset);
54
+ width: var(--ui-switch-knob);
55
+ height: var(--ui-switch-knob);
56
+ border-radius: var(--ui-radius-full);
57
+ background: var(--ui-base-100);
58
+ box-shadow: var(--ui-shadow-card);
59
+ transition: transform 0.15s ease;
60
+ }
61
+
62
+ /* 选中:三源等价(滑动量 = 轨道宽 − 滑块 − 2×内距,不写死数值) */
63
+ .mh-switch.is-checked .mh-switch__track,
64
+ .mh-switch[data-state='checked'] .mh-switch__track,
65
+ .mh-switch > .mh-switch__input:checked ~ .mh-switch__track {
66
+ background: var(--ui-switch-on-bg);
67
+ }
68
+ .mh-switch.is-checked .mh-switch__knob,
69
+ .mh-switch[data-state='checked'] .mh-switch__knob,
70
+ .mh-switch > .mh-switch__input:checked ~ .mh-switch__track .mh-switch__knob {
71
+ transform: translateX(
72
+ calc(var(--ui-switch-track-w) - var(--ui-switch-knob) - 2 * var(--ui-switch-inset))
73
+ );
74
+ }
75
+
76
+ /* 键盘焦点环画在轨道上(外扩 2px) */
77
+ .mh-switch > .mh-switch__input:focus-visible ~ .mh-switch__track {
78
+ outline: 2px solid var(--ui-primary);
79
+ outline-offset: 2px;
80
+ }
81
+
82
+ /* 禁用:整行不可点 + 整体降透明(原生 disabled 与静态档同款) */
83
+ .mh-switch.is-disabled,
84
+ .mh-switch:has(.mh-switch__input:disabled) {
85
+ opacity: var(--ui-switch-disabled-opacity);
86
+ cursor: not-allowed;
87
+ }
88
+
89
+ /* ===== 尺寸档:sm 28×14 / lg 50×24(只覆盖令牌,不重写几何) ===== */
90
+ .mh-switch--sm {
91
+ --ui-switch-track-w: 28px;
92
+ --ui-switch-track-h: 14px;
93
+ --ui-switch-knob: 10px;
94
+ --ui-switch-inset: 2px;
95
+ }
96
+ .mh-switch--form,
97
+ .mh-switch--lg {
98
+ --ui-switch-track-w: 50px;
99
+ --ui-switch-track-h: 24px;
100
+ --ui-switch-knob: 18px;
101
+ --ui-switch-inset: 3px;
102
+ }
103
+
104
+ /* ===== 文字位置:用 flex `order` 翻转,不做 DOM 重排 =====
105
+ * 换 DOM 顺序会让上面那条 `input:checked ~ track` 兄弟规则立刻失效。 */
106
+ .mh-switch--label-right > .mh-switch__label {
107
+ order: 1;
108
+ }
109
+
110
+ /* ===== 轨道内文案(iOS 式:选中时靠左让出滑块,未选中时靠右) ===== */
111
+ .mh-switch--with-text {
112
+ --ui-switch-track-w: 46px;
113
+ }
114
+ .mh-switch--sm.mh-switch--with-text {
115
+ --ui-switch-track-w: 38px;
116
+ }
117
+ .mh-switch--lg.mh-switch--with-text {
118
+ --ui-switch-track-w: 56px;
119
+ }
120
+ .mh-switch__track-text {
121
+ position: absolute;
122
+ top: 0;
123
+ bottom: 0;
124
+ display: flex;
125
+ align-items: center;
126
+ font-size: 11px;
127
+ line-height: 1;
128
+ color: var(--ui-base-100);
129
+ white-space: nowrap;
130
+ pointer-events: none;
131
+ }
132
+ .mh-switch.is-checked .mh-switch__track-text,
133
+ .mh-switch[data-state='checked'] .mh-switch__track-text,
134
+ .mh-switch > .mh-switch__input:checked ~ .mh-switch__track .mh-switch__track-text {
135
+ left: calc(var(--ui-switch-inset) + 2px);
136
+ right: calc(var(--ui-switch-knob) + 2 * var(--ui-switch-inset));
137
+ justify-content: flex-start;
138
+ }
139
+ .mh-switch:not(.is-checked) .mh-switch__track-text {
140
+ left: calc(var(--ui-switch-knob) + 2 * var(--ui-switch-inset));
141
+ right: calc(var(--ui-switch-inset) + 2px);
142
+ justify-content: flex-end;
143
+ }
144
+
145
+ /* ===== 加载:轨道内转圈(同时置原生 disabled,真正吞掉点击) ===== */
146
+ .mh-switch__spinner {
147
+ position: absolute;
148
+ top: 50%;
149
+ left: 50%;
150
+ width: 10px;
151
+ height: 10px;
152
+ margin: -5px 0 0 -5px;
153
+ border: 1.5px solid var(--ui-base-100);
154
+ border-top-color: transparent;
155
+ border-radius: var(--ui-radius-full);
156
+ animation: mh-switch-spin 0.8s linear infinite;
157
+ }
158
+ @keyframes mh-switch-spin {
159
+ to {
160
+ transform: rotate(360deg);
161
+ }
162
+ }
163
+ .mh-switch.is-loading {
164
+ cursor: progress;
165
+ }
@@ -1,26 +1,26 @@
1
- /**
2
- * switch —— 单件令牌(**基础值**)。
3
- *
4
- * 本件自己的几何 / 尺寸 / 色彩槽位;只服务本件,故不随主题进 `@manohub/theme`。
5
- *
6
- * ## 抽出说明
7
- * 本文件从面文件里抽出(原先混写在 `switch.css` 顶部):这些是**基础值**,锚在
8
- * `[data-manohub-ui]` —— 跨包唯一作用域锚,由入口层无条件写在应用容器上,因此**任何落在
9
- * 容器里的分件都取得到值**,不再依赖「声明在某个组件根类上」这条脆弱假设
10
- * (历史症状:跨件消费的 `--ui-*-group-*` 取不到值,组内间距变 0)。
11
- *
12
- * ⚠️ `.mh-<件>--<档>` 这类**档位改写**留在面文件的修饰符块里 —— 它们靠「同一元素上两个
13
- * 选择器改写同一个令牌」生效,搬到本文件会让档位失效。
14
- * ⚠️ 新增组件要登记两处:本文件 + `src/styles/index.css`(见其文件头「五处齐备」)。
15
- */
16
- [data-manohub-ui] {
17
- /* 单件令牌 */
18
- --ui-switch-track-w: 36px; /* 规范表格档 */
19
- --ui-switch-track-h: 18px;
20
- --ui-switch-knob: 14px;
21
- --ui-switch-inset: 2px;
22
- --ui-switch-label-gap: 10px; /* 规范实测 */
23
- --ui-switch-off-bg: var(--ui-base-400); /* Ne04 */
24
- --ui-switch-on-bg: var(--ui-primary);
25
- --ui-switch-disabled-opacity: 0.5; /* 规范禁用透明度 */
26
- }
1
+ /**
2
+ * switch —— 单件令牌(**基础值**)。
3
+ *
4
+ * 本件自己的几何 / 尺寸 / 色彩槽位;只服务本件,故不随主题进 `@manohub/theme`。
5
+ *
6
+ * ## 抽出说明
7
+ * 本文件从面文件里抽出(原先混写在 `switch.css` 顶部):这些是**基础值**,锚在
8
+ * `[data-manohub-ui]` —— 跨包唯一作用域锚,由入口层无条件写在应用容器上,因此**任何落在
9
+ * 容器里的分件都取得到值**,不再依赖「声明在某个组件根类上」这条脆弱假设
10
+ * (历史症状:跨件消费的 `--ui-*-group-*` 取不到值,组内间距变 0)。
11
+ *
12
+ * ⚠️ `.mh-<件>--<档>` 这类**档位改写**留在面文件的修饰符块里 —— 它们靠「同一元素上两个
13
+ * 选择器改写同一个令牌」生效,搬到本文件会让档位失效。
14
+ * ⚠️ 新增组件要登记两处:本文件 + `src/styles/index.css`(见其文件头「五处齐备」)。
15
+ */
16
+ [data-manohub-ui] {
17
+ /* 单件令牌 */
18
+ --ui-switch-track-w: 36px; /* 规范表格档 */
19
+ --ui-switch-track-h: 18px;
20
+ --ui-switch-knob: 14px;
21
+ --ui-switch-inset: 2px;
22
+ --ui-switch-label-gap: 10px; /* 规范实测 */
23
+ --ui-switch-off-bg: var(--ui-base-400); /* Ne04 */
24
+ --ui-switch-on-bg: var(--ui-primary);
25
+ --ui-switch-disabled-opacity: 0.5; /* 规范禁用透明度 */
26
+ }