clxx 3.0.2 → 3.0.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.
- package/AGENTS.md +49 -3
- package/build/Alert/style.js +15 -14
- package/build/CarouselNotice/style.js +2 -1
- package/build/CitySelect/style.js +40 -39
- package/build/Container/index.js +21 -1
- package/build/DatePicker/style.d.ts +1 -1
- package/build/DatePicker/style.js +25 -24
- package/build/Indicator/index.js +2 -1
- package/build/Loading/Wrapper.js +3 -2
- package/build/Loading/style.js +7 -6
- package/build/MapLocationSelection/buildSelectedLocation.d.ts +16 -0
- package/build/MapLocationSelection/buildSelectedLocation.js +123 -0
- package/build/MapLocationSelection/createProvider.d.ts +8 -0
- package/build/MapLocationSelection/createProvider.js +33 -0
- package/build/MapLocationSelection/getLocation.d.ts +8 -0
- package/build/MapLocationSelection/getLocation.js +112 -0
- package/build/MapLocationSelection/index.d.ts +16 -0
- package/build/MapLocationSelection/index.js +985 -0
- package/build/MapLocationSelection/loader.amap.d.ts +48 -0
- package/build/MapLocationSelection/loader.amap.js +125 -0
- package/build/MapLocationSelection/loader.bmap.d.ts +8 -0
- package/build/MapLocationSelection/loader.bmap.js +60 -0
- package/build/MapLocationSelection/provider.amap.d.ts +38 -0
- package/build/MapLocationSelection/provider.amap.js +659 -0
- package/build/MapLocationSelection/provider.bmap.d.ts +36 -0
- package/build/MapLocationSelection/provider.bmap.js +837 -0
- package/build/MapLocationSelection/provider.d.ts +45 -0
- package/build/MapLocationSelection/provider.js +10 -0
- package/build/MapLocationSelection/style.d.ts +4 -0
- package/build/MapLocationSelection/style.js +442 -0
- package/build/MapLocationSelection/types.d.ts +29 -0
- package/build/MapLocationSelection/types.js +22 -0
- package/build/MapLocationSelection/userMarker.d.ts +2 -0
- package/build/MapLocationSelection/userMarker.js +95 -0
- package/build/RegionPicker/style.js +34 -33
- package/build/ScrollView/style.js +5 -4
- package/build/Toast/style.js +6 -5
- package/build/index.d.ts +3 -0
- package/build/index.js +8 -2
- package/build/utils/rem.d.ts +1 -0
- package/build/utils/rem.js +48 -0
- package/package.json +2 -2
- package/test/src/index/index.jsx +5 -0
- package/test/src/index.jsx +1 -0
- package/test/src/map-location-selection/index.jsx +192 -0
package/AGENTS.md
CHANGED
|
@@ -1,3 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
本仓库是面向移动端 H5 的基础组件库 `clxx`(React 19 + TypeScript + @emotion/react),以下规则对所有 AI Agent 在本工程内的工作均有效。
|
|
4
|
+
|
|
5
|
+
## 1. 沟通约定
|
|
6
|
+
|
|
7
|
+
- 所有回复使用中文。
|
|
8
|
+
- 不主动 push 到远程;除非用户显式要求,否则只做本地改动。
|
|
9
|
+
- 任务执行完成后,需自检产物:不允许遗留报错(编译 / 类型 / Lint),除非用户主动要求保留。
|
|
10
|
+
|
|
11
|
+
## 2. 项目结构
|
|
12
|
+
|
|
13
|
+
- `src/`:组件库源码,按 PascalCase 目录组织,每个组件一个目录(如 `Toast/`、`MapLocationSelection/`)。
|
|
14
|
+
- 目录内常见文件:`index.tsx`(导出入口)、`style.ts`(emotion 样式)、子组件 `*.tsx`。
|
|
15
|
+
- `src/Effect/` 存放自定义 hooks,`src/utils/` 存放无 React 依赖的工具函数。
|
|
16
|
+
- 对外导出统一在 `src/index.ts` 维护。
|
|
17
|
+
- `test/`:基于 Vite 的本地预览工程,**只用于演示与人工验证 `src/` 下的组件**,不得承载业务逻辑。
|
|
18
|
+
- 子目录使用 kebab-case(如 `map-location-selection/`),与 `src` 下的 PascalCase 目录一一对应。
|
|
19
|
+
|
|
20
|
+
## 3. 代码规范
|
|
21
|
+
|
|
22
|
+
- **一个文件只允许导出一个 React 组件**;同一文件内的辅助子组件必须拆分到独立文件。
|
|
23
|
+
- 组件文件使用 `.tsx`,纯逻辑 / 类型 / 工具使用 `.ts`。
|
|
24
|
+
- 样式优先使用 `@emotion/react`,写在同目录的 `style.ts` 中;避免引入新的 CSS-in-JS 方案。
|
|
25
|
+
- 公共依赖:`react@^19`、`@emotion/react`、`dayjs`、`lodash`、`history`;新增第三方依赖前先确认是否已有等价能力。
|
|
26
|
+
- TypeScript 严格类型:禁止用 `any` 屏蔽类型问题;导出的 props/类型放在组件文件顶部并显式 `export`。
|
|
27
|
+
- 注释只解释「为什么」与不易看出的约束,禁止逐行翻译代码。
|
|
28
|
+
|
|
29
|
+
## 4. Container 约束(强制)
|
|
30
|
+
|
|
31
|
+
本库所有组件的 `rem` 自适应、最大宽度居中、CSS 变量 `--clxx-max-width` 等能力均由 `src/Container` 提供。
|
|
32
|
+
|
|
33
|
+
- 任何使用本库的页面 / Demo / 测试入口,**必须把 `Container` 作为根组件**包裹其它组件,否则尺寸会失真。
|
|
34
|
+
- 修改 `Container` 时需同时验证 `Overlay`、`Fixed`、弹窗类组件(`Dialog`、`Toast`、`Alert`、`Loading`、`*Picker` 等)在 PC 端居中与最大宽度限制下的表现。
|
|
35
|
+
|
|
36
|
+
## 5. 测试与本地运行
|
|
37
|
+
|
|
38
|
+
- `test/` 工程:`cd test && npm run dev` 启动本地预览。
|
|
39
|
+
- 库本身:`npm run dev`(tsc watch)/ `npm run build`(清理后产出到 `build/`)。
|
|
40
|
+
- 新增 / 修改组件时,应在 `test/src/<对应目录>/` 下补充或更新最小可运行 Demo。
|
|
41
|
+
- 临时为调试创建、与正常逻辑无关的测试文件 / 代码,**任务完成前必须删除**。
|
|
42
|
+
|
|
43
|
+
## 6. 质量门禁
|
|
44
|
+
|
|
45
|
+
- 任何修改完成后,先自检:
|
|
46
|
+
1. 是否引入新 bug 或破坏既有用例;如有,**必须修复**。
|
|
47
|
+
2. 是否影响公共导出(`src/index.ts`)的兼容性。
|
|
48
|
+
3. 是否在 `Container` 之外破坏了自适应行为。
|
|
49
|
+
- 涉及 `peerDependencies`(React/ReactDOM)相关 API 的改动,需确保仍兼容 React 19。
|
package/build/Alert/style.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.style = void 0;
|
|
4
4
|
const theme_1 = require("../utils/theme");
|
|
5
|
+
const rem_1 = require("../utils/rem");
|
|
5
6
|
// 1px 硬边框(高清屏 hairline)
|
|
6
7
|
const hairline = 1 / (typeof window !== "undefined" ? window.devicePixelRatio : 1);
|
|
7
8
|
// iOS 风色板
|
|
@@ -13,20 +14,20 @@ exports.style = {
|
|
|
13
14
|
position: "relative",
|
|
14
15
|
overflow: "hidden",
|
|
15
16
|
backgroundColor: "#ffffff",
|
|
16
|
-
borderRadius:
|
|
17
|
-
width: (750 * 0.78)
|
|
17
|
+
borderRadius: (0, rem_1.r)(28),
|
|
18
|
+
width: (0, rem_1.r)(750 * 0.78),
|
|
18
19
|
fontFamily: theme_1.fontStack,
|
|
19
20
|
color: textPrimary,
|
|
20
21
|
WebkitFontSmoothing: "antialiased",
|
|
21
22
|
MozOsxFontSmoothing: "grayscale",
|
|
22
|
-
boxShadow:
|
|
23
|
+
boxShadow: `0 ${(0, rem_1.r)(20)} ${(0, rem_1.r)(60)} rgba(0,0,0,.18)`,
|
|
23
24
|
},
|
|
24
25
|
content: {
|
|
25
26
|
position: "relative",
|
|
26
|
-
paddingTop:
|
|
27
|
-
paddingBottom:
|
|
28
|
-
paddingLeft:
|
|
29
|
-
paddingRight:
|
|
27
|
+
paddingTop: (0, rem_1.r)(40),
|
|
28
|
+
paddingBottom: (0, rem_1.r)(40),
|
|
29
|
+
paddingLeft: (0, rem_1.r)(36),
|
|
30
|
+
paddingRight: (0, rem_1.r)(36),
|
|
30
31
|
"&:after,&::after": {
|
|
31
32
|
content: "''",
|
|
32
33
|
position: "absolute",
|
|
@@ -43,21 +44,21 @@ exports.style = {
|
|
|
43
44
|
textAlign: "center",
|
|
44
45
|
lineHeight: 1.45,
|
|
45
46
|
color: textPrimary,
|
|
46
|
-
fontSize:
|
|
47
|
+
fontSize: (0, rem_1.r)(34),
|
|
47
48
|
fontWeight: 600,
|
|
48
|
-
letterSpacing:
|
|
49
|
+
letterSpacing: (0, rem_1.r)(1),
|
|
49
50
|
},
|
|
50
51
|
desc: {
|
|
51
52
|
textAlign: "center",
|
|
52
53
|
lineHeight: 1.55,
|
|
53
54
|
color: textSecondary,
|
|
54
|
-
fontSize:
|
|
55
|
-
marginTop:
|
|
55
|
+
fontSize: (0, rem_1.r)(28),
|
|
56
|
+
marginTop: (0, rem_1.r)(18),
|
|
56
57
|
wordBreak: "break-word",
|
|
57
58
|
},
|
|
58
59
|
btnBox: {
|
|
59
60
|
position: "relative",
|
|
60
|
-
height:
|
|
61
|
+
height: (0, rem_1.r)(92),
|
|
61
62
|
},
|
|
62
63
|
btnBoxWithCancel: {
|
|
63
64
|
"&:after,&::after": {
|
|
@@ -79,9 +80,9 @@ exports.style = {
|
|
|
79
80
|
alignItems: "center",
|
|
80
81
|
justifyContent: "center",
|
|
81
82
|
userSelect: "none",
|
|
82
|
-
fontSize:
|
|
83
|
+
fontSize: (0, rem_1.r)(32),
|
|
83
84
|
fontWeight: 500,
|
|
84
|
-
letterSpacing:
|
|
85
|
+
letterSpacing: (0, rem_1.r)(1),
|
|
85
86
|
cursor: "pointer",
|
|
86
87
|
transition: "background-color .12s",
|
|
87
88
|
},
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.style = exports.Bubble = void 0;
|
|
4
4
|
const react_1 = require("@emotion/react");
|
|
5
|
+
const rem_1 = require("../utils/rem");
|
|
5
6
|
// translate 走百分比;fill-mode: forwards 保证动画结束后定格在 -50%,
|
|
6
7
|
// 与 React 的 setState 提交顺序解耦,杜绝"动画结束帧"回弹到 0 造成的闪烁
|
|
7
8
|
exports.Bubble = (0, react_1.keyframes) `
|
|
@@ -16,7 +17,7 @@ exports.style = {
|
|
|
16
17
|
box: {
|
|
17
18
|
position: "relative",
|
|
18
19
|
overflow: "hidden",
|
|
19
|
-
height:
|
|
20
|
+
height: (0, rem_1.r)(80),
|
|
20
21
|
},
|
|
21
22
|
wrapper: {
|
|
22
23
|
position: "absolute",
|
|
@@ -5,6 +5,7 @@ exports.createStyle = createStyle;
|
|
|
5
5
|
const react_1 = require("@emotion/react");
|
|
6
6
|
const color_1 = require("../utils/color");
|
|
7
7
|
const theme_1 = require("../utils/theme");
|
|
8
|
+
const rem_1 = require("../utils/rem");
|
|
8
9
|
// 设计变量
|
|
9
10
|
const textPrimary = "#1f2328";
|
|
10
11
|
const textSecondary = "#6b7280";
|
|
@@ -32,22 +33,22 @@ function createStyle(primary) {
|
|
|
32
33
|
sidebar: (0, react_1.css)({
|
|
33
34
|
position: "absolute",
|
|
34
35
|
top: "50%",
|
|
35
|
-
right:
|
|
36
|
+
right: (0, rem_1.r)(12),
|
|
36
37
|
transform: "translateY(-50%)",
|
|
37
38
|
zIndex: 2,
|
|
38
|
-
padding:
|
|
39
|
-
borderRadius:
|
|
39
|
+
padding: `${(0, rem_1.r)(10)} ${(0, rem_1.r)(6)}`,
|
|
40
|
+
borderRadius: (0, rem_1.r)(30),
|
|
40
41
|
display: "flex",
|
|
41
42
|
flexDirection: "column",
|
|
42
43
|
alignItems: "center",
|
|
43
|
-
gap:
|
|
44
|
+
gap: (0, rem_1.r)(2),
|
|
44
45
|
}),
|
|
45
46
|
letter: (0, react_1.css)({
|
|
46
|
-
width:
|
|
47
|
-
height:
|
|
48
|
-
lineHeight:
|
|
47
|
+
width: (0, rem_1.r)(36),
|
|
48
|
+
height: (0, rem_1.r)(36),
|
|
49
|
+
lineHeight: (0, rem_1.r)(36),
|
|
49
50
|
textAlign: "center",
|
|
50
|
-
fontSize:
|
|
51
|
+
fontSize: (0, rem_1.r)(22),
|
|
51
52
|
fontFamily: "Arial, sans-serif",
|
|
52
53
|
fontWeight: 500,
|
|
53
54
|
borderRadius: "50%",
|
|
@@ -68,12 +69,12 @@ function createStyle(primary) {
|
|
|
68
69
|
transform: "translate(-50%, -50%)",
|
|
69
70
|
backgroundColor: "rgba(0,0,0,0.55)",
|
|
70
71
|
color: "#fff",
|
|
71
|
-
fontSize:
|
|
72
|
-
width:
|
|
73
|
-
height:
|
|
74
|
-
lineHeight:
|
|
72
|
+
fontSize: (0, rem_1.r)(60),
|
|
73
|
+
width: (0, rem_1.r)(140),
|
|
74
|
+
height: (0, rem_1.r)(140),
|
|
75
|
+
lineHeight: (0, rem_1.r)(140),
|
|
75
76
|
textAlign: "center",
|
|
76
|
-
borderRadius:
|
|
77
|
+
borderRadius: (0, rem_1.r)(24),
|
|
77
78
|
pointerEvents: "none",
|
|
78
79
|
}),
|
|
79
80
|
original: (0, react_1.css)({
|
|
@@ -81,20 +82,20 @@ function createStyle(primary) {
|
|
|
81
82
|
backgroundColor: bgPage,
|
|
82
83
|
}),
|
|
83
84
|
top: (0, react_1.css)({
|
|
84
|
-
padding:
|
|
85
|
+
padding: `${(0, rem_1.r)(24)} ${(0, rem_1.r)(30)}`,
|
|
85
86
|
borderBottom: `1px solid ${border}`,
|
|
86
87
|
"& > div": {
|
|
87
|
-
height:
|
|
88
|
+
height: (0, rem_1.r)(72),
|
|
88
89
|
backgroundColor: bgSubtle,
|
|
89
|
-
padding:
|
|
90
|
-
borderRadius:
|
|
90
|
+
padding: `0 ${(0, rem_1.r)(24)}`,
|
|
91
|
+
borderRadius: (0, rem_1.r)(36),
|
|
91
92
|
},
|
|
92
93
|
}),
|
|
93
94
|
icon: (0, react_1.css)({
|
|
94
|
-
width:
|
|
95
|
-
height:
|
|
95
|
+
width: (0, rem_1.r)(32),
|
|
96
|
+
height: (0, rem_1.r)(32),
|
|
96
97
|
fill: textTertiary,
|
|
97
|
-
marginRight:
|
|
98
|
+
marginRight: (0, rem_1.r)(15),
|
|
98
99
|
fontSize: 0,
|
|
99
100
|
flexShrink: 0,
|
|
100
101
|
}),
|
|
@@ -102,8 +103,8 @@ function createStyle(primary) {
|
|
|
102
103
|
flexGrow: 1,
|
|
103
104
|
height: "100%",
|
|
104
105
|
minWidth: 0,
|
|
105
|
-
fontSize:
|
|
106
|
-
lineHeight:
|
|
106
|
+
fontSize: (0, rem_1.r)(28),
|
|
107
|
+
lineHeight: (0, rem_1.r)(72),
|
|
107
108
|
color: textPrimary,
|
|
108
109
|
fontFamily: "inherit",
|
|
109
110
|
border: "none",
|
|
@@ -112,14 +113,14 @@ function createStyle(primary) {
|
|
|
112
113
|
padding: 0,
|
|
113
114
|
"&::placeholder": {
|
|
114
115
|
color: textTertiary,
|
|
115
|
-
lineHeight:
|
|
116
|
+
lineHeight: (0, rem_1.r)(72),
|
|
116
117
|
},
|
|
117
118
|
}),
|
|
118
119
|
exit: (0, react_1.css)({
|
|
119
120
|
whiteSpace: "nowrap",
|
|
120
|
-
marginLeft:
|
|
121
|
-
lineHeight:
|
|
122
|
-
fontSize:
|
|
121
|
+
marginLeft: (0, rem_1.r)(20),
|
|
122
|
+
lineHeight: (0, rem_1.r)(72),
|
|
123
|
+
fontSize: (0, rem_1.r)(28),
|
|
123
124
|
color: primary,
|
|
124
125
|
cursor: "pointer",
|
|
125
126
|
transition: "opacity .15s, color .15s",
|
|
@@ -138,7 +139,7 @@ function createStyle(primary) {
|
|
|
138
139
|
locate: (0, react_1.css)({
|
|
139
140
|
display: "flex",
|
|
140
141
|
alignItems: "center",
|
|
141
|
-
padding:
|
|
142
|
+
padding: `${(0, rem_1.r)(20)} ${(0, rem_1.r)(23)}`,
|
|
142
143
|
borderBottom: `1px solid ${border}`,
|
|
143
144
|
backgroundColor: bgPage,
|
|
144
145
|
transition: "background-color .12s",
|
|
@@ -147,28 +148,28 @@ function createStyle(primary) {
|
|
|
147
148
|
},
|
|
148
149
|
}),
|
|
149
150
|
locateIcon: (0, react_1.css)({
|
|
150
|
-
width:
|
|
151
|
-
height:
|
|
151
|
+
width: (0, rem_1.r)(32),
|
|
152
|
+
height: (0, rem_1.r)(32),
|
|
152
153
|
fill: primary,
|
|
153
|
-
marginRight:
|
|
154
|
+
marginRight: (0, rem_1.r)(16),
|
|
154
155
|
fontSize: 0,
|
|
155
156
|
flexShrink: 0,
|
|
156
157
|
}),
|
|
157
158
|
locateLabel: (0, react_1.css)({
|
|
158
|
-
fontSize:
|
|
159
|
+
fontSize: (0, rem_1.r)(24),
|
|
159
160
|
color: textTertiary,
|
|
160
|
-
marginRight:
|
|
161
|
+
marginRight: (0, rem_1.r)(16),
|
|
161
162
|
}),
|
|
162
163
|
locateName: (0, react_1.css)({
|
|
163
|
-
fontSize:
|
|
164
|
+
fontSize: (0, rem_1.r)(24),
|
|
164
165
|
color: primary,
|
|
165
166
|
}),
|
|
166
167
|
title: (0, react_1.css)({
|
|
167
|
-
padding:
|
|
168
|
-
fontSize:
|
|
168
|
+
padding: `${(0, rem_1.r)(8)} ${(0, rem_1.r)(30)}`,
|
|
169
|
+
fontSize: (0, rem_1.r)(22),
|
|
169
170
|
fontWeight: 600,
|
|
170
171
|
color: textSecondary,
|
|
171
|
-
letterSpacing:
|
|
172
|
+
letterSpacing: (0, rem_1.r)(2),
|
|
172
173
|
textTransform: "uppercase",
|
|
173
174
|
backgroundColor: bgSubtle,
|
|
174
175
|
position: "sticky",
|
|
@@ -176,8 +177,8 @@ function createStyle(primary) {
|
|
|
176
177
|
zIndex: 1,
|
|
177
178
|
}),
|
|
178
179
|
item: (0, react_1.css)({
|
|
179
|
-
padding:
|
|
180
|
-
fontSize:
|
|
180
|
+
padding: `${(0, rem_1.r)(24)} ${(0, rem_1.r)(30)}`,
|
|
181
|
+
fontSize: (0, rem_1.r)(30),
|
|
181
182
|
color: textPrimary,
|
|
182
183
|
borderBottom: `1px solid ${border}`,
|
|
183
184
|
backgroundColor: bgPage,
|
|
@@ -199,7 +200,7 @@ function createStyle(primary) {
|
|
|
199
200
|
alignItems: "center",
|
|
200
201
|
justifyContent: "center",
|
|
201
202
|
color: textTertiary,
|
|
202
|
-
fontSize:
|
|
203
|
+
fontSize: (0, rem_1.r)(26),
|
|
203
204
|
}),
|
|
204
205
|
};
|
|
205
206
|
}
|
package/build/Container/index.js
CHANGED
|
@@ -91,6 +91,25 @@ function Container(props) {
|
|
|
91
91
|
document.body.removeEventListener("touchstart", noop);
|
|
92
92
|
};
|
|
93
93
|
}, []);
|
|
94
|
+
// --clxx-px:库内组件统一基于 750 设计稿做尺寸(用 utils/rem.ts 的 r() helper),
|
|
95
|
+
// 与用户的 designWidth 完全解耦。否则用户传 designWidth=375 时,库内写死的
|
|
96
|
+
// ".28rem"(按 750 设计稿出)会被 html fontSize 放大一倍,导致整个库视觉错位。
|
|
97
|
+
//
|
|
98
|
+
// 计算口径:1 个「750 设计稿 px」在当前视口下应该渲染成多少 css px:
|
|
99
|
+
// --clxx-px = clamp(viewport, maxWidth) / 750
|
|
100
|
+
// 视口 750 → 1
|
|
101
|
+
// 视口 375 → 0.5
|
|
102
|
+
// 视口 1080 → 1.44
|
|
103
|
+
// r(28) = calc(28 * var(--clxx-px)) = 视口比例下的 28 设计稿 px。
|
|
104
|
+
const LIB_DESIGN_WIDTH = 750;
|
|
105
|
+
const clxxPx = (0, react_2.useMemo)(() => {
|
|
106
|
+
// 字号缩放修正同样要应用:浏览器把 html 字号放大 N 倍时,rem 字面量会跟着放大;
|
|
107
|
+
// --clxx-px 也必须 / scaleFactor 才能保持库内尺寸的稳定。
|
|
108
|
+
const raw = viewportWidth / LIB_DESIGN_WIDTH;
|
|
109
|
+
const fixed = scaleFactor === 1 ? raw : raw / scaleFactor;
|
|
110
|
+
// 4 位小数已远超 1 设备 px 精度,避免浮点串导致 css 变量频繁字符串变化
|
|
111
|
+
return Math.round(fixed * 10000) / 10000;
|
|
112
|
+
}, [viewportWidth, scaleFactor]);
|
|
94
113
|
// 全局样式:fontSize 写入 html,rem 自动跟随
|
|
95
114
|
// body 以 maxWidth 居中,保证 PC 端上页面不超过设计宽度,两侧留白
|
|
96
115
|
// CSS 变量 --clxx-max-width 供 Overlay/Fixed 等使用 fixed 定位的组件读取
|
|
@@ -100,6 +119,7 @@ function Container(props) {
|
|
|
100
119
|
{
|
|
101
120
|
":root": {
|
|
102
121
|
"--clxx-max-width": hasMaxWidth ? `${maxWidth}px` : "100%",
|
|
122
|
+
"--clxx-px": `${clxxPx}px`,
|
|
103
123
|
},
|
|
104
124
|
"*": {
|
|
105
125
|
boxSizing: "border-box",
|
|
@@ -114,6 +134,6 @@ function Container(props) {
|
|
|
114
134
|
body: Object.assign({ fontSize: "16px", margin: "0 auto" }, (hasMaxWidth ? { maxWidth: `${maxWidth}px` } : null)),
|
|
115
135
|
},
|
|
116
136
|
globalStyle,
|
|
117
|
-
], [fontSize, maxWidth, hasMaxWidth, globalStyle]);
|
|
137
|
+
], [fontSize, maxWidth, hasMaxWidth, clxxPx, globalStyle]);
|
|
118
138
|
return ((0, jsx_runtime_1.jsxs)(react_2.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_1.Global, { styles: globalStyles }), children] }));
|
|
119
139
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Interpolation, Theme } from "@emotion/react";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const ITEM_HEIGHT_PX = 80;
|
|
3
3
|
export declare const VISIBLE_ROWS = 5;
|
|
4
4
|
export type DatePickerStyle = Record<string, Interpolation<Theme>>;
|
|
5
5
|
export declare function createStyle(primary: string, rounded?: boolean): DatePickerStyle;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_PRIMARY = exports.VISIBLE_ROWS = exports.
|
|
3
|
+
exports.DEFAULT_PRIMARY = exports.VISIBLE_ROWS = exports.ITEM_HEIGHT_PX = void 0;
|
|
4
4
|
exports.createStyle = createStyle;
|
|
5
5
|
const react_1 = require("@emotion/react");
|
|
6
6
|
const color_1 = require("../utils/color");
|
|
7
7
|
const theme_1 = require("../utils/theme");
|
|
8
|
+
const rem_1 = require("../utils/rem");
|
|
8
9
|
// 与 CitySelect 一致的设计变量(带线条风格)
|
|
9
10
|
const textPrimary = "#1f2328";
|
|
10
11
|
const textSecondary = "#6b7280";
|
|
@@ -12,13 +13,13 @@ const textTertiary = "#9ca3af";
|
|
|
12
13
|
const bgPage = "#ffffff";
|
|
13
14
|
const bgSubtle = "#f5f6f8";
|
|
14
15
|
const border = "#e5e7eb";
|
|
15
|
-
// 可见行数 = 5,单元高度 =
|
|
16
|
-
exports.
|
|
16
|
+
// 可见行数 = 5,单元高度 = 80px @ 750 设计稿
|
|
17
|
+
exports.ITEM_HEIGHT_PX = 80;
|
|
17
18
|
exports.VISIBLE_ROWS = 5;
|
|
18
19
|
function createStyle(primary, rounded = true) {
|
|
19
20
|
const primaryActive = (0, color_1.darken)(primary, 0.15);
|
|
20
|
-
const sheetRadius = rounded ?
|
|
21
|
-
const indicatorRadius = rounded ?
|
|
21
|
+
const sheetRadius = rounded ? (0, rem_1.r)(24) : "0";
|
|
22
|
+
const indicatorRadius = rounded ? (0, rem_1.r)(12) : "0";
|
|
22
23
|
return {
|
|
23
24
|
// 内容容器:动画/全屏/居中由 Dialog 提供,这里只保留视觉与排版
|
|
24
25
|
sheet: (0, react_1.css)({
|
|
@@ -35,27 +36,27 @@ function createStyle(primary, rounded = true) {
|
|
|
35
36
|
}),
|
|
36
37
|
// 标题栏:底部 hairline 与 body 区分
|
|
37
38
|
header: (0, react_1.css)({
|
|
38
|
-
height:
|
|
39
|
+
height: (0, rem_1.r)(92),
|
|
39
40
|
display: "flex",
|
|
40
41
|
alignItems: "center",
|
|
41
42
|
justifyContent: "space-between",
|
|
42
|
-
padding:
|
|
43
|
+
padding: `0 ${(0, rem_1.r)(16)}`,
|
|
43
44
|
borderBottom: `1px solid ${border}`,
|
|
44
45
|
}),
|
|
45
46
|
title: (0, react_1.css)({
|
|
46
47
|
flex: 1,
|
|
47
48
|
textAlign: "center",
|
|
48
|
-
fontSize:
|
|
49
|
+
fontSize: (0, rem_1.r)(30),
|
|
49
50
|
fontWeight: 600,
|
|
50
51
|
color: textPrimary,
|
|
51
|
-
letterSpacing:
|
|
52
|
+
letterSpacing: (0, rem_1.r)(1),
|
|
52
53
|
}),
|
|
53
54
|
btn: (0, react_1.css)({
|
|
54
|
-
minWidth:
|
|
55
|
-
padding:
|
|
56
|
-
fontSize:
|
|
55
|
+
minWidth: (0, rem_1.r)(110),
|
|
56
|
+
padding: `0 ${(0, rem_1.r)(8)}`,
|
|
57
|
+
fontSize: (0, rem_1.r)(28),
|
|
57
58
|
fontWeight: 400,
|
|
58
|
-
lineHeight:
|
|
59
|
+
lineHeight: (0, rem_1.r)(92),
|
|
59
60
|
cursor: "pointer",
|
|
60
61
|
transition: "opacity .15s, color .15s",
|
|
61
62
|
}),
|
|
@@ -73,16 +74,16 @@ function createStyle(primary, rounded = true) {
|
|
|
73
74
|
body: (0, react_1.css)({
|
|
74
75
|
position: "relative",
|
|
75
76
|
display: "flex",
|
|
76
|
-
height:
|
|
77
|
-
padding:
|
|
77
|
+
height: (0, rem_1.r)(exports.ITEM_HEIGHT_PX * exports.VISIBLE_ROWS),
|
|
78
|
+
padding: `0 ${(0, rem_1.r)(16)} ${(0, rem_1.r)(12)}`,
|
|
78
79
|
}),
|
|
79
80
|
// 选中条:浅灰底 + 上下 hairline,与 CitySelect 列表观感一致
|
|
80
81
|
indicator: (0, react_1.css)({
|
|
81
82
|
position: "absolute",
|
|
82
|
-
left:
|
|
83
|
-
right:
|
|
84
|
-
top:
|
|
85
|
-
height:
|
|
83
|
+
left: (0, rem_1.r)(16),
|
|
84
|
+
right: (0, rem_1.r)(16),
|
|
85
|
+
top: (0, rem_1.r)(exports.ITEM_HEIGHT_PX * 2),
|
|
86
|
+
height: (0, rem_1.r)(exports.ITEM_HEIGHT_PX),
|
|
86
87
|
pointerEvents: "none",
|
|
87
88
|
backgroundColor: bgSubtle,
|
|
88
89
|
borderTop: `1px solid ${border}`,
|
|
@@ -109,13 +110,13 @@ function createStyle(primary, rounded = true) {
|
|
|
109
110
|
willChange: "transform",
|
|
110
111
|
}),
|
|
111
112
|
item: (0, react_1.css)({
|
|
112
|
-
height:
|
|
113
|
-
lineHeight:
|
|
114
|
-
fontSize:
|
|
113
|
+
height: (0, rem_1.r)(exports.ITEM_HEIGHT_PX),
|
|
114
|
+
lineHeight: (0, rem_1.r)(exports.ITEM_HEIGHT_PX),
|
|
115
|
+
fontSize: (0, rem_1.r)(32),
|
|
115
116
|
fontWeight: 400,
|
|
116
117
|
fontFamily: theme_1.numberFontStack,
|
|
117
118
|
fontVariantNumeric: "tabular-nums",
|
|
118
|
-
letterSpacing:
|
|
119
|
+
letterSpacing: (0, rem_1.r)(1),
|
|
119
120
|
textAlign: "center",
|
|
120
121
|
color: textTertiary,
|
|
121
122
|
transition: "color .18s ease",
|
|
@@ -125,7 +126,7 @@ function createStyle(primary, rounded = true) {
|
|
|
125
126
|
fontWeight: 600,
|
|
126
127
|
}),
|
|
127
128
|
spacer: (0, react_1.css)({
|
|
128
|
-
height:
|
|
129
|
+
height: (0, rem_1.r)(exports.ITEM_HEIGHT_PX * 2),
|
|
129
130
|
pointerEvents: "none",
|
|
130
131
|
}),
|
|
131
132
|
};
|
package/build/Indicator/index.js
CHANGED
|
@@ -16,6 +16,7 @@ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
|
16
16
|
const react_1 = require("@emotion/react");
|
|
17
17
|
const react_2 = require("react");
|
|
18
18
|
const cssUtil_1 = require("../utils/cssUtil");
|
|
19
|
+
const rem_1 = require("../utils/rem");
|
|
19
20
|
const style_1 = require("./style");
|
|
20
21
|
/**
|
|
21
22
|
* iOS 风菊花转圈指示器(仿 UIActivityIndicatorView 节奏)。
|
|
@@ -31,7 +32,7 @@ function Indicator(props) {
|
|
|
31
32
|
{ fontSize: 0, display: "inline-block", lineHeight: 0 },
|
|
32
33
|
size !== undefined
|
|
33
34
|
? { width: (0, cssUtil_1.normalizeUnit)(size), height: (0, cssUtil_1.normalizeUnit)(size) }
|
|
34
|
-
: { width:
|
|
35
|
+
: { width: (0, rem_1.r)(40), height: (0, rem_1.r)(40) },
|
|
35
36
|
], [size]);
|
|
36
37
|
const svgCss = (0, react_2.useMemo)(() => (0, react_1.css)({
|
|
37
38
|
width: "100%",
|
package/build/Loading/Wrapper.js
CHANGED
|
@@ -6,6 +6,7 @@ const style_1 = require("./style");
|
|
|
6
6
|
const Indicator_1 = require("../Indicator");
|
|
7
7
|
const Row_1 = require("../Flex/Row");
|
|
8
8
|
const Overlay_1 = require("../Overlay");
|
|
9
|
+
const rem_1 = require("../utils/rem");
|
|
9
10
|
function Wrapper(props) {
|
|
10
11
|
const { status = 'show', hint, overlay, indicator, onHide, containerStyle, } = props;
|
|
11
12
|
// 覆盖层样式
|
|
@@ -17,9 +18,9 @@ function Wrapper(props) {
|
|
|
17
18
|
if (typeof overlay === 'object') {
|
|
18
19
|
overlayProps = Object.assign(Object.assign({}, overlayProps), overlay);
|
|
19
20
|
}
|
|
20
|
-
// 指示器样式:默认 size
|
|
21
|
+
// 指示器样式:默认 size = 48px @ 750 设计稿,保证带文字 / 不带文字两态指示器大小一致
|
|
21
22
|
let indicatorProps = {
|
|
22
|
-
size:
|
|
23
|
+
size: (0, rem_1.r)(48),
|
|
23
24
|
barWidth: 5,
|
|
24
25
|
barHeight: 25,
|
|
25
26
|
barCount: 14,
|
package/build/Loading/style.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.style = exports.LoadingHide = exports.LoadingShow = void 0;
|
|
4
4
|
const react_1 = require("@emotion/react");
|
|
5
|
+
const rem_1 = require("../utils/rem");
|
|
5
6
|
exports.LoadingShow = (0, react_1.keyframes) `
|
|
6
7
|
from {
|
|
7
8
|
opacity: 0;
|
|
@@ -21,13 +22,13 @@ exports.LoadingHide = (0, react_1.keyframes) `
|
|
|
21
22
|
exports.style = {
|
|
22
23
|
boxCommon: {
|
|
23
24
|
backgroundColor: `rgba(0, 0, 0, .72)`,
|
|
24
|
-
borderRadius:
|
|
25
|
+
borderRadius: (0, rem_1.r)(20),
|
|
25
26
|
backdropFilter: 'blur(20px) saturate(160%)',
|
|
26
27
|
WebkitBackdropFilter: 'blur(20px) saturate(160%)',
|
|
27
28
|
},
|
|
28
29
|
box: {
|
|
29
|
-
width:
|
|
30
|
-
height:
|
|
30
|
+
width: (0, rem_1.r)(160),
|
|
31
|
+
height: (0, rem_1.r)(160),
|
|
31
32
|
},
|
|
32
33
|
boxShow: {
|
|
33
34
|
animation: `${exports.LoadingShow} 200ms`,
|
|
@@ -36,13 +37,13 @@ exports.style = {
|
|
|
36
37
|
animation: `${exports.LoadingHide} 200ms`,
|
|
37
38
|
},
|
|
38
39
|
boxWithExtra: {
|
|
39
|
-
padding:
|
|
40
|
+
padding: (0, rem_1.r)(30),
|
|
40
41
|
},
|
|
41
42
|
hint: {
|
|
42
43
|
color: "#ffffff",
|
|
43
44
|
whiteSpace: "nowrap",
|
|
44
|
-
fontSize:
|
|
45
|
-
marginLeft:
|
|
45
|
+
fontSize: (0, rem_1.r)(28),
|
|
46
|
+
marginLeft: (0, rem_1.r)(20),
|
|
46
47
|
fontWeight: 500,
|
|
47
48
|
},
|
|
48
49
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type POIItem, type SelectedLocation } from "./types";
|
|
2
|
+
import type { ReverseGeocodeResult } from "./provider";
|
|
3
|
+
export declare const NEAREST_POI_FALLBACK_RADIUS_M = 80;
|
|
4
|
+
export declare function splitAdcode(adcode?: string): {
|
|
5
|
+
provinceCode: string;
|
|
6
|
+
cityCode: string;
|
|
7
|
+
districtCode: string;
|
|
8
|
+
} | undefined;
|
|
9
|
+
export interface BuildSelectedLocationOptions {
|
|
10
|
+
pickedPoi?: {
|
|
11
|
+
name?: string;
|
|
12
|
+
address?: string;
|
|
13
|
+
};
|
|
14
|
+
candidatePoi?: POIItem | null;
|
|
15
|
+
}
|
|
16
|
+
export declare function buildSelectedLocation(center: [number, number], geo: ReverseGeocodeResult | null, options?: BuildSelectedLocationOptions): SelectedLocation;
|