@aleph-alpha/ui-library 1.0.0 → 1.2.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 +138 -5
- package/config.d.ts +11 -0
- package/config.js +18 -0
- package/dist/system/index.d.ts +749 -77
- package/dist/system/lib.js +8566 -4612
- package/package.json +16 -3
package/README.md
CHANGED
|
@@ -1,11 +1,137 @@
|
|
|
1
1
|
# UI Library
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
📘 **[View Storybook](https://urban-broccoli-l1okew7.pages.github.io/ui-library)**
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @aleph-alpha/ui-library
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### Required Peer Dependencies
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm add -D unocss @unocss/preset-wind4 @unocss/reset unocss-preset-animations unocss-preset-shadcn
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
### 1. Configure UnoCSS
|
|
20
|
+
|
|
21
|
+
The library exports a helper function `getUiLibraryContentConfig()` to simplify UnoCSS configuration:
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
// uno.config.ts
|
|
25
|
+
import { defineConfig } from 'unocss'
|
|
26
|
+
import { getUiLibraryContentConfig } from '@aleph-alpha/ui-library/config'
|
|
27
|
+
import presetWind from '@unocss/preset-wind4'
|
|
28
|
+
import presetAnimations from 'unocss-preset-animations'
|
|
29
|
+
import presetShadcn from 'unocss-preset-shadcn'
|
|
30
|
+
|
|
31
|
+
export default defineConfig({
|
|
32
|
+
...getUiLibraryContentConfig(),
|
|
33
|
+
presets: [
|
|
34
|
+
presetWind(),
|
|
35
|
+
presetAnimations(),
|
|
36
|
+
presetShadcn({ color: 'neutral' }),
|
|
37
|
+
],
|
|
38
|
+
})
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 2. Configure Vite
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
// vite.config.ts
|
|
45
|
+
import { defineConfig } from 'vite'
|
|
46
|
+
import vue from '@vitejs/plugin-vue'
|
|
47
|
+
import UnoCSS from 'unocss/vite'
|
|
48
|
+
|
|
49
|
+
export default defineConfig({
|
|
50
|
+
plugins: [vue(), UnoCSS()],
|
|
51
|
+
})
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 3. Import Styles
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
// main.ts
|
|
58
|
+
import '@unocss/reset/tailwind.css'
|
|
59
|
+
import 'virtual:uno.css'
|
|
60
|
+
|
|
61
|
+
import { createApp } from 'vue'
|
|
62
|
+
import App from './App.vue'
|
|
63
|
+
|
|
64
|
+
createApp(App).mount('#app')
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 4. Use Components
|
|
68
|
+
|
|
69
|
+
```vue
|
|
70
|
+
<script setup lang="ts">
|
|
71
|
+
import { UiButton, UiBadge } from '@aleph-alpha/ui-library'
|
|
72
|
+
</script>
|
|
73
|
+
|
|
74
|
+
<template>
|
|
75
|
+
<UiButton>Click me</UiButton>
|
|
76
|
+
<UiBadge variant="secondary">New</UiBadge>
|
|
77
|
+
</template>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Using with @aleph-alpha/ds-components-vue
|
|
81
|
+
|
|
82
|
+
If you're using both `ui-library` and `ds-components-vue`, configure UnoCSS to include both:
|
|
83
|
+
|
|
84
|
+
> **⚠️ Important:** Do NOT add `presetWind()` or `presetAnimations()` separately when using `presetsAlephAlpha()`. The DS presets already include these utilities. Adding them again from different packages causes style conflicts.
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
// uno.config.ts
|
|
88
|
+
import { defineConfig } from 'unocss'
|
|
89
|
+
import { presetsAlephAlpha, getDesignSystemContentPathConfig } from '@aleph-alpha/config-css'
|
|
90
|
+
import { presetAlephAlphaIcons } from '@aleph-alpha/ds-icons'
|
|
91
|
+
import { getUiLibraryContentConfig } from '@aleph-alpha/ui-library/config'
|
|
92
|
+
import presetShadcn from 'unocss-preset-shadcn'
|
|
93
|
+
|
|
94
|
+
const uiLibraryConfig = getUiLibraryContentConfig()
|
|
95
|
+
const dsConfig = getDesignSystemContentPathConfig('vue')
|
|
96
|
+
|
|
97
|
+
export default defineConfig({
|
|
98
|
+
presets: [
|
|
99
|
+
// DS presets (already includes presetWind + presetAnimations)
|
|
100
|
+
...presetsAlephAlpha(),
|
|
101
|
+
presetAlephAlphaIcons(),
|
|
102
|
+
// UI Library preset (for shadcn CSS variables only)
|
|
103
|
+
presetShadcn({ color: 'neutral' }),
|
|
104
|
+
],
|
|
105
|
+
content: {
|
|
106
|
+
filesystem: [
|
|
107
|
+
...(uiLibraryConfig.content.filesystem || []),
|
|
108
|
+
...(dsConfig.content?.filesystem || []),
|
|
109
|
+
],
|
|
110
|
+
pipeline: {
|
|
111
|
+
include: [
|
|
112
|
+
/\.(vue|svelte|[jt]sx|mdx?|astro|elm|php|phtml|html)($|\?)/,
|
|
113
|
+
'src/**/*.{js,ts,vue}',
|
|
114
|
+
'node_modules/@aleph-alpha/ui-library/**/*.js',
|
|
115
|
+
'node_modules/@aleph-alpha/ds-components-vue/**/*.{js,ts}',
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
})
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## External Resources
|
|
123
|
+
|
|
124
|
+
- [shadcn-vue](https://www.shadcn-vue.com/) — The component library we build upon
|
|
125
|
+
- [Reka UI](https://reka-ui.com/) — Underlying accessible primitives
|
|
126
|
+
- [TanStack Table](https://tanstack.com/table/latest) — Headless table library (used in UiDataTable)
|
|
127
|
+
- [WAI-ARIA APG](https://www.w3.org/WAI/ARIA/apg/) — Accessibility patterns guide
|
|
128
|
+
- [WCAG 2.2](https://www.w3.org/TR/WCAG22/) — Web accessibility guidelines
|
|
4
129
|
|
|
5
130
|
## Documentation
|
|
6
131
|
|
|
7
132
|
- [Architecture](./docs/ARCHITECTURE.md) — Component structure and design decisions
|
|
8
133
|
- [Contribution Guidelines](./docs/CONTRIBUTION_GUIDELINES.md) — Accessibility requirements and patterns
|
|
134
|
+
- [Storybook Guidelines](./docs/STORYBOOK.md) — Story patterns and guidelines
|
|
9
135
|
- [Testing Strategy](./docs/TESTING.md) — What we test and where
|
|
10
136
|
|
|
11
137
|
## Getting Started
|
|
@@ -35,6 +161,7 @@ We follow the [Conventional Commits](https://www.conventionalcommits.org/) speci
|
|
|
35
161
|
```
|
|
36
162
|
|
|
37
163
|
**Types:**
|
|
164
|
+
|
|
38
165
|
- `feat`: A new feature
|
|
39
166
|
- `fix`: A bug fix
|
|
40
167
|
- `docs`: Documentation only changes
|
|
@@ -45,6 +172,7 @@ We follow the [Conventional Commits](https://www.conventionalcommits.org/) speci
|
|
|
45
172
|
- `chore`: Changes to the build process or auxiliary tools
|
|
46
173
|
|
|
47
174
|
**Examples:**
|
|
175
|
+
|
|
48
176
|
```bash
|
|
49
177
|
git commit -m "feat(button): add loading state"
|
|
50
178
|
git commit -m "fix(dropdown): resolve keyboard navigation issue"
|
|
@@ -60,6 +188,7 @@ pnpm dlx shadcn-vue@latest add [component]
|
|
|
60
188
|
```
|
|
61
189
|
|
|
62
190
|
Example:
|
|
191
|
+
|
|
63
192
|
```bash
|
|
64
193
|
pnpm dlx shadcn-vue@latest add tooltip
|
|
65
194
|
```
|
|
@@ -68,11 +197,11 @@ Please refer to [CONTRIBUTION_GUIDELINES.md](./docs/CONTRIBUTION_GUIDELINES.md)
|
|
|
68
197
|
|
|
69
198
|
## Testing
|
|
70
199
|
|
|
71
|
-
| Command
|
|
72
|
-
|
|
73
|
-
| `pnpm test`
|
|
200
|
+
| Command | Purpose |
|
|
201
|
+
| --------------------- | ----------------------------------- |
|
|
202
|
+
| `pnpm test` | Run unit tests |
|
|
74
203
|
| `pnpm test:storybook` | Run Storybook + accessibility tests |
|
|
75
|
-
| `pnpm lint`
|
|
204
|
+
| `pnpm lint` | Run linting including a11y rules |
|
|
76
205
|
|
|
77
206
|
See [Testing Strategy](./docs/TESTING.md) for details on what we test and where.
|
|
78
207
|
|
|
@@ -81,6 +210,7 @@ See [Testing Strategy](./docs/TESTING.md) for details on what we test and where.
|
|
|
81
210
|
This project uses `nx affected` in pre-commit hooks to ensure code quality. Because `lint` and `test` targets depend on `build`, commits might hang if the build cache is cold.
|
|
82
211
|
|
|
83
212
|
### If commit hangs:
|
|
213
|
+
|
|
84
214
|
Run a full build to populate the cache before committing:
|
|
85
215
|
|
|
86
216
|
```bash
|
|
@@ -90,8 +220,11 @@ pnpm nx run-many --target=build --all
|
|
|
90
220
|
Then try committing again. The pre-commit hook will hit the cache and finish quickly.
|
|
91
221
|
|
|
92
222
|
### Quick unblock (Emergency only)
|
|
223
|
+
|
|
93
224
|
If you need to bypass hooks:
|
|
225
|
+
|
|
94
226
|
```sh
|
|
95
227
|
git commit -m "Your message" --no-verify
|
|
96
228
|
```
|
|
229
|
+
|
|
97
230
|
Use this sparingly and ensure CI passes.
|
package/config.d.ts
ADDED
package/config.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UnoCSS content configuration for scanning ui-library components.
|
|
3
|
+
*/
|
|
4
|
+
export const getUiLibraryContentConfig = () => ({
|
|
5
|
+
content: {
|
|
6
|
+
filesystem: ['node_modules/@aleph-alpha/ui-library/dist/**/*.js'],
|
|
7
|
+
// NOTE: pipeline.include is NOT redundant with filesystem.
|
|
8
|
+
// filesystem = where to find files, pipeline.include = which files to extract classes from.
|
|
9
|
+
// Both are required for UnoCSS to properly scan node_modules.
|
|
10
|
+
pipeline: {
|
|
11
|
+
include: [
|
|
12
|
+
/\.(vue|svelte|[jt]sx|mdx?|astro|elm|php|phtml|html)($|\?)/,
|
|
13
|
+
'src/**/*.{js,ts,vue}',
|
|
14
|
+
'node_modules/@aleph-alpha/ui-library/**/*.js',
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
});
|