@kubex/zinc 1.0.119 → 1.1.0
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 +453 -20
- package/dist/vscode.html-custom-data.json +87 -11
- package/dist/web-types.json +168 -12
- package/dist/zn.d.ts +149 -25
- package/dist/zn.min.css +1 -1
- package/dist/zn.min.js +911 -874
- package/docs/assets/styles/docs.css +1 -1
- package/docs/pages/components/button.md +25 -7
- package/docs/pages/components/chat-message.md +62 -0
- package/docs/pages/components/data-table-search.md +6 -6
- package/docs/pages/components/editor.md +1 -1
- package/docs/pages/components/file.md +1 -1
- package/docs/pages/components/form-group.md +1 -1
- package/docs/pages/components/icon.md +19 -2
- package/docs/pages/components/menu.md +23 -2
- package/docs/pages/components/select.md +2 -2
- package/docs/pages/components/tile-group.md +92 -0
- package/docs/pages/components/tile.md +80 -25
- package/package.json +1 -1
- package/scss/_root.scss +1 -1
- package/scss/mixins/_spacing-mixins.scss +20 -0
- package/scss/mixins/_typography-mixins.scss +22 -0
- package/scss/mixins/index.scss +2 -1
- package/scss/shared/_base.scss +18 -20
- package/scss/shared/_button.scss +5 -3
- package/scss/shared/_table.scss +4 -1
- package/scss/shared/layout.scss +2 -2
- package/scss/themes/_index.scss +2 -0
- package/scss/themes/_light.scss +22 -45
- package/scss/themes/_spacing.scss +44 -0
- package/scss/themes/_typography.scss +62 -0
- package/src/components/animated-button/README.md +1 -1
- package/src/components/button/button.component.ts +27 -5
- package/src/components/button/button.scss +86 -30
- package/src/components/button-menu/button-menu.component.ts +22 -9
- package/src/components/button-menu/button-menu.scss +1 -2
- package/src/components/button-menu/button-menu.test.ts +18 -0
- package/src/components/chat-message/chat-message.component.ts +73 -0
- package/src/components/chat-message/chat-message.scss +60 -0
- package/src/components/chat-message/index.ts +12 -0
- package/src/components/checkbox/checkbox.scss +2 -2
- package/src/components/chip/chip.component.ts +0 -5
- package/src/components/chip/chip.scss +14 -35
- package/src/components/content-block/content-block.component.ts +46 -45
- package/src/components/content-block/content-block.scss +58 -27
- package/src/components/data-table/data-table.scss +10 -7
- package/src/components/data-table-sort/data-table-sort.scss +1 -1
- package/src/components/dialog/dialog.component.ts +3 -3
- package/src/components/dialog/dialog.scss +2 -2
- package/src/components/dropdown/dropdown.component.ts +1 -0
- package/src/components/editor/editor.component.ts +3 -1
- package/src/components/editor/editor.scss +9 -2
- package/src/components/editor/modules/ai/panel/ai-panel.scss +2 -2
- package/src/components/editor/modules/ai/tooltip/ai-tooltip.scss +1 -1
- package/src/components/editor/modules/context-menu/context-menu.ts +20 -20
- package/src/components/editor/modules/dialog/dialog.component.ts +3 -4
- package/src/components/editor/modules/dialog/dialog.scss +2 -1
- package/src/components/editor/modules/dialog/dialog.ts +12 -8
- package/src/components/editor/modules/toolbar/tool/tool.component.ts +1 -5
- package/src/components/editor/modules/toolbar/toolbar.component.ts +54 -50
- package/src/components/editor/modules/toolbar/toolbar.scss +4 -29
- package/src/components/editor/modules/toolbar/toolbar.ts +15 -17
- package/src/components/expanding-action/expanding-action.component.ts +14 -7
- package/src/components/expanding-action/expanding-action.scss +44 -2
- package/src/components/file/file.scss +2 -2
- package/src/components/header/header.component.ts +1 -1
- package/src/components/header/header.scss +3 -3
- package/src/components/hover-container/hover-container.scss +1 -1
- package/src/components/icon/icon.component.ts +6 -1
- package/src/components/icon/icon.scss +31 -0
- package/src/components/icon-picker/icon-picker.scss +3 -3
- package/src/components/input/input.scss +3 -3
- package/src/components/input-group/input-group.scss +16 -16
- package/src/components/markdown-editor/markdown-editor.scss +2 -2
- package/src/components/menu/menu.component.ts +32 -1
- package/src/components/menu/menu.scss +28 -5
- package/src/components/menu-item/menu-item.component.ts +6 -2
- package/src/components/menu-item/menu-item.scss +49 -5
- package/src/components/navbar/navbar.component.ts +7 -4
- package/src/components/navbar/navbar.scss +93 -21
- package/src/components/page/page.component.ts +1 -1
- package/src/components/page/page.scss +7 -26
- package/src/components/panel/panel.scss +5 -8
- package/src/components/priority-list/priority-list.scss +1 -1
- package/src/components/rating/rating.scss +1 -1
- package/src/components/scroll-container/scroll-container.scss +2 -1
- package/src/components/select/select.scss +1 -1
- package/src/components/settings-container/settings-container.scss +2 -2
- package/src/components/stat/stat.scss +8 -5
- package/src/components/tile/tile.component.ts +10 -2
- package/src/components/tile/tile.scss +108 -67
- package/src/components/tile-group/index.ts +12 -0
- package/src/components/tile-group/tile-group.component.ts +66 -0
- package/src/components/tile-group/tile-group.scss +23 -0
- package/src/form-control.scss +2 -1
- package/src/wc.scss +1 -0
- package/src/zinc.ts +2 -0
- package/src/components/editor/modules/toolbar/tool/tool.scss +0 -5
|
@@ -40,7 +40,7 @@ export default class ZnButtonMenu extends ZincElement {
|
|
|
40
40
|
@property({type: Number, attribute: 'max-level'})
|
|
41
41
|
public maxLevel: number = 2; // primary = 1, secondary = 2, transparent = 3
|
|
42
42
|
|
|
43
|
-
@property({type: Number, attribute: 'icon-size', reflect: true}) iconSize: number =
|
|
43
|
+
@property({type: Number, attribute: 'icon-size', reflect: true}) iconSize: number = 20;
|
|
44
44
|
|
|
45
45
|
@property({type: Boolean, attribute: 'no-gap'}) public noGap: boolean;
|
|
46
46
|
|
|
@@ -172,9 +172,6 @@ export default class ZnButtonMenu extends ZincElement {
|
|
|
172
172
|
if (index < visibleButtons) {
|
|
173
173
|
this.shadowRoot?.querySelector('.button-menu__container')?.appendChild(button.button);
|
|
174
174
|
|
|
175
|
-
if (!button.button.hasAttribute('color')) {
|
|
176
|
-
button.button.setAttribute('color', button.button.hasAttribute('primary') ? 'primary' : button.button.hasAttribute('secondary') ? 'secondary' : 'transparent');
|
|
177
|
-
}
|
|
178
175
|
if (button.button.hasAttribute('primary') || button.button.hasAttribute('secondary')) {
|
|
179
176
|
button.button.setAttribute('text', "");
|
|
180
177
|
}
|
|
@@ -200,7 +197,7 @@ export default class ZnButtonMenu extends ZincElement {
|
|
|
200
197
|
buttons.forEach((button: CustomButtonWidths, index: number) => {
|
|
201
198
|
if (index >= visibleButtons) {
|
|
202
199
|
const menuItem = document.createElement('zn-menu-item');
|
|
203
|
-
menuItem.
|
|
200
|
+
menuItem.textContent = this.getButtonLabel(button.button);
|
|
204
201
|
menuItem.setAttribute('id', button.button.id || `zn-button-menu-item-${index}`);
|
|
205
202
|
menuItem.setAttribute('role', 'menuitem');
|
|
206
203
|
const attr = button.button.attributes;
|
|
@@ -215,6 +212,10 @@ export default class ZnButtonMenu extends ZincElement {
|
|
|
215
212
|
if (icon) {
|
|
216
213
|
const iconElement = document.createElement('zn-icon');
|
|
217
214
|
iconElement.setAttribute('src', icon);
|
|
215
|
+
const iconLibrary = button.button.getAttribute('icon-library');
|
|
216
|
+
if (iconLibrary) {
|
|
217
|
+
iconElement.setAttribute('library', iconLibrary);
|
|
218
|
+
}
|
|
218
219
|
iconElement.setAttribute('size', '18');
|
|
219
220
|
iconElement.setAttribute('slot', 'prefix');
|
|
220
221
|
menuItem.appendChild(iconElement);
|
|
@@ -236,7 +237,7 @@ export default class ZnButtonMenu extends ZincElement {
|
|
|
236
237
|
menuItems[category].forEach((item: Element) => {
|
|
237
238
|
menu.appendChild(item);
|
|
238
239
|
});
|
|
239
|
-
// if only 1
|
|
240
|
+
// if only 1 category item
|
|
240
241
|
} else if (menuItems[category].length === 1) {
|
|
241
242
|
const menuItem = menuItems[category][0] as ZnMenuItem;
|
|
242
243
|
menu.appendChild(menuItem);
|
|
@@ -246,6 +247,7 @@ export default class ZnButtonMenu extends ZincElement {
|
|
|
246
247
|
menuItem.innerText = category.charAt(0).toUpperCase() + category.slice(1);
|
|
247
248
|
const submenu = document.createElement('zn-menu');
|
|
248
249
|
submenu.setAttribute('slot', 'submenu');
|
|
250
|
+
submenu.setAttribute('variant', menu.variant);
|
|
249
251
|
|
|
250
252
|
menuItems[category].forEach((item: Element) => {
|
|
251
253
|
submenu.appendChild(item);
|
|
@@ -273,12 +275,19 @@ export default class ZnButtonMenu extends ZincElement {
|
|
|
273
275
|
.join('')
|
|
274
276
|
.trim() : '';
|
|
275
277
|
|
|
276
|
-
|
|
278
|
+
const label = slottedLabel ||
|
|
277
279
|
button.content ||
|
|
278
280
|
button.getAttribute('content') ||
|
|
279
281
|
(button as ZnButton & { caption?: string }).caption ||
|
|
280
282
|
button.getAttribute('caption') ||
|
|
281
|
-
button.
|
|
283
|
+
button.tooltip ||
|
|
284
|
+
button.getAttribute('tooltip') ||
|
|
285
|
+
button.getAttribute('aria-label') ||
|
|
286
|
+
button.button?.innerText ||
|
|
287
|
+
button.textContent ||
|
|
288
|
+
'';
|
|
289
|
+
|
|
290
|
+
return label.trim();
|
|
282
291
|
}
|
|
283
292
|
|
|
284
293
|
render() {
|
|
@@ -290,7 +299,11 @@ export default class ZnButtonMenu extends ZincElement {
|
|
|
290
299
|
})}">
|
|
291
300
|
<div class="button-menu__container"></div>
|
|
292
301
|
<zn-dropdown placement="bottom-end">
|
|
293
|
-
<zn-button slot="trigger"
|
|
302
|
+
<zn-button slot="trigger"
|
|
303
|
+
icon="ellipsis"
|
|
304
|
+
icon-library="lucide"
|
|
305
|
+
icon-size="${this.iconSize}"
|
|
306
|
+
icon-button="small"></zn-button>
|
|
294
307
|
<zn-menu></zn-menu>
|
|
295
308
|
</zn-dropdown>
|
|
296
309
|
<slot></slot>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
:host {
|
|
4
4
|
display: block;
|
|
5
5
|
max-width: 100%;
|
|
6
|
-
--menu-gap: var(--zn-spacing-
|
|
6
|
+
--menu-gap: var(--zn-spacing-x-small);
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
.button-menu--no-gap {
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
display: flex;
|
|
15
15
|
flex-direction: row;
|
|
16
16
|
justify-content: flex-end;
|
|
17
|
-
padding: var(--zn-spacing-small) 0;
|
|
18
17
|
margin: 0;
|
|
19
18
|
|
|
20
19
|
min-width: 34px;
|
|
@@ -45,6 +45,24 @@ describe('<zn-button-menu>', () => {
|
|
|
45
45
|
expect(menuItem!.innerText).to.equal('Content Label');
|
|
46
46
|
});
|
|
47
47
|
|
|
48
|
+
it('uses the aria-label of an icon button when creating collapsed menu items', async () => {
|
|
49
|
+
const el = await fixture<ZnButtonMenu>(html`
|
|
50
|
+
<zn-button-menu limit="0">
|
|
51
|
+
<zn-button id="icon-label" icon="pencil-ruler@lu" icon-button="small"
|
|
52
|
+
aria-label="Customer Details"></zn-button>
|
|
53
|
+
</zn-button-menu>
|
|
54
|
+
`);
|
|
55
|
+
|
|
56
|
+
await el.updateComplete;
|
|
57
|
+
await aTimeout(20);
|
|
58
|
+
el.calculateVisibleButtons();
|
|
59
|
+
|
|
60
|
+
const menuItem = el.shadowRoot!.querySelector('zn-menu-item');
|
|
61
|
+
|
|
62
|
+
expect(menuItem).to.exist;
|
|
63
|
+
expect(menuItem!.textContent?.trim()).to.equal('Customer Details');
|
|
64
|
+
});
|
|
65
|
+
|
|
48
66
|
it('uses the button caption attribute when creating collapsed menu items', async () => {
|
|
49
67
|
const el = await fixture<ZnButtonMenu>(html`
|
|
50
68
|
<zn-button-menu limit="0">
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import {type CSSResultGroup, html, unsafeCSS} from 'lit';
|
|
2
|
+
import {property} from "lit/decorators.js";
|
|
3
|
+
import ZincElement from '../../internal/zinc-element';
|
|
4
|
+
import ZnIcon from "../icon";
|
|
5
|
+
|
|
6
|
+
import styles from './chat-message.scss';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @summary A single message in a chat-style conversation: avatar, sender,
|
|
10
|
+
* time, optional badge, and a message bubble with optional actions.
|
|
11
|
+
* @documentation https://zinc.style/components/chat-message
|
|
12
|
+
* @status experimental
|
|
13
|
+
* @since 1.0
|
|
14
|
+
*
|
|
15
|
+
* @dependency zn-icon
|
|
16
|
+
*
|
|
17
|
+
* @slot - The message content.
|
|
18
|
+
* @slot badge - Rendered in the header after the sender and time (e.g. an INTERNAL NOTE chip).
|
|
19
|
+
* @slot edit-dialog-trigger - Action rendered at the end of the bubble (e.g. a remove icon button).
|
|
20
|
+
* @slot edit-dialog - Pass-through for an associated dialog element.
|
|
21
|
+
*
|
|
22
|
+
* @csspart base - The component's base wrapper.
|
|
23
|
+
* @csspart avatar - The avatar column.
|
|
24
|
+
* @csspart body - The header and bubble column.
|
|
25
|
+
* @csspart header - The sender/time/badge row.
|
|
26
|
+
* @csspart bubble - The message bubble.
|
|
27
|
+
* @csspart content - The message content within the bubble.
|
|
28
|
+
*
|
|
29
|
+
* @cssproperty --message-background - The bubble's background colour.
|
|
30
|
+
*/
|
|
31
|
+
export default class ZnChatMessage extends ZincElement {
|
|
32
|
+
static styles: CSSResultGroup = unsafeCSS(styles);
|
|
33
|
+
static dependencies = {
|
|
34
|
+
'zn-icon': ZnIcon
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/** The sender's name, also used for the avatar initials. */
|
|
38
|
+
@property() sender: string = '';
|
|
39
|
+
|
|
40
|
+
/** Unix timestamp (seconds) of the message, shown as HH:MM. */
|
|
41
|
+
@property() time: string = '';
|
|
42
|
+
|
|
43
|
+
private getTime(time: string) {
|
|
44
|
+
const date = new Date(parseInt(time, 10) * 1000);
|
|
45
|
+
return date.toLocaleTimeString([], {hour: '2-digit', minute: '2-digit'});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
protected render() {
|
|
49
|
+
return html`
|
|
50
|
+
<div part="base" class="message">
|
|
51
|
+
<div part="avatar" class="message__avatar">
|
|
52
|
+
<zn-icon library="avatar" src="${this.sender}" size="36" round></zn-icon>
|
|
53
|
+
</div>
|
|
54
|
+
<div part="body" class="message__body">
|
|
55
|
+
<div part="header" class="message__header">
|
|
56
|
+
<span class="message__sender">${this.sender}</span>
|
|
57
|
+
${this.time ? html`<span class="message__time">${this.getTime(this.time)}</span>` : null}
|
|
58
|
+
<slot name="badge"></slot>
|
|
59
|
+
</div>
|
|
60
|
+
<div part="bubble" class="message__bubble">
|
|
61
|
+
<div part="content" class="message__content">
|
|
62
|
+
<slot></slot>
|
|
63
|
+
</div>
|
|
64
|
+
<div class="message__actions">
|
|
65
|
+
<slot name="edit-dialog-trigger"></slot>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
<slot name="edit-dialog"></slot>
|
|
71
|
+
`;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
@use "../../wc";
|
|
2
|
+
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.message {
|
|
8
|
+
display: flex;
|
|
9
|
+
gap: var(--zn-spacing-small);
|
|
10
|
+
|
|
11
|
+
&__avatar {
|
|
12
|
+
flex-shrink: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
&__body {
|
|
16
|
+
flex: 1 1 auto;
|
|
17
|
+
min-width: 0;
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
gap: var(--zn-spacing-x-small);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&__header {
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
gap: var(--zn-spacing-x-small);
|
|
27
|
+
min-height: 36px; // keeps the header centred against the avatar
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&__sender {
|
|
31
|
+
@include wc.text-style(h1);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&__time {
|
|
35
|
+
@include wc.text-style(subheading-small);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&__bubble {
|
|
39
|
+
display: flex;
|
|
40
|
+
align-items: flex-start;
|
|
41
|
+
gap: var(--zn-spacing-small);
|
|
42
|
+
padding: var(--zn-spacing-small);
|
|
43
|
+
border-radius: var(--zn-border-radius);
|
|
44
|
+
background: var(--message-background, hsl(48, 78%, 94%));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&__content {
|
|
48
|
+
@include wc.text-style(chat);
|
|
49
|
+
|
|
50
|
+
flex: 1 1 auto;
|
|
51
|
+
min-width: 0;
|
|
52
|
+
overflow-wrap: anywhere;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&__actions {
|
|
56
|
+
flex-shrink: 0;
|
|
57
|
+
display: flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import ZnChatMessage from './chat-message.component';
|
|
2
|
+
|
|
3
|
+
export * from './chat-message.component';
|
|
4
|
+
export default ZnChatMessage;
|
|
5
|
+
|
|
6
|
+
ZnChatMessage.define('zn-chat-message');
|
|
7
|
+
|
|
8
|
+
declare global {
|
|
9
|
+
interface HTMLElementTagNameMap {
|
|
10
|
+
'zn-chat-message': ZnChatMessage;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
box-shadow: var(--zn-shadow-x-small);
|
|
117
117
|
border: solid var(--zn-input-border-width) var(--checkbox-border-color);
|
|
118
118
|
background-color: var(--checkbox-bg-color);
|
|
119
|
-
border-radius:
|
|
119
|
+
border-radius: var(--zn-border-radius-small);
|
|
120
120
|
color: var(--checkbox-icon-color);
|
|
121
121
|
transition: var(--zn-transition-fast) border-color,
|
|
122
122
|
var(--zn-transition-fast) background-color,
|
|
@@ -260,7 +260,7 @@
|
|
|
260
260
|
.checkbox--contained {
|
|
261
261
|
padding: 1.375rem var(--zn-spacing-large) 1.375rem var(--zn-spacing-medium);
|
|
262
262
|
border: 1px solid var(--zn-color-gray-400);
|
|
263
|
-
border-radius: var(--zn-border-radius
|
|
263
|
+
border-radius: var(--zn-border-radius);
|
|
264
264
|
width: 100%;
|
|
265
265
|
height: 100%;
|
|
266
266
|
}
|
|
@@ -34,8 +34,6 @@ export default class ZnChip extends ZincElement {
|
|
|
34
34
|
@property() type: 'info' | 'success' | 'warning' | 'error' | 'primary' |
|
|
35
35
|
'transparent' | 'custom' | 'neutral' = 'neutral';
|
|
36
36
|
|
|
37
|
-
@property() size: 'small' | 'medium' | 'large'; // Defaults to base chip styling
|
|
38
|
-
|
|
39
37
|
@property({attribute: 'flush', type: Boolean, reflect: true}) flush: boolean = false;
|
|
40
38
|
@property({attribute: 'flush-x', type: Boolean, reflect: true}) flushX: boolean = false;
|
|
41
39
|
@property({attribute: 'flush-y', type: Boolean, reflect: true}) flushY: boolean = false;
|
|
@@ -61,9 +59,6 @@ export default class ZnChip extends ZincElement {
|
|
|
61
59
|
'chip--transparent': this.type === 'transparent',
|
|
62
60
|
'chip--custom': this.type === 'custom',
|
|
63
61
|
'chip--neutral': this.type === 'neutral',
|
|
64
|
-
'chip--small': this.size === 'small',
|
|
65
|
-
'chip--medium': this.size === 'medium',
|
|
66
|
-
'chip--large': this.size === 'large',
|
|
67
62
|
})}">
|
|
68
63
|
${this.icon ? html`
|
|
69
64
|
<zn-icon src="${this.icon}" size="${this.iconSize}"></zn-icon>` : ''}
|
|
@@ -7,22 +7,25 @@
|
|
|
7
7
|
|
|
8
8
|
.chip {
|
|
9
9
|
display: inline-flex;
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
font-size: var(--zn-text-chip-font-size);
|
|
11
|
+
font-family: var(--zn-font-family-sans);
|
|
12
|
+
font-weight: var(--zn-text-chip-font-weight);
|
|
13
|
+
border-radius: var(--zn-border-radius-small);
|
|
14
|
+
padding-inline: var(--zn-spacing-x-small);
|
|
15
|
+
padding-block: 0;
|
|
16
|
+
height: 24px;
|
|
12
17
|
text-align: center;
|
|
13
|
-
font-size: 12px;
|
|
14
18
|
gap: 4px;
|
|
15
19
|
width: fit-content;
|
|
16
|
-
margin: 1px;
|
|
17
20
|
justify-content: center;
|
|
18
21
|
align-items: center;
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
line-height: var(--zn-text-chip-line-height);
|
|
23
|
+
letter-spacing: var(--zn-letter-spacing-loose);
|
|
21
24
|
white-space: nowrap;
|
|
22
|
-
text-transform: uppercase;
|
|
23
25
|
|
|
24
26
|
&--flush {
|
|
25
27
|
padding: 0;
|
|
28
|
+
height: auto;
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
&--flush-x {
|
|
@@ -31,90 +34,66 @@
|
|
|
31
34
|
|
|
32
35
|
&--flush-y {
|
|
33
36
|
padding-block: 0;
|
|
37
|
+
height: auto;
|
|
34
38
|
}
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
.chip--primary {
|
|
38
42
|
color: rgba(var(--zn-primary), 0.9);
|
|
39
|
-
border-color: rgb(var(--zn-primary));
|
|
40
43
|
background: rgba(var(--zn-primary), .10);
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
.chip--error {
|
|
44
47
|
color: rgb(var(--zn-color-error));
|
|
45
|
-
border-color: rgb(var(--zn-color-error));
|
|
46
48
|
background: rgba(var(--zn-color-error), .10);
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
.chip--info {
|
|
50
52
|
color: rgb(var(--zn-color-info));
|
|
51
|
-
border-color: rgb(var(--zn-color-info));
|
|
52
53
|
background: rgba(var(--zn-color-info), .10);
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
.chip--warning {
|
|
56
57
|
color: rgb(var(--zn-color-warning));
|
|
57
|
-
border-color: rgb(var(--zn-color-warning));
|
|
58
58
|
background: rgba(var(--zn-color-warning), .10);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
.chip--success {
|
|
62
62
|
color: rgb(var(--zn-color-success));
|
|
63
|
-
border-color: rgb(var(--zn-color-success));
|
|
64
63
|
background: rgba(var(--zn-color-success), .10);
|
|
65
64
|
}
|
|
66
65
|
|
|
67
66
|
.chip--neutral {
|
|
68
67
|
color: rgb(var(--zn-text));
|
|
69
|
-
border-color: rgb(var(--zn-border-color));
|
|
70
68
|
background: rgba(var(--zn-border-color), .10);
|
|
71
69
|
}
|
|
72
70
|
|
|
73
71
|
.chip--transparent {
|
|
74
72
|
color: rgb(var(--zn-text));
|
|
75
|
-
border-color: transparent;
|
|
76
73
|
background: transparent;
|
|
77
74
|
}
|
|
78
75
|
|
|
79
76
|
.chip--custom {
|
|
80
77
|
color: rgb(var(--zn-text));
|
|
81
|
-
border-color: hsl(from var(--chip-color-override, inherit) h s l / 0.6);
|
|
82
78
|
background-color: hsl(from var(--chip-color-override, inherit) h s l / 0.1);
|
|
83
79
|
}
|
|
84
80
|
|
|
85
81
|
.chip__value {
|
|
86
82
|
overflow: hidden;
|
|
87
83
|
text-overflow: ellipsis;
|
|
84
|
+
text-transform: var(--zn-text-chip-transform);
|
|
88
85
|
}
|
|
89
86
|
|
|
90
87
|
.chip__caption {
|
|
91
88
|
opacity: 0.7;
|
|
92
|
-
font-weight:
|
|
89
|
+
font-weight: var(--zn-text-chip-font-weight);
|
|
90
|
+
text-transform: var(--zn-text-chip-transform);
|
|
93
91
|
|
|
94
92
|
&::after {
|
|
95
93
|
content: ":";
|
|
96
94
|
}
|
|
97
95
|
}
|
|
98
96
|
|
|
99
|
-
.chip__action {
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.chip--small {
|
|
103
|
-
font-size: var(--zn-font-size-small);
|
|
104
|
-
padding: var(--zn-spacing-2x-small) var(--zn-spacing-x-small);
|
|
105
|
-
line-height: var(--zn-line-height-dense);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.chip--medium {
|
|
109
|
-
font-size: var(--zn-font-size-medium);
|
|
110
|
-
padding: var(--zn-spacing-2x-small) var(--zn-spacing-small);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
.chip--large {
|
|
114
|
-
font-size: var(--zn-font-size-large);
|
|
115
|
-
padding: var(--zn-spacing-x-small) var(--zn-spacing-x-large);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
97
|
.chip--no-content {
|
|
119
98
|
padding: var(--zn-spacing-3x-small) var(--zn-spacing-2x-small);
|
|
120
99
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {classMap} from "lit/directives/class-map.js";
|
|
2
2
|
import {deepQuerySelectorAll} from "../../utilities/query";
|
|
3
3
|
import {HasSlotController} from "../../internal/slot";
|
|
4
|
-
import
|
|
5
|
-
import {html, nothing, unsafeCSS} from 'lit';
|
|
4
|
+
import {html, unsafeCSS} from 'lit';
|
|
6
5
|
import {MutationController} from '@lit-labs/observers/mutation-controller.js';
|
|
7
6
|
import {property, queryAssignedNodes, queryAsync} from 'lit/decorators.js';
|
|
8
7
|
import {unsafeHTML} from 'lit-html/directives/unsafe-html.js';
|
|
9
8
|
import ZincElement from "../../internal/zinc-element";
|
|
9
|
+
import type {PropertyValues} from 'lit';
|
|
10
10
|
import type ZnTile from "../tile";
|
|
11
11
|
|
|
12
12
|
import styles from './content-block.scss';
|
|
@@ -87,23 +87,24 @@ export default class ContentBlock extends ZincElement {
|
|
|
87
87
|
if (this.noCollapse) {
|
|
88
88
|
return;
|
|
89
89
|
}
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
this.short = !this.short;
|
|
96
|
-
this.requestUpdate();
|
|
97
|
-
this.updateComplete.then(() => {
|
|
98
|
-
if (!this.short) {
|
|
99
|
-
this.iframe.then((iframe) => {
|
|
100
|
-
if (iframe && !iframe.classList.contains('hidden')) {
|
|
101
|
-
this._resizeIframe(iframe);
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
});
|
|
90
|
+
|
|
91
|
+
const fromActions = e.composedPath().some((el) =>
|
|
92
|
+
el instanceof HTMLElement && el.classList.contains('content-block-header__actions'));
|
|
93
|
+
if (fromActions) {
|
|
94
|
+
return;
|
|
106
95
|
}
|
|
96
|
+
|
|
97
|
+
this.short = !this.short;
|
|
98
|
+
this.requestUpdate();
|
|
99
|
+
this.updateComplete.then(() => {
|
|
100
|
+
if (!this.short) {
|
|
101
|
+
this.iframe.then((iframe) => {
|
|
102
|
+
if (iframe && !iframe.classList.contains('hidden')) {
|
|
103
|
+
this._resizeIframe(iframe);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
});
|
|
107
108
|
}
|
|
108
109
|
|
|
109
110
|
private _toggleText() {
|
|
@@ -184,32 +185,33 @@ export default class ContentBlock extends ZincElement {
|
|
|
184
185
|
const initialShowHtml = hasHtmlSlot && (!hasTextSlot || this.defaultDisplay === 'html');
|
|
185
186
|
|
|
186
187
|
return html`
|
|
187
|
-
<
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
188
|
+
<div class="${classMap({
|
|
189
|
+
'content-block--outbound': this.outbound,
|
|
190
|
+
'content-block--short': this.short,
|
|
191
|
+
'content-block--collapsible': !this.noCollapse
|
|
192
|
+
})}">
|
|
193
|
+
|
|
194
|
+
<div class="content-block-header" @click="${this._collapseContent}">
|
|
195
|
+
<div class="content-block-header__icon">
|
|
196
|
+
<slot name="icon">
|
|
197
|
+
<zn-icon src="${this.avatar}"
|
|
198
|
+
library="avatar"
|
|
199
|
+
round></zn-icon>
|
|
200
|
+
</slot>
|
|
201
|
+
</div>
|
|
202
|
+
|
|
203
|
+
<div class="content-block-header__main">
|
|
204
|
+
<span class="content-block-header__caption">
|
|
205
|
+
<slot name="caption">${this.sender}</slot>
|
|
206
|
+
</span>
|
|
207
|
+
<span class="content-block-header__description">${this.truncateText()}</span>
|
|
208
|
+
</div>
|
|
209
|
+
|
|
210
|
+
<div class="content-block-header__actions">
|
|
209
211
|
<slot name="actions"><small>${this.time}</small></slot>
|
|
210
212
|
${showActions ? html`
|
|
211
213
|
<zn-dropdown>
|
|
212
|
-
<zn-button slot="trigger" icon="
|
|
214
|
+
<zn-button slot="trigger" icon="ellipsis@lu" icon-size="20" icon-button="small" plain></zn-button>
|
|
213
215
|
<zn-menu>
|
|
214
216
|
<zn-menu-item @click="${this._toggleHtml}">
|
|
215
217
|
Show HTML
|
|
@@ -221,10 +223,9 @@ export default class ContentBlock extends ZincElement {
|
|
|
221
223
|
</zn-dropdown>
|
|
222
224
|
` : ''}
|
|
223
225
|
</div>
|
|
226
|
+
</div>
|
|
224
227
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
<zn-sp no-gap>
|
|
228
|
+
<zn-sp no-gap flush-x>
|
|
228
229
|
<iframe class="${classMap({'hidden': !initialShowHtml})}" title="Content block HTML preview"></iframe>
|
|
229
230
|
<slot class="html-content" name="html" style="display: none;"></slot>
|
|
230
231
|
<slot name="text" style="display: none;"></slot>
|
|
@@ -246,7 +247,7 @@ export default class ContentBlock extends ZincElement {
|
|
|
246
247
|
|
|
247
248
|
${hasFooter ? html`
|
|
248
249
|
<slot slot="footer" name="footer" @slotchange="${this._handleSlotChange}"></slot>` : ''}
|
|
249
|
-
</
|
|
250
|
+
</div>
|
|
250
251
|
`;
|
|
251
252
|
}
|
|
252
253
|
|