@adoptaunabuelo/react-components 0.1.20 → 0.1.21
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/cjs/components/Modal/Modal.d.ts +11 -20
- package/dist/cjs/components/Modal/ModalPrimary.d.ts +21 -0
- package/dist/cjs/index.js +16 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/components/Modal/Modal.d.ts +11 -20
- package/dist/esm/components/Modal/ModalPrimary.d.ts +21 -0
- package/dist/esm/index.js +16 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +14 -7
- package/package.json +1 -1
|
@@ -1,22 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
declare const ModalComponent: import("react").ForwardRefExoticComponent<ModalProps & import("react").RefAttributes<ModalRef>>;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ModalPrimaryProps } from './ModalPrimary';
|
|
3
|
+
declare const ModalComponent: (props: ModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
4
|
export default ModalComponent;
|
|
6
|
-
export interface ModalProps extends
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
contentStyle?: CSSProperties;
|
|
15
|
-
Header?: JSX.Element;
|
|
16
|
-
Bottom?: JSX.Element;
|
|
17
|
-
buttonProps?: ButtonProps;
|
|
18
|
-
onClose: () => void;
|
|
19
|
-
}
|
|
20
|
-
export interface ModalRef {
|
|
21
|
-
close: () => void;
|
|
5
|
+
export interface ModalProps extends ModalPrimaryProps {
|
|
6
|
+
options?: Array<{
|
|
7
|
+
id: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
Data?: JSX.Element;
|
|
10
|
+
hidden?: boolean;
|
|
11
|
+
}>;
|
|
12
|
+
url?: string;
|
|
22
13
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, CSSProperties } from 'react';
|
|
2
|
+
import { ButtonProps } from '../Button/Button';
|
|
3
|
+
declare const ModalComponent: import("react").ForwardRefExoticComponent<ModalPrimaryProps & import("react").RefAttributes<ModalRef>>;
|
|
4
|
+
export default ModalComponent;
|
|
5
|
+
export interface ModalPrimaryProps extends ComponentPropsWithoutRef<"div"> {
|
|
6
|
+
isVisible: boolean;
|
|
7
|
+
type?: 'default' | 'full-screen' | 'form' | 'web';
|
|
8
|
+
title?: string;
|
|
9
|
+
subtitle?: string;
|
|
10
|
+
error?: string;
|
|
11
|
+
hideClose?: boolean;
|
|
12
|
+
hideHeader?: boolean;
|
|
13
|
+
contentStyle?: CSSProperties;
|
|
14
|
+
Header?: JSX.Element;
|
|
15
|
+
Bottom?: JSX.Element;
|
|
16
|
+
buttonProps?: ButtonProps;
|
|
17
|
+
onClose: () => void;
|
|
18
|
+
}
|
|
19
|
+
export interface ModalRef {
|
|
20
|
+
close: () => void;
|
|
21
|
+
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -641,7 +641,22 @@ var r="none",n="contents",a=/input|select|textarea|button|object|iframe/;functio
|
|
|
641
641
|
background-color: ${Color.background.redLow};
|
|
642
642
|
padding: 12px 24px;
|
|
643
643
|
margin-top: 24px;
|
|
644
|
-
`,ModalComponent=React.forwardRef(((e,t)=>{const[r,n]=React.useState(e.isVisible),[a,o]=React.useState(!1);React.useImperativeHandle(t,(()=>({close(){l()}}))),React.useEffect((()=>{e.isVisible?(n(!0),i(100).then((()=>{o(!0)}))):(o(!1),i(500).then((()=>{n(!1)})))}),[e.isVisible]);const i=e=>new Promise((t=>setTimeout(t,e))),l=()=>{o(!1),i(300).then((()=>{n(!1),e.onClose&&e.onClose()}))};return jsxRuntime.jsxs(Modal,Object.assign({role:"modal",isOpen:r,ariaHideApp:!1,style:{content:Object.assign({position:"absolute",width:"full-screen"===e.
|
|
644
|
+
`,ModalComponent$1=React.forwardRef(((e,t)=>{const[r,n]=React.useState(e.isVisible),[a,o]=React.useState(!1);React.useImperativeHandle(t,(()=>({close(){l()}}))),React.useEffect((()=>{e.isVisible?(n(!0),i(100).then((()=>{o(!0)}))):(o(!1),i(500).then((()=>{n(!1)})))}),[e.isVisible]);const i=e=>new Promise((t=>setTimeout(t,e))),l=()=>{o(!1),i(300).then((()=>{n(!1),e.onClose&&e.onClose()}))};return jsxRuntime.jsxs(Modal,Object.assign({role:"modal",isOpen:r,ariaHideApp:!1,style:{content:Object.assign({position:"absolute",width:"full-screen"===e.type?"100%":500,maxWidth:"full-screen"===e.type?"100%":"calc(100% - 24px)",maxHeight:"calc(100% - 24px)",background:"#FFFFFF",boxShadow:"0px 4px 8px rgba(0, 0, 0, 0.1)",borderRadius:"full-screen"===e.type?"12px 12px 0px 0px":12,top:"full-screen"!==e.type?a?"50%":"150%":"unset",bottom:"full-screen"===e.type?a?"0px":"-100vh":"unset",transition:"top 0.3s ease-out, bottom 0.3s ease-out, transform 0.3s ease-in-out",left:"50%",transform:"full-screen"===e.type?"translate(-50%, 0%)":"translate(-50%, -50%) scale("+(a?1:.2)+")",overflow:"hidden",overflowY:"auto",border:"none",padding:0},e.style),overlay:{backgroundColor:"rgba(0, 0, 0, "+(a?.6:0)+")",transition:" background-color 0.3s ease-out",zIndex:1e3}}},{children:[!e.hideHeader&&jsxRuntime.jsxs(TitleView,{children:[!e.hideClose&&jsxRuntime.jsx(Button,{style:{position:"absolute",alignSelf:"flex-end",cursor:"pointer"},icon:jsxRuntime.jsx(X,{height:20,width:20,color:Color.text.full}),design:"image",onClick:l}),e.title&&jsxRuntime.jsx(Title,{children:e.title}),e.subtitle&&jsxRuntime.jsx(Subtitle,{children:e.subtitle}),e.Header]}),jsxRuntime.jsx(ChildrenView,Object.assign({style:e.contentStyle},{children:e.children})),e.error&&jsxRuntime.jsx(ErrorView,{children:jsxRuntime.jsx(Text$1,Object.assign({type:"p",style:{color:Color.status.color.error,fontSize:12}},{children:e.error}))}),e.buttonProps&&jsxRuntime.jsxs(Buttons,{children:[e.Bottom,e.buttonProps&&jsxRuntime.jsx(Button,Object.assign({},e.buttonProps,{children:e.buttonProps.children?e.buttonProps.children:"Guardar"}))]})]}))})),Row=Ye.div`
|
|
645
|
+
display: flex;
|
|
646
|
+
flex-direction: row;
|
|
647
|
+
margin-bottom: 8px;
|
|
648
|
+
`,LabelColumn=Ye.div`
|
|
649
|
+
display: flex;
|
|
650
|
+
width: 112px;
|
|
651
|
+
align-items: center;
|
|
652
|
+
`,DataColumn=Ye.div`
|
|
653
|
+
display: flex;
|
|
654
|
+
flex: 1;
|
|
655
|
+
flex-direction: column;
|
|
656
|
+
`,Separator=Ye.div`
|
|
657
|
+
content: none;
|
|
658
|
+
margin-bottom: 24px;
|
|
659
|
+
`,WebView=Ye.iframe``,ModalComponent=e=>{const t=__rest(e,["children"]);return"form"===e.type?jsxRuntime.jsx(ModalComponent$1,Object.assign({},t,{children:e.options&&e.options.map(((e,t)=>e.hidden?null:"separator"===e.id?jsxRuntime.jsx(Separator,{},"separator-"+t):jsxRuntime.jsxs(Row,{children:[jsxRuntime.jsx(LabelColumn,{children:jsxRuntime.jsx(Text$1,Object.assign({type:"c1",weight:"medium"},{children:e.title}))}),jsxRuntime.jsx(DataColumn,{children:e.Data})]},"option-"+e.id)))})):"web"===e.type?jsxRuntime.jsx(ModalComponent$1,Object.assign({},t,{children:jsxRuntime.jsx(WebView,{id:"web-iframe",src:e.url,width:"100%",height:"100%",style:{border:"none"}})})):jsxRuntime.jsx(ModalComponent$1,Object.assign({},e))},Container$5=Ye.div`
|
|
645
660
|
position: relative;
|
|
646
661
|
`,FilterView$3=Ye.div`
|
|
647
662
|
position: absolute;
|