@govtechsg/sgds-web-component 3.15.1-rc.2 → 3.16.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/components/Badge/index.umd.min.js +1 -1
- package/components/Badge/index.umd.min.js.map +1 -1
- package/components/Breadcrumb/index.umd.min.js +6 -6
- package/components/Breadcrumb/index.umd.min.js.map +1 -1
- package/components/ComboBox/index.umd.min.js +2 -2
- package/components/ComboBox/index.umd.min.js.map +1 -1
- package/components/Datepicker/index.umd.min.js +1 -1
- package/components/Datepicker/index.umd.min.js.map +1 -1
- package/components/Drawer/drawer.js +1 -1
- package/components/Drawer/index.umd.min.js +1 -1
- package/components/Drawer/index.umd.min.js.map +1 -1
- package/components/Dropdown/dropdown-menu.js +1 -1
- package/components/Dropdown/index.umd.min.js +1 -1
- package/components/Dropdown/index.umd.min.js.map +1 -1
- package/components/Mainnav/index.umd.min.js +9 -9
- package/components/Mainnav/index.umd.min.js.map +1 -1
- package/components/Mainnav/mainnav.js +1 -1
- package/components/Modal/index.umd.min.js +1 -1
- package/components/Modal/index.umd.min.js.map +1 -1
- package/components/Modal/modal.js +1 -1
- package/components/OverflowMenu/index.umd.min.js +6 -6
- package/components/OverflowMenu/index.umd.min.js.map +1 -1
- package/components/Select/index.umd.min.js +1 -1
- package/components/Select/index.umd.min.js.map +1 -1
- package/components/Subnav/index.umd.min.js +1 -1
- package/components/Subnav/index.umd.min.js.map +1 -1
- package/components/Subnav/subnav.js +1 -1
- package/components/Toast/index.umd.min.js +1 -1
- package/components/Toast/index.umd.min.js.map +1 -1
- package/components/Toast/toast-container.js +1 -1
- package/components/Tooltip/index.umd.min.js +1 -1
- package/components/Tooltip/index.umd.min.js.map +1 -1
- package/components/Tooltip/tooltip.js +1 -1
- package/components/index.d.ts +0 -1
- package/components/index.js +0 -1
- package/components/index.js.map +1 -1
- package/components/index.umd.min.js +64 -116
- package/components/index.umd.min.js.map +1 -1
- package/css/fouc.css +1 -5
- package/css/utility.css +0 -14
- package/index.d.ts +0 -1
- package/index.js +0 -1
- package/index.js.map +1 -1
- package/index.umd.min.js +63 -194
- package/index.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/react/components/Drawer/drawer.cjs.js +1 -1
- package/react/components/Drawer/drawer.js +1 -1
- package/react/components/Dropdown/dropdown-menu.cjs.js +1 -1
- package/react/components/Dropdown/dropdown-menu.js +1 -1
- package/react/components/Mainnav/mainnav.cjs.js +1 -1
- package/react/components/Mainnav/mainnav.js +1 -1
- package/react/components/Modal/modal.cjs.js +1 -1
- package/react/components/Modal/modal.js +1 -1
- package/react/components/Subnav/subnav.cjs.js +1 -1
- package/react/components/Subnav/subnav.js +1 -1
- package/react/components/Toast/toast-container.cjs.js +1 -1
- package/react/components/Toast/toast-container.js +1 -1
- package/react/components/Tooltip/tooltip.cjs.js +1 -1
- package/react/components/Tooltip/tooltip.js +1 -1
- package/react/index.cjs.js +54 -62
- package/react/index.cjs.js.map +1 -1
- package/react/index.d.ts +1 -5
- package/react/index.js +1 -5
- package/react/index.js.map +1 -1
- package/themes/root.css +0 -13
- package/components/Sidebar/index.d.ts +0 -16
- package/components/Sidebar/index.js +0 -10
- package/components/Sidebar/index.js.map +0 -1
- package/components/Sidebar/index.umd.min.js +0 -2501
- package/components/Sidebar/index.umd.min.js.map +0 -1
- package/components/Sidebar/sgds-sidebar-group.d.ts +0 -51
- package/components/Sidebar/sgds-sidebar-group.js +0 -123
- package/components/Sidebar/sgds-sidebar-group.js.map +0 -1
- package/components/Sidebar/sgds-sidebar-item.d.ts +0 -17
- package/components/Sidebar/sgds-sidebar-item.js +0 -61
- package/components/Sidebar/sgds-sidebar-item.js.map +0 -1
- package/components/Sidebar/sgds-sidebar-section.d.ts +0 -56
- package/components/Sidebar/sgds-sidebar-section.js +0 -125
- package/components/Sidebar/sgds-sidebar-section.js.map +0 -1
- package/components/Sidebar/sgds-sidebar.d.ts +0 -161
- package/components/Sidebar/sgds-sidebar.js +0 -424
- package/components/Sidebar/sgds-sidebar.js.map +0 -1
- package/components/Sidebar/sidebar-context.d.ts +0 -51
- package/components/Sidebar/sidebar-context.js +0 -45
- package/components/Sidebar/sidebar-context.js.map +0 -1
- package/components/Sidebar/sidebar-element.d.ts +0 -112
- package/components/Sidebar/sidebar-element.js +0 -280
- package/components/Sidebar/sidebar-element.js.map +0 -1
- package/components/Sidebar/sidebar-item.js +0 -6
- package/components/Sidebar/sidebar-item.js.map +0 -1
- package/components/Sidebar/sidebar-section.js +0 -6
- package/components/Sidebar/sidebar-section.js.map +0 -1
- package/components/Sidebar/sidebar.js +0 -6
- package/components/Sidebar/sidebar.js.map +0 -1
- package/react/components/Sidebar/sgds-sidebar-group.cjs.js +0 -129
- package/react/components/Sidebar/sgds-sidebar-group.cjs.js.map +0 -1
- package/react/components/Sidebar/sgds-sidebar-group.js +0 -124
- package/react/components/Sidebar/sgds-sidebar-group.js.map +0 -1
- package/react/components/Sidebar/sgds-sidebar-item.cjs.js +0 -67
- package/react/components/Sidebar/sgds-sidebar-item.cjs.js.map +0 -1
- package/react/components/Sidebar/sgds-sidebar-item.js +0 -62
- package/react/components/Sidebar/sgds-sidebar-item.js.map +0 -1
- package/react/components/Sidebar/sgds-sidebar-section.cjs.js +0 -131
- package/react/components/Sidebar/sgds-sidebar-section.cjs.js.map +0 -1
- package/react/components/Sidebar/sgds-sidebar-section.js +0 -126
- package/react/components/Sidebar/sgds-sidebar-section.js.map +0 -1
- package/react/components/Sidebar/sgds-sidebar.cjs.js +0 -430
- package/react/components/Sidebar/sgds-sidebar.cjs.js.map +0 -1
- package/react/components/Sidebar/sgds-sidebar.js +0 -425
- package/react/components/Sidebar/sgds-sidebar.js.map +0 -1
- package/react/components/Sidebar/sidebar-context.cjs.js +0 -54
- package/react/components/Sidebar/sidebar-context.cjs.js.map +0 -1
- package/react/components/Sidebar/sidebar-context.js +0 -46
- package/react/components/Sidebar/sidebar-context.js.map +0 -1
- package/react/components/Sidebar/sidebar-element.cjs.js +0 -285
- package/react/components/Sidebar/sidebar-element.cjs.js.map +0 -1
- package/react/components/Sidebar/sidebar-element.js +0 -281
- package/react/components/Sidebar/sidebar-element.js.map +0 -1
- package/react/components/Sidebar/sidebar-item.cjs.js +0 -11
- package/react/components/Sidebar/sidebar-item.cjs.js.map +0 -1
- package/react/components/Sidebar/sidebar-item.js +0 -7
- package/react/components/Sidebar/sidebar-item.js.map +0 -1
- package/react/components/Sidebar/sidebar-section.cjs.js +0 -11
- package/react/components/Sidebar/sidebar-section.cjs.js.map +0 -1
- package/react/components/Sidebar/sidebar-section.js +0 -7
- package/react/components/Sidebar/sidebar-section.js.map +0 -1
- package/react/components/Sidebar/sidebar.cjs.js +0 -11
- package/react/components/Sidebar/sidebar.cjs.js.map +0 -1
- package/react/components/Sidebar/sidebar.js +0 -7
- package/react/components/Sidebar/sidebar.js.map +0 -1
- package/react/sidebar/index.cjs.js +0 -42
- package/react/sidebar/index.cjs.js.map +0 -1
- package/react/sidebar/index.d.ts +0 -2
- package/react/sidebar/index.js +0 -18
- package/react/sidebar/index.js.map +0 -1
- package/react/sidebar-group/index.cjs.js +0 -40
- package/react/sidebar-group/index.cjs.js.map +0 -1
- package/react/sidebar-group/index.d.ts +0 -2
- package/react/sidebar-group/index.js +0 -16
- package/react/sidebar-group/index.js.map +0 -1
- package/react/sidebar-item/index.cjs.js +0 -40
- package/react/sidebar-item/index.cjs.js.map +0 -1
- package/react/sidebar-item/index.d.ts +0 -2
- package/react/sidebar-item/index.js +0 -16
- package/react/sidebar-item/index.js.map +0 -1
- package/react/sidebar-section/index.cjs.js +0 -40
- package/react/sidebar-section/index.cjs.js.map +0 -1
- package/react/sidebar-section/index.d.ts +0 -2
- package/react/sidebar-section/index.js +0 -16
- package/react/sidebar-section/index.js.map +0 -1
|
@@ -1,425 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { __decorate } from 'tslib';
|
|
3
|
-
import { html } from 'lit';
|
|
4
|
-
import { property, state, queryAssignedElements } from 'lit/decorators.js';
|
|
5
|
-
import { classMap } from 'lit/directives/class-map.js';
|
|
6
|
-
import SgdsElement from '../../base/sgds-element.js';
|
|
7
|
-
import css_248z from './sidebar.js';
|
|
8
|
-
import { provide } from '@lit/context';
|
|
9
|
-
import { SidebarActiveGroup, SidebarCollapsed, SidebarActiveItem, SidebarDrawerItems, SidebarDrawerOpen } from './sidebar-context.js';
|
|
10
|
-
import { watch } from '../../utils/watch.js';
|
|
11
|
-
import { SgdsIconButton } from '../IconButton/sgds-icon-button.js';
|
|
12
|
-
import { SM_BREAKPOINT } from '../../utils/breakpoints.js';
|
|
13
|
-
|
|
14
|
-
const SGDS_SIDEBAR_GROUP = "sgds-sidebar-group";
|
|
15
|
-
/**
|
|
16
|
-
* @summary Sidebar is a collapsible navigation component that displays menu items and groups.
|
|
17
|
-
* Users can expand and collapse the sidebar to save screen space while navigating through organized menu items.
|
|
18
|
-
* The sidebar coordinates selection and navigation across nested items using context providers and custom events.
|
|
19
|
-
*
|
|
20
|
-
* Features:
|
|
21
|
-
* - Collapsible state for space-saving layouts with icon-only mode
|
|
22
|
-
* - Multi-level nesting (up to 3 levels) with drawer overlay for root-level groups
|
|
23
|
-
* - Keyboard navigation with full ARIA support for accessibility
|
|
24
|
-
* - Programmatic link navigation support with anchor elements
|
|
25
|
-
* - Active item tracking and synchronized state management
|
|
26
|
-
*
|
|
27
|
-
* Keyboard Navigation:
|
|
28
|
-
* - Arrow Up/Down: Navigate between sidebar items and groups
|
|
29
|
-
* - Arrow Left/Right: Collapse/expand groups or navigate drawer overlays
|
|
30
|
-
* - Enter/Space: Activate focused item or toggle group
|
|
31
|
-
* - Tab: Standard focus management to interactive elements
|
|
32
|
-
*
|
|
33
|
-
* @slot default - Insert sgds-sidebar-item, sgds-sidebar-group, and sgds-sidebar-section elements
|
|
34
|
-
* @slot top - Insert brand/logo content in sidebar header
|
|
35
|
-
* @slot bottom - Insert content in sidebar footer
|
|
36
|
-
*
|
|
37
|
-
* @fires sgds-select - Emitted when a sidebar item or group is selected.
|
|
38
|
-
* Event detail: { activeItem: string } - name of the selected item
|
|
39
|
-
*
|
|
40
|
-
*/
|
|
41
|
-
class SgdsSidebar extends SgdsElement {
|
|
42
|
-
constructor() {
|
|
43
|
-
super(...arguments);
|
|
44
|
-
/**
|
|
45
|
-
* Controls whether the sidebar is collapsed or expanded.
|
|
46
|
-
* When true, the sidebar is in collapsed state showing only icons.
|
|
47
|
-
* When false, the sidebar is expanded displaying full labels and content.
|
|
48
|
-
* Affects all child items by toggling visibility of labels and adjusting spacing.
|
|
49
|
-
* @attribute collapsed
|
|
50
|
-
* @type {boolean}
|
|
51
|
-
* @default false
|
|
52
|
-
*/
|
|
53
|
-
this.collapsed = false;
|
|
54
|
-
/**
|
|
55
|
-
* The name of the currently active sidebar item or group.
|
|
56
|
-
* Reflects the selected item and allows external control of sidebar selection.
|
|
57
|
-
* Used to synchronize sidebar state with external navigation state or programmatic selection.
|
|
58
|
-
* When set, the corresponding item with matching `name` attribute will be highlighted as active.
|
|
59
|
-
* @attribute active
|
|
60
|
-
* @type {string}
|
|
61
|
-
* @default ""
|
|
62
|
-
*/
|
|
63
|
-
this.active = "";
|
|
64
|
-
/** @internal Tracks the currently active group and provides it via context to all child elements */
|
|
65
|
-
this._sidebarActiveGroup = null;
|
|
66
|
-
/** @internal Tracks the currently active item and provides it via context to all child elements */
|
|
67
|
-
this._sidebarActiveItem = null;
|
|
68
|
-
/** @internal Provides the list of items shown in the drawer overlay */
|
|
69
|
-
this._drawerItems = [];
|
|
70
|
-
/** @internal Indicates whether a drawer overlay is currently open */
|
|
71
|
-
this._showDrawer = false;
|
|
72
|
-
/** @internal */
|
|
73
|
-
this._isMobile = false;
|
|
74
|
-
/** @internal Bound resize handler for proper event listener removal */
|
|
75
|
-
this._boundHandleResize = this._handleResize.bind(this);
|
|
76
|
-
this._handleSlotChange = () => {
|
|
77
|
-
this.addItemListeners();
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
* Handles clicks outside the sidebar to close the drawer overlay.
|
|
81
|
-
* Closes the nested items drawer when user clicks outside the sidebar.
|
|
82
|
-
* Maintains drawer visibility when clicking within sidebar boundaries.
|
|
83
|
-
* @private
|
|
84
|
-
* @param {MouseEvent} e - The click event from the document
|
|
85
|
-
* @returns {void}
|
|
86
|
-
*/
|
|
87
|
-
this._handleClickOutOfElement = (e) => {
|
|
88
|
-
if (!this._sidebarActiveGroup)
|
|
89
|
-
return;
|
|
90
|
-
const overlay = e.composedPath().find(e => { var _a; return (_a = e === null || e === void 0 ? void 0 : e.classList) === null || _a === void 0 ? void 0 : _a.contains("sidebar--overlay"); });
|
|
91
|
-
if (overlay || !e.composedPath().includes(this)) {
|
|
92
|
-
this._showDrawer = false;
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
connectedCallback() {
|
|
97
|
-
super.connectedCallback();
|
|
98
|
-
this.setAttribute("role", "navigation");
|
|
99
|
-
this.setAttribute("aria-label", "Main navigation");
|
|
100
|
-
this.updateComplete.then(() => {
|
|
101
|
-
this._handleActive();
|
|
102
|
-
});
|
|
103
|
-
window === null || window === void 0 ? void 0 : window.addEventListener("resize", this._boundHandleResize);
|
|
104
|
-
this._handleResize();
|
|
105
|
-
}
|
|
106
|
-
disconnectedCallback() {
|
|
107
|
-
super.disconnectedCallback();
|
|
108
|
-
document === null || document === void 0 ? void 0 : document.removeEventListener("click", this._handleClickOutOfElement);
|
|
109
|
-
window === null || window === void 0 ? void 0 : window.removeEventListener("resize", this._boundHandleResize);
|
|
110
|
-
}
|
|
111
|
-
firstUpdated() {
|
|
112
|
-
document === null || document === void 0 ? void 0 : document.addEventListener("click", this._handleClickOutOfElement);
|
|
113
|
-
}
|
|
114
|
-
updated() {
|
|
115
|
-
this._handleActive();
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Watch handler for the collapsed property.
|
|
119
|
-
* Syncs the internal collapsed state with the property value.
|
|
120
|
-
* Triggers re-render and updates all child items' collapsed styling.
|
|
121
|
-
* @private
|
|
122
|
-
* @returns {void}
|
|
123
|
-
*/
|
|
124
|
-
_handleCollapsed() {
|
|
125
|
-
this._sidebarCollapsed = this.collapsed;
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Handles changes to the active item selection.
|
|
129
|
-
* Updates selection state and manages drawer overlay visibility based on the active item's nesting level.
|
|
130
|
-
* For root-level items with children, opens the drawer overlay.
|
|
131
|
-
* For nested items, expands parent groups and opens the appropriate drawer if needed.
|
|
132
|
-
* @private
|
|
133
|
-
* @returns {void}
|
|
134
|
-
*/
|
|
135
|
-
_handleActiveItem() {
|
|
136
|
-
if (!this._sidebarActiveItem)
|
|
137
|
-
return;
|
|
138
|
-
const childLevel = this._sidebarActiveItem._childLevel;
|
|
139
|
-
this._sidebarActiveItem._selected = true;
|
|
140
|
-
if (childLevel === 1) {
|
|
141
|
-
// First level of navigation, check if need to open drawer or not.
|
|
142
|
-
if (this._sidebarActiveItem._childElements.length > 0) {
|
|
143
|
-
this._setNodesToDrawer(this._sidebarActiveItem);
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
this._revertNodesToParent();
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
// when nested, we will find the top level of parent
|
|
151
|
-
let parentEle = this._sidebarActiveItem.parentElement;
|
|
152
|
-
while (parentEle._childLevel >= 1 && parentEle.tagName.toLowerCase() === SGDS_SIDEBAR_GROUP) {
|
|
153
|
-
if (parentEle.tagName.toLowerCase() === SGDS_SIDEBAR_GROUP) {
|
|
154
|
-
if (parentEle._childLevel === 1) {
|
|
155
|
-
// when active item not in drawer, set nodes into drawer.
|
|
156
|
-
if (!parentEle.classList.contains("sidebar-nested-overlay")) {
|
|
157
|
-
this._setNodesToDrawer(parentEle);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
parentEle._selected = true;
|
|
161
|
-
parentEle._showMenu = parentEle._childLevel > 1; // setting this to true as the child is active
|
|
162
|
-
parentEle = parentEle.parentElement;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
if (this._sidebarActiveGroup) {
|
|
166
|
-
this._sidebarActiveGroup._selected = true;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Watch handler for the active property.
|
|
172
|
-
* Finds and sets the active item by name from the sidebar hierarchy.
|
|
173
|
-
* Clears active state when active property is empty.
|
|
174
|
-
* @private
|
|
175
|
-
* @returns {void}
|
|
176
|
-
*/
|
|
177
|
-
_handleActive() {
|
|
178
|
-
// Return early if active is empty
|
|
179
|
-
if (!this.active) {
|
|
180
|
-
this._sidebarActiveItem = null;
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
this._sidebarActiveItem = this._getActiveChild();
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* Recursively searches the sidebar hierarchy for an item matching the active name.
|
|
187
|
-
* Traverses through all nested levels to find the target element.
|
|
188
|
-
* Used to support programmatic selection of deeply nested items.
|
|
189
|
-
* @private
|
|
190
|
-
* @returns {SidebarElement | null} The matching sidebar element or null if not found
|
|
191
|
-
*/
|
|
192
|
-
_getActiveChild() {
|
|
193
|
-
const findByName = (elements) => {
|
|
194
|
-
var _a;
|
|
195
|
-
for (const element of elements) {
|
|
196
|
-
if (element.name === this.active) {
|
|
197
|
-
return element;
|
|
198
|
-
}
|
|
199
|
-
if ((_a = element._childElements) === null || _a === void 0 ? void 0 : _a.length) {
|
|
200
|
-
const found = findByName(element._childElements);
|
|
201
|
-
if (found)
|
|
202
|
-
return found;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
return null;
|
|
206
|
-
};
|
|
207
|
-
return findByName(this._defaultNodes);
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Handles window resize events to manage responsive behavior.
|
|
211
|
-
* Automatically collapses sidebar on mobile devices (width <= SM_BREAKPOINT).
|
|
212
|
-
* Expands sidebar on larger screens.
|
|
213
|
-
* @private
|
|
214
|
-
* @returns {void}
|
|
215
|
-
*/ _handleResize() {
|
|
216
|
-
const isMobile = window.innerWidth <= SM_BREAKPOINT;
|
|
217
|
-
if (isMobile !== this._isMobile) {
|
|
218
|
-
this._isMobile = isMobile;
|
|
219
|
-
this.collapsed = this._isMobile;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* Manages the drawer overlay content based on the selected parent item.
|
|
224
|
-
* If element is provided: Opens drawer for that element's children.
|
|
225
|
-
* If element is undefined: Closes drawer and reverts items to their parent.
|
|
226
|
-
* @private
|
|
227
|
-
* @param {SgdsSidebarGroup} [element] - The parent item to display in drawer. Undefined closes drawer.
|
|
228
|
-
* @returns {void}
|
|
229
|
-
*/
|
|
230
|
-
_setNodesToDrawer(element) {
|
|
231
|
-
if (!element)
|
|
232
|
-
return;
|
|
233
|
-
// when there is element, we will revert the nodes of the previous active group before setting new value into the active group
|
|
234
|
-
if (this._sidebarActiveGroup && element !== this._sidebarActiveGroup) {
|
|
235
|
-
this._revertNodesToParent();
|
|
236
|
-
}
|
|
237
|
-
this._sidebarActiveGroup = element;
|
|
238
|
-
// when there is an active group set, always set new menu items
|
|
239
|
-
this._drawerItems = []; // always set to empty to prevent duplicate
|
|
240
|
-
const menuItems = this._sidebarActiveGroup.querySelectorAll(":scope > sgds-sidebar-group, :scope > sgds-sidebar-item");
|
|
241
|
-
menuItems.forEach(e => {
|
|
242
|
-
this._drawerItems.push(e);
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
* Reverts nested items back to their original parent element.
|
|
247
|
-
* Clears the drawer overlay content and updates selected attributes.
|
|
248
|
-
* Called when closing the drawer or switching to a different parent item.
|
|
249
|
-
* @private
|
|
250
|
-
* @param {SgdsSidebarItem} element - The parent item to return nodes to
|
|
251
|
-
* @returns {void}
|
|
252
|
-
*/
|
|
253
|
-
_revertNodesToParent() {
|
|
254
|
-
if (this._sidebarActiveGroup) {
|
|
255
|
-
this._drawerItems.forEach(e => {
|
|
256
|
-
this._sidebarActiveGroup.append(e);
|
|
257
|
-
});
|
|
258
|
-
this._drawerItems = [];
|
|
259
|
-
}
|
|
260
|
-
this._sidebarActiveGroup = null;
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* Attaches event listeners to all direct child sidebar items.
|
|
264
|
-
* Handles item selection events and drawer overlay state management.
|
|
265
|
-
* Manages emitting sgds-select custom events for external components.
|
|
266
|
-
* @private
|
|
267
|
-
* @returns {void}
|
|
268
|
-
*/
|
|
269
|
-
addItemListeners() {
|
|
270
|
-
const items = this.querySelectorAll("sgds-sidebar-item");
|
|
271
|
-
const groups = this.querySelectorAll(SGDS_SIDEBAR_GROUP);
|
|
272
|
-
const allItems = [...items, ...groups];
|
|
273
|
-
allItems.forEach(item => {
|
|
274
|
-
item.addEventListener("i-sgds-click", (e) => {
|
|
275
|
-
const element = e.detail.element;
|
|
276
|
-
if (element === this._sidebarActiveGroup) {
|
|
277
|
-
// just toggle drawer
|
|
278
|
-
this._showDrawer = !this._showDrawer;
|
|
279
|
-
}
|
|
280
|
-
else {
|
|
281
|
-
if (this.active !== element.name) {
|
|
282
|
-
this.active = element.name;
|
|
283
|
-
allItems.forEach(item => (item._selected = false));
|
|
284
|
-
}
|
|
285
|
-
if (element._childElements.length > 0) {
|
|
286
|
-
this._showDrawer = true;
|
|
287
|
-
}
|
|
288
|
-
else {
|
|
289
|
-
this._showDrawer = false;
|
|
290
|
-
// when there is anchorLink we will trigger click to redirect and allow user to handle the navigation themselves
|
|
291
|
-
const anchorLink = item.querySelector(":scope > a");
|
|
292
|
-
if (anchorLink)
|
|
293
|
-
anchorLink.click();
|
|
294
|
-
}
|
|
295
|
-
// Emit sgds-select event when an item is selected
|
|
296
|
-
this.emit("sgds-select", { detail: { activeItem: element.name } });
|
|
297
|
-
}
|
|
298
|
-
});
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* Toggles the sidebar between collapsed and expanded states.
|
|
303
|
-
* Updates the collapsed property to show/hide labels and adjust item spacing.
|
|
304
|
-
* Called when user clicks the collapse/expand button in the sidebar header.
|
|
305
|
-
* @private
|
|
306
|
-
* @returns {void}
|
|
307
|
-
*/
|
|
308
|
-
toggleCollapsed() {
|
|
309
|
-
this.collapsed = !this.collapsed;
|
|
310
|
-
}
|
|
311
|
-
render() {
|
|
312
|
-
var _a, _b;
|
|
313
|
-
return html `
|
|
314
|
-
<div
|
|
315
|
-
class=${classMap({
|
|
316
|
-
sidebar: true,
|
|
317
|
-
"sidebar--expanded": !this._sidebarCollapsed,
|
|
318
|
-
"sidebar--collapsed": this._sidebarCollapsed
|
|
319
|
-
})}
|
|
320
|
-
>
|
|
321
|
-
<div
|
|
322
|
-
class=${classMap({
|
|
323
|
-
"sidebar--overlay": true,
|
|
324
|
-
show: this._showDrawer
|
|
325
|
-
})}
|
|
326
|
-
></div>
|
|
327
|
-
|
|
328
|
-
<div class="sidebar-main">
|
|
329
|
-
<div class="sidebar-wrapper">
|
|
330
|
-
<div class="sidebar-top">
|
|
331
|
-
<div class="sidebar-brand-name">
|
|
332
|
-
<slot name="top"></slot>
|
|
333
|
-
</div>
|
|
334
|
-
|
|
335
|
-
<sgds-icon-button
|
|
336
|
-
name=${this._sidebarCollapsed ? "sidebar-expand" : "sidebar-collapse"}
|
|
337
|
-
variant="ghost"
|
|
338
|
-
tone="neutral"
|
|
339
|
-
size="sm"
|
|
340
|
-
@click=${this.toggleCollapsed}
|
|
341
|
-
aria-label=${this._sidebarCollapsed ? "Expand sidebar" : "Collapse sidebar"}
|
|
342
|
-
aria-expanded=${!this._sidebarCollapsed}
|
|
343
|
-
></sgds-icon-button>
|
|
344
|
-
</div>
|
|
345
|
-
|
|
346
|
-
<nav class="sidebar-content" aria-activedescendant=${((_a = this._sidebarActiveItem) === null || _a === void 0 ? void 0 : _a.name) || ""}>
|
|
347
|
-
<slot @slotchange=${this._handleSlotChange}></slot>
|
|
348
|
-
</nav>
|
|
349
|
-
|
|
350
|
-
<slot name="bottom"></slot>
|
|
351
|
-
</div>
|
|
352
|
-
</div>
|
|
353
|
-
|
|
354
|
-
<div
|
|
355
|
-
class=${classMap({
|
|
356
|
-
"sidebar-nested-overlay": true,
|
|
357
|
-
show: this._showDrawer
|
|
358
|
-
})}
|
|
359
|
-
role="dialog"
|
|
360
|
-
aria-label=${((_b = this._sidebarActiveGroup) === null || _b === void 0 ? void 0 : _b.title) ? `Nested items for ${this._sidebarActiveGroup.title}` : ""}
|
|
361
|
-
>
|
|
362
|
-
<sgds-icon-button
|
|
363
|
-
name="chevron-left"
|
|
364
|
-
variant="ghost"
|
|
365
|
-
tone="neutral"
|
|
366
|
-
size="sm"
|
|
367
|
-
@click=${() => (this._showDrawer = false)}
|
|
368
|
-
aria-label=${"Close drawer"}
|
|
369
|
-
aria-expanded=${this._showDrawer}
|
|
370
|
-
></sgds-icon-button>
|
|
371
|
-
|
|
372
|
-
${this._drawerItems}
|
|
373
|
-
</div>
|
|
374
|
-
</div>
|
|
375
|
-
`;
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
SgdsSidebar.styles = [...SgdsElement.styles, css_248z];
|
|
379
|
-
SgdsSidebar.dependencies = {
|
|
380
|
-
"sgds-icon-button": SgdsIconButton
|
|
381
|
-
};
|
|
382
|
-
__decorate([
|
|
383
|
-
property({ type: Boolean, reflect: true })
|
|
384
|
-
], SgdsSidebar.prototype, "collapsed", void 0);
|
|
385
|
-
__decorate([
|
|
386
|
-
property({ type: String, reflect: true })
|
|
387
|
-
], SgdsSidebar.prototype, "active", void 0);
|
|
388
|
-
__decorate([
|
|
389
|
-
provide({ context: SidebarActiveGroup }),
|
|
390
|
-
state()
|
|
391
|
-
], SgdsSidebar.prototype, "_sidebarActiveGroup", void 0);
|
|
392
|
-
__decorate([
|
|
393
|
-
provide({ context: SidebarCollapsed }),
|
|
394
|
-
state()
|
|
395
|
-
], SgdsSidebar.prototype, "_sidebarCollapsed", void 0);
|
|
396
|
-
__decorate([
|
|
397
|
-
provide({ context: SidebarActiveItem }),
|
|
398
|
-
state()
|
|
399
|
-
], SgdsSidebar.prototype, "_sidebarActiveItem", void 0);
|
|
400
|
-
__decorate([
|
|
401
|
-
provide({ context: SidebarDrawerItems }),
|
|
402
|
-
state()
|
|
403
|
-
], SgdsSidebar.prototype, "_drawerItems", void 0);
|
|
404
|
-
__decorate([
|
|
405
|
-
provide({ context: SidebarDrawerOpen }),
|
|
406
|
-
state()
|
|
407
|
-
], SgdsSidebar.prototype, "_showDrawer", void 0);
|
|
408
|
-
__decorate([
|
|
409
|
-
queryAssignedElements()
|
|
410
|
-
], SgdsSidebar.prototype, "_defaultNodes", void 0);
|
|
411
|
-
__decorate([
|
|
412
|
-
state()
|
|
413
|
-
], SgdsSidebar.prototype, "_isMobile", void 0);
|
|
414
|
-
__decorate([
|
|
415
|
-
watch("collapsed")
|
|
416
|
-
], SgdsSidebar.prototype, "_handleCollapsed", null);
|
|
417
|
-
__decorate([
|
|
418
|
-
watch("_sidebarActiveItem")
|
|
419
|
-
], SgdsSidebar.prototype, "_handleActiveItem", null);
|
|
420
|
-
__decorate([
|
|
421
|
-
watch("active")
|
|
422
|
-
], SgdsSidebar.prototype, "_handleActive", null);
|
|
423
|
-
|
|
424
|
-
export { SgdsSidebar, SgdsSidebar as default };
|
|
425
|
-
//# sourceMappingURL=sgds-sidebar.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sgds-sidebar.js","sources":["../../../../src/components/Sidebar/sgds-sidebar.ts"],"sourcesContent":["import { html, LitElement, PropertyValues } from \"lit\";\nimport { property, queryAssignedElements, state } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport SgdsElement from \"../../base/sgds-element\";\nimport sidebarStyle from \"./sidebar.css\";\n\nimport { provide } from \"@lit/context\";\nimport {\n SidebarCollapsed,\n SidebarActiveItem,\n SidebarActiveGroup,\n SidebarDrawerItems,\n SidebarDrawerOpen\n} from \"./sidebar-context\";\nimport { watch } from \"../../utils/watch\";\nimport { SidebarElement } from \"./sidebar-element\";\nimport SgdsSidebarGroup from \"./sgds-sidebar-group\";\nimport SgdsIconButton from \"../IconButton/sgds-icon-button\";\nimport { SM_BREAKPOINT } from \"../../utils/breakpoints\";\n\nconst SGDS_SIDEBAR_GROUP = \"sgds-sidebar-group\";\n\n/**\n * @summary Sidebar is a collapsible navigation component that displays menu items and groups.\n * Users can expand and collapse the sidebar to save screen space while navigating through organized menu items.\n * The sidebar coordinates selection and navigation across nested items using context providers and custom events.\n *\n * Features:\n * - Collapsible state for space-saving layouts with icon-only mode\n * - Multi-level nesting (up to 3 levels) with drawer overlay for root-level groups\n * - Keyboard navigation with full ARIA support for accessibility\n * - Programmatic link navigation support with anchor elements\n * - Active item tracking and synchronized state management\n *\n * Keyboard Navigation:\n * - Arrow Up/Down: Navigate between sidebar items and groups\n * - Arrow Left/Right: Collapse/expand groups or navigate drawer overlays\n * - Enter/Space: Activate focused item or toggle group\n * - Tab: Standard focus management to interactive elements\n *\n * @slot default - Insert sgds-sidebar-item, sgds-sidebar-group, and sgds-sidebar-section elements\n * @slot top - Insert brand/logo content in sidebar header\n * @slot bottom - Insert content in sidebar footer\n *\n * @fires sgds-select - Emitted when a sidebar item or group is selected.\n * Event detail: { activeItem: string } - name of the selected item\n *\n */\n\nexport class SgdsSidebar extends SgdsElement {\n static styles = [...SgdsElement.styles, sidebarStyle];\n\n static dependencies = {\n \"sgds-icon-button\": SgdsIconButton\n };\n /**\n * Controls whether the sidebar is collapsed or expanded.\n * When true, the sidebar is in collapsed state showing only icons.\n * When false, the sidebar is expanded displaying full labels and content.\n * Affects all child items by toggling visibility of labels and adjusting spacing.\n * @attribute collapsed\n * @type {boolean}\n * @default false\n */\n @property({ type: Boolean, reflect: true }) collapsed = false;\n\n /**\n * The name of the currently active sidebar item or group.\n * Reflects the selected item and allows external control of sidebar selection.\n * Used to synchronize sidebar state with external navigation state or programmatic selection.\n * When set, the corresponding item with matching `name` attribute will be highlighted as active.\n * @attribute active\n * @type {string}\n * @default \"\"\n */\n @property({ type: String, reflect: true }) active = \"\";\n\n /** @internal Tracks the currently active group and provides it via context to all child elements */\n @provide({ context: SidebarActiveGroup })\n @state()\n _sidebarActiveGroup: SgdsSidebarGroup | null = null;\n\n /** @internal Tracks the collapsed state and provides it via context to all child elements */\n @provide({ context: SidebarCollapsed })\n @state()\n private _sidebarCollapsed: boolean;\n\n /** @internal Tracks the currently active item and provides it via context to all child elements */\n @provide({ context: SidebarActiveItem })\n @state()\n private _sidebarActiveItem: SidebarElement | null = null;\n\n /** @internal Provides the list of items shown in the drawer overlay */\n @provide({ context: SidebarDrawerItems })\n @state()\n private _drawerItems = [];\n\n /** @internal Indicates whether a drawer overlay is currently open */\n @provide({ context: SidebarDrawerOpen })\n @state()\n private _showDrawer = false;\n\n /** @internal */\n @queryAssignedElements()\n private _defaultNodes!: SidebarElement[];\n\n /** @internal */\n @state()\n private _isMobile = false;\n\n /** @internal Bound resize handler for proper event listener removal */\n private _boundHandleResize = this._handleResize.bind(this);\n\n connectedCallback() {\n super.connectedCallback();\n this.setAttribute(\"role\", \"navigation\");\n this.setAttribute(\"aria-label\", \"Main navigation\");\n\n this.updateComplete.then(() => {\n this._handleActive();\n });\n\n window?.addEventListener(\"resize\", this._boundHandleResize);\n this._handleResize();\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n document?.removeEventListener(\"click\", this._handleClickOutOfElement);\n window?.removeEventListener(\"resize\", this._boundHandleResize);\n }\n\n firstUpdated() {\n document?.addEventListener(\"click\", this._handleClickOutOfElement);\n }\n\n updated() {\n this._handleActive();\n }\n\n private _handleSlotChange = () => {\n this.addItemListeners();\n };\n /**\n * Watch handler for the collapsed property.\n * Syncs the internal collapsed state with the property value.\n * Triggers re-render and updates all child items' collapsed styling.\n * @private\n * @returns {void}\n */\n @watch(\"collapsed\")\n _handleCollapsed() {\n this._sidebarCollapsed = this.collapsed;\n }\n\n /**\n * Handles changes to the active item selection.\n * Updates selection state and manages drawer overlay visibility based on the active item's nesting level.\n * For root-level items with children, opens the drawer overlay.\n * For nested items, expands parent groups and opens the appropriate drawer if needed.\n * @private\n * @returns {void}\n */\n @watch(\"_sidebarActiveItem\")\n _handleActiveItem() {\n if (!this._sidebarActiveItem) return;\n\n const childLevel = this._sidebarActiveItem._childLevel;\n this._sidebarActiveItem._selected = true;\n\n if (childLevel === 1) {\n // First level of navigation, check if need to open drawer or not.\n if (this._sidebarActiveItem._childElements.length > 0) {\n this._setNodesToDrawer(this._sidebarActiveItem as SgdsSidebarGroup);\n } else {\n this._revertNodesToParent();\n }\n } else {\n // when nested, we will find the top level of parent\n let parentEle = this._sidebarActiveItem.parentElement as SgdsSidebarGroup;\n\n while (parentEle._childLevel >= 1 && parentEle.tagName.toLowerCase() === SGDS_SIDEBAR_GROUP) {\n if (parentEle.tagName.toLowerCase() === SGDS_SIDEBAR_GROUP) {\n if (parentEle._childLevel === 1) {\n // when active item not in drawer, set nodes into drawer.\n if (!parentEle.classList.contains(\"sidebar-nested-overlay\")) {\n this._setNodesToDrawer(parentEle);\n }\n }\n\n parentEle._selected = true;\n\n parentEle._showMenu = parentEle._childLevel > 1; // setting this to true as the child is active\n parentEle = parentEle.parentElement as SgdsSidebarGroup;\n }\n }\n\n if (this._sidebarActiveGroup) {\n this._sidebarActiveGroup._selected = true;\n }\n }\n }\n\n /**\n * Watch handler for the active property.\n * Finds and sets the active item by name from the sidebar hierarchy.\n * Clears active state when active property is empty.\n * @private\n * @returns {void}\n */\n @watch(\"active\")\n _handleActive() {\n // Return early if active is empty\n if (!this.active) {\n this._sidebarActiveItem = null;\n return;\n }\n\n this._sidebarActiveItem = this._getActiveChild();\n }\n\n /**\n * Recursively searches the sidebar hierarchy for an item matching the active name.\n * Traverses through all nested levels to find the target element.\n * Used to support programmatic selection of deeply nested items.\n * @private\n * @returns {SidebarElement | null} The matching sidebar element or null if not found\n */\n private _getActiveChild() {\n const findByName = (elements: SidebarElement[]): SidebarElement | null => {\n for (const element of elements) {\n if (element.name === this.active) {\n return element;\n }\n if (element._childElements?.length) {\n const found = findByName(element._childElements);\n if (found) return found;\n }\n }\n return null;\n };\n\n return findByName(this._defaultNodes);\n }\n /**\n * Handles window resize events to manage responsive behavior.\n * Automatically collapses sidebar on mobile devices (width <= SM_BREAKPOINT).\n * Expands sidebar on larger screens.\n * @private\n * @returns {void}\n */ private _handleResize() {\n const isMobile = window.innerWidth <= SM_BREAKPOINT;\n\n if (isMobile !== this._isMobile) {\n this._isMobile = isMobile;\n this.collapsed = this._isMobile;\n }\n }\n\n /**\n * Manages the drawer overlay content based on the selected parent item.\n * If element is provided: Opens drawer for that element's children.\n * If element is undefined: Closes drawer and reverts items to their parent.\n * @private\n * @param {SgdsSidebarGroup} [element] - The parent item to display in drawer. Undefined closes drawer.\n * @returns {void}\n */\n private _setNodesToDrawer(element: SgdsSidebarGroup) {\n if (!element) return;\n\n // when there is element, we will revert the nodes of the previous active group before setting new value into the active group\n if (this._sidebarActiveGroup && element !== this._sidebarActiveGroup) {\n this._revertNodesToParent();\n }\n\n this._sidebarActiveGroup = element;\n\n // when there is an active group set, always set new menu items\n this._drawerItems = []; // always set to empty to prevent duplicate\n const menuItems = this._sidebarActiveGroup.querySelectorAll(\n \":scope > sgds-sidebar-group, :scope > sgds-sidebar-item\"\n );\n menuItems.forEach(e => {\n this._drawerItems.push(e);\n });\n }\n\n /**\n * Reverts nested items back to their original parent element.\n * Clears the drawer overlay content and updates selected attributes.\n * Called when closing the drawer or switching to a different parent item.\n * @private\n * @param {SgdsSidebarItem} element - The parent item to return nodes to\n * @returns {void}\n */\n private _revertNodesToParent() {\n if (this._sidebarActiveGroup) {\n this._drawerItems.forEach(e => {\n this._sidebarActiveGroup.append(e);\n });\n\n this._drawerItems = [];\n }\n\n this._sidebarActiveGroup = null;\n }\n\n /**\n * Attaches event listeners to all direct child sidebar items.\n * Handles item selection events and drawer overlay state management.\n * Manages emitting sgds-select custom events for external components.\n * @private\n * @returns {void}\n */\n private addItemListeners() {\n const items = this.querySelectorAll(\"sgds-sidebar-item\");\n const groups = this.querySelectorAll(SGDS_SIDEBAR_GROUP);\n const allItems = [...items, ...groups] as SidebarElement[];\n\n allItems.forEach(item => {\n item.addEventListener(\"i-sgds-click\", (e: CustomEvent) => {\n const element = e.detail.element as SidebarElement;\n\n if (element === this._sidebarActiveGroup) {\n // just toggle drawer\n this._showDrawer = !this._showDrawer;\n } else {\n if (this.active !== element.name) {\n this.active = element.name;\n allItems.forEach(item => (item._selected = false));\n }\n\n if (element._childElements.length > 0) {\n this._showDrawer = true;\n } else {\n this._showDrawer = false;\n\n // when there is anchorLink we will trigger click to redirect and allow user to handle the navigation themselves\n const anchorLink = item.querySelector(\":scope > a\") as HTMLAnchorElement;\n if (anchorLink) anchorLink.click();\n }\n\n // Emit sgds-select event when an item is selected\n this.emit(\"sgds-select\", { detail: { activeItem: element.name } });\n }\n });\n });\n }\n\n /**\n * Toggles the sidebar between collapsed and expanded states.\n * Updates the collapsed property to show/hide labels and adjust item spacing.\n * Called when user clicks the collapse/expand button in the sidebar header.\n * @private\n * @returns {void}\n */\n private toggleCollapsed() {\n this.collapsed = !this.collapsed;\n }\n\n /**\n * Handles clicks outside the sidebar to close the drawer overlay.\n * Closes the nested items drawer when user clicks outside the sidebar.\n * Maintains drawer visibility when clicking within sidebar boundaries.\n * @private\n * @param {MouseEvent} e - The click event from the document\n * @returns {void}\n */\n private _handleClickOutOfElement = (e: MouseEvent) => {\n if (!this._sidebarActiveGroup) return;\n\n const overlay = e.composedPath().find(e => (e as HTMLElement)?.classList?.contains(\"sidebar--overlay\"));\n if (overlay || !e.composedPath().includes(this)) {\n this._showDrawer = false;\n }\n };\n\n render() {\n return html`\n <div\n class=${classMap({\n sidebar: true,\n \"sidebar--expanded\": !this._sidebarCollapsed,\n \"sidebar--collapsed\": this._sidebarCollapsed\n })}\n >\n <div\n class=${classMap({\n \"sidebar--overlay\": true,\n show: this._showDrawer\n })}\n ></div>\n\n <div class=\"sidebar-main\">\n <div class=\"sidebar-wrapper\">\n <div class=\"sidebar-top\">\n <div class=\"sidebar-brand-name\">\n <slot name=\"top\"></slot>\n </div>\n\n <sgds-icon-button\n name=${this._sidebarCollapsed ? \"sidebar-expand\" : \"sidebar-collapse\"}\n variant=\"ghost\"\n tone=\"neutral\"\n size=\"sm\"\n @click=${this.toggleCollapsed}\n aria-label=${this._sidebarCollapsed ? \"Expand sidebar\" : \"Collapse sidebar\"}\n aria-expanded=${!this._sidebarCollapsed}\n ></sgds-icon-button>\n </div>\n\n <nav class=\"sidebar-content\" aria-activedescendant=${this._sidebarActiveItem?.name || \"\"}>\n <slot @slotchange=${this._handleSlotChange}></slot>\n </nav>\n\n <slot name=\"bottom\"></slot>\n </div>\n </div>\n\n <div\n class=${classMap({\n \"sidebar-nested-overlay\": true,\n show: this._showDrawer\n })}\n role=\"dialog\"\n aria-label=${this._sidebarActiveGroup?.title ? `Nested items for ${this._sidebarActiveGroup.title}` : \"\"}\n >\n <sgds-icon-button\n name=\"chevron-left\"\n variant=\"ghost\"\n tone=\"neutral\"\n size=\"sm\"\n @click=${() => (this._showDrawer = false)}\n aria-label=${\"Close drawer\"}\n aria-expanded=${this._showDrawer}\n ></sgds-icon-button>\n\n ${this._drawerItems}\n </div>\n </div>\n `;\n }\n}\n\nexport default SgdsSidebar;\n"],"names":["sidebarStyle"],"mappings":";;;;;;;;;;;;;AAoBA,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG;AAEG,MAAO,WAAY,SAAQ,WAAW,CAAA;AAA5C,IAAA,WAAA,GAAA;;AAME;;;;;;;;AAQG;QACyC,IAAS,CAAA,SAAA,GAAG,KAAK,CAAC;AAE9D;;;;;;;;AAQG;QACwC,IAAM,CAAA,MAAA,GAAG,EAAE,CAAC;;QAKvD,IAAmB,CAAA,mBAAA,GAA4B,IAAI,CAAC;;QAU5C,IAAkB,CAAA,kBAAA,GAA0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,CAAA,SAAA,EAAA,WAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AA2C1B,UAAA,CAAA;IADC,KAAK,CAAC,WAAW,CAAC;AAGlB,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,kBAAA,EAAA,IAAA,CAAA,CAAA;AAWD,UAAA,CAAA;IADC,KAAK,CAAC,oBAAoB,CAAC;AAsC3B,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,mBAAA,EAAA,IAAA,CAAA,CAAA;AAUD,UAAA,CAAA;IADC,KAAK,CAAC,QAAQ,CAAC;AASf,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,eAAA,EAAA,IAAA,CAAA;;;;"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
-
|
|
6
|
-
var context = require('@lit/context');
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Context providing the currently active sidebar group (parent with nested children).
|
|
10
|
-
* Stores the SidebarElement instance of the group whose drawer overlay is currently open.
|
|
11
|
-
* Used to manage drawer visibility and determine which nested items to display.
|
|
12
|
-
* Value is null when no group drawer is open.
|
|
13
|
-
* @type {SidebarElement | null}
|
|
14
|
-
*/
|
|
15
|
-
const SidebarActiveGroup = context.createContext("sidebar-active-group");
|
|
16
|
-
/**
|
|
17
|
-
* Context providing the currently selected/active sidebar item element.
|
|
18
|
-
* Stores the SidebarElement instance that is currently marked as active/selected.
|
|
19
|
-
* Used to highlight and visually emphasize the selected navigation item.
|
|
20
|
-
* Value is null when no item is selected.
|
|
21
|
-
* @type {SidebarElement | null}
|
|
22
|
-
*/
|
|
23
|
-
const SidebarActiveItem = context.createContext("sidebar-active");
|
|
24
|
-
/**
|
|
25
|
-
* Context indicating whether the sidebar is in collapsed (icon-only) state.
|
|
26
|
-
* When true, sidebar displays only icons and uses tooltips for labels.
|
|
27
|
-
* When false, sidebar displays full labels alongside icons.
|
|
28
|
-
* Consumed by all sidebar child elements to adjust their layout and styling accordingly.
|
|
29
|
-
* @type {boolean}
|
|
30
|
-
*/
|
|
31
|
-
const SidebarCollapsed = context.createContext("sidebar-collapsed");
|
|
32
|
-
/**
|
|
33
|
-
* Context providing the array of drawer items currently displayed in the sidebar overlay.
|
|
34
|
-
* Contains the child elements of the active group that are rendered in the drawer.
|
|
35
|
-
* Updated when group drawers open/close to show/hide nested children.
|
|
36
|
-
* Empty array when no drawer is open.
|
|
37
|
-
* @type {SidebarElement[]}
|
|
38
|
-
*/
|
|
39
|
-
const SidebarDrawerItems = context.createContext("sidebar-drawer-items");
|
|
40
|
-
/**
|
|
41
|
-
* Context indicating whether a drawer overlay is currently open for displaying nested items.
|
|
42
|
-
* When true, a group drawer is open showing child elements.
|
|
43
|
-
* When false, no drawer is currently displayed.
|
|
44
|
-
* Used to manage the visibility state of the overlay across the component hierarchy.
|
|
45
|
-
* @type {boolean}
|
|
46
|
-
*/
|
|
47
|
-
const SidebarDrawerOpen = context.createContext("sidebar-drawer-open");
|
|
48
|
-
|
|
49
|
-
exports.SidebarActiveGroup = SidebarActiveGroup;
|
|
50
|
-
exports.SidebarActiveItem = SidebarActiveItem;
|
|
51
|
-
exports.SidebarCollapsed = SidebarCollapsed;
|
|
52
|
-
exports.SidebarDrawerItems = SidebarDrawerItems;
|
|
53
|
-
exports.SidebarDrawerOpen = SidebarDrawerOpen;
|
|
54
|
-
//# sourceMappingURL=sidebar-context.cjs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar-context.cjs.js","sources":["../../../../src/components/Sidebar/sidebar-context.ts"],"sourcesContent":["import { createContext } from \"@lit/context\";\nimport { SidebarElement } from \"./sidebar-element\";\n\n/**\n * Context providing the currently active sidebar group (parent with nested children).\n * Stores the SidebarElement instance of the group whose drawer overlay is currently open.\n * Used to manage drawer visibility and determine which nested items to display.\n * Value is null when no group drawer is open.\n * @type {SidebarElement | null}\n */\nexport const SidebarActiveGroup = createContext<SidebarElement | null>(\"sidebar-active-group\");\n\n/**\n * Context providing the currently selected/active sidebar item element.\n * Stores the SidebarElement instance that is currently marked as active/selected.\n * Used to highlight and visually emphasize the selected navigation item.\n * Value is null when no item is selected.\n * @type {SidebarElement | null}\n */\nexport const SidebarActiveItem = createContext<SidebarElement | null>(\"sidebar-active\");\n\n/**\n * Context indicating whether the sidebar is in collapsed (icon-only) state.\n * When true, sidebar displays only icons and uses tooltips for labels.\n * When false, sidebar displays full labels alongside icons.\n * Consumed by all sidebar child elements to adjust their layout and styling accordingly.\n * @type {boolean}\n */\nexport const SidebarCollapsed = createContext<boolean>(\"sidebar-collapsed\");\n\n/**\n * Context providing the array of drawer items currently displayed in the sidebar overlay.\n * Contains the child elements of the active group that are rendered in the drawer.\n * Updated when group drawers open/close to show/hide nested children.\n * Empty array when no drawer is open.\n * @type {SidebarElement[]}\n */\nexport const SidebarDrawerItems = createContext<SidebarElement[]>(\"sidebar-drawer-items\");\n\n/**\n * Context indicating whether a drawer overlay is currently open for displaying nested items.\n * When true, a group drawer is open showing child elements.\n * When false, no drawer is currently displayed.\n * Used to manage the visibility state of the overlay across the component hierarchy.\n * @type {boolean}\n */\nexport const SidebarDrawerOpen = createContext<boolean>(\"sidebar-drawer-open\");\n"],"names":["createContext"],"mappings":";;;;;;;AAGA;;;;;;AAMG;MACU,kBAAkB,GAAGA,qBAAa,CAAwB,sBAAsB,EAAE;AAE/F;;;;;;AAMG;MACU,iBAAiB,GAAGA,qBAAa,CAAwB,gBAAgB,EAAE;AAExF;;;;;;AAMG;MACU,gBAAgB,GAAGA,qBAAa,CAAU,mBAAmB,EAAE;AAE5E;;;;;;AAMG;MACU,kBAAkB,GAAGA,qBAAa,CAAmB,sBAAsB,EAAE;AAE1F;;;;;;AAMG;MACU,iBAAiB,GAAGA,qBAAa,CAAU,qBAAqB;;;;;;;;"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { createContext } from '@lit/context';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Context providing the currently active sidebar group (parent with nested children).
|
|
6
|
-
* Stores the SidebarElement instance of the group whose drawer overlay is currently open.
|
|
7
|
-
* Used to manage drawer visibility and determine which nested items to display.
|
|
8
|
-
* Value is null when no group drawer is open.
|
|
9
|
-
* @type {SidebarElement | null}
|
|
10
|
-
*/
|
|
11
|
-
const SidebarActiveGroup = createContext("sidebar-active-group");
|
|
12
|
-
/**
|
|
13
|
-
* Context providing the currently selected/active sidebar item element.
|
|
14
|
-
* Stores the SidebarElement instance that is currently marked as active/selected.
|
|
15
|
-
* Used to highlight and visually emphasize the selected navigation item.
|
|
16
|
-
* Value is null when no item is selected.
|
|
17
|
-
* @type {SidebarElement | null}
|
|
18
|
-
*/
|
|
19
|
-
const SidebarActiveItem = createContext("sidebar-active");
|
|
20
|
-
/**
|
|
21
|
-
* Context indicating whether the sidebar is in collapsed (icon-only) state.
|
|
22
|
-
* When true, sidebar displays only icons and uses tooltips for labels.
|
|
23
|
-
* When false, sidebar displays full labels alongside icons.
|
|
24
|
-
* Consumed by all sidebar child elements to adjust their layout and styling accordingly.
|
|
25
|
-
* @type {boolean}
|
|
26
|
-
*/
|
|
27
|
-
const SidebarCollapsed = createContext("sidebar-collapsed");
|
|
28
|
-
/**
|
|
29
|
-
* Context providing the array of drawer items currently displayed in the sidebar overlay.
|
|
30
|
-
* Contains the child elements of the active group that are rendered in the drawer.
|
|
31
|
-
* Updated when group drawers open/close to show/hide nested children.
|
|
32
|
-
* Empty array when no drawer is open.
|
|
33
|
-
* @type {SidebarElement[]}
|
|
34
|
-
*/
|
|
35
|
-
const SidebarDrawerItems = createContext("sidebar-drawer-items");
|
|
36
|
-
/**
|
|
37
|
-
* Context indicating whether a drawer overlay is currently open for displaying nested items.
|
|
38
|
-
* When true, a group drawer is open showing child elements.
|
|
39
|
-
* When false, no drawer is currently displayed.
|
|
40
|
-
* Used to manage the visibility state of the overlay across the component hierarchy.
|
|
41
|
-
* @type {boolean}
|
|
42
|
-
*/
|
|
43
|
-
const SidebarDrawerOpen = createContext("sidebar-drawer-open");
|
|
44
|
-
|
|
45
|
-
export { SidebarActiveGroup, SidebarActiveItem, SidebarCollapsed, SidebarDrawerItems, SidebarDrawerOpen };
|
|
46
|
-
//# sourceMappingURL=sidebar-context.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar-context.js","sources":["../../../../src/components/Sidebar/sidebar-context.ts"],"sourcesContent":["import { createContext } from \"@lit/context\";\nimport { SidebarElement } from \"./sidebar-element\";\n\n/**\n * Context providing the currently active sidebar group (parent with nested children).\n * Stores the SidebarElement instance of the group whose drawer overlay is currently open.\n * Used to manage drawer visibility and determine which nested items to display.\n * Value is null when no group drawer is open.\n * @type {SidebarElement | null}\n */\nexport const SidebarActiveGroup = createContext<SidebarElement | null>(\"sidebar-active-group\");\n\n/**\n * Context providing the currently selected/active sidebar item element.\n * Stores the SidebarElement instance that is currently marked as active/selected.\n * Used to highlight and visually emphasize the selected navigation item.\n * Value is null when no item is selected.\n * @type {SidebarElement | null}\n */\nexport const SidebarActiveItem = createContext<SidebarElement | null>(\"sidebar-active\");\n\n/**\n * Context indicating whether the sidebar is in collapsed (icon-only) state.\n * When true, sidebar displays only icons and uses tooltips for labels.\n * When false, sidebar displays full labels alongside icons.\n * Consumed by all sidebar child elements to adjust their layout and styling accordingly.\n * @type {boolean}\n */\nexport const SidebarCollapsed = createContext<boolean>(\"sidebar-collapsed\");\n\n/**\n * Context providing the array of drawer items currently displayed in the sidebar overlay.\n * Contains the child elements of the active group that are rendered in the drawer.\n * Updated when group drawers open/close to show/hide nested children.\n * Empty array when no drawer is open.\n * @type {SidebarElement[]}\n */\nexport const SidebarDrawerItems = createContext<SidebarElement[]>(\"sidebar-drawer-items\");\n\n/**\n * Context indicating whether a drawer overlay is currently open for displaying nested items.\n * When true, a group drawer is open showing child elements.\n * When false, no drawer is currently displayed.\n * Used to manage the visibility state of the overlay across the component hierarchy.\n * @type {boolean}\n */\nexport const SidebarDrawerOpen = createContext<boolean>(\"sidebar-drawer-open\");\n"],"names":[],"mappings":";;;AAGA;;;;;;AAMG;MACU,kBAAkB,GAAG,aAAa,CAAwB,sBAAsB,EAAE;AAE/F;;;;;;AAMG;MACU,iBAAiB,GAAG,aAAa,CAAwB,gBAAgB,EAAE;AAExF;;;;;;AAMG;MACU,gBAAgB,GAAG,aAAa,CAAU,mBAAmB,EAAE;AAE5E;;;;;;AAMG;MACU,kBAAkB,GAAG,aAAa,CAAmB,sBAAsB,EAAE;AAE1F;;;;;;AAMG;MACU,iBAAiB,GAAG,aAAa,CAAU,qBAAqB;;;;"}
|