{"_id":"@_nu/react-modal","_rev":"1-2ceef2701ea08331983e49d292495f20","name":"@_nu/react-modal","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.2":{"name":"@_nu/react-modal","version":"0.0.2","description":"No UI dependency modal of react","main":"lib/index.js","typings":"lib/index.d.ts","module":"es/index.js","author":{"name":"ziven27"},"license":"MIT","repository":{"type":"git","url":"git+ssh://git@github.com/nu-system/react.git"},"bugs":{"url":"https://github.com/nu-system/react/issues"},"homepage":"https://nu-system.github.io/react/","publishConfig":{"access":"public"},"dependencies":{"focus-trap-react":"^7.0.1","prop-types":"^15.7.2","react-dom":"^16.13.1"},"peerDependencies":{"react":"16.x"},"keywords":["react-component","ui","no-ui","nu-system","react","react-ui","modal"],"scripts":{"demo":"nwb serve-react-demo","build":"father build"},"devDependencies":{"@_nu/css-modal":"^0.0.5"},"gitHead":"b0404c43fefd3571fb9eaa0c618500b61c13ca02","_id":"@_nu/react-modal@0.0.2","_nodeVersion":"12.16.3","_npmVersion":"lerna/3.22.1/node@v12.16.3+x64 (darwin)","dist":{"integrity":"sha512-d3WnsPME8nymj6lk5W2qpuAQMNebYoPzjPmG1QwK/IsPu44TRbwVTJc+1IlLjT1SAenIrmA6yOtcM19UhJnLDQ==","shasum":"10c156e103b2a2cf011772a17b656014966c6ed1","tarball":"https://registry.npmjs.org/@_nu/react-modal/-/react-modal-0.0.2.tgz","fileCount":31,"unpackedSize":44955,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfORy0CRA9TVsSAnZWagAAyjAQAJA7iwu05ghkIP7s6t5g\nkGJ84Ntz5RebKKPo0w4dl0rJKYdQNpQT27uySU1jbEK7Ggp9gyCK+iK/nSDE\n3WGmrYyUr+0hMyDlS8yox0f98tPJJN9mWrOB6gQYyjgMvXz1wSN051Lhs8kw\nNl0MEfNABdIuNzZ3FV7NOSdHrrW3FrQczShPRik8EyVyOLKT8fvV6HbS8jk8\nhuMU+9hgVp4eQGjNrVpdjXxDxmwZ9l57ZuTq567tt5tATgNdKYGKXr61PoD0\nL7HkSE4mT0+RGFhduwtTuCaf2SDrMjs1J7oGLUKbeKN2tXgXyAwXnEe4T1wV\nZ91M0GeCe1tWD7zXhmBdEkijggsC49/CYO/NfCsmElXeYsVFua8tA3xmpLQP\nt7VgYQ+SpG7+2EJxEQ6f6obUO62ySWEzB8V7W/Hb9wou5wAQ9SC7u/XyeD60\n+U9mDTgWaIwcHPCjR8+G0nwHpLArRyMXNf1t5yLShYJ6E/miPuQ2M/CPjNbb\n7pyjaiaS1kUcpKz8u3KfpRAkXjIEJOPjqR+sBq4tGiW2KyIoXRQVtuqtvcMz\n/wTffFIi0VZKpDzjwW6nYc9LxMGbeiUa8yHdFTKwRpWCwsG0etlBxb/XK7+i\nn1VNFGb7bdN0otEnIiRrfEZj+z7qHZRwRVtvYCLPtNCqStRq+H4J1Q1X2kEi\nfiEj\r\n=LK6A\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAi/1HBoeYg7Mo04+S10KdaLM/Hja/a/UsqhEjDzSupGAiEA6EFAXkqy8Xzn50LAVz/XHIMWZzty++0iNygBa4fH41k="}]},"maintainers":[{"name":"nanasun","email":"1128yeye@sina.com"},{"name":"ziven27","email":"ziven27@qq.com"}],"_npmUser":{"name":"ziven27","email":"ziven27@qq.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-modal_0.0.2_1597578420467_0.9580948885415392"},"_hasShrinkwrap":false}},"time":{"created":"2020-08-16T11:47:00.259Z","0.0.2":"2020-08-16T11:47:00.573Z","modified":"2022-04-04T10:51:37.897Z"},"maintainers":[{"name":"nanasun","email":"1128yeye@sina.com"},{"name":"ziven27","email":"ziven27@qq.com"}],"description":"No UI dependency modal of react","homepage":"https://nu-system.github.io/react/","keywords":["react-component","ui","no-ui","nu-system","react","react-ui","modal"],"repository":{"type":"git","url":"git+ssh://git@github.com/nu-system/react.git"},"author":{"name":"ziven27"},"bugs":{"url":"https://github.com/nu-system/react/issues"},"license":"MIT","readme":"# @\\_nu/react-modal\n\n[![npm package][npm-badge]][npm-url]\n[![npm downloads][npm-downloads]][npm-url]\n[![github][git-badge]][git-url]\n\n[npm-badge]: https://img.shields.io/npm/v/@_nu/react-modal.svg\n[npm-url]: https://www.npmjs.org/package/@_nu/react-modal\n[npm-downloads]: https://img.shields.io/npm/dw/@_nu/react-modal\n[git-url]: https://github.com/nu-system/react\n[git-badge]: https://img.shields.io/github/stars/nu-system/react.svg?style=social\n\n[English](../README.md) | 简体中文\n\n一个兼顾无障碍范围，易用性，且没有 UI 依赖的 React 模态框组件.\n\n`@_nu/react-modal` 本身不会输出任何样式，所有 demo 样式均来自于[@\\_nu/css-modal](https://nu-system.github.io/css/modal/)。\n\n\n## 安装\n\n```\n$ yarn add @_nu/react-modal\n```\n\n## 二次封装\n\n在你的项目组件库文件夹中创建一个新的 Modal 组件.\n\n```\nsrc/components/\n   └── Modal/\n       ├── index.js\n       └── style.css\n```\n\n```JSX\n// components/Modal/index.js\nimport NuModal from \"@_nu/react-modal\";\nimport \"@_nu/css-modal\";\n\n// 自定义你的模态框样式\nimport \"./index.css\";\n\nexport default NuDialog;\n```\n\n## 使用\n\n```JSX\nimport React, { useState } from \"react\";\nimport Dialog from \"./components/Dialog\";\n\nfunction Demo() {\n  const [open, setOpen] = useState(false);\n  return (\n    <div>\n      <button type=\"button\" onClick={() => setOpen(true)}>\n        open\n      </button>\n      <Dialog open={open} onClose={() => setOpen(false)}>\n        <h3>hello world!</h3>\n        <p>Happy to see you again.</p>\n      </Dialog>\n    </div>\n  );\n}\nexport default App;\n```\n\n## Dom\n\n```JSX\n<dialog open tab-index=\"-1\" class=\"nu_dialog_wrap\">\n  <Mask title={maskTitle} className=\"nu_dialog_mask\" />\n  <section class=\"nu_dialog\">\n      {children}\n      <Close title={closeTitle} className=\"nu_dialog_close\" />\n  </section>\n</dialog>\n```\n\n## Api\n\n```JSX\nDialog.defaultProps={\n  className = \"\",\n  children = null,\n  open = false,\n  active = true,\n  lockScroll = true,\n  maskTitle = \"Mask\",\n  removeTime = 200,\n  disabledPortal = false,\n  disableEsc = false,\n  closeTitle = \"Close\",\n  closeChildren = <Fragment>&times;</Fragment>,\n  onClose = () => {},\n  onClickMask = () => {}\n};\n\nDialog.propTypes = {\n  /**\n   * css class\n   */\n  className: PropTypes.string,\n  /**\n   * Dialog children, usually the included sub-components.\n   */\n  children: PropTypes.node,\n  /**\n   * if `> 0`, hide dialog and remove dialog after removeTime\n   * else if `0`, remove dialog immediately\n   * else, keep exit after hide\n   */\n  removeTime: PropTypes.number,\n  /**\n   * If `true`, the dialog go through the enter, entring, enterd.\n   * If `false`, the dialog go through the exitring, exitred.\n   */\n  open: PropTypes.bool,\n  /**\n   * If `true`, the dialog can focusable\n   * If `false`, the dialog blur\n   */\n  active: PropTypes.bool,\n  /**\n   * Callback fired when dialog close.\n   */\n  onClose: PropTypes.func,\n  /**\n   * Callback fired when the `Mask` is clicked.\n   * if return `false`, no longer trigger onclick\n   * else trigger the onClose\n   */\n  onClickMask: PropTypes.func,\n  /**\n   * If `true`, when dialog scroll into bottom the body will scroll\n   */\n  lockScroll: PropTypes.bool,\n  /**\n   * If `true`, the dialog will render where it is defined\n   */\n  disabledPortal: PropTypes.bool,\n  /**\n   * If `true`, the dialog will not close when click esc\n   */\n  disableEsc: PropTypes.bool,\n  /**\n   * title of the `Close`.\n   * If empty string, the `Close` do not render\n   */\n  closeTitle: PropTypes.string,\n  /**\n   * title of the mask element.\n   * If empty string, the mask do not render\n   */\n  maskTitle: PropTypes.string,\n  /**\n   * Close children\n   */\n  closeChildren: PropTypes.node\n};\n```\n\n### Transition\n\n```CSS\n.nu_dialog {\n  transform: translate(0, -50px);\n}\n._top .nu_dialog {\n  transform: translate(0, -50px);\n}\n._bottom .nu_dialog {\n  transform: translate(0, 50px);\n}\n._right .nu_dialog {\n  transform: translate(50px, 0);\n}\n._left .nu_dialog {\n  transform: translate(-50px, 0);\n}\n```\n\n你只需要定义 `.nu_dialog` 的起点状态即可。\n\n## 贡献与开发\n\n这个项目是与贡献者行为准则一起发布的。参与本项目，代表您同意遵守其条款。\n\n运行 demo `npm start`.\n\n## 技术方案\n\n`@_nu/react-dialog` 灵感来自以下几个优秀的开源框架：\n\n- [react-aria-modal](https://github.com/davidtheclark/react-aria-modal)\n- [focus-trap-react](https://github.com/davidtheclark/focus-trap-react)\n- [material-ui](https://material-ui.com/zh/components/modal/)\n- [nu-system](https://nu-system.github.io/)\n","readmeFilename":"README.md"}