rox-react-components 0.0.11 → 0.0.13

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
@@ -6,6 +6,6 @@
6
6
 
7
7
  # Components
8
8
 
9
- ## Card
9
+ ## Swiper、Loading、 Card、Container、Menu
10
10
 
11
11
  ## Swiper (suppoert <strong>PC</strong> & <strong>Mobile</strong> Platform)
@@ -1 +1 @@
1
- import{__assign as e}from"tslib";import{css as t}from"aphrodite/no-important";import r,{createContext as n,useState as i,useEffect as a,useContext as c,useCallback as o}from"react";import l from"../Card/Card.js";import d from"./styles.js";var u={data:[],renderItem:function(){return null},onChange:function(){return null},subItemStyle:{paddingLeft:"25px"},activeStyle:{color:"skyblue"},active:"0",isMultipleExpand:!1,iconSize:"10px",iconStrokeWidth:"2px",iconColor:"#333"};function m(n){var i=e(e({},u),n),a=i.iconSize,c=i.iconStrokeWidth,o=i.iconColor,l=i.down;return r.createElement("div",{style:{"--size":a,"--strokeWidth":c,"--color":o},className:"".concat(t(d.arrow_right)," ").concat(l?t(d.arrow_down):"")})}var s=n({active:"0",changeActive:function(){return null}}),v=function(n){var h=e(e({},u),n),f=h.renderItem,p=h.item,y=h.subItemStyle,g=h.index,E=h.isMultipleExpand,x=h.icon,A=h.activeIcon,b=i(!1),S=b[0],C=b[1],k=c(s),w=k.active,I=k.changeActive,W=o((function(e){e.stopPropagation(),I(g),h.onChange(p,g),p.children&&Array.isArray(p.children)&&C((function(e){return!e}))}),[I,g,p]);return a((function(){if(void 0!==w){var e=w.split("-"),t=g.split("-");w.startsWith(g)&&e.length>t.length&&g.length<w.length?C(!0):w.startsWith(g)&&g.startsWith(w)||E||C(!1)}}),[w,g]),r.createElement("div",{className:t(d.w_full,d.border_box),onClick:W},r.createElement("div",{className:t(d.item)},f(p)," ",Array.isArray(p.children)&&p.children.length?S?A||r.createElement(m,e({},h,{down:!0})):x||r.createElement(m,e({},h)):null),Array.isArray(p.children)?p.children.map((function(n,i){return r.createElement("div",{key:i,className:t(d.w_full,d.border_box),style:e(e({},u.subItemStyle),y)},r.createElement(l,{expand:S},r.createElement(v,e({},h,{index:g+"-"+i,item:n}))))})):null)},h=function(t){var n=e(e({},u),t),c=i(n.active),o=c[0],l=c[1];return a((function(){if(n.data.length&&void 0!==n.active){var e=n.active.split("-").map((function(e){return Number(e)})),t=n.data,r={};e.forEach((function(e){Array.isArray(t)&&(r=t[e]||{},t=r.children)})),n.onChange(r,n.active)}l(n.active)}),[n.active,n.data]),r.createElement(s.Provider,{value:{active:o,changeActive:l}},n.data.map((function(t,i){return r.createElement(v,e({key:i,index:i.toString()},n,{item:t}))})))};export{h as default};
1
+ import{__assign as e}from"tslib";import{css as t}from"aphrodite/no-important";import r,{createContext as n,useState as i,useEffect as a,useContext as c,useCallback as o}from"react";import l from"../Card/Card.js";import d from"./styles.js";var u={data:[],renderItem:function(){return null},onChange:function(){return null},subItemStyle:{paddingLeft:"25px"},activeStyle:{color:"skyblue"},active:"",isMultipleExpand:!1,iconSize:"10px",iconStrokeWidth:"2px",iconColor:"#333"};function s(n){var i=e(e({},u),n),a=i.iconSize,c=i.iconStrokeWidth,o=i.iconColor,l=i.down;return r.createElement("div",{style:{"--size":a,"--strokeWidth":c,"--color":o},className:"".concat(t(d.arrow_right)," ").concat(l?t(d.arrow_down):"")})}var m=n({active:"0",changeActive:function(){return null}}),v=function(n){var h=e(e({},u),n),f=h.renderItem,p=h.item,y=h.subItemStyle,g=h.activeStyle,E=h.index,x=h.isMultipleExpand,A=h.icon,b=h.activeIcon,S=i(!1),C=S[0],k=S[1],w=c(m),I=w.active,W=w.changeActive,_=o((function(e){e.stopPropagation(),W(E),h.onChange(p,E),p.children&&Array.isArray(p.children)&&k((function(e){return!e}))}),[W,E,p]);return a((function(){if(void 0!==I){var e=I.split("-"),t=E.split("-");I.startsWith(E)&&e.length>t.length&&E.length<I.length?k(!0):I.startsWith(E)&&E.startsWith(I)||x||k(!1)}}),[I,E]),r.createElement("div",{className:t(d.w_full,d.border_box),onClick:_},r.createElement("div",{className:t(d.item),style:I===E?g:{}},f(p)," ",Array.isArray(p.children)&&p.children.length?C?b||r.createElement(s,e({},h,{down:!0})):A||r.createElement(s,e({},h)):null),Array.isArray(p.children)?p.children.map((function(n,i){return r.createElement("div",{key:i,className:t(d.w_full,d.border_box),style:e(e({},u.subItemStyle),y)},r.createElement(l,{expand:C},r.createElement(v,e({},h,{index:E+"-"+i,item:n}))))})):null)},h=function(t){var n=e(e({},u),t),c=i(n.active),o=c[0],l=c[1];return a((function(){if(n.data.length&&void 0!==n.active){var e=n.active.split("-").map((function(e){return Number(e)})),t=n.data,r={};e.forEach((function(e){Array.isArray(t)&&(r=t[e]||{},t=r.children)})),n.onChange(r,n.active)}l(n.active)}),[n.active,n.data]),r.createElement(m.Provider,{value:{active:o,changeActive:l}},n.data.map((function(t,i){return r.createElement(v,e({key:i,index:i.toString()},n,{item:t}))})))};export{h as default};
@@ -1,5 +1,7 @@
1
1
  declare function sleep(timestamp?: number, result?: boolean): Promise<boolean>;
2
+ declare function parseUrl(): Record<string, string | (string | boolean)[] | boolean>;
2
3
  declare const _default: {
3
4
  sleep: typeof sleep;
5
+ parseUrl: typeof parseUrl;
4
6
  };
5
7
  export default _default;
package/dist/es/utils.js CHANGED
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as n}from"tslib";var r={sleep:function(r,i){return void 0===i&&(i=!1),t(this,void 0,void 0,(function(){return n(this,(function(t){return[2,new Promise((function(t){return setTimeout((function(){return t(i)}),r)}))]}))}))}};export{r as default};
1
+ import{__awaiter as r,__generator as i}from"tslib";var n={sleep:function(n,t){return void 0===t&&(t=!1),r(this,void 0,void 0,(function(){return i(this,(function(r){return[2,new Promise((function(r){return setTimeout((function(){return r(t)}),n)}))]}))}))},parseUrl:function(){var r=window.location.href.split("?").slice(1),i={};return r.forEach((function(r){var n=r.indexOf("/");(-1!==n?r.substring(0,n):r).split("&").forEach((function(r){var n=r.split("="),t=n[0],o=n[1],e=void 0===o||o;if(i.hasOwnProperty(t)){var s=i[t];Array.isArray(s)?s.push(e):i[t]=[e]}else i[t]=e}))})),i}};export{n as default};
package/dist/index.d.ts CHANGED
@@ -21,8 +21,10 @@ interface SwiperExposeMethods {
21
21
  }
22
22
 
23
23
  declare function sleep(timestamp?: number, result?: boolean): Promise<boolean>;
24
+ declare function parseUrl(): Record<string, string | (string | boolean)[] | boolean>;
24
25
  declare const _default$1: {
25
26
  sleep: typeof sleep;
27
+ parseUrl: typeof parseUrl;
26
28
  };
27
29
 
28
30
  interface CardProps extends PropsWithChildren {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("aphrodite/no-important"),n=require("react"),a=require("../Card/Card.js"),r=require("./styles.js"),i={data:[],renderItem:function(){return null},onChange:function(){return null},subItemStyle:{paddingLeft:"25px"},activeStyle:{color:"skyblue"},active:"0",isMultipleExpand:!1,iconSize:"10px",iconStrokeWidth:"2px",iconColor:"#333"};function s(a){var s=e.__assign(e.__assign({},i),a),c=s.iconSize,l=s.iconStrokeWidth,o=s.iconColor,u=s.down;return n.createElement("div",{style:{"--size":c,"--strokeWidth":l,"--color":o},className:"".concat(t.css(r.default.arrow_right)," ").concat(u?t.css(r.default.arrow_down):"")})}var c=n.createContext({active:"0",changeActive:function(){return null}}),l=function(o){var u=e.__assign(e.__assign({},i),o),d=u.renderItem,f=u.item,_=u.subItemStyle,v=u.index,g=u.isMultipleExpand,h=u.icon,m=u.activeIcon,p=n.useState(!1),y=p[0],x=p[1],E=n.useContext(c),b=E.active,A=E.changeActive,C=n.useCallback((function(e){e.stopPropagation(),A(v),u.onChange(f,v),f.children&&Array.isArray(f.children)&&x((function(e){return!e}))}),[A,v,f]);return n.useEffect((function(){if(void 0!==b){var e=b.split("-"),t=v.split("-");b.startsWith(v)&&e.length>t.length&&v.length<b.length?x(!0):b.startsWith(v)&&v.startsWith(b)||g||x(!1)}}),[b,v]),n.createElement("div",{className:t.css(r.default.w_full,r.default.border_box),onClick:C},n.createElement("div",{className:t.css(r.default.item)},d(f)," ",Array.isArray(f.children)&&f.children.length?y?m||n.createElement(s,e.__assign({},u,{down:!0})):h||n.createElement(s,e.__assign({},u)):null),Array.isArray(f.children)?f.children.map((function(s,c){return n.createElement("div",{key:c,className:t.css(r.default.w_full,r.default.border_box),style:e.__assign(e.__assign({},i.subItemStyle),_)},n.createElement(a.default,{expand:y},n.createElement(l,e.__assign({},u,{index:v+"-"+c,item:s}))))})):null)};exports.default=function(t){var a=e.__assign(e.__assign({},i),t),r=n.useState(a.active),s=r[0],o=r[1];return n.useEffect((function(){if(a.data.length&&void 0!==a.active){var e=a.active.split("-").map((function(e){return Number(e)})),t=a.data,n={};e.forEach((function(e){Array.isArray(t)&&(n=t[e]||{},t=n.children)})),a.onChange(n,a.active)}o(a.active)}),[a.active,a.data]),n.createElement(c.Provider,{value:{active:s,changeActive:o}},a.data.map((function(t,r){return n.createElement(l,e.__assign({key:r,index:r.toString()},a,{item:t}))})))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("aphrodite/no-important"),n=require("react"),a=require("../Card/Card.js"),r=require("./styles.js"),i={data:[],renderItem:function(){return null},onChange:function(){return null},subItemStyle:{paddingLeft:"25px"},activeStyle:{color:"skyblue"},active:"",isMultipleExpand:!1,iconSize:"10px",iconStrokeWidth:"2px",iconColor:"#333"};function s(a){var s=e.__assign(e.__assign({},i),a),c=s.iconSize,l=s.iconStrokeWidth,o=s.iconColor,u=s.down;return n.createElement("div",{style:{"--size":c,"--strokeWidth":l,"--color":o},className:"".concat(t.css(r.default.arrow_right)," ").concat(u?t.css(r.default.arrow_down):"")})}var c=n.createContext({active:"0",changeActive:function(){return null}}),l=function(o){var u=e.__assign(e.__assign({},i),o),d=u.renderItem,f=u.item,v=u.subItemStyle,_=u.activeStyle,g=u.index,h=u.isMultipleExpand,m=u.icon,p=u.activeIcon,y=n.useState(!1),x=y[0],E=y[1],b=n.useContext(c),S=b.active,A=b.changeActive,C=n.useCallback((function(e){e.stopPropagation(),A(g),u.onChange(f,g),f.children&&Array.isArray(f.children)&&E((function(e){return!e}))}),[A,g,f]);return n.useEffect((function(){if(void 0!==S){var e=S.split("-"),t=g.split("-");S.startsWith(g)&&e.length>t.length&&g.length<S.length?E(!0):S.startsWith(g)&&g.startsWith(S)||h||E(!1)}}),[S,g]),n.createElement("div",{className:t.css(r.default.w_full,r.default.border_box),onClick:C},n.createElement("div",{className:t.css(r.default.item),style:S===g?_:{}},d(f)," ",Array.isArray(f.children)&&f.children.length?x?p||n.createElement(s,e.__assign({},u,{down:!0})):m||n.createElement(s,e.__assign({},u)):null),Array.isArray(f.children)?f.children.map((function(s,c){return n.createElement("div",{key:c,className:t.css(r.default.w_full,r.default.border_box),style:e.__assign(e.__assign({},i.subItemStyle),v)},n.createElement(a.default,{expand:x},n.createElement(l,e.__assign({},u,{index:g+"-"+c,item:s}))))})):null)};exports.default=function(t){var a=e.__assign(e.__assign({},i),t),r=n.useState(a.active),s=r[0],o=r[1];return n.useEffect((function(){if(a.data.length&&void 0!==a.active){var e=a.active.split("-").map((function(e){return Number(e)})),t=a.data,n={};e.forEach((function(e){Array.isArray(t)&&(n=t[e]||{},t=n.children)})),a.onChange(n,a.active)}o(a.active)}),[a.active,a.data]),n.createElement(c.Provider,{value:{active:s,changeActive:o}},a.data.map((function(t,r){return n.createElement(l,e.__assign({key:r,index:r.toString()},a,{item:t}))})))};
@@ -1,5 +1,7 @@
1
1
  declare function sleep(timestamp?: number, result?: boolean): Promise<boolean>;
2
+ declare function parseUrl(): Record<string, string | (string | boolean)[] | boolean>;
2
3
  declare const _default: {
3
4
  sleep: typeof sleep;
5
+ parseUrl: typeof parseUrl;
4
6
  };
5
7
  export default _default;
package/dist/lib/utils.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib");var t={sleep:function(t,r){return void 0===r&&(r=!1),e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(e){return[2,new Promise((function(e){return setTimeout((function(){return e(r)}),t)}))]}))}))}};exports.default=t;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("tslib");var e={sleep:function(e,t){return void 0===t&&(t=!1),r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(r){return[2,new Promise((function(r){return setTimeout((function(){return r(t)}),e)}))]}))}))},parseUrl:function(){var r=window.location.href.split("?").slice(1),e={};return r.forEach((function(r){var t=r.indexOf("/");(-1!==t?r.substring(0,t):r).split("&").forEach((function(r){var t=r.split("="),i=t[0],n=t[1],o=void 0===n||n;if(e.hasOwnProperty(i)){var s=e[i];Array.isArray(s)?s.push(o):e[i]=[o]}else e[i]=o}))})),e}};exports.default=e;
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "rox-react-components",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "main": "dist/lib/index.js",
5
5
  "module": "dist/es/index.js",
6
6
  "types": "dist/index.d.ts",
7
- "description": "A React UI Component Library",
7
+ "description": "A React UI Component Library with swiper that support pc and mobile events, and with loading",
8
8
  "keywords": [
9
9
  "react",
10
10
  "slideMenu",
@@ -18,7 +18,9 @@
18
18
  "menu",
19
19
  "loading",
20
20
  "container with ratio",
21
- "react swiper carousel pc mobile touch mouse"
21
+ "react swiper carousel pc mobile touch mouse",
22
+ "touch events swiper",
23
+ "touch events carousel"
22
24
  ],
23
25
  "files": [
24
26
  "dist",