@ng-zen/cli 20.2.0 → 20.2.1-next.1

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 CHANGED
@@ -1,3 +1,14 @@
1
+ ## [20.2.1-next.1](https://github.com/kstepien3/ng-zen/compare/v20.2.0...v20.2.1-next.1) (2025-08-29)
2
+
3
+ ### 🐛 Bug Fixes
4
+
5
+ * **button:** improve styles to detect disabled states ([#283](https://github.com/kstepien3/ng-zen/issues/283)) ([757108f](https://github.com/kstepien3/ng-zen/commit/757108f9b455d699f416d893c027209d3fa9cbc0))
6
+ * **form-control:** move placeholder into the input component ([#277](https://github.com/kstepien3/ng-zen/issues/277)) ([aec69b4](https://github.com/kstepien3/ng-zen/commit/aec69b43575556b29d6256f1b3fbd61ae7eae515))
7
+
8
+ ### 🛠️ Code Refactor
9
+
10
+ * remove unnecessary standalone property ([#290](https://github.com/kstepien3/ng-zen/issues/290)) ([d984f17](https://github.com/kstepien3/ng-zen/commit/d984f174ed7e25febaf3c908cb14573f3eaf7dee))
11
+
1
12
  ## [20.2.0](https://github.com/kstepien3/ng-zen/compare/v20.1.0...v20.2.0) (2025-08-18)
2
13
 
3
14
  ### 🚀 New Features
package/README.md CHANGED
@@ -1,168 +1,360 @@
1
- # @ng-zen/cli
1
+ <div align="center">
2
+ <a href="https://kstepien3.github.io/ng-zen/">
3
+ <img src="https://raw.githubusercontent.com/kstepien3/ng-zen/master/images/logo.png" alt="@ng-zen/cli Logo" width="256" />
4
+ </a>
5
+
6
+ <h1>@ng-zen/cli</h1>
2
7
 
3
- [![Build Status ](https://img.shields.io/github/actions/workflow/status/kstepien3/ng-zen/ci.yml?branch=master&label=build)](https://github.com/kstepien3/ng-zen/actions/workflows/ci.yml)
4
- [![NPM Version ](https://img.shields.io/npm/v/@ng-zen/cli/latest?label=npm%40latest)](https://www.npmjs.com/package/@ng-zen/cli)
5
- [![License](https://img.shields.io/github/license/kstepien3/ng-zen)](https://github.com/kstepien3/ng-zen/blob/master/LICENSE)
8
+ <p style="display: flex; gap: 1rem; justify-content: center;">
9
+ <a href="https://github.com/kstepien3/ng-zen/actions/workflows/ci.yml">
10
+ <img src="https://img.shields.io/github/actions/workflow/status/kstepien3/ng-zen/ci.yml?branch=master&label=build" alt="Build Status" />
11
+ </a>
12
+ <a href="https://www.npmjs.com/package/@ng-zen/cli">
13
+ <img src="https://img.shields.io/npm/v/@ng-zen/cli/latest?label=npm%40latest" alt="NPM Version" />
14
+ </a>
15
+ <a href="https://github.com/kstepien3/ng-zen/blob/master/LICENSE">
16
+ <img src="https://img.shields.io/github/license/kstepien3/ng-zen" alt="License" />
17
+ </a>
18
+ </p>
6
19
 
7
- [![](https://img.shields.io/badge/-Repository-181818?style=flat&logo=github&logoColor=white)](https://github.com/kstepien3/ng-zen)
8
- [![](https://img.shields.io/badge/-Storybook%20Demo-FF4785?style=flat&logo=storybook&logoColor=white)](https://kstepien3.github.io/ng-zen/)
20
+ <p style="display: flex; gap: 1rem; justify-content: center;">
21
+ <a href="https://github.com/kstepien3/ng-zen">
22
+ <img src="https://img.shields.io/badge/-Repository-181818?style=flat&logo=github&logoColor=white" alt="Repository" />
23
+ </a>
24
+ <a href="https://kstepien3.github.io/ng-zen/">
25
+ <img src="https://img.shields.io/badge/-Storybook%20Demo-FF4785?style=flat&logo=storybook&logoColor=white" alt="Storybook Demo" />
26
+ </a>
27
+ </p>
9
28
 
10
- Generate modern, customizable Angular UI components and elements directly into your project 🚀
29
+ <p><strong>Generate production-ready, customizable Angular UI components directly into your project 🚀</strong></p>
11
30
 
12
- Built with the best practices and developer experience in mind 💡
31
+ <p>Stop wrestling with rigid UI libraries. @ng-zen/cli generates beautiful, modern Angular components <strong>as source code</strong> in your project, giving you complete control and ownership.</p>
32
+ </div>
33
+
34
+ ## 🎯 Why Choose @ng-zen/cli?
35
+
36
+ ### ✨ **Own Your Components**
37
+
38
+ 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.
39
+
40
+ ### 🏎️ **Instant Productivity**
41
+
42
+ - **Production-Ready Components:** Avatar, Button, Checkbox, Divider, Form Control, Icon, Input, Skeleton, Switch, Textarea
43
+ - **Zero Configuration:** Works with Angular 20+ out of the box
44
+ - **Complete Setup:** Each component includes unit tests, Storybook stories, and documentation
45
+
46
+ ### 🎨 **Built for Customization**
47
+
48
+ - **CSS Variables:** Easy theming without touching component internals
49
+ - **Editable SCSS:** Modify styles directly when you need deeper customization
50
+ - **Modern Architecture:** Standalone components, OnPush change detection, Angular signals
51
+
52
+ ### 📚 **Developer Experience First**
53
+
54
+ - **Interactive Documentation:** Live Storybook examples for every component
55
+ - **TypeScript Ready:** Full type safety and IntelliSense support
56
+ - **Test Coverage:** Generated components include comprehensive unit tests
57
+ - **JSDoc Annotations:** Detailed inline documentation
13
58
 
14
59
  ## Table of Contents
15
60
 
16
- 1. [Features](#features)
17
- 2. [Ideal for](#ideal-for)
18
- 3. [Quick Start](#quick-start)
19
- 4. [Installation](#installation)
20
- 5. [Usage](#usage)
21
- 6. [Why @ng-zen/cli?](#why-ng-zencli)
22
- 7. [Examples](#examples)
23
- 8. [Documentation](#documentation)
24
- 9. [Project Status](#project-status)
25
- 10. [Contributing](#contributing)
26
- 11. [License](#license)
27
- 12. [Author](#author)
28
- 13. [See also](#see-also)
29
- 14. [FAQ](#faq)
30
-
31
- ## Features
32
-
33
- - 🧩 **Component Schematics:** Generates ready-to-use UI component code (`.ts`, `.html`, `.scss`).
34
- - 🎨 **Fully Customizable:** Easily theme and modify components via CSS variables and editable SCSS.
35
- - 📱 **Responsive Design:** Components designed to adapt across various screen sizes.
36
- - 📚 **Comprehensive Documentation:** Includes Storybook examples, JSDoc annotations, and `README.md` per component.
37
- - ✅ **Test Coverage:** Generated components include unit tests (`.spec.ts`).
38
- - 🚀 **Modern Angular:** Leverages standalone components, `OnPush` change detection, signals, and current best practices.
39
- - 🛠 **Extensible:** Planned support for generating directives, pipes, services, and more.
40
-
41
- ## Ideal for
42
-
43
- - 🏢 **Enterprise UI Kits:** A great starting point for building consistent, internal component libraries.
44
- - 📈 **Custom Projects:** Accelerates development when custom UI elements are needed, avoiding vendor lock-in.
45
- - 👩‍💻 **Developers:** Speeds up UI creation and ensures adherence to modern Angular patterns.
46
-
47
- ## Quick Start
48
-
49
- The easiest way to add `@ng-zen/cli` and its schematics to your project:
61
+ 1. [Quick Start](#-quick-start)
62
+ 2. [Installation](#-installation)
63
+ 3. [Available Components](#-available-components)
64
+ 4. [Usage Examples](#-usage-examples)
65
+ 5. [Perfect For](#-perfect-for)
66
+ 6. [Advanced Features](#-advanced-features)
67
+ 7. [Documentation](#-documentation)
68
+ 8. [Project Status](#-project-status)
69
+ 9. [Contributing](#-contributing)
70
+ 10. [License](#license)
71
+ 11. [Author](#author)
72
+ 12. [See Also](#see-also)
73
+ 13. [FAQ](#faq)
74
+
75
+ ## 🚀 Quick Start
76
+
77
+ The fastest way to get started:
50
78
 
51
79
  ```bash
52
80
  ng add @ng-zen/cli
53
81
  ```
54
82
 
55
- This command installs the package and performs initial setup.
83
+ This command:
84
+
85
+ - ✅ Installs the package
86
+ - ✅ Sets up your project configuration
87
+ - ✅ Ready to generate components
88
+
89
+ Then generate your first component:
90
+
91
+ ```bash
92
+ ng generate @ng-zen/cli:component
93
+ ```
94
+
95
+ Select components from an interactive menu and they'll be generated directly into your current directory! 🎉
96
+
97
+ ## 📦 Installation
98
+
99
+ ### Recommended: Using ng add
56
100
 
57
- ## Installation
101
+ ```bash
102
+ ng add @ng-zen/cli
103
+ ```
58
104
 
59
- Alternatively, you can install it manually:
105
+ ### Manual Installation
60
106
 
61
107
  ```bash
62
- # For the latest stable version
108
+ # Stable version
63
109
  pnpm add -D @ng-zen/cli
64
110
 
65
- # For the latest pre-release version (includes newest features/fixes)
111
+ # Latest features and fixes
66
112
  pnpm add -D @ng-zen/cli@next
67
113
  ```
68
114
 
69
- ## Usage
115
+ ## 🧩 Available Components
116
+
117
+ | Component | Description | Features |
118
+ | ---------------- | -------------------------------- | -------------------------------------------------- |
119
+ | **Avatar** | User profile images and initials | Image fallback, size variants, rounded styles |
120
+ | **Button** | Interactive buttons | Primary/secondary variants, loading states, icons |
121
+ | **Checkbox** | Form checkboxes | Indeterminate state, custom styling, validation |
122
+ | **Divider** | Visual separators | Horizontal/vertical, with labels, custom thickness |
123
+ | **Form Control** | Form field wrapper | Labels, validation messages, required indicators |
124
+ | **Icon** | SVG icon system | Huge Icons integration, size variants, colors |
125
+ | **Input** | Text input fields | Validation states, prefixes/suffixes, types |
126
+ | **Skeleton** | Loading placeholders | Multiple shapes, animation, responsive |
127
+ | **Switch** | Toggle controls | On/off states, disabled state, custom labels |
128
+ | **Textarea** | Multi-line text input | Auto-resize, character counts, validation |
70
129
 
71
- ### Generating Components
130
+ > 💡 **More components coming soon!** Planned: Directives, Pipes, Services, and additional UI elements.
72
131
 
73
- You can create a new component in your Angular project using the `@ng-zen/cli` schematic.
132
+ ## 💡 Usage Examples
133
+
134
+ ### Basic Component Generation
74
135
 
75
136
  ```bash
137
+ # Interactive mode - choose components from a menu
76
138
  ng generate @ng-zen/cli:component
139
+
140
+ # Generate specific components
141
+ ng generate @ng-zen/cli:component --components avatar button
142
+
143
+ # Custom location
144
+ ng generate @ng-zen/cli:component ./src/app/ui --components input checkbox
145
+
146
+ # Include Storybook stories
147
+ ng generate @ng-zen/cli:component --components button --stories
77
148
  ```
78
149
 
79
- > 💡 Run the command inside a subfolder of your project, the schematic will place the new components in that directory.
150
+ ### What Gets Generated
80
151
 
81
- ### Examples
152
+ Each component set includes:
82
153
 
83
- ```bash
84
- ng generate @ng-zen/cli:component ./src/app/ui #insert an optional path
85
- ng generate @ng-zen/cli:component --components avatar button # declare components without interactive prompt
86
- ng generate @ng-zen/cli:component ./src/app/ui --components avatar button --stories # generate stories files
154
+ ```
155
+ src/app/ui/
156
+ ├── button/
157
+ │ ├── button.ts # Component logic
158
+ │ ├── button.scss # Customizable styles
159
+ │ ├── button.spec.ts # Unit tests
160
+ │ ├── button.stories.ts # Storybook documentation
161
+ │ ├── index.ts # Barrel exports
162
+ │ └── README.md # Component-specific docs
163
+ └── input/
164
+ ├── input.ts
165
+ ├── input.scss
166
+ ├── input.spec.ts
167
+ ├── input.stories.ts
168
+ ├── index.ts
169
+ └── README.md
87
170
  ```
88
171
 
89
- This interactive prompt guides you through selecting and configuring the desired component(s) 📊.
172
+ ### Real-World Usage
173
+
174
+ ```typescript
175
+ // After generation, import and use like any Angular component
176
+ import { ZenButton } from './ui/button';
177
+ import { ZenInput } from './ui/input';
178
+
179
+ @Component({
180
+ selector: 'app-login',
181
+ imports: [ZenButton, ZenInput],
182
+ template: `
183
+ <form>
184
+ <zen-input placeholder="Enter email" type="email" />
185
+ <button variant="primary" zen-button>Sign In</button>
186
+ </form>
187
+ `,
188
+ })
189
+ export class LoginComponent {}
190
+ ```
90
191
 
91
- To see available options without running interactively:
192
+ ## 🎯 Perfect For
92
193
 
93
- ```bash
94
- ng generate @ng-zen/cli:component --help
194
+ ### 🏢 **Enterprise Teams**
195
+
196
+ - Build consistent internal component libraries
197
+ - Maintain design system compliance across projects
198
+ - Avoid vendor lock-in with owned source code
199
+
200
+ ### 🚀 **Startup Projects**
201
+
202
+ - Rapid prototyping with production-ready components
203
+ - Easy customization as requirements evolve
204
+ - No licensing concerns or bundle size bloat
205
+
206
+ ### 👩‍💻 **Angular Developers**
207
+
208
+ - Learn modern Angular patterns (signals, standalone components)
209
+ - Speed up UI development workflow
210
+ - Maintain full control over component behavior
211
+
212
+ ### 🎨 **Design Systems**
213
+
214
+ - Use as foundation for custom component libraries
215
+ - Extend and modify components to match brand guidelines
216
+ - Generate consistent documentation automatically
217
+
218
+ ## ⚡ Advanced Features
219
+
220
+ ### **Modern Angular Architecture**
221
+
222
+ - **Standalone Components:** No NgModule dependencies
223
+ - **OnPush Change Detection:** Optimized performance
224
+ - **Angular Signals:** Reactive state management
225
+ - **TypeScript 5.8+:** Latest language features
226
+
227
+ ### **Customization System**
228
+
229
+ ```scss
230
+ // Easy theming with CSS variables
231
+ :root {
232
+ --zen-button-primary-bg: #your-brand-color;
233
+ --zen-button-border-radius: 8px;
234
+ --zen-button-font-weight: 600;
235
+ }
95
236
  ```
96
237
 
97
- ### Future Generators
238
+ ### **Testing Integration**
98
239
 
99
- Support for generating other Angular building blocks is planned:
240
+ - **Jest Ready:** All tests use Jest framework
241
+ - **Component Testing:** Isolated unit tests for each component
242
+ - **Storybook Testing:** Visual testing and documentation
100
243
 
101
- - 📝 Directives
102
- - 💧 Pipes
103
- - 🛠 Services
104
- - ... and more!
244
+ ### **Development Tools**
105
245
 
106
- ## Why @ng-zen/cli?
246
+ - **ESLint Integration:** Code quality enforcement
247
+ - **Prettier Support:** Consistent code formatting
248
+ - **Husky Hooks:** Pre-commit validation
107
249
 
108
- Unlike pre-compiled UI libraries, `@ng-zen/cli`:
250
+ ## 📚 Documentation
109
251
 
110
- - **Generates Source Code:** You get actual, editable component code in your project, not opaque `<library-button>` tags.
111
- - **Full Control:** Modify the generated code and styles freely to perfectly match your application's needs.
112
- - **Modern Foundation:** Built on current Angular features (standalone, signals, etc.).
113
- - **Transparency:** Understand exactly how components work and evolve them with your project.
114
- - **Developer Experience:** Focuses on ease of use, customization, and maintainability.
252
+ - **📖 [Live Storybook Demo](https://kstepien3.github.io/ng-zen/)** - Interactive component examples
253
+ - **🔧 [Development Guide](DEVELOPMENT.md)** - Setup and contribution workflow
254
+ - **🤝 [Contributing Guide](CONTRIBUTING.md)** - How to contribute to the project
255
+ - **📝 [Changelog](CHANGELOG.md)** - Version history and breaking changes
256
+ - **💬 Component READMEs** - Detailed docs generated with each component
115
257
 
116
- ## Examples
258
+ ## 🚧 Project Status
117
259
 
118
- Each generated component set includes:
260
+ **🟢 Actively Developed & Production Ready**
119
261
 
120
- - Angular component code (`.ts`, `.html`, `.scss`)
121
- - Unit tests (`.spec.ts`)
122
- - Storybook stories (`.stories.ts`) for visual development and documentation.
123
- - An `index.ts` for easy exporting.
124
- - A component-specific `README.md` (generated from a template).
262
+ - **Core Features:** Component generation is stable and tested
263
+ - **Angular 20+ Support:** Compatible with latest Angular versions
264
+ - 🔄 **Continuous Improvement:** Regular updates and new components
265
+ - 📋 **Roadmap:** Directives, pipes, services, and more UI components planned
125
266
 
126
- ## Documentation
267
+ ### Release Channels
127
268
 
128
- - **Storybook:** The primary source for visual examples and interactive demos: [View Storybook Demo](https://kstepien3.github.io/ng-zen/)
129
- - **JSDoc:** Code includes documentation comments.
130
- - **READMEs:** Project-level (`README.md`, `DEVELOPMENT.md`, `CONTRIBUTING.md`) and component-level READMEs.
131
- - **Changelog:** Automatically generated history of changes: [CHANGELOG.md](https://github.com/kstepien3/ng-zen/blob/master/CHANGELOG.md)
269
+ - **`@ng-zen/cli`** - Stable releases from `master` branch
270
+ - **`@ng-zen/cli@next`** - Pre-releases from `next` branch with latest features
132
271
 
133
- ## Project Status
272
+ > **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.
134
273
 
135
- 🚧 **Actively Developed** 🚧
274
+ ## 🤝 Contributing
136
275
 
137
- - The core schematics and existing components are functional but continuously improved.
138
- - New generators (directives, pipes, etc.) are planned.
139
- - The `master` branch represents the latest **stable** release.
140
- - The `next` branch contains **pre-release** versions with the newest features and fixes – use `@ng-zen/cli@next` to try them out.
276
+ We welcome contributions! Whether it's:
141
277
 
142
- Since the tool generates code directly into your project, you own and control that code. Updates to `@ng-zen/cli` itself primarily bring new generator features or improvements to the generation process, not breaking changes to already generated components.
278
+ - 🐛 **Bug Reports** - Help us improve reliability
279
+ - 💡 **Feature Requests** - Suggest new components or capabilities
280
+ - 🔧 **Code Contributions** - Add features or fix issues
281
+ - 📚 **Documentation** - Improve guides and examples
143
282
 
144
- ## Contributing
283
+ > 🚀 **Do you urgently need some new features? Report them in the [`issues`](https://github.com/kstepien3/ng-zen/issues) section! They will be scheduled for the next deployments.**
145
284
 
146
- Contributions are highly welcome! If you'd like to help improve `@ng-zen/cli`, please read our **[Contribution Guidelines (CONTRIBUTING.md)](https://github.com/kstepien3/ng-zen/blob/master/CONTRIBUTING.md)** for details on the workflow, commit message requirements, and setup. 🤝
285
+ **Getting Started:**
286
+
287
+ 1. Read our [Contributing Guidelines](CONTRIBUTING.md)
288
+ 2. Check the [Development Setup](DEVELOPMENT.md)
289
+ 3. Browse [open issues](https://github.com/kstepien3/ng-zen/issues)
290
+ 4. Join the discussion!
147
291
 
148
292
  ## License
149
293
 
150
- This project is licensed under the [BSD 2-Clause License](https://github.com/kstepien3/ng-zen/blob/master/LICENSE) 📜.
294
+ This project is licensed under the [BSD 2-Clause License](LICENSE) 📜.
151
295
 
152
296
  ## Author
153
297
 
154
- Maintained by Konrad Stępień.
298
+ **Konrad Stępień** - Creator & Maintainer
155
299
 
156
- - GitHub: [@kstepien3](https://github.com/kstepien3)
157
- - LinkedIn: [Konrad Stępień](https://www.linkedin.com/in/konradstepien/) 👥
158
- - Email: [kord.stp@gmail.com](mailto:kord.stp@gmail.com?subject=%5BNG-ZEN%5D%20Query) 📨
300
+ - 🐙 GitHub: [@kstepien3](https://github.com/kstepien3)
301
+ - 💼 LinkedIn: [Konrad Stępień](https://www.linkedin.com/in/konradstepien/)
302
+ - 📧 Email: [kord.stp@gmail.com](mailto:kord.stp@gmail.com?subject=%5BNG-ZEN%5D%20Question)
159
303
 
160
- ## See also
304
+ ## See Also
161
305
 
162
- - [ngx-schematic-builder](https://github.com/kstepien3/ngx-schematic-builder) - A custom Angular builder for compiling and bundling Angular schematics.
306
+ - **[ngx-schematic-builder](https://github.com/kstepien3/ngx-schematic-builder)** - Custom Angular builder for compiling schematics (used by this project)
163
307
 
164
308
  ## FAQ
165
309
 
166
- ### How do I customize a generated component?
310
+ ### ❓ **How is this different from Angular Material or PrimeNG?**
311
+
312
+ 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.
313
+
314
+ ### ❓ **Can I customize the generated components?**
315
+
316
+ Absolutely! That's the whole point. Every component is generated as editable source code in your project. You can:
317
+
318
+ - Modify the TypeScript logic
319
+ - Change the HTML templates
320
+ - Customize the SCSS styles
321
+ - Extend functionality as needed
322
+
323
+ ### ❓ **What happens when I update @ng-zen/cli?**
324
+
325
+ 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.
326
+
327
+ ### ❓ **Does this work with existing Angular projects?**
328
+
329
+ 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.
330
+
331
+ ### ❓ **Can I use this in production?**
332
+
333
+ Definitely! The generated components are production-ready with:
334
+
335
+ - Full TypeScript type safety
336
+ - Comprehensive unit tests
337
+ - Optimized performance (OnPush change detection)
338
+ - Accessibility considerations
339
+ - Modern Angular best practices
340
+
341
+ ### ❓ **How do I theme the components?**
342
+
343
+ Components use CSS variables for easy theming:
344
+
345
+ ```scss
346
+ :root {
347
+ --zen-primary-color: #your-brand-color;
348
+ --zen-border-radius: 8px;
349
+ }
350
+ ```
351
+
352
+ For deeper customization, edit the generated SCSS files directly.
353
+
354
+ ### ❓ **Why no Tailwind CSS?**
355
+
356
+ You can tweak the code to use Tailwind if you want, but avoid adding extra libraries. Our goal is to create base components that are easy to improve later, work without any CSS libraries, and are fully customizable right out of the box.
357
+
358
+ ---
167
359
 
168
- Generated components reside entirely within your project's source code. You can directly edit the `.ts`, `.html`, and `.scss` files. Components are structured to use CSS variables and SCSS for easier theming and modification.
360
+ **Ready to take control of your Angular UI components?** [Get started now!](#-quick-start) 🚀
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ng-zen/cli",
3
- "version": "20.2.0",
3
+ "version": "20.2.1-next.1",
4
4
  "description": "A CLI tool for generating customizable, modern Angular UI components using schematics.",
5
5
  "license": "BSD-2-Clause",
6
6
  "private": false,
@@ -2,37 +2,57 @@ import type { Meta, StoryObj } from '@storybook/angular';
2
2
 
3
3
  import { ZenAvatar } from './avatar';
4
4
 
5
+ type Options = ZenAvatar;
6
+
5
7
  export default {
6
8
  title: 'Components/Avatar',
7
9
  component: ZenAvatar,
8
- tags: ['autodocs'],
9
- render: args => ({ props: { ...args } }),
10
- } satisfies Meta<ZenAvatar>;
10
+ argTypes: {
11
+ src: {
12
+ table: {
13
+ category: 'Inputs',
14
+ type: {
15
+ summary: 'string',
16
+ },
17
+ defaultValue: {
18
+ summary: '',
19
+ },
20
+ },
21
+ control: 'text',
22
+ },
23
+ alt: {
24
+ table: {
25
+ category: 'Inputs',
26
+ type: {
27
+ summary: 'string',
28
+ },
29
+ defaultValue: {
30
+ summary: '',
31
+ },
32
+ },
33
+ control: 'text',
34
+ },
35
+ },
36
+ } satisfies Meta<Options>;
11
37
 
12
- type Story = StoryObj<ZenAvatar>;
38
+ type Story = StoryObj<Options>;
13
39
 
14
- export const Image: Story = {
40
+ export const Default: Story = {
15
41
  args: {
16
- src: 'https://picsum.photos/32',
42
+ src: 'https://github.com/kstepien3.png',
43
+ alt: 'Author',
17
44
  },
18
45
  };
19
46
 
20
- export const Default: Story = {
21
- render: () => ({
22
- template: `
23
- <zen-avatar src="https://github.com/kstepien3.png" alt="Author" style="--zen-avatar-size: 64px"/>
24
- `,
25
- }),
47
+ export const Image: Story = {
48
+ args: {
49
+ src: 'https://picsum.photos/32',
50
+ alt: 'Random User',
51
+ },
26
52
  };
27
53
 
28
54
  export const Text: Story = {
29
55
  render: () => ({
30
- template: `
31
- <div style="display: flex; gap: 1rem;">
32
- <zen-avatar>MI</zen-avatar>
33
- <zen-avatar>IB</zen-avatar>
34
- <zen-avatar>WP</zen-avatar>
35
- <zen-avatar>AI</zen-avatar>
36
- </div> `,
56
+ template: `<zen-avatar>KS</zen-avatar>`,
37
57
  }),
38
58
  };
@@ -49,13 +49,8 @@ import { ChangeDetectionStrategy, Component, input } from '@angular/core';
49
49
  changeDetection: ChangeDetectionStrategy.OnPush,
50
50
  })
51
51
  export class ZenAvatar {
52
- /**
53
- * Name of the source image. Image name will be processed by the image loader,
54
- * and the final URL will be applied as the src property of the image.
55
- */
52
+ /** Source path for the image which will be processed by Angular's image loader. */
56
53
  readonly src = input<string>('');
57
- /**
58
- * Sets or retrieves a text alternative to the graphic.
59
- */
54
+ /** Sets or retrieves a text alternative to the graphic. */
60
55
  readonly alt = input<string>('');
61
56
  }
@@ -37,7 +37,8 @@ $outline: var(--zen-outline, 2px solid hsl(200deg 100% 50% / 50%));
37
37
  }
38
38
 
39
39
  /* Disabled state */
40
- :host[aria-disabled='true'] {
40
+ :host[aria-disabled]:not([aria-disabled='false']),
41
+ :host[disabled]:not([disabled='false']) {
41
42
  cursor: not-allowed;
42
43
  opacity: 0.6;
43
44
  }
@@ -2,19 +2,46 @@ import type { Meta, StoryObj } from '@storybook/angular';
2
2
 
3
3
  import { ZenButton } from './button';
4
4
 
5
+ interface StoryParams {
6
+ content: string;
7
+ disabled: boolean;
8
+ }
9
+
10
+ type Options = ZenButton & StoryParams;
11
+
5
12
  export default {
6
13
  title: 'Components/Button',
7
14
  component: ZenButton,
8
- tags: ['autodocs'],
9
- render: args => ({ props: { ...args } }),
10
- } satisfies Meta<ZenButton>;
15
+ args: {
16
+ content: 'Test',
17
+ disabled: false,
18
+ },
19
+ argTypes: {
20
+ content: {
21
+ control: 'text',
22
+ table: {
23
+ category: 'story parameters',
24
+ type: {
25
+ summary: 'ng-content',
26
+ },
27
+ },
28
+ },
29
+ disabled: {
30
+ control: 'boolean',
31
+ table: {
32
+ category: 'attributes',
33
+ type: {
34
+ summary: 'boolean',
35
+ },
36
+ },
37
+ },
38
+ },
39
+ render: ({ content, ...args }) => ({
40
+ props: args,
41
+ template: `<button zen-btn ${args.disabled ? 'disabled' : ''}>${content}</button>`,
42
+ }),
43
+ } satisfies Meta<Options>;
11
44
 
12
- type Story = StoryObj<ZenButton>;
45
+ type Story = StoryObj<Options>;
13
46
 
14
- export const Default: Story = {
15
- render: () => ({
16
- template: `
17
- <button zen-btn>Test</button>
18
- `,
19
- }),
20
- };
47
+ export const Default: Story = {};