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