@mateosuarezdev/react-ui 1.0.43 → 1.0.44

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.d.ts CHANGED
@@ -661,7 +661,7 @@ declare interface SelectProps<T> {
661
661
  onChange: (value: T) => void;
662
662
  idExtractor: (item: T) => string | number;
663
663
  labelExtractor: (item: T) => string;
664
- descriptionExtractor?: (item: T) => string;
664
+ descriptionExtractor?: (item: T) => string | undefined;
665
665
  classNameExtractor?: (isSelected: boolean) => string;
666
666
  customGetter?: (value: any, options: T[]) => T | null | undefined;
667
667
  customSetter?: (item: T) => any;
package/dist/index.js CHANGED
@@ -1187,7 +1187,7 @@ function Bo(e, t) {
1187
1187
  const r = ee(e, t?.in), n = +ze(r, t) - +Ho(r, t);
1188
1188
  return Math.round(n / _r) + 1;
1189
1189
  }
1190
- function I(e, t) {
1190
+ function j(e, t) {
1191
1191
  const r = e < 0 ? "-" : "", n = Math.abs(e).toString().padStart(t, "0");
1192
1192
  return r + n;
1193
1193
  }
@@ -1195,16 +1195,16 @@ const ge = {
1195
1195
  // Year
1196
1196
  y(e, t) {
1197
1197
  const r = e.getFullYear(), n = r > 0 ? r : 1 - r;
1198
- return I(t === "yy" ? n % 100 : n, t.length);
1198
+ return j(t === "yy" ? n % 100 : n, t.length);
1199
1199
  },
1200
1200
  // Month
1201
1201
  M(e, t) {
1202
1202
  const r = e.getMonth();
1203
- return t === "M" ? String(r + 1) : I(r + 1, 2);
1203
+ return t === "M" ? String(r + 1) : j(r + 1, 2);
1204
1204
  },
1205
1205
  // Day of the month
1206
1206
  d(e, t) {
1207
- return I(e.getDate(), t.length);
1207
+ return j(e.getDate(), t.length);
1208
1208
  },
1209
1209
  // AM or PM
1210
1210
  a(e, t) {
@@ -1224,26 +1224,26 @@ const ge = {
1224
1224
  },
1225
1225
  // Hour [1-12]
1226
1226
  h(e, t) {
1227
- return I(e.getHours() % 12 || 12, t.length);
1227
+ return j(e.getHours() % 12 || 12, t.length);
1228
1228
  },
1229
1229
  // Hour [0-23]
1230
1230
  H(e, t) {
1231
- return I(e.getHours(), t.length);
1231
+ return j(e.getHours(), t.length);
1232
1232
  },
1233
1233
  // Minute
1234
1234
  m(e, t) {
1235
- return I(e.getMinutes(), t.length);
1235
+ return j(e.getMinutes(), t.length);
1236
1236
  },
1237
1237
  // Second
1238
1238
  s(e, t) {
1239
- return I(e.getSeconds(), t.length);
1239
+ return j(e.getSeconds(), t.length);
1240
1240
  },
1241
1241
  // Fraction of second
1242
1242
  S(e, t) {
1243
1243
  const r = t.length, n = e.getMilliseconds(), o = Math.trunc(
1244
1244
  n * Math.pow(10, r - 3)
1245
1245
  );
1246
- return I(o, t.length);
1246
+ return j(o, t.length);
1247
1247
  }
1248
1248
  }, De = {
1249
1249
  midnight: "midnight",
@@ -1284,14 +1284,14 @@ const ge = {
1284
1284
  const o = jr(e, n), a = o > 0 ? o : 1 - o;
1285
1285
  if (t === "YY") {
1286
1286
  const s = a % 100;
1287
- return I(s, 2);
1287
+ return j(s, 2);
1288
1288
  }
1289
- return t === "Yo" ? r.ordinalNumber(a, { unit: "year" }) : I(a, t.length);
1289
+ return t === "Yo" ? r.ordinalNumber(a, { unit: "year" }) : j(a, t.length);
1290
1290
  },
1291
1291
  // ISO week-numbering year
1292
1292
  R: function(e, t) {
1293
1293
  const r = Yr(e);
1294
- return I(r, t.length);
1294
+ return j(r, t.length);
1295
1295
  },
1296
1296
  // Extended year. This is a single number designating the year of this calendar system.
1297
1297
  // The main difference between `y` and `u` localizers are B.C. years:
@@ -1304,7 +1304,7 @@ const ge = {
1304
1304
  // while `uu` pads single digit years to 2 characters and returns other years unchanged.
1305
1305
  u: function(e, t) {
1306
1306
  const r = e.getFullYear();
1307
- return I(r, t.length);
1307
+ return j(r, t.length);
1308
1308
  },
1309
1309
  // Quarter
1310
1310
  Q: function(e, t, r) {
@@ -1315,7 +1315,7 @@ const ge = {
1315
1315
  return String(n);
1316
1316
  // 01, 02, 03, 04
1317
1317
  case "QQ":
1318
- return I(n, 2);
1318
+ return j(n, 2);
1319
1319
  // 1st, 2nd, 3rd, 4th
1320
1320
  case "Qo":
1321
1321
  return r.ordinalNumber(n, { unit: "quarter" });
@@ -1349,7 +1349,7 @@ const ge = {
1349
1349
  return String(n);
1350
1350
  // 01, 02, 03, 04
1351
1351
  case "qq":
1352
- return I(n, 2);
1352
+ return j(n, 2);
1353
1353
  // 1st, 2nd, 3rd, 4th
1354
1354
  case "qo":
1355
1355
  return r.ordinalNumber(n, { unit: "quarter" });
@@ -1411,7 +1411,7 @@ const ge = {
1411
1411
  return String(n + 1);
1412
1412
  // 01, 02, ..., 12
1413
1413
  case "LL":
1414
- return I(n + 1, 2);
1414
+ return j(n + 1, 2);
1415
1415
  // 1st, 2nd, ..., 12th
1416
1416
  case "Lo":
1417
1417
  return r.ordinalNumber(n + 1, { unit: "month" });
@@ -1436,12 +1436,12 @@ const ge = {
1436
1436
  // Local week of year
1437
1437
  w: function(e, t, r, n) {
1438
1438
  const o = Bo(e, n);
1439
- return t === "wo" ? r.ordinalNumber(o, { unit: "week" }) : I(o, t.length);
1439
+ return t === "wo" ? r.ordinalNumber(o, { unit: "week" }) : j(o, t.length);
1440
1440
  },
1441
1441
  // ISO week of year
1442
1442
  I: function(e, t, r) {
1443
1443
  const n = zo(e);
1444
- return t === "Io" ? r.ordinalNumber(n, { unit: "week" }) : I(n, t.length);
1444
+ return t === "Io" ? r.ordinalNumber(n, { unit: "week" }) : j(n, t.length);
1445
1445
  },
1446
1446
  // Day of the month
1447
1447
  d: function(e, t, r) {
@@ -1450,7 +1450,7 @@ const ge = {
1450
1450
  // Day of year
1451
1451
  D: function(e, t, r) {
1452
1452
  const n = jo(e);
1453
- return t === "Do" ? r.ordinalNumber(n, { unit: "dayOfYear" }) : I(n, t.length);
1453
+ return t === "Do" ? r.ordinalNumber(n, { unit: "dayOfYear" }) : j(n, t.length);
1454
1454
  },
1455
1455
  // Day of week
1456
1456
  E: function(e, t, r) {
@@ -1494,7 +1494,7 @@ const ge = {
1494
1494
  return String(a);
1495
1495
  // Padded numerical value
1496
1496
  case "ee":
1497
- return I(a, 2);
1497
+ return j(a, 2);
1498
1498
  // 1st, 2nd, ..., 7th
1499
1499
  case "eo":
1500
1500
  return r.ordinalNumber(a, { unit: "day" });
@@ -1533,7 +1533,7 @@ const ge = {
1533
1533
  return String(a);
1534
1534
  // Padded numerical value
1535
1535
  case "cc":
1536
- return I(a, t.length);
1536
+ return j(a, t.length);
1537
1537
  // 1st, 2nd, ..., 7th
1538
1538
  case "co":
1539
1539
  return r.ordinalNumber(a, { unit: "day" });
@@ -1572,7 +1572,7 @@ const ge = {
1572
1572
  return String(o);
1573
1573
  // 02
1574
1574
  case "ii":
1575
- return I(o, t.length);
1575
+ return j(o, t.length);
1576
1576
  // 2nd
1577
1577
  case "io":
1578
1578
  return r.ordinalNumber(o, { unit: "day" });
@@ -1700,12 +1700,12 @@ const ge = {
1700
1700
  // Hour [0-11]
1701
1701
  K: function(e, t, r) {
1702
1702
  const n = e.getHours() % 12;
1703
- return t === "Ko" ? r.ordinalNumber(n, { unit: "hour" }) : I(n, t.length);
1703
+ return t === "Ko" ? r.ordinalNumber(n, { unit: "hour" }) : j(n, t.length);
1704
1704
  },
1705
1705
  // Hour [1-24]
1706
1706
  k: function(e, t, r) {
1707
1707
  let n = e.getHours();
1708
- return n === 0 && (n = 24), t === "ko" ? r.ordinalNumber(n, { unit: "hour" }) : I(n, t.length);
1708
+ return n === 0 && (n = 24), t === "ko" ? r.ordinalNumber(n, { unit: "hour" }) : j(n, t.length);
1709
1709
  },
1710
1710
  // Minute
1711
1711
  m: function(e, t, r) {
@@ -1800,22 +1800,22 @@ const ge = {
1800
1800
  // Seconds timestamp
1801
1801
  t: function(e, t, r) {
1802
1802
  const n = Math.trunc(+e / 1e3);
1803
- return I(n, t.length);
1803
+ return j(n, t.length);
1804
1804
  },
1805
1805
  // Milliseconds timestamp
1806
1806
  T: function(e, t, r) {
1807
- return I(+e, t.length);
1807
+ return j(+e, t.length);
1808
1808
  }
1809
1809
  };
1810
1810
  function lr(e, t = "") {
1811
1811
  const r = e > 0 ? "-" : "+", n = Math.abs(e), o = Math.trunc(n / 60), a = n % 60;
1812
- return a === 0 ? r + String(o) : r + String(o) + t + I(a, 2);
1812
+ return a === 0 ? r + String(o) : r + String(o) + t + j(a, 2);
1813
1813
  }
1814
1814
  function cr(e, t) {
1815
- return e % 60 === 0 ? (e > 0 ? "-" : "+") + I(Math.abs(e) / 60, 2) : Ne(e, t);
1815
+ return e % 60 === 0 ? (e > 0 ? "-" : "+") + j(Math.abs(e) / 60, 2) : Ne(e, t);
1816
1816
  }
1817
1817
  function Ne(e, t = "") {
1818
- const r = e > 0 ? "-" : "+", n = Math.abs(e), o = I(Math.trunc(n / 60), 2), a = I(n % 60, 2);
1818
+ const r = e > 0 ? "-" : "+", n = Math.abs(e), o = j(Math.trunc(n / 60), 2), a = j(n % 60, 2);
1819
1819
  return r + o + t + a;
1820
1820
  }
1821
1821
  const ur = (e, t) => {
@@ -4216,7 +4216,7 @@ const ji = ({
4216
4216
  getPopoverPosition: p,
4217
4217
  open: M,
4218
4218
  toggle: C,
4219
- close: W
4219
+ close: F
4220
4220
  } = Ht({
4221
4221
  align: "start",
4222
4222
  side: "top",
@@ -4227,11 +4227,11 @@ const ji = ({
4227
4227
  onClose: () => {
4228
4228
  S(!1), v(""), D(-1);
4229
4229
  }
4230
- }), j = T(
4230
+ }), I = T(
4231
4231
  `multiselect-${Math.random().toString(36).substr(2, 9)}`
4232
4232
  ).current, X = T(
4233
4233
  `label-${Math.random().toString(36).substr(2, 9)}`
4234
- ).current, F = T(
4234
+ ).current, W = T(
4235
4235
  `error-${Math.random().toString(36).substr(2, 9)}`
4236
4236
  ).current, w = T(
4237
4237
  `listbox-${Math.random().toString(36).substr(2, 9)}`
@@ -4289,7 +4289,7 @@ const ji = ({
4289
4289
  O.preventDefault(), M ? _ >= 0 && _e(Q[_]) : C();
4290
4290
  break;
4291
4291
  case "Escape":
4292
- O.preventDefault(), W();
4292
+ O.preventDefault(), F();
4293
4293
  break;
4294
4294
  case "ArrowDown":
4295
4295
  if (O.preventDefault(), !M)
@@ -4320,7 +4320,7 @@ const ji = ({
4320
4320
  console.log(`Accessibility announcement: ${O}`);
4321
4321
  };
4322
4322
  Bt($, (O) => {
4323
- !L.current || !M || !O.target || L.current.contains(O.target) || W();
4323
+ !L.current || !M || !O.target || L.current.contains(O.target) || F();
4324
4324
  });
4325
4325
  const Et = p();
4326
4326
  return /* @__PURE__ */ y("div", { className: N("relative", h), children: [
@@ -4358,7 +4358,7 @@ const ji = ({
4358
4358
  "aria-haspopup": "listbox",
4359
4359
  "aria-owns": w,
4360
4360
  "aria-labelledby": X,
4361
- "aria-describedby": l ? F : void 0,
4361
+ "aria-describedby": l ? W : void 0,
4362
4362
  onKeyDown: Je,
4363
4363
  tabIndex: b ? -1 : 0,
4364
4364
  children: [
@@ -4366,7 +4366,7 @@ const ji = ({
4366
4366
  "label",
4367
4367
  {
4368
4368
  id: X,
4369
- htmlFor: j,
4369
+ htmlFor: I,
4370
4370
  className: N(
4371
4371
  "absolute transition-all duration-200 pointer-events-none",
4372
4372
  "text-base top-4 font-semibold left-3",
@@ -4420,7 +4420,7 @@ const ji = ({
4420
4420
  "input",
4421
4421
  {
4422
4422
  ref: P,
4423
- id: j,
4423
+ id: I,
4424
4424
  type: "text",
4425
4425
  className: "flex-grow min-w-[60px] bg-transparent outline-none placeholder:text-sm",
4426
4426
  value: g,
@@ -4511,7 +4511,7 @@ const ji = ({
4511
4511
  l && /* @__PURE__ */ d(
4512
4512
  "p",
4513
4513
  {
4514
- id: F,
4514
+ id: W,
4515
4515
  className: "text-red-9 text-xs mt-1",
4516
4516
  "aria-live": "assertive",
4517
4517
  children: l
@@ -4576,46 +4576,46 @@ const ji = ({
4576
4576
  ));
4577
4577
  }),
4578
4578
  []
4579
- ), k = A((F) => {
4579
+ ), k = A((W) => {
4580
4580
  const { maxScroll: w } = D.current;
4581
- return F > 0 ? Math.pow(F, 0.8) : F < -w ? -w - Math.pow(-(F + w), 0.8) : F;
4581
+ return W > 0 ? Math.pow(W, 0.8) : W < -w ? -w - Math.pow(-(W + w), 0.8) : W;
4582
4582
  }, []), L = A(() => {
4583
4583
  if (!u || !m.current || !g.current)
4584
4584
  return;
4585
- const { currentY: F, maxScroll: w } = D.current, V = m.current.offsetHeight, K = Math.max(
4585
+ const { currentY: W, maxScroll: w } = D.current, V = m.current.offsetHeight, K = Math.max(
4586
4586
  30,
4587
4587
  V / (V + w) * V
4588
4588
  ), ie = V - K;
4589
- let Q = -F / w * ie, oe = 1;
4590
- F > 0 ? (Q = 0, oe = 1 - F / V, g.current.style.transformOrigin = "top") : F < -w ? (Q = ie, oe = 1 - Math.abs(F + w) / V, g.current.style.transformOrigin = "bottom") : g.current.style.transformOrigin = "top", g.current.style.transform = `translate3d(0, ${Q}px, 0) scaleY(${oe})`, g.current.style.height = `${K}px`;
4589
+ let Q = -W / w * ie, oe = 1;
4590
+ W > 0 ? (Q = 0, oe = 1 - W / V, g.current.style.transformOrigin = "top") : W < -w ? (Q = ie, oe = 1 - Math.abs(W + w) / V, g.current.style.transformOrigin = "bottom") : g.current.style.transformOrigin = "top", g.current.style.transform = `translate3d(0, ${Q}px, 0) scaleY(${oe})`, g.current.style.height = `${K}px`;
4591
4591
  }, [u]), Y = A(
4592
- (F) => {
4593
- if (D.current.currentY = F, b.current && (b.current.style.transform = `translate3d(0, ${F}px, 0)`), h.current) {
4592
+ (W) => {
4593
+ if (D.current.currentY = W, b.current && (b.current.style.transform = `translate3d(0, ${W}px, 0)`), h.current) {
4594
4594
  const w = Math.max(
4595
- F - D.current.refreshThreshold,
4595
+ W - D.current.refreshThreshold,
4596
4596
  -D.current.refreshThreshold
4597
4597
  );
4598
4598
  h.current.style.transform = `translate3d(0, ${w}px, 0)`;
4599
4599
  }
4600
- f && f(F), L();
4600
+ f && f(W), L();
4601
4601
  },
4602
4602
  [L]
4603
4603
  ), $ = A(
4604
- (F) => {
4604
+ (W) => {
4605
4605
  const w = D.current;
4606
4606
  w.frameCallback && (te(w.frameCallback), w.frameCallback = null);
4607
- const V = performance.now(), K = w.currentY, ie = F - K, Q = () => {
4607
+ const V = performance.now(), K = w.currentY, ie = W - K, Q = () => {
4608
4608
  const oe = performance.now() - V, _e = Math.min(oe / l, 1), Ge = 1 - Math.pow(1 - _e, 3), Je = K + ie * Ge;
4609
- Y(Je), _e >= 1 && (w.frameCallback && (te(w.frameCallback), w.frameCallback = null), Y(F), F === 0 && h.current && (h.current.textContent = "Pull to refresh"));
4609
+ Y(Je), _e >= 1 && (w.frameCallback && (te(w.frameCallback), w.frameCallback = null), Y(W), W === 0 && h.current && (h.current.textContent = "Pull to refresh"));
4610
4610
  };
4611
4611
  w.frameCallback = at.render(Q, !0);
4612
4612
  },
4613
4613
  [Y, l]
4614
4614
  ), p = A(
4615
- (F) => {
4615
+ (W) => {
4616
4616
  const w = D.current;
4617
4617
  w.frameCallback && (te(w.frameCallback), w.frameCallback = null);
4618
- let V = F, K = Date.now();
4618
+ let V = W, K = Date.now();
4619
4619
  const ie = () => {
4620
4620
  const Q = Date.now(), oe = Q - K;
4621
4621
  if (K = Q, V *= Math.pow(0.95, oe / 16), w.currentY += V * oe, w.currentY > 0 || w.currentY < -w.maxScroll) {
@@ -4632,14 +4632,14 @@ const ji = ({
4632
4632
  v.current !== null && clearTimeout(v.current), requestAnimationFrame(() => {
4633
4633
  g.current && (g.current.style.opacity = "1");
4634
4634
  });
4635
- const F = window.requestIdleCallback || ((w) => setTimeout(w, 1e3));
4635
+ const W = window.requestIdleCallback || ((w) => setTimeout(w, 1e3));
4636
4636
  v.current = window.setTimeout(() => {
4637
- F(() => {
4637
+ W(() => {
4638
4638
  g.current && (g.current.style.opacity = "0"), v.current = null;
4639
4639
  });
4640
4640
  }, 1e3);
4641
4641
  }, [u]), C = A(
4642
- (F) => {
4642
+ (W) => {
4643
4643
  if (_.current !== null && Date.now() - _.current < 50)
4644
4644
  return;
4645
4645
  _.current = Date.now();
@@ -4647,11 +4647,11 @@ const ji = ({
4647
4647
  w.isScrolling = !0, w.startY = w.currentY, w.lastTimestamp = Date.now(), w.isPullingToRefresh = w.currentY === 0, w.pullDistance = 0, w.frameCallback && (te(w.frameCallback), w.frameCallback = null), M();
4648
4648
  },
4649
4649
  [M]
4650
- ), W = A(
4651
- (F) => {
4650
+ ), F = A(
4651
+ (W) => {
4652
4652
  const w = D.current;
4653
4653
  if (!w.isScrolling) return;
4654
- const V = k(w.startY + F.deltaY);
4654
+ const V = k(w.startY + W.deltaY);
4655
4655
  w.isPullingToRefresh && V < w.startY && (w.isPullingToRefresh = !1), Y(V), a && w.isPullingToRefresh && !E && V > 0 && (w.pullDistance = V, h.current && (h.current.textContent = w.pullDistance > w.refreshThreshold ? "Release to refresh" : "Pull to refresh")), M();
4656
4656
  },
4657
4657
  [
@@ -4661,10 +4661,10 @@ const ji = ({
4661
4661
  M,
4662
4662
  k
4663
4663
  ]
4664
- ), j = A(
4665
- (F) => {
4664
+ ), I = A(
4665
+ (W) => {
4666
4666
  const w = D.current;
4667
- w.isScrolling && (w.isScrolling = !1, a && w.isPullingToRefresh && !E && w.pullDistance > w.refreshThreshold ? X() : w.currentY > 0 || w.currentY < -w.maxScroll ? $(w.currentY > 0 ? 0 : -w.maxScroll) : p(F.velocityY), w.isPullingToRefresh = !1);
4667
+ w.isScrolling && (w.isScrolling = !1, a && w.isPullingToRefresh && !E && w.pullDistance > w.refreshThreshold ? X() : w.currentY > 0 || w.currentY < -w.maxScroll ? $(w.currentY > 0 ? 0 : -w.maxScroll) : p(W.velocityY), w.isPullingToRefresh = !1);
4668
4668
  },
4669
4669
  [a, p, $, E]
4670
4670
  ), X = A(() => {
@@ -4674,7 +4674,7 @@ const ji = ({
4674
4674
  }, [a, $]);
4675
4675
  return B(() => {
4676
4676
  if (!m.current) return;
4677
- const F = Fr(m.current, {
4677
+ const W = Fr(m.current, {
4678
4678
  name: "page-scroller-gesture",
4679
4679
  // threshold: 0, due to small miss touches
4680
4680
  // maybe if implementing proper stop propagation
@@ -4684,11 +4684,11 @@ const ji = ({
4684
4684
  passive: !0,
4685
4685
  direction: "y",
4686
4686
  onStart: C,
4687
- onMove: W,
4688
- onEnd: j
4687
+ onMove: F,
4688
+ onEnd: I
4689
4689
  });
4690
- return F.init(), () => F.destroy();
4691
- }, [C, W, j]), B(() => {
4690
+ return W.init(), () => W.destroy();
4691
+ }, [C, F, I]), B(() => {
4692
4692
  if (m.current)
4693
4693
  return x(), L(), window.addEventListener("resize", x), () => {
4694
4694
  window.removeEventListener("resize", x), v.current !== null && clearTimeout(v.current);
@@ -4823,9 +4823,9 @@ function Ui({
4823
4823
  const { currentY: $, maxScroll: p } = h.current, M = s.current.offsetHeight, C = Math.max(
4824
4824
  30,
4825
4825
  M / (M + p) * M
4826
- ), W = M - C;
4827
- let j = -$ / p * W, X = 1;
4828
- $ > 0 ? (j = 0, X = 1 - $ / M, l.current.style.transformOrigin = "top") : $ < -p ? (j = W, X = 1 - Math.abs($ + p) / M, l.current.style.transformOrigin = "bottom") : l.current.style.transformOrigin = "top", l.current.style.transform = `translate3d(0, ${j}px, 0) scaleY(${X})`, l.current.style.height = `${C}px`;
4826
+ ), F = M - C;
4827
+ let I = -$ / p * F, X = 1;
4828
+ $ > 0 ? (I = 0, X = 1 - $ / M, l.current.style.transformOrigin = "top") : $ < -p ? (I = F, X = 1 - Math.abs($ + p) / M, l.current.style.transformOrigin = "bottom") : l.current.style.transformOrigin = "top", l.current.style.transform = `translate3d(0, ${I}px, 0) scaleY(${X})`, l.current.style.height = `${C}px`;
4829
4829
  }, [t]), S = A(
4830
4830
  ($) => {
4831
4831
  if (h.current.currentY = $, i.current && (i.current.style.transform = `translate3d(0, ${$}px, 0)`), c.current) {
@@ -4842,11 +4842,11 @@ function Ui({
4842
4842
  ($) => {
4843
4843
  const p = h.current;
4844
4844
  p.frameCallback && (te(p.frameCallback), p.frameCallback = null);
4845
- const M = performance.now(), C = p.currentY, W = $ - C, j = () => {
4846
- const X = performance.now() - M, F = Math.min(X / n, 1), w = 1 - Math.pow(1 - F, 3), V = C + W * w;
4847
- S(V), F >= 1 && (p.frameCallback && (te(p.frameCallback), p.frameCallback = null), S($));
4845
+ const M = performance.now(), C = p.currentY, F = $ - C, I = () => {
4846
+ const X = performance.now() - M, W = Math.min(X / n, 1), w = 1 - Math.pow(1 - W, 3), V = C + F * w;
4847
+ S(V), W >= 1 && (p.frameCallback && (te(p.frameCallback), p.frameCallback = null), S($));
4848
4848
  };
4849
- p.frameCallback = at.render(j, !0);
4849
+ p.frameCallback = at.render(I, !0);
4850
4850
  },
4851
4851
  [S, n]
4852
4852
  ), D = A(
@@ -4854,15 +4854,15 @@ function Ui({
4854
4854
  const p = h.current;
4855
4855
  p.frameCallback && (te(p.frameCallback), p.frameCallback = null);
4856
4856
  let M = $, C = Date.now();
4857
- const W = () => {
4858
- const j = Date.now(), X = j - C;
4859
- if (C = j, M *= Math.pow(0.95, X / 16), p.currentY += M * X, p.currentY > 0 || p.currentY < -p.maxScroll) {
4857
+ const F = () => {
4858
+ const I = Date.now(), X = I - C;
4859
+ if (C = I, M *= Math.pow(0.95, X / 16), p.currentY += M * X, p.currentY > 0 || p.currentY < -p.maxScroll) {
4860
4860
  p.frameCallback && (te(p.frameCallback), p.frameCallback = null), _(p.currentY > 0 ? 0 : -p.maxScroll);
4861
4861
  return;
4862
4862
  }
4863
4863
  S(p.currentY), Math.abs(M) < 0.01 && p.frameCallback && (te(p.frameCallback), p.frameCallback = null);
4864
4864
  };
4865
- p.frameCallback = at.render(W, !0);
4865
+ p.frameCallback = at.render(F, !0);
4866
4866
  },
4867
4867
  [S, _]
4868
4868
  ), P = A(() => {
@@ -5656,7 +5656,7 @@ function Zs({
5656
5656
  ),
5657
5657
  role: "listbox",
5658
5658
  children: r.map((p, M) => {
5659
- const C = !!($ && a(p) === a($));
5659
+ const C = !!($ && a(p) === a($)), F = M === g, I = i?.(p);
5660
5660
  return /* @__PURE__ */ y(
5661
5661
  "div",
5662
5662
  {
@@ -5665,7 +5665,7 @@ function Zs({
5665
5665
  // gap-x-2
5666
5666
  "first:rounded-t-6 last:rounded-b-6 relative",
5667
5667
  // !selected && "pl-9",
5668
- M === g && "bg-base-3 dark-theme:bg-base-4",
5668
+ F && "bg-base-3 dark-theme:bg-base-4",
5669
5669
  C && "bg-brandfadedbg text-brand",
5670
5670
  c && c(C)
5671
5671
  ),
@@ -5680,7 +5680,7 @@ function Zs({
5680
5680
  s(p),
5681
5681
  " "
5682
5682
  ] }),
5683
- i && /* @__PURE__ */ d("p", { className: "text-xs text-base-11 mt-0.5 line-clamp-2", children: i(p) })
5683
+ I && /* @__PURE__ */ d("p", { className: "text-xs text-base-11 mt-0.5 line-clamp-2", children: I })
5684
5684
  ] }),
5685
5685
  C && /* @__PURE__ */ d(je, { size: 16, className: "shrink-0" })
5686
5686
  ]
@@ -6053,41 +6053,41 @@ const oi = ({
6053
6053
  const k = (C) => {
6054
6054
  if (C.key === "Enter" && u.trim()) {
6055
6055
  C.preventDefault();
6056
- const W = u.trim();
6056
+ const F = u.trim();
6057
6057
  if (c && n.length >= c) {
6058
6058
  g(`Maximum of ${c} tags allowed`);
6059
6059
  return;
6060
6060
  }
6061
- if (n.includes(W)) {
6061
+ if (n.includes(F)) {
6062
6062
  g("Tag already exists");
6063
6063
  return;
6064
6064
  }
6065
6065
  if (l) {
6066
- const j = l(W);
6067
- if (typeof j == "string") {
6068
- g(j);
6066
+ const I = l(F);
6067
+ if (typeof I == "string") {
6068
+ g(I);
6069
6069
  return;
6070
- } else if (j === !1) {
6070
+ } else if (I === !1) {
6071
6071
  g("Invalid tag");
6072
6072
  return;
6073
6073
  }
6074
6074
  }
6075
- o([...n, W]), f(""), g(null), M(`Added tag ${W}`);
6075
+ o([...n, F]), f(""), g(null), M(`Added tag ${F}`);
6076
6076
  } else if (C.key === "Backspace" && !u && n.length > 0) {
6077
- const W = n[n.length - 1];
6078
- o(n.slice(0, -1)), M(`Removed tag ${W}`);
6077
+ const F = n[n.length - 1];
6078
+ o(n.slice(0, -1)), M(`Removed tag ${F}`);
6079
6079
  } else C.key === "ArrowLeft" && u === "" && n.length > 0 && S.current[n.length - 1] && S.current[n.length - 1]?.focus();
6080
- }, L = (C, W) => {
6080
+ }, L = (C, F) => {
6081
6081
  if (C.key === "Backspace" || C.key === "Delete") {
6082
6082
  C.preventDefault();
6083
- const j = n[W], X = [...n];
6084
- X.splice(W, 1), o(X), setTimeout(() => {
6083
+ const I = n[F], X = [...n];
6084
+ X.splice(F, 1), o(X), setTimeout(() => {
6085
6085
  v.current && v.current.focus();
6086
- }, 0), M(`Removed tag ${j}`);
6087
- } else C.key === "ArrowRight" ? (C.preventDefault(), W < n.length - 1 ? S.current[W + 1]?.focus() : v.current?.focus()) : C.key === "ArrowLeft" && (C.preventDefault(), W > 0 && S.current[W - 1]?.focus());
6088
- }, Y = (C, W) => {
6089
- o(n.filter((j) => j !== C)), setTimeout(() => {
6090
- W < n.length - 1 ? S.current[W]?.focus() : W > 0 ? S.current[W - 1]?.focus() : v.current?.focus();
6086
+ }, 0), M(`Removed tag ${I}`);
6087
+ } else C.key === "ArrowRight" ? (C.preventDefault(), F < n.length - 1 ? S.current[F + 1]?.focus() : v.current?.focus()) : C.key === "ArrowLeft" && (C.preventDefault(), F > 0 && S.current[F - 1]?.focus());
6088
+ }, Y = (C, F) => {
6089
+ o(n.filter((I) => I !== C)), setTimeout(() => {
6090
+ F < n.length - 1 ? S.current[F]?.focus() : F > 0 ? S.current[F - 1]?.focus() : v.current?.focus();
6091
6091
  }, 0), M(`Removed tag ${C}`);
6092
6092
  }, $ = (C) => {
6093
6093
  f(C.target.value), g(null);
@@ -6158,11 +6158,11 @@ const oi = ({
6158
6158
  "mt-2.5": t === "floating"
6159
6159
  }),
6160
6160
  children: [
6161
- n.map((C, W) => /* @__PURE__ */ y(
6161
+ n.map((C, F) => /* @__PURE__ */ y(
6162
6162
  "div",
6163
6163
  {
6164
- ref: (j) => {
6165
- S.current[W] = j;
6164
+ ref: (I) => {
6165
+ S.current[F] = I;
6166
6166
  },
6167
6167
  className: N(
6168
6168
  "line-clamp-1 text-brand rounded-full px-2 text-sm flex items-center",
@@ -6174,7 +6174,7 @@ const oi = ({
6174
6174
  tabIndex: 0,
6175
6175
  role: "button",
6176
6176
  "aria-label": `${C}, press delete or backspace to remove`,
6177
- onKeyDown: (j) => L(j, W),
6177
+ onKeyDown: (I) => L(I, F),
6178
6178
  children: [
6179
6179
  C,
6180
6180
  /* @__PURE__ */ d(
@@ -6182,14 +6182,14 @@ const oi = ({
6182
6182
  {
6183
6183
  type: "button",
6184
6184
  className: "ml-1 text-brand hover:text-brandhover shrink-0",
6185
- onClick: () => Y(C, W),
6185
+ onClick: () => Y(C, F),
6186
6186
  "aria-label": `Remove ${C} tag`,
6187
6187
  children: "x"
6188
6188
  }
6189
6189
  )
6190
6190
  ]
6191
6191
  },
6192
- `${C}-${W}`
6192
+ `${C}-${F}`
6193
6193
  )),
6194
6194
  /* @__PURE__ */ d(
6195
6195
  "input",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mateosuarezdev/react-ui",
3
- "version": "1.0.43",
3
+ "version": "1.0.44",
4
4
  "description": "Dynamic React UI library designed to work alongside @mateosuarezdev/react-router",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",