mbt-ui-kit 0.1.14 → 0.1.18
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/.ai/agent-examples/README.md +185 -0
- package/.ai/agent-reference/README.md +49 -0
- package/.ai/agent-rules/README.md +37 -0
- package/.ai/agent-rules/maintenance.md +22 -0
- package/AGENTS.md +41 -0
- package/README.md +173 -93
- package/dist/components/button/button.d.ts +2 -82
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/button/index.d.ts +2 -2
- package/dist/components/button/index.d.ts.map +1 -1
- package/dist/components/input/index.d.ts +3 -3
- package/dist/components/input/index.d.ts.map +1 -1
- package/dist/components/input/input.d.ts +2 -92
- package/dist/components/input/input.d.ts.map +1 -1
- package/dist/components/input/search-icon.d.ts +7 -0
- package/dist/components/input/search-icon.d.ts.map +1 -0
- package/dist/components/loader/index.d.ts +2 -2
- package/dist/components/loader/index.d.ts.map +1 -1
- package/dist/components/loader/loader.d.ts +2 -39
- package/dist/components/loader/loader.d.ts.map +1 -1
- package/dist/components/menu-button/graduation-cap-icon.d.ts +7 -0
- package/dist/components/menu-button/graduation-cap-icon.d.ts.map +1 -0
- package/dist/components/menu-button/index.d.ts +3 -3
- package/dist/components/menu-button/index.d.ts.map +1 -1
- package/dist/components/menu-button/menu-button.d.ts +1 -55
- package/dist/components/menu-button/menu-button.d.ts.map +1 -1
- package/dist/components/typography/heading.d.ts +7 -0
- package/dist/components/typography/heading.d.ts.map +1 -0
- package/dist/components/typography/index.d.ts +6 -6
- package/dist/components/typography/index.d.ts.map +1 -1
- package/dist/components/typography/metric.d.ts +9 -0
- package/dist/components/typography/metric.d.ts.map +1 -0
- package/dist/components/typography/text.d.ts +12 -0
- package/dist/components/typography/text.d.ts.map +1 -0
- package/dist/fonts/ibm-plex-mono-v20-latin-500.woff2 +0 -0
- package/dist/fonts/ibm-plex-mono-v20-latin-600.woff2 +0 -0
- package/dist/fonts/ibm-plex-mono-v20-latin-regular.woff2 +0 -0
- package/dist/fonts/ibm-plex-sans-v23-latin-500.woff2 +0 -0
- package/dist/fonts/ibm-plex-sans-v23-latin-600.woff2 +0 -0
- package/dist/fonts/ibm-plex-sans-v23-latin-regular.woff2 +0 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +13 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +117 -102
- package/dist/styles/fonts.css +64 -0
- package/dist/styles/mbt-ui-kit.css +1 -1
- package/dist/styles/tokens.css +27 -27
- package/dist/styles/tokens.d.ts +2 -2
- package/dist/{tokens-DRT06tcO.js → tokens-Bxhg1IBs.js} +2 -2
- package/dist/tokens-only.d.ts +3 -8
- package/dist/tokens-only.d.ts.map +1 -1
- package/dist/tokens-only.mjs +1 -1
- package/package.json +25 -10
- package/src/styles/_tokens.scss +27 -24
- package/dist/components/input/SearchIcon.d.ts +0 -26
- package/dist/components/input/SearchIcon.d.ts.map +0 -1
- package/dist/components/menu-button/GraduationCapIcon.d.ts +0 -6
- package/dist/components/menu-button/GraduationCapIcon.d.ts.map +0 -1
- package/dist/components/typography/Heading.d.ts +0 -34
- package/dist/components/typography/Heading.d.ts.map +0 -1
- package/dist/components/typography/Metric.d.ts +0 -50
- package/dist/components/typography/Metric.d.ts.map +0 -1
- package/dist/components/typography/Text.d.ts +0 -72
- package/dist/components/typography/Text.d.ts.map +0 -1
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# Agent Examples
|
|
2
|
+
|
|
3
|
+
Use these examples when a consumer app needs package-level usage patterns for `mbt-ui-kit`.
|
|
4
|
+
|
|
5
|
+
## App Shell Setup
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Button, Heading, Input, Text } from 'mbt-ui-kit';
|
|
9
|
+
import 'mbt-ui-kit/styles';
|
|
10
|
+
|
|
11
|
+
function SettingsPanel() {
|
|
12
|
+
return (
|
|
13
|
+
<div>
|
|
14
|
+
<Heading level={2}>Settings</Heading>
|
|
15
|
+
<Text muted>Configure your account preferences.</Text>
|
|
16
|
+
<Input label="Email" placeholder="name@example.com" fullWidth />
|
|
17
|
+
<Button type="button">Save changes</Button>
|
|
18
|
+
</div>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Font Loading
|
|
24
|
+
|
|
25
|
+
Default consumer setup:
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import 'mbt-ui-kit/styles';
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Advanced consumer preload setup:
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
import 'mbt-ui-kit/styles';
|
|
35
|
+
import plexSansRegularUrl from 'mbt-ui-kit/fonts/ibm-plex-sans-v23-latin-regular.woff2';
|
|
36
|
+
import plexSansMediumUrl from 'mbt-ui-kit/fonts/ibm-plex-sans-v23-latin-500.woff2';
|
|
37
|
+
import interVariableUrl from 'mbt-ui-kit/fonts/Inter-VariableFont_opsz,wght.ttf';
|
|
38
|
+
|
|
39
|
+
const preloadFonts = [plexSansRegularUrl, plexSansMediumUrl, interVariableUrl];
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
- Use `mbt-ui-kit/styles` as the default package entrypoint.
|
|
43
|
+
- Preload `mbt-ui-kit/fonts/*` only when the consumer app wants better first paint for fonts already used above the fold.
|
|
44
|
+
- Do not import both `mbt-ui-kit/styles` and `mbt-ui-kit/fonts.css` unless the app intentionally needs separate early font-face loading.
|
|
45
|
+
|
|
46
|
+
## Buttons
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
<Button>Start</Button>
|
|
50
|
+
|
|
51
|
+
<Button disabled>Coming Soon</Button>
|
|
52
|
+
|
|
53
|
+
<Button fullWidth onClick={handleSubmit}>
|
|
54
|
+
Confirm
|
|
55
|
+
</Button>
|
|
56
|
+
|
|
57
|
+
<Button type="button" onClick={handleOpenSettings}>
|
|
58
|
+
<SettingsIcon /> Settings
|
|
59
|
+
</Button>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Inputs
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
<Input label="Search" placeholder="Find champion" showSearchIcon />
|
|
66
|
+
|
|
67
|
+
<Input label="Email" fullWidth value={email} onChange={(e) => setEmail(e.target.value)} />
|
|
68
|
+
|
|
69
|
+
<Input placeholder="Custom icon" icon={<CustomIcon />} />
|
|
70
|
+
|
|
71
|
+
<Input label="Disabled field" muted disabled />
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Typography
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
<Heading level={1}>Dashboard</Heading>
|
|
78
|
+
<Heading level={3}>Recent Matches</Heading>
|
|
79
|
+
|
|
80
|
+
<Text>Regular body copy.</Text>
|
|
81
|
+
<Text strong>Highlighted text.</Text>
|
|
82
|
+
<Text small muted>Secondary caption.</Text>
|
|
83
|
+
<Text label>Role</Text>
|
|
84
|
+
|
|
85
|
+
<Metric>1,234</Metric>
|
|
86
|
+
<Metric large>42,500</Metric>
|
|
87
|
+
<Metric as="span" muted>
|
|
88
|
+
99
|
|
89
|
+
</Metric>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Menu Buttons
|
|
93
|
+
|
|
94
|
+
```tsx
|
|
95
|
+
<MenuButton>Training</MenuButton>
|
|
96
|
+
|
|
97
|
+
<MenuButton selected icon={<SettingsIcon />}>
|
|
98
|
+
Settings
|
|
99
|
+
</MenuButton>
|
|
100
|
+
|
|
101
|
+
<MenuButton small>Inventory</MenuButton>
|
|
102
|
+
|
|
103
|
+
<MenuButton disabled>Coming Soon</MenuButton>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Loader
|
|
107
|
+
|
|
108
|
+
```tsx
|
|
109
|
+
<Loader size="sm" />
|
|
110
|
+
<Loader size="md" />
|
|
111
|
+
<Loader size="lg" />
|
|
112
|
+
|
|
113
|
+
<Button loading>Saving</Button>
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Icons
|
|
117
|
+
|
|
118
|
+
```tsx
|
|
119
|
+
<SearchIcon />
|
|
120
|
+
|
|
121
|
+
<MenuButton icon={<GraduationCapIcon />}>Training</MenuButton>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Tokens In Styled Components
|
|
125
|
+
|
|
126
|
+
```tsx
|
|
127
|
+
import styled from 'styled-components';
|
|
128
|
+
import { colors, fontSizes, radius, spacing } from 'mbt-ui-kit/tokens';
|
|
129
|
+
|
|
130
|
+
export const Card = styled.div`
|
|
131
|
+
display: grid;
|
|
132
|
+
gap: ${spacing[3]};
|
|
133
|
+
padding: ${spacing[5]};
|
|
134
|
+
border-radius: ${radius.md};
|
|
135
|
+
background: ${colors.surface};
|
|
136
|
+
color: ${colors.textPrimary};
|
|
137
|
+
font-size: ${fontSizes[3]};
|
|
138
|
+
`;
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Token-Only Import
|
|
142
|
+
|
|
143
|
+
```tsx
|
|
144
|
+
import { colors, spacing, transitions } from 'mbt-ui-kit/tokens';
|
|
145
|
+
|
|
146
|
+
const panelStyle = {
|
|
147
|
+
backgroundColor: colors.surfaceRaised,
|
|
148
|
+
padding: spacing[4],
|
|
149
|
+
transition: `opacity ${transitions.fast}`,
|
|
150
|
+
};
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## CSS Custom Properties
|
|
154
|
+
|
|
155
|
+
```tsx
|
|
156
|
+
import 'mbt-ui-kit/tokens.css';
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
```css
|
|
160
|
+
.panel {
|
|
161
|
+
background-color: var(--mbt-color-surface);
|
|
162
|
+
color: var(--mbt-color-text-primary);
|
|
163
|
+
padding: var(--mbt-space-4);
|
|
164
|
+
border-radius: var(--mbt-radius-sm);
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Sass Tokens
|
|
169
|
+
|
|
170
|
+
```scss
|
|
171
|
+
@use 'mbt-ui-kit/src/styles/tokens' as *;
|
|
172
|
+
|
|
173
|
+
.panel {
|
|
174
|
+
background-color: $surface;
|
|
175
|
+
color: $text-primary;
|
|
176
|
+
padding: $space-4;
|
|
177
|
+
border-radius: $radius-sm;
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Guidance
|
|
182
|
+
|
|
183
|
+
- Prefer nearby consumer-app usage before inventing a new composition pattern.
|
|
184
|
+
- Prefer public package entrypoints over deep imports, except for the published Sass token path.
|
|
185
|
+
- Keep app-specific layout decisions in the consumer app; keep package examples focused on reusable component and token usage.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Agent Reference
|
|
2
|
+
|
|
3
|
+
This folder holds factual package reference for `mbt-ui-kit`.
|
|
4
|
+
|
|
5
|
+
## Public Entry Points
|
|
6
|
+
|
|
7
|
+
- `mbt-ui-kit` - components plus token exports from `src/index.ts`
|
|
8
|
+
- `mbt-ui-kit/styles` - built package stylesheet, including the package font-face declarations
|
|
9
|
+
- `mbt-ui-kit/fonts.css` - standalone font-face stylesheet for advanced consumer setup
|
|
10
|
+
- `mbt-ui-kit/fonts/*` - published font asset files for preload or direct asset access
|
|
11
|
+
- `mbt-ui-kit/tokens` - token-only module surface
|
|
12
|
+
- `mbt-ui-kit/tokens.css` - CSS custom properties surface
|
|
13
|
+
- `mbt-ui-kit/src/styles/tokens` - published Sass token surface for Sass consumers
|
|
14
|
+
|
|
15
|
+
## Font Contract
|
|
16
|
+
|
|
17
|
+
- `fonts.primary` maps to `IBM Plex Sans`
|
|
18
|
+
- `fonts.secondary` maps to `Inter`
|
|
19
|
+
- `fonts.mono` maps to `IBM Plex Mono`
|
|
20
|
+
- importing `mbt-ui-kit/styles` is the default way to make those package fonts available in a consumer app
|
|
21
|
+
- importing `mbt-ui-kit/fonts.css` is an advanced alternative for apps that want font-face declarations without the full package stylesheet
|
|
22
|
+
- importing `mbt-ui-kit/fonts/*` is for direct asset access, such as preload tags in the consumer app shell
|
|
23
|
+
|
|
24
|
+
## Primary Components
|
|
25
|
+
|
|
26
|
+
- `Button`
|
|
27
|
+
- `Input`
|
|
28
|
+
- `Loader`
|
|
29
|
+
- `Heading`
|
|
30
|
+
- `Text`
|
|
31
|
+
- `Metric`
|
|
32
|
+
- `MenuButton`
|
|
33
|
+
- `GraduationCapIcon`
|
|
34
|
+
- `SearchIcon`
|
|
35
|
+
|
|
36
|
+
## Primary Token Families
|
|
37
|
+
|
|
38
|
+
- `tokens`
|
|
39
|
+
- `colors`
|
|
40
|
+
- `fonts`
|
|
41
|
+
- `fontSizes`
|
|
42
|
+
- `fontWeights`
|
|
43
|
+
- `fontFeatures`
|
|
44
|
+
- `spacing`
|
|
45
|
+
- `radius`
|
|
46
|
+
- `zIndex`
|
|
47
|
+
- `transitions`
|
|
48
|
+
|
|
49
|
+
Reference docs should stay factual. Policy and maintenance rules belong in `.ai/agent-rules/`.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Agent Rules
|
|
2
|
+
|
|
3
|
+
These files are the canonical package-owned rules for `mbt-ui-kit`.
|
|
4
|
+
|
|
5
|
+
## Rule Map
|
|
6
|
+
|
|
7
|
+
- `.ai/agent-rules/README.md` - normative usage rules for imports, components, styling, and tokens.
|
|
8
|
+
- `.ai/agent-rules/maintenance.md` - required rule for keeping package guidance in sync with public changes.
|
|
9
|
+
|
|
10
|
+
## Usage Rules
|
|
11
|
+
|
|
12
|
+
- Import components and tokens from public package entrypoints only.
|
|
13
|
+
- Prefer an existing `mbt-ui-kit` component before creating a new primitive in a consumer app.
|
|
14
|
+
- Prefer exported design tokens over hardcoded near-duplicate values.
|
|
15
|
+
- Use kebab-case for file names and folder names across this repo.
|
|
16
|
+
- Use `pnpm` as the package manager for this repo and keep a single lockfile.
|
|
17
|
+
- Use `mbt-ui-kit/styles` once at the app shell when the consumer app wants the package styles loaded globally.
|
|
18
|
+
- Treat `mbt-ui-kit/styles` as the default entrypoint for package styles and font-face declarations.
|
|
19
|
+
- Use `mbt-ui-kit/fonts.css` only when the consumer intentionally wants the package font-face declarations without the full styles bundle.
|
|
20
|
+
- Use `mbt-ui-kit/fonts/*` only when the consumer intentionally wants direct font-file access for preload or asset orchestration.
|
|
21
|
+
- Use `mbt-ui-kit/tokens` for token access when the consumer wants the token module surface.
|
|
22
|
+
- Use `mbt-ui-kit/tokens.css` when the consumer explicitly wants only the CSS custom properties stylesheet.
|
|
23
|
+
- Use `mbt-ui-kit/src/styles/tokens` for Sass extension workflows that intentionally depend on the published Sass token surface.
|
|
24
|
+
- Keep examples and rules package-focused; app-specific composition rules belong in the consuming app, not here.
|
|
25
|
+
|
|
26
|
+
## Component Guidance
|
|
27
|
+
|
|
28
|
+
- Use `Button` for shared button behavior instead of recreating button primitives.
|
|
29
|
+
- Use `Input` for labeled text inputs and search-style input affordances.
|
|
30
|
+
- Use `Heading`, `Text`, and `Metric` for typography when the consumer wants the package typography primitives.
|
|
31
|
+
- Use `MenuButton` for sidebar or navigation-style button treatments, not as a generic replacement for every button.
|
|
32
|
+
- Use `Loader` for package-consistent loading states.
|
|
33
|
+
|
|
34
|
+
## Token Guidance
|
|
35
|
+
|
|
36
|
+
- Preferred token families are `colors`, `fonts`, `fontSizes`, `fontWeights`, `fontFeatures`, `spacing`, `radius`, `zIndex`, and `transitions`.
|
|
37
|
+
- When a consumer needs a custom value outside the token system, keep the exception local to that consumer instead of expanding package docs with app-only design rules.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Maintenance Rule
|
|
2
|
+
|
|
3
|
+
Agents working in `mbt-ui-kit` must review and update package guidance whenever a change affects public behavior.
|
|
4
|
+
|
|
5
|
+
## Update The Docs When
|
|
6
|
+
|
|
7
|
+
- component props or defaults change
|
|
8
|
+
- exported components are added, removed, or renamed
|
|
9
|
+
- token names or token values change in a way that affects usage
|
|
10
|
+
- package entrypoints or import paths change
|
|
11
|
+
- style-loading expectations change
|
|
12
|
+
- font asset paths, exported font entrypoints, or font-loading expectations change
|
|
13
|
+
- canonical examples need to change to stay correct
|
|
14
|
+
|
|
15
|
+
## Required Files To Review
|
|
16
|
+
|
|
17
|
+
- `AGENTS.md`
|
|
18
|
+
- `.ai/agent-rules/README.md`
|
|
19
|
+
- `.ai/agent-reference/README.md`
|
|
20
|
+
- `.ai/agent-examples/README.md`
|
|
21
|
+
|
|
22
|
+
Do not finish public package work without reviewing these files.
|
package/AGENTS.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
- `mbt-ui-kit` is the shared React design-system package for MBT apps.
|
|
6
|
+
- This repo owns the canonical agent guidance for how to use the package.
|
|
7
|
+
- Consumer apps should read the installed package docs from `node_modules/mbt-ui-kit/...`.
|
|
8
|
+
|
|
9
|
+
## Package Name
|
|
10
|
+
|
|
11
|
+
- npm package: `mbt-ui-kit`
|
|
12
|
+
- public entrypoints: `mbt-ui-kit`, `mbt-ui-kit/styles`, `mbt-ui-kit/fonts.css`, `mbt-ui-kit/fonts/*`, `mbt-ui-kit/tokens`, `mbt-ui-kit/tokens.css`
|
|
13
|
+
- published Sass token path: `mbt-ui-kit/src/styles/tokens`
|
|
14
|
+
|
|
15
|
+
## Read This First
|
|
16
|
+
|
|
17
|
+
1. `.ai/agent-rules/README.md`
|
|
18
|
+
2. `.ai/agent-rules/maintenance.md`
|
|
19
|
+
3. `.ai/agent-reference/README.md`
|
|
20
|
+
4. `.ai/agent-examples/README.md`
|
|
21
|
+
|
|
22
|
+
## Guidance Map
|
|
23
|
+
|
|
24
|
+
- `.ai/agent-rules/README.md` - package-owned usage rules, imports, styling boundaries, and token expectations.
|
|
25
|
+
- `.ai/agent-rules/maintenance.md` - required doc-sync rule when public usage changes.
|
|
26
|
+
- `.ai/agent-reference/README.md` - exported surfaces and lookup map.
|
|
27
|
+
- `.ai/agent-examples/README.md` - short canonical examples for common components and tokens.
|
|
28
|
+
|
|
29
|
+
## Maintenance Rule
|
|
30
|
+
|
|
31
|
+
- If a change affects public components, props, tokens, styles, font assets, exports, or expected usage, update the guidance docs before considering the work complete.
|
|
32
|
+
|
|
33
|
+
## Guardrails
|
|
34
|
+
|
|
35
|
+
- Document only public package behavior here.
|
|
36
|
+
- Prefer public entrypoints over deep source imports in examples, except for the published Sass token path.
|
|
37
|
+
- Treat `mbt-ui-kit/styles` as the default consumer entrypoint for loading package styles and font-face declarations.
|
|
38
|
+
- Treat `mbt-ui-kit/fonts.css` and `mbt-ui-kit/fonts/*` as advanced consumer entrypoints for apps that intentionally preload or separately stage package fonts.
|
|
39
|
+
- Use kebab-case for file names and folder names across this repo.
|
|
40
|
+
- Use `pnpm` as the package manager for this repo.
|
|
41
|
+
- Keep Storybook as maintainer reference material, not the canonical consumer contract.
|
package/README.md
CHANGED
|
@@ -1,160 +1,240 @@
|
|
|
1
1
|
# MBT UI Kit
|
|
2
2
|
|
|
3
|
-
React
|
|
3
|
+
Reusable React UI primitives, typography, and design tokens for MBT applications.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
|
|
9
|
-
# или
|
|
10
|
-
bun install mbt-ui-kit
|
|
8
|
+
pnpm add mbt-ui-kit
|
|
11
9
|
```
|
|
12
10
|
|
|
13
|
-
##
|
|
11
|
+
## Package Surfaces
|
|
12
|
+
|
|
13
|
+
- `mbt-ui-kit` - components plus token exports
|
|
14
|
+
- `mbt-ui-kit/styles` - package stylesheet, including package font-face declarations
|
|
15
|
+
- `mbt-ui-kit/fonts.css` - standalone package font-face stylesheet
|
|
16
|
+
- `mbt-ui-kit/fonts/*` - published package font files
|
|
17
|
+
- `mbt-ui-kit/tokens` - token module surface
|
|
18
|
+
- `mbt-ui-kit/tokens.css` - CSS custom properties
|
|
19
|
+
- `mbt-ui-kit/src/styles/tokens` - published Sass token surface
|
|
20
|
+
|
|
21
|
+
## Agent Guidance
|
|
22
|
+
|
|
23
|
+
- `AGENTS.md` is the package entrypoint for coding agents.
|
|
24
|
+
- Canonical rules live in `.ai/agent-rules/`.
|
|
25
|
+
- Factual reference lives in `.ai/agent-reference/`.
|
|
26
|
+
- Canonical usage examples live in `.ai/agent-examples/`.
|
|
27
|
+
|
|
28
|
+
## Quick Start
|
|
14
29
|
|
|
15
30
|
```tsx
|
|
16
|
-
import { Button, Input } from
|
|
17
|
-
import
|
|
31
|
+
import { Button, Heading, Input, Text } from 'mbt-ui-kit';
|
|
32
|
+
import 'mbt-ui-kit/styles';
|
|
18
33
|
|
|
19
|
-
function
|
|
34
|
+
function ProfileForm() {
|
|
20
35
|
return (
|
|
21
36
|
<div>
|
|
22
|
-
<
|
|
23
|
-
<
|
|
37
|
+
<Heading level={2}>Profile</Heading>
|
|
38
|
+
<Text muted>Update your account details.</Text>
|
|
39
|
+
<Input label="Email" placeholder="name@example.com" fullWidth />
|
|
40
|
+
<Button type="button">Save</Button>
|
|
24
41
|
</div>
|
|
25
42
|
);
|
|
26
43
|
}
|
|
27
44
|
```
|
|
28
45
|
|
|
29
|
-
|
|
46
|
+
### Font loading in consumer app
|
|
30
47
|
|
|
31
|
-
|
|
32
|
-
Кнопка с тремя состояниями: default, hover, disabled.
|
|
48
|
+
Default setup: import `mbt-ui-kit/styles` once at the app shell. This already loads the package font-face declarations.
|
|
33
49
|
|
|
34
50
|
```tsx
|
|
35
|
-
|
|
36
|
-
<Button disabled>Start</Button>
|
|
37
|
-
<Button fullWidth>Start</Button>
|
|
51
|
+
import 'mbt-ui-kit/styles';
|
|
38
52
|
```
|
|
39
53
|
|
|
40
|
-
|
|
41
|
-
Текстовое поле с label и опциональной иконкой.
|
|
54
|
+
Advanced setup: if the consumer app wants better first paint for package fonts used immediately, preload selected files from `mbt-ui-kit/fonts/*` in the app shell.
|
|
42
55
|
|
|
43
56
|
```tsx
|
|
44
|
-
|
|
45
|
-
<Input label="Label" placeholder="text_input" muted />
|
|
46
|
-
<Input placeholder="text_input" fullWidth />
|
|
57
|
+
import 'mbt-ui-kit/styles';
|
|
47
58
|
```
|
|
48
59
|
|
|
49
|
-
|
|
50
|
-
Компоненты для заголовков, текста и метрик.
|
|
60
|
+
Example with bundler-resolved asset URLs:
|
|
51
61
|
|
|
52
62
|
```tsx
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
63
|
+
import plexSansRegularUrl from 'mbt-ui-kit/fonts/ibm-plex-sans-v23-latin-regular.woff2';
|
|
64
|
+
import plexSansMediumUrl from 'mbt-ui-kit/fonts/ibm-plex-sans-v23-latin-500.woff2';
|
|
65
|
+
import plexSansSemiboldUrl from 'mbt-ui-kit/fonts/ibm-plex-sans-v23-latin-600.woff2';
|
|
66
|
+
import interVariableUrl from 'mbt-ui-kit/fonts/Inter-VariableFont_opsz,wght.ttf';
|
|
67
|
+
import interItalicVariableUrl from 'mbt-ui-kit/fonts/Inter-Italic-VariableFont_opsz,wght.ttf';
|
|
68
|
+
import plexMonoRegularUrl from 'mbt-ui-kit/fonts/ibm-plex-mono-v20-latin-regular.woff2';
|
|
69
|
+
import plexMonoMediumUrl from 'mbt-ui-kit/fonts/ibm-plex-mono-v20-latin-500.woff2';
|
|
70
|
+
import plexMonoSemiboldUrl from 'mbt-ui-kit/fonts/ibm-plex-mono-v20-latin-600.woff2';
|
|
71
|
+
|
|
72
|
+
const preloadFonts = [
|
|
73
|
+
plexSansRegularUrl,
|
|
74
|
+
plexSansMediumUrl,
|
|
75
|
+
plexSansSemiboldUrl,
|
|
76
|
+
interVariableUrl,
|
|
77
|
+
interItalicVariableUrl,
|
|
78
|
+
plexMonoRegularUrl,
|
|
79
|
+
plexMonoMediumUrl,
|
|
80
|
+
plexMonoSemiboldUrl,
|
|
81
|
+
];
|
|
57
82
|
```
|
|
58
83
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
84
|
+
Example preload tags:
|
|
85
|
+
|
|
86
|
+
```html
|
|
87
|
+
<link
|
|
88
|
+
rel="preload"
|
|
89
|
+
href="...resolved IBM Plex Sans 400 url..."
|
|
90
|
+
as="font"
|
|
91
|
+
type="font/woff2"
|
|
92
|
+
crossorigin
|
|
93
|
+
/>
|
|
94
|
+
<link
|
|
95
|
+
rel="preload"
|
|
96
|
+
href="...resolved IBM Plex Sans 500 url..."
|
|
97
|
+
as="font"
|
|
98
|
+
type="font/woff2"
|
|
99
|
+
crossorigin
|
|
100
|
+
/>
|
|
101
|
+
<link
|
|
102
|
+
rel="preload"
|
|
103
|
+
href="...resolved IBM Plex Sans 600 url..."
|
|
104
|
+
as="font"
|
|
105
|
+
type="font/woff2"
|
|
106
|
+
crossorigin
|
|
107
|
+
/>
|
|
108
|
+
<link
|
|
109
|
+
rel="preload"
|
|
110
|
+
href="...resolved Inter variable url..."
|
|
111
|
+
as="font"
|
|
112
|
+
type="font/ttf"
|
|
113
|
+
crossorigin
|
|
114
|
+
/>
|
|
115
|
+
<link
|
|
116
|
+
rel="preload"
|
|
117
|
+
href="...resolved Inter italic variable url..."
|
|
118
|
+
as="font"
|
|
119
|
+
type="font/ttf"
|
|
120
|
+
crossorigin
|
|
121
|
+
/>
|
|
122
|
+
<link
|
|
123
|
+
rel="preload"
|
|
124
|
+
href="...resolved IBM Plex Mono 400 url..."
|
|
125
|
+
as="font"
|
|
126
|
+
type="font/woff2"
|
|
127
|
+
crossorigin
|
|
128
|
+
/>
|
|
129
|
+
<link
|
|
130
|
+
rel="preload"
|
|
131
|
+
href="...resolved IBM Plex Mono 500 url..."
|
|
132
|
+
as="font"
|
|
133
|
+
type="font/woff2"
|
|
134
|
+
crossorigin
|
|
135
|
+
/>
|
|
136
|
+
<link
|
|
137
|
+
rel="preload"
|
|
138
|
+
href="...resolved IBM Plex Mono 600 url..."
|
|
139
|
+
as="font"
|
|
140
|
+
type="font/woff2"
|
|
141
|
+
crossorigin
|
|
142
|
+
/>
|
|
66
143
|
```
|
|
67
144
|
|
|
68
|
-
|
|
145
|
+
The library publishes the font files in `dist/fonts/`, exposes them under `mbt-ui-kit/fonts/*`, and ships matching declarations in both `mbt-ui-kit/styles` and `mbt-ui-kit/fonts.css`, including both normal and italic Inter variable fonts.
|
|
69
146
|
|
|
70
|
-
|
|
71
|
-
# Установка зависимостей
|
|
72
|
-
bun install
|
|
147
|
+
Use `mbt-ui-kit/fonts.css` only when the consumer intentionally wants the font-face declarations without the full package stylesheet. Most apps should import `mbt-ui-kit/styles` only.
|
|
73
148
|
|
|
74
|
-
|
|
75
|
-
bun storybook
|
|
149
|
+
## Components
|
|
76
150
|
|
|
77
|
-
|
|
78
|
-
bun run build
|
|
151
|
+
Primary exports include:
|
|
79
152
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
153
|
+
- `Button`
|
|
154
|
+
- `Input`
|
|
155
|
+
- `Loader`
|
|
156
|
+
- `Heading`
|
|
157
|
+
- `Text`
|
|
158
|
+
- `Metric`
|
|
159
|
+
- `MenuButton`
|
|
160
|
+
- `SearchIcon`
|
|
161
|
+
- `GraduationCapIcon`
|
|
84
162
|
|
|
85
|
-
|
|
163
|
+
For richer package examples, use `.ai/agent-examples/README.md`.
|
|
86
164
|
|
|
87
|
-
|
|
165
|
+
## Design Tokens
|
|
88
166
|
|
|
89
|
-
###
|
|
167
|
+
### TypeScript or JavaScript
|
|
90
168
|
|
|
91
|
-
|
|
92
|
-
```tsx
|
|
93
|
-
import { tokens, colors, spacing, radius } from "mbt-ui-kit/tokens";
|
|
94
|
-
|
|
95
|
-
const MyComponent = () => (
|
|
96
|
-
<div style={{
|
|
97
|
-
backgroundColor: colors.primary,
|
|
98
|
-
padding: spacing[4],
|
|
99
|
-
borderRadius: radius.sm
|
|
100
|
-
}}>
|
|
101
|
-
Content
|
|
102
|
-
</div>
|
|
103
|
-
);
|
|
104
|
-
```
|
|
169
|
+
Use token exports for inline styles, styled-components, or utility layers.
|
|
105
170
|
|
|
106
|
-
Или из основного пакета:
|
|
107
171
|
```tsx
|
|
108
|
-
import { colors, spacing,
|
|
172
|
+
import { colors, fontSizes, radius, spacing, tokens } from 'mbt-ui-kit/tokens';
|
|
173
|
+
|
|
174
|
+
const panelStyle = {
|
|
175
|
+
backgroundColor: colors.surface,
|
|
176
|
+
color: colors.textPrimary,
|
|
177
|
+
padding: spacing[5],
|
|
178
|
+
borderRadius: radius.md,
|
|
179
|
+
fontSize: fontSizes[3],
|
|
180
|
+
};
|
|
109
181
|
```
|
|
110
182
|
|
|
111
|
-
|
|
112
|
-
- `colors` — цветовая палитра
|
|
113
|
-
- `fonts` — семейства шрифтов
|
|
114
|
-
- `fontSizes` — размеры текста
|
|
115
|
-
- `fontWeights` — начертания шрифтов
|
|
116
|
-
- `spacing` — отступы и размеры
|
|
117
|
-
- `radius` — радиусы скругления
|
|
118
|
-
- `zIndex` — z-индексы
|
|
119
|
-
- `transitions` — анимации
|
|
183
|
+
Available token groups:
|
|
120
184
|
|
|
121
|
-
|
|
185
|
+
- `tokens`
|
|
186
|
+
- `colors`
|
|
187
|
+
- `fonts`
|
|
188
|
+
- `fontSizes`
|
|
189
|
+
- `fontWeights`
|
|
190
|
+
- `fontFeatures`
|
|
191
|
+
- `spacing`
|
|
192
|
+
- `radius`
|
|
193
|
+
- `zIndex`
|
|
194
|
+
- `transitions`
|
|
195
|
+
|
|
196
|
+
### CSS Custom Properties
|
|
122
197
|
|
|
123
|
-
Импорт CSS переменных:
|
|
124
198
|
```tsx
|
|
125
|
-
import
|
|
199
|
+
import 'mbt-ui-kit/tokens.css';
|
|
126
200
|
```
|
|
127
201
|
|
|
128
|
-
Использование в CSS/SCSS:
|
|
129
202
|
```css
|
|
130
|
-
.
|
|
131
|
-
background-color: var(--mbt-color-
|
|
203
|
+
.panel {
|
|
204
|
+
background-color: var(--mbt-color-surface);
|
|
205
|
+
color: var(--mbt-color-text-primary);
|
|
132
206
|
padding: var(--mbt-space-4);
|
|
133
207
|
border-radius: var(--mbt-radius-sm);
|
|
134
|
-
font-family: var(--mbt-font-primary);
|
|
135
208
|
transition: all var(--mbt-transition-fast);
|
|
136
209
|
}
|
|
137
210
|
```
|
|
138
211
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
### 3. SCSS Variables (для расширения библиотеки)
|
|
212
|
+
### Sass Tokens
|
|
142
213
|
|
|
143
214
|
```scss
|
|
144
|
-
@use
|
|
215
|
+
@use 'mbt-ui-kit/src/styles/tokens' as *;
|
|
145
216
|
|
|
146
|
-
.
|
|
147
|
-
background-color: $
|
|
217
|
+
.panel {
|
|
218
|
+
background-color: $surface;
|
|
219
|
+
color: $text-primary;
|
|
148
220
|
padding: $space-4;
|
|
149
221
|
border-radius: $radius-sm;
|
|
150
|
-
font-family: $font-ui-primary;
|
|
151
222
|
}
|
|
152
223
|
```
|
|
153
224
|
|
|
154
|
-
##
|
|
225
|
+
## Development
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
pnpm install
|
|
229
|
+
pnpm build
|
|
230
|
+
pnpm lint
|
|
231
|
+
pnpm format
|
|
232
|
+
pnpm storybook
|
|
233
|
+
```
|
|
155
234
|
|
|
156
|
-
|
|
235
|
+
This repo standardizes on `pnpm` only.
|
|
157
236
|
|
|
158
|
-
##
|
|
237
|
+
## Notes
|
|
159
238
|
|
|
160
|
-
|
|
239
|
+
- Storybook is maintainer-facing visual coverage, not the canonical package contract.
|
|
240
|
+
- Package-owned agent guidance is versioned with the library and published with the package.
|