@worldcoin/idkit 2.4.0 → 2.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.cjs CHANGED
@@ -351,13 +351,13 @@ var import_react2 = require("react");
351
351
  var useMedia = () => {
352
352
  const getInitialState = () => {
353
353
  if (typeof window !== "undefined") {
354
- return window.matchMedia("(max-width: 768px)").matches ? "mobile" : "desktop";
354
+ return window.matchMedia("(max-width: 1024px)").matches ? "mobile" : "desktop";
355
355
  }
356
356
  return "desktop";
357
357
  };
358
358
  const [media, setMedia] = (0, import_react2.useState)(getInitialState());
359
359
  (0, import_react2.useEffect)(() => {
360
- const mql = window.matchMedia("(max-width: 768px)");
360
+ const mql = window.matchMedia("(max-width: 1024px)");
361
361
  const handleChange = (mql2) => setMedia(mql2.matches ? "mobile" : "desktop");
362
362
  handleChange(mql);
363
363
  mql.addEventListener("change", handleChange);
@@ -1653,6 +1653,9 @@ input[type='number']::-webkit-inner-spin-button,
1653
1653
  .md\\:mt-2 {
1654
1654
  margin-top: 8px;
1655
1655
  }
1656
+ .md\\:block {
1657
+ display: block;
1658
+ }
1656
1659
  .md\\:hidden {
1657
1660
  display: none;
1658
1661
  }
@@ -1679,6 +1682,15 @@ input[type='number']::-webkit-inner-spin-button,
1679
1682
  padding: 16px;
1680
1683
  }
1681
1684
  }
1685
+
1686
+ @media (min-width: 1280px) {
1687
+ .xl\\:block {
1688
+ display: block;
1689
+ }
1690
+ .xl\\:hidden {
1691
+ display: none;
1692
+ }
1693
+ }
1682
1694
  `;
1683
1695
 
1684
1696
  // src/components/Styles.tsx
@@ -2165,7 +2177,6 @@ var QRPlaceholderIcon_default = QRPlaceholderIcon;
2165
2177
  // src/components/IDKitWidget/States/WorldID/QRState.tsx
2166
2178
  var import_jsx_runtime12 = require("react/jsx-runtime");
2167
2179
  var QRState = ({ qrData, showQR, setShowQR }) => {
2168
- const media = useMedia_default();
2169
2180
  const [copiedLink, setCopiedLink] = (0, import_react6.useState)(false);
2170
2181
  const copyLink = (0, import_react6.useCallback)(() => {
2171
2182
  (0, import_copy_to_clipboard.default)(qrData ?? "");
@@ -2173,15 +2184,22 @@ var QRState = ({ qrData, showQR, setShowQR }) => {
2173
2184
  setTimeout(() => setCopiedLink(false), 2e3);
2174
2185
  }, [qrData]);
2175
2186
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
2176
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: clsx_default("md:hidden", { "mb-10 space-y-4": !showQR }), children: [
2187
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "md:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2188
+ "a",
2189
+ {
2190
+ href: qrData ?? void 0,
2191
+ className: "flex w-full items-center space-x-2 rounded-2xl border border-transparent bg-0d151d p-4 font-medium text-white shadow-sm dark:bg-white dark:text-0d151d",
2192
+ children: [
2193
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(WorldcoinIcon_default, { className: "size-5" }),
2194
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "flex-1 text-center", children: __("Open World App") })
2195
+ ]
2196
+ }
2197
+ ) }),
2198
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: clsx_default("hidden md:block xl:hidden", { "mb-10 space-y-4": !showQR }), children: [
2177
2199
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2178
- import_framer_motion.motion.a,
2200
+ "a",
2179
2201
  {
2180
- href: qrData ?? "",
2181
- whileTap: { scale: 0.95 },
2182
- whileHover: { scale: 1.05 },
2183
- transition: { layout: { duration: 0.15 } },
2184
- layoutId: media == "desktop" ? void 0 : "worldid-button",
2202
+ href: qrData ?? void 0,
2185
2203
  className: clsx_default(
2186
2204
  "flex w-full items-center space-x-2 rounded-2xl border border-transparent p-4 font-medium shadow-sm",
2187
2205
  "bg-0d151d text-white dark:bg-white dark:text-0d151d",
@@ -2189,20 +2207,12 @@ var QRState = ({ qrData, showQR, setShowQR }) => {
2189
2207
  ),
2190
2208
  children: [
2191
2209
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(WorldcoinIcon_default, { className: "size-5" }),
2192
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2193
- import_framer_motion.motion.span,
2194
- {
2195
- className: "flex-1 text-center",
2196
- transition: { layout: { duration: 0.15 } },
2197
- layoutId: media == "desktop" ? void 0 : "worldid-text",
2198
- children: __("Open World App")
2199
- }
2200
- )
2210
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "flex-1 text-center", children: __("Open World App") })
2201
2211
  ]
2202
2212
  }
2203
2213
  ),
2204
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: clsx_default("mb-3", { "space-y-4": !showQR, hidden: media === "mobile" }), children: [
2205
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: clsx_default("flex items-center space-x-4 ", { hidden: showQR }), children: [
2214
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: clsx_default("mb-3 space-y-4", { hidden: showQR }), children: [
2215
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center space-x-4", children: [
2206
2216
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("hr", { className: "flex-1" }),
2207
2217
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-xs font-medium text-9ba3ae", children: "or" }),
2208
2218
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("hr", { className: "flex-1" })
@@ -2212,12 +2222,61 @@ var QRState = ({ qrData, showQR, setShowQR }) => {
2212
2222
  {
2213
2223
  className: "w-full rounded-2xl border border-ebecef p-4 text-lg font-medium text-3c424b",
2214
2224
  onClick: () => setShowQR((state) => !state),
2215
- children: showQR ? __("Hide QR Code") : __("Display QR Code")
2225
+ children: __("Display QR Code")
2216
2226
  }
2217
2227
  )
2218
2228
  ] })
2219
2229
  ] }),
2220
- (media == "desktop" || showQR) && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
2230
+ showQR && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "hidden md:block xl:hidden", children: [
2231
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2232
+ import_framer_motion.motion.button,
2233
+ {
2234
+ className: "w-full rounded-2xl border border-ebecef p-4 text-lg font-medium text-3c424b",
2235
+ onClick: () => setShowQR(false),
2236
+ children: __("Hide QR Code")
2237
+ }
2238
+ ) }),
2239
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "relative inline-flex items-center justify-center rounded-2xl border border-f1f5f8 p-3 dark:border-f1f5f8/10", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "text-29343f dark:text-white", children: qrData ? (
2240
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
2241
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { onClick: copyLink, className: "cursor-pointer", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(QRCode_default, { data: qrData, size: 200 }) })
2242
+ ) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex size-[200px] items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(QRPlaceholderIcon_default, { className: "size-[200px] animate-pulse" }) }) }) }),
2243
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_framer_motion.AnimatePresence, { children: copiedLink && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2244
+ import_framer_motion.motion.div,
2245
+ {
2246
+ className: "text-center text-sm text-9eafc0",
2247
+ initial: "hidden",
2248
+ animate: "visible",
2249
+ exit: "exit",
2250
+ variants: {
2251
+ hidden: { opacity: 0, height: 0, marginTop: 0 },
2252
+ visible: {
2253
+ opacity: 1,
2254
+ height: "auto",
2255
+ marginTop: 8,
2256
+ transition: {
2257
+ duration: 0.25,
2258
+ opacity: { delay: 0.05, duration: 0.2 },
2259
+ ease: "easeInOut"
2260
+ }
2261
+ },
2262
+ exit: {
2263
+ opacity: 0,
2264
+ height: 0,
2265
+ marginTop: 0,
2266
+ transition: {
2267
+ duration: 0.4,
2268
+ delay: 0.1,
2269
+ opacity: { duration: 0.25, delay: 0 },
2270
+ ease: "easeInOut"
2271
+ }
2272
+ }
2273
+ },
2274
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "rounded-lg border border-f1f5f8 px-2 py-1 text-sm", children: __("QR Code copied") })
2275
+ },
2276
+ "copied"
2277
+ ) })
2278
+ ] }),
2279
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "hidden xl:block", children: [
2221
2280
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_framer_motion.AnimatePresence, { children: copiedLink && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2222
2281
  import_framer_motion.motion.div,
2223
2282
  {
package/build/index.js CHANGED
@@ -34,13 +34,13 @@ import { useEffect as useEffect2, useState } from "react";
34
34
  var useMedia = () => {
35
35
  const getInitialState = () => {
36
36
  if (typeof window !== "undefined") {
37
- return window.matchMedia("(max-width: 768px)").matches ? "mobile" : "desktop";
37
+ return window.matchMedia("(max-width: 1024px)").matches ? "mobile" : "desktop";
38
38
  }
39
39
  return "desktop";
40
40
  };
41
41
  const [media, setMedia] = useState(getInitialState());
42
42
  useEffect2(() => {
43
- const mql = window.matchMedia("(max-width: 768px)");
43
+ const mql = window.matchMedia("(max-width: 1024px)");
44
44
  const handleChange = (mql2) => setMedia(mql2.matches ? "mobile" : "desktop");
45
45
  handleChange(mql);
46
46
  mql.addEventListener("change", handleChange);
@@ -1318,6 +1318,9 @@ input[type='number']::-webkit-inner-spin-button,
1318
1318
  .md\\:mt-2 {
1319
1319
  margin-top: 8px;
1320
1320
  }
1321
+ .md\\:block {
1322
+ display: block;
1323
+ }
1321
1324
  .md\\:hidden {
1322
1325
  display: none;
1323
1326
  }
@@ -1344,6 +1347,14 @@ input[type='number']::-webkit-inner-spin-button,
1344
1347
  padding: 16px;
1345
1348
  }
1346
1349
  }
1350
+ @media (min-width: 1280px) {
1351
+ .xl\\:block {
1352
+ display: block;
1353
+ }
1354
+ .xl\\:hidden {
1355
+ display: none;
1356
+ }
1357
+ }
1347
1358
  `;
1348
1359
 
1349
1360
  // src/components/Styles.tsx
@@ -1755,7 +1766,6 @@ var QRPlaceholderIcon_default = QRPlaceholderIcon;
1755
1766
  // src/components/IDKitWidget/States/WorldID/QRState.tsx
1756
1767
  import { Fragment, jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
1757
1768
  var QRState = ({ qrData, showQR, setShowQR }) => {
1758
- const media = useMedia_default();
1759
1769
  const [copiedLink, setCopiedLink] = useState3(false);
1760
1770
  const copyLink = useCallback2(() => {
1761
1771
  copy(qrData ?? "");
@@ -1763,15 +1773,22 @@ var QRState = ({ qrData, showQR, setShowQR }) => {
1763
1773
  setTimeout(() => setCopiedLink(false), 2e3);
1764
1774
  }, [qrData]);
1765
1775
  return /* @__PURE__ */ jsxs7(Fragment, { children: [
1766
- /* @__PURE__ */ jsxs7("div", { className: clsx_default("md:hidden", { "mb-10 space-y-4": !showQR }), children: [
1776
+ /* @__PURE__ */ jsx11("div", { className: "md:hidden", children: /* @__PURE__ */ jsxs7(
1777
+ "a",
1778
+ {
1779
+ href: qrData ?? void 0,
1780
+ className: "flex w-full items-center space-x-2 rounded-2xl border border-transparent bg-0d151d p-4 font-medium text-white shadow-sm dark:bg-white dark:text-0d151d",
1781
+ children: [
1782
+ /* @__PURE__ */ jsx11(WorldcoinIcon_default, { className: "size-5" }),
1783
+ /* @__PURE__ */ jsx11("span", { className: "flex-1 text-center", children: __("Open World App") })
1784
+ ]
1785
+ }
1786
+ ) }),
1787
+ /* @__PURE__ */ jsxs7("div", { className: clsx_default("hidden md:block xl:hidden", { "mb-10 space-y-4": !showQR }), children: [
1767
1788
  /* @__PURE__ */ jsxs7(
1768
- motion.a,
1789
+ "a",
1769
1790
  {
1770
- href: qrData ?? "",
1771
- whileTap: { scale: 0.95 },
1772
- whileHover: { scale: 1.05 },
1773
- transition: { layout: { duration: 0.15 } },
1774
- layoutId: media == "desktop" ? void 0 : "worldid-button",
1791
+ href: qrData ?? void 0,
1775
1792
  className: clsx_default(
1776
1793
  "flex w-full items-center space-x-2 rounded-2xl border border-transparent p-4 font-medium shadow-sm",
1777
1794
  "bg-0d151d text-white dark:bg-white dark:text-0d151d",
@@ -1779,20 +1796,12 @@ var QRState = ({ qrData, showQR, setShowQR }) => {
1779
1796
  ),
1780
1797
  children: [
1781
1798
  /* @__PURE__ */ jsx11(WorldcoinIcon_default, { className: "size-5" }),
1782
- /* @__PURE__ */ jsx11(
1783
- motion.span,
1784
- {
1785
- className: "flex-1 text-center",
1786
- transition: { layout: { duration: 0.15 } },
1787
- layoutId: media == "desktop" ? void 0 : "worldid-text",
1788
- children: __("Open World App")
1789
- }
1790
- )
1799
+ /* @__PURE__ */ jsx11("span", { className: "flex-1 text-center", children: __("Open World App") })
1791
1800
  ]
1792
1801
  }
1793
1802
  ),
1794
- /* @__PURE__ */ jsxs7("div", { className: clsx_default("mb-3", { "space-y-4": !showQR, hidden: media === "mobile" }), children: [
1795
- /* @__PURE__ */ jsxs7("div", { className: clsx_default("flex items-center space-x-4 ", { hidden: showQR }), children: [
1803
+ /* @__PURE__ */ jsxs7("div", { className: clsx_default("mb-3 space-y-4", { hidden: showQR }), children: [
1804
+ /* @__PURE__ */ jsxs7("div", { className: "flex items-center space-x-4", children: [
1796
1805
  /* @__PURE__ */ jsx11("hr", { className: "flex-1" }),
1797
1806
  /* @__PURE__ */ jsx11("span", { className: "text-xs font-medium text-9ba3ae", children: "or" }),
1798
1807
  /* @__PURE__ */ jsx11("hr", { className: "flex-1" })
@@ -1802,12 +1811,61 @@ var QRState = ({ qrData, showQR, setShowQR }) => {
1802
1811
  {
1803
1812
  className: "w-full rounded-2xl border border-ebecef p-4 text-lg font-medium text-3c424b",
1804
1813
  onClick: () => setShowQR((state) => !state),
1805
- children: showQR ? __("Hide QR Code") : __("Display QR Code")
1814
+ children: __("Display QR Code")
1806
1815
  }
1807
1816
  )
1808
1817
  ] })
1809
1818
  ] }),
1810
- (media == "desktop" || showQR) && /* @__PURE__ */ jsxs7(Fragment, { children: [
1819
+ showQR && /* @__PURE__ */ jsxs7("div", { className: "hidden md:block xl:hidden", children: [
1820
+ /* @__PURE__ */ jsx11("div", { className: "mb-4", children: /* @__PURE__ */ jsx11(
1821
+ motion.button,
1822
+ {
1823
+ className: "w-full rounded-2xl border border-ebecef p-4 text-lg font-medium text-3c424b",
1824
+ onClick: () => setShowQR(false),
1825
+ children: __("Hide QR Code")
1826
+ }
1827
+ ) }),
1828
+ /* @__PURE__ */ jsx11("div", { className: "relative inline-flex items-center justify-center rounded-2xl border border-f1f5f8 p-3 dark:border-f1f5f8/10", children: /* @__PURE__ */ jsx11("div", { className: "text-29343f dark:text-white", children: qrData ? (
1829
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
1830
+ /* @__PURE__ */ jsx11("div", { onClick: copyLink, className: "cursor-pointer", children: /* @__PURE__ */ jsx11(QRCode_default, { data: qrData, size: 200 }) })
1831
+ ) : /* @__PURE__ */ jsx11("div", { className: "flex size-[200px] items-center justify-center", children: /* @__PURE__ */ jsx11(QRPlaceholderIcon_default, { className: "size-[200px] animate-pulse" }) }) }) }),
1832
+ /* @__PURE__ */ jsx11(AnimatePresence, { children: copiedLink && /* @__PURE__ */ jsx11(
1833
+ motion.div,
1834
+ {
1835
+ className: "text-center text-sm text-9eafc0",
1836
+ initial: "hidden",
1837
+ animate: "visible",
1838
+ exit: "exit",
1839
+ variants: {
1840
+ hidden: { opacity: 0, height: 0, marginTop: 0 },
1841
+ visible: {
1842
+ opacity: 1,
1843
+ height: "auto",
1844
+ marginTop: 8,
1845
+ transition: {
1846
+ duration: 0.25,
1847
+ opacity: { delay: 0.05, duration: 0.2 },
1848
+ ease: "easeInOut"
1849
+ }
1850
+ },
1851
+ exit: {
1852
+ opacity: 0,
1853
+ height: 0,
1854
+ marginTop: 0,
1855
+ transition: {
1856
+ duration: 0.4,
1857
+ delay: 0.1,
1858
+ opacity: { duration: 0.25, delay: 0 },
1859
+ ease: "easeInOut"
1860
+ }
1861
+ }
1862
+ },
1863
+ children: /* @__PURE__ */ jsx11("span", { className: "rounded-lg border border-f1f5f8 px-2 py-1 text-sm", children: __("QR Code copied") })
1864
+ },
1865
+ "copied"
1866
+ ) })
1867
+ ] }),
1868
+ /* @__PURE__ */ jsxs7("div", { className: "hidden xl:block", children: [
1811
1869
  /* @__PURE__ */ jsx11(AnimatePresence, { children: copiedLink && /* @__PURE__ */ jsx11(
1812
1870
  motion.div,
1813
1871
  {
package/package.json CHANGED
@@ -37,6 +37,9 @@
37
37
  "tsup": "^8.1.0",
38
38
  "typescript": "^5.5.3"
39
39
  },
40
+ "overrides": {
41
+ "rollup": "^4.22.4"
42
+ },
40
43
  "engines": {
41
44
  "node": ">=12.4"
42
45
  },
@@ -103,7 +106,7 @@
103
106
  ]
104
107
  }
105
108
  },
106
- "version": "2.4.0",
109
+ "version": "2.4.2",
107
110
  "scripts": {
108
111
  "build": "npm run build:css && tsup",
109
112
  "build:css": "npx tailwindcss -i ./src/styles/styles.css -o ./build/index.css --minify",