clxx 2.1.7 → 3.0.0
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 +2 -1
- package/README.md +147 -22
- package/build/Alert/Wrapper.js +12 -14
- package/build/Alert/style.js +44 -25
- package/build/AutoGrid/index.js +21 -15
- package/build/CarouselNotice/index.d.ts +19 -11
- package/build/CarouselNotice/index.js +80 -74
- package/build/CarouselNotice/style.js +14 -4
- package/build/CitySelect/index.js +81 -71
- package/build/CitySelect/style.js +22 -56
- package/build/Clickable/index.js +7 -0
- package/build/Container/index.d.ts +12 -4
- package/build/Container/index.js +94 -89
- package/build/Countdowner/index.js +4 -2
- package/build/DatePicker/Column.d.ts +9 -0
- package/build/DatePicker/Column.js +330 -0
- package/build/DatePicker/index.d.ts +32 -0
- package/build/DatePicker/index.js +230 -0
- package/build/DatePicker/style.d.ts +6 -0
- package/build/DatePicker/style.js +130 -0
- package/build/Dialog/Wrapper.d.ts +0 -1
- package/build/Dialog/Wrapper.js +22 -12
- package/build/Dialog/index.d.ts +7 -1
- package/build/Dialog/index.js +57 -32
- package/build/Dialog/style.js +6 -2
- package/build/Effect/useInterval.js +6 -3
- package/build/Fixed/index.js +13 -22
- package/build/Flex/FlexItem.d.ts +11 -0
- package/build/Flex/FlexItem.js +26 -0
- package/build/Flex/index.d.ts +2 -10
- package/build/Flex/index.js +12 -22
- package/build/Indicator/index.d.ts +9 -6
- package/build/Indicator/index.js +34 -37
- package/build/Indicator/style.d.ts +4 -3
- package/build/Indicator/style.js +8 -13
- package/build/Loading/Wrapper.js +2 -1
- package/build/Loading/style.js +9 -12
- package/build/Overlay/index.js +6 -1
- package/build/RegionPicker/data.d.ts +6 -0
- package/build/RegionPicker/data.js +14486 -0
- package/build/RegionPicker/index.d.ts +33 -0
- package/build/RegionPicker/index.js +205 -0
- package/build/RegionPicker/style.d.ts +4 -0
- package/build/RegionPicker/style.js +187 -0
- package/build/SafeArea/index.js +14 -17
- package/build/ScrollView/index.d.ts +23 -11
- package/build/ScrollView/index.js +132 -118
- package/build/ScrollView/style.d.ts +1 -1
- package/build/ScrollView/style.js +33 -22
- package/build/Toast/Toast.d.ts +0 -1
- package/build/Toast/Toast.js +6 -4
- package/build/Toast/style.d.ts +3 -10
- package/build/Toast/style.js +41 -45
- package/build/index.d.ts +3 -0
- package/build/index.js +7 -1
- package/build/utils/color.d.ts +5 -0
- package/build/utils/color.js +18 -0
- package/build/utils/dom.js +4 -3
- package/build/utils/theme.d.ts +2 -0
- package/build/utils/theme.js +7 -0
- package/package.json +1 -1
- package/test/src/date-picker/index.jsx +119 -0
- package/test/src/index/index.jsx +2 -0
- package/test/src/index.jsx +1 -0
- package/test/src/loading/index.jsx +2 -2
- package/test/src/region-picker/index.jsx +120 -0
- package/test/src/scrollview/BasicSection.jsx +56 -0
- package/test/src/scrollview/CustomLoadingSection.jsx +53 -0
- package/test/src/scrollview/HeightModeSection.jsx +42 -0
- package/test/src/scrollview/ImperativeSection.jsx +56 -0
- package/test/src/scrollview/NotScrollableSection.jsx +32 -0
- package/test/src/scrollview/PerfSection.jsx +34 -0
- package/test/src/scrollview/index.css +92 -8
- package/test/src/scrollview/index.jsx +13 -45
- package/test/src/toast/index.jsx +1 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.FlexItem = FlexItem;
|
|
15
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
16
|
+
function FlexItem(props) {
|
|
17
|
+
const { children, alignSelf, order, flex, flexGrow, flexShrink, flexBasis, style } = props, extra = __rest(props, ["children", "alignSelf", "order", "flex", "flexGrow", "flexShrink", "flexBasis", "style"]);
|
|
18
|
+
// 布局属性走原生 inline style:避免 emotion 在每次 render 哈希对象字面量
|
|
19
|
+
const inlineStyle = Object.assign({ alignSelf,
|
|
20
|
+
order,
|
|
21
|
+
flex,
|
|
22
|
+
flexGrow,
|
|
23
|
+
flexShrink,
|
|
24
|
+
flexBasis }, style);
|
|
25
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ style: inlineStyle }, extra, { children: children })));
|
|
26
|
+
}
|
package/build/Flex/index.d.ts
CHANGED
|
@@ -8,14 +8,6 @@ export interface FlexProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
8
8
|
flexWrap?: CSS.Property.FlexWrap;
|
|
9
9
|
flexDirection?: CSS.Property.FlexDirection;
|
|
10
10
|
}
|
|
11
|
-
export interface FlexItemProps extends React.HTMLProps<HTMLDivElement> {
|
|
12
|
-
children?: React.ReactNode;
|
|
13
|
-
alignSelf?: CSS.Property.AlignSelf;
|
|
14
|
-
order?: CSS.Property.Order;
|
|
15
|
-
flex?: CSS.Property.BoxFlex;
|
|
16
|
-
flexGrow?: CSS.Property.FlexGrow;
|
|
17
|
-
flexShrink?: CSS.Property.FlexShrink;
|
|
18
|
-
flexBasis?: CSS.Property.FlexBasis;
|
|
19
|
-
}
|
|
20
11
|
export declare function Flex(props: FlexProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
21
|
-
export
|
|
12
|
+
export type { FlexItemProps } from './FlexItem';
|
|
13
|
+
export { FlexItem } from './FlexItem';
|
package/build/Flex/index.js
CHANGED
|
@@ -11,29 +11,19 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.FlexItem = void 0;
|
|
14
15
|
exports.Flex = Flex;
|
|
15
|
-
exports.FlexItem = FlexItem;
|
|
16
16
|
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
17
17
|
function Flex(props) {
|
|
18
|
-
const { children, alignItems = 'center', alignContent, justifyContent, flexFlow, flexWrap, flexDirection } = props, extra = __rest(props, ["children", "alignItems", "alignContent", "justifyContent", "flexFlow", "flexWrap", "flexDirection"]);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} }, extra, { children: children })));
|
|
28
|
-
}
|
|
29
|
-
function FlexItem(props) {
|
|
30
|
-
const { children, alignSelf, order, flex, flexGrow, flexShrink, flexBasis } = props, extra = __rest(props, ["children", "alignSelf", "order", "flex", "flexGrow", "flexShrink", "flexBasis"]);
|
|
31
|
-
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ css: {
|
|
32
|
-
alignSelf,
|
|
33
|
-
order,
|
|
34
|
-
flex,
|
|
35
|
-
flexGrow,
|
|
36
|
-
flexShrink,
|
|
37
|
-
flexBasis,
|
|
38
|
-
} }, extra, { children: children })));
|
|
18
|
+
const { children, alignItems = 'center', alignContent, justifyContent, flexFlow, flexWrap, flexDirection, style } = props, extra = __rest(props, ["children", "alignItems", "alignContent", "justifyContent", "flexFlow", "flexWrap", "flexDirection", "style"]);
|
|
19
|
+
// 布局属性走原生 inline style:避免 emotion 在每次 render 哈希对象字面量
|
|
20
|
+
const inlineStyle = Object.assign({ display: 'flex', alignItems,
|
|
21
|
+
alignContent,
|
|
22
|
+
justifyContent,
|
|
23
|
+
flexFlow,
|
|
24
|
+
flexWrap,
|
|
25
|
+
flexDirection }, style);
|
|
26
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ style: inlineStyle }, extra, { children: children })));
|
|
39
27
|
}
|
|
28
|
+
var FlexItem_1 = require("./FlexItem");
|
|
29
|
+
Object.defineProperty(exports, "FlexItem", { enumerable: true, get: function () { return FlexItem_1.FlexItem; } });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Interpolation, Theme } from
|
|
2
|
-
import
|
|
3
|
-
import * as CSS from
|
|
4
|
-
export interface IndicatorProps extends
|
|
1
|
+
import { Interpolation, Theme } from "@emotion/react";
|
|
2
|
+
import { HTMLAttributes } from "react";
|
|
3
|
+
import * as CSS from "csstype";
|
|
4
|
+
export interface IndicatorProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
5
|
size?: CSS.Property.Width | number;
|
|
6
6
|
rounded?: boolean;
|
|
7
7
|
barWidth?: number;
|
|
@@ -12,7 +12,10 @@ export interface IndicatorProps extends React.DetailedHTMLProps<React.HTMLAttrib
|
|
|
12
12
|
containerStyle?: Interpolation<Theme>;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* iOS 风菊花转圈指示器(仿 UIActivityIndicatorView 节奏)。
|
|
16
|
+
* 性能要点:
|
|
17
|
+
* - 用 opacity 动画替代 fill 动画,触发 GPU 合成而非 SVG paint
|
|
18
|
+
* - keyframes 全局单例,颜色/时长变化不会污染样式表
|
|
19
|
+
* - animation-delay 走 inline style,emotion 不再为每条 bar 生成独立类名
|
|
17
20
|
*/
|
|
18
21
|
export declare function Indicator(props: IndicatorProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
package/build/Indicator/index.js
CHANGED
|
@@ -10,56 +10,53 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
}
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
14
|
exports.Indicator = Indicator;
|
|
18
15
|
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
19
16
|
const react_1 = require("@emotion/react");
|
|
20
|
-
const react_2 =
|
|
17
|
+
const react_2 = require("react");
|
|
21
18
|
const cssUtil_1 = require("../utils/cssUtil");
|
|
22
19
|
const style_1 = require("./style");
|
|
23
20
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
21
|
+
* iOS 风菊花转圈指示器(仿 UIActivityIndicatorView 节奏)。
|
|
22
|
+
* 性能要点:
|
|
23
|
+
* - 用 opacity 动画替代 fill 动画,触发 GPU 合成而非 SVG paint
|
|
24
|
+
* - keyframes 全局单例,颜色/时长变化不会污染样式表
|
|
25
|
+
* - animation-delay 走 inline style,emotion 不再为每条 bar 生成独立类名
|
|
26
26
|
*/
|
|
27
27
|
function Indicator(props) {
|
|
28
|
-
const { size, rounded = true, barWidth =
|
|
28
|
+
const { size, rounded = true, barWidth = 8, barHeight = 26, barColor = "#ffffff", barCount = 12, duration = 1000, containerStyle } = props, attributes = __rest(props, ["size", "rounded", "barWidth", "barHeight", "barColor", "barCount", "duration", "containerStyle"]);
|
|
29
29
|
const radius = rounded ? barWidth / 2 : 0;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
animationDelay: `${-(duration * (barCount - i)) / barCount}ms`,
|
|
36
|
-
} }, i));
|
|
37
|
-
}
|
|
38
|
-
return bars;
|
|
39
|
-
}, [barCount, barWidth, barHeight, radius, duration]);
|
|
40
|
-
// 使用 useMemo 缓存样式,避免每次都重新计算
|
|
41
|
-
const style = react_2.default.useMemo(() => [
|
|
42
|
-
{
|
|
43
|
-
fontSize: 0,
|
|
44
|
-
},
|
|
45
|
-
typeof size !== 'undefined' ? {
|
|
46
|
-
width: (0, cssUtil_1.normalizeUnit)(size),
|
|
47
|
-
height: (0, cssUtil_1.normalizeUnit)(size),
|
|
48
|
-
} : {
|
|
49
|
-
width: '.6rem',
|
|
50
|
-
height: '.6rem',
|
|
51
|
-
}
|
|
30
|
+
const containerCss = (0, react_2.useMemo)(() => [
|
|
31
|
+
{ fontSize: 0, display: "inline-block", lineHeight: 0 },
|
|
32
|
+
size !== undefined
|
|
33
|
+
? { width: (0, cssUtil_1.normalizeUnit)(size), height: (0, cssUtil_1.normalizeUnit)(size) }
|
|
34
|
+
: { width: ".4rem", height: ".4rem" },
|
|
52
35
|
], [size]);
|
|
53
|
-
const
|
|
54
|
-
width:
|
|
55
|
-
height:
|
|
36
|
+
const svgCss = (0, react_2.useMemo)(() => (0, react_1.css)({
|
|
37
|
+
width: "100%",
|
|
38
|
+
height: "100%",
|
|
39
|
+
display: "block",
|
|
56
40
|
rect: {
|
|
57
|
-
fill:
|
|
58
|
-
animationName:
|
|
41
|
+
fill: barColor,
|
|
42
|
+
animationName: `${style_1.barFadeKeyframes}`,
|
|
59
43
|
animationDuration: `${duration}ms`,
|
|
60
|
-
animationTimingFunction:
|
|
61
|
-
animationIterationCount:
|
|
44
|
+
animationTimingFunction: "linear",
|
|
45
|
+
animationIterationCount: "infinite",
|
|
46
|
+
willChange: "opacity",
|
|
62
47
|
},
|
|
63
48
|
}), [barColor, duration]);
|
|
64
|
-
|
|
49
|
+
const bars = (0, react_2.useMemo)(() => {
|
|
50
|
+
const list = [];
|
|
51
|
+
const x = (100 - barWidth) / 2;
|
|
52
|
+
for (let i = 0; i < barCount; i++) {
|
|
53
|
+
list.push((0, jsx_runtime_1.jsx)("rect", { x: x, y: 0, rx: radius, ry: radius, width: barWidth, height: barHeight, transform: `rotate(${(360 / barCount) * i} 50 50)`,
|
|
54
|
+
// 负 delay:组件挂载即处于稳态动画中,不会先停后转
|
|
55
|
+
style: {
|
|
56
|
+
animationDelay: `${-(duration * (barCount - i)) / barCount}ms`,
|
|
57
|
+
} }, i));
|
|
58
|
+
}
|
|
59
|
+
return list;
|
|
60
|
+
}, [barCount, barWidth, barHeight, radius, duration]);
|
|
61
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ css: [containerCss, containerStyle] }, attributes, { children: (0, jsx_runtime_1.jsx)("svg", { viewBox: "0 0 100 100", css: svgCss, "aria-hidden": "true", children: bars }) })));
|
|
65
62
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* iOS 菊花单条 bar 的不透明度衰减动画
|
|
3
|
+
* 1 -> 0.18 线性衰减;keyframes 与颜色解耦,全局共享单例,
|
|
4
|
+
* 走 opacity 触发 GPU 合成而非 SVG paint,性能更高。
|
|
4
5
|
*/
|
|
5
|
-
export declare
|
|
6
|
+
export declare const barFadeKeyframes: {
|
|
6
7
|
name: string;
|
|
7
8
|
styles: string;
|
|
8
9
|
anim: 1;
|
package/build/Indicator/style.js
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.barFadeKeyframes = void 0;
|
|
4
4
|
const react_1 = require("@emotion/react");
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* iOS 菊花单条 bar 的不透明度衰减动画
|
|
7
|
+
* 1 -> 0.18 线性衰减;keyframes 与颜色解耦,全局共享单例,
|
|
8
|
+
* 走 opacity 触发 GPU 合成而非 SVG paint,性能更高。
|
|
8
9
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
to {
|
|
15
|
-
fill: transparent;
|
|
16
|
-
}
|
|
17
|
-
`;
|
|
18
|
-
}
|
|
10
|
+
exports.barFadeKeyframes = (0, react_1.keyframes) `
|
|
11
|
+
0% { opacity: 1; }
|
|
12
|
+
100% { opacity: 0.18; }
|
|
13
|
+
`;
|
package/build/Loading/Wrapper.js
CHANGED
|
@@ -17,8 +17,9 @@ function Wrapper(props) {
|
|
|
17
17
|
if (typeof overlay === 'object') {
|
|
18
18
|
overlayProps = Object.assign(Object.assign({}, overlayProps), overlay);
|
|
19
19
|
}
|
|
20
|
-
//
|
|
20
|
+
// 指示器样式:默认 size .48rem,保证带文字 / 不带文字两态指示器大小一致
|
|
21
21
|
let indicatorProps = {
|
|
22
|
+
size: '.48rem',
|
|
22
23
|
barWidth: 5,
|
|
23
24
|
barHeight: 25,
|
|
24
25
|
barCount: 14,
|
package/build/Loading/style.js
CHANGED
|
@@ -20,8 +20,10 @@ exports.LoadingHide = (0, react_1.keyframes) `
|
|
|
20
20
|
`;
|
|
21
21
|
exports.style = {
|
|
22
22
|
boxCommon: {
|
|
23
|
-
backgroundColor: `rgba(0, 0, 0, .
|
|
24
|
-
borderRadius: '.
|
|
23
|
+
backgroundColor: `rgba(0, 0, 0, .72)`,
|
|
24
|
+
borderRadius: '.2rem',
|
|
25
|
+
backdropFilter: 'blur(20px) saturate(160%)',
|
|
26
|
+
WebkitBackdropFilter: 'blur(20px) saturate(160%)',
|
|
25
27
|
},
|
|
26
28
|
box: {
|
|
27
29
|
width: '1.6rem',
|
|
@@ -33,19 +35,14 @@ exports.style = {
|
|
|
33
35
|
boxHide: {
|
|
34
36
|
animation: `${exports.LoadingHide} 200ms`,
|
|
35
37
|
},
|
|
36
|
-
boxWithExtra:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"> div:first-of-type": {
|
|
40
|
-
width: '.48rem',
|
|
41
|
-
height: '.48rem',
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
],
|
|
38
|
+
boxWithExtra: {
|
|
39
|
+
padding: '.3rem',
|
|
40
|
+
},
|
|
45
41
|
hint: {
|
|
46
|
-
color: "#
|
|
42
|
+
color: "#ffffff",
|
|
47
43
|
whiteSpace: "nowrap",
|
|
48
44
|
fontSize: '.28rem',
|
|
49
45
|
marginLeft: '.2rem',
|
|
46
|
+
fontWeight: 500,
|
|
50
47
|
},
|
|
51
48
|
};
|
package/build/Overlay/index.js
CHANGED
|
@@ -37,13 +37,18 @@ function Overlay(props) {
|
|
|
37
37
|
const style = (0, react_1.useMemo)(() => {
|
|
38
38
|
const styles = [];
|
|
39
39
|
// 如果是全屏,设置全屏样式
|
|
40
|
+
// 通过 CSS 变量 --clxx-max-width 与 Container 的 maxWidth 联动;
|
|
41
|
+
// PC 端 fixed 默认参照浏览器窗口,这里用 left:50% + translateX(-50%) + maxWidth
|
|
42
|
+
// 让遮罩 / 弹窗水平居中并限制在 Container 视口范围内
|
|
40
43
|
if (fullScreen) {
|
|
41
44
|
styles.push({
|
|
42
45
|
zIndex: 9999,
|
|
43
46
|
position: "fixed",
|
|
44
47
|
top: 0,
|
|
45
|
-
left:
|
|
48
|
+
left: "50%",
|
|
49
|
+
transform: "translateX(-50%)",
|
|
46
50
|
width: "100%",
|
|
51
|
+
maxWidth: "var(--clxx-max-width, 100%)",
|
|
47
52
|
height: "100%",
|
|
48
53
|
backgroundColor: maskColor,
|
|
49
54
|
});
|