juxscript 1.1.239 → 1.1.243
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/index.js +7 -137
- package/lib/components/dataframe.ts +0 -569
- package/lib/components/tag.ts +68 -0
- package/lib/styles/shadcn.css +20 -7
- package/lib/utils/idgen.ts +6 -0
- package/package.json +5 -6
- package/index.d.ts +0 -239
- package/index.d.ts.map +0 -1
- package/lib/components/alert.d.ts +0 -36
- package/lib/components/alert.d.ts.map +0 -1
- package/lib/components/alert.js +0 -172
- package/lib/components/alert.ts +0 -219
- package/lib/components/app.d.ts +0 -89
- package/lib/components/app.d.ts.map +0 -1
- package/lib/components/app.js +0 -175
- package/lib/components/app.ts +0 -247
- package/lib/components/badge.d.ts +0 -26
- package/lib/components/badge.d.ts.map +0 -1
- package/lib/components/badge.js +0 -91
- package/lib/components/badge.ts +0 -118
- package/lib/components/base/Animations.d.ts +0 -36
- package/lib/components/base/Animations.d.ts.map +0 -1
- package/lib/components/base/Animations.js +0 -70
- package/lib/components/base/Animations.ts +0 -112
- package/lib/components/base/BaseComponent.d.ts +0 -294
- package/lib/components/base/BaseComponent.d.ts.map +0 -1
- package/lib/components/base/BaseComponent.js +0 -735
- package/lib/components/base/BaseComponent.ts +0 -884
- package/lib/components/base/FormInput.d.ts +0 -77
- package/lib/components/base/FormInput.d.ts.map +0 -1
- package/lib/components/base/FormInput.js +0 -171
- package/lib/components/base/FormInput.ts +0 -237
- package/lib/components/blueprint.d.ts +0 -40
- package/lib/components/blueprint.d.ts.map +0 -1
- package/lib/components/blueprint.js +0 -327
- package/lib/components/button.d.ts +0 -70
- package/lib/components/button.d.ts.map +0 -1
- package/lib/components/button.js +0 -177
- package/lib/components/button.ts +0 -237
- package/lib/components/card.d.ts +0 -35
- package/lib/components/card.d.ts.map +0 -1
- package/lib/components/card.js +0 -130
- package/lib/components/card.ts +0 -177
- package/lib/components/chart.d.ts +0 -49
- package/lib/components/chart.d.ts.map +0 -1
- package/lib/components/chart.js +0 -205
- package/lib/components/chart.ts +0 -254
- package/lib/components/checkbox.d.ts +0 -33
- package/lib/components/checkbox.d.ts.map +0 -1
- package/lib/components/checkbox.js +0 -202
- package/lib/components/checkbox.ts +0 -260
- package/lib/components/code.d.ts +0 -52
- package/lib/components/code.d.ts.map +0 -1
- package/lib/components/code.js +0 -201
- package/lib/components/code.ts +0 -260
- package/lib/components/container.d.ts +0 -60
- package/lib/components/container.d.ts.map +0 -1
- package/lib/components/container.js +0 -195
- package/lib/components/container.ts +0 -259
- package/lib/components/data.d.ts +0 -36
- package/lib/components/data.d.ts.map +0 -1
- package/lib/components/data.js +0 -110
- package/lib/components/data.ts +0 -135
- package/lib/components/dataframe/DataFrameSource.d.ts +0 -118
- package/lib/components/dataframe/DataFrameSource.d.ts.map +0 -1
- package/lib/components/dataframe/DataFrameSource.js +0 -421
- package/lib/components/dataframe/DataFrameSource.ts +0 -532
- package/lib/components/dataframe/ImportSettingsModal.d.ts +0 -60
- package/lib/components/dataframe/ImportSettingsModal.d.ts.map +0 -1
- package/lib/components/dataframe/ImportSettingsModal.js +0 -442
- package/lib/components/dataframe/ImportSettingsModal.ts +0 -531
- package/lib/components/dataframe.d.ts +0 -110
- package/lib/components/dataframe.d.ts.map +0 -1
- package/lib/components/dataframe.js +0 -470
- package/lib/components/datepicker.d.ts +0 -40
- package/lib/components/datepicker.d.ts.map +0 -1
- package/lib/components/datepicker.js +0 -193
- package/lib/components/datepicker.ts +0 -251
- package/lib/components/dialog.d.ts +0 -39
- package/lib/components/dialog.d.ts.map +0 -1
- package/lib/components/dialog.js +0 -131
- package/lib/components/dialog.ts +0 -178
- package/lib/components/divider.d.ts +0 -31
- package/lib/components/divider.d.ts.map +0 -1
- package/lib/components/divider.js +0 -72
- package/lib/components/divider.ts +0 -104
- package/lib/components/dropdown-menu.d.ts +0 -42
- package/lib/components/dropdown-menu.d.ts.map +0 -1
- package/lib/components/dropdown-menu.js +0 -177
- package/lib/components/dropdown-menu.ts +0 -214
- package/lib/components/dropdown.d.ts +0 -41
- package/lib/components/dropdown.d.ts.map +0 -1
- package/lib/components/dropdown.js +0 -136
- package/lib/components/dropdown.ts +0 -188
- package/lib/components/element.d.ts +0 -51
- package/lib/components/element.d.ts.map +0 -1
- package/lib/components/element.js +0 -209
- package/lib/components/element.ts +0 -271
- package/lib/components/event-chain.d.ts +0 -9
- package/lib/components/event-chain.d.ts.map +0 -1
- package/lib/components/event-chain.js +0 -33
- package/lib/components/fileupload.d.ts +0 -98
- package/lib/components/fileupload.d.ts.map +0 -1
- package/lib/components/fileupload.js +0 -351
- package/lib/components/fileupload.ts +0 -449
- package/lib/components/grid.d.ts +0 -88
- package/lib/components/grid.d.ts.map +0 -1
- package/lib/components/grid.js +0 -208
- package/lib/components/grid.ts +0 -295
- package/lib/components/heading.d.ts +0 -25
- package/lib/components/heading.d.ts.map +0 -1
- package/lib/components/heading.js +0 -83
- package/lib/components/heading.ts +0 -113
- package/lib/components/helpers.d.ts +0 -9
- package/lib/components/helpers.d.ts.map +0 -1
- package/lib/components/helpers.js +0 -30
- package/lib/components/helpers.ts +0 -41
- package/lib/components/hero.d.ts +0 -60
- package/lib/components/hero.d.ts.map +0 -1
- package/lib/components/hero.js +0 -239
- package/lib/components/hero.ts +0 -302
- package/lib/components/history/StateHistory.d.ts +0 -91
- package/lib/components/history/StateHistory.d.ts.map +0 -1
- package/lib/components/history/StateHistory.js +0 -154
- package/lib/components/history/StateHistory.ts +0 -200
- package/lib/components/icon.d.ts +0 -36
- package/lib/components/icon.d.ts.map +0 -1
- package/lib/components/icon.js +0 -135
- package/lib/components/icon.ts +0 -182
- package/lib/components/icons.d.ts +0 -25
- package/lib/components/icons.d.ts.map +0 -1
- package/lib/components/icons.js +0 -440
- package/lib/components/icons.ts +0 -464
- package/lib/components/image.d.ts +0 -42
- package/lib/components/image.d.ts.map +0 -1
- package/lib/components/image.js +0 -204
- package/lib/components/image.ts +0 -260
- package/lib/components/include.d.ts +0 -86
- package/lib/components/include.d.ts.map +0 -1
- package/lib/components/include.js +0 -238
- package/lib/components/include.ts +0 -281
- package/lib/components/input.d.ts +0 -85
- package/lib/components/input.d.ts.map +0 -1
- package/lib/components/input.js +0 -362
- package/lib/components/input.ts +0 -473
- package/lib/components/layer.d.ts +0 -72
- package/lib/components/layer.d.ts.map +0 -1
- package/lib/components/layer.js +0 -219
- package/lib/components/layer.ts +0 -304
- package/lib/components/link.d.ts +0 -41
- package/lib/components/link.d.ts.map +0 -1
- package/lib/components/link.js +0 -216
- package/lib/components/link.ts +0 -268
- package/lib/components/list.d.ts +0 -83
- package/lib/components/list.d.ts.map +0 -1
- package/lib/components/list.js +0 -314
- package/lib/components/list.ts +0 -423
- package/lib/components/loading.d.ts +0 -25
- package/lib/components/loading.d.ts.map +0 -1
- package/lib/components/loading.js +0 -76
- package/lib/components/loading.ts +0 -104
- package/lib/components/menu.d.ts +0 -38
- package/lib/components/menu.d.ts.map +0 -1
- package/lib/components/menu.js +0 -205
- package/lib/components/menu.ts +0 -279
- package/lib/components/modal.d.ts +0 -97
- package/lib/components/modal.d.ts.map +0 -1
- package/lib/components/modal.js +0 -463
- package/lib/components/modal.ts +0 -576
- package/lib/components/nav.d.ts +0 -46
- package/lib/components/nav.d.ts.map +0 -1
- package/lib/components/nav.js +0 -193
- package/lib/components/nav.ts +0 -261
- package/lib/components/paragraph.d.ts +0 -30
- package/lib/components/paragraph.d.ts.map +0 -1
- package/lib/components/paragraph.js +0 -93
- package/lib/components/paragraph.ts +0 -123
- package/lib/components/pen.d.ts +0 -125
- package/lib/components/pen.d.ts.map +0 -1
- package/lib/components/pen.js +0 -443
- package/lib/components/pen.ts +0 -567
- package/lib/components/progress.d.ts +0 -40
- package/lib/components/progress.d.ts.map +0 -1
- package/lib/components/progress.js +0 -116
- package/lib/components/progress.ts +0 -163
- package/lib/components/radio.d.ts +0 -43
- package/lib/components/radio.d.ts.map +0 -1
- package/lib/components/radio.js +0 -226
- package/lib/components/radio.ts +0 -303
- package/lib/components/registry.d.ts +0 -34
- package/lib/components/registry.d.ts.map +0 -1
- package/lib/components/registry.js +0 -163
- package/lib/components/registry.ts +0 -193
- package/lib/components/req.d.ts +0 -155
- package/lib/components/req.d.ts.map +0 -1
- package/lib/components/req.js +0 -253
- package/lib/components/req.ts +0 -303
- package/lib/components/script.d.ts +0 -14
- package/lib/components/script.d.ts.map +0 -1
- package/lib/components/script.js +0 -33
- package/lib/components/script.ts +0 -41
- package/lib/components/select.d.ts +0 -42
- package/lib/components/select.d.ts.map +0 -1
- package/lib/components/select.js +0 -209
- package/lib/components/select.ts +0 -281
- package/lib/components/sidebar.d.ts +0 -59
- package/lib/components/sidebar.d.ts.map +0 -1
- package/lib/components/sidebar.js +0 -298
- package/lib/components/sidebar.ts +0 -395
- package/lib/components/stack/BaseStack.d.ts +0 -65
- package/lib/components/stack/BaseStack.d.ts.map +0 -1
- package/lib/components/stack/BaseStack.js +0 -274
- package/lib/components/stack/BaseStack.ts +0 -328
- package/lib/components/stack/HStack.d.ts +0 -18
- package/lib/components/stack/HStack.d.ts.map +0 -1
- package/lib/components/stack/HStack.js +0 -22
- package/lib/components/stack/HStack.ts +0 -25
- package/lib/components/stack/VStack.d.ts +0 -19
- package/lib/components/stack/VStack.d.ts.map +0 -1
- package/lib/components/stack/VStack.js +0 -23
- package/lib/components/stack/VStack.ts +0 -26
- package/lib/components/stack/ZStack.d.ts +0 -18
- package/lib/components/stack/ZStack.d.ts.map +0 -1
- package/lib/components/stack/ZStack.js +0 -22
- package/lib/components/stack/ZStack.ts +0 -25
- package/lib/components/style.d.ts +0 -14
- package/lib/components/style.d.ts.map +0 -1
- package/lib/components/style.js +0 -33
- package/lib/components/style.ts +0 -41
- package/lib/components/switch.d.ts +0 -34
- package/lib/components/switch.d.ts.map +0 -1
- package/lib/components/switch.js +0 -209
- package/lib/components/switch.ts +0 -272
- package/lib/components/table.d.ts +0 -137
- package/lib/components/table.d.ts.map +0 -1
- package/lib/components/table.js +0 -1019
- package/lib/components/table.ts +0 -1225
- package/lib/components/tabs.d.ts +0 -53
- package/lib/components/tabs.d.ts.map +0 -1
- package/lib/components/tabs.js +0 -275
- package/lib/components/tabs.ts +0 -349
- package/lib/components/theme-toggle.d.ts +0 -45
- package/lib/components/theme-toggle.d.ts.map +0 -1
- package/lib/components/theme-toggle.js +0 -218
- package/lib/components/theme-toggle.ts +0 -297
- package/lib/components/tooltip.d.ts +0 -31
- package/lib/components/tooltip.d.ts.map +0 -1
- package/lib/components/tooltip.js +0 -112
- package/lib/components/tooltip.ts +0 -148
- package/lib/components/watcher.d.ts +0 -195
- package/lib/components/watcher.d.ts.map +0 -1
- package/lib/components/watcher.js +0 -241
- package/lib/components/watcher.ts +0 -261
- package/lib/components/write.d.ts +0 -107
- package/lib/components/write.d.ts.map +0 -1
- package/lib/components/write.js +0 -222
- package/lib/components/write.ts +0 -272
- package/lib/data/DataPipeline.d.ts +0 -113
- package/lib/data/DataPipeline.d.ts.map +0 -1
- package/lib/data/DataPipeline.js +0 -359
- package/lib/data/DataPipeline.ts +0 -452
- package/lib/facades/dataframe.jux +0 -0
- package/lib/globals.d.ts +0 -21
- package/lib/reactivity/state.d.ts +0 -36
- package/lib/reactivity/state.d.ts.map +0 -1
- package/lib/reactivity/state.js +0 -67
- package/lib/reactivity/state.ts +0 -78
- package/lib/storage/DataFrame.d.ts +0 -284
- package/lib/storage/DataFrame.d.ts.map +0 -1
- package/lib/storage/DataFrame.js +0 -1022
- package/lib/storage/DataFrame.ts +0 -1195
- package/lib/storage/DataFrameSource.d.ts +0 -158
- package/lib/storage/DataFrameSource.d.ts.map +0 -1
- package/lib/storage/DataFrameSource.js +0 -409
- package/lib/storage/DataFrameSource.ts +0 -556
- package/lib/storage/FileStorage.d.ts +0 -53
- package/lib/storage/FileStorage.d.ts.map +0 -1
- package/lib/storage/FileStorage.js +0 -80
- package/lib/storage/FileStorage.ts +0 -95
- package/lib/storage/IndexedDBDriver.d.ts +0 -75
- package/lib/storage/IndexedDBDriver.d.ts.map +0 -1
- package/lib/storage/IndexedDBDriver.js +0 -177
- package/lib/storage/IndexedDBDriver.ts +0 -226
- package/lib/storage/TabularDriver.d.ts +0 -118
- package/lib/storage/TabularDriver.d.ts.map +0 -1
- package/lib/storage/TabularDriver.js +0 -731
- package/lib/storage/TabularDriver.ts +0 -874
- package/lib/utils/codeparser.d.ts +0 -29
- package/lib/utils/codeparser.d.ts.map +0 -1
- package/lib/utils/codeparser.js +0 -409
- package/lib/utils/fetch.d.ts +0 -176
- package/lib/utils/fetch.d.ts.map +0 -1
- package/lib/utils/fetch.js +0 -427
- package/lib/utils/formatId.d.ts +0 -16
- package/lib/utils/formatId.d.ts.map +0 -1
- package/lib/utils/formatId.js +0 -27
- package/lib/utils/path-resolver.js +0 -23
|
@@ -1,327 +0,0 @@
|
|
|
1
|
-
import { BaseComponent } from './base/BaseComponent.js';
|
|
2
|
-
// Event definitions
|
|
3
|
-
const TRIGGER_EVENTS = [];
|
|
4
|
-
const CALLBACK_EVENTS = ['select', 'expand'];
|
|
5
|
-
export class Blueprint extends BaseComponent {
|
|
6
|
-
constructor(id, options = {}) {
|
|
7
|
-
super(id, {
|
|
8
|
-
structureData: options.structureData ?? null,
|
|
9
|
-
classData: options.classData ?? null,
|
|
10
|
-
filter: options.filter ?? '',
|
|
11
|
-
showMethods: options.showMethods ?? true,
|
|
12
|
-
expandAll: options.expandAll ?? false,
|
|
13
|
-
theme: options.theme ?? 'auto',
|
|
14
|
-
expandedComponents: new Set(),
|
|
15
|
-
style: options.style ?? '',
|
|
16
|
-
class: options.class ?? ''
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
getTriggerEvents() {
|
|
20
|
-
return TRIGGER_EVENTS;
|
|
21
|
-
}
|
|
22
|
-
getCallbackEvents() {
|
|
23
|
-
return CALLBACK_EVENTS;
|
|
24
|
-
}
|
|
25
|
-
/* ═════════════════════════════════════════════════════════════════
|
|
26
|
-
* FLUENT API
|
|
27
|
-
* ═════════════════════════════════════════════════════════════════ */
|
|
28
|
-
structureData(data) {
|
|
29
|
-
this.state.structureData = data;
|
|
30
|
-
return this;
|
|
31
|
-
}
|
|
32
|
-
classData(data) {
|
|
33
|
-
this.state.classData = data;
|
|
34
|
-
return this;
|
|
35
|
-
}
|
|
36
|
-
filter(value) {
|
|
37
|
-
this.state.filter = value;
|
|
38
|
-
return this;
|
|
39
|
-
}
|
|
40
|
-
showMethods(value) {
|
|
41
|
-
this.state.showMethods = value;
|
|
42
|
-
return this;
|
|
43
|
-
}
|
|
44
|
-
expandAll(value) {
|
|
45
|
-
this.state.expandAll = value;
|
|
46
|
-
return this;
|
|
47
|
-
}
|
|
48
|
-
theme(value) {
|
|
49
|
-
this.state.theme = value;
|
|
50
|
-
return this;
|
|
51
|
-
}
|
|
52
|
-
toggleComponent(componentFile) {
|
|
53
|
-
if (this.state.expandedComponents.has(componentFile)) {
|
|
54
|
-
this.state.expandedComponents.delete(componentFile);
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
this.state.expandedComponents.add(componentFile);
|
|
58
|
-
}
|
|
59
|
-
this._triggerCallback('expand', componentFile);
|
|
60
|
-
return this;
|
|
61
|
-
}
|
|
62
|
-
/* ═════════════════════════════════════════════════════════════════
|
|
63
|
-
* RENDER HELPERS
|
|
64
|
-
* ═════════════════════════════════════════════════════════════════ */
|
|
65
|
-
_renderHierarchy(hierarchy, depth = 0) {
|
|
66
|
-
const container = document.createElement('div');
|
|
67
|
-
container.className = 'jux-blueprint-hierarchy';
|
|
68
|
-
hierarchy.forEach((node, index) => {
|
|
69
|
-
const nodeEl = document.createElement('div');
|
|
70
|
-
nodeEl.className = 'jux-blueprint-node';
|
|
71
|
-
nodeEl.style.paddingLeft = `${depth * 20}px`;
|
|
72
|
-
const isLast = index === hierarchy.length - 1;
|
|
73
|
-
const connector = isLast ? '└─' : '├─';
|
|
74
|
-
// Tree line
|
|
75
|
-
const lineEl = document.createElement('span');
|
|
76
|
-
lineEl.className = 'jux-blueprint-line';
|
|
77
|
-
lineEl.textContent = connector + ' ';
|
|
78
|
-
nodeEl.appendChild(lineEl);
|
|
79
|
-
// Tag
|
|
80
|
-
const tagEl = document.createElement('span');
|
|
81
|
-
tagEl.className = 'jux-blueprint-tag';
|
|
82
|
-
tagEl.textContent = `<${node.tag}>`;
|
|
83
|
-
nodeEl.appendChild(tagEl);
|
|
84
|
-
// ID
|
|
85
|
-
if (node.id) {
|
|
86
|
-
const idEl = document.createElement('span');
|
|
87
|
-
idEl.className = 'jux-blueprint-id';
|
|
88
|
-
idEl.textContent = ` #${node.id}`;
|
|
89
|
-
nodeEl.appendChild(idEl);
|
|
90
|
-
}
|
|
91
|
-
// Classes
|
|
92
|
-
if (node.classes && node.classes.length > 0) {
|
|
93
|
-
const classesEl = document.createElement('span');
|
|
94
|
-
classesEl.className = 'jux-blueprint-classes';
|
|
95
|
-
node.classes.forEach(cls => {
|
|
96
|
-
const classEl = document.createElement('span');
|
|
97
|
-
classEl.className = 'jux-blueprint-class';
|
|
98
|
-
classEl.textContent = `.${cls}`;
|
|
99
|
-
classesEl.appendChild(classEl);
|
|
100
|
-
classesEl.appendChild(document.createTextNode(' '));
|
|
101
|
-
});
|
|
102
|
-
nodeEl.appendChild(classesEl);
|
|
103
|
-
}
|
|
104
|
-
container.appendChild(nodeEl);
|
|
105
|
-
// Render children recursively
|
|
106
|
-
if (node.children && node.children.length > 0) {
|
|
107
|
-
container.appendChild(this._renderHierarchy(node.children, depth + 1));
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
return container;
|
|
111
|
-
}
|
|
112
|
-
_renderComponentCard(component) {
|
|
113
|
-
const { showMethods, expandAll, expandedComponents } = this.state;
|
|
114
|
-
const isExpanded = expandAll || expandedComponents.has(component.file);
|
|
115
|
-
const card = document.createElement('div');
|
|
116
|
-
card.className = 'jux-blueprint-card';
|
|
117
|
-
if (isExpanded)
|
|
118
|
-
card.classList.add('jux-blueprint-card-expanded');
|
|
119
|
-
// Header
|
|
120
|
-
const header = document.createElement('div');
|
|
121
|
-
header.className = 'jux-blueprint-card-header';
|
|
122
|
-
header.addEventListener('click', () => {
|
|
123
|
-
this.toggleComponent(component.file);
|
|
124
|
-
this.update('expandedComponents', this.state.expandedComponents);
|
|
125
|
-
});
|
|
126
|
-
const title = document.createElement('h4');
|
|
127
|
-
title.className = 'jux-blueprint-card-title';
|
|
128
|
-
title.textContent = component.file;
|
|
129
|
-
header.appendChild(title);
|
|
130
|
-
const badge = document.createElement('span');
|
|
131
|
-
badge.className = 'jux-blueprint-badge';
|
|
132
|
-
badge.textContent = `${component.classCount} classes`;
|
|
133
|
-
header.appendChild(badge);
|
|
134
|
-
const toggle = document.createElement('span');
|
|
135
|
-
toggle.className = 'jux-blueprint-toggle-icon';
|
|
136
|
-
toggle.textContent = isExpanded ? '▼' : '▶';
|
|
137
|
-
header.appendChild(toggle);
|
|
138
|
-
card.appendChild(header);
|
|
139
|
-
// Body (collapsed by default)
|
|
140
|
-
if (isExpanded) {
|
|
141
|
-
const body = document.createElement('div');
|
|
142
|
-
body.className = 'jux-blueprint-card-body';
|
|
143
|
-
// Class list
|
|
144
|
-
if (component.allClasses && component.allClasses.length > 0) {
|
|
145
|
-
const classSection = document.createElement('div');
|
|
146
|
-
classSection.className = 'jux-blueprint-section';
|
|
147
|
-
const classTitle = document.createElement('h5');
|
|
148
|
-
classTitle.className = 'jux-blueprint-section-title';
|
|
149
|
-
classTitle.textContent = 'CSS Classes';
|
|
150
|
-
classSection.appendChild(classTitle);
|
|
151
|
-
const classList = document.createElement('div');
|
|
152
|
-
classList.className = 'jux-blueprint-class-list';
|
|
153
|
-
component.allClasses.forEach((cls) => {
|
|
154
|
-
const classTag = document.createElement('span');
|
|
155
|
-
classTag.className = 'jux-blueprint-class-tag';
|
|
156
|
-
classTag.textContent = `.${cls}`;
|
|
157
|
-
classList.appendChild(classTag);
|
|
158
|
-
});
|
|
159
|
-
classSection.appendChild(classList);
|
|
160
|
-
body.appendChild(classSection);
|
|
161
|
-
}
|
|
162
|
-
// DOM Structures
|
|
163
|
-
if (component.domStructures && component.domStructures.length > 0) {
|
|
164
|
-
component.domStructures.forEach((structure) => {
|
|
165
|
-
const structSection = document.createElement('div');
|
|
166
|
-
structSection.className = 'jux-blueprint-section';
|
|
167
|
-
const methodTitle = document.createElement('h5');
|
|
168
|
-
methodTitle.className = 'jux-blueprint-section-title';
|
|
169
|
-
methodTitle.textContent = `Method: ${structure.method}()`;
|
|
170
|
-
structSection.appendChild(methodTitle);
|
|
171
|
-
// Render hierarchy if available
|
|
172
|
-
if (structure.hierarchy && structure.hierarchy.length > 0) {
|
|
173
|
-
const hierarchyEl = this._renderHierarchy(structure.hierarchy);
|
|
174
|
-
structSection.appendChild(hierarchyEl);
|
|
175
|
-
}
|
|
176
|
-
body.appendChild(structSection);
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
card.appendChild(body);
|
|
180
|
-
}
|
|
181
|
-
return card;
|
|
182
|
-
}
|
|
183
|
-
/* ═════════════════════════════════════════════════════════════════
|
|
184
|
-
* REACTIVE UPDATE
|
|
185
|
-
* ═════════════════════════════════════════════════════════════════ */
|
|
186
|
-
update(prop, value) {
|
|
187
|
-
super.update(prop, value);
|
|
188
|
-
if (!this.container)
|
|
189
|
-
return;
|
|
190
|
-
const blueprint = this.container.querySelector(`#${this._id}`);
|
|
191
|
-
if (!blueprint)
|
|
192
|
-
return;
|
|
193
|
-
switch (prop) {
|
|
194
|
-
case 'structureData':
|
|
195
|
-
case 'classData':
|
|
196
|
-
case 'filter':
|
|
197
|
-
case 'showMethods':
|
|
198
|
-
case 'expandAll':
|
|
199
|
-
case 'expandedComponents':
|
|
200
|
-
this._rebuildContent();
|
|
201
|
-
break;
|
|
202
|
-
case 'theme':
|
|
203
|
-
blueprint.dataset.theme = value;
|
|
204
|
-
break;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
_rebuildContent() {
|
|
208
|
-
if (!this.container)
|
|
209
|
-
return;
|
|
210
|
-
const contentContainer = this.container.querySelector('.jux-blueprint-content');
|
|
211
|
-
if (!contentContainer)
|
|
212
|
-
return;
|
|
213
|
-
contentContainer.innerHTML = '';
|
|
214
|
-
const { classData, filter } = this.state;
|
|
215
|
-
if (!classData || !classData.components) {
|
|
216
|
-
const emptyEl = document.createElement('div');
|
|
217
|
-
emptyEl.className = 'jux-blueprint-empty';
|
|
218
|
-
emptyEl.textContent = 'No component data loaded. Use .structureData() and .classData() to load JSON files.';
|
|
219
|
-
contentContainer.appendChild(emptyEl);
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
// Filter components
|
|
223
|
-
const filteredComponents = classData.components.filter((comp) => {
|
|
224
|
-
if (!filter)
|
|
225
|
-
return true;
|
|
226
|
-
return comp.file.toLowerCase().includes(filter.toLowerCase());
|
|
227
|
-
});
|
|
228
|
-
// Render component cards
|
|
229
|
-
filteredComponents.forEach((component) => {
|
|
230
|
-
const card = this._renderComponentCard(component);
|
|
231
|
-
contentContainer.appendChild(card);
|
|
232
|
-
});
|
|
233
|
-
// Show count
|
|
234
|
-
const countEl = this.container.querySelector('.jux-blueprint-count');
|
|
235
|
-
if (countEl) {
|
|
236
|
-
countEl.textContent = `Showing ${filteredComponents.length} of ${classData.components.length} components`;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
/* ═════════════════════════════════════════════════════════════════
|
|
240
|
-
* RENDER
|
|
241
|
-
* ═════════════════════════════════════════════════════════════════ */
|
|
242
|
-
render(targetId) {
|
|
243
|
-
const container = this._setupContainer(targetId);
|
|
244
|
-
const { theme, style, class: className, classData } = this.state;
|
|
245
|
-
// Create wrapper
|
|
246
|
-
const wrapper = document.createElement('div');
|
|
247
|
-
wrapper.className = 'jux-blueprint';
|
|
248
|
-
wrapper.id = this._id;
|
|
249
|
-
wrapper.dataset.theme = theme;
|
|
250
|
-
if (className)
|
|
251
|
-
wrapper.className += ` ${className}`;
|
|
252
|
-
if (style)
|
|
253
|
-
wrapper.setAttribute('style', style);
|
|
254
|
-
// Header
|
|
255
|
-
const header = document.createElement('div');
|
|
256
|
-
header.className = 'jux-blueprint-header';
|
|
257
|
-
const title = document.createElement('h2');
|
|
258
|
-
title.className = 'jux-blueprint-title';
|
|
259
|
-
title.textContent = 'Component Blueprint';
|
|
260
|
-
header.appendChild(title);
|
|
261
|
-
// Stats
|
|
262
|
-
if (classData) {
|
|
263
|
-
const stats = document.createElement('div');
|
|
264
|
-
stats.className = 'jux-blueprint-stats';
|
|
265
|
-
stats.innerHTML = `
|
|
266
|
-
<span class="jux-blueprint-stat">
|
|
267
|
-
<strong>${classData.totalFiles || 0}</strong> Components
|
|
268
|
-
</span>
|
|
269
|
-
<span class="jux-blueprint-stat">
|
|
270
|
-
<strong>${classData.totalClasses || 0}</strong> Total Classes
|
|
271
|
-
</span>
|
|
272
|
-
`;
|
|
273
|
-
header.appendChild(stats);
|
|
274
|
-
}
|
|
275
|
-
wrapper.appendChild(header);
|
|
276
|
-
// Controls
|
|
277
|
-
const controls = document.createElement('div');
|
|
278
|
-
controls.className = 'jux-blueprint-controls';
|
|
279
|
-
// Filter input
|
|
280
|
-
const filterInput = document.createElement('input');
|
|
281
|
-
filterInput.type = 'text';
|
|
282
|
-
filterInput.className = 'jux-blueprint-filter';
|
|
283
|
-
filterInput.placeholder = 'Filter components...';
|
|
284
|
-
filterInput.value = this.state.filter;
|
|
285
|
-
filterInput.addEventListener('input', (e) => {
|
|
286
|
-
this.state.filter = e.target.value;
|
|
287
|
-
});
|
|
288
|
-
controls.appendChild(filterInput);
|
|
289
|
-
// Expand All toggle
|
|
290
|
-
const expandToggle = document.createElement('button');
|
|
291
|
-
expandToggle.className = 'jux-blueprint-button';
|
|
292
|
-
expandToggle.textContent = 'Expand All';
|
|
293
|
-
expandToggle.addEventListener('click', () => {
|
|
294
|
-
this.state.expandAll = !this.state.expandAll;
|
|
295
|
-
expandToggle.textContent = this.state.expandAll ? 'Collapse All' : 'Expand All';
|
|
296
|
-
});
|
|
297
|
-
controls.appendChild(expandToggle);
|
|
298
|
-
wrapper.appendChild(controls);
|
|
299
|
-
// Count
|
|
300
|
-
const count = document.createElement('div');
|
|
301
|
-
count.className = 'jux-blueprint-count';
|
|
302
|
-
count.textContent = classData ? `Showing ${classData.components.length} components` : 'No data loaded';
|
|
303
|
-
wrapper.appendChild(count);
|
|
304
|
-
// Content container
|
|
305
|
-
const content = document.createElement('div');
|
|
306
|
-
content.className = 'jux-blueprint-content';
|
|
307
|
-
if (classData && classData.components) {
|
|
308
|
-
classData.components.forEach((component) => {
|
|
309
|
-
const card = this._renderComponentCard(component);
|
|
310
|
-
content.appendChild(card);
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
else {
|
|
314
|
-
const emptyEl = document.createElement('div');
|
|
315
|
-
emptyEl.className = 'jux-blueprint-empty';
|
|
316
|
-
emptyEl.textContent = 'No component data loaded. Use .structureData() and .classData() to load JSON files.';
|
|
317
|
-
content.appendChild(emptyEl);
|
|
318
|
-
}
|
|
319
|
-
wrapper.appendChild(content);
|
|
320
|
-
this._wireStandardEvents(wrapper);
|
|
321
|
-
container.appendChild(wrapper);
|
|
322
|
-
return this;
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
export function blueprint(id, options = {}) {
|
|
326
|
-
return new Blueprint(id, options);
|
|
327
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { BaseComponent } from './base/BaseComponent.js';
|
|
2
|
-
export interface ButtonOptions {
|
|
3
|
-
label?: string;
|
|
4
|
-
icon?: string;
|
|
5
|
-
variant?: 'primary' | 'secondary' | 'danger' | 'success' | 'warning' | 'info' | 'link' | string;
|
|
6
|
-
size?: 'small' | 'medium' | 'large';
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
loading?: boolean;
|
|
9
|
-
iconPosition?: 'left' | 'right';
|
|
10
|
-
fullWidth?: boolean;
|
|
11
|
-
type?: 'button' | 'submit' | 'reset';
|
|
12
|
-
style?: string;
|
|
13
|
-
class?: string;
|
|
14
|
-
}
|
|
15
|
-
type ButtonState = {
|
|
16
|
-
label: string;
|
|
17
|
-
content: string;
|
|
18
|
-
icon: string;
|
|
19
|
-
variant: string;
|
|
20
|
-
size: string;
|
|
21
|
-
disabled: boolean;
|
|
22
|
-
loading: boolean;
|
|
23
|
-
iconPosition: string;
|
|
24
|
-
fullWidth: boolean;
|
|
25
|
-
type: 'button' | 'submit' | 'reset';
|
|
26
|
-
style: string;
|
|
27
|
-
class: string;
|
|
28
|
-
};
|
|
29
|
-
export declare class Button extends BaseComponent<ButtonState> {
|
|
30
|
-
private _buttonElement;
|
|
31
|
-
constructor(id: string, options?: ButtonOptions);
|
|
32
|
-
protected getTriggerEvents(): readonly string[];
|
|
33
|
-
protected getCallbackEvents(): readonly string[];
|
|
34
|
-
/**
|
|
35
|
-
* Set button label (plain text, auto-escaped)
|
|
36
|
-
* Clears any HTML content
|
|
37
|
-
*/
|
|
38
|
-
label(value: string): this;
|
|
39
|
-
/**
|
|
40
|
-
* Alias for label() - more semantic for buttons
|
|
41
|
-
*/
|
|
42
|
-
text(value: string): this;
|
|
43
|
-
/**
|
|
44
|
-
* Set button content as HTML (overrides label)
|
|
45
|
-
*/
|
|
46
|
-
content(value: string): this;
|
|
47
|
-
icon(value: string): this;
|
|
48
|
-
iconPosition(value: 'left' | 'right'): this;
|
|
49
|
-
fullWidth(value: boolean): this;
|
|
50
|
-
variant(value: string): this;
|
|
51
|
-
size(value: 'small' | 'medium' | 'large'): this;
|
|
52
|
-
/**
|
|
53
|
-
* Alias for content() - more semantic
|
|
54
|
-
*/
|
|
55
|
-
html(value: string): this;
|
|
56
|
-
/**
|
|
57
|
-
* Update button text/HTML based on priority
|
|
58
|
-
* Priority: content (HTML) > label (text) > loading state
|
|
59
|
-
*/
|
|
60
|
-
private _updateButtonText;
|
|
61
|
-
update(prop: string, value: any): void;
|
|
62
|
-
/**
|
|
63
|
-
* Override visible() to update the actual button element
|
|
64
|
-
*/
|
|
65
|
-
visible(value: boolean): this;
|
|
66
|
-
render(targetId?: string | HTMLElement | BaseComponent<any>): this;
|
|
67
|
-
}
|
|
68
|
-
export declare function button(id: string, options?: ButtonOptions): Button;
|
|
69
|
-
export {};
|
|
70
|
-
//# sourceMappingURL=button.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAQxD,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IAChG,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,qBAAa,MAAO,SAAQ,aAAa,CAAC,WAAW,CAAC;IACpD,OAAO,CAAC,cAAc,CAAkC;gBAE5C,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa;IAmB/C,SAAS,CAAC,gBAAgB,IAAI,SAAS,MAAM,EAAE;IAI/C,SAAS,CAAC,iBAAiB,IAAI,SAAS,MAAM,EAAE;IAQhD;;;OAGG;IACH,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAO1B;;OAEG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIzB;;OAEG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAM5B,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIzB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI;IAI3C,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAK/B,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK5B,IAAI,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,IAAI;IAO/C;;OAEG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIzB;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAgBzB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI;IAQtC;;OAEG;IACH,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAW7B,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,IAAI;CA4DnE;AAED,wBAAgB,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,MAAM,CAElE"}
|
package/lib/components/button.js
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import { BaseComponent } from './base/BaseComponent.js';
|
|
2
|
-
import { renderIcon } from './icons.js';
|
|
3
|
-
import { formatIdAsLabel } from '../utils/formatId.js'; // ✅ Import utility
|
|
4
|
-
// Event definitions
|
|
5
|
-
const TRIGGER_EVENTS = [];
|
|
6
|
-
const CALLBACK_EVENTS = ['click']; // ✅ Button fires click events
|
|
7
|
-
export class Button extends BaseComponent {
|
|
8
|
-
constructor(id, options) {
|
|
9
|
-
const opts = options || {};
|
|
10
|
-
super(id, {
|
|
11
|
-
label: opts.label ?? formatIdAsLabel(id), // ✅ Auto-generate label
|
|
12
|
-
content: '', // ✅ Empty by default
|
|
13
|
-
icon: opts.icon ?? '',
|
|
14
|
-
variant: opts.variant ?? 'primary',
|
|
15
|
-
size: opts.size ?? 'medium',
|
|
16
|
-
disabled: opts.disabled ?? false,
|
|
17
|
-
loading: opts.loading ?? false,
|
|
18
|
-
iconPosition: opts.iconPosition ?? 'left',
|
|
19
|
-
fullWidth: opts.fullWidth ?? false,
|
|
20
|
-
type: opts.type ?? 'button',
|
|
21
|
-
style: opts.style ?? '',
|
|
22
|
-
class: opts.class ?? ''
|
|
23
|
-
});
|
|
24
|
-
this._buttonElement = null;
|
|
25
|
-
}
|
|
26
|
-
getTriggerEvents() {
|
|
27
|
-
return TRIGGER_EVENTS;
|
|
28
|
-
}
|
|
29
|
-
getCallbackEvents() {
|
|
30
|
-
return CALLBACK_EVENTS;
|
|
31
|
-
}
|
|
32
|
-
/* ═════════════════════════════════════════════════════════════════
|
|
33
|
-
* FLUENT API - Priority: content > label > auto-generated
|
|
34
|
-
* ═════════════════════════════════════════════════════════════════ */
|
|
35
|
-
/**
|
|
36
|
-
* Set button label (plain text, auto-escaped)
|
|
37
|
-
* Clears any HTML content
|
|
38
|
-
*/
|
|
39
|
-
label(value) {
|
|
40
|
-
this.state.label = value;
|
|
41
|
-
this.state.content = ''; // ✅ Clear HTML content when label is set
|
|
42
|
-
this._updateButtonText();
|
|
43
|
-
return this;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Alias for label() - more semantic for buttons
|
|
47
|
-
*/
|
|
48
|
-
text(value) {
|
|
49
|
-
return this.label(value);
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Set button content as HTML (overrides label)
|
|
53
|
-
*/
|
|
54
|
-
content(value) {
|
|
55
|
-
this.state.content = value;
|
|
56
|
-
this._updateButtonText();
|
|
57
|
-
return this;
|
|
58
|
-
}
|
|
59
|
-
icon(value) {
|
|
60
|
-
this.state.icon = value;
|
|
61
|
-
return this;
|
|
62
|
-
}
|
|
63
|
-
iconPosition(value) {
|
|
64
|
-
this.state.iconPosition = value;
|
|
65
|
-
return this;
|
|
66
|
-
}
|
|
67
|
-
fullWidth(value) {
|
|
68
|
-
this.state.fullWidth = value;
|
|
69
|
-
return this;
|
|
70
|
-
}
|
|
71
|
-
variant(value) {
|
|
72
|
-
this.state.variant = value;
|
|
73
|
-
return this;
|
|
74
|
-
}
|
|
75
|
-
size(value) {
|
|
76
|
-
this.state.size = value;
|
|
77
|
-
return this;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Alias for content() - more semantic
|
|
81
|
-
*/
|
|
82
|
-
html(value) {
|
|
83
|
-
return this.content(value);
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Update button text/HTML based on priority
|
|
87
|
-
* Priority: content (HTML) > label (text) > loading state
|
|
88
|
-
*/
|
|
89
|
-
_updateButtonText() {
|
|
90
|
-
if (!this._buttonElement)
|
|
91
|
-
return;
|
|
92
|
-
const textEl = this._buttonElement.querySelector('span:not(.jux-button-icon)');
|
|
93
|
-
if (!textEl)
|
|
94
|
-
return;
|
|
95
|
-
// Priority 1: HTML content (if set)
|
|
96
|
-
if (this.state.content) {
|
|
97
|
-
textEl.innerHTML = this.state.content;
|
|
98
|
-
}
|
|
99
|
-
// Priority 2: Label text
|
|
100
|
-
else if (this.state.label) {
|
|
101
|
-
textEl.textContent = this.state.loading ? 'Loading...' : this.state.label;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
update(prop, value) {
|
|
105
|
-
// No reactive updates needed
|
|
106
|
-
}
|
|
107
|
-
/* ═════════════════════════════════════════════════════════════════
|
|
108
|
-
* RENDER
|
|
109
|
-
* ═════════════════════════════════════════════════════════════════ */
|
|
110
|
-
/**
|
|
111
|
-
* Override visible() to update the actual button element
|
|
112
|
-
*/
|
|
113
|
-
visible(value) {
|
|
114
|
-
this.state.visible = value;
|
|
115
|
-
// Update the button element directly, not the container
|
|
116
|
-
if (this._buttonElement) {
|
|
117
|
-
this._buttonElement.style.display = value ? '' : 'none';
|
|
118
|
-
}
|
|
119
|
-
return this;
|
|
120
|
-
}
|
|
121
|
-
render(targetId) {
|
|
122
|
-
const container = this._setupContainer(targetId);
|
|
123
|
-
const { content, icon, iconPosition, variant, size, style, class: className } = this.state;
|
|
124
|
-
const button = document.createElement('button');
|
|
125
|
-
// ✅ Base class + variant + size
|
|
126
|
-
button.className = 'jux-button';
|
|
127
|
-
if (variant && variant !== 'primary') {
|
|
128
|
-
button.className += ` jux-button-${variant}`;
|
|
129
|
-
}
|
|
130
|
-
if (size && size !== 'medium') {
|
|
131
|
-
button.className += ` jux-button-${size}`;
|
|
132
|
-
}
|
|
133
|
-
button.id = this._id;
|
|
134
|
-
// ✅ Add user classes
|
|
135
|
-
if (className)
|
|
136
|
-
button.className += ` ${className}`;
|
|
137
|
-
// ✅ Apply user style (no variant/size logic here)
|
|
138
|
-
if (style)
|
|
139
|
-
button.setAttribute('style', style);
|
|
140
|
-
if (icon && iconPosition === 'left') {
|
|
141
|
-
const iconEl = document.createElement('span');
|
|
142
|
-
iconEl.className = 'jux-button-icon';
|
|
143
|
-
iconEl.appendChild(renderIcon(icon));
|
|
144
|
-
button.appendChild(iconEl);
|
|
145
|
-
}
|
|
146
|
-
const textEl = document.createElement('span');
|
|
147
|
-
if (content) {
|
|
148
|
-
textEl.innerHTML = content;
|
|
149
|
-
}
|
|
150
|
-
else if (this.state.label) {
|
|
151
|
-
textEl.textContent = this.state.loading ? 'Loading...' : this.state.label;
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
154
|
-
// Fallback to auto-generated label from ID
|
|
155
|
-
textEl.textContent = this.state.loading ? 'Loading...' : formatIdAsLabel(this._id);
|
|
156
|
-
}
|
|
157
|
-
button.appendChild(textEl);
|
|
158
|
-
if (icon && iconPosition === 'right') {
|
|
159
|
-
const iconEl = document.createElement('span');
|
|
160
|
-
iconEl.className = 'jux-button-icon';
|
|
161
|
-
iconEl.appendChild(renderIcon(icon));
|
|
162
|
-
button.appendChild(iconEl);
|
|
163
|
-
}
|
|
164
|
-
button.addEventListener('click', (e) => {
|
|
165
|
-
if (!this.state.disabled && !this.state.loading) {
|
|
166
|
-
this._triggerCallback('click', e);
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
this._wireStandardEvents(button);
|
|
170
|
-
container.appendChild(button);
|
|
171
|
-
this._buttonElement = button;
|
|
172
|
-
return this;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
export function button(id, options) {
|
|
176
|
-
return new Button(id, options);
|
|
177
|
-
}
|