@uni-design-system/uni-angular 4.0.0 → 5.1.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 George English
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 CHANGED
@@ -5,16 +5,24 @@
5
5
  </p>
6
6
 
7
7
  <p align="center">
8
- UNI Angular is a themed based component library built atop of the UNI Design System Core Concepts.
8
+ UNI Angular is a theme-based component library built atop the UNI Design System core concepts.
9
9
  <p>
10
10
 
11
11
  <p align="center">
12
- <a href="https://uni-design-system.github.io/uni/docs/angular/"><strong>Browse the Angular (v21) component library &rarr;</strong></a>
12
+ <a href="https://www.npmjs.com/package/@uni-design-system/uni-angular"><img src="https://img.shields.io/npm/v/%40uni-design-system%2Funi-angular" alt="npm version"></a>
13
+ <a href="https://github.com/uni-design-system/uni/actions/workflows/ci.yml"><img src="https://github.com/uni-design-system/uni/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
14
+ </p>
15
+
16
+ <p align="center">
17
+ <a href="https://uni-design-system.github.io/uni/docs/angular/"><strong>Browse the Angular component library &rarr;</strong></a>
13
18
  </p>
14
19
 
15
20
  # @uni-design-system/uni-angular
16
21
 
17
- The official **Angular** implementation of the Uni Design System. Built from the ground up for modern enterprise apps, this package delivers strict, performance-optimized structural components.
22
+ The official **Angular** implementation of the UNI Design System: ~50 themed,
23
+ accessible, standalone components with a **signals-only API** — signal inputs,
24
+ `model()` two-way bindings, zoneless-ready `OnPush` change detection, and
25
+ first-class **Signal Forms** integration. No rxjs, no NgModules, no CVA.
18
26
 
19
27
  ## 📦 Installation
20
28
 
@@ -22,33 +30,126 @@ The official **Angular** implementation of the Uni Design System. Built from the
22
30
  npm install @uni-design-system/uni-angular @uni-design-system/uni-core @emotion/css
23
31
  ```
24
32
 
25
- _Note: This package requires `@emotion/css` to be present in the host application as a peer dependency._
33
+ `@emotion/css` and `@uni-design-system/uni-core` are peer dependencies of the
34
+ host application.
26
35
 
27
36
  ## 🏁 Getting Started
28
37
 
29
- This library utilizes fully standalone components compliant with modern Angular architectures. Simply import the component into your Standalone Component or Angular Module:
30
-
31
- ### 1. Import Component
38
+ Every component is standalone import the class and use its selector:
32
39
 
33
40
  ```typescript
34
41
  import { Component } from '@angular/core';
35
- import { ButtonComponent } from '@uni-design-system/uni-angular';
42
+ import { UniButtonComponent } from '@uni-design-system/uni-angular';
36
43
 
37
44
  @Component({
38
45
  selector: 'app-root',
39
- standalone: true,
40
- imports: [ButtonComponent], // 🟢 Inject here
41
- template: ` <uni-button text="Hello Uni!" (click)="handleOnClick()"> </uni-button> `,
46
+ imports: [UniButtonComponent],
47
+ template: `
48
+ <button uni-text-button variant="primary" (click)="handleClick()">Hello UNI!</button>
49
+ `,
42
50
  })
43
51
  export class AppComponent {
44
- handleOnClick() {
52
+ handleClick() {
45
53
  console.log('Button clicked!');
46
54
  }
47
55
  }
48
56
  ```
49
57
 
58
+ Theming works out of the box — the built-in themes are provided by default.
59
+ To register your own:
60
+
61
+ ```typescript
62
+ import { UNI_THEMES } from '@uni-design-system/uni-angular';
63
+ import { UniThemes } from '@uni-design-system/uni-core';
64
+
65
+ export const appConfig = {
66
+ providers: [{ provide: UNI_THEMES, useValue: { ...UniThemes, myTheme } }],
67
+ };
68
+ ```
69
+
70
+ ## ✍️ Signal Forms
71
+
72
+ Form controls (`Input`, `Checkbox`, `Radio`, `Toggle`, `SelectInput`,
73
+ `MultiSelectDropdown`) implement Angular's Signal Forms
74
+ `FormValueControl`/`FormCheckboxControl` interfaces — bind them straight to a
75
+ field with `[field]`, no ControlValueAccessor involved:
76
+
77
+ ```typescript
78
+ import { Component, signal } from '@angular/core';
79
+ import { form, required, minLength } from '@angular/forms/signals';
80
+ import { UniCheckboxComponent, UniInputComponent } from '@uni-design-system/uni-angular';
81
+
82
+ @Component({
83
+ selector: 'app-signup',
84
+ imports: [UniInputComponent, UniCheckboxComponent],
85
+ template: `
86
+ <uni-input label="Username" [field]="signupForm.username" />
87
+ <uni-checkbox label="Accept terms" [field]="signupForm.terms" />
88
+ `,
89
+ })
90
+ export class SignupComponent {
91
+ readonly formState = signal({ username: '', terms: false });
92
+
93
+ readonly signupForm = form(this.formState, {
94
+ username: [required(), minLength(3)],
95
+ terms: [required()],
96
+ });
97
+ }
98
+ ```
99
+
100
+ Outside a form, every control also supports plain two-way binding:
101
+ `<uni-checkbox [(checked)]="agreed" />`.
102
+
103
+ ## 🔤 Selectors
104
+
105
+ Every component registers a **canonical `uni-`-prefixed selector** plus a short
106
+ alias. Use the canonical form in application code; the aliases exist for
107
+ terse internal/demo markup.
108
+
109
+ | Component | Canonical | Alias |
110
+ | --------- | -------------------------- | ------------------------ |
111
+ | Button | `button[uni-text-button]` | `button[text-button]`, `Button` |
112
+ | Checkbox | `uni-checkbox` | `Checkbox` |
113
+ | Dialog | `dialog[uni-dialog]` | `Dialog` |
114
+ | Box | `div[uni-box-layout]` | `div[box-layout]`, `Box` |
115
+
116
+ The full selector list for every component is in [`llms.txt`](./llms.txt).
117
+
118
+ ## ♿ Accessibility
119
+
120
+ The library targets **WCAG 2.2 AA**: full keyboard support (menus, tables,
121
+ dialogs, tooltips), ARIA contracts on every component, reduced-motion support,
122
+ and screen-reader announcements for badges, alerts, and progress. See
123
+ [ACCESSIBILITY.md](./ACCESSIBILITY.md) for per-component keyboard maps and the
124
+ contracts your app is expected to fulfill (e.g. labelling icon-only buttons).
125
+
126
+ ## 🤖 AI-agent friendly
127
+
128
+ A generated, always-current API reference lives in [`llms.txt`](./llms.txt) —
129
+ selectors, inputs (with types and defaults), two-way models, and outputs for
130
+ every component. Point your coding agent at it. Regenerate with
131
+ `pnpm docs:api`. Conventions for contributors (human or agent) are in
132
+ [AGENTS.md](./AGENTS.md).
133
+
50
134
  ## 🛠️ Architecture Profile
51
135
 
52
- - **Framework Support:** Angular `^21.2.0`
53
- - **Package Format:** Compiled strictly under the **Angular Package Format (APF)** using `ng-packagr` into flat, optimized `fesm2022` modules.
54
- - **CSS Architecture:** Leverages native CSS properties and token maps for high-performance hardware rendering, avoiding heavy deprecated runtime framework animation libraries.
136
+ - **Framework support:** Angular `^21.2.0` (zoneless-ready; every component is `OnPush`)
137
+ - **Package format:** Angular Package Format (APF) via `ng-packagr`, flat `fesm2022`
138
+ - **Styling:** [Emotion](https://emotion.sh/docs/@emotion/css) atomic CSS from
139
+ theme tokens — no global stylesheets, no CSS files to import
140
+ - **Zero runtime dependencies.** Positioning uses the native Popover API +
141
+ CSS Anchor Positioning (Baseline 2026). On browsers without
142
+ `@position-try` support yet (Safari < 26, Firefox < 147) panels still
143
+ position correctly but don't auto-flip at viewport edges.
144
+ - **Rendering:** client-side. The library drives browser-only primitives
145
+ (top layer, popovers, `matchMedia`); SSR/hydration is not currently a target
146
+ - **Testing:** Vitest (zoneless TestBed), ESLint with template accessibility
147
+ rules and a hard ban on legacy decorator APIs
148
+
149
+ ## 🗓️ Versioning & Support
150
+
151
+ - Follows [semver](https://semver.org) with
152
+ [changesets](https://github.com/changesets/changesets); see
153
+ [CHANGELOG.md](./CHANGELOG.md).
154
+ - Each major of this package tracks one Angular major (current: Angular 21).
155
+ Previous majors receive fixes for six months after the next major ships.