@ng-zen/cli 21.0.0 → 21.1.0-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 +11 -0
- package/README.md +27 -25
- package/package.json +15 -12
- package/schematics/collection.json +5 -5
- package/schematics/dependency-manager/index.js +1 -1
- package/schematics/dependency-manager/index.js.map +1 -1
- package/schematics/dependency-manager/index.ts +1 -1
- package/schematics/dependency-manager/utils/get-dependencies.js.map +1 -1
- package/schematics/dependency-manager/utils/get-dependencies.ts +2 -2
- package/schematics/{components → ui}/files/alert/alert.stories.ts +1 -1
- package/schematics/{components → ui}/files/avatar/avatar.stories.ts +3 -3
- package/schematics/{components → ui}/files/button/button.stories.ts +1 -1
- package/schematics/{components → ui}/files/checkbox/checkbox.stories.ts +1 -1
- package/schematics/{components → ui}/files/divider/divider.stories.ts +2 -2
- package/schematics/{components → ui}/files/form-control/form-control.stories.ts +1 -1
- package/schematics/{components → ui}/files/icon/icon.stories.ts +1 -1
- package/schematics/{components → ui}/files/input/input.stories.ts +1 -1
- package/schematics/ui/files/popover/host/popover-host.scss +76 -0
- package/schematics/ui/files/popover/host/popover-host.spec.ts +20 -0
- package/schematics/ui/files/popover/host/popover-host.ts +38 -0
- package/schematics/ui/files/popover/index.ts +1 -0
- package/schematics/ui/files/popover/popover-positions.type.ts +13 -0
- package/schematics/ui/files/popover/popover.spec.ts +171 -0
- package/schematics/ui/files/popover/popover.stories.ts +66 -0
- package/schematics/ui/files/popover/popover.ts +130 -0
- package/schematics/{components → ui}/files/radio/radio.stories.ts +1 -1
- package/schematics/{components → ui}/files/skeleton/skeleton.stories.ts +1 -1
- package/schematics/{components → ui}/files/switch/switch.stories.ts +1 -1
- package/schematics/{components → ui}/files/textarea/textarea.stories.ts +1 -1
- package/schematics/ui/index.js +27 -0
- package/schematics/ui/index.js.map +1 -0
- package/schematics/ui/index.ts +31 -0
- package/schematics/ui/schema.js.map +1 -0
- package/schematics/{components → ui}/schema.json +15 -6
- package/schematics/{components → ui}/schema.ts +3 -2
- package/schematics/{components → ui}/templates/README.md.template +3 -3
- package/services/selected-elements.js.map +1 -1
- package/services/selected-elements.ts +2 -2
- package/types/files-config.js.map +1 -1
- package/types/files-config.ts +2 -2
- package/types/generator-schema-base.js.map +1 -1
- package/types/generator-schema-base.ts +2 -1
- package/types/schematics-folder.js.map +1 -1
- package/types/schematics-folder.ts +2 -2
- package/utils/apply-file-template.util.js.map +1 -1
- package/utils/apply-file-template.util.ts +1 -1
- package/schematics/components/index.js +0 -16
- package/schematics/components/index.js.map +0 -1
- package/schematics/components/index.ts +0 -16
- package/schematics/components/schema.js.map +0 -1
- /package/schematics/{components → ui}/files/alert/alert.scss +0 -0
- /package/schematics/{components → ui}/files/alert/alert.spec.ts +0 -0
- /package/schematics/{components → ui}/files/alert/alert.ts +0 -0
- /package/schematics/{components → ui}/files/alert/index.ts +0 -0
- /package/schematics/{components → ui}/files/avatar/avatar.scss +0 -0
- /package/schematics/{components → ui}/files/avatar/avatar.spec.ts +0 -0
- /package/schematics/{components → ui}/files/avatar/avatar.ts +0 -0
- /package/schematics/{components → ui}/files/avatar/index.ts +0 -0
- /package/schematics/{components → ui}/files/button/button.scss +0 -0
- /package/schematics/{components → ui}/files/button/button.spec.ts +0 -0
- /package/schematics/{components → ui}/files/button/button.ts +0 -0
- /package/schematics/{components → ui}/files/button/index.ts +0 -0
- /package/schematics/{components → ui}/files/checkbox/checkbox.scss +0 -0
- /package/schematics/{components → ui}/files/checkbox/checkbox.spec.ts +0 -0
- /package/schematics/{components → ui}/files/checkbox/checkbox.ts +0 -0
- /package/schematics/{components → ui}/files/checkbox/index.ts +0 -0
- /package/schematics/{components → ui}/files/divider/divider.scss +0 -0
- /package/schematics/{components → ui}/files/divider/divider.spec.ts +0 -0
- /package/schematics/{components → ui}/files/divider/divider.ts +0 -0
- /package/schematics/{components → ui}/files/divider/index.ts +0 -0
- /package/schematics/{components → ui}/files/form-control/form-control.spec.ts +0 -0
- /package/schematics/{components → ui}/files/form-control/form-control.ts +0 -0
- /package/schematics/{components → ui}/files/form-control/index.ts +0 -0
- /package/schematics/{components → ui}/files/icon/icon.spec.ts +0 -0
- /package/schematics/{components → ui}/files/icon/icon.ts +0 -0
- /package/schematics/{components → ui}/files/icon/index.ts +0 -0
- /package/schematics/{components → ui}/files/input/index.ts +0 -0
- /package/schematics/{components → ui}/files/input/input.scss +0 -0
- /package/schematics/{components → ui}/files/input/input.spec.ts +0 -0
- /package/schematics/{components → ui}/files/input/input.ts +0 -0
- /package/schematics/{components → ui}/files/radio/index.ts +0 -0
- /package/schematics/{components → ui}/files/radio/radio.registry.ts +0 -0
- /package/schematics/{components → ui}/files/radio/radio.scss +0 -0
- /package/schematics/{components → ui}/files/radio/radio.spec.ts +0 -0
- /package/schematics/{components → ui}/files/radio/radio.ts +0 -0
- /package/schematics/{components → ui}/files/skeleton/index.ts +0 -0
- /package/schematics/{components → ui}/files/skeleton/skeleton.scss +0 -0
- /package/schematics/{components → ui}/files/skeleton/skeleton.spec.ts +0 -0
- /package/schematics/{components → ui}/files/skeleton/skeleton.ts +0 -0
- /package/schematics/{components → ui}/files/switch/index.ts +0 -0
- /package/schematics/{components → ui}/files/switch/switch.scss +0 -0
- /package/schematics/{components → ui}/files/switch/switch.spec.ts +0 -0
- /package/schematics/{components → ui}/files/switch/switch.ts +0 -0
- /package/schematics/{components → ui}/files/textarea/index.ts +0 -0
- /package/schematics/{components → ui}/files/textarea/textarea.scss +0 -0
- /package/schematics/{components → ui}/files/textarea/textarea.spec.ts +0 -0
- /package/schematics/{components → ui}/files/textarea/textarea.ts +0 -0
- /package/schematics/{components → ui}/schema.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
## [21.1.0-next.1](https://github.com/kstepien3/ng-zen/compare/v21.0.0...v21.1.0-next.1) (2026-02-15)
|
|
2
|
+
|
|
3
|
+
### 🚀 New Features
|
|
4
|
+
|
|
5
|
+
* **components:** improve path component generation ([#362](https://github.com/kstepien3/ng-zen/issues/362)) ([8503565](https://github.com/kstepien3/ng-zen/commit/8503565076e2189a36c18b8555639cf86adb2fcc))
|
|
6
|
+
* **popover:** add new component ([#374](https://github.com/kstepien3/ng-zen/issues/374)) ([c67daea](https://github.com/kstepien3/ng-zen/commit/c67daea23027ecfdd868b96ff29b65903059ac20))
|
|
7
|
+
|
|
8
|
+
### 🛠️ Code Refactor
|
|
9
|
+
|
|
10
|
+
* **ui:** rename `components` to `ui` across schematics ([#376](https://github.com/kstepien3/ng-zen/issues/376)) ([6b1bc9f](https://github.com/kstepien3/ng-zen/commit/6b1bc9fc6197fefa85d3eb0d2d9947ef44547533))
|
|
11
|
+
|
|
1
12
|
## [21.0.0](https://github.com/kstepien3/ng-zen/compare/v20.5.0...v21.0.0) (2025-12-18)
|
|
2
13
|
|
|
3
14
|
### ⚠ BREAKING CHANGES
|
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ Unlike traditional UI libraries that give you `<library-button>` black boxes, @n
|
|
|
39
39
|
|
|
40
40
|
### 🏎️ **Instant Productivity**
|
|
41
41
|
|
|
42
|
-
- **Production-Ready
|
|
42
|
+
- **Production-Ready UI Elements:** Alert, Avatar, Button, Checkbox, Divider, Form Control, Icon, Input, Popover, Radio, Skeleton, Switch, Textarea
|
|
43
43
|
- **Zero Configuration:** Works with Angular 20+ out of the box
|
|
44
44
|
- **Complete Setup:** Each component includes unit tests, Storybook stories, and documentation
|
|
45
45
|
|
|
@@ -60,7 +60,7 @@ Unlike traditional UI libraries that give you `<library-button>` black boxes, @n
|
|
|
60
60
|
|
|
61
61
|
1. [Quick Start](#-quick-start)
|
|
62
62
|
2. [Installation](#-installation)
|
|
63
|
-
3. [Available
|
|
63
|
+
3. [Available Elements](#-available-elements)
|
|
64
64
|
4. [Usage Examples](#-usage-examples)
|
|
65
65
|
5. [Perfect For](#-perfect-for)
|
|
66
66
|
6. [Advanced Features](#-advanced-features)
|
|
@@ -89,10 +89,10 @@ This command:
|
|
|
89
89
|
Then generate your first component:
|
|
90
90
|
|
|
91
91
|
```bash
|
|
92
|
-
ng generate @ng-zen/cli:
|
|
92
|
+
ng generate @ng-zen/cli:ui
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
-
Select components from an interactive menu and they'll be generated
|
|
95
|
+
Select components from an interactive menu and they'll be generated in the `ui` folder within your project's source directory (e.g., `src/app/ui`)! 🎉
|
|
96
96
|
|
|
97
97
|
## 📦 Installation
|
|
98
98
|
|
|
@@ -112,21 +112,23 @@ pnpm add -D @ng-zen/cli
|
|
|
112
112
|
pnpm add -D @ng-zen/cli@next
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
-
## 🧩 Available
|
|
116
|
-
|
|
117
|
-
| Component | Description | Features
|
|
118
|
-
| ---------------- | -------------------------------- |
|
|
119
|
-
| **Avatar** | User profile images and initials | Image fallback, size variants, rounded styles
|
|
120
|
-
| **Alert** | Informational messages | Customizable styles, dismissible options
|
|
121
|
-
| **Button** | Interactive buttons | Primary/secondary variants, loading states, icons
|
|
122
|
-
| **Checkbox** | Form checkboxes | Indeterminate state, custom styling, validation
|
|
123
|
-
| **Divider** | Visual separators | Horizontal/vertical, with labels, custom thickness
|
|
124
|
-
| **Form Control** | Form field wrapper | Labels, validation messages, required indicators
|
|
125
|
-
| **Icon** | SVG icon system | Huge Icons integration, size variants, colors
|
|
126
|
-
| **Input** | Text input fields | Validation states, prefixes/suffixes, types
|
|
127
|
-
| **
|
|
128
|
-
| **
|
|
129
|
-
| **
|
|
115
|
+
## 🧩 Available UIs
|
|
116
|
+
|
|
117
|
+
| Component | Description | Features |
|
|
118
|
+
| ---------------- | -------------------------------- | ------------------------------------------------------------------------- |
|
|
119
|
+
| **Avatar** | User profile images and initials | Image fallback, size variants, rounded styles |
|
|
120
|
+
| **Alert** | Informational messages | Customizable styles, dismissible options |
|
|
121
|
+
| **Button** | Interactive buttons | Primary/secondary variants, loading states, icons |
|
|
122
|
+
| **Checkbox** | Form checkboxes | Indeterminate state, custom styling, validation |
|
|
123
|
+
| **Divider** | Visual separators | Horizontal/vertical, with labels, custom thickness |
|
|
124
|
+
| **Form Control** | Form field wrapper | Labels, validation messages, required indicators |
|
|
125
|
+
| **Icon** | SVG icon system | Huge Icons integration, size variants, colors |
|
|
126
|
+
| **Input** | Text input fields | Validation states, prefixes/suffixes, types |
|
|
127
|
+
| **Popover** | Native Popover API directive | Template/string content, placements, click toggle, CSS anchor positioning |
|
|
128
|
+
| **Radio** | Form radio buttons | Group selection, two-way binding, custom styling, disabled state |
|
|
129
|
+
| **Skeleton** | Loading placeholders | Multiple shapes, animation, responsive |
|
|
130
|
+
| **Switch** | Toggle controls | On/off states, disabled state, custom labels |
|
|
131
|
+
| **Textarea** | Multi-line text input | Auto-resize, character counts, validation |
|
|
130
132
|
|
|
131
133
|
> 💡 **More components coming soon!** Planned: Directives, Pipes, Services, and additional UI elements.
|
|
132
134
|
|
|
@@ -135,17 +137,17 @@ pnpm add -D @ng-zen/cli@next
|
|
|
135
137
|
### Basic Component Generation
|
|
136
138
|
|
|
137
139
|
```bash
|
|
138
|
-
# Interactive mode - choose components from a menu
|
|
139
|
-
ng generate @ng-zen/cli:
|
|
140
|
+
# Interactive mode - choose components from a menu (default path: src/app/ui if not provided)
|
|
141
|
+
ng generate @ng-zen/cli:ui
|
|
140
142
|
|
|
141
|
-
# Generate specific
|
|
142
|
-
ng generate @ng-zen/cli:
|
|
143
|
+
# Generate specific UI elements
|
|
144
|
+
ng generate @ng-zen/cli:ui --ui avatar button
|
|
143
145
|
|
|
144
146
|
# Custom location
|
|
145
|
-
ng generate @ng-zen/cli:
|
|
147
|
+
ng generate @ng-zen/cli:ui ./src/app/custom --ui input checkbox
|
|
146
148
|
|
|
147
149
|
# Include Storybook stories
|
|
148
|
-
ng generate @ng-zen/cli:
|
|
150
|
+
ng generate @ng-zen/cli:ui --ui button --stories
|
|
149
151
|
```
|
|
150
152
|
|
|
151
153
|
### What Gets Generated
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ng-zen/cli",
|
|
3
|
-
"version": "21.0.
|
|
3
|
+
"version": "21.1.0-next.1",
|
|
4
4
|
"description": "Angular UI components generator – Zen UI Kit CLI for schematics-based creation of customizable components like avatar, button, checkbox, divider, form-control, icon, input, skeleton, switch, textarea with Storybook demos.",
|
|
5
5
|
"license": "BSD-2-Clause",
|
|
6
6
|
"private": false,
|
|
@@ -27,16 +27,6 @@
|
|
|
27
27
|
"storybook angular",
|
|
28
28
|
"customizable ui",
|
|
29
29
|
"angular library",
|
|
30
|
-
"avatar",
|
|
31
|
-
"button",
|
|
32
|
-
"checkbox",
|
|
33
|
-
"input",
|
|
34
|
-
"textarea",
|
|
35
|
-
"switch",
|
|
36
|
-
"skeleton",
|
|
37
|
-
"divider",
|
|
38
|
-
"form-control",
|
|
39
|
-
"icon",
|
|
40
30
|
"angular ui",
|
|
41
31
|
"angular components",
|
|
42
32
|
"ui library",
|
|
@@ -54,7 +44,20 @@
|
|
|
54
44
|
"accessibility",
|
|
55
45
|
"theming",
|
|
56
46
|
"angular schematics generator",
|
|
57
|
-
"ui components cli"
|
|
47
|
+
"ui components cli",
|
|
48
|
+
"alert",
|
|
49
|
+
"avatar",
|
|
50
|
+
"button",
|
|
51
|
+
"checkbox",
|
|
52
|
+
"divider",
|
|
53
|
+
"form-control",
|
|
54
|
+
"icon",
|
|
55
|
+
"input",
|
|
56
|
+
"popover",
|
|
57
|
+
"radio",
|
|
58
|
+
"skeleton",
|
|
59
|
+
"switch",
|
|
60
|
+
"textarea"
|
|
58
61
|
],
|
|
59
62
|
"ng-add": {
|
|
60
63
|
"save": "devDependencies"
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
"factory": "./ng-add/index#ngAdd",
|
|
7
7
|
"schema": "./ng-add/schema.json"
|
|
8
8
|
},
|
|
9
|
-
"
|
|
10
|
-
"description": "This schematic generates
|
|
11
|
-
"factory": "./
|
|
12
|
-
"schema": "./
|
|
13
|
-
"aliases": ["c"]
|
|
9
|
+
"ui": {
|
|
10
|
+
"description": "This schematic generates UI components",
|
|
11
|
+
"factory": "./ui/index#uiGenerator",
|
|
12
|
+
"schema": "./ui/schema.json",
|
|
13
|
+
"aliases": ["c", "component", "components"]
|
|
14
14
|
},
|
|
15
15
|
"dependency-manager": {
|
|
16
16
|
"description": "Manage dependencies for selected elements",
|
|
@@ -10,7 +10,7 @@ function dependencyManager() {
|
|
|
10
10
|
return (tree, context) => {
|
|
11
11
|
const dependenciesToInstall = (0, get_dependencies_1.getDependencies)(selected_elements_1.selectedElements, dependencies_constant_1.DEPENDENCIES_CONFIG);
|
|
12
12
|
if (!dependenciesToInstall.length) {
|
|
13
|
-
context.logger.info('✅ No dependencies to install for the selected
|
|
13
|
+
context.logger.info('✅ No dependencies to install for the selected elements.');
|
|
14
14
|
return tree;
|
|
15
15
|
}
|
|
16
16
|
context.logger.info(`📦 Installing ${dependenciesToInstall.length} dependencies...`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/schematics/dependency-manager/index.ts"],"names":[],"mappings":";;AAQA,8CAkBC;AAzBD,4DAA0E;AAC1E,2EAAoG;AAEpG,wEAAoE;AACpE,mEAA8D;AAC9D,+DAA2D;AAE3D,SAAgB,iBAAiB;IAC/B,OAAO,CAAC,IAAU,EAAE,OAAO,EAAE,EAAE;QAC7B,MAAM,qBAAqB,GAAqB,IAAA,kCAAe,EAAC,oCAAgB,EAAE,2CAAmB,CAAC,CAAC;QAEvG,IAAI,CAAC,qBAAqB,CAAC,MAAM,EAAE,CAAC;YAClC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/schematics/dependency-manager/index.ts"],"names":[],"mappings":";;AAQA,8CAkBC;AAzBD,4DAA0E;AAC1E,2EAAoG;AAEpG,wEAAoE;AACpE,mEAA8D;AAC9D,+DAA2D;AAE3D,SAAgB,iBAAiB;IAC/B,OAAO,CAAC,IAAU,EAAE,OAAO,EAAE,EAAE;QAC7B,MAAM,qBAAqB,GAAqB,IAAA,kCAAe,EAAC,oCAAgB,EAAE,2CAAmB,CAAC,CAAC;QAEvG,IAAI,CAAC,qBAAqB,CAAC,MAAM,EAAE,CAAC;YAClC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,yDAAyD,CAAC,CAAC;YAC/E,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,qBAAqB,CAAC,MAAM,kBAAkB,CAAC,CAAC;QAErF,KAAK,MAAM,UAAU,IAAI,qBAAqB,EAAE,CAAC;YAC/C,IAAA,uCAAwB,EAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAC7C,CAAC;QAED,OAAO,CAAC,OAAO,CAAC,IAAI,8BAAsB,EAAE,CAAC,CAAC;QAC9C,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { Rule, Tree } from '@angular-devkit/schematics';\nimport { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';\nimport { addPackageJsonDependency, NodeDependency } from '@schematics/angular/utility/dependencies';\n\nimport { selectedElements } from '../../services/selected-elements';\nimport { DEPENDENCIES_CONFIG } from './dependencies.constant';\nimport { getDependencies } from './utils/get-dependencies';\n\nexport function dependencyManager(): Rule {\n return (tree: Tree, context) => {\n const dependenciesToInstall: NodeDependency[] = getDependencies(selectedElements, DEPENDENCIES_CONFIG);\n\n if (!dependenciesToInstall.length) {\n context.logger.info('✅ No dependencies to install for the selected elements.');\n return tree;\n }\n\n context.logger.info(`📦 Installing ${dependenciesToInstall.length} dependencies...`);\n\n for (const dependency of dependenciesToInstall) {\n addPackageJsonDependency(tree, dependency);\n }\n\n context.addTask(new NodePackageInstallTask());\n return tree;\n };\n}\n"]}
|
|
@@ -11,7 +11,7 @@ export function dependencyManager(): Rule {
|
|
|
11
11
|
const dependenciesToInstall: NodeDependency[] = getDependencies(selectedElements, DEPENDENCIES_CONFIG);
|
|
12
12
|
|
|
13
13
|
if (!dependenciesToInstall.length) {
|
|
14
|
-
context.logger.info('✅ No dependencies to install for the selected
|
|
14
|
+
context.logger.info('✅ No dependencies to install for the selected elements.');
|
|
15
15
|
return tree;
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-dependencies.js","sourceRoot":"","sources":["../../../../../../src/schematics/dependency-manager/utils/get-dependencies.ts"],"names":[],"mappings":";;AAKA,0CAyBC;AA9BD,2EAA8F;AAK9F,SAAgB,eAAe,CAC7B,
|
|
1
|
+
{"version":3,"file":"get-dependencies.js","sourceRoot":"","sources":["../../../../../../src/schematics/dependency-manager/utils/get-dependencies.ts"],"names":[],"mappings":";;AAKA,0CAyBC;AA9BD,2EAA8F;AAK9F,SAAgB,eAAe,CAC7B,gBAA0B,EAC1B,kBAAwC;IAExC,MAAM,YAAY,GAAqB,EAAE,CAAC;IAE1C,KAAK,MAAM,SAAS,IAAI,gBAAgB,EAAE,CAAC;QACzC,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC;YAAE,SAAS;QAE7C,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,iCAAkB,CAAC,EAAE,CAAC;YACrD,MAAM,QAAQ,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC;YACrD,IAAI,CAAC,QAAQ;gBAAE,SAAS;YAExB,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACvD,YAAY,CAAC,IAAI,CAAC;oBAChB,IAAI;oBACJ,IAAI;oBACJ,OAAO;oBACP,SAAS,EAAE,KAAK;iBACjB,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC","sourcesContent":["import { NodeDependency, NodeDependencyType } from '@schematics/angular/utility/dependencies';\n\nimport { FilesConfig } from '../../../types';\nimport { UiType } from '../../ui/schema';\n\nexport function getDependencies(\n selectedElements: UiType[],\n dependenciesConfig: Partial<FilesConfig>\n): NodeDependency[] {\n const dependencies: NodeDependency[] = [];\n\n for (const component of selectedElements) {\n if (!dependenciesConfig[component]) continue;\n\n for (const type of Object.values(NodeDependencyType)) {\n const typeDeps = dependenciesConfig[component][type];\n if (!typeDeps) continue;\n\n for (const [name, version] of Object.entries(typeDeps)) {\n dependencies.push({\n type,\n name,\n version,\n overwrite: false,\n });\n }\n }\n }\n\n return dependencies;\n}\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { NodeDependency, NodeDependencyType } from '@schematics/angular/utility/dependencies';
|
|
2
2
|
|
|
3
3
|
import { FilesConfig } from '../../../types';
|
|
4
|
-
import {
|
|
4
|
+
import { UiType } from '../../ui/schema';
|
|
5
5
|
|
|
6
6
|
export function getDependencies(
|
|
7
|
-
selectedElements:
|
|
7
|
+
selectedElements: UiType[],
|
|
8
8
|
dependenciesConfig: Partial<FilesConfig>
|
|
9
9
|
): NodeDependency[] {
|
|
10
10
|
const dependencies: NodeDependency[] = [];
|
|
@@ -5,12 +5,12 @@ import { ZenAvatar } from './avatar';
|
|
|
5
5
|
type Options = ZenAvatar;
|
|
6
6
|
|
|
7
7
|
export default {
|
|
8
|
-
title: '
|
|
8
|
+
title: 'Ui/Avatar',
|
|
9
9
|
component: ZenAvatar,
|
|
10
10
|
argTypes: {
|
|
11
11
|
src: {
|
|
12
12
|
table: {
|
|
13
|
-
category: '
|
|
13
|
+
category: 'inputs',
|
|
14
14
|
type: {
|
|
15
15
|
summary: 'string',
|
|
16
16
|
},
|
|
@@ -22,7 +22,7 @@ export default {
|
|
|
22
22
|
},
|
|
23
23
|
alt: {
|
|
24
24
|
table: {
|
|
25
|
-
category: '
|
|
25
|
+
category: 'inputs',
|
|
26
26
|
type: {
|
|
27
27
|
summary: 'string',
|
|
28
28
|
},
|
|
@@ -10,7 +10,7 @@ interface StoryParams {
|
|
|
10
10
|
type Options = ZenDivider & StoryParams;
|
|
11
11
|
|
|
12
12
|
export default {
|
|
13
|
-
title: '
|
|
13
|
+
title: 'Ui/Divider',
|
|
14
14
|
component: ZenDivider,
|
|
15
15
|
parameters: {
|
|
16
16
|
layout: 'padded',
|
|
@@ -33,7 +33,7 @@ export default {
|
|
|
33
33
|
control: 'select',
|
|
34
34
|
options: ['start', 'center', 'end'],
|
|
35
35
|
table: {
|
|
36
|
-
category: '
|
|
36
|
+
category: 'inputs',
|
|
37
37
|
defaultValue: { summary: 'center' },
|
|
38
38
|
type: { summary: '"start" | "center" | "end"' },
|
|
39
39
|
},
|
|
@@ -8,7 +8,7 @@ import { ZenFormControl } from './form-control';
|
|
|
8
8
|
type Options = ZenFormControl<unknown>;
|
|
9
9
|
|
|
10
10
|
export default {
|
|
11
|
-
title: '
|
|
11
|
+
title: 'Ui/FormControl',
|
|
12
12
|
component: ZenFormControl,
|
|
13
13
|
decorators: [
|
|
14
14
|
moduleMetadata({ imports: [ZenCheckbox, ZenInput, ZenSwitch] }),
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
--zen-popover-offset: 0.5rem;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
/* stylelint-disable-next-line no-duplicate-selectors -- separate variables and styles */
|
|
6
|
+
:host {
|
|
7
|
+
position: fixed;
|
|
8
|
+
inset: auto;
|
|
9
|
+
margin: var(--zen-popover-offset);
|
|
10
|
+
width: max-content;
|
|
11
|
+
max-width: 300px;
|
|
12
|
+
background: white;
|
|
13
|
+
border: 1px solid #ccc;
|
|
14
|
+
border-radius: 8px;
|
|
15
|
+
padding: 0.5rem;
|
|
16
|
+
box-shadow: 0 4px 12px rgb(0 0 0 / 15%);
|
|
17
|
+
overflow: visible;
|
|
18
|
+
|
|
19
|
+
// Auto-reposition if the popover would overflow
|
|
20
|
+
position-try-fallbacks:
|
|
21
|
+
flip-block,
|
|
22
|
+
flip-inline,
|
|
23
|
+
flip-block flip-inline;
|
|
24
|
+
|
|
25
|
+
/* TOP */
|
|
26
|
+
&[data-placement='top'] {
|
|
27
|
+
position-area: top center;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&[data-placement='top-start'] {
|
|
31
|
+
position-area: top left;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&[data-placement='top-end'] {
|
|
35
|
+
position-area: top right;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/* BOTTOM */
|
|
39
|
+
&[data-placement='bottom'] {
|
|
40
|
+
position-area: bottom center;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&[data-placement='bottom-start'] {
|
|
44
|
+
position-area: bottom left;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&[data-placement='bottom-end'] {
|
|
48
|
+
position-area: bottom right;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* LEFT */
|
|
52
|
+
&[data-placement='left'] {
|
|
53
|
+
position-area: left center;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&[data-placement='left-start'] {
|
|
57
|
+
position-area: left top;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&[data-placement='left-end'] {
|
|
61
|
+
position-area: left bottom;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* RIGHT */
|
|
65
|
+
&[data-placement='right'] {
|
|
66
|
+
position-area: right center;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&[data-placement='right-start'] {
|
|
70
|
+
position-area: right top;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&[data-placement='right-end'] {
|
|
74
|
+
position-area: right bottom;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { provideZonelessChangeDetection } from '@angular/core';
|
|
2
|
+
import { TestBed } from '@angular/core/testing';
|
|
3
|
+
import { beforeEach, describe, expect, it } from 'vitest';
|
|
4
|
+
|
|
5
|
+
import { ZenPopoverHost } from './popover-host';
|
|
6
|
+
|
|
7
|
+
describe('ZenPopoverHost', () => {
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
await TestBed.configureTestingModule({
|
|
10
|
+
imports: [ZenPopoverHost],
|
|
11
|
+
providers: [provideZonelessChangeDetection()],
|
|
12
|
+
}).compileComponents();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('should create', () => {
|
|
16
|
+
const fixture = TestBed.createComponent(ZenPopoverHost);
|
|
17
|
+
const component = fixture.componentInstance;
|
|
18
|
+
expect(component).toBeTruthy();
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
import { PopoverPlacement } from '../popover-positions.type';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* ZenPopoverHost is a minimal host component created dynamically by the `ZenPopover` directive.
|
|
7
|
+
* It exists mainly to provide a real DOM element that can act as a native popover (`popover="auto"`),
|
|
8
|
+
* receive styles, and host projected content.
|
|
9
|
+
*
|
|
10
|
+
* The directive is responsible for creating/destroying this component instance, attaching content
|
|
11
|
+
* (text or a TemplateRef), configuring positioning, and calling the Popover API methods to toggle it.
|
|
12
|
+
*
|
|
13
|
+
* ### Notes
|
|
14
|
+
* This component intentionally contains no behavior logic. All lifecycle and interaction logic is handled
|
|
15
|
+
* by the directive that creates it.
|
|
16
|
+
*
|
|
17
|
+
* @author Konrad Stępień
|
|
18
|
+
* @license {@link https://github.com/kstepien3/ng-zen/blob/master/LICENSE|BSD-2-Clause}
|
|
19
|
+
* @see [GitHub](https://github.com/kstepien3/ng-zen)
|
|
20
|
+
* @see [MDN Popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API)
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
@Component({
|
|
24
|
+
template: `
|
|
25
|
+
<ng-content />
|
|
26
|
+
`,
|
|
27
|
+
styleUrl: './popover-host.scss',
|
|
28
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
29
|
+
host: {
|
|
30
|
+
popover: 'auto',
|
|
31
|
+
'[attr.id]': 'id()',
|
|
32
|
+
'[attr.data-placement]': 'placement()',
|
|
33
|
+
},
|
|
34
|
+
})
|
|
35
|
+
export class ZenPopoverHost {
|
|
36
|
+
readonly id = input.required<string>();
|
|
37
|
+
readonly placement = input<PopoverPlacement>('top');
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './popover';
|