@tachui/core 0.7.1-alpha → 0.8.1-alpha

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 (286) hide show
  1. package/README.md +20 -2
  2. package/dist/bundles/assets.d.ts +19 -0
  3. package/dist/bundles/assets.d.ts.map +1 -0
  4. package/dist/bundles/common.d.ts +1 -1
  5. package/dist/bundles/common.d.ts.map +1 -1
  6. package/dist/bundles/context.d.ts +22 -0
  7. package/dist/bundles/context.d.ts.map +1 -0
  8. package/dist/bundles/minimal.d.ts +8 -18
  9. package/dist/bundles/minimal.d.ts.map +1 -1
  10. package/dist/bundles/production-minimal.d.ts +2 -16
  11. package/dist/bundles/production-minimal.d.ts.map +1 -1
  12. package/dist/common.js +405 -828
  13. package/dist/compiler/advanced-parser.d.ts.map +1 -1
  14. package/dist/compiler/codegen.d.ts.map +1 -1
  15. package/dist/compiler/index.js +6 -1387
  16. package/dist/compiler/parser.d.ts +1 -1
  17. package/dist/compiler/parser.d.ts.map +1 -1
  18. package/dist/compiler/plugin.d.ts.map +1 -1
  19. package/dist/compiler/types.d.ts +28 -0
  20. package/dist/compiler/types.d.ts.map +1 -1
  21. package/dist/component-XAzF1xqs.js +487 -0
  22. package/dist/component-base-x2XmHFjy.js +255 -0
  23. package/dist/components/index.d.ts +4 -38
  24. package/dist/components/index.d.ts.map +1 -1
  25. package/dist/components/index.js +7 -4167
  26. package/dist/components/wrapper.d.ts +5 -152
  27. package/dist/components/wrapper.d.ts.map +1 -1
  28. package/dist/concatenated-component-ByPl3_FF.js +2933 -0
  29. package/dist/constants/index.d.ts +1 -1
  30. package/dist/constants/layout.d.ts +47 -4
  31. package/dist/constants/layout.d.ts.map +1 -1
  32. package/dist/constants/layout.js +84 -0
  33. package/dist/css-classes/index.js +176 -0
  34. package/dist/{dom-bridge-Cx-s6Ihx.js → dom-bridge-CAa1N2zX.js} +28 -28
  35. package/dist/{effect-CytAc9em.js → effect-B9Knft0b.js} +3 -3
  36. package/dist/essential.js +397 -826
  37. package/dist/index-DEBd8cq7.js +1144 -0
  38. package/dist/index-DIvMCJQO.js +268 -0
  39. package/dist/index-vdsiw6gQ.js +777 -0
  40. package/dist/index.d.ts +9 -9
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +397 -826
  43. package/dist/minimal-prod.js +101 -155
  44. package/dist/minimal.js +118 -170
  45. package/dist/modifiers/background.d.ts +41 -11
  46. package/dist/modifiers/background.d.ts.map +1 -1
  47. package/dist/modifiers/base.d.ts +6 -33
  48. package/dist/modifiers/base.d.ts.map +1 -1
  49. package/dist/modifiers/base.js +487 -0
  50. package/dist/modifiers/builder.d.ts +103 -195
  51. package/dist/modifiers/builder.d.ts.map +1 -1
  52. package/dist/modifiers/builder.js +9 -0
  53. package/dist/modifiers/core.d.ts +9 -401
  54. package/dist/modifiers/core.d.ts.map +1 -1
  55. package/dist/modifiers/{utils.d.ts → factories.d.ts} +18 -5
  56. package/dist/modifiers/factories.d.ts.map +1 -0
  57. package/dist/modifiers/index.d.ts +8 -52
  58. package/dist/modifiers/index.d.ts.map +1 -1
  59. package/dist/modifiers/index.js +38 -0
  60. package/dist/modifiers/presets.d.ts +368 -0
  61. package/dist/modifiers/presets.d.ts.map +1 -0
  62. package/dist/modifiers/registry.js +10 -0
  63. package/dist/modifiers/types.d.ts +39 -211
  64. package/dist/modifiers/types.d.ts.map +1 -1
  65. package/dist/modifiers/types.js +4 -0
  66. package/dist/observed-object-Cos-FtjP.js +269 -0
  67. package/dist/performance-optimizer-stub-CtfXUwl4.js +38 -0
  68. package/dist/plugin-BCAdZXKq.js +1680 -0
  69. package/dist/plugins/index.d.ts +5 -6
  70. package/dist/plugins/index.d.ts.map +1 -1
  71. package/dist/plugins/index.js +147 -297
  72. package/dist/plugins/simplified-index.d.ts +5 -6
  73. package/dist/plugins/simplified-index.d.ts.map +1 -1
  74. package/dist/production-minimal-BY_gMc-l.js +2532 -0
  75. package/dist/reactive/index.js +96 -95
  76. package/dist/reactive/types.js +4 -0
  77. package/dist/runtime/concatenation-aria.d.ts +24 -0
  78. package/dist/runtime/concatenation-aria.d.ts.map +1 -0
  79. package/dist/runtime/concatenation-aria.js +53 -0
  80. package/dist/runtime/concatenation-full.d.ts +30 -0
  81. package/dist/runtime/concatenation-full.d.ts.map +1 -0
  82. package/dist/runtime/concatenation-full.js +77 -0
  83. package/dist/runtime/concatenation-minimal.d.ts +25 -0
  84. package/dist/runtime/concatenation-minimal.d.ts.map +1 -0
  85. package/dist/runtime/concatenation-minimal.js +40 -0
  86. package/dist/runtime/dom-bridge.js +5 -5
  87. package/dist/runtime/element-override.d.ts.map +1 -1
  88. package/dist/runtime/index.d.ts +0 -7
  89. package/dist/runtime/index.d.ts.map +1 -1
  90. package/dist/runtime/renderer.d.ts.map +1 -1
  91. package/dist/runtime/renderer.js +7 -8
  92. package/dist/runtime/semantic-role-manager.d.ts.map +1 -1
  93. package/dist/runtime/types.js +1 -0
  94. package/dist/{scheduler-7SvC3a21.js → scheduler-BKeqwrYE.js} +130 -130
  95. package/dist/validation/build-time-stub.d.ts +33 -0
  96. package/dist/validation/build-time-stub.d.ts.map +1 -0
  97. package/dist/validation/debug-tools-stub.d.ts +67 -0
  98. package/dist/validation/debug-tools-stub.d.ts.map +1 -0
  99. package/dist/validation/index.d.ts +23 -78
  100. package/dist/validation/index.d.ts.map +1 -1
  101. package/dist/validation/index.js +609 -6470
  102. package/dist/validation/lifecycle-validation.d.ts.map +1 -1
  103. package/dist/validation/performance-optimizer-stub.d.ts +50 -0
  104. package/dist/validation/performance-optimizer-stub.d.ts.map +1 -0
  105. package/dist/validation/plugin-registration.d.ts +5 -1
  106. package/dist/validation/plugin-registration.d.ts.map +1 -1
  107. package/dist/validation/production-bypass-core.d.ts +69 -0
  108. package/dist/validation/production-bypass-core.d.ts.map +1 -0
  109. package/package.json +61 -5
  110. package/dist/ScrollView-h-6wYMAm.js +0 -515
  111. package/dist/Spacer-BbteDQ9I.js +0 -5337
  112. package/dist/binding-CmdpowkI.js +0 -2276
  113. package/dist/components/BasicInput.d.ts +0 -116
  114. package/dist/components/BasicInput.d.ts.map +0 -1
  115. package/dist/components/Button.d.ts +0 -252
  116. package/dist/components/Button.d.ts.map +0 -1
  117. package/dist/components/Divider.d.ts +0 -141
  118. package/dist/components/Divider.d.ts.map +0 -1
  119. package/dist/components/EnhancedLink.d.ts +0 -365
  120. package/dist/components/EnhancedLink.d.ts.map +0 -1
  121. package/dist/components/Form.d.ts +0 -141
  122. package/dist/components/Form.d.ts.map +0 -1
  123. package/dist/components/Grid.d.ts +0 -698
  124. package/dist/components/Grid.d.ts.map +0 -1
  125. package/dist/components/GridResponsive.d.ts +0 -214
  126. package/dist/components/GridResponsive.d.ts.map +0 -1
  127. package/dist/components/Image.d.ts +0 -162
  128. package/dist/components/Image.d.ts.map +0 -1
  129. package/dist/components/List.d.ts +0 -287
  130. package/dist/components/List.d.ts.map +0 -1
  131. package/dist/components/Menu.d.ts +0 -159
  132. package/dist/components/Menu.d.ts.map +0 -1
  133. package/dist/components/Picker.d.ts +0 -153
  134. package/dist/components/Picker.d.ts.map +0 -1
  135. package/dist/components/ScrollView.d.ts +0 -222
  136. package/dist/components/ScrollView.d.ts.map +0 -1
  137. package/dist/components/Section.d.ts +0 -153
  138. package/dist/components/Section.d.ts.map +0 -1
  139. package/dist/components/Show.d.ts +0 -64
  140. package/dist/components/Show.d.ts.map +0 -1
  141. package/dist/components/Spacer.d.ts +0 -35
  142. package/dist/components/Spacer.d.ts.map +0 -1
  143. package/dist/components/Text.d.ts +0 -242
  144. package/dist/components/Text.d.ts.map +0 -1
  145. package/dist/components/Toggle.d.ts +0 -207
  146. package/dist/components/Toggle.d.ts.map +0 -1
  147. package/dist/concatenated-component-DPcl2TEO.js +0 -6779
  148. package/dist/context--zQFIImS.js +0 -283
  149. package/dist/debug/index.d.ts +0 -61
  150. package/dist/debug/index.d.ts.map +0 -1
  151. package/dist/debug.js +0 -178
  152. package/dist/developer-experience/enhanced-errors.d.ts +0 -128
  153. package/dist/developer-experience/enhanced-errors.d.ts.map +0 -1
  154. package/dist/developer-experience/enhanced-types.d.ts +0 -281
  155. package/dist/developer-experience/enhanced-types.d.ts.map +0 -1
  156. package/dist/developer-experience/index.d.ts +0 -44
  157. package/dist/developer-experience/index.d.ts.map +0 -1
  158. package/dist/index-Nfi2SBQh.js +0 -3268
  159. package/dist/modifiers/attributes.d.ts +0 -203
  160. package/dist/modifiers/attributes.d.ts.map +0 -1
  161. package/dist/modifiers/backdrop.d.ts +0 -59
  162. package/dist/modifiers/backdrop.d.ts.map +0 -1
  163. package/dist/modifiers/border.d.ts +0 -217
  164. package/dist/modifiers/border.d.ts.map +0 -1
  165. package/dist/modifiers/effects.d.ts +0 -159
  166. package/dist/modifiers/effects.d.ts.map +0 -1
  167. package/dist/modifiers/elements.d.ts +0 -240
  168. package/dist/modifiers/elements.d.ts.map +0 -1
  169. package/dist/modifiers/filters.d.ts +0 -275
  170. package/dist/modifiers/filters.d.ts.map +0 -1
  171. package/dist/modifiers/flexbox.d.ts +0 -82
  172. package/dist/modifiers/flexbox.d.ts.map +0 -1
  173. package/dist/modifiers/font.d.ts +0 -71
  174. package/dist/modifiers/font.d.ts.map +0 -1
  175. package/dist/modifiers/grid.d.ts +0 -92
  176. package/dist/modifiers/grid.d.ts.map +0 -1
  177. package/dist/modifiers/margin.d.ts +0 -128
  178. package/dist/modifiers/margin.d.ts.map +0 -1
  179. package/dist/modifiers/padding.d.ts +0 -204
  180. package/dist/modifiers/padding.d.ts.map +0 -1
  181. package/dist/modifiers/responsive/advanced-utilities.d.ts +0 -118
  182. package/dist/modifiers/responsive/advanced-utilities.d.ts.map +0 -1
  183. package/dist/modifiers/responsive/breakpoints.d.ts +0 -81
  184. package/dist/modifiers/responsive/breakpoints.d.ts.map +0 -1
  185. package/dist/modifiers/responsive/css-generator.d.ts +0 -100
  186. package/dist/modifiers/responsive/css-generator.d.ts.map +0 -1
  187. package/dist/modifiers/responsive/dev-tools.d.ts +0 -107
  188. package/dist/modifiers/responsive/dev-tools.d.ts.map +0 -1
  189. package/dist/modifiers/responsive/index.d.ts +0 -29
  190. package/dist/modifiers/responsive/index.d.ts.map +0 -1
  191. package/dist/modifiers/responsive/layout-patterns.d.ts +0 -230
  192. package/dist/modifiers/responsive/layout-patterns.d.ts.map +0 -1
  193. package/dist/modifiers/responsive/performance.d.ts +0 -130
  194. package/dist/modifiers/responsive/performance.d.ts.map +0 -1
  195. package/dist/modifiers/responsive/responsive-builder.d.ts +0 -133
  196. package/dist/modifiers/responsive/responsive-builder.d.ts.map +0 -1
  197. package/dist/modifiers/responsive/responsive-modifier.d.ts +0 -123
  198. package/dist/modifiers/responsive/responsive-modifier.d.ts.map +0 -1
  199. package/dist/modifiers/responsive/types.d.ts +0 -183
  200. package/dist/modifiers/responsive/types.d.ts.map +0 -1
  201. package/dist/modifiers/responsive/utilities.d.ts +0 -149
  202. package/dist/modifiers/responsive/utilities.d.ts.map +0 -1
  203. package/dist/modifiers/scroll.d.ts +0 -143
  204. package/dist/modifiers/scroll.d.ts.map +0 -1
  205. package/dist/modifiers/shadows.d.ts +0 -114
  206. package/dist/modifiers/shadows.d.ts.map +0 -1
  207. package/dist/modifiers/size.d.ts +0 -113
  208. package/dist/modifiers/size.d.ts.map +0 -1
  209. package/dist/modifiers/text.d.ts +0 -147
  210. package/dist/modifiers/text.d.ts.map +0 -1
  211. package/dist/modifiers/transformations.d.ts +0 -329
  212. package/dist/modifiers/transformations.d.ts.map +0 -1
  213. package/dist/modifiers/transitions.d.ts +0 -98
  214. package/dist/modifiers/transitions.d.ts.map +0 -1
  215. package/dist/modifiers/typography.d.ts +0 -192
  216. package/dist/modifiers/typography.d.ts.map +0 -1
  217. package/dist/modifiers/utility.d.ts +0 -69
  218. package/dist/modifiers/utility.d.ts.map +0 -1
  219. package/dist/modifiers/utils.d.ts.map +0 -1
  220. package/dist/plugins/simplified-error-handler.d.ts +0 -83
  221. package/dist/plugins/simplified-error-handler.d.ts.map +0 -1
  222. package/dist/runtime/dev-tools.d.ts +0 -240
  223. package/dist/runtime/dev-tools.d.ts.map +0 -1
  224. package/dist/runtime/development-warnings.d.ts +0 -42
  225. package/dist/runtime/development-warnings.d.ts.map +0 -1
  226. package/dist/runtime/error-boundary.d.ts +0 -302
  227. package/dist/runtime/error-boundary.d.ts.map +0 -1
  228. package/dist/runtime/error-recovery.d.ts +0 -267
  229. package/dist/runtime/error-recovery.d.ts.map +0 -1
  230. package/dist/runtime/error-reporting.d.ts +0 -287
  231. package/dist/runtime/error-reporting.d.ts.map +0 -1
  232. package/dist/runtime/error-utils.d.ts +0 -204
  233. package/dist/runtime/error-utils.d.ts.map +0 -1
  234. package/dist/runtime/performance.d.ts +0 -217
  235. package/dist/runtime/performance.d.ts.map +0 -1
  236. package/dist/sui-compat.d.ts +0 -110
  237. package/dist/sui-compat.d.ts.map +0 -1
  238. package/dist/validation/advanced-debugging.d.ts +0 -319
  239. package/dist/validation/advanced-debugging.d.ts.map +0 -1
  240. package/dist/validation/build-time/detection.d.ts +0 -32
  241. package/dist/validation/build-time/detection.d.ts.map +0 -1
  242. package/dist/validation/build-time/index.d.ts +0 -84
  243. package/dist/validation/build-time/index.d.ts.map +0 -1
  244. package/dist/validation/build-time/plugins.d.ts +0 -75
  245. package/dist/validation/build-time/plugins.d.ts.map +0 -1
  246. package/dist/validation/build-time/rules.d.ts +0 -73
  247. package/dist/validation/build-time/rules.d.ts.map +0 -1
  248. package/dist/validation/build-time/transformer.d.ts +0 -23
  249. package/dist/validation/build-time/transformer.d.ts.map +0 -1
  250. package/dist/validation/build-time/types.d.ts +0 -212
  251. package/dist/validation/build-time/types.d.ts.map +0 -1
  252. package/dist/validation/comprehensive.d.ts +0 -160
  253. package/dist/validation/comprehensive.d.ts.map +0 -1
  254. package/dist/validation/debug-tools.d.ts +0 -251
  255. package/dist/validation/debug-tools.d.ts.map +0 -1
  256. package/dist/validation/developer-experience.d.ts +0 -243
  257. package/dist/validation/developer-experience.d.ts.map +0 -1
  258. package/dist/validation/documentation-integration.d.ts +0 -269
  259. package/dist/validation/documentation-integration.d.ts.map +0 -1
  260. package/dist/validation/enhanced-runtime.d.ts +0 -279
  261. package/dist/validation/enhanced-runtime.d.ts.map +0 -1
  262. package/dist/validation/error-reporting.d.ts +0 -186
  263. package/dist/validation/error-reporting.d.ts.map +0 -1
  264. package/dist/validation/ide-integration.d.ts +0 -328
  265. package/dist/validation/ide-integration.d.ts.map +0 -1
  266. package/dist/validation/performance-optimizer.d.ts +0 -218
  267. package/dist/validation/performance-optimizer.d.ts.map +0 -1
  268. package/dist/validation/production-bypass.d.ts +0 -175
  269. package/dist/validation/production-bypass.d.ts.map +0 -1
  270. package/dist/validation/simple.d.ts +0 -111
  271. package/dist/validation/simple.d.ts.map +0 -1
  272. package/dist/viewport/adapters/web-adapter.d.ts +0 -227
  273. package/dist/viewport/adapters/web-adapter.d.ts.map +0 -1
  274. package/dist/viewport/components.d.ts +0 -131
  275. package/dist/viewport/components.d.ts.map +0 -1
  276. package/dist/viewport/environment.d.ts +0 -75
  277. package/dist/viewport/environment.d.ts.map +0 -1
  278. package/dist/viewport/index.d.ts +0 -138
  279. package/dist/viewport/index.d.ts.map +0 -1
  280. package/dist/viewport/index.js +0 -2085
  281. package/dist/viewport/platform-detection.d.ts +0 -59
  282. package/dist/viewport/platform-detection.d.ts.map +0 -1
  283. package/dist/viewport/types.d.ts +0 -301
  284. package/dist/viewport/types.d.ts.map +0 -1
  285. package/dist/viewport/viewport-manager.d.ts +0 -118
  286. package/dist/viewport/viewport-manager.d.ts.map +0 -1
@@ -1,4169 +1,9 @@
1
- import { b3 as ie, aX as le, aa as I, n as re, aW as ue, aN as he, aO as fe } from "../Spacer-BbteDQ9I.js";
2
- import { D as Lt, G as Mt, F as Ot, B as Tt, t as zt, s as Dt, u as Ft, a1 as Gt, a2 as Pt, a3 as Vt, a4 as _t, a5 as Ht, a6 as jt, H as Nt, a7 as Bt, v as Wt, y as Ut, x as qt, z as Yt, a8 as Xt, L as Kt, J as Qt, q as Zt, o as Jt, T as ei, U as ti, V as ii, W as si, Z as ni, $ as ri, a0 as oi, r as ai, a9 as li, ab as ci } from "../Spacer-BbteDQ9I.js";
3
- import { dg as me, dz as ge, d$ as se, bG as be, dR as d, dT as S, X as ye, dQ as Se } from "../concatenated-component-DPcl2TEO.js";
4
- import { a as $, i as f, b as xe, h as ve, q as Ce } from "../scheduler-7SvC3a21.js";
5
- import { r as we } from "../dom-bridge-Cx-s6Ihx.js";
6
- import { S as $e } from "../ScrollView-h-6wYMAm.js";
7
- import { D as pi, a as ui, b as hi, E as fi, c as mi, d as gi } from "../ScrollView-h-6wYMAm.js";
8
- import { c as D } from "../effect-CytAc9em.js";
9
- import "../context--zQFIImS.js";
10
- var Ie = Object.defineProperty, ke = (r, e, t) => e in r ? Ie(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, F = (r, e, t) => ke(r, typeof e != "symbol" ? e + "" : e, t);
11
- class Ee extends ge {
12
- constructor(e) {
13
- super({
14
- selector: e,
15
- mobileFirst: !0,
16
- optimizeOutput: !0,
17
- includeComments: !1,
18
- generateMinified: !0
19
- });
20
- }
21
- /**
22
- * Generate responsive grid CSS that integrates with tachUI's modifier system
23
- */
24
- generateGridCSS(e) {
25
- const t = {};
26
- return Object.entries(e).forEach(([i, s]) => {
27
- if (this.isResponsiveValue(s))
28
- Object.entries(s).forEach(([n, o]) => {
29
- t[n] || (t[n] = {});
30
- const a = this.mapGridPropertyToCSS(i, o);
31
- a && Object.assign(t[n], a);
32
- });
33
- else {
34
- t.base || (t.base = {});
35
- const n = this.mapGridPropertyToCSS(i, s);
36
- n && Object.assign(t.base, n);
37
- }
38
- }), this.generateResponsiveCSS(t);
39
- }
40
- /**
41
- * Map grid property names to CSS properties with appropriate value processing
42
- */
43
- mapGridPropertyToCSS(e, t) {
44
- switch (e) {
45
- case "columns":
46
- return { "grid-template-columns": this.generateGridColumns(t) };
47
- case "rows":
48
- return { "grid-template-rows": this.generateGridRows(t) };
49
- case "gap":
50
- return { gap: this.normalizeSpacing(t) };
51
- case "columnGap":
52
- return { "column-gap": this.normalizeSpacing(t) };
53
- case "rowGap":
54
- return { "row-gap": this.normalizeSpacing(t) };
55
- case "autoFlow":
56
- return { "grid-auto-flow": t };
57
- case "autoRows":
58
- return { "grid-auto-rows": t };
59
- case "autoColumns":
60
- return { "grid-auto-columns": t };
61
- case "templateAreas":
62
- return { "grid-template-areas": t };
63
- case "alignItems":
64
- return { "align-items": t };
65
- case "justifyItems":
66
- return { "justify-items": t };
67
- case "alignContent":
68
- return { "align-content": t };
69
- case "justifyContent":
70
- return { "justify-content": t };
71
- default:
72
- return null;
73
- }
74
- }
75
- /**
76
- * Generate CSS grid-template-columns from GridItem configurations
77
- */
78
- generateGridColumns(e) {
79
- return e.map((t) => {
80
- switch (t.type) {
81
- case "fixed":
82
- return `${t.size}px`;
83
- case "flexible":
84
- const i = t.minimum || 0, s = t.maximum ? `${t.maximum}px` : "1fr";
85
- return i > 0 ? `minmax(${i}px, ${s})` : "1fr";
86
- case "adaptive":
87
- const n = t.minimum, o = t.maximum ? `${t.maximum}px` : "1fr";
88
- return `minmax(${n}px, ${o})`;
89
- default:
90
- return "1fr";
91
- }
92
- }).join(" ");
93
- }
94
- /**
95
- * Generate CSS grid-template-rows from GridItem configurations
96
- */
97
- generateGridRows(e) {
98
- return this.generateGridColumns(e);
99
- }
100
- /**
101
- * Normalize spacing values to CSS
102
- */
103
- normalizeSpacing(e) {
104
- return typeof e == "number" ? `${e}px` : e;
105
- }
106
- /**
107
- * Check if a value is responsive (has breakpoint keys)
108
- */
109
- isResponsiveValue(e) {
110
- return e && typeof e == "object" && !Array.isArray(e) && Object.keys(e).some((t) => ["base", "sm", "md", "lg", "xl", "xxl"].includes(t));
111
- }
112
- }
113
- function ce(r) {
114
- return me((e) => {
115
- const t = `#${e}`;
116
- return T.getCachedCSS(r, t);
117
- });
118
- }
119
- class T {
120
- /**
121
- * Generate cache key from configuration
122
- */
123
- static generateCacheKey(e) {
124
- return JSON.stringify(e, (t, i) => typeof i == "function" ? "[Function]" : i);
125
- }
126
- /**
127
- * Get cached CSS or generate new if not cached
128
- */
129
- static getCachedCSS(e, t) {
130
- const i = this.generateCacheKey(e);
131
- if (this.cache.has(i)) {
132
- this.hitCount++;
133
- const a = this.cache.get(i);
134
- return {
135
- ...a,
136
- mediaQueries: a.mediaQueries.map((l) => ({
137
- ...l,
138
- selector: t
139
- }))
140
- };
141
- }
142
- this.missCount++;
143
- const n = new Ee(t).generateGridCSS(e), o = {
144
- ...n,
145
- mediaQueries: n.mediaQueries.map((a) => ({
146
- ...a,
147
- selector: ".cached-selector"
148
- // Placeholder selector for caching
149
- }))
150
- };
151
- if (this.cache.size >= this.maxCacheSize) {
152
- const a = this.cache.keys().next().value;
153
- a !== void 0 && this.cache.delete(a);
154
- }
155
- return this.cache.set(i, o), n;
156
- }
157
- /**
158
- * Get cache statistics for performance monitoring
159
- */
160
- static getStats() {
161
- return {
162
- cacheSize: this.cache.size,
163
- hitCount: this.hitCount,
164
- missCount: this.missCount,
165
- hitRate: this.hitCount / (this.hitCount + this.missCount) || 0
166
- };
167
- }
168
- /**
169
- * Clear cache (useful for testing or memory management)
170
- */
171
- static clearCache() {
172
- this.cache.clear(), this.hitCount = 0, this.missCount = 0;
173
- }
174
- }
175
- F(T, "cache", /* @__PURE__ */ new Map());
176
- F(T, "maxCacheSize", 100);
177
- F(T, "hitCount", 0);
178
- F(T, "missCount", 0);
179
- class de {
180
- /**
181
- * Convert legacy ResponsiveGridItemConfig to enhanced format
182
- */
183
- static convertLegacyConfig(e) {
184
- const t = {};
185
- return Object.entries(e).forEach(([i, s]) => {
186
- s && (t[i] = s);
187
- }), t;
188
- }
189
- /**
190
- * Create responsive grid configuration from simple column/row definitions
191
- */
192
- static createResponsiveGridConfig(e) {
193
- const t = {};
194
- if (e.columns && (this.isLegacyResponsiveGridConfig(e.columns) ? t.columns = this.convertLegacyConfig(e.columns) : t.columns = e.columns), e.rows && (this.isLegacyResponsiveGridConfig(e.rows) ? t.rows = this.convertLegacyConfig(e.rows) : t.rows = e.rows), e.spacing)
195
- if (this.isResponsiveValue(e.spacing)) {
196
- const i = {};
197
- Object.entries(e.spacing).forEach(([s, n]) => {
198
- i[s] = this.normalizeSpacing(n);
199
- }), t.gap = i;
200
- } else
201
- t.gap = { base: this.normalizeSpacing(e.spacing) };
202
- if (e.alignment)
203
- if (this.isResponsiveValue(e.alignment)) {
204
- const i = {}, s = {};
205
- Object.entries(e.alignment).forEach(([n, o]) => {
206
- const { alignItems: a, justifyItems: l } = this.convertAlignment(o);
207
- i[n] = a, s[n] = l;
208
- }), t.alignItems = i, t.justifyItems = s;
209
- } else {
210
- const { alignItems: i, justifyItems: s } = this.convertAlignment(e.alignment);
211
- t.alignItems = { base: i }, t.justifyItems = { base: s };
212
- }
213
- return t;
214
- }
215
- /**
216
- * Convert GridAlignment to CSS alignment properties
217
- */
218
- static convertAlignment(e) {
219
- const t = {
220
- topLeading: { alignItems: "start", justifyItems: "start" },
221
- top: { alignItems: "start", justifyItems: "center" },
222
- topTrailing: { alignItems: "start", justifyItems: "end" },
223
- leading: { alignItems: "center", justifyItems: "start" },
224
- center: { alignItems: "center", justifyItems: "center" },
225
- trailing: { alignItems: "center", justifyItems: "end" },
226
- bottomLeading: { alignItems: "end", justifyItems: "start" },
227
- bottom: { alignItems: "end", justifyItems: "center" },
228
- bottomTrailing: { alignItems: "end", justifyItems: "end" }
229
- };
230
- return t[e] || t.center;
231
- }
232
- /**
233
- * Normalize spacing values to CSS
234
- */
235
- static normalizeSpacing(e) {
236
- if (typeof e == "number")
237
- return `${e}px`;
238
- if (typeof e == "string")
239
- return e;
240
- if (e && typeof e == "object") {
241
- const t = e.horizontal ?? 0;
242
- return `${e.vertical ?? 0}px ${t}px`;
243
- }
244
- return "0";
245
- }
246
- /**
247
- * Check if value is a responsive value
248
- */
249
- static isResponsiveValue(e) {
250
- return e && typeof e == "object" && !Array.isArray(e) && Object.keys(e).some((t) => ["base", "sm", "md", "lg", "xl", "xxl"].includes(t));
251
- }
252
- /**
253
- * Check if value is legacy ResponsiveGridItemConfig
254
- */
255
- static isLegacyResponsiveGridConfig(e) {
256
- return e && typeof e == "object" && !Array.isArray(e) && Object.keys(e).some((t) => ["base", "sm", "md", "lg", "xl", "xxl"].includes(t)) && Object.values(e).every((t) => Array.isArray(t));
257
- }
258
- }
259
- class _ {
260
- /**
261
- * Enable/disable grid debugging
262
- */
263
- static setDebugMode(e) {
264
- this.debugMode = e, e && console.log("🔍 tachUI Grid debugging enabled");
265
- }
266
- /**
267
- * Register a grid instance for debugging
268
- */
269
- static registerGrid(e, t, i) {
270
- this.debugMode && (this.instances.set(e, {
271
- config: t,
272
- selector: i,
273
- timestamp: Date.now()
274
- }), console.group(`🏗️ Grid registered: ${e}`), console.log("Configuration:", t), console.log("Selector:", i), console.log("Cache stats:", T.getStats()), console.groupEnd());
275
- }
276
- /**
277
- * Log responsive grid performance metrics
278
- */
279
- static logPerformanceMetrics() {
280
- if (!this.debugMode) return;
281
- console.group("📊 Grid Performance Metrics");
282
- const e = T.getStats();
283
- console.log(`Cache efficiency: ${(e.hitRate * 100).toFixed(1)}%`), console.log(`Cache size: ${e.cacheSize}/100`), console.log(`Cache hits: ${e.hitCount}, misses: ${e.missCount}`), console.log(`Active grid instances: ${this.instances.size}`), console.groupEnd();
284
- }
285
- /**
286
- * Visualize breakpoint behavior in browser console
287
- */
288
- static visualizeBreakpoints(e) {
289
- this.debugMode && (console.group("📱 Responsive Grid Breakpoints"), e.columns && (console.log("Column configuration:"), Object.entries(e.columns).forEach(([t, i]) => {
290
- const s = Array.isArray(i) ? i.map((n) => `${n.type}(${n.size || n.minimum || "auto"})`).join(" ") : String(i || "auto");
291
- console.log(` ${t}: ${s}`);
292
- })), e.gap && (console.log("Gap configuration:"), Object.entries(e.gap).forEach(([t, i]) => {
293
- console.log(` ${t}: ${i}`);
294
- })), console.groupEnd());
295
- }
296
- /**
297
- * Get debugging information for all registered grids
298
- */
299
- static getDebugInfo() {
300
- return {
301
- debugMode: this.debugMode,
302
- instances: Array.from(this.instances.entries()).map(([e, t]) => ({
303
- id: e,
304
- ...t,
305
- age: Date.now() - t.timestamp
306
- })),
307
- cacheStats: T.getStats()
308
- };
309
- }
310
- /**
311
- * Clear debugging data
312
- */
313
- static clear() {
314
- this.instances.clear(), T.clearCache(), this.debugMode && console.log("🧹 Grid debugging data cleared");
315
- }
316
- }
317
- F(_, "debugMode", !1);
318
- F(_, "instances", /* @__PURE__ */ new Map());
319
- class J {
320
- /**
321
- * Enable performance monitoring
322
- */
323
- static enable() {
324
- this.enabled = !0, console.log("⏱️ Grid performance monitoring enabled");
325
- }
326
- /**
327
- * Disable performance monitoring
328
- */
329
- static disable() {
330
- this.enabled = !1;
331
- }
332
- /**
333
- * Start measuring a performance metric
334
- */
335
- static startMeasurement(e) {
336
- if (!this.enabled) return () => {
337
- };
338
- const t = performance.now();
339
- return () => {
340
- const i = performance.now() - t;
341
- this.measurements.has(e) || this.measurements.set(e, []), this.measurements.get(e).push(i), i > 10 && console.warn(`🐌 Slow grid operation: ${e} took ${i.toFixed(2)}ms`);
342
- };
343
- }
344
- /**
345
- * Get performance statistics
346
- */
347
- static getStats() {
348
- const e = {};
349
- for (const [t, i] of this.measurements) {
350
- const s = i.length, n = i.reduce((u, c) => u + c, 0), o = n / s, a = Math.min(...i), l = Math.max(...i);
351
- e[t] = {
352
- count: s,
353
- averageTime: Number(o.toFixed(2)),
354
- minTime: Number(a.toFixed(2)),
355
- maxTime: Number(l.toFixed(2)),
356
- totalTime: Number(n.toFixed(2))
357
- };
358
- }
359
- return e;
360
- }
361
- /**
362
- * Log performance report
363
- */
364
- static logReport() {
365
- if (!this.enabled) return;
366
- console.group("📈 Grid Performance Report");
367
- const e = this.getStats();
368
- for (const [t, i] of Object.entries(e))
369
- console.log(`${t}:`, i);
370
- console.groupEnd();
371
- }
372
- /**
373
- * Clear performance data
374
- */
375
- static clear() {
376
- this.measurements.clear(), this.enabled && console.log("🧹 Grid performance data cleared");
377
- }
378
- }
379
- F(J, "measurements", /* @__PURE__ */ new Map());
380
- F(J, "enabled", !1);
381
- var Ae = Object.defineProperty, Re = (r, e, t) => e in r ? Ae(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, v = (r, e, t) => Re(r, typeof e != "symbol" ? e + "" : e, t);
382
- let Y = null;
383
- const U = () => {
384
- if (!Y)
385
- try {
386
- Y = require("../debug").debugManager;
387
- } catch {
388
- Y = {
389
- isEnabled: () => !1,
390
- logComponent: () => {
391
- }
392
- };
393
- }
394
- return Y;
395
- };
396
- class at {
397
- /**
398
- * Fixed-size grid column/row
399
- */
400
- static fixed(e, t) {
401
- return {
402
- type: "fixed",
403
- size: e,
404
- spacing: t
405
- };
406
- }
407
- /**
408
- * Flexible grid column/row with optional constraints
409
- */
410
- static flexible(e = 0, t) {
411
- return {
412
- type: "flexible",
413
- minimum: e,
414
- maximum: t
415
- };
416
- }
417
- /**
418
- * Adaptive grid column/row with minimum size
419
- */
420
- static adaptive(e, t) {
421
- return {
422
- type: "adaptive",
423
- minimum: e,
424
- maximum: t
425
- };
426
- }
427
- /**
428
- * Create spanning configuration for grid items (Phase 3)
429
- */
430
- static spanning(e) {
431
- return e;
432
- }
433
- /**
434
- * Create enhanced grid item with spanning support (Phase 3)
435
- */
436
- static withSpan(e, t) {
437
- return {
438
- ...e,
439
- span: t
440
- };
441
- }
442
- }
443
- class y {
444
- /**
445
- * Generate CSS grid-template-columns from GridItem configurations
446
- */
447
- static generateColumns(e) {
448
- return e.map((t) => {
449
- switch (t.type) {
450
- case "fixed":
451
- return `${t.size}px`;
452
- case "flexible":
453
- const i = t.minimum || 0, s = t.maximum ? `${t.maximum}px` : "1fr";
454
- return i > 0 ? `minmax(${i}px, ${s})` : "1fr";
455
- case "adaptive":
456
- const n = t.minimum, o = t.maximum ? `${t.maximum}px` : "1fr";
457
- return `minmax(${n}px, ${o})`;
458
- default:
459
- return "1fr";
460
- }
461
- }).join(" ");
462
- }
463
- /**
464
- * Generate CSS grid-template-rows from GridItem configurations
465
- */
466
- static generateRows(e) {
467
- return this.generateColumns(e);
468
- }
469
- /**
470
- * Generate responsive CSS for grid layouts
471
- */
472
- static generateResponsiveGridCSS(e, t) {
473
- const i = {};
474
- return e.base && (i[t] = t === "grid-template-columns" ? this.generateColumns(e.base) : this.generateRows(e.base)), Object.entries({
475
- sm: "640px",
476
- md: "768px",
477
- lg: "1024px",
478
- xl: "1280px",
479
- xxl: "1536px"
480
- }).forEach(([n, o]) => {
481
- const a = e[n];
482
- if (a) {
483
- const l = `@media (min-width: ${o})`, u = t === "grid-template-columns" ? this.generateColumns(a) : this.generateRows(a);
484
- i[l] || (i[l] = {});
485
- const c = i[l];
486
- i[l] = {
487
- ...c,
488
- [t]: u
489
- };
490
- }
491
- }), i;
492
- }
493
- /**
494
- * Convert spacing configuration to CSS gap values
495
- */
496
- static generateSpacing(e) {
497
- if (typeof e == "number")
498
- return `${e}px`;
499
- if (e && typeof e == "object") {
500
- const t = e.horizontal ?? 0;
501
- return `${e.vertical ?? 0}px ${t}px`;
502
- }
503
- return "0";
504
- }
505
- /**
506
- * Convert GridAlignment to CSS grid alignment properties
507
- */
508
- static generateAlignment(e) {
509
- const t = {
510
- topLeading: { justifyItems: "start", alignItems: "start" },
511
- top: { justifyItems: "center", alignItems: "start" },
512
- topTrailing: { justifyItems: "end", alignItems: "start" },
513
- leading: { justifyItems: "start", alignItems: "center" },
514
- center: { justifyItems: "center", alignItems: "center" },
515
- trailing: { justifyItems: "end", alignItems: "center" },
516
- bottomLeading: { justifyItems: "start", alignItems: "end" },
517
- bottom: { justifyItems: "center", alignItems: "end" },
518
- bottomTrailing: { justifyItems: "end", alignItems: "end" }
519
- };
520
- return t[e] || t.center;
521
- }
522
- /**
523
- * Generate CSS for section header/footer styling (Phase 3)
524
- */
525
- static generateSectionHeaderCSS(e, t, i) {
526
- const s = {
527
- gridColumn: `1 / span ${i}`,
528
- display: "flex",
529
- alignItems: "center"
530
- };
531
- switch (e) {
532
- case "sticky":
533
- s.position = "sticky", s.top = t === "header" ? "0" : "auto", s.bottom = t === "footer" ? "0" : "auto", s.zIndex = "10", s.backgroundColor = "var(--background-color, white)";
534
- break;
535
- case "grouped":
536
- s.padding = "12px 16px", s.backgroundColor = "var(--section-bg, #f8f9fa)", s.borderRadius = t === "header" ? "8px 8px 0 0" : "0 0 8px 8px";
537
- break;
538
- case "plain":
539
- s.padding = "8px 0";
540
- break;
541
- case "automatic":
542
- default:
543
- s.padding = "12px 0", s.fontWeight = "600", s.fontSize = "1.1em", t === "footer" && (s.fontSize = "0.9em", s.fontWeight = "400", s.color = "var(--text-secondary, #6b7280)");
544
- break;
545
- }
546
- return s;
547
- }
548
- /**
549
- * Generate CSS animations for grid layout changes (Phase 3)
550
- */
551
- static generateGridAnimationCSS(e) {
552
- const t = {};
553
- if (e.layoutChanges) {
554
- const i = typeof e.layoutChanges == "boolean" ? {} : e.layoutChanges, s = i.duration || 300, n = i.easing || "ease-out", o = i.delay || 0;
555
- t.transition = `grid-template-columns ${s}ms ${n}${o > 0 ? ` ${o}ms` : ""}, grid-template-rows ${s}ms ${n}${o > 0 ? ` ${o}ms` : ""}`;
556
- }
557
- if (e.responsive) {
558
- const i = typeof e.responsive == "boolean" ? {} : e.responsive, s = i.duration || 250, n = i.easing || "ease-out", o = i.delay || 0, a = `grid-template-columns ${s}ms ${n}${o > 0 ? ` ${o}ms` : ""}, grid-template-rows ${s}ms ${n}${o > 0 ? ` ${o}ms` : ""}, gap ${s}ms ${n}${o > 0 ? ` ${o}ms` : ""}`;
559
- t.transition ? t.transition += `, ${a}` : t.transition = a;
560
- }
561
- return t;
562
- }
563
- /**
564
- * Generate item entrance/exit animation keyframes (Phase 3)
565
- */
566
- static generateItemAnimationKeyframes(e, t) {
567
- const i = `grid-item-${e}-${t}`;
568
- let s = "";
569
- switch (t) {
570
- case "fade":
571
- s = e === "enter" ? "from { opacity: 0; } to { opacity: 1; }" : "from { opacity: 1; } to { opacity: 0; }";
572
- break;
573
- case "scale":
574
- s = e === "enter" ? "from { opacity: 0; transform: scale(0.8); } to { opacity: 1; transform: scale(1); }" : "from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(0.8); }";
575
- break;
576
- case "slide-up":
577
- s = e === "enter" ? "from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); }" : "from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-20px); }";
578
- break;
579
- case "slide-down":
580
- s = e === "enter" ? "from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); }" : "from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(20px); }";
581
- break;
582
- case "slide-left":
583
- s = e === "enter" ? "from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); }" : "from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(-20px); }";
584
- break;
585
- case "slide-right":
586
- s = e === "enter" ? "from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); }" : "from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(20px); }";
587
- break;
588
- }
589
- return {
590
- [`@keyframes ${i}`]: `{ ${s} }`,
591
- [`--${i}-keyframes`]: i
592
- };
593
- }
594
- /**
595
- * Generate accessibility attributes for grid elements (Phase 3)
596
- */
597
- static generateAccessibilityAttributes(e, t, i, s) {
598
- const n = {}, o = t === "grid" ? "grid" : "group", a = e.role || o;
599
- if (n.role = a, e.label && (n["aria-label"] = e.label), e.description && (n["aria-describedby"] = e.description), e.screenReader !== !1) {
600
- const l = typeof e.screenReader == "boolean" ? {} : e.screenReader || {};
601
- l.announceStructure !== !1 && i !== void 0 && (n["aria-colcount"] = i), l.announceStructure !== !1 && s !== void 0 && (n["aria-rowcount"] = s);
602
- }
603
- if (e.keyboardNavigation !== !1) {
604
- const l = typeof e.keyboardNavigation == "boolean" ? {} : e.keyboardNavigation || {};
605
- l.enabled !== !1 && (n.tabIndex = 0, n["data-keyboard-navigation"] = l.mode || "grid", l.pageNavigation && (n["data-page-navigation"] = !0), l.homeEndNavigation && (n["data-home-end-navigation"] = !0));
606
- }
607
- if (e.focusManagement !== !1) {
608
- const l = typeof e.focusManagement == "boolean" ? {} : e.focusManagement || {};
609
- l.trapFocus && (n["data-focus-trap"] = !0), l.skipLinks && (n["data-skip-links"] = !0);
610
- }
611
- if (e.reducedMotion !== !1) {
612
- const l = typeof e.reducedMotion == "boolean" ? {} : e.reducedMotion || {};
613
- l.respectPreference !== !1 && (n["data-respect-reduced-motion"] = !0, n["data-reduced-motion-fallback"] = l.fallbackBehavior || "disable");
614
- }
615
- return n;
616
- }
617
- /**
618
- * Generate reduced motion CSS based on user preferences (Phase 3)
619
- */
620
- static generateReducedMotionCSS(e) {
621
- if (!e?.reducedMotion) return {};
622
- const i = (typeof e.reducedMotion == "boolean" ? {} : e.reducedMotion).fallbackBehavior || "disable", s = {};
623
- switch (i) {
624
- case "disable":
625
- s["@media (prefers-reduced-motion: reduce)"] = "{ transition: none !important; animation: none !important; }";
626
- break;
627
- case "reduce":
628
- s["@media (prefers-reduced-motion: reduce)"] = "{ transition-duration: 0.1s !important; animation-duration: 0.1s !important; }";
629
- break;
630
- case "instant":
631
- s["@media (prefers-reduced-motion: reduce)"] = "{ transition-duration: 0s !important; animation-duration: 0s !important; }";
632
- break;
633
- }
634
- return s;
635
- }
636
- /**
637
- * Generate advanced styling CSS for grid components (Phase 3)
638
- */
639
- static generateAdvancedStylingCSS(e) {
640
- const t = {};
641
- if (e.templateAreas && e.templateAreas.length > 0) {
642
- const i = e.templateAreas.map((s) => `"${s}"`).join(" ");
643
- t.gridTemplateAreas = i;
644
- }
645
- if (e.advancedGap && (e.advancedGap.row && (typeof e.advancedGap.row == "object" ? Object.entries(e.advancedGap.row).forEach(([i, s]) => {
646
- const n = this.getMediaQueryForBreakpoint(i);
647
- n && (t[n] = t[n] || "{}", t[n] = t[n].replace("}", ` row-gap: ${s}px; }`));
648
- }) : t.rowGap = typeof e.advancedGap.row == "number" ? `${e.advancedGap.row}px` : e.advancedGap.row), e.advancedGap.column && (typeof e.advancedGap.column == "object" ? Object.entries(e.advancedGap.column).forEach(([i, s]) => {
649
- const n = this.getMediaQueryForBreakpoint(i);
650
- n && (t[n] = t[n] || "{}", t[n] = t[n].replace("}", ` column-gap: ${s}px; }`));
651
- }) : t.columnGap = typeof e.advancedGap.column == "number" ? `${e.advancedGap.column}px` : e.advancedGap.column)), e.container) {
652
- if (e.container.background)
653
- if (typeof e.container.background == "string")
654
- t.background = e.container.background;
655
- else {
656
- const i = e.container.background;
657
- switch (i.pattern) {
658
- case "dots":
659
- t.background = `radial-gradient(circle, ${i.color || "#e0e0e0"} 1px, transparent 1px)`, t.backgroundSize = "20px 20px", i.opacity && (t.opacity = i.opacity.toString());
660
- break;
661
- case "lines":
662
- t.background = `linear-gradient(90deg, ${i.color || "#e0e0e0"} 1px, transparent 1px), linear-gradient(${i.color || "#e0e0e0"} 1px, transparent 1px)`, t.backgroundSize = "20px 20px";
663
- break;
664
- case "grid":
665
- t.background = `linear-gradient(to right, ${i.color || "#e0e0e0"} 1px, transparent 1px), linear-gradient(to bottom, ${i.color || "#e0e0e0"} 1px, transparent 1px)`, t.backgroundSize = "20px 20px";
666
- break;
667
- }
668
- }
669
- if (e.container.border && (t.border = e.container.border), e.container.borderRadius && (t.borderRadius = typeof e.container.borderRadius == "number" ? `${e.container.borderRadius}px` : e.container.borderRadius), e.container.boxShadow && (t.boxShadow = e.container.boxShadow), e.container.padding)
670
- if (typeof e.container.padding == "object") {
671
- const i = e.container.padding;
672
- t.padding = `${i.top || 0} ${i.right || 0} ${i.bottom || 0} ${i.left || 0}`;
673
- } else
674
- t.padding = typeof e.container.padding == "number" ? `${e.container.padding}px` : e.container.padding;
675
- }
676
- if (e.debug && (e.debug === !0 || e.debug.enabled)) {
677
- const i = typeof e.debug == "boolean" ? {} : e.debug, s = i.lineColor || "#ff0000";
678
- if (i.showLines !== !1) {
679
- const n = `linear-gradient(to right, ${s} 1px, transparent 1px), linear-gradient(to bottom, ${s} 1px, transparent 1px)`;
680
- t.background && !t.background.includes("linear-gradient") ? t.background = `${n}, ${t.background}` : t.background = n, t.backgroundSize = "var(--grid-debug-size, 20px) var(--grid-debug-size, 20px)";
681
- }
682
- i.showAreas && (t.position = "relative", t["&::after"] = `{ content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: repeating-linear-gradient(45deg, transparent, transparent 10px, ${s}22 10px, ${s}22 20px); pointer-events: none; }`);
683
- }
684
- return t;
685
- }
686
- /**
687
- * Generate item state CSS (hover, focus, active) (Phase 3)
688
- */
689
- static generateItemStateCSS(e) {
690
- const t = {};
691
- if (e.hover && e.hover.enabled !== !1) {
692
- const i = e.hover, s = [];
693
- switch (i.transform) {
694
- case "scale":
695
- s.push("transform: scale(1.05)");
696
- break;
697
- case "lift":
698
- s.push("transform: translateY(-2px)", "box-shadow: 0 4px 8px rgba(0,0,0,0.12)");
699
- break;
700
- case "glow":
701
- s.push("box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.4)");
702
- break;
703
- case "highlight":
704
- s.push("background-color: rgba(59, 130, 246, 0.1)");
705
- break;
706
- }
707
- i.transition ? s.push(`transition: ${i.transition}`) : s.push("transition: all 0.2s ease"), i.customCSS && Object.entries(i.customCSS).forEach(([n, o]) => {
708
- s.push(`${n}: ${o}`);
709
- }), t["& > *:hover"] = `{ ${s.join("; ")} }`;
710
- }
711
- if (e.focus && e.focus.enabled !== !1) {
712
- const i = e.focus, s = [];
713
- switch (i.style) {
714
- case "ring":
715
- s.push(`box-shadow: 0 0 0 2px ${i.color || "#3b82f6"}`);
716
- break;
717
- case "outline":
718
- s.push(`outline: 2px solid ${i.color || "#3b82f6"}`, "outline-offset: 2px");
719
- break;
720
- case "background":
721
- s.push(`background-color: ${i.color || "rgba(59, 130, 246, 0.1)"}`);
722
- break;
723
- case "border":
724
- s.push(`border: 2px solid ${i.color || "#3b82f6"}`);
725
- break;
726
- }
727
- i.customCSS && Object.entries(i.customCSS).forEach(([n, o]) => {
728
- s.push(`${n}: ${o}`);
729
- }), t["& > *:focus"] = `{ ${s.join("; ")} }`;
730
- }
731
- if (e.active && e.active.enabled !== !1) {
732
- const i = e.active, s = [];
733
- switch (i.transform) {
734
- case "scale":
735
- s.push("transform: scale(0.95)");
736
- break;
737
- case "inset":
738
- s.push("box-shadow: inset 0 2px 4px rgba(0,0,0,0.1)");
739
- break;
740
- case "darken":
741
- s.push("filter: brightness(0.9)");
742
- break;
743
- }
744
- i.customCSS && Object.entries(i.customCSS).forEach(([n, o]) => {
745
- s.push(`${n}: ${o}`);
746
- }), t["& > *:active"] = `{ ${s.join("; ")} }`;
747
- }
748
- return t;
749
- }
750
- /**
751
- * Get media query for breakpoint (helper function)
752
- */
753
- static getMediaQueryForBreakpoint(e) {
754
- return {
755
- sm: "@media (min-width: 640px)",
756
- md: "@media (min-width: 768px)",
757
- lg: "@media (min-width: 1024px)",
758
- xl: "@media (min-width: 1280px)",
759
- xxl: "@media (min-width: 1536px)"
760
- }[e] || null;
761
- }
762
- }
763
- class Z extends ie {
764
- constructor(e) {
765
- super(), this.props = e, v(this, "type", "component"), v(this, "id"), v(this, "mounted", !1), v(this, "cleanup", []), v(this, "effectiveTag"), v(this, "validationResult"), this.id = `grid-section-${e.type}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
766
- const t = `GridSection${e.type === "header" ? "Header" : "Footer"}`, i = se(t, "div", this.props.element);
767
- this.effectiveTag = i.tag, this.validationResult = i.validation;
768
- }
769
- render() {
770
- const { content: e, sectionId: t, type: i, style: s, debugLabel: n } = this.props, o = U();
771
- o.logComponent(`GRID_SECTION_${i.toUpperCase()}`, n);
772
- const a = [`tachui-grid-section-${i}`, ...o.isEnabled() ? ["tachui-debug"] : []], l = this.createClassString(this.props, a), c = y.generateSectionHeaderCSS(s, i, 12);
773
- let p;
774
- if (typeof e == "string")
775
- p = [{
776
- type: "element",
777
- tag: "span",
778
- props: {
779
- className: `tachui-grid-section-${i}-text`,
780
- children: [{ type: "text", text: e }]
781
- }
782
- }];
783
- else {
784
- const x = e.render();
785
- p = Array.isArray(x) ? x : [x];
786
- }
787
- return [{
788
- type: "element",
789
- tag: this.effectiveTag,
790
- props: {
791
- className: l,
792
- style: c,
793
- "data-section-id": t,
794
- "data-section-type": i,
795
- // Add debug attributes
796
- ...o.isEnabled() && {
797
- "data-tachui-component": `GridSection${i === "header" ? "Header" : "Footer"}`,
798
- ...n && { "data-tachui-label": n }
799
- }
800
- },
801
- children: p,
802
- // Add component metadata
803
- componentMetadata: {
804
- originalType: `GridSection${i === "header" ? "Header" : "Footer"}`,
805
- overriddenTo: this.effectiveTag !== "div" ? this.effectiveTag : void 0,
806
- validationResult: this.validationResult
807
- }
808
- }];
809
- }
810
- }
811
- class ne extends ie {
812
- constructor(e, t, i = []) {
813
- super(), this.props = e, this.gridType = t, this.children = i, v(this, "type", "component"), v(this, "id"), v(this, "mounted", !1), v(this, "cleanup", []), v(this, "effectiveTag"), v(this, "validationResult"), this.id = `${t}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
814
- const n = se(t === "grid" ? "Grid" : t === "lazy-vgrid" ? "LazyVGrid" : "LazyHGrid", "div", this.props.element);
815
- this.effectiveTag = n.tag, this.validationResult = n.validation, this.setupLifecycleHooks(), we(this);
816
- }
817
- /**
818
- * Generate animation styles for grid layout (Phase 3)
819
- */
820
- generateAnimationStyles(e) {
821
- return e ? y.generateGridAnimationCSS(e) : {};
822
- }
823
- /**
824
- * Apply item animations to child elements (Phase 3)
825
- */
826
- applyItemAnimations(e, t) {
827
- if (!t?.itemChanges) return e;
828
- const i = typeof t.itemChanges == "boolean" ? {} : t.itemChanges;
829
- if (i.enter) {
830
- const s = i.enter, n = s.duration || 250, o = s.easing || "ease-out", a = s.delay || 0;
831
- return e.map((l, u) => {
832
- if ("modifiers" in l && Array.isArray(l.modifiers)) {
833
- const c = a + u * 50, p = be("all", n, o, c);
834
- l.modifiers.push(p);
835
- }
836
- return l;
837
- });
838
- }
839
- return e;
840
- }
841
- /**
842
- * Generate accessibility attributes for grid (Phase 3)
843
- */
844
- generateAccessibilityAttributes(e, t, i) {
845
- return e ? y.generateAccessibilityAttributes(e, this.gridType, t, i) : {};
846
- }
847
- /**
848
- * Generate advanced styling CSS for grid (Phase 3)
849
- */
850
- generateStylingCSS(e) {
851
- if (!e) return {};
852
- const t = y.generateAdvancedStylingCSS(e);
853
- if (e.itemStates) {
854
- const i = y.generateItemStateCSS(e.itemStates);
855
- Object.assign(t, i);
856
- }
857
- return t;
858
- }
859
- /**
860
- * Handle keyboard navigation events (Phase 3)
861
- */
862
- setupKeyboardNavigation(e, t) {
863
- if (!t?.keyboardNavigation) return;
864
- const i = typeof t.keyboardNavigation == "boolean" ? {} : t.keyboardNavigation;
865
- if (i.enabled === !1) return;
866
- const s = i.mode || "grid", n = (o) => {
867
- const a = o.target;
868
- if (!e.contains(a)) return;
869
- let l = !1;
870
- switch (o.key) {
871
- case "ArrowUp":
872
- s === "grid" && (this.navigateGrid(e, "up"), l = !0);
873
- break;
874
- case "ArrowDown":
875
- s === "grid" ? (this.navigateGrid(e, "down"), l = !0) : s === "list" && (this.navigateList(e, "next"), l = !0);
876
- break;
877
- case "ArrowLeft":
878
- this.navigateGrid(e, "left"), l = !0;
879
- break;
880
- case "ArrowRight":
881
- this.navigateGrid(e, "right"), l = !0;
882
- break;
883
- case "Home":
884
- i.homeEndNavigation && (this.navigateToFirst(e), l = !0);
885
- break;
886
- case "End":
887
- i.homeEndNavigation && (this.navigateToLast(e), l = !0);
888
- break;
889
- case "PageUp":
890
- i.pageNavigation && (this.navigatePage(e, "up"), l = !0);
891
- break;
892
- case "PageDown":
893
- i.pageNavigation && (this.navigatePage(e, "down"), l = !0);
894
- break;
895
- }
896
- l && (o.preventDefault(), o.stopPropagation());
897
- };
898
- e.addEventListener("keydown", n), this.cleanup.push(() => {
899
- e.removeEventListener("keydown", n);
900
- });
901
- }
902
- /**
903
- * Navigate within grid structure (Phase 3)
904
- */
905
- navigateGrid(e, t) {
906
- const i = e.querySelectorAll('[tabindex="0"], button, input, select, textarea, [contenteditable]'), s = Array.from(i).indexOf(document.activeElement);
907
- if (s === -1) return;
908
- const o = getComputedStyle(e).gridTemplateColumns.split(" ").length;
909
- let a = s;
910
- switch (t) {
911
- case "up":
912
- a = Math.max(0, s - o);
913
- break;
914
- case "down":
915
- a = Math.min(i.length - 1, s + o);
916
- break;
917
- case "left":
918
- a = Math.max(0, s - 1);
919
- break;
920
- case "right":
921
- a = Math.min(i.length - 1, s + 1);
922
- break;
923
- }
924
- a !== s && i[a].focus();
925
- }
926
- /**
927
- * Navigate in list mode (Phase 3)
928
- */
929
- navigateList(e, t) {
930
- const i = e.querySelectorAll('[tabindex="0"], button, input, select, textarea, [contenteditable]'), s = Array.from(i).indexOf(document.activeElement);
931
- if (s === -1) return;
932
- const n = t === "next" ? Math.min(i.length - 1, s + 1) : Math.max(0, s - 1);
933
- n !== s && i[n].focus();
934
- }
935
- /**
936
- * Navigate to first/last elements (Phase 3)
937
- */
938
- navigateToFirst(e) {
939
- const t = e.querySelectorAll('[tabindex="0"], button, input, select, textarea, [contenteditable]');
940
- t.length > 0 && t[0].focus();
941
- }
942
- navigateToLast(e) {
943
- const t = e.querySelectorAll('[tabindex="0"], button, input, select, textarea, [contenteditable]');
944
- t.length > 0 && t[t.length - 1].focus();
945
- }
946
- /**
947
- * Navigate by page (Phase 3)
948
- */
949
- navigatePage(e, t) {
950
- const i = e.querySelectorAll('[tabindex="0"], button, input, select, textarea, [contenteditable]'), s = Array.from(i).indexOf(document.activeElement);
951
- if (s === -1) return;
952
- const n = 10, o = t === "down" ? Math.min(i.length - 1, s + n) : Math.max(0, s - n);
953
- o !== s && i[o].focus();
954
- }
955
- setupLifecycleHooks() {
956
- le(this, {
957
- onDOMReady: (e, t) => {
958
- this.children.forEach((i, s) => {
959
- const n = i._enhancedLifecycle;
960
- if (n && n.onDOMReady && !i.domReady)
961
- try {
962
- if (t) {
963
- const o = this.findChildDOMElements(i, t, s);
964
- if (o.length > 0) {
965
- i.domElements = /* @__PURE__ */ new Map(), o.forEach((l, u) => {
966
- const c = l.id || `element-${u}`;
967
- i.domElements.set(c, l), i.primaryElement || (i.primaryElement = l);
968
- }), i.domReady = !0;
969
- const a = n.onDOMReady(
970
- i.domElements,
971
- i.primaryElement
972
- );
973
- if (typeof a == "function" && (i.cleanup = i.cleanup || [], i.cleanup.push(a)), n.onMount) {
974
- const l = n.onMount();
975
- typeof l == "function" && (i.cleanup = i.cleanup || [], i.cleanup.push(l));
976
- }
977
- }
978
- }
979
- } catch (o) {
980
- console.error(`Error processing lifecycle hooks for child ${i.id}:`, o);
981
- }
982
- });
983
- }
984
- });
985
- }
986
- /**
987
- * Find DOM elements for child components (reusing pattern from LayoutComponent)
988
- */
989
- findChildDOMElements(e, t, i) {
990
- if (e.id.startsWith("image-")) {
991
- const n = t.querySelectorAll("img.tachui-image");
992
- return n[i] ? [n[i]] : Array.from(n);
993
- }
994
- if (e.id.startsWith("button-")) {
995
- const n = t.querySelectorAll("button.tachui-button");
996
- return n[i] ? [n[i]] : Array.from(n);
997
- }
998
- if (e.id.startsWith("text-")) {
999
- const n = t.querySelectorAll("span.tachui-text, .tachui-text");
1000
- return n[i] ? [n[i]] : Array.from(n);
1001
- }
1002
- const s = Array.from(t.children);
1003
- return s[i] ? [s[i]] : s;
1004
- }
1005
- render() {
1006
- throw new Error("BaseGridComponent.render() must be implemented by subclass");
1007
- }
1008
- }
1009
- class Le extends ne {
1010
- constructor(e, t = []) {
1011
- super(e, "grid", t), this.props = e;
1012
- }
1013
- render() {
1014
- const { alignment: e = "center", spacing: t, debugLabel: i, animations: s, accessibility: n, styling: o } = this.props, a = U();
1015
- a.logComponent("GRID", i);
1016
- const l = ["tachui-grid", ...a.isEnabled() ? ["tachui-debug"] : []], u = this.createClassString(this.props, l), p = this.applyItemAnimations(this.children, s).map((N) => {
1017
- const G = N.render();
1018
- return Array.isArray(G) ? G : [G];
1019
- }).flat(), h = y.generateAlignment(e), x = y.generateSpacing(t), k = this.generateAnimationStyles(s), C = this.generateAccessibilityAttributes(n), m = y.generateReducedMotionCSS(n), H = this.generateStylingCSS(o), j = {
1020
- display: "grid",
1021
- gap: x,
1022
- ...h,
1023
- ...k,
1024
- ...m,
1025
- ...H
1026
- };
1027
- return [{
1028
- type: "element",
1029
- tag: this.effectiveTag,
1030
- props: {
1031
- className: u,
1032
- style: j,
1033
- ...C,
1034
- // Add debug attributes
1035
- ...a.isEnabled() && {
1036
- "data-tachui-component": "Grid",
1037
- ...i && { "data-tachui-label": i }
1038
- }
1039
- },
1040
- children: p,
1041
- // Add component metadata for semantic role processing
1042
- componentMetadata: {
1043
- originalType: "Grid",
1044
- overriddenTo: this.effectiveTag !== "div" ? this.effectiveTag : void 0,
1045
- validationResult: this.validationResult
1046
- }
1047
- }];
1048
- }
1049
- }
1050
- class Me extends ie {
1051
- constructor(e, t = []) {
1052
- super(), this.props = e, this.children = t, v(this, "type", "component"), v(this, "id"), v(this, "mounted", !1), v(this, "cleanup", []), v(this, "effectiveTag"), v(this, "validationResult"), this.id = `gridrow-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
1053
- const i = se("GridRow", "div", this.props.element);
1054
- this.effectiveTag = i.tag, this.validationResult = i.validation;
1055
- }
1056
- render() {
1057
- const { debugLabel: e } = this.props, t = U();
1058
- t.logComponent("GRIDROW", e);
1059
- const i = ["tachui-gridrow", ...t.isEnabled() ? ["tachui-debug"] : []], s = this.createClassString(this.props, i), n = this.children.map((a) => {
1060
- const l = a.render();
1061
- return Array.isArray(l) ? l : [l];
1062
- }).flat();
1063
- return [{
1064
- type: "element",
1065
- tag: this.effectiveTag,
1066
- props: {
1067
- className: s,
1068
- style: {
1069
- display: "contents"
1070
- // GridRow acts as a transparent container within CSS Grid
1071
- },
1072
- // Add debug attributes
1073
- ...t.isEnabled() && {
1074
- "data-tachui-component": "GridRow",
1075
- ...e && { "data-tachui-label": e }
1076
- }
1077
- },
1078
- children: n,
1079
- // Add component metadata
1080
- componentMetadata: {
1081
- originalType: "GridRow",
1082
- overriddenTo: this.effectiveTag !== "div" ? this.effectiveTag : void 0,
1083
- validationResult: this.validationResult
1084
- }
1085
- }];
1086
- }
1087
- }
1088
- class Oe extends ne {
1089
- constructor(e, t = []) {
1090
- super(e, "lazy-vgrid", t), this.props = e;
1091
- }
1092
- render() {
1093
- const { columns: e, alignment: t = "center", spacing: i, debugLabel: s, responsive: n, sections: o, pinnedViews: a, animations: l, accessibility: u, styling: c } = this.props, p = U();
1094
- p.logComponent("LAZYVGRID", s);
1095
- const h = ["tachui-lazy-vgrid", ...p.isEnabled() ? ["tachui-debug"] : []], x = this.createClassString(this.props, h);
1096
- let k;
1097
- o && o.length > 0 ? k = this.renderSections(o, a) : k = this.applyItemAnimations(this.children, l).map((L) => {
1098
- const g = L.render();
1099
- return Array.isArray(g) ? g : [g];
1100
- }).flat();
1101
- let C, m = {
1102
- display: "grid"
1103
- };
1104
- if (n) {
1105
- const R = J.startMeasurement("responsive-css-generation");
1106
- try {
1107
- const g = { ...de.createResponsiveGridConfig({
1108
- columns: e,
1109
- spacing: i,
1110
- alignment: t
1111
- }), ...n };
1112
- _.registerGrid(this.id, g, `#${this.id}`), _.visualizeBreakpoints(g);
1113
- const M = ce(g);
1114
- g.columns && typeof g.columns == "object" && "base" in g.columns && g.columns.base ? C = this.generateColumnsFromConfig(g.columns.base) : Array.isArray(e) ? C = y.generateColumns(e) : C = "1fr", m._responsiveModifier = M;
1115
- } finally {
1116
- R();
1117
- }
1118
- } else {
1119
- const R = y.generateAlignment(t), L = y.generateSpacing(i);
1120
- if (Array.isArray(e))
1121
- C = y.generateColumns(e);
1122
- else {
1123
- const M = y.generateResponsiveGridCSS(e, "grid-template-columns")["grid-template-columns"];
1124
- C = typeof M == "string" ? M : "1fr";
1125
- }
1126
- m = {
1127
- ...m,
1128
- gap: L,
1129
- ...R
1130
- };
1131
- }
1132
- m.gridTemplateColumns = C;
1133
- const H = this.generateAnimationStyles(l);
1134
- Object.assign(m, H);
1135
- const j = this.getColumnCount(), q = this.generateAccessibilityAttributes(u, j), N = y.generateReducedMotionCSS(u);
1136
- Object.assign(m, N);
1137
- const G = this.generateStylingCSS(c);
1138
- Object.assign(m, G);
1139
- const ee = {
1140
- type: "element",
1141
- tag: this.effectiveTag,
1142
- props: {
1143
- className: x,
1144
- style: m,
1145
- ...q,
1146
- // Add debug attributes
1147
- ...p.isEnabled() && {
1148
- "data-tachui-component": "LazyVGrid",
1149
- ...s && { "data-tachui-label": s }
1150
- }
1151
- },
1152
- children: k,
1153
- // Add component metadata
1154
- componentMetadata: {
1155
- originalType: "LazyVGrid",
1156
- overriddenTo: this.effectiveTag !== "div" ? this.effectiveTag : void 0,
1157
- validationResult: this.validationResult,
1158
- // Phase 2: Include responsive modifier for processing
1159
- ...n && m._responsiveModifier && {
1160
- responsiveModifier: m._responsiveModifier
1161
- }
1162
- }
1163
- };
1164
- return m._responsiveModifier && delete m._responsiveModifier, [ee];
1165
- }
1166
- /**
1167
- * Render sectioned data with headers and footers (Phase 3)
1168
- */
1169
- renderSections(e, t) {
1170
- const i = [], s = this.getColumnCount(), n = t?.includes("sectionHeaders"), o = t?.includes("sectionFooters");
1171
- return e.forEach((a) => {
1172
- if (a.header) {
1173
- const l = a.headerStyle || (n ? "sticky" : "automatic"), c = new Z({
1174
- content: a.header,
1175
- sectionId: a.id,
1176
- type: "header",
1177
- style: l
1178
- }).render();
1179
- Array.isArray(c) && (c.forEach((p) => {
1180
- p.props && p.props.style && (p.props.style.gridColumn = `1 / span ${s}`);
1181
- }), i.push(...c));
1182
- }
1183
- if (a.items.forEach((l) => {
1184
- const u = l.render(), c = Array.isArray(u) ? u : [u];
1185
- i.push(...c);
1186
- }), a.footer) {
1187
- const l = a.footerStyle || (o ? "sticky" : "automatic"), c = new Z({
1188
- content: a.footer,
1189
- sectionId: a.id,
1190
- type: "footer",
1191
- style: l
1192
- }).render();
1193
- Array.isArray(c) && (c.forEach((p) => {
1194
- p.props && p.props.style && (p.props.style.gridColumn = `1 / span ${s}`);
1195
- }), i.push(...c));
1196
- }
1197
- }), i;
1198
- }
1199
- /**
1200
- * Get the number of columns in the grid (Phase 3 helper)
1201
- */
1202
- getColumnCount() {
1203
- const { columns: e } = this.props;
1204
- if (Array.isArray(e))
1205
- return e.length;
1206
- if (typeof e == "object" && e !== null) {
1207
- const t = e, i = t.base || t.sm || t.md || t.lg || t.xl || t.xxl;
1208
- return Array.isArray(i) ? i.length : 1;
1209
- }
1210
- return 1;
1211
- }
1212
- /**
1213
- * Generate columns from GridItemConfig array (Phase 2 helper)
1214
- */
1215
- generateColumnsFromConfig(e) {
1216
- return e.map((t) => {
1217
- switch (t.type) {
1218
- case "fixed":
1219
- return `${t.size}px`;
1220
- case "flexible":
1221
- const i = t.minimum || 0, s = t.maximum ? `${t.maximum}px` : "1fr";
1222
- return i > 0 ? `minmax(${i}px, ${s})` : "1fr";
1223
- case "adaptive":
1224
- const n = t.minimum, o = t.maximum ? `${t.maximum}px` : "1fr";
1225
- return `minmax(${n}px, ${o})`;
1226
- default:
1227
- return "1fr";
1228
- }
1229
- }).join(" ");
1230
- }
1231
- }
1232
- class Te extends ne {
1233
- constructor(e, t = []) {
1234
- super(e, "lazy-hgrid", t), this.props = e;
1235
- }
1236
- render() {
1237
- const { rows: e, alignment: t = "center", spacing: i, debugLabel: s, responsive: n, sections: o, pinnedViews: a, animations: l, accessibility: u, styling: c } = this.props, p = U();
1238
- p.logComponent("LAZYHGRID", s);
1239
- const h = ["tachui-lazy-hgrid", ...p.isEnabled() ? ["tachui-debug"] : []], x = this.createClassString(this.props, h);
1240
- let k;
1241
- o && o.length > 0 ? k = this.renderSections(o, a) : k = this.applyItemAnimations(this.children, l).map((L) => {
1242
- const g = L.render();
1243
- return Array.isArray(g) ? g : [g];
1244
- }).flat();
1245
- let C, m = {
1246
- display: "grid",
1247
- gridAutoFlow: "column",
1248
- // Horizontal flow for LazyHGrid
1249
- overflowX: "auto"
1250
- // Enable horizontal scrolling
1251
- };
1252
- if (n) {
1253
- const R = J.startMeasurement("responsive-css-generation");
1254
- try {
1255
- const g = { ...de.createResponsiveGridConfig({
1256
- rows: e,
1257
- spacing: i,
1258
- alignment: t
1259
- }), ...n };
1260
- _.registerGrid(this.id, g, `#${this.id}`), _.visualizeBreakpoints(g);
1261
- const M = ce(g);
1262
- g.rows && typeof g.rows == "object" && "base" in g.rows && g.rows.base ? C = this.generateRowsFromConfig(g.rows.base) : Array.isArray(e) ? C = y.generateRows(e) : C = "auto", m._responsiveModifier = M;
1263
- } finally {
1264
- R();
1265
- }
1266
- } else {
1267
- const R = y.generateAlignment(t), L = y.generateSpacing(i);
1268
- if (Array.isArray(e))
1269
- C = y.generateRows(e);
1270
- else {
1271
- const M = y.generateResponsiveGridCSS(e, "grid-template-rows")["grid-template-rows"];
1272
- C = typeof M == "string" ? M : "auto";
1273
- }
1274
- m = {
1275
- ...m,
1276
- gap: L,
1277
- ...R
1278
- };
1279
- }
1280
- m.gridTemplateRows = C;
1281
- const H = this.generateAnimationStyles(l);
1282
- Object.assign(m, H);
1283
- const j = this.getRowCount(), q = this.generateAccessibilityAttributes(u, void 0, j), N = y.generateReducedMotionCSS(u);
1284
- Object.assign(m, N);
1285
- const G = this.generateStylingCSS(c);
1286
- Object.assign(m, G);
1287
- const ee = {
1288
- type: "element",
1289
- tag: this.effectiveTag,
1290
- props: {
1291
- className: x,
1292
- style: m,
1293
- ...q,
1294
- // Add debug attributes
1295
- ...p.isEnabled() && {
1296
- "data-tachui-component": "LazyHGrid",
1297
- ...s && { "data-tachui-label": s }
1298
- }
1299
- },
1300
- children: k,
1301
- // Add component metadata
1302
- componentMetadata: {
1303
- originalType: "LazyHGrid",
1304
- overriddenTo: this.effectiveTag !== "div" ? this.effectiveTag : void 0,
1305
- validationResult: this.validationResult,
1306
- // Phase 2: Include responsive modifier for processing
1307
- ...n && m._responsiveModifier && {
1308
- responsiveModifier: m._responsiveModifier
1309
- }
1310
- }
1311
- };
1312
- return m._responsiveModifier && delete m._responsiveModifier, [ee];
1313
- }
1314
- /**
1315
- * Render sectioned data with headers and footers (Phase 3)
1316
- */
1317
- renderSections(e, t) {
1318
- const i = [], s = this.getRowCount(), n = t?.includes("sectionHeaders"), o = t?.includes("sectionFooters");
1319
- return e.forEach((a) => {
1320
- if (a.header) {
1321
- const l = a.headerStyle || (n ? "sticky" : "automatic"), c = new Z({
1322
- content: a.header,
1323
- sectionId: a.id,
1324
- type: "header",
1325
- style: l
1326
- }).render();
1327
- Array.isArray(c) && (c.forEach((p) => {
1328
- p.props && p.props.style && (p.props.style.gridRow = `1 / span ${s}`, p.props.style.gridColumn = "auto");
1329
- }), i.push(...c));
1330
- }
1331
- if (a.items.forEach((l) => {
1332
- const u = l.render(), c = Array.isArray(u) ? u : [u];
1333
- i.push(...c);
1334
- }), a.footer) {
1335
- const l = a.footerStyle || (o ? "sticky" : "automatic"), c = new Z({
1336
- content: a.footer,
1337
- sectionId: a.id,
1338
- type: "footer",
1339
- style: l
1340
- }).render();
1341
- Array.isArray(c) && (c.forEach((p) => {
1342
- p.props && p.props.style && (p.props.style.gridRow = `1 / span ${s}`, p.props.style.gridColumn = "auto");
1343
- }), i.push(...c));
1344
- }
1345
- }), i;
1346
- }
1347
- /**
1348
- * Get the number of rows in the grid (Phase 3 helper)
1349
- */
1350
- getRowCount() {
1351
- const { rows: e } = this.props;
1352
- if (Array.isArray(e))
1353
- return e.length;
1354
- if (typeof e == "object" && e !== null) {
1355
- const t = e, i = t.base || t.sm || t.md || t.lg || t.xl || t.xxl;
1356
- return Array.isArray(i) ? i.length : 1;
1357
- }
1358
- return 1;
1359
- }
1360
- /**
1361
- * Generate rows from GridItemConfig array (Phase 2 helper)
1362
- */
1363
- generateRowsFromConfig(e) {
1364
- return e.map((t) => {
1365
- switch (t.type) {
1366
- case "fixed":
1367
- return `${t.size}px`;
1368
- case "flexible":
1369
- const i = t.minimum || 0, s = t.maximum ? `${t.maximum}px` : "1fr";
1370
- return i > 0 ? `minmax(${i}px, ${s})` : "1fr";
1371
- case "adaptive":
1372
- const n = t.minimum, o = t.maximum ? `${t.maximum}px` : "1fr";
1373
- return `minmax(${n}px, ${o})`;
1374
- default:
1375
- return "auto";
1376
- }
1377
- }).join(" ");
1378
- }
1379
- }
1380
- function lt(r = {}) {
1381
- const { children: e = [], ...t } = r, i = new Le(t, e);
1382
- return I(i);
1383
- }
1384
- function ct(r = [], e = {}) {
1385
- const t = { ...e, children: r }, i = new Me(t, r);
1386
- return I(i);
1387
- }
1388
- function dt(r) {
1389
- const { children: e = [], ...t } = r, i = new Oe({ ...t, children: e }, e);
1390
- return I(i);
1391
- }
1392
- function pt(r) {
1393
- const { children: e = [], ...t } = r, i = new Te({ ...t, children: e }, e);
1394
- return I(i);
1395
- }
1396
- var ze = Object.defineProperty, De = (r, e, t) => e in r ? ze(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, E = (r, e, t) => De(r, typeof e != "symbol" ? e + "" : e, t);
1397
- class Fe {
1398
- constructor(e) {
1399
- this.props = e, E(this, "type", "component"), E(this, "id"), E(this, "mounted", !1), E(this, "cleanup", []), E(this, "formElement", null), E(this, "validationErrors"), E(this, "setValidationErrors"), E(this, "setIsValid"), E(this, "handleSubmit", async (n) => {
1400
- if (n.preventDefault(), this.props.validateOnSubmit !== !1) {
1401
- const o = this.validateForm();
1402
- if (this.setValidationErrors(o), o.length > 0)
1403
- return;
1404
- }
1405
- if (this.props.onSubmit) {
1406
- const o = this.extractFormData();
1407
- await this.props.onSubmit(o);
1408
- }
1409
- }), E(this, "handleChange", () => {
1410
- if (this.props.validateOnChange) {
1411
- const n = this.validateForm();
1412
- this.setValidationErrors(n);
1413
- }
1414
- }), this.id = `form-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
1415
- const [t, i] = $([]), [, s] = $(!0);
1416
- this.validationErrors = t, this.setValidationErrors = i, this.setIsValid = s, D(() => {
1417
- const n = this.validationErrors(), o = n.length === 0;
1418
- this.setIsValid(o), this.props.onValidationChange && this.props.onValidationChange(o, n);
1419
- });
1420
- }
1421
- /**
1422
- * Extract form data from form elements
1423
- */
1424
- extractFormData() {
1425
- if (!this.formElement) return {};
1426
- const e = new FormData(this.formElement), t = {};
1427
- for (const [i, s] of e.entries())
1428
- t[i] ? Array.isArray(t[i]) ? t[i].push(s) : t[i] = [t[i], s] : t[i] = s;
1429
- return t;
1430
- }
1431
- /**
1432
- * Validate all form fields
1433
- */
1434
- validateForm() {
1435
- if (!this.formElement) return [];
1436
- const e = [];
1437
- return this.formElement.querySelectorAll("input, select, textarea").forEach((i) => {
1438
- const s = i, n = s.name || s.id;
1439
- s.checkValidity() || e.push({
1440
- field: n,
1441
- message: s.validationMessage,
1442
- code: "html5_validation"
1443
- }), s.hasAttribute("required") && !s.value.trim() && e.push({
1444
- field: n,
1445
- message: `${n} is required`,
1446
- code: "required"
1447
- });
1448
- }), e;
1449
- }
1450
- /**
1451
- * Get form styling based on style prop
1452
- */
1453
- getFormStyles() {
1454
- const { style: e = "automatic", spacing: t = 16 } = this.props, i = {
1455
- display: "flex",
1456
- flexDirection: "column",
1457
- gap: `${t}px`
1458
- };
1459
- switch (e) {
1460
- case "grouped":
1461
- return {
1462
- ...i,
1463
- backgroundColor: "#ffffff",
1464
- border: "1px solid #e0e0e0",
1465
- borderRadius: "12px",
1466
- padding: "20px",
1467
- boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
1468
- };
1469
- case "inset":
1470
- return {
1471
- ...i,
1472
- backgroundColor: "#f8f9fa",
1473
- border: "1px solid #e9ecef",
1474
- borderRadius: "8px",
1475
- padding: "16px",
1476
- margin: "0 16px"
1477
- };
1478
- case "plain":
1479
- return i;
1480
- default:
1481
- return {
1482
- ...i,
1483
- backgroundColor: "#ffffff",
1484
- borderRadius: "8px",
1485
- padding: "16px"
1486
- };
1487
- }
1488
- }
1489
- /**
1490
- * Render validation summary
1491
- */
1492
- renderValidationSummary() {
1493
- const e = this.validationErrors();
1494
- return !this.props.showValidationSummary || e.length === 0 ? null : d(
1495
- "div",
1496
- {
1497
- style: {
1498
- backgroundColor: "#fff5f5",
1499
- border: "1px solid #fed7d7",
1500
- borderRadius: "6px",
1501
- padding: "12px 16px",
1502
- marginBottom: "16px"
1503
- }
1504
- },
1505
- d(
1506
- "div",
1507
- {
1508
- style: {
1509
- fontSize: "14px",
1510
- fontWeight: "600",
1511
- color: "#e53e3e",
1512
- marginBottom: "8px"
1513
- }
1514
- },
1515
- S("Please fix the following errors:")
1516
- ),
1517
- d(
1518
- "ul",
1519
- {
1520
- style: {
1521
- margin: "0",
1522
- paddingLeft: "20px",
1523
- fontSize: "14px",
1524
- color: "#c53030"
1525
- }
1526
- },
1527
- ...e.map((t) => d("li", { key: t.field }, S(t.message)))
1528
- )
1529
- );
1530
- }
1531
- render() {
1532
- const { children: e = [], accessibilityLabel: t, accessibilityRole: i = "form" } = this.props;
1533
- return [
1534
- d(
1535
- "form",
1536
- {
1537
- ref: (s) => {
1538
- this.formElement = s, s && !this.mounted && (s.addEventListener("submit", this.handleSubmit), s.addEventListener("change", this.handleChange), s.addEventListener("input", this.handleChange), this.cleanup.push(() => {
1539
- s.removeEventListener("submit", this.handleSubmit), s.removeEventListener("change", this.handleChange), s.removeEventListener("input", this.handleChange);
1540
- }), this.mounted = !0);
1541
- },
1542
- style: this.getFormStyles(),
1543
- "aria-label": t,
1544
- role: i,
1545
- noValidate: !0
1546
- // We handle validation manually
1547
- },
1548
- ...this.renderValidationSummary() !== null ? [this.renderValidationSummary()] : [],
1549
- ...e.flatMap((s) => s.render())
1550
- )
1551
- ];
1552
- }
1553
- }
1554
- function X(r, e = {}) {
1555
- const t = { ...e, children: r }, i = new Fe(t);
1556
- return I(i);
1557
- }
1558
- const ut = {
1559
- /**
1560
- * Automatic form styling (default)
1561
- */
1562
- Automatic(r, e = {}) {
1563
- return X(r, { ...e, style: "automatic" });
1564
- },
1565
- /**
1566
- * Grouped form with container styling
1567
- */
1568
- Grouped(r, e = {}) {
1569
- return X(r, { ...e, style: "grouped" });
1570
- },
1571
- /**
1572
- * Inset form styling
1573
- */
1574
- Inset(r, e = {}) {
1575
- return X(r, { ...e, style: "inset" });
1576
- },
1577
- /**
1578
- * Plain form without styling
1579
- */
1580
- Plain(r, e = {}) {
1581
- return X(r, { ...e, style: "plain" });
1582
- }
1583
- }, ht = {
1584
- /**
1585
- * Common validation rules
1586
- */
1587
- rules: {
1588
- // biome-ignore lint/suspicious/noExplicitAny: Validation rules accept any input type
1589
- required: (r) => r != null && r !== "",
1590
- email: (r) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r),
1591
- minLength: (r) => (e) => e.length >= r,
1592
- maxLength: (r) => (e) => e.length <= r,
1593
- pattern: (r) => (e) => r.test(e),
1594
- number: (r) => !Number.isNaN(Number(r)),
1595
- integer: (r) => Number.isInteger(Number(r)),
1596
- min: (r) => (e) => Number(e) >= r,
1597
- max: (r) => (e) => Number(e) <= r
1598
- },
1599
- /**
1600
- * Validate a single field
1601
- */
1602
- validateField(r, e) {
1603
- for (const t of e) {
1604
- const i = t(r);
1605
- if (i !== !0)
1606
- return {
1607
- field: "field",
1608
- message: typeof i == "string" ? i : "Validation failed",
1609
- code: "custom_validation"
1610
- };
1611
- }
1612
- return null;
1613
- }
1614
- };
1615
- var Ge = Object.defineProperty, Pe = (r, e, t) => e in r ? Ge(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, te = (r, e, t) => Pe(r, typeof e != "symbol" ? e + "" : e, t);
1616
- class oe {
1617
- constructor(e) {
1618
- te(this, "type", "component"), te(this, "id"), te(this, "props"), this.props = e, this.id = `enhanced-link-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
1619
- }
1620
- resolveValue(e) {
1621
- return f(e) ? e() : e;
1622
- }
1623
- getDestination() {
1624
- const e = this.resolveValue(this.props.destination);
1625
- return e instanceof URL ? e.toString() : e;
1626
- }
1627
- getTarget() {
1628
- const e = this.resolveValue(this.props.target);
1629
- if (e)
1630
- return e;
1631
- const t = this.resolveValue(this.props.destination), i = t instanceof URL ? t.toString() : t;
1632
- return this.isExternalURL(i) ? "_blank" : "_self";
1633
- }
1634
- getRoutingMode() {
1635
- return this.resolveValue(this.props.routingMode) || "auto";
1636
- }
1637
- getRel() {
1638
- const e = this.resolveValue(this.props.rel), t = this.getTarget(), i = this.getDestination(), n = this.isExternalURL(i) && t === "_blank" ? "noopener noreferrer" : "";
1639
- return e && n ? `${e} ${n}`.trim() : e || n;
1640
- }
1641
- getDownload() {
1642
- return this.resolveValue(this.props.download);
1643
- }
1644
- isDisabled() {
1645
- return this.resolveValue(this.props.disabled) || !1;
1646
- }
1647
- getAccessibilityLabel() {
1648
- return this.resolveValue(this.props.accessibilityLabel);
1649
- }
1650
- getAccessibilityHint() {
1651
- return this.resolveValue(this.props.accessibilityHint);
1652
- }
1653
- getAccessibilityRole() {
1654
- return this.resolveValue(this.props.accessibilityRole);
1655
- }
1656
- shouldUseInternalRouting(e) {
1657
- const t = this.getRoutingMode();
1658
- return t === "internal" ? !0 : t === "external" ? !1 : t === "spa" ? !0 : !(this.isSpecialScheme(e) || this.isExternalURL(e));
1659
- }
1660
- isSpecialScheme(e) {
1661
- return /^(mailto|tel|sms|ftp|file):/.test(e);
1662
- }
1663
- async handleClick(e) {
1664
- if (this.isDisabled()) {
1665
- e.preventDefault();
1666
- return;
1667
- }
1668
- if (this.props.onPress)
1669
- try {
1670
- this.props.onPress(e);
1671
- } catch (n) {
1672
- console.error("Link onPress error:", n);
1673
- }
1674
- const t = this.getDestination();
1675
- if (this.isSpecialScheme(t) || (e.preventDefault(), this.props.openURLAction && this.props.openURLAction(t) === "handled"))
1676
- return;
1677
- if (this.props.onBeforeNavigation)
1678
- try {
1679
- if (!await this.props.onBeforeNavigation(t))
1680
- return;
1681
- } catch (n) {
1682
- throw console.error("Link onBeforeNavigation error:", n), n;
1683
- }
1684
- const i = this.getTarget(), s = this.getRoutingMode();
1685
- if (this.shouldUseInternalRouting(t)) {
1686
- if (this.props.onInternalNavigation)
1687
- try {
1688
- if (await this.props.onInternalNavigation(t))
1689
- return;
1690
- } catch (n) {
1691
- console.error("Link onInternalNavigation error:", n);
1692
- }
1693
- s === "spa" ? this.handleSPANavigation(t) : i === "_blank" ? window.open(t, i) : window.location.href = t;
1694
- } else
1695
- i === "_blank" || i === "_top" || i === "_parent" ? window.open(t, i) : window.location.href = t;
1696
- }
1697
- handleSPANavigation(e) {
1698
- typeof window < "u" && window.history && window.history.pushState ? (window.history.pushState(null, "", e), window.dispatchEvent(new PopStateEvent("popstate"))) : window.location.href = e;
1699
- }
1700
- isExternalURL(e) {
1701
- try {
1702
- return new URL(e, window.location.href).hostname !== window.location.hostname;
1703
- } catch {
1704
- return !1;
1705
- }
1706
- }
1707
- renderContent() {
1708
- if (this.props.label) {
1709
- const n = this.props.label().render();
1710
- return Array.isArray(n) ? n : [n];
1711
- }
1712
- if (this.props.children)
1713
- return this.renderChildren();
1714
- let e;
1715
- this.props.text ? e = this.props.text : f(this.props.destination) ? e = xe(() => this.getDestination()) : e = this.getDestination();
1716
- const i = re(e).render();
1717
- return Array.isArray(i) ? i : [i];
1718
- }
1719
- renderChildren() {
1720
- const { children: e } = this.props;
1721
- return e ? Array.isArray(e) ? e.map((t) => this.renderChild(t)).flat() : this.renderChild(e) : [];
1722
- }
1723
- renderChild(e) {
1724
- if (typeof e == "string") {
1725
- const i = re(e).render();
1726
- return Array.isArray(i) ? i : [i];
1727
- } else {
1728
- const t = e.render();
1729
- return Array.isArray(t) ? t : [t];
1730
- }
1731
- }
1732
- render() {
1733
- const e = this.renderContent(), t = this.isDisabled(), i = {
1734
- id: this.id,
1735
- "data-component": "enhanced-link"
1736
- };
1737
- f(this.props.destination) ? i.href = () => this.getDestination() : i.href = this.getDestination(), this.props.target && (f(this.props.target) ? i.target = () => this.getTarget() : i.target = this.getTarget());
1738
- const s = this.getRel();
1739
- s && (f(this.props.rel) || f(this.props.target) ? i.rel = () => this.getRel() : i.rel = s);
1740
- const n = this.getDownload();
1741
- n !== void 0 && (f(this.props.download) ? i.download = () => this.getDownload() : n === !0 ? i.download = !0 : typeof n == "string" && (i.download = n));
1742
- const o = this.getAccessibilityLabel();
1743
- o && (f(this.props.accessibilityLabel) ? i["aria-label"] = () => this.getAccessibilityLabel() : i["aria-label"] = o);
1744
- const a = this.getAccessibilityHint();
1745
- a && (f(this.props.accessibilityHint) ? i["aria-describedby"] = () => this.getAccessibilityHint() : i["aria-describedby"] = a);
1746
- const l = this.getAccessibilityRole();
1747
- return l && (f(this.props.accessibilityRole) ? i.role = () => this.getAccessibilityRole() : i.role = l), t && (i["aria-disabled"] = "true", i.tabindex = "-1"), i.onclick = (c) => this.handleClick(c), i.style = {
1748
- textDecoration: "none",
1749
- color: "inherit",
1750
- cursor: t ? "not-allowed" : "pointer",
1751
- opacity: t ? 0.6 : 1
1752
- }, d("a", i, ...e);
1753
- }
1754
- // Concatenation support
1755
- concat(e) {
1756
- const t = this.toSegment(), i = e.toSegment(), s = {
1757
- totalSegments: 2,
1758
- accessibilityRole: "composite",
1759
- semanticStructure: "inline"
1760
- };
1761
- return new ye([t, i], s);
1762
- }
1763
- toSegment() {
1764
- return {
1765
- id: this.id,
1766
- component: this,
1767
- modifiers: [],
1768
- render: () => this.render()
1769
- };
1770
- }
1771
- isConcatenatable() {
1772
- return !0;
1773
- }
1774
- }
1775
- function ft(r, e) {
1776
- if (e !== void 0) {
1777
- const s = {
1778
- text: r,
1779
- destination: e
1780
- }, n = new oe(s);
1781
- return I(n);
1782
- }
1783
- const t = r, i = new oe(t);
1784
- return I(i);
1785
- }
1786
- const P = {
1787
- /**
1788
- * Create an external link that opens in a new tab
1789
- */
1790
- external(r, e, t = {}) {
1791
- return {
1792
- destination: r,
1793
- children: e,
1794
- target: "_blank",
1795
- routingMode: "external",
1796
- rel: "noopener noreferrer external",
1797
- accessibilityHint: "Opens in a new tab",
1798
- ...t
1799
- };
1800
- },
1801
- /**
1802
- * Create an internal link for same-domain navigation
1803
- */
1804
- internal(r, e, t = {}) {
1805
- return {
1806
- destination: r,
1807
- children: e,
1808
- routingMode: "internal",
1809
- target: "_self",
1810
- ...t
1811
- };
1812
- },
1813
- /**
1814
- * Create a SPA link using History API
1815
- */
1816
- spa(r, e, t = {}) {
1817
- return {
1818
- destination: r,
1819
- children: e,
1820
- routingMode: "spa",
1821
- target: "_self",
1822
- accessibilityHint: "Navigates within the app",
1823
- ...t
1824
- };
1825
- },
1826
- /**
1827
- * Create an email link with optional subject and body
1828
- */
1829
- email(r, e, t, i) {
1830
- let s = `mailto:${r}`;
1831
- const n = new URLSearchParams();
1832
- return e && n.append("subject", e), t && n.append("body", t), n.toString() && (s += `?${n.toString()}`), {
1833
- destination: s,
1834
- children: i || r,
1835
- accessibilityLabel: `Send email to ${r}`,
1836
- accessibilityHint: "Opens your email app"
1837
- };
1838
- },
1839
- /**
1840
- * Create a phone link with formatted display
1841
- */
1842
- phone(r, e) {
1843
- return {
1844
- destination: `tel:${r.replace(/[^\d+]/g, "")}`,
1845
- children: e || r,
1846
- accessibilityLabel: `Call ${r}`,
1847
- accessibilityHint: "Opens your phone app"
1848
- };
1849
- },
1850
- /**
1851
- * Create a download link
1852
- */
1853
- download(r, e, t) {
1854
- return {
1855
- destination: r,
1856
- children: t || `Download ${e || "file"}`,
1857
- download: e || !0,
1858
- accessibilityLabel: `Download ${e || "file"}`,
1859
- accessibilityHint: "Downloads file to your device"
1860
- };
1861
- },
1862
- /**
1863
- * Social media link utilities
1864
- */
1865
- social: {
1866
- twitter(r, e) {
1867
- return P.external(
1868
- `https://twitter.com/${r}`,
1869
- e || `@${r}`,
1870
- { accessibilityLabel: `Visit ${r} on Twitter` }
1871
- );
1872
- },
1873
- github(r, e) {
1874
- return P.external(
1875
- `https://github.com/${r}`,
1876
- e || r,
1877
- { accessibilityLabel: `Visit ${r} on GitHub` }
1878
- );
1879
- },
1880
- linkedin(r, e) {
1881
- return P.external(
1882
- `https://linkedin.com/in/${r}`,
1883
- e || r,
1884
- { accessibilityLabel: `Visit ${r} on LinkedIn` }
1885
- );
1886
- },
1887
- instagram(r, e) {
1888
- return P.external(
1889
- `https://instagram.com/${r}`,
1890
- e || `@${r}`,
1891
- { accessibilityLabel: `Visit ${r} on Instagram` }
1892
- );
1893
- },
1894
- facebook(r, e) {
1895
- return P.external(
1896
- `https://facebook.com/${r}`,
1897
- e || r,
1898
- { accessibilityLabel: `Visit ${r} on Facebook` }
1899
- );
1900
- }
1901
- },
1902
- /**
1903
- * App store link utilities
1904
- */
1905
- appStore: {
1906
- ios(r, e) {
1907
- return P.external(
1908
- `https://apps.apple.com/app/id${r}`,
1909
- e || "Download from App Store",
1910
- {
1911
- accessibilityLabel: "Download from the iOS App Store",
1912
- accessibilityHint: "Opens App Store app or website"
1913
- }
1914
- );
1915
- },
1916
- android(r, e) {
1917
- return P.external(
1918
- `https://play.google.com/store/apps/details?id=${r}`,
1919
- e || "Get it on Google Play",
1920
- {
1921
- accessibilityLabel: "Download from Google Play Store",
1922
- accessibilityHint: "Opens Google Play Store app or website"
1923
- }
1924
- );
1925
- }
1926
- },
1927
- /**
1928
- * Create a custom OpenURL action
1929
- */
1930
- openURLAction(r) {
1931
- return (e) => r(e) ? "handled" : "systemAction";
1932
- }
1933
- };
1934
- var Ve = Object.defineProperty, _e = (r, e, t) => e in r ? Ve(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, b = (r, e, t) => _e(r, typeof e != "symbol" ? e + "" : e, t);
1935
- class He {
1936
- constructor(e) {
1937
- this.props = e, b(this, "type", "component"), b(this, "id"), b(this, "mounted", !1), b(this, "cleanup", []), b(this, "dataSignal"), b(this, "setData"), b(this, "sectionsSignal"), b(this, "setSections"), b(this, "selectedItemsSignal"), b(this, "setSelectedItems"), b(this, "isLoadingSignal"), b(this, "setIsLoading"), b(this, "virtualItems", []), b(this, "visibleStartIndex", 0), b(this, "visibleEndIndex", 0), b(this, "scrollOffset", 0), b(this, "containerHeight", 0), b(this, "totalHeight", 0), b(this, "handleListScroll", (p) => {
1938
- this.scrollOffset = p.offset.y, this.containerHeight = p.containerSize.height, this.props.virtualScrolling?.enabled && this.calculateVisibleRange(), this.props.onLoadMore && p.edges.bottom && (f(this.props.hasMore) ? this.props.hasMore() : this.props.hasMore) && !this.isLoadingSignal() && (this.setIsLoading(!0), this.props.onLoadMore().finally(() => {
1939
- this.setIsLoading(!1);
1940
- })), this.props.onScroll && this.props.onScroll(p);
1941
- }), this.id = `list-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
1942
- const [t, i] = $(this.resolveData());
1943
- this.dataSignal = t, this.setData = i;
1944
- const [s, n] = $(this.resolveSections());
1945
- this.sectionsSignal = s, this.setSections = n;
1946
- const o = /* @__PURE__ */ new Set(), [a, l] = $(o);
1947
- this.selectedItemsSignal = a, this.setSelectedItems = l;
1948
- const [u, c] = $(this.resolveIsLoading());
1949
- this.isLoadingSignal = u, this.setIsLoading = c, this.setupReactiveUpdates(), e.virtualScrolling?.enabled && this.initializeVirtualScrolling();
1950
- }
1951
- /**
1952
- * Helper to flatten render results
1953
- */
1954
- flattenRenderResult(e) {
1955
- return Array.isArray(e) ? e : [e];
1956
- }
1957
- /**
1958
- * Resolve data from various input types
1959
- */
1960
- resolveData() {
1961
- const { data: e } = this.props;
1962
- return Array.isArray(e) ? e : f(e) ? e() : [];
1963
- }
1964
- /**
1965
- * Resolve sections from various input types
1966
- */
1967
- resolveSections() {
1968
- const { sections: e } = this.props;
1969
- return Array.isArray(e) ? e : f(e) ? e() : [];
1970
- }
1971
- /**
1972
- * Resolve loading state
1973
- */
1974
- resolveIsLoading() {
1975
- const { isLoading: e } = this.props;
1976
- return typeof e == "boolean" ? e : f(e) ? e() : !1;
1977
- }
1978
- /**
1979
- * Set up reactive updates for data and state
1980
- */
1981
- setupReactiveUpdates() {
1982
- if (f(this.props.data)) {
1983
- const e = D(() => {
1984
- this.setData(this.resolveData()), this.updateVirtualScrolling();
1985
- });
1986
- this.cleanup.push(() => e.dispose());
1987
- }
1988
- if (f(this.props.sections)) {
1989
- const e = D(() => {
1990
- this.setSections(this.resolveSections()), this.updateVirtualScrolling();
1991
- });
1992
- this.cleanup.push(() => e.dispose());
1993
- }
1994
- if (f(this.props.isLoading)) {
1995
- const e = D(() => {
1996
- this.setIsLoading(this.resolveIsLoading());
1997
- });
1998
- this.cleanup.push(() => e.dispose());
1999
- }
2000
- if (this.props.selectedItems) {
2001
- const e = D(() => {
2002
- this.props.selectedItems && this.setSelectedItems(this.props.selectedItems());
2003
- });
2004
- this.cleanup.push(() => e.dispose());
2005
- }
2006
- }
2007
- /**
2008
- * Initialize virtual scrolling calculations
2009
- */
2010
- initializeVirtualScrolling() {
2011
- const e = this.dataSignal(), i = this.props.virtualScrolling.estimatedItemHeight || 50;
2012
- this.virtualItems = e.map((s, n) => ({
2013
- index: n,
2014
- height: i,
2015
- offset: n * i,
2016
- item: s
2017
- })), this.totalHeight = e.length * i;
2018
- }
2019
- /**
2020
- * Update virtual scrolling calculations
2021
- */
2022
- updateVirtualScrolling() {
2023
- this.props.virtualScrolling?.enabled && (this.initializeVirtualScrolling(), this.calculateVisibleRange());
2024
- }
2025
- /**
2026
- * Calculate visible item range for virtual scrolling
2027
- */
2028
- calculateVisibleRange() {
2029
- if (!this.props.virtualScrolling?.enabled) return;
2030
- const e = this.props.virtualScrolling, t = e.overscan || 5, i = e.threshold || 0;
2031
- let s = 0;
2032
- for (let o = 0; o < this.virtualItems.length; o++)
2033
- if (this.virtualItems[o].offset + this.virtualItems[o].height > this.scrollOffset - i) {
2034
- s = Math.max(0, o - t);
2035
- break;
2036
- }
2037
- let n = this.virtualItems.length - 1;
2038
- for (let o = s; o < this.virtualItems.length; o++)
2039
- if (this.virtualItems[o].offset > this.scrollOffset + this.containerHeight + i) {
2040
- n = Math.min(this.virtualItems.length - 1, o + t);
2041
- break;
2042
- }
2043
- this.visibleStartIndex = s, this.visibleEndIndex = n;
2044
- }
2045
- /**
2046
- * Handle item selection
2047
- */
2048
- handleItemSelection(e, t) {
2049
- const { selectionMode: i, getItemId: s, onSelectionChange: n } = this.props;
2050
- if (i === "none") return;
2051
- const o = s ? s(e, t) : t, a = new Set(this.selectedItemsSignal());
2052
- i === "single" ? (a.clear(), a.add(o)) : i === "multiple" && (a.has(o) ? a.delete(o) : a.add(o)), this.setSelectedItems(a), n && n(a);
2053
- }
2054
- /**
2055
- * Create list item component
2056
- */
2057
- createListItem(e, t, i) {
2058
- const { renderItem: s, style: n, onItemTap: o, onItemLongPress: a } = this.props, l = s(e, t);
2059
- return {
2060
- type: "component",
2061
- id: `${this.id}-item-${t}`,
2062
- mounted: !1,
2063
- cleanup: [],
2064
- props: {},
2065
- render: () => {
2066
- const u = d(
2067
- "div",
2068
- {
2069
- class: `tachui-list-item tachui-list-item-${n || "plain"}`,
2070
- style: {
2071
- display: "flex",
2072
- flexDirection: "column",
2073
- position: "relative",
2074
- backgroundColor: i ? "#e6f3ff" : "transparent",
2075
- transition: "background-color 0.2s ease",
2076
- cursor: o ? "pointer" : "default"
2077
- }
2078
- },
2079
- ...this.flattenRenderResult(l.render())
2080
- );
2081
- if (u.element) {
2082
- const c = u.element;
2083
- if (o && c.addEventListener("click", () => o(e, t)), a) {
2084
- let p;
2085
- const h = () => {
2086
- p = setTimeout(() => a(e, t), 500);
2087
- }, x = () => {
2088
- clearTimeout(p);
2089
- };
2090
- c.addEventListener("mousedown", h), c.addEventListener("mouseup", x), c.addEventListener("mouseleave", x), c.addEventListener("touchstart", h), c.addEventListener("touchend", x);
2091
- }
2092
- this.props.selectionMode !== "none" && c.addEventListener("click", (p) => {
2093
- (p.metaKey || p.ctrlKey || this.props.selectionMode === "multiple") && (p.preventDefault(), this.handleItemSelection(e, t));
2094
- });
2095
- }
2096
- return [u];
2097
- }
2098
- };
2099
- }
2100
- /**
2101
- * Create list separator
2102
- */
2103
- createSeparator() {
2104
- const { separator: e } = this.props;
2105
- return e ? typeof e == "object" && "render" in e ? e : {
2106
- type: "component",
2107
- id: `${this.id}-separator`,
2108
- mounted: !1,
2109
- cleanup: [],
2110
- props: {},
2111
- render: () => [
2112
- d("div", {
2113
- class: "tachui-list-separator",
2114
- style: {
2115
- height: "1px",
2116
- backgroundColor: "#e0e0e0",
2117
- margin: "0 16px"
2118
- }
2119
- })
2120
- ]
2121
- } : null;
2122
- }
2123
- /**
2124
- * Create section header
2125
- */
2126
- createSectionHeader(e, t) {
2127
- return e.header ? typeof e.header == "string" ? {
2128
- type: "component",
2129
- id: `${this.id}-section-header-${t}`,
2130
- mounted: !1,
2131
- cleanup: [],
2132
- props: {},
2133
- render: () => [
2134
- d(
2135
- "div",
2136
- {
2137
- class: "tachui-list-section-header",
2138
- style: {
2139
- padding: "8px 16px",
2140
- backgroundColor: "#f8f9fa",
2141
- fontWeight: "600",
2142
- fontSize: "14px",
2143
- color: "#666",
2144
- textTransform: "uppercase",
2145
- letterSpacing: "0.5px"
2146
- }
2147
- },
2148
- e.header
2149
- )
2150
- ]
2151
- } : this.props.renderSectionHeader ? this.props.renderSectionHeader(e, t) : e.header : null;
2152
- }
2153
- /**
2154
- * Create section footer
2155
- */
2156
- createSectionFooter(e, t) {
2157
- return e.footer ? typeof e.footer == "string" ? {
2158
- type: "component",
2159
- id: `${this.id}-section-footer-${t}`,
2160
- mounted: !1,
2161
- cleanup: [],
2162
- props: {},
2163
- render: () => [
2164
- d(
2165
- "div",
2166
- {
2167
- class: "tachui-list-section-footer",
2168
- style: {
2169
- padding: "8px 16px",
2170
- fontSize: "12px",
2171
- color: "#999"
2172
- }
2173
- },
2174
- e.footer
2175
- )
2176
- ]
2177
- } : this.props.renderSectionFooter ? this.props.renderSectionFooter(e, t) : e.footer : null;
2178
- }
2179
- /**
2180
- * Create empty state component
2181
- */
2182
- createEmptyState() {
2183
- const { emptyState: e } = this.props;
2184
- return e || {
2185
- type: "component",
2186
- id: `${this.id}-empty`,
2187
- mounted: !1,
2188
- cleanup: [],
2189
- props: {},
2190
- render: () => [
2191
- d(
2192
- "div",
2193
- {
2194
- class: "tachui-list-empty",
2195
- style: {
2196
- display: "flex",
2197
- flexDirection: "column",
2198
- alignItems: "center",
2199
- justifyContent: "center",
2200
- padding: "40px 20px",
2201
- color: "#999",
2202
- fontSize: "16px"
2203
- }
2204
- },
2205
- "No items to display"
2206
- )
2207
- ]
2208
- };
2209
- }
2210
- /**
2211
- * Create loading indicator
2212
- */
2213
- createLoadingIndicator() {
2214
- const { loadingIndicator: e } = this.props;
2215
- return e || {
2216
- type: "component",
2217
- id: `${this.id}-loading`,
2218
- mounted: !1,
2219
- cleanup: [],
2220
- props: {},
2221
- render: () => [
2222
- d(
2223
- "div",
2224
- {
2225
- class: "tachui-list-loading",
2226
- style: {
2227
- display: "flex",
2228
- alignItems: "center",
2229
- justifyContent: "center",
2230
- padding: "20px",
2231
- color: "#999"
2232
- }
2233
- },
2234
- "Loading..."
2235
- )
2236
- ]
2237
- };
2238
- }
2239
- /**
2240
- * Render virtual scrolling content
2241
- */
2242
- renderVirtualContent() {
2243
- if (!this.props.virtualScrolling?.enabled)
2244
- return this.renderRegularContent();
2245
- const e = this.dataSignal(), t = this.selectedItemsSignal(), i = this.createSeparator(), s = [];
2246
- if (this.visibleStartIndex > 0) {
2247
- const n = this.virtualItems[this.visibleStartIndex]?.offset || 0;
2248
- s.push({
2249
- type: "component",
2250
- id: `${this.id}-spacer-top`,
2251
- mounted: !1,
2252
- cleanup: [],
2253
- props: {},
2254
- render: () => [
2255
- d("div", {
2256
- style: { height: `${n}px` }
2257
- })
2258
- ]
2259
- });
2260
- }
2261
- for (let n = this.visibleStartIndex; n <= this.visibleEndIndex && n < e.length; n++) {
2262
- const o = e[n], a = this.props.getItemId ? this.props.getItemId(o, n) : n, l = t.has(a);
2263
- s.push(this.createListItem(o, n, l)), i && n < e.length - 1 && s.push(i);
2264
- }
2265
- if (this.visibleEndIndex < e.length - 1) {
2266
- const n = this.totalHeight - (this.virtualItems[this.visibleEndIndex + 1]?.offset || 0);
2267
- s.push({
2268
- type: "component",
2269
- id: `${this.id}-spacer-bottom`,
2270
- mounted: !1,
2271
- cleanup: [],
2272
- props: {},
2273
- render: () => [
2274
- d("div", {
2275
- style: { height: `${n}px` }
2276
- })
2277
- ]
2278
- });
2279
- }
2280
- return s;
2281
- }
2282
- /**
2283
- * Render regular (non-virtual) content
2284
- */
2285
- renderRegularContent() {
2286
- const e = this.dataSignal(), t = this.sectionsSignal(), i = this.selectedItemsSignal(), s = this.createSeparator(), n = [];
2287
- return t.length > 0 ? t.forEach((o, a) => {
2288
- const l = this.createSectionHeader(o, a);
2289
- l && n.push(l), o.items.forEach((c, p) => {
2290
- const h = a * 1e3 + p, x = this.props.getItemId ? this.props.getItemId(c, h) : h, k = i.has(x);
2291
- n.push(this.createListItem(c, h, k)), s && p < o.items.length - 1 && n.push(s);
2292
- });
2293
- const u = this.createSectionFooter(o, a);
2294
- u && n.push(u);
2295
- }) : e.forEach((o, a) => {
2296
- const l = this.props.getItemId ? this.props.getItemId(o, a) : a, u = i.has(l);
2297
- n.push(this.createListItem(o, a, u)), s && a < e.length - 1 && n.push(s);
2298
- }), n;
2299
- }
2300
- /**
2301
- * Render the list component
2302
- */
2303
- render() {
2304
- const e = this.dataSignal(), t = this.isLoadingSignal();
2305
- if (t && e.length === 0) {
2306
- const o = this.createLoadingIndicator();
2307
- return o ? o.render() : [];
2308
- }
2309
- if (e.length === 0 && !t) {
2310
- const o = this.createEmptyState();
2311
- return o ? o.render() : [];
2312
- }
2313
- const i = this.props.virtualScrolling?.enabled ? this.renderVirtualContent() : this.renderRegularContent();
2314
- if (t && e.length > 0) {
2315
- const o = this.createLoadingIndicator();
2316
- o && i.push(o);
2317
- }
2318
- const s = {
2319
- ...this.props,
2320
- children: i,
2321
- onScroll: this.handleListScroll
2322
- };
2323
- return new $e(s).render();
2324
- }
2325
- }
2326
- class pe {
2327
- constructor(e) {
2328
- b(this, "type", "component"), b(this, "id"), b(this, "mounted", !1), b(this, "cleanup", []), b(this, "props"), b(this, "dataSignal"), this.props = {
2329
- ...e,
2330
- renderItem: e.children,
2331
- children: void 0
2332
- // ComponentProps children
2333
- }, this.id = `foreach-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, this.dataSignal = f(e.data) ? e.data : () => e.data;
2334
- }
2335
- /**
2336
- * Helper to flatten render results
2337
- */
2338
- flattenRenderResult(e) {
2339
- return Array.isArray(e) ? e : [e];
2340
- }
2341
- /**
2342
- * Render children for current data
2343
- */
2344
- renderChildren() {
2345
- return this.dataSignal().flatMap((t, i) => {
2346
- const s = this.props.renderItem(t, i);
2347
- return (Array.isArray(s) ? s : [s]).flatMap((o) => this.flattenRenderResult(o.render()));
2348
- });
2349
- }
2350
- /**
2351
- * Render ForEach with reactive container pattern like Show component
2352
- */
2353
- render() {
2354
- if (!(f(this.props.data) || ve(this.props.data)))
2355
- return this.renderChildren();
2356
- const t = {
2357
- type: "element",
2358
- tag: "div",
2359
- props: {
2360
- style: { display: "contents" }
2361
- // Make container invisible
2362
- },
2363
- children: [],
2364
- dispose: void 0
2365
- }, i = Ce(() => {
2366
- const n = D(() => {
2367
- const o = this.renderChildren();
2368
- t.children = o, t.element && t.element instanceof HTMLElement && this.updateContainerDOM(t.element, o);
2369
- });
2370
- return () => n.dispose();
2371
- });
2372
- t.dispose = i;
2373
- const s = this.renderChildren();
2374
- return t.children = s, [t];
2375
- }
2376
- /**
2377
- * Update the container DOM element with new children using TachUI's renderer
2378
- */
2379
- updateContainerDOM(e, t) {
2380
- e.innerHTML = "";
2381
- const i = new Se();
2382
- t.forEach((s) => {
2383
- try {
2384
- const n = i.render(s);
2385
- n && e.appendChild(n);
2386
- } catch (n) {
2387
- console.error("Error rendering ForEach component child:", n);
2388
- }
2389
- });
2390
- }
2391
- /**
2392
- * Cleanup resources
2393
- */
2394
- dispose() {
2395
- this.cleanup.forEach((e) => {
2396
- try {
2397
- e();
2398
- } catch (t) {
2399
- console.error("ForEach component cleanup error:", t);
2400
- }
2401
- }), this.cleanup = [];
2402
- }
2403
- }
2404
- function K(r) {
2405
- const e = new He(r);
2406
- return I(e);
2407
- }
2408
- function mt(r) {
2409
- return new pe(r);
2410
- }
2411
- function gt(r) {
2412
- const e = {
2413
- data: r.each,
2414
- children: r.children,
2415
- key: r.key,
2416
- ref: r.ref
2417
- };
2418
- return new pe(e);
2419
- }
2420
- const bt = {
2421
- /**
2422
- * Create a simple list from array
2423
- */
2424
- simple(r, e, t = {}) {
2425
- return K({
2426
- ...t,
2427
- data: r,
2428
- renderItem: e
2429
- });
2430
- },
2431
- /**
2432
- * Create a sectioned list
2433
- */
2434
- sectioned(r, e, t = {}) {
2435
- return K({
2436
- ...t,
2437
- sections: r,
2438
- renderItem: e
2439
- });
2440
- },
2441
- /**
2442
- * Create a virtual scrolling list for large datasets
2443
- */
2444
- virtual(r, e, t, i = {}) {
2445
- return K({
2446
- ...i,
2447
- data: r,
2448
- renderItem: e,
2449
- virtualScrolling: t
2450
- });
2451
- },
2452
- /**
2453
- * Create an infinite scrolling list
2454
- */
2455
- infinite(r, e, t, i, s = {}) {
2456
- return K({
2457
- ...s,
2458
- data: r,
2459
- renderItem: e,
2460
- onLoadMore: t,
2461
- hasMore: i
2462
- });
2463
- }
2464
- };
2465
- var je = Object.defineProperty, Ne = (r, e, t) => e in r ? je(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, w = (r, e, t) => Ne(r, typeof e != "symbol" ? e + "" : e, t);
2466
- const W = {
2467
- colors: {
2468
- background: "#FFFFFF",
2469
- surface: "#F8F9FA",
2470
- text: "#1A1A1A",
2471
- textSecondary: "#6B7280",
2472
- textDisabled: "#A0A0A0",
2473
- textDestructive: "#FF3B30",
2474
- border: "#E5E5E5",
2475
- hover: "#F0F0F0",
2476
- active: "#E3F2FD",
2477
- separator: "#E5E5E5",
2478
- shortcut: "#8E8E93",
2479
- backdrop: "rgba(0, 0, 0, 0.1)"
2480
- },
2481
- spacing: {
2482
- padding: 8,
2483
- itemPadding: 12,
2484
- gap: 4
2485
- },
2486
- borderRadius: 8,
2487
- minWidth: 200,
2488
- maxWidth: 320,
2489
- itemHeight: 36,
2490
- shadow: "0 4px 12px rgba(0, 0, 0, 0.15)",
2491
- backdropBlur: "blur(2px)"
2492
- };
2493
- class Be {
2494
- constructor(e) {
2495
- w(this, "type", "component"), w(this, "id"), w(this, "props"), w(this, "cleanup", []), w(this, "theme", W), w(this, "isOpenSignal", $(!1)), w(this, "focusedIndex", -1), w(this, "menuElement", null), w(this, "triggerElement", null), w(this, "handleKeyDown", (t) => {
2496
- if (!this.isOpen()) return;
2497
- const i = this.getVisibleItems();
2498
- switch (t.key) {
2499
- case "Escape":
2500
- (this.props.escapeKeyCloses ?? !0) && (t.preventDefault(), this.setIsOpenValue(!1));
2501
- break;
2502
- case "ArrowDown":
2503
- t.preventDefault(), this.focusedIndex = Math.min(this.focusedIndex + 1, i.length - 1), this.updateItemFocus();
2504
- break;
2505
- case "ArrowUp":
2506
- t.preventDefault(), this.focusedIndex = Math.max(this.focusedIndex - 1, 0), this.updateItemFocus();
2507
- break;
2508
- case "Enter":
2509
- case " ":
2510
- if (this.focusedIndex >= 0 && this.focusedIndex < i.length) {
2511
- t.preventDefault();
2512
- const s = this.menuElement?.querySelector(
2513
- `[data-menu-item-index="${this.focusedIndex}"]`
2514
- );
2515
- s && s.click();
2516
- }
2517
- break;
2518
- case "Home":
2519
- t.preventDefault(), this.focusedIndex = 0, this.updateItemFocus();
2520
- break;
2521
- case "End":
2522
- t.preventDefault(), this.focusedIndex = i.length - 1, this.updateItemFocus();
2523
- break;
2524
- }
2525
- }), w(this, "handleClickOutside", (t) => {
2526
- if (!(this.props.closeOnClickOutside ?? !0)) return;
2527
- const i = t.target, s = this.menuElement?.contains(i), n = this.triggerElement?.contains(i);
2528
- !s && !n && this.setIsOpenValue(!1);
2529
- }), w(this, "setIsOpenValue", (t) => {
2530
- this.props.isOpen ? typeof this.props.isOpen == "function" && this.props.isOpen(t) : this.setIsOpen(t);
2531
- }), this.props = e, this.id = `menu-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, this.props.isOpen && (this.isOpenSignal = [
2532
- this.props.isOpen,
2533
- ((t) => {
2534
- typeof this.props.isOpen == "function" && this.props.isOpen(
2535
- typeof t == "function" ? t(this.props.isOpen()) : t
2536
- );
2537
- })
2538
- ]), le(this, {
2539
- onDOMReady: (t, i) => {
2540
- i && (this.setupMenuPositioning(i), this.setupMenuAnimations(i));
2541
- }
2542
- });
2543
- }
2544
- get isOpen() {
2545
- return this.isOpenSignal[0];
2546
- }
2547
- get setIsOpen() {
2548
- return this.isOpenSignal[1];
2549
- }
2550
- resolveValue(e) {
2551
- return f(e) ? e() : e;
2552
- }
2553
- /**
2554
- * Set up menu positioning using enhanced lifecycle (ENHANCED Phase 3)
2555
- */
2556
- setupMenuPositioning(e) {
2557
- this.cleanup || (this.cleanup = []), ue(
2558
- this,
2559
- `[data-menu-trigger="${this.id}"]`,
2560
- `[data-menu-content="${this.id}"]`,
2561
- (t, i) => this.calculatePosition(t, i)
2562
- );
2563
- }
2564
- /**
2565
- * Set up menu animations using enhanced lifecycle (ENHANCED Phase 3)
2566
- */
2567
- setupMenuAnimations(e) {
2568
- this.cleanup || (this.cleanup = []);
2569
- }
2570
- getVisibleItems() {
2571
- return this.props.items.filter((e) => e.title !== "---");
2572
- }
2573
- createMenuItem(e, t) {
2574
- if (e.title === "---")
2575
- return d("div", {
2576
- role: "separator",
2577
- style: {
2578
- height: "1px",
2579
- backgroundColor: this.theme.colors.separator,
2580
- margin: `${this.theme.spacing.gap}px 0`
2581
- }
2582
- });
2583
- const i = this.resolveValue(e.disabled ?? !1), s = this.resolveValue(e.title), n = d("div", {
2584
- role: "menuitem",
2585
- tabindex: i ? "-1" : "0",
2586
- "aria-disabled": i,
2587
- "data-menu-item-index": t,
2588
- style: {
2589
- display: "flex",
2590
- alignItems: "center",
2591
- justifyContent: "space-between",
2592
- padding: `${this.theme.spacing.itemPadding}px`,
2593
- minHeight: `${this.theme.itemHeight}px`,
2594
- fontSize: "14px",
2595
- fontWeight: "400",
2596
- color: i ? this.theme.colors.textDisabled : e.destructive || e.role === "destructive" ? this.theme.colors.textDestructive : this.theme.colors.text,
2597
- cursor: i ? "default" : "pointer",
2598
- borderRadius: `${this.theme.borderRadius / 2}px`,
2599
- transition: "all 150ms ease-out",
2600
- userSelect: "none"
2601
- },
2602
- onclick: async (p) => {
2603
- if (!i) {
2604
- if (p.preventDefault(), p.stopPropagation(), e.action)
2605
- try {
2606
- await e.action();
2607
- } catch (h) {
2608
- console.error("Menu item action failed:", h);
2609
- }
2610
- (this.props.closeOnSelect ?? !0) && this.setIsOpenValue(!1);
2611
- }
2612
- },
2613
- onmouseenter: () => {
2614
- if (!i) {
2615
- this.focusedIndex = t, this.updateItemFocus();
2616
- const p = n.element;
2617
- p && (p.style.backgroundColor = this.theme.colors.hover);
2618
- }
2619
- },
2620
- onmouseleave: () => {
2621
- if (!i) {
2622
- const p = n.element;
2623
- p && (p.style.backgroundColor = "transparent");
2624
- }
2625
- }
2626
- }), o = d("div", {
2627
- style: {
2628
- display: "flex",
2629
- alignItems: "center",
2630
- gap: `${this.theme.spacing.gap * 2}px`
2631
- }
2632
- });
2633
- if (e.systemImage) {
2634
- const h = d("span", {
2635
- style: {
2636
- fontSize: "16px",
2637
- color: "inherit"
2638
- }
2639
- }).element;
2640
- h && (h.textContent = e.systemImage);
2641
- const x = o.element;
2642
- x && h && x.appendChild(h);
2643
- }
2644
- const l = d("span").element;
2645
- l && (l.textContent = s);
2646
- const u = o.element;
2647
- u && l && u.appendChild(l);
2648
- const c = n.element;
2649
- if (c && u && c.appendChild(u), e.shortcut) {
2650
- const h = d("span", {
2651
- style: {
2652
- fontSize: "12px",
2653
- color: this.theme.colors.shortcut,
2654
- fontFamily: "monospace"
2655
- }
2656
- }).element;
2657
- h && (h.textContent = e.shortcut), c && h && c.appendChild(h);
2658
- }
2659
- if (e.submenu && e.submenu.length > 0) {
2660
- const h = d("span", {
2661
- style: {
2662
- fontSize: "12px",
2663
- color: this.theme.colors.textSecondary
2664
- }
2665
- }).element;
2666
- h && (h.textContent = "▶"), c && h && c.appendChild(h);
2667
- }
2668
- return n;
2669
- }
2670
- updateItemFocus() {
2671
- if (!this.menuElement) return;
2672
- this.menuElement.querySelectorAll('[role="menuitem"]').forEach((t, i) => {
2673
- const s = t;
2674
- i === this.focusedIndex ? (s.style.backgroundColor = this.theme.colors.hover, s.focus()) : s.style.backgroundColor = "transparent";
2675
- });
2676
- }
2677
- calculatePosition(e, t) {
2678
- const i = e.getBoundingClientRect(), s = t.getBoundingClientRect(), n = {
2679
- width: window.innerWidth,
2680
- height: window.innerHeight
2681
- }, o = this.props.placement ?? "bottom", a = this.props.offset ?? { x: 0, y: 4 };
2682
- let l = 0, u = 0;
2683
- switch (o) {
2684
- case "bottom":
2685
- case "bottom-start":
2686
- case "bottom-end":
2687
- u = i.bottom + a.y;
2688
- break;
2689
- case "top":
2690
- case "top-start":
2691
- case "top-end":
2692
- u = i.top - s.height - a.y;
2693
- break;
2694
- case "right":
2695
- case "right-start":
2696
- case "right-end":
2697
- l = i.right + a.x;
2698
- break;
2699
- case "left":
2700
- case "left-start":
2701
- case "left-end":
2702
- l = i.left - s.width - a.x;
2703
- break;
2704
- }
2705
- switch (o) {
2706
- case "bottom":
2707
- case "top":
2708
- l = i.left + (i.width - s.width) / 2;
2709
- break;
2710
- case "bottom-start":
2711
- case "top-start":
2712
- l = i.left;
2713
- break;
2714
- case "bottom-end":
2715
- case "top-end":
2716
- l = i.right - s.width;
2717
- break;
2718
- case "right":
2719
- case "left":
2720
- u = i.top + (i.height - s.height) / 2;
2721
- break;
2722
- case "right-start":
2723
- case "left-start":
2724
- u = i.top;
2725
- break;
2726
- case "right-end":
2727
- case "left-end":
2728
- u = i.bottom - s.height;
2729
- break;
2730
- }
2731
- return (this.props.flip ?? !0) && (u + s.height > n.height && i.top > s.height && (u = i.top - s.height - a.y), l + s.width > n.width && i.left > s.width && (l = i.left - s.width - a.x)), (this.props.shift ?? !0) && (l = Math.max(8, Math.min(l, n.width - s.width - 8)), u = Math.max(8, Math.min(u, n.height - s.height - 8))), { x: l, y: u };
2732
- }
2733
- createMenuContent() {
2734
- const e = d("div", {
2735
- role: "menu",
2736
- "aria-labelledby": `${this.id}-trigger`,
2737
- "data-menu-id": this.id,
2738
- "data-menu-content": this.id,
2739
- // ENHANCED: Add data attribute for lifecycle hooks
2740
- style: {
2741
- position: "fixed",
2742
- backgroundColor: this.theme.colors.background,
2743
- border: `1px solid ${this.theme.colors.border}`,
2744
- borderRadius: `${this.theme.borderRadius}px`,
2745
- boxShadow: this.theme.shadow,
2746
- minWidth: `${this.theme.minWidth}px`,
2747
- maxWidth: `${this.theme.maxWidth}px`,
2748
- padding: `${this.theme.spacing.padding}px`,
2749
- zIndex: "9999",
2750
- opacity: "0",
2751
- transform: "scale(0.95)",
2752
- transformOrigin: "top",
2753
- transition: `all ${this.props.animationDuration || 150}ms cubic-bezier(0.16, 1, 0.3, 1)`
2754
- }
2755
- });
2756
- return this.props.items.forEach((t, i) => {
2757
- const s = this.createMenuItem(t, i), n = e.element, o = s.element;
2758
- n && o && n.appendChild(o);
2759
- }), this.menuElement = e.element, e;
2760
- }
2761
- setupTrigger() {
2762
- let e;
2763
- if (typeof this.props.trigger == "function") {
2764
- const t = this.props.trigger();
2765
- if ("render" in t) {
2766
- const i = t.render();
2767
- Array.isArray(i) ? e = i[0]?.element : e = i instanceof HTMLElement ? i : i?.element;
2768
- } else
2769
- e = t;
2770
- } else if ("render" in this.props.trigger) {
2771
- const t = this.props.trigger.render();
2772
- Array.isArray(t) ? e = t[0]?.element : e = t instanceof HTMLElement ? t : t?.element;
2773
- } else
2774
- e = this.props.trigger;
2775
- return e.id = e.id || `${this.id}-trigger`, e.setAttribute("aria-haspopup", "menu"), e.setAttribute("aria-expanded", String(this.isOpen())), e.setAttribute("data-menu-trigger", this.id), e.addEventListener("click", (t) => {
2776
- t.preventDefault(), t.stopPropagation(), this.setIsOpenValue(!this.isOpen());
2777
- }), this.triggerElement = e, e;
2778
- }
2779
- render() {
2780
- const e = d("div", {
2781
- style: {
2782
- position: "relative",
2783
- display: "inline-block"
2784
- }
2785
- }), t = this.setupTrigger();
2786
- return e.element && t && e.element.appendChild(t), D(() => {
2787
- if (this.isOpen()) {
2788
- const n = this.createMenuContent().element;
2789
- if (n && (document.body.appendChild(n), this.menuElement = n), this.triggerElement && this.menuElement) {
2790
- const o = this.calculatePosition(this.triggerElement, this.menuElement);
2791
- this.menuElement.style.left = `${o.x}px`, this.menuElement.style.top = `${o.y}px`, he.scaleIn(this, this.menuElement, this.props.animationDuration || 150), this.focusedIndex = 0, fe.focusWhenReady(this, '[role="menuitem"]', this.menuElement);
2792
- }
2793
- document.addEventListener("keydown", this.handleKeyDown), document.addEventListener("click", this.handleClickOutside), this.triggerElement?.setAttribute("aria-expanded", "true");
2794
- } else {
2795
- if (this.menuElement) {
2796
- this.menuElement.style.opacity = "0", this.menuElement.style.transform = "scale(0.95)";
2797
- const s = () => {
2798
- this.menuElement?.parentNode && (document.body.removeChild(this.menuElement), this.menuElement = null), this.menuElement?.removeEventListener("transitionend", s);
2799
- };
2800
- this.menuElement.addEventListener("transitionend", s);
2801
- const n = setTimeout(() => {
2802
- this.menuElement?.removeEventListener("transitionend", s), s();
2803
- }, this.props.animationDuration || 150);
2804
- this.cleanup || (this.cleanup = []), this.cleanup.push(() => {
2805
- n && clearTimeout(n);
2806
- });
2807
- }
2808
- document.removeEventListener("keydown", this.handleKeyDown), document.removeEventListener("click", this.handleClickOutside), this.triggerElement?.setAttribute("aria-expanded", "false"), this.focusedIndex = -1;
2809
- }
2810
- }), e;
2811
- }
2812
- }
2813
- function yt(r) {
2814
- return I(new Be(r));
2815
- }
2816
- const St = {
2817
- /**
2818
- * Create a separator item
2819
- */
2820
- separator() {
2821
- return { title: "---" };
2822
- },
2823
- /**
2824
- * Create a destructive menu item
2825
- */
2826
- destructive(r, e, t) {
2827
- return {
2828
- title: r,
2829
- action: e,
2830
- destructive: !0,
2831
- systemImage: t
2832
- };
2833
- },
2834
- /**
2835
- * Create a menu item with keyboard shortcut
2836
- */
2837
- withShortcut(r, e, t, i) {
2838
- return {
2839
- title: r,
2840
- shortcut: e,
2841
- action: t,
2842
- systemImage: i
2843
- };
2844
- },
2845
- /**
2846
- * Create a context menu for right-click interactions
2847
- */
2848
- contextMenu(r, e) {
2849
- const [t, i] = $(!1), [s, n] = $({ x: 0, y: 0 });
2850
- r.addEventListener("contextmenu", (o) => {
2851
- o.preventDefault(), n({ x: o.clientX, y: o.clientY }), i(!0);
2852
- }), console.log("Context menu requested", { items: e, position: s(), isOpen: t() });
2853
- }
2854
- }, xt = {
2855
- theme: W,
2856
- /**
2857
- * Create a custom menu theme
2858
- */
2859
- createTheme(r) {
2860
- return { ...W, ...r };
2861
- },
2862
- /**
2863
- * Dark theme preset
2864
- */
2865
- darkTheme() {
2866
- return {
2867
- ...W,
2868
- colors: {
2869
- ...W.colors,
2870
- background: "#2A2A2A",
2871
- surface: "#3A3A3A",
2872
- text: "#FFFFFF",
2873
- textSecondary: "#A0A0A0",
2874
- border: "#404040",
2875
- hover: "#404040",
2876
- active: "#0066CC"
2877
- }
2878
- };
2879
- }
2880
- };
2881
- var We = Object.defineProperty, Ue = (r, e, t) => e in r ? We(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, A = (r, e, t) => Ue(r, typeof e != "symbol" ? e + "" : e, t);
2882
- class qe {
2883
- constructor(e) {
2884
- this.props = e, A(this, "type", "component"), A(this, "id"), A(this, "mounted", !1), A(this, "cleanup", []), A(this, "isOpen"), A(this, "setIsOpen"), A(this, "searchTerm"), A(this, "setSearchTerm"), A(this, "handleSelection", (o) => {
2885
- this.props.onSelectionChange && this.props.onSelectionChange(o), (this.props.variant === "dropdown" || this.props.variant === "menu") && this.setIsOpen(!1), this.setSearchTerm("");
2886
- }), A(this, "toggleOpen", () => {
2887
- this.isDisabled() || this.setIsOpen(!this.isOpen());
2888
- }), this.id = `picker-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
2889
- const [t, i] = $(!1), [s, n] = $("");
2890
- if (this.isOpen = t, this.setIsOpen = i, this.searchTerm = s, this.setSearchTerm = n, typeof window < "u") {
2891
- const o = (a) => {
2892
- const l = document.getElementById(this.id);
2893
- l && !l.contains(a.target) && this.setIsOpen(!1);
2894
- };
2895
- document.addEventListener("click", o), this.cleanup.push(() => {
2896
- document.removeEventListener("click", o);
2897
- });
2898
- }
2899
- }
2900
- /**
2901
- * Get current selection value
2902
- */
2903
- getSelection() {
2904
- const { selection: e } = this.props;
2905
- return f(e) ? e() : e;
2906
- }
2907
- /**
2908
- * Get current options
2909
- */
2910
- getOptions() {
2911
- const { options: e } = this.props;
2912
- return f(e) ? e() : e;
2913
- }
2914
- /**
2915
- * Filter options based on search term
2916
- */
2917
- getFilteredOptions() {
2918
- const e = this.getOptions(), t = this.searchTerm().toLowerCase();
2919
- return !t || !this.props.searchable ? e : e.filter(
2920
- (i) => i.label.toLowerCase().includes(t) || i.description?.toLowerCase().includes(t)
2921
- );
2922
- }
2923
- /**
2924
- * Check if picker is disabled
2925
- */
2926
- isDisabled() {
2927
- const { disabled: e } = this.props;
2928
- return typeof e == "boolean" ? e : f(e) ? e() : !1;
2929
- }
2930
- /**
2931
- * Get selected option
2932
- */
2933
- getSelectedOption() {
2934
- const e = this.getSelection();
2935
- return this.getOptions().find((i) => i.value === e) || null;
2936
- }
2937
- /**
2938
- * Get picker size styles
2939
- */
2940
- getSizeStyles() {
2941
- const { size: e = "medium" } = this.props;
2942
- switch (e) {
2943
- case "small":
2944
- return {
2945
- fontSize: "14px",
2946
- padding: "6px 12px",
2947
- minHeight: "32px"
2948
- };
2949
- case "large":
2950
- return {
2951
- fontSize: "18px",
2952
- padding: "12px 16px",
2953
- minHeight: "48px"
2954
- };
2955
- default:
2956
- return {
2957
- fontSize: "16px",
2958
- padding: "8px 12px",
2959
- minHeight: "40px"
2960
- };
2961
- }
2962
- }
2963
- /**
2964
- * Render dropdown variant
2965
- */
2966
- renderDropdown() {
2967
- const e = this.getSelectedOption(), t = this.getFilteredOptions(), i = this.getSizeStyles(), s = this.isOpen();
2968
- return d(
2969
- "div",
2970
- {
2971
- id: this.id,
2972
- style: {
2973
- position: "relative",
2974
- display: "inline-block",
2975
- minWidth: "200px"
2976
- }
2977
- },
2978
- // Trigger button
2979
- d(
2980
- "button",
2981
- {
2982
- type: "button",
2983
- onClick: this.toggleOpen,
2984
- disabled: this.isDisabled(),
2985
- style: {
2986
- ...i,
2987
- width: "100%",
2988
- display: "flex",
2989
- alignItems: "center",
2990
- justifyContent: "space-between",
2991
- backgroundColor: "#ffffff",
2992
- border: "1px solid #d1d5db",
2993
- borderRadius: "6px",
2994
- cursor: this.isDisabled() ? "not-allowed" : "pointer",
2995
- opacity: this.isDisabled() ? 0.6 : 1,
2996
- ...s && {
2997
- borderColor: this.props.tint || "#007AFF",
2998
- boxShadow: `0 0 0 1px ${this.props.tint || "#007AFF"}`
2999
- }
3000
- }
3001
- },
3002
- d(
3003
- "span",
3004
- {
3005
- style: {
3006
- color: e ? "#1a1a1a" : "#6b7280"
3007
- }
3008
- },
3009
- S(e?.label || this.props.placeholder || "Select an option")
3010
- ),
3011
- d(
3012
- "span",
3013
- {
3014
- style: {
3015
- fontSize: "12px",
3016
- color: "#6b7280",
3017
- transform: s ? "rotate(180deg)" : "rotate(0deg)",
3018
- transition: "transform 0.2s"
3019
- }
3020
- },
3021
- S("▼")
3022
- )
3023
- ),
3024
- ...s ? [
3025
- d(
3026
- "div",
3027
- {
3028
- style: {
3029
- position: "absolute",
3030
- top: "100%",
3031
- left: "0",
3032
- right: "0",
3033
- zIndex: 1e3,
3034
- backgroundColor: "#ffffff",
3035
- border: "1px solid #d1d5db",
3036
- borderRadius: "6px",
3037
- boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.1)",
3038
- maxHeight: "200px",
3039
- overflowY: "auto",
3040
- marginTop: "2px"
3041
- }
3042
- },
3043
- ...this.props.searchable ? [
3044
- d(
3045
- "div",
3046
- {
3047
- style: {
3048
- padding: "8px",
3049
- borderBottom: "1px solid #e5e7eb"
3050
- }
3051
- },
3052
- d("input", {
3053
- type: "text",
3054
- placeholder: "Search options...",
3055
- value: this.searchTerm(),
3056
- onInput: (n) => {
3057
- const o = n.target;
3058
- this.setSearchTerm(o.value);
3059
- },
3060
- style: {
3061
- width: "100%",
3062
- padding: "6px 8px",
3063
- border: "1px solid #d1d5db",
3064
- borderRadius: "4px",
3065
- fontSize: "14px"
3066
- }
3067
- })
3068
- )
3069
- ] : [],
3070
- ...t.map(
3071
- (n) => d(
3072
- "button",
3073
- {
3074
- type: "button",
3075
- key: String(n.value),
3076
- onClick: () => this.handleSelection(n.value),
3077
- disabled: n.disabled,
3078
- style: {
3079
- width: "100%",
3080
- padding: "8px 12px",
3081
- textAlign: "left",
3082
- backgroundColor: n.value === this.getSelection() ? "#f3f4f6" : "transparent",
3083
- border: "none",
3084
- cursor: n.disabled ? "not-allowed" : "pointer",
3085
- opacity: n.disabled ? 0.5 : 1,
3086
- fontSize: "14px",
3087
- display: "flex",
3088
- alignItems: "center",
3089
- gap: "8px",
3090
- ":hover": {
3091
- backgroundColor: "#f9fafb"
3092
- }
3093
- }
3094
- },
3095
- ...n.icon ? [d("span", { style: { fontSize: "16px" } }, S(n.icon))] : [],
3096
- d(
3097
- "div",
3098
- {},
3099
- d("div", {}, S(n.label)),
3100
- ...n.description ? [
3101
- d(
3102
- "div",
3103
- {
3104
- style: {
3105
- fontSize: "12px",
3106
- color: "#6b7280",
3107
- marginTop: "2px"
3108
- }
3109
- },
3110
- S(n.description)
3111
- )
3112
- ] : []
3113
- )
3114
- )
3115
- ),
3116
- ...t.length === 0 ? [
3117
- d(
3118
- "div",
3119
- {
3120
- style: {
3121
- padding: "12px",
3122
- textAlign: "center",
3123
- color: "#6b7280",
3124
- fontSize: "14px"
3125
- }
3126
- },
3127
- S("No options found")
3128
- )
3129
- ] : []
3130
- )
3131
- ] : []
3132
- );
3133
- }
3134
- /**
3135
- * Render segmented variant
3136
- */
3137
- renderSegmented() {
3138
- const e = this.getOptions(), t = this.getSelection(), i = this.getSizeStyles();
3139
- return d(
3140
- "div",
3141
- {
3142
- style: {
3143
- display: "flex",
3144
- backgroundColor: "#f3f4f6",
3145
- borderRadius: "8px",
3146
- padding: "2px"
3147
- },
3148
- role: "radiogroup",
3149
- "aria-label": this.props.accessibilityLabel
3150
- },
3151
- ...e.map(
3152
- (s, n) => d(
3153
- "button",
3154
- {
3155
- type: "button",
3156
- key: String(s.value),
3157
- onClick: () => this.handleSelection(s.value),
3158
- disabled: s.disabled || this.isDisabled(),
3159
- role: "radio",
3160
- "aria-checked": s.value === t,
3161
- style: {
3162
- ...i,
3163
- flex: 1,
3164
- border: "none",
3165
- borderRadius: "6px",
3166
- backgroundColor: s.value === t ? "#ffffff" : "transparent",
3167
- color: s.value === t ? "#1a1a1a" : "#6b7280",
3168
- fontWeight: s.value === t ? "600" : "400",
3169
- cursor: s.disabled || this.isDisabled() ? "not-allowed" : "pointer",
3170
- opacity: s.disabled || this.isDisabled() ? 0.5 : 1,
3171
- boxShadow: s.value === t ? "0 1px 2px rgba(0, 0, 0, 0.1)" : "none",
3172
- transition: "all 0.2s",
3173
- margin: "0",
3174
- ...n === 0 && { marginRight: "1px" },
3175
- ...n === e.length - 1 && { marginLeft: "1px" }
3176
- }
3177
- },
3178
- ...s.icon ? [
3179
- d(
3180
- "span",
3181
- {
3182
- style: {
3183
- marginRight: "6px",
3184
- fontSize: "14px"
3185
- }
3186
- },
3187
- S(s.icon)
3188
- )
3189
- ] : [],
3190
- S(s.label)
3191
- )
3192
- )
3193
- );
3194
- }
3195
- /**
3196
- * Render wheel variant (simplified)
3197
- */
3198
- renderWheel() {
3199
- const e = this.getOptions(), t = this.getSelection();
3200
- return d(
3201
- "select",
3202
- {
3203
- value: String(t),
3204
- onChange: (i) => {
3205
- const s = i.target, n = e.find((o) => String(o.value) === s.value);
3206
- n && this.handleSelection(n.value);
3207
- },
3208
- disabled: this.isDisabled(),
3209
- style: {
3210
- ...this.getSizeStyles(),
3211
- minWidth: "200px",
3212
- backgroundColor: "#ffffff",
3213
- border: "1px solid #d1d5db",
3214
- borderRadius: "6px",
3215
- cursor: this.isDisabled() ? "not-allowed" : "pointer",
3216
- opacity: this.isDisabled() ? 0.6 : 1
3217
- }
3218
- },
3219
- ...e.map(
3220
- (i) => d(
3221
- "option",
3222
- {
3223
- key: String(i.value),
3224
- value: String(i.value),
3225
- disabled: i.disabled
3226
- },
3227
- S(i.label)
3228
- )
3229
- )
3230
- );
3231
- }
3232
- render() {
3233
- const { variant: e = "dropdown", accessibilityLabel: t, accessibilityHint: i } = this.props, s = {
3234
- "aria-label": t,
3235
- "aria-describedby": i ? `${this.id}-hint` : void 0
3236
- };
3237
- let n;
3238
- switch (e) {
3239
- case "segmented":
3240
- n = this.renderSegmented();
3241
- break;
3242
- case "wheel":
3243
- n = this.renderWheel();
3244
- break;
3245
- default:
3246
- n = this.renderDropdown();
3247
- break;
3248
- }
3249
- return d(
3250
- "div",
3251
- s,
3252
- n,
3253
- ...i ? [
3254
- d(
3255
- "div",
3256
- {
3257
- id: `${this.id}-hint`,
3258
- style: {
3259
- fontSize: "12px",
3260
- color: "#6b7280",
3261
- marginTop: "4px"
3262
- }
3263
- },
3264
- S(i)
3265
- )
3266
- ] : []
3267
- );
3268
- }
3269
- }
3270
- function Q(r, e, t = {}) {
3271
- const i = { ...t, selection: r, options: e }, s = new qe(i);
3272
- return I(s);
3273
- }
3274
- const vt = {
3275
- /**
3276
- * Dropdown picker (default)
3277
- */
3278
- // biome-ignore lint/suspicious/noExplicitAny: Generic dropdown picker requires flexible type
3279
- Dropdown(r, e, t = {}) {
3280
- return Q(r, e, { ...t, variant: "dropdown" });
3281
- },
3282
- /**
3283
- * Segmented picker
3284
- */
3285
- // biome-ignore lint/suspicious/noExplicitAny: Generic segmented picker requires flexible type
3286
- Segmented(r, e, t = {}) {
3287
- return Q(r, e, { ...t, variant: "segmented" });
3288
- },
3289
- /**
3290
- * Wheel picker (native select)
3291
- */
3292
- // biome-ignore lint/suspicious/noExplicitAny: Generic wheel picker requires flexible type
3293
- Wheel(r, e, t = {}) {
3294
- return Q(r, e, { ...t, variant: "wheel" });
3295
- },
3296
- /**
3297
- * Menu picker
3298
- */
3299
- // biome-ignore lint/suspicious/noExplicitAny: Generic menu picker requires flexible type
3300
- Menu(r, e, t = {}) {
3301
- return Q(r, e, { ...t, variant: "menu" });
3302
- }
3303
- }, Ct = {
3304
- /**
3305
- * Create options from simple array
3306
- */
3307
- fromArray(r, e) {
3308
- return r.map((t) => ({
3309
- value: t,
3310
- label: String(e && typeof t == "object" && t !== null ? t[e] : t)
3311
- }));
3312
- },
3313
- /**
3314
- * Create options from enum
3315
- */
3316
- fromEnum(r) {
3317
- return Object.entries(r).map(([e, t]) => ({
3318
- value: t,
3319
- label: e.replace(/([A-Z])/g, " $1").trim()
3320
- }));
3321
- },
3322
- /**
3323
- * Group options by category
3324
- */
3325
- grouped(r) {
3326
- return r.reduce(
3327
- (e, t) => {
3328
- const i = t.category || "Other";
3329
- return e[i] || (e[i] = []), e[i].push(t), e;
3330
- },
3331
- {}
3332
- );
3333
- }
3334
- };
3335
- var Ye = Object.defineProperty, Xe = (r, e, t) => e in r ? Ye(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, B = (r, e, t) => Xe(r, typeof e != "symbol" ? e + "" : e, t);
3336
- class Ke {
3337
- constructor(e) {
3338
- this.props = e, B(this, "type", "component"), B(this, "id"), B(this, "mounted", !1), B(this, "cleanup", []), B(this, "handleToggle", () => {
3339
- this.props.onToggle && this.props.onToggle(!this.isCollapsed());
3340
- }), this.id = `section-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
3341
- }
3342
- /**
3343
- * Resolve dynamic content
3344
- */
3345
- resolveContent(e) {
3346
- return e ? typeof e == "string" ? e : typeof e == "function" || f(e) ? e() : e : null;
3347
- }
3348
- /**
3349
- * Check if section is collapsed
3350
- */
3351
- isCollapsed() {
3352
- const { collapsed: e } = this.props;
3353
- return typeof e == "boolean" ? e : f(e) ? e() : !1;
3354
- }
3355
- /**
3356
- * Helper to render component content safely
3357
- */
3358
- renderComponentContent(e) {
3359
- const t = e.render();
3360
- return Array.isArray(t) ? t : [t];
3361
- }
3362
- /**
3363
- * Get section styles based on style prop
3364
- */
3365
- getSectionStyles() {
3366
- const { style: e = "automatic" } = this.props, t = {
3367
- marginBottom: "20px"
3368
- };
3369
- switch (e) {
3370
- case "grouped":
3371
- return {
3372
- ...t,
3373
- backgroundColor: "#ffffff",
3374
- border: "1px solid #e0e0e0",
3375
- borderRadius: "12px",
3376
- overflow: "hidden"
3377
- };
3378
- case "inset":
3379
- return {
3380
- ...t,
3381
- backgroundColor: "#f8f9fa",
3382
- border: "1px solid #e9ecef",
3383
- borderRadius: "8px",
3384
- margin: "0 16px 20px 16px"
3385
- };
3386
- case "sidebar":
3387
- return {
3388
- ...t,
3389
- borderLeft: "3px solid #007AFF",
3390
- paddingLeft: "16px",
3391
- backgroundColor: "#f8f9fa",
3392
- borderRadius: "0 8px 8px 0"
3393
- };
3394
- case "plain":
3395
- return t;
3396
- default:
3397
- return {
3398
- ...t,
3399
- backgroundColor: "#ffffff",
3400
- border: "1px solid #f0f0f0",
3401
- borderRadius: "8px"
3402
- };
3403
- }
3404
- }
3405
- /**
3406
- * Get header styles
3407
- */
3408
- getHeaderStyles() {
3409
- const { style: e = "automatic" } = this.props, t = {
3410
- fontSize: "16px",
3411
- fontWeight: "600",
3412
- color: "#1a1a1a",
3413
- margin: "0 0 12px 0"
3414
- };
3415
- switch (e) {
3416
- case "grouped":
3417
- case "inset":
3418
- return {
3419
- ...t,
3420
- padding: "12px 16px 0 16px",
3421
- backgroundColor: "#f8f9fa",
3422
- borderBottom: "1px solid #e9ecef"
3423
- };
3424
- case "sidebar":
3425
- return {
3426
- ...t,
3427
- fontSize: "14px",
3428
- textTransform: "uppercase",
3429
- letterSpacing: "0.5px",
3430
- color: "#666",
3431
- marginBottom: "8px"
3432
- };
3433
- default:
3434
- return {
3435
- ...t,
3436
- padding: "0 0 8px 0"
3437
- };
3438
- }
3439
- }
3440
- /**
3441
- * Get content styles
3442
- */
3443
- getContentStyles() {
3444
- const { style: e = "automatic", spacing: t = 12 } = this.props, i = {
3445
- display: "flex",
3446
- flexDirection: "column",
3447
- gap: `${t}px`
3448
- };
3449
- switch (e) {
3450
- case "grouped":
3451
- case "inset":
3452
- return {
3453
- ...i,
3454
- padding: "16px"
3455
- };
3456
- case "sidebar":
3457
- return {
3458
- ...i,
3459
- padding: "8px 0"
3460
- };
3461
- default:
3462
- return {
3463
- ...i,
3464
- padding: "12px"
3465
- };
3466
- }
3467
- }
3468
- /**
3469
- * Get footer styles
3470
- */
3471
- getFooterStyles() {
3472
- const { style: e = "automatic" } = this.props, t = {
3473
- fontSize: "14px",
3474
- color: "#666",
3475
- margin: "8px 0 0 0"
3476
- };
3477
- switch (e) {
3478
- case "grouped":
3479
- case "inset":
3480
- return {
3481
- ...t,
3482
- padding: "0 16px 12px 16px",
3483
- backgroundColor: "#f8f9fa",
3484
- borderTop: "1px solid #e9ecef"
3485
- };
3486
- default:
3487
- return {
3488
- ...t,
3489
- padding: "0 0 4px 0"
3490
- };
3491
- }
3492
- }
3493
- /**
3494
- * Render header content
3495
- */
3496
- renderHeader() {
3497
- const e = this.resolveContent(this.props.header);
3498
- if (!e) return null;
3499
- const t = this.getHeaderStyles();
3500
- if (this.props.collapsible) {
3501
- const i = this.isCollapsed() ? "▶" : "▼";
3502
- return d(
3503
- "div",
3504
- {
3505
- style: {
3506
- ...t,
3507
- cursor: "pointer",
3508
- display: "flex",
3509
- alignItems: "center",
3510
- gap: "8px"
3511
- },
3512
- onClick: this.handleToggle
3513
- },
3514
- d(
3515
- "span",
3516
- {
3517
- style: {
3518
- fontSize: "12px",
3519
- color: "#666"
3520
- }
3521
- },
3522
- S(i)
3523
- ),
3524
- ...typeof e == "string" ? [S(e)] : this.renderComponentContent(e)
3525
- );
3526
- }
3527
- return d(
3528
- "div",
3529
- { style: t },
3530
- ...typeof e == "string" ? [S(e)] : this.renderComponentContent(e)
3531
- );
3532
- }
3533
- /**
3534
- * Render content
3535
- */
3536
- renderContent() {
3537
- const { children: e = [] } = this.props;
3538
- return this.props.collapsible && this.isCollapsed() || e.length === 0 ? null : d(
3539
- "div",
3540
- {
3541
- style: this.getContentStyles()
3542
- },
3543
- ...e.flatMap((t) => {
3544
- const i = t.render();
3545
- return Array.isArray(i) ? i : [i];
3546
- })
3547
- );
3548
- }
3549
- /**
3550
- * Render footer content
3551
- */
3552
- renderFooter() {
3553
- const e = this.resolveContent(this.props.footer);
3554
- return e ? d(
3555
- "div",
3556
- {
3557
- style: this.getFooterStyles()
3558
- },
3559
- ...typeof e == "string" ? [S(e)] : this.renderComponentContent(e)
3560
- ) : null;
3561
- }
3562
- render() {
3563
- const { accessibilityLabel: e, accessibilityRole: t = "group" } = this.props;
3564
- return d(
3565
- "div",
3566
- {
3567
- style: this.getSectionStyles(),
3568
- "aria-label": e,
3569
- role: t
3570
- },
3571
- ...[this.renderHeader(), this.renderContent(), this.renderFooter()].filter(
3572
- (i) => i !== null
3573
- )
3574
- );
3575
- }
3576
- }
3577
- function z(r, e = {}) {
3578
- console.warn(
3579
- "Section from @tachui/core is deprecated. Use FormSection from @tachui/forms for form contexts, or VStack for general layout grouping."
3580
- );
3581
- const t = { ...e, children: r }, i = new Ke(t);
3582
- return I(i);
3583
- }
3584
- function wt(r, e, t = {}) {
3585
- return z(e, { ...t, header: r });
3586
- }
3587
- function $t(r, e, t, i = {}) {
3588
- return z(t, { ...i, header: r, footer: e });
3589
- }
3590
- const It = {
3591
- /**
3592
- * Automatic section styling (default)
3593
- */
3594
- Automatic(r, e = {}) {
3595
- return z(r, { ...e, style: "automatic" });
3596
- },
3597
- /**
3598
- * Grouped section with container styling
3599
- */
3600
- Grouped(r, e = {}) {
3601
- return z(r, { ...e, style: "grouped" });
3602
- },
3603
- /**
3604
- * Inset section styling
3605
- */
3606
- Inset(r, e = {}) {
3607
- return z(r, { ...e, style: "inset" });
3608
- },
3609
- /**
3610
- * Sidebar-style section
3611
- */
3612
- Sidebar(r, e = {}) {
3613
- return z(r, { ...e, style: "sidebar" });
3614
- },
3615
- /**
3616
- * Plain section without styling
3617
- */
3618
- Plain(r, e = {}) {
3619
- return z(r, { ...e, style: "plain" });
3620
- },
3621
- /**
3622
- * Collapsible section
3623
- */
3624
- Collapsible(r, e, t = !1, i = {}) {
3625
- return z(e, {
3626
- ...i,
3627
- header: r,
3628
- collapsible: !0,
3629
- collapsed: t
3630
- });
3631
- }
3632
- };
3633
- var Qe = Object.defineProperty, Ze = (r, e, t) => e in r ? Qe(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, V = (r, e, t) => Ze(r, typeof e != "symbol" ? e + "" : e, t);
3634
- class Je {
3635
- constructor(e) {
3636
- this.props = e, V(this, "type", "component"), V(this, "id"), V(this, "mounted", !1), V(this, "cleanup", []), V(this, "toggleElement", null), V(this, "setIsAnimating"), V(this, "handleToggle", async (i) => {
3637
- if (i.preventDefault(), this.isDisabled()) return;
3638
- const s = !this.getIsOn();
3639
- this.props.animated !== !1 && (this.setIsAnimating(!0), setTimeout(() => {
3640
- this.setIsAnimating(!1);
3641
- }, 200)), this.props.onToggle && this.props.onToggle(s);
3642
- }), this.id = `toggle-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
3643
- const [, t] = $(!1);
3644
- this.setIsAnimating = t, D(() => {
3645
- const i = this.getIsOn();
3646
- this.toggleElement && this.toggleElement.checked !== i && (this.toggleElement.checked = i);
3647
- });
3648
- }
3649
- /**
3650
- * Get current toggle state
3651
- */
3652
- getIsOn() {
3653
- const { isOn: e } = this.props;
3654
- return f(e) ? e() : e;
3655
- }
3656
- // /**
3657
- // * Get toggle state as signal or static value for DOM renderer
3658
- // */
3659
- // private getIsOnForDOM(): boolean | (() => boolean) {
3660
- // const { isOn } = this.props
3661
- // if (isSignal(isOn)) {
3662
- // return isOn as () => boolean
3663
- // }
3664
- // return isOn as boolean
3665
- // }
3666
- /**
3667
- * Check if toggle is disabled
3668
- */
3669
- isDisabled() {
3670
- const { disabled: e } = this.props;
3671
- return typeof e == "boolean" ? e : f(e) ? e() : !1;
3672
- }
3673
- // /**
3674
- // * Get disabled state as signal or static value for DOM renderer
3675
- // */
3676
- // private getDisabledForDOM(): boolean | (() => boolean) {
3677
- // const { disabled } = this.props
3678
- // if (typeof disabled === 'boolean') return disabled
3679
- // if (isSignal(disabled)) return disabled as () => boolean
3680
- // return false
3681
- // }
3682
- /**
3683
- * Resolve label content
3684
- */
3685
- resolveLabel() {
3686
- const { label: e } = this.props;
3687
- return e ? typeof e == "string" ? e : typeof e == "function" || f(e) ? e() : e : null;
3688
- }
3689
- /**
3690
- * Helper to render component content safely
3691
- */
3692
- renderComponentContent(e) {
3693
- const t = e.render();
3694
- return Array.isArray(t) ? t : [t];
3695
- }
3696
- /**
3697
- * Get toggle size styles
3698
- */
3699
- getSizeStyles() {
3700
- const { size: e = "medium" } = this.props;
3701
- switch (e) {
3702
- case "small":
3703
- return {
3704
- width: "36px",
3705
- height: "20px",
3706
- thumbSize: "16px",
3707
- fontSize: "14px"
3708
- };
3709
- case "large":
3710
- return {
3711
- width: "56px",
3712
- height: "32px",
3713
- thumbSize: "28px",
3714
- fontSize: "18px"
3715
- };
3716
- default:
3717
- return {
3718
- width: "46px",
3719
- height: "26px",
3720
- thumbSize: "22px",
3721
- fontSize: "16px"
3722
- };
3723
- }
3724
- }
3725
- /**
3726
- * Render switch variant
3727
- */
3728
- renderSwitch() {
3729
- const e = this.getIsOn(), t = this.isDisabled(), i = this.getSizeStyles(), {
3730
- color: s = "#007AFF",
3731
- offColor: n = "#e2e8f0",
3732
- thumbColor: o = "#ffffff",
3733
- animated: a = !0
3734
- } = this.props, l = e ? s : n, u = e ? `translateX(${parseInt(i.width) - parseInt(i.thumbSize) - 2}px)` : "translateX(2px)";
3735
- return d(
3736
- "div",
3737
- {
3738
- style: {
3739
- position: "relative",
3740
- display: "inline-block"
3741
- }
3742
- },
3743
- // Hidden input for form integration
3744
- d("input", {
3745
- ref: (c) => {
3746
- this.toggleElement = c, c && !this.mounted && (c.addEventListener("change", this.handleToggle), this.cleanup.push(() => {
3747
- c.removeEventListener("change", this.handleToggle);
3748
- }));
3749
- },
3750
- type: "checkbox",
3751
- checked: e,
3752
- disabled: t,
3753
- style: {
3754
- position: "absolute",
3755
- opacity: 0,
3756
- width: "100%",
3757
- height: "100%",
3758
- margin: 0,
3759
- cursor: t ? "not-allowed" : "pointer"
3760
- },
3761
- "aria-label": this.props.accessibilityLabel,
3762
- "aria-describedby": this.props.accessibilityHint ? `${this.id}-hint` : void 0
3763
- }),
3764
- // Switch track
3765
- d(
3766
- "div",
3767
- {
3768
- style: {
3769
- width: i.width,
3770
- height: i.height,
3771
- backgroundColor: l,
3772
- borderRadius: i.height,
3773
- position: "relative",
3774
- cursor: t ? "not-allowed" : "pointer",
3775
- opacity: t ? 0.5 : 1,
3776
- transition: a ? "background-color 0.2s ease" : "none",
3777
- border: "1px solid rgba(0,0,0,0.1)",
3778
- boxShadow: "inset 0 1px 2px rgba(0,0,0,0.1)"
3779
- },
3780
- onClick: this.handleToggle
3781
- },
3782
- // Switch thumb
3783
- d("div", {
3784
- style: {
3785
- width: i.thumbSize,
3786
- height: i.thumbSize,
3787
- backgroundColor: o,
3788
- borderRadius: "50%",
3789
- position: "absolute",
3790
- top: "50%",
3791
- transform: `translateY(-50%) ${u}`,
3792
- transition: a ? "transform 0.2s ease" : "none",
3793
- boxShadow: "0 2px 4px rgba(0,0,0,0.2)",
3794
- border: "1px solid rgba(0,0,0,0.1)"
3795
- }
3796
- })
3797
- )
3798
- );
3799
- }
3800
- /**
3801
- * Render checkbox variant
3802
- */
3803
- renderCheckbox() {
3804
- const e = this.getIsOn(), t = this.isDisabled(), i = this.getSizeStyles(), { color: s = "#007AFF" } = this.props;
3805
- return d(
3806
- "div",
3807
- {
3808
- style: {
3809
- position: "relative",
3810
- display: "inline-block"
3811
- }
3812
- },
3813
- // Hidden input
3814
- d("input", {
3815
- ref: (n) => {
3816
- this.toggleElement = n, n && !this.mounted && (n.addEventListener("change", this.handleToggle), this.cleanup.push(() => {
3817
- n.removeEventListener("change", this.handleToggle);
3818
- }));
3819
- },
3820
- type: "checkbox",
3821
- checked: e,
3822
- disabled: t,
3823
- style: {
3824
- position: "absolute",
3825
- opacity: 0,
3826
- width: "100%",
3827
- height: "100%",
3828
- margin: 0,
3829
- cursor: t ? "not-allowed" : "pointer"
3830
- }
3831
- }),
3832
- // Checkbox visual
3833
- d(
3834
- "div",
3835
- {
3836
- style: {
3837
- width: i.thumbSize,
3838
- height: i.thumbSize,
3839
- border: `2px solid ${e ? s : "#d1d5db"}`,
3840
- borderRadius: "4px",
3841
- backgroundColor: e ? s : "#ffffff",
3842
- display: "flex",
3843
- alignItems: "center",
3844
- justifyContent: "center",
3845
- cursor: t ? "not-allowed" : "pointer",
3846
- opacity: t ? 0.5 : 1,
3847
- transition: "all 0.2s ease"
3848
- },
3849
- onClick: this.handleToggle
3850
- },
3851
- ...e ? [
3852
- // Checkmark
3853
- d("div", {
3854
- style: {
3855
- width: "6px",
3856
- height: "10px",
3857
- border: "2px solid white",
3858
- borderTop: "none",
3859
- borderLeft: "none",
3860
- transform: "rotate(45deg) translateY(-1px)",
3861
- opacity: e ? 1 : 0,
3862
- transition: "opacity 0.1s ease"
3863
- }
3864
- })
3865
- ] : []
3866
- )
3867
- );
3868
- }
3869
- /**
3870
- * Render button variant
3871
- */
3872
- renderButton() {
3873
- const e = this.getIsOn(), t = this.isDisabled(), i = this.getSizeStyles(), { color: s = "#007AFF", offColor: n = "#f3f4f6" } = this.props;
3874
- return d(
3875
- "button",
3876
- {
3877
- ref: (o) => {
3878
- o && !this.mounted && (o.addEventListener("click", this.handleToggle), this.cleanup.push(() => {
3879
- o.removeEventListener("click", this.handleToggle);
3880
- }));
3881
- },
3882
- type: "button",
3883
- disabled: t,
3884
- style: {
3885
- padding: "8px 16px",
3886
- backgroundColor: e ? s : n,
3887
- color: e ? "#ffffff" : "#374151",
3888
- border: `1px solid ${e ? s : "#d1d5db"}`,
3889
- borderRadius: "6px",
3890
- fontSize: i.fontSize,
3891
- fontWeight: "500",
3892
- cursor: t ? "not-allowed" : "pointer",
3893
- opacity: t ? 0.5 : 1,
3894
- transition: "all 0.2s ease",
3895
- outline: "none"
3896
- },
3897
- "aria-pressed": e,
3898
- "aria-label": this.props.accessibilityLabel
3899
- },
3900
- S(e ? "ON" : "OFF")
3901
- );
3902
- }
3903
- /**
3904
- * Render toggle control based on variant
3905
- */
3906
- renderToggleControl() {
3907
- const { variant: e = "switch" } = this.props;
3908
- switch (e) {
3909
- case "checkbox":
3910
- return this.renderCheckbox();
3911
- case "button":
3912
- return this.renderButton();
3913
- default:
3914
- return this.renderSwitch();
3915
- }
3916
- }
3917
- /**
3918
- * Render label content
3919
- */
3920
- renderLabel() {
3921
- const e = this.resolveLabel();
3922
- if (!e) return null;
3923
- const t = this.getSizeStyles();
3924
- return d(
3925
- "span",
3926
- {
3927
- style: {
3928
- fontSize: t.fontSize,
3929
- color: this.isDisabled() ? "#9ca3af" : "#374151",
3930
- cursor: this.isDisabled() ? "not-allowed" : "pointer"
3931
- },
3932
- onClick: this.isDisabled() ? void 0 : this.handleToggle
3933
- },
3934
- ...typeof e == "string" ? [S(e)] : this.renderComponentContent(e)
3935
- );
3936
- }
3937
- render() {
3938
- const { labelPosition: e = "trailing", spacing: t = 8, accessibilityHint: i } = this.props, s = this.renderLabel(), n = this.renderToggleControl(), o = e === "leading" && s ? [s, n] : s ? [n, s] : [n];
3939
- return d(
3940
- "div",
3941
- {
3942
- style: {
3943
- display: "flex",
3944
- alignItems: "center",
3945
- gap: s ? `${t}px` : "0",
3946
- cursor: this.isDisabled() ? "not-allowed" : "pointer"
3947
- },
3948
- "aria-describedby": i ? `${this.id}-hint` : void 0
3949
- },
3950
- ...o,
3951
- ...i ? [
3952
- d(
3953
- "div",
3954
- {
3955
- id: `${this.id}-hint`,
3956
- style: {
3957
- fontSize: "12px",
3958
- color: "#6b7280",
3959
- marginTop: "4px",
3960
- display: "block",
3961
- width: "100%"
3962
- }
3963
- },
3964
- S(i)
3965
- )
3966
- ] : []
3967
- );
3968
- }
3969
- }
3970
- function O(r, e = {}) {
3971
- const t = { ...e, isOn: r }, i = new Je(t);
3972
- return I(i);
3973
- }
3974
- function ae(r, e, t = {}) {
3975
- return O(e, { ...t, label: r });
3976
- }
3977
- const kt = {
3978
- /**
3979
- * Switch toggle (default)
3980
- */
3981
- Switch(r, e = {}) {
3982
- return O(r, { ...e, variant: "switch" });
3983
- },
3984
- /**
3985
- * Checkbox toggle
3986
- */
3987
- Checkbox(r, e = {}) {
3988
- return O(r, { ...e, variant: "checkbox" });
3989
- },
3990
- /**
3991
- * Button toggle
3992
- */
3993
- Button(r, e = {}) {
3994
- return O(r, { ...e, variant: "button" });
3995
- },
3996
- /**
3997
- * Small toggle
3998
- */
3999
- Small(r, e = {}) {
4000
- return O(r, { ...e, size: "small" });
4001
- },
4002
- /**
4003
- * Large toggle
4004
- */
4005
- Large(r, e = {}) {
4006
- return O(r, { ...e, size: "large" });
4007
- },
4008
- /**
4009
- * Custom color toggle
4010
- */
4011
- CustomColor(r, e, t = {}) {
4012
- return O(r, { ...t, color: e });
4013
- },
4014
- /**
4015
- * Toggle with leading label
4016
- */
4017
- WithLeadingLabel(r, e, t = {}) {
4018
- return O(e, { ...t, label: r, labelPosition: "leading" });
4019
- },
4020
- /**
4021
- * Toggle with trailing label (default)
4022
- */
4023
- WithTrailingLabel(r, e, t = {}) {
4024
- return O(e, { ...t, label: r, labelPosition: "trailing" });
4025
- }
4026
- }, Et = {
4027
- /**
4028
- * Create a toggle group with multiple options
4029
- */
4030
- createGroup(r, e = {}) {
4031
- return r.map(
4032
- (t) => ae(t.label, t.isOn, {
4033
- ...e,
4034
- onToggle: t.onToggle
4035
- })
4036
- );
4037
- },
4038
- /**
4039
- * Create exclusive toggle group (radio-like behavior)
4040
- */
4041
- createExclusiveGroup(r, e, t, i = {}) {
4042
- const s = () => f(e) ? e() : e;
4043
- return r.map(
4044
- (n) => ae(n.label, s() === n.key, {
4045
- ...i,
4046
- onToggle: (o) => {
4047
- o && t && t(n.key);
4048
- }
4049
- })
4050
- );
4051
- },
4052
- /**
4053
- * Batch toggle operations
4054
- */
4055
- batch: {
4056
- /**
4057
- * Toggle all items in a group
4058
- */
4059
- toggleAll(r, e) {
4060
- r.forEach((t) => {
4061
- t.onToggle && t.onToggle(e);
4062
- });
4063
- },
4064
- /**
4065
- * Get state of all toggles in a group
4066
- */
4067
- getStates(r) {
4068
- return r.map((e) => f(e.isOn) ? e.isOn() : e.isOn);
4069
- },
4070
- /**
4071
- * Check if all toggles are on
4072
- */
4073
- allOn(r) {
4074
- return this.getStates(r).every((e) => e);
4075
- },
4076
- /**
4077
- * Check if any toggle is on
4078
- */
4079
- anyOn(r) {
4080
- return this.getStates(r).some((e) => e);
4081
- }
4082
- }
4083
- };
1
+ import { L as o, c as r, a as t, w as i, b as p, d as s } from "../index-vdsiw6gQ.js";
4084
2
  export {
4085
- ne as BaseGridComponent,
4086
- X as BasicForm,
4087
- Fe as BasicFormImplementation,
4088
- ut as BasicFormStyles,
4089
- ht as BasicFormValidation,
4090
- Lt as BasicInput,
4091
- Mt as BasicInputStyles,
4092
- Ot as BasicInputUtils,
4093
- Tt as Button,
4094
- zt as ButtonStyles,
4095
- pi as Divider,
4096
- ui as DividerStyles,
4097
- hi as DividerUtils,
4098
- Dt as EnhancedButton,
4099
- Le as EnhancedGrid,
4100
- Me as EnhancedGridRow,
4101
- Ft as EnhancedImage,
4102
- Te as EnhancedLazyHGrid,
4103
- Oe as EnhancedLazyVGrid,
4104
- He as EnhancedList,
4105
- qe as EnhancedPicker,
4106
- fi as EnhancedScrollView,
4107
- Ke as EnhancedSection,
4108
- Je as EnhancedToggle,
4109
- gt as For,
4110
- pe as ForEach,
4111
- mt as ForEachComponent,
4112
- lt as Grid,
4113
- y as GridCSSGenerator,
4114
- at as GridItem,
4115
- ct as GridRow,
4116
- Gt as H1,
4117
- Pt as H2,
4118
- Vt as H3,
4119
- _t as H4,
4120
- Ht as H5,
4121
- jt as H6,
4122
- Nt as HStack,
4123
- Bt as HTML,
4124
- Wt as Image,
4125
- Ut as ImageContentModes,
4126
- qt as ImageStates,
4127
- Yt as ImageUtils,
4128
- Xt as Layout,
4129
- pt as LazyHGrid,
4130
- dt as LazyVGrid,
4131
- ft as Link,
4132
- P as LinkUtils,
4133
- K as List,
4134
- bt as ListUtils,
4135
- yt as Menu,
4136
- xt as MenuStyles,
4137
- St as MenuUtils,
4138
- Q as Picker,
4139
- vt as PickerStyles,
4140
- Ct as PickerUtils,
4141
- $e as ScrollView,
4142
- mi as ScrollViewUtils,
4143
- z as Section,
4144
- It as SectionStyles,
4145
- wt as SectionWithHeader,
4146
- $t as SectionWithHeaderFooter,
4147
- Kt as Show,
4148
- Qt as Spacer,
4149
- re as Text,
4150
- Zt as TextFormat,
4151
- Jt as TextStyles,
4152
- O as Toggle,
4153
- kt as ToggleStyles,
4154
- Et as ToggleUtils,
4155
- ae as ToggleWithLabel,
4156
- ei as Typography,
4157
- ti as Unless,
4158
- ii as VStack,
4159
- si as When,
4160
- ni as ZStack,
4161
- ri as createModifiableComponentFactory,
4162
- oi as createReactiveWrapper,
4163
- ai as defaultButtonTheme,
4164
- gi as defaultDividerTheme,
4165
- W as defaultMenuTheme,
4166
- li as withModifierSupport,
4167
- I as withModifiers,
4168
- ci as wrapComponent
3
+ o as Layout,
4
+ r as createModifiableComponentFactory,
5
+ t as createReactiveWrapper,
6
+ i as withModifierSupport,
7
+ p as withModifiers,
8
+ s as wrapComponent
4169
9
  };