@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 +65 -10
- package/index.d.ts +65 -10
- package/index.js +60 -8
- package/index.js.map +1 -1
- package/index.mjs +60 -8
- package/index.mjs.map +1 -1
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -3602,6 +3602,7 @@ var themeConfig = (mode = "dark", productContext = defaultProductContext) => {
|
|
|
3602
3602
|
);
|
|
3603
3603
|
}
|
|
3604
3604
|
const contextFonts = getFonts(productContext);
|
|
3605
|
+
const contextTypography = getTypographyTokens(productContext);
|
|
3605
3606
|
return {
|
|
3606
3607
|
colors: colors[mode],
|
|
3607
3608
|
spacing,
|
|
@@ -3613,7 +3614,7 @@ var themeConfig = (mode = "dark", productContext = defaultProductContext) => {
|
|
|
3613
3614
|
heading: contextFonts.heading,
|
|
3614
3615
|
body: contextFonts.body
|
|
3615
3616
|
},
|
|
3616
|
-
typographyTokens:
|
|
3617
|
+
typographyTokens: contextTypography,
|
|
3617
3618
|
productContext,
|
|
3618
3619
|
sizing: {
|
|
3619
3620
|
button: (size) => {
|
|
@@ -4622,15 +4623,66 @@ var themeConfig = (mode = "dark", productContext = defaultProductContext) => {
|
|
|
4622
4623
|
};
|
|
4623
4624
|
return configs[size];
|
|
4624
4625
|
},
|
|
4626
|
+
/**
|
|
4627
|
+
* SupportingText sizing.
|
|
4628
|
+
*
|
|
4629
|
+
* Typography is bound to the `Theme / Typography` body tokens rather than
|
|
4630
|
+
* hardcoded px values, so a change to the Figma-synced scale propagates
|
|
4631
|
+
* automatically. Each size maps to the body token whose font-size and
|
|
4632
|
+
* compact line-height match the corresponding Figma size variant:
|
|
4633
|
+
*
|
|
4634
|
+
* | size | typography token | font-size / line-height | icon | gap |
|
|
4635
|
+
* | ---- | ---------------- | ----------------------- | ---- | --- |
|
|
4636
|
+
* | xl | `body-lg` | 18 / 24 | 18 | 6 |
|
|
4637
|
+
* | lg | `body-md` | 16 / 20 | 18 | 6 |
|
|
4638
|
+
* | md | `body-sm` | 14 / 18 | 18 | 6 |
|
|
4639
|
+
* | sm | `body-xs` | 12 / 16 | 14 | 4 |
|
|
4640
|
+
* | xs | `body-xxs` | 10 / 14 | 14 | 4 |
|
|
4641
|
+
*
|
|
4642
|
+
* `requiredIndicator` is the required-field asterisk that sits beside a
|
|
4643
|
+
* label. Figma renders it one step down the same scale, so it aliases the
|
|
4644
|
+
* next-smaller size's token instead of carrying its own table.
|
|
4645
|
+
*
|
|
4646
|
+
* `gap` is the spacing between the text and its trailing icon (Figma
|
|
4647
|
+
* `Label & icon` frame item-spacing).
|
|
4648
|
+
*
|
|
4649
|
+
* @see https://www.figma.com/design/m0qqLlCvR29fvqj0EzlLAU/Xsolla-UI-Toolkit?node-id=5680-33147
|
|
4650
|
+
*/
|
|
4625
4651
|
supportingText: (size) => {
|
|
4626
|
-
const
|
|
4627
|
-
xl:
|
|
4628
|
-
lg:
|
|
4629
|
-
md:
|
|
4630
|
-
sm:
|
|
4631
|
-
xs:
|
|
4652
|
+
const typographyBySize = {
|
|
4653
|
+
xl: contextTypography.basic["body-lg"],
|
|
4654
|
+
lg: contextTypography.basic["body-md"],
|
|
4655
|
+
md: contextTypography.basic["body-sm"],
|
|
4656
|
+
sm: contextTypography.basic["body-xs"],
|
|
4657
|
+
xs: contextTypography.basic["body-xxs"]
|
|
4658
|
+
};
|
|
4659
|
+
const dimensions = {
|
|
4660
|
+
xl: { gap: 6, iconSize: 18 },
|
|
4661
|
+
lg: { gap: 6, iconSize: 18 },
|
|
4662
|
+
md: { gap: 6, iconSize: 18 },
|
|
4663
|
+
sm: { gap: 4, iconSize: 14 },
|
|
4664
|
+
xs: { gap: 4, iconSize: 14 }
|
|
4665
|
+
};
|
|
4666
|
+
const requiredIndicatorSizeMap = {
|
|
4667
|
+
xl: "lg",
|
|
4668
|
+
lg: "md",
|
|
4669
|
+
md: "sm",
|
|
4670
|
+
sm: "xs",
|
|
4671
|
+
xs: "xs"
|
|
4672
|
+
};
|
|
4673
|
+
const typography2 = typographyBySize[size];
|
|
4674
|
+
const requiredTypography = typographyBySize[requiredIndicatorSizeMap[size]];
|
|
4675
|
+
return {
|
|
4676
|
+
fontSize: typography2.fontSize,
|
|
4677
|
+
lineHeight: typography2.lineHeight,
|
|
4678
|
+
fontWeight: typography2.fontWeight,
|
|
4679
|
+
fontFamily: contextFonts.body,
|
|
4680
|
+
requiredIndicator: {
|
|
4681
|
+
fontSize: requiredTypography.fontSize,
|
|
4682
|
+
lineHeight: requiredTypography.lineHeight
|
|
4683
|
+
},
|
|
4684
|
+
...dimensions[size]
|
|
4632
4685
|
};
|
|
4633
|
-
return configs[size];
|
|
4634
4686
|
},
|
|
4635
4687
|
iconWrapper: (size) => {
|
|
4636
4688
|
const configs = {
|