@almeidinha/mf-ui 2.0.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/LICENSE +21 -0
- package/README.md +149 -0
- package/dist/flags-large-32-O3VQGXOM.png +0 -0
- package/dist/flags-medium-32-ICGJ7AMM.png +0 -0
- package/dist/flags-small-32-SRYQIJGQ.png +0 -0
- package/dist/index.d.mts +3204 -0
- package/dist/index.d.ts +3204 -0
- package/dist/index.js +24655 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +24634 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +111 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Marcos Almeida
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# mf-ui-library
|
|
2
|
+
|
|
3
|
+
A small React design system / UI component library I use across BI projects.
|
|
4
|
+
|
|
5
|
+
It’s built as a **library** (not an app): you develop and preview components in Storybook, and publish a bundled output (ESM + CJS + typings) from `dist/`.
|
|
6
|
+
|
|
7
|
+
## Tech stack
|
|
8
|
+
|
|
9
|
+
- **React + TypeScript**
|
|
10
|
+
- **styled-components v6** (peer dependency)
|
|
11
|
+
- **Build**: `tsup` (outputs ESM + CJS + `.d.ts`)
|
|
12
|
+
- **Docs / playground**: Storybook (Vite)
|
|
13
|
+
- **Tests**: Vitest (jsdom) + Testing Library
|
|
14
|
+
- **Storybook tests**: `@storybook/addon-vitest` + Playwright (headless browser)
|
|
15
|
+
- **Quality**: ESLint + `tsc` + Prettier
|
|
16
|
+
|
|
17
|
+
## Architecture
|
|
18
|
+
|
|
19
|
+
The code lives under `src/`:
|
|
20
|
+
|
|
21
|
+
- `src/foundation/` — design tokens (colors, spacing, typography, shadows)
|
|
22
|
+
- `src/components/` — UI components (atoms → molecules → organisms)
|
|
23
|
+
- `src/hooks/` — reusable React hooks
|
|
24
|
+
- `src/helpers/` — shared utility functions/types
|
|
25
|
+
- `src/theme/` — theme helpers (currently internal)
|
|
26
|
+
|
|
27
|
+
### Public API (what the package exports)
|
|
28
|
+
|
|
29
|
+
The library’s **single entry point** is `src/index.ts` (configured in `tsup.config.ts`).
|
|
30
|
+
|
|
31
|
+
The package root currently exports:
|
|
32
|
+
|
|
33
|
+
- `components/`
|
|
34
|
+
- `foundation/`
|
|
35
|
+
- `hooks/`
|
|
36
|
+
- `theme/`
|
|
37
|
+
|
|
38
|
+
Helpers remain internal to the repo and are not part of the public package API.
|
|
39
|
+
|
|
40
|
+
### Internal path aliases
|
|
41
|
+
|
|
42
|
+
The source uses TypeScript path aliases (e.g. `@foundations`, `@helpers`, `components/...`) for local development. Those are resolved at build time.
|
|
43
|
+
|
|
44
|
+
## Development guide
|
|
45
|
+
|
|
46
|
+
### Prerequisites
|
|
47
|
+
|
|
48
|
+
- Node.js installed (recommended: `nvm`, this repo includes a `.nvmrc`)
|
|
49
|
+
- `pnpm` (this repo pins a `packageManager` version in `package.json`)
|
|
50
|
+
|
|
51
|
+
If you use `nvm`:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
nvm install
|
|
55
|
+
nvm use
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Install
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pnpm install
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Build (library output)
|
|
65
|
+
|
|
66
|
+
Builds `dist/` (ESM + CJS + source maps + TypeScript declarations):
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pnpm build
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Watch mode (dev build)
|
|
73
|
+
|
|
74
|
+
Continuously rebuilds `dist/` on changes:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pnpm dev
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Run Storybook (component playground)
|
|
81
|
+
|
|
82
|
+
Starts Storybook on port `6006`:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
pnpm storybook
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Build static Storybook:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
pnpm build-storybook
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Testing
|
|
95
|
+
|
|
96
|
+
### Unit tests
|
|
97
|
+
|
|
98
|
+
Runs unit tests (Vitest “unit” project):
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
pnpm test
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Storybook tests
|
|
105
|
+
|
|
106
|
+
Runs Storybook-linked tests in a headless browser (Vitest “storybook” project):
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
pnpm test:storybook
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
First run may require installing Playwright browsers:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
pnpm playwright install
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Linting & formatting
|
|
119
|
+
|
|
120
|
+
Typecheck + ESLint:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
pnpm lint
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Auto-fix ESLint + format:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
pnpm lint:fix
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Format only:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
pnpm lint:format
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Example (using foundation tokens)
|
|
139
|
+
|
|
140
|
+
```tsx
|
|
141
|
+
import styled from "styled-components";
|
|
142
|
+
import { Borders, Padding, Surface } from "@almeidinha/mfui";
|
|
143
|
+
|
|
144
|
+
export const Panel = styled.div`
|
|
145
|
+
background: ${Surface.Default.Default};
|
|
146
|
+
border: 1px solid ${Borders.Default.Subdued};
|
|
147
|
+
padding: ${Padding.m};
|
|
148
|
+
`;
|
|
149
|
+
```
|
|
Binary file
|
|
Binary file
|
|
Binary file
|