|
| 1 | +# @codebar-ag/flows |
| 2 | + |
| 3 | +Shared **Vue 3 + Tailwind v4** design-system atoms and design tokens for codebar-ag |
| 4 | +applications, documented in **Storybook**. One source of truth so every app looks |
| 5 | +identical. |
| 6 | + |
| 7 | +> **Atoms only.** This package ships the basic building blocks (button, card, |
| 8 | +> table, badge, form fields, dropdown, icon, list-row, metric, alert…) and the |
| 9 | +> design tokens. Composite, domain-specific "organisms" (billing panels, instance |
| 10 | +> rows, …) live in each consuming app — but they must be assembled **only** from |
| 11 | +> these atoms, never from raw HTML elements. |
| 12 | +
|
| 13 | +## Install |
| 14 | + |
| 15 | +The package is published to **GitHub Packages**. Add an `.npmrc` to the consuming app: |
| 16 | + |
| 17 | +``` |
| 18 | +@codebar-ag:registry=https://npm.pkg.github.com |
| 19 | +//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN} |
| 20 | +``` |
| 21 | + |
| 22 | +```bash |
| 23 | +npm install @codebar-ag/flows |
| 24 | +``` |
| 25 | + |
| 26 | +## Use |
| 27 | + |
| 28 | +**1. Tokens + Tailwind** — in your app's `app.css`: |
| 29 | + |
| 30 | +```css |
| 31 | +@import "@codebar-ag/flows/tokens.css"; /* @theme: colors, type scale, radius */ |
| 32 | +@import "tailwindcss"; |
| 33 | +@source "../../node_modules/@codebar-ag/flows/dist"; /* scan atoms for classes */ |
| 34 | +``` |
| 35 | + |
| 36 | +The `@source` line is required: Tailwind must scan the compiled atoms so their |
| 37 | +utility classes are generated in your app's stylesheet. |
| 38 | + |
| 39 | +**2. Register the atoms** — in your Vue entry: |
| 40 | + |
| 41 | +```ts |
| 42 | +import { Flows } from '@codebar-ag/flows'; |
| 43 | +createApp(...).use(Flows); // global <Button>, <Card>, <Icon>, … |
| 44 | +``` |
| 45 | + |
| 46 | +Or import individually: |
| 47 | + |
| 48 | +```ts |
| 49 | +import { Button, Card, useToast } from '@codebar-ag/flows'; |
| 50 | +``` |
| 51 | + |
| 52 | +**3. Toasts** — mount `<Toaster />` once near the root, then `push()` from anywhere: |
| 53 | + |
| 54 | +```ts |
| 55 | +import { pushToast } from '@codebar-ag/flows'; |
| 56 | +pushToast({ message: 'Saved.', type: 'success' }); |
| 57 | +``` |
| 58 | + |
| 59 | +## Develop |
| 60 | + |
| 61 | +```bash |
| 62 | +npm install |
| 63 | +npm run dev # Storybook on :6006 (the styleguide) |
| 64 | +npm run build # library build → dist/ (ESM + types + tokens.css) |
| 65 | +npm run build-storybook # static styleguide → storybook-static/ |
| 66 | +npm run typecheck # vue-tsc |
| 67 | +npm run lint |
| 68 | +``` |
| 69 | + |
| 70 | +## License |
| 71 | + |
| 72 | +MIT © codebar Solutions AG |
0 commit comments