@tonconnect/ui 2.0.6 → 2.0.7-beta.0

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/lib/index.mjs CHANGED
@@ -2881,7 +2881,7 @@ const ButtonStyled$1 = styled.button`
2881
2881
  cursor: ${(props) => props.disabled ? "not-allowed" : "pointer"};
2882
2882
 
2883
2883
  font-size: 14px;
2884
- font-weight: 590;
2884
+ font-weight: 510;
2885
2885
  line-height: 18px;
2886
2886
 
2887
2887
  transition: transform 0.125s ease-in-out;
@@ -3297,7 +3297,7 @@ const ROUTE_STATE_KEY = "androidBackHandler";
3297
3297
  const ROUTE_STATE = {
3298
3298
  [ROUTE_STATE_KEY]: true
3299
3299
  };
3300
- const _tmpl$$v = /* @__PURE__ */ template$1(`<svg><path fill-rule="evenodd" clip-rule="evenodd" d="M10.2122 14.3407C10.5384 14.0854 10.5959 13.614 10.3406 13.2878L6.20237 8.00003L10.3406 2.71227C10.5959 2.38607 10.5384 1.91469 10.2122 1.6594C9.88604 1.40412 9.41465 1.46161 9.15937 1.7878L4.65937 7.5378C4.44688 7.80932 4.44688 8.19074 4.65937 8.46226L9.15937 14.2123C9.41465 14.5385 9.88604 14.5959 10.2122 14.3407Z"></path></svg>`, 4, true);
3300
+ const _tmpl$$w = /* @__PURE__ */ template$1(`<svg><path fill-rule="evenodd" clip-rule="evenodd" d="M10.2122 14.3407C10.5384 14.0854 10.5959 13.614 10.3406 13.2878L6.20237 8.00003L10.3406 2.71227C10.5959 2.38607 10.5384 1.91469 10.2122 1.6594C9.88604 1.40412 9.41465 1.46161 9.15937 1.7878L4.65937 7.5378C4.44688 7.80932 4.44688 8.19074 4.65937 8.46226L9.15937 14.2123C9.41465 14.5385 9.88604 14.5959 10.2122 14.3407Z"></path></svg>`, 4, true);
3301
3301
  const rotationDegrees = {
3302
3302
  left: 0,
3303
3303
  top: 90,
@@ -3322,18 +3322,18 @@ const ArrowIcon = (props) => {
3322
3322
  return direction();
3323
3323
  },
3324
3324
  get children() {
3325
- const _el$ = _tmpl$$v.cloneNode(true);
3325
+ const _el$ = _tmpl$$w.cloneNode(true);
3326
3326
  createRenderEffect(() => setAttribute(_el$, "fill", fill()));
3327
3327
  return _el$;
3328
3328
  }
3329
3329
  });
3330
3330
  };
3331
- const _tmpl$$u = /* @__PURE__ */ template$1(`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none"><path fill-rule="evenodd" clip-rule="evenodd" d="M2.71966 2.71968C3.01255 2.42678 3.48743 2.42677 3.78032 2.71966L8.00002 6.93925L12.2197 2.71967C12.5126 2.42677 12.9874 2.42678 13.2803 2.71967C13.5732 3.01257 13.5732 3.48744 13.2803 3.78033L9.06068 7.99991L13.2803 12.2197C13.5732 12.5126 13.5732 12.9874 13.2803 13.2803C12.9874 13.5732 12.5126 13.5732 12.2197 13.2803L8.00002 9.06057L3.78033 13.2803C3.48744 13.5732 3.01257 13.5732 2.71967 13.2803C2.42678 12.9874 2.42677 12.5126 2.71967 12.2197L6.93936 7.99991L2.71968 3.78034C2.42678 3.48745 2.42677 3.01257 2.71966 2.71968Z"></path></svg>`);
3331
+ const _tmpl$$v = /* @__PURE__ */ template$1(`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none"><path fill-rule="evenodd" clip-rule="evenodd" d="M2.71966 2.71968C3.01255 2.42678 3.48743 2.42677 3.78032 2.71966L8.00002 6.93925L12.2197 2.71967C12.5126 2.42677 12.9874 2.42678 13.2803 2.71967C13.5732 3.01257 13.5732 3.48744 13.2803 3.78033L9.06068 7.99991L13.2803 12.2197C13.5732 12.5126 13.5732 12.9874 13.2803 13.2803C12.9874 13.5732 12.5126 13.5732 12.2197 13.2803L8.00002 9.06057L3.78033 13.2803C3.48744 13.5732 3.01257 13.5732 2.71967 13.2803C2.42678 12.9874 2.42677 12.5126 2.71967 12.2197L6.93936 7.99991L2.71968 3.78034C2.42678 3.48745 2.42677 3.01257 2.71966 2.71968Z"></path></svg>`);
3332
3332
  const CloseIcon = (props) => {
3333
3333
  const theme = useTheme();
3334
3334
  const fill = () => props.fill || theme.colors.icon.secondary;
3335
3335
  return (() => {
3336
- const _el$ = _tmpl$$u.cloneNode(true), _el$2 = _el$.firstChild;
3336
+ const _el$ = _tmpl$$v.cloneNode(true), _el$2 = _el$.firstChild;
3337
3337
  createRenderEffect(() => setAttribute(_el$2, "fill", fill()));
3338
3338
  return _el$;
3339
3339
  })();
@@ -3567,7 +3567,7 @@ function animate(element, keyframes, options) {
3567
3567
  }
3568
3568
  return AnimationNoop.create();
3569
3569
  }
3570
- const _tmpl$$t = /* @__PURE__ */ template$1(`<div></div>`);
3570
+ const _tmpl$$u = /* @__PURE__ */ template$1(`<div></div>`);
3571
3571
  const clickOutside = clickOutside$1;
3572
3572
  const keyPressed = escPressed;
3573
3573
  const androidBackHandler = androidBackHandler$1;
@@ -3633,7 +3633,7 @@ const Modal = (props) => {
3633
3633
  "data-tc-modal": "true"
3634
3634
  }, dataAttrs, {
3635
3635
  get children() {
3636
- const _el$ = _tmpl$$t.cloneNode(true);
3636
+ const _el$ = _tmpl$$u.cloneNode(true);
3637
3637
  use(androidBackHandler, _el$, () => ({
3638
3638
  isEnabled: props.enableAndroidBackHandler,
3639
3639
  onClose: () => props.onClose()
@@ -5580,7 +5580,7 @@ function fallbackCopyTextToClipboard(text) {
5580
5580
  document.body.removeChild(textArea);
5581
5581
  }
5582
5582
  }
5583
- const _tmpl$$s = /* @__PURE__ */ template$1(`<div></div>`);
5583
+ const _tmpl$$t = /* @__PURE__ */ template$1(`<div></div>`);
5584
5584
  const QRCode = (props) => {
5585
5585
  let qrCodeCanvasRef;
5586
5586
  let qrCodeWrapperRef;
@@ -5629,7 +5629,7 @@ const QRCode = (props) => {
5629
5629
  },
5630
5630
  get children() {
5631
5631
  return [(() => {
5632
- const _el$ = _tmpl$$s.cloneNode(true);
5632
+ const _el$ = _tmpl$$t.cloneNode(true);
5633
5633
  const _ref$2 = qrCodeCanvasRef;
5634
5634
  typeof _ref$2 === "function" ? use(_ref$2, _el$) : qrCodeCanvasRef = _el$;
5635
5635
  return _el$;
@@ -5899,7 +5899,7 @@ const BadgeStyled = styled(Image)`
5899
5899
  `;
5900
5900
  const StyledText = styled(Text)`
5901
5901
  max-width: 90px;
5902
- font-weight: 590;
5902
+ font-weight: 510;
5903
5903
  white-space: nowrap;
5904
5904
  text-overflow: ellipsis;
5905
5905
  overflow: hidden;
@@ -5909,7 +5909,7 @@ const StyledText = styled(Text)`
5909
5909
  }
5910
5910
  `;
5911
5911
  const StyledSecondLine = styled(Text)`
5912
- font-weight: 510;
5912
+ font-weight: ${(props) => props.colorPrimary ? "510" : "400"};
5913
5913
  max-width: 90px;
5914
5914
  white-space: nowrap;
5915
5915
  text-overflow: ellipsis;
@@ -5920,7 +5920,29 @@ const StyledSecondLine = styled(Text)`
5920
5920
  max-width: 80px;
5921
5921
  }
5922
5922
  `;
5923
+ const _tmpl$$s = /* @__PURE__ */ template$1(`<div></div>`);
5923
5924
  const WalletItem = (props) => {
5925
+ let ctxRef = null;
5926
+ const adjustLetterSpacing = () => {
5927
+ const name = ctxRef == null ? void 0 : ctxRef.querySelector("div");
5928
+ if (name && name.scrollWidth > name.clientWidth) {
5929
+ let spacing = 0;
5930
+ const minSpacing = -0.4;
5931
+ const step = 0.05;
5932
+ while (name.scrollWidth > name.clientWidth && spacing >= minSpacing) {
5933
+ spacing -= step;
5934
+ name.style.letterSpacing = `${spacing}px`;
5935
+ }
5936
+ if (spacing !== 0) {
5937
+ spacing -= step;
5938
+ name.style.letterSpacing = `${spacing}px`;
5939
+ }
5940
+ }
5941
+ };
5942
+ onMount(() => adjustLetterSpacing());
5943
+ createEffect(() => {
5944
+ adjustLetterSpacing();
5945
+ });
5924
5946
  return createComponent(WalletItemStyled, {
5925
5947
  get ["class"]() {
5926
5948
  return props.class;
@@ -5936,11 +5958,16 @@ const WalletItem = (props) => {
5936
5958
  get src() {
5937
5959
  return props.badgeUrl;
5938
5960
  }
5939
- })), createComponent(StyledText, {
5940
- get children() {
5941
- return props.name;
5942
- }
5943
- }), createMemo(() => createMemo(() => !!props.secondLine)() && createComponent(StyledSecondLine, {
5961
+ })), (() => {
5962
+ const _el$ = _tmpl$$s.cloneNode(true);
5963
+ use((el) => ctxRef = el, _el$);
5964
+ insert(_el$, createComponent(StyledText, {
5965
+ get children() {
5966
+ return props.name;
5967
+ }
5968
+ }));
5969
+ return _el$;
5970
+ })(), createMemo(() => createMemo(() => !!props.secondLine)() && createComponent(StyledSecondLine, {
5944
5971
  get colorPrimary() {
5945
5972
  var _a2;
5946
5973
  return (_a2 = props.secondLineColorPrimary) != null ? _a2 : true;
@@ -5954,7 +5981,7 @@ const WalletItem = (props) => {
5954
5981
  };
5955
5982
  const H1Styled$9 = styled.h1`
5956
5983
  font-style: normal;
5957
- font-weight: 700;
5984
+ font-weight: 590;
5958
5985
  font-size: 20px;
5959
5986
  line-height: 28px;
5960
5987
 
@@ -5982,7 +6009,7 @@ const H1 = (props) => {
5982
6009
  };
5983
6010
  const H2Styled$5 = styled.h2`
5984
6011
  font-style: normal;
5985
- font-weight: 510;
6012
+ font-weight: 400;
5986
6013
  font-size: 16px;
5987
6014
  line-height: 22px;
5988
6015
 
@@ -6010,7 +6037,7 @@ const H2 = (props) => {
6010
6037
  };
6011
6038
  const H3Styled$1 = styled.h3`
6012
6039
  font-style: normal;
6013
- font-weight: 590;
6040
+ font-weight: 510;
6014
6041
  font-size: 16px;
6015
6042
  line-height: 20px;
6016
6043
 
@@ -9577,6 +9604,9 @@ const H2Styled$2 = styled(H2)`
9577
9604
  margin-bottom: 24px;
9578
9605
  padding: 0 24px;
9579
9606
  min-height: 44px;
9607
+ max-width: ${(props) => props.maxWidth}px;
9608
+ margin-left: ${(props) => props.maxWidth ? "auto" : "0px"};
9609
+ margin-right: ${(props) => props.maxWidth ? "auto" : "0px"};
9580
9610
  `;
9581
9611
  styled(Button)`
9582
9612
  display: block;
@@ -9590,11 +9620,12 @@ const TelegramButtonStyled = styled(Button)`
9590
9620
  background-color: ${(props) => props.theme.colors.telegramButton};
9591
9621
 
9592
9622
  color: ${(props) => props.theme.colors.constant.white};
9593
- font-weight: 590;
9623
+ font-weight: 510;
9594
9624
  font-size: 16px;
9595
9625
  line-height: 20px;
9596
9626
  `;
9597
9627
  const TGImageStyled = styled(Image)`
9628
+ background-color: transparent;
9598
9629
  border-radius: ${(props) => tgBorders[props.theme.borderRadius]};
9599
9630
  width: 24px;
9600
9631
  height: 24px;
@@ -9750,6 +9781,7 @@ const MobileUniversalModal = (props) => {
9750
9781
  children: "Connect your wallet"
9751
9782
  }), createComponent(H2Styled$2, {
9752
9783
  translationKey: "walletModal.mobileUniversalModal.openWalletOnTelegramOrSelect",
9784
+ maxWidth: 342,
9753
9785
  children: "Open Wallet in Telegram or select your wallet to connect"
9754
9786
  }), createComponent(TelegramButtonStyled, {
9755
9787
  get leftIcon() {
@@ -10906,7 +10938,7 @@ class TonConnectUITracker {
10906
10938
  }
10907
10939
  }
10908
10940
  }
10909
- const tonConnectUiVersion = "2.0.5";
10941
+ const tonConnectUiVersion = "2.0.7-beta.0";
10910
10942
  class TonConnectUI {
10911
10943
  constructor(options) {
10912
10944
  __publicField(this, "walletInfoStorage", new WalletInfoStorage());