1.0.0 • Published 3 years ago

ant-design-draggable-modal-4 v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

Modal from Ant Design, draggable.

Version Downloads BundlePhobia MIT License

Watch on GitHub Star on GitHub Tweet

🌎 Example

✨ Features

  • Drag with title bar.
  • Resize with handle.
  • Keep in bounds.
    • During drag.
    • During resize.
    • During resize window.
  • Multiple modals with managed zIndex.
  • Open from center.
  • Better API for using as a controlled component.
  • Open from quadrants.
  • Better escape key management.
  • Resize with option key.

📦 Install

yarn add ant-design-draggable-modal

NOTE: You must use react@16.8.0 and react-dom@16.8.0 or higher.

🔨 Usage

import React, { useState, useCallback } from 'react'
import { Button } from 'antd'
import { DraggableModal, DraggableModalProvider } from 'ant-design-draggable-modal'
import 'antd/dist/antd.css'
import 'ant-design-draggable-modal/dist/index.css'

const ModalWithButton = () => {
    const [visible, setVisible] = useState(false)
    const onOk = useCallback(() => setVisible(true), [])
    const onCancel = useCallback(() => setVisible(false), [])
    return (
        <>
            <Button onClick={onOk}>Open</Button>
            <DraggableModal visible={visible} onOk={onOk} onCancel={onCancel}>
                Body text.
            </DraggableModal>
        </>
    )
}

// DraggableModalProvider manages the zIndex
// of DraggableModals rendered beneath it.
const App = () => (
    <DraggableModalProvider>
        <ModalWithButton />
        <ModalWithButton />
        <ModalWithButton />
    </DraggableModalProvider>
)

⚠️ User Experience Warning

You should probably try to design your app not to need to use this, apps should usually not be window managers.

License

MIT © DylanVann

ababacorn-jsxacornacorn-walkansi-colorsansi-escapesansi-regexajvansi-stylesanymatchant-design-draggable-modalaria-queryarr-diffarr-flattenarr-unionarray-equalarray-includesarray-tree-filterarray.prototype.flatarray-uniquearray.prototype.flatmapasn1assert-plusassign-symbolsastral-regexasynckitasync-validatorasyncroat-least-nodeatobaws-sign2aws4axe-coreaxobject-querybabel-eslintbabel-jestacorn-globalsbabel-plugin-annotate-pure-callsast-types-flowbabel-plugin-istanbulbabel-plugin-dev-expressionbabel-plugin-macrosbabel-plugin-polyfill-corejs2argparsebabel-plugin-polyfill-corejs3babel-plugin-polyfill-regeneratorbabel-plugin-transform-rename-importbasebluebirdbalanced-matchbrace-expansionbracesbabel-preset-jestbabel-plugin-dynamic-import-nodebrowser-process-hrtimebrowser-resolvebrowserslistbs-loggerbuffer-frombuiltin-modulescache-basecallsitescall-bindbabel-plugin-jest-hoistcamelcasecaniuse-litebcrypt-pbkdfcaselesschalkci-infoclassnamesclass-utilscli-cursorcli-spinnersbabel-preset-current-node-syntaxclonecocollect-v8-coveragecollection-visitchardetcolor-namecolor-convertbsercombined-streamcommandercommondircomponent-emittercapture-exitcompute-scroll-into-viewcli-widthconcat-mapcontains-pathconfusing-browser-globalsconvert-source-mapcopy-descriptorcopy-to-clipboardcore-js-compatcore-util-iscore-js-purecssomcssstylecsstypecliuidamerau-levenshteindata-urlsdebugdate-fnsdecamelizedecode-uri-componentdeepmergedefaultsdefine-propertiesdefine-propertycolorettedelayed-streamdetect-newlinediff-sequencesdoctrinedom-accessibility-apidom-aligncosmiconfigdomexceptionecc-jsbnelectron-to-chromiumemoji-regexend-of-streamcross-spawnenquirererror-exes-abstractes-to-primitiveescape-string-regexpeslinteslint-config-prettierdashdasheslint-config-react-appeslint-module-utilseslint-plugin-importeslint-plugin-flowtypeeslint-plugin-prettiereslint-plugin-jsx-a11yeslint-plugin-reacteslint-plugin-react-hooksdeep-iseslint-scopeeslint-utilsescaladeeslint-visitor-keysespreeesqueryesrecurseestraverseestree-walkeresutilsescodegenexecaeslint-import-resolver-nodeexitexpand-bracketsexpectextendextend-shallowextglobextsprintffast-difffast-deep-equalfast-json-stable-stringifyfast-levenshteinfb-watchmanfile-entry-cachefill-rangefind-upfor-inesprimaforever-agentform-datafiguresfragment-cacheexternal-editorexec-shfind-cache-dirfs-extrafs.realpathgensyncfunction-bindfunctional-red-black-treeget-intrinsicget-streamget-valueglobflat-cacheglob-parentglobalsglobalyzerglobrexflattedgraceful-fshar-schemahar-validatorgetpasshashas-flagget-stdinhas-symbolshas-valuehoist-non-react-staticshas-valuesget-caller-filehtml-encoding-sniffergrowlyhttp-signaturehuman-signalsiconv-liteget-package-typeignoreimport-freshimport-localimurmurhashinflighthas-bigintsinheritshosted-git-infoinquirerhtml-escaperinternal-slotip-regexis-accessor-descriptoris-arrayishis-bufferis-callableis-cihumanize-durationis-core-moduleis-data-descriptoris-date-objectis-extendableis-descriptoris-extglobis-fullwidth-code-pointis-generator-fnis-globis-interactiveis-moduleis-numberinterpretis-plain-objectis-bigintis-referenceis-regexis-streamis-stringis-symbolis-boolean-objectis-typedarrayis-windowsisarrayis-dockerisexeisobjectistanbul-lib-coverageisstreamistanbul-lib-instrumentistanbul-lib-source-mapsistanbul-lib-reportis-negative-zeroistanbul-reportsjestis-number-objectjest-clijest-changed-filesjest-configjest-diffjest-docblockjest-eachjest-environment-jsdomjest-haste-mapjest-environment-nodejest-get-typejest-jasmine2jest-leak-detectorjest-matcher-utilsjest-message-utiljest-mockjest-pnp-resolverjest-regex-utiljest-resolvejest-resolve-dependenciesjest-runnerjest-runtimejest-serializerjest-snapshotjest-utiljest-validatejest-watch-typeaheadjest-watcherjest-workerjpjsjs-tokensjs-yamljsbnjsdomis-wsljsescjson-schemajson-schema-traversejson-stable-stringify-without-jsonifyjson-stringify-safejson2mqjson5jsonfilejsprimjsx-ast-utilskind-oflanguage-subtag-registrylanguage-tagslevenlevnload-json-filelocate-pathlodashlodash.debouncelodash.memoizelodash.mergelodash.sortbylog-symbolslog-updatelolexlower-caselru-cachelz-stringmake-dirmagic-stringjson-parse-even-better-errorsmake-errorkleurmakeerrormap-cachelines-and-columnsmap-visitmerge-streammicromatchmime-dbmime-typesmimic-fnmini-storeminimatchminimistmkdirpmixin-deepmomentmrimsnanomatchmute-streamnatural-compareno-casenode-modules-regexpnode-notifiernode-releasesnpm-run-pathnormalize-pathnwsapioauth-signobject-assignobject-copyloose-envifyobject-inspectobject-keysobject-visitnode-int64object.assignobject.entriesobject.fromentriesobject.pickobject.valuesonceonetimeorap-each-seriesp-limitp-locatep-tryparent-modulenice-tryparse5pascal-casepascalcasepath-existsnormalize-package-datapath-is-absolutepath-typeperformance-nowpicomatchpifyos-tmpdiroptionatorp-finallypnposix-character-classesprelude-lspiratesprettierparse-jsonprettier-linter-helperspretty-formatprogress-estimatorpromptsprop-typespslpumpqsrandombytesrc-alignpath-keyrc-cascaderrc-checkboxpath-parserc-collapserc-dialogrc-drawerrc-dropdownrc-field-formrc-imagerc-input-numberpkg-dirrc-mentionsrc-menurc-motionrc-notificationrc-overflowrc-paginationrc-pickerrc-progressrc-resize-observerrc-selectrc-raterc-sliderrc-stepspunycodeprogressrc-switchrc-tablerc-tabsrc-tooltiprc-textarearc-treerc-tree-selectrc-triggerrc-uploadrc-utilrc-virtual-listreact-isreact-uidread-pkgread-pkg-uprealpath-nativeregenerateregenerator-runtimeregenerator-transformregex-notregexp.prototype.flagsregexpu-coreregexppregjsgenregjsparserremove-trailing-separatorrepeat-elementrepeat-stringrequestrequest-promise-corerequest-promise-nativerequire-directoryrequire-main-filenameresize-observer-polyfillresolverestore-cursorretrimrafrolluprollup-plugin-sourcemapsrechoirrollup-plugin-terserrollup-pluginutilsregenerate-unicode-propertiessadesafe-buffersafe-regexresolve-cwdresolve-fromrun-asyncsafer-buffersanesaxesschedulerscroll-into-view-if-neededresolve-urlsemverserialize-javascriptset-blockingset-valueshallowequalshelljsslashside-channelsignal-exitsnapdragonrsvpshebang-commandshebang-regexrxjssnapdragon-nodesnapdragon-utilsource-mapsisteransisource-map-resolveshellwordssource-map-supportsourcemap-codecsource-map-urlsplitsplit-stringsshpkstack-utilsstatic-extendslice-ansispdx-exceptionsstealthy-requirestring-convertstring-lengthspdx-correctstring-widthstring.prototype.matchallspdx-expression-parsestrip-ansistrip-bomstrip-json-commentsstrip-final-newlinesupports-colorsupports-hyperlinkssymbol-treespdx-license-idssprintf-jsterminal-linktersertext-tablethroatthroughstring.prototype.trimendtiny-globtmptmplstring.prototype.trimstartstrip-eofto-fast-propertiesto-object-pathto-regextoggle-selectionto-regex-rangetough-cookietr46tsconfig-pathstsdxtslibtsutilstabletunnel-agenttweetnacltype-checktype-festtype-detecttypedarray-to-bufferunicode-canonical-property-names-ecmascriptunicode-match-property-ecmascriptunicode-match-property-value-ecmascripttest-excludeunicode-property-aliases-ecmascriptunion-valueuniversalifyunset-valueuri-jsurixuseuuidv8-to-istanbulverrorw3c-hr-timew3c-xmlserializerwalkerwarningwcwidthwebidl-conversionswhatwg-encodingwhatwg-mimetypewhatwg-urlwhichwhich-modulewrappyunbox-primitivewrite-file-atomicwsxml-name-validatorv8-compile-cachexmlcharsvalidate-npm-package-licensey18nwhich-boxed-primitiveyallistyargsyargs-parserword-wrapwritewrap-ansiyaml
1.0.0

3 years ago