diff --git a/docs/api/index.html b/docs/api/index.html index 3150403..74c5b35 100644 --- a/docs/api/index.html +++ b/docs/api/index.html @@ -112,7 +112,7 @@

Const ModalDef

ModalDef: React.FC<Record<string, unknown>> = ...
@@ -137,7 +137,7 @@

Const ModalHolder

ModalHolder: React.FC<Record<string, unknown>> = ...
@@ -165,7 +165,7 @@

Const NiceModalContext<
NiceModalContext: Context<NiceModalStore> = ...
@@ -175,17 +175,17 @@

Const Provider

Provider: React.FC<Record<string, unknown>> = ...

Const default

-
default: { ModalDef: FC<Record<string, unknown>>; ModalHolder: FC<Record<string, unknown>>; NiceModalContext: Context<NiceModalStore>; Provider: FC<Record<string, unknown>>; antdDrawer: (modal: NiceModalHandler<Record<string, unknown>>) => { visible: boolean; afterVisibleChange: any; onClose: any }; antdModal: (modal: NiceModalHandler<Record<string, unknown>>) => { visible: boolean; afterClose: any; onCancel: any; onOk: any }; bootstrapDialog: (modal: NiceModalHandler<Record<string, unknown>>) => { show: boolean; onExited: any; onHide: any }; create: <P>(Comp: ComponentType<P>) => FC<P & NiceModalHocProps>; getModal: (modalId: string) => React.FC<any> | undefined; hide: <T>(modal: string | React.FC<any>) => Promise<T>; muiDialog: (modal: NiceModalHandler<Record<string, unknown>>) => { open: boolean; onClose: any; onExited: any }; reducer: (state?: NiceModalStore, action: NiceModalAction) => NiceModalStore; register: <T>(id: string, comp: T, props?: Partial<NiceModalArgs<T>>) => void; remove: (modal: string | FC<any>) => void; show: { <T, C>(modal: React.FC<C>, args?: NiceModalArgs<React.FC<C>>): Promise<T>; <T>(modal: string, args?: Record<string, unknown>): Promise<T>; <T, P>(modal: string, args: P): Promise<T> }; useModal: { (): NiceModalHandler; (modal: string, args?: Record<string, unknown>): NiceModalHandler; <T, ComponentProps, PreparedProps, RemainingProps, ResolveType>(modal: T, args?: PreparedProps): Omit<NiceModalHandler, "show"> & { show: Partial<RemainingProps> extends RemainingProps ? (args?: RemainingProps) => Promise<ResolveType> : (args: RemainingProps) => Promise<ResolveType> } } } = ...
+
default: { ModalDef: FC<Record<string, unknown>>; ModalHolder: FC<Record<string, unknown>>; NiceModalContext: Context<NiceModalStore>; Provider: FC<Record<string, unknown>>; antdDrawer: (modal: NiceModalHandler<Record<string, unknown>>) => { visible: boolean; afterVisibleChange: any; onClose: any }; antdModal: (modal: NiceModalHandler<Record<string, unknown>>) => { visible: boolean; afterClose: any; onCancel: any; onOk: any }; bootstrapDialog: (modal: NiceModalHandler<Record<string, unknown>>) => { show: boolean; onExited: any; onHide: any }; create: <P>(Comp: ComponentType<P>) => FC<P & NiceModalHocProps>; getModal: (modalId: string) => React.FC<any> | undefined; hide: <T>(modal: string | React.FC<any>) => Promise<T>; muiDialog: (modal: NiceModalHandler<Record<string, unknown>>) => { open: boolean; onClose: any; onExited: any }; reducer: (state?: NiceModalStore, action: NiceModalAction) => NiceModalStore; register: <T>(id: string, comp: T, props?: Partial<NiceModalArgs<T>>) => void; remove: (modal: string | FC<any>) => void; show: { <T, C>(modal: React.FC<C>, args?: Partial<NiceModalArgs<React.FC<C>>>): Promise<T>; <T>(modal: string, args?: Record<string, unknown>): Promise<T>; <T, P>(modal: string, args: P): Promise<T> }; useModal: { (): NiceModalHandler; (modal: string, args?: Record<string, unknown>): NiceModalHandler; <C, P>(modal: React.FC<C>, args?: P): Omit<NiceModalHandler, "show"> & { show: any } } } = ...
@@ -232,7 +232,7 @@
afterVisibleChange: func
  • Parameters

    @@ -254,7 +254,7 @@
    onClose: function
  • Returns void

    @@ -296,7 +296,7 @@
    afterClose: function
  • Returns void

    @@ -312,7 +312,7 @@
    onCancel: function
  • Returns void

    @@ -328,7 +328,7 @@
    onOk: function
  • Returns void

    @@ -370,7 +370,7 @@
    onExited: function
  • Returns void

    @@ -386,7 +386,7 @@
    onHide: function
  • Returns void

    @@ -503,7 +503,7 @@
    onClose: function
  • Returns void

    @@ -519,7 +519,7 @@
    onExited: function
  • Returns void

    @@ -611,11 +611,11 @@

    Returns void

  • -
    show: { <T, C>(modal: React.FC<C>, args?: NiceModalArgs<React.FC<C>>): Promise<T>; <T>(modal: string, args?: Record<string, unknown>): Promise<T>; <T, P>(modal: string, args: P): Promise<T> }
    +
    show: { <T, C>(modal: React.FC<C>, args?: Partial<NiceModalArgs<React.FC<C>>>): Promise<T>; <T>(modal: string, args?: Record<string, unknown>): Promise<T>; <T, P>(modal: string, args: P): Promise<T> }
      • -
      • <T, C>(modal: React.FC<C>, args?: NiceModalArgs<React.FC<C>>): Promise<T>
      • +
      • <T, C>(modal: React.FC<C>, args?: Partial<NiceModalArgs<React.FC<C>>>): Promise<T>
      • <T>(modal: string, args?: Record<string, unknown>): Promise<T>
      • <T, P>(modal: string, args: P): Promise<T>
      @@ -636,7 +636,7 @@

      Parameters

      modal: React.FC<C>
    • -
      Optional args: NiceModalArgs<React.FC<C>>
      +
      Optional args: Partial<NiceModalArgs<React.FC<C>>>

    Returns Promise<T>

    @@ -685,13 +685,13 @@

    Returns Promise

  • -
    useModal: { (): NiceModalHandler; (modal: string, args?: Record<string, unknown>): NiceModalHandler; <T, ComponentProps, PreparedProps, RemainingProps, ResolveType>(modal: T, args?: PreparedProps): Omit<NiceModalHandler, "show"> & { show: Partial<RemainingProps> extends RemainingProps ? (args?: RemainingProps) => Promise<ResolveType> : (args: RemainingProps) => Promise<ResolveType> } }
    +
    useModal: { (): NiceModalHandler; (modal: string, args?: Record<string, unknown>): NiceModalHandler; <C, P>(modal: React.FC<C>, args?: P): Omit<NiceModalHandler, "show"> & { show: any } }

    Returns Promise<T>

    @@ -1398,7 +1389,7 @@

    Returns Promise

    Type parameters

    @@ -1421,7 +1412,7 @@

    Returns Promise

    Type parameters

    @@ -1456,7 +1447,7 @@

    Const unregister

  • @@ -1483,13 +1474,13 @@

    useModal

    • useModal(): NiceModalHandler
    • useModal(modal: string, args?: Record<string, unknown>): NiceModalHandler
    • -
    • useModal<T, ComponentProps, PreparedProps, RemainingProps, ResolveType>(modal: T, args?: PreparedProps): Omit<NiceModalHandler, "show"> & { show: Partial<RemainingProps> extends RemainingProps ? (args?: RemainingProps) => Promise<ResolveType> : (args: RemainingProps) => Promise<ResolveType> }
    • +
    • useModal<C, P>(modal: React.FC<C>, args?: P): Omit<NiceModalHandler, "show"> & { show: any }
    • Returns NiceModalHandler

      @@ -1497,7 +1488,7 @@

      Returns

      Parameters

      @@ -1514,37 +1505,28 @@

      Returns

      Type parameters

      • -

        T: FunctionComponent<any, T>

        -
      • -
      • -

        ComponentProps: Omit<any, "id">

        -
      • -
      • -

        PreparedProps: Partial<ComponentProps> = {} | ComponentProps

        -
      • -
      • -

        RemainingProps = Omit<ComponentProps, keyof PreparedProps> & Partial<ComponentProps>

        +

        C: unknown

      • -

        ResolveType = unknown

        +

        P: Partial<Omit<C & { children?: ReactNode }, "id">>

      Parameters

      • -
        modal: T
        +
        modal: React.FC<C>
      • -
        Optional args: PreparedProps
        +
        Optional args: P
      -

      Returns Omit<NiceModalHandler, "show"> & { show: Partial<RemainingProps> extends RemainingProps ? (args?: RemainingProps) => Promise<ResolveType> : (args: RemainingProps) => Promise<ResolveType> }

      +

      Returns Omit<NiceModalHandler, "show"> & { show: any }

  • diff --git a/docs/api/interfaces/NiceModalAction.html b/docs/api/interfaces/NiceModalAction.html index 6612ef4..fa2e8c5 100644 --- a/docs/api/interfaces/NiceModalAction.html +++ b/docs/api/interfaces/NiceModalAction.html @@ -95,7 +95,7 @@

    payload

    payload: { args?: Record<string, unknown>; flags?: Record<string, unknown>; modalId: string }
    @@ -119,7 +119,7 @@

    type

    type: string
    diff --git a/docs/api/interfaces/NiceModalHandler.html b/docs/api/interfaces/NiceModalHandler.html index 7e2efdb..49c4555 100644 --- a/docs/api/interfaces/NiceModalHandler.html +++ b/docs/api/interfaces/NiceModalHandler.html @@ -130,7 +130,7 @@

    Optional args

    @@ -141,7 +141,7 @@

    Optional delayVisible

    Inherited from NiceModalState.delayVisible

    @@ -152,7 +152,7 @@

    id

    @@ -163,7 +163,7 @@

    keepMounted

    @@ -179,7 +179,7 @@

    visible

    @@ -201,7 +201,7 @@

    hide

  • @@ -223,7 +223,7 @@

    reject

  • @@ -251,7 +251,7 @@

    remove

  • @@ -273,7 +273,7 @@

    resolve

  • @@ -301,7 +301,7 @@

    resolveHide

  • @@ -329,7 +329,7 @@

    show

  • diff --git a/docs/api/interfaces/NiceModalHocProps.html b/docs/api/interfaces/NiceModalHocProps.html index f615d48..9325416 100644 --- a/docs/api/interfaces/NiceModalHocProps.html +++ b/docs/api/interfaces/NiceModalHocProps.html @@ -96,7 +96,7 @@

    Optional defaultVisibledefaultVisible: boolean

    @@ -106,7 +106,7 @@

    id

    id: string
    @@ -116,7 +116,7 @@

    Optional keepMounted

    keepMounted: boolean
    diff --git a/docs/api/interfaces/NiceModalState.html b/docs/api/interfaces/NiceModalState.html index 0521cbb..26f9039 100644 --- a/docs/api/interfaces/NiceModalState.html +++ b/docs/api/interfaces/NiceModalState.html @@ -103,7 +103,7 @@

    Optional args

    args: Record<string, unknown>
    @@ -113,7 +113,7 @@

    Optional delayVisible

    delayVisible: boolean
  • @@ -123,7 +123,7 @@

    id

    id: string
    @@ -133,7 +133,7 @@

    Optional keepMounted

    keepMounted: boolean
    @@ -143,7 +143,7 @@

    Optional visible

    visible: boolean
    diff --git a/docs/asset-manifest.json b/docs/asset-manifest.json index fc386cf..75c913e 100644 --- a/docs/asset-manifest.json +++ b/docs/asset-manifest.json @@ -1,8 +1,8 @@ { "files": { "main.css": "./static/css/main.4fe4bbe5.chunk.css", - "main.js": "./static/js/main.896621f7.chunk.js", - "main.js.map": "./static/js/main.896621f7.chunk.js.map", + "main.js": "./static/js/main.6645edd4.chunk.js", + "main.js.map": "./static/js/main.6645edd4.chunk.js.map", "runtime-main.js": "./static/js/runtime-main.3e6ba3ee.js", "runtime-main.js.map": "./static/js/runtime-main.3e6ba3ee.js.map", "static/css/2.9573e3cf.chunk.css": "./static/css/2.9573e3cf.chunk.css", @@ -20,6 +20,6 @@ "static/css/2.9573e3cf.chunk.css", "static/js/2.039ea410.chunk.js", "static/css/main.4fe4bbe5.chunk.css", - "static/js/main.896621f7.chunk.js" + "static/js/main.6645edd4.chunk.js" ] } \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 0db1ce4..c30ed94 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1 +1 @@ -Nice Modal
    \ No newline at end of file +Nice Modal
    \ No newline at end of file diff --git a/docs/static/js/main.896621f7.chunk.js b/docs/static/js/main.6645edd4.chunk.js similarity index 89% rename from docs/static/js/main.896621f7.chunk.js rename to docs/static/js/main.6645edd4.chunk.js index 4d8f205..700f5d8 100644 --- a/docs/static/js/main.896621f7.chunk.js +++ b/docs/static/js/main.6645edd4.chunk.js @@ -1,2 +1,2 @@ -(this.webpackJsonpexample=this.webpackJsonpexample||[]).push([[0],{226:function(e,n,o){},337:function(e,n,o){},341:function(e,n,o){"use strict";o.r(n);var t=o(0),r=o.n(t),a=o(21),i=o.n(a),l=(o(226),function(){return l=Object.assign||function(e){for(var n,o=1,t=arguments.length;o {\n const modal = useModal();\n return (\n \n Greetings: {name}!\n \n );\n});\n\nconst MyAntdDrawer = NiceModal.create(({ name }: { name: string }) => {\n const modal = useModal();\n return (\n {\n if (!visible) modal.remove();\n }}\n >\n Greetings: {name}!\n \n );\n});\n\nexport default function AntdSample() {\n return (\n \n \n \n \n );\n}\n","UserInfoModal.jsx":"import { useCallback } from 'react';\nimport { Form, Modal } from 'antd';\nimport FormBuilder from 'antd-form-builder';\nimport NiceModal, { useModal, antdModal } from '@ebay/nice-modal-react';\n\nexport default NiceModal.create(({ user }) => {\n const modal = useModal();\n const [form] = Form.useForm();\n const meta = {\n initialValues: user,\n fields: [\n { key: 'name', label: 'Name', required: true },\n { key: 'job', label: 'Job Title', required: true },\n ],\n };\n\n const handleSubmit = useCallback(() => {\n form.validateFields().then(() => {\n const newUser = { ...form.getFieldsValue() };\n // In real case, you may call API to create user or update user\n if (!user) {\n newUser.id = String(Date.now());\n } else {\n newUser.id = user.id;\n }\n modal.resolve(newUser);\n modal.hide();\n });\n }, [modal, user, form]);\n return (\n \n
    \n \n \n \n );\n});\n","UserList.jsx":"import { useMemo, useCallback, useState } from 'react';\nimport { Button, Table } from 'antd';\nimport { EditOutlined } from '@ant-design/icons';\nimport { useModal } from '@ebay/nice-modal-react';\nimport UserInfoModal from './UserInfoModal';\nimport mockData from './mock';\n\nexport default function UserList() {\n const userModal = useModal(UserInfoModal);\n const [users, setUsers] = useState(mockData);\n\n const handleNewUser = useCallback(() => {\n userModal.show().then((newUser) => {\n setUsers([newUser, ...users]);\n });\n }, [userModal, users]);\n\n const handleEditUser = useCallback(\n (user) => {\n userModal.show({ user }).then((newUser) => {\n setUsers((users) => {\n // Modify users immutablly\n const i = users.findIndex((u) => u.id === newUser.id);\n const updated = { ...users[i], ...newUser };\n const arr = [...users];\n arr.splice(i, 1, updated);\n return arr;\n });\n });\n },\n [userModal],\n );\n\n const columns = useMemo(\n () => [\n {\n title: 'Name',\n dataIndex: 'name',\n width: '150px',\n },\n {\n title: 'Job Title',\n dataIndex: 'job',\n },\n {\n title: 'Edit',\n width: '100px',\n render(value, user) {\n return (\n }\n onClick={() => {\n handleEditUser(user);\n }}\n />\n );\n },\n },\n ],\n [handleEditUser],\n );\n\n return (\n
    \n \n \n
    \n );\n}\n","PromiseSample.jsx":"import { Modal, Button, Space } from 'antd';\nimport NiceModal, { useModal, antdModal } from '@ebay/nice-modal-react';\n\nconst PromiseModal = NiceModal.create(({ name }) => {\n const modal = useModal();\n const handleResolve = () => {\n modal.resolve({ resolved: true });\n };\n const handleReject = () => {\n modal.reject(new Error('Rejected'));\n modal.hide();\n };\n return (\n \n

    Choose the promise action: {name}

    \n \n \n \n \n
    \n );\n});\n\nconst ChainingModal = NiceModal.create(({ times }) => {\n const modal = useModal();\n return (\n \n \n
    \n
    \n Showed {times}/3 times.\n
    \n );\n});\n\nexport default function PromiseSample() {\n const chainingModal = useModal(ChainingModal);\n const showPromiseModal = () => {\n NiceModal.show(PromiseModal, { name: 'nate' })\n .then((res) => {\n console.log('Resolved: ', res);\n NiceModal.show(PromiseModal, { name: 'nate2' });\n })\n .catch((err) => {\n console.log('Rejected: ', err);\n });\n };\n const showChainingModal = async () => {\n for (let i = 0; i < 3; i++) {\n await chainingModal.show({ times: i + 1 });\n await chainingModal.hide();\n }\n };\n\n return (\n <>\n

    NOTE: please open dev console to see the output.

    \n \n \n\n \n \n \n );\n}\n","MyMuiDialog.tsx":"import React from 'react';\nimport Button from '@material-ui/core/Button';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogActions from '@material-ui/core/DialogActions';\nimport DialogContent from '@material-ui/core/DialogContent';\nimport DialogContentText from '@material-ui/core/DialogContentText';\nimport DialogTitle from '@material-ui/core/DialogTitle';\nimport Slide from '@material-ui/core/Slide';\nimport { TransitionProps } from '@material-ui/core/transitions';\nimport NiceModal, { useModal } from '@ebay/nice-modal-react';\n\nconst Transition = React.forwardRef(function Transition(\n props: TransitionProps & { children?: React.ReactElement },\n ref: React.Ref,\n) {\n return ;\n});\n\nconst MyMuiDialog = NiceModal.create(() => {\n const modal = useModal();\n return (\n modal.hide()}\n TransitionProps={{\n onExited: () => modal.remove(),\n }}\n >\n {\"Use Google's location service?\"}\n \n \n Let Google help apps determine location. This means sending anonymous location data to Google, even when no\n apps are running.\n \n \n \n \n \n \n \n );\n});\n\nexport default function MuiDialogSample() {\n return (\n \n );\n}\n","MyBootstrapDialog.tsx":"import BootstrapModal from 'react-bootstrap/Modal';\nimport Button from 'react-bootstrap/Button';\nimport NiceModal, { useModal, bootstrapDialog } from '@ebay/nice-modal-react';\n\nconst MyBootstrapDialog = NiceModal.create(({ name = 'Bootstrap' }: { name: string }) => {\n const modal = useModal();\n return (\n \n \n Modal title\n \n\n \n

    Modal body text goes here. {name}

    \n
    \n\n \n \n \n \n
    \n );\n});\nexport default function BootstrapSample() {\n return (\n <>\n \n \n );\n}\n","ReduxIntegration.jsx":"import { createStore, applyMiddleware, compose, combineReducers } from 'redux';\nimport { Provider, useSelector, useDispatch } from 'react-redux';\nimport NiceModal from '@ebay/nice-modal-react';\nimport { Button } from 'antd';\nimport { MyAntdModal } from './MyAntdModal';\nimport logger from 'redux-logger';\n\nconst composeEnhancers = (typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) || compose;\nconst enhancer = composeEnhancers(applyMiddleware(logger));\n\nconst store = createStore(\n combineReducers({\n __nice_modals: NiceModal.reducer,\n // other reducers...\n }),\n enhancer,\n);\n\nconst ModalsProvider = ({ children }) => {\n const modals = useSelector((s) => s.__nice_modals);\n const dispatch = useDispatch();\n return (\n \n

    NOTE: open dev console or Redux dev tools to see actions log.

    \n {\n NiceModal.show(MyAntdModal, { name: 'Redux' });\n }}\n >\n Show Modal\n \n
    \n );\n};\n\nexport default function ReduxIntegration({ children }) {\n return (\n \n {children}\n \n );\n}\n","Declarative.jsx":"import { Modal, Button } from 'antd';\nimport NiceModal, { useModal, ModalDef } from '@ebay/nice-modal-react';\n\nexport const MyAntdModal = NiceModal.create(({ name }) => {\n const modal = useModal();\n return (\n \n Greetings: {name}!\n \n );\n});\n\nexport default function AntdSample() {\n return (\n <>\n \n \n \n );\n}\n","PropsBinding.jsx":"import { useEffect, useState } from 'react';\nimport { Modal, Button } from 'antd';\nimport NiceModal, { useModal, ModalHolder } from '@ebay/nice-modal-react';\n\nexport const MyAntdModal = NiceModal.create(({ time }) => {\n const modal = useModal();\n return (\n \n Time: {time}\n \n );\n});\n\nexport default function Example() {\n const [time, setTime] = useState(0);\n useEffect(() => {\n const p = setInterval(() => setTime((t) => t + 1), 1000);\n return () => clearInterval(p);\n }, []);\n\n // modalHandler will be assign show/hide method.\n const modalHandler = {};\n\n return (\n <>\n \n \n \n );\n}\n"};function F(e){var n=e.filename;return Object(t.useEffect)((function(){window.Prism.highlightAll()}),[n]),Object(_.jsxs)("div",{className:"code-viewer",children:[Object(_.jsx)("h5",{children:n}),Object(_.jsx)("pre",{children:Object(_.jsx)("code",{className:"language-jsx line-numbers",children:H[n]||'// Error: code of "'.concat(n,'" not found')})})]})}var L=o(34),G=o(178),V=o(37),J=o(374),K=o(375),X=o(376),q=o(379),z=o(208),Q=R.create((function(e){var n=e.user,o=C(),r=X.a.useForm(),a=Object(U.a)(r,1)[0],i={initialValues:n,fields:[{key:"name",label:"Name",required:!0},{key:"job",label:"Job Title",required:!0}]},l=Object(t.useCallback)((function(){a.validateFields().then((function(){var e=Object(L.a)({},a.getFieldsValue());e.id=n?n.id:String(Date.now()),o.resolve(e),o.hide()}))}),[o,n,a]);return Object(_.jsx)(q.a,Object(L.a)(Object(L.a)({},D(o)),{},{title:n?"Edit User":"New User",okText:n?"Update":"Create",onOk:l,children:Object(_.jsx)(X.a,{form:a,children:Object(_.jsx)(z.a,{meta:i,form:a})})}))})),W=[{id:"1",name:"Kennedy",job:"Chief Mobility Orchestrator",city:"North Alec"},{id:"2",name:"Lucius",job:"Internal Research Manager",city:"Littleland"},{id:"3",name:"Carlos",job:"Lead Configuration Analyst",city:"South Lillian"},{id:"4",name:"Urban",job:"Chief Operations Agent",city:"Shieldshaven"},{id:"5",name:"Katrine",job:"Legacy Solutions Orchestrator",city:"South Kyleigh"}];o(337);var Y=o(177),Z=o.n(Y),$=o(206),ee=o(381),ne=R.create((function(e){var n=e.name,o=C();return Object(_.jsxs)(q.a,Object(L.a)(Object(L.a)({title:"Promise Example"},D(o)),{},{children:[Object(_.jsxs)("p",{children:["Choose the promise action: ",n]}),Object(_.jsxs)(ee.b,{children:[Object(_.jsx)(V.a,{onClick:function(){o.resolve({resolved:!0})},children:"Resolve"}),Object(_.jsx)(V.a,{onClick:function(){o.reject(new Error("Rejected")),o.hide()},danger:!0,children:"Reject"})]})]}))})),oe=R.create((function(e){var n=e.times,o=C();return Object(_.jsxs)(q.a,Object(L.a)(Object(L.a)({title:"Chaining Same Modal Example"},D(o)),{},{children:[Object(_.jsx)(V.a,{type:"primary",onClick:function(){return o.resolve()},children:"Hide with resolve."}),Object(_.jsx)("br",{}),Object(_.jsx)("br",{}),"Showed ",n,"/3 times."]}))}));var te=R.create((function(e){var n=e.name,o=C();return Object(_.jsxs)(q.a,{title:"Hello Antd",visible:o.visible,onOk:o.hide,onCancel:o.hide,afterClose:o.remove,children:["Greetings: ",n,"!"]})}));var re=o(378),ae=o(377),ie=o(373),le=o(371),ce=o(372),de=o(370),se=o(382),ue=r.a.forwardRef((function(e,n){return Object(_.jsx)(se.a,Object(L.a)({direction:"up",ref:n},e))})),me=R.create((function(){var e=C();return Object(_.jsxs)(ae.a,{TransitionComponent:ue,open:e.visible,onClose:function(){return e.hide()},TransitionProps:{onExited:function(){return e.remove()}},children:[Object(_.jsx)(de.a,{id:"alert-dialog-slide-title",children:"Use Google's location service?"}),Object(_.jsx)(le.a,{children:Object(_.jsx)(ce.a,{id:"alert-dialog-slide-description",children:"Let Google help apps determine location. This means sending anonymous location data to Google, even when no apps are running."})}),Object(_.jsxs)(ie.a,{children:[Object(_.jsx)(re.a,{onClick:function(){return e.hide()},color:"primary",children:"Disagree"}),Object(_.jsx)(re.a,{onClick:function(){return e.hide()},color:"primary",children:"Agree"})]})]})}));var pe=o(380),he=R.create((function(e){var n=e.name,o=C();return Object(_.jsxs)(q.a,{title:"Hello Antd",visible:o.visible,onOk:o.hide,onCancel:o.hide,afterClose:o.remove,children:["Greetings: ",n,"!"]})})),fe=R.create((function(e){var n=e.name,o=C();return Object(_.jsxs)(pe.a,{title:"Hello Antd",visible:o.visible,onClose:o.hide,afterVisibleChange:function(e){e||o.remove()},children:["Greetings: ",n,"!"]})}));var be=o(98),je=o(157),ve=R.create((function(e){var n=e.name,o=void 0===n?"Bootstrap":n,t=C();return Object(_.jsxs)(be.a,Object(L.a)(Object(L.a)({},T(t)),{},{title:"Nice Modal",children:[Object(_.jsx)(be.a.Header,{closeButton:!0,children:Object(_.jsx)(be.a.Title,{children:"Modal title"})}),Object(_.jsx)(be.a.Body,{children:Object(_.jsxs)("p",{children:["Modal body text goes here. ",o]})}),Object(_.jsxs)(be.a.Footer,{children:[Object(_.jsx)(je.a,{variant:"secondary",onClick:t.hide,children:"Close"}),Object(_.jsx)(je.a,{variant:"primary",onClick:t.hide,children:"Save changes"})]})]}))}));var Me=o(112),xe=o(156),Oe=o(207),ge=o.n(Oe),ye=("undefined"!==typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__||Me.c)(Object(Me.a)(ge.a)),we=Object(Me.d)(Object(Me.b)({__nice_modals:R.reducer}),ye),Ce=function(e){e.children;var n=Object(xe.c)((function(e){return e.__nice_modals})),o=Object(xe.b)();return Object(_.jsxs)(R.Provider,{modals:n,dispatch:o,children:[Object(_.jsx)("p",{style:{color:"#999"},children:"NOTE: open dev console or Redux dev tools to see actions log."}),Object(_.jsx)(V.a,{type:"primary",onClick:function(){R.show(he,{name:"Redux"})},children:"Show Modal"})]})};var ke=R.create((function(e){var n=e.time,o=C();return Object(_.jsxs)(q.a,{title:"Props Binding",visible:o.visible,onOk:o.hide,onCancel:o.hide,afterClose:o.remove,children:["Time: ",n]})}));var Be={real:{name:"Real Case",component:function(){var e=C(Q),n=Object(t.useState)(W),o=Object(U.a)(n,2),r=o[0],a=o[1],i=Object(t.useCallback)((function(){e.show().then((function(e){a([e].concat(Object(G.a)(r)))}))}),[e,r]),l=Object(t.useCallback)((function(n){e.show({user:n}).then((function(e){a((function(n){var o=n.findIndex((function(n){return n.id===e.id})),t=Object(L.a)(Object(L.a)({},n[o]),e),r=Object(G.a)(n);return r.splice(o,1,t),r}))}))}),[e]),c=Object(t.useMemo)((function(){return[{title:"Name",dataIndex:"name",width:"150px"},{title:"Job Title",dataIndex:"job"},{title:"Edit",width:"100px",render:function(e,n){return Object(_.jsx)(V.a,{type:"link",icon:Object(_.jsx)(K.a,{}),onClick:function(){l(n)}})}}]}),[l]);return Object(_.jsxs)("div",{children:[Object(_.jsx)(V.a,{type:"primary",onClick:i,children:"+ New User"}),Object(_.jsx)(J.a,{size:"small",rowKey:"id",pagination:!1,columns:c,dataSource:r,style:{marginTop:"20px"}})]})},description:"Show a dialog to create a new user or edit user info.",code:["UserList.jsx","UserInfoModal.jsx"]},mui:{name:"Material UI",description:"Show material UI dialog",component:function(){return Object(_.jsx)(re.a,{variant:"contained",onClick:function(){return R.show(me)},color:"primary",children:"Agree"})},code:["MyMuiDialog.tsx"]},antd:{name:"Ant Design",description:"Show/hide antd modal or drawer.",component:function(){return Object(_.jsxs)(ee.b,{children:[Object(_.jsx)(V.a,{type:"primary",onClick:function(){return R.show(he,{name:"Nate"})},children:"Show Modal"}),Object(_.jsx)(V.a,{type:"primary",onClick:function(){return R.show(fe,{name:"Bood"})},children:"Show Drawer"})]})},code:["MyAntdModal.tsx"]},bootstrap:{name:"Bootstrap React",descript:"Show/hide bootstrap dialog.",component:function(){return Object(_.jsx)(_.Fragment,{children:Object(_.jsx)(je.a,{variant:"primary",onClick:function(){return R.show(ve,{name:"Bootstrap"})},children:"Show Dialog"})})},code:["MyBootstrapDialog.tsx"]},promise:{name:"Promise",description:"Use promise to interact with the dialog.",component:function(){var e=C(oe),n=function(){var n=Object($.a)(Z.a.mark((function n(){var o;return Z.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:o=0;case 1:if(!(o<3)){n.next=9;break}return n.next=4,e.show({times:o+1});case 4:return n.next=6,e.hide();case 6:o++,n.next=1;break;case 9:case"end":return n.stop()}}),n)})));return function(){return n.apply(this,arguments)}}();return Object(_.jsxs)(_.Fragment,{children:[Object(_.jsx)("p",{style:{color:"#888"},children:"NOTE: please open dev console to see the output."}),Object(_.jsxs)(ee.b,{children:[Object(_.jsx)(V.a,{type:"primary",onClick:function(){R.show(ne,{name:"nate"}).then((function(e){console.log("Resolved: ",e),R.show(ne,{name:"nate2"})})).catch((function(e){console.log("Rejected: ",e)}))},children:"Show Modal"}),Object(_.jsx)(V.a,{type:"primary",onClick:n,children:"Chaining Same Modal"})]})]})},code:["PromiseSample.jsx"]},declarative:{name:"Declarative",description:"Declarative way to register a modal with id.",component:function(){return Object(_.jsxs)(_.Fragment,{children:[Object(_.jsx)(V.a,{type:"primary",onClick:function(){return R.show("my-antd-modal",{name:"Nate"})},children:"Show Modal"}),Object(_.jsx)(S,{id:"my-antd-modal",component:te})]})},code:["Declarative.jsx"]},propsBinding:{name:"Props Binding",description:"To bind props to modal, need to declare the modal using jsx.",component:function(){var e=Object(t.useState)(0),n=Object(U.a)(e,2),o=n[0],r=n[1];Object(t.useEffect)((function(){var e=setInterval((function(){return r((function(e){return e+1}))}),1e3);return function(){return clearInterval(e)}}),[]);var a={};return Object(_.jsxs)(_.Fragment,{children:[Object(_.jsx)(V.a,{type:"primary",onClick:function(){return a.show()},children:"Show Modal"}),Object(_.jsx)(E,{modal:ke,handler:a,time:o})]})},code:["PropsBinding.jsx"]},redux:{name:"Redux Integration",description:"Use Redux to manage modals state so that you can use Redux dev tools to debug nice modals.",component:function(e){var n=e.children;return Object(_.jsx)(xe.a,{store:we,children:Object(_.jsx)(Ce,{children:n})})},code:["ReduxIntegration.jsx"]}};var Ne=function(){var e,n=A()||"real",o=Be[n]||{},t=Object(_.jsxs)("div",{className:"app",children:[Object(_.jsxs)("div",{className:"sider",children:[Object(_.jsxs)("h1",{children:[Object(_.jsx)("span",{className:"header-name",children:"@ebay/nice-modal-react"}),Object(_.jsx)("span",{className:"example-title",children:"Examples"})]}),Object(_.jsx)("div",{className:"scroll-container",children:Object(_.jsx)("ul",{children:Object.keys(Be).map((function(e){return Object(_.jsx)("li",{children:Object(_.jsx)("a",{href:"#".concat(e),className:n===e?"active":"",children:Be[e].name})},e)}))})}),Object(_.jsxs)("div",{className:"social",children:[Object(_.jsx)("a",{href:"https://github.com/ebay/nice-modal-react",children:Object(_.jsx)("img",{src:"https://img.shields.io/github/stars/eBay/nice-modal-react?style=social",alt:"Github Repo"})}),Object(_.jsx)("br",{}),Object(_.jsx)("a",{href:"https://ebay.github.io/nice-modal-react/api",children:Object(_.jsx)("img",{src:"https://img.shields.io/badge/API-Reference-green",alt:"api reference"})}),Object(_.jsx)("br",{}),Object(_.jsx)("a",{href:"https://codesandbox.io/s/github/ebay/nice-modal-react/tree/main/example",children:Object(_.jsx)("img",{width:"150px",src:"https://codesandbox.io/static/img/play-codesandbox.svg",alt:"codesandbox"})})]})]}),Object(_.jsxs)("div",{children:[Object(_.jsx)("div",{className:"example-container",children:function(){var e=Be[n];if(!e||!e.component)return Object(_.jsxs)("span",{style:{color:"red"},children:['Error: example "',n,'" not found.']});var o=e.component;return Object(_.jsxs)(_.Fragment,{children:[Object(_.jsxs)("h1",{children:[e.name,Object(_.jsx)("p",{className:"example-description",children:e.description})]}),Object(_.jsx)(o,{})]})}()}),Object(_.jsx)("div",{className:"code-container",children:null===(e=o.code)||void 0===e?void 0:e.map((function(e){return Object(_.jsx)(F,{filename:e},e)}))})]})]});return"redux"===n?t:Object(_.jsx)(R.Provider,{children:t})},Se=function(e){e&&e instanceof Function&&o.e(3).then(o.bind(null,383)).then((function(n){var o=n.getCLS,t=n.getFID,r=n.getFCP,a=n.getLCP,i=n.getTTFB;o(e),t(e),r(e),a(e),i(e)}))};o(339),o(340);i.a.render(Object(_.jsx)(Ne,{}),document.getElementById("root")),Se()}},[[341,1,2]]]); -//# sourceMappingURL=main.896621f7.chunk.js.map \ No newline at end of file +(this.webpackJsonpexample=this.webpackJsonpexample||[]).push([[0],{226:function(e,n,o){},337:function(e,n,o){},341:function(e,n,o){"use strict";o.r(n);var t=o(0),r=o.n(t),a=o(21),i=o.n(a),l=(o(226),function(){return l=Object.assign||function(e){for(var n,o=1,t=arguments.length;o {\n const modal = useModal();\n return (\n \n Greetings: {name}!\n \n );\n});\n\nconst MyAntdDrawer = NiceModal.create(({ name }: { name: string }) => {\n const modal = useModal();\n return (\n {\n if (!visible) modal.remove();\n }}\n >\n Greetings: {name}!\n \n );\n});\n\nexport default function AntdSample() {\n return (\n \n \n \n \n );\n}\n","UserInfoModal.jsx":"import { useCallback } from 'react';\nimport { Form, Modal } from 'antd';\nimport FormBuilder from 'antd-form-builder';\nimport NiceModal, { useModal, antdModal } from '@ebay/nice-modal-react';\n\nexport default NiceModal.create(({ user }) => {\n const modal = useModal();\n const [form] = Form.useForm();\n const meta = {\n initialValues: user,\n fields: [\n { key: 'name', label: 'Name', required: true },\n { key: 'job', label: 'Job Title', required: true },\n ],\n };\n\n const handleSubmit = useCallback(() => {\n form.validateFields().then(() => {\n const newUser = { ...form.getFieldsValue() };\n // In real case, you may call API to create user or update user\n if (!user) {\n newUser.id = String(Date.now());\n } else {\n newUser.id = user.id;\n }\n modal.resolve(newUser);\n modal.hide();\n });\n }, [modal, user, form]);\n return (\n \n
    \n \n \n \n );\n});\n","UserList.jsx":"import { useMemo, useCallback, useState } from 'react';\nimport { Button, Table } from 'antd';\nimport { EditOutlined } from '@ant-design/icons';\nimport { useModal } from '@ebay/nice-modal-react';\nimport UserInfoModal from './UserInfoModal';\nimport mockData from './mock';\n\nexport default function UserList() {\n const userModal = useModal(UserInfoModal);\n const [users, setUsers] = useState(mockData);\n\n const handleNewUser = useCallback(() => {\n userModal.show().then((newUser) => {\n setUsers([newUser, ...users]);\n });\n }, [userModal, users]);\n\n const handleEditUser = useCallback(\n (user) => {\n userModal.show({ user }).then((newUser) => {\n setUsers((users) => {\n // Modify users immutablly\n const i = users.findIndex((u) => u.id === newUser.id);\n const updated = { ...users[i], ...newUser };\n const arr = [...users];\n arr.splice(i, 1, updated);\n return arr;\n });\n });\n },\n [userModal],\n );\n\n const columns = useMemo(\n () => [\n {\n title: 'Name',\n dataIndex: 'name',\n width: '150px',\n },\n {\n title: 'Job Title',\n dataIndex: 'job',\n },\n {\n title: 'Edit',\n width: '100px',\n render(value, user) {\n return (\n }\n onClick={() => {\n handleEditUser(user);\n }}\n />\n );\n },\n },\n ],\n [handleEditUser],\n );\n\n return (\n
    \n \n \n
    \n );\n}\n","PromiseSample.jsx":"import { Modal, Button, Space } from 'antd';\nimport NiceModal, { useModal, antdModal } from '@ebay/nice-modal-react';\n\nconst PromiseModal = NiceModal.create(({ name }) => {\n const modal = useModal();\n const handleResolve = () => {\n modal.resolve({ resolved: true });\n };\n const handleReject = () => {\n modal.reject(new Error('Rejected'));\n modal.hide();\n };\n return (\n \n

    Choose the promise action: {name}

    \n \n \n \n \n
    \n );\n});\n\nconst ChainingModal = NiceModal.create(({ times }) => {\n const modal = useModal();\n return (\n \n \n
    \n
    \n Showed {times}/3 times.\n
    \n );\n});\n\nexport default function PromiseSample() {\n const chainingModal = useModal(ChainingModal);\n const showPromiseModal = () => {\n NiceModal.show(PromiseModal, { name: 'nate' })\n .then((res) => {\n console.log('Resolved: ', res);\n NiceModal.show(PromiseModal, { name: 'nate2' });\n })\n .catch((err) => {\n console.log('Rejected: ', err);\n });\n };\n const showChainingModal = async () => {\n for (let i = 0; i < 3; i++) {\n await chainingModal.show({ times: i + 1 });\n await chainingModal.hide();\n }\n };\n\n return (\n <>\n

    NOTE: please open dev console to see the output.

    \n \n \n\n \n \n \n );\n}\n","MyMuiDialog.tsx":"import React from 'react';\nimport Button from '@material-ui/core/Button';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogActions from '@material-ui/core/DialogActions';\nimport DialogContent from '@material-ui/core/DialogContent';\nimport DialogContentText from '@material-ui/core/DialogContentText';\nimport DialogTitle from '@material-ui/core/DialogTitle';\nimport Slide from '@material-ui/core/Slide';\nimport { TransitionProps } from '@material-ui/core/transitions';\nimport NiceModal, { useModal } from '@ebay/nice-modal-react';\n\nconst Transition = React.forwardRef(function Transition(\n props: TransitionProps & { children?: React.ReactElement },\n ref: React.Ref,\n) {\n return ;\n});\n\nconst MyMuiDialog = NiceModal.create(() => {\n const modal = useModal();\n return (\n modal.hide()}\n TransitionProps={{\n onExited: () => modal.remove(),\n }}\n >\n {\"Use Google's location service?\"}\n \n \n Let Google help apps determine location. This means sending anonymous location data to Google, even when no\n apps are running.\n \n \n \n \n \n \n \n );\n});\n\nexport default function MuiDialogSample() {\n return (\n \n );\n}\n","MyBootstrapDialog.tsx":"import BootstrapModal from 'react-bootstrap/Modal';\nimport Button from 'react-bootstrap/Button';\nimport NiceModal, { useModal, bootstrapDialog } from '@ebay/nice-modal-react';\n\nconst MyBootstrapDialog = NiceModal.create(({ name = 'Bootstrap' }: { name: string }) => {\n const modal = useModal();\n return (\n \n \n Modal title\n \n\n \n

    Modal body text goes here. {name}

    \n
    \n\n \n \n \n \n
    \n );\n});\nexport default function BootstrapSample() {\n return (\n <>\n \n \n );\n}\n","ReduxIntegration.jsx":"import { createStore, applyMiddleware, compose, combineReducers } from 'redux';\nimport { Provider, useSelector, useDispatch } from 'react-redux';\nimport NiceModal from '@ebay/nice-modal-react';\nimport { Button } from 'antd';\nimport { MyAntdModal } from './MyAntdModal';\nimport logger from 'redux-logger';\n\nconst composeEnhancers = (typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) || compose;\nconst enhancer = composeEnhancers(applyMiddleware(logger));\n\nconst store = createStore(\n combineReducers({\n __nice_modals: NiceModal.reducer,\n // other reducers...\n }),\n enhancer,\n);\n\nconst ModalsProvider = ({ children }) => {\n const modals = useSelector((s) => s.__nice_modals);\n const dispatch = useDispatch();\n return (\n \n

    NOTE: open dev console or Redux dev tools to see actions log.

    \n {\n NiceModal.show(MyAntdModal, { name: 'Redux' });\n }}\n >\n Show Modal\n \n
    \n );\n};\n\nexport default function ReduxIntegration({ children }) {\n return (\n \n {children}\n \n );\n}\n","Declarative.jsx":"import { Modal, Button } from 'antd';\nimport NiceModal, { useModal, ModalDef } from '@ebay/nice-modal-react';\n\nexport const MyAntdModal = NiceModal.create(({ name }) => {\n const modal = useModal();\n return (\n \n Greetings: {name}!\n \n );\n});\n\nexport default function AntdSample() {\n return (\n <>\n \n \n \n );\n}\n","PropsBinding.jsx":"import { useEffect, useState } from 'react';\nimport { Modal, Button } from 'antd';\nimport NiceModal, { useModal, ModalHolder } from '@ebay/nice-modal-react';\n\nexport const MyAntdModal = NiceModal.create(({ time }) => {\n const modal = useModal();\n return (\n \n Time: {time}\n \n );\n});\n\nexport default function Example() {\n const [time, setTime] = useState(0);\n useEffect(() => {\n const p = setInterval(() => setTime((t) => t + 1), 1000);\n return () => clearInterval(p);\n }, []);\n\n // modalHandler will be assign show/hide method.\n const modalHandler = {};\n\n return (\n <>\n \n \n \n );\n}\n"};function F(e){var n=e.filename;return Object(t.useEffect)((function(){window.Prism.highlightAll()}),[n]),Object(_.jsxs)("div",{className:"code-viewer",children:[Object(_.jsx)("h5",{children:n}),Object(_.jsx)("pre",{children:Object(_.jsx)("code",{className:"language-jsx line-numbers",children:H[n]||'// Error: code of "'.concat(n,'" not found')})})]})}var L=o(34),G=o(178),V=o(37),J=o(374),K=o(375),X=o(376),q=o(379),z=o(208),Q=R.create((function(e){var n=e.user,o=C(),r=X.a.useForm(),a=Object(U.a)(r,1)[0],i={initialValues:n,fields:[{key:"name",label:"Name",required:!0},{key:"job",label:"Job Title",required:!0}]},l=Object(t.useCallback)((function(){a.validateFields().then((function(){var e=Object(L.a)({},a.getFieldsValue());e.id=n?n.id:String(Date.now()),o.resolve(e),o.hide()}))}),[o,n,a]);return Object(_.jsx)(q.a,Object(L.a)(Object(L.a)({},D(o)),{},{title:n?"Edit User":"New User",okText:n?"Update":"Create",onOk:l,children:Object(_.jsx)(X.a,{form:a,children:Object(_.jsx)(z.a,{meta:i,form:a})})}))})),W=[{id:"1",name:"Kennedy",job:"Chief Mobility Orchestrator",city:"North Alec"},{id:"2",name:"Lucius",job:"Internal Research Manager",city:"Littleland"},{id:"3",name:"Carlos",job:"Lead Configuration Analyst",city:"South Lillian"},{id:"4",name:"Urban",job:"Chief Operations Agent",city:"Shieldshaven"},{id:"5",name:"Katrine",job:"Legacy Solutions Orchestrator",city:"South Kyleigh"}];o(337);var Y=o(177),Z=o.n(Y),$=o(206),ee=o(381),ne=R.create((function(e){var n=e.name,o=C();return Object(_.jsxs)(q.a,Object(L.a)(Object(L.a)({title:"Promise Example"},D(o)),{},{children:[Object(_.jsxs)("p",{children:["Choose the promise action: ",n]}),Object(_.jsxs)(ee.b,{children:[Object(_.jsx)(V.a,{onClick:function(){o.resolve({resolved:!0})},children:"Resolve"}),Object(_.jsx)(V.a,{onClick:function(){o.reject(new Error("Rejected")),o.hide()},danger:!0,children:"Reject"})]})]}))})),oe=R.create((function(e){var n=e.times,o=C();return Object(_.jsxs)(q.a,Object(L.a)(Object(L.a)({title:"Chaining Same Modal Example"},D(o)),{},{children:[Object(_.jsx)(V.a,{type:"primary",onClick:function(){return o.resolve()},children:"Hide with resolve."}),Object(_.jsx)("br",{}),Object(_.jsx)("br",{}),"Showed ",n,"/3 times."]}))}));var te=R.create((function(e){var n=e.name,o=C();return Object(_.jsxs)(q.a,{title:"Hello Antd",visible:o.visible,onOk:o.hide,onCancel:o.hide,afterClose:o.remove,children:["Greetings: ",n,"!"]})}));var re=o(378),ae=o(377),ie=o(373),le=o(371),ce=o(372),de=o(370),se=o(382),ue=r.a.forwardRef((function(e,n){return Object(_.jsx)(se.a,Object(L.a)({direction:"up",ref:n},e))})),me=R.create((function(){var e=C();return Object(_.jsxs)(ae.a,{TransitionComponent:ue,open:e.visible,onClose:function(){return e.hide()},TransitionProps:{onExited:function(){return e.remove()}},children:[Object(_.jsx)(de.a,{id:"alert-dialog-slide-title",children:"Use Google's location service?"}),Object(_.jsx)(le.a,{children:Object(_.jsx)(ce.a,{id:"alert-dialog-slide-description",children:"Let Google help apps determine location. This means sending anonymous location data to Google, even when no apps are running."})}),Object(_.jsxs)(ie.a,{children:[Object(_.jsx)(re.a,{onClick:function(){return e.hide()},color:"primary",children:"Disagree"}),Object(_.jsx)(re.a,{onClick:function(){return e.hide()},color:"primary",children:"Agree"})]})]})}));var pe=o(380),he=R.create((function(e){var n=e.name,o=C();return Object(_.jsxs)(q.a,{title:"Hello Antd",visible:o.visible,onOk:o.hide,onCancel:o.hide,afterClose:o.remove,children:["Greetings: ",n,"!"]})})),fe=R.create((function(e){var n=e.name,o=C();return Object(_.jsxs)(pe.a,{title:"Hello Antd",visible:o.visible,onClose:o.hide,afterVisibleChange:function(e){e||o.remove()},children:["Greetings: ",n,"!"]})}));var be=o(98),je=o(157),ve=R.create((function(e){var n=e.name,o=void 0===n?"Bootstrap":n,t=C();return Object(_.jsxs)(be.a,Object(L.a)(Object(L.a)({},T(t)),{},{title:"Nice Modal",children:[Object(_.jsx)(be.a.Header,{closeButton:!0,children:Object(_.jsx)(be.a.Title,{children:"Modal title"})}),Object(_.jsx)(be.a.Body,{children:Object(_.jsxs)("p",{children:["Modal body text goes here. ",o]})}),Object(_.jsxs)(be.a.Footer,{children:[Object(_.jsx)(je.a,{variant:"secondary",onClick:t.hide,children:"Close"}),Object(_.jsx)(je.a,{variant:"primary",onClick:t.hide,children:"Save changes"})]})]}))}));var Me=o(112),xe=o(156),Oe=o(207),ge=o.n(Oe),ye=("undefined"!==typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__||Me.c)(Object(Me.a)(ge.a)),we=Object(Me.d)(Object(Me.b)({__nice_modals:R.reducer}),ye),Ce=function(e){e.children;var n=Object(xe.c)((function(e){return e.__nice_modals})),o=Object(xe.b)();return Object(_.jsxs)(R.Provider,{modals:n,dispatch:o,children:[Object(_.jsx)("p",{style:{color:"#999"},children:"NOTE: open dev console or Redux dev tools to see actions log."}),Object(_.jsx)(V.a,{type:"primary",onClick:function(){R.show(he,{name:"Redux"})},children:"Show Modal"})]})};var ke=R.create((function(e){var n=e.time,o=C();return Object(_.jsxs)(q.a,{title:"Props Binding",visible:o.visible,onOk:o.hide,onCancel:o.hide,afterClose:o.remove,children:["Time: ",n]})}));var Be={real:{name:"Real Case",component:function(){var e=C(Q),n=Object(t.useState)(W),o=Object(U.a)(n,2),r=o[0],a=o[1],i=Object(t.useCallback)((function(){e.show().then((function(e){a([e].concat(Object(G.a)(r)))}))}),[e,r]),l=Object(t.useCallback)((function(n){e.show({user:n}).then((function(e){a((function(n){var o=n.findIndex((function(n){return n.id===e.id})),t=Object(L.a)(Object(L.a)({},n[o]),e),r=Object(G.a)(n);return r.splice(o,1,t),r}))}))}),[e]),c=Object(t.useMemo)((function(){return[{title:"Name",dataIndex:"name",width:"150px"},{title:"Job Title",dataIndex:"job"},{title:"Edit",width:"100px",render:function(e,n){return Object(_.jsx)(V.a,{type:"link",icon:Object(_.jsx)(K.a,{}),onClick:function(){l(n)}})}}]}),[l]);return Object(_.jsxs)("div",{children:[Object(_.jsx)(V.a,{type:"primary",onClick:i,children:"+ New User"}),Object(_.jsx)(J.a,{size:"small",rowKey:"id",pagination:!1,columns:c,dataSource:r,style:{marginTop:"20px"}})]})},description:"Show a dialog to create a new user or edit user info.",code:["UserList.jsx","UserInfoModal.jsx"]},mui:{name:"Material UI",description:"Show material UI dialog",component:function(){return Object(_.jsx)(re.a,{variant:"contained",onClick:function(){return R.show(me)},color:"primary",children:"Agree"})},code:["MyMuiDialog.tsx"]},antd:{name:"Ant Design",description:"Show/hide antd modal or drawer.",component:function(){return Object(_.jsxs)(ee.b,{children:[Object(_.jsx)(V.a,{type:"primary",onClick:function(){return R.show(he,{name:"Nate"})},children:"Show Modal"}),Object(_.jsx)(V.a,{type:"primary",onClick:function(){return R.show(fe,{name:"Bood"})},children:"Show Drawer"})]})},code:["MyAntdModal.tsx"]},bootstrap:{name:"Bootstrap React",descript:"Show/hide bootstrap dialog.",component:function(){return Object(_.jsx)(_.Fragment,{children:Object(_.jsx)(je.a,{variant:"primary",onClick:function(){return R.show(ve,{name:"Bootstrap"})},children:"Show Dialog"})})},code:["MyBootstrapDialog.tsx"]},promise:{name:"Promise",description:"Use promise to interact with the dialog.",component:function(){var e=C(oe),n=function(){var n=Object($.a)(Z.a.mark((function n(){var o;return Z.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:o=0;case 1:if(!(o<3)){n.next=9;break}return n.next=4,e.show({times:o+1});case 4:return n.next=6,e.hide();case 6:o++,n.next=1;break;case 9:case"end":return n.stop()}}),n)})));return function(){return n.apply(this,arguments)}}();return Object(_.jsxs)(_.Fragment,{children:[Object(_.jsx)("p",{style:{color:"#888"},children:"NOTE: please open dev console to see the output."}),Object(_.jsxs)(ee.b,{children:[Object(_.jsx)(V.a,{type:"primary",onClick:function(){R.show(ne,{name:"nate"}).then((function(e){console.log("Resolved: ",e),R.show(ne,{name:"nate2"})})).catch((function(e){console.log("Rejected: ",e)}))},children:"Show Modal"}),Object(_.jsx)(V.a,{type:"primary",onClick:n,children:"Chaining Same Modal"})]})]})},code:["PromiseSample.jsx"]},declarative:{name:"Declarative",description:"Declarative way to register a modal with id.",component:function(){return Object(_.jsxs)(_.Fragment,{children:[Object(_.jsx)(V.a,{type:"primary",onClick:function(){return R.show("my-antd-modal",{name:"Nate"})},children:"Show Modal"}),Object(_.jsx)(S,{id:"my-antd-modal",component:te})]})},code:["Declarative.jsx"]},propsBinding:{name:"Props Binding",description:"To bind props to modal, need to declare the modal using .",component:function(){var e=Object(t.useState)(0),n=Object(U.a)(e,2),o=n[0],r=n[1];Object(t.useEffect)((function(){var e=setInterval((function(){return r((function(e){return e+1}))}),1e3);return function(){return clearInterval(e)}}),[]);var a={};return Object(_.jsxs)(_.Fragment,{children:[Object(_.jsx)(V.a,{type:"primary",onClick:function(){return a.show()},children:"Show Modal"}),Object(_.jsx)(E,{modal:ke,handler:a,time:o})]})},code:["PropsBinding.jsx"]},redux:{name:"Redux Integration",description:"Use Redux to manage modals state so that you can use Redux dev tools to debug nice modals.",component:function(e){var n=e.children;return Object(_.jsx)(xe.a,{store:we,children:Object(_.jsx)(Ce,{children:n})})},code:["ReduxIntegration.jsx"]}};var Ne=function(){var e,n=A()||"real",o=Be[n]||{},t=Object(_.jsxs)("div",{className:"app",children:[Object(_.jsxs)("div",{className:"sider",children:[Object(_.jsxs)("h1",{children:[Object(_.jsx)("span",{className:"header-name",children:"@ebay/nice-modal-react"}),Object(_.jsx)("span",{className:"example-title",children:"Examples"})]}),Object(_.jsx)("div",{className:"scroll-container",children:Object(_.jsx)("ul",{children:Object.keys(Be).map((function(e){return Object(_.jsx)("li",{children:Object(_.jsx)("a",{href:"#".concat(e),className:n===e?"active":"",children:Be[e].name})},e)}))})}),Object(_.jsxs)("div",{className:"social",children:[Object(_.jsx)("a",{href:"https://github.com/ebay/nice-modal-react",children:Object(_.jsx)("img",{src:"https://img.shields.io/github/stars/eBay/nice-modal-react?style=social",alt:"Github Repo"})}),Object(_.jsx)("br",{}),Object(_.jsx)("a",{href:"https://ebay.github.io/nice-modal-react/api",children:Object(_.jsx)("img",{src:"https://img.shields.io/badge/API-Reference-green",alt:"api reference"})}),Object(_.jsx)("br",{}),Object(_.jsx)("a",{href:"https://codesandbox.io/s/github/ebay/nice-modal-react/tree/main/example",children:Object(_.jsx)("img",{width:"150px",src:"https://codesandbox.io/static/img/play-codesandbox.svg",alt:"codesandbox"})})]})]}),Object(_.jsxs)("div",{children:[Object(_.jsx)("div",{className:"example-container",children:function(){var e=Be[n];if(!e||!e.component)return Object(_.jsxs)("span",{style:{color:"red"},children:['Error: example "',n,'" not found.']});var o=e.component;return Object(_.jsxs)(_.Fragment,{children:[Object(_.jsxs)("h1",{children:[e.name,Object(_.jsx)("p",{className:"example-description",children:e.description})]}),Object(_.jsx)(o,{})]})}()}),Object(_.jsx)("div",{className:"code-container",children:null===(e=o.code)||void 0===e?void 0:e.map((function(e){return Object(_.jsx)(F,{filename:e},e)}))})]})]});return"redux"===n?t:Object(_.jsx)(R.Provider,{children:t})},Se=function(e){e&&e instanceof Function&&o.e(3).then(o.bind(null,383)).then((function(n){var o=n.getCLS,t=n.getFID,r=n.getFCP,a=n.getLCP,i=n.getTTFB;o(e),t(e),r(e),a(e),i(e)}))};o(339),o(340);i.a.render(Object(_.jsx)(Ne,{}),document.getElementById("root")),Se()}},[[341,1,2]]]); +//# sourceMappingURL=main.6645edd4.chunk.js.map \ No newline at end of file diff --git a/docs/static/js/main.6645edd4.chunk.js.map b/docs/static/js/main.6645edd4.chunk.js.map new file mode 100644 index 0000000..6ce1b1c --- /dev/null +++ b/docs/static/js/main.6645edd4.chunk.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/index.tsx","useHash.js","CodeViewer.jsx","webpack:///./src/MyAntdModal.tsx?80f2","webpack:///./src/UserInfoModal.jsx?3e7a","webpack:///./src/UserList.jsx?90fc","webpack:///./src/PromiseSample.jsx?a91c","webpack:///./src/MyMuiDialog.tsx?55e3","webpack:///./src/MyBootstrapDialog.tsx?9fa1","webpack:///./src/ReduxIntegration.jsx?f440","webpack:///./src/Declarative.jsx?88cb","webpack:///./src/PropsBinding.jsx?ac2d","UserInfoModal.jsx","mock.js","PromiseSample.jsx","Declarative.jsx","MyMuiDialog.tsx","MyAntdModal.tsx","MyBootstrapDialog.tsx","ReduxIntegration.jsx","PropsBinding.jsx","App.jsx","UserList.jsx","reportWebVitals.ts","index.tsx"],"names":["modal","getHash","document","location","hash","replace","useHash","useState","setHash","useEffect","handleHashChange","window","scrollTo","top","addEventListener","removeEventListener","codeMap","CodeViewer","filename","Prism","highlightAll","className","NiceModal","create","user","useModal","Form","useForm","form","meta","initialValues","fields","key","label","required","handleSubmit","useCallback","validateFields","then","newUser","getFieldsValue","id","String","Date","now","resolve","hide","antdModal","title","okText","onOk","data","name","job","city","PromiseModal","onClick","resolved","reject","Error","danger","ChainingModal","times","type","MyAntdModal","visible","onCancel","afterClose","remove","Transition","React","forwardRef","props","ref","Slide","direction","MyMuiDialog","Dialog","TransitionComponent","open","onClose","TransitionProps","onExited","DialogTitle","DialogContent","DialogContentText","DialogActions","Button","color","MyAntdDrawer","afterVisibleChange","MyBootstrapDialog","bootstrapDialog","Header","closeButton","Title","Body","Footer","variant","enhancer","__REDUX_DEVTOOLS_EXTENSION_COMPOSE__","compose","applyMiddleware","logger","store","createStore","combineReducers","__nice_modals","reducer","ModalsProvider","children","modals","useSelector","s","dispatch","useDispatch","Provider","style","show","time","examples","real","component","userModal","UserInfoModal","mockData","users","setUsers","handleNewUser","handleEditUser","i","findIndex","u","updated","arr","splice","columns","useMemo","dataIndex","width","render","value","icon","EditOutlined","size","rowKey","pagination","dataSource","marginTop","description","code","mui","antd","bootstrap","descript","promise","chainingModal","showChainingModal","a","res","console","log","catch","err","declarative","propsBinding","setTime","p","setInterval","t","clearInterval","modalHandler","handler","redux","App","current","example","ele","Object","keys","map","href","src","alt","item","Comp","renderExample","f","reportWebVitals","onPerfEntry","Function","getCLS","getFID","getFCP","getLCP","getTTFB","ReactDOM","getElementById"],"mappings":"kuBAyFM,EAAa,OAAO,eACpB,EAA+B,GACxB,EAAmB,IAAM,cAA8B,GAC9D,EAAqB,IAAM,cAA6B,MACxD,EAKF,GACE,EAAkB,GAEpB,EAAU,EACV,EAA4C,WAC9C,MAAM,IAAI,MAAM,+EACjB,EACK,EAAS,WAAM,qBAAe,GAAW,EAGlC,EAAU,SACrB,EACA,G,UAEA,YAHA,QAAI,EAAJ,GAGQ,EAAO,MACb,IAAK,kBACG,MAAoB,EAAO,QAAzB,EAAO,UAAE,EAAI,OACrB,cACK,KAAK,MACP,GAAO,OACH,EAAM,IAAQ,CACjB,GAAI,EACJ,KAAI,EAIJ,UAAW,EAAgB,GAC3B,cAAe,EAAgB,KAAQ,IAI7C,IAAK,kBAEH,OAAK,EADG,EAAY,EAAO,QAAZ,SAEf,OACK,KAAK,MACP,GAAO,OACH,EAAM,IAAQ,CACjB,SAAS,IAAK,IALU,EAS1B,IAAC,oBACK,EAAY,EAAO,QAAZ,QAAP,IACF,EAAQ,KAAQ,GAEtB,cADO,EAAS,GACT,EAEL,IAAC,uBACG,MAAqB,EAAO,QAAjB,GAAT,EAAO,UAAO,SACtB,cACK,KAAK,MACP,GAAO,OACH,EAAM,IACN,GAAK,IAId,QACE,OAAO,EAEZ,EAgDD,IAAM,EAAqC,GACrC,EAAyC,GACzC,EAAa,SAACA,GAChB,MAAmB,kBAAV,EAA2B,GACjC,EAAM,KACT,EAAM,GAAc,KAEf,EAAM,GACd,EAeK,SAAU,EACd,EACA,GAEE,IAAI,EAAU,EAAW,GAMzB,GALmB,kBAAV,GAAuB,EAAe,IAC3C,EAAK,EAAS,GAGlB,EAxEJ,SAAmB,EAAiB,GAChC,MAA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645edd4.chunk.js","sourcesContent":["/* *********************************************************\n * Copyright 2021 eBay Inc.\n\n * Use of this source code is governed by an MIT-style\n * license that can be found in the LICENSE file or at\n * https://opensource.org/licenses/MIT.\n*********************************************************** */\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/**\n * @module NiceModal\n * */\nimport React, { useEffect, useCallback, useContext, useReducer, useMemo } from 'react';\nvar symModalId = Symbol('NiceModalId');\nvar initialState = {};\nexport var NiceModalContext = React.createContext(initialState);\nvar NiceModalIdContext = React.createContext(null);\nvar MODAL_REGISTRY = {};\nvar ALREADY_MOUNTED = {};\nvar uidSeed = 0;\nvar dispatch = function () {\n throw new Error('No dispatch method detected, did you embed your app with NiceModal.Provider?');\n};\nvar getUid = function () { return \"_nice_modal_\" + uidSeed++; };\n// Modal reducer used in useReducer hook.\nexport var reducer = function (state, action) {\n var _a, _b, _c;\n if (state === void 0) { state = initialState; }\n switch (action.type) {\n case 'nice-modal/show': {\n var _d = action.payload, modalId = _d.modalId, args = _d.args;\n return __assign(__assign({}, state), (_a = {}, _a[modalId] = __assign(__assign({}, state[modalId]), { id: modalId, args: args, \n // If modal is not mounted, mount it first then make it visible.\n // There is logic inside HOC wrapper to make it visible after its first mount.\n // This mechanism ensures the entering transition.\n visible: !!ALREADY_MOUNTED[modalId], delayVisible: !ALREADY_MOUNTED[modalId] }), _a));\n }\n case 'nice-modal/hide': {\n var modalId = action.payload.modalId;\n if (!state[modalId])\n return state;\n return __assign(__assign({}, state), (_b = {}, _b[modalId] = __assign(__assign({}, state[modalId]), { visible: false }), _b));\n }\n case 'nice-modal/remove': {\n var modalId = action.payload.modalId;\n var newState = __assign({}, state);\n delete newState[modalId];\n return newState;\n }\n case 'nice-modal/set-flags': {\n var _e = action.payload, modalId = _e.modalId, flags = _e.flags;\n return __assign(__assign({}, state), (_c = {}, _c[modalId] = __assign(__assign({}, state[modalId]), flags), _c));\n }\n default:\n return state;\n }\n};\n// Get modal component by modal id\nfunction getModal(modalId) {\n var _a;\n return (_a = MODAL_REGISTRY[modalId]) === null || _a === void 0 ? void 0 : _a.comp;\n}\n// action creator to show a modal\nfunction showModal(modalId, args) {\n return {\n type: 'nice-modal/show',\n payload: {\n modalId: modalId,\n args: args,\n },\n };\n}\n// action creator to set flags of a modal\nfunction setModalFlags(modalId, flags) {\n return {\n type: 'nice-modal/set-flags',\n payload: {\n modalId: modalId,\n flags: flags,\n },\n };\n}\n// action creator to hide a modal\nfunction hideModal(modalId) {\n return {\n type: 'nice-modal/hide',\n payload: {\n modalId: modalId,\n },\n };\n}\n// action creator to remove a modal\nfunction removeModal(modalId) {\n return {\n type: 'nice-modal/remove',\n payload: {\n modalId: modalId,\n },\n };\n}\nvar modalCallbacks = {};\nvar hideModalCallbacks = {};\nvar getModalId = function (modal) {\n if (typeof modal === 'string')\n return modal;\n if (!modal[symModalId]) {\n modal[symModalId] = getUid();\n }\n return modal[symModalId];\n};\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function show(modal, args) {\n var modalId = getModalId(modal);\n if (typeof modal !== 'string' && !MODAL_REGISTRY[modalId]) {\n register(modalId, modal);\n }\n dispatch(showModal(modalId, args));\n if (!modalCallbacks[modalId]) {\n // `!` tell ts that theResolve will be written before it is used\n var theResolve_1;\n // `!` tell ts that theResolve will be written before it is used\n var theReject_1;\n var promise = new Promise(function (resolve, reject) {\n theResolve_1 = resolve;\n theReject_1 = reject;\n });\n modalCallbacks[modalId] = {\n resolve: theResolve_1,\n reject: theReject_1,\n promise: promise,\n };\n }\n return modalCallbacks[modalId].promise;\n}\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function hide(modal) {\n var modalId = getModalId(modal);\n dispatch(hideModal(modalId));\n // Should also delete the callback for modal.resolve #35\n delete modalCallbacks[modalId];\n if (!hideModalCallbacks[modalId]) {\n // `!` tell ts that theResolve will be written before it is used\n var theResolve_2;\n // `!` tell ts that theResolve will be written before it is used\n var theReject_2;\n var promise = new Promise(function (resolve, reject) {\n theResolve_2 = resolve;\n theReject_2 = reject;\n });\n hideModalCallbacks[modalId] = {\n resolve: theResolve_2,\n reject: theReject_2,\n promise: promise,\n };\n }\n return hideModalCallbacks[modalId].promise;\n}\nexport var remove = function (modal) {\n var modalId = getModalId(modal);\n dispatch(removeModal(modalId));\n delete modalCallbacks[modalId];\n delete hideModalCallbacks[modalId];\n};\nvar setFlags = function (modalId, flags) {\n dispatch(setModalFlags(modalId, flags));\n};\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function useModal(modal, args) {\n var modals = useContext(NiceModalContext);\n var contextModalId = useContext(NiceModalIdContext);\n var modalId = null;\n var isUseComponent = modal && typeof modal !== 'string';\n if (!modal) {\n modalId = contextModalId;\n }\n else {\n modalId = getModalId(modal);\n }\n // Only if contextModalId doesn't exist\n if (!modalId)\n throw new Error('No modal id found in NiceModal.useModal.');\n var mid = modalId;\n // If use a component directly, register it.\n useEffect(function () {\n if (isUseComponent && !MODAL_REGISTRY[mid]) {\n register(mid, modal, args);\n }\n }, [isUseComponent, mid, modal, args]);\n var modalInfo = modals[mid];\n var showCallback = useCallback(function (args) { return show(mid, args); }, [mid]);\n var hideCallback = useCallback(function () { return hide(mid); }, [mid]);\n var removeCallback = useCallback(function () { return remove(mid); }, [mid]);\n var resolveCallback = useCallback(function (args) {\n var _a;\n (_a = modalCallbacks[mid]) === null || _a === void 0 ? void 0 : _a.resolve(args);\n delete modalCallbacks[mid];\n }, [mid]);\n var rejectCallback = useCallback(function (args) {\n var _a;\n (_a = modalCallbacks[mid]) === null || _a === void 0 ? void 0 : _a.reject(args);\n delete modalCallbacks[mid];\n }, [mid]);\n var resolveHide = useCallback(function (args) {\n var _a;\n (_a = hideModalCallbacks[mid]) === null || _a === void 0 ? void 0 : _a.resolve(args);\n delete hideModalCallbacks[mid];\n }, [mid]);\n return useMemo(function () { return ({\n id: mid,\n args: modalInfo === null || modalInfo === void 0 ? void 0 : modalInfo.args,\n visible: !!(modalInfo === null || modalInfo === void 0 ? void 0 : modalInfo.visible),\n keepMounted: !!(modalInfo === null || modalInfo === void 0 ? void 0 : modalInfo.keepMounted),\n show: showCallback,\n hide: hideCallback,\n remove: removeCallback,\n resolve: resolveCallback,\n reject: rejectCallback,\n resolveHide: resolveHide,\n }); }, [\n mid,\n modalInfo === null || modalInfo === void 0 ? void 0 : modalInfo.args,\n modalInfo === null || modalInfo === void 0 ? void 0 : modalInfo.visible,\n modalInfo === null || modalInfo === void 0 ? void 0 : modalInfo.keepMounted,\n showCallback,\n hideCallback,\n removeCallback,\n resolveCallback,\n rejectCallback,\n resolveHide,\n ]);\n}\nexport var create = function (Comp) {\n return function (_a) {\n var _b;\n var defaultVisible = _a.defaultVisible, keepMounted = _a.keepMounted, id = _a.id, props = __rest(_a, [\"defaultVisible\", \"keepMounted\", \"id\"]);\n var _c = useModal(id), args = _c.args, show = _c.show;\n // If there's modal state, then should mount it.\n var modals = useContext(NiceModalContext);\n var shouldMount = !!modals[id];\n useEffect(function () {\n // If defaultVisible, show it after mounted.\n if (defaultVisible) {\n show();\n }\n ALREADY_MOUNTED[id] = true;\n return function () {\n delete ALREADY_MOUNTED[id];\n };\n }, [id, show, defaultVisible]);\n useEffect(function () {\n if (keepMounted)\n setFlags(id, { keepMounted: true });\n }, [id, keepMounted]);\n var delayVisible = (_b = modals[id]) === null || _b === void 0 ? void 0 : _b.delayVisible;\n // If modal.show is called\n // 1. If modal was mounted, should make it visible directly\n // 2. If modal has not been mounted, should mount it first, then make it visible\n useEffect(function () {\n if (delayVisible) {\n // delayVisible: false => true, it means the modal.show() is called, should show it.\n show(args);\n }\n }, [delayVisible, args, show]);\n if (!shouldMount)\n return null;\n return (React.createElement(NiceModalIdContext.Provider, { value: id },\n React.createElement(Comp, __assign({}, props, args))));\n };\n};\n// All registered modals will be rendered in modal placeholder\nexport var register = function (id, comp, props) {\n if (!MODAL_REGISTRY[id]) {\n MODAL_REGISTRY[id] = { comp: comp, props: props };\n }\n else {\n MODAL_REGISTRY[id].props = props;\n }\n};\n/**\n * Unregister a modal.\n * @param id - The id of the modal.\n */\nexport var unregister = function (id) {\n delete MODAL_REGISTRY[id];\n};\n// The placeholder component is used to auto render modals when call modal.show()\n// When modal.show() is called, it means there've been modal info\nvar NiceModalPlaceholder = function () {\n var modals = useContext(NiceModalContext);\n var visibleModalIds = Object.keys(modals).filter(function (id) { return !!modals[id]; });\n visibleModalIds.forEach(function (id) {\n if (!MODAL_REGISTRY[id] && !ALREADY_MOUNTED[id]) {\n console.warn(\"No modal found for id: \" + id + \". Please check the id or if it is registered or declared via JSX.\");\n return;\n }\n });\n var toRender = visibleModalIds\n .filter(function (id) { return MODAL_REGISTRY[id]; })\n .map(function (id) { return (__assign({ id: id }, MODAL_REGISTRY[id])); });\n return (React.createElement(React.Fragment, null, toRender.map(function (t) { return (React.createElement(t.comp, __assign({ key: t.id, id: t.id }, t.props))); })));\n};\nvar InnerContextProvider = function (_a) {\n var children = _a.children;\n var arr = useReducer(reducer, initialState);\n var modals = arr[0];\n dispatch = arr[1];\n return (React.createElement(NiceModalContext.Provider, { value: modals },\n children,\n React.createElement(NiceModalPlaceholder, null)));\n};\nexport var Provider = function (_a) {\n var children = _a.children, givenDispatch = _a.dispatch, givenModals = _a.modals;\n if (!givenDispatch || !givenModals) {\n return React.createElement(InnerContextProvider, null, children);\n }\n dispatch = givenDispatch;\n return (React.createElement(NiceModalContext.Provider, { value: givenModals },\n children,\n React.createElement(NiceModalPlaceholder, null)));\n};\n/**\n * Declarative way to register a modal.\n * @param id - The id of the modal.\n * @param component - The modal Component.\n * @returns\n */\nexport var ModalDef = function (_a) {\n var id = _a.id, component = _a.component;\n useEffect(function () {\n register(id, component);\n return function () {\n unregister(id);\n };\n }, [id, component]);\n return null;\n};\n/**\n * A place holder allows to bind props to a modal.\n * It assigns show/hide methods to handler object to show/hide the modal.\n *\n * Comparing to use the directly, this approach allows use registered modal id to find the modal component.\n * Also it avoids to create unique id for MyNiceModal.\n *\n * @param modal - The modal id registered or a modal component.\n * @param handler - The handler object to control the modal.\n * @returns\n */\nexport var ModalHolder = function (_a) {\n var _b;\n var modal = _a.modal, _c = _a.handler, handler = _c === void 0 ? {} : _c, restProps = __rest(_a, [\"modal\", \"handler\"]);\n var mid = useMemo(function () { return getUid(); }, []);\n var ModalComp = typeof modal === 'string' ? (_b = MODAL_REGISTRY[modal]) === null || _b === void 0 ? void 0 : _b.comp : modal;\n if (!handler) {\n throw new Error('No handler found in NiceModal.ModalHolder.');\n }\n if (!ModalComp) {\n throw new Error(\"No modal found for id: \" + modal + \" in NiceModal.ModalHolder.\");\n }\n handler.show = useCallback(function (args) { return show(mid, args); }, [mid]);\n handler.hide = useCallback(function () { return hide(mid); }, [mid]);\n return React.createElement(ModalComp, __assign({ id: mid }, restProps));\n};\nexport var antdModal = function (modal) {\n return {\n visible: modal.visible,\n onOk: function () { return modal.hide(); },\n onCancel: function () { return modal.hide(); },\n afterClose: function () {\n // Need to resolve before remove\n modal.resolveHide();\n if (!modal.keepMounted)\n modal.remove();\n },\n };\n};\nexport var antdModalV5 = function (modal) {\n var _a = antdModal(modal), onOk = _a.onOk, onCancel = _a.onCancel, afterClose = _a.afterClose;\n return {\n open: modal.visible,\n onOk: onOk,\n onCancel: onCancel,\n afterClose: afterClose,\n };\n};\nexport var antdDrawer = function (modal) {\n return {\n visible: modal.visible,\n onClose: function () { return modal.hide(); },\n afterVisibleChange: function (v) {\n if (!v) {\n modal.resolveHide();\n }\n !v && !modal.keepMounted && modal.remove();\n },\n };\n};\nexport var antdDrawerV5 = function (modal) {\n var _a = antdDrawer(modal), onClose = _a.onClose, afterOpenChange = _a.afterVisibleChange;\n return {\n open: modal.visible,\n onClose: onClose,\n afterOpenChange: afterOpenChange,\n };\n};\nexport var muiDialog = function (modal) {\n return {\n open: modal.visible,\n onClose: function () { return modal.hide(); },\n onExited: function () {\n modal.resolveHide();\n !modal.keepMounted && modal.remove();\n },\n };\n};\nexport var muiDialogV5 = function (modal) {\n return {\n open: modal.visible,\n onClose: function () { return modal.hide(); },\n TransitionProps: {\n onExited: function () {\n modal.resolveHide();\n !modal.keepMounted && modal.remove();\n },\n },\n };\n};\nexport var bootstrapDialog = function (modal) {\n return {\n show: modal.visible,\n onHide: function () { return modal.hide(); },\n onExited: function () {\n modal.resolveHide();\n !modal.keepMounted && modal.remove();\n },\n };\n};\nvar NiceModal = {\n Provider: Provider,\n ModalDef: ModalDef,\n ModalHolder: ModalHolder,\n NiceModalContext: NiceModalContext,\n create: create,\n register: register,\n getModal: getModal,\n show: show,\n hide: hide,\n remove: remove,\n useModal: useModal,\n reducer: reducer,\n antdModal: antdModal,\n antdDrawer: antdDrawer,\n muiDialog: muiDialog,\n bootstrapDialog: bootstrapDialog,\n};\nexport default NiceModal;\n//# sourceMappingURL=index.js.map","import { useEffect, useState } from 'react';\n\nconst getHash = () => document.location.hash.replace('#', '');\n\nconst useHash = () => {\n const [hash, setHash] = useState(getHash());\n useEffect(() => {\n function handleHashChange() {\n const hash = getHash() || 'basic';\n setHash(hash);\n window.scrollTo({ top: 0 });\n }\n window.addEventListener('hashchange', handleHashChange);\n return () => {\n window.removeEventListener('hashchange', handleHashChange);\n };\n }, [setHash]);\n return hash;\n};\n\nexport default useHash;\n","/* eslint import/no-webpack-loader-syntax: off */\n\nimport React, { useEffect } from 'react';\nimport codeAntd from '!!raw-loader!./MyAntdModal.tsx';\nimport codeUserList from '!!raw-loader!./UserList.jsx';\nimport codeUserInfoModal from '!!raw-loader!./UserInfoModal.jsx';\nimport codePromiseSample from '!!raw-loader!./PromiseSample.jsx';\nimport codeMyMuiDialog from '!!raw-loader!./MyMuiDialog.tsx';\nimport codeMyBootstrapDialog from '!!raw-loader!./MyBootstrapDialog.tsx';\nimport codeReduxIntegration from '!!raw-loader!./ReduxIntegration.jsx';\nimport codeDeclarative from '!!raw-loader!./Declarative.jsx';\nimport codePropsBinding from '!!raw-loader!./PropsBinding.jsx';\n\nconst codeMap = {\n 'MyAntdModal.tsx': codeAntd,\n 'UserInfoModal.jsx': codeUserInfoModal,\n 'UserList.jsx': codeUserList,\n 'PromiseSample.jsx': codePromiseSample,\n 'MyMuiDialog.tsx': codeMyMuiDialog,\n 'MyBootstrapDialog.tsx': codeMyBootstrapDialog,\n 'ReduxIntegration.jsx': codeReduxIntegration,\n 'Declarative.jsx': codeDeclarative,\n 'PropsBinding.jsx': codePropsBinding,\n};\nexport default function CodeViewer({ filename }) {\n useEffect(() => {\n window.Prism.highlightAll();\n }, [filename]);\n return (\n
    \n
    {filename}
    \n
    \n        \n          {codeMap[filename] || `// Error: code of \"${filename}\" not found`}\n        \n      
    \n
    \n );\n}\n","export default \"import { Modal, Button, Drawer, Space } from 'antd';\\nimport NiceModal, { useModal } from '@ebay/nice-modal-react';\\n\\nexport const MyAntdModal = NiceModal.create(({ name }: { name: string }) => {\\n const modal = useModal();\\n return (\\n \\n Greetings: {name}!\\n \\n );\\n});\\n\\nconst MyAntdDrawer = NiceModal.create(({ name }: { name: string }) => {\\n const modal = useModal();\\n return (\\n {\\n if (!visible) modal.remove();\\n }}\\n >\\n Greetings: {name}!\\n \\n );\\n});\\n\\nexport default function AntdSample() {\\n return (\\n \\n \\n \\n \\n );\\n}\\n\";","export default \"import { useCallback } from 'react';\\nimport { Form, Modal } from 'antd';\\nimport FormBuilder from 'antd-form-builder';\\nimport NiceModal, { useModal, antdModal } from '@ebay/nice-modal-react';\\n\\nexport default NiceModal.create(({ user }) => {\\n const modal = useModal();\\n const [form] = Form.useForm();\\n const meta = {\\n initialValues: user,\\n fields: [\\n { key: 'name', label: 'Name', required: true },\\n { key: 'job', label: 'Job Title', required: true },\\n ],\\n };\\n\\n const handleSubmit = useCallback(() => {\\n form.validateFields().then(() => {\\n const newUser = { ...form.getFieldsValue() };\\n // In real case, you may call API to create user or update user\\n if (!user) {\\n newUser.id = String(Date.now());\\n } else {\\n newUser.id = user.id;\\n }\\n modal.resolve(newUser);\\n modal.hide();\\n });\\n }, [modal, user, form]);\\n return (\\n \\n
    \\n \\n \\n \\n );\\n});\\n\";","export default \"import { useMemo, useCallback, useState } from 'react';\\nimport { Button, Table } from 'antd';\\nimport { EditOutlined } from '@ant-design/icons';\\nimport { useModal } from '@ebay/nice-modal-react';\\nimport UserInfoModal from './UserInfoModal';\\nimport mockData from './mock';\\n\\nexport default function UserList() {\\n const userModal = useModal(UserInfoModal);\\n const [users, setUsers] = useState(mockData);\\n\\n const handleNewUser = useCallback(() => {\\n userModal.show().then((newUser) => {\\n setUsers([newUser, ...users]);\\n });\\n }, [userModal, users]);\\n\\n const handleEditUser = useCallback(\\n (user) => {\\n userModal.show({ user }).then((newUser) => {\\n setUsers((users) => {\\n // Modify users immutablly\\n const i = users.findIndex((u) => u.id === newUser.id);\\n const updated = { ...users[i], ...newUser };\\n const arr = [...users];\\n arr.splice(i, 1, updated);\\n return arr;\\n });\\n });\\n },\\n [userModal],\\n );\\n\\n const columns = useMemo(\\n () => [\\n {\\n title: 'Name',\\n dataIndex: 'name',\\n width: '150px',\\n },\\n {\\n title: 'Job Title',\\n dataIndex: 'job',\\n },\\n {\\n title: 'Edit',\\n width: '100px',\\n render(value, user) {\\n return (\\n }\\n onClick={() => {\\n handleEditUser(user);\\n }}\\n />\\n );\\n },\\n },\\n ],\\n [handleEditUser],\\n );\\n\\n return (\\n
    \\n \\n \\n
    \\n );\\n}\\n\";","export default \"import { Modal, Button, Space } from 'antd';\\nimport NiceModal, { useModal, antdModal } from '@ebay/nice-modal-react';\\n\\nconst PromiseModal = NiceModal.create(({ name }) => {\\n const modal = useModal();\\n const handleResolve = () => {\\n modal.resolve({ resolved: true });\\n };\\n const handleReject = () => {\\n modal.reject(new Error('Rejected'));\\n modal.hide();\\n };\\n return (\\n \\n

    Choose the promise action: {name}

    \\n \\n \\n \\n \\n
    \\n );\\n});\\n\\nconst ChainingModal = NiceModal.create(({ times }) => {\\n const modal = useModal();\\n return (\\n \\n \\n
    \\n
    \\n Showed {times}/3 times.\\n
    \\n );\\n});\\n\\nexport default function PromiseSample() {\\n const chainingModal = useModal(ChainingModal);\\n const showPromiseModal = () => {\\n NiceModal.show(PromiseModal, { name: 'nate' })\\n .then((res) => {\\n console.log('Resolved: ', res);\\n NiceModal.show(PromiseModal, { name: 'nate2' });\\n })\\n .catch((err) => {\\n console.log('Rejected: ', err);\\n });\\n };\\n const showChainingModal = async () => {\\n for (let i = 0; i < 3; i++) {\\n await chainingModal.show({ times: i + 1 });\\n await chainingModal.hide();\\n }\\n };\\n\\n return (\\n <>\\n

    NOTE: please open dev console to see the output.

    \\n \\n \\n\\n \\n \\n \\n );\\n}\\n\";","export default \"import React from 'react';\\nimport Button from '@material-ui/core/Button';\\nimport Dialog from '@material-ui/core/Dialog';\\nimport DialogActions from '@material-ui/core/DialogActions';\\nimport DialogContent from '@material-ui/core/DialogContent';\\nimport DialogContentText from '@material-ui/core/DialogContentText';\\nimport DialogTitle from '@material-ui/core/DialogTitle';\\nimport Slide from '@material-ui/core/Slide';\\nimport { TransitionProps } from '@material-ui/core/transitions';\\nimport NiceModal, { useModal } from '@ebay/nice-modal-react';\\n\\nconst Transition = React.forwardRef(function Transition(\\n props: TransitionProps & { children?: React.ReactElement },\\n ref: React.Ref,\\n) {\\n return ;\\n});\\n\\nconst MyMuiDialog = NiceModal.create(() => {\\n const modal = useModal();\\n return (\\n modal.hide()}\\n TransitionProps={{\\n onExited: () => modal.remove(),\\n }}\\n >\\n {\\\"Use Google's location service?\\\"}\\n \\n \\n Let Google help apps determine location. This means sending anonymous location data to Google, even when no\\n apps are running.\\n \\n \\n \\n \\n \\n \\n \\n );\\n});\\n\\nexport default function MuiDialogSample() {\\n return (\\n \\n );\\n}\\n\";","export default \"import BootstrapModal from 'react-bootstrap/Modal';\\nimport Button from 'react-bootstrap/Button';\\nimport NiceModal, { useModal, bootstrapDialog } from '@ebay/nice-modal-react';\\n\\nconst MyBootstrapDialog = NiceModal.create(({ name = 'Bootstrap' }: { name: string }) => {\\n const modal = useModal();\\n return (\\n \\n \\n Modal title\\n \\n\\n \\n

    Modal body text goes here. {name}

    \\n
    \\n\\n \\n \\n \\n \\n
    \\n );\\n});\\nexport default function BootstrapSample() {\\n return (\\n <>\\n \\n \\n );\\n}\\n\";","export default \"import { createStore, applyMiddleware, compose, combineReducers } from 'redux';\\nimport { Provider, useSelector, useDispatch } from 'react-redux';\\nimport NiceModal from '@ebay/nice-modal-react';\\nimport { Button } from 'antd';\\nimport { MyAntdModal } from './MyAntdModal';\\nimport logger from 'redux-logger';\\n\\nconst composeEnhancers = (typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) || compose;\\nconst enhancer = composeEnhancers(applyMiddleware(logger));\\n\\nconst store = createStore(\\n combineReducers({\\n __nice_modals: NiceModal.reducer,\\n // other reducers...\\n }),\\n enhancer,\\n);\\n\\nconst ModalsProvider = ({ children }) => {\\n const modals = useSelector((s) => s.__nice_modals);\\n const dispatch = useDispatch();\\n return (\\n \\n

    NOTE: open dev console or Redux dev tools to see actions log.

    \\n {\\n NiceModal.show(MyAntdModal, { name: 'Redux' });\\n }}\\n >\\n Show Modal\\n \\n
    \\n );\\n};\\n\\nexport default function ReduxIntegration({ children }) {\\n return (\\n \\n {children}\\n \\n );\\n}\\n\";","export default \"import { Modal, Button } from 'antd';\\nimport NiceModal, { useModal, ModalDef } from '@ebay/nice-modal-react';\\n\\nexport const MyAntdModal = NiceModal.create(({ name }) => {\\n const modal = useModal();\\n return (\\n \\n Greetings: {name}!\\n \\n );\\n});\\n\\nexport default function AntdSample() {\\n return (\\n <>\\n \\n \\n \\n );\\n}\\n\";","export default \"import { useEffect, useState } from 'react';\\nimport { Modal, Button } from 'antd';\\nimport NiceModal, { useModal, ModalHolder } from '@ebay/nice-modal-react';\\n\\nexport const MyAntdModal = NiceModal.create(({ time }) => {\\n const modal = useModal();\\n return (\\n \\n Time: {time}\\n \\n );\\n});\\n\\nexport default function Example() {\\n const [time, setTime] = useState(0);\\n useEffect(() => {\\n const p = setInterval(() => setTime((t) => t + 1), 1000);\\n return () => clearInterval(p);\\n }, []);\\n\\n // modalHandler will be assign show/hide method.\\n const modalHandler = {};\\n\\n return (\\n <>\\n \\n \\n \\n );\\n}\\n\";","import { useCallback } from 'react';\nimport { Form, Modal } from 'antd';\nimport FormBuilder from 'antd-form-builder';\nimport NiceModal, { useModal, antdModal } from '@ebay/nice-modal-react';\n\nexport default NiceModal.create(({ user }) => {\n const modal = useModal();\n const [form] = Form.useForm();\n const meta = {\n initialValues: user,\n fields: [\n { key: 'name', label: 'Name', required: true },\n { key: 'job', label: 'Job Title', required: true },\n ],\n };\n\n const handleSubmit = useCallback(() => {\n form.validateFields().then(() => {\n const newUser = { ...form.getFieldsValue() };\n // In real case, you may call API to create user or update user\n if (!user) {\n newUser.id = String(Date.now());\n } else {\n newUser.id = user.id;\n }\n modal.resolve(newUser);\n modal.hide();\n });\n }, [modal, user, form]);\n return (\n \n
    \n \n \n \n );\n});\n","const data = [\n {\n id: '1',\n name: 'Kennedy',\n job: 'Chief Mobility Orchestrator',\n city: 'North Alec',\n },\n {\n id: '2',\n name: 'Lucius',\n job: 'Internal Research Manager',\n city: 'Littleland',\n },\n {\n id: '3',\n name: 'Carlos',\n job: 'Lead Configuration Analyst',\n city: 'South Lillian',\n },\n {\n id: '4',\n name: 'Urban',\n job: 'Chief Operations Agent',\n city: 'Shieldshaven',\n },\n {\n id: '5',\n name: 'Katrine',\n job: 'Legacy Solutions Orchestrator',\n city: 'South Kyleigh',\n },\n];\nexport default data;\n","import { Modal, Button, Space } from 'antd';\nimport NiceModal, { useModal, antdModal } from '@ebay/nice-modal-react';\n\nconst PromiseModal = NiceModal.create(({ name }) => {\n const modal = useModal();\n const handleResolve = () => {\n modal.resolve({ resolved: true });\n };\n const handleReject = () => {\n modal.reject(new Error('Rejected'));\n modal.hide();\n };\n return (\n \n

    Choose the promise action: {name}

    \n \n \n \n \n
    \n );\n});\n\nconst ChainingModal = NiceModal.create(({ times }) => {\n const modal = useModal();\n return (\n \n \n
    \n
    \n Showed {times}/3 times.\n
    \n );\n});\n\nexport default function PromiseSample() {\n const chainingModal = useModal(ChainingModal);\n const showPromiseModal = () => {\n NiceModal.show(PromiseModal, { name: 'nate' })\n .then((res) => {\n console.log('Resolved: ', res);\n NiceModal.show(PromiseModal, { name: 'nate2' });\n })\n .catch((err) => {\n console.log('Rejected: ', err);\n });\n };\n const showChainingModal = async () => {\n for (let i = 0; i < 3; i++) {\n await chainingModal.show({ times: i + 1 });\n await chainingModal.hide();\n }\n };\n\n return (\n <>\n

    NOTE: please open dev console to see the output.

    \n \n \n\n \n \n \n );\n}\n","import { Modal, Button } from 'antd';\nimport NiceModal, { useModal, ModalDef } from '@ebay/nice-modal-react';\n\nexport const MyAntdModal = NiceModal.create(({ name }) => {\n const modal = useModal();\n return (\n \n Greetings: {name}!\n \n );\n});\n\nexport default function AntdSample() {\n return (\n <>\n \n \n \n );\n}\n","import React from 'react';\nimport Button from '@material-ui/core/Button';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogActions from '@material-ui/core/DialogActions';\nimport DialogContent from '@material-ui/core/DialogContent';\nimport DialogContentText from '@material-ui/core/DialogContentText';\nimport DialogTitle from '@material-ui/core/DialogTitle';\nimport Slide from '@material-ui/core/Slide';\nimport { TransitionProps } from '@material-ui/core/transitions';\nimport NiceModal, { useModal } from '@ebay/nice-modal-react';\n\nconst Transition = React.forwardRef(function Transition(\n props: TransitionProps & { children?: React.ReactElement },\n ref: React.Ref,\n) {\n return ;\n});\n\nconst MyMuiDialog = NiceModal.create(() => {\n const modal = useModal();\n return (\n modal.hide()}\n TransitionProps={{\n onExited: () => modal.remove(),\n }}\n >\n {\"Use Google's location service?\"}\n \n \n Let Google help apps determine location. This means sending anonymous location data to Google, even when no\n apps are running.\n \n \n \n \n \n \n \n );\n});\n\nexport default function MuiDialogSample() {\n return (\n \n );\n}\n","import { Modal, Button, Drawer, Space } from 'antd';\nimport NiceModal, { useModal } from '@ebay/nice-modal-react';\n\nexport const MyAntdModal = NiceModal.create(({ name }: { name: string }) => {\n const modal = useModal();\n return (\n \n Greetings: {name}!\n \n );\n});\n\nconst MyAntdDrawer = NiceModal.create(({ name }: { name: string }) => {\n const modal = useModal();\n return (\n {\n if (!visible) modal.remove();\n }}\n >\n Greetings: {name}!\n \n );\n});\n\nexport default function AntdSample() {\n return (\n \n \n \n \n );\n}\n","import BootstrapModal from 'react-bootstrap/Modal';\nimport Button from 'react-bootstrap/Button';\nimport NiceModal, { useModal, bootstrapDialog } from '@ebay/nice-modal-react';\n\nconst MyBootstrapDialog = NiceModal.create(({ name = 'Bootstrap' }: { name: string }) => {\n const modal = useModal();\n return (\n \n \n Modal title\n \n\n \n

    Modal body text goes here. {name}

    \n
    \n\n \n \n \n \n
    \n );\n});\nexport default function BootstrapSample() {\n return (\n <>\n \n \n );\n}\n","import { createStore, applyMiddleware, compose, combineReducers } from 'redux';\nimport { Provider, useSelector, useDispatch } from 'react-redux';\nimport NiceModal from '@ebay/nice-modal-react';\nimport { Button } from 'antd';\nimport { MyAntdModal } from './MyAntdModal';\nimport logger from 'redux-logger';\n\nconst composeEnhancers = (typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) || compose;\nconst enhancer = composeEnhancers(applyMiddleware(logger));\n\nconst store = createStore(\n combineReducers({\n __nice_modals: NiceModal.reducer,\n // other reducers...\n }),\n enhancer,\n);\n\nconst ModalsProvider = ({ children }) => {\n const modals = useSelector((s) => s.__nice_modals);\n const dispatch = useDispatch();\n return (\n \n

    NOTE: open dev console or Redux dev tools to see actions log.

    \n {\n NiceModal.show(MyAntdModal, { name: 'Redux' });\n }}\n >\n Show Modal\n \n
    \n );\n};\n\nexport default function ReduxIntegration({ children }) {\n return (\n \n {children}\n \n );\n}\n","import { useEffect, useState } from 'react';\nimport { Modal, Button } from 'antd';\nimport NiceModal, { useModal, ModalHolder } from '@ebay/nice-modal-react';\n\nexport const MyAntdModal = NiceModal.create(({ time }) => {\n const modal = useModal();\n return (\n \n Time: {time}\n \n );\n});\n\nexport default function Example() {\n const [time, setTime] = useState(0);\n useEffect(() => {\n const p = setInterval(() => setTime((t) => t + 1), 1000);\n return () => clearInterval(p);\n }, []);\n\n // modalHandler will be assign show/hide method.\n const modalHandler = {};\n\n return (\n <>\n \n \n \n );\n}\n","import NiceModal from '@ebay/nice-modal-react';\nimport useHash from './useHash';\nimport CodeViewer from './CodeViewer';\nimport UserList from './UserList';\nimport './App.css';\nimport PromiseSample from './PromiseSample';\nimport Declarative from './Declarative';\nimport MyMuiDialog from './MyMuiDialog';\nimport MyAntdModal from './MyAntdModal';\nimport MyBootstrapDialog from './MyBootstrapDialog';\nimport ReduxIntegration from './ReduxIntegration';\nimport PropsBinding from './PropsBinding';\n\nconst examples = {\n real: {\n name: 'Real Case',\n component: UserList,\n description: 'Show a dialog to create a new user or edit user info.',\n code: ['UserList.jsx', 'UserInfoModal.jsx'],\n },\n mui: {\n name: 'Material UI',\n description: 'Show material UI dialog',\n component: MyMuiDialog,\n code: ['MyMuiDialog.tsx'],\n },\n antd: {\n name: 'Ant Design',\n description: 'Show/hide antd modal or drawer.',\n component: MyAntdModal,\n code: ['MyAntdModal.tsx'],\n },\n bootstrap: {\n name: 'Bootstrap React',\n descript: 'Show/hide bootstrap dialog.',\n component: MyBootstrapDialog,\n code: ['MyBootstrapDialog.tsx'],\n },\n promise: {\n name: 'Promise',\n description: 'Use promise to interact with the dialog.',\n component: PromiseSample,\n code: ['PromiseSample.jsx'],\n },\n declarative: {\n name: 'Declarative',\n description: 'Declarative way to register a modal with id.',\n component: Declarative,\n code: ['Declarative.jsx'],\n },\n propsBinding: {\n name: 'Props Binding',\n description: 'To bind props to modal, need to declare the modal using .',\n component: PropsBinding,\n code: ['PropsBinding.jsx'],\n },\n redux: {\n name: 'Redux Integration',\n description:\n 'Use Redux to manage modals state so that you can use Redux dev tools to debug nice modals.',\n component: ReduxIntegration,\n code: ['ReduxIntegration.jsx'],\n },\n};\n\nfunction App() {\n const current = useHash() || 'real';\n\n const renderExample = () => {\n const item = examples[current];\n if (!item || !item.component) {\n return Error: example \"{current}\" not found.;\n }\n const Comp = item.component;\n return (\n <>\n

    \n {item.name}\n

    {item.description}

    \n

    \n \n \n );\n };\n const example = examples[current] || {};\n const ele = (\n
    \n
    \n

    \n @ebay/nice-modal-react\n Examples\n

    \n
    \n \n
    \n
    \n \n \n \n
    \n \n \"api\n \n
    \n \n \n \n
    \n
    \n
    \n
    {renderExample()}
    \n
    \n {example.code?.map((f) => (\n \n ))}\n
    \n
    \n
    \n );\n\n if (current === 'redux') return ele;\n else return {ele};\n}\n\nexport default App;\n","import { useMemo, useCallback, useState } from 'react';\nimport { Button, Table } from 'antd';\nimport { EditOutlined } from '@ant-design/icons';\nimport { useModal } from '@ebay/nice-modal-react';\nimport UserInfoModal from './UserInfoModal';\nimport mockData from './mock';\n\nexport default function UserList() {\n const userModal = useModal(UserInfoModal);\n const [users, setUsers] = useState(mockData);\n\n const handleNewUser = useCallback(() => {\n userModal.show().then((newUser) => {\n setUsers([newUser, ...users]);\n });\n }, [userModal, users]);\n\n const handleEditUser = useCallback(\n (user) => {\n userModal.show({ user }).then((newUser) => {\n setUsers((users) => {\n // Modify users immutablly\n const i = users.findIndex((u) => u.id === newUser.id);\n const updated = { ...users[i], ...newUser };\n const arr = [...users];\n arr.splice(i, 1, updated);\n return arr;\n });\n });\n },\n [userModal],\n );\n\n const columns = useMemo(\n () => [\n {\n title: 'Name',\n dataIndex: 'name',\n width: '150px',\n },\n {\n title: 'Job Title',\n dataIndex: 'job',\n },\n {\n title: 'Edit',\n width: '100px',\n render(value, user) {\n return (\n }\n onClick={() => {\n handleEditUser(user);\n }}\n />\n );\n },\n },\n ],\n [handleEditUser],\n );\n\n return (\n
    \n \n \n
    \n );\n}\n","import { ReportHandler } from 'web-vitals';\n\nconst reportWebVitals = (onPerfEntry?: ReportHandler) => {\n if (onPerfEntry && onPerfEntry instanceof Function) {\n import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {\n getCLS(onPerfEntry);\n getFID(onPerfEntry);\n getFCP(onPerfEntry);\n getLCP(onPerfEntry);\n getTTFB(onPerfEntry);\n });\n }\n};\n\nexport default reportWebVitals;\n","import React from 'react';\nimport ReactDOM from 'react-dom';\nimport './index.css';\nimport App from './App';\nimport reportWebVitals from './reportWebVitals';\nimport 'bootstrap/dist/css/bootstrap.min.css';\nimport 'antd/dist/antd.css';\n\nReactDOM.render(, document.getElementById('root'));\n\n// If you want to start measuring performance in your app, pass a function\n// to log results (for example: reportWebVitals(console.log))\n// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals\nreportWebVitals();\n"],"sourceRoot":""} \ No newline at end of file diff --git a/docs/static/js/main.896621f7.chunk.js.map b/docs/static/js/main.896621f7.chunk.js.map deleted file mode 100644 index c3232f6..0000000 --- a/docs/static/js/main.896621f7.chunk.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../../lib/esm/index.js","useHash.js","CodeViewer.jsx","webpack:///./src/MyAntdModal.tsx?80f2","webpack:///./src/UserInfoModal.jsx?3e7a","webpack:///./src/UserList.jsx?90fc","webpack:///./src/PromiseSample.jsx?a91c","webpack:///./src/MyMuiDialog.tsx?55e3","webpack:///./src/MyBootstrapDialog.tsx?9fa1","webpack:///./src/ReduxIntegration.jsx?f440","webpack:///./src/Declarative.jsx?88cb","webpack:///./src/PropsBinding.jsx?ac2d","UserInfoModal.jsx","mock.js","PromiseSample.jsx","Declarative.jsx","MyMuiDialog.tsx","MyAntdModal.tsx","MyBootstrapDialog.tsx","ReduxIntegration.jsx","PropsBinding.jsx","App.jsx","UserList.jsx","reportWebVitals.ts","index.tsx"],"names":["__assign","Object","assign","t","s","i","n","arguments","length","p","prototype","hasOwnProperty","call","apply","this","__rest","e","indexOf","getOwnPropertySymbols","propertyIsEnumerable","symModalId","Symbol","initialState","NiceModalContext","React","createContext","NiceModalIdContext","MODAL_REGISTRY","ALREADY_MOUNTED","uidSeed","dispatch","Error","getUid","reducer","state","action","_a","_b","_c","type","_d","payload","modalId","args","id","visible","delayVisible","newState","_e","flags","modalCallbacks","hideModalCallbacks","getModalId","modal","show","register","showModal","theResolve_1","theReject_1","promise","Promise","resolve","reject","hide","hideModal","theResolve_2","theReject_2","remove","removeModal","useModal","modals","useContext","contextModalId","isUseComponent","mid","useEffect","modalInfo","showCallback","useCallback","hideCallback","removeCallback","resolveCallback","rejectCallback","resolveHide","useMemo","keepMounted","comp","props","NiceModalPlaceholder","visibleModalIds","keys","filter","forEach","console","warn","toRender","map","createElement","Fragment","key","InnerContextProvider","children","arr","useReducer","Provider","value","ModalDef","component","unregister","ModalHolder","handler","restProps","ModalComp","antdModal","onOk","onCancel","afterClose","antdDrawer","onClose","afterVisibleChange","v","bootstrapDialog","onHide","onExited","NiceModal","givenDispatch","givenModals","create","Comp","defaultVisible","shouldMount","setModalFlags","getModal","muiDialog","open","getHash","document","location","hash","replace","useHash","useState","setHash","handleHashChange","window","scrollTo","top","addEventListener","removeEventListener","codeMap","CodeViewer","filename","Prism","highlightAll","className","user","Form","useForm","form","meta","initialValues","fields","label","required","handleSubmit","validateFields","then","newUser","getFieldsValue","String","Date","now","title","okText","data","name","job","city","PromiseModal","onClick","resolved","danger","ChainingModal","times","MyAntdModal","Transition","forwardRef","ref","Slide","direction","MyMuiDialog","Dialog","TransitionComponent","TransitionProps","DialogTitle","DialogContent","DialogContentText","DialogActions","Button","color","MyAntdDrawer","MyBootstrapDialog","Header","closeButton","Title","Body","Footer","variant","enhancer","__REDUX_DEVTOOLS_EXTENSION_COMPOSE__","compose","applyMiddleware","logger","store","createStore","combineReducers","__nice_modals","ModalsProvider","useSelector","useDispatch","style","time","examples","real","userModal","UserInfoModal","mockData","users","setUsers","handleNewUser","handleEditUser","findIndex","u","updated","splice","columns","dataIndex","width","render","icon","EditOutlined","size","rowKey","pagination","dataSource","marginTop","description","code","mui","antd","bootstrap","descript","chainingModal","showChainingModal","a","res","log","catch","err","declarative","propsBinding","setTime","setInterval","clearInterval","modalHandler","redux","App","current","example","ele","href","src","alt","item","renderExample","f","reportWebVitals","onPerfEntry","Function","getCLS","getFID","getFCP","getLCP","getTTFB","ReactDOM","getElementById"],"mappings":"4LAOIA,G,OAAsC,WAStC,OARAA,EAAWC,OAAOC,QAAU,SAASC,GACjC,IAAK,IAAIC,EAAGC,EAAI,EAAGC,EAAIC,UAAUC,OAAQH,EAAIC,EAAGD,IAE5C,IAAK,IAAII,KADTL,EAAIG,UAAUF,GACOJ,OAAOS,UAAUC,eAAeC,KAAKR,EAAGK,KACzDN,EAAEM,GAAKL,EAAEK,IAEjB,OAAON,CACV,EACMH,EAASa,MAAMC,KAAMP,UAC/B,GACGQ,EAAkC,SAAUX,EAAGY,GAC/C,IAAIb,EAAI,CAAC,EACT,IAAK,IAAIM,KAAKL,EAAOH,OAAOS,UAAUC,eAAeC,KAAKR,EAAGK,IAAMO,EAAEC,QAAQR,GAAK,IAC9EN,EAAEM,GAAKL,EAAEK,IACb,GAAS,MAALL,GAAqD,oBAAjCH,OAAOiB,sBACtB,KAAIb,EAAI,EAAb,IAAgBI,EAAIR,OAAOiB,sBAAsBd,GAAIC,EAAII,EAAED,OAAQH,IAC3DW,EAAEC,QAAQR,EAAEJ,IAAM,GAAKJ,OAAOS,UAAUS,qBAAqBP,KAAKR,E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DgB,WACpB,IAAMuH,EAAOnD,GAAS6C,GACtB,IAAKM,IAASA,EAAKtK,UACjB,OAAO,uBAAMiH,MAAO,CAAErB,MAAO,OAAtB,6BAAgDoE,EAAhD,kBAET,IAAM3I,EAAOiJ,EAAKtK,UAClB,OACE,qCACE,+BACGsK,EAAKlG,KACN,mBAAGrB,UAAU,sBAAb,SAAoCuH,EAAK3B,iBAE3C,cAACtH,EAAD,MAGL,CA0CyCkJ,KACpC,qBAAKxH,UAAU,iBAAf,mBACGkH,EAAQrB,YADX,aACG,EAAcvJ,KAAI,SAACmL,GAAD,OACjB,cAAC7H,EAAD,CAAoBC,SAAU4H,GAAbA,EADA,YAQ3B,MAAgB,UAAZR,EAA4BE,EACpB,cAAC,EAAUrK,SAAX,UAAqBqK,GAClC,EE3HcO,GAZS,SAACC,GACnBA,GAAeA,aAAuBC,UACxC,8BAAqBhH,MAAK,YAAkD,IAA/CiH,EAA8C,EAA9CA,OAAQC,EAAsC,EAAtCA,OAAQC,EAA8B,EAA9BA,OAAQC,EAAsB,EAAtBA,OAAQC,EAAc,EAAdA,QAC3DJ,EAAOF,GACPG,EAAOH,GACPI,EAAOJ,GACPK,EAAOL,GACPM,EAAQN,EACT,GAEJ,E,cCJDO,IAAS9C,OAAO,cAAC,GAAD,IAAStG,SAASqJ,eAAe,SAKjDT,I","file":"static/js/main.896621f7.chunk.js","sourcesContent":["/* *********************************************************\n * Copyright 2021 eBay Inc.\n\n * Use of this source code is governed by an MIT-style\n * license that can be found in the LICENSE file or at\n * https://opensource.org/licenses/MIT.\n*********************************************************** */\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/**\n * @module NiceModal\n * */\nimport React, { useEffect, useCallback, useContext, useReducer, useMemo } from 'react';\nvar symModalId = Symbol('NiceModalId');\nvar initialState = {};\nexport var NiceModalContext = React.createContext(initialState);\nvar NiceModalIdContext = React.createContext(null);\nvar MODAL_REGISTRY = {};\nvar ALREADY_MOUNTED = {};\nvar uidSeed = 0;\nvar dispatch = function () {\n throw new Error('No dispatch method detected, did you embed your app with NiceModal.Provider?');\n};\nvar getUid = function () { return \"_nice_modal_\" + uidSeed++; };\n// Modal reducer used in useReducer hook.\nexport var reducer = function (state, action) {\n var _a, _b, _c;\n if (state === void 0) { state = initialState; }\n switch (action.type) {\n case 'nice-modal/show': {\n var _d = action.payload, modalId = _d.modalId, args = _d.args;\n return __assign(__assign({}, state), (_a = {}, _a[modalId] = __assign(__assign({}, state[modalId]), { id: modalId, args: args, \n // If modal is not mounted, mount it first then make it visible.\n // There is logic inside HOC wrapper to make it visible after its first mount.\n // This mechanism ensures the entering transition.\n visible: !!ALREADY_MOUNTED[modalId], delayVisible: !ALREADY_MOUNTED[modalId] }), _a));\n }\n case 'nice-modal/hide': {\n var modalId = action.payload.modalId;\n if (!state[modalId])\n return state;\n return __assign(__assign({}, state), (_b = {}, _b[modalId] = __assign(__assign({}, state[modalId]), { visible: false }), _b));\n }\n case 'nice-modal/remove': {\n var modalId = action.payload.modalId;\n var newState = __assign({}, state);\n delete newState[modalId];\n return newState;\n }\n case 'nice-modal/set-flags': {\n var _e = action.payload, modalId = _e.modalId, flags = _e.flags;\n return __assign(__assign({}, state), (_c = {}, _c[modalId] = __assign(__assign({}, state[modalId]), flags), _c));\n }\n default:\n return state;\n }\n};\n// Get modal component by modal id\nfunction getModal(modalId) {\n var _a;\n return (_a = MODAL_REGISTRY[modalId]) === null || _a === void 0 ? void 0 : _a.comp;\n}\n// action creator to show a modal\nfunction showModal(modalId, args) {\n return {\n type: 'nice-modal/show',\n payload: {\n modalId: modalId,\n args: args,\n },\n };\n}\n// action creator to set flags of a modal\nfunction setModalFlags(modalId, flags) {\n return {\n type: 'nice-modal/set-flags',\n payload: {\n modalId: modalId,\n flags: flags,\n },\n };\n}\n// action creator to hide a modal\nfunction hideModal(modalId) {\n return {\n type: 'nice-modal/hide',\n payload: {\n modalId: modalId,\n },\n };\n}\n// action creator to remove a modal\nfunction removeModal(modalId) {\n return {\n type: 'nice-modal/remove',\n payload: {\n modalId: modalId,\n },\n };\n}\nvar modalCallbacks = {};\nvar hideModalCallbacks = {};\nvar getModalId = function (modal) {\n if (typeof modal === 'string')\n return modal;\n if (!modal[symModalId]) {\n modal[symModalId] = getUid();\n }\n return modal[symModalId];\n};\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function show(modal, args) {\n var modalId = getModalId(modal);\n if (typeof modal !== 'string' && !MODAL_REGISTRY[modalId]) {\n register(modalId, modal);\n }\n dispatch(showModal(modalId, args));\n if (!modalCallbacks[modalId]) {\n // `!` tell ts that theResolve will be written before it is used\n var theResolve_1;\n // `!` tell ts that theResolve will be written before it is used\n var theReject_1;\n var promise = new Promise(function (resolve, reject) {\n theResolve_1 = resolve;\n theReject_1 = reject;\n });\n modalCallbacks[modalId] = {\n resolve: theResolve_1,\n reject: theReject_1,\n promise: promise,\n };\n }\n return modalCallbacks[modalId].promise;\n}\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function hide(modal) {\n var modalId = getModalId(modal);\n dispatch(hideModal(modalId));\n // Should also delete the callback for modal.resolve #35\n delete modalCallbacks[modalId];\n if (!hideModalCallbacks[modalId]) {\n // `!` tell ts that theResolve will be written before it is used\n var theResolve_2;\n // `!` tell ts that theResolve will be written before it is used\n var theReject_2;\n var promise = new Promise(function (resolve, reject) {\n theResolve_2 = resolve;\n theReject_2 = reject;\n });\n hideModalCallbacks[modalId] = {\n resolve: theResolve_2,\n reject: theReject_2,\n promise: promise,\n };\n }\n return hideModalCallbacks[modalId].promise;\n}\nexport var remove = function (modal) {\n var modalId = getModalId(modal);\n dispatch(removeModal(modalId));\n delete modalCallbacks[modalId];\n delete hideModalCallbacks[modalId];\n};\nvar setFlags = function (modalId, flags) {\n dispatch(setModalFlags(modalId, flags));\n};\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function useModal(modal, args) {\n var modals = useContext(NiceModalContext);\n var contextModalId = useContext(NiceModalIdContext);\n var modalId = null;\n var isUseComponent = modal && typeof modal !== 'string';\n if (!modal) {\n modalId = contextModalId;\n }\n else {\n modalId = getModalId(modal);\n }\n // Only if contextModalId doesn't exist\n if (!modalId)\n throw new Error('No modal id found in NiceModal.useModal.');\n var mid = modalId;\n // If use a component directly, register it.\n useEffect(function () {\n if (isUseComponent && !MODAL_REGISTRY[mid]) {\n register(mid, modal, args);\n }\n }, [isUseComponent, mid, modal, args]);\n var modalInfo = modals[mid];\n var showCallback = useCallback(function (args) { return show(mid, args); }, [mid]);\n var hideCallback = useCallback(function () { return hide(mid); }, [mid]);\n var removeCallback = useCallback(function () { return remove(mid); }, [mid]);\n var resolveCallback = useCallback(function (args) {\n var _a;\n (_a = modalCallbacks[mid]) === null || _a === void 0 ? void 0 : _a.resolve(args);\n delete modalCallbacks[mid];\n }, [mid]);\n var rejectCallback = useCallback(function (args) {\n var _a;\n (_a = modalCallbacks[mid]) === null || _a === void 0 ? void 0 : _a.reject(args);\n delete modalCallbacks[mid];\n }, [mid]);\n var resolveHide = useCallback(function (args) {\n var _a;\n (_a = hideModalCallbacks[mid]) === null || _a === void 0 ? void 0 : _a.resolve(args);\n delete hideModalCallbacks[mid];\n }, [mid]);\n return useMemo(function () { return ({\n id: mid,\n args: modalInfo === null || modalInfo === void 0 ? void 0 : modalInfo.args,\n visible: !!(modalInfo === null || modalInfo === void 0 ? void 0 : modalInfo.visible),\n keepMounted: !!(modalInfo === null || modalInfo === void 0 ? void 0 : modalInfo.keepMounted),\n show: showCallback,\n hide: hideCallback,\n remove: removeCallback,\n resolve: resolveCallback,\n reject: rejectCallback,\n resolveHide: resolveHide,\n }); }, [\n mid,\n modalInfo === null || modalInfo === void 0 ? void 0 : modalInfo.args,\n modalInfo === null || modalInfo === void 0 ? void 0 : modalInfo.visible,\n modalInfo === null || modalInfo === void 0 ? void 0 : modalInfo.keepMounted,\n showCallback,\n hideCallback,\n removeCallback,\n resolveCallback,\n rejectCallback,\n resolveHide,\n ]);\n}\nexport var create = function (Comp) {\n return function (_a) {\n var _b;\n var defaultVisible = _a.defaultVisible, keepMounted = _a.keepMounted, id = _a.id, props = __rest(_a, [\"defaultVisible\", \"keepMounted\", \"id\"]);\n var _c = useModal(id), args = _c.args, show = _c.show;\n // If there's modal state, then should mount it.\n var modals = useContext(NiceModalContext);\n var shouldMount = !!modals[id];\n useEffect(function () {\n // If defaultVisible, show it after mounted.\n if (defaultVisible) {\n show();\n }\n ALREADY_MOUNTED[id] = true;\n return function () {\n delete ALREADY_MOUNTED[id];\n };\n }, [id, show, defaultVisible]);\n useEffect(function () {\n if (keepMounted)\n setFlags(id, { keepMounted: true });\n }, [id, keepMounted]);\n var delayVisible = (_b = modals[id]) === null || _b === void 0 ? void 0 : _b.delayVisible;\n // If modal.show is called\n // 1. If modal was mounted, should make it visible directly\n // 2. If modal has not been mounted, should mount it first, then make it visible\n useEffect(function () {\n if (delayVisible) {\n // delayVisible: false => true, it means the modal.show() is called, should show it.\n show(args);\n }\n }, [delayVisible, args, show]);\n if (!shouldMount)\n return null;\n return (React.createElement(NiceModalIdContext.Provider, { value: id },\n React.createElement(Comp, __assign({}, props, args))));\n };\n};\n// All registered modals will be rendered in modal placeholder\nexport var register = function (id, comp, props) {\n if (!MODAL_REGISTRY[id]) {\n MODAL_REGISTRY[id] = { comp: comp, props: props };\n }\n else {\n MODAL_REGISTRY[id].props = props;\n }\n};\n/**\n * Unregister a modal.\n * @param id - The id of the modal.\n */\nexport var unregister = function (id) {\n delete MODAL_REGISTRY[id];\n};\n// The placeholder component is used to auto render modals when call modal.show()\n// When modal.show() is called, it means there've been modal info\nvar NiceModalPlaceholder = function () {\n var modals = useContext(NiceModalContext);\n var visibleModalIds = Object.keys(modals).filter(function (id) { return !!modals[id]; });\n visibleModalIds.forEach(function (id) {\n if (!MODAL_REGISTRY[id] && !ALREADY_MOUNTED[id]) {\n console.warn(\"No modal found for id: \" + id + \". Please check the id or if it is registered or declared via JSX.\");\n return;\n }\n });\n var toRender = visibleModalIds\n .filter(function (id) { return MODAL_REGISTRY[id]; })\n .map(function (id) { return (__assign({ id: id }, MODAL_REGISTRY[id])); });\n return (React.createElement(React.Fragment, null, toRender.map(function (t) { return (React.createElement(t.comp, __assign({ key: t.id, id: t.id }, t.props))); })));\n};\nvar InnerContextProvider = function (_a) {\n var children = _a.children;\n var arr = useReducer(reducer, initialState);\n var modals = arr[0];\n dispatch = arr[1];\n return (React.createElement(NiceModalContext.Provider, { value: modals },\n children,\n React.createElement(NiceModalPlaceholder, null)));\n};\nexport var Provider = function (_a) {\n var children = _a.children, givenDispatch = _a.dispatch, givenModals = _a.modals;\n if (!givenDispatch || !givenModals) {\n return React.createElement(InnerContextProvider, null, children);\n }\n dispatch = givenDispatch;\n return (React.createElement(NiceModalContext.Provider, { value: givenModals },\n children,\n React.createElement(NiceModalPlaceholder, null)));\n};\n/**\n * Declarative way to register a modal.\n * @param id - The id of the modal.\n * @param component - The modal Component.\n * @returns\n */\nexport var ModalDef = function (_a) {\n var id = _a.id, component = _a.component;\n useEffect(function () {\n register(id, component);\n return function () {\n unregister(id);\n };\n }, [id, component]);\n return null;\n};\n/**\n * A place holder allows to bind props to a modal.\n * It assigns show/hide methods to handler object to show/hide the modal.\n *\n * Comparing to use the directly, this approach allows use registered modal id to find the modal component.\n * Also it avoids to create unique id for MyNiceModal.\n *\n * @param modal - The modal id registered or a modal component.\n * @param handler - The handler object to control the modal.\n * @returns\n */\nexport var ModalHolder = function (_a) {\n var _b;\n var modal = _a.modal, _c = _a.handler, handler = _c === void 0 ? {} : _c, restProps = __rest(_a, [\"modal\", \"handler\"]);\n var mid = useMemo(function () { return getUid(); }, []);\n var ModalComp = typeof modal === 'string' ? (_b = MODAL_REGISTRY[modal]) === null || _b === void 0 ? void 0 : _b.comp : modal;\n if (!handler) {\n throw new Error('No handler found in NiceModal.ModalHolder.');\n }\n if (!ModalComp) {\n throw new Error(\"No modal found for id: \" + modal + \" in NiceModal.ModalHolder.\");\n }\n handler.show = useCallback(function (args) { return show(mid, args); }, [mid]);\n handler.hide = useCallback(function () { return hide(mid); }, [mid]);\n return React.createElement(ModalComp, __assign({ id: mid }, restProps));\n};\nexport var antdModal = function (modal) {\n return {\n visible: modal.visible,\n onOk: function () { return modal.hide(); },\n onCancel: function () { return modal.hide(); },\n afterClose: function () {\n // Need to resolve before remove\n modal.resolveHide();\n if (!modal.keepMounted)\n modal.remove();\n },\n };\n};\nexport var antdModalV5 = function (modal) {\n var _a = antdModal(modal), onOk = _a.onOk, onCancel = _a.onCancel, afterClose = _a.afterClose;\n return {\n open: modal.visible,\n onOk: onOk,\n onCancel: onCancel,\n afterClose: afterClose,\n };\n};\nexport var antdDrawer = function (modal) {\n return {\n visible: modal.visible,\n onClose: function () { return modal.hide(); },\n afterVisibleChange: function (v) {\n if (!v) {\n modal.resolveHide();\n }\n !v && !modal.keepMounted && modal.remove();\n },\n };\n};\nexport var antdDrawerV5 = function (modal) {\n var _a = antdDrawer(modal), onClose = _a.onClose, afterOpenChange = _a.afterVisibleChange;\n return {\n open: modal.visible,\n onClose: onClose,\n afterOpenChange: afterOpenChange,\n };\n};\nexport var muiDialog = function (modal) {\n return {\n open: modal.visible,\n onClose: function () { return modal.hide(); },\n onExited: function () {\n modal.resolveHide();\n !modal.keepMounted && modal.remove();\n },\n };\n};\nexport var muiDialogV5 = function (modal) {\n return {\n open: modal.visible,\n onClose: function () { return modal.hide(); },\n TransitionProps: {\n onExited: function () {\n modal.resolveHide();\n !modal.keepMounted && modal.remove();\n },\n },\n };\n};\nexport var bootstrapDialog = function (modal) {\n return {\n show: modal.visible,\n onHide: function () { return modal.hide(); },\n onExited: function () {\n modal.resolveHide();\n !modal.keepMounted && modal.remove();\n },\n };\n};\nvar NiceModal = {\n Provider: Provider,\n ModalDef: ModalDef,\n ModalHolder: ModalHolder,\n NiceModalContext: NiceModalContext,\n create: create,\n register: register,\n getModal: getModal,\n show: show,\n hide: hide,\n remove: remove,\n useModal: useModal,\n reducer: reducer,\n antdModal: antdModal,\n antdDrawer: antdDrawer,\n muiDialog: muiDialog,\n bootstrapDialog: bootstrapDialog,\n};\nexport default NiceModal;\n","import { useEffect, useState } from 'react';\n\nconst getHash = () => document.location.hash.replace('#', '');\n\nconst useHash = () => {\n const [hash, setHash] = useState(getHash());\n useEffect(() => {\n function handleHashChange() {\n const hash = getHash() || 'basic';\n setHash(hash);\n window.scrollTo({ top: 0 });\n }\n window.addEventListener('hashchange', handleHashChange);\n return () => {\n window.removeEventListener('hashchange', handleHashChange);\n };\n }, [setHash]);\n return hash;\n};\n\nexport default useHash;\n","/* eslint import/no-webpack-loader-syntax: off */\n\nimport React, { useEffect } from 'react';\nimport codeAntd from '!!raw-loader!./MyAntdModal.tsx';\nimport codeUserList from '!!raw-loader!./UserList.jsx';\nimport codeUserInfoModal from '!!raw-loader!./UserInfoModal.jsx';\nimport codePromiseSample from '!!raw-loader!./PromiseSample.jsx';\nimport codeMyMuiDialog from '!!raw-loader!./MyMuiDialog.tsx';\nimport codeMyBootstrapDialog from '!!raw-loader!./MyBootstrapDialog.tsx';\nimport codeReduxIntegration from '!!raw-loader!./ReduxIntegration.jsx';\nimport codeDeclarative from '!!raw-loader!./Declarative.jsx';\nimport codePropsBinding from '!!raw-loader!./PropsBinding.jsx';\n\nconst codeMap = {\n 'MyAntdModal.tsx': codeAntd,\n 'UserInfoModal.jsx': codeUserInfoModal,\n 'UserList.jsx': codeUserList,\n 'PromiseSample.jsx': codePromiseSample,\n 'MyMuiDialog.tsx': codeMyMuiDialog,\n 'MyBootstrapDialog.tsx': codeMyBootstrapDialog,\n 'ReduxIntegration.jsx': codeReduxIntegration,\n 'Declarative.jsx': codeDeclarative,\n 'PropsBinding.jsx': codePropsBinding,\n};\nexport default function CodeViewer({ filename }) {\n useEffect(() => {\n window.Prism.highlightAll();\n }, [filename]);\n return (\n
    \n
    {filename}
    \n
    \n        \n          {codeMap[filename] || `// Error: code of \"${filename}\" not found`}\n        \n      
    \n
    \n );\n}\n","export default \"import { Modal, Button, Drawer, Space } from 'antd';\\nimport NiceModal, { useModal } from '@ebay/nice-modal-react';\\n\\nexport const MyAntdModal = NiceModal.create(({ name }: { name: string }) => {\\n const modal = useModal();\\n return (\\n \\n Greetings: {name}!\\n \\n );\\n});\\n\\nconst MyAntdDrawer = NiceModal.create(({ name }: { name: string }) => {\\n const modal = useModal();\\n return (\\n {\\n if (!visible) modal.remove();\\n }}\\n >\\n Greetings: {name}!\\n \\n );\\n});\\n\\nexport default function AntdSample() {\\n return (\\n \\n \\n \\n \\n );\\n}\\n\";","export default \"import { useCallback } from 'react';\\nimport { Form, Modal } from 'antd';\\nimport FormBuilder from 'antd-form-builder';\\nimport NiceModal, { useModal, antdModal } from '@ebay/nice-modal-react';\\n\\nexport default NiceModal.create(({ user }) => {\\n const modal = useModal();\\n const [form] = Form.useForm();\\n const meta = {\\n initialValues: user,\\n fields: [\\n { key: 'name', label: 'Name', required: true },\\n { key: 'job', label: 'Job Title', required: true },\\n ],\\n };\\n\\n const handleSubmit = useCallback(() => {\\n form.validateFields().then(() => {\\n const newUser = { ...form.getFieldsValue() };\\n // In real case, you may call API to create user or update user\\n if (!user) {\\n newUser.id = String(Date.now());\\n } else {\\n newUser.id = user.id;\\n }\\n modal.resolve(newUser);\\n modal.hide();\\n });\\n }, [modal, user, form]);\\n return (\\n \\n
    \\n \\n \\n \\n );\\n});\\n\";","export default \"import { useMemo, useCallback, useState } from 'react';\\nimport { Button, Table } from 'antd';\\nimport { EditOutlined } from '@ant-design/icons';\\nimport { useModal } from '@ebay/nice-modal-react';\\nimport UserInfoModal from './UserInfoModal';\\nimport mockData from './mock';\\n\\nexport default function UserList() {\\n const userModal = useModal(UserInfoModal);\\n const [users, setUsers] = useState(mockData);\\n\\n const handleNewUser = useCallback(() => {\\n userModal.show().then((newUser) => {\\n setUsers([newUser, ...users]);\\n });\\n }, [userModal, users]);\\n\\n const handleEditUser = useCallback(\\n (user) => {\\n userModal.show({ user }).then((newUser) => {\\n setUsers((users) => {\\n // Modify users immutablly\\n const i = users.findIndex((u) => u.id === newUser.id);\\n const updated = { ...users[i], ...newUser };\\n const arr = [...users];\\n arr.splice(i, 1, updated);\\n return arr;\\n });\\n });\\n },\\n [userModal],\\n );\\n\\n const columns = useMemo(\\n () => [\\n {\\n title: 'Name',\\n dataIndex: 'name',\\n width: '150px',\\n },\\n {\\n title: 'Job Title',\\n dataIndex: 'job',\\n },\\n {\\n title: 'Edit',\\n width: '100px',\\n render(value, user) {\\n return (\\n }\\n onClick={() => {\\n handleEditUser(user);\\n }}\\n />\\n );\\n },\\n },\\n ],\\n [handleEditUser],\\n );\\n\\n return (\\n
    \\n \\n \\n
    \\n );\\n}\\n\";","export default \"import { Modal, Button, Space } from 'antd';\\nimport NiceModal, { useModal, antdModal } from '@ebay/nice-modal-react';\\n\\nconst PromiseModal = NiceModal.create(({ name }) => {\\n const modal = useModal();\\n const handleResolve = () => {\\n modal.resolve({ resolved: true });\\n };\\n const handleReject = () => {\\n modal.reject(new Error('Rejected'));\\n modal.hide();\\n };\\n return (\\n \\n

    Choose the promise action: {name}

    \\n \\n \\n \\n \\n
    \\n );\\n});\\n\\nconst ChainingModal = NiceModal.create(({ times }) => {\\n const modal = useModal();\\n return (\\n \\n \\n
    \\n
    \\n Showed {times}/3 times.\\n
    \\n );\\n});\\n\\nexport default function PromiseSample() {\\n const chainingModal = useModal(ChainingModal);\\n const showPromiseModal = () => {\\n NiceModal.show(PromiseModal, { name: 'nate' })\\n .then((res) => {\\n console.log('Resolved: ', res);\\n NiceModal.show(PromiseModal, { name: 'nate2' });\\n })\\n .catch((err) => {\\n console.log('Rejected: ', err);\\n });\\n };\\n const showChainingModal = async () => {\\n for (let i = 0; i < 3; i++) {\\n await chainingModal.show({ times: i + 1 });\\n await chainingModal.hide();\\n }\\n };\\n\\n return (\\n <>\\n

    NOTE: please open dev console to see the output.

    \\n \\n \\n\\n \\n \\n \\n );\\n}\\n\";","export default \"import React from 'react';\\nimport Button from '@material-ui/core/Button';\\nimport Dialog from '@material-ui/core/Dialog';\\nimport DialogActions from '@material-ui/core/DialogActions';\\nimport DialogContent from '@material-ui/core/DialogContent';\\nimport DialogContentText from '@material-ui/core/DialogContentText';\\nimport DialogTitle from '@material-ui/core/DialogTitle';\\nimport Slide from '@material-ui/core/Slide';\\nimport { TransitionProps } from '@material-ui/core/transitions';\\nimport NiceModal, { useModal } from '@ebay/nice-modal-react';\\n\\nconst Transition = React.forwardRef(function Transition(\\n props: TransitionProps & { children?: React.ReactElement },\\n ref: React.Ref,\\n) {\\n return ;\\n});\\n\\nconst MyMuiDialog = NiceModal.create(() => {\\n const modal = useModal();\\n return (\\n modal.hide()}\\n TransitionProps={{\\n onExited: () => modal.remove(),\\n }}\\n >\\n {\\\"Use Google's location service?\\\"}\\n \\n \\n Let Google help apps determine location. This means sending anonymous location data to Google, even when no\\n apps are running.\\n \\n \\n \\n \\n \\n \\n \\n );\\n});\\n\\nexport default function MuiDialogSample() {\\n return (\\n \\n );\\n}\\n\";","export default \"import BootstrapModal from 'react-bootstrap/Modal';\\nimport Button from 'react-bootstrap/Button';\\nimport NiceModal, { useModal, bootstrapDialog } from '@ebay/nice-modal-react';\\n\\nconst MyBootstrapDialog = NiceModal.create(({ name = 'Bootstrap' }: { name: string }) => {\\n const modal = useModal();\\n return (\\n \\n \\n Modal title\\n \\n\\n \\n

    Modal body text goes here. {name}

    \\n
    \\n\\n \\n \\n \\n \\n
    \\n );\\n});\\nexport default function BootstrapSample() {\\n return (\\n <>\\n \\n \\n );\\n}\\n\";","export default \"import { createStore, applyMiddleware, compose, combineReducers } from 'redux';\\nimport { Provider, useSelector, useDispatch } from 'react-redux';\\nimport NiceModal from '@ebay/nice-modal-react';\\nimport { Button } from 'antd';\\nimport { MyAntdModal } from './MyAntdModal';\\nimport logger from 'redux-logger';\\n\\nconst composeEnhancers = (typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) || compose;\\nconst enhancer = composeEnhancers(applyMiddleware(logger));\\n\\nconst store = createStore(\\n combineReducers({\\n __nice_modals: NiceModal.reducer,\\n // other reducers...\\n }),\\n enhancer,\\n);\\n\\nconst ModalsProvider = ({ children }) => {\\n const modals = useSelector((s) => s.__nice_modals);\\n const dispatch = useDispatch();\\n return (\\n \\n

    NOTE: open dev console or Redux dev tools to see actions log.

    \\n {\\n NiceModal.show(MyAntdModal, { name: 'Redux' });\\n }}\\n >\\n Show Modal\\n \\n
    \\n );\\n};\\n\\nexport default function ReduxIntegration({ children }) {\\n return (\\n \\n {children}\\n \\n );\\n}\\n\";","export default \"import { Modal, Button } from 'antd';\\nimport NiceModal, { useModal, ModalDef } from '@ebay/nice-modal-react';\\n\\nexport const MyAntdModal = NiceModal.create(({ name }) => {\\n const modal = useModal();\\n return (\\n \\n Greetings: {name}!\\n \\n );\\n});\\n\\nexport default function AntdSample() {\\n return (\\n <>\\n \\n \\n \\n );\\n}\\n\";","export default \"import { useEffect, useState } from 'react';\\nimport { Modal, Button } from 'antd';\\nimport NiceModal, { useModal, ModalHolder } from '@ebay/nice-modal-react';\\n\\nexport const MyAntdModal = NiceModal.create(({ time }) => {\\n const modal = useModal();\\n return (\\n \\n Time: {time}\\n \\n );\\n});\\n\\nexport default function Example() {\\n const [time, setTime] = useState(0);\\n useEffect(() => {\\n const p = setInterval(() => setTime((t) => t + 1), 1000);\\n return () => clearInterval(p);\\n }, []);\\n\\n // modalHandler will be assign show/hide method.\\n const modalHandler = {};\\n\\n return (\\n <>\\n \\n \\n \\n );\\n}\\n\";","import { useCallback } from 'react';\nimport { Form, Modal } from 'antd';\nimport FormBuilder from 'antd-form-builder';\nimport NiceModal, { useModal, antdModal } from '@ebay/nice-modal-react';\n\nexport default NiceModal.create(({ user }) => {\n const modal = useModal();\n const [form] = Form.useForm();\n const meta = {\n initialValues: user,\n fields: [\n { key: 'name', label: 'Name', required: true },\n { key: 'job', label: 'Job Title', required: true },\n ],\n };\n\n const handleSubmit = useCallback(() => {\n form.validateFields().then(() => {\n const newUser = { ...form.getFieldsValue() };\n // In real case, you may call API to create user or update user\n if (!user) {\n newUser.id = String(Date.now());\n } else {\n newUser.id = user.id;\n }\n modal.resolve(newUser);\n modal.hide();\n });\n }, [modal, user, form]);\n return (\n \n
    \n \n \n \n );\n});\n","const data = [\n {\n id: '1',\n name: 'Kennedy',\n job: 'Chief Mobility Orchestrator',\n city: 'North Alec',\n },\n {\n id: '2',\n name: 'Lucius',\n job: 'Internal Research Manager',\n city: 'Littleland',\n },\n {\n id: '3',\n name: 'Carlos',\n job: 'Lead Configuration Analyst',\n city: 'South Lillian',\n },\n {\n id: '4',\n name: 'Urban',\n job: 'Chief Operations Agent',\n city: 'Shieldshaven',\n },\n {\n id: '5',\n name: 'Katrine',\n job: 'Legacy Solutions Orchestrator',\n city: 'South Kyleigh',\n },\n];\nexport default data;\n","import { Modal, Button, Space } from 'antd';\nimport NiceModal, { useModal, antdModal } from '@ebay/nice-modal-react';\n\nconst PromiseModal = NiceModal.create(({ name }) => {\n const modal = useModal();\n const handleResolve = () => {\n modal.resolve({ resolved: true });\n };\n const handleReject = () => {\n modal.reject(new Error('Rejected'));\n modal.hide();\n };\n return (\n \n

    Choose the promise action: {name}

    \n \n \n \n \n
    \n );\n});\n\nconst ChainingModal = NiceModal.create(({ times }) => {\n const modal = useModal();\n return (\n \n \n
    \n
    \n Showed {times}/3 times.\n
    \n );\n});\n\nexport default function PromiseSample() {\n const chainingModal = useModal(ChainingModal);\n const showPromiseModal = () => {\n NiceModal.show(PromiseModal, { name: 'nate' })\n .then((res) => {\n console.log('Resolved: ', res);\n NiceModal.show(PromiseModal, { name: 'nate2' });\n })\n .catch((err) => {\n console.log('Rejected: ', err);\n });\n };\n const showChainingModal = async () => {\n for (let i = 0; i < 3; i++) {\n await chainingModal.show({ times: i + 1 });\n await chainingModal.hide();\n }\n };\n\n return (\n <>\n

    NOTE: please open dev console to see the output.

    \n \n \n\n \n \n \n );\n}\n","import { Modal, Button } from 'antd';\nimport NiceModal, { useModal, ModalDef } from '@ebay/nice-modal-react';\n\nexport const MyAntdModal = NiceModal.create(({ name }) => {\n const modal = useModal();\n return (\n \n Greetings: {name}!\n \n );\n});\n\nexport default function AntdSample() {\n return (\n <>\n \n \n \n );\n}\n","import React from 'react';\nimport Button from '@material-ui/core/Button';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogActions from '@material-ui/core/DialogActions';\nimport DialogContent from '@material-ui/core/DialogContent';\nimport DialogContentText from '@material-ui/core/DialogContentText';\nimport DialogTitle from '@material-ui/core/DialogTitle';\nimport Slide from '@material-ui/core/Slide';\nimport { TransitionProps } from '@material-ui/core/transitions';\nimport NiceModal, { useModal } from '@ebay/nice-modal-react';\n\nconst Transition = React.forwardRef(function Transition(\n props: TransitionProps & { children?: React.ReactElement },\n ref: React.Ref,\n) {\n return ;\n});\n\nconst MyMuiDialog = NiceModal.create(() => {\n const modal = useModal();\n return (\n modal.hide()}\n TransitionProps={{\n onExited: () => modal.remove(),\n }}\n >\n {\"Use Google's location service?\"}\n \n \n Let Google help apps determine location. This means sending anonymous location data to Google, even when no\n apps are running.\n \n \n \n \n \n \n \n );\n});\n\nexport default function MuiDialogSample() {\n return (\n \n );\n}\n","import { Modal, Button, Drawer, Space } from 'antd';\nimport NiceModal, { useModal } from '@ebay/nice-modal-react';\n\nexport const MyAntdModal = NiceModal.create(({ name }: { name: string }) => {\n const modal = useModal();\n return (\n \n Greetings: {name}!\n \n );\n});\n\nconst MyAntdDrawer = NiceModal.create(({ name }: { name: string }) => {\n const modal = useModal();\n return (\n {\n if (!visible) modal.remove();\n }}\n >\n Greetings: {name}!\n \n );\n});\n\nexport default function AntdSample() {\n return (\n \n \n \n \n );\n}\n","import BootstrapModal from 'react-bootstrap/Modal';\nimport Button from 'react-bootstrap/Button';\nimport NiceModal, { useModal, bootstrapDialog } from '@ebay/nice-modal-react';\n\nconst MyBootstrapDialog = NiceModal.create(({ name = 'Bootstrap' }: { name: string }) => {\n const modal = useModal();\n return (\n \n \n Modal title\n \n\n \n

    Modal body text goes here. {name}

    \n
    \n\n \n \n \n \n
    \n );\n});\nexport default function BootstrapSample() {\n return (\n <>\n \n \n );\n}\n","import { createStore, applyMiddleware, compose, combineReducers } from 'redux';\nimport { Provider, useSelector, useDispatch } from 'react-redux';\nimport NiceModal from '@ebay/nice-modal-react';\nimport { Button } from 'antd';\nimport { MyAntdModal } from './MyAntdModal';\nimport logger from 'redux-logger';\n\nconst composeEnhancers = (typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) || compose;\nconst enhancer = composeEnhancers(applyMiddleware(logger));\n\nconst store = createStore(\n combineReducers({\n __nice_modals: NiceModal.reducer,\n // other reducers...\n }),\n enhancer,\n);\n\nconst ModalsProvider = ({ children }) => {\n const modals = useSelector((s) => s.__nice_modals);\n const dispatch = useDispatch();\n return (\n \n

    NOTE: open dev console or Redux dev tools to see actions log.

    \n {\n NiceModal.show(MyAntdModal, { name: 'Redux' });\n }}\n >\n Show Modal\n \n
    \n );\n};\n\nexport default function ReduxIntegration({ children }) {\n return (\n \n {children}\n \n );\n}\n","import { useEffect, useState } from 'react';\nimport { Modal, Button } from 'antd';\nimport NiceModal, { useModal, ModalHolder } from '@ebay/nice-modal-react';\n\nexport const MyAntdModal = NiceModal.create(({ time }) => {\n const modal = useModal();\n return (\n \n Time: {time}\n \n );\n});\n\nexport default function Example() {\n const [time, setTime] = useState(0);\n useEffect(() => {\n const p = setInterval(() => setTime((t) => t + 1), 1000);\n return () => clearInterval(p);\n }, []);\n\n // modalHandler will be assign show/hide method.\n const modalHandler = {};\n\n return (\n <>\n \n \n \n );\n}\n","import NiceModal from '@ebay/nice-modal-react';\nimport useHash from './useHash';\nimport CodeViewer from './CodeViewer';\nimport UserList from './UserList';\nimport './App.css';\nimport PromiseSample from './PromiseSample';\nimport Declarative from './Declarative';\nimport MyMuiDialog from './MyMuiDialog';\nimport MyAntdModal from './MyAntdModal';\nimport MyBootstrapDialog from './MyBootstrapDialog';\nimport ReduxIntegration from './ReduxIntegration';\nimport PropsBinding from './PropsBinding';\n\nconst examples = {\n real: {\n name: 'Real Case',\n component: UserList,\n description: 'Show a dialog to create a new user or edit user info.',\n code: ['UserList.jsx', 'UserInfoModal.jsx'],\n },\n mui: {\n name: 'Material UI',\n description: 'Show material UI dialog',\n component: MyMuiDialog,\n code: ['MyMuiDialog.tsx'],\n },\n antd: {\n name: 'Ant Design',\n description: 'Show/hide antd modal or drawer.',\n component: MyAntdModal,\n code: ['MyAntdModal.tsx'],\n },\n bootstrap: {\n name: 'Bootstrap React',\n descript: 'Show/hide bootstrap dialog.',\n component: MyBootstrapDialog,\n code: ['MyBootstrapDialog.tsx'],\n },\n promise: {\n name: 'Promise',\n description: 'Use promise to interact with the dialog.',\n component: PromiseSample,\n code: ['PromiseSample.jsx'],\n },\n declarative: {\n name: 'Declarative',\n description: 'Declarative way to register a modal with id.',\n component: Declarative,\n code: ['Declarative.jsx'],\n },\n propsBinding: {\n name: 'Props Binding',\n description: 'To bind props to modal, need to declare the modal using jsx.',\n component: PropsBinding,\n code: ['PropsBinding.jsx'],\n },\n redux: {\n name: 'Redux Integration',\n description:\n 'Use Redux to manage modals state so that you can use Redux dev tools to debug nice modals.',\n component: ReduxIntegration,\n code: ['ReduxIntegration.jsx'],\n },\n};\n\nfunction App() {\n const current = useHash() || 'real';\n\n const renderExample = () => {\n const item = examples[current];\n if (!item || !item.component) {\n return Error: example \"{current}\" not found.;\n }\n const Comp = item.component;\n return (\n <>\n

    \n {item.name}\n

    {item.description}

    \n

    \n \n \n );\n };\n const example = examples[current] || {};\n const ele = (\n
    \n
    \n

    \n @ebay/nice-modal-react\n Examples\n

    \n
    \n \n
    \n
    \n \n \n \n
    \n \n \"api\n \n
    \n \n \n \n
    \n
    \n
    \n
    {renderExample()}
    \n
    \n {example.code?.map((f) => (\n \n ))}\n
    \n
    \n
    \n );\n\n if (current === 'redux') return ele;\n else return {ele};\n}\n\nexport default App;\n","import { useMemo, useCallback, useState } from 'react';\nimport { Button, Table } from 'antd';\nimport { EditOutlined } from '@ant-design/icons';\nimport { useModal } from '@ebay/nice-modal-react';\nimport UserInfoModal from './UserInfoModal';\nimport mockData from './mock';\n\nexport default function UserList() {\n const userModal = useModal(UserInfoModal);\n const [users, setUsers] = useState(mockData);\n\n const handleNewUser = useCallback(() => {\n userModal.show().then((newUser) => {\n setUsers([newUser, ...users]);\n });\n }, [userModal, users]);\n\n const handleEditUser = useCallback(\n (user) => {\n userModal.show({ user }).then((newUser) => {\n setUsers((users) => {\n // Modify users immutablly\n const i = users.findIndex((u) => u.id === newUser.id);\n const updated = { ...users[i], ...newUser };\n const arr = [...users];\n arr.splice(i, 1, updated);\n return arr;\n });\n });\n },\n [userModal],\n );\n\n const columns = useMemo(\n () => [\n {\n title: 'Name',\n dataIndex: 'name',\n width: '150px',\n },\n {\n title: 'Job Title',\n dataIndex: 'job',\n },\n {\n title: 'Edit',\n width: '100px',\n render(value, user) {\n return (\n }\n onClick={() => {\n handleEditUser(user);\n }}\n />\n );\n },\n },\n ],\n [handleEditUser],\n );\n\n return (\n
    \n \n \n
    \n );\n}\n","import { ReportHandler } from 'web-vitals';\n\nconst reportWebVitals = (onPerfEntry?: ReportHandler) => {\n if (onPerfEntry && onPerfEntry instanceof Function) {\n import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {\n getCLS(onPerfEntry);\n getFID(onPerfEntry);\n getFCP(onPerfEntry);\n getLCP(onPerfEntry);\n getTTFB(onPerfEntry);\n });\n }\n};\n\nexport default reportWebVitals;\n","import React from 'react';\nimport ReactDOM from 'react-dom';\nimport './index.css';\nimport App from './App';\nimport reportWebVitals from './reportWebVitals';\nimport 'bootstrap/dist/css/bootstrap.min.css';\nimport 'antd/dist/antd.css';\n\nReactDOM.render(, document.getElementById('root'));\n\n// If you want to start measuring performance in your app, pass a function\n// to log results (for example: reportWebVitals(console.log))\n// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals\nreportWebVitals();\n"],"sourceRoot":""} \ No newline at end of file