@24city/web-console 0.3.2 → 0.3.3
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/CHANGELOG.md +42 -0
- package/GUIDELINES.md +20 -2
- package/dist/account/index.js +1 -1
- package/dist/chunks/link-button-PqZcqU6s.js +17 -0
- package/dist/chunks/text-link-Ch_4QIkx.js +65 -0
- package/dist/chunks/upgrade-modal-DyPkV9OB.js +713 -0
- package/dist/index.js +3 -3
- package/dist/page/index.js +2 -2
- package/dist/page/link-button.d.ts +6 -4
- package/dist/page/text-link.d.ts +7 -4
- package/dist/semi.js +9 -4
- package/dist/styles.css +123 -49
- package/package.json +1 -1
- package/dist/chunks/link-button-giJEcTmG.js +0 -42
- package/dist/chunks/text-link-BAKoHe5o.js +0 -64
- package/dist/chunks/upgrade-modal-BWnNve0z.js +0 -696
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.3
|
|
4
|
+
|
|
5
|
+
来自 AdFlow 的 Arco → Semi 迁移审计:下面这些要么是本包组件的缺陷,要么是 Semi 默认值与规范不一致、每个产品都会遇到的地方,统一在这里修。
|
|
6
|
+
升级后有几处外观会变,见末尾“升级注意”。
|
|
7
|
+
|
|
8
|
+
**组件修正**
|
|
9
|
+
|
|
10
|
+
- `TextLink`、`LinkButton` 可以当 `Tooltip`、`Popover`、`Popconfirm`、`Dropdown` 的触发元素了。这些组件靠克隆子元素注入 ref 和事件,
|
|
11
|
+
两个组件原先既不转发 ref、也只留下 `aria-label` 一个属性:提示不出现,气泡定位不到触发元素,点外面关不掉。现在 ref、事件和其余属性
|
|
12
|
+
(`aria-*`、`data-*`、`tabIndex`、`style`……)都落到里面的链接元素上;`TextLink` 自己的回车 / 空格支持照旧。
|
|
13
|
+
- `LinkButton` 只有图标时是方形的图标按钮(原先左右各带 12px 内边距,是个扁块),图标和文字并排时中间有 8px(原先文字是纯文本时贴在一起)。
|
|
14
|
+
类名与结构和 Semi 的图标按钮一致。
|
|
15
|
+
- `UpgradeModal` 宽度恢复 400px(原先的样式写在 `.semi-modal` 上,而 Semi 把 `className` 挂在最外层包装,规则没命中,实际 448px);
|
|
16
|
+
右上角恢复关闭按钮(`header={null}` 时 Semi 不渲染它,改为组件自己画)。
|
|
17
|
+
|
|
18
|
+
**主题补上的 Semi 缺口**
|
|
19
|
+
|
|
20
|
+
- 圆形按钮:Semi 的 `circle` 只加类名、样式表里没有对应规则,按钮还是圆角方块;主题补上圆角。
|
|
21
|
+
- 线型页签的选中指示条是 3px 圆角条了。原先的规则写在 Semi 没有的伪元素上,实际一直是 Semi 默认的 2px 直角下划线;页签高度和文字位置不变。
|
|
22
|
+
- 分段选择(按钮式 `RadioGroup`):未选中 400、选中 500(Semi 每一项都是 600,未选中的反而更粗);字号跟控件走(默认 14px,小号 12px),
|
|
23
|
+
左右内边距 12px(大号 16px)。
|
|
24
|
+
- 标题和加粗统一 500:`Typography.Title` 六级、`Text strong`,以及里面是 Title 的卡片标题、弹窗标题(原先写在外层类上的 500 不生效,实际 600)。
|
|
25
|
+
显式传 `weight` 的标题不受影响。链接(`Typography.Text link`、`TextLink`)改为常规字重 400,靠颜色区分。
|
|
26
|
+
- 弹窗默认上下居中(`Modal.defaultProps.centered`,`Modal.confirm` 等命令式弹窗相同);要靠上的传 `centered={false}`。标题保持左对齐。
|
|
27
|
+
- 弹窗脚部:Semi 给脚部里所有按钮加 12px 左外边距(后代选择器),产品自己排版的脚部里每个按钮都被多推 12px、第一个也被缩进。
|
|
28
|
+
现在只在两种情况下给相邻按钮留 12px:Semi 默认的“取消 / 确定”,和直接放进 `footer` 的按钮;自己包了一层的脚部由自己的 `gap` 决定。
|
|
29
|
+
|
|
30
|
+
**文档与总览页**
|
|
31
|
+
|
|
32
|
+
- `GUIDELINES.md`:弹窗默认值与脚部写法、Semi 各组件 `className` 挂在哪个元素的对照表、触发元素要转发 ref。
|
|
33
|
+
- 组件总览页新增:圆形按钮、三种尺寸的分段选择、只有图标的 `LinkButton`、「链接作气泡和提示的触发元素」、「Semi 弹窗 · 自己排版的脚部」。
|
|
34
|
+
|
|
35
|
+
**升级注意**
|
|
36
|
+
|
|
37
|
+
- 所有标题、加粗文字和链接变细一档,弹窗从离顶 80px 变为上下居中,线型页签指示条变粗变圆,分段选择字号变大。产品里为了抵消旧表现写的补丁
|
|
38
|
+
(例如给 `strong` 单独设 500、给脚部按钮设 `margin-left: 0`、给 Modal 逐个加 `centered`、把 `TextLink` 包一层 `span` 再放进气泡)可以删掉。
|
|
39
|
+
- 自己包了一层、却靠 Semi 那 12px 外边距隔开按钮的弹窗脚部,升级后按钮会贴在一起:给容器加 `display: flex; gap`(或用 `Space`)。
|
|
40
|
+
- 不改的两处(AdFlow 审计里列为可选):`SideSheet` 头部保持 Semi 的留白、不加分隔线,与弹窗头部一致;`TextLink` 悬停保持下划线,
|
|
41
|
+
不恢复 Arco 的灰底(那种写法要常驻内边距,会让链接和旁边的文字对不齐)。
|
|
42
|
+
|
|
3
43
|
## 0.3.2
|
|
4
44
|
|
|
5
45
|
- 修正:没有标题也没有关闭按钮的 SideSheet 顶上平白空出 44px。Semi 在这种情况下仍渲染一个空头部(上下内边距 24px + 20px),
|
|
@@ -17,6 +57,8 @@
|
|
|
17
57
|
(`exhausted`,例如全站名额先发完)变橙色,不限(`UNLIMITED_QUOTA` 及以上)只写已用多少,读取中显示“…”,读不到显示“暂不可用”。
|
|
18
58
|
- 组件总览页新增「额度条」,账号菜单的示例带上一条额度。
|
|
19
59
|
|
|
60
|
+
## 0.3.0
|
|
61
|
+
|
|
20
62
|
**暗色模式**
|
|
21
63
|
|
|
22
64
|
默认仍然只有浅色,已接入的产品升级后外观不变(浅色下总览页截图与 0.2.1 对比,只有文字提示的小箭头颜色一处修正)。
|
package/GUIDELINES.md
CHANGED
|
@@ -97,6 +97,8 @@
|
|
|
97
97
|
|
|
98
98
|
- 展示尺寸 36、40、48、56、64 只用于大数字和大图标,直接写数值。其他数值(17、22、30……)不要出现。
|
|
99
99
|
- 字重:正文 400;标题、选中项、强调数值 500;外壳导航的选中项和账号区的名称 600;价格和指标卡的大数字 700。
|
|
100
|
+
Semi 的 `Typography.Title`、`Text strong`、卡片与弹窗标题、分段选择的选中项已由主题统一成 500,链接是 400(靠颜色区分);
|
|
101
|
+
个别标题要更重时传 `weight`,不要在产品样式里把 Semi 的标题整体改回 600。
|
|
100
102
|
- 数字:表格、指标、价格用等宽数字(`font-variant-numeric: tabular-nums`);指标卡和看板里的大数字用 `--app-font-family-number`。
|
|
101
103
|
- 一页里字号不超过四档;靠字号和颜色的层级区分主次,不靠加粗一切。
|
|
102
104
|
|
|
@@ -173,8 +175,10 @@
|
|
|
173
175
|
| 行内轻操作:查看、编辑 | `theme="borderless" type="primary"` |
|
|
174
176
|
| 危险操作:删除、移除 | `type="danger"`,并用 `Popconfirm` 或确认弹窗二次确认 |
|
|
175
177
|
|
|
176
|
-
- 要跳到别的地址(账号中心、下载)用 `LinkButton` 或 `TextLink`,不用带 `onClick`
|
|
177
|
-
|
|
178
|
+
- 要跳到别的地址(账号中心、下载)用 `LinkButton` 或 `TextLink`,不用带 `onClick` 跳转的按钮。两者都把 ref 和事件转给里面的链接元素,
|
|
179
|
+
可以直接包在 `Tooltip`、`Popover`、`Popconfirm` 里当触发元素。自己写的组件要当触发元素,同样得 `forwardRef` 并把其余属性传到根元素上,
|
|
180
|
+
否则气泡定位不到、点外面也关不掉。
|
|
181
|
+
- 只有图标的按钮必须有 `aria-label`;按钮文字旁的装饰图标加 `aria-hidden="true"`。圆形的图标按钮加 `circle`。
|
|
178
182
|
- 列表里每项的低频操作(复制、移动、删除)收进“⋯”菜单。
|
|
179
183
|
|
|
180
184
|
**卡片**:默认无边框白底加投影(`bordered={false}`);可点的卡片加 `shadows="hover"`;底部操作用 `actions`(均分整行)。
|
|
@@ -208,6 +212,20 @@
|
|
|
208
212
|
**弹窗与抽屉**:表单和确认用 `Modal`,看详情用 `SideSheet`(加 `closeOnEsc`);头部吸顶、关闭按钮始终可见;
|
|
209
213
|
弹窗内部滚动,不叠加外层页面滚动条;脚部按钮用 `modalButtonProps()`;一个弹窗只做一件事,不在弹窗里再开弹窗。
|
|
210
214
|
|
|
215
|
+
- 弹窗默认上下居中、标题左对齐(引入 `@24city/web-console/semi` 后生效,`Modal.confirm` 一样);个别要靠上的传 `centered={false}`。
|
|
216
|
+
- 宽度用 `width` 属性,不写在样式里(见下表)。
|
|
217
|
+
- 脚部优先用默认的“取消 / 确定”。要自己排版(左边一句说明、右边按钮)时包一层自己的容器,用 flex + `gap` 排;
|
|
218
|
+
主题不再给这种脚部里的按钮加外边距。直接放进 `footer` 的按钮(`footer={<><Button /><Button /></>}`)相邻两个之间留 12px。
|
|
219
|
+
|
|
220
|
+
Semi 把 `className` 挂在哪个元素上因组件而异,写样式前先对一下,挂错了规则不报错、只是不生效:
|
|
221
|
+
|
|
222
|
+
| 组件 | `className` 所在元素 | 怎么写 |
|
|
223
|
+
| --- | --- | --- |
|
|
224
|
+
| `Modal` | 最外层包装(遮罩和弹窗的共同父元素),不是 `.semi-modal` | 宽度用 `width`;内容层用 `modalContentClass`;内容区用 `bodyStyle` |
|
|
225
|
+
| `SideSheet` | 最外层 `.semi-sidesheet`(含遮罩) | 宽度用 `width`;面板用 `style`、`bodyStyle` |
|
|
226
|
+
| `Input`、`TextArea` | 包装层(`.semi-input-wrapper`、`.semi-input-textarea-wrapper`) | 要作用到 `textarea` 本身用 `textareaStyle` |
|
|
227
|
+
| `Button`、`Card`、`Tabs`、`Upload`、`Image`、`Avatar`、`Empty` | 根元素自己 | 直接写在自己的类上 |
|
|
228
|
+
|
|
211
229
|
**表单**(`/form`):标签在上;整齐、直接、能快速扫完。
|
|
212
230
|
|
|
213
231
|
- 字段用 `Field` 包住控件(自己管状态的受控控件),或者用 Semi `Form` 的字段;两种写出来是同一个样子,不再手写“标签 + 控件”的布局。
|
package/dist/account/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { A as e, a as t, c as o, b as n, i as r, d as i, l as u, n as c, r as l, e as g, f as p, u as A, g as S, w as P } from "../chunks/logout-signal-CiD_zY5M.js";
|
|
2
|
-
import { A as C, a as d, C as f, L as h, P as m, b as y, c as N, Q as T, R as E, S as O, d as b, T as U, U as F, e as _, p as w, f as x, g as v, h as B, y as R } from "../chunks/upgrade-modal-
|
|
2
|
+
import { A as C, a as d, C as f, L as h, P as m, b as y, c as N, Q as T, R as E, S as O, d as b, T as U, U as F, e as _, p as w, f as x, g as v, h as B, y as R } from "../chunks/upgrade-modal-DyPkV9OB.js";
|
|
3
3
|
import { A as M, a as q, b as D, E as K, F as Q, P as G, c as H, d as k, U as W, e as Y, W as j, f as z, g as J, h as V, i as X, j as Z, k as $, l as aa, m as sa, n as ea, o as ta, p as oa, q as na, r as ra, s as ia, t as ua, u as ca, v as la, w as ga, x as pa, y as Aa, z as Sa, B as Pa, C as La, D as Ca, G as da, H as fa, I as ha, J as ma, K as ya, L as Na, M as Ta, N as Ea, O as Oa, Q as ba } from "../chunks/wallet-badge-Dt8fv-Du.js";
|
|
4
4
|
import { A as Fa } from "../chunks/auth-provider-CqiyTeOt.js";
|
|
5
5
|
import { notifyCustomerSessionChanged as wa, subscribeCustomerSessionChanges as xa } from "@24city/web-runtime/session-sync";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as e, jsxs as x } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as y } from "react";
|
|
3
|
+
const g = "_linkButton_vk9fy_2", N = "_icon_vk9fy_16", r = {
|
|
4
|
+
linkButton: g,
|
|
5
|
+
icon: N
|
|
6
|
+
}, w = y(function({ href: b, target: i, rel: u, theme: h = "light", type: p = "tertiary", size: l = "default", block: k = !1, icon: s, iconPosition: o = "left", className: a, children: t, ..._ }, B) {
|
|
7
|
+
const f = t != null && t !== !1 && t !== "", n = ["semi-button", `semi-button-${p}`, `semi-button-${h}`, r.linkButton];
|
|
8
|
+
l !== "default" && n.push(`semi-button-size-${l}`), k && n.push("semi-button-block"), s && n.push("semi-button-with-icon"), s && !f && n.push("semi-button-with-icon-only"), a && n.push(a);
|
|
9
|
+
const m = s ? /* @__PURE__ */ e("span", { className: r.icon, children: s }) : null, c = f ? s ? /* @__PURE__ */ e("span", { className: o === "right" ? "semi-button-content-left" : "semi-button-content-right", children: t }) : t : null;
|
|
10
|
+
return /* @__PURE__ */ e("a", { ..._, ref: B, className: n.join(" "), href: b, target: i, rel: i === "_blank" ? u ?? "noreferrer" : u, children: /* @__PURE__ */ x("span", { className: "semi-button-content", children: [
|
|
11
|
+
o === "right" ? c : m,
|
|
12
|
+
o === "right" ? m : c
|
|
13
|
+
] }) });
|
|
14
|
+
});
|
|
15
|
+
export {
|
|
16
|
+
w as L
|
|
17
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsx as n, jsxs as u, Fragment as z } from "react/jsx-runtime";
|
|
2
|
+
import { Button as p, Typography as F } from "@douyinfe/semi-ui";
|
|
3
|
+
import { useNavigate as O } from "react-router";
|
|
4
|
+
import { b as S } from "./context-CaVim6ZO.js";
|
|
5
|
+
import { F as f, e as g } from "./page-YBG0dEN1.js";
|
|
6
|
+
import { useId as j, cloneElement as E, forwardRef as L } from "react";
|
|
7
|
+
const Q = () => {
|
|
8
|
+
const { config: i } = S(), r = O();
|
|
9
|
+
return /* @__PURE__ */ n(f, { children: /* @__PURE__ */ n(
|
|
10
|
+
g,
|
|
11
|
+
{
|
|
12
|
+
status: "not-found",
|
|
13
|
+
title: "页面不存在",
|
|
14
|
+
description: "请检查地址,或返回产品首页继续。",
|
|
15
|
+
extra: /* @__PURE__ */ n(p, { theme: "solid", type: "primary", onClick: () => r(i.routes.publicHome), children: "返回首页" })
|
|
16
|
+
}
|
|
17
|
+
) });
|
|
18
|
+
}, P = "_srOnly_1mfs8_2", R = {
|
|
19
|
+
srOnly: P
|
|
20
|
+
}, U = ({ label: i, children: r }) => {
|
|
21
|
+
const t = j();
|
|
22
|
+
return /* @__PURE__ */ u(z, { children: [
|
|
23
|
+
/* @__PURE__ */ n("span", { id: t, className: R.srOnly, children: i }),
|
|
24
|
+
E(r, { "aria-labelledby": t })
|
|
25
|
+
] });
|
|
26
|
+
}, V = () => /* @__PURE__ */ n(f, { children: /* @__PURE__ */ n("div", { role: "alert", children: /* @__PURE__ */ n(
|
|
27
|
+
g,
|
|
28
|
+
{
|
|
29
|
+
status: "error",
|
|
30
|
+
title: "应用配置暂时无法加载",
|
|
31
|
+
description: "启动检查未通过。请检查运行时配置和网络连接后重新加载。",
|
|
32
|
+
extra: /* @__PURE__ */ n(p, { theme: "solid", type: "primary", onClick: () => window.location.reload(), children: "重新加载" })
|
|
33
|
+
}
|
|
34
|
+
) }) }), B = "_link_1mzr6_2", C = "_danger_1mzr6_28", I = "_warning_1mzr6_33", H = "_icon_1mzr6_38", s = {
|
|
35
|
+
link: B,
|
|
36
|
+
danger: C,
|
|
37
|
+
warning: I,
|
|
38
|
+
icon: H
|
|
39
|
+
}, W = L(function({ href: r, target: t, rel: c, download: _, onClick: a, onKeyDown: l, icon: d, status: m, disabled: o = !1, className: y, style: h, role: k, tabIndex: x, children: w, ...N }, b) {
|
|
40
|
+
const T = [s.link, m === "danger" ? s.danger : m === "warning" ? s.warning : "", y ?? ""].filter(Boolean).join(" "), v = {
|
|
41
|
+
...N,
|
|
42
|
+
ref: b,
|
|
43
|
+
href: r,
|
|
44
|
+
target: t,
|
|
45
|
+
rel: t === "_blank" ? c ?? "noreferrer" : c,
|
|
46
|
+
download: _,
|
|
47
|
+
onClick: o ? void 0 : a,
|
|
48
|
+
onKeyDown: (e) => {
|
|
49
|
+
l == null || l(e), !(e.defaultPrevented || r || o || !a) && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), a(e));
|
|
50
|
+
},
|
|
51
|
+
role: k ?? (r ? void 0 : "button"),
|
|
52
|
+
tabIndex: x ?? (r || o ? void 0 : 0),
|
|
53
|
+
"aria-disabled": o || void 0
|
|
54
|
+
};
|
|
55
|
+
return /* @__PURE__ */ u(F.Text, { link: v, disabled: o, className: T, style: h, children: [
|
|
56
|
+
d ? /* @__PURE__ */ n("span", { className: s.icon, children: d }) : null,
|
|
57
|
+
w
|
|
58
|
+
] });
|
|
59
|
+
});
|
|
60
|
+
export {
|
|
61
|
+
Q as N,
|
|
62
|
+
U as S,
|
|
63
|
+
W as T,
|
|
64
|
+
V as a
|
|
65
|
+
};
|