@flipova/foundation 1.10.1 → 1.11.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/CHANGELOG.md +35 -0
- package/dist/sso/index.js +379 -0
- package/dist/sso/index.js.map +1 -0
- package/dist/sso/index.mjs +374 -0
- package/dist/sso/index.mjs.map +1 -0
- package/dist/web/index.js +518 -24
- package/dist/web/index.js.map +1 -1
- package/dist/web/index.mjs +519 -26
- package/dist/web/index.mjs.map +1 -1
- package/package.json +6 -3
package/dist/web/index.mjs
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import React2, { createContext, useMemo, useId, useContext, useState, useEffect, useRef } from 'react';
|
|
2
|
-
import { useColorScheme as useColorScheme$1 } from 'react-native';
|
|
2
|
+
import { useColorScheme as useColorScheme$1, Dimensions, View, ScrollView, Platform } from 'react-native';
|
|
3
3
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
import * as LucideIcons from 'lucide-react';
|
|
5
5
|
import * as RadixTabs from '@radix-ui/react-tabs';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
9
|
+
}) : x)(function(x) {
|
|
10
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
|
+
});
|
|
8
13
|
|
|
9
14
|
// foundation/tokens/breakpoints.ts
|
|
10
15
|
var breakpoints = {
|
|
@@ -1139,20 +1144,20 @@ var Box = React2.forwardRef(({
|
|
|
1139
1144
|
if (shadow) {
|
|
1140
1145
|
boxShadow = rnShadowToCss(shadows[shadow]);
|
|
1141
1146
|
}
|
|
1142
|
-
const
|
|
1147
|
+
const sp3 = (token) => token != null ? spacing[token] : void 0;
|
|
1143
1148
|
const resolved = {
|
|
1144
1149
|
// Padding
|
|
1145
|
-
padding:
|
|
1146
|
-
paddingTop:
|
|
1147
|
-
paddingRight:
|
|
1148
|
-
paddingBottom:
|
|
1149
|
-
paddingLeft:
|
|
1150
|
+
padding: sp3(p) != null && !px && !py && !pt && !pr && !pb && !pl ? sp3(p) : void 0,
|
|
1151
|
+
paddingTop: sp3(pt) ?? sp3(py) ?? sp3(p),
|
|
1152
|
+
paddingRight: sp3(pr) ?? sp3(px) ?? sp3(p),
|
|
1153
|
+
paddingBottom: sp3(pb) ?? sp3(py) ?? sp3(p),
|
|
1154
|
+
paddingLeft: sp3(pl) ?? sp3(px) ?? sp3(p),
|
|
1150
1155
|
// Margin
|
|
1151
|
-
margin:
|
|
1152
|
-
marginTop:
|
|
1153
|
-
marginRight:
|
|
1154
|
-
marginBottom:
|
|
1155
|
-
marginLeft:
|
|
1156
|
+
margin: sp3(m) != null && !mx && !my && !mt && !mr && !mb && !ml ? sp3(m) : void 0,
|
|
1157
|
+
marginTop: sp3(mt) ?? sp3(my) ?? sp3(m),
|
|
1158
|
+
marginRight: sp3(mr) ?? sp3(mx) ?? sp3(m),
|
|
1159
|
+
marginBottom: sp3(mb) ?? sp3(my) ?? sp3(m),
|
|
1160
|
+
marginLeft: sp3(ml) ?? sp3(mx) ?? sp3(m),
|
|
1156
1161
|
// Background
|
|
1157
1162
|
backgroundColor,
|
|
1158
1163
|
backgroundImage,
|
|
@@ -5231,7 +5236,495 @@ var DashboardLayout = (rawProps) => {
|
|
|
5231
5236
|
] });
|
|
5232
5237
|
};
|
|
5233
5238
|
var DashboardLayout_default = DashboardLayout;
|
|
5234
|
-
var
|
|
5239
|
+
var getBreakpoint = (innerWidth) => {
|
|
5240
|
+
const width = innerWidth ?? (Platform.OS === "web" && typeof window !== "undefined" ? window.innerWidth : Dimensions.get("window").width);
|
|
5241
|
+
if (width >= breakpoints["2xl"]) return "2xl";
|
|
5242
|
+
if (width >= breakpoints.xl) return "xl";
|
|
5243
|
+
if (width >= breakpoints.lg) return "lg";
|
|
5244
|
+
if (width >= breakpoints.md) return "md";
|
|
5245
|
+
if (width >= breakpoints.sm) return "sm";
|
|
5246
|
+
return "xs";
|
|
5247
|
+
};
|
|
5248
|
+
var getResponsiveValue = (value, currentBreakpoint) => {
|
|
5249
|
+
if (typeof value !== "object" || value === null) {
|
|
5250
|
+
return value;
|
|
5251
|
+
}
|
|
5252
|
+
const responsiveValue = value;
|
|
5253
|
+
const orderedBreakpoints = [
|
|
5254
|
+
"xs",
|
|
5255
|
+
"sm",
|
|
5256
|
+
"md",
|
|
5257
|
+
"lg",
|
|
5258
|
+
"xl",
|
|
5259
|
+
"2xl"
|
|
5260
|
+
];
|
|
5261
|
+
const currentIndex = orderedBreakpoints.indexOf(currentBreakpoint);
|
|
5262
|
+
for (let i = currentIndex; i >= 0; i--) {
|
|
5263
|
+
const bp = orderedBreakpoints[i];
|
|
5264
|
+
if (responsiveValue[bp] !== void 0) {
|
|
5265
|
+
return responsiveValue[bp];
|
|
5266
|
+
}
|
|
5267
|
+
}
|
|
5268
|
+
return responsiveValue[orderedBreakpoints[0]];
|
|
5269
|
+
};
|
|
5270
|
+
var Ctx = createContext(null);
|
|
5271
|
+
var usePlatformOverride = () => useContext(Ctx);
|
|
5272
|
+
|
|
5273
|
+
// foundation/layout/hooks/useBreakpoint.ts
|
|
5274
|
+
var MOBILE = ["xs", "sm"];
|
|
5275
|
+
var TABLET = ["md"];
|
|
5276
|
+
var DESKTOP = ["lg", "xl", "2xl"];
|
|
5277
|
+
var getInitialBreakpoint = () => {
|
|
5278
|
+
if (Platform.OS === "web") {
|
|
5279
|
+
if (typeof window !== "undefined") {
|
|
5280
|
+
return getBreakpoint(window.innerWidth);
|
|
5281
|
+
}
|
|
5282
|
+
return null;
|
|
5283
|
+
}
|
|
5284
|
+
return getBreakpoint();
|
|
5285
|
+
};
|
|
5286
|
+
var deriveInfo = (bp) => ({
|
|
5287
|
+
breakpoint: bp,
|
|
5288
|
+
isMobile: bp !== null && MOBILE.includes(bp),
|
|
5289
|
+
isTablet: bp !== null && TABLET.includes(bp),
|
|
5290
|
+
isDesktop: bp !== null && DESKTOP.includes(bp),
|
|
5291
|
+
isAtLeastTablet: bp !== null && !MOBILE.includes(bp),
|
|
5292
|
+
isAtLeastDesktop: bp !== null && DESKTOP.includes(bp)
|
|
5293
|
+
});
|
|
5294
|
+
var useBreakpoint = () => {
|
|
5295
|
+
const override = usePlatformOverride();
|
|
5296
|
+
const [bp, setBp] = useState(getInitialBreakpoint);
|
|
5297
|
+
useEffect(() => {
|
|
5298
|
+
if (bp === null) {
|
|
5299
|
+
setBp(getBreakpoint(window.innerWidth));
|
|
5300
|
+
}
|
|
5301
|
+
const subscription = Dimensions.addEventListener("change", () => {
|
|
5302
|
+
setBp(getBreakpoint());
|
|
5303
|
+
});
|
|
5304
|
+
return () => subscription?.remove();
|
|
5305
|
+
}, [bp]);
|
|
5306
|
+
const real = useMemo(() => deriveInfo(bp), [bp]);
|
|
5307
|
+
return override?.breakpoint ?? real;
|
|
5308
|
+
};
|
|
5309
|
+
function isInsertZone(el) {
|
|
5310
|
+
if (!React2.isValidElement(el)) return false;
|
|
5311
|
+
const t = el.type;
|
|
5312
|
+
return t?.$insertZone === true || el.props?.$insertZone === true;
|
|
5313
|
+
}
|
|
5314
|
+
function useStudioItems(items, count, placeholder) {
|
|
5315
|
+
const safe = Array.isArray(items) ? items : [];
|
|
5316
|
+
if (safe.length === 1 && isInsertZone(safe[0])) return safe;
|
|
5317
|
+
if (safe.length > 0) return safe;
|
|
5318
|
+
return Array.from({ length: Math.max(1, count) }, (_, i) => placeholder(i));
|
|
5319
|
+
}
|
|
5320
|
+
|
|
5321
|
+
// foundation/layout/hooks/useResponsiveValue.ts
|
|
5322
|
+
var useResponsiveValue = (value) => {
|
|
5323
|
+
const { breakpoint } = useBreakpoint();
|
|
5324
|
+
if (!breakpoint) return null;
|
|
5325
|
+
return getResponsiveValue(value, breakpoint);
|
|
5326
|
+
};
|
|
5327
|
+
var LinearGradient = null;
|
|
5328
|
+
try {
|
|
5329
|
+
LinearGradient = __require("expo-linear-gradient").LinearGradient ?? null;
|
|
5330
|
+
} catch {
|
|
5331
|
+
LinearGradient = null;
|
|
5332
|
+
}
|
|
5333
|
+
var GRADIENT_VECTORS = {
|
|
5334
|
+
toTop: { start: { x: 0.5, y: 1 }, end: { x: 0.5, y: 0 } },
|
|
5335
|
+
toBottom: { start: { x: 0.5, y: 0 }, end: { x: 0.5, y: 1 } },
|
|
5336
|
+
toLeft: { start: { x: 1, y: 0.5 }, end: { x: 0, y: 0.5 } },
|
|
5337
|
+
toRight: { start: { x: 0, y: 0.5 }, end: { x: 1, y: 0.5 } },
|
|
5338
|
+
toTopLeft: { start: { x: 1, y: 1 }, end: { x: 0, y: 0 } },
|
|
5339
|
+
toTopRight: { start: { x: 0, y: 1 }, end: { x: 1, y: 0 } },
|
|
5340
|
+
toBottomLeft: { start: { x: 1, y: 0 }, end: { x: 0, y: 1 } },
|
|
5341
|
+
toBottomRight: { start: { x: 0, y: 0 }, end: { x: 1, y: 1 } }
|
|
5342
|
+
};
|
|
5343
|
+
function sp(token) {
|
|
5344
|
+
return token != null ? spacing[token] : void 0;
|
|
5345
|
+
}
|
|
5346
|
+
function resolvePosition(value) {
|
|
5347
|
+
if (value == null) return void 0;
|
|
5348
|
+
if (typeof value === "string" && value in spacing)
|
|
5349
|
+
return spacing[value];
|
|
5350
|
+
return value;
|
|
5351
|
+
}
|
|
5352
|
+
var Box2 = ({
|
|
5353
|
+
// Padding
|
|
5354
|
+
p,
|
|
5355
|
+
pt,
|
|
5356
|
+
pr,
|
|
5357
|
+
pb,
|
|
5358
|
+
pl,
|
|
5359
|
+
px,
|
|
5360
|
+
py,
|
|
5361
|
+
// Margin
|
|
5362
|
+
m,
|
|
5363
|
+
mt,
|
|
5364
|
+
mr,
|
|
5365
|
+
mb,
|
|
5366
|
+
ml,
|
|
5367
|
+
mx,
|
|
5368
|
+
my,
|
|
5369
|
+
// Fond
|
|
5370
|
+
bg,
|
|
5371
|
+
gradient,
|
|
5372
|
+
gradientDirection = "toBottom",
|
|
5373
|
+
// Bordure
|
|
5374
|
+
borderRadius,
|
|
5375
|
+
borderTopLeftRadius,
|
|
5376
|
+
borderTopRightRadius,
|
|
5377
|
+
borderBottomLeftRadius,
|
|
5378
|
+
borderBottomRightRadius,
|
|
5379
|
+
// Ombre
|
|
5380
|
+
shadow,
|
|
5381
|
+
// Flex
|
|
5382
|
+
flex,
|
|
5383
|
+
flexGrow,
|
|
5384
|
+
flexShrink,
|
|
5385
|
+
flexBasis,
|
|
5386
|
+
flexDirection,
|
|
5387
|
+
alignItems,
|
|
5388
|
+
alignSelf,
|
|
5389
|
+
justifyContent,
|
|
5390
|
+
gap,
|
|
5391
|
+
rowGap,
|
|
5392
|
+
columnGap,
|
|
5393
|
+
flexWrap,
|
|
5394
|
+
// Dimensions
|
|
5395
|
+
width,
|
|
5396
|
+
height,
|
|
5397
|
+
minWidth,
|
|
5398
|
+
minHeight,
|
|
5399
|
+
maxWidth,
|
|
5400
|
+
maxHeight,
|
|
5401
|
+
// Position
|
|
5402
|
+
overflow,
|
|
5403
|
+
opacity: opacity2,
|
|
5404
|
+
position,
|
|
5405
|
+
top,
|
|
5406
|
+
right,
|
|
5407
|
+
bottom,
|
|
5408
|
+
left,
|
|
5409
|
+
zIndex,
|
|
5410
|
+
style,
|
|
5411
|
+
children,
|
|
5412
|
+
theme,
|
|
5413
|
+
...rest
|
|
5414
|
+
}) => {
|
|
5415
|
+
const { theme: currentTheme } = useTheme(theme);
|
|
5416
|
+
const resP = useResponsiveValue(p);
|
|
5417
|
+
const resPT = useResponsiveValue(pt);
|
|
5418
|
+
const resPR = useResponsiveValue(pr);
|
|
5419
|
+
const resPB = useResponsiveValue(pb);
|
|
5420
|
+
const resPL = useResponsiveValue(pl);
|
|
5421
|
+
const resPX = useResponsiveValue(px);
|
|
5422
|
+
const resPY = useResponsiveValue(py);
|
|
5423
|
+
const resM = useResponsiveValue(m);
|
|
5424
|
+
const resMT = useResponsiveValue(mt);
|
|
5425
|
+
const resMR = useResponsiveValue(mr);
|
|
5426
|
+
const resMB = useResponsiveValue(mb);
|
|
5427
|
+
const resML = useResponsiveValue(ml);
|
|
5428
|
+
const resMX = useResponsiveValue(mx);
|
|
5429
|
+
const resMY = useResponsiveValue(my);
|
|
5430
|
+
const { boxStyle, gradientConfig } = useMemo(() => {
|
|
5431
|
+
let gradientColors = null;
|
|
5432
|
+
if (gradient) {
|
|
5433
|
+
gradientColors = Array.isArray(gradient) ? gradient : currentTheme.gradients[gradient] ?? [bg ?? "transparent", bg ?? "transparent"];
|
|
5434
|
+
}
|
|
5435
|
+
const computed = {
|
|
5436
|
+
// Padding
|
|
5437
|
+
padding: sp(resP),
|
|
5438
|
+
paddingTop: sp(resPT),
|
|
5439
|
+
paddingRight: sp(resPR),
|
|
5440
|
+
paddingBottom: sp(resPB),
|
|
5441
|
+
paddingLeft: sp(resPL),
|
|
5442
|
+
paddingHorizontal: sp(resPX),
|
|
5443
|
+
paddingVertical: sp(resPY),
|
|
5444
|
+
// Margin
|
|
5445
|
+
margin: sp(resM),
|
|
5446
|
+
marginTop: sp(resMT),
|
|
5447
|
+
marginRight: sp(resMR),
|
|
5448
|
+
marginBottom: sp(resMB),
|
|
5449
|
+
marginLeft: sp(resML),
|
|
5450
|
+
marginHorizontal: sp(resMX),
|
|
5451
|
+
marginVertical: sp(resMY),
|
|
5452
|
+
// Fond — omis quand gradient actif (LinearGradient gère ça)
|
|
5453
|
+
backgroundColor: gradientColors ? void 0 : bg,
|
|
5454
|
+
// Bordure
|
|
5455
|
+
borderRadius: borderRadius ? radii[borderRadius] : void 0,
|
|
5456
|
+
borderTopLeftRadius: borderTopLeftRadius ? radii[borderTopLeftRadius] : void 0,
|
|
5457
|
+
borderTopRightRadius: borderTopRightRadius ? radii[borderTopRightRadius] : void 0,
|
|
5458
|
+
borderBottomLeftRadius: borderBottomLeftRadius ? radii[borderBottomLeftRadius] : void 0,
|
|
5459
|
+
borderBottomRightRadius: borderBottomRightRadius ? radii[borderBottomRightRadius] : void 0,
|
|
5460
|
+
// Flex
|
|
5461
|
+
flex,
|
|
5462
|
+
flexGrow,
|
|
5463
|
+
flexShrink,
|
|
5464
|
+
flexBasis,
|
|
5465
|
+
flexDirection,
|
|
5466
|
+
alignItems,
|
|
5467
|
+
alignSelf,
|
|
5468
|
+
justifyContent,
|
|
5469
|
+
flexWrap,
|
|
5470
|
+
gap: gap != null ? spacing[gap] : void 0,
|
|
5471
|
+
rowGap: rowGap != null ? spacing[rowGap] : void 0,
|
|
5472
|
+
columnGap: columnGap != null ? spacing[columnGap] : void 0,
|
|
5473
|
+
// Dimensions
|
|
5474
|
+
width,
|
|
5475
|
+
height,
|
|
5476
|
+
minWidth,
|
|
5477
|
+
minHeight,
|
|
5478
|
+
maxWidth,
|
|
5479
|
+
maxHeight,
|
|
5480
|
+
// Divers
|
|
5481
|
+
overflow,
|
|
5482
|
+
opacity: opacity2,
|
|
5483
|
+
position,
|
|
5484
|
+
zIndex,
|
|
5485
|
+
top: resolvePosition(top),
|
|
5486
|
+
right: resolvePosition(right),
|
|
5487
|
+
bottom: resolvePosition(bottom),
|
|
5488
|
+
left: resolvePosition(left),
|
|
5489
|
+
// Ombre
|
|
5490
|
+
...shadow ? shadows[shadow] : {}
|
|
5491
|
+
};
|
|
5492
|
+
const flatStyle = [computed, ...Array.isArray(style) ? style : style ? [style] : []];
|
|
5493
|
+
return {
|
|
5494
|
+
boxStyle: flatStyle,
|
|
5495
|
+
gradientConfig: gradientColors ? { colors: gradientColors, ...GRADIENT_VECTORS[gradientDirection] } : null
|
|
5496
|
+
};
|
|
5497
|
+
}, [
|
|
5498
|
+
resP,
|
|
5499
|
+
resPT,
|
|
5500
|
+
resPR,
|
|
5501
|
+
resPB,
|
|
5502
|
+
resPL,
|
|
5503
|
+
resPX,
|
|
5504
|
+
resPY,
|
|
5505
|
+
resM,
|
|
5506
|
+
resMT,
|
|
5507
|
+
resMR,
|
|
5508
|
+
resMB,
|
|
5509
|
+
resML,
|
|
5510
|
+
resMX,
|
|
5511
|
+
resMY,
|
|
5512
|
+
bg,
|
|
5513
|
+
gradient,
|
|
5514
|
+
gradientDirection,
|
|
5515
|
+
currentTheme,
|
|
5516
|
+
borderRadius,
|
|
5517
|
+
borderTopLeftRadius,
|
|
5518
|
+
borderTopRightRadius,
|
|
5519
|
+
borderBottomLeftRadius,
|
|
5520
|
+
borderBottomRightRadius,
|
|
5521
|
+
shadow,
|
|
5522
|
+
flex,
|
|
5523
|
+
flexGrow,
|
|
5524
|
+
flexShrink,
|
|
5525
|
+
flexBasis,
|
|
5526
|
+
flexDirection,
|
|
5527
|
+
alignItems,
|
|
5528
|
+
alignSelf,
|
|
5529
|
+
justifyContent,
|
|
5530
|
+
gap,
|
|
5531
|
+
rowGap,
|
|
5532
|
+
columnGap,
|
|
5533
|
+
flexWrap,
|
|
5534
|
+
width,
|
|
5535
|
+
height,
|
|
5536
|
+
minWidth,
|
|
5537
|
+
minHeight,
|
|
5538
|
+
maxWidth,
|
|
5539
|
+
maxHeight,
|
|
5540
|
+
overflow,
|
|
5541
|
+
opacity2,
|
|
5542
|
+
position,
|
|
5543
|
+
top,
|
|
5544
|
+
right,
|
|
5545
|
+
bottom,
|
|
5546
|
+
left,
|
|
5547
|
+
zIndex,
|
|
5548
|
+
style
|
|
5549
|
+
]);
|
|
5550
|
+
if (gradientConfig && LinearGradient) {
|
|
5551
|
+
return /* @__PURE__ */ jsx(
|
|
5552
|
+
LinearGradient,
|
|
5553
|
+
{
|
|
5554
|
+
colors: gradientConfig.colors,
|
|
5555
|
+
start: gradientConfig.start,
|
|
5556
|
+
end: gradientConfig.end,
|
|
5557
|
+
style: boxStyle,
|
|
5558
|
+
...rest,
|
|
5559
|
+
children
|
|
5560
|
+
}
|
|
5561
|
+
);
|
|
5562
|
+
}
|
|
5563
|
+
return /* @__PURE__ */ jsx(View, { style: boxStyle, ...rest, children });
|
|
5564
|
+
};
|
|
5565
|
+
var Box_default2 = Box2;
|
|
5566
|
+
function sp2(token) {
|
|
5567
|
+
return token != null ? spacing[token] : void 0;
|
|
5568
|
+
}
|
|
5569
|
+
var Scroll2 = ({
|
|
5570
|
+
p,
|
|
5571
|
+
px,
|
|
5572
|
+
py,
|
|
5573
|
+
pt,
|
|
5574
|
+
pr,
|
|
5575
|
+
pb,
|
|
5576
|
+
pl,
|
|
5577
|
+
contentContainerStyle,
|
|
5578
|
+
containerProps,
|
|
5579
|
+
children,
|
|
5580
|
+
...rest
|
|
5581
|
+
}) => {
|
|
5582
|
+
const paddingStyle = useMemo(
|
|
5583
|
+
() => ({
|
|
5584
|
+
padding: sp2(p),
|
|
5585
|
+
paddingHorizontal: sp2(px),
|
|
5586
|
+
paddingVertical: sp2(py),
|
|
5587
|
+
paddingTop: sp2(pt),
|
|
5588
|
+
paddingRight: sp2(pr),
|
|
5589
|
+
paddingLeft: sp2(pl),
|
|
5590
|
+
// pb résout à 0 si absent — évite de couper le contenu en bas
|
|
5591
|
+
paddingBottom: pb != null ? spacing[pb] : 0
|
|
5592
|
+
}),
|
|
5593
|
+
[p, px, py, pt, pr, pb, pl]
|
|
5594
|
+
);
|
|
5595
|
+
return /* @__PURE__ */ jsx(Box_default2, { flex: 1, overflow: "hidden", width: "100%", ...containerProps, children: /* @__PURE__ */ jsx(
|
|
5596
|
+
ScrollView,
|
|
5597
|
+
{
|
|
5598
|
+
style: { flex: 1 },
|
|
5599
|
+
contentContainerStyle: [{ flexGrow: 1 }, paddingStyle, contentContainerStyle],
|
|
5600
|
+
showsVerticalScrollIndicator: rest.showsVerticalScrollIndicator ?? true,
|
|
5601
|
+
nestedScrollEnabled: rest.nestedScrollEnabled ?? true,
|
|
5602
|
+
keyboardShouldPersistTaps: rest.keyboardShouldPersistTaps ?? "handled",
|
|
5603
|
+
...rest,
|
|
5604
|
+
children
|
|
5605
|
+
}
|
|
5606
|
+
) });
|
|
5607
|
+
};
|
|
5608
|
+
var Scroll_default2 = Scroll2;
|
|
5609
|
+
var META9 = getLayoutMeta("BentoLayout");
|
|
5610
|
+
var generateModernBentoConfig = (itemCount, isMobile) => {
|
|
5611
|
+
const config = [];
|
|
5612
|
+
const patterns = [
|
|
5613
|
+
[{ cols: 2, rows: 2 }, { cols: 2, rows: 1 }, { cols: 2, rows: 1 }],
|
|
5614
|
+
[{ cols: isMobile ? 2 : 1, rows: 1 }, { cols: isMobile ? 2 : 1, rows: 1 }, { cols: isMobile ? 2 : 2, rows: isMobile ? 1 : 2 }],
|
|
5615
|
+
[{ cols: 2, rows: 2 }, { cols: 1, rows: 1 }, { cols: 1, rows: 1 }],
|
|
5616
|
+
[{ cols: 3, rows: 1 }, { cols: 1, rows: 1 }, { cols: 1, rows: 1 }]
|
|
5617
|
+
];
|
|
5618
|
+
let itemIndex = 0;
|
|
5619
|
+
let patternIndex = 0;
|
|
5620
|
+
while (itemIndex < itemCount) {
|
|
5621
|
+
const pattern = patterns[patternIndex % patterns.length];
|
|
5622
|
+
for (const cell of pattern) {
|
|
5623
|
+
if (itemIndex >= itemCount) break;
|
|
5624
|
+
config.push({
|
|
5625
|
+
index: itemIndex,
|
|
5626
|
+
cols: isMobile ? Math.min(cell.cols, 2) : cell.cols,
|
|
5627
|
+
rows: cell.rows
|
|
5628
|
+
});
|
|
5629
|
+
itemIndex++;
|
|
5630
|
+
}
|
|
5631
|
+
patternIndex++;
|
|
5632
|
+
}
|
|
5633
|
+
return config;
|
|
5634
|
+
};
|
|
5635
|
+
var BentoLayout = (rawProps) => {
|
|
5636
|
+
const { theme } = useTheme();
|
|
5637
|
+
const {
|
|
5638
|
+
items: itemsProp,
|
|
5639
|
+
children: childrenProp,
|
|
5640
|
+
spacing: spacing3,
|
|
5641
|
+
itemBackground,
|
|
5642
|
+
itemBorderRadius,
|
|
5643
|
+
scrollable,
|
|
5644
|
+
maxWidth,
|
|
5645
|
+
cellConfig,
|
|
5646
|
+
baseHeight,
|
|
5647
|
+
background,
|
|
5648
|
+
borderRadius
|
|
5649
|
+
} = applyDefaults(rawProps, META9, theme);
|
|
5650
|
+
const { isMobile } = useBreakpoint();
|
|
5651
|
+
const maxCols = isMobile ? 2 : 4;
|
|
5652
|
+
const rawItems = Array.isArray(itemsProp) && itemsProp.length > 0 ? itemsProp : React2.Children.toArray(childrenProp).filter(Boolean);
|
|
5653
|
+
const resolvedItems = useStudioItems(
|
|
5654
|
+
rawItems,
|
|
5655
|
+
4,
|
|
5656
|
+
(i) => /* @__PURE__ */ jsx(Box_default2, { flex: 1, bg: itemBackground, borderRadius: itemBorderRadius, opacity: 0.4 }, i)
|
|
5657
|
+
);
|
|
5658
|
+
const itemPadding = useMemo(() => Number(spacing3) / 2, [spacing3]);
|
|
5659
|
+
const bentoConfig = useMemo(
|
|
5660
|
+
() => cellConfig || generateModernBentoConfig(resolvedItems.length, isMobile),
|
|
5661
|
+
[resolvedItems.length, isMobile, cellConfig]
|
|
5662
|
+
);
|
|
5663
|
+
const { placements, totalHeight } = useMemo(() => {
|
|
5664
|
+
const grid = {};
|
|
5665
|
+
const results = [];
|
|
5666
|
+
const canPlace = (row, col, cols, rows) => {
|
|
5667
|
+
for (let r = 0; r < rows; r++)
|
|
5668
|
+
for (let c = 0; c < cols; c++)
|
|
5669
|
+
if (grid[row + r]?.[col + c]) return false;
|
|
5670
|
+
return true;
|
|
5671
|
+
};
|
|
5672
|
+
const markOccupied = (row, col, cols, rows) => {
|
|
5673
|
+
for (let r = 0; r < rows; r++) {
|
|
5674
|
+
if (!grid[row + r]) grid[row + r] = {};
|
|
5675
|
+
for (let c = 0; c < cols; c++) grid[row + r][col + c] = true;
|
|
5676
|
+
}
|
|
5677
|
+
};
|
|
5678
|
+
bentoConfig.forEach((cell) => {
|
|
5679
|
+
let r = 0, found = false;
|
|
5680
|
+
while (!found && r < 1e3) {
|
|
5681
|
+
for (let c = 0; c <= maxCols - cell.cols; c++) {
|
|
5682
|
+
if (canPlace(r, c, cell.cols, cell.rows)) {
|
|
5683
|
+
markOccupied(r, c, cell.cols, cell.rows);
|
|
5684
|
+
results.push({ index: cell.index, row: r, col: c, cols: cell.cols, rows: cell.rows });
|
|
5685
|
+
found = true;
|
|
5686
|
+
break;
|
|
5687
|
+
}
|
|
5688
|
+
}
|
|
5689
|
+
r++;
|
|
5690
|
+
}
|
|
5691
|
+
});
|
|
5692
|
+
return { placements: results, totalHeight: Math.max(...results.map((p) => p.row + p.rows), 1) * baseHeight };
|
|
5693
|
+
}, [bentoConfig, baseHeight, maxCols]);
|
|
5694
|
+
const GridContent = /* @__PURE__ */ jsx(
|
|
5695
|
+
Box_default2,
|
|
5696
|
+
{
|
|
5697
|
+
width: "100%",
|
|
5698
|
+
height: totalHeight,
|
|
5699
|
+
style: { maxWidth: isMobile ? "100%" : maxWidth, alignSelf: "center" },
|
|
5700
|
+
children: placements.map((p) => /* @__PURE__ */ jsx(
|
|
5701
|
+
Box_default2,
|
|
5702
|
+
{
|
|
5703
|
+
position: "absolute",
|
|
5704
|
+
left: `${p.col / maxCols * 100}%`,
|
|
5705
|
+
top: p.row * baseHeight,
|
|
5706
|
+
width: `${p.cols / maxCols * 100}%`,
|
|
5707
|
+
height: p.rows * baseHeight,
|
|
5708
|
+
p: itemPadding,
|
|
5709
|
+
children: /* @__PURE__ */ jsx(
|
|
5710
|
+
Box_default2,
|
|
5711
|
+
{
|
|
5712
|
+
flex: 1,
|
|
5713
|
+
bg: itemBackground || "transparent",
|
|
5714
|
+
borderRadius: itemBorderRadius,
|
|
5715
|
+
overflow: "hidden",
|
|
5716
|
+
children: resolvedItems[p.index]
|
|
5717
|
+
}
|
|
5718
|
+
)
|
|
5719
|
+
},
|
|
5720
|
+
`bento-${p.index}`
|
|
5721
|
+
))
|
|
5722
|
+
}
|
|
5723
|
+
);
|
|
5724
|
+
return /* @__PURE__ */ jsx(Box_default2, { flex: 1, bg: background, borderRadius, overflow: "hidden", children: scrollable ? /* @__PURE__ */ jsx(Scroll_default2, { showsVerticalScrollIndicator: false, children: GridContent }) : GridContent });
|
|
5725
|
+
};
|
|
5726
|
+
var BentoLayout_default = BentoLayout;
|
|
5727
|
+
var META10 = getLayoutMeta("SidebarLayout");
|
|
5235
5728
|
var SidebarLayout = (rawProps) => {
|
|
5236
5729
|
const { theme } = useTheme();
|
|
5237
5730
|
const {
|
|
@@ -5250,7 +5743,7 @@ var SidebarLayout = (rawProps) => {
|
|
|
5250
5743
|
children,
|
|
5251
5744
|
style,
|
|
5252
5745
|
...rest
|
|
5253
|
-
} = applyDefaults(rawProps,
|
|
5746
|
+
} = applyDefaults(rawProps, META10, theme);
|
|
5254
5747
|
const sw = sidebarWidth ?? 280;
|
|
5255
5748
|
const gap = spacingToken != null ? spacing[spacingToken] : spacing[4];
|
|
5256
5749
|
const pad = paddingToken != null ? spacing[paddingToken] : void 0;
|
|
@@ -5298,7 +5791,7 @@ var SidebarLayout = (rawProps) => {
|
|
|
5298
5791
|
] });
|
|
5299
5792
|
};
|
|
5300
5793
|
var SidebarLayout_default = SidebarLayout;
|
|
5301
|
-
var
|
|
5794
|
+
var META11 = getLayoutMeta("GridLayout");
|
|
5302
5795
|
var GridLayout = (rawProps) => {
|
|
5303
5796
|
const { theme } = useTheme();
|
|
5304
5797
|
const {
|
|
@@ -5317,7 +5810,7 @@ var GridLayout = (rawProps) => {
|
|
|
5317
5810
|
children,
|
|
5318
5811
|
style,
|
|
5319
5812
|
...rest
|
|
5320
|
-
} = applyDefaults(rawProps,
|
|
5813
|
+
} = applyDefaults(rawProps, META11, theme);
|
|
5321
5814
|
const gap = spacingToken != null ? spacing[spacingToken] : 0;
|
|
5322
5815
|
const pad = paddingToken != null ? spacing[paddingToken] : 0;
|
|
5323
5816
|
const minCellWidth = compact ? 140 : 200;
|
|
@@ -5347,7 +5840,7 @@ var GridLayout = (rawProps) => {
|
|
|
5347
5840
|
return /* @__PURE__ */ jsx("div", { style: gridStyle, ...rest, children });
|
|
5348
5841
|
};
|
|
5349
5842
|
var GridLayout_default = GridLayout;
|
|
5350
|
-
var
|
|
5843
|
+
var META12 = getLayoutMeta("FlexLayout");
|
|
5351
5844
|
var FlexLayout = (rawProps) => {
|
|
5352
5845
|
const { theme } = useTheme();
|
|
5353
5846
|
const {
|
|
@@ -5364,7 +5857,7 @@ var FlexLayout = (rawProps) => {
|
|
|
5364
5857
|
children,
|
|
5365
5858
|
style,
|
|
5366
5859
|
...rest
|
|
5367
|
-
} = applyDefaults(rawProps,
|
|
5860
|
+
} = applyDefaults(rawProps, META12, theme);
|
|
5368
5861
|
const flexStyle = {
|
|
5369
5862
|
display: "flex",
|
|
5370
5863
|
flexDirection: direction ?? "row",
|
|
@@ -5385,7 +5878,7 @@ var FlexLayout = (rawProps) => {
|
|
|
5385
5878
|
return /* @__PURE__ */ jsx("div", { style: flexStyle, ...rest, children });
|
|
5386
5879
|
};
|
|
5387
5880
|
var FlexLayout_default = FlexLayout;
|
|
5388
|
-
var
|
|
5881
|
+
var META13 = getLayoutMeta("SplitLayout");
|
|
5389
5882
|
var SplitLayout = (rawProps) => {
|
|
5390
5883
|
const { theme } = useTheme();
|
|
5391
5884
|
const {
|
|
@@ -5405,7 +5898,7 @@ var SplitLayout = (rawProps) => {
|
|
|
5405
5898
|
children,
|
|
5406
5899
|
style,
|
|
5407
5900
|
...rest
|
|
5408
|
-
} = applyDefaults(rawProps,
|
|
5901
|
+
} = applyDefaults(rawProps, META13, theme);
|
|
5409
5902
|
const gap = spacingToken != null ? spacing[spacingToken] : 0;
|
|
5410
5903
|
const r = ratio ?? 0.5;
|
|
5411
5904
|
const isVertical = orientation === "vertical";
|
|
@@ -5449,7 +5942,7 @@ var SplitLayout = (rawProps) => {
|
|
|
5449
5942
|
] });
|
|
5450
5943
|
};
|
|
5451
5944
|
var SplitLayout_default = SplitLayout;
|
|
5452
|
-
var
|
|
5945
|
+
var META14 = getLayoutMeta("FooterLayout");
|
|
5453
5946
|
var FooterLayout = (rawProps) => {
|
|
5454
5947
|
const { theme } = useTheme();
|
|
5455
5948
|
const {
|
|
@@ -5470,7 +5963,7 @@ var FooterLayout = (rawProps) => {
|
|
|
5470
5963
|
children,
|
|
5471
5964
|
style,
|
|
5472
5965
|
...rest
|
|
5473
|
-
} = applyDefaults(rawProps,
|
|
5966
|
+
} = applyDefaults(rawProps, META14, theme);
|
|
5474
5967
|
const fh = footerHeight ?? 60;
|
|
5475
5968
|
const gap = spacingToken != null ? spacing[spacingToken] : 0;
|
|
5476
5969
|
const pad = paddingToken != null ? spacing[paddingToken] : spacing[5];
|
|
@@ -5512,7 +6005,7 @@ var FooterLayout = (rawProps) => {
|
|
|
5512
6005
|
] });
|
|
5513
6006
|
};
|
|
5514
6007
|
var FooterLayout_default = FooterLayout;
|
|
5515
|
-
var
|
|
6008
|
+
var META15 = getLayoutMeta("ResponsiveLayout");
|
|
5516
6009
|
var ResponsiveLayout = (rawProps) => {
|
|
5517
6010
|
const { theme } = useTheme();
|
|
5518
6011
|
const {
|
|
@@ -5538,7 +6031,7 @@ var ResponsiveLayout = (rawProps) => {
|
|
|
5538
6031
|
children,
|
|
5539
6032
|
style,
|
|
5540
6033
|
...rest
|
|
5541
|
-
} = applyDefaults(rawProps,
|
|
6034
|
+
} = applyDefaults(rawProps, META15, theme);
|
|
5542
6035
|
const hh = headerHeight ?? 60;
|
|
5543
6036
|
const sw = Math.min(sidebarWidth ?? 260, sidebarMaxWidth ?? 320);
|
|
5544
6037
|
const fh = footerHeight ?? 60;
|
|
@@ -5703,6 +6196,6 @@ var FoundationProvider = ({
|
|
|
5703
6196
|
) });
|
|
5704
6197
|
};
|
|
5705
6198
|
|
|
5706
|
-
export { Accordion_default as Accordion, AuthLayout_default as AuthLayout, Avatar_default as Avatar, Badge_default as Badge, Box_default as Box, Button_default as Button, Center_default as Center, CenteredLayout_default as CenteredLayout, Checkbox_default as Checkbox, Chip_default as Chip, DashboardLayout_default as DashboardLayout, Divider_default as Divider, FilePicker_default as FilePicker, FlexLayout_default as FlexLayout, FooterLayout_default as FooterLayout, FoundationProvider, GridLayout_default as GridLayout, Icon_default as Icon, IconButton_default as IconButton, Inline_default as Inline, TextInput_default as Input, Text_default as Label, ProgressBar_default as ProgressBar, RadioGroup_default as RadioGroup, ResponsiveLayout_default as ResponsiveLayout, RootLayout_default as RootLayout, Scroll_default as Scroll, Select_default as Select, Separator_default as Separator, SidebarLayout_default as SidebarLayout, Slider_default as Slider, Spinner_default as Spinner, SplitLayout_default as SplitLayout, Stack_default as Stack, Switch_default as Switch, Tabs_default as Tabs, Text_default as Text, TextArea_default as TextArea, TextInput_default as TextInput, TextArea_default as Textarea, ThemeProvider, applyDefaults, applyVariant, autumnTheme, blockRegistry, breakpoints, christmasTheme, colors, componentRegistry, createTheme, darkTheme, defineConfig, durations, easings, extractDefaults, fontSizes, fontWeights, getBlockMeta, getComponentMeta, getConstants, getLayoutMeta, getPrimitiveMeta, halloweenTheme, layoutRegistry, letterSpacings, lightTheme, lineHeights, neonTheme, opacity, primitiveRegistry, radii, resolveConfig, resolveThemeDefaults, shadows, spacing, springTheme, summerTheme, useColorScheme, useFoundationConfig, useTheme, useTokens, winterTheme, zIndices };
|
|
6199
|
+
export { Accordion_default as Accordion, AuthLayout_default as AuthLayout, Avatar_default as Avatar, Badge_default as Badge, BentoLayout_default as BentoLayout, Box_default as Box, Button_default as Button, Center_default as Center, CenteredLayout_default as CenteredLayout, Checkbox_default as Checkbox, Chip_default as Chip, DashboardLayout_default as DashboardLayout, Divider_default as Divider, FilePicker_default as FilePicker, FlexLayout_default as FlexLayout, FooterLayout_default as FooterLayout, FoundationProvider, GridLayout_default as GridLayout, Icon_default as Icon, IconButton_default as IconButton, Inline_default as Inline, TextInput_default as Input, Text_default as Label, ProgressBar_default as ProgressBar, RadioGroup_default as RadioGroup, ResponsiveLayout_default as ResponsiveLayout, RootLayout_default as RootLayout, Scroll_default as Scroll, Select_default as Select, Separator_default as Separator, SidebarLayout_default as SidebarLayout, Slider_default as Slider, Spinner_default as Spinner, SplitLayout_default as SplitLayout, Stack_default as Stack, Switch_default as Switch, Tabs_default as Tabs, Text_default as Text, TextArea_default as TextArea, TextInput_default as TextInput, TextArea_default as Textarea, ThemeProvider, applyDefaults, applyVariant, autumnTheme, blockRegistry, breakpoints, christmasTheme, colors, componentRegistry, createTheme, darkTheme, defineConfig, durations, easings, extractDefaults, fontSizes, fontWeights, getBlockMeta, getComponentMeta, getConstants, getLayoutMeta, getPrimitiveMeta, halloweenTheme, layoutRegistry, letterSpacings, lightTheme, lineHeights, neonTheme, opacity, primitiveRegistry, radii, resolveConfig, resolveThemeDefaults, shadows, spacing, springTheme, summerTheme, useColorScheme, useFoundationConfig, useTheme, useTokens, winterTheme, zIndices };
|
|
5707
6200
|
//# sourceMappingURL=index.mjs.map
|
|
5708
6201
|
//# sourceMappingURL=index.mjs.map
|