@dso-toolkit/core 52.0.3 → 53.1.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 (163) hide show
  1. package/dist/cjs/dso-accordion-section.cjs.entry.js +39 -1404
  2. package/dist/cjs/dso-action-list-item.cjs.entry.js +27 -0
  3. package/dist/cjs/dso-action-list.cjs.entry.js +20 -0
  4. package/dist/cjs/dso-annotation-output.cjs.entry.js +1 -1
  5. package/dist/cjs/dso-card-container.cjs.entry.js +1 -1
  6. package/dist/cjs/dso-date-picker.cjs.entry.js +1 -1
  7. package/dist/cjs/dso-dropdown-menu.cjs.entry.js +18 -3
  8. package/dist/cjs/dso-expandable-heading.cjs.entry.js +6 -2
  9. package/dist/cjs/dso-expandable.cjs.entry.js +1433 -2
  10. package/dist/cjs/dso-header.cjs.entry.js +16 -1
  11. package/dist/cjs/dso-helpcenter-panel.cjs.entry.js +2 -2
  12. package/dist/cjs/dso-image-overlay.cjs.entry.js +2 -2
  13. package/dist/cjs/dso-info_2.cjs.entry.js +3 -2
  14. package/dist/cjs/dso-label.cjs.entry.js +1 -8
  15. package/dist/cjs/dso-list-button.cjs.entry.js +3 -3
  16. package/dist/cjs/dso-modal.cjs.entry.js +2 -2
  17. package/dist/cjs/dso-ozon-content.cjs.entry.js +2 -2
  18. package/dist/cjs/dso-table.cjs.entry.js +2 -2
  19. package/dist/cjs/dso-toolkit.cjs.js +1 -1
  20. package/dist/cjs/dso-tooltip.cjs.entry.js +14 -12
  21. package/dist/cjs/dso-viewer-grid.cjs.entry.js +2 -2
  22. package/dist/cjs/expandable.interfaces-19b608b9.js +7 -0
  23. package/dist/cjs/{focus-trap.esm-c501d382.js → focus-trap.esm-a5b7273f.js} +134 -51
  24. package/dist/cjs/{has-overflow-b1b4f3f3.js → has-overflow-dd552ec8.js} +3 -4
  25. package/dist/cjs/index.cjs.js +67 -0
  26. package/dist/cjs/{index.esm-03a9e0b4.js → index.esm-0e935715.js} +97 -17
  27. package/dist/cjs/loader.cjs.js +1 -1
  28. package/dist/collection/collection-manifest.json +3 -1
  29. package/dist/collection/components/accordion/accordion.js +1 -1
  30. package/dist/collection/components/accordion/components/accordion-section.css +60 -10
  31. package/dist/collection/components/accordion/components/accordion-section.js +41 -100
  32. package/dist/collection/components/action-list/action-list.css +25 -0
  33. package/dist/collection/components/action-list/action-list.js +42 -0
  34. package/dist/collection/components/action-list/components/action-list-item.css +81 -0
  35. package/dist/collection/components/action-list/components/action-list-item.js +120 -0
  36. package/dist/collection/components/annotation-output/annotation-output.js +1 -1
  37. package/dist/collection/components/card-container/card-container.css +15 -1
  38. package/dist/collection/components/date-picker/date-picker.css +1 -1
  39. package/dist/collection/components/date-picker/date-picker.js +1 -1
  40. package/dist/collection/components/dropdown-menu/dropdown-menu.js +36 -1
  41. package/dist/collection/components/expandable/expandable.css +12 -1
  42. package/dist/collection/components/expandable/expandable.interfaces.js +3 -0
  43. package/dist/collection/components/expandable/expandable.js +246 -2
  44. package/dist/collection/components/expandable-heading/expandable-heading.css +34 -0
  45. package/dist/collection/components/expandable-heading/expandable-heading.js +28 -2
  46. package/dist/collection/components/header/header.js +18 -2
  47. package/dist/collection/components/label/label.js +1 -8
  48. package/dist/collection/components/list-button/list-button.css +2 -2
  49. package/dist/collection/components/modal/modal-ref.js +18 -0
  50. package/dist/collection/components/modal/modal.controller.js +47 -0
  51. package/dist/collection/components/modal/modal.js +3 -7
  52. package/dist/collection/components/ozon-content/ozon-content.css +8 -0
  53. package/dist/collection/components/selectable/selectable.css +22 -9
  54. package/dist/collection/components/selectable/selectable.js +2 -1
  55. package/dist/collection/components/tooltip/tooltip.js +13 -11
  56. package/dist/collection/index.js +2 -0
  57. package/dist/components/dropdown-menu.js +17 -1
  58. package/dist/components/dso-accordion-section.js +52 -1407
  59. package/dist/components/dso-action-list-item.d.ts +11 -0
  60. package/dist/components/dso-action-list-item.js +53 -0
  61. package/dist/components/dso-action-list.d.ts +11 -0
  62. package/dist/components/dso-action-list.js +36 -0
  63. package/dist/components/dso-annotation-output.js +1 -1
  64. package/dist/components/dso-card-container.js +1 -1
  65. package/dist/components/dso-date-picker.js +2 -2
  66. package/dist/components/dso-expandable-heading.js +9 -4
  67. package/dist/components/dso-header.js +18 -2
  68. package/dist/components/dso-label.js +1 -8
  69. package/dist/components/dso-list-button.js +1 -1
  70. package/dist/components/dso-ozon-content.js +1 -1
  71. package/dist/components/expandable.js +1440 -4
  72. package/dist/components/focus-trap.esm.js +133 -50
  73. package/dist/components/has-overflow.js +3 -4
  74. package/dist/components/index.d.ts +2 -0
  75. package/dist/components/index.esm.js +97 -17
  76. package/dist/components/index.js +71 -1
  77. package/dist/components/selectable.js +3 -2
  78. package/dist/components/tooltip.js +13 -11
  79. package/dist/dso-toolkit/dso-toolkit.esm.js +1 -1
  80. package/dist/dso-toolkit/index.esm.js +1 -1
  81. package/dist/dso-toolkit/{p-e4f667b3.entry.js → p-0b6fa7d3.entry.js} +1 -1
  82. package/dist/dso-toolkit/p-36224d6f.entry.js +1 -0
  83. package/dist/dso-toolkit/{p-9b07b034.entry.js → p-398a8e0b.entry.js} +1 -1
  84. package/dist/dso-toolkit/p-3b91c3e9.entry.js +1 -0
  85. package/dist/dso-toolkit/p-452b1234.js +1 -0
  86. package/dist/dso-toolkit/p-5950644a.js +5 -0
  87. package/dist/dso-toolkit/p-5de8b79a.entry.js +1 -0
  88. package/dist/dso-toolkit/p-5e50b616.entry.js +1 -0
  89. package/dist/dso-toolkit/p-69f37ab3.entry.js +1 -0
  90. package/dist/dso-toolkit/p-6a99d7f8.entry.js +1 -0
  91. package/dist/dso-toolkit/p-8a77030b.entry.js +1 -0
  92. package/dist/dso-toolkit/p-91963e3d.js +5 -0
  93. package/dist/dso-toolkit/p-96f44d35.entry.js +1 -0
  94. package/dist/dso-toolkit/p-975c172a.entry.js +1 -0
  95. package/dist/dso-toolkit/{p-092dde2f.entry.js → p-a1616935.entry.js} +1 -1
  96. package/dist/dso-toolkit/{p-ba330644.entry.js → p-bb90ea4c.entry.js} +1 -1
  97. package/dist/dso-toolkit/p-bf750b97.js +1 -0
  98. package/dist/dso-toolkit/{p-aab458c4.entry.js → p-c86a5bcb.entry.js} +1 -1
  99. package/dist/dso-toolkit/{p-f2b76233.entry.js → p-cf9b79df.entry.js} +1 -1
  100. package/dist/dso-toolkit/{p-43f3d736.entry.js → p-d10ec2b3.entry.js} +1 -1
  101. package/dist/dso-toolkit/p-e8a6ccf5.entry.js +1 -0
  102. package/dist/dso-toolkit/p-eaae698e.entry.js +1 -0
  103. package/dist/dso-toolkit/p-fa2f1a1c.entry.js +1 -0
  104. package/dist/dso-toolkit/p-fe7ca25f.entry.js +1 -0
  105. package/dist/esm/dso-accordion-section.entry.js +39 -1404
  106. package/dist/esm/dso-action-list-item.entry.js +23 -0
  107. package/dist/esm/dso-action-list.entry.js +16 -0
  108. package/dist/esm/dso-annotation-output.entry.js +1 -1
  109. package/dist/esm/dso-card-container.entry.js +1 -1
  110. package/dist/esm/dso-date-picker.entry.js +1 -1
  111. package/dist/esm/dso-dropdown-menu.entry.js +18 -3
  112. package/dist/esm/dso-expandable-heading.entry.js +7 -3
  113. package/dist/esm/dso-expandable.entry.js +1434 -3
  114. package/dist/esm/dso-header.entry.js +16 -1
  115. package/dist/esm/dso-helpcenter-panel.entry.js +2 -2
  116. package/dist/esm/dso-image-overlay.entry.js +2 -2
  117. package/dist/esm/dso-info_2.entry.js +3 -2
  118. package/dist/esm/dso-label.entry.js +1 -8
  119. package/dist/esm/dso-list-button.entry.js +3 -3
  120. package/dist/esm/dso-modal.entry.js +2 -2
  121. package/dist/esm/dso-ozon-content.entry.js +2 -2
  122. package/dist/esm/dso-table.entry.js +2 -2
  123. package/dist/esm/dso-toolkit.js +1 -1
  124. package/dist/esm/dso-tooltip.entry.js +14 -12
  125. package/dist/esm/dso-viewer-grid.entry.js +2 -2
  126. package/dist/esm/expandable.interfaces-9b1afbe8.js +5 -0
  127. package/dist/esm/{focus-trap.esm-94794d92.js → focus-trap.esm-2a49a38f.js} +134 -51
  128. package/dist/esm/{has-overflow-c44a8a0a.js → has-overflow-fdc85d8f.js} +3 -4
  129. package/dist/esm/{index.esm-8fc07ad8.js → index.esm-3d6c8190.js} +97 -17
  130. package/dist/esm/index.js +69 -0
  131. package/dist/esm/loader.js +1 -1
  132. package/dist/types/components/accordion/accordion.interfaces.d.ts +1 -1
  133. package/dist/types/components/accordion/components/accordion-section.d.ts +4 -8
  134. package/dist/types/components/action-list/action-list.d.ts +5 -0
  135. package/dist/types/components/action-list/components/action-list-item.d.ts +15 -0
  136. package/dist/types/components/dropdown-menu/dropdown-menu.d.ts +5 -0
  137. package/dist/types/components/expandable/expandable.d.ts +25 -1
  138. package/dist/types/components/expandable/expandable.interfaces.d.ts +10 -0
  139. package/dist/types/components/expandable-heading/expandable-heading.d.ts +2 -1
  140. package/dist/types/components/expandable-heading/expandable-heading.interfaces.d.ts +1 -0
  141. package/dist/types/components/header/header.d.ts +3 -0
  142. package/dist/types/components/label/label.d.ts +0 -1
  143. package/dist/types/components/modal/modal-ref.d.ts +8 -0
  144. package/dist/types/components/modal/modal.controller.d.ts +6 -0
  145. package/dist/types/components/modal/modal.d.ts +1 -2
  146. package/dist/types/components/modal/modal.interfaces.d.ts +12 -0
  147. package/dist/types/components.d.ts +82 -4
  148. package/dist/types/index.d.ts +2 -0
  149. package/package.json +11 -11
  150. package/dist/dso-toolkit/p-0fcdc369.entry.js +0 -1
  151. package/dist/dso-toolkit/p-147ec7bd.entry.js +0 -1
  152. package/dist/dso-toolkit/p-22f9240a.entry.js +0 -1
  153. package/dist/dso-toolkit/p-3635427a.js +0 -5
  154. package/dist/dso-toolkit/p-3b83e9c6.entry.js +0 -1
  155. package/dist/dso-toolkit/p-452c7fbb.entry.js +0 -1
  156. package/dist/dso-toolkit/p-4ae40ddc.entry.js +0 -1
  157. package/dist/dso-toolkit/p-4c8426b7.entry.js +0 -1
  158. package/dist/dso-toolkit/p-57ceabab.js +0 -5
  159. package/dist/dso-toolkit/p-9984079e.entry.js +0 -1
  160. package/dist/dso-toolkit/p-cece17a5.entry.js +0 -1
  161. package/dist/dso-toolkit/p-d3ed00f6.js +0 -1
  162. package/dist/dso-toolkit/p-e3bd7689.entry.js +0 -1
  163. package/dist/dso-toolkit/p-f3f0d6c9.entry.js +0 -1
@@ -0,0 +1,81 @@
1
+ *,
2
+ *::after,
3
+ *::before {
4
+ box-sizing: border-box;
5
+ }
6
+
7
+ :host {
8
+ display: block;
9
+ padding-block: 16px;
10
+ position: relative;
11
+ }
12
+ :host.dso-has-counter {
13
+ padding-top: 2.5rem;
14
+ position: relative;
15
+ }
16
+ :host .dso-step-counter {
17
+ background-color: #275937;
18
+ border: 8px solid #79b929;
19
+ border-radius: 50%;
20
+ box-sizing: content-box;
21
+ color: #fff;
22
+ font-size: 1.25rem;
23
+ font-weight: 500;
24
+ height: 2rem;
25
+ left: 16px;
26
+ line-height: 2rem;
27
+ position: absolute;
28
+ text-align: center;
29
+ top: -1.5rem;
30
+ width: 2rem;
31
+ }
32
+ :host .dso-step-counter svg.di {
33
+ height: 1.5rem;
34
+ margin-top: 0.25rem;
35
+ width: 1.5rem;
36
+ }
37
+ :host > dso-icon {
38
+ vertical-align: text-top;
39
+ }
40
+
41
+ :host(.divider) .dso-action-list-item::after {
42
+ border-bottom: 0.25rem dashed #6ca4d9;
43
+ bottom: 0;
44
+ content: "";
45
+ display: block;
46
+ height: 24px;
47
+ left: 80px;
48
+ position: absolute;
49
+ width: calc(100% + 16px);
50
+ }
51
+
52
+ h3 {
53
+ color: #275937;
54
+ color: #275937;
55
+ font-size: 1.25rem;
56
+ font-weight: 600;
57
+ margin-block-end: 16px;
58
+ margin-block-start: 0;
59
+ min-height: 48px;
60
+ padding-block-start: 9px;
61
+ }
62
+
63
+ .dso-action-list-item {
64
+ display: grid;
65
+ grid-template-columns: 80px 1fr;
66
+ }
67
+ .dso-action-list-item .dso-step-counter {
68
+ position: unset;
69
+ }
70
+ .dso-action-list-item .dso-step-counter,
71
+ .dso-action-list-item dso-icon {
72
+ margin-inline-start: 8px;
73
+ }
74
+ .dso-action-list-item .action-list-item-content {
75
+ grid-column: 2/2;
76
+ }
77
+
78
+ dso-icon {
79
+ height: 48px;
80
+ width: 48px;
81
+ }
@@ -0,0 +1,120 @@
1
+ import { h, Host } from "@stencil/core";
2
+ export class ActionListItem {
3
+ constructor() {
4
+ this.step = undefined;
5
+ this.itemTitle = undefined;
6
+ this.flowLine = false;
7
+ this.warning = false;
8
+ this.divider = false;
9
+ }
10
+ render() {
11
+ return (h(Host, { class: {
12
+ divider: this.divider,
13
+ "flow-line": this.flowLine,
14
+ } }, h("div", { class: "dso-action-list-item" }, this.warning ? h("dso-icon", { icon: "status-warning" }) : h("div", { class: "dso-step-counter" }, this.step), h("div", { class: "action-list-item-content" }, this.itemTitle && h("h3", null, this.itemTitle), h("slot", null)))));
15
+ }
16
+ static get is() { return "dso-action-list-item"; }
17
+ static get encapsulation() { return "shadow"; }
18
+ static get originalStyleUrls() {
19
+ return {
20
+ "$": ["action-list-item.scss"]
21
+ };
22
+ }
23
+ static get styleUrls() {
24
+ return {
25
+ "$": ["action-list-item.css"]
26
+ };
27
+ }
28
+ static get properties() {
29
+ return {
30
+ "step": {
31
+ "type": "number",
32
+ "mutable": false,
33
+ "complexType": {
34
+ "original": "number",
35
+ "resolved": "number",
36
+ "references": {}
37
+ },
38
+ "required": true,
39
+ "optional": false,
40
+ "docs": {
41
+ "tags": [],
42
+ "text": ""
43
+ },
44
+ "attribute": "step",
45
+ "reflect": false
46
+ },
47
+ "itemTitle": {
48
+ "type": "string",
49
+ "mutable": false,
50
+ "complexType": {
51
+ "original": "string",
52
+ "resolved": "string | undefined",
53
+ "references": {}
54
+ },
55
+ "required": false,
56
+ "optional": true,
57
+ "docs": {
58
+ "tags": [],
59
+ "text": ""
60
+ },
61
+ "attribute": "item-title",
62
+ "reflect": false
63
+ },
64
+ "flowLine": {
65
+ "type": "boolean",
66
+ "mutable": false,
67
+ "complexType": {
68
+ "original": "boolean",
69
+ "resolved": "boolean",
70
+ "references": {}
71
+ },
72
+ "required": false,
73
+ "optional": false,
74
+ "docs": {
75
+ "tags": [],
76
+ "text": "Show flow line to next step"
77
+ },
78
+ "attribute": "flow-line",
79
+ "reflect": false,
80
+ "defaultValue": "false"
81
+ },
82
+ "warning": {
83
+ "type": "boolean",
84
+ "mutable": false,
85
+ "complexType": {
86
+ "original": "boolean",
87
+ "resolved": "boolean",
88
+ "references": {}
89
+ },
90
+ "required": false,
91
+ "optional": false,
92
+ "docs": {
93
+ "tags": [],
94
+ "text": ""
95
+ },
96
+ "attribute": "warning",
97
+ "reflect": false,
98
+ "defaultValue": "false"
99
+ },
100
+ "divider": {
101
+ "type": "boolean",
102
+ "mutable": false,
103
+ "complexType": {
104
+ "original": "boolean",
105
+ "resolved": "boolean",
106
+ "references": {}
107
+ },
108
+ "required": false,
109
+ "optional": false,
110
+ "docs": {
111
+ "tags": [],
112
+ "text": "Places a dashed line at the bottom of the item."
113
+ },
114
+ "attribute": "divider",
115
+ "reflect": false,
116
+ "defaultValue": "false"
117
+ }
118
+ };
119
+ }
120
+ }
@@ -17,7 +17,7 @@ export class AnnotationOutput {
17
17
  }
18
18
  render() {
19
19
  const expandableProperties = AnnotationService.state[this.identifier] ? { open: true } : {};
20
- return (h("dso-responsive-element", null, h("dso-expandable", Object.assign({ id: this.identifier }, expandableProperties), this.annotationPrefix && h("span", { class: "dso-annotation-prefix" }, this.annotationPrefix), h("div", { class: "dso-annotation-header" }, h("slot", { name: "title" }), h("slot", { name: "addons" }), h("button", { type: "button", class: "dso-tertiary dso-annotation-close-button", onClick: (e) => this.toggleHandler(e) }, h("dso-icon", { icon: "times" }), h("span", { class: "sr-only" }, "Toelichting sluiten"))), h("div", { class: "dso-annotation-content" }, h("slot", null)))));
20
+ return (h("dso-responsive-element", null, h("dso-expandable", Object.assign({ id: this.identifier }, expandableProperties), h("div", { slot: "expandable-content" }, this.annotationPrefix && h("span", { class: "dso-annotation-prefix" }, this.annotationPrefix), h("div", { class: "dso-annotation-header" }, h("slot", { name: "title" }), h("slot", { name: "addons" }), h("button", { type: "button", class: "dso-tertiary dso-annotation-close-button", onClick: (e) => this.toggleHandler(e) }, h("dso-icon", { icon: "times" }), h("span", { class: "sr-only" }, "Toelichting sluiten"))), h("div", { class: "dso-annotation-content" }, h("slot", null))))));
21
21
  }
22
22
  static get is() { return "dso-annotation-output"; }
23
23
  static get originalStyleUrls() {
@@ -7,6 +7,20 @@
7
7
  :host .dso-card-grid {
8
8
  display: grid;
9
9
  gap: 32px;
10
- grid-template-columns: repeat(3, 1fr);
11
10
  grid-auto-rows: 1fr;
11
+ }
12
+ @media (max-width: 991px) {
13
+ :host .dso-card-grid {
14
+ grid-template-columns: repeat(1, 1fr);
15
+ }
16
+ }
17
+ @media (min-width: 992px) and (max-width: 1199px) {
18
+ :host .dso-card-grid {
19
+ grid-template-columns: repeat(2, 1fr);
20
+ }
21
+ }
22
+ @media (min-width: 1200px) {
23
+ :host .dso-card-grid {
24
+ grid-template-columns: repeat(3, 1fr);
25
+ }
12
26
  }
@@ -1,7 +1,7 @@
1
1
  :host {
2
2
  display: block;
3
3
  }
4
- :host[invalid] .dso-date__input {
4
+ :host[invalid]:not([invalid=false]) .dso-date__input {
5
5
  border-color: #ce3f51;
6
6
  }
7
7
 
@@ -562,7 +562,7 @@ export class DsoDatePicker {
562
562
  "text": "Is input invalid?"
563
563
  },
564
564
  "attribute": "invalid",
565
- "reflect": false
565
+ "reflect": true
566
566
  },
567
567
  "dsoAutofocus": {
568
568
  "type": "boolean",
@@ -40,6 +40,7 @@ export class DropdownMenu {
40
40
  };
41
41
  this.open = false;
42
42
  this.dropdownAlign = "left";
43
+ this.dropdownOptionsOffset = 2;
43
44
  this.checkable = false;
44
45
  this.boundary = undefined;
45
46
  this.strategy = "auto";
@@ -52,6 +53,19 @@ export class DropdownMenu {
52
53
  placement: this.dropdownAlign === "right" ? "bottom-end" : "bottom-start",
53
54
  });
54
55
  }
56
+ watchOptionsOffset() {
57
+ var _a;
58
+ (_a = this.popper) === null || _a === void 0 ? void 0 : _a.setOptions({
59
+ modifiers: [
60
+ {
61
+ name: "offset",
62
+ options: {
63
+ offset: [0, this.dropdownOptionsOffset],
64
+ },
65
+ },
66
+ ],
67
+ });
68
+ }
55
69
  watchStrategy() {
56
70
  this.setStrategy();
57
71
  }
@@ -124,7 +138,7 @@ export class DropdownMenu {
124
138
  {
125
139
  name: "offset",
126
140
  options: {
127
- offset: [0, 2], // 2px margin between button and options
141
+ offset: [0, this.dropdownOptionsOffset],
128
142
  },
129
143
  },
130
144
  {
@@ -242,6 +256,24 @@ export class DropdownMenu {
242
256
  "reflect": false,
243
257
  "defaultValue": "\"left\""
244
258
  },
259
+ "dropdownOptionsOffset": {
260
+ "type": "number",
261
+ "mutable": false,
262
+ "complexType": {
263
+ "original": "number",
264
+ "resolved": "number",
265
+ "references": {}
266
+ },
267
+ "required": false,
268
+ "optional": false,
269
+ "docs": {
270
+ "tags": [],
271
+ "text": "Space between button and dropdown options"
272
+ },
273
+ "attribute": "dropdown-options-offset",
274
+ "reflect": false,
275
+ "defaultValue": "2"
276
+ },
245
277
  "checkable": {
246
278
  "type": "boolean",
247
279
  "mutable": false,
@@ -302,6 +334,9 @@ export class DropdownMenu {
302
334
  return [{
303
335
  "propName": "dropdownAlign",
304
336
  "methodName": "watchPosition"
337
+ }, {
338
+ "propName": "dropdownOptionsOffset",
339
+ "methodName": "watchOptionsOffset"
305
340
  }, {
306
341
  "propName": "strategy",
307
342
  "methodName": "watchStrategy"
@@ -1,9 +1,20 @@
1
1
  :host {
2
+ display: block;
3
+ overflow-y: hidden;
4
+ }
5
+
6
+ :host(.dso-hide) {
2
7
  display: none;
3
8
  }
4
9
 
10
+ :host(:not(.dso-animate-ready)) {
11
+ position: absolute;
12
+ visibility: hidden;
13
+ }
14
+
5
15
  :host([open]) {
6
- display: block;
16
+ position: inherit;
17
+ visibility: inherit;
7
18
  }
8
19
 
9
20
  *,
@@ -0,0 +1,3 @@
1
+ export function isExpandable(element) {
2
+ return element instanceof HTMLElement && "getAnimeInstance" in element;
3
+ }
@@ -1,10 +1,127 @@
1
- import { h, Host } from "@stencil/core";
1
+ import { h, Host, } from "@stencil/core";
2
+ import anime from "animejs";
3
+ import clsx from "clsx";
4
+ import debounce from "debounce";
2
5
  export class Expandable {
3
6
  constructor() {
4
7
  this.open = undefined;
8
+ this.enableAnimation = false;
9
+ this.minimumHeight = undefined;
10
+ this.animationReady = false;
11
+ }
12
+ toggleOpen() {
13
+ if (this.enableAnimation) {
14
+ this.activateAnimation();
15
+ }
16
+ }
17
+ toggleEnableAnimation(enableAnimation) {
18
+ var _a;
19
+ if (enableAnimation) {
20
+ this.prepareAnimationResizeObserver();
21
+ this.activateObserver();
22
+ }
23
+ else {
24
+ (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
25
+ delete this.animeInstance;
26
+ this.host.removeAttribute("style");
27
+ }
28
+ }
29
+ async getAnimeInstance() {
30
+ return this.animeInstance;
31
+ }
32
+ async getBodyHeight() {
33
+ return this.bodyHeight;
34
+ }
35
+ componentWillLoad() {
36
+ if (this.enableAnimation) {
37
+ this.prepareAnimationResizeObserver();
38
+ }
39
+ }
40
+ componentDidLoad() {
41
+ this.activateObserver();
42
+ }
43
+ activateObserver() {
44
+ var _a;
45
+ const bodyContentElement = this.host.querySelector(`[slot="expandable-content"]`);
46
+ if (bodyContentElement) {
47
+ (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.observe(bodyContentElement);
48
+ }
49
+ }
50
+ disconnectedCallback() {
51
+ var _a;
52
+ (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
5
53
  }
6
54
  render() {
7
- return (h(Host, { "aria-hidden": this.open ? "false" : "true" }, h("slot", null)));
55
+ return (h(Host, { "aria-hidden": this.open ? "false" : "true", class: clsx({
56
+ "dso-animate-ready": this.enableAnimation && this.animationReady,
57
+ "dso-hide": !this.enableAnimation && !this.open,
58
+ }) }, h("slot", { name: "expandable-content" })));
59
+ }
60
+ prepareAnimationResizeObserver() {
61
+ this.resizeObserver = new ResizeObserver(debounce(([entry]) => {
62
+ // entry.contentRect does not include padding, so we use getBoundingClientRect.
63
+ const height = entry.target.getBoundingClientRect().height;
64
+ if (this.bodyHeight !== height) {
65
+ this.bodyHeight = height;
66
+ }
67
+ this.instantiateAnimation();
68
+ }, 150));
69
+ }
70
+ instantiateAnimation() {
71
+ var _a;
72
+ this.animeInstance = anime({
73
+ targets: this.host,
74
+ height: (_a = this.minimumHeight) !== null && _a !== void 0 ? _a : 0,
75
+ easing: "cubicBezier(0.4, 0, 0.2, 1)",
76
+ duration: 260,
77
+ autoplay: false,
78
+ direction: "normal",
79
+ begin: () => {
80
+ if (this.host) {
81
+ if (this.open) {
82
+ this.host.style.visibility = "";
83
+ this.host.style.position = "";
84
+ this.host.style.bottom = "";
85
+ }
86
+ }
87
+ },
88
+ complete: () => {
89
+ if (this.host) {
90
+ this.host.style.height = "";
91
+ if (!this.open) {
92
+ this.host.style.visibility = "hidden";
93
+ this.host.style.position = "absolute";
94
+ this.host.style.bottom = "100%";
95
+ }
96
+ }
97
+ },
98
+ });
99
+ if (!this.open) {
100
+ this.animeInstance.reverse();
101
+ this.animeInstance.play();
102
+ }
103
+ if (this.host) {
104
+ this.host.style.height = "";
105
+ }
106
+ this.animationReady = !!this.animeInstance;
107
+ this.animationInstantiated.emit();
108
+ }
109
+ activateAnimation() {
110
+ if (this.animeInstance) {
111
+ if (this.animeInstance.progress > 0 && this.animeInstance.progress < 100) {
112
+ this.animeInstance.reverse();
113
+ }
114
+ else {
115
+ if (this.open) {
116
+ this.animeInstance.direction = "reverse";
117
+ this.animeInstance.play();
118
+ }
119
+ else {
120
+ this.animeInstance.direction = "normal";
121
+ this.animeInstance.play();
122
+ }
123
+ }
124
+ }
8
125
  }
9
126
  static get is() { return "dso-expandable"; }
10
127
  static get encapsulation() { return "shadow"; }
@@ -36,7 +153,134 @@ export class Expandable {
36
153
  },
37
154
  "attribute": "open",
38
155
  "reflect": true
156
+ },
157
+ "enableAnimation": {
158
+ "type": "boolean",
159
+ "mutable": false,
160
+ "complexType": {
161
+ "original": "boolean",
162
+ "resolved": "boolean",
163
+ "references": {}
164
+ },
165
+ "required": false,
166
+ "optional": false,
167
+ "docs": {
168
+ "tags": [],
169
+ "text": ""
170
+ },
171
+ "attribute": "enable-animation",
172
+ "reflect": false,
173
+ "defaultValue": "false"
174
+ },
175
+ "minimumHeight": {
176
+ "type": "number",
177
+ "mutable": false,
178
+ "complexType": {
179
+ "original": "number",
180
+ "resolved": "number | undefined",
181
+ "references": {}
182
+ },
183
+ "required": false,
184
+ "optional": true,
185
+ "docs": {
186
+ "tags": [],
187
+ "text": "When enableAnimation is set to `true`, this property specifies the height of this element at which the animation will expand from / collapse to"
188
+ },
189
+ "attribute": "minimum-height",
190
+ "reflect": false
191
+ }
192
+ };
193
+ }
194
+ static get states() {
195
+ return {
196
+ "animationReady": {}
197
+ };
198
+ }
199
+ static get events() {
200
+ return [{
201
+ "method": "dsoToggle",
202
+ "name": "dsoToggle",
203
+ "bubbles": true,
204
+ "cancelable": true,
205
+ "composed": true,
206
+ "docs": {
207
+ "tags": [],
208
+ "text": ""
209
+ },
210
+ "complexType": {
211
+ "original": "ExpandableToggleEvent",
212
+ "resolved": "ExpandableToggleEvent",
213
+ "references": {
214
+ "ExpandableToggleEvent": {
215
+ "location": "import",
216
+ "path": "./expandable.interfaces"
217
+ }
218
+ }
219
+ }
220
+ }, {
221
+ "method": "animationInstantiated",
222
+ "name": "animationInstantiated",
223
+ "bubbles": true,
224
+ "cancelable": true,
225
+ "composed": true,
226
+ "docs": {
227
+ "tags": [],
228
+ "text": ""
229
+ },
230
+ "complexType": {
231
+ "original": "void",
232
+ "resolved": "void",
233
+ "references": {}
234
+ }
235
+ }];
236
+ }
237
+ static get methods() {
238
+ return {
239
+ "getAnimeInstance": {
240
+ "complexType": {
241
+ "signature": "() => Promise<anime.AnimeInstance | undefined>",
242
+ "parameters": [],
243
+ "references": {
244
+ "Promise": {
245
+ "location": "global"
246
+ },
247
+ "anime": {
248
+ "location": "global"
249
+ }
250
+ },
251
+ "return": "Promise<AnimeInstance | undefined>"
252
+ },
253
+ "docs": {
254
+ "text": "",
255
+ "tags": []
256
+ }
257
+ },
258
+ "getBodyHeight": {
259
+ "complexType": {
260
+ "signature": "() => Promise<number | undefined>",
261
+ "parameters": [],
262
+ "references": {
263
+ "Promise": {
264
+ "location": "global"
265
+ }
266
+ },
267
+ "return": "Promise<number | undefined>"
268
+ },
269
+ "docs": {
270
+ "text": "",
271
+ "tags": []
272
+ }
39
273
  }
40
274
  };
41
275
  }
276
+ static get elementRef() { return "host"; }
277
+ static get watchers() {
278
+ return [{
279
+ "propName": "open",
280
+ "methodName": "toggleOpen"
281
+ }, {
282
+ "propName": "enableAnimation",
283
+ "methodName": "toggleEnableAnimation"
284
+ }];
285
+ }
42
286
  }
@@ -92,8 +92,29 @@ h6,
92
92
  line-height: 1.5;
93
93
  }
94
94
 
95
+ ins {
96
+ background-color: #e4f1d4;
97
+ box-shadow: 0 1px 3px 1px rgba(0, 0, 0, 0.25);
98
+ color: #000;
99
+ text-decoration: none;
100
+ }
101
+
95
102
  :host {
96
103
  display: block;
104
+ margin-inline: -8px;
105
+ padding-inline: 8px;
106
+ }
107
+
108
+ :host(.dso-del) {
109
+ background-color: #f5d8dc;
110
+ color: #000;
111
+ text-decoration: line-through;
112
+ }
113
+
114
+ :host(.dso-ins) {
115
+ background-color: #e4f1d4;
116
+ box-shadow: 0 1px 3px 1px rgba(0, 0, 0, 0.25);
117
+ color: #000;
97
118
  }
98
119
 
99
120
  *,
@@ -113,6 +134,19 @@ h6,
113
134
  border: 0;
114
135
  }
115
136
 
137
+ .dso-edit-action-text {
138
+ margin-bottom: 8px;
139
+ margin-top: -8px;
140
+ }
141
+ .dso-edit-action-text span {
142
+ display: inline-block;
143
+ font-style: italic;
144
+ }
145
+ .dso-edit-action-text + .expandable-heading {
146
+ margin-top: 0;
147
+ padding-top: 0;
148
+ }
149
+
116
150
  .expandable-heading {
117
151
  align-items: center;
118
152
  display: flex;