@aleph-alpha/ui-library 1.1.0 → 1.3.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 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
- - [Radix Vue](https://www.radix-vue.com/) — Underlying accessible primitives
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
@@ -0,0 +1,11 @@
1
+ /**
2
+ * UnoCSS content configuration for scanning ui-library components.
3
+ */
4
+ export declare const getUiLibraryContentConfig: () => {
5
+ content: {
6
+ filesystem: string[];
7
+ pipeline: {
8
+ include: (RegExp | string)[];
9
+ };
10
+ };
11
+ };
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
+ });
@@ -53,21 +53,21 @@ startIcon: Component;
53
53
  endIcon: Component;
54
54
  }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
55
55
 
56
- declare const __VLS_component_17: DefineComponent< {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, HTMLDivElement>;
56
+ declare const __VLS_component_17: DefineComponent<UiCardProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<UiCardProps> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
57
57
 
58
- declare const __VLS_component_18: DefineComponent< {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, HTMLDivElement>;
58
+ declare const __VLS_component_18: DefineComponent<UiCardActionProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<UiCardActionProps> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
59
59
 
60
- declare const __VLS_component_19: DefineComponent< {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, HTMLDivElement>;
60
+ declare const __VLS_component_19: DefineComponent<UiCardContentProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<UiCardContentProps> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
61
61
 
62
62
  declare const __VLS_component_2: DefineComponent< {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, HTMLDivElement>;
63
63
 
64
- declare const __VLS_component_20: DefineComponent< {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, HTMLParagraphElement>;
64
+ declare const __VLS_component_20: DefineComponent<UiCardDescriptionProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<UiCardDescriptionProps> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLParagraphElement>;
65
65
 
66
- declare const __VLS_component_21: DefineComponent< {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, HTMLDivElement>;
66
+ declare const __VLS_component_21: DefineComponent<UiCardFooterProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<UiCardFooterProps> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
67
67
 
68
- declare const __VLS_component_22: DefineComponent< {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, HTMLDivElement>;
68
+ declare const __VLS_component_22: DefineComponent<UiCardHeaderProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<UiCardHeaderProps> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
69
69
 
70
- declare const __VLS_component_23: DefineComponent< {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, HTMLHeadingElement>;
70
+ declare const __VLS_component_23: DefineComponent<UiCardTitleProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<UiCardTitleProps> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLHeadingElement>;
71
71
 
72
72
  declare const __VLS_component_24: DefineComponent<UiDropdownMenuProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
73
73
  "update:open": (value: boolean) => any;
@@ -1277,19 +1277,18 @@ export declare interface UiBadgeProps {
1277
1277
  */
1278
1278
  asChild?: boolean;
1279
1279
  /**
1280
- * Icon component to display before the button text.
1281
- * Hidden when loading is true.
1280
+ * Icon component to display before the badge text.
1282
1281
  * @example
1283
1282
  * ```vue
1284
- * <UiButton :startIcon="ChevronLeft">Back</UiButton>
1283
+ * <UiBadge :startIcon="InfoIcon">Info</UiBadge>
1285
1284
  * ```
1286
1285
  */
1287
1286
  startIcon?: Component;
1288
1287
  /**
1289
- * Icon component to display after the button text.
1288
+ * Icon component to display after the badge text.
1290
1289
  * @example
1291
1290
  * ```vue
1292
- * <UiButton :endIcon="ChevronRight">Next</UiButton>
1291
+ * <UiBadge :endIcon="CloseIcon">Dismissible</UiBadge>
1293
1292
  * ```
1294
1293
  */
1295
1294
  endIcon?: Component;
@@ -1377,16 +1376,93 @@ export declare const UiCard: __VLS_WithTemplateSlots_17<typeof __VLS_component_1
1377
1376
 
1378
1377
  export declare const UiCardAction: __VLS_WithTemplateSlots_18<typeof __VLS_component_18, __VLS_TemplateResult_18["slots"]>;
1379
1378
 
1379
+ /**
1380
+ * Props for UiCardAction component.
1381
+ * Container for action buttons in the card header.
1382
+ */
1383
+ export declare interface UiCardActionProps {
1384
+ /**
1385
+ * Additional CSS classes to apply to the action container.
1386
+ */
1387
+ class?: HTMLAttributes['class'];
1388
+ }
1389
+
1380
1390
  export declare const UiCardContent: __VLS_WithTemplateSlots_19<typeof __VLS_component_19, __VLS_TemplateResult_19["slots"]>;
1381
1391
 
1392
+ /**
1393
+ * Props for UiCardContent component.
1394
+ * The main content area of the card.
1395
+ */
1396
+ export declare interface UiCardContentProps {
1397
+ /**
1398
+ * Additional CSS classes to apply to the content container.
1399
+ */
1400
+ class?: HTMLAttributes['class'];
1401
+ }
1402
+
1382
1403
  export declare const UiCardDescription: __VLS_WithTemplateSlots_20<typeof __VLS_component_20, __VLS_TemplateResult_20["slots"]>;
1383
1404
 
1405
+ /**
1406
+ * Props for UiCardDescription component.
1407
+ * A brief description or subtitle for the card.
1408
+ */
1409
+ export declare interface UiCardDescriptionProps {
1410
+ /**
1411
+ * Additional CSS classes to apply to the description element.
1412
+ */
1413
+ class?: HTMLAttributes['class'];
1414
+ }
1415
+
1384
1416
  export declare const UiCardFooter: __VLS_WithTemplateSlots_21<typeof __VLS_component_21, __VLS_TemplateResult_21["slots"]>;
1385
1417
 
1418
+ /**
1419
+ * Props for UiCardFooter component.
1420
+ * Container for card actions or additional information at the bottom.
1421
+ */
1422
+ export declare interface UiCardFooterProps {
1423
+ /**
1424
+ * Additional CSS classes to apply to the footer container.
1425
+ */
1426
+ class?: HTMLAttributes['class'];
1427
+ }
1428
+
1386
1429
  export declare const UiCardHeader: __VLS_WithTemplateSlots_22<typeof __VLS_component_22, __VLS_TemplateResult_22["slots"]>;
1387
1430
 
1431
+ /**
1432
+ * Props for UiCardHeader component.
1433
+ * Container for the card's header content (title, description, action).
1434
+ */
1435
+ export declare interface UiCardHeaderProps {
1436
+ /**
1437
+ * Additional CSS classes to apply to the header container.
1438
+ */
1439
+ class?: HTMLAttributes['class'];
1440
+ }
1441
+
1442
+ /**
1443
+ * Props for UiCard component.
1444
+ * A container with rounded corners and a shadow for grouping related content.
1445
+ */
1446
+ export declare interface UiCardProps {
1447
+ /**
1448
+ * Additional CSS classes to apply to the card container.
1449
+ */
1450
+ class?: HTMLAttributes['class'];
1451
+ }
1452
+
1388
1453
  export declare const UiCardTitle: __VLS_WithTemplateSlots_23<typeof __VLS_component_23, __VLS_TemplateResult_23["slots"]>;
1389
1454
 
1455
+ /**
1456
+ * Props for UiCardTitle component.
1457
+ * The main heading of the card.
1458
+ */
1459
+ export declare interface UiCardTitleProps {
1460
+ /**
1461
+ * Additional CSS classes to apply to the title element.
1462
+ */
1463
+ class?: HTMLAttributes['class'];
1464
+ }
1465
+
1390
1466
  export declare const UiCheckbox: DefineComponent<__VLS_PublicProps_2, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
1391
1467
  "update:modelValue": (value: UiCheckboxModelValue) => any;
1392
1468
  }, string, PublicProps, Readonly<__VLS_PublicProps_2> & Readonly<{