@kubex/zinc 1.0.11 → 1.0.13
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 +343 -1
- package/dist/vscode.html-custom-data.json +33 -3
- package/dist/web-types.json +90 -3
- package/dist/zn.d.ts +127 -16
- package/dist/zn.min.css +1 -1
- package/dist/zn.min.js +541 -518
- package/docs/pages/components/data-select.md +1 -1
- package/docs/pages/components/filter-container.md +72 -0
- package/docs/pages/components/filter-wrapper.md +2 -2
- package/docs/pages/components/hover-container.md +20 -0
- package/docs/pages/components/reveal.md +24 -0
- package/docs/pages/components/select.md +39 -1
- package/docs/pages/components/toggle.md +6 -3
- package/package.json +1 -1
- package/scss/_root.scss +4 -4
- package/src/components/button/button.component.ts +11 -5
- package/src/components/data-select/data-select.component.ts +5 -2
- package/src/components/dropdown/dropdown.component.ts +3 -0
- package/src/components/filter-container/filter-container.component.ts +112 -0
- package/src/components/filter-container/filter-container.scss +5 -0
- package/src/components/filter-container/filter-container.test.ts +10 -0
- package/src/components/filter-container/index.ts +12 -0
- package/src/components/form-group/form-group.component.ts +26 -25
- package/src/components/form-group/form-group.scss +1 -0
- package/src/components/header/header.scss +7 -0
- package/src/components/navbar/navbar.scss +4 -0
- package/src/components/note/note.component.ts +1 -0
- package/src/components/option/option.component.ts +3 -3
- package/src/components/option/option.scss +5 -9
- package/src/components/popup/popup.component.ts +8 -1
- package/src/components/progress-bar/progress-bar.component.ts +1 -1
- package/src/components/progress-tile/progress-tile.component.ts +2 -2
- package/src/components/reveal/index.ts +12 -0
- package/src/components/reveal/reveal.component.ts +92 -0
- package/src/components/reveal/reveal.scss +18 -0
- package/src/components/reveal/reveal.test.ts +10 -0
- package/src/components/select/select.component.ts +76 -11
- package/src/components/sp/sp.component.ts +2 -0
- package/src/components/split-pane/split-pane.component.ts +2 -1
- package/src/components/toggle/toggle.component.ts +33 -23
- package/src/components/tooltip/tooltip.component.ts +10 -5
- package/src/internal/form.ts +5 -0
- package/src/utilities/top-layer-manager.ts +32 -0
- package/src/wc.scss +9 -5
- package/src/zinc.ts +3 -1
|
@@ -8,7 +8,7 @@ layout: component
|
|
|
8
8
|
```html:preview
|
|
9
9
|
|
|
10
10
|
<div class="form-spacing">
|
|
11
|
-
<zn-data-select label="Country" provider="country" name="country"></zn-data-select>
|
|
11
|
+
<zn-data-select label="Country" provider="country" name="country" multiple></zn-data-select>
|
|
12
12
|
<zn-data-select label="Currency" provider="currency" name="currency"></zn-data-select>
|
|
13
13
|
<zn-data-select label="Color" provider="color" name="color"></zn-data-select>
|
|
14
14
|
</div>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
meta:
|
|
3
|
+
title: Filter Container
|
|
4
|
+
description:
|
|
5
|
+
layout: component
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
```html:preview
|
|
9
|
+
|
|
10
|
+
<zn-filter-container>
|
|
11
|
+
<zn-sp flush>
|
|
12
|
+
<zn-panel caption="Section One">
|
|
13
|
+
<div style="display: flex; flex-direction: column;">
|
|
14
|
+
<div data-filter="John Doe"
|
|
15
|
+
style="padding: 10px 0; display: flex; flex-direction: column; border-bottom: 1px solid grey;">
|
|
16
|
+
<strong>John Doe</strong>
|
|
17
|
+
<span>john.doe@zinc.style</span>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<div data-filter="Gary Smith"
|
|
21
|
+
style="padding: 10px 0; display: flex; flex-direction: column; border-bottom: 1px solid grey;">
|
|
22
|
+
<strong>Gary Smith</strong>
|
|
23
|
+
<span>gary.smith@zinc.style</span>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<div data-filter="Lisa Wong"
|
|
27
|
+
style="padding: 10px 0; display: flex; flex-direction: column; border-bottom: 1px solid grey;">
|
|
28
|
+
<strong>Lisa Wong</strong>
|
|
29
|
+
<span>lisa.wong@zinc.style</span>
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
<div data-filter="Emma Johnson"
|
|
33
|
+
style="padding: 10px 0; display: flex; flex-direction: column; border-bottom: 1px solid grey;">
|
|
34
|
+
<strong>Emma Johnson</strong>
|
|
35
|
+
<span>emma.johnson@zinc.style</span>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
</zn-panel>
|
|
40
|
+
|
|
41
|
+
<zn-panel caption="Section Two">
|
|
42
|
+
<div style="display: flex; flex-direction: column;">
|
|
43
|
+
<div data-filter="Michael Brown"
|
|
44
|
+
style="padding: 10px 0; display: flex; flex-direction: column; border-bottom: 1px solid grey;">
|
|
45
|
+
<strong>Michael Brown</strong>
|
|
46
|
+
<span>michael.brown@zinc.style</span>
|
|
47
|
+
</div>
|
|
48
|
+
<div data-filter="Sophia Davis"
|
|
49
|
+
style="padding: 10px 0; display: flex; flex-direction: column; border-bottom: 1px solid grey;">
|
|
50
|
+
<strong>Sophia Davis</strong>
|
|
51
|
+
<span>sophia.davis@zinc.style</span>
|
|
52
|
+
</div>
|
|
53
|
+
<div data-filter="Lisa Wong"
|
|
54
|
+
style="padding: 10px 0; display: flex; flex-direction: column; border-bottom: 1px solid grey;">
|
|
55
|
+
<strong>Lisa Wong</strong>
|
|
56
|
+
<span>lisa.wong@zinc.style</span>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</zn-panel>
|
|
60
|
+
</zn-sp>
|
|
61
|
+
</zn-filter-container>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Examples
|
|
65
|
+
|
|
66
|
+
### First Example
|
|
67
|
+
|
|
68
|
+
TODO
|
|
69
|
+
|
|
70
|
+
### Second Example
|
|
71
|
+
|
|
72
|
+
TODO
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
meta:
|
|
3
|
+
title: Reveal
|
|
4
|
+
description:
|
|
5
|
+
layout: component
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
```html:preview
|
|
9
|
+
|
|
10
|
+
<zn-reveal duration="3000"
|
|
11
|
+
initial="******@hotmail.com"
|
|
12
|
+
revealed="john.doe@hotmail.com">
|
|
13
|
+
</zn-reveal>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Examples
|
|
17
|
+
|
|
18
|
+
### First Example
|
|
19
|
+
|
|
20
|
+
TODO
|
|
21
|
+
|
|
22
|
+
### Second Example
|
|
23
|
+
|
|
24
|
+
TODO
|
|
@@ -39,6 +39,44 @@ This component works with standard `<form>` elements. Please refer to the sectio
|
|
|
39
39
|
on [form controls](/getting-started/form-controls) to learn more about form submission and client-side validation.
|
|
40
40
|
:::
|
|
41
41
|
|
|
42
|
+
### Distinct Selects
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
```html:preview
|
|
46
|
+
|
|
47
|
+
<div class="form-spacing">
|
|
48
|
+
<zn-select provider="country" multiple name="country-one" id="country-one" distinct="country-two">
|
|
49
|
+
<zn-option value="0">Option 0</zn-option>
|
|
50
|
+
<zn-option value="1">Option 1</zn-option>
|
|
51
|
+
<zn-option value="2">Option 2</zn-option>
|
|
52
|
+
</zn-select>
|
|
53
|
+
<zn-select provider="country" multiple name="country-two" id="country-two" distinct="country-one">
|
|
54
|
+
<zn-option value="0">Option 0</zn-option>
|
|
55
|
+
<zn-option value="1">Option 1</zn-option>
|
|
56
|
+
<zn-option value="2">Option 2</zn-option>
|
|
57
|
+
</zn-select>
|
|
58
|
+
</div>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Conditional Selects
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
```html:preview
|
|
65
|
+
|
|
66
|
+
<div class="form-spacing">
|
|
67
|
+
<zn-select provider="conditional" multiple name="conditional-one" id="conditional-one" conditional="conditional-two">
|
|
68
|
+
<zn-option value="0">Option 0</zn-option>
|
|
69
|
+
<zn-option value="1">Option 1</zn-option>
|
|
70
|
+
<zn-option value="2">Option 2</zn-option>
|
|
71
|
+
</zn-select>
|
|
72
|
+
<zn-select provider="conditional" multiple name="conditional-two" id="conditional-two" conditional="conditional-one">
|
|
73
|
+
<zn-option value="0">Option 0</zn-option>
|
|
74
|
+
<zn-option value="1">Option 1</zn-option>
|
|
75
|
+
<zn-option value="2">Option 2</zn-option>
|
|
76
|
+
</zn-select>
|
|
77
|
+
</div>
|
|
78
|
+
```
|
|
79
|
+
|
|
42
80
|
### Help Text
|
|
43
81
|
|
|
44
82
|
Add descriptive help text to a select with the `help-text` attribute. For help texts that contain HTML, use the
|
|
@@ -124,7 +162,7 @@ the most common for selects), include an empty option that people can select to
|
|
|
124
162
|
:::
|
|
125
163
|
|
|
126
164
|
```html:preview
|
|
127
|
-
<zn-select label="Clearable multi-choice select" clearable multiple
|
|
165
|
+
<zn-select label="Clearable multi-choice select" clearable multiple help-text="For multi-choice selects only, display an icon button to let people clear their selections">
|
|
128
166
|
<zn-option value="option-1">Option 1</zn-option>
|
|
129
167
|
<zn-option value="option-2">Option 2</zn-option>
|
|
130
168
|
<zn-option value="option-3">Option 3</zn-option>
|
|
@@ -6,14 +6,17 @@ layout: component
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
```html:preview
|
|
9
|
-
<zn-toggle
|
|
9
|
+
<zn-toggle></zn-toggle>
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
## Examples
|
|
13
13
|
|
|
14
|
-
###
|
|
14
|
+
### With Tooltip
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
```html:preview
|
|
17
|
+
|
|
18
|
+
<zn-toggle on-text="Available" off-text="Unavailable" label="Status"></zn-toggle>
|
|
19
|
+
```
|
|
17
20
|
|
|
18
21
|
### Second Example
|
|
19
22
|
|
package/package.json
CHANGED
package/scss/_root.scss
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
:root {
|
|
7
7
|
// Brand Colors
|
|
8
8
|
--zn-red: 237, 84, 109;
|
|
9
|
-
--zn-blue: 100,
|
|
10
|
-
--zn-green:
|
|
9
|
+
--zn-blue: 100, 117, 242;
|
|
10
|
+
--zn-green: 43, 192, 145;
|
|
11
11
|
--zn-orange: 255, 136, 0;
|
|
12
12
|
--zn-yellow: 255, 193, 7;
|
|
13
13
|
--zn-indigo: 63, 81, 181;
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
--zn-accent: 71, 214, 214;
|
|
19
19
|
|
|
20
20
|
// Theme Colors
|
|
21
|
-
--zn-color-info: 100,
|
|
21
|
+
--zn-color-info: 100, 117, 242;
|
|
22
22
|
--zn-color-warning: 255, 136, 0;
|
|
23
23
|
--zn-color-error: 237, 84, 109;
|
|
24
|
-
--zn-color-success:
|
|
24
|
+
--zn-color-success: 43, 192, 145;
|
|
25
25
|
--zn-color-disabled: 181, 181, 181;
|
|
26
26
|
|
|
27
27
|
// Common Sizes
|
|
@@ -5,6 +5,7 @@ import {HasSlotController} from '../../internal/slot';
|
|
|
5
5
|
import {html, literal} from 'lit/static-html.js';
|
|
6
6
|
import {ifDefined} from 'lit/directives/if-defined.js';
|
|
7
7
|
import {property, query, queryAll} from 'lit/decorators.js';
|
|
8
|
+
import {watch} from '../../internal/watch';
|
|
8
9
|
import ZincElement from '../../internal/zinc-element';
|
|
9
10
|
import ZnDropdown from "../dropdown";
|
|
10
11
|
import ZnIcon from "../icon";
|
|
@@ -137,13 +138,18 @@ export default class ZnButton extends ZincElement implements ZincFormControl {
|
|
|
137
138
|
this.teardownAutoClick();
|
|
138
139
|
}
|
|
139
140
|
|
|
141
|
+
@watch('autoClick')
|
|
142
|
+
async handleAutoClickChange(_old: boolean, value: boolean) {
|
|
143
|
+
if (value) {
|
|
144
|
+
await this.updateComplete;
|
|
145
|
+
this.setupAutoClick();
|
|
146
|
+
} else {
|
|
147
|
+
this.teardownAutoClick();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
140
151
|
protected updated(changedProps: Map<string, any>) {
|
|
141
152
|
super.updated(changedProps);
|
|
142
|
-
if (changedProps.has('autoClick')) {
|
|
143
|
-
if (this.autoClick) {
|
|
144
|
-
this.setupAutoClick();
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
153
|
if (this.button) {
|
|
148
154
|
const oldOverlay = this.button.querySelector('.button--loading-fill');
|
|
149
155
|
if (oldOverlay) {
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
emptyDataProvider,
|
|
8
8
|
type LocalDataProvider,
|
|
9
9
|
} from "./providers/provider";
|
|
10
|
-
import {type CSSResultGroup, html, nothing,
|
|
10
|
+
import {type CSSResultGroup, html, nothing, type PropertyValues, unsafeCSS} from 'lit';
|
|
11
11
|
import {FormControlController} from "../../internal/form";
|
|
12
12
|
import {property, query} from 'lit/decorators.js';
|
|
13
13
|
import {watch} from "../../internal/watch";
|
|
14
|
-
import type {ZincFormControl} from '../../internal/zinc-element';
|
|
15
14
|
import ZincElement from '../../internal/zinc-element';
|
|
15
|
+
import type {ZincFormControl} from '../../internal/zinc-element';
|
|
16
16
|
import type ZnSelect from "../select";
|
|
17
17
|
|
|
18
18
|
import styles from './data-select.scss';
|
|
@@ -93,6 +93,8 @@ export default class ZnDataSelect extends ZincElement implements ZincFormControl
|
|
|
93
93
|
|
|
94
94
|
@property({attribute: "icon-only", type: Boolean, reflect: true}) iconOnly = false;
|
|
95
95
|
|
|
96
|
+
@property({type: Boolean}) multiple = false;
|
|
97
|
+
|
|
96
98
|
protected readonly formControlController = new FormControlController(this);
|
|
97
99
|
|
|
98
100
|
get validationMessage() {
|
|
@@ -215,6 +217,7 @@ export default class ZnDataSelect extends ZincElement implements ZincFormControl
|
|
|
215
217
|
@zn-clear="${this.handleClear}"
|
|
216
218
|
@blur=${this.blur}
|
|
217
219
|
value="${this.value}"
|
|
220
|
+
?multiple=${this.multiple}
|
|
218
221
|
placeholder="${this.getPlaceholder(localProvider)}"
|
|
219
222
|
exportparts="combobox,expand-icon,form-control-help-text,form-control-input,display-input">
|
|
220
223
|
${(this.iconPosition !== 'none' || this.iconOnly) ? html`
|
|
@@ -6,6 +6,7 @@ import {property, query} from 'lit/decorators.js';
|
|
|
6
6
|
import {unsafeHTML} from 'lit/directives/unsafe-html.js';
|
|
7
7
|
import {waitForEvent} from "../../internal/event";
|
|
8
8
|
import {watch} from '../../internal/watch';
|
|
9
|
+
import topLayerManager from '../../utilities/top-layer-manager';
|
|
9
10
|
import ZincElement from '../../internal/zinc-element';
|
|
10
11
|
import type {ZnSelectEvent} from "../../events/zn-select";
|
|
11
12
|
import type ZnButton from "../button";
|
|
@@ -324,6 +325,7 @@ export default class ZnDropdown extends ZincElement {
|
|
|
324
325
|
|
|
325
326
|
if (this.open) {
|
|
326
327
|
this.emit('zn-show');
|
|
328
|
+
topLayerManager.registerDropdown(this);
|
|
327
329
|
this.addOpenListeners();
|
|
328
330
|
this.panel.hidden = false;
|
|
329
331
|
this.popup.active = true;
|
|
@@ -331,6 +333,7 @@ export default class ZnDropdown extends ZincElement {
|
|
|
331
333
|
this.emit('zn-after-show');
|
|
332
334
|
} else {
|
|
333
335
|
this.emit('zn-hide');
|
|
336
|
+
topLayerManager.unregisterDropdown(this);
|
|
334
337
|
this.removeOpenListeners();
|
|
335
338
|
this.panel.blur();
|
|
336
339
|
this.panel.hidden = true;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import {property} from 'lit/decorators.js';
|
|
2
|
+
import {type CSSResultGroup, html, unsafeCSS} from 'lit';
|
|
3
|
+
import ZincElement from '../../internal/zinc-element';
|
|
4
|
+
|
|
5
|
+
import styles from './filter-container.scss';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @summary Short summary of the component's intended use.
|
|
9
|
+
* @documentation https://zinc.style/components/filter-container
|
|
10
|
+
* @status experimental
|
|
11
|
+
* @since 1.0
|
|
12
|
+
*
|
|
13
|
+
* @dependency zn-example
|
|
14
|
+
*
|
|
15
|
+
* @event zn-event-name - Emitted as an example.
|
|
16
|
+
*
|
|
17
|
+
* @slot - The default slot.
|
|
18
|
+
* @slot example - An example slot.
|
|
19
|
+
*
|
|
20
|
+
* @csspart base - The component's base wrapper.
|
|
21
|
+
*
|
|
22
|
+
* @cssproperty --example - An example CSS custom property.
|
|
23
|
+
*/
|
|
24
|
+
export default class ZnFilterContainer extends ZincElement {
|
|
25
|
+
static styles: CSSResultGroup = unsafeCSS(styles);
|
|
26
|
+
|
|
27
|
+
@property() attr = 'filter';
|
|
28
|
+
|
|
29
|
+
public handleSearchChange(event: Event) {
|
|
30
|
+
// get all element that have data-'this.attr' attribute
|
|
31
|
+
const filterableElements = this.querySelectorAll(`[data-${this.attr}]`);
|
|
32
|
+
const input = event.target as HTMLInputElement;
|
|
33
|
+
const searchTerm = input.value.toLowerCase();
|
|
34
|
+
|
|
35
|
+
filterableElements.forEach((el) => {
|
|
36
|
+
const filterValue = el.getAttribute(`data-${this.attr}`)?.toLowerCase() || '';
|
|
37
|
+
if (filterValue.includes(searchTerm)) {
|
|
38
|
+
(el as HTMLElement).style.display = '';
|
|
39
|
+
} else {
|
|
40
|
+
(el as HTMLElement).style.display = 'none';
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const panel = el.closest('zn-panel');
|
|
44
|
+
if (panel) {
|
|
45
|
+
const panelItems = panel.querySelectorAll(`[data-${this.attr}]`);
|
|
46
|
+
let anyVisible = false;
|
|
47
|
+
panelItems.forEach((item) => {
|
|
48
|
+
if ((item as HTMLElement).style.display !== 'none') {
|
|
49
|
+
anyVisible = true;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
});
|
|
53
|
+
if (anyVisible) {
|
|
54
|
+
(panel as HTMLElement).style.display = '';
|
|
55
|
+
} else {
|
|
56
|
+
(panel as HTMLElement).style.display = 'none';
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const accordionItem = el.closest('zn-accordion');
|
|
61
|
+
if (accordionItem) {
|
|
62
|
+
const itemElements = accordionItem.querySelectorAll(`[data-${this.attr}]`);
|
|
63
|
+
let anyVisible = false;
|
|
64
|
+
itemElements.forEach((item) => {
|
|
65
|
+
if ((item as HTMLElement).style.display !== 'none') {
|
|
66
|
+
anyVisible = true;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
if (anyVisible) {
|
|
71
|
+
(accordionItem as HTMLElement).style.display = '';
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
if (searchTerm === '') {
|
|
77
|
+
filterableElements.forEach((el) => {
|
|
78
|
+
(el as HTMLElement).style.display = '';
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// if nothing is visible, show a "no results found" message
|
|
83
|
+
const anyVisibleElements = Array.from(filterableElements).some((el) => {
|
|
84
|
+
return (el as HTMLElement).style.display !== 'none';
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
let noResultsMessage = this.querySelector('.no-results-message') as HTMLElement;
|
|
88
|
+
if (!anyVisibleElements) {
|
|
89
|
+
if (!noResultsMessage) {
|
|
90
|
+
noResultsMessage = document.createElement('div');
|
|
91
|
+
noResultsMessage.className = 'no-results-message';
|
|
92
|
+
noResultsMessage.textContent = 'No results found';
|
|
93
|
+
this.appendChild(noResultsMessage);
|
|
94
|
+
}
|
|
95
|
+
noResultsMessage.style.display = '';
|
|
96
|
+
} else {
|
|
97
|
+
if (noResultsMessage) {
|
|
98
|
+
noResultsMessage.style.display = 'none';
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
render() {
|
|
105
|
+
return html`
|
|
106
|
+
<zn-input placeholder="Filter" clearable type="search" @zn-input=${this.handleSearchChange}
|
|
107
|
+
style="margin-bottom: var(--zn-spacing-small)">
|
|
108
|
+
<zn-icon src="search" slot="prefix"></zn-icon>
|
|
109
|
+
</zn-input>
|
|
110
|
+
<slot></slot> `;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import '../../../dist/zn.min.js';
|
|
2
|
+
import { expect, fixture, html } from '@open-wc/testing';
|
|
3
|
+
|
|
4
|
+
describe('<zn-filter-container>', () => {
|
|
5
|
+
it('should render a component', async () => {
|
|
6
|
+
const el = await fixture(html` <zn-filter-container></zn-filter-container> `);
|
|
7
|
+
|
|
8
|
+
expect(el).to.exist;
|
|
9
|
+
});
|
|
10
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import ZnFilterContainer from './filter-container.component';
|
|
2
|
+
|
|
3
|
+
export * from './filter-container.component';
|
|
4
|
+
export default ZnFilterContainer;
|
|
5
|
+
|
|
6
|
+
ZnFilterContainer.define('zn-filter-container');
|
|
7
|
+
|
|
8
|
+
declare global {
|
|
9
|
+
interface HTMLElementTagNameMap {
|
|
10
|
+
'zn-filter-container': ZnFilterContainer;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -57,32 +57,33 @@ export default class ZnFormGroup extends ZincElement {
|
|
|
57
57
|
aria-describedby="help-text">
|
|
58
58
|
|
|
59
59
|
<zn-cols layout="1,2" mc="2" part="form-control-container" class="form-control__container">
|
|
60
|
-
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
<
|
|
71
|
-
<slot
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
60
|
+
${hasLabel ? html`
|
|
61
|
+
<div>
|
|
62
|
+
<label
|
|
63
|
+
part="form-control-label"
|
|
64
|
+
id="label"
|
|
65
|
+
class="form-control__label"
|
|
66
|
+
aria-hidden=${hasLabel ? 'false' : 'true'}>
|
|
67
|
+
<slot name="label">${this.label}</slot>
|
|
68
|
+
${hasLabelTooltip
|
|
69
|
+
? html`
|
|
70
|
+
<zn-tooltip class="form-control--label-tooltip">
|
|
71
|
+
<div slot="content">
|
|
72
|
+
<slot name="label-tooltip">${this.labelTooltip}</slot>
|
|
73
|
+
</div>
|
|
74
|
+
<zn-icon src="info"></zn-icon>
|
|
75
|
+
</zn-tooltip>`
|
|
76
|
+
: ''}
|
|
77
|
+
</label>
|
|
77
78
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
79
|
+
${hasHelpText ? html`
|
|
80
|
+
<div
|
|
81
|
+
part="form-control-help-text"
|
|
82
|
+
id="help-text"
|
|
83
|
+
class="form-control__help-text">
|
|
84
|
+
<slot name="help-text">${this.helpText}</slot>
|
|
85
|
+
</div>` : html``}
|
|
86
|
+
</div>` : html``}
|
|
86
87
|
|
|
87
88
|
<div part="form-control-input" class="form-control-input">
|
|
88
89
|
<slot></slot>
|
|
@@ -140,15 +140,15 @@ export default class ZnOption extends ZincElement {
|
|
|
140
140
|
})}
|
|
141
141
|
@mouseenter=${this.handleMouseEnter}
|
|
142
142
|
@mouseleave=${this.handleMouseLeave}>
|
|
143
|
+
<slot part="prefix" name="prefix" class="option__prefix"></slot>
|
|
144
|
+
<slot part="label" class="option__label" @slotchange=${this.handleDefaultSlotChange}></slot>
|
|
145
|
+
<slot part="suffix" name="suffix" class="option__suffix"></slot>
|
|
143
146
|
<zn-icon
|
|
144
147
|
part="checked-option-icon"
|
|
145
148
|
class="option__check"
|
|
146
149
|
src="check_small"
|
|
147
150
|
aria-hidden="true"
|
|
148
151
|
></zn-icon>
|
|
149
|
-
<slot part="prefix" name="prefix" class="option__prefix"></slot>
|
|
150
|
-
<slot part="label" class="option__label" @slotchange=${this.handleDefaultSlotChange}></slot>
|
|
151
|
-
<slot part="suffix" name="suffix" class="option__suffix"></slot>
|
|
152
152
|
</div>
|
|
153
153
|
`;
|
|
154
154
|
}
|
|
@@ -20,19 +20,11 @@
|
|
|
20
20
|
line-height: var(--zn-line-height-normal);
|
|
21
21
|
letter-spacing: var(--zn-letter-spacing-normal);
|
|
22
22
|
color: var(--zn-input-color);
|
|
23
|
-
padding: var(--zn-spacing-x-small) var(--zn-spacing-
|
|
23
|
+
padding: var(--zn-spacing-x-small) var(--zn-spacing-small);
|
|
24
24
|
transition: var(--zn-transition-fast) fill;
|
|
25
25
|
cursor: pointer;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
.option--singular:not(.option--selected) {
|
|
29
|
-
padding: var(--zn-spacing-x-small) var(--zn-spacing-2x-large) var(--zn-spacing-x-small) var(--zn-spacing-large);
|
|
30
|
-
|
|
31
|
-
zn-icon {
|
|
32
|
-
display: none;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
28
|
|
|
37
29
|
.option--hover:not(.option--current):not(.option--disabled) {
|
|
38
30
|
background-color: var(--zn-color-primary-100);
|
|
@@ -73,6 +65,10 @@
|
|
|
73
65
|
visibility: visible;
|
|
74
66
|
}
|
|
75
67
|
|
|
68
|
+
.option--selected {
|
|
69
|
+
background-color: var(--zn-color-primary-200);
|
|
70
|
+
}
|
|
71
|
+
|
|
76
72
|
.option__prefix,
|
|
77
73
|
.option__suffix {
|
|
78
74
|
flex: 0 0 auto;
|
|
@@ -251,7 +251,14 @@ export default class ZnPopup extends ZincElement {
|
|
|
251
251
|
}
|
|
252
252
|
|
|
253
253
|
// If the anchor is valid, start it up
|
|
254
|
-
if (this.anchorEl && this.active) {
|
|
254
|
+
if (this.anchorEl && !this.active && this.anchorEl instanceof Element) {
|
|
255
|
+
this.anchorEl.removeEventListener('mouseover', this.handleAnchorHover);
|
|
256
|
+
this.anchorEl.addEventListener('mouseover', this.handleAnchorHover);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
public handleAnchorHover = () => {
|
|
261
|
+
if (!this.active) {
|
|
255
262
|
this.start();
|
|
256
263
|
}
|
|
257
264
|
}
|