wj-elements 0.4.5 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/packages/wje-breadcrumbs/breadcrumbs.element.d.ts +59 -0
- package/dist/packages/wje-toolbar/toolbar.element.d.ts +96 -0
- package/dist/packages/wje-toolbar-action/toolbar-action.element.d.ts +146 -2
- package/dist/wje-breadcrumb.js +2 -2
- package/dist/wje-breadcrumb.js.map +1 -1
- package/dist/wje-breadcrumbs.js +146 -17
- package/dist/wje-breadcrumbs.js.map +1 -1
- package/dist/wje-menu-item.js +3 -1
- package/dist/wje-menu-item.js.map +1 -1
- package/dist/wje-toolbar-action.js +384 -12
- package/dist/wje-toolbar-action.js.map +1 -1
- package/dist/wje-toolbar.js +259 -1
- package/dist/wje-toolbar.js.map +1 -1
- package/package.json +1 -1
|
@@ -23,6 +23,14 @@ import { default as WJElement } from '../wje-element/element.js';
|
|
|
23
23
|
* <!-- Output: Only the first two and last two breadcrumbs will be visible, with a collapsed indicator in the middle -->
|
|
24
24
|
*/
|
|
25
25
|
export default class Breadcrumbs extends WJElement {
|
|
26
|
+
static BREAKPOINTS: {
|
|
27
|
+
sm: number;
|
|
28
|
+
md: number;
|
|
29
|
+
lg: number;
|
|
30
|
+
xl: number;
|
|
31
|
+
'2xl': number;
|
|
32
|
+
xxl: number;
|
|
33
|
+
};
|
|
26
34
|
/**
|
|
27
35
|
* Get CSS stylesheet for the Breadcrumbs element.
|
|
28
36
|
* @static
|
|
@@ -40,6 +48,7 @@ export default class Breadcrumbs extends WJElement {
|
|
|
40
48
|
* @type {boolean}
|
|
41
49
|
*/
|
|
42
50
|
last: boolean;
|
|
51
|
+
_isCollapsedByBreakpoint: boolean;
|
|
43
52
|
/**
|
|
44
53
|
* Set variant attribute for the Breadcrumbs element.
|
|
45
54
|
* @param value
|
|
@@ -50,6 +59,21 @@ export default class Breadcrumbs extends WJElement {
|
|
|
50
59
|
* @returns {string}
|
|
51
60
|
*/
|
|
52
61
|
get variant(): string;
|
|
62
|
+
/**
|
|
63
|
+
* Get the collapsed indicator variant.
|
|
64
|
+
* @returns {string}
|
|
65
|
+
*/
|
|
66
|
+
get collapsedVariant(): string;
|
|
67
|
+
/**
|
|
68
|
+
* Sets the collapse breakpoint token or value.
|
|
69
|
+
* @param {string} value Breakpoint token or CSS size.
|
|
70
|
+
*/
|
|
71
|
+
set breakpoint(value: string);
|
|
72
|
+
/**
|
|
73
|
+
* Gets the collapse breakpoint token or value.
|
|
74
|
+
* @returns {string}
|
|
75
|
+
*/
|
|
76
|
+
get breakpoint(): string;
|
|
53
77
|
/**
|
|
54
78
|
* Get items before collapse attribute.
|
|
55
79
|
* @param {string} value
|
|
@@ -85,6 +109,7 @@ export default class Breadcrumbs extends WJElement {
|
|
|
85
109
|
* @returns {object} fragment - The document fragment
|
|
86
110
|
*/
|
|
87
111
|
draw(): object;
|
|
112
|
+
defaultSlot: HTMLSlotElement;
|
|
88
113
|
/**
|
|
89
114
|
* Updates the breadcrumb elements after they are drawn on the page.
|
|
90
115
|
* It manages attributes on breadcrumb items and handles the logic for collapsing breadcrumbs
|
|
@@ -92,6 +117,40 @@ export default class Breadcrumbs extends WJElement {
|
|
|
92
117
|
* @returns {void} This method does not return a value.
|
|
93
118
|
*/
|
|
94
119
|
afterDraw(): void;
|
|
120
|
+
onSlotChange: () => void;
|
|
121
|
+
handleResize: () => void;
|
|
122
|
+
/**
|
|
123
|
+
* Reacts to viewport resize only when the breakpoint mode actually changes.
|
|
124
|
+
* @returns {void}
|
|
125
|
+
*/
|
|
126
|
+
handleBreakpointResize(): void;
|
|
127
|
+
/**
|
|
128
|
+
* Recalculates breadcrumb collapse state.
|
|
129
|
+
* @returns {void}
|
|
130
|
+
*/
|
|
131
|
+
updateCollapse(): void;
|
|
132
|
+
/**
|
|
133
|
+
* Clears attributes/classes managed by the collapse algorithm.
|
|
134
|
+
* @param {Array<Element>} breadcrumbs Breadcrumb items.
|
|
135
|
+
*/
|
|
136
|
+
resetCollapseState(breadcrumbs?: Array<Element>): void;
|
|
137
|
+
/**
|
|
138
|
+
* Applies a managed boolean attribute only when its value truly changes.
|
|
139
|
+
* @param {Element} element Breadcrumb item whose responsive state is being synchronized.
|
|
140
|
+
* @param {string} name Managed state flag that should be synchronized on the breadcrumb item.
|
|
141
|
+
* @param {boolean} isEnabled Whether the attribute should be present.
|
|
142
|
+
*/
|
|
143
|
+
syncManagedAttribute(element: Element, name: string, isEnabled: boolean): void;
|
|
144
|
+
/**
|
|
145
|
+
* Returns whether collapse rules should currently be applied.
|
|
146
|
+
* @returns {boolean}
|
|
147
|
+
*/
|
|
148
|
+
shouldApplyBreakpointCollapse(): boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Resolves the configured breakpoint to a pixel width.
|
|
151
|
+
* @returns {number|null}
|
|
152
|
+
*/
|
|
153
|
+
getBreakpointWidth(): number | null;
|
|
95
154
|
/**
|
|
96
155
|
* Retrieves all breadcrumb elements within the current instance.
|
|
97
156
|
* @returns {Array<Element>} An array of breadcrumb elements (`wje-breadcrumb`) found within the instance. Returns an empty array if no breadcrumbs are found.
|
|
@@ -31,13 +31,109 @@ export default class Toolbar extends WJElement {
|
|
|
31
31
|
* @returns {Array} An empty array
|
|
32
32
|
*/
|
|
33
33
|
static get observedAttributes(): any[];
|
|
34
|
+
_breadcrumbState: WeakMap<WeakKey, any>;
|
|
35
|
+
_responsiveFrame: any;
|
|
34
36
|
/**
|
|
35
37
|
* Draws the component for the toolbar.
|
|
36
38
|
* @returns {object} Document fragment
|
|
37
39
|
*/
|
|
38
40
|
draw(): object;
|
|
41
|
+
native: HTMLDivElement;
|
|
42
|
+
startSlot: HTMLSlotElement;
|
|
43
|
+
endSlot: HTMLSlotElement;
|
|
44
|
+
/**
|
|
45
|
+
* Initializes responsive layout observers.
|
|
46
|
+
*/
|
|
47
|
+
afterDraw(): void;
|
|
48
|
+
onSlotChange: () => void;
|
|
49
|
+
_resizeObserver: ResizeObserver;
|
|
39
50
|
/**
|
|
40
51
|
* Sync ARIA attributes on host.
|
|
41
52
|
*/
|
|
42
53
|
syncAria(): void;
|
|
54
|
+
/**
|
|
55
|
+
* Schedules responsive layout recalculation.
|
|
56
|
+
*/
|
|
57
|
+
scheduleResponsiveLayout(): void;
|
|
58
|
+
/**
|
|
59
|
+
* Updates slotted breadcrumbs and actions to fit the toolbar width.
|
|
60
|
+
* @returns {Promise<void>}
|
|
61
|
+
*/
|
|
62
|
+
updateResponsiveLayout(): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Measures breadcrumbs in their full state.
|
|
65
|
+
* @param {HTMLElement} breadcrumbs Breadcrumbs component.
|
|
66
|
+
* @returns {Promise<{count: number, fullWidth: number, compactWidth: number}>}
|
|
67
|
+
*/
|
|
68
|
+
measureBreadcrumbs(breadcrumbs: HTMLElement): Promise<{
|
|
69
|
+
count: number;
|
|
70
|
+
fullWidth: number;
|
|
71
|
+
compactWidth: number;
|
|
72
|
+
}>;
|
|
73
|
+
/**
|
|
74
|
+
* Stores original breadcrumb settings used as responsive compact target.
|
|
75
|
+
* @param {HTMLElement} breadcrumbs Breadcrumbs component.
|
|
76
|
+
* @param {number} count Number of breadcrumb elements currently in the trail.
|
|
77
|
+
* @returns {{compactMaxItems: number}}
|
|
78
|
+
*/
|
|
79
|
+
ensureBreadcrumbState(breadcrumbs: HTMLElement, count: number): {
|
|
80
|
+
compactMaxItems: number;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Applies the compact or full breadcrumb state.
|
|
84
|
+
* @param {HTMLElement|null} breadcrumbs Breadcrumbs component.
|
|
85
|
+
* @param {boolean} compact Whether compact mode should be used.
|
|
86
|
+
*/
|
|
87
|
+
setBreadcrumbCompactState(breadcrumbs: HTMLElement | null, compact: boolean): void;
|
|
88
|
+
/**
|
|
89
|
+
* Sets breadcrumb max-items only when it changed.
|
|
90
|
+
* @param {HTMLElement} breadcrumbs Breadcrumbs component.
|
|
91
|
+
* @param {number} value The max item count.
|
|
92
|
+
*/
|
|
93
|
+
setBreadcrumbMaxItems(breadcrumbs: HTMLElement, value: number): void;
|
|
94
|
+
/**
|
|
95
|
+
* Finds how many actions fit into the available width.
|
|
96
|
+
* @param {object} actionMetrics Measured action metrics.
|
|
97
|
+
* @param {number} width Available width.
|
|
98
|
+
* @returns {number}
|
|
99
|
+
*/
|
|
100
|
+
getVisibleActionsForWidth(actionMetrics: object, width: number): number;
|
|
101
|
+
/**
|
|
102
|
+
* Applies visible action count.
|
|
103
|
+
* @param {HTMLElement|null} action Toolbar action component.
|
|
104
|
+
* @param {number} count Visible action count.
|
|
105
|
+
*/
|
|
106
|
+
setVisibleActions(action: HTMLElement | null, count: number): void;
|
|
107
|
+
/**
|
|
108
|
+
* Clears toolbar-managed visible action state when actions manage themselves.
|
|
109
|
+
* @param {HTMLElement|null} action Toolbar action component.
|
|
110
|
+
*/
|
|
111
|
+
clearVisibleActions(action: HTMLElement | null): void;
|
|
112
|
+
/**
|
|
113
|
+
* Returns the slotted toolbar action.
|
|
114
|
+
* @returns {HTMLElement|null}
|
|
115
|
+
*/
|
|
116
|
+
getToolbarAction(): HTMLElement | null;
|
|
117
|
+
/**
|
|
118
|
+
* Returns the slotted breadcrumbs.
|
|
119
|
+
* @returns {HTMLElement|null}
|
|
120
|
+
*/
|
|
121
|
+
getBreadcrumbs(): HTMLElement | null;
|
|
122
|
+
/**
|
|
123
|
+
* Returns whether toolbar actions are managed by their own breakpoint logic.
|
|
124
|
+
* @param {HTMLElement|null} action Toolbar action component.
|
|
125
|
+
* @returns {boolean}
|
|
126
|
+
*/
|
|
127
|
+
isSelfManagedAction(action: HTMLElement | null): boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Returns whether breadcrumb collapse is managed by its own breakpoint logic.
|
|
130
|
+
* @param {HTMLElement|null} breadcrumbs Breadcrumbs component.
|
|
131
|
+
* @returns {boolean}
|
|
132
|
+
*/
|
|
133
|
+
isSelfManagedBreadcrumbs(breadcrumbs: HTMLElement | null, action: any): boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Waits for one animation frame.
|
|
136
|
+
* @returns {Promise<void>}
|
|
137
|
+
*/
|
|
138
|
+
nextFrame(): Promise<void>;
|
|
43
139
|
}
|
|
@@ -10,6 +10,14 @@ import { default as WJElement } from '../wje-element/element.js';
|
|
|
10
10
|
* @tag wje-toolbar-action
|
|
11
11
|
*/
|
|
12
12
|
export default class ToolbarAction extends WJElement {
|
|
13
|
+
static BREAKPOINTS: {
|
|
14
|
+
sm: number;
|
|
15
|
+
md: number;
|
|
16
|
+
lg: number;
|
|
17
|
+
xl: number;
|
|
18
|
+
'2xl': number;
|
|
19
|
+
xxl: number;
|
|
20
|
+
};
|
|
13
21
|
/**
|
|
14
22
|
* Returns the CSS stylesheet for the component.
|
|
15
23
|
* @static
|
|
@@ -22,14 +30,150 @@ export default class ToolbarAction extends WJElement {
|
|
|
22
30
|
* @returns {Array} An empty array
|
|
23
31
|
*/
|
|
24
32
|
static get observedAttributes(): any[];
|
|
33
|
+
_managedHiddenActions: WeakSet<WeakKey>;
|
|
34
|
+
_isCollapsedByBreakpoint: any;
|
|
35
|
+
_managedOverflowNodes: WeakSet<WeakKey>;
|
|
36
|
+
_overflowRetryFrame: any;
|
|
37
|
+
/**
|
|
38
|
+
* Sets the collapse breakpoint token or value.
|
|
39
|
+
* @param {string} value Breakpoint token or CSS size.
|
|
40
|
+
*/
|
|
41
|
+
set breakpoint(value: string);
|
|
42
|
+
/**
|
|
43
|
+
* Gets the collapse breakpoint token or value.
|
|
44
|
+
* @returns {string}
|
|
45
|
+
*/
|
|
46
|
+
get breakpoint(): string;
|
|
47
|
+
/**
|
|
48
|
+
* Sets the maximum number of visible actions.
|
|
49
|
+
* @param {number|string} value The maximum number of visible actions.
|
|
50
|
+
*/
|
|
51
|
+
set maxItems(value: number | string);
|
|
52
|
+
/**
|
|
53
|
+
* Gets the maximum number of visible actions.
|
|
54
|
+
* @returns {number}
|
|
55
|
+
*/
|
|
56
|
+
get maxItems(): number;
|
|
57
|
+
/**
|
|
58
|
+
* Sets the responsive visible action count.
|
|
59
|
+
* @param {number|string} value The visible action count.
|
|
60
|
+
*/
|
|
61
|
+
set visibleItems(value: number | string);
|
|
62
|
+
/**
|
|
63
|
+
* Gets the responsive visible action count.
|
|
64
|
+
* @returns {number|null}
|
|
65
|
+
*/
|
|
66
|
+
get visibleItems(): number | null;
|
|
25
67
|
/**
|
|
26
68
|
* Draws the component for the toolbar action.
|
|
27
69
|
* @returns {object} Document fragment
|
|
28
70
|
*/
|
|
29
71
|
draw(): object;
|
|
72
|
+
defaultSlot: HTMLSlotElement;
|
|
73
|
+
native: HTMLDivElement;
|
|
74
|
+
moreDropdown: HTMLElement;
|
|
75
|
+
moreMenu: HTMLElement;
|
|
76
|
+
/**
|
|
77
|
+
* Applies the current visible action limit after the component is drawn.
|
|
78
|
+
*/
|
|
79
|
+
afterDraw(): void;
|
|
80
|
+
onSlotChange: () => void;
|
|
81
|
+
handleResize: () => void;
|
|
30
82
|
/**
|
|
31
83
|
* Returns the actions for the toolbar action.
|
|
32
|
-
* @returns {Array}
|
|
84
|
+
* @returns {Array<HTMLElement>} Managed toolbar actions.
|
|
85
|
+
*/
|
|
86
|
+
getActions(): Array<HTMLElement>;
|
|
87
|
+
/**
|
|
88
|
+
* Returns direct children assigned to the default slot.
|
|
89
|
+
* @returns {Array<HTMLElement>}
|
|
90
|
+
*/
|
|
91
|
+
getAssignedElements(): Array<HTMLElement>;
|
|
92
|
+
/**
|
|
93
|
+
* Returns an existing top-level dropdown if present.
|
|
94
|
+
* @returns {HTMLElement|null}
|
|
95
|
+
*/
|
|
96
|
+
getExistingDropdown(): HTMLElement | null;
|
|
97
|
+
/**
|
|
98
|
+
* Returns the dropdown that should receive overflow items.
|
|
99
|
+
* @returns {HTMLElement}
|
|
100
|
+
*/
|
|
101
|
+
getOverflowDropdown(): HTMLElement;
|
|
102
|
+
/**
|
|
103
|
+
* Returns the menu used for overflow items.
|
|
104
|
+
* @returns {HTMLElement|null}
|
|
105
|
+
*/
|
|
106
|
+
getOverflowMenu(): HTMLElement | null;
|
|
107
|
+
/**
|
|
108
|
+
* Gets the number of actions that should stay visible.
|
|
109
|
+
* @returns {number}
|
|
110
|
+
*/
|
|
111
|
+
getVisibleLimit(): number;
|
|
112
|
+
/**
|
|
113
|
+
* Returns whether the toolbar action should collapse based on the configured breakpoint.
|
|
114
|
+
* @returns {boolean}
|
|
115
|
+
*/
|
|
116
|
+
shouldCollapseByBreakpoint(): boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Returns the cached breakpoint collapse state.
|
|
119
|
+
* @returns {boolean}
|
|
120
|
+
*/
|
|
121
|
+
isCollapsedByBreakpoint(): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Reacts to viewport resize only when the breakpoint mode actually changes.
|
|
124
|
+
* @returns {void}
|
|
125
|
+
*/
|
|
126
|
+
handleBreakpointResize(): void;
|
|
127
|
+
/**
|
|
128
|
+
* Resolves the configured breakpoint to a pixel width.
|
|
129
|
+
* @returns {number|null}
|
|
130
|
+
*/
|
|
131
|
+
getBreakpointWidth(): number | null;
|
|
132
|
+
/**
|
|
133
|
+
* Updates visible actions and the overflow dropdown.
|
|
134
|
+
* @returns {void}
|
|
135
|
+
*/
|
|
136
|
+
applyOverflow(): void;
|
|
137
|
+
/**
|
|
138
|
+
* Restores buttons hidden by this component.
|
|
139
|
+
* @param {Array<HTMLElement>} actions Toolbar buttons.
|
|
140
|
+
*/
|
|
141
|
+
restoreManagedActions(actions?: Array<HTMLElement>): void;
|
|
142
|
+
/**
|
|
143
|
+
* Removes overflow menu nodes that were previously injected by this component.
|
|
144
|
+
*/
|
|
145
|
+
restoreManagedOverflowContent(): void;
|
|
146
|
+
/**
|
|
147
|
+
* Creates a dropdown menu proxy for an overflowed button.
|
|
148
|
+
* @param {HTMLElement} action The original action button.
|
|
149
|
+
* @returns {HTMLElement}
|
|
150
|
+
*/
|
|
151
|
+
createMenuItem(action: HTMLElement): HTMLElement;
|
|
152
|
+
/**
|
|
153
|
+
* Creates a divider separating existing dropdown actions from responsive overflow actions.
|
|
154
|
+
* @returns {HTMLElement}
|
|
155
|
+
*/
|
|
156
|
+
createOverflowDivider(): HTMLElement;
|
|
157
|
+
/**
|
|
158
|
+
* Forwards menu item activation to the original button.
|
|
159
|
+
* @param {Event} e The menu event.
|
|
160
|
+
* @param {HTMLElement} action The original action button.
|
|
161
|
+
*/
|
|
162
|
+
handleMenuItemClick(e: Event, action: HTMLElement): void;
|
|
163
|
+
/**
|
|
164
|
+
* Measures action widths while preserving current overflow state.
|
|
165
|
+
* @returns {{count: number, widths: number[], gap: number, moreWidth: number, getWidthForCount: Function}}
|
|
166
|
+
*/
|
|
167
|
+
measureActionMetrics(): {
|
|
168
|
+
count: number;
|
|
169
|
+
widths: number[];
|
|
170
|
+
gap: number;
|
|
171
|
+
moreWidth: number;
|
|
172
|
+
getWidthForCount: Function;
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Measures the overflow dropdown trigger.
|
|
176
|
+
* @returns {number}
|
|
33
177
|
*/
|
|
34
|
-
|
|
178
|
+
measureMoreWidth(): number;
|
|
35
179
|
}
|
package/dist/wje-breadcrumb.js
CHANGED
|
@@ -45,8 +45,8 @@ class Breadcrumb extends WJElement {
|
|
|
45
45
|
* @returns {string} The collapsed variant value in uppercase.
|
|
46
46
|
*/
|
|
47
47
|
get collapsedVariant() {
|
|
48
|
-
var _a;
|
|
49
|
-
let variant = ((_a = this.parentElement) == null ? void 0 : _a.variant) || this._collapsedVariant;
|
|
48
|
+
var _a, _b;
|
|
49
|
+
let variant = ((_a = this.parentElement) == null ? void 0 : _a.collapsedVariant) || ((_b = this.parentElement) == null ? void 0 : _b.variant) || this._collapsedVariant || "button";
|
|
50
50
|
return variant.toUpperCase();
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wje-breadcrumb.js","sources":["../packages/wje-breadcrumb/breadcrumb.element.js","../packages/wje-breadcrumb/breadcrumb.js"],"sourcesContent":["import { default as WJElement, event, WjElementUtils } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * @summary This class represents a Breadcrumb element, extending the WJElement class. It provides a navigational aid in user interfaces, displaying the current location within a hierarchy.\n * @documentation https://elements.webjet.sk/components/breadcrumb\n * @status stable\n * @augments WJElement\n * @slot - The main content of the breadcrumb.\n * @slot start - Slot for content at the start of the breadcrumb.\n * @slot end - Slot for content at the end of the breadcrumb.\n * @slot separator - Slot for a custom separator between breadcrumb items.\n * @csspart native - The native wrapper of the breadcrumb component.\n * @csspart separator - The separator between breadcrumb items.\n * @cssproperty [--wje-breadcrumb-a=var(--wje-color-contrast-8)] - The color of the breadcrumb text.\n * @cssproperty [--wje-breadcrumb-a-hover=var(--wje-color-contrast-6)] - The color of the breadcrumb separator line.\n * @tag wje-breadcrumb\n */\nexport default class Breadcrumb extends WJElement {\n /**\n * Breadcrumb constructor method.\n */\n constructor() {\n super();\n\n this._showSeparator = true;\n this._showCollapsedIndicator = false;\n }\n\n /**\n * Get show separator flag.\n * @returns {boolean} showSeparator - The show separator flag\n */\n get showSeparator() {\n return this._showSeparator;\n }\n\n /**\n * Set show separator flag.\n * @param {boolean} value The value to set\n */\n set showSeparator(value) {\n this._showSeparator = value;\n }\n\n /**\n * Set collapsed variant.\n * @param {string} value The value to set\n */\n set collapsedVariant(value) {\n this._collapsedVariant = value;\n }\n\n /**\n * Get collapsed variant.\n * @returns {string} The collapsed variant value in uppercase.\n */\n get collapsedVariant() {\n let variant = this.parentElement?.variant || this._collapsedVariant;\n return variant.toUpperCase();\n }\n\n /**\n * Class name for the Breadcrumb element.\n * @type {string}\n */\n className = 'Breadcrumb';\n\n /**\n * Get CSS stylesheet for the Breadcrumb element.\n * @static\n * @returns {object} styles - The CSS styles\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Get observed attributes for the Breadcrumb element.\n * @static\n * @returns {Array<string>} - The observed attributes array for the Breadcrumb element.\n */\n static get observedAttributes() {\n return ['show-collapsed-indicator', 'collapsed', 'last'];\n }\n\n /**\n * Handles attribute changes for the custom element and updates its behavior or appearance accordingly.\n * @param {string} name The name of the attribute that was changed.\n * @param {string|null} oldValue The previous value of the attribute before it was changed. Null if the attribute was not previously set.\n * @param {string|null} newValue The new value of the attribute after it was changed. Null if the attribute was removed.\n */\n attributeChangedCallback(name, oldValue, newValue) {\n super.attributeChangedCallback?.(name, oldValue, newValue);\n\n if (name === 'collapsed') {\n const isCollapsed = WjElementUtils.stringToBoolean(newValue);\n\n // toggle class podľa stavu\n this.classList.toggle('collapsed', isCollapsed && !this.hasAttribute('show-collapsed-indicator'));\n\n } else if (name === 'show-collapsed-indicator') {\n const isOn = WjElementUtils.stringToBoolean(newValue);\n this._showCollapsedIndicator = isOn;\n this.refresh();\n\n } else if (name === 'last') {\n const isLast = WjElementUtils.stringToBoolean(newValue);\n this.active = isLast;\n this.showSeparator = !isLast;\n this.syncAria();\n if (this.native) {\n if (isLast) this.native.setAttribute('aria-current', 'page');\n else this.native.removeAttribute('aria-current');\n }\n this.refresh();\n }\n }\n\n /**\n * Setup attributes for the Breadcrumb element.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n this.syncAria();\n }\n\n syncAria() {\n this.setAriaState({ role: 'link' });\n if (this.active) this.setAriaState({ current: 'page' });\n else this.removeAttribute('aria-current');\n }\n\n /**\n * Draw method for the Breadcrumb element.\n * @returns {object} fragment - The document fragment\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let native = document.createElement('a');\n native.classList.add('native-breadcrumb');\n native.setAttribute('part', 'native');\n if (this.active) native.setAttribute('aria-current', 'page');\n\n if (this.active) native.classList.add('active');\n\n let slot = document.createElement('slot');\n\n let start = document.createElement('slot');\n start.setAttribute('name', 'start');\n\n let end = document.createElement('slot');\n end.setAttribute('name', 'end');\n\n native.append(start, slot, end);\n\n // APPEND\n fragment.append(native);\n\n if (WjElementUtils.stringToBoolean(this._showCollapsedIndicator)) {\n // pridame button za native element\n fragment.append(this.drawCollapsedIndicator());\n\n // skryjeme native element\n native.classList.add('hidden');\n }\n\n if (this.showSeparator) {\n let separator = document.createElement('span');\n separator.classList.add('separator');\n separator.setAttribute('part', 'separator');\n\n if (WjElementUtils.hasSlot(this, 'separator')) {\n let slotSeparator = document.createElement('slot');\n slotSeparator.setAttribute('name', 'separator');\n\n separator.append(slotSeparator);\n } else {\n separator.innerHTML = `<wje-icon name=${this.separator || 'chevron-right'}></wje-icon>`;\n }\n\n fragment.append(separator);\n }\n\n this.native = native;\n\n return fragment;\n }\n\n /**\n * Renders the collapsed indicator based on the current collapsed variant.\n * If the collapsed variant is 'DROPDOWN', it invokes the collapseDropdown method.\n * Otherwise, it invokes the collapseButton method.\n * @returns {any} The rendered collapsed indicator, either as a dropdown or a button.\n */\n drawCollapsedIndicator() {\n let collapsedIndicator = null;\n\n if (this.collapsedVariant === 'DROPDOWN') {\n collapsedIndicator = this.collapseDropdown();\n } else {\n collapsedIndicator = this.collapseButton();\n }\n\n return collapsedIndicator;\n }\n\n /**\n * Creates and returns a dropdown UI component for collapsed breadcrumbs.\n * This method generates a dropdown element with a button trigger and a menu populated with items corresponding\n * to the collapsed breadcrumbs. The dropdown is configured to handle specific interactions and ensure that\n * events are appropriately managed to avoid propagation issues. Menu items are linked to their corresponding\n * breadcrumbs, enabling the same functionality as clicking on the original breadcrumb.\n * @returns {HTMLElement} A configured dropdown element containing a button as trigger and a menu with breadcrumb items.\n */\n collapseDropdown() {\n let dropdown = document.createElement('wje-dropdown');\n dropdown.setAttribute('placement', 'bottom');\n dropdown.setAttribute('offset', '10');\n\n let button = document.createElement('wje-button');\n button.setAttribute('slot', 'trigger');\n button.setAttribute('fill', 'link');\n button.innerHTML = `<wje-icon name=\"dots\"></wje-icon>`;\n\n let menu = document.createElement('wje-menu');\n menu.setAttribute('variant', 'context');\n\n menu.addEventListener('click', (e) => {\n e.stopPropagation();\n e.stopImmediatePropagation?.();\n });\n\n this.getBreadcrumbs().getBreadcrumbsCollapsed().forEach((b) => {\n let menuItem = document.createElement('wje-menu-item');\n menuItem.innerHTML = b.innerHTML;\n\n menuItem.__breadcrumb = b;\n\n menuItem.addEventListener('wje-menu-item:click', (e) => {\n e.preventDefault?.();\n e.stopPropagation();\n e.stopImmediatePropagation?.();\n\n const breadcrumb = e.currentTarget.__breadcrumb;\n if (!breadcrumb) return;\n\n // Prefer clicking the internal anchor (same behavior as real user click), fallback to host click.\n const native = breadcrumb.native || breadcrumb.context?.querySelector('a.native-breadcrumb');\n if (native && typeof native.click === 'function') {\n native.click();\n } else if (typeof breadcrumb.click === 'function') {\n breadcrumb.click();\n } else {\n breadcrumb.dispatchEvent(\n new MouseEvent('click', {\n bubbles: true,\n composed: true,\n cancelable: true\n })\n );\n }\n });\n\n menu.append(menuItem);\n });\n\n dropdown.append(button, menu);\n\n return dropdown;\n }\n\n /**\n * Creates a button element that expands hidden breadcrumbs when clicked.\n * The button is set with appropriate attributes and event listeners to handle\n * the expanding of hidden breadcrumb elements. Clicking the button will remove\n * the button itself, reveal hidden breadcrumbs, and stop the current event\n * propagation.\n * @returns {HTMLButtonElement} The created button configured to expand breadcrumbs.\n */\n collapseButton() {\n let button = document.createElement('button');\n button.setAttribute('aria-label', 'Show more breadcrumbs');\n button.setAttribute('part', 'collapsed-indicator');\n button.innerHTML = `<wje-icon name=\"dots\"></wje-icon>`;\n\n event.addListener(button, 'click', null, (e) => {\n this.native.classList.remove('hidden');\n button.remove();\n this.getBreadcrumbs().getBreadcrumbsCollapsed().forEach((el) => {\n el.classList.remove('collapsed');\n });\n e.stopPropagation();\n });\n\n return button;\n }\n\n /**\n * Retrieves the breadcrumb trail for the current element by returning its parent element.\n * @returns {Element} The parent element representing the breadcrumb trail.\n */\n getBreadcrumbs() {\n return this.parentElement;\n }\n}\n","import Breadcrumb from './breadcrumb.element.js';\n\n// export * from \"./breadcrumb.element.js\";\nexport default Breadcrumb;\n\nBreadcrumb.define('wje-breadcrumb',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,EAAE,cAAc;AACnC,YAAI,CAAC,WAAY;AAGjB,cAAM,SAAS,WAAW,YAAU,gBAAW,YAAX,mBAAoB,cAAc;AACtE,YAAI,UAAU,OAAO,OAAO,UAAU,YAAY;AAC9C,iBAAO,MAAK;AAAA,QAChB,WAAW,OAAO,WAAW,UAAU,YAAY;AAC/C,qBAAW,MAAK;AAAA,QACpB,OAAO;AACH,qBAAW;AAAA,YACP,IAAI,WAAW,SAAS;AAAA,cACpB,SAAS;AAAA,cACT,UAAU;AAAA,cACV,YAAY;AAAA,YACxC,CAAyB;AAAA,UACzB;AAAA,QACgB;AAAA,MACJ,CAAC;AAED,WAAK,OAAO,QAAQ;AAAA,IACxB,CAAC;AAED,aAAS,OAAO,QAAQ,IAAI;AAE5B,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,iBAAiB;AACb,QAAI,SAAS,SAAS,cAAc,QAAQ;AAC5C,WAAO,aAAa,cAAc,uBAAuB;AACzD,WAAO,aAAa,QAAQ,qBAAqB;AACjD,WAAO,YAAY;AAEnB,UAAM,YAAY,QAAQ,SAAS,MAAM,CAAC,MAAM;AAC5C,WAAK,OAAO,UAAU,OAAO,QAAQ;AACrC,aAAO,OAAM;AACb,WAAK,eAAc,EAAG,wBAAuB,EAAG,QAAQ,CAAC,OAAO;AAC5D,WAAG,UAAU,OAAO,WAAW;AAAA,MACnC,CAAC;AACD,QAAE,gBAAe;AAAA,IACrB,CAAC;AAED,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,iBAAiB;AACb,WAAO,KAAK;AAAA,EAChB;AACJ;AC7SA,WAAW,OAAO,kBAAkB,UAAU;"}
|
|
1
|
+
{"version":3,"file":"wje-breadcrumb.js","sources":["../packages/wje-breadcrumb/breadcrumb.element.js","../packages/wje-breadcrumb/breadcrumb.js"],"sourcesContent":["import { default as WJElement, event, WjElementUtils } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * @summary This class represents a Breadcrumb element, extending the WJElement class. It provides a navigational aid in user interfaces, displaying the current location within a hierarchy.\n * @documentation https://elements.webjet.sk/components/breadcrumb\n * @status stable\n * @augments WJElement\n * @slot - The main content of the breadcrumb.\n * @slot start - Slot for content at the start of the breadcrumb.\n * @slot end - Slot for content at the end of the breadcrumb.\n * @slot separator - Slot for a custom separator between breadcrumb items.\n * @csspart native - The native wrapper of the breadcrumb component.\n * @csspart separator - The separator between breadcrumb items.\n * @cssproperty [--wje-breadcrumb-a=var(--wje-color-contrast-8)] - The color of the breadcrumb text.\n * @cssproperty [--wje-breadcrumb-a-hover=var(--wje-color-contrast-6)] - The color of the breadcrumb separator line.\n * @tag wje-breadcrumb\n */\nexport default class Breadcrumb extends WJElement {\n /**\n * Breadcrumb constructor method.\n */\n constructor() {\n super();\n\n this._showSeparator = true;\n this._showCollapsedIndicator = false;\n }\n\n /**\n * Get show separator flag.\n * @returns {boolean} showSeparator - The show separator flag\n */\n get showSeparator() {\n return this._showSeparator;\n }\n\n /**\n * Set show separator flag.\n * @param {boolean} value The value to set\n */\n set showSeparator(value) {\n this._showSeparator = value;\n }\n\n /**\n * Set collapsed variant.\n * @param {string} value The value to set\n */\n set collapsedVariant(value) {\n this._collapsedVariant = value;\n }\n\n /**\n * Get collapsed variant.\n * @returns {string} The collapsed variant value in uppercase.\n */\n get collapsedVariant() {\n let variant = this.parentElement?.collapsedVariant || this.parentElement?.variant || this._collapsedVariant || 'button';\n return variant.toUpperCase();\n }\n\n /**\n * Class name for the Breadcrumb element.\n * @type {string}\n */\n className = 'Breadcrumb';\n\n /**\n * Get CSS stylesheet for the Breadcrumb element.\n * @static\n * @returns {object} styles - The CSS styles\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Get observed attributes for the Breadcrumb element.\n * @static\n * @returns {Array<string>} - The observed attributes array for the Breadcrumb element.\n */\n static get observedAttributes() {\n return ['show-collapsed-indicator', 'collapsed', 'last'];\n }\n\n /**\n * Handles attribute changes for the custom element and updates its behavior or appearance accordingly.\n * @param {string} name The name of the attribute that was changed.\n * @param {string|null} oldValue The previous value of the attribute before it was changed. Null if the attribute was not previously set.\n * @param {string|null} newValue The new value of the attribute after it was changed. Null if the attribute was removed.\n */\n attributeChangedCallback(name, oldValue, newValue) {\n super.attributeChangedCallback?.(name, oldValue, newValue);\n\n if (name === 'collapsed') {\n const isCollapsed = WjElementUtils.stringToBoolean(newValue);\n\n // toggle class podľa stavu\n this.classList.toggle('collapsed', isCollapsed && !this.hasAttribute('show-collapsed-indicator'));\n\n } else if (name === 'show-collapsed-indicator') {\n const isOn = WjElementUtils.stringToBoolean(newValue);\n this._showCollapsedIndicator = isOn;\n this.refresh();\n\n } else if (name === 'last') {\n const isLast = WjElementUtils.stringToBoolean(newValue);\n this.active = isLast;\n this.showSeparator = !isLast;\n this.syncAria();\n if (this.native) {\n if (isLast) this.native.setAttribute('aria-current', 'page');\n else this.native.removeAttribute('aria-current');\n }\n this.refresh();\n }\n }\n\n /**\n * Setup attributes for the Breadcrumb element.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n this.syncAria();\n }\n\n syncAria() {\n this.setAriaState({ role: 'link' });\n if (this.active) this.setAriaState({ current: 'page' });\n else this.removeAttribute('aria-current');\n }\n\n /**\n * Draw method for the Breadcrumb element.\n * @returns {object} fragment - The document fragment\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let native = document.createElement('a');\n native.classList.add('native-breadcrumb');\n native.setAttribute('part', 'native');\n if (this.active) native.setAttribute('aria-current', 'page');\n\n if (this.active) native.classList.add('active');\n\n let slot = document.createElement('slot');\n\n let start = document.createElement('slot');\n start.setAttribute('name', 'start');\n\n let end = document.createElement('slot');\n end.setAttribute('name', 'end');\n\n native.append(start, slot, end);\n\n // APPEND\n fragment.append(native);\n\n if (WjElementUtils.stringToBoolean(this._showCollapsedIndicator)) {\n // pridame button za native element\n fragment.append(this.drawCollapsedIndicator());\n\n // skryjeme native element\n native.classList.add('hidden');\n }\n\n if (this.showSeparator) {\n let separator = document.createElement('span');\n separator.classList.add('separator');\n separator.setAttribute('part', 'separator');\n\n if (WjElementUtils.hasSlot(this, 'separator')) {\n let slotSeparator = document.createElement('slot');\n slotSeparator.setAttribute('name', 'separator');\n\n separator.append(slotSeparator);\n } else {\n separator.innerHTML = `<wje-icon name=${this.separator || 'chevron-right'}></wje-icon>`;\n }\n\n fragment.append(separator);\n }\n\n this.native = native;\n\n return fragment;\n }\n\n /**\n * Renders the collapsed indicator based on the current collapsed variant.\n * If the collapsed variant is 'DROPDOWN', it invokes the collapseDropdown method.\n * Otherwise, it invokes the collapseButton method.\n * @returns {any} The rendered collapsed indicator, either as a dropdown or a button.\n */\n drawCollapsedIndicator() {\n let collapsedIndicator = null;\n\n if (this.collapsedVariant === 'DROPDOWN') {\n collapsedIndicator = this.collapseDropdown();\n } else {\n collapsedIndicator = this.collapseButton();\n }\n\n return collapsedIndicator;\n }\n\n /**\n * Creates and returns a dropdown UI component for collapsed breadcrumbs.\n * This method generates a dropdown element with a button trigger and a menu populated with items corresponding\n * to the collapsed breadcrumbs. The dropdown is configured to handle specific interactions and ensure that\n * events are appropriately managed to avoid propagation issues. Menu items are linked to their corresponding\n * breadcrumbs, enabling the same functionality as clicking on the original breadcrumb.\n * @returns {HTMLElement} A configured dropdown element containing a button as trigger and a menu with breadcrumb items.\n */\n collapseDropdown() {\n let dropdown = document.createElement('wje-dropdown');\n dropdown.setAttribute('placement', 'bottom');\n dropdown.setAttribute('offset', '10');\n\n let button = document.createElement('wje-button');\n button.setAttribute('slot', 'trigger');\n button.setAttribute('fill', 'link');\n button.innerHTML = `<wje-icon name=\"dots\"></wje-icon>`;\n\n let menu = document.createElement('wje-menu');\n menu.setAttribute('variant', 'context');\n\n menu.addEventListener('click', (e) => {\n e.stopPropagation();\n e.stopImmediatePropagation?.();\n });\n\n this.getBreadcrumbs().getBreadcrumbsCollapsed().forEach((b) => {\n let menuItem = document.createElement('wje-menu-item');\n menuItem.innerHTML = b.innerHTML;\n\n menuItem.__breadcrumb = b;\n\n menuItem.addEventListener('wje-menu-item:click', (e) => {\n e.preventDefault?.();\n e.stopPropagation();\n e.stopImmediatePropagation?.();\n\n const breadcrumb = e.currentTarget.__breadcrumb;\n if (!breadcrumb) return;\n\n // Prefer clicking the internal anchor (same behavior as real user click), fallback to host click.\n const native = breadcrumb.native || breadcrumb.context?.querySelector('a.native-breadcrumb');\n if (native && typeof native.click === 'function') {\n native.click();\n } else if (typeof breadcrumb.click === 'function') {\n breadcrumb.click();\n } else {\n breadcrumb.dispatchEvent(\n new MouseEvent('click', {\n bubbles: true,\n composed: true,\n cancelable: true\n })\n );\n }\n });\n\n menu.append(menuItem);\n });\n\n dropdown.append(button, menu);\n\n return dropdown;\n }\n\n /**\n * Creates a button element that expands hidden breadcrumbs when clicked.\n * The button is set with appropriate attributes and event listeners to handle\n * the expanding of hidden breadcrumb elements. Clicking the button will remove\n * the button itself, reveal hidden breadcrumbs, and stop the current event\n * propagation.\n * @returns {HTMLButtonElement} The created button configured to expand breadcrumbs.\n */\n collapseButton() {\n let button = document.createElement('button');\n button.setAttribute('aria-label', 'Show more breadcrumbs');\n button.setAttribute('part', 'collapsed-indicator');\n button.innerHTML = `<wje-icon name=\"dots\"></wje-icon>`;\n\n event.addListener(button, 'click', null, (e) => {\n this.native.classList.remove('hidden');\n button.remove();\n this.getBreadcrumbs().getBreadcrumbsCollapsed().forEach((el) => {\n el.classList.remove('collapsed');\n });\n e.stopPropagation();\n });\n\n return button;\n }\n\n /**\n * Retrieves the breadcrumb trail for the current element by returning its parent element.\n * @returns {Element} The parent element representing the breadcrumb trail.\n */\n getBreadcrumbs() {\n return this.parentElement;\n }\n}\n","import Breadcrumb from './breadcrumb.element.js';\n\n// export * from \"./breadcrumb.element.js\";\nexport default Breadcrumb;\n\nBreadcrumb.define('wje-breadcrumb', Breadcrumb);\n"],"names":[],"mappings":";;;;;;;AAkBe,MAAM,mBAAmB,UAAU;AAAA;AAA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