juxscript 1.1.15 → 1.1.17
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/lib/components/base/BaseComponent.d.ts +10 -22
- package/lib/components/base/BaseComponent.d.ts.map +1 -1
- package/lib/components/base/BaseComponent.js +43 -1
- package/lib/components/base/BaseComponent.ts +45 -22
- package/lib/components/hero.d.ts +2 -2
- package/lib/components/hero.d.ts.map +1 -1
- package/lib/components/hero.js +7 -11
- package/lib/components/hero.ts +8 -10
- package/lib/components/sidebar.d.ts.map +1 -1
- package/lib/components/sidebar.js +0 -7
- package/lib/components/sidebar.ts +0 -7
- package/package.json +1 -1
|
@@ -42,28 +42,12 @@ export declare abstract class BaseComponent<TState extends BaseState = BaseState
|
|
|
42
42
|
protected abstract getCallbackEvents(): readonly string[];
|
|
43
43
|
abstract render(targetId?: string): this;
|
|
44
44
|
/**
|
|
45
|
-
* REACTIVE UPDATE HOOK (
|
|
46
|
-
* Called automatically when this.state[prop] changes via
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* This is PUBLIC because:
|
|
50
|
-
* - Components may need to call it manually
|
|
51
|
-
* - Allows external updates without full re-render
|
|
52
|
-
* - Part of the component's public API
|
|
53
|
-
*
|
|
54
|
-
* @param prop - The state property that changed
|
|
55
|
-
* @param value - The new value
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* update(prop: string, value: any): void {
|
|
59
|
-
* const el = document.getElementById(this._id);
|
|
60
|
-
* if (!el) return;
|
|
61
|
-
*
|
|
62
|
-
* if (prop === 'label') el.textContent = value;
|
|
63
|
-
* if (prop === 'visible') el.style.display = value ? '' : 'none';
|
|
64
|
-
* }
|
|
45
|
+
* REACTIVE UPDATE HOOK (PUBLIC, CONCRETE)
|
|
46
|
+
* Called automatically when this.state[prop] changes via Proxy.
|
|
47
|
+
* Default implementation handles base properties.
|
|
48
|
+
* Children can override to add component-specific logic.
|
|
65
49
|
*/
|
|
66
|
-
|
|
50
|
+
update(prop: string, value: any): void;
|
|
67
51
|
/**
|
|
68
52
|
* Set component style
|
|
69
53
|
*/
|
|
@@ -161,7 +145,11 @@ export declare abstract class BaseComponent<TState extends BaseState = BaseState
|
|
|
161
145
|
protected _wireAllSyncs(): void;
|
|
162
146
|
renderTo(juxComponent: any): this;
|
|
163
147
|
/**
|
|
164
|
-
* ✅ Read-only accessor for component state
|
|
148
|
+
* ✅ Read-only accessor for component state (getter, not a method)
|
|
149
|
+
*
|
|
150
|
+
* Usage:
|
|
151
|
+
* const myState = component.props; // ✅ Correct
|
|
152
|
+
* const myState = component.props(); // ❌ Error: props is not a function
|
|
165
153
|
*/
|
|
166
154
|
get props(): Readonly<TState>;
|
|
167
155
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseComponent.d.ts","sourceRoot":"","sources":["BaseComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAGlD;;;GAGG;AACH,MAAM,WAAW,SAAS;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvC;AAED;;;;;;;;GAQG;AACH,8BAAsB,aAAa,CAAC,MAAM,SAAS,SAAS,GAAG,SAAS;IAEpE,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,WAAW,GAAG,IAAI,CAAQ;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;IAGX,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,QAAQ,CAAA;KAAE,CAAC,CAAM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AE,WAAW,GAAG,IAAI;IAMzD;;;OAGG;IACH,SAAS,CAAC,aAAa,IAAI,IAAI;IA0B/B,QAAQ,CAAC,YAAY,EAAE,GAAG,GAAG,IAAI;IAWjC;;;;;;OAMG;IACH,IAAI,KAAK,IAAI,QAAQ,CAAC,MAAM,CAAC,CAE5B;CACJ"}
|
|
@@ -40,6 +40,44 @@ export class BaseComponent {
|
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* REACTIVE UPDATE HOOK (PUBLIC, CONCRETE)
|
|
45
|
+
* Called automatically when this.state[prop] changes via Proxy.
|
|
46
|
+
* Default implementation handles base properties.
|
|
47
|
+
* Children can override to add component-specific logic.
|
|
48
|
+
*/
|
|
49
|
+
update(prop, value) {
|
|
50
|
+
if (!this.container)
|
|
51
|
+
return;
|
|
52
|
+
const el = this.container.querySelector(`#${this._id}`);
|
|
53
|
+
if (!el)
|
|
54
|
+
return;
|
|
55
|
+
// Handle base properties
|
|
56
|
+
switch (prop) {
|
|
57
|
+
case 'visible':
|
|
58
|
+
el.style.display = value ? '' : 'none';
|
|
59
|
+
break;
|
|
60
|
+
case 'class':
|
|
61
|
+
const baseClasses = el.className.split(' ').filter(c => c.startsWith('jux-'));
|
|
62
|
+
const userClasses = value.split(' ').filter((c) => c);
|
|
63
|
+
el.className = [...baseClasses, ...userClasses].join(' ');
|
|
64
|
+
break;
|
|
65
|
+
case 'style':
|
|
66
|
+
el.setAttribute('style', value);
|
|
67
|
+
break;
|
|
68
|
+
case 'disabled':
|
|
69
|
+
el.setAttribute('aria-disabled', String(value));
|
|
70
|
+
const inputs = el.querySelectorAll('input, button, select, textarea');
|
|
71
|
+
inputs.forEach(input => {
|
|
72
|
+
input.disabled = value;
|
|
73
|
+
});
|
|
74
|
+
break;
|
|
75
|
+
case 'loading':
|
|
76
|
+
el.classList.toggle('jux-loading', value);
|
|
77
|
+
el.setAttribute('aria-busy', String(value));
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
43
81
|
/* ═════════════════════════════════════════════════════════════════
|
|
44
82
|
* COMMON FLUENT API (Inherited by all components)
|
|
45
83
|
* ═════════════════════════════════════════════════════════════════ */
|
|
@@ -336,7 +374,11 @@ export class BaseComponent {
|
|
|
336
374
|
* PROPS ACCESSOR - Read-only access to component state
|
|
337
375
|
* ═════════════════════════════════════════════════════════════════ */
|
|
338
376
|
/**
|
|
339
|
-
* ✅ Read-only accessor for component state
|
|
377
|
+
* ✅ Read-only accessor for component state (getter, not a method)
|
|
378
|
+
*
|
|
379
|
+
* Usage:
|
|
380
|
+
* const myState = component.props; // ✅ Correct
|
|
381
|
+
* const myState = component.props(); // ❌ Error: props is not a function
|
|
340
382
|
*/
|
|
341
383
|
get props() {
|
|
342
384
|
return this.state;
|
|
@@ -78,28 +78,47 @@ export abstract class BaseComponent<TState extends BaseState = BaseState> {
|
|
|
78
78
|
abstract render(targetId?: string): this;
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
|
-
* REACTIVE UPDATE HOOK (
|
|
82
|
-
* Called automatically when this.state[prop] changes via
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* This is PUBLIC because:
|
|
86
|
-
* - Components may need to call it manually
|
|
87
|
-
* - Allows external updates without full re-render
|
|
88
|
-
* - Part of the component's public API
|
|
89
|
-
*
|
|
90
|
-
* @param prop - The state property that changed
|
|
91
|
-
* @param value - The new value
|
|
92
|
-
*
|
|
93
|
-
* @example
|
|
94
|
-
* update(prop: string, value: any): void {
|
|
95
|
-
* const el = document.getElementById(this._id);
|
|
96
|
-
* if (!el) return;
|
|
97
|
-
*
|
|
98
|
-
* if (prop === 'label') el.textContent = value;
|
|
99
|
-
* if (prop === 'visible') el.style.display = value ? '' : 'none';
|
|
100
|
-
* }
|
|
81
|
+
* REACTIVE UPDATE HOOK (PUBLIC, CONCRETE)
|
|
82
|
+
* Called automatically when this.state[prop] changes via Proxy.
|
|
83
|
+
* Default implementation handles base properties.
|
|
84
|
+
* Children can override to add component-specific logic.
|
|
101
85
|
*/
|
|
102
|
-
|
|
86
|
+
update(prop: string, value: any): void {
|
|
87
|
+
if (!this.container) return;
|
|
88
|
+
|
|
89
|
+
const el = this.container.querySelector(`#${this._id}`) as HTMLElement;
|
|
90
|
+
if (!el) return;
|
|
91
|
+
|
|
92
|
+
// Handle base properties
|
|
93
|
+
switch (prop) {
|
|
94
|
+
case 'visible':
|
|
95
|
+
el.style.display = value ? '' : 'none';
|
|
96
|
+
break;
|
|
97
|
+
|
|
98
|
+
case 'class':
|
|
99
|
+
const baseClasses = el.className.split(' ').filter(c => c.startsWith('jux-'));
|
|
100
|
+
const userClasses = value.split(' ').filter((c: string) => c);
|
|
101
|
+
el.className = [...baseClasses, ...userClasses].join(' ');
|
|
102
|
+
break;
|
|
103
|
+
|
|
104
|
+
case 'style':
|
|
105
|
+
el.setAttribute('style', value);
|
|
106
|
+
break;
|
|
107
|
+
|
|
108
|
+
case 'disabled':
|
|
109
|
+
el.setAttribute('aria-disabled', String(value));
|
|
110
|
+
const inputs = el.querySelectorAll('input, button, select, textarea');
|
|
111
|
+
inputs.forEach(input => {
|
|
112
|
+
(input as HTMLInputElement).disabled = value;
|
|
113
|
+
});
|
|
114
|
+
break;
|
|
115
|
+
|
|
116
|
+
case 'loading':
|
|
117
|
+
el.classList.toggle('jux-loading', value);
|
|
118
|
+
el.setAttribute('aria-busy', String(value));
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
103
122
|
|
|
104
123
|
/* ═════════════════════════════════════════════════════════════════
|
|
105
124
|
* COMMON FLUENT API (Inherited by all components)
|
|
@@ -436,7 +455,11 @@ export abstract class BaseComponent<TState extends BaseState = BaseState> {
|
|
|
436
455
|
* ═════════════════════════════════════════════════════════════════ */
|
|
437
456
|
|
|
438
457
|
/**
|
|
439
|
-
* ✅ Read-only accessor for component state
|
|
458
|
+
* ✅ Read-only accessor for component state (getter, not a method)
|
|
459
|
+
*
|
|
460
|
+
* Usage:
|
|
461
|
+
* const myState = component.props; // ✅ Correct
|
|
462
|
+
* const myState = component.props(); // ❌ Error: props is not a function
|
|
440
463
|
*/
|
|
441
464
|
get props(): Readonly<TState> {
|
|
442
465
|
return this.state as Readonly<TState>;
|
package/lib/components/hero.d.ts
CHANGED
|
@@ -36,8 +36,8 @@ export declare class Hero extends BaseComponent<HeroState> {
|
|
|
36
36
|
protected getTriggerEvents(): readonly string[];
|
|
37
37
|
protected getCallbackEvents(): readonly string[];
|
|
38
38
|
/**
|
|
39
|
-
* Called automatically
|
|
40
|
-
*
|
|
39
|
+
* Called automatically when state changes.
|
|
40
|
+
* Extends BaseComponent's update() to handle Hero-specific properties.
|
|
41
41
|
*/
|
|
42
42
|
update(prop: string, value: any): void;
|
|
43
43
|
title(value: string): this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hero.d.ts","sourceRoot":"","sources":["hero.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAMnE,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,GAAG;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3E,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,OAAO,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,OAAO,CAAC;IAC3C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,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KAAK,EAAE,OAAO,GAAG,IAAI;IAKvC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK5B,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAS9B,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI;CAsEhC;AAED,wBAAgB,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,IAAI,CAEhE"}
|
package/lib/components/hero.js
CHANGED
|
@@ -27,14 +27,14 @@ export class Hero extends BaseComponent {
|
|
|
27
27
|
getCallbackEvents() {
|
|
28
28
|
return CALLBACK_EVENTS;
|
|
29
29
|
}
|
|
30
|
-
/* ═════════════════════════════════════════════════════════════════
|
|
31
|
-
* REACTIVE DOM UPDATES
|
|
32
|
-
* ═════════════════════════════════════════════════════════════════ */
|
|
33
30
|
/**
|
|
34
|
-
* Called automatically
|
|
35
|
-
*
|
|
31
|
+
* Called automatically when state changes.
|
|
32
|
+
* Extends BaseComponent's update() to handle Hero-specific properties.
|
|
36
33
|
*/
|
|
37
34
|
update(prop, value) {
|
|
35
|
+
// First, call parent to handle base properties (visible, class, style, etc.)
|
|
36
|
+
super.update(prop, value);
|
|
37
|
+
// Then handle Hero-specific properties
|
|
38
38
|
const hero = document.getElementById(this._id);
|
|
39
39
|
if (!hero)
|
|
40
40
|
return;
|
|
@@ -70,10 +70,7 @@ export class Hero extends BaseComponent {
|
|
|
70
70
|
hero.style.backgroundRepeat = value.repeat;
|
|
71
71
|
break;
|
|
72
72
|
case 'centered':
|
|
73
|
-
|
|
74
|
-
hero.classList.add('jux-hero-centered');
|
|
75
|
-
else
|
|
76
|
-
hero.classList.remove('jux-hero-centered');
|
|
73
|
+
hero.classList.toggle('jux-hero-centered', value);
|
|
77
74
|
break;
|
|
78
75
|
}
|
|
79
76
|
}
|
|
@@ -177,7 +174,6 @@ export class Hero extends BaseComponent {
|
|
|
177
174
|
ctaButton.className = 'jux-hero-cta';
|
|
178
175
|
ctaButton.href = this.state.ctaLink;
|
|
179
176
|
ctaButton.textContent = this.state.cta;
|
|
180
|
-
// ✅ Fire callback when CTA is clicked
|
|
181
177
|
ctaButton.addEventListener('click', (e) => {
|
|
182
178
|
this._triggerCallback('ctaClick', e);
|
|
183
179
|
});
|
|
@@ -185,7 +181,7 @@ export class Hero extends BaseComponent {
|
|
|
185
181
|
}
|
|
186
182
|
hero.appendChild(contentContainer);
|
|
187
183
|
this._wireStandardEvents(hero);
|
|
188
|
-
this._wireAllSyncs();
|
|
184
|
+
this._wireAllSyncs();
|
|
189
185
|
container.appendChild(hero);
|
|
190
186
|
return this;
|
|
191
187
|
}
|
package/lib/components/hero.ts
CHANGED
|
@@ -59,15 +59,15 @@ export class Hero extends BaseComponent<HeroState> {
|
|
|
59
59
|
return CALLBACK_EVENTS;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
/* ═════════════════════════════════════════════════════════════════
|
|
63
|
-
* REACTIVE DOM UPDATES
|
|
64
|
-
* ═════════════════════════════════════════════════════════════════ */
|
|
65
|
-
|
|
66
62
|
/**
|
|
67
|
-
* Called automatically
|
|
68
|
-
*
|
|
63
|
+
* Called automatically when state changes.
|
|
64
|
+
* Extends BaseComponent's update() to handle Hero-specific properties.
|
|
69
65
|
*/
|
|
70
66
|
update(prop: string, value: any): void {
|
|
67
|
+
// First, call parent to handle base properties (visible, class, style, etc.)
|
|
68
|
+
super.update(prop, value);
|
|
69
|
+
|
|
70
|
+
// Then handle Hero-specific properties
|
|
71
71
|
const hero = document.getElementById(this._id);
|
|
72
72
|
if (!hero) return;
|
|
73
73
|
|
|
@@ -104,8 +104,7 @@ export class Hero extends BaseComponent<HeroState> {
|
|
|
104
104
|
break;
|
|
105
105
|
|
|
106
106
|
case 'centered':
|
|
107
|
-
|
|
108
|
-
else hero.classList.remove('jux-hero-centered');
|
|
107
|
+
hero.classList.toggle('jux-hero-centered', value);
|
|
109
108
|
break;
|
|
110
109
|
}
|
|
111
110
|
}
|
|
@@ -226,7 +225,6 @@ export class Hero extends BaseComponent<HeroState> {
|
|
|
226
225
|
ctaButton.href = this.state.ctaLink;
|
|
227
226
|
ctaButton.textContent = this.state.cta;
|
|
228
227
|
|
|
229
|
-
// ✅ Fire callback when CTA is clicked
|
|
230
228
|
ctaButton.addEventListener('click', (e) => {
|
|
231
229
|
this._triggerCallback('ctaClick', e);
|
|
232
230
|
});
|
|
@@ -237,7 +235,7 @@ export class Hero extends BaseComponent<HeroState> {
|
|
|
237
235
|
hero.appendChild(contentContainer);
|
|
238
236
|
|
|
239
237
|
this._wireStandardEvents(hero);
|
|
240
|
-
this._wireAllSyncs();
|
|
238
|
+
this._wireAllSyncs();
|
|
241
239
|
|
|
242
240
|
container.appendChild(hero);
|
|
243
241
|
return this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["sidebar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAQnE,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,WAAW,EAAE,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,WAAW,EAAE,CAAC;IACtB,MA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AKvC,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAKjC,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAKhC,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAKnC,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAK/B,KAAK,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,IAAI;IAKjC,OAAO,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IAKhC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK3B,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK3B,MAAM,IAAI,IAAI;IAKd,mBAAmB,IAAI,IAAI;IAU3B,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI;CA2FhC;AAED,wBAAgB,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAEzE"}
|
|
@@ -102,7 +102,6 @@ export class Sidebar extends BaseComponent {
|
|
|
102
102
|
});
|
|
103
103
|
itemEl.appendChild(button);
|
|
104
104
|
}
|
|
105
|
-
// Handle sub-items
|
|
106
105
|
if (item.items && item.items.length > 0) {
|
|
107
106
|
itemEl.classList.add('jux-sidebar-item-has-submenu');
|
|
108
107
|
const submenu = document.createElement('div');
|
|
@@ -111,7 +110,6 @@ export class Sidebar extends BaseComponent {
|
|
|
111
110
|
submenu.appendChild(this._renderItem(subItem));
|
|
112
111
|
});
|
|
113
112
|
itemEl.appendChild(submenu);
|
|
114
|
-
// Toggle submenu expansion
|
|
115
113
|
const clickTarget = itemEl.querySelector('a, button');
|
|
116
114
|
if (clickTarget) {
|
|
117
115
|
clickTarget.addEventListener('click', (e) => {
|
|
@@ -235,28 +233,24 @@ export class Sidebar extends BaseComponent {
|
|
|
235
233
|
sidebar.setAttribute('style', style);
|
|
236
234
|
if (width)
|
|
237
235
|
sidebar.style.width = width;
|
|
238
|
-
// Header
|
|
239
236
|
if (header) {
|
|
240
237
|
const headerEl = document.createElement('div');
|
|
241
238
|
headerEl.className = 'jux-sidebar-header';
|
|
242
239
|
headerEl.textContent = header;
|
|
243
240
|
sidebar.appendChild(headerEl);
|
|
244
241
|
}
|
|
245
|
-
// Navigation
|
|
246
242
|
const nav = document.createElement('nav');
|
|
247
243
|
nav.className = 'jux-sidebar-nav';
|
|
248
244
|
items.forEach(item => {
|
|
249
245
|
nav.appendChild(this._renderItem(item));
|
|
250
246
|
});
|
|
251
247
|
sidebar.appendChild(nav);
|
|
252
|
-
// Footer
|
|
253
248
|
if (footer) {
|
|
254
249
|
const footerEl = document.createElement('div');
|
|
255
250
|
footerEl.className = 'jux-sidebar-footer';
|
|
256
251
|
footerEl.textContent = footer;
|
|
257
252
|
sidebar.appendChild(footerEl);
|
|
258
253
|
}
|
|
259
|
-
// Toggle button
|
|
260
254
|
if (this.state.collapsible || this.state.showToggle) {
|
|
261
255
|
const toggleBtn = document.createElement('button');
|
|
262
256
|
toggleBtn.className = 'jux-sidebar-toggle';
|
|
@@ -275,7 +269,6 @@ export class Sidebar extends BaseComponent {
|
|
|
275
269
|
});
|
|
276
270
|
sidebar.appendChild(toggleBtn);
|
|
277
271
|
}
|
|
278
|
-
// Expand on hover
|
|
279
272
|
if (expandOnHover) {
|
|
280
273
|
sidebar.addEventListener('mouseenter', () => {
|
|
281
274
|
if (this.state.collapsed) {
|
|
@@ -161,7 +161,6 @@ export class Sidebar extends BaseComponent<SidebarState> {
|
|
|
161
161
|
itemEl.appendChild(button);
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
// Handle sub-items
|
|
165
164
|
if (item.items && item.items.length > 0) {
|
|
166
165
|
itemEl.classList.add('jux-sidebar-item-has-submenu');
|
|
167
166
|
|
|
@@ -174,7 +173,6 @@ export class Sidebar extends BaseComponent<SidebarState> {
|
|
|
174
173
|
|
|
175
174
|
itemEl.appendChild(submenu);
|
|
176
175
|
|
|
177
|
-
// Toggle submenu expansion
|
|
178
176
|
const clickTarget = itemEl.querySelector('a, button');
|
|
179
177
|
if (clickTarget) {
|
|
180
178
|
clickTarget.addEventListener('click', (e) => {
|
|
@@ -316,7 +314,6 @@ export class Sidebar extends BaseComponent<SidebarState> {
|
|
|
316
314
|
if (style) sidebar.setAttribute('style', style);
|
|
317
315
|
if (width) sidebar.style.width = width;
|
|
318
316
|
|
|
319
|
-
// Header
|
|
320
317
|
if (header) {
|
|
321
318
|
const headerEl = document.createElement('div');
|
|
322
319
|
headerEl.className = 'jux-sidebar-header';
|
|
@@ -324,7 +321,6 @@ export class Sidebar extends BaseComponent<SidebarState> {
|
|
|
324
321
|
sidebar.appendChild(headerEl);
|
|
325
322
|
}
|
|
326
323
|
|
|
327
|
-
// Navigation
|
|
328
324
|
const nav = document.createElement('nav');
|
|
329
325
|
nav.className = 'jux-sidebar-nav';
|
|
330
326
|
|
|
@@ -334,7 +330,6 @@ export class Sidebar extends BaseComponent<SidebarState> {
|
|
|
334
330
|
|
|
335
331
|
sidebar.appendChild(nav);
|
|
336
332
|
|
|
337
|
-
// Footer
|
|
338
333
|
if (footer) {
|
|
339
334
|
const footerEl = document.createElement('div');
|
|
340
335
|
footerEl.className = 'jux-sidebar-footer';
|
|
@@ -342,7 +337,6 @@ export class Sidebar extends BaseComponent<SidebarState> {
|
|
|
342
337
|
sidebar.appendChild(footerEl);
|
|
343
338
|
}
|
|
344
339
|
|
|
345
|
-
// Toggle button
|
|
346
340
|
if (this.state.collapsible || this.state.showToggle) {
|
|
347
341
|
const toggleBtn = document.createElement('button');
|
|
348
342
|
toggleBtn.className = 'jux-sidebar-toggle';
|
|
@@ -366,7 +360,6 @@ export class Sidebar extends BaseComponent<SidebarState> {
|
|
|
366
360
|
sidebar.appendChild(toggleBtn);
|
|
367
361
|
}
|
|
368
362
|
|
|
369
|
-
// Expand on hover
|
|
370
363
|
if (expandOnHover) {
|
|
371
364
|
sidebar.addEventListener('mouseenter', () => {
|
|
372
365
|
if (this.state.collapsed) {
|