@rufous/ui 0.3.60 → 0.3.62

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
@@ -2207,6 +2424,7 @@ var BaseDialog = ({
2207
2424
  showCloseButton = true,
2208
2425
  buttonAlign = "flex-end",
2209
2426
  showCancelButton = true,
2427
+ showConfirmButton = true,
2210
2428
  formatTitle = true,
2211
2429
  fullWidth = false,
2212
2430
  className,
@@ -2283,7 +2501,7 @@ var BaseDialog = ({
2283
2501
  type: "button"
2284
2502
  },
2285
2503
  cancelText
2286
- ), form ? /* @__PURE__ */ React140.createElement(
2504
+ ), showConfirmButton && (form ? /* @__PURE__ */ React140.createElement(
2287
2505
  "button",
2288
2506
  {
2289
2507
  className: "btn-confirm",
@@ -2315,7 +2533,7 @@ var BaseDialog = ({
2315
2533
  },
2316
2534
  /* @__PURE__ */ React140.createElement("span", { style: { visibility: isButtonLoading ? "hidden" : "visible" } }, confirmText),
2317
2535
  isButtonLoading && /* @__PURE__ */ React140.createElement("span", { style: { position: "absolute", inset: 0, display: "flex", alignItems: "center", justifyContent: "center" } }, /* @__PURE__ */ React140.createElement(circularProgress_default, { size: 18, color: "#ffffff80" }))
2318
- ));
2536
+ )));
2319
2537
  const containerClass = ["dialog-container", size ? `size-${size}` : "", sxClass, className].filter(Boolean).join(" ");
2320
2538
  const containerStyle = { minWidth, minHeight };
2321
2539
  const dialogInner = /* @__PURE__ */ React140.createElement(React140.Fragment, null, !hideHeader && /* @__PURE__ */ React140.createElement(React140.Fragment, null, customHeader ?? /* @__PURE__ */ React140.createElement("div", { className: "dialog-title" }, /* @__PURE__ */ React140.createElement("h2", null, formatTitle ? title?.charAt(0).toUpperCase() + title?.slice(1) : title), showCloseButton && /* @__PURE__ */ React140.createElement("button", { className: "btn-close", type: "button", onClick: onClose }, /* @__PURE__ */ React140.createElement(
@@ -4496,29 +4714,46 @@ var DateField = ({
4496
4714
  if (!rect) return {};
4497
4715
  const PICKER_H = 420;
4498
4716
  const GAP2 = 6;
4499
- const spaceBelow = window.innerHeight - rect.bottom - GAP2;
4717
+ const MARGIN = 8;
4718
+ const vw = window.innerWidth;
4719
+ const vh = window.innerHeight;
4720
+ const naturalW = isSideVariant ? 470 : 320;
4721
+ const avail = vw - MARGIN * 2;
4722
+ const scale = naturalW > avail ? avail / naturalW : 1;
4723
+ const scaledW = naturalW * scale;
4724
+ let left = rect.left;
4725
+ const maxLeft = vw - scaledW - MARGIN;
4726
+ if (left > maxLeft) left = maxLeft;
4727
+ if (left < MARGIN) left = MARGIN;
4728
+ const spaceBelow = vh - rect.bottom - GAP2;
4500
4729
  const spaceAbove = rect.top - GAP2;
4501
- const useDropUp = spaceBelow < PICKER_H && spaceAbove > spaceBelow;
4730
+ const useDropUp = spaceBelow < PICKER_H * scale && spaceAbove > spaceBelow;
4731
+ const common = {
4732
+ position: "fixed",
4733
+ left,
4734
+ width: naturalW,
4735
+ transform: scale === 1 ? void 0 : `scale(${scale})`,
4736
+ overflowY: "auto",
4737
+ zIndex: 99999
4738
+ };
4502
4739
  if (useDropUp) {
4503
4740
  return {
4504
- position: "fixed",
4505
- left: rect.left,
4741
+ ...common,
4506
4742
  // bottom anchors picker's bottom edge exactly to field top — no gap regardless of actual height
4507
- bottom: window.innerHeight - rect.top + GAP2,
4508
- // prevent going above viewport
4509
- maxHeight: rect.top - GAP2 - 4,
4510
- overflowY: "auto",
4511
- zIndex: 99999,
4512
- animationName: "rf-date-picker-appear-up",
4743
+ bottom: vh - rect.top + GAP2,
4744
+ // unscaled max-height — visual height after scaling fits the gap above
4745
+ maxHeight: (rect.top - GAP2 - MARGIN) / scale,
4746
+ // skip the scale-animating keyframes when we apply a static scale (they'd flash full-size)
4747
+ animationName: scale === 1 ? "rf-date-picker-appear-up" : "none",
4513
4748
  transformOrigin: "bottom left"
4514
4749
  };
4515
4750
  }
4516
4751
  return {
4517
- position: "fixed",
4518
- left: rect.left,
4752
+ ...common,
4519
4753
  top: rect.bottom + GAP2,
4520
- zIndex: 99999,
4521
- animationName: "rf-date-picker-appear",
4754
+ // unscaled max-height — visual height after scaling fits below the field
4755
+ maxHeight: (vh - rect.bottom - GAP2 - MARGIN) / scale,
4756
+ animationName: scale === 1 ? "rf-date-picker-appear" : "none",
4522
4757
  transformOrigin: "top left"
4523
4758
  };
4524
4759
  })(),
@@ -4894,6 +5129,43 @@ var DateRangeField = ({
4894
5129
  const [leftViewMonth, setLeftViewMonth] = (0, import_react16.useState)(() => today2.getMonth());
4895
5130
  const containerRef = (0, import_react16.useRef)(null);
4896
5131
  const inputId = (0, import_react16.useRef)(`rf-dr-${Math.random().toString(36).substr(2, 9)}`).current;
5132
+ const [mobileStyle, setMobileStyle] = (0, import_react16.useState)({});
5133
+ (0, import_react16.useEffect)(() => {
5134
+ if (!open) {
5135
+ setMobileStyle({});
5136
+ return;
5137
+ }
5138
+ const compute = () => {
5139
+ const vw = window.innerWidth;
5140
+ const vh = window.innerHeight;
5141
+ const MARGIN = 8;
5142
+ const GAP2 = 6;
5143
+ const naturalW = pickerType === "panel" ? 520 : 640;
5144
+ const avail = vw - MARGIN * 2;
5145
+ if (naturalW <= avail) {
5146
+ setMobileStyle({});
5147
+ return;
5148
+ }
5149
+ const scale = avail / naturalW;
5150
+ const rect = containerRef.current?.getBoundingClientRect();
5151
+ const top = rect ? rect.bottom + GAP2 : 60;
5152
+ setMobileStyle({
5153
+ position: "fixed",
5154
+ top,
5155
+ left: "50%",
5156
+ transform: `translateX(-50%) scale(${scale})`,
5157
+ transformOrigin: "top center",
5158
+ width: naturalW,
5159
+ maxHeight: (vh - top - MARGIN) / scale,
5160
+ overflowY: "auto",
5161
+ animation: "none",
5162
+ zIndex: 99999
5163
+ });
5164
+ };
5165
+ compute();
5166
+ window.addEventListener("resize", compute);
5167
+ return () => window.removeEventListener("resize", compute);
5168
+ }, [open, pickerType]);
4897
5169
  (0, import_react16.useEffect)(() => {
4898
5170
  const s2 = value?.start ? isoToDate2(value.start) : null;
4899
5171
  const e = value?.end ? isoToDate2(value.end) : null;
@@ -5091,7 +5363,7 @@ var DateRangeField = ({
5091
5363
  variant === "outlined" && /* @__PURE__ */ import_react16.default.createElement("fieldset", { className: "rf-text-field__notch" }, label ? /* @__PURE__ */ import_react16.default.createElement("legend", { className: "rf-text-field__legend" }, /* @__PURE__ */ import_react16.default.createElement("span", null, label, required ? " *" : "")) : /* @__PURE__ */ import_react16.default.createElement("legend", { className: "rf-text-field__legend--empty" }))
5092
5364
  ), open && !disabled && (pickerType === "panel" ? (
5093
5365
  /* ── Panel Mode ── */
5094
- /* @__PURE__ */ import_react16.default.createElement("div", { className: "rf-dr-picker rf-dr-picker--panel", onMouseDown: (e) => e.preventDefault() }, /* @__PURE__ */ import_react16.default.createElement("div", { className: "rf-dr-picker__presets" }, PRESETS.map((p, i) => /* @__PURE__ */ import_react16.default.createElement(import_react16.default.Fragment, { key: p.id }, i > 0 && /* @__PURE__ */ import_react16.default.createElement("div", { className: "rf-dr-picker__preset-sep" }), /* @__PURE__ */ import_react16.default.createElement(
5366
+ /* @__PURE__ */ import_react16.default.createElement("div", { className: "rf-dr-picker rf-dr-picker--panel", style: mobileStyle, onMouseDown: (e) => e.preventDefault() }, /* @__PURE__ */ import_react16.default.createElement("div", { className: "rf-dr-picker__presets" }, PRESETS.map((p, i) => /* @__PURE__ */ import_react16.default.createElement(import_react16.default.Fragment, { key: p.id }, i > 0 && /* @__PURE__ */ import_react16.default.createElement("div", { className: "rf-dr-picker__preset-sep" }), /* @__PURE__ */ import_react16.default.createElement(
5095
5367
  "button",
5096
5368
  {
5097
5369
  type: "button",
@@ -5211,7 +5483,7 @@ var DateRangeField = ({
5211
5483
  ))), /* @__PURE__ */ import_react16.default.createElement("div", { style: { flex: 1 } }), /* @__PURE__ */ import_react16.default.createElement("div", { className: "rf-dr-picker__footer" }, /* @__PURE__ */ import_react16.default.createElement("button", { type: "button", className: "rf-dr-picker__close-btn", onClick: handleClose }, "CLOSE"), /* @__PURE__ */ import_react16.default.createElement("button", { type: "button", className: "rf-dr-picker__apply-btn", onClick: handleApply }, "APPLY"))))
5212
5484
  ) : (
5213
5485
  /* ── Calendar Mode ── */
5214
- /* @__PURE__ */ import_react16.default.createElement("div", { className: "rf-dr-picker rf-dr-picker--calendar", onMouseDown: (e) => e.preventDefault() }, /* @__PURE__ */ import_react16.default.createElement("div", { className: "rf-dr-picker__calendars" }, /* @__PURE__ */ import_react16.default.createElement(
5486
+ /* @__PURE__ */ import_react16.default.createElement("div", { className: "rf-dr-picker rf-dr-picker--calendar", style: mobileStyle, onMouseDown: (e) => e.preventDefault() }, /* @__PURE__ */ import_react16.default.createElement("div", { className: "rf-dr-picker__calendars" }, /* @__PURE__ */ import_react16.default.createElement(
5215
5487
  RangeCalendarBody,
5216
5488
  {
5217
5489
  viewYear: leftViewYear,
@@ -5614,6 +5886,7 @@ function DataGrid({
5614
5886
  const menuRef = (0, import_react17.useRef)(null);
5615
5887
  const [showManageColumns, setShowManageColumns] = (0, import_react17.useState)(false);
5616
5888
  const [showAdvancedFilter, setShowAdvancedFilter] = (0, import_react17.useState)(false);
5889
+ const [mobileToolbarExpanded, setMobileToolbarExpanded] = (0, import_react17.useState)(false);
5617
5890
  const [focusFilterIdx, setFocusFilterIdx] = (0, import_react17.useState)(-1);
5618
5891
  const filterableColumnsProp = initialColumnsProp.filter((c) => c.filterable !== false);
5619
5892
  const initialFilterCol = String(filterableColumnsProp[0]?.field || filterableColumnsProp[0]?.key || "");
@@ -6103,14 +6376,24 @@ function DataGrid({
6103
6376
  onClick: () => setShowAdvancedFilter(true)
6104
6377
  },
6105
6378
  /* @__PURE__ */ import_react17.default.createElement(Funnel, { size: 16 })
6106
- )), showColumnsBtn && /* @__PURE__ */ import_react17.default.createElement(Tooltip, { title: "Manage Columns", placement: "top" }, /* @__PURE__ */ import_react17.default.createElement(
6379
+ )), /* @__PURE__ */ import_react17.default.createElement("div", { className: `dg-actions-overflow${mobileToolbarExpanded ? " dg-actions-overflow--expanded" : ""}` }, showColumnsBtn && /* @__PURE__ */ import_react17.default.createElement(Tooltip, { title: "Manage Columns", placement: "top" }, /* @__PURE__ */ import_react17.default.createElement(
6107
6380
  "button",
6108
6381
  {
6109
6382
  className: "dg-icon-btn",
6110
6383
  onClick: () => setShowManageColumns(true)
6111
6384
  },
6112
6385
  /* @__PURE__ */ import_react17.default.createElement(Columns2, { size: 16 })
6113
- )), showExportBtn && /* @__PURE__ */ import_react17.default.createElement("button", { className: "dg-action-btn", onClick: handleExport, disabled: loading }, /* @__PURE__ */ import_react17.default.createElement(Download, { size: 14 }), " Export CSV"), slotAt("after-actions"));
6386
+ )), showExportBtn && /* @__PURE__ */ import_react17.default.createElement("button", { className: "dg-action-btn", onClick: handleExport, disabled: loading }, /* @__PURE__ */ import_react17.default.createElement(Download, { size: 14 }), " Export CSV"), slotAt("after-actions")), (showColumnsBtn || showExportBtn || slots.some((s2) => s2.position === "after-actions" || !s2.position)) && /* @__PURE__ */ import_react17.default.createElement(
6387
+ "button",
6388
+ {
6389
+ type: "button",
6390
+ className: `dg-toolbar-toggle${mobileToolbarExpanded ? " dg-toolbar-toggle--expanded" : ""}`,
6391
+ onClick: () => setMobileToolbarExpanded((v) => !v),
6392
+ "aria-label": mobileToolbarExpanded ? "Hide toolbar options" : "Show all toolbar options",
6393
+ "aria-expanded": mobileToolbarExpanded
6394
+ },
6395
+ /* @__PURE__ */ import_react17.default.createElement(ChevronDown, { size: 18 })
6396
+ ));
6114
6397
  })())), !tOpts.hideHeader && /* @__PURE__ */ import_react17.default.createElement("div", { className: `dg-toolbar ${alignClass(toolbarContent?.align)}` }, toolbarContent?.content || ""), isGroupingActive && /* @__PURE__ */ import_react17.default.createElement("div", { className: "dg-grouping-bar" }, /* @__PURE__ */ import_react17.default.createElement("span", { className: "dg-grouping-bar-label" }, "Grouped by"), activeGroupingModel.map((gField) => {
6115
6398
  const col = resolvedColumns.find((c) => String(c.field) === gField || String(c.key) === gField);
6116
6399
  return /* @__PURE__ */ import_react17.default.createElement("div", { key: gField, className: "dg-group-chip" }, /* @__PURE__ */ import_react17.default.createElement(Layers, { size: 11 }), /* @__PURE__ */ import_react17.default.createElement("span", null, col?.header ?? col?.headerName ?? gField), !disableRowGrouping && /* @__PURE__ */ import_react17.default.createElement(
@@ -7813,6 +8096,44 @@ ListSubheader.displayName = "ListSubheader";
7813
8096
 
7814
8097
  // lib/Typography/Typography.tsx
7815
8098
  var import_react28 = __toESM(require("react"), 1);
8099
+
8100
+ // lib/utils/filterSystemProps.ts
8101
+ var NEVER_SYSTEM = /* @__PURE__ */ new Set([
8102
+ "size",
8103
+ "variant",
8104
+ "disabled",
8105
+ "open",
8106
+ "value",
8107
+ "checked",
8108
+ "label",
8109
+ "placeholder",
8110
+ "rows",
8111
+ "error",
8112
+ "required",
8113
+ "fullWidth",
8114
+ "component",
8115
+ "children",
8116
+ "ref",
8117
+ "key",
8118
+ "sx",
8119
+ "className",
8120
+ "style"
8121
+ ]);
8122
+ function filterSystemProps(props) {
8123
+ const system = {};
8124
+ const rest = {};
8125
+ for (const key of Object.keys(props)) {
8126
+ const value = props[key];
8127
+ if (!NEVER_SYSTEM.has(key) && SYSTEM_PROP_NAMES.has(key)) {
8128
+ system[key] = value;
8129
+ } else {
8130
+ rest[key] = value;
8131
+ }
8132
+ }
8133
+ return { system, rest };
8134
+ }
8135
+
8136
+ // lib/Typography/Typography.tsx
7816
8137
  var VARIANT_ELEMENT_MAP = {
7817
8138
  h1: "h1",
7818
8139
  h2: "h2",
@@ -7853,9 +8174,11 @@ var Typography = ({
7853
8174
  children,
7854
8175
  className = "",
7855
8176
  style,
7856
- sx
8177
+ sx,
8178
+ ...rest
7857
8179
  }) => {
7858
- const sxClass = useSx(sx);
8180
+ const { system, rest: domRest } = filterSystemProps(rest);
8181
+ const sxClass = useSx({ ...system, ...sx });
7859
8182
  const Tag = component || (paragraph ? "p" : VARIANT_ELEMENT_MAP[variant] || "span");
7860
8183
  const colorClass = color ? COLOR_CLASSES[color] : "";
7861
8184
  const colorStyle = color && !COLOR_CLASSES[color] ? { color } : {};
@@ -7886,7 +8209,15 @@ var Typography = ({
7886
8209
  ...weightStyle,
7887
8210
  ...style
7888
8211
  };
7889
- return /* @__PURE__ */ import_react28.default.createElement(Tag, { className: classes, style: Object.keys(inlineStyle).length > 0 ? inlineStyle : void 0 }, children);
8212
+ return /* @__PURE__ */ import_react28.default.createElement(
8213
+ Tag,
8214
+ {
8215
+ className: classes,
8216
+ style: Object.keys(inlineStyle).length > 0 ? inlineStyle : void 0,
8217
+ ...domRest
8218
+ },
8219
+ children
8220
+ );
7890
8221
  };
7891
8222
  Typography.displayName = "Typography";
7892
8223
 
@@ -7941,195 +8272,37 @@ Skeleton.displayName = "Skeleton";
7941
8272
 
7942
8273
  // lib/Box/Box.tsx
7943
8274
  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
8275
  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
- };
8276
+ ({ component = "div", children, className, style, sx, ...rest }, ref) => {
8277
+ const { system, rest: domRest } = filterSystemProps(rest);
8278
+ const sxClass = useSx({ ...system, ...sx });
8046
8279
  const classes = ["rf-box", sxClass, className].filter(Boolean).join(" ");
8047
8280
  const Tag = component;
8048
- return /* @__PURE__ */ React165.createElement(Tag, { ref, className: classes, style: inlineStyle, ...rest }, children);
8281
+ return /* @__PURE__ */ React165.createElement(Tag, { ref, className: classes, style, ...domRest }, children);
8049
8282
  }
8050
8283
  );
8051
8284
  Box.displayName = "Box";
8052
8285
 
8053
8286
  // lib/Stack/Stack.tsx
8054
8287
  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
8288
  var Stack = React166.forwardRef(
8060
8289
  ({
8061
8290
  direction = "column",
8062
8291
  spacing,
8063
- alignItems,
8064
- justifyContent,
8065
8292
  divider,
8066
- flexWrap,
8067
8293
  useFlexGap = true,
8068
- flex,
8069
- overflow,
8070
8294
  component = "div",
8071
8295
  children,
8072
8296
  className,
8073
8297
  style,
8074
8298
  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
8299
  ...rest
8096
8300
  }, ref) => {
8097
- const sxClass = useSx(sx);
8301
+ const { system, rest: domRest } = filterSystemProps(rest);
8098
8302
  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
- };
8303
+ const baseSx = { flexDirection: direction };
8304
+ if (gapValue !== void 0 && useFlexGap) baseSx.gap = gapValue;
8305
+ const sxClass = useSx({ ...baseSx, ...system, ...sx });
8133
8306
  const classes = ["rf-stack", sxClass, className].filter(Boolean).join(" ");
8134
8307
  let content;
8135
8308
  if (divider) {
@@ -8149,17 +8322,13 @@ var Stack = React166.forwardRef(
8149
8322
  content = children;
8150
8323
  }
8151
8324
  const Tag = component;
8152
- return /* @__PURE__ */ React166.createElement(Tag, { ref, className: classes, style: inlineStyle, ...rest }, content);
8325
+ return /* @__PURE__ */ React166.createElement(Tag, { ref, className: classes, style, ...domRest }, content);
8153
8326
  }
8154
8327
  );
8155
8328
  Stack.displayName = "Stack";
8156
8329
 
8157
8330
  // lib/Grid/Grid.tsx
8158
8331
  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
8332
  function getBreakpointClass(bp, val) {
8164
8333
  if (val === void 0) return "";
8165
8334
  if (val === true) return `rf-grid-${bp}-12`;
@@ -8192,29 +8361,9 @@ var Grid = React167.forwardRef(
8192
8361
  className,
8193
8362
  style,
8194
8363
  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
8364
  ...rest
8216
8365
  }, ref) => {
8217
- const sxClass = useSx(sx);
8366
+ const { system, rest: domRest } = filterSystemProps(rest);
8218
8367
  const containerClasses = container ? ["rf-grid-container"] : [];
8219
8368
  const itemClasses = item || !container ? ["rf-grid-item"] : [];
8220
8369
  const bpClasses = [
@@ -8225,39 +8374,14 @@ var Grid = React167.forwardRef(
8225
8374
  getBreakpointClass("xl", xl)
8226
8375
  ].filter(Boolean);
8227
8376
  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
- };
8377
+ const baseSx = {};
8378
+ if (container && gap) baseSx.gap = gap;
8379
+ if (container && direction) baseSx.gridAutoFlow = direction.startsWith("column") ? "column" : "row";
8380
+ if (container && alignItems) baseSx.alignItems = alignItems;
8381
+ if (container && justifyContent) baseSx.justifyContent = justifyContent;
8382
+ if (container && wrap) baseSx.flexWrap = wrap;
8383
+ if (zeroMinWidth) baseSx.minWidth = 0;
8384
+ const sxClass = useSx({ ...baseSx, ...system, ...sx });
8261
8385
  const classes = [
8262
8386
  ...containerClasses,
8263
8387
  ...itemClasses,
@@ -8266,7 +8390,7 @@ var Grid = React167.forwardRef(
8266
8390
  className
8267
8391
  ].filter(Boolean).join(" ");
8268
8392
  const Tag = component;
8269
- return /* @__PURE__ */ React167.createElement(Tag, { ref, className: classes, style: inlineStyle, ...rest }, children);
8393
+ return /* @__PURE__ */ React167.createElement(Tag, { ref, className: classes, style, ...domRest }, children);
8270
8394
  }
8271
8395
  );
8272
8396
  Grid.displayName = "Grid";