@dso-toolkit/core 33.3.0 → 34.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 (146) hide show
  1. package/dist/cjs/dso-alert.cjs.entry.js +1 -1
  2. package/dist/cjs/dso-attachments-counter.cjs.entry.js +2 -2
  3. package/dist/cjs/dso-autosuggest.cjs.entry.js +1 -1
  4. package/dist/cjs/dso-badge.cjs.entry.js +1 -1
  5. package/dist/cjs/dso-banner.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 +4 -228
  8. package/dist/cjs/dso-header.cjs.entry.js +2 -2
  9. package/dist/cjs/dso-helpcenter-panel.cjs.entry.js +1 -1
  10. package/dist/cjs/dso-highlight-box.cjs.entry.js +1 -1
  11. package/dist/cjs/dso-icon.cjs.entry.js +1 -1
  12. package/dist/cjs/dso-info-button.cjs.entry.js +1 -1
  13. package/dist/cjs/dso-info_2.cjs.entry.js +2 -2
  14. package/dist/cjs/dso-label.cjs.entry.js +1 -1
  15. package/dist/cjs/dso-map-base-layers.cjs.entry.js +5 -3
  16. package/dist/cjs/dso-map-controls.cjs.entry.js +1 -1
  17. package/dist/cjs/dso-map-overlays.cjs.entry.js +5 -3
  18. package/dist/cjs/dso-ozon-content.cjs.entry.js +1 -1
  19. package/dist/cjs/dso-progress-bar.cjs.entry.js +1 -1
  20. package/dist/cjs/dso-progress-indicator.cjs.entry.js +1 -1
  21. package/dist/cjs/dso-toggletip.cjs.entry.js +1 -1
  22. package/dist/cjs/dso-toolkit.cjs.js +2 -2
  23. package/dist/cjs/dso-tooltip.cjs.entry.js +1 -1
  24. package/dist/cjs/dso-tree-view.cjs.entry.js +2 -2
  25. package/dist/cjs/dso-viewer-grid.cjs.entry.js +778 -0
  26. package/dist/cjs/{index-fcdfdd38.js → index-5ea63531.js} +26 -2
  27. package/dist/cjs/index.esm-2ac7081c.js +267 -0
  28. package/dist/cjs/loader.cjs.js +2 -2
  29. package/dist/collection/collection-manifest.json +2 -1
  30. package/dist/collection/components/alert/alert.css +0 -3
  31. package/dist/collection/components/anchor/anchor.template.js +17 -0
  32. package/dist/collection/components/attachments-counter/attachments-counter.css +0 -4
  33. package/dist/collection/components/autosuggest/autosuggest.css +0 -3
  34. package/dist/collection/components/badge/badge.css +0 -3
  35. package/dist/collection/components/banner/banner.css +0 -3
  36. package/dist/collection/components/button/button.template.js +48 -0
  37. package/dist/collection/components/context/context.template.js +42 -0
  38. package/dist/collection/components/date-picker/date-picker.css +0 -3
  39. package/dist/collection/components/definition-list/definition-list.template.js +36 -0
  40. package/dist/collection/components/dropdown-menu/dropdown-menu.css +0 -3
  41. package/dist/collection/components/header/header.css +0 -6
  42. package/dist/collection/components/helpcenter-panel/helpcenter-panel.css +0 -3
  43. package/dist/collection/components/highlight-box/highlight-box.css +0 -3
  44. package/dist/collection/components/icon/icon.css +0 -4
  45. package/dist/collection/components/info/info.css +1 -4
  46. package/dist/collection/components/info-button/info-button.css +0 -3
  47. package/dist/collection/components/label/label.css +0 -3
  48. package/dist/collection/components/label-group/label-group.template.js +7 -0
  49. package/dist/collection/components/list/list.template.js +37 -0
  50. package/dist/collection/components/map-base-layers/map-base-layers.css +4 -3
  51. package/dist/collection/components/map-base-layers/map-base-layers.js +5 -1
  52. package/dist/collection/components/map-controls/map-controls.css +0 -3
  53. package/dist/collection/components/map-controls/map-controls.template.js +11 -16
  54. package/dist/collection/components/map-overlays/map-overlays.css +4 -3
  55. package/dist/collection/components/map-overlays/map-overlays.js +5 -1
  56. package/dist/collection/components/ozon-content/ozon-content.css +0 -3
  57. package/dist/collection/components/progress-bar/progress-bar.css +0 -3
  58. package/dist/collection/components/progress-indicator/progress-indicator.css +0 -3
  59. package/dist/collection/components/selectable/selectable.css +0 -3
  60. package/dist/collection/components/toggletip/toggletip.css +0 -3
  61. package/dist/collection/components/tooltip/tooltip.css +0 -3
  62. package/dist/collection/components/tree-view/tree-view.css +3 -3
  63. package/dist/collection/components/viewer-grid/viewer-grid-document-header.template.js +39 -0
  64. package/dist/collection/components/viewer-grid/viewer-grid-document-list-item.template.js +19 -0
  65. package/dist/collection/components/viewer-grid/viewer-grid-filterblok.template.js +28 -0
  66. package/dist/collection/components/viewer-grid/viewer-grid.css +251 -0
  67. package/dist/collection/components/viewer-grid/viewer-grid.js +127 -0
  68. package/dist/collection/components/viewer-grid/viewer-grid.template.js +23 -0
  69. package/dist/custom-elements/index.d.ts +6 -0
  70. package/dist/custom-elements/index.js +824 -10
  71. package/dist/dso-toolkit/dso-toolkit.css +1 -1
  72. package/dist/dso-toolkit/dso-toolkit.esm.js +1 -1
  73. package/dist/dso-toolkit/{p-22bc904d.entry.js → p-06de0fa1.entry.js} +1 -1
  74. package/dist/dso-toolkit/{p-ff767c21.entry.js → p-10aa1fba.entry.js} +1 -1
  75. package/dist/dso-toolkit/p-17f073d1.entry.js +1 -0
  76. package/dist/dso-toolkit/{p-75233655.entry.js → p-1fefbf8c.entry.js} +1 -1
  77. package/dist/dso-toolkit/{p-a52d3623.entry.js → p-20856f91.entry.js} +1 -1
  78. package/dist/dso-toolkit/{p-262858dd.entry.js → p-2b6a3dfa.entry.js} +1 -1
  79. package/dist/dso-toolkit/{p-be5682cc.entry.js → p-348414bf.entry.js} +1 -1
  80. package/dist/dso-toolkit/{p-984551a8.entry.js → p-3b493a2c.entry.js} +1 -1
  81. package/dist/dso-toolkit/{p-0a08ac9f.entry.js → p-4e573fc5.entry.js} +1 -1
  82. package/dist/dso-toolkit/{p-c9c1bc8f.entry.js → p-5037944e.entry.js} +1 -1
  83. package/dist/dso-toolkit/p-7b006b11.entry.js +1 -0
  84. package/dist/dso-toolkit/p-8bf3a60e.js +5 -0
  85. package/dist/dso-toolkit/p-8f21d07d.entry.js +5 -0
  86. package/dist/dso-toolkit/{p-83f166b3.entry.js → p-94dffa65.entry.js} +1 -1
  87. package/dist/dso-toolkit/{p-b07991b9.entry.js → p-951f5872.entry.js} +1 -1
  88. package/dist/dso-toolkit/{p-7a043467.entry.js → p-a6c9e063.entry.js} +1 -1
  89. package/dist/dso-toolkit/{p-da3be034.entry.js → p-a7306b7b.entry.js} +1 -1
  90. package/dist/dso-toolkit/p-aadc4f8e.entry.js +1 -0
  91. package/dist/dso-toolkit/p-ad2210ad.entry.js +1 -0
  92. package/dist/dso-toolkit/{p-b5b946de.entry.js → p-bc14cafd.entry.js} +1 -1
  93. package/dist/dso-toolkit/{p-4a78a31b.entry.js → p-c54ecae1.entry.js} +1 -1
  94. package/dist/dso-toolkit/{p-72e4484a.entry.js → p-c95108fe.entry.js} +1 -1
  95. package/dist/dso-toolkit/{p-e814d644.entry.js → p-daa1e29d.entry.js} +1 -1
  96. package/dist/dso-toolkit/p-dad72605.js +1 -0
  97. package/dist/dso-toolkit/{p-2e7d535c.entry.js → p-dc86d830.entry.js} +1 -1
  98. package/dist/dso-toolkit/{p-19de4cc7.entry.js → p-f0b67246.entry.js} +1 -1
  99. package/dist/esm/dso-alert.entry.js +1 -1
  100. package/dist/esm/dso-attachments-counter.entry.js +2 -2
  101. package/dist/esm/dso-autosuggest.entry.js +1 -1
  102. package/dist/esm/dso-badge.entry.js +1 -1
  103. package/dist/esm/dso-banner.entry.js +1 -1
  104. package/dist/esm/dso-date-picker.entry.js +1 -1
  105. package/dist/esm/dso-dropdown-menu.entry.js +2 -226
  106. package/dist/esm/dso-header.entry.js +2 -2
  107. package/dist/esm/dso-helpcenter-panel.entry.js +1 -1
  108. package/dist/esm/dso-highlight-box.entry.js +1 -1
  109. package/dist/esm/dso-icon.entry.js +1 -1
  110. package/dist/esm/dso-info-button.entry.js +1 -1
  111. package/dist/esm/dso-info_2.entry.js +2 -2
  112. package/dist/esm/dso-label.entry.js +1 -1
  113. package/dist/esm/dso-map-base-layers.entry.js +5 -3
  114. package/dist/esm/dso-map-controls.entry.js +1 -1
  115. package/dist/esm/dso-map-overlays.entry.js +5 -3
  116. package/dist/esm/dso-ozon-content.entry.js +1 -1
  117. package/dist/esm/dso-progress-bar.entry.js +1 -1
  118. package/dist/esm/dso-progress-indicator.entry.js +1 -1
  119. package/dist/esm/dso-toggletip.entry.js +1 -1
  120. package/dist/esm/dso-toolkit.js +2 -2
  121. package/dist/esm/dso-tooltip.entry.js +1 -1
  122. package/dist/esm/dso-tree-view.entry.js +2 -2
  123. package/dist/esm/dso-viewer-grid.entry.js +774 -0
  124. package/dist/esm/{index-61410be2.js → index-d54cae76.js} +26 -2
  125. package/dist/esm/index.esm-a1362957.js +262 -0
  126. package/dist/esm/loader.js +2 -2
  127. package/dist/types/components/anchor/anchor.template.d.ts +2 -0
  128. package/dist/types/components/button/button.template.d.ts +2 -0
  129. package/dist/types/components/context/context.template.d.ts +3 -0
  130. package/dist/types/components/definition-list/definition-list.template.d.ts +3 -0
  131. package/dist/types/components/label-group/label-group.template.d.ts +2 -0
  132. package/dist/types/components/list/list.template.d.ts +3 -0
  133. package/dist/types/components/map-base-layers/map-base-layers.interfaces.d.ts +1 -0
  134. package/dist/types/components/map-overlays/map-overlays.interfaces.d.ts +1 -0
  135. package/dist/types/components/viewer-grid/viewer-grid-document-header.template.d.ts +3 -0
  136. package/dist/types/components/viewer-grid/viewer-grid-document-list-item.template.d.ts +3 -0
  137. package/dist/types/components/viewer-grid/viewer-grid-filterblok.template.d.ts +3 -0
  138. package/dist/types/components/viewer-grid/viewer-grid.d.ts +22 -0
  139. package/dist/types/components/viewer-grid/viewer-grid.template.d.ts +3 -0
  140. package/dist/types/components.d.ts +16 -0
  141. package/package.json +2 -1
  142. package/dist/dso-toolkit/p-99b93d2e.entry.js +0 -5
  143. package/dist/dso-toolkit/p-a40eeb32.js +0 -1
  144. package/dist/dso-toolkit/p-affe82e6.entry.js +0 -1
  145. package/dist/dso-toolkit/p-b3e6d377.entry.js +0 -1
  146. package/dist/dso-toolkit/p-ec8b74f7.entry.js +0 -1
@@ -0,0 +1,774 @@
1
+ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-d54cae76.js';
2
+ import { t as tabbable, f as focusable, i as isTabbable, a as isFocusable } from './index.esm-a1362957.js';
3
+
4
+ /*!
5
+ * focus-trap 6.7.3
6
+ * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
7
+ */
8
+
9
+ function ownKeys(object, enumerableOnly) {
10
+ var keys = Object.keys(object);
11
+
12
+ if (Object.getOwnPropertySymbols) {
13
+ var symbols = Object.getOwnPropertySymbols(object);
14
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
15
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
16
+ })), keys.push.apply(keys, symbols);
17
+ }
18
+
19
+ return keys;
20
+ }
21
+
22
+ function _objectSpread2(target) {
23
+ for (var i = 1; i < arguments.length; i++) {
24
+ var source = null != arguments[i] ? arguments[i] : {};
25
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
26
+ _defineProperty(target, key, source[key]);
27
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
28
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
29
+ });
30
+ }
31
+
32
+ return target;
33
+ }
34
+
35
+ function _defineProperty(obj, key, value) {
36
+ if (key in obj) {
37
+ Object.defineProperty(obj, key, {
38
+ value: value,
39
+ enumerable: true,
40
+ configurable: true,
41
+ writable: true
42
+ });
43
+ } else {
44
+ obj[key] = value;
45
+ }
46
+
47
+ return obj;
48
+ }
49
+
50
+ var activeFocusTraps = function () {
51
+ var trapQueue = [];
52
+ return {
53
+ activateTrap: function activateTrap(trap) {
54
+ if (trapQueue.length > 0) {
55
+ var activeTrap = trapQueue[trapQueue.length - 1];
56
+
57
+ if (activeTrap !== trap) {
58
+ activeTrap.pause();
59
+ }
60
+ }
61
+
62
+ var trapIndex = trapQueue.indexOf(trap);
63
+
64
+ if (trapIndex === -1) {
65
+ trapQueue.push(trap);
66
+ } else {
67
+ // move this existing trap to the front of the queue
68
+ trapQueue.splice(trapIndex, 1);
69
+ trapQueue.push(trap);
70
+ }
71
+ },
72
+ deactivateTrap: function deactivateTrap(trap) {
73
+ var trapIndex = trapQueue.indexOf(trap);
74
+
75
+ if (trapIndex !== -1) {
76
+ trapQueue.splice(trapIndex, 1);
77
+ }
78
+
79
+ if (trapQueue.length > 0) {
80
+ trapQueue[trapQueue.length - 1].unpause();
81
+ }
82
+ }
83
+ };
84
+ }();
85
+
86
+ var isSelectableInput = function isSelectableInput(node) {
87
+ return node.tagName && node.tagName.toLowerCase() === 'input' && typeof node.select === 'function';
88
+ };
89
+
90
+ var isEscapeEvent = function isEscapeEvent(e) {
91
+ return e.key === 'Escape' || e.key === 'Esc' || e.keyCode === 27;
92
+ };
93
+
94
+ var isTabEvent = function isTabEvent(e) {
95
+ return e.key === 'Tab' || e.keyCode === 9;
96
+ };
97
+
98
+ var delay = function delay(fn) {
99
+ return setTimeout(fn, 0);
100
+ }; // Array.find/findIndex() are not supported on IE; this replicates enough
101
+ // of Array.findIndex() for our needs
102
+
103
+
104
+ var findIndex = function findIndex(arr, fn) {
105
+ var idx = -1;
106
+ arr.every(function (value, i) {
107
+ if (fn(value)) {
108
+ idx = i;
109
+ return false; // break
110
+ }
111
+
112
+ return true; // next
113
+ });
114
+ return idx;
115
+ };
116
+ /**
117
+ * Get an option's value when it could be a plain value, or a handler that provides
118
+ * the value.
119
+ * @param {*} value Option's value to check.
120
+ * @param {...*} [params] Any parameters to pass to the handler, if `value` is a function.
121
+ * @returns {*} The `value`, or the handler's returned value.
122
+ */
123
+
124
+
125
+ var valueOrHandler = function valueOrHandler(value) {
126
+ for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
127
+ params[_key - 1] = arguments[_key];
128
+ }
129
+
130
+ return typeof value === 'function' ? value.apply(void 0, params) : value;
131
+ };
132
+
133
+ var getActualTarget = function getActualTarget(event) {
134
+ // NOTE: If the trap is _inside_ a shadow DOM, event.target will always be the
135
+ // shadow host. However, event.target.composedPath() will be an array of
136
+ // nodes "clicked" from inner-most (the actual element inside the shadow) to
137
+ // outer-most (the host HTML document). If we have access to composedPath(),
138
+ // then use its first element; otherwise, fall back to event.target (and
139
+ // this only works for an _open_ shadow DOM; otherwise,
140
+ // composedPath()[0] === event.target always).
141
+ return event.target.shadowRoot && typeof event.composedPath === 'function' ? event.composedPath()[0] : event.target;
142
+ };
143
+
144
+ var createFocusTrap = function createFocusTrap(elements, userOptions) {
145
+ // SSR: a live trap shouldn't be created in this type of environment so this
146
+ // should be safe code to execute if the `document` option isn't specified
147
+ var doc = (userOptions === null || userOptions === void 0 ? void 0 : userOptions.document) || document;
148
+
149
+ var config = _objectSpread2({
150
+ returnFocusOnDeactivate: true,
151
+ escapeDeactivates: true,
152
+ delayInitialFocus: true
153
+ }, userOptions);
154
+
155
+ var state = {
156
+ // @type {Array<HTMLElement>}
157
+ containers: [],
158
+ // list of objects identifying the first and last tabbable nodes in all containers/groups in
159
+ // the trap
160
+ // NOTE: it's possible that a group has no tabbable nodes if nodes get removed while the trap
161
+ // is active, but the trap should never get to a state where there isn't at least one group
162
+ // with at least one tabbable node in it (that would lead to an error condition that would
163
+ // result in an error being thrown)
164
+ // @type {Array<{
165
+ // container: HTMLElement,
166
+ // firstTabbableNode: HTMLElement|null,
167
+ // lastTabbableNode: HTMLElement|null,
168
+ // nextTabbableNode: (node: HTMLElement, forward: boolean) => HTMLElement|undefined
169
+ // }>}
170
+ tabbableGroups: [],
171
+ nodeFocusedBeforeActivation: null,
172
+ mostRecentlyFocusedNode: null,
173
+ active: false,
174
+ paused: false,
175
+ // timer ID for when delayInitialFocus is true and initial focus in this trap
176
+ // has been delayed during activation
177
+ delayInitialFocusTimer: undefined
178
+ };
179
+ var trap; // eslint-disable-line prefer-const -- some private functions reference it, and its methods reference private functions, so we must declare here and define later
180
+
181
+ var getOption = function getOption(configOverrideOptions, optionName, configOptionName) {
182
+ return configOverrideOptions && configOverrideOptions[optionName] !== undefined ? configOverrideOptions[optionName] : config[configOptionName || optionName];
183
+ };
184
+
185
+ var containersContain = function containersContain(element) {
186
+ return !!(element && state.containers.some(function (container) {
187
+ return container.contains(element);
188
+ }));
189
+ };
190
+ /**
191
+ * Gets the node for the given option, which is expected to be an option that
192
+ * can be either a DOM node, a string that is a selector to get a node, `false`
193
+ * (if a node is explicitly NOT given), or a function that returns any of these
194
+ * values.
195
+ * @param {string} optionName
196
+ * @returns {undefined | false | HTMLElement | SVGElement} Returns
197
+ * `undefined` if the option is not specified; `false` if the option
198
+ * resolved to `false` (node explicitly not given); otherwise, the resolved
199
+ * DOM node.
200
+ * @throws {Error} If the option is set, not `false`, and is not, or does not
201
+ * resolve to a node.
202
+ */
203
+
204
+
205
+ var getNodeForOption = function getNodeForOption(optionName) {
206
+ var optionValue = config[optionName];
207
+
208
+ if (typeof optionValue === 'function') {
209
+ for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
210
+ params[_key2 - 1] = arguments[_key2];
211
+ }
212
+
213
+ optionValue = optionValue.apply(void 0, params);
214
+ }
215
+
216
+ if (!optionValue) {
217
+ if (optionValue === undefined || optionValue === false) {
218
+ return optionValue;
219
+ } // else, empty string (invalid), null (invalid), 0 (invalid)
220
+
221
+
222
+ throw new Error("`".concat(optionName, "` was specified but was not a node, or did not return a node"));
223
+ }
224
+
225
+ var node = optionValue; // could be HTMLElement, SVGElement, or non-empty string at this point
226
+
227
+ if (typeof optionValue === 'string') {
228
+ node = doc.querySelector(optionValue); // resolve to node, or null if fails
229
+
230
+ if (!node) {
231
+ throw new Error("`".concat(optionName, "` as selector refers to no known node"));
232
+ }
233
+ }
234
+
235
+ return node;
236
+ };
237
+
238
+ var getInitialFocusNode = function getInitialFocusNode() {
239
+ var node = getNodeForOption('initialFocus'); // false explicitly indicates we want no initialFocus at all
240
+
241
+ if (node === false) {
242
+ return false;
243
+ }
244
+
245
+ if (node === undefined) {
246
+ // option not specified: use fallback options
247
+ if (containersContain(doc.activeElement)) {
248
+ node = doc.activeElement;
249
+ } else {
250
+ var firstTabbableGroup = state.tabbableGroups[0];
251
+ var firstTabbableNode = firstTabbableGroup && firstTabbableGroup.firstTabbableNode; // NOTE: `fallbackFocus` option function cannot return `false` (not supported)
252
+
253
+ node = firstTabbableNode || getNodeForOption('fallbackFocus');
254
+ }
255
+ }
256
+
257
+ if (!node) {
258
+ throw new Error('Your focus-trap needs to have at least one focusable element');
259
+ }
260
+
261
+ return node;
262
+ };
263
+
264
+ var updateTabbableNodes = function updateTabbableNodes() {
265
+ state.tabbableGroups = state.containers.map(function (container) {
266
+ var tabbableNodes = tabbable(container); // NOTE: if we have tabbable nodes, we must have focusable nodes; focusable nodes
267
+ // are a superset of tabbable nodes
268
+
269
+ var focusableNodes = focusable(container);
270
+
271
+ if (tabbableNodes.length > 0) {
272
+ return {
273
+ container: container,
274
+ firstTabbableNode: tabbableNodes[0],
275
+ lastTabbableNode: tabbableNodes[tabbableNodes.length - 1],
276
+
277
+ /**
278
+ * Finds the __tabbable__ node that follows the given node in the specified direction,
279
+ * in this container, if any.
280
+ * @param {HTMLElement} node
281
+ * @param {boolean} [forward] True if going in forward tab order; false if going
282
+ * in reverse.
283
+ * @returns {HTMLElement|undefined} The next tabbable node, if any.
284
+ */
285
+ nextTabbableNode: function nextTabbableNode(node) {
286
+ var forward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
287
+ // NOTE: If tabindex is positive (in order to manipulate the tab order separate
288
+ // from the DOM order), this __will not work__ because the list of focusableNodes,
289
+ // while it contains tabbable nodes, does not sort its nodes in any order other
290
+ // than DOM order, because it can't: Where would you place focusable (but not
291
+ // tabbable) nodes in that order? They have no order, because they aren't tabbale...
292
+ // Support for positive tabindex is already broken and hard to manage (possibly
293
+ // not supportable, TBD), so this isn't going to make things worse than they
294
+ // already are, and at least makes things better for the majority of cases where
295
+ // tabindex is either 0/unset or negative.
296
+ // FYI, positive tabindex issue: https://github.com/focus-trap/focus-trap/issues/375
297
+ var nodeIdx = focusableNodes.findIndex(function (n) {
298
+ return n === node;
299
+ });
300
+
301
+ if (forward) {
302
+ return focusableNodes.slice(nodeIdx + 1).find(function (n) {
303
+ return isTabbable(n);
304
+ });
305
+ }
306
+
307
+ return focusableNodes.slice(0, nodeIdx).reverse().find(function (n) {
308
+ return isTabbable(n);
309
+ });
310
+ }
311
+ };
312
+ }
313
+
314
+ return undefined;
315
+ }).filter(function (group) {
316
+ return !!group;
317
+ }); // remove groups with no tabbable nodes
318
+ // throw if no groups have tabbable nodes and we don't have a fallback focus node either
319
+
320
+ if (state.tabbableGroups.length <= 0 && !getNodeForOption('fallbackFocus') // returning false not supported for this option
321
+ ) {
322
+ throw new Error('Your focus-trap must have at least one container with at least one tabbable node in it at all times');
323
+ }
324
+ };
325
+
326
+ var tryFocus = function tryFocus(node) {
327
+ if (node === false) {
328
+ return;
329
+ }
330
+
331
+ if (node === doc.activeElement) {
332
+ return;
333
+ }
334
+
335
+ if (!node || !node.focus) {
336
+ tryFocus(getInitialFocusNode());
337
+ return;
338
+ }
339
+
340
+ node.focus({
341
+ preventScroll: !!config.preventScroll
342
+ });
343
+ state.mostRecentlyFocusedNode = node;
344
+
345
+ if (isSelectableInput(node)) {
346
+ node.select();
347
+ }
348
+ };
349
+
350
+ var getReturnFocusNode = function getReturnFocusNode(previousActiveElement) {
351
+ var node = getNodeForOption('setReturnFocus', previousActiveElement);
352
+ return node ? node : node === false ? false : previousActiveElement;
353
+ }; // This needs to be done on mousedown and touchstart instead of click
354
+ // so that it precedes the focus event.
355
+
356
+
357
+ var checkPointerDown = function checkPointerDown(e) {
358
+ var target = getActualTarget(e);
359
+
360
+ if (containersContain(target)) {
361
+ // allow the click since it ocurred inside the trap
362
+ return;
363
+ }
364
+
365
+ if (valueOrHandler(config.clickOutsideDeactivates, e)) {
366
+ // immediately deactivate the trap
367
+ trap.deactivate({
368
+ // if, on deactivation, we should return focus to the node originally-focused
369
+ // when the trap was activated (or the configured `setReturnFocus` node),
370
+ // then assume it's also OK to return focus to the outside node that was
371
+ // just clicked, causing deactivation, as long as that node is focusable;
372
+ // if it isn't focusable, then return focus to the original node focused
373
+ // on activation (or the configured `setReturnFocus` node)
374
+ // NOTE: by setting `returnFocus: false`, deactivate() will do nothing,
375
+ // which will result in the outside click setting focus to the node
376
+ // that was clicked, whether it's focusable or not; by setting
377
+ // `returnFocus: true`, we'll attempt to re-focus the node originally-focused
378
+ // on activation (or the configured `setReturnFocus` node)
379
+ returnFocus: config.returnFocusOnDeactivate && !isFocusable(target)
380
+ });
381
+ return;
382
+ } // This is needed for mobile devices.
383
+ // (If we'll only let `click` events through,
384
+ // then on mobile they will be blocked anyways if `touchstart` is blocked.)
385
+
386
+
387
+ if (valueOrHandler(config.allowOutsideClick, e)) {
388
+ // allow the click outside the trap to take place
389
+ return;
390
+ } // otherwise, prevent the click
391
+
392
+
393
+ e.preventDefault();
394
+ }; // In case focus escapes the trap for some strange reason, pull it back in.
395
+
396
+
397
+ var checkFocusIn = function checkFocusIn(e) {
398
+ var target = getActualTarget(e);
399
+ var targetContained = containersContain(target); // In Firefox when you Tab out of an iframe the Document is briefly focused.
400
+
401
+ if (targetContained || target instanceof Document) {
402
+ if (targetContained) {
403
+ state.mostRecentlyFocusedNode = target;
404
+ }
405
+ } else {
406
+ // escaped! pull it back in to where it just left
407
+ e.stopImmediatePropagation();
408
+ tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());
409
+ }
410
+ }; // Hijack Tab events on the first and last focusable nodes of the trap,
411
+ // in order to prevent focus from escaping. If it escapes for even a
412
+ // moment it can end up scrolling the page and causing confusion so we
413
+ // kind of need to capture the action at the keydown phase.
414
+
415
+
416
+ var checkTab = function checkTab(e) {
417
+ var target = getActualTarget(e);
418
+ updateTabbableNodes();
419
+ var destinationNode = null;
420
+
421
+ if (state.tabbableGroups.length > 0) {
422
+ // make sure the target is actually contained in a group
423
+ // NOTE: the target may also be the container itself if it's focusable
424
+ // with tabIndex='-1' and was given initial focus
425
+ var containerIndex = findIndex(state.tabbableGroups, function (_ref) {
426
+ var container = _ref.container;
427
+ return container.contains(target);
428
+ });
429
+ var containerGroup = containerIndex >= 0 ? state.tabbableGroups[containerIndex] : undefined;
430
+
431
+ if (containerIndex < 0) {
432
+ // target not found in any group: quite possible focus has escaped the trap,
433
+ // so bring it back in to...
434
+ if (e.shiftKey) {
435
+ // ...the last node in the last group
436
+ destinationNode = state.tabbableGroups[state.tabbableGroups.length - 1].lastTabbableNode;
437
+ } else {
438
+ // ...the first node in the first group
439
+ destinationNode = state.tabbableGroups[0].firstTabbableNode;
440
+ }
441
+ } else if (e.shiftKey) {
442
+ // REVERSE
443
+ // is the target the first tabbable node in a group?
444
+ var startOfGroupIndex = findIndex(state.tabbableGroups, function (_ref2) {
445
+ var firstTabbableNode = _ref2.firstTabbableNode;
446
+ return target === firstTabbableNode;
447
+ });
448
+
449
+ if (startOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target) && !isTabbable(target) && !containerGroup.nextTabbableNode(target, false))) {
450
+ // an exception case where the target is either the container itself, or
451
+ // a non-tabbable node that was given focus (i.e. tabindex is negative
452
+ // and user clicked on it or node was programmatically given focus)
453
+ // and is not followed by any other tabbable node, in which
454
+ // case, we should handle shift+tab as if focus were on the container's
455
+ // first tabbable node, and go to the last tabbable node of the LAST group
456
+ startOfGroupIndex = containerIndex;
457
+ }
458
+
459
+ if (startOfGroupIndex >= 0) {
460
+ // YES: then shift+tab should go to the last tabbable node in the
461
+ // previous group (and wrap around to the last tabbable node of
462
+ // the LAST group if it's the first tabbable node of the FIRST group)
463
+ var destinationGroupIndex = startOfGroupIndex === 0 ? state.tabbableGroups.length - 1 : startOfGroupIndex - 1;
464
+ var destinationGroup = state.tabbableGroups[destinationGroupIndex];
465
+ destinationNode = destinationGroup.lastTabbableNode;
466
+ }
467
+ } else {
468
+ // FORWARD
469
+ // is the target the last tabbable node in a group?
470
+ var lastOfGroupIndex = findIndex(state.tabbableGroups, function (_ref3) {
471
+ var lastTabbableNode = _ref3.lastTabbableNode;
472
+ return target === lastTabbableNode;
473
+ });
474
+
475
+ if (lastOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target) && !isTabbable(target) && !containerGroup.nextTabbableNode(target))) {
476
+ // an exception case where the target is the container itself, or
477
+ // a non-tabbable node that was given focus (i.e. tabindex is negative
478
+ // and user clicked on it or node was programmatically given focus)
479
+ // and is not followed by any other tabbable node, in which
480
+ // case, we should handle tab as if focus were on the container's
481
+ // last tabbable node, and go to the first tabbable node of the FIRST group
482
+ lastOfGroupIndex = containerIndex;
483
+ }
484
+
485
+ if (lastOfGroupIndex >= 0) {
486
+ // YES: then tab should go to the first tabbable node in the next
487
+ // group (and wrap around to the first tabbable node of the FIRST
488
+ // group if it's the last tabbable node of the LAST group)
489
+ var _destinationGroupIndex = lastOfGroupIndex === state.tabbableGroups.length - 1 ? 0 : lastOfGroupIndex + 1;
490
+
491
+ var _destinationGroup = state.tabbableGroups[_destinationGroupIndex];
492
+ destinationNode = _destinationGroup.firstTabbableNode;
493
+ }
494
+ }
495
+ } else {
496
+ // NOTE: the fallbackFocus option does not support returning false to opt-out
497
+ destinationNode = getNodeForOption('fallbackFocus');
498
+ }
499
+
500
+ if (destinationNode) {
501
+ e.preventDefault();
502
+ tryFocus(destinationNode);
503
+ } // else, let the browser take care of [shift+]tab and move the focus
504
+
505
+ };
506
+
507
+ var checkKey = function checkKey(e) {
508
+ if (isEscapeEvent(e) && valueOrHandler(config.escapeDeactivates, e) !== false) {
509
+ e.preventDefault();
510
+ trap.deactivate();
511
+ return;
512
+ }
513
+
514
+ if (isTabEvent(e)) {
515
+ checkTab(e);
516
+ return;
517
+ }
518
+ };
519
+
520
+ var checkClick = function checkClick(e) {
521
+ if (valueOrHandler(config.clickOutsideDeactivates, e)) {
522
+ return;
523
+ }
524
+
525
+ var target = getActualTarget(e);
526
+
527
+ if (containersContain(target)) {
528
+ return;
529
+ }
530
+
531
+ if (valueOrHandler(config.allowOutsideClick, e)) {
532
+ return;
533
+ }
534
+
535
+ e.preventDefault();
536
+ e.stopImmediatePropagation();
537
+ }; //
538
+ // EVENT LISTENERS
539
+ //
540
+
541
+
542
+ var addListeners = function addListeners() {
543
+ if (!state.active) {
544
+ return;
545
+ } // There can be only one listening focus trap at a time
546
+
547
+
548
+ activeFocusTraps.activateTrap(trap); // Delay ensures that the focused element doesn't capture the event
549
+ // that caused the focus trap activation.
550
+
551
+ state.delayInitialFocusTimer = config.delayInitialFocus ? delay(function () {
552
+ tryFocus(getInitialFocusNode());
553
+ }) : tryFocus(getInitialFocusNode());
554
+ doc.addEventListener('focusin', checkFocusIn, true);
555
+ doc.addEventListener('mousedown', checkPointerDown, {
556
+ capture: true,
557
+ passive: false
558
+ });
559
+ doc.addEventListener('touchstart', checkPointerDown, {
560
+ capture: true,
561
+ passive: false
562
+ });
563
+ doc.addEventListener('click', checkClick, {
564
+ capture: true,
565
+ passive: false
566
+ });
567
+ doc.addEventListener('keydown', checkKey, {
568
+ capture: true,
569
+ passive: false
570
+ });
571
+ return trap;
572
+ };
573
+
574
+ var removeListeners = function removeListeners() {
575
+ if (!state.active) {
576
+ return;
577
+ }
578
+
579
+ doc.removeEventListener('focusin', checkFocusIn, true);
580
+ doc.removeEventListener('mousedown', checkPointerDown, true);
581
+ doc.removeEventListener('touchstart', checkPointerDown, true);
582
+ doc.removeEventListener('click', checkClick, true);
583
+ doc.removeEventListener('keydown', checkKey, true);
584
+ return trap;
585
+ }; //
586
+ // TRAP DEFINITION
587
+ //
588
+
589
+
590
+ trap = {
591
+ activate: function activate(activateOptions) {
592
+ if (state.active) {
593
+ return this;
594
+ }
595
+
596
+ var onActivate = getOption(activateOptions, 'onActivate');
597
+ var onPostActivate = getOption(activateOptions, 'onPostActivate');
598
+ var checkCanFocusTrap = getOption(activateOptions, 'checkCanFocusTrap');
599
+
600
+ if (!checkCanFocusTrap) {
601
+ updateTabbableNodes();
602
+ }
603
+
604
+ state.active = true;
605
+ state.paused = false;
606
+ state.nodeFocusedBeforeActivation = doc.activeElement;
607
+
608
+ if (onActivate) {
609
+ onActivate();
610
+ }
611
+
612
+ var finishActivation = function finishActivation() {
613
+ if (checkCanFocusTrap) {
614
+ updateTabbableNodes();
615
+ }
616
+
617
+ addListeners();
618
+
619
+ if (onPostActivate) {
620
+ onPostActivate();
621
+ }
622
+ };
623
+
624
+ if (checkCanFocusTrap) {
625
+ checkCanFocusTrap(state.containers.concat()).then(finishActivation, finishActivation);
626
+ return this;
627
+ }
628
+
629
+ finishActivation();
630
+ return this;
631
+ },
632
+ deactivate: function deactivate(deactivateOptions) {
633
+ if (!state.active) {
634
+ return this;
635
+ }
636
+
637
+ clearTimeout(state.delayInitialFocusTimer); // noop if undefined
638
+
639
+ state.delayInitialFocusTimer = undefined;
640
+ removeListeners();
641
+ state.active = false;
642
+ state.paused = false;
643
+ activeFocusTraps.deactivateTrap(trap);
644
+ var onDeactivate = getOption(deactivateOptions, 'onDeactivate');
645
+ var onPostDeactivate = getOption(deactivateOptions, 'onPostDeactivate');
646
+ var checkCanReturnFocus = getOption(deactivateOptions, 'checkCanReturnFocus');
647
+
648
+ if (onDeactivate) {
649
+ onDeactivate();
650
+ }
651
+
652
+ var returnFocus = getOption(deactivateOptions, 'returnFocus', 'returnFocusOnDeactivate');
653
+
654
+ var finishDeactivation = function finishDeactivation() {
655
+ delay(function () {
656
+ if (returnFocus) {
657
+ tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation));
658
+ }
659
+
660
+ if (onPostDeactivate) {
661
+ onPostDeactivate();
662
+ }
663
+ });
664
+ };
665
+
666
+ if (returnFocus && checkCanReturnFocus) {
667
+ checkCanReturnFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation)).then(finishDeactivation, finishDeactivation);
668
+ return this;
669
+ }
670
+
671
+ finishDeactivation();
672
+ return this;
673
+ },
674
+ pause: function pause() {
675
+ if (state.paused || !state.active) {
676
+ return this;
677
+ }
678
+
679
+ state.paused = true;
680
+ removeListeners();
681
+ return this;
682
+ },
683
+ unpause: function unpause() {
684
+ if (!state.paused || !state.active) {
685
+ return this;
686
+ }
687
+
688
+ state.paused = false;
689
+ updateTabbableNodes();
690
+ addListeners();
691
+ return this;
692
+ },
693
+ updateContainerElements: function updateContainerElements(containerElements) {
694
+ var elementsAsArray = [].concat(containerElements).filter(Boolean);
695
+ state.containers = elementsAsArray.map(function (element) {
696
+ return typeof element === 'string' ? doc.querySelector(element) : element;
697
+ });
698
+
699
+ if (state.active) {
700
+ updateTabbableNodes();
701
+ }
702
+
703
+ return this;
704
+ }
705
+ }; // initialize container elements
706
+
707
+ trap.updateContainerElements(elements);
708
+ return trap;
709
+ };
710
+
711
+ const viewerGridCss = "*,*::after,*::before{box-sizing:border-box}:host{display:flex;height:100vh;overflow:hidden;position:relative}:host([small]) .main{flex-basis:375px}@media screen and (max-width: 375px){:host([small]) .main{transition:none;flex-basis:100vw}}:host([medium]) .main{flex-basis:624px}@media screen and (max-width: 624px){:host([medium]) .main{transition:none;flex-basis:100vw}}:host([large]) .main{flex-basis:60%;min-width:768px;max-width:1024px}@media screen and (max-width: 768px){:host([large]) .main{transition:none;flex-basis:100vw;min-width:auto;max-width:auto}}.shrink,.expand,.overlay-close-button{display:inline-block;font-size:1em;font-weight:500;margin-bottom:0;text-decoration:none;touch-action:manipulation;text-align:left;user-select:none;vertical-align:middle;border:0;color:#39870c;line-height:1;padding:0;background-color:transparent}.shrink:focus,.shrink:focus-visible,.expand:focus,.expand:focus-visible,.overlay-close-button:focus,.overlay-close-button:focus-visible{outline-offset:2px}.shrink:active,.expand:active,.overlay-close-button:active{outline:0}.shrink.extern::after,.shrink.download::after,.expand.extern::after,.expand.download::after,.overlay-close-button.extern::after,.overlay-close-button.download::after{content:\"\";display:inline-block;height:1.5em;margin-left:8px;vertical-align:top;width:1.5em}.shrink[disabled],.expand[disabled],.overlay-close-button[disabled]{color:#afcf9d}.shrink:not([disabled]):hover,.expand:not([disabled]):hover,.overlay-close-button:not([disabled]):hover{color:#676cb0;text-decoration:underline}.shrink:not([disabled]):active,.expand:not([disabled]):active,.overlay-close-button:not([disabled]):active{color:#676cb0}.shrink.btn-align,.expand.btn-align,.overlay-close-button.btn-align{line-height:calc(1.5em - 1px);padding:11px 0;position:relative}.shrink.extern::after,.shrink.download::after,.expand.extern::after,.expand.download::after,.overlay-close-button.extern::after,.overlay-close-button.download::after{position:relative;top:-2px}.shrink.download::after,.expand.download::after,.overlay-close-button.download::after{background:var(--dso-icon, var(--di-download)) no-repeat;background-position:center;background-size:cover;height:1.5em;vertical-align:top;width:1.5em}.shrink.download[disabled]::after,.expand.download[disabled]::after,.overlay-close-button.download[disabled]::after{--dso-icon:var(--di-download-grasgroen-40)}.shrink.download:not([disabled]):hover::after,.shrink.download:not([disabled]):active::after,.expand.download:not([disabled]):hover::after,.expand.download:not([disabled]):active::after,.overlay-close-button.download:not([disabled]):hover::after,.overlay-close-button.download:not([disabled]):active::after{--dso-icon:var(--di-download-scampi)}.shrink.extern::after,.expand.extern::after,.overlay-close-button.extern::after{background:var(--dso-icon, var(--di-external-link)) no-repeat;background-position:center;background-size:cover;height:1.5em;vertical-align:top;width:1.5em}.shrink.extern[disabled]::after,.expand.extern[disabled]::after,.overlay-close-button.extern[disabled]::after{--dso-icon:var(--di-external-link-grasgroen-40)}.shrink.extern:not([disabled]):hover::after,.shrink.extern:not([disabled]):active::after,.expand.extern:not([disabled]):hover::after,.expand.extern:not([disabled]):active::after,.overlay-close-button.extern:not([disabled]):hover::after,.overlay-close-button.extern:not([disabled]):active::after{--dso-icon:var(--di-external-link-scampi)}.shrink dso-icon+span:not(.sr-only),.shrink svg.di+span:not(.sr-only),.shrink span:not(.sr-only)+dso-icon,.shrink span:not(.sr-only)+svg.di,.expand dso-icon+span:not(.sr-only),.expand svg.di+span:not(.sr-only),.expand span:not(.sr-only)+dso-icon,.expand span:not(.sr-only)+svg.di,.overlay-close-button dso-icon+span:not(.sr-only),.overlay-close-button svg.di+span:not(.sr-only),.overlay-close-button span:not(.sr-only)+dso-icon,.overlay-close-button span:not(.sr-only)+svg.di{margin-left:8px}.shrink dso-icon,.shrink svg.di,.shrink span,.expand dso-icon,.expand svg.di,.expand span,.overlay-close-button dso-icon,.overlay-close-button svg.di,.overlay-close-button span{vertical-align:middle}.shrink:hover,.expand:hover,.overlay-close-button:hover{cursor:pointer}.shrink[disabled],.expand[disabled],.overlay-close-button[disabled]{display:none}.overlay-close-button{position:absolute;top:8px;right:16px}.overlay-close-button .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);border:0}.sizing-buttons{display:flex;justify-content:flex-end;margin-bottom:8px}.main{background-color:#fff;box-shadow:2px 0 5px #666;flex-shrink:0;flex-grow:0;height:100%;transition:flex-basis 0.2s ease-in, max-width 0.2s ease-in, min-width 0.2s ease-in;padding:8px 16px;overflow-y:auto;z-index:1}.map{height:100%;width:100%;overflow:hidden}.overlay{background-color:#fff;box-shadow:-2px 0 5px #666;height:100%;overflow-y:auto;padding:40px 16px 8px;position:absolute;right:0;width:624px;z-index:2}";
712
+
713
+ let ViewerGrid = class {
714
+ constructor(hostRef) {
715
+ registerInstance(this, hostRef);
716
+ this.closeOverlay = createEvent(this, "closeOverlay", 7);
717
+ this.overlayOpen = false;
718
+ this.mainSize = "large";
719
+ this.shrinkMain = () => {
720
+ this.mainSize = this.mainSize == "large" ? "medium" : "small";
721
+ };
722
+ this.expandMain = () => {
723
+ this.mainSize = this.mainSize == "small" ? "medium" : "large";
724
+ };
725
+ this.keyDownListener = (event) => {
726
+ if (event.key != "Escape") {
727
+ return;
728
+ }
729
+ this.closeOverlay.emit(event);
730
+ };
731
+ }
732
+ updateFocusTrap() {
733
+ if (!this.trap) {
734
+ return;
735
+ }
736
+ if (this.overlayOpen) {
737
+ this.trap.activate();
738
+ this.host.addEventListener("keydown", this.keyDownListener);
739
+ }
740
+ else {
741
+ this.trap.deactivate();
742
+ this.host.removeEventListener("keydown", this.keyDownListener);
743
+ }
744
+ }
745
+ connectedCallback() {
746
+ this.overlaySlot = this.host.querySelector("div[slot = 'overlay']");
747
+ }
748
+ componentDidLoad() {
749
+ if (!this.overlay || !this.overlaySlot) {
750
+ return;
751
+ }
752
+ this.trap = createFocusTrap([this.overlay, this.overlaySlot], {
753
+ escapeDeactivates: false,
754
+ allowOutsideClick: true,
755
+ });
756
+ this.updateFocusTrap();
757
+ }
758
+ componentDidUpdate() {
759
+ this.updateFocusTrap();
760
+ }
761
+ disconnectedCallback() {
762
+ if (this.trap) {
763
+ this.trap.deactivate();
764
+ }
765
+ this.host.removeEventListener("keydown", this.keyDownListener);
766
+ }
767
+ render() {
768
+ return (h(Host, Object.assign({}, { [this.mainSize]: true }), h("div", { class: "main" }, h("div", { class: "sizing-buttons" }, h("button", { type: "button", class: "shrink", disabled: this.mainSize == "small", onClick: this.shrinkMain }, h("dso-icon", { icon: "chevron-left" })), h("button", { type: "button", class: "expand", disabled: this.mainSize == "large", onClick: this.expandMain }, h("dso-icon", { icon: "chevron-right" }))), h("slot", { name: "main" })), h("div", { class: "map" }, h("slot", { name: "map" })), h("div", { class: "overlay", hidden: !this.overlayOpen || !this.overlaySlot, ref: (element) => (this.overlay = element) }, h("button", { type: "button", class: "overlay-close-button", onClick: (e) => this.closeOverlay.emit(e) }, h("dso-icon", { icon: "times" }), h("span", { class: "sr-only" }, "sluiten")), h("slot", { name: "overlay" }))));
769
+ }
770
+ get host() { return getElement(this); }
771
+ };
772
+ ViewerGrid.style = viewerGridCss;
773
+
774
+ export { ViewerGrid as dso_viewer_grid };