@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.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
@@ -1905,6 +2122,7 @@ var BaseDialog = ({
1905
2122
  showCloseButton = true,
1906
2123
  buttonAlign = "flex-end",
1907
2124
  showCancelButton = true,
2125
+ showConfirmButton = true,
1908
2126
  formatTitle = true,
1909
2127
  fullWidth = false,
1910
2128
  className,
@@ -1981,7 +2199,7 @@ var BaseDialog = ({
1981
2199
  type: "button"
1982
2200
  },
1983
2201
  cancelText
1984
- ), form ? /* @__PURE__ */ React140.createElement(
2202
+ ), showConfirmButton && (form ? /* @__PURE__ */ React140.createElement(
1985
2203
  "button",
1986
2204
  {
1987
2205
  className: "btn-confirm",
@@ -2013,7 +2231,7 @@ var BaseDialog = ({
2013
2231
  },
2014
2232
  /* @__PURE__ */ React140.createElement("span", { style: { visibility: isButtonLoading ? "hidden" : "visible" } }, confirmText),
2015
2233
  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" }))
2016
- ));
2234
+ )));
2017
2235
  const containerClass = ["dialog-container", size ? `size-${size}` : "", sxClass, className].filter(Boolean).join(" ");
2018
2236
  const containerStyle = { minWidth, minHeight };
2019
2237
  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(
@@ -4217,29 +4435,46 @@ var DateField = ({
4217
4435
  if (!rect) return {};
4218
4436
  const PICKER_H = 420;
4219
4437
  const GAP2 = 6;
4220
- const spaceBelow = window.innerHeight - rect.bottom - GAP2;
4438
+ const MARGIN = 8;
4439
+ const vw = window.innerWidth;
4440
+ const vh = window.innerHeight;
4441
+ const naturalW = isSideVariant ? 470 : 320;
4442
+ const avail = vw - MARGIN * 2;
4443
+ const scale = naturalW > avail ? avail / naturalW : 1;
4444
+ const scaledW = naturalW * scale;
4445
+ let left = rect.left;
4446
+ const maxLeft = vw - scaledW - MARGIN;
4447
+ if (left > maxLeft) left = maxLeft;
4448
+ if (left < MARGIN) left = MARGIN;
4449
+ const spaceBelow = vh - rect.bottom - GAP2;
4221
4450
  const spaceAbove = rect.top - GAP2;
4222
- const useDropUp = spaceBelow < PICKER_H && spaceAbove > spaceBelow;
4451
+ const useDropUp = spaceBelow < PICKER_H * scale && spaceAbove > spaceBelow;
4452
+ const common = {
4453
+ position: "fixed",
4454
+ left,
4455
+ width: naturalW,
4456
+ transform: scale === 1 ? void 0 : `scale(${scale})`,
4457
+ overflowY: "auto",
4458
+ zIndex: 99999
4459
+ };
4223
4460
  if (useDropUp) {
4224
4461
  return {
4225
- position: "fixed",
4226
- left: rect.left,
4462
+ ...common,
4227
4463
  // bottom anchors picker's bottom edge exactly to field top — no gap regardless of actual height
4228
- bottom: window.innerHeight - rect.top + GAP2,
4229
- // prevent going above viewport
4230
- maxHeight: rect.top - GAP2 - 4,
4231
- overflowY: "auto",
4232
- zIndex: 99999,
4233
- animationName: "rf-date-picker-appear-up",
4464
+ bottom: vh - rect.top + GAP2,
4465
+ // unscaled max-height — visual height after scaling fits the gap above
4466
+ maxHeight: (rect.top - GAP2 - MARGIN) / scale,
4467
+ // skip the scale-animating keyframes when we apply a static scale (they'd flash full-size)
4468
+ animationName: scale === 1 ? "rf-date-picker-appear-up" : "none",
4234
4469
  transformOrigin: "bottom left"
4235
4470
  };
4236
4471
  }
4237
4472
  return {
4238
- position: "fixed",
4239
- left: rect.left,
4473
+ ...common,
4240
4474
  top: rect.bottom + GAP2,
4241
- zIndex: 99999,
4242
- animationName: "rf-date-picker-appear",
4475
+ // unscaled max-height — visual height after scaling fits below the field
4476
+ maxHeight: (vh - rect.bottom - GAP2 - MARGIN) / scale,
4477
+ animationName: scale === 1 ? "rf-date-picker-appear" : "none",
4243
4478
  transformOrigin: "top left"
4244
4479
  };
4245
4480
  })(),
@@ -4619,6 +4854,43 @@ var DateRangeField = ({
4619
4854
  const [leftViewMonth, setLeftViewMonth] = useState9(() => today2.getMonth());
4620
4855
  const containerRef = useRef8(null);
4621
4856
  const inputId = useRef8(`rf-dr-${Math.random().toString(36).substr(2, 9)}`).current;
4857
+ const [mobileStyle, setMobileStyle] = useState9({});
4858
+ useEffect8(() => {
4859
+ if (!open) {
4860
+ setMobileStyle({});
4861
+ return;
4862
+ }
4863
+ const compute = () => {
4864
+ const vw = window.innerWidth;
4865
+ const vh = window.innerHeight;
4866
+ const MARGIN = 8;
4867
+ const GAP2 = 6;
4868
+ const naturalW = pickerType === "panel" ? 520 : 640;
4869
+ const avail = vw - MARGIN * 2;
4870
+ if (naturalW <= avail) {
4871
+ setMobileStyle({});
4872
+ return;
4873
+ }
4874
+ const scale = avail / naturalW;
4875
+ const rect = containerRef.current?.getBoundingClientRect();
4876
+ const top = rect ? rect.bottom + GAP2 : 60;
4877
+ setMobileStyle({
4878
+ position: "fixed",
4879
+ top,
4880
+ left: "50%",
4881
+ transform: `translateX(-50%) scale(${scale})`,
4882
+ transformOrigin: "top center",
4883
+ width: naturalW,
4884
+ maxHeight: (vh - top - MARGIN) / scale,
4885
+ overflowY: "auto",
4886
+ animation: "none",
4887
+ zIndex: 99999
4888
+ });
4889
+ };
4890
+ compute();
4891
+ window.addEventListener("resize", compute);
4892
+ return () => window.removeEventListener("resize", compute);
4893
+ }, [open, pickerType]);
4622
4894
  useEffect8(() => {
4623
4895
  const s2 = value?.start ? isoToDate2(value.start) : null;
4624
4896
  const e = value?.end ? isoToDate2(value.end) : null;
@@ -4816,7 +5088,7 @@ var DateRangeField = ({
4816
5088
  variant === "outlined" && /* @__PURE__ */ React148.createElement("fieldset", { className: "rf-text-field__notch" }, label ? /* @__PURE__ */ React148.createElement("legend", { className: "rf-text-field__legend" }, /* @__PURE__ */ React148.createElement("span", null, label, required ? " *" : "")) : /* @__PURE__ */ React148.createElement("legend", { className: "rf-text-field__legend--empty" }))
4817
5089
  ), open && !disabled && (pickerType === "panel" ? (
4818
5090
  /* ── Panel Mode ── */
4819
- /* @__PURE__ */ React148.createElement("div", { className: "rf-dr-picker rf-dr-picker--panel", onMouseDown: (e) => e.preventDefault() }, /* @__PURE__ */ React148.createElement("div", { className: "rf-dr-picker__presets" }, PRESETS.map((p, i) => /* @__PURE__ */ React148.createElement(React148.Fragment, { key: p.id }, i > 0 && /* @__PURE__ */ React148.createElement("div", { className: "rf-dr-picker__preset-sep" }), /* @__PURE__ */ React148.createElement(
5091
+ /* @__PURE__ */ React148.createElement("div", { className: "rf-dr-picker rf-dr-picker--panel", style: mobileStyle, onMouseDown: (e) => e.preventDefault() }, /* @__PURE__ */ React148.createElement("div", { className: "rf-dr-picker__presets" }, PRESETS.map((p, i) => /* @__PURE__ */ React148.createElement(React148.Fragment, { key: p.id }, i > 0 && /* @__PURE__ */ React148.createElement("div", { className: "rf-dr-picker__preset-sep" }), /* @__PURE__ */ React148.createElement(
4820
5092
  "button",
4821
5093
  {
4822
5094
  type: "button",
@@ -4936,7 +5208,7 @@ var DateRangeField = ({
4936
5208
  ))), /* @__PURE__ */ React148.createElement("div", { style: { flex: 1 } }), /* @__PURE__ */ React148.createElement("div", { className: "rf-dr-picker__footer" }, /* @__PURE__ */ React148.createElement("button", { type: "button", className: "rf-dr-picker__close-btn", onClick: handleClose }, "CLOSE"), /* @__PURE__ */ React148.createElement("button", { type: "button", className: "rf-dr-picker__apply-btn", onClick: handleApply }, "APPLY"))))
4937
5209
  ) : (
4938
5210
  /* ── Calendar Mode ── */
4939
- /* @__PURE__ */ React148.createElement("div", { className: "rf-dr-picker rf-dr-picker--calendar", onMouseDown: (e) => e.preventDefault() }, /* @__PURE__ */ React148.createElement("div", { className: "rf-dr-picker__calendars" }, /* @__PURE__ */ React148.createElement(
5211
+ /* @__PURE__ */ React148.createElement("div", { className: "rf-dr-picker rf-dr-picker--calendar", style: mobileStyle, onMouseDown: (e) => e.preventDefault() }, /* @__PURE__ */ React148.createElement("div", { className: "rf-dr-picker__calendars" }, /* @__PURE__ */ React148.createElement(
4940
5212
  RangeCalendarBody,
4941
5213
  {
4942
5214
  viewYear: leftViewYear,
@@ -5339,6 +5611,7 @@ function DataGrid({
5339
5611
  const menuRef = useRef10(null);
5340
5612
  const [showManageColumns, setShowManageColumns] = useState10(false);
5341
5613
  const [showAdvancedFilter, setShowAdvancedFilter] = useState10(false);
5614
+ const [mobileToolbarExpanded, setMobileToolbarExpanded] = useState10(false);
5342
5615
  const [focusFilterIdx, setFocusFilterIdx] = useState10(-1);
5343
5616
  const filterableColumnsProp = initialColumnsProp.filter((c) => c.filterable !== false);
5344
5617
  const initialFilterCol = String(filterableColumnsProp[0]?.field || filterableColumnsProp[0]?.key || "");
@@ -5828,14 +6101,24 @@ function DataGrid({
5828
6101
  onClick: () => setShowAdvancedFilter(true)
5829
6102
  },
5830
6103
  /* @__PURE__ */ React151.createElement(Funnel, { size: 16 })
5831
- )), showColumnsBtn && /* @__PURE__ */ React151.createElement(Tooltip, { title: "Manage Columns", placement: "top" }, /* @__PURE__ */ React151.createElement(
6104
+ )), /* @__PURE__ */ React151.createElement("div", { className: `dg-actions-overflow${mobileToolbarExpanded ? " dg-actions-overflow--expanded" : ""}` }, showColumnsBtn && /* @__PURE__ */ React151.createElement(Tooltip, { title: "Manage Columns", placement: "top" }, /* @__PURE__ */ React151.createElement(
5832
6105
  "button",
5833
6106
  {
5834
6107
  className: "dg-icon-btn",
5835
6108
  onClick: () => setShowManageColumns(true)
5836
6109
  },
5837
6110
  /* @__PURE__ */ React151.createElement(Columns2, { size: 16 })
5838
- )), showExportBtn && /* @__PURE__ */ React151.createElement("button", { className: "dg-action-btn", onClick: handleExport, disabled: loading }, /* @__PURE__ */ React151.createElement(Download, { size: 14 }), " Export CSV"), slotAt("after-actions"));
6111
+ )), showExportBtn && /* @__PURE__ */ React151.createElement("button", { className: "dg-action-btn", onClick: handleExport, disabled: loading }, /* @__PURE__ */ React151.createElement(Download, { size: 14 }), " Export CSV"), slotAt("after-actions")), (showColumnsBtn || showExportBtn || slots.some((s2) => s2.position === "after-actions" || !s2.position)) && /* @__PURE__ */ React151.createElement(
6112
+ "button",
6113
+ {
6114
+ type: "button",
6115
+ className: `dg-toolbar-toggle${mobileToolbarExpanded ? " dg-toolbar-toggle--expanded" : ""}`,
6116
+ onClick: () => setMobileToolbarExpanded((v) => !v),
6117
+ "aria-label": mobileToolbarExpanded ? "Hide toolbar options" : "Show all toolbar options",
6118
+ "aria-expanded": mobileToolbarExpanded
6119
+ },
6120
+ /* @__PURE__ */ React151.createElement(ChevronDown, { size: 18 })
6121
+ ));
5839
6122
  })())), !tOpts.hideHeader && /* @__PURE__ */ React151.createElement("div", { className: `dg-toolbar ${alignClass(toolbarContent?.align)}` }, toolbarContent?.content || ""), isGroupingActive && /* @__PURE__ */ React151.createElement("div", { className: "dg-grouping-bar" }, /* @__PURE__ */ React151.createElement("span", { className: "dg-grouping-bar-label" }, "Grouped by"), activeGroupingModel.map((gField) => {
5840
6123
  const col = resolvedColumns.find((c) => String(c.field) === gField || String(c.key) === gField);
5841
6124
  return /* @__PURE__ */ React151.createElement("div", { key: gField, className: "dg-group-chip" }, /* @__PURE__ */ React151.createElement(Layers, { size: 11 }), /* @__PURE__ */ React151.createElement("span", null, col?.header ?? col?.headerName ?? gField), !disableRowGrouping && /* @__PURE__ */ React151.createElement(
@@ -7554,6 +7837,44 @@ ListSubheader.displayName = "ListSubheader";
7554
7837
 
7555
7838
  // lib/Typography/Typography.tsx
7556
7839
  import React163 from "react";
7840
+
7841
+ // lib/utils/filterSystemProps.ts
7842
+ var NEVER_SYSTEM = /* @__PURE__ */ new Set([
7843
+ "size",
7844
+ "variant",
7845
+ "disabled",
7846
+ "open",
7847
+ "value",
7848
+ "checked",
7849
+ "label",
7850
+ "placeholder",
7851
+ "rows",
7852
+ "error",
7853
+ "required",
7854
+ "fullWidth",
7855
+ "component",
7856
+ "children",
7857
+ "ref",
7858
+ "key",
7859
+ "sx",
7860
+ "className",
7861
+ "style"
7862
+ ]);
7863
+ function filterSystemProps(props) {
7864
+ const system = {};
7865
+ const rest = {};
7866
+ for (const key of Object.keys(props)) {
7867
+ const value = props[key];
7868
+ if (!NEVER_SYSTEM.has(key) && SYSTEM_PROP_NAMES.has(key)) {
7869
+ system[key] = value;
7870
+ } else {
7871
+ rest[key] = value;
7872
+ }
7873
+ }
7874
+ return { system, rest };
7875
+ }
7876
+
7877
+ // lib/Typography/Typography.tsx
7557
7878
  var VARIANT_ELEMENT_MAP = {
7558
7879
  h1: "h1",
7559
7880
  h2: "h2",
@@ -7594,9 +7915,11 @@ var Typography = ({
7594
7915
  children,
7595
7916
  className = "",
7596
7917
  style,
7597
- sx
7918
+ sx,
7919
+ ...rest
7598
7920
  }) => {
7599
- const sxClass = useSx(sx);
7921
+ const { system, rest: domRest } = filterSystemProps(rest);
7922
+ const sxClass = useSx({ ...system, ...sx });
7600
7923
  const Tag = component || (paragraph ? "p" : VARIANT_ELEMENT_MAP[variant] || "span");
7601
7924
  const colorClass = color ? COLOR_CLASSES[color] : "";
7602
7925
  const colorStyle = color && !COLOR_CLASSES[color] ? { color } : {};
@@ -7627,7 +7950,15 @@ var Typography = ({
7627
7950
  ...weightStyle,
7628
7951
  ...style
7629
7952
  };
7630
- return /* @__PURE__ */ React163.createElement(Tag, { className: classes, style: Object.keys(inlineStyle).length > 0 ? inlineStyle : void 0 }, children);
7953
+ return /* @__PURE__ */ React163.createElement(
7954
+ Tag,
7955
+ {
7956
+ className: classes,
7957
+ style: Object.keys(inlineStyle).length > 0 ? inlineStyle : void 0,
7958
+ ...domRest
7959
+ },
7960
+ children
7961
+ );
7631
7962
  };
7632
7963
  Typography.displayName = "Typography";
7633
7964
 
@@ -7682,195 +8013,37 @@ Skeleton.displayName = "Skeleton";
7682
8013
 
7683
8014
  // lib/Box/Box.tsx
7684
8015
  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
8016
  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
- };
8017
+ ({ component = "div", children, className, style, sx, ...rest }, ref) => {
8018
+ const { system, rest: domRest } = filterSystemProps(rest);
8019
+ const sxClass = useSx({ ...system, ...sx });
7787
8020
  const classes = ["rf-box", sxClass, className].filter(Boolean).join(" ");
7788
8021
  const Tag = component;
7789
- return /* @__PURE__ */ React165.createElement(Tag, { ref, className: classes, style: inlineStyle, ...rest }, children);
8022
+ return /* @__PURE__ */ React165.createElement(Tag, { ref, className: classes, style, ...domRest }, children);
7790
8023
  }
7791
8024
  );
7792
8025
  Box.displayName = "Box";
7793
8026
 
7794
8027
  // lib/Stack/Stack.tsx
7795
8028
  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
8029
  var Stack = React166.forwardRef(
7801
8030
  ({
7802
8031
  direction = "column",
7803
8032
  spacing,
7804
- alignItems,
7805
- justifyContent,
7806
8033
  divider,
7807
- flexWrap,
7808
8034
  useFlexGap = true,
7809
- flex,
7810
- overflow,
7811
8035
  component = "div",
7812
8036
  children,
7813
8037
  className,
7814
8038
  style,
7815
8039
  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
8040
  ...rest
7837
8041
  }, ref) => {
7838
- const sxClass = useSx(sx);
8042
+ const { system, rest: domRest } = filterSystemProps(rest);
7839
8043
  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
- };
8044
+ const baseSx = { flexDirection: direction };
8045
+ if (gapValue !== void 0 && useFlexGap) baseSx.gap = gapValue;
8046
+ const sxClass = useSx({ ...baseSx, ...system, ...sx });
7874
8047
  const classes = ["rf-stack", sxClass, className].filter(Boolean).join(" ");
7875
8048
  let content;
7876
8049
  if (divider) {
@@ -7890,17 +8063,13 @@ var Stack = React166.forwardRef(
7890
8063
  content = children;
7891
8064
  }
7892
8065
  const Tag = component;
7893
- return /* @__PURE__ */ React166.createElement(Tag, { ref, className: classes, style: inlineStyle, ...rest }, content);
8066
+ return /* @__PURE__ */ React166.createElement(Tag, { ref, className: classes, style, ...domRest }, content);
7894
8067
  }
7895
8068
  );
7896
8069
  Stack.displayName = "Stack";
7897
8070
 
7898
8071
  // lib/Grid/Grid.tsx
7899
8072
  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
8073
  function getBreakpointClass(bp, val) {
7905
8074
  if (val === void 0) return "";
7906
8075
  if (val === true) return `rf-grid-${bp}-12`;
@@ -7933,29 +8102,9 @@ var Grid = React167.forwardRef(
7933
8102
  className,
7934
8103
  style,
7935
8104
  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
8105
  ...rest
7957
8106
  }, ref) => {
7958
- const sxClass = useSx(sx);
8107
+ const { system, rest: domRest } = filterSystemProps(rest);
7959
8108
  const containerClasses = container ? ["rf-grid-container"] : [];
7960
8109
  const itemClasses = item || !container ? ["rf-grid-item"] : [];
7961
8110
  const bpClasses = [
@@ -7966,39 +8115,14 @@ var Grid = React167.forwardRef(
7966
8115
  getBreakpointClass("xl", xl)
7967
8116
  ].filter(Boolean);
7968
8117
  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
- };
8118
+ const baseSx = {};
8119
+ if (container && gap) baseSx.gap = gap;
8120
+ if (container && direction) baseSx.gridAutoFlow = direction.startsWith("column") ? "column" : "row";
8121
+ if (container && alignItems) baseSx.alignItems = alignItems;
8122
+ if (container && justifyContent) baseSx.justifyContent = justifyContent;
8123
+ if (container && wrap) baseSx.flexWrap = wrap;
8124
+ if (zeroMinWidth) baseSx.minWidth = 0;
8125
+ const sxClass = useSx({ ...baseSx, ...system, ...sx });
8002
8126
  const classes = [
8003
8127
  ...containerClasses,
8004
8128
  ...itemClasses,
@@ -8007,7 +8131,7 @@ var Grid = React167.forwardRef(
8007
8131
  className
8008
8132
  ].filter(Boolean).join(" ");
8009
8133
  const Tag = component;
8010
- return /* @__PURE__ */ React167.createElement(Tag, { ref, className: classes, style: inlineStyle, ...rest }, children);
8134
+ return /* @__PURE__ */ React167.createElement(Tag, { ref, className: classes, style, ...domRest }, children);
8011
8135
  }
8012
8136
  );
8013
8137
  Grid.displayName = "Grid";