@kubex/zinc 1.1.18 → 1.1.19
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/dist/custom-elements.json +40 -3
- package/dist/vscode.html-custom-data.json +18 -1
- package/dist/web-types.json +25 -3
- package/dist/zn.d.ts +9 -1
- package/dist/zn.min.js +71 -71
- package/docs/pages/components/status-indicator.md +29 -1
- package/package.json +1 -1
- package/src/components/status-indicator/status-indicator.component.ts +19 -1
- package/src/components/status-indicator/status-indicator.scss +100 -0
|
@@ -24,13 +24,41 @@ A basic status indicator displays as a small circular dot with the default info
|
|
|
24
24
|
|
|
25
25
|
### Types
|
|
26
26
|
|
|
27
|
-
Use the `type` attribute to set the semantic meaning and color of the status indicator. Available types are: `info` (default), `success`, `warning`, and `
|
|
27
|
+
Use the `type` attribute to set the semantic meaning and color of the status indicator. Available types are: `info` (default), `success`, `warning`, `error`, and `disabled`.
|
|
28
28
|
|
|
29
29
|
```html:preview
|
|
30
30
|
<zn-status-indicator type="info"></zn-status-indicator>
|
|
31
31
|
<zn-status-indicator type="success"></zn-status-indicator>
|
|
32
32
|
<zn-status-indicator type="warning"></zn-status-indicator>
|
|
33
33
|
<zn-status-indicator type="error"></zn-status-indicator>
|
|
34
|
+
<zn-status-indicator type="disabled"></zn-status-indicator>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Glow
|
|
38
|
+
|
|
39
|
+
Add the `glow` attribute to animate a throbbing glow effect around the indicator, useful for drawing attention to a live or active status.
|
|
40
|
+
|
|
41
|
+
```html:preview
|
|
42
|
+
<zn-status-indicator type="info" glow></zn-status-indicator>
|
|
43
|
+
<zn-status-indicator type="success" glow></zn-status-indicator>
|
|
44
|
+
<zn-status-indicator type="warning" glow></zn-status-indicator>
|
|
45
|
+
<zn-status-indicator type="error" glow></zn-status-indicator>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Alternating Status
|
|
49
|
+
|
|
50
|
+
Use the `alt-type` attribute to animate the indicator between two statuses. This is useful for representing a status that is transitioning or flapping between two states, e.g. a service moving between `warning` and offline (`disabled`).
|
|
51
|
+
|
|
52
|
+
```html:preview
|
|
53
|
+
<zn-status-indicator type="warning" alt-type="disabled"></zn-status-indicator>
|
|
54
|
+
<zn-status-indicator type="success" alt-type="warning"></zn-status-indicator>
|
|
55
|
+
<zn-status-indicator type="error" alt-type="info"></zn-status-indicator>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The `alt-type` attribute accepts the same values as `type`: `info`, `success`, `warning`, `error`, and `disabled`. Combine it with `glow` for a pulsing, colour-switching effect.
|
|
59
|
+
|
|
60
|
+
```html:preview
|
|
61
|
+
<zn-status-indicator type="warning" alt-type="disabled" glow></zn-status-indicator>
|
|
34
62
|
```
|
|
35
63
|
|
|
36
64
|
### With Labels
|
package/package.json
CHANGED
|
@@ -14,7 +14,17 @@ import styles from './status-indicator.scss';
|
|
|
14
14
|
export default class ZnStatusIndicator extends ZincElement {
|
|
15
15
|
static styles: CSSResultGroup = unsafeCSS(styles);
|
|
16
16
|
|
|
17
|
-
@property() type: 'success' | 'error' | 'warning' | 'info' = 'info';
|
|
17
|
+
@property() type: 'success' | 'error' | 'warning' | 'info' | 'disabled' = 'info';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A secondary status type. When set, the indicator animates between `type`
|
|
21
|
+
* and this colour to represent a status transitioning between two states
|
|
22
|
+
* (e.g. `warning` and `disabled`).
|
|
23
|
+
*/
|
|
24
|
+
@property({attribute: 'alt-type'}) altType?: 'success' | 'error' | 'warning' | 'info' | 'disabled';
|
|
25
|
+
|
|
26
|
+
/** Animates a throbbing glow effect around the indicator. */
|
|
27
|
+
@property({type: Boolean, reflect: true}) glow = false;
|
|
18
28
|
|
|
19
29
|
render() {
|
|
20
30
|
return html`
|
|
@@ -24,6 +34,14 @@ export default class ZnStatusIndicator extends ZincElement {
|
|
|
24
34
|
'indicator--error': this.type === 'error',
|
|
25
35
|
'indicator--success': this.type === 'success',
|
|
26
36
|
'indicator--info': this.type === 'info',
|
|
37
|
+
'indicator--disabled': this.type === 'disabled',
|
|
38
|
+
'indicator--alt-warning': this.altType === 'warning',
|
|
39
|
+
'indicator--alt-error': this.altType === 'error',
|
|
40
|
+
'indicator--alt-success': this.altType === 'success',
|
|
41
|
+
'indicator--alt-info': this.altType === 'info',
|
|
42
|
+
'indicator--alt-disabled': this.altType === 'disabled',
|
|
43
|
+
'indicator--alternate': !!this.altType,
|
|
44
|
+
'indicator--glow': this.glow,
|
|
27
45
|
})}>
|
|
28
46
|
</div>
|
|
29
47
|
`;
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
--zn-indicator-disabled: 220, 220, 220;
|
|
9
9
|
|
|
10
10
|
--indicator-color: var(--zn-indicator-disabled);
|
|
11
|
+
--indicator-alt-color: var(--zn-indicator-disabled);
|
|
11
12
|
white-space: nowrap;
|
|
12
13
|
display: inline-block;
|
|
13
14
|
}
|
|
@@ -35,4 +36,103 @@
|
|
|
35
36
|
&--success {
|
|
36
37
|
--indicator-color: var(--zn-indicator-success);
|
|
37
38
|
}
|
|
39
|
+
|
|
40
|
+
&--disabled {
|
|
41
|
+
--indicator-color: var(--zn-indicator-disabled);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Alternate (secondary) colour, used by the alternating animation.
|
|
45
|
+
&--alt-info {
|
|
46
|
+
--indicator-alt-color: var(--zn-indicator-info);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&--alt-error {
|
|
50
|
+
--indicator-alt-color: var(--zn-indicator-error);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&--alt-warning {
|
|
54
|
+
--indicator-alt-color: var(--zn-indicator-warning);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&--alt-success {
|
|
58
|
+
--indicator-alt-color: var(--zn-indicator-success);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&--alt-disabled {
|
|
62
|
+
--indicator-alt-color: var(--zn-indicator-disabled);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&--glow {
|
|
66
|
+
animation: indicator-glow 2s ease-in-out infinite;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Animates between the primary colour and the alternate colour to
|
|
70
|
+
// represent a status transitioning between two states.
|
|
71
|
+
&--alternate {
|
|
72
|
+
animation: indicator-alternate 2s ease-in-out infinite;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// When both glow and alternate are set, a single animation switches
|
|
76
|
+
// colour while pulsing the glow.
|
|
77
|
+
&--alternate#{&}--glow {
|
|
78
|
+
animation: indicator-alternate-glow 2s ease-in-out infinite;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@keyframes indicator-glow {
|
|
83
|
+
0%,
|
|
84
|
+
100% {
|
|
85
|
+
background-color: rgba(var(--indicator-color), 0.5);
|
|
86
|
+
box-shadow: 0 0 1px 0 rgba(var(--indicator-color), 0.1);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
50% {
|
|
90
|
+
background-color: rgba(var(--indicator-color), 0.8);
|
|
91
|
+
box-shadow: 0 0 3px 1px rgba(var(--indicator-color), 0.5);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@keyframes indicator-alternate {
|
|
96
|
+
0%,
|
|
97
|
+
100% {
|
|
98
|
+
background-color: rgba(var(--indicator-color), 0.7);
|
|
99
|
+
border-color: rgb(var(--indicator-color));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
50% {
|
|
103
|
+
background-color: rgba(var(--indicator-alt-color), 0.7);
|
|
104
|
+
border-color: rgb(var(--indicator-alt-color));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@keyframes indicator-alternate-glow {
|
|
109
|
+
0%,
|
|
110
|
+
100% {
|
|
111
|
+
background-color: rgba(var(--indicator-color), 0.5);
|
|
112
|
+
border-color: rgb(var(--indicator-color));
|
|
113
|
+
box-shadow: 0 0 1px 0 rgba(var(--indicator-color), 0.1);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
50% {
|
|
117
|
+
background-color: rgba(var(--indicator-alt-color), 0.8);
|
|
118
|
+
border-color: rgb(var(--indicator-alt-color));
|
|
119
|
+
box-shadow: 0 0 3px 1px rgba(var(--indicator-alt-color), 0.5);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
@media (prefers-reduced-motion: reduce) {
|
|
124
|
+
.indicator--glow {
|
|
125
|
+
animation: none;
|
|
126
|
+
box-shadow: 0 0 4px 1px rgba(var(--indicator-color), 0.6);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Without motion, fall back to a static split between the two colours.
|
|
130
|
+
.indicator--alternate {
|
|
131
|
+
animation: none;
|
|
132
|
+
background: linear-gradient(
|
|
133
|
+
90deg,
|
|
134
|
+
rgb(var(--indicator-color)) 0 50%,
|
|
135
|
+
rgb(var(--indicator-alt-color)) 50% 100%
|
|
136
|
+
);
|
|
137
|
+
}
|
|
38
138
|
}
|