@dso-toolkit/core 47.0.0 → 48.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.
- package/dist/cjs/dso-accordion-section.cjs.entry.js +1447 -58
- package/dist/cjs/dso-autosuggest.cjs.entry.js +57 -47
- package/dist/cjs/dso-date-picker.cjs.entry.js +3 -2
- package/dist/cjs/dso-dropdown-menu.cjs.entry.js +2 -2
- package/dist/cjs/dso-helpcenter-panel.cjs.entry.js +1 -1
- package/dist/cjs/dso-image-overlay.cjs.entry.js +1 -1
- package/dist/cjs/dso-info_2.cjs.entry.js +2 -2
- package/dist/cjs/dso-label.cjs.entry.js +2 -2
- package/dist/cjs/dso-modal.cjs.entry.js +4 -7
- package/dist/cjs/dso-ozon-content.cjs.entry.js +3 -3
- package/dist/cjs/dso-table.cjs.entry.js +3 -5
- package/dist/cjs/dso-toggletip.cjs.entry.js +1 -1
- package/dist/cjs/dso-toolkit.cjs.js +2 -2
- package/dist/cjs/dso-tooltip.cjs.entry.js +13 -21
- package/dist/cjs/dso-viewer-grid.cjs.entry.js +8 -3
- package/dist/cjs/{focus-trap.esm-d83fd673.js → focus-trap.esm-c501d382.js} +82 -155
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +8 -8
- package/dist/collection/components/accordion/components/accordion-section.css +27 -4
- package/dist/collection/components/accordion/components/accordion-section.interfaces.js +6 -0
- package/dist/collection/components/accordion/components/accordion-section.js +91 -59
- package/dist/collection/components/accordion/components/handles/element.handle.js +7 -0
- package/dist/collection/components/accordion/components/handles/heading.handle.js +14 -0
- package/dist/collection/components/accordion/components/handles/icon.handle.js +13 -0
- package/dist/collection/components/accordion/components/handles/index.js +4 -0
- package/dist/collection/components/accordion/components/handles/state-icon.handle.js +15 -0
- package/dist/collection/components/autosuggest/autosuggest.interfaces.js +1 -0
- package/dist/collection/components/autosuggest/autosuggest.js +61 -49
- package/dist/collection/components/banner/banner.js +1 -1
- package/dist/collection/components/card-container/card-container.js +1 -1
- package/dist/collection/components/date-picker/date-picker.interfaces.js +1 -0
- package/dist/collection/components/date-picker/date-picker.js +19 -11
- package/dist/collection/components/dropdown-menu/dropdown-menu.js +2 -2
- package/dist/collection/components/header/header.js +2 -6
- package/dist/collection/components/info-button/info-button.interfaces.js +1 -0
- package/dist/collection/components/info-button/info-button.js +2 -1
- package/dist/collection/components/label/label.js +2 -2
- package/dist/collection/components/modal/modal.css +103 -75
- package/dist/collection/components/modal/modal.interfaces.js +1 -0
- package/dist/collection/components/modal/modal.js +6 -9
- package/dist/collection/components/ozon-content/nodes/noot.node.js +1 -1
- package/dist/collection/components/ozon-content/nodes/table.node/table.node.js +1 -1
- package/dist/collection/components/progress-indicator/progress-indicator.js +1 -1
- package/dist/collection/components/selectable/selectable.css +18 -1
- package/dist/collection/components/selectable/selectable.interfaces.js +1 -0
- package/dist/collection/components/selectable/selectable.js +3 -2
- package/dist/collection/components/table/table.css +49 -16
- package/dist/collection/components/table/table.js +2 -4
- package/dist/collection/components/toggletip/toggletip.js +1 -1
- package/dist/collection/components/tooltip/tooltip.js +13 -42
- package/dist/collection/components/tree-view/tree-view.js +8 -2
- package/dist/collection/components/viewer-grid/viewer-grid.interfaces.js +1 -0
- package/dist/collection/components/viewer-grid/viewer-grid.js +19 -11
- package/dist/collection/index.js +13 -0
- package/dist/components/clsx.m.js +3 -0
- package/dist/components/create-identifier.js +15 -0
- package/dist/components/dropdown-menu.js +151 -0
- package/dist/components/dso-accordion-section.d.ts +11 -0
- package/dist/components/dso-accordion-section.js +1535 -0
- package/dist/components/dso-accordion.d.ts +11 -0
- package/dist/components/dso-accordion.js +316 -0
- package/dist/components/dso-alert.d.ts +11 -0
- package/dist/components/dso-alert.js +55 -0
- package/dist/components/dso-attachments-counter.d.ts +11 -0
- package/dist/components/dso-attachments-counter.js +42 -0
- package/dist/components/dso-autosuggest.d.ts +11 -0
- package/dist/components/dso-autosuggest.js +309 -0
- package/dist/components/dso-badge.d.ts +11 -0
- package/dist/components/dso-badge.js +37 -0
- package/dist/components/dso-banner.d.ts +11 -0
- package/dist/components/dso-banner.js +37 -0
- package/dist/components/dso-card-container.d.ts +11 -0
- package/dist/components/dso-card-container.js +36 -0
- package/dist/components/dso-card.d.ts +11 -0
- package/dist/components/dso-card.js +66 -0
- package/dist/components/dso-date-picker.d.ts +11 -0
- package/dist/components/dso-date-picker.js +682 -0
- package/dist/components/dso-dropdown-menu.d.ts +11 -0
- package/dist/components/dso-dropdown-menu.js +6 -0
- package/dist/components/dso-header.d.ts +11 -0
- package/dist/components/dso-header.js +159 -0
- package/dist/components/dso-helpcenter-panel.d.ts +11 -0
- package/dist/components/dso-helpcenter-panel.js +127 -0
- package/dist/components/dso-highlight-box.d.ts +11 -0
- package/dist/components/dso-highlight-box.js +55 -0
- package/dist/components/dso-icon.d.ts +11 -0
- package/dist/components/dso-icon.js +6 -0
- package/dist/components/dso-image-overlay.d.ts +11 -0
- package/dist/components/dso-image-overlay.js +129 -0
- package/dist/components/dso-info-button.d.ts +11 -0
- package/dist/components/dso-info-button.js +6 -0
- package/dist/components/dso-info.d.ts +11 -0
- package/dist/components/dso-info.js +6 -0
- package/dist/components/dso-label.d.ts +11 -0
- package/dist/components/dso-label.js +156 -0
- package/dist/components/dso-map-base-layers.d.ts +11 -0
- package/dist/components/dso-map-base-layers.js +80 -0
- package/dist/components/dso-map-controls.d.ts +11 -0
- package/dist/components/dso-map-controls.js +86 -0
- package/dist/components/dso-map-overlays.d.ts +11 -0
- package/dist/components/dso-map-overlays.js +81 -0
- package/dist/components/dso-modal.d.ts +11 -0
- package/dist/components/dso-modal.js +85 -0
- package/dist/components/dso-ozon-content.d.ts +11 -0
- package/dist/components/dso-ozon-content.js +507 -0
- package/dist/components/dso-pagination.d.ts +11 -0
- package/dist/components/dso-pagination.js +159 -0
- package/dist/components/dso-progress-bar.d.ts +11 -0
- package/dist/components/dso-progress-bar.js +42 -0
- package/dist/components/dso-progress-indicator.d.ts +11 -0
- package/dist/components/dso-progress-indicator.js +6 -0
- package/dist/components/dso-responsive-element.d.ts +11 -0
- package/dist/components/dso-responsive-element.js +6 -0
- package/dist/components/dso-selectable.d.ts +11 -0
- package/dist/components/dso-selectable.js +6 -0
- package/dist/components/dso-table.d.ts +11 -0
- package/dist/components/dso-table.js +111 -0
- package/dist/components/dso-toggletip.d.ts +11 -0
- package/dist/components/dso-toggletip.js +90 -0
- package/dist/components/dso-tooltip.d.ts +11 -0
- package/dist/components/dso-tooltip.js +6 -0
- package/dist/components/dso-tree-view.d.ts +11 -0
- package/dist/components/dso-tree-view.js +227 -0
- package/dist/components/dso-viewer-grid.d.ts +11 -0
- package/dist/components/dso-viewer-grid.js +171 -0
- package/dist/components/focus-trap.esm.js +688 -0
- package/dist/components/icon.js +663 -0
- package/dist/components/index.d.ts +55 -0
- package/dist/components/index.esm.js +458 -0
- package/dist/components/index.js +35 -0
- package/dist/components/index2.js +70 -0
- package/dist/components/info-button.js +56 -0
- package/dist/components/info.js +42 -0
- package/dist/components/is-modified-event.js +4 -0
- package/dist/components/progress-indicator.js +44 -0
- package/dist/components/responsive-element.js +67 -0
- package/dist/components/selectable.js +108 -0
- package/dist/components/tooltip.js +2047 -0
- package/dist/components/v4.js +66 -0
- package/dist/dso-toolkit/dso-toolkit.esm.js +1 -1
- package/dist/dso-toolkit/p-04ffcc93.entry.js +1 -0
- package/dist/dso-toolkit/{p-e0a37d82.entry.js → p-06b4f78d.entry.js} +1 -1
- package/dist/dso-toolkit/{p-2b83a825.entry.js → p-35687d62.entry.js} +1 -1
- package/dist/dso-toolkit/p-52bc72d0.entry.js +1 -0
- package/dist/dso-toolkit/p-57ceabab.js +5 -0
- package/dist/dso-toolkit/p-655eff47.entry.js +1 -0
- package/dist/dso-toolkit/p-672c8323.entry.js +1 -0
- package/dist/dso-toolkit/p-7f8be9bc.entry.js +1 -0
- package/dist/dso-toolkit/p-80575700.entry.js +1 -0
- package/dist/dso-toolkit/p-8e9f6355.entry.js +1 -0
- package/dist/dso-toolkit/p-a8cb2eae.entry.js +1 -0
- package/dist/dso-toolkit/p-d31805a9.entry.js +1 -0
- package/dist/dso-toolkit/{p-dcc74039.entry.js → p-d7b2adc3.entry.js} +1 -1
- package/dist/dso-toolkit/{p-800e1267.entry.js → p-daee3252.entry.js} +1 -1
- package/dist/dso-toolkit/p-ec5412aa.entry.js +1 -0
- package/dist/esm/dso-accordion-section.entry.js +1448 -59
- package/dist/esm/dso-autosuggest.entry.js +57 -47
- package/dist/esm/dso-date-picker.entry.js +3 -2
- package/dist/esm/dso-dropdown-menu.entry.js +2 -2
- package/dist/esm/dso-helpcenter-panel.entry.js +1 -1
- package/dist/esm/dso-image-overlay.entry.js +1 -1
- package/dist/esm/dso-info_2.entry.js +2 -2
- package/dist/esm/dso-label.entry.js +2 -2
- package/dist/esm/dso-modal.entry.js +5 -8
- package/dist/esm/dso-ozon-content.entry.js +3 -3
- package/dist/esm/dso-table.entry.js +3 -5
- package/dist/esm/dso-toggletip.entry.js +1 -1
- package/dist/esm/dso-toolkit.js +2 -2
- package/dist/esm/dso-tooltip.entry.js +13 -21
- package/dist/esm/dso-viewer-grid.entry.js +8 -3
- package/dist/esm/{focus-trap.esm-33203b60.js → focus-trap.esm-94794d92.js} +82 -155
- package/dist/esm/loader.js +2 -2
- package/dist/types/components/accordion/accordion.interfaces.d.ts +0 -2
- package/dist/types/components/accordion/components/accordion-section.d.ts +10 -1
- package/dist/types/components/accordion/components/accordion-section.interfaces.d.ts +3 -0
- package/dist/types/components/accordion/components/handles/element.handle.d.ts +6 -0
- package/dist/types/components/accordion/components/handles/heading.handle.d.ts +5 -0
- package/dist/types/components/accordion/components/handles/icon.handle.d.ts +7 -0
- package/dist/types/components/accordion/components/handles/index.d.ts +4 -0
- package/dist/types/components/accordion/components/handles/state-icon.handle.d.ts +5 -0
- package/dist/types/components/autosuggest/autosuggest.d.ts +2 -15
- package/dist/types/components/autosuggest/autosuggest.interfaces.d.ts +14 -0
- package/dist/types/components/date-picker/date-picker.d.ts +2 -15
- package/dist/types/components/date-picker/date-picker.interfaces.d.ts +14 -0
- package/dist/types/components/dropdown-menu/dropdown-menu.d.ts +1 -1
- package/dist/types/components/header/header.d.ts +2 -2
- package/dist/types/components/header/header.interfaces.d.ts +1 -0
- package/dist/types/components/info-button/info-button.d.ts +1 -4
- package/dist/types/components/info-button/info-button.interfaces.d.ts +4 -0
- package/dist/types/components/map-overlays/map-overlays.d.ts +1 -1
- package/dist/types/components/modal/modal.d.ts +3 -5
- package/dist/types/components/modal/modal.interfaces.d.ts +3 -0
- package/dist/types/components/selectable/selectable.d.ts +1 -2
- package/dist/types/components/selectable/selectable.interfaces.d.ts +2 -0
- package/dist/types/components/table/table.d.ts +1 -1
- package/dist/types/components/tooltip/tooltip.d.ts +0 -8
- package/dist/types/components/tree-view/tree-view.d.ts +2 -2
- package/dist/types/components/viewer-grid/viewer-grid.d.ts +5 -16
- package/dist/types/components/viewer-grid/viewer-grid.interfaces.d.ts +15 -0
- package/dist/types/components.d.ts +20 -27
- package/dist/types/index.d.ts +13 -0
- package/package.json +8 -8
- package/dist/custom-elements/index.d.ts +0 -243
- package/dist/custom-elements/index.js +0 -7555
- package/dist/dso-toolkit/p-0917f18a.entry.js +0 -1
- package/dist/dso-toolkit/p-0c8cd0d8.entry.js +0 -1
- package/dist/dso-toolkit/p-203fc66c.entry.js +0 -1
- package/dist/dso-toolkit/p-3ab4441a.entry.js +0 -1
- package/dist/dso-toolkit/p-44c0bb3e.entry.js +0 -1
- package/dist/dso-toolkit/p-89d262b7.js +0 -5
- package/dist/dso-toolkit/p-9aa3fa9d.entry.js +0 -1
- package/dist/dso-toolkit/p-ba253bcd.entry.js +0 -1
- package/dist/dso-toolkit/p-e43e39cf.entry.js +0 -1
- package/dist/dso-toolkit/p-e8b22546.entry.js +0 -1
- package/dist/dso-toolkit/p-f93b7c7a.entry.js +0 -1
|
@@ -217,9 +217,12 @@ export class TreeView {
|
|
|
217
217
|
"text": "Emitted when a tree view item is opened.\r\nThe `detail` property of the `CustomEvent` will contain the complete path of TreeViewItems from the\r\nroot to the item that is emitting the open event. The consumer of the event is responsible for updating\r\nthe TreeView's collection (usually set the open state on the last TreeViewItem in path)."
|
|
218
218
|
},
|
|
219
219
|
"complexType": {
|
|
220
|
-
"original": "TreeViewItem
|
|
220
|
+
"original": "Array<TreeViewItem>",
|
|
221
221
|
"resolved": "TreeViewItem[]",
|
|
222
222
|
"references": {
|
|
223
|
+
"Array": {
|
|
224
|
+
"location": "global"
|
|
225
|
+
},
|
|
223
226
|
"TreeViewItem": {
|
|
224
227
|
"location": "import",
|
|
225
228
|
"path": "./tree-view.interfaces"
|
|
@@ -237,9 +240,12 @@ export class TreeView {
|
|
|
237
240
|
"text": "Emitted when a tree view item is closed.\r\nThe `detail` property of the `CustomEvent` will contain the complete path of TreeViewItems from the\r\nroot to the item that is emitting the close event. The consumer of the event is responsible for updating\r\nthe TreeView's collection (usually set the closed state on the last TreeViewItem in path)."
|
|
238
241
|
},
|
|
239
242
|
"complexType": {
|
|
240
|
-
"original": "TreeViewItem
|
|
243
|
+
"original": "Array<TreeViewItem>",
|
|
241
244
|
"resolved": "TreeViewItem[]",
|
|
242
245
|
"references": {
|
|
246
|
+
"Array": {
|
|
247
|
+
"location": "global"
|
|
248
|
+
},
|
|
243
249
|
"TreeViewItem": {
|
|
244
250
|
"location": "import",
|
|
245
251
|
"path": "./tree-view.interfaces"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -24,8 +24,8 @@ export class ViewerGrid {
|
|
|
24
24
|
};
|
|
25
25
|
this.filterpanelOpen = false;
|
|
26
26
|
this.overlayOpen = false;
|
|
27
|
-
this.initialMainSize =
|
|
28
|
-
this.mainSize =
|
|
27
|
+
this.initialMainSize = undefined;
|
|
28
|
+
this.mainSize = "large";
|
|
29
29
|
}
|
|
30
30
|
mainSizeWatcher(currentSize, previousSize) {
|
|
31
31
|
var _a;
|
|
@@ -95,6 +95,11 @@ export class ViewerGrid {
|
|
|
95
95
|
}
|
|
96
96
|
this.updateFocusTrap();
|
|
97
97
|
}
|
|
98
|
+
componentWillLoad() {
|
|
99
|
+
if (this.initialMainSize) {
|
|
100
|
+
this.mainSize = this.initialMainSize;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
98
103
|
componentDidUpdate() {
|
|
99
104
|
this.updateFocusTrap();
|
|
100
105
|
}
|
|
@@ -168,22 +173,22 @@ export class ViewerGrid {
|
|
|
168
173
|
"mutable": false,
|
|
169
174
|
"complexType": {
|
|
170
175
|
"original": "MainSize",
|
|
171
|
-
"resolved": "\"large\" | \"medium\" | \"small\"",
|
|
176
|
+
"resolved": "\"large\" | \"medium\" | \"small\" | undefined",
|
|
172
177
|
"references": {
|
|
173
178
|
"MainSize": {
|
|
174
|
-
"location": "
|
|
179
|
+
"location": "import",
|
|
180
|
+
"path": "./viewer-grid.interfaces"
|
|
175
181
|
}
|
|
176
182
|
}
|
|
177
183
|
},
|
|
178
184
|
"required": false,
|
|
179
|
-
"optional":
|
|
185
|
+
"optional": true,
|
|
180
186
|
"docs": {
|
|
181
187
|
"tags": [],
|
|
182
|
-
"text": "Size of the main content panel when component loads. Changing this attribute afterwards has no effect
|
|
188
|
+
"text": "Size of the main content panel when component loads. Changing this attribute afterwards has no effect.\r\n\r\nDefault size is `large`."
|
|
183
189
|
},
|
|
184
190
|
"attribute": "initial-main-size",
|
|
185
|
-
"reflect": false
|
|
186
|
-
"defaultValue": "\"large\""
|
|
191
|
+
"reflect": false
|
|
187
192
|
}
|
|
188
193
|
};
|
|
189
194
|
}
|
|
@@ -230,7 +235,8 @@ export class ViewerGrid {
|
|
|
230
235
|
"resolved": "FilterpanelEvent",
|
|
231
236
|
"references": {
|
|
232
237
|
"FilterpanelEvent": {
|
|
233
|
-
"location": "
|
|
238
|
+
"location": "import",
|
|
239
|
+
"path": "./viewer-grid.interfaces"
|
|
234
240
|
}
|
|
235
241
|
}
|
|
236
242
|
}
|
|
@@ -249,7 +255,8 @@ export class ViewerGrid {
|
|
|
249
255
|
"resolved": "FilterpanelEvent",
|
|
250
256
|
"references": {
|
|
251
257
|
"FilterpanelEvent": {
|
|
252
|
-
"location": "
|
|
258
|
+
"location": "import",
|
|
259
|
+
"path": "./viewer-grid.interfaces"
|
|
253
260
|
}
|
|
254
261
|
}
|
|
255
262
|
}
|
|
@@ -268,7 +275,8 @@ export class ViewerGrid {
|
|
|
268
275
|
"resolved": "ViewerGridChangeSizeEvent",
|
|
269
276
|
"references": {
|
|
270
277
|
"ViewerGridChangeSizeEvent": {
|
|
271
|
-
"location": "
|
|
278
|
+
"location": "import",
|
|
279
|
+
"path": "./viewer-grid.interfaces"
|
|
272
280
|
}
|
|
273
281
|
}
|
|
274
282
|
}
|
package/dist/collection/index.js
CHANGED
|
@@ -1,2 +1,15 @@
|
|
|
1
|
+
export * from "./components/accordion/accordion.interfaces";
|
|
2
|
+
export * from "./components/autosuggest/autosuggest.interfaces";
|
|
3
|
+
export * from "./components/card/card.interfaces";
|
|
4
|
+
export * from "./components/date-picker/date-picker.interfaces";
|
|
5
|
+
export * from "./components/header/header.interfaces";
|
|
6
|
+
export * from "./components/info-button/info-button.interfaces";
|
|
1
7
|
export * from "./components/map-base-layers/map-base-layers.interfaces";
|
|
2
8
|
export * from "./components/map-overlays/map-overlays.interfaces";
|
|
9
|
+
export * from "./components/modal/modal.interfaces";
|
|
10
|
+
export * from "./components/ozon-content/ozon-content.interfaces";
|
|
11
|
+
export * from "./components/pagination/pagination.interfaces";
|
|
12
|
+
export * from "./components/responsive-element/responsive-element.interfaces";
|
|
13
|
+
export * from "./components/selectable/selectable.interfaces";
|
|
14
|
+
export * from "./components/tree-view/tree-view.interfaces";
|
|
15
|
+
export * from "./components/viewer-grid/viewer-grid.interfaces";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|
|
2
|
+
|
|
3
|
+
export { clsx as c };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Form random hash
|
|
3
|
+
*/
|
|
4
|
+
function chr4() {
|
|
5
|
+
return Math.random().toString(16).slice(-4);
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Create random identifier with a prefix
|
|
9
|
+
* @param prefix
|
|
10
|
+
*/
|
|
11
|
+
function createIdentifier(prefix) {
|
|
12
|
+
return `${prefix}-${chr4()}${chr4()}-${chr4()}-${chr4()}-${chr4()}-${chr4()}${chr4()}${chr4()}`;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { createIdentifier as c };
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { t as tabbable } from './index.esm.js';
|
|
3
|
+
import { v as v4 } from './v4.js';
|
|
4
|
+
|
|
5
|
+
const dropdownMenuCss = ":host(:focus){outline:none}:host{display:inline-block;position:relative}";
|
|
6
|
+
|
|
7
|
+
const DropdownMenu = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
this.__registerHost();
|
|
11
|
+
this.__attachShadow();
|
|
12
|
+
this.focusOutListener = (event) => {
|
|
13
|
+
if (!this.tabbables.includes(event.relatedTarget)) {
|
|
14
|
+
this.open = false;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
this.keyDownListener = (event) => {
|
|
18
|
+
if (event.defaultPrevented) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
switch (event.key) {
|
|
22
|
+
case "ArrowDown":
|
|
23
|
+
this.tabInPopup(1);
|
|
24
|
+
break;
|
|
25
|
+
case "ArrowUp":
|
|
26
|
+
this.tabInPopup(-1);
|
|
27
|
+
break;
|
|
28
|
+
case "Escape":
|
|
29
|
+
this.escape();
|
|
30
|
+
break;
|
|
31
|
+
case " ":
|
|
32
|
+
if (event.target instanceof HTMLElement) {
|
|
33
|
+
event.target.click();
|
|
34
|
+
}
|
|
35
|
+
break;
|
|
36
|
+
default:
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
event.preventDefault();
|
|
40
|
+
};
|
|
41
|
+
this.escape = () => {
|
|
42
|
+
this.button.focus();
|
|
43
|
+
this.open = false;
|
|
44
|
+
};
|
|
45
|
+
this.open = false;
|
|
46
|
+
this.dropdownAlign = "left";
|
|
47
|
+
this.checkable = false;
|
|
48
|
+
}
|
|
49
|
+
get button() {
|
|
50
|
+
const button = this.host.querySelector('button[slot="toggle"]');
|
|
51
|
+
if (!(button instanceof HTMLButtonElement)) {
|
|
52
|
+
throw new ReferenceError("Mandatory toggle button not found");
|
|
53
|
+
}
|
|
54
|
+
return button;
|
|
55
|
+
}
|
|
56
|
+
get tabbables() {
|
|
57
|
+
return tabbable(this.host).filter((e) => e !== this.button);
|
|
58
|
+
}
|
|
59
|
+
componentDidLoad() {
|
|
60
|
+
this.button.setAttribute("aria-haspopup", "menu");
|
|
61
|
+
this.button.setAttribute("aria-expanded", "false");
|
|
62
|
+
if (!this.button.id) {
|
|
63
|
+
this.button.id = v4();
|
|
64
|
+
}
|
|
65
|
+
this.button.addEventListener("click", () => {
|
|
66
|
+
this.open = !this.open;
|
|
67
|
+
});
|
|
68
|
+
const options = this.host.querySelector(".dso-dropdown-options");
|
|
69
|
+
if (!options) {
|
|
70
|
+
throw new ReferenceError("Dropdown options not found");
|
|
71
|
+
}
|
|
72
|
+
options.setAttribute("role", "menu");
|
|
73
|
+
options.setAttribute("aria-labelledby", this.button.id);
|
|
74
|
+
for (const ul of Array.from(this.host.getElementsByTagName("ul"))) {
|
|
75
|
+
ul.setAttribute("role", "none");
|
|
76
|
+
for (const li of Array.from(ul.getElementsByTagName("li"))) {
|
|
77
|
+
li.setAttribute("role", "none");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
componentDidRender() {
|
|
82
|
+
for (const li of Array.from(this.host.getElementsByTagName("li"))) {
|
|
83
|
+
for (const tab of tabbable(li)) {
|
|
84
|
+
tab.setAttribute("role", this.checkable ? "menuitemradio" : "menuitem");
|
|
85
|
+
if (this.checkable && li.classList.contains("dso-checked")) {
|
|
86
|
+
tab.setAttribute("aria-checked", "true");
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
tab.removeAttribute("aria-checked");
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
this.host.removeEventListener("keydown", this.keyDownListener);
|
|
94
|
+
this.button.setAttribute("aria-expanded", this.open ? "true" : "false");
|
|
95
|
+
if (this.open) {
|
|
96
|
+
this.host.addEventListener("keydown", this.keyDownListener);
|
|
97
|
+
}
|
|
98
|
+
this.tabbables.forEach((tabbable) => {
|
|
99
|
+
tabbable.removeEventListener("click", this.escape);
|
|
100
|
+
if (this.open) {
|
|
101
|
+
tabbable.addEventListener("click", this.escape);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
getActiveElement(root = document) {
|
|
106
|
+
const activeEl = root.activeElement;
|
|
107
|
+
if (!activeEl) {
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
if (activeEl.shadowRoot) {
|
|
111
|
+
return this.getActiveElement(activeEl.shadowRoot);
|
|
112
|
+
}
|
|
113
|
+
return activeEl;
|
|
114
|
+
}
|
|
115
|
+
tabInPopup(direction) {
|
|
116
|
+
const tabs = this.tabbables;
|
|
117
|
+
const currentIndex = tabs.findIndex((e) => e === this.getActiveElement());
|
|
118
|
+
let nextIndex = currentIndex + direction;
|
|
119
|
+
if (nextIndex >= tabs.length) {
|
|
120
|
+
nextIndex = 0;
|
|
121
|
+
}
|
|
122
|
+
else if (nextIndex < 0) {
|
|
123
|
+
nextIndex = tabs.length - 1;
|
|
124
|
+
}
|
|
125
|
+
tabs[nextIndex].focus();
|
|
126
|
+
}
|
|
127
|
+
render() {
|
|
128
|
+
return (h(Host, { onFocusout: this.focusOutListener, tabindex: this.open ? "-1" : undefined }, h("slot", { name: "toggle" }), h("div", { hidden: !this.open }, h("slot", null))));
|
|
129
|
+
}
|
|
130
|
+
get host() { return this; }
|
|
131
|
+
static get style() { return dropdownMenuCss; }
|
|
132
|
+
}, [1, "dso-dropdown-menu", {
|
|
133
|
+
"open": [1540],
|
|
134
|
+
"dropdownAlign": [1, "dropdown-align"],
|
|
135
|
+
"checkable": [4]
|
|
136
|
+
}]);
|
|
137
|
+
function defineCustomElement() {
|
|
138
|
+
if (typeof customElements === "undefined") {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
const components = ["dso-dropdown-menu"];
|
|
142
|
+
components.forEach(tagName => { switch (tagName) {
|
|
143
|
+
case "dso-dropdown-menu":
|
|
144
|
+
if (!customElements.get(tagName)) {
|
|
145
|
+
customElements.define(tagName, DropdownMenu);
|
|
146
|
+
}
|
|
147
|
+
break;
|
|
148
|
+
} });
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export { DropdownMenu as D, defineCustomElement as d };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface DsoAccordionSection extends Components.DsoAccordionSection, HTMLElement {}
|
|
4
|
+
export const DsoAccordionSection: {
|
|
5
|
+
prototype: DsoAccordionSection;
|
|
6
|
+
new (): DsoAccordionSection;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|