@worldcoin/idkit 2.4.0 → 2.4.1

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
@@ -2173,15 +2185,22 @@ var QRState = ({ qrData, showQR, setShowQR }) => {
2173
2185
  setTimeout(() => setCopiedLink(false), 2e3);
2174
2186
  }, [qrData]);
2175
2187
  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: [
2188
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "md:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2189
+ "a",
2190
+ {
2191
+ href: qrData ?? "",
2192
+ className: "flex w-full items-center space-x-2 rounded-2xl border border-transparent p-4 font-medium shadow-sm bg-0d151d text-white dark:bg-white dark:text-0d151d",
2193
+ children: [
2194
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(WorldcoinIcon_default, { className: "size-5" }),
2195
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "flex-1 text-center", children: __("Open World App") })
2196
+ ]
2197
+ }
2198
+ ) }),
2199
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: clsx_default("hidden md:block xl:hidden", { "mb-10 space-y-4": !showQR }), children: [
2177
2200
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2178
- import_framer_motion.motion.a,
2201
+ "a",
2179
2202
  {
2180
2203
  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",
2185
2204
  className: clsx_default(
2186
2205
  "flex w-full items-center space-x-2 rounded-2xl border border-transparent p-4 font-medium shadow-sm",
2187
2206
  "bg-0d151d text-white dark:bg-white dark:text-0d151d",
@@ -2189,20 +2208,12 @@ var QRState = ({ qrData, showQR, setShowQR }) => {
2189
2208
  ),
2190
2209
  children: [
2191
2210
  /* @__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
- )
2211
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "flex-1 text-center", children: __("Open World App") })
2201
2212
  ]
2202
2213
  }
2203
2214
  ),
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: [
2215
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: clsx_default("mb-3 space-y-4", { hidden: showQR }), children: [
2216
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center space-x-4", children: [
2206
2217
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("hr", { className: "flex-1" }),
2207
2218
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-xs font-medium text-9ba3ae", children: "or" }),
2208
2219
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("hr", { className: "flex-1" })
@@ -2212,12 +2223,61 @@ var QRState = ({ qrData, showQR, setShowQR }) => {
2212
2223
  {
2213
2224
  className: "w-full rounded-2xl border border-ebecef p-4 text-lg font-medium text-3c424b",
2214
2225
  onClick: () => setShowQR((state) => !state),
2215
- children: showQR ? __("Hide QR Code") : __("Display QR Code")
2226
+ children: __("Display QR Code")
2216
2227
  }
2217
2228
  )
2218
2229
  ] })
2219
2230
  ] }),
2220
- (media == "desktop" || showQR) && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
2231
+ showQR && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "hidden md:block xl:hidden", children: [
2232
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2233
+ import_framer_motion.motion.button,
2234
+ {
2235
+ className: "w-full rounded-2xl border border-ebecef p-4 text-lg font-medium text-3c424b",
2236
+ onClick: () => setShowQR(false),
2237
+ children: __("Hide QR Code")
2238
+ }
2239
+ ) }),
2240
+ /* @__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 ? (
2241
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
2242
+ /* @__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 }) })
2243
+ ) : /* @__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" }) }) }) }),
2244
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_framer_motion.AnimatePresence, { children: copiedLink && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2245
+ import_framer_motion.motion.div,
2246
+ {
2247
+ className: "text-sm text-9eafc0 text-center",
2248
+ initial: "hidden",
2249
+ animate: "visible",
2250
+ exit: "exit",
2251
+ variants: {
2252
+ hidden: { opacity: 0, height: 0, marginTop: 0 },
2253
+ visible: {
2254
+ opacity: 1,
2255
+ height: "auto",
2256
+ marginTop: 8,
2257
+ transition: {
2258
+ duration: 0.25,
2259
+ opacity: { delay: 0.05, duration: 0.2 },
2260
+ ease: "easeInOut"
2261
+ }
2262
+ },
2263
+ exit: {
2264
+ opacity: 0,
2265
+ height: 0,
2266
+ marginTop: 0,
2267
+ transition: {
2268
+ duration: 0.4,
2269
+ delay: 0.1,
2270
+ opacity: { duration: 0.25, delay: 0 },
2271
+ ease: "easeInOut"
2272
+ }
2273
+ }
2274
+ },
2275
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "rounded-lg border border-f1f5f8 px-2 py-1 text-sm", children: __("QR Code copied") })
2276
+ },
2277
+ "copied"
2278
+ ) })
2279
+ ] }),
2280
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "hidden xl:block", children: [
2221
2281
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_framer_motion.AnimatePresence, { children: copiedLink && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2222
2282
  import_framer_motion.motion.div,
2223
2283
  {
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
@@ -1763,15 +1774,22 @@ var QRState = ({ qrData, showQR, setShowQR }) => {
1763
1774
  setTimeout(() => setCopiedLink(false), 2e3);
1764
1775
  }, [qrData]);
1765
1776
  return /* @__PURE__ */ jsxs7(Fragment, { children: [
1766
- /* @__PURE__ */ jsxs7("div", { className: clsx_default("md:hidden", { "mb-10 space-y-4": !showQR }), children: [
1777
+ /* @__PURE__ */ jsx11("div", { className: "md:hidden", children: /* @__PURE__ */ jsxs7(
1778
+ "a",
1779
+ {
1780
+ href: qrData ?? "",
1781
+ className: "flex w-full items-center space-x-2 rounded-2xl border border-transparent p-4 font-medium shadow-sm bg-0d151d text-white dark:bg-white dark:text-0d151d",
1782
+ children: [
1783
+ /* @__PURE__ */ jsx11(WorldcoinIcon_default, { className: "size-5" }),
1784
+ /* @__PURE__ */ jsx11("span", { className: "flex-1 text-center", children: __("Open World App") })
1785
+ ]
1786
+ }
1787
+ ) }),
1788
+ /* @__PURE__ */ jsxs7("div", { className: clsx_default("hidden md:block xl:hidden", { "mb-10 space-y-4": !showQR }), children: [
1767
1789
  /* @__PURE__ */ jsxs7(
1768
- motion.a,
1790
+ "a",
1769
1791
  {
1770
1792
  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",
1775
1793
  className: clsx_default(
1776
1794
  "flex w-full items-center space-x-2 rounded-2xl border border-transparent p-4 font-medium shadow-sm",
1777
1795
  "bg-0d151d text-white dark:bg-white dark:text-0d151d",
@@ -1779,20 +1797,12 @@ var QRState = ({ qrData, showQR, setShowQR }) => {
1779
1797
  ),
1780
1798
  children: [
1781
1799
  /* @__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
- )
1800
+ /* @__PURE__ */ jsx11("span", { className: "flex-1 text-center", children: __("Open World App") })
1791
1801
  ]
1792
1802
  }
1793
1803
  ),
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: [
1804
+ /* @__PURE__ */ jsxs7("div", { className: clsx_default("mb-3 space-y-4", { hidden: showQR }), children: [
1805
+ /* @__PURE__ */ jsxs7("div", { className: "flex items-center space-x-4", children: [
1796
1806
  /* @__PURE__ */ jsx11("hr", { className: "flex-1" }),
1797
1807
  /* @__PURE__ */ jsx11("span", { className: "text-xs font-medium text-9ba3ae", children: "or" }),
1798
1808
  /* @__PURE__ */ jsx11("hr", { className: "flex-1" })
@@ -1802,12 +1812,61 @@ var QRState = ({ qrData, showQR, setShowQR }) => {
1802
1812
  {
1803
1813
  className: "w-full rounded-2xl border border-ebecef p-4 text-lg font-medium text-3c424b",
1804
1814
  onClick: () => setShowQR((state) => !state),
1805
- children: showQR ? __("Hide QR Code") : __("Display QR Code")
1815
+ children: __("Display QR Code")
1806
1816
  }
1807
1817
  )
1808
1818
  ] })
1809
1819
  ] }),
1810
- (media == "desktop" || showQR) && /* @__PURE__ */ jsxs7(Fragment, { children: [
1820
+ showQR && /* @__PURE__ */ jsxs7("div", { className: "hidden md:block xl:hidden", children: [
1821
+ /* @__PURE__ */ jsx11("div", { className: "mb-4", children: /* @__PURE__ */ jsx11(
1822
+ motion.button,
1823
+ {
1824
+ className: "w-full rounded-2xl border border-ebecef p-4 text-lg font-medium text-3c424b",
1825
+ onClick: () => setShowQR(false),
1826
+ children: __("Hide QR Code")
1827
+ }
1828
+ ) }),
1829
+ /* @__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 ? (
1830
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
1831
+ /* @__PURE__ */ jsx11("div", { onClick: copyLink, className: "cursor-pointer", children: /* @__PURE__ */ jsx11(QRCode_default, { data: qrData, size: 200 }) })
1832
+ ) : /* @__PURE__ */ jsx11("div", { className: "flex size-[200px] items-center justify-center", children: /* @__PURE__ */ jsx11(QRPlaceholderIcon_default, { className: "size-[200px] animate-pulse" }) }) }) }),
1833
+ /* @__PURE__ */ jsx11(AnimatePresence, { children: copiedLink && /* @__PURE__ */ jsx11(
1834
+ motion.div,
1835
+ {
1836
+ className: "text-sm text-9eafc0 text-center",
1837
+ initial: "hidden",
1838
+ animate: "visible",
1839
+ exit: "exit",
1840
+ variants: {
1841
+ hidden: { opacity: 0, height: 0, marginTop: 0 },
1842
+ visible: {
1843
+ opacity: 1,
1844
+ height: "auto",
1845
+ marginTop: 8,
1846
+ transition: {
1847
+ duration: 0.25,
1848
+ opacity: { delay: 0.05, duration: 0.2 },
1849
+ ease: "easeInOut"
1850
+ }
1851
+ },
1852
+ exit: {
1853
+ opacity: 0,
1854
+ height: 0,
1855
+ marginTop: 0,
1856
+ transition: {
1857
+ duration: 0.4,
1858
+ delay: 0.1,
1859
+ opacity: { duration: 0.25, delay: 0 },
1860
+ ease: "easeInOut"
1861
+ }
1862
+ }
1863
+ },
1864
+ children: /* @__PURE__ */ jsx11("span", { className: "rounded-lg border border-f1f5f8 px-2 py-1 text-sm", children: __("QR Code copied") })
1865
+ },
1866
+ "copied"
1867
+ ) })
1868
+ ] }),
1869
+ /* @__PURE__ */ jsxs7("div", { className: "hidden xl:block", children: [
1811
1870
  /* @__PURE__ */ jsx11(AnimatePresence, { children: copiedLink && /* @__PURE__ */ jsx11(
1812
1871
  motion.div,
1813
1872
  {
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.1",
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",