@almadar/ui 4.49.0 → 4.50.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- import * as React136 from 'react';
2
- import React136__default, { createContext, useContext, useMemo, useRef, useEffect, useCallback, Suspense, useState, useLayoutEffect, lazy, useId } from 'react';
1
+ import * as React81 from 'react';
2
+ import React81__default, { createContext, useContext, useMemo, useRef, useEffect, useCallback, Suspense, useState, useLayoutEffect, lazy, useId } from 'react';
3
3
  import { createLogger, isLogLevelEnabled } from '@almadar/logger';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
  import { EventBusContext, useTraitScope, TraitScopeProvider } from '@almadar/ui/providers';
@@ -36,6 +36,9 @@ import langToml from 'react-syntax-highlighter/dist/esm/languages/prism/toml.js'
36
36
  import langGo from 'react-syntax-highlighter/dist/esm/languages/prism/go.js';
37
37
  import langGraphql from 'react-syntax-highlighter/dist/esm/languages/prism/graphql.js';
38
38
  import { isInlineTrait } from '@almadar/core';
39
+ import { useSensors, useSensor, PointerSensor, KeyboardSensor, DndContext, closestCenter, useDroppable } from '@dnd-kit/core';
40
+ import { sortableKeyboardCoordinates, arrayMove, useSortable, SortableContext, rectSortingStrategy, verticalListSortingStrategy } from '@dnd-kit/sortable';
41
+ import { CSS } from '@dnd-kit/utilities';
39
42
  import { Handle, Position } from '@xyflow/react';
40
43
  import { getPatternDefinition, getComponentForPattern as getComponentForPattern$1 } from '@almadar/patterns';
41
44
 
@@ -684,7 +687,7 @@ var init_Box = __esm({
684
687
  fixed: "fixed",
685
688
  sticky: "sticky"
686
689
  };
687
- Box = React136__default.forwardRef(
690
+ Box = React81__default.forwardRef(
688
691
  ({
689
692
  padding,
690
693
  paddingX,
@@ -1383,7 +1386,7 @@ function resolveIconProp(value, sizeClass) {
1383
1386
  const IconComp = value;
1384
1387
  return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
1385
1388
  }
1386
- if (React136__default.isValidElement(value)) {
1389
+ if (React81__default.isValidElement(value)) {
1387
1390
  return value;
1388
1391
  }
1389
1392
  if (typeof value === "object" && value !== null && "render" in value) {
@@ -1459,7 +1462,7 @@ var init_Button = __esm({
1459
1462
  md: "h-4 w-4",
1460
1463
  lg: "h-5 w-5"
1461
1464
  };
1462
- Button = React136__default.forwardRef(
1465
+ Button = React81__default.forwardRef(
1463
1466
  ({
1464
1467
  className,
1465
1468
  variant = "primary",
@@ -1562,7 +1565,7 @@ var init_Badge = __esm({
1562
1565
  md: "px-2.5 py-1 text-sm",
1563
1566
  lg: "px-3 py-1.5 text-base"
1564
1567
  };
1565
- Badge = React136__default.forwardRef(
1568
+ Badge = React81__default.forwardRef(
1566
1569
  ({ className, variant = "default", size = "sm", amount, label, icon, children, ...props }, ref) => {
1567
1570
  const iconSizes3 = { sm: "w-3 h-3", md: "w-3.5 h-3.5", lg: "w-4 h-4" };
1568
1571
  const resolvedIcon = typeof icon === "string" ? (() => {
@@ -1856,7 +1859,7 @@ var init_SvgFlow = __esm({
1856
1859
  opacity = 1,
1857
1860
  className
1858
1861
  }) => {
1859
- const markerId = React136__default.useMemo(() => {
1862
+ const markerId = React81__default.useMemo(() => {
1860
1863
  flowIdCounter += 1;
1861
1864
  return `almadar-flow-arrow-${flowIdCounter}`;
1862
1865
  }, []);
@@ -2399,7 +2402,7 @@ var init_SvgRing = __esm({
2399
2402
  className,
2400
2403
  label
2401
2404
  }) => {
2402
- const gradientId = React136__default.useMemo(() => {
2405
+ const gradientId = React81__default.useMemo(() => {
2403
2406
  ringIdCounter += 1;
2404
2407
  return `almadar-ring-glow-${ringIdCounter}`;
2405
2408
  }, []);
@@ -2560,7 +2563,7 @@ var Input;
2560
2563
  var init_Input = __esm({
2561
2564
  "components/atoms/Input.tsx"() {
2562
2565
  init_cn();
2563
- Input = React136__default.forwardRef(
2566
+ Input = React81__default.forwardRef(
2564
2567
  ({
2565
2568
  className,
2566
2569
  inputType,
@@ -2678,7 +2681,7 @@ var Label;
2678
2681
  var init_Label = __esm({
2679
2682
  "components/atoms/Label.tsx"() {
2680
2683
  init_cn();
2681
- Label = React136__default.forwardRef(
2684
+ Label = React81__default.forwardRef(
2682
2685
  ({ className, required, children, ...props }, ref) => {
2683
2686
  return /* @__PURE__ */ jsxs(
2684
2687
  "label",
@@ -2704,7 +2707,7 @@ var Textarea;
2704
2707
  var init_Textarea = __esm({
2705
2708
  "components/atoms/Textarea.tsx"() {
2706
2709
  init_cn();
2707
- Textarea = React136__default.forwardRef(
2710
+ Textarea = React81__default.forwardRef(
2708
2711
  ({ className, error, ...props }, ref) => {
2709
2712
  return /* @__PURE__ */ jsx(
2710
2713
  "textarea",
@@ -2733,7 +2736,7 @@ var Select;
2733
2736
  var init_Select = __esm({
2734
2737
  "components/atoms/Select.tsx"() {
2735
2738
  init_cn();
2736
- Select = React136__default.forwardRef(
2739
+ Select = React81__default.forwardRef(
2737
2740
  ({ className, options, placeholder, error, ...props }, ref) => {
2738
2741
  return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
2739
2742
  /* @__PURE__ */ jsxs(
@@ -2775,7 +2778,7 @@ var Checkbox;
2775
2778
  var init_Checkbox = __esm({
2776
2779
  "components/atoms/Checkbox.tsx"() {
2777
2780
  init_cn();
2778
- Checkbox = React136__default.forwardRef(
2781
+ Checkbox = React81__default.forwardRef(
2779
2782
  ({ className, label, id, ...props }, ref) => {
2780
2783
  const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
2781
2784
  return /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
@@ -2857,7 +2860,7 @@ var init_Card = __esm({
2857
2860
  md: "shadow",
2858
2861
  lg: "shadow-lg"
2859
2862
  };
2860
- Card = React136__default.forwardRef(
2863
+ Card = React81__default.forwardRef(
2861
2864
  ({
2862
2865
  className,
2863
2866
  variant = "bordered",
@@ -2893,9 +2896,9 @@ var init_Card = __esm({
2893
2896
  }
2894
2897
  );
2895
2898
  Card.displayName = "Card";
2896
- CardHeader = React136__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
2899
+ CardHeader = React81__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
2897
2900
  CardHeader.displayName = "CardHeader";
2898
- CardTitle = React136__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2901
+ CardTitle = React81__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2899
2902
  "h3",
2900
2903
  {
2901
2904
  ref,
@@ -2908,11 +2911,11 @@ var init_Card = __esm({
2908
2911
  }
2909
2912
  ));
2910
2913
  CardTitle.displayName = "CardTitle";
2911
- CardContent = React136__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
2914
+ CardContent = React81__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
2912
2915
  CardContent.displayName = "CardContent";
2913
2916
  CardBody = CardContent;
2914
2917
  CardBody.displayName = "CardBody";
2915
- CardFooter = React136__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2918
+ CardFooter = React81__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2916
2919
  "div",
2917
2920
  {
2918
2921
  ref,
@@ -2967,7 +2970,7 @@ var init_FilterPill = __esm({
2967
2970
  md: "w-3.5 h-3.5",
2968
2971
  lg: "w-4 h-4"
2969
2972
  };
2970
- FilterPill = React136__default.forwardRef(
2973
+ FilterPill = React81__default.forwardRef(
2971
2974
  ({
2972
2975
  className,
2973
2976
  variant = "default",
@@ -3046,7 +3049,7 @@ var init_Spinner = __esm({
3046
3049
  md: "h-6 w-6",
3047
3050
  lg: "h-8 w-8"
3048
3051
  };
3049
- Spinner = React136__default.forwardRef(
3052
+ Spinner = React81__default.forwardRef(
3050
3053
  ({ className, size = "md", ...props }, ref) => {
3051
3054
  return /* @__PURE__ */ jsx(
3052
3055
  "div",
@@ -3494,7 +3497,7 @@ var Radio;
3494
3497
  var init_Radio = __esm({
3495
3498
  "components/atoms/Radio.tsx"() {
3496
3499
  init_cn();
3497
- Radio = React136__default.forwardRef(
3500
+ Radio = React81__default.forwardRef(
3498
3501
  ({
3499
3502
  label,
3500
3503
  helperText,
@@ -3605,7 +3608,7 @@ var init_Switch = __esm({
3605
3608
  "components/atoms/Switch.tsx"() {
3606
3609
  "use client";
3607
3610
  init_cn();
3608
- Switch = React136.forwardRef(
3611
+ Switch = React81.forwardRef(
3609
3612
  ({
3610
3613
  checked,
3611
3614
  defaultChecked = false,
@@ -3616,10 +3619,10 @@ var init_Switch = __esm({
3616
3619
  name,
3617
3620
  className
3618
3621
  }, ref) => {
3619
- const [isChecked, setIsChecked] = React136.useState(
3622
+ const [isChecked, setIsChecked] = React81.useState(
3620
3623
  checked !== void 0 ? checked : defaultChecked
3621
3624
  );
3622
- React136.useEffect(() => {
3625
+ React81.useEffect(() => {
3623
3626
  if (checked !== void 0) {
3624
3627
  setIsChecked(checked);
3625
3628
  }
@@ -4039,8 +4042,8 @@ var init_LawReferenceTooltip = __esm({
4039
4042
  position = "top",
4040
4043
  className
4041
4044
  }) => {
4042
- const [isVisible, setIsVisible] = React136__default.useState(false);
4043
- const timeoutRef = React136__default.useRef(null);
4045
+ const [isVisible, setIsVisible] = React81__default.useState(false);
4046
+ const timeoutRef = React81__default.useRef(null);
4044
4047
  const handleMouseEnter = () => {
4045
4048
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4046
4049
  timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
@@ -4049,7 +4052,7 @@ var init_LawReferenceTooltip = __esm({
4049
4052
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4050
4053
  setIsVisible(false);
4051
4054
  };
4052
- React136__default.useEffect(() => {
4055
+ React81__default.useEffect(() => {
4053
4056
  return () => {
4054
4057
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4055
4058
  };
@@ -4259,7 +4262,7 @@ var init_StatusDot = __esm({
4259
4262
  md: "w-2.5 h-2.5",
4260
4263
  lg: "w-3 h-3"
4261
4264
  };
4262
- StatusDot = React136__default.forwardRef(
4265
+ StatusDot = React81__default.forwardRef(
4263
4266
  ({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
4264
4267
  return /* @__PURE__ */ jsx(
4265
4268
  "span",
@@ -4312,7 +4315,7 @@ var init_TrendIndicator = __esm({
4312
4315
  down: TrendingDown,
4313
4316
  flat: ArrowRight
4314
4317
  };
4315
- TrendIndicator = React136__default.forwardRef(
4318
+ TrendIndicator = React81__default.forwardRef(
4316
4319
  ({
4317
4320
  className,
4318
4321
  value,
@@ -4379,7 +4382,7 @@ var init_RangeSlider = __esm({
4379
4382
  md: "w-4 h-4",
4380
4383
  lg: "w-5 h-5"
4381
4384
  };
4382
- RangeSlider = React136__default.forwardRef(
4385
+ RangeSlider = React81__default.forwardRef(
4383
4386
  ({
4384
4387
  className,
4385
4388
  min = 0,
@@ -4947,7 +4950,7 @@ var init_ContentSection = __esm({
4947
4950
  md: "py-16",
4948
4951
  lg: "py-24"
4949
4952
  };
4950
- ContentSection = React136__default.forwardRef(
4953
+ ContentSection = React81__default.forwardRef(
4951
4954
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
4952
4955
  return /* @__PURE__ */ jsx(
4953
4956
  Box,
@@ -5481,7 +5484,7 @@ var init_AnimatedReveal = __esm({
5481
5484
  "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
5482
5485
  "none": {}
5483
5486
  };
5484
- AnimatedReveal = React136__default.forwardRef(
5487
+ AnimatedReveal = React81__default.forwardRef(
5485
5488
  ({
5486
5489
  trigger = "scroll",
5487
5490
  animation = "fade-up",
@@ -5641,7 +5644,7 @@ var init_AnimatedGraphic = __esm({
5641
5644
  "components/atoms/AnimatedGraphic.tsx"() {
5642
5645
  "use client";
5643
5646
  init_cn();
5644
- AnimatedGraphic = React136__default.forwardRef(
5647
+ AnimatedGraphic = React81__default.forwardRef(
5645
5648
  ({
5646
5649
  src,
5647
5650
  svgContent,
@@ -5664,7 +5667,7 @@ var init_AnimatedGraphic = __esm({
5664
5667
  const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
5665
5668
  const resolvedSvg = svgContent ?? fetchedSvg;
5666
5669
  const prevAnimateRef = useRef(animate);
5667
- const setRef = React136__default.useCallback(
5670
+ const setRef = React81__default.useCallback(
5668
5671
  (node) => {
5669
5672
  containerRef.current = node;
5670
5673
  if (typeof ref === "function") ref(node);
@@ -5889,9 +5892,9 @@ function ScoreDisplay({
5889
5892
  ...rest
5890
5893
  }) {
5891
5894
  const resolvedValue = typeof value === "number" && !Number.isNaN(value) ? value : typeof rest.score === "number" && !Number.isNaN(rest.score) ? rest.score : 0;
5892
- const [displayValue, setDisplayValue] = React136.useState(resolvedValue);
5893
- const [isAnimating, setIsAnimating] = React136.useState(false);
5894
- React136.useEffect(() => {
5895
+ const [displayValue, setDisplayValue] = React81.useState(resolvedValue);
5896
+ const [isAnimating, setIsAnimating] = React81.useState(false);
5897
+ React81.useEffect(() => {
5895
5898
  if (!animated || displayValue === resolvedValue) {
5896
5899
  setDisplayValue(resolvedValue);
5897
5900
  return;
@@ -5961,9 +5964,9 @@ function ControlButton({
5961
5964
  className
5962
5965
  }) {
5963
5966
  const eventBus = useEventBus();
5964
- const [isPressed, setIsPressed] = React136.useState(false);
5967
+ const [isPressed, setIsPressed] = React81.useState(false);
5965
5968
  const actualPressed = pressed ?? isPressed;
5966
- const handlePointerDown = React136.useCallback(
5969
+ const handlePointerDown = React81.useCallback(
5967
5970
  (e) => {
5968
5971
  e.preventDefault();
5969
5972
  if (disabled) return;
@@ -5973,7 +5976,7 @@ function ControlButton({
5973
5976
  },
5974
5977
  [disabled, pressEvent, eventBus, onPress]
5975
5978
  );
5976
- const handlePointerUp = React136.useCallback(
5979
+ const handlePointerUp = React81.useCallback(
5977
5980
  (e) => {
5978
5981
  e.preventDefault();
5979
5982
  if (disabled) return;
@@ -5983,7 +5986,7 @@ function ControlButton({
5983
5986
  },
5984
5987
  [disabled, releaseEvent, eventBus, onRelease]
5985
5988
  );
5986
- const handlePointerLeave = React136.useCallback(
5989
+ const handlePointerLeave = React81.useCallback(
5987
5990
  (e) => {
5988
5991
  if (isPressed) {
5989
5992
  setIsPressed(false);
@@ -6889,9 +6892,9 @@ function MiniMap({
6889
6892
  viewportRect,
6890
6893
  className
6891
6894
  }) {
6892
- const canvasRef = React136.useRef(null);
6893
- const frameRef = React136.useRef(0);
6894
- React136.useEffect(() => {
6895
+ const canvasRef = React81.useRef(null);
6896
+ const frameRef = React81.useRef(0);
6897
+ React81.useEffect(() => {
6895
6898
  const canvas = canvasRef.current;
6896
6899
  if (!canvas) return;
6897
6900
  const ctx = canvas.getContext("2d");
@@ -7185,7 +7188,7 @@ var init_ErrorBoundary = __esm({
7185
7188
  "use client";
7186
7189
  init_cn();
7187
7190
  init_ErrorState();
7188
- ErrorBoundary = class extends React136__default.Component {
7191
+ ErrorBoundary = class extends React81__default.Component {
7189
7192
  constructor(props) {
7190
7193
  super(props);
7191
7194
  __publicField(this, "reset", () => {
@@ -8616,8 +8619,8 @@ var init_Tooltip = __esm({
8616
8619
  if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
8617
8620
  };
8618
8621
  }, []);
8619
- const triggerElement = React136__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
8620
- const trigger = React136__default.cloneElement(triggerElement, {
8622
+ const triggerElement = React81__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
8623
+ const trigger = React81__default.cloneElement(triggerElement, {
8621
8624
  ref: triggerRef,
8622
8625
  onMouseEnter: handleMouseEnter,
8623
8626
  onMouseLeave: handleMouseLeave,
@@ -8738,8 +8741,8 @@ var init_Popover = __esm({
8738
8741
  onMouseEnter: handleOpen,
8739
8742
  onMouseLeave: handleClose
8740
8743
  };
8741
- const childElement = React136__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
8742
- const triggerElement = React136__default.cloneElement(
8744
+ const childElement = React81__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
8745
+ const triggerElement = React81__default.cloneElement(
8743
8746
  childElement,
8744
8747
  {
8745
8748
  ref: triggerRef,
@@ -8856,8 +8859,8 @@ var init_Menu = __esm({
8856
8859
  "bottom-start": "top-full left-0 mt-2",
8857
8860
  "bottom-end": "top-full right-0 mt-2"
8858
8861
  };
8859
- const triggerChild = React136__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx("span", { children: trigger });
8860
- const triggerElement = React136__default.cloneElement(
8862
+ const triggerChild = React81__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx("span", { children: trigger });
8863
+ const triggerElement = React81__default.cloneElement(
8861
8864
  triggerChild,
8862
8865
  {
8863
8866
  ref: triggerRef,
@@ -9273,7 +9276,7 @@ var init_MapView = __esm({
9273
9276
  shadowSize: [41, 41]
9274
9277
  });
9275
9278
  L.Marker.prototype.options.icon = defaultIcon;
9276
- const { useEffect: useEffect67, useRef: useRef65, useCallback: useCallback110, useState: useState95 } = React136__default;
9279
+ const { useEffect: useEffect67, useRef: useRef65, useCallback: useCallback110, useState: useState95 } = React81__default;
9277
9280
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
9278
9281
  const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
9279
9282
  function MapUpdater({ centerLat, centerLng, zoom }) {
@@ -9519,7 +9522,7 @@ function InputPattern({
9519
9522
  fieldName
9520
9523
  }) {
9521
9524
  const { emit } = useEventBus();
9522
- const [localValue, setLocalValue] = React136__default.useState(value);
9525
+ const [localValue, setLocalValue] = React81__default.useState(value);
9523
9526
  const handleChange = (e) => {
9524
9527
  setLocalValue(e.target.value);
9525
9528
  if (onChange) {
@@ -9557,7 +9560,7 @@ function TextareaPattern({
9557
9560
  fieldName
9558
9561
  }) {
9559
9562
  const { emit } = useEventBus();
9560
- const [localValue, setLocalValue] = React136__default.useState(value);
9563
+ const [localValue, setLocalValue] = React81__default.useState(value);
9561
9564
  const handleChange = (e) => {
9562
9565
  setLocalValue(e.target.value);
9563
9566
  if (onChange) {
@@ -9589,7 +9592,7 @@ function SelectPattern({
9589
9592
  fieldName
9590
9593
  }) {
9591
9594
  const { emit } = useEventBus();
9592
- const [localValue, setLocalValue] = React136__default.useState(value);
9595
+ const [localValue, setLocalValue] = React81__default.useState(value);
9593
9596
  const handleChange = (e) => {
9594
9597
  setLocalValue(e.target.value);
9595
9598
  if (onChange) {
@@ -9618,7 +9621,7 @@ function CheckboxPattern({
9618
9621
  className
9619
9622
  }) {
9620
9623
  const { emit } = useEventBus();
9621
- const [localChecked, setLocalChecked] = React136__default.useState(checked);
9624
+ const [localChecked, setLocalChecked] = React81__default.useState(checked);
9622
9625
  const handleChange = (e) => {
9623
9626
  setLocalChecked(e.target.checked);
9624
9627
  if (onChange) {
@@ -9849,8 +9852,8 @@ function ActionButtons({
9849
9852
  disabled
9850
9853
  }) {
9851
9854
  const eventBus = useEventBus();
9852
- const [activeButtons, setActiveButtons] = React136.useState(/* @__PURE__ */ new Set());
9853
- const handlePress = React136.useCallback(
9855
+ const [activeButtons, setActiveButtons] = React81.useState(/* @__PURE__ */ new Set());
9856
+ const handlePress = React81.useCallback(
9854
9857
  (id) => {
9855
9858
  setActiveButtons((prev) => new Set(prev).add(id));
9856
9859
  if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
@@ -9858,7 +9861,7 @@ function ActionButtons({
9858
9861
  },
9859
9862
  [actionEvent, eventBus, onAction]
9860
9863
  );
9861
- const handleRelease = React136.useCallback(
9864
+ const handleRelease = React81.useCallback(
9862
9865
  (id) => {
9863
9866
  setActiveButtons((prev) => {
9864
9867
  const next = new Set(prev);
@@ -12709,7 +12712,7 @@ var init_MarkdownContent = __esm({
12709
12712
  init_Box();
12710
12713
  init_useTranslate();
12711
12714
  init_cn();
12712
- MarkdownContent = React136__default.memo(
12715
+ MarkdownContent = React81__default.memo(
12713
12716
  ({ content, direction, className }) => {
12714
12717
  const { t: _t } = useTranslate();
12715
12718
  const safeContent = typeof content === "string" ? content : String(content ?? "");
@@ -12927,7 +12930,7 @@ var init_CodeBlock = __esm({
12927
12930
  log8 = createLogger("almadar:ui:markdown-code");
12928
12931
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
12929
12932
  HIDDEN_LINE_NUMBERS = { display: "none" };
12930
- CodeBlock = React136__default.memo(
12933
+ CodeBlock = React81__default.memo(
12931
12934
  ({
12932
12935
  code: rawCode,
12933
12936
  language = "text",
@@ -14236,7 +14239,7 @@ var init_StateMachineView = __esm({
14236
14239
  style: { top: title ? 30 : 0 },
14237
14240
  children: [
14238
14241
  entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
14239
- states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React136__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
14242
+ states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React81__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
14240
14243
  StateNode,
14241
14244
  {
14242
14245
  state,
@@ -20680,7 +20683,7 @@ function CraftingRecipe({
20680
20683
  className
20681
20684
  }) {
20682
20685
  const eventBus = useEventBus();
20683
- const handleCraft = React136.useCallback(() => {
20686
+ const handleCraft = React81.useCallback(() => {
20684
20687
  onCraft?.();
20685
20688
  if (craftEvent) {
20686
20689
  eventBus.emit(craftEvent, { output: output.label });
@@ -20697,7 +20700,7 @@ function CraftingRecipe({
20697
20700
  children: [
20698
20701
  /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap items-center", children: inputs.map((ingredient, index) => {
20699
20702
  const hasSufficient = ingredient.available >= ingredient.required;
20700
- return /* @__PURE__ */ jsxs(React136.Fragment, { children: [
20703
+ return /* @__PURE__ */ jsxs(React81.Fragment, { children: [
20701
20704
  /* @__PURE__ */ jsx(Box, { className: "relative", children: /* @__PURE__ */ jsx(
20702
20705
  ItemSlot,
20703
20706
  {
@@ -20760,8 +20763,8 @@ function DPad({
20760
20763
  }) {
20761
20764
  const eventBus = useEventBus();
20762
20765
  const sizes = sizeMap15[size];
20763
- const [activeDirections, setActiveDirections] = React136.useState(/* @__PURE__ */ new Set());
20764
- const handlePress = React136.useCallback(
20766
+ const [activeDirections, setActiveDirections] = React81.useState(/* @__PURE__ */ new Set());
20767
+ const handlePress = React81.useCallback(
20765
20768
  (direction) => {
20766
20769
  setActiveDirections((prev) => new Set(prev).add(direction));
20767
20770
  if (directionEvent) eventBus.emit(`UI:${directionEvent}`, { direction, pressed: true });
@@ -20769,7 +20772,7 @@ function DPad({
20769
20772
  },
20770
20773
  [directionEvent, eventBus, onDirection]
20771
20774
  );
20772
- const handleRelease = React136.useCallback(
20775
+ const handleRelease = React81.useCallback(
20773
20776
  (direction) => {
20774
20777
  setActiveDirections((prev) => {
20775
20778
  const next = new Set(prev);
@@ -21269,6 +21272,199 @@ var init_DashboardLayout = __esm({
21269
21272
  NavLink.displayName = "NavLink";
21270
21273
  }
21271
21274
  });
21275
+ function useDataDnd(args) {
21276
+ const {
21277
+ dragGroup,
21278
+ accepts,
21279
+ sortable,
21280
+ dropEvent,
21281
+ reorderEvent,
21282
+ dndItemIdField = "id",
21283
+ dndRoot,
21284
+ items,
21285
+ layout
21286
+ } = args;
21287
+ const isZone = Boolean(dragGroup || accepts || sortable);
21288
+ const enabled = isZone || Boolean(dndRoot);
21289
+ const eventBus = useEventBus();
21290
+ const parentRoot = React81__default.useContext(RootCtx);
21291
+ const isRoot = enabled && parentRoot === null;
21292
+ const [localOrder, setLocalOrder] = React81__default.useState(null);
21293
+ const orderedItems = localOrder ?? items;
21294
+ React81__default.useEffect(() => {
21295
+ setLocalOrder(null);
21296
+ }, [items]);
21297
+ const itemIds = React81__default.useMemo(
21298
+ () => orderedItems.map((it, idx) => {
21299
+ const raw = it[dndItemIdField];
21300
+ return raw ?? `__idx_${idx}`;
21301
+ }),
21302
+ [orderedItems, dndItemIdField]
21303
+ );
21304
+ const zonesRef = React81__default.useRef(/* @__PURE__ */ new Map());
21305
+ const registerZone = React81__default.useCallback((zoneId2, meta2) => {
21306
+ zonesRef.current.set(zoneId2, meta2);
21307
+ }, []);
21308
+ const unregisterZone = React81__default.useCallback((zoneId2) => {
21309
+ zonesRef.current.delete(zoneId2);
21310
+ }, []);
21311
+ const zoneId = React81__default.useId();
21312
+ const ownGroup = dragGroup ?? accepts ?? zoneId;
21313
+ const meta = React81__default.useMemo(
21314
+ () => ({ group: ownGroup, dropEvent, reorderEvent, itemIds }),
21315
+ [ownGroup, dropEvent, reorderEvent, itemIds]
21316
+ );
21317
+ React81__default.useEffect(() => {
21318
+ const target = isRoot ? null : parentRoot;
21319
+ if (!target) {
21320
+ zonesRef.current.set(zoneId, meta);
21321
+ return () => zonesRef.current.delete(zoneId);
21322
+ }
21323
+ target.registerZone(zoneId, meta);
21324
+ return () => target.unregisterZone(zoneId);
21325
+ }, [parentRoot, isRoot, zoneId, meta]);
21326
+ const sensors = useSensors(
21327
+ useSensor(PointerSensor, { activationConstraint: { distance: 5 } }),
21328
+ useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates })
21329
+ );
21330
+ const findZoneByItem = React81__default.useCallback(
21331
+ (id) => {
21332
+ for (const z of zonesRef.current.values()) {
21333
+ if (z.itemIds.includes(id)) return z;
21334
+ }
21335
+ return void 0;
21336
+ },
21337
+ []
21338
+ );
21339
+ const findZoneByGroup = React81__default.useCallback(
21340
+ (group) => {
21341
+ for (const z of zonesRef.current.values()) {
21342
+ if (z.group === group) return z;
21343
+ }
21344
+ return void 0;
21345
+ },
21346
+ []
21347
+ );
21348
+ const handleDragEnd = React81__default.useCallback(
21349
+ (event) => {
21350
+ const { active, over } = event;
21351
+ if (!over) return;
21352
+ const sourceZone = findZoneByItem(active.id);
21353
+ const overData = over.data?.current;
21354
+ const targetGroup = overData?.dndGroup;
21355
+ if (!sourceZone || !targetGroup) return;
21356
+ const targetZone = findZoneByGroup(targetGroup);
21357
+ if (!targetZone) return;
21358
+ if (sourceZone.group !== targetZone.group) {
21359
+ if (targetZone.dropEvent) {
21360
+ const newIndex2 = targetZone.itemIds.indexOf(over.id);
21361
+ eventBus.emit(targetZone.dropEvent, {
21362
+ id: String(active.id),
21363
+ sourceGroup: sourceZone.group,
21364
+ targetGroup: targetZone.group,
21365
+ newIndex: newIndex2 === -1 ? targetZone.itemIds.length : newIndex2
21366
+ });
21367
+ }
21368
+ return;
21369
+ }
21370
+ const oldIndex = sourceZone.itemIds.indexOf(active.id);
21371
+ const newIndex = sourceZone.itemIds.indexOf(over.id);
21372
+ if (oldIndex === -1 || newIndex === -1 || oldIndex === newIndex) return;
21373
+ if (sourceZone.group === ownGroup) {
21374
+ const reordered = arrayMove(orderedItems, oldIndex, newIndex);
21375
+ setLocalOrder(reordered);
21376
+ }
21377
+ if (sourceZone.reorderEvent) {
21378
+ eventBus.emit(sourceZone.reorderEvent, {
21379
+ id: String(active.id),
21380
+ oldIndex,
21381
+ newIndex
21382
+ });
21383
+ }
21384
+ },
21385
+ [orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
21386
+ );
21387
+ const SortableItem = React81__default.useCallback(
21388
+ ({ id, children }) => {
21389
+ const {
21390
+ attributes,
21391
+ listeners: listeners6,
21392
+ setNodeRef,
21393
+ transform,
21394
+ transition,
21395
+ isDragging
21396
+ } = useSortable({ id, data: { dndGroup: ownGroup } });
21397
+ const style = {
21398
+ transform: CSS.Transform.toString(transform),
21399
+ transition,
21400
+ opacity: isDragging ? 0.4 : 1,
21401
+ cursor: enabled ? "grab" : void 0
21402
+ };
21403
+ return /* @__PURE__ */ jsx(
21404
+ Box,
21405
+ {
21406
+ className: "touch-none",
21407
+ ref: setNodeRef,
21408
+ style,
21409
+ ...attributes,
21410
+ ...listeners6,
21411
+ children
21412
+ }
21413
+ );
21414
+ },
21415
+ [ownGroup, enabled]
21416
+ );
21417
+ const DropZoneShell = ({ children }) => {
21418
+ const { setNodeRef, isOver } = useDroppable({
21419
+ id: `dnd-zone-${zoneId}`,
21420
+ data: { dndGroup: ownGroup }
21421
+ });
21422
+ return /* @__PURE__ */ jsx(
21423
+ Box,
21424
+ {
21425
+ ref: setNodeRef,
21426
+ "data-dnd-zone": ownGroup,
21427
+ className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
21428
+ children
21429
+ }
21430
+ );
21431
+ };
21432
+ const rootContextValue = React81__default.useMemo(
21433
+ () => ({ registerZone, unregisterZone }),
21434
+ [registerZone, unregisterZone]
21435
+ );
21436
+ const wrapContainer = React81__default.useCallback(
21437
+ (children) => {
21438
+ if (!enabled) return children;
21439
+ const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
21440
+ if (!isZone) {
21441
+ if (!isRoot) return children;
21442
+ return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, children }) });
21443
+ }
21444
+ const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
21445
+ if (isRoot) {
21446
+ return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, children: inner }) });
21447
+ }
21448
+ return inner;
21449
+ },
21450
+ [enabled, isZone, layout, sensors, handleDragEnd, itemIds, isRoot, rootContextValue]
21451
+ );
21452
+ return {
21453
+ enabled,
21454
+ wrapContainer,
21455
+ SortableItem,
21456
+ orderedItems
21457
+ };
21458
+ }
21459
+ var RootCtx;
21460
+ var init_useDataDnd = __esm({
21461
+ "components/molecules/useDataDnd.tsx"() {
21462
+ "use client";
21463
+ init_useEventBus();
21464
+ init_Box();
21465
+ RootCtx = React81__default.createContext(null);
21466
+ }
21467
+ });
21272
21468
  function fieldLabel2(key) {
21273
21469
  return key.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
21274
21470
  }
@@ -21332,14 +21528,33 @@ function DataGrid({
21332
21528
  hasMore,
21333
21529
  children,
21334
21530
  pageSize = 0,
21335
- renderItem: schemaRenderItem
21531
+ renderItem: schemaRenderItem,
21532
+ dragGroup,
21533
+ accepts,
21534
+ sortable,
21535
+ dropEvent,
21536
+ reorderEvent,
21537
+ dndItemIdField,
21538
+ dndRoot
21336
21539
  }) {
21337
21540
  const eventBus = useEventBus();
21338
21541
  const { t } = useTranslate();
21339
21542
  const [selectedIds, setSelectedIds] = useState(/* @__PURE__ */ new Set());
21340
21543
  const [visibleCount, setVisibleCount] = useState(pageSize || Infinity);
21341
21544
  const fieldDefs = fields ?? columns ?? [];
21342
- const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
21545
+ const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
21546
+ const dnd = useDataDnd({
21547
+ items: allDataRaw,
21548
+ layout: "grid",
21549
+ dragGroup,
21550
+ accepts,
21551
+ sortable,
21552
+ dropEvent,
21553
+ reorderEvent,
21554
+ dndItemIdField,
21555
+ dndRoot
21556
+ });
21557
+ const allData = dnd.orderedItems;
21343
21558
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
21344
21559
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
21345
21560
  const toggleSelection = useCallback((id) => {
@@ -21411,196 +21626,205 @@ function DataGrid({
21411
21626
  const allIds = data.map((item, i) => item.id || String(i));
21412
21627
  const allSelected = allIds.length > 0 && allIds.every((id) => selectedIds.has(id));
21413
21628
  const someSelected = selectedIds.size > 0;
21414
- return /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
21415
- selectable && someSelected && /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "items-center px-2 py-2 bg-muted rounded-sm", children: [
21629
+ const idFieldName = dndItemIdField ?? "id";
21630
+ return dnd.wrapContainer(
21631
+ /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
21632
+ selectable && someSelected && /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "items-center px-2 py-2 bg-muted rounded-sm", children: [
21633
+ /* @__PURE__ */ jsx(
21634
+ "input",
21635
+ {
21636
+ type: "checkbox",
21637
+ checked: allSelected,
21638
+ onChange: toggleAll,
21639
+ className: "w-4 h-4 accent-primary",
21640
+ "aria-label": "Select all"
21641
+ }
21642
+ ),
21643
+ /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "font-semibold", children: [
21644
+ selectedIds.size,
21645
+ " ",
21646
+ t("common.selected") || "selected"
21647
+ ] })
21648
+ ] }),
21416
21649
  /* @__PURE__ */ jsx(
21417
- "input",
21650
+ Box,
21418
21651
  {
21419
- type: "checkbox",
21420
- checked: allSelected,
21421
- onChange: toggleAll,
21422
- className: "w-4 h-4 accent-primary",
21423
- "aria-label": "Select all"
21424
- }
21425
- ),
21426
- /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "font-semibold", children: [
21427
- selectedIds.size,
21428
- " ",
21429
- t("common.selected") || "selected"
21430
- ] })
21431
- ] }),
21432
- /* @__PURE__ */ jsx(
21433
- Box,
21434
- {
21435
- className: cn("grid", gapStyles6[gap], colsClass, className),
21436
- style: gridTemplateColumns ? { gridTemplateColumns } : void 0,
21437
- children: data.map((item, index) => {
21438
- const itemData = item;
21439
- const id = itemData.id || String(index);
21440
- const isSelected = selectedIds.has(id);
21441
- if (hasRenderProp) {
21442
- return /* @__PURE__ */ jsx(
21443
- Box,
21444
- {
21445
- "data-entity-row": true,
21446
- "data-entity-id": id,
21447
- className: cn(isSelected && "ring-2 ring-primary rounded-lg"),
21448
- children: children(itemData, index)
21449
- },
21450
- id
21451
- );
21452
- }
21453
- const titleValue = getNestedValue(itemData, titleField?.name ?? "");
21454
- return /* @__PURE__ */ jsxs(
21455
- Box,
21456
- {
21457
- "data-entity-row": true,
21458
- "data-entity-id": id,
21459
- className: cn(
21460
- "bg-card rounded-lg",
21461
- "border border-border",
21462
- "shadow-sm hover:shadow-lg",
21463
- "hover:border-primary transition-all",
21464
- "flex flex-col",
21465
- isSelected && "ring-2 ring-primary border-primary"
21466
- ),
21467
- children: [
21468
- imageField && (() => {
21469
- const imgUrl = getNestedValue(itemData, imageField);
21470
- if (!imgUrl || typeof imgUrl !== "string") return null;
21471
- return /* @__PURE__ */ jsx(Box, { className: "w-full aspect-video overflow-hidden rounded-t-lg", children: /* @__PURE__ */ jsx(
21472
- "img",
21473
- {
21474
- src: imgUrl,
21475
- alt: titleValue !== void 0 ? String(titleValue) : "",
21476
- className: "w-full h-full object-cover",
21477
- loading: "lazy"
21478
- }
21479
- ) });
21480
- })(),
21481
- /* @__PURE__ */ jsx(Box, { className: "p-4 pb-0", children: /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-start", children: [
21482
- selectable && /* @__PURE__ */ jsx(
21483
- "input",
21484
- {
21485
- type: "checkbox",
21486
- checked: isSelected,
21487
- onChange: () => toggleSelection(id),
21488
- onClick: (e) => e.stopPropagation(),
21489
- className: "w-4 h-4 mt-1 flex-shrink-0 accent-primary",
21490
- "aria-label": `Select ${titleValue !== void 0 ? String(titleValue) : "item"}`
21491
- }
21652
+ className: cn("grid", gapStyles6[gap], colsClass, className),
21653
+ style: gridTemplateColumns ? { gridTemplateColumns } : void 0,
21654
+ children: data.map((item, index) => {
21655
+ const itemData = item;
21656
+ const id = itemData.id || String(index);
21657
+ const isSelected = selectedIds.has(id);
21658
+ const dndId = itemData[idFieldName] ?? `__idx_${index}`;
21659
+ const wrapDnd = (node) => dnd.enabled ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
21660
+ if (hasRenderProp) {
21661
+ return wrapDnd(
21662
+ /* @__PURE__ */ jsx(
21663
+ Box,
21664
+ {
21665
+ "data-entity-row": true,
21666
+ "data-entity-id": id,
21667
+ className: cn(isSelected && "ring-2 ring-primary rounded-lg"),
21668
+ children: children(itemData, index)
21669
+ },
21670
+ id
21671
+ )
21672
+ );
21673
+ }
21674
+ const titleValue = getNestedValue(itemData, titleField?.name ?? "");
21675
+ return wrapDnd(
21676
+ /* @__PURE__ */ jsxs(
21677
+ Box,
21678
+ {
21679
+ "data-entity-row": true,
21680
+ "data-entity-id": id,
21681
+ className: cn(
21682
+ "bg-card rounded-lg",
21683
+ "border border-border",
21684
+ "shadow-sm hover:shadow-lg",
21685
+ "hover:border-primary transition-all",
21686
+ "flex flex-col",
21687
+ isSelected && "ring-2 ring-primary border-primary"
21492
21688
  ),
21493
- /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: "flex-1 min-w-0", children: [
21494
- titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21495
- titleField?.icon && /* @__PURE__ */ jsx(Icon, { name: titleField.icon, size: "sm", className: "text-primary flex-shrink-0" }),
21496
- /* @__PURE__ */ jsx(
21497
- Typography,
21689
+ children: [
21690
+ imageField && (() => {
21691
+ const imgUrl = getNestedValue(itemData, imageField);
21692
+ if (!imgUrl || typeof imgUrl !== "string") return null;
21693
+ return /* @__PURE__ */ jsx(Box, { className: "w-full aspect-video overflow-hidden rounded-t-lg", children: /* @__PURE__ */ jsx(
21694
+ "img",
21498
21695
  {
21499
- variant: titleField?.variant === "h3" ? "h3" : "h4",
21500
- className: "font-semibold truncate",
21501
- children: String(titleValue)
21696
+ src: imgUrl,
21697
+ alt: titleValue !== void 0 ? String(titleValue) : "",
21698
+ className: "w-full h-full object-cover",
21699
+ loading: "lazy"
21502
21700
  }
21503
- )
21504
- ] }),
21505
- badgeFields.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap", children: badgeFields.map((field) => {
21506
- const val = getNestedValue(itemData, field.name);
21507
- if (val === void 0 || val === null) return null;
21508
- return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21509
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
21510
- /* @__PURE__ */ jsx(Badge, { variant: resolveBadgeVariant(field, String(val)), children: String(val) })
21511
- ] }, field.name);
21512
- }) })
21513
- ] }),
21514
- dangerActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: dangerActions.map((action, idx) => /* @__PURE__ */ jsxs(
21515
- Button,
21516
- {
21517
- variant: "ghost",
21518
- size: "sm",
21519
- onClick: handleActionClick(action, itemData),
21520
- "data-testid": `action-${action.event}`,
21521
- "data-row-id": String(itemData.id),
21522
- className: "text-error hover:text-error hover:bg-error/10 px-2",
21523
- children: [
21524
- action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs" }),
21525
- action.label
21526
- ]
21527
- },
21528
- idx
21529
- )) })
21530
- ] }) }),
21531
- bodyFields.length > 0 && /* @__PURE__ */ jsx(Box, { className: "px-4 py-3 flex-1", children: /* @__PURE__ */ jsx(VStack, { gap: "xs", children: bodyFields.map((field) => {
21532
- const value = getNestedValue(itemData, field.name);
21533
- if (value === void 0 || value === null || value === "") return null;
21534
- if (field.format === "boolean") {
21535
- return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-center", children: [
21536
- /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21537
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21538
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
21701
+ ) });
21702
+ })(),
21703
+ /* @__PURE__ */ jsx(Box, { className: "p-4 pb-0", children: /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-start", children: [
21704
+ selectable && /* @__PURE__ */ jsx(
21705
+ "input",
21706
+ {
21707
+ type: "checkbox",
21708
+ checked: isSelected,
21709
+ onChange: () => toggleSelection(id),
21710
+ onClick: (e) => e.stopPropagation(),
21711
+ className: "w-4 h-4 mt-1 flex-shrink-0 accent-primary",
21712
+ "aria-label": `Select ${titleValue !== void 0 ? String(titleValue) : "item"}`
21713
+ }
21714
+ ),
21715
+ /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: "flex-1 min-w-0", children: [
21716
+ titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21717
+ titleField?.icon && /* @__PURE__ */ jsx(Icon, { name: titleField.icon, size: "sm", className: "text-primary flex-shrink-0" }),
21718
+ /* @__PURE__ */ jsx(
21719
+ Typography,
21720
+ {
21721
+ variant: titleField?.variant === "h3" ? "h3" : "h4",
21722
+ className: "font-semibold truncate",
21723
+ children: String(titleValue)
21724
+ }
21725
+ )
21726
+ ] }),
21727
+ badgeFields.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap", children: badgeFields.map((field) => {
21728
+ const val = getNestedValue(itemData, field.name);
21729
+ if (val === void 0 || val === null) return null;
21730
+ return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21731
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
21732
+ /* @__PURE__ */ jsx(Badge, { variant: resolveBadgeVariant(field, String(val)), children: String(val) })
21733
+ ] }, field.name);
21734
+ }) })
21539
21735
  ] }),
21540
- /* @__PURE__ */ jsx(Badge, { variant: value ? "success" : "neutral", children: value ? t("common.yes") || "Yes" : t("common.no") || "No" })
21541
- ] }, field.name);
21542
- }
21543
- return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-center", children: [
21544
- /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21545
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21546
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
21547
- ] }),
21548
- /* @__PURE__ */ jsx(
21549
- Typography,
21550
- {
21551
- variant: field.variant === "caption" ? "caption" : "small",
21552
- className: "text-right truncate max-w-[60%]",
21553
- children: formatValue(value, field.format)
21736
+ dangerActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: dangerActions.map((action, idx) => /* @__PURE__ */ jsxs(
21737
+ Button,
21738
+ {
21739
+ variant: "ghost",
21740
+ size: "sm",
21741
+ onClick: handleActionClick(action, itemData),
21742
+ "data-testid": `action-${action.event}`,
21743
+ "data-row-id": String(itemData.id),
21744
+ className: "text-error hover:text-error hover:bg-error/10 px-2",
21745
+ children: [
21746
+ action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs" }),
21747
+ action.label
21748
+ ]
21749
+ },
21750
+ idx
21751
+ )) })
21752
+ ] }) }),
21753
+ bodyFields.length > 0 && /* @__PURE__ */ jsx(Box, { className: "px-4 py-3 flex-1", children: /* @__PURE__ */ jsx(VStack, { gap: "xs", children: bodyFields.map((field) => {
21754
+ const value = getNestedValue(itemData, field.name);
21755
+ if (value === void 0 || value === null || value === "") return null;
21756
+ if (field.format === "boolean") {
21757
+ return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-center", children: [
21758
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21759
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21760
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
21761
+ ] }),
21762
+ /* @__PURE__ */ jsx(Badge, { variant: value ? "success" : "neutral", children: value ? t("common.yes") || "Yes" : t("common.no") || "No" })
21763
+ ] }, field.name);
21554
21764
  }
21555
- )
21556
- ] }, field.name);
21557
- }) }) }),
21558
- 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(
21559
- Button,
21560
- {
21561
- variant: action.variant === "primary" ? "primary" : "ghost",
21562
- size: "sm",
21563
- onClick: handleActionClick(action, itemData),
21564
- "data-testid": `action-${action.event}`,
21565
- "data-row-id": String(itemData.id),
21566
- children: [
21567
- action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
21568
- action.label
21569
- ]
21570
- },
21571
- idx
21572
- )) }) })
21573
- ]
21574
- },
21575
- id
21576
- );
21577
- })
21578
- }
21579
- ),
21580
- hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
21581
- Button,
21582
- {
21583
- variant: "ghost",
21584
- size: "sm",
21585
- onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
21586
- children: [
21587
- /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
21588
- t("common.showMore"),
21589
- " (",
21590
- allData.length - visibleCount,
21591
- " remaining)"
21592
- ]
21593
- }
21594
- ) }),
21595
- infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
21596
- InfiniteScrollSentinel,
21597
- {
21598
- loadMoreEvent,
21599
- isLoading,
21600
- hasMore
21601
- }
21602
- )
21603
- ] });
21765
+ return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-center", children: [
21766
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21767
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21768
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
21769
+ ] }),
21770
+ /* @__PURE__ */ jsx(
21771
+ Typography,
21772
+ {
21773
+ variant: field.variant === "caption" ? "caption" : "small",
21774
+ className: "text-right truncate max-w-[60%]",
21775
+ children: formatValue(value, field.format)
21776
+ }
21777
+ )
21778
+ ] }, field.name);
21779
+ }) }) }),
21780
+ 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(
21781
+ Button,
21782
+ {
21783
+ variant: action.variant === "primary" ? "primary" : "ghost",
21784
+ size: "sm",
21785
+ onClick: handleActionClick(action, itemData),
21786
+ "data-testid": `action-${action.event}`,
21787
+ "data-row-id": String(itemData.id),
21788
+ children: [
21789
+ action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
21790
+ action.label
21791
+ ]
21792
+ },
21793
+ idx
21794
+ )) }) })
21795
+ ]
21796
+ },
21797
+ id
21798
+ )
21799
+ );
21800
+ })
21801
+ }
21802
+ ),
21803
+ hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
21804
+ Button,
21805
+ {
21806
+ variant: "ghost",
21807
+ size: "sm",
21808
+ onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
21809
+ children: [
21810
+ /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
21811
+ t("common.showMore"),
21812
+ " (",
21813
+ allData.length - visibleCount,
21814
+ " remaining)"
21815
+ ]
21816
+ }
21817
+ ) }),
21818
+ infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
21819
+ InfiniteScrollSentinel,
21820
+ {
21821
+ loadMoreEvent,
21822
+ isLoading,
21823
+ hasMore
21824
+ }
21825
+ )
21826
+ ] })
21827
+ );
21604
21828
  }
21605
21829
  var dataGridLog, BADGE_VARIANTS, gapStyles6;
21606
21830
  var init_DataGrid = __esm({
@@ -21617,6 +21841,7 @@ var init_DataGrid = __esm({
21617
21841
  init_Button();
21618
21842
  init_Icon();
21619
21843
  init_InfiniteScrollSentinel();
21844
+ init_useDataDnd();
21620
21845
  dataGridLog = createLogger("almadar:ui:data-grid");
21621
21846
  BADGE_VARIANTS = /* @__PURE__ */ new Set([
21622
21847
  "default",
@@ -21711,17 +21936,36 @@ function DataList({
21711
21936
  hasMore,
21712
21937
  children,
21713
21938
  pageSize = 5,
21714
- renderItem: schemaRenderItem
21939
+ renderItem: schemaRenderItem,
21940
+ dragGroup,
21941
+ accepts,
21942
+ sortable: sortableProp,
21943
+ dropEvent,
21944
+ reorderEvent: dndReorderEvent,
21945
+ dndItemIdField,
21946
+ dndRoot
21715
21947
  }) {
21716
21948
  const eventBus = useEventBus();
21717
21949
  const { t } = useTranslate();
21718
- const [visibleCount, setVisibleCount] = React136__default.useState(pageSize || Infinity);
21950
+ const [visibleCount, setVisibleCount] = React81__default.useState(pageSize || Infinity);
21719
21951
  const fieldDefs = fields ?? columns ?? [];
21720
- const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
21952
+ const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
21953
+ const dnd = useDataDnd({
21954
+ items: allDataRaw,
21955
+ layout: "list",
21956
+ dragGroup,
21957
+ accepts,
21958
+ sortable: sortableProp,
21959
+ dropEvent,
21960
+ reorderEvent: dndReorderEvent,
21961
+ dndItemIdField,
21962
+ dndRoot
21963
+ });
21964
+ const allData = dnd.orderedItems;
21721
21965
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
21722
21966
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
21723
21967
  const hasRenderProp = typeof children === "function";
21724
- React136__default.useEffect(() => {
21968
+ React81__default.useEffect(() => {
21725
21969
  const renderItemTypeOf = typeof schemaRenderItem;
21726
21970
  const childrenTypeOf = typeof children;
21727
21971
  if (data.length > 0 && !hasRenderProp) {
@@ -21777,7 +22021,7 @@ function DataList({
21777
22021
  const items2 = data.map((item) => item);
21778
22022
  const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
21779
22023
  const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
21780
- return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React136__default.Fragment, { children: [
22024
+ return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
21781
22025
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
21782
22026
  group.items.map((itemData, index) => {
21783
22027
  const id = itemData.id || `${gi}-${index}`;
@@ -21825,18 +22069,112 @@ function DataList({
21825
22069
  }
21826
22070
  const items = data.map((item) => item);
21827
22071
  const groups = groupBy ? groupData(items, groupBy) : [{ label: "", items }];
22072
+ const idFieldName = dndItemIdField ?? "id";
21828
22073
  const renderItem = (itemData, index, isLast) => {
22074
+ const dndId = itemData[idFieldName] ?? `__idx_${index}`;
22075
+ const wrapDnd = (node) => dnd.enabled ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
21829
22076
  if (hasRenderProp) {
21830
22077
  const id2 = itemData.id || String(index);
21831
- return /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id2, children: [
21832
- /* @__PURE__ */ jsxs(Box, { className: "group flex items-stretch gap-2", children: [
21833
- /* @__PURE__ */ jsx(Box, { className: "flex-1 min-w-0", children: children(itemData, index) }),
21834
- itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(
21835
- HStack,
21836
- {
21837
- gap: "xs",
21838
- className: "flex-shrink-0",
21839
- children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
22078
+ return wrapDnd(
22079
+ /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id2, children: [
22080
+ /* @__PURE__ */ jsxs(Box, { className: "group flex items-stretch gap-2", children: [
22081
+ /* @__PURE__ */ jsx(Box, { className: "flex-1 min-w-0", children: children(itemData, index) }),
22082
+ itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(
22083
+ HStack,
22084
+ {
22085
+ gap: "xs",
22086
+ className: "flex-shrink-0",
22087
+ children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
22088
+ Button,
22089
+ {
22090
+ variant: action.variant ?? "ghost",
22091
+ size: "sm",
22092
+ onClick: handleActionClick(action, itemData),
22093
+ "data-testid": `action-${action.event}`,
22094
+ "data-row-id": String(itemData.id),
22095
+ className: cn(
22096
+ action.variant === "danger" && "text-error hover:bg-error/10"
22097
+ ),
22098
+ children: [
22099
+ action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
22100
+ action.label
22101
+ ]
22102
+ },
22103
+ idx
22104
+ ))
22105
+ }
22106
+ )
22107
+ ] }),
22108
+ isCard && !isLast && /* @__PURE__ */ jsx(Box, { className: "mx-6 border-b border-border/40" })
22109
+ ] }, id2)
22110
+ );
22111
+ }
22112
+ const id = itemData.id || String(index);
22113
+ const titleValue = getNestedValue(itemData, titleField?.name ?? "");
22114
+ return wrapDnd(
22115
+ /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id, children: [
22116
+ /* @__PURE__ */ jsxs(
22117
+ Box,
22118
+ {
22119
+ className: cn(
22120
+ "group flex items-center gap-4 transition-all duration-200",
22121
+ isCompact ? "px-4 py-2" : "px-6 py-4",
22122
+ "hover:bg-muted/80",
22123
+ !isCard && !isCompact && "rounded-lg border border-transparent hover:border-border"
22124
+ ),
22125
+ children: [
22126
+ /* @__PURE__ */ jsxs(Box, { className: "flex-1 min-w-0", children: [
22127
+ /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "items-center", children: [
22128
+ titleField?.icon && /* @__PURE__ */ jsx(
22129
+ Icon,
22130
+ {
22131
+ name: titleField.icon,
22132
+ size: isCompact ? "xs" : "sm",
22133
+ className: "text-primary flex-shrink-0"
22134
+ }
22135
+ ),
22136
+ titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsx(
22137
+ Typography,
22138
+ {
22139
+ variant: titleField?.variant === "h3" ? "h3" : "h4",
22140
+ className: cn("font-semibold truncate flex-1", isCompact && "text-sm"),
22141
+ children: String(titleValue)
22142
+ }
22143
+ ),
22144
+ badgeFields.map((field) => {
22145
+ const val = getNestedValue(itemData, field.name);
22146
+ if (val === void 0 || val === null) return null;
22147
+ return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center flex-shrink-0", children: [
22148
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
22149
+ /* @__PURE__ */ jsx(Badge, { variant: statusVariant3(String(val)), children: String(val) })
22150
+ ] }, field.name);
22151
+ })
22152
+ ] }),
22153
+ bodyFields.length > 0 && !isCompact && /* @__PURE__ */ jsx(HStack, { gap: "md", className: "mt-1.5 flex-wrap", children: bodyFields.map((field) => {
22154
+ const value = getNestedValue(itemData, field.name);
22155
+ if (value === void 0 || value === null || value === "") return null;
22156
+ return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
22157
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
22158
+ /* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "secondary", children: [
22159
+ field.label ?? fieldLabel3(field.name),
22160
+ ":"
22161
+ ] }),
22162
+ /* @__PURE__ */ jsx(Typography, { variant: "small", children: formatValue2(value, field.format) })
22163
+ ] }, field.name);
22164
+ }) }),
22165
+ progressFields.map((field) => {
22166
+ const value = getNestedValue(itemData, field.name);
22167
+ if (typeof value !== "number") return null;
22168
+ return /* @__PURE__ */ jsxs(Box, { className: "mt-2 max-w-xs", children: [
22169
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center mb-1", children: [
22170
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
22171
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel3(field.name) })
22172
+ ] }),
22173
+ /* @__PURE__ */ jsx(ProgressBar, { value, max: 100 })
22174
+ ] }, field.name);
22175
+ })
22176
+ ] }),
22177
+ itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
21840
22178
  Button,
21841
22179
  {
21842
22180
  variant: action.variant ?? "ghost",
@@ -21853,141 +22191,56 @@ function DataList({
21853
22191
  ]
21854
22192
  },
21855
22193
  idx
21856
- ))
21857
- }
21858
- )
21859
- ] }),
22194
+ )) })
22195
+ ]
22196
+ }
22197
+ ),
21860
22198
  isCard && !isLast && /* @__PURE__ */ jsx(Box, { className: "mx-6 border-b border-border/40" })
21861
- ] }, id2);
21862
- }
21863
- const id = itemData.id || String(index);
21864
- const titleValue = getNestedValue(itemData, titleField?.name ?? "");
21865
- return /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id, children: [
21866
- /* @__PURE__ */ jsxs(
21867
- Box,
21868
- {
21869
- className: cn(
21870
- "group flex items-center gap-4 transition-all duration-200",
21871
- isCompact ? "px-4 py-2" : "px-6 py-4",
21872
- "hover:bg-muted/80",
21873
- !isCard && !isCompact && "rounded-lg border border-transparent hover:border-border"
21874
- ),
21875
- children: [
21876
- /* @__PURE__ */ jsxs(Box, { className: "flex-1 min-w-0", children: [
21877
- /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "items-center", children: [
21878
- titleField?.icon && /* @__PURE__ */ jsx(
21879
- Icon,
21880
- {
21881
- name: titleField.icon,
21882
- size: isCompact ? "xs" : "sm",
21883
- className: "text-primary flex-shrink-0"
21884
- }
21885
- ),
21886
- titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsx(
21887
- Typography,
21888
- {
21889
- variant: titleField?.variant === "h3" ? "h3" : "h4",
21890
- className: cn("font-semibold truncate flex-1", isCompact && "text-sm"),
21891
- children: String(titleValue)
21892
- }
21893
- ),
21894
- badgeFields.map((field) => {
21895
- const val = getNestedValue(itemData, field.name);
21896
- if (val === void 0 || val === null) return null;
21897
- return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center flex-shrink-0", children: [
21898
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
21899
- /* @__PURE__ */ jsx(Badge, { variant: statusVariant3(String(val)), children: String(val) })
21900
- ] }, field.name);
21901
- })
21902
- ] }),
21903
- bodyFields.length > 0 && !isCompact && /* @__PURE__ */ jsx(HStack, { gap: "md", className: "mt-1.5 flex-wrap", children: bodyFields.map((field) => {
21904
- const value = getNestedValue(itemData, field.name);
21905
- if (value === void 0 || value === null || value === "") return null;
21906
- return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21907
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21908
- /* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "secondary", children: [
21909
- field.label ?? fieldLabel3(field.name),
21910
- ":"
21911
- ] }),
21912
- /* @__PURE__ */ jsx(Typography, { variant: "small", children: formatValue2(value, field.format) })
21913
- ] }, field.name);
21914
- }) }),
21915
- progressFields.map((field) => {
21916
- const value = getNestedValue(itemData, field.name);
21917
- if (typeof value !== "number") return null;
21918
- return /* @__PURE__ */ jsxs(Box, { className: "mt-2 max-w-xs", children: [
21919
- /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center mb-1", children: [
21920
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21921
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel3(field.name) })
21922
- ] }),
21923
- /* @__PURE__ */ jsx(ProgressBar, { value, max: 100 })
21924
- ] }, field.name);
21925
- })
21926
- ] }),
21927
- itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
21928
- Button,
21929
- {
21930
- variant: action.variant ?? "ghost",
21931
- size: "sm",
21932
- onClick: handleActionClick(action, itemData),
21933
- "data-testid": `action-${action.event}`,
21934
- "data-row-id": String(itemData.id),
21935
- className: cn(
21936
- action.variant === "danger" && "text-error hover:bg-error/10"
21937
- ),
21938
- children: [
21939
- action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
21940
- action.label
21941
- ]
21942
- },
21943
- idx
21944
- )) })
21945
- ]
21946
- }
21947
- ),
21948
- isCard && !isLast && /* @__PURE__ */ jsx(Box, { className: "mx-6 border-b border-border/40" })
21949
- ] }, id);
22199
+ ] }, id)
22200
+ );
21950
22201
  };
21951
- return /* @__PURE__ */ jsxs(
21952
- Box,
21953
- {
21954
- className: cn(
21955
- isCard && "bg-card rounded-xl border border-border shadow-lg overflow-hidden",
21956
- !isCard && gapClass,
21957
- className
21958
- ),
21959
- children: [
21960
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React136__default.Fragment, { children: [
21961
- group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
21962
- group.items.map(
21963
- (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
22202
+ return dnd.wrapContainer(
22203
+ /* @__PURE__ */ jsxs(
22204
+ Box,
22205
+ {
22206
+ className: cn(
22207
+ isCard && "bg-card rounded-xl border border-border shadow-lg overflow-hidden",
22208
+ !isCard && gapClass,
22209
+ className
22210
+ ),
22211
+ children: [
22212
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
22213
+ group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
22214
+ group.items.map(
22215
+ (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
22216
+ )
22217
+ ] }, gi)),
22218
+ hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
22219
+ Button,
22220
+ {
22221
+ variant: "ghost",
22222
+ size: "sm",
22223
+ onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
22224
+ children: [
22225
+ /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
22226
+ t("common.showMore"),
22227
+ " (",
22228
+ allData.length - visibleCount,
22229
+ " remaining)"
22230
+ ]
22231
+ }
22232
+ ) }),
22233
+ infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
22234
+ InfiniteScrollSentinel,
22235
+ {
22236
+ loadMoreEvent,
22237
+ isLoading,
22238
+ hasMore
22239
+ }
21964
22240
  )
21965
- ] }, gi)),
21966
- hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
21967
- Button,
21968
- {
21969
- variant: "ghost",
21970
- size: "sm",
21971
- onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
21972
- children: [
21973
- /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
21974
- t("common.showMore"),
21975
- " (",
21976
- allData.length - visibleCount,
21977
- " remaining)"
21978
- ]
21979
- }
21980
- ) }),
21981
- infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
21982
- InfiniteScrollSentinel,
21983
- {
21984
- loadMoreEvent,
21985
- isLoading,
21986
- hasMore
21987
- }
21988
- )
21989
- ]
21990
- }
22241
+ ]
22242
+ }
22243
+ )
21991
22244
  );
21992
22245
  }
21993
22246
  var dataListLog;
@@ -22007,6 +22260,7 @@ var init_DataList = __esm({
22007
22260
  init_ProgressBar();
22008
22261
  init_Divider();
22009
22262
  init_InfiniteScrollSentinel();
22263
+ init_useDataDnd();
22010
22264
  dataListLog = createLogger("almadar:ui:data-list");
22011
22265
  DataList.displayName = "DataList";
22012
22266
  }
@@ -23257,7 +23511,7 @@ var init_WizardProgress = __esm({
23257
23511
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
23258
23512
  const isActive = index === currentStep;
23259
23513
  const isCompleted = index < currentStep;
23260
- return /* @__PURE__ */ jsxs(React136__default.Fragment, { children: [
23514
+ return /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
23261
23515
  /* @__PURE__ */ jsx(
23262
23516
  "button",
23263
23517
  {
@@ -24168,7 +24422,7 @@ function InventoryGrid({
24168
24422
  const eventBus = useEventBus();
24169
24423
  const slotCount = totalSlots ?? items.length;
24170
24424
  const emptySlotCount = Math.max(0, slotCount - items.length);
24171
- const handleSelect = React136.useCallback(
24425
+ const handleSelect = React81.useCallback(
24172
24426
  (id) => {
24173
24427
  onSelect?.(id);
24174
24428
  if (selectEvent) {
@@ -24381,15 +24635,15 @@ function GameCanvas2D({
24381
24635
  fps = 60,
24382
24636
  className
24383
24637
  }) {
24384
- const canvasRef = React136.useRef(null);
24385
- const rafRef = React136.useRef(0);
24386
- const frameRef = React136.useRef(0);
24387
- const lastTimeRef = React136.useRef(0);
24388
- const onDrawRef = React136.useRef(onDraw);
24638
+ const canvasRef = React81.useRef(null);
24639
+ const rafRef = React81.useRef(0);
24640
+ const frameRef = React81.useRef(0);
24641
+ const lastTimeRef = React81.useRef(0);
24642
+ const onDrawRef = React81.useRef(onDraw);
24389
24643
  onDrawRef.current = onDraw;
24390
- const onTickRef = React136.useRef(onTick);
24644
+ const onTickRef = React81.useRef(onTick);
24391
24645
  onTickRef.current = onTick;
24392
- React136.useEffect(() => {
24646
+ React81.useEffect(() => {
24393
24647
  const canvas = canvasRef.current;
24394
24648
  if (!canvas) return;
24395
24649
  const ctx = canvas.getContext("2d");
@@ -24678,7 +24932,7 @@ function TurnPanel({
24678
24932
  className
24679
24933
  }) {
24680
24934
  const eventBus = useEventBus();
24681
- const handleAction = React136.useCallback(
24935
+ const handleAction = React81.useCallback(
24682
24936
  (event) => {
24683
24937
  if (event) {
24684
24938
  eventBus.emit(event, { turn: currentTurn, phase, activeTeam });
@@ -24824,7 +25078,7 @@ function UnitCommandBar({
24824
25078
  className
24825
25079
  }) {
24826
25080
  const eventBus = useEventBus();
24827
- const handleCommand = React136.useCallback(
25081
+ const handleCommand = React81.useCallback(
24828
25082
  (event) => {
24829
25083
  if (event) {
24830
25084
  eventBus.emit(event, { unitId: selectedUnitId });
@@ -25309,7 +25563,7 @@ function GameMenu({
25309
25563
  } catch {
25310
25564
  }
25311
25565
  const eventBus = eventBusProp || eventBusFromHook;
25312
- const handleOptionClick = React136.useCallback(
25566
+ const handleOptionClick = React81.useCallback(
25313
25567
  (option) => {
25314
25568
  if (option.event && eventBus) {
25315
25569
  eventBus.emit(`UI:${option.event}`, { option });
@@ -25423,7 +25677,7 @@ function GameOverScreen({
25423
25677
  } catch {
25424
25678
  }
25425
25679
  const eventBus = eventBusProp || eventBusFromHook;
25426
- const handleActionClick = React136.useCallback(
25680
+ const handleActionClick = React81.useCallback(
25427
25681
  (action) => {
25428
25682
  if (action.event && eventBus) {
25429
25683
  eventBus.emit(`UI:${action.event}`, { action });
@@ -28050,7 +28304,7 @@ var init_StepFlow = __esm({
28050
28304
  className
28051
28305
  }) => {
28052
28306
  if (orientation === "vertical") {
28053
- return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React136__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
28307
+ return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React81__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
28054
28308
  /* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
28055
28309
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
28056
28310
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
@@ -28061,7 +28315,7 @@ var init_StepFlow = __esm({
28061
28315
  ] })
28062
28316
  ] }) }, index)) });
28063
28317
  }
28064
- 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(React136__default.Fragment, { children: [
28318
+ 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(React81__default.Fragment, { children: [
28065
28319
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
28066
28320
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
28067
28321
  /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -28943,7 +29197,7 @@ var init_LikertScale = __esm({
28943
29197
  md: "text-base",
28944
29198
  lg: "text-lg"
28945
29199
  };
28946
- LikertScale = React136__default.forwardRef(
29200
+ LikertScale = React81__default.forwardRef(
28947
29201
  ({
28948
29202
  question,
28949
29203
  options = DEFAULT_LIKERT_OPTIONS,
@@ -28955,7 +29209,7 @@ var init_LikertScale = __esm({
28955
29209
  variant = "radios",
28956
29210
  className
28957
29211
  }, ref) => {
28958
- const groupId = React136__default.useId();
29212
+ const groupId = React81__default.useId();
28959
29213
  const eventBus = useEventBus();
28960
29214
  const handleSelect = useCallback(
28961
29215
  (next) => {
@@ -31181,7 +31435,7 @@ var init_DocBreadcrumb = __esm({
31181
31435
  "aria-label": "Breadcrumb",
31182
31436
  children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", wrap: true, children: items.map((item, idx) => {
31183
31437
  const isLast = idx === items.length - 1;
31184
- return /* @__PURE__ */ jsxs(React136__default.Fragment, { children: [
31438
+ return /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
31185
31439
  idx > 0 && /* @__PURE__ */ jsx(
31186
31440
  Icon,
31187
31441
  {
@@ -32071,7 +32325,7 @@ var init_MiniStateMachine = __esm({
32071
32325
  const x = 2 + i * (NODE_W + GAP + ARROW_W + GAP);
32072
32326
  const tc = transitionCounts[s.name] ?? 0;
32073
32327
  const role = getStateRole(s.name, s.isInitial, s.isTerminal, tc, maxTC);
32074
- return /* @__PURE__ */ jsxs(React136__default.Fragment, { children: [
32328
+ return /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
32075
32329
  /* @__PURE__ */ jsx(
32076
32330
  AvlState,
32077
32331
  {
@@ -33448,7 +33702,7 @@ var init_DocumentViewer = __esm({
33448
33702
  }
33449
33703
  });
33450
33704
  function extractTitle(children) {
33451
- if (!React136__default.isValidElement(children)) return void 0;
33705
+ if (!React81__default.isValidElement(children)) return void 0;
33452
33706
  const props = children.props;
33453
33707
  if (typeof props.title === "string") {
33454
33708
  return props.title;
@@ -33503,7 +33757,7 @@ function LinearView({
33503
33757
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
33504
33758
  const isDone = i < currentIdx;
33505
33759
  const isCurrent = i === currentIdx;
33506
- return /* @__PURE__ */ jsxs(React136__default.Fragment, { children: [
33760
+ return /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
33507
33761
  i > 0 && /* @__PURE__ */ jsx(
33508
33762
  Typography,
33509
33763
  {
@@ -34403,12 +34657,12 @@ var init_Form = __esm({
34403
34657
  const isSchemaEntity = isOrbitalEntitySchema(entity);
34404
34658
  const resolvedEntity = isSchemaEntity ? entity : void 0;
34405
34659
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
34406
- const normalizedInitialData = React136__default.useMemo(() => {
34660
+ const normalizedInitialData = React81__default.useMemo(() => {
34407
34661
  const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
34408
34662
  const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
34409
34663
  return entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
34410
34664
  }, [entity, initialData]);
34411
- const entityDerivedFields = React136__default.useMemo(() => {
34665
+ const entityDerivedFields = React81__default.useMemo(() => {
34412
34666
  if (fields && fields.length > 0) return void 0;
34413
34667
  if (!resolvedEntity) return void 0;
34414
34668
  return resolvedEntity.fields.map(
@@ -34427,16 +34681,16 @@ var init_Form = __esm({
34427
34681
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
34428
34682
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
34429
34683
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
34430
- const [formData, setFormData] = React136__default.useState(
34684
+ const [formData, setFormData] = React81__default.useState(
34431
34685
  normalizedInitialData
34432
34686
  );
34433
- const [collapsedSections, setCollapsedSections] = React136__default.useState(
34687
+ const [collapsedSections, setCollapsedSections] = React81__default.useState(
34434
34688
  /* @__PURE__ */ new Set()
34435
34689
  );
34436
- const [submitError, setSubmitError] = React136__default.useState(null);
34437
- const formRef = React136__default.useRef(null);
34690
+ const [submitError, setSubmitError] = React81__default.useState(null);
34691
+ const formRef = React81__default.useRef(null);
34438
34692
  const formMode = props.mode;
34439
- const mountedRef = React136__default.useRef(false);
34693
+ const mountedRef = React81__default.useRef(false);
34440
34694
  if (!mountedRef.current) {
34441
34695
  mountedRef.current = true;
34442
34696
  debug("forms", "mount", {
@@ -34449,7 +34703,7 @@ var init_Form = __esm({
34449
34703
  });
34450
34704
  }
34451
34705
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
34452
- const evalContext = React136__default.useMemo(
34706
+ const evalContext = React81__default.useMemo(
34453
34707
  () => ({
34454
34708
  formValues: formData,
34455
34709
  globalVariables: externalContext?.globalVariables ?? {},
@@ -34458,7 +34712,7 @@ var init_Form = __esm({
34458
34712
  }),
34459
34713
  [formData, externalContext]
34460
34714
  );
34461
- React136__default.useEffect(() => {
34715
+ React81__default.useEffect(() => {
34462
34716
  debug("forms", "initialData-sync", {
34463
34717
  mode: formMode,
34464
34718
  normalizedInitialData,
@@ -34469,7 +34723,7 @@ var init_Form = __esm({
34469
34723
  setFormData(normalizedInitialData);
34470
34724
  }
34471
34725
  }, [normalizedInitialData]);
34472
- const processCalculations = React136__default.useCallback(
34726
+ const processCalculations = React81__default.useCallback(
34473
34727
  (changedFieldId, newFormData) => {
34474
34728
  if (!hiddenCalculations.length) return;
34475
34729
  const context = {
@@ -34494,7 +34748,7 @@ var init_Form = __esm({
34494
34748
  },
34495
34749
  [hiddenCalculations, externalContext, eventBus]
34496
34750
  );
34497
- const checkViolations = React136__default.useCallback(
34751
+ const checkViolations = React81__default.useCallback(
34498
34752
  (changedFieldId, newFormData) => {
34499
34753
  if (!violationTriggers.length) return;
34500
34754
  const context = {
@@ -34532,7 +34786,7 @@ var init_Form = __esm({
34532
34786
  processCalculations(name, newFormData);
34533
34787
  checkViolations(name, newFormData);
34534
34788
  };
34535
- const isFieldVisible = React136__default.useCallback(
34789
+ const isFieldVisible = React81__default.useCallback(
34536
34790
  (fieldName) => {
34537
34791
  const condition = conditionalFields[fieldName];
34538
34792
  if (!condition) return true;
@@ -34540,7 +34794,7 @@ var init_Form = __esm({
34540
34794
  },
34541
34795
  [conditionalFields, evalContext]
34542
34796
  );
34543
- const isSectionVisible = React136__default.useCallback(
34797
+ const isSectionVisible = React81__default.useCallback(
34544
34798
  (section) => {
34545
34799
  if (!section.condition) return true;
34546
34800
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -34616,7 +34870,7 @@ var init_Form = __esm({
34616
34870
  eventBus.emit(`UI:${onCancel}`);
34617
34871
  }
34618
34872
  };
34619
- const renderField = React136__default.useCallback(
34873
+ const renderField = React81__default.useCallback(
34620
34874
  (field) => {
34621
34875
  const fieldName = field.name || field.field;
34622
34876
  if (!fieldName) return null;
@@ -34637,7 +34891,7 @@ var init_Form = __esm({
34637
34891
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
34638
34892
  );
34639
34893
  const effectiveFields = entityDerivedFields ?? fields;
34640
- const normalizedFields = React136__default.useMemo(() => {
34894
+ const normalizedFields = React81__default.useMemo(() => {
34641
34895
  if (!effectiveFields || effectiveFields.length === 0) return [];
34642
34896
  return effectiveFields.map((field) => {
34643
34897
  if (typeof field === "string") {
@@ -34659,7 +34913,7 @@ var init_Form = __esm({
34659
34913
  return field;
34660
34914
  });
34661
34915
  }, [effectiveFields, resolvedEntity]);
34662
- const schemaFields = React136__default.useMemo(() => {
34916
+ const schemaFields = React81__default.useMemo(() => {
34663
34917
  if (normalizedFields.length === 0) return null;
34664
34918
  if (isDebugEnabled()) {
34665
34919
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -34669,7 +34923,7 @@ var init_Form = __esm({
34669
34923
  }
34670
34924
  return normalizedFields.map(renderField).filter(Boolean);
34671
34925
  }, [normalizedFields, renderField, entityName, conditionalFields]);
34672
- const sectionElements = React136__default.useMemo(() => {
34926
+ const sectionElements = React81__default.useMemo(() => {
34673
34927
  if (!sections || sections.length === 0) return null;
34674
34928
  return sections.map((section) => {
34675
34929
  if (!isSectionVisible(section)) {
@@ -36395,7 +36649,7 @@ var init_List = __esm({
36395
36649
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
36396
36650
  return [];
36397
36651
  }, [entity]);
36398
- const getItemActions = React136__default.useCallback(
36652
+ const getItemActions = React81__default.useCallback(
36399
36653
  (item) => {
36400
36654
  if (!itemActions) return [];
36401
36655
  if (typeof itemActions === "function") {
@@ -36868,7 +37122,7 @@ var init_MediaGallery = __esm({
36868
37122
  [selectable, selectedItems, selectionEvent, eventBus]
36869
37123
  );
36870
37124
  const entityData = Array.isArray(entity) ? entity : [];
36871
- const items = React136__default.useMemo(() => {
37125
+ const items = React81__default.useMemo(() => {
36872
37126
  if (propItems) return propItems;
36873
37127
  if (entityData.length === 0) return [];
36874
37128
  return entityData.map((record, idx) => ({
@@ -37032,7 +37286,7 @@ var init_MediaGallery = __esm({
37032
37286
  }
37033
37287
  });
37034
37288
  function extractTitle2(children) {
37035
- if (!React136__default.isValidElement(children)) return void 0;
37289
+ if (!React81__default.isValidElement(children)) return void 0;
37036
37290
  const props = children.props;
37037
37291
  if (typeof props.title === "string") {
37038
37292
  return props.title;
@@ -37745,7 +37999,7 @@ var init_PageHeader = __esm({
37745
37999
  info: "bg-info/10 text-info"
37746
38000
  };
37747
38001
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
37748
- 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(React136__default.Fragment, { children: [
38002
+ 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(React81__default.Fragment, { children: [
37749
38003
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
37750
38004
  crumb.href ? /* @__PURE__ */ jsx(
37751
38005
  "a",
@@ -38041,7 +38295,7 @@ var init_debugRegistry = __esm({
38041
38295
  }
38042
38296
  });
38043
38297
  function useDebugData() {
38044
- const [data, setData] = React136.useState(() => ({
38298
+ const [data, setData] = React81.useState(() => ({
38045
38299
  traits: [],
38046
38300
  ticks: [],
38047
38301
  guards: [],
@@ -38055,7 +38309,7 @@ function useDebugData() {
38055
38309
  },
38056
38310
  lastUpdate: Date.now()
38057
38311
  }));
38058
- React136.useEffect(() => {
38312
+ React81.useEffect(() => {
38059
38313
  const updateData = () => {
38060
38314
  setData({
38061
38315
  traits: getAllTraits(),
@@ -38164,12 +38418,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
38164
38418
  return positions;
38165
38419
  }
38166
38420
  function WalkMinimap() {
38167
- const [walkStep, setWalkStep] = React136.useState(null);
38168
- const [traits2, setTraits] = React136.useState([]);
38169
- const [coveredEdges, setCoveredEdges] = React136.useState([]);
38170
- const [completedTraits, setCompletedTraits] = React136.useState(/* @__PURE__ */ new Set());
38171
- const prevTraitRef = React136.useRef(null);
38172
- React136.useEffect(() => {
38421
+ const [walkStep, setWalkStep] = React81.useState(null);
38422
+ const [traits2, setTraits] = React81.useState([]);
38423
+ const [coveredEdges, setCoveredEdges] = React81.useState([]);
38424
+ const [completedTraits, setCompletedTraits] = React81.useState(/* @__PURE__ */ new Set());
38425
+ const prevTraitRef = React81.useRef(null);
38426
+ React81.useEffect(() => {
38173
38427
  const interval = setInterval(() => {
38174
38428
  const w = window;
38175
38429
  const step = w.__orbitalWalkStep;
@@ -38616,15 +38870,15 @@ var init_EntitiesTab = __esm({
38616
38870
  }
38617
38871
  });
38618
38872
  function EventFlowTab({ events: events2 }) {
38619
- const [filter, setFilter] = React136.useState("all");
38620
- const containerRef = React136.useRef(null);
38621
- const [autoScroll, setAutoScroll] = React136.useState(true);
38622
- React136.useEffect(() => {
38873
+ const [filter, setFilter] = React81.useState("all");
38874
+ const containerRef = React81.useRef(null);
38875
+ const [autoScroll, setAutoScroll] = React81.useState(true);
38876
+ React81.useEffect(() => {
38623
38877
  if (autoScroll && containerRef.current) {
38624
38878
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
38625
38879
  }
38626
38880
  }, [events2.length, autoScroll]);
38627
- const filteredEvents = React136.useMemo(() => {
38881
+ const filteredEvents = React81.useMemo(() => {
38628
38882
  if (filter === "all") return events2;
38629
38883
  return events2.filter((e) => e.type === filter);
38630
38884
  }, [events2, filter]);
@@ -38743,7 +38997,7 @@ var init_EventFlowTab = __esm({
38743
38997
  }
38744
38998
  });
38745
38999
  function GuardsPanel({ guards }) {
38746
- const [filter, setFilter] = React136.useState("all");
39000
+ const [filter, setFilter] = React81.useState("all");
38747
39001
  if (guards.length === 0) {
38748
39002
  return /* @__PURE__ */ jsx(
38749
39003
  EmptyState,
@@ -38756,7 +39010,7 @@ function GuardsPanel({ guards }) {
38756
39010
  }
38757
39011
  const passedCount = guards.filter((g) => g.result).length;
38758
39012
  const failedCount = guards.length - passedCount;
38759
- const filteredGuards = React136.useMemo(() => {
39013
+ const filteredGuards = React81.useMemo(() => {
38760
39014
  if (filter === "all") return guards;
38761
39015
  if (filter === "passed") return guards.filter((g) => g.result);
38762
39016
  return guards.filter((g) => !g.result);
@@ -38917,10 +39171,10 @@ function EffectBadge({ effect }) {
38917
39171
  ] });
38918
39172
  }
38919
39173
  function TransitionTimeline({ transitions }) {
38920
- const containerRef = React136.useRef(null);
38921
- const [autoScroll, setAutoScroll] = React136.useState(true);
38922
- const [expandedId, setExpandedId] = React136.useState(null);
38923
- React136.useEffect(() => {
39174
+ const containerRef = React81.useRef(null);
39175
+ const [autoScroll, setAutoScroll] = React81.useState(true);
39176
+ const [expandedId, setExpandedId] = React81.useState(null);
39177
+ React81.useEffect(() => {
38924
39178
  if (autoScroll && containerRef.current) {
38925
39179
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
38926
39180
  }
@@ -39206,9 +39460,9 @@ function getAllEvents(traits2) {
39206
39460
  }
39207
39461
  function EventDispatcherTab({ traits: traits2, schema }) {
39208
39462
  const eventBus = useEventBus();
39209
- const [log12, setLog] = React136.useState([]);
39210
- const prevStatesRef = React136.useRef(/* @__PURE__ */ new Map());
39211
- React136.useEffect(() => {
39463
+ const [log12, setLog] = React81.useState([]);
39464
+ const prevStatesRef = React81.useRef(/* @__PURE__ */ new Map());
39465
+ React81.useEffect(() => {
39212
39466
  for (const trait of traits2) {
39213
39467
  const prev = prevStatesRef.current.get(trait.id);
39214
39468
  if (prev && prev !== trait.currentState) {
@@ -39378,10 +39632,10 @@ function VerifyModePanel({
39378
39632
  serverCount,
39379
39633
  localCount
39380
39634
  }) {
39381
- const [expanded, setExpanded] = React136.useState(true);
39382
- const scrollRef = React136.useRef(null);
39383
- const prevCountRef = React136.useRef(0);
39384
- React136.useEffect(() => {
39635
+ const [expanded, setExpanded] = React81.useState(true);
39636
+ const scrollRef = React81.useRef(null);
39637
+ const prevCountRef = React81.useRef(0);
39638
+ React81.useEffect(() => {
39385
39639
  if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
39386
39640
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
39387
39641
  }
@@ -39447,10 +39701,10 @@ function RuntimeDebugger({
39447
39701
  defaultTab,
39448
39702
  schema
39449
39703
  }) {
39450
- const [isCollapsed, setIsCollapsed] = React136.useState(mode === "verify" ? true : defaultCollapsed);
39451
- const [isVisible, setIsVisible] = React136.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
39704
+ const [isCollapsed, setIsCollapsed] = React81.useState(mode === "verify" ? true : defaultCollapsed);
39705
+ const [isVisible, setIsVisible] = React81.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
39452
39706
  const debugData = useDebugData();
39453
- React136.useEffect(() => {
39707
+ React81.useEffect(() => {
39454
39708
  if (mode === "inline") return;
39455
39709
  return onDebugToggle((enabled) => {
39456
39710
  setIsVisible(enabled);
@@ -39459,7 +39713,7 @@ function RuntimeDebugger({
39459
39713
  }
39460
39714
  });
39461
39715
  }, [mode]);
39462
- React136.useEffect(() => {
39716
+ React81.useEffect(() => {
39463
39717
  if (mode === "inline") return;
39464
39718
  const handleKeyDown = (e) => {
39465
39719
  if (e.key === "`" && isVisible) {
@@ -40008,7 +40262,7 @@ function SequenceBar({
40008
40262
  onSlotRemove(index);
40009
40263
  }, [onSlotRemove, playing]);
40010
40264
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
40011
- return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React136__default.Fragment, { children: [
40265
+ return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
40012
40266
  i > 0 && /* @__PURE__ */ jsx(
40013
40267
  Typography,
40014
40268
  {
@@ -41409,7 +41663,7 @@ var init_StatCard = __esm({
41409
41663
  const labelToUse = propLabel ?? propTitle;
41410
41664
  const eventBus = useEventBus();
41411
41665
  const { t } = useTranslate();
41412
- const handleActionClick = React136__default.useCallback(() => {
41666
+ const handleActionClick = React81__default.useCallback(() => {
41413
41667
  if (action?.event) {
41414
41668
  eventBus.emit(`UI:${action.event}`, {});
41415
41669
  }
@@ -41420,7 +41674,7 @@ var init_StatCard = __esm({
41420
41674
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
41421
41675
  const isLoading = externalLoading ?? false;
41422
41676
  const error = externalError;
41423
- const computeMetricValue = React136__default.useCallback(
41677
+ const computeMetricValue = React81__default.useCallback(
41424
41678
  (metric, items) => {
41425
41679
  if (metric.value !== void 0) {
41426
41680
  return metric.value;
@@ -41459,7 +41713,7 @@ var init_StatCard = __esm({
41459
41713
  },
41460
41714
  []
41461
41715
  );
41462
- const schemaStats = React136__default.useMemo(() => {
41716
+ const schemaStats = React81__default.useMemo(() => {
41463
41717
  if (!metrics || metrics.length === 0) return null;
41464
41718
  return metrics.map((metric) => ({
41465
41719
  label: metric.label,
@@ -41467,7 +41721,7 @@ var init_StatCard = __esm({
41467
41721
  format: metric.format
41468
41722
  }));
41469
41723
  }, [metrics, data, computeMetricValue]);
41470
- const calculatedTrend = React136__default.useMemo(() => {
41724
+ const calculatedTrend = React81__default.useMemo(() => {
41471
41725
  if (manualTrend !== void 0) return manualTrend;
41472
41726
  if (previousValue === void 0 || currentValue === void 0)
41473
41727
  return void 0;
@@ -42603,7 +42857,7 @@ var init_Timeline = __esm({
42603
42857
  }) => {
42604
42858
  const { t } = useTranslate();
42605
42859
  const entityData = Array.isArray(entity) ? entity : [];
42606
- const items = React136__default.useMemo(() => {
42860
+ const items = React81__default.useMemo(() => {
42607
42861
  if (propItems) return propItems;
42608
42862
  if (entityData.length === 0) return [];
42609
42863
  return entityData.map((record, idx) => {
@@ -42710,7 +42964,7 @@ var init_Timeline = __esm({
42710
42964
  }
42711
42965
  });
42712
42966
  function extractToastProps(children) {
42713
- if (!React136__default.isValidElement(children)) {
42967
+ if (!React81__default.isValidElement(children)) {
42714
42968
  if (typeof children === "string") {
42715
42969
  return { message: children };
42716
42970
  }
@@ -42748,7 +43002,7 @@ var init_ToastSlot = __esm({
42748
43002
  eventBus.emit("UI:CLOSE");
42749
43003
  };
42750
43004
  if (!isVisible) return null;
42751
- const isCustomContent = React136__default.isValidElement(children) && !message;
43005
+ const isCustomContent = React81__default.isValidElement(children) && !message;
42752
43006
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
42753
43007
  Toast,
42754
43008
  {
@@ -43017,7 +43271,7 @@ var init_WizardContainer = __esm({
43017
43271
  const isCompleted = index < currentStep;
43018
43272
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
43019
43273
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
43020
- return /* @__PURE__ */ jsxs(React136__default.Fragment, { children: [
43274
+ return /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
43021
43275
  /* @__PURE__ */ jsx(
43022
43276
  Button,
43023
43277
  {
@@ -43399,12 +43653,12 @@ var init_WorldMapTemplate = __esm({
43399
43653
  }
43400
43654
  });
43401
43655
  function lazyThree(name, loader) {
43402
- const Lazy = React136__default.lazy(() => loader().then((m) => ({ default: m[name] })));
43656
+ const Lazy = React81__default.lazy(() => loader().then((m) => ({ default: m[name] })));
43403
43657
  function ThreeWrapper(props) {
43404
- return React136__default.createElement(
43405
- React136__default.Suspense,
43658
+ return React81__default.createElement(
43659
+ React81__default.Suspense,
43406
43660
  { fallback: null },
43407
- React136__default.createElement(Lazy, props)
43661
+ React81__default.createElement(Lazy, props)
43408
43662
  );
43409
43663
  }
43410
43664
  ThreeWrapper.displayName = `Lazy(${name})`;
@@ -44008,7 +44262,7 @@ function SuspenseConfigProvider({
44008
44262
  config,
44009
44263
  children
44010
44264
  }) {
44011
- return React136__default.createElement(
44265
+ return React81__default.createElement(
44012
44266
  SuspenseConfigContext.Provider,
44013
44267
  { value: config },
44014
44268
  children
@@ -44491,7 +44745,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
44491
44745
  const key = `${parentId}-${index}-trait:${traitName}`;
44492
44746
  return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
44493
44747
  }
44494
- return /* @__PURE__ */ jsx(React136__default.Fragment, { children: child }, `${parentId}-${index}`);
44748
+ return /* @__PURE__ */ jsx(React81__default.Fragment, { children: child }, `${parentId}-${index}`);
44495
44749
  }
44496
44750
  if (!child || typeof child !== "object") return null;
44497
44751
  const childId = `${parentId}-${index}`;
@@ -44528,14 +44782,14 @@ function isPatternConfig(value) {
44528
44782
  if (value === null || value === void 0) return false;
44529
44783
  if (typeof value !== "object") return false;
44530
44784
  if (Array.isArray(value)) return false;
44531
- if (React136__default.isValidElement(value)) return false;
44785
+ if (React81__default.isValidElement(value)) return false;
44532
44786
  if (value instanceof Date) return false;
44533
44787
  if (typeof value === "function") return false;
44534
44788
  const record = value;
44535
44789
  return "type" in record && typeof record.type === "string";
44536
44790
  }
44537
44791
  function isPlainConfigObject(value) {
44538
- if (React136__default.isValidElement(value)) return false;
44792
+ if (React81__default.isValidElement(value)) return false;
44539
44793
  if (value instanceof Date) return false;
44540
44794
  const proto = Object.getPrototypeOf(value);
44541
44795
  return proto === Object.prototype || proto === null;