@dso-toolkit/core 30.1.0 → 32.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 (96) hide show
  1. package/dist/cjs/dso-alert.cjs.entry.js +1 -1
  2. package/dist/cjs/dso-autosuggest.cjs.entry.js +14 -2
  3. package/dist/cjs/dso-banner.cjs.entry.js +1 -1
  4. package/dist/cjs/dso-date-picker.cjs.entry.js +54 -14
  5. package/dist/cjs/dso-highlight-box.cjs.entry.js +1 -1
  6. package/dist/cjs/dso-icon.cjs.entry.js +6 -4
  7. package/dist/cjs/dso-info-button.cjs.entry.js +26 -0
  8. package/dist/cjs/{dso-info_3.cjs.entry.js → dso-info_2.cjs.entry.js} +1 -21
  9. package/dist/cjs/dso-label.cjs.entry.js +1 -1
  10. package/dist/cjs/dso-ozon-content.cjs.entry.js +48 -11
  11. package/dist/cjs/dso-toggletip.cjs.entry.js +62 -0
  12. package/dist/cjs/dso-toolkit.cjs.js +1 -1
  13. package/dist/cjs/dso-tooltip.cjs.entry.js +33 -26
  14. package/dist/cjs/dso-tree-view.cjs.entry.js +180 -0
  15. package/dist/cjs/loader.cjs.js +1 -1
  16. package/dist/collection/collection-manifest.json +3 -1
  17. package/dist/collection/components/alert/alert.css +2 -0
  18. package/dist/collection/components/autosuggest/autosuggest.js +3 -2
  19. package/dist/collection/components/banner/banner.css +2 -0
  20. package/dist/collection/components/date-picker/date-localization.js +1 -1
  21. package/dist/collection/components/date-picker/date-picker.css +0 -3
  22. package/dist/collection/components/date-picker/date-picker.js +108 -14
  23. package/dist/collection/components/date-picker/date-picker.template.js +2 -1
  24. package/dist/collection/components/highlight-box/highlight-box.css +1 -1
  25. package/dist/collection/components/icon/icon.js +9 -7
  26. package/dist/collection/components/info/info.css +4 -4
  27. package/dist/collection/components/info-button/info-button.css +10 -3
  28. package/dist/collection/components/info-button/info-button.js +18 -1
  29. package/dist/collection/components/info-button/info-button.template.js +2 -1
  30. package/dist/collection/components/label/label.decorator.js +6 -0
  31. package/dist/collection/components/label/label.js +1 -0
  32. package/dist/collection/components/label/label.template.js +10 -2
  33. package/dist/collection/components/ozon-content/ozon-content.transformer.js +1 -1
  34. package/dist/collection/components/toggletip/toggletip.css +8 -0
  35. package/dist/collection/components/toggletip/toggletip.js +137 -0
  36. package/dist/collection/components/toggletip/toggletip.template.js +12 -0
  37. package/dist/collection/components/tooltip/tooltip.css +1 -1
  38. package/dist/collection/components/tooltip/tooltip.js +49 -25
  39. package/dist/collection/components/tree-view/tree-item.js +20 -0
  40. package/dist/collection/components/tree-view/tree-view.css +43 -0
  41. package/dist/collection/components/tree-view/tree-view.interfaces.js +1 -0
  42. package/dist/collection/components/tree-view/tree-view.js +239 -0
  43. package/dist/collection/components/tree-view/tree-view.template.js +11 -0
  44. package/dist/custom-elements/index.d.ts +12 -0
  45. package/dist/custom-elements/index.js +402 -69
  46. package/dist/dso-toolkit/dso-toolkit.css +1 -1
  47. package/dist/dso-toolkit/dso-toolkit.esm.js +1 -1
  48. package/dist/dso-toolkit/{p-968d9e1d.entry.js → p-19de4cc7.entry.js} +1 -1
  49. package/dist/dso-toolkit/p-39dae284.entry.js +1 -0
  50. package/dist/dso-toolkit/p-5665f1ee.entry.js +1 -0
  51. package/dist/dso-toolkit/{p-eadba8c3.entry.js → p-5a67f3f7.entry.js} +1 -1
  52. package/dist/dso-toolkit/p-759920d0.entry.js +1 -0
  53. package/dist/dso-toolkit/{p-d748df48.entry.js → p-83f166b3.entry.js} +1 -1
  54. package/dist/dso-toolkit/p-9e9f8bcf.entry.js +1 -0
  55. package/dist/dso-toolkit/p-a52d3623.entry.js +1 -0
  56. package/dist/dso-toolkit/p-ad8f467f.entry.js +1 -0
  57. package/dist/dso-toolkit/{p-a2357726.entry.js → p-affe82e6.entry.js} +1 -1
  58. package/dist/dso-toolkit/{p-ae6209c6.entry.js → p-be5682cc.entry.js} +1 -1
  59. package/dist/dso-toolkit/p-e03d7741.entry.js +1 -0
  60. package/dist/dso-toolkit/p-e2dc97c4.entry.js +1 -0
  61. package/dist/esm/dso-alert.entry.js +1 -1
  62. package/dist/esm/dso-autosuggest.entry.js +14 -2
  63. package/dist/esm/dso-banner.entry.js +1 -1
  64. package/dist/esm/dso-date-picker.entry.js +54 -14
  65. package/dist/esm/dso-highlight-box.entry.js +1 -1
  66. package/dist/esm/dso-icon.entry.js +6 -4
  67. package/dist/esm/dso-info-button.entry.js +22 -0
  68. package/dist/esm/{dso-info_3.entry.js → dso-info_2.entry.js} +2 -21
  69. package/dist/esm/dso-label.entry.js +1 -1
  70. package/dist/esm/dso-ozon-content.entry.js +48 -11
  71. package/dist/esm/dso-toggletip.entry.js +58 -0
  72. package/dist/esm/dso-toolkit.js +1 -1
  73. package/dist/esm/dso-tooltip.entry.js +33 -26
  74. package/dist/esm/dso-tree-view.entry.js +176 -0
  75. package/dist/esm/loader.js +1 -1
  76. package/dist/types/components/date-picker/date-picker.d.ts +20 -0
  77. package/dist/types/components/date-picker/date-picker.template.d.ts +1 -1
  78. package/dist/types/components/icon/icon.d.ts +1 -1
  79. package/dist/types/components/info-button/info-button.d.ts +1 -0
  80. package/dist/types/components/info-button/info-button.template.d.ts +1 -1
  81. package/dist/types/components/label/label.decorator.d.ts +3 -0
  82. package/dist/types/components/label/label.template.d.ts +1 -1
  83. package/dist/types/components/toggletip/toggletip.d.ts +17 -0
  84. package/dist/types/components/toggletip/toggletip.template.d.ts +2 -0
  85. package/dist/types/components/tooltip/tooltip.d.ts +6 -2
  86. package/dist/types/components/tree-view/tree-item.d.ts +13 -0
  87. package/dist/types/components/tree-view/tree-view.d.ts +36 -0
  88. package/dist/types/components/tree-view/tree-view.interfaces.d.ts +24 -0
  89. package/dist/types/components/tree-view/tree-view.template.d.ts +2 -0
  90. package/dist/types/components.d.ts +84 -3
  91. package/package.json +2 -1
  92. package/dist/dso-toolkit/p-112ed9ac.entry.js +0 -1
  93. package/dist/dso-toolkit/p-187782ee.entry.js +0 -1
  94. package/dist/dso-toolkit/p-2c6e9460.entry.js +0 -1
  95. package/dist/dso-toolkit/p-6fcc89f9.entry.js +0 -1
  96. package/dist/dso-toolkit/p-c5acf7e2.entry.js +0 -1
@@ -4,7 +4,7 @@
4
4
  :host {
5
5
  --di-times-bosgroen: url("data:image/svg+xml,%3csvg id='times' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' style='color: %23275937%3b'%3e %3cpath fill='currentColor' d='M13.36%2c12l3.3-3.3A1%2c1%2c0%2c1%2c0%2c15.3%2c7.34L12%2c10.64%2c8.7%2c7.34A1%2c1%2c0%2c1%2c0%2c7.34%2c8.7l3.3%2c3.3-3.3%2c3.3A1%2c1%2c0%2c1%2c0%2c8.7%2c16.66l3.3-3.3%2c3.3%2c3.3a1%2c1%2c0%2c1%2c0%2c1.36-1.36Z'/%3e %3c/svg%3e");
6
6
  display: block;
7
- background-color: #e5e5e5;
7
+ background-color: #f2f2f2;
8
8
  padding: 16px 32px 16px 16px;
9
9
  position: relative;
10
10
  }
@@ -13,11 +13,11 @@
13
13
  border-style: none;
14
14
  padding: 0;
15
15
  position: absolute;
16
- right: 0;
17
- top: 0;
16
+ right: 8px;
17
+ top: 8px;
18
18
  }
19
19
  :host > button::before {
20
- background: var(--dso-icon, var(--di-times-bosgroen)) no-repeat;
20
+ background: var(--dso-icon, var(--di-times-grijs90)) no-repeat;
21
21
  background-position: center;
22
22
  background-size: cover;
23
23
  height: 1.5em;
@@ -5,6 +5,8 @@
5
5
  display: inline-block;
6
6
  --di-info: url("data:image/svg+xml,%3csvg id='info' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' style='color: %2339870c%3b'%3e %3cpath fill='currentColor' d='M12%2c3a9%2c9%2c0%2c1%2c1-9%2c9%2c9%2c9%2c0%2c0%2c1%2c9-9m0-2A11%2c11%2c0%2c1%2c0%2c23%2c12%2c11%2c11%2c0%2c0%2c0%2c12%2c1Zm0%2c8a1%2c1%2c0%2c1%2c0-1-1A1%2c1%2c0%2c0%2c0%2c12%2c9Zm1%2c7.79V11.21A1.12%2c1.12%2c0%2c0%2c0%2c12%2c10a1.12%2c1.12%2c0%2c0%2c0-1%2c1.21v5.58A1.12%2c1.12%2c0%2c0%2c0%2c12%2c18%2c1.12%2c1.12%2c0%2c0%2c0%2c13%2c16.79Z'/%3e %3c/svg%3e");
7
7
  --di-info-active: url("data:image/svg+xml,%3csvg id='info-active' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' style='color: %2339870c%3b'%3e %3cpath fill='currentColor' d='M23%2c12A11%2c11%2c0%2c1%2c1%2c12%2c1%2c11%2c11%2c0%2c0%2c1%2c23%2c12ZM12%2c9a1%2c1%2c0%2c1%2c0-1-1A1%2c1%2c0%2c0%2c0%2c12%2c9Zm1%2c7.79V11.21A1.12%2c1.12%2c0%2c0%2c0%2c12%2c10a1.12%2c1.12%2c0%2c0%2c0-1%2c1.21v5.58A1.12%2c1.12%2c0%2c0%2c0%2c12%2c18%2c1.12%2c1.12%2c0%2c0%2c0%2c13%2c16.79Z'/%3e %3c/svg%3e");
8
+ --di-info-secondary: url("data:image/svg+xml,%3csvg id='info' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' style='color: %23666%3b'%3e %3cpath fill='currentColor' d='M12%2c3a9%2c9%2c0%2c1%2c1-9%2c9%2c9%2c9%2c0%2c0%2c1%2c9-9m0-2A11%2c11%2c0%2c1%2c0%2c23%2c12%2c11%2c11%2c0%2c0%2c0%2c12%2c1Zm0%2c8a1%2c1%2c0%2c1%2c0-1-1A1%2c1%2c0%2c0%2c0%2c12%2c9Zm1%2c7.79V11.21A1.12%2c1.12%2c0%2c0%2c0%2c12%2c10a1.12%2c1.12%2c0%2c0%2c0-1%2c1.21v5.58A1.12%2c1.12%2c0%2c0%2c0%2c12%2c18%2c1.12%2c1.12%2c0%2c0%2c0%2c13%2c16.79Z'/%3e %3c/svg%3e");
9
+ --di-info-active-secondary: url("data:image/svg+xml,%3csvg id='info-active' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' style='color: %23666%3b'%3e %3cpath fill='currentColor' d='M23%2c12A11%2c11%2c0%2c1%2c1%2c12%2c1%2c11%2c11%2c0%2c0%2c1%2c23%2c12ZM12%2c9a1%2c1%2c0%2c1%2c0-1-1A1%2c1%2c0%2c0%2c0%2c12%2c9Zm1%2c7.79V11.21A1.12%2c1.12%2c0%2c0%2c0%2c12%2c10a1.12%2c1.12%2c0%2c0%2c0-1%2c1.21v5.58A1.12%2c1.12%2c0%2c0%2c0%2c12%2c18%2c1.12%2c1.12%2c0%2c0%2c0%2c13%2c16.79Z'/%3e %3c/svg%3e");
8
10
  }
9
11
 
10
12
  *,
@@ -28,14 +30,19 @@ button {
28
30
  background: var(--dso-icon, var(--di-info)) no-repeat;
29
31
  background-position: center;
30
32
  background-size: cover;
31
- height: 1.5em;
33
+ height: 24px;
32
34
  vertical-align: top;
33
- width: 1.5em;
35
+ width: 24px;
34
36
  border: 1px solid transparent;
35
37
  margin-left: 8px;
36
- min-width: 16px;
37
38
  padding: 0;
38
39
  }
39
40
  button.dso-open, button:hover, button:active {
40
41
  --dso-icon: var(--di-info-active);
42
+ }
43
+ button.dso-info-secondary {
44
+ --dso-icon: var(--di-info-secondary);
45
+ }
46
+ button.dso-info-secondary.dso-open, button.dso-info-secondary:hover, button.dso-info-secondary:active {
47
+ --dso-icon: var(--di-info-active-secondary);
41
48
  }
@@ -9,7 +9,7 @@ export class InfoButton {
9
9
  this.toggle.emit({ originalEvent: e, active: this.active });
10
10
  }
11
11
  render() {
12
- return (h("button", { type: "button", class: clsx('btn', { 'dso-open': !!this.active }), "aria-expanded": typeof this.active === 'boolean' ? this.active.toString() : undefined, onClick: e => this.handleToggle(e) },
12
+ return (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) },
13
13
  h("span", { class: "sr-only" }, this.label)));
14
14
  }
15
15
  static get is() { return "dso-info-button"; }
@@ -38,6 +38,23 @@ export class InfoButton {
38
38
  "attribute": "active",
39
39
  "reflect": true
40
40
  },
41
+ "secondary": {
42
+ "type": "boolean",
43
+ "mutable": false,
44
+ "complexType": {
45
+ "original": "boolean",
46
+ "resolved": "boolean | undefined",
47
+ "references": {}
48
+ },
49
+ "required": false,
50
+ "optional": true,
51
+ "docs": {
52
+ "tags": [],
53
+ "text": ""
54
+ },
55
+ "attribute": "secondary",
56
+ "reflect": false
57
+ },
41
58
  "label": {
42
59
  "type": "string",
43
60
  "mutable": false,
@@ -1,9 +1,10 @@
1
1
  import { html } from 'lit-html';
2
- export function infoButtonTemplate({ label, active, onClick }) {
2
+ export function infoButtonTemplate({ label, active, secondary, onClick }) {
3
3
  return html `
4
4
  <dso-info-button
5
5
  label=${label}
6
6
  ?active=${active}
7
+ ?secondary=${secondary}
7
8
  @toggle=${(e) => onClick(e.detail)}
8
9
  ></dso-info-button>
9
10
  `;
@@ -0,0 +1,6 @@
1
+ import { html } from 'lit-html';
2
+ export const decorator = (story, css) => html `
3
+ ${story()}
4
+
5
+ <style>${css}</style>
6
+ `;
@@ -4,6 +4,7 @@ export class Label {
4
4
  render() {
5
5
  const status = this.status && Label.statusMap.get(this.status);
6
6
  return (h("span", { class: clsx('dso-label', { [`dso-label-${this.status}`]: this.status, 'dso-compact': this.compact && !this.removable, 'dso-hover': this.hover }) },
7
+ h("slot", { name: "symbol" }),
7
8
  status && (h("span", { class: "sr-only" },
8
9
  status,
9
10
  ": ")),
@@ -1,6 +1,7 @@
1
- import { html } from 'lit-html';
1
+ import { html, nothing } from 'lit-html';
2
2
  import { ifDefined } from 'lit-html/directives/if-defined';
3
- export function labelTemplate({ status, label, button, compact }) {
3
+ import { unsafeHTML } from 'lit-html/directives/unsafe-html';
4
+ export function labelTemplate({ status, label, button, compact, symbol }) {
4
5
  return html `
5
6
  <dso-label
6
7
  status=${ifDefined(status)}
@@ -8,6 +9,13 @@ export function labelTemplate({ status, label, button, compact }) {
8
9
  ?compact=${compact}
9
10
  ?removable=${button}
10
11
  >
12
+ ${symbol
13
+ ? html `
14
+ <span slot="symbol">
15
+ ${unsafeHTML(symbol)}
16
+ </span>
17
+ `
18
+ : nothing}
11
19
  ${label}
12
20
  </dso-label>
13
21
  `;
@@ -1,6 +1,6 @@
1
1
  import isURL from 'validator/es/lib/isURL';
2
2
  function transformDescriptionNote(body) {
3
- body.querySelectorAll('.od-Al > div.noot').forEach((nootElement, index) => {
3
+ body.querySelectorAll('div.noot').forEach((nootElement, index) => {
4
4
  const contentElement = nootElement.nextElementSibling;
5
5
  if (!(contentElement instanceof HTMLDivElement && contentElement.classList.value === 'noot_popup')) {
6
6
  return;
@@ -0,0 +1,8 @@
1
+ /* stylelint-disable value-keyword-case */
2
+ /* stylelint-disable string-no-newline */
3
+ /* stylelint-enable */
4
+ *,
5
+ *::after,
6
+ *::before {
7
+ box-sizing: border-box;
8
+ }
@@ -0,0 +1,137 @@
1
+ import { h, Component, Fragment, Element, Prop, State } from "@stencil/core";
2
+ export class Toggletip {
3
+ constructor() {
4
+ this.active = false;
5
+ this.label = "Toelichting";
6
+ this.position = "right";
7
+ this.click = () => {
8
+ this.active ? this.close() : this.open();
9
+ };
10
+ this.open = () => {
11
+ this.active = true;
12
+ this.host.addEventListener("keydown", this.keyDownListener);
13
+ this.host.addEventListener("focusout", this.focusOutListener);
14
+ };
15
+ this.close = () => {
16
+ this.host.removeEventListener("focusout", this.focusOutListener);
17
+ this.host.removeEventListener("keydown", this.keyDownListener);
18
+ this.active = false;
19
+ };
20
+ this.focusOutListener = (event) => {
21
+ if (!this.host.contains(event.relatedTarget)) {
22
+ this.close();
23
+ }
24
+ };
25
+ this.keyDownListener = (event) => {
26
+ if (!event.defaultPrevented && event.key == "Escape") {
27
+ this.close();
28
+ this.button.focus();
29
+ event.preventDefault();
30
+ }
31
+ return;
32
+ };
33
+ }
34
+ componentDidRender() {
35
+ var _a, _b, _c;
36
+ const infoButton = (_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector("dso-info-button");
37
+ if (!infoButton) {
38
+ throw Error("dso-info-button not found");
39
+ }
40
+ this.infoButton = infoButton;
41
+ const button = (_c = (_b = this.infoButton) === null || _b === void 0 ? void 0 : _b.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector("button");
42
+ if (!button) {
43
+ throw Error("button not found");
44
+ }
45
+ this.button = button;
46
+ }
47
+ render() {
48
+ return (h(Fragment, null,
49
+ h("dso-info-button", { id: "toggle", onClick: this.click, label: this.label, active: this.active, secondary: this.secondary }),
50
+ h("dso-tooltip", { stateless: true, for: "toggle", active: this.active, position: this.position, small: this.small },
51
+ h("slot", null))));
52
+ }
53
+ static get is() { return "dso-toggletip"; }
54
+ static get encapsulation() { return "shadow"; }
55
+ static get originalStyleUrls() { return {
56
+ "$": ["toggletip.scss"]
57
+ }; }
58
+ static get styleUrls() { return {
59
+ "$": ["toggletip.css"]
60
+ }; }
61
+ static get properties() { return {
62
+ "label": {
63
+ "type": "string",
64
+ "mutable": false,
65
+ "complexType": {
66
+ "original": "string",
67
+ "resolved": "string",
68
+ "references": {}
69
+ },
70
+ "required": false,
71
+ "optional": false,
72
+ "docs": {
73
+ "tags": [],
74
+ "text": ""
75
+ },
76
+ "attribute": "label",
77
+ "reflect": false,
78
+ "defaultValue": "\"Toelichting\""
79
+ },
80
+ "position": {
81
+ "type": "string",
82
+ "mutable": false,
83
+ "complexType": {
84
+ "original": "\"top\" | \"right\" | \"bottom\" | \"left\"",
85
+ "resolved": "\"bottom\" | \"left\" | \"right\" | \"top\"",
86
+ "references": {}
87
+ },
88
+ "required": false,
89
+ "optional": false,
90
+ "docs": {
91
+ "tags": [],
92
+ "text": ""
93
+ },
94
+ "attribute": "position",
95
+ "reflect": false,
96
+ "defaultValue": "\"right\""
97
+ },
98
+ "small": {
99
+ "type": "boolean",
100
+ "mutable": false,
101
+ "complexType": {
102
+ "original": "boolean",
103
+ "resolved": "boolean | undefined",
104
+ "references": {}
105
+ },
106
+ "required": false,
107
+ "optional": true,
108
+ "docs": {
109
+ "tags": [],
110
+ "text": ""
111
+ },
112
+ "attribute": "small",
113
+ "reflect": false
114
+ },
115
+ "secondary": {
116
+ "type": "boolean",
117
+ "mutable": false,
118
+ "complexType": {
119
+ "original": "boolean",
120
+ "resolved": "boolean | undefined",
121
+ "references": {}
122
+ },
123
+ "required": false,
124
+ "optional": true,
125
+ "docs": {
126
+ "tags": [],
127
+ "text": ""
128
+ },
129
+ "attribute": "secondary",
130
+ "reflect": false
131
+ }
132
+ }; }
133
+ static get states() { return {
134
+ "active": {}
135
+ }; }
136
+ static get elementRef() { return "host"; }
137
+ }
@@ -0,0 +1,12 @@
1
+ import { html } from "lit-html";
2
+ import { ifDefined } from "lit-html/directives/if-defined";
3
+ import { unsafeHTML } from "lit-html/directives/unsafe-html";
4
+ export function toggletipTemplate({ children, label, position, small, secondary, }) {
5
+ return html `<dso-toggletip
6
+ label=${ifDefined(label)}
7
+ position=${ifDefined(position)}
8
+ ?small=${small}
9
+ ?secondary=${secondary}
10
+ >${unsafeHTML(children)}</dso-toggletip
11
+ >`;
12
+ }
@@ -2,7 +2,7 @@
2
2
  /* stylelint-disable string-no-newline */
3
3
  /* stylelint-enable */
4
4
  :host(:not([hidden])) {
5
- display: block;
5
+ display: inline-block;
6
6
  }
7
7
 
8
8
  *,
@@ -40,8 +40,25 @@ export class Tooltip {
40
40
  });
41
41
  }
42
42
  watchActive() {
43
+ var _a;
43
44
  if (this.active) {
44
45
  this.hidden = false;
46
+ if (!this.stateless) {
47
+ setTimeout(() => {
48
+ var _a;
49
+ (_a = this.popper) === null || _a === void 0 ? void 0 : _a.setOptions({
50
+ modifiers: [{ name: 'eventListeners', enabled: true }]
51
+ });
52
+ });
53
+ }
54
+ }
55
+ else {
56
+ if (!this.stateless) {
57
+ (_a = this.popper) === null || _a === void 0 ? void 0 : _a.setOptions({
58
+ modifiers: [{ name: 'eventListeners', enabled: false }]
59
+ });
60
+ }
61
+ setTimeout(() => (this.hidden = true), transitionDuration);
45
62
  }
46
63
  }
47
64
  listenClick(e) {
@@ -61,34 +78,20 @@ export class Tooltip {
61
78
  placement: this.position
62
79
  });
63
80
  this.callbacks = {
64
- activate: () => {
65
- this.hidden = false;
66
- setTimeout(() => {
67
- var _a;
68
- this.active = true;
69
- (_a = this.popper) === null || _a === void 0 ? void 0 : _a.setOptions({
70
- modifiers: [{ name: 'eventListeners', enabled: true }]
71
- });
72
- });
73
- },
74
- deactivate: () => {
75
- var _a;
76
- this.active = false;
77
- (_a = this.popper) === null || _a === void 0 ? void 0 : _a.setOptions({
78
- modifiers: [{ name: 'eventListeners', enabled: false }]
79
- });
80
- setTimeout(() => this.hidden = true, transitionDuration);
81
- }
81
+ activate: () => (this.active = true),
82
+ deactivate: () => (this.active = false)
82
83
  };
83
- this.target.addEventListener('mouseenter', this.callbacks.activate);
84
- this.target.addEventListener('mouseleave', this.callbacks.deactivate);
85
- this.target.addEventListener('focus', this.callbacks.activate);
86
- this.target.addEventListener('blur', this.callbacks.deactivate);
84
+ if (!this.stateless) {
85
+ this.target.addEventListener('mouseenter', this.callbacks.activate);
86
+ this.target.addEventListener('mouseleave', this.callbacks.deactivate);
87
+ this.target.addEventListener('focus', this.callbacks.activate);
88
+ this.target.addEventListener('blur', this.callbacks.deactivate);
89
+ }
87
90
  }
88
91
  disconnectedCallback() {
89
92
  var _a;
90
93
  (_a = this.popper) === null || _a === void 0 ? void 0 : _a.destroy();
91
- if (this.target && this.callbacks) {
94
+ if (!this.stateless && this.target && this.callbacks) {
92
95
  this.target.removeEventListener('mouseenter', this.callbacks.activate);
93
96
  this.target.removeEventListener('mouseleave', this.callbacks.deactivate);
94
97
  this.target.removeEventListener('focus', this.callbacks.activate);
@@ -106,7 +109,7 @@ export class Tooltip {
106
109
  render() {
107
110
  return (h(Host, { hidden: this.hidden },
108
111
  h("div", { class: clsx('tooltip', { in: this.active }), role: "tooltip" },
109
- !this.noArrow && (h("div", { class: "tooltip-arrow" })),
112
+ !this.noArrow && h("div", { class: "tooltip-arrow" }),
110
113
  h("div", { class: clsx('tooltip-inner', { 'dso-small': this.small }) },
111
114
  h("slot", null)))));
112
115
  }
@@ -115,7 +118,11 @@ export class Tooltip {
115
118
  return this.for;
116
119
  }
117
120
  if (typeof this.for === 'string') {
118
- const reference = document.getElementById(this.for);
121
+ const rootNode = this.element.getRootNode();
122
+ if (!(rootNode instanceof Document || rootNode instanceof ShadowRoot)) {
123
+ throw new Error(`rootNode is not instance of Document or ShadowRoot`);
124
+ }
125
+ const reference = rootNode.getElementById(this.for);
119
126
  if (!reference) {
120
127
  throw new Error(`Unable to find reference with id ${this.for}`);
121
128
  }
@@ -193,6 +200,23 @@ export class Tooltip {
193
200
  "reflect": false,
194
201
  "defaultValue": "false"
195
202
  },
203
+ "stateless": {
204
+ "type": "boolean",
205
+ "mutable": false,
206
+ "complexType": {
207
+ "original": "boolean",
208
+ "resolved": "boolean | undefined",
209
+ "references": {}
210
+ },
211
+ "required": false,
212
+ "optional": true,
213
+ "docs": {
214
+ "tags": [],
215
+ "text": "Deactivates mouseover behaviour"
216
+ },
217
+ "attribute": "stateless",
218
+ "reflect": false
219
+ },
196
220
  "small": {
197
221
  "type": "boolean",
198
222
  "mutable": false,
@@ -0,0 +1,20 @@
1
+ import { h, Fragment } from '@stencil/core';
2
+ import clsx from 'clsx';
3
+ export const DsoTreeItem = ({ owner, ancestors, item, index, level, setSize }) => {
4
+ var _a, _b, _c;
5
+ return (h("li", { key: item.reference, class: clsx('tree-item', { 'has-child': item.hasItems }), role: 'none' },
6
+ h("div", { class: "tree-branch-control" }, item.hasItems
7
+ ?
8
+ h("div", { onClick: (e) => owner.itemClick(e, ancestors, item) },
9
+ h("dso-icon", { icon: item.open ? 'chevron-down' : 'chevron-right' }))
10
+ : h("dso-icon", null)),
11
+ h("p", { class: "tree-content", tabindex: level === 1 && index === 0 ? 0 : -1, role: "treeitem", "aria-expanded": item.hasItems ? '' + (!!item.open && !!((_a = item.items) === null || _a === void 0 ? void 0 : _a.length)) : undefined, "aria-level": level, "aria-setsize": setSize, "aria-posinset": index + 1, "aria-busy": item.loading ? 'true' : undefined, onClick: (e) => owner.itemClick(e, ancestors, item) },
12
+ item.href
13
+ ? h("a", { href: item.href, tabindex: "-1" }, item.label)
14
+ : h("span", null, item.label), (_b = item.icons) === null || _b === void 0 ? void 0 :
15
+ _b.map((icon) => h("dso-icon", { icon: icon.icon, title: icon.label }))),
16
+ item.open &&
17
+ h(Fragment, null, item.hasItems && !item.items && item.loading
18
+ ? h("dso-progress-indicator", { size: "small", label: "Resultaten laden: een moment geduld alstublieft." })
19
+ : h("ul", { role: "group" }, (_c = item.items) === null || _c === void 0 ? void 0 : _c.map((childItem, index, org) => h(DsoTreeItem, { owner: owner, ancestors: [...ancestors, item], item: childItem, index: index, level: level + 1, setSize: org.length }))))));
20
+ };
@@ -0,0 +1,43 @@
1
+ /* stylelint-disable value-keyword-case */
2
+ /* stylelint-disable string-no-newline */
3
+ /* stylelint-enable */
4
+ :host ul {
5
+ list-style-type: none;
6
+ }
7
+ :host ul[role=tree] {
8
+ padding-left: 0;
9
+ }
10
+ :host li[role=treeitem] > ul {
11
+ padding-left: 1.5em;
12
+ }
13
+ :host .tree-branch-control {
14
+ cursor: pointer;
15
+ display: inline-block;
16
+ }
17
+ :host .tree-content {
18
+ cursor: pointer;
19
+ display: inline-block;
20
+ margin: 8px 0;
21
+ }
22
+ :host .tree-content a, :host .tree-content a:visited {
23
+ color: #39870c;
24
+ text-decoration: none;
25
+ }
26
+ :host .tree-content a:hover, :host .tree-content a:focus {
27
+ color: #676cb0;
28
+ text-decoration: underline;
29
+ }
30
+ :host .tree-content a:active {
31
+ text-decoration: none;
32
+ }
33
+ :host .tree-content dso-icon {
34
+ vertical-align: text-bottom;
35
+ font-size: 0.75em;
36
+ margin-left: 0.5em;
37
+ }
38
+
39
+ *,
40
+ *::after,
41
+ *::before {
42
+ box-sizing: border-box;
43
+ }