@almadar/ui 4.49.0 → 4.50.1

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,6 +1,6 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import * as React131 from 'react';
3
- import React131__default, { useContext, useMemo, useRef, useEffect, useCallback, createContext, Suspense, useState, lazy, useSyncExternalStore, useLayoutEffect, useId } from 'react';
2
+ import * as React75 from 'react';
3
+ import React75__default, { useContext, useMemo, useRef, useEffect, useCallback, createContext, Suspense, useState, lazy, useSyncExternalStore, useLayoutEffect, useId } from 'react';
4
4
  import { clsx } from 'clsx';
5
5
  import { twMerge } from 'tailwind-merge';
6
6
  import { EventBusContext, useTraitScope, TraitScopeProvider } from '@almadar/ui/providers';
@@ -35,6 +35,9 @@ import langToml from 'react-syntax-highlighter/dist/esm/languages/prism/toml.js'
35
35
  import langGo from 'react-syntax-highlighter/dist/esm/languages/prism/go.js';
36
36
  import langGraphql from 'react-syntax-highlighter/dist/esm/languages/prism/graphql.js';
37
37
  import { isInlineTrait } from '@almadar/core';
38
+ import { useSensors, useSensor, PointerSensor, KeyboardSensor, DndContext, closestCenter, useDroppable } from '@dnd-kit/core';
39
+ import { sortableKeyboardCoordinates, arrayMove, useSortable, SortableContext, rectSortingStrategy, verticalListSortingStrategy } from '@dnd-kit/sortable';
40
+ import { CSS } from '@dnd-kit/utilities';
38
41
  import { Handle, Position } from '@xyflow/react';
39
42
  import { useUISlots } from '@almadar/ui/context';
40
43
  import { getPatternDefinition, getComponentForPattern as getComponentForPattern$1 } from '@almadar/patterns';
@@ -203,7 +206,7 @@ var init_SvgFlow = __esm({
203
206
  opacity = 1,
204
207
  className
205
208
  }) => {
206
- const markerId = React131__default.useMemo(() => {
209
+ const markerId = React75__default.useMemo(() => {
207
210
  flowIdCounter += 1;
208
211
  return `almadar-flow-arrow-${flowIdCounter}`;
209
212
  }, []);
@@ -746,7 +749,7 @@ var init_SvgRing = __esm({
746
749
  className,
747
750
  label
748
751
  }) => {
749
- const gradientId = React131__default.useMemo(() => {
752
+ const gradientId = React75__default.useMemo(() => {
750
753
  ringIdCounter += 1;
751
754
  return `almadar-ring-glow-${ringIdCounter}`;
752
755
  }, []);
@@ -1174,7 +1177,7 @@ function resolveIconProp(value, sizeClass) {
1174
1177
  const IconComp = value;
1175
1178
  return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
1176
1179
  }
1177
- if (React131__default.isValidElement(value)) {
1180
+ if (React75__default.isValidElement(value)) {
1178
1181
  return value;
1179
1182
  }
1180
1183
  if (typeof value === "object" && value !== null && "render" in value) {
@@ -1250,7 +1253,7 @@ var init_Button = __esm({
1250
1253
  md: "h-4 w-4",
1251
1254
  lg: "h-5 w-5"
1252
1255
  };
1253
- Button = React131__default.forwardRef(
1256
+ Button = React75__default.forwardRef(
1254
1257
  ({
1255
1258
  className,
1256
1259
  variant = "primary",
@@ -1315,7 +1318,7 @@ var Input;
1315
1318
  var init_Input = __esm({
1316
1319
  "components/atoms/Input.tsx"() {
1317
1320
  init_cn();
1318
- Input = React131__default.forwardRef(
1321
+ Input = React75__default.forwardRef(
1319
1322
  ({
1320
1323
  className,
1321
1324
  inputType,
@@ -1433,7 +1436,7 @@ var Label;
1433
1436
  var init_Label = __esm({
1434
1437
  "components/atoms/Label.tsx"() {
1435
1438
  init_cn();
1436
- Label = React131__default.forwardRef(
1439
+ Label = React75__default.forwardRef(
1437
1440
  ({ className, required, children, ...props }, ref) => {
1438
1441
  return /* @__PURE__ */ jsxs(
1439
1442
  "label",
@@ -1459,7 +1462,7 @@ var Textarea;
1459
1462
  var init_Textarea = __esm({
1460
1463
  "components/atoms/Textarea.tsx"() {
1461
1464
  init_cn();
1462
- Textarea = React131__default.forwardRef(
1465
+ Textarea = React75__default.forwardRef(
1463
1466
  ({ className, error, ...props }, ref) => {
1464
1467
  return /* @__PURE__ */ jsx(
1465
1468
  "textarea",
@@ -1488,7 +1491,7 @@ var Select;
1488
1491
  var init_Select = __esm({
1489
1492
  "components/atoms/Select.tsx"() {
1490
1493
  init_cn();
1491
- Select = React131__default.forwardRef(
1494
+ Select = React75__default.forwardRef(
1492
1495
  ({ className, options, placeholder, error, ...props }, ref) => {
1493
1496
  return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
1494
1497
  /* @__PURE__ */ jsxs(
@@ -1530,7 +1533,7 @@ var Checkbox;
1530
1533
  var init_Checkbox = __esm({
1531
1534
  "components/atoms/Checkbox.tsx"() {
1532
1535
  init_cn();
1533
- Checkbox = React131__default.forwardRef(
1536
+ Checkbox = React75__default.forwardRef(
1534
1537
  ({ className, label, id, ...props }, ref) => {
1535
1538
  const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
1536
1539
  return /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
@@ -1612,7 +1615,7 @@ var init_Card = __esm({
1612
1615
  md: "shadow",
1613
1616
  lg: "shadow-lg"
1614
1617
  };
1615
- Card = React131__default.forwardRef(
1618
+ Card = React75__default.forwardRef(
1616
1619
  ({
1617
1620
  className,
1618
1621
  variant = "bordered",
@@ -1648,9 +1651,9 @@ var init_Card = __esm({
1648
1651
  }
1649
1652
  );
1650
1653
  Card.displayName = "Card";
1651
- CardHeader = React131__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
1654
+ CardHeader = React75__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
1652
1655
  CardHeader.displayName = "CardHeader";
1653
- CardTitle = React131__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1656
+ CardTitle = React75__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1654
1657
  "h3",
1655
1658
  {
1656
1659
  ref,
@@ -1663,11 +1666,11 @@ var init_Card = __esm({
1663
1666
  }
1664
1667
  ));
1665
1668
  CardTitle.displayName = "CardTitle";
1666
- CardContent = React131__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
1669
+ CardContent = React75__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
1667
1670
  CardContent.displayName = "CardContent";
1668
1671
  CardBody = CardContent;
1669
1672
  CardBody.displayName = "CardBody";
1670
- CardFooter = React131__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1673
+ CardFooter = React75__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1671
1674
  "div",
1672
1675
  {
1673
1676
  ref,
@@ -1720,7 +1723,7 @@ var init_Badge = __esm({
1720
1723
  md: "px-2.5 py-1 text-sm",
1721
1724
  lg: "px-3 py-1.5 text-base"
1722
1725
  };
1723
- Badge = React131__default.forwardRef(
1726
+ Badge = React75__default.forwardRef(
1724
1727
  ({ className, variant = "default", size = "sm", amount, label, icon, children, ...props }, ref) => {
1725
1728
  const iconSizes3 = { sm: "w-3 h-3", md: "w-3.5 h-3.5", lg: "w-4 h-4" };
1726
1729
  const resolvedIcon = typeof icon === "string" ? (() => {
@@ -1793,7 +1796,7 @@ var init_FilterPill = __esm({
1793
1796
  md: "w-3.5 h-3.5",
1794
1797
  lg: "w-4 h-4"
1795
1798
  };
1796
- FilterPill = React131__default.forwardRef(
1799
+ FilterPill = React75__default.forwardRef(
1797
1800
  ({
1798
1801
  className,
1799
1802
  variant = "default",
@@ -1872,7 +1875,7 @@ var init_Spinner = __esm({
1872
1875
  md: "h-6 w-6",
1873
1876
  lg: "h-8 w-8"
1874
1877
  };
1875
- Spinner = React131__default.forwardRef(
1878
+ Spinner = React75__default.forwardRef(
1876
1879
  ({ className, size = "md", ...props }, ref) => {
1877
1880
  return /* @__PURE__ */ jsx(
1878
1881
  "div",
@@ -2153,7 +2156,7 @@ var init_Box = __esm({
2153
2156
  fixed: "fixed",
2154
2157
  sticky: "sticky"
2155
2158
  };
2156
- Box = React131__default.forwardRef(
2159
+ Box = React75__default.forwardRef(
2157
2160
  ({
2158
2161
  padding,
2159
2162
  paddingX,
@@ -2526,7 +2529,7 @@ var Radio;
2526
2529
  var init_Radio = __esm({
2527
2530
  "components/atoms/Radio.tsx"() {
2528
2531
  init_cn();
2529
- Radio = React131__default.forwardRef(
2532
+ Radio = React75__default.forwardRef(
2530
2533
  ({
2531
2534
  label,
2532
2535
  helperText,
@@ -2637,7 +2640,7 @@ var init_Switch = __esm({
2637
2640
  "components/atoms/Switch.tsx"() {
2638
2641
  "use client";
2639
2642
  init_cn();
2640
- Switch = React131.forwardRef(
2643
+ Switch = React75.forwardRef(
2641
2644
  ({
2642
2645
  checked,
2643
2646
  defaultChecked = false,
@@ -2648,10 +2651,10 @@ var init_Switch = __esm({
2648
2651
  name,
2649
2652
  className
2650
2653
  }, ref) => {
2651
- const [isChecked, setIsChecked] = React131.useState(
2654
+ const [isChecked, setIsChecked] = React75.useState(
2652
2655
  checked !== void 0 ? checked : defaultChecked
2653
2656
  );
2654
- React131.useEffect(() => {
2657
+ React75.useEffect(() => {
2655
2658
  if (checked !== void 0) {
2656
2659
  setIsChecked(checked);
2657
2660
  }
@@ -3537,8 +3540,8 @@ var init_LawReferenceTooltip = __esm({
3537
3540
  position = "top",
3538
3541
  className
3539
3542
  }) => {
3540
- const [isVisible, setIsVisible] = React131__default.useState(false);
3541
- const timeoutRef = React131__default.useRef(null);
3543
+ const [isVisible, setIsVisible] = React75__default.useState(false);
3544
+ const timeoutRef = React75__default.useRef(null);
3542
3545
  const handleMouseEnter = () => {
3543
3546
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
3544
3547
  timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
@@ -3547,7 +3550,7 @@ var init_LawReferenceTooltip = __esm({
3547
3550
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
3548
3551
  setIsVisible(false);
3549
3552
  };
3550
- React131__default.useEffect(() => {
3553
+ React75__default.useEffect(() => {
3551
3554
  return () => {
3552
3555
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
3553
3556
  };
@@ -3757,7 +3760,7 @@ var init_StatusDot = __esm({
3757
3760
  md: "w-2.5 h-2.5",
3758
3761
  lg: "w-3 h-3"
3759
3762
  };
3760
- StatusDot = React131__default.forwardRef(
3763
+ StatusDot = React75__default.forwardRef(
3761
3764
  ({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
3762
3765
  return /* @__PURE__ */ jsx(
3763
3766
  "span",
@@ -3810,7 +3813,7 @@ var init_TrendIndicator = __esm({
3810
3813
  down: TrendingDown,
3811
3814
  flat: ArrowRight
3812
3815
  };
3813
- TrendIndicator = React131__default.forwardRef(
3816
+ TrendIndicator = React75__default.forwardRef(
3814
3817
  ({
3815
3818
  className,
3816
3819
  value,
@@ -3877,7 +3880,7 @@ var init_RangeSlider = __esm({
3877
3880
  md: "w-4 h-4",
3878
3881
  lg: "w-5 h-5"
3879
3882
  };
3880
- RangeSlider = React131__default.forwardRef(
3883
+ RangeSlider = React75__default.forwardRef(
3881
3884
  ({
3882
3885
  className,
3883
3886
  min = 0,
@@ -4473,7 +4476,7 @@ var init_ContentSection = __esm({
4473
4476
  md: "py-16",
4474
4477
  lg: "py-24"
4475
4478
  };
4476
- ContentSection = React131__default.forwardRef(
4479
+ ContentSection = React75__default.forwardRef(
4477
4480
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
4478
4481
  return /* @__PURE__ */ jsx(
4479
4482
  Box,
@@ -5007,7 +5010,7 @@ var init_AnimatedReveal = __esm({
5007
5010
  "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
5008
5011
  "none": {}
5009
5012
  };
5010
- AnimatedReveal = React131__default.forwardRef(
5013
+ AnimatedReveal = React75__default.forwardRef(
5011
5014
  ({
5012
5015
  trigger = "scroll",
5013
5016
  animation = "fade-up",
@@ -5167,7 +5170,7 @@ var init_AnimatedGraphic = __esm({
5167
5170
  "components/atoms/AnimatedGraphic.tsx"() {
5168
5171
  "use client";
5169
5172
  init_cn();
5170
- AnimatedGraphic = React131__default.forwardRef(
5173
+ AnimatedGraphic = React75__default.forwardRef(
5171
5174
  ({
5172
5175
  src,
5173
5176
  svgContent,
@@ -5190,7 +5193,7 @@ var init_AnimatedGraphic = __esm({
5190
5193
  const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
5191
5194
  const resolvedSvg = svgContent ?? fetchedSvg;
5192
5195
  const prevAnimateRef = useRef(animate);
5193
- const setRef = React131__default.useCallback(
5196
+ const setRef = React75__default.useCallback(
5194
5197
  (node) => {
5195
5198
  containerRef.current = node;
5196
5199
  if (typeof ref === "function") ref(node);
@@ -6000,7 +6003,7 @@ var init_ErrorBoundary = __esm({
6000
6003
  "use client";
6001
6004
  init_cn();
6002
6005
  init_ErrorState();
6003
- ErrorBoundary = class extends React131__default.Component {
6006
+ ErrorBoundary = class extends React75__default.Component {
6004
6007
  constructor(props) {
6005
6008
  super(props);
6006
6009
  __publicField(this, "reset", () => {
@@ -7048,8 +7051,8 @@ var init_Tooltip = __esm({
7048
7051
  if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
7049
7052
  };
7050
7053
  }, []);
7051
- const triggerElement = React131__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
7052
- const trigger = React131__default.cloneElement(triggerElement, {
7054
+ const triggerElement = React75__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
7055
+ const trigger = React75__default.cloneElement(triggerElement, {
7053
7056
  ref: triggerRef,
7054
7057
  onMouseEnter: handleMouseEnter,
7055
7058
  onMouseLeave: handleMouseLeave,
@@ -7170,8 +7173,8 @@ var init_Popover = __esm({
7170
7173
  onMouseEnter: handleOpen,
7171
7174
  onMouseLeave: handleClose
7172
7175
  };
7173
- const childElement = React131__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
7174
- const triggerElement = React131__default.cloneElement(
7176
+ const childElement = React75__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
7177
+ const triggerElement = React75__default.cloneElement(
7175
7178
  childElement,
7176
7179
  {
7177
7180
  ref: triggerRef,
@@ -7288,8 +7291,8 @@ var init_Menu = __esm({
7288
7291
  "bottom-start": "top-full left-0 mt-2",
7289
7292
  "bottom-end": "top-full right-0 mt-2"
7290
7293
  };
7291
- const triggerChild = React131__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx("span", { children: trigger });
7292
- const triggerElement = React131__default.cloneElement(
7294
+ const triggerChild = React75__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx("span", { children: trigger });
7295
+ const triggerElement = React75__default.cloneElement(
7293
7296
  triggerChild,
7294
7297
  {
7295
7298
  ref: triggerRef,
@@ -7705,7 +7708,7 @@ var init_MapView = __esm({
7705
7708
  shadowSize: [41, 41]
7706
7709
  });
7707
7710
  L.Marker.prototype.options.icon = defaultIcon;
7708
- const { useEffect: useEffect70, useRef: useRef66, useCallback: useCallback124, useState: useState106 } = React131__default;
7711
+ const { useEffect: useEffect70, useRef: useRef66, useCallback: useCallback124, useState: useState106 } = React75__default;
7709
7712
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
7710
7713
  const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
7711
7714
  function MapUpdater({ centerLat, centerLng, zoom }) {
@@ -7951,7 +7954,7 @@ function InputPattern({
7951
7954
  fieldName
7952
7955
  }) {
7953
7956
  const { emit } = useEventBus();
7954
- const [localValue, setLocalValue] = React131__default.useState(value);
7957
+ const [localValue, setLocalValue] = React75__default.useState(value);
7955
7958
  const handleChange = (e) => {
7956
7959
  setLocalValue(e.target.value);
7957
7960
  if (onChange) {
@@ -7989,7 +7992,7 @@ function TextareaPattern({
7989
7992
  fieldName
7990
7993
  }) {
7991
7994
  const { emit } = useEventBus();
7992
- const [localValue, setLocalValue] = React131__default.useState(value);
7995
+ const [localValue, setLocalValue] = React75__default.useState(value);
7993
7996
  const handleChange = (e) => {
7994
7997
  setLocalValue(e.target.value);
7995
7998
  if (onChange) {
@@ -8021,7 +8024,7 @@ function SelectPattern({
8021
8024
  fieldName
8022
8025
  }) {
8023
8026
  const { emit } = useEventBus();
8024
- const [localValue, setLocalValue] = React131__default.useState(value);
8027
+ const [localValue, setLocalValue] = React75__default.useState(value);
8025
8028
  const handleChange = (e) => {
8026
8029
  setLocalValue(e.target.value);
8027
8030
  if (onChange) {
@@ -8050,7 +8053,7 @@ function CheckboxPattern({
8050
8053
  className
8051
8054
  }) {
8052
8055
  const { emit } = useEventBus();
8053
- const [localChecked, setLocalChecked] = React131__default.useState(checked);
8056
+ const [localChecked, setLocalChecked] = React75__default.useState(checked);
8054
8057
  const handleChange = (e) => {
8055
8058
  setLocalChecked(e.target.checked);
8056
8059
  if (onChange) {
@@ -8363,9 +8366,9 @@ function ControlButton({
8363
8366
  className
8364
8367
  }) {
8365
8368
  const eventBus = useEventBus();
8366
- const [isPressed, setIsPressed] = React131.useState(false);
8369
+ const [isPressed, setIsPressed] = React75.useState(false);
8367
8370
  const actualPressed = pressed ?? isPressed;
8368
- const handlePointerDown = React131.useCallback(
8371
+ const handlePointerDown = React75.useCallback(
8369
8372
  (e) => {
8370
8373
  e.preventDefault();
8371
8374
  if (disabled) return;
@@ -8375,7 +8378,7 @@ function ControlButton({
8375
8378
  },
8376
8379
  [disabled, pressEvent, eventBus, onPress]
8377
8380
  );
8378
- const handlePointerUp = React131.useCallback(
8381
+ const handlePointerUp = React75.useCallback(
8379
8382
  (e) => {
8380
8383
  e.preventDefault();
8381
8384
  if (disabled) return;
@@ -8385,7 +8388,7 @@ function ControlButton({
8385
8388
  },
8386
8389
  [disabled, releaseEvent, eventBus, onRelease]
8387
8390
  );
8388
- const handlePointerLeave = React131.useCallback(
8391
+ const handlePointerLeave = React75.useCallback(
8389
8392
  (e) => {
8390
8393
  if (isPressed) {
8391
8394
  setIsPressed(false);
@@ -8462,8 +8465,8 @@ function ActionButtons({
8462
8465
  disabled
8463
8466
  }) {
8464
8467
  const eventBus = useEventBus();
8465
- const [activeButtons, setActiveButtons] = React131.useState(/* @__PURE__ */ new Set());
8466
- const handlePress = React131.useCallback(
8468
+ const [activeButtons, setActiveButtons] = React75.useState(/* @__PURE__ */ new Set());
8469
+ const handlePress = React75.useCallback(
8467
8470
  (id) => {
8468
8471
  setActiveButtons((prev) => new Set(prev).add(id));
8469
8472
  if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
@@ -8471,7 +8474,7 @@ function ActionButtons({
8471
8474
  },
8472
8475
  [actionEvent, eventBus, onAction]
8473
8476
  );
8474
- const handleRelease = React131.useCallback(
8477
+ const handleRelease = React75.useCallback(
8475
8478
  (id) => {
8476
8479
  setActiveButtons((prev) => {
8477
8480
  const next = new Set(prev);
@@ -11233,7 +11236,7 @@ var init_MarkdownContent = __esm({
11233
11236
  init_Box();
11234
11237
  init_useTranslate();
11235
11238
  init_cn();
11236
- MarkdownContent = React131__default.memo(
11239
+ MarkdownContent = React75__default.memo(
11237
11240
  ({ content, direction, className }) => {
11238
11241
  const { t: _t } = useTranslate();
11239
11242
  const safeContent = typeof content === "string" ? content : String(content ?? "");
@@ -11451,7 +11454,7 @@ var init_CodeBlock = __esm({
11451
11454
  log5 = createLogger("almadar:ui:markdown-code");
11452
11455
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
11453
11456
  HIDDEN_LINE_NUMBERS = { display: "none" };
11454
- CodeBlock = React131__default.memo(
11457
+ CodeBlock = React75__default.memo(
11455
11458
  ({
11456
11459
  code: rawCode,
11457
11460
  language = "text",
@@ -12760,7 +12763,7 @@ var init_StateMachineView = __esm({
12760
12763
  style: { top: title ? 30 : 0 },
12761
12764
  children: [
12762
12765
  entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
12763
- states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React131__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
12766
+ states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React75__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
12764
12767
  StateNode,
12765
12768
  {
12766
12769
  state,
@@ -19382,7 +19385,7 @@ function CraftingRecipe({
19382
19385
  className
19383
19386
  }) {
19384
19387
  const eventBus = useEventBus();
19385
- const handleCraft = React131.useCallback(() => {
19388
+ const handleCraft = React75.useCallback(() => {
19386
19389
  onCraft?.();
19387
19390
  if (craftEvent) {
19388
19391
  eventBus.emit(craftEvent, { output: output.label });
@@ -19399,7 +19402,7 @@ function CraftingRecipe({
19399
19402
  children: [
19400
19403
  /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap items-center", children: inputs.map((ingredient, index) => {
19401
19404
  const hasSufficient = ingredient.available >= ingredient.required;
19402
- return /* @__PURE__ */ jsxs(React131.Fragment, { children: [
19405
+ return /* @__PURE__ */ jsxs(React75.Fragment, { children: [
19403
19406
  /* @__PURE__ */ jsx(Box, { className: "relative", children: /* @__PURE__ */ jsx(
19404
19407
  ItemSlot,
19405
19408
  {
@@ -19462,8 +19465,8 @@ function DPad({
19462
19465
  }) {
19463
19466
  const eventBus = useEventBus();
19464
19467
  const sizes = sizeMap6[size];
19465
- const [activeDirections, setActiveDirections] = React131.useState(/* @__PURE__ */ new Set());
19466
- const handlePress = React131.useCallback(
19468
+ const [activeDirections, setActiveDirections] = React75.useState(/* @__PURE__ */ new Set());
19469
+ const handlePress = React75.useCallback(
19467
19470
  (direction) => {
19468
19471
  setActiveDirections((prev) => new Set(prev).add(direction));
19469
19472
  if (directionEvent) eventBus.emit(`UI:${directionEvent}`, { direction, pressed: true });
@@ -19471,7 +19474,7 @@ function DPad({
19471
19474
  },
19472
19475
  [directionEvent, eventBus, onDirection]
19473
19476
  );
19474
- const handleRelease = React131.useCallback(
19477
+ const handleRelease = React75.useCallback(
19475
19478
  (direction) => {
19476
19479
  setActiveDirections((prev) => {
19477
19480
  const next = new Set(prev);
@@ -20024,6 +20027,199 @@ var init_DashboardLayout = __esm({
20024
20027
  NavLink.displayName = "NavLink";
20025
20028
  }
20026
20029
  });
20030
+ function useDataDnd(args) {
20031
+ const {
20032
+ dragGroup,
20033
+ accepts,
20034
+ sortable,
20035
+ dropEvent,
20036
+ reorderEvent,
20037
+ dndItemIdField = "id",
20038
+ dndRoot,
20039
+ items,
20040
+ layout
20041
+ } = args;
20042
+ const isZone = Boolean(dragGroup || accepts || sortable);
20043
+ const enabled = isZone || Boolean(dndRoot);
20044
+ const eventBus = useEventBus();
20045
+ const parentRoot = React75__default.useContext(RootCtx);
20046
+ const isRoot = enabled && parentRoot === null;
20047
+ const [localOrder, setLocalOrder] = React75__default.useState(null);
20048
+ const orderedItems = localOrder ?? items;
20049
+ React75__default.useEffect(() => {
20050
+ setLocalOrder(null);
20051
+ }, [items]);
20052
+ const itemIds = React75__default.useMemo(
20053
+ () => orderedItems.map((it, idx) => {
20054
+ const raw = it[dndItemIdField];
20055
+ return raw ?? `__idx_${idx}`;
20056
+ }),
20057
+ [orderedItems, dndItemIdField]
20058
+ );
20059
+ const zonesRef = React75__default.useRef(/* @__PURE__ */ new Map());
20060
+ const registerZone = React75__default.useCallback((zoneId2, meta2) => {
20061
+ zonesRef.current.set(zoneId2, meta2);
20062
+ }, []);
20063
+ const unregisterZone = React75__default.useCallback((zoneId2) => {
20064
+ zonesRef.current.delete(zoneId2);
20065
+ }, []);
20066
+ const zoneId = React75__default.useId();
20067
+ const ownGroup = dragGroup ?? accepts ?? zoneId;
20068
+ const meta = React75__default.useMemo(
20069
+ () => ({ group: ownGroup, dropEvent, reorderEvent, itemIds }),
20070
+ [ownGroup, dropEvent, reorderEvent, itemIds]
20071
+ );
20072
+ React75__default.useEffect(() => {
20073
+ const target = isRoot ? null : parentRoot;
20074
+ if (!target) {
20075
+ zonesRef.current.set(zoneId, meta);
20076
+ return () => zonesRef.current.delete(zoneId);
20077
+ }
20078
+ target.registerZone(zoneId, meta);
20079
+ return () => target.unregisterZone(zoneId);
20080
+ }, [parentRoot, isRoot, zoneId, meta]);
20081
+ const sensors = useSensors(
20082
+ useSensor(PointerSensor, { activationConstraint: { distance: 5 } }),
20083
+ useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates })
20084
+ );
20085
+ const findZoneByItem = React75__default.useCallback(
20086
+ (id) => {
20087
+ for (const z of zonesRef.current.values()) {
20088
+ if (z.itemIds.includes(id)) return z;
20089
+ }
20090
+ return void 0;
20091
+ },
20092
+ []
20093
+ );
20094
+ const findZoneByGroup = React75__default.useCallback(
20095
+ (group) => {
20096
+ for (const z of zonesRef.current.values()) {
20097
+ if (z.group === group) return z;
20098
+ }
20099
+ return void 0;
20100
+ },
20101
+ []
20102
+ );
20103
+ const handleDragEnd = React75__default.useCallback(
20104
+ (event) => {
20105
+ const { active, over } = event;
20106
+ if (!over) return;
20107
+ const sourceZone = findZoneByItem(active.id);
20108
+ const overData = over.data?.current;
20109
+ const targetGroup = overData?.dndGroup;
20110
+ if (!sourceZone || !targetGroup) return;
20111
+ const targetZone = findZoneByGroup(targetGroup);
20112
+ if (!targetZone) return;
20113
+ if (sourceZone.group !== targetZone.group) {
20114
+ if (targetZone.dropEvent) {
20115
+ const newIndex2 = targetZone.itemIds.indexOf(over.id);
20116
+ eventBus.emit(targetZone.dropEvent, {
20117
+ id: String(active.id),
20118
+ sourceGroup: sourceZone.group,
20119
+ targetGroup: targetZone.group,
20120
+ newIndex: newIndex2 === -1 ? targetZone.itemIds.length : newIndex2
20121
+ });
20122
+ }
20123
+ return;
20124
+ }
20125
+ const oldIndex = sourceZone.itemIds.indexOf(active.id);
20126
+ const newIndex = sourceZone.itemIds.indexOf(over.id);
20127
+ if (oldIndex === -1 || newIndex === -1 || oldIndex === newIndex) return;
20128
+ if (sourceZone.group === ownGroup) {
20129
+ const reordered = arrayMove(orderedItems, oldIndex, newIndex);
20130
+ setLocalOrder(reordered);
20131
+ }
20132
+ if (sourceZone.reorderEvent) {
20133
+ eventBus.emit(sourceZone.reorderEvent, {
20134
+ id: String(active.id),
20135
+ oldIndex,
20136
+ newIndex
20137
+ });
20138
+ }
20139
+ },
20140
+ [orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
20141
+ );
20142
+ const SortableItem = React75__default.useCallback(
20143
+ ({ id, children }) => {
20144
+ const {
20145
+ attributes,
20146
+ listeners: listeners7,
20147
+ setNodeRef,
20148
+ transform,
20149
+ transition,
20150
+ isDragging
20151
+ } = useSortable({ id, data: { dndGroup: ownGroup } });
20152
+ const style = {
20153
+ transform: CSS.Transform.toString(transform),
20154
+ transition,
20155
+ opacity: isDragging ? 0.4 : 1,
20156
+ cursor: enabled ? "grab" : void 0
20157
+ };
20158
+ return /* @__PURE__ */ jsx(
20159
+ Box,
20160
+ {
20161
+ className: "touch-none",
20162
+ ref: setNodeRef,
20163
+ style,
20164
+ ...attributes,
20165
+ ...listeners7,
20166
+ children
20167
+ }
20168
+ );
20169
+ },
20170
+ [ownGroup, enabled]
20171
+ );
20172
+ const DropZoneShell = ({ children }) => {
20173
+ const { setNodeRef, isOver } = useDroppable({
20174
+ id: `dnd-zone-${zoneId}`,
20175
+ data: { dndGroup: ownGroup }
20176
+ });
20177
+ return /* @__PURE__ */ jsx(
20178
+ Box,
20179
+ {
20180
+ ref: setNodeRef,
20181
+ "data-dnd-zone": ownGroup,
20182
+ className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
20183
+ children
20184
+ }
20185
+ );
20186
+ };
20187
+ const rootContextValue = React75__default.useMemo(
20188
+ () => ({ registerZone, unregisterZone }),
20189
+ [registerZone, unregisterZone]
20190
+ );
20191
+ const wrapContainer = React75__default.useCallback(
20192
+ (children) => {
20193
+ if (!enabled) return children;
20194
+ const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
20195
+ if (!isZone) {
20196
+ if (!isRoot) return children;
20197
+ return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, children }) });
20198
+ }
20199
+ const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
20200
+ if (isRoot) {
20201
+ return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, children: inner }) });
20202
+ }
20203
+ return inner;
20204
+ },
20205
+ [enabled, isZone, layout, sensors, handleDragEnd, itemIds, isRoot, rootContextValue]
20206
+ );
20207
+ return {
20208
+ enabled,
20209
+ wrapContainer,
20210
+ SortableItem,
20211
+ orderedItems
20212
+ };
20213
+ }
20214
+ var RootCtx;
20215
+ var init_useDataDnd = __esm({
20216
+ "components/molecules/useDataDnd.tsx"() {
20217
+ "use client";
20218
+ init_useEventBus();
20219
+ init_Box();
20220
+ RootCtx = React75__default.createContext(null);
20221
+ }
20222
+ });
20027
20223
  function fieldLabel2(key) {
20028
20224
  return key.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
20029
20225
  }
@@ -20087,14 +20283,33 @@ function DataGrid({
20087
20283
  hasMore,
20088
20284
  children,
20089
20285
  pageSize = 0,
20090
- renderItem: schemaRenderItem
20286
+ renderItem: schemaRenderItem,
20287
+ dragGroup,
20288
+ accepts,
20289
+ sortable,
20290
+ dropEvent,
20291
+ reorderEvent,
20292
+ dndItemIdField,
20293
+ dndRoot
20091
20294
  }) {
20092
20295
  const eventBus = useEventBus();
20093
20296
  const { t } = useTranslate();
20094
20297
  const [selectedIds, setSelectedIds] = useState(/* @__PURE__ */ new Set());
20095
20298
  const [visibleCount, setVisibleCount] = useState(pageSize || Infinity);
20096
20299
  const fieldDefs = fields ?? columns ?? [];
20097
- const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
20300
+ const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
20301
+ const dnd = useDataDnd({
20302
+ items: allDataRaw,
20303
+ layout: "grid",
20304
+ dragGroup,
20305
+ accepts,
20306
+ sortable,
20307
+ dropEvent,
20308
+ reorderEvent,
20309
+ dndItemIdField,
20310
+ dndRoot
20311
+ });
20312
+ const allData = dnd.orderedItems;
20098
20313
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
20099
20314
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
20100
20315
  const toggleSelection = useCallback((id) => {
@@ -20166,196 +20381,205 @@ function DataGrid({
20166
20381
  const allIds = data.map((item, i) => item.id || String(i));
20167
20382
  const allSelected = allIds.length > 0 && allIds.every((id) => selectedIds.has(id));
20168
20383
  const someSelected = selectedIds.size > 0;
20169
- return /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
20170
- selectable && someSelected && /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "items-center px-2 py-2 bg-muted rounded-sm", children: [
20384
+ const idFieldName = dndItemIdField ?? "id";
20385
+ return dnd.wrapContainer(
20386
+ /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
20387
+ selectable && someSelected && /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "items-center px-2 py-2 bg-muted rounded-sm", children: [
20388
+ /* @__PURE__ */ jsx(
20389
+ "input",
20390
+ {
20391
+ type: "checkbox",
20392
+ checked: allSelected,
20393
+ onChange: toggleAll,
20394
+ className: "w-4 h-4 accent-primary",
20395
+ "aria-label": "Select all"
20396
+ }
20397
+ ),
20398
+ /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "font-semibold", children: [
20399
+ selectedIds.size,
20400
+ " ",
20401
+ t("common.selected") || "selected"
20402
+ ] })
20403
+ ] }),
20171
20404
  /* @__PURE__ */ jsx(
20172
- "input",
20405
+ Box,
20173
20406
  {
20174
- type: "checkbox",
20175
- checked: allSelected,
20176
- onChange: toggleAll,
20177
- className: "w-4 h-4 accent-primary",
20178
- "aria-label": "Select all"
20179
- }
20180
- ),
20181
- /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "font-semibold", children: [
20182
- selectedIds.size,
20183
- " ",
20184
- t("common.selected") || "selected"
20185
- ] })
20186
- ] }),
20187
- /* @__PURE__ */ jsx(
20188
- Box,
20189
- {
20190
- className: cn("grid", gapStyles6[gap], colsClass, className),
20191
- style: gridTemplateColumns ? { gridTemplateColumns } : void 0,
20192
- children: data.map((item, index) => {
20193
- const itemData = item;
20194
- const id = itemData.id || String(index);
20195
- const isSelected = selectedIds.has(id);
20196
- if (hasRenderProp) {
20197
- return /* @__PURE__ */ jsx(
20198
- Box,
20199
- {
20200
- "data-entity-row": true,
20201
- "data-entity-id": id,
20202
- className: cn(isSelected && "ring-2 ring-primary rounded-lg"),
20203
- children: children(itemData, index)
20204
- },
20205
- id
20206
- );
20207
- }
20208
- const titleValue = getNestedValue(itemData, titleField?.name ?? "");
20209
- return /* @__PURE__ */ jsxs(
20210
- Box,
20211
- {
20212
- "data-entity-row": true,
20213
- "data-entity-id": id,
20214
- className: cn(
20215
- "bg-card rounded-lg",
20216
- "border border-border",
20217
- "shadow-sm hover:shadow-lg",
20218
- "hover:border-primary transition-all",
20219
- "flex flex-col",
20220
- isSelected && "ring-2 ring-primary border-primary"
20221
- ),
20222
- children: [
20223
- imageField && (() => {
20224
- const imgUrl = getNestedValue(itemData, imageField);
20225
- if (!imgUrl || typeof imgUrl !== "string") return null;
20226
- return /* @__PURE__ */ jsx(Box, { className: "w-full aspect-video overflow-hidden rounded-t-lg", children: /* @__PURE__ */ jsx(
20227
- "img",
20228
- {
20229
- src: imgUrl,
20230
- alt: titleValue !== void 0 ? String(titleValue) : "",
20231
- className: "w-full h-full object-cover",
20232
- loading: "lazy"
20233
- }
20234
- ) });
20235
- })(),
20236
- /* @__PURE__ */ jsx(Box, { className: "p-4 pb-0", children: /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-start", children: [
20237
- selectable && /* @__PURE__ */ jsx(
20238
- "input",
20239
- {
20240
- type: "checkbox",
20241
- checked: isSelected,
20242
- onChange: () => toggleSelection(id),
20243
- onClick: (e) => e.stopPropagation(),
20244
- className: "w-4 h-4 mt-1 flex-shrink-0 accent-primary",
20245
- "aria-label": `Select ${titleValue !== void 0 ? String(titleValue) : "item"}`
20246
- }
20407
+ className: cn("grid", gapStyles6[gap], colsClass, className),
20408
+ style: gridTemplateColumns ? { gridTemplateColumns } : void 0,
20409
+ children: data.map((item, index) => {
20410
+ const itemData = item;
20411
+ const id = itemData.id || String(index);
20412
+ const isSelected = selectedIds.has(id);
20413
+ const dndId = itemData[idFieldName] ?? `__idx_${index}`;
20414
+ const wrapDnd = (node) => dnd.enabled ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
20415
+ if (hasRenderProp) {
20416
+ return wrapDnd(
20417
+ /* @__PURE__ */ jsx(
20418
+ Box,
20419
+ {
20420
+ "data-entity-row": true,
20421
+ "data-entity-id": id,
20422
+ className: cn(isSelected && "ring-2 ring-primary rounded-lg"),
20423
+ children: children(itemData, index)
20424
+ },
20425
+ id
20426
+ )
20427
+ );
20428
+ }
20429
+ const titleValue = getNestedValue(itemData, titleField?.name ?? "");
20430
+ return wrapDnd(
20431
+ /* @__PURE__ */ jsxs(
20432
+ Box,
20433
+ {
20434
+ "data-entity-row": true,
20435
+ "data-entity-id": id,
20436
+ className: cn(
20437
+ "bg-card rounded-lg",
20438
+ "border border-border",
20439
+ "shadow-sm hover:shadow-lg",
20440
+ "hover:border-primary transition-all",
20441
+ "flex flex-col",
20442
+ isSelected && "ring-2 ring-primary border-primary"
20247
20443
  ),
20248
- /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: "flex-1 min-w-0", children: [
20249
- titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
20250
- titleField?.icon && /* @__PURE__ */ jsx(Icon, { name: titleField.icon, size: "sm", className: "text-primary flex-shrink-0" }),
20251
- /* @__PURE__ */ jsx(
20252
- Typography,
20444
+ children: [
20445
+ imageField && (() => {
20446
+ const imgUrl = getNestedValue(itemData, imageField);
20447
+ if (!imgUrl || typeof imgUrl !== "string") return null;
20448
+ return /* @__PURE__ */ jsx(Box, { className: "w-full aspect-video overflow-hidden rounded-t-lg", children: /* @__PURE__ */ jsx(
20449
+ "img",
20253
20450
  {
20254
- variant: titleField?.variant === "h3" ? "h3" : "h4",
20255
- className: "font-semibold truncate",
20256
- children: String(titleValue)
20451
+ src: imgUrl,
20452
+ alt: titleValue !== void 0 ? String(titleValue) : "",
20453
+ className: "w-full h-full object-cover",
20454
+ loading: "lazy"
20257
20455
  }
20258
- )
20259
- ] }),
20260
- badgeFields.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap", children: badgeFields.map((field) => {
20261
- const val = getNestedValue(itemData, field.name);
20262
- if (val === void 0 || val === null) return null;
20263
- return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
20264
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
20265
- /* @__PURE__ */ jsx(Badge, { variant: resolveBadgeVariant(field, String(val)), children: String(val) })
20266
- ] }, field.name);
20267
- }) })
20268
- ] }),
20269
- dangerActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: dangerActions.map((action, idx) => /* @__PURE__ */ jsxs(
20270
- Button,
20271
- {
20272
- variant: "ghost",
20273
- size: "sm",
20274
- onClick: handleActionClick(action, itemData),
20275
- "data-testid": `action-${action.event}`,
20276
- "data-row-id": String(itemData.id),
20277
- className: "text-error hover:text-error hover:bg-error/10 px-2",
20278
- children: [
20279
- action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs" }),
20280
- action.label
20281
- ]
20282
- },
20283
- idx
20284
- )) })
20285
- ] }) }),
20286
- bodyFields.length > 0 && /* @__PURE__ */ jsx(Box, { className: "px-4 py-3 flex-1", children: /* @__PURE__ */ jsx(VStack, { gap: "xs", children: bodyFields.map((field) => {
20287
- const value = getNestedValue(itemData, field.name);
20288
- if (value === void 0 || value === null || value === "") return null;
20289
- if (field.format === "boolean") {
20290
- return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-center", children: [
20291
- /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
20292
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
20293
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
20456
+ ) });
20457
+ })(),
20458
+ /* @__PURE__ */ jsx(Box, { className: "p-4 pb-0", children: /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-start", children: [
20459
+ selectable && /* @__PURE__ */ jsx(
20460
+ "input",
20461
+ {
20462
+ type: "checkbox",
20463
+ checked: isSelected,
20464
+ onChange: () => toggleSelection(id),
20465
+ onClick: (e) => e.stopPropagation(),
20466
+ className: "w-4 h-4 mt-1 flex-shrink-0 accent-primary",
20467
+ "aria-label": `Select ${titleValue !== void 0 ? String(titleValue) : "item"}`
20468
+ }
20469
+ ),
20470
+ /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: "flex-1 min-w-0", children: [
20471
+ titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
20472
+ titleField?.icon && /* @__PURE__ */ jsx(Icon, { name: titleField.icon, size: "sm", className: "text-primary flex-shrink-0" }),
20473
+ /* @__PURE__ */ jsx(
20474
+ Typography,
20475
+ {
20476
+ variant: titleField?.variant === "h3" ? "h3" : "h4",
20477
+ className: "font-semibold truncate",
20478
+ children: String(titleValue)
20479
+ }
20480
+ )
20481
+ ] }),
20482
+ badgeFields.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap", children: badgeFields.map((field) => {
20483
+ const val = getNestedValue(itemData, field.name);
20484
+ if (val === void 0 || val === null) return null;
20485
+ return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
20486
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
20487
+ /* @__PURE__ */ jsx(Badge, { variant: resolveBadgeVariant(field, String(val)), children: String(val) })
20488
+ ] }, field.name);
20489
+ }) })
20294
20490
  ] }),
20295
- /* @__PURE__ */ jsx(Badge, { variant: value ? "success" : "neutral", children: value ? t("common.yes") || "Yes" : t("common.no") || "No" })
20296
- ] }, field.name);
20297
- }
20298
- return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-center", children: [
20299
- /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
20300
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
20301
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
20302
- ] }),
20303
- /* @__PURE__ */ jsx(
20304
- Typography,
20305
- {
20306
- variant: field.variant === "caption" ? "caption" : "small",
20307
- className: "text-right truncate max-w-[60%]",
20308
- children: formatValue(value, field.format)
20491
+ dangerActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: dangerActions.map((action, idx) => /* @__PURE__ */ jsxs(
20492
+ Button,
20493
+ {
20494
+ variant: "ghost",
20495
+ size: "sm",
20496
+ onClick: handleActionClick(action, itemData),
20497
+ "data-testid": `action-${action.event}`,
20498
+ "data-row-id": String(itemData.id),
20499
+ className: "text-error hover:text-error hover:bg-error/10 px-2",
20500
+ children: [
20501
+ action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs" }),
20502
+ action.label
20503
+ ]
20504
+ },
20505
+ idx
20506
+ )) })
20507
+ ] }) }),
20508
+ bodyFields.length > 0 && /* @__PURE__ */ jsx(Box, { className: "px-4 py-3 flex-1", children: /* @__PURE__ */ jsx(VStack, { gap: "xs", children: bodyFields.map((field) => {
20509
+ const value = getNestedValue(itemData, field.name);
20510
+ if (value === void 0 || value === null || value === "") return null;
20511
+ if (field.format === "boolean") {
20512
+ return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-center", children: [
20513
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
20514
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
20515
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
20516
+ ] }),
20517
+ /* @__PURE__ */ jsx(Badge, { variant: value ? "success" : "neutral", children: value ? t("common.yes") || "Yes" : t("common.no") || "No" })
20518
+ ] }, field.name);
20309
20519
  }
20310
- )
20311
- ] }, field.name);
20312
- }) }) }),
20313
- primaryActions.length > 0 && /* @__PURE__ */ jsx(Box, { className: "px-4 py-3 mt-auto border-t border-border", children: /* @__PURE__ */ jsx(HStack, { gap: "sm", className: "justify-end", children: primaryActions.map((action, idx) => /* @__PURE__ */ jsxs(
20314
- Button,
20315
- {
20316
- variant: action.variant === "primary" ? "primary" : "ghost",
20317
- size: "sm",
20318
- onClick: handleActionClick(action, itemData),
20319
- "data-testid": `action-${action.event}`,
20320
- "data-row-id": String(itemData.id),
20321
- children: [
20322
- action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
20323
- action.label
20324
- ]
20325
- },
20326
- idx
20327
- )) }) })
20328
- ]
20329
- },
20330
- id
20331
- );
20332
- })
20333
- }
20334
- ),
20335
- hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
20336
- Button,
20337
- {
20338
- variant: "ghost",
20339
- size: "sm",
20340
- onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
20341
- children: [
20342
- /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
20343
- t("common.showMore"),
20344
- " (",
20345
- allData.length - visibleCount,
20346
- " remaining)"
20347
- ]
20348
- }
20349
- ) }),
20350
- infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
20351
- InfiniteScrollSentinel,
20352
- {
20353
- loadMoreEvent,
20354
- isLoading,
20355
- hasMore
20356
- }
20357
- )
20358
- ] });
20520
+ return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-center", children: [
20521
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
20522
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
20523
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
20524
+ ] }),
20525
+ /* @__PURE__ */ jsx(
20526
+ Typography,
20527
+ {
20528
+ variant: field.variant === "caption" ? "caption" : "small",
20529
+ className: "text-right truncate max-w-[60%]",
20530
+ children: formatValue(value, field.format)
20531
+ }
20532
+ )
20533
+ ] }, field.name);
20534
+ }) }) }),
20535
+ primaryActions.length > 0 && /* @__PURE__ */ jsx(Box, { className: "px-4 py-3 mt-auto border-t border-border", children: /* @__PURE__ */ jsx(HStack, { gap: "sm", className: "justify-end", children: primaryActions.map((action, idx) => /* @__PURE__ */ jsxs(
20536
+ Button,
20537
+ {
20538
+ variant: action.variant === "primary" ? "primary" : "ghost",
20539
+ size: "sm",
20540
+ onClick: handleActionClick(action, itemData),
20541
+ "data-testid": `action-${action.event}`,
20542
+ "data-row-id": String(itemData.id),
20543
+ children: [
20544
+ action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
20545
+ action.label
20546
+ ]
20547
+ },
20548
+ idx
20549
+ )) }) })
20550
+ ]
20551
+ },
20552
+ id
20553
+ )
20554
+ );
20555
+ })
20556
+ }
20557
+ ),
20558
+ hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
20559
+ Button,
20560
+ {
20561
+ variant: "ghost",
20562
+ size: "sm",
20563
+ onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
20564
+ children: [
20565
+ /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
20566
+ t("common.showMore"),
20567
+ " (",
20568
+ allData.length - visibleCount,
20569
+ " remaining)"
20570
+ ]
20571
+ }
20572
+ ) }),
20573
+ infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
20574
+ InfiniteScrollSentinel,
20575
+ {
20576
+ loadMoreEvent,
20577
+ isLoading,
20578
+ hasMore
20579
+ }
20580
+ )
20581
+ ] })
20582
+ );
20359
20583
  }
20360
20584
  var dataGridLog, BADGE_VARIANTS, gapStyles6;
20361
20585
  var init_DataGrid = __esm({
@@ -20372,6 +20596,7 @@ var init_DataGrid = __esm({
20372
20596
  init_Button();
20373
20597
  init_Icon();
20374
20598
  init_InfiniteScrollSentinel();
20599
+ init_useDataDnd();
20375
20600
  dataGridLog = createLogger("almadar:ui:data-grid");
20376
20601
  BADGE_VARIANTS = /* @__PURE__ */ new Set([
20377
20602
  "default",
@@ -20466,17 +20691,36 @@ function DataList({
20466
20691
  hasMore,
20467
20692
  children,
20468
20693
  pageSize = 5,
20469
- renderItem: schemaRenderItem
20694
+ renderItem: schemaRenderItem,
20695
+ dragGroup,
20696
+ accepts,
20697
+ sortable: sortableProp,
20698
+ dropEvent,
20699
+ reorderEvent: dndReorderEvent,
20700
+ dndItemIdField,
20701
+ dndRoot
20470
20702
  }) {
20471
20703
  const eventBus = useEventBus();
20472
20704
  const { t } = useTranslate();
20473
- const [visibleCount, setVisibleCount] = React131__default.useState(pageSize || Infinity);
20705
+ const [visibleCount, setVisibleCount] = React75__default.useState(pageSize || Infinity);
20474
20706
  const fieldDefs = fields ?? columns ?? [];
20475
- const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
20707
+ const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
20708
+ const dnd = useDataDnd({
20709
+ items: allDataRaw,
20710
+ layout: "list",
20711
+ dragGroup,
20712
+ accepts,
20713
+ sortable: sortableProp,
20714
+ dropEvent,
20715
+ reorderEvent: dndReorderEvent,
20716
+ dndItemIdField,
20717
+ dndRoot
20718
+ });
20719
+ const allData = dnd.orderedItems;
20476
20720
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
20477
20721
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
20478
20722
  const hasRenderProp = typeof children === "function";
20479
- React131__default.useEffect(() => {
20723
+ React75__default.useEffect(() => {
20480
20724
  const renderItemTypeOf = typeof schemaRenderItem;
20481
20725
  const childrenTypeOf = typeof children;
20482
20726
  if (data.length > 0 && !hasRenderProp) {
@@ -20532,7 +20776,7 @@ function DataList({
20532
20776
  const items2 = data.map((item) => item);
20533
20777
  const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
20534
20778
  const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
20535
- return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React131__default.Fragment, { children: [
20779
+ return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React75__default.Fragment, { children: [
20536
20780
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
20537
20781
  group.items.map((itemData, index) => {
20538
20782
  const id = itemData.id || `${gi}-${index}`;
@@ -20580,18 +20824,112 @@ function DataList({
20580
20824
  }
20581
20825
  const items = data.map((item) => item);
20582
20826
  const groups = groupBy ? groupData(items, groupBy) : [{ label: "", items }];
20827
+ const idFieldName = dndItemIdField ?? "id";
20583
20828
  const renderItem = (itemData, index, isLast) => {
20829
+ const dndId = itemData[idFieldName] ?? `__idx_${index}`;
20830
+ const wrapDnd = (node) => dnd.enabled ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
20584
20831
  if (hasRenderProp) {
20585
20832
  const id2 = itemData.id || String(index);
20586
- return /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id2, children: [
20587
- /* @__PURE__ */ jsxs(Box, { className: "group flex items-stretch gap-2", children: [
20588
- /* @__PURE__ */ jsx(Box, { className: "flex-1 min-w-0", children: children(itemData, index) }),
20589
- itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(
20590
- HStack,
20591
- {
20592
- gap: "xs",
20593
- className: "flex-shrink-0",
20594
- children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
20833
+ return wrapDnd(
20834
+ /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id2, children: [
20835
+ /* @__PURE__ */ jsxs(Box, { className: "group flex items-stretch gap-2", children: [
20836
+ /* @__PURE__ */ jsx(Box, { className: "flex-1 min-w-0", children: children(itemData, index) }),
20837
+ itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(
20838
+ HStack,
20839
+ {
20840
+ gap: "xs",
20841
+ className: "flex-shrink-0",
20842
+ children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
20843
+ Button,
20844
+ {
20845
+ variant: action.variant ?? "ghost",
20846
+ size: "sm",
20847
+ onClick: handleActionClick(action, itemData),
20848
+ "data-testid": `action-${action.event}`,
20849
+ "data-row-id": String(itemData.id),
20850
+ className: cn(
20851
+ action.variant === "danger" && "text-error hover:bg-error/10"
20852
+ ),
20853
+ children: [
20854
+ action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
20855
+ action.label
20856
+ ]
20857
+ },
20858
+ idx
20859
+ ))
20860
+ }
20861
+ )
20862
+ ] }),
20863
+ isCard && !isLast && /* @__PURE__ */ jsx(Box, { className: "mx-6 border-b border-border/40" })
20864
+ ] }, id2)
20865
+ );
20866
+ }
20867
+ const id = itemData.id || String(index);
20868
+ const titleValue = getNestedValue(itemData, titleField?.name ?? "");
20869
+ return wrapDnd(
20870
+ /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id, children: [
20871
+ /* @__PURE__ */ jsxs(
20872
+ Box,
20873
+ {
20874
+ className: cn(
20875
+ "group flex items-center gap-4 transition-all duration-200",
20876
+ isCompact ? "px-4 py-2" : "px-6 py-4",
20877
+ "hover:bg-muted/80",
20878
+ !isCard && !isCompact && "rounded-lg border border-transparent hover:border-border"
20879
+ ),
20880
+ children: [
20881
+ /* @__PURE__ */ jsxs(Box, { className: "flex-1 min-w-0", children: [
20882
+ /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "items-center", children: [
20883
+ titleField?.icon && /* @__PURE__ */ jsx(
20884
+ Icon,
20885
+ {
20886
+ name: titleField.icon,
20887
+ size: isCompact ? "xs" : "sm",
20888
+ className: "text-primary flex-shrink-0"
20889
+ }
20890
+ ),
20891
+ titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsx(
20892
+ Typography,
20893
+ {
20894
+ variant: titleField?.variant === "h3" ? "h3" : "h4",
20895
+ className: cn("font-semibold truncate flex-1", isCompact && "text-sm"),
20896
+ children: String(titleValue)
20897
+ }
20898
+ ),
20899
+ badgeFields.map((field) => {
20900
+ const val = getNestedValue(itemData, field.name);
20901
+ if (val === void 0 || val === null) return null;
20902
+ return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center flex-shrink-0", children: [
20903
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
20904
+ /* @__PURE__ */ jsx(Badge, { variant: statusVariant3(String(val)), children: String(val) })
20905
+ ] }, field.name);
20906
+ })
20907
+ ] }),
20908
+ bodyFields.length > 0 && !isCompact && /* @__PURE__ */ jsx(HStack, { gap: "md", className: "mt-1.5 flex-wrap", children: bodyFields.map((field) => {
20909
+ const value = getNestedValue(itemData, field.name);
20910
+ if (value === void 0 || value === null || value === "") return null;
20911
+ return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
20912
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
20913
+ /* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "secondary", children: [
20914
+ field.label ?? fieldLabel3(field.name),
20915
+ ":"
20916
+ ] }),
20917
+ /* @__PURE__ */ jsx(Typography, { variant: "small", children: formatValue2(value, field.format) })
20918
+ ] }, field.name);
20919
+ }) }),
20920
+ progressFields.map((field) => {
20921
+ const value = getNestedValue(itemData, field.name);
20922
+ if (typeof value !== "number") return null;
20923
+ return /* @__PURE__ */ jsxs(Box, { className: "mt-2 max-w-xs", children: [
20924
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center mb-1", children: [
20925
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
20926
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel3(field.name) })
20927
+ ] }),
20928
+ /* @__PURE__ */ jsx(ProgressBar, { value, max: 100 })
20929
+ ] }, field.name);
20930
+ })
20931
+ ] }),
20932
+ itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
20595
20933
  Button,
20596
20934
  {
20597
20935
  variant: action.variant ?? "ghost",
@@ -20608,141 +20946,56 @@ function DataList({
20608
20946
  ]
20609
20947
  },
20610
20948
  idx
20611
- ))
20612
- }
20613
- )
20614
- ] }),
20949
+ )) })
20950
+ ]
20951
+ }
20952
+ ),
20615
20953
  isCard && !isLast && /* @__PURE__ */ jsx(Box, { className: "mx-6 border-b border-border/40" })
20616
- ] }, id2);
20617
- }
20618
- const id = itemData.id || String(index);
20619
- const titleValue = getNestedValue(itemData, titleField?.name ?? "");
20620
- return /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id, children: [
20621
- /* @__PURE__ */ jsxs(
20622
- Box,
20623
- {
20624
- className: cn(
20625
- "group flex items-center gap-4 transition-all duration-200",
20626
- isCompact ? "px-4 py-2" : "px-6 py-4",
20627
- "hover:bg-muted/80",
20628
- !isCard && !isCompact && "rounded-lg border border-transparent hover:border-border"
20629
- ),
20630
- children: [
20631
- /* @__PURE__ */ jsxs(Box, { className: "flex-1 min-w-0", children: [
20632
- /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "items-center", children: [
20633
- titleField?.icon && /* @__PURE__ */ jsx(
20634
- Icon,
20635
- {
20636
- name: titleField.icon,
20637
- size: isCompact ? "xs" : "sm",
20638
- className: "text-primary flex-shrink-0"
20639
- }
20640
- ),
20641
- titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsx(
20642
- Typography,
20643
- {
20644
- variant: titleField?.variant === "h3" ? "h3" : "h4",
20645
- className: cn("font-semibold truncate flex-1", isCompact && "text-sm"),
20646
- children: String(titleValue)
20647
- }
20648
- ),
20649
- badgeFields.map((field) => {
20650
- const val = getNestedValue(itemData, field.name);
20651
- if (val === void 0 || val === null) return null;
20652
- return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center flex-shrink-0", children: [
20653
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
20654
- /* @__PURE__ */ jsx(Badge, { variant: statusVariant3(String(val)), children: String(val) })
20655
- ] }, field.name);
20656
- })
20657
- ] }),
20658
- bodyFields.length > 0 && !isCompact && /* @__PURE__ */ jsx(HStack, { gap: "md", className: "mt-1.5 flex-wrap", children: bodyFields.map((field) => {
20659
- const value = getNestedValue(itemData, field.name);
20660
- if (value === void 0 || value === null || value === "") return null;
20661
- return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
20662
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
20663
- /* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "secondary", children: [
20664
- field.label ?? fieldLabel3(field.name),
20665
- ":"
20666
- ] }),
20667
- /* @__PURE__ */ jsx(Typography, { variant: "small", children: formatValue2(value, field.format) })
20668
- ] }, field.name);
20669
- }) }),
20670
- progressFields.map((field) => {
20671
- const value = getNestedValue(itemData, field.name);
20672
- if (typeof value !== "number") return null;
20673
- return /* @__PURE__ */ jsxs(Box, { className: "mt-2 max-w-xs", children: [
20674
- /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center mb-1", children: [
20675
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
20676
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel3(field.name) })
20677
- ] }),
20678
- /* @__PURE__ */ jsx(ProgressBar, { value, max: 100 })
20679
- ] }, field.name);
20680
- })
20681
- ] }),
20682
- itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
20683
- Button,
20684
- {
20685
- variant: action.variant ?? "ghost",
20686
- size: "sm",
20687
- onClick: handleActionClick(action, itemData),
20688
- "data-testid": `action-${action.event}`,
20689
- "data-row-id": String(itemData.id),
20690
- className: cn(
20691
- action.variant === "danger" && "text-error hover:bg-error/10"
20692
- ),
20693
- children: [
20694
- action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
20695
- action.label
20696
- ]
20697
- },
20698
- idx
20699
- )) })
20700
- ]
20701
- }
20702
- ),
20703
- isCard && !isLast && /* @__PURE__ */ jsx(Box, { className: "mx-6 border-b border-border/40" })
20704
- ] }, id);
20954
+ ] }, id)
20955
+ );
20705
20956
  };
20706
- return /* @__PURE__ */ jsxs(
20707
- Box,
20708
- {
20709
- className: cn(
20710
- isCard && "bg-card rounded-xl border border-border shadow-lg overflow-hidden",
20711
- !isCard && gapClass,
20712
- className
20713
- ),
20714
- children: [
20715
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React131__default.Fragment, { children: [
20716
- group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
20717
- group.items.map(
20718
- (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
20957
+ return dnd.wrapContainer(
20958
+ /* @__PURE__ */ jsxs(
20959
+ Box,
20960
+ {
20961
+ className: cn(
20962
+ isCard && "bg-card rounded-xl border border-border shadow-lg overflow-hidden",
20963
+ !isCard && gapClass,
20964
+ className
20965
+ ),
20966
+ children: [
20967
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React75__default.Fragment, { children: [
20968
+ group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
20969
+ group.items.map(
20970
+ (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
20971
+ )
20972
+ ] }, gi)),
20973
+ hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
20974
+ Button,
20975
+ {
20976
+ variant: "ghost",
20977
+ size: "sm",
20978
+ onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
20979
+ children: [
20980
+ /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
20981
+ t("common.showMore"),
20982
+ " (",
20983
+ allData.length - visibleCount,
20984
+ " remaining)"
20985
+ ]
20986
+ }
20987
+ ) }),
20988
+ infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
20989
+ InfiniteScrollSentinel,
20990
+ {
20991
+ loadMoreEvent,
20992
+ isLoading,
20993
+ hasMore
20994
+ }
20719
20995
  )
20720
- ] }, gi)),
20721
- hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
20722
- Button,
20723
- {
20724
- variant: "ghost",
20725
- size: "sm",
20726
- onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
20727
- children: [
20728
- /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
20729
- t("common.showMore"),
20730
- " (",
20731
- allData.length - visibleCount,
20732
- " remaining)"
20733
- ]
20734
- }
20735
- ) }),
20736
- infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
20737
- InfiniteScrollSentinel,
20738
- {
20739
- loadMoreEvent,
20740
- isLoading,
20741
- hasMore
20742
- }
20743
- )
20744
- ]
20745
- }
20996
+ ]
20997
+ }
20998
+ )
20746
20999
  );
20747
21000
  }
20748
21001
  var dataListLog;
@@ -20762,6 +21015,7 @@ var init_DataList = __esm({
20762
21015
  init_ProgressBar();
20763
21016
  init_Divider();
20764
21017
  init_InfiniteScrollSentinel();
21018
+ init_useDataDnd();
20765
21019
  dataListLog = createLogger("almadar:ui:data-list");
20766
21020
  DataList.displayName = "DataList";
20767
21021
  }
@@ -22020,7 +22274,7 @@ var init_WizardProgress = __esm({
22020
22274
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
22021
22275
  const isActive = index === currentStep;
22022
22276
  const isCompleted = index < currentStep;
22023
- return /* @__PURE__ */ jsxs(React131__default.Fragment, { children: [
22277
+ return /* @__PURE__ */ jsxs(React75__default.Fragment, { children: [
22024
22278
  /* @__PURE__ */ jsx(
22025
22279
  "button",
22026
22280
  {
@@ -22920,9 +23174,9 @@ function ScoreDisplay({
22920
23174
  ...rest
22921
23175
  }) {
22922
23176
  const resolvedValue = typeof value === "number" && !Number.isNaN(value) ? value : typeof rest.score === "number" && !Number.isNaN(rest.score) ? rest.score : 0;
22923
- const [displayValue, setDisplayValue] = React131.useState(resolvedValue);
22924
- const [isAnimating, setIsAnimating] = React131.useState(false);
22925
- React131.useEffect(() => {
23177
+ const [displayValue, setDisplayValue] = React75.useState(resolvedValue);
23178
+ const [isAnimating, setIsAnimating] = React75.useState(false);
23179
+ React75.useEffect(() => {
22926
23180
  if (!animated || displayValue === resolvedValue) {
22927
23181
  setDisplayValue(resolvedValue);
22928
23182
  return;
@@ -23072,7 +23326,7 @@ function InventoryGrid({
23072
23326
  const eventBus = useEventBus();
23073
23327
  const slotCount = totalSlots ?? items.length;
23074
23328
  const emptySlotCount = Math.max(0, slotCount - items.length);
23075
- const handleSelect = React131.useCallback(
23329
+ const handleSelect = React75.useCallback(
23076
23330
  (id) => {
23077
23331
  onSelect?.(id);
23078
23332
  if (selectEvent) {
@@ -23354,15 +23608,15 @@ function GameCanvas2D({
23354
23608
  fps = 60,
23355
23609
  className
23356
23610
  }) {
23357
- const canvasRef = React131.useRef(null);
23358
- const rafRef = React131.useRef(0);
23359
- const frameRef = React131.useRef(0);
23360
- const lastTimeRef = React131.useRef(0);
23361
- const onDrawRef = React131.useRef(onDraw);
23611
+ const canvasRef = React75.useRef(null);
23612
+ const rafRef = React75.useRef(0);
23613
+ const frameRef = React75.useRef(0);
23614
+ const lastTimeRef = React75.useRef(0);
23615
+ const onDrawRef = React75.useRef(onDraw);
23362
23616
  onDrawRef.current = onDraw;
23363
- const onTickRef = React131.useRef(onTick);
23617
+ const onTickRef = React75.useRef(onTick);
23364
23618
  onTickRef.current = onTick;
23365
- React131.useEffect(() => {
23619
+ React75.useEffect(() => {
23366
23620
  const canvas = canvasRef.current;
23367
23621
  if (!canvas) return;
23368
23622
  const ctx = canvas.getContext("2d");
@@ -23703,7 +23957,7 @@ function TurnPanel({
23703
23957
  className
23704
23958
  }) {
23705
23959
  const eventBus = useEventBus();
23706
- const handleAction = React131.useCallback(
23960
+ const handleAction = React75.useCallback(
23707
23961
  (event) => {
23708
23962
  if (event) {
23709
23963
  eventBus.emit(event, { turn: currentTurn, phase, activeTeam });
@@ -23849,7 +24103,7 @@ function UnitCommandBar({
23849
24103
  className
23850
24104
  }) {
23851
24105
  const eventBus = useEventBus();
23852
- const handleCommand = React131.useCallback(
24106
+ const handleCommand = React75.useCallback(
23853
24107
  (event) => {
23854
24108
  if (event) {
23855
24109
  eventBus.emit(event, { unitId: selectedUnitId });
@@ -24334,7 +24588,7 @@ function GameMenu({
24334
24588
  } catch {
24335
24589
  }
24336
24590
  const eventBus = eventBusProp || eventBusFromHook;
24337
- const handleOptionClick = React131.useCallback(
24591
+ const handleOptionClick = React75.useCallback(
24338
24592
  (option) => {
24339
24593
  if (option.event && eventBus) {
24340
24594
  eventBus.emit(`UI:${option.event}`, { option });
@@ -24448,7 +24702,7 @@ function GameOverScreen({
24448
24702
  } catch {
24449
24703
  }
24450
24704
  const eventBus = eventBusProp || eventBusFromHook;
24451
- const handleActionClick = React131.useCallback(
24705
+ const handleActionClick = React75.useCallback(
24452
24706
  (action) => {
24453
24707
  if (action.event && eventBus) {
24454
24708
  eventBus.emit(`UI:${action.event}`, { action });
@@ -27097,7 +27351,7 @@ var init_StepFlow = __esm({
27097
27351
  className
27098
27352
  }) => {
27099
27353
  if (orientation === "vertical") {
27100
- return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React131__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
27354
+ return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React75__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
27101
27355
  /* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
27102
27356
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
27103
27357
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
@@ -27108,7 +27362,7 @@ var init_StepFlow = __esm({
27108
27362
  ] })
27109
27363
  ] }) }, index)) });
27110
27364
  }
27111
- return /* @__PURE__ */ jsx(Box, { className: cn("w-full flex flex-col md:flex-row items-start gap-0", className), children: steps.map((step, index) => /* @__PURE__ */ jsxs(React131__default.Fragment, { children: [
27365
+ return /* @__PURE__ */ jsx(Box, { className: cn("w-full flex flex-col md:flex-row items-start gap-0", className), children: steps.map((step, index) => /* @__PURE__ */ jsxs(React75__default.Fragment, { children: [
27112
27366
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
27113
27367
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
27114
27368
  /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -27990,7 +28244,7 @@ var init_LikertScale = __esm({
27990
28244
  md: "text-base",
27991
28245
  lg: "text-lg"
27992
28246
  };
27993
- LikertScale = React131__default.forwardRef(
28247
+ LikertScale = React75__default.forwardRef(
27994
28248
  ({
27995
28249
  question,
27996
28250
  options = DEFAULT_LIKERT_OPTIONS,
@@ -28002,7 +28256,7 @@ var init_LikertScale = __esm({
28002
28256
  variant = "radios",
28003
28257
  className
28004
28258
  }, ref) => {
28005
- const groupId = React131__default.useId();
28259
+ const groupId = React75__default.useId();
28006
28260
  const eventBus = useEventBus();
28007
28261
  const handleSelect = useCallback(
28008
28262
  (next) => {
@@ -30228,7 +30482,7 @@ var init_DocBreadcrumb = __esm({
30228
30482
  "aria-label": "Breadcrumb",
30229
30483
  children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", wrap: true, children: items.map((item, idx) => {
30230
30484
  const isLast = idx === items.length - 1;
30231
- return /* @__PURE__ */ jsxs(React131__default.Fragment, { children: [
30485
+ return /* @__PURE__ */ jsxs(React75__default.Fragment, { children: [
30232
30486
  idx > 0 && /* @__PURE__ */ jsx(
30233
30487
  Icon,
30234
30488
  {
@@ -31118,7 +31372,7 @@ var init_MiniStateMachine = __esm({
31118
31372
  const x = 2 + i * (NODE_W + GAP + ARROW_W + GAP);
31119
31373
  const tc = transitionCounts[s.name] ?? 0;
31120
31374
  const role = getStateRole(s.name, s.isInitial, s.isTerminal, tc, maxTC);
31121
- return /* @__PURE__ */ jsxs(React131__default.Fragment, { children: [
31375
+ return /* @__PURE__ */ jsxs(React75__default.Fragment, { children: [
31122
31376
  /* @__PURE__ */ jsx(
31123
31377
  AvlState,
31124
31378
  {
@@ -32631,7 +32885,7 @@ var init_DocumentViewer = __esm({
32631
32885
  }
32632
32886
  });
32633
32887
  function extractTitle(children) {
32634
- if (!React131__default.isValidElement(children)) return void 0;
32888
+ if (!React75__default.isValidElement(children)) return void 0;
32635
32889
  const props = children.props;
32636
32890
  if (typeof props.title === "string") {
32637
32891
  return props.title;
@@ -32743,7 +32997,7 @@ function LinearView({
32743
32997
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
32744
32998
  const isDone = i < currentIdx;
32745
32999
  const isCurrent = i === currentIdx;
32746
- return /* @__PURE__ */ jsxs(React131__default.Fragment, { children: [
33000
+ return /* @__PURE__ */ jsxs(React75__default.Fragment, { children: [
32747
33001
  i > 0 && /* @__PURE__ */ jsx(
32748
33002
  Typography,
32749
33003
  {
@@ -33643,12 +33897,12 @@ var init_Form = __esm({
33643
33897
  const isSchemaEntity = isOrbitalEntitySchema(entity);
33644
33898
  const resolvedEntity = isSchemaEntity ? entity : void 0;
33645
33899
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
33646
- const normalizedInitialData = React131__default.useMemo(() => {
33900
+ const normalizedInitialData = React75__default.useMemo(() => {
33647
33901
  const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
33648
33902
  const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
33649
33903
  return entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
33650
33904
  }, [entity, initialData]);
33651
- const entityDerivedFields = React131__default.useMemo(() => {
33905
+ const entityDerivedFields = React75__default.useMemo(() => {
33652
33906
  if (fields && fields.length > 0) return void 0;
33653
33907
  if (!resolvedEntity) return void 0;
33654
33908
  return resolvedEntity.fields.map(
@@ -33667,16 +33921,16 @@ var init_Form = __esm({
33667
33921
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
33668
33922
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
33669
33923
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
33670
- const [formData, setFormData] = React131__default.useState(
33924
+ const [formData, setFormData] = React75__default.useState(
33671
33925
  normalizedInitialData
33672
33926
  );
33673
- const [collapsedSections, setCollapsedSections] = React131__default.useState(
33927
+ const [collapsedSections, setCollapsedSections] = React75__default.useState(
33674
33928
  /* @__PURE__ */ new Set()
33675
33929
  );
33676
- const [submitError, setSubmitError] = React131__default.useState(null);
33677
- const formRef = React131__default.useRef(null);
33930
+ const [submitError, setSubmitError] = React75__default.useState(null);
33931
+ const formRef = React75__default.useRef(null);
33678
33932
  const formMode = props.mode;
33679
- const mountedRef = React131__default.useRef(false);
33933
+ const mountedRef = React75__default.useRef(false);
33680
33934
  if (!mountedRef.current) {
33681
33935
  mountedRef.current = true;
33682
33936
  debug("forms", "mount", {
@@ -33689,7 +33943,7 @@ var init_Form = __esm({
33689
33943
  });
33690
33944
  }
33691
33945
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
33692
- const evalContext = React131__default.useMemo(
33946
+ const evalContext = React75__default.useMemo(
33693
33947
  () => ({
33694
33948
  formValues: formData,
33695
33949
  globalVariables: externalContext?.globalVariables ?? {},
@@ -33698,7 +33952,7 @@ var init_Form = __esm({
33698
33952
  }),
33699
33953
  [formData, externalContext]
33700
33954
  );
33701
- React131__default.useEffect(() => {
33955
+ React75__default.useEffect(() => {
33702
33956
  debug("forms", "initialData-sync", {
33703
33957
  mode: formMode,
33704
33958
  normalizedInitialData,
@@ -33709,7 +33963,7 @@ var init_Form = __esm({
33709
33963
  setFormData(normalizedInitialData);
33710
33964
  }
33711
33965
  }, [normalizedInitialData]);
33712
- const processCalculations = React131__default.useCallback(
33966
+ const processCalculations = React75__default.useCallback(
33713
33967
  (changedFieldId, newFormData) => {
33714
33968
  if (!hiddenCalculations.length) return;
33715
33969
  const context = {
@@ -33734,7 +33988,7 @@ var init_Form = __esm({
33734
33988
  },
33735
33989
  [hiddenCalculations, externalContext, eventBus]
33736
33990
  );
33737
- const checkViolations = React131__default.useCallback(
33991
+ const checkViolations = React75__default.useCallback(
33738
33992
  (changedFieldId, newFormData) => {
33739
33993
  if (!violationTriggers.length) return;
33740
33994
  const context = {
@@ -33772,7 +34026,7 @@ var init_Form = __esm({
33772
34026
  processCalculations(name, newFormData);
33773
34027
  checkViolations(name, newFormData);
33774
34028
  };
33775
- const isFieldVisible = React131__default.useCallback(
34029
+ const isFieldVisible = React75__default.useCallback(
33776
34030
  (fieldName) => {
33777
34031
  const condition = conditionalFields[fieldName];
33778
34032
  if (!condition) return true;
@@ -33780,7 +34034,7 @@ var init_Form = __esm({
33780
34034
  },
33781
34035
  [conditionalFields, evalContext]
33782
34036
  );
33783
- const isSectionVisible = React131__default.useCallback(
34037
+ const isSectionVisible = React75__default.useCallback(
33784
34038
  (section) => {
33785
34039
  if (!section.condition) return true;
33786
34040
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -33856,7 +34110,7 @@ var init_Form = __esm({
33856
34110
  eventBus.emit(`UI:${onCancel}`);
33857
34111
  }
33858
34112
  };
33859
- const renderField = React131__default.useCallback(
34113
+ const renderField = React75__default.useCallback(
33860
34114
  (field) => {
33861
34115
  const fieldName = field.name || field.field;
33862
34116
  if (!fieldName) return null;
@@ -33877,7 +34131,7 @@ var init_Form = __esm({
33877
34131
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
33878
34132
  );
33879
34133
  const effectiveFields = entityDerivedFields ?? fields;
33880
- const normalizedFields = React131__default.useMemo(() => {
34134
+ const normalizedFields = React75__default.useMemo(() => {
33881
34135
  if (!effectiveFields || effectiveFields.length === 0) return [];
33882
34136
  return effectiveFields.map((field) => {
33883
34137
  if (typeof field === "string") {
@@ -33899,7 +34153,7 @@ var init_Form = __esm({
33899
34153
  return field;
33900
34154
  });
33901
34155
  }, [effectiveFields, resolvedEntity]);
33902
- const schemaFields = React131__default.useMemo(() => {
34156
+ const schemaFields = React75__default.useMemo(() => {
33903
34157
  if (normalizedFields.length === 0) return null;
33904
34158
  if (isDebugEnabled()) {
33905
34159
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -33909,7 +34163,7 @@ var init_Form = __esm({
33909
34163
  }
33910
34164
  return normalizedFields.map(renderField).filter(Boolean);
33911
34165
  }, [normalizedFields, renderField, entityName, conditionalFields]);
33912
- const sectionElements = React131__default.useMemo(() => {
34166
+ const sectionElements = React75__default.useMemo(() => {
33913
34167
  if (!sections || sections.length === 0) return null;
33914
34168
  return sections.map((section) => {
33915
34169
  if (!isSectionVisible(section)) {
@@ -35635,7 +35889,7 @@ var init_List = __esm({
35635
35889
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
35636
35890
  return [];
35637
35891
  }, [entity]);
35638
- const getItemActions = React131__default.useCallback(
35892
+ const getItemActions = React75__default.useCallback(
35639
35893
  (item) => {
35640
35894
  if (!itemActions) return [];
35641
35895
  if (typeof itemActions === "function") {
@@ -36108,7 +36362,7 @@ var init_MediaGallery = __esm({
36108
36362
  [selectable, selectedItems, selectionEvent, eventBus]
36109
36363
  );
36110
36364
  const entityData = Array.isArray(entity) ? entity : [];
36111
- const items = React131__default.useMemo(() => {
36365
+ const items = React75__default.useMemo(() => {
36112
36366
  if (propItems) return propItems;
36113
36367
  if (entityData.length === 0) return [];
36114
36368
  return entityData.map((record, idx) => ({
@@ -36281,9 +36535,9 @@ function MiniMap({
36281
36535
  viewportRect,
36282
36536
  className
36283
36537
  }) {
36284
- const canvasRef = React131.useRef(null);
36285
- const frameRef = React131.useRef(0);
36286
- React131.useEffect(() => {
36538
+ const canvasRef = React75.useRef(null);
36539
+ const frameRef = React75.useRef(0);
36540
+ React75.useEffect(() => {
36287
36541
  const canvas = canvasRef.current;
36288
36542
  if (!canvas) return;
36289
36543
  const ctx = canvas.getContext("2d");
@@ -36365,7 +36619,7 @@ var init_MiniMap = __esm({
36365
36619
  }
36366
36620
  });
36367
36621
  function extractTitle2(children) {
36368
- if (!React131__default.isValidElement(children)) return void 0;
36622
+ if (!React75__default.isValidElement(children)) return void 0;
36369
36623
  const props = children.props;
36370
36624
  if (typeof props.title === "string") {
36371
36625
  return props.title;
@@ -37078,7 +37332,7 @@ var init_PageHeader = __esm({
37078
37332
  info: "bg-info/10 text-info"
37079
37333
  };
37080
37334
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
37081
- 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(React131__default.Fragment, { children: [
37335
+ 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(React75__default.Fragment, { children: [
37082
37336
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
37083
37337
  crumb.href ? /* @__PURE__ */ jsx(
37084
37338
  "a",
@@ -37419,7 +37673,7 @@ var init_debugRegistry = __esm({
37419
37673
  }
37420
37674
  });
37421
37675
  function useDebugData() {
37422
- const [data, setData] = React131.useState(() => ({
37676
+ const [data, setData] = React75.useState(() => ({
37423
37677
  traits: [],
37424
37678
  ticks: [],
37425
37679
  guards: [],
@@ -37433,7 +37687,7 @@ function useDebugData() {
37433
37687
  },
37434
37688
  lastUpdate: Date.now()
37435
37689
  }));
37436
- React131.useEffect(() => {
37690
+ React75.useEffect(() => {
37437
37691
  const updateData = () => {
37438
37692
  setData({
37439
37693
  traits: getAllTraits(),
@@ -37542,12 +37796,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
37542
37796
  return positions;
37543
37797
  }
37544
37798
  function WalkMinimap() {
37545
- const [walkStep, setWalkStep] = React131.useState(null);
37546
- const [traits2, setTraits] = React131.useState([]);
37547
- const [coveredEdges, setCoveredEdges] = React131.useState([]);
37548
- const [completedTraits, setCompletedTraits] = React131.useState(/* @__PURE__ */ new Set());
37549
- const prevTraitRef = React131.useRef(null);
37550
- React131.useEffect(() => {
37799
+ const [walkStep, setWalkStep] = React75.useState(null);
37800
+ const [traits2, setTraits] = React75.useState([]);
37801
+ const [coveredEdges, setCoveredEdges] = React75.useState([]);
37802
+ const [completedTraits, setCompletedTraits] = React75.useState(/* @__PURE__ */ new Set());
37803
+ const prevTraitRef = React75.useRef(null);
37804
+ React75.useEffect(() => {
37551
37805
  const interval = setInterval(() => {
37552
37806
  const w = window;
37553
37807
  const step = w.__orbitalWalkStep;
@@ -37994,15 +38248,15 @@ var init_EntitiesTab = __esm({
37994
38248
  }
37995
38249
  });
37996
38250
  function EventFlowTab({ events: events2 }) {
37997
- const [filter, setFilter] = React131.useState("all");
37998
- const containerRef = React131.useRef(null);
37999
- const [autoScroll, setAutoScroll] = React131.useState(true);
38000
- React131.useEffect(() => {
38251
+ const [filter, setFilter] = React75.useState("all");
38252
+ const containerRef = React75.useRef(null);
38253
+ const [autoScroll, setAutoScroll] = React75.useState(true);
38254
+ React75.useEffect(() => {
38001
38255
  if (autoScroll && containerRef.current) {
38002
38256
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
38003
38257
  }
38004
38258
  }, [events2.length, autoScroll]);
38005
- const filteredEvents = React131.useMemo(() => {
38259
+ const filteredEvents = React75.useMemo(() => {
38006
38260
  if (filter === "all") return events2;
38007
38261
  return events2.filter((e) => e.type === filter);
38008
38262
  }, [events2, filter]);
@@ -38121,7 +38375,7 @@ var init_EventFlowTab = __esm({
38121
38375
  }
38122
38376
  });
38123
38377
  function GuardsPanel({ guards }) {
38124
- const [filter, setFilter] = React131.useState("all");
38378
+ const [filter, setFilter] = React75.useState("all");
38125
38379
  if (guards.length === 0) {
38126
38380
  return /* @__PURE__ */ jsx(
38127
38381
  EmptyState,
@@ -38134,7 +38388,7 @@ function GuardsPanel({ guards }) {
38134
38388
  }
38135
38389
  const passedCount = guards.filter((g) => g.result).length;
38136
38390
  const failedCount = guards.length - passedCount;
38137
- const filteredGuards = React131.useMemo(() => {
38391
+ const filteredGuards = React75.useMemo(() => {
38138
38392
  if (filter === "all") return guards;
38139
38393
  if (filter === "passed") return guards.filter((g) => g.result);
38140
38394
  return guards.filter((g) => !g.result);
@@ -38295,10 +38549,10 @@ function EffectBadge({ effect }) {
38295
38549
  ] });
38296
38550
  }
38297
38551
  function TransitionTimeline({ transitions }) {
38298
- const containerRef = React131.useRef(null);
38299
- const [autoScroll, setAutoScroll] = React131.useState(true);
38300
- const [expandedId, setExpandedId] = React131.useState(null);
38301
- React131.useEffect(() => {
38552
+ const containerRef = React75.useRef(null);
38553
+ const [autoScroll, setAutoScroll] = React75.useState(true);
38554
+ const [expandedId, setExpandedId] = React75.useState(null);
38555
+ React75.useEffect(() => {
38302
38556
  if (autoScroll && containerRef.current) {
38303
38557
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
38304
38558
  }
@@ -38584,9 +38838,9 @@ function getAllEvents(traits2) {
38584
38838
  }
38585
38839
  function EventDispatcherTab({ traits: traits2, schema }) {
38586
38840
  const eventBus = useEventBus();
38587
- const [log18, setLog] = React131.useState([]);
38588
- const prevStatesRef = React131.useRef(/* @__PURE__ */ new Map());
38589
- React131.useEffect(() => {
38841
+ const [log18, setLog] = React75.useState([]);
38842
+ const prevStatesRef = React75.useRef(/* @__PURE__ */ new Map());
38843
+ React75.useEffect(() => {
38590
38844
  for (const trait of traits2) {
38591
38845
  const prev = prevStatesRef.current.get(trait.id);
38592
38846
  if (prev && prev !== trait.currentState) {
@@ -38756,10 +39010,10 @@ function VerifyModePanel({
38756
39010
  serverCount,
38757
39011
  localCount
38758
39012
  }) {
38759
- const [expanded, setExpanded] = React131.useState(true);
38760
- const scrollRef = React131.useRef(null);
38761
- const prevCountRef = React131.useRef(0);
38762
- React131.useEffect(() => {
39013
+ const [expanded, setExpanded] = React75.useState(true);
39014
+ const scrollRef = React75.useRef(null);
39015
+ const prevCountRef = React75.useRef(0);
39016
+ React75.useEffect(() => {
38763
39017
  if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
38764
39018
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
38765
39019
  }
@@ -38825,10 +39079,10 @@ function RuntimeDebugger({
38825
39079
  defaultTab,
38826
39080
  schema
38827
39081
  }) {
38828
- const [isCollapsed, setIsCollapsed] = React131.useState(mode === "verify" ? true : defaultCollapsed);
38829
- const [isVisible, setIsVisible] = React131.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
39082
+ const [isCollapsed, setIsCollapsed] = React75.useState(mode === "verify" ? true : defaultCollapsed);
39083
+ const [isVisible, setIsVisible] = React75.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
38830
39084
  const debugData = useDebugData();
38831
- React131.useEffect(() => {
39085
+ React75.useEffect(() => {
38832
39086
  if (mode === "inline") return;
38833
39087
  return onDebugToggle((enabled) => {
38834
39088
  setIsVisible(enabled);
@@ -38837,7 +39091,7 @@ function RuntimeDebugger({
38837
39091
  }
38838
39092
  });
38839
39093
  }, [mode]);
38840
- React131.useEffect(() => {
39094
+ React75.useEffect(() => {
38841
39095
  if (mode === "inline") return;
38842
39096
  const handleKeyDown = (e) => {
38843
39097
  if (e.key === "`" && isVisible) {
@@ -39386,7 +39640,7 @@ function SequenceBar({
39386
39640
  onSlotRemove(index);
39387
39641
  }, [onSlotRemove, playing]);
39388
39642
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
39389
- return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React131__default.Fragment, { children: [
39643
+ return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React75__default.Fragment, { children: [
39390
39644
  i > 0 && /* @__PURE__ */ jsx(
39391
39645
  Typography,
39392
39646
  {
@@ -40898,7 +41152,7 @@ var init_StatCard = __esm({
40898
41152
  const labelToUse = propLabel ?? propTitle;
40899
41153
  const eventBus = useEventBus();
40900
41154
  const { t } = useTranslate();
40901
- const handleActionClick = React131__default.useCallback(() => {
41155
+ const handleActionClick = React75__default.useCallback(() => {
40902
41156
  if (action?.event) {
40903
41157
  eventBus.emit(`UI:${action.event}`, {});
40904
41158
  }
@@ -40909,7 +41163,7 @@ var init_StatCard = __esm({
40909
41163
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
40910
41164
  const isLoading = externalLoading ?? false;
40911
41165
  const error = externalError;
40912
- const computeMetricValue = React131__default.useCallback(
41166
+ const computeMetricValue = React75__default.useCallback(
40913
41167
  (metric, items) => {
40914
41168
  if (metric.value !== void 0) {
40915
41169
  return metric.value;
@@ -40948,7 +41202,7 @@ var init_StatCard = __esm({
40948
41202
  },
40949
41203
  []
40950
41204
  );
40951
- const schemaStats = React131__default.useMemo(() => {
41205
+ const schemaStats = React75__default.useMemo(() => {
40952
41206
  if (!metrics || metrics.length === 0) return null;
40953
41207
  return metrics.map((metric) => ({
40954
41208
  label: metric.label,
@@ -40956,7 +41210,7 @@ var init_StatCard = __esm({
40956
41210
  format: metric.format
40957
41211
  }));
40958
41212
  }, [metrics, data, computeMetricValue]);
40959
- const calculatedTrend = React131__default.useMemo(() => {
41213
+ const calculatedTrend = React75__default.useMemo(() => {
40960
41214
  if (manualTrend !== void 0) return manualTrend;
40961
41215
  if (previousValue === void 0 || currentValue === void 0)
40962
41216
  return void 0;
@@ -42163,7 +42417,7 @@ var init_Timeline = __esm({
42163
42417
  }) => {
42164
42418
  const { t } = useTranslate();
42165
42419
  const entityData = Array.isArray(entity) ? entity : [];
42166
- const items = React131__default.useMemo(() => {
42420
+ const items = React75__default.useMemo(() => {
42167
42421
  if (propItems) return propItems;
42168
42422
  if (entityData.length === 0) return [];
42169
42423
  return entityData.map((record, idx) => {
@@ -42320,7 +42574,7 @@ var init_TimerDisplay = __esm({
42320
42574
  }
42321
42575
  });
42322
42576
  function extractToastProps(children) {
42323
- if (!React131__default.isValidElement(children)) {
42577
+ if (!React75__default.isValidElement(children)) {
42324
42578
  if (typeof children === "string") {
42325
42579
  return { message: children };
42326
42580
  }
@@ -42358,7 +42612,7 @@ var init_ToastSlot = __esm({
42358
42612
  eventBus.emit("UI:CLOSE");
42359
42613
  };
42360
42614
  if (!isVisible) return null;
42361
- const isCustomContent = React131__default.isValidElement(children) && !message;
42615
+ const isCustomContent = React75__default.isValidElement(children) && !message;
42362
42616
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
42363
42617
  Toast,
42364
42618
  {
@@ -42627,7 +42881,7 @@ var init_WizardContainer = __esm({
42627
42881
  const isCompleted = index < currentStep;
42628
42882
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
42629
42883
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
42630
- return /* @__PURE__ */ jsxs(React131__default.Fragment, { children: [
42884
+ return /* @__PURE__ */ jsxs(React75__default.Fragment, { children: [
42631
42885
  /* @__PURE__ */ jsx(
42632
42886
  Button,
42633
42887
  {
@@ -43077,12 +43331,12 @@ var init_XPBar = __esm({
43077
43331
  }
43078
43332
  });
43079
43333
  function lazyThree(name, loader) {
43080
- const Lazy = React131__default.lazy(() => loader().then((m) => ({ default: m[name] })));
43334
+ const Lazy = React75__default.lazy(() => loader().then((m) => ({ default: m[name] })));
43081
43335
  function ThreeWrapper(props) {
43082
- return React131__default.createElement(
43083
- React131__default.Suspense,
43336
+ return React75__default.createElement(
43337
+ React75__default.Suspense,
43084
43338
  { fallback: null },
43085
- React131__default.createElement(Lazy, props)
43339
+ React75__default.createElement(Lazy, props)
43086
43340
  );
43087
43341
  }
43088
43342
  ThreeWrapper.displayName = `Lazy(${name})`;
@@ -43686,7 +43940,7 @@ function SuspenseConfigProvider({
43686
43940
  config,
43687
43941
  children
43688
43942
  }) {
43689
- return React131__default.createElement(
43943
+ return React75__default.createElement(
43690
43944
  SuspenseConfigContext.Provider,
43691
43945
  { value: config },
43692
43946
  children
@@ -44169,7 +44423,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
44169
44423
  const key = `${parentId}-${index}-trait:${traitName}`;
44170
44424
  return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
44171
44425
  }
44172
- return /* @__PURE__ */ jsx(React131__default.Fragment, { children: child }, `${parentId}-${index}`);
44426
+ return /* @__PURE__ */ jsx(React75__default.Fragment, { children: child }, `${parentId}-${index}`);
44173
44427
  }
44174
44428
  if (!child || typeof child !== "object") return null;
44175
44429
  const childId = `${parentId}-${index}`;
@@ -44206,14 +44460,14 @@ function isPatternConfig(value) {
44206
44460
  if (value === null || value === void 0) return false;
44207
44461
  if (typeof value !== "object") return false;
44208
44462
  if (Array.isArray(value)) return false;
44209
- if (React131__default.isValidElement(value)) return false;
44463
+ if (React75__default.isValidElement(value)) return false;
44210
44464
  if (value instanceof Date) return false;
44211
44465
  if (typeof value === "function") return false;
44212
44466
  const record = value;
44213
44467
  return "type" in record && typeof record.type === "string";
44214
44468
  }
44215
44469
  function isPlainConfigObject(value) {
44216
- if (React131__default.isValidElement(value)) return false;
44470
+ if (React75__default.isValidElement(value)) return false;
44217
44471
  if (value instanceof Date) return false;
44218
44472
  const proto = Object.getPrototypeOf(value);
44219
44473
  return proto === Object.prototype || proto === null;
@@ -44657,7 +44911,7 @@ var FormSection = ({
44657
44911
  columns = 1,
44658
44912
  className
44659
44913
  }) => {
44660
- const [collapsed, setCollapsed] = React131__default.useState(defaultCollapsed);
44914
+ const [collapsed, setCollapsed] = React75__default.useState(defaultCollapsed);
44661
44915
  const { t } = useTranslate();
44662
44916
  const eventBus = useEventBus();
44663
44917
  const gridClass = {
@@ -44665,7 +44919,7 @@ var FormSection = ({
44665
44919
  2: "grid-cols-1 md:grid-cols-2",
44666
44920
  3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
44667
44921
  }[columns];
44668
- React131__default.useCallback(() => {
44922
+ React75__default.useCallback(() => {
44669
44923
  if (collapsible) {
44670
44924
  setCollapsed((prev) => !prev);
44671
44925
  eventBus.emit("UI:TOGGLE_COLLAPSE", { collapsed: !collapsed });