@photoroom/ui 0.1.524 → 0.1.525

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.
@@ -1 +1 @@
1
- {"version":3,"file":"NumberSelectField.d.ts","sourceRoot":"","sources":["../../../../src/components/unsorted/NumberSelectField/NumberSelectField.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAqD,MAAM,OAAO,CAAC;AAS1F,yFAAyF;AACzF,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG,SAAS,CAAC;AAE1D,KAAK,sBAAsB,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,UAAU,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC,GAAG;IACjG,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,IAAI,CAAC,EAAE,qBAAqB,CAAC;CAC9B,CAAC;AAKF,eAAO,MAAM,iBAAiB,GAAI,kFAW/B,sBAAsB,gCAwXxB,CAAC"}
1
+ {"version":3,"file":"NumberSelectField.d.ts","sourceRoot":"","sources":["../../../../src/components/unsorted/NumberSelectField/NumberSelectField.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAqD,MAAM,OAAO,CAAC;AAS1F,yFAAyF;AACzF,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG,SAAS,CAAC;AAE1D,KAAK,sBAAsB,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,UAAU,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC,GAAG;IACjG,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,IAAI,CAAC,EAAE,qBAAqB,CAAC;CAC9B,CAAC;AAKF,eAAO,MAAM,iBAAiB,GAAI,kFAW/B,sBAAsB,gCA0ZxB,CAAC"}
package/index.mjs CHANGED
@@ -52621,110 +52621,122 @@ var n9 = {
52621
52621
  }, e))
52622
52622
  });
52623
52623
  }, h_e = 120, g_e = 200, __e = ({ value: e, onChange: r, min: a = -Infinity, max: o = Infinity, step: s = 1, disabled: c, options: l, className: u, size: d = "default", ...f }) => {
52624
- let p = d === "compact", m = V(!1), h = V(null), g = V(null), [_, v] = Me(e.toString()), y = V(_), [b, x] = Me(null), S = V(null), C = B((e) => {
52624
+ let p = d === "compact", m = V(!1), h = V(null), g = V(null), [_, v] = Me(e.toString()), y = V(_), b = V(!1), x = V(null), [S, C] = Me(null), w = V(null), T = B((e) => {
52625
52625
  if (e === "") return !1;
52626
52626
  let t = Number(e);
52627
52627
  return !isNaN(t) && (a === void 0 || t >= a) && (o === void 0 || t <= o);
52628
- }, [a, o]), w = B(() => {
52629
- S.current &&= (clearInterval(S.current), null);
52630
- }, []), T = B((e) => {
52628
+ }, [a, o]), E = B(() => {
52629
+ w.current &&= (clearInterval(w.current), null);
52630
+ }, []), D = B((e) => {
52631
52631
  v((t) => {
52632
52632
  let n = (() => {
52633
52633
  let n = (e > 0 ? Math.floor : Math.ceil)(Number(t) + e);
52634
- return C(n) ? n.toString() : (w(), t);
52634
+ return T(n) ? n.toString() : (E(), t);
52635
52635
  })();
52636
- return C(n) && r(Number(n)), n;
52636
+ return T(n) && r(Number(n)), n;
52637
52637
  });
52638
52638
  }, [
52639
- w,
52640
- C,
52639
+ E,
52640
+ T,
52641
52641
  r
52642
- ]), E = B((e) => {
52643
- m.current || (m.current = !0, T(e), w(), S.current = window.setInterval(() => {
52644
- T(e);
52642
+ ]), O = B((e) => {
52643
+ m.current || (m.current = !0, D(e), E(), w.current = window.setInterval(() => {
52644
+ D(e);
52645
52645
  }, h_e));
52646
- }, [w, T]), D = B((e) => {
52647
- w(), S.current = window.setTimeout(() => {
52648
- E(e);
52646
+ }, [E, D]), k = B((e) => {
52647
+ E(), w.current = window.setTimeout(() => {
52648
+ O(e);
52649
52649
  }, g_e);
52650
- }, [w, E]), O = B((e) => {
52651
- r(e), v(e.toString());
52652
- }, [r]), k = B((e) => {
52650
+ }, [E, O]), A = B((e) => {
52651
+ b.current = !1, r(e), v(e.toString());
52652
+ }, [r]), j = B(() => {
52653
+ let t = b.current;
52654
+ if (b.current = !1, t && T(_)) {
52655
+ x.current = Number(_), r(x.current);
52656
+ return;
52657
+ }
52658
+ T(_) && x.current === Number(_) || v(e.toString());
52659
+ }, [
52660
+ T,
52661
+ _,
52662
+ r,
52663
+ e
52664
+ ]), M = B((e) => {
52653
52665
  let t = e.shiftKey && s === 1 ? 10 : s;
52654
52666
  switch (e.key) {
52655
52667
  case "ArrowUp":
52656
52668
  if (e.preventDefault(), l) {
52657
- x((e) => e === null || e - 1 < 0 ? l.length - 1 : e - 1);
52669
+ C((e) => e === null || e - 1 < 0 ? l.length - 1 : e - 1);
52658
52670
  return;
52659
52671
  }
52660
- E(t);
52672
+ O(t);
52661
52673
  break;
52662
52674
  case "ArrowDown":
52663
52675
  if (e.preventDefault(), l) {
52664
- x((e) => e === null || e + 1 >= l.length ? 0 : e + 1);
52676
+ C((e) => e === null || e + 1 >= l.length ? 0 : e + 1);
52665
52677
  return;
52666
52678
  }
52667
- E(-t);
52679
+ O(-t);
52668
52680
  break;
52669
- case "Enter":
52670
- if (e.preventDefault(), b === null) return;
52671
- O(l[b]), x(null);
52681
+ case "Enter": {
52682
+ e.preventDefault();
52683
+ let t = S === null ? void 0 : l[S];
52684
+ if (t === void 0) {
52685
+ j();
52686
+ return;
52687
+ }
52688
+ A(t), C(null);
52672
52689
  break;
52690
+ }
52673
52691
  case "Escape":
52674
- e.preventDefault(), x(null), w();
52692
+ e.preventDefault(), C(null), E();
52675
52693
  break;
52676
52694
  default:
52677
- x(null);
52695
+ C(null);
52678
52696
  break;
52679
52697
  }
52680
52698
  }, [
52681
- w,
52699
+ E,
52700
+ j,
52682
52701
  l,
52702
+ A,
52703
+ S,
52683
52704
  O,
52684
- b,
52685
- E,
52686
52705
  s
52687
- ]), A = B((e) => {
52706
+ ]), N = B((e) => {
52688
52707
  switch (e.key) {
52689
52708
  case "ArrowUp":
52690
52709
  case "ArrowDown":
52691
- e.preventDefault(), m.current = !1, w();
52710
+ e.preventDefault(), m.current = !1, E();
52692
52711
  break;
52693
52712
  }
52694
- }, [w]), j = B((e) => {
52695
- let t = e.target.value;
52696
- v(t), C(t) && r(Number(t));
52697
- }, [C, r]), M = B(() => {
52698
- l && x(l.indexOf(e) ?? 0), h.current?.select();
52699
- }, [l, e]), N = B(() => {
52700
- l && x(null);
52701
- let t = e.toString();
52702
- _ !== t && v(t);
52703
- }, [
52704
- _,
52705
- l,
52706
- e
52707
- ]), ee = Ae(() => C(Number(_) + s), [
52708
- C,
52713
+ }, [E]), ee = B((e) => {
52714
+ b.current = !0, v(e.target.value);
52715
+ }, []), P = B(() => {
52716
+ b.current = !1, x.current = null, l && C(l.indexOf(e) ?? 0), h.current?.select();
52717
+ }, [l, e]), F = B(() => {
52718
+ l && C(null), j();
52719
+ }, [j, l]), te = Ae(() => T(Number(_) + s), [
52720
+ T,
52709
52721
  _,
52710
52722
  s
52711
- ]), P = Ae(() => C(Number(_) - s), [
52712
- C,
52723
+ ]), I = Ae(() => T(Number(_) - s), [
52724
+ T,
52713
52725
  _,
52714
52726
  s
52715
52727
  ]);
52716
52728
  return we(() => () => {
52717
- w();
52718
- }, [w]), we(() => {
52719
- if (b === null) {
52729
+ E();
52730
+ }, [E]), we(() => {
52731
+ if (S === null) {
52720
52732
  g.current?.close();
52721
52733
  return;
52722
52734
  }
52723
52735
  g.current?.open();
52724
- }, [b]), we(() => {
52736
+ }, [S]), we(() => {
52725
52737
  y.current = _;
52726
52738
  }, [_]), we(() => {
52727
- e !== Number(y.current) && v(e.toString());
52739
+ x.current = null, document.activeElement !== h.current && e !== Number(y.current) && v(e.toString());
52728
52740
  }, [e]), /* @__PURE__ */ n("div", {
52729
52741
  className: U("relative inline-block", u),
52730
52742
  children: [/* @__PURE__ */ n("span", {
@@ -52732,25 +52744,25 @@ var n9 = {
52732
52744
  children: [
52733
52745
  /* @__PURE__ */ t(r9, {
52734
52746
  size: d,
52735
- disabled: !P,
52747
+ disabled: !I,
52736
52748
  "aria-label": "-",
52737
52749
  onClick: () => {
52738
- T(-s);
52750
+ D(-s);
52739
52751
  },
52740
52752
  onMouseDown: () => {
52741
- D(-s);
52753
+ k(-s);
52742
52754
  },
52743
52755
  onTouchStart: () => {
52744
- D(-s);
52756
+ k(-s);
52745
52757
  },
52746
52758
  onMouseUp: () => {
52747
- m.current = !1, w();
52759
+ m.current = !1, E();
52748
52760
  },
52749
52761
  onTouchEnd: () => {
52750
- m.current = !1, w();
52762
+ m.current = !1, E();
52751
52763
  },
52752
52764
  onMouseLeave: () => {
52753
- il.isMobile || (m.current = !1, w());
52765
+ il.isMobile || (m.current = !1, E());
52754
52766
  },
52755
52767
  onContextMenu: (e) => e.preventDefault(),
52756
52768
  children: /* @__PURE__ */ t(ie, { className: "text-content-primary h-4 w-4" })
@@ -52762,33 +52774,33 @@ var n9 = {
52762
52774
  type: "number",
52763
52775
  className: H(p ? "size-h-400" : "size-h-500", "component-500 border-misc-border bg-surface-high text-content-primary w-10 border-0 border-y p-0 text-center focus:ring-0", "focus-visible:border-content-accent focus-visible:border focus-visible:outline-hidden", "focus-visible:ring-misc-focus-indicator focus-visible:misc-border-size-focus-ring focus-visible:rounded-150", "focus-visible:relative focus-visible:z-10", "group-hover:not-focus-visible:border-misc-border-hover", "group-focus-visible:not-focus-visible:border-misc-border-hover", "group-disabled:opacity-30"),
52764
52776
  value: _,
52765
- onFocus: M,
52766
- onChange: j,
52767
- onBlur: N,
52768
- onKeyDown: k,
52769
- onKeyUp: A
52777
+ onFocus: P,
52778
+ onChange: ee,
52779
+ onBlur: F,
52780
+ onKeyDown: M,
52781
+ onKeyUp: N
52770
52782
  }),
52771
52783
  /* @__PURE__ */ t(r9, {
52772
52784
  size: d,
52773
- disabled: !ee,
52785
+ disabled: !te,
52774
52786
  "aria-label": "+",
52775
52787
  onClick: () => {
52776
- T(s);
52788
+ D(s);
52777
52789
  },
52778
52790
  onMouseDown: () => {
52779
- D(s);
52791
+ k(s);
52780
52792
  },
52781
52793
  onTouchStart: () => {
52782
- D(s);
52794
+ k(s);
52783
52795
  },
52784
52796
  onMouseUp: () => {
52785
- m.current = !1, w();
52797
+ m.current = !1, E();
52786
52798
  },
52787
52799
  onTouchEnd: () => {
52788
- m.current = !1, w();
52800
+ m.current = !1, E();
52789
52801
  },
52790
52802
  onMouseLeave: () => {
52791
- il.isMobile || (m.current = !1, w());
52803
+ il.isMobile || (m.current = !1, E());
52792
52804
  },
52793
52805
  onContextMenu: (e) => e.preventDefault(),
52794
52806
  children: /* @__PURE__ */ t(i, { className: "text-content-primary h-4 w-4" })
@@ -52800,9 +52812,9 @@ var n9 = {
52800
52812
  preventAutoFocus: !0,
52801
52813
  children: /* @__PURE__ */ t(m_e, {
52802
52814
  values: l,
52803
- selectedIndex: b,
52815
+ selectedIndex: S,
52804
52816
  onSelect: (e) => {
52805
- O(e), x(null);
52817
+ A(e), C(null);
52806
52818
  }
52807
52819
  })
52808
52820
  })]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@photoroom/ui",
3
- "version": "0.1.524",
3
+ "version": "0.1.525",
4
4
  "private": false,
5
5
  "description": "Photoroom design system components",
6
6
  "sideEffects": [