mbt-ui-kit 0.1.15 → 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 +162 -127
- 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/Inter-Italic-VariableFont_opsz,wght.ttf +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 +23 -14
- 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-only.d.ts +3 -8
- package/dist/tokens-only.d.ts.map +1 -1
- package/package.json +22 -9
- 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.
|