@tightrope-dev/link-component 0.1.4 → 0.1.5

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/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx as i, jsxs as k, Fragment as Pe } from "react/jsx-runtime";
2
2
  import * as _ from "react";
3
- import { forwardRef as xe, createElement as ne, useState as V, useEffect as je } from "react";
3
+ import { forwardRef as xe, createElement as ne, useState as L, useEffect as je } from "react";
4
4
  import "react-dom";
5
5
  function de(e, t) {
6
6
  if (typeof e == "function")
@@ -26,7 +26,7 @@ function Me(...e) {
26
26
  // @__NO_SIDE_EFFECTS__
27
27
  function ye(e) {
28
28
  const t = /* @__PURE__ */ $e(e), r = _.forwardRef((o, n) => {
29
- const { children: s, ...l } = o, a = _.Children.toArray(s), u = a.find(Ve);
29
+ const { children: s, ...l } = o, a = _.Children.toArray(s), u = a.find(Le);
30
30
  if (u) {
31
31
  const d = u.props.children, b = a.map((w) => w === u ? _.Children.count(d) > 1 ? _.Children.only(null) : _.isValidElement(d) ? d.props.children : null : w);
32
32
  return /* @__PURE__ */ i(t, { ...l, ref: n, children: _.isValidElement(d) ? _.cloneElement(d, void 0, b) : null });
@@ -41,7 +41,7 @@ function $e(e) {
41
41
  const t = _.forwardRef((r, o) => {
42
42
  const { children: n, ...s } = r;
43
43
  if (_.isValidElement(n)) {
44
- const l = Ge(n), a = Le(s, n.props);
44
+ const l = Ge(n), a = Ve(s, n.props);
45
45
  return n.type !== _.Fragment && (a.ref = o ? Me(o, l) : l), _.cloneElement(n, a);
46
46
  }
47
47
  return _.Children.count(n) > 1 ? _.Children.only(null) : null;
@@ -49,10 +49,10 @@ function $e(e) {
49
49
  return t.displayName = `${e}.SlotClone`, t;
50
50
  }
51
51
  var Ee = Symbol("radix.slottable");
52
- function Ve(e) {
52
+ function Le(e) {
53
53
  return _.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === Ee;
54
54
  }
55
- function Le(e, t) {
55
+ function Ve(e, t) {
56
56
  const r = { ...t };
57
57
  for (const o in t) {
58
58
  const n = e[o], s = t[o];
@@ -152,7 +152,7 @@ const ue = (e) => typeof e == "boolean" ? `${e}` : e === 0 ? "0" : e, pe = ke, a
152
152
  nextPart: /* @__PURE__ */ new Map(),
153
153
  validators: []
154
154
  };
155
- return Be(Object.entries(e.classGroups), r).forEach(([s, l]) => {
155
+ return Ue(Object.entries(e.classGroups), r).forEach(([s, l]) => {
156
156
  se(l, o, s, t);
157
157
  }), o;
158
158
  }, se = (e, t, r, o) => {
@@ -185,10 +185,10 @@ const ue = (e) => typeof e == "boolean" ? `${e}` : e === 0 ? "0" : e, pe = ke, a
185
185
  validators: []
186
186
  }), r = r.nextPart.get(o);
187
187
  }), r;
188
- }, Fe = (e) => e.isThemeGetter, Be = (e, t) => t ? e.map(([r, o]) => {
188
+ }, Fe = (e) => e.isThemeGetter, Ue = (e, t) => t ? e.map(([r, o]) => {
189
189
  const n = o.map((s) => typeof s == "string" ? t + s : typeof s == "object" ? Object.fromEntries(Object.entries(s).map(([l, a]) => [t + l, a])) : s);
190
190
  return [r, n];
191
- }) : e, Ue = (e) => {
191
+ }) : e, Be = (e) => {
192
192
  if (e < 1)
193
193
  return {
194
194
  get: () => {
@@ -254,7 +254,7 @@ const ue = (e) => typeof e == "boolean" ? `${e}` : e === 0 ? "0" : e, pe = ke, a
254
254
  o[0] === "[" ? (t.push(...r.sort(), o), r = []) : r.push(o);
255
255
  }), t.push(...r.sort()), t;
256
256
  }, Ze = (e) => ({
257
- cache: Ue(e.cacheSize),
257
+ cache: Be(e.cacheSize),
258
258
  parseClassName: qe(e),
259
259
  ...Te(e)
260
260
  }), De = /\s+/, Je = (e, t) => {
@@ -330,7 +330,7 @@ function Xe(e, ...t) {
330
330
  const x = (e) => {
331
331
  const t = (r) => r[e] || [];
332
332
  return t.isThemeGetter = !0, t;
333
- }, ze = /^\[(?:([a-z-]+):)?(.+)\]$/i, Qe = /^\d+\/\d+$/, Ye = /* @__PURE__ */ new Set(["px", "full", "screen"]), et = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, tt = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, rt = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/, ot = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, nt = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, M = (e) => F(e) || Ye.has(e) || Qe.test(e), L = (e) => B(e, "length", pt), F = (e) => !!e && !Number.isNaN(Number(e)), Q = (e) => B(e, "number", F), Z = (e) => !!e && Number.isInteger(Number(e)), st = (e) => e.endsWith("%") && F(e.slice(0, -1)), c = (e) => ze.test(e), G = (e) => et.test(e), at = /* @__PURE__ */ new Set(["length", "size", "percentage"]), it = (e) => B(e, at, Ae), lt = (e) => B(e, "position", Ae), ct = /* @__PURE__ */ new Set(["image", "url"]), dt = (e) => B(e, ct, mt), ut = (e) => B(e, "", gt), D = () => !0, B = (e, t, r) => {
333
+ }, ze = /^\[(?:([a-z-]+):)?(.+)\]$/i, Qe = /^\d+\/\d+$/, Ye = /* @__PURE__ */ new Set(["px", "full", "screen"]), et = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, tt = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, rt = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/, ot = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, nt = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, M = (e) => F(e) || Ye.has(e) || Qe.test(e), V = (e) => U(e, "length", pt), F = (e) => !!e && !Number.isNaN(Number(e)), Q = (e) => U(e, "number", F), Z = (e) => !!e && Number.isInteger(Number(e)), st = (e) => e.endsWith("%") && F(e.slice(0, -1)), c = (e) => ze.test(e), G = (e) => et.test(e), at = /* @__PURE__ */ new Set(["length", "size", "percentage"]), it = (e) => U(e, at, Ae), lt = (e) => U(e, "position", Ae), ct = /* @__PURE__ */ new Set(["image", "url"]), dt = (e) => U(e, ct, mt), ut = (e) => U(e, "", gt), D = () => !0, U = (e, t, r) => {
334
334
  const o = ze.exec(e);
335
335
  return o ? o[1] ? typeof t == "string" ? o[1] === t : t.has(o[1]) : r(o[2]) : !1;
336
336
  }, pt = (e) => (
@@ -339,13 +339,13 @@ const x = (e) => {
339
339
  // I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
340
340
  tt.test(e) && !rt.test(e)
341
341
  ), Ae = () => !1, gt = (e) => ot.test(e), mt = (e) => nt.test(e), ft = () => {
342
- const e = x("colors"), t = x("spacing"), r = x("blur"), o = x("brightness"), n = x("borderColor"), s = x("borderRadius"), l = x("borderSpacing"), a = x("borderWidth"), u = x("contrast"), d = x("grayscale"), b = x("hueRotate"), w = x("invert"), C = x("gap"), A = x("gradientColorStops"), z = x("gradientColorStopPositions"), m = x("inset"), f = x("margin"), g = x("opacity"), N = x("padding"), $ = x("saturate"), R = x("scale"), T = x("sepia"), P = x("skew"), J = x("space"), K = x("translate"), O = () => ["auto", "contain", "none"], W = () => ["auto", "hidden", "clip", "visible", "scroll"], U = () => ["auto", c, t], h = () => [c, t], q = () => ["", M, L], p = () => ["auto", F, c], y = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], v = () => ["solid", "dashed", "dotted", "double", "none"], S = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], H = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], E = () => ["", "0", c], ce = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], j = () => [F, c];
342
+ const e = x("colors"), t = x("spacing"), r = x("blur"), o = x("brightness"), n = x("borderColor"), s = x("borderRadius"), l = x("borderSpacing"), a = x("borderWidth"), u = x("contrast"), d = x("grayscale"), b = x("hueRotate"), w = x("invert"), C = x("gap"), A = x("gradientColorStops"), z = x("gradientColorStopPositions"), m = x("inset"), f = x("margin"), g = x("opacity"), N = x("padding"), $ = x("saturate"), R = x("scale"), T = x("sepia"), P = x("skew"), J = x("space"), K = x("translate"), O = () => ["auto", "contain", "none"], W = () => ["auto", "hidden", "clip", "visible", "scroll"], B = () => ["auto", c, t], h = () => [c, t], q = () => ["", M, V], p = () => ["auto", F, c], y = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], v = () => ["solid", "dashed", "dotted", "double", "none"], S = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], H = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], E = () => ["", "0", c], ce = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], j = () => [F, c];
343
343
  return {
344
344
  cacheSize: 500,
345
345
  separator: ":",
346
346
  theme: {
347
347
  colors: [D],
348
- spacing: [M, L],
348
+ spacing: [M, V],
349
349
  blur: ["none", "", G, c],
350
350
  brightness: j(),
351
351
  borderColor: [e],
@@ -358,9 +358,9 @@ const x = (e) => {
358
358
  invert: E(),
359
359
  gap: h(),
360
360
  gradientColorStops: [e],
361
- gradientColorStopPositions: [st, L],
362
- inset: U(),
363
- margin: U(),
361
+ gradientColorStopPositions: [st, V],
362
+ inset: B(),
363
+ margin: B(),
364
364
  opacity: j(),
365
365
  padding: h(),
366
366
  saturate: j(),
@@ -592,7 +592,7 @@ const x = (e) => {
592
592
  * @see https://tailwindcss.com/docs/flex-basis
593
593
  */
594
594
  basis: [{
595
- basis: U()
595
+ basis: B()
596
596
  }],
597
597
  /**
598
598
  * Flex Direction
@@ -1010,7 +1010,7 @@ const x = (e) => {
1010
1010
  * @see https://tailwindcss.com/docs/font-size
1011
1011
  */
1012
1012
  "font-size": [{
1013
- text: ["base", G, L]
1013
+ text: ["base", G, V]
1014
1014
  }],
1015
1015
  /**
1016
1016
  * Font Smoothing
@@ -1161,7 +1161,7 @@ const x = (e) => {
1161
1161
  * @see https://tailwindcss.com/docs/text-decoration-thickness
1162
1162
  */
1163
1163
  "text-decoration-thickness": [{
1164
- decoration: ["auto", "from-font", M, L]
1164
+ decoration: ["auto", "from-font", M, V]
1165
1165
  }],
1166
1166
  /**
1167
1167
  * Text Underline Offset
@@ -1657,7 +1657,7 @@ const x = (e) => {
1657
1657
  * @see https://tailwindcss.com/docs/outline-width
1658
1658
  */
1659
1659
  "outline-w": [{
1660
- outline: [M, L]
1660
+ outline: [M, V]
1661
1661
  }],
1662
1662
  /**
1663
1663
  * Outline Color
@@ -1697,7 +1697,7 @@ const x = (e) => {
1697
1697
  * @see https://tailwindcss.com/docs/ring-offset-width
1698
1698
  */
1699
1699
  "ring-offset-w": [{
1700
- "ring-offset": [M, L]
1700
+ "ring-offset": [M, V]
1701
1701
  }],
1702
1702
  /**
1703
1703
  * Ring Offset Color
@@ -2292,7 +2292,7 @@ const x = (e) => {
2292
2292
  * @see https://tailwindcss.com/docs/stroke-width
2293
2293
  */
2294
2294
  "stroke-w": [{
2295
- stroke: [M, L, Q]
2295
+ stroke: [M, V, Q]
2296
2296
  }],
2297
2297
  /**
2298
2298
  * Stroke
@@ -2718,22 +2718,22 @@ const Et = [
2718
2718
  * This source code is licensed under the ISC license.
2719
2719
  * See the LICENSE file in the root directory of this source tree.
2720
2720
  */
2721
- const Vt = [
2721
+ const Lt = [
2722
2722
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
2723
2723
  ["path", { d: "m15 9-6 6", key: "1uzhvr" }],
2724
2724
  ["path", { d: "m9 9 6 6", key: "z0biqf" }]
2725
- ], oe = le("circle-x", Vt);
2725
+ ], oe = le("circle-x", Lt);
2726
2726
  /**
2727
2727
  * @license lucide-react v0.537.0 - ISC
2728
2728
  *
2729
2729
  * This source code is licensed under the ISC license.
2730
2730
  * See the LICENSE file in the root directory of this source tree.
2731
2731
  */
2732
- const Lt = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]], he = le("loader-circle", Lt), Gt = "_linkContainer_1iste_4", Tt = "_dark_1iste_29", ve = {
2732
+ const Vt = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]], he = le("loader-circle", Vt), Gt = "_linkContainer_1iste_4", Tt = "_dark_1iste_29", ve = {
2733
2733
  linkContainer: Gt,
2734
2734
  dark: Tt
2735
2735
  };
2736
- function Bt({
2736
+ function Ut({
2737
2737
  linkToken: e,
2738
2738
  apiBaseUrl: t = "https://api.tightrope.dev",
2739
2739
  onSuccess: r,
@@ -2745,17 +2745,23 @@ function Bt({
2745
2745
  description: u
2746
2746
  }) {
2747
2747
  var h, q;
2748
- const [d, b] = V([]), [w, C] = V(!0), [A, z] = V(null), [m, f] = V(
2748
+ const [d, b] = L([]), [w, C] = L(!0), [A, z] = L(null), [m, f] = L(
2749
2749
  null
2750
- ), [g, N] = V({
2750
+ ), [g, N] = L({
2751
2751
  username: "",
2752
2752
  password: "",
2753
2753
  auth_params: {}
2754
- }), [$, R] = V(!1), [T, P] = V(null), [J, K] = V(!1);
2754
+ }), [$, R] = L(!1), [T, P] = L(null), [J, K] = L(!1);
2755
2755
  je(() => {
2756
- (async () => {
2756
+ if (!e) {
2757
+ C(!1);
2758
+ return;
2759
+ }
2760
+ C(!0), (async () => {
2757
2761
  try {
2758
- const y = `${t}/integration_methods`, v = await fetch(y);
2762
+ const y = new URL(`${t}/integration_methods`);
2763
+ y.searchParams.set("link_token", e);
2764
+ const v = await fetch(y.toString());
2759
2765
  if (!v.ok)
2760
2766
  throw new Error(`Failed to fetch integrations: ${v.status}`);
2761
2767
  const S = await v.json();
@@ -2768,7 +2774,7 @@ function Bt({
2768
2774
  C(!1);
2769
2775
  }
2770
2776
  })();
2771
- }, [t, o]);
2777
+ }, [t, e, o]);
2772
2778
  const O = (p) => /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(p), W = () => {
2773
2779
  if (!m) return null;
2774
2780
  for (const p of d) {
@@ -2778,7 +2784,7 @@ function Bt({
2778
2784
  if (y) return y;
2779
2785
  }
2780
2786
  return null;
2781
- }, U = async (p) => {
2787
+ }, B = async (p) => {
2782
2788
  if (p.preventDefault(), !m || !g.username || !g.password) {
2783
2789
  P("Please fill in all fields");
2784
2790
  return;
@@ -2904,7 +2910,7 @@ function Bt({
2904
2910
  /* @__PURE__ */ k(
2905
2911
  "form",
2906
2912
  {
2907
- onSubmit: U,
2913
+ onSubmit: B,
2908
2914
  className: "flex flex-col gap-4 ",
2909
2915
  children: [
2910
2916
  /* @__PURE__ */ k("div", { className: "space-y-2", children: [
@@ -3016,6 +3022,6 @@ function Bt({
3016
3022
  );
3017
3023
  }
3018
3024
  export {
3019
- Bt as Link
3025
+ Ut as Link
3020
3026
  };
3021
3027
  //# sourceMappingURL=index.js.map