@nutui/nutui-react 2.5.2 → 2.6.1

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 (42) hide show
  1. package/CHANGELOG.md +29 -5
  2. package/dist/esm/CellGroup.js +1 -1
  3. package/dist/esm/Form/style/style.css +1 -1
  4. package/dist/esm/Image.js +1 -1
  5. package/dist/esm/ImagePreview/style/style.css +1 -1
  6. package/dist/esm/ImagePreview.js +16 -20
  7. package/dist/esm/Indicator.js +25 -1
  8. package/dist/esm/SideNavBar.js +1 -1
  9. package/dist/esm/SubSideNavBar.js +1 -1
  10. package/dist/esm/Swiper/style/index.js +0 -1
  11. package/dist/esm/Swiper/style/style.css +1 -1
  12. package/dist/esm/Swiper.js +273 -306
  13. package/dist/esm/SwiperItem.js +6 -18
  14. package/dist/esm/context4.js +16 -2
  15. package/dist/esm/use-touch.js +13 -3
  16. package/dist/locales/base.js +1 -1
  17. package/dist/locales/en-US.js +1 -1
  18. package/dist/locales/id-ID.js +1 -1
  19. package/dist/locales/tr-TR.js +1 -1
  20. package/dist/locales/zh-CN.js +1 -1
  21. package/dist/locales/zh-TW.js +1 -1
  22. package/dist/locales/zh-UG.js +1 -1
  23. package/dist/nutui.react.es.js +405 -397
  24. package/dist/nutui.react.umd.js +405 -397
  25. package/dist/packages/form/form.scss +0 -3
  26. package/dist/packages/swiper/swiper.scss +30 -16
  27. package/dist/style.css +1 -1
  28. package/dist/style.mjs +1 -1
  29. package/dist/types/packages/input/input.taro.d.ts +1 -1
  30. package/dist/types/packages/swiper/effects/default.d.ts +11 -0
  31. package/dist/types/packages/swiper/effects/focus.d.ts +21 -0
  32. package/dist/types/packages/swiper/index.d.ts +4 -2
  33. package/dist/types/packages/swiper/swiper.d.ts +24 -43
  34. package/dist/types/packages/swiper/types.d.ts +6 -0
  35. package/dist/types/packages/swiperitem/swiperitem.d.ts +8 -4
  36. package/dist/types/utils/use-lock-fn.d.ts +2 -0
  37. package/dist/types/utils/use-ref-state.d.ts +3 -0
  38. package/dist/types/utils/use-touch.d.ts +3 -1
  39. package/package.json +1 -1
  40. package/dist/esm/context5.js +0 -19
  41. package/dist/esm/indicator2.js +0 -28
  42. package/dist/types/packages/picker/doc.en.d.ts +0 -145
package/dist/style.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v2.5.2 Wed Apr 03 2024 18:19:58 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v2.6.1 Fri Apr 19 2024 14:49:48 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -22,7 +22,7 @@ export interface InputProps extends BasicComponent {
22
22
  formatter?: (value: string) => void;
23
23
  onChange?: (value: string) => void;
24
24
  onBlur?: (value: string) => void;
25
- onFocus?: (value: string) => void;
25
+ onFocus?: (value: string, height?: number) => void;
26
26
  onClear?: (value: string) => void;
27
27
  onClick?: (e: ITouchEvent) => void;
28
28
  }
@@ -0,0 +1,11 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { SpringValue } from '@react-spring/web';
3
+ type DefaultEffect = {
4
+ children: ReactNode;
5
+ getSpringsAxis: () => SpringValue<number>;
6
+ isVertical: boolean;
7
+ loop: boolean;
8
+ count: number;
9
+ };
10
+ export declare const defaultEffect: (args: DefaultEffect) => React.JSX.Element[] | null | undefined;
11
+ export {};
@@ -0,0 +1,21 @@
1
+ import React, { ReactNode } from 'react';
2
+ export interface FocusEffect {
3
+ name: 'focus';
4
+ scale: number;
5
+ }
6
+ type DefaultEffect = {
7
+ children: ReactNode;
8
+ springs: any;
9
+ isVertical: boolean;
10
+ loop: boolean;
11
+ count: number;
12
+ current: React.MutableRefObject<number>;
13
+ swiperDirection: React.MutableRefObject<number>;
14
+ effect: FocusEffect;
15
+ transforms: React.MutableRefObject<number[]>;
16
+ dragging: boolean;
17
+ };
18
+ export declare const focusEffect: (args: DefaultEffect) => React.JSX.Element[] | null | undefined;
19
+ export declare const useList: (effect: FocusEffect | undefined, count: number, current: React.MutableRefObject<number>) => [React.MutableRefObject<number[]>, (p: number[]) => void];
20
+ export declare const updateTransform: (transforms: React.MutableRefObject<number[]>, setTransforms: any, effect: FocusEffect, page: number) => void;
21
+ export {};
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
- import { SwiperProps, SwiperRef } from './swiper';
2
+ import { SwiperProps } from './swiper';
3
3
  import SwiperItem from '../../packages/swiperitem';
4
- export type { SwiperProps, SwiperRef } from './swiper';
4
+ import { SwiperRef } from '../../packages/swiper/types';
5
+ export type { SwiperProps } from './swiper';
6
+ export type { SwiperRef } from './types';
5
7
  type CompoundedComponent = React.ForwardRefExoticComponent<Partial<SwiperProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> & React.RefAttributes<SwiperRef>> & {
6
8
  Item: typeof SwiperItem;
7
9
  };
@@ -1,36 +1,11 @@
1
1
  import React, { ReactNode } from 'react';
2
2
  import { BasicComponent } from '../../utils/typings';
3
- export type SwiperRef = {
4
- to: (index: number) => void;
5
- next: () => void;
6
- prev: () => void;
7
- };
3
+ import { SwiperRef } from '../../packages/swiper/types';
4
+ export interface FocusEffect {
5
+ name: 'focus';
6
+ scale: number;
7
+ }
8
8
  export interface SwiperProps extends BasicComponent {
9
- /**
10
- * 轮播卡片的宽度
11
- * @default -
12
- */
13
- width: number | string
14
- /**
15
- * 轮播卡片的高度
16
- * @default -
17
- */
18
- height: number | string
19
- /**
20
- * 动画时长(单位是ms)
21
- * @default 500
22
- */
23
- duration: number | string
24
- /**
25
- * 初始化索引值
26
- * @default 0
27
- */
28
- defaultValue: number | string
29
- /**
30
- * 自动轮播时长,0表示不会自动轮播
31
- * @default 0
32
- */
33
- autoPlay: number | string
34
9
  /**
35
10
  * 轮播方向
36
11
  * @default horizontal
@@ -47,29 +22,35 @@ export interface SwiperProps extends BasicComponent {
47
22
  */
48
23
  loop: boolean
49
24
  /**
50
- * 是否可触摸滑动
51
- * @default true
25
+ * 动画时长(单位是ms)
26
+ * @default 500
52
27
  */
53
- touchable: boolean
28
+ duration: number | string
54
29
  /**
55
- * 滑动过程中是否禁用默认事件
56
- * @default true
30
+ * 自动轮播时长,0表示不会自动轮播
31
+ * @default 0
32
+ */
33
+ autoPlay: boolean | number
34
+ /**
35
+ * 初始化索引值
36
+ * @default 0
57
37
  */
58
- preventDefault: boolean
38
+ defaultValue: number
59
39
  /**
60
- * 滑动过程中是否禁止冒泡
40
+ * 是否可触摸滑动
61
41
  * @default true
62
42
  */
63
- stopPropagation: boolean
43
+ touchable: boolean
44
+ effect: FocusEffect | undefined;
64
45
  /**
65
- * 是否居中展示,必须传对应的width 和 height
66
- * @default false
46
+ * 轮播卡片的尺寸
47
+ * @default -
67
48
  */
68
- center: boolean
49
+ slideSize?: number
69
50
  /**
70
51
  * 卡片切换后的回调
71
52
  * @default -
72
53
  */
73
- onChange?: (current: number) => void
54
+ onChange?: (index: number) => void
74
55
  }
75
- export declare const Swiper: React.ForwardRefExoticComponent<Partial<SwiperProps> & Omit<React.HTMLAttributes<HTMLDivElement>, "onChange"> & React.RefAttributes<SwiperRef>>;
56
+ export declare const Swiper: React.ForwardRefExoticComponent<Partial<SwiperProps> & React.RefAttributes<SwiperRef>>;
@@ -0,0 +1,6 @@
1
+ export type SwiperDirection = 'horizontal' | 'vertical';
2
+ export type SwiperRef = {
3
+ to: (index: number) => void;
4
+ next: () => void;
5
+ prev: () => void;
6
+ };
@@ -1,6 +1,10 @@
1
1
  import React from 'react';
2
- export interface SwiperItemProps {
3
- direction?: string;
4
- size?: 0;
2
+ import { BasicComponent } from '../../utils/typings';
3
+ export interface SwiperItemProps extends BasicComponent {
4
+ onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
5
5
  }
6
- export declare const SwiperItem: React.ForwardRefExoticComponent<Partial<SwiperItemProps> & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
6
+ export declare const SwiperItem: {
7
+ (props: SwiperItemProps): React.JSX.Element;
8
+ defaultProps: SwiperItemProps;
9
+ displayName: string;
10
+ };
@@ -0,0 +1,2 @@
1
+ declare function useLockFn<P extends any[] = any[], V = any>(fn: (...args: P) => Promise<V>): (...args: P) => Promise<V | undefined>;
2
+ export default useLockFn;
@@ -0,0 +1,3 @@
1
+ import { MutableRefObject } from 'react';
2
+ export declare const getRefValue: <T>(ref: MutableRefObject<T>) => T;
3
+ export declare const useRefState: <T>(param: T) => [MutableRefObject<T>, (p: T) => void];
@@ -1,10 +1,11 @@
1
1
  import React from 'react';
2
2
  type Direction = '' | 'vertical' | 'horizontal';
3
3
  export declare function useTouch(): {
4
+ end: (event: React.TouchEvent<HTMLElement>) => void;
4
5
  move: (event: React.TouchEvent<HTMLElement>) => void;
5
6
  start: (event: React.TouchEvent<HTMLElement>) => void;
6
7
  reset: () => void;
7
- touchTime: React.MutableRefObject<number | null>;
8
+ touchTime: React.MutableRefObject<number>;
8
9
  startX: React.MutableRefObject<number>;
9
10
  startY: React.MutableRefObject<number>;
10
11
  deltaX: React.MutableRefObject<number>;
@@ -15,5 +16,6 @@ export declare function useTouch(): {
15
16
  direction: React.MutableRefObject<Direction>;
16
17
  isVertical: () => boolean;
17
18
  isHorizontal: () => boolean;
19
+ last: React.MutableRefObject<boolean>;
18
20
  };
19
21
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nutui/nutui-react",
3
- "version": "2.5.2",
3
+ "version": "2.6.1",
4
4
  "style": "dist/style.css",
5
5
  "main": "dist/nutui.react.umd.js",
6
6
  "module": "dist/esm/nutui-react.es.js",
@@ -1,19 +0,0 @@
1
- import { createContext } from "react";
2
- const handleClick = (e) => {
3
- e.stopPropagation();
4
- const isIcon = e.target.className.includes("arrow-icon");
5
- const isTitle = e.target.className.includes("-title") || isIcon;
6
- const currentClass = e.currentTarget.className;
7
- const isShow = currentClass.includes("sidenavbar-show");
8
- const arrowIcon = e.currentTarget.querySelector(".arrow-icon");
9
- const iconClass = arrowIcon.className;
10
- if (isTitle) {
11
- e.currentTarget.className = isShow ? currentClass.replace("sidenavbar-show", "sidenavbar-hide") : currentClass.replace("sidenavbar-hide", "sidenavbar-show");
12
- arrowIcon.className = isShow ? iconClass.replace("arrow-down", "arrow-up") : iconClass.replace("arrow-up", "arrow-down");
13
- }
14
- };
15
- const OffsetContext = createContext(20);
16
- export {
17
- OffsetContext as O,
18
- handleClick as h
19
- };
@@ -1,28 +0,0 @@
1
- import { _ as __rest } from "./tslib.es6.js";
2
- import React__default from "react";
3
- import classNames from "classnames";
4
- const defaultProps = {
5
- total: 3,
6
- current: 0,
7
- direction: "horizontal"
8
- };
9
- const classPrefix = `nut-indicator`;
10
- const Indicator = (props) => {
11
- const _a = Object.assign(Object.assign({}, defaultProps), props), { total, current, children, className, direction } = _a, rest = __rest(_a, ["total", "current", "children", "className", "direction"]);
12
- const classes = classNames({
13
- [`${classPrefix}-vertical`]: direction === "vertical"
14
- });
15
- const renderElement = () => {
16
- const childs = [];
17
- for (let item = 0; item < total; item++) {
18
- childs.push(item === current ? children || React__default.createElement("div", { key: item, className: `${classPrefix}-dot ${classPrefix}-active` }) : React__default.createElement("div", { key: item, className: `${classPrefix}-dot` }));
19
- }
20
- return childs;
21
- };
22
- return React__default.createElement("div", Object.assign({ className: classNames(classPrefix, classes, className) }, rest), renderElement());
23
- };
24
- Indicator.defaultProps = defaultProps;
25
- Indicator.displayName = "NutIndicator";
26
- export {
27
- Indicator as I
28
- };
@@ -1,145 +0,0 @@
1
- export declare const Internation: {
2
- 'zh-CN': {
3
- basic: string;
4
- chooseCity: string;
5
- defaultSelected: string;
6
- controlled: string;
7
- tileDesc: string;
8
- multipleColumns: string;
9
- chooseTime: string;
10
- cascade: string;
11
- async: string;
12
- theme: string;
13
- validTime: string;
14
- chooseDate: string;
15
- always: string;
16
- monday: string;
17
- tuesday: string;
18
- wednesday: string;
19
- thursday: string;
20
- friday: string;
21
- morning: string;
22
- afternoon: string;
23
- evening: string;
24
- nanJing: string;
25
- wuXi: string;
26
- zangZu: string;
27
- beiJing: string;
28
- lianYunGang: string;
29
- wuhan: string;
30
- yangzhou: string;
31
- daQing: string;
32
- suiHua: string;
33
- weiFang: string;
34
- shijiazhuang: string;
35
- wlmq: string;
36
- hangZhou: string;
37
- chaoYang: string;
38
- haiDian: string;
39
- daXing: string;
40
- dongCheng: string;
41
- xiCheng: string;
42
- fengTai: string;
43
- shangHai: string;
44
- huangPu: string;
45
- changNing: string;
46
- puTuo: string;
47
- yangPu: string;
48
- puDong: string;
49
- };
50
- 'zh-TW': {
51
- basic: string;
52
- chooseCity: string;
53
- defaultSelected: string;
54
- controlled: string;
55
- tileDesc: string;
56
- multipleColumns: string;
57
- chooseTime: string;
58
- cascade: string;
59
- async: string;
60
- theme: string;
61
- chooseDate: string;
62
- always: string;
63
- monday: string;
64
- tuesday: string;
65
- wednesday: string;
66
- thursday: string;
67
- friday: string;
68
- morning: string;
69
- afternoon: string;
70
- evening: string;
71
- nanJing: string;
72
- wuXi: string;
73
- zangZu: string;
74
- beiJing: string;
75
- lianYunGang: string;
76
- wuhan: string;
77
- yangzhou: string;
78
- daQing: string;
79
- suiHua: string;
80
- weiFang: string;
81
- shijiazhuang: string;
82
- wlmq: string;
83
- hangZhou: string;
84
- chaoYang: string;
85
- haiDian: string;
86
- daXing: string;
87
- dongCheng: string;
88
- xiCheng: string;
89
- fengTai: string;
90
- shangHai: string;
91
- huangPu: string;
92
- changNing: string;
93
- puTuo: string;
94
- yangPu: string;
95
- puDong: string;
96
- };
97
- 'en-US': {
98
- basic: string;
99
- chooseCity: string;
100
- defaultSelected: string;
101
- controlled: string;
102
- tileDesc: string;
103
- multipleColumns: string;
104
- chooseTime: string;
105
- cascade: string;
106
- async: string;
107
- theme: string;
108
- validTime: string;
109
- chooseDate: string;
110
- always: string;
111
- monday: string;
112
- tuesday: string;
113
- wednesday: string;
114
- thursday: string;
115
- friday: string;
116
- morning: string;
117
- afternoon: string;
118
- evening: string;
119
- nanJing: string;
120
- wuXi: string;
121
- zangZu: string;
122
- beiJing: string;
123
- lianYunGang: string;
124
- wuhan: string;
125
- yangzhou: string;
126
- daQing: string;
127
- suiHua: string;
128
- weiFang: string;
129
- shijiazhuang: string;
130
- wlmq: string;
131
- hangZhou: string;
132
- chaoYang: string;
133
- haiDian: string;
134
- daXing: string;
135
- dongCheng: string;
136
- xiCheng: string;
137
- fengTai: string;
138
- shangHai: string;
139
- huangPu: string;
140
- changNing: string;
141
- puTuo: string;
142
- yangPu: string;
143
- puDong: string;
144
- };
145
- };