react-vant-nova 1.0.9 → 1.1.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/bundle/index.css +52 -0
- package/bundle/index.min.css +1 -1
- package/bundle/react-vant-nova.es.js +561 -498
- package/bundle/react-vant-nova.js +85 -21
- package/bundle/react-vant-nova.min.js +2 -2
- package/es/avatar/Avatar.d.ts +4 -0
- package/es/avatar/Avatar.js +68 -0
- package/es/avatar/PropsType.d.ts +34 -0
- package/es/avatar/PropsType.js +1 -0
- package/es/avatar/index.d.ts +5 -0
- package/es/avatar/index.js +4 -0
- package/es/avatar/style/index.css +52 -0
- package/es/avatar/style/var.css +0 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/lib/avatar/Avatar.d.ts +4 -0
- package/lib/avatar/Avatar.js +94 -0
- package/lib/avatar/PropsType.d.ts +34 -0
- package/lib/avatar/PropsType.js +6 -0
- package/lib/avatar/index.d.ts +5 -0
- package/lib/avatar/index.js +16 -0
- package/lib/avatar/style/index.css +52 -0
- package/lib/avatar/style/var.css +0 -0
- package/lib/index.css +52 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +12 -0
- package/lib/index.min.css +1 -1
- package/package.json +5 -5
|
@@ -935,7 +935,7 @@
|
|
|
935
935
|
);
|
|
936
936
|
return [stateRef.current, setState];
|
|
937
937
|
}
|
|
938
|
-
var index$
|
|
938
|
+
var index$18 = {
|
|
939
939
|
useClickAway,
|
|
940
940
|
useCountDown,
|
|
941
941
|
useEventListener,
|
|
@@ -954,7 +954,7 @@
|
|
|
954
954
|
useMemoizedFn,
|
|
955
955
|
usePropsValue
|
|
956
956
|
};
|
|
957
|
-
var index$
|
|
957
|
+
var index$17 = "";
|
|
958
958
|
function r(e2) {
|
|
959
959
|
var t2, f2, n2 = "";
|
|
960
960
|
if ("string" == typeof e2 || "number" == typeof e2)
|
|
@@ -973,7 +973,7 @@
|
|
|
973
973
|
(e2 = arguments[f2++]) && (t2 = r(e2)) && (n2 && (n2 += " "), n2 += t2);
|
|
974
974
|
return n2;
|
|
975
975
|
}
|
|
976
|
-
var index$
|
|
976
|
+
var index$16 = "";
|
|
977
977
|
const SpinIcon = ({ bem: bem2 }) => /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, Array(12).fill(null).map((_, index2) => /* @__PURE__ */ React__default["default"].createElement("i", {
|
|
978
978
|
key: index2,
|
|
979
979
|
className: clsx(bem2("line", String(index2 + 1)))
|
|
@@ -1001,7 +1001,7 @@
|
|
|
1001
1001
|
bem: bem2
|
|
1002
1002
|
})
|
|
1003
1003
|
});
|
|
1004
|
-
const [bem$
|
|
1004
|
+
const [bem$1G] = createNamespace("loading");
|
|
1005
1005
|
const Loading = (props) => {
|
|
1006
1006
|
const {
|
|
1007
1007
|
className,
|
|
@@ -1023,7 +1023,7 @@
|
|
|
1023
1023
|
const renderText = () => {
|
|
1024
1024
|
if (children) {
|
|
1025
1025
|
return /* @__PURE__ */ React__default["default"].createElement("span", {
|
|
1026
|
-
className: clsx(bem$
|
|
1026
|
+
className: clsx(bem$1G("text")),
|
|
1027
1027
|
style: {
|
|
1028
1028
|
fontSize: addUnit$1(textSize),
|
|
1029
1029
|
color: textColor != null ? textColor : color
|
|
@@ -1033,12 +1033,12 @@
|
|
|
1033
1033
|
return null;
|
|
1034
1034
|
};
|
|
1035
1035
|
return /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
1036
|
-
className: clsx(className, bem$
|
|
1036
|
+
className: clsx(className, bem$1G([type2, { vertical }])),
|
|
1037
1037
|
style: props.style
|
|
1038
1038
|
}, /* @__PURE__ */ React__default["default"].createElement("span", {
|
|
1039
|
-
className: clsx(bem$
|
|
1039
|
+
className: clsx(bem$1G("spinner", type2)),
|
|
1040
1040
|
style: spinnerStyle
|
|
1041
|
-
}, Icon(bem$
|
|
1041
|
+
}, Icon(bem$1G)[type2]), renderText());
|
|
1042
1042
|
};
|
|
1043
1043
|
const WHITE = "#fff";
|
|
1044
1044
|
const BORDER = "rv-hairline";
|
|
@@ -1051,7 +1051,7 @@
|
|
|
1051
1051
|
const SHADOW = "rv-shadow";
|
|
1052
1052
|
const COMPONENT_TYPE_KEY = "__REACT_VANT_COMPONENT";
|
|
1053
1053
|
const ButtonContext = React__default["default"].createContext({});
|
|
1054
|
-
const [bem$
|
|
1054
|
+
const [bem$1F] = createNamespace("button");
|
|
1055
1055
|
const Button$1 = (props) => {
|
|
1056
1056
|
const {
|
|
1057
1057
|
color,
|
|
@@ -1107,7 +1107,7 @@
|
|
|
1107
1107
|
const TagElement = tag;
|
|
1108
1108
|
const classes = clsx(
|
|
1109
1109
|
className,
|
|
1110
|
-
bem$
|
|
1110
|
+
bem$1F([
|
|
1111
1111
|
type2,
|
|
1112
1112
|
size,
|
|
1113
1113
|
{
|
|
@@ -1144,7 +1144,7 @@
|
|
|
1144
1144
|
if (loading) {
|
|
1145
1145
|
const { loadingSize = "20px" } = props;
|
|
1146
1146
|
return /* @__PURE__ */ React__default["default"].createElement(Loading, {
|
|
1147
|
-
className: clsx(bem$
|
|
1147
|
+
className: clsx(bem$1F("loading")),
|
|
1148
1148
|
size: loadingSize,
|
|
1149
1149
|
type: loadingType,
|
|
1150
1150
|
color: type2 === "default" ? void 0 : ""
|
|
@@ -1158,7 +1158,7 @@
|
|
|
1158
1158
|
}
|
|
1159
1159
|
if (props.icon) {
|
|
1160
1160
|
return React__default["default"].cloneElement(props.icon, {
|
|
1161
|
-
className: clsx(bem$
|
|
1161
|
+
className: clsx(bem$1F("icon"))
|
|
1162
1162
|
});
|
|
1163
1163
|
}
|
|
1164
1164
|
return null;
|
|
@@ -1173,13 +1173,13 @@
|
|
|
1173
1173
|
if (text) {
|
|
1174
1174
|
return /* @__PURE__ */ React__default["default"].createElement("span", {
|
|
1175
1175
|
key: "text",
|
|
1176
|
-
className: clsx(bem$
|
|
1176
|
+
className: clsx(bem$1F("text"))
|
|
1177
1177
|
}, text);
|
|
1178
1178
|
}
|
|
1179
1179
|
return null;
|
|
1180
1180
|
};
|
|
1181
1181
|
const renderContent = () => /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
1182
|
-
className: clsx(bem$
|
|
1182
|
+
className: clsx(bem$1F("content"))
|
|
1183
1183
|
}, iconPosition === "left" && renderIcon(), renderText(), iconPosition === "right" && renderIcon());
|
|
1184
1184
|
const ValidTagElement = TagElement;
|
|
1185
1185
|
return /* @__PURE__ */ React__default["default"].createElement(ValidTagElement, {
|
|
@@ -1191,7 +1191,7 @@
|
|
|
1191
1191
|
onClick
|
|
1192
1192
|
}, renderContent());
|
|
1193
1193
|
};
|
|
1194
|
-
const [bem$
|
|
1194
|
+
const [bem$1E] = createNamespace("button-group");
|
|
1195
1195
|
const ButtonGroup = ({
|
|
1196
1196
|
className,
|
|
1197
1197
|
style,
|
|
@@ -1209,7 +1209,7 @@
|
|
|
1209
1209
|
style,
|
|
1210
1210
|
className: clsx(
|
|
1211
1211
|
className,
|
|
1212
|
-
bem$
|
|
1212
|
+
bem$1E([
|
|
1213
1213
|
props.type,
|
|
1214
1214
|
{
|
|
1215
1215
|
round: props.round,
|
|
@@ -1224,7 +1224,7 @@
|
|
|
1224
1224
|
}, children));
|
|
1225
1225
|
};
|
|
1226
1226
|
const Button = Object.assign(Button$1, { Group: ButtonGroup });
|
|
1227
|
-
var index$
|
|
1227
|
+
var index$15 = "";
|
|
1228
1228
|
function mergeProps(...items) {
|
|
1229
1229
|
const result = { ...items[0] };
|
|
1230
1230
|
items.forEach((item) => {
|
|
@@ -1235,7 +1235,7 @@
|
|
|
1235
1235
|
});
|
|
1236
1236
|
return result;
|
|
1237
1237
|
}
|
|
1238
|
-
const [bem$
|
|
1238
|
+
const [bem$1D] = createNamespace("badge");
|
|
1239
1239
|
const Badge = (p2) => {
|
|
1240
1240
|
const props = mergeProps(p2, {
|
|
1241
1241
|
tag: "div",
|
|
@@ -1281,7 +1281,7 @@
|
|
|
1281
1281
|
{
|
|
1282
1282
|
[props.className]: props.className && !props.children
|
|
1283
1283
|
},
|
|
1284
|
-
bem$
|
|
1284
|
+
bem$1D({ dot: props.dot, fixed: !!props.children })
|
|
1285
1285
|
),
|
|
1286
1286
|
style
|
|
1287
1287
|
}, renderContent());
|
|
@@ -1291,7 +1291,7 @@
|
|
|
1291
1291
|
if (props.children) {
|
|
1292
1292
|
const ValidTagElement = TagElement;
|
|
1293
1293
|
return /* @__PURE__ */ React__default["default"].createElement(ValidTagElement, {
|
|
1294
|
-
className: clsx(bem$
|
|
1294
|
+
className: clsx(bem$1D("wrapper"), props.className),
|
|
1295
1295
|
style: props.style,
|
|
1296
1296
|
onClick: props.onClick,
|
|
1297
1297
|
onTouchStart: props.onTouchStart
|
|
@@ -1299,6 +1299,69 @@
|
|
|
1299
1299
|
}
|
|
1300
1300
|
return renderBadge();
|
|
1301
1301
|
};
|
|
1302
|
+
var index$14 = "";
|
|
1303
|
+
const [bem$1C] = createNamespace("avatar");
|
|
1304
|
+
const presetSizes = ["mini", "small", "normal", "large"];
|
|
1305
|
+
const Avatar = (props) => {
|
|
1306
|
+
const {
|
|
1307
|
+
alt,
|
|
1308
|
+
children,
|
|
1309
|
+
className,
|
|
1310
|
+
fallback,
|
|
1311
|
+
fit = "cover",
|
|
1312
|
+
shape = "circle",
|
|
1313
|
+
size = "normal",
|
|
1314
|
+
src,
|
|
1315
|
+
style,
|
|
1316
|
+
onClick,
|
|
1317
|
+
onError,
|
|
1318
|
+
onLoad
|
|
1319
|
+
} = props;
|
|
1320
|
+
const [failed, setFailed] = React.useState(false);
|
|
1321
|
+
React.useEffect(() => {
|
|
1322
|
+
setFailed(false);
|
|
1323
|
+
}, [src]);
|
|
1324
|
+
const avatarStyle = React.useMemo(() => {
|
|
1325
|
+
const internalStyle = { ...style };
|
|
1326
|
+
if (!presetSizes.includes(String(size))) {
|
|
1327
|
+
const sizeValue = addUnit$1(size);
|
|
1328
|
+
internalStyle.width = sizeValue;
|
|
1329
|
+
internalStyle.height = sizeValue;
|
|
1330
|
+
}
|
|
1331
|
+
return internalStyle;
|
|
1332
|
+
}, [style, size]);
|
|
1333
|
+
const handleLoad = (event) => {
|
|
1334
|
+
onLoad == null ? void 0 : onLoad(event);
|
|
1335
|
+
};
|
|
1336
|
+
const handleError = (event) => {
|
|
1337
|
+
setFailed(true);
|
|
1338
|
+
onError == null ? void 0 : onError(event);
|
|
1339
|
+
};
|
|
1340
|
+
const renderContent = () => {
|
|
1341
|
+
if (src && !failed) {
|
|
1342
|
+
return /* @__PURE__ */ React__default["default"].createElement("img", {
|
|
1343
|
+
className: clsx(bem$1C("img")),
|
|
1344
|
+
src,
|
|
1345
|
+
alt: alt || "",
|
|
1346
|
+
style: { objectFit: fit },
|
|
1347
|
+
onLoad: handleLoad,
|
|
1348
|
+
onError: handleError
|
|
1349
|
+
});
|
|
1350
|
+
}
|
|
1351
|
+
return fallback != null ? fallback : children;
|
|
1352
|
+
};
|
|
1353
|
+
return /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
1354
|
+
className: clsx(
|
|
1355
|
+
className,
|
|
1356
|
+
bem$1C({
|
|
1357
|
+
[shape]: !!shape,
|
|
1358
|
+
[String(size)]: presetSizes.includes(String(size))
|
|
1359
|
+
})
|
|
1360
|
+
),
|
|
1361
|
+
style: avatarStyle,
|
|
1362
|
+
onClick
|
|
1363
|
+
}, renderContent());
|
|
1364
|
+
};
|
|
1302
1365
|
var index$13 = "";
|
|
1303
1366
|
var __rest = globalThis && globalThis.__rest || function(s, e2) {
|
|
1304
1367
|
var t2 = {};
|
|
@@ -25356,6 +25419,7 @@
|
|
|
25356
25419
|
exports2.ActionBar = ActionBar;
|
|
25357
25420
|
exports2.ActionSheet = ActionSheet;
|
|
25358
25421
|
exports2.Area = Area;
|
|
25422
|
+
exports2.Avatar = Avatar;
|
|
25359
25423
|
exports2.Badge = Badge;
|
|
25360
25424
|
exports2.Button = Button;
|
|
25361
25425
|
exports2.Calendar = Calendar;
|
|
@@ -25435,6 +25499,6 @@
|
|
|
25435
25499
|
exports2.Typography = TypographyNamespace;
|
|
25436
25500
|
exports2.Uploader = Uploader;
|
|
25437
25501
|
exports2.WaterMark = WaterMark;
|
|
25438
|
-
exports2.hooks = index$
|
|
25502
|
+
exports2.hooks = index$18;
|
|
25439
25503
|
Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
25440
25504
|
});
|