@ng-zen/cli 19.2.0 → 19.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 +18 -0
- package/package.json +1 -1
- package/schematics/components/components-generator.js.map +1 -1
- package/schematics/components/components-generator.ts +1 -1
- package/schematics/components/files/avatar/avatar.component.scss +3 -3
- package/schematics/components/files/avatar/avatar.component.ts +5 -10
- package/schematics/components/files/button/button.component.scss +1 -1
- package/schematics/components/files/button/button.component.ts +14 -0
- package/schematics/components/files/checkbox/checkbox.component.scss +7 -7
- package/schematics/components/files/checkbox/checkbox.component.ts +15 -0
- package/schematics/components/files/divider/divider.component.scss +8 -3
- package/schematics/components/files/divider/divider.component.ts +5 -3
- package/schematics/components/files/input/input.component.scss +5 -5
- package/schematics/components/files/input/input.component.ts +13 -0
- package/schematics/components/files/skeleton/index.ts +1 -0
- package/schematics/components/files/skeleton/skeleton.component.scss +72 -0
- package/schematics/components/files/skeleton/skeleton.component.spec.ts +22 -0
- package/schematics/components/files/skeleton/skeleton.component.ts +36 -0
- package/schematics/components/files/skeleton/skeleton.stories.ts +37 -0
- package/schematics/components/files/switch/switch.component.scss +5 -5
- package/schematics/components/files/switch/switch.component.ts +30 -0
- package/schematics/components/files/textarea/textarea.component.scss +5 -5
- package/schematics/components/files/textarea/textarea.component.ts +13 -0
- package/schematics/components/schema.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## [19.3.0-next.2](https://github.com/kstepien3/ng-zen/compare/v19.3.0-next.1...v19.3.0-next.2) (2025-06-11)
|
|
2
|
+
|
|
3
|
+
### 🐛 Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **storybook/components:** format and documentation ([#211](https://github.com/kstepien3/ng-zen/issues/211)) ([a0fb6f5](https://github.com/kstepien3/ng-zen/commit/a0fb6f576e1c47509ba2aed4cd4314dace894366))
|
|
6
|
+
* **styles:** improve format of hls colors ([#207](https://github.com/kstepien3/ng-zen/issues/207)) ([354d698](https://github.com/kstepien3/ng-zen/commit/354d6989507ba86397268012f6a53002c2e02297))
|
|
7
|
+
|
|
8
|
+
### 📚 Documentation
|
|
9
|
+
|
|
10
|
+
* **DEVELOPMENT:** add release information ([#209](https://github.com/kstepien3/ng-zen/issues/209)) ([f9aad1b](https://github.com/kstepien3/ng-zen/commit/f9aad1b8be3d7d633c41ad9cff4bf3c6b93ad0f4))
|
|
11
|
+
* resolve a problem with missing documentation ([#208](https://github.com/kstepien3/ng-zen/issues/208)) ([85e7969](https://github.com/kstepien3/ng-zen/commit/85e7969c23b6b7bd2039e9cfdc336dc8da6edcc1))
|
|
12
|
+
|
|
13
|
+
## [19.3.0-next.1](https://github.com/kstepien3/ng-zen/compare/v19.2.0...v19.3.0-next.1) (2025-06-10)
|
|
14
|
+
|
|
15
|
+
### 🚀 New Features
|
|
16
|
+
|
|
17
|
+
* **skeleton:** add component ([#205](https://github.com/kstepien3/ng-zen/issues/205)) ([fa21c9a](https://github.com/kstepien3/ng-zen/commit/fa21c9a440ce918d521c12cd9e9eec17cade60cd))
|
|
18
|
+
|
|
1
19
|
## [19.2.0](https://github.com/kstepien3/ng-zen/compare/v19.1.0...v19.2.0) (2025-05-25)
|
|
2
20
|
|
|
3
21
|
### 🚀 New Features
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components-generator.js","sourceRoot":"","sources":["../../../../../src/schematics/components/components-generator.ts"],"names":[],"mappings":"","sourcesContent":["import { GeneratorSchemaBase } from '../../types';\n\nexport type ComponentType = 'avatar' | 'button' | 'checkbox' | 'divider' | 'input' | 'switch' | 'textarea';\n\nexport interface ComponentGeneratorSchema extends GeneratorSchemaBase {\n components: ComponentType[];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"components-generator.js","sourceRoot":"","sources":["../../../../../src/schematics/components/components-generator.ts"],"names":[],"mappings":"","sourcesContent":["import { GeneratorSchemaBase } from '../../types';\n\nexport type ComponentType = 'avatar' | 'button' | 'checkbox' | 'divider' | 'input' | 'skeleton' | 'switch' | 'textarea';\n\nexport interface ComponentGeneratorSchema extends GeneratorSchemaBase {\n components: ComponentType[];\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GeneratorSchemaBase } from '../../types';
|
|
2
2
|
|
|
3
|
-
export type ComponentType = 'avatar' | 'button' | 'checkbox' | 'divider' | 'input' | 'switch' | 'textarea';
|
|
3
|
+
export type ComponentType = 'avatar' | 'button' | 'checkbox' | 'divider' | 'input' | 'skeleton' | 'switch' | 'textarea';
|
|
4
4
|
|
|
5
5
|
export interface ComponentGeneratorSchema extends GeneratorSchemaBase {
|
|
6
6
|
components: ComponentType[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
$size: var(--zen-avatar-size,
|
|
2
|
-
$bg-color: var(--zen-avatar-bg-color,
|
|
3
|
-
$color: var(--zen-avatar-color,
|
|
1
|
+
$size: var(--zen-avatar-size, 2rem);
|
|
2
|
+
$bg-color: var(--zen-avatar-bg-color, hsl(0deg 0% 80%));
|
|
3
|
+
$color: var(--zen-avatar-color, hsl(0deg 0% 20%));
|
|
4
4
|
$font-size: var(--zen-avatar-font-size, small);
|
|
5
5
|
|
|
6
6
|
:host {
|
|
@@ -8,9 +8,7 @@ import { ChangeDetectionStrategy, Component, input } from '@angular/core';
|
|
|
8
8
|
*
|
|
9
9
|
* This component utilizes Angular's optimized image directives for enhanced performance.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* To use the component, you can provide an image source or project content:
|
|
11
|
+
* @example
|
|
14
12
|
*
|
|
15
13
|
* ```html
|
|
16
14
|
* <!-- If an image source is provided, it will display the image -->
|
|
@@ -22,20 +20,17 @@ import { ChangeDetectionStrategy, Component, input } from '@angular/core';
|
|
|
22
20
|
*
|
|
23
21
|
* ### CSS Custom Properties
|
|
24
22
|
*
|
|
25
|
-
* You can customize the
|
|
23
|
+
* You can customize the component using CSS custom properties:
|
|
26
24
|
*
|
|
27
25
|
* ```css
|
|
28
26
|
* :root {
|
|
29
|
-
* --zen-avatar-size:
|
|
30
|
-
* --zen-avatar-bg-color:
|
|
31
|
-
* --zen-avatar-color:
|
|
27
|
+
* --zen-avatar-size: 2rem;
|
|
28
|
+
* --zen-avatar-bg-color: hsl(0deg 0% 80%);
|
|
29
|
+
* --zen-avatar-color: hsl(0deg 0% 20%);
|
|
32
30
|
* --zen-avatar-font-size: small;
|
|
33
31
|
* }
|
|
34
32
|
* ```
|
|
35
33
|
*
|
|
36
|
-
* @example
|
|
37
|
-
* <zen-avatar src="https://picsum.photos/32" />
|
|
38
|
-
*
|
|
39
34
|
* @author Konrad Stępień
|
|
40
35
|
* @license {@link https://github.com/kstepien3/ng-zen/blob/master/LICENSE|BSD-2-Clause}
|
|
41
36
|
* @see [GitHub](https://github.com/kstepien3/ng-zen)
|
|
@@ -4,7 +4,7 @@ $color: var(--zen-button-color, hsl(0deg 0% 100%));
|
|
|
4
4
|
$padding: var(--zen-button-padding, 0.5rem 1rem);
|
|
5
5
|
$shadow: var(--zen-button-shadow, 0 2px 4px hsl(0deg 0% 0% / 10%));
|
|
6
6
|
$transition-duration: var(--zen-transition-duration, 0.4s);
|
|
7
|
-
$outline: var(--zen-outline, 2px solid hsl(200deg 100 50 / 50%));
|
|
7
|
+
$outline: var(--zen-outline, 2px solid hsl(200deg 100% 50% / 50%));
|
|
8
8
|
|
|
9
9
|
:host {
|
|
10
10
|
display: inline-block;
|
|
@@ -9,6 +9,20 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
|
9
9
|
* @example
|
|
10
10
|
* <button zen-btn> ... </button>
|
|
11
11
|
*
|
|
12
|
+
* ### CSS Custom Properties
|
|
13
|
+
*
|
|
14
|
+
* You can customize the component using CSS custom properties:
|
|
15
|
+
*
|
|
16
|
+
* ```css
|
|
17
|
+
* :root {
|
|
18
|
+
* --zen-button-bg-color-hover: lightgrey;
|
|
19
|
+
* --zen-button-bg-color: grey;
|
|
20
|
+
* --zen-button-color: white;
|
|
21
|
+
* --zen-button-padding: 0.5rem 2rem;
|
|
22
|
+
* --zen-button-shadow: 0 2px 4px hsl(0deg 0% 0% / 10%);
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
12
26
|
* @author Konrad Stępień
|
|
13
27
|
* @license {@link https://github.com/kstepien3/ng-zen/blob/master/LICENSE|BSD-2-Clause}
|
|
14
28
|
* @see [GitHub](https://github.com/kstepien3/ng-zen)
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// Component Variables
|
|
2
2
|
$size: var(--zen-checkbox-size, 16px);
|
|
3
3
|
$border-radius: var(--zen-checkbox-border-radius, 6px);
|
|
4
|
-
$focus-shadow: var(--zen-checkbox-focus-shadow, 0 1px 4px
|
|
4
|
+
$focus-shadow: var(--zen-checkbox-focus-shadow, 0 1px 4px hsl(0deg 0% 60% / 20%) inset);
|
|
5
5
|
|
|
6
6
|
// Color Palette
|
|
7
|
-
$appearance: var(--zen-checkbox-appearance, hsl(
|
|
7
|
+
$appearance: var(--zen-checkbox-appearance, hsl(0deg 0% 10%));
|
|
8
8
|
$disabled-opacity: var(--zen-checkbox-disabled-opacity, 0.6);
|
|
9
|
-
$border: var(--zen-checkbox-border, 1px solid hsl(
|
|
10
|
-
$error: var(--zen-error, hsl(
|
|
11
|
-
$outline: var(--zen-outline, 2px solid hsl(200deg 100 50 / 50%));
|
|
9
|
+
$border: var(--zen-checkbox-border, 1px solid hsl(0deg 0% 80%));
|
|
10
|
+
$error: var(--zen-error, hsl(0deg 70% 50%));
|
|
11
|
+
$outline: var(--zen-outline, 2px solid hsl(200deg 100% 50% / 50%));
|
|
12
12
|
|
|
13
13
|
// Animations
|
|
14
14
|
$transition-duration: var(--zen-transition-duration, 0.2s);
|
|
@@ -51,12 +51,12 @@ input {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
:host:has(input[type='checkbox']:disabled) {
|
|
54
|
+
opacity: $disabled-opacity;
|
|
55
|
+
|
|
54
56
|
&,
|
|
55
57
|
input {
|
|
56
58
|
cursor: not-allowed;
|
|
57
59
|
}
|
|
58
|
-
|
|
59
|
-
opacity: $disabled-opacity;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
:host:has(input:focus-visible) {
|
|
@@ -10,6 +10,21 @@ import { ControlValueAccessor, FormsModule, NG_VALUE_ACCESSOR } from '@angular/f
|
|
|
10
10
|
* @example
|
|
11
11
|
* <zen-checkbox value="false" />
|
|
12
12
|
*
|
|
13
|
+
* ### CSS Custom Properties
|
|
14
|
+
*
|
|
15
|
+
* You can customize the component using CSS custom properties:
|
|
16
|
+
*
|
|
17
|
+
* ```css
|
|
18
|
+
* :root {
|
|
19
|
+
* --zen-checkbox-size: 16px;
|
|
20
|
+
* --zen-checkbox-border-radius: 6px;
|
|
21
|
+
* --zen-checkbox-focus-shadow: 0 1px 4px hsl(0deg 0% 60% / 20%) inset;
|
|
22
|
+
* --zen-checkbox-appearance: hsl(0deg 0% 10%);
|
|
23
|
+
* --zen-checkbox-disabled-opacity: 0.6;
|
|
24
|
+
* --zen-checkbox-border: 1px solid hsl(0deg 0% 80%);
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
13
28
|
* @implements {ControlValueAccessor}
|
|
14
29
|
*
|
|
15
30
|
* @author Konrad Stępień
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
$appearance: var(--zen-divider-appearance, hsl(
|
|
1
|
+
$appearance: var(--zen-divider-appearance, hsl(0deg 0% 60%));
|
|
2
2
|
$type: var(--zen-divider-type, solid);
|
|
3
3
|
$align-offset: var(--zen-divider-align-offset, 25%);
|
|
4
4
|
$gap: var(--zen-divider-gap, 0.25rem);
|
|
@@ -9,6 +9,7 @@ $thickness: var(--zen-divider-thickness, 1px);
|
|
|
9
9
|
display: flex;
|
|
10
10
|
align-items: center;
|
|
11
11
|
gap: $gap;
|
|
12
|
+
color: $appearance;
|
|
12
13
|
|
|
13
14
|
&::before,
|
|
14
15
|
&::after {
|
|
@@ -21,8 +22,12 @@ $thickness: var(--zen-divider-thickness, 1px);
|
|
|
21
22
|
border-width: #{$thickness} 0 0;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
&:not(.has-content)
|
|
25
|
-
|
|
25
|
+
&:not(.has-content) {
|
|
26
|
+
gap: 0;
|
|
27
|
+
|
|
28
|
+
&::after {
|
|
29
|
+
content: none;
|
|
30
|
+
}
|
|
26
31
|
}
|
|
27
32
|
|
|
28
33
|
&.zen-align-start::before,
|
|
@@ -19,9 +19,11 @@ import { ChangeDetectionStrategy, Component, computed, ElementRef, inject, input
|
|
|
19
19
|
*
|
|
20
20
|
* ```css
|
|
21
21
|
* :root {
|
|
22
|
-
* --zen-divider-appearance:
|
|
23
|
-
* --zen-divider-type:
|
|
24
|
-
* --zen-divider-align-offset:
|
|
22
|
+
* --zen-divider-appearance: hsl(0deg 0% 10%);
|
|
23
|
+
* --zen-divider-type: solid;
|
|
24
|
+
* --zen-divider-align-offset: 25%;
|
|
25
|
+
* --zen-divider-gap: 0.25rem;
|
|
26
|
+
* --zen-divider-thickness: 1px;
|
|
25
27
|
* }
|
|
26
28
|
* ```
|
|
27
29
|
*
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// Component Variables
|
|
2
|
-
$border: var(--zen-input-border, 1px solid hsl(
|
|
2
|
+
$border: var(--zen-input-border, 1px solid hsl(0deg 0% 80%));
|
|
3
3
|
$border-radius: var(--zen-input-border-radius, 8px);
|
|
4
4
|
$padding: var(--zen-input-padding, 0.5rem 1rem);
|
|
5
|
-
$focus-shadow: var(--zen-input-focus-shadow, 0 1px 4px
|
|
6
|
-
$placeholder-color: var(--zen-input-placeholder-color, hsl(
|
|
5
|
+
$focus-shadow: var(--zen-input-focus-shadow, 0 1px 4px hsl(0deg 0% 60% / 20%) inset);
|
|
6
|
+
$placeholder-color: var(--zen-input-placeholder-color, hsl(0deg 0% 60%));
|
|
7
7
|
|
|
8
8
|
// Color Palette
|
|
9
|
-
$outline: var(--zen-outline, 2px solid hsl(200deg 100 50 / 50%));
|
|
10
|
-
$error: var(--zen-error, hsl(
|
|
9
|
+
$outline: var(--zen-outline, 2px solid hsl(200deg 100% 50% / 50%));
|
|
10
|
+
$error: var(--zen-error, hsl(0deg 70% 50%));
|
|
11
11
|
|
|
12
12
|
input {
|
|
13
13
|
border: $border;
|
|
@@ -9,6 +9,19 @@ import { ControlValueAccessor, FormsModule, NG_VALUE_ACCESSOR } from '@angular/f
|
|
|
9
9
|
* @example
|
|
10
10
|
* <zen-input value="string" />
|
|
11
11
|
*
|
|
12
|
+
* ### CSS Custom Properties
|
|
13
|
+
* You can customize the component using CSS custom properties:
|
|
14
|
+
*
|
|
15
|
+
* ```css
|
|
16
|
+
* :root {
|
|
17
|
+
* --zen-input-border: 1px solid hsl(0deg 0% 80%);
|
|
18
|
+
* --zen-input-border-radius: 8px;
|
|
19
|
+
* --zen-input-padding: 0.5rem 1rem;
|
|
20
|
+
* --zen-input-focus-shadow: 0 1px 4px hsl(0deg 0% 60% / 20%) inset;
|
|
21
|
+
* --zen-input-placeholder-color: hsl(0deg 0% 60%);
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
12
25
|
* @implements {ControlValueAccessor}
|
|
13
26
|
*
|
|
14
27
|
* @author Konrad Stępień
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './skeleton.component';
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
$background: var(--zen-skeleton-background, hsl(0deg 0% 80%));
|
|
2
|
+
$radius: var(--zen-skeleton-border-radius, 0.5rem);
|
|
3
|
+
$animation-duration: var(--zen-skeleton-animation-duration, 1.6s);
|
|
4
|
+
|
|
5
|
+
:host {
|
|
6
|
+
background: $background;
|
|
7
|
+
display: inline-block;
|
|
8
|
+
min-height: 1rem;
|
|
9
|
+
min-width: 1rem;
|
|
10
|
+
border-radius: $radius;
|
|
11
|
+
position: relative;
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
|
|
14
|
+
// GPU acceleration hint
|
|
15
|
+
will-change: auto;
|
|
16
|
+
|
|
17
|
+
&::before {
|
|
18
|
+
content: '';
|
|
19
|
+
position: absolute;
|
|
20
|
+
top: 0;
|
|
21
|
+
left: 0;
|
|
22
|
+
width: 100%;
|
|
23
|
+
height: 100%;
|
|
24
|
+
background: linear-gradient(
|
|
25
|
+
90deg,
|
|
26
|
+
transparent 0%,
|
|
27
|
+
hsl(0deg 0% 100% / 60%) 40%,
|
|
28
|
+
hsl(0deg 0% 100% / 60%) 60%,
|
|
29
|
+
transparent 100%
|
|
30
|
+
);
|
|
31
|
+
transform: translateX(-100%);
|
|
32
|
+
animation: shimmer $animation-duration ease-in-out infinite;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&[rounded] {
|
|
36
|
+
border-radius: 9999px;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Accessibility: Motion sensitivity support
|
|
41
|
+
@media (prefers-reduced-motion: reduce) {
|
|
42
|
+
:host {
|
|
43
|
+
&::before {
|
|
44
|
+
animation: none;
|
|
45
|
+
content: unset;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Subtle pulse animation as fallback
|
|
49
|
+
animation: pulse $animation-duration ease-in-out infinite alternate;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@keyframes pulse {
|
|
54
|
+
0% {
|
|
55
|
+
opacity: 0.6;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
100% {
|
|
59
|
+
opacity: 1;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// GPU-optimized keyframes
|
|
64
|
+
@keyframes shimmer {
|
|
65
|
+
0% {
|
|
66
|
+
transform: translateX(-100%);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
100% {
|
|
70
|
+
transform: translateX(100%);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { ZenSkeletonComponent } from './skeleton.component';
|
|
4
|
+
|
|
5
|
+
describe('ZenSkeletonComponent', () => {
|
|
6
|
+
let component: ZenSkeletonComponent;
|
|
7
|
+
let fixture: ComponentFixture<ZenSkeletonComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
imports: [ZenSkeletonComponent],
|
|
12
|
+
}).compileComponents();
|
|
13
|
+
|
|
14
|
+
fixture = TestBed.createComponent(ZenSkeletonComponent);
|
|
15
|
+
component = fixture.componentInstance;
|
|
16
|
+
fixture.detectChanges();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should create', () => {
|
|
20
|
+
expect(component).toBeTruthy();
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ZenInputComponent loader component that displays loading states.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
*
|
|
8
|
+
* ```html
|
|
9
|
+
* <zen-skeleton rounded />
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* ### Properties:
|
|
13
|
+
* - `rounded` - Whether to display rounded corners
|
|
14
|
+
*
|
|
15
|
+
* ### CSS Custom Properties
|
|
16
|
+
* You can customize the component using CSS custom properties:
|
|
17
|
+
*
|
|
18
|
+
* ```css
|
|
19
|
+
* :root {
|
|
20
|
+
* --zen-skeleton-background: hsl(0deg 0% 80%);
|
|
21
|
+
* --zen-skeleton-border-radius: 0.5rem;
|
|
22
|
+
* --zen-skeleton-animation-duration: 1.6s;
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @author Konrad Stępień
|
|
27
|
+
* @license {@link https://github.com/kstepien3/ng-zen/blob/master/LICENSE|BSD-2-Clause}
|
|
28
|
+
* @see [GitHub](https://github.com/kstepien3/ng-zen)
|
|
29
|
+
*/
|
|
30
|
+
@Component({
|
|
31
|
+
selector: 'zen-skeleton, zen-skeleton[rounded]',
|
|
32
|
+
template: ``,
|
|
33
|
+
styleUrl: './skeleton.component.scss',
|
|
34
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
35
|
+
})
|
|
36
|
+
export class ZenSkeletonComponent {}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/angular';
|
|
2
|
+
|
|
3
|
+
import { ZenSkeletonComponent } from './skeleton.component';
|
|
4
|
+
|
|
5
|
+
interface StoryParams {
|
|
6
|
+
rounded: boolean;
|
|
7
|
+
height: number;
|
|
8
|
+
width: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
type StoryType = ZenSkeletonComponent & StoryParams;
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
title: 'Components/Skeleton',
|
|
15
|
+
component: ZenSkeletonComponent,
|
|
16
|
+
tags: ['autodocs'],
|
|
17
|
+
argTypes: {
|
|
18
|
+
rounded: { control: { type: 'boolean' } },
|
|
19
|
+
height: { control: { type: 'range', min: 1, max: 20, step: 0.25 }, description: 'Height managed by css' },
|
|
20
|
+
width: { control: { type: 'range', min: 1, max: 20, step: 0.25 }, description: 'Width managed by css' },
|
|
21
|
+
},
|
|
22
|
+
args: {
|
|
23
|
+
rounded: false,
|
|
24
|
+
height: 3,
|
|
25
|
+
width: 3,
|
|
26
|
+
},
|
|
27
|
+
} satisfies Meta<StoryType>;
|
|
28
|
+
|
|
29
|
+
type Story = StoryObj<StoryType>;
|
|
30
|
+
|
|
31
|
+
export const Default: Story = {
|
|
32
|
+
render: args => ({
|
|
33
|
+
props: { ...args },
|
|
34
|
+
template: `
|
|
35
|
+
<zen-skeleton ${args.rounded ? 'rounded' : ''} style="width: ${args.width}rem; height: ${args.height}rem"/>`,
|
|
36
|
+
}),
|
|
37
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
$outline: var(--zen-outline, 2px solid hsl(200deg 100 50 / 50%));
|
|
1
|
+
$outline: var(--zen-outline, 2px solid hsl(200deg 100% 50% / 50%));
|
|
2
2
|
$transition-duration: 0.15s;
|
|
3
|
-
$placeholder-color: var(--zen-input-placeholder-color, hsl(
|
|
3
|
+
$placeholder-color: var(--zen-input-placeholder-color, hsl(0deg 0% 60%));
|
|
4
4
|
$size: var(--zen-switch-size, 16px);
|
|
5
5
|
$margin: var(--zen-switch-margin, 2px);
|
|
6
6
|
$width: var(--zen-switch-width, 30px);
|
|
@@ -9,7 +9,7 @@ $height: calc(#{$size} + #{$margin} * 2);
|
|
|
9
9
|
|
|
10
10
|
:host {
|
|
11
11
|
cursor: pointer;
|
|
12
|
-
background: hsl(
|
|
12
|
+
background: hsl(0deg 0% 80%);
|
|
13
13
|
border-radius: 9999px;
|
|
14
14
|
width: $width;
|
|
15
15
|
height: $height;
|
|
@@ -48,10 +48,10 @@ $height: calc(#{$size} + #{$margin} * 2);
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
&[data-checked='true'] {
|
|
51
|
-
background-color: hsl(
|
|
51
|
+
background-color: hsl(0deg 0% 10%);
|
|
52
52
|
|
|
53
53
|
.switch-handle {
|
|
54
|
-
color: hsl(
|
|
54
|
+
color: hsl(0deg 0% 10%);
|
|
55
55
|
right: 0;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
import { ChangeDetectionStrategy, Component, forwardRef, model } from '@angular/core';
|
|
2
2
|
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* ZenInputComponent is a reusable text input component designed to provide
|
|
6
|
+
* a consistent and customizable input style across the application.
|
|
7
|
+
* It supports Angular forms integration and provides two-way data binding.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
*
|
|
11
|
+
* ```html
|
|
12
|
+
* <zen-switch [disabled]="false" [value]="true" />
|
|
13
|
+
*```
|
|
14
|
+
*
|
|
15
|
+
* ### CSS Custom Properties
|
|
16
|
+
* You can customize the component using CSS custom properties:
|
|
17
|
+
*
|
|
18
|
+
* ```css
|
|
19
|
+
* :root {
|
|
20
|
+
* --zen-input-border: 1px solid hsl(0deg 0% 80%);
|
|
21
|
+
* --zen-input-border-radius: 8px;
|
|
22
|
+
* --zen-input-padding: 0.5rem 1rem;
|
|
23
|
+
* --zen-input-focus-shadow: 0 1px 4px hsl(0deg 0% 60% / 20%) inset;
|
|
24
|
+
* --zen-input-placeholder-color: hsl(0deg 0% 60%);
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @implements {ControlValueAccessor}
|
|
29
|
+
*
|
|
30
|
+
* @author Konrad Stępień
|
|
31
|
+
* @license {@link https://github.com/kstepien3/ng-zen/blob/master/LICENSE|BSD-2-Clause}
|
|
32
|
+
* @see [GitHub](https://github.com/kstepien3/ng-zen)
|
|
33
|
+
*/
|
|
4
34
|
@Component({
|
|
5
35
|
selector: 'zen-switch',
|
|
6
36
|
template: `
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// Component Variables
|
|
2
|
-
$border: var(--zen-input-border, 1px solid hsl(
|
|
2
|
+
$border: var(--zen-input-border, 1px solid hsl(0deg 0% 80%));
|
|
3
3
|
$border-radius: var(--zen-input-border-radius, 8px);
|
|
4
4
|
$padding: var(--zen-input-padding, 0.5rem 1rem);
|
|
5
|
-
$focus-shadow: var(--zen-input-focus-shadow, 0 1px 4px
|
|
6
|
-
$placeholder-color: var(--zen-input-placeholder-color, hsl(
|
|
5
|
+
$focus-shadow: var(--zen-input-focus-shadow, 0 1px 4px hsl(0deg 0% 60% / 20%) inset);
|
|
6
|
+
$placeholder-color: var(--zen-input-placeholder-color, hsl(0deg 0% 60%));
|
|
7
7
|
|
|
8
8
|
// Color Palette
|
|
9
|
-
$outline: var(--zen-outline, 2px solid hsl(200deg 100 50 / 50%));
|
|
10
|
-
$error: var(--zen-error, hsl(
|
|
9
|
+
$outline: var(--zen-outline, 2px solid hsl(200deg 100% 50% / 50%));
|
|
10
|
+
$error: var(--zen-error, hsl(0deg 70% 50%));
|
|
11
11
|
|
|
12
12
|
:host {
|
|
13
13
|
border: $border;
|
|
@@ -8,6 +8,19 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
|
8
8
|
* @example
|
|
9
9
|
* <textarea zen-textarea></textarea>
|
|
10
10
|
*
|
|
11
|
+
* ### CSS Custom Properties
|
|
12
|
+
* You can customize the component using CSS custom properties:
|
|
13
|
+
*
|
|
14
|
+
* ```css
|
|
15
|
+
* :root {
|
|
16
|
+
* --zen-input-border: 1px solid hsl(0deg 0% 80%);
|
|
17
|
+
* --zen-input-border-radius: 8px;
|
|
18
|
+
* --zen-input-padding: 0.5rem 1rem;
|
|
19
|
+
* --zen-input-focus-shadow: 0 1px 4px hsl(0deg 0% 60% / 20%) inset;
|
|
20
|
+
* --zen-input-placeholder-color: hsl(0deg 0% 60%);
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
11
24
|
* @author Konrad Stępień
|
|
12
25
|
* @license {@link https://github.com/kstepien3/ng-zen/blob/master/LICENSE|BSD-2-Clause}
|
|
13
26
|
* @see [GitHub](https://github.com/kstepien3/ng-zen)
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"type": "array",
|
|
11
11
|
"items": {
|
|
12
12
|
"type": "string",
|
|
13
|
-
"enum": ["avatar", "button", "checkbox", "divider", "input", "switch", "textarea"]
|
|
13
|
+
"enum": ["avatar", "button", "checkbox", "divider", "input", "skeleton", "switch", "textarea"]
|
|
14
14
|
},
|
|
15
15
|
"multiselect": true,
|
|
16
16
|
"x-prompt": "Which component should be generated?"
|