q2-tecton-elements 1.28.3 → 1.29.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/cjs/click-elsewhere_2.cjs.entry.js +4 -3
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/q2-action-sheet.cjs.entry.js +10 -5
- package/dist/cjs/q2-badge.cjs.entry.js +43 -0
- package/dist/cjs/q2-btn_2.cjs.entry.js +1 -1
- package/dist/cjs/q2-checkbox.cjs.entry.js +16 -7
- package/dist/cjs/q2-data-table.cjs.entry.js +287 -0
- package/dist/cjs/{q2-badge_2.cjs.entry.js → q2-input.cjs.entry.js} +1 -38
- package/dist/cjs/q2-tecton-elements.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/q2-action-sheet/index.js +26 -4
- package/dist/collection/components/q2-action-sheet/styles.css +2 -2
- package/dist/collection/components/q2-btn/styles.css +4 -0
- package/dist/collection/components/q2-checkbox/index.js +15 -6
- package/dist/collection/components/q2-checkbox/styles.css +4 -0
- package/dist/collection/components/q2-data-table/index.js +539 -0
- package/dist/collection/components/q2-data-table/styles.css +192 -0
- package/dist/collection/components/q2-input/styles.css +1 -1
- package/dist/collection/components/q2-popover/index.js +4 -3
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/index10.js +72 -55
- package/dist/components/index11.js +56 -44
- package/dist/components/index12.js +42 -42
- package/dist/components/index13.js +40 -538
- package/dist/components/index14.js +518 -136
- package/dist/components/index15.js +174 -574
- package/dist/components/index16.js +589 -0
- package/dist/components/index3.js +1 -1
- package/dist/components/index5.js +3 -3
- package/dist/components/index6.js +93 -94
- package/dist/components/index7.js +112 -2927
- package/dist/components/index8.js +2919 -3347
- package/dist/components/index9.js +3343 -56
- package/dist/components/q2-action-sheet.js +18 -12
- package/dist/components/q2-calendar.js +6 -6
- package/dist/components/q2-card.js +2 -2
- package/dist/components/q2-carousel-pane.js +1 -1
- package/dist/components/q2-carousel.js +3 -3
- package/dist/components/q2-chart-area.js +1 -1
- package/dist/components/q2-chart-bar.js +1 -1
- package/dist/components/q2-chart-donut.js +2 -2
- package/dist/components/q2-checkbox-group.js +2 -2
- package/dist/components/q2-checkbox.js +1 -133
- package/dist/components/q2-data-table.d.ts +11 -0
- package/dist/components/q2-data-table.js +349 -0
- package/dist/components/q2-dropdown-item.js +1 -1
- package/dist/components/q2-dropdown.js +5 -5
- package/dist/components/q2-editable-field.js +4 -4
- package/dist/components/q2-icon.js +1 -1
- package/dist/components/q2-input.js +1 -1
- package/dist/components/q2-loading.js +1 -1
- package/dist/components/q2-loc.js +1 -1
- package/dist/components/q2-message.js +1 -1
- package/dist/components/q2-month-picker.js +3 -3
- package/dist/components/q2-optgroup.js +1 -1
- package/dist/components/q2-option-list.js +1 -1
- package/dist/components/q2-option.js +1 -1
- package/dist/components/q2-pagination.js +4 -4
- package/dist/components/q2-pill.js +4 -4
- package/dist/components/q2-popover.js +1 -1
- package/dist/components/q2-radio-group.js +2 -2
- package/dist/components/q2-radio.js +1 -1
- package/dist/components/q2-section.js +3 -3
- package/dist/components/q2-select.js +6 -6
- package/dist/components/q2-stepper-pane.js +1 -1
- package/dist/components/q2-stepper-vertical.js +2 -2
- package/dist/components/q2-stepper.js +3 -3
- package/dist/components/q2-tab-container.js +3 -3
- package/dist/components/q2-tag.js +4 -4
- package/dist/components/q2-textarea.js +2 -2
- package/dist/components/q2-tooltip.js +1 -1
- package/dist/docs.json +280 -3
- package/dist/esm/click-elsewhere_2.entry.js +4 -3
- package/dist/esm/loader.js +1 -1
- package/dist/esm/q2-action-sheet.entry.js +10 -5
- package/dist/esm/q2-badge.entry.js +39 -0
- package/dist/esm/q2-btn_2.entry.js +1 -1
- package/dist/esm/q2-checkbox.entry.js +16 -7
- package/dist/esm/q2-data-table.entry.js +283 -0
- package/dist/esm/{q2-badge_2.entry.js → q2-input.entry.js} +3 -39
- package/dist/esm/q2-tecton-elements.js +1 -1
- package/dist/q2-tecton-elements/p-00b2c345.entry.js +1 -0
- package/dist/q2-tecton-elements/p-0112df78.entry.js +1 -0
- package/dist/q2-tecton-elements/p-08286237.entry.js +1 -0
- package/dist/q2-tecton-elements/p-42d03011.entry.js +1 -0
- package/dist/q2-tecton-elements/p-47aefcc2.entry.js +1 -0
- package/dist/q2-tecton-elements/p-9a327827.entry.js +1 -0
- package/dist/q2-tecton-elements/p-c9abc814.entry.js +1 -0
- package/dist/q2-tecton-elements/q2-tecton-elements.esm.js +1 -1
- package/dist/types/components/q2-action-sheet/index.d.ts +1 -0
- package/dist/types/components/q2-checkbox/index.d.ts +4 -0
- package/dist/types/components/q2-data-table/index.d.ts +94 -0
- package/dist/types/components.d.ts +47 -0
- package/package.json +3 -3
- package/dist/q2-tecton-elements/p-0b7003c4.entry.js +0 -1
- package/dist/q2-tecton-elements/p-1b9e07b4.entry.js +0 -1
- package/dist/q2-tecton-elements/p-3bf06809.entry.js +0 -1
- package/dist/q2-tecton-elements/p-92e746c8.entry.js +0 -1
- package/dist/q2-tecton-elements/p-d6824ce5.entry.js +0 -1
- /package/dist/types/workspace/workspace/{tecton-production_release_1.28.x → Tecton_tecton-production_master}/packages/q2-tecton-elements/.stencil/test/helpers.d.ts +0 -0
|
@@ -1,139 +1,138 @@
|
|
|
1
|
-
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
|
-
import { h as handleAriaLabel, l as loc } from './
|
|
3
|
-
import { d as defineCustomElement$
|
|
4
|
-
import { d as defineCustomElement$2 } from './index7.js';
|
|
5
|
-
import { d as defineCustomElement$1 } from './index9.js';
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
+
import { d as createGuid, h as handleAriaLabel, o as overrideFocus, a as isEventFromElement, l as loc } from './index16.js';
|
|
3
|
+
import { d as defineCustomElement$1 } from './index8.js';
|
|
6
4
|
|
|
7
|
-
const stylesCss = "*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-double-focus-ring, 0 0 0 2px #ffffff, 0 0 0 4px #33b4ff #06C)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size:inherit;font-stretch:inherit}:host(.sr),:host(.sr) button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sr,.sr button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none}:host([hidden]){display:none}.invisible{visibility:hidden}.
|
|
5
|
+
const stylesCss = "*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-double-focus-ring, 0 0 0 2px #ffffff, 0 0 0 4px #33b4ff #06C)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size:inherit;font-stretch:inherit}:host(.sr),:host(.sr) button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sr,.sr button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none}:host([hidden]){display:none}.invisible{visibility:hidden}:host{display:block;position:relative;padding:var(--tct-checkbox-vertical-padding, var(--t-checkbox-vertical-padding, var(--tct-scale-2, var(--app-scale-2x, 10px)))) 0}.container{--comp-checkbox-size:var(--tct-checkbox-size, var(--t-checkbox-size, 20px));--comp-checkbox-default-column-gap:var(--app-scale-2x, 10px);--comp-checkbox-default-row-gap:0;--comp-checkbox-default-gap:var(--comp-checkbox-default-row-gap) var(--comp-checkbox-default-column-gap);--comp-checkbox-tween:var(--tct-tween-1, var(--app-tween-1, 0.2s ease));--comp-checkbox-toggle-width:var(--tct-checkbox-toggle-width, var(--t-checkbox-toggle-width, 46px));--comp-checkbox-gap:var(--tct-checkbox-gap, var(--t-checkbox-gap, var(--comp-checkbox-default-gap)));--comp-checkbox-outer-stroke-color:var(--tct-checkbox-outer-stroke-color, var(--t-checkbox-outer-stroke-color, var(--t-a11y-gray-color-AA, #949494)));--comp-checkbox-outer-fill-color:var(--tct-checkbox-outer-fill-color, var(--t-checkbox-outer-fill-color, var(--tct-white, var(--app-white, #ffffff))));--comp-checkbox-checked-color:var(--tct-checkbox-check-stroke-color, var(--t-checkbox-check-stroke-color, var(--t-checkbox-fill, var(--t-a11y-active-gray-color-AA, #404040))));--comp-control-width:var(--comp-checkbox-size);display:grid;grid-template-areas:\"svg label\" \"svg description\";align-items:center;gap:var(--comp-checkbox-gap);grid-template-columns:var(--comp-control-width) calc(100% - var(--comp-control-width) - var(--comp-checkbox-default-column-gap))}:host([type=favorite]) .container{--comp-checkbox-favorite-stroke-color:var(--tct-checkbox-favorite-stroke-color, var(--t-checkbox-favorite-stroke-color, var(--t-a11y-gray-color-AA, #949494)));--comp-checkbox-favorite-fill-color:var(--tct-checkbox-favorite-fill-color, var(--t-checkbox-favorite-fill-color, #db7d24))}:host([hide-label]:not([hide-label=false])) .container{grid-template-areas:\"svg\";grid-template-columns:var(--comp-control-width)}:host([type=toggle]) .container{--comp-control-width:var(--comp-checkbox-toggle-width)}:host([alignment=right]) .container,:host([type=toggle]:not([alignment])) .container{grid-template-areas:\"label svg\" \"description svg\";grid-template-columns:calc(100% - var(--comp-control-width) - var(--comp-checkbox-default-column-gap)) var(--comp-control-width)}.label-control{align-items:center;display:flex}.label-text{grid-area:label}:host([description]) .label-text{font-weight:var(--tct-checkbox-label-font-weight, var(--t-checkbox-label-font-weight, 600))}:host([checked]) .label-text{font-weight:var(--tct-checkbox-checked-label-font-weight, var(--t-checkbox-checked-label-font-weight, 600))}.description-text{grid-area:description;font-weight:var(--tct-checkbox-description-font-weight, var(--t-checkbox-description-font-weight, 400))}label{color:var(--tct-checkbox-label-color);cursor:pointer}:host([disabled]:not([disabled=false])),:host([group-disabled]){opacity:var(--tct-checkbox-disabled-opacity, var(--t-checkbox-disabled-opacity, var(--tct-disabled-opacity, var(--app-disabled-opacity, 0.4))))}:host([disabled]:not([disabled=false])) label,:host([group-disabled]) label{cursor:not-allowed}.checkbox-icon{--t-icon-stroke-primary:var(--comp-checkbox-outer-stroke-color);width:var(--comp-checkbox-size);height:var(--comp-checkbox-size);border-radius:var(--tct-checkbox-outer-border-radius, var(--t-checkbox-outer-border-radius, var(--tct-border-radius-1, var(--app-border-radius-1, 3px))));stroke:var(--comp-checkbox-outer-stroke-color);color:var(--comp-checkbox-outer-stroke-color);stroke-width:var(--tct-checkbox-outer-stroke-width, var(--t-checkbox-outer-stroke-width, 2));fill:var(--comp-checkbox-outer-fill-color);flex-shrink:0}:host([checked]) .checkbox-icon{fill:var(--tct-checkbox-checked-outer-fill-color, var(--t-checkbox-checked-outer-fill-color, var(--comp-checkbox-outer-fill-color)));stroke:var(--tct-checkbox-checked-outer-stroke-color, var(--t-checkbox-checked-outer-stroke-color, var(--comp-checkbox-outer-stroke-color)))}:host(:focus-within) .checkbox-icon{box-shadow:var(--const-double-focus-ring), var(--tct-global-focus, 0 0 0 2px #33b4ff);stroke:var(--tct-checkbox-focused-outer-stroke-color, var(--t-checkbox-focused-outer-stroke-color, var(--comp-checkbox-checked-color)))}:host([type=favorite]) .checkbox-icon{--tct-icon-stroke-width:var(--tct-checkbox-favorite-stroke-width, var(--t-checkbox-favorite-stroke-width, 1));--tct-icon-stroke-primary:var(--comp-checkbox-favorite-stroke-color);transition:fill var(--comp-checkbox-tween), color var(--comp-checkbox-tween), stroke var(--comp-checkbox-tween)}:host([type=favorite]:focus-within) .checkbox-icon,:host([type=favorite]:hover) .checkbox-icon{--tct-icon-stroke-primary:var(--comp-checkbox-favorite-fill-color);--tct-icon-stroke-width:var(--tct-checkbox-favorite-hover-stroke-width, var(--t-checkbox-favorite-hover-stroke-width, 2))}:host([checked][type=favorite]) .checkbox-icon{--tct-icon-stroke-primary:var(--comp-checkbox-favorite-fill-color);fill:var(--comp-checkbox-favorite-fill-color);transition:fill var(--comp-checkbox-tween), color var(--comp-checkbox-tween), stroke var(--comp-checkbox-tween)}:host([checked][type=favorite]:focus-within) .checkbox-icon,:host([checked][type=favorite]:hover) .checkbox-icon{--tct-icon-stroke-primary:var(--comp-checkbox-favorite-stroke-color);--tct-icon-fill-primary:var(--comp-checkbox-favorite-fill-color);--tct-icon-stroke-width:var(--tct-checkbox-favorite-hover-stroke-width, var(--t-checkbox-favorite-hover-stroke-width, 2))}.checkbox-fill{stroke:var(--comp-checkbox-checked-color)}.checked-fill{stroke-width:var(--tct-checkbox-check-stroke-width, var(--t-checkbox-check-stroke-width, 2.5));stroke-linecap:round;stroke-linejoin:round}:host([type=toggle]) .checked-fill{stroke:var(--tct-checkbox-toggle-icon-stroke, var(--t-checkbox-toggle-icon-stroke, var(--tct-white, var(--app-white, #ffffff))));transition:opacity var(--comp-checkbox-tween)}:host([type=toggle][checked]) .checked-fill{stroke:var(--tct-checkbox-toggle-checked-icon-stroke, var(--t-checkbox-toggle-checked-icon-stroke, var(--t-checkbox-text, var(--tct-white, var(--app-white, #ffffff)))))}.indeterminate-fill{stroke-width:var(--tct-checkbox-indeterminate-stroke-width, var(--t-checkbox-indeterminate-stroke-width, 3.5))}.toggle-svg{height:30px;width:var(--comp-checkbox-toggle-width);position:relative;text-align:initial}.toggle-track,.toggle-indicator{position:absolute;top:50%;transform:translateY(-50%)}.toggle-track{fill:var(--tct-checkbox-toggle-track-color, var(--t-checkbox-toggle-track-color, var(--tct-gray-11, var(--t-gray-11, var(--tct-gray-l1, var(--app-gray-l1, #cccccc))))));height:14px;width:46px}:host([checked]) .toggle-track{fill:var(--tct-checkbox-toggle-checked-color, var(--t-checkbox-toggle-checked-color, var(--comp-checkbox-checked-color)));opacity:0.5}.toggle-indicator{transition:left var(--comp-checkbox-tween);height:30px;width:30px;left:0;border-radius:50%}:host([checked]) .toggle-indicator{left:21px}.toggle-circle{fill:var(--tct-checkbox-toggle-circle-color, var(--t-checkbox-toggle-circle-color, var(--t-a11y-gray-color-AA, #949494)))}:host([checked]) .toggle-circle{fill:var(--tct-checkbox-toggle-checked-color, var(--t-checkbox-toggle-checked-color, var(--comp-checkbox-checked-color)))}:host(:focus-within) .toggle-circle{stroke:var(--tct-checkbox-toggle-checked-color, var(--t-checkbox-toggle-checked-color, var(--comp-checkbox-checked-color)));stroke-width:10px;stroke-opacity:0.5}:host(:not([checked]):focus-within) .toggle-circle{stroke:var(--tct-checkbox-toggle-circle-color, var(--t-checkbox-toggle-circle-color, var(--t-a11y-gray-color-AA, #949494)))}:host([checked]) .off,:host(:not([checked])) .on{opacity:0}";
|
|
8
6
|
|
|
9
|
-
const
|
|
7
|
+
const Q2Checkbox = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
10
8
|
constructor() {
|
|
11
9
|
super();
|
|
12
10
|
this.__registerHost();
|
|
13
11
|
this.__attachShadow();
|
|
14
|
-
this.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
type: 'select',
|
|
19
|
-
value: this.value || '',
|
|
20
|
-
},
|
|
21
|
-
bubbles: true,
|
|
22
|
-
}));
|
|
23
|
-
};
|
|
24
|
-
this.onItemKeydown = (event) => {
|
|
25
|
-
if (['ArrowRight', 'Right'].includes(event.key)) {
|
|
26
|
-
this.focusRemoveBtn();
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
this.onItemFocus = (event) => {
|
|
30
|
-
event.stopPropagation();
|
|
31
|
-
};
|
|
32
|
-
this.onRemoveBtnClick = (event) => {
|
|
33
|
-
event.stopImmediatePropagation();
|
|
34
|
-
this.hostElement.dispatchEvent(new CustomEvent('click', {
|
|
35
|
-
detail: {
|
|
36
|
-
type: 'remove',
|
|
37
|
-
value: this.value || '',
|
|
38
|
-
},
|
|
39
|
-
bubbles: true,
|
|
40
|
-
}));
|
|
41
|
-
};
|
|
42
|
-
this.onRemoveBtnKeydown = (event) => {
|
|
43
|
-
if (['ArrowLeft', 'Left'].includes(event.key)) {
|
|
44
|
-
this.focusItem();
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
this.onRemoveBtnFocus = (event) => {
|
|
12
|
+
this.change = createEvent(this, "change", 7);
|
|
13
|
+
this._id = `checkbox-${createGuid()}`;
|
|
14
|
+
///// Actions ////////
|
|
15
|
+
this.onInputClick = (event) => {
|
|
48
16
|
event.stopPropagation();
|
|
17
|
+
event.preventDefault();
|
|
18
|
+
const isNotInteractive = this.disabled || this.readonly;
|
|
19
|
+
if (isNotInteractive)
|
|
20
|
+
return;
|
|
21
|
+
if (!(event.target instanceof HTMLInputElement))
|
|
22
|
+
return;
|
|
23
|
+
const { value, checked } = event.target;
|
|
24
|
+
this.change.emit({
|
|
25
|
+
value,
|
|
26
|
+
checked,
|
|
27
|
+
});
|
|
28
|
+
this.inputElement.focus();
|
|
49
29
|
};
|
|
50
|
-
this.
|
|
51
|
-
this.
|
|
52
|
-
this.separator = undefined;
|
|
30
|
+
this.checked = false;
|
|
31
|
+
this.type = undefined;
|
|
53
32
|
this.label = undefined;
|
|
33
|
+
this.hideLabel = undefined;
|
|
34
|
+
this.indeterminate = undefined;
|
|
35
|
+
this.disabled = undefined;
|
|
36
|
+
this.readonly = undefined;
|
|
54
37
|
this.value = undefined;
|
|
38
|
+
this.name = undefined;
|
|
39
|
+
this.groupDisabled = undefined;
|
|
40
|
+
this.alignment = undefined;
|
|
41
|
+
this.description = undefined;
|
|
42
|
+
this.hasError = undefined;
|
|
55
43
|
this.ariaLabel = undefined;
|
|
56
44
|
}
|
|
57
|
-
|
|
45
|
+
////////// LIFECYCLE HOOKS ////////
|
|
58
46
|
componentWillLoad() {
|
|
59
47
|
handleAriaLabel(this);
|
|
60
48
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
get removeLabel() {
|
|
66
|
-
return loc('tecton.element.dropdownItem.remove', [this.label || '']);
|
|
49
|
+
componentDidLoad() {
|
|
50
|
+
overrideFocus(this.hostElement);
|
|
51
|
+
this.hostElement.click = () => this.inputElement.click();
|
|
67
52
|
}
|
|
68
|
-
|
|
69
|
-
|
|
53
|
+
//////// Host Element Events ////////
|
|
54
|
+
defaultChangeHandler(event) {
|
|
55
|
+
// We use setTimeout to give an opportunity to call preventDefault
|
|
56
|
+
setTimeout(() => this.handleChangeEvent(event), 0);
|
|
70
57
|
}
|
|
71
|
-
|
|
72
|
-
|
|
58
|
+
delegateFocus(event) {
|
|
59
|
+
if (!isEventFromElement(event, this.hostElement))
|
|
60
|
+
return;
|
|
61
|
+
this.hostElement.shadowRoot.querySelector('input').focus();
|
|
73
62
|
}
|
|
74
|
-
|
|
75
|
-
|
|
63
|
+
////////// OBSERVERS //////////
|
|
64
|
+
ariaLabelObserver() {
|
|
65
|
+
handleAriaLabel(this);
|
|
76
66
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
this.
|
|
67
|
+
handleChangeEvent(event) {
|
|
68
|
+
if (this.readonly ||
|
|
69
|
+
this.disabled ||
|
|
70
|
+
this.hostElement.onchange ||
|
|
71
|
+
event.defaultPrevented ||
|
|
72
|
+
event.target !== this.hostElement ||
|
|
73
|
+
!event.detail) {
|
|
74
|
+
return;
|
|
81
75
|
}
|
|
76
|
+
this.checked = event.detail.checked;
|
|
82
77
|
}
|
|
83
|
-
|
|
84
|
-
focusItem() {
|
|
85
|
-
this.dropdownItemBtn.dispatchEvent(new FocusEvent('focus', { bubbles: false }));
|
|
86
|
-
}
|
|
87
|
-
focusRemoveBtn() {
|
|
88
|
-
this.removeBtn && this.removeBtn.dispatchEvent(new FocusEvent('focus', { bubbles: false }));
|
|
89
|
-
}
|
|
78
|
+
/////// View Methods ///////
|
|
90
79
|
render() {
|
|
91
|
-
|
|
92
|
-
|
|
80
|
+
const textLabelClasses = ['label-text'];
|
|
81
|
+
if (this.hideLabel)
|
|
82
|
+
textLabelClasses.push('sr');
|
|
83
|
+
return (h("div", { class: "container" }, h("input", { ref: el => (this.inputElement = el), id: this._id, type: "checkbox", checked: this.indeterminate || this.checked || false, disabled: !!this.disabled || !!this.groupDisabled, class: "sr", value: this.value, name: this.name || this._id, "aria-describedby": this.description ? 'description' : undefined, "test-id": "q2CheckboxInnerCheckBox", onClick: this.onInputClick }), h("label", { htmlFor: this._id, class: "label-control", "test-id": "checkboxButton" }, this.generateCheckboxSVG()), h("div", { class: textLabelClasses.join(' ') }, h("label", { "test-id": "checkboxLabel", htmlFor: this._id }, loc(this.label), h("slot", null))), this.description && (h("div", { class: "description-text", "test-id": "checkboxDescription", id: "description" }, loc(this.description)))));
|
|
84
|
+
}
|
|
85
|
+
generateCheckboxSVG() {
|
|
86
|
+
if (this.type === 'favorite') {
|
|
87
|
+
return (h("q2-icon", { type: "star", class: "checkbox-icon" }));
|
|
93
88
|
}
|
|
94
|
-
|
|
89
|
+
if (this.type === 'toggle') {
|
|
90
|
+
return this.generateToggleSVG();
|
|
91
|
+
}
|
|
92
|
+
return (h("svg", { "aria-hidden": "true", width: "20", height: "20", viewBox: "0 0 20 20", class: "checkbox-icon", focusable: "false" }, h("rect", { x: "1", y: "1", width: "18", height: "18", rx: "3" }), (this.checked || this.indeterminate) && this.generateCheckBoxSVGFill()));
|
|
95
93
|
}
|
|
96
|
-
|
|
97
|
-
|
|
94
|
+
generateCheckBoxSVGFill() {
|
|
95
|
+
if (this.indeterminate) {
|
|
96
|
+
return (h("line", { class: "checkbox-fill indeterminate-fill", x1: "4", y1: "10", x2: "16", y2: "10" }));
|
|
97
|
+
}
|
|
98
|
+
return (h("polyline", { class: "checkbox-fill checked-fill", points: "5 11 8.5 14.5 15 6" }));
|
|
98
99
|
}
|
|
99
|
-
|
|
100
|
-
return (h("div", { class: "
|
|
100
|
+
generateToggleSVG() {
|
|
101
|
+
return (h("div", { class: "toggle-svg" }, h("svg", { "aria-hidden": "true", focusable: "false", viewBox: "0 0 46 14", class: "toggle-track", "test-id": "toggleTrack" }, h("rect", { width: "36", height: "14", rx: "7", x: "5" })), h("svg", { "aria-hidden": "true", focusable: "false", viewBox: "0 0 30 30", class: "toggle-indicator", "test-id": "toggleIndicator" }, h("circle", { class: "toggle-circle", width: "20", height: "20", cx: "15", cy: "15", r: "10" }), h("line", { class: "off checked-fill", x1: "12", y1: "18", x2: "18", y2: "12" }), h("line", { class: "off checked-fill", x1: "12", y1: "12", x2: "18", y2: "18" }), h("polyline", { class: "on checked-fill", points: "11,16 14,19 18,12 14,19" }))));
|
|
101
102
|
}
|
|
102
103
|
get hostElement() { return this; }
|
|
103
104
|
static get watchers() { return {
|
|
104
105
|
"ariaLabel": ["ariaLabelObserver"]
|
|
105
106
|
}; }
|
|
106
107
|
static get style() { return stylesCss; }
|
|
107
|
-
}, [1, "q2-
|
|
108
|
-
"
|
|
109
|
-
"
|
|
110
|
-
"separator": [516],
|
|
108
|
+
}, [1, "q2-checkbox", {
|
|
109
|
+
"checked": [1540],
|
|
110
|
+
"type": [513],
|
|
111
111
|
"label": [1537],
|
|
112
|
+
"hideLabel": [1540, "hide-label"],
|
|
113
|
+
"indeterminate": [516],
|
|
114
|
+
"disabled": [516],
|
|
115
|
+
"readonly": [516],
|
|
112
116
|
"value": [513],
|
|
117
|
+
"name": [513],
|
|
118
|
+
"groupDisabled": [516, "group-disabled"],
|
|
119
|
+
"alignment": [513],
|
|
120
|
+
"description": [513],
|
|
121
|
+
"hasError": [516, "has-error"],
|
|
113
122
|
"ariaLabel": [1537, "aria-label"]
|
|
114
|
-
}, [[0, "focus", "
|
|
123
|
+
}, [[0, "change", "defaultChangeHandler"], [0, "focus", "delegateFocus"]]]);
|
|
115
124
|
function defineCustomElement() {
|
|
116
125
|
if (typeof customElements === "undefined") {
|
|
117
126
|
return;
|
|
118
127
|
}
|
|
119
|
-
const components = ["q2-
|
|
128
|
+
const components = ["q2-checkbox", "q2-icon"];
|
|
120
129
|
components.forEach(tagName => { switch (tagName) {
|
|
121
|
-
case "q2-
|
|
122
|
-
if (!customElements.get(tagName)) {
|
|
123
|
-
customElements.define(tagName, Q2DropdownItem);
|
|
124
|
-
}
|
|
125
|
-
break;
|
|
126
|
-
case "q2-btn":
|
|
130
|
+
case "q2-checkbox":
|
|
127
131
|
if (!customElements.get(tagName)) {
|
|
128
|
-
|
|
132
|
+
customElements.define(tagName, Q2Checkbox);
|
|
129
133
|
}
|
|
130
134
|
break;
|
|
131
135
|
case "q2-icon":
|
|
132
|
-
if (!customElements.get(tagName)) {
|
|
133
|
-
defineCustomElement$2();
|
|
134
|
-
}
|
|
135
|
-
break;
|
|
136
|
-
case "q2-loading":
|
|
137
136
|
if (!customElements.get(tagName)) {
|
|
138
137
|
defineCustomElement$1();
|
|
139
138
|
}
|
|
@@ -142,4 +141,4 @@ function defineCustomElement() {
|
|
|
142
141
|
}
|
|
143
142
|
defineCustomElement();
|
|
144
143
|
|
|
145
|
-
export {
|
|
144
|
+
export { Q2Checkbox as Q, defineCustomElement as d };
|