rox-react-components 0.0.34 → 0.0.36

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/README.md CHANGED
@@ -8,4 +8,6 @@
8
8
 
9
9
  ## Card [Card Demo](https://stackblitz.com/edit/stackblitz-starters-hjyeni?file=src%2FApp.tsx)
10
10
 
11
+ ## Button [Button Demo](https://stackblitz.com/edit/stackblitz-starters-mze3as?file=src%2FApp.tsx)
12
+
11
13
  ## Popup -> Designing
@@ -0,0 +1,10 @@
1
+ import { FC, HTMLAttributes, PropsWithChildren } from 'react';
2
+ interface ButtonProps extends HTMLAttributes<HTMLButtonElement>, PropsWithChildren {
3
+ wavesColor?: string;
4
+ radius?: number;
5
+ bg?: string;
6
+ color?: string;
7
+ block?: boolean;
8
+ }
9
+ declare const Button: FC<ButtonProps>;
10
+ export default Button;
@@ -0,0 +1 @@
1
+ import{__rest as t,__assign as o}from"tslib";import{css as e}from"aphrodite/no-important";import r,{useRef as i,useMemo as l,useCallback as n,useEffect as c}from"react";import a from"./styles.js";var d=["relative","absolute","fixed"],s=function(s){var u=s.children,f=s.style,p=void 0===f?{}:f,m=s.block,v=void 0!==m&&m,h=s.className,b=void 0===h?"":h,g=s.radius,y=void 0===g?4:g,C=s.bg,k=void 0===C?"rgba(0,0,0,.7)":C,x=s.color,w=void 0===x?"#ffffff":x,N=s.onClick,T=s.wavesColor,E=void 0===T?"rgba(255,255,255,.3)":T,R=t(s,["children","style","block","className","radius","bg","color","onClick","wavesColor"]),j=i([]),B=i(null),H=l((function(){return o(o({},p),{overflow:"hidden",borderRadius:y+"px",background:k,color:w})}),[p,y,k,w]),L=n((function(t){null==N||N(t);var o,r=t.currentTarget;j.current.length?o=j.current.shift():(o=document.createElement("div")).classList.add(e(a.ripple));var i=r.getBoundingClientRect();o.style.width=o.style.height=Math.max(i.width,i.height)+"px",o.style.backgroundColor=E,r.appendChild(o);var l=t.pageY-i.top-o.offsetHeight/2-document.body.scrollTop+"px",n=t.pageX-i.left-o.offsetWidth/2-document.body.scrollTop+"px";o.style.top=l,o.style.left=n,o.onanimationend=function(){r.removeChild(o),j.current.push(o)}}),[N,E]);return c((function(){if(B.current){var t=getComputedStyle(B.current);d.includes(t.position)||(B.current.style.position="relative")}}),[]),r.createElement("button",o({},R,{className:"".concat(b," ").concat(e(a.button)," ").concat(v?e(a.block):""),style:H,ref:B,onClick:L}),u)};export{s as default};
@@ -0,0 +1,2 @@
1
+ import Button from './Button';
2
+ export default Button;
@@ -0,0 +1 @@
1
+ import t from"./Button.js";export{t as default};
@@ -0,0 +1,6 @@
1
+ declare const styles: {
2
+ button: object;
3
+ block: object;
4
+ ripple: object;
5
+ };
6
+ export default styles;
@@ -0,0 +1 @@
1
+ import{StyleSheet as o}from"aphrodite/no-important";var n=o.create({button:{border:"1px solid transparent",boxSizing:"border-box",padding:"8px 20px",cursor:"pointer",outline:"none",":focus":{outline:"none"},":focus-within":{outline:"none"}},block:{display:"block",width:"100%"},ripple:{position:"absolute",borderRadius:"100%",pointerEvents:"none",transform:"scale(0)",opacity:1,animationName:[{to:{opacity:0,transform:"scale(2)","-webkit-transform":"scale(2)"}}],animationDuration:"0.4s",animationTimingFunction:"ease-out"}});export{n as default};
@@ -1,5 +1,5 @@
1
1
  import React, { CSSProperties, PropsWithChildren } from 'react';
2
- import { ExposedScrollViewMethods } from './type';
2
+ import { ScrollViewExposeMethods } from './type';
3
3
  interface OnScrollParameters {
4
4
  x?: number;
5
5
  y?: number;
@@ -15,5 +15,5 @@ interface ScrollViewProps extends PropsWithChildren {
15
15
  onReachLeft?: (done: Function) => void;
16
16
  onReachRight?: (done: Function) => void;
17
17
  }
18
- declare const _default: (props: ScrollViewProps & React.RefAttributes<ExposedScrollViewMethods>) => React.ReactNode;
18
+ declare const _default: (props: ScrollViewProps & React.RefAttributes<ScrollViewExposeMethods>) => React.ReactNode;
19
19
  export default _default;
@@ -3,6 +3,6 @@ export interface ToParams {
3
3
  y?: number;
4
4
  animation?: boolean;
5
5
  }
6
- export interface ExposedScrollViewMethods {
6
+ export interface ScrollViewExposeMethods {
7
7
  to: (data?: ToParams) => void;
8
8
  }
@@ -1,5 +1,6 @@
1
1
  export * from './types';
2
2
  export { default as utils } from './utils';
3
+ export { default as Button } from './Button';
3
4
  export { default as Card } from './Card';
4
5
  export { default as Container } from './Container';
5
6
  export { default as Loading } from './Loading';
package/dist/es/index.js CHANGED
@@ -1 +1 @@
1
- export{default as utils}from"./utils.js";export{default as Card}from"./Card/Card.js";export{default as Container}from"./Container/Container.js";export{default as Loading}from"./Loading/Loading.js";export{default as Popup}from"./Popup/Popup.js";export{default as ScrollView}from"./ScrollView/ScrollView.js";export{default as Swiper}from"./Swiper/Swiper.js";
1
+ export{default as utils}from"./utils.js";export{default as Button}from"./Button/Button.js";export{default as Card}from"./Card/Card.js";export{default as Container}from"./Container/Container.js";export{default as Loading}from"./Loading/Loading.js";export{default as Popup}from"./Popup/Popup.js";export{default as ScrollView}from"./ScrollView/ScrollView.js";export{default as Swiper}from"./Swiper/Swiper.js";
@@ -1,2 +1,3 @@
1
1
  export * from './Popup/type';
2
+ export * from './ScrollView/type';
2
3
  export * from './Swiper/type';
package/dist/index.d.ts CHANGED
@@ -1,8 +1,17 @@
1
- import React, { PropsWithChildren, ReactNode, CSSProperties, FC, Component } from 'react';
1
+ import React, { PropsWithChildren, ReactNode, CSSProperties, FC, HTMLAttributes, Component } from 'react';
2
2
 
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;
@@ -31,6 +40,15 @@ declare const _default$2: {
31
40
  parseUrl: typeof parseUrl;
32
41
  };
33
42
 
43
+ interface ButtonProps extends HTMLAttributes<HTMLButtonElement>, PropsWithChildren {
44
+ wavesColor?: string;
45
+ radius?: number;
46
+ bg?: string;
47
+ color?: string;
48
+ block?: boolean;
49
+ }
50
+ declare const Button: FC<ButtonProps>;
51
+
34
52
  interface CardProps extends PropsWithChildren {
35
53
  expand?: boolean;
36
54
  duration?: number;
@@ -84,15 +102,6 @@ interface PopupProps extends PropsWithChildren {
84
102
  }
85
103
  declare function PopupContainer(_props: PopupProps): React.ReactPortal | null;
86
104
 
87
- interface ToParams {
88
- x?: number;
89
- y?: number;
90
- animation?: boolean;
91
- }
92
- interface ExposedScrollViewMethods {
93
- to: (data?: ToParams) => void;
94
- }
95
-
96
105
  interface OnScrollParameters {
97
106
  x?: number;
98
107
  y?: number;
@@ -108,11 +117,11 @@ interface ScrollViewProps extends PropsWithChildren {
108
117
  onReachLeft?: (done: Function) => void;
109
118
  onReachRight?: (done: Function) => void;
110
119
  }
111
- declare const _default$1: (props: ScrollViewProps & React.RefAttributes<ExposedScrollViewMethods>) => React.ReactNode;
120
+ declare const _default$1: (props: ScrollViewProps & React.RefAttributes<ScrollViewExposeMethods>) => React.ReactNode;
112
121
 
113
122
  declare module 'react' {
114
123
  function forwardRef<T, P = {}>(render: (props: P, ref: React.Ref<T>) => React.ReactNode | null): (props: P & React.RefAttributes<T>) => React.ReactNode | null;
115
124
  }
116
125
  declare const _default: <T extends unknown>(props: SwiperProps<T> & React.RefAttributes<SwiperExposeMethods>) => React.ReactNode;
117
126
 
118
- export { Card, Container, Loading, PopupContainer as Popup, type PopupPosition, type PopupType, _default$1 as ScrollView, _default as Swiper, type SwiperExposeMethods, type SwiperProps, _default$2 as utils };
127
+ export { Button, 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 };
@@ -0,0 +1,10 @@
1
+ import { FC, HTMLAttributes, PropsWithChildren } from 'react';
2
+ interface ButtonProps extends HTMLAttributes<HTMLButtonElement>, PropsWithChildren {
3
+ wavesColor?: string;
4
+ radius?: number;
5
+ bg?: string;
6
+ color?: string;
7
+ block?: boolean;
8
+ }
9
+ declare const Button: FC<ButtonProps>;
10
+ export default Button;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("aphrodite/no-important"),o=require("react"),r=require("./styles.js"),l=["relative","absolute","fixed"];exports.default=function(s){var i=s.children,n=s.style,a=void 0===n?{}:n,c=s.block,u=void 0!==c&&c,d=s.className,f=void 0===d?"":d,p=s.radius,v=void 0===p?4:p,g=s.bg,b=void 0===g?"rgba(0,0,0,.7)":g,h=s.color,m=void 0===h?"#ffffff":h,y=s.onClick,C=s.wavesColor,_=void 0===C?"rgba(255,255,255,.3)":C,k=e.__rest(s,["children","style","block","className","radius","bg","color","onClick","wavesColor"]),x=o.useRef([]),w=o.useRef(null),q=o.useMemo((function(){return e.__assign(e.__assign({},a),{overflow:"hidden",borderRadius:v+"px",background:b,color:m})}),[a,v,b,m]),R=o.useCallback((function(e){null==y||y(e);var o,l=e.currentTarget;x.current.length?o=x.current.shift():(o=document.createElement("div")).classList.add(t.css(r.default.ripple));var s=l.getBoundingClientRect();o.style.width=o.style.height=Math.max(s.width,s.height)+"px",o.style.backgroundColor=_,l.appendChild(o);var i=e.pageY-s.top-o.offsetHeight/2-document.body.scrollTop+"px",n=e.pageX-s.left-o.offsetWidth/2-document.body.scrollTop+"px";o.style.top=i,o.style.left=n,o.onanimationend=function(){l.removeChild(o),x.current.push(o)}}),[y,_]);return o.useEffect((function(){if(w.current){var e=getComputedStyle(w.current);l.includes(e.position)||(w.current.style.position="relative")}}),[]),o.createElement("button",e.__assign({},k,{className:"".concat(f," ").concat(t.css(r.default.button)," ").concat(u?t.css(r.default.block):""),style:q,ref:w,onClick:R}),i)};
@@ -0,0 +1,2 @@
1
+ import Button from './Button';
2
+ export default Button;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./Button.js");exports.default=e.default;
@@ -0,0 +1,6 @@
1
+ declare const styles: {
2
+ button: object;
3
+ block: object;
4
+ ripple: object;
5
+ };
6
+ export default styles;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var o=require("aphrodite/no-important").StyleSheet.create({button:{border:"1px solid transparent",boxSizing:"border-box",padding:"8px 20px",cursor:"pointer",outline:"none",":focus":{outline:"none"},":focus-within":{outline:"none"}},block:{display:"block",width:"100%"},ripple:{position:"absolute",borderRadius:"100%",pointerEvents:"none",transform:"scale(0)",opacity:1,animationName:[{to:{opacity:0,transform:"scale(2)","-webkit-transform":"scale(2)"}}],animationDuration:"0.4s",animationTimingFunction:"ease-out"}});exports.default=o;
@@ -1,5 +1,5 @@
1
1
  import React, { CSSProperties, PropsWithChildren } from 'react';
2
- import { ExposedScrollViewMethods } from './type';
2
+ import { ScrollViewExposeMethods } from './type';
3
3
  interface OnScrollParameters {
4
4
  x?: number;
5
5
  y?: number;
@@ -15,5 +15,5 @@ interface ScrollViewProps extends PropsWithChildren {
15
15
  onReachLeft?: (done: Function) => void;
16
16
  onReachRight?: (done: Function) => void;
17
17
  }
18
- declare const _default: (props: ScrollViewProps & React.RefAttributes<ExposedScrollViewMethods>) => React.ReactNode;
18
+ declare const _default: (props: ScrollViewProps & React.RefAttributes<ScrollViewExposeMethods>) => React.ReactNode;
19
19
  export default _default;
@@ -3,6 +3,6 @@ export interface ToParams {
3
3
  y?: number;
4
4
  animation?: boolean;
5
5
  }
6
- export interface ExposedScrollViewMethods {
6
+ export interface ScrollViewExposeMethods {
7
7
  to: (data?: ToParams) => void;
8
8
  }
@@ -1,5 +1,6 @@
1
1
  export * from './types';
2
2
  export { default as utils } from './utils';
3
+ export { default as Button } from './Button';
3
4
  export { default as Card } from './Card';
4
5
  export { default as Container } from './Container';
5
6
  export { default as Loading } from './Loading';
package/dist/lib/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e=require("./utils.js"),r=require("./Card/Card.js"),i=require("./Container/Container.js"),t=require("./Loading/Loading.js"),u=require("./Popup/Popup.js"),o=require("./ScrollView/ScrollView.js"),s=require("./Swiper/Swiper.js");exports.utils=e.default,exports.Card=r.default,exports.Container=i.default,exports.Loading=t.default,exports.Popup=u.default,exports.ScrollView=o.default,exports.Swiper=s.default;
1
+ "use strict";var e=require("./utils.js"),r=require("./Button/Button.js"),t=require("./Card/Card.js"),u=require("./Container/Container.js"),i=require("./Loading/Loading.js"),o=require("./Popup/Popup.js"),s=require("./ScrollView/ScrollView.js"),a=require("./Swiper/Swiper.js");exports.utils=e.default,exports.Button=r.default,exports.Card=t.default,exports.Container=u.default,exports.Loading=i.default,exports.Popup=o.default,exports.ScrollView=s.default,exports.Swiper=a.default;
@@ -1,2 +1,3 @@
1
1
  export * from './Popup/type';
2
+ export * from './ScrollView/type';
2
3
  export * from './Swiper/type';
package/package.json CHANGED
@@ -1,62 +1,62 @@
1
1
  {
2
- "name": "rox-react-components",
3
- "version": "0.0.34",
4
- "main": "dist/lib/index.js",
5
- "module": "dist/es/index.js",
6
- "types": "dist/index.d.ts",
7
- "description": "A React UI Component Library with swiper that support pc and mobile events, and with loading",
8
- "keywords": [
9
- "react",
10
- "slideMenu",
11
- "card",
12
- "swiper",
13
- "mobile swiper",
14
- "pc swiper",
15
- "carousel",
16
- "mobile carousel",
17
- "ps carousel",
18
- "loading",
19
- "container with ratio",
20
- "react swiper carousel pc mobile touch mouse",
21
- "touch events swiper",
22
- "touch events carousel",
23
- "scrollview reachTop reachBottom reachLeft reachRight"
24
- ],
25
- "files": [
26
- "dist",
27
- "README.md",
28
- "pakcage.json"
29
- ],
30
- "engines": {
31
- "node": ">=14"
32
- },
33
- "author": "YangSu.Zhou",
34
- "scripts": {
35
- "dev": "cross-env NODE_ENV=development rollup -c -w",
36
- "build": "cross-env NODE_ENV=production rollup -c"
37
- },
38
- "license": "MIT",
39
- "devDependencies": {
40
- "@rollup/plugin-commonjs": "^25.0.7",
41
- "@rollup/plugin-node-resolve": "^15.2.3",
42
- "@rollup/plugin-strip": "^3.0.4",
43
- "@rollup/plugin-terser": "^0.4.4",
44
- "@rollup/plugin-typescript": "^11.1.5",
45
- "@types/node": "^20.8.10",
46
- "@types/react": "^18.2.35",
47
- "@types/react-dom": "^18.2.14",
48
- "cross-env": "^7.0.3",
49
- "rollup": "^4.3.0",
50
- "rollup-plugin-delete": "^2.0.0",
51
- "rollup-plugin-dts": "^6.1.0",
52
- "rollup-plugin-node-externals": "^6.1.2"
53
- },
54
- "peerDependencies": {
55
- "react": "^18.2.0",
56
- "react-dom": "^18.2.0"
57
- },
58
- "dependencies": {
59
- "aphrodite": "^2.4.0",
60
- "tslib": "^2.6.2"
61
- }
2
+ "name": "rox-react-components",
3
+ "version": "0.0.36",
4
+ "main": "dist/lib/index.js",
5
+ "module": "dist/es/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "description": "A React UI Component Library with swiper that support pc and mobile events, and with loading",
8
+ "keywords": [
9
+ "react",
10
+ "slideMenu",
11
+ "card",
12
+ "swiper",
13
+ "mobile swiper",
14
+ "pc swiper",
15
+ "carousel",
16
+ "mobile carousel",
17
+ "ps carousel",
18
+ "loading",
19
+ "container with ratio",
20
+ "react swiper carousel pc mobile touch mouse",
21
+ "touch events swiper",
22
+ "touch events carousel",
23
+ "scrollview reachTop reachBottom reachLeft reachRight"
24
+ ],
25
+ "files": [
26
+ "dist",
27
+ "README.md",
28
+ "pakcage.json"
29
+ ],
30
+ "engines": {
31
+ "node": ">=14"
32
+ },
33
+ "author": "YangSu.Zhou",
34
+ "scripts": {
35
+ "dev": "cross-env NODE_ENV=development rollup -c -w",
36
+ "build": "cross-env NODE_ENV=production rollup -c"
37
+ },
38
+ "license": "MIT",
39
+ "devDependencies": {
40
+ "@rollup/plugin-commonjs": "^25.0.7",
41
+ "@rollup/plugin-node-resolve": "^15.2.3",
42
+ "@rollup/plugin-strip": "^3.0.4",
43
+ "@rollup/plugin-terser": "^0.4.4",
44
+ "@rollup/plugin-typescript": "^11.1.5",
45
+ "@types/node": "^20.8.10",
46
+ "@types/react": "^18.2.35",
47
+ "@types/react-dom": "^18.2.14",
48
+ "cross-env": "^7.0.3",
49
+ "rollup": "^4.3.0",
50
+ "rollup-plugin-delete": "^2.0.0",
51
+ "rollup-plugin-dts": "^6.1.0",
52
+ "rollup-plugin-node-externals": "^6.1.2"
53
+ },
54
+ "peerDependencies": {
55
+ "react": "^18.2.0",
56
+ "react-dom": "^18.2.0"
57
+ },
58
+ "dependencies": {
59
+ "aphrodite": "^2.4.0",
60
+ "tslib": "^2.6.2"
61
+ }
62
62
  }