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.
Files changed (101) hide show
  1. package/dist/cjs/click-elsewhere_2.cjs.entry.js +4 -3
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/q2-action-sheet.cjs.entry.js +10 -5
  4. package/dist/cjs/q2-badge.cjs.entry.js +43 -0
  5. package/dist/cjs/q2-btn_2.cjs.entry.js +1 -1
  6. package/dist/cjs/q2-checkbox.cjs.entry.js +16 -7
  7. package/dist/cjs/q2-data-table.cjs.entry.js +287 -0
  8. package/dist/cjs/{q2-badge_2.cjs.entry.js → q2-input.cjs.entry.js} +1 -38
  9. package/dist/cjs/q2-tecton-elements.cjs.js +1 -1
  10. package/dist/collection/collection-manifest.json +1 -0
  11. package/dist/collection/components/q2-action-sheet/index.js +26 -4
  12. package/dist/collection/components/q2-action-sheet/styles.css +2 -2
  13. package/dist/collection/components/q2-btn/styles.css +4 -0
  14. package/dist/collection/components/q2-checkbox/index.js +15 -6
  15. package/dist/collection/components/q2-checkbox/styles.css +4 -0
  16. package/dist/collection/components/q2-data-table/index.js +539 -0
  17. package/dist/collection/components/q2-data-table/styles.css +192 -0
  18. package/dist/collection/components/q2-input/styles.css +1 -1
  19. package/dist/collection/components/q2-popover/index.js +4 -3
  20. package/dist/components/index.d.ts +1 -0
  21. package/dist/components/index.js +1 -0
  22. package/dist/components/index10.js +72 -55
  23. package/dist/components/index11.js +56 -44
  24. package/dist/components/index12.js +42 -42
  25. package/dist/components/index13.js +40 -538
  26. package/dist/components/index14.js +518 -136
  27. package/dist/components/index15.js +174 -574
  28. package/dist/components/index16.js +589 -0
  29. package/dist/components/index3.js +1 -1
  30. package/dist/components/index5.js +3 -3
  31. package/dist/components/index6.js +93 -94
  32. package/dist/components/index7.js +112 -2927
  33. package/dist/components/index8.js +2919 -3347
  34. package/dist/components/index9.js +3343 -56
  35. package/dist/components/q2-action-sheet.js +18 -12
  36. package/dist/components/q2-calendar.js +6 -6
  37. package/dist/components/q2-card.js +2 -2
  38. package/dist/components/q2-carousel-pane.js +1 -1
  39. package/dist/components/q2-carousel.js +3 -3
  40. package/dist/components/q2-chart-area.js +1 -1
  41. package/dist/components/q2-chart-bar.js +1 -1
  42. package/dist/components/q2-chart-donut.js +2 -2
  43. package/dist/components/q2-checkbox-group.js +2 -2
  44. package/dist/components/q2-checkbox.js +1 -133
  45. package/dist/components/q2-data-table.d.ts +11 -0
  46. package/dist/components/q2-data-table.js +349 -0
  47. package/dist/components/q2-dropdown-item.js +1 -1
  48. package/dist/components/q2-dropdown.js +5 -5
  49. package/dist/components/q2-editable-field.js +4 -4
  50. package/dist/components/q2-icon.js +1 -1
  51. package/dist/components/q2-input.js +1 -1
  52. package/dist/components/q2-loading.js +1 -1
  53. package/dist/components/q2-loc.js +1 -1
  54. package/dist/components/q2-message.js +1 -1
  55. package/dist/components/q2-month-picker.js +3 -3
  56. package/dist/components/q2-optgroup.js +1 -1
  57. package/dist/components/q2-option-list.js +1 -1
  58. package/dist/components/q2-option.js +1 -1
  59. package/dist/components/q2-pagination.js +4 -4
  60. package/dist/components/q2-pill.js +4 -4
  61. package/dist/components/q2-popover.js +1 -1
  62. package/dist/components/q2-radio-group.js +2 -2
  63. package/dist/components/q2-radio.js +1 -1
  64. package/dist/components/q2-section.js +3 -3
  65. package/dist/components/q2-select.js +6 -6
  66. package/dist/components/q2-stepper-pane.js +1 -1
  67. package/dist/components/q2-stepper-vertical.js +2 -2
  68. package/dist/components/q2-stepper.js +3 -3
  69. package/dist/components/q2-tab-container.js +3 -3
  70. package/dist/components/q2-tag.js +4 -4
  71. package/dist/components/q2-textarea.js +2 -2
  72. package/dist/components/q2-tooltip.js +1 -1
  73. package/dist/docs.json +280 -3
  74. package/dist/esm/click-elsewhere_2.entry.js +4 -3
  75. package/dist/esm/loader.js +1 -1
  76. package/dist/esm/q2-action-sheet.entry.js +10 -5
  77. package/dist/esm/q2-badge.entry.js +39 -0
  78. package/dist/esm/q2-btn_2.entry.js +1 -1
  79. package/dist/esm/q2-checkbox.entry.js +16 -7
  80. package/dist/esm/q2-data-table.entry.js +283 -0
  81. package/dist/esm/{q2-badge_2.entry.js → q2-input.entry.js} +3 -39
  82. package/dist/esm/q2-tecton-elements.js +1 -1
  83. package/dist/q2-tecton-elements/p-00b2c345.entry.js +1 -0
  84. package/dist/q2-tecton-elements/p-0112df78.entry.js +1 -0
  85. package/dist/q2-tecton-elements/p-08286237.entry.js +1 -0
  86. package/dist/q2-tecton-elements/p-42d03011.entry.js +1 -0
  87. package/dist/q2-tecton-elements/p-47aefcc2.entry.js +1 -0
  88. package/dist/q2-tecton-elements/p-9a327827.entry.js +1 -0
  89. package/dist/q2-tecton-elements/p-c9abc814.entry.js +1 -0
  90. package/dist/q2-tecton-elements/q2-tecton-elements.esm.js +1 -1
  91. package/dist/types/components/q2-action-sheet/index.d.ts +1 -0
  92. package/dist/types/components/q2-checkbox/index.d.ts +4 -0
  93. package/dist/types/components/q2-data-table/index.d.ts +94 -0
  94. package/dist/types/components.d.ts +47 -0
  95. package/package.json +3 -3
  96. package/dist/q2-tecton-elements/p-0b7003c4.entry.js +0 -1
  97. package/dist/q2-tecton-elements/p-1b9e07b4.entry.js +0 -1
  98. package/dist/q2-tecton-elements/p-3bf06809.entry.js +0 -1
  99. package/dist/q2-tecton-elements/p-92e746c8.entry.js +0 -1
  100. package/dist/q2-tecton-elements/p-d6824ce5.entry.js +0 -1
  101. /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 './index15.js';
3
- import { d as defineCustomElement$3 } from './index5.js';
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}.dropdown-separator{--comp-default-separator-margin:0 var(--tct-scale-1, var(--app-scale-3x, 15px));margin:var(--tct-dropdown-separator-margin, var(--t-dropdown-separator-margin, var(--comp-default-separator-margin)));border-bottom:1px solid var(--tct-dropdown-item-separator-color, var(--t-dropdown-item-separator-color, var(--tct-gray-11, var(--t-gray-11, var(--tct-gray-l1, var(--app-gray-l1, #cccccc))))))}.dropdown-item-wrapper{display:flex}.dropdown-item{min-height:44px;flex:1 1 100%;padding:var(--tct-dropdown-item-padding, var(--t-dropdown-item-padding, 2px))}.dropdown-item-content{--comp-default-content-padding:12px var(--app-scale-3x, 15px);padding:var(--tct-dropdown-item-content-padding, var(--t-dropdown-item-content-padding, var(--comp-default-content-padding)));text-align:left;background-color:var(--tct-dropdown-item-bg, var(--t-dropdown-item-bg, var(--tct-white, var(--t-base, var(--app-white, #ffffff)))));color:var(--tct-dropdown-item-font-color, var(--t-dropdown-item-font-color, inherit));transition:background-color var(--tct-dropdown-item-content-tween, var(--t-dropdown-item-content-tween, var(--tct-tween-1, var(--app-tween-1, 0.2s ease))));overflow:hidden;text-overflow:ellipsis;flex:1}:host(:not([disabled])) .dropdown-item-content:hover,:host(:not([disabled])) .dropdown-item:focus-within .dropdown-item-content{background-color:var(--tct-dropdown-item-selected-bg, var(--t-dropdown-item-selected-bg, var(--tct-gray-14, var(--t-gray-14, var(--tct-gray-l3, var(--app-gray-l3, var(--t-base, #f2f2f2)))))));color:var(--tct-dropdown-item-selected-font-color, var(--t-dropdown-item-selected-font-color, inherit))}.remove-dropdown-item{flex:0 0 44px;margin:2px}";
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 Q2DropdownItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
7
+ const Q2Checkbox = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
10
8
  constructor() {
11
9
  super();
12
10
  this.__registerHost();
13
11
  this.__attachShadow();
14
- this.onItemClick = (event) => {
15
- event.stopImmediatePropagation();
16
- this.hostElement.dispatchEvent(new CustomEvent('click', {
17
- detail: {
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.disabled = undefined;
51
- this.removable = undefined;
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
- /////// LIFECYCLE HOOKS //////
45
+ ////////// LIFECYCLE HOOKS ////////
58
46
  componentWillLoad() {
59
47
  handleAriaLabel(this);
60
48
  }
61
- //////// OBSERVERS //////////
62
- ariaLabelObserver() {
63
- handleAriaLabel(this);
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
- get dropdownItemBtn() {
69
- return this.hostElement.shadowRoot.querySelector('.dropdown-item');
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
- get innerLabel() {
72
- return this.label || this.hostElement.textContent;
58
+ delegateFocus(event) {
59
+ if (!isEventFromElement(event, this.hostElement))
60
+ return;
61
+ this.hostElement.shadowRoot.querySelector('input').focus();
73
62
  }
74
- get removeBtn() {
75
- return this.hostElement.shadowRoot.querySelector('.remove-dropdown-item');
63
+ ////////// OBSERVERS //////////
64
+ ariaLabelObserver() {
65
+ handleAriaLabel(this);
76
66
  }
77
- ///////// Host Element Events //////
78
- onHostElementFocus() {
79
- if (event.target === this.hostElement) {
80
- this.focusItem();
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
- ///////// Actions /////////
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
- if (!!this.separator) {
92
- return this.separatorDOM();
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
- return this.itemDOM();
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
- separatorDOM() {
97
- return (h("div", { class: "dropdown-separator", role: "separator", "test-id": "dropdownItemSeparator" }));
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
- itemDOM() {
100
- return (h("div", { class: "dropdown-item-wrapper" }, h("q2-btn", { class: "dropdown-item", label: this.innerLabel, "hide-label": true, disabled: !!this.disabled, role: "menuitem", onClick: this.onItemClick, onKeyDown: this.onItemKeydown, onFocus: this.onItemFocus, "test-id": "dropdownItem" }, h("div", { class: "dropdown-item-content" }, h("slot", null))), !!this.removable ? (h("q2-btn", { class: "remove-dropdown-item", label: this.removeLabel, "hide-label": true, disabled: !!this.disabled, role: "menuitem", onClick: this.onRemoveBtnClick, onKeyDown: this.onRemoveBtnKeydown, onFocus: this.onRemoveBtnFocus, "test-id": "removeDropdownItem" }, h("q2-icon", { type: "close" }))) : ('')));
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-dropdown-item", {
108
- "disabled": [516],
109
- "removable": [516],
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", "onHostElementFocus"]]]);
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-dropdown-item", "q2-btn", "q2-icon", "q2-loading"];
128
+ const components = ["q2-checkbox", "q2-icon"];
120
129
  components.forEach(tagName => { switch (tagName) {
121
- case "q2-dropdown-item":
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
- defineCustomElement$3();
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 { Q2DropdownItem as Q, defineCustomElement as d };
144
+ export { Q2Checkbox as Q, defineCustomElement as d };