From d923ffdf9e083d1402152f0b2d979a21c12a33e2 Mon Sep 17 00:00:00 2001 From: Evan Jacobs <570070+probablyup@users.noreply.github.com> Date: Fri, 4 Jun 2021 11:59:58 -0400 Subject: [PATCH] add bundled typings (#1) --- .eslintignore | 1 + index.d.ts | 26 ++++++++++++++++++++++++++ package.json | 2 ++ yarn.lock | 32 ++++++++++++++++---------------- 4 files changed, 45 insertions(+), 16 deletions(-) create mode 100644 index.d.ts diff --git a/.eslintignore b/.eslintignore index 5f98501..a5d5fc5 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1 +1,2 @@ dist/*.js +index.d.ts diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..ffc3bfe --- /dev/null +++ b/index.d.ts @@ -0,0 +1,26 @@ +import { TextFieldProps } from "@material-ui/core"; +import * as React from "react"; + +export type MuiPhoneNumberProps = TextFieldProps & { + autoFormat?: boolean; + classes?: any; + countryCodeEditable?: boolean; + defaultCountry?: string; + disableAreaCodes?: boolean; + disableCountryCode?: boolean; + disableDropdown?: boolean; + dropdownClass?: string; + enableLongNumbers?: boolean; + excludeCountries?: string[]; + inputClass?: string; + onChange: ( + e: React.ChangeEvent | string + ) => void; + onlyCountries?: string[]; + preferredCountries?: string[]; + regions?: [string] | string; +}; + +declare const MuiPhoneNumber: React.FC; + +export default MuiPhoneNumber; diff --git a/package.json b/package.json index d84a9b9..bfc3c29 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "2.2.6", "description": "A material-ui react component to format phone numbers. Based on react-phone-input-2", "main": "dist/index.js", + "types": "index.d.ts", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "dev": "webpack-dev-server --config webpack.config.dev.js --hot --progress --mode development", @@ -30,6 +31,7 @@ "@babel/plugin-proposal-object-rest-spread": "^7.5.4", "@babel/preset-env": "^7.14.2", "@babel/preset-react": "^7.13.13", + "@types/react": "^17.0.8", "babel-eslint": "^10.0.3", "babel-loader": "^8.2.2", "babel-plugin-lodash": "^3.3.4", diff --git a/yarn.lock b/yarn.lock index 1500c23..7fc535c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1165,9 +1165,9 @@ integrity sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ== "@types/node@*": - version "16.7.5" - resolved "https://registry.yarnpkg.com/@types/node/-/node-16.7.5.tgz#96142b243977b03d99c338fdb09241d286102711" - integrity sha512-E7SpxDXoHEpmZ9C1gSqwadhE6zPRtf3g0gJy9Y51DsImnR5TcDs3QEiV/3Q7zOM8LWaZp5Gph71NK6ElVMG1IQ== + version "16.7.6" + resolved "https://registry.yarnpkg.com/@types/node/-/node-16.7.6.tgz#8666478db8095aa66e25b7e469f3e7b53ea2855e" + integrity sha512-VESVNFoa/ahYA62xnLBjo5ur6gPsgEE5cNRy8SrdnkZ2nwJSW0kJ4ufbFr2zuU9ALtHM8juY53VcRoTA7htXSg== "@types/parse-json@^4.0.0": version "4.0.0" @@ -1198,7 +1198,7 @@ dependencies: "@types/react" "*" -"@types/react@*": +"@types/react@*", "@types/react@^17.0.8": version "17.0.19" resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.19.tgz#8f2a85e8180a43b57966b237d26a29481dacc991" integrity sha512-sX1HisdB1/ZESixMTGnMxH9TDe8Sk709734fEQZzCV/4lSu9kJCPbo2PbTRoZM+53Pp0P10hYVyReUueGwUi4A== @@ -2419,17 +2419,17 @@ copy-descriptor@^0.1.0: integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= core-js-compat@^3.14.0, core-js-compat@^3.16.0: - version "3.16.3" - resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.16.3.tgz#ae12a6e20505a1d79fbd16b6689dfc77fc989114" - integrity sha512-A/OtSfSJQKLAFRVd4V0m6Sep9lPdjD8bpN8v3tCCGwE0Tmh0hOiVDm9tw6mXmWOKOSZIyr3EkywPo84cJjGvIQ== + version "3.16.4" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.16.4.tgz#cf28abe0e45a43645b04b2c1a073efa03d0b3b26" + integrity sha512-IzCSomxRdahCYb6G3HiN6pl3JCiM0NMunRcNa1pIeC7g17Vd6Ue3AT9anQiENPIm/svThUVer1pIbLMDERIsFw== dependencies: browserslist "^4.16.8" semver "7.0.0" core-js-pure@^3.16.0: - version "3.16.3" - resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.16.3.tgz#41ccb9b6027535f8dd51a0af004c1c7f0a8c9ca7" - integrity sha512-6In+2RwN0FT5yK0ZnhDP5rco/NnuuFZhHauQizZiHo5lDnqAvq8Phxcpy3f+prJOqtKodt/cftBl/GTOW0kiqQ== + version "3.16.4" + resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.16.4.tgz#8b23122628d88c560f209812b9b2d9ebbce5e29c" + integrity sha512-bY1K3/1Jy9D8Jd12eoeVahNXHLfHFb4TXWI8SQ4y8bImR9qDPmGITBAfmcffTkgUvbJn87r8dILOTWW5kZzkgA== core-util-is@~1.0.0: version "1.0.2" @@ -2925,9 +2925,9 @@ domelementtype@^2.0.1, domelementtype@^2.2.0: integrity sha512-DtBMo82pv1dFtUmHyr48beiuq792Sxohr+8Hm9zoxklYPfa6n0Z3Byjj2IV7bmr2IyqClnqEQhfgHJJ5QF0R5A== domhandler@^4.0.0, domhandler@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-4.2.0.tgz#f9768a5f034be60a89a27c2e4d0f74eba0d8b059" - integrity sha512-zk7sgt970kzPks2Bf+dwT/PLzghLnsivb9CcxkvR8Mzr66Olr0Ofd8neSbglHJHaHa2MadfoSdNlKYAaafmWfA== + version "4.2.2" + resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-4.2.2.tgz#e825d721d19a86b8c201a35264e226c678ee755f" + integrity sha512-PzE9aBMsdZO8TK4BnuJwH0QT41wgMbRzuZrHUcpYncEjmQazq8QEaBWgLG7ZyC/DAZKEgglpIA6j4Qn/HmxS3w== dependencies: domelementtype "^2.2.0" @@ -3559,9 +3559,9 @@ find-cache-dir@^2.1.0: pkg-dir "^3.0.0" find-cache-dir@^3.3.1: - version "3.3.1" - resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-3.3.1.tgz#89b33fad4a4670daa94f855f7fbe31d6d84fe880" - integrity sha512-t2GDMt3oGC/v+BMwzmllWDuJF/xcDtE5j/fCGbqDD7OLuJkj0cfh1YSA5VKPvwMeLFLNDBkwOKZ2X85jGLVftQ== + version "3.3.2" + resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-3.3.2.tgz#b30c5b6eff0730731aea9bbd9dbecbd80256d64b" + integrity sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig== dependencies: commondir "^1.0.1" make-dir "^3.0.2"