@kubex/zinc 1.1.18 → 1.1.20

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.18",
3
+ "version": "1.1.20",
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",
@@ -202,7 +202,7 @@ export default class ZnChatMessage extends ZincElement {
202
202
  <span class="message__sender">${this.sender || (this.customerInitiated ? 'Customer' : 'You')}</span>
203
203
  ${this.time ? html`<span class="message__time">${this.getSentTime()}</span>` : nothing}
204
204
  ${this.actionType === 'internal' ? html`
205
- <zn-chip type="info">Internal</zn-chip>` : nothing}
205
+ <zn-chip type="info">Internal Note</zn-chip>` : nothing}
206
206
  <slot name="badge"></slot>
207
207
  </div>`;
208
208
  }
@@ -3,6 +3,11 @@
3
3
  :host {
4
4
  display: block;
5
5
  padding-inline: calc(var(--zn-gutter, 0) + var(--zn-base-gap, 0));
6
+
7
+ // Bubble tints by message origin / type (overridable per consumer).
8
+ --message-bubble-agent: rgba(4, 114, 225, 0.1);
9
+ --message-bubble-customer: rgba(48, 170, 61, 0.1);
10
+ --message-bubble-internal: rgba(255, 203, 0, 0.1);
6
11
  }
7
12
 
8
13
  .message {
@@ -46,7 +51,7 @@
46
51
  gap: var(--zn-spacing-small);
47
52
  padding: 11px var(--zn-spacing-small); // 11px top/bottom + 24px line = 46px base
48
53
  border-radius: var(--zn-border-radius);
49
- background: var(--message-background, hsl(48, 78%, 94%));
54
+ background: var(--message-bubble-agent);
50
55
  min-height: 46px; // base (padding included); grows only when text wraps
51
56
 
52
57
  &--sending {
@@ -171,11 +176,15 @@
171
176
 
172
177
  // Bubble tints by message origin / type.
173
178
  :host([agent-initiated]) .message__bubble {
174
- background: var(--message-background, rgba(var(--zn-color-info), 0.1));
179
+ background: var(--message-background, var(--message-bubble-agent));
180
+ }
181
+
182
+ :host([customer-initiated]) .message__bubble {
183
+ background: var(--message-background, var(--message-bubble-customer));
175
184
  }
176
185
 
177
186
  :host([action-type="internal"]) .message__bubble {
178
- background: var(--message-background, rgba(var(--zn-color-warning), 0.15));
187
+ background: var(--message-background, var(--message-bubble-internal));
179
188
  }
180
189
 
181
190
  :host([action-type="error"]) .message__bubble {
@@ -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
  }