rox-react-components 0.0.33 → 0.0.35
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/dist/es/Popup/Popup.js +1 -1
- package/dist/es/ScrollView/ScrollView.d.ts +3 -2
- package/dist/es/ScrollView/ScrollView.js +1 -1
- package/dist/es/ScrollView/type.d.ts +8 -0
- package/dist/es/types.d.ts +1 -0
- package/dist/index.d.ts +12 -3
- package/dist/lib/Popup/Popup.js +1 -1
- package/dist/lib/ScrollView/ScrollView.d.ts +3 -2
- package/dist/lib/ScrollView/ScrollView.js +1 -1
- package/dist/lib/ScrollView/type.d.ts +8 -0
- package/dist/lib/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/es/Popup/Popup.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as
|
|
1
|
+
import{__assign as r}from"tslib";import{css as t}from"aphrodite/no-important";import e,{useRef as o,useEffect as n,useState as i}from"react";import{createPortal as a}from"react-dom";import m from"./styles.js";var u={visible:!1,position:"bottom",duration:300,bg:"rgba(0,0,0,.3)",maskClosable:!0,popupType:"slide"};function c(r){var o=r.bg;r.visible,r.duration;var n=i(!1);return n[0],n[1],e.createElement("div",{style:{"--bg":o},className:t(m.container)})}function l(t){var i=r(r({},u),t),m=o(document.createElement("div"));return n((function(){var r=m.current;return document.body.appendChild(r),function(){document.body.removeChild(r)}}),[]),m.current?a(e.createElement(c,r({},i)),m.current):null}export{l as default};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { CSSProperties, PropsWithChildren } from 'react';
|
|
2
|
+
import { ScrollViewExposeMethods } from './type';
|
|
2
3
|
interface OnScrollParameters {
|
|
3
4
|
x?: number;
|
|
4
5
|
y?: number;
|
|
@@ -14,5 +15,5 @@ interface ScrollViewProps extends PropsWithChildren {
|
|
|
14
15
|
onReachLeft?: (done: Function) => void;
|
|
15
16
|
onReachRight?: (done: Function) => void;
|
|
16
17
|
}
|
|
17
|
-
declare
|
|
18
|
-
export default
|
|
18
|
+
declare const _default: (props: ScrollViewProps & React.RefAttributes<ScrollViewExposeMethods>) => React.ReactNode;
|
|
19
|
+
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as r}from"tslib";import{css as t}from"aphrodite/no-important";import e,
|
|
1
|
+
import{__assign as r}from"tslib";import{css as t}from"aphrodite/no-important";import n,{forwardRef as e,useRef as o,useMemo as c,useCallback as l,useImperativeHandle as u}from"react";import i from"../utils.js";import a from"./styles.js";var f={style:{width:"100%",height:"100%"},horizontal:!1,vertical:!0,onScroll:function(){return null},threshold:50,onReachTop:function(r){return r()},onReachBottom:function(r){return r()},onReachLeft:function(r){return r()},onReachRight:function(r){return r()}},h={x:0,y:0,animation:!1};var s=e((function(e,s){void 0===e&&(e=f);var m=r(r({},f),e),d=m.style,v=m.children,p=m.horizontal,b=m.vertical,y=m.onScroll,R=m.threshold,_=m.onReachTop,g=m.onReachBottom,T=m.onReachLeft,x=m.onReachRight,w=o(null),L=o(0),S=o(0),E=o(!1),N=o(!1),W=o(!1),j=o(!1),z=c((function(){return r(r({},f.style),d)}),[d]),B=c((function(){return{overflowX:p?"scroll":"hidden",overflowY:b?"scroll":"hidden",scrollbarWidth:"none",msOverflowStyle:"none"}}),[p,b]),H=l((function(r){var t=r.currentTarget,n=t.scrollTop,e=t.scrollHeight,o=t.clientHeight;n>L.current?n+o>=e-R&&!N.current&&(N.current=!0,g((function(){return i.sleep(60).then((function(){return N.current=!1}))}))):n<L.current&&n<=0&&!E.current&&(E.current=!0,_((function(){return i.sleep(60).then((function(){return E.current=!1}))}))),L.current=n}),[R,g,_]),O=l((function(r){var t=r.currentTarget,n=t.scrollLeft,e=t.scrollWidth,o=t.clientWidth;n>S.current?n+o>=e-R&&!j.current&&(j.current=!0,x((function(){return i.sleep(60).then((function(){return j.current=!1}))}))):n<S.current&&n<=0&&!W.current&&(W.current=!0,T((function(){return i.sleep(60).then((function(){return W.current=!1}))}))),S.current=n}),[R,T,x]),X=l((function(r){O(r),H(r)}),[O,H]),Y=l((function(r){var t=r.currentTarget,n=t.scrollTop,e=t.scrollLeft;y({x:e,y:n}),p&&b?X(r):p?O(r):b&&H(r)}),[p,b,y,O,H,X]);return u(s,(function(){return{to:function(t){if(void 0===t&&(t=h),w.current){var n=r(r({},h),t),e=n.x,o=n.y,c=n.animation;w.current.scrollTo({left:e,top:o,behavior:c?"smooth":"auto"})}}}}),[]),n.createElement("div",{style:z,className:t(a.border_box)},n.createElement("div",{className:t(a.w_full,a.h_full,a.border_box)},n.createElement("div",{ref:w,onScroll:Y,style:B,className:t(a.border_box,a.w_full,a.h_full,a.scroll_bar_hide)},v)))}));export{s as default};
|
package/dist/es/types.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,15 @@ import React, { PropsWithChildren, ReactNode, CSSProperties, FC, Component } fro
|
|
|
3
3
|
type PopupPosition = 'left' | 'top' | 'right' | 'bottom' | 'center';
|
|
4
4
|
type PopupType = 'slide' | 'fade' | 'scale';
|
|
5
5
|
|
|
6
|
+
interface ToParams {
|
|
7
|
+
x?: number;
|
|
8
|
+
y?: number;
|
|
9
|
+
animation?: boolean;
|
|
10
|
+
}
|
|
11
|
+
interface ScrollViewExposeMethods {
|
|
12
|
+
to: (data?: ToParams) => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
6
15
|
interface SwiperProps<T> extends PropsWithChildren {
|
|
7
16
|
data: T[];
|
|
8
17
|
renderItem: (item: T) => ReactNode;
|
|
@@ -26,7 +35,7 @@ interface SwiperExposeMethods {
|
|
|
26
35
|
declare function sleep(timestamp?: number, result?: boolean): Promise<boolean>;
|
|
27
36
|
type parseUrlResponse = Record<string, string | (string | boolean)[] | boolean> | string | boolean | (string | boolean)[] | undefined;
|
|
28
37
|
declare function parseUrl(key?: string): parseUrlResponse;
|
|
29
|
-
declare const _default$
|
|
38
|
+
declare const _default$2: {
|
|
30
39
|
sleep: typeof sleep;
|
|
31
40
|
parseUrl: typeof parseUrl;
|
|
32
41
|
};
|
|
@@ -99,11 +108,11 @@ interface ScrollViewProps extends PropsWithChildren {
|
|
|
99
108
|
onReachLeft?: (done: Function) => void;
|
|
100
109
|
onReachRight?: (done: Function) => void;
|
|
101
110
|
}
|
|
102
|
-
declare
|
|
111
|
+
declare const _default$1: (props: ScrollViewProps & React.RefAttributes<ScrollViewExposeMethods>) => React.ReactNode;
|
|
103
112
|
|
|
104
113
|
declare module 'react' {
|
|
105
114
|
function forwardRef<T, P = {}>(render: (props: P, ref: React.Ref<T>) => React.ReactNode | null): (props: P & React.RefAttributes<T>) => React.ReactNode | null;
|
|
106
115
|
}
|
|
107
116
|
declare const _default: <T extends unknown>(props: SwiperProps<T> & React.RefAttributes<SwiperExposeMethods>) => React.ReactNode;
|
|
108
117
|
|
|
109
|
-
export { Card, Container, Loading, PopupContainer as Popup, type PopupPosition, type PopupType, ScrollView, _default as Swiper, type SwiperExposeMethods, type SwiperProps, _default$
|
|
118
|
+
export { Card, Container, Loading, PopupContainer as Popup, type PopupPosition, type PopupType, _default$1 as ScrollView, type ScrollViewExposeMethods, _default as Swiper, type SwiperExposeMethods, type SwiperProps, type ToParams, _default$2 as utils };
|
package/dist/lib/Popup/Popup.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("aphrodite/no-important"),t=require("react"),n=require("react-dom"),i=require("./styles.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("aphrodite/no-important"),t=require("react"),n=require("react-dom"),i=require("./styles.js"),a={visible:!1,position:"bottom",duration:300,bg:"rgba(0,0,0,.3)",maskClosable:!0,popupType:"slide"};function u(e){var n=e.bg;e.visible,e.duration;var a=t.useState(!1);return a[0],a[1],t.createElement("div",{style:{"--bg":n},className:r.css(i.default.container)})}exports.default=function(r){var i=e.__assign(e.__assign({},a),r),s=t.useRef(document.createElement("div"));return t.useEffect((function(){var e=s.current;return document.body.appendChild(e),function(){document.body.removeChild(e)}}),[]),s.current?n.createPortal(t.createElement(u,e.__assign({},i)),s.current):null};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { CSSProperties, PropsWithChildren } from 'react';
|
|
2
|
+
import { ScrollViewExposeMethods } from './type';
|
|
2
3
|
interface OnScrollParameters {
|
|
3
4
|
x?: number;
|
|
4
5
|
y?: number;
|
|
@@ -14,5 +15,5 @@ interface ScrollViewProps extends PropsWithChildren {
|
|
|
14
15
|
onReachLeft?: (done: Function) => void;
|
|
15
16
|
onReachRight?: (done: Function) => void;
|
|
16
17
|
}
|
|
17
|
-
declare
|
|
18
|
-
export default
|
|
18
|
+
declare const _default: (props: ScrollViewProps & React.RefAttributes<ScrollViewExposeMethods>) => React.ReactNode;
|
|
19
|
+
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("aphrodite/no-important"),t=require("react"),n=require("../utils.js"),u=require("./styles.js"),l={style:{width:"100%",height:"100%"},horizontal:!1,vertical:!0,onScroll:function(){return null},threshold:50,onReachTop:function(e){return e()},onReachBottom:function(e){return e()},onReachLeft:function(e){return e()},onReachRight:function(e){return e()}};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("aphrodite/no-important"),t=require("react"),n=require("../utils.js"),u=require("./styles.js"),l={style:{width:"100%",height:"100%"},horizontal:!1,vertical:!0,onScroll:function(){return null},threshold:50,onReachTop:function(e){return e()},onReachBottom:function(e){return e()},onReachLeft:function(e){return e()},onReachRight:function(e){return e()}},o={x:0,y:0,animation:!1};var c=t.forwardRef((function(c,a){void 0===c&&(c=l);var s=e.__assign(e.__assign({},l),c),i=s.style,f=s.children,d=s.horizontal,h=s.vertical,_=s.onScroll,v=s.threshold,R=s.onReachTop,m=s.onReachBottom,b=s.onReachLeft,p=s.onReachRight,g=t.useRef(null),y=t.useRef(0),x=t.useRef(0),T=t.useRef(!1),w=t.useRef(!1),q=t.useRef(!1),k=t.useRef(!1),C=t.useMemo((function(){return e.__assign(e.__assign({},l.style),i)}),[i]),L=t.useMemo((function(){return{overflowX:d?"scroll":"hidden",overflowY:h?"scroll":"hidden",scrollbarWidth:"none",msOverflowStyle:"none"}}),[d,h]),S=t.useCallback((function(e){var r=e.currentTarget,t=r.scrollTop,u=r.scrollHeight,l=r.clientHeight;t>y.current?t+l>=u-v&&!w.current&&(w.current=!0,m((function(){return n.default.sleep(60).then((function(){return w.current=!1}))}))):t<y.current&&t<=0&&!T.current&&(T.current=!0,R((function(){return n.default.sleep(60).then((function(){return T.current=!1}))}))),y.current=t}),[v,m,R]),j=t.useCallback((function(e){var r=e.currentTarget,t=r.scrollLeft,u=r.scrollWidth,l=r.clientWidth;t>x.current?t+l>=u-v&&!k.current&&(k.current=!0,p((function(){return n.default.sleep(60).then((function(){return k.current=!1}))}))):t<x.current&&t<=0&&!q.current&&(q.current=!0,b((function(){return n.default.sleep(60).then((function(){return q.current=!1}))}))),x.current=t}),[v,b,p]),E=t.useCallback((function(e){j(e),S(e)}),[j,S]),H=t.useCallback((function(e){var r=e.currentTarget,t=r.scrollTop,n=r.scrollLeft;_({x:n,y:t}),d&&h?E(e):d?j(e):h&&S(e)}),[d,h,_,j,S,E]);return t.useImperativeHandle(a,(function(){return{to:function(r){if(void 0===r&&(r=o),g.current){var t=e.__assign(e.__assign({},o),r),n=t.x,u=t.y,l=t.animation;g.current.scrollTo({left:n,top:u,behavior:l?"smooth":"auto"})}}}}),[]),t.createElement("div",{style:C,className:r.css(u.default.border_box)},t.createElement("div",{className:r.css(u.default.w_full,u.default.h_full,u.default.border_box)},t.createElement("div",{ref:g,onScroll:H,style:L,className:r.css(u.default.border_box,u.default.w_full,u.default.h_full,u.default.scroll_bar_hide)},f)))}));exports.default=c;
|
package/dist/lib/types.d.ts
CHANGED