@rufous/ui 0.3.59 → 0.3.61

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/main.js CHANGED
@@ -1231,19 +1231,235 @@ import * as React132 from "react";
1231
1231
 
1232
1232
  // lib/utils/sx.ts
1233
1233
  import { useRef, useEffect } from "react";
1234
+
1235
+ // lib/utils/sxResolver.ts
1236
+ var DEFAULT_SPACING = 8;
1237
+ var DEFAULT_BORDER_RADIUS = 4;
1234
1238
  function camelToKebab(str) {
1235
1239
  return str.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
1236
1240
  }
1237
- function sxToCss(sx, selector) {
1241
+ function warn(msg) {
1242
+ if (typeof process !== "undefined" && process.env && process.env.NODE_ENV !== "production") {
1243
+ console.warn(`[rufous-ui sx] ${msg}`);
1244
+ }
1245
+ }
1246
+ var SPACING_MAP = {
1247
+ m: ["margin"],
1248
+ margin: ["margin"],
1249
+ mt: ["margin-top"],
1250
+ marginTop: ["margin-top"],
1251
+ mb: ["margin-bottom"],
1252
+ marginBottom: ["margin-bottom"],
1253
+ ml: ["margin-left"],
1254
+ marginLeft: ["margin-left"],
1255
+ mr: ["margin-right"],
1256
+ marginRight: ["margin-right"],
1257
+ mx: ["margin-left", "margin-right"],
1258
+ marginX: ["margin-left", "margin-right"],
1259
+ my: ["margin-top", "margin-bottom"],
1260
+ marginY: ["margin-top", "margin-bottom"],
1261
+ marginInline: ["margin-inline"],
1262
+ marginInlineStart: ["margin-inline-start"],
1263
+ marginInlineEnd: ["margin-inline-end"],
1264
+ marginBlock: ["margin-block"],
1265
+ marginBlockStart: ["margin-block-start"],
1266
+ marginBlockEnd: ["margin-block-end"],
1267
+ p: ["padding"],
1268
+ padding: ["padding"],
1269
+ pt: ["padding-top"],
1270
+ paddingTop: ["padding-top"],
1271
+ pb: ["padding-bottom"],
1272
+ paddingBottom: ["padding-bottom"],
1273
+ pl: ["padding-left"],
1274
+ paddingLeft: ["padding-left"],
1275
+ pr: ["padding-right"],
1276
+ paddingRight: ["padding-right"],
1277
+ px: ["padding-left", "padding-right"],
1278
+ paddingX: ["padding-left", "padding-right"],
1279
+ py: ["padding-top", "padding-bottom"],
1280
+ paddingY: ["padding-top", "padding-bottom"],
1281
+ paddingInline: ["padding-inline"],
1282
+ paddingInlineStart: ["padding-inline-start"],
1283
+ paddingInlineEnd: ["padding-inline-end"],
1284
+ paddingBlock: ["padding-block"],
1285
+ paddingBlockStart: ["padding-block-start"],
1286
+ paddingBlockEnd: ["padding-block-end"],
1287
+ gap: ["gap"],
1288
+ rowGap: ["row-gap"],
1289
+ columnGap: ["column-gap"]
1290
+ };
1291
+ var BORDER_WIDTH_MAP = {
1292
+ border: "border",
1293
+ borderTop: "border-top",
1294
+ borderRight: "border-right",
1295
+ borderBottom: "border-bottom",
1296
+ borderLeft: "border-left"
1297
+ };
1298
+ var SIZING_MAP = {
1299
+ width: "width",
1300
+ height: "height",
1301
+ minWidth: "min-width",
1302
+ maxWidth: "max-width",
1303
+ minHeight: "min-height",
1304
+ maxHeight: "max-height"
1305
+ };
1306
+ var PALETTE_MAP = {
1307
+ bgcolor: "background-color",
1308
+ color: "color",
1309
+ borderColor: "border-color"
1310
+ };
1311
+ var POSITION_LENGTH_MAP = {
1312
+ top: "top",
1313
+ right: "right",
1314
+ bottom: "bottom",
1315
+ left: "left"
1316
+ };
1317
+ var PASS_THROUGH_KEYS = [
1318
+ "boxSizing",
1319
+ "overflow",
1320
+ "overflowX",
1321
+ "overflowY",
1322
+ // Flexbox (Group H)
1323
+ "display",
1324
+ "alignContent",
1325
+ "alignItems",
1326
+ "alignSelf",
1327
+ "flex",
1328
+ "flexDirection",
1329
+ "flexGrow",
1330
+ "flexShrink",
1331
+ "flexWrap",
1332
+ "flexBasis",
1333
+ "justifyContent",
1334
+ "justifyItems",
1335
+ "justifySelf",
1336
+ "order",
1337
+ // Grid (Group I)
1338
+ "gridColumn",
1339
+ "gridRow",
1340
+ "gridAutoFlow",
1341
+ "gridAutoColumns",
1342
+ "gridAutoRows",
1343
+ "gridTemplateColumns",
1344
+ "gridTemplateRows",
1345
+ "gridTemplateAreas",
1346
+ "gridArea",
1347
+ // Positioning (Group J)
1348
+ "position",
1349
+ // Typography (Group G)
1350
+ "fontFamily",
1351
+ "fontSize",
1352
+ "fontStyle",
1353
+ "fontWeight",
1354
+ "letterSpacing",
1355
+ "lineHeight",
1356
+ "textAlign",
1357
+ "textTransform"
1358
+ ];
1359
+ var SYSTEM_PROP_NAMES = /* @__PURE__ */ new Set([
1360
+ ...Object.keys(SPACING_MAP),
1361
+ ...Object.keys(BORDER_WIDTH_MAP),
1362
+ "borderRadius",
1363
+ ...Object.keys(SIZING_MAP),
1364
+ ...Object.keys(PALETTE_MAP),
1365
+ ...Object.keys(POSITION_LENGTH_MAP),
1366
+ "boxShadow",
1367
+ "zIndex",
1368
+ "typography",
1369
+ ...PASS_THROUGH_KEYS
1370
+ ]);
1371
+ function resolvePaletteValue(value, theme) {
1372
+ if (typeof value === "string" && value.includes(".")) {
1373
+ if (theme?.palette) {
1374
+ const [group, token] = value.split(".");
1375
+ const resolved = theme.palette?.[group]?.[token];
1376
+ if (typeof resolved === "string") return resolved;
1377
+ warn(`palette token "${value}" not found in theme \u2014 passing through verbatim`);
1378
+ }
1379
+ }
1380
+ return String(value);
1381
+ }
1382
+ function resolveSxProp(key, value, theme) {
1383
+ if (value === void 0 || value === null) return [];
1384
+ if (key in SPACING_MAP) {
1385
+ const spacing = theme?.spacing ?? DEFAULT_SPACING;
1386
+ const out = typeof value === "number" ? `${value * spacing}px` : String(value);
1387
+ return SPACING_MAP[key].map((property) => ({ property, value: out }));
1388
+ }
1389
+ if (key in BORDER_WIDTH_MAP) {
1390
+ const out = typeof value === "number" ? `${value}px solid` : String(value);
1391
+ return [{ property: BORDER_WIDTH_MAP[key], value: out }];
1392
+ }
1393
+ if (key === "borderRadius") {
1394
+ const radius = theme?.shape?.borderRadius ?? DEFAULT_BORDER_RADIUS;
1395
+ const out = typeof value === "number" ? `${value * radius}px` : String(value);
1396
+ return [{ property: "border-radius", value: out }];
1397
+ }
1398
+ if (key in PALETTE_MAP) {
1399
+ return [{ property: PALETTE_MAP[key], value: resolvePaletteValue(value, theme) }];
1400
+ }
1401
+ if (key in SIZING_MAP) {
1402
+ const out = typeof value === "number" ? `${value}px` : String(value);
1403
+ return [{ property: SIZING_MAP[key], value: out }];
1404
+ }
1405
+ if (key in POSITION_LENGTH_MAP) {
1406
+ const out = typeof value === "number" ? `${value}px` : String(value);
1407
+ return [{ property: POSITION_LENGTH_MAP[key], value: out }];
1408
+ }
1409
+ if (key === "boxShadow") {
1410
+ if (typeof value === "number") {
1411
+ const shadow = theme?.shadows?.[value];
1412
+ if (shadow === void 0) {
1413
+ warn(`theme.shadows[${value}] not found \u2014 passing through verbatim`);
1414
+ return [{ property: "box-shadow", value: String(value) }];
1415
+ }
1416
+ return [{ property: "box-shadow", value: shadow }];
1417
+ }
1418
+ return [{ property: "box-shadow", value: String(value) }];
1419
+ }
1420
+ if (key === "zIndex") {
1421
+ if (typeof value === "string") {
1422
+ const z = theme?.zIndex?.[value];
1423
+ if (z === void 0) {
1424
+ warn(`theme.zIndex["${value}"] not found \u2014 passing through verbatim`);
1425
+ return [{ property: "z-index", value }];
1426
+ }
1427
+ return [{ property: "z-index", value: String(z) }];
1428
+ }
1429
+ return [{ property: "z-index", value: String(value) }];
1430
+ }
1431
+ if (key === "typography") {
1432
+ const variant = theme?.typography?.[String(value)];
1433
+ if (!variant) {
1434
+ warn(`theme.typography["${String(value)}"] not found \u2014 skipping`);
1435
+ return [];
1436
+ }
1437
+ const pairs = [
1438
+ ["font-family", variant.fontFamily],
1439
+ ["font-weight", variant.fontWeight],
1440
+ ["font-size", variant.fontSize],
1441
+ ["line-height", variant.lineHeight],
1442
+ ["letter-spacing", variant.letterSpacing],
1443
+ ["text-transform", variant.textTransform]
1444
+ ];
1445
+ return pairs.filter(([, v]) => v !== void 0).map(([property, v]) => ({ property, value: String(v) }));
1446
+ }
1447
+ return [{ property: camelToKebab(key), value: String(value) }];
1448
+ }
1449
+
1450
+ // lib/utils/sx.ts
1451
+ function sxToCss(sx, selector, theme) {
1238
1452
  const props = [];
1239
1453
  const nested = [];
1240
1454
  for (const [key, value] of Object.entries(sx)) {
1241
1455
  if (value === void 0 || value === null) continue;
1242
1456
  if (typeof value === "object") {
1243
1457
  const nestedSel = key.includes("&") ? key.replace(/&/g, selector) : `${selector} ${key}`;
1244
- nested.push(sxToCss(value, nestedSel));
1458
+ nested.push(sxToCss(value, nestedSel, theme));
1245
1459
  } else {
1246
- props.push(` ${camelToKebab(key)}: ${value};`);
1460
+ for (const { property, value: resolved } of resolveSxProp(key, value, theme)) {
1461
+ props.push(` ${property}: ${resolved};`);
1462
+ }
1247
1463
  }
1248
1464
  }
1249
1465
  const blocks = [];
@@ -1254,10 +1470,11 @@ ${props.join("\n")}
1254
1470
  return blocks.join("\n");
1255
1471
  }
1256
1472
  var _sxUid = 0;
1257
- function useSx(sx) {
1473
+ function useSx(sx, theme) {
1258
1474
  const cls = useRef(`rf-sx-${++_sxUid}`).current;
1475
+ const hasStyles = !!sx && Object.keys(sx).length > 0;
1259
1476
  useEffect(() => {
1260
- if (!sx) return;
1477
+ if (!hasStyles) return;
1261
1478
  const id = `style-${cls}`;
1262
1479
  let el = document.getElementById(id);
1263
1480
  if (!el) {
@@ -1265,12 +1482,12 @@ function useSx(sx) {
1265
1482
  el.id = id;
1266
1483
  document.head.appendChild(el);
1267
1484
  }
1268
- el.textContent = sxToCss(sx, `.${cls}`);
1485
+ el.textContent = sxToCss(sx, `.${cls}`, theme);
1269
1486
  return () => {
1270
1487
  document.getElementById(id)?.remove();
1271
1488
  };
1272
- }, [sx, cls]);
1273
- return sx ? cls : "";
1489
+ }, [sx, cls, theme, hasStyles]);
1490
+ return hasStyles ? cls : "";
1274
1491
  }
1275
1492
 
1276
1493
  // lib/Buttons/addButton.tsx
@@ -7554,6 +7771,44 @@ ListSubheader.displayName = "ListSubheader";
7554
7771
 
7555
7772
  // lib/Typography/Typography.tsx
7556
7773
  import React163 from "react";
7774
+
7775
+ // lib/utils/filterSystemProps.ts
7776
+ var NEVER_SYSTEM = /* @__PURE__ */ new Set([
7777
+ "size",
7778
+ "variant",
7779
+ "disabled",
7780
+ "open",
7781
+ "value",
7782
+ "checked",
7783
+ "label",
7784
+ "placeholder",
7785
+ "rows",
7786
+ "error",
7787
+ "required",
7788
+ "fullWidth",
7789
+ "component",
7790
+ "children",
7791
+ "ref",
7792
+ "key",
7793
+ "sx",
7794
+ "className",
7795
+ "style"
7796
+ ]);
7797
+ function filterSystemProps(props) {
7798
+ const system = {};
7799
+ const rest = {};
7800
+ for (const key of Object.keys(props)) {
7801
+ const value = props[key];
7802
+ if (!NEVER_SYSTEM.has(key) && SYSTEM_PROP_NAMES.has(key)) {
7803
+ system[key] = value;
7804
+ } else {
7805
+ rest[key] = value;
7806
+ }
7807
+ }
7808
+ return { system, rest };
7809
+ }
7810
+
7811
+ // lib/Typography/Typography.tsx
7557
7812
  var VARIANT_ELEMENT_MAP = {
7558
7813
  h1: "h1",
7559
7814
  h2: "h2",
@@ -7594,9 +7849,11 @@ var Typography = ({
7594
7849
  children,
7595
7850
  className = "",
7596
7851
  style,
7597
- sx
7852
+ sx,
7853
+ ...rest
7598
7854
  }) => {
7599
- const sxClass = useSx(sx);
7855
+ const { system, rest: domRest } = filterSystemProps(rest);
7856
+ const sxClass = useSx({ ...system, ...sx });
7600
7857
  const Tag = component || (paragraph ? "p" : VARIANT_ELEMENT_MAP[variant] || "span");
7601
7858
  const colorClass = color ? COLOR_CLASSES[color] : "";
7602
7859
  const colorStyle = color && !COLOR_CLASSES[color] ? { color } : {};
@@ -7627,7 +7884,15 @@ var Typography = ({
7627
7884
  ...weightStyle,
7628
7885
  ...style
7629
7886
  };
7630
- return /* @__PURE__ */ React163.createElement(Tag, { className: classes, style: Object.keys(inlineStyle).length > 0 ? inlineStyle : void 0 }, children);
7887
+ return /* @__PURE__ */ React163.createElement(
7888
+ Tag,
7889
+ {
7890
+ className: classes,
7891
+ style: Object.keys(inlineStyle).length > 0 ? inlineStyle : void 0,
7892
+ ...domRest
7893
+ },
7894
+ children
7895
+ );
7631
7896
  };
7632
7897
  Typography.displayName = "Typography";
7633
7898
 
@@ -7682,195 +7947,37 @@ Skeleton.displayName = "Skeleton";
7682
7947
 
7683
7948
  // lib/Box/Box.tsx
7684
7949
  import * as React165 from "react";
7685
- function sp(val) {
7686
- if (val === void 0) return void 0;
7687
- return typeof val === "number" ? `${val * 8}px` : val;
7688
- }
7689
7950
  var Box = React165.forwardRef(
7690
- ({
7691
- component = "div",
7692
- children,
7693
- display,
7694
- flexDirection,
7695
- alignItems,
7696
- justifyContent,
7697
- gap,
7698
- flex,
7699
- flexWrap,
7700
- flexGrow,
7701
- flexShrink,
7702
- overflow,
7703
- position,
7704
- top,
7705
- right,
7706
- bottom,
7707
- left,
7708
- borderRadius,
7709
- bgcolor,
7710
- color,
7711
- width,
7712
- height,
7713
- minWidth,
7714
- maxWidth,
7715
- minHeight,
7716
- maxHeight,
7717
- margin,
7718
- padding,
7719
- m,
7720
- mt,
7721
- mr,
7722
- mb,
7723
- ml,
7724
- mx,
7725
- my,
7726
- p,
7727
- pt,
7728
- pr,
7729
- pb,
7730
- pl,
7731
- px,
7732
- py,
7733
- className,
7734
- style,
7735
- sx,
7736
- ...rest
7737
- }, ref) => {
7738
- const sxClass = useSx(sx);
7739
- const toSize = (val) => val === void 0 ? void 0 : typeof val === "number" ? `${val}px` : val;
7740
- const inlineStyle = {
7741
- ...display !== void 0 ? { display } : {},
7742
- ...flexDirection !== void 0 ? { flexDirection } : {},
7743
- ...alignItems !== void 0 ? { alignItems } : {},
7744
- ...justifyContent !== void 0 ? { justifyContent } : {},
7745
- ...gap !== void 0 ? { gap: typeof gap === "number" ? `${gap}px` : gap } : {},
7746
- ...flex !== void 0 ? { flex } : {},
7747
- ...flexWrap !== void 0 ? { flexWrap } : {},
7748
- ...flexGrow !== void 0 ? { flexGrow } : {},
7749
- ...flexShrink !== void 0 ? { flexShrink } : {},
7750
- ...overflow !== void 0 ? { overflow } : {},
7751
- ...position !== void 0 ? { position } : {},
7752
- ...top !== void 0 ? { top: toSize(top) } : {},
7753
- ...right !== void 0 ? { right: toSize(right) } : {},
7754
- ...bottom !== void 0 ? { bottom: toSize(bottom) } : {},
7755
- ...left !== void 0 ? { left: toSize(left) } : {},
7756
- ...borderRadius !== void 0 ? { borderRadius: toSize(borderRadius) } : {},
7757
- ...bgcolor !== void 0 ? { backgroundColor: bgcolor } : {},
7758
- ...color !== void 0 ? { color } : {},
7759
- // Size
7760
- ...width !== void 0 ? { width: toSize(width) } : {},
7761
- ...height !== void 0 ? { height: toSize(height) } : {},
7762
- ...minWidth !== void 0 ? { minWidth: toSize(minWidth) } : {},
7763
- ...maxWidth !== void 0 ? { maxWidth: toSize(maxWidth) } : {},
7764
- ...minHeight !== void 0 ? { minHeight: toSize(minHeight) } : {},
7765
- ...maxHeight !== void 0 ? { maxHeight: toSize(maxHeight) } : {},
7766
- // Full margin/padding
7767
- ...margin !== void 0 ? { margin: toSize(margin) } : {},
7768
- ...padding !== void 0 ? { padding: toSize(padding) } : {},
7769
- // Margin shorthands (8px scale)
7770
- ...m !== void 0 ? { margin: sp(m) } : {},
7771
- ...my !== void 0 ? { marginTop: sp(my), marginBottom: sp(my) } : {},
7772
- ...mx !== void 0 ? { marginLeft: sp(mx), marginRight: sp(mx) } : {},
7773
- ...mt !== void 0 ? { marginTop: sp(mt) } : {},
7774
- ...mr !== void 0 ? { marginRight: sp(mr) } : {},
7775
- ...mb !== void 0 ? { marginBottom: sp(mb) } : {},
7776
- ...ml !== void 0 ? { marginLeft: sp(ml) } : {},
7777
- // Padding shorthands (8px scale)
7778
- ...p !== void 0 ? { padding: sp(p) } : {},
7779
- ...py !== void 0 ? { paddingTop: sp(py), paddingBottom: sp(py) } : {},
7780
- ...px !== void 0 ? { paddingLeft: sp(px), paddingRight: sp(px) } : {},
7781
- ...pt !== void 0 ? { paddingTop: sp(pt) } : {},
7782
- ...pr !== void 0 ? { paddingRight: sp(pr) } : {},
7783
- ...pb !== void 0 ? { paddingBottom: sp(pb) } : {},
7784
- ...pl !== void 0 ? { paddingLeft: sp(pl) } : {},
7785
- ...style
7786
- };
7951
+ ({ component = "div", children, className, style, sx, ...rest }, ref) => {
7952
+ const { system, rest: domRest } = filterSystemProps(rest);
7953
+ const sxClass = useSx({ ...system, ...sx });
7787
7954
  const classes = ["rf-box", sxClass, className].filter(Boolean).join(" ");
7788
7955
  const Tag = component;
7789
- return /* @__PURE__ */ React165.createElement(Tag, { ref, className: classes, style: inlineStyle, ...rest }, children);
7956
+ return /* @__PURE__ */ React165.createElement(Tag, { ref, className: classes, style, ...domRest }, children);
7790
7957
  }
7791
7958
  );
7792
7959
  Box.displayName = "Box";
7793
7960
 
7794
7961
  // lib/Stack/Stack.tsx
7795
7962
  import * as React166 from "react";
7796
- function sp2(val) {
7797
- if (val === void 0) return void 0;
7798
- return typeof val === "number" ? `${val * 8}px` : val;
7799
- }
7800
7963
  var Stack = React166.forwardRef(
7801
7964
  ({
7802
7965
  direction = "column",
7803
7966
  spacing,
7804
- alignItems,
7805
- justifyContent,
7806
7967
  divider,
7807
- flexWrap,
7808
7968
  useFlexGap = true,
7809
- flex,
7810
- overflow,
7811
7969
  component = "div",
7812
7970
  children,
7813
7971
  className,
7814
7972
  style,
7815
7973
  sx,
7816
- width,
7817
- height,
7818
- minWidth,
7819
- maxWidth,
7820
- minHeight,
7821
- maxHeight,
7822
- m,
7823
- mt,
7824
- mr,
7825
- mb,
7826
- ml,
7827
- mx,
7828
- my,
7829
- p,
7830
- pt,
7831
- pr,
7832
- pb,
7833
- pl,
7834
- px,
7835
- py,
7836
7974
  ...rest
7837
7975
  }, ref) => {
7838
- const sxClass = useSx(sx);
7976
+ const { system, rest: domRest } = filterSystemProps(rest);
7839
7977
  const gapValue = spacing !== void 0 ? typeof spacing === "number" ? `${spacing * 8}px` : spacing : void 0;
7840
- const toSize = (val) => val === void 0 ? void 0 : typeof val === "number" ? `${val}px` : val;
7841
- const inlineStyle = {
7842
- flexDirection: direction,
7843
- ...alignItems !== void 0 ? { alignItems } : {},
7844
- ...justifyContent !== void 0 ? { justifyContent } : {},
7845
- ...flexWrap !== void 0 ? { flexWrap } : {},
7846
- ...gapValue !== void 0 && useFlexGap ? { gap: gapValue } : {},
7847
- ...flex !== void 0 ? { flex } : {},
7848
- ...overflow !== void 0 ? { overflow } : {},
7849
- // Layout
7850
- ...width !== void 0 ? { width: toSize(width) } : {},
7851
- ...height !== void 0 ? { height: toSize(height) } : {},
7852
- ...minWidth !== void 0 ? { minWidth: toSize(minWidth) } : {},
7853
- ...maxWidth !== void 0 ? { maxWidth: toSize(maxWidth) } : {},
7854
- ...minHeight !== void 0 ? { minHeight: toSize(minHeight) } : {},
7855
- ...maxHeight !== void 0 ? { maxHeight: toSize(maxHeight) } : {},
7856
- // Margin shorthands
7857
- ...m !== void 0 ? { margin: sp2(m) } : {},
7858
- ...my !== void 0 ? { marginTop: sp2(my), marginBottom: sp2(my) } : {},
7859
- ...mx !== void 0 ? { marginLeft: sp2(mx), marginRight: sp2(mx) } : {},
7860
- ...mt !== void 0 ? { marginTop: sp2(mt) } : {},
7861
- ...mr !== void 0 ? { marginRight: sp2(mr) } : {},
7862
- ...mb !== void 0 ? { marginBottom: sp2(mb) } : {},
7863
- ...ml !== void 0 ? { marginLeft: sp2(ml) } : {},
7864
- // Padding shorthands
7865
- ...p !== void 0 ? { padding: sp2(p) } : {},
7866
- ...py !== void 0 ? { paddingTop: sp2(py), paddingBottom: sp2(py) } : {},
7867
- ...px !== void 0 ? { paddingLeft: sp2(px), paddingRight: sp2(px) } : {},
7868
- ...pt !== void 0 ? { paddingTop: sp2(pt) } : {},
7869
- ...pr !== void 0 ? { paddingRight: sp2(pr) } : {},
7870
- ...pb !== void 0 ? { paddingBottom: sp2(pb) } : {},
7871
- ...pl !== void 0 ? { paddingLeft: sp2(pl) } : {},
7872
- ...style
7873
- };
7978
+ const baseSx = { flexDirection: direction };
7979
+ if (gapValue !== void 0 && useFlexGap) baseSx.gap = gapValue;
7980
+ const sxClass = useSx({ ...baseSx, ...system, ...sx });
7874
7981
  const classes = ["rf-stack", sxClass, className].filter(Boolean).join(" ");
7875
7982
  let content;
7876
7983
  if (divider) {
@@ -7890,17 +7997,13 @@ var Stack = React166.forwardRef(
7890
7997
  content = children;
7891
7998
  }
7892
7999
  const Tag = component;
7893
- return /* @__PURE__ */ React166.createElement(Tag, { ref, className: classes, style: inlineStyle, ...rest }, content);
8000
+ return /* @__PURE__ */ React166.createElement(Tag, { ref, className: classes, style, ...domRest }, content);
7894
8001
  }
7895
8002
  );
7896
8003
  Stack.displayName = "Stack";
7897
8004
 
7898
8005
  // lib/Grid/Grid.tsx
7899
8006
  import * as React167 from "react";
7900
- function sp3(val) {
7901
- if (val === void 0) return void 0;
7902
- return typeof val === "number" ? `${val * 8}px` : val;
7903
- }
7904
8007
  function getBreakpointClass(bp, val) {
7905
8008
  if (val === void 0) return "";
7906
8009
  if (val === true) return `rf-grid-${bp}-12`;
@@ -7933,29 +8036,9 @@ var Grid = React167.forwardRef(
7933
8036
  className,
7934
8037
  style,
7935
8038
  sx,
7936
- width,
7937
- height,
7938
- minWidth,
7939
- maxWidth,
7940
- minHeight,
7941
- maxHeight,
7942
- m,
7943
- mt,
7944
- mr,
7945
- mb,
7946
- ml,
7947
- mx,
7948
- my,
7949
- p,
7950
- pt,
7951
- pr,
7952
- pb,
7953
- pl,
7954
- px,
7955
- py,
7956
8039
  ...rest
7957
8040
  }, ref) => {
7958
- const sxClass = useSx(sx);
8041
+ const { system, rest: domRest } = filterSystemProps(rest);
7959
8042
  const containerClasses = container ? ["rf-grid-container"] : [];
7960
8043
  const itemClasses = item || !container ? ["rf-grid-item"] : [];
7961
8044
  const bpClasses = [
@@ -7966,39 +8049,14 @@ var Grid = React167.forwardRef(
7966
8049
  getBreakpointClass("xl", xl)
7967
8050
  ].filter(Boolean);
7968
8051
  const gap = getSpacingGap(spacing);
7969
- const toSize = (val) => val === void 0 ? void 0 : typeof val === "number" ? `${val}px` : val;
7970
- const inlineStyle = {
7971
- ...container && gap ? { gap } : {},
7972
- ...container && direction ? { gridAutoFlow: direction.startsWith("column") ? "column" : "row" } : {},
7973
- ...container && alignItems ? { alignItems } : {},
7974
- ...container && justifyContent ? { justifyContent } : {},
7975
- ...container && wrap ? { flexWrap: wrap } : {},
7976
- ...zeroMinWidth ? { minWidth: 0 } : {},
7977
- // Layout
7978
- ...width !== void 0 ? { width: toSize(width) } : {},
7979
- ...height !== void 0 ? { height: toSize(height) } : {},
7980
- ...minWidth !== void 0 ? { minWidth: toSize(minWidth) } : {},
7981
- ...maxWidth !== void 0 ? { maxWidth: toSize(maxWidth) } : {},
7982
- ...minHeight !== void 0 ? { minHeight: toSize(minHeight) } : {},
7983
- ...maxHeight !== void 0 ? { maxHeight: toSize(maxHeight) } : {},
7984
- // Margin shorthands
7985
- ...m !== void 0 ? { margin: sp3(m) } : {},
7986
- ...my !== void 0 ? { marginTop: sp3(my), marginBottom: sp3(my) } : {},
7987
- ...mx !== void 0 ? { marginLeft: sp3(mx), marginRight: sp3(mx) } : {},
7988
- ...mt !== void 0 ? { marginTop: sp3(mt) } : {},
7989
- ...mr !== void 0 ? { marginRight: sp3(mr) } : {},
7990
- ...mb !== void 0 ? { marginBottom: sp3(mb) } : {},
7991
- ...ml !== void 0 ? { marginLeft: sp3(ml) } : {},
7992
- // Padding shorthands
7993
- ...p !== void 0 ? { padding: sp3(p) } : {},
7994
- ...py !== void 0 ? { paddingTop: sp3(py), paddingBottom: sp3(py) } : {},
7995
- ...px !== void 0 ? { paddingLeft: sp3(px), paddingRight: sp3(px) } : {},
7996
- ...pt !== void 0 ? { paddingTop: sp3(pt) } : {},
7997
- ...pr !== void 0 ? { paddingRight: sp3(pr) } : {},
7998
- ...pb !== void 0 ? { paddingBottom: sp3(pb) } : {},
7999
- ...pl !== void 0 ? { paddingLeft: sp3(pl) } : {},
8000
- ...style
8001
- };
8052
+ const baseSx = {};
8053
+ if (container && gap) baseSx.gap = gap;
8054
+ if (container && direction) baseSx.gridAutoFlow = direction.startsWith("column") ? "column" : "row";
8055
+ if (container && alignItems) baseSx.alignItems = alignItems;
8056
+ if (container && justifyContent) baseSx.justifyContent = justifyContent;
8057
+ if (container && wrap) baseSx.flexWrap = wrap;
8058
+ if (zeroMinWidth) baseSx.minWidth = 0;
8059
+ const sxClass = useSx({ ...baseSx, ...system, ...sx });
8002
8060
  const classes = [
8003
8061
  ...containerClasses,
8004
8062
  ...itemClasses,
@@ -8007,7 +8065,7 @@ var Grid = React167.forwardRef(
8007
8065
  className
8008
8066
  ].filter(Boolean).join(" ");
8009
8067
  const Tag = component;
8010
- return /* @__PURE__ */ React167.createElement(Tag, { ref, className: classes, style: inlineStyle, ...rest }, children);
8068
+ return /* @__PURE__ */ React167.createElement(Tag, { ref, className: classes, style, ...domRest }, children);
8011
8069
  }
8012
8070
  );
8013
8071
  Grid.displayName = "Grid";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rufous/ui",
3
3
  "private": false,
4
- "version": "0.3.59",
4
+ "version": "0.3.61",
5
5
  "type": "module",
6
6
  "description": "Experimental: A lightweight React UI component library (Beta)",
7
7
  "style": "./dist/main.css",