From 28bf2796e5a2664370d3494fd637fff9b8517dfa Mon Sep 17 00:00:00 2001 From: ndom91 Date: Wed, 29 Mar 2023 17:24:45 +0200 Subject: [PATCH] feat: move react-select to peer dep --- .github/ISSUE_TEMPLATE/config.yml | 5 +- .npmrc | 1 + package.json | 6 +- pnpm-lock.yaml | 191 +++++++++++++++++------------- src/index.d.ts | 20 ---- src/index.tsx | 102 ++++++++-------- src/timezone-list.d.ts | 3 - src/types/globals.d.ts | 1 - src/types/timezone.d.ts | 21 ---- tsconfig.json | 1 + 10 files changed, 168 insertions(+), 183 deletions(-) delete mode 100644 src/index.d.ts delete mode 100644 src/timezone-list.d.ts delete mode 100644 src/types/globals.d.ts delete mode 100644 src/types/timezone.d.ts diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 279466a..ae1afd2 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,7 +1,4 @@ contact_links: - - name: 💬 Nico's Contact Links - url: https://ndo.dev - about: Want to discuss / chat with the community? Here you go! - - name: ⁉️ Why and How to make a reproduction? + - name: ⁉️ Why and how to make a reproduction? url: https://antfu.me/posts/why-reproductions-are-required about: Reproduction is very important for maintainer to help on your issues! diff --git a/.npmrc b/.npmrc index 6c59086..23091ca 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1,2 @@ enable-pre-post-scripts=true +auto-install-peers = true diff --git a/package.json b/package.json index dbbe3a7..5dd487e 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-timezone-select", - "version": "1.5.6", + "version": "2.0.0", "description": "Usable, dynamic React Timezone Select", "scripts": { "dev": "concurrently \"tsup src/index.tsx --format esm --watch\" \"cd example && pnpm dev\"", @@ -48,10 +48,10 @@ }, "peerDependencies": { "react": "^18 || ^17.0.1 || ^16", - "react-dom": "^18 || ^17.0.1 || ^16" + "react-dom": "^18 || ^17.0.1 || ^16", + "react-select": "^5.7.0" }, "dependencies": { - "react-select": "^5.7.0", "spacetime": "^7.4.1", "timezone-soft": "^1.4.1" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6777054..4b4c85f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -28,7 +28,7 @@ specifiers: typescript: ^4.5.5 dependencies: - react-select: 5.7.0_crofjw4wgu3s56yfd4j5czcwki + react-select: 5.7.2_nn45z5sr7igu7sfun6tiae5hx4 spacetime: 7.4.1 timezone-soft: 1.4.1 @@ -64,6 +64,7 @@ packages: dependencies: '@jridgewell/gen-mapping': 0.1.1 '@jridgewell/trace-mapping': 0.3.14 + dev: true /@babel/code-frame/7.18.6: resolution: {integrity: sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==} @@ -74,6 +75,7 @@ packages: /@babel/compat-data/7.21.0: resolution: {integrity: sha512-gMuZsmsgxk/ENC3O/fRw5QY8A9/uxQbbCEypnLIiYYc/qVJtEV7ouxC3EllIIwNzMqAQee5tanFabWsUOutS7g==} engines: {node: '>=6.9.0'} + dev: true /@babel/core/7.21.3: resolution: {integrity: sha512-qIJONzoa/qiHghnm0l1n4i/6IIziDpzqc36FBs4pzMhDUraHqponwJLiAKm1hGLP3OSB/TVNz6rMwVGpwxxySw==} @@ -96,6 +98,7 @@ packages: semver: 6.3.0 transitivePeerDependencies: - supports-color + dev: true /@babel/generator/7.21.3: resolution: {integrity: sha512-QS3iR1GYC/YGUnW7IdggFeN5c1poPUurnGttOV/bZgPGV+izC/D8HnD6DLwod0fsatNyVn1G3EVWMYIF0nHbeA==} @@ -105,6 +108,7 @@ packages: '@jridgewell/gen-mapping': 0.3.2 '@jridgewell/trace-mapping': 0.3.17 jsesc: 2.5.2 + dev: true /@babel/helper-compilation-targets/7.20.7_@babel+core@7.21.3: resolution: {integrity: sha512-4tGORmfQcrc+bvrjb5y3dG9Mx1IOZjsHqQVUz7XCNHO+iTmqxWnVg3KRygjGmpRLJGdQSKuvFinbIb0CnZwHAQ==} @@ -118,10 +122,12 @@ packages: browserslist: 4.21.5 lru-cache: 5.1.1 semver: 6.3.0 + dev: true /@babel/helper-environment-visitor/7.18.9: resolution: {integrity: sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==} engines: {node: '>=6.9.0'} + dev: true /@babel/helper-function-name/7.21.0: resolution: {integrity: sha512-HfK1aMRanKHpxemaY2gqBmL04iAPOPRj7DxtNbiDOrJK+gdwkiNRVpCpUJYbUT+aZyemKN8brqTOxzCaG6ExRg==} @@ -129,12 +135,14 @@ packages: dependencies: '@babel/template': 7.20.7 '@babel/types': 7.21.3 + dev: true /@babel/helper-hoist-variables/7.18.6: resolution: {integrity: sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==} engines: {node: '>=6.9.0'} dependencies: '@babel/types': 7.21.3 + dev: true /@babel/helper-module-imports/7.18.6: resolution: {integrity: sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA==} @@ -156,22 +164,26 @@ packages: '@babel/types': 7.21.3 transitivePeerDependencies: - supports-color + dev: true /@babel/helper-plugin-utils/7.20.2: resolution: {integrity: sha512-8RvlJG2mj4huQ4pZ+rU9lqKi9ZKiRmuvGuM2HlWmkmgOhbs6zEAw6IEiJ5cQqGbDzGZOhwuOQNtZMi/ENLjZoQ==} engines: {node: '>=6.9.0'} + dev: true /@babel/helper-simple-access/7.20.2: resolution: {integrity: sha512-+0woI/WPq59IrqDYbVGfshjT5Dmk/nnbdpcF8SnMhhXObpTq2KNBdLFRFrkVdbDOyUmHBCxzm5FHV1rACIkIbA==} engines: {node: '>=6.9.0'} dependencies: '@babel/types': 7.21.3 + dev: true /@babel/helper-split-export-declaration/7.18.6: resolution: {integrity: sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==} engines: {node: '>=6.9.0'} dependencies: '@babel/types': 7.21.3 + dev: true /@babel/helper-string-parser/7.19.4: resolution: {integrity: sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==} @@ -184,6 +196,7 @@ packages: /@babel/helper-validator-option/7.18.6: resolution: {integrity: sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw==} engines: {node: '>=6.9.0'} + dev: true /@babel/helpers/7.21.0: resolution: {integrity: sha512-XXve0CBtOW0pd7MRzzmoyuSj0e3SEzj8pgyFxnTT1NJZL38BD1MK7yYrm8yefRPIDvNNe14xR4FdbHwpInD4rA==} @@ -194,6 +207,7 @@ packages: '@babel/types': 7.21.3 transitivePeerDependencies: - supports-color + dev: true /@babel/highlight/7.18.6: resolution: {integrity: sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==} @@ -209,6 +223,7 @@ packages: hasBin: true dependencies: '@babel/types': 7.21.3 + dev: true /@babel/plugin-syntax-async-generators/7.8.4_@babel+core@7.21.3: resolution: {integrity: sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==} @@ -255,16 +270,6 @@ packages: '@babel/helper-plugin-utils': 7.20.2 dev: true - /@babel/plugin-syntax-jsx/7.18.6_@babel+core@7.21.3: - resolution: {integrity: sha512-6mmljtAedFGTWu2p/8WIORGwy+61PLgOMPOdazc7YoJ9ZCWUyFy3A6CpPkRKLKD1ToAesxX8KGEViAiLo9N+7Q==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - dependencies: - '@babel/core': 7.21.3 - '@babel/helper-plugin-utils': 7.20.2 - dev: false - /@babel/plugin-syntax-logical-assignment-operators/7.10.4_@babel+core@7.21.3: resolution: {integrity: sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==} peerDependencies: @@ -366,6 +371,7 @@ packages: '@babel/code-frame': 7.18.6 '@babel/parser': 7.21.3 '@babel/types': 7.21.3 + dev: true /@babel/traverse/7.21.3: resolution: {integrity: sha512-XLyopNeaTancVitYZe2MlUEvgKb6YVVPXzofHgqHijCImG33b/uTurMS488ht/Hbsb2XK3U2BnSTxKVNGV3nGQ==} @@ -383,6 +389,7 @@ packages: globals: 11.12.0 transitivePeerDependencies: - supports-color + dev: true /@babel/types/7.21.3: resolution: {integrity: sha512-sBGdETxC+/M4o/zKC0sl6sjWv62WFR/uzxrJ6uYyMLZOUlPnwzw0tKgVHOXxaAd5l2g8pEDM5RZ495GPQI77kg==} @@ -405,92 +412,93 @@ packages: minimist: 1.2.8 dev: true - /@emotion/babel-plugin/11.9.2_@babel+core@7.21.3: - resolution: {integrity: sha512-Pr/7HGH6H6yKgnVFNEj2MVlreu3ADqftqjqwUvDy/OJzKFgxKeTQ+eeUf20FOTuHVkDON2iNa25rAXVYtWJCjw==} - peerDependencies: - '@babel/core': ^7.0.0 + /@emotion/babel-plugin/11.10.6: + resolution: {integrity: sha512-p2dAqtVrkhSa7xz1u/m9eHYdLi+en8NowrmXeF/dKtJpU8lCWli8RUAati7NcSl0afsBott48pdnANuD0wh9QQ==} dependencies: - '@babel/core': 7.21.3 '@babel/helper-module-imports': 7.18.6 - '@babel/plugin-syntax-jsx': 7.18.6_@babel+core@7.21.3 '@babel/runtime': 7.18.6 - '@emotion/hash': 0.8.0 - '@emotion/memoize': 0.7.5 - '@emotion/serialize': 1.0.4 - babel-plugin-macros: 2.8.0 + '@emotion/hash': 0.9.0 + '@emotion/memoize': 0.8.0 + '@emotion/serialize': 1.1.1 + babel-plugin-macros: 3.1.0 convert-source-map: 1.8.0 escape-string-regexp: 4.0.0 find-root: 1.1.0 source-map: 0.5.7 - stylis: 4.0.13 + stylis: 4.1.3 dev: false - /@emotion/cache/11.9.3: - resolution: {integrity: sha512-0dgkI/JKlCXa+lEXviaMtGBL0ynpx4osh7rjOXE71q9bIF8G+XhJgvi+wDu0B0IdCVx37BffiwXlN9I3UuzFvg==} + /@emotion/cache/11.10.5: + resolution: {integrity: sha512-dGYHWyzTdmK+f2+EnIGBpkz1lKc4Zbj2KHd4cX3Wi8/OWr5pKslNjc3yABKH4adRGCvSX4VDC0i04mrrq0aiRA==} dependencies: - '@emotion/memoize': 0.7.5 - '@emotion/sheet': 1.1.1 - '@emotion/utils': 1.1.0 - '@emotion/weak-memoize': 0.2.5 - stylis: 4.0.13 + '@emotion/memoize': 0.8.0 + '@emotion/sheet': 1.2.1 + '@emotion/utils': 1.2.0 + '@emotion/weak-memoize': 0.3.0 + stylis: 4.1.3 dev: false - /@emotion/hash/0.8.0: - resolution: {integrity: sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow==} + /@emotion/hash/0.9.0: + resolution: {integrity: sha512-14FtKiHhy2QoPIzdTcvh//8OyBlknNs2nXRwIhG904opCby3l+9Xaf/wuPvICBF0rc1ZCNBd3nKe9cd2mecVkQ==} dev: false - /@emotion/memoize/0.7.5: - resolution: {integrity: sha512-igX9a37DR2ZPGYtV6suZ6whr8pTFtyHL3K/oLUotxpSVO2ASaprmAe2Dkq7tBo7CRY7MMDrAa9nuQP9/YG8FxQ==} + /@emotion/memoize/0.8.0: + resolution: {integrity: sha512-G/YwXTkv7Den9mXDO7AhLWkE3q+I92B+VqAE+dYG4NGPaHZGvt3G8Q0p9vmE+sq7rTGphUbAvmQ9YpbfMQGGlA==} dev: false - /@emotion/react/11.9.3_o7mw5f62d53yjknipiq2ngtukq: - resolution: {integrity: sha512-g9Q1GcTOlzOEjqwuLF/Zd9LC+4FljjPjDfxSM7KmEakm+hsHXk+bYZ2q+/hTJzr0OUNkujo72pXLQvXj6H+GJQ==} + /@emotion/react/11.10.6_sudpmbbyhqtxq6t4xf6jlicdem: + resolution: {integrity: sha512-6HT8jBmcSkfzO7mc+N1L9uwvOnlcGoix8Zn7srt+9ga0MjREo6lRpuVX0kzo6Jp6oTqDhREOFsygN6Ew4fEQbw==} peerDependencies: - '@babel/core': ^7.0.0 '@types/react': '*' react: '>=16.8.0' peerDependenciesMeta: - '@babel/core': - optional: true '@types/react': optional: true dependencies: - '@babel/core': 7.21.3 '@babel/runtime': 7.18.6 - '@emotion/babel-plugin': 11.9.2_@babel+core@7.21.3 - '@emotion/cache': 11.9.3 - '@emotion/serialize': 1.0.4 - '@emotion/utils': 1.1.0 - '@emotion/weak-memoize': 0.2.5 + '@emotion/babel-plugin': 11.10.6 + '@emotion/cache': 11.10.5 + '@emotion/serialize': 1.1.1 + '@emotion/use-insertion-effect-with-fallbacks': 1.0.0_react@17.0.2 + '@emotion/utils': 1.2.0 + '@emotion/weak-memoize': 0.3.0 '@types/react': 17.0.47 hoist-non-react-statics: 3.3.2 react: 17.0.2 dev: false - /@emotion/serialize/1.0.4: - resolution: {integrity: sha512-1JHamSpH8PIfFwAMryO2bNka+y8+KA5yga5Ocf2d7ZEiJjb7xlLW7aknBGZqJLajuLOvJ+72vN+IBSwPlXD1Pg==} + /@emotion/serialize/1.1.1: + resolution: {integrity: sha512-Zl/0LFggN7+L1liljxXdsVSVlg6E/Z/olVWpfxUTxOAmi8NU7YoeWeLfi1RmnB2TATHoaWwIBRoL+FvAJiTUQA==} dependencies: - '@emotion/hash': 0.8.0 - '@emotion/memoize': 0.7.5 - '@emotion/unitless': 0.7.5 - '@emotion/utils': 1.1.0 + '@emotion/hash': 0.9.0 + '@emotion/memoize': 0.8.0 + '@emotion/unitless': 0.8.0 + '@emotion/utils': 1.2.0 csstype: 3.1.0 dev: false - /@emotion/sheet/1.1.1: - resolution: {integrity: sha512-J3YPccVRMiTZxYAY0IOq3kd+hUP8idY8Kz6B/Cyo+JuXq52Ek+zbPbSQUrVQp95aJ+lsAW7DPL1P2Z+U1jGkKA==} + /@emotion/sheet/1.2.1: + resolution: {integrity: sha512-zxRBwl93sHMsOj4zs+OslQKg/uhF38MB+OMKoCrVuS0nyTkqnau+BM3WGEoOptg9Oz45T/aIGs1qbVAsEFo3nA==} dev: false - /@emotion/unitless/0.7.5: - resolution: {integrity: sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg==} + /@emotion/unitless/0.8.0: + resolution: {integrity: sha512-VINS5vEYAscRl2ZUDiT3uMPlrFQupiKgHz5AA4bCH1miKBg4qtwkim1qPmJj/4WG6TreYMY111rEFsjupcOKHw==} dev: false - /@emotion/utils/1.1.0: - resolution: {integrity: sha512-iRLa/Y4Rs5H/f2nimczYmS5kFJEbpiVvgN3XVfZ022IYhuNA1IRSHEizcof88LtCTXtl9S2Cxt32KgaXEu72JQ==} + /@emotion/use-insertion-effect-with-fallbacks/1.0.0_react@17.0.2: + resolution: {integrity: sha512-1eEgUGmkaljiBnRMTdksDV1W4kUnmwgp7X9G8B++9GYwl1lUdqSndSriIrTJ0N7LQaoauY9JJ2yhiOYK5+NI4A==} + peerDependencies: + react: '>=16.8.0' + dependencies: + react: 17.0.2 dev: false - /@emotion/weak-memoize/0.2.5: - resolution: {integrity: sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA==} + /@emotion/utils/1.2.0: + resolution: {integrity: sha512-sn3WH53Kzpw8oQ5mgMmIzzyAaH2ZqFEbozVVBSYp538E06OSE6ytOp7pRAjNQR+Q/orwqdQYJSe2m3hCOeznkw==} + dev: false + + /@emotion/weak-memoize/0.3.0: + resolution: {integrity: sha512-AHPmaAx+RYfZz0eYu6Gviiagpmiyw98ySSlQvCUhVGDRtDFe4DBS0x1bSjdF3gqUDYOczB+yYvBTtEylYSdRhg==} dev: false /@esbuild/android-arm/0.16.17: @@ -926,14 +934,14 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@floating-ui/core/1.1.1: - resolution: {integrity: sha512-PL7g3dhA4dHgZfujkuD8Q+tfJJynEtnNQSPzmucCnxMvkxf4cLBJw/ZYqZUn4HCh33U3WHrAfv2R2tbi9UCSmw==} + /@floating-ui/core/1.2.5: + resolution: {integrity: sha512-qrcbyfnRVziRlB6IYwjCopYhO7Vud750JlJyuljruIXcPxr22y8zdckcJGsuOdnQ639uVD1tTXddrcH3t3QYIQ==} dev: false - /@floating-ui/dom/1.1.1: - resolution: {integrity: sha512-TpIO93+DIujg3g7SykEAGZMDtbJRrmnYRCNYSjJlvIbGhBjRSNTLVbNeDQBrzy9qDgUbiWdc7KA0uZHZ2tJmiw==} + /@floating-ui/dom/1.2.5: + resolution: {integrity: sha512-+sAUfpQ3Frz+VCbPCqj+cZzvEESy3fjSeT/pDWkYCWOBXYNNKZfuVsHuv8/JO2zze8+Eb/Q7a6hZVgzS81fLbQ==} dependencies: - '@floating-ui/core': 1.1.1 + '@floating-ui/core': 1.2.5 dev: false /@humanwhocodes/config-array/0.11.8: @@ -1203,6 +1211,7 @@ packages: dependencies: '@jridgewell/set-array': 1.1.2 '@jridgewell/sourcemap-codec': 1.4.14 + dev: true /@jridgewell/gen-mapping/0.3.2: resolution: {integrity: sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==} @@ -1211,29 +1220,35 @@ packages: '@jridgewell/set-array': 1.1.2 '@jridgewell/sourcemap-codec': 1.4.14 '@jridgewell/trace-mapping': 0.3.17 + dev: true /@jridgewell/resolve-uri/3.1.0: resolution: {integrity: sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==} engines: {node: '>=6.0.0'} + dev: true /@jridgewell/set-array/1.1.2: resolution: {integrity: sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==} engines: {node: '>=6.0.0'} + dev: true /@jridgewell/sourcemap-codec/1.4.14: resolution: {integrity: sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==} + dev: true /@jridgewell/trace-mapping/0.3.14: resolution: {integrity: sha512-bJWEfQ9lPTvm3SneWwRFVLzrh6nhjwqw7TUFFBEMzwvg7t7PCDenf2lDwqo4NQXzdpgBXyFgDWnQA+2vkruksQ==} dependencies: '@jridgewell/resolve-uri': 3.1.0 '@jridgewell/sourcemap-codec': 1.4.14 + dev: true /@jridgewell/trace-mapping/0.3.17: resolution: {integrity: sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g==} dependencies: '@jridgewell/resolve-uri': 3.1.0 '@jridgewell/sourcemap-codec': 1.4.14 + dev: true /@nodelib/fs.scandir/2.1.5: resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} @@ -1690,11 +1705,12 @@ packages: '@types/babel__traverse': 7.17.1 dev: true - /babel-plugin-macros/2.8.0: - resolution: {integrity: sha512-SEP5kJpfGYqYKpBrj5XU3ahw5p5GOHJ0U5ssOSQ/WBVdwkD2Dzlce95exQTs3jOVWPPKLBN2rlEWkCK7dSmLvg==} + /babel-plugin-macros/3.1.0: + resolution: {integrity: sha512-Cg7TFGpIr01vOQNODXOOaGz2NpCU5gl8x1qJFbb6hbZxR7XrcE2vtbAsTAbJ7/xwJtUuJEw8K8Zr/AE0LHlesg==} + engines: {node: '>=10', npm: '>=6'} dependencies: '@babel/runtime': 7.18.6 - cosmiconfig: 6.0.0 + cosmiconfig: 7.1.0 resolve: 1.22.1 dev: false @@ -1807,6 +1823,7 @@ packages: electron-to-chromium: 1.4.340 node-releases: 2.0.10 update-browserslist-db: 1.0.10_browserslist@4.21.5 + dev: true /bs-logger/0.2.6: resolution: {integrity: sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==} @@ -1871,6 +1888,7 @@ packages: /caniuse-lite/1.0.30001470: resolution: {integrity: sha512-065uNwY6QtHCBOExzbV6m236DDhYCCtPmQUCoQtwkVqzud8v5QPidoMr6CoMkC2nfp6nksjttqWQRRh75LqUmA==} + dev: true /capture-exit/2.0.0: resolution: {integrity: sha512-PiT/hQmTonHhl/HFGN+Lx3JJUznrVYJ3+AQsnthneZbvW7x+f08Tk7yLJTLEOUvBTbduLeeBkxEaYXUOUrRq6g==} @@ -2043,9 +2061,9 @@ packages: engines: {node: '>=0.10.0'} dev: true - /cosmiconfig/6.0.0: - resolution: {integrity: sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg==} - engines: {node: '>=8'} + /cosmiconfig/7.1.0: + resolution: {integrity: sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==} + engines: {node: '>=10'} dependencies: '@types/parse-json': 4.0.0 import-fresh: 3.3.0 @@ -2139,6 +2157,7 @@ packages: optional: true dependencies: ms: 2.1.2 + dev: true /decimal.js/10.3.1: resolution: {integrity: sha512-V0pfhfr8suzyPGOx3nmq4aHqabehUZn6Ch9kyFpV79TGDTWFmHqUqXdabR7QHqxzrYolF4+tVmJhUG4OURg5dQ==} @@ -2233,6 +2252,7 @@ packages: /electron-to-chromium/1.4.340: resolution: {integrity: sha512-zx8hqumOqltKsv/MF50yvdAlPF9S/4PXbyfzJS6ZGhbddGkRegdwImmfSVqCkEziYzrIGZ/TlrzBND4FysfkDg==} + dev: true /email-addresses/3.1.0: resolution: {integrity: sha512-k0/r7GrWVL32kZlGwfPNgB2Y/mMXVTq/decgLczm/j34whdaspNrZO8CnXPf1laaHxI6ptUlsnAxN+UAPw+fzg==} @@ -2334,6 +2354,7 @@ packages: /escalade/3.1.1: resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} engines: {node: '>=6'} + dev: true /escape-string-regexp/1.0.5: resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==} @@ -2747,6 +2768,7 @@ packages: /gensync/1.0.0-beta.2: resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==} engines: {node: '>=6.9.0'} + dev: true /get-caller-file/2.0.5: resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} @@ -2828,6 +2850,7 @@ packages: /globals/11.12.0: resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==} engines: {node: '>=4'} + dev: true /globals/13.20.0: resolution: {integrity: sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==} @@ -3820,6 +3843,7 @@ packages: resolution: {integrity: sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==} engines: {node: '>=4'} hasBin: true + dev: true /json-parse-even-better-errors/2.3.1: resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} @@ -3842,6 +3866,7 @@ packages: resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==} engines: {node: '>=6'} hasBin: true + dev: true /jsonfile/4.0.0: resolution: {integrity: sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==} @@ -3952,6 +3977,7 @@ packages: resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==} dependencies: yallist: 3.1.1 + dev: true /lru-cache/6.0.0: resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==} @@ -4082,6 +4108,7 @@ packages: /ms/2.1.2: resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} + dev: true /mz/2.7.0: resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==} @@ -4124,6 +4151,7 @@ packages: /node-releases/2.0.10: resolution: {integrity: sha512-5GFldHPXVG/YZmFzJvKK2zDSzPKhEp0+ZR5SVaoSag9fsL5YgHbUHDfnG5494ISANDcK4KwPXAx2xqVEydmd7w==} + dev: true /normalize-path/2.1.1: resolution: {integrity: sha512-3pKJwH184Xo/lnH6oyP1q2pMd7HcypqqmRs91/6/i2CGtWwIKGCkOOMTm/zXbgTEWHw1uNpNi/igc3ePOYHb6w==} @@ -4310,6 +4338,7 @@ packages: /picocolors/1.0.0: resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==} + dev: true /picomatch/2.3.1: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} @@ -4452,30 +4481,29 @@ packages: resolution: {integrity: sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==} dev: true - /react-select/5.7.0_crofjw4wgu3s56yfd4j5czcwki: - resolution: {integrity: sha512-lJGiMxCa3cqnUr2Jjtg9YHsaytiZqeNOKeibv6WF5zbK/fPegZ1hg3y/9P1RZVLhqBTs0PfqQLKuAACednYGhQ==} + /react-select/5.7.2_nn45z5sr7igu7sfun6tiae5hx4: + resolution: {integrity: sha512-cTlJkQ8YjV6T/js8wW0owTzht0hHGABh29vjLscY4HfZGkv7hc3FFTmRp9NzY/Ib1uQ36GieAKEjxpHdpCFpcA==} peerDependencies: react: ^16.8.0 || ^17.0.0 || ^18.0.0 react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 dependencies: '@babel/runtime': 7.18.6 - '@emotion/cache': 11.9.3 - '@emotion/react': 11.9.3_o7mw5f62d53yjknipiq2ngtukq - '@floating-ui/dom': 1.1.1 + '@emotion/cache': 11.10.5 + '@emotion/react': 11.10.6_sudpmbbyhqtxq6t4xf6jlicdem + '@floating-ui/dom': 1.2.5 '@types/react-transition-group': 4.4.5 memoize-one: 6.0.0 prop-types: 15.8.1 react: 17.0.2 react-dom: 17.0.2_react@17.0.2 - react-transition-group: 4.4.2_sfoxds7t5ydpegc3knd667wn6m + react-transition-group: 4.4.5_sfoxds7t5ydpegc3knd667wn6m use-isomorphic-layout-effect: 1.1.2_sudpmbbyhqtxq6t4xf6jlicdem transitivePeerDependencies: - - '@babel/core' - '@types/react' dev: false - /react-transition-group/4.4.2_sfoxds7t5ydpegc3knd667wn6m: - resolution: {integrity: sha512-/RNYfRAMlZwDSr6z4zNKV6xu53/e2BuaBbGhbyYIXTrmgu/bGHzmqOs7mJSJBHy9Ud+ApHx3QjrkKSp1pxvlFg==} + /react-transition-group/4.4.5_sfoxds7t5ydpegc3knd667wn6m: + resolution: {integrity: sha512-pZcd1MCJoiKiBR2NRxeCRg13uCXbydPnmB4EOeRrY7480qNWO8IIgQG6zlDkm6uRMsURXPuKq0GWtiM59a5Q6g==} peerDependencies: react: '>=16.6.0' react-dom: '>=16.6.0' @@ -4669,6 +4697,7 @@ packages: /semver/6.3.0: resolution: {integrity: sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==} hasBin: true + dev: true /semver/7.3.7: resolution: {integrity: sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==} @@ -4911,8 +4940,8 @@ packages: escape-string-regexp: 1.0.5 dev: true - /stylis/4.0.13: - resolution: {integrity: sha512-xGPXiFVl4YED9Jh7Euv2V220mriG9u4B2TA6Ybjc1catrstKD2PpIdU3U0RKpkVBC2EhmL/F0sPCr9vrFTNRag==} + /stylis/4.1.3: + resolution: {integrity: sha512-GP6WDNWf+o403jrEp9c5jibKavrtLW+/qYGhFxFrG8maXhwTBI7gLLhiBb0o7uFccWN+EOS9aMO6cGHWAO07OA==} dev: false /sucrase/3.31.0: @@ -5233,6 +5262,7 @@ packages: browserslist: 4.21.5 escalade: 3.1.1 picocolors: 1.0.0 + dev: true /uri-js/4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} @@ -5402,6 +5432,7 @@ packages: /yallist/3.1.1: resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} + dev: true /yallist/4.0.0: resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} diff --git a/src/index.d.ts b/src/index.d.ts deleted file mode 100644 index ba3d604..0000000 --- a/src/index.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -/// -import allTimezones from './timezone-list.js' -import type { - Props, - ITimezone, - ITimezoneOption, - ILabelStyle, -} from './types/timezone' -export { allTimezones } -export type { ITimezone, ITimezoneOption, Props, ILabelStyle } -declare const TimezoneSelect: ({ - value, - onBlur, - onChange, - labelStyle, - timezones, - maxAbbrLength, - ...props -}: Props) => JSX.Element -export default TimezoneSelect diff --git a/src/index.tsx b/src/index.tsx index 224ee31..b495d3c 100755 --- a/src/index.tsx +++ b/src/index.tsx @@ -10,69 +10,68 @@ import type { ILabelStyle, } from './types/timezone' -export { allTimezones } -export type { ITimezone, ITimezoneOption, Props, ILabelStyle } - const TimezoneSelect = ({ value, onBlur, onChange, labelStyle = 'original', - timezones, + timezones = allTimezones, maxAbbrLength = 4, ...props }: Props) => { - if (!timezones) timezones = allTimezones - const getOptions = React.useMemo(() => { - return Object.entries(timezones) - .reduce((selectOptions, zone) => { - try { - const now = spacetime.now(zone[0]) - const tz = now.timezone() - const tzStrings = soft(zone[0]) + const getOptions = React.useMemo( + () => + Object.entries(timezones) + .reduce((selectOptions, zone) => { + try { + const now = spacetime.now(zone[0]) + const tz = now.timezone() + const tzStrings = soft(zone[0]) - let label = '' - let abbr = now.isDST() - ? tzStrings[0].daylight.abbr - : tzStrings[0].standard.abbr - let altName = now.isDST() - ? tzStrings[0].daylight.name - : tzStrings[0].standard.name + let label = '' + let abbr = now.isDST() + ? tzStrings[0].daylight.abbr + : tzStrings[0].standard.abbr + let altName = now.isDST() + ? tzStrings[0].daylight.name + : tzStrings[0].standard.name - const min = tz.current.offset * 60 - const hr = - `${(min / 60) ^ 0}:` + (min % 60 === 0 ? '00' : Math.abs(min % 60)) - const prefix = `(GMT${hr.includes('-') ? hr : `+${hr}`}) ${zone[1]}` + const min = tz.current.offset * 60 + const hr = + `${(min / 60) ^ 0}:` + + (min % 60 === 0 ? '00' : Math.abs(min % 60)) + const prefix = `(GMT${hr.includes('-') ? hr : `+${hr}`}) ${zone[1]}` - switch (labelStyle) { - case 'original': - label = prefix - break - case 'altName': - label = `${prefix} ${altName?.length ? `(${altName})` : ''}` - break - case 'abbrev': - label = `${prefix} (${abbr.substring(0, maxAbbrLength)})` - break - default: - label = `${prefix}` - } + switch (labelStyle) { + case 'original': + label = prefix + break + case 'altName': + label = `${prefix} ${altName?.length ? `(${altName})` : ''}` + break + case 'abbrev': + label = `${prefix} (${abbr.substring(0, maxAbbrLength)})` + break + default: + label = `${prefix}` + } - selectOptions.push({ - value: tz.name, - label: label, - offset: tz.current.offset, - abbrev: abbr, - altName: altName, - }) + selectOptions.push({ + value: tz.name, + label: label, + offset: tz.current.offset, + abbrev: abbr, + altName: altName, + }) - return selectOptions - } catch { - return selectOptions - } - }, []) - .sort((a: ITimezoneOption, b: ITimezoneOption) => a.offset - b.offset) - }, [labelStyle, timezones]) + return selectOptions + } catch { + return selectOptions + } + }, []) + .sort((a: ITimezoneOption, b: ITimezoneOption) => a.offset - b.offset), + [labelStyle, timezones] + ) const handleChange = (tz: ITimezoneOption) => { onChange && onChange(tz) @@ -155,4 +154,5 @@ const TimezoneSelect = ({ ) } -export default TimezoneSelect +export { TimezoneSelect as default, allTimezones } +export type { ITimezone, ITimezoneOption, Props, ILabelStyle } diff --git a/src/timezone-list.d.ts b/src/timezone-list.d.ts deleted file mode 100644 index 30af7eb..0000000 --- a/src/timezone-list.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { ICustomTimezone } from './types/timezone'; -declare const allTimezones: ICustomTimezone; -export default allTimezones; diff --git a/src/types/globals.d.ts b/src/types/globals.d.ts deleted file mode 100644 index 6a69409..0000000 --- a/src/types/globals.d.ts +++ /dev/null @@ -1 +0,0 @@ -import "@testing-library/jest-dom/extend-expect"; diff --git a/src/types/timezone.d.ts b/src/types/timezone.d.ts deleted file mode 100644 index 9d7c7e4..0000000 --- a/src/types/timezone.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { Props as ReactSelectProps } from 'react-select' -export declare type ICustomTimezone = { - [key: string]: string -} -export declare type ILabelStyle = 'original' | 'altName' | 'abbrev' -export interface ITimezoneOption { - value: string - label: string - offset: number - abbrev?: string - altName?: string -} -export declare type ITimezone = ITimezoneOption | string -export interface Props - extends Omit, 'onChange'> { - value: ITimezone - labelStyle?: ILabelStyle - onChange?: (timezone: ITimezoneOption) => void - timezones?: ICustomTimezone - maxAbbrLength?: number -} diff --git a/tsconfig.json b/tsconfig.json index ebd1117..6fbcf7a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,6 +3,7 @@ "exclude": ["example/", "node_modules"], "compilerOptions": { "target": "es2020", + "module": "esnext", "emitDeclarationOnly": true, "declaration": true, "strict": false,