@morlay/dsh-client-ui-primitives 0.0.7 → 0.0.9

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 (83) hide show
  1. package/README.md +32 -9
  2. package/dist/client-DYp99CgT.mjs +3730 -0
  3. package/dist/client-uyVkC7mu.cjs +17197 -0
  4. package/dist/client.cjs +54 -0
  5. package/dist/client.d.cts +4 -0
  6. package/dist/client.d.mts +3 -11680
  7. package/dist/client.mjs +3 -4575
  8. package/dist/index-AMHtcyMt.d.mts +647 -0
  9. package/dist/index.cjs +54 -0
  10. package/dist/index.d.mts +4 -5
  11. package/dist/index.mjs +4 -5
  12. package/dist/reference-hchCWm3z.cjs +482 -0
  13. package/dist/reference.cjs +4 -0
  14. package/dist/reference.d.mts +3 -0
  15. package/dist/reference.mjs +1 -0
  16. package/package.json +31 -35
  17. package/src/client/controls/Bubble.module.css +17 -0
  18. package/src/client/controls/Bubble.tsx +17 -0
  19. package/src/client/controls/Button.module.css +10 -0
  20. package/src/client/controls/Button.tsx +29 -0
  21. package/src/client/controls/DisclosureRow.module.css +22 -0
  22. package/src/client/controls/DisclosureRow.tsx +20 -0
  23. package/src/client/controls/IconButton.module.css +50 -0
  24. package/src/client/controls/IconButton.tsx +47 -0
  25. package/src/client/controls/ModelRouteList.module.css +100 -0
  26. package/src/client/controls/ModelRouteList.tsx +118 -0
  27. package/src/client/controls/MultilineField.module.css +26 -0
  28. package/src/client/controls/MultilineField.tsx +19 -0
  29. package/src/client/controls/SearchSelect.module.css +34 -0
  30. package/src/client/controls/SearchSelect.tsx +138 -0
  31. package/src/client/controls/SeatButton.module.css +53 -0
  32. package/src/client/controls/SeatButton.tsx +39 -0
  33. package/src/client/controls/Spinner.module.css +18 -0
  34. package/src/client/controls/Spinner.tsx +14 -0
  35. package/src/client/controls/TagInput.module.css +105 -0
  36. package/src/client/controls/TagInput.tsx +152 -0
  37. package/src/client/controls/TimeLabel.module.css +16 -0
  38. package/src/client/controls/TimeLabel.tsx +15 -0
  39. package/src/client/controls/VisuallyHidden.module.css +9 -0
  40. package/src/client/controls/VisuallyHidden.tsx +16 -0
  41. package/src/client/controls/classes.ts +5 -0
  42. package/src/client/controls/index.ts +24 -0
  43. package/src/client/controls/tags.ts +24 -0
  44. package/src/client/index.ts +16 -2
  45. package/src/client/layout/Row.tsx +89 -0
  46. package/src/client/layout/Stack.tsx +82 -0
  47. package/src/client/layout/Text.tsx +61 -0
  48. package/src/client/layout/index.ts +16 -0
  49. package/src/client/layout/layout.module.css +217 -0
  50. package/src/client/layout/scales.ts +91 -0
  51. package/src/client/schema-form/Editor.tsx +65 -65
  52. package/src/client/schema-form/SchemaForm.tsx +9 -4
  53. package/src/client/schema-form/controller.ts +5 -2
  54. package/src/client/schema-form/geometry.ts +3 -0
  55. package/src/client/schema-form/index.ts +5 -0
  56. package/src/client/schema-form/schema-form.module.css +335 -0
  57. package/src/client/schema-form/testing/fake-scope.ts +0 -1
  58. package/src/client/schema-form/value.tsx +15 -9
  59. package/src/client/settings-form/SettingsFieldRow.module.css +93 -0
  60. package/src/client/settings-form/SettingsFieldRow.tsx +105 -0
  61. package/src/client/settings-form/index.ts +5 -18
  62. package/src/css-modules.d.ts +6 -0
  63. package/src/index.ts +6 -2
  64. package/src/reference-markdown.tsx +2 -6
  65. package/dist/rolldown-runtime-EAsCxrDo.mjs +0 -14
  66. package/locale/en.json +0 -6
  67. package/locale/zh.json +0 -6
  68. package/src/client/schema-form/styles.ts +0 -321
  69. package/src/client/settings-form/SettingsForm.styles.ts +0 -58
  70. package/src/client/settings-form/SettingsForm.tsx +0 -68
  71. package/src/client/settings-form/fields.styles.ts +0 -158
  72. package/src/client/settings-form/fields.tsx +0 -184
  73. package/src/client/settings-form/form-model.ts +0 -339
  74. package/src/client/styling/css.ts +0 -27
  75. package/src/client/styling/focus.ts +0 -9
  76. package/src/client/styling/index.ts +0 -6
  77. package/src/client/styling/styled.tsx +0 -54
  78. package/src/client/styling/styling.ts +0 -142
  79. package/src/client/styling/token.ts +0 -275
  80. package/src/client/styling/toolkit.ts +0 -37
  81. package/src/client/theme.generated.ts +0 -846
  82. package/src/client/theme.ts +0 -5
  83. /package/src/{client/markdown-text.ts → markdown-text.ts} +0 -0
@@ -1,321 +0,0 @@
1
- // 行式编辑器的样式:等宽、行号、语法色、悬停行为——全部消费官方 `--dsw-*` token。
2
- //
3
- // 几何只有一套:行高、行内间距、动作按钮尺寸都由下面几个常量给,行与行之间不各自决定。
4
-
5
- import { styled } from "../styling/index.ts";
6
- import { dsw } from "../theme.ts";
7
-
8
- // 等宽字体栈:配置值的观感与代码一致。
9
- const MONO = 'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace';
10
-
11
- // 行高:行内容、行内输入、折叠箭头、按钮排都在这一档上对齐。
12
- const ROW = "22px";
13
-
14
- // 行内元素之间的间距。
15
- const GAP = "6px";
16
-
17
- // 动作按钮:方形图标键,尺寸与行高同一档的紧凑版。
18
- const ACTION = "20px";
19
-
20
- // 动作按钮之间的间距(比行内间距紧一档)。
21
- const ACTION_GAP = "4px";
22
-
23
- // 图标边长(行内图标与动作键同一档)。
24
- export const ICON_SIZE = 14;
25
-
26
- // 折叠列(chevron 与它的占位)宽度。
27
- const FOLD = "14px";
28
-
29
- // 行号列宽度。
30
- const NUMBER = "32px";
31
-
32
- // 行尾留白。
33
- const PAD = "8px";
34
-
35
- // 细线:theme 给的 0.5px 描边(`0 0 0 0.5px var(--dsw-elevation-stroke-color)`)。
36
- const HAIRLINE = dsw.elevation.stroke;
37
-
38
- // 描边色:theme 里给描边用的那一档(与官方 `Menu` 面板同源)。
39
- const LINE = dsw.elevation.stroke.color;
40
-
41
- // 行左侧那道「改过」的标记宽度。
42
- const EDGE = "2px";
43
-
44
- // 出错那一行的底色:theme 的红掺进透明里(半透明红),比整行实红轻、又比只有一道条明显。
45
- const ERROR_WASH = `color-mix(in srgb, ${String(dsw.alias.state.error.secondary)} 12%, transparent)`;
46
-
47
- // 编辑器的根:纵向排列的行。
48
- export const EditorRoot = styled("div")({
49
- display: "flex",
50
- flexDirection: "column",
51
- width: "100%",
52
- fontFamily: MONO,
53
- fontSize: "14px",
54
- lineHeight: ROW,
55
- color: dsw.alias.label.primary,
56
- });
57
-
58
- // 一行:行号 + 折进 + 行内容。悬停给一层浅底。
59
- export const LineRow = styled("div")({
60
- display: "flex",
61
- // 顶部对齐:行里出现输入框或多行值时,内容不跟着上下跳。
62
- alignItems: "flex-start",
63
- gap: GAP,
64
- minHeight: ROW,
65
- paddingRight: PAD,
66
- whiteSpace: "nowrap",
67
- "&:hover": { background: dsw.alias.bg.layer["2"] },
68
- // 选中一行(点行号):整行留一层底色,便于对着行号找内容。
69
- "&[data-selected='true']": { background: dsw.alias.bg.layer["3"] },
70
- // 本页改过还没保存:左边一道强调色,和「已经存进用户层」的浅灰区分开。
71
- "&[data-dirty='true']": { boxShadow: `inset ${EDGE} 0 0 ${String(dsw.alias.brand.primary)}` },
72
- "&[data-overridden='true']": { boxShadow: `inset ${EDGE} 0 0 ${String(LINE)}` },
73
- // 改过的字段名用强调色(存没存看左边那道条);出错时红优先。
74
- "&[data-dirty='true'] [data-role='key']": { color: dsw.alias.brand.primary },
75
- "&[data-overridden='true'] [data-role='key']": { color: dsw.alias.brand.primary },
76
- // 有问题的行:半透明红底 + 左侧一道实红条,字段名与注释位那句都是红字。
77
- "&[data-invalid='true']": {
78
- background: ERROR_WASH,
79
- boxShadow: `inset ${EDGE} 0 0 ${String(dsw.alias.state.error.primary)}`,
80
- },
81
- "&[data-invalid='true'] [data-role='key']": { color: dsw.alias.state.error.primary },
82
- // 行内的行为按钮(撤回 / 恢复默认 / 复制 / 移除):平时透明,悬停这一行才显形。
83
- "&:hover [data-role='actions']": { opacity: 1 },
84
- });
85
-
86
- // 一行的内容区:**缩进只作用在这里**——行号列固定在左边,缩进不推它。
87
- export const LineBody = styled("div")({
88
- display: "flex",
89
- alignItems: "center",
90
- gap: GAP,
91
- flex: 1,
92
- minWidth: 0,
93
- minHeight: ROW,
94
- });
95
-
96
- // 行号列:右对齐、不可选、淡色。
97
- export const LineNumber = styled("span")({
98
- flex: "none",
99
- width: NUMBER,
100
- lineHeight: ROW,
101
- textAlign: "right",
102
- color: dsw.alias.label.caption,
103
- userSelect: "none",
104
- cursor: "pointer",
105
- });
106
-
107
- // 折叠 chevron(官方箭头图标,尺寸与别的行内图标同源)。
108
- export const LineFold = styled("button")({
109
- display: "inline-flex",
110
- alignItems: "center",
111
- justifyContent: "center",
112
- flex: "none",
113
- width: FOLD,
114
- height: ROW,
115
- padding: 0,
116
- border: 0,
117
- background: "none",
118
- color: dsw.alias.label.caption,
119
- cursor: "pointer",
120
- "&:hover": { color: dsw.alias.label.secondary },
121
- });
122
-
123
- // 叶子行的折叠占位(保持列对齐)。
124
- export const LineFoldSpacer = styled("span")({
125
- flex: "none",
126
- width: FOLD,
127
- });
128
-
129
- // 键名(配置键原样;数组下标淡一些)。
130
- export const LineKey = styled("span")({
131
- flex: "none",
132
- color: dsw.alias.label.primary,
133
- "&[data-index='true']": { color: dsw.alias.label.caption },
134
- });
135
-
136
- // 结构符与标点(`{` `}` `[` `]` `:`)。
137
- export const LineToken = styled("span")({
138
- flex: "none",
139
- color: dsw.alias.label.caption,
140
- });
141
-
142
- // 值(token):字符串 / 数字 / 布尔各有语法色。
143
- //
144
- // **必须是块级盒**:`overflow` / `text-overflow` 对 inline 盒不生效,inline 的 token 无论多长都不会截断,
145
- // 只会把行撑宽(`min-width` / `overflow` 那两条声明在 inline 盒上是死代码)。
146
- export const LineValue = styled("span")({
147
- display: "block",
148
- minWidth: 0,
149
- overflow: "hidden",
150
- textOverflow: "ellipsis",
151
- cursor: "text",
152
- color: dsw.alias.state.business.primary,
153
- "&[data-tone='number']": { color: dsw.alias.state.warn.primary },
154
- "&[data-tone='boolean']": { color: dsw.alias.state.success.primary },
155
- "&[data-tone='empty']": { color: dsw.alias.label.caption },
156
- });
157
-
158
- // 值在行里的位置(字段槽的宿主):键名与结构符都是 `flex: none`,它是行里**唯一可收缩**的那一项。
159
- //
160
- // 这里不能放一个裸 `<span>`:flex item 的自动最小尺寸(`min-width: auto`)加上行上的 `white-space: nowrap`,
161
- // 等于「整段值的宽度」——值长了它一步不让,直接把整行(进而整个表单壳)撑宽。给它 `min-width: 0` 之后,
162
- // 值要么按自然宽度摆着,要么收缩到行尾并自己截断,长值因此不再有上限之外的影响。
163
- export const ValueSlot = styled("span")({
164
- display: "block",
165
- // 不生长:短值保持自然宽度(不会被拉成一整行),长值才收缩。
166
- flex: "0 1 auto",
167
- minWidth: 0,
168
- overflow: "hidden",
169
- });
170
-
171
- // 值上的下拉触发:**它自己就是值的呈现**(不再是「值 + 一个下拉」两遍),点开才出菜单。
172
- export const ValueTrigger = styled("button")({
173
- display: "inline-flex",
174
- alignItems: "center",
175
- gap: "2px",
176
- minWidth: 0,
177
- padding: 0,
178
- border: 0,
179
- background: "none",
180
- font: "inherit",
181
- textAlign: "left",
182
- cursor: "pointer",
183
- color: dsw.alias.label.caption,
184
- "&:disabled": { cursor: "default" },
185
- "&:focus-visible": { outline: "none" },
186
- });
187
-
188
- // 行内输入的外壳:官方 `Input` 压到与值同一行高,并**吃掉剩下的宽度**。
189
- //
190
- // 行内编辑与容器闭合行的添加输入共用它——两处的输入框因此长得一模一样。
191
- export const CompactInput = styled("span")({
192
- display: "inline-flex",
193
- flex: "1 1 auto",
194
- minWidth: 0,
195
- "& > span": {
196
- width: "100%",
197
- height: ROW,
198
- padding: "0 6px",
199
- borderRadius: "4px",
200
- },
201
- "& input": {
202
- fontSize: "14px",
203
- lineHeight: ROW,
204
- },
205
- });
206
-
207
- // 多行值的行内输入:官方没有多行原子,所以这里用同一套观感的字段壳(同边框、同圆角、同焦点色),
208
- // 高度跟着内容长、宽度同样撑满剩下的位置。
209
- export const CompactTextField = styled("span")({
210
- display: "inline-flex",
211
- flex: "1 1 auto",
212
- minWidth: 0,
213
- padding: "0 6px",
214
- borderRadius: "4px",
215
- background: dsw.alias.bg.layer["1"],
216
- // 细线走 theme 的描边(0.5px 与颜色都由 token 给)。
217
- border: 0,
218
- boxShadow: HAIRLINE,
219
- "&:focus-within": { "--dsw-elevation-stroke-color": dsw.alias.brand.primary },
220
- "& > textarea": {
221
- flex: 1,
222
- width: "100%",
223
- minHeight: ACTION,
224
- maxHeight: "240px",
225
- padding: 0,
226
- border: 0,
227
- outline: "none",
228
- background: "transparent",
229
- resize: "none",
230
- fieldSizing: "content",
231
- fontFamily: "inherit",
232
- fontSize: "14px",
233
- lineHeight: ROW,
234
- color: dsw.alias.label.primary,
235
- },
236
- });
237
-
238
- // 行内注释(schema 说明与业务文案):比配置值小一档、tertiary 色,占满这一行剩下的宽度,长了就截断——**真的被
239
- // 截断时**才由官方 `Tooltip` 给全文(`Editor.tsx` 里的 `TruncatedTooltip` 包着它),放得下就一个浮层也不挂。
240
- export const LineComment = styled("span")({
241
- flex: "1 1 auto",
242
- minWidth: 0,
243
- overflow: "hidden",
244
- textOverflow: "ellipsis",
245
- color: dsw.alias.label.tertiary,
246
- fontFamily: "inherit",
247
- fontSize: "12px",
248
- });
249
-
250
- // 行内的校验消息(与注释放同一档字号):注释位装的也可能是整段校验或解析失败的长消息,所以与注释同一套约束
251
- // ——可收缩、自己截断、**截断了**才由官方 `Tooltip` 给全文。`flex: 0 1 auto`(不生长):短消息别铺满整行,添加
252
- // 入口那一行里也不跟输入框抢剩下的宽度。红字先说清。
253
- export const LineInvalid = styled("span")({
254
- flex: "0 1 auto",
255
- minWidth: 0,
256
- overflow: "hidden",
257
- textOverflow: "ellipsis",
258
- color: dsw.alias.state.error.primary,
259
- fontFamily: "inherit",
260
- fontSize: "12px",
261
- });
262
-
263
- // 行尾的动作组:方形图标键(默认透明,悬停时显形)。
264
- export const LineActions = styled("span")({
265
- display: "inline-flex",
266
- alignItems: "center",
267
- gap: ACTION_GAP,
268
- flex: "none",
269
- opacity: 0,
270
- "& > button": {
271
- display: "inline-flex",
272
- alignItems: "center",
273
- justifyContent: "center",
274
- width: ACTION,
275
- height: ACTION,
276
- padding: 0,
277
- border: 0,
278
- borderRadius: "4px",
279
- background: "none",
280
- color: dsw.alias.label.secondary,
281
- cursor: "pointer",
282
- "&:hover": { background: dsw.alias.bg.layer["3"], color: dsw.alias.label.primary },
283
- "&:disabled": { cursor: "not-allowed", color: dsw.alias.label.dimmed },
284
- },
285
- });
286
-
287
- // 悬停行时才显示这一行的动作按钮:显形规则写在行上(`[data-role='actions']`),组件只需要带这个属性。
288
- export const HoverActions = styled(LineActions)({
289
- // 编辑态的两个按钮常显,而且**要有底色与描边**:行底色上只有淡色图标是看不见的,
290
- // 所以这里给实体按钮(theme 的描边 + 一层底),确认用成功档、取消用中性档。
291
- "&[data-editing='true']": {
292
- opacity: 1,
293
- gap: GAP,
294
- "& > button": {
295
- boxShadow: HAIRLINE,
296
- background: dsw.alias.bg.layer["1"],
297
- color: dsw.alias.label.primary,
298
- "&:first-of-type": { color: dsw.alias.state.success.primary },
299
- },
300
- },
301
- });
302
-
303
- // 添加输入:**跟在容器的闭合括号同一行**(菜单锚在它上面),宽度吃掉剩下的位置。
304
- export const AddWrap = styled("span")({
305
- position: "relative",
306
- display: "inline-flex",
307
- alignItems: "center",
308
- gap: GAP,
309
- flex: "1 1 auto",
310
- minWidth: 0,
311
- marginLeft: GAP,
312
- "&[data-invalid='true'] input": { borderColor: dsw.alias.state.error.primary },
313
- });
314
-
315
- // 一行说明(不可用 / 没有可生成项时用)。
316
- export const Hint = styled("p")({
317
- margin: 0,
318
- fontSize: "12px",
319
- lineHeight: 1.5,
320
- color: dsw.alias.label.tertiary,
321
- });
@@ -1,58 +0,0 @@
1
- // 样式搬自 vendor/deepseek-harness/packages/client/ui-primitives/src/settings-form/SettingsForm.module.css,
2
- // 换成包内 css-in-js(CSSProps + dsw);上游那份是 CSS Modules,本包不做预编译。
3
-
4
- import type { CSSProps } from "../styling/css.ts";
5
- import { focusRing } from "../styling/focus.ts";
6
- import { dsw } from "../theme.ts";
7
-
8
- // 上游引用的 --dsw-alias-label-error 不在官方主题定义集内(token 树里没有这个变量),
9
- // 照抄引用而不是换一个近义 token——官方主题哪天定义它,这里自动跟着生效。
10
- const failedColor = "var(--dsw-alias-label-error)";
11
-
12
- export const styles = {
13
- form: {
14
- display: "flex",
15
- flexDirection: "column",
16
- },
17
- // 上游 readOnly 与 unavailable 同一条规则:两处用同一个样式对象。
18
- notice: {
19
- margin: "0 0 12px",
20
- fontSize: "12px",
21
- lineHeight: 1.5,
22
- color: dsw.alias.label.tertiary,
23
- },
24
- footer: {
25
- display: "flex",
26
- alignItems: "center",
27
- gap: "8px",
28
- paddingTop: "16px",
29
- },
30
- failed: {
31
- flex: 1,
32
- minWidth: 0,
33
- margin: 0,
34
- fontSize: "12px",
35
- lineHeight: 1.5,
36
- color: failedColor,
37
- },
38
- save: {
39
- appearance: "none",
40
- border: "1px solid transparent",
41
- borderRadius: "8px",
42
- padding: "5px 14px",
43
- font: "inherit",
44
- fontSize: "13px",
45
- lineHeight: 1.5,
46
- cursor: "pointer",
47
- background: dsw.alias.label.primary,
48
- color: dsw.alias.bg.layer["3"],
49
- "&:disabled": {
50
- opacity: 0.4,
51
- cursor: "default",
52
- },
53
- "&:focus-visible": {
54
- outline: focusRing,
55
- outlineOffset: "1px",
56
- },
57
- },
58
- } satisfies Record<string, CSSProps>;
@@ -1,68 +0,0 @@
1
- // 搬自 vendor/deepseek-harness/packages/client/ui-primitives/src/settings-form/SettingsForm.tsx
2
- // (上游 `@deepseek-ai/dsh-client-ui-primitives`):行为同形,样式从 CSS Modules 换成包内 css-in-js。
3
-
4
- import { useEffect, useRef, type ReactNode } from "react";
5
- import { styled } from "../styling/styled.tsx";
6
- import type { SettingsFormShell } from "./form-model.ts";
7
- import { styles } from "./SettingsForm.styles.ts";
8
-
9
- const Form = styled("div")(styles.form);
10
- const Notice = styled("p")(styles.notice);
11
- const Footer = styled("div")(styles.footer);
12
- const Failed = styled("p")(styles.failed);
13
- const Save = styled("button")(styles.save);
14
-
15
- // The copy the form frame renders, from the owning plugin's dictionary.
16
- export interface SettingsFormLabels {
17
- // Shown in place of the controls while the namespace is not served.
18
- unavailable: string;
19
- // Shown over the controls while the document is read-only.
20
- readOnly: string;
21
- // Shown beside the save after a save the Host did not accept.
22
- saveFailed: string;
23
- // The save control.
24
- save: string;
25
- // The save control while a save is crossing the wire.
26
- saving: string;
27
- }
28
-
29
- // Form chrome shared by every settings page.
30
- export interface SettingsFormProps {
31
- // The frame's copy.
32
- labels: SettingsFormLabels;
33
- // The form state: availability, writability, and what a save would do.
34
- state: SettingsFormShell;
35
- // Write every staged edit.
36
- onSave: () => void;
37
- // Drop every staged edit; the form calls it when it leaves the page.
38
- onDiscard: () => void;
39
- // The plugin's controls.
40
- children: ReactNode;
41
- }
42
-
43
- // Render one plugin's settings form.
44
- export function SettingsForm(props: SettingsFormProps) {
45
- const { state, labels } = props;
46
- const discard = useRef(props.onDiscard);
47
- discard.current = props.onDiscard;
48
- useEffect(
49
- () => () => {
50
- discard.current();
51
- },
52
- [],
53
- );
54
- if (!state.available) return <Notice role="status">{labels.unavailable}</Notice>;
55
- const blocked = !state.dirty || state.invalid || state.saving;
56
- return (
57
- <Form>
58
- {!state.writable ? <Notice role="status">{labels.readOnly}</Notice> : null}
59
- {props.children}
60
- <Footer>
61
- {state.failed ? <Failed role="status">{labels.saveFailed}</Failed> : null}
62
- <Save type="button" disabled={blocked} onClick={props.onSave}>
63
- {state.saving ? labels.saving : labels.save}
64
- </Save>
65
- </Footer>
66
- </Form>
67
- );
68
- }
@@ -1,158 +0,0 @@
1
- // 样式搬自 vendor/deepseek-harness/packages/client/ui-primitives/src/settings-form/fields.module.css,
2
- // 换成包内 css-in-js(CSSProps + dsw);上游那份是 CSS Modules,本包不做预编译。
3
-
4
- import type { CSSProps } from "../styling/css.ts";
5
- import { focusRing } from "../styling/focus.ts";
6
- import { dsw } from "../theme.ts";
7
-
8
- // 上游引用的 --dsw-alias-bg-layer-4 不在官方主题定义集内(token 树里没有这个变量),
9
- // 照抄引用而不是换一个近义 token——官方主题哪天定义它,这里自动跟着生效。
10
- const helpButtonHoverBackground = "var(--dsw-alias-bg-layer-4)";
11
-
12
- export const styles = {
13
- field: {
14
- display: "flex",
15
- flexDirection: "column",
16
- gap: "6px",
17
- padding: "12px 0",
18
- "& + &": {
19
- borderTop: `0.5px solid ${String(dsw.alias.border.l2)}`,
20
- },
21
- },
22
- head: {
23
- display: "flex",
24
- alignItems: "center",
25
- gap: "8px",
26
- },
27
- label: {
28
- flex: 1,
29
- minWidth: 0,
30
- fontSize: "13px",
31
- fontWeight: 500,
32
- lineHeight: 1.5,
33
- color: dsw.alias.label.primary,
34
- },
35
- // 标签进 labelGroup 后由外层承担伸缩,自己不再抢空间(上游的 `.labelGroup > .label`)。
36
- groupLabel: {
37
- flex: "0 1 auto",
38
- },
39
- labelGroup: {
40
- display: "flex",
41
- alignItems: "center",
42
- gap: "4px",
43
- flex: 1,
44
- minWidth: 0,
45
- },
46
- helpButton: {
47
- display: "inline-flex",
48
- alignItems: "center",
49
- justifyContent: "center",
50
- flex: "none",
51
- width: "24px",
52
- height: "24px",
53
- padding: 0,
54
- border: 0,
55
- borderRadius: "6px",
56
- background: "none",
57
- color: dsw.alias.label.tertiary,
58
- cursor: "pointer",
59
- "&:hover": {
60
- background: helpButtonHoverBackground,
61
- color: dsw.alias.label.secondary,
62
- },
63
- "&[aria-expanded='true']": {
64
- background: helpButtonHoverBackground,
65
- color: dsw.alias.label.secondary,
66
- },
67
- "&:focus-visible": {
68
- outline: focusRing,
69
- outlineOffset: "1px",
70
- },
71
- },
72
- help: {
73
- padding: "10px 0 0",
74
- fontSize: "12px",
75
- lineHeight: 1.6,
76
- color: dsw.alias.label.secondary,
77
- "& > p": {
78
- margin: 0,
79
- },
80
- "& > p + p": {
81
- marginTop: "8px",
82
- },
83
- },
84
- badges: {
85
- display: "inline-flex",
86
- alignItems: "center",
87
- gap: "8px",
88
- },
89
- // 上游用 Tag(tone="neutral" | "quiet"):这里按变体拆两个 styled,形态与颜色照抄 Tag.module.css。
90
- badge: {
91
- display: "inline-flex",
92
- alignItems: "center",
93
- borderRadius: "999px",
94
- cornerShape: "round",
95
- padding: "1px 8px",
96
- fontSize: "11px",
97
- lineHeight: "17px",
98
- fontWeight: 500,
99
- whiteSpace: "nowrap",
100
- },
101
- badgeNeutral: {
102
- background: dsw.alias.bg.module.platform,
103
- color: dsw.alias.label.secondary,
104
- },
105
- badgeQuiet: {
106
- color: dsw.alias.label.tertiary,
107
- },
108
- reset: {
109
- border: "none",
110
- background: "none",
111
- padding: 0,
112
- font: "inherit",
113
- fontSize: "12px",
114
- lineHeight: 1.5,
115
- color: dsw.alias.label.secondary,
116
- cursor: "pointer",
117
- "&:hover:not(:disabled)": {
118
- color: dsw.alias.label.primary,
119
- },
120
- "&:disabled": {
121
- cursor: "default",
122
- },
123
- },
124
- input: {
125
- height: "34px",
126
- padding: "0 12px",
127
- border: `0.5px solid ${String(dsw.alias.border.l4)}`,
128
- borderRadius: "8px",
129
- background: dsw.alias.bg.layer["3"],
130
- font: "inherit",
131
- fontSize: "13px",
132
- lineHeight: 1.5,
133
- color: dsw.alias.label.primary,
134
- "&:focus-visible": {
135
- outline: "none",
136
- borderColor: dsw.alias.state.business.primary,
137
- },
138
- "&:disabled": {
139
- color: dsw.alias.label.tertiary,
140
- cursor: "default",
141
- },
142
- "&[aria-invalid='true']": {
143
- borderColor: dsw.alias.state.error.primary,
144
- },
145
- },
146
- invalid: {
147
- margin: 0,
148
- fontSize: "12px",
149
- lineHeight: 1.5,
150
- color: dsw.alias.state.error.primary,
151
- },
152
- hint: {
153
- margin: 0,
154
- fontSize: "12px",
155
- lineHeight: 1.5,
156
- color: dsw.alias.label.tertiary,
157
- },
158
- } satisfies Record<string, CSSProps>;