@dynshift/layr 1.0.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.
package/dist/index.js ADDED
@@ -0,0 +1,807 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import React from 'react';
3
+
4
+ // src/components/container.tsx
5
+ var BoxShape = /* @__PURE__ */ ((BoxShape2) => {
6
+ BoxShape2["rectangle"] = "rectangle";
7
+ BoxShape2["circle"] = "circle";
8
+ return BoxShape2;
9
+ })(BoxShape || {});
10
+ function edgeInsetsToCSS(insets) {
11
+ if (insets === void 0) return void 0;
12
+ if (typeof insets === "number") return `${insets}px`;
13
+ if ("all" in insets) {
14
+ return `${insets.all}px`;
15
+ }
16
+ if ("horizontal" in insets || "vertical" in insets) {
17
+ const horizontal = insets.horizontal ?? 0;
18
+ const vertical = insets.vertical ?? 0;
19
+ return `${vertical}px ${horizontal}px`;
20
+ }
21
+ if ("top" in insets || "right" in insets || "bottom" in insets || "left" in insets) {
22
+ const { top = 0, right = 0, bottom = 0, left = 0 } = insets;
23
+ return `${top}px ${right}px ${bottom}px ${left}px`;
24
+ }
25
+ return "0px";
26
+ }
27
+ function resolvePadding(props) {
28
+ const base = {};
29
+ if (typeof props.padding === "number") {
30
+ base.top = base.bottom = base.left = base.right = props.padding;
31
+ } else if (props.padding) {
32
+ if ("all" in props.padding) {
33
+ base.top = base.bottom = base.left = base.right = props.padding.all;
34
+ } else if ("horizontal" in props.padding || "vertical" in props.padding) {
35
+ if (props.padding.horizontal !== void 0) {
36
+ base.left = base.right = props.padding.horizontal;
37
+ }
38
+ if (props.padding.vertical !== void 0) {
39
+ base.top = base.bottom = props.padding.vertical;
40
+ }
41
+ } else {
42
+ Object.assign(base, props.padding);
43
+ }
44
+ }
45
+ if (props.paddingHorizontal !== void 0) {
46
+ base.left = base.right = props.paddingHorizontal;
47
+ }
48
+ if (props.paddingVertical !== void 0) {
49
+ base.top = base.bottom = props.paddingVertical;
50
+ }
51
+ if (props.paddingTop !== void 0) base.top = props.paddingTop;
52
+ if (props.paddingBottom !== void 0) base.bottom = props.paddingBottom;
53
+ if (props.paddingLeft !== void 0) base.left = props.paddingLeft;
54
+ if (props.paddingRight !== void 0) base.right = props.paddingRight;
55
+ return base;
56
+ }
57
+ function resolveMargin(props) {
58
+ const base = {};
59
+ if (typeof props.margin === "number") {
60
+ base.top = base.bottom = base.left = base.right = props.margin;
61
+ } else if (props.margin) {
62
+ if ("all" in props.margin) {
63
+ base.top = base.bottom = base.left = base.right = props.margin.all;
64
+ } else if ("horizontal" in props.margin || "vertical" in props.margin) {
65
+ if (props.margin.horizontal !== void 0) {
66
+ base.left = base.right = props.margin.horizontal;
67
+ }
68
+ if (props.margin.vertical !== void 0) {
69
+ base.top = base.bottom = props.margin.vertical;
70
+ }
71
+ } else {
72
+ Object.assign(base, props.margin);
73
+ }
74
+ }
75
+ if (props.marginHorizontal !== void 0) {
76
+ base.left = base.right = props.marginHorizontal;
77
+ }
78
+ if (props.marginVertical !== void 0) {
79
+ base.top = base.bottom = props.marginVertical;
80
+ }
81
+ if (props.marginTop !== void 0) base.top = props.marginTop;
82
+ if (props.marginBottom !== void 0) base.bottom = props.marginBottom;
83
+ if (props.marginLeft !== void 0) base.left = props.marginLeft;
84
+ if (props.marginRight !== void 0) base.right = props.marginRight;
85
+ return base;
86
+ }
87
+ function alignmentToFlexbox(alignment) {
88
+ if (!alignment) return {};
89
+ const map = {
90
+ topLeft: { justifyContent: "flex-start", alignItems: "flex-start" },
91
+ topCenter: { justifyContent: "center", alignItems: "flex-start" },
92
+ topRight: { justifyContent: "flex-end", alignItems: "flex-start" },
93
+ centerLeft: { justifyContent: "flex-start", alignItems: "center" },
94
+ center: { justifyContent: "center", alignItems: "center" },
95
+ centerRight: { justifyContent: "flex-end", alignItems: "center" },
96
+ bottomLeft: { justifyContent: "flex-start", alignItems: "flex-end" },
97
+ bottomCenter: { justifyContent: "center", alignItems: "flex-end" },
98
+ bottomRight: { justifyContent: "flex-end", alignItems: "flex-end" }
99
+ };
100
+ return {
101
+ display: "flex",
102
+ ...map[alignment]
103
+ };
104
+ }
105
+ function boxShadowToCSS(shadows) {
106
+ if (!shadows || shadows.length === 0) return void 0;
107
+ return shadows.map((shadow) => {
108
+ const dx = shadow.offset?.dx || 0;
109
+ const dy = shadow.offset?.dy || 0;
110
+ const blur = shadow.blurRadius || 0;
111
+ const spread = shadow.spreadRadius || 0;
112
+ const color = shadow.color || "rgba(0, 0, 0, 0.1)";
113
+ return `${dx}px ${dy}px ${blur}px ${spread}px ${color}`;
114
+ }).join(", ");
115
+ }
116
+ function gradientToCSS(gradient) {
117
+ if (!gradient || gradient.colors.length === 0) return void 0;
118
+ const { type = "linear", colors, stops, begin = "to right" } = gradient;
119
+ let colorStops;
120
+ if (stops && stops.length === colors.length) {
121
+ colorStops = colors.map((color, i) => `${color} ${stops[i] * 100}%`).join(", ");
122
+ } else {
123
+ colorStops = colors.join(", ");
124
+ }
125
+ if (type === "radial") {
126
+ return `radial-gradient(${gradient.center || "circle"}, ${colorStops})`;
127
+ }
128
+ return `linear-gradient(${begin}, ${colorStops})`;
129
+ }
130
+ function borderToCSS(border) {
131
+ if (!border) return {};
132
+ if (typeof border === "string") return { border };
133
+ const styles = {};
134
+ if (border.top) {
135
+ const { width, color, style = "solid" } = border.top;
136
+ styles.borderTop = `${width}px ${style} ${color}`;
137
+ }
138
+ if (border.bottom) {
139
+ const { width, color, style = "solid" } = border.bottom;
140
+ styles.borderBottom = `${width}px ${style} ${color}`;
141
+ }
142
+ if (border.left) {
143
+ const { width, color, style = "solid" } = border.left;
144
+ styles.borderLeft = `${width}px ${style} ${color}`;
145
+ }
146
+ if (border.right) {
147
+ const { width, color, style = "solid" } = border.right;
148
+ styles.borderRight = `${width}px ${style} ${color}`;
149
+ }
150
+ return styles;
151
+ }
152
+ function decorationToCSS(decoration, colorProp) {
153
+ const styles = {};
154
+ if (!decoration && !colorProp) return styles;
155
+ const dec = decoration || {};
156
+ const bgColor = colorProp || dec.color;
157
+ if (bgColor) styles.backgroundColor = bgColor;
158
+ const gradientCSS = gradientToCSS(dec.gradient);
159
+ if (gradientCSS) styles.backgroundImage = gradientCSS;
160
+ if (dec.image) {
161
+ const img = dec.image;
162
+ styles.backgroundImage = `url(${img.image})`;
163
+ styles.backgroundSize = img.fit || "cover";
164
+ styles.backgroundPosition = img.alignment || "center";
165
+ styles.backgroundRepeat = img.repeat || "no-repeat";
166
+ if (img.opacity !== void 0) {
167
+ styles.opacity = img.opacity;
168
+ }
169
+ }
170
+ if (dec.shape === "circle" /* circle */) {
171
+ styles.borderRadius = "50%";
172
+ styles.aspectRatio = "1 / 1";
173
+ } else if (dec.borderRadius !== void 0) {
174
+ styles.borderRadius = typeof dec.borderRadius === "number" ? `${dec.borderRadius}px` : dec.borderRadius;
175
+ }
176
+ Object.assign(styles, borderToCSS(dec.border));
177
+ const shadowCSS = boxShadowToCSS(dec.boxShadow);
178
+ if (shadowCSS) styles.boxShadow = shadowCSS;
179
+ if (dec.backgroundBlendMode) {
180
+ styles.backgroundBlendMode = dec.backgroundBlendMode;
181
+ }
182
+ if (dec.opacity !== void 0) {
183
+ styles.opacity = dec.opacity;
184
+ }
185
+ return styles;
186
+ }
187
+ function normalizeDimension(value) {
188
+ if (value === void 0) return void 0;
189
+ return typeof value === "number" ? `${value}px` : value;
190
+ }
191
+ function alignmentToTransformOrigin(alignment) {
192
+ const map = {
193
+ topLeft: "top left",
194
+ topCenter: "top center",
195
+ topRight: "top right",
196
+ centerLeft: "center left",
197
+ center: "center",
198
+ centerRight: "center right",
199
+ bottomLeft: "bottom left",
200
+ bottomCenter: "bottom center",
201
+ bottomRight: "bottom right"
202
+ };
203
+ return map[alignment];
204
+ }
205
+ var Container = ({
206
+ children,
207
+ width,
208
+ height,
209
+ padding,
210
+ paddingHorizontal,
211
+ paddingVertical,
212
+ paddingTop,
213
+ paddingBottom,
214
+ paddingLeft,
215
+ paddingRight,
216
+ margin,
217
+ marginHorizontal,
218
+ marginVertical,
219
+ marginTop,
220
+ marginBottom,
221
+ marginLeft,
222
+ marginRight,
223
+ decoration,
224
+ foregroundDecoration,
225
+ color,
226
+ alignment,
227
+ constraints,
228
+ transform,
229
+ transformAlignment,
230
+ clipBehavior = "none",
231
+ onTap,
232
+ onClick,
233
+ cursor,
234
+ className = "",
235
+ style = {},
236
+ id,
237
+ role,
238
+ ariaLabel
239
+ }) => {
240
+ const resolvedPadding = resolvePadding({
241
+ padding,
242
+ paddingHorizontal,
243
+ paddingVertical,
244
+ paddingTop,
245
+ paddingBottom,
246
+ paddingLeft,
247
+ paddingRight
248
+ });
249
+ const resolvedMargin = resolveMargin({
250
+ margin,
251
+ marginHorizontal,
252
+ marginVertical,
253
+ marginTop,
254
+ marginBottom,
255
+ marginLeft,
256
+ marginRight
257
+ });
258
+ const containerStyles = {
259
+ // Margin (outermost)
260
+ margin: edgeInsetsToCSS(resolvedMargin),
261
+ // Dimensions
262
+ width: normalizeDimension(width),
263
+ height: normalizeDimension(height),
264
+ // Constraints
265
+ minWidth: normalizeDimension(constraints?.minWidth),
266
+ maxWidth: normalizeDimension(constraints?.maxWidth),
267
+ minHeight: normalizeDimension(constraints?.minHeight),
268
+ maxHeight: normalizeDimension(constraints?.maxHeight),
269
+ // Padding
270
+ padding: edgeInsetsToCSS(resolvedPadding),
271
+ // Decoration (background layer)
272
+ ...decorationToCSS(decoration, color),
273
+ // Alignment
274
+ ...alignmentToFlexbox(alignment),
275
+ // Transform
276
+ transform,
277
+ transformOrigin: transformAlignment ? alignmentToTransformOrigin(transformAlignment) : void 0,
278
+ // Clip behavior
279
+ overflow: clipBehavior === "none" ? "visible" : "hidden",
280
+ // Cursor
281
+ cursor: cursor || (onTap || onClick ? "pointer" : void 0),
282
+ // Box sizing
283
+ boxSizing: "border-box",
284
+ // Position for stacking
285
+ position: "relative",
286
+ // Custom styles (escape hatch)
287
+ ...style
288
+ };
289
+ const handleClick = onTap || onClick;
290
+ return (
291
+ // biome-ignore lint/a11y/useKeyWithClickEvents: <explanation>
292
+ /* @__PURE__ */ jsxs(
293
+ "div",
294
+ {
295
+ id,
296
+ className,
297
+ style: containerStyles,
298
+ onClick: handleClick,
299
+ role,
300
+ "aria-label": ariaLabel,
301
+ children: [
302
+ children,
303
+ foregroundDecoration && /* @__PURE__ */ jsx(
304
+ "div",
305
+ {
306
+ style: {
307
+ position: "absolute",
308
+ top: 0,
309
+ left: 0,
310
+ right: 0,
311
+ bottom: 0,
312
+ pointerEvents: "none",
313
+ ...decorationToCSS(foregroundDecoration)
314
+ }
315
+ }
316
+ )
317
+ ]
318
+ }
319
+ )
320
+ );
321
+ };
322
+ var EdgeInsetsAll = (value) => ({
323
+ all: value
324
+ });
325
+ var EdgeInsetsSymmetric = ({
326
+ horizontal = 0,
327
+ vertical = 0
328
+ }) => ({
329
+ horizontal,
330
+ vertical
331
+ });
332
+ var EdgeInsetsOnly = ({
333
+ top,
334
+ bottom,
335
+ left,
336
+ right
337
+ }) => ({
338
+ top,
339
+ bottom,
340
+ left,
341
+ right
342
+ });
343
+ var BorderAll = ({
344
+ width = 1,
345
+ color = "currentColor",
346
+ style = "solid"
347
+ }) => ({
348
+ top: { width, color, style },
349
+ bottom: { width, color, style },
350
+ left: { width, color, style },
351
+ right: { width, color, style }
352
+ });
353
+ var BorderRadiusCircular = (radius) => radius;
354
+ var Centre = ({
355
+ children,
356
+ widthFactor,
357
+ heightFactor,
358
+ className = "",
359
+ style = {},
360
+ id
361
+ }) => {
362
+ const containerStyles = {
363
+ // Always use flexbox for centering
364
+ display: "flex",
365
+ justifyContent: "center",
366
+ alignItems: "center",
367
+ // Size behavior (Flutter spec):
368
+ // - If factor is null: expand to fill parent (width/height: 100%)
369
+ // - If factor is set: size will be determined by child (fit-content)
370
+ width: widthFactor === void 0 ? "100%" : "fit-content",
371
+ height: heightFactor === void 0 ? "100%" : "fit-content",
372
+ // Box sizing
373
+ boxSizing: "border-box",
374
+ // Custom styles (escape hatch)
375
+ ...style
376
+ };
377
+ if (widthFactor !== void 0 || heightFactor !== void 0) {
378
+ return /* @__PURE__ */ jsx("div", { id, className, style: containerStyles, children: /* @__PURE__ */ jsx(
379
+ "div",
380
+ {
381
+ style: {
382
+ transform: `scale(${widthFactor || 1}, ${heightFactor || 1})`,
383
+ transformOrigin: "center"
384
+ },
385
+ children
386
+ }
387
+ ) });
388
+ }
389
+ return /* @__PURE__ */ jsx("div", { id, className, style: containerStyles, children });
390
+ };
391
+ var Center = Centre;
392
+ var MainAxisAlignment = /* @__PURE__ */ ((MainAxisAlignment3) => {
393
+ MainAxisAlignment3["start"] = "flex-start";
394
+ MainAxisAlignment3["center"] = "center";
395
+ MainAxisAlignment3["end"] = "flex-end";
396
+ MainAxisAlignment3["spaceBetween"] = "space-between";
397
+ MainAxisAlignment3["spaceAround"] = "space-around";
398
+ MainAxisAlignment3["spaceEvenly"] = "space-evenly";
399
+ return MainAxisAlignment3;
400
+ })(MainAxisAlignment || {});
401
+ var CrossAxisAlignment = /* @__PURE__ */ ((CrossAxisAlignment3) => {
402
+ CrossAxisAlignment3["start"] = "flex-start";
403
+ CrossAxisAlignment3["center"] = "center";
404
+ CrossAxisAlignment3["end"] = "flex-end";
405
+ CrossAxisAlignment3["stretch"] = "stretch";
406
+ CrossAxisAlignment3["baseline"] = "baseline";
407
+ return CrossAxisAlignment3;
408
+ })(CrossAxisAlignment || {});
409
+ var MainAxisSize = /* @__PURE__ */ ((MainAxisSize3) => {
410
+ MainAxisSize3["max"] = "max";
411
+ MainAxisSize3["min"] = "min";
412
+ return MainAxisSize3;
413
+ })(MainAxisSize || {});
414
+ var VerticalDirection = /* @__PURE__ */ ((VerticalDirection2) => {
415
+ VerticalDirection2["down"] = "down";
416
+ VerticalDirection2["up"] = "up";
417
+ return VerticalDirection2;
418
+ })(VerticalDirection || {});
419
+ var Column = ({
420
+ children,
421
+ mainAxisAlignment = "flex-start" /* start */,
422
+ crossAxisAlignment = "center" /* center */,
423
+ mainAxisSize = "max" /* max */,
424
+ verticalDirection = "down" /* down */,
425
+ spacing = 0,
426
+ clipBehavior = "visible",
427
+ className = "",
428
+ style = {},
429
+ id,
430
+ onTap,
431
+ onClick
432
+ }) => {
433
+ const columnStyles = {
434
+ // Flexbox for vertical layout
435
+ display: "flex",
436
+ flexDirection: verticalDirection === "down" /* down */ ? "column" : "column-reverse",
437
+ // Main axis alignment (vertical)
438
+ justifyContent: mainAxisAlignment,
439
+ // Cross axis alignment (horizontal)
440
+ alignItems: crossAxisAlignment,
441
+ // Main axis size behavior
442
+ height: mainAxisSize === "max" /* max */ ? "100%" : "auto",
443
+ minHeight: mainAxisSize === "min" /* min */ ? "auto" : void 0,
444
+ // Spacing between children (CSS gap for clean implementation)
445
+ gap: spacing > 0 ? `${spacing}px` : void 0,
446
+ // Clip behavior
447
+ overflow: clipBehavior,
448
+ // Box sizing
449
+ boxSizing: "border-box",
450
+ // Width behavior (Flutter spec: width = max width of children)
451
+ width: "100%",
452
+ // Default to full width, children can control their own width
453
+ // Custom styles (escape hatch)
454
+ ...style
455
+ };
456
+ const handleClick = onTap || onClick;
457
+ return (
458
+ // biome-ignore lint/a11y/useKeyWithClickEvents: <explanation>
459
+ /* @__PURE__ */ jsx(
460
+ "div",
461
+ {
462
+ id,
463
+ className,
464
+ style: columnStyles,
465
+ onClick: handleClick,
466
+ children
467
+ }
468
+ )
469
+ );
470
+ };
471
+ var MainAxisAlignment2 = /* @__PURE__ */ ((MainAxisAlignment3) => {
472
+ MainAxisAlignment3["start"] = "flex-start";
473
+ MainAxisAlignment3["center"] = "center";
474
+ MainAxisAlignment3["end"] = "flex-end";
475
+ MainAxisAlignment3["spaceBetween"] = "space-between";
476
+ MainAxisAlignment3["spaceAround"] = "space-around";
477
+ MainAxisAlignment3["spaceEvenly"] = "space-evenly";
478
+ return MainAxisAlignment3;
479
+ })(MainAxisAlignment2 || {});
480
+ var CrossAxisAlignment2 = /* @__PURE__ */ ((CrossAxisAlignment3) => {
481
+ CrossAxisAlignment3["start"] = "flex-start";
482
+ CrossAxisAlignment3["center"] = "center";
483
+ CrossAxisAlignment3["end"] = "flex-end";
484
+ CrossAxisAlignment3["stretch"] = "stretch";
485
+ CrossAxisAlignment3["baseline"] = "baseline";
486
+ return CrossAxisAlignment3;
487
+ })(CrossAxisAlignment2 || {});
488
+ var MainAxisSize2 = /* @__PURE__ */ ((MainAxisSize3) => {
489
+ MainAxisSize3["max"] = "max";
490
+ MainAxisSize3["min"] = "min";
491
+ return MainAxisSize3;
492
+ })(MainAxisSize2 || {});
493
+ var TextDirection = /* @__PURE__ */ ((TextDirection2) => {
494
+ TextDirection2["ltr"] = "ltr";
495
+ TextDirection2["rtl"] = "rtl";
496
+ return TextDirection2;
497
+ })(TextDirection || {});
498
+ var Row = ({
499
+ children,
500
+ mainAxisAlignment = "flex-start" /* start */,
501
+ crossAxisAlignment = "center" /* center */,
502
+ mainAxisSize = "max" /* max */,
503
+ textDirection = "ltr" /* ltr */,
504
+ spacing = 0,
505
+ clipBehavior = "visible",
506
+ className = "",
507
+ style = {},
508
+ id,
509
+ onTap,
510
+ onClick
511
+ }) => {
512
+ const rowStyles = {
513
+ // Flexbox for horizontal layout
514
+ display: "flex",
515
+ flexDirection: textDirection === "ltr" /* ltr */ ? "row" : "row-reverse",
516
+ // Main axis alignment (horizontal)
517
+ justifyContent: mainAxisAlignment,
518
+ // Cross axis alignment (vertical)
519
+ alignItems: crossAxisAlignment,
520
+ // Main axis size behavior
521
+ width: mainAxisSize === "max" /* max */ ? "100%" : "auto",
522
+ minWidth: mainAxisSize === "min" /* min */ ? "auto" : void 0,
523
+ // Spacing between children (CSS gap for clean implementation)
524
+ gap: spacing > 0 ? `${spacing}px` : void 0,
525
+ // Clip behavior
526
+ overflow: clipBehavior,
527
+ // Box sizing
528
+ boxSizing: "border-box",
529
+ // Height behavior (Flutter spec: height = max height of children)
530
+ height: "auto",
531
+ // Default to auto, children control their own height
532
+ // Custom styles (escape hatch)
533
+ ...style
534
+ };
535
+ const handleClick = onTap || onClick;
536
+ return (
537
+ // biome-ignore lint/a11y/useKeyWithClickEvents: <explanation>
538
+ /* @__PURE__ */ jsx(
539
+ "div",
540
+ {
541
+ id,
542
+ className,
543
+ style: rowStyles,
544
+ onClick: handleClick,
545
+ dir: textDirection,
546
+ children
547
+ }
548
+ )
549
+ );
550
+ };
551
+ var StackFit = /* @__PURE__ */ ((StackFit2) => {
552
+ StackFit2["expand"] = "expand";
553
+ StackFit2["loose"] = "loose";
554
+ StackFit2["passthrough"] = "passthrough";
555
+ return StackFit2;
556
+ })(StackFit || {});
557
+ var Clip = /* @__PURE__ */ ((Clip2) => {
558
+ Clip2["hardEdge"] = "hidden";
559
+ Clip2["antiAlias"] = "hidden";
560
+ Clip2["antiAliasWithSaveLayer"] = "hidden";
561
+ Clip2["none"] = "visible";
562
+ return Clip2;
563
+ })(Clip || {});
564
+ function alignmentToPosition(alignment, textDirection) {
565
+ const isRTL = textDirection === "rtl" /* rtl */;
566
+ const alignmentMap = {
567
+ topLeft: {
568
+ top: 0,
569
+ left: isRTL ? void 0 : 0,
570
+ right: isRTL ? 0 : void 0
571
+ },
572
+ topCenter: {
573
+ top: 0,
574
+ left: "50%",
575
+ transform: "translateX(-50%)"
576
+ },
577
+ topRight: {
578
+ top: 0,
579
+ right: isRTL ? void 0 : 0,
580
+ left: isRTL ? 0 : void 0
581
+ },
582
+ centerLeft: {
583
+ top: "50%",
584
+ left: isRTL ? void 0 : 0,
585
+ right: isRTL ? 0 : void 0,
586
+ transform: "translateY(-50%)"
587
+ },
588
+ center: {
589
+ top: "50%",
590
+ left: "50%",
591
+ transform: "translate(-50%, -50%)"
592
+ },
593
+ centerRight: {
594
+ top: "50%",
595
+ right: isRTL ? void 0 : 0,
596
+ left: isRTL ? 0 : void 0,
597
+ transform: "translateY(-50%)"
598
+ },
599
+ bottomLeft: {
600
+ bottom: 0,
601
+ left: isRTL ? void 0 : 0,
602
+ right: isRTL ? 0 : void 0
603
+ },
604
+ bottomCenter: {
605
+ bottom: 0,
606
+ left: "50%",
607
+ transform: "translateX(-50%)"
608
+ },
609
+ bottomRight: {
610
+ bottom: 0,
611
+ right: isRTL ? void 0 : 0,
612
+ left: isRTL ? 0 : void 0
613
+ }
614
+ };
615
+ return alignmentMap[alignment];
616
+ }
617
+ var Stack = ({
618
+ children,
619
+ alignment = "topLeft",
620
+ fit = "loose" /* loose */,
621
+ textDirection = "ltr" /* ltr */,
622
+ clipBehavior = "hidden" /* hardEdge */,
623
+ className = "",
624
+ style = {},
625
+ id,
626
+ onTap,
627
+ onClick
628
+ }) => {
629
+ const stackStyles = {
630
+ // Position context for children
631
+ position: "relative",
632
+ // Sizing behavior based on fit
633
+ display: fit === "expand" /* expand */ ? "flex" : "block",
634
+ width: fit === "expand" /* expand */ ? "100%" : "auto",
635
+ height: fit === "expand" /* expand */ ? "100%" : "auto",
636
+ // Clip behavior
637
+ overflow: clipBehavior,
638
+ // Box sizing
639
+ boxSizing: "border-box",
640
+ // Text direction (for alignment resolution)
641
+ direction: textDirection,
642
+ // Custom styles
643
+ ...style
644
+ };
645
+ const handleClick = onTap || onClick;
646
+ const processedChildren = React.Children.map(children, (child, index) => {
647
+ if (!React.isValidElement(child)) return child;
648
+ const isPositioned = child.type?.displayName === "Positioned";
649
+ if (isPositioned) {
650
+ return child;
651
+ }
652
+ const childStyles = {
653
+ position: "absolute",
654
+ ...alignmentToPosition(alignment, textDirection),
655
+ // Sizing based on fit
656
+ ...fit === "expand" /* expand */ && {
657
+ width: "100%",
658
+ height: "100%"
659
+ },
660
+ // Z-index based on order (first = bottom)
661
+ zIndex: index
662
+ };
663
+ return (
664
+ // biome-ignore lint/suspicious/noArrayIndexKey: <explanation>
665
+ /* @__PURE__ */ jsx("div", { style: childStyles, children: child }, index)
666
+ );
667
+ });
668
+ return (
669
+ // biome-ignore lint/a11y/useKeyWithClickEvents: <explanation>
670
+ /* @__PURE__ */ jsx(
671
+ "div",
672
+ {
673
+ id,
674
+ className,
675
+ style: stackStyles,
676
+ onClick: handleClick,
677
+ children: processedChildren
678
+ }
679
+ )
680
+ );
681
+ };
682
+ function normalizeDimension2(value) {
683
+ if (value === void 0) return void 0;
684
+ return typeof value === "number" ? `${value}px` : value;
685
+ }
686
+ var Positioned = ({
687
+ children,
688
+ top,
689
+ bottom,
690
+ left,
691
+ right,
692
+ width,
693
+ height,
694
+ className = "",
695
+ style = {}
696
+ }) => {
697
+ const positionedStyles = {
698
+ position: "absolute",
699
+ // Position from edges
700
+ top: normalizeDimension2(top),
701
+ bottom: normalizeDimension2(bottom),
702
+ left: normalizeDimension2(left),
703
+ right: normalizeDimension2(right),
704
+ // Explicit dimensions
705
+ width: normalizeDimension2(width),
706
+ height: normalizeDimension2(height),
707
+ // Box sizing
708
+ boxSizing: "border-box",
709
+ // Custom styles
710
+ ...style
711
+ };
712
+ return /* @__PURE__ */ jsx("div", { className, style: positionedStyles, children });
713
+ };
714
+ Positioned.displayName = "Positioned";
715
+ var PositionedFill = ({ children, width, height, className, style }) => {
716
+ return /* @__PURE__ */ jsx(
717
+ Positioned,
718
+ {
719
+ top: 0,
720
+ bottom: 0,
721
+ left: 0,
722
+ right: 0,
723
+ width,
724
+ height,
725
+ className,
726
+ style,
727
+ children
728
+ }
729
+ );
730
+ };
731
+ PositionedFill.displayName = "Positioned";
732
+ function normalizeDimension3(value) {
733
+ if (value === void 0) return void 0;
734
+ return typeof value === "number" ? `${value}px` : value;
735
+ }
736
+ var SizedBoxBase = ({
737
+ children,
738
+ width,
739
+ height,
740
+ className = "",
741
+ style = {},
742
+ id
743
+ }) => {
744
+ const boxStyles = {
745
+ // Explicit dimensions
746
+ width: normalizeDimension3(width),
747
+ height: normalizeDimension3(height),
748
+ // Minimal styling (no decoration, just sizing)
749
+ boxSizing: "border-box",
750
+ flexShrink: 0,
751
+ // Prevent shrinking in flex layouts (Flutter behavior)
752
+ // Custom styles
753
+ ...style
754
+ };
755
+ return /* @__PURE__ */ jsx("div", { id, className, style: boxStyles, children });
756
+ };
757
+ var SizedBoxExpand = (props) => /* @__PURE__ */ jsx(SizedBoxBase, { width: "100%", height: "100%", ...props });
758
+ var SizedBoxShrink = (props) => /* @__PURE__ */ jsx(SizedBoxBase, { width: 0, height: 0, ...props });
759
+ var SizedBoxSquare = ({ dimension, ...props }) => /* @__PURE__ */ jsx(SizedBoxBase, { width: dimension, height: dimension, ...props });
760
+ var SizedBox = SizedBoxBase;
761
+ SizedBox.expand = SizedBoxExpand;
762
+ SizedBox.shrink = SizedBoxShrink;
763
+ SizedBox.square = SizedBoxSquare;
764
+ function edgeInsetsToPadding(insets) {
765
+ if (typeof insets === "number") {
766
+ return `${insets}px`;
767
+ }
768
+ if ("all" in insets && insets.all !== void 0) {
769
+ return `${insets.all}px`;
770
+ }
771
+ const hasHorizontal = "horizontal" in insets;
772
+ const hasVertical = "vertical" in insets;
773
+ if (hasHorizontal || hasVertical) {
774
+ const v = insets.vertical ?? 0;
775
+ const h = insets.horizontal ?? 0;
776
+ return `${v}px ${h}px`;
777
+ }
778
+ if ("top" in insets || "right" in insets || "bottom" in insets || "left" in insets) {
779
+ const top = insets.top ?? 0;
780
+ const right = insets.right ?? 0;
781
+ const bottom = insets.bottom ?? 0;
782
+ const left = insets.left ?? 0;
783
+ return `${top}px ${right}px ${bottom}px ${left}px`;
784
+ }
785
+ return "0px";
786
+ }
787
+ var Padding = ({
788
+ children,
789
+ padding,
790
+ className = "",
791
+ style = {},
792
+ id
793
+ }) => {
794
+ const paddingStyles = {
795
+ // Apply padding
796
+ padding: edgeInsetsToPadding(padding),
797
+ // Minimal styling (no decoration, just padding)
798
+ boxSizing: "border-box",
799
+ // Custom styles
800
+ ...style
801
+ };
802
+ return /* @__PURE__ */ jsx("div", { id, className, style: paddingStyles, children });
803
+ };
804
+
805
+ export { BorderAll, BorderRadiusCircular, BoxShape, Center, Centre, Clip, Column, CrossAxisAlignment as ColumnCrossAxisAlignment, MainAxisAlignment as ColumnMainAxisAlignment, MainAxisSize as ColumnMainAxisSize, Container, CrossAxisAlignment2 as CrossAxisAlignment, EdgeInsetsAll, EdgeInsetsOnly, EdgeInsetsSymmetric, MainAxisAlignment2 as MainAxisAlignment, MainAxisSize2 as MainAxisSize, Padding, Positioned, PositionedFill, Row, SizedBox, Stack, StackFit, TextDirection, VerticalDirection };
806
+ //# sourceMappingURL=index.js.map
807
+ //# sourceMappingURL=index.js.map