@almadar/ui 4.49.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,196 +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(isSelected && "ring-2 ring-primary rounded-lg"),
20203
- children: children(itemData, index)
20204
- },
20205
- id
20206
- );
20207
- }
20208
- const titleValue = getNestedValue(itemData, titleField?.name ?? "");
20209
- return /* @__PURE__ */ jsxs(
20210
- Box,
20211
- {
20212
- "data-entity-row": true,
20213
- "data-entity-id": id,
20214
- className: cn(
20215
- "bg-card rounded-lg",
20216
- "border border-border",
20217
- "shadow-sm hover:shadow-lg",
20218
- "hover:border-primary transition-all",
20219
- "flex flex-col",
20220
- isSelected && "ring-2 ring-primary border-primary"
20221
- ),
20222
- children: [
20223
- imageField && (() => {
20224
- const imgUrl = getNestedValue(itemData, imageField);
20225
- if (!imgUrl || typeof imgUrl !== "string") return null;
20226
- return /* @__PURE__ */ jsx(Box, { className: "w-full aspect-video overflow-hidden rounded-t-lg", children: /* @__PURE__ */ jsx(
20227
- "img",
20228
- {
20229
- src: imgUrl,
20230
- alt: titleValue !== void 0 ? String(titleValue) : "",
20231
- className: "w-full h-full object-cover",
20232
- loading: "lazy"
20233
- }
20234
- ) });
20235
- })(),
20236
- /* @__PURE__ */ jsx(Box, { className: "p-4 pb-0", children: /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-start", children: [
20237
- selectable && /* @__PURE__ */ jsx(
20238
- "input",
20239
- {
20240
- type: "checkbox",
20241
- checked: isSelected,
20242
- onChange: () => toggleSelection(id),
20243
- onClick: (e) => e.stopPropagation(),
20244
- className: "w-4 h-4 mt-1 flex-shrink-0 accent-primary",
20245
- "aria-label": `Select ${titleValue !== void 0 ? String(titleValue) : "item"}`
20246
- }
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"
20247
20434
  ),
20248
- /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: "flex-1 min-w-0", children: [
20249
- titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
20250
- titleField?.icon && /* @__PURE__ */ jsx(Icon, { name: titleField.icon, size: "sm", className: "text-primary flex-shrink-0" }),
20251
- /* @__PURE__ */ jsx(
20252
- Typography,
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",
20253
20441
  {
20254
- variant: titleField?.variant === "h3" ? "h3" : "h4",
20255
- className: "font-semibold truncate",
20256
- children: String(titleValue)
20442
+ src: imgUrl,
20443
+ alt: titleValue !== void 0 ? String(titleValue) : "",
20444
+ className: "w-full h-full object-cover",
20445
+ loading: "lazy"
20257
20446
  }
20258
- )
20259
- ] }),
20260
- badgeFields.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap", children: badgeFields.map((field) => {
20261
- const val = getNestedValue(itemData, field.name);
20262
- if (val === void 0 || val === null) return null;
20263
- return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
20264
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
20265
- /* @__PURE__ */ jsx(Badge, { variant: resolveBadgeVariant(field, String(val)), children: String(val) })
20266
- ] }, field.name);
20267
- }) })
20268
- ] }),
20269
- dangerActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: dangerActions.map((action, idx) => /* @__PURE__ */ jsxs(
20270
- Button,
20271
- {
20272
- variant: "ghost",
20273
- size: "sm",
20274
- onClick: handleActionClick(action, itemData),
20275
- "data-testid": `action-${action.event}`,
20276
- "data-row-id": String(itemData.id),
20277
- className: "text-error hover:text-error hover:bg-error/10 px-2",
20278
- children: [
20279
- action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs" }),
20280
- action.label
20281
- ]
20282
- },
20283
- idx
20284
- )) })
20285
- ] }) }),
20286
- bodyFields.length > 0 && /* @__PURE__ */ jsx(Box, { className: "px-4 py-3 flex-1", children: /* @__PURE__ */ jsx(VStack, { gap: "xs", children: bodyFields.map((field) => {
20287
- const value = getNestedValue(itemData, field.name);
20288
- if (value === void 0 || value === null || value === "") return null;
20289
- if (field.format === "boolean") {
20290
- return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-center", children: [
20291
- /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
20292
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
20293
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
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
+ }) })
20294
20481
  ] }),
20295
- /* @__PURE__ */ jsx(Badge, { variant: value ? "success" : "neutral", children: value ? t("common.yes") || "Yes" : t("common.no") || "No" })
20296
- ] }, field.name);
20297
- }
20298
- return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-center", children: [
20299
- /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
20300
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
20301
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
20302
- ] }),
20303
- /* @__PURE__ */ jsx(
20304
- Typography,
20305
- {
20306
- variant: field.variant === "caption" ? "caption" : "small",
20307
- className: "text-right truncate max-w-[60%]",
20308
- children: formatValue(value, field.format)
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);
20309
20510
  }
20310
- )
20311
- ] }, field.name);
20312
- }) }) }),
20313
- primaryActions.length > 0 && /* @__PURE__ */ jsx(Box, { className: "px-4 py-3 mt-auto border-t border-border", children: /* @__PURE__ */ jsx(HStack, { gap: "sm", className: "justify-end", children: primaryActions.map((action, idx) => /* @__PURE__ */ jsxs(
20314
- Button,
20315
- {
20316
- variant: action.variant === "primary" ? "primary" : "ghost",
20317
- size: "sm",
20318
- onClick: handleActionClick(action, itemData),
20319
- "data-testid": `action-${action.event}`,
20320
- "data-row-id": String(itemData.id),
20321
- children: [
20322
- action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
20323
- action.label
20324
- ]
20325
- },
20326
- idx
20327
- )) }) })
20328
- ]
20329
- },
20330
- id
20331
- );
20332
- })
20333
- }
20334
- ),
20335
- hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
20336
- Button,
20337
- {
20338
- variant: "ghost",
20339
- size: "sm",
20340
- onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
20341
- children: [
20342
- /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
20343
- t("common.showMore"),
20344
- " (",
20345
- allData.length - visibleCount,
20346
- " remaining)"
20347
- ]
20348
- }
20349
- ) }),
20350
- infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
20351
- InfiniteScrollSentinel,
20352
- {
20353
- loadMoreEvent,
20354
- isLoading,
20355
- hasMore
20356
- }
20357
- )
20358
- ] });
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
+ );
20359
20574
  }
20360
20575
  var dataGridLog, BADGE_VARIANTS, gapStyles6;
20361
20576
  var init_DataGrid = __esm({
@@ -20372,6 +20587,7 @@ var init_DataGrid = __esm({
20372
20587
  init_Button();
20373
20588
  init_Icon();
20374
20589
  init_InfiniteScrollSentinel();
20590
+ init_useDataDnd();
20375
20591
  dataGridLog = createLogger("almadar:ui:data-grid");
20376
20592
  BADGE_VARIANTS = /* @__PURE__ */ new Set([
20377
20593
  "default",
@@ -20466,17 +20682,34 @@ function DataList({
20466
20682
  hasMore,
20467
20683
  children,
20468
20684
  pageSize = 5,
20469
- renderItem: schemaRenderItem
20685
+ renderItem: schemaRenderItem,
20686
+ dragGroup,
20687
+ accepts,
20688
+ sortable: sortableProp,
20689
+ dropEvent,
20690
+ reorderEvent: dndReorderEvent,
20691
+ dndItemIdField
20470
20692
  }) {
20471
20693
  const eventBus = useEventBus();
20472
20694
  const { t } = useTranslate();
20473
- const [visibleCount, setVisibleCount] = React131__default.useState(pageSize || Infinity);
20695
+ const [visibleCount, setVisibleCount] = React75__default.useState(pageSize || Infinity);
20474
20696
  const fieldDefs = fields ?? columns ?? [];
20475
- 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;
20476
20709
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
20477
20710
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
20478
20711
  const hasRenderProp = typeof children === "function";
20479
- React131__default.useEffect(() => {
20712
+ React75__default.useEffect(() => {
20480
20713
  const renderItemTypeOf = typeof schemaRenderItem;
20481
20714
  const childrenTypeOf = typeof children;
20482
20715
  if (data.length > 0 && !hasRenderProp) {
@@ -20532,7 +20765,7 @@ function DataList({
20532
20765
  const items2 = data.map((item) => item);
20533
20766
  const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
20534
20767
  const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
20535
- return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React131__default.Fragment, { children: [
20768
+ return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React75__default.Fragment, { children: [
20536
20769
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
20537
20770
  group.items.map((itemData, index) => {
20538
20771
  const id = itemData.id || `${gi}-${index}`;
@@ -20580,18 +20813,112 @@ function DataList({
20580
20813
  }
20581
20814
  const items = data.map((item) => item);
20582
20815
  const groups = groupBy ? groupData(items, groupBy) : [{ label: "", items }];
20816
+ const idFieldName = dndItemIdField ?? "id";
20583
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;
20584
20820
  if (hasRenderProp) {
20585
20821
  const id2 = itemData.id || String(index);
20586
- return /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id2, children: [
20587
- /* @__PURE__ */ jsxs(Box, { className: "group flex items-stretch gap-2", children: [
20588
- /* @__PURE__ */ jsx(Box, { className: "flex-1 min-w-0", children: children(itemData, index) }),
20589
- itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(
20590
- HStack,
20591
- {
20592
- gap: "xs",
20593
- className: "flex-shrink-0",
20594
- children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
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: [
20860
+ /* @__PURE__ */ jsxs(
20861
+ Box,
20862
+ {
20863
+ className: cn(
20864
+ "group flex items-center gap-4 transition-all duration-200",
20865
+ isCompact ? "px-4 py-2" : "px-6 py-4",
20866
+ "hover:bg-muted/80",
20867
+ !isCard && !isCompact && "rounded-lg border border-transparent hover:border-border"
20868
+ ),
20869
+ children: [
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,
20874
+ {
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(
20595
20922
  Button,
20596
20923
  {
20597
20924
  variant: action.variant ?? "ghost",
@@ -20608,141 +20935,56 @@ function DataList({
20608
20935
  ]
20609
20936
  },
20610
20937
  idx
20611
- ))
20612
- }
20613
- )
20614
- ] }),
20938
+ )) })
20939
+ ]
20940
+ }
20941
+ ),
20615
20942
  isCard && !isLast && /* @__PURE__ */ jsx(Box, { className: "mx-6 border-b border-border/40" })
20616
- ] }, id2);
20617
- }
20618
- const id = itemData.id || String(index);
20619
- const titleValue = getNestedValue(itemData, titleField?.name ?? "");
20620
- return /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id, children: [
20621
- /* @__PURE__ */ jsxs(
20622
- Box,
20623
- {
20624
- className: cn(
20625
- "group flex items-center gap-4 transition-all duration-200",
20626
- isCompact ? "px-4 py-2" : "px-6 py-4",
20627
- "hover:bg-muted/80",
20628
- !isCard && !isCompact && "rounded-lg border border-transparent hover:border-border"
20629
- ),
20630
- children: [
20631
- /* @__PURE__ */ jsxs(Box, { className: "flex-1 min-w-0", children: [
20632
- /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "items-center", children: [
20633
- titleField?.icon && /* @__PURE__ */ jsx(
20634
- Icon,
20635
- {
20636
- name: titleField.icon,
20637
- size: isCompact ? "xs" : "sm",
20638
- className: "text-primary flex-shrink-0"
20639
- }
20640
- ),
20641
- titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsx(
20642
- Typography,
20643
- {
20644
- variant: titleField?.variant === "h3" ? "h3" : "h4",
20645
- className: cn("font-semibold truncate flex-1", isCompact && "text-sm"),
20646
- children: String(titleValue)
20647
- }
20648
- ),
20649
- badgeFields.map((field) => {
20650
- const val = getNestedValue(itemData, field.name);
20651
- if (val === void 0 || val === null) return null;
20652
- return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center flex-shrink-0", children: [
20653
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
20654
- /* @__PURE__ */ jsx(Badge, { variant: statusVariant3(String(val)), children: String(val) })
20655
- ] }, field.name);
20656
- })
20657
- ] }),
20658
- bodyFields.length > 0 && !isCompact && /* @__PURE__ */ jsx(HStack, { gap: "md", className: "mt-1.5 flex-wrap", children: bodyFields.map((field) => {
20659
- const value = getNestedValue(itemData, field.name);
20660
- if (value === void 0 || value === null || value === "") return null;
20661
- return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
20662
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
20663
- /* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "secondary", children: [
20664
- field.label ?? fieldLabel3(field.name),
20665
- ":"
20666
- ] }),
20667
- /* @__PURE__ */ jsx(Typography, { variant: "small", children: formatValue2(value, field.format) })
20668
- ] }, field.name);
20669
- }) }),
20670
- progressFields.map((field) => {
20671
- const value = getNestedValue(itemData, field.name);
20672
- if (typeof value !== "number") return null;
20673
- return /* @__PURE__ */ jsxs(Box, { className: "mt-2 max-w-xs", children: [
20674
- /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center mb-1", children: [
20675
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
20676
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel3(field.name) })
20677
- ] }),
20678
- /* @__PURE__ */ jsx(ProgressBar, { value, max: 100 })
20679
- ] }, field.name);
20680
- })
20681
- ] }),
20682
- itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
20683
- Button,
20684
- {
20685
- variant: action.variant ?? "ghost",
20686
- size: "sm",
20687
- onClick: handleActionClick(action, itemData),
20688
- "data-testid": `action-${action.event}`,
20689
- "data-row-id": String(itemData.id),
20690
- className: cn(
20691
- action.variant === "danger" && "text-error hover:bg-error/10"
20692
- ),
20693
- children: [
20694
- action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
20695
- action.label
20696
- ]
20697
- },
20698
- idx
20699
- )) })
20700
- ]
20701
- }
20702
- ),
20703
- isCard && !isLast && /* @__PURE__ */ jsx(Box, { className: "mx-6 border-b border-border/40" })
20704
- ] }, id);
20943
+ ] }, id)
20944
+ );
20705
20945
  };
20706
- return /* @__PURE__ */ jsxs(
20707
- Box,
20708
- {
20709
- className: cn(
20710
- isCard && "bg-card rounded-xl border border-border shadow-lg overflow-hidden",
20711
- !isCard && gapClass,
20712
- className
20713
- ),
20714
- children: [
20715
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React131__default.Fragment, { children: [
20716
- group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
20717
- group.items.map(
20718
- (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
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
+ }
20719
20984
  )
20720
- ] }, gi)),
20721
- hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
20722
- Button,
20723
- {
20724
- variant: "ghost",
20725
- size: "sm",
20726
- onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
20727
- children: [
20728
- /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
20729
- t("common.showMore"),
20730
- " (",
20731
- allData.length - visibleCount,
20732
- " remaining)"
20733
- ]
20734
- }
20735
- ) }),
20736
- infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
20737
- InfiniteScrollSentinel,
20738
- {
20739
- loadMoreEvent,
20740
- isLoading,
20741
- hasMore
20742
- }
20743
- )
20744
- ]
20745
- }
20985
+ ]
20986
+ }
20987
+ )
20746
20988
  );
20747
20989
  }
20748
20990
  var dataListLog;
@@ -20762,6 +21004,7 @@ var init_DataList = __esm({
20762
21004
  init_ProgressBar();
20763
21005
  init_Divider();
20764
21006
  init_InfiniteScrollSentinel();
21007
+ init_useDataDnd();
20765
21008
  dataListLog = createLogger("almadar:ui:data-list");
20766
21009
  DataList.displayName = "DataList";
20767
21010
  }
@@ -22020,7 +22263,7 @@ var init_WizardProgress = __esm({
22020
22263
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
22021
22264
  const isActive = index === currentStep;
22022
22265
  const isCompleted = index < currentStep;
22023
- return /* @__PURE__ */ jsxs(React131__default.Fragment, { children: [
22266
+ return /* @__PURE__ */ jsxs(React75__default.Fragment, { children: [
22024
22267
  /* @__PURE__ */ jsx(
22025
22268
  "button",
22026
22269
  {
@@ -22920,9 +23163,9 @@ function ScoreDisplay({
22920
23163
  ...rest
22921
23164
  }) {
22922
23165
  const resolvedValue = typeof value === "number" && !Number.isNaN(value) ? value : typeof rest.score === "number" && !Number.isNaN(rest.score) ? rest.score : 0;
22923
- const [displayValue, setDisplayValue] = React131.useState(resolvedValue);
22924
- const [isAnimating, setIsAnimating] = React131.useState(false);
22925
- React131.useEffect(() => {
23166
+ const [displayValue, setDisplayValue] = React75.useState(resolvedValue);
23167
+ const [isAnimating, setIsAnimating] = React75.useState(false);
23168
+ React75.useEffect(() => {
22926
23169
  if (!animated || displayValue === resolvedValue) {
22927
23170
  setDisplayValue(resolvedValue);
22928
23171
  return;
@@ -23072,7 +23315,7 @@ function InventoryGrid({
23072
23315
  const eventBus = useEventBus();
23073
23316
  const slotCount = totalSlots ?? items.length;
23074
23317
  const emptySlotCount = Math.max(0, slotCount - items.length);
23075
- const handleSelect = React131.useCallback(
23318
+ const handleSelect = React75.useCallback(
23076
23319
  (id) => {
23077
23320
  onSelect?.(id);
23078
23321
  if (selectEvent) {
@@ -23354,15 +23597,15 @@ function GameCanvas2D({
23354
23597
  fps = 60,
23355
23598
  className
23356
23599
  }) {
23357
- const canvasRef = React131.useRef(null);
23358
- const rafRef = React131.useRef(0);
23359
- const frameRef = React131.useRef(0);
23360
- const lastTimeRef = React131.useRef(0);
23361
- const onDrawRef = React131.useRef(onDraw);
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);
23362
23605
  onDrawRef.current = onDraw;
23363
- const onTickRef = React131.useRef(onTick);
23606
+ const onTickRef = React75.useRef(onTick);
23364
23607
  onTickRef.current = onTick;
23365
- React131.useEffect(() => {
23608
+ React75.useEffect(() => {
23366
23609
  const canvas = canvasRef.current;
23367
23610
  if (!canvas) return;
23368
23611
  const ctx = canvas.getContext("2d");
@@ -23703,7 +23946,7 @@ function TurnPanel({
23703
23946
  className
23704
23947
  }) {
23705
23948
  const eventBus = useEventBus();
23706
- const handleAction = React131.useCallback(
23949
+ const handleAction = React75.useCallback(
23707
23950
  (event) => {
23708
23951
  if (event) {
23709
23952
  eventBus.emit(event, { turn: currentTurn, phase, activeTeam });
@@ -23849,7 +24092,7 @@ function UnitCommandBar({
23849
24092
  className
23850
24093
  }) {
23851
24094
  const eventBus = useEventBus();
23852
- const handleCommand = React131.useCallback(
24095
+ const handleCommand = React75.useCallback(
23853
24096
  (event) => {
23854
24097
  if (event) {
23855
24098
  eventBus.emit(event, { unitId: selectedUnitId });
@@ -24334,7 +24577,7 @@ function GameMenu({
24334
24577
  } catch {
24335
24578
  }
24336
24579
  const eventBus = eventBusProp || eventBusFromHook;
24337
- const handleOptionClick = React131.useCallback(
24580
+ const handleOptionClick = React75.useCallback(
24338
24581
  (option) => {
24339
24582
  if (option.event && eventBus) {
24340
24583
  eventBus.emit(`UI:${option.event}`, { option });
@@ -24448,7 +24691,7 @@ function GameOverScreen({
24448
24691
  } catch {
24449
24692
  }
24450
24693
  const eventBus = eventBusProp || eventBusFromHook;
24451
- const handleActionClick = React131.useCallback(
24694
+ const handleActionClick = React75.useCallback(
24452
24695
  (action) => {
24453
24696
  if (action.event && eventBus) {
24454
24697
  eventBus.emit(`UI:${action.event}`, { action });
@@ -27097,7 +27340,7 @@ var init_StepFlow = __esm({
27097
27340
  className
27098
27341
  }) => {
27099
27342
  if (orientation === "vertical") {
27100
- return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React131__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
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: [
27101
27344
  /* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
27102
27345
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
27103
27346
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
@@ -27108,7 +27351,7 @@ var init_StepFlow = __esm({
27108
27351
  ] })
27109
27352
  ] }) }, index)) });
27110
27353
  }
27111
- return /* @__PURE__ */ jsx(Box, { className: cn("w-full flex flex-col md:flex-row items-start gap-0", className), children: steps.map((step, index) => /* @__PURE__ */ jsxs(React131__default.Fragment, { children: [
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: [
27112
27355
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
27113
27356
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
27114
27357
  /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -27990,7 +28233,7 @@ var init_LikertScale = __esm({
27990
28233
  md: "text-base",
27991
28234
  lg: "text-lg"
27992
28235
  };
27993
- LikertScale = React131__default.forwardRef(
28236
+ LikertScale = React75__default.forwardRef(
27994
28237
  ({
27995
28238
  question,
27996
28239
  options = DEFAULT_LIKERT_OPTIONS,
@@ -28002,7 +28245,7 @@ var init_LikertScale = __esm({
28002
28245
  variant = "radios",
28003
28246
  className
28004
28247
  }, ref) => {
28005
- const groupId = React131__default.useId();
28248
+ const groupId = React75__default.useId();
28006
28249
  const eventBus = useEventBus();
28007
28250
  const handleSelect = useCallback(
28008
28251
  (next) => {
@@ -30228,7 +30471,7 @@ var init_DocBreadcrumb = __esm({
30228
30471
  "aria-label": "Breadcrumb",
30229
30472
  children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", wrap: true, children: items.map((item, idx) => {
30230
30473
  const isLast = idx === items.length - 1;
30231
- return /* @__PURE__ */ jsxs(React131__default.Fragment, { children: [
30474
+ return /* @__PURE__ */ jsxs(React75__default.Fragment, { children: [
30232
30475
  idx > 0 && /* @__PURE__ */ jsx(
30233
30476
  Icon,
30234
30477
  {
@@ -31118,7 +31361,7 @@ var init_MiniStateMachine = __esm({
31118
31361
  const x = 2 + i * (NODE_W + GAP + ARROW_W + GAP);
31119
31362
  const tc = transitionCounts[s.name] ?? 0;
31120
31363
  const role = getStateRole(s.name, s.isInitial, s.isTerminal, tc, maxTC);
31121
- return /* @__PURE__ */ jsxs(React131__default.Fragment, { children: [
31364
+ return /* @__PURE__ */ jsxs(React75__default.Fragment, { children: [
31122
31365
  /* @__PURE__ */ jsx(
31123
31366
  AvlState,
31124
31367
  {
@@ -32631,7 +32874,7 @@ var init_DocumentViewer = __esm({
32631
32874
  }
32632
32875
  });
32633
32876
  function extractTitle(children) {
32634
- if (!React131__default.isValidElement(children)) return void 0;
32877
+ if (!React75__default.isValidElement(children)) return void 0;
32635
32878
  const props = children.props;
32636
32879
  if (typeof props.title === "string") {
32637
32880
  return props.title;
@@ -32743,7 +32986,7 @@ function LinearView({
32743
32986
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
32744
32987
  const isDone = i < currentIdx;
32745
32988
  const isCurrent = i === currentIdx;
32746
- return /* @__PURE__ */ jsxs(React131__default.Fragment, { children: [
32989
+ return /* @__PURE__ */ jsxs(React75__default.Fragment, { children: [
32747
32990
  i > 0 && /* @__PURE__ */ jsx(
32748
32991
  Typography,
32749
32992
  {
@@ -33643,12 +33886,12 @@ var init_Form = __esm({
33643
33886
  const isSchemaEntity = isOrbitalEntitySchema(entity);
33644
33887
  const resolvedEntity = isSchemaEntity ? entity : void 0;
33645
33888
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
33646
- const normalizedInitialData = React131__default.useMemo(() => {
33889
+ const normalizedInitialData = React75__default.useMemo(() => {
33647
33890
  const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
33648
33891
  const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
33649
33892
  return entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
33650
33893
  }, [entity, initialData]);
33651
- const entityDerivedFields = React131__default.useMemo(() => {
33894
+ const entityDerivedFields = React75__default.useMemo(() => {
33652
33895
  if (fields && fields.length > 0) return void 0;
33653
33896
  if (!resolvedEntity) return void 0;
33654
33897
  return resolvedEntity.fields.map(
@@ -33667,16 +33910,16 @@ var init_Form = __esm({
33667
33910
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
33668
33911
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
33669
33912
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
33670
- const [formData, setFormData] = React131__default.useState(
33913
+ const [formData, setFormData] = React75__default.useState(
33671
33914
  normalizedInitialData
33672
33915
  );
33673
- const [collapsedSections, setCollapsedSections] = React131__default.useState(
33916
+ const [collapsedSections, setCollapsedSections] = React75__default.useState(
33674
33917
  /* @__PURE__ */ new Set()
33675
33918
  );
33676
- const [submitError, setSubmitError] = React131__default.useState(null);
33677
- const formRef = React131__default.useRef(null);
33919
+ const [submitError, setSubmitError] = React75__default.useState(null);
33920
+ const formRef = React75__default.useRef(null);
33678
33921
  const formMode = props.mode;
33679
- const mountedRef = React131__default.useRef(false);
33922
+ const mountedRef = React75__default.useRef(false);
33680
33923
  if (!mountedRef.current) {
33681
33924
  mountedRef.current = true;
33682
33925
  debug("forms", "mount", {
@@ -33689,7 +33932,7 @@ var init_Form = __esm({
33689
33932
  });
33690
33933
  }
33691
33934
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
33692
- const evalContext = React131__default.useMemo(
33935
+ const evalContext = React75__default.useMemo(
33693
33936
  () => ({
33694
33937
  formValues: formData,
33695
33938
  globalVariables: externalContext?.globalVariables ?? {},
@@ -33698,7 +33941,7 @@ var init_Form = __esm({
33698
33941
  }),
33699
33942
  [formData, externalContext]
33700
33943
  );
33701
- React131__default.useEffect(() => {
33944
+ React75__default.useEffect(() => {
33702
33945
  debug("forms", "initialData-sync", {
33703
33946
  mode: formMode,
33704
33947
  normalizedInitialData,
@@ -33709,7 +33952,7 @@ var init_Form = __esm({
33709
33952
  setFormData(normalizedInitialData);
33710
33953
  }
33711
33954
  }, [normalizedInitialData]);
33712
- const processCalculations = React131__default.useCallback(
33955
+ const processCalculations = React75__default.useCallback(
33713
33956
  (changedFieldId, newFormData) => {
33714
33957
  if (!hiddenCalculations.length) return;
33715
33958
  const context = {
@@ -33734,7 +33977,7 @@ var init_Form = __esm({
33734
33977
  },
33735
33978
  [hiddenCalculations, externalContext, eventBus]
33736
33979
  );
33737
- const checkViolations = React131__default.useCallback(
33980
+ const checkViolations = React75__default.useCallback(
33738
33981
  (changedFieldId, newFormData) => {
33739
33982
  if (!violationTriggers.length) return;
33740
33983
  const context = {
@@ -33772,7 +34015,7 @@ var init_Form = __esm({
33772
34015
  processCalculations(name, newFormData);
33773
34016
  checkViolations(name, newFormData);
33774
34017
  };
33775
- const isFieldVisible = React131__default.useCallback(
34018
+ const isFieldVisible = React75__default.useCallback(
33776
34019
  (fieldName) => {
33777
34020
  const condition = conditionalFields[fieldName];
33778
34021
  if (!condition) return true;
@@ -33780,7 +34023,7 @@ var init_Form = __esm({
33780
34023
  },
33781
34024
  [conditionalFields, evalContext]
33782
34025
  );
33783
- const isSectionVisible = React131__default.useCallback(
34026
+ const isSectionVisible = React75__default.useCallback(
33784
34027
  (section) => {
33785
34028
  if (!section.condition) return true;
33786
34029
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -33856,7 +34099,7 @@ var init_Form = __esm({
33856
34099
  eventBus.emit(`UI:${onCancel}`);
33857
34100
  }
33858
34101
  };
33859
- const renderField = React131__default.useCallback(
34102
+ const renderField = React75__default.useCallback(
33860
34103
  (field) => {
33861
34104
  const fieldName = field.name || field.field;
33862
34105
  if (!fieldName) return null;
@@ -33877,7 +34120,7 @@ var init_Form = __esm({
33877
34120
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
33878
34121
  );
33879
34122
  const effectiveFields = entityDerivedFields ?? fields;
33880
- const normalizedFields = React131__default.useMemo(() => {
34123
+ const normalizedFields = React75__default.useMemo(() => {
33881
34124
  if (!effectiveFields || effectiveFields.length === 0) return [];
33882
34125
  return effectiveFields.map((field) => {
33883
34126
  if (typeof field === "string") {
@@ -33899,7 +34142,7 @@ var init_Form = __esm({
33899
34142
  return field;
33900
34143
  });
33901
34144
  }, [effectiveFields, resolvedEntity]);
33902
- const schemaFields = React131__default.useMemo(() => {
34145
+ const schemaFields = React75__default.useMemo(() => {
33903
34146
  if (normalizedFields.length === 0) return null;
33904
34147
  if (isDebugEnabled()) {
33905
34148
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -33909,7 +34152,7 @@ var init_Form = __esm({
33909
34152
  }
33910
34153
  return normalizedFields.map(renderField).filter(Boolean);
33911
34154
  }, [normalizedFields, renderField, entityName, conditionalFields]);
33912
- const sectionElements = React131__default.useMemo(() => {
34155
+ const sectionElements = React75__default.useMemo(() => {
33913
34156
  if (!sections || sections.length === 0) return null;
33914
34157
  return sections.map((section) => {
33915
34158
  if (!isSectionVisible(section)) {
@@ -35635,7 +35878,7 @@ var init_List = __esm({
35635
35878
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
35636
35879
  return [];
35637
35880
  }, [entity]);
35638
- const getItemActions = React131__default.useCallback(
35881
+ const getItemActions = React75__default.useCallback(
35639
35882
  (item) => {
35640
35883
  if (!itemActions) return [];
35641
35884
  if (typeof itemActions === "function") {
@@ -36108,7 +36351,7 @@ var init_MediaGallery = __esm({
36108
36351
  [selectable, selectedItems, selectionEvent, eventBus]
36109
36352
  );
36110
36353
  const entityData = Array.isArray(entity) ? entity : [];
36111
- const items = React131__default.useMemo(() => {
36354
+ const items = React75__default.useMemo(() => {
36112
36355
  if (propItems) return propItems;
36113
36356
  if (entityData.length === 0) return [];
36114
36357
  return entityData.map((record, idx) => ({
@@ -36281,9 +36524,9 @@ function MiniMap({
36281
36524
  viewportRect,
36282
36525
  className
36283
36526
  }) {
36284
- const canvasRef = React131.useRef(null);
36285
- const frameRef = React131.useRef(0);
36286
- React131.useEffect(() => {
36527
+ const canvasRef = React75.useRef(null);
36528
+ const frameRef = React75.useRef(0);
36529
+ React75.useEffect(() => {
36287
36530
  const canvas = canvasRef.current;
36288
36531
  if (!canvas) return;
36289
36532
  const ctx = canvas.getContext("2d");
@@ -36365,7 +36608,7 @@ var init_MiniMap = __esm({
36365
36608
  }
36366
36609
  });
36367
36610
  function extractTitle2(children) {
36368
- if (!React131__default.isValidElement(children)) return void 0;
36611
+ if (!React75__default.isValidElement(children)) return void 0;
36369
36612
  const props = children.props;
36370
36613
  if (typeof props.title === "string") {
36371
36614
  return props.title;
@@ -37078,7 +37321,7 @@ var init_PageHeader = __esm({
37078
37321
  info: "bg-info/10 text-info"
37079
37322
  };
37080
37323
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
37081
- breadcrumbs && breadcrumbs.length > 0 && /* @__PURE__ */ jsx(Box, { as: "nav", className: "mb-4", children: /* @__PURE__ */ jsx(Box, { as: "ol", className: "flex items-center gap-2 text-sm", children: breadcrumbs.map((crumb, idx) => /* @__PURE__ */ jsxs(React131__default.Fragment, { children: [
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: [
37082
37325
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
37083
37326
  crumb.href ? /* @__PURE__ */ jsx(
37084
37327
  "a",
@@ -37419,7 +37662,7 @@ var init_debugRegistry = __esm({
37419
37662
  }
37420
37663
  });
37421
37664
  function useDebugData() {
37422
- const [data, setData] = React131.useState(() => ({
37665
+ const [data, setData] = React75.useState(() => ({
37423
37666
  traits: [],
37424
37667
  ticks: [],
37425
37668
  guards: [],
@@ -37433,7 +37676,7 @@ function useDebugData() {
37433
37676
  },
37434
37677
  lastUpdate: Date.now()
37435
37678
  }));
37436
- React131.useEffect(() => {
37679
+ React75.useEffect(() => {
37437
37680
  const updateData = () => {
37438
37681
  setData({
37439
37682
  traits: getAllTraits(),
@@ -37542,12 +37785,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
37542
37785
  return positions;
37543
37786
  }
37544
37787
  function WalkMinimap() {
37545
- const [walkStep, setWalkStep] = React131.useState(null);
37546
- const [traits2, setTraits] = React131.useState([]);
37547
- const [coveredEdges, setCoveredEdges] = React131.useState([]);
37548
- const [completedTraits, setCompletedTraits] = React131.useState(/* @__PURE__ */ new Set());
37549
- const prevTraitRef = React131.useRef(null);
37550
- React131.useEffect(() => {
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(() => {
37551
37794
  const interval = setInterval(() => {
37552
37795
  const w = window;
37553
37796
  const step = w.__orbitalWalkStep;
@@ -37994,15 +38237,15 @@ var init_EntitiesTab = __esm({
37994
38237
  }
37995
38238
  });
37996
38239
  function EventFlowTab({ events: events2 }) {
37997
- const [filter, setFilter] = React131.useState("all");
37998
- const containerRef = React131.useRef(null);
37999
- const [autoScroll, setAutoScroll] = React131.useState(true);
38000
- React131.useEffect(() => {
38240
+ const [filter, setFilter] = React75.useState("all");
38241
+ const containerRef = React75.useRef(null);
38242
+ const [autoScroll, setAutoScroll] = React75.useState(true);
38243
+ React75.useEffect(() => {
38001
38244
  if (autoScroll && containerRef.current) {
38002
38245
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
38003
38246
  }
38004
38247
  }, [events2.length, autoScroll]);
38005
- const filteredEvents = React131.useMemo(() => {
38248
+ const filteredEvents = React75.useMemo(() => {
38006
38249
  if (filter === "all") return events2;
38007
38250
  return events2.filter((e) => e.type === filter);
38008
38251
  }, [events2, filter]);
@@ -38121,7 +38364,7 @@ var init_EventFlowTab = __esm({
38121
38364
  }
38122
38365
  });
38123
38366
  function GuardsPanel({ guards }) {
38124
- const [filter, setFilter] = React131.useState("all");
38367
+ const [filter, setFilter] = React75.useState("all");
38125
38368
  if (guards.length === 0) {
38126
38369
  return /* @__PURE__ */ jsx(
38127
38370
  EmptyState,
@@ -38134,7 +38377,7 @@ function GuardsPanel({ guards }) {
38134
38377
  }
38135
38378
  const passedCount = guards.filter((g) => g.result).length;
38136
38379
  const failedCount = guards.length - passedCount;
38137
- const filteredGuards = React131.useMemo(() => {
38380
+ const filteredGuards = React75.useMemo(() => {
38138
38381
  if (filter === "all") return guards;
38139
38382
  if (filter === "passed") return guards.filter((g) => g.result);
38140
38383
  return guards.filter((g) => !g.result);
@@ -38295,10 +38538,10 @@ function EffectBadge({ effect }) {
38295
38538
  ] });
38296
38539
  }
38297
38540
  function TransitionTimeline({ transitions }) {
38298
- const containerRef = React131.useRef(null);
38299
- const [autoScroll, setAutoScroll] = React131.useState(true);
38300
- const [expandedId, setExpandedId] = React131.useState(null);
38301
- React131.useEffect(() => {
38541
+ const containerRef = React75.useRef(null);
38542
+ const [autoScroll, setAutoScroll] = React75.useState(true);
38543
+ const [expandedId, setExpandedId] = React75.useState(null);
38544
+ React75.useEffect(() => {
38302
38545
  if (autoScroll && containerRef.current) {
38303
38546
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
38304
38547
  }
@@ -38584,9 +38827,9 @@ function getAllEvents(traits2) {
38584
38827
  }
38585
38828
  function EventDispatcherTab({ traits: traits2, schema }) {
38586
38829
  const eventBus = useEventBus();
38587
- const [log18, setLog] = React131.useState([]);
38588
- const prevStatesRef = React131.useRef(/* @__PURE__ */ new Map());
38589
- React131.useEffect(() => {
38830
+ const [log18, setLog] = React75.useState([]);
38831
+ const prevStatesRef = React75.useRef(/* @__PURE__ */ new Map());
38832
+ React75.useEffect(() => {
38590
38833
  for (const trait of traits2) {
38591
38834
  const prev = prevStatesRef.current.get(trait.id);
38592
38835
  if (prev && prev !== trait.currentState) {
@@ -38756,10 +38999,10 @@ function VerifyModePanel({
38756
38999
  serverCount,
38757
39000
  localCount
38758
39001
  }) {
38759
- const [expanded, setExpanded] = React131.useState(true);
38760
- const scrollRef = React131.useRef(null);
38761
- const prevCountRef = React131.useRef(0);
38762
- React131.useEffect(() => {
39002
+ const [expanded, setExpanded] = React75.useState(true);
39003
+ const scrollRef = React75.useRef(null);
39004
+ const prevCountRef = React75.useRef(0);
39005
+ React75.useEffect(() => {
38763
39006
  if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
38764
39007
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
38765
39008
  }
@@ -38825,10 +39068,10 @@ function RuntimeDebugger({
38825
39068
  defaultTab,
38826
39069
  schema
38827
39070
  }) {
38828
- const [isCollapsed, setIsCollapsed] = React131.useState(mode === "verify" ? true : defaultCollapsed);
38829
- 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());
38830
39073
  const debugData = useDebugData();
38831
- React131.useEffect(() => {
39074
+ React75.useEffect(() => {
38832
39075
  if (mode === "inline") return;
38833
39076
  return onDebugToggle((enabled) => {
38834
39077
  setIsVisible(enabled);
@@ -38837,7 +39080,7 @@ function RuntimeDebugger({
38837
39080
  }
38838
39081
  });
38839
39082
  }, [mode]);
38840
- React131.useEffect(() => {
39083
+ React75.useEffect(() => {
38841
39084
  if (mode === "inline") return;
38842
39085
  const handleKeyDown = (e) => {
38843
39086
  if (e.key === "`" && isVisible) {
@@ -39386,7 +39629,7 @@ function SequenceBar({
39386
39629
  onSlotRemove(index);
39387
39630
  }, [onSlotRemove, playing]);
39388
39631
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
39389
- return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React131__default.Fragment, { children: [
39632
+ return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React75__default.Fragment, { children: [
39390
39633
  i > 0 && /* @__PURE__ */ jsx(
39391
39634
  Typography,
39392
39635
  {
@@ -40898,7 +41141,7 @@ var init_StatCard = __esm({
40898
41141
  const labelToUse = propLabel ?? propTitle;
40899
41142
  const eventBus = useEventBus();
40900
41143
  const { t } = useTranslate();
40901
- const handleActionClick = React131__default.useCallback(() => {
41144
+ const handleActionClick = React75__default.useCallback(() => {
40902
41145
  if (action?.event) {
40903
41146
  eventBus.emit(`UI:${action.event}`, {});
40904
41147
  }
@@ -40909,7 +41152,7 @@ var init_StatCard = __esm({
40909
41152
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
40910
41153
  const isLoading = externalLoading ?? false;
40911
41154
  const error = externalError;
40912
- const computeMetricValue = React131__default.useCallback(
41155
+ const computeMetricValue = React75__default.useCallback(
40913
41156
  (metric, items) => {
40914
41157
  if (metric.value !== void 0) {
40915
41158
  return metric.value;
@@ -40948,7 +41191,7 @@ var init_StatCard = __esm({
40948
41191
  },
40949
41192
  []
40950
41193
  );
40951
- const schemaStats = React131__default.useMemo(() => {
41194
+ const schemaStats = React75__default.useMemo(() => {
40952
41195
  if (!metrics || metrics.length === 0) return null;
40953
41196
  return metrics.map((metric) => ({
40954
41197
  label: metric.label,
@@ -40956,7 +41199,7 @@ var init_StatCard = __esm({
40956
41199
  format: metric.format
40957
41200
  }));
40958
41201
  }, [metrics, data, computeMetricValue]);
40959
- const calculatedTrend = React131__default.useMemo(() => {
41202
+ const calculatedTrend = React75__default.useMemo(() => {
40960
41203
  if (manualTrend !== void 0) return manualTrend;
40961
41204
  if (previousValue === void 0 || currentValue === void 0)
40962
41205
  return void 0;
@@ -42163,7 +42406,7 @@ var init_Timeline = __esm({
42163
42406
  }) => {
42164
42407
  const { t } = useTranslate();
42165
42408
  const entityData = Array.isArray(entity) ? entity : [];
42166
- const items = React131__default.useMemo(() => {
42409
+ const items = React75__default.useMemo(() => {
42167
42410
  if (propItems) return propItems;
42168
42411
  if (entityData.length === 0) return [];
42169
42412
  return entityData.map((record, idx) => {
@@ -42320,7 +42563,7 @@ var init_TimerDisplay = __esm({
42320
42563
  }
42321
42564
  });
42322
42565
  function extractToastProps(children) {
42323
- if (!React131__default.isValidElement(children)) {
42566
+ if (!React75__default.isValidElement(children)) {
42324
42567
  if (typeof children === "string") {
42325
42568
  return { message: children };
42326
42569
  }
@@ -42358,7 +42601,7 @@ var init_ToastSlot = __esm({
42358
42601
  eventBus.emit("UI:CLOSE");
42359
42602
  };
42360
42603
  if (!isVisible) return null;
42361
- const isCustomContent = React131__default.isValidElement(children) && !message;
42604
+ const isCustomContent = React75__default.isValidElement(children) && !message;
42362
42605
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
42363
42606
  Toast,
42364
42607
  {
@@ -42627,7 +42870,7 @@ var init_WizardContainer = __esm({
42627
42870
  const isCompleted = index < currentStep;
42628
42871
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
42629
42872
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
42630
- return /* @__PURE__ */ jsxs(React131__default.Fragment, { children: [
42873
+ return /* @__PURE__ */ jsxs(React75__default.Fragment, { children: [
42631
42874
  /* @__PURE__ */ jsx(
42632
42875
  Button,
42633
42876
  {
@@ -43077,12 +43320,12 @@ var init_XPBar = __esm({
43077
43320
  }
43078
43321
  });
43079
43322
  function lazyThree(name, loader) {
43080
- const Lazy = React131__default.lazy(() => loader().then((m) => ({ default: m[name] })));
43323
+ const Lazy = React75__default.lazy(() => loader().then((m) => ({ default: m[name] })));
43081
43324
  function ThreeWrapper(props) {
43082
- return React131__default.createElement(
43083
- React131__default.Suspense,
43325
+ return React75__default.createElement(
43326
+ React75__default.Suspense,
43084
43327
  { fallback: null },
43085
- React131__default.createElement(Lazy, props)
43328
+ React75__default.createElement(Lazy, props)
43086
43329
  );
43087
43330
  }
43088
43331
  ThreeWrapper.displayName = `Lazy(${name})`;
@@ -43686,7 +43929,7 @@ function SuspenseConfigProvider({
43686
43929
  config,
43687
43930
  children
43688
43931
  }) {
43689
- return React131__default.createElement(
43932
+ return React75__default.createElement(
43690
43933
  SuspenseConfigContext.Provider,
43691
43934
  { value: config },
43692
43935
  children
@@ -44169,7 +44412,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
44169
44412
  const key = `${parentId}-${index}-trait:${traitName}`;
44170
44413
  return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
44171
44414
  }
44172
- return /* @__PURE__ */ jsx(React131__default.Fragment, { children: child }, `${parentId}-${index}`);
44415
+ return /* @__PURE__ */ jsx(React75__default.Fragment, { children: child }, `${parentId}-${index}`);
44173
44416
  }
44174
44417
  if (!child || typeof child !== "object") return null;
44175
44418
  const childId = `${parentId}-${index}`;
@@ -44206,14 +44449,14 @@ function isPatternConfig(value) {
44206
44449
  if (value === null || value === void 0) return false;
44207
44450
  if (typeof value !== "object") return false;
44208
44451
  if (Array.isArray(value)) return false;
44209
- if (React131__default.isValidElement(value)) return false;
44452
+ if (React75__default.isValidElement(value)) return false;
44210
44453
  if (value instanceof Date) return false;
44211
44454
  if (typeof value === "function") return false;
44212
44455
  const record = value;
44213
44456
  return "type" in record && typeof record.type === "string";
44214
44457
  }
44215
44458
  function isPlainConfigObject(value) {
44216
- if (React131__default.isValidElement(value)) return false;
44459
+ if (React75__default.isValidElement(value)) return false;
44217
44460
  if (value instanceof Date) return false;
44218
44461
  const proto = Object.getPrototypeOf(value);
44219
44462
  return proto === Object.prototype || proto === null;
@@ -44657,7 +44900,7 @@ var FormSection = ({
44657
44900
  columns = 1,
44658
44901
  className
44659
44902
  }) => {
44660
- const [collapsed, setCollapsed] = React131__default.useState(defaultCollapsed);
44903
+ const [collapsed, setCollapsed] = React75__default.useState(defaultCollapsed);
44661
44904
  const { t } = useTranslate();
44662
44905
  const eventBus = useEventBus();
44663
44906
  const gridClass = {
@@ -44665,7 +44908,7 @@ var FormSection = ({
44665
44908
  2: "grid-cols-1 md:grid-cols-2",
44666
44909
  3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
44667
44910
  }[columns];
44668
- React131__default.useCallback(() => {
44911
+ React75__default.useCallback(() => {
44669
44912
  if (collapsible) {
44670
44913
  setCollapsed((prev) => !prev);
44671
44914
  eventBus.emit("UI:TOGGLE_COLLAPSE", { collapsed: !collapsed });