rox-react-components 0.0.8 → 0.0.10
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/Card/Card.js +1 -1
- package/dist/es/Container/Container.d.ts +6 -0
- package/dist/es/Container/Container.js +1 -0
- package/dist/es/Container/index.d.ts +2 -0
- package/dist/es/Container/index.js +1 -0
- package/dist/es/Container/styles.d.ts +11 -0
- package/dist/es/Container/styles.js +1 -0
- package/dist/es/Loading/Inner.d.ts +15 -0
- package/dist/es/Loading/Inner.js +1 -0
- package/dist/es/Loading/Loading.d.ts +17 -0
- package/dist/es/Loading/Loading.js +1 -0
- package/dist/es/Loading/dom.d.ts +7 -0
- package/dist/es/Loading/dom.js +1 -0
- package/dist/es/Loading/index.d.ts +2 -0
- package/dist/es/Loading/index.js +1 -0
- package/dist/es/Loading/styles.d.ts +15 -0
- package/dist/es/Loading/styles.js +1 -0
- package/dist/es/Loading/type.d.ts +13 -0
- package/dist/es/Loading/type.js +1 -0
- package/dist/es/Menu/Menu.d.ts +28 -0
- package/dist/es/Menu/Menu.js +1 -0
- package/dist/es/Menu/index.d.ts +2 -0
- package/dist/es/Menu/index.js +1 -0
- package/dist/es/Menu/styles.d.ts +8 -0
- package/dist/es/Menu/styles.js +1 -0
- package/dist/es/index.d.ts +4 -1
- package/dist/es/index.js +1 -1
- package/dist/index.d.ts +67 -8
- package/dist/lib/Card/Card.js +1 -1
- package/dist/lib/Container/Container.d.ts +6 -0
- package/dist/lib/Container/Container.js +1 -0
- package/dist/lib/Container/index.d.ts +2 -0
- package/dist/lib/Container/index.js +1 -0
- package/dist/lib/Container/styles.d.ts +11 -0
- package/dist/lib/Container/styles.js +1 -0
- package/dist/lib/Loading/Inner.d.ts +15 -0
- package/dist/lib/Loading/Inner.js +1 -0
- package/dist/lib/Loading/Loading.d.ts +17 -0
- package/dist/lib/Loading/Loading.js +1 -0
- package/dist/lib/Loading/dom.d.ts +7 -0
- package/dist/lib/Loading/dom.js +1 -0
- package/dist/lib/Loading/index.d.ts +2 -0
- package/dist/lib/Loading/index.js +1 -0
- package/dist/lib/Loading/styles.d.ts +15 -0
- package/dist/lib/Loading/styles.js +1 -0
- package/dist/lib/Loading/type.d.ts +13 -0
- package/dist/lib/Loading/type.js +1 -0
- package/dist/lib/Menu/Menu.d.ts +28 -0
- package/dist/lib/Menu/Menu.js +1 -0
- package/dist/lib/Menu/index.d.ts +2 -0
- package/dist/lib/Menu/index.js +1 -0
- package/dist/lib/Menu/styles.d.ts +8 -0
- package/dist/lib/Menu/styles.js +1 -0
- package/dist/lib/index.d.ts +4 -1
- package/dist/lib/index.js +1 -1
- package/package.json +4 -1
package/dist/es/Card/Card.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{__assign as t}from"tslib";import{css as n}from"aphrodite/no-important";import a,{useMemo as o}from"react";import r from"./styles.js";var i={expand:!1,duration:200},e=function(e){var c=t(t({},i),e),s=c.duration,m=c.expand,d=c.children,l=o((function(){return{transitionDuration:"".concat(s,"ms"),msTransitionDuration:"".concat(s,"ms"),MozTransitionDuration:"".concat(s,"ms"),WebkitTransitionDuration:"".concat(s,"ms")}}),[s]);return a.createElement("div",{style:l,className:"".concat(n(r.collapse)," ").concat(m?n(r.expand):"")},a.createElement("div",{className:n(r.hide0)},d))};export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__assign as t}from"tslib";import{css as r}from"aphrodite/no-important";import e,{useMemo as o}from"react";import l from"./styles.js";var a={ratio:1},i=function(i){var m=t(t({},a),i),n=m.ratio,f=m.children,s=o((function(){return null==n||n<=0?"100%":100/n+"%"}),[n]);return e.createElement("div",{className:r(l.relative,l.w_full,l.h_0,l.border_box),style:{paddingBottom:s}},e.createElement("div",{className:r(l.absolute,l.top_0,l.left_0,l.w_full,l.h_full)},f))};export{i as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import o from"./Container.js";export{o as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{StyleSheet as t}from"aphrodite/no-important";var o=t.create({relative:{position:"relative"},absolute:{position:"absolute"},top_0:{top:"0px"},left_0:{left:"0px"},w_full:{width:"100%"},h_full:{height:"100%"},h_0:{height:"0px"},border_box:{boxSizing:"border-box"}});export{o as default};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { LoadingProps } from './type';
|
|
3
|
+
declare module 'react' {
|
|
4
|
+
interface CSSProperties {
|
|
5
|
+
'--delay'?: string;
|
|
6
|
+
'--width'?: string;
|
|
7
|
+
'--height'?: string;
|
|
8
|
+
'--bg'?: string;
|
|
9
|
+
'--margin'?: string;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
declare const Inner: FC<{
|
|
13
|
+
style: LoadingProps['loadingStyle'];
|
|
14
|
+
}>;
|
|
15
|
+
export default Inner;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__assign as e}from"tslib";import{css as t}from"aphrodite/no-important";import r from"react";import a from"./styles.js";import{initLoadingStyle as i}from"./type.js";var m=[{delay:"0s"},{delay:"-1.1s"},{delay:"-1.0s"},{delay:"-0.9s"},{delay:"-0.8s"}],o=function(o){var s=e(e({},i),o.style);return r.createElement("div",{className:t(a.inner_box),style:{"--width":s.width,"--height":s.height,"--bg":s.bg,"--margin":s.margin}},m.map((function(e,i){return r.createElement("div",{key:i,style:{"--delay":e.delay},className:t(a.inner_box_item)})})))};export{o as default};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Component, ReactNode } from 'react';
|
|
2
|
+
import { LoadingProps } from './type';
|
|
3
|
+
interface LoadingState {
|
|
4
|
+
}
|
|
5
|
+
declare class Loading extends Component<LoadingProps, LoadingState> {
|
|
6
|
+
state: Readonly<LoadingState>;
|
|
7
|
+
static defaultProps: LoadingProps;
|
|
8
|
+
private static el;
|
|
9
|
+
static show(options?: Pick<LoadingProps, 'bg' | 'loadingStyle' | 'customLoading'>): void;
|
|
10
|
+
static hide(): void;
|
|
11
|
+
render(): ReactNode;
|
|
12
|
+
static getDerivedStateFromProps(props: LoadingProps, state: LoadingState): null;
|
|
13
|
+
getSnapshotBeforeUpdate(prevProps: Readonly<LoadingProps>, prevState: Readonly<LoadingState>): null;
|
|
14
|
+
componentDidUpdate(prevProps: Readonly<LoadingProps>, prevState: Readonly<LoadingState>, snapshot?: any): void;
|
|
15
|
+
componentWillUnmount(): void;
|
|
16
|
+
}
|
|
17
|
+
export default Loading;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__extends as e,__assign as t}from"tslib";import{css as l}from"aphrodite/no-important";import o,{Component as r}from"react";import{createRoot as n}from"react-dom/client";import i from"./Inner.js";import u from"./dom.js";import a from"./styles.js";var d=function(r){function d(){var e=null!==r&&r.apply(this,arguments)||this;return e.state={},e}return e(d,r),d.show=function(e){d.el||(d.el=document.createElement("div"),u.addClass(d.el,l(a.fixed)),document.body.appendChild(d.el),n(d.el).render(o.createElement(d,t({},e,{children:null,visible:!0}))))},d.hide=function(){try{if(!d.el)return;document.body.removeChild(d.el),d.el=null}catch(e){d.el=null}},d.prototype.render=function(){var e=this.props,t=e.visible,r=e.bg,n=e.customLoading,u=e.loadingStyle,d=e.children;return o.createElement("div",{className:l(a.relative,a.w_full,a.h_full,a.border_box)},d,t?o.createElement("div",{className:l(a.absolute,a.top_0,a.left_0,a.w_full,a.h_full,a.z_99,a.center),style:{backgroundColor:r}},n||o.createElement(i,{style:u})):null)},d.getDerivedStateFromProps=function(e,t){return null},d.prototype.getSnapshotBeforeUpdate=function(e,t){return null},d.prototype.componentDidUpdate=function(e,t,l){},d.prototype.componentWillUnmount=function(){d.hide()},d.defaultProps={visible:!0,bg:"rgba(0,0,0,.7)",customLoading:null,loadingStyle:{}},d.el=null,d}(r);export{d as default};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare function addClass<T extends HTMLElement>(el: T, cls: string): void;
|
|
2
|
+
declare function removeClass<T extends HTMLElement>(el: T, cls: string): void;
|
|
3
|
+
declare const _default: {
|
|
4
|
+
addClass: typeof addClass;
|
|
5
|
+
removeClass: typeof removeClass;
|
|
6
|
+
};
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var s={addClass:function(s,a){s.classList.contains(a)||s.classList.add(a)},removeClass:function(s,a){s.classList.remove(a)}};export{s as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import o from"./Loading.js";export{o as default};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare const styles: {
|
|
2
|
+
relative: object;
|
|
3
|
+
center: object;
|
|
4
|
+
absolute: object;
|
|
5
|
+
top_0: object;
|
|
6
|
+
left_0: object;
|
|
7
|
+
w_full: object;
|
|
8
|
+
h_full: object;
|
|
9
|
+
border_box: object;
|
|
10
|
+
z_99: object;
|
|
11
|
+
inner_box: object;
|
|
12
|
+
inner_box_item: object;
|
|
13
|
+
fixed: object;
|
|
14
|
+
};
|
|
15
|
+
export default styles;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{StyleSheet as t}from"aphrodite/no-important";var e=t.create({relative:{position:"relative"},center:{display:"flex",alignItems:"center",justifyContent:"center"},absolute:{position:"absolute"},top_0:{top:"0px"},left_0:{left:"0px"},w_full:{width:"100%"},h_full:{height:"100%"},border_box:{boxSizing:"border-box"},z_99:{zIndex:99},inner_box:{display:"flex",width:"100%",height:"100%",textAlign:"center",fontSize:"10px",alignItems:"center",justifyContent:"center"},inner_box_item:{height:"var(--height)",width:"var(--width)",margin:"var(--margin)",backgroundColor:"var(--bg)",animationName:[{"0%, 40%, 100%":{transform:"scaleY(0.4)","-webkit-transform":"scaleY(0.4)"},"20%":{transform:"scaleY(1.0)","-webkit-transform":"scaleY(1.0)"}}],animationDelay:"var(--delay)",animationDuration:"1.2s",animationIterationCount:"infinite"},fixed:{position:"fixed",display:"flex",alignItems:"center",justifyContent:"center",top:"0",left:"0",width:"100%",height:"100%",zIndex:99}});export{e as default};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
export interface LoadingProps extends PropsWithChildren {
|
|
3
|
+
visible?: boolean;
|
|
4
|
+
bg?: string;
|
|
5
|
+
customLoading?: ReactNode;
|
|
6
|
+
loadingStyle?: {
|
|
7
|
+
width?: string;
|
|
8
|
+
height?: string;
|
|
9
|
+
bg?: string;
|
|
10
|
+
margin?: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export declare const initLoadingStyle: LoadingProps['loadingStyle'];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var p={width:"6px",height:"50px",bg:"#fff",margin:"0 3px"};export{p as initLoadingStyle};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React, { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
declare module 'react' {
|
|
3
|
+
interface CSSProperties {
|
|
4
|
+
'--size'?: string;
|
|
5
|
+
'--strokeWidth'?: string;
|
|
6
|
+
'--color'?: string;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
interface IconProps {
|
|
10
|
+
iconSize?: string;
|
|
11
|
+
iconStrokeWidth?: string;
|
|
12
|
+
iconColor?: string;
|
|
13
|
+
}
|
|
14
|
+
interface MenuProps<T> extends IconProps {
|
|
15
|
+
data: T[];
|
|
16
|
+
renderItem: (item: T) => ReactNode;
|
|
17
|
+
onChange?: (item: T, index: string) => void;
|
|
18
|
+
subItemStyle?: CSSProperties;
|
|
19
|
+
activeStyle?: CSSProperties;
|
|
20
|
+
active?: string;
|
|
21
|
+
isMultipleExpand?: boolean;
|
|
22
|
+
icon?: ReactNode;
|
|
23
|
+
activeIcon?: ReactNode;
|
|
24
|
+
}
|
|
25
|
+
declare const Menu: <T extends {
|
|
26
|
+
children?: unknown[] | undefined;
|
|
27
|
+
}>(_props: MenuProps<T>) => React.JSX.Element;
|
|
28
|
+
export default Menu;
|
|
@@ -0,0 +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,{down:!0}):x||r.createElement(m,null):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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"./Menu.js";export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{StyleSheet as r}from"aphrodite/no-important";var o=r.create({w_full:{width:"100%"},item:{display:"flex",width:"100%",paddingRight:"10px",alignItems:"center",justifyContent:"space-between",boxSizing:"border-box"},border_box:{boxSizing:"border-box"},arrow_right:{position:"relative",width:"var(--size)",height:"var(--size)",borderTop:"var(--strokeWidth) solid var(--color)",borderRight:"var(--strokeWidth) solid var(--color)",transform:"rotate(45deg)",transformOrigin:"center",transition:"all 100ms linear"},arrow_down:{transform:"rotate(135deg)"}});export{o as default};
|
package/dist/es/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export * from './types';
|
|
2
|
+
export { default as utils } from './utils';
|
|
2
3
|
export { default as Card } from './Card';
|
|
4
|
+
export { default as Container } from './Container';
|
|
5
|
+
export { default as Loading } from './Loading';
|
|
6
|
+
export { default as Menu } from './Menu';
|
|
3
7
|
export { default as Swiper } from './Swiper';
|
|
4
|
-
export { default as utils } from './utils';
|
package/dist/es/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{default as Card}from"./Card/Card.js";export{default as
|
|
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 Menu}from"./Menu/Menu.js";export{default as Swiper}from"./Swiper/Swiper.js";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { PropsWithChildren, ReactNode, CSSProperties, FC } from 'react';
|
|
1
|
+
import React, { PropsWithChildren, ReactNode, CSSProperties, FC, Component } from 'react';
|
|
2
2
|
|
|
3
3
|
interface SwiperProps<T> extends PropsWithChildren {
|
|
4
4
|
data: T[];
|
|
@@ -20,20 +20,79 @@ interface SwiperExposeMethods {
|
|
|
20
20
|
pre: () => any;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
declare function sleep(timestamp?: number, result?: boolean): Promise<boolean>;
|
|
24
|
+
declare const _default$1: {
|
|
25
|
+
sleep: typeof sleep;
|
|
26
|
+
};
|
|
27
|
+
|
|
23
28
|
interface CardProps extends PropsWithChildren {
|
|
24
29
|
expand?: boolean;
|
|
25
30
|
duration?: number;
|
|
26
31
|
}
|
|
27
32
|
declare const Card: FC<CardProps>;
|
|
28
33
|
|
|
34
|
+
interface ContainerProps extends PropsWithChildren {
|
|
35
|
+
ratio?: number;
|
|
36
|
+
}
|
|
37
|
+
declare const Container: FC<ContainerProps>;
|
|
38
|
+
|
|
39
|
+
interface LoadingProps extends PropsWithChildren {
|
|
40
|
+
visible?: boolean;
|
|
41
|
+
bg?: string;
|
|
42
|
+
customLoading?: ReactNode;
|
|
43
|
+
loadingStyle?: {
|
|
44
|
+
width?: string;
|
|
45
|
+
height?: string;
|
|
46
|
+
bg?: string;
|
|
47
|
+
margin?: string;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface LoadingState {
|
|
52
|
+
}
|
|
53
|
+
declare class Loading extends Component<LoadingProps, LoadingState> {
|
|
54
|
+
state: Readonly<LoadingState>;
|
|
55
|
+
static defaultProps: LoadingProps;
|
|
56
|
+
private static el;
|
|
57
|
+
static show(options?: Pick<LoadingProps, 'bg' | 'loadingStyle' | 'customLoading'>): void;
|
|
58
|
+
static hide(): void;
|
|
59
|
+
render(): ReactNode;
|
|
60
|
+
static getDerivedStateFromProps(props: LoadingProps, state: LoadingState): null;
|
|
61
|
+
getSnapshotBeforeUpdate(prevProps: Readonly<LoadingProps>, prevState: Readonly<LoadingState>): null;
|
|
62
|
+
componentDidUpdate(prevProps: Readonly<LoadingProps>, prevState: Readonly<LoadingState>, snapshot?: any): void;
|
|
63
|
+
componentWillUnmount(): void;
|
|
64
|
+
}
|
|
65
|
+
|
|
29
66
|
declare module 'react' {
|
|
30
|
-
|
|
67
|
+
interface CSSProperties {
|
|
68
|
+
'--size'?: string;
|
|
69
|
+
'--strokeWidth'?: string;
|
|
70
|
+
'--color'?: string;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
interface IconProps {
|
|
74
|
+
iconSize?: string;
|
|
75
|
+
iconStrokeWidth?: string;
|
|
76
|
+
iconColor?: string;
|
|
77
|
+
}
|
|
78
|
+
interface MenuProps<T> extends IconProps {
|
|
79
|
+
data: T[];
|
|
80
|
+
renderItem: (item: T) => ReactNode;
|
|
81
|
+
onChange?: (item: T, index: string) => void;
|
|
82
|
+
subItemStyle?: CSSProperties;
|
|
83
|
+
activeStyle?: CSSProperties;
|
|
84
|
+
active?: string;
|
|
85
|
+
isMultipleExpand?: boolean;
|
|
86
|
+
icon?: ReactNode;
|
|
87
|
+
activeIcon?: ReactNode;
|
|
31
88
|
}
|
|
32
|
-
declare const
|
|
89
|
+
declare const Menu: <T extends {
|
|
90
|
+
children?: unknown[] | undefined;
|
|
91
|
+
}>(_props: MenuProps<T>) => React.JSX.Element;
|
|
33
92
|
|
|
34
|
-
declare
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
93
|
+
declare module 'react' {
|
|
94
|
+
function forwardRef<T, P = {}>(render: (props: P, ref: React.Ref<T>) => React.ReactNode | null): (props: P & React.RefAttributes<T>) => React.ReactNode | null;
|
|
95
|
+
}
|
|
96
|
+
declare const _default: <T extends unknown>(props: SwiperProps<T> & React.RefAttributes<SwiperExposeMethods>) => React.ReactNode;
|
|
38
97
|
|
|
39
|
-
export { Card, _default
|
|
98
|
+
export { Card, Container, Loading, Menu, _default as Swiper, type SwiperExposeMethods, type SwiperProps, _default$1 as utils };
|
package/dist/lib/Card/Card.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("aphrodite/no-important"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("aphrodite/no-important"),a=require("react"),n=require("./styles.js"),r={expand:!1,duration:200};exports.default=function(s){var i=e.__assign(e.__assign({},r),s),o=i.duration,c=i.expand,u=i.children,d=a.useMemo((function(){return{transitionDuration:"".concat(o,"ms"),msTransitionDuration:"".concat(o,"ms"),MozTransitionDuration:"".concat(o,"ms"),WebkitTransitionDuration:"".concat(o,"ms")}}),[o]);return a.createElement("div",{style:d,className:"".concat(t.css(n.default.collapse)," ").concat(c?t.css(n.default.expand):"")},a.createElement("div",{className:t.css(n.default.hide0)},u))};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("aphrodite/no-important"),l=require("react"),r=require("./styles.js"),a={ratio:1};exports.default=function(u){var s=e.__assign(e.__assign({},a),u),i=s.ratio,d=s.children,o=l.useMemo((function(){return null==i||i<=0?"100%":100/i+"%"}),[i]);return l.createElement("div",{className:t.css(r.default.relative,r.default.w_full,r.default.h_0,r.default.border_box),style:{paddingBottom:o}},l.createElement("div",{className:t.css(r.default.absolute,r.default.top_0,r.default.left_0,r.default.w_full,r.default.h_full)},d))};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./Container.js");exports.default=e.default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("aphrodite/no-important").StyleSheet.create({relative:{position:"relative"},absolute:{position:"absolute"},top_0:{top:"0px"},left_0:{left:"0px"},w_full:{width:"100%"},h_full:{height:"100%"},h_0:{height:"0px"},border_box:{boxSizing:"border-box"}});exports.default=e;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { LoadingProps } from './type';
|
|
3
|
+
declare module 'react' {
|
|
4
|
+
interface CSSProperties {
|
|
5
|
+
'--delay'?: string;
|
|
6
|
+
'--width'?: string;
|
|
7
|
+
'--height'?: string;
|
|
8
|
+
'--bg'?: string;
|
|
9
|
+
'--margin'?: string;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
declare const Inner: FC<{
|
|
13
|
+
style: LoadingProps['loadingStyle'];
|
|
14
|
+
}>;
|
|
15
|
+
export default Inner;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("aphrodite/no-important"),r=require("react"),s=require("./styles.js"),a=require("./type.js"),i=[{delay:"0s"},{delay:"-1.1s"},{delay:"-1.0s"},{delay:"-0.9s"},{delay:"-0.8s"}];exports.default=function(l){var n=e.__assign(e.__assign({},a.initLoadingStyle),l.style);return r.createElement("div",{className:t.css(s.default.inner_box),style:{"--width":n.width,"--height":n.height,"--bg":n.bg,"--margin":n.margin}},i.map((function(e,a){return r.createElement("div",{key:a,style:{"--delay":e.delay},className:t.css(s.default.inner_box_item)})})))};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Component, ReactNode } from 'react';
|
|
2
|
+
import { LoadingProps } from './type';
|
|
3
|
+
interface LoadingState {
|
|
4
|
+
}
|
|
5
|
+
declare class Loading extends Component<LoadingProps, LoadingState> {
|
|
6
|
+
state: Readonly<LoadingState>;
|
|
7
|
+
static defaultProps: LoadingProps;
|
|
8
|
+
private static el;
|
|
9
|
+
static show(options?: Pick<LoadingProps, 'bg' | 'loadingStyle' | 'customLoading'>): void;
|
|
10
|
+
static hide(): void;
|
|
11
|
+
render(): ReactNode;
|
|
12
|
+
static getDerivedStateFromProps(props: LoadingProps, state: LoadingState): null;
|
|
13
|
+
getSnapshotBeforeUpdate(prevProps: Readonly<LoadingProps>, prevState: Readonly<LoadingState>): null;
|
|
14
|
+
componentDidUpdate(prevProps: Readonly<LoadingProps>, prevState: Readonly<LoadingState>, snapshot?: any): void;
|
|
15
|
+
componentWillUnmount(): void;
|
|
16
|
+
}
|
|
17
|
+
export default Loading;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("aphrodite/no-important"),l=require("react"),r=require("react-dom/client"),n=require("./Inner.js"),u=require("./dom.js"),o=require("./styles.js"),a=function(a){function d(){var e=null!==a&&a.apply(this,arguments)||this;return e.state={},e}return e.__extends(d,a),d.show=function(n){d.el||(d.el=document.createElement("div"),u.default.addClass(d.el,t.css(o.default.fixed)),document.body.appendChild(d.el),r.createRoot(d.el).render(l.createElement(d,e.__assign({},n,{children:null,visible:!0}))))},d.hide=function(){try{if(!d.el)return;document.body.removeChild(d.el),d.el=null}catch(e){d.el=null}},d.prototype.render=function(){var e=this.props,r=e.visible,u=e.bg,a=e.customLoading,d=e.loadingStyle,i=e.children;return l.createElement("div",{className:t.css(o.default.relative,o.default.w_full,o.default.h_full,o.default.border_box)},i,r?l.createElement("div",{className:t.css(o.default.absolute,o.default.top_0,o.default.left_0,o.default.w_full,o.default.h_full,o.default.z_99,o.default.center),style:{backgroundColor:u}},a||l.createElement(n.default,{style:d})):null)},d.getDerivedStateFromProps=function(e,t){return null},d.prototype.getSnapshotBeforeUpdate=function(e,t){return null},d.prototype.componentDidUpdate=function(e,t,l){},d.prototype.componentWillUnmount=function(){d.hide()},d.defaultProps={visible:!0,bg:"rgba(0,0,0,.7)",customLoading:null,loadingStyle:{}},d.el=null,d}(l.Component);exports.default=a;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare function addClass<T extends HTMLElement>(el: T, cls: string): void;
|
|
2
|
+
declare function removeClass<T extends HTMLElement>(el: T, cls: string): void;
|
|
3
|
+
declare const _default: {
|
|
4
|
+
addClass: typeof addClass;
|
|
5
|
+
removeClass: typeof removeClass;
|
|
6
|
+
};
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var s={addClass:function(s,e){s.classList.contains(e)||s.classList.add(e)},removeClass:function(s,e){s.classList.remove(e)}};exports.default=s;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./Loading.js");exports.default=e.default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare const styles: {
|
|
2
|
+
relative: object;
|
|
3
|
+
center: object;
|
|
4
|
+
absolute: object;
|
|
5
|
+
top_0: object;
|
|
6
|
+
left_0: object;
|
|
7
|
+
w_full: object;
|
|
8
|
+
h_full: object;
|
|
9
|
+
border_box: object;
|
|
10
|
+
z_99: object;
|
|
11
|
+
inner_box: object;
|
|
12
|
+
inner_box_item: object;
|
|
13
|
+
fixed: object;
|
|
14
|
+
};
|
|
15
|
+
export default styles;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("aphrodite/no-important").StyleSheet.create({relative:{position:"relative"},center:{display:"flex",alignItems:"center",justifyContent:"center"},absolute:{position:"absolute"},top_0:{top:"0px"},left_0:{left:"0px"},w_full:{width:"100%"},h_full:{height:"100%"},border_box:{boxSizing:"border-box"},z_99:{zIndex:99},inner_box:{display:"flex",width:"100%",height:"100%",textAlign:"center",fontSize:"10px",alignItems:"center",justifyContent:"center"},inner_box_item:{height:"var(--height)",width:"var(--width)",margin:"var(--margin)",backgroundColor:"var(--bg)",animationName:[{"0%, 40%, 100%":{transform:"scaleY(0.4)","-webkit-transform":"scaleY(0.4)"},"20%":{transform:"scaleY(1.0)","-webkit-transform":"scaleY(1.0)"}}],animationDelay:"var(--delay)",animationDuration:"1.2s",animationIterationCount:"infinite"},fixed:{position:"fixed",display:"flex",alignItems:"center",justifyContent:"center",top:"0",left:"0",width:"100%",height:"100%",zIndex:99}});exports.default=e;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
export interface LoadingProps extends PropsWithChildren {
|
|
3
|
+
visible?: boolean;
|
|
4
|
+
bg?: string;
|
|
5
|
+
customLoading?: ReactNode;
|
|
6
|
+
loadingStyle?: {
|
|
7
|
+
width?: string;
|
|
8
|
+
height?: string;
|
|
9
|
+
bg?: string;
|
|
10
|
+
margin?: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export declare const initLoadingStyle: LoadingProps['loadingStyle'];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.initLoadingStyle={width:"6px",height:"50px",bg:"#fff",margin:"0 3px"};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React, { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
declare module 'react' {
|
|
3
|
+
interface CSSProperties {
|
|
4
|
+
'--size'?: string;
|
|
5
|
+
'--strokeWidth'?: string;
|
|
6
|
+
'--color'?: string;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
interface IconProps {
|
|
10
|
+
iconSize?: string;
|
|
11
|
+
iconStrokeWidth?: string;
|
|
12
|
+
iconColor?: string;
|
|
13
|
+
}
|
|
14
|
+
interface MenuProps<T> extends IconProps {
|
|
15
|
+
data: T[];
|
|
16
|
+
renderItem: (item: T) => ReactNode;
|
|
17
|
+
onChange?: (item: T, index: string) => void;
|
|
18
|
+
subItemStyle?: CSSProperties;
|
|
19
|
+
activeStyle?: CSSProperties;
|
|
20
|
+
active?: string;
|
|
21
|
+
isMultipleExpand?: boolean;
|
|
22
|
+
icon?: ReactNode;
|
|
23
|
+
activeIcon?: ReactNode;
|
|
24
|
+
}
|
|
25
|
+
declare const Menu: <T extends {
|
|
26
|
+
children?: unknown[] | undefined;
|
|
27
|
+
}>(_props: MenuProps<T>) => React.JSX.Element;
|
|
28
|
+
export default Menu;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("aphrodite/no-important"),n=require("react"),r=require("../Card/Card.js"),a=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 c(r){var c=e.__assign(e.__assign({},i),r),l=c.iconSize,s=c.iconStrokeWidth,o=c.iconColor,u=c.down;return n.createElement("div",{style:{"--size":l,"--strokeWidth":s,"--color":o},className:"".concat(t.css(a.default.arrow_right)," ").concat(u?t.css(a.default.arrow_down):"")})}var l=n.createContext({active:"0",changeActive:function(){return null}}),s=function(o){var u=e.__assign(e.__assign({},i),o),d=u.renderItem,f=u.item,v=u.subItemStyle,h=u.index,m=u.isMultipleExpand,_=u.icon,g=u.activeIcon,p=n.useState(!1),y=p[0],x=p[1],E=n.useContext(l),b=E.active,A=E.changeActive,C=n.useCallback((function(e){e.stopPropagation(),A(h),u.onChange(f,h),f.children&&Array.isArray(f.children)&&x((function(e){return!e}))}),[A,h,f]);return n.useEffect((function(){if(void 0!==b){var e=b.split("-"),t=h.split("-");b.startsWith(h)&&e.length>t.length&&h.length<b.length?x(!0):b.startsWith(h)&&h.startsWith(b)||m||x(!1)}}),[b,h]),n.createElement("div",{className:t.css(a.default.w_full,a.default.border_box),onClick:C},n.createElement("div",{className:t.css(a.default.item)},d(f)," ",Array.isArray(f.children)&&f.children.length?y?g||n.createElement(c,{down:!0}):_||n.createElement(c,null):null),Array.isArray(f.children)?f.children.map((function(c,l){return n.createElement("div",{key:l,className:t.css(a.default.w_full,a.default.border_box),style:e.__assign(e.__assign({},i.subItemStyle),v)},n.createElement(r.default,{expand:y},n.createElement(s,e.__assign({},u,{index:h+"-"+l,item:c}))))})):null)};exports.default=function(t){var r=e.__assign(e.__assign({},i),t),a=n.useState(r.active),c=a[0],o=a[1];return n.useEffect((function(){if(r.data.length&&void 0!==r.active){var e=r.active.split("-").map((function(e){return Number(e)})),t=r.data,n={};e.forEach((function(e){Array.isArray(t)&&(n=t[e]||{},t=n.children)})),r.onChange(n,r.active)}o(r.active)}),[r.active,r.data]),n.createElement(l.Provider,{value:{active:c,changeActive:o}},r.data.map((function(t,a){return n.createElement(s,e.__assign({key:a,index:a.toString()},r,{item:t}))})))};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./Menu.js");exports.default=e.default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("aphrodite/no-important").StyleSheet.create({w_full:{width:"100%"},item:{display:"flex",width:"100%",paddingRight:"10px",alignItems:"center",justifyContent:"space-between",boxSizing:"border-box"},border_box:{boxSizing:"border-box"},arrow_right:{position:"relative",width:"var(--size)",height:"var(--size)",borderTop:"var(--strokeWidth) solid var(--color)",borderRight:"var(--strokeWidth) solid var(--color)",transform:"rotate(45deg)",transformOrigin:"center",transition:"all 100ms linear"},arrow_down:{transform:"rotate(135deg)"}});exports.default=r;
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export * from './types';
|
|
2
|
+
export { default as utils } from './utils';
|
|
2
3
|
export { default as Card } from './Card';
|
|
4
|
+
export { default as Container } from './Container';
|
|
5
|
+
export { default as Loading } from './Loading';
|
|
6
|
+
export { default as Menu } from './Menu';
|
|
3
7
|
export { default as Swiper } from './Swiper';
|
|
4
|
-
export { default as utils } from './utils';
|
package/dist/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var r=require("./Card/Card.js"),
|
|
1
|
+
"use strict";var e=require("./utils.js"),r=require("./Card/Card.js"),t=require("./Container/Container.js"),i=require("./Loading/Loading.js"),u=require("./Menu/Menu.js"),a=require("./Swiper/Swiper.js");exports.utils=e.default,exports.Card=r.default,exports.Container=t.default,exports.Loading=i.default,exports.Menu=u.default,exports.Swiper=a.default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rox-react-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"main": "dist/lib/index.js",
|
|
5
5
|
"module": "dist/es/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
"carousel",
|
|
16
16
|
"mobile carousel",
|
|
17
17
|
"ps carousel",
|
|
18
|
+
"menu",
|
|
19
|
+
"loading",
|
|
20
|
+
"container with ratio",
|
|
18
21
|
"react swiper carousel pc mobile touch mouse"
|
|
19
22
|
],
|
|
20
23
|
"files": [
|