@manohub/ui 1.1.2 → 1.1.4

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 (37) hide show
  1. package/README.md +2 -2
  2. package/dist/components/code-block/index.js +7 -2
  3. package/dist/components/date-picker/calendar.d.ts +78 -0
  4. package/dist/components/date-picker/calendar.js +91 -0
  5. package/dist/components/date-picker/date-panel.d.ts +312 -0
  6. package/dist/components/date-picker/date-panel.js +265 -0
  7. package/dist/components/date-picker/date-time-row.d.ts +84 -0
  8. package/dist/components/date-picker/date-time-row.js +105 -0
  9. package/dist/components/date-picker/index.d.ts +863 -0
  10. package/dist/components/date-picker/index.js +549 -0
  11. package/dist/components/date-picker/panel.d.ts +73 -0
  12. package/dist/components/date-picker/panel.js +53 -0
  13. package/dist/components/date-picker/shared.d.ts +37 -0
  14. package/dist/components/date-picker/shared.js +20 -0
  15. package/dist/components/date-picker/trigger.d.ts +147 -0
  16. package/dist/components/date-picker/trigger.js +107 -0
  17. package/dist/components/input/composition.d.ts +25 -0
  18. package/dist/components/input/composition.js +31 -0
  19. package/dist/components/input/index.d.ts +5 -5
  20. package/dist/components/input/index.js +91 -12
  21. package/dist/components/query-state/index.js +15 -1
  22. package/dist/components/search/index.d.ts +1 -1
  23. package/dist/components/select/index.d.ts +5 -2
  24. package/dist/components/select/select-panel.d.ts +3 -0
  25. package/dist/index.d.ts +1 -0
  26. package/dist/index.js +4 -0
  27. package/dist/styles/components/date-picker.css +278 -0
  28. package/dist/styles/components/date-picker.tokens.css +14 -0
  29. package/dist/styles/components/query-state.css +2 -1
  30. package/dist/styles/components/select.css +3 -33
  31. package/dist/styles/components/select.tokens.css +0 -1
  32. package/dist/styles/index.css +2 -0
  33. package/dist/utils/scope-svg-ids.d.ts +34 -0
  34. package/dist/utils/scope-svg-ids.js +15 -0
  35. package/dist/utils/state-illustration.d.ts +8 -14
  36. package/dist/utils/state-illustration.js +81 -69
  37. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -34,6 +34,7 @@ export { Button, Segmented, type ButtonVariant, type ButtonCompound, type Button
34
34
  export { Input, Textarea, NumberInput, type TextareaProps, type NumberInputProps, type InputCompound, type InputCompoundType, } from './components/input';
35
35
  export { Search, type SearchProps } from './components/search';
36
36
  export { Select, SelectTree, type SelectOption, type SelectValue } from './components/select';
37
+ export { DatePicker, DateRangePicker, DateTimePicker, type DatePickerProps, type DatePickerCompoundType, type DateRangePickerProps, type DateTimePickerProps, } from './components/date-picker';
37
38
  export { Switch } from './components/switch';
38
39
  export { Capsule, type CapsuleOption, type CapsuleShape } from './components/capsule';
39
40
  export { Form, type FormProps, type FormHeaderProps, type FormItemProps, type FormValues, type FormItemSlotScope, type FormItemAlign, type FormLabelAlign, type FormColumns, type FormPadding, type FormCompound, } from './components/form';
package/dist/index.js CHANGED
@@ -16,6 +16,7 @@ import { Button } from "./components/button/index.js";
16
16
  import { Input, Textarea } from "./components/input/index.js";
17
17
  import { Search } from "./components/search/index.js";
18
18
  import { Select } from "./components/select/index.js";
19
+ import { DatePicker, DateRangePicker, DateTimePicker } from "./components/date-picker/index.js";
19
20
  import { Switch } from "./components/switch/index.js";
20
21
  import { Capsule } from "./components/capsule/index.js";
21
22
  import { Form } from "./components/form/index.js";
@@ -54,6 +55,9 @@ export {
54
55
  Checkbox,
55
56
  CodeBlock,
56
57
  Collapse,
58
+ DatePicker,
59
+ DateRangePicker,
60
+ DateTimePicker,
57
61
  Dialog,
58
62
  Divider,
59
63
  Drawer,
@@ -0,0 +1,278 @@
1
+ /**
2
+ * date-picker —— 日期族的面(`DatePicker` / `DatePicker.Range` / `DateTimePicker`,见 `components/date-picker/`)。
3
+ *
4
+ * **自足的一份面**:本件原来寄居在 `select.css` 里(「与选择器同族同面」),2026-10-14 拆出独立目录后,
5
+ * 它不再引用选择器面的任何规则 —— 触发的**框与状态仍归输入面**(`Input` 的触发器形态),故「日期框与
6
+ * 选择器长得一样」这件事依旧成立,但两份面各写各的规则、互不牵连(选择器要加搜索行 / 选项列表,
7
+ * 日期要加日历 / 月份网格 / 时间行,两边的长势早已不同)。
8
+ *
9
+ * 面板仍是**操作层的组合**:根上并列 `class="mh-popup mh-date-picker__panel mh-popup--anchored"`
10
+ * (开合 / Esc / 点外部关闭 / 顶层渲染 / 定位档全在 `styles/operations/popup.css`),本文件只给皮肤。
11
+ * **面板宽度按内容、高度不限**:日历是 7 列固定宽(见 `.mh-date-picker__calendar`),跟触发器那点宽度
12
+ * 会把它挤坏;内容固定(日历 6 行 / 月份 4 行 + 可选时间行),也不需要那档给选项列表的限高。
13
+ */
14
+ /* ===== 触发器:只留日期族自己的排版(框与状态全归输入面) ===== */
15
+ .mh-date-picker {
16
+ display: inline-flex;
17
+ align-items: center;
18
+ gap: var(--ui-space-1);
19
+ width: 100%;
20
+ text-align: left;
21
+ cursor: pointer;
22
+ overflow: hidden;
23
+ }
24
+ /* 表壳上的本件修饰(TSX 把 `mh-date-picker-host` 挂在**表壳**上:`class` 落壳是输入面的既有契约):
25
+ 壳内间距取本族的 4(输入面的附加位节奏是 8),右侧图标位的尺寸收敛回常规图标档(同选择器那处口径)。 */
26
+ .mh-date-picker-host {
27
+ gap: var(--ui-space-1);
28
+ }
29
+ .mh-date-picker-host .mh-date-picker__icon {
30
+ width: var(--ui-font-icon);
31
+ height: var(--ui-font-icon);
32
+ }
33
+ /* 值区:占满剩余宽、超出省略(无值态由输入面的占位承担,见 `index.tsx`) */
34
+ .mh-date-picker__value {
35
+ flex: 1;
36
+ min-width: 0;
37
+ overflow: hidden;
38
+ text-overflow: ellipsis;
39
+ white-space: nowrap;
40
+ }
41
+ /* 右侧图标位:**日历**(不是下拉箭头)—— 它是「这一格填的是日期」的身份标识,不是「点我能展开」的线索,
42
+ 故不随展开转向(不挂 `.mh-popup-caret`),只读与禁用档也留着(见 `trigger.tsx`)。 */
43
+ .mh-date-picker__icon {
44
+ flex: none;
45
+ color: var(--ui-base-content-muted);
46
+ }
47
+
48
+ /* ===== 面板皮肤(与操作层并列组合:`class="mh-popup mh-date-picker__panel mh-popup--anchored"`) ===== */
49
+ .mh-date-picker__panel {
50
+ /* 锚 = `.mh-popup-anchor`(挂在表壳上);这里**不取锚点宽**:日历 7 列固定宽,跟触发器会挤坏 */
51
+ display: flex;
52
+ flex-direction: column;
53
+ width: max-content;
54
+ /* 内容固定(日历 / 月份网格 + 可选时间行),故**不限高**;不加这条会被 UA 给 `[popover]` 的
55
+ `max-height: none` 之外那套(以及浮层的默认限高)影响,字号更大的主题里会压出内部滚动条 */
56
+ max-height: none;
57
+ /* UA 给 `[popover]` 的是 `overflow: auto`,本件不需要滚动 */
58
+ overflow: hidden;
59
+ padding: var(--ui-space-2);
60
+ border-radius: var(--ui-radius-md);
61
+ background: var(--ui-base-100);
62
+ box-shadow: var(--ui-shadow-popover);
63
+ }
64
+ /* 内容区:日期族的面板里没有搜索行,故这一层只是「日历 / 月份网格 + 可选时间行」的容器 */
65
+ .mh-date-picker__body {
66
+ padding: 0;
67
+ }
68
+
69
+ /* 日历根:列容器(月份头 → 星期行 + 日历网格 / 月份网格 → 可选的时间行),宽度**钉成 7 个日期格** ——
70
+ 日历与月份网格两个视图同宽;高度那边由 `.mh-date-picker__cal-months` 撑到与日历内容区一样高,
71
+ 故切视图时面板**尺寸完全不变**(宽或高跟着内容走,都会让面板「跳一下」)。 */
72
+ .mh-date-picker__calendar {
73
+ display: flex;
74
+ flex-direction: column;
75
+ gap: var(--ui-space-1);
76
+ width: calc(7 * var(--ui-date-picker-cell));
77
+ }
78
+ .mh-date-picker__cal-head {
79
+ display: flex;
80
+ align-items: center;
81
+ justify-content: space-between;
82
+ gap: var(--ui-space-1);
83
+ }
84
+ /* 月份头是**按钮**:点它进月份网格(跨年不必一格一格翻月),再点回到日历。
85
+ 边 / 底 / 内距三样自带(`reset.css` 不再代消费方归零按钮);内距顺带把它撑成一块可点的热区。 */
86
+ .mh-date-picker__cal-title {
87
+ padding: var(--ui-space-1) var(--ui-space-2);
88
+ border: none;
89
+ border-radius: var(--ui-radius-control);
90
+ background: transparent;
91
+ font-family: inherit;
92
+ font-size: var(--ui-font-caption);
93
+ color: var(--ui-base-content);
94
+ cursor: pointer;
95
+ }
96
+ .mh-date-picker__cal-title:hover {
97
+ background: var(--ui-primary-weak);
98
+ }
99
+ /* 翻月按钮:与日期格同尺寸的方块(热区与网格列宽对齐);图标取下拉箭头那一档。
100
+ 边 / 底 / 内距三样必须自带(`reset.css` 早已不代消费方归零按钮):尺寸由固定方块给,内距一律清 0。 */
101
+ .mh-date-picker__cal-nav {
102
+ display: inline-flex;
103
+ align-items: center;
104
+ justify-content: center;
105
+ width: var(--ui-date-picker-cell);
106
+ height: var(--ui-date-picker-cell);
107
+ padding: 0;
108
+ border: none;
109
+ border-radius: var(--ui-radius-control);
110
+ background: transparent;
111
+ color: var(--ui-base-content-muted);
112
+ cursor: pointer;
113
+ }
114
+ .mh-date-picker__cal-nav > svg {
115
+ width: var(--ui-font-icon);
116
+ height: var(--ui-font-icon);
117
+ }
118
+ .mh-date-picker__cal-nav:hover {
119
+ background: var(--ui-primary-weak);
120
+ }
121
+ /* 星期行与每一周共用一套 7 列网格(列宽 = 日期格尺寸)⇒ 表头与格天然对齐 */
122
+ .mh-date-picker__cal-week,
123
+ .mh-date-picker__cal-row {
124
+ display: grid;
125
+ grid-template-columns: repeat(7, var(--ui-date-picker-cell));
126
+ }
127
+ .mh-date-picker__cal-weekday {
128
+ display: flex;
129
+ align-items: center;
130
+ justify-content: center;
131
+ height: var(--ui-date-picker-cell);
132
+ font-size: var(--ui-font-caption);
133
+ color: var(--ui-base-content-muted);
134
+ }
135
+ .mh-date-picker__cal-grid {
136
+ display: flex;
137
+ flex-direction: column;
138
+ }
139
+ .mh-date-picker__cal-cell {
140
+ display: flex;
141
+ align-items: center;
142
+ justify-content: center;
143
+ }
144
+ /* 月份网格:3 列 × 4 行;格子是按钮,三样外观自带。
145
+ **高度与日历视图的内容区相同**(1 行星期表头 + 6 行日期格 + 一格行距)—— 两个视图的面板因此同宽同高,
146
+ 切视图不会「缩一下」;4 行**均分**这块高度(行高随主题的控件档一起变),月格不高不扁。 */
147
+ .mh-date-picker__cal-months {
148
+ display: grid;
149
+ grid-template-columns: repeat(3, 1fr);
150
+ grid-template-rows: repeat(4, 1fr);
151
+ gap: var(--ui-space-1);
152
+ height: calc(7 * var(--ui-date-picker-cell) + var(--ui-space-1));
153
+ }
154
+ .mh-date-picker__cal-month {
155
+ display: inline-flex;
156
+ align-items: center;
157
+ justify-content: center;
158
+ /* 高度由上面的行高拉伸给(不写 `height`):写了就会把均分结果按掉,四行又缩回去 */
159
+ padding: 0;
160
+ border: none;
161
+ border-radius: var(--ui-radius-control);
162
+ background: transparent;
163
+ font-family: inherit;
164
+ font-size: var(--ui-font-caption);
165
+ color: var(--ui-base-content);
166
+ cursor: pointer;
167
+ }
168
+ .mh-date-picker__cal-month:hover {
169
+ background: var(--ui-primary-weak);
170
+ }
171
+ /* 当前展示的那一个月(选中即切回日历) */
172
+ .mh-date-picker__cal-month[data-state='selected'] {
173
+ background: var(--ui-primary);
174
+ color: var(--ui-primary-content);
175
+ }
176
+
177
+ /* ===== 时间行(`DateTimePicker` 的日期 + 时间面板;见 `components/date-picker/date-time-row.tsx`) =====
178
+ 结构:`时 : 分 [: 秒] + 此刻`。三个输入框**等分**面板宽(即日历那 7 列的宽),故不写死像素;
179
+ 输入框直接吃裸控件(`.mh-input`),本件只覆盖三处:撑满自己那一格、居中、去掉左右内距
180
+ (框里只有两位数字,那 8px 左右内距会把两位挤成一位的观感)。
181
+ 它在**日历与月份两个视图里都在** —— 面板宽高因此与视图无关(切视图不跳)。 */
182
+ .mh-date-picker__cal-time {
183
+ display: flex;
184
+ align-items: center;
185
+ gap: var(--ui-space-1);
186
+ /* 与上面的网格画一条分节线 + 一档呼吸位(时间行不是日历的一部分) */
187
+ padding-top: var(--ui-space-1);
188
+ border-top: 1px solid var(--ui-base-200);
189
+ }
190
+ .mh-date-picker__time-input {
191
+ flex: 1 1 0;
192
+ min-width: 0;
193
+ width: auto;
194
+ padding: 0;
195
+ text-align: center;
196
+ }
197
+ .mh-date-picker__time-sep {
198
+ flex: none;
199
+ color: var(--ui-base-content-muted);
200
+ }
201
+ /* 「此刻」:面板里的文字按钮(边 / 底 / 内距三样自带,与翻月按钮同款口径) */
202
+ .mh-date-picker__cal-now {
203
+ flex: none;
204
+ height: var(--ui-date-picker-cell);
205
+ padding: 0 var(--ui-space-2);
206
+ border: none;
207
+ border-radius: var(--ui-radius-control);
208
+ background: transparent;
209
+ font-family: inherit;
210
+ font-size: var(--ui-font-caption);
211
+ color: var(--ui-primary);
212
+ cursor: pointer;
213
+ }
214
+ .mh-date-picker__cal-now:hover {
215
+ background: var(--ui-primary-weak);
216
+ }
217
+
218
+ /* ===== 日期格(DatePicker 复用本族面板;选中主色实底、区间浅底) ===== */
219
+ .mh-date-picker__date {
220
+ display: inline-flex;
221
+ align-items: center;
222
+ justify-content: center;
223
+ width: var(--ui-date-picker-cell);
224
+ height: var(--ui-date-picker-cell);
225
+ /* 方块尺寸已定,内距一律清 0(UA 的 `1px 6px` 会把 32 的格子挤歪);边与底同 `--cal-nav` 自带 */
226
+ padding: 0;
227
+ border: none;
228
+ border-radius: var(--ui-radius-control);
229
+ background: transparent;
230
+ font-family: inherit;
231
+ font-size: var(--ui-font-caption);
232
+ color: var(--ui-base-content);
233
+ cursor: pointer;
234
+ }
235
+ .mh-date-picker__date:hover,
236
+ .mh-date-picker__date.is-hover {
237
+ background: var(--ui-primary-weak);
238
+ }
239
+ .mh-date-picker__date.is-selected,
240
+ .mh-date-picker__date[data-state='selected'] {
241
+ background: var(--ui-primary);
242
+ color: var(--ui-primary-content);
243
+ }
244
+ .mh-date-picker__date.is-range {
245
+ background: var(--ui-primary-weak);
246
+ }
247
+ /* 涂色接缝:**相接那一侧的圆角归零**。
248
+ 区间底色是一格一格方块拼出来的,圆角方块并排时相邻两角各让出一块 4×4 的空白,两块空白拼成一个
249
+ 菱形白点(就是「24 与 25 之间」那种缝)。故凡「与**同周**邻居同属涂色区」(端点或区间内部)的那一侧
250
+ 不留圆角:区间内部的格两侧全直角,区间两端只归零靠内的一侧 —— 区间外侧的圆角因此保留。
251
+ 哪一侧相接由数据层算(`date-panel.tsx` 的 `jointLeft` / `jointRight`):跨行的周日与下周一不相邻。 */
252
+ .mh-date-picker__date--joint-l {
253
+ border-start-start-radius: 0;
254
+ border-end-start-radius: 0;
255
+ }
256
+ .mh-date-picker__date--joint-r {
257
+ border-start-end-radius: 0;
258
+ border-end-end-radius: 0;
259
+ }
260
+ /* 邻近月的补位日:降一档字色(仍可点,点了即选中并把视图跟到那个月) */
261
+ .mh-date-picker__date--outside {
262
+ color: var(--ui-base-content-subtle);
263
+ }
264
+ /* 今天:主色字。**不加底、不加环** —— 底是滑过与选中的语义,今天只是一个参照点 */
265
+ .mh-date-picker__date--today {
266
+ color: var(--ui-primary);
267
+ }
268
+ /* 键盘焦点环:格子是真实 `<button>`(可聚焦、Enter 选中),走与其他件同一句 ——
269
+ 不掉到浏览器默认 outline 上(各引擎形状与颜色不一致,且与全库的焦点语言不同) */
270
+ .mh-date-picker__date:focus-visible {
271
+ outline: 2px solid var(--ui-primary);
272
+ outline-offset: -2px;
273
+ }
274
+ .mh-date-picker__date.is-disabled,
275
+ .mh-date-picker__date:disabled {
276
+ color: var(--ui-base-content-subtle);
277
+ cursor: not-allowed;
278
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * date-picker —— 单件令牌(**基础值**;只服务日期族三件,故不随主题进 `@manohub/theme`)。
3
+ *
4
+ * 令牌锚 `[data-manohub-ui]`:面板挂在宿主下、与触发器**同级**,日历格又是面板的后代 ——
5
+ * 锚容器才让这几支都取得到值(锚元件根类会漏掉面板那一支)。
6
+ *
7
+ * 只造**一处改全动**的那几枚:日历的格宽、星期行高、网格列宽、面板宽度、月份网格的行高全由
8
+ * `--ui-date-picker-cell` 派生,改一枚即整块几何一起走。其余值(字号、图标档、圆角、语义色)
9
+ * 直接吃全局令牌 —— 为没人会去单独改的值造令牌只是噪音。
10
+ */
11
+ [data-manohub-ui] {
12
+ /* 日期格尺寸(32 = 全库控件标准档):日历 7 列、星期行、月份网格行高、面板宽都由它派生 */
13
+ --ui-date-picker-cell: var(--ui-control-height-md);
14
+ }
@@ -65,7 +65,8 @@
65
65
 
66
66
  /* ===== 插画壳 =====
67
67
  内建插画是**设计交付的 SVG 原样注入**(见 `utils/state-illustration.ts`:结构 / 坐标 / 固定色值 /
68
- `id` / `<title>` 全保留),面里因此只有外壳这一件事:壳宽(264 = 设计画布宽)、窄容器里按比例收缩、
68
+ `<title>` 全保留;`id` 原样保留,但注入前按实例加后缀,见 `utils/scope-svg-ids.ts`),
69
+ 面里因此只有外壳这一件事:壳宽(264 = 设计画布宽)、窄容器里按比例收缩、
69
70
  与下方文案的间距,以及把设计稿写死 `264 × 246` 的画布拉成「随壳自适应」。
70
71
  同理,插画**不跟随主题**(图里是设计终值色,不走 `--ui-*`)——这是「原样引用」的取舍。
71
72
  `illustration` 属性给的图片地址复用同一个壳(`<img>` 自带比例,不需要第二条规则)。 */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Select —— 选择器族(单选触发器 + 多选标签 + 选项面板 + 搜索行 + 日期格)。
2
+ * Select —— 选择器族(单选触发器 + 多选标签 + 选项面板 + 搜索行 + 日期面板与日历 + 日期格)。
3
3
  *
4
4
  * **触发器的框不在本件**:触发器 = 输入框的「触发器形态」(`<Input as="button">`),框 / 内距 / 边 / 圆角 /
5
5
  * 底 / 字 / 三态 / 清除位 / 右侧图标位全部归输入面与它的表壳。本件只给选择器自己的排版(`display` / `gap` /
@@ -40,6 +40,8 @@
40
40
  .mh-select-host {
41
41
  gap: var(--ui-space-1);
42
42
  }
43
+ /* 右侧图标位的槽内尺寸:箭头长在输入面的 `suffix` 槽里,而输入面按自己的附加位档(常规图标档 16)收敛,
44
+ 不写这条就会被顶成 16(历史坑);本族取值与它同档,只是显式写出来。 */
43
45
  .mh-select-host .mh-select__caret {
44
46
  width: var(--ui-select-icon-size);
45
47
  height: var(--ui-select-icon-size);
@@ -246,35 +248,3 @@
246
248
  color: inherit;
247
249
  }
248
250
 
249
- /* ===== 日期格(DatePicker 复用本族面板;选中主色实底、区间浅底) ===== */
250
- .mh-select__date {
251
- display: inline-flex;
252
- align-items: center;
253
- justify-content: center;
254
- width: var(--ui-select-height);
255
- height: var(--ui-select-height);
256
- border: none;
257
- border-radius: var(--ui-radius-control);
258
- background: transparent;
259
- font-family: inherit;
260
- font-size: var(--ui-select-font-size);
261
- color: var(--ui-base-content);
262
- cursor: pointer;
263
- }
264
- .mh-select__date:hover,
265
- .mh-select__date.is-hover {
266
- background: var(--ui-select-option-hover);
267
- }
268
- .mh-select__date.is-selected,
269
- .mh-select__date[data-state='selected'] {
270
- background: var(--ui-primary);
271
- color: var(--ui-primary-content);
272
- }
273
- .mh-select__date.is-range {
274
- background: var(--ui-primary-weak);
275
- }
276
- .mh-select__date.is-disabled,
277
- .mh-select__date:disabled {
278
- color: var(--ui-base-content-subtle);
279
- cursor: not-allowed;
280
- }
@@ -19,7 +19,6 @@
19
19
  故面板里列表形态与树形态不会再长成两套行。改树行的行几何 = 选项行一起动(有意)。
20
20
  ⚠️ 与全局 `--ui-row-height`(36,Skeleton / Collapse 头行在用)**不是一档**:
21
21
  对齐目标是树行(34),不是全库行高 —— 别再按「行高就该 36」改回来。 */
22
- --ui-select-height: var(--ui-control-height-md); /* 标准档 32(日期格与面板内部用;触发器的框高归输入面) */
23
22
  --ui-select-padding-x: var(--ui-space-2); /* 8 = 树行的基础内距(缩进之外的左右呼吸位) */
24
23
  --ui-select-radius: var(--ui-radius-md); /* 8:设计 `0:4025` 下拉面板 r8(原注释写 8 但取的是控件档 6) */
25
24
  --ui-select-font-size: var(--ui-font-caption); /* 13 = 树行字号(不是触发器的 14) */
@@ -47,6 +47,7 @@
47
47
  @import './components/button.tokens.css';
48
48
  @import './components/input.tokens.css';
49
49
  @import './components/select.tokens.css';
50
+ @import './components/date-picker.tokens.css';
50
51
  @import './components/switch.tokens.css';
51
52
  @import './components/form.tokens.css';
52
53
  @import './components/checkbox.tokens.css';
@@ -104,6 +105,7 @@
104
105
  @import './components/input.css';
105
106
  @import './components/search.css'; /* 只有「一行里怎么摆」,输入框与按钮的面各自归族(故排在 input.css 之后) */
106
107
  @import './components/select.css';
108
+ @import './components/date-picker.css'; /* 日期族(单日 / 区间 / 日期时间):2026-10-14 从选择器面拆出,自成一份 */
107
109
  @import './components/switch.css';
108
110
  @import './components/form.css';
109
111
  @import './components/checkbox.css';
@@ -0,0 +1,34 @@
1
+ /**
2
+ * 内联 SVG 的 **id 作用域化**:把「一份固定 id 的设计 SVG」改成「本次渲染独占」的一串。
3
+ *
4
+ * ## 为什么必须有这层
5
+ *
6
+ * `state-illustration.ts` 是设计原样导出的 SVG,里面十几个 `id`(`empty-glow-1` / `empty-badge-clip` …)
7
+ * 是**常量**,而每个 `QueryState` 实例都把它 `innerHTML` 进 DOM 一份。微前端里子应用各自打包、
8
+ * 挂**同一个文档**(aip-web:平台页签容器),于是同一种状态同屏出现两次时,文档里就有两套同名 id。
9
+ *
10
+ * 浏览器解析 `url(#…)` 按**文档树里第一个匹配**算,后出现的那份其实在借前一份的 `<defs>`:
11
+ *
12
+ * - 前一份还渲染着 ⇒ 侥幸一模一样(这就是「只开一个页面时怎么都正常」);
13
+ * - 前一份被隐藏(平台切页签 → `display:none`,那份 `<defs>` 失去布局对象、不再作为资源存在)
14
+ * ⇒ 后一份的 `url()` 全部落空,**凡靠渐变 / 图案 / 遮罩上色的图元整块不绘制**,只剩字面色值的图元;
15
+ * 靠 `<use xlink:href="#…">` 撑起来的遮罩还会被前一份的 `visibility` 连累。
16
+ *
17
+ * 症状指纹:一张「白卡片 + 灰影」—— 恰好是所有 `url(#…)` 图元消失后的残余(2026-10-17 实测,
18
+ * aip-web 的「集成对象管理」与「服务开放」两页同开、都出空态时复现)。
19
+ *
20
+ * ## 做法
21
+ *
22
+ * 渲染前给**所有 id 与三处引用**加同一个后缀:`<mask id="x-s3">` 与 `mask="url(#x-s3)"`、
23
+ * `<use xlink:href="#x-s3">` 必须同源。漏掉引用侧就是另一种空转(定义在、引用不到 —— 回形针角标)
24
+ * ,漏掉 id 侧则是「引用了别人的」。CSS 选择器不参与:本包的样式规则只按 `.mh-*` 类走。
25
+ */
26
+ /**
27
+ * 给内联 SVG 的 id 声明与引用统一加后缀。
28
+ *
29
+ * 只认双引号属性(设计导出如此);`<?xml …?>` 头原样留着,`innerHTML` 会把它当注释丢掉。
30
+ *
31
+ * @param svg 设计原样的 SVG 串
32
+ * @param scope 本实例独占的后缀。会被塞进 `url(#…)`,须只含 `[A-Za-z0-9_-]`(不得有括号 / 引号 / 空白)
33
+ */
34
+ export declare function scopeSvgIds(svg: string, scope: string): string;
@@ -0,0 +1,15 @@
1
+ function scopeSvgIds(svg, scope) {
2
+ return svg.replace(/(\bid=")([^"]+)(")/g, (_match, before, id, after) => {
3
+ return `${before}${id}-${scope}${after}`;
4
+ }).replace(/(url\(#)([^)]+)(\))/g, (_match, before, id, after) => {
5
+ return `${before}${id}-${scope}${after}`;
6
+ }).replace(
7
+ /((?:xlink:)?href="#)([^"]+)(")/g,
8
+ (_match, before, id, after) => {
9
+ return `${before}${id}-${scope}${after}`;
10
+ }
11
+ );
12
+ }
13
+ export {
14
+ scopeSvgIds
15
+ };
@@ -1,18 +1,5 @@
1
1
  /**
2
- * 状态插画资产:**设计交付的四张 SVG,原样内联**(空 / 成功 / 异常 / 错误)。
3
- *
4
- * 四张图由设计直接导出(原交付件已随本轮迁移清理,**本文件是它们的唯一留存**),一字未改地收录:结构、坐标、渐变、
5
- * **固定色值**、`id`、`<title>`、连 XML 声明都在 —— 渲染结果与设计稿逐像素一致。任何「重绘成令牌 /
6
- * 精简路径 / 改 id」的做法都会走样,故这里不做。
7
- *
8
- * ## 取舍(已知并接受)
9
- *
10
- * - **不跟随主题**:颜色是设计交付的终值(`#EAEAEA` 底纹 / `#8DABFF` 折角 / 各态角标色),不进 `--ui-*`;
11
- * 换主题、进深色域时插画保持原样。
12
- * - **体积**:四张合计约 0.63 MB(空态那张的圆点网格被设计展开成了路径),随包进消费方产物。
13
- * - **id 冲突**:`异常` 与 `错误` 出自同一设计页,16 个 `id` 同名,其中 `linearGradient-8` 在一张里是
14
- * 角标橙、在另一张里是文本条灰 —— 两张挂进**同一个 document** 时会互相顶掉(其余组合无冲突)。
15
- * 必须同页共存时,改这里的 `id` 前缀或改名其中一张。
2
+ * 状态插画资产:设计交付的四张 SVG(空 / 成功 / 异常 / 错误)。
16
3
  *
17
4
  * ## 谁在用
18
5
  *
@@ -20,6 +7,13 @@
20
7
  * `.mh-state-illustration` 壳(`innerHTML`,与 `@manohub/icon` 渲染字形同一套路),壳宽由 `illustrationSize` 定。
21
8
  * 成功 / 异常两张暂无内建消费方,要「提交完成」整页那样的图形时按同一路子引即可。
22
9
  * 换图 = 重新从设计导出并整体替换本文件,不要在这里改结构、也不要在组件里改细节。
10
+ *
11
+ * ## 注入前必须做 id 作用域化
12
+ *
13
+ * 本文件的 `id` 是**设计原样的常量**(`empty-glow-1` / `error-card-clip-1` …),每注入一份就多一套同名 id;
14
+ * 同一文档里出现两份时,`url(#…)` 会解析到**先出现那份**的 `<defs>`,那份一旦被隐藏,后来者整块丢图。
15
+ * 故**不要**把串直接喂 `innerHTML`:一律先过 `utils/scope-svg-ids.ts` 的 `scopeSvgIds(svg, 本实例唯一后缀)`。
16
+ * 修图时也不要「顺手把 id 改成调用方前缀」—— 图是设计资产,作用域归渲染层。
23
17
  */
24
18
  /** 空态(设计稿「空状态」):圆点底纹 + 叠加卡片 + 蓝色折角 + 绿色回形针角标 */
25
19
  export declare const STATE_ILLUSTRATION_EMPTY_SVG: string;