@dso-toolkit/core 56.0.0 → 57.0.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 (152) hide show
  1. package/dist/cjs/dso-accordion-section.cjs.entry.js +1 -1
  2. package/dist/cjs/dso-accordion-section.cjs.entry.js.map +1 -1
  3. package/dist/cjs/dso-alert_5.cjs.entry.js +34 -32
  4. package/dist/cjs/dso-alert_5.cjs.entry.js.map +1 -1
  5. package/dist/cjs/dso-expandable.cjs.entry.js +1 -1
  6. package/dist/cjs/dso-expandable.cjs.entry.js.map +1 -1
  7. package/dist/cjs/dso-header.cjs.entry.js +1 -1
  8. package/dist/cjs/dso-header.cjs.entry.js.map +1 -1
  9. package/dist/cjs/dso-helpcenter-panel.cjs.entry.js +1 -1
  10. package/dist/cjs/dso-helpcenter-panel.cjs.entry.js.map +1 -1
  11. package/dist/cjs/dso-image-overlay.cjs.entry.js +1 -1
  12. package/dist/cjs/dso-image-overlay.cjs.entry.js.map +1 -1
  13. package/dist/cjs/dso-info-button.cjs.entry.js +1 -1
  14. package/dist/cjs/dso-info-button.cjs.entry.js.map +1 -1
  15. package/dist/cjs/dso-list-button.cjs.entry.js +2 -2
  16. package/dist/cjs/dso-list-button.cjs.entry.js.map +1 -1
  17. package/dist/cjs/dso-map-controls.cjs.entry.js +1 -1
  18. package/dist/cjs/dso-map-controls.cjs.entry.js.map +1 -1
  19. package/dist/cjs/dso-modal.cjs.entry.js +1 -1
  20. package/dist/cjs/dso-modal.cjs.entry.js.map +1 -1
  21. package/dist/cjs/dso-table.cjs.entry.js +1 -1
  22. package/dist/cjs/dso-table.cjs.entry.js.map +1 -1
  23. package/dist/cjs/dso-toolkit.cjs.js +1 -1
  24. package/dist/cjs/dso-viewer-grid.cjs.entry.js +2 -2
  25. package/dist/cjs/dso-viewer-grid.cjs.entry.js.map +1 -1
  26. package/dist/cjs/loader.cjs.js +1 -1
  27. package/dist/collection/components/accordion/accordion.interfaces.js.map +1 -1
  28. package/dist/collection/components/accordion/accordion.js +1 -1
  29. package/dist/collection/components/accordion/components/accordion-section.css +97 -32
  30. package/dist/collection/components/accordion/components/accordion-section.interfaces.js.map +1 -1
  31. package/dist/collection/components/accordion/components/accordion-section.js +3 -3
  32. package/dist/collection/components/accordion/components/accordion-section.js.map +1 -1
  33. package/dist/collection/components/annotation-button/annotation-button.css +59 -383
  34. package/dist/collection/components/annotation-button/annotation-button.js +1 -1
  35. package/dist/collection/components/annotation-output/annotation-output.js +1 -1
  36. package/dist/collection/components/expandable/expandable.js +2 -2
  37. package/dist/collection/components/expandable/expandable.js.map +1 -1
  38. package/dist/collection/components/header/header.css +3 -3
  39. package/dist/collection/components/helpcenter-panel/helpcenter-panel.css +12 -12
  40. package/dist/collection/components/image-overlay/image-overlay.css +14 -14
  41. package/dist/collection/components/info-button/info-button.js +1 -1
  42. package/dist/collection/components/info-button/info-button.js.map +1 -1
  43. package/dist/collection/components/label/label.js +42 -33
  44. package/dist/collection/components/label/label.js.map +1 -1
  45. package/dist/collection/components/list-button/list-button.css +29 -23
  46. package/dist/collection/components/list-button/list-button.js +1 -1
  47. package/dist/collection/components/list-button/list-button.js.map +1 -1
  48. package/dist/collection/components/map-controls/map-controls.css +21 -15
  49. package/dist/collection/components/modal/modal.css +6 -8
  50. package/dist/collection/components/ozon-content/ozon-content.css +7 -1
  51. package/dist/collection/components/table/table.css +13 -9
  52. package/dist/collection/components/viewer-grid/viewer-grid.css +30 -22
  53. package/dist/collection/components/viewer-grid/viewer-grid.js +1 -1
  54. package/dist/collection/components/viewer-grid/viewer-grid.js.map +1 -1
  55. package/dist/components/annotation-button.js +1 -1
  56. package/dist/components/annotation-button.js.map +1 -1
  57. package/dist/components/dso-accordion-section.js +1 -1
  58. package/dist/components/dso-accordion-section.js.map +1 -1
  59. package/dist/components/dso-header.js +1 -1
  60. package/dist/components/dso-header.js.map +1 -1
  61. package/dist/components/dso-helpcenter-panel.js +1 -1
  62. package/dist/components/dso-helpcenter-panel.js.map +1 -1
  63. package/dist/components/dso-image-overlay.js +1 -1
  64. package/dist/components/dso-image-overlay.js.map +1 -1
  65. package/dist/components/dso-list-button.js +2 -2
  66. package/dist/components/dso-list-button.js.map +1 -1
  67. package/dist/components/dso-map-controls.js +1 -1
  68. package/dist/components/dso-map-controls.js.map +1 -1
  69. package/dist/components/dso-modal.js +1 -1
  70. package/dist/components/dso-modal.js.map +1 -1
  71. package/dist/components/dso-table.js +1 -1
  72. package/dist/components/dso-table.js.map +1 -1
  73. package/dist/components/dso-viewer-grid.js +2 -2
  74. package/dist/components/dso-viewer-grid.js.map +1 -1
  75. package/dist/components/expandable.js +1 -1
  76. package/dist/components/expandable.js.map +1 -1
  77. package/dist/components/info-button.js +1 -1
  78. package/dist/components/info-button.js.map +1 -1
  79. package/dist/components/label.js +33 -31
  80. package/dist/components/label.js.map +1 -1
  81. package/dist/components/ozon-content.js +1 -1
  82. package/dist/components/ozon-content.js.map +1 -1
  83. package/dist/dso-toolkit/dso-toolkit.esm.js +1 -1
  84. package/dist/dso-toolkit/dso-toolkit.esm.js.map +1 -1
  85. package/dist/dso-toolkit/p-04c97d7d.entry.js +2 -0
  86. package/dist/dso-toolkit/{p-909ccf98.entry.js.map → p-04c97d7d.entry.js.map} +1 -1
  87. package/dist/dso-toolkit/p-1c295ae2.entry.js +2 -0
  88. package/dist/dso-toolkit/p-1c295ae2.entry.js.map +1 -0
  89. package/dist/dso-toolkit/p-1fe715e4.entry.js +2 -0
  90. package/dist/dso-toolkit/{p-422bcf93.entry.js.map → p-1fe715e4.entry.js.map} +1 -1
  91. package/dist/dso-toolkit/p-27dfadbf.entry.js +2 -0
  92. package/dist/dso-toolkit/{p-b627d9ac.entry.js.map → p-27dfadbf.entry.js.map} +1 -1
  93. package/dist/dso-toolkit/p-70a28e3f.entry.js +2 -0
  94. package/dist/dso-toolkit/{p-9c0477fc.entry.js.map → p-70a28e3f.entry.js.map} +1 -1
  95. package/dist/dso-toolkit/p-b608283b.entry.js +2 -0
  96. package/dist/dso-toolkit/{p-29752a45.entry.js.map → p-b608283b.entry.js.map} +1 -1
  97. package/dist/dso-toolkit/p-e26974ee.entry.js +2 -0
  98. package/dist/dso-toolkit/p-e26974ee.entry.js.map +1 -0
  99. package/dist/dso-toolkit/p-e2cacb8b.entry.js +2 -0
  100. package/dist/dso-toolkit/{p-484ea1d2.entry.js.map → p-e2cacb8b.entry.js.map} +1 -1
  101. package/dist/dso-toolkit/p-e4553695.entry.js +2 -0
  102. package/dist/dso-toolkit/{p-1cc75e0b.entry.js.map → p-e4553695.entry.js.map} +1 -1
  103. package/dist/dso-toolkit/{p-674e2406.entry.js → p-e86e0fce.entry.js} +2 -2
  104. package/dist/dso-toolkit/p-e86e0fce.entry.js.map +1 -0
  105. package/dist/dso-toolkit/{p-83cdfde8.entry.js → p-f3ed8688.entry.js} +2 -2
  106. package/dist/dso-toolkit/{p-83cdfde8.entry.js.map → p-f3ed8688.entry.js.map} +1 -1
  107. package/dist/dso-toolkit/{p-ec4b568d.entry.js → p-f56c1b28.entry.js} +2 -2
  108. package/dist/dso-toolkit/{p-ec4b568d.entry.js.map → p-f56c1b28.entry.js.map} +1 -1
  109. package/dist/esm/dso-accordion-section.entry.js +1 -1
  110. package/dist/esm/dso-accordion-section.entry.js.map +1 -1
  111. package/dist/esm/dso-alert_5.entry.js +34 -32
  112. package/dist/esm/dso-alert_5.entry.js.map +1 -1
  113. package/dist/esm/dso-expandable.entry.js +1 -1
  114. package/dist/esm/dso-expandable.entry.js.map +1 -1
  115. package/dist/esm/dso-header.entry.js +1 -1
  116. package/dist/esm/dso-header.entry.js.map +1 -1
  117. package/dist/esm/dso-helpcenter-panel.entry.js +1 -1
  118. package/dist/esm/dso-helpcenter-panel.entry.js.map +1 -1
  119. package/dist/esm/dso-image-overlay.entry.js +1 -1
  120. package/dist/esm/dso-image-overlay.entry.js.map +1 -1
  121. package/dist/esm/dso-info-button.entry.js +1 -1
  122. package/dist/esm/dso-info-button.entry.js.map +1 -1
  123. package/dist/esm/dso-list-button.entry.js +2 -2
  124. package/dist/esm/dso-list-button.entry.js.map +1 -1
  125. package/dist/esm/dso-map-controls.entry.js +1 -1
  126. package/dist/esm/dso-map-controls.entry.js.map +1 -1
  127. package/dist/esm/dso-modal.entry.js +1 -1
  128. package/dist/esm/dso-modal.entry.js.map +1 -1
  129. package/dist/esm/dso-table.entry.js +1 -1
  130. package/dist/esm/dso-table.entry.js.map +1 -1
  131. package/dist/esm/dso-toolkit.js +1 -1
  132. package/dist/esm/dso-viewer-grid.entry.js +2 -2
  133. package/dist/esm/dso-viewer-grid.entry.js.map +1 -1
  134. package/dist/esm/loader.js +1 -1
  135. package/dist/types/components/accordion/accordion.interfaces.d.ts +1 -23
  136. package/dist/types/components/accordion/components/accordion-section.d.ts +1 -2
  137. package/dist/types/components/accordion/components/accordion-section.interfaces.d.ts +22 -0
  138. package/dist/types/components/label/label.d.ts +9 -9
  139. package/dist/types/components.d.ts +4 -4
  140. package/package.json +2 -2
  141. package/dist/dso-toolkit/p-1cc75e0b.entry.js +0 -2
  142. package/dist/dso-toolkit/p-29752a45.entry.js +0 -2
  143. package/dist/dso-toolkit/p-39f6447d.entry.js +0 -2
  144. package/dist/dso-toolkit/p-39f6447d.entry.js.map +0 -1
  145. package/dist/dso-toolkit/p-3c554a18.entry.js +0 -2
  146. package/dist/dso-toolkit/p-3c554a18.entry.js.map +0 -1
  147. package/dist/dso-toolkit/p-422bcf93.entry.js +0 -2
  148. package/dist/dso-toolkit/p-484ea1d2.entry.js +0 -2
  149. package/dist/dso-toolkit/p-674e2406.entry.js.map +0 -1
  150. package/dist/dso-toolkit/p-909ccf98.entry.js +0 -2
  151. package/dist/dso-toolkit/p-9c0477fc.entry.js +0 -2
  152. package/dist/dso-toolkit/p-b627d9ac.entry.js +0 -2
@@ -144,21 +144,21 @@ dso-dropdown-menu .dso-dropdown-options ul li + li {
144
144
  right: 0;
145
145
  top: 100%;
146
146
  }
147
- .dropdown dso-dropdown-menu button {
147
+ .dropdown dso-dropdown-menu > button {
148
148
  color: #39870c;
149
149
  font-size: 16px;
150
150
  font-weight: 600;
151
151
  line-height: normal;
152
152
  position: relative;
153
153
  }
154
- .dropdown dso-dropdown-menu button::after {
154
+ .dropdown dso-dropdown-menu > button::after {
155
155
  margin-left: 8px;
156
156
  position: absolute;
157
157
  right: 0px;
158
158
  top: 50%;
159
159
  transform: translateY(-50%);
160
160
  }
161
- .dropdown dso-dropdown-menu button:hover, .dropdown dso-dropdown-menu button:active {
161
+ .dropdown dso-dropdown-menu > button:hover, .dropdown dso-dropdown-menu > button:active {
162
162
  cursor: pointer;
163
163
  text-decoration: underline;
164
164
  }
@@ -79,19 +79,19 @@
79
79
  border-color: #afcf9d;
80
80
  color: #fff;
81
81
  }
82
- .open-button.btn-sm {
82
+ .open-button.dso-small {
83
83
  line-height: 1rem;
84
84
  }
85
- .open-button.btn-sm dso-icon,
86
- .open-button.btn-sm svg.di, .open-button.btn-sm.extern::after, .open-button.btn-sm.download::after, .open-button.btn-sm.dso-spinner::before {
85
+ .open-button.dso-small dso-icon,
86
+ .open-button.dso-small svg.di, .open-button.dso-small.extern::after, .open-button.dso-small.download::after, .open-button.dso-small.dso-spinner::before {
87
87
  margin-bottom: -4px;
88
88
  margin-top: -4px;
89
89
  }
90
- .open-button.btn-sm.dso-spinner-left::before {
90
+ .open-button.dso-small.dso-spinner-left::before {
91
91
  height: 16px;
92
92
  width: 16px;
93
93
  }
94
- .open-button.btn-sm.dso-spinner-right::after {
94
+ .open-button.dso-small.dso-spinner-right::after {
95
95
  height: 16px;
96
96
  width: 16px;
97
97
  }
@@ -188,19 +188,19 @@
188
188
  border-color: #afcf9d;
189
189
  color: #afcf9d;
190
190
  }
191
- .close-button.btn-sm {
191
+ .close-button.dso-small {
192
192
  line-height: 1rem;
193
193
  }
194
- .close-button.btn-sm dso-icon,
195
- .close-button.btn-sm svg.di, .close-button.btn-sm.extern::after, .close-button.btn-sm.download::after, .close-button.btn-sm.dso-spinner::before {
194
+ .close-button.dso-small dso-icon,
195
+ .close-button.dso-small svg.di, .close-button.dso-small.extern::after, .close-button.dso-small.download::after, .close-button.dso-small.dso-spinner::before {
196
196
  margin-bottom: -4px;
197
197
  margin-top: -4px;
198
198
  }
199
- .close-button.btn-sm.dso-spinner-left::before {
199
+ .close-button.dso-small.dso-spinner-left::before {
200
200
  height: 16px;
201
201
  width: 16px;
202
202
  }
203
- .close-button.btn-sm.dso-spinner-right::after {
203
+ .close-button.dso-small.dso-spinner-right::after {
204
204
  height: 16px;
205
205
  width: 16px;
206
206
  }
@@ -239,7 +239,7 @@
239
239
  width: 24px;
240
240
  margin-right: 8px;
241
241
  }
242
- .close-button.dso-spinner-left:not([disabled]).btn-sm:hover::before {
242
+ .close-button.dso-spinner-left:not([disabled]).dso-small:hover::before {
243
243
  height: 16px;
244
244
  width: 16px;
245
245
  }
@@ -263,7 +263,7 @@
263
263
  width: 24px;
264
264
  margin-left: 8px;
265
265
  }
266
- .close-button.dso-spinner-right:not([disabled]).btn-sm:hover::after {
266
+ .close-button.dso-spinner-right:not([disabled]).dso-small:hover::after {
267
267
  height: 16px;
268
268
  width: 16px;
269
269
  }
@@ -77,19 +77,19 @@ button::-moz-focus-inner {
77
77
  border-color: #afcf9d;
78
78
  color: #afcf9d;
79
79
  }
80
- .open.btn-sm {
80
+ .open.dso-small {
81
81
  line-height: 1rem;
82
82
  }
83
- .open.btn-sm dso-icon,
84
- .open.btn-sm svg.di, .open.btn-sm.extern::after, .open.btn-sm.download::after, .open.btn-sm.dso-spinner::before {
83
+ .open.dso-small dso-icon,
84
+ .open.dso-small svg.di, .open.dso-small.extern::after, .open.dso-small.download::after, .open.dso-small.dso-spinner::before {
85
85
  margin-bottom: -4px;
86
86
  margin-top: -4px;
87
87
  }
88
- .open.btn-sm.dso-spinner-left::before {
88
+ .open.dso-small.dso-spinner-left::before {
89
89
  height: 16px;
90
90
  width: 16px;
91
91
  }
92
- .open.btn-sm.dso-spinner-right::after {
92
+ .open.dso-small.dso-spinner-right::after {
93
93
  height: 16px;
94
94
  width: 16px;
95
95
  }
@@ -128,7 +128,7 @@ button::-moz-focus-inner {
128
128
  width: 24px;
129
129
  margin-right: 8px;
130
130
  }
131
- .open.dso-spinner-left:not([disabled]).btn-sm:hover::before {
131
+ .open.dso-spinner-left:not([disabled]).dso-small:hover::before {
132
132
  height: 16px;
133
133
  width: 16px;
134
134
  }
@@ -152,7 +152,7 @@ button::-moz-focus-inner {
152
152
  width: 24px;
153
153
  margin-left: 8px;
154
154
  }
155
- .open.dso-spinner-right:not([disabled]).btn-sm:hover::after {
155
+ .open.dso-spinner-right:not([disabled]).dso-small:hover::after {
156
156
  height: 16px;
157
157
  width: 16px;
158
158
  }
@@ -247,19 +247,19 @@ button::-moz-focus-inner {
247
247
  border-color: #afcf9d;
248
248
  color: #afcf9d;
249
249
  }
250
- .close.btn-sm {
250
+ .close.dso-small {
251
251
  line-height: 1rem;
252
252
  }
253
- .close.btn-sm dso-icon,
254
- .close.btn-sm svg.di, .close.btn-sm.extern::after, .close.btn-sm.download::after, .close.btn-sm.dso-spinner::before {
253
+ .close.dso-small dso-icon,
254
+ .close.dso-small svg.di, .close.dso-small.extern::after, .close.dso-small.download::after, .close.dso-small.dso-spinner::before {
255
255
  margin-bottom: -4px;
256
256
  margin-top: -4px;
257
257
  }
258
- .close.btn-sm.dso-spinner-left::before {
258
+ .close.dso-small.dso-spinner-left::before {
259
259
  height: 16px;
260
260
  width: 16px;
261
261
  }
262
- .close.btn-sm.dso-spinner-right::after {
262
+ .close.dso-small.dso-spinner-right::after {
263
263
  height: 16px;
264
264
  width: 16px;
265
265
  }
@@ -298,7 +298,7 @@ button::-moz-focus-inner {
298
298
  width: 24px;
299
299
  margin-right: 8px;
300
300
  }
301
- .close.dso-spinner-left:not([disabled]).btn-sm:hover::before {
301
+ .close.dso-spinner-left:not([disabled]).dso-small:hover::before {
302
302
  height: 16px;
303
303
  width: 16px;
304
304
  }
@@ -322,7 +322,7 @@ button::-moz-focus-inner {
322
322
  width: 24px;
323
323
  margin-left: 8px;
324
324
  }
325
- .close.dso-spinner-right:not([disabled]).btn-sm:hover::after {
325
+ .close.dso-spinner-right:not([disabled]).dso-small:hover::after {
326
326
  height: 16px;
327
327
  width: 16px;
328
328
  }
@@ -19,7 +19,7 @@ export class InfoButton {
19
19
  this.dsoToggle.emit({ originalEvent: e, active: this.active });
20
20
  }
21
21
  render() {
22
- return (h(Host, { onMouseenter: () => (this.hover = true), onMouseleave: () => (this.hover = false) }, h("button", { type: "button", class: clsx("btn", { "dso-open": !!this.active, "dso-info-secondary": !!this.secondary }), "aria-expanded": typeof this.active === "boolean" ? this.active.toString() : undefined, onClick: (e) => this.handleToggle(e), ref: (element) => (this.button = element) }, h("dso-icon", { icon: this.active || this.hover ? "info-active" : "info" }), h("span", { class: "sr-only" }, this.label))));
22
+ return (h(Host, { onMouseenter: () => (this.hover = true), onMouseleave: () => (this.hover = false) }, h("button", { type: "button", class: clsx({ "dso-open": !!this.active, "dso-info-secondary": !!this.secondary }), "aria-expanded": typeof this.active === "boolean" ? this.active.toString() : undefined, onClick: (e) => this.handleToggle(e), ref: (element) => (this.button = element) }, h("dso-icon", { icon: this.active || this.hover ? "info-active" : "info" }), h("span", { class: "sr-only" }, this.label))));
23
23
  }
24
24
  static get is() { return "dso-info-button"; }
25
25
  static get encapsulation() { return "shadow"; }
@@ -1 +1 @@
1
- {"version":3,"file":"info-button.js","sourceRoot":"","sources":["../../../src/components/info-button/info-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAgB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC7F,OAAO,IAAI,MAAM,MAAM,CAAC;AASxB,MAAM,OAAO,UAAU;;;iBAUb,KAAK;;iBAYL,uBAAuB;;EAQ/B;;KAEG;EAEH,KAAK,CAAC,QAAQ;;IACZ,MAAA,IAAI,CAAC,MAAM,0CAAE,KA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { h, Component, Event, Prop, EventEmitter, Method, Host, State } from \"@stencil/core\";\r\nimport clsx from \"clsx\";\r\n\r\nimport { InfoButtonToggleEvent } from \"./info-button.interfaces\";\r\n\r\n@Component({\r\n tag: \"dso-info-button\",\r\n shadow: true,\r\n styleUrl: \"info-button.scss\",\r\n})\r\nexport class InfoButton {\r\n private button?: HTMLButtonElement;\r\n\r\n /**\r\n * Whether the InfoButton is active.\r\n */\r\n @Prop({ mutable: true, reflect: true })\r\n active?: boolean;\r\n\r\n @State()\r\n hover = false;\r\n\r\n /**\r\n * For secondary Info Button.\r\n */\r\n @Prop()\r\n secondary?: boolean;\r\n\r\n /**\r\n * The label.\r\n */\r\n @Prop()\r\n label = \"Toelichting bij optie\";\r\n\r\n /**\r\n * Emitted when the user activates the Info Button.\r\n */\r\n @Event()\r\n dsoToggle!: EventEmitter<InfoButtonToggleEvent>;\r\n\r\n /**\r\n * To set focus to the toggle button.\r\n */\r\n @Method()\r\n async setFocus() {\r\n this.button?.focus();\r\n }\r\n\r\n private handleToggle(e: MouseEvent) {\r\n this.active = !this.active;\r\n this.dsoToggle.emit({ originalEvent: e, active: this.active });\r\n }\r\n\r\n render() {\r\n return (\r\n <Host onMouseenter={() => (this.hover = true)} onMouseleave={() => (this.hover = false)}>\r\n <button\r\n type=\"button\"\r\n class={clsx(\"btn\", { \"dso-open\": !!this.active, \"dso-info-secondary\": !!this.secondary })}\r\n aria-expanded={typeof this.active === \"boolean\" ? this.active.toString() : undefined}\r\n onClick={(e) => this.handleToggle(e)}\r\n ref={(element) => (this.button = element)}\r\n >\r\n <dso-icon icon={this.active || this.hover ? \"info-active\" : \"info\"}></dso-icon>\r\n <span class=\"sr-only\">{this.label}</span>\r\n </button>\r\n </Host>\r\n );\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"info-button.js","sourceRoot":"","sources":["../../../src/components/info-button/info-button.tsx"],"names":[],"mappings":"AAA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AI,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,GAAa;QAC/E,YAAM,KAAK,EAAC,SAAS,IAAE,IAAI,CAAC,KAAK,CAAQ,CAClC,CACJ,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { h, Component, Event, Prop, EventEmitter, Method, Host, State } from \"@stencil/core\";\r\nimport clsx from \"clsx\";\r\n\r\nimport { InfoButtonToggleEvent } from \"./info-button.interfaces\";\r\n\r\n@Component({\r\n tag: \"dso-info-button\",\r\n shadow: true,\r\n styleUrl: \"info-button.scss\",\r\n})\r\nexport class InfoButton {\r\n private button?: HTMLButtonElement;\r\n\r\n /**\r\n * Whether the InfoButton is active.\r\n */\r\n @Prop({ mutable: true, reflect: true })\r\n active?: boolean;\r\n\r\n @State()\r\n hover = false;\r\n\r\n /**\r\n * For secondary Info Button.\r\n */\r\n @Prop()\r\n secondary?: boolean;\r\n\r\n /**\r\n * The label.\r\n */\r\n @Prop()\r\n label = \"Toelichting bij optie\";\r\n\r\n /**\r\n * Emitted when the user activates the Info Button.\r\n */\r\n @Event()\r\n dsoToggle!: EventEmitter<InfoButtonToggleEvent>;\r\n\r\n /**\r\n * To set focus to the toggle button.\r\n */\r\n @Method()\r\n async setFocus() {\r\n this.button?.focus();\r\n }\r\n\r\n private handleToggle(e: MouseEvent) {\r\n this.active = !this.active;\r\n this.dsoToggle.emit({ originalEvent: e, active: this.active });\r\n }\r\n\r\n render() {\r\n return (\r\n <Host onMouseenter={() => (this.hover = true)} onMouseleave={() => (this.hover = false)}>\r\n <button\r\n type=\"button\"\r\n class={clsx({ \"dso-open\": !!this.active, \"dso-info-secondary\": !!this.secondary })}\r\n aria-expanded={typeof this.active === \"boolean\" ? this.active.toString() : undefined}\r\n onClick={(e) => this.handleToggle(e)}\r\n ref={(element) => (this.button = element)}\r\n >\r\n <dso-icon icon={this.active || this.hover ? \"info-active\" : \"info\"}></dso-icon>\r\n <span class=\"sr-only\">{this.label}</span>\r\n </button>\r\n </Host>\r\n );\r\n }\r\n}\r\n"]}
@@ -16,13 +16,6 @@ function hasEllipses(el) {
16
16
  }
17
17
  export class Label {
18
18
  constructor() {
19
- this.keydownListenerActive = false;
20
- this.keyDownListener = (event) => {
21
- if (event.key === "Escape") {
22
- this.textHover = false;
23
- this.textFocus = false;
24
- }
25
- };
26
19
  this.compact = undefined;
27
20
  this.removable = undefined;
28
21
  this.status = undefined;
@@ -31,8 +24,16 @@ export class Label {
31
24
  this.truncate = undefined;
32
25
  this.textHover = undefined;
33
26
  this.textFocus = undefined;
34
- this.isTruncated = undefined;
35
- this.labelText = null;
27
+ this.isTruncated = false;
28
+ this.labelText = "";
29
+ }
30
+ watchRemovable(removable) {
31
+ if (removable) {
32
+ this.startMutationObserver();
33
+ }
34
+ else {
35
+ this.stopMutationObserver();
36
+ }
36
37
  }
37
38
  watchTruncate(truncate) {
38
39
  if (truncate) {
@@ -42,14 +43,10 @@ export class Label {
42
43
  this.stopTruncate();
43
44
  }
44
45
  }
45
- watchTooltipActive() {
46
- if (!this.keydownListenerActive && (this.textHover || this.textFocus)) {
47
- document.addEventListener("keydown", this.keyDownListener);
48
- this.keydownListenerActive = true;
49
- }
50
- if (!this.textHover && !this.textFocus) {
51
- document.removeEventListener("keydown", this.keyDownListener);
52
- this.keydownListenerActive = false;
46
+ keyDownListener(event) {
47
+ if (event.key === "Escape") {
48
+ this.textHover = false;
49
+ this.textFocus = false;
53
50
  }
54
51
  }
55
52
  /**
@@ -57,11 +54,12 @@ export class Label {
57
54
  */
58
55
  async _truncateLabel() {
59
56
  setTimeout(() => {
60
- this.isTruncated = this.labelContent && hasEllipses(this.labelContent);
57
+ this.isTruncated = !!this.labelContent && hasEllipses(this.labelContent);
61
58
  });
62
59
  }
63
60
  syncLabelText() {
64
- this.labelText = this.host.textContent;
61
+ var _a, _b;
62
+ this.labelText = (_b = (_a = this.host.textContent) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : "";
65
63
  }
66
64
  componentDidLoad() {
67
65
  if (this.truncate) {
@@ -73,19 +71,25 @@ export class Label {
73
71
  }
74
72
  disconnectedCallback() {
75
73
  this.stopTruncate();
74
+ this.stopMutationObserver(true);
76
75
  }
77
76
  /** The mutationObserver fetches the text placed inside the label, this is then used for the remove button and tooltip. */
78
77
  startMutationObserver() {
79
- if (this.mutationObserver) {
80
- return;
81
- }
82
- this.mutationObserver = new MutationObserver((entries) => entries.forEach(() => this.syncLabelText()));
78
+ this.mutationObserver = new MutationObserver(() => this.syncLabelText());
83
79
  this.mutationObserver.observe(this.host, {
84
80
  characterData: true,
81
+ childList: true,
85
82
  subtree: true,
86
83
  attributes: true,
87
84
  });
88
- this.labelText = this.host.textContent;
85
+ this.syncLabelText();
86
+ }
87
+ stopMutationObserver(force = false) {
88
+ var _a;
89
+ if (force || !(this.truncate && this.removable)) {
90
+ (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
91
+ delete this.mutationObserver;
92
+ }
89
93
  }
90
94
  startTruncate() {
91
95
  resizeObserver.observe(this.host);
@@ -93,10 +97,9 @@ export class Label {
93
97
  this._truncateLabel();
94
98
  }
95
99
  stopTruncate() {
96
- document.removeEventListener("keydown", this.keyDownListener);
97
100
  resizeObserver.unobserve(this.host);
98
- this.isTruncated = undefined;
99
- this.keydownListenerActive = false;
101
+ this.stopMutationObserver();
102
+ this.isTruncated = false;
100
103
  }
101
104
  render() {
102
105
  return (h(Fragment, null, h("span", { "aria-describedby": "toggle-anchor", class: clsx("dso-label", {
@@ -249,14 +252,20 @@ export class Label {
249
252
  static get elementRef() { return "host"; }
250
253
  static get watchers() {
251
254
  return [{
255
+ "propName": "removable",
256
+ "methodName": "watchRemovable"
257
+ }, {
252
258
  "propName": "truncate",
253
259
  "methodName": "watchTruncate"
254
- }, {
255
- "propName": "textHover",
256
- "methodName": "watchTooltipActive"
257
- }, {
258
- "propName": "textFocus",
259
- "methodName": "watchTooltipActive"
260
+ }];
261
+ }
262
+ static get listeners() {
263
+ return [{
264
+ "name": "keydown",
265
+ "method": "keyDownListener",
266
+ "target": "document",
267
+ "capture": false,
268
+ "passive": false
260
269
  }];
261
270
  }
262
271
  }
@@ -1 +1 @@
1
- {"version":3,"file":"label.js","sourceRoot":"","sources":["../../../src/components/label/label.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,CAAC,EACD,SAAS,EAET,OAAO,EACP,KAAK,EAEL,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,KAAK,EACL,KAAK,GACN,MAAM,eAAe,CAAC;AACvB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,MAAM,cAAc,GAAG,IAAI,cAAc,CACvC,QAAQ,CAAC,CAAC,OAAO,EAAE,EAAE;EACnB,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE;IAC7B,IAAI,mBAAmB,CAAC,MAAM,CAAC,EAAE;MAC/B,MAAM,CAAC,cAAc,EAAE,CAAC;KACzB;EACH,CAAC,CAAC,CAAC;AACL,CAAC,EAAE,GAAG,CAAC,CACR,CAAC;AAEF,SAAS,mBAAmB,CAAC,OAAgB;EAC3C,OAAO,OAAO,CAAC,OAAO,KAAK,WAAW,CAAC;AACzC,CAAC;AAED,SAAS,WAAW,CAAC,EAAe;EAClC,OAAO,EAAE,CAAC,WAAW,GAAG,EAAE,CAAC,WAAW,CAAC;AACzC,CAAC;AAOD,MAAM,OAAO,KAAK;;IAGR,0BAAqB,GAAG,KAAK,CAAC;IAyI9B,oBAAe,GAAG,CAAC,KAAoB,EAAE,EAAE;MACjD,IAAI,KAAK,CAAC,GAAG,KAAK,QAAQ,EAAE;QAC1B,IAAI,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gBAAU,IAAI,EAAC,OAAO,GAAY,CAC3B,CACV,CACI;MACN,IAAI,CAAC,WAAW,IAAI,CACnB,mBACE,SAAS,QACT,EAAE,EAAC,eAAe,EAClB,MAAM,EAAE,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,EACxC,QAAQ,EAAC,KAAK,EACd,QAAQ,EAAC,UAAU,IAElB,IAAI,CAAC,SAAS,CACH,CACf,CACQ,CACZ,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\r\n h,\r\n Component,\r\n ComponentInterface,\r\n Element,\r\n Event,\r\n EventEmitter,\r\n Fragment,\r\n Method,\r\n Prop,\r\n State,\r\n Watch,\r\n} from \"@stencil/core\";\r\nimport clsx from \"clsx\";\r\nimport { debounce } from \"debounce\";\r\n\r\nconst resizeObserver = new ResizeObserver(\r\n debounce((entries) => {\r\n entries.forEach(({ target }) => {\r\n if (isDsoLabelComponent(target)) {\r\n target._truncateLabel();\r\n }\r\n });\r\n }, 150)\r\n);\r\n\r\nfunction isDsoLabelComponent(element: Element): element is HTMLDsoLabelElement {\r\n return element.tagName === \"DSO-LABEL\";\r\n}\r\n\r\nfunction hasEllipses(el: HTMLElement): boolean {\r\n return el.scrollWidth > el.clientWidth;\r\n}\r\n\r\n@Component({\r\n tag: \"dso-label\",\r\n styleUrl: \"label.scss\",\r\n shadow: true,\r\n})\r\nexport class Label implements ComponentInterface {\r\n private labelContent: HTMLSpanElement | undefined;\r\n\r\n private keydownListenerActive = false;\r\n\r\n private mutationObserver?: MutationObserver;\r\n\r\n @Element()\r\n private host!: HTMLDsoLabelElement;\r\n\r\n /**\r\n * For compact Label\r\n */\r\n @Prop()\r\n compact?: boolean;\r\n\r\n /**\r\n * Shows a button that can be used to remove the Label.\r\n */\r\n @Prop()\r\n removable?: boolean;\r\n\r\n /**\r\n * The status of this Label.\r\n */\r\n @Prop()\r\n status?: \"primary\" | \"info\" | \"success\" | \"warning\" | \"danger\" | \"error\" | \"bright\" | \"attention\";\r\n\r\n @State()\r\n removeHover?: boolean;\r\n\r\n @State()\r\n removeFocus?: boolean;\r\n\r\n /**\r\n * Whether the Label is allowed to truncate the contents if it does not fit the container element.\r\n */\r\n @Prop()\r\n truncate?: boolean;\r\n\r\n @State()\r\n textHover?: boolean;\r\n\r\n @State()\r\n textFocus?: boolean;\r\n\r\n @State()\r\n isTruncated?: boolean;\r\n\r\n @State()\r\n labelText: string | null = null;\r\n\r\n /**\r\n * Emitted when the user activates the remove button.\r\n */\r\n @Event()\r\n dsoRemoveClick!: EventEmitter<MouseEvent>;\r\n\r\n @Watch(\"truncate\")\r\n watchTruncate(truncate: boolean) {\r\n if (truncate) {\r\n this.startTruncate();\r\n } else {\r\n this.stopTruncate();\r\n }\r\n }\r\n\r\n @Watch(\"textHover\")\r\n @Watch(\"textFocus\")\r\n watchTooltipActive() {\r\n if (!this.keydownListenerActive && (this.textHover || this.textFocus)) {\r\n document.addEventListener(\"keydown\", this.keyDownListener);\r\n this.keydownListenerActive = true;\r\n }\r\n\r\n if (!this.textHover && !this.textFocus) {\r\n document.removeEventListener(\"keydown\", this.keyDownListener);\r\n this.keydownListenerActive = false;\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n @Method()\r\n async _truncateLabel() {\r\n setTimeout(() => {\r\n this.isTruncated = this.labelContent && hasEllipses(this.labelContent);\r\n });\r\n }\r\n\r\n private syncLabelText() {\r\n this.labelText = this.host.textContent;\r\n }\r\n\r\n componentDidLoad() {\r\n if (this.truncate) {\r\n this.startTruncate();\r\n }\r\n\r\n if (this.removable) {\r\n this.startMutationObserver();\r\n }\r\n }\r\n\r\n disconnectedCallback() {\r\n this.stopTruncate();\r\n }\r\n\r\n /** The mutationObserver fetches the text placed inside the label, this is then used for the remove button and tooltip. */\r\n private startMutationObserver(): void {\r\n if (this.mutationObserver) {\r\n return;\r\n }\r\n\r\n this.mutationObserver = new MutationObserver((entries) => entries.forEach(() => this.syncLabelText()));\r\n\r\n this.mutationObserver.observe(this.host, {\r\n characterData: true,\r\n subtree: true,\r\n attributes: true,\r\n });\r\n\r\n this.labelText = this.host.textContent;\r\n }\r\n\r\n private startTruncate(): void {\r\n resizeObserver.observe(this.host);\r\n this.startMutationObserver();\r\n this._truncateLabel();\r\n }\r\n\r\n private stopTruncate(): void {\r\n document.removeEventListener(\"keydown\", this.keyDownListener);\r\n\r\n resizeObserver.unobserve(this.host);\r\n this.isTruncated = undefined;\r\n this.keydownListenerActive = false;\r\n }\r\n\r\n private keyDownListener = (event: KeyboardEvent) => {\r\n if (event.key === \"Escape\") {\r\n this.textHover = false;\r\n this.textFocus = false;\r\n }\r\n };\r\n\r\n render() {\r\n return (\r\n <Fragment>\r\n <span\r\n aria-describedby=\"toggle-anchor\"\r\n class={clsx(\"dso-label\", {\r\n [`dso-label-${this.status}`]: this.status,\r\n \"dso-compact\": this.compact && !this.removable,\r\n \"dso-hover\": this.removeHover || this.removeFocus,\r\n })}\r\n >\r\n <slot name=\"symbol\"></slot>\r\n <span\r\n class={clsx(\"dso-label-content\", {\r\n \"dso-truncate\": !!this.truncate,\r\n })}\r\n ref={(element) => (this.labelContent = element)}\r\n tabindex={this.truncate && this.isTruncated ? 0 : undefined}\r\n onMouseEnter={() => (this.textHover = true)}\r\n onMouseLeave={() => (this.textHover = false)}\r\n onFocus={() => (this.textFocus = true)}\r\n onBlur={() => (this.textFocus = false)}\r\n >\r\n <slot></slot>\r\n </span>\r\n {this.removable && (\r\n <button\r\n type=\"button\"\r\n onClick={(e) => this.dsoRemoveClick.emit(e)}\r\n onMouseEnter={() => (this.removeHover = true)}\r\n onMouseLeave={() => (this.removeHover = false)}\r\n onFocus={() => (this.removeFocus = true)}\r\n onBlur={() => (this.removeFocus = false)}\r\n >\r\n <span class=\"sr-only\">Verwijder: {this.labelText}</span>\r\n <dso-icon icon=\"times\"></dso-icon>\r\n </button>\r\n )}\r\n </span>\r\n {this.isTruncated && (\r\n <dso-tooltip\r\n stateless\r\n id=\"toggle-anchor\"\r\n active={this.textHover || this.textFocus}\r\n position=\"top\"\r\n strategy=\"absolute\"\r\n >\r\n {this.labelText}\r\n </dso-tooltip>\r\n )}\r\n </Fragment>\r\n );\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"label.js","sourceRoot":"","sources":["../../../src/components/label/label.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,CAAC,EACD,SAAS,EAET,OAAO,EACP,KAAK,EAEL,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,KAAK,EACL,KAAK,EACL,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,MAAM,cAAc,GAAG,IAAI,cAAc,CACvC,QAAQ,CAAC,CAAC,OAAO,EAAE,EAAE;EACnB,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE;IAC7B,IAAI,mBAAmB,CAAC,MAAM,CAAC,EAAE;MAC/B,MAAM,CAAC,cAAc,EAAE,CAAC;KACzB;EACH,CAAC,CAAC,CAAC;AACL,CAAC,EAAE,GAAG,CAAC,CACR,CAAC;AAEF,SAAS,mBAAmB,CAAC,OAAgB;EAC3C,OAAO,OAAO,CAAC,OAAO,KAAK,WAAW,CAAC;AACzC,CAAC;AAED,SAAS,WAAW,CAAC,EAAe;EAClC,OAAO,EAAE,CAAC,WAAW,GAAG,EAAE,CAAC,WAAW,CAAC;AACzC,CAAC;AAOD,MAAM,OAAO,KAAK;;;;;;;;;;uBAmDF,KAAK;qBAGP,EAAE;;EAGd,cAAc,CAAC,SAAkB;IAC/B,IAAI,SAAS,EAAE;MACb,IAAI,CAAC,qBAAqB,EAAE,CAAC;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EACxC,QAAQ,EAAC,KAAK,EACd,QAAQ,EAAC,UAAU,IAElB,IAAI,CAAC,SAAS,CACH,CACf,CACQ,CACZ,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\r\n h,\r\n Component,\r\n ComponentInterface,\r\n Element,\r\n Event,\r\n EventEmitter,\r\n Fragment,\r\n Method,\r\n Prop,\r\n State,\r\n Watch,\r\n Listen,\r\n} from \"@stencil/core\";\r\nimport clsx from \"clsx\";\r\nimport { debounce } from \"debounce\";\r\n\r\nconst resizeObserver = new ResizeObserver(\r\n debounce((entries) => {\r\n entries.forEach(({ target }) => {\r\n if (isDsoLabelComponent(target)) {\r\n target._truncateLabel();\r\n }\r\n });\r\n }, 150)\r\n);\r\n\r\nfunction isDsoLabelComponent(element: Element): element is HTMLDsoLabelElement {\r\n return element.tagName === \"DSO-LABEL\";\r\n}\r\n\r\nfunction hasEllipses(el: HTMLElement): boolean {\r\n return el.scrollWidth > el.clientWidth;\r\n}\r\n\r\n@Component({\r\n tag: \"dso-label\",\r\n styleUrl: \"label.scss\",\r\n shadow: true,\r\n})\r\nexport class Label implements ComponentInterface {\r\n private labelContent: HTMLSpanElement | undefined;\r\n\r\n private mutationObserver?: MutationObserver;\r\n\r\n @Element()\r\n private host!: HTMLDsoLabelElement;\r\n\r\n /**\r\n * For compact Label\r\n */\r\n @Prop()\r\n compact?: boolean;\r\n\r\n /**\r\n * Shows a button that can be used to remove the Label.\r\n */\r\n @Prop()\r\n removable?: boolean;\r\n\r\n /**\r\n * The status of this Label.\r\n */\r\n @Prop()\r\n status?: \"primary\" | \"info\" | \"success\" | \"warning\" | \"danger\" | \"error\" | \"bright\" | \"attention\";\r\n\r\n /**\r\n * Emitted when the user activates the remove button.\r\n */\r\n @Event()\r\n dsoRemoveClick!: EventEmitter<MouseEvent>;\r\n\r\n @State()\r\n removeHover?: boolean;\r\n\r\n @State()\r\n removeFocus?: boolean;\r\n\r\n /**\r\n * Whether the Label is allowed to truncate the contents if it does not fit the container element.\r\n */\r\n @Prop()\r\n truncate?: boolean;\r\n\r\n @State()\r\n textHover?: boolean;\r\n\r\n @State()\r\n textFocus?: boolean;\r\n\r\n @State()\r\n isTruncated = false;\r\n\r\n @State()\r\n labelText = \"\";\r\n\r\n @Watch(\"removable\")\r\n watchRemovable(removable: boolean) {\r\n if (removable) {\r\n this.startMutationObserver();\r\n } else {\r\n this.stopMutationObserver();\r\n }\r\n }\r\n\r\n @Watch(\"truncate\")\r\n watchTruncate(truncate: boolean) {\r\n if (truncate) {\r\n this.startTruncate();\r\n } else {\r\n this.stopTruncate();\r\n }\r\n }\r\n\r\n @Listen(\"keydown\", { target: \"document\" })\r\n keyDownListener(event: KeyboardEvent) {\r\n if (event.key === \"Escape\") {\r\n this.textHover = false;\r\n this.textFocus = false;\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n @Method()\r\n async _truncateLabel() {\r\n setTimeout(() => {\r\n this.isTruncated = !!this.labelContent && hasEllipses(this.labelContent);\r\n });\r\n }\r\n\r\n private syncLabelText() {\r\n this.labelText = this.host.textContent?.trim() ?? \"\";\r\n }\r\n\r\n componentDidLoad() {\r\n if (this.truncate) {\r\n this.startTruncate();\r\n }\r\n\r\n if (this.removable) {\r\n this.startMutationObserver();\r\n }\r\n }\r\n\r\n disconnectedCallback() {\r\n this.stopTruncate();\r\n\r\n this.stopMutationObserver(true);\r\n }\r\n\r\n /** The mutationObserver fetches the text placed inside the label, this is then used for the remove button and tooltip. */\r\n private startMutationObserver(): void {\r\n this.mutationObserver = new MutationObserver(() => this.syncLabelText());\r\n\r\n this.mutationObserver.observe(this.host, {\r\n characterData: true,\r\n childList: true,\r\n subtree: true,\r\n attributes: true,\r\n });\r\n\r\n this.syncLabelText();\r\n }\r\n\r\n private stopMutationObserver(force = false): void {\r\n if (force || !(this.truncate && this.removable)) {\r\n this.mutationObserver?.disconnect();\r\n\r\n delete this.mutationObserver;\r\n }\r\n }\r\n\r\n private startTruncate(): void {\r\n resizeObserver.observe(this.host);\r\n this.startMutationObserver();\r\n this._truncateLabel();\r\n }\r\n\r\n private stopTruncate(): void {\r\n resizeObserver.unobserve(this.host);\r\n this.stopMutationObserver();\r\n this.isTruncated = false;\r\n }\r\n\r\n render() {\r\n return (\r\n <Fragment>\r\n <span\r\n aria-describedby=\"toggle-anchor\"\r\n class={clsx(\"dso-label\", {\r\n [`dso-label-${this.status}`]: this.status,\r\n \"dso-compact\": this.compact && !this.removable,\r\n \"dso-hover\": this.removeHover || this.removeFocus,\r\n })}\r\n >\r\n <slot name=\"symbol\"></slot>\r\n <span\r\n class={clsx(\"dso-label-content\", {\r\n \"dso-truncate\": !!this.truncate,\r\n })}\r\n ref={(element) => (this.labelContent = element)}\r\n tabindex={this.truncate && this.isTruncated ? 0 : undefined}\r\n onMouseEnter={() => (this.textHover = true)}\r\n onMouseLeave={() => (this.textHover = false)}\r\n onFocus={() => (this.textFocus = true)}\r\n onBlur={() => (this.textFocus = false)}\r\n >\r\n <slot></slot>\r\n </span>\r\n {this.removable && (\r\n <button\r\n type=\"button\"\r\n onClick={(e) => this.dsoRemoveClick.emit(e)}\r\n onMouseEnter={() => (this.removeHover = true)}\r\n onMouseLeave={() => (this.removeHover = false)}\r\n onFocus={() => (this.removeFocus = true)}\r\n onBlur={() => (this.removeFocus = false)}\r\n >\r\n <span class=\"sr-only\">Verwijder: {this.labelText}</span>\r\n <dso-icon icon=\"times\"></dso-icon>\r\n </button>\r\n )}\r\n </span>\r\n {this.isTruncated && (\r\n <dso-tooltip\r\n stateless\r\n id=\"toggle-anchor\"\r\n active={this.textHover || this.textFocus}\r\n position=\"top\"\r\n strategy=\"absolute\"\r\n >\r\n {this.labelText}\r\n </dso-tooltip>\r\n )}\r\n </Fragment>\r\n );\r\n }\r\n}\r\n"]}
@@ -60,11 +60,17 @@
60
60
  .dso-tertiary:not([disabled]):active {
61
61
  color: #173521;
62
62
  }
63
- .dso-tertiary.btn-align {
63
+ .dso-tertiary.dso-align {
64
64
  line-height: calc(1.5em - 1px);
65
65
  padding: 11px 0;
66
66
  position: relative;
67
67
  }
68
+ .dso-tertiary.dso-truncate {
69
+ max-width: 100%;
70
+ overflow: hidden;
71
+ text-overflow: ellipsis;
72
+ white-space: nowrap;
73
+ }
68
74
  .dso-tertiary.dso-spinner-left::before {
69
75
  background-image: url("data:image/svg+xml,%3Csvg class='spinner' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg' %3E%3Cstyle%3E .spinner %7B animation: rotator 8s linear infinite; transform-origin: center; %7D @keyframes rotator %7B 0%25 %7B transform: rotate(0deg); %7D 100%25 %7B transform: rotate(360deg); %7D %7D .path %7B stroke-dasharray: 265; stroke-dashoffset: 0; transform-origin: center; stroke: %2339870c; animation: dash 2s ease-in-out infinite; %7D @keyframes dash %7B 0%25 %7B stroke-dashoffset: 265; %7D 50%25 %7B stroke-dashoffset: 65; transform:rotate(90deg); %7D 100%25 %7B stroke-dashoffset: 265; transform:rotate(360deg); %7D %3C/style%3E%3Ccircle class='path' fill='none' stroke-width='10' stroke-linecap='butt' cx='50' cy='50' r='45'%3E%3C/circle%3E%3C/svg%3E");
70
76
  background-repeat: no-repeat;
@@ -141,32 +147,32 @@
141
147
  -moz-appearance: textfield;
142
148
  }
143
149
 
144
- .dso-btn-group {
150
+ .dso-button-group {
145
151
  display: flex;
146
152
  flex-direction: row;
147
153
  }
148
- .dso-btn-group.dso-disabled > * {
154
+ .dso-button-group.dso-disabled > * {
149
155
  background-color: #fff;
150
156
  border-color: #e5e5e5;
151
157
  color: #666;
152
158
  pointer-events: none;
153
159
  }
154
- .dso-btn-group > * {
160
+ .dso-button-group > * {
155
161
  border-radius: 0;
156
162
  }
157
- .dso-btn-group > *:first-child {
163
+ .dso-button-group > *:first-child {
158
164
  border-radius: 4px 0 0 4px;
159
165
  }
160
- .dso-btn-group > *:not(:first-child) {
166
+ .dso-button-group > *:not(:first-child) {
161
167
  border-left-style: none !important;
162
168
  }
163
- .dso-btn-group > *:last-child {
169
+ .dso-button-group > *:last-child {
164
170
  border-radius: 0 4px 4px 0;
165
171
  }
166
- .dso-btn-group > *:only-child {
172
+ .dso-button-group > *:only-child {
167
173
  border-radius: 4px;
168
174
  }
169
- .dso-btn-group > .dso-input-number {
175
+ .dso-button-group > .dso-input-number {
170
176
  background-color: #fff;
171
177
  border-color: #ccc;
172
178
  color: #191919;
@@ -176,38 +182,38 @@
176
182
  padding: 0 16px;
177
183
  }
178
184
  @media screen and (max-width: 767px) {
179
- .dso-btn-group > .dso-input-number {
185
+ .dso-button-group > .dso-input-number {
180
186
  justify-content: center;
181
187
  }
182
188
  }
183
- .dso-btn-group > *:hover + .dso-input-number,
184
- .dso-btn-group > *:focus + .dso-input-number {
189
+ .dso-button-group > *:hover + .dso-input-number,
190
+ .dso-button-group > *:focus + .dso-input-number {
185
191
  background-color: #fff;
186
192
  border-color: #39870c;
187
193
  color: #191919;
188
194
  }
189
- .dso-btn-group > *.dso-selected + .dso-input-number {
195
+ .dso-button-group > *.dso-selected + .dso-input-number {
190
196
  background-color: #fff;
191
197
  border-color: #39870c;
192
198
  color: #191919;
193
199
  box-shadow: inset 0 -1px 0 0 #39870c, inset 0 1px 0 0 #39870c, inset -1px 0 0 0 #39870c;
194
200
  }
195
- .dso-btn-group > *:active + .dso-input-number, .dso-btn-group > *:active + .dso-input-number:hover,
196
- .dso-btn-group > *.active + .dso-input-number,
197
- .dso-btn-group > *.active + .dso-input-number:hover {
201
+ .dso-button-group > *:active + .dso-input-number, .dso-button-group > *:active + .dso-input-number:hover,
202
+ .dso-button-group > *.active + .dso-input-number,
203
+ .dso-button-group > *.active + .dso-input-number:hover {
198
204
  background-color: #fff;
199
205
  border-color: #39870c;
200
206
  color: #191919;
201
207
  }
202
- .dso-btn-group > *.disabled + .dso-input-number, .dso-btn-group > *.disabled + .dso-input-number:hover,
203
- .dso-btn-group > *[disabled] + .dso-input-number,
204
- .dso-btn-group > *[disabled] + .dso-input-number:hover {
208
+ .dso-button-group > *.disabled + .dso-input-number, .dso-button-group > *.disabled + .dso-input-number:hover,
209
+ .dso-button-group > *[disabled] + .dso-input-number,
210
+ .dso-button-group > *[disabled] + .dso-input-number:hover {
205
211
  background-color: #fff;
206
212
  border-color: #ccc;
207
213
  color: #666;
208
214
  opacity: 1;
209
215
  }
210
- .dso-btn-group .dso-list-button {
216
+ .dso-button-group .dso-list-button {
211
217
  padding-right: 15px;
212
218
  }
213
219
 
@@ -444,9 +450,9 @@
444
450
  }
445
451
 
446
452
  .dso-list-button + .dso-list-button,
447
- .dso-list-button + .dso-btn-group,
448
- .dso-btn-group + .dso-list-button,
449
- .dso-btn-group + .dso-btn-group {
453
+ .dso-list-button + .dso-button-group,
454
+ .dso-button-group + .dso-list-button,
455
+ .dso-button-group + .dso-button-group {
450
456
  margin-top: 4px;
451
457
  }
452
458
 
@@ -100,7 +100,7 @@ export class ListButton {
100
100
  render() {
101
101
  const showButtonInputs = this.manualCount === undefined;
102
102
  const selected = this.checked || (this.count !== undefined && this.count > 0);
103
- return (h("div", { class: clsx(["dso-btn-group", { "dso-disabled": this.disabled }]) }, h("div", { class: clsx(["dso-list-button", { "dso-selected": selected, "dso-single-count": this.count === 1 }]), onClick: (e) => this.handleSelectClick(e) }, h("div", { class: "dso-selectable" }, h("input", { id: "dso-list-button-checkbox", type: "checkbox", value: "list-button", name: "naam", checked: selected, disabled: this.disabled, "aria-label": this.label }), h("label", { htmlFor: "dso-list-button-checkbox" }, this.label)), this.sublabel && h("span", { class: "dso-sublabel" }, this.sublabel), h("slot", { name: "subcontent" })), this.count !== undefined && this.count > 0 && (h("div", { class: "dso-input-number" }, this.manualCount === undefined && this.count > 1 && (h("button", { type: "button", class: "dso-tertiary", disabled: this.count === Number(this.min) || this.disabled, onClick: (e) => this.stepValue(e, "decrement") }, h("dso-icon", { icon: "minus-circle" }), h("span", { class: "sr-only" }, "Aantal verlagen"))), h("div", { class: "dso-input-wrapper" }, this.manualCount === undefined && this.count > 1 && (h("input", { class: "dso-input-step-counter", type: "number", tabIndex: -1, "aria-label": "Aantal", value: this.count, readOnly: true })), h("form", { onSubmit: (e) => this.setCount(e) }, h("div", { ref: (element) => (this.manualInputWrapperElement = element) }, h("input", { class: clsx("form-control", { hidden: showButtonInputs }), type: "number", "aria-label": "Aantal", value: this.manualCount, min: this.min, max: this.max, onInput: (e) => this.handleOnChange(e) })), this.manual === true && (h("button", { class: clsx("dso-manual-input-button", { "sr-only": !showButtonInputs }), type: !showButtonInputs ? "submit" : "button", disabled: this.disabled, onClick: () => showButtonInputs && this.startManualCountInput() }, showButtonInputs ? (h("span", { class: "sr-only" }, "Handmatig aantal invullen")) : (h("span", { class: "sr-only" }, "Zet waarde")))))), showButtonInputs && (h("button", { type: "button", class: "dso-tertiary", disabled: this.count === Number(this.max) || this.disabled, onClick: (e) => this.stepValue(e, "increment") }, h("dso-icon", { icon: "plus-circle" }), h("span", { class: "sr-only" }, "Aantal verhogen")))))));
103
+ return (h("div", { class: clsx(["dso-button-group", { "dso-disabled": this.disabled }]) }, h("div", { class: clsx(["dso-list-button", { "dso-selected": selected, "dso-single-count": this.count === 1 }]), onClick: (e) => this.handleSelectClick(e) }, h("div", { class: "dso-selectable" }, h("input", { id: "dso-list-button-checkbox", type: "checkbox", value: "list-button", name: "naam", checked: selected, disabled: this.disabled, "aria-label": this.label }), h("label", { htmlFor: "dso-list-button-checkbox" }, this.label)), this.sublabel && h("span", { class: "dso-sublabel" }, this.sublabel), h("slot", { name: "subcontent" })), this.count !== undefined && this.count > 0 && (h("div", { class: "dso-input-number" }, this.manualCount === undefined && this.count > 1 && (h("button", { type: "button", class: "dso-tertiary", disabled: this.count === Number(this.min) || this.disabled, onClick: (e) => this.stepValue(e, "decrement") }, h("dso-icon", { icon: "minus-circle" }), h("span", { class: "sr-only" }, "Aantal verlagen"))), h("div", { class: "dso-input-wrapper" }, this.manualCount === undefined && this.count > 1 && (h("input", { class: "dso-input-step-counter", type: "number", tabIndex: -1, "aria-label": "Aantal", value: this.count, readOnly: true })), h("form", { onSubmit: (e) => this.setCount(e) }, h("div", { ref: (element) => (this.manualInputWrapperElement = element) }, h("input", { class: clsx("form-control", { hidden: showButtonInputs }), type: "number", "aria-label": "Aantal", value: this.manualCount, min: this.min, max: this.max, onInput: (e) => this.handleOnChange(e) })), this.manual === true && (h("button", { class: clsx("dso-manual-input-button", { "sr-only": !showButtonInputs }), type: !showButtonInputs ? "submit" : "button", disabled: this.disabled, onClick: () => showButtonInputs && this.startManualCountInput() }, showButtonInputs ? (h("span", { class: "sr-only" }, "Handmatig aantal invullen")) : (h("span", { class: "sr-only" }, "Zet waarde")))))), showButtonInputs && (h("button", { type: "button", class: "dso-tertiary", disabled: this.count === Number(this.max) || this.disabled, onClick: (e) => this.stepValue(e, "increment") }, h("dso-icon", { icon: "plus-circle" }), h("span", { class: "sr-only" }, "Aantal verhogen")))))));
104
104
  }
105
105
  static get is() { return "dso-list-button"; }
106
106
  static get encapsulation() { return "shadow"; }
@@ -1 +1 @@
1
- {"version":3,"file":"list-button.js","sourceRoot":"","sources":["../../../src/components/list-button/list-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAsB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAgB,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAG1G,OAAO,EAAE,eAAe,EAAa,MAAM,YAAY,CAAC;AACxD,OAAO,IAAI,MAAM,MAAM,CAAC;AAOxB,MAAM,OAAO,UAAU;;;;;;;;;mBA6CX,KAAK;oBAMJ,KAAK;kBAQP,IAAI;;EAiBb,mBAAmB;IACjB,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,WAAW,EAAE;MACpC,IAAI,CAAC,oBAAoB,EAAE,CAAC;KAC7B;EACH,C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ComponentInterface, h, Prop, Event, EventEmitter, State, Watch } from \"@stencil/core\";\r\nimport { ListButtonChangeEvent, ListButtonSelectedEvent } from \"./list-button.interfaces\";\r\n\r\nimport { createFocusTrap, FocusTrap } from \"focus-trap\";\r\nimport clsx from \"clsx\";\r\n\r\n@Component({\r\n tag: \"dso-list-button\",\r\n shadow: true,\r\n styleUrl: \"list-button.scss\",\r\n})\r\nexport class ListButton implements ComponentInterface {\r\n private trap?: FocusTrap;\r\n\r\n @State()\r\n private manualInputWrapperElement?: HTMLDivElement;\r\n\r\n private manualInputButtonElement?: HTMLButtonElement;\r\n\r\n @State()\r\n manualCount?: number;\r\n\r\n /**\r\n * The label of the List Button.\r\n */\r\n @Prop()\r\n label?: string;\r\n\r\n /**\r\n * The sublabel of the List Button.\r\n */\r\n @Prop()\r\n sublabel?: string;\r\n\r\n /**\r\n * When defined the count can show on the List Button.\r\n */\r\n @Prop()\r\n count?: number;\r\n\r\n /**\r\n * The minimum value.\r\n */\r\n @Prop()\r\n min?: string | number;\r\n\r\n /**\r\n * The maximum value.\r\n */\r\n @Prop()\r\n max?: string | number;\r\n\r\n /**\r\n * Whether the List Button is checked.\r\n */\r\n @Prop({ reflect: true })\r\n checked = false;\r\n\r\n /**\r\n * Whether the List Button is disabled.\r\n */\r\n @Prop({ reflect: true })\r\n disabled = false;\r\n\r\n /**\r\n * Allow user to directly input a value.\r\n *\r\n * Set to `false` to force users to use plus/minus buttons.\r\n */\r\n @Prop()\r\n manual = true;\r\n\r\n /**\r\n * Emitted when the user changes the count.\r\n */\r\n @Event()\r\n dsoCountChange!: EventEmitter<ListButtonChangeEvent>;\r\n\r\n /**\r\n * Emitted when the user activates the List Button itself.\r\n *\r\n * Does not fire when the user activates the count controls.\r\n */\r\n @Event()\r\n dsoSelectedChange!: EventEmitter<ListButtonSelectedEvent>;\r\n\r\n @Watch(\"manual\")\r\n watchManualCallback() {\r\n if (!this.manual && this.manualCount) {\r\n this.stopManualCountInput();\r\n }\r\n }\r\n\r\n componentDidRender(): void {\r\n if (this.manualCount !== undefined && this.manualInputWrapperElement && !this.trap) {\r\n this.trap = createFocusTrap(this.manualInputWrapperElement, {\r\n escapeDeactivates: true,\r\n setReturnFocus: false,\r\n\r\n clickOutsideDeactivates: (e) => {\r\n this.setCount(e);\r\n\r\n return true;\r\n },\r\n onDeactivate: () => this.stopManualCountInput(),\r\n onPostDeactivate: () => this.manualInputButtonElement?.focus(),\r\n }).activate();\r\n } else if (this.manualCount === undefined && this.trap) {\r\n this.trap?.deactivate();\r\n\r\n delete this.trap;\r\n }\r\n }\r\n\r\n disconnectedCallback(): void {\r\n this.trap?.deactivate();\r\n }\r\n\r\n private handleOnChange({ target }: Event): void {\r\n if (target instanceof HTMLInputElement) {\r\n this.manualCount = target.valueAsNumber;\r\n }\r\n }\r\n\r\n private stepValue(e: Event, direction: \"increment\" | \"decrement\"): void {\r\n if (typeof this.count === \"number\") {\r\n const newValue = direction === \"increment\" ? this.count + 1 : this.count - 1;\r\n\r\n if (this.isNewCountValid(newValue) === false) {\r\n return;\r\n }\r\n\r\n this.dsoCountChange.emit({\r\n originalEvent: e,\r\n count: newValue,\r\n });\r\n }\r\n }\r\n\r\n private setCount(e: Event): void {\r\n e.preventDefault();\r\n\r\n if (typeof this.manualCount === \"number\" && this.isNewCountValid(this.manualCount)) {\r\n this.dsoCountChange.emit({\r\n originalEvent: e,\r\n count: this.manualCount,\r\n });\r\n this.stopManualCountInput();\r\n }\r\n }\r\n\r\n private handleSelectClick(e: Event): void {\r\n e.preventDefault();\r\n\r\n if (this.count !== undefined) {\r\n this.dsoCountChange.emit({\r\n originalEvent: e,\r\n count: this.count > 0 ? 0 : 1,\r\n });\r\n\r\n return;\r\n }\r\n\r\n this.dsoSelectedChange.emit({\r\n originalEvent: e,\r\n checked: !this.checked,\r\n });\r\n }\r\n\r\n private startManualCountInput(): void {\r\n this.manualCount = this.count;\r\n }\r\n\r\n private stopManualCountInput(): void {\r\n this.manualCount = undefined;\r\n }\r\n\r\n private isNewCountValid(newValue: number): boolean {\r\n if (\r\n this.min !== undefined &&\r\n this.max !== undefined &&\r\n (newValue < Number(this.min) || newValue > Number(this.max))\r\n ) {\r\n return false;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n render() {\r\n const showButtonInputs = this.manualCount === undefined;\r\n\r\n const selected = this.checked || (this.count !== undefined && this.count > 0);\r\n\r\n return (\r\n <div class={clsx([\"dso-btn-group\", { \"dso-disabled\": this.disabled }])}>\r\n <div\r\n class={clsx([\"dso-list-button\", { \"dso-selected\": selected, \"dso-single-count\": this.count === 1 }])}\r\n onClick={(e) => this.handleSelectClick(e)}\r\n >\r\n <div class=\"dso-selectable\">\r\n <input\r\n id=\"dso-list-button-checkbox\"\r\n type=\"checkbox\"\r\n value=\"list-button\"\r\n name=\"naam\"\r\n checked={selected}\r\n disabled={this.disabled}\r\n aria-label={this.label}\r\n />\r\n <label htmlFor=\"dso-list-button-checkbox\">{this.label}</label>\r\n </div>\r\n {this.sublabel && <span class=\"dso-sublabel\">{this.sublabel}</span>}\r\n <slot name=\"subcontent\" />\r\n </div>\r\n\r\n {this.count !== undefined && this.count > 0 && (\r\n <div class=\"dso-input-number\">\r\n {this.manualCount === undefined && this.count > 1 && (\r\n <button\r\n type=\"button\"\r\n class=\"dso-tertiary\"\r\n disabled={this.count === Number(this.min) || this.disabled}\r\n onClick={(e) => this.stepValue(e, \"decrement\")}\r\n >\r\n <dso-icon icon=\"minus-circle\"></dso-icon>\r\n <span class=\"sr-only\">Aantal verlagen</span>\r\n </button>\r\n )}\r\n\r\n <div class=\"dso-input-wrapper\">\r\n {this.manualCount === undefined && this.count > 1 && (\r\n <input\r\n class=\"dso-input-step-counter\"\r\n type=\"number\"\r\n tabIndex={-1}\r\n aria-label=\"Aantal\"\r\n value={this.count}\r\n readOnly\r\n />\r\n )}\r\n\r\n <form onSubmit={(e) => this.setCount(e)}>\r\n <div ref={(element) => (this.manualInputWrapperElement = element)}>\r\n <input\r\n class={clsx(\"form-control\", { hidden: showButtonInputs })}\r\n type=\"number\"\r\n aria-label=\"Aantal\"\r\n value={this.manualCount}\r\n min={this.min}\r\n max={this.max}\r\n onInput={(e) => this.handleOnChange(e)}\r\n />\r\n </div>\r\n\r\n {this.manual === true && (\r\n <button\r\n class={clsx(\"dso-manual-input-button\", { \"sr-only\": !showButtonInputs })}\r\n type={!showButtonInputs ? \"submit\" : \"button\"}\r\n disabled={this.disabled}\r\n onClick={() => showButtonInputs && this.startManualCountInput()}\r\n >\r\n {showButtonInputs ? (\r\n <span class=\"sr-only\">Handmatig aantal invullen</span>\r\n ) : (\r\n <span class=\"sr-only\">Zet waarde</span>\r\n )}\r\n </button>\r\n )}\r\n </form>\r\n </div>\r\n\r\n {showButtonInputs && (\r\n <button\r\n type=\"button\"\r\n class=\"dso-tertiary\"\r\n disabled={this.count === Number(this.max) || this.disabled}\r\n onClick={(e) => this.stepValue(e, \"increment\")}\r\n >\r\n <dso-icon icon=\"plus-circle\"></dso-icon>\r\n <span class=\"sr-only\">Aantal verhogen</span>\r\n </button>\r\n )}\r\n </div>\r\n )}\r\n </div>\r\n );\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"list-button.js","sourceRoot":"","sources":["../../../src/components/list-button/list-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAsB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAgB,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAG1G,OAAO,EAAE,eAAe,EAAa,MAAM,YAAY,CAAC;AACxD,OAAO,IAAI,MAAM,MAAM,CAAC;AAOxB,MAAM,OAAO,UAAU;;;;;;;;;mBA6CX,KAAK;oBAMJ,KAAK;kBAQP,IAAI;;EAiBb,mBAAmB;IACjB,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,WAAW,EAAE;MACpC,IAAI,CAAC,oBAAoB,EAAE,CAAC;KAC7B;EACH,CAAC;EAED,kBAAkB;;IAChB,IAAI,IAAI,CAAC,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encil/core\";\r\nimport { ListButtonChangeEvent, ListButtonSelectedEvent } from \"./list-button.interfaces\";\r\n\r\nimport { createFocusTrap, FocusTrap } from \"focus-trap\";\r\nimport clsx from \"clsx\";\r\n\r\n@Component({\r\n tag: \"dso-list-button\",\r\n shadow: true,\r\n styleUrl: \"list-button.scss\",\r\n})\r\nexport class ListButton implements ComponentInterface {\r\n private trap?: FocusTrap;\r\n\r\n @State()\r\n private manualInputWrapperElement?: HTMLDivElement;\r\n\r\n private manualInputButtonElement?: HTMLButtonElement;\r\n\r\n @State()\r\n manualCount?: number;\r\n\r\n /**\r\n * The label of the List Button.\r\n */\r\n @Prop()\r\n label?: string;\r\n\r\n /**\r\n * The sublabel of the List Button.\r\n */\r\n @Prop()\r\n sublabel?: string;\r\n\r\n /**\r\n * When defined the count can show on the List Button.\r\n */\r\n @Prop()\r\n count?: number;\r\n\r\n /**\r\n * The minimum value.\r\n */\r\n @Prop()\r\n min?: string | number;\r\n\r\n /**\r\n * The maximum value.\r\n */\r\n @Prop()\r\n max?: string | number;\r\n\r\n /**\r\n * Whether the List Button is checked.\r\n */\r\n @Prop({ reflect: true })\r\n checked = false;\r\n\r\n /**\r\n * Whether the List Button is disabled.\r\n */\r\n @Prop({ reflect: true })\r\n disabled = false;\r\n\r\n /**\r\n * Allow user to directly input a value.\r\n *\r\n * Set to `false` to force users to use plus/minus buttons.\r\n */\r\n @Prop()\r\n manual = true;\r\n\r\n /**\r\n * Emitted when the user changes the count.\r\n */\r\n @Event()\r\n dsoCountChange!: EventEmitter<ListButtonChangeEvent>;\r\n\r\n /**\r\n * Emitted when the user activates the List Button itself.\r\n *\r\n * Does not fire when the user activates the count controls.\r\n */\r\n @Event()\r\n dsoSelectedChange!: EventEmitter<ListButtonSelectedEvent>;\r\n\r\n @Watch(\"manual\")\r\n watchManualCallback() {\r\n if (!this.manual && this.manualCount) {\r\n this.stopManualCountInput();\r\n }\r\n }\r\n\r\n componentDidRender(): void {\r\n if (this.manualCount !== undefined && this.manualInputWrapperElement && !this.trap) {\r\n this.trap = createFocusTrap(this.manualInputWrapperElement, {\r\n escapeDeactivates: true,\r\n setReturnFocus: false,\r\n\r\n clickOutsideDeactivates: (e) => {\r\n this.setCount(e);\r\n\r\n return true;\r\n },\r\n onDeactivate: () => this.stopManualCountInput(),\r\n onPostDeactivate: () => this.manualInputButtonElement?.focus(),\r\n }).activate();\r\n } else if (this.manualCount === undefined && this.trap) {\r\n this.trap?.deactivate();\r\n\r\n delete this.trap;\r\n }\r\n }\r\n\r\n disconnectedCallback(): void {\r\n this.trap?.deactivate();\r\n }\r\n\r\n private handleOnChange({ target }: Event): void {\r\n if (target instanceof HTMLInputElement) {\r\n this.manualCount = target.valueAsNumber;\r\n }\r\n }\r\n\r\n private stepValue(e: Event, direction: \"increment\" | \"decrement\"): void {\r\n if (typeof this.count === \"number\") {\r\n const newValue = direction === \"increment\" ? this.count + 1 : this.count - 1;\r\n\r\n if (this.isNewCountValid(newValue) === false) {\r\n return;\r\n }\r\n\r\n this.dsoCountChange.emit({\r\n originalEvent: e,\r\n count: newValue,\r\n });\r\n }\r\n }\r\n\r\n private setCount(e: Event): void {\r\n e.preventDefault();\r\n\r\n if (typeof this.manualCount === \"number\" && this.isNewCountValid(this.manualCount)) {\r\n this.dsoCountChange.emit({\r\n originalEvent: e,\r\n count: this.manualCount,\r\n });\r\n this.stopManualCountInput();\r\n }\r\n }\r\n\r\n private handleSelectClick(e: Event): void {\r\n e.preventDefault();\r\n\r\n if (this.count !== undefined) {\r\n this.dsoCountChange.emit({\r\n originalEvent: e,\r\n count: this.count > 0 ? 0 : 1,\r\n });\r\n\r\n return;\r\n }\r\n\r\n this.dsoSelectedChange.emit({\r\n originalEvent: e,\r\n checked: !this.checked,\r\n });\r\n }\r\n\r\n private startManualCountInput(): void {\r\n this.manualCount = this.count;\r\n }\r\n\r\n private stopManualCountInput(): void {\r\n this.manualCount = undefined;\r\n }\r\n\r\n private isNewCountValid(newValue: number): boolean {\r\n if (\r\n this.min !== undefined &&\r\n this.max !== undefined &&\r\n (newValue < Number(this.min) || newValue > Number(this.max))\r\n ) {\r\n return false;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n render() {\r\n const showButtonInputs = this.manualCount === undefined;\r\n\r\n const selected = this.checked || (this.count !== undefined && this.count > 0);\r\n\r\n return (\r\n <div class={clsx([\"dso-button-group\", { \"dso-disabled\": this.disabled }])}>\r\n <div\r\n class={clsx([\"dso-list-button\", { \"dso-selected\": selected, \"dso-single-count\": this.count === 1 }])}\r\n onClick={(e) => this.handleSelectClick(e)}\r\n >\r\n <div class=\"dso-selectable\">\r\n <input\r\n id=\"dso-list-button-checkbox\"\r\n type=\"checkbox\"\r\n value=\"list-button\"\r\n name=\"naam\"\r\n checked={selected}\r\n disabled={this.disabled}\r\n aria-label={this.label}\r\n />\r\n <label htmlFor=\"dso-list-button-checkbox\">{this.label}</label>\r\n </div>\r\n {this.sublabel && <span class=\"dso-sublabel\">{this.sublabel}</span>}\r\n <slot name=\"subcontent\" />\r\n </div>\r\n\r\n {this.count !== undefined && this.count > 0 && (\r\n <div class=\"dso-input-number\">\r\n {this.manualCount === undefined && this.count > 1 && (\r\n <button\r\n type=\"button\"\r\n class=\"dso-tertiary\"\r\n disabled={this.count === Number(this.min) || this.disabled}\r\n onClick={(e) => this.stepValue(e, \"decrement\")}\r\n >\r\n <dso-icon icon=\"minus-circle\"></dso-icon>\r\n <span class=\"sr-only\">Aantal verlagen</span>\r\n </button>\r\n )}\r\n\r\n <div class=\"dso-input-wrapper\">\r\n {this.manualCount === undefined && this.count > 1 && (\r\n <input\r\n class=\"dso-input-step-counter\"\r\n type=\"number\"\r\n tabIndex={-1}\r\n aria-label=\"Aantal\"\r\n value={this.count}\r\n readOnly\r\n />\r\n )}\r\n\r\n <form onSubmit={(e) => this.setCount(e)}>\r\n <div ref={(element) => (this.manualInputWrapperElement = element)}>\r\n <input\r\n class={clsx(\"form-control\", { hidden: showButtonInputs })}\r\n type=\"number\"\r\n aria-label=\"Aantal\"\r\n value={this.manualCount}\r\n min={this.min}\r\n max={this.max}\r\n onInput={(e) => this.handleOnChange(e)}\r\n />\r\n </div>\r\n\r\n {this.manual === true && (\r\n <button\r\n class={clsx(\"dso-manual-input-button\", { \"sr-only\": !showButtonInputs })}\r\n type={!showButtonInputs ? \"submit\" : \"button\"}\r\n disabled={this.disabled}\r\n onClick={() => showButtonInputs && this.startManualCountInput()}\r\n >\r\n {showButtonInputs ? (\r\n <span class=\"sr-only\">Handmatig aantal invullen</span>\r\n ) : (\r\n <span class=\"sr-only\">Zet waarde</span>\r\n )}\r\n </button>\r\n )}\r\n </form>\r\n </div>\r\n\r\n {showButtonInputs && (\r\n <button\r\n type=\"button\"\r\n class=\"dso-tertiary\"\r\n disabled={this.count === Number(this.max) || this.disabled}\r\n onClick={(e) => this.stepValue(e, \"increment\")}\r\n >\r\n <dso-icon icon=\"plus-circle\"></dso-icon>\r\n <span class=\"sr-only\">Aantal verhogen</span>\r\n </button>\r\n )}\r\n </div>\r\n )}\r\n </div>\r\n );\r\n }\r\n}\r\n"]}