@xsolla/xui-core 0.214.1 → 0.215.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/index.d.mts CHANGED
@@ -8434,31 +8434,86 @@ declare const themeConfig: (mode?: ThemeMode, productContext?: ProductContext) =
8434
8434
  helperSize: number;
8435
8435
  gap: number;
8436
8436
  };
8437
+ /**
8438
+ * SupportingText sizing.
8439
+ *
8440
+ * Typography is bound to the `Theme / Typography` body tokens rather than
8441
+ * hardcoded px values, so a change to the Figma-synced scale propagates
8442
+ * automatically. Each size maps to the body token whose font-size and
8443
+ * compact line-height match the corresponding Figma size variant:
8444
+ *
8445
+ * | size | typography token | font-size / line-height | icon | gap |
8446
+ * | ---- | ---------------- | ----------------------- | ---- | --- |
8447
+ * | xl | `body-lg` | 18 / 24 | 18 | 6 |
8448
+ * | lg | `body-md` | 16 / 20 | 18 | 6 |
8449
+ * | md | `body-sm` | 14 / 18 | 18 | 6 |
8450
+ * | sm | `body-xs` | 12 / 16 | 14 | 4 |
8451
+ * | xs | `body-xxs` | 10 / 14 | 14 | 4 |
8452
+ *
8453
+ * `requiredIndicator` is the required-field asterisk that sits beside a
8454
+ * label. Figma renders it one step down the same scale, so it aliases the
8455
+ * next-smaller size's token instead of carrying its own table.
8456
+ *
8457
+ * `gap` is the spacing between the text and its trailing icon (Figma
8458
+ * `Label & icon` frame item-spacing).
8459
+ *
8460
+ * @see https://www.figma.com/design/m0qqLlCvR29fvqj0EzlLAU/Xsolla-UI-Toolkit?node-id=5680-33147
8461
+ */
8437
8462
  supportingText: (size: "xl" | "lg" | "md" | "sm" | "xs") => {
8463
+ gap: 6;
8464
+ iconSize: 18;
8438
8465
  fontSize: number;
8439
8466
  lineHeight: string;
8440
- gap: number;
8441
- iconSize: number;
8467
+ fontWeight: number;
8468
+ fontFamily: string;
8469
+ requiredIndicator: {
8470
+ fontSize: number;
8471
+ lineHeight: string;
8472
+ };
8442
8473
  } | {
8474
+ gap: 6;
8475
+ iconSize: 18;
8443
8476
  fontSize: number;
8444
8477
  lineHeight: string;
8445
- gap: number;
8446
- iconSize: number;
8478
+ fontWeight: number;
8479
+ fontFamily: string;
8480
+ requiredIndicator: {
8481
+ fontSize: number;
8482
+ lineHeight: string;
8483
+ };
8447
8484
  } | {
8485
+ gap: 6;
8486
+ iconSize: 18;
8448
8487
  fontSize: number;
8449
8488
  lineHeight: string;
8450
- gap: number;
8451
- iconSize: number;
8489
+ fontWeight: number;
8490
+ fontFamily: string;
8491
+ requiredIndicator: {
8492
+ fontSize: number;
8493
+ lineHeight: string;
8494
+ };
8452
8495
  } | {
8496
+ gap: 4;
8497
+ iconSize: 14;
8453
8498
  fontSize: number;
8454
8499
  lineHeight: string;
8455
- gap: number;
8456
- iconSize: number;
8500
+ fontWeight: number;
8501
+ fontFamily: string;
8502
+ requiredIndicator: {
8503
+ fontSize: number;
8504
+ lineHeight: string;
8505
+ };
8457
8506
  } | {
8507
+ gap: 4;
8508
+ iconSize: 14;
8458
8509
  fontSize: number;
8459
8510
  lineHeight: string;
8460
- gap: number;
8461
- iconSize: number;
8511
+ fontWeight: number;
8512
+ fontFamily: string;
8513
+ requiredIndicator: {
8514
+ fontSize: number;
8515
+ lineHeight: string;
8516
+ };
8462
8517
  };
8463
8518
  iconWrapper: (size: "xl" | "lg" | "md" | "sm" | "xs" | "xxs") => {
8464
8519
  size: number;
package/index.d.ts CHANGED
@@ -8434,31 +8434,86 @@ declare const themeConfig: (mode?: ThemeMode, productContext?: ProductContext) =
8434
8434
  helperSize: number;
8435
8435
  gap: number;
8436
8436
  };
8437
+ /**
8438
+ * SupportingText sizing.
8439
+ *
8440
+ * Typography is bound to the `Theme / Typography` body tokens rather than
8441
+ * hardcoded px values, so a change to the Figma-synced scale propagates
8442
+ * automatically. Each size maps to the body token whose font-size and
8443
+ * compact line-height match the corresponding Figma size variant:
8444
+ *
8445
+ * | size | typography token | font-size / line-height | icon | gap |
8446
+ * | ---- | ---------------- | ----------------------- | ---- | --- |
8447
+ * | xl | `body-lg` | 18 / 24 | 18 | 6 |
8448
+ * | lg | `body-md` | 16 / 20 | 18 | 6 |
8449
+ * | md | `body-sm` | 14 / 18 | 18 | 6 |
8450
+ * | sm | `body-xs` | 12 / 16 | 14 | 4 |
8451
+ * | xs | `body-xxs` | 10 / 14 | 14 | 4 |
8452
+ *
8453
+ * `requiredIndicator` is the required-field asterisk that sits beside a
8454
+ * label. Figma renders it one step down the same scale, so it aliases the
8455
+ * next-smaller size's token instead of carrying its own table.
8456
+ *
8457
+ * `gap` is the spacing between the text and its trailing icon (Figma
8458
+ * `Label & icon` frame item-spacing).
8459
+ *
8460
+ * @see https://www.figma.com/design/m0qqLlCvR29fvqj0EzlLAU/Xsolla-UI-Toolkit?node-id=5680-33147
8461
+ */
8437
8462
  supportingText: (size: "xl" | "lg" | "md" | "sm" | "xs") => {
8463
+ gap: 6;
8464
+ iconSize: 18;
8438
8465
  fontSize: number;
8439
8466
  lineHeight: string;
8440
- gap: number;
8441
- iconSize: number;
8467
+ fontWeight: number;
8468
+ fontFamily: string;
8469
+ requiredIndicator: {
8470
+ fontSize: number;
8471
+ lineHeight: string;
8472
+ };
8442
8473
  } | {
8474
+ gap: 6;
8475
+ iconSize: 18;
8443
8476
  fontSize: number;
8444
8477
  lineHeight: string;
8445
- gap: number;
8446
- iconSize: number;
8478
+ fontWeight: number;
8479
+ fontFamily: string;
8480
+ requiredIndicator: {
8481
+ fontSize: number;
8482
+ lineHeight: string;
8483
+ };
8447
8484
  } | {
8485
+ gap: 6;
8486
+ iconSize: 18;
8448
8487
  fontSize: number;
8449
8488
  lineHeight: string;
8450
- gap: number;
8451
- iconSize: number;
8489
+ fontWeight: number;
8490
+ fontFamily: string;
8491
+ requiredIndicator: {
8492
+ fontSize: number;
8493
+ lineHeight: string;
8494
+ };
8452
8495
  } | {
8496
+ gap: 4;
8497
+ iconSize: 14;
8453
8498
  fontSize: number;
8454
8499
  lineHeight: string;
8455
- gap: number;
8456
- iconSize: number;
8500
+ fontWeight: number;
8501
+ fontFamily: string;
8502
+ requiredIndicator: {
8503
+ fontSize: number;
8504
+ lineHeight: string;
8505
+ };
8457
8506
  } | {
8507
+ gap: 4;
8508
+ iconSize: 14;
8458
8509
  fontSize: number;
8459
8510
  lineHeight: string;
8460
- gap: number;
8461
- iconSize: number;
8511
+ fontWeight: number;
8512
+ fontFamily: string;
8513
+ requiredIndicator: {
8514
+ fontSize: number;
8515
+ lineHeight: string;
8516
+ };
8462
8517
  };
8463
8518
  iconWrapper: (size: "xl" | "lg" | "md" | "sm" | "xs" | "xxs") => {
8464
8519
  size: number;
package/index.js CHANGED
@@ -3682,6 +3682,7 @@ var themeConfig = (mode = "dark", productContext = defaultProductContext) => {
3682
3682
  );
3683
3683
  }
3684
3684
  const contextFonts = getFonts(productContext);
3685
+ const contextTypography = getTypographyTokens(productContext);
3685
3686
  return {
3686
3687
  colors: colors[mode],
3687
3688
  spacing,
@@ -3693,7 +3694,7 @@ var themeConfig = (mode = "dark", productContext = defaultProductContext) => {
3693
3694
  heading: contextFonts.heading,
3694
3695
  body: contextFonts.body
3695
3696
  },
3696
- typographyTokens: getTypographyTokens(productContext),
3697
+ typographyTokens: contextTypography,
3697
3698
  productContext,
3698
3699
  sizing: {
3699
3700
  button: (size) => {
@@ -4702,15 +4703,66 @@ var themeConfig = (mode = "dark", productContext = defaultProductContext) => {
4702
4703
  };
4703
4704
  return configs[size];
4704
4705
  },
4706
+ /**
4707
+ * SupportingText sizing.
4708
+ *
4709
+ * Typography is bound to the `Theme / Typography` body tokens rather than
4710
+ * hardcoded px values, so a change to the Figma-synced scale propagates
4711
+ * automatically. Each size maps to the body token whose font-size and
4712
+ * compact line-height match the corresponding Figma size variant:
4713
+ *
4714
+ * | size | typography token | font-size / line-height | icon | gap |
4715
+ * | ---- | ---------------- | ----------------------- | ---- | --- |
4716
+ * | xl | `body-lg` | 18 / 24 | 18 | 6 |
4717
+ * | lg | `body-md` | 16 / 20 | 18 | 6 |
4718
+ * | md | `body-sm` | 14 / 18 | 18 | 6 |
4719
+ * | sm | `body-xs` | 12 / 16 | 14 | 4 |
4720
+ * | xs | `body-xxs` | 10 / 14 | 14 | 4 |
4721
+ *
4722
+ * `requiredIndicator` is the required-field asterisk that sits beside a
4723
+ * label. Figma renders it one step down the same scale, so it aliases the
4724
+ * next-smaller size's token instead of carrying its own table.
4725
+ *
4726
+ * `gap` is the spacing between the text and its trailing icon (Figma
4727
+ * `Label & icon` frame item-spacing).
4728
+ *
4729
+ * @see https://www.figma.com/design/m0qqLlCvR29fvqj0EzlLAU/Xsolla-UI-Toolkit?node-id=5680-33147
4730
+ */
4705
4731
  supportingText: (size) => {
4706
- const configs = {
4707
- xl: { fontSize: 18, lineHeight: "20px", gap: 6, iconSize: 18 },
4708
- lg: { fontSize: 16, lineHeight: "18px", gap: 6, iconSize: 18 },
4709
- md: { fontSize: 14, lineHeight: "16px", gap: 6, iconSize: 18 },
4710
- sm: { fontSize: 12, lineHeight: "14px", gap: 4, iconSize: 16 },
4711
- xs: { fontSize: 10, lineHeight: "10px", gap: 4, iconSize: 16 }
4732
+ const typographyBySize = {
4733
+ xl: contextTypography.basic["body-lg"],
4734
+ lg: contextTypography.basic["body-md"],
4735
+ md: contextTypography.basic["body-sm"],
4736
+ sm: contextTypography.basic["body-xs"],
4737
+ xs: contextTypography.basic["body-xxs"]
4738
+ };
4739
+ const dimensions = {
4740
+ xl: { gap: 6, iconSize: 18 },
4741
+ lg: { gap: 6, iconSize: 18 },
4742
+ md: { gap: 6, iconSize: 18 },
4743
+ sm: { gap: 4, iconSize: 14 },
4744
+ xs: { gap: 4, iconSize: 14 }
4745
+ };
4746
+ const requiredIndicatorSizeMap = {
4747
+ xl: "lg",
4748
+ lg: "md",
4749
+ md: "sm",
4750
+ sm: "xs",
4751
+ xs: "xs"
4752
+ };
4753
+ const typography2 = typographyBySize[size];
4754
+ const requiredTypography = typographyBySize[requiredIndicatorSizeMap[size]];
4755
+ return {
4756
+ fontSize: typography2.fontSize,
4757
+ lineHeight: typography2.lineHeight,
4758
+ fontWeight: typography2.fontWeight,
4759
+ fontFamily: contextFonts.body,
4760
+ requiredIndicator: {
4761
+ fontSize: requiredTypography.fontSize,
4762
+ lineHeight: requiredTypography.lineHeight
4763
+ },
4764
+ ...dimensions[size]
4712
4765
  };
4713
- return configs[size];
4714
4766
  },
4715
4767
  iconWrapper: (size) => {
4716
4768
  const configs = {