@adoptaunabuelo/react-components 0.1.15 → 0.1.16
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.
|
@@ -9,8 +9,8 @@ export interface MenuProps {
|
|
|
9
9
|
icon?: JSX.Element;
|
|
10
10
|
Icon?: JSX.Element;
|
|
11
11
|
position: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
12
|
-
children
|
|
13
|
-
options
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
options?: Array<OptionsProps>;
|
|
14
14
|
onChange?: (visible: boolean) => void;
|
|
15
15
|
onClick?: (option: OptionsProps) => void;
|
|
16
16
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -683,7 +683,7 @@ var n="none",a="contents",r=/input|select|textarea|button|object|iframe/;functio
|
|
|
683
683
|
:hover{
|
|
684
684
|
background-color: ${Color.status.neutral.hover};
|
|
685
685
|
}
|
|
686
|
-
`,MenuList=React.forwardRef(((e,t)=>{const[n,a]=React.useState(!1);React.useImperativeHandle(t,(()=>({close(){a(!1)}}))),React.useEffect((()=>(document.addEventListener("mousedown",(t=>{const a=document.getElementById(e.id);null!==a&&(a.contains(t.target)||n&&r(t))})),document.removeEventListener("mousedown",r))));const r=t=>{t.stopPropagation(),n?(a(!1),e.onChange&&e.onChange(!1)):(a(!0),e.onChange&&e.onChange(!0))};return jsxRuntime.jsxs(Container,Object.assign({id:e.id,role:"menu",style:e.style},{children:[e.Icon?jsxRuntime.jsx(IconView,Object.assign({onClick:r},{children:e.Icon})):jsxRuntime.jsx(Button,{style:{backgroundColor:n?Color.status.neutral.active:void 0},design:"image",icon:e.icon?e.icon:jsxRuntime.jsx(MoreVertical,{}),onClick:r}),jsxRuntime.jsxs(FilterView,Object.assign({padding:!e.options,position:e.position,style:e.menuStyle,show:n},{children:[e.children,e.options&&e.options.map(((t,n)=>jsxRuntime.jsxs(MenuCell,Object.assign({style:{borderBottom:n+1===e.options.length?"none":"1px solid "+Color.line.soft},onClick:n=>((t,n)=>{t.stopPropagation(),a(!1),e.onClick&&e.onClick(n)})(n,t)},{children:[t.icon,jsxRuntime.jsx(Text,Object.assign({type:"p"},{children:t.label}))]}),"action"+n)))]}))]}))})),LabelStyled=qe.div`
|
|
686
|
+
`,MenuList=React.forwardRef(((e,t)=>{const[n,a]=React.useState(!1);React.useImperativeHandle(t,(()=>({close(){a(!1)}}))),React.useEffect((()=>(document.addEventListener("mousedown",(t=>{const a=document.getElementById(e.id);null!==a&&(a.contains(t.target)||n&&r(t))})),document.removeEventListener("mousedown",r))));const r=t=>{t.stopPropagation(),n?(a(!1),e.onChange&&e.onChange(!1)):(a(!0),e.onChange&&e.onChange(!0))};return jsxRuntime.jsxs(Container,Object.assign({id:e.id,role:"menu",style:e.style},{children:[e.Icon?jsxRuntime.jsx(IconView,Object.assign({onClick:r},{children:e.Icon})):jsxRuntime.jsx(Button,{style:{backgroundColor:n?Color.status.neutral.active:void 0},design:"image",icon:e.icon?e.icon:jsxRuntime.jsx(MoreVertical,{}),onClick:r}),jsxRuntime.jsxs(FilterView,Object.assign({padding:!e.options,position:e.position,style:e.menuStyle,show:n},{children:[e.children,e.options&&e.options.map(((t,n)=>{var r;return jsxRuntime.jsxs(MenuCell,Object.assign({style:{borderBottom:n+1===(null===(r=e.options)||void 0===r?void 0:r.length)?"none":"1px solid "+Color.line.soft},onClick:n=>((t,n)=>{t.stopPropagation(),a(!1),e.onClick&&e.onClick(n)})(n,t)},{children:[t.icon,jsxRuntime.jsx(Text,Object.assign({type:"p"},{children:t.label}))]}),"action"+n)}))]}))]}))})),LabelStyled=qe.div`
|
|
687
687
|
display: flex;
|
|
688
688
|
flex-direction: row;
|
|
689
689
|
justify-content: center;
|