{"version":3,"file":"components/TextDrawer/index.mjs","sources":["../../../src/components/TextDrawer/index.tsx"],"sourcesContent":["import { CodeOutlined } from '@ant-design/icons';\nimport { Button, Drawer, ButtonProps, DrawerProps } from 'antd';\nimport React, {\n  CSSProperties,\n  HTMLAttributes,\n  PropsWithChildren,\n  useState,\n} from 'react';\n\nexport interface TextDrawerProps {\n  text?: string | React.ReactNode;\n  button?: React.ReactNode;\n  buttonProps?: ButtonProps;\n  buttonStyle?: CSSProperties;\n  drawerProps?: DrawerProps;\n  containerProps?: HTMLAttributes<HTMLDivElement>;\n}\n\nexport const TextDrawer = (\n  props: PropsWithChildren<TextDrawerProps>,\n): React.JSX.Element => {\n  const [visible, setVisible] = useState(false);\n\n  return (\n    // avoid propagation event affect collapse component\n    <div onClick={(e) => e.stopPropagation()} {...props.containerProps}>\n      {props.button ? (\n        <div onClick={() => setVisible(!visible)}>{props.button}</div>\n      ) : props.text ? (\n        <Button\n          type={'link'}\n          {...props.buttonProps}\n          onClick={() => setVisible(!visible)}\n          style={{ padding: 0, ...props.buttonStyle }}\n        >\n          {props.text}\n        </Button>\n      ) : (\n        <CodeOutlined\n          style={{ fontSize: 14, padding: 0 }}\n          onClick={() => setVisible(!visible)}\n        />\n      )}\n      <Drawer\n        maskClosable\n        zIndex={999}\n        width={'60%'}\n        {...props.drawerProps}\n        open={visible}\n        onClose={() => setVisible(false)}\n        destroyOnClose\n      >\n        {props.children}\n      </Drawer>\n    </div>\n  );\n};\n\nexport * from './duplicate';\n"],"names":["TextDrawer","props","visible","setVisible","useState","e","Button","CodeOutlined","Drawer"],"mappings":";;;;;AAkBO,MAAMA,aAAa,CACxBC;IAEA,MAAM,CAACC,SAASC,WAAW,GAAGC,SAAS;IAEvC,O,cAEE,KAAC;QAAI,SAAS,CAACC,IAAMA,EAAE,eAAe;QAAK,GAAGJ,MAAM,cAAc;;YAC/DA,MAAM,MAAM,GAAG,WAAH,GACX,IAAC;gBAAI,SAAS,IAAME,WAAW,CAACD;0BAAWD,MAAM,MAAM;iBACrDA,MAAM,IAAI,GAAG,WAAH,GACZ,IAACK,QAAMA;gBACL,MAAM;gBACL,GAAGL,MAAM,WAAW;gBACrB,SAAS,IAAME,WAAW,CAACD;gBAC3B,OAAO;oBAAE,SAAS;oBAAG,GAAGD,MAAM,WAAW;gBAAC;0BAEzCA,MAAM,IAAI;+BAGb,IAACM,cAAYA;gBACX,OAAO;oBAAE,UAAU;oBAAI,SAAS;gBAAE;gBAClC,SAAS,IAAMJ,WAAW,CAACD;;0BAG/B,IAACM,QAAMA;gBACL,cAAY;gBACZ,QAAQ;gBACR,OAAO;gBACN,GAAGP,MAAM,WAAW;gBACrB,MAAMC;gBACN,SAAS,IAAMC,WAAW;gBAC1B,gBAAc;0BAEbF,MAAM,QAAQ;;;;AAIvB"}