clxx 3.0.1 → 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.
Files changed (55) hide show
  1. package/AGENTS.md +49 -3
  2. package/README.md +6 -3
  3. package/build/Alert/style.js +15 -14
  4. package/build/CarouselNotice/style.js +2 -1
  5. package/build/CitySelect/data.d.ts +1 -1
  6. package/build/CitySelect/data.js +2277 -1674
  7. package/build/CitySelect/index.d.ts +2 -1
  8. package/build/CitySelect/index.js +35 -9
  9. package/build/CitySelect/style.js +52 -48
  10. package/build/Container/index.js +21 -1
  11. package/build/DatePicker/style.d.ts +1 -1
  12. package/build/DatePicker/style.js +39 -35
  13. package/build/Indicator/index.js +2 -1
  14. package/build/Loading/Wrapper.js +3 -2
  15. package/build/Loading/style.js +7 -6
  16. package/build/MapLocationSelection/buildSelectedLocation.d.ts +16 -0
  17. package/build/MapLocationSelection/buildSelectedLocation.js +123 -0
  18. package/build/MapLocationSelection/createProvider.d.ts +8 -0
  19. package/build/MapLocationSelection/createProvider.js +33 -0
  20. package/build/MapLocationSelection/getLocation.d.ts +8 -0
  21. package/build/MapLocationSelection/getLocation.js +112 -0
  22. package/build/MapLocationSelection/index.d.ts +16 -0
  23. package/build/MapLocationSelection/index.js +985 -0
  24. package/build/MapLocationSelection/loader.amap.d.ts +48 -0
  25. package/build/MapLocationSelection/loader.amap.js +125 -0
  26. package/build/MapLocationSelection/loader.bmap.d.ts +8 -0
  27. package/build/MapLocationSelection/loader.bmap.js +60 -0
  28. package/build/MapLocationSelection/provider.amap.d.ts +38 -0
  29. package/build/MapLocationSelection/provider.amap.js +659 -0
  30. package/build/MapLocationSelection/provider.bmap.d.ts +36 -0
  31. package/build/MapLocationSelection/provider.bmap.js +837 -0
  32. package/build/MapLocationSelection/provider.d.ts +45 -0
  33. package/build/MapLocationSelection/provider.js +10 -0
  34. package/build/MapLocationSelection/style.d.ts +4 -0
  35. package/build/MapLocationSelection/style.js +442 -0
  36. package/build/MapLocationSelection/types.d.ts +29 -0
  37. package/build/MapLocationSelection/types.js +22 -0
  38. package/build/MapLocationSelection/userMarker.d.ts +2 -0
  39. package/build/MapLocationSelection/userMarker.js +95 -0
  40. package/build/RegionPicker/data.js +974 -992
  41. package/build/RegionPicker/index.d.ts +3 -2
  42. package/build/RegionPicker/index.js +29 -10
  43. package/build/RegionPicker/style.js +54 -49
  44. package/build/ScrollView/style.js +5 -4
  45. package/build/Toast/style.js +6 -5
  46. package/build/index.d.ts +3 -0
  47. package/build/index.js +8 -2
  48. package/build/utils/rem.d.ts +1 -0
  49. package/build/utils/rem.js +48 -0
  50. package/package.json +2 -2
  51. package/test/src/city-select/index.jsx +28 -15
  52. package/test/src/index/index.jsx +5 -0
  53. package/test/src/index.jsx +1 -0
  54. package/test/src/map-location-selection/index.jsx +192 -0
  55. package/test/src/region-picker/index.jsx +29 -21
@@ -12,6 +12,7 @@ export interface CitySelectProps {
12
12
  onLetterChange?: (letter: string) => void;
13
13
  getLocation?: () => string | null | undefined | Promise<string | null | undefined>;
14
14
  primary?: string;
15
+ taiwanHKMacau?: boolean;
15
16
  }
16
17
  export declare function CitySelect(props: CitySelectProps): import("@emotion/react/jsx-runtime").JSX.Element;
17
- export declare function showCitySelect(options?: Pick<CitySelectProps, "onSelect" | "onLetterChange" | "getLocation" | "primary">): void;
18
+ export declare function showCitySelect(options?: Pick<CitySelectProps, "onSelect" | "onLetterChange" | "getLocation" | "primary" | "taiwanHKMacau">): void;
@@ -11,17 +11,23 @@ const style_1 = require("./style");
11
11
  const Col_1 = require("../Flex/Col");
12
12
  const Row_1 = require("../Flex/Row");
13
13
  const Clickable_1 = require("../Clickable");
14
+ // 港澳台对应的省份 code(台湾、香港、澳门)
15
+ const HK_MO_TW_PCODES = new Set([
16
+ "710000",
17
+ "810000",
18
+ "820000",
19
+ ]);
14
20
  // 在 cityData 中按 code 或 name 查找城市
15
21
  // name 匹配时允许省略末尾的"市",如"北京" 匹配 "北京市"
16
- function findCity(key) {
22
+ function findCity(source, key) {
17
23
  if (!key)
18
24
  return null;
19
25
  const k = key.trim();
20
26
  if (!k)
21
27
  return null;
22
28
  const kNoCity = k.endsWith("市") ? k.slice(0, -1) : k;
23
- for (const letter of Object.keys(data_1.cityData)) {
24
- for (const item of data_1.cityData[letter]) {
29
+ for (const letter of Object.keys(source)) {
30
+ for (const item of source[letter]) {
25
31
  if (item.code === k)
26
32
  return item;
27
33
  const nameNoCity = item.name.endsWith("市")
@@ -35,14 +41,29 @@ function findCity(key) {
35
41
  }
36
42
  // 弹出与滑入/滑出动画由 showDialog (pullLeft) 接管
37
43
  function CitySelect(props) {
38
- const { onClose, onSelect, onLetterChange, getLocation, primary = style_1.DEFAULT_PRIMARY, } = props;
44
+ const { onClose, onSelect, onLetterChange, getLocation, primary = style_1.DEFAULT_PRIMARY, taiwanHKMacau = false, } = props;
39
45
  const style = (0, react_1.useMemo)(() => (0, style_1.createStyle)(primary), [primary]);
40
- const letters = (0, react_1.useMemo)(() => Object.keys(data_1.cityData), []);
46
+ // 过滤后的城市数据:当 taiwanHKMacau=false 时排除港澳台;
47
+ // 过滤后为空的字母档位会从指引中移除。仅在 taiwanHKMacau 变化时重建。
48
+ const filteredCityData = (0, react_1.useMemo)(() => {
49
+ if (taiwanHKMacau)
50
+ return data_1.cityData;
51
+ const out = {};
52
+ for (const letter of Object.keys(data_1.cityData)) {
53
+ const arr = data_1.cityData[letter].filter((it) => !HK_MO_TW_PCODES.has(it.pcode));
54
+ if (arr.length > 0)
55
+ out[letter] = arr;
56
+ }
57
+ return out;
58
+ }, [taiwanHKMacau]);
59
+ const letters = (0, react_1.useMemo)(() => Object.keys(filteredCityData), [filteredCityData]);
41
60
  // 定位解析结果:null 表示尚未解析或失败/未匹配;非空时展示快捷入口
42
61
  const [locatedCity, setLocatedCity] = (0, react_1.useState)(null);
43
62
  // 首次挂载时调用一次外部定位;异步失败或匹配不到均保持不展示
44
63
  const getLocationRef = (0, react_1.useRef)(getLocation);
45
64
  getLocationRef.current = getLocation;
65
+ const filteredCityDataRef = (0, react_1.useRef)(filteredCityData);
66
+ filteredCityDataRef.current = filteredCityData;
46
67
  (0, react_1.useEffect)(() => {
47
68
  const fn = getLocationRef.current;
48
69
  if (!fn)
@@ -53,7 +74,7 @@ function CitySelect(props) {
53
74
  .then((key) => {
54
75
  if (cancelled)
55
76
  return;
56
- const city = findCity(key !== null && key !== void 0 ? key : undefined);
77
+ const city = findCity(filteredCityDataRef.current, key !== null && key !== void 0 ? key : undefined);
57
78
  if (city)
58
79
  setLocatedCity(city);
59
80
  })
@@ -83,8 +104,13 @@ function CitySelect(props) {
83
104
  const searchResult = (0, react_1.useMemo)(() => {
84
105
  if (composing)
85
106
  return null;
86
- return keyword.trim() ? (0, search_1.searchCity)(keyword) : null;
87
- }, [keyword, composing]);
107
+ if (!keyword.trim())
108
+ return null;
109
+ const list = (0, search_1.searchCity)(keyword);
110
+ if (taiwanHKMacau)
111
+ return list;
112
+ return list.filter((it) => !HK_MO_TW_PCODES.has(it.pcode));
113
+ }, [keyword, composing, taiwanHKMacau]);
88
114
  const isSearching = searchResult !== null;
89
115
  // 用 ref 保存最新值,避免 effect 依赖变化而反复解绑/绑定
90
116
  const lettersRef = (0, react_1.useRef)(letters);
@@ -287,7 +313,7 @@ function CitySelect(props) {
287
313
  // 每个字母对应一个区块,包含该字母开头的城市列表
288
314
  (0, jsx_runtime_1.jsxs)("div", { ref: (el) => {
289
315
  sectionRefs.current[k] = el;
290
- }, children: [(0, jsx_runtime_1.jsx)("div", { css: style.title, children: k.toUpperCase() }), data_1.cityData[k].map((item) => ((0, jsx_runtime_1.jsx)(Clickable_1.Clickable, { css: style.item, onClick: () => handleSelect(item), children: item.name }, item.code)))] }, k));
316
+ }, children: [(0, jsx_runtime_1.jsx)("div", { css: style.title, children: k.toUpperCase() }), filteredCityData[k].map((item) => ((0, jsx_runtime_1.jsx)(Clickable_1.Clickable, { css: style.item, onClick: () => handleSelect(item), children: item.name }, item.code)))] }, k));
291
317
  }) }))] }), !isSearching && ((0, jsx_runtime_1.jsx)("div", { ref: sidebarRef, css: style.sidebar, children: letters.map((k) => ((0, jsx_runtime_1.jsx)("div", { css: [style.letter, activeLetter === k && style.letterActive], children: k.toUpperCase() }, k))) })), touching && activeLetter && !isSearching && ((0, jsx_runtime_1.jsx)("div", { css: style.bigLetter, children: activeLetter.toUpperCase() }))] }));
292
318
  }
293
319
  function showCitySelect(options = {}) {
@@ -5,13 +5,14 @@ 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
- // iOS 风格设计变量
9
- const textPrimary = "#000000";
10
- const textSecondary = "#3c3c43"; // iOS secondaryLabel
11
- const textTertiary = "#8e8e93"; // iOS tertiaryLabel / placeholder
8
+ const rem_1 = require("../utils/rem");
9
+ // 设计变量
10
+ const textPrimary = "#1f2328";
11
+ const textSecondary = "#6b7280";
12
+ const textTertiary = "#9ca3af";
12
13
  const bgPage = "#ffffff";
13
- const bgSubtle = "rgba(120,120,128,.12)"; // iOS quaternary fill
14
- const bgGrouped = "#f2f2f7"; // iOS systemGroupedBackground
14
+ const bgSubtle = "#f5f6f8";
15
+ const border = "#e5e7eb";
15
16
  // 根据 primary 色值生成一整套样式;primaryActive 由 primary 派生
16
17
  function createStyle(primary) {
17
18
  const primaryActive = (0, color_1.darken)(primary, 0.15);
@@ -32,22 +33,22 @@ function createStyle(primary) {
32
33
  sidebar: (0, react_1.css)({
33
34
  position: "absolute",
34
35
  top: "50%",
35
- right: ".12rem",
36
+ right: (0, rem_1.r)(12),
36
37
  transform: "translateY(-50%)",
37
38
  zIndex: 2,
38
- padding: ".1rem .06rem",
39
- borderRadius: ".3rem",
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: ".02rem",
44
+ gap: (0, rem_1.r)(2),
44
45
  }),
45
46
  letter: (0, react_1.css)({
46
- width: ".36rem",
47
- height: ".36rem",
48
- lineHeight: ".36rem",
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: ".22rem",
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: ".6rem",
72
- width: "1.4rem",
73
- height: "1.4rem",
74
- lineHeight: "1.4rem",
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: ".24rem",
77
+ borderRadius: (0, rem_1.r)(24),
77
78
  pointerEvents: "none",
78
79
  }),
79
80
  original: (0, react_1.css)({
@@ -81,19 +82,20 @@ function createStyle(primary) {
81
82
  backgroundColor: bgPage,
82
83
  }),
83
84
  top: (0, react_1.css)({
84
- padding: ".3rem",
85
+ padding: `${(0, rem_1.r)(24)} ${(0, rem_1.r)(30)}`,
86
+ borderBottom: `1px solid ${border}`,
85
87
  "& > div": {
86
- height: ".72rem",
88
+ height: (0, rem_1.r)(72),
87
89
  backgroundColor: bgSubtle,
88
- padding: "0 .24rem",
89
- borderRadius: ".36rem",
90
+ padding: `0 ${(0, rem_1.r)(24)}`,
91
+ borderRadius: (0, rem_1.r)(36),
90
92
  },
91
93
  }),
92
94
  icon: (0, react_1.css)({
93
- width: ".32rem",
94
- height: ".32rem",
95
+ width: (0, rem_1.r)(32),
96
+ height: (0, rem_1.r)(32),
95
97
  fill: textTertiary,
96
- marginRight: ".15rem",
98
+ marginRight: (0, rem_1.r)(15),
97
99
  fontSize: 0,
98
100
  flexShrink: 0,
99
101
  }),
@@ -101,8 +103,8 @@ function createStyle(primary) {
101
103
  flexGrow: 1,
102
104
  height: "100%",
103
105
  minWidth: 0,
104
- fontSize: ".28rem",
105
- lineHeight: ".72rem",
106
+ fontSize: (0, rem_1.r)(28),
107
+ lineHeight: (0, rem_1.r)(72),
106
108
  color: textPrimary,
107
109
  fontFamily: "inherit",
108
110
  border: "none",
@@ -111,14 +113,14 @@ function createStyle(primary) {
111
113
  padding: 0,
112
114
  "&::placeholder": {
113
115
  color: textTertiary,
114
- lineHeight: ".72rem",
116
+ lineHeight: (0, rem_1.r)(72),
115
117
  },
116
118
  }),
117
119
  exit: (0, react_1.css)({
118
120
  whiteSpace: "nowrap",
119
- marginLeft: ".2rem",
120
- lineHeight: ".72rem",
121
- fontSize: ".28rem",
121
+ marginLeft: (0, rem_1.r)(20),
122
+ lineHeight: (0, rem_1.r)(72),
123
+ fontSize: (0, rem_1.r)(28),
122
124
  color: primary,
123
125
  cursor: "pointer",
124
126
  transition: "opacity .15s, color .15s",
@@ -137,7 +139,8 @@ function createStyle(primary) {
137
139
  locate: (0, react_1.css)({
138
140
  display: "flex",
139
141
  alignItems: "center",
140
- padding: "0 .3rem .3rem",
142
+ padding: `${(0, rem_1.r)(20)} ${(0, rem_1.r)(23)}`,
143
+ borderBottom: `1px solid ${border}`,
141
144
  backgroundColor: bgPage,
142
145
  transition: "background-color .12s",
143
146
  "&:active": {
@@ -145,38 +148,39 @@ function createStyle(primary) {
145
148
  },
146
149
  }),
147
150
  locateIcon: (0, react_1.css)({
148
- width: ".32rem",
149
- height: ".32rem",
151
+ width: (0, rem_1.r)(32),
152
+ height: (0, rem_1.r)(32),
150
153
  fill: primary,
151
- marginRight: ".16rem",
154
+ marginRight: (0, rem_1.r)(16),
152
155
  fontSize: 0,
153
156
  flexShrink: 0,
154
157
  }),
155
158
  locateLabel: (0, react_1.css)({
156
- fontSize: ".24rem",
159
+ fontSize: (0, rem_1.r)(24),
157
160
  color: textTertiary,
158
- marginRight: ".16rem",
161
+ marginRight: (0, rem_1.r)(16),
159
162
  }),
160
163
  locateName: (0, react_1.css)({
161
- fontSize: ".24rem",
164
+ fontSize: (0, rem_1.r)(24),
162
165
  color: primary,
163
166
  }),
164
167
  title: (0, react_1.css)({
165
- padding: ".12rem .3rem .06rem",
166
- fontSize: ".22rem",
167
- fontWeight: 500,
168
- color: textTertiary,
169
- letterSpacing: ".02rem",
168
+ padding: `${(0, rem_1.r)(8)} ${(0, rem_1.r)(30)}`,
169
+ fontSize: (0, rem_1.r)(22),
170
+ fontWeight: 600,
171
+ color: textSecondary,
172
+ letterSpacing: (0, rem_1.r)(2),
170
173
  textTransform: "uppercase",
171
- backgroundColor: bgGrouped,
174
+ backgroundColor: bgSubtle,
172
175
  position: "sticky",
173
176
  top: 0,
174
177
  zIndex: 1,
175
178
  }),
176
179
  item: (0, react_1.css)({
177
- padding: ".24rem .3rem",
178
- fontSize: ".3rem",
180
+ padding: `${(0, rem_1.r)(24)} ${(0, rem_1.r)(30)}`,
181
+ fontSize: (0, rem_1.r)(30),
179
182
  color: textPrimary,
183
+ borderBottom: `1px solid ${border}`,
180
184
  backgroundColor: bgPage,
181
185
  transition: "background-color .12s",
182
186
  "&:active": {
@@ -196,7 +200,7 @@ function createStyle(primary) {
196
200
  alignItems: "center",
197
201
  justifyContent: "center",
198
202
  color: textTertiary,
199
- fontSize: ".26rem",
203
+ fontSize: (0, rem_1.r)(26),
200
204
  }),
201
205
  };
202
206
  }
@@ -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 ITEM_HEIGHT_REM = 0.8;
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,23 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_PRIMARY = exports.VISIBLE_ROWS = exports.ITEM_HEIGHT_REM = void 0;
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
- // iOS 风格设计变量
9
- const textPrimary = "#000000";
10
- const textSecondary = "#3c3c43"; // iOS secondaryLabel
11
- const textTertiary = "#8e8e93"; // iOS tertiaryLabel
8
+ const rem_1 = require("../utils/rem");
9
+ // CitySelect 一致的设计变量(带线条风格)
10
+ const textPrimary = "#1f2328";
11
+ const textSecondary = "#6b7280";
12
+ const textTertiary = "#9ca3af";
12
13
  const bgPage = "#ffffff";
13
- const bgSubtle = "rgba(120,120,128,.12)"; // iOS quaternary fill
14
- // 可见行数 = 5,单元高度 = .8rem
15
- exports.ITEM_HEIGHT_REM = 0.8;
14
+ const bgSubtle = "#f5f6f8";
15
+ const border = "#e5e7eb";
16
+ // 可见行数 = 5,单元高度 = 80px @ 750 设计稿
17
+ exports.ITEM_HEIGHT_PX = 80;
16
18
  exports.VISIBLE_ROWS = 5;
17
19
  function createStyle(primary, rounded = true) {
18
20
  const primaryActive = (0, color_1.darken)(primary, 0.15);
19
- const sheetRadius = rounded ? ".28rem" : "0";
20
- const indicatorRadius = rounded ? ".12rem" : "0";
21
+ const sheetRadius = rounded ? (0, rem_1.r)(24) : "0";
22
+ const indicatorRadius = rounded ? (0, rem_1.r)(12) : "0";
21
23
  return {
22
24
  // 内容容器:动画/全屏/居中由 Dialog 提供,这里只保留视觉与排版
23
25
  sheet: (0, react_1.css)({
@@ -32,29 +34,29 @@ function createStyle(primary, rounded = true) {
32
34
  WebkitFontSmoothing: "antialiased",
33
35
  MozOsxFontSmoothing: "grayscale",
34
36
  }),
35
- // iOS 风标题栏:底部 hairline 与下方 body 做轻量区块分隔
37
+ // 标题栏:底部 hairline body 区分
36
38
  header: (0, react_1.css)({
37
- height: ".92rem",
39
+ height: (0, rem_1.r)(92),
38
40
  display: "flex",
39
41
  alignItems: "center",
40
42
  justifyContent: "space-between",
41
- padding: "0 .16rem",
42
- borderBottom: "1px solid rgba(60,60,67,.18)",
43
+ padding: `0 ${(0, rem_1.r)(16)}`,
44
+ borderBottom: `1px solid ${border}`,
43
45
  }),
44
46
  title: (0, react_1.css)({
45
47
  flex: 1,
46
48
  textAlign: "center",
47
- fontSize: ".32rem",
49
+ fontSize: (0, rem_1.r)(30),
48
50
  fontWeight: 600,
49
51
  color: textPrimary,
50
- letterSpacing: ".01rem",
52
+ letterSpacing: (0, rem_1.r)(1),
51
53
  }),
52
54
  btn: (0, react_1.css)({
53
- minWidth: "1.1rem",
54
- padding: "0 .08rem",
55
- fontSize: ".3rem",
55
+ minWidth: (0, rem_1.r)(110),
56
+ padding: `0 ${(0, rem_1.r)(8)}`,
57
+ fontSize: (0, rem_1.r)(28),
56
58
  fontWeight: 400,
57
- lineHeight: ".92rem",
59
+ lineHeight: (0, rem_1.r)(92),
58
60
  cursor: "pointer",
59
61
  transition: "opacity .15s, color .15s",
60
62
  }),
@@ -65,25 +67,27 @@ function createStyle(primary, rounded = true) {
65
67
  }),
66
68
  btnConfirm: (0, react_1.css)({
67
69
  textAlign: "right",
68
- fontWeight: 600,
70
+ fontWeight: 500,
69
71
  color: primary,
70
72
  "&:active": { color: primaryActive, opacity: 0.65 },
71
73
  }),
72
74
  body: (0, react_1.css)({
73
75
  position: "relative",
74
76
  display: "flex",
75
- height: `${exports.ITEM_HEIGHT_REM * exports.VISIBLE_ROWS}rem`,
76
- padding: "0 .16rem .12rem",
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)}`,
77
79
  }),
78
- // iOS 风选中背景:柔和的 quaternary fill、充足圆角
80
+ // 选中条:浅灰底 + 上下 hairline,与 CitySelect 列表观感一致
79
81
  indicator: (0, react_1.css)({
80
82
  position: "absolute",
81
- left: ".16rem",
82
- right: ".16rem",
83
- top: `${exports.ITEM_HEIGHT_REM * 2}rem`,
84
- height: `${exports.ITEM_HEIGHT_REM}rem`,
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),
85
87
  pointerEvents: "none",
86
88
  backgroundColor: bgSubtle,
89
+ borderTop: `1px solid ${border}`,
90
+ borderBottom: `1px solid ${border}`,
87
91
  borderRadius: indicatorRadius,
88
92
  }),
89
93
  column: (0, react_1.css)({
@@ -106,23 +110,23 @@ function createStyle(primary, rounded = true) {
106
110
  willChange: "transform",
107
111
  }),
108
112
  item: (0, react_1.css)({
109
- height: `${exports.ITEM_HEIGHT_REM}rem`,
110
- lineHeight: `${exports.ITEM_HEIGHT_REM}rem`,
111
- fontSize: ".32rem",
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),
112
116
  fontWeight: 400,
113
117
  fontFamily: theme_1.numberFontStack,
114
118
  fontVariantNumeric: "tabular-nums",
115
- letterSpacing: ".01rem",
119
+ letterSpacing: (0, rem_1.r)(1),
116
120
  textAlign: "center",
117
121
  color: textTertiary,
118
122
  transition: "color .18s ease",
119
123
  }),
120
124
  itemActive: (0, react_1.css)({
121
- color: textPrimary,
122
- fontWeight: 500,
125
+ color: primary,
126
+ fontWeight: 600,
123
127
  }),
124
128
  spacer: (0, react_1.css)({
125
- height: `${exports.ITEM_HEIGHT_REM * 2}rem`,
129
+ height: (0, rem_1.r)(exports.ITEM_HEIGHT_PX * 2),
126
130
  pointerEvents: "none",
127
131
  }),
128
132
  };
@@ -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: ".4rem", height: ".4rem" },
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%",
@@ -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 .48rem,保证带文字 / 不带文字两态指示器大小一致
21
+ // 指示器样式:默认 size = 48px @ 750 设计稿,保证带文字 / 不带文字两态指示器大小一致
21
22
  let indicatorProps = {
22
- size: '.48rem',
23
+ size: (0, rem_1.r)(48),
23
24
  barWidth: 5,
24
25
  barHeight: 25,
25
26
  barCount: 14,
@@ -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: '.2rem',
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: '1.6rem',
30
- height: '1.6rem',
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: '.3rem',
40
+ padding: (0, rem_1.r)(30),
40
41
  },
41
42
  hint: {
42
43
  color: "#ffffff",
43
44
  whiteSpace: "nowrap",
44
- fontSize: '.28rem',
45
- marginLeft: '.2rem',
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;