juxscript 1.1.240 → 1.1.244

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.
Files changed (297) hide show
  1. package/index.js +7 -137
  2. package/lib/components/dataframe.ts +0 -569
  3. package/lib/components/include.ts +229 -229
  4. package/lib/components/tag.ts +68 -0
  5. package/lib/styles/shadcn.css +17 -5
  6. package/lib/utils/idgen.ts +6 -0
  7. package/package.json +5 -6
  8. package/index.d.ts +0 -239
  9. package/index.d.ts.map +0 -1
  10. package/lib/components/alert.d.ts +0 -36
  11. package/lib/components/alert.d.ts.map +0 -1
  12. package/lib/components/alert.js +0 -172
  13. package/lib/components/alert.ts +0 -219
  14. package/lib/components/app.d.ts +0 -89
  15. package/lib/components/app.d.ts.map +0 -1
  16. package/lib/components/app.js +0 -175
  17. package/lib/components/app.ts +0 -247
  18. package/lib/components/badge.d.ts +0 -26
  19. package/lib/components/badge.d.ts.map +0 -1
  20. package/lib/components/badge.js +0 -91
  21. package/lib/components/badge.ts +0 -118
  22. package/lib/components/base/Animations.d.ts +0 -36
  23. package/lib/components/base/Animations.d.ts.map +0 -1
  24. package/lib/components/base/Animations.js +0 -70
  25. package/lib/components/base/Animations.ts +0 -112
  26. package/lib/components/base/BaseComponent.d.ts +0 -294
  27. package/lib/components/base/BaseComponent.d.ts.map +0 -1
  28. package/lib/components/base/BaseComponent.js +0 -735
  29. package/lib/components/base/BaseComponent.ts +0 -884
  30. package/lib/components/base/FormInput.d.ts +0 -77
  31. package/lib/components/base/FormInput.d.ts.map +0 -1
  32. package/lib/components/base/FormInput.js +0 -171
  33. package/lib/components/base/FormInput.ts +0 -237
  34. package/lib/components/blueprint.d.ts +0 -40
  35. package/lib/components/blueprint.d.ts.map +0 -1
  36. package/lib/components/blueprint.js +0 -327
  37. package/lib/components/button.d.ts +0 -70
  38. package/lib/components/button.d.ts.map +0 -1
  39. package/lib/components/button.js +0 -177
  40. package/lib/components/button.ts +0 -237
  41. package/lib/components/card.d.ts +0 -35
  42. package/lib/components/card.d.ts.map +0 -1
  43. package/lib/components/card.js +0 -130
  44. package/lib/components/card.ts +0 -177
  45. package/lib/components/chart.d.ts +0 -49
  46. package/lib/components/chart.d.ts.map +0 -1
  47. package/lib/components/chart.js +0 -205
  48. package/lib/components/chart.ts +0 -254
  49. package/lib/components/checkbox.d.ts +0 -33
  50. package/lib/components/checkbox.d.ts.map +0 -1
  51. package/lib/components/checkbox.js +0 -202
  52. package/lib/components/checkbox.ts +0 -260
  53. package/lib/components/code.d.ts +0 -52
  54. package/lib/components/code.d.ts.map +0 -1
  55. package/lib/components/code.js +0 -201
  56. package/lib/components/code.ts +0 -260
  57. package/lib/components/container.d.ts +0 -60
  58. package/lib/components/container.d.ts.map +0 -1
  59. package/lib/components/container.js +0 -195
  60. package/lib/components/container.ts +0 -259
  61. package/lib/components/data.d.ts +0 -36
  62. package/lib/components/data.d.ts.map +0 -1
  63. package/lib/components/data.js +0 -110
  64. package/lib/components/data.ts +0 -135
  65. package/lib/components/dataframe/DataFrameSource.d.ts +0 -118
  66. package/lib/components/dataframe/DataFrameSource.d.ts.map +0 -1
  67. package/lib/components/dataframe/DataFrameSource.js +0 -421
  68. package/lib/components/dataframe/DataFrameSource.ts +0 -532
  69. package/lib/components/dataframe/ImportSettingsModal.d.ts +0 -60
  70. package/lib/components/dataframe/ImportSettingsModal.d.ts.map +0 -1
  71. package/lib/components/dataframe/ImportSettingsModal.js +0 -442
  72. package/lib/components/dataframe/ImportSettingsModal.ts +0 -531
  73. package/lib/components/dataframe.d.ts +0 -110
  74. package/lib/components/dataframe.d.ts.map +0 -1
  75. package/lib/components/dataframe.js +0 -470
  76. package/lib/components/datepicker.d.ts +0 -40
  77. package/lib/components/datepicker.d.ts.map +0 -1
  78. package/lib/components/datepicker.js +0 -193
  79. package/lib/components/datepicker.ts +0 -251
  80. package/lib/components/dialog.d.ts +0 -39
  81. package/lib/components/dialog.d.ts.map +0 -1
  82. package/lib/components/dialog.js +0 -131
  83. package/lib/components/dialog.ts +0 -178
  84. package/lib/components/divider.d.ts +0 -31
  85. package/lib/components/divider.d.ts.map +0 -1
  86. package/lib/components/divider.js +0 -72
  87. package/lib/components/divider.ts +0 -104
  88. package/lib/components/dropdown-menu.d.ts +0 -42
  89. package/lib/components/dropdown-menu.d.ts.map +0 -1
  90. package/lib/components/dropdown-menu.js +0 -177
  91. package/lib/components/dropdown-menu.ts +0 -214
  92. package/lib/components/dropdown.d.ts +0 -41
  93. package/lib/components/dropdown.d.ts.map +0 -1
  94. package/lib/components/dropdown.js +0 -136
  95. package/lib/components/dropdown.ts +0 -188
  96. package/lib/components/element.d.ts +0 -51
  97. package/lib/components/element.d.ts.map +0 -1
  98. package/lib/components/element.js +0 -209
  99. package/lib/components/element.ts +0 -271
  100. package/lib/components/event-chain.d.ts +0 -9
  101. package/lib/components/event-chain.d.ts.map +0 -1
  102. package/lib/components/event-chain.js +0 -33
  103. package/lib/components/fileupload.d.ts +0 -98
  104. package/lib/components/fileupload.d.ts.map +0 -1
  105. package/lib/components/fileupload.js +0 -351
  106. package/lib/components/fileupload.ts +0 -449
  107. package/lib/components/grid.d.ts +0 -88
  108. package/lib/components/grid.d.ts.map +0 -1
  109. package/lib/components/grid.js +0 -208
  110. package/lib/components/grid.ts +0 -295
  111. package/lib/components/heading.d.ts +0 -25
  112. package/lib/components/heading.d.ts.map +0 -1
  113. package/lib/components/heading.js +0 -83
  114. package/lib/components/heading.ts +0 -113
  115. package/lib/components/helpers.d.ts +0 -9
  116. package/lib/components/helpers.d.ts.map +0 -1
  117. package/lib/components/helpers.js +0 -30
  118. package/lib/components/helpers.ts +0 -41
  119. package/lib/components/hero.d.ts +0 -60
  120. package/lib/components/hero.d.ts.map +0 -1
  121. package/lib/components/hero.js +0 -239
  122. package/lib/components/hero.ts +0 -302
  123. package/lib/components/history/StateHistory.d.ts +0 -91
  124. package/lib/components/history/StateHistory.d.ts.map +0 -1
  125. package/lib/components/history/StateHistory.js +0 -154
  126. package/lib/components/history/StateHistory.ts +0 -200
  127. package/lib/components/icon.d.ts +0 -36
  128. package/lib/components/icon.d.ts.map +0 -1
  129. package/lib/components/icon.js +0 -135
  130. package/lib/components/icon.ts +0 -182
  131. package/lib/components/icons.d.ts +0 -25
  132. package/lib/components/icons.d.ts.map +0 -1
  133. package/lib/components/icons.js +0 -440
  134. package/lib/components/icons.ts +0 -464
  135. package/lib/components/image.d.ts +0 -42
  136. package/lib/components/image.d.ts.map +0 -1
  137. package/lib/components/image.js +0 -204
  138. package/lib/components/image.ts +0 -260
  139. package/lib/components/include.d.ts +0 -86
  140. package/lib/components/include.d.ts.map +0 -1
  141. package/lib/components/include.js +0 -238
  142. package/lib/components/input.d.ts +0 -85
  143. package/lib/components/input.d.ts.map +0 -1
  144. package/lib/components/input.js +0 -362
  145. package/lib/components/input.ts +0 -473
  146. package/lib/components/layer.d.ts +0 -72
  147. package/lib/components/layer.d.ts.map +0 -1
  148. package/lib/components/layer.js +0 -219
  149. package/lib/components/layer.ts +0 -304
  150. package/lib/components/link.d.ts +0 -41
  151. package/lib/components/link.d.ts.map +0 -1
  152. package/lib/components/link.js +0 -216
  153. package/lib/components/link.ts +0 -268
  154. package/lib/components/list.d.ts +0 -83
  155. package/lib/components/list.d.ts.map +0 -1
  156. package/lib/components/list.js +0 -314
  157. package/lib/components/list.ts +0 -423
  158. package/lib/components/loading.d.ts +0 -25
  159. package/lib/components/loading.d.ts.map +0 -1
  160. package/lib/components/loading.js +0 -76
  161. package/lib/components/loading.ts +0 -104
  162. package/lib/components/menu.d.ts +0 -38
  163. package/lib/components/menu.d.ts.map +0 -1
  164. package/lib/components/menu.js +0 -205
  165. package/lib/components/menu.ts +0 -279
  166. package/lib/components/modal.d.ts +0 -97
  167. package/lib/components/modal.d.ts.map +0 -1
  168. package/lib/components/modal.js +0 -463
  169. package/lib/components/modal.ts +0 -576
  170. package/lib/components/nav.d.ts +0 -46
  171. package/lib/components/nav.d.ts.map +0 -1
  172. package/lib/components/nav.js +0 -193
  173. package/lib/components/nav.ts +0 -261
  174. package/lib/components/paragraph.d.ts +0 -30
  175. package/lib/components/paragraph.d.ts.map +0 -1
  176. package/lib/components/paragraph.js +0 -93
  177. package/lib/components/paragraph.ts +0 -123
  178. package/lib/components/pen.d.ts +0 -125
  179. package/lib/components/pen.d.ts.map +0 -1
  180. package/lib/components/pen.js +0 -443
  181. package/lib/components/pen.ts +0 -567
  182. package/lib/components/progress.d.ts +0 -40
  183. package/lib/components/progress.d.ts.map +0 -1
  184. package/lib/components/progress.js +0 -116
  185. package/lib/components/progress.ts +0 -163
  186. package/lib/components/radio.d.ts +0 -43
  187. package/lib/components/radio.d.ts.map +0 -1
  188. package/lib/components/radio.js +0 -226
  189. package/lib/components/radio.ts +0 -303
  190. package/lib/components/registry.d.ts +0 -34
  191. package/lib/components/registry.d.ts.map +0 -1
  192. package/lib/components/registry.js +0 -163
  193. package/lib/components/registry.ts +0 -193
  194. package/lib/components/req.d.ts +0 -155
  195. package/lib/components/req.d.ts.map +0 -1
  196. package/lib/components/req.js +0 -253
  197. package/lib/components/req.ts +0 -303
  198. package/lib/components/script.d.ts +0 -14
  199. package/lib/components/script.d.ts.map +0 -1
  200. package/lib/components/script.js +0 -33
  201. package/lib/components/script.ts +0 -41
  202. package/lib/components/select.d.ts +0 -42
  203. package/lib/components/select.d.ts.map +0 -1
  204. package/lib/components/select.js +0 -209
  205. package/lib/components/select.ts +0 -281
  206. package/lib/components/sidebar.d.ts +0 -59
  207. package/lib/components/sidebar.d.ts.map +0 -1
  208. package/lib/components/sidebar.js +0 -298
  209. package/lib/components/sidebar.ts +0 -395
  210. package/lib/components/stack/BaseStack.d.ts +0 -65
  211. package/lib/components/stack/BaseStack.d.ts.map +0 -1
  212. package/lib/components/stack/BaseStack.js +0 -274
  213. package/lib/components/stack/BaseStack.ts +0 -328
  214. package/lib/components/stack/HStack.d.ts +0 -18
  215. package/lib/components/stack/HStack.d.ts.map +0 -1
  216. package/lib/components/stack/HStack.js +0 -22
  217. package/lib/components/stack/HStack.ts +0 -25
  218. package/lib/components/stack/VStack.d.ts +0 -19
  219. package/lib/components/stack/VStack.d.ts.map +0 -1
  220. package/lib/components/stack/VStack.js +0 -23
  221. package/lib/components/stack/VStack.ts +0 -26
  222. package/lib/components/stack/ZStack.d.ts +0 -18
  223. package/lib/components/stack/ZStack.d.ts.map +0 -1
  224. package/lib/components/stack/ZStack.js +0 -22
  225. package/lib/components/stack/ZStack.ts +0 -25
  226. package/lib/components/style.d.ts +0 -14
  227. package/lib/components/style.d.ts.map +0 -1
  228. package/lib/components/style.js +0 -33
  229. package/lib/components/style.ts +0 -41
  230. package/lib/components/switch.d.ts +0 -34
  231. package/lib/components/switch.d.ts.map +0 -1
  232. package/lib/components/switch.js +0 -209
  233. package/lib/components/switch.ts +0 -272
  234. package/lib/components/table.d.ts +0 -137
  235. package/lib/components/table.d.ts.map +0 -1
  236. package/lib/components/table.js +0 -1019
  237. package/lib/components/table.ts +0 -1225
  238. package/lib/components/tabs.d.ts +0 -53
  239. package/lib/components/tabs.d.ts.map +0 -1
  240. package/lib/components/tabs.js +0 -275
  241. package/lib/components/tabs.ts +0 -349
  242. package/lib/components/theme-toggle.d.ts +0 -45
  243. package/lib/components/theme-toggle.d.ts.map +0 -1
  244. package/lib/components/theme-toggle.js +0 -218
  245. package/lib/components/theme-toggle.ts +0 -297
  246. package/lib/components/tooltip.d.ts +0 -31
  247. package/lib/components/tooltip.d.ts.map +0 -1
  248. package/lib/components/tooltip.js +0 -112
  249. package/lib/components/tooltip.ts +0 -148
  250. package/lib/components/watcher.d.ts +0 -195
  251. package/lib/components/watcher.d.ts.map +0 -1
  252. package/lib/components/watcher.js +0 -241
  253. package/lib/components/watcher.ts +0 -261
  254. package/lib/components/write.d.ts +0 -107
  255. package/lib/components/write.d.ts.map +0 -1
  256. package/lib/components/write.js +0 -222
  257. package/lib/components/write.ts +0 -272
  258. package/lib/data/DataPipeline.d.ts +0 -113
  259. package/lib/data/DataPipeline.d.ts.map +0 -1
  260. package/lib/data/DataPipeline.js +0 -359
  261. package/lib/data/DataPipeline.ts +0 -452
  262. package/lib/facades/dataframe.jux +0 -0
  263. package/lib/globals.d.ts +0 -21
  264. package/lib/reactivity/state.d.ts +0 -36
  265. package/lib/reactivity/state.d.ts.map +0 -1
  266. package/lib/reactivity/state.js +0 -67
  267. package/lib/reactivity/state.ts +0 -78
  268. package/lib/storage/DataFrame.d.ts +0 -284
  269. package/lib/storage/DataFrame.d.ts.map +0 -1
  270. package/lib/storage/DataFrame.js +0 -1022
  271. package/lib/storage/DataFrame.ts +0 -1195
  272. package/lib/storage/DataFrameSource.d.ts +0 -158
  273. package/lib/storage/DataFrameSource.d.ts.map +0 -1
  274. package/lib/storage/DataFrameSource.js +0 -409
  275. package/lib/storage/DataFrameSource.ts +0 -556
  276. package/lib/storage/FileStorage.d.ts +0 -53
  277. package/lib/storage/FileStorage.d.ts.map +0 -1
  278. package/lib/storage/FileStorage.js +0 -80
  279. package/lib/storage/FileStorage.ts +0 -95
  280. package/lib/storage/IndexedDBDriver.d.ts +0 -75
  281. package/lib/storage/IndexedDBDriver.d.ts.map +0 -1
  282. package/lib/storage/IndexedDBDriver.js +0 -177
  283. package/lib/storage/IndexedDBDriver.ts +0 -226
  284. package/lib/storage/TabularDriver.d.ts +0 -118
  285. package/lib/storage/TabularDriver.d.ts.map +0 -1
  286. package/lib/storage/TabularDriver.js +0 -731
  287. package/lib/storage/TabularDriver.ts +0 -874
  288. package/lib/utils/codeparser.d.ts +0 -29
  289. package/lib/utils/codeparser.d.ts.map +0 -1
  290. package/lib/utils/codeparser.js +0 -409
  291. package/lib/utils/fetch.d.ts +0 -176
  292. package/lib/utils/fetch.d.ts.map +0 -1
  293. package/lib/utils/fetch.js +0 -427
  294. package/lib/utils/formatId.d.ts +0 -16
  295. package/lib/utils/formatId.d.ts.map +0 -1
  296. package/lib/utils/formatId.js +0 -27
  297. package/lib/utils/path-resolver.js +0 -23
@@ -1,116 +0,0 @@
1
- import { BaseComponent } from './base/BaseComponent.js';
2
- // Event definitions
3
- const TRIGGER_EVENTS = [];
4
- const CALLBACK_EVENTS = [];
5
- export class Progress extends BaseComponent {
6
- constructor(id, options = {}) {
7
- super(id, {
8
- value: options.value ?? 0,
9
- max: options.max ?? 100,
10
- variant: options.variant ?? 'default',
11
- showPercentage: options.showPercentage ?? false,
12
- label: options.label ?? '',
13
- size: options.size ?? 'md',
14
- style: options.style ?? '',
15
- class: options.class ?? ''
16
- });
17
- this._bar = null;
18
- this._label = null;
19
- }
20
- getTriggerEvents() {
21
- return TRIGGER_EVENTS;
22
- }
23
- getCallbackEvents() {
24
- return CALLBACK_EVENTS;
25
- }
26
- /* ═════════════════════════════════════════════════════════════════
27
- * FLUENT API
28
- * ═════════════════════════════════════════════════════════════════ */
29
- value(val) {
30
- this.state.value = Math.max(0, Math.min(val, this.state.max));
31
- this._updateProgress();
32
- return this;
33
- }
34
- max(val) {
35
- this.state.max = val;
36
- this._updateProgress();
37
- return this;
38
- }
39
- variant(value) {
40
- this.state.variant = value;
41
- return this;
42
- }
43
- showPercentage(value) {
44
- this.state.showPercentage = value;
45
- return this;
46
- }
47
- label(value) {
48
- this.state.label = value;
49
- if (this._label) {
50
- this._label.textContent = value;
51
- }
52
- return this;
53
- }
54
- size(value) {
55
- this.state.size = value;
56
- return this;
57
- }
58
- _updateProgress() {
59
- if (this._bar) {
60
- const percentage = (this.state.value / this.state.max) * 100;
61
- this._bar.style.width = `${percentage}%`;
62
- if (this._label) {
63
- // Use custom label if set, otherwise show percentage
64
- this._label.textContent = this.state.label || `${Math.round(percentage)}%`;
65
- }
66
- }
67
- }
68
- /* ═════════════════════════════════════════════════════════════════
69
- * RENDER
70
- * ═════════════════════════════════════════════════════════════════ */
71
- render(targetId) {
72
- const container = this._setupContainer(targetId);
73
- const { value, max, variant, showPercentage, label, size, style, class: className } = this.state;
74
- const wrapper = document.createElement('div');
75
- wrapper.className = `jux-progress jux-progress-${size}`;
76
- wrapper.id = this._id;
77
- if (className)
78
- wrapper.className += ` ${className}`;
79
- if (style)
80
- wrapper.setAttribute('style', style);
81
- const track = document.createElement('div');
82
- track.className = 'jux-progress-track';
83
- const bar = document.createElement('div');
84
- bar.className = `jux-progress-bar jux-progress-bar-${variant}`;
85
- const percentage = (value / max) * 100;
86
- bar.style.width = `${percentage}%`;
87
- this._bar = bar;
88
- if (showPercentage || label) {
89
- const labelEl = document.createElement('span');
90
- labelEl.className = 'jux-progress-label';
91
- labelEl.textContent = label || `${Math.round(percentage)}%`;
92
- bar.appendChild(labelEl);
93
- this._label = labelEl;
94
- }
95
- track.appendChild(bar);
96
- wrapper.appendChild(track);
97
- this._wireStandardEvents(wrapper);
98
- // Wire sync for value
99
- this._syncBindings.forEach(({ property, stateObj, toState, toComponent }) => {
100
- if (property === 'value') {
101
- const transform = toComponent || ((v) => Number(v));
102
- stateObj.subscribe((val) => {
103
- this.value(transform(val));
104
- });
105
- }
106
- });
107
- container.appendChild(wrapper);
108
- return this;
109
- }
110
- update(prop, value) {
111
- // No reactive updates needed
112
- }
113
- }
114
- export function progress(id, options = {}) {
115
- return new Progress(id, options);
116
- }
@@ -1,163 +0,0 @@
1
- import { BaseComponent } from './base/BaseComponent.js';
2
-
3
- // Event definitions
4
- const TRIGGER_EVENTS = [] as const;
5
- const CALLBACK_EVENTS = [] as const;
6
-
7
- export interface ProgressOptions {
8
- value?: number;
9
- max?: number;
10
- variant?: 'default' | 'success' | 'warning' | 'error';
11
- showPercentage?: boolean;
12
- label?: string;
13
- size?: 'sm' | 'md' | 'lg';
14
- style?: string;
15
- class?: string;
16
- }
17
-
18
- type ProgressState = {
19
- value: number;
20
- max: number;
21
- variant: string;
22
- showPercentage: boolean;
23
- label: string;
24
- size: string;
25
- style: string;
26
- class: string;
27
- };
28
-
29
- export class Progress extends BaseComponent<ProgressState> {
30
- private _bar: HTMLElement | null = null;
31
- private _label: HTMLElement | null = null;
32
-
33
- constructor(id: string, options: ProgressOptions = {}) {
34
- super(id, {
35
- value: options.value ?? 0,
36
- max: options.max ?? 100,
37
- variant: options.variant ?? 'default',
38
- showPercentage: options.showPercentage ?? false,
39
- label: options.label ?? '',
40
- size: options.size ?? 'md',
41
- style: options.style ?? '',
42
- class: options.class ?? ''
43
- });
44
- }
45
-
46
- protected getTriggerEvents(): readonly string[] {
47
- return TRIGGER_EVENTS;
48
- }
49
-
50
- protected getCallbackEvents(): readonly string[] {
51
- return CALLBACK_EVENTS;
52
- }
53
-
54
- /* ═════════════════════════════════════════════════════════════════
55
- * FLUENT API
56
- * ═════════════════════════════════════════════════════════════════ */
57
-
58
- value(val: number): this {
59
- this.state.value = Math.max(0, Math.min(val, this.state.max));
60
- this._updateProgress();
61
- return this;
62
- }
63
-
64
- max(val: number): this {
65
- this.state.max = val;
66
- this._updateProgress();
67
- return this;
68
- }
69
-
70
- variant(value: 'default' | 'success' | 'warning' | 'error'): this {
71
- this.state.variant = value;
72
- return this;
73
- }
74
-
75
- showPercentage(value: boolean): this {
76
- this.state.showPercentage = value;
77
- return this;
78
- }
79
-
80
- label(value: string): this {
81
- this.state.label = value;
82
- if (this._label) {
83
- this._label.textContent = value;
84
- }
85
- return this;
86
- }
87
-
88
- size(value: 'sm' | 'md' | 'lg'): this {
89
- this.state.size = value;
90
- return this;
91
- }
92
-
93
- private _updateProgress(): void {
94
- if (this._bar) {
95
- const percentage = (this.state.value / this.state.max) * 100;
96
- this._bar.style.width = `${percentage}%`;
97
- if (this._label) {
98
- // Use custom label if set, otherwise show percentage
99
- this._label.textContent = this.state.label || `${Math.round(percentage)}%`;
100
- }
101
- }
102
- }
103
-
104
- /* ═════════════════════════════════════════════════════════════════
105
- * RENDER
106
- * ═════════════════════════════════════════════════════════════════ */
107
-
108
- render(targetId?: string | HTMLElement | BaseComponent<any>): this {
109
- const container = this._setupContainer(targetId);
110
-
111
- const { value, max, variant, showPercentage, label, size, style, class: className } = this.state;
112
-
113
- const wrapper = document.createElement('div');
114
- wrapper.className = `jux-progress jux-progress-${size}`;
115
- wrapper.id = this._id;
116
- if (className) wrapper.className += ` ${className}`;
117
- if (style) wrapper.setAttribute('style', style);
118
-
119
- const track = document.createElement('div');
120
- track.className = 'jux-progress-track';
121
-
122
- const bar = document.createElement('div');
123
- bar.className = `jux-progress-bar jux-progress-bar-${variant}`;
124
- const percentage = (value / max) * 100;
125
- bar.style.width = `${percentage}%`;
126
- this._bar = bar;
127
-
128
- if (showPercentage || label) {
129
- const labelEl = document.createElement('span');
130
- labelEl.className = 'jux-progress-label';
131
- labelEl.textContent = label || `${Math.round(percentage)}%`;
132
- bar.appendChild(labelEl);
133
- this._label = labelEl;
134
- }
135
-
136
- track.appendChild(bar);
137
- wrapper.appendChild(track);
138
-
139
- this._wireStandardEvents(wrapper);
140
-
141
- // Wire sync for value
142
- this._syncBindings.forEach(({ property, stateObj, toState, toComponent }) => {
143
- if (property === 'value') {
144
- const transform = toComponent || ((v: any) => Number(v));
145
- stateObj.subscribe((val: any) => {
146
- this.value(transform(val));
147
- });
148
- }
149
- });
150
-
151
- container.appendChild(wrapper);
152
-
153
- return this;
154
- }
155
-
156
- update(prop: string, value: any): void {
157
- // No reactive updates needed
158
- }
159
- }
160
-
161
- export function progress(id: string, options: ProgressOptions = {}): Progress {
162
- return new Progress(id, options);
163
- }
@@ -1,43 +0,0 @@
1
- import { BaseComponent, BaseState } from './base/BaseComponent.js';
2
- export interface RadioOption {
3
- label: string;
4
- value: string;
5
- disabled?: boolean;
6
- }
7
- export interface RadioOptions {
8
- options?: RadioOption[];
9
- value?: string;
10
- label?: string;
11
- required?: boolean;
12
- disabled?: boolean;
13
- name?: string;
14
- orientation?: 'vertical' | 'horizontal';
15
- style?: string;
16
- class?: string;
17
- onValidate?: (value: string) => boolean | string;
18
- }
19
- interface RadioState extends BaseState {
20
- options: RadioOption[];
21
- value: string;
22
- orientation: 'vertical' | 'horizontal';
23
- }
24
- export declare class Radio extends BaseComponent<RadioState> {
25
- private _radioInputs;
26
- constructor(id: string, options?: RadioOptions);
27
- protected getTriggerEvents(): readonly string[];
28
- protected getCallbackEvents(): readonly string[];
29
- options(value: RadioOption[]): this;
30
- value(value: string): this;
31
- addOption(option: RadioOption): this;
32
- orientation(value: 'vertical' | 'horizontal'): this;
33
- getValue(): string;
34
- setValue(value: string): this;
35
- validate(): boolean;
36
- isValid(): boolean;
37
- protected _validateValue(value: string): boolean | string;
38
- protected _buildInputElement(): HTMLElement;
39
- render(targetId?: string | HTMLElement | BaseComponent<any>): this;
40
- }
41
- export declare function radio(id: string, options?: RadioOptions): Radio;
42
- export {};
43
- //# sourceMappingURL=radio.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"radio.d.ts","sourceRoot":"","sources":["radio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAOnE,MAAM,WAAW,WAAW;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IACzB,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,GAAG,MAAM,CAAC;CACpD;AAED,UAAU,UAAW,SAAQ,SAAS;IAClC,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,UAAU,GAAG,YAAY,CAAC;CAC1C;AAED,qBAAa,KAAM,SAAQ,aAAa,CAAC,UAAU,CAAC;IAChD,OAAO,CAAC,YAAY,CAA0B;gBAElC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB;IAsBlD,SAAS,CAAC,gBAAgB,IAAI,SAAS,MAAM,EAAE;IAI/C,SAAS,CAAC,iBAAiB,IAAI,SAAS,MAAM,EAAE;IAehD,OAAO,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,IAAI;IAKnC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI1B,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IAKpC,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,YAAY,GAAG,IAAI;IASnD,QAAQ,IAAI,MAAM;IAIlB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAW7B,QAAQ,IAAI,OAAO;IAcnB,OAAO,IAAI,OAAO;IAKlB,SAAS,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM;IAsBzD,SAAS,CAAC,kBAAkB,IAAI,WAAW;IAW3C,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,IAAI;CAoIrE;AAED,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG,KAAK,CAEnE"}
@@ -1,226 +0,0 @@
1
- import { BaseComponent } from './base/BaseComponent.js';
2
- import { formatIdAsLabel } from '../utils/formatId.js'; // ✅ Import
3
- // Event definitions
4
- const TRIGGER_EVENTS = [];
5
- const CALLBACK_EVENTS = ['change'];
6
- export class Radio extends BaseComponent {
7
- constructor(id, options = {}) {
8
- super(id, {
9
- visible: true,
10
- disabled: options.disabled ?? false,
11
- loading: false,
12
- class: options.class ?? '',
13
- style: options.style ?? '',
14
- attributes: {},
15
- label: options.label ?? formatIdAsLabel(id), // ✅ Auto-generate
16
- required: options.required ?? false,
17
- name: options.name ?? id,
18
- errorMessage: undefined,
19
- options: options.options ?? [],
20
- value: options.value ?? '',
21
- orientation: options.orientation ?? 'vertical'
22
- });
23
- this._radioInputs = [];
24
- if (options.onValidate) {
25
- this._onValidate = options.onValidate;
26
- }
27
- }
28
- getTriggerEvents() {
29
- return TRIGGER_EVENTS;
30
- }
31
- getCallbackEvents() {
32
- return CALLBACK_EVENTS;
33
- }
34
- /* ═════════════════════════════════════════════════════════════════
35
- * FLUENT API
36
- * ═════════════════════════════════════════════════════════════════ */
37
- //BaseComponent:
38
- // - label(), required(), name(), onValidate()
39
- // - validate(), isValid()
40
- // - style(), class()
41
- // - bind(), sync(), renderTo()
42
- // - disabled(), enable(), disable()
43
- options(value) {
44
- this.state.options = value;
45
- return this;
46
- }
47
- value(value) {
48
- return this.setValue(value);
49
- }
50
- addOption(option) {
51
- this.state.options = [...this.state.options, option];
52
- return this;
53
- }
54
- orientation(value) {
55
- this.state.orientation = value;
56
- return this;
57
- }
58
- /* ═════════════════════════════════════════════════════════════════
59
- * FORM INPUT IMPLEMENTATION
60
- * ═════════════════════════════════════════════════════════════════ */
61
- getValue() {
62
- return this.state.value;
63
- }
64
- setValue(value) {
65
- this.state.value = value;
66
- // Update all radio inputs
67
- this._radioInputs.forEach(input => {
68
- input.checked = input.value === value;
69
- });
70
- return this;
71
- }
72
- validate() {
73
- this._hasBeenValidated = true;
74
- const value = this.getValue();
75
- const result = this._validateValue(value);
76
- if (result === true) {
77
- this._clearError();
78
- return true;
79
- }
80
- else {
81
- this._showError(result);
82
- return false;
83
- }
84
- }
85
- isValid() {
86
- const value = this.getValue();
87
- return this._validateValue(value) === true;
88
- }
89
- _validateValue(value) {
90
- const { required, options } = this.state;
91
- if (required && !value) {
92
- return 'Please select an option';
93
- }
94
- // Validate that value is one of the options
95
- if (value && !options.some(opt => opt.value === value)) {
96
- return 'Invalid option selected';
97
- }
98
- if (this._onValidate) {
99
- const result = this._onValidate(value);
100
- if (result !== true) {
101
- return result || 'Invalid value';
102
- }
103
- }
104
- return true;
105
- }
106
- _buildInputElement() {
107
- // Radio uses a container, not a single input
108
- const container = document.createElement('div');
109
- container.className = 'jux-radio-options';
110
- return container;
111
- }
112
- /* ═════════════════════════════════════════════════════════════════
113
- * RENDER
114
- * ═════════════════════════════════════════════════════════════════ */
115
- render(targetId) {
116
- const container = this._setupContainer(targetId);
117
- const { options, value, name, disabled, orientation, style, class: className } = this.state;
118
- // Build wrapper
119
- const wrapper = document.createElement('div');
120
- wrapper.className = 'jux-radio';
121
- wrapper.id = this._id;
122
- if (className)
123
- wrapper.className += ` ${className}`;
124
- if (style)
125
- wrapper.setAttribute('style', style);
126
- // Label
127
- if (this.state.label) {
128
- wrapper.appendChild(this._renderLabel());
129
- }
130
- // Radio options container
131
- const optionsContainer = document.createElement('div');
132
- optionsContainer.className = `jux-radio-options jux-radio-${orientation}`; // ✅ Add orientation class
133
- this._inputElement = optionsContainer;
134
- this._radioInputs = [];
135
- options.forEach((option, index) => {
136
- const radioWrapper = document.createElement('label');
137
- radioWrapper.className = 'jux-radio-option';
138
- const input = document.createElement('input');
139
- input.type = 'radio';
140
- input.className = 'jux-radio-input';
141
- input.id = `${this._id}-option-${index}`;
142
- input.name = name; // ✅ Non-null assertion (name is always set in constructor)
143
- input.value = option.value;
144
- input.checked = option.value === value;
145
- input.disabled = disabled || option.disabled || false;
146
- this._radioInputs.push(input);
147
- const radioMark = document.createElement('span');
148
- radioMark.className = 'jux-radio-mark';
149
- const labelText = document.createElement('span');
150
- labelText.className = 'jux-radio-label-text';
151
- labelText.textContent = option.label;
152
- radioWrapper.appendChild(input);
153
- radioWrapper.appendChild(radioMark);
154
- radioWrapper.appendChild(labelText);
155
- optionsContainer.appendChild(radioWrapper);
156
- });
157
- wrapper.appendChild(optionsContainer);
158
- // Error element
159
- wrapper.appendChild(this._renderError());
160
- // Wire events
161
- this._wireStandardEvents(wrapper);
162
- // Wire radio-specific sync
163
- const valueSync = this._syncBindings.find(b => b.property === 'value');
164
- if (valueSync) {
165
- const { stateObj, toState, toComponent } = valueSync;
166
- const transformToState = toState || ((v) => v);
167
- const transformToComponent = toComponent || ((v) => String(v));
168
- let isUpdating = false;
169
- // State → Component
170
- stateObj.subscribe((val) => {
171
- if (isUpdating)
172
- return;
173
- const transformed = transformToComponent(val);
174
- this.setValue(transformed);
175
- });
176
- // Component → State
177
- this._radioInputs.forEach(input => {
178
- input.addEventListener('change', () => {
179
- if (isUpdating)
180
- return;
181
- isUpdating = true;
182
- const selectedValue = input.value;
183
- this.state.value = selectedValue;
184
- this._clearError();
185
- const transformed = transformToState(selectedValue);
186
- stateObj.set(transformed);
187
- // 🎯 Fire the change callback event
188
- this._triggerCallback('change', selectedValue);
189
- setTimeout(() => { isUpdating = false; }, 0);
190
- });
191
- });
192
- }
193
- else {
194
- // Default behavior without sync
195
- this._radioInputs.forEach(input => {
196
- input.addEventListener('change', () => {
197
- this.state.value = input.value;
198
- this._clearError();
199
- // 🎯 Fire the change callback event
200
- this._triggerCallback('change', input.value);
201
- });
202
- });
203
- }
204
- // Always add blur validation
205
- this._radioInputs.forEach(input => {
206
- input.addEventListener('blur', () => {
207
- if (this._hasBeenValidated) {
208
- this.validate();
209
- }
210
- });
211
- });
212
- // Sync label changes
213
- const labelSync = this._syncBindings.find(b => b.property === 'label');
214
- if (labelSync) {
215
- const transform = labelSync.toComponent || ((v) => String(v));
216
- labelSync.stateObj.subscribe((val) => {
217
- this.label(transform(val));
218
- });
219
- }
220
- container.appendChild(wrapper);
221
- return this;
222
- }
223
- }
224
- export function radio(id, options = {}) {
225
- return new Radio(id, options);
226
- }