@kubex/zinc 1.1.17 → 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.
@@ -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 `error`.
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubex/zinc",
3
- "version": "1.1.17",
3
+ "version": "1.1.19",
4
4
  "description": "A collection of web components for building web applications based off of @shoelace-style/Shoelace",
5
5
  "keywords": [
6
6
  "web components",
@@ -60,7 +60,7 @@ export default class ZnButton extends ZincElement implements ZincFormControl {
60
60
  @queryAll('.loading-countdown') countdownContainer: HTMLElement[];
61
61
 
62
62
  @property({}) color: 'default' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning' |
63
- 'transparent' | 'star' | (string & Record<never, never>) = 'default';
63
+ 'transparent' | 'star' | 'white' | (string & Record<never, never>) = 'default';
64
64
  @property({attribute: 'hover-color'}) hoverColor: string;
65
65
  @property({type: Boolean}) text = false;
66
66
  @property({type: Boolean}) outline = false;
@@ -388,6 +388,7 @@ export default class ZnButton extends ZincElement implements ZincFormControl {
388
388
  'button--warning': this.color === 'warning',
389
389
  'button--transparent': this.color === 'transparent',
390
390
  'button--star': this.color === 'star',
391
+ 'button--white': this.color === 'white',
391
392
  'button--outline': this.outline,
392
393
  'button--text': (this.text && !this.outline),
393
394
  'button--icon-button': !!this.iconButton,
@@ -244,6 +244,22 @@
244
244
  }
245
245
  }
246
246
 
247
+ /**
248
+ * White: white panel background with a neutral border, matching the
249
+ * icon-button look but for normal (auto-width, text) buttons.
250
+ *
251
+ * Doubled-up selector so it out-cascades the standard/secondary combos.
252
+ */
253
+ .button.button--white {
254
+ background: rgb(var(--zn-panel));
255
+ border-color: var(--zn-button-border-color, rgb(var(--zn-border-color)));
256
+ color: rgb(var(--zn-text));
257
+
258
+ &:hover:not([disabled]), &:active:not([disabled]) {
259
+ background: rgba(var(--zn-color-tab), 0.5);
260
+ }
261
+ }
262
+
247
263
  /**
248
264
  * Icon buttons
249
265
  *
@@ -722,11 +722,13 @@ export default class ZnDataTable extends ZincElement {
722
722
 
723
723
  return html`
724
724
  <div class="table__footer__pagination-buttons">
725
- <zn-button @click="${this.page !== 1 ? this.goToFirstPage : undefined}"
725
+ <zn-button color="white"
726
+ @click="${this.page !== 1 ? this.goToFirstPage : undefined}"
726
727
  ?disabled="${this.page === 1}"
727
728
  icon="arrow_left@lu">First
728
729
  </zn-button>
729
- <zn-button @click="${this.page !== 1 ? this.goToPreviousPage : undefined}"
730
+ <zn-button color="white"
731
+ @click="${this.page !== 1 ? this.goToPreviousPage : undefined}"
730
732
  ?disabled="${this.page === 1}">Back
731
733
  </zn-button>
732
734
  ${this.getPageRange().map((p) => p === 'ellipsis'
@@ -737,10 +739,12 @@ export default class ZnDataTable extends ZincElement {
737
739
  class="${p === this.page ? 'table__footer__pagination-page--active' : ''}">${p}
738
740
  </zn-button>`
739
741
  )}
740
- <zn-button @click="${this.page !== this.totalPages ? this.goToNextPage : undefined}"
742
+ <zn-button color="white"
743
+ @click="${this.page !== this.totalPages ? this.goToNextPage : undefined}"
741
744
  ?disabled="${this.page === this.totalPages}">Next
742
745
  </zn-button>
743
- <zn-button @click="${this.page !== this.totalPages ? this.goToLastPage : undefined}"
746
+ <zn-button color="white"
747
+ @click="${this.page !== this.totalPages ? this.goToLastPage : undefined}"
744
748
  ?disabled="${this.page === this.totalPages}"
745
749
  icon="arrow_right@lu"
746
750
  icon-position="right">Last
@@ -284,23 +284,12 @@ table {
284
284
  flex-direction: row;
285
285
  align-items: center;
286
286
  gap: var(--zn-spacing-x-small);
287
-
288
- button {
289
- border: 1px solid rgb(var(--zn-border-color));
290
- border-radius: 5px;
291
- padding: var(--zn-spacing-x-small);
292
-
293
- &[disabled] {
294
- cursor: not-allowed;
295
- opacity: 0.5;
296
- }
297
- }
298
287
  }
299
288
 
300
289
  &__pagination-page--active::part(base) {
301
- background-color: rgb(var(--zn-primary));
302
- border-color: rgb(var(--zn-primary));
303
- color: rgb(var(--zn-text-on-primary, 255 255 255));
290
+ background-color: var(--zn-color-neutral-300);
291
+ border-color: var(--zn-color-neutral-300);
292
+ color: rgb(var(--zn-text));
304
293
  }
305
294
 
306
295
  &__pagination-ellipsis {
@@ -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
  `;
@@ -1,7 +1,14 @@
1
1
  @use "../../wc";
2
2
 
3
3
  :host {
4
- --indicator-color: var(--zn-color-info);
4
+ --zn-indicator-info: 100, 117, 242;
5
+ --zn-indicator-warning: 255, 136, 0;
6
+ --zn-indicator-error: 237, 84, 109;
7
+ --zn-indicator-success: 43, 192, 145;
8
+ --zn-indicator-disabled: 220, 220, 220;
9
+
10
+ --indicator-color: var(--zn-indicator-disabled);
11
+ --indicator-alt-color: var(--zn-indicator-disabled);
5
12
  white-space: nowrap;
6
13
  display: inline-block;
7
14
  }
@@ -15,18 +22,117 @@
15
22
  border-radius: 50%;
16
23
 
17
24
  &--info {
18
- --indicator-color: var(--zn-color-info);
25
+ --indicator-color: var(--zn-indicator-info);
19
26
  }
20
27
 
21
28
  &--error {
22
- --indicator-color: var(--zn-color-error);
29
+ --indicator-color: var(--zn-indicator-error);
23
30
  }
24
31
 
25
32
  &--warning {
26
- --indicator-color: var(--zn-color-warning);
33
+ --indicator-color: var(--zn-indicator-warning);
27
34
  }
28
35
 
29
36
  &--success {
30
- --indicator-color: var(--zn-color-success);
37
+ --indicator-color: var(--zn-indicator-success);
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
+ );
31
137
  }
32
138
  }