@almadar/ui 4.48.0 → 4.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,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,192 @@ 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
+ items,
20039
+ layout
20040
+ } = args;
20041
+ const enabled = Boolean(dragGroup || accepts || sortable);
20042
+ const eventBus = useEventBus();
20043
+ const parentRoot = React75__default.useContext(RootCtx);
20044
+ const isRoot = enabled && parentRoot === null;
20045
+ const [localOrder, setLocalOrder] = React75__default.useState(null);
20046
+ const orderedItems = localOrder ?? items;
20047
+ React75__default.useEffect(() => {
20048
+ setLocalOrder(null);
20049
+ }, [items]);
20050
+ const itemIds = React75__default.useMemo(
20051
+ () => orderedItems.map((it, idx) => {
20052
+ const raw = it[dndItemIdField];
20053
+ return raw ?? `__idx_${idx}`;
20054
+ }),
20055
+ [orderedItems, dndItemIdField]
20056
+ );
20057
+ const zonesRef = React75__default.useRef(/* @__PURE__ */ new Map());
20058
+ const registerZone = React75__default.useCallback((zoneId2, meta2) => {
20059
+ zonesRef.current.set(zoneId2, meta2);
20060
+ }, []);
20061
+ const unregisterZone = React75__default.useCallback((zoneId2) => {
20062
+ zonesRef.current.delete(zoneId2);
20063
+ }, []);
20064
+ const zoneId = React75__default.useId();
20065
+ const ownGroup = dragGroup ?? accepts ?? zoneId;
20066
+ const meta = React75__default.useMemo(
20067
+ () => ({ group: ownGroup, dropEvent, reorderEvent, itemIds }),
20068
+ [ownGroup, dropEvent, reorderEvent, itemIds]
20069
+ );
20070
+ React75__default.useEffect(() => {
20071
+ const target = isRoot ? null : parentRoot;
20072
+ if (!target) {
20073
+ zonesRef.current.set(zoneId, meta);
20074
+ return () => zonesRef.current.delete(zoneId);
20075
+ }
20076
+ target.registerZone(zoneId, meta);
20077
+ return () => target.unregisterZone(zoneId);
20078
+ }, [parentRoot, isRoot, zoneId, meta]);
20079
+ const sensors = useSensors(
20080
+ useSensor(PointerSensor, { activationConstraint: { distance: 5 } }),
20081
+ useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates })
20082
+ );
20083
+ const findZoneByItem = React75__default.useCallback(
20084
+ (id) => {
20085
+ for (const z of zonesRef.current.values()) {
20086
+ if (z.itemIds.includes(id)) return z;
20087
+ }
20088
+ return void 0;
20089
+ },
20090
+ []
20091
+ );
20092
+ const findZoneByGroup = React75__default.useCallback(
20093
+ (group) => {
20094
+ for (const z of zonesRef.current.values()) {
20095
+ if (z.group === group) return z;
20096
+ }
20097
+ return void 0;
20098
+ },
20099
+ []
20100
+ );
20101
+ const handleDragEnd = React75__default.useCallback(
20102
+ (event) => {
20103
+ const { active, over } = event;
20104
+ if (!over) return;
20105
+ const sourceZone = findZoneByItem(active.id);
20106
+ const overData = over.data?.current;
20107
+ const targetGroup = overData?.dndGroup;
20108
+ if (!sourceZone || !targetGroup) return;
20109
+ const targetZone = findZoneByGroup(targetGroup);
20110
+ if (!targetZone) return;
20111
+ if (sourceZone.group !== targetZone.group) {
20112
+ if (targetZone.dropEvent) {
20113
+ const newIndex2 = targetZone.itemIds.indexOf(over.id);
20114
+ eventBus.emit(targetZone.dropEvent, {
20115
+ id: String(active.id),
20116
+ sourceGroup: sourceZone.group,
20117
+ targetGroup: targetZone.group,
20118
+ newIndex: newIndex2 === -1 ? targetZone.itemIds.length : newIndex2
20119
+ });
20120
+ }
20121
+ return;
20122
+ }
20123
+ const oldIndex = sourceZone.itemIds.indexOf(active.id);
20124
+ const newIndex = sourceZone.itemIds.indexOf(over.id);
20125
+ if (oldIndex === -1 || newIndex === -1 || oldIndex === newIndex) return;
20126
+ if (sourceZone.group === ownGroup) {
20127
+ const reordered = arrayMove(orderedItems, oldIndex, newIndex);
20128
+ setLocalOrder(reordered);
20129
+ }
20130
+ if (sourceZone.reorderEvent) {
20131
+ eventBus.emit(sourceZone.reorderEvent, {
20132
+ id: String(active.id),
20133
+ oldIndex,
20134
+ newIndex
20135
+ });
20136
+ }
20137
+ },
20138
+ [orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
20139
+ );
20140
+ const SortableItem = React75__default.useCallback(
20141
+ ({ id, children }) => {
20142
+ const {
20143
+ attributes,
20144
+ listeners: listeners7,
20145
+ setNodeRef,
20146
+ transform,
20147
+ transition,
20148
+ isDragging
20149
+ } = useSortable({ id, data: { dndGroup: ownGroup } });
20150
+ const style = {
20151
+ transform: CSS.Transform.toString(transform),
20152
+ transition,
20153
+ opacity: isDragging ? 0.4 : 1,
20154
+ cursor: enabled ? "grab" : void 0
20155
+ };
20156
+ return /* @__PURE__ */ jsx(
20157
+ Box,
20158
+ {
20159
+ className: "touch-none",
20160
+ ref: setNodeRef,
20161
+ style,
20162
+ ...attributes,
20163
+ ...listeners7,
20164
+ children
20165
+ }
20166
+ );
20167
+ },
20168
+ [ownGroup, enabled]
20169
+ );
20170
+ const DropZoneShell = ({ children }) => {
20171
+ const { setNodeRef, isOver } = useDroppable({
20172
+ id: `dnd-zone-${zoneId}`,
20173
+ data: { dndGroup: ownGroup }
20174
+ });
20175
+ return /* @__PURE__ */ jsx(
20176
+ Box,
20177
+ {
20178
+ ref: setNodeRef,
20179
+ className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg" : void 0,
20180
+ children
20181
+ }
20182
+ );
20183
+ };
20184
+ const rootContextValue = React75__default.useMemo(
20185
+ () => ({ registerZone, unregisterZone }),
20186
+ [registerZone, unregisterZone]
20187
+ );
20188
+ const wrapContainer = React75__default.useCallback(
20189
+ (children) => {
20190
+ if (!enabled) return children;
20191
+ const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
20192
+ const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
20193
+ if (isRoot) {
20194
+ return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, children: inner }) });
20195
+ }
20196
+ return inner;
20197
+ },
20198
+ [enabled, layout, sensors, handleDragEnd, itemIds, isRoot, rootContextValue]
20199
+ );
20200
+ return {
20201
+ enabled,
20202
+ wrapContainer,
20203
+ SortableItem,
20204
+ orderedItems
20205
+ };
20206
+ }
20207
+ var RootCtx;
20208
+ var init_useDataDnd = __esm({
20209
+ "components/molecules/useDataDnd.tsx"() {
20210
+ "use client";
20211
+ init_useEventBus();
20212
+ init_Box();
20213
+ RootCtx = React75__default.createContext(null);
20214
+ }
20215
+ });
20027
20216
  function fieldLabel2(key) {
20028
20217
  return key.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
20029
20218
  }
@@ -20087,14 +20276,31 @@ function DataGrid({
20087
20276
  hasMore,
20088
20277
  children,
20089
20278
  pageSize = 0,
20090
- renderItem: schemaRenderItem
20279
+ renderItem: schemaRenderItem,
20280
+ dragGroup,
20281
+ accepts,
20282
+ sortable,
20283
+ dropEvent,
20284
+ reorderEvent,
20285
+ dndItemIdField
20091
20286
  }) {
20092
20287
  const eventBus = useEventBus();
20093
20288
  const { t } = useTranslate();
20094
20289
  const [selectedIds, setSelectedIds] = useState(/* @__PURE__ */ new Set());
20095
20290
  const [visibleCount, setVisibleCount] = useState(pageSize || Infinity);
20096
20291
  const fieldDefs = fields ?? columns ?? [];
20097
- const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
20292
+ const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
20293
+ const dnd = useDataDnd({
20294
+ items: allDataRaw,
20295
+ layout: "grid",
20296
+ dragGroup,
20297
+ accepts,
20298
+ sortable,
20299
+ dropEvent,
20300
+ reorderEvent,
20301
+ dndItemIdField
20302
+ });
20303
+ const allData = dnd.orderedItems;
20098
20304
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
20099
20305
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
20100
20306
  const toggleSelection = useCallback((id) => {
@@ -20166,203 +20372,205 @@ function DataGrid({
20166
20372
  const allIds = data.map((item, i) => item.id || String(i));
20167
20373
  const allSelected = allIds.length > 0 && allIds.every((id) => selectedIds.has(id));
20168
20374
  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: [
20375
+ const idFieldName = dndItemIdField ?? "id";
20376
+ return dnd.wrapContainer(
20377
+ /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
20378
+ selectable && someSelected && /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "items-center px-2 py-2 bg-muted rounded-sm", children: [
20379
+ /* @__PURE__ */ jsx(
20380
+ "input",
20381
+ {
20382
+ type: "checkbox",
20383
+ checked: allSelected,
20384
+ onChange: toggleAll,
20385
+ className: "w-4 h-4 accent-primary",
20386
+ "aria-label": "Select all"
20387
+ }
20388
+ ),
20389
+ /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "font-semibold", children: [
20390
+ selectedIds.size,
20391
+ " ",
20392
+ t("common.selected") || "selected"
20393
+ ] })
20394
+ ] }),
20171
20395
  /* @__PURE__ */ jsx(
20172
- "input",
20396
+ Box,
20173
20397
  {
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(
20203
- "bg-card rounded-lg",
20204
- "border border-border",
20205
- "shadow-sm hover:shadow-lg",
20206
- "hover:border-primary transition-all",
20207
- "p-4",
20208
- isSelected && "ring-2 ring-primary border-primary"
20209
- ),
20210
- children: children(itemData, index)
20211
- },
20212
- id
20213
- );
20214
- }
20215
- const titleValue = getNestedValue(itemData, titleField?.name ?? "");
20216
- return /* @__PURE__ */ jsxs(
20217
- Box,
20218
- {
20219
- "data-entity-row": true,
20220
- "data-entity-id": id,
20221
- className: cn(
20222
- "bg-card rounded-lg",
20223
- "border border-border",
20224
- "shadow-sm hover:shadow-lg",
20225
- "hover:border-primary transition-all",
20226
- "flex flex-col",
20227
- isSelected && "ring-2 ring-primary border-primary"
20228
- ),
20229
- children: [
20230
- imageField && (() => {
20231
- const imgUrl = getNestedValue(itemData, imageField);
20232
- if (!imgUrl || typeof imgUrl !== "string") return null;
20233
- return /* @__PURE__ */ jsx(Box, { className: "w-full aspect-video overflow-hidden rounded-t-lg", children: /* @__PURE__ */ jsx(
20234
- "img",
20235
- {
20236
- src: imgUrl,
20237
- alt: titleValue !== void 0 ? String(titleValue) : "",
20238
- className: "w-full h-full object-cover",
20239
- loading: "lazy"
20240
- }
20241
- ) });
20242
- })(),
20243
- /* @__PURE__ */ jsx(Box, { className: "p-4 pb-0", children: /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-start", children: [
20244
- selectable && /* @__PURE__ */ jsx(
20245
- "input",
20246
- {
20247
- type: "checkbox",
20248
- checked: isSelected,
20249
- onChange: () => toggleSelection(id),
20250
- onClick: (e) => e.stopPropagation(),
20251
- className: "w-4 h-4 mt-1 flex-shrink-0 accent-primary",
20252
- "aria-label": `Select ${titleValue !== void 0 ? String(titleValue) : "item"}`
20253
- }
20398
+ className: cn("grid", gapStyles6[gap], colsClass, className),
20399
+ style: gridTemplateColumns ? { gridTemplateColumns } : void 0,
20400
+ children: data.map((item, index) => {
20401
+ const itemData = item;
20402
+ const id = itemData.id || String(index);
20403
+ const isSelected = selectedIds.has(id);
20404
+ const dndId = itemData[idFieldName] ?? `__idx_${index}`;
20405
+ const wrapDnd = (node) => dnd.enabled ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
20406
+ if (hasRenderProp) {
20407
+ return wrapDnd(
20408
+ /* @__PURE__ */ jsx(
20409
+ Box,
20410
+ {
20411
+ "data-entity-row": true,
20412
+ "data-entity-id": id,
20413
+ className: cn(isSelected && "ring-2 ring-primary rounded-lg"),
20414
+ children: children(itemData, index)
20415
+ },
20416
+ id
20417
+ )
20418
+ );
20419
+ }
20420
+ const titleValue = getNestedValue(itemData, titleField?.name ?? "");
20421
+ return wrapDnd(
20422
+ /* @__PURE__ */ jsxs(
20423
+ Box,
20424
+ {
20425
+ "data-entity-row": true,
20426
+ "data-entity-id": id,
20427
+ className: cn(
20428
+ "bg-card rounded-lg",
20429
+ "border border-border",
20430
+ "shadow-sm hover:shadow-lg",
20431
+ "hover:border-primary transition-all",
20432
+ "flex flex-col",
20433
+ isSelected && "ring-2 ring-primary border-primary"
20254
20434
  ),
20255
- /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: "flex-1 min-w-0", children: [
20256
- titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
20257
- titleField?.icon && /* @__PURE__ */ jsx(Icon, { name: titleField.icon, size: "sm", className: "text-primary flex-shrink-0" }),
20258
- /* @__PURE__ */ jsx(
20259
- Typography,
20435
+ children: [
20436
+ imageField && (() => {
20437
+ const imgUrl = getNestedValue(itemData, imageField);
20438
+ if (!imgUrl || typeof imgUrl !== "string") return null;
20439
+ return /* @__PURE__ */ jsx(Box, { className: "w-full aspect-video overflow-hidden rounded-t-lg", children: /* @__PURE__ */ jsx(
20440
+ "img",
20260
20441
  {
20261
- variant: titleField?.variant === "h3" ? "h3" : "h4",
20262
- className: "font-semibold truncate",
20263
- children: String(titleValue)
20442
+ src: imgUrl,
20443
+ alt: titleValue !== void 0 ? String(titleValue) : "",
20444
+ className: "w-full h-full object-cover",
20445
+ loading: "lazy"
20264
20446
  }
20265
- )
20266
- ] }),
20267
- badgeFields.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap", children: badgeFields.map((field) => {
20268
- const val = getNestedValue(itemData, field.name);
20269
- if (val === void 0 || val === null) return null;
20270
- return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
20271
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
20272
- /* @__PURE__ */ jsx(Badge, { variant: resolveBadgeVariant(field, String(val)), children: String(val) })
20273
- ] }, field.name);
20274
- }) })
20275
- ] }),
20276
- dangerActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: dangerActions.map((action, idx) => /* @__PURE__ */ jsxs(
20277
- Button,
20278
- {
20279
- variant: "ghost",
20280
- size: "sm",
20281
- onClick: handleActionClick(action, itemData),
20282
- "data-testid": `action-${action.event}`,
20283
- "data-row-id": String(itemData.id),
20284
- className: "text-error hover:text-error hover:bg-error/10 px-2",
20285
- children: [
20286
- action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs" }),
20287
- action.label
20288
- ]
20289
- },
20290
- idx
20291
- )) })
20292
- ] }) }),
20293
- bodyFields.length > 0 && /* @__PURE__ */ jsx(Box, { className: "px-4 py-3 flex-1", children: /* @__PURE__ */ jsx(VStack, { gap: "xs", children: bodyFields.map((field) => {
20294
- const value = getNestedValue(itemData, field.name);
20295
- if (value === void 0 || value === null || value === "") return null;
20296
- if (field.format === "boolean") {
20297
- return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-center", children: [
20298
- /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
20299
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
20300
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
20447
+ ) });
20448
+ })(),
20449
+ /* @__PURE__ */ jsx(Box, { className: "p-4 pb-0", children: /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-start", children: [
20450
+ selectable && /* @__PURE__ */ jsx(
20451
+ "input",
20452
+ {
20453
+ type: "checkbox",
20454
+ checked: isSelected,
20455
+ onChange: () => toggleSelection(id),
20456
+ onClick: (e) => e.stopPropagation(),
20457
+ className: "w-4 h-4 mt-1 flex-shrink-0 accent-primary",
20458
+ "aria-label": `Select ${titleValue !== void 0 ? String(titleValue) : "item"}`
20459
+ }
20460
+ ),
20461
+ /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: "flex-1 min-w-0", children: [
20462
+ titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
20463
+ titleField?.icon && /* @__PURE__ */ jsx(Icon, { name: titleField.icon, size: "sm", className: "text-primary flex-shrink-0" }),
20464
+ /* @__PURE__ */ jsx(
20465
+ Typography,
20466
+ {
20467
+ variant: titleField?.variant === "h3" ? "h3" : "h4",
20468
+ className: "font-semibold truncate",
20469
+ children: String(titleValue)
20470
+ }
20471
+ )
20472
+ ] }),
20473
+ badgeFields.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap", children: badgeFields.map((field) => {
20474
+ const val = getNestedValue(itemData, field.name);
20475
+ if (val === void 0 || val === null) return null;
20476
+ return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
20477
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
20478
+ /* @__PURE__ */ jsx(Badge, { variant: resolveBadgeVariant(field, String(val)), children: String(val) })
20479
+ ] }, field.name);
20480
+ }) })
20301
20481
  ] }),
20302
- /* @__PURE__ */ jsx(Badge, { variant: value ? "success" : "neutral", children: value ? t("common.yes") || "Yes" : t("common.no") || "No" })
20303
- ] }, field.name);
20304
- }
20305
- return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-center", children: [
20306
- /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
20307
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
20308
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
20309
- ] }),
20310
- /* @__PURE__ */ jsx(
20311
- Typography,
20312
- {
20313
- variant: field.variant === "caption" ? "caption" : "small",
20314
- className: "text-right truncate max-w-[60%]",
20315
- children: formatValue(value, field.format)
20482
+ dangerActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: dangerActions.map((action, idx) => /* @__PURE__ */ jsxs(
20483
+ Button,
20484
+ {
20485
+ variant: "ghost",
20486
+ size: "sm",
20487
+ onClick: handleActionClick(action, itemData),
20488
+ "data-testid": `action-${action.event}`,
20489
+ "data-row-id": String(itemData.id),
20490
+ className: "text-error hover:text-error hover:bg-error/10 px-2",
20491
+ children: [
20492
+ action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs" }),
20493
+ action.label
20494
+ ]
20495
+ },
20496
+ idx
20497
+ )) })
20498
+ ] }) }),
20499
+ bodyFields.length > 0 && /* @__PURE__ */ jsx(Box, { className: "px-4 py-3 flex-1", children: /* @__PURE__ */ jsx(VStack, { gap: "xs", children: bodyFields.map((field) => {
20500
+ const value = getNestedValue(itemData, field.name);
20501
+ if (value === void 0 || value === null || value === "") return null;
20502
+ if (field.format === "boolean") {
20503
+ return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-center", children: [
20504
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
20505
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
20506
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
20507
+ ] }),
20508
+ /* @__PURE__ */ jsx(Badge, { variant: value ? "success" : "neutral", children: value ? t("common.yes") || "Yes" : t("common.no") || "No" })
20509
+ ] }, field.name);
20316
20510
  }
20317
- )
20318
- ] }, field.name);
20319
- }) }) }),
20320
- 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(
20321
- Button,
20322
- {
20323
- variant: action.variant === "primary" ? "primary" : "ghost",
20324
- size: "sm",
20325
- onClick: handleActionClick(action, itemData),
20326
- "data-testid": `action-${action.event}`,
20327
- "data-row-id": String(itemData.id),
20328
- children: [
20329
- action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
20330
- action.label
20331
- ]
20332
- },
20333
- idx
20334
- )) }) })
20335
- ]
20336
- },
20337
- id
20338
- );
20339
- })
20340
- }
20341
- ),
20342
- hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
20343
- Button,
20344
- {
20345
- variant: "ghost",
20346
- size: "sm",
20347
- onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
20348
- children: [
20349
- /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
20350
- t("common.showMore"),
20351
- " (",
20352
- allData.length - visibleCount,
20353
- " remaining)"
20354
- ]
20355
- }
20356
- ) }),
20357
- infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
20358
- InfiniteScrollSentinel,
20359
- {
20360
- loadMoreEvent,
20361
- isLoading,
20362
- hasMore
20363
- }
20364
- )
20365
- ] });
20511
+ return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-center", children: [
20512
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
20513
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
20514
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
20515
+ ] }),
20516
+ /* @__PURE__ */ jsx(
20517
+ Typography,
20518
+ {
20519
+ variant: field.variant === "caption" ? "caption" : "small",
20520
+ className: "text-right truncate max-w-[60%]",
20521
+ children: formatValue(value, field.format)
20522
+ }
20523
+ )
20524
+ ] }, field.name);
20525
+ }) }) }),
20526
+ 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(
20527
+ Button,
20528
+ {
20529
+ variant: action.variant === "primary" ? "primary" : "ghost",
20530
+ size: "sm",
20531
+ onClick: handleActionClick(action, itemData),
20532
+ "data-testid": `action-${action.event}`,
20533
+ "data-row-id": String(itemData.id),
20534
+ children: [
20535
+ action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
20536
+ action.label
20537
+ ]
20538
+ },
20539
+ idx
20540
+ )) }) })
20541
+ ]
20542
+ },
20543
+ id
20544
+ )
20545
+ );
20546
+ })
20547
+ }
20548
+ ),
20549
+ hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
20550
+ Button,
20551
+ {
20552
+ variant: "ghost",
20553
+ size: "sm",
20554
+ onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
20555
+ children: [
20556
+ /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
20557
+ t("common.showMore"),
20558
+ " (",
20559
+ allData.length - visibleCount,
20560
+ " remaining)"
20561
+ ]
20562
+ }
20563
+ ) }),
20564
+ infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
20565
+ InfiniteScrollSentinel,
20566
+ {
20567
+ loadMoreEvent,
20568
+ isLoading,
20569
+ hasMore
20570
+ }
20571
+ )
20572
+ ] })
20573
+ );
20366
20574
  }
20367
20575
  var dataGridLog, BADGE_VARIANTS, gapStyles6;
20368
20576
  var init_DataGrid = __esm({
@@ -20379,6 +20587,7 @@ var init_DataGrid = __esm({
20379
20587
  init_Button();
20380
20588
  init_Icon();
20381
20589
  init_InfiniteScrollSentinel();
20590
+ init_useDataDnd();
20382
20591
  dataGridLog = createLogger("almadar:ui:data-grid");
20383
20592
  BADGE_VARIANTS = /* @__PURE__ */ new Set([
20384
20593
  "default",
@@ -20473,17 +20682,34 @@ function DataList({
20473
20682
  hasMore,
20474
20683
  children,
20475
20684
  pageSize = 5,
20476
- renderItem: schemaRenderItem
20685
+ renderItem: schemaRenderItem,
20686
+ dragGroup,
20687
+ accepts,
20688
+ sortable: sortableProp,
20689
+ dropEvent,
20690
+ reorderEvent: dndReorderEvent,
20691
+ dndItemIdField
20477
20692
  }) {
20478
20693
  const eventBus = useEventBus();
20479
20694
  const { t } = useTranslate();
20480
- const [visibleCount, setVisibleCount] = React131__default.useState(pageSize || Infinity);
20695
+ const [visibleCount, setVisibleCount] = React75__default.useState(pageSize || Infinity);
20481
20696
  const fieldDefs = fields ?? columns ?? [];
20482
- const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
20697
+ const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
20698
+ const dnd = useDataDnd({
20699
+ items: allDataRaw,
20700
+ layout: "list",
20701
+ dragGroup,
20702
+ accepts,
20703
+ sortable: sortableProp,
20704
+ dropEvent,
20705
+ reorderEvent: dndReorderEvent,
20706
+ dndItemIdField
20707
+ });
20708
+ const allData = dnd.orderedItems;
20483
20709
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
20484
20710
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
20485
20711
  const hasRenderProp = typeof children === "function";
20486
- React131__default.useEffect(() => {
20712
+ React75__default.useEffect(() => {
20487
20713
  const renderItemTypeOf = typeof schemaRenderItem;
20488
20714
  const childrenTypeOf = typeof children;
20489
20715
  if (data.length > 0 && !hasRenderProp) {
@@ -20539,7 +20765,7 @@ function DataList({
20539
20765
  const items2 = data.map((item) => item);
20540
20766
  const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
20541
20767
  const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
20542
- return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React131__default.Fragment, { children: [
20768
+ return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React75__default.Fragment, { children: [
20543
20769
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
20544
20770
  group.items.map((itemData, index) => {
20545
20771
  const id = itemData.id || `${gi}-${index}`;
@@ -20587,10 +20813,50 @@ function DataList({
20587
20813
  }
20588
20814
  const items = data.map((item) => item);
20589
20815
  const groups = groupBy ? groupData(items, groupBy) : [{ label: "", items }];
20816
+ const idFieldName = dndItemIdField ?? "id";
20590
20817
  const renderItem = (itemData, index, isLast) => {
20818
+ const dndId = itemData[idFieldName] ?? `__idx_${index}`;
20819
+ const wrapDnd = (node) => dnd.enabled ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
20591
20820
  if (hasRenderProp) {
20592
20821
  const id2 = itemData.id || String(index);
20593
- return /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id2, children: [
20822
+ return wrapDnd(
20823
+ /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id2, children: [
20824
+ /* @__PURE__ */ jsxs(Box, { className: "group flex items-stretch gap-2", children: [
20825
+ /* @__PURE__ */ jsx(Box, { className: "flex-1 min-w-0", children: children(itemData, index) }),
20826
+ itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(
20827
+ HStack,
20828
+ {
20829
+ gap: "xs",
20830
+ className: "flex-shrink-0",
20831
+ children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
20832
+ Button,
20833
+ {
20834
+ variant: action.variant ?? "ghost",
20835
+ size: "sm",
20836
+ onClick: handleActionClick(action, itemData),
20837
+ "data-testid": `action-${action.event}`,
20838
+ "data-row-id": String(itemData.id),
20839
+ className: cn(
20840
+ action.variant === "danger" && "text-error hover:bg-error/10"
20841
+ ),
20842
+ children: [
20843
+ action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
20844
+ action.label
20845
+ ]
20846
+ },
20847
+ idx
20848
+ ))
20849
+ }
20850
+ )
20851
+ ] }),
20852
+ isCard && !isLast && /* @__PURE__ */ jsx(Box, { className: "mx-6 border-b border-border/40" })
20853
+ ] }, id2)
20854
+ );
20855
+ }
20856
+ const id = itemData.id || String(index);
20857
+ const titleValue = getNestedValue(itemData, titleField?.name ?? "");
20858
+ return wrapDnd(
20859
+ /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id, children: [
20594
20860
  /* @__PURE__ */ jsxs(
20595
20861
  Box,
20596
20862
  {
@@ -20601,166 +20867,124 @@ function DataList({
20601
20867
  !isCard && !isCompact && "rounded-lg border border-transparent hover:border-border"
20602
20868
  ),
20603
20869
  children: [
20604
- /* @__PURE__ */ jsx(Box, { className: "flex-1 min-w-0", children: children(itemData, index) }),
20605
- itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(
20606
- HStack,
20607
- {
20608
- gap: "xs",
20609
- className: "flex-shrink-0",
20610
- children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
20611
- Button,
20870
+ /* @__PURE__ */ jsxs(Box, { className: "flex-1 min-w-0", children: [
20871
+ /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "items-center", children: [
20872
+ titleField?.icon && /* @__PURE__ */ jsx(
20873
+ Icon,
20612
20874
  {
20613
- variant: action.variant ?? "ghost",
20614
- size: "sm",
20615
- onClick: handleActionClick(action, itemData),
20616
- "data-testid": `action-${action.event}`,
20617
- "data-row-id": String(itemData.id),
20618
- className: cn(
20619
- action.variant === "danger" && "text-error hover:bg-error/10"
20620
- ),
20621
- children: [
20622
- action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
20623
- action.label
20624
- ]
20625
- },
20626
- idx
20627
- ))
20628
- }
20629
- )
20875
+ name: titleField.icon,
20876
+ size: isCompact ? "xs" : "sm",
20877
+ className: "text-primary flex-shrink-0"
20878
+ }
20879
+ ),
20880
+ titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsx(
20881
+ Typography,
20882
+ {
20883
+ variant: titleField?.variant === "h3" ? "h3" : "h4",
20884
+ className: cn("font-semibold truncate flex-1", isCompact && "text-sm"),
20885
+ children: String(titleValue)
20886
+ }
20887
+ ),
20888
+ badgeFields.map((field) => {
20889
+ const val = getNestedValue(itemData, field.name);
20890
+ if (val === void 0 || val === null) return null;
20891
+ return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center flex-shrink-0", children: [
20892
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
20893
+ /* @__PURE__ */ jsx(Badge, { variant: statusVariant3(String(val)), children: String(val) })
20894
+ ] }, field.name);
20895
+ })
20896
+ ] }),
20897
+ bodyFields.length > 0 && !isCompact && /* @__PURE__ */ jsx(HStack, { gap: "md", className: "mt-1.5 flex-wrap", children: bodyFields.map((field) => {
20898
+ const value = getNestedValue(itemData, field.name);
20899
+ if (value === void 0 || value === null || value === "") return null;
20900
+ return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
20901
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
20902
+ /* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "secondary", children: [
20903
+ field.label ?? fieldLabel3(field.name),
20904
+ ":"
20905
+ ] }),
20906
+ /* @__PURE__ */ jsx(Typography, { variant: "small", children: formatValue2(value, field.format) })
20907
+ ] }, field.name);
20908
+ }) }),
20909
+ progressFields.map((field) => {
20910
+ const value = getNestedValue(itemData, field.name);
20911
+ if (typeof value !== "number") return null;
20912
+ return /* @__PURE__ */ jsxs(Box, { className: "mt-2 max-w-xs", children: [
20913
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center mb-1", children: [
20914
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
20915
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel3(field.name) })
20916
+ ] }),
20917
+ /* @__PURE__ */ jsx(ProgressBar, { value, max: 100 })
20918
+ ] }, field.name);
20919
+ })
20920
+ ] }),
20921
+ itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
20922
+ Button,
20923
+ {
20924
+ variant: action.variant ?? "ghost",
20925
+ size: "sm",
20926
+ onClick: handleActionClick(action, itemData),
20927
+ "data-testid": `action-${action.event}`,
20928
+ "data-row-id": String(itemData.id),
20929
+ className: cn(
20930
+ action.variant === "danger" && "text-error hover:bg-error/10"
20931
+ ),
20932
+ children: [
20933
+ action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
20934
+ action.label
20935
+ ]
20936
+ },
20937
+ idx
20938
+ )) })
20630
20939
  ]
20631
20940
  }
20632
20941
  ),
20633
20942
  isCard && !isLast && /* @__PURE__ */ jsx(Box, { className: "mx-6 border-b border-border/40" })
20634
- ] }, id2);
20635
- }
20636
- const id = itemData.id || String(index);
20637
- const titleValue = getNestedValue(itemData, titleField?.name ?? "");
20638
- return /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id, children: [
20639
- /* @__PURE__ */ jsxs(
20640
- Box,
20641
- {
20642
- className: cn(
20643
- "group flex items-center gap-4 transition-all duration-200",
20644
- isCompact ? "px-4 py-2" : "px-6 py-4",
20645
- "hover:bg-muted/80",
20646
- !isCard && !isCompact && "rounded-lg border border-transparent hover:border-border"
20647
- ),
20648
- children: [
20649
- /* @__PURE__ */ jsxs(Box, { className: "flex-1 min-w-0", children: [
20650
- /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "items-center", children: [
20651
- titleField?.icon && /* @__PURE__ */ jsx(
20652
- Icon,
20653
- {
20654
- name: titleField.icon,
20655
- size: isCompact ? "xs" : "sm",
20656
- className: "text-primary flex-shrink-0"
20657
- }
20658
- ),
20659
- titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsx(
20660
- Typography,
20661
- {
20662
- variant: titleField?.variant === "h3" ? "h3" : "h4",
20663
- className: cn("font-semibold truncate flex-1", isCompact && "text-sm"),
20664
- children: String(titleValue)
20665
- }
20666
- ),
20667
- badgeFields.map((field) => {
20668
- const val = getNestedValue(itemData, field.name);
20669
- if (val === void 0 || val === null) return null;
20670
- return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center flex-shrink-0", children: [
20671
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
20672
- /* @__PURE__ */ jsx(Badge, { variant: statusVariant3(String(val)), children: String(val) })
20673
- ] }, field.name);
20674
- })
20675
- ] }),
20676
- bodyFields.length > 0 && !isCompact && /* @__PURE__ */ jsx(HStack, { gap: "md", className: "mt-1.5 flex-wrap", children: bodyFields.map((field) => {
20677
- const value = getNestedValue(itemData, field.name);
20678
- if (value === void 0 || value === null || value === "") return null;
20679
- return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
20680
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
20681
- /* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "secondary", children: [
20682
- field.label ?? fieldLabel3(field.name),
20683
- ":"
20684
- ] }),
20685
- /* @__PURE__ */ jsx(Typography, { variant: "small", children: formatValue2(value, field.format) })
20686
- ] }, field.name);
20687
- }) }),
20688
- progressFields.map((field) => {
20689
- const value = getNestedValue(itemData, field.name);
20690
- if (typeof value !== "number") return null;
20691
- return /* @__PURE__ */ jsxs(Box, { className: "mt-2 max-w-xs", children: [
20692
- /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center mb-1", children: [
20693
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
20694
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel3(field.name) })
20695
- ] }),
20696
- /* @__PURE__ */ jsx(ProgressBar, { value, max: 100 })
20697
- ] }, field.name);
20698
- })
20699
- ] }),
20700
- itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
20701
- Button,
20702
- {
20703
- variant: action.variant ?? "ghost",
20704
- size: "sm",
20705
- onClick: handleActionClick(action, itemData),
20706
- "data-testid": `action-${action.event}`,
20707
- "data-row-id": String(itemData.id),
20708
- className: cn(
20709
- action.variant === "danger" && "text-error hover:bg-error/10"
20710
- ),
20711
- children: [
20712
- action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
20713
- action.label
20714
- ]
20715
- },
20716
- idx
20717
- )) })
20718
- ]
20719
- }
20720
- ),
20721
- isCard && !isLast && /* @__PURE__ */ jsx(Box, { className: "mx-6 border-b border-border/40" })
20722
- ] }, id);
20943
+ ] }, id)
20944
+ );
20723
20945
  };
20724
- return /* @__PURE__ */ jsxs(
20725
- Box,
20726
- {
20727
- className: cn(
20728
- isCard && "bg-card rounded-xl border border-border shadow-lg overflow-hidden",
20729
- !isCard && gapClass,
20730
- className
20731
- ),
20732
- children: [
20733
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React131__default.Fragment, { children: [
20734
- group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
20735
- group.items.map(
20736
- (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
20946
+ return dnd.wrapContainer(
20947
+ /* @__PURE__ */ jsxs(
20948
+ Box,
20949
+ {
20950
+ className: cn(
20951
+ isCard && "bg-card rounded-xl border border-border shadow-lg overflow-hidden",
20952
+ !isCard && gapClass,
20953
+ className
20954
+ ),
20955
+ children: [
20956
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React75__default.Fragment, { children: [
20957
+ group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
20958
+ group.items.map(
20959
+ (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
20960
+ )
20961
+ ] }, gi)),
20962
+ hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
20963
+ Button,
20964
+ {
20965
+ variant: "ghost",
20966
+ size: "sm",
20967
+ onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
20968
+ children: [
20969
+ /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
20970
+ t("common.showMore"),
20971
+ " (",
20972
+ allData.length - visibleCount,
20973
+ " remaining)"
20974
+ ]
20975
+ }
20976
+ ) }),
20977
+ infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
20978
+ InfiniteScrollSentinel,
20979
+ {
20980
+ loadMoreEvent,
20981
+ isLoading,
20982
+ hasMore
20983
+ }
20737
20984
  )
20738
- ] }, gi)),
20739
- hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
20740
- Button,
20741
- {
20742
- variant: "ghost",
20743
- size: "sm",
20744
- onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
20745
- children: [
20746
- /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
20747
- t("common.showMore"),
20748
- " (",
20749
- allData.length - visibleCount,
20750
- " remaining)"
20751
- ]
20752
- }
20753
- ) }),
20754
- infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
20755
- InfiniteScrollSentinel,
20756
- {
20757
- loadMoreEvent,
20758
- isLoading,
20759
- hasMore
20760
- }
20761
- )
20762
- ]
20763
- }
20985
+ ]
20986
+ }
20987
+ )
20764
20988
  );
20765
20989
  }
20766
20990
  var dataListLog;
@@ -20780,6 +21004,7 @@ var init_DataList = __esm({
20780
21004
  init_ProgressBar();
20781
21005
  init_Divider();
20782
21006
  init_InfiniteScrollSentinel();
21007
+ init_useDataDnd();
20783
21008
  dataListLog = createLogger("almadar:ui:data-list");
20784
21009
  DataList.displayName = "DataList";
20785
21010
  }
@@ -22038,7 +22263,7 @@ var init_WizardProgress = __esm({
22038
22263
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
22039
22264
  const isActive = index === currentStep;
22040
22265
  const isCompleted = index < currentStep;
22041
- return /* @__PURE__ */ jsxs(React131__default.Fragment, { children: [
22266
+ return /* @__PURE__ */ jsxs(React75__default.Fragment, { children: [
22042
22267
  /* @__PURE__ */ jsx(
22043
22268
  "button",
22044
22269
  {
@@ -22938,9 +23163,9 @@ function ScoreDisplay({
22938
23163
  ...rest
22939
23164
  }) {
22940
23165
  const resolvedValue = typeof value === "number" && !Number.isNaN(value) ? value : typeof rest.score === "number" && !Number.isNaN(rest.score) ? rest.score : 0;
22941
- const [displayValue, setDisplayValue] = React131.useState(resolvedValue);
22942
- const [isAnimating, setIsAnimating] = React131.useState(false);
22943
- React131.useEffect(() => {
23166
+ const [displayValue, setDisplayValue] = React75.useState(resolvedValue);
23167
+ const [isAnimating, setIsAnimating] = React75.useState(false);
23168
+ React75.useEffect(() => {
22944
23169
  if (!animated || displayValue === resolvedValue) {
22945
23170
  setDisplayValue(resolvedValue);
22946
23171
  return;
@@ -23090,7 +23315,7 @@ function InventoryGrid({
23090
23315
  const eventBus = useEventBus();
23091
23316
  const slotCount = totalSlots ?? items.length;
23092
23317
  const emptySlotCount = Math.max(0, slotCount - items.length);
23093
- const handleSelect = React131.useCallback(
23318
+ const handleSelect = React75.useCallback(
23094
23319
  (id) => {
23095
23320
  onSelect?.(id);
23096
23321
  if (selectEvent) {
@@ -23372,15 +23597,15 @@ function GameCanvas2D({
23372
23597
  fps = 60,
23373
23598
  className
23374
23599
  }) {
23375
- const canvasRef = React131.useRef(null);
23376
- const rafRef = React131.useRef(0);
23377
- const frameRef = React131.useRef(0);
23378
- const lastTimeRef = React131.useRef(0);
23379
- const onDrawRef = React131.useRef(onDraw);
23600
+ const canvasRef = React75.useRef(null);
23601
+ const rafRef = React75.useRef(0);
23602
+ const frameRef = React75.useRef(0);
23603
+ const lastTimeRef = React75.useRef(0);
23604
+ const onDrawRef = React75.useRef(onDraw);
23380
23605
  onDrawRef.current = onDraw;
23381
- const onTickRef = React131.useRef(onTick);
23606
+ const onTickRef = React75.useRef(onTick);
23382
23607
  onTickRef.current = onTick;
23383
- React131.useEffect(() => {
23608
+ React75.useEffect(() => {
23384
23609
  const canvas = canvasRef.current;
23385
23610
  if (!canvas) return;
23386
23611
  const ctx = canvas.getContext("2d");
@@ -23721,7 +23946,7 @@ function TurnPanel({
23721
23946
  className
23722
23947
  }) {
23723
23948
  const eventBus = useEventBus();
23724
- const handleAction = React131.useCallback(
23949
+ const handleAction = React75.useCallback(
23725
23950
  (event) => {
23726
23951
  if (event) {
23727
23952
  eventBus.emit(event, { turn: currentTurn, phase, activeTeam });
@@ -23867,7 +24092,7 @@ function UnitCommandBar({
23867
24092
  className
23868
24093
  }) {
23869
24094
  const eventBus = useEventBus();
23870
- const handleCommand = React131.useCallback(
24095
+ const handleCommand = React75.useCallback(
23871
24096
  (event) => {
23872
24097
  if (event) {
23873
24098
  eventBus.emit(event, { unitId: selectedUnitId });
@@ -24352,7 +24577,7 @@ function GameMenu({
24352
24577
  } catch {
24353
24578
  }
24354
24579
  const eventBus = eventBusProp || eventBusFromHook;
24355
- const handleOptionClick = React131.useCallback(
24580
+ const handleOptionClick = React75.useCallback(
24356
24581
  (option) => {
24357
24582
  if (option.event && eventBus) {
24358
24583
  eventBus.emit(`UI:${option.event}`, { option });
@@ -24466,7 +24691,7 @@ function GameOverScreen({
24466
24691
  } catch {
24467
24692
  }
24468
24693
  const eventBus = eventBusProp || eventBusFromHook;
24469
- const handleActionClick = React131.useCallback(
24694
+ const handleActionClick = React75.useCallback(
24470
24695
  (action) => {
24471
24696
  if (action.event && eventBus) {
24472
24697
  eventBus.emit(`UI:${action.event}`, { action });
@@ -27115,7 +27340,7 @@ var init_StepFlow = __esm({
27115
27340
  className
27116
27341
  }) => {
27117
27342
  if (orientation === "vertical") {
27118
- 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: [
27343
+ 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: [
27119
27344
  /* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
27120
27345
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
27121
27346
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
@@ -27126,7 +27351,7 @@ var init_StepFlow = __esm({
27126
27351
  ] })
27127
27352
  ] }) }, index)) });
27128
27353
  }
27129
- 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: [
27354
+ 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: [
27130
27355
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
27131
27356
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
27132
27357
  /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -28008,7 +28233,7 @@ var init_LikertScale = __esm({
28008
28233
  md: "text-base",
28009
28234
  lg: "text-lg"
28010
28235
  };
28011
- LikertScale = React131__default.forwardRef(
28236
+ LikertScale = React75__default.forwardRef(
28012
28237
  ({
28013
28238
  question,
28014
28239
  options = DEFAULT_LIKERT_OPTIONS,
@@ -28020,7 +28245,7 @@ var init_LikertScale = __esm({
28020
28245
  variant = "radios",
28021
28246
  className
28022
28247
  }, ref) => {
28023
- const groupId = React131__default.useId();
28248
+ const groupId = React75__default.useId();
28024
28249
  const eventBus = useEventBus();
28025
28250
  const handleSelect = useCallback(
28026
28251
  (next) => {
@@ -30246,7 +30471,7 @@ var init_DocBreadcrumb = __esm({
30246
30471
  "aria-label": "Breadcrumb",
30247
30472
  children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", wrap: true, children: items.map((item, idx) => {
30248
30473
  const isLast = idx === items.length - 1;
30249
- return /* @__PURE__ */ jsxs(React131__default.Fragment, { children: [
30474
+ return /* @__PURE__ */ jsxs(React75__default.Fragment, { children: [
30250
30475
  idx > 0 && /* @__PURE__ */ jsx(
30251
30476
  Icon,
30252
30477
  {
@@ -31136,7 +31361,7 @@ var init_MiniStateMachine = __esm({
31136
31361
  const x = 2 + i * (NODE_W + GAP + ARROW_W + GAP);
31137
31362
  const tc = transitionCounts[s.name] ?? 0;
31138
31363
  const role = getStateRole(s.name, s.isInitial, s.isTerminal, tc, maxTC);
31139
- return /* @__PURE__ */ jsxs(React131__default.Fragment, { children: [
31364
+ return /* @__PURE__ */ jsxs(React75__default.Fragment, { children: [
31140
31365
  /* @__PURE__ */ jsx(
31141
31366
  AvlState,
31142
31367
  {
@@ -32649,7 +32874,7 @@ var init_DocumentViewer = __esm({
32649
32874
  }
32650
32875
  });
32651
32876
  function extractTitle(children) {
32652
- if (!React131__default.isValidElement(children)) return void 0;
32877
+ if (!React75__default.isValidElement(children)) return void 0;
32653
32878
  const props = children.props;
32654
32879
  if (typeof props.title === "string") {
32655
32880
  return props.title;
@@ -32761,7 +32986,7 @@ function LinearView({
32761
32986
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
32762
32987
  const isDone = i < currentIdx;
32763
32988
  const isCurrent = i === currentIdx;
32764
- return /* @__PURE__ */ jsxs(React131__default.Fragment, { children: [
32989
+ return /* @__PURE__ */ jsxs(React75__default.Fragment, { children: [
32765
32990
  i > 0 && /* @__PURE__ */ jsx(
32766
32991
  Typography,
32767
32992
  {
@@ -33661,12 +33886,12 @@ var init_Form = __esm({
33661
33886
  const isSchemaEntity = isOrbitalEntitySchema(entity);
33662
33887
  const resolvedEntity = isSchemaEntity ? entity : void 0;
33663
33888
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
33664
- const normalizedInitialData = React131__default.useMemo(() => {
33889
+ const normalizedInitialData = React75__default.useMemo(() => {
33665
33890
  const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
33666
33891
  const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
33667
33892
  return entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
33668
33893
  }, [entity, initialData]);
33669
- const entityDerivedFields = React131__default.useMemo(() => {
33894
+ const entityDerivedFields = React75__default.useMemo(() => {
33670
33895
  if (fields && fields.length > 0) return void 0;
33671
33896
  if (!resolvedEntity) return void 0;
33672
33897
  return resolvedEntity.fields.map(
@@ -33685,16 +33910,16 @@ var init_Form = __esm({
33685
33910
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
33686
33911
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
33687
33912
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
33688
- const [formData, setFormData] = React131__default.useState(
33913
+ const [formData, setFormData] = React75__default.useState(
33689
33914
  normalizedInitialData
33690
33915
  );
33691
- const [collapsedSections, setCollapsedSections] = React131__default.useState(
33916
+ const [collapsedSections, setCollapsedSections] = React75__default.useState(
33692
33917
  /* @__PURE__ */ new Set()
33693
33918
  );
33694
- const [submitError, setSubmitError] = React131__default.useState(null);
33695
- const formRef = React131__default.useRef(null);
33919
+ const [submitError, setSubmitError] = React75__default.useState(null);
33920
+ const formRef = React75__default.useRef(null);
33696
33921
  const formMode = props.mode;
33697
- const mountedRef = React131__default.useRef(false);
33922
+ const mountedRef = React75__default.useRef(false);
33698
33923
  if (!mountedRef.current) {
33699
33924
  mountedRef.current = true;
33700
33925
  debug("forms", "mount", {
@@ -33707,7 +33932,7 @@ var init_Form = __esm({
33707
33932
  });
33708
33933
  }
33709
33934
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
33710
- const evalContext = React131__default.useMemo(
33935
+ const evalContext = React75__default.useMemo(
33711
33936
  () => ({
33712
33937
  formValues: formData,
33713
33938
  globalVariables: externalContext?.globalVariables ?? {},
@@ -33716,7 +33941,7 @@ var init_Form = __esm({
33716
33941
  }),
33717
33942
  [formData, externalContext]
33718
33943
  );
33719
- React131__default.useEffect(() => {
33944
+ React75__default.useEffect(() => {
33720
33945
  debug("forms", "initialData-sync", {
33721
33946
  mode: formMode,
33722
33947
  normalizedInitialData,
@@ -33727,7 +33952,7 @@ var init_Form = __esm({
33727
33952
  setFormData(normalizedInitialData);
33728
33953
  }
33729
33954
  }, [normalizedInitialData]);
33730
- const processCalculations = React131__default.useCallback(
33955
+ const processCalculations = React75__default.useCallback(
33731
33956
  (changedFieldId, newFormData) => {
33732
33957
  if (!hiddenCalculations.length) return;
33733
33958
  const context = {
@@ -33752,7 +33977,7 @@ var init_Form = __esm({
33752
33977
  },
33753
33978
  [hiddenCalculations, externalContext, eventBus]
33754
33979
  );
33755
- const checkViolations = React131__default.useCallback(
33980
+ const checkViolations = React75__default.useCallback(
33756
33981
  (changedFieldId, newFormData) => {
33757
33982
  if (!violationTriggers.length) return;
33758
33983
  const context = {
@@ -33790,7 +34015,7 @@ var init_Form = __esm({
33790
34015
  processCalculations(name, newFormData);
33791
34016
  checkViolations(name, newFormData);
33792
34017
  };
33793
- const isFieldVisible = React131__default.useCallback(
34018
+ const isFieldVisible = React75__default.useCallback(
33794
34019
  (fieldName) => {
33795
34020
  const condition = conditionalFields[fieldName];
33796
34021
  if (!condition) return true;
@@ -33798,7 +34023,7 @@ var init_Form = __esm({
33798
34023
  },
33799
34024
  [conditionalFields, evalContext]
33800
34025
  );
33801
- const isSectionVisible = React131__default.useCallback(
34026
+ const isSectionVisible = React75__default.useCallback(
33802
34027
  (section) => {
33803
34028
  if (!section.condition) return true;
33804
34029
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -33874,7 +34099,7 @@ var init_Form = __esm({
33874
34099
  eventBus.emit(`UI:${onCancel}`);
33875
34100
  }
33876
34101
  };
33877
- const renderField = React131__default.useCallback(
34102
+ const renderField = React75__default.useCallback(
33878
34103
  (field) => {
33879
34104
  const fieldName = field.name || field.field;
33880
34105
  if (!fieldName) return null;
@@ -33895,7 +34120,7 @@ var init_Form = __esm({
33895
34120
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
33896
34121
  );
33897
34122
  const effectiveFields = entityDerivedFields ?? fields;
33898
- const normalizedFields = React131__default.useMemo(() => {
34123
+ const normalizedFields = React75__default.useMemo(() => {
33899
34124
  if (!effectiveFields || effectiveFields.length === 0) return [];
33900
34125
  return effectiveFields.map((field) => {
33901
34126
  if (typeof field === "string") {
@@ -33917,7 +34142,7 @@ var init_Form = __esm({
33917
34142
  return field;
33918
34143
  });
33919
34144
  }, [effectiveFields, resolvedEntity]);
33920
- const schemaFields = React131__default.useMemo(() => {
34145
+ const schemaFields = React75__default.useMemo(() => {
33921
34146
  if (normalizedFields.length === 0) return null;
33922
34147
  if (isDebugEnabled()) {
33923
34148
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -33927,7 +34152,7 @@ var init_Form = __esm({
33927
34152
  }
33928
34153
  return normalizedFields.map(renderField).filter(Boolean);
33929
34154
  }, [normalizedFields, renderField, entityName, conditionalFields]);
33930
- const sectionElements = React131__default.useMemo(() => {
34155
+ const sectionElements = React75__default.useMemo(() => {
33931
34156
  if (!sections || sections.length === 0) return null;
33932
34157
  return sections.map((section) => {
33933
34158
  if (!isSectionVisible(section)) {
@@ -35653,7 +35878,7 @@ var init_List = __esm({
35653
35878
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
35654
35879
  return [];
35655
35880
  }, [entity]);
35656
- const getItemActions = React131__default.useCallback(
35881
+ const getItemActions = React75__default.useCallback(
35657
35882
  (item) => {
35658
35883
  if (!itemActions) return [];
35659
35884
  if (typeof itemActions === "function") {
@@ -36126,7 +36351,7 @@ var init_MediaGallery = __esm({
36126
36351
  [selectable, selectedItems, selectionEvent, eventBus]
36127
36352
  );
36128
36353
  const entityData = Array.isArray(entity) ? entity : [];
36129
- const items = React131__default.useMemo(() => {
36354
+ const items = React75__default.useMemo(() => {
36130
36355
  if (propItems) return propItems;
36131
36356
  if (entityData.length === 0) return [];
36132
36357
  return entityData.map((record, idx) => ({
@@ -36299,9 +36524,9 @@ function MiniMap({
36299
36524
  viewportRect,
36300
36525
  className
36301
36526
  }) {
36302
- const canvasRef = React131.useRef(null);
36303
- const frameRef = React131.useRef(0);
36304
- React131.useEffect(() => {
36527
+ const canvasRef = React75.useRef(null);
36528
+ const frameRef = React75.useRef(0);
36529
+ React75.useEffect(() => {
36305
36530
  const canvas = canvasRef.current;
36306
36531
  if (!canvas) return;
36307
36532
  const ctx = canvas.getContext("2d");
@@ -36383,7 +36608,7 @@ var init_MiniMap = __esm({
36383
36608
  }
36384
36609
  });
36385
36610
  function extractTitle2(children) {
36386
- if (!React131__default.isValidElement(children)) return void 0;
36611
+ if (!React75__default.isValidElement(children)) return void 0;
36387
36612
  const props = children.props;
36388
36613
  if (typeof props.title === "string") {
36389
36614
  return props.title;
@@ -37096,7 +37321,7 @@ var init_PageHeader = __esm({
37096
37321
  info: "bg-info/10 text-info"
37097
37322
  };
37098
37323
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
37099
- 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: [
37324
+ 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: [
37100
37325
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
37101
37326
  crumb.href ? /* @__PURE__ */ jsx(
37102
37327
  "a",
@@ -37437,7 +37662,7 @@ var init_debugRegistry = __esm({
37437
37662
  }
37438
37663
  });
37439
37664
  function useDebugData() {
37440
- const [data, setData] = React131.useState(() => ({
37665
+ const [data, setData] = React75.useState(() => ({
37441
37666
  traits: [],
37442
37667
  ticks: [],
37443
37668
  guards: [],
@@ -37451,7 +37676,7 @@ function useDebugData() {
37451
37676
  },
37452
37677
  lastUpdate: Date.now()
37453
37678
  }));
37454
- React131.useEffect(() => {
37679
+ React75.useEffect(() => {
37455
37680
  const updateData = () => {
37456
37681
  setData({
37457
37682
  traits: getAllTraits(),
@@ -37560,12 +37785,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
37560
37785
  return positions;
37561
37786
  }
37562
37787
  function WalkMinimap() {
37563
- const [walkStep, setWalkStep] = React131.useState(null);
37564
- const [traits2, setTraits] = React131.useState([]);
37565
- const [coveredEdges, setCoveredEdges] = React131.useState([]);
37566
- const [completedTraits, setCompletedTraits] = React131.useState(/* @__PURE__ */ new Set());
37567
- const prevTraitRef = React131.useRef(null);
37568
- React131.useEffect(() => {
37788
+ const [walkStep, setWalkStep] = React75.useState(null);
37789
+ const [traits2, setTraits] = React75.useState([]);
37790
+ const [coveredEdges, setCoveredEdges] = React75.useState([]);
37791
+ const [completedTraits, setCompletedTraits] = React75.useState(/* @__PURE__ */ new Set());
37792
+ const prevTraitRef = React75.useRef(null);
37793
+ React75.useEffect(() => {
37569
37794
  const interval = setInterval(() => {
37570
37795
  const w = window;
37571
37796
  const step = w.__orbitalWalkStep;
@@ -38012,15 +38237,15 @@ var init_EntitiesTab = __esm({
38012
38237
  }
38013
38238
  });
38014
38239
  function EventFlowTab({ events: events2 }) {
38015
- const [filter, setFilter] = React131.useState("all");
38016
- const containerRef = React131.useRef(null);
38017
- const [autoScroll, setAutoScroll] = React131.useState(true);
38018
- React131.useEffect(() => {
38240
+ const [filter, setFilter] = React75.useState("all");
38241
+ const containerRef = React75.useRef(null);
38242
+ const [autoScroll, setAutoScroll] = React75.useState(true);
38243
+ React75.useEffect(() => {
38019
38244
  if (autoScroll && containerRef.current) {
38020
38245
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
38021
38246
  }
38022
38247
  }, [events2.length, autoScroll]);
38023
- const filteredEvents = React131.useMemo(() => {
38248
+ const filteredEvents = React75.useMemo(() => {
38024
38249
  if (filter === "all") return events2;
38025
38250
  return events2.filter((e) => e.type === filter);
38026
38251
  }, [events2, filter]);
@@ -38139,7 +38364,7 @@ var init_EventFlowTab = __esm({
38139
38364
  }
38140
38365
  });
38141
38366
  function GuardsPanel({ guards }) {
38142
- const [filter, setFilter] = React131.useState("all");
38367
+ const [filter, setFilter] = React75.useState("all");
38143
38368
  if (guards.length === 0) {
38144
38369
  return /* @__PURE__ */ jsx(
38145
38370
  EmptyState,
@@ -38152,7 +38377,7 @@ function GuardsPanel({ guards }) {
38152
38377
  }
38153
38378
  const passedCount = guards.filter((g) => g.result).length;
38154
38379
  const failedCount = guards.length - passedCount;
38155
- const filteredGuards = React131.useMemo(() => {
38380
+ const filteredGuards = React75.useMemo(() => {
38156
38381
  if (filter === "all") return guards;
38157
38382
  if (filter === "passed") return guards.filter((g) => g.result);
38158
38383
  return guards.filter((g) => !g.result);
@@ -38313,10 +38538,10 @@ function EffectBadge({ effect }) {
38313
38538
  ] });
38314
38539
  }
38315
38540
  function TransitionTimeline({ transitions }) {
38316
- const containerRef = React131.useRef(null);
38317
- const [autoScroll, setAutoScroll] = React131.useState(true);
38318
- const [expandedId, setExpandedId] = React131.useState(null);
38319
- React131.useEffect(() => {
38541
+ const containerRef = React75.useRef(null);
38542
+ const [autoScroll, setAutoScroll] = React75.useState(true);
38543
+ const [expandedId, setExpandedId] = React75.useState(null);
38544
+ React75.useEffect(() => {
38320
38545
  if (autoScroll && containerRef.current) {
38321
38546
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
38322
38547
  }
@@ -38602,9 +38827,9 @@ function getAllEvents(traits2) {
38602
38827
  }
38603
38828
  function EventDispatcherTab({ traits: traits2, schema }) {
38604
38829
  const eventBus = useEventBus();
38605
- const [log18, setLog] = React131.useState([]);
38606
- const prevStatesRef = React131.useRef(/* @__PURE__ */ new Map());
38607
- React131.useEffect(() => {
38830
+ const [log18, setLog] = React75.useState([]);
38831
+ const prevStatesRef = React75.useRef(/* @__PURE__ */ new Map());
38832
+ React75.useEffect(() => {
38608
38833
  for (const trait of traits2) {
38609
38834
  const prev = prevStatesRef.current.get(trait.id);
38610
38835
  if (prev && prev !== trait.currentState) {
@@ -38774,10 +38999,10 @@ function VerifyModePanel({
38774
38999
  serverCount,
38775
39000
  localCount
38776
39001
  }) {
38777
- const [expanded, setExpanded] = React131.useState(true);
38778
- const scrollRef = React131.useRef(null);
38779
- const prevCountRef = React131.useRef(0);
38780
- React131.useEffect(() => {
39002
+ const [expanded, setExpanded] = React75.useState(true);
39003
+ const scrollRef = React75.useRef(null);
39004
+ const prevCountRef = React75.useRef(0);
39005
+ React75.useEffect(() => {
38781
39006
  if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
38782
39007
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
38783
39008
  }
@@ -38843,10 +39068,10 @@ function RuntimeDebugger({
38843
39068
  defaultTab,
38844
39069
  schema
38845
39070
  }) {
38846
- const [isCollapsed, setIsCollapsed] = React131.useState(mode === "verify" ? true : defaultCollapsed);
38847
- const [isVisible, setIsVisible] = React131.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
39071
+ const [isCollapsed, setIsCollapsed] = React75.useState(mode === "verify" ? true : defaultCollapsed);
39072
+ const [isVisible, setIsVisible] = React75.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
38848
39073
  const debugData = useDebugData();
38849
- React131.useEffect(() => {
39074
+ React75.useEffect(() => {
38850
39075
  if (mode === "inline") return;
38851
39076
  return onDebugToggle((enabled) => {
38852
39077
  setIsVisible(enabled);
@@ -38855,7 +39080,7 @@ function RuntimeDebugger({
38855
39080
  }
38856
39081
  });
38857
39082
  }, [mode]);
38858
- React131.useEffect(() => {
39083
+ React75.useEffect(() => {
38859
39084
  if (mode === "inline") return;
38860
39085
  const handleKeyDown = (e) => {
38861
39086
  if (e.key === "`" && isVisible) {
@@ -39404,7 +39629,7 @@ function SequenceBar({
39404
39629
  onSlotRemove(index);
39405
39630
  }, [onSlotRemove, playing]);
39406
39631
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
39407
- return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React131__default.Fragment, { children: [
39632
+ return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React75__default.Fragment, { children: [
39408
39633
  i > 0 && /* @__PURE__ */ jsx(
39409
39634
  Typography,
39410
39635
  {
@@ -40916,7 +41141,7 @@ var init_StatCard = __esm({
40916
41141
  const labelToUse = propLabel ?? propTitle;
40917
41142
  const eventBus = useEventBus();
40918
41143
  const { t } = useTranslate();
40919
- const handleActionClick = React131__default.useCallback(() => {
41144
+ const handleActionClick = React75__default.useCallback(() => {
40920
41145
  if (action?.event) {
40921
41146
  eventBus.emit(`UI:${action.event}`, {});
40922
41147
  }
@@ -40927,7 +41152,7 @@ var init_StatCard = __esm({
40927
41152
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
40928
41153
  const isLoading = externalLoading ?? false;
40929
41154
  const error = externalError;
40930
- const computeMetricValue = React131__default.useCallback(
41155
+ const computeMetricValue = React75__default.useCallback(
40931
41156
  (metric, items) => {
40932
41157
  if (metric.value !== void 0) {
40933
41158
  return metric.value;
@@ -40966,7 +41191,7 @@ var init_StatCard = __esm({
40966
41191
  },
40967
41192
  []
40968
41193
  );
40969
- const schemaStats = React131__default.useMemo(() => {
41194
+ const schemaStats = React75__default.useMemo(() => {
40970
41195
  if (!metrics || metrics.length === 0) return null;
40971
41196
  return metrics.map((metric) => ({
40972
41197
  label: metric.label,
@@ -40974,7 +41199,7 @@ var init_StatCard = __esm({
40974
41199
  format: metric.format
40975
41200
  }));
40976
41201
  }, [metrics, data, computeMetricValue]);
40977
- const calculatedTrend = React131__default.useMemo(() => {
41202
+ const calculatedTrend = React75__default.useMemo(() => {
40978
41203
  if (manualTrend !== void 0) return manualTrend;
40979
41204
  if (previousValue === void 0 || currentValue === void 0)
40980
41205
  return void 0;
@@ -42181,7 +42406,7 @@ var init_Timeline = __esm({
42181
42406
  }) => {
42182
42407
  const { t } = useTranslate();
42183
42408
  const entityData = Array.isArray(entity) ? entity : [];
42184
- const items = React131__default.useMemo(() => {
42409
+ const items = React75__default.useMemo(() => {
42185
42410
  if (propItems) return propItems;
42186
42411
  if (entityData.length === 0) return [];
42187
42412
  return entityData.map((record, idx) => {
@@ -42338,7 +42563,7 @@ var init_TimerDisplay = __esm({
42338
42563
  }
42339
42564
  });
42340
42565
  function extractToastProps(children) {
42341
- if (!React131__default.isValidElement(children)) {
42566
+ if (!React75__default.isValidElement(children)) {
42342
42567
  if (typeof children === "string") {
42343
42568
  return { message: children };
42344
42569
  }
@@ -42376,7 +42601,7 @@ var init_ToastSlot = __esm({
42376
42601
  eventBus.emit("UI:CLOSE");
42377
42602
  };
42378
42603
  if (!isVisible) return null;
42379
- const isCustomContent = React131__default.isValidElement(children) && !message;
42604
+ const isCustomContent = React75__default.isValidElement(children) && !message;
42380
42605
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
42381
42606
  Toast,
42382
42607
  {
@@ -42645,7 +42870,7 @@ var init_WizardContainer = __esm({
42645
42870
  const isCompleted = index < currentStep;
42646
42871
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
42647
42872
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
42648
- return /* @__PURE__ */ jsxs(React131__default.Fragment, { children: [
42873
+ return /* @__PURE__ */ jsxs(React75__default.Fragment, { children: [
42649
42874
  /* @__PURE__ */ jsx(
42650
42875
  Button,
42651
42876
  {
@@ -43095,12 +43320,12 @@ var init_XPBar = __esm({
43095
43320
  }
43096
43321
  });
43097
43322
  function lazyThree(name, loader) {
43098
- const Lazy = React131__default.lazy(() => loader().then((m) => ({ default: m[name] })));
43323
+ const Lazy = React75__default.lazy(() => loader().then((m) => ({ default: m[name] })));
43099
43324
  function ThreeWrapper(props) {
43100
- return React131__default.createElement(
43101
- React131__default.Suspense,
43325
+ return React75__default.createElement(
43326
+ React75__default.Suspense,
43102
43327
  { fallback: null },
43103
- React131__default.createElement(Lazy, props)
43328
+ React75__default.createElement(Lazy, props)
43104
43329
  );
43105
43330
  }
43106
43331
  ThreeWrapper.displayName = `Lazy(${name})`;
@@ -43704,7 +43929,7 @@ function SuspenseConfigProvider({
43704
43929
  config,
43705
43930
  children
43706
43931
  }) {
43707
- return React131__default.createElement(
43932
+ return React75__default.createElement(
43708
43933
  SuspenseConfigContext.Provider,
43709
43934
  { value: config },
43710
43935
  children
@@ -44187,7 +44412,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
44187
44412
  const key = `${parentId}-${index}-trait:${traitName}`;
44188
44413
  return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
44189
44414
  }
44190
- return /* @__PURE__ */ jsx(React131__default.Fragment, { children: child }, `${parentId}-${index}`);
44415
+ return /* @__PURE__ */ jsx(React75__default.Fragment, { children: child }, `${parentId}-${index}`);
44191
44416
  }
44192
44417
  if (!child || typeof child !== "object") return null;
44193
44418
  const childId = `${parentId}-${index}`;
@@ -44224,14 +44449,14 @@ function isPatternConfig(value) {
44224
44449
  if (value === null || value === void 0) return false;
44225
44450
  if (typeof value !== "object") return false;
44226
44451
  if (Array.isArray(value)) return false;
44227
- if (React131__default.isValidElement(value)) return false;
44452
+ if (React75__default.isValidElement(value)) return false;
44228
44453
  if (value instanceof Date) return false;
44229
44454
  if (typeof value === "function") return false;
44230
44455
  const record = value;
44231
44456
  return "type" in record && typeof record.type === "string";
44232
44457
  }
44233
44458
  function isPlainConfigObject(value) {
44234
- if (React131__default.isValidElement(value)) return false;
44459
+ if (React75__default.isValidElement(value)) return false;
44235
44460
  if (value instanceof Date) return false;
44236
44461
  const proto = Object.getPrototypeOf(value);
44237
44462
  return proto === Object.prototype || proto === null;
@@ -44675,7 +44900,7 @@ var FormSection = ({
44675
44900
  columns = 1,
44676
44901
  className
44677
44902
  }) => {
44678
- const [collapsed, setCollapsed] = React131__default.useState(defaultCollapsed);
44903
+ const [collapsed, setCollapsed] = React75__default.useState(defaultCollapsed);
44679
44904
  const { t } = useTranslate();
44680
44905
  const eventBus = useEventBus();
44681
44906
  const gridClass = {
@@ -44683,7 +44908,7 @@ var FormSection = ({
44683
44908
  2: "grid-cols-1 md:grid-cols-2",
44684
44909
  3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
44685
44910
  }[columns];
44686
- React131__default.useCallback(() => {
44911
+ React75__default.useCallback(() => {
44687
44912
  if (collapsible) {
44688
44913
  setCollapsed((prev) => !prev);
44689
44914
  eventBus.emit("UI:TOGGLE_COLLAPSE", { collapsed: !collapsed });