@xsolla/xui-core 0.95.0 → 0.97.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 +45 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# @xsolla/xui-core
|
|
2
|
+
|
|
3
|
+
Design system foundation providing theming, context, design tokens, and shared utilities for the XUI toolkit.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
yarn add @xsolla/xui-core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { XUIProvider, useDesignSystem } from '@xsolla/xui-core';
|
|
15
|
+
|
|
16
|
+
function App() {
|
|
17
|
+
return (
|
|
18
|
+
<XUIProvider initialMode="dark">
|
|
19
|
+
<MyApp />
|
|
20
|
+
</XUIProvider>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function MyComponent() {
|
|
25
|
+
const { theme, mode, setMode } = useDesignSystem();
|
|
26
|
+
return <div style={{ color: theme.colors.content.primary }}>Hello</div>;
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Exports
|
|
31
|
+
|
|
32
|
+
- `XUIProvider` — Root context provider; accepts `initialMode` (`"dark"` | `"light"`)
|
|
33
|
+
- `useDesignSystem` — Hook returning `{ theme, mode, setMode }`; falls back to dark theme if no provider
|
|
34
|
+
- `themeConfig` — Function returning the full theme object for a given `ThemeMode`
|
|
35
|
+
- `useId` — Stable unique ID hook; polyfills `React.useId` for React < 18
|
|
36
|
+
- `ModalIdContext` — Context holding the current modal's ID for portal-based components
|
|
37
|
+
- `useModalId` — Hook returning the current modal ID, or `null` if outside a modal
|
|
38
|
+
- `ThemeMode` — Type: `"dark"` | `"light"`
|
|
39
|
+
- `ThemeColors` — Type of the colour token object
|
|
40
|
+
- `colors` — Raw colour tokens for dark and light themes
|
|
41
|
+
- `spacing` — Spacing scale (`xs`, `s`, `m`, `l`, `xl`)
|
|
42
|
+
- `radius` — Border-radius tokens (button, card, input, tag, avatar variants)
|
|
43
|
+
- `shadow` — Shadow tokens
|
|
44
|
+
- `fonts` — Font-family definitions
|
|
45
|
+
- `isWeb` / `isNative` / `isIOS` / `isAndroid` — Platform detection booleans
|