@kubex/zinc 1.0.15 → 1.0.16
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 +110 -21
- package/dist/vscode.html-custom-data.json +9 -1
- package/dist/web-types.json +30 -9
- package/dist/zn.d.ts +99 -87
- package/dist/zn.min.css +1 -1
- package/dist/zn.min.js +177 -165
- package/docs/pages/components/collapsible.md +41 -1
- package/docs/pages/components/select.md +2 -2
- package/package.json +1 -1
- package/scss/shared/_button.scss +1 -1
- package/src/components/button/button.component.ts +2 -2
- package/src/components/button/button.scss +12 -13
- package/src/components/collapsible/collapsible.component.ts +53 -20
- package/src/components/collapsible/collapsible.scss +2 -0
- package/src/components/confirm/confirm.component.ts +28 -7
- package/src/components/data-table/data-table.component.ts +3 -2
- package/src/components/data-table/data-table.scss +1 -1
- package/src/components/dialog/dialog.component.ts +1 -3
- package/src/components/input/input.component.ts +1 -1
- package/src/components/option/option.component.ts +11 -10
- package/src/components/order-table/order-table.scss +4 -1
- package/src/components/select/select.component.ts +64 -52
- package/src/components/style/style.component.ts +7 -1
- package/src/components/textarea/textarea.component.ts +36 -1
- package/src/components/textarea/textarea.scss +2 -2
|
@@ -31,10 +31,50 @@ Used instead of directly setting the `expanded` attribute on the element.
|
|
|
31
31
|
</zn-collapsible>
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
+
### Checkbox stuff
|
|
35
|
+
|
|
36
|
+
```html:preview
|
|
37
|
+
|
|
38
|
+
<zn-collapsible caption="Collapsible with Checkbox">
|
|
39
|
+
<div class="flex-mid" slot="caption">
|
|
40
|
+
<div class="grow zn-pr">Billing</div>
|
|
41
|
+
<zn-toggle name="enabled"></zn-toggle>
|
|
42
|
+
</div>
|
|
43
|
+
<div class="permission" data-filter="Example Permission">
|
|
44
|
+
<div class="flex-row zn-pad">
|
|
45
|
+
<div class="flex-mid">
|
|
46
|
+
<div class="grow flex-col flex-jc">
|
|
47
|
+
<strong>Example Permission</strong>
|
|
48
|
+
<span>Example Permission Description</span>
|
|
49
|
+
</div>
|
|
50
|
+
<div class="flex-mid">
|
|
51
|
+
<zn-toggle class="permission-toggle" name="enabled" value="1" fallback="0" size="medium">
|
|
52
|
+
</zn-toggle>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
<div class="permission" data-filter="Example Permission">
|
|
58
|
+
<div class="flex-row zn-pad">
|
|
59
|
+
<div class="flex-mid">
|
|
60
|
+
<div class="grow flex-col flex-jc">
|
|
61
|
+
<strong>Example Permission 2</strong>
|
|
62
|
+
<span>Example Permission 2 Description</span>
|
|
63
|
+
</div>
|
|
64
|
+
<div class="flex-mid">
|
|
65
|
+
<zn-toggle name="enabled" size="medium"></zn-toggle>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
</zn-collapsible>
|
|
71
|
+
```
|
|
72
|
+
|
|
34
73
|
### Expanded Attribute
|
|
35
74
|
|
|
36
75
|
```html:preview
|
|
37
|
-
|
|
76
|
+
|
|
77
|
+
<zn-collapsible caption="Expanded Attribute"
|
|
38
78
|
description="Adding the expanded attribute will open the collapsible"
|
|
39
79
|
expanded>
|
|
40
80
|
<zn-button>Button</zn-button>
|
|
@@ -18,10 +18,10 @@ instead.
|
|
|
18
18
|
```html:preview
|
|
19
19
|
|
|
20
20
|
<form method="get" action="#">
|
|
21
|
-
<zn-select name="something" label="Select one option"
|
|
21
|
+
<zn-select name="something" label="Select one option">
|
|
22
22
|
<zn-option value="0">Option 0</zn-option>
|
|
23
23
|
<zn-option value="1">Option 1</zn-option>
|
|
24
|
-
<zn-option value="2">Option 2</zn-option>
|
|
24
|
+
<zn-option value="2" selected>Option 2</zn-option>
|
|
25
25
|
<zn-option value="3">Option 3</zn-option>
|
|
26
26
|
<zn-option value="4">Option 4</zn-option>
|
|
27
27
|
<zn-option value="5">Option 5</zn-option>
|
package/package.json
CHANGED
package/scss/shared/_button.scss
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {classMap} from 'lit/directives/class-map.js';
|
|
2
|
-
import {type CSSResultGroup, unsafeCSS} from 'lit';
|
|
2
|
+
import {type CSSResultGroup, nothing, unsafeCSS} from 'lit';
|
|
3
3
|
import {FormControlController, validValidityState} from "../../internal/form";
|
|
4
4
|
import {HasSlotController} from '../../internal/slot';
|
|
5
5
|
import {html, literal} from 'lit/static-html.js';
|
|
@@ -339,7 +339,6 @@ export default class ZnButton extends ZincElement implements ZincFormControl {
|
|
|
339
339
|
'button--text': (this.text && !this.outline),
|
|
340
340
|
'button--grow': this.grow,
|
|
341
341
|
'button--standard': !this.outline && !this.text,
|
|
342
|
-
'button--disabled': this.disabled,
|
|
343
342
|
'button--with-icon': this.icon,
|
|
344
343
|
'button--icon-left': this.iconPosition === 'left',
|
|
345
344
|
'button--icon-right': this.iconPosition === 'right',
|
|
@@ -356,6 +355,7 @@ export default class ZnButton extends ZincElement implements ZincFormControl {
|
|
|
356
355
|
rel="${ifDefined(isLink ? this.rel : undefined)}"
|
|
357
356
|
gaid="${ifDefined(this.gaid)}"
|
|
358
357
|
data-notification="${ifDefined(this.notification)}"
|
|
358
|
+
disabled=${this.disabled || nothing}
|
|
359
359
|
@click="${this.handleClick}">
|
|
360
360
|
${this.iconPosition === 'left' ? icon : ''}
|
|
361
361
|
<slot part="label"
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
|
|
22
22
|
border-width: 1px;
|
|
23
23
|
border-color: transparent;
|
|
24
|
-
height: 100%;
|
|
25
24
|
display: inline-flex;
|
|
26
25
|
position: relative;
|
|
27
26
|
|
|
@@ -93,7 +92,7 @@
|
|
|
93
92
|
outline-offset: 2px;
|
|
94
93
|
}
|
|
95
94
|
|
|
96
|
-
|
|
95
|
+
[disabled] {
|
|
97
96
|
cursor: not-allowed;
|
|
98
97
|
opacity: 0.5;
|
|
99
98
|
|
|
@@ -108,11 +107,11 @@
|
|
|
108
107
|
border-color: var(--zn-color-neutral-50);
|
|
109
108
|
color: rgb(var(--zn-primary));
|
|
110
109
|
|
|
111
|
-
&:hover:not(
|
|
110
|
+
&:hover:not([disabled]) {
|
|
112
111
|
background-color: var(--zn-color-neutral-100)
|
|
113
112
|
}
|
|
114
113
|
|
|
115
|
-
&:active:not(
|
|
114
|
+
&:active:not([disabled]) {
|
|
116
115
|
background-color: var(--zn-color-neutral-100)
|
|
117
116
|
}
|
|
118
117
|
}
|
|
@@ -122,11 +121,11 @@
|
|
|
122
121
|
border-color: rgb(var(--btn-color));
|
|
123
122
|
color: rgba(255, 255, 255, 0.9);
|
|
124
123
|
|
|
125
|
-
&:hover:not(
|
|
124
|
+
&:hover:not([disabled]) {
|
|
126
125
|
background-color: rgba(var(--btn-color), 0.8);
|
|
127
126
|
}
|
|
128
127
|
|
|
129
|
-
&:active:not(
|
|
128
|
+
&:active:not([disabled]) {
|
|
130
129
|
background-color: rgba(var(--btn-color));
|
|
131
130
|
}
|
|
132
131
|
}
|
|
@@ -137,7 +136,7 @@
|
|
|
137
136
|
border-color: rgb(var(--btn-color));
|
|
138
137
|
color: rgb(var(--btn-color));
|
|
139
138
|
|
|
140
|
-
&:hover:not(
|
|
139
|
+
&:hover:not([disabled]), &:active:not([disabled]) {
|
|
141
140
|
background-color: rgb(var(--btn-color));
|
|
142
141
|
color: white;
|
|
143
142
|
}
|
|
@@ -145,7 +144,7 @@
|
|
|
145
144
|
&.button--secondary {
|
|
146
145
|
border-color: #F3EFFF;
|
|
147
146
|
|
|
148
|
-
&:hover:not(
|
|
147
|
+
&:hover:not([disabled]), &:active:not([disabled]) {
|
|
149
148
|
background-color: rgb(221, 218, 236);
|
|
150
149
|
}
|
|
151
150
|
}
|
|
@@ -156,7 +155,7 @@
|
|
|
156
155
|
background: none;
|
|
157
156
|
color: rgb(var(--btn-color));
|
|
158
157
|
|
|
159
|
-
&:hover:not(
|
|
158
|
+
&:hover:not([disabled]), &:active:not([disabled]) {
|
|
160
159
|
background-color: rgba(var(--btn-color), 0.1);
|
|
161
160
|
}
|
|
162
161
|
|
|
@@ -275,11 +274,11 @@
|
|
|
275
274
|
border-color: transparent !important;
|
|
276
275
|
color: inherit;
|
|
277
276
|
|
|
278
|
-
&:hover:not(
|
|
277
|
+
&:hover:not([disabled]) {
|
|
279
278
|
background-color: rgba(var(--zn-primary), 0.1);
|
|
280
279
|
}
|
|
281
280
|
|
|
282
|
-
&:active:not(
|
|
281
|
+
&:active:not([disabled]) {
|
|
283
282
|
background-color: rgba(var(--zn-primary), 0.2);
|
|
284
283
|
}
|
|
285
284
|
}
|
|
@@ -291,7 +290,7 @@
|
|
|
291
290
|
color: white;
|
|
292
291
|
opacity: 1 !important;
|
|
293
292
|
|
|
294
|
-
&:hover {
|
|
293
|
+
&:hover:not([disabled]) {
|
|
295
294
|
background-color: rgb(var(--btn-color));
|
|
296
295
|
}
|
|
297
296
|
|
|
@@ -304,7 +303,7 @@
|
|
|
304
303
|
border-color: rgb(var(--btn-color));
|
|
305
304
|
color: rgb(var(--btn-color));
|
|
306
305
|
|
|
307
|
-
&:hover, &:active {
|
|
306
|
+
&:hover:not([disabled]), &:active:not([disabled]) {
|
|
308
307
|
background-color: rgba(var(--btn-color));
|
|
309
308
|
color: white;
|
|
310
309
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {classMap} from "lit/directives/class-map.js";
|
|
2
|
-
import {type CSSResultGroup, html, unsafeCSS} from 'lit';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
2
|
+
import { type CSSResultGroup, html, unsafeCSS } from 'lit';
|
|
3
|
+
import { HasSlotController } from "../../internal/slot";
|
|
4
|
+
import { property, state } from 'lit/decorators.js';
|
|
5
|
+
import { Store } from "../../internal/storage";
|
|
5
6
|
import ZincElement from '../../internal/zinc-element';
|
|
6
7
|
|
|
7
8
|
import styles from './collapsible.scss';
|
|
8
|
-
import {
|
|
9
|
+
import { ZnInputEvent } from "../../events/zn-input";
|
|
10
|
+
import ZnToggle from "../toggle";
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* @summary Toggles between showing and hiding content when clicked
|
|
@@ -21,28 +23,28 @@ import {HasSlotController} from "../../internal/slot";
|
|
|
21
23
|
export default class ZnCollapsible extends ZincElement {
|
|
22
24
|
static styles: CSSResultGroup = unsafeCSS(styles);
|
|
23
25
|
|
|
24
|
-
@property({reflect: true}) caption = '';
|
|
26
|
+
@property({ reflect: true }) caption = '';
|
|
25
27
|
|
|
26
|
-
@property({reflect: true}) description
|
|
28
|
+
@property({ reflect: true }) description: string;
|
|
27
29
|
|
|
28
|
-
@property({reflect: true}) label = '';
|
|
30
|
+
@property({ reflect: true }) label = '';
|
|
29
31
|
|
|
30
|
-
@property({type: Boolean, attribute: 'show-number', reflect: true}) showNumber: boolean = false;
|
|
32
|
+
@property({ type: Boolean, attribute: 'show-number', reflect: true }) showNumber: boolean = false;
|
|
31
33
|
|
|
32
34
|
// what element name to count
|
|
33
|
-
@property({type: String, attribute: 'count-element'}) countElement: string = '*';
|
|
35
|
+
@property({ type: String, attribute: 'count-element' }) countElement: string = '*';
|
|
34
36
|
|
|
35
|
-
@property({type: Boolean, reflect: true}) expanded: boolean = false;
|
|
37
|
+
@property({ type: Boolean, reflect: true }) expanded: boolean = false;
|
|
36
38
|
|
|
37
|
-
@property({attribute: 'default'}) defaultState: 'open' | 'closed';
|
|
39
|
+
@property({ attribute: 'default' }) defaultState: 'open' | 'closed';
|
|
38
40
|
|
|
39
|
-
@property({attribute: 'local-storage', type: Boolean, reflect: true}) localStorage: boolean;
|
|
41
|
+
@property({ attribute: 'local-storage', type: Boolean, reflect: true }) localStorage: boolean;
|
|
40
42
|
|
|
41
|
-
@property({attribute: 'store-key', reflect: true}) storeKey: string = "";
|
|
43
|
+
@property({ attribute: 'store-key', reflect: true }) storeKey: string = "";
|
|
42
44
|
|
|
43
|
-
@property({attribute: 'store-ttl', type: Number, reflect: true}) storeTtl = 0;
|
|
45
|
+
@property({ attribute: 'store-ttl', type: Number, reflect: true }) storeTtl = 0;
|
|
44
46
|
|
|
45
|
-
@property({attribute: 'flush', type: Boolean, reflect: true}) flush: boolean = false;
|
|
47
|
+
@property({ attribute: 'flush', type: Boolean, reflect: true }) flush: boolean = false;
|
|
46
48
|
|
|
47
49
|
@state() numberOfItems: number = 0;
|
|
48
50
|
|
|
@@ -52,7 +54,9 @@ export default class ZnCollapsible extends ZincElement {
|
|
|
52
54
|
|
|
53
55
|
private observer: MutationObserver;
|
|
54
56
|
|
|
55
|
-
|
|
57
|
+
private showArrow: boolean = true;
|
|
58
|
+
|
|
59
|
+
async connectedCallback() {
|
|
56
60
|
super.connectedCallback();
|
|
57
61
|
this._store = new Store(this.localStorage ? window.localStorage : window.sessionStorage, "zncla:", this.storeTtl);
|
|
58
62
|
this.expanded = this.defaultState === 'open';
|
|
@@ -70,7 +74,28 @@ export default class ZnCollapsible extends ZincElement {
|
|
|
70
74
|
this.observer = new MutationObserver(() => {
|
|
71
75
|
this.recalculateNumberOfItems();
|
|
72
76
|
});
|
|
73
|
-
this.observer.observe(slot, {childList: true, subtree: true});
|
|
77
|
+
this.observer.observe(slot, { childList: true, subtree: true });
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
await this.updateComplete;
|
|
81
|
+
|
|
82
|
+
const captionSlot = this.hasSlotController.getSlot('caption') as HTMLDivElement;
|
|
83
|
+
if (captionSlot) {
|
|
84
|
+
const toggles = captionSlot.querySelectorAll('zn-toggle');
|
|
85
|
+
// remove the drop arrow
|
|
86
|
+
this.showArrow = false;
|
|
87
|
+
toggles.forEach(toggle => {
|
|
88
|
+
toggle.removeEventListener('zn-input', this.handleCaptionToggle);
|
|
89
|
+
toggle.addEventListener('zn-input', this.handleCaptionToggle);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// this is for handling global toggles
|
|
95
|
+
public handleCaptionToggle = (e: ZnInputEvent) => {
|
|
96
|
+
const toggle = e.target as ZnToggle;
|
|
97
|
+
if (toggle) {
|
|
98
|
+
this.expanded = toggle.checked;
|
|
74
99
|
}
|
|
75
100
|
}
|
|
76
101
|
|
|
@@ -82,6 +107,11 @@ export default class ZnCollapsible extends ZincElement {
|
|
|
82
107
|
}
|
|
83
108
|
|
|
84
109
|
handleCollapse = (e: MouseEvent) => {
|
|
110
|
+
const target = e.target as HTMLElement;
|
|
111
|
+
if (target.tagName.toLowerCase() === 'input' && (target as HTMLInputElement).type === 'checkbox') {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
|
|
85
115
|
if (this.expanded) {
|
|
86
116
|
this.expanded = false;
|
|
87
117
|
e.stopPropagation();
|
|
@@ -112,13 +142,16 @@ export default class ZnCollapsible extends ZincElement {
|
|
|
112
142
|
<p class="caption">
|
|
113
143
|
<slot name="caption">${this.caption}</slot>
|
|
114
144
|
</p>
|
|
115
|
-
<p class="description"
|
|
145
|
+
<p class="description">
|
|
146
|
+
<slot name="description">${this.description}</slot>
|
|
147
|
+
</p>
|
|
116
148
|
</div>
|
|
117
149
|
<div class="header__right">
|
|
118
150
|
<slot name="label"><p class="label">${this.label}</p></slot>
|
|
119
151
|
${this.showNumber && !this.expanded ? html`
|
|
120
152
|
<zn-chip size="small" type="primary">${this.numberOfItems}</zn-chip>` : ''}
|
|
121
|
-
|
|
153
|
+
${this.showArrow ? html`
|
|
154
|
+
<zn-icon library="material-outlined" src="expand_more" class="expand"></zn-icon>` : ''}
|
|
122
155
|
</div>
|
|
123
156
|
</slot>
|
|
124
157
|
<div class="${classMap({
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {classMap} from "lit/directives/class-map.js";
|
|
2
|
-
import {type CSSResultGroup, html, type PropertyValues, unsafeCSS} from 'lit';
|
|
2
|
+
import {type CSSResultGroup, html, nothing, type PropertyValues, unsafeCSS} from 'lit';
|
|
3
3
|
import {deepQuerySelectorAll} from "../../utilities/query";
|
|
4
4
|
import {HasSlotController} from "../../internal/slot";
|
|
5
5
|
import {ifDefined} from "lit/directives/if-defined.js";
|
|
6
|
-
import {property, query} from 'lit/decorators.js';
|
|
6
|
+
import {property, query, state} from 'lit/decorators.js';
|
|
7
7
|
import ZincElement from "../../internal/zinc-element";
|
|
8
8
|
import ZnDialog from "../dialog";
|
|
9
9
|
|
|
@@ -61,6 +61,11 @@ export default class ZnConfirm extends ZincElement {
|
|
|
61
61
|
|
|
62
62
|
@property({type: Boolean, attribute: 'hide-icon'}) hideIcon: boolean = false;
|
|
63
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Show a loading state when the dialog is submitted.
|
|
66
|
+
*/
|
|
67
|
+
@property({type: Boolean, attribute: 'show-loading'}) showLoading: boolean = false;
|
|
68
|
+
|
|
64
69
|
/**
|
|
65
70
|
* The dialog's trigger element. This is used to open the dialog when clicked. If you do not provide a trigger, you
|
|
66
71
|
* will need to manually open the dialog using the `show()` method.
|
|
@@ -75,6 +80,9 @@ export default class ZnConfirm extends ZincElement {
|
|
|
75
80
|
|
|
76
81
|
@query('zn-dialog') dialog: ZnDialog;
|
|
77
82
|
|
|
83
|
+
/** Internal loading state used when showLoading is enabled */
|
|
84
|
+
@state() private loading: boolean = false;
|
|
85
|
+
|
|
78
86
|
protected firstUpdated(_changedProperties: PropertyValues) {
|
|
79
87
|
super.firstUpdated(_changedProperties);
|
|
80
88
|
if (this.open) {
|
|
@@ -108,10 +116,12 @@ export default class ZnConfirm extends ZincElement {
|
|
|
108
116
|
show = (event: Event | undefined = undefined) => {
|
|
109
117
|
const trigger = event?.target as HTMLButtonElement
|
|
110
118
|
if (trigger?.disabled) return;
|
|
119
|
+
this.loading = false;
|
|
111
120
|
this.dialog.show();
|
|
112
121
|
}
|
|
113
122
|
|
|
114
123
|
hide() {
|
|
124
|
+
this.loading = false;
|
|
115
125
|
this.dialog.hide();
|
|
116
126
|
}
|
|
117
127
|
|
|
@@ -143,12 +153,18 @@ export default class ZnConfirm extends ZincElement {
|
|
|
143
153
|
: ''}
|
|
144
154
|
|
|
145
155
|
<div class="confirm-dialog__content">
|
|
146
|
-
${this.
|
|
147
|
-
|
|
156
|
+
${!this.loading ? html`
|
|
157
|
+
${this.content ? html`${this.content}` : ''}
|
|
158
|
+
<slot></slot>` : html`
|
|
159
|
+
Loading...`}
|
|
148
160
|
</div>
|
|
149
161
|
|
|
150
|
-
<zn-button outline color="${this.type}" slot="footer" dialog-closer
|
|
151
|
-
|
|
162
|
+
<zn-button outline color="${this.type}" slot="footer" dialog-closer disabled=${this.loading || nothing}>
|
|
163
|
+
${this.cancelText}
|
|
164
|
+
</zn-button>
|
|
165
|
+
<zn-button color="${this.type}" slot="footer" @click="${this.submitDialog}" disabled=${this.loading || nothing}>
|
|
166
|
+
${this.confirmText}
|
|
167
|
+
</zn-button>
|
|
152
168
|
|
|
153
169
|
<slot name="footer-text" slot="footer-text">${this.footerText}</slot>
|
|
154
170
|
</zn-dialog>`;
|
|
@@ -174,7 +190,12 @@ export default class ZnConfirm extends ZincElement {
|
|
|
174
190
|
detail: {element: form}
|
|
175
191
|
}))
|
|
176
192
|
form.requestSubmit();
|
|
177
|
-
this.
|
|
193
|
+
if (!this.showLoading) {
|
|
194
|
+
this.hide();
|
|
195
|
+
} else {
|
|
196
|
+
this.loading = true;
|
|
197
|
+
this.dialog.closer.disabled = true;
|
|
198
|
+
}
|
|
178
199
|
}
|
|
179
200
|
}
|
|
180
201
|
}
|
|
@@ -1253,8 +1253,9 @@ export default class ZnDataTable extends ZincElement {
|
|
|
1253
1253
|
type="${ifDefined(action.confirmType)}"
|
|
1254
1254
|
caption="${action.confirmTitle}"
|
|
1255
1255
|
content="${action.confirmContent}"
|
|
1256
|
-
action="${action.uri}"
|
|
1257
|
-
|
|
1256
|
+
action="${action.uri}"
|
|
1257
|
+
show-loading></zn-confirm>
|
|
1258
|
+
<zn-menu-item id="${triggerId}" confirm>
|
|
1258
1259
|
${(action.icon) ? html`
|
|
1259
1260
|
<zn-icon src="${action.icon}" size="20" slot="prefix"></zn-icon>` : html``}
|
|
1260
1261
|
${action.text}
|
|
@@ -57,9 +57,7 @@ export default class ZnDialog extends ZincElement {
|
|
|
57
57
|
private closeWatcher: CloseWatcher | null;
|
|
58
58
|
|
|
59
59
|
@query('.dialog') dialog: HTMLDialogElement;
|
|
60
|
-
@query('.
|
|
61
|
-
@query('.dialog__overlay') overlay: HTMLElement;
|
|
62
|
-
|
|
60
|
+
@query('.dialog__close') closer: HTMLButtonElement;
|
|
63
61
|
|
|
64
62
|
/** The dialog's theme variant. */
|
|
65
63
|
@property({reflect: true}) variant: 'default' | 'warning' | 'announcement' = 'default';
|
|
@@ -268,7 +268,7 @@ export default class ZnInput extends ZincElement implements ZincFormControl {
|
|
|
268
268
|
}
|
|
269
269
|
|
|
270
270
|
private handleChange() {
|
|
271
|
-
if (this.type === 'currency') {
|
|
271
|
+
if (this.type === 'currency' && this.input.value) {
|
|
272
272
|
this.value = parseFloat(this.input.value as string).toFixed(2)
|
|
273
273
|
} else {
|
|
274
274
|
this.value = this.input.value;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {classMap} from "lit/directives/class-map.js";
|
|
2
|
-
import {type CSSResultGroup, html, unsafeCSS} from 'lit';
|
|
3
|
-
import {LocalizeController} from "../../utilities/localize";
|
|
4
|
-
import {property, query, state} from 'lit/decorators.js';
|
|
5
|
-
import {watch} from '../../internal/watch';
|
|
1
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
2
|
+
import { type CSSResultGroup, html, unsafeCSS } from 'lit';
|
|
3
|
+
import { LocalizeController } from "../../utilities/localize";
|
|
4
|
+
import { property, query, state } from 'lit/decorators.js';
|
|
5
|
+
import { watch } from '../../internal/watch';
|
|
6
6
|
import ZincElement from '../../internal/zinc-element';
|
|
7
7
|
import ZnIcon from "../icon";
|
|
8
8
|
|
|
@@ -28,7 +28,7 @@ import styles from './option.scss';
|
|
|
28
28
|
*/
|
|
29
29
|
export default class ZnOption extends ZincElement {
|
|
30
30
|
static styles: CSSResultGroup = unsafeCSS(styles);
|
|
31
|
-
static dependencies = {'zn-icon': ZnIcon};
|
|
31
|
+
static dependencies = { 'zn-icon': ZnIcon };
|
|
32
32
|
|
|
33
33
|
private cachedTextLabel: string;
|
|
34
34
|
// @ts-expect-error - Controller is currently unused
|
|
@@ -39,7 +39,6 @@ export default class ZnOption extends ZincElement {
|
|
|
39
39
|
@query('.option__label') defaultSlot: HTMLSlotElement;
|
|
40
40
|
|
|
41
41
|
@state() current = false; // the user has keyed into the option, but hasn't selected it yet (shows a highlight)
|
|
42
|
-
@state() selected = false; // the option is selected and has aria-selected="true"
|
|
43
42
|
@state() hasHover = false; // we need this because Safari doesn't honor :hover styles while dragging
|
|
44
43
|
|
|
45
44
|
/**
|
|
@@ -47,10 +46,12 @@ export default class ZnOption extends ZincElement {
|
|
|
47
46
|
* from other options in the same group. Values may not contain spaces, as spaces are used as delimiters when listing
|
|
48
47
|
* multiple values.
|
|
49
48
|
*/
|
|
50
|
-
@property({reflect: true}) value = '';
|
|
49
|
+
@property({ reflect: true }) value = '';
|
|
51
50
|
|
|
52
51
|
/** Draws the option in a disabled state, preventing selection. */
|
|
53
|
-
@property({type: Boolean, reflect: true}) disabled = false;
|
|
52
|
+
@property({ type: Boolean, reflect: true }) disabled = false;
|
|
53
|
+
|
|
54
|
+
@property({ type: Boolean, reflect: true }) selected = false;
|
|
54
55
|
|
|
55
56
|
connectedCallback() {
|
|
56
57
|
super.connectedCallback();
|
|
@@ -70,7 +71,7 @@ export default class ZnOption extends ZincElement {
|
|
|
70
71
|
// When the label changes, emit a slotchange event so parent controls see it
|
|
71
72
|
if (textLabel !== this.cachedTextLabel) {
|
|
72
73
|
this.cachedTextLabel = textLabel;
|
|
73
|
-
this.emit('slotchange', {bubbles: true, composed: false, cancelable: false});
|
|
74
|
+
this.emit('slotchange', { bubbles: true, composed: false, cancelable: false });
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
77
|
|
|
@@ -68,7 +68,6 @@
|
|
|
68
68
|
|
|
69
69
|
.row {
|
|
70
70
|
background-color: rgba(var(--zn-panel-highlight), var(--zn-panel-highlight-opacity, 1));
|
|
71
|
-
margin-top: 20px;
|
|
72
71
|
}
|
|
73
72
|
|
|
74
73
|
.header-item {
|
|
@@ -101,6 +100,10 @@
|
|
|
101
100
|
@include wc.container-query(md) {
|
|
102
101
|
border-bottom: none;
|
|
103
102
|
}
|
|
103
|
+
|
|
104
|
+
&:first-of-type {
|
|
105
|
+
margin-top: 0;
|
|
106
|
+
}
|
|
104
107
|
}
|
|
105
108
|
|
|
106
109
|
.sub {
|