@strata-ds/core 2.1.0

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 (42) hide show
  1. package/README.md +438 -0
  2. package/dist/components/DynamicComponentDebug.d.ts +3 -0
  3. package/dist/components/DynamicComponentDebug.d.ts.map +1 -0
  4. package/dist/components/DynamicComponents.d.ts +12 -0
  5. package/dist/components/DynamicComponents.d.ts.map +1 -0
  6. package/dist/components/card-ui/Card.d.ts +40 -0
  7. package/dist/components/card-ui/Card.d.ts.map +1 -0
  8. package/dist/components/card-ui/DefaultCard.d.ts +3 -0
  9. package/dist/components/card-ui/DefaultCard.d.ts.map +1 -0
  10. package/dist/components/index.d.ts +4 -0
  11. package/dist/components/index.d.ts.map +1 -0
  12. package/dist/data/index.d.ts +2 -0
  13. package/dist/data/index.d.ts.map +1 -0
  14. package/dist/data/mock.types.d.ts +70 -0
  15. package/dist/data/mock.types.d.ts.map +1 -0
  16. package/dist/hook/useCardData.d.ts +371 -0
  17. package/dist/hook/useCardData.d.ts.map +1 -0
  18. package/dist/hook/useComponent.d.ts +4 -0
  19. package/dist/hook/useComponent.d.ts.map +1 -0
  20. package/dist/hook/useComponents.d.ts +2 -0
  21. package/dist/hook/useComponents.d.ts.map +1 -0
  22. package/dist/hook/useDesignSystemSync.d.ts +1 -0
  23. package/dist/hook/useDesignSystemSync.d.ts.map +1 -0
  24. package/dist/hook/useDynamicComponents.d.ts +3 -0
  25. package/dist/hook/useDynamicComponents.d.ts.map +1 -0
  26. package/dist/index.d.ts +440 -0
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/index.esm.js +3049 -0
  29. package/dist/index.esm.js.map +1 -0
  30. package/dist/index.js +3062 -0
  31. package/dist/index.js.map +1 -0
  32. package/dist/providers/StrataProvider.d.ts +60 -0
  33. package/dist/providers/StrataProvider.d.ts.map +1 -0
  34. package/dist/providers/index.d.ts +2 -0
  35. package/dist/providers/index.d.ts.map +1 -0
  36. package/dist/registry/ComponentFactory.d.ts +39 -0
  37. package/dist/registry/ComponentFactory.d.ts.map +1 -0
  38. package/dist/registry/ComponentRegistry.d.ts +29 -0
  39. package/dist/registry/ComponentRegistry.d.ts.map +1 -0
  40. package/dist/types/card-types.d.ts +185 -0
  41. package/dist/types/card-types.d.ts.map +1 -0
  42. package/package.json +74 -0
@@ -0,0 +1,3049 @@
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
+ import React, { useState, useRef, useMemo, useCallback, useEffect, createContext, useContext } from 'react';
3
+ import { extendTheme, ChakraProvider, Box, Flex, Text, Image, Button, VStack, HStack } from '@chakra-ui/react';
4
+
5
+ function _arrayLikeToArray(r, a) {
6
+ (null == a || a > r.length) && (a = r.length);
7
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
8
+ return n;
9
+ }
10
+ function _arrayWithHoles(r) {
11
+ if (Array.isArray(r)) return r;
12
+ }
13
+ function asyncGeneratorStep(n, t, e, r, o, a, c) {
14
+ try {
15
+ var i = n[a](c),
16
+ u = i.value;
17
+ } catch (n) {
18
+ return void e(n);
19
+ }
20
+ i.done ? t(u) : Promise.resolve(u).then(r, o);
21
+ }
22
+ function _asyncToGenerator(n) {
23
+ return function () {
24
+ var t = this,
25
+ e = arguments;
26
+ return new Promise(function (r, o) {
27
+ var a = n.apply(t, e);
28
+ function _next(n) {
29
+ asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
30
+ }
31
+ function _throw(n) {
32
+ asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
33
+ }
34
+ _next(void 0);
35
+ });
36
+ };
37
+ }
38
+ function _classCallCheck(a, n) {
39
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
40
+ }
41
+ function _defineProperties(e, r) {
42
+ for (var t = 0; t < r.length; t++) {
43
+ var o = r[t];
44
+ o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey(o.key), o);
45
+ }
46
+ }
47
+ function _createClass(e, r, t) {
48
+ return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
49
+ writable: false
50
+ }), e;
51
+ }
52
+ function _defineProperty(e, r, t) {
53
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
54
+ value: t,
55
+ enumerable: true,
56
+ configurable: true,
57
+ writable: true
58
+ }) : e[r] = t, e;
59
+ }
60
+ function _iterableToArrayLimit(r, l) {
61
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
62
+ if (null != t) {
63
+ var e,
64
+ n,
65
+ i,
66
+ u,
67
+ a = [],
68
+ f = true,
69
+ o = false;
70
+ try {
71
+ if (i = (t = t.call(r)).next, 0 === l) {
72
+ if (Object(t) !== t) return;
73
+ f = !1;
74
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
75
+ } catch (r) {
76
+ o = true, n = r;
77
+ } finally {
78
+ try {
79
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
80
+ } finally {
81
+ if (o) throw n;
82
+ }
83
+ }
84
+ return a;
85
+ }
86
+ }
87
+ function _nonIterableRest() {
88
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
89
+ }
90
+ function ownKeys(e, r) {
91
+ var t = Object.keys(e);
92
+ if (Object.getOwnPropertySymbols) {
93
+ var o = Object.getOwnPropertySymbols(e);
94
+ r && (o = o.filter(function (r) {
95
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
96
+ })), t.push.apply(t, o);
97
+ }
98
+ return t;
99
+ }
100
+ function _objectSpread2(e) {
101
+ for (var r = 1; r < arguments.length; r++) {
102
+ var t = null != arguments[r] ? arguments[r] : {};
103
+ r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
104
+ _defineProperty(e, r, t[r]);
105
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
106
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
107
+ });
108
+ }
109
+ return e;
110
+ }
111
+ function _objectWithoutProperties(e, t) {
112
+ if (null == e) return {};
113
+ var o,
114
+ r,
115
+ i = _objectWithoutPropertiesLoose(e, t);
116
+ if (Object.getOwnPropertySymbols) {
117
+ var n = Object.getOwnPropertySymbols(e);
118
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
119
+ }
120
+ return i;
121
+ }
122
+ function _objectWithoutPropertiesLoose(r, e) {
123
+ if (null == r) return {};
124
+ var t = {};
125
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
126
+ if (-1 !== e.indexOf(n)) continue;
127
+ t[n] = r[n];
128
+ }
129
+ return t;
130
+ }
131
+ function _regenerator() {
132
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
133
+ var e,
134
+ t,
135
+ r = "function" == typeof Symbol ? Symbol : {},
136
+ n = r.iterator || "@@iterator",
137
+ o = r.toStringTag || "@@toStringTag";
138
+ function i(r, n, o, i) {
139
+ var c = n && n.prototype instanceof Generator ? n : Generator,
140
+ u = Object.create(c.prototype);
141
+ return _regeneratorDefine(u, "_invoke", function (r, n, o) {
142
+ var i,
143
+ c,
144
+ u,
145
+ f = 0,
146
+ p = o || [],
147
+ y = false,
148
+ G = {
149
+ p: 0,
150
+ n: 0,
151
+ v: e,
152
+ a: d,
153
+ f: d.bind(e, 4),
154
+ d: function (t, r) {
155
+ return i = t, c = 0, u = e, G.n = r, a;
156
+ }
157
+ };
158
+ function d(r, n) {
159
+ for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
160
+ var o,
161
+ i = p[t],
162
+ d = G.p,
163
+ l = i[2];
164
+ r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
165
+ }
166
+ if (o || r > 1) return a;
167
+ throw y = true, n;
168
+ }
169
+ return function (o, p, l) {
170
+ if (f > 1) throw TypeError("Generator is already running");
171
+ for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
172
+ i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
173
+ try {
174
+ if (f = 2, i) {
175
+ if (c || (o = "next"), t = i[o]) {
176
+ if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
177
+ if (!t.done) return t;
178
+ u = t.value, c < 2 && (c = 0);
179
+ } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
180
+ i = e;
181
+ } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
182
+ } catch (t) {
183
+ i = e, c = 1, u = t;
184
+ } finally {
185
+ f = 1;
186
+ }
187
+ }
188
+ return {
189
+ value: t,
190
+ done: y
191
+ };
192
+ };
193
+ }(r, o, i), true), u;
194
+ }
195
+ var a = {};
196
+ function Generator() {}
197
+ function GeneratorFunction() {}
198
+ function GeneratorFunctionPrototype() {}
199
+ t = Object.getPrototypeOf;
200
+ var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
201
+ return this;
202
+ }), t),
203
+ u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
204
+ function f(e) {
205
+ return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
206
+ }
207
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
208
+ return this;
209
+ }), _regeneratorDefine(u, "toString", function () {
210
+ return "[object Generator]";
211
+ }), (_regenerator = function () {
212
+ return {
213
+ w: i,
214
+ m: f
215
+ };
216
+ })();
217
+ }
218
+ function _regeneratorDefine(e, r, n, t) {
219
+ var i = Object.defineProperty;
220
+ try {
221
+ i({}, "", {});
222
+ } catch (e) {
223
+ i = 0;
224
+ }
225
+ _regeneratorDefine = function (e, r, n, t) {
226
+ function o(r, n) {
227
+ _regeneratorDefine(e, r, function (e) {
228
+ return this._invoke(r, n, e);
229
+ });
230
+ }
231
+ r ? i ? i(e, r, {
232
+ value: n,
233
+ enumerable: !t,
234
+ configurable: !t,
235
+ writable: !t
236
+ }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
237
+ }, _regeneratorDefine(e, r, n, t);
238
+ }
239
+ function _slicedToArray(r, e) {
240
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
241
+ }
242
+ function _toPrimitive(t, r) {
243
+ if ("object" != typeof t || !t) return t;
244
+ var e = t[Symbol.toPrimitive];
245
+ if (void 0 !== e) {
246
+ var i = e.call(t, r);
247
+ if ("object" != typeof i) return i;
248
+ throw new TypeError("@@toPrimitive must return a primitive value.");
249
+ }
250
+ return (String )(t);
251
+ }
252
+ function _toPropertyKey(t) {
253
+ var i = _toPrimitive(t, "string");
254
+ return "symbol" == typeof i ? i : i + "";
255
+ }
256
+ function _typeof(o) {
257
+ "@babel/helpers - typeof";
258
+
259
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
260
+ return typeof o;
261
+ } : function (o) {
262
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
263
+ }, _typeof(o);
264
+ }
265
+ function _unsupportedIterableToArray(r, a) {
266
+ if (r) {
267
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
268
+ var t = {}.toString.call(r).slice(8, -1);
269
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
270
+ }
271
+ }
272
+
273
+ var _excluded$2 = ["children", "style", "className"],
274
+ _excluded2$2 = ["children", "style", "className"],
275
+ _excluded3$1 = ["key", "ref", "children", "style", "className"];
276
+ var StrataComponentFactory = /*#__PURE__*/function () {
277
+ function StrataComponentFactory() {
278
+ _classCallCheck(this, StrataComponentFactory);
279
+ }
280
+ return _createClass(StrataComponentFactory, null, [{
281
+ key: "createComponent",
282
+ value:
283
+ // Create component with enhanced attribute handling
284
+ function createComponent(componentName, componentData, designSystem) {
285
+ var _this = this;
286
+ var Component = function Component(_ref) {
287
+ var children = _ref.children,
288
+ style = _ref.style,
289
+ className = _ref.className,
290
+ props = _objectWithoutProperties(_ref, _excluded$2);
291
+ var componentStyle = _this.resolveComponentStyles(componentData, designSystem);
292
+ var mergedStyle = _objectSpread2(_objectSpread2({}, componentStyle), style);
293
+ // Determine the HTML tag - use linkedElement or infer from component name
294
+ var htmlTag = _this.determineHtmlTag(componentData, componentName);
295
+ // Process ALL attributes including linked ones and passed props
296
+ var allAttributes = _this.processAllAttributes(props, componentData.linkedElement, htmlTag, designSystem);
297
+ return /*#__PURE__*/React.createElement(htmlTag, _objectSpread2({
298
+ style: mergedStyle,
299
+ className: _this.mergeClassNames(className, allAttributes["class"])
300
+ }, _this.cleanAttributes(allAttributes)), children || componentData.textContent);
301
+ };
302
+ Component.displayName = componentName;
303
+ return Component;
304
+ }
305
+ // Create sub-component with same enhanced attribute handling
306
+ }, {
307
+ key: "createSubComponent",
308
+ value: function createSubComponent(componentName, componentData, designSystem) {
309
+ var _this2 = this;
310
+ var SubComponent = function SubComponent(_ref2) {
311
+ var children = _ref2.children,
312
+ style = _ref2.style,
313
+ className = _ref2.className,
314
+ props = _objectWithoutProperties(_ref2, _excluded2$2);
315
+ var componentStyle = _this2.resolveComponentStyles(componentData, designSystem);
316
+ var mergedStyle = _objectSpread2(_objectSpread2({}, componentStyle), style);
317
+ var htmlTag = _this2.determineHtmlTag(componentData, componentName);
318
+ var allAttributes = _this2.processAllAttributes(props, componentData.linkedElement, htmlTag, designSystem);
319
+ return /*#__PURE__*/React.createElement(htmlTag, _objectSpread2({
320
+ style: mergedStyle,
321
+ className: _this2.mergeClassNames(className, allAttributes["class"])
322
+ }, _this2.cleanAttributes(allAttributes)), children || componentData.textContent);
323
+ };
324
+ SubComponent.displayName = componentName;
325
+ return SubComponent;
326
+ }
327
+ // Process both linked attributes and passed props
328
+ }, {
329
+ key: "processAllAttributes",
330
+ value: function processAllAttributes(props, linkedElement, htmlTag, designSystem) {
331
+ // Start with linked element attributes
332
+ var linkedAttributes = (linkedElement === null || linkedElement === void 0 ? void 0 : linkedElement.attributes) || {};
333
+ // Resolve CSS variables in linked attributes
334
+ var resolvedLinkedAttributes = this.resolveAttributesWithVariables(linkedAttributes, designSystem);
335
+ // Merge with passed props (props take precedence)
336
+ var mergedAttributes = _objectSpread2(_objectSpread2({}, resolvedLinkedAttributes), props);
337
+ // Clean and process the merged attributes
338
+ return this.processHtmlAttributes(mergedAttributes, htmlTag, designSystem);
339
+ }
340
+ // Resolve CSS variables in attribute values
341
+ }, {
342
+ key: "resolveAttributesWithVariables",
343
+ value: function resolveAttributesWithVariables(attributes, designSystem) {
344
+ var _this3 = this;
345
+ var resolved = {};
346
+ Object.entries(attributes).forEach(function (_ref3) {
347
+ var _ref4 = _slicedToArray(_ref3, 2),
348
+ key = _ref4[0],
349
+ value = _ref4[1];
350
+ if (typeof value === 'string') {
351
+ resolved[key] = _this3.resolveCssVariables(value, designSystem);
352
+ } else {
353
+ resolved[key] = value;
354
+ }
355
+ });
356
+ return resolved;
357
+ }
358
+ // Enhanced CSS variable resolution
359
+ }, {
360
+ key: "resolveCssVariables",
361
+ value: function resolveCssVariables(value, designSystem) {
362
+ return value.replace(/var\(--([^)]+)\)/g, function (match, varName) {
363
+ var variable = designSystem.variables["--".concat(varName)];
364
+ if (variable) {
365
+ return variable.value + (variable.unit || '');
366
+ }
367
+ return match; // Return original if variable not found
368
+ });
369
+ }
370
+ // Enhanced HTML attribute processing with type-specific validation
371
+ }, {
372
+ key: "processHtmlAttributes",
373
+ value: function processHtmlAttributes(attributes, htmlTag, designSystem) {
374
+ attributes.key;
375
+ attributes.ref;
376
+ attributes.children;
377
+ attributes.style;
378
+ attributes.className;
379
+ var cleanProps = _objectWithoutProperties(attributes, _excluded3$1);
380
+ var processed = _objectSpread2({}, cleanProps);
381
+ // Element-specific attribute processing
382
+ switch (htmlTag) {
383
+ case 'img':
384
+ this.processImageAttributes(processed);
385
+ break;
386
+ case 'input':
387
+ this.processInputAttributes(processed);
388
+ break;
389
+ case 'button':
390
+ this.processButtonAttributes(processed);
391
+ break;
392
+ case 'a':
393
+ this.processLinkAttributes(processed);
394
+ break;
395
+ case 'textarea':
396
+ this.processTextareaAttributes(processed);
397
+ break;
398
+ case 'video':
399
+ this.processVideoAttributes(processed);
400
+ break;
401
+ case 'audio':
402
+ this.processAudioAttributes(processed);
403
+ break;
404
+ case 'form':
405
+ this.processFormAttributes(processed);
406
+ break;
407
+ case 'select':
408
+ this.processSelectAttributes(processed);
409
+ break;
410
+ case 'svg':
411
+ this.processSvgAttributes(processed);
412
+ break;
413
+ case 'canvas':
414
+ this.processCanvasAttributes(processed);
415
+ break;
416
+ }
417
+ // Remove any undefined or null values
418
+ Object.keys(processed).forEach(function (key) {
419
+ if (processed[key] === undefined || processed[key] === null) {
420
+ delete processed[key];
421
+ }
422
+ });
423
+ return processed;
424
+ }
425
+ // Specific attribute processors for different HTML elements
426
+ }, {
427
+ key: "processInputAttributes",
428
+ value: function processInputAttributes(attrs) {
429
+ if (!attrs.type) {
430
+ var name = (attrs.name || '').toLowerCase();
431
+ if (name.includes('email')) attrs.type = 'email';else if (name.includes('password')) attrs.type = 'password';else if (name.includes('number') || name.includes('tel')) attrs.type = 'number';else if (name.includes('url')) attrs.type = 'url';else if (name.includes('search')) attrs.type = 'search';else if (name.includes('file')) attrs.type = 'file';else if (name.includes('checkbox')) attrs.type = 'checkbox';else if (name.includes('radio')) attrs.type = 'radio';else attrs.type = 'text';
432
+ }
433
+ // Add placeholder if missing for text-like inputs
434
+ if (!attrs.placeholder && ['text', 'email', 'password', 'search', 'url'].includes(attrs.type)) {
435
+ attrs.placeholder = "Enter ".concat(attrs.name || 'text');
436
+ }
437
+ // Ensure name attribute for form inputs
438
+ if (!attrs.name && attrs.id) {
439
+ attrs.name = attrs.id;
440
+ }
441
+ }
442
+ }, {
443
+ key: "processButtonAttributes",
444
+ value: function processButtonAttributes(attrs) {
445
+ if (!attrs.type) {
446
+ attrs.type = 'button';
447
+ }
448
+ // Add accessible default if no text content
449
+ if (!attrs['aria-label'] && !attrs.children) {
450
+ attrs['aria-label'] = 'Button';
451
+ }
452
+ }
453
+ }, {
454
+ key: "processImageAttributes",
455
+ value: function processImageAttributes(attrs) {
456
+ if (!attrs.alt) {
457
+ attrs.alt = 'Image';
458
+ }
459
+ if (!attrs.loading) {
460
+ attrs.loading = 'lazy';
461
+ }
462
+ // Handle missing or invalid src
463
+ if (attrs.src && !attrs.src.startsWith('http') && !attrs.src.startsWith('/') && !attrs.src.startsWith('data:')) {
464
+ // Provide a fallback placeholder image
465
+ attrs.src = "https://via.placeholder.com/200x150?text=Image+Placeholder";
466
+ }
467
+ }
468
+ }, {
469
+ key: "processLinkAttributes",
470
+ value: function processLinkAttributes(attrs) {
471
+ if (!attrs.href && attrs.onClick) {
472
+ attrs.href = '#';
473
+ }
474
+ if (attrs.target === '_blank' && !attrs.rel) {
475
+ attrs.rel = 'noopener noreferrer';
476
+ }
477
+ // Ensure href has a value
478
+ if (!attrs.href) {
479
+ attrs.href = '#';
480
+ }
481
+ }
482
+ }, {
483
+ key: "processTextareaAttributes",
484
+ value: function processTextareaAttributes(attrs) {
485
+ if (!attrs.rows) attrs.rows = '4';
486
+ if (!attrs.cols) attrs.cols = '50';
487
+ if (!attrs.placeholder) {
488
+ attrs.placeholder = 'Enter your text here...';
489
+ }
490
+ }
491
+ }, {
492
+ key: "processVideoAttributes",
493
+ value: function processVideoAttributes(attrs) {
494
+ if (!attrs.controls) attrs.controls = true;
495
+ if (!attrs.preload) attrs.preload = 'metadata';
496
+ }
497
+ }, {
498
+ key: "processAudioAttributes",
499
+ value: function processAudioAttributes(attrs) {
500
+ if (!attrs.controls) attrs.controls = true;
501
+ if (!attrs.preload) attrs.preload = 'metadata';
502
+ }
503
+ }, {
504
+ key: "processFormAttributes",
505
+ value: function processFormAttributes(attrs) {
506
+ if (!attrs.method) attrs.method = 'post';
507
+ if (!attrs.action) attrs.action = '#';
508
+ }
509
+ }, {
510
+ key: "processSelectAttributes",
511
+ value: function processSelectAttributes(attrs) {
512
+ if (!attrs.name) attrs.name = 'select-field';
513
+ }
514
+ }, {
515
+ key: "processSvgAttributes",
516
+ value: function processSvgAttributes(attrs) {
517
+ if (!attrs.viewBox && !attrs.width && !attrs.height) {
518
+ attrs.viewBox = '0 0 24 24';
519
+ }
520
+ if (!attrs.role) {
521
+ attrs.role = 'img';
522
+ }
523
+ if (!attrs['aria-hidden'] && !attrs['aria-label']) {
524
+ attrs['aria-hidden'] = 'true';
525
+ }
526
+ }
527
+ }, {
528
+ key: "processCanvasAttributes",
529
+ value: function processCanvasAttributes(attrs) {
530
+ if (!attrs.width) attrs.width = '300';
531
+ if (!attrs.height) attrs.height = '150';
532
+ }
533
+ // Helper to merge class names
534
+ }, {
535
+ key: "mergeClassNames",
536
+ value: function mergeClassNames() {
537
+ for (var _len = arguments.length, classes = new Array(_len), _key = 0; _key < _len; _key++) {
538
+ classes[_key] = arguments[_key];
539
+ }
540
+ return classes.filter(Boolean).join(' ').trim();
541
+ }
542
+ // Helper to clean attributes for React
543
+ }, {
544
+ key: "cleanAttributes",
545
+ value: function cleanAttributes(attrs) {
546
+ var cleaned = _objectSpread2({}, attrs);
547
+ // Remove class if it's empty after processing
548
+ if (cleaned["class"] === '') {
549
+ delete cleaned["class"];
550
+ }
551
+ // Convert boolean strings to actual booleans
552
+ Object.keys(cleaned).forEach(function (key) {
553
+ if (cleaned[key] === 'true') cleaned[key] = true;
554
+ if (cleaned[key] === 'false') cleaned[key] = false;
555
+ if (cleaned[key] === '') delete cleaned[key]; // Remove empty strings
556
+ });
557
+ // Remove React-specific props that shouldn't be passed to DOM
558
+ var reactProps = ['key', 'ref', 'children', 'style', 'className'];
559
+ reactProps.forEach(function (prop) {
560
+ delete cleaned[prop];
561
+ });
562
+ return cleaned;
563
+ }
564
+ // Determine HTML tag based on linkedElement or component name
565
+ }, {
566
+ key: "determineHtmlTag",
567
+ value: function determineHtmlTag(componentData, componentName) {
568
+ var _componentData$linked;
569
+ if ((_componentData$linked = componentData.linkedElement) !== null && _componentData$linked !== void 0 && _componentData$linked.htmlTag) {
570
+ return componentData.linkedElement.htmlTag;
571
+ }
572
+ var lowerName = componentName.toLowerCase();
573
+ // Comprehensive tag inference
574
+ if (lowerName.includes('input') || lowerName.includes('textfield') || lowerName.includes('textinput')) return 'input';
575
+ if (lowerName.includes('textarea') || lowerName.includes('textbox')) return 'textarea';
576
+ if (lowerName.includes('button') || lowerName.includes('btn')) return 'button';
577
+ if (lowerName.includes('form')) return 'form';
578
+ if (lowerName.includes('img') || lowerName.includes('image')) return 'img';
579
+ if (lowerName.includes('link') || lowerName.includes('anchor')) return 'a';
580
+ if (lowerName.includes('video')) return 'video';
581
+ if (lowerName.includes('audio')) return 'audio';
582
+ if (lowerName.includes('select') || lowerName.includes('dropdown')) return 'select';
583
+ if (lowerName.includes('list') || lowerName.includes('ul')) return 'ul';
584
+ if (lowerName.includes('listitem') || lowerName.includes('li')) return 'li';
585
+ if (lowerName.includes('table')) return 'table';
586
+ if (lowerName.includes('row') || lowerName.includes('tr')) return 'tr';
587
+ if (lowerName.includes('cell') || lowerName.includes('td')) return 'td';
588
+ if (lowerName.includes('header') || lowerName.includes('th')) return 'th';
589
+ if (lowerName.includes('heading') || lowerName.includes('h1')) return 'h1';
590
+ if (lowerName.includes('h2')) return 'h2';
591
+ if (lowerName.includes('h3')) return 'h3';
592
+ if (lowerName.includes('h4')) return 'h4';
593
+ if (lowerName.includes('h5')) return 'h5';
594
+ if (lowerName.includes('h6')) return 'h6';
595
+ if (lowerName.includes('paragraph') || lowerName.includes('p')) return 'p';
596
+ if (lowerName.includes('span')) return 'span';
597
+ if (lowerName.includes('div')) return 'div';
598
+ if (lowerName.includes('section')) return 'section';
599
+ if (lowerName.includes('article')) return 'article';
600
+ if (lowerName.includes('header')) return 'header';
601
+ if (lowerName.includes('footer')) return 'footer';
602
+ if (lowerName.includes('nav')) return 'nav';
603
+ if (lowerName.includes('main')) return 'main';
604
+ if (lowerName.includes('aside')) return 'aside';
605
+ if (lowerName.includes('svg')) return 'svg';
606
+ if (lowerName.includes('canvas')) return 'canvas';
607
+ return 'div'; // Default fallback
608
+ }
609
+ // Resolve component styles from properties and design system variables
610
+ }, {
611
+ key: "resolveComponentStyles",
612
+ value: function resolveComponentStyles(componentData, designSystem) {
613
+ var _this4 = this;
614
+ var styles = {};
615
+ if (componentData.properties) {
616
+ Object.entries(componentData.properties).forEach(function (_ref5) {
617
+ var _ref6 = _slicedToArray(_ref5, 2),
618
+ prop = _ref6[0],
619
+ value = _ref6[1];
620
+ var cssProperty = _this4.kebabToCamelCase(prop);
621
+ var resolvedValue = value.value;
622
+ // Resolve CSS variables
623
+ if (typeof resolvedValue === 'string' && resolvedValue.startsWith('var(')) {
624
+ var _resolvedValue$match;
625
+ var varName = (_resolvedValue$match = resolvedValue.match(/var\((--[^)]+)\)/)) === null || _resolvedValue$match === void 0 ? void 0 : _resolvedValue$match[1];
626
+ if (varName && designSystem.variables[varName]) {
627
+ var varData = designSystem.variables[varName];
628
+ resolvedValue = varData.value + (varData.unit || '');
629
+ }
630
+ }
631
+ // Add unit if value is numeric and unit is specified
632
+ if (value.unit && /^-?\d*\.?\d+$/.test(resolvedValue)) {
633
+ resolvedValue = resolvedValue + value.unit;
634
+ }
635
+ // Handle special CSS properties
636
+ if (cssProperty === 'boxShadow' && resolvedValue.includes('var(')) {
637
+ // Resolve shadow variables
638
+ resolvedValue = _this4.resolveCssVariables(resolvedValue, designSystem);
639
+ }
640
+ // Set the style property
641
+ styles[cssProperty] = resolvedValue;
642
+ });
643
+ }
644
+ return styles;
645
+ }
646
+ // Convert kebab-case to camelCase for CSS properties
647
+ }, {
648
+ key: "kebabToCamelCase",
649
+ value: function kebabToCamelCase(str) {
650
+ return str.replace(/-([a-z])/g, function (g) {
651
+ return g[1].toUpperCase();
652
+ });
653
+ }
654
+ // Convert camelCase to kebab-case (useful for HTML attributes)
655
+ }, {
656
+ key: "camelToKebabCase",
657
+ value: function camelToKebabCase(str) {
658
+ return str.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1-$2').toLowerCase();
659
+ }
660
+ // Validate that the component can be safely rendered
661
+ }, {
662
+ key: "validateComponent",
663
+ value: function validateComponent(componentData) {
664
+ var errors = [];
665
+ // Check for required linked element attributes
666
+ if (componentData.linkedElement) {
667
+ var _componentData$linked2 = componentData.linkedElement,
668
+ htmlTag = _componentData$linked2.htmlTag,
669
+ attributes = _componentData$linked2.attributes,
670
+ requiredAttributes = _componentData$linked2.requiredAttributes;
671
+ if (requiredAttributes) {
672
+ requiredAttributes.forEach(function (attr) {
673
+ if (!attributes || !attributes[attr]) {
674
+ errors.push("Required attribute \"".concat(attr, "\" is missing for <").concat(htmlTag, "> element"));
675
+ }
676
+ });
677
+ }
678
+ // Validate specific element types
679
+ if (htmlTag === 'img' && attributes) {
680
+ if (!attributes.src) {
681
+ errors.push('Image element requires "src" attribute');
682
+ }
683
+ if (!attributes.alt) {
684
+ errors.push('Image element should have "alt" attribute for accessibility');
685
+ }
686
+ }
687
+ if (htmlTag === 'a' && attributes && !attributes.href) {
688
+ errors.push('Anchor element requires "href" attribute');
689
+ }
690
+ }
691
+ // Validate that properties have valid values
692
+ if (componentData.properties) {
693
+ Object.entries(componentData.properties).forEach(function (_ref7) {
694
+ var _ref8 = _slicedToArray(_ref7, 2),
695
+ prop = _ref8[0],
696
+ value = _ref8[1];
697
+ if (!value.value && value.value !== '') {
698
+ errors.push("Property \"".concat(prop, "\" has invalid value"));
699
+ }
700
+ });
701
+ }
702
+ return {
703
+ isValid: errors.length === 0,
704
+ errors: errors
705
+ };
706
+ }
707
+ // Create a debug version of the component that shows validation errors
708
+ }, {
709
+ key: "createDebugComponent",
710
+ value: function createDebugComponent(componentName, componentData, designSystem) {
711
+ var _this5 = this;
712
+ var validation = this.validateComponent(componentData);
713
+ var Component = function Component(props) {
714
+ if (!validation.isValid) {
715
+ console.warn("Component \"".concat(componentName, "\" validation errors:"), validation.errors);
716
+ // Return a debug element that shows errors in development
717
+ if (process.env.NODE_ENV === 'development') {
718
+ return /*#__PURE__*/React.createElement('div', {
719
+ style: {
720
+ border: '2px solid red',
721
+ padding: '8px',
722
+ margin: '4px',
723
+ backgroundColor: '#fff0f0'
724
+ },
725
+ title: validation.errors.join('\n')
726
+ }, "[DEBUG: ".concat(componentName, "] ").concat(validation.errors.join(', ')));
727
+ }
728
+ }
729
+ // Use the normal component factory for production
730
+ var NormalComponent = _this5.createComponent(componentName, componentData, designSystem);
731
+ return /*#__PURE__*/React.createElement(NormalComponent, props);
732
+ };
733
+ Component.displayName = "Debug".concat(componentName);
734
+ return Component;
735
+ }
736
+ }]);
737
+ }();
738
+
739
+ var ComponentRegistryService = /*#__PURE__*/function () {
740
+ function ComponentRegistryService() {
741
+ _classCallCheck(this, ComponentRegistryService);
742
+ this.registry = {};
743
+ this.listeners = [];
744
+ this.originalToPascalMap = new Map();
745
+ }
746
+ // UNIVERSAL PascalCase conversion - handles ALL component names
747
+ return _createClass(ComponentRegistryService, [{
748
+ key: "formatComponentName",
749
+ value: function formatComponentName(name) {
750
+ if (!name || typeof name !== 'string') {
751
+ console.warn("\u26A0\uFE0F Invalid component name:", name);
752
+ return "UnknownComponent";
753
+ }
754
+ console.log("\uD83D\uDD0D formatComponentName INPUT: \"".concat(name, "\""));
755
+ // Remove any file extensions
756
+ var cleanName = name.replace(/\.[^/.]+$/, "");
757
+ // Handle various naming conventions and convert to PascalCase
758
+ var pascalCaseName = cleanName
759
+ // Split by common separators: space, hyphen, underscore, dot, slash, camelCase boundary
760
+ .split(/[\s\-_\.\/]+|(?=[A-Z])/)
761
+ // Remove empty strings and filter out non-alphanumeric parts
762
+ .filter(function (part) {
763
+ return part.length > 0 && /[a-zA-Z0-9]/.test(part);
764
+ })
765
+ // Capitalize the first letter of each part
766
+ .map(function (part) {
767
+ // Handle edge cases like "2xl", "3xs" etc.
768
+ if (/^\d+[a-zA-Z]+$/.test(part)) {
769
+ return part.charAt(0) + part.slice(1).charAt(0).toUpperCase() + part.slice(2);
770
+ }
771
+ return part.charAt(0).toUpperCase() + part.slice(1).toLowerCase();
772
+ }).join("");
773
+ // Final validation and cleanup
774
+ var result = pascalCaseName;
775
+ // Ensure it starts with a letter (not a number)
776
+ if (/^\d/.test(result)) {
777
+ result = "Component" + result;
778
+ }
779
+ // Remove any remaining non-alphanumeric characters (except letters and numbers)
780
+ result = result.replace(/[^a-zA-Z0-9]/g, "");
781
+ // If result is empty, provide a fallback
782
+ if (!result) {
783
+ result = "UnknownComponent";
784
+ }
785
+ console.log("\uD83D\uDCDD FINAL CONVERSION: \"".concat(name, "\" \u2192 \"").concat(result, "\""));
786
+ return result;
787
+ }
788
+ // Test method to verify PascalCase conversion
789
+ }, {
790
+ key: "testPascalCaseConversion",
791
+ value: function testPascalCaseConversion() {
792
+ var _this = this;
793
+ var testCases = ["header", "main-content", "user_profile", "buttonPrimary", "form.input.email", "card-body", "nav menu", "footer-bottom", "3xs-text", "2xl-container", "userProfileCard", "roboform", "mailcard", "miscbutton", "random-component_name", "SomeAlreadyPascalCase", "multiple-words-component", "path/to/component", "component.v2", "component_v3_final"];
794
+ console.log("🧪 TESTING PASCAL CASE CONVERSION:");
795
+ testCases.forEach(function (testCase) {
796
+ var result = _this.formatComponentName(testCase);
797
+ console.log(" \"".concat(testCase, "\" \u2192 \"").concat(result, "\""));
798
+ });
799
+ }
800
+ // Register a new component dynamically
801
+ }, {
802
+ key: "registerComponent",
803
+ value: function registerComponent(componentName, componentData, designSystem) {
804
+ var _this2 = this;
805
+ console.log("\uD83D\uDD04 REGISTER COMPONENT CALLED with: \"".concat(componentName, "\""));
806
+ // Use PascalCase for the main component name
807
+ var pascalCaseName = this.formatComponentName(componentName);
808
+ // Store mapping for debugging and reverse lookup
809
+ this.originalToPascalMap.set(componentName, pascalCaseName);
810
+ console.log("\uD83D\uDCDD MAPPING STORED: \"".concat(componentName, "\" \u2192 \"").concat(pascalCaseName, "\""));
811
+ // Create the main component
812
+ var MainComponent = StrataComponentFactory.createComponent(pascalCaseName, componentData, designSystem);
813
+ // Create sub-components recursively with proper PascalCase
814
+ if (componentData.children) {
815
+ Object.entries(componentData.children).forEach(function (_ref) {
816
+ var _ref2 = _slicedToArray(_ref, 2),
817
+ childName = _ref2[0],
818
+ childData = _ref2[1];
819
+ var childComponentName = _this2.formatComponentName(childName);
820
+ console.log("\uD83D\uDCDD Nested conversion: \"".concat(childName, "\" \u2192 \"").concat(childComponentName, "\""));
821
+ // Store nested component mapping
822
+ _this2.originalToPascalMap.set("".concat(componentName, ".").concat(childName), "".concat(pascalCaseName, ".").concat(childComponentName));
823
+ MainComponent[childComponentName] = StrataComponentFactory.createSubComponent(childComponentName, childData, designSystem);
824
+ // Recursively add nested sub-components
825
+ _this2.addNestedComponents(MainComponent[childComponentName], childData, designSystem, childComponentName, "".concat(componentName, ".").concat(childName));
826
+ });
827
+ }
828
+ // Register with PascalCase name only for cleaner API
829
+ this.registry[pascalCaseName] = MainComponent;
830
+ console.log("\u2705 Registered: \"".concat(pascalCaseName, "\""));
831
+ console.log("\uD83D\uDCCA Current registry:", Object.keys(this.registry));
832
+ this.notifyListeners();
833
+ }
834
+ // Recursively add nested components with mapping
835
+ }, {
836
+ key: "addNestedComponents",
837
+ value: function addNestedComponents(parentComponent, componentData, designSystem, parentPascalPath, parentOriginalPath) {
838
+ var _this3 = this;
839
+ if (componentData.children) {
840
+ Object.entries(componentData.children).forEach(function (_ref3) {
841
+ var _ref4 = _slicedToArray(_ref3, 2),
842
+ childName = _ref4[0],
843
+ childData = _ref4[1];
844
+ var childComponentName = _this3.formatComponentName(childName);
845
+ var fullPascalPath = "".concat(parentPascalPath, ".").concat(childComponentName);
846
+ var fullOriginalPath = "".concat(parentOriginalPath, ".").concat(childName);
847
+ // Store mapping for nested components
848
+ _this3.originalToPascalMap.set(fullOriginalPath, fullPascalPath);
849
+ parentComponent[childComponentName] = StrataComponentFactory.createSubComponent(childComponentName, childData, designSystem);
850
+ // Continue recursion
851
+ _this3.addNestedComponents(parentComponent[childComponentName], childData, designSystem, fullPascalPath, fullOriginalPath);
852
+ });
853
+ }
854
+ }
855
+ // Get all registered components
856
+ }, {
857
+ key: "getRegistry",
858
+ value: function getRegistry() {
859
+ return _objectSpread2({}, this.registry);
860
+ }
861
+ // Get the mapping for debugging
862
+ }, {
863
+ key: "getComponentMapping",
864
+ value: function getComponentMapping() {
865
+ return new Map(this.originalToPascalMap);
866
+ }
867
+ // Check if component exists (supports both original and PascalCase names)
868
+ }, {
869
+ key: "hasComponent",
870
+ value: function hasComponent(componentName) {
871
+ // Try direct PascalCase first
872
+ if (componentName in this.registry) {
873
+ return true;
874
+ }
875
+ // Try to convert and check
876
+ var pascalName = this.formatComponentName(componentName);
877
+ return pascalName in this.registry;
878
+ }
879
+ // Get component by name (supports both original and PascalCase)
880
+ }, {
881
+ key: "getComponent",
882
+ value: function getComponent(componentName) {
883
+ // Try direct access first
884
+ if (this.registry[componentName]) {
885
+ return this.registry[componentName];
886
+ }
887
+ // Try converted name
888
+ var pascalName = this.formatComponentName(componentName);
889
+ return this.registry[pascalName] || null;
890
+ }
891
+ // Clear all components and re-register with new design system
892
+ }, {
893
+ key: "syncWithDesignSystem",
894
+ value: function syncWithDesignSystem(designSystem) {
895
+ var _this4 = this;
896
+ console.log("🔄 SYNC WITH DESIGN SYSTEM CALLED");
897
+ console.log("🔍 Design system components:", Object.keys(designSystem.components));
898
+ // Test PascalCase conversion before proceeding
899
+ this.testPascalCaseConversion();
900
+ // Clear existing registry and mappings
901
+ this.registry = {};
902
+ this.originalToPascalMap.clear();
903
+ // Register all components
904
+ Object.entries(designSystem.components).forEach(function (_ref5) {
905
+ var _ref6 = _slicedToArray(_ref5, 2),
906
+ componentName = _ref6[0],
907
+ componentData = _ref6[1];
908
+ console.log("\uD83D\uDD04 Processing component from design system: \"".concat(componentName, "\""));
909
+ _this4.registerComponent(componentName, componentData, designSystem);
910
+ });
911
+ console.log("✅ Sync completed. Final registry:", Object.keys(this.registry));
912
+ console.log("🗺️ Component mapping:", Array.from(this.originalToPascalMap.entries()));
913
+ this.notifyListeners();
914
+ }
915
+ // Subscribe to registry changes
916
+ }, {
917
+ key: "subscribe",
918
+ value: function subscribe(listener) {
919
+ var _this5 = this;
920
+ this.listeners.push(listener);
921
+ return function () {
922
+ _this5.listeners = _this5.listeners.filter(function (l) {
923
+ return l !== listener;
924
+ });
925
+ };
926
+ }
927
+ }, {
928
+ key: "notifyListeners",
929
+ value: function notifyListeners() {
930
+ var currentRegistry = this.getRegistry();
931
+ console.log("📋 FINAL REGISTRY STATE:", Object.keys(currentRegistry));
932
+ this.listeners.forEach(function (listener) {
933
+ return listener(currentRegistry);
934
+ });
935
+ }
936
+ // Clear all components (useful for testing)
937
+ }, {
938
+ key: "clear",
939
+ value: function clear() {
940
+ this.registry = {};
941
+ this.originalToPascalMap.clear();
942
+ this.notifyListeners();
943
+ }
944
+ // Utility method to get PascalCase name without registering
945
+ }, {
946
+ key: "getPascalCaseName",
947
+ value: function getPascalCaseName(originalName) {
948
+ return this.formatComponentName(originalName);
949
+ }
950
+ }]);
951
+ }();
952
+ var strataRegistry = new ComponentRegistryService();
953
+ // Optionally run test when module loads in development, behind explicit debug flag
954
+ var shouldRunPascalCaseTest = typeof process !== "undefined" && process.env && process.env.NODE_ENV === "development" && process.env.STRATA_DEBUG_PASCAL_CASE_TEST === "true";
955
+ if (shouldRunPascalCaseTest) {
956
+ setTimeout(function () {
957
+ strataRegistry.testPascalCaseConversion();
958
+ }, 1000);
959
+ }
960
+
961
+ var StrataContext = /*#__PURE__*/createContext(undefined);
962
+ var useStrata = function useStrata() {
963
+ var context = useContext(StrataContext);
964
+ if (!context) {
965
+ throw new Error("useStrata must be used within a StrataProvider");
966
+ }
967
+ return context;
968
+ };
969
+ var StrataProvider = function StrataProvider(_ref) {
970
+ var _designSystem$variabl, _designSystem$variabl2, _designSystem$variabl3, _designSystem$variabl4, _designSystem$variabl5, _designSystem$variabl6, _designSystem$variabl7, _designSystem$variabl8, _designSystem$variabl9, _designSystem$variabl0, _designSystem$variabl1, _designSystem$variabl10, _designSystem$variabl11, _designSystem$variabl12, _designSystem$variabl13, _designSystem$variabl14, _designSystem$variabl15, _designSystem$variabl16, _designSystem$variabl17, _designSystem$variabl18, _designSystem$variabl19, _designSystem$variabl20, _designSystem$variabl21, _designSystem$variabl22, _designSystem$variabl23, _designSystem$variabl24;
971
+ var children = _ref.children,
972
+ initialData = _ref.initialData,
973
+ userDesignSystem = _ref.userDesignSystem,
974
+ _ref$syncEnabled = _ref.syncEnabled,
975
+ syncEnabled = _ref$syncEnabled === void 0 ? false : _ref$syncEnabled,
976
+ _ref$syncUrl = _ref.syncUrl,
977
+ syncUrl = _ref$syncUrl === void 0 ? "http://localhost:4000" : _ref$syncUrl,
978
+ _ref$syncInterval = _ref.syncInterval,
979
+ syncInterval = _ref$syncInterval === void 0 ? 3000 : _ref$syncInterval,
980
+ syncToken = _ref.syncToken,
981
+ snapshotCdnBase = _ref.snapshotCdnBase,
982
+ projectId = _ref.projectId,
983
+ onSyncError = _ref.onSyncError,
984
+ onSyncSuccess = _ref.onSyncSuccess;
985
+ var _useState = useState(userDesignSystem || initialData || {
986
+ variables: {},
987
+ components: {},
988
+ custom: {
989
+ variables: {},
990
+ components: {}
991
+ }
992
+ }),
993
+ _useState2 = _slicedToArray(_useState, 2),
994
+ designSystem = _useState2[0],
995
+ setDesignSystem = _useState2[1];
996
+ var _useState3 = useState("idle"),
997
+ _useState4 = _slicedToArray(_useState3, 2),
998
+ syncStatus = _useState4[0],
999
+ setSyncStatus = _useState4[1];
1000
+ var _useState5 = useState(null),
1001
+ _useState6 = _slicedToArray(_useState5, 2),
1002
+ lastSynced = _useState6[0],
1003
+ setLastSynced = _useState6[1];
1004
+ var _useState7 = useState(0),
1005
+ _useState8 = _slicedToArray(_useState7, 2),
1006
+ syncVersion = _useState8[0],
1007
+ setSyncVersion = _useState8[1];
1008
+ // Ref that tracks the JSON string of the last successfully synced payload so
1009
+ // that syncDesignSystem does not need to close over the designSystem state
1010
+ // value. This keeps the callback stable and prevents the polling interval
1011
+ // from being continuously reset after each successful sync.
1012
+ var lastSyncedStringRef = useRef(null);
1013
+ // Derive the CDN snapshot URL once — used in both syncDesignSystem and the
1014
+ // polling effect so the condition is computed in a single place.
1015
+ var snapshotUrl = useMemo(function () {
1016
+ return snapshotCdnBase && projectId ? "".concat(snapshotCdnBase, "/snapshots/").concat(projectId, "/strata.json") : null;
1017
+ }, [snapshotCdnBase, projectId]);
1018
+ var syncDesignSystem = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
1019
+ var headers, remoteData, res, data, _yield$Promise$all, _yield$Promise$all2, variablesRes, componentsRes, customRes, _yield$Promise$all3, _yield$Promise$all4, variables, components, custom, newDataString, _t;
1020
+ return _regenerator().w(function (_context) {
1021
+ while (1) switch (_context.p = _context.n) {
1022
+ case 0:
1023
+ if (!(!syncEnabled || !snapshotUrl && !syncUrl)) {
1024
+ _context.n = 1;
1025
+ break;
1026
+ }
1027
+ return _context.a(2);
1028
+ case 1:
1029
+ setSyncStatus("syncing");
1030
+ _context.p = 2;
1031
+ console.log("🔄 Starting design system sync...");
1032
+ headers = syncToken ? {
1033
+ Authorization: "Bearer ".concat(syncToken)
1034
+ } : {};
1035
+ if (!snapshotUrl) {
1036
+ _context.n = 8;
1037
+ break;
1038
+ }
1039
+ _context.n = 3;
1040
+ return fetch(snapshotUrl, {
1041
+ headers: headers
1042
+ });
1043
+ case 3:
1044
+ res = _context.v;
1045
+ if (!(!res.ok && res.status >= 400 && res.status < 500)) {
1046
+ _context.n = 4;
1047
+ break;
1048
+ }
1049
+ setSyncStatus("error");
1050
+ onSyncError === null || onSyncError === void 0 || onSyncError({
1051
+ code: res.status,
1052
+ message: "CDN fetch failed: ".concat(res.status, " ").concat(res.statusText),
1053
+ source: "cdn"
1054
+ });
1055
+ return _context.a(2);
1056
+ case 4:
1057
+ if (res.ok) {
1058
+ _context.n = 5;
1059
+ break;
1060
+ }
1061
+ throw new Error("Snapshot fetch failed: ".concat(res.status));
1062
+ case 5:
1063
+ _context.n = 6;
1064
+ return res.json();
1065
+ case 6:
1066
+ data = _context.v;
1067
+ if (!(!data || _typeof(data) !== "object" || Array.isArray(data) || _typeof(data.variables) !== "object" || data.variables === null || Array.isArray(data.variables) || _typeof(data.components) !== "object" || data.components === null || Array.isArray(data.components))) {
1068
+ _context.n = 7;
1069
+ break;
1070
+ }
1071
+ console.warn("[strata] Invalid snapshot shape received from CDN — skipping update.");
1072
+ setSyncStatus("error");
1073
+ onSyncError === null || onSyncError === void 0 || onSyncError({
1074
+ code: 0,
1075
+ message: "Invalid snapshot shape: missing variables or components",
1076
+ source: "cdn"
1077
+ });
1078
+ return _context.a(2);
1079
+ case 7:
1080
+ remoteData = {
1081
+ variables: data.variables,
1082
+ components: data.components,
1083
+ custom: data.custom || {
1084
+ variables: {},
1085
+ components: {}
1086
+ }
1087
+ };
1088
+ _context.n = 14;
1089
+ break;
1090
+ case 8:
1091
+ _context.n = 9;
1092
+ return Promise.all([fetch("".concat(syncUrl, "/variables"), {
1093
+ headers: headers
1094
+ }), fetch("".concat(syncUrl, "/components"), {
1095
+ headers: headers
1096
+ }), fetch("".concat(syncUrl, "/custom"), {
1097
+ headers: headers
1098
+ })]);
1099
+ case 9:
1100
+ _yield$Promise$all = _context.v;
1101
+ _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 3);
1102
+ variablesRes = _yield$Promise$all2[0];
1103
+ componentsRes = _yield$Promise$all2[1];
1104
+ customRes = _yield$Promise$all2[2];
1105
+ if (variablesRes.ok) {
1106
+ _context.n = 10;
1107
+ break;
1108
+ }
1109
+ throw new Error("Variables fetch failed: ".concat(variablesRes.status));
1110
+ case 10:
1111
+ if (componentsRes.ok) {
1112
+ _context.n = 11;
1113
+ break;
1114
+ }
1115
+ throw new Error("Components fetch failed: ".concat(componentsRes.status));
1116
+ case 11:
1117
+ if (customRes.ok) {
1118
+ _context.n = 12;
1119
+ break;
1120
+ }
1121
+ throw new Error("Custom fetch failed: ".concat(customRes.status));
1122
+ case 12:
1123
+ _context.n = 13;
1124
+ return Promise.all([variablesRes.json(), componentsRes.json(), customRes.json()]);
1125
+ case 13:
1126
+ _yield$Promise$all3 = _context.v;
1127
+ _yield$Promise$all4 = _slicedToArray(_yield$Promise$all3, 3);
1128
+ variables = _yield$Promise$all4[0];
1129
+ components = _yield$Promise$all4[1];
1130
+ custom = _yield$Promise$all4[2];
1131
+ remoteData = {
1132
+ variables: variables || {},
1133
+ components: components || {},
1134
+ custom: custom || {
1135
+ variables: {},
1136
+ components: {}
1137
+ }
1138
+ };
1139
+ case 14:
1140
+ // Only update if data actually changed (compared against the last synced
1141
+ // snapshot via ref, so this callback stays stable across renders).
1142
+ newDataString = JSON.stringify(remoteData);
1143
+ if (lastSyncedStringRef.current !== newDataString) {
1144
+ console.log("🔄 Design system data changed, updating...");
1145
+ lastSyncedStringRef.current = newDataString;
1146
+ setDesignSystem(remoteData);
1147
+ Object.entries(remoteData.components).forEach(function (_ref3) {
1148
+ var _ref4 = _slicedToArray(_ref3, 2),
1149
+ componentName = _ref4[0],
1150
+ componentData = _ref4[1];
1151
+ if (!strataRegistry.hasComponent(componentName)) {
1152
+ strataRegistry.registerComponent(componentName, componentData, remoteData);
1153
+ }
1154
+ });
1155
+ setSyncVersion(function (prev) {
1156
+ return prev + 1;
1157
+ });
1158
+ setSyncStatus("success");
1159
+ setLastSynced(new Date());
1160
+ onSyncSuccess === null || onSyncSuccess === void 0 || onSyncSuccess(remoteData);
1161
+ console.log("✅ Design system synced successfully");
1162
+ console.log("📊 Components available:", Object.keys(remoteData.components));
1163
+ console.log("🎨 Variables available:", Object.keys(remoteData.variables));
1164
+ } else {
1165
+ setSyncStatus("idle");
1166
+ console.log("⚡ Design system already up to date");
1167
+ }
1168
+ _context.n = 16;
1169
+ break;
1170
+ case 15:
1171
+ _context.p = 15;
1172
+ _t = _context.v;
1173
+ console.error("❌ Sync failed:", _t);
1174
+ setSyncStatus("error");
1175
+ onSyncError === null || onSyncError === void 0 || onSyncError({
1176
+ code: 0,
1177
+ message: _t instanceof Error ? _t.message : String(_t),
1178
+ source: snapshotUrl ? "cdn" : "sync"
1179
+ });
1180
+ case 16:
1181
+ return _context.a(2);
1182
+ }
1183
+ }, _callee, null, [[2, 15]]);
1184
+ })), [syncEnabled, syncUrl, syncToken, snapshotUrl, onSyncSuccess, onSyncError]);
1185
+ // Force sync function for manual triggering
1186
+ var forceSync = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
1187
+ return _regenerator().w(function (_context2) {
1188
+ while (1) switch (_context2.n) {
1189
+ case 0:
1190
+ _context2.n = 1;
1191
+ return syncDesignSystem();
1192
+ case 1:
1193
+ return _context2.a(2);
1194
+ }
1195
+ }, _callee2);
1196
+ })), [syncDesignSystem]);
1197
+ // Polling for real-time updates
1198
+ useEffect(function () {
1199
+ if (!syncEnabled || !snapshotUrl && !syncUrl) return;
1200
+ console.log("🔄 Starting sync polling...");
1201
+ var interval = setInterval(syncDesignSystem, syncInterval);
1202
+ // Initial sync
1203
+ syncDesignSystem();
1204
+ return function () {
1205
+ console.log("🔄 Stopping sync polling...");
1206
+ clearInterval(interval);
1207
+ };
1208
+ }, [syncEnabled, syncUrl, snapshotUrl, syncInterval, syncDesignSystem]);
1209
+ // Convert design tokens to Chakra UI theme with enhanced resolution
1210
+ var theme = extendTheme({
1211
+ colors: Object.entries(designSystem.variables).reduce(function (acc, _ref6) {
1212
+ var _ref7 = _slicedToArray(_ref6, 2),
1213
+ key = _ref7[0],
1214
+ value = _ref7[1];
1215
+ if (value.type === "color" && key.startsWith("--")) {
1216
+ var colorName = key.replace("--", "").replace(/-color/g, "");
1217
+ acc[colorName] = value.value;
1218
+ }
1219
+ return acc;
1220
+ }, {}),
1221
+ fonts: {
1222
+ body: ((_designSystem$variabl = designSystem.variables["--font-family-sans"]) === null || _designSystem$variabl === void 0 ? void 0 : _designSystem$variabl.value) || "system-ui, sans-serif",
1223
+ heading: ((_designSystem$variabl2 = designSystem.variables["--font-family-sans"]) === null || _designSystem$variabl2 === void 0 ? void 0 : _designSystem$variabl2.value) || "system-ui, sans-serif",
1224
+ mono: ((_designSystem$variabl3 = designSystem.variables["--font-family-mono"]) === null || _designSystem$variabl3 === void 0 ? void 0 : _designSystem$variabl3.value) || "monospace"
1225
+ },
1226
+ fontSizes: {
1227
+ xs: ((_designSystem$variabl4 = designSystem.variables["--font-size-xs"]) === null || _designSystem$variabl4 === void 0 ? void 0 : _designSystem$variabl4.value) || "0.75rem",
1228
+ sm: ((_designSystem$variabl5 = designSystem.variables["--font-size-sm"]) === null || _designSystem$variabl5 === void 0 ? void 0 : _designSystem$variabl5.value) || "0.875rem",
1229
+ md: ((_designSystem$variabl6 = designSystem.variables["--font-size-base"]) === null || _designSystem$variabl6 === void 0 ? void 0 : _designSystem$variabl6.value) || "1rem",
1230
+ lg: ((_designSystem$variabl7 = designSystem.variables["--font-size-lg"]) === null || _designSystem$variabl7 === void 0 ? void 0 : _designSystem$variabl7.value) || "1.125rem",
1231
+ xl: ((_designSystem$variabl8 = designSystem.variables["--text-xl"]) === null || _designSystem$variabl8 === void 0 ? void 0 : _designSystem$variabl8.value) || "1.25rem",
1232
+ "2xl": ((_designSystem$variabl9 = designSystem.variables["--text-2xl"]) === null || _designSystem$variabl9 === void 0 ? void 0 : _designSystem$variabl9.value) || "1.5rem"
1233
+ },
1234
+ space: {
1235
+ 1: ((_designSystem$variabl0 = designSystem.variables["--spacing-1"]) === null || _designSystem$variabl0 === void 0 ? void 0 : _designSystem$variabl0.value) || "0.25rem",
1236
+ 2: ((_designSystem$variabl1 = designSystem.variables["--spacing-2"]) === null || _designSystem$variabl1 === void 0 ? void 0 : _designSystem$variabl1.value) || "0.5rem",
1237
+ 3: ((_designSystem$variabl10 = designSystem.variables["--spacing-3"]) === null || _designSystem$variabl10 === void 0 ? void 0 : _designSystem$variabl10.value) || "0.75rem",
1238
+ 4: ((_designSystem$variabl11 = designSystem.variables["--spacing-4"]) === null || _designSystem$variabl11 === void 0 ? void 0 : _designSystem$variabl11.value) || "1rem",
1239
+ 6: ((_designSystem$variabl12 = designSystem.variables["--spacing-6"]) === null || _designSystem$variabl12 === void 0 ? void 0 : _designSystem$variabl12.value) || "1.5rem",
1240
+ 8: ((_designSystem$variabl13 = designSystem.variables["--spacing-8"]) === null || _designSystem$variabl13 === void 0 ? void 0 : _designSystem$variabl13.value) || "2rem"
1241
+ },
1242
+ radii: {
1243
+ none: "0",
1244
+ sm: ((_designSystem$variabl14 = designSystem.variables["--border-radius-sm"]) === null || _designSystem$variabl14 === void 0 ? void 0 : _designSystem$variabl14.value) || "0.125rem",
1245
+ md: ((_designSystem$variabl15 = designSystem.variables["--border-radius-md"]) === null || _designSystem$variabl15 === void 0 ? void 0 : _designSystem$variabl15.value) || "0.375rem",
1246
+ lg: ((_designSystem$variabl16 = designSystem.variables["--border-radius-lg"]) === null || _designSystem$variabl16 === void 0 ? void 0 : _designSystem$variabl16.value) || "0.5rem",
1247
+ xl: ((_designSystem$variabl17 = designSystem.variables["--border-radius-xl"]) === null || _designSystem$variabl17 === void 0 ? void 0 : _designSystem$variabl17.value) || "0.75rem",
1248
+ "2xl": ((_designSystem$variabl18 = designSystem.variables["--border-radius-2xl"]) === null || _designSystem$variabl18 === void 0 ? void 0 : _designSystem$variabl18.value) || "1rem",
1249
+ "3xl": ((_designSystem$variabl19 = designSystem.variables["--border-radius-3xl"]) === null || _designSystem$variabl19 === void 0 ? void 0 : _designSystem$variabl19.value) || "1.5rem",
1250
+ full: ((_designSystem$variabl20 = designSystem.variables["--border-radius-full"]) === null || _designSystem$variabl20 === void 0 ? void 0 : _designSystem$variabl20.value) || "9999px"
1251
+ },
1252
+ shadows: {
1253
+ sm: ((_designSystem$variabl21 = designSystem.variables["--shadow-sm"]) === null || _designSystem$variabl21 === void 0 ? void 0 : _designSystem$variabl21.value) || "0 1px 2px 0 rgba(0, 0, 0, 0.05)",
1254
+ md: ((_designSystem$variabl22 = designSystem.variables["--shadow-md"]) === null || _designSystem$variabl22 === void 0 ? void 0 : _designSystem$variabl22.value) || "0 4px 6px -1px rgba(0, 0, 0, 0.1)",
1255
+ lg: ((_designSystem$variabl23 = designSystem.variables["--shadow-lg"]) === null || _designSystem$variabl23 === void 0 ? void 0 : _designSystem$variabl23.value) || "0 10px 15px -3px rgba(0, 0, 0, 0.1)",
1256
+ xl: ((_designSystem$variabl24 = designSystem.variables["--shadow-xl"]) === null || _designSystem$variabl24 === void 0 ? void 0 : _designSystem$variabl24.value) || "0 20px 25px -5px rgba(0, 0, 0, 0.1)"
1257
+ }
1258
+ });
1259
+ var updateDesignSystem = function updateDesignSystem(newData) {
1260
+ setDesignSystem(newData);
1261
+ setSyncVersion(function (prev) {
1262
+ return prev + 1;
1263
+ });
1264
+ if (!syncEnabled) {
1265
+ localStorage.setItem("designSystemData", JSON.stringify(newData));
1266
+ }
1267
+ };
1268
+ var contextValue = {
1269
+ designSystem: designSystem,
1270
+ updateDesignSystem: updateDesignSystem,
1271
+ syncStatus: syncStatus,
1272
+ lastSynced: lastSynced,
1273
+ forceSync: forceSync,
1274
+ syncVersion: syncVersion,
1275
+ syncUrl: syncUrl,
1276
+ syncEnabled: syncEnabled,
1277
+ syncInterval: syncInterval,
1278
+ syncToken: syncToken,
1279
+ snapshotCdnBase: snapshotCdnBase,
1280
+ projectId: projectId
1281
+ };
1282
+ return jsx(StrataContext.Provider, {
1283
+ value: contextValue,
1284
+ children: jsx(ChakraProvider, {
1285
+ theme: theme,
1286
+ cssVarsRoot: ":root",
1287
+ children: children
1288
+ })
1289
+ });
1290
+ };
1291
+
1292
+ var useComponentData = function useComponentData() {
1293
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1294
+ var _options$componentNam = options.componentName,
1295
+ componentName = _options$componentNam === void 0 ? 'card' : _options$componentNam,
1296
+ _options$fallbackToDe = options.fallbackToDefault,
1297
+ fallbackToDefault = _options$fallbackToDe === void 0 ? true : _options$fallbackToDe;
1298
+ var _useStrata = useStrata(),
1299
+ designSystem = _useStrata.designSystem,
1300
+ syncVersion = _useStrata.syncVersion;
1301
+ // Enhanced helper function to safely access nested properties
1302
+ var safeGet = function safeGet(obj, path, defaultValue) {
1303
+ return path.split('.').reduce(function (acc, key) {
1304
+ if (acc && _typeof(acc) === 'object' && key in acc) {
1305
+ return acc[key];
1306
+ }
1307
+ return defaultValue;
1308
+ }, obj);
1309
+ };
1310
+ // Advanced CSS variable resolution with recursion protection
1311
+ var _resolveValue = function resolveValue(value) {
1312
+ var unit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1313
+ var visited = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Set();
1314
+ if (!value) return '';
1315
+ var resolvedValue = value;
1316
+ // Resolve CSS variables recursively with cycle detection
1317
+ if (resolvedValue.startsWith('var(')) {
1318
+ var _resolvedValue$match;
1319
+ var varName = (_resolvedValue$match = resolvedValue.match(/var\((--[^)]+)\)/)) === null || _resolvedValue$match === void 0 ? void 0 : _resolvedValue$match[1];
1320
+ if (varName) {
1321
+ if (visited.has(varName)) {
1322
+ console.warn("Circular reference detected for variable: ".concat(varName));
1323
+ return resolvedValue;
1324
+ }
1325
+ visited.add(varName);
1326
+ var varData = designSystem.variables[varName];
1327
+ if (varData) {
1328
+ resolvedValue = _resolveValue(varData.value, varData.unit, visited);
1329
+ }
1330
+ }
1331
+ }
1332
+ // Add unit if missing and value is numeric
1333
+ if (unit && /^-?\d*\.?\d+$/.test(resolvedValue)) {
1334
+ return resolvedValue + unit;
1335
+ }
1336
+ return resolvedValue;
1337
+ };
1338
+ // Get property value with enhanced resolution
1339
+ var getPropertyValue = function getPropertyValue(node, property) {
1340
+ var _node$properties;
1341
+ if (!(node !== null && node !== void 0 && (_node$properties = node.properties) !== null && _node$properties !== void 0 && _node$properties[property])) {
1342
+ return '';
1343
+ }
1344
+ var prop = node.properties[property];
1345
+ return _resolveValue(prop.value, prop.unit);
1346
+ };
1347
+ // Get text content with safe access
1348
+ var getTextContent = function getTextContent(node) {
1349
+ return (node === null || node === void 0 ? void 0 : node.textContent) || '';
1350
+ };
1351
+ // Get linked element attributes
1352
+ var getLinkedElementAttr = function getLinkedElementAttr(node, attr) {
1353
+ var _node$linkedElement;
1354
+ if (!(node !== null && node !== void 0 && (_node$linkedElement = node.linkedElement) !== null && _node$linkedElement !== void 0 && (_node$linkedElement = _node$linkedElement.attributes) !== null && _node$linkedElement !== void 0 && _node$linkedElement[attr])) {
1355
+ return '';
1356
+ }
1357
+ return node.linkedElement.attributes[attr];
1358
+ };
1359
+ // Enhanced component data extraction that matches your design system structure
1360
+ var _extractComponentData = function extractComponentData(componentName) {
1361
+ var componentData = designSystem.components[componentName];
1362
+ if (!componentData) {
1363
+ if (fallbackToDefault && componentName !== 'card') {
1364
+ console.warn("Component \"".concat(componentName, "\" not found, falling back to default card"));
1365
+ return _extractComponentData('card');
1366
+ }
1367
+ console.warn("Component \"".concat(componentName, "\" not found in design system"));
1368
+ return null;
1369
+ }
1370
+ console.log("\uD83D\uDCE6 Extracting data for component: ".concat(componentName), componentData);
1371
+ // Extract card data based on your actual design system structure
1372
+ var extractedData = {
1373
+ // Main card properties
1374
+ card: {
1375
+ width: getPropertyValue(componentData, 'width') || '100%',
1376
+ maxWidth: getPropertyValue(componentData, 'max-width') || '32rem',
1377
+ backgroundColor: getPropertyValue(componentData, 'background-color') || '#f9fafb',
1378
+ fontFamily: getPropertyValue(componentData, 'font-family') || 'Inter, system-ui, sans-serif'
1379
+ },
1380
+ // Card container (from children.card-container)
1381
+ container: {
1382
+ width: getPropertyValue(safeGet(componentData, 'children.card-container', undefined), 'width') || '100%',
1383
+ maxWidth: getPropertyValue(safeGet(componentData, 'children.card-container', undefined), 'max-width') || '32rem',
1384
+ backgroundColor: getPropertyValue(safeGet(componentData, 'children.card-container', undefined), 'background-color') || '#ffffff',
1385
+ borderRadius: getPropertyValue(safeGet(componentData, 'children.card-container', undefined), 'border-radius') || '1.5rem',
1386
+ boxShadow: getPropertyValue(safeGet(componentData, 'children.card-container', undefined), 'box-shadow') || '0 10px 15px -3px rgba(0, 0, 0, 0.1)',
1387
+ overflow: getPropertyValue(safeGet(componentData, 'children.card-container', undefined), 'overflow') || 'hidden'
1388
+ },
1389
+ // Card header (nested structure)
1390
+ header: {
1391
+ padding: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-header', undefined), 'padding') || '1.5rem',
1392
+ borderBottom: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-header', undefined), 'border-bottom-width') || '1px',
1393
+ borderColor: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-header', undefined), 'border-bottom-color') || '#e5e7eb'
1394
+ },
1395
+ headerContent: {
1396
+ display: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-header.children.card-header-content', undefined), 'display') || 'flex',
1397
+ justifyContent: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-header.children.card-header-content', undefined), 'justify-content') || 'space-between',
1398
+ alignItems: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-header.children.card-header-content', undefined), 'align-items') || 'center'
1399
+ },
1400
+ headerTitle: {
1401
+ text: getTextContent(safeGet(componentData, 'children.card-container.children.card-header.children.card-header-content.children.card-header-title', undefined)) || 'Arrived in',
1402
+ fontSize: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-header.children.card-header-content.children.card-header-title', undefined), 'font-size') || '1.25rem',
1403
+ fontWeight: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-header.children.card-header-content.children.card-header-title', undefined), 'font-weight') || '600',
1404
+ color: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-header.children.card-header-content.children.card-header-title', undefined), 'color') || '#111827'
1405
+ },
1406
+ headerTimer: {
1407
+ text: getTextContent(safeGet(componentData, 'children.card-container.children.card-header.children.card-header-content.children.card-header-timer', undefined)) || '00:05:20',
1408
+ fontSize: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-header.children.card-header-content.children.card-header-timer', undefined), 'font-size') || '1.25rem',
1409
+ fontFamily: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-header.children.card-header-content.children.card-header-timer', undefined), 'font-family') || 'monospace',
1410
+ color: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-header.children.card-header-content.children.card-header-timer', undefined), 'color') || '#1f2937'
1411
+ },
1412
+ // Card body
1413
+ body: {
1414
+ padding: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-body', undefined), 'padding') || '1.5rem'
1415
+ },
1416
+ bodyDriver: {
1417
+ backgroundColor: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-body.children.card-body-driver', undefined), 'background-color') || '#f9fafb',
1418
+ borderRadius: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-body.children.card-body-driver', undefined), 'border-radius') || '0.75rem',
1419
+ padding: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-body.children.card-body-driver', undefined), 'padding') || '1rem',
1420
+ display: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-body.children.card-body-driver', undefined), 'display') || 'flex',
1421
+ alignItems: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-body.children.card-body-driver', undefined), 'align-items') || 'center',
1422
+ gap: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-body.children.card-body-driver', undefined), 'gap') || '1rem'
1423
+ },
1424
+ bodyImage: {
1425
+ src: getLinkedElementAttr(safeGet(componentData, 'children.card-container.children.card-body.children.card-body-driver.children.card-body-img', undefined), 'src') || 'https://plus.unsplash.com/premium_photo-1689977927774-401b12d137d6?w=900&auto=format&fit=crop&q=60&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxzZWFyY2h8OXx8bWFufGVufDB8fDB8fHww',
1426
+ alt: getLinkedElementAttr(safeGet(componentData, 'children.card-container.children.card-body.children.card-body-driver.children.card-body-img', undefined), 'alt') || 'Driver',
1427
+ width: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-body.children.card-body-driver.children.card-body-img', undefined), 'width') || '3.5rem',
1428
+ height: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-body.children.card-body-driver.children.card-body-img', undefined), 'height') || '3.5rem',
1429
+ borderRadius: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-body.children.card-body-driver.children.card-body-img', undefined), 'border-radius') || '50%',
1430
+ objectFit: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-body.children.card-body-driver.children.card-body-img', undefined), 'object-fit') || 'cover'
1431
+ },
1432
+ bodyInfo: {
1433
+ flexGrow: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-body.children.card-body-driver.children.card-body-info', undefined), 'flex-grow') || '1'
1434
+ },
1435
+ bodyName: {
1436
+ text: getTextContent(safeGet(componentData, 'children.card-container.children.card-body.children.card-body-driver.children.card-body-info.children.card-body-name', undefined)) || 'Jacob Jones',
1437
+ fontWeight: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-body.children.card-body-driver.children.card-body-info.children.card-body-name', undefined), 'font-weight') || '600',
1438
+ color: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-body.children.card-body-driver.children.card-body-info.children.card-body-name', undefined), 'color') || '#111827'
1439
+ },
1440
+ bodySpan: {
1441
+ text: getTextContent(safeGet(componentData, 'children.card-container.children.card-body.children.card-body-driver.children.card-body-info.children.card-body-span', undefined)) || 'Omnitrans • SPX-8328',
1442
+ fontSize: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-body.children.card-body-driver.children.card-body-info.children.card-body-span', undefined), 'font-size') || '0.875rem',
1443
+ color: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-body.children.card-body-driver.children.card-body-info.children.card-body-span', undefined), 'color') || '#6b7280'
1444
+ },
1445
+ bodyActions: {
1446
+ gap: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-body.children.card-body-driver.children.card-body-actions', undefined), 'gap') || '0.5rem'
1447
+ },
1448
+ // Route section
1449
+ route: {
1450
+ paddingX: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-route', undefined), 'padding-left') || '1.5rem',
1451
+ paddingBottom: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-route', undefined), 'padding-bottom') || '1.5rem'
1452
+ },
1453
+ routeContainer: {
1454
+ gap: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-route.children.card-route-container', undefined), 'gap') || '1.5rem'
1455
+ },
1456
+ // Payment section
1457
+ payment: {
1458
+ paddingX: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-payment', undefined), 'padding-left') || '1.5rem',
1459
+ paddingBottom: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-payment', undefined), 'padding-bottom') || '1.5rem'
1460
+ },
1461
+ paymentContainer: {
1462
+ backgroundColor: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-payment.children.card-payment-container', undefined), 'background-color') || '#111827',
1463
+ borderRadius: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-payment.children.card-payment-container', undefined), 'border-radius') || '0.75rem',
1464
+ padding: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-payment.children.card-payment-container', undefined), 'padding') || '1rem'
1465
+ },
1466
+ cardNumber: {
1467
+ text: getTextContent(safeGet(componentData, 'children.card-container.children.card-payment.children.card-payment-container.children.card-payment-content.children.card-payment-details.children.card-number', undefined)) || '**** 7493',
1468
+ color: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-payment.children.card-payment-container.children.card-payment-content.children.card-payment-details.children.card-number', undefined), 'color') || '#ffffff',
1469
+ fontWeight: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-payment.children.card-payment-container.children.card-payment-content.children.card-payment-details.children.card-number', undefined), 'font-weight') || '500',
1470
+ fontSize: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-payment.children.card-payment-container.children.card-payment-content.children.card-payment-details.children.card-number', undefined), 'font-size') || '1.125rem'
1471
+ },
1472
+ cardType: {
1473
+ text: getTextContent(safeGet(componentData, 'children.card-container.children.card-payment.children.card-payment-container.children.card-payment-content.children.card-payment-details.children.card-type', undefined)) || 'Credit card',
1474
+ fontSize: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-payment.children.card-payment-container.children.card-payment-content.children.card-payment-details.children.card-type', undefined), 'font-size') || '0.875rem',
1475
+ color: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-payment.children.card-payment-container.children.card-payment-content.children.card-payment-details.children.card-type', undefined), 'color') || '#d1d5db'
1476
+ },
1477
+ // Total section
1478
+ totalSection: {
1479
+ paddingX: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-total-section', undefined), 'padding-left') || '1.5rem',
1480
+ paddingY: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-total-section', undefined), 'padding-top') || '1.5rem'
1481
+ },
1482
+ totalLabel: {
1483
+ text: getTextContent(safeGet(componentData, 'children.card-container.children.card-total-section.children.card-total-content.children.card-total-label', undefined)) || 'Total orders',
1484
+ color: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-total-section.children.card-total-content.children.card-total-label', undefined), 'color') || '#111827',
1485
+ fontWeight: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-total-section.children.card-total-content.children.card-total-label', undefined), 'font-weight') || '500'
1486
+ },
1487
+ totalAmount: {
1488
+ text: getTextContent(safeGet(componentData, 'children.card-container.children.card-total-section.children.card-total-content.children.card-total-amount', undefined)) || '$5.75',
1489
+ fontSize: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-total-section.children.card-total-content.children.card-total-amount', undefined), 'font-size') || '1.25rem',
1490
+ fontWeight: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-total-section.children.card-total-content.children.card-total-amount', undefined), 'font-weight') || '700',
1491
+ color: getPropertyValue(safeGet(componentData, 'children.card-container.children.card-total-section.children.card-total-content.children.card-total-amount', undefined), 'color') || '#111827'
1492
+ }
1493
+ };
1494
+ console.log("\u2705 Extracted data for ".concat(componentName, ":"), extractedData);
1495
+ return extractedData;
1496
+ };
1497
+ var componentData = _extractComponentData(componentName);
1498
+ return {
1499
+ data: componentData,
1500
+ hasData: !!componentData,
1501
+ componentName: componentName,
1502
+ syncVersion: syncVersion
1503
+ };
1504
+ };
1505
+ // Backward compatibility alias
1506
+ var useCardData = function useCardData() {
1507
+ return useComponentData({
1508
+ componentName: 'card'
1509
+ });
1510
+ };
1511
+
1512
+ // "use client";
1513
+ // import * as React from "react";
1514
+ // import {
1515
+ // Box,
1516
+ // Flex,
1517
+ // Text,
1518
+ // Image,
1519
+ // Button,
1520
+ // VStack,
1521
+ // HStack,
1522
+ // } from "@chakra-ui/react";
1523
+ // import { useCardData } from "../../hook/useCardData";
1524
+ // // Card Container
1525
+ // const CardContainer = ({ children, width, maxWidth }: any) => {
1526
+ // const cardData = useCardData();
1527
+ // if (!cardData) return null;
1528
+ // return (
1529
+ // <Box
1530
+ // width={width || cardData.container.width}
1531
+ // maxWidth={maxWidth || cardData.container.maxWidth}
1532
+ // mx="auto"
1533
+ // bg={cardData.container.backgroundColor}
1534
+ // borderRadius={cardData.container.borderRadius}
1535
+ // boxShadow={cardData.container.boxShadow}
1536
+ // overflow={cardData.container.overflow}
1537
+ // >
1538
+ // {children}
1539
+ // </Box>
1540
+ // );
1541
+ // };
1542
+ // // Card Header
1543
+ // const CardHeader = ({ children, padding }: any) => {
1544
+ // const cardData = useCardData();
1545
+ // if (!cardData) return null;
1546
+ // return (
1547
+ // <Box
1548
+ // p={padding || cardData.header.padding}
1549
+ // borderBottom={`${cardData.header.borderBottom} solid ${cardData.header.borderColor}`}
1550
+ // >
1551
+ // {children}
1552
+ // </Box>
1553
+ // );
1554
+ // };
1555
+ // const CardHeaderContent = ({ children }: any) => {
1556
+ // const cardData = useCardData();
1557
+ // if (!cardData) return null;
1558
+ // return (
1559
+ // <Flex
1560
+ // display={cardData.headerContent.display}
1561
+ // justifyContent={cardData.headerContent.justifyContent}
1562
+ // alignItems={cardData.headerContent.alignItems}
1563
+ // >
1564
+ // {children}
1565
+ // </Flex>
1566
+ // );
1567
+ // };
1568
+ // const CardHeaderTitle = ({ children, fontSize, fontWeight, color }: any) => {
1569
+ // const cardData = useCardData();
1570
+ // if (!cardData) return null;
1571
+ // return (
1572
+ // <Text
1573
+ // fontSize={fontSize || cardData.headerTitle.fontSize}
1574
+ // fontWeight={fontWeight || cardData.headerTitle.fontWeight}
1575
+ // color={color || cardData.headerTitle.color}
1576
+ // >
1577
+ // {children || cardData.headerTitle.text}
1578
+ // </Text>
1579
+ // );
1580
+ // };
1581
+ // const CardHeaderTimer = ({ children, fontSize, fontFamily, color }: any) => {
1582
+ // const cardData = useCardData();
1583
+ // if (!cardData) return null;
1584
+ // return (
1585
+ // <Text
1586
+ // fontSize={fontSize || cardData.headerTimer.fontSize}
1587
+ // fontFamily={fontFamily || cardData.headerTimer.fontFamily}
1588
+ // color={color || cardData.headerTimer.color}
1589
+ // >
1590
+ // {children || cardData.headerTimer.text}
1591
+ // </Text>
1592
+ // );
1593
+ // };
1594
+ // // Card Body
1595
+ // const CardBody = ({ children, padding }: any) => {
1596
+ // const cardData = useCardData();
1597
+ // if (!cardData) return null;
1598
+ // return <Box p={padding || cardData.body.padding}>{children}</Box>;
1599
+ // };
1600
+ // const CardBodyDriver = ({
1601
+ // children,
1602
+ // backgroundColor,
1603
+ // borderRadius,
1604
+ // padding,
1605
+ // }: any) => {
1606
+ // const cardData = useCardData();
1607
+ // if (!cardData) return null;
1608
+ // return (
1609
+ // <Flex
1610
+ // bg={backgroundColor || cardData.bodyDriver.backgroundColor}
1611
+ // borderRadius={borderRadius || cardData.bodyDriver.borderRadius}
1612
+ // p={padding || cardData.bodyDriver.padding}
1613
+ // display={cardData.bodyDriver.display}
1614
+ // alignItems={cardData.bodyDriver.alignItems}
1615
+ // gap={cardData.bodyDriver.gap}
1616
+ // >
1617
+ // {children}
1618
+ // </Flex>
1619
+ // );
1620
+ // };
1621
+ // const CardBodyImage = ({ src, alt, width, height, borderRadius }: any) => {
1622
+ // const cardData = useCardData();
1623
+ // if (!cardData) return null;
1624
+ // return (
1625
+ // <Image
1626
+ // src={src || cardData.bodyImage.src}
1627
+ // alt={alt || cardData.bodyImage.alt}
1628
+ // width={width || cardData.bodyImage.width}
1629
+ // height={height || cardData.bodyImage.height}
1630
+ // borderRadius={borderRadius || cardData.bodyImage.borderRadius}
1631
+ // objectFit={cardData.bodyImage.objectFit as any}
1632
+ // />
1633
+ // );
1634
+ // };
1635
+ // const CardBodyInfo = ({ children, flexGrow }: any) => {
1636
+ // const cardData = useCardData();
1637
+ // if (!cardData) return null;
1638
+ // return <Box flex={flexGrow || cardData.bodyInfo.flexGrow}>{children}</Box>;
1639
+ // };
1640
+ // const CardBodyName = ({ children, fontWeight, color }: any) => {
1641
+ // const cardData = useCardData();
1642
+ // if (!cardData) return null;
1643
+ // return (
1644
+ // <Text
1645
+ // fontWeight={fontWeight || cardData.bodyName.fontWeight}
1646
+ // color={color || cardData.bodyName.color}
1647
+ // >
1648
+ // {children || cardData.bodyName.text}
1649
+ // </Text>
1650
+ // );
1651
+ // };
1652
+ // const CardBodySpan = ({ children, fontSize, color }: any) => {
1653
+ // const cardData = useCardData();
1654
+ // if (!cardData) return null;
1655
+ // return (
1656
+ // <Text
1657
+ // fontSize={fontSize || cardData.bodySpan.fontSize}
1658
+ // color={color || cardData.bodySpan.color}
1659
+ // >
1660
+ // {children || cardData.bodySpan.text}
1661
+ // </Text>
1662
+ // );
1663
+ // };
1664
+ // const CardBodyActions = ({ children }: any) => {
1665
+ // const cardData = useCardData();
1666
+ // if (!cardData) return null;
1667
+ // return <Flex gap={cardData.bodyActions.gap}>{children}</Flex>;
1668
+ // };
1669
+ // // Action Button Components - FIXED to match design system exactly
1670
+ // const CardBodyActionButton = ({
1671
+ // children,
1672
+ // variant = "outline",
1673
+ // backgroundColor,
1674
+ // color,
1675
+ // hoverBackgroundColor,
1676
+ // border,
1677
+ // padding = 2,
1678
+ // borderRadius = "full",
1679
+ // onClick,
1680
+ // }: any) => {
1681
+ // const cardData = useCardData();
1682
+ // if (!cardData) return null;
1683
+ // // Use custom props if provided, otherwise use variant-based styles
1684
+ // const getButtonStyles = () => {
1685
+ // // If custom props are provided, use them
1686
+ // if (backgroundColor || color || hoverBackgroundColor || border) {
1687
+ // return {
1688
+ // bg: backgroundColor,
1689
+ // color: color,
1690
+ // border: border,
1691
+ // borderColor: border === "none" ? "transparent" : "gray.300",
1692
+ // _hover: {
1693
+ // bg: hoverBackgroundColor,
1694
+ // },
1695
+ // };
1696
+ // }
1697
+ // // Otherwise use variant-based styles
1698
+ // if (variant === "solid") {
1699
+ // return {
1700
+ // bg: "#1f2937", // gray-800
1701
+ // color: "white",
1702
+ // border: "none",
1703
+ // _hover: {
1704
+ // bg: "#374151", // gray-700
1705
+ // },
1706
+ // };
1707
+ // } else {
1708
+ // return {
1709
+ // bg: "transparent",
1710
+ // color: "gray.600",
1711
+ // border: "1px solid",
1712
+ // borderColor: "gray.300",
1713
+ // _hover: {
1714
+ // bg: "gray.100",
1715
+ // },
1716
+ // };
1717
+ // }
1718
+ // };
1719
+ // const styles = getButtonStyles();
1720
+ // return (
1721
+ // <Button
1722
+ // p={padding}
1723
+ // borderRadius={borderRadius}
1724
+ // bg={styles.bg}
1725
+ // color={styles.color}
1726
+ // border={styles.border}
1727
+ // borderColor={styles.borderColor}
1728
+ // transition="all 0.2s"
1729
+ // _hover={styles._hover}
1730
+ // onClick={onClick}
1731
+ // minW="auto"
1732
+ // h="auto"
1733
+ // display="flex"
1734
+ // alignItems="center"
1735
+ // justifyContent="center"
1736
+ // >
1737
+ // {children}
1738
+ // </Button>
1739
+ // );
1740
+ // };
1741
+ // const CardBodyActionIcon = ({
1742
+ // children,
1743
+ // width = 5,
1744
+ // height = 5,
1745
+ // color,
1746
+ // }: any) => {
1747
+ // return (
1748
+ // <Box
1749
+ // width={width}
1750
+ // height={height}
1751
+ // color={color}
1752
+ // display="flex"
1753
+ // alignItems="center"
1754
+ // justifyContent="center"
1755
+ // >
1756
+ // {children}
1757
+ // </Box>
1758
+ // );
1759
+ // };
1760
+ // // Card Route
1761
+ // const CardRoute = ({ children, paddingX, paddingBottom }: any) => {
1762
+ // const cardData = useCardData();
1763
+ // if (!cardData) return null;
1764
+ // return (
1765
+ // <Box
1766
+ // px={paddingX || cardData.route.paddingX}
1767
+ // pb={paddingBottom || cardData.route.paddingBottom}
1768
+ // >
1769
+ // {children}
1770
+ // </Box>
1771
+ // );
1772
+ // };
1773
+ // const CardRouteContainer = ({ children, gap }: any) => {
1774
+ // const cardData = useCardData();
1775
+ // if (!cardData) return null;
1776
+ // return (
1777
+ // <VStack spacing={gap || cardData.routeContainer.gap} align="stretch">
1778
+ // {children}
1779
+ // </VStack>
1780
+ // );
1781
+ // };
1782
+ // // FIXED: CardRouteItem with proper spacing to match design system
1783
+ // // const CardRouteItem = ({
1784
+ // // children,
1785
+ // // icon,
1786
+ // // iconBackgroundColor = "blue.50",
1787
+ // // title,
1788
+ // // subtitle,
1789
+ // // }: {
1790
+ // // children?: React.ReactNode;
1791
+ // // icon?: React.ReactNode;
1792
+ // // iconBackgroundColor?: string;
1793
+ // // title?: string;
1794
+ // // subtitle?: string;
1795
+ // // }) => {
1796
+ // // return (
1797
+ // // <HStack align="flex-start" spacing={4}>
1798
+ // // <Box mt={0.5} flexShrink={0}>
1799
+ // // <Flex
1800
+ // // width={8}
1801
+ // // height={8}
1802
+ // // borderRadius="full"
1803
+ // // backgroundColor={iconBackgroundColor}
1804
+ // // align="center"
1805
+ // // justify="center"
1806
+ // // >
1807
+ // // {icon}
1808
+ // // </Flex>
1809
+ // // </Box>
1810
+ // // <Box flex="1">
1811
+ // // {children || (
1812
+ // // <>
1813
+ // // <Text
1814
+ // // fontWeight="semibold"
1815
+ // // color="gray.900"
1816
+ // // fontSize="md"
1817
+ // // lineHeight="short"
1818
+ // // mb={1} // Added margin bottom for proper spacing
1819
+ // // >
1820
+ // // {title}
1821
+ // // </Text>
1822
+ // // <Text fontSize="sm" color="gray.500" lineHeight="short">
1823
+ // // {subtitle}
1824
+ // // </Text>
1825
+ // // </>
1826
+ // // )}
1827
+ // // </Box>
1828
+ // // </HStack>
1829
+ // // );
1830
+ // // };
1831
+ // const CardRouteItem = ({
1832
+ // children,
1833
+ // icon,
1834
+ // iconBackgroundColor = "blue.50",
1835
+ // title,
1836
+ // subtitle,
1837
+ // }: {
1838
+ // children?: React.ReactNode;
1839
+ // icon?: React.ReactNode;
1840
+ // iconBackgroundColor?: string;
1841
+ // title?: string;
1842
+ // subtitle?: string;
1843
+ // }) => {
1844
+ // return (
1845
+ // <HStack align="flex-start" spacing={4}>
1846
+ // <Box mt={0.5} flexShrink={0}>
1847
+ // <Flex
1848
+ // width={8}
1849
+ // height={8}
1850
+ // borderRadius="full"
1851
+ // backgroundColor={iconBackgroundColor}
1852
+ // align="center"
1853
+ // justify="center"
1854
+ // >
1855
+ // {icon}
1856
+ // </Flex>
1857
+ // </Box>
1858
+ // <Box flex="1">
1859
+ // {children || (
1860
+ // <>
1861
+ // <Text
1862
+ // fontWeight="semibold"
1863
+ // color="gray.900"
1864
+ // fontSize="md"
1865
+ // lineHeight="short"
1866
+ // mb={1}
1867
+ // >
1868
+ // {title}
1869
+ // </Text>
1870
+ // <Text fontSize="sm" color="gray.500" lineHeight="short">
1871
+ // {subtitle}
1872
+ // </Text>
1873
+ // </>
1874
+ // )}
1875
+ // </Box>
1876
+ // </HStack>
1877
+ // );
1878
+ // };
1879
+ // // Card Payment
1880
+ // const CardPayment = ({ children, paddingX, paddingBottom }: any) => {
1881
+ // const cardData = useCardData();
1882
+ // if (!cardData) return null;
1883
+ // return (
1884
+ // <Box
1885
+ // px={paddingX || cardData.payment.paddingX}
1886
+ // pb={paddingBottom || cardData.payment.paddingBottom}
1887
+ // >
1888
+ // {children}
1889
+ // </Box>
1890
+ // );
1891
+ // };
1892
+ // const CardPaymentContainer = ({
1893
+ // children,
1894
+ // backgroundColor,
1895
+ // borderRadius,
1896
+ // padding,
1897
+ // }: any) => {
1898
+ // const cardData = useCardData();
1899
+ // if (!cardData) return null;
1900
+ // return (
1901
+ // <Box
1902
+ // bg={backgroundColor || cardData.paymentContainer.backgroundColor}
1903
+ // borderRadius={borderRadius || cardData.paymentContainer.borderRadius}
1904
+ // p={padding || cardData.paymentContainer.padding}
1905
+ // >
1906
+ // {children}
1907
+ // </Box>
1908
+ // );
1909
+ // };
1910
+ // const CardPaymentContent = ({ children }: any) => {
1911
+ // return (
1912
+ // <Flex align="center" gap={4}>
1913
+ // {children}
1914
+ // </Flex>
1915
+ // );
1916
+ // };
1917
+ // const CardPaymentIconContainer = ({
1918
+ // children,
1919
+ // width = 12,
1920
+ // height = 12,
1921
+ // backgroundColor = "gray.800",
1922
+ // }: any) => {
1923
+ // return (
1924
+ // <Flex
1925
+ // width={width}
1926
+ // height={height}
1927
+ // borderRadius="full"
1928
+ // backgroundColor={backgroundColor}
1929
+ // align="center"
1930
+ // justify="center"
1931
+ // >
1932
+ // {children}
1933
+ // </Flex>
1934
+ // );
1935
+ // };
1936
+ // const CardPaymentDetails = ({ children }: any) => {
1937
+ // return <Box>{children}</Box>;
1938
+ // };
1939
+ // const CardNumber = ({ children, color, fontWeight, fontSize }: any) => {
1940
+ // const cardData = useCardData();
1941
+ // if (!cardData) return null;
1942
+ // return (
1943
+ // <Text
1944
+ // color={color || cardData.cardNumber.color}
1945
+ // fontWeight={fontWeight || cardData.cardNumber.fontWeight}
1946
+ // fontSize={fontSize || cardData.cardNumber.fontSize}
1947
+ // >
1948
+ // {children || cardData.cardNumber.text}
1949
+ // </Text>
1950
+ // );
1951
+ // };
1952
+ // const CardType = ({ children, fontSize, color }: any) => {
1953
+ // const cardData = useCardData();
1954
+ // if (!cardData) return null;
1955
+ // return (
1956
+ // <Text
1957
+ // fontSize={fontSize || cardData.cardType.fontSize}
1958
+ // color={color || cardData.cardType.color}
1959
+ // >
1960
+ // {children || cardData.cardType.text}
1961
+ // </Text>
1962
+ // );
1963
+ // };
1964
+ // // Card Total Section
1965
+ // const CardTotalSection = ({
1966
+ // children,
1967
+ // paddingX,
1968
+ // paddingY,
1969
+ // borderTop = "1px",
1970
+ // borderColor = "gray.200",
1971
+ // }: any) => {
1972
+ // const cardData = useCardData();
1973
+ // if (!cardData) return null;
1974
+ // return (
1975
+ // <Box
1976
+ // px={paddingX || cardData.totalSection.paddingX}
1977
+ // py={paddingY || cardData.totalSection.paddingY}
1978
+ // borderTop={borderTop}
1979
+ // borderColor={borderColor}
1980
+ // >
1981
+ // {children}
1982
+ // </Box>
1983
+ // );
1984
+ // };
1985
+ // const CardTotalContent = ({ children }: any) => {
1986
+ // return (
1987
+ // <Flex justify="space-between" align="center">
1988
+ // {children}
1989
+ // </Flex>
1990
+ // );
1991
+ // };
1992
+ // const CardTotalLabel = ({ children, color, fontWeight }: any) => {
1993
+ // const cardData = useCardData();
1994
+ // if (!cardData) return null;
1995
+ // return (
1996
+ // <Text
1997
+ // color={color || cardData.totalLabel.color}
1998
+ // fontWeight={fontWeight || cardData.totalLabel.fontWeight}
1999
+ // >
2000
+ // {children || cardData.totalLabel.text}
2001
+ // </Text>
2002
+ // );
2003
+ // };
2004
+ // const CardTotalAmount = ({ children, fontSize, fontWeight, color }: any) => {
2005
+ // const cardData = useCardData();
2006
+ // if (!cardData) return null;
2007
+ // return (
2008
+ // <Text
2009
+ // fontSize={fontSize || cardData.totalAmount.fontSize}
2010
+ // fontWeight={fontWeight || cardData.totalAmount.fontWeight}
2011
+ // color={color || cardData.totalAmount.color}
2012
+ // >
2013
+ // {children || cardData.totalAmount.text}
2014
+ // </Text>
2015
+ // );
2016
+ // };
2017
+ // // Main Card component
2018
+ // const Card = ({ children, width, maxWidth, fontFamily }: any) => {
2019
+ // const cardData = useCardData();
2020
+ // if (!cardData) return null;
2021
+ // return (
2022
+ // <Box
2023
+ // width={width || cardData.card.width}
2024
+ // maxWidth={maxWidth || cardData.card.maxWidth}
2025
+ // fontFamily={fontFamily || cardData.card.fontFamily}
2026
+ // >
2027
+ // {children}
2028
+ // </Box>
2029
+ // );
2030
+ // };
2031
+ // // Attach all subcomponents to Card
2032
+ // Card.Container = CardContainer;
2033
+ // Card.Header = CardHeader;
2034
+ // Card.HeaderContent = CardHeaderContent;
2035
+ // Card.HeaderTitle = CardHeaderTitle;
2036
+ // Card.HeaderTimer = CardHeaderTimer;
2037
+ // Card.Body = CardBody;
2038
+ // Card.BodyDriver = CardBodyDriver;
2039
+ // Card.BodyImage = CardBodyImage;
2040
+ // Card.BodyInfo = CardBodyInfo;
2041
+ // Card.BodyName = CardBodyName;
2042
+ // Card.BodySpan = CardBodySpan;
2043
+ // Card.BodyActions = CardBodyActions;
2044
+ // Card.BodyActionButton = CardBodyActionButton;
2045
+ // Card.BodyActionIcon = CardBodyActionIcon;
2046
+ // Card.Route = CardRoute;
2047
+ // Card.RouteContainer = CardRouteContainer;
2048
+ // Card.RouteItem = CardRouteItem;
2049
+ // Card.Payment = CardPayment;
2050
+ // Card.PaymentContainer = CardPaymentContainer;
2051
+ // Card.PaymentContent = CardPaymentContent;
2052
+ // Card.PaymentIconContainer = CardPaymentIconContainer;
2053
+ // Card.PaymentDetails = CardPaymentDetails;
2054
+ // Card.Number = CardNumber;
2055
+ // Card.Type = CardType;
2056
+ // Card.TotalSection = CardTotalSection;
2057
+ // Card.TotalContent = CardTotalContent;
2058
+ // Card.TotalLabel = CardTotalLabel;
2059
+ // Card.TotalAmount = CardTotalAmount;
2060
+ // export default Card;
2061
+ ///ddeeeeeeeeeeppeeepeppepepepepeep
2062
+ // components/Card/Card.tsx
2063
+ var _excluded$1 = ["children", "width", "maxWidth"],
2064
+ _excluded2$1 = ["children", "padding"],
2065
+ _excluded3 = ["children"],
2066
+ _excluded4 = ["children", "fontSize", "fontWeight", "color"],
2067
+ _excluded5 = ["children", "fontSize", "fontFamily", "color"],
2068
+ _excluded6 = ["children", "padding"],
2069
+ _excluded7 = ["children", "backgroundColor", "borderRadius", "padding"],
2070
+ _excluded8 = ["src", "alt", "width", "height", "borderRadius"],
2071
+ _excluded9 = ["children", "flexGrow"],
2072
+ _excluded0 = ["children", "fontWeight", "color"],
2073
+ _excluded1 = ["children", "fontSize", "color"],
2074
+ _excluded10 = ["children"],
2075
+ _excluded11 = ["children", "variant", "backgroundColor", "color", "hoverBackgroundColor", "border", "padding", "borderRadius", "onClick"],
2076
+ _excluded12 = ["children", "width", "height", "color"],
2077
+ _excluded13 = ["children", "paddingX", "paddingBottom"],
2078
+ _excluded14 = ["children", "gap"],
2079
+ _excluded15 = ["children", "icon", "iconBackgroundColor", "title", "subtitle"],
2080
+ _excluded16 = ["children", "paddingX", "paddingBottom"],
2081
+ _excluded17 = ["children", "backgroundColor", "borderRadius", "padding"],
2082
+ _excluded18 = ["children"],
2083
+ _excluded19 = ["children", "width", "height", "backgroundColor"],
2084
+ _excluded20 = ["children"],
2085
+ _excluded21 = ["children", "color", "fontWeight", "fontSize"],
2086
+ _excluded22 = ["children", "fontSize", "color"],
2087
+ _excluded23 = ["children", "paddingX", "paddingY", "borderTop", "borderColor"],
2088
+ _excluded24 = ["children"],
2089
+ _excluded25 = ["children", "color", "fontWeight"],
2090
+ _excluded26 = ["children", "fontSize", "fontWeight", "color"],
2091
+ _excluded27 = ["children", "width", "maxWidth", "fontFamily"];
2092
+ // Helper function to safely access nested properties
2093
+ var safeGet = function safeGet(obj, path) {
2094
+ var defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
2095
+ return path.split('.').reduce(function (acc, key) {
2096
+ if (acc && _typeof(acc) === 'object' && key in acc) {
2097
+ return acc[key];
2098
+ }
2099
+ return defaultValue;
2100
+ }, obj);
2101
+ };
2102
+ // Card Container
2103
+ var CardContainer = function CardContainer(_ref) {
2104
+ var children = _ref.children,
2105
+ width = _ref.width,
2106
+ maxWidth = _ref.maxWidth,
2107
+ props = _objectWithoutProperties(_ref, _excluded$1);
2108
+ var _useCardData = useCardData(),
2109
+ cardData = _useCardData.data;
2110
+ if (!cardData) return null;
2111
+ return jsx(Box, _objectSpread2(_objectSpread2({
2112
+ width: width || safeGet(cardData, 'container.width', '100%'),
2113
+ maxWidth: maxWidth || safeGet(cardData, 'container.maxWidth', '32rem'),
2114
+ mx: "auto",
2115
+ bg: safeGet(cardData, 'container.backgroundColor', '#ffffff'),
2116
+ borderRadius: safeGet(cardData, 'container.borderRadius', '1.5rem'),
2117
+ boxShadow: safeGet(cardData, 'container.boxShadow', '0 10px 15px -3px rgba(0, 0, 0, 0.1)'),
2118
+ overflow: safeGet(cardData, 'container.overflow', 'hidden')
2119
+ }, props), {}, {
2120
+ children: children
2121
+ }));
2122
+ };
2123
+ // Card Header
2124
+ var CardHeader = function CardHeader(_ref2) {
2125
+ var children = _ref2.children,
2126
+ padding = _ref2.padding,
2127
+ props = _objectWithoutProperties(_ref2, _excluded2$1);
2128
+ var _useCardData2 = useCardData(),
2129
+ cardData = _useCardData2.data;
2130
+ if (!cardData) return null;
2131
+ return jsx(Box, _objectSpread2(_objectSpread2({
2132
+ p: padding || safeGet(cardData, 'header.padding', '1.5rem'),
2133
+ borderBottom: "".concat(safeGet(cardData, 'header.borderBottom', '1px'), " solid ").concat(safeGet(cardData, 'header.borderColor', '#e5e7eb'))
2134
+ }, props), {}, {
2135
+ children: children
2136
+ }));
2137
+ };
2138
+ var CardHeaderContent = function CardHeaderContent(_ref3) {
2139
+ var children = _ref3.children,
2140
+ props = _objectWithoutProperties(_ref3, _excluded3);
2141
+ var _useCardData3 = useCardData(),
2142
+ cardData = _useCardData3.data;
2143
+ if (!cardData) return null;
2144
+ return jsx(Flex, _objectSpread2(_objectSpread2({
2145
+ display: safeGet(cardData, 'headerContent.display', 'flex'),
2146
+ justifyContent: safeGet(cardData, 'headerContent.justifyContent', 'space-between'),
2147
+ alignItems: safeGet(cardData, 'headerContent.alignItems', 'center')
2148
+ }, props), {}, {
2149
+ children: children
2150
+ }));
2151
+ };
2152
+ var CardHeaderTitle = function CardHeaderTitle(_ref4) {
2153
+ var children = _ref4.children,
2154
+ fontSize = _ref4.fontSize,
2155
+ fontWeight = _ref4.fontWeight,
2156
+ color = _ref4.color,
2157
+ props = _objectWithoutProperties(_ref4, _excluded4);
2158
+ var _useCardData4 = useCardData(),
2159
+ cardData = _useCardData4.data;
2160
+ if (!cardData) return null;
2161
+ return jsx(Text, _objectSpread2(_objectSpread2({
2162
+ fontSize: fontSize || safeGet(cardData, 'headerTitle.fontSize', '1.25rem'),
2163
+ fontWeight: fontWeight || safeGet(cardData, 'headerTitle.fontWeight', '600'),
2164
+ color: color || safeGet(cardData, 'headerTitle.color', '#111827')
2165
+ }, props), {}, {
2166
+ children: children || safeGet(cardData, 'headerTitle.text', 'Arrived in')
2167
+ }));
2168
+ };
2169
+ var CardHeaderTimer = function CardHeaderTimer(_ref5) {
2170
+ var children = _ref5.children,
2171
+ fontSize = _ref5.fontSize,
2172
+ fontFamily = _ref5.fontFamily,
2173
+ color = _ref5.color,
2174
+ props = _objectWithoutProperties(_ref5, _excluded5);
2175
+ var _useCardData5 = useCardData(),
2176
+ cardData = _useCardData5.data;
2177
+ if (!cardData) return null;
2178
+ return jsx(Text, _objectSpread2(_objectSpread2({
2179
+ fontSize: fontSize || safeGet(cardData, 'headerTimer.fontSize', '1.25rem'),
2180
+ fontFamily: fontFamily || safeGet(cardData, 'headerTimer.fontFamily', 'monospace'),
2181
+ color: color || safeGet(cardData, 'headerTimer.color', '#1f2937')
2182
+ }, props), {}, {
2183
+ children: children || safeGet(cardData, 'headerTimer.text', '00:05:20')
2184
+ }));
2185
+ };
2186
+ // Card Body
2187
+ var CardBody = function CardBody(_ref6) {
2188
+ var children = _ref6.children,
2189
+ padding = _ref6.padding,
2190
+ props = _objectWithoutProperties(_ref6, _excluded6);
2191
+ var _useCardData6 = useCardData(),
2192
+ cardData = _useCardData6.data;
2193
+ if (!cardData) return null;
2194
+ return jsx(Box, _objectSpread2(_objectSpread2({
2195
+ p: padding || safeGet(cardData, 'body.padding', '1.5rem')
2196
+ }, props), {}, {
2197
+ children: children
2198
+ }));
2199
+ };
2200
+ var CardBodyDriver = function CardBodyDriver(_ref7) {
2201
+ var children = _ref7.children,
2202
+ backgroundColor = _ref7.backgroundColor,
2203
+ borderRadius = _ref7.borderRadius,
2204
+ padding = _ref7.padding,
2205
+ props = _objectWithoutProperties(_ref7, _excluded7);
2206
+ var _useCardData7 = useCardData(),
2207
+ cardData = _useCardData7.data;
2208
+ if (!cardData) return null;
2209
+ return jsx(Flex, _objectSpread2(_objectSpread2({
2210
+ bg: backgroundColor || safeGet(cardData, 'bodyDriver.backgroundColor', '#f9fafb'),
2211
+ borderRadius: borderRadius || safeGet(cardData, 'bodyDriver.borderRadius', '0.75rem'),
2212
+ p: padding || safeGet(cardData, 'bodyDriver.padding', '1rem'),
2213
+ display: safeGet(cardData, 'bodyDriver.display', 'flex'),
2214
+ alignItems: safeGet(cardData, 'bodyDriver.alignItems', 'center'),
2215
+ gap: safeGet(cardData, 'bodyDriver.gap', '1rem')
2216
+ }, props), {}, {
2217
+ children: children
2218
+ }));
2219
+ };
2220
+ var CardBodyImage = function CardBodyImage(_ref8) {
2221
+ var src = _ref8.src,
2222
+ alt = _ref8.alt,
2223
+ width = _ref8.width,
2224
+ height = _ref8.height,
2225
+ borderRadius = _ref8.borderRadius,
2226
+ props = _objectWithoutProperties(_ref8, _excluded8);
2227
+ var _useCardData8 = useCardData(),
2228
+ cardData = _useCardData8.data;
2229
+ if (!cardData) return null;
2230
+ return jsx(Image, _objectSpread2({
2231
+ src: src || safeGet(cardData, 'bodyImage.src', 'https://plus.unsplash.com/premium_photo-1689977927774-401b12d137d6?w=900&auto=format&fit=crop&q=60&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxzZWFyY2h8OXx8bWFufGVufDB8fDB8fHww'),
2232
+ alt: alt || safeGet(cardData, 'bodyImage.alt', 'Driver'),
2233
+ width: width || safeGet(cardData, 'bodyImage.width', '3.5rem'),
2234
+ height: height || safeGet(cardData, 'bodyImage.height', '3.5rem'),
2235
+ borderRadius: borderRadius || safeGet(cardData, 'bodyImage.borderRadius', '50%'),
2236
+ objectFit: safeGet(cardData, 'bodyImage.objectFit', 'cover')
2237
+ }, props));
2238
+ };
2239
+ var CardBodyInfo = function CardBodyInfo(_ref9) {
2240
+ var children = _ref9.children,
2241
+ flexGrow = _ref9.flexGrow,
2242
+ props = _objectWithoutProperties(_ref9, _excluded9);
2243
+ var _useCardData9 = useCardData(),
2244
+ cardData = _useCardData9.data;
2245
+ if (!cardData) return null;
2246
+ return jsx(Box, _objectSpread2(_objectSpread2({
2247
+ flex: flexGrow || safeGet(cardData, 'bodyInfo.flexGrow', '1')
2248
+ }, props), {}, {
2249
+ children: children
2250
+ }));
2251
+ };
2252
+ var CardBodyName = function CardBodyName(_ref0) {
2253
+ var children = _ref0.children,
2254
+ fontWeight = _ref0.fontWeight,
2255
+ color = _ref0.color,
2256
+ props = _objectWithoutProperties(_ref0, _excluded0);
2257
+ var _useCardData0 = useCardData(),
2258
+ cardData = _useCardData0.data;
2259
+ if (!cardData) return null;
2260
+ return jsx(Text, _objectSpread2(_objectSpread2({
2261
+ fontWeight: fontWeight || safeGet(cardData, 'bodyName.fontWeight', '600'),
2262
+ color: color || safeGet(cardData, 'bodyName.color', '#111827')
2263
+ }, props), {}, {
2264
+ children: children || safeGet(cardData, 'bodyName.text', 'Jacob Jones')
2265
+ }));
2266
+ };
2267
+ var CardBodySpan = function CardBodySpan(_ref1) {
2268
+ var children = _ref1.children,
2269
+ fontSize = _ref1.fontSize,
2270
+ color = _ref1.color,
2271
+ props = _objectWithoutProperties(_ref1, _excluded1);
2272
+ var _useCardData1 = useCardData(),
2273
+ cardData = _useCardData1.data;
2274
+ if (!cardData) return null;
2275
+ return jsx(Text, _objectSpread2(_objectSpread2({
2276
+ fontSize: fontSize || safeGet(cardData, 'bodySpan.fontSize', '0.875rem'),
2277
+ color: color || safeGet(cardData, 'bodySpan.color', '#6b7280')
2278
+ }, props), {}, {
2279
+ children: children || safeGet(cardData, 'bodySpan.text', 'Omnitrans • SPX-8328')
2280
+ }));
2281
+ };
2282
+ var CardBodyActions = function CardBodyActions(_ref10) {
2283
+ var children = _ref10.children,
2284
+ props = _objectWithoutProperties(_ref10, _excluded10);
2285
+ var _useCardData10 = useCardData(),
2286
+ cardData = _useCardData10.data;
2287
+ if (!cardData) return null;
2288
+ return jsx(Flex, _objectSpread2(_objectSpread2({
2289
+ gap: safeGet(cardData, 'bodyActions.gap', '0.5rem')
2290
+ }, props), {}, {
2291
+ children: children
2292
+ }));
2293
+ };
2294
+ // Action Button Components
2295
+ var CardBodyActionButton = function CardBodyActionButton(_ref11) {
2296
+ var children = _ref11.children,
2297
+ _ref11$variant = _ref11.variant,
2298
+ variant = _ref11$variant === void 0 ? "outline" : _ref11$variant,
2299
+ backgroundColor = _ref11.backgroundColor,
2300
+ color = _ref11.color,
2301
+ hoverBackgroundColor = _ref11.hoverBackgroundColor,
2302
+ border = _ref11.border,
2303
+ _ref11$padding = _ref11.padding,
2304
+ padding = _ref11$padding === void 0 ? 2 : _ref11$padding,
2305
+ _ref11$borderRadius = _ref11.borderRadius,
2306
+ borderRadius = _ref11$borderRadius === void 0 ? "full" : _ref11$borderRadius,
2307
+ onClick = _ref11.onClick,
2308
+ props = _objectWithoutProperties(_ref11, _excluded11);
2309
+ var _useCardData11 = useCardData(),
2310
+ cardData = _useCardData11.data;
2311
+ if (!cardData) return null;
2312
+ // Use custom props if provided, otherwise use variant-based styles
2313
+ var getButtonStyles = function getButtonStyles() {
2314
+ // If custom props are provided, use them
2315
+ if (backgroundColor || color || hoverBackgroundColor || border) {
2316
+ return {
2317
+ bg: backgroundColor,
2318
+ color: color,
2319
+ border: border,
2320
+ borderColor: border === "none" ? "transparent" : "gray.300",
2321
+ _hover: {
2322
+ bg: hoverBackgroundColor
2323
+ }
2324
+ };
2325
+ }
2326
+ // Otherwise use variant-based styles
2327
+ if (variant === "solid") {
2328
+ return {
2329
+ bg: "#1f2937",
2330
+ // gray-800
2331
+ color: "white",
2332
+ border: "none",
2333
+ _hover: {
2334
+ bg: "#374151" // gray-700
2335
+ }
2336
+ };
2337
+ } else {
2338
+ return {
2339
+ bg: "transparent",
2340
+ color: "gray.600",
2341
+ border: "1px solid",
2342
+ borderColor: "gray.300",
2343
+ _hover: {
2344
+ bg: "gray.100"
2345
+ }
2346
+ };
2347
+ }
2348
+ };
2349
+ var styles = getButtonStyles();
2350
+ return jsx(Button, _objectSpread2(_objectSpread2({
2351
+ p: padding,
2352
+ borderRadius: borderRadius,
2353
+ bg: styles.bg,
2354
+ color: styles.color,
2355
+ border: styles.border,
2356
+ borderColor: styles.borderColor,
2357
+ transition: "all 0.2s",
2358
+ _hover: styles._hover,
2359
+ onClick: onClick,
2360
+ minW: "auto",
2361
+ h: "auto",
2362
+ display: "flex",
2363
+ alignItems: "center",
2364
+ justifyContent: "center"
2365
+ }, props), {}, {
2366
+ children: children
2367
+ }));
2368
+ };
2369
+ var CardBodyActionIcon = function CardBodyActionIcon(_ref12) {
2370
+ var children = _ref12.children,
2371
+ _ref12$width = _ref12.width,
2372
+ width = _ref12$width === void 0 ? 5 : _ref12$width,
2373
+ _ref12$height = _ref12.height,
2374
+ height = _ref12$height === void 0 ? 5 : _ref12$height,
2375
+ color = _ref12.color,
2376
+ props = _objectWithoutProperties(_ref12, _excluded12);
2377
+ return jsx(Box, _objectSpread2(_objectSpread2({
2378
+ width: width,
2379
+ height: height,
2380
+ color: color,
2381
+ display: "flex",
2382
+ alignItems: "center",
2383
+ justifyContent: "center"
2384
+ }, props), {}, {
2385
+ children: children
2386
+ }));
2387
+ };
2388
+ // Card Route
2389
+ var CardRoute = function CardRoute(_ref13) {
2390
+ var children = _ref13.children,
2391
+ paddingX = _ref13.paddingX,
2392
+ paddingBottom = _ref13.paddingBottom,
2393
+ props = _objectWithoutProperties(_ref13, _excluded13);
2394
+ var _useCardData12 = useCardData(),
2395
+ cardData = _useCardData12.data;
2396
+ if (!cardData) return null;
2397
+ return jsx(Box, _objectSpread2(_objectSpread2({
2398
+ px: paddingX || safeGet(cardData, 'route.paddingX', '1.5rem'),
2399
+ pb: paddingBottom || safeGet(cardData, 'route.paddingBottom', '1.5rem')
2400
+ }, props), {}, {
2401
+ children: children
2402
+ }));
2403
+ };
2404
+ var CardRouteContainer = function CardRouteContainer(_ref14) {
2405
+ var children = _ref14.children,
2406
+ gap = _ref14.gap,
2407
+ props = _objectWithoutProperties(_ref14, _excluded14);
2408
+ var _useCardData13 = useCardData(),
2409
+ cardData = _useCardData13.data;
2410
+ if (!cardData) return null;
2411
+ return jsx(VStack, _objectSpread2(_objectSpread2({
2412
+ spacing: gap || safeGet(cardData, 'routeContainer.gap', '1.5rem'),
2413
+ align: "stretch"
2414
+ }, props), {}, {
2415
+ children: children
2416
+ }));
2417
+ };
2418
+ var CardRouteItem = function CardRouteItem(_ref15) {
2419
+ var children = _ref15.children,
2420
+ icon = _ref15.icon,
2421
+ _ref15$iconBackground = _ref15.iconBackgroundColor,
2422
+ iconBackgroundColor = _ref15$iconBackground === void 0 ? "blue.50" : _ref15$iconBackground,
2423
+ title = _ref15.title,
2424
+ subtitle = _ref15.subtitle,
2425
+ props = _objectWithoutProperties(_ref15, _excluded15);
2426
+ var _useCardData14 = useCardData(),
2427
+ cardData = _useCardData14.data;
2428
+ if (!cardData) return null;
2429
+ return jsxs(HStack, _objectSpread2(_objectSpread2({
2430
+ align: "flex-start",
2431
+ spacing: 4
2432
+ }, props), {}, {
2433
+ children: [jsx(Box, {
2434
+ mt: 0.5,
2435
+ flexShrink: 0,
2436
+ children: jsx(Flex, {
2437
+ width: 8,
2438
+ height: 8,
2439
+ borderRadius: "full",
2440
+ backgroundColor: iconBackgroundColor,
2441
+ align: "center",
2442
+ justify: "center",
2443
+ children: icon
2444
+ })
2445
+ }), jsx(Box, {
2446
+ flex: "1",
2447
+ children: children || jsxs(Fragment, {
2448
+ children: [jsx(Text, {
2449
+ fontWeight: "semibold",
2450
+ color: "gray.900",
2451
+ fontSize: "md",
2452
+ lineHeight: "short",
2453
+ mb: 1,
2454
+ children: title || safeGet(cardData, 'pickup.title', '456 Elm Street, Springfield')
2455
+ }), jsx(Text, {
2456
+ fontSize: "sm",
2457
+ color: "gray.500",
2458
+ lineHeight: "short",
2459
+ children: subtitle || safeGet(cardData, 'pickup.subtitle', 'Pickup point')
2460
+ })]
2461
+ })
2462
+ })]
2463
+ }));
2464
+ };
2465
+ // Card Payment
2466
+ var CardPayment = function CardPayment(_ref16) {
2467
+ var children = _ref16.children,
2468
+ paddingX = _ref16.paddingX,
2469
+ paddingBottom = _ref16.paddingBottom,
2470
+ props = _objectWithoutProperties(_ref16, _excluded16);
2471
+ var _useCardData15 = useCardData(),
2472
+ cardData = _useCardData15.data;
2473
+ if (!cardData) return null;
2474
+ return jsx(Box, _objectSpread2(_objectSpread2({
2475
+ px: paddingX || safeGet(cardData, 'payment.paddingX', '1.5rem'),
2476
+ pb: paddingBottom || safeGet(cardData, 'payment.paddingBottom', '1.5rem')
2477
+ }, props), {}, {
2478
+ children: children
2479
+ }));
2480
+ };
2481
+ var CardPaymentContainer = function CardPaymentContainer(_ref17) {
2482
+ var children = _ref17.children,
2483
+ backgroundColor = _ref17.backgroundColor,
2484
+ borderRadius = _ref17.borderRadius,
2485
+ padding = _ref17.padding,
2486
+ props = _objectWithoutProperties(_ref17, _excluded17);
2487
+ var _useCardData16 = useCardData(),
2488
+ cardData = _useCardData16.data;
2489
+ if (!cardData) return null;
2490
+ return jsx(Box, _objectSpread2(_objectSpread2({
2491
+ bg: backgroundColor || safeGet(cardData, 'paymentContainer.backgroundColor', '#111827'),
2492
+ borderRadius: borderRadius || safeGet(cardData, 'paymentContainer.borderRadius', '0.75rem'),
2493
+ p: padding || safeGet(cardData, 'paymentContainer.padding', '1rem')
2494
+ }, props), {}, {
2495
+ children: children
2496
+ }));
2497
+ };
2498
+ var CardPaymentContent = function CardPaymentContent(_ref18) {
2499
+ var children = _ref18.children,
2500
+ props = _objectWithoutProperties(_ref18, _excluded18);
2501
+ return jsx(Flex, _objectSpread2(_objectSpread2({
2502
+ align: "center",
2503
+ gap: 4
2504
+ }, props), {}, {
2505
+ children: children
2506
+ }));
2507
+ };
2508
+ var CardPaymentIconContainer = function CardPaymentIconContainer(_ref19) {
2509
+ var children = _ref19.children,
2510
+ _ref19$width = _ref19.width,
2511
+ width = _ref19$width === void 0 ? 12 : _ref19$width,
2512
+ _ref19$height = _ref19.height,
2513
+ height = _ref19$height === void 0 ? 12 : _ref19$height,
2514
+ _ref19$backgroundColo = _ref19.backgroundColor,
2515
+ backgroundColor = _ref19$backgroundColo === void 0 ? "gray.800" : _ref19$backgroundColo,
2516
+ props = _objectWithoutProperties(_ref19, _excluded19);
2517
+ return jsx(Flex, _objectSpread2(_objectSpread2({
2518
+ width: width,
2519
+ height: height,
2520
+ borderRadius: "full",
2521
+ backgroundColor: backgroundColor,
2522
+ align: "center",
2523
+ justify: "center"
2524
+ }, props), {}, {
2525
+ children: children
2526
+ }));
2527
+ };
2528
+ var CardPaymentDetails = function CardPaymentDetails(_ref20) {
2529
+ var children = _ref20.children,
2530
+ props = _objectWithoutProperties(_ref20, _excluded20);
2531
+ return jsx(Box, _objectSpread2(_objectSpread2({}, props), {}, {
2532
+ children: children
2533
+ }));
2534
+ };
2535
+ var CardNumber = function CardNumber(_ref21) {
2536
+ var children = _ref21.children,
2537
+ color = _ref21.color,
2538
+ fontWeight = _ref21.fontWeight,
2539
+ fontSize = _ref21.fontSize,
2540
+ props = _objectWithoutProperties(_ref21, _excluded21);
2541
+ var _useCardData17 = useCardData(),
2542
+ cardData = _useCardData17.data;
2543
+ if (!cardData) return null;
2544
+ return jsx(Text, _objectSpread2(_objectSpread2({
2545
+ color: color || safeGet(cardData, 'cardNumber.color', '#ffffff'),
2546
+ fontWeight: fontWeight || safeGet(cardData, 'cardNumber.fontWeight', '500'),
2547
+ fontSize: fontSize || safeGet(cardData, 'cardNumber.fontSize', '1.125rem')
2548
+ }, props), {}, {
2549
+ children: children || safeGet(cardData, 'cardNumber.text', '**** 7493')
2550
+ }));
2551
+ };
2552
+ var CardType = function CardType(_ref22) {
2553
+ var children = _ref22.children,
2554
+ fontSize = _ref22.fontSize,
2555
+ color = _ref22.color,
2556
+ props = _objectWithoutProperties(_ref22, _excluded22);
2557
+ var _useCardData18 = useCardData(),
2558
+ cardData = _useCardData18.data;
2559
+ if (!cardData) return null;
2560
+ return jsx(Text, _objectSpread2(_objectSpread2({
2561
+ fontSize: fontSize || safeGet(cardData, 'cardType.fontSize', '0.875rem'),
2562
+ color: color || safeGet(cardData, 'cardType.color', '#d1d5db')
2563
+ }, props), {}, {
2564
+ children: children || safeGet(cardData, 'cardType.text', 'Credit card')
2565
+ }));
2566
+ };
2567
+ // Card Total Section
2568
+ var CardTotalSection = function CardTotalSection(_ref23) {
2569
+ var children = _ref23.children,
2570
+ paddingX = _ref23.paddingX,
2571
+ paddingY = _ref23.paddingY,
2572
+ _ref23$borderTop = _ref23.borderTop,
2573
+ borderTop = _ref23$borderTop === void 0 ? "1px" : _ref23$borderTop,
2574
+ _ref23$borderColor = _ref23.borderColor,
2575
+ borderColor = _ref23$borderColor === void 0 ? "gray.200" : _ref23$borderColor,
2576
+ props = _objectWithoutProperties(_ref23, _excluded23);
2577
+ var _useCardData19 = useCardData(),
2578
+ cardData = _useCardData19.data;
2579
+ if (!cardData) return null;
2580
+ return jsx(Box, _objectSpread2(_objectSpread2({
2581
+ px: paddingX || safeGet(cardData, 'totalSection.paddingX', '1.5rem'),
2582
+ py: paddingY || safeGet(cardData, 'totalSection.paddingY', '1.5rem'),
2583
+ borderTop: borderTop,
2584
+ borderColor: borderColor
2585
+ }, props), {}, {
2586
+ children: children
2587
+ }));
2588
+ };
2589
+ var CardTotalContent = function CardTotalContent(_ref24) {
2590
+ var children = _ref24.children,
2591
+ props = _objectWithoutProperties(_ref24, _excluded24);
2592
+ return jsx(Flex, _objectSpread2(_objectSpread2({
2593
+ justify: "space-between",
2594
+ align: "center"
2595
+ }, props), {}, {
2596
+ children: children
2597
+ }));
2598
+ };
2599
+ var CardTotalLabel = function CardTotalLabel(_ref25) {
2600
+ var children = _ref25.children,
2601
+ color = _ref25.color,
2602
+ fontWeight = _ref25.fontWeight,
2603
+ props = _objectWithoutProperties(_ref25, _excluded25);
2604
+ var _useCardData20 = useCardData(),
2605
+ cardData = _useCardData20.data;
2606
+ if (!cardData) return null;
2607
+ return jsx(Text, _objectSpread2(_objectSpread2({
2608
+ color: color || safeGet(cardData, 'totalLabel.color', '#111827'),
2609
+ fontWeight: fontWeight || safeGet(cardData, 'totalLabel.fontWeight', '500')
2610
+ }, props), {}, {
2611
+ children: children || safeGet(cardData, 'totalLabel.text', 'Total orders')
2612
+ }));
2613
+ };
2614
+ var CardTotalAmount = function CardTotalAmount(_ref26) {
2615
+ var children = _ref26.children,
2616
+ fontSize = _ref26.fontSize,
2617
+ fontWeight = _ref26.fontWeight,
2618
+ color = _ref26.color,
2619
+ props = _objectWithoutProperties(_ref26, _excluded26);
2620
+ var _useCardData21 = useCardData(),
2621
+ cardData = _useCardData21.data;
2622
+ if (!cardData) return null;
2623
+ return jsx(Text, _objectSpread2(_objectSpread2({
2624
+ fontSize: fontSize || safeGet(cardData, 'totalAmount.fontSize', '1.25rem'),
2625
+ fontWeight: fontWeight || safeGet(cardData, 'totalAmount.fontWeight', '700'),
2626
+ color: color || safeGet(cardData, 'totalAmount.color', '#111827')
2627
+ }, props), {}, {
2628
+ children: children || safeGet(cardData, 'totalAmount.text', '$5.75')
2629
+ }));
2630
+ };
2631
+ // Main Card component
2632
+ var Card = function Card(_ref27) {
2633
+ var children = _ref27.children,
2634
+ width = _ref27.width,
2635
+ maxWidth = _ref27.maxWidth,
2636
+ fontFamily = _ref27.fontFamily,
2637
+ props = _objectWithoutProperties(_ref27, _excluded27);
2638
+ var _useCardData22 = useCardData(),
2639
+ cardData = _useCardData22.data;
2640
+ if (!cardData) return null;
2641
+ return jsx(Box, _objectSpread2(_objectSpread2({
2642
+ width: width || safeGet(cardData, 'card.width', '100%'),
2643
+ maxWidth: maxWidth || safeGet(cardData, 'card.maxWidth', '32rem'),
2644
+ fontFamily: fontFamily || safeGet(cardData, 'card.fontFamily', 'Inter, system-ui, sans-serif')
2645
+ }, props), {}, {
2646
+ children: children
2647
+ }));
2648
+ };
2649
+ // Attach all subcomponents to Card
2650
+ Card.Container = CardContainer;
2651
+ Card.Header = CardHeader;
2652
+ Card.HeaderContent = CardHeaderContent;
2653
+ Card.HeaderTitle = CardHeaderTitle;
2654
+ Card.HeaderTimer = CardHeaderTimer;
2655
+ Card.Body = CardBody;
2656
+ Card.BodyDriver = CardBodyDriver;
2657
+ Card.BodyImage = CardBodyImage;
2658
+ Card.BodyInfo = CardBodyInfo;
2659
+ Card.BodyName = CardBodyName;
2660
+ Card.BodySpan = CardBodySpan;
2661
+ Card.BodyActions = CardBodyActions;
2662
+ Card.BodyActionButton = CardBodyActionButton;
2663
+ Card.BodyActionIcon = CardBodyActionIcon;
2664
+ Card.Route = CardRoute;
2665
+ Card.RouteContainer = CardRouteContainer;
2666
+ Card.RouteItem = CardRouteItem;
2667
+ Card.Payment = CardPayment;
2668
+ Card.PaymentContainer = CardPaymentContainer;
2669
+ Card.PaymentContent = CardPaymentContent;
2670
+ Card.PaymentIconContainer = CardPaymentIconContainer;
2671
+ Card.PaymentDetails = CardPaymentDetails;
2672
+ Card.Number = CardNumber;
2673
+ Card.Type = CardType;
2674
+ Card.TotalSection = CardTotalSection;
2675
+ Card.TotalContent = CardTotalContent;
2676
+ Card.TotalLabel = CardTotalLabel;
2677
+ Card.TotalAmount = CardTotalAmount;
2678
+
2679
+ var DefaultCard = function DefaultCard() {
2680
+ return jsx(Card, {
2681
+ children: jsxs(Card.Container, {
2682
+ children: [jsx(Card.Header, {
2683
+ children: jsxs(Card.HeaderContent, {
2684
+ children: [jsx(Card.HeaderTitle, {
2685
+ children: "Arrived in"
2686
+ }), jsx(Card.HeaderTimer, {
2687
+ children: "00:05:20"
2688
+ })]
2689
+ })
2690
+ }), jsx(Card.Body, {
2691
+ children: jsxs(Card.BodyDriver, {
2692
+ children: [jsx(Card.BodyImage, {}), jsxs(Card.BodyInfo, {
2693
+ children: [jsx(Card.BodyName, {
2694
+ children: "Jacob Jones"
2695
+ }), jsx(Card.BodySpan, {
2696
+ children: "Omnitrans \u2022 SPX-8328"
2697
+ })]
2698
+ }), jsxs(Card.BodyActions, {
2699
+ children: [jsx(Card.BodyActionButton, {
2700
+ children: jsx(Card.BodyActionIcon, {
2701
+ children: jsx("svg", {
2702
+ xmlns: "http://www.w3.org/2000/svg",
2703
+ className: "h-5 w-5 text-gray-600",
2704
+ viewBox: "0 0 20 20",
2705
+ fill: "currentColor",
2706
+ children: jsx("path", {
2707
+ d: "M2 3a1 1 0 011-1h2.153a1 1 0 01.986.836l.74 4.435a1 1 0 01-.54 1.06l-1.548.773a11.041 11.041 0 006.105 6.105l.774-1.548a1 1 0 011.059-.54l4.435.74a1 1 0 01.836.986V17a1 1 0 01-1 1h-2C9.083 18 3 11.917 3 6V3z"
2708
+ })
2709
+ })
2710
+ })
2711
+ }), jsx(Card.BodyActionButton, {
2712
+ backgroundColor: "gray.800",
2713
+ color: "white",
2714
+ hoverBackgroundColor: "gray.700",
2715
+ border: "none",
2716
+ children: jsx(Card.BodyActionIcon, {
2717
+ color: "white",
2718
+ children: jsx("svg", {
2719
+ xmlns: "http://www.w3.org/2000/svg",
2720
+ className: "h-5 w-5",
2721
+ viewBox: "0 0 20 20",
2722
+ fill: "currentColor",
2723
+ children: jsx("path", {
2724
+ fillRule: "evenodd",
2725
+ d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2H9.5v-3a1 1 0 00-1-1z",
2726
+ clipRule: "evenodd"
2727
+ })
2728
+ })
2729
+ })
2730
+ })]
2731
+ })]
2732
+ })
2733
+ }), jsx(Card.Route, {
2734
+ children: jsxs(Card.RouteContainer, {
2735
+ children: [jsx(Card.RouteItem, {
2736
+ icon: jsx("svg", {
2737
+ xmlns: "http://www.w3.org/2000/svg",
2738
+ className: "h-4 w-4 text-blue-600",
2739
+ viewBox: "0 0 20 20",
2740
+ fill: "currentColor",
2741
+ children: jsx("path", {
2742
+ fillRule: "evenodd",
2743
+ d: "M10 18a8 8 0 100-16 8 8 0 000 16zm1-11a1 1 0 10-2 0v2a1 1 0 00.293.707l2.828 2.829a1 1 0 101.414-1.414L11 9.586V7z",
2744
+ clipRule: "evenodd"
2745
+ })
2746
+ }),
2747
+ iconBackgroundColor: "blue.50",
2748
+ title: "456 Elm Street, Springfield",
2749
+ subtitle: "Pickup point"
2750
+ }), jsx(Card.RouteItem, {
2751
+ icon: jsx("svg", {
2752
+ xmlns: "http://www.w3.org/2000/svg",
2753
+ className: "h-4 w-4 text-gray-600",
2754
+ viewBox: "0 0 20 20",
2755
+ fill: "currentColor",
2756
+ children: jsx("path", {
2757
+ fillRule: "evenodd",
2758
+ d: "M5.05 4.05a7 7 0 119.9 9.9L10 18.9l-4.95-4.95a7 7 0 010-9.9zM10 11a2 2 0 100-4 2 2 0 000 4z",
2759
+ clipRule: "evenodd"
2760
+ })
2761
+ }),
2762
+ iconBackgroundColor: "gray.50",
2763
+ title: "739 Main Street, Springfield",
2764
+ subtitle: "Destination"
2765
+ })]
2766
+ })
2767
+ }), jsx(Card.Payment, {
2768
+ children: jsx(Card.PaymentContainer, {
2769
+ children: jsxs(Card.PaymentContent, {
2770
+ children: [jsx(Card.PaymentIconContainer, {
2771
+ children: jsx(Card.BodyActionIcon, {
2772
+ width: 6,
2773
+ height: 6,
2774
+ color: "gray.300",
2775
+ children: jsx("svg", {
2776
+ xmlns: "http://www.w3.org/2000/svg",
2777
+ className: "h-6 w-6 text-gray-300",
2778
+ viewBox: "0 0 20 20",
2779
+ fill: "currentColor",
2780
+ children: jsx("path", {
2781
+ d: "M4 4a2 2 0 00-2 2v8a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2H4zm1 4h10v2H5V8zm0 4h10v2H5v-2z"
2782
+ })
2783
+ })
2784
+ })
2785
+ }), jsxs(Card.PaymentDetails, {
2786
+ children: [jsx(Card.Number, {
2787
+ children: "**** 7493"
2788
+ }), jsx(Card.Type, {
2789
+ children: "Credit card"
2790
+ })]
2791
+ })]
2792
+ })
2793
+ })
2794
+ }), jsx(Card.TotalSection, {
2795
+ children: jsxs(Card.TotalContent, {
2796
+ children: [jsx(Card.TotalLabel, {
2797
+ children: "Total orders"
2798
+ }), jsx(Card.TotalAmount, {
2799
+ children: "$5.75"
2800
+ })]
2801
+ })
2802
+ })]
2803
+ })
2804
+ });
2805
+ };
2806
+
2807
+ var useDynamicComponents = function useDynamicComponents() {
2808
+ var _useStrata = useStrata(),
2809
+ designSystem = _useStrata.designSystem,
2810
+ syncVersion = _useStrata.syncVersion;
2811
+ var _useState = useState(strataRegistry.getRegistry()),
2812
+ _useState2 = _slicedToArray(_useState, 2),
2813
+ registry = _useState2[0],
2814
+ setRegistry = _useState2[1];
2815
+ var _useState3 = useState(false),
2816
+ _useState4 = _slicedToArray(_useState3, 2),
2817
+ isInitialized = _useState4[0],
2818
+ setIsInitialized = _useState4[1];
2819
+ // Sync components when design system changes
2820
+ useEffect(function () {
2821
+ console.log('🔄 useDynamicComponents: Design system changed', {
2822
+ components: Object.keys(designSystem.components),
2823
+ syncVersion: syncVersion
2824
+ });
2825
+ if (Object.keys(designSystem.components).length > 0) {
2826
+ console.log('🔄 Syncing registry with design system...');
2827
+ // Sync the entire registry with the current design system
2828
+ strataRegistry.syncWithDesignSystem(designSystem);
2829
+ setIsInitialized(true);
2830
+ }
2831
+ }, [designSystem, syncVersion]);
2832
+ // Subscribe to registry changes
2833
+ useEffect(function () {
2834
+ console.log('🔄 useDynamicComponents: Subscribing to registry changes');
2835
+ var unsubscribe = strataRegistry.subscribe(function (newRegistry) {
2836
+ console.log('🔄 Registry updated:', Object.keys(newRegistry));
2837
+ setRegistry(newRegistry);
2838
+ });
2839
+ return unsubscribe;
2840
+ }, []);
2841
+ console.log('📋 useDynamicComponents returning registry:', {
2842
+ registryKeys: Object.keys(registry),
2843
+ isInitialized: isInitialized,
2844
+ hasRoboForm: 'RoboForm' in registry
2845
+ });
2846
+ return registry;
2847
+ };
2848
+
2849
+ // This hook provides direct access to all components in PascalCase
2850
+ var useComponents = function useComponents() {
2851
+ var dynamicComponents = useDynamicComponents();
2852
+ console.log('🔄 useComponents returning:', {
2853
+ componentCount: Object.keys(dynamicComponents).length,
2854
+ componentNames: Object.keys(dynamicComponents)
2855
+ });
2856
+ return dynamicComponents;
2857
+ };
2858
+
2859
+ var StrataDebug = function StrataDebug() {
2860
+ var components = useComponents();
2861
+ var _useStrata = useStrata(),
2862
+ designSystem = _useStrata.designSystem,
2863
+ syncStatus = _useStrata.syncStatus,
2864
+ lastSynced = _useStrata.lastSynced,
2865
+ syncUrl = _useStrata.syncUrl,
2866
+ syncEnabled = _useStrata.syncEnabled,
2867
+ syncInterval = _useStrata.syncInterval,
2868
+ syncToken = _useStrata.syncToken,
2869
+ snapshotCdnBase = _useStrata.snapshotCdnBase,
2870
+ projectId = _useStrata.projectId;
2871
+ var isCdnMode = !!(snapshotCdnBase && projectId);
2872
+ var isLegacyMode = !isCdnMode && !!syncUrl;
2873
+ var syncModeLabel;
2874
+ if (!syncEnabled) {
2875
+ syncModeLabel = '❌ Disabled';
2876
+ } else if (isCdnMode) {
2877
+ syncModeLabel = '✅ CDN Snapshot';
2878
+ } else {
2879
+ syncModeLabel = '⚠️ Legacy (3 requests/poll)';
2880
+ }
2881
+ return jsxs("div", {
2882
+ style: {
2883
+ padding: '20px',
2884
+ border: '1px solid #ccc',
2885
+ margin: '10px'
2886
+ },
2887
+ children: [jsx("h3", {
2888
+ children: "Dynamic Components Debug"
2889
+ }), jsxs("p", {
2890
+ children: [jsx("strong", {
2891
+ children: "Sync Status:"
2892
+ }), " ", syncStatus]
2893
+ }), jsxs("p", {
2894
+ children: [jsx("strong", {
2895
+ children: "Sync Mode:"
2896
+ }), " ", syncModeLabel]
2897
+ }), syncEnabled && isCdnMode && jsxs(Fragment, {
2898
+ children: [jsxs("p", {
2899
+ children: [jsx("strong", {
2900
+ children: "Project ID:"
2901
+ }), " ", projectId]
2902
+ }), jsxs("p", {
2903
+ children: [jsx("strong", {
2904
+ children: "Snapshot URL:"
2905
+ }), " ", "".concat(snapshotCdnBase, "/snapshots/").concat(projectId, "/strata.json")]
2906
+ }), jsxs("p", {
2907
+ children: [jsx("strong", {
2908
+ children: "Token auth:"
2909
+ }), " ", syncToken ? '✅ Present' : '❌ None']
2910
+ }), jsxs("p", {
2911
+ children: [jsx("strong", {
2912
+ children: "Sync interval:"
2913
+ }), " ", syncInterval, "ms"]
2914
+ })]
2915
+ }), syncEnabled && isLegacyMode && jsxs(Fragment, {
2916
+ children: [jsxs("p", {
2917
+ children: [jsx("strong", {
2918
+ children: "Sync URL:"
2919
+ }), " ", syncUrl]
2920
+ }), jsxs("p", {
2921
+ children: [jsx("strong", {
2922
+ children: "Token auth:"
2923
+ }), " ", syncToken ? '✅ Present' : '❌ None']
2924
+ }), jsxs("p", {
2925
+ children: [jsx("strong", {
2926
+ children: "Sync interval:"
2927
+ }), " ", syncInterval, "ms"]
2928
+ })]
2929
+ }), jsxs("p", {
2930
+ children: [jsx("strong", {
2931
+ children: "Last Synced:"
2932
+ }), " ", (lastSynced === null || lastSynced === void 0 ? void 0 : lastSynced.toLocaleTimeString()) || 'Never']
2933
+ }), jsxs("p", {
2934
+ children: [jsx("strong", {
2935
+ children: "Raw Components in Design System:"
2936
+ }), " ", Object.keys(designSystem.components).join(', ') || 'None']
2937
+ }), jsxs("p", {
2938
+ children: [jsx("strong", {
2939
+ children: "Components in Registry (PascalCase):"
2940
+ }), " ", Object.keys(components).join(', ') || 'None']
2941
+ }), jsxs("div", {
2942
+ style: {
2943
+ marginTop: '10px',
2944
+ padding: '10px',
2945
+ backgroundColor: '#f5f5f5'
2946
+ },
2947
+ children: [jsx("h4", {
2948
+ children: "Component Conversion Map:"
2949
+ }), jsx("ul", {
2950
+ children: Object.keys(designSystem.components).map(function (originalName) {
2951
+ var pascalName = Object.keys(components).find(function (key) {
2952
+ return key.toLowerCase() === originalName.toLowerCase().replace(/[-_]/g, '');
2953
+ });
2954
+ return jsxs("li", {
2955
+ children: [jsx("code", {
2956
+ children: originalName
2957
+ }), " \u2192 ", jsx("code", {
2958
+ children: pascalName || 'Not converted'
2959
+ })]
2960
+ }, originalName);
2961
+ })
2962
+ })]
2963
+ }), Object.keys(components).length === 0 && jsx("div", {
2964
+ style: {
2965
+ color: 'orange'
2966
+ },
2967
+ children: "No components in registry. Check if sync is working."
2968
+ })]
2969
+ });
2970
+ };
2971
+
2972
+ //working
2973
+ // "use client";
2974
+ // import { useDynamicComponents } from './useDynamicComponents';
2975
+ // export const useComponent = (componentName: string) => {
2976
+ // const dynamicComponents = useDynamicComponents();
2977
+ // // Try exact match first
2978
+ // if (dynamicComponents[componentName]) {
2979
+ // return dynamicComponents[componentName];
2980
+ // }
2981
+ // // Try PascalCase
2982
+ // const pascalCaseName = componentName
2983
+ // .split('-')
2984
+ // .map(part => part.charAt(0).toUpperCase() + part.slice(1))
2985
+ // .join('');
2986
+ // if (dynamicComponents[pascalCaseName]) {
2987
+ // return dynamicComponents[pascalCaseName];
2988
+ // }
2989
+ // // Try camelCase
2990
+ // const camelCaseName = componentName
2991
+ // .split('-')
2992
+ // .map((part, index) => index === 0 ? part : part.charAt(0).toUpperCase() + part.slice(1))
2993
+ // .join('');
2994
+ // return dynamicComponents[camelCaseName];
2995
+ // };
2996
+ // working
2997
+ var useComponent = function useComponent(componentName) {
2998
+ var dynamicComponents = useDynamicComponents();
2999
+ // Try exact match first
3000
+ if (dynamicComponents[componentName]) {
3001
+ return dynamicComponents[componentName];
3002
+ }
3003
+ // Try PascalCase conversion
3004
+ var toPascalCase = function toPascalCase(str) {
3005
+ return str.split(/[-_]/).map(function (part) {
3006
+ return part.charAt(0).toUpperCase() + part.slice(1).toLowerCase();
3007
+ }).join('');
3008
+ };
3009
+ var pascalCaseName = toPascalCase(componentName);
3010
+ if (dynamicComponents[pascalCaseName]) {
3011
+ return dynamicComponents[pascalCaseName];
3012
+ }
3013
+ console.warn("Component \"".concat(componentName, "\" not found. Available:"), Object.keys(dynamicComponents));
3014
+ return null;
3015
+ };
3016
+
3017
+ var _excluded = ["name", "children"],
3018
+ _excluded2 = ["formName", "children"];
3019
+ // This component automatically imports and renders any dynamic component
3020
+ var DynamicComponent = function DynamicComponent(_ref) {
3021
+ var name = _ref.name,
3022
+ children = _ref.children,
3023
+ props = _objectWithoutProperties(_ref, _excluded);
3024
+ var components = useComponents();
3025
+ var Component = components[name];
3026
+ if (!Component) {
3027
+ console.warn("Component \"".concat(name, "\" not found in registry. Available: ").concat(Object.keys(components).join(', ')));
3028
+ return null;
3029
+ }
3030
+ return /*#__PURE__*/React.createElement(Component, props, children);
3031
+ };
3032
+ // Helper component for common patterns
3033
+ var AutoForm = function AutoForm(_ref2) {
3034
+ var _ref2$formName = _ref2.formName,
3035
+ formName = _ref2$formName === void 0 ? 'Form' : _ref2$formName,
3036
+ children = _ref2.children,
3037
+ props = _objectWithoutProperties(_ref2, _excluded2);
3038
+ var components = useComponents();
3039
+ var FormComponent = components[formName] || components['Form'];
3040
+ if (!FormComponent) {
3041
+ return jsxs("div", {
3042
+ children: ["Form component \"", formName, "\" not found"]
3043
+ });
3044
+ }
3045
+ return /*#__PURE__*/React.createElement(FormComponent, props, children);
3046
+ };
3047
+
3048
+ export { AutoForm, Card, DefaultCard, DynamicComponent, StrataComponentFactory, StrataDebug, StrataProvider, strataRegistry, useComponent, useComponents, useDynamicComponents, useStrata };
3049
+ //# sourceMappingURL=index.esm.js.map