q2-tecton-elements 1.12.0-alpha.0 → 1.13.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 (234) hide show
  1. package/dist/cjs/click-elsewhere.cjs.entry.js +5 -7
  2. package/dist/cjs/{icons-4595ee47.js → icons-08ffe5c9.js} +394 -384
  3. package/dist/cjs/{index-c2e53804.js → index-7febb200.js} +112 -65
  4. package/dist/cjs/{index-a55d3c34.js → index-dd823ee6.js} +27 -14
  5. package/dist/cjs/loader.cjs.js +3 -3
  6. package/dist/cjs/q2-avatar.cjs.entry.js +2 -2
  7. package/dist/cjs/q2-badge.cjs.entry.js +43 -0
  8. package/dist/cjs/q2-btn_2.cjs.entry.js +13 -13
  9. package/dist/cjs/q2-calendar.cjs.entry.js +53 -59
  10. package/dist/cjs/q2-card.cjs.entry.js +127 -0
  11. package/dist/cjs/q2-carousel-pane.cjs.entry.js +5 -5
  12. package/dist/cjs/q2-carousel.cjs.entry.js +318 -106
  13. package/dist/cjs/q2-checkbox-group.cjs.entry.js +6 -3
  14. package/dist/cjs/q2-checkbox.cjs.entry.js +18 -10
  15. package/dist/cjs/q2-dropdown-item.cjs.entry.js +7 -7
  16. package/dist/cjs/q2-dropdown.cjs.entry.js +8 -17
  17. package/dist/cjs/q2-editable-field.cjs.entry.js +5 -8
  18. package/dist/cjs/q2-icon.cjs.entry.js +3 -3
  19. package/dist/cjs/q2-input.cjs.entry.js +439 -437
  20. package/dist/cjs/q2-loading-element.cjs.entry.js +3 -3
  21. package/dist/cjs/q2-loc.cjs.entry.js +2 -2
  22. package/dist/cjs/q2-message.cjs.entry.js +5 -5
  23. package/dist/cjs/q2-optgroup.cjs.entry.js +3 -3
  24. package/dist/cjs/q2-option-list.cjs.entry.js +359 -0
  25. package/dist/cjs/q2-option.cjs.entry.js +3 -11
  26. package/dist/cjs/q2-pagination.cjs.entry.js +116 -0
  27. package/dist/cjs/q2-pill.cjs.entry.js +137 -0
  28. package/dist/cjs/q2-radio-group.cjs.entry.js +43 -18
  29. package/dist/cjs/q2-radio.cjs.entry.js +21 -4
  30. package/dist/cjs/q2-section.cjs.entry.js +5 -7
  31. package/dist/cjs/q2-select.cjs.entry.js +23 -26
  32. package/dist/cjs/q2-stepper-pane.cjs.entry.js +42 -4
  33. package/dist/cjs/q2-stepper-vertical.cjs.entry.js +278 -0
  34. package/dist/cjs/q2-stepper.cjs.entry.js +10 -12
  35. package/dist/cjs/q2-tab-container.cjs.entry.js +12 -8
  36. package/dist/cjs/q2-tab-pane.cjs.entry.js +1 -1
  37. package/dist/cjs/q2-tag.cjs.entry.js +94 -0
  38. package/dist/cjs/q2-tecton-elements.cjs.js +3 -3
  39. package/dist/cjs/q2-textarea.cjs.entry.js +8 -8
  40. package/dist/cjs/{shapes-086c0365.js → shapes-305746b5.js} +9 -16
  41. package/dist/cjs/tecton-tab-pane.cjs.entry.js +2 -5
  42. package/dist/collection/collection-manifest.json +10 -3
  43. package/dist/collection/components/click-elsewhere/index.js +4 -6
  44. package/dist/collection/components/q2-badge/index.js +148 -0
  45. package/dist/collection/components/q2-badge/styles.css +134 -0
  46. package/dist/collection/components/q2-btn/index.js +14 -14
  47. package/dist/collection/components/q2-btn/styles.css +1 -1
  48. package/dist/collection/components/q2-calendar/helpers.js +22 -20
  49. package/dist/collection/components/q2-calendar/index.js +44 -37
  50. package/dist/collection/components/q2-calendar/validation.js +4 -2
  51. package/dist/collection/components/q2-card/index.js +347 -0
  52. package/dist/collection/components/q2-card/styles.css +177 -0
  53. package/dist/collection/components/q2-carousel/index.js +11 -16
  54. package/dist/collection/components/q2-carousel/styles.css +3 -3
  55. package/dist/collection/components/q2-carousel-pane/index.js +2 -2
  56. package/dist/collection/components/q2-carousel-pane/styles.css +8 -3
  57. package/dist/collection/components/q2-checkbox/index.js +37 -12
  58. package/dist/collection/components/q2-checkbox-group/index.js +22 -1
  59. package/dist/collection/components/q2-dropdown/index.js +6 -15
  60. package/dist/collection/components/q2-dropdown-item/index.js +5 -5
  61. package/dist/collection/components/q2-editable-field/index.js +3 -6
  62. package/dist/collection/components/q2-icon/icons.js +393 -383
  63. package/dist/collection/components/q2-input/formatting/credit-card.js +15 -13
  64. package/dist/collection/components/q2-input/formatting/currency.js +162 -162
  65. package/dist/collection/components/q2-input/formatting/date.js +1 -1
  66. package/dist/collection/components/q2-input/formatting/generic.js +7 -8
  67. package/dist/collection/components/q2-input/formatting/number.js +6 -9
  68. package/dist/collection/components/q2-input/formatting/numeric.js +5 -5
  69. package/dist/collection/components/q2-input/formatting/phone.js +215 -215
  70. package/dist/collection/components/q2-input/formatting/postal.js +1 -1
  71. package/dist/collection/components/q2-input/index.js +81 -25
  72. package/dist/collection/components/q2-input/styles.css +19 -14
  73. package/dist/collection/components/q2-loading/index.js +4 -4
  74. package/dist/collection/components/q2-loading/skeleton/q2-loading-element/index.js +1 -1
  75. package/dist/collection/components/q2-loading/skeleton/shapes.js +8 -15
  76. package/dist/collection/components/q2-message/index.js +3 -3
  77. package/dist/collection/components/q2-optgroup/index.js +1 -1
  78. package/dist/collection/components/q2-option/index.js +19 -25
  79. package/dist/collection/components/q2-option/styles.css +5 -0
  80. package/dist/collection/components/q2-option-list/index.js +648 -0
  81. package/dist/collection/components/q2-option-list/styles.css +128 -0
  82. package/dist/collection/components/q2-pagination/index.js +275 -0
  83. package/dist/collection/components/q2-pagination/styles.css +120 -0
  84. package/dist/collection/components/q2-pill/index.js +324 -0
  85. package/dist/collection/components/q2-pill/styles.css +229 -0
  86. package/dist/collection/components/q2-radio/index.js +38 -1
  87. package/dist/collection/components/q2-radio-group/index.js +66 -24
  88. package/dist/collection/components/q2-section/index.js +5 -7
  89. package/dist/collection/components/q2-select/index.js +40 -25
  90. package/dist/collection/components/q2-stepper/index.js +8 -10
  91. package/dist/collection/components/q2-stepper/styles.css +5 -5
  92. package/dist/collection/components/q2-stepper-pane/index.js +133 -5
  93. package/dist/collection/components/q2-stepper-vertical/index.js +346 -0
  94. package/dist/collection/components/q2-stepper-vertical/styles.css +273 -0
  95. package/dist/collection/components/q2-tab-container/index.js +11 -7
  96. package/dist/collection/components/q2-tag/index.js +200 -0
  97. package/dist/collection/components/q2-tag/styles.css +141 -0
  98. package/dist/collection/components/q2-textarea/index.js +6 -6
  99. package/dist/collection/components/tecton-tab-pane/index.js +3 -10
  100. package/dist/collection/utils/index.js +25 -13
  101. package/dist/esm/click-elsewhere.entry.js +5 -7
  102. package/dist/esm/{icons-3ee662ea.js → icons-b1e11526.js} +394 -384
  103. package/dist/esm/{index-ec6660af.js → index-0ff8de52.js} +27 -15
  104. package/dist/esm/{index-be8376c0.js → index-dbfb3ecc.js} +112 -65
  105. package/dist/esm/loader.js +3 -3
  106. package/dist/esm/polyfills/css-shim.js +1 -1
  107. package/dist/esm/q2-avatar.entry.js +2 -2
  108. package/dist/esm/q2-badge.entry.js +39 -0
  109. package/dist/esm/q2-btn_2.entry.js +13 -13
  110. package/dist/esm/q2-calendar.entry.js +53 -59
  111. package/dist/esm/q2-card.entry.js +123 -0
  112. package/dist/esm/q2-carousel-pane.entry.js +5 -5
  113. package/dist/esm/q2-carousel.entry.js +318 -106
  114. package/dist/esm/q2-checkbox-group.entry.js +6 -3
  115. package/dist/esm/q2-checkbox.entry.js +18 -10
  116. package/dist/esm/q2-dropdown-item.entry.js +7 -7
  117. package/dist/esm/q2-dropdown.entry.js +8 -17
  118. package/dist/esm/q2-editable-field.entry.js +5 -8
  119. package/dist/esm/q2-icon.entry.js +3 -3
  120. package/dist/esm/q2-input.entry.js +439 -437
  121. package/dist/esm/q2-loading-element.entry.js +3 -3
  122. package/dist/esm/q2-loc.entry.js +2 -2
  123. package/dist/esm/q2-message.entry.js +5 -5
  124. package/dist/esm/q2-optgroup.entry.js +3 -3
  125. package/dist/esm/q2-option-list.entry.js +355 -0
  126. package/dist/esm/q2-option.entry.js +3 -11
  127. package/dist/esm/q2-pagination.entry.js +112 -0
  128. package/dist/esm/q2-pill.entry.js +133 -0
  129. package/dist/esm/q2-radio-group.entry.js +43 -18
  130. package/dist/esm/q2-radio.entry.js +21 -4
  131. package/dist/esm/q2-section.entry.js +5 -7
  132. package/dist/esm/q2-select.entry.js +23 -26
  133. package/dist/esm/q2-stepper-pane.entry.js +42 -4
  134. package/dist/esm/q2-stepper-vertical.entry.js +274 -0
  135. package/dist/esm/q2-stepper.entry.js +10 -12
  136. package/dist/esm/q2-tab-container.entry.js +12 -8
  137. package/dist/esm/q2-tab-pane.entry.js +1 -1
  138. package/dist/esm/q2-tag.entry.js +90 -0
  139. package/dist/esm/q2-tecton-elements.js +3 -3
  140. package/dist/esm/q2-textarea.entry.js +8 -8
  141. package/dist/esm/{shapes-81c11dfe.js → shapes-cff4e1f0.js} +9 -16
  142. package/dist/esm/tecton-tab-pane.entry.js +2 -5
  143. package/dist/loader/index.d.ts +0 -1
  144. package/dist/q2-tecton-elements/{p-75e87cca.entry.js → p-00e8f782.entry.js} +1 -1
  145. package/dist/q2-tecton-elements/p-0900bec1.entry.js +1 -0
  146. package/dist/q2-tecton-elements/p-10264ecb.entry.js +1 -0
  147. package/dist/q2-tecton-elements/p-123cdfb9.entry.js +1 -0
  148. package/dist/q2-tecton-elements/{p-fbf7c5e6.entry.js → p-1305ec5f.entry.js} +1 -1
  149. package/dist/q2-tecton-elements/p-148391d6.entry.js +1 -0
  150. package/dist/q2-tecton-elements/p-1dfaee64.entry.js +1 -0
  151. package/dist/q2-tecton-elements/{p-32ad664c.entry.js → p-221abbf6.entry.js} +1 -1
  152. package/dist/q2-tecton-elements/{p-c90a6016.js → p-255b2b4c.js} +1 -1
  153. package/dist/q2-tecton-elements/p-27736b6b.entry.js +1 -0
  154. package/dist/q2-tecton-elements/p-2846ab94.entry.js +1 -0
  155. package/dist/q2-tecton-elements/p-2bc1de01.entry.js +1 -0
  156. package/dist/q2-tecton-elements/{p-8ea2c4f7.entry.js → p-2c15414c.entry.js} +1 -1
  157. package/dist/q2-tecton-elements/p-2caa89fd.js +1 -0
  158. package/dist/q2-tecton-elements/p-327cca41.entry.js +1 -0
  159. package/dist/q2-tecton-elements/p-3a420dbf.entry.js +1 -0
  160. package/dist/q2-tecton-elements/p-3abcb09d.entry.js +1 -0
  161. package/dist/q2-tecton-elements/p-3fe98e3e.entry.js +1 -0
  162. package/dist/q2-tecton-elements/{p-bb2e110a.entry.js → p-430a979b.entry.js} +1 -1
  163. package/dist/q2-tecton-elements/{p-7e6fc65d.entry.js → p-45eb7739.entry.js} +1 -1
  164. package/dist/q2-tecton-elements/{p-750bcd33.entry.js → p-49b2abc4.entry.js} +1 -1
  165. package/dist/q2-tecton-elements/{p-9b50c3c3.entry.js → p-4ab30466.entry.js} +1 -1
  166. package/dist/q2-tecton-elements/p-50e218c7.entry.js +1 -0
  167. package/dist/q2-tecton-elements/p-5bbf2bfe.entry.js +1 -0
  168. package/dist/q2-tecton-elements/{p-ac859fcc.entry.js → p-6fec9235.entry.js} +1 -1
  169. package/dist/q2-tecton-elements/p-824aebd9.js +1 -0
  170. package/dist/q2-tecton-elements/p-a4ae89cc.entry.js +1 -0
  171. package/dist/q2-tecton-elements/{p-50967020.entry.js → p-a5562aaa.entry.js} +1 -1
  172. package/dist/q2-tecton-elements/p-ae4fed23.entry.js +1 -0
  173. package/dist/q2-tecton-elements/p-b2302cd3.entry.js +1 -0
  174. package/dist/q2-tecton-elements/p-c20cbb2d.entry.js +1 -0
  175. package/dist/q2-tecton-elements/p-ca7a3380.entry.js +1 -0
  176. package/dist/q2-tecton-elements/{p-a6f8d09a.entry.js → p-d33e152c.entry.js} +1 -1
  177. package/dist/q2-tecton-elements/{p-9024859f.entry.js → p-d5218cd6.entry.js} +1 -1
  178. package/dist/q2-tecton-elements/p-d52b435e.entry.js +1 -0
  179. package/dist/q2-tecton-elements/p-dd02cf8d.js +1 -0
  180. package/dist/q2-tecton-elements/{p-07a5d703.entry.js → p-e0e7ae8b.entry.js} +1 -1
  181. package/dist/q2-tecton-elements/{p-7e030e92.entry.js → p-ede12fc1.entry.js} +1 -1
  182. package/dist/q2-tecton-elements/{p-df182f61.entry.js → p-fdfbe75b.entry.js} +1 -1
  183. package/dist/q2-tecton-elements/q2-tecton-elements.esm.js +1 -1
  184. package/dist/test/elements/q2-tag-test.js +151 -0
  185. package/dist/test/helpers.js +20 -9
  186. package/dist/types/components/q2-badge/index.d.ts +13 -0
  187. package/dist/types/components/q2-btn/index.d.ts +3 -3
  188. package/dist/types/components/q2-calendar/helpers.d.ts +1 -0
  189. package/dist/types/components/q2-calendar/index.d.ts +2 -1
  190. package/dist/types/components/q2-calendar/validation.d.ts +1 -1
  191. package/dist/types/components/q2-card/index.d.ts +35 -0
  192. package/dist/types/components/q2-checkbox/index.d.ts +3 -1
  193. package/dist/types/components/q2-checkbox-group/index.d.ts +1 -0
  194. package/dist/types/components/q2-dropdown/index.d.ts +1 -1
  195. package/dist/types/components/q2-editable-field/index.d.ts +1 -1
  196. package/dist/types/components/q2-input/formatting/credit-card.d.ts +1 -3
  197. package/dist/types/components/q2-input/index.d.ts +5 -2
  198. package/dist/types/components/q2-option/index.d.ts +2 -3
  199. package/dist/types/components/q2-option-list/index.d.ts +62 -0
  200. package/dist/types/components/q2-pagination/index.d.ts +30 -0
  201. package/dist/types/components/q2-pill/index.d.ts +39 -0
  202. package/dist/types/components/q2-radio/index.d.ts +4 -1
  203. package/dist/types/components/q2-radio-group/index.d.ts +5 -1
  204. package/dist/types/components/q2-select/index.d.ts +2 -1
  205. package/dist/types/components/q2-stepper/index.d.ts +1 -1
  206. package/dist/types/components/q2-stepper-pane/index.d.ts +16 -1
  207. package/dist/types/components/q2-stepper-vertical/index.d.ts +52 -0
  208. package/dist/types/components/q2-tab-container/index.d.ts +1 -1
  209. package/dist/types/components/q2-tag/index.d.ts +28 -0
  210. package/dist/types/components/tecton-tab-pane/index.d.ts +2 -2
  211. package/dist/types/components.d.ts +235 -11
  212. package/dist/types/global.d.ts +1 -0
  213. package/dist/types/stencil-public-runtime.d.ts +6 -4
  214. package/dist/types/util.d.ts +2 -10
  215. package/dist/types/utils/index.d.ts +1 -0
  216. package/dist/types/workspace/workspace/Tecton_tecton-production_master/packages/q2-tecton-elements/.stencil/test/elements/q2-tag-test.d.ts +1 -0
  217. package/dist/types/workspace/workspace/{_production_release_1.11.0-alpha → Tecton_tecton-production_master}/packages/q2-tecton-elements/.stencil/test/helpers.d.ts +6 -3
  218. package/package.json +13 -13
  219. package/dist/q2-tecton-elements/p-06fff43d.entry.js +0 -1
  220. package/dist/q2-tecton-elements/p-080839ed.js +0 -1
  221. package/dist/q2-tecton-elements/p-29a37091.entry.js +0 -1
  222. package/dist/q2-tecton-elements/p-37aba2a4.js +0 -1
  223. package/dist/q2-tecton-elements/p-4cd00f1a.js +0 -1
  224. package/dist/q2-tecton-elements/p-6702eb4d.entry.js +0 -1
  225. package/dist/q2-tecton-elements/p-768e3a5d.entry.js +0 -1
  226. package/dist/q2-tecton-elements/p-843b1ee9.entry.js +0 -1
  227. package/dist/q2-tecton-elements/p-943c7745.entry.js +0 -1
  228. package/dist/q2-tecton-elements/p-95a73559.entry.js +0 -1
  229. package/dist/q2-tecton-elements/p-9a977ee6.entry.js +0 -1
  230. package/dist/q2-tecton-elements/p-b281c349.entry.js +0 -1
  231. package/dist/q2-tecton-elements/p-c5e55b9f.entry.js +0 -1
  232. package/dist/q2-tecton-elements/p-ccbe9158.entry.js +0 -1
  233. package/dist/q2-tecton-elements/p-db6f90ac.entry.js +0 -1
  234. package/dist/q2-tecton-elements/p-fa6eea5c.entry.js +0 -1
@@ -0,0 +1,324 @@
1
+ import { Component, State, Prop, h, Listen, Element, Fragment, Event, } from '@stencil/core';
2
+ import { isEventFromElement, loc, overrideFocus } from 'src/utils';
3
+ export class Q2Pill {
4
+ constructor() {
5
+ this.selectedOptions = [];
6
+ this.scheduledAfterRender = [];
7
+ /// Helpers ///
8
+ this.determineHasOptions = () => {
9
+ const hasOptions = !!this.hostElement.querySelectorAll('q2-option').length;
10
+ this.hasOptions = hasOptions;
11
+ };
12
+ this.clearSelectedOptions = () => {
13
+ this.selectedOptions = [];
14
+ this.active = false;
15
+ this.open = false;
16
+ this.primaryBtn.focus();
17
+ this.change.emit({ value: null, values: [], active: false });
18
+ };
19
+ /// Event Handlers ///
20
+ this.handleClick = (event) => {
21
+ event.stopPropagation();
22
+ if (this.disabled)
23
+ return;
24
+ if (this.hasOptions) {
25
+ this.optionList.toggle();
26
+ }
27
+ else {
28
+ const { value, label } = this;
29
+ const isActive = (this.active = !this.active);
30
+ const values = isActive ? [{ value, display: label }] : [];
31
+ this.selectedOptions = values;
32
+ this.change.emit({
33
+ value,
34
+ values,
35
+ active: isActive,
36
+ });
37
+ }
38
+ };
39
+ this.handleKeydown = (event) => {
40
+ if (!this.hasOptions || this.disabled)
41
+ return;
42
+ this.optionList.handleExternalKeydown(event);
43
+ };
44
+ this.handleChange = event => {
45
+ if (!this.hasOptions)
46
+ return;
47
+ const { value, values } = event.detail;
48
+ const isActive = !!values.length;
49
+ if (!this.hostElement.onchange) {
50
+ this.selectedOptions = values;
51
+ this.active = isActive;
52
+ }
53
+ this.change.emit({ value, values, active: isActive });
54
+ };
55
+ this.handleFocusout = (event) => {
56
+ const relatedTarget = event.relatedTarget;
57
+ if (Array.from(this.hostElement.children).includes(relatedTarget))
58
+ return;
59
+ if (relatedTarget && !(event.relatedTarget instanceof HTMLElement))
60
+ return;
61
+ if (relatedTarget && relatedTarget.closest('.btn-height-wrapper'))
62
+ return;
63
+ this.optionList.open = false;
64
+ };
65
+ this.handleWrapperClick = () => {
66
+ this.primaryBtn.focus();
67
+ this.primaryBtn.click();
68
+ };
69
+ }
70
+ /// LifeCycle Hooks ///
71
+ componentWillLoad() {
72
+ const observer = new MutationObserver(this.determineHasOptions);
73
+ observer.observe(this.hostElement, { childList: true, attributes: true });
74
+ this.mutationObserver = observer;
75
+ }
76
+ componentDidLoad() {
77
+ overrideFocus(this.hostElement);
78
+ }
79
+ componentDidRender() {
80
+ this.scheduledAfterRender.forEach(fn => fn());
81
+ this.scheduledAfterRender = [];
82
+ }
83
+ disconnectedCallback() {
84
+ this.mutationObserver.disconnect();
85
+ this.mutationObserver = null;
86
+ }
87
+ /// Getters ///
88
+ get buttonContent() {
89
+ const { label, selectedOptions, hasOptions } = this;
90
+ if (!hasOptions || selectedOptions.length === 0)
91
+ return label;
92
+ else if (selectedOptions.length === 1)
93
+ return selectedOptions[0].display;
94
+ return loc('tecton.element.pill.activeCount', { count: selectedOptions.length });
95
+ }
96
+ /// Listeners ///
97
+ delegateFocus(event) {
98
+ if (!isEventFromElement(event, this.hostElement))
99
+ return;
100
+ this.primaryBtn.focus();
101
+ }
102
+ optionListStateEvent({ detail: { open } }) {
103
+ this.open = open;
104
+ if (!open)
105
+ this.primaryBtn.focus();
106
+ }
107
+ /// DOM ///
108
+ generateIcon() {
109
+ const { hasOptions, active } = this;
110
+ const isButton = hasOptions && active;
111
+ const TagName = isButton ? 'button' : 'div';
112
+ const iconName = isButton || !hasOptions ? 'close' : 'chevron-down';
113
+ return (h(TagName, { class: "btn-close", onClick: isButton && this.clearSelectedOptions, disabled: isButton && this.disabled, "aria-label": isButton && loc('tecton.element.pill.clearSelection'), type: isButton && 'button' },
114
+ h("q2-icon", { type: iconName })));
115
+ }
116
+ render() {
117
+ const { hasOptions, active, open } = this;
118
+ const wrapperClassNames = ['btn-wrapper'];
119
+ if (hasOptions || active)
120
+ wrapperClassNames.push('has-icon');
121
+ if (hasOptions)
122
+ wrapperClassNames.push('has-options');
123
+ return (h(Fragment, null,
124
+ h("div", { class: wrapperClassNames.join(' ') },
125
+ h("div", { class: "btn-height-wrapper", onClick: this.handleWrapperClick, tabIndex: -1 },
126
+ h("button", { class: "btn-primary", type: "button", "test-id": "btn-control", ref: el => (this.primaryBtn = el), onClick: this.handleClick, onKeyDown: this.handleKeydown, disabled: this.disabled, onFocusout: this.handleFocusout, "aria-selected": !hasOptions && active ? 'true' : 'false', "aria-roledescription": !hasOptions && 'filter', "aria-controls": hasOptions && 'option-list', "aria-haspopup": hasOptions && 'true', "aria-expanded": hasOptions && open ? 'true' : 'false' },
127
+ this.buttonContent,
128
+ !hasOptions && active && h("span", { class: "sr" },
129
+ "(",
130
+ loc('tecton.element.pill.active'),
131
+ ")"))),
132
+ this.generateIcon()),
133
+ this.hasOptions && (h("q2-option-list", { id: "option-list", ref: el => (this.optionList = el), open: this.open, onChange: this.handleChange, multiple: this.multiple, onFocusout: this.handleFocusout, selectedOptions: this.selectedOptions },
134
+ h("slot", null)))));
135
+ }
136
+ static get is() { return "q2-pill"; }
137
+ static get encapsulation() { return "shadow"; }
138
+ static get originalStyleUrls() { return {
139
+ "$": ["styles.scss"]
140
+ }; }
141
+ static get styleUrls() { return {
142
+ "$": ["styles.css"]
143
+ }; }
144
+ static get properties() { return {
145
+ "disabled": {
146
+ "type": "boolean",
147
+ "mutable": false,
148
+ "complexType": {
149
+ "original": "boolean",
150
+ "resolved": "boolean",
151
+ "references": {}
152
+ },
153
+ "required": false,
154
+ "optional": false,
155
+ "docs": {
156
+ "tags": [],
157
+ "text": ""
158
+ },
159
+ "attribute": "disabled",
160
+ "reflect": true
161
+ },
162
+ "active": {
163
+ "type": "boolean",
164
+ "mutable": true,
165
+ "complexType": {
166
+ "original": "boolean",
167
+ "resolved": "boolean",
168
+ "references": {}
169
+ },
170
+ "required": false,
171
+ "optional": false,
172
+ "docs": {
173
+ "tags": [],
174
+ "text": ""
175
+ },
176
+ "attribute": "active",
177
+ "reflect": true
178
+ },
179
+ "open": {
180
+ "type": "boolean",
181
+ "mutable": true,
182
+ "complexType": {
183
+ "original": "boolean",
184
+ "resolved": "boolean",
185
+ "references": {}
186
+ },
187
+ "required": false,
188
+ "optional": false,
189
+ "docs": {
190
+ "tags": [],
191
+ "text": ""
192
+ },
193
+ "attribute": "open",
194
+ "reflect": true
195
+ },
196
+ "multiple": {
197
+ "type": "boolean",
198
+ "mutable": false,
199
+ "complexType": {
200
+ "original": "boolean",
201
+ "resolved": "boolean",
202
+ "references": {}
203
+ },
204
+ "required": false,
205
+ "optional": false,
206
+ "docs": {
207
+ "tags": [],
208
+ "text": ""
209
+ },
210
+ "attribute": "multiple",
211
+ "reflect": true
212
+ },
213
+ "label": {
214
+ "type": "string",
215
+ "mutable": false,
216
+ "complexType": {
217
+ "original": "string",
218
+ "resolved": "string",
219
+ "references": {}
220
+ },
221
+ "required": false,
222
+ "optional": false,
223
+ "docs": {
224
+ "tags": [],
225
+ "text": ""
226
+ },
227
+ "attribute": "label",
228
+ "reflect": true
229
+ },
230
+ "value": {
231
+ "type": "string",
232
+ "mutable": false,
233
+ "complexType": {
234
+ "original": "string",
235
+ "resolved": "string",
236
+ "references": {}
237
+ },
238
+ "required": false,
239
+ "optional": false,
240
+ "docs": {
241
+ "tags": [],
242
+ "text": ""
243
+ },
244
+ "attribute": "value",
245
+ "reflect": true
246
+ },
247
+ "theme": {
248
+ "type": "string",
249
+ "mutable": false,
250
+ "complexType": {
251
+ "original": "'primary' | 'secondary' | 'tertiary'",
252
+ "resolved": "\"primary\" | \"secondary\" | \"tertiary\"",
253
+ "references": {}
254
+ },
255
+ "required": false,
256
+ "optional": false,
257
+ "docs": {
258
+ "tags": [],
259
+ "text": ""
260
+ },
261
+ "attribute": "theme",
262
+ "reflect": true
263
+ },
264
+ "selectedOptions": {
265
+ "type": "unknown",
266
+ "mutable": true,
267
+ "complexType": {
268
+ "original": "IOptionValue[]",
269
+ "resolved": "IOptionValue[]",
270
+ "references": {
271
+ "IOptionValue": {
272
+ "location": "import",
273
+ "path": "../q2-option-list"
274
+ }
275
+ }
276
+ },
277
+ "required": false,
278
+ "optional": false,
279
+ "docs": {
280
+ "tags": [],
281
+ "text": ""
282
+ },
283
+ "defaultValue": "[]"
284
+ }
285
+ }; }
286
+ static get states() { return {
287
+ "hasOptions": {}
288
+ }; }
289
+ static get events() { return [{
290
+ "method": "change",
291
+ "name": "change",
292
+ "bubbles": true,
293
+ "cancelable": true,
294
+ "composed": true,
295
+ "docs": {
296
+ "tags": [],
297
+ "text": ""
298
+ },
299
+ "complexType": {
300
+ "original": "{ value: string; values: IOptionValue[]; active: boolean }",
301
+ "resolved": "{ value: string; values: IOptionValue[]; active: boolean; }",
302
+ "references": {
303
+ "IOptionValue": {
304
+ "location": "import",
305
+ "path": "../q2-option-list"
306
+ }
307
+ }
308
+ }
309
+ }]; }
310
+ static get elementRef() { return "hostElement"; }
311
+ static get listeners() { return [{
312
+ "name": "focus",
313
+ "method": "delegateFocus",
314
+ "target": undefined,
315
+ "capture": false,
316
+ "passive": false
317
+ }, {
318
+ "name": "optionListState",
319
+ "method": "optionListStateEvent",
320
+ "target": undefined,
321
+ "capture": false,
322
+ "passive": false
323
+ }]; }
324
+ }
@@ -0,0 +1,229 @@
1
+ * {
2
+ box-sizing: border-box;
3
+ }
4
+
5
+ *:active {
6
+ outline: none;
7
+ }
8
+
9
+ *:focus {
10
+ outline: none;
11
+ box-shadow: var(--const-global-focus);
12
+ }
13
+
14
+ :host {
15
+ box-shadow: none !important;
16
+ }
17
+
18
+ ::-moz-focus-inner {
19
+ border: none;
20
+ }
21
+
22
+ input,
23
+ textarea,
24
+ button {
25
+ font-family: inherit;
26
+ font-size: inherit;
27
+ }
28
+
29
+ :host(.sr),
30
+ :host(.sr) button {
31
+ border: 0;
32
+ clip: rect(0 0 0 0);
33
+ height: 1px;
34
+ margin: -1px;
35
+ overflow: hidden;
36
+ padding: 0;
37
+ position: absolute;
38
+ width: 1px;
39
+ white-space: nowrap;
40
+ }
41
+
42
+ .sr,
43
+ .sr button {
44
+ border: 0;
45
+ clip: rect(0 0 0 0);
46
+ height: 1px;
47
+ margin: -1px;
48
+ overflow: hidden;
49
+ padding: 0;
50
+ position: absolute;
51
+ width: 1px;
52
+ white-space: nowrap;
53
+ }
54
+
55
+ .hidden {
56
+ display: none;
57
+ }
58
+
59
+ :host([hidden]) {
60
+ display: none;
61
+ }
62
+
63
+ .invisible {
64
+ visibility: hidden;
65
+ }
66
+
67
+ :host {
68
+ display: inline-block;
69
+ position: relative;
70
+ }
71
+
72
+ :host(:not(:last-child)) {
73
+ margin-inline-end: var(--tct-pill-margin, var(--t-pill-margin, var(--app-scale-2x, 10px)));
74
+ }
75
+
76
+ .btn-wrapper {
77
+ --comp-pill-min-height: var(--tct-pill-min-height, var(--t-pill-min-height, 44px));
78
+ --comp-pill-btn-border-width: var(--tct-pill-btn-border-width, var(--t-pill-btn-border-width, 2px));
79
+ --comp-pill-btn-height: var(--tct-pill-btn-height, var(--t-pill-btn-height, 30px));
80
+ --comp-close-size: 0px;
81
+ --comp-btn-background: var(--tct-pill-btn-background, var(--t-pill-btn-background, var(--t-base, #ffffff)));
82
+ --compt-hover-btn-background: var(--tct-pill-hover-btn-background, var(--t-pill-hover-btn-background, var(--t-gray-13, #e6e6e6)));
83
+ --comp-btn-padding: var(--tct-pill-btn-padding-inline, var(--t-pill-btn-padding-inline, var(--app-scale-3x, 15px)));
84
+ --comp-btn-color: var(--tct-pill-btn-color, var(--t-pill-btn-color, var(--t-gray-3, #262626)));
85
+ --comp-active-btn-background: var(--tct-pill-active-btn-background, var(--t-pill-active-btn-background, var(--t-gray-7, #666666)));
86
+ --comp-active-btn-border-color: var(--tct-pill-active-btn-border-color, var(--t-pill-active-btn-border-color, var(--t-gray-7, #666666)));
87
+ --comp-hover-active-btn-background: var(--tct-pill-active-btn-background, var(--t-pill-active-btn-background, var(--t-gray-6, #4d4d4d)));
88
+ --comp-hover-active-btn-border-color: var(--tct-pill-active-btn-background, var(--t-pill-active-btn-background, var(--t-gray-6, #4d4d4d)));
89
+ position: relative;
90
+ }
91
+ :host(:not(:empty)) .btn-wrapper, .btn-wrapper.has-icon {
92
+ --comp-close-size: var(--comp-pill-btn-height);
93
+ }
94
+ :host([active]) .btn-wrapper {
95
+ --comp-btn-color: var(--tct-pill-active-btn-color, var(--t-pill-active-btn-color, var(--t-base, #ffffff)));
96
+ }
97
+ :host([theme=primary]) .btn-wrapper {
98
+ --comp-active-btn-background: var(--t-primary-l5, #61c4ff);
99
+ --comp-btn-color: var(--t-primary-text, #ffffff);
100
+ --comp-active-btn-border-color: var(--t-primary-l5, #61c4ff);
101
+ --comp-hover-active-btn-background: var(--t-primary-l3, #21acff);
102
+ --comp-hover-active-btn-border-color: var(--t-primary-l3, #21acff);
103
+ }
104
+ :host([theme=secondary]) .btn-wrapper {
105
+ --comp-active-btn-background: var(--t-secondary-l5, #61c4ff);
106
+ --comp-btn-color: var(--t-secondary-text, #000000);
107
+ --comp-active-btn-border-color: var(--t-secondary-l5, #61c4ff);
108
+ --comp-hover-active-btn-background: var(--t-secondary-l3, #21acff);
109
+ --comp-hover-active-btn-border-color: var(--t-secondary-l3, #21acff);
110
+ }
111
+ :host([theme=tertiary]) .btn-wrapper {
112
+ --comp-active-btn-background: var(--t-tertiary-l5, #61c4ff);
113
+ --comp-btn-color: var(--t-tertiary-text, #000000);
114
+ --comp-active-btn-border-color: var(--t-tertiary-l5, #61c4ff);
115
+ --comp-hover-active-btn-background: var(--t-tertiary-l3, #21acff);
116
+ --comp-hover-active-btn-border-color: var(--t-tertiary-l3, #21acff);
117
+ }
118
+
119
+ q2-option-list {
120
+ position: absolute;
121
+ left: 0;
122
+ }
123
+
124
+ .btn-height-wrapper {
125
+ height: var(--comp-pill-min-height);
126
+ display: flex;
127
+ align-items: center;
128
+ cursor: pointer;
129
+ }
130
+ .btn-height-wrapper:focus {
131
+ box-shadow: none;
132
+ }
133
+ :host([disabled]) .btn-height-wrapper {
134
+ cursor: not-allowed;
135
+ }
136
+
137
+ .btn-close,
138
+ .btn-primary {
139
+ cursor: pointer;
140
+ height: var(--comp-pill-btn-height);
141
+ border-style: solid;
142
+ border-radius: var(--tct-pill-btn-border-radius, var(--t-pill-btn-border-radius, 30px));
143
+ transition-property: background, color, padding, width, opacity;
144
+ transition: var(--tct-pill-btn-tween, var(--t-pill-btn-tween, var(--app-tween-1, 0.2s ease)));
145
+ }
146
+
147
+ :host([disabled]) .btn-close,
148
+ :host([disabled]) .btn-primary,
149
+ :host([disabled]) q2-icon {
150
+ opacity: var(--tct-pill-disabled-opacity, var(--t-pill-disabled-opacity, var(--tct-disabled-opacity, var(--app-disabled-opacity, 0.4))));
151
+ cursor: not-allowed;
152
+ }
153
+
154
+ .btn-primary {
155
+ background: var(--comp-btn-background);
156
+ border-width: var(--comp-pill-btn-border-width);
157
+ border-color: var(--tct-pill-btn-border-color, var(--t-pill-btn-border-color, var(--t-gray-9, #999999)));
158
+ padding-inline: var(--comp-btn-padding);
159
+ padding-right: calc(var(--comp-btn-padding) + var(--comp-close-size));
160
+ font-size: var(--tct-pill-btn-font-size, var(--t-pill-btn-font-size, var(--app-font-size, 14px)));
161
+ color: var(--comp-btn-color);
162
+ display: block;
163
+ width: 100%;
164
+ text-align: start;
165
+ }
166
+ .btn-primary:focus, .btn-primary:hover {
167
+ background: var(--comp-hover-btn-background);
168
+ }
169
+ :host(:not(:empty)) .btn-primary, .has-icon .btn-primary {
170
+ padding-right: calc(
171
+ var(--tct-pill-icon-gap, var(--t-pill-icon-gap, var(--app-size-1x, 5px))) + var(--comp-close-size)
172
+ );
173
+ }
174
+ .has-options .btn-primary {
175
+ text-overflow: ellipsis;
176
+ overflow: hidden;
177
+ white-space: nowrap;
178
+ max-width: var(--tct-pill-max-width, var(--t-pill-max-width, 200px));
179
+ }
180
+ :host([active]) .btn-primary {
181
+ background: var(--comp-active-btn-background);
182
+ border-color: var(--comp-active-btn-border-color);
183
+ }
184
+ :host([active]) .btn-primary:focus, :host([active]) .btn-primary:hover {
185
+ background: var(--comp-hover-active-btn-background);
186
+ border-color: var(--comp-hover-active-btn-border-color);
187
+ }
188
+
189
+ .btn-close {
190
+ background: transparent;
191
+ border-color: transparent;
192
+ border-width: var(--comp-pill-btn-border-width);
193
+ width: var(--comp-close-size);
194
+ height: var(--comp-close-size);
195
+ padding: 0;
196
+ border: 0;
197
+ display: inline-flex;
198
+ justify-content: center;
199
+ align-items: center;
200
+ position: absolute;
201
+ right: 0;
202
+ top: 50%;
203
+ transform: translateY(-50%);
204
+ opacity: 0;
205
+ stroke: var(--comp-btn-color);
206
+ --tct-icon-stroke-primary: var(--comp-btn-color);
207
+ }
208
+ :host(:not(:empty)) .btn-close, .has-icon .btn-close {
209
+ opacity: 1;
210
+ }
211
+
212
+ q2-icon {
213
+ width: var(--tct-pill-icon-size, var(--t-pill-icon-size, 14px));
214
+ height: var(--tct-pill-icon-size, var(--t-pill-icon-size, 14px));
215
+ transition-property: transform;
216
+ transition: var(--tct-pill-btn-tween, var(--t-pill-btn-tween, var(--app-tween-1, 0.2s ease)));
217
+ }
218
+
219
+ div.btn-close {
220
+ pointer-events: none;
221
+ }
222
+ :host([open]) div.btn-close q2-icon {
223
+ transform: rotate(180deg);
224
+ }
225
+
226
+ :host([active]) button.btn-close:focus, :host([active]) button.btn-close:hover {
227
+ background: var(--tct-pill-hover-close-btn-background, var(--t-pill-hover-close-btn-background, var(--t-top-a1, rgba(13, 13, 13, 0.35))));
228
+ border-color: var(--tct-pill-hover-close-btn-border-color, var(--t-pill-hover-close-btn-border-color, var(--t-top-a1, rgba(13, 13, 13, 0.35))));
229
+ }
@@ -5,11 +5,19 @@ export class Q2Radio {
5
5
  this.disabled = false;
6
6
  this.checked = false;
7
7
  this.groupDisabled = false;
8
+ this.groupReadonly = false;
8
9
  this.groupTileLayout = false;
9
10
  this.id = `radio-${createGuid()}`;
11
+ this.isLoaded = false;
10
12
  this.inputChange = (event) => {
11
13
  event.stopPropagation();
12
- this.change.emit({ value: this.value });
14
+ if (this.groupReadonly) {
15
+ event.preventDefault();
16
+ return false;
17
+ }
18
+ if (event.target instanceof HTMLInputElement) {
19
+ this.checked = event.target.checked;
20
+ }
13
21
  };
14
22
  }
15
23
  ////////// LIFECYCLE HOOKS ////////
@@ -17,12 +25,20 @@ export class Q2Radio {
17
25
  handleAriaLabel(this);
18
26
  }
19
27
  componentDidLoad() {
28
+ this.isLoaded = true;
20
29
  overrideFocus(this.hostElement);
21
30
  }
22
31
  ////////// OBSERVERS //////////
23
32
  ariaLabelObserver() {
24
33
  handleAriaLabel(this);
25
34
  }
35
+ checkedObserver() {
36
+ if (!this.isLoaded)
37
+ return;
38
+ if (!this.checked)
39
+ return;
40
+ this.change.emit({ value: this.value });
41
+ }
26
42
  /////// HOST ELEMENT EVENTS ///////
27
43
  onHostClick(event) {
28
44
  if (this.disabled) {
@@ -193,6 +209,24 @@ export class Q2Radio {
193
209
  "reflect": false,
194
210
  "defaultValue": "false"
195
211
  },
212
+ "groupReadonly": {
213
+ "type": "boolean",
214
+ "mutable": false,
215
+ "complexType": {
216
+ "original": "boolean",
217
+ "resolved": "boolean",
218
+ "references": {}
219
+ },
220
+ "required": false,
221
+ "optional": false,
222
+ "docs": {
223
+ "tags": [],
224
+ "text": ""
225
+ },
226
+ "attribute": "group-readonly",
227
+ "reflect": false,
228
+ "defaultValue": "false"
229
+ },
196
230
  "groupTileLayout": {
197
231
  "type": "boolean",
198
232
  "mutable": false,
@@ -232,6 +266,9 @@ export class Q2Radio {
232
266
  static get watchers() { return [{
233
267
  "propName": "ariaLabel",
234
268
  "methodName": "ariaLabelObserver"
269
+ }, {
270
+ "propName": "checked",
271
+ "methodName": "checkedObserver"
235
272
  }]; }
236
273
  static get listeners() { return [{
237
274
  "name": "click",