@xsolla/xui-core 0.134.0 → 0.136.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/README.md +6 -0
- package/index.d.mts +149 -1
- package/index.d.ts +149 -1
- package/index.js +509 -57
- package/index.js.map +1 -1
- package/index.mjs +489 -48
- package/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -72,6 +72,12 @@ For custom components, use `useResolvedTheme` instead of `useDesignSystem`.
|
|
|
72
72
|
- `useId` — Stable unique ID hook; polyfills `React.useId` for React < 18
|
|
73
73
|
- `ModalIdContext` — Context holding the current modal's ID for portal-based components
|
|
74
74
|
- `useModalId` — Hook returning the current modal ID, or `null` if outside a modal
|
|
75
|
+
- `breakpoints` — Responsive breakpoints: `{ mobile: 0, desktop: 768 }`
|
|
76
|
+
- `responsiveTypographyScale` — Raw responsive font-size and line-height data (13 steps × 3 device modes)
|
|
77
|
+
- `SCALE_STEPS` — Array of all scale step identifiers
|
|
78
|
+
- `generateTypographyCSS` — Returns the full CSS string for responsive typography custom properties
|
|
79
|
+
- `cssVar` — Helper to get CSS variable references: `cssVar.fontSize("350")` → `"var(--xui-font-size-350)"`
|
|
80
|
+
- `TypographyStyleLoader` — Component that injects responsive typography CSS (rendered automatically by `XUIProvider`)
|
|
75
81
|
- `ThemeMode` — Type: `"dark"` | `"light"` | `"ltg-dark"`
|
|
76
82
|
- `ThemeColors` — Type of the colour token object
|
|
77
83
|
- `colors` — Raw colour tokens for all themes
|
package/index.d.mts
CHANGED
|
@@ -1,10 +1,30 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Typography token definitions for different product contexts.
|
|
5
|
+
*
|
|
6
|
+
* ProductContext determines typography scales — font sizes, line heights,
|
|
7
|
+
* and font weights vary between B2B, B2C, Pay Station, and Presentation.
|
|
8
|
+
*
|
|
9
|
+
* Values are synced from the Figma "Theme / Typography" variable collection.
|
|
10
|
+
* Each semantic token (e.g., heading/h1/font-size) aliases into the responsive
|
|
11
|
+
* scale defined in responsive-typography.ts. The `scaleStep` field records
|
|
12
|
+
* which scale step a token maps to, enabling CSS variable consumption on web.
|
|
13
|
+
*
|
|
14
|
+
* Line-height categories:
|
|
15
|
+
* - Headings and display use "display" line-heights (tight, ~1:1)
|
|
16
|
+
* - Body default/accent use "compact" line-heights (moderate)
|
|
17
|
+
* - Body paragraph uses "text" line-heights (generous, for reading)
|
|
18
|
+
*/
|
|
3
19
|
type ProductContext = "b2c" | "b2b" | "paystation" | "presentation";
|
|
4
20
|
interface TypographyVariant {
|
|
5
21
|
fontSize: number;
|
|
6
22
|
lineHeight: string;
|
|
7
23
|
fontWeight: number;
|
|
24
|
+
/** The responsive scale step this variant maps to (e.g., "650" for 56px) */
|
|
25
|
+
scaleStep?: string;
|
|
26
|
+
/** The line-height category: "display", "compact", or "text" */
|
|
27
|
+
lineHeightCategory?: "display" | "compact" | "text";
|
|
8
28
|
}
|
|
9
29
|
interface TypographyBodyVariant extends TypographyVariant {
|
|
10
30
|
accent?: {
|
|
@@ -13,6 +33,8 @@ interface TypographyBodyVariant extends TypographyVariant {
|
|
|
13
33
|
paragraph?: {
|
|
14
34
|
lineHeight: string;
|
|
15
35
|
spacing?: number;
|
|
36
|
+
/** The line-height scale step for the paragraph variant */
|
|
37
|
+
lineHeightScaleStep?: string;
|
|
16
38
|
};
|
|
17
39
|
}
|
|
18
40
|
interface TypographyTokens {
|
|
@@ -2459,10 +2481,25 @@ declare const shadow: {
|
|
|
2459
2481
|
modal: string;
|
|
2460
2482
|
};
|
|
2461
2483
|
|
|
2484
|
+
/**
|
|
2485
|
+
* Font family definitions per ProductContext.
|
|
2486
|
+
*
|
|
2487
|
+
* Figma "Font" variable collection defines 3 roles:
|
|
2488
|
+
* - display: heading/display font (Pilat or Pilat Wide)
|
|
2489
|
+
* - compact: body/UI font (Aktiv Grotesk or Montserrat)
|
|
2490
|
+
* - text: paragraph/reading font (same families as compact)
|
|
2491
|
+
*
|
|
2492
|
+
* The `heading` and `body` exports map to these Figma roles:
|
|
2493
|
+
* heading → display
|
|
2494
|
+
* body → compact (also used for text contexts)
|
|
2495
|
+
*/
|
|
2496
|
+
|
|
2462
2497
|
/** Static fonts object (defaults to B2B for backwards compatibility) */
|
|
2463
2498
|
declare const fonts: {
|
|
2464
2499
|
heading: string;
|
|
2465
2500
|
body: string;
|
|
2501
|
+
/** Paragraph/reading font — same families as body */
|
|
2502
|
+
text: string;
|
|
2466
2503
|
/** @deprecated Use `heading` or `body` instead */
|
|
2467
2504
|
primary: string;
|
|
2468
2505
|
};
|
|
@@ -2470,6 +2507,8 @@ declare const fonts: {
|
|
|
2470
2507
|
declare const getFonts: (productContext?: ProductContext) => {
|
|
2471
2508
|
heading: string;
|
|
2472
2509
|
body: string;
|
|
2510
|
+
/** Paragraph/reading font — same families as body */
|
|
2511
|
+
text: string;
|
|
2473
2512
|
/** @deprecated Use `heading` or `body` instead */
|
|
2474
2513
|
primary: string;
|
|
2475
2514
|
};
|
|
@@ -2480,6 +2519,73 @@ declare const typography: {
|
|
|
2480
2519
|
};
|
|
2481
2520
|
};
|
|
2482
2521
|
|
|
2522
|
+
/**
|
|
2523
|
+
* Responsive breakpoint definitions for the design system.
|
|
2524
|
+
*
|
|
2525
|
+
* Derived from the Figma "Responsive / Typography" variable collection,
|
|
2526
|
+
* which has three modes: Common, Mobile, Desktop.
|
|
2527
|
+
* Common and Desktop share identical values; Mobile scales down.
|
|
2528
|
+
*
|
|
2529
|
+
* Usage (CSS):
|
|
2530
|
+
* @media (max-width: 767px) { ... } // Mobile
|
|
2531
|
+
* @media (min-width: 768px) { ... } // Desktop
|
|
2532
|
+
*
|
|
2533
|
+
* Usage (JS):
|
|
2534
|
+
* import { breakpoints } from '@xsolla/xui-core';
|
|
2535
|
+
* const isMobile = window.innerWidth < breakpoints.desktop;
|
|
2536
|
+
*/
|
|
2537
|
+
declare const breakpoints: {
|
|
2538
|
+
/** Mobile: 0 – 767px */
|
|
2539
|
+
readonly mobile: 0;
|
|
2540
|
+
/** Desktop: 768px and above */
|
|
2541
|
+
readonly desktop: 768;
|
|
2542
|
+
};
|
|
2543
|
+
type BreakpointKey = keyof typeof breakpoints;
|
|
2544
|
+
/**
|
|
2545
|
+
* Max-width media query value for targeting mobile devices.
|
|
2546
|
+
* Use in CSS: `@media (max-width: ${MOBILE_MAX_WIDTH}px)`
|
|
2547
|
+
*/
|
|
2548
|
+
declare const MOBILE_MAX_WIDTH: number;
|
|
2549
|
+
|
|
2550
|
+
/**
|
|
2551
|
+
* Responsive typography scale tokens sourced from the Figma
|
|
2552
|
+
* "Responsive / Typography" variable collection.
|
|
2553
|
+
*
|
|
2554
|
+
* Three device modes: Common (default), Mobile, Desktop.
|
|
2555
|
+
* Common and Desktop have identical values. Mobile scales down.
|
|
2556
|
+
*
|
|
2557
|
+
* These are the raw building blocks. Semantic tokens in typography.ts
|
|
2558
|
+
* alias into this scale (e.g., B2B heading/h1/font-size → font-size/650).
|
|
2559
|
+
*
|
|
2560
|
+
* On web, these are injected as CSS custom properties (--xui-font-size-*, --xui-lh-*)
|
|
2561
|
+
* with @media overrides for mobile. Components consume a single CSS variable
|
|
2562
|
+
* and scale automatically by viewport.
|
|
2563
|
+
*
|
|
2564
|
+
* @see {@link ../styles/typography-css.ts} for CSS generation
|
|
2565
|
+
* @see {@link ./breakpoints.ts} for breakpoint definitions
|
|
2566
|
+
*/
|
|
2567
|
+
interface ResponsiveValue {
|
|
2568
|
+
common: number;
|
|
2569
|
+
mobile: number;
|
|
2570
|
+
desktop: number;
|
|
2571
|
+
}
|
|
2572
|
+
type ScaleStep = "75" | "100" | "125" | "150" | "175" | "200" | "250" | "300" | "350" | "450" | "550" | "650" | "750";
|
|
2573
|
+
declare const SCALE_STEPS: ScaleStep[];
|
|
2574
|
+
/** Font-size scale: 13 steps from 10px to 64px (desktop) */
|
|
2575
|
+
declare const fontSize: Record<ScaleStep, ResponsiveValue>;
|
|
2576
|
+
/** Line-height/display: tight line-heights for headings (roughly 1:1 with font-size) */
|
|
2577
|
+
declare const lineHeightDisplay: Record<ScaleStep, ResponsiveValue>;
|
|
2578
|
+
/** Line-height/compact: moderate line-heights for UI body text */
|
|
2579
|
+
declare const lineHeightCompact: Record<ScaleStep, ResponsiveValue>;
|
|
2580
|
+
/** Line-height/text: generous line-heights for paragraphs and reading text */
|
|
2581
|
+
declare const lineHeightText: Record<ScaleStep, ResponsiveValue>;
|
|
2582
|
+
declare const responsiveTypographyScale: {
|
|
2583
|
+
readonly fontSize: Record<ScaleStep, ResponsiveValue>;
|
|
2584
|
+
readonly lineHeightDisplay: Record<ScaleStep, ResponsiveValue>;
|
|
2585
|
+
readonly lineHeightCompact: Record<ScaleStep, ResponsiveValue>;
|
|
2586
|
+
readonly lineHeightText: Record<ScaleStep, ResponsiveValue>;
|
|
2587
|
+
};
|
|
2588
|
+
|
|
2483
2589
|
declare const isWeb: boolean;
|
|
2484
2590
|
declare const isNative: boolean;
|
|
2485
2591
|
declare const isIOS: boolean;
|
|
@@ -2506,6 +2612,46 @@ declare const FontLoader: React.FC;
|
|
|
2506
2612
|
*/
|
|
2507
2613
|
declare const fontFacesCSS = "\n /* \u2500\u2500 Pilat Wide (B2C headings) \u2500\u2500 */\n\n @font-face {\n font-family: 'Pilat Wide';\n src: url('https://cdn.xsolla.net/strapi-v2-bucket-prod/Pilat_Test_Medium_/Pilat_Test_Medium.ttf') format('truetype');\n font-weight: 400;\n font-style: normal;\n font-display: swap;\n }\n @font-face {\n font-family: 'Pilat Wide';\n src: url('https://cdn.xsolla.net/strapi-v2-bucket-prod/Pilat_Test_Demi_Bold_bee67c470a/Pilat_Test_Demi_Bold_bee67c470a.ttf') format('truetype');\n font-weight: 600;\n font-style: normal;\n font-display: swap;\n }\n @font-face {\n font-family: 'Pilat Wide';\n src: url('https://cdn.xsolla.net/strapi-v2-bucket-prod/Pilat_Test_Bold_b12b40d234/Pilat_Test_Bold_b12b40d234.ttf') format('truetype');\n font-weight: 700;\n font-style: normal;\n font-display: swap;\n }\n @font-face {\n font-family: 'Pilat Wide';\n src: url('https://cdn.xsolla.net/strapi-v2-bucket-prod/Pilat_Test_Heavy_2885678ca4/Pilat_Test_Heavy_2885678ca4.otf') format('opentype');\n font-weight: 800;\n font-style: normal;\n font-display: swap;\n }\n\n /* \u2500\u2500 Pilat (B2B headings) \u2500\u2500 */\n\n @font-face {\n font-family: 'Pilat';\n src: url('https://cdn.xsolla.net/merchant-bucket-prod/files/uploaded/722279/55a03110b2400b778d485de2c8d064c0.woff2') format('woff2');\n font-weight: 300;\n font-style: normal;\n font-display: swap;\n }\n @font-face {\n font-family: 'Pilat';\n src: url('https://cdn.xsolla.net/merchant-bucket-prod/files/uploaded/722279/e968c9cc76e48ff6111c90534549bbf9.woff2') format('woff2');\n font-weight: 400;\n font-style: normal;\n font-display: swap;\n }\n @font-face {\n font-family: 'Pilat';\n src: url('https://cdn.xsolla.net/merchant-bucket-prod/files/uploaded/722279/ed4fe74e88aaacc6978f06a862e75b08.woff2') format('woff2');\n font-weight: 600;\n font-style: normal;\n font-display: swap;\n }\n @font-face {\n font-family: 'Pilat';\n src: url('https://cdn.xsolla.net/merchant-bucket-prod/files/uploaded/722279/7450f429979af7eaa8fa4d4d91cee927.woff2') format('woff2');\n font-weight: 700;\n font-style: normal;\n font-display: swap;\n }\n @font-face {\n font-family: 'Pilat';\n src: url('https://cdn.xsolla.net/merchant-bucket-prod/files/uploaded/722279/218d647ff7690c1e312f6943e29af375.woff2') format('woff2');\n font-weight: 800;\n font-style: normal;\n font-display: swap;\n }\n\n /* \u2500\u2500 Aktiv Grotesk (body) \u2014 served from Sharp Grotesk CDN files \u2500\u2500 */\n\n @font-face {\n font-family: 'Aktiv Grotesk';\n src: url('https://cdn.xsolla.net/strapi-v2-bucket-prod/Pilat_Test_Light_c4650750bb/Pilat_Test_Light_c4650750bb.otf') format('opentype');\n font-weight: 300;\n font-style: normal;\n font-display: swap;\n }\n @font-face {\n font-family: 'Aktiv Grotesk';\n src: url('https://cdn.xsolla.net/strapi-v2-bucket-prod/Pilat_Test_Book_5cb49cd592/Pilat_Test_Book_5cb49cd592.otf') format('opentype');\n font-weight: 400;\n font-style: normal;\n font-display: swap;\n }\n @font-face {\n font-family: 'Aktiv Grotesk';\n src: url('https://cdn.xsolla.net/strapi-v2-bucket-prod/Pilat_Test_Demi_e9bed59107/Pilat_Test_Demi_e9bed59107.otf') format('opentype');\n font-weight: 500;\n font-style: normal;\n font-display: swap;\n }\n @font-face {\n font-family: 'Aktiv Grotesk';\n src: url('https://cdn.xsolla.net/strapi-v2-bucket-prod/Pilat_Test_Bold_195d1b44fa/Pilat_Test_Bold_195d1b44fa.otf') format('opentype');\n font-weight: 600;\n font-style: normal;\n font-display: swap;\n }\n @font-face {\n font-family: 'Aktiv Grotesk';\n src: url('https://cdn.xsolla.net/strapi-v2-bucket-prod/Pilat_Test_Bold_195d1b44fa/Pilat_Test_Bold_195d1b44fa.otf') format('opentype');\n font-weight: 700;\n font-style: normal;\n font-display: swap;\n }\n";
|
|
2508
2614
|
|
|
2615
|
+
declare const TypographyStyleLoader: React.FC;
|
|
2616
|
+
|
|
2617
|
+
/**
|
|
2618
|
+
* Generates the CSS custom properties string for responsive typography.
|
|
2619
|
+
*
|
|
2620
|
+
* Produces two blocks:
|
|
2621
|
+
* 1. :root — Desktop/Common values (the default)
|
|
2622
|
+
* 2. @media (max-width: 767px) :root — Mobile overrides
|
|
2623
|
+
*
|
|
2624
|
+
* CSS variable naming convention (mirrors Figma variable names):
|
|
2625
|
+
* --xui-font-size-{step} → e.g. --xui-font-size-150: 16px
|
|
2626
|
+
* --xui-lh-display-{step} → e.g. --xui-lh-display-150: 16px
|
|
2627
|
+
* --xui-lh-compact-{step} → e.g. --xui-lh-compact-150: 20px
|
|
2628
|
+
* --xui-lh-text-{step} → e.g. --xui-lh-text-150: 22px
|
|
2629
|
+
*
|
|
2630
|
+
* Consumers can use these in CSS or styled-components:
|
|
2631
|
+
* font-size: var(--xui-font-size-350);
|
|
2632
|
+
* line-height: var(--xui-lh-compact-350);
|
|
2633
|
+
*
|
|
2634
|
+
* @see {@link ../tokens/responsive-typography.ts} for raw token data
|
|
2635
|
+
* @see {@link ../tokens/breakpoints.ts} for breakpoint definitions
|
|
2636
|
+
*/
|
|
2637
|
+
/**
|
|
2638
|
+
* Returns the full CSS string for responsive typography custom properties.
|
|
2639
|
+
* The result is memoized — safe to call multiple times.
|
|
2640
|
+
*/
|
|
2641
|
+
declare function generateTypographyCSS(): string;
|
|
2642
|
+
/**
|
|
2643
|
+
* Returns the CSS variable name for a given font-size scale step.
|
|
2644
|
+
* Useful when the Typography component needs to reference a CSS variable.
|
|
2645
|
+
*
|
|
2646
|
+
* @example cssVar.fontSize("350") → "var(--xui-font-size-350)"
|
|
2647
|
+
*/
|
|
2648
|
+
declare const cssVar: {
|
|
2649
|
+
readonly fontSize: (step: string) => string;
|
|
2650
|
+
readonly lhDisplay: (step: string) => string;
|
|
2651
|
+
readonly lhCompact: (step: string) => string;
|
|
2652
|
+
readonly lhText: (step: string) => string;
|
|
2653
|
+
};
|
|
2654
|
+
|
|
2509
2655
|
type ThemeMode = "dark" | "light" | "pentagram-dark" | "pentagram-light" | "ltg-dark";
|
|
2510
2656
|
declare const themeConfig: (mode?: ThemeMode, productContext?: ProductContext) => {
|
|
2511
2657
|
colors: {
|
|
@@ -3722,6 +3868,7 @@ declare const themeConfig: (mode?: ThemeMode, productContext?: ProductContext) =
|
|
|
3722
3868
|
fonts: {
|
|
3723
3869
|
heading: string;
|
|
3724
3870
|
body: string;
|
|
3871
|
+
text: string;
|
|
3725
3872
|
primary: string;
|
|
3726
3873
|
};
|
|
3727
3874
|
typography: {
|
|
@@ -5935,6 +6082,7 @@ declare const useResolvedTheme: (overrides?: ThemeOverrideProps) => {
|
|
|
5935
6082
|
fonts: {
|
|
5936
6083
|
heading: string;
|
|
5937
6084
|
body: string;
|
|
6085
|
+
text: string;
|
|
5938
6086
|
primary: string;
|
|
5939
6087
|
};
|
|
5940
6088
|
typography: {
|
|
@@ -6924,4 +7072,4 @@ declare const ModalIdContext: React.Context<string | null>;
|
|
|
6924
7072
|
*/
|
|
6925
7073
|
declare const useModalId: () => string | null;
|
|
6926
7074
|
|
|
6927
|
-
export { FontLoader, ModalIdContext, type ProductContext, type ThemeColors, type ThemeMode, type ThemeOverrideProps, type TypographyBodyVariant, type TypographyTokens, type TypographyVariant, XUIProvider, colors, defaultProductContext, fontFacesCSS, fonts, getFonts, getTypographyTokens, getTypographyVariant, isAndroid, isIOS, isNative, isWeb, radius, shadow, spacing, themeConfig, typography, typographyTokens, useDesignSystem, useId, useModalId, useResolvedTheme };
|
|
7075
|
+
export { type BreakpointKey, FontLoader, MOBILE_MAX_WIDTH, ModalIdContext, type ProductContext, type ResponsiveValue, SCALE_STEPS, type ScaleStep, type ThemeColors, type ThemeMode, type ThemeOverrideProps, type TypographyBodyVariant, TypographyStyleLoader, type TypographyTokens, type TypographyVariant, XUIProvider, breakpoints, colors, cssVar, defaultProductContext, fontFacesCSS, fontSize, fonts, generateTypographyCSS, getFonts, getTypographyTokens, getTypographyVariant, isAndroid, isIOS, isNative, isWeb, lineHeightCompact, lineHeightDisplay, lineHeightText, radius, responsiveTypographyScale, shadow, spacing, themeConfig, typography, typographyTokens, useDesignSystem, useId, useModalId, useResolvedTheme };
|
package/index.d.ts
CHANGED
|
@@ -1,10 +1,30 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Typography token definitions for different product contexts.
|
|
5
|
+
*
|
|
6
|
+
* ProductContext determines typography scales — font sizes, line heights,
|
|
7
|
+
* and font weights vary between B2B, B2C, Pay Station, and Presentation.
|
|
8
|
+
*
|
|
9
|
+
* Values are synced from the Figma "Theme / Typography" variable collection.
|
|
10
|
+
* Each semantic token (e.g., heading/h1/font-size) aliases into the responsive
|
|
11
|
+
* scale defined in responsive-typography.ts. The `scaleStep` field records
|
|
12
|
+
* which scale step a token maps to, enabling CSS variable consumption on web.
|
|
13
|
+
*
|
|
14
|
+
* Line-height categories:
|
|
15
|
+
* - Headings and display use "display" line-heights (tight, ~1:1)
|
|
16
|
+
* - Body default/accent use "compact" line-heights (moderate)
|
|
17
|
+
* - Body paragraph uses "text" line-heights (generous, for reading)
|
|
18
|
+
*/
|
|
3
19
|
type ProductContext = "b2c" | "b2b" | "paystation" | "presentation";
|
|
4
20
|
interface TypographyVariant {
|
|
5
21
|
fontSize: number;
|
|
6
22
|
lineHeight: string;
|
|
7
23
|
fontWeight: number;
|
|
24
|
+
/** The responsive scale step this variant maps to (e.g., "650" for 56px) */
|
|
25
|
+
scaleStep?: string;
|
|
26
|
+
/** The line-height category: "display", "compact", or "text" */
|
|
27
|
+
lineHeightCategory?: "display" | "compact" | "text";
|
|
8
28
|
}
|
|
9
29
|
interface TypographyBodyVariant extends TypographyVariant {
|
|
10
30
|
accent?: {
|
|
@@ -13,6 +33,8 @@ interface TypographyBodyVariant extends TypographyVariant {
|
|
|
13
33
|
paragraph?: {
|
|
14
34
|
lineHeight: string;
|
|
15
35
|
spacing?: number;
|
|
36
|
+
/** The line-height scale step for the paragraph variant */
|
|
37
|
+
lineHeightScaleStep?: string;
|
|
16
38
|
};
|
|
17
39
|
}
|
|
18
40
|
interface TypographyTokens {
|
|
@@ -2459,10 +2481,25 @@ declare const shadow: {
|
|
|
2459
2481
|
modal: string;
|
|
2460
2482
|
};
|
|
2461
2483
|
|
|
2484
|
+
/**
|
|
2485
|
+
* Font family definitions per ProductContext.
|
|
2486
|
+
*
|
|
2487
|
+
* Figma "Font" variable collection defines 3 roles:
|
|
2488
|
+
* - display: heading/display font (Pilat or Pilat Wide)
|
|
2489
|
+
* - compact: body/UI font (Aktiv Grotesk or Montserrat)
|
|
2490
|
+
* - text: paragraph/reading font (same families as compact)
|
|
2491
|
+
*
|
|
2492
|
+
* The `heading` and `body` exports map to these Figma roles:
|
|
2493
|
+
* heading → display
|
|
2494
|
+
* body → compact (also used for text contexts)
|
|
2495
|
+
*/
|
|
2496
|
+
|
|
2462
2497
|
/** Static fonts object (defaults to B2B for backwards compatibility) */
|
|
2463
2498
|
declare const fonts: {
|
|
2464
2499
|
heading: string;
|
|
2465
2500
|
body: string;
|
|
2501
|
+
/** Paragraph/reading font — same families as body */
|
|
2502
|
+
text: string;
|
|
2466
2503
|
/** @deprecated Use `heading` or `body` instead */
|
|
2467
2504
|
primary: string;
|
|
2468
2505
|
};
|
|
@@ -2470,6 +2507,8 @@ declare const fonts: {
|
|
|
2470
2507
|
declare const getFonts: (productContext?: ProductContext) => {
|
|
2471
2508
|
heading: string;
|
|
2472
2509
|
body: string;
|
|
2510
|
+
/** Paragraph/reading font — same families as body */
|
|
2511
|
+
text: string;
|
|
2473
2512
|
/** @deprecated Use `heading` or `body` instead */
|
|
2474
2513
|
primary: string;
|
|
2475
2514
|
};
|
|
@@ -2480,6 +2519,73 @@ declare const typography: {
|
|
|
2480
2519
|
};
|
|
2481
2520
|
};
|
|
2482
2521
|
|
|
2522
|
+
/**
|
|
2523
|
+
* Responsive breakpoint definitions for the design system.
|
|
2524
|
+
*
|
|
2525
|
+
* Derived from the Figma "Responsive / Typography" variable collection,
|
|
2526
|
+
* which has three modes: Common, Mobile, Desktop.
|
|
2527
|
+
* Common and Desktop share identical values; Mobile scales down.
|
|
2528
|
+
*
|
|
2529
|
+
* Usage (CSS):
|
|
2530
|
+
* @media (max-width: 767px) { ... } // Mobile
|
|
2531
|
+
* @media (min-width: 768px) { ... } // Desktop
|
|
2532
|
+
*
|
|
2533
|
+
* Usage (JS):
|
|
2534
|
+
* import { breakpoints } from '@xsolla/xui-core';
|
|
2535
|
+
* const isMobile = window.innerWidth < breakpoints.desktop;
|
|
2536
|
+
*/
|
|
2537
|
+
declare const breakpoints: {
|
|
2538
|
+
/** Mobile: 0 – 767px */
|
|
2539
|
+
readonly mobile: 0;
|
|
2540
|
+
/** Desktop: 768px and above */
|
|
2541
|
+
readonly desktop: 768;
|
|
2542
|
+
};
|
|
2543
|
+
type BreakpointKey = keyof typeof breakpoints;
|
|
2544
|
+
/**
|
|
2545
|
+
* Max-width media query value for targeting mobile devices.
|
|
2546
|
+
* Use in CSS: `@media (max-width: ${MOBILE_MAX_WIDTH}px)`
|
|
2547
|
+
*/
|
|
2548
|
+
declare const MOBILE_MAX_WIDTH: number;
|
|
2549
|
+
|
|
2550
|
+
/**
|
|
2551
|
+
* Responsive typography scale tokens sourced from the Figma
|
|
2552
|
+
* "Responsive / Typography" variable collection.
|
|
2553
|
+
*
|
|
2554
|
+
* Three device modes: Common (default), Mobile, Desktop.
|
|
2555
|
+
* Common and Desktop have identical values. Mobile scales down.
|
|
2556
|
+
*
|
|
2557
|
+
* These are the raw building blocks. Semantic tokens in typography.ts
|
|
2558
|
+
* alias into this scale (e.g., B2B heading/h1/font-size → font-size/650).
|
|
2559
|
+
*
|
|
2560
|
+
* On web, these are injected as CSS custom properties (--xui-font-size-*, --xui-lh-*)
|
|
2561
|
+
* with @media overrides for mobile. Components consume a single CSS variable
|
|
2562
|
+
* and scale automatically by viewport.
|
|
2563
|
+
*
|
|
2564
|
+
* @see {@link ../styles/typography-css.ts} for CSS generation
|
|
2565
|
+
* @see {@link ./breakpoints.ts} for breakpoint definitions
|
|
2566
|
+
*/
|
|
2567
|
+
interface ResponsiveValue {
|
|
2568
|
+
common: number;
|
|
2569
|
+
mobile: number;
|
|
2570
|
+
desktop: number;
|
|
2571
|
+
}
|
|
2572
|
+
type ScaleStep = "75" | "100" | "125" | "150" | "175" | "200" | "250" | "300" | "350" | "450" | "550" | "650" | "750";
|
|
2573
|
+
declare const SCALE_STEPS: ScaleStep[];
|
|
2574
|
+
/** Font-size scale: 13 steps from 10px to 64px (desktop) */
|
|
2575
|
+
declare const fontSize: Record<ScaleStep, ResponsiveValue>;
|
|
2576
|
+
/** Line-height/display: tight line-heights for headings (roughly 1:1 with font-size) */
|
|
2577
|
+
declare const lineHeightDisplay: Record<ScaleStep, ResponsiveValue>;
|
|
2578
|
+
/** Line-height/compact: moderate line-heights for UI body text */
|
|
2579
|
+
declare const lineHeightCompact: Record<ScaleStep, ResponsiveValue>;
|
|
2580
|
+
/** Line-height/text: generous line-heights for paragraphs and reading text */
|
|
2581
|
+
declare const lineHeightText: Record<ScaleStep, ResponsiveValue>;
|
|
2582
|
+
declare const responsiveTypographyScale: {
|
|
2583
|
+
readonly fontSize: Record<ScaleStep, ResponsiveValue>;
|
|
2584
|
+
readonly lineHeightDisplay: Record<ScaleStep, ResponsiveValue>;
|
|
2585
|
+
readonly lineHeightCompact: Record<ScaleStep, ResponsiveValue>;
|
|
2586
|
+
readonly lineHeightText: Record<ScaleStep, ResponsiveValue>;
|
|
2587
|
+
};
|
|
2588
|
+
|
|
2483
2589
|
declare const isWeb: boolean;
|
|
2484
2590
|
declare const isNative: boolean;
|
|
2485
2591
|
declare const isIOS: boolean;
|
|
@@ -2506,6 +2612,46 @@ declare const FontLoader: React.FC;
|
|
|
2506
2612
|
*/
|
|
2507
2613
|
declare const fontFacesCSS = "\n /* \u2500\u2500 Pilat Wide (B2C headings) \u2500\u2500 */\n\n @font-face {\n font-family: 'Pilat Wide';\n src: url('https://cdn.xsolla.net/strapi-v2-bucket-prod/Pilat_Test_Medium_/Pilat_Test_Medium.ttf') format('truetype');\n font-weight: 400;\n font-style: normal;\n font-display: swap;\n }\n @font-face {\n font-family: 'Pilat Wide';\n src: url('https://cdn.xsolla.net/strapi-v2-bucket-prod/Pilat_Test_Demi_Bold_bee67c470a/Pilat_Test_Demi_Bold_bee67c470a.ttf') format('truetype');\n font-weight: 600;\n font-style: normal;\n font-display: swap;\n }\n @font-face {\n font-family: 'Pilat Wide';\n src: url('https://cdn.xsolla.net/strapi-v2-bucket-prod/Pilat_Test_Bold_b12b40d234/Pilat_Test_Bold_b12b40d234.ttf') format('truetype');\n font-weight: 700;\n font-style: normal;\n font-display: swap;\n }\n @font-face {\n font-family: 'Pilat Wide';\n src: url('https://cdn.xsolla.net/strapi-v2-bucket-prod/Pilat_Test_Heavy_2885678ca4/Pilat_Test_Heavy_2885678ca4.otf') format('opentype');\n font-weight: 800;\n font-style: normal;\n font-display: swap;\n }\n\n /* \u2500\u2500 Pilat (B2B headings) \u2500\u2500 */\n\n @font-face {\n font-family: 'Pilat';\n src: url('https://cdn.xsolla.net/merchant-bucket-prod/files/uploaded/722279/55a03110b2400b778d485de2c8d064c0.woff2') format('woff2');\n font-weight: 300;\n font-style: normal;\n font-display: swap;\n }\n @font-face {\n font-family: 'Pilat';\n src: url('https://cdn.xsolla.net/merchant-bucket-prod/files/uploaded/722279/e968c9cc76e48ff6111c90534549bbf9.woff2') format('woff2');\n font-weight: 400;\n font-style: normal;\n font-display: swap;\n }\n @font-face {\n font-family: 'Pilat';\n src: url('https://cdn.xsolla.net/merchant-bucket-prod/files/uploaded/722279/ed4fe74e88aaacc6978f06a862e75b08.woff2') format('woff2');\n font-weight: 600;\n font-style: normal;\n font-display: swap;\n }\n @font-face {\n font-family: 'Pilat';\n src: url('https://cdn.xsolla.net/merchant-bucket-prod/files/uploaded/722279/7450f429979af7eaa8fa4d4d91cee927.woff2') format('woff2');\n font-weight: 700;\n font-style: normal;\n font-display: swap;\n }\n @font-face {\n font-family: 'Pilat';\n src: url('https://cdn.xsolla.net/merchant-bucket-prod/files/uploaded/722279/218d647ff7690c1e312f6943e29af375.woff2') format('woff2');\n font-weight: 800;\n font-style: normal;\n font-display: swap;\n }\n\n /* \u2500\u2500 Aktiv Grotesk (body) \u2014 served from Sharp Grotesk CDN files \u2500\u2500 */\n\n @font-face {\n font-family: 'Aktiv Grotesk';\n src: url('https://cdn.xsolla.net/strapi-v2-bucket-prod/Pilat_Test_Light_c4650750bb/Pilat_Test_Light_c4650750bb.otf') format('opentype');\n font-weight: 300;\n font-style: normal;\n font-display: swap;\n }\n @font-face {\n font-family: 'Aktiv Grotesk';\n src: url('https://cdn.xsolla.net/strapi-v2-bucket-prod/Pilat_Test_Book_5cb49cd592/Pilat_Test_Book_5cb49cd592.otf') format('opentype');\n font-weight: 400;\n font-style: normal;\n font-display: swap;\n }\n @font-face {\n font-family: 'Aktiv Grotesk';\n src: url('https://cdn.xsolla.net/strapi-v2-bucket-prod/Pilat_Test_Demi_e9bed59107/Pilat_Test_Demi_e9bed59107.otf') format('opentype');\n font-weight: 500;\n font-style: normal;\n font-display: swap;\n }\n @font-face {\n font-family: 'Aktiv Grotesk';\n src: url('https://cdn.xsolla.net/strapi-v2-bucket-prod/Pilat_Test_Bold_195d1b44fa/Pilat_Test_Bold_195d1b44fa.otf') format('opentype');\n font-weight: 600;\n font-style: normal;\n font-display: swap;\n }\n @font-face {\n font-family: 'Aktiv Grotesk';\n src: url('https://cdn.xsolla.net/strapi-v2-bucket-prod/Pilat_Test_Bold_195d1b44fa/Pilat_Test_Bold_195d1b44fa.otf') format('opentype');\n font-weight: 700;\n font-style: normal;\n font-display: swap;\n }\n";
|
|
2508
2614
|
|
|
2615
|
+
declare const TypographyStyleLoader: React.FC;
|
|
2616
|
+
|
|
2617
|
+
/**
|
|
2618
|
+
* Generates the CSS custom properties string for responsive typography.
|
|
2619
|
+
*
|
|
2620
|
+
* Produces two blocks:
|
|
2621
|
+
* 1. :root — Desktop/Common values (the default)
|
|
2622
|
+
* 2. @media (max-width: 767px) :root — Mobile overrides
|
|
2623
|
+
*
|
|
2624
|
+
* CSS variable naming convention (mirrors Figma variable names):
|
|
2625
|
+
* --xui-font-size-{step} → e.g. --xui-font-size-150: 16px
|
|
2626
|
+
* --xui-lh-display-{step} → e.g. --xui-lh-display-150: 16px
|
|
2627
|
+
* --xui-lh-compact-{step} → e.g. --xui-lh-compact-150: 20px
|
|
2628
|
+
* --xui-lh-text-{step} → e.g. --xui-lh-text-150: 22px
|
|
2629
|
+
*
|
|
2630
|
+
* Consumers can use these in CSS or styled-components:
|
|
2631
|
+
* font-size: var(--xui-font-size-350);
|
|
2632
|
+
* line-height: var(--xui-lh-compact-350);
|
|
2633
|
+
*
|
|
2634
|
+
* @see {@link ../tokens/responsive-typography.ts} for raw token data
|
|
2635
|
+
* @see {@link ../tokens/breakpoints.ts} for breakpoint definitions
|
|
2636
|
+
*/
|
|
2637
|
+
/**
|
|
2638
|
+
* Returns the full CSS string for responsive typography custom properties.
|
|
2639
|
+
* The result is memoized — safe to call multiple times.
|
|
2640
|
+
*/
|
|
2641
|
+
declare function generateTypographyCSS(): string;
|
|
2642
|
+
/**
|
|
2643
|
+
* Returns the CSS variable name for a given font-size scale step.
|
|
2644
|
+
* Useful when the Typography component needs to reference a CSS variable.
|
|
2645
|
+
*
|
|
2646
|
+
* @example cssVar.fontSize("350") → "var(--xui-font-size-350)"
|
|
2647
|
+
*/
|
|
2648
|
+
declare const cssVar: {
|
|
2649
|
+
readonly fontSize: (step: string) => string;
|
|
2650
|
+
readonly lhDisplay: (step: string) => string;
|
|
2651
|
+
readonly lhCompact: (step: string) => string;
|
|
2652
|
+
readonly lhText: (step: string) => string;
|
|
2653
|
+
};
|
|
2654
|
+
|
|
2509
2655
|
type ThemeMode = "dark" | "light" | "pentagram-dark" | "pentagram-light" | "ltg-dark";
|
|
2510
2656
|
declare const themeConfig: (mode?: ThemeMode, productContext?: ProductContext) => {
|
|
2511
2657
|
colors: {
|
|
@@ -3722,6 +3868,7 @@ declare const themeConfig: (mode?: ThemeMode, productContext?: ProductContext) =
|
|
|
3722
3868
|
fonts: {
|
|
3723
3869
|
heading: string;
|
|
3724
3870
|
body: string;
|
|
3871
|
+
text: string;
|
|
3725
3872
|
primary: string;
|
|
3726
3873
|
};
|
|
3727
3874
|
typography: {
|
|
@@ -5935,6 +6082,7 @@ declare const useResolvedTheme: (overrides?: ThemeOverrideProps) => {
|
|
|
5935
6082
|
fonts: {
|
|
5936
6083
|
heading: string;
|
|
5937
6084
|
body: string;
|
|
6085
|
+
text: string;
|
|
5938
6086
|
primary: string;
|
|
5939
6087
|
};
|
|
5940
6088
|
typography: {
|
|
@@ -6924,4 +7072,4 @@ declare const ModalIdContext: React.Context<string | null>;
|
|
|
6924
7072
|
*/
|
|
6925
7073
|
declare const useModalId: () => string | null;
|
|
6926
7074
|
|
|
6927
|
-
export { FontLoader, ModalIdContext, type ProductContext, type ThemeColors, type ThemeMode, type ThemeOverrideProps, type TypographyBodyVariant, type TypographyTokens, type TypographyVariant, XUIProvider, colors, defaultProductContext, fontFacesCSS, fonts, getFonts, getTypographyTokens, getTypographyVariant, isAndroid, isIOS, isNative, isWeb, radius, shadow, spacing, themeConfig, typography, typographyTokens, useDesignSystem, useId, useModalId, useResolvedTheme };
|
|
7075
|
+
export { type BreakpointKey, FontLoader, MOBILE_MAX_WIDTH, ModalIdContext, type ProductContext, type ResponsiveValue, SCALE_STEPS, type ScaleStep, type ThemeColors, type ThemeMode, type ThemeOverrideProps, type TypographyBodyVariant, TypographyStyleLoader, type TypographyTokens, type TypographyVariant, XUIProvider, breakpoints, colors, cssVar, defaultProductContext, fontFacesCSS, fontSize, fonts, generateTypographyCSS, getFonts, getTypographyTokens, getTypographyVariant, isAndroid, isIOS, isNative, isWeb, lineHeightCompact, lineHeightDisplay, lineHeightText, radius, responsiveTypographyScale, shadow, spacing, themeConfig, typography, typographyTokens, useDesignSystem, useId, useModalId, useResolvedTheme };
|