@aleph-alpha/ui-library 1.1.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 +118 -1
- package/config.d.ts +11 -0
- package/config.js +18 -0
- package/package.json +7 -1
package/README.md
CHANGED
|
@@ -2,10 +2,127 @@
|
|
|
2
2
|
|
|
3
3
|
📘 **[View Storybook](https://urban-broccoli-l1okew7.pages.github.io/ui-library)**
|
|
4
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
|
+
|
|
5
122
|
## External Resources
|
|
6
123
|
|
|
7
124
|
- [shadcn-vue](https://www.shadcn-vue.com/) — The component library we build upon
|
|
8
|
-
- [
|
|
125
|
+
- [Reka UI](https://reka-ui.com/) — Underlying accessible primitives
|
|
9
126
|
- [TanStack Table](https://tanstack.com/table/latest) — Headless table library (used in UiDataTable)
|
|
10
127
|
- [WAI-ARIA APG](https://www.w3.org/WAI/ARIA/apg/) — Accessibility patterns guide
|
|
11
128
|
- [WCAG 2.2](https://www.w3.org/TR/WCAG22/) — Web accessibility guidelines
|
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
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aleph-alpha/ui-library",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/system/lib.js",
|
|
@@ -10,10 +10,16 @@
|
|
|
10
10
|
"types": "./dist/system/index.d.ts",
|
|
11
11
|
"import": "./dist/system/lib.js"
|
|
12
12
|
},
|
|
13
|
+
"./config": {
|
|
14
|
+
"types": "./config.d.ts",
|
|
15
|
+
"import": "./config.js"
|
|
16
|
+
},
|
|
13
17
|
"./tailwind.preset": "./tailwind.preset.js"
|
|
14
18
|
},
|
|
15
19
|
"files": [
|
|
16
20
|
"dist/system",
|
|
21
|
+
"config.js",
|
|
22
|
+
"config.d.ts",
|
|
17
23
|
"tailwind.preset.js"
|
|
18
24
|
],
|
|
19
25
|
"description": "Next-gen UI Library for Vue.js projects.",
|