1.0.2 • Published 3 years ago

ant-design-draggable-modal-fix-2 v1.0.2

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-jsxacorn-globalsacornacorn-walkant-design-draggable-modalansi-colorsaria-queryansi-escapesansi-stylesajvanymatchansi-regexargparsearr-unionarray-equalarr-diffarray-tree-filterarray-includesarr-flattenarray-uniquearray.prototype.flatassert-plusasn1array.prototype.flatmapassign-symbolsast-types-flowastral-regexasync-validatorasynckitatobasyncroaws-sign2at-least-nodeaxobject-querybabel-eslintbabel-jestaxe-coreaws4babel-plugin-dynamic-import-nodebabel-plugin-istanbulbabel-plugin-annotate-pure-callsbabel-plugin-dev-expressionbabel-plugin-macrosbabel-plugin-polyfill-corejs2babel-plugin-polyfill-corejs3babel-plugin-jest-hoistbabel-plugin-polyfill-regeneratorbabel-preset-jestbabel-plugin-transform-rename-importbabel-preset-current-node-syntaxbcrypt-pbkdfbalanced-matchbasebluebirdbrowser-process-hrtimebracesbrace-expansionbrowser-resolvebs-loggerbuffer-frombserbuiltin-modulesbrowserslistcache-basecall-bindcallsitescaniuse-litecamelcasecapture-exitchalkclass-utilschardetcaselessclassnamescli-cursorci-infocli-widthcocli-spinnerscollect-v8-coveragecollection-visitclonecliuicolor-namecombined-streamcomponent-emittercolor-convertcolorettecommandercommondircompute-scroll-into-viewconfusing-browser-globalsconcat-mapconvert-source-mapcontains-pathcopy-to-clipboardcore-util-iscopy-descriptorcore-js-purecsstypecore-js-compatcssomcosmiconfigdashdashcssstylecross-spawndamerau-levenshteindata-urlsdate-fnsdebugdecamelizedecode-uri-componentdeep-isdefine-propertydefine-propertiesdefaultsdeepmergedelayed-streamdetect-newlinediff-sequencesdoctrinedom-accessibility-apidom-aligndomexceptionemoji-regexecc-jsbnelectron-to-chromiumend-of-streamenquirererror-exes-to-primitiveescape-string-regexpescaladees-abstractescodegeneslinteslint-import-resolver-nodeeslint-config-react-appeslint-module-utilseslint-plugin-flowtypeeslint-config-prettiereslint-plugin-jsx-a11yeslint-plugin-importeslint-plugin-prettiereslint-plugin-reacteslint-plugin-react-hookseslint-scopeeslint-utilsespreeeslint-visitor-keysesqueryesprimaesrecurseestree-walkerestraverseexitesutilsexecaexec-shexpand-bracketsexternal-editorexpectextsprintfextendextend-shallowfast-diffextglobfast-json-stable-stringifyfast-deep-equalfb-watchmanfill-rangefiguresfast-levenshteinfile-entry-cacheflat-cachefind-cache-dirflattedforever-agentfor-infind-upfs.realpathfragment-cacheform-datafs-extrafunctional-red-black-treefunction-bindgensyncget-caller-fileget-stdinget-package-typeget-streamget-intrinsicgetpassget-valueglobrexglobalyzerglobglob-parentglobalsgraceful-fshar-schemagrowlyhas-bigintshas-flaghashar-validatorhas-symbolshas-valuehoist-non-react-staticshas-valueshtml-encoding-snifferhtml-escaperhttp-signaturehosted-git-infoiconv-litehuman-signalshumanize-durationimport-freshignoreimport-localinheritsimurmurhashinflightinquirerinternal-slotis-arrayiship-regexis-bigintis-accessor-descriptorinterpretis-boolean-objectis-bufferis-callableis-ciis-core-moduleis-date-objectis-data-descriptoris-descriptoris-dockeris-extendableis-extglobis-fullwidth-code-pointis-moduleis-generator-fnis-globis-interactiveis-numberis-negative-zerois-number-objectis-plain-objectis-regexis-referenceis-stringis-streamistanbul-lib-coverageis-symbolis-windowsis-typedarrayistanbul-lib-reportis-wslisexeistanbul-lib-instrumentisarrayisstreamisobjectjest-changed-filesistanbul-reportsjestjest-clijest-configjest-diffistanbul-lib-source-mapsjest-docblockjest-eachjest-get-typejest-environment-jsdomjest-haste-mapjest-environment-nodejest-jasmine2jest-leak-detectorjest-matcher-utilsjest-mockjest-regex-utiljest-resolvejest-message-utiljest-resolve-dependenciesjest-pnp-resolverjest-runnerjest-serializerjest-validatejest-runtimejest-snapshotjest-utiljest-watch-typeaheadjest-workerjest-watcherjpjsjs-tokensjsbnjs-yamljsdomjsescjson-parse-even-better-errorsjson-schemajson-schema-traversejson-stringify-safejson2mqjson-stable-stringify-without-jsonifyjsprimjsx-ast-utilskleurjsonfilejson5language-subtag-registrylanguage-tagslevnkind-oflevenload-json-filelocate-pathlodash.sortbylines-and-columnslodash.debouncelodashlodash.mergelog-updatelodash.memoizelog-symbolslolexloose-envifylower-caselru-cachemagic-stringmake-errorlz-stringmakeerrormake-dirmap-cachemerge-streammap-visitmicromatchmime-dbmomentmimic-fnmime-typesmini-storeminimatchminimistmkdirpmixin-deepmute-streammrimsnatural-comparenice-trynanomatchnode-int64no-casenode-releasesnode-modules-regexpnode-notifiernormalize-pathoauth-signnormalize-package-datanwsapiobject-copynpm-run-pathobject-assignobject-inspectobject-keysobject-visitonceobject.pickobject.entriesobject.assignobject.valuesobject.fromentriesonetimeos-tmpdiroptionatororap-each-seriesp-tryp-finallyp-locateparent-modulep-limitpascal-caseparse5parse-jsonpath-is-absolutepascalcasepath-parsepath-keypath-existspath-typepicomatchpifypnperformance-nowposix-character-classespkg-dirprop-typespiratesprettierprelude-lspretty-formatprettier-linter-helpersprogresspumppromptsrc-dialogprogress-estimatorpunycodepslrc-cascaderrc-alignrc-field-formqsrc-imagerc-input-numberrc-mentionsrandombytesrc-menurc-checkboxrc-drawerrc-motionrc-notificationrc-pickerrc-selectrc-dropdownrc-collapserc-tablerc-paginationrc-progressrc-tooltiprc-overflowrc-tabsrc-textarearc-tree-selectrc-treerc-uploadrc-raterc-triggerrc-utilrc-virtual-listreact-uidrc-resize-observerrc-sliderreact-isrc-switchrc-stepsread-pkgrealpath-nativeread-pkg-upregenerator-runtimerechoirregenerateregenerate-unicode-propertiesregenerator-transformregex-notregexp.prototype.flagsregexpu-coreregexppregjsgenregjsparserremove-trailing-separatorrepeat-stringrepeat-elementrequest-promise-nativerequestrequire-directoryrequest-promise-corerequire-main-filenameresolveresize-observer-polyfillresolve-cwdresolve-fromresolve-urlrimrafretrestore-cursorrollup-plugin-sourcemapsrollup-plugin-terserrolluprun-asyncschedulerrollup-pluginutilsrsvpscroll-into-view-if-neededsafe-buffersafer-bufferrxjssemversanesadesafe-regexsaxesserialize-javascriptset-blockingset-valueshebang-commandshebang-regexshallowequalshelljsside-channelsisteransislashshellwordssignal-exitslice-ansisnapdragon-utilsnapdragonsnapdragon-nodesource-mapsource-map-resolvesourcemap-codecsource-map-urlsource-map-supportspdx-correctspdx-exceptionsspdx-expression-parsespdx-license-idssplitsplit-stringsprintf-jsstring-convertsshpkstatic-extendstealthy-requirestack-utilsstring-lengthstring-widthstring.prototype.trimendstrip-ansistring.prototype.trimstartstring.prototype.matchallstrip-bomstrip-eofstrip-json-commentsstrip-final-newlinesupports-hyperlinkstersersymbol-treesupports-colortest-excludethroattabletext-tableterminal-linktiny-globthroughtmplto-object-pathtmpto-regexto-fast-propertiesto-regex-rangetoggle-selectiontr46tsconfig-pathstslibtough-cookietunnel-agenttype-checktsutilstweetnacltsdxtypedarray-to-buffertype-festtype-detectunicode-canonical-property-names-ecmascriptunicode-match-property-ecmascriptunbox-primitiveunset-valueuniversalifyunion-valueunicode-match-property-value-ecmascriptunicode-property-aliases-ecmascripturixuuidusev8-compile-cacheverroruri-jsv8-to-istanbulvalidate-npm-package-licensewalkerwarningw3c-hr-timew3c-xmlserializerwebidl-conversionswcwidthwhatwg-encodingwhatwg-urlwhatwg-mimetypewhichwhich-boxed-primitivewhich-modulewrap-ansiword-wrapwrappyyargs-parserwritewrite-file-atomicwsxml-name-validatorxmlcharsy18nyamlyallistyargs
1.0.2

3 years ago

1.0.1

3 years ago