@carbon/web-components 2.61.0 → 2.62.0-rc.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/custom-elements.json +455 -13
- package/es/components/action-set/action-set.d.ts +107 -0
- package/es/components/action-set/action-set.d.ts.map +1 -0
- package/es/components/action-set/action-set.js +269 -0
- package/es/components/action-set/action-set.js.map +1 -0
- package/es/components/action-set/action-set.scss.js +14 -0
- package/es/components/action-set/action-set.scss.js.map +1 -0
- package/es/components/action-set/index.d.ts +9 -0
- package/es/components/action-set/index.d.ts.map +1 -0
- package/es/components/action-set/index.js +8 -0
- package/es/components/button/button.d.ts.map +1 -1
- package/es/components/button/button.js +7 -2
- package/es/components/button/button.js.map +1 -1
- package/es/components/data-table/data-table.scss.js +1 -1
- package/es/components/date-picker/next/components/date-picker.scss.js +1 -1
- package/es/components/file-uploader/file-uploader.scss.js +1 -1
- package/es/components/fluid-date-picker/fluid-date-picker.scss.js +1 -1
- package/es/components/resizer/defs.d.ts +73 -0
- package/es/components/resizer/defs.d.ts.map +1 -0
- package/es/components/resizer/defs.js +97 -0
- package/es/components/resizer/defs.js.map +1 -0
- package/es/components/resizer/index.d.ts +11 -0
- package/es/components/resizer/index.d.ts.map +1 -0
- package/es/components/resizer/index.js +11 -0
- package/es/components/resizer/resizer-grid.d.ts +22 -0
- package/es/components/resizer/resizer-grid.d.ts.map +1 -0
- package/es/components/resizer/resizer-grid.js +44 -0
- package/es/components/resizer/resizer-grid.js.map +1 -0
- package/es/components/resizer/resizer-grid.scss.js +14 -0
- package/es/components/resizer/resizer-grid.scss.js.map +1 -0
- package/es/components/resizer/resizer-handle-pivot.d.ts +31 -0
- package/es/components/resizer/resizer-handle-pivot.d.ts.map +1 -0
- package/es/components/resizer/resizer-handle-pivot.js +93 -0
- package/es/components/resizer/resizer-handle-pivot.js.map +1 -0
- package/es/components/resizer/resizer-handle-pivot.scss.js +14 -0
- package/es/components/resizer/resizer-handle-pivot.scss.js.map +1 -0
- package/es/components/resizer/resizer-handle.d.ts +64 -0
- package/es/components/resizer/resizer-handle.d.ts.map +1 -0
- package/es/components/resizer/resizer-handle.js +350 -0
- package/es/components/resizer/resizer-handle.js.map +1 -0
- package/es/components/resizer/resizer-handle.scss.js +14 -0
- package/es/components/resizer/resizer-handle.scss.js.map +1 -0
- package/es/components/resizer/resizer-panel.d.ts +22 -0
- package/es/components/resizer/resizer-panel.d.ts.map +1 -0
- package/es/components/resizer/resizer-panel.js +37 -0
- package/es/components/resizer/resizer-panel.js.map +1 -0
- package/es/components/resizer/resizer-panel.scss.js +14 -0
- package/es/components/resizer/resizer-panel.scss.js.map +1 -0
- package/es/components/side-panel/_story-assets/index.d.ts +9 -0
- package/es/components/side-panel/_story-assets/index.d.ts.map +1 -0
- package/es/components/side-panel/_story-assets/index.js +246 -0
- package/es/components/side-panel/_story-assets/index.js.map +1 -0
- package/es/components/side-panel/defs.d.ts +7 -1
- package/es/components/side-panel/defs.d.ts.map +1 -1
- package/es/components/side-panel/defs.js +7 -1
- package/es/components/side-panel/defs.js.map +1 -1
- package/es/components/side-panel/index.d.ts +3 -1
- package/es/components/side-panel/index.d.ts.map +1 -1
- package/es/components/side-panel/index.js +12 -0
- package/es/components/side-panel/index.js.map +1 -0
- package/es/components/side-panel/side-panel.d.ts +60 -22
- package/es/components/side-panel/side-panel.d.ts.map +1 -1
- package/es/components/side-panel/side-panel.js +268 -126
- package/es/components/side-panel/side-panel.js.map +1 -1
- package/es/components/side-panel/side-panel.scss.js +14 -0
- package/es/components/side-panel/side-panel.scss.js.map +1 -0
- package/es/components/side-panel/story-styles.scss.js +14 -0
- package/es/components/side-panel/story-styles.scss.js.map +1 -0
- package/es/components/slider/slider.d.ts +14 -0
- package/es/components/slider/slider.d.ts.map +1 -1
- package/es/components/slider/slider.js +40 -5
- package/es/components/slider/slider.js.map +1 -1
- package/es/components/slider/slider.scss.js +1 -1
- package/es/components/tabs/tab.d.ts.map +1 -1
- package/es/components/tabs/tab.js +4 -1
- package/es/components/tabs/tab.js.map +1 -1
- package/es/components/tabs/tabs.scss.js +1 -1
- package/es/components/tabs/tabs.scss.js.map +1 -1
- package/es/components/textarea/textarea.scss.js +1 -1
- package/es/components/textarea/textarea.scss.js.map +1 -1
- package/es/components/truncated-text/index.d.ts +8 -0
- package/es/components/truncated-text/index.d.ts.map +1 -0
- package/es/components/truncated-text/index.js +8 -0
- package/es/components/truncated-text/truncated-text.d.ts +77 -0
- package/es/components/truncated-text/truncated-text.d.ts.map +1 -0
- package/es/components/truncated-text/truncated-text.js +216 -0
- package/es/components/truncated-text/truncated-text.js.map +1 -0
- package/es/components/truncated-text/truncated-text.scss.js +14 -0
- package/es/components/truncated-text/truncated-text.scss.js.map +1 -0
- package/es/globals/internal/icon-loader-utils.d.ts +2 -2
- package/es/globals/internal/icon-loader-utils.d.ts.map +1 -1
- package/es/globals/internal/icon-loader-utils.js +1 -1
- package/es/globals/internal/icon-loader-utils.js.map +1 -1
- package/es/index.d.ts.map +1 -1
- package/es-custom/components/action-set/action-set.d.ts +107 -0
- package/es-custom/components/action-set/action-set.d.ts.map +1 -0
- package/es-custom/components/action-set/action-set.js +269 -0
- package/es-custom/components/action-set/action-set.js.map +1 -0
- package/es-custom/components/action-set/action-set.scss.js +14 -0
- package/es-custom/components/action-set/action-set.scss.js.map +1 -0
- package/es-custom/components/action-set/index.d.ts +9 -0
- package/es-custom/components/action-set/index.d.ts.map +1 -0
- package/es-custom/components/action-set/index.js +8 -0
- package/es-custom/components/button/button.d.ts.map +1 -1
- package/es-custom/components/button/button.js +7 -2
- package/es-custom/components/button/button.js.map +1 -1
- package/es-custom/components/data-table/data-table.scss.js +1 -1
- package/es-custom/components/date-picker/next/components/date-picker.scss.js +1 -1
- package/es-custom/components/file-uploader/file-uploader.scss.js +1 -1
- package/es-custom/components/fluid-date-picker/fluid-date-picker.scss.js +1 -1
- package/es-custom/components/resizer/defs.d.ts +73 -0
- package/es-custom/components/resizer/defs.d.ts.map +1 -0
- package/es-custom/components/resizer/defs.js +97 -0
- package/es-custom/components/resizer/defs.js.map +1 -0
- package/es-custom/components/resizer/index.d.ts +11 -0
- package/es-custom/components/resizer/index.d.ts.map +1 -0
- package/es-custom/components/resizer/index.js +11 -0
- package/es-custom/components/resizer/resizer-grid.d.ts +22 -0
- package/es-custom/components/resizer/resizer-grid.d.ts.map +1 -0
- package/es-custom/components/resizer/resizer-grid.js +44 -0
- package/es-custom/components/resizer/resizer-grid.js.map +1 -0
- package/es-custom/components/resizer/resizer-grid.scss.js +14 -0
- package/es-custom/components/resizer/resizer-grid.scss.js.map +1 -0
- package/es-custom/components/resizer/resizer-handle-pivot.d.ts +31 -0
- package/es-custom/components/resizer/resizer-handle-pivot.d.ts.map +1 -0
- package/es-custom/components/resizer/resizer-handle-pivot.js +93 -0
- package/es-custom/components/resizer/resizer-handle-pivot.js.map +1 -0
- package/es-custom/components/resizer/resizer-handle-pivot.scss.js +14 -0
- package/es-custom/components/resizer/resizer-handle-pivot.scss.js.map +1 -0
- package/es-custom/components/resizer/resizer-handle.d.ts +64 -0
- package/es-custom/components/resizer/resizer-handle.d.ts.map +1 -0
- package/es-custom/components/resizer/resizer-handle.js +350 -0
- package/es-custom/components/resizer/resizer-handle.js.map +1 -0
- package/es-custom/components/resizer/resizer-handle.scss.js +14 -0
- package/es-custom/components/resizer/resizer-handle.scss.js.map +1 -0
- package/es-custom/components/resizer/resizer-panel.d.ts +22 -0
- package/es-custom/components/resizer/resizer-panel.d.ts.map +1 -0
- package/es-custom/components/resizer/resizer-panel.js +37 -0
- package/es-custom/components/resizer/resizer-panel.js.map +1 -0
- package/es-custom/components/resizer/resizer-panel.scss.js +14 -0
- package/es-custom/components/resizer/resizer-panel.scss.js.map +1 -0
- package/es-custom/components/side-panel/_story-assets/index.d.ts +9 -0
- package/es-custom/components/side-panel/_story-assets/index.d.ts.map +1 -0
- package/es-custom/components/side-panel/_story-assets/index.js +246 -0
- package/es-custom/components/side-panel/_story-assets/index.js.map +1 -0
- package/es-custom/components/side-panel/defs.d.ts +7 -1
- package/es-custom/components/side-panel/defs.d.ts.map +1 -1
- package/es-custom/components/side-panel/defs.js +7 -1
- package/es-custom/components/side-panel/defs.js.map +1 -1
- package/es-custom/components/side-panel/index.d.ts +3 -1
- package/es-custom/components/side-panel/index.d.ts.map +1 -1
- package/es-custom/components/side-panel/index.js +12 -0
- package/es-custom/components/side-panel/index.js.map +1 -0
- package/es-custom/components/side-panel/side-panel.d.ts +60 -22
- package/es-custom/components/side-panel/side-panel.d.ts.map +1 -1
- package/es-custom/components/side-panel/side-panel.js +268 -126
- package/es-custom/components/side-panel/side-panel.js.map +1 -1
- package/es-custom/components/side-panel/side-panel.scss.js +14 -0
- package/es-custom/components/side-panel/side-panel.scss.js.map +1 -0
- package/es-custom/components/side-panel/story-styles.scss.js +14 -0
- package/es-custom/components/side-panel/story-styles.scss.js.map +1 -0
- package/es-custom/components/slider/slider.d.ts +14 -0
- package/es-custom/components/slider/slider.d.ts.map +1 -1
- package/es-custom/components/slider/slider.js +40 -5
- package/es-custom/components/slider/slider.js.map +1 -1
- package/es-custom/components/slider/slider.scss.js +1 -1
- package/es-custom/components/tabs/tab.d.ts.map +1 -1
- package/es-custom/components/tabs/tab.js +4 -1
- package/es-custom/components/tabs/tab.js.map +1 -1
- package/es-custom/components/tabs/tabs.scss.js +1 -1
- package/es-custom/components/tabs/tabs.scss.js.map +1 -1
- package/es-custom/components/textarea/textarea.scss.js +1 -1
- package/es-custom/components/textarea/textarea.scss.js.map +1 -1
- package/es-custom/components/truncated-text/index.d.ts +8 -0
- package/es-custom/components/truncated-text/index.d.ts.map +1 -0
- package/es-custom/components/truncated-text/index.js +8 -0
- package/es-custom/components/truncated-text/truncated-text.d.ts +77 -0
- package/es-custom/components/truncated-text/truncated-text.d.ts.map +1 -0
- package/es-custom/components/truncated-text/truncated-text.js +216 -0
- package/es-custom/components/truncated-text/truncated-text.js.map +1 -0
- package/es-custom/components/truncated-text/truncated-text.scss.js +14 -0
- package/es-custom/components/truncated-text/truncated-text.scss.js.map +1 -0
- package/es-custom/globals/internal/icon-loader-utils.d.ts +2 -2
- package/es-custom/globals/internal/icon-loader-utils.d.ts.map +1 -1
- package/es-custom/globals/internal/icon-loader-utils.js +1 -1
- package/es-custom/globals/internal/icon-loader-utils.js.map +1 -1
- package/es-custom/index.d.ts.map +1 -1
- package/lib/components/action-set/action-set.d.ts +107 -0
- package/lib/components/action-set/action-set.d.ts.map +1 -0
- package/lib/components/action-set/index.d.ts +9 -0
- package/lib/components/action-set/index.d.ts.map +1 -0
- package/lib/components/button/button.d.ts.map +1 -1
- package/lib/components/resizer/defs.d.ts +73 -0
- package/lib/components/resizer/defs.d.ts.map +1 -0
- package/lib/components/resizer/defs.js +112 -0
- package/lib/components/resizer/defs.js.map +1 -0
- package/lib/components/resizer/index.d.ts +11 -0
- package/lib/components/resizer/index.d.ts.map +1 -0
- package/lib/components/resizer/resizer-grid.d.ts +22 -0
- package/lib/components/resizer/resizer-grid.d.ts.map +1 -0
- package/lib/components/resizer/resizer-handle-pivot.d.ts +31 -0
- package/lib/components/resizer/resizer-handle-pivot.d.ts.map +1 -0
- package/lib/components/resizer/resizer-handle.d.ts +64 -0
- package/lib/components/resizer/resizer-handle.d.ts.map +1 -0
- package/lib/components/resizer/resizer-panel.d.ts +22 -0
- package/lib/components/resizer/resizer-panel.d.ts.map +1 -0
- package/lib/components/side-panel/_story-assets/index.d.ts +9 -0
- package/lib/components/side-panel/_story-assets/index.d.ts.map +1 -0
- package/lib/components/side-panel/defs.d.ts +7 -1
- package/lib/components/side-panel/defs.d.ts.map +1 -1
- package/lib/components/side-panel/defs.js +7 -1
- package/lib/components/side-panel/defs.js.map +1 -1
- package/lib/components/side-panel/index.d.ts +3 -1
- package/lib/components/side-panel/index.d.ts.map +1 -1
- package/lib/components/side-panel/side-panel.d.ts +60 -22
- package/lib/components/side-panel/side-panel.d.ts.map +1 -1
- package/lib/components/slider/slider.d.ts +14 -0
- package/lib/components/slider/slider.d.ts.map +1 -1
- package/lib/components/tabs/tab.d.ts.map +1 -1
- package/lib/components/truncated-text/index.d.ts +8 -0
- package/lib/components/truncated-text/index.d.ts.map +1 -0
- package/lib/components/truncated-text/truncated-text.d.ts +77 -0
- package/lib/components/truncated-text/truncated-text.d.ts.map +1 -0
- package/lib/globals/internal/icon-loader-utils.d.ts +2 -2
- package/lib/globals/internal/icon-loader-utils.d.ts.map +1 -1
- package/lib/index.d.ts.map +1 -1
- package/package.json +7 -7
- package/scss/components/action-set/action-set.scss +93 -0
- package/scss/components/data-table/_table-core.scss +73 -20
- package/scss/components/data-table/_table-selection.scss +31 -14
- package/scss/components/resizer/resizer-grid.scss +34 -0
- package/scss/components/resizer/resizer-handle-pivot.scss +39 -0
- package/scss/components/resizer/resizer-handle.scss +127 -0
- package/scss/components/resizer/resizer-panel.scss +10 -0
- package/scss/components/side-panel/side-panel.scss +363 -0
- package/scss/components/side-panel/story-styles.scss +51 -0
- package/scss/components/tabs/tabs.scss +4 -0
- package/scss/components/textarea/textarea.scss +6 -0
- package/scss/components/truncated-text/truncated-text-story.scss +14 -0
- package/scss/components/truncated-text/truncated-text.scss +122 -0
- package/telemetry.yml +26 -0
|
@@ -11,27 +11,28 @@ import __decorate from "../../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm
|
|
|
11
11
|
import iconLoader from "../../globals/internal/icon-loader.js";
|
|
12
12
|
import HostListener from "../../globals/decorators/host-listener.js";
|
|
13
13
|
import HostListenerMixin from "../../globals/mixins/host-listener.js";
|
|
14
|
-
import "../button/button-set-base.js";
|
|
15
14
|
import "../button/index.js";
|
|
16
15
|
import "../icon-button/index.js";
|
|
16
|
+
import "../action-set/index.js";
|
|
17
17
|
import "../layer/index.js";
|
|
18
|
+
import "../resizer/index.js";
|
|
18
19
|
import { SIDE_PANEL_PLACEMENT, SIDE_PANEL_SIZE } from "./defs.js";
|
|
20
|
+
import side_panel_default$1 from "./side-panel.scss.js";
|
|
19
21
|
import { LitElement, html } from "lit";
|
|
20
|
-
import { property, query,
|
|
21
|
-
import
|
|
22
|
-
import
|
|
22
|
+
import { property, query, state } from "lit/decorators.js";
|
|
23
|
+
import ArrowLeft16 from "@carbon/icons/es/arrow--left/16";
|
|
24
|
+
import Close16 from "@carbon/icons/es/close/16";
|
|
23
25
|
import { moderate02 } from "@carbon/motion";
|
|
24
26
|
//#region src/components/side-panel/side-panel.ts
|
|
25
27
|
/**
|
|
28
|
+
* @license
|
|
29
|
+
*
|
|
26
30
|
* Copyright IBM Corp. 2023, 2026
|
|
27
31
|
*
|
|
28
32
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
29
33
|
* LICENSE file in the root directory of this source tree.
|
|
30
34
|
*/
|
|
31
|
-
const PRECEDING = Node.DOCUMENT_POSITION_PRECEDING | Node.DOCUMENT_POSITION_CONTAINS;
|
|
32
|
-
const FOLLOWING = Node.DOCUMENT_POSITION_FOLLOWING | Node.DOCUMENT_POSITION_CONTAINED_BY;
|
|
33
35
|
const blockClass = `cds-custom--side-panel`;
|
|
34
|
-
const blockClassActionSet = `cds-custom--action-set`;
|
|
35
36
|
/**
|
|
36
37
|
* Observes resize of the given element with the given resize observer.
|
|
37
38
|
*
|
|
@@ -47,32 +48,8 @@ const observeResize = (observer, elem) => {
|
|
|
47
48
|
} };
|
|
48
49
|
};
|
|
49
50
|
/**
|
|
50
|
-
* Tries to focus on the given elements and bails out if one of them is successful.
|
|
51
|
-
*
|
|
52
|
-
* @param elems The elements.
|
|
53
|
-
* @param reverse `true` to go through the list in reverse order.
|
|
54
|
-
* @returns `true` if one of the attempts is successful, `false` otherwise.
|
|
55
|
-
*/
|
|
56
|
-
function tryFocusElems(elems, reverse) {
|
|
57
|
-
if (!reverse) for (let i = 0; i < elems.length; ++i) {
|
|
58
|
-
const elem = elems[i];
|
|
59
|
-
elem.focus();
|
|
60
|
-
if (elem.ownerDocument.activeElement === elem) return true;
|
|
61
|
-
}
|
|
62
|
-
else for (let i = elems.length - 1; i >= 0; --i) {
|
|
63
|
-
const elem = elems[i];
|
|
64
|
-
elem.focus();
|
|
65
|
-
if (elem.ownerDocument.activeElement === elem) return true;
|
|
66
|
-
}
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
51
|
* SidePanel.
|
|
71
52
|
*
|
|
72
|
-
* @deprecated Use Carbon for IBM Products `side-panel` component.
|
|
73
|
-
* This component has been deprecated in `@carbon/web-components` and will instead be maintained
|
|
74
|
-
* in the Carbon for IBM Products library:
|
|
75
|
-
* https://github.com/carbon-design-system/ibm-products/tree/main/packages/ibm-products-web-components
|
|
76
53
|
* @element cds-custom-side-panel
|
|
77
54
|
* @csspart dialog The dialog.
|
|
78
55
|
* @fires cds-custom-side-panel-beingclosed
|
|
@@ -93,20 +70,20 @@ let CDSSidePanel = class CDSSidePanel extends HostListenerMixin(LitElement) {
|
|
|
93
70
|
this._hasSlug = false;
|
|
94
71
|
this._hasActionToolbar = false;
|
|
95
72
|
this._actionsCount = 0;
|
|
73
|
+
this._actionsMultiple = "";
|
|
96
74
|
this._slugCloseSize = "sm";
|
|
97
|
-
this.
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
if (!tryFocusElems(this.querySelectorAll(selectorTabbableForSidePanel), true)) this.focus();
|
|
75
|
+
this._customHeaderElements = [];
|
|
76
|
+
this._customHeaderHidden = false;
|
|
77
|
+
this._accumulatedDelta = 0;
|
|
78
|
+
this._handleHostKeydown = (event) => {
|
|
79
|
+
if (event.key === "Tab" && !this.slideIn) {
|
|
80
|
+
const { first: _firstElement, last: _lastElement } = this.getFocusable();
|
|
81
|
+
if (event.shiftKey && (this.shadowRoot?.activeElement === _firstElement || document.activeElement === _firstElement)) {
|
|
82
|
+
event.preventDefault();
|
|
83
|
+
_lastElement?.focus();
|
|
84
|
+
} else if (!event.shiftKey && document.activeElement === _lastElement) {
|
|
85
|
+
event.preventDefault();
|
|
86
|
+
_firstElement?.focus();
|
|
110
87
|
}
|
|
111
88
|
}
|
|
112
89
|
};
|
|
@@ -130,7 +107,7 @@ let CDSSidePanel = class CDSSidePanel extends HostListenerMixin(LitElement) {
|
|
|
130
107
|
if (this.placement === "left") newValues.marginInlineStart = `${this?._sidePanel?.offsetWidth}px`;
|
|
131
108
|
else newValues.marginInlineEnd = `${this?._sidePanel?.offsetWidth}px`;
|
|
132
109
|
}
|
|
133
|
-
Object.keys(newValues).forEach((key) => {
|
|
110
|
+
if (this.slideIn) Object.keys(newValues).forEach((key) => {
|
|
134
111
|
pageContentEl.style[key] = newValues[key];
|
|
135
112
|
});
|
|
136
113
|
}
|
|
@@ -138,28 +115,27 @@ let CDSSidePanel = class CDSSidePanel extends HostListenerMixin(LitElement) {
|
|
|
138
115
|
};
|
|
139
116
|
this._checkSetOpen = () => {
|
|
140
117
|
const { _sidePanel: sidePanel } = this;
|
|
141
|
-
if (sidePanel && this._isOpen) if (this._reducedMotion) this._isOpen = false;
|
|
118
|
+
if (sidePanel && this._isOpen) if (this._reducedMotion?.matches) this._isOpen = false;
|
|
142
119
|
else sidePanel.addEventListener("transitionend", () => {
|
|
143
120
|
this._isOpen = false;
|
|
144
121
|
});
|
|
145
|
-
else this.
|
|
122
|
+
else if (this.open) requestAnimationFrame(() => {
|
|
123
|
+
this._isOpen = this.open;
|
|
124
|
+
});
|
|
125
|
+
else this._isOpen = false;
|
|
146
126
|
};
|
|
147
127
|
this._checkUpdateIconButtonSizes = () => {
|
|
148
128
|
const slug = this.querySelector(`cds-custom-slug`);
|
|
149
129
|
const otherButtons = this?.shadowRoot?.querySelectorAll("#nav-back-button, #close-button");
|
|
150
|
-
|
|
151
|
-
if (slug
|
|
152
|
-
|
|
130
|
+
const shouldUpgrade = (this?.querySelectorAll?.(`cds-custom-button[slot='actions']`))?.length && /l/.test(this.size);
|
|
131
|
+
if (slug && shouldUpgrade) slug.setAttribute("size", "md");
|
|
132
|
+
if (otherButtons) {
|
|
133
|
+
const iconButtonSize = shouldUpgrade ? "md" : "sm";
|
|
134
|
+
[...otherButtons].forEach((btn) => {
|
|
135
|
+
btn.setAttribute("size", iconButtonSize);
|
|
136
|
+
});
|
|
153
137
|
}
|
|
154
|
-
if (slug) slug?.setAttribute("size", iconButtonSize);
|
|
155
|
-
if (otherButtons) [...otherButtons].forEach((btn) => {
|
|
156
|
-
btn.setAttribute("size", iconButtonSize);
|
|
157
|
-
});
|
|
158
138
|
};
|
|
159
|
-
this._checkUpdateActionSizes = () => {
|
|
160
|
-
if (this._actions) for (let i = 0; i < this._actions.length; i++) this._actions[i].setAttribute("size", this.condensedActions ? "lg" : "xl");
|
|
161
|
-
};
|
|
162
|
-
this._maxActions = 3;
|
|
163
139
|
this._checkSetDoAnimateTitle = () => {
|
|
164
140
|
let canDoAnimateTitle = false;
|
|
165
141
|
if (this._sidePanel && this.open && this.animateTitle && this?.title?.length && !this._reducedMotion.matches) {
|
|
@@ -187,7 +163,62 @@ let CDSSidePanel = class CDSSidePanel extends HostListenerMixin(LitElement) {
|
|
|
187
163
|
this._scrollObserver = () => {
|
|
188
164
|
const scrollTop = this._animateScrollWrapper?.scrollTop ?? 0;
|
|
189
165
|
const scrollAnimationDistance = this._getScrollAnimationDistance();
|
|
190
|
-
|
|
166
|
+
const animationProgress = Math.min(scrollTop, scrollAnimationDistance) / scrollAnimationDistance;
|
|
167
|
+
this?._sidePanel?.style?.setProperty(`--${blockClass}--scroll-animation-progress`, `${animationProgress}`);
|
|
168
|
+
this._customHeaderHidden = animationProgress === 1;
|
|
169
|
+
};
|
|
170
|
+
this._handleResizeStart = () => {
|
|
171
|
+
this._sidePanelWidth = this._sidePanel?.clientWidth;
|
|
172
|
+
this._accumulatedDelta = 0;
|
|
173
|
+
};
|
|
174
|
+
this._handleResizeDrag = (event) => {
|
|
175
|
+
const { delta, isKeyboard, key } = event.detail;
|
|
176
|
+
if (!this._sidePanelWidth) this._sidePanelWidth = this._sidePanel?.clientWidth;
|
|
177
|
+
if (isKeyboard && (key === "Home" || key === "End")) {
|
|
178
|
+
if (key === "Home") this.style.setProperty("--cds-side-panel-modified-size", "75vw");
|
|
179
|
+
else this.style.setProperty("--cds-side-panel-modified-size", "16rem");
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
let calculatedWidth;
|
|
183
|
+
if (isKeyboard) {
|
|
184
|
+
this._accumulatedDelta += delta;
|
|
185
|
+
calculatedWidth = this._sidePanelWidth - (this.placement === "right" ? this._accumulatedDelta : -this._accumulatedDelta);
|
|
186
|
+
} else calculatedWidth = this._sidePanelWidth - (this.placement === "right" ? delta : -delta);
|
|
187
|
+
if (this._sidePanel?.style) this._sidePanel.style.transition = "none";
|
|
188
|
+
const minWidth = 256;
|
|
189
|
+
const maxWidth = window.innerWidth * .75;
|
|
190
|
+
const newWidth = Math.max(minWidth, Math.min(maxWidth, calculatedWidth));
|
|
191
|
+
this.style.setProperty("--cds-side-panel-modified-size", `${newWidth}px`);
|
|
192
|
+
};
|
|
193
|
+
this._handleResizeEnd = () => {
|
|
194
|
+
this._accumulatedDelta = 0;
|
|
195
|
+
this._sidePanel?.style?.removeProperty("transition");
|
|
196
|
+
this._sidePanelWidth = this._sidePanel?.clientWidth;
|
|
197
|
+
if (this._resizerHandle) {
|
|
198
|
+
this._resizerHandle.setAttribute("aria-label", `side panel is covering ${this._getPanelWidthPercent()}% of screen`);
|
|
199
|
+
this._resizerHandle.setAttribute("aria-valuenow", this._getPanelWidthPercent().toString());
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
this._handleResizeReset = () => {
|
|
203
|
+
const sizeMap = {
|
|
204
|
+
xs: "16rem",
|
|
205
|
+
sm: "20rem",
|
|
206
|
+
md: "30rem",
|
|
207
|
+
lg: "40rem",
|
|
208
|
+
xl: "65rem",
|
|
209
|
+
"2xl": "80rem"
|
|
210
|
+
};
|
|
211
|
+
const defaultSize = sizeMap[this.size] || sizeMap.md;
|
|
212
|
+
const defaultSizeInPx = parseFloat(defaultSize) * 16;
|
|
213
|
+
this._sidePanelWidth = Math.min(defaultSizeInPx, window.innerWidth * .75);
|
|
214
|
+
this.style.removeProperty("--cds-side-panel-modified-size");
|
|
215
|
+
};
|
|
216
|
+
this._getPanelWidthPercent = (customWidth) => {
|
|
217
|
+
if (customWidth) {
|
|
218
|
+
const remInPixels = parseFloat(customWidth) * parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
219
|
+
return Math.round(remInPixels / window.innerWidth * 100);
|
|
220
|
+
}
|
|
221
|
+
return Math.round((this._sidePanel?.clientWidth || 0) / window.innerWidth * 100);
|
|
191
222
|
};
|
|
192
223
|
this._handleCurrentStepUpdate = () => {
|
|
193
224
|
const scrollable = this._animateScrollWrapper ?? this._innerContent;
|
|
@@ -195,6 +226,7 @@ let CDSSidePanel = class CDSSidePanel extends HostListenerMixin(LitElement) {
|
|
|
195
226
|
};
|
|
196
227
|
this.animateTitle = true;
|
|
197
228
|
this.closeIconDescription = "Close";
|
|
229
|
+
this.closeIconTooltipAlignment = "left";
|
|
198
230
|
this.condensedActions = false;
|
|
199
231
|
this.includeOverlay = false;
|
|
200
232
|
this.navigationBackIconDescription = "Back";
|
|
@@ -202,8 +234,69 @@ let CDSSidePanel = class CDSSidePanel extends HostListenerMixin(LitElement) {
|
|
|
202
234
|
this.placement = "right";
|
|
203
235
|
this.preventCloseOnClickOutside = false;
|
|
204
236
|
this.selectorPageContent = "";
|
|
237
|
+
this.hideCloseButton = false;
|
|
205
238
|
this.size = "md";
|
|
206
239
|
this.slideIn = false;
|
|
240
|
+
this.resizable = false;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Get focusable elements.
|
|
244
|
+
*
|
|
245
|
+
* Querying all tabbable items.
|
|
246
|
+
*
|
|
247
|
+
* @returns {{first: HTMLElement, last: HTMLElement, all: HTMLElement[]}} Returns an object with various elements.
|
|
248
|
+
*/
|
|
249
|
+
getFocusable() {
|
|
250
|
+
const elements = [];
|
|
251
|
+
if (this.currentStep > 0) {
|
|
252
|
+
const backButton = this.shadowRoot?.querySelector(`.${blockClass}__navigation-back-button`);
|
|
253
|
+
if (backButton) elements.push(backButton);
|
|
254
|
+
}
|
|
255
|
+
const aboveTitleSlot = this.shadowRoot?.querySelector("slot[name=\"above-title\"]");
|
|
256
|
+
if (aboveTitleSlot) {
|
|
257
|
+
const aboveTitleElements = aboveTitleSlot.assignedElements({ flatten: true }).flatMap((el) => Array.from(el.querySelectorAll(selectorTabbable)));
|
|
258
|
+
elements.push(...aboveTitleElements);
|
|
259
|
+
}
|
|
260
|
+
const labelText = this.shadowRoot?.querySelector(`.${blockClass}__label-text`);
|
|
261
|
+
if (labelText) elements.push(labelText);
|
|
262
|
+
const titleText = this.shadowRoot?.querySelector(`.${blockClass}__title-text`);
|
|
263
|
+
if (titleText) elements.push(titleText);
|
|
264
|
+
if (this._hasSlug) {
|
|
265
|
+
const slugElements = Array.from(this.querySelectorAll(`cds-custom-slug`));
|
|
266
|
+
elements.push(...slugElements);
|
|
267
|
+
}
|
|
268
|
+
if (!this.hideCloseButton) {
|
|
269
|
+
const closeButton = this.shadowRoot?.querySelector(`.${blockClass}__close-button`);
|
|
270
|
+
if (closeButton) elements.push(closeButton);
|
|
271
|
+
}
|
|
272
|
+
const subtitleText = this.shadowRoot?.querySelector(`.${blockClass}__subtitle-text`);
|
|
273
|
+
if (subtitleText && !subtitleText.hidden) elements.push(subtitleText);
|
|
274
|
+
const belowTitleSlot = this.shadowRoot?.querySelector("slot[name=\"below-title\"]");
|
|
275
|
+
if (belowTitleSlot) {
|
|
276
|
+
const belowTitleElements = belowTitleSlot.assignedElements({ flatten: true }).flatMap((el) => Array.from(el.querySelectorAll(selectorTabbable)));
|
|
277
|
+
elements.push(...belowTitleElements);
|
|
278
|
+
}
|
|
279
|
+
const actionToolbarSlot = this.shadowRoot?.querySelector("slot[name=\"action-toolbar\"]");
|
|
280
|
+
if (actionToolbarSlot) {
|
|
281
|
+
const actionToolbarElements = actionToolbarSlot.assignedElements({ flatten: true }).filter((el) => el instanceof HTMLElement && typeof el.focus === "function");
|
|
282
|
+
elements.push(...actionToolbarElements);
|
|
283
|
+
}
|
|
284
|
+
const defaultSlot = this.shadowRoot?.querySelector("slot:not([name])");
|
|
285
|
+
if (defaultSlot) {
|
|
286
|
+
const bodyElements = defaultSlot.assignedElements({ flatten: true }).flatMap((el) => Array.from(el.querySelectorAll(selectorTabbable)));
|
|
287
|
+
elements.push(...bodyElements);
|
|
288
|
+
}
|
|
289
|
+
const actionsSlot = this.shadowRoot?.querySelector("slot[name=\"actions\"]");
|
|
290
|
+
if (actionsSlot) {
|
|
291
|
+
const actionElements = actionsSlot.assignedElements({ flatten: true }).filter((el) => el instanceof HTMLElement && typeof el.focus === "function");
|
|
292
|
+
elements.push(...actionElements);
|
|
293
|
+
}
|
|
294
|
+
const all = elements.filter((el) => typeof el?.focus === "function");
|
|
295
|
+
return {
|
|
296
|
+
first: all[0],
|
|
297
|
+
last: all[all.length - 1],
|
|
298
|
+
all
|
|
299
|
+
};
|
|
207
300
|
}
|
|
208
301
|
/**
|
|
209
302
|
* Handles `click` event on the side-panel container.
|
|
@@ -255,24 +348,33 @@ let CDSSidePanel = class CDSSidePanel extends HostListenerMixin(LitElement) {
|
|
|
255
348
|
const subtitle = e.target?.assignedElements();
|
|
256
349
|
this._hasSubtitle = subtitle.length > 0;
|
|
257
350
|
}
|
|
351
|
+
_handleCustomHeaderSlotChange(e) {
|
|
352
|
+
(e.target?.assignedElements()).forEach((el) => {
|
|
353
|
+
if (el instanceof HTMLElement) {
|
|
354
|
+
el.style.opacity = `calc(1 - var(--${blockClass}--scroll-animation-progress))`;
|
|
355
|
+
this._customHeaderElements.push(el);
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
}
|
|
258
359
|
_handleActionToolbarChange(e) {
|
|
259
360
|
const toolbarActions = e.target?.assignedElements();
|
|
260
361
|
this._hasActionToolbar = toolbarActions && toolbarActions.length > 0;
|
|
261
|
-
if (this._hasActionToolbar) for (
|
|
362
|
+
if (this._hasActionToolbar) for (let i = 0; i < toolbarActions.length; i++) {
|
|
363
|
+
const toolbarAction = toolbarActions[i];
|
|
364
|
+
toolbarAction.setAttribute("size", "sm");
|
|
365
|
+
if (i === 0) toolbarAction.classList.add(`${blockClass}__action-toolbar-leading-button`);
|
|
366
|
+
else toolbarAction.classList.remove(`${blockClass}__action-toolbar-leading-button`);
|
|
367
|
+
}
|
|
262
368
|
}
|
|
263
369
|
_handleActionsChange(e) {
|
|
264
370
|
const actions = e.target?.assignedElements();
|
|
265
371
|
this._checkUpdateIconButtonSizes();
|
|
266
372
|
const actionsCount = actions?.length ?? 0;
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
actions[i].setAttribute("hidden", "true");
|
|
273
|
-
actions[i].setAttribute(`data-actions-limit-${this._maxActions}-exceeded`, `${actions.length}`);
|
|
274
|
-
} else actions[i].classList.add(`${blockClassActionSet}__action-button`);
|
|
275
|
-
this._checkUpdateActionSizes();
|
|
373
|
+
this._actionsCount = actionsCount;
|
|
374
|
+
if (actionsCount === 1) this._actionsMultiple = "single";
|
|
375
|
+
else if (actionsCount === 2) this._actionsMultiple = "double";
|
|
376
|
+
else if (actionsCount === 3) this._actionsMultiple = "triple";
|
|
377
|
+
else this._actionsMultiple = "";
|
|
276
378
|
}
|
|
277
379
|
async connectObservers() {
|
|
278
380
|
await this.updateComplete;
|
|
@@ -285,30 +387,30 @@ let CDSSidePanel = class CDSSidePanel extends HostListenerMixin(LitElement) {
|
|
|
285
387
|
super.connectedCallback();
|
|
286
388
|
this.disconnectObservers();
|
|
287
389
|
this.connectObservers();
|
|
390
|
+
this.addEventListener("resize-start", this._handleResizeStart);
|
|
391
|
+
this.addEventListener("resize-drag", this._handleResizeDrag);
|
|
392
|
+
this.addEventListener("resize-end", this._handleResizeEnd);
|
|
393
|
+
this.addEventListener("resize-reset", this._handleResizeReset);
|
|
288
394
|
}
|
|
289
395
|
disconnectedCallback() {
|
|
290
396
|
super.disconnectedCallback();
|
|
291
397
|
this.disconnectObservers();
|
|
398
|
+
this.removeEventListener("resize-start", this._handleResizeStart);
|
|
399
|
+
this.removeEventListener("resize-drag", this._handleResizeDrag);
|
|
400
|
+
this.removeEventListener("resize-end", this._handleResizeEnd);
|
|
401
|
+
this.removeEventListener("resize-reset", this._handleResizeReset);
|
|
292
402
|
}
|
|
293
403
|
render() {
|
|
294
|
-
const { closeIconDescription, condensedActions, currentStep, includeOverlay, labelText, navigationBackIconDescription, open, placement, size, slideIn, title } = this;
|
|
404
|
+
const { closeIconDescription, closeIconTooltipAlignment, condensedActions, currentStep, includeOverlay, labelText, navigationBackIconDescription, open, placement, hideCloseButton, size, slideIn, title } = this;
|
|
295
405
|
if (!open && !this._isOpen) return html``;
|
|
296
|
-
const
|
|
297
|
-
"",
|
|
298
|
-
"single",
|
|
299
|
-
"double",
|
|
300
|
-
"triple"
|
|
301
|
-
][this._actionsCount];
|
|
302
|
-
const titleTemplate = html`<div
|
|
406
|
+
const titleTemplate = html` <div
|
|
303
407
|
class=${`${blockClass}__title`}
|
|
304
408
|
?no-label=${!!labelText}>
|
|
305
|
-
<h2 class=${title ? `${blockClass}__title-text` : ""}
|
|
409
|
+
<h2 class=${title ? `${blockClass}__title-text` : ""} tabindex="0">
|
|
306
410
|
${title}
|
|
307
411
|
</h2>
|
|
308
|
-
|
|
309
412
|
${this._doAnimateTitle ? html`<h2
|
|
310
413
|
class=${`${blockClass}__collapsed-title-text`}
|
|
311
|
-
title=${title}
|
|
312
414
|
aria-hidden="true">
|
|
313
415
|
${title}
|
|
314
416
|
</h2>` : ""}
|
|
@@ -334,8 +436,18 @@ let CDSSidePanel = class CDSSidePanel extends HostListenerMixin(LitElement) {
|
|
|
334
436
|
</span>
|
|
335
437
|
</cds-custom-icon-button>` : ""}
|
|
336
438
|
|
|
439
|
+
<!-- slot for custom header components -->
|
|
440
|
+
<div
|
|
441
|
+
class=${`${blockClass}__custom-header-wrapper${this._customHeaderHidden ? ` ${blockClass}__custom-header-wrapper--hidden` : ""}`}>
|
|
442
|
+
<slot
|
|
443
|
+
name="above-title"
|
|
444
|
+
@slotchange=${this._handleCustomHeaderSlotChange}></slot>
|
|
445
|
+
</div>
|
|
446
|
+
|
|
337
447
|
<!-- render title label -->
|
|
338
|
-
${title?.length && labelText?.length ? html` <p class=${`${blockClass}__label-text`}
|
|
448
|
+
${title?.length && labelText?.length ? html` <p class=${`${blockClass}__label-text`} tabindex="0">
|
|
449
|
+
${labelText}
|
|
450
|
+
</p>` : ""}
|
|
339
451
|
|
|
340
452
|
<!-- title -->
|
|
341
453
|
${title ? titleTemplate : ""}
|
|
@@ -344,16 +456,16 @@ let CDSSidePanel = class CDSSidePanel extends HostListenerMixin(LitElement) {
|
|
|
344
456
|
<div class=${`${blockClass}__slug-and-close`}>
|
|
345
457
|
<slot name="slug" @slotchange=${this._handleSlugChange}></slot>
|
|
346
458
|
<!-- {normalizedSlug} -->
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
459
|
+
${!hideCloseButton ? html`<cds-custom-icon-button
|
|
460
|
+
align=${closeIconTooltipAlignment}
|
|
461
|
+
aria-label=${closeIconDescription}
|
|
462
|
+
kind="ghost"
|
|
463
|
+
size="sm"
|
|
464
|
+
class=${`${blockClass}__close-button`}
|
|
465
|
+
@click=${this._handleCloseClick}>
|
|
466
|
+
${iconLoader(Close16, { slot: "icon" })}
|
|
467
|
+
<span slot="tooltip-content"> ${closeIconDescription} </span>
|
|
468
|
+
</cds-custom-icon-button>` : ""}
|
|
357
469
|
</div>
|
|
358
470
|
|
|
359
471
|
<!-- render sub title -->
|
|
@@ -362,12 +474,21 @@ let CDSSidePanel = class CDSSidePanel extends HostListenerMixin(LitElement) {
|
|
|
362
474
|
?hidden=${!this._hasSubtitle}
|
|
363
475
|
?no-title-animation=${!this._doAnimateTitle}
|
|
364
476
|
?no-action-toolbar=${!this._hasActionToolbar}
|
|
365
|
-
?no-title=${!title}
|
|
477
|
+
?no-title=${!title}
|
|
478
|
+
tabindex="0">
|
|
366
479
|
<slot
|
|
367
480
|
name="subtitle"
|
|
368
481
|
@slotchange=${this._handleSubtitleChange}></slot>
|
|
369
482
|
</p>
|
|
370
483
|
|
|
484
|
+
<!-- slot for custom header components -->
|
|
485
|
+
<div
|
|
486
|
+
class=${`${blockClass}__custom-header-wrapper${this._customHeaderHidden ? ` ${blockClass}__custom-header-wrapper--hidden` : ""}`}>
|
|
487
|
+
<slot
|
|
488
|
+
name="below-title"
|
|
489
|
+
@slotchange=${this._handleCustomHeaderSlotChange}></slot>
|
|
490
|
+
</div>
|
|
491
|
+
|
|
371
492
|
<div
|
|
372
493
|
class=${this._hasActionToolbar ? `${blockClass}__action-toolbar` : ""}
|
|
373
494
|
?hidden=${!this._hasActionToolbar}
|
|
@@ -399,33 +520,31 @@ let CDSSidePanel = class CDSSidePanel extends HostListenerMixin(LitElement) {
|
|
|
399
520
|
?condensed-actions=${condensedActions}
|
|
400
521
|
?overlay=${includeOverlay || slideIn}
|
|
401
522
|
?slide-in=${slideIn}
|
|
523
|
+
?resizable=${this.resizable && !slideIn}
|
|
402
524
|
size=${size}>
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
525
|
+
${!slideIn && this.resizable && typeof window !== "undefined" && window.innerWidth > 768 ? html`<cds-custom-resizer-handle
|
|
526
|
+
class="${blockClass}__resizer"
|
|
527
|
+
orientation="horizontal"
|
|
528
|
+
aria-valuemin="${this._getPanelWidthPercent("16rem")}"
|
|
529
|
+
aria-valuemax="75"
|
|
530
|
+
aria-valuenow="${this._getPanelWidthPercent()}"
|
|
531
|
+
aria-label="side panel is covering ${this._getPanelWidthPercent()}% of screen"
|
|
532
|
+
@resize-start=${this._handleResizeStart}
|
|
533
|
+
@resize-drag=${this._handleResizeDrag}
|
|
534
|
+
@resize-end=${this._handleResizeEnd}
|
|
535
|
+
@resize-reset=${this._handleResizeReset}></cds-custom-resizer-handle>` : ""}
|
|
410
536
|
${this._doAnimateTitle ? html`<div class=${`${blockClass}__animated-scroll-wrapper`} scrolls>
|
|
411
537
|
${headerTemplate} ${mainTemplate}
|
|
412
538
|
</div>` : html` ${headerTemplate} ${mainTemplate}`}
|
|
413
539
|
|
|
414
|
-
<cds-custom-
|
|
540
|
+
<cds-custom-action-set
|
|
415
541
|
class=${`${blockClass}__actions-container`}
|
|
416
542
|
?hidden=${this._actionsCount === 0}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
543
|
+
size=${/^(lg|xl|2xl)$/.test(size) ? "lg" : "md"}
|
|
544
|
+
button-size=${condensedActions ? "md" : "lg"}
|
|
545
|
+
actions-multiple=${this._actionsMultiple}>
|
|
420
546
|
<slot name="actions" @slotchange=${this._handleActionsChange}></slot>
|
|
421
|
-
</cds-custom-
|
|
422
|
-
|
|
423
|
-
<a
|
|
424
|
-
id="end-sentinel"
|
|
425
|
-
class="sentinel"
|
|
426
|
-
hidden
|
|
427
|
-
href="javascript:void 0"
|
|
428
|
-
role="navigation"></a>
|
|
547
|
+
</cds-custom-action-set>
|
|
429
548
|
</div>
|
|
430
549
|
|
|
431
550
|
${includeOverlay ? html`<div
|
|
@@ -439,7 +558,6 @@ let CDSSidePanel = class CDSSidePanel extends HostListenerMixin(LitElement) {
|
|
|
439
558
|
`;
|
|
440
559
|
}
|
|
441
560
|
async updated(changedProperties) {
|
|
442
|
-
if (changedProperties.has("condensedActions")) this._checkUpdateActionSizes();
|
|
443
561
|
if (changedProperties.has("currentStep")) this._handleCurrentStepUpdate();
|
|
444
562
|
if (changedProperties.has("_doAnimateTitle")) {
|
|
445
563
|
this?._animateScrollWrapper?.removeEventListener("scroll", this._scrollObserver);
|
|
@@ -453,16 +571,23 @@ let CDSSidePanel = class CDSSidePanel extends HostListenerMixin(LitElement) {
|
|
|
453
571
|
this.disconnectObservers();
|
|
454
572
|
if (this.open) {
|
|
455
573
|
this.connectObservers();
|
|
456
|
-
this._launcher = this.ownerDocument
|
|
457
|
-
const focusNode = this.selectorInitialFocus && this.querySelector(this.selectorInitialFocus);
|
|
574
|
+
this._launcher = this.ownerDocument?.activeElement ?? null;
|
|
458
575
|
await this.constructor._delay();
|
|
459
|
-
if (
|
|
460
|
-
else if (!
|
|
461
|
-
|
|
462
|
-
|
|
576
|
+
if (this.selectorInitialFocus?.trim()?.length) this.querySelector(this.selectorInitialFocus)?.focus();
|
|
577
|
+
else if (!this.slideIn) {
|
|
578
|
+
const { first: _firstElement } = this.getFocusable();
|
|
579
|
+
_firstElement?.focus();
|
|
580
|
+
}
|
|
581
|
+
} else if (this._launcher && typeof this._launcher?.focus === "function") {
|
|
582
|
+
this._launcher?.focus();
|
|
463
583
|
this._launcher = null;
|
|
464
584
|
}
|
|
465
585
|
}
|
|
586
|
+
if (changedProperties.has("size") && this.resizable && !this.slideIn || changedProperties.has("resizable") && !this.resizable) this.style.removeProperty("--cds-side-panel-modified-size");
|
|
587
|
+
if ((changedProperties.has("resizable") || changedProperties.has("open")) && this.resizable && !this.slideIn && this.open) {
|
|
588
|
+
await this.updateComplete;
|
|
589
|
+
this._sidePanelWidth = this._sidePanel?.clientWidth;
|
|
590
|
+
}
|
|
466
591
|
}
|
|
467
592
|
/**
|
|
468
593
|
* @param ms The number of milliseconds.
|
|
@@ -498,19 +623,17 @@ let CDSSidePanel = class CDSSidePanel extends HostListenerMixin(LitElement) {
|
|
|
498
623
|
static get eventNavigateBack() {
|
|
499
624
|
return `cds-custom-side-panel-navigate-back`;
|
|
500
625
|
}
|
|
626
|
+
static {
|
|
627
|
+
this.styles = side_panel_default$1;
|
|
628
|
+
}
|
|
501
629
|
};
|
|
502
|
-
__decorate([query("#start-sentinel")], CDSSidePanel.prototype, "_startSentinelNode", void 0);
|
|
503
|
-
__decorate([query("#end-sentinel")], CDSSidePanel.prototype, "_endSentinelNode", void 0);
|
|
504
630
|
__decorate([query(`.${blockClass}`)], CDSSidePanel.prototype, "_sidePanel", void 0);
|
|
505
631
|
__decorate([query(`.${blockClass}__animated-scroll-wrapper`)], CDSSidePanel.prototype, "_animateScrollWrapper", void 0);
|
|
506
632
|
__decorate([query(`.${blockClass}__label-text`)], CDSSidePanel.prototype, "_label", void 0);
|
|
507
633
|
__decorate([query(`.${blockClass}__title-text`)], CDSSidePanel.prototype, "_title", void 0);
|
|
508
634
|
__decorate([query(`.${blockClass}__subtitle-text`)], CDSSidePanel.prototype, "_subtitle", void 0);
|
|
509
635
|
__decorate([query(`.${blockClass}__inner-content`)], CDSSidePanel.prototype, "_innerContent", void 0);
|
|
510
|
-
__decorate([
|
|
511
|
-
slot: "actions",
|
|
512
|
-
selector: `cds-custom-button`
|
|
513
|
-
})], CDSSidePanel.prototype, "_actions", void 0);
|
|
636
|
+
__decorate([query(`cds-custom-resizer-handle`)], CDSSidePanel.prototype, "_resizerHandle", void 0);
|
|
514
637
|
__decorate([state()], CDSSidePanel.prototype, "_doAnimateTitle", void 0);
|
|
515
638
|
__decorate([state()], CDSSidePanel.prototype, "_isOpen", void 0);
|
|
516
639
|
__decorate([state()], CDSSidePanel.prototype, "_containerScrollTop", void 0);
|
|
@@ -518,8 +641,13 @@ __decorate([state()], CDSSidePanel.prototype, "_hasSubtitle", void 0);
|
|
|
518
641
|
__decorate([state()], CDSSidePanel.prototype, "_hasSlug", void 0);
|
|
519
642
|
__decorate([state()], CDSSidePanel.prototype, "_hasActionToolbar", void 0);
|
|
520
643
|
__decorate([state()], CDSSidePanel.prototype, "_actionsCount", void 0);
|
|
644
|
+
__decorate([state()], CDSSidePanel.prototype, "_actionsMultiple", void 0);
|
|
521
645
|
__decorate([state()], CDSSidePanel.prototype, "_slugCloseSize", void 0);
|
|
522
|
-
__decorate([
|
|
646
|
+
__decorate([state()], CDSSidePanel.prototype, "_customHeaderElements", void 0);
|
|
647
|
+
__decorate([state()], CDSSidePanel.prototype, "_customHeaderHidden", void 0);
|
|
648
|
+
__decorate([state()], CDSSidePanel.prototype, "_sidePanelWidth", void 0);
|
|
649
|
+
__decorate([state()], CDSSidePanel.prototype, "_accumulatedDelta", void 0);
|
|
650
|
+
__decorate([HostListener("keydown")], CDSSidePanel.prototype, "_handleHostKeydown", void 0);
|
|
523
651
|
__decorate([HostListener("document:keydown")], CDSSidePanel.prototype, "_handleKeydown", void 0);
|
|
524
652
|
__decorate([property({
|
|
525
653
|
reflect: true,
|
|
@@ -528,8 +656,14 @@ __decorate([property({
|
|
|
528
656
|
})], CDSSidePanel.prototype, "animateTitle", void 0);
|
|
529
657
|
__decorate([property({
|
|
530
658
|
reflect: true,
|
|
531
|
-
attribute: "close-icon-description"
|
|
659
|
+
attribute: "close-icon-description",
|
|
660
|
+
type: String
|
|
532
661
|
})], CDSSidePanel.prototype, "closeIconDescription", void 0);
|
|
662
|
+
__decorate([property({
|
|
663
|
+
reflect: true,
|
|
664
|
+
attribute: "close-icon-tooltip-alignment",
|
|
665
|
+
type: String
|
|
666
|
+
})], CDSSidePanel.prototype, "closeIconTooltipAlignment", void 0);
|
|
533
667
|
__decorate([property({
|
|
534
668
|
type: Boolean,
|
|
535
669
|
reflect: true,
|
|
@@ -574,6 +708,10 @@ __decorate([property({
|
|
|
574
708
|
reflect: true,
|
|
575
709
|
attribute: "selector-page-content"
|
|
576
710
|
})], CDSSidePanel.prototype, "selectorPageContent", void 0);
|
|
711
|
+
__decorate([property({
|
|
712
|
+
attribute: "hide-close-button",
|
|
713
|
+
type: Boolean
|
|
714
|
+
})], CDSSidePanel.prototype, "hideCloseButton", void 0);
|
|
577
715
|
__decorate([property({
|
|
578
716
|
reflect: true,
|
|
579
717
|
type: String
|
|
@@ -583,6 +721,10 @@ __decorate([property({
|
|
|
583
721
|
type: Boolean,
|
|
584
722
|
reflect: true
|
|
585
723
|
})], CDSSidePanel.prototype, "slideIn", void 0);
|
|
724
|
+
__decorate([property({
|
|
725
|
+
type: Boolean,
|
|
726
|
+
reflect: true
|
|
727
|
+
})], CDSSidePanel.prototype, "resizable", void 0);
|
|
586
728
|
__decorate([property({
|
|
587
729
|
reflect: false,
|
|
588
730
|
type: String
|