@ng-zen/cli 22.2.0 → 22.3.0-next.2
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/CHANGELOG.md +3 -13
- package/README.md +120 -291
- package/package.json +6 -3
- package/schematics/ui/files/badge/badge.scss +106 -0
- package/schematics/ui/files/badge/badge.spec.ts +58 -0
- package/schematics/ui/files/badge/badge.stories.ts +138 -0
- package/schematics/ui/files/badge/badge.ts +15 -0
- package/schematics/ui/files/badge/index.ts +1 -0
- package/schematics/ui/files/card/card.stories.ts +4 -3
- package/schematics/ui/files/input/input.scss +5 -0
- package/schematics/ui/schema.js.map +1 -1
- package/schematics/ui/schema.json +1 -0
- package/schematics/ui/schema.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,18 +1,8 @@
|
|
|
1
|
-
## [22.
|
|
2
|
-
|
|
3
|
-
### 🚀 New Features
|
|
4
|
-
|
|
5
|
-
* **textarea:** remove outdated autoresize TODO comment ([#435](https://github.com/kstepien3/ng-zen/issues/435)) ([73575c7](https://github.com/kstepien3/ng-zen/commit/73575c74e803d816612f74c5794ca97800bddb1c))
|
|
6
|
-
* trigger 22.2.0-next.1 release ([803e0fa](https://github.com/kstepien3/ng-zen/commit/803e0faccbd41c77b8996227f034dbbda0fa2852))
|
|
7
|
-
* **ui:** add reusable card component ([#428](https://github.com/kstepien3/ng-zen/issues/428)) ([f7acac6](https://github.com/kstepien3/ng-zen/commit/f7acac6b443b23c2710deaf3a763feb7f9269fbb))
|
|
8
|
-
* **ui:** migrate controls for signals and clean up ([#417](https://github.com/kstepien3/ng-zen/issues/417)) ([08824f8](https://github.com/kstepien3/ng-zen/commit/08824f85096745bcf001700dc415afe1a6cdb52e))
|
|
9
|
-
|
|
10
|
-
### 🐛 Bug Fixes
|
|
11
|
-
|
|
12
|
-
* force release after failed npm publish for 22.1.0-next.1 ([3e4d4db](https://github.com/kstepien3/ng-zen/commit/3e4d4db2a602f05b13ca2a989abc923ccebf7207))
|
|
1
|
+
## [22.3.0-next.2](https://github.com/kstepien3/ng-zen/compare/v22.3.0-next.1...v22.3.0-next.2) (2026-07-11)
|
|
13
2
|
|
|
14
3
|
### 📚 Documentation
|
|
15
4
|
|
|
16
|
-
* **
|
|
5
|
+
* **README:** emphasize @ng-zen/cli ([#456](https://github.com/kstepien3/ng-zen/issues/456)) ([6306d4e](https://github.com/kstepien3/ng-zen/commit/6306d4efb5fef1b9a2de8790b4dc149e5069a5dd))
|
|
6
|
+
* **README:** simplify content structure and highlight key features ([#457](https://github.com/kstepien3/ng-zen/issues/457)) ([6ff7d4d](https://github.com/kstepien3/ng-zen/commit/6ff7d4d296b5be3bd86fcc44193028afcfe25dd7))
|
|
17
7
|
|
|
18
8
|
Development mode - changelog will be generated during build.
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<a href="https://kstepien3.github.io/ng-zen/">
|
|
3
3
|
<img src="https://raw.githubusercontent.com/kstepien3/ng-zen/master/assets/logo.png" alt="@ng-zen/cli Logo" width="256" />
|
|
4
4
|
</a>
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
<h1>@ng-zen/cli</h1>
|
|
7
7
|
|
|
8
8
|
<p style="display: flex; gap: 1rem; justify-content: center;">
|
|
@@ -32,366 +32,195 @@
|
|
|
32
32
|
</a>
|
|
33
33
|
</p>
|
|
34
34
|
|
|
35
|
-
<p
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
<p>
|
|
36
|
+
<strong>Standalone Angular UI Kit Generator — the shadcn/ui alternative for Angular.</strong><br/>
|
|
37
|
+
Generate production-ready, highly customizable Angular UI components directly into your workspace. No rigid libraries, full code ownership.
|
|
38
|
+
</p>
|
|
38
39
|
</div>
|
|
39
40
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
### ✨ **Own Your Components**
|
|
43
|
-
|
|
44
|
-
Unlike traditional UI libraries that give you `<library-button>` black boxes, @ng-zen generates **actual TypeScript, HTML, and SCSS files** directly into your project. You own the code, you control the future.
|
|
45
|
-
|
|
46
|
-
### 🏎️ **Instant Productivity**
|
|
47
|
-
|
|
48
|
-
- **Production-Ready UI Elements:** Alert, Avatar, Button, Card, Checkbox, Dialog, Divider, Form Control, Icon, Input, Popover, Radio, Skeleton, Switch, Textarea
|
|
49
|
-
- **Zero Configuration:** Works with Angular 20+ out of the box
|
|
50
|
-
- **Complete Setup:** Each component includes unit tests, Storybook stories, and documentation
|
|
51
|
-
|
|
52
|
-
### 🎨 **Built for Customization**
|
|
53
|
-
|
|
54
|
-
- **CSS Variables:** Easy theming without touching component internals
|
|
55
|
-
- **Editable SCSS:** Modify styles directly when you need deeper customization
|
|
56
|
-
- **Modern Architecture:** Standalone components, OnPush change detection, Angular signals
|
|
57
|
-
|
|
58
|
-
### 📚 **Developer Experience First**
|
|
59
|
-
|
|
60
|
-
- **Interactive Documentation:** Live Storybook examples for every component
|
|
61
|
-
- **TypeScript Ready:** Full type safety and IntelliSense support
|
|
62
|
-
- **Test Coverage:** Generated components include comprehensive unit tests
|
|
63
|
-
- **JSDoc Annotations:** Detailed inline documentation
|
|
41
|
+
<!-- TODO: Insert terminal recording GIF/WebM here showing the CLI in action -->
|
|
64
42
|
|
|
65
|
-
|
|
43
|
+
---
|
|
66
44
|
|
|
67
|
-
|
|
68
|
-
2. [Installation](#-installation)
|
|
69
|
-
3. [Available Elements](#-available-uis)
|
|
70
|
-
4. [Usage Examples](#-usage-examples)
|
|
71
|
-
5. [Perfect For](#-perfect-for)
|
|
72
|
-
6. [Advanced Features](#-advanced-features)
|
|
73
|
-
7. [Documentation](#-documentation)
|
|
74
|
-
8. [Project Status](#-project-status)
|
|
75
|
-
9. [Contributing](#-contributing)
|
|
76
|
-
10. [License](#license)
|
|
77
|
-
11. [Author](#author)
|
|
78
|
-
12. [See Also](#see-also)
|
|
79
|
-
13. [FAQ](#faq)
|
|
45
|
+
## 🚀 Getting Started
|
|
80
46
|
|
|
81
|
-
|
|
47
|
+
The fastest way to install the CLI and generate your first component.
|
|
82
48
|
|
|
83
|
-
|
|
49
|
+
**1. Add the package to your Angular 20+ project:**
|
|
84
50
|
|
|
85
51
|
```bash
|
|
86
52
|
ng add @ng-zen/cli
|
|
87
53
|
```
|
|
88
54
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
- ✅ Installs the package
|
|
92
|
-
- ✅ Sets up your project configuration
|
|
93
|
-
- ✅ Ready to generate components
|
|
94
|
-
|
|
95
|
-
Then generate your first component:
|
|
55
|
+
**2. Generate UI components (interactive mode):**
|
|
96
56
|
|
|
97
57
|
```bash
|
|
98
58
|
ng generate @ng-zen/cli:ui
|
|
99
59
|
```
|
|
100
60
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
## 📦 Installation
|
|
104
|
-
|
|
105
|
-
### Recommended: Using ng add
|
|
106
|
-
|
|
107
|
-
```bash
|
|
108
|
-
ng add @ng-zen/cli
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
### Manual Installation
|
|
112
|
-
|
|
113
|
-
```bash
|
|
114
|
-
# Stable version
|
|
115
|
-
pnpm add -D @ng-zen/cli
|
|
116
|
-
|
|
117
|
-
# Latest features and fixes
|
|
118
|
-
pnpm add -D @ng-zen/cli@next
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
### Icon Library (Optional)
|
|
122
|
-
|
|
123
|
-
To use the `zen-icon` component, install an icon library:
|
|
124
|
-
|
|
125
|
-
```bash
|
|
126
|
-
# Using HugeIcons (recommended)
|
|
127
|
-
pnpm add @hugeicons/core-free-icons
|
|
128
|
-
|
|
129
|
-
# Or use any other SVG icon library
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
Then import icons and pass them to the component:
|
|
61
|
+
**3. Use the generated standalone component:**
|
|
133
62
|
|
|
134
63
|
```typescript
|
|
135
|
-
import {
|
|
136
|
-
import { ZenIcon } from '@ng-zen/cli';
|
|
64
|
+
import { ZenButton } from './ui/button';
|
|
137
65
|
|
|
138
66
|
@Component({
|
|
139
|
-
imports: [
|
|
67
|
+
imports: [ZenButton],
|
|
140
68
|
template: `
|
|
141
|
-
<
|
|
69
|
+
<button variant="primary" zen-button>Action</button>
|
|
142
70
|
`,
|
|
143
71
|
})
|
|
144
72
|
export class MyComponent {}
|
|
145
73
|
```
|
|
146
74
|
|
|
147
|
-
##
|
|
75
|
+
## Table of Contents
|
|
148
76
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
| **Divider** | Visual separators | Horizontal/vertical, with labels, custom thickness |
|
|
158
|
-
| **Form Control** | Form field wrapper | Labels, validation messages, required indicators |
|
|
159
|
-
| **Icon** | SVG icon system | Huge Icons integration, size variants, colors |
|
|
160
|
-
| **Input** | Text input fields | Validation states, prefixes/suffixes, types |
|
|
161
|
-
| **Popover** | Native Popover API directive | Template/string content, placements, click toggle, CSS anchor positioning |
|
|
162
|
-
| **Radio** | Form radio buttons | Group selection, two-way binding, custom styling, disabled state |
|
|
163
|
-
| **Skeleton** | Loading placeholders | Multiple shapes, animation, responsive |
|
|
164
|
-
| **Switch** | Toggle controls | On/off states, disabled state, custom labels |
|
|
165
|
-
| **Textarea** | Multi-line text input | Auto-resize, character counts, validation |
|
|
166
|
-
|
|
167
|
-
> 💡 **More components coming soon!** Planned: Directives, Pipes, Services, and additional UI elements.
|
|
168
|
-
|
|
169
|
-
## 💡 Usage Examples
|
|
170
|
-
|
|
171
|
-
### Basic Component Generation
|
|
77
|
+
1. [Getting Started](#-getting-started)
|
|
78
|
+
2. [Features](#-features)
|
|
79
|
+
3. [CLI Usage & Options](#-cli-usage--options)
|
|
80
|
+
4. [Available UIs](#-available-uis)
|
|
81
|
+
5. [Customization](#-customization)
|
|
82
|
+
6. [Philosophy & Architecture](#-philosophy--architecture)
|
|
83
|
+
7. [Community & Contributions](#-community--contributions)
|
|
84
|
+
8. [Documentation & Links](#-documentation--links)
|
|
172
85
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
86
|
+
## ✨ Features
|
|
87
|
+
|
|
88
|
+
- **Signal First Architecture:** Designed natively for Angular's reactive model. Full support for Signal Inputs, Queries, Model signals, and the new **Signal Forms** API.
|
|
89
|
+
- **Own Your Code:** Components are generated as raw `.ts`, `.html`, and `.scss` files directly in your project. You control the implementation.
|
|
90
|
+
- **Agnostic Styling:** Built with raw SCSS and CSS Variables. No forced dependencies on Tailwind CSS, but fully adaptable if needed.
|
|
91
|
+
- **Modern Angular:** Leverages Standalone Components, OnPush change detection, and eliminates unnecessary RxJS overhead in UI layers.
|
|
92
|
+
- **Production Ready:** Includes Vitest unit tests, Storybook stories, and accessibility features out of the box.
|
|
176
93
|
|
|
177
|
-
|
|
178
|
-
ng generate @ng-zen/cli:ui --ui avatar button
|
|
94
|
+
## 🛠️ CLI Usage & Options
|
|
179
95
|
|
|
180
|
-
|
|
181
|
-
ng generate @ng-zen/cli:ui ./src/app/custom --ui input checkbox
|
|
96
|
+
Generate multiple components at once, specify custom paths, or include Storybook documentation files directly from the terminal.
|
|
182
97
|
|
|
183
|
-
|
|
184
|
-
ng generate @ng-zen/cli:ui --ui
|
|
98
|
+
```bash
|
|
99
|
+
ng generate @ng-zen/cli:ui [path] --ui <elements...> --stories
|
|
185
100
|
```
|
|
186
101
|
|
|
187
|
-
###
|
|
102
|
+
### Arguments & Flags
|
|
188
103
|
|
|
189
|
-
|
|
104
|
+
| Property | Status | Default | Description |
|
|
105
|
+
| :-------------- | :--------- | :------------ | :--------------------------------------------------------------------------------------------------------------------------- |
|
|
106
|
+
| **`[path]`** | _Optional_ | `src/app/ui` | The directory where components will be generated (e.g., `./src/app/shared/components`). |
|
|
107
|
+
| **`--ui`** | _Required_ | - | A space-separated list of components to generate (e.g., `button`, `alert`, `dialog`). Interactive prompt appears if omitted. |
|
|
108
|
+
| **`--stories`** | _Optional_ | `false` | Generates `.stories.ts` files alongside the component, instantly ready for your Storybook integration. |
|
|
109
|
+
| **`--project`** | _Optional_ | auto-detected | Specify the target project name in a multi-project workspace. |
|
|
190
110
|
|
|
191
|
-
|
|
192
|
-
src/app/ui/
|
|
193
|
-
├── button/
|
|
194
|
-
│ ├── button.ts # Component logic
|
|
195
|
-
│ ├── button.scss # Customizable styles
|
|
196
|
-
│ ├── button.spec.ts # Unit tests
|
|
197
|
-
│ ├── button.stories.ts # Storybook documentation
|
|
198
|
-
│ ├── index.ts # Barrel exports
|
|
199
|
-
│ └── README.md # Component-specific docs
|
|
200
|
-
└── input/
|
|
201
|
-
├── input.ts
|
|
202
|
-
├── input.scss
|
|
203
|
-
├── input.spec.ts
|
|
204
|
-
├── input.stories.ts
|
|
205
|
-
├── index.ts
|
|
206
|
-
└── README.md
|
|
207
|
-
```
|
|
111
|
+
### Examples
|
|
208
112
|
|
|
209
|
-
|
|
113
|
+
**Interactive mode (Recommended):**
|
|
210
114
|
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
import { ZenInput } from './ui/input';
|
|
115
|
+
```bash
|
|
116
|
+
ng generate @ng-zen/cli:ui
|
|
117
|
+
```
|
|
215
118
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
<form>
|
|
221
|
-
<zen-input placeholder="Enter email" type="email" />
|
|
222
|
-
<button variant="primary" zen-button>Sign In</button>
|
|
223
|
-
</form>
|
|
224
|
-
`,
|
|
225
|
-
})
|
|
226
|
-
export class LoginComponent {}
|
|
119
|
+
**Generate specific components to a custom path:**
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
ng generate @ng-zen/cli:ui ./src/app/shared/components --ui avatar badge card
|
|
227
123
|
```
|
|
228
124
|
|
|
229
|
-
|
|
125
|
+
**Generate components with Storybook files:**
|
|
230
126
|
|
|
231
|
-
|
|
127
|
+
```bash
|
|
128
|
+
ng generate @ng-zen/cli:ui --ui button input --stories
|
|
129
|
+
```
|
|
232
130
|
|
|
233
|
-
|
|
234
|
-
- Maintain design system compliance across projects
|
|
235
|
-
- Avoid vendor lock-in with owned source code
|
|
131
|
+
## 🧩 Available UIs
|
|
236
132
|
|
|
237
|
-
###
|
|
133
|
+
### Forms & Inputs
|
|
238
134
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
135
|
+
| Component | Description | Features |
|
|
136
|
+
| ---------------- | --------------------- | ---------------------------------------------------------------- |
|
|
137
|
+
| **Checkbox** | Form checkboxes | Indeterminate state, custom styling, validation |
|
|
138
|
+
| **Form Control** | Form field wrapper | Labels, validation messages, required indicators |
|
|
139
|
+
| **Input** | Text input fields | Validation states, prefixes/suffixes, types |
|
|
140
|
+
| **Radio** | Form radio buttons | Group selection, two-way binding, custom styling, disabled state |
|
|
141
|
+
| **Switch** | Toggle controls | On/off states, disabled state, custom labels |
|
|
142
|
+
| **Textarea** | Multi-line text input | Auto-resize, character counts, validation |
|
|
242
143
|
|
|
243
|
-
###
|
|
144
|
+
### Data Display
|
|
244
145
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
146
|
+
| Component | Description | Features |
|
|
147
|
+
| ----------- | -------------------------------- | ------------------------------------------------------------------------------ |
|
|
148
|
+
| **Avatar** | User profile images and initials | Image fallback, size variants, rounded styles |
|
|
149
|
+
| **Badge** | Status indicators and labels | 6 variants, icons support, focus-visible ring |
|
|
150
|
+
| **Card** | Content container | Multi-slot projection (header, title, subtitle, footer), CSS custom properties |
|
|
151
|
+
| **Divider** | Visual separators | Horizontal/vertical, with labels, custom thickness |
|
|
152
|
+
| **Icon** | SVG icon system | Built to support any SVG icon library. Size variants, colors |
|
|
248
153
|
|
|
249
|
-
###
|
|
154
|
+
### Feedback
|
|
250
155
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
156
|
+
| Component | Description | Features |
|
|
157
|
+
| ------------ | ---------------------- | ---------------------------------------- |
|
|
158
|
+
| **Alert** | Informational messages | Customizable styles, dismissible options |
|
|
159
|
+
| **Skeleton** | Loading placeholders | Multiple shapes, animation, responsive |
|
|
254
160
|
|
|
255
|
-
|
|
161
|
+
### Actions & Overlays
|
|
256
162
|
|
|
257
|
-
|
|
163
|
+
| Component | Description | Features |
|
|
164
|
+
| ----------- | ---------------------------- | ------------------------------------------------------------------------- |
|
|
165
|
+
| **Button** | Interactive buttons | Primary/secondary variants, loading states, icons |
|
|
166
|
+
| **Dialog** | Native modal dialogs | Native dialog element, service API, size variants, backdrop config |
|
|
167
|
+
| **Popover** | Native Popover API directive | Template/string content, placements, click toggle, CSS anchor positioning |
|
|
258
168
|
|
|
259
|
-
|
|
260
|
-
- **OnPush Change Detection:** Optimized performance
|
|
261
|
-
- **Angular Signals:** Reactive state management
|
|
262
|
-
- **TypeScript 5.8+:** Latest language features
|
|
169
|
+
## 🎨 Customization
|
|
263
170
|
|
|
264
|
-
|
|
171
|
+
Every generated component utilizes CSS variables for immediate theming without touching the core logic. Overwrite them globally or locally:
|
|
265
172
|
|
|
266
173
|
```scss
|
|
267
|
-
|
|
174
|
+
/* styles.scss */
|
|
268
175
|
:root {
|
|
269
|
-
|
|
270
|
-
--zen-
|
|
271
|
-
--zen-
|
|
176
|
+
/* Global theme variables */
|
|
177
|
+
--zen-primary: hsl(221deg 83% 53%);
|
|
178
|
+
--zen-transition-duration: 0.3s;
|
|
179
|
+
--zen-outline: 2px solid hsl(221deg 83% 53% / 50%);
|
|
180
|
+
|
|
181
|
+
/* Component-specific overrides */
|
|
182
|
+
--zen-button-primary: hsl(221deg 83% 40%);
|
|
183
|
+
--zen-button-shadow: 0 4px 6px hsl(0deg 0% 0% / 15%);
|
|
272
184
|
}
|
|
273
185
|
```
|
|
274
186
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
- **Vitest Ready:** All tests use Vitest framework for fast, modern unit testing
|
|
278
|
-
- **Component Testing:** Isolated unit tests for each component
|
|
279
|
-
- **Storybook Testing:** Visual testing and documentation
|
|
280
|
-
|
|
281
|
-
### **Development Tools**
|
|
282
|
-
|
|
283
|
-
- **ESLint Integration:** Code quality enforcement
|
|
284
|
-
- **Prettier Support:** Consistent code formatting
|
|
285
|
-
- **Husky Hooks:** Pre-commit validation
|
|
286
|
-
|
|
287
|
-
## 📚 Documentation
|
|
288
|
-
|
|
289
|
-
- **📖 [Live Storybook Demo](https://kstepien3.github.io/ng-zen/)** - Interactive component examples
|
|
290
|
-
- **🔧 [Development Guide](https://github.com/kstepien3/ng-zen/blob/master/DEVELOPMENT.md)** - Setup and contribution workflow
|
|
291
|
-
- **🤝 [Contributing Guide](https://github.com/kstepien3/ng-zen/blob/master/CONTRIBUTING.md)** - How to contribute to the project
|
|
292
|
-
- **📝 [Changelog](https://github.com/kstepien3/ng-zen/blob/master/CHANGELOG.md)** - Version history and breaking changes
|
|
293
|
-
- **💬 Component READMEs** - Detailed docs generated with each component
|
|
294
|
-
|
|
295
|
-
## 🚧 Project Status
|
|
296
|
-
|
|
297
|
-
**🟢 Actively Developed & Production Ready**
|
|
298
|
-
|
|
299
|
-
- ✅ **Core Features:** Component generation is stable and tested
|
|
300
|
-
- ✅ **Angular 20+ Support:** Compatible with latest Angular versions
|
|
301
|
-
- 🔄 **Continuous Improvement:** Regular updates and new components
|
|
302
|
-
- 📋 **Roadmap:** Directives, pipes, services, and more UI components planned
|
|
303
|
-
|
|
304
|
-
### Release Channels
|
|
305
|
-
|
|
306
|
-
- **`@ng-zen/cli`** - Stable releases from `master` branch
|
|
307
|
-
- **`@ng-zen/cli@next`** - Pre-releases from `next` branch with latest features
|
|
308
|
-
|
|
309
|
-
> **Important:** Since @ng-zen/cli generates code into your project, you own that code completely. Updates to the CLI primarily add new features and components - they won't break your existing generated components.
|
|
310
|
-
|
|
311
|
-
## 🤝 Contributing
|
|
187
|
+
For structural changes (e.g., modifying the default `0.625rem` border radius or internal padding), simply edit the generated `.scss` files in your `./ui` directory.
|
|
312
188
|
|
|
313
|
-
|
|
189
|
+
## 🏛️ Philosophy & Architecture
|
|
314
190
|
|
|
315
|
-
|
|
316
|
-
- 💡 **Feature Requests** - Suggest new components or capabilities
|
|
317
|
-
- 🔧 **Code Contributions** - Add features or fix issues
|
|
318
|
-
- 📚 **Documentation** - Improve guides and examples
|
|
191
|
+
### Perfect For
|
|
319
192
|
|
|
320
|
-
|
|
193
|
+
- **Enterprise Teams:** Build consistent internal design systems without vendor lock-in.
|
|
194
|
+
- **Startup Projects:** Rapid prototyping with components that can be easily customized as requirements scale.
|
|
195
|
+
- **Angular Developers:** Maintain full control over component behavior while enforcing modern Angular patterns (Signals, Signal Forms, Standalone).
|
|
321
196
|
|
|
322
|
-
|
|
197
|
+
### Advanced Details
|
|
323
198
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
199
|
+
- **Zero Configuration:** Works seamlessly with standard Angular CLI workspaces.
|
|
200
|
+
- **Reactive by Design:** Built from the ground up to utilize Angular Signals for state management, making integration with modern state libraries and Signal Forms seamless.
|
|
201
|
+
- **Continuous Updates:** Updating `@ng-zen/cli` brings new features and component blueprints, but will **never** overwrite or break your already generated code.
|
|
202
|
+
- **Icon Agnostic:** The optional `zen-icon` is built to be completely library-agnostic. While `@hugeicons/core-free-icons` is used in examples, you can integrate it with any SVG icon provider.
|
|
328
203
|
|
|
329
|
-
##
|
|
204
|
+
## 🤝 Community & Contributions
|
|
330
205
|
|
|
331
|
-
|
|
206
|
+
**Built by developers, for developers.**
|
|
332
207
|
|
|
333
|
-
|
|
208
|
+
This project is actively developed and shaped by community feedback. We are highly open to suggestions, new features, and improvements.
|
|
334
209
|
|
|
335
|
-
**
|
|
336
|
-
|
|
337
|
-
-
|
|
338
|
-
- 💼 LinkedIn: [Konrad Stępień](https://www.linkedin.com/in/konradstepien/)
|
|
339
|
-
- 📧 Email: [kord.stp@gmail.com](mailto:kord.stp@gmail.com?subject=%5BNG-ZEN%5D%20Question)
|
|
340
|
-
|
|
341
|
-
## See Also
|
|
342
|
-
|
|
343
|
-
- **[ngx-schematic-builder](https://github.com/kstepien3/ngx-schematic-builder)** - Custom Angular builder for compiling schematics (used by this project)
|
|
344
|
-
|
|
345
|
-
## FAQ
|
|
346
|
-
|
|
347
|
-
### ❓ **How is this different from Angular Material or PrimeNG?**
|
|
348
|
-
|
|
349
|
-
Traditional UI libraries give you pre-compiled components that you can't modify. @ng-zen/cli generates the actual source code into your project, so you have complete control. You can modify the TypeScript, HTML, and SCSS files however you need.
|
|
350
|
-
|
|
351
|
-
### ❓ **Can I customize the generated components?**
|
|
352
|
-
|
|
353
|
-
Absolutely! That's the whole point. Every component is generated as editable source code in your project. You can:
|
|
354
|
-
|
|
355
|
-
- Modify the TypeScript logic
|
|
356
|
-
- Change the HTML templates
|
|
357
|
-
- Customize the SCSS styles
|
|
358
|
-
- Extend functionality as needed
|
|
359
|
-
|
|
360
|
-
### ❓ **What happens when I update @ng-zen/cli?**
|
|
361
|
-
|
|
362
|
-
Updates to the CLI add new features and components but don't affect your already-generated code. Your components belong to you and won't be overwritten. You can always generate new components with the latest features.
|
|
363
|
-
|
|
364
|
-
### ❓ **Does this work with existing Angular projects?**
|
|
365
|
-
|
|
366
|
-
Yes! @ng-zen/cli works with any Angular 20+ project. Just run `ng add @ng-zen/cli` in your existing project and start generating components.
|
|
367
|
-
|
|
368
|
-
### ❓ **Can I use this in production?**
|
|
369
|
-
|
|
370
|
-
Definitely! The generated components are production-ready with:
|
|
371
|
-
|
|
372
|
-
- Full TypeScript type safety
|
|
373
|
-
- Comprehensive unit tests
|
|
374
|
-
- Optimized performance (OnPush change detection)
|
|
375
|
-
- Accessibility considerations
|
|
376
|
-
- Modern Angular best practices
|
|
377
|
-
|
|
378
|
-
### ❓ **How do I theme the components?**
|
|
379
|
-
|
|
380
|
-
Components use CSS variables for easy theming:
|
|
381
|
-
|
|
382
|
-
```scss
|
|
383
|
-
:root {
|
|
384
|
-
--zen-primary-color: #your-brand-color;
|
|
385
|
-
--zen-border-radius: 8px;
|
|
386
|
-
}
|
|
387
|
-
```
|
|
210
|
+
- **Missing a component?** Open a feature request.
|
|
211
|
+
- **Found a bug?** Submit an issue.
|
|
212
|
+
- **Have an idea?** Start a discussion.
|
|
388
213
|
|
|
389
|
-
|
|
214
|
+
We prioritize community requests in our roadmap. [Report issues or suggest features here](https://github.com/kstepien3/ng-zen/issues).
|
|
390
215
|
|
|
391
|
-
|
|
216
|
+
## 📚 Documentation & Links
|
|
392
217
|
|
|
393
|
-
|
|
218
|
+
- **📖 [Live Storybook Demo](https://kstepien3.github.io/ng-zen/)** - Interactive examples
|
|
219
|
+
- **🤝 [Contributing Guide](https://github.com/kstepien3/ng-zen/blob/master/CONTRIBUTING.md)** - Workflow & bug reporting
|
|
220
|
+
- **📝 [Releases & Changelog](https://github.com/kstepien3/ng-zen/releases)** - Version history and release notes
|
|
221
|
+
- **📦 [ngx-schematic-builder](https://github.com/kstepien3/ngx-schematic-builder)** - Custom compiler for this project
|
|
394
222
|
|
|
395
223
|
---
|
|
396
224
|
|
|
397
|
-
**
|
|
225
|
+
**License:** [BSD 2-Clause](https://github.com/kstepien3/ng-zen/blob/master/LICENSE)
|
|
226
|
+
**Maintainer:** Konrad Stępień ([@kstepien3](https://github.com/kstepien3))
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ng-zen/cli",
|
|
3
|
-
"version": "22.
|
|
4
|
-
"description": "Angular
|
|
3
|
+
"version": "22.3.0-next.2",
|
|
4
|
+
"description": "Angular CLI generator for creating fully customizable UI components.",
|
|
5
5
|
"license": "BSD-2-Clause",
|
|
6
6
|
"private": false,
|
|
7
7
|
"repository": {
|
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
},
|
|
19
19
|
"homepage": "https://kstepien3.github.io/ng-zen/",
|
|
20
20
|
"keywords": [
|
|
21
|
+
"shadcn",
|
|
22
|
+
"shadcn-ui",
|
|
23
|
+
"shadcn-angular",
|
|
21
24
|
"angular",
|
|
22
25
|
"angular-ui",
|
|
23
26
|
"ui-kit",
|
|
@@ -47,6 +50,7 @@
|
|
|
47
50
|
"ui components cli",
|
|
48
51
|
"alert",
|
|
49
52
|
"avatar",
|
|
53
|
+
"badge",
|
|
50
54
|
"button",
|
|
51
55
|
"card",
|
|
52
56
|
"checkbox",
|
|
@@ -66,7 +70,6 @@
|
|
|
66
70
|
},
|
|
67
71
|
"schematics": "./schematics/collection.json",
|
|
68
72
|
"packageManager": "pnpm@10.24.0",
|
|
69
|
-
"peerDependencies": {},
|
|
70
73
|
"dependencies": {
|
|
71
74
|
"@angular-devkit/core": "^22.0.1",
|
|
72
75
|
"@angular-devkit/schematics": "^22.0.1",
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
|
|
3
|
+
$transition-duration: var(--zen-transition-duration, 0.2s);
|
|
4
|
+
$outline: var(--zen-outline, 2px solid hsl(200deg 100% 50% / 50%));
|
|
5
|
+
|
|
6
|
+
:host {
|
|
7
|
+
--zen-badge-shadow: 0 1px 2px hsl(0deg 0% 0% / 8%);
|
|
8
|
+
--zen-badge-neutral: var(--zen-neutral, hsl(30deg 5% 10%));
|
|
9
|
+
--zen-badge-primary: var(--zen-primary, hsl(193deg 58% 34%));
|
|
10
|
+
--zen-badge-success: var(--zen-success, hsl(142deg 38% 36%));
|
|
11
|
+
--zen-badge-warning: var(--zen-warning, hsl(36deg 72% 46%));
|
|
12
|
+
--zen-badge-danger: var(--zen-danger, hsl(348deg 52% 42%));
|
|
13
|
+
--zen-badge-info: var(--zen-info, hsl(214deg 34% 46%));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
$colors: (
|
|
17
|
+
primary: var(--zen-badge-primary),
|
|
18
|
+
success: var(--zen-badge-success),
|
|
19
|
+
warning: var(--zen-badge-warning),
|
|
20
|
+
danger: var(--zen-badge-danger),
|
|
21
|
+
info: var(--zen-badge-info),
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
// Ghost variant opacity levels
|
|
25
|
+
$ghost-hover-opacity: 10%;
|
|
26
|
+
$ghost-active-opacity: 20%;
|
|
27
|
+
|
|
28
|
+
:host {
|
|
29
|
+
--zen-badge-bg-color: var(--zen-badge-neutral);
|
|
30
|
+
|
|
31
|
+
display: inline-flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
height: 1rem;
|
|
35
|
+
width: fit-content;
|
|
36
|
+
flex-shrink: 0;
|
|
37
|
+
gap: 0.25rem;
|
|
38
|
+
overflow: hidden;
|
|
39
|
+
border-radius: 625rem;
|
|
40
|
+
border: 1px solid transparent;
|
|
41
|
+
padding: 0.0625rem 0.5rem;
|
|
42
|
+
font-size: 0.75rem;
|
|
43
|
+
font-weight: 500;
|
|
44
|
+
line-height: 1;
|
|
45
|
+
white-space: nowrap;
|
|
46
|
+
transition:
|
|
47
|
+
background-color $transition-duration ease,
|
|
48
|
+
color $transition-duration ease,
|
|
49
|
+
border-color $transition-duration ease;
|
|
50
|
+
user-select: none;
|
|
51
|
+
background-color: var(--zen-badge-bg-color);
|
|
52
|
+
color: var(--zen-badge-color, contrast-color(var(--zen-badge-bg-color)));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
:host:focus-visible {
|
|
56
|
+
outline: $outline;
|
|
57
|
+
outline-offset: 2px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
:host > ::ng-deep svg {
|
|
61
|
+
pointer-events: none;
|
|
62
|
+
width: 0.75rem;
|
|
63
|
+
height: 0.75rem;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
:host([disabled]) {
|
|
67
|
+
opacity: 0.6;
|
|
68
|
+
pointer-events: none;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// --- COLORS ---
|
|
72
|
+
@each $name, $bg-color in $colors {
|
|
73
|
+
:host([data-color='#{$name}']) {
|
|
74
|
+
--zen-badge-bg-color: #{$bg-color};
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// --- VARIANTS ---
|
|
79
|
+
|
|
80
|
+
/* Outline variant */
|
|
81
|
+
:host([data-variant='outline']) {
|
|
82
|
+
background-color: transparent;
|
|
83
|
+
color: var(--zen-badge-bg-color);
|
|
84
|
+
border-color: var(--zen-badge-bg-color);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* Filled variant */
|
|
88
|
+
:host([data-variant='filled']) {
|
|
89
|
+
background-color: color-mix(in oklch, var(--zen-badge-bg-color) 8%, transparent);
|
|
90
|
+
color: var(--zen-badge-bg-color);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* Ghost variant */
|
|
94
|
+
:host([data-variant='ghost']) {
|
|
95
|
+
background-color: transparent;
|
|
96
|
+
color: var(--zen-badge-bg-color);
|
|
97
|
+
box-shadow: none;
|
|
98
|
+
|
|
99
|
+
&:hover {
|
|
100
|
+
background-color: color-mix(in oklch, var(--zen-badge-bg-color) $ghost-hover-opacity, transparent);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&:active {
|
|
104
|
+
background-color: color-mix(in oklch, var(--zen-badge-bg-color) $ghost-active-opacity, transparent);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { provideZonelessChangeDetection } from '@angular/core';
|
|
2
|
+
import { TestBed } from '@angular/core/testing';
|
|
3
|
+
import { beforeEach, describe, expect, it } from 'vitest';
|
|
4
|
+
|
|
5
|
+
import { ZenBadge } from './badge';
|
|
6
|
+
|
|
7
|
+
describe('ZenBadge', () => {
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
await TestBed.configureTestingModule({
|
|
10
|
+
imports: [ZenBadge],
|
|
11
|
+
providers: [provideZonelessChangeDetection()],
|
|
12
|
+
}).compileComponents();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('should create', () => {
|
|
16
|
+
const fixture = TestBed.createComponent(ZenBadge);
|
|
17
|
+
const component = fixture.componentInstance;
|
|
18
|
+
expect(component).toBeTruthy();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('should have default color neutral', () => {
|
|
22
|
+
const fixture = TestBed.createComponent(ZenBadge);
|
|
23
|
+
fixture.detectChanges();
|
|
24
|
+
const badge = fixture.nativeElement as HTMLElement;
|
|
25
|
+
expect(badge.getAttribute('data-color')).toBe('neutral');
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('should have default variant solid', () => {
|
|
29
|
+
const fixture = TestBed.createComponent(ZenBadge);
|
|
30
|
+
fixture.detectChanges();
|
|
31
|
+
const badge = fixture.nativeElement as HTMLElement;
|
|
32
|
+
expect(badge.getAttribute('data-variant')).toBe('solid');
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const colors = ['neutral', 'primary', 'success', 'warning', 'danger', 'info'] as const;
|
|
36
|
+
|
|
37
|
+
for (const color of colors) {
|
|
38
|
+
it(`should apply color ${color}`, () => {
|
|
39
|
+
const fixture = TestBed.createComponent(ZenBadge);
|
|
40
|
+
fixture.componentRef.setInput('color', color);
|
|
41
|
+
fixture.detectChanges();
|
|
42
|
+
const badge = fixture.nativeElement as HTMLElement;
|
|
43
|
+
expect(badge.getAttribute('data-color')).toBe(color);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const variants = ['solid', 'outline', 'filled', 'ghost'] as const;
|
|
48
|
+
|
|
49
|
+
for (const variant of variants) {
|
|
50
|
+
it(`should apply variant ${variant}`, () => {
|
|
51
|
+
const fixture = TestBed.createComponent(ZenBadge);
|
|
52
|
+
fixture.componentRef.setInput('variant', variant);
|
|
53
|
+
fixture.detectChanges();
|
|
54
|
+
const badge = fixture.nativeElement as HTMLElement;
|
|
55
|
+
expect(badge.getAttribute('data-variant')).toBe(variant);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
});
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { FavouriteIcon } from '@hugeicons/core-free-icons';
|
|
2
|
+
import { argsToTemplate, Meta, moduleMetadata, StoryObj } from '@storybook/angular';
|
|
3
|
+
|
|
4
|
+
import { ZenIcon } from '../icon';
|
|
5
|
+
import { ZenBadge } from './badge';
|
|
6
|
+
|
|
7
|
+
interface StoryParams {
|
|
8
|
+
color: 'neutral' | 'primary' | 'success' | 'warning' | 'danger' | 'info';
|
|
9
|
+
variant: 'solid' | 'filled' | 'outline' | 'ghost';
|
|
10
|
+
label: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
type Options = ZenBadge & StoryParams;
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
title: 'Ui/Badge',
|
|
17
|
+
component: ZenBadge,
|
|
18
|
+
args: {
|
|
19
|
+
label: 'Badge',
|
|
20
|
+
color: 'neutral',
|
|
21
|
+
variant: 'solid',
|
|
22
|
+
},
|
|
23
|
+
argTypes: {
|
|
24
|
+
label: {
|
|
25
|
+
control: 'text',
|
|
26
|
+
table: {
|
|
27
|
+
category: 'story parameters',
|
|
28
|
+
type: {
|
|
29
|
+
summary: 'ng-content',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
color: {
|
|
34
|
+
control: 'select',
|
|
35
|
+
options: ['neutral', 'primary', 'success', 'warning', 'danger', 'info'],
|
|
36
|
+
},
|
|
37
|
+
variant: {
|
|
38
|
+
control: 'select',
|
|
39
|
+
options: ['solid', 'filled', 'outline', 'ghost'],
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
render: ({ label, ...args }) => ({
|
|
43
|
+
props: args,
|
|
44
|
+
template: `<zen-badge ${argsToTemplate(args)}>${label}</zen-badge>`,
|
|
45
|
+
}),
|
|
46
|
+
} satisfies Meta<Options>;
|
|
47
|
+
|
|
48
|
+
type Story = StoryObj<Options>;
|
|
49
|
+
|
|
50
|
+
export const Default: Story = {};
|
|
51
|
+
|
|
52
|
+
export const WithIcon: Story = {
|
|
53
|
+
decorators: [moduleMetadata({ imports: [ZenIcon] })],
|
|
54
|
+
render: () => ({
|
|
55
|
+
props: { FavouriteIcon },
|
|
56
|
+
template: `
|
|
57
|
+
<div style="display: flex; gap: 0.5rem; flex-wrap: wrap">
|
|
58
|
+
<zen-badge color="primary">
|
|
59
|
+
<zen-icon [icon]="FavouriteIcon" [size]="12" [strokeWidth]="3" />
|
|
60
|
+
With Icon
|
|
61
|
+
</zen-badge>
|
|
62
|
+
<zen-badge variant="outline" color="primary">
|
|
63
|
+
<zen-icon [icon]="FavouriteIcon" [size]="12" [strokeWidth]="3" />
|
|
64
|
+
Outline
|
|
65
|
+
</zen-badge>
|
|
66
|
+
</div>
|
|
67
|
+
`,
|
|
68
|
+
}),
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const AllVariants: Story = {
|
|
72
|
+
render: () => ({
|
|
73
|
+
template: `
|
|
74
|
+
<div style="display: flex; gap: 0.5rem">
|
|
75
|
+
<zen-badge variant="solid">Solid</zen-badge>
|
|
76
|
+
<zen-badge variant="filled">Filled</zen-badge>
|
|
77
|
+
<zen-badge variant="outline">Outline</zen-badge>
|
|
78
|
+
<zen-badge variant="ghost">Ghost</zen-badge>
|
|
79
|
+
</div>
|
|
80
|
+
`,
|
|
81
|
+
}),
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export const AllColorVariants: Story = {
|
|
85
|
+
render: () => ({
|
|
86
|
+
template: `
|
|
87
|
+
<div style="display: flex; flex-direction: column; gap: 1rem;">
|
|
88
|
+
<!-- Default (No color attribute) -->
|
|
89
|
+
<div style="display: flex; gap: 0.5rem;">
|
|
90
|
+
<zen-badge variant="solid">Solid</zen-badge>
|
|
91
|
+
<zen-badge variant="filled">Filled</zen-badge>
|
|
92
|
+
<zen-badge variant="outline">Outline</zen-badge>
|
|
93
|
+
<zen-badge variant="ghost">Ghost</zen-badge>
|
|
94
|
+
</div>
|
|
95
|
+
|
|
96
|
+
<!-- Primary -->
|
|
97
|
+
<div style="display: flex; gap: 0.5rem;">
|
|
98
|
+
<zen-badge color="primary" variant="solid">Solid</zen-badge>
|
|
99
|
+
<zen-badge color="primary" variant="filled">Filled</zen-badge>
|
|
100
|
+
<zen-badge color="primary" variant="outline">Outline</zen-badge>
|
|
101
|
+
<zen-badge color="primary" variant="ghost">Ghost</zen-badge>
|
|
102
|
+
</div>
|
|
103
|
+
|
|
104
|
+
<!-- Success -->
|
|
105
|
+
<div style="display: flex; gap: 0.5rem;">
|
|
106
|
+
<zen-badge color="success" variant="solid">Solid</zen-badge>
|
|
107
|
+
<zen-badge color="success" variant="filled">Filled</zen-badge>
|
|
108
|
+
<zen-badge color="success" variant="outline">Outline</zen-badge>
|
|
109
|
+
<zen-badge color="success" variant="ghost">Ghost</zen-badge>
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
<!-- Warning -->
|
|
113
|
+
<div style="display: flex; gap: 0.5rem;">
|
|
114
|
+
<zen-badge color="warning" variant="solid">Solid</zen-badge>
|
|
115
|
+
<zen-badge color="warning" variant="filled">Filled</zen-badge>
|
|
116
|
+
<zen-badge color="warning" variant="outline">Outline</zen-badge>
|
|
117
|
+
<zen-badge color="warning" variant="ghost">Ghost</zen-badge>
|
|
118
|
+
</div>
|
|
119
|
+
|
|
120
|
+
<!-- Danger -->
|
|
121
|
+
<div style="display: flex; gap: 0.5rem;">
|
|
122
|
+
<zen-badge color="danger" variant="solid">Solid</zen-badge>
|
|
123
|
+
<zen-badge color="danger" variant="filled">Filled</zen-badge>
|
|
124
|
+
<zen-badge color="danger" variant="outline">Outline</zen-badge>
|
|
125
|
+
<zen-badge color="danger" variant="ghost">Ghost</zen-badge>
|
|
126
|
+
</div>
|
|
127
|
+
|
|
128
|
+
<!-- Info -->
|
|
129
|
+
<div style="display: flex; gap: 0.5rem;">
|
|
130
|
+
<zen-badge color="info" variant="solid">Solid</zen-badge>
|
|
131
|
+
<zen-badge color="info" variant="filled">Filled</zen-badge>
|
|
132
|
+
<zen-badge color="info" variant="outline">Outline</zen-badge>
|
|
133
|
+
<zen-badge color="info" variant="ghost">Ghost</zen-badge>
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
136
|
+
`,
|
|
137
|
+
}),
|
|
138
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Component, input } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'zen-badge',
|
|
5
|
+
template: '<ng-content />',
|
|
6
|
+
styleUrl: './badge.scss',
|
|
7
|
+
host: {
|
|
8
|
+
'[attr.data-color]': 'color()',
|
|
9
|
+
'[attr.data-variant]': 'variant()',
|
|
10
|
+
},
|
|
11
|
+
})
|
|
12
|
+
export class ZenBadge {
|
|
13
|
+
readonly color = input<'neutral' | 'primary' | 'success' | 'warning' | 'danger' | 'info'>('neutral');
|
|
14
|
+
readonly variant = input<'solid' | 'outline' | 'filled' | 'ghost'>('solid');
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './badge';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Meta, moduleMetadata, StoryObj } from '@storybook/angular';
|
|
2
2
|
|
|
3
3
|
import { ZenButton } from '../button';
|
|
4
|
+
import { ZenInput } from '../input';
|
|
4
5
|
import { ZenCard } from './card';
|
|
5
6
|
|
|
6
7
|
interface StoryParams {
|
|
@@ -14,7 +15,7 @@ type Options = ZenCard & StoryParams;
|
|
|
14
15
|
export default {
|
|
15
16
|
title: 'Ui/Card',
|
|
16
17
|
component: ZenCard,
|
|
17
|
-
decorators: [moduleMetadata({ imports: [ZenButton] })],
|
|
18
|
+
decorators: [moduleMetadata({ imports: [ZenButton, ZenInput] })],
|
|
18
19
|
args: {
|
|
19
20
|
content: 'This is the card content.',
|
|
20
21
|
title: 'Card Title',
|
|
@@ -122,8 +123,8 @@ export const LoginForm: Story = {
|
|
|
122
123
|
<h3 card-title>Login to your account</h3>
|
|
123
124
|
<p card-subtitle>Enter your email below to login to your account</p>
|
|
124
125
|
<div style="display: grid; gap: 0.75rem;">
|
|
125
|
-
<input type="email" placeholder="Email"
|
|
126
|
-
<input type="password" placeholder="Password"
|
|
126
|
+
<zen-input type="email" placeholder="Email" />
|
|
127
|
+
<zen-input type="password" placeholder="Password" />
|
|
127
128
|
<a href="#" style="font-size: 0.75rem; color: hsl(0deg 0% 40%); text-align: right;">Forgot your password?</a>
|
|
128
129
|
</div>
|
|
129
130
|
<div card-footer style="display: flex; flex-direction: column; gap: 0.5rem;">
|
|
@@ -10,6 +10,11 @@ $error: var(--zen-error, hsl(0deg 70% 50%));
|
|
|
10
10
|
--zen-input-placeholder-color: hsl(0deg 0% 60%);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
/* stylelint-disable-next-line no-duplicate-selectors -- separate variables and styles */
|
|
14
|
+
:host {
|
|
15
|
+
display: contents;
|
|
16
|
+
}
|
|
17
|
+
|
|
13
18
|
input {
|
|
14
19
|
border: var(--zen-input-border);
|
|
15
20
|
border-radius: var(--zen-input-border-radius);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../src/schematics/ui/schema.ts"],"names":[],"mappings":"","sourcesContent":["import { Path } from '@angular-devkit/core';\n\nexport interface GeneratorSchemaBase {\n currentDirectory: Path;\n path?: Path;\n stories: boolean;\n project?: string;\n}\n\nexport type UiType =\n | 'alert'\n | 'avatar'\n | 'button'\n | 'card'\n | 'checkbox'\n | 'dialog'\n | 'divider'\n | 'form-control'\n | 'icon'\n | 'input'\n | 'popover'\n | 'radio'\n | 'skeleton'\n | 'switch'\n | 'textarea';\n\nexport interface Schema extends GeneratorSchemaBase {\n ui: UiType[];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../src/schematics/ui/schema.ts"],"names":[],"mappings":"","sourcesContent":["import { Path } from '@angular-devkit/core';\n\nexport interface GeneratorSchemaBase {\n currentDirectory: Path;\n path?: Path;\n stories: boolean;\n project?: string;\n}\n\nexport type UiType =\n | 'alert'\n | 'avatar'\n | 'badge'\n | 'button'\n | 'card'\n | 'checkbox'\n | 'dialog'\n | 'divider'\n | 'form-control'\n | 'icon'\n | 'input'\n | 'popover'\n | 'radio'\n | 'skeleton'\n | 'switch'\n | 'textarea';\n\nexport interface Schema extends GeneratorSchemaBase {\n ui: UiType[];\n}\n"]}
|