@almadar/ui 2.6.0 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,14 @@
1
1
  import { useTheme, useUISlots } from './chunk-DKQN5FVU.js';
2
2
  import { useTranslate, useInfiniteScroll, useQuerySingleton, useLongPress, useSwipeGesture, useDragReorder, usePullToRefresh } from './chunk-WGJIL4YR.js';
3
3
  import { useEventBus } from './chunk-YXZM3WCF.js';
4
- import { cn, debugGroup, debug, debugGroupEnd, getNestedValue, isDebugEnabled } from './chunk-KKCVDUK7.js';
4
+ import { cn, debugGroup, debug, debugGroupEnd, getNestedValue, isDebugEnabled } from './chunk-RPYMP7ZC.js';
5
5
  import { isPortalSlot } from './chunk-K2D5D3WK.js';
6
6
  import { __publicField } from './chunk-PKBMQBKP.js';
7
7
  import * as LucideIcons from 'lucide-react';
8
8
  import { Loader2, ChevronDown, X, ArrowRight, TrendingDown, TrendingUp, Check, Copy, AlertCircle, User, Sun, Moon, FileQuestion, Inbox, Search, Info, XCircle, CheckCircle, AlertTriangle, ChevronRight, Filter, Plus, ChevronLeft, HelpCircle, ChevronUp, Minus, Star, FileWarning, Upload, MoreHorizontal, ArrowLeft, Calendar, Tag, Clock, CheckCircle2, DollarSign, FileText, Package } from 'lucide-react';
9
9
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
10
- import * as React68 from 'react';
11
- import React68__default, { useCallback, useState, useRef, useLayoutEffect, useEffect, lazy, createContext, useMemo, useId, useContext, Suspense } from 'react';
10
+ import * as React69 from 'react';
11
+ import React69__default, { useCallback, useState, useRef, useLayoutEffect, useEffect, lazy, createContext, useMemo, useId, useContext, Suspense } from 'react';
12
12
  import { evaluate, createMinimalContext } from '@almadar/evaluator';
13
13
  import { createPortal } from 'react-dom';
14
14
  import ReactMarkdown from 'react-markdown';
@@ -157,7 +157,7 @@ var iconSizeStyles = {
157
157
  md: "h-4 w-4",
158
158
  lg: "h-5 w-5"
159
159
  };
160
- var Button = React68__default.forwardRef(
160
+ var Button = React69__default.forwardRef(
161
161
  ({
162
162
  className,
163
163
  variant = "primary",
@@ -215,7 +215,7 @@ var Button = React68__default.forwardRef(
215
215
  }
216
216
  );
217
217
  Button.displayName = "Button";
218
- var Input = React68__default.forwardRef(
218
+ var Input = React69__default.forwardRef(
219
219
  ({
220
220
  className,
221
221
  inputType,
@@ -327,7 +327,7 @@ var Input = React68__default.forwardRef(
327
327
  }
328
328
  );
329
329
  Input.displayName = "Input";
330
- var Label = React68__default.forwardRef(
330
+ var Label = React69__default.forwardRef(
331
331
  ({ className, required, children, ...props }, ref) => {
332
332
  return /* @__PURE__ */ jsxs(
333
333
  "label",
@@ -347,7 +347,7 @@ var Label = React68__default.forwardRef(
347
347
  }
348
348
  );
349
349
  Label.displayName = "Label";
350
- var Textarea = React68__default.forwardRef(
350
+ var Textarea = React69__default.forwardRef(
351
351
  ({ className, error, ...props }, ref) => {
352
352
  return /* @__PURE__ */ jsx(
353
353
  "textarea",
@@ -370,7 +370,7 @@ var Textarea = React68__default.forwardRef(
370
370
  }
371
371
  );
372
372
  Textarea.displayName = "Textarea";
373
- var Select = React68__default.forwardRef(
373
+ var Select = React69__default.forwardRef(
374
374
  ({ className, options, placeholder, error, ...props }, ref) => {
375
375
  return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
376
376
  /* @__PURE__ */ jsxs(
@@ -406,7 +406,7 @@ var Select = React68__default.forwardRef(
406
406
  }
407
407
  );
408
408
  Select.displayName = "Select";
409
- var Checkbox = React68__default.forwardRef(
409
+ var Checkbox = React69__default.forwardRef(
410
410
  ({ className, label, id, ...props }, ref) => {
411
411
  const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
412
412
  return /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
@@ -472,7 +472,7 @@ var shadowStyles = {
472
472
  md: "shadow-[var(--shadow-main)]",
473
473
  lg: "shadow-[var(--shadow-lg)]"
474
474
  };
475
- var Card = React68__default.forwardRef(
475
+ var Card = React69__default.forwardRef(
476
476
  ({
477
477
  className,
478
478
  variant = "bordered",
@@ -508,9 +508,9 @@ var Card = React68__default.forwardRef(
508
508
  }
509
509
  );
510
510
  Card.displayName = "Card";
511
- var CardHeader = React68__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
511
+ var CardHeader = React69__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
512
512
  CardHeader.displayName = "CardHeader";
513
- var CardTitle = React68__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
513
+ var CardTitle = React69__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
514
514
  "h3",
515
515
  {
516
516
  ref,
@@ -523,11 +523,11 @@ var CardTitle = React68__default.forwardRef(({ className, ...props }, ref) => /*
523
523
  }
524
524
  ));
525
525
  CardTitle.displayName = "CardTitle";
526
- var CardContent = React68__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
526
+ var CardContent = React69__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
527
527
  CardContent.displayName = "CardContent";
528
528
  var CardBody = CardContent;
529
529
  CardBody.displayName = "CardBody";
530
- var CardFooter = React68__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
530
+ var CardFooter = React69__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
531
531
  "div",
532
532
  {
533
533
  ref,
@@ -573,8 +573,8 @@ var sizeStyles2 = {
573
573
  md: "px-2.5 py-1 text-sm",
574
574
  lg: "px-3 py-1.5 text-base"
575
575
  };
576
- var Badge = React68__default.forwardRef(
577
- ({ className, variant = "default", size = "sm", label, icon, children, ...props }, ref) => {
576
+ var Badge = React69__default.forwardRef(
577
+ ({ className, variant = "default", size = "sm", amount, label, icon, children, ...props }, ref) => {
578
578
  const iconSizes2 = { sm: "w-3 h-3", md: "w-3.5 h-3.5", lg: "w-4 h-4" };
579
579
  const resolvedIcon = typeof icon === "string" ? (() => {
580
580
  const I = resolveIcon(icon);
@@ -593,7 +593,7 @@ var Badge = React68__default.forwardRef(
593
593
  ...props,
594
594
  children: [
595
595
  resolvedIcon,
596
- children || label
596
+ children || (amount != null ? `${label ? `${label} ` : ""}${amount}` : label)
597
597
  ]
598
598
  }
599
599
  );
@@ -606,7 +606,7 @@ var sizeStyles3 = {
606
606
  md: "h-6 w-6",
607
607
  lg: "h-8 w-8"
608
608
  };
609
- var Spinner = React68__default.forwardRef(
609
+ var Spinner = React69__default.forwardRef(
610
610
  ({ className, size = "md", ...props }, ref) => {
611
611
  return /* @__PURE__ */ jsx(
612
612
  "div",
@@ -871,7 +871,7 @@ var positionStyles = {
871
871
  fixed: "fixed",
872
872
  sticky: "sticky"
873
873
  };
874
- var Box = React68__default.forwardRef(
874
+ var Box = React69__default.forwardRef(
875
875
  ({
876
876
  padding,
877
877
  paddingX,
@@ -1216,7 +1216,7 @@ var ProgressBar = ({
1216
1216
  return null;
1217
1217
  };
1218
1218
  ProgressBar.displayName = "ProgressBar";
1219
- var Radio = React68__default.forwardRef(
1219
+ var Radio = React69__default.forwardRef(
1220
1220
  ({
1221
1221
  label,
1222
1222
  helperText,
@@ -1320,7 +1320,7 @@ var Radio = React68__default.forwardRef(
1320
1320
  }
1321
1321
  );
1322
1322
  Radio.displayName = "Radio";
1323
- var Switch = React68.forwardRef(
1323
+ var Switch = React69.forwardRef(
1324
1324
  ({
1325
1325
  checked,
1326
1326
  defaultChecked = false,
@@ -1331,10 +1331,10 @@ var Switch = React68.forwardRef(
1331
1331
  name,
1332
1332
  className
1333
1333
  }, ref) => {
1334
- const [isChecked, setIsChecked] = React68.useState(
1334
+ const [isChecked, setIsChecked] = React69.useState(
1335
1335
  checked !== void 0 ? checked : defaultChecked
1336
1336
  );
1337
- React68.useEffect(() => {
1337
+ React69.useEffect(() => {
1338
1338
  if (checked !== void 0) {
1339
1339
  setIsChecked(checked);
1340
1340
  }
@@ -2007,8 +2007,8 @@ var LawReferenceTooltip = ({
2007
2007
  position = "top",
2008
2008
  className
2009
2009
  }) => {
2010
- const [isVisible, setIsVisible] = React68__default.useState(false);
2011
- const timeoutRef = React68__default.useRef(null);
2010
+ const [isVisible, setIsVisible] = React69__default.useState(false);
2011
+ const timeoutRef = React69__default.useRef(null);
2012
2012
  const handleMouseEnter = () => {
2013
2013
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
2014
2014
  timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
@@ -2017,7 +2017,7 @@ var LawReferenceTooltip = ({
2017
2017
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
2018
2018
  setIsVisible(false);
2019
2019
  };
2020
- React68__default.useEffect(() => {
2020
+ React69__default.useEffect(() => {
2021
2021
  return () => {
2022
2022
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
2023
2023
  };
@@ -2205,7 +2205,7 @@ var sizeStyles5 = {
2205
2205
  md: "w-2.5 h-2.5",
2206
2206
  lg: "w-3 h-3"
2207
2207
  };
2208
- var StatusDot = React68__default.forwardRef(
2208
+ var StatusDot = React69__default.forwardRef(
2209
2209
  ({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
2210
2210
  return /* @__PURE__ */ jsx(
2211
2211
  "span",
@@ -2252,7 +2252,7 @@ var iconMap = {
2252
2252
  down: TrendingDown,
2253
2253
  flat: ArrowRight
2254
2254
  };
2255
- var TrendIndicator = React68__default.forwardRef(
2255
+ var TrendIndicator = React69__default.forwardRef(
2256
2256
  ({
2257
2257
  className,
2258
2258
  value,
@@ -2311,7 +2311,7 @@ var thumbSizes = {
2311
2311
  md: "w-4 h-4",
2312
2312
  lg: "w-5 h-5"
2313
2313
  };
2314
- var RangeSlider = React68__default.forwardRef(
2314
+ var RangeSlider = React69__default.forwardRef(
2315
2315
  ({
2316
2316
  className,
2317
2317
  min = 0,
@@ -2326,7 +2326,7 @@ var RangeSlider = React68__default.forwardRef(
2326
2326
  action,
2327
2327
  actionPayload,
2328
2328
  onChange,
2329
- formatValue: formatValue3,
2329
+ formatValue: formatValue4,
2330
2330
  ...props
2331
2331
  }, ref) => {
2332
2332
  const [isDragging, setIsDragging] = useState(false);
@@ -2335,7 +2335,7 @@ var RangeSlider = React68__default.forwardRef(
2335
2335
  const eventBus = useSafeEventBus();
2336
2336
  const percentage = max !== min ? (value - min) / (max - min) * 100 : 0;
2337
2337
  const bufferedPercentage = buffered !== void 0 ? Math.min(buffered, 100) : void 0;
2338
- const displayValue = formatValue3 ? formatValue3(value) : String(value);
2338
+ const displayValue = formatValue4 ? formatValue4(value) : String(value);
2339
2339
  const handleChange = useCallback(
2340
2340
  (e) => {
2341
2341
  const newValue = Number(e.target.value);
@@ -2827,9 +2827,9 @@ function ScoreDisplay({
2827
2827
  animated = true,
2828
2828
  locale = "en-US"
2829
2829
  }) {
2830
- const [displayValue, setDisplayValue] = React68.useState(value);
2831
- const [isAnimating, setIsAnimating] = React68.useState(false);
2832
- React68.useEffect(() => {
2830
+ const [displayValue, setDisplayValue] = React69.useState(value);
2831
+ const [isAnimating, setIsAnimating] = React69.useState(false);
2832
+ React69.useEffect(() => {
2833
2833
  if (!animated || displayValue === value) {
2834
2834
  setDisplayValue(value);
2835
2835
  return;
@@ -2902,9 +2902,9 @@ function ControlButton({
2902
2902
  className
2903
2903
  }) {
2904
2904
  const eventBus = useEventBus();
2905
- const [isPressed, setIsPressed] = React68.useState(false);
2905
+ const [isPressed, setIsPressed] = React69.useState(false);
2906
2906
  const actualPressed = pressed ?? isPressed;
2907
- const handlePointerDown = React68.useCallback(
2907
+ const handlePointerDown = React69.useCallback(
2908
2908
  (e) => {
2909
2909
  e.preventDefault();
2910
2910
  if (disabled) return;
@@ -2914,7 +2914,7 @@ function ControlButton({
2914
2914
  },
2915
2915
  [disabled, pressEvent, eventBus, onPress]
2916
2916
  );
2917
- const handlePointerUp = React68.useCallback(
2917
+ const handlePointerUp = React69.useCallback(
2918
2918
  (e) => {
2919
2919
  e.preventDefault();
2920
2920
  if (disabled) return;
@@ -2924,7 +2924,7 @@ function ControlButton({
2924
2924
  },
2925
2925
  [disabled, releaseEvent, eventBus, onRelease]
2926
2926
  );
2927
- const handlePointerLeave = React68.useCallback(
2927
+ const handlePointerLeave = React69.useCallback(
2928
2928
  (e) => {
2929
2929
  if (isPressed) {
2930
2930
  setIsPressed(false);
@@ -3152,7 +3152,7 @@ var ErrorState = ({
3152
3152
  );
3153
3153
  };
3154
3154
  ErrorState.displayName = "ErrorState";
3155
- var ErrorBoundary = class extends React68__default.Component {
3155
+ var ErrorBoundary = class extends React69__default.Component {
3156
3156
  constructor(props) {
3157
3157
  super(props);
3158
3158
  __publicField(this, "reset", () => {
@@ -4774,8 +4774,8 @@ var Menu = ({
4774
4774
  "bottom-start": "top-full left-0 mt-2",
4775
4775
  "bottom-end": "top-full right-0 mt-2"
4776
4776
  };
4777
- const triggerChild = React68__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx("span", { children: trigger });
4778
- const triggerElement = React68__default.cloneElement(
4777
+ const triggerChild = React69__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx("span", { children: trigger });
4778
+ const triggerElement = React69__default.cloneElement(
4779
4779
  triggerChild,
4780
4780
  {
4781
4781
  ref: triggerRef,
@@ -5280,8 +5280,8 @@ var Popover = ({
5280
5280
  onMouseEnter: handleOpen,
5281
5281
  onMouseLeave: handleClose
5282
5282
  };
5283
- const childElement = React68__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
5284
- const triggerElement = React68__default.cloneElement(
5283
+ const childElement = React69__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
5284
+ const triggerElement = React69__default.cloneElement(
5285
5285
  childElement,
5286
5286
  {
5287
5287
  ref: triggerRef,
@@ -6011,8 +6011,8 @@ var Tooltip = ({
6011
6011
  if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
6012
6012
  };
6013
6013
  }, []);
6014
- const triggerElement = React68__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
6015
- const trigger = React68__default.cloneElement(triggerElement, {
6014
+ const triggerElement = React69__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
6015
+ const trigger = React69__default.cloneElement(triggerElement, {
6016
6016
  ref: triggerRef,
6017
6017
  onMouseEnter: handleMouseEnter,
6018
6018
  onMouseLeave: handleMouseLeave,
@@ -6261,7 +6261,7 @@ var WizardProgress = ({
6261
6261
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: steps.map((step, index) => {
6262
6262
  const isActive = index === currentStep;
6263
6263
  const isCompleted = index < currentStep;
6264
- return /* @__PURE__ */ jsxs(React68__default.Fragment, { children: [
6264
+ return /* @__PURE__ */ jsxs(React69__default.Fragment, { children: [
6265
6265
  /* @__PURE__ */ jsx(
6266
6266
  "button",
6267
6267
  {
@@ -6391,7 +6391,7 @@ var WizardNavigation = ({
6391
6391
  );
6392
6392
  };
6393
6393
  WizardNavigation.displayName = "WizardNavigation";
6394
- var MarkdownContent = React68__default.memo(
6394
+ var MarkdownContent = React69__default.memo(
6395
6395
  ({ content, direction, className }) => {
6396
6396
  const { t: _t } = useTranslate();
6397
6397
  return /* @__PURE__ */ jsx(
@@ -6492,7 +6492,7 @@ var MarkdownContent = React68__default.memo(
6492
6492
  (prev, next) => prev.content === next.content && prev.className === next.className && prev.direction === next.direction
6493
6493
  );
6494
6494
  MarkdownContent.displayName = "MarkdownContent";
6495
- var CodeBlock = React68__default.memo(
6495
+ var CodeBlock = React69__default.memo(
6496
6496
  ({
6497
6497
  code,
6498
6498
  language = "text",
@@ -7540,8 +7540,8 @@ function DPad({
7540
7540
  }) {
7541
7541
  const eventBus = useEventBus();
7542
7542
  const sizes = sizeMap5[size];
7543
- const [activeDirections, setActiveDirections] = React68.useState(/* @__PURE__ */ new Set());
7544
- const handlePress = React68.useCallback(
7543
+ const [activeDirections, setActiveDirections] = React69.useState(/* @__PURE__ */ new Set());
7544
+ const handlePress = React69.useCallback(
7545
7545
  (direction) => {
7546
7546
  setActiveDirections((prev) => new Set(prev).add(direction));
7547
7547
  if (directionEvent) eventBus.emit(`UI:${directionEvent}`, { direction, pressed: true });
@@ -7549,7 +7549,7 @@ function DPad({
7549
7549
  },
7550
7550
  [directionEvent, eventBus, onDirection]
7551
7551
  );
7552
- const handleRelease = React68.useCallback(
7552
+ const handleRelease = React69.useCallback(
7553
7553
  (direction) => {
7554
7554
  setActiveDirections((prev) => {
7555
7555
  const next = new Set(prev);
@@ -7607,8 +7607,8 @@ function ActionButtons({
7607
7607
  disabled
7608
7608
  }) {
7609
7609
  const eventBus = useEventBus();
7610
- const [activeButtons, setActiveButtons] = React68.useState(/* @__PURE__ */ new Set());
7611
- const handlePress = React68.useCallback(
7610
+ const [activeButtons, setActiveButtons] = React69.useState(/* @__PURE__ */ new Set());
7611
+ const handlePress = React69.useCallback(
7612
7612
  (id) => {
7613
7613
  setActiveButtons((prev) => new Set(prev).add(id));
7614
7614
  if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
@@ -7616,7 +7616,7 @@ function ActionButtons({
7616
7616
  },
7617
7617
  [actionEvent, eventBus, onAction]
7618
7618
  );
7619
- const handleRelease = React68.useCallback(
7619
+ const handleRelease = React69.useCallback(
7620
7620
  (id) => {
7621
7621
  setActiveButtons((prev) => {
7622
7622
  const next = new Set(prev);
@@ -8919,13 +8919,18 @@ var DataGrid = ({
8919
8919
  selectionEvent,
8920
8920
  infiniteScroll,
8921
8921
  loadMoreEvent,
8922
- hasMore
8922
+ hasMore,
8923
+ children,
8924
+ pageSize = 0
8923
8925
  }) => {
8924
8926
  const eventBus = useEventBus();
8925
8927
  const { t } = useTranslate();
8926
8928
  const [selectedIds, setSelectedIds] = useState(/* @__PURE__ */ new Set());
8929
+ const [visibleCount, setVisibleCount] = useState(pageSize || Infinity);
8927
8930
  const fields = fieldsProp ?? columnsProp ?? [];
8928
- const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
8931
+ const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
8932
+ const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
8933
+ const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
8929
8934
  const toggleSelection = useCallback((id) => {
8930
8935
  setSelectedIds((prev) => {
8931
8936
  const next = new Set(prev);
@@ -8955,7 +8960,7 @@ var DataGrid = ({
8955
8960
  const dangerActions = itemActions?.filter((a) => a.variant === "danger") ?? [];
8956
8961
  const handleActionClick = (action, itemData) => (e) => {
8957
8962
  e.stopPropagation();
8958
- eventBus.emit(`UI:${action.event}`, { row: itemData });
8963
+ eventBus.emit(`UI:${action.event}`, { id: itemData.id, row: itemData });
8959
8964
  };
8960
8965
  const gridTemplateColumns = cols ? void 0 : `repeat(auto-fit, minmax(min(${minCardWidth}px, 100%), 1fr))`;
8961
8966
  const colsClass = cols ? {
@@ -8975,6 +8980,7 @@ var DataGrid = ({
8975
8980
  if (data.length === 0) {
8976
8981
  return /* @__PURE__ */ jsx(Box, { className: "text-center py-12", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "secondary", children: t("empty.noItems") || "No items found" }) });
8977
8982
  }
8983
+ const hasRenderProp = typeof children === "function";
8978
8984
  const allIds = data.map((item, i) => item.id || String(i));
8979
8985
  const allSelected = allIds.length > 0 && allIds.every((id) => selectedIds.has(id));
8980
8986
  const someSelected = selectedIds.size > 0;
@@ -9004,8 +9010,26 @@ var DataGrid = ({
9004
9010
  children: data.map((item, index) => {
9005
9011
  const itemData = item;
9006
9012
  const id = itemData.id || String(index);
9007
- const titleValue = getNestedValue(itemData, titleField?.name ?? "");
9008
9013
  const isSelected = selectedIds.has(id);
9014
+ if (hasRenderProp) {
9015
+ return /* @__PURE__ */ jsx(
9016
+ Box,
9017
+ {
9018
+ "data-entity-row": true,
9019
+ className: cn(
9020
+ "bg-[var(--color-card)] rounded-[var(--radius-lg)]",
9021
+ "border border-[var(--color-border)]",
9022
+ "shadow-[var(--shadow-sm)] hover:shadow-[var(--shadow-hover)]",
9023
+ "hover:border-[var(--color-primary)] transition-all",
9024
+ "p-4",
9025
+ isSelected && "ring-2 ring-[var(--color-primary)] border-[var(--color-primary)]"
9026
+ ),
9027
+ children: children(itemData, index)
9028
+ },
9029
+ id
9030
+ );
9031
+ }
9032
+ const titleValue = getNestedValue(itemData, titleField?.name ?? "");
9009
9033
  return /* @__PURE__ */ jsxs(
9010
9034
  Box,
9011
9035
  {
@@ -9129,6 +9153,21 @@ var DataGrid = ({
9129
9153
  })
9130
9154
  }
9131
9155
  ),
9156
+ hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
9157
+ Button,
9158
+ {
9159
+ variant: "ghost",
9160
+ size: "sm",
9161
+ onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
9162
+ children: [
9163
+ /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
9164
+ t("common.showMore") || "Show More",
9165
+ " (",
9166
+ allData.length - visibleCount,
9167
+ " remaining)"
9168
+ ]
9169
+ }
9170
+ ) }),
9132
9171
  infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
9133
9172
  InfiniteScrollSentinel,
9134
9173
  {
@@ -9209,12 +9248,17 @@ var DataList = ({
9209
9248
  longPressEvent: _longPressEvent,
9210
9249
  infiniteScroll,
9211
9250
  loadMoreEvent,
9212
- hasMore
9251
+ hasMore,
9252
+ children,
9253
+ pageSize = 5
9213
9254
  }) => {
9214
9255
  const eventBus = useEventBus();
9215
9256
  const { t } = useTranslate();
9257
+ const [visibleCount, setVisibleCount] = React69__default.useState(pageSize || Infinity);
9216
9258
  const fields = fieldsProp ?? columnsProp ?? [];
9217
- const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
9259
+ const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
9260
+ const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
9261
+ const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
9218
9262
  const titleField = fields.find((f) => f.variant === "h3" || f.variant === "h4") ?? fields[0];
9219
9263
  const badgeFields = fields.filter((f) => f.variant === "badge" && f !== titleField);
9220
9264
  const progressFields = fields.filter((f) => f.variant === "progress");
@@ -9223,7 +9267,7 @@ var DataList = ({
9223
9267
  );
9224
9268
  const handleActionClick = (action, itemData) => (e) => {
9225
9269
  e.stopPropagation();
9226
- eventBus.emit(`UI:${action.event}`, { row: itemData });
9270
+ eventBus.emit(`UI:${action.event}`, { id: itemData.id, row: itemData });
9227
9271
  };
9228
9272
  if (isLoading) {
9229
9273
  return /* @__PURE__ */ jsx(Box, { className: "text-center py-8", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "secondary", children: t("loading.items") || "Loading..." }) });
@@ -9247,7 +9291,7 @@ var DataList = ({
9247
9291
  const items2 = data.map((item) => item);
9248
9292
  const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
9249
9293
  const contentField = titleField?.name ?? fields[0]?.name ?? "";
9250
- return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React68__default.Fragment, { children: [
9294
+ return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React69__default.Fragment, { children: [
9251
9295
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
9252
9296
  group.items.map((itemData, index) => {
9253
9297
  const id = itemData.id || `${gi}-${index}`;
@@ -9293,9 +9337,57 @@ var DataList = ({
9293
9337
  })
9294
9338
  ] }, gi)) });
9295
9339
  }
9340
+ const hasRenderProp = typeof children === "function";
9296
9341
  const items = data.map((item) => item);
9297
9342
  const groups = groupBy ? groupData(items, groupBy) : [{ label: "", items }];
9298
9343
  const renderItem = (itemData, index, isLast) => {
9344
+ if (hasRenderProp) {
9345
+ const id2 = itemData.id || String(index);
9346
+ return /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, children: [
9347
+ /* @__PURE__ */ jsxs(
9348
+ Box,
9349
+ {
9350
+ className: cn(
9351
+ "group flex items-center gap-4 transition-all duration-200",
9352
+ isCompact ? "px-4 py-2" : "px-6 py-4",
9353
+ "hover:bg-[var(--color-muted)]/80",
9354
+ !isCard && !isCompact && "rounded-[var(--radius-lg)] border border-transparent hover:border-[var(--color-border)]"
9355
+ ),
9356
+ children: [
9357
+ /* @__PURE__ */ jsx(Box, { className: "flex-1 min-w-0", children: children(itemData, index) }),
9358
+ itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(
9359
+ HStack,
9360
+ {
9361
+ gap: "xs",
9362
+ className: cn(
9363
+ "flex-shrink-0 transition-opacity duration-200",
9364
+ "opacity-0 group-hover:opacity-100"
9365
+ ),
9366
+ children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
9367
+ Button,
9368
+ {
9369
+ variant: action.variant ?? "ghost",
9370
+ size: "sm",
9371
+ onClick: handleActionClick(action, itemData),
9372
+ "data-testid": `action-${action.event}`,
9373
+ className: cn(
9374
+ action.variant === "danger" && "text-[var(--color-error)] hover:bg-[var(--color-error)]/10"
9375
+ ),
9376
+ children: [
9377
+ action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
9378
+ action.label
9379
+ ]
9380
+ },
9381
+ idx
9382
+ ))
9383
+ }
9384
+ )
9385
+ ]
9386
+ }
9387
+ ),
9388
+ isCard && !isLast && /* @__PURE__ */ jsx(Box, { className: "mx-6 border-b border-[var(--color-border)]/40" })
9389
+ ] }, id2);
9390
+ }
9299
9391
  const id = itemData.id || String(index);
9300
9392
  const titleValue = getNestedValue(itemData, titleField?.name ?? "");
9301
9393
  return /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, children: [
@@ -9402,12 +9494,27 @@ var DataList = ({
9402
9494
  className
9403
9495
  ),
9404
9496
  children: [
9405
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React68__default.Fragment, { children: [
9497
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React69__default.Fragment, { children: [
9406
9498
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
9407
9499
  group.items.map(
9408
9500
  (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
9409
9501
  )
9410
9502
  ] }, gi)),
9503
+ hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
9504
+ Button,
9505
+ {
9506
+ variant: "ghost",
9507
+ size: "sm",
9508
+ onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
9509
+ children: [
9510
+ /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
9511
+ t("common.showMore") || "Show More",
9512
+ " (",
9513
+ allData.length - visibleCount,
9514
+ " remaining)"
9515
+ ]
9516
+ }
9517
+ ) }),
9411
9518
  infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
9412
9519
  InfiniteScrollSentinel,
9413
9520
  {
@@ -9421,6 +9528,282 @@ var DataList = ({
9421
9528
  );
9422
9529
  };
9423
9530
  DataList.displayName = "DataList";
9531
+ function formatValue3(value, format, max) {
9532
+ if (value == null) return "0";
9533
+ const v = typeof value === "number" ? value : value;
9534
+ let formatted;
9535
+ switch (format) {
9536
+ case "currency":
9537
+ formatted = typeof v === "number" ? `$${v.toFixed(2)}` : String(v);
9538
+ break;
9539
+ case "percent":
9540
+ formatted = typeof v === "number" ? `${Math.round(v)}%` : String(v);
9541
+ break;
9542
+ case "number":
9543
+ formatted = typeof v === "number" ? v.toLocaleString() : String(v);
9544
+ break;
9545
+ default:
9546
+ formatted = String(v);
9547
+ }
9548
+ if (max != null) return `${formatted} / ${max}`;
9549
+ return formatted;
9550
+ }
9551
+ var variantColor = {
9552
+ default: "text-[var(--color-foreground)]",
9553
+ primary: "text-[var(--color-primary)]",
9554
+ success: "text-[var(--color-success)]",
9555
+ warning: "text-[var(--color-warning)]",
9556
+ error: "text-[var(--color-error)]",
9557
+ info: "text-[var(--color-info)]"
9558
+ };
9559
+ var StatDisplay = ({
9560
+ label,
9561
+ value,
9562
+ max,
9563
+ icon: iconProp,
9564
+ iconBg = "bg-[var(--color-muted)]",
9565
+ iconColor = "text-[var(--color-foreground)]",
9566
+ format,
9567
+ size = "md",
9568
+ variant = "default",
9569
+ compact = false,
9570
+ className,
9571
+ isLoading = false,
9572
+ error = null
9573
+ }) => {
9574
+ const ResolvedIcon = typeof iconProp === "string" ? resolveIcon(iconProp) : null;
9575
+ const iconSizes2 = { sm: "h-4 w-4", md: "h-5 w-5", lg: "h-6 w-6" };
9576
+ const valueSizes = { sm: "text-lg", md: "text-2xl", lg: "text-3xl" };
9577
+ const padSizes = { sm: "p-3", md: "p-4", lg: "p-6" };
9578
+ const displayValue = formatValue3(value, format, max);
9579
+ if (error) {
9580
+ return /* @__PURE__ */ jsx(Card, { className: cn(padSizes[size], className), children: /* @__PURE__ */ jsx(Typography, { variant: "small", color: "error", children: error.message }) });
9581
+ }
9582
+ if (isLoading) {
9583
+ return /* @__PURE__ */ jsx(Card, { className: cn(padSizes[size], className), children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", className: "animate-pulse", children: [
9584
+ /* @__PURE__ */ jsx(Box, { className: "h-3 bg-[var(--color-muted)] rounded w-16" }),
9585
+ /* @__PURE__ */ jsx(Box, { className: "h-6 bg-[var(--color-muted)] rounded w-12" })
9586
+ ] }) });
9587
+ }
9588
+ if (compact) {
9589
+ return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: cn("items-center", className), children: [
9590
+ ResolvedIcon && /* @__PURE__ */ jsx(ResolvedIcon, { className: cn(iconSizes2[size], iconColor) }),
9591
+ typeof iconProp !== "string" && iconProp,
9592
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: label }),
9593
+ /* @__PURE__ */ jsx(Typography, { variant: "h4", className: cn("font-bold", valueSizes[size], variantColor[variant]), children: displayValue })
9594
+ ] });
9595
+ }
9596
+ return /* @__PURE__ */ jsx(Card, { className: cn(padSizes[size], className), children: /* @__PURE__ */ jsxs(HStack, { align: "start", justify: "between", children: [
9597
+ /* @__PURE__ */ jsxs(VStack, { gap: "none", className: "space-y-1", children: [
9598
+ /* @__PURE__ */ jsx(Typography, { variant: "overline", color: "secondary", children: label }),
9599
+ /* @__PURE__ */ jsx(Typography, { variant: "h4", className: cn("font-bold", valueSizes[size], variantColor[variant]), children: displayValue })
9600
+ ] }),
9601
+ (ResolvedIcon || typeof iconProp !== "string" && iconProp) && /* @__PURE__ */ jsx(Box, { className: cn("p-3 rounded-[var(--radius-md)]", iconBg), children: ResolvedIcon ? /* @__PURE__ */ jsx(ResolvedIcon, { className: cn(iconSizes2[size], iconColor) }) : iconProp })
9602
+ ] }) });
9603
+ };
9604
+ StatDisplay.displayName = "StatDisplay";
9605
+ var DEFAULT_THRESHOLDS = [
9606
+ { value: 30, color: "var(--color-error)" },
9607
+ { value: 70, color: "var(--color-warning)" },
9608
+ { value: 100, color: "var(--color-success)" }
9609
+ ];
9610
+ function getColorForValue(value, max, thresholds) {
9611
+ const percentage = value / max * 100;
9612
+ for (const threshold of thresholds) {
9613
+ if (percentage <= threshold.value) {
9614
+ return threshold.color;
9615
+ }
9616
+ }
9617
+ return thresholds[thresholds.length - 1]?.color ?? "var(--color-primary)";
9618
+ }
9619
+ var radialSizes = {
9620
+ sm: { size: 80, stroke: 6, fontSize: "12px" },
9621
+ md: { size: 120, stroke: 8, fontSize: "16px" },
9622
+ lg: { size: 160, stroke: 10, fontSize: "20px" }
9623
+ };
9624
+ var Meter = ({
9625
+ value,
9626
+ min = 0,
9627
+ max = 100,
9628
+ label,
9629
+ unit,
9630
+ variant = "linear",
9631
+ thresholds = DEFAULT_THRESHOLDS,
9632
+ segments = 5,
9633
+ showValue = true,
9634
+ size = "md",
9635
+ actions,
9636
+ isLoading = false,
9637
+ error,
9638
+ className
9639
+ }) => {
9640
+ const eventBus = useEventBus();
9641
+ const handleAction = useCallback(
9642
+ (action) => {
9643
+ if (action.event) {
9644
+ eventBus.emit(`UI:${action.event}`, { value });
9645
+ }
9646
+ },
9647
+ [eventBus, value]
9648
+ );
9649
+ const percentage = useMemo(() => {
9650
+ const range = max - min;
9651
+ if (range <= 0) return 0;
9652
+ return Math.min(Math.max((value - min) / range * 100, 0), 100);
9653
+ }, [value, min, max]);
9654
+ const activeColor = useMemo(
9655
+ () => getColorForValue(value, max, thresholds),
9656
+ [value, max, thresholds]
9657
+ );
9658
+ const displayValue = useMemo(() => {
9659
+ const formatted = Number.isInteger(value) ? value : value.toFixed(1);
9660
+ return unit ? `${formatted}${unit}` : `${formatted}`;
9661
+ }, [value, unit]);
9662
+ if (isLoading) {
9663
+ return /* @__PURE__ */ jsx(LoadingState, { message: "Loading meter...", className });
9664
+ }
9665
+ if (error) {
9666
+ return /* @__PURE__ */ jsx(
9667
+ ErrorState,
9668
+ {
9669
+ title: "Meter error",
9670
+ message: error.message,
9671
+ className
9672
+ }
9673
+ );
9674
+ }
9675
+ if (variant === "radial") {
9676
+ const dims = radialSizes[size];
9677
+ const radius = (dims.size - dims.stroke * 2) / 2;
9678
+ const circumference = 2 * Math.PI * radius;
9679
+ const offset = circumference - percentage / 100 * circumference;
9680
+ const center = dims.size / 2;
9681
+ return /* @__PURE__ */ jsx(Card, { className: cn("p-4", className), children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", children: [
9682
+ label && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "secondary", weight: "medium", children: label }),
9683
+ /* @__PURE__ */ jsxs(Box, { className: "relative inline-flex items-center justify-center", children: [
9684
+ /* @__PURE__ */ jsxs(
9685
+ "svg",
9686
+ {
9687
+ width: dims.size,
9688
+ height: dims.size,
9689
+ viewBox: `0 0 ${dims.size} ${dims.size}`,
9690
+ className: "transform -rotate-90",
9691
+ children: [
9692
+ /* @__PURE__ */ jsx(
9693
+ "circle",
9694
+ {
9695
+ cx: center,
9696
+ cy: center,
9697
+ r: radius,
9698
+ fill: "none",
9699
+ stroke: "var(--color-muted)",
9700
+ strokeWidth: dims.stroke
9701
+ }
9702
+ ),
9703
+ /* @__PURE__ */ jsx(
9704
+ "circle",
9705
+ {
9706
+ cx: center,
9707
+ cy: center,
9708
+ r: radius,
9709
+ fill: "none",
9710
+ stroke: activeColor,
9711
+ strokeWidth: dims.stroke,
9712
+ strokeDasharray: circumference,
9713
+ strokeDashoffset: offset,
9714
+ strokeLinecap: "round",
9715
+ className: "transition-all duration-500 ease-out"
9716
+ }
9717
+ )
9718
+ ]
9719
+ }
9720
+ ),
9721
+ showValue && /* @__PURE__ */ jsx(Box, { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsx(
9722
+ Typography,
9723
+ {
9724
+ variant: "h5",
9725
+ weight: "bold",
9726
+ className: "tabular-nums",
9727
+ style: { fontSize: dims.fontSize },
9728
+ children: displayValue
9729
+ }
9730
+ ) })
9731
+ ] }),
9732
+ actions && actions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", children: actions.map((action, idx) => /* @__PURE__ */ jsx(
9733
+ Badge,
9734
+ {
9735
+ variant: "default",
9736
+ className: "cursor-pointer hover:opacity-80 transition-opacity",
9737
+ onClick: () => handleAction(action),
9738
+ children: action.label
9739
+ },
9740
+ idx
9741
+ )) })
9742
+ ] }) });
9743
+ }
9744
+ if (variant === "segmented") {
9745
+ const activeSegments = Math.round(percentage / 100 * segments);
9746
+ return /* @__PURE__ */ jsx(Card, { className: cn("p-4", className), children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
9747
+ (label || showValue) && /* @__PURE__ */ jsxs(HStack, { justify: "between", align: "center", children: [
9748
+ label && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "secondary", weight: "medium", children: label }),
9749
+ showValue && /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "bold", className: "tabular-nums", children: displayValue })
9750
+ ] }),
9751
+ /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "w-full", children: Array.from({ length: segments }).map((_, idx) => {
9752
+ const isActive = idx < activeSegments;
9753
+ const segColor = isActive ? getColorForValue((idx + 1) / segments * max, max, thresholds) : void 0;
9754
+ return /* @__PURE__ */ jsx(
9755
+ Box,
9756
+ {
9757
+ className: cn(
9758
+ "h-2 flex-1 rounded-[var(--radius-sm)] transition-all duration-300",
9759
+ !isActive && "bg-[var(--color-muted)]"
9760
+ ),
9761
+ style: isActive ? { backgroundColor: segColor } : void 0
9762
+ },
9763
+ idx
9764
+ );
9765
+ }) }),
9766
+ thresholds.some((t) => t.label) && /* @__PURE__ */ jsx(HStack, { justify: "between", className: "w-full", children: thresholds.map((t, idx) => /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: t.label || "" }, idx)) })
9767
+ ] }) });
9768
+ }
9769
+ return /* @__PURE__ */ jsx(Card, { className: cn("p-4", className), children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
9770
+ (label || showValue) && /* @__PURE__ */ jsxs(HStack, { justify: "between", align: "center", children: [
9771
+ label && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "secondary", weight: "medium", children: label }),
9772
+ showValue && /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "bold", className: "tabular-nums", children: displayValue })
9773
+ ] }),
9774
+ /* @__PURE__ */ jsx(Box, { className: "w-full h-3 bg-[var(--color-muted)] rounded-[var(--radius-full)] overflow-hidden", children: /* @__PURE__ */ jsx(
9775
+ Box,
9776
+ {
9777
+ className: "h-full rounded-[var(--radius-full)] transition-all duration-500 ease-out",
9778
+ style: {
9779
+ width: `${percentage}%`,
9780
+ backgroundColor: activeColor
9781
+ }
9782
+ }
9783
+ ) }),
9784
+ /* @__PURE__ */ jsxs(HStack, { justify: "between", className: "w-full", children: [
9785
+ /* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "secondary", children: [
9786
+ min,
9787
+ unit ? ` ${unit}` : ""
9788
+ ] }),
9789
+ /* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "secondary", children: [
9790
+ max,
9791
+ unit ? ` ${unit}` : ""
9792
+ ] })
9793
+ ] }),
9794
+ actions && actions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", children: actions.map((action, idx) => /* @__PURE__ */ jsx(
9795
+ Badge,
9796
+ {
9797
+ variant: "default",
9798
+ className: "cursor-pointer hover:opacity-80 transition-opacity",
9799
+ onClick: () => handleAction(action),
9800
+ children: action.label
9801
+ },
9802
+ idx
9803
+ )) })
9804
+ ] }) });
9805
+ };
9806
+ Meter.displayName = "Meter";
9424
9807
  function useSafeEventBus8() {
9425
9808
  try {
9426
9809
  return useEventBus();
@@ -10455,7 +10838,7 @@ var StatCard = ({
10455
10838
  const labelToUse = propLabel ?? propTitle;
10456
10839
  const eventBus = useEventBus();
10457
10840
  const { t } = useTranslate();
10458
- const handleActionClick = React68__default.useCallback(() => {
10841
+ const handleActionClick = React69__default.useCallback(() => {
10459
10842
  if (action?.event) {
10460
10843
  eventBus.emit(`UI:${action.event}`, {});
10461
10844
  }
@@ -10466,7 +10849,7 @@ var StatCard = ({
10466
10849
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
10467
10850
  const isLoading = externalLoading ?? false;
10468
10851
  const error = externalError;
10469
- const computeMetricValue = React68__default.useCallback(
10852
+ const computeMetricValue = React69__default.useCallback(
10470
10853
  (metric, items) => {
10471
10854
  if (metric.value !== void 0) {
10472
10855
  return metric.value;
@@ -10505,7 +10888,7 @@ var StatCard = ({
10505
10888
  },
10506
10889
  []
10507
10890
  );
10508
- const schemaStats = React68__default.useMemo(() => {
10891
+ const schemaStats = React69__default.useMemo(() => {
10509
10892
  if (!metrics || metrics.length === 0) return null;
10510
10893
  return metrics.map((metric) => ({
10511
10894
  label: metric.label,
@@ -10513,7 +10896,7 @@ var StatCard = ({
10513
10896
  format: metric.format
10514
10897
  }));
10515
10898
  }, [metrics, data, computeMetricValue]);
10516
- const calculatedTrend = React68__default.useMemo(() => {
10899
+ const calculatedTrend = React69__default.useMemo(() => {
10517
10900
  if (manualTrend !== void 0) return manualTrend;
10518
10901
  if (previousValue === void 0 || currentValue === void 0)
10519
10902
  return void 0;
@@ -10677,7 +11060,7 @@ var PageHeader = ({
10677
11060
  info: "bg-[var(--color-info)]/10 text-[var(--color-info)]"
10678
11061
  };
10679
11062
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
10680
- breadcrumbs && breadcrumbs.length > 0 && /* @__PURE__ */ jsx(Box, { as: "nav", className: "mb-4", children: /* @__PURE__ */ jsx(Box, { as: "ol", className: "flex items-center gap-2 text-sm", children: breadcrumbs.map((crumb, idx) => /* @__PURE__ */ jsxs(React68__default.Fragment, { children: [
11063
+ breadcrumbs && breadcrumbs.length > 0 && /* @__PURE__ */ jsx(Box, { as: "nav", className: "mb-4", children: /* @__PURE__ */ jsx(Box, { as: "ol", className: "flex items-center gap-2 text-sm", children: breadcrumbs.map((crumb, idx) => /* @__PURE__ */ jsxs(React69__default.Fragment, { children: [
10681
11064
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
10682
11065
  crumb.href ? /* @__PURE__ */ jsx(
10683
11066
  "a",
@@ -10913,7 +11296,7 @@ var DetailPanel = ({
10913
11296
  return;
10914
11297
  }
10915
11298
  if (action.event) {
10916
- eventBus.emit(`UI:${action.event}`, { row: data2 });
11299
+ eventBus.emit(`UI:${action.event}`, { id: data2?.id, row: data2 });
10917
11300
  }
10918
11301
  if (action.onClick) {
10919
11302
  action.onClick();
@@ -11310,7 +11693,7 @@ var Form = ({
11310
11693
  const normalizedInitialData = initialData ?? {};
11311
11694
  const resolvedEntity = entity && typeof entity === "object" && !Array.isArray(entity) ? entity : void 0;
11312
11695
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
11313
- const entityDerivedFields = React68__default.useMemo(() => {
11696
+ const entityDerivedFields = React69__default.useMemo(() => {
11314
11697
  if (fields && fields.length > 0) return void 0;
11315
11698
  if (!resolvedEntity) return void 0;
11316
11699
  return resolvedEntity.fields.map(
@@ -11329,14 +11712,14 @@ var Form = ({
11329
11712
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
11330
11713
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
11331
11714
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
11332
- const [formData, setFormData] = React68__default.useState(
11715
+ const [formData, setFormData] = React69__default.useState(
11333
11716
  normalizedInitialData
11334
11717
  );
11335
- const [collapsedSections, setCollapsedSections] = React68__default.useState(
11718
+ const [collapsedSections, setCollapsedSections] = React69__default.useState(
11336
11719
  /* @__PURE__ */ new Set()
11337
11720
  );
11338
11721
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
11339
- const evalContext = React68__default.useMemo(
11722
+ const evalContext = React69__default.useMemo(
11340
11723
  () => ({
11341
11724
  formValues: formData,
11342
11725
  globalVariables: externalContext?.globalVariables ?? {},
@@ -11345,13 +11728,13 @@ var Form = ({
11345
11728
  }),
11346
11729
  [formData, externalContext]
11347
11730
  );
11348
- React68__default.useEffect(() => {
11731
+ React69__default.useEffect(() => {
11349
11732
  const data = initialData;
11350
11733
  if (data && Object.keys(data).length > 0) {
11351
11734
  setFormData(data);
11352
11735
  }
11353
11736
  }, [initialData]);
11354
- const processCalculations = React68__default.useCallback(
11737
+ const processCalculations = React69__default.useCallback(
11355
11738
  (changedFieldId, newFormData) => {
11356
11739
  if (!hiddenCalculations.length) return;
11357
11740
  const context = {
@@ -11376,7 +11759,7 @@ var Form = ({
11376
11759
  },
11377
11760
  [hiddenCalculations, externalContext, eventBus]
11378
11761
  );
11379
- const checkViolations = React68__default.useCallback(
11762
+ const checkViolations = React69__default.useCallback(
11380
11763
  (changedFieldId, newFormData) => {
11381
11764
  if (!violationTriggers.length) return;
11382
11765
  const context = {
@@ -11413,7 +11796,7 @@ var Form = ({
11413
11796
  processCalculations(name, newFormData);
11414
11797
  checkViolations(name, newFormData);
11415
11798
  };
11416
- const isFieldVisible = React68__default.useCallback(
11799
+ const isFieldVisible = React69__default.useCallback(
11417
11800
  (fieldName) => {
11418
11801
  const condition = conditionalFields[fieldName];
11419
11802
  if (!condition) return true;
@@ -11421,7 +11804,7 @@ var Form = ({
11421
11804
  },
11422
11805
  [conditionalFields, evalContext]
11423
11806
  );
11424
- const isSectionVisible = React68__default.useCallback(
11807
+ const isSectionVisible = React69__default.useCallback(
11425
11808
  (section) => {
11426
11809
  if (!section.condition) return true;
11427
11810
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -11453,7 +11836,7 @@ var Form = ({
11453
11836
  eventBus.emit(`UI:${onCancel}`);
11454
11837
  }
11455
11838
  };
11456
- const renderField = React68__default.useCallback(
11839
+ const renderField = React69__default.useCallback(
11457
11840
  (field) => {
11458
11841
  const fieldName = field.name || field.field;
11459
11842
  if (!fieldName) return null;
@@ -11474,7 +11857,7 @@ var Form = ({
11474
11857
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
11475
11858
  );
11476
11859
  const effectiveFields = entityDerivedFields ?? fields;
11477
- const normalizedFields = React68__default.useMemo(() => {
11860
+ const normalizedFields = React69__default.useMemo(() => {
11478
11861
  if (!effectiveFields || effectiveFields.length === 0) return [];
11479
11862
  return effectiveFields.map((field) => {
11480
11863
  if (typeof field === "string") {
@@ -11483,7 +11866,7 @@ var Form = ({
11483
11866
  return field;
11484
11867
  });
11485
11868
  }, [effectiveFields]);
11486
- const schemaFields = React68__default.useMemo(() => {
11869
+ const schemaFields = React69__default.useMemo(() => {
11487
11870
  if (normalizedFields.length === 0) return null;
11488
11871
  if (isDebugEnabled()) {
11489
11872
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -11493,7 +11876,7 @@ var Form = ({
11493
11876
  }
11494
11877
  return normalizedFields.map(renderField).filter(Boolean);
11495
11878
  }, [normalizedFields, renderField, entityName, conditionalFields]);
11496
- const sectionElements = React68__default.useMemo(() => {
11879
+ const sectionElements = React69__default.useMemo(() => {
11497
11880
  if (!sections || sections.length === 0) return null;
11498
11881
  return sections.map((section) => {
11499
11882
  if (!isSectionVisible(section)) {
@@ -11832,7 +12215,7 @@ var CardGrid = ({
11832
12215
  return;
11833
12216
  }
11834
12217
  if (action.event) {
11835
- eventBus.emit(`UI:${action.event}`, { row: itemData });
12218
+ eventBus.emit(`UI:${action.event}`, { id: itemData.id, row: itemData });
11836
12219
  }
11837
12220
  if (action.onClick) {
11838
12221
  action.onClick(itemData);
@@ -12344,7 +12727,7 @@ function InputPattern({
12344
12727
  className
12345
12728
  }) {
12346
12729
  const { emit } = useEventBus();
12347
- const [localValue, setLocalValue] = React68__default.useState(value);
12730
+ const [localValue, setLocalValue] = React69__default.useState(value);
12348
12731
  const handleChange = (e) => {
12349
12732
  setLocalValue(e.target.value);
12350
12733
  if (onChange) {
@@ -12381,7 +12764,7 @@ function TextareaPattern({
12381
12764
  className
12382
12765
  }) {
12383
12766
  const { emit } = useEventBus();
12384
- const [localValue, setLocalValue] = React68__default.useState(value);
12767
+ const [localValue, setLocalValue] = React69__default.useState(value);
12385
12768
  const handleChange = (e) => {
12386
12769
  setLocalValue(e.target.value);
12387
12770
  if (onChange) {
@@ -12412,7 +12795,7 @@ function SelectPattern({
12412
12795
  className
12413
12796
  }) {
12414
12797
  const { emit } = useEventBus();
12415
- const [localValue, setLocalValue] = React68__default.useState(value);
12798
+ const [localValue, setLocalValue] = React69__default.useState(value);
12416
12799
  const handleChange = (e) => {
12417
12800
  setLocalValue(e.target.value);
12418
12801
  if (onChange) {
@@ -12441,7 +12824,7 @@ function CheckboxPattern({
12441
12824
  className
12442
12825
  }) {
12443
12826
  const { emit } = useEventBus();
12444
- const [localChecked, setLocalChecked] = React68__default.useState(checked);
12827
+ const [localChecked, setLocalChecked] = React69__default.useState(checked);
12445
12828
  const handleChange = (e) => {
12446
12829
  setLocalChecked(e.target.checked);
12447
12830
  if (onChange) {
@@ -12871,7 +13254,7 @@ function SuspenseConfigProvider({
12871
13254
  config,
12872
13255
  children
12873
13256
  }) {
12874
- return React68__default.createElement(
13257
+ return React69__default.createElement(
12875
13258
  SuspenseConfigContext.Provider,
12876
13259
  { value: config },
12877
13260
  children
@@ -13124,7 +13507,7 @@ function CompiledPortal({ slot, className, pattern, sourceTrait, children }) {
13124
13507
  let wrapper;
13125
13508
  switch (slot) {
13126
13509
  case "modal":
13127
- wrapper = /* @__PURE__ */ jsx(Modal, { isOpen: true, onClose: handleDismiss, showCloseButton: true, children: /* @__PURE__ */ jsx(
13510
+ wrapper = /* @__PURE__ */ jsx(Modal, { isOpen: true, onClose: handleDismiss, showCloseButton: true, size: "lg", children: /* @__PURE__ */ jsx(
13128
13511
  Box,
13129
13512
  {
13130
13513
  className: cn("ui-slot", `ui-slot-${slot}`, className),
@@ -13356,4 +13739,4 @@ function UISlotRenderer({
13356
13739
  }
13357
13740
  UISlotRenderer.displayName = "UISlotRenderer";
13358
13741
 
13359
- export { Accordion, ActionButtons, Alert, AnimatedCounter, Avatar, Badge, Box, Breadcrumb, Button, ButtonGroup, CalendarGrid, Card, Card2, CardBody, CardContent, CardFooter, CardGrid, CardHeader, CardTitle, Carousel, Center, ChartLegend, Checkbox, CodeBlock, ConditionalWrapper, ConfettiEffect, Container, ControlButton, DPad, DataGrid, DataList, DataTable, DateRangeSelector, DayCell, DetailPanel, Divider, Drawer, EmptyState, EntityDisplayEvents, ErrorBoundary, ErrorState, FilterGroup, Flex, FlipCard, FlipContainer, FloatingActionButton, Form, FormField, FormSectionHeader, GraphView, Grid, HStack, Heading, HealthBar, Icon, InfiniteScrollSentinel, Input, InputGroup, Label, LawReferenceTooltip, Lightbox, LineChart, LoadingState, MapView, MarkdownContent, MasterDetail, Menu, Modal, NumberStepper, Overlay, PageHeader, Pagination, Popover, ProgressBar, ProgressDots, PullToRefresh, QuizBlock, Radio, RangeSlider, RelationSelect, RepeatableFormSection, ScaledDiagram, ScoreDisplay, SearchInput, Select, SidePanel, SimpleGrid, Skeleton, SlotContentRenderer, SortableList, Spacer, Spinner, Sprite, Stack, StarRating, StatBadge, StatCard, StateIndicator, StatusDot, SuspenseConfigProvider, SwipeableRow, Switch, Tabs, Text, TextHighlight, Textarea, ThemeSelector, ThemeToggle, TimeSlotCell, Toast, Tooltip, TrendIndicator, TypewriterText, Typography, UISlotComponent, UISlotRenderer, UploadDropZone, VStack, ViolationAlert, WizardNavigation, WizardProgress, drawSprite };
13742
+ export { Accordion, ActionButtons, Alert, AnimatedCounter, Avatar, Badge, Box, Breadcrumb, Button, ButtonGroup, CalendarGrid, Card, Card2, CardBody, CardContent, CardFooter, CardGrid, CardHeader, CardTitle, Carousel, Center, ChartLegend, Checkbox, CodeBlock, ConditionalWrapper, ConfettiEffect, Container, ControlButton, DPad, DataGrid, DataList, DataTable, DateRangeSelector, DayCell, DetailPanel, Divider, Drawer, EmptyState, EntityDisplayEvents, ErrorBoundary, ErrorState, FilterGroup, Flex, FlipCard, FlipContainer, FloatingActionButton, Form, FormField, FormSectionHeader, GraphView, Grid, HStack, Heading, HealthBar, Icon, InfiniteScrollSentinel, Input, InputGroup, Label, LawReferenceTooltip, Lightbox, LineChart, LoadingState, MapView, MarkdownContent, MasterDetail, Menu, Meter, Modal, NumberStepper, Overlay, PageHeader, Pagination, Popover, ProgressBar, ProgressDots, PullToRefresh, QuizBlock, Radio, RangeSlider, RelationSelect, RepeatableFormSection, ScaledDiagram, ScoreDisplay, SearchInput, Select, SidePanel, SimpleGrid, Skeleton, SlotContentRenderer, SortableList, Spacer, Spinner, Sprite, Stack, StarRating, StatBadge, StatCard, StatDisplay, StateIndicator, StatusDot, SuspenseConfigProvider, SwipeableRow, Switch, Tabs, Text, TextHighlight, Textarea, ThemeSelector, ThemeToggle, TimeSlotCell, Toast, Tooltip, TrendIndicator, TypewriterText, Typography, UISlotComponent, UISlotRenderer, UploadDropZone, VStack, ViolationAlert, WizardNavigation, WizardProgress, drawSprite };