@nutui/nutui-react-taro 2.6.21 → 2.6.22

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 (62) hide show
  1. package/CHANGELOG.md +22 -5
  2. package/dist/esm/Address.js +1 -1
  3. package/dist/esm/AnimatingNumbers.js +7 -7
  4. package/dist/esm/Audio/style/style.css +1 -1
  5. package/dist/esm/Audio.js +1 -1
  6. package/dist/esm/Avatar.js +1 -1
  7. package/dist/esm/AvatarCropper.js +1 -1
  8. package/dist/esm/BackTop.js +1 -1
  9. package/dist/esm/Button.js +1 -1
  10. package/dist/esm/Calendar.js +1 -1
  11. package/dist/esm/CalendarItem.js +1 -1
  12. package/dist/esm/Cascader.js +1 -1
  13. package/dist/esm/Dialog.js +1 -1
  14. package/dist/esm/Empty.js +1 -1
  15. package/dist/esm/Menu.js +1 -1
  16. package/dist/esm/MenuItem.js +1 -1
  17. package/dist/esm/NavBar/style/style.css +1 -1
  18. package/dist/esm/NavBar.js +1 -1
  19. package/dist/esm/Radio.js +1 -1
  20. package/dist/esm/RadioGroup.js +1 -1
  21. package/dist/esm/Range/style/style.css +1 -1
  22. package/dist/esm/Range.js +1 -1
  23. package/dist/esm/Skeleton.js +1 -1
  24. package/dist/esm/Tabs.js +1 -1
  25. package/dist/esm/Uploader.js +1 -1
  26. package/dist/esm/{address.taro-CWr6jIYg.js → address.taro-Ai6DQF3D.js} +1 -1
  27. package/dist/esm/{audio.taro--yoX2oyx.js → audio.taro-qK1wq4IH.js} +4 -5
  28. package/dist/esm/avatar.taro-9dU2KeWv.js +82 -0
  29. package/dist/esm/{avatarcropper.taro-B0I9uLNp.js → avatarcropper.taro-meD2sizv.js} +1 -1
  30. package/dist/esm/{backtop.taro-CpzSXDW3.js → backtop.taro-D3Lo3jFO.js} +8 -10
  31. package/dist/esm/{button.taro-1kEru6r9.js → button.taro-CixO32Hw.js} +2 -2
  32. package/dist/esm/{calendar.taro-Csq-7imv.js → calendar.taro-C52T1TFf.js} +1 -1
  33. package/dist/esm/{calendaritem.taro-BOMJjsx9.js → calendaritem.taro-CHdJXKkc.js} +1 -1
  34. package/dist/esm/{cascader.taro-DZ_oBTm0.js → cascader.taro-CMOCzo0m.js} +1 -1
  35. package/dist/esm/{dialog.taro-Bg730q8d.js → dialog.taro-yjDaaRHA.js} +1 -1
  36. package/dist/esm/{empty.taro-Dr4eSaDg.js → empty.taro-Dt07kty5.js} +1 -1
  37. package/dist/esm/{menu.taro-BFc4uUxG.js → menu.taro-BmjnA_YM.js} +13 -13
  38. package/dist/esm/{menuitem.taro-D6KQvdRw.js → menuitem.taro-DCqPC4Nu.js} +13 -13
  39. package/dist/esm/{navbar.taro-Dea0-s9Q.js → navbar.taro-HRFRDGii.js} +7 -2
  40. package/dist/esm/nutui-react.es.js +19 -19
  41. package/dist/esm/{radio.taro-CzOHqD3O.js → radio.taro-M2in687s.js} +24 -20
  42. package/dist/esm/{raf-zwv-SBjP.js → raf-Di10dXPS.js} +2 -1
  43. package/dist/esm/{range.taro-BilM3sMH.js → range.taro-D4U2Q7Wx.js} +49 -44
  44. package/dist/esm/{skeleton.taro-bD6fHZop.js → skeleton.taro-D9Vkgsyx.js} +1 -1
  45. package/dist/esm/{tabs.taro-CJiI4q_-.js → tabs.taro-D8bDfm4x.js} +1 -1
  46. package/dist/esm/{uploader.taro-DZyZiEi2.js → uploader.taro-CceZ5Y4t.js} +1 -1
  47. package/dist/locales/base.js +1 -1
  48. package/dist/locales/en-US.js +1 -1
  49. package/dist/locales/id-ID.js +1 -1
  50. package/dist/locales/tr-TR.js +1 -1
  51. package/dist/locales/zh-CN.js +1 -1
  52. package/dist/locales/zh-TW.js +1 -1
  53. package/dist/locales/zh-UG.js +1 -1
  54. package/dist/nutui.react.es.js +211 -251
  55. package/dist/nutui.react.umd.js +211 -251
  56. package/dist/packages/navbar/navbar.scss +0 -5
  57. package/dist/packages/range/range.scss +2 -0
  58. package/dist/style.css +1 -1
  59. package/dist/types/packages/avatar/avatar.d.ts +1 -1
  60. package/dist/types/packages/overlay/overlay.d.ts +1 -1
  61. package/package.json +1 -1
  62. package/dist/esm/avatar.taro-DSL3ErmC.js +0 -85
@@ -4,10 +4,10 @@ import { default as AvatarGroup } from '../avatargroup';
4
4
  export interface AvatarProps extends BasicComponent {
5
5
  size: string;
6
6
  icon: React.ReactNode;
7
- fit: 'contain' | 'cover' | 'fill' | 'none' | 'scale-down';
8
7
  shape: AvatarShape;
9
8
  background: string;
10
9
  color: string;
10
+ fit: 'contain' | 'cover' | 'fill' | 'none' | 'scale-down';
11
11
  src: string;
12
12
  alt: string;
13
13
  onClick: (e: MouseEvent<HTMLDivElement>) => void;
@@ -5,7 +5,7 @@ export interface OverlayProps extends BasicComponent {
5
5
  duration: number;
6
6
  closeOnOverlayClick: boolean;
7
7
  visible: boolean;
8
- lockScroll: boolean;
8
+ lockScroll: boolean | 'strict';
9
9
  onClick: (event: MouseEvent) => void;
10
10
  afterShow: () => void;
11
11
  afterClose: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nutui/nutui-react-taro",
3
- "version": "2.6.21",
3
+ "version": "2.6.22",
4
4
  "style": "dist/style.css",
5
5
  "main": "dist/nutui.react.umd.js",
6
6
  "module": "dist/esm/nutui-react.es.js",
@@ -1,85 +0,0 @@
1
- import { _ as __rest } from "./tslib.es6-iWu3F_1J.js";
2
- import React__default, { useState, useRef, useContext, useEffect } from "react";
3
- import Taro, { getEnv } from "@tarojs/taro";
4
- import classNames from "classnames";
5
- import { User } from "@nutui/icons-react-taro";
6
- import { I as Image } from "./image.taro-CyF6ujA7.js";
7
- import { a as AvatarContext, A as AvatarGroup } from "./avatargroup.taro-ScakjsY1.js";
8
- import { C as ComponentDefaults } from "./typings-DV9RBfhj.js";
9
- const defaultProps = Object.assign(Object.assign({}, ComponentDefaults), { size: "", shape: "round", icon: "", fit: "cover", background: "#eee", color: "#666", src: "", alt: "" });
10
- const classPrefix = `nut-avatar`;
11
- const Avatar = (props) => {
12
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
13
- const _q = Object.assign(Object.assign({}, defaultProps), props), { children, size, shape, background, color, src, icon, fit, alt, className, style, onClick, onError } = _q, rest = __rest(_q, ["children", "size", "shape", "background", "color", "src", "icon", "fit", "alt", "className", "style", "onClick", "onError"]);
14
- const [maxSum, setMaxSum] = useState(0);
15
- const [showMax, setShowMax] = useState(false);
16
- const [avatarIndex, setAvatarIndex] = useState(1);
17
- const avatarRef = useRef(null);
18
- const parent = useContext(AvatarContext);
19
- const sizeValue = ["large", "normal", "small"];
20
- const classes = classNames({
21
- [`nut-avatar-${((_a = parent === null || parent === void 0 ? void 0 : parent.propAvatarGroup) === null || _a === void 0 ? void 0 : _a.size) || size || "normal"}`]: true,
22
- [`nut-avatar-${((_b = parent === null || parent === void 0 ? void 0 : parent.propAvatarGroup) === null || _b === void 0 ? void 0 : _b.shape) || shape}`]: true
23
- });
24
- const cls = classNames(classPrefix, classes, className);
25
- const styles = Object.assign({ width: sizeValue.indexOf(size) > -1 ? "" : `${size}px`, height: sizeValue.indexOf(size) > -1 ? "" : `${size}px`, backgroundColor: `${background}`, color, marginLeft: avatarIndex !== 1 && ((_c = parent === null || parent === void 0 ? void 0 : parent.propAvatarGroup) === null || _c === void 0 ? void 0 : _c.gap) ? `${(_d = parent === null || parent === void 0 ? void 0 : parent.propAvatarGroup) === null || _d === void 0 ? void 0 : _d.gap}px` : "", zIndex: ((_e = parent === null || parent === void 0 ? void 0 : parent.propAvatarGroup) === null || _e === void 0 ? void 0 : _e.level) === "right" ? `${Math.abs(maxSum - avatarIndex)}` : "" }, style);
26
- const maxStyles = {
27
- backgroundColor: `${(_f = parent === null || parent === void 0 ? void 0 : parent.propAvatarGroup) === null || _f === void 0 ? void 0 : _f.maxBackground}`,
28
- color: `${(_g = parent === null || parent === void 0 ? void 0 : parent.propAvatarGroup) === null || _g === void 0 ? void 0 : _g.maxColor}`
29
- };
30
- useEffect(() => {
31
- var _a2;
32
- const avatarChildren = (_a2 = parent === null || parent === void 0 ? void 0 : parent.avatarGroupRef) === null || _a2 === void 0 ? void 0 : _a2.current.children;
33
- if (avatarChildren) {
34
- avatarLength(avatarChildren);
35
- }
36
- }, []);
37
- const isAvatarInClassList = (element) => {
38
- var _a2, _b2;
39
- if (getEnv() === Taro.ENV_TYPE.WEB) {
40
- return element.classList[0] === "nut-avatar" || element.classList.values().next().value === "nut-avatar";
41
- }
42
- return ((_a2 = element.classList) === null || _a2 === void 0 ? void 0 : _a2.tokenList[0]) === "nut-avatar" || ((_b2 = element.classList) === null || _b2 === void 0 ? void 0 : _b2.tokenList.values().next().value) === "nut-avatar";
43
- };
44
- const avatarLength = (children2) => {
45
- var _a2, _b2, _c2;
46
- for (let i = 0; i < children2.length; i++) {
47
- if (children2[i] && children2[i].classList && isAvatarInClassList(children2[i])) {
48
- children2[i].setAttribute("data-index", i + 1);
49
- }
50
- }
51
- const index = (_b2 = (_a2 = avatarRef === null || avatarRef === void 0 ? void 0 : avatarRef.current) === null || _a2 === void 0 ? void 0 : _a2.dataset) === null || _b2 === void 0 ? void 0 : _b2.index;
52
- const maxCount = (_c2 = parent === null || parent === void 0 ? void 0 : parent.propAvatarGroup) === null || _c2 === void 0 ? void 0 : _c2.max;
53
- setMaxSum(children2.length);
54
- setAvatarIndex(index);
55
- if (index === children2.length && index !== maxCount && children2.length > maxCount) {
56
- setShowMax(true);
57
- }
58
- };
59
- const errorEvent = () => {
60
- if (onError) {
61
- onError();
62
- }
63
- };
64
- const clickAvatar = (e) => {
65
- onClick && onClick(e);
66
- };
67
- return React__default.createElement(React__default.Fragment, null, (showMax || !((_h = parent === null || parent === void 0 ? void 0 : parent.propAvatarGroup) === null || _h === void 0 ? void 0 : _h.max) || avatarIndex <= ((_j = parent === null || parent === void 0 ? void 0 : parent.propAvatarGroup) === null || _j === void 0 ? void 0 : _j.max)) && React__default.createElement(
68
- "div",
69
- Object.assign({ className: cls }, rest, { style: !showMax ? styles : maxStyles, onClick: clickAvatar, ref: avatarRef }),
70
- (!((_k = parent === null || parent === void 0 ? void 0 : parent.propAvatarGroup) === null || _k === void 0 ? void 0 : _k.max) || avatarIndex <= ((_l = parent === null || parent === void 0 ? void 0 : parent.propAvatarGroup) === null || _l === void 0 ? void 0 : _l.max)) && React__default.createElement(
71
- React__default.Fragment,
72
- null,
73
- src && React__default.createElement(Image, { className: "avatar-img", src, style: { objectFit: fit }, onError: errorEvent }),
74
- React__default.isValidElement(icon) ? React__default.cloneElement(icon, Object.assign(Object.assign({}, icon.props), { className: `${icon.props.className || ""} icon` })) : null,
75
- children && React__default.createElement("span", { className: "text" }, children),
76
- !src && !icon && !children && React__default.createElement(User, { className: "icon" })
77
- ),
78
- showMax && React__default.createElement("div", { className: "text" }, ((_m = parent === null || parent === void 0 ? void 0 : parent.propAvatarGroup) === null || _m === void 0 ? void 0 : _m.maxContent) ? (_o = parent === null || parent === void 0 ? void 0 : parent.propAvatarGroup) === null || _o === void 0 ? void 0 : _o.maxContent : `+ ${avatarIndex - Number(((_p = parent === null || parent === void 0 ? void 0 : parent.propAvatarGroup) === null || _p === void 0 ? void 0 : _p.max) || 0)}`)
79
- ));
80
- };
81
- Avatar.displayName = "NutAvatar";
82
- Avatar.Group = AvatarGroup;
83
- export {
84
- Avatar as A
85
- };