@xsolla/xui-core 0.161.3 → 0.162.0-pr294.1780506771
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 +29 -6
- package/index.d.mts +1642 -426
- package/index.d.ts +1642 -426
- package/index.js +561 -392
- package/index.js.map +1 -1
- package/index.mjs +561 -392
- package/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -51,6 +51,7 @@ function MyWidget({ label, themeMode, themeProductContext }: MyWidgetProps) {
|
|
|
51
51
|
| `"dark"` | Pentagram Dark (default) |
|
|
52
52
|
| `"light"` | Pentagram Light |
|
|
53
53
|
| `"ltg-dark"` | LTG Dark |
|
|
54
|
+
| `"blueprints"` | Blueprints |
|
|
54
55
|
|
|
55
56
|
## Per-Component Overrides
|
|
56
57
|
|
|
@@ -62,10 +63,32 @@ Every component accepts `themeMode` and `themeProductContext` props to override
|
|
|
62
63
|
|
|
63
64
|
For custom components, use `useResolvedTheme` instead of `useDesignSystem`.
|
|
64
65
|
|
|
66
|
+
## Responsive Typography
|
|
67
|
+
|
|
68
|
+
By default, `XUIProvider` injects CSS custom properties (`--xui-font-size-*`, `--xui-lh-*`) with `@media` queries so text scales between mobile and desktop breakpoints. Pass `responsive={false}` to disable this — all components will use the fixed common/desktop values instead.
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
// Default — responsive scaling via CSS vars + @media
|
|
72
|
+
<XUIProvider>
|
|
73
|
+
<App />
|
|
74
|
+
</XUIProvider>
|
|
75
|
+
|
|
76
|
+
// Opt-out — fixed sizes, no @media queries injected
|
|
77
|
+
<XUIProvider responsive={false}>
|
|
78
|
+
<App />
|
|
79
|
+
</XUIProvider>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The `responsive` flag is also available from `useDesignSystem()` if a component needs to branch on it:
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
const { responsive } = useDesignSystem();
|
|
86
|
+
```
|
|
87
|
+
|
|
65
88
|
## Exports
|
|
66
89
|
|
|
67
|
-
- `XUIProvider` — Root context provider; accepts `initialMode` (see theme modes above)
|
|
68
|
-
- `useDesignSystem` — Hook returning `{ theme, mode, setMode }`; falls back to dark theme if no provider
|
|
90
|
+
- `XUIProvider` — Root context provider; accepts `initialMode` (see theme modes above) and `responsive` (opt-out of responsive typography, defaults to `true`)
|
|
91
|
+
- `useDesignSystem` — Hook returning `{ theme, mode, setMode, responsive }`; falls back to dark theme if no provider
|
|
69
92
|
- `useResolvedTheme` — Hook returning resolved theme with per-component overrides applied; same return shape as `useDesignSystem`
|
|
70
93
|
- `ThemeOverrideProps` — Type: `{ themeMode?: ThemeMode; themeProductContext?: ProductContext }`
|
|
71
94
|
- `themeConfig` — Function returning the full theme object for a given `ThemeMode`
|
|
@@ -73,16 +96,16 @@ For custom components, use `useResolvedTheme` instead of `useDesignSystem`.
|
|
|
73
96
|
- `ModalIdContext` — Context holding the current modal's ID for portal-based components
|
|
74
97
|
- `useModalId` — Hook returning the current modal ID, or `null` if outside a modal
|
|
75
98
|
- `breakpoints` — Responsive breakpoints: `{ mobile: 0, desktop: 768 }`
|
|
76
|
-
- `responsiveTypographyScale` — Raw responsive font-size and line-height data (13 steps ×
|
|
99
|
+
- `responsiveTypographyScale` — Raw responsive font-size and line-height data (13 steps × 2 device modes: common/mobile)
|
|
77
100
|
- `SCALE_STEPS` — Array of all scale step identifiers
|
|
78
101
|
- `generateTypographyCSS` — Returns the full CSS string for responsive typography custom properties
|
|
79
102
|
- `cssVar` — Helper to get CSS variable references: `cssVar.fontSize("350")` → `"var(--xui-font-size-350)"`
|
|
80
103
|
- `TypographyStyleLoader` — Component that injects responsive typography CSS (rendered automatically by `XUIProvider`)
|
|
81
104
|
- `FontLoader` — Component that injects the `@font-face` declarations for XUI fonts
|
|
82
105
|
- `fontFacesCSS` — Raw `@font-face` CSS string (for SSR or manual injection)
|
|
83
|
-
- `ThemeMode` — Type: `"dark"` | `"light"` | `"ltg-dark"`
|
|
106
|
+
- `ThemeMode` — Type: `"dark"` | `"light"` | `"ltg-dark"` | `"blueprints"`
|
|
84
107
|
- `ThemeColors` — Type of the colour token object
|
|
85
|
-
- `ProductContext` — Type of the `themeProductContext` prop
|
|
108
|
+
- `ProductContext` — Type of the `themeProductContext` prop: `"b2c"` | `"b2b"`
|
|
86
109
|
- `colors` — Raw colour tokens for all themes
|
|
87
110
|
- `spacing` — Spacing scale (`xs`, `s`, `m`, `l`, `xl`)
|
|
88
111
|
- `radius` — Border-radius tokens (button, card, input, tag, avatar variants)
|
|
@@ -118,7 +141,7 @@ export const Card = ({ title, themeMode, themeProductContext }: CardProps) => {
|
|
|
118
141
|
<XUIProvider initialMode="dark">
|
|
119
142
|
<Card title="Dark card" />
|
|
120
143
|
<Card title="Light card" themeMode="light" />
|
|
121
|
-
<Card title="
|
|
144
|
+
<Card title="B2C card" themeMode="light" themeProductContext="b2c" />
|
|
122
145
|
</XUIProvider>
|
|
123
146
|
```
|
|
124
147
|
|