@rufous/ui 0.3.60 → 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.cjs CHANGED
@@ -1533,19 +1533,235 @@ var React132 = __toESM(require("react"), 1);
1533
1533
 
1534
1534
  // lib/utils/sx.ts
1535
1535
  var import_react5 = require("react");
1536
+
1537
+ // lib/utils/sxResolver.ts
1538
+ var DEFAULT_SPACING = 8;
1539
+ var DEFAULT_BORDER_RADIUS = 4;
1536
1540
  function camelToKebab(str) {
1537
1541
  return str.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
1538
1542
  }
1539
- function sxToCss(sx, selector) {
1543
+ function warn(msg) {
1544
+ if (typeof process !== "undefined" && process.env && process.env.NODE_ENV !== "production") {
1545
+ console.warn(`[rufous-ui sx] ${msg}`);
1546
+ }
1547
+ }
1548
+ var SPACING_MAP = {
1549
+ m: ["margin"],
1550
+ margin: ["margin"],
1551
+ mt: ["margin-top"],
1552
+ marginTop: ["margin-top"],
1553
+ mb: ["margin-bottom"],
1554
+ marginBottom: ["margin-bottom"],
1555
+ ml: ["margin-left"],
1556
+ marginLeft: ["margin-left"],
1557
+ mr: ["margin-right"],
1558
+ marginRight: ["margin-right"],
1559
+ mx: ["margin-left", "margin-right"],
1560
+ marginX: ["margin-left", "margin-right"],
1561
+ my: ["margin-top", "margin-bottom"],
1562
+ marginY: ["margin-top", "margin-bottom"],
1563
+ marginInline: ["margin-inline"],
1564
+ marginInlineStart: ["margin-inline-start"],
1565
+ marginInlineEnd: ["margin-inline-end"],
1566
+ marginBlock: ["margin-block"],
1567
+ marginBlockStart: ["margin-block-start"],
1568
+ marginBlockEnd: ["margin-block-end"],
1569
+ p: ["padding"],
1570
+ padding: ["padding"],
1571
+ pt: ["padding-top"],
1572
+ paddingTop: ["padding-top"],
1573
+ pb: ["padding-bottom"],
1574
+ paddingBottom: ["padding-bottom"],
1575
+ pl: ["padding-left"],
1576
+ paddingLeft: ["padding-left"],
1577
+ pr: ["padding-right"],
1578
+ paddingRight: ["padding-right"],
1579
+ px: ["padding-left", "padding-right"],
1580
+ paddingX: ["padding-left", "padding-right"],
1581
+ py: ["padding-top", "padding-bottom"],
1582
+ paddingY: ["padding-top", "padding-bottom"],
1583
+ paddingInline: ["padding-inline"],
1584
+ paddingInlineStart: ["padding-inline-start"],
1585
+ paddingInlineEnd: ["padding-inline-end"],
1586
+ paddingBlock: ["padding-block"],
1587
+ paddingBlockStart: ["padding-block-start"],
1588
+ paddingBlockEnd: ["padding-block-end"],
1589
+ gap: ["gap"],
1590
+ rowGap: ["row-gap"],
1591
+ columnGap: ["column-gap"]
1592
+ };
1593
+ var BORDER_WIDTH_MAP = {
1594
+ border: "border",
1595
+ borderTop: "border-top",
1596
+ borderRight: "border-right",
1597
+ borderBottom: "border-bottom",
1598
+ borderLeft: "border-left"
1599
+ };
1600
+ var SIZING_MAP = {
1601
+ width: "width",
1602
+ height: "height",
1603
+ minWidth: "min-width",
1604
+ maxWidth: "max-width",
1605
+ minHeight: "min-height",
1606
+ maxHeight: "max-height"
1607
+ };
1608
+ var PALETTE_MAP = {
1609
+ bgcolor: "background-color",
1610
+ color: "color",
1611
+ borderColor: "border-color"
1612
+ };
1613
+ var POSITION_LENGTH_MAP = {
1614
+ top: "top",
1615
+ right: "right",
1616
+ bottom: "bottom",
1617
+ left: "left"
1618
+ };
1619
+ var PASS_THROUGH_KEYS = [
1620
+ "boxSizing",
1621
+ "overflow",
1622
+ "overflowX",
1623
+ "overflowY",
1624
+ // Flexbox (Group H)
1625
+ "display",
1626
+ "alignContent",
1627
+ "alignItems",
1628
+ "alignSelf",
1629
+ "flex",
1630
+ "flexDirection",
1631
+ "flexGrow",
1632
+ "flexShrink",
1633
+ "flexWrap",
1634
+ "flexBasis",
1635
+ "justifyContent",
1636
+ "justifyItems",
1637
+ "justifySelf",
1638
+ "order",
1639
+ // Grid (Group I)
1640
+ "gridColumn",
1641
+ "gridRow",
1642
+ "gridAutoFlow",
1643
+ "gridAutoColumns",
1644
+ "gridAutoRows",
1645
+ "gridTemplateColumns",
1646
+ "gridTemplateRows",
1647
+ "gridTemplateAreas",
1648
+ "gridArea",
1649
+ // Positioning (Group J)
1650
+ "position",
1651
+ // Typography (Group G)
1652
+ "fontFamily",
1653
+ "fontSize",
1654
+ "fontStyle",
1655
+ "fontWeight",
1656
+ "letterSpacing",
1657
+ "lineHeight",
1658
+ "textAlign",
1659
+ "textTransform"
1660
+ ];
1661
+ var SYSTEM_PROP_NAMES = /* @__PURE__ */ new Set([
1662
+ ...Object.keys(SPACING_MAP),
1663
+ ...Object.keys(BORDER_WIDTH_MAP),
1664
+ "borderRadius",
1665
+ ...Object.keys(SIZING_MAP),
1666
+ ...Object.keys(PALETTE_MAP),
1667
+ ...Object.keys(POSITION_LENGTH_MAP),
1668
+ "boxShadow",
1669
+ "zIndex",
1670
+ "typography",
1671
+ ...PASS_THROUGH_KEYS
1672
+ ]);
1673
+ function resolvePaletteValue(value, theme) {
1674
+ if (typeof value === "string" && value.includes(".")) {
1675
+ if (theme?.palette) {
1676
+ const [group, token] = value.split(".");
1677
+ const resolved = theme.palette?.[group]?.[token];
1678
+ if (typeof resolved === "string") return resolved;
1679
+ warn(`palette token "${value}" not found in theme \u2014 passing through verbatim`);
1680
+ }
1681
+ }
1682
+ return String(value);
1683
+ }
1684
+ function resolveSxProp(key, value, theme) {
1685
+ if (value === void 0 || value === null) return [];
1686
+ if (key in SPACING_MAP) {
1687
+ const spacing = theme?.spacing ?? DEFAULT_SPACING;
1688
+ const out = typeof value === "number" ? `${value * spacing}px` : String(value);
1689
+ return SPACING_MAP[key].map((property) => ({ property, value: out }));
1690
+ }
1691
+ if (key in BORDER_WIDTH_MAP) {
1692
+ const out = typeof value === "number" ? `${value}px solid` : String(value);
1693
+ return [{ property: BORDER_WIDTH_MAP[key], value: out }];
1694
+ }
1695
+ if (key === "borderRadius") {
1696
+ const radius = theme?.shape?.borderRadius ?? DEFAULT_BORDER_RADIUS;
1697
+ const out = typeof value === "number" ? `${value * radius}px` : String(value);
1698
+ return [{ property: "border-radius", value: out }];
1699
+ }
1700
+ if (key in PALETTE_MAP) {
1701
+ return [{ property: PALETTE_MAP[key], value: resolvePaletteValue(value, theme) }];
1702
+ }
1703
+ if (key in SIZING_MAP) {
1704
+ const out = typeof value === "number" ? `${value}px` : String(value);
1705
+ return [{ property: SIZING_MAP[key], value: out }];
1706
+ }
1707
+ if (key in POSITION_LENGTH_MAP) {
1708
+ const out = typeof value === "number" ? `${value}px` : String(value);
1709
+ return [{ property: POSITION_LENGTH_MAP[key], value: out }];
1710
+ }
1711
+ if (key === "boxShadow") {
1712
+ if (typeof value === "number") {
1713
+ const shadow = theme?.shadows?.[value];
1714
+ if (shadow === void 0) {
1715
+ warn(`theme.shadows[${value}] not found \u2014 passing through verbatim`);
1716
+ return [{ property: "box-shadow", value: String(value) }];
1717
+ }
1718
+ return [{ property: "box-shadow", value: shadow }];
1719
+ }
1720
+ return [{ property: "box-shadow", value: String(value) }];
1721
+ }
1722
+ if (key === "zIndex") {
1723
+ if (typeof value === "string") {
1724
+ const z = theme?.zIndex?.[value];
1725
+ if (z === void 0) {
1726
+ warn(`theme.zIndex["${value}"] not found \u2014 passing through verbatim`);
1727
+ return [{ property: "z-index", value }];
1728
+ }
1729
+ return [{ property: "z-index", value: String(z) }];
1730
+ }
1731
+ return [{ property: "z-index", value: String(value) }];
1732
+ }
1733
+ if (key === "typography") {
1734
+ const variant = theme?.typography?.[String(value)];
1735
+ if (!variant) {
1736
+ warn(`theme.typography["${String(value)}"] not found \u2014 skipping`);
1737
+ return [];
1738
+ }
1739
+ const pairs = [
1740
+ ["font-family", variant.fontFamily],
1741
+ ["font-weight", variant.fontWeight],
1742
+ ["font-size", variant.fontSize],
1743
+ ["line-height", variant.lineHeight],
1744
+ ["letter-spacing", variant.letterSpacing],
1745
+ ["text-transform", variant.textTransform]
1746
+ ];
1747
+ return pairs.filter(([, v]) => v !== void 0).map(([property, v]) => ({ property, value: String(v) }));
1748
+ }
1749
+ return [{ property: camelToKebab(key), value: String(value) }];
1750
+ }
1751
+
1752
+ // lib/utils/sx.ts
1753
+ function sxToCss(sx, selector, theme) {
1540
1754
  const props = [];
1541
1755
  const nested = [];
1542
1756
  for (const [key, value] of Object.entries(sx)) {
1543
1757
  if (value === void 0 || value === null) continue;
1544
1758
  if (typeof value === "object") {
1545
1759
  const nestedSel = key.includes("&") ? key.replace(/&/g, selector) : `${selector} ${key}`;
1546
- nested.push(sxToCss(value, nestedSel));
1760
+ nested.push(sxToCss(value, nestedSel, theme));
1547
1761
  } else {
1548
- props.push(` ${camelToKebab(key)}: ${value};`);
1762
+ for (const { property, value: resolved } of resolveSxProp(key, value, theme)) {
1763
+ props.push(` ${property}: ${resolved};`);
1764
+ }
1549
1765
  }
1550
1766
  }
1551
1767
  const blocks = [];
@@ -1556,10 +1772,11 @@ ${props.join("\n")}
1556
1772
  return blocks.join("\n");
1557
1773
  }
1558
1774
  var _sxUid = 0;
1559
- function useSx(sx) {
1775
+ function useSx(sx, theme) {
1560
1776
  const cls = (0, import_react5.useRef)(`rf-sx-${++_sxUid}`).current;
1777
+ const hasStyles = !!sx && Object.keys(sx).length > 0;
1561
1778
  (0, import_react5.useEffect)(() => {
1562
- if (!sx) return;
1779
+ if (!hasStyles) return;
1563
1780
  const id = `style-${cls}`;
1564
1781
  let el = document.getElementById(id);
1565
1782
  if (!el) {
@@ -1567,12 +1784,12 @@ function useSx(sx) {
1567
1784
  el.id = id;
1568
1785
  document.head.appendChild(el);
1569
1786
  }
1570
- el.textContent = sxToCss(sx, `.${cls}`);
1787
+ el.textContent = sxToCss(sx, `.${cls}`, theme);
1571
1788
  return () => {
1572
1789
  document.getElementById(id)?.remove();
1573
1790
  };
1574
- }, [sx, cls]);
1575
- return sx ? cls : "";
1791
+ }, [sx, cls, theme, hasStyles]);
1792
+ return hasStyles ? cls : "";
1576
1793
  }
1577
1794
 
1578
1795
  // lib/Buttons/addButton.tsx
@@ -7813,6 +8030,44 @@ ListSubheader.displayName = "ListSubheader";
7813
8030
 
7814
8031
  // lib/Typography/Typography.tsx
7815
8032
  var import_react28 = __toESM(require("react"), 1);
8033
+
8034
+ // lib/utils/filterSystemProps.ts
8035
+ var NEVER_SYSTEM = /* @__PURE__ */ new Set([
8036
+ "size",
8037
+ "variant",
8038
+ "disabled",
8039
+ "open",
8040
+ "value",
8041
+ "checked",
8042
+ "label",
8043
+ "placeholder",
8044
+ "rows",
8045
+ "error",
8046
+ "required",
8047
+ "fullWidth",
8048
+ "component",
8049
+ "children",
8050
+ "ref",
8051
+ "key",
8052
+ "sx",
8053
+ "className",
8054
+ "style"
8055
+ ]);
8056
+ function filterSystemProps(props) {
8057
+ const system = {};
8058
+ const rest = {};
8059
+ for (const key of Object.keys(props)) {
8060
+ const value = props[key];
8061
+ if (!NEVER_SYSTEM.has(key) && SYSTEM_PROP_NAMES.has(key)) {
8062
+ system[key] = value;
8063
+ } else {
8064
+ rest[key] = value;
8065
+ }
8066
+ }
8067
+ return { system, rest };
8068
+ }
8069
+
8070
+ // lib/Typography/Typography.tsx
7816
8071
  var VARIANT_ELEMENT_MAP = {
7817
8072
  h1: "h1",
7818
8073
  h2: "h2",
@@ -7853,9 +8108,11 @@ var Typography = ({
7853
8108
  children,
7854
8109
  className = "",
7855
8110
  style,
7856
- sx
8111
+ sx,
8112
+ ...rest
7857
8113
  }) => {
7858
- const sxClass = useSx(sx);
8114
+ const { system, rest: domRest } = filterSystemProps(rest);
8115
+ const sxClass = useSx({ ...system, ...sx });
7859
8116
  const Tag = component || (paragraph ? "p" : VARIANT_ELEMENT_MAP[variant] || "span");
7860
8117
  const colorClass = color ? COLOR_CLASSES[color] : "";
7861
8118
  const colorStyle = color && !COLOR_CLASSES[color] ? { color } : {};
@@ -7886,7 +8143,15 @@ var Typography = ({
7886
8143
  ...weightStyle,
7887
8144
  ...style
7888
8145
  };
7889
- return /* @__PURE__ */ import_react28.default.createElement(Tag, { className: classes, style: Object.keys(inlineStyle).length > 0 ? inlineStyle : void 0 }, children);
8146
+ return /* @__PURE__ */ import_react28.default.createElement(
8147
+ Tag,
8148
+ {
8149
+ className: classes,
8150
+ style: Object.keys(inlineStyle).length > 0 ? inlineStyle : void 0,
8151
+ ...domRest
8152
+ },
8153
+ children
8154
+ );
7890
8155
  };
7891
8156
  Typography.displayName = "Typography";
7892
8157
 
@@ -7941,195 +8206,37 @@ Skeleton.displayName = "Skeleton";
7941
8206
 
7942
8207
  // lib/Box/Box.tsx
7943
8208
  var React165 = __toESM(require("react"), 1);
7944
- function sp(val) {
7945
- if (val === void 0) return void 0;
7946
- return typeof val === "number" ? `${val * 8}px` : val;
7947
- }
7948
8209
  var Box = React165.forwardRef(
7949
- ({
7950
- component = "div",
7951
- children,
7952
- display,
7953
- flexDirection,
7954
- alignItems,
7955
- justifyContent,
7956
- gap,
7957
- flex,
7958
- flexWrap,
7959
- flexGrow,
7960
- flexShrink,
7961
- overflow,
7962
- position,
7963
- top,
7964
- right,
7965
- bottom,
7966
- left,
7967
- borderRadius,
7968
- bgcolor,
7969
- color,
7970
- width,
7971
- height,
7972
- minWidth,
7973
- maxWidth,
7974
- minHeight,
7975
- maxHeight,
7976
- margin,
7977
- padding,
7978
- m,
7979
- mt,
7980
- mr,
7981
- mb,
7982
- ml,
7983
- mx,
7984
- my,
7985
- p,
7986
- pt,
7987
- pr,
7988
- pb,
7989
- pl,
7990
- px,
7991
- py,
7992
- className,
7993
- style,
7994
- sx,
7995
- ...rest
7996
- }, ref) => {
7997
- const sxClass = useSx(sx);
7998
- const toSize = (val) => val === void 0 ? void 0 : typeof val === "number" ? `${val}px` : val;
7999
- const inlineStyle = {
8000
- ...display !== void 0 ? { display } : {},
8001
- ...flexDirection !== void 0 ? { flexDirection } : {},
8002
- ...alignItems !== void 0 ? { alignItems } : {},
8003
- ...justifyContent !== void 0 ? { justifyContent } : {},
8004
- ...gap !== void 0 ? { gap: typeof gap === "number" ? `${gap}px` : gap } : {},
8005
- ...flex !== void 0 ? { flex } : {},
8006
- ...flexWrap !== void 0 ? { flexWrap } : {},
8007
- ...flexGrow !== void 0 ? { flexGrow } : {},
8008
- ...flexShrink !== void 0 ? { flexShrink } : {},
8009
- ...overflow !== void 0 ? { overflow } : {},
8010
- ...position !== void 0 ? { position } : {},
8011
- ...top !== void 0 ? { top: toSize(top) } : {},
8012
- ...right !== void 0 ? { right: toSize(right) } : {},
8013
- ...bottom !== void 0 ? { bottom: toSize(bottom) } : {},
8014
- ...left !== void 0 ? { left: toSize(left) } : {},
8015
- ...borderRadius !== void 0 ? { borderRadius: toSize(borderRadius) } : {},
8016
- ...bgcolor !== void 0 ? { backgroundColor: bgcolor } : {},
8017
- ...color !== void 0 ? { color } : {},
8018
- // Size
8019
- ...width !== void 0 ? { width: toSize(width) } : {},
8020
- ...height !== void 0 ? { height: toSize(height) } : {},
8021
- ...minWidth !== void 0 ? { minWidth: toSize(minWidth) } : {},
8022
- ...maxWidth !== void 0 ? { maxWidth: toSize(maxWidth) } : {},
8023
- ...minHeight !== void 0 ? { minHeight: toSize(minHeight) } : {},
8024
- ...maxHeight !== void 0 ? { maxHeight: toSize(maxHeight) } : {},
8025
- // Full margin/padding
8026
- ...margin !== void 0 ? { margin: toSize(margin) } : {},
8027
- ...padding !== void 0 ? { padding: toSize(padding) } : {},
8028
- // Margin shorthands (8px scale)
8029
- ...m !== void 0 ? { margin: sp(m) } : {},
8030
- ...my !== void 0 ? { marginTop: sp(my), marginBottom: sp(my) } : {},
8031
- ...mx !== void 0 ? { marginLeft: sp(mx), marginRight: sp(mx) } : {},
8032
- ...mt !== void 0 ? { marginTop: sp(mt) } : {},
8033
- ...mr !== void 0 ? { marginRight: sp(mr) } : {},
8034
- ...mb !== void 0 ? { marginBottom: sp(mb) } : {},
8035
- ...ml !== void 0 ? { marginLeft: sp(ml) } : {},
8036
- // Padding shorthands (8px scale)
8037
- ...p !== void 0 ? { padding: sp(p) } : {},
8038
- ...py !== void 0 ? { paddingTop: sp(py), paddingBottom: sp(py) } : {},
8039
- ...px !== void 0 ? { paddingLeft: sp(px), paddingRight: sp(px) } : {},
8040
- ...pt !== void 0 ? { paddingTop: sp(pt) } : {},
8041
- ...pr !== void 0 ? { paddingRight: sp(pr) } : {},
8042
- ...pb !== void 0 ? { paddingBottom: sp(pb) } : {},
8043
- ...pl !== void 0 ? { paddingLeft: sp(pl) } : {},
8044
- ...style
8045
- };
8210
+ ({ component = "div", children, className, style, sx, ...rest }, ref) => {
8211
+ const { system, rest: domRest } = filterSystemProps(rest);
8212
+ const sxClass = useSx({ ...system, ...sx });
8046
8213
  const classes = ["rf-box", sxClass, className].filter(Boolean).join(" ");
8047
8214
  const Tag = component;
8048
- return /* @__PURE__ */ React165.createElement(Tag, { ref, className: classes, style: inlineStyle, ...rest }, children);
8215
+ return /* @__PURE__ */ React165.createElement(Tag, { ref, className: classes, style, ...domRest }, children);
8049
8216
  }
8050
8217
  );
8051
8218
  Box.displayName = "Box";
8052
8219
 
8053
8220
  // lib/Stack/Stack.tsx
8054
8221
  var React166 = __toESM(require("react"), 1);
8055
- function sp2(val) {
8056
- if (val === void 0) return void 0;
8057
- return typeof val === "number" ? `${val * 8}px` : val;
8058
- }
8059
8222
  var Stack = React166.forwardRef(
8060
8223
  ({
8061
8224
  direction = "column",
8062
8225
  spacing,
8063
- alignItems,
8064
- justifyContent,
8065
8226
  divider,
8066
- flexWrap,
8067
8227
  useFlexGap = true,
8068
- flex,
8069
- overflow,
8070
8228
  component = "div",
8071
8229
  children,
8072
8230
  className,
8073
8231
  style,
8074
8232
  sx,
8075
- width,
8076
- height,
8077
- minWidth,
8078
- maxWidth,
8079
- minHeight,
8080
- maxHeight,
8081
- m,
8082
- mt,
8083
- mr,
8084
- mb,
8085
- ml,
8086
- mx,
8087
- my,
8088
- p,
8089
- pt,
8090
- pr,
8091
- pb,
8092
- pl,
8093
- px,
8094
- py,
8095
8233
  ...rest
8096
8234
  }, ref) => {
8097
- const sxClass = useSx(sx);
8235
+ const { system, rest: domRest } = filterSystemProps(rest);
8098
8236
  const gapValue = spacing !== void 0 ? typeof spacing === "number" ? `${spacing * 8}px` : spacing : void 0;
8099
- const toSize = (val) => val === void 0 ? void 0 : typeof val === "number" ? `${val}px` : val;
8100
- const inlineStyle = {
8101
- flexDirection: direction,
8102
- ...alignItems !== void 0 ? { alignItems } : {},
8103
- ...justifyContent !== void 0 ? { justifyContent } : {},
8104
- ...flexWrap !== void 0 ? { flexWrap } : {},
8105
- ...gapValue !== void 0 && useFlexGap ? { gap: gapValue } : {},
8106
- ...flex !== void 0 ? { flex } : {},
8107
- ...overflow !== void 0 ? { overflow } : {},
8108
- // Layout
8109
- ...width !== void 0 ? { width: toSize(width) } : {},
8110
- ...height !== void 0 ? { height: toSize(height) } : {},
8111
- ...minWidth !== void 0 ? { minWidth: toSize(minWidth) } : {},
8112
- ...maxWidth !== void 0 ? { maxWidth: toSize(maxWidth) } : {},
8113
- ...minHeight !== void 0 ? { minHeight: toSize(minHeight) } : {},
8114
- ...maxHeight !== void 0 ? { maxHeight: toSize(maxHeight) } : {},
8115
- // Margin shorthands
8116
- ...m !== void 0 ? { margin: sp2(m) } : {},
8117
- ...my !== void 0 ? { marginTop: sp2(my), marginBottom: sp2(my) } : {},
8118
- ...mx !== void 0 ? { marginLeft: sp2(mx), marginRight: sp2(mx) } : {},
8119
- ...mt !== void 0 ? { marginTop: sp2(mt) } : {},
8120
- ...mr !== void 0 ? { marginRight: sp2(mr) } : {},
8121
- ...mb !== void 0 ? { marginBottom: sp2(mb) } : {},
8122
- ...ml !== void 0 ? { marginLeft: sp2(ml) } : {},
8123
- // Padding shorthands
8124
- ...p !== void 0 ? { padding: sp2(p) } : {},
8125
- ...py !== void 0 ? { paddingTop: sp2(py), paddingBottom: sp2(py) } : {},
8126
- ...px !== void 0 ? { paddingLeft: sp2(px), paddingRight: sp2(px) } : {},
8127
- ...pt !== void 0 ? { paddingTop: sp2(pt) } : {},
8128
- ...pr !== void 0 ? { paddingRight: sp2(pr) } : {},
8129
- ...pb !== void 0 ? { paddingBottom: sp2(pb) } : {},
8130
- ...pl !== void 0 ? { paddingLeft: sp2(pl) } : {},
8131
- ...style
8132
- };
8237
+ const baseSx = { flexDirection: direction };
8238
+ if (gapValue !== void 0 && useFlexGap) baseSx.gap = gapValue;
8239
+ const sxClass = useSx({ ...baseSx, ...system, ...sx });
8133
8240
  const classes = ["rf-stack", sxClass, className].filter(Boolean).join(" ");
8134
8241
  let content;
8135
8242
  if (divider) {
@@ -8149,17 +8256,13 @@ var Stack = React166.forwardRef(
8149
8256
  content = children;
8150
8257
  }
8151
8258
  const Tag = component;
8152
- return /* @__PURE__ */ React166.createElement(Tag, { ref, className: classes, style: inlineStyle, ...rest }, content);
8259
+ return /* @__PURE__ */ React166.createElement(Tag, { ref, className: classes, style, ...domRest }, content);
8153
8260
  }
8154
8261
  );
8155
8262
  Stack.displayName = "Stack";
8156
8263
 
8157
8264
  // lib/Grid/Grid.tsx
8158
8265
  var React167 = __toESM(require("react"), 1);
8159
- function sp3(val) {
8160
- if (val === void 0) return void 0;
8161
- return typeof val === "number" ? `${val * 8}px` : val;
8162
- }
8163
8266
  function getBreakpointClass(bp, val) {
8164
8267
  if (val === void 0) return "";
8165
8268
  if (val === true) return `rf-grid-${bp}-12`;
@@ -8192,29 +8295,9 @@ var Grid = React167.forwardRef(
8192
8295
  className,
8193
8296
  style,
8194
8297
  sx,
8195
- width,
8196
- height,
8197
- minWidth,
8198
- maxWidth,
8199
- minHeight,
8200
- maxHeight,
8201
- m,
8202
- mt,
8203
- mr,
8204
- mb,
8205
- ml,
8206
- mx,
8207
- my,
8208
- p,
8209
- pt,
8210
- pr,
8211
- pb,
8212
- pl,
8213
- px,
8214
- py,
8215
8298
  ...rest
8216
8299
  }, ref) => {
8217
- const sxClass = useSx(sx);
8300
+ const { system, rest: domRest } = filterSystemProps(rest);
8218
8301
  const containerClasses = container ? ["rf-grid-container"] : [];
8219
8302
  const itemClasses = item || !container ? ["rf-grid-item"] : [];
8220
8303
  const bpClasses = [
@@ -8225,39 +8308,14 @@ var Grid = React167.forwardRef(
8225
8308
  getBreakpointClass("xl", xl)
8226
8309
  ].filter(Boolean);
8227
8310
  const gap = getSpacingGap(spacing);
8228
- const toSize = (val) => val === void 0 ? void 0 : typeof val === "number" ? `${val}px` : val;
8229
- const inlineStyle = {
8230
- ...container && gap ? { gap } : {},
8231
- ...container && direction ? { gridAutoFlow: direction.startsWith("column") ? "column" : "row" } : {},
8232
- ...container && alignItems ? { alignItems } : {},
8233
- ...container && justifyContent ? { justifyContent } : {},
8234
- ...container && wrap ? { flexWrap: wrap } : {},
8235
- ...zeroMinWidth ? { minWidth: 0 } : {},
8236
- // Layout
8237
- ...width !== void 0 ? { width: toSize(width) } : {},
8238
- ...height !== void 0 ? { height: toSize(height) } : {},
8239
- ...minWidth !== void 0 ? { minWidth: toSize(minWidth) } : {},
8240
- ...maxWidth !== void 0 ? { maxWidth: toSize(maxWidth) } : {},
8241
- ...minHeight !== void 0 ? { minHeight: toSize(minHeight) } : {},
8242
- ...maxHeight !== void 0 ? { maxHeight: toSize(maxHeight) } : {},
8243
- // Margin shorthands
8244
- ...m !== void 0 ? { margin: sp3(m) } : {},
8245
- ...my !== void 0 ? { marginTop: sp3(my), marginBottom: sp3(my) } : {},
8246
- ...mx !== void 0 ? { marginLeft: sp3(mx), marginRight: sp3(mx) } : {},
8247
- ...mt !== void 0 ? { marginTop: sp3(mt) } : {},
8248
- ...mr !== void 0 ? { marginRight: sp3(mr) } : {},
8249
- ...mb !== void 0 ? { marginBottom: sp3(mb) } : {},
8250
- ...ml !== void 0 ? { marginLeft: sp3(ml) } : {},
8251
- // Padding shorthands
8252
- ...p !== void 0 ? { padding: sp3(p) } : {},
8253
- ...py !== void 0 ? { paddingTop: sp3(py), paddingBottom: sp3(py) } : {},
8254
- ...px !== void 0 ? { paddingLeft: sp3(px), paddingRight: sp3(px) } : {},
8255
- ...pt !== void 0 ? { paddingTop: sp3(pt) } : {},
8256
- ...pr !== void 0 ? { paddingRight: sp3(pr) } : {},
8257
- ...pb !== void 0 ? { paddingBottom: sp3(pb) } : {},
8258
- ...pl !== void 0 ? { paddingLeft: sp3(pl) } : {},
8259
- ...style
8260
- };
8311
+ const baseSx = {};
8312
+ if (container && gap) baseSx.gap = gap;
8313
+ if (container && direction) baseSx.gridAutoFlow = direction.startsWith("column") ? "column" : "row";
8314
+ if (container && alignItems) baseSx.alignItems = alignItems;
8315
+ if (container && justifyContent) baseSx.justifyContent = justifyContent;
8316
+ if (container && wrap) baseSx.flexWrap = wrap;
8317
+ if (zeroMinWidth) baseSx.minWidth = 0;
8318
+ const sxClass = useSx({ ...baseSx, ...system, ...sx });
8261
8319
  const classes = [
8262
8320
  ...containerClasses,
8263
8321
  ...itemClasses,
@@ -8266,7 +8324,7 @@ var Grid = React167.forwardRef(
8266
8324
  className
8267
8325
  ].filter(Boolean).join(" ");
8268
8326
  const Tag = component;
8269
- return /* @__PURE__ */ React167.createElement(Tag, { ref, className: classes, style: inlineStyle, ...rest }, children);
8327
+ return /* @__PURE__ */ React167.createElement(Tag, { ref, className: classes, style, ...domRest }, children);
8270
8328
  }
8271
8329
  );
8272
8330
  Grid.displayName = "Grid";