@kubex/zinc 1.1.19 → 1.1.21

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubex/zinc",
3
- "version": "1.1.19",
3
+ "version": "1.1.21",
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",
@@ -55,7 +55,3 @@ table:not(.remarkd-table) {
55
55
  .zn-table-fixed {
56
56
  table-layout: fixed;
57
57
  }
58
-
59
- thead tr:last-of-type th {
60
- border-bottom: 0;
61
- }
@@ -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 {
@@ -1,6 +1,6 @@
1
1
  import {choose} from 'lit/directives/choose.js';
2
2
  import {classMap} from "lit/directives/class-map.js";
3
- import {type CSSResultGroup, html, render, unsafeCSS} from 'lit';
3
+ import {type CSSResultGroup, html, type PropertyValues, render, unsafeCSS} from 'lit';
4
4
  import {icons} from 'lucide';
5
5
  import {property} from 'lit/decorators.js';
6
6
  import {sha256} from '../../utilities/sha256';
@@ -90,6 +90,8 @@ export default class ZnIcon extends ZincElement {
90
90
  gravatarOptions = "";
91
91
  defaultLibrary: IconLibrary = "material-symbols-outlined";
92
92
 
93
+ private libraryAutoSet = false;
94
+
93
95
  convertToLibrary(input: string): IconLibrary {
94
96
  return this.convertIndicatorToLibrary(input) ?? this.defaultLibrary
95
97
  }
@@ -140,6 +142,33 @@ export default class ZnIcon extends ZincElement {
140
142
  connectedCallback() {
141
143
  super.connectedCallback();
142
144
 
145
+ // load the material icons font if the library is set to material
146
+ render(html`
147
+ <link
148
+ href="https://cdn.jsdelivr.net/gh/kubex/icons@0.0.8/dist/kubex-icons.css"
149
+ rel="stylesheet">
150
+ <link
151
+ href="https://cdn.lineicons.com/5.0/lineicons.css"
152
+ rel="stylesheet">
153
+ <link
154
+ href="https://fonts.googleapis.com/icon?family=Material+Symbols+Outlined|Material+Icons|Material+Icons+Round|Material+Icons+Sharp|Material+Icons+Two+Tone|Material+Icons+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200"
155
+ rel="stylesheet">`, document.head);
156
+ }
157
+
158
+ protected override willUpdate(changedProperties: PropertyValues<this>) {
159
+ super.willUpdate(changedProperties);
160
+
161
+ if (changedProperties.has('src')) {
162
+ this.parseSrc();
163
+ }
164
+ }
165
+
166
+ private parseSrc() {
167
+ if (this.libraryAutoSet) {
168
+ this.library = undefined as unknown as IconLibrary;
169
+ this.libraryAutoSet = false;
170
+ }
171
+
143
172
  let hashFragment = '';
144
173
 
145
174
  if (this.src && this.src.includes('#')) {
@@ -157,8 +186,8 @@ export default class ZnIcon extends ZincElement {
157
186
  if (libraryOrDomain.includes('.')) {
158
187
  this.library = this.library ?? "gravatar";
159
188
  } else if ((this.library === undefined) && indicatedLibrary !== undefined) {
160
- // if split[1] is a valid library name, set it
161
189
  this.library = indicatedLibrary;
190
+ this.libraryAutoSet = true;
162
191
  this.src = this.src.slice(0, atIndex);
163
192
  } else if (this.library !== undefined && indicatedLibrary === this.library) {
164
193
  this.src = this.src.slice(0, atIndex);
@@ -173,21 +202,10 @@ export default class ZnIcon extends ZincElement {
173
202
  } else if (!this.library && this.src && !this.src.includes('/')) {
174
203
  this.applyHashFragment(hashFragment);
175
204
  this.library = this.defaultLibrary;
205
+ this.libraryAutoSet = true;
176
206
  } else {
177
207
  this.applyHashFragment(hashFragment);
178
208
  }
179
-
180
- // load the material icons font if the library is set to material
181
- render(html`
182
- <link
183
- href="https://cdn.jsdelivr.net/gh/kubex/icons@0.0.8/dist/kubex-icons.css"
184
- rel="stylesheet">
185
- <link
186
- href="https://cdn.lineicons.com/5.0/lineicons.css"
187
- rel="stylesheet">
188
- <link
189
- href="https://fonts.googleapis.com/icon?family=Material+Symbols+Outlined|Material+Icons|Material+Icons+Round|Material+Icons+Sharp|Material+Icons+Two+Tone|Material+Icons+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200"
190
- rel="stylesheet">`, document.head);
191
209
  }
192
210
 
193
211
  private applyHashFragment(hashFragment: string) {
@@ -116,7 +116,7 @@
116
116
  50% {
117
117
  background-color: rgba(var(--indicator-alt-color), 0.8);
118
118
  border-color: rgb(var(--indicator-alt-color));
119
- box-shadow: 0 0 3px 1px rgba(var(--indicator-alt-color), 0.5);
119
+ box-shadow: 0 0 4px 2px rgba(var(--indicator-alt-color), 0.5);
120
120
  }
121
121
  }
122
122