@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 React135 from 'react';
2
- import React135__default, { createContext, useContext, useMemo, useRef, useEffect, useCallback, Suspense, useState, useSyncExternalStore, useLayoutEffect, lazy, useId } from 'react';
1
+ import * as React80 from 'react';
2
+ import React80__default, { createContext, useContext, useMemo, useRef, useEffect, useCallback, Suspense, useState, useSyncExternalStore, useLayoutEffect, lazy, useId } from 'react';
3
3
  import { EventBusContext, useTraitScope, OrbitalProvider, TraitScopeProvider, VerificationProvider } from '@almadar/ui/providers';
4
4
  import { createLogger, isLogLevelEnabled } from '@almadar/logger';
5
5
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -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 { isCircuitEvent, schemaToIR, getPage, clearSchemaCache as clearSchemaCache$1, isEntityCall, 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
  import { StateMachineManager, createContextFromBindings, interpolateValue, collectDeclaredConfigDefaults, createServerEffectHandlers, EffectExecutor, InMemoryPersistence } from '@almadar/runtime';
@@ -968,7 +971,7 @@ var init_Box = __esm({
968
971
  fixed: "fixed",
969
972
  sticky: "sticky"
970
973
  };
971
- Box = React135__default.forwardRef(
974
+ Box = React80__default.forwardRef(
972
975
  ({
973
976
  padding,
974
977
  paddingX,
@@ -1667,7 +1670,7 @@ function resolveIconProp(value, sizeClass) {
1667
1670
  const IconComp = value;
1668
1671
  return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
1669
1672
  }
1670
- if (React135__default.isValidElement(value)) {
1673
+ if (React80__default.isValidElement(value)) {
1671
1674
  return value;
1672
1675
  }
1673
1676
  if (typeof value === "object" && value !== null && "render" in value) {
@@ -1743,7 +1746,7 @@ var init_Button = __esm({
1743
1746
  md: "h-4 w-4",
1744
1747
  lg: "h-5 w-5"
1745
1748
  };
1746
- Button = React135__default.forwardRef(
1749
+ Button = React80__default.forwardRef(
1747
1750
  ({
1748
1751
  className,
1749
1752
  variant = "primary",
@@ -1846,7 +1849,7 @@ var init_Badge = __esm({
1846
1849
  md: "px-2.5 py-1 text-sm",
1847
1850
  lg: "px-3 py-1.5 text-base"
1848
1851
  };
1849
- Badge = React135__default.forwardRef(
1852
+ Badge = React80__default.forwardRef(
1850
1853
  ({ className, variant = "default", size = "sm", amount, label, icon, children, ...props }, ref) => {
1851
1854
  const iconSizes3 = { sm: "w-3 h-3", md: "w-3.5 h-3.5", lg: "w-4 h-4" };
1852
1855
  const resolvedIcon = typeof icon === "string" ? (() => {
@@ -2140,7 +2143,7 @@ var init_SvgFlow = __esm({
2140
2143
  opacity = 1,
2141
2144
  className
2142
2145
  }) => {
2143
- const markerId = React135__default.useMemo(() => {
2146
+ const markerId = React80__default.useMemo(() => {
2144
2147
  flowIdCounter += 1;
2145
2148
  return `almadar-flow-arrow-${flowIdCounter}`;
2146
2149
  }, []);
@@ -2683,7 +2686,7 @@ var init_SvgRing = __esm({
2683
2686
  className,
2684
2687
  label
2685
2688
  }) => {
2686
- const gradientId = React135__default.useMemo(() => {
2689
+ const gradientId = React80__default.useMemo(() => {
2687
2690
  ringIdCounter += 1;
2688
2691
  return `almadar-ring-glow-${ringIdCounter}`;
2689
2692
  }, []);
@@ -2844,7 +2847,7 @@ var Input;
2844
2847
  var init_Input = __esm({
2845
2848
  "components/atoms/Input.tsx"() {
2846
2849
  init_cn();
2847
- Input = React135__default.forwardRef(
2850
+ Input = React80__default.forwardRef(
2848
2851
  ({
2849
2852
  className,
2850
2853
  inputType,
@@ -2962,7 +2965,7 @@ var Label;
2962
2965
  var init_Label = __esm({
2963
2966
  "components/atoms/Label.tsx"() {
2964
2967
  init_cn();
2965
- Label = React135__default.forwardRef(
2968
+ Label = React80__default.forwardRef(
2966
2969
  ({ className, required, children, ...props }, ref) => {
2967
2970
  return /* @__PURE__ */ jsxs(
2968
2971
  "label",
@@ -2988,7 +2991,7 @@ var Textarea;
2988
2991
  var init_Textarea = __esm({
2989
2992
  "components/atoms/Textarea.tsx"() {
2990
2993
  init_cn();
2991
- Textarea = React135__default.forwardRef(
2994
+ Textarea = React80__default.forwardRef(
2992
2995
  ({ className, error, ...props }, ref) => {
2993
2996
  return /* @__PURE__ */ jsx(
2994
2997
  "textarea",
@@ -3017,7 +3020,7 @@ var Select;
3017
3020
  var init_Select = __esm({
3018
3021
  "components/atoms/Select.tsx"() {
3019
3022
  init_cn();
3020
- Select = React135__default.forwardRef(
3023
+ Select = React80__default.forwardRef(
3021
3024
  ({ className, options, placeholder, error, ...props }, ref) => {
3022
3025
  return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
3023
3026
  /* @__PURE__ */ jsxs(
@@ -3059,7 +3062,7 @@ var Checkbox;
3059
3062
  var init_Checkbox = __esm({
3060
3063
  "components/atoms/Checkbox.tsx"() {
3061
3064
  init_cn();
3062
- Checkbox = React135__default.forwardRef(
3065
+ Checkbox = React80__default.forwardRef(
3063
3066
  ({ className, label, id, ...props }, ref) => {
3064
3067
  const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
3065
3068
  return /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
@@ -3141,7 +3144,7 @@ var init_Card = __esm({
3141
3144
  md: "shadow",
3142
3145
  lg: "shadow-lg"
3143
3146
  };
3144
- Card = React135__default.forwardRef(
3147
+ Card = React80__default.forwardRef(
3145
3148
  ({
3146
3149
  className,
3147
3150
  variant = "bordered",
@@ -3177,9 +3180,9 @@ var init_Card = __esm({
3177
3180
  }
3178
3181
  );
3179
3182
  Card.displayName = "Card";
3180
- CardHeader = React135__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
3183
+ CardHeader = React80__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
3181
3184
  CardHeader.displayName = "CardHeader";
3182
- CardTitle = React135__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3185
+ CardTitle = React80__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3183
3186
  "h3",
3184
3187
  {
3185
3188
  ref,
@@ -3192,11 +3195,11 @@ var init_Card = __esm({
3192
3195
  }
3193
3196
  ));
3194
3197
  CardTitle.displayName = "CardTitle";
3195
- CardContent = React135__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
3198
+ CardContent = React80__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
3196
3199
  CardContent.displayName = "CardContent";
3197
3200
  CardBody = CardContent;
3198
3201
  CardBody.displayName = "CardBody";
3199
- CardFooter = React135__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3202
+ CardFooter = React80__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3200
3203
  "div",
3201
3204
  {
3202
3205
  ref,
@@ -3251,7 +3254,7 @@ var init_FilterPill = __esm({
3251
3254
  md: "w-3.5 h-3.5",
3252
3255
  lg: "w-4 h-4"
3253
3256
  };
3254
- FilterPill = React135__default.forwardRef(
3257
+ FilterPill = React80__default.forwardRef(
3255
3258
  ({
3256
3259
  className,
3257
3260
  variant = "default",
@@ -3330,7 +3333,7 @@ var init_Spinner = __esm({
3330
3333
  md: "h-6 w-6",
3331
3334
  lg: "h-8 w-8"
3332
3335
  };
3333
- Spinner = React135__default.forwardRef(
3336
+ Spinner = React80__default.forwardRef(
3334
3337
  ({ className, size = "md", ...props }, ref) => {
3335
3338
  return /* @__PURE__ */ jsx(
3336
3339
  "div",
@@ -3778,7 +3781,7 @@ var Radio;
3778
3781
  var init_Radio = __esm({
3779
3782
  "components/atoms/Radio.tsx"() {
3780
3783
  init_cn();
3781
- Radio = React135__default.forwardRef(
3784
+ Radio = React80__default.forwardRef(
3782
3785
  ({
3783
3786
  label,
3784
3787
  helperText,
@@ -3889,7 +3892,7 @@ var init_Switch = __esm({
3889
3892
  "components/atoms/Switch.tsx"() {
3890
3893
  "use client";
3891
3894
  init_cn();
3892
- Switch = React135.forwardRef(
3895
+ Switch = React80.forwardRef(
3893
3896
  ({
3894
3897
  checked,
3895
3898
  defaultChecked = false,
@@ -3900,10 +3903,10 @@ var init_Switch = __esm({
3900
3903
  name,
3901
3904
  className
3902
3905
  }, ref) => {
3903
- const [isChecked, setIsChecked] = React135.useState(
3906
+ const [isChecked, setIsChecked] = React80.useState(
3904
3907
  checked !== void 0 ? checked : defaultChecked
3905
3908
  );
3906
- React135.useEffect(() => {
3909
+ React80.useEffect(() => {
3907
3910
  if (checked !== void 0) {
3908
3911
  setIsChecked(checked);
3909
3912
  }
@@ -4449,8 +4452,8 @@ var init_LawReferenceTooltip = __esm({
4449
4452
  position = "top",
4450
4453
  className
4451
4454
  }) => {
4452
- const [isVisible, setIsVisible] = React135__default.useState(false);
4453
- const timeoutRef = React135__default.useRef(null);
4455
+ const [isVisible, setIsVisible] = React80__default.useState(false);
4456
+ const timeoutRef = React80__default.useRef(null);
4454
4457
  const handleMouseEnter = () => {
4455
4458
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4456
4459
  timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
@@ -4459,7 +4462,7 @@ var init_LawReferenceTooltip = __esm({
4459
4462
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4460
4463
  setIsVisible(false);
4461
4464
  };
4462
- React135__default.useEffect(() => {
4465
+ React80__default.useEffect(() => {
4463
4466
  return () => {
4464
4467
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4465
4468
  };
@@ -4669,7 +4672,7 @@ var init_StatusDot = __esm({
4669
4672
  md: "w-2.5 h-2.5",
4670
4673
  lg: "w-3 h-3"
4671
4674
  };
4672
- StatusDot = React135__default.forwardRef(
4675
+ StatusDot = React80__default.forwardRef(
4673
4676
  ({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
4674
4677
  return /* @__PURE__ */ jsx(
4675
4678
  "span",
@@ -4722,7 +4725,7 @@ var init_TrendIndicator = __esm({
4722
4725
  down: TrendingDown,
4723
4726
  flat: ArrowRight
4724
4727
  };
4725
- TrendIndicator = React135__default.forwardRef(
4728
+ TrendIndicator = React80__default.forwardRef(
4726
4729
  ({
4727
4730
  className,
4728
4731
  value,
@@ -4789,7 +4792,7 @@ var init_RangeSlider = __esm({
4789
4792
  md: "w-4 h-4",
4790
4793
  lg: "w-5 h-5"
4791
4794
  };
4792
- RangeSlider = React135__default.forwardRef(
4795
+ RangeSlider = React80__default.forwardRef(
4793
4796
  ({
4794
4797
  className,
4795
4798
  min = 0,
@@ -5322,7 +5325,7 @@ var init_ContentSection = __esm({
5322
5325
  md: "py-16",
5323
5326
  lg: "py-24"
5324
5327
  };
5325
- ContentSection = React135__default.forwardRef(
5328
+ ContentSection = React80__default.forwardRef(
5326
5329
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
5327
5330
  return /* @__PURE__ */ jsx(
5328
5331
  Box,
@@ -5856,7 +5859,7 @@ var init_AnimatedReveal = __esm({
5856
5859
  "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
5857
5860
  "none": {}
5858
5861
  };
5859
- AnimatedReveal = React135__default.forwardRef(
5862
+ AnimatedReveal = React80__default.forwardRef(
5860
5863
  ({
5861
5864
  trigger = "scroll",
5862
5865
  animation = "fade-up",
@@ -6016,7 +6019,7 @@ var init_AnimatedGraphic = __esm({
6016
6019
  "components/atoms/AnimatedGraphic.tsx"() {
6017
6020
  "use client";
6018
6021
  init_cn();
6019
- AnimatedGraphic = React135__default.forwardRef(
6022
+ AnimatedGraphic = React80__default.forwardRef(
6020
6023
  ({
6021
6024
  src,
6022
6025
  svgContent,
@@ -6039,7 +6042,7 @@ var init_AnimatedGraphic = __esm({
6039
6042
  const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
6040
6043
  const resolvedSvg = svgContent ?? fetchedSvg;
6041
6044
  const prevAnimateRef = useRef(animate);
6042
- const setRef = React135__default.useCallback(
6045
+ const setRef = React80__default.useCallback(
6043
6046
  (node) => {
6044
6047
  containerRef.current = node;
6045
6048
  if (typeof ref === "function") ref(node);
@@ -6264,9 +6267,9 @@ function ScoreDisplay({
6264
6267
  ...rest
6265
6268
  }) {
6266
6269
  const resolvedValue = typeof value === "number" && !Number.isNaN(value) ? value : typeof rest.score === "number" && !Number.isNaN(rest.score) ? rest.score : 0;
6267
- const [displayValue, setDisplayValue] = React135.useState(resolvedValue);
6268
- const [isAnimating, setIsAnimating] = React135.useState(false);
6269
- React135.useEffect(() => {
6270
+ const [displayValue, setDisplayValue] = React80.useState(resolvedValue);
6271
+ const [isAnimating, setIsAnimating] = React80.useState(false);
6272
+ React80.useEffect(() => {
6270
6273
  if (!animated || displayValue === resolvedValue) {
6271
6274
  setDisplayValue(resolvedValue);
6272
6275
  return;
@@ -6336,9 +6339,9 @@ function ControlButton({
6336
6339
  className
6337
6340
  }) {
6338
6341
  const eventBus = useEventBus();
6339
- const [isPressed, setIsPressed] = React135.useState(false);
6342
+ const [isPressed, setIsPressed] = React80.useState(false);
6340
6343
  const actualPressed = pressed ?? isPressed;
6341
- const handlePointerDown = React135.useCallback(
6344
+ const handlePointerDown = React80.useCallback(
6342
6345
  (e) => {
6343
6346
  e.preventDefault();
6344
6347
  if (disabled) return;
@@ -6348,7 +6351,7 @@ function ControlButton({
6348
6351
  },
6349
6352
  [disabled, pressEvent, eventBus, onPress]
6350
6353
  );
6351
- const handlePointerUp = React135.useCallback(
6354
+ const handlePointerUp = React80.useCallback(
6352
6355
  (e) => {
6353
6356
  e.preventDefault();
6354
6357
  if (disabled) return;
@@ -6358,7 +6361,7 @@ function ControlButton({
6358
6361
  },
6359
6362
  [disabled, releaseEvent, eventBus, onRelease]
6360
6363
  );
6361
- const handlePointerLeave = React135.useCallback(
6364
+ const handlePointerLeave = React80.useCallback(
6362
6365
  (e) => {
6363
6366
  if (isPressed) {
6364
6367
  setIsPressed(false);
@@ -7264,9 +7267,9 @@ function MiniMap({
7264
7267
  viewportRect,
7265
7268
  className
7266
7269
  }) {
7267
- const canvasRef = React135.useRef(null);
7268
- const frameRef = React135.useRef(0);
7269
- React135.useEffect(() => {
7270
+ const canvasRef = React80.useRef(null);
7271
+ const frameRef = React80.useRef(0);
7272
+ React80.useEffect(() => {
7270
7273
  const canvas = canvasRef.current;
7271
7274
  if (!canvas) return;
7272
7275
  const ctx = canvas.getContext("2d");
@@ -7429,7 +7432,7 @@ var init_ErrorBoundary = __esm({
7429
7432
  "use client";
7430
7433
  init_cn();
7431
7434
  init_ErrorState();
7432
- ErrorBoundary = class extends React135__default.Component {
7435
+ ErrorBoundary = class extends React80__default.Component {
7433
7436
  constructor(props) {
7434
7437
  super(props);
7435
7438
  __publicField(this, "reset", () => {
@@ -8504,8 +8507,8 @@ var init_Tooltip = __esm({
8504
8507
  if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
8505
8508
  };
8506
8509
  }, []);
8507
- const triggerElement = React135__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
8508
- const trigger = React135__default.cloneElement(triggerElement, {
8510
+ const triggerElement = React80__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
8511
+ const trigger = React80__default.cloneElement(triggerElement, {
8509
8512
  ref: triggerRef,
8510
8513
  onMouseEnter: handleMouseEnter,
8511
8514
  onMouseLeave: handleMouseLeave,
@@ -8626,8 +8629,8 @@ var init_Popover = __esm({
8626
8629
  onMouseEnter: handleOpen,
8627
8630
  onMouseLeave: handleClose
8628
8631
  };
8629
- const childElement = React135__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
8630
- const triggerElement = React135__default.cloneElement(
8632
+ const childElement = React80__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
8633
+ const triggerElement = React80__default.cloneElement(
8631
8634
  childElement,
8632
8635
  {
8633
8636
  ref: triggerRef,
@@ -8744,8 +8747,8 @@ var init_Menu = __esm({
8744
8747
  "bottom-start": "top-full left-0 mt-2",
8745
8748
  "bottom-end": "top-full right-0 mt-2"
8746
8749
  };
8747
- const triggerChild = React135__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx("span", { children: trigger });
8748
- const triggerElement = React135__default.cloneElement(
8750
+ const triggerChild = React80__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx("span", { children: trigger });
8751
+ const triggerElement = React80__default.cloneElement(
8749
8752
  triggerChild,
8750
8753
  {
8751
8754
  ref: triggerRef,
@@ -9161,7 +9164,7 @@ var init_MapView = __esm({
9161
9164
  shadowSize: [41, 41]
9162
9165
  });
9163
9166
  L.Marker.prototype.options.icon = defaultIcon;
9164
- const { useEffect: useEffect68, useRef: useRef64, useCallback: useCallback110, useState: useState98 } = React135__default;
9167
+ const { useEffect: useEffect68, useRef: useRef64, useCallback: useCallback110, useState: useState98 } = React80__default;
9165
9168
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
9166
9169
  const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
9167
9170
  function MapUpdater({ centerLat, centerLng, zoom }) {
@@ -9407,7 +9410,7 @@ function InputPattern({
9407
9410
  fieldName
9408
9411
  }) {
9409
9412
  const { emit } = useEventBus();
9410
- const [localValue, setLocalValue] = React135__default.useState(value);
9413
+ const [localValue, setLocalValue] = React80__default.useState(value);
9411
9414
  const handleChange = (e) => {
9412
9415
  setLocalValue(e.target.value);
9413
9416
  if (onChange) {
@@ -9445,7 +9448,7 @@ function TextareaPattern({
9445
9448
  fieldName
9446
9449
  }) {
9447
9450
  const { emit } = useEventBus();
9448
- const [localValue, setLocalValue] = React135__default.useState(value);
9451
+ const [localValue, setLocalValue] = React80__default.useState(value);
9449
9452
  const handleChange = (e) => {
9450
9453
  setLocalValue(e.target.value);
9451
9454
  if (onChange) {
@@ -9477,7 +9480,7 @@ function SelectPattern({
9477
9480
  fieldName
9478
9481
  }) {
9479
9482
  const { emit } = useEventBus();
9480
- const [localValue, setLocalValue] = React135__default.useState(value);
9483
+ const [localValue, setLocalValue] = React80__default.useState(value);
9481
9484
  const handleChange = (e) => {
9482
9485
  setLocalValue(e.target.value);
9483
9486
  if (onChange) {
@@ -9506,7 +9509,7 @@ function CheckboxPattern({
9506
9509
  className
9507
9510
  }) {
9508
9511
  const { emit } = useEventBus();
9509
- const [localChecked, setLocalChecked] = React135__default.useState(checked);
9512
+ const [localChecked, setLocalChecked] = React80__default.useState(checked);
9510
9513
  const handleChange = (e) => {
9511
9514
  setLocalChecked(e.target.checked);
9512
9515
  if (onChange) {
@@ -9737,8 +9740,8 @@ function ActionButtons({
9737
9740
  disabled
9738
9741
  }) {
9739
9742
  const eventBus = useEventBus();
9740
- const [activeButtons, setActiveButtons] = React135.useState(/* @__PURE__ */ new Set());
9741
- const handlePress = React135.useCallback(
9743
+ const [activeButtons, setActiveButtons] = React80.useState(/* @__PURE__ */ new Set());
9744
+ const handlePress = React80.useCallback(
9742
9745
  (id) => {
9743
9746
  setActiveButtons((prev) => new Set(prev).add(id));
9744
9747
  if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
@@ -9746,7 +9749,7 @@ function ActionButtons({
9746
9749
  },
9747
9750
  [actionEvent, eventBus, onAction]
9748
9751
  );
9749
- const handleRelease = React135.useCallback(
9752
+ const handleRelease = React80.useCallback(
9750
9753
  (id) => {
9751
9754
  setActiveButtons((prev) => {
9752
9755
  const next = new Set(prev);
@@ -12609,7 +12612,7 @@ var init_MarkdownContent = __esm({
12609
12612
  init_Box();
12610
12613
  init_useTranslate();
12611
12614
  init_cn();
12612
- MarkdownContent = React135__default.memo(
12615
+ MarkdownContent = React80__default.memo(
12613
12616
  ({ content, direction, className }) => {
12614
12617
  const { t: _t } = useTranslate();
12615
12618
  const safeContent = typeof content === "string" ? content : String(content ?? "");
@@ -12827,7 +12830,7 @@ var init_CodeBlock = __esm({
12827
12830
  log7 = createLogger("almadar:ui:markdown-code");
12828
12831
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
12829
12832
  HIDDEN_LINE_NUMBERS = { display: "none" };
12830
- CodeBlock = React135__default.memo(
12833
+ CodeBlock = React80__default.memo(
12831
12834
  ({
12832
12835
  code: rawCode,
12833
12836
  language = "text",
@@ -14086,7 +14089,7 @@ var init_StateMachineView = __esm({
14086
14089
  style: { top: title ? 30 : 0 },
14087
14090
  children: [
14088
14091
  entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
14089
- states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React135__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
14092
+ states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React80__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
14090
14093
  StateNode,
14091
14094
  {
14092
14095
  state,
@@ -20463,7 +20466,7 @@ function CraftingRecipe({
20463
20466
  className
20464
20467
  }) {
20465
20468
  const eventBus = useEventBus();
20466
- const handleCraft = React135.useCallback(() => {
20469
+ const handleCraft = React80.useCallback(() => {
20467
20470
  onCraft?.();
20468
20471
  if (craftEvent) {
20469
20472
  eventBus.emit(craftEvent, { output: output.label });
@@ -20480,7 +20483,7 @@ function CraftingRecipe({
20480
20483
  children: [
20481
20484
  /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap items-center", children: inputs.map((ingredient, index) => {
20482
20485
  const hasSufficient = ingredient.available >= ingredient.required;
20483
- return /* @__PURE__ */ jsxs(React135.Fragment, { children: [
20486
+ return /* @__PURE__ */ jsxs(React80.Fragment, { children: [
20484
20487
  /* @__PURE__ */ jsx(Box, { className: "relative", children: /* @__PURE__ */ jsx(
20485
20488
  ItemSlot,
20486
20489
  {
@@ -20543,8 +20546,8 @@ function DPad({
20543
20546
  }) {
20544
20547
  const eventBus = useEventBus();
20545
20548
  const sizes = sizeMap15[size];
20546
- const [activeDirections, setActiveDirections] = React135.useState(/* @__PURE__ */ new Set());
20547
- const handlePress = React135.useCallback(
20549
+ const [activeDirections, setActiveDirections] = React80.useState(/* @__PURE__ */ new Set());
20550
+ const handlePress = React80.useCallback(
20548
20551
  (direction) => {
20549
20552
  setActiveDirections((prev) => new Set(prev).add(direction));
20550
20553
  if (directionEvent) eventBus.emit(`UI:${directionEvent}`, { direction, pressed: true });
@@ -20552,7 +20555,7 @@ function DPad({
20552
20555
  },
20553
20556
  [directionEvent, eventBus, onDirection]
20554
20557
  );
20555
- const handleRelease = React135.useCallback(
20558
+ const handleRelease = React80.useCallback(
20556
20559
  (direction) => {
20557
20560
  setActiveDirections((prev) => {
20558
20561
  const next = new Set(prev);
@@ -21038,6 +21041,199 @@ var init_DashboardLayout = __esm({
21038
21041
  NavLink.displayName = "NavLink";
21039
21042
  }
21040
21043
  });
21044
+ function useDataDnd(args) {
21045
+ const {
21046
+ dragGroup,
21047
+ accepts,
21048
+ sortable,
21049
+ dropEvent,
21050
+ reorderEvent,
21051
+ dndItemIdField = "id",
21052
+ dndRoot,
21053
+ items,
21054
+ layout
21055
+ } = args;
21056
+ const isZone = Boolean(dragGroup || accepts || sortable);
21057
+ const enabled = isZone || Boolean(dndRoot);
21058
+ const eventBus = useEventBus();
21059
+ const parentRoot = React80__default.useContext(RootCtx);
21060
+ const isRoot = enabled && parentRoot === null;
21061
+ const [localOrder, setLocalOrder] = React80__default.useState(null);
21062
+ const orderedItems = localOrder ?? items;
21063
+ React80__default.useEffect(() => {
21064
+ setLocalOrder(null);
21065
+ }, [items]);
21066
+ const itemIds = React80__default.useMemo(
21067
+ () => orderedItems.map((it, idx) => {
21068
+ const raw = it[dndItemIdField];
21069
+ return raw ?? `__idx_${idx}`;
21070
+ }),
21071
+ [orderedItems, dndItemIdField]
21072
+ );
21073
+ const zonesRef = React80__default.useRef(/* @__PURE__ */ new Map());
21074
+ const registerZone = React80__default.useCallback((zoneId2, meta2) => {
21075
+ zonesRef.current.set(zoneId2, meta2);
21076
+ }, []);
21077
+ const unregisterZone = React80__default.useCallback((zoneId2) => {
21078
+ zonesRef.current.delete(zoneId2);
21079
+ }, []);
21080
+ const zoneId = React80__default.useId();
21081
+ const ownGroup = dragGroup ?? accepts ?? zoneId;
21082
+ const meta = React80__default.useMemo(
21083
+ () => ({ group: ownGroup, dropEvent, reorderEvent, itemIds }),
21084
+ [ownGroup, dropEvent, reorderEvent, itemIds]
21085
+ );
21086
+ React80__default.useEffect(() => {
21087
+ const target = isRoot ? null : parentRoot;
21088
+ if (!target) {
21089
+ zonesRef.current.set(zoneId, meta);
21090
+ return () => zonesRef.current.delete(zoneId);
21091
+ }
21092
+ target.registerZone(zoneId, meta);
21093
+ return () => target.unregisterZone(zoneId);
21094
+ }, [parentRoot, isRoot, zoneId, meta]);
21095
+ const sensors = useSensors(
21096
+ useSensor(PointerSensor, { activationConstraint: { distance: 5 } }),
21097
+ useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates })
21098
+ );
21099
+ const findZoneByItem = React80__default.useCallback(
21100
+ (id) => {
21101
+ for (const z of zonesRef.current.values()) {
21102
+ if (z.itemIds.includes(id)) return z;
21103
+ }
21104
+ return void 0;
21105
+ },
21106
+ []
21107
+ );
21108
+ const findZoneByGroup = React80__default.useCallback(
21109
+ (group) => {
21110
+ for (const z of zonesRef.current.values()) {
21111
+ if (z.group === group) return z;
21112
+ }
21113
+ return void 0;
21114
+ },
21115
+ []
21116
+ );
21117
+ const handleDragEnd = React80__default.useCallback(
21118
+ (event) => {
21119
+ const { active, over } = event;
21120
+ if (!over) return;
21121
+ const sourceZone = findZoneByItem(active.id);
21122
+ const overData = over.data?.current;
21123
+ const targetGroup = overData?.dndGroup;
21124
+ if (!sourceZone || !targetGroup) return;
21125
+ const targetZone = findZoneByGroup(targetGroup);
21126
+ if (!targetZone) return;
21127
+ if (sourceZone.group !== targetZone.group) {
21128
+ if (targetZone.dropEvent) {
21129
+ const newIndex2 = targetZone.itemIds.indexOf(over.id);
21130
+ eventBus.emit(targetZone.dropEvent, {
21131
+ id: String(active.id),
21132
+ sourceGroup: sourceZone.group,
21133
+ targetGroup: targetZone.group,
21134
+ newIndex: newIndex2 === -1 ? targetZone.itemIds.length : newIndex2
21135
+ });
21136
+ }
21137
+ return;
21138
+ }
21139
+ const oldIndex = sourceZone.itemIds.indexOf(active.id);
21140
+ const newIndex = sourceZone.itemIds.indexOf(over.id);
21141
+ if (oldIndex === -1 || newIndex === -1 || oldIndex === newIndex) return;
21142
+ if (sourceZone.group === ownGroup) {
21143
+ const reordered = arrayMove(orderedItems, oldIndex, newIndex);
21144
+ setLocalOrder(reordered);
21145
+ }
21146
+ if (sourceZone.reorderEvent) {
21147
+ eventBus.emit(sourceZone.reorderEvent, {
21148
+ id: String(active.id),
21149
+ oldIndex,
21150
+ newIndex
21151
+ });
21152
+ }
21153
+ },
21154
+ [orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
21155
+ );
21156
+ const SortableItem = React80__default.useCallback(
21157
+ ({ id, children }) => {
21158
+ const {
21159
+ attributes,
21160
+ listeners: listeners6,
21161
+ setNodeRef,
21162
+ transform,
21163
+ transition,
21164
+ isDragging
21165
+ } = useSortable({ id, data: { dndGroup: ownGroup } });
21166
+ const style = {
21167
+ transform: CSS.Transform.toString(transform),
21168
+ transition,
21169
+ opacity: isDragging ? 0.4 : 1,
21170
+ cursor: enabled ? "grab" : void 0
21171
+ };
21172
+ return /* @__PURE__ */ jsx(
21173
+ Box,
21174
+ {
21175
+ className: "touch-none",
21176
+ ref: setNodeRef,
21177
+ style,
21178
+ ...attributes,
21179
+ ...listeners6,
21180
+ children
21181
+ }
21182
+ );
21183
+ },
21184
+ [ownGroup, enabled]
21185
+ );
21186
+ const DropZoneShell = ({ children }) => {
21187
+ const { setNodeRef, isOver } = useDroppable({
21188
+ id: `dnd-zone-${zoneId}`,
21189
+ data: { dndGroup: ownGroup }
21190
+ });
21191
+ return /* @__PURE__ */ jsx(
21192
+ Box,
21193
+ {
21194
+ ref: setNodeRef,
21195
+ "data-dnd-zone": ownGroup,
21196
+ className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
21197
+ children
21198
+ }
21199
+ );
21200
+ };
21201
+ const rootContextValue = React80__default.useMemo(
21202
+ () => ({ registerZone, unregisterZone }),
21203
+ [registerZone, unregisterZone]
21204
+ );
21205
+ const wrapContainer = React80__default.useCallback(
21206
+ (children) => {
21207
+ if (!enabled) return children;
21208
+ const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
21209
+ if (!isZone) {
21210
+ if (!isRoot) return children;
21211
+ return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, children }) });
21212
+ }
21213
+ const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
21214
+ if (isRoot) {
21215
+ return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, children: inner }) });
21216
+ }
21217
+ return inner;
21218
+ },
21219
+ [enabled, isZone, layout, sensors, handleDragEnd, itemIds, isRoot, rootContextValue]
21220
+ );
21221
+ return {
21222
+ enabled,
21223
+ wrapContainer,
21224
+ SortableItem,
21225
+ orderedItems
21226
+ };
21227
+ }
21228
+ var RootCtx;
21229
+ var init_useDataDnd = __esm({
21230
+ "components/molecules/useDataDnd.tsx"() {
21231
+ "use client";
21232
+ init_useEventBus();
21233
+ init_Box();
21234
+ RootCtx = React80__default.createContext(null);
21235
+ }
21236
+ });
21041
21237
  function fieldLabel2(key) {
21042
21238
  return key.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
21043
21239
  }
@@ -21101,14 +21297,33 @@ function DataGrid({
21101
21297
  hasMore,
21102
21298
  children,
21103
21299
  pageSize = 0,
21104
- renderItem: schemaRenderItem
21300
+ renderItem: schemaRenderItem,
21301
+ dragGroup,
21302
+ accepts,
21303
+ sortable,
21304
+ dropEvent,
21305
+ reorderEvent,
21306
+ dndItemIdField,
21307
+ dndRoot
21105
21308
  }) {
21106
21309
  const eventBus = useEventBus();
21107
21310
  const { t } = useTranslate();
21108
21311
  const [selectedIds, setSelectedIds] = useState(/* @__PURE__ */ new Set());
21109
21312
  const [visibleCount, setVisibleCount] = useState(pageSize || Infinity);
21110
21313
  const fieldDefs = fields ?? columns ?? [];
21111
- const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
21314
+ const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
21315
+ const dnd = useDataDnd({
21316
+ items: allDataRaw,
21317
+ layout: "grid",
21318
+ dragGroup,
21319
+ accepts,
21320
+ sortable,
21321
+ dropEvent,
21322
+ reorderEvent,
21323
+ dndItemIdField,
21324
+ dndRoot
21325
+ });
21326
+ const allData = dnd.orderedItems;
21112
21327
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
21113
21328
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
21114
21329
  const toggleSelection = useCallback((id) => {
@@ -21180,196 +21395,205 @@ function DataGrid({
21180
21395
  const allIds = data.map((item, i) => item.id || String(i));
21181
21396
  const allSelected = allIds.length > 0 && allIds.every((id) => selectedIds.has(id));
21182
21397
  const someSelected = selectedIds.size > 0;
21183
- return /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
21184
- selectable && someSelected && /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "items-center px-2 py-2 bg-muted rounded-sm", children: [
21398
+ const idFieldName = dndItemIdField ?? "id";
21399
+ return dnd.wrapContainer(
21400
+ /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
21401
+ selectable && someSelected && /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "items-center px-2 py-2 bg-muted rounded-sm", children: [
21402
+ /* @__PURE__ */ jsx(
21403
+ "input",
21404
+ {
21405
+ type: "checkbox",
21406
+ checked: allSelected,
21407
+ onChange: toggleAll,
21408
+ className: "w-4 h-4 accent-primary",
21409
+ "aria-label": "Select all"
21410
+ }
21411
+ ),
21412
+ /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "font-semibold", children: [
21413
+ selectedIds.size,
21414
+ " ",
21415
+ t("common.selected") || "selected"
21416
+ ] })
21417
+ ] }),
21185
21418
  /* @__PURE__ */ jsx(
21186
- "input",
21419
+ Box,
21187
21420
  {
21188
- type: "checkbox",
21189
- checked: allSelected,
21190
- onChange: toggleAll,
21191
- className: "w-4 h-4 accent-primary",
21192
- "aria-label": "Select all"
21193
- }
21194
- ),
21195
- /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "font-semibold", children: [
21196
- selectedIds.size,
21197
- " ",
21198
- t("common.selected") || "selected"
21199
- ] })
21200
- ] }),
21201
- /* @__PURE__ */ jsx(
21202
- Box,
21203
- {
21204
- className: cn("grid", gapStyles6[gap], colsClass, className),
21205
- style: gridTemplateColumns ? { gridTemplateColumns } : void 0,
21206
- children: data.map((item, index) => {
21207
- const itemData = item;
21208
- const id = itemData.id || String(index);
21209
- const isSelected = selectedIds.has(id);
21210
- if (hasRenderProp) {
21211
- return /* @__PURE__ */ jsx(
21212
- Box,
21213
- {
21214
- "data-entity-row": true,
21215
- "data-entity-id": id,
21216
- className: cn(isSelected && "ring-2 ring-primary rounded-lg"),
21217
- children: children(itemData, index)
21218
- },
21219
- id
21220
- );
21221
- }
21222
- const titleValue = getNestedValue(itemData, titleField?.name ?? "");
21223
- return /* @__PURE__ */ jsxs(
21224
- Box,
21225
- {
21226
- "data-entity-row": true,
21227
- "data-entity-id": id,
21228
- className: cn(
21229
- "bg-card rounded-lg",
21230
- "border border-border",
21231
- "shadow-sm hover:shadow-lg",
21232
- "hover:border-primary transition-all",
21233
- "flex flex-col",
21234
- isSelected && "ring-2 ring-primary border-primary"
21235
- ),
21236
- children: [
21237
- imageField && (() => {
21238
- const imgUrl = getNestedValue(itemData, imageField);
21239
- if (!imgUrl || typeof imgUrl !== "string") return null;
21240
- return /* @__PURE__ */ jsx(Box, { className: "w-full aspect-video overflow-hidden rounded-t-lg", children: /* @__PURE__ */ jsx(
21241
- "img",
21242
- {
21243
- src: imgUrl,
21244
- alt: titleValue !== void 0 ? String(titleValue) : "",
21245
- className: "w-full h-full object-cover",
21246
- loading: "lazy"
21247
- }
21248
- ) });
21249
- })(),
21250
- /* @__PURE__ */ jsx(Box, { className: "p-4 pb-0", children: /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-start", children: [
21251
- selectable && /* @__PURE__ */ jsx(
21252
- "input",
21253
- {
21254
- type: "checkbox",
21255
- checked: isSelected,
21256
- onChange: () => toggleSelection(id),
21257
- onClick: (e) => e.stopPropagation(),
21258
- className: "w-4 h-4 mt-1 flex-shrink-0 accent-primary",
21259
- "aria-label": `Select ${titleValue !== void 0 ? String(titleValue) : "item"}`
21260
- }
21421
+ className: cn("grid", gapStyles6[gap], colsClass, className),
21422
+ style: gridTemplateColumns ? { gridTemplateColumns } : void 0,
21423
+ children: data.map((item, index) => {
21424
+ const itemData = item;
21425
+ const id = itemData.id || String(index);
21426
+ const isSelected = selectedIds.has(id);
21427
+ const dndId = itemData[idFieldName] ?? `__idx_${index}`;
21428
+ const wrapDnd = (node) => dnd.enabled ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
21429
+ if (hasRenderProp) {
21430
+ return wrapDnd(
21431
+ /* @__PURE__ */ jsx(
21432
+ Box,
21433
+ {
21434
+ "data-entity-row": true,
21435
+ "data-entity-id": id,
21436
+ className: cn(isSelected && "ring-2 ring-primary rounded-lg"),
21437
+ children: children(itemData, index)
21438
+ },
21439
+ id
21440
+ )
21441
+ );
21442
+ }
21443
+ const titleValue = getNestedValue(itemData, titleField?.name ?? "");
21444
+ return wrapDnd(
21445
+ /* @__PURE__ */ jsxs(
21446
+ Box,
21447
+ {
21448
+ "data-entity-row": true,
21449
+ "data-entity-id": id,
21450
+ className: cn(
21451
+ "bg-card rounded-lg",
21452
+ "border border-border",
21453
+ "shadow-sm hover:shadow-lg",
21454
+ "hover:border-primary transition-all",
21455
+ "flex flex-col",
21456
+ isSelected && "ring-2 ring-primary border-primary"
21261
21457
  ),
21262
- /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: "flex-1 min-w-0", children: [
21263
- titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21264
- titleField?.icon && /* @__PURE__ */ jsx(Icon, { name: titleField.icon, size: "sm", className: "text-primary flex-shrink-0" }),
21265
- /* @__PURE__ */ jsx(
21266
- Typography,
21458
+ children: [
21459
+ imageField && (() => {
21460
+ const imgUrl = getNestedValue(itemData, imageField);
21461
+ if (!imgUrl || typeof imgUrl !== "string") return null;
21462
+ return /* @__PURE__ */ jsx(Box, { className: "w-full aspect-video overflow-hidden rounded-t-lg", children: /* @__PURE__ */ jsx(
21463
+ "img",
21267
21464
  {
21268
- variant: titleField?.variant === "h3" ? "h3" : "h4",
21269
- className: "font-semibold truncate",
21270
- children: String(titleValue)
21465
+ src: imgUrl,
21466
+ alt: titleValue !== void 0 ? String(titleValue) : "",
21467
+ className: "w-full h-full object-cover",
21468
+ loading: "lazy"
21271
21469
  }
21272
- )
21273
- ] }),
21274
- badgeFields.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap", children: badgeFields.map((field) => {
21275
- const val = getNestedValue(itemData, field.name);
21276
- if (val === void 0 || val === null) return null;
21277
- return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21278
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
21279
- /* @__PURE__ */ jsx(Badge, { variant: resolveBadgeVariant(field, String(val)), children: String(val) })
21280
- ] }, field.name);
21281
- }) })
21282
- ] }),
21283
- dangerActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: dangerActions.map((action, idx) => /* @__PURE__ */ jsxs(
21284
- Button,
21285
- {
21286
- variant: "ghost",
21287
- size: "sm",
21288
- onClick: handleActionClick(action, itemData),
21289
- "data-testid": `action-${action.event}`,
21290
- "data-row-id": String(itemData.id),
21291
- className: "text-error hover:text-error hover:bg-error/10 px-2",
21292
- children: [
21293
- action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs" }),
21294
- action.label
21295
- ]
21296
- },
21297
- idx
21298
- )) })
21299
- ] }) }),
21300
- bodyFields.length > 0 && /* @__PURE__ */ jsx(Box, { className: "px-4 py-3 flex-1", children: /* @__PURE__ */ jsx(VStack, { gap: "xs", children: bodyFields.map((field) => {
21301
- const value = getNestedValue(itemData, field.name);
21302
- if (value === void 0 || value === null || value === "") return null;
21303
- if (field.format === "boolean") {
21304
- return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-center", children: [
21305
- /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21306
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21307
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
21470
+ ) });
21471
+ })(),
21472
+ /* @__PURE__ */ jsx(Box, { className: "p-4 pb-0", children: /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-start", children: [
21473
+ selectable && /* @__PURE__ */ jsx(
21474
+ "input",
21475
+ {
21476
+ type: "checkbox",
21477
+ checked: isSelected,
21478
+ onChange: () => toggleSelection(id),
21479
+ onClick: (e) => e.stopPropagation(),
21480
+ className: "w-4 h-4 mt-1 flex-shrink-0 accent-primary",
21481
+ "aria-label": `Select ${titleValue !== void 0 ? String(titleValue) : "item"}`
21482
+ }
21483
+ ),
21484
+ /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: "flex-1 min-w-0", children: [
21485
+ titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21486
+ titleField?.icon && /* @__PURE__ */ jsx(Icon, { name: titleField.icon, size: "sm", className: "text-primary flex-shrink-0" }),
21487
+ /* @__PURE__ */ jsx(
21488
+ Typography,
21489
+ {
21490
+ variant: titleField?.variant === "h3" ? "h3" : "h4",
21491
+ className: "font-semibold truncate",
21492
+ children: String(titleValue)
21493
+ }
21494
+ )
21495
+ ] }),
21496
+ badgeFields.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap", children: badgeFields.map((field) => {
21497
+ const val = getNestedValue(itemData, field.name);
21498
+ if (val === void 0 || val === null) return null;
21499
+ return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21500
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
21501
+ /* @__PURE__ */ jsx(Badge, { variant: resolveBadgeVariant(field, String(val)), children: String(val) })
21502
+ ] }, field.name);
21503
+ }) })
21308
21504
  ] }),
21309
- /* @__PURE__ */ jsx(Badge, { variant: value ? "success" : "neutral", children: value ? t("common.yes") || "Yes" : t("common.no") || "No" })
21310
- ] }, field.name);
21311
- }
21312
- return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-center", children: [
21313
- /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21314
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21315
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
21316
- ] }),
21317
- /* @__PURE__ */ jsx(
21318
- Typography,
21319
- {
21320
- variant: field.variant === "caption" ? "caption" : "small",
21321
- className: "text-right truncate max-w-[60%]",
21322
- children: formatValue(value, field.format)
21505
+ dangerActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: dangerActions.map((action, idx) => /* @__PURE__ */ jsxs(
21506
+ Button,
21507
+ {
21508
+ variant: "ghost",
21509
+ size: "sm",
21510
+ onClick: handleActionClick(action, itemData),
21511
+ "data-testid": `action-${action.event}`,
21512
+ "data-row-id": String(itemData.id),
21513
+ className: "text-error hover:text-error hover:bg-error/10 px-2",
21514
+ children: [
21515
+ action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs" }),
21516
+ action.label
21517
+ ]
21518
+ },
21519
+ idx
21520
+ )) })
21521
+ ] }) }),
21522
+ bodyFields.length > 0 && /* @__PURE__ */ jsx(Box, { className: "px-4 py-3 flex-1", children: /* @__PURE__ */ jsx(VStack, { gap: "xs", children: bodyFields.map((field) => {
21523
+ const value = getNestedValue(itemData, field.name);
21524
+ if (value === void 0 || value === null || value === "") return null;
21525
+ if (field.format === "boolean") {
21526
+ return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-center", children: [
21527
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21528
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21529
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
21530
+ ] }),
21531
+ /* @__PURE__ */ jsx(Badge, { variant: value ? "success" : "neutral", children: value ? t("common.yes") || "Yes" : t("common.no") || "No" })
21532
+ ] }, field.name);
21323
21533
  }
21324
- )
21325
- ] }, field.name);
21326
- }) }) }),
21327
- 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(
21328
- Button,
21329
- {
21330
- variant: action.variant === "primary" ? "primary" : "ghost",
21331
- size: "sm",
21332
- onClick: handleActionClick(action, itemData),
21333
- "data-testid": `action-${action.event}`,
21334
- "data-row-id": String(itemData.id),
21335
- children: [
21336
- action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
21337
- action.label
21338
- ]
21339
- },
21340
- idx
21341
- )) }) })
21342
- ]
21343
- },
21344
- id
21345
- );
21346
- })
21347
- }
21348
- ),
21349
- hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
21350
- Button,
21351
- {
21352
- variant: "ghost",
21353
- size: "sm",
21354
- onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
21355
- children: [
21356
- /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
21357
- t("common.showMore"),
21358
- " (",
21359
- allData.length - visibleCount,
21360
- " remaining)"
21361
- ]
21362
- }
21363
- ) }),
21364
- infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
21365
- InfiniteScrollSentinel,
21366
- {
21367
- loadMoreEvent,
21368
- isLoading,
21369
- hasMore
21370
- }
21371
- )
21372
- ] });
21534
+ return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-center", children: [
21535
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21536
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21537
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
21538
+ ] }),
21539
+ /* @__PURE__ */ jsx(
21540
+ Typography,
21541
+ {
21542
+ variant: field.variant === "caption" ? "caption" : "small",
21543
+ className: "text-right truncate max-w-[60%]",
21544
+ children: formatValue(value, field.format)
21545
+ }
21546
+ )
21547
+ ] }, field.name);
21548
+ }) }) }),
21549
+ 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(
21550
+ Button,
21551
+ {
21552
+ variant: action.variant === "primary" ? "primary" : "ghost",
21553
+ size: "sm",
21554
+ onClick: handleActionClick(action, itemData),
21555
+ "data-testid": `action-${action.event}`,
21556
+ "data-row-id": String(itemData.id),
21557
+ children: [
21558
+ action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
21559
+ action.label
21560
+ ]
21561
+ },
21562
+ idx
21563
+ )) }) })
21564
+ ]
21565
+ },
21566
+ id
21567
+ )
21568
+ );
21569
+ })
21570
+ }
21571
+ ),
21572
+ hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
21573
+ Button,
21574
+ {
21575
+ variant: "ghost",
21576
+ size: "sm",
21577
+ onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
21578
+ children: [
21579
+ /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
21580
+ t("common.showMore"),
21581
+ " (",
21582
+ allData.length - visibleCount,
21583
+ " remaining)"
21584
+ ]
21585
+ }
21586
+ ) }),
21587
+ infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
21588
+ InfiniteScrollSentinel,
21589
+ {
21590
+ loadMoreEvent,
21591
+ isLoading,
21592
+ hasMore
21593
+ }
21594
+ )
21595
+ ] })
21596
+ );
21373
21597
  }
21374
21598
  var dataGridLog, BADGE_VARIANTS, gapStyles6;
21375
21599
  var init_DataGrid = __esm({
@@ -21386,6 +21610,7 @@ var init_DataGrid = __esm({
21386
21610
  init_Button();
21387
21611
  init_Icon();
21388
21612
  init_InfiniteScrollSentinel();
21613
+ init_useDataDnd();
21389
21614
  dataGridLog = createLogger("almadar:ui:data-grid");
21390
21615
  BADGE_VARIANTS = /* @__PURE__ */ new Set([
21391
21616
  "default",
@@ -21480,17 +21705,36 @@ function DataList({
21480
21705
  hasMore,
21481
21706
  children,
21482
21707
  pageSize = 5,
21483
- renderItem: schemaRenderItem
21708
+ renderItem: schemaRenderItem,
21709
+ dragGroup,
21710
+ accepts,
21711
+ sortable: sortableProp,
21712
+ dropEvent,
21713
+ reorderEvent: dndReorderEvent,
21714
+ dndItemIdField,
21715
+ dndRoot
21484
21716
  }) {
21485
21717
  const eventBus = useEventBus();
21486
21718
  const { t } = useTranslate();
21487
- const [visibleCount, setVisibleCount] = React135__default.useState(pageSize || Infinity);
21719
+ const [visibleCount, setVisibleCount] = React80__default.useState(pageSize || Infinity);
21488
21720
  const fieldDefs = fields ?? columns ?? [];
21489
- const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
21721
+ const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
21722
+ const dnd = useDataDnd({
21723
+ items: allDataRaw,
21724
+ layout: "list",
21725
+ dragGroup,
21726
+ accepts,
21727
+ sortable: sortableProp,
21728
+ dropEvent,
21729
+ reorderEvent: dndReorderEvent,
21730
+ dndItemIdField,
21731
+ dndRoot
21732
+ });
21733
+ const allData = dnd.orderedItems;
21490
21734
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
21491
21735
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
21492
21736
  const hasRenderProp = typeof children === "function";
21493
- React135__default.useEffect(() => {
21737
+ React80__default.useEffect(() => {
21494
21738
  const renderItemTypeOf = typeof schemaRenderItem;
21495
21739
  const childrenTypeOf = typeof children;
21496
21740
  if (data.length > 0 && !hasRenderProp) {
@@ -21546,7 +21790,7 @@ function DataList({
21546
21790
  const items2 = data.map((item) => item);
21547
21791
  const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
21548
21792
  const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
21549
- return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React135__default.Fragment, { children: [
21793
+ return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React80__default.Fragment, { children: [
21550
21794
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
21551
21795
  group.items.map((itemData, index) => {
21552
21796
  const id = itemData.id || `${gi}-${index}`;
@@ -21594,18 +21838,112 @@ function DataList({
21594
21838
  }
21595
21839
  const items = data.map((item) => item);
21596
21840
  const groups = groupBy ? groupData(items, groupBy) : [{ label: "", items }];
21841
+ const idFieldName = dndItemIdField ?? "id";
21597
21842
  const renderItem = (itemData, index, isLast) => {
21843
+ const dndId = itemData[idFieldName] ?? `__idx_${index}`;
21844
+ const wrapDnd = (node) => dnd.enabled ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
21598
21845
  if (hasRenderProp) {
21599
21846
  const id2 = itemData.id || String(index);
21600
- return /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id2, children: [
21601
- /* @__PURE__ */ jsxs(Box, { className: "group flex items-stretch gap-2", children: [
21602
- /* @__PURE__ */ jsx(Box, { className: "flex-1 min-w-0", children: children(itemData, index) }),
21603
- itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(
21604
- HStack,
21605
- {
21606
- gap: "xs",
21607
- className: "flex-shrink-0",
21608
- children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
21847
+ return wrapDnd(
21848
+ /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id2, children: [
21849
+ /* @__PURE__ */ jsxs(Box, { className: "group flex items-stretch gap-2", children: [
21850
+ /* @__PURE__ */ jsx(Box, { className: "flex-1 min-w-0", children: children(itemData, index) }),
21851
+ itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(
21852
+ HStack,
21853
+ {
21854
+ gap: "xs",
21855
+ className: "flex-shrink-0",
21856
+ children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
21857
+ Button,
21858
+ {
21859
+ variant: action.variant ?? "ghost",
21860
+ size: "sm",
21861
+ onClick: handleActionClick(action, itemData),
21862
+ "data-testid": `action-${action.event}`,
21863
+ "data-row-id": String(itemData.id),
21864
+ className: cn(
21865
+ action.variant === "danger" && "text-error hover:bg-error/10"
21866
+ ),
21867
+ children: [
21868
+ action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
21869
+ action.label
21870
+ ]
21871
+ },
21872
+ idx
21873
+ ))
21874
+ }
21875
+ )
21876
+ ] }),
21877
+ isCard && !isLast && /* @__PURE__ */ jsx(Box, { className: "mx-6 border-b border-border/40" })
21878
+ ] }, id2)
21879
+ );
21880
+ }
21881
+ const id = itemData.id || String(index);
21882
+ const titleValue = getNestedValue(itemData, titleField?.name ?? "");
21883
+ return wrapDnd(
21884
+ /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id, children: [
21885
+ /* @__PURE__ */ jsxs(
21886
+ Box,
21887
+ {
21888
+ className: cn(
21889
+ "group flex items-center gap-4 transition-all duration-200",
21890
+ isCompact ? "px-4 py-2" : "px-6 py-4",
21891
+ "hover:bg-muted/80",
21892
+ !isCard && !isCompact && "rounded-lg border border-transparent hover:border-border"
21893
+ ),
21894
+ children: [
21895
+ /* @__PURE__ */ jsxs(Box, { className: "flex-1 min-w-0", children: [
21896
+ /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "items-center", children: [
21897
+ titleField?.icon && /* @__PURE__ */ jsx(
21898
+ Icon,
21899
+ {
21900
+ name: titleField.icon,
21901
+ size: isCompact ? "xs" : "sm",
21902
+ className: "text-primary flex-shrink-0"
21903
+ }
21904
+ ),
21905
+ titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsx(
21906
+ Typography,
21907
+ {
21908
+ variant: titleField?.variant === "h3" ? "h3" : "h4",
21909
+ className: cn("font-semibold truncate flex-1", isCompact && "text-sm"),
21910
+ children: String(titleValue)
21911
+ }
21912
+ ),
21913
+ badgeFields.map((field) => {
21914
+ const val = getNestedValue(itemData, field.name);
21915
+ if (val === void 0 || val === null) return null;
21916
+ return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center flex-shrink-0", children: [
21917
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
21918
+ /* @__PURE__ */ jsx(Badge, { variant: statusVariant3(String(val)), children: String(val) })
21919
+ ] }, field.name);
21920
+ })
21921
+ ] }),
21922
+ bodyFields.length > 0 && !isCompact && /* @__PURE__ */ jsx(HStack, { gap: "md", className: "mt-1.5 flex-wrap", children: bodyFields.map((field) => {
21923
+ const value = getNestedValue(itemData, field.name);
21924
+ if (value === void 0 || value === null || value === "") return null;
21925
+ return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21926
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21927
+ /* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "secondary", children: [
21928
+ field.label ?? fieldLabel3(field.name),
21929
+ ":"
21930
+ ] }),
21931
+ /* @__PURE__ */ jsx(Typography, { variant: "small", children: formatValue2(value, field.format) })
21932
+ ] }, field.name);
21933
+ }) }),
21934
+ progressFields.map((field) => {
21935
+ const value = getNestedValue(itemData, field.name);
21936
+ if (typeof value !== "number") return null;
21937
+ return /* @__PURE__ */ jsxs(Box, { className: "mt-2 max-w-xs", children: [
21938
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center mb-1", children: [
21939
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21940
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel3(field.name) })
21941
+ ] }),
21942
+ /* @__PURE__ */ jsx(ProgressBar, { value, max: 100 })
21943
+ ] }, field.name);
21944
+ })
21945
+ ] }),
21946
+ itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
21609
21947
  Button,
21610
21948
  {
21611
21949
  variant: action.variant ?? "ghost",
@@ -21622,141 +21960,56 @@ function DataList({
21622
21960
  ]
21623
21961
  },
21624
21962
  idx
21625
- ))
21626
- }
21627
- )
21628
- ] }),
21963
+ )) })
21964
+ ]
21965
+ }
21966
+ ),
21629
21967
  isCard && !isLast && /* @__PURE__ */ jsx(Box, { className: "mx-6 border-b border-border/40" })
21630
- ] }, id2);
21631
- }
21632
- const id = itemData.id || String(index);
21633
- const titleValue = getNestedValue(itemData, titleField?.name ?? "");
21634
- return /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id, children: [
21635
- /* @__PURE__ */ jsxs(
21636
- Box,
21637
- {
21638
- className: cn(
21639
- "group flex items-center gap-4 transition-all duration-200",
21640
- isCompact ? "px-4 py-2" : "px-6 py-4",
21641
- "hover:bg-muted/80",
21642
- !isCard && !isCompact && "rounded-lg border border-transparent hover:border-border"
21643
- ),
21644
- children: [
21645
- /* @__PURE__ */ jsxs(Box, { className: "flex-1 min-w-0", children: [
21646
- /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "items-center", children: [
21647
- titleField?.icon && /* @__PURE__ */ jsx(
21648
- Icon,
21649
- {
21650
- name: titleField.icon,
21651
- size: isCompact ? "xs" : "sm",
21652
- className: "text-primary flex-shrink-0"
21653
- }
21654
- ),
21655
- titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsx(
21656
- Typography,
21657
- {
21658
- variant: titleField?.variant === "h3" ? "h3" : "h4",
21659
- className: cn("font-semibold truncate flex-1", isCompact && "text-sm"),
21660
- children: String(titleValue)
21661
- }
21662
- ),
21663
- badgeFields.map((field) => {
21664
- const val = getNestedValue(itemData, field.name);
21665
- if (val === void 0 || val === null) return null;
21666
- return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center flex-shrink-0", children: [
21667
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
21668
- /* @__PURE__ */ jsx(Badge, { variant: statusVariant3(String(val)), children: String(val) })
21669
- ] }, field.name);
21670
- })
21671
- ] }),
21672
- bodyFields.length > 0 && !isCompact && /* @__PURE__ */ jsx(HStack, { gap: "md", className: "mt-1.5 flex-wrap", children: bodyFields.map((field) => {
21673
- const value = getNestedValue(itemData, field.name);
21674
- if (value === void 0 || value === null || value === "") return null;
21675
- return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21676
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21677
- /* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "secondary", children: [
21678
- field.label ?? fieldLabel3(field.name),
21679
- ":"
21680
- ] }),
21681
- /* @__PURE__ */ jsx(Typography, { variant: "small", children: formatValue2(value, field.format) })
21682
- ] }, field.name);
21683
- }) }),
21684
- progressFields.map((field) => {
21685
- const value = getNestedValue(itemData, field.name);
21686
- if (typeof value !== "number") return null;
21687
- return /* @__PURE__ */ jsxs(Box, { className: "mt-2 max-w-xs", children: [
21688
- /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center mb-1", children: [
21689
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21690
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel3(field.name) })
21691
- ] }),
21692
- /* @__PURE__ */ jsx(ProgressBar, { value, max: 100 })
21693
- ] }, field.name);
21694
- })
21695
- ] }),
21696
- itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
21697
- Button,
21698
- {
21699
- variant: action.variant ?? "ghost",
21700
- size: "sm",
21701
- onClick: handleActionClick(action, itemData),
21702
- "data-testid": `action-${action.event}`,
21703
- "data-row-id": String(itemData.id),
21704
- className: cn(
21705
- action.variant === "danger" && "text-error hover:bg-error/10"
21706
- ),
21707
- children: [
21708
- action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
21709
- action.label
21710
- ]
21711
- },
21712
- idx
21713
- )) })
21714
- ]
21715
- }
21716
- ),
21717
- isCard && !isLast && /* @__PURE__ */ jsx(Box, { className: "mx-6 border-b border-border/40" })
21718
- ] }, id);
21968
+ ] }, id)
21969
+ );
21719
21970
  };
21720
- return /* @__PURE__ */ jsxs(
21721
- Box,
21722
- {
21723
- className: cn(
21724
- isCard && "bg-card rounded-xl border border-border shadow-lg overflow-hidden",
21725
- !isCard && gapClass,
21726
- className
21727
- ),
21728
- children: [
21729
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React135__default.Fragment, { children: [
21730
- group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
21731
- group.items.map(
21732
- (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
21971
+ return dnd.wrapContainer(
21972
+ /* @__PURE__ */ jsxs(
21973
+ Box,
21974
+ {
21975
+ className: cn(
21976
+ isCard && "bg-card rounded-xl border border-border shadow-lg overflow-hidden",
21977
+ !isCard && gapClass,
21978
+ className
21979
+ ),
21980
+ children: [
21981
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React80__default.Fragment, { children: [
21982
+ group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
21983
+ group.items.map(
21984
+ (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
21985
+ )
21986
+ ] }, gi)),
21987
+ hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
21988
+ Button,
21989
+ {
21990
+ variant: "ghost",
21991
+ size: "sm",
21992
+ onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
21993
+ children: [
21994
+ /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
21995
+ t("common.showMore"),
21996
+ " (",
21997
+ allData.length - visibleCount,
21998
+ " remaining)"
21999
+ ]
22000
+ }
22001
+ ) }),
22002
+ infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
22003
+ InfiniteScrollSentinel,
22004
+ {
22005
+ loadMoreEvent,
22006
+ isLoading,
22007
+ hasMore
22008
+ }
21733
22009
  )
21734
- ] }, gi)),
21735
- hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
21736
- Button,
21737
- {
21738
- variant: "ghost",
21739
- size: "sm",
21740
- onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
21741
- children: [
21742
- /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
21743
- t("common.showMore"),
21744
- " (",
21745
- allData.length - visibleCount,
21746
- " remaining)"
21747
- ]
21748
- }
21749
- ) }),
21750
- infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
21751
- InfiniteScrollSentinel,
21752
- {
21753
- loadMoreEvent,
21754
- isLoading,
21755
- hasMore
21756
- }
21757
- )
21758
- ]
21759
- }
22010
+ ]
22011
+ }
22012
+ )
21760
22013
  );
21761
22014
  }
21762
22015
  var dataListLog;
@@ -21776,6 +22029,7 @@ var init_DataList = __esm({
21776
22029
  init_ProgressBar();
21777
22030
  init_Divider();
21778
22031
  init_InfiniteScrollSentinel();
22032
+ init_useDataDnd();
21779
22033
  dataListLog = createLogger("almadar:ui:data-list");
21780
22034
  DataList.displayName = "DataList";
21781
22035
  }
@@ -22962,7 +23216,7 @@ var init_WizardProgress = __esm({
22962
23216
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
22963
23217
  const isActive = index === currentStep;
22964
23218
  const isCompleted = index < currentStep;
22965
- return /* @__PURE__ */ jsxs(React135__default.Fragment, { children: [
23219
+ return /* @__PURE__ */ jsxs(React80__default.Fragment, { children: [
22966
23220
  /* @__PURE__ */ jsx(
22967
23221
  "button",
22968
23222
  {
@@ -23873,7 +24127,7 @@ function InventoryGrid({
23873
24127
  const eventBus = useEventBus();
23874
24128
  const slotCount = totalSlots ?? items.length;
23875
24129
  const emptySlotCount = Math.max(0, slotCount - items.length);
23876
- const handleSelect = React135.useCallback(
24130
+ const handleSelect = React80.useCallback(
23877
24131
  (id) => {
23878
24132
  onSelect?.(id);
23879
24133
  if (selectEvent) {
@@ -24086,15 +24340,15 @@ function GameCanvas2D({
24086
24340
  fps = 60,
24087
24341
  className
24088
24342
  }) {
24089
- const canvasRef = React135.useRef(null);
24090
- const rafRef = React135.useRef(0);
24091
- const frameRef = React135.useRef(0);
24092
- const lastTimeRef = React135.useRef(0);
24093
- const onDrawRef = React135.useRef(onDraw);
24343
+ const canvasRef = React80.useRef(null);
24344
+ const rafRef = React80.useRef(0);
24345
+ const frameRef = React80.useRef(0);
24346
+ const lastTimeRef = React80.useRef(0);
24347
+ const onDrawRef = React80.useRef(onDraw);
24094
24348
  onDrawRef.current = onDraw;
24095
- const onTickRef = React135.useRef(onTick);
24349
+ const onTickRef = React80.useRef(onTick);
24096
24350
  onTickRef.current = onTick;
24097
- React135.useEffect(() => {
24351
+ React80.useEffect(() => {
24098
24352
  const canvas = canvasRef.current;
24099
24353
  if (!canvas) return;
24100
24354
  const ctx = canvas.getContext("2d");
@@ -24383,7 +24637,7 @@ function TurnPanel({
24383
24637
  className
24384
24638
  }) {
24385
24639
  const eventBus = useEventBus();
24386
- const handleAction = React135.useCallback(
24640
+ const handleAction = React80.useCallback(
24387
24641
  (event) => {
24388
24642
  if (event) {
24389
24643
  eventBus.emit(event, { turn: currentTurn, phase, activeTeam });
@@ -24529,7 +24783,7 @@ function UnitCommandBar({
24529
24783
  className
24530
24784
  }) {
24531
24785
  const eventBus = useEventBus();
24532
- const handleCommand = React135.useCallback(
24786
+ const handleCommand = React80.useCallback(
24533
24787
  (event) => {
24534
24788
  if (event) {
24535
24789
  eventBus.emit(event, { unitId: selectedUnitId });
@@ -25014,7 +25268,7 @@ function GameMenu({
25014
25268
  } catch {
25015
25269
  }
25016
25270
  const eventBus = eventBusProp || eventBusFromHook;
25017
- const handleOptionClick = React135.useCallback(
25271
+ const handleOptionClick = React80.useCallback(
25018
25272
  (option) => {
25019
25273
  if (option.event && eventBus) {
25020
25274
  eventBus.emit(`UI:${option.event}`, { option });
@@ -25128,7 +25382,7 @@ function GameOverScreen({
25128
25382
  } catch {
25129
25383
  }
25130
25384
  const eventBus = eventBusProp || eventBusFromHook;
25131
- const handleActionClick = React135.useCallback(
25385
+ const handleActionClick = React80.useCallback(
25132
25386
  (action) => {
25133
25387
  if (action.event && eventBus) {
25134
25388
  eventBus.emit(`UI:${action.event}`, { action });
@@ -27617,7 +27871,7 @@ var init_StepFlow = __esm({
27617
27871
  className
27618
27872
  }) => {
27619
27873
  if (orientation === "vertical") {
27620
- return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React135__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
27874
+ return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React80__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
27621
27875
  /* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
27622
27876
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
27623
27877
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
@@ -27628,7 +27882,7 @@ var init_StepFlow = __esm({
27628
27882
  ] })
27629
27883
  ] }) }, index)) });
27630
27884
  }
27631
- 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(React135__default.Fragment, { children: [
27885
+ 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(React80__default.Fragment, { children: [
27632
27886
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
27633
27887
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
27634
27888
  /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -28510,7 +28764,7 @@ var init_LikertScale = __esm({
28510
28764
  md: "text-base",
28511
28765
  lg: "text-lg"
28512
28766
  };
28513
- LikertScale = React135__default.forwardRef(
28767
+ LikertScale = React80__default.forwardRef(
28514
28768
  ({
28515
28769
  question,
28516
28770
  options = DEFAULT_LIKERT_OPTIONS,
@@ -28522,7 +28776,7 @@ var init_LikertScale = __esm({
28522
28776
  variant = "radios",
28523
28777
  className
28524
28778
  }, ref) => {
28525
- const groupId = React135__default.useId();
28779
+ const groupId = React80__default.useId();
28526
28780
  const eventBus = useEventBus();
28527
28781
  const handleSelect = useCallback(
28528
28782
  (next) => {
@@ -30748,7 +31002,7 @@ var init_DocBreadcrumb = __esm({
30748
31002
  "aria-label": "Breadcrumb",
30749
31003
  children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", wrap: true, children: items.map((item, idx) => {
30750
31004
  const isLast = idx === items.length - 1;
30751
- return /* @__PURE__ */ jsxs(React135__default.Fragment, { children: [
31005
+ return /* @__PURE__ */ jsxs(React80__default.Fragment, { children: [
30752
31006
  idx > 0 && /* @__PURE__ */ jsx(
30753
31007
  Icon,
30754
31008
  {
@@ -31638,7 +31892,7 @@ var init_MiniStateMachine = __esm({
31638
31892
  const x = 2 + i * (NODE_W + GAP + ARROW_W + GAP);
31639
31893
  const tc = transitionCounts[s.name] ?? 0;
31640
31894
  const role = getStateRole(s.name, s.isInitial, s.isTerminal, tc, maxTC);
31641
- return /* @__PURE__ */ jsxs(React135__default.Fragment, { children: [
31895
+ return /* @__PURE__ */ jsxs(React80__default.Fragment, { children: [
31642
31896
  /* @__PURE__ */ jsx(
31643
31897
  AvlState,
31644
31898
  {
@@ -33015,7 +33269,7 @@ var init_DocumentViewer = __esm({
33015
33269
  }
33016
33270
  });
33017
33271
  function extractTitle(children) {
33018
- if (!React135__default.isValidElement(children)) return void 0;
33272
+ if (!React80__default.isValidElement(children)) return void 0;
33019
33273
  const props = children.props;
33020
33274
  if (typeof props.title === "string") {
33021
33275
  return props.title;
@@ -33070,7 +33324,7 @@ function LinearView({
33070
33324
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
33071
33325
  const isDone = i < currentIdx;
33072
33326
  const isCurrent = i === currentIdx;
33073
- return /* @__PURE__ */ jsxs(React135__default.Fragment, { children: [
33327
+ return /* @__PURE__ */ jsxs(React80__default.Fragment, { children: [
33074
33328
  i > 0 && /* @__PURE__ */ jsx(
33075
33329
  Typography,
33076
33330
  {
@@ -33970,12 +34224,12 @@ var init_Form = __esm({
33970
34224
  const isSchemaEntity = isOrbitalEntitySchema(entity);
33971
34225
  const resolvedEntity = isSchemaEntity ? entity : void 0;
33972
34226
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
33973
- const normalizedInitialData = React135__default.useMemo(() => {
34227
+ const normalizedInitialData = React80__default.useMemo(() => {
33974
34228
  const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
33975
34229
  const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
33976
34230
  return entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
33977
34231
  }, [entity, initialData]);
33978
- const entityDerivedFields = React135__default.useMemo(() => {
34232
+ const entityDerivedFields = React80__default.useMemo(() => {
33979
34233
  if (fields && fields.length > 0) return void 0;
33980
34234
  if (!resolvedEntity) return void 0;
33981
34235
  return resolvedEntity.fields.map(
@@ -33994,16 +34248,16 @@ var init_Form = __esm({
33994
34248
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
33995
34249
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
33996
34250
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
33997
- const [formData, setFormData] = React135__default.useState(
34251
+ const [formData, setFormData] = React80__default.useState(
33998
34252
  normalizedInitialData
33999
34253
  );
34000
- const [collapsedSections, setCollapsedSections] = React135__default.useState(
34254
+ const [collapsedSections, setCollapsedSections] = React80__default.useState(
34001
34255
  /* @__PURE__ */ new Set()
34002
34256
  );
34003
- const [submitError, setSubmitError] = React135__default.useState(null);
34004
- const formRef = React135__default.useRef(null);
34257
+ const [submitError, setSubmitError] = React80__default.useState(null);
34258
+ const formRef = React80__default.useRef(null);
34005
34259
  const formMode = props.mode;
34006
- const mountedRef = React135__default.useRef(false);
34260
+ const mountedRef = React80__default.useRef(false);
34007
34261
  if (!mountedRef.current) {
34008
34262
  mountedRef.current = true;
34009
34263
  debug("forms", "mount", {
@@ -34016,7 +34270,7 @@ var init_Form = __esm({
34016
34270
  });
34017
34271
  }
34018
34272
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
34019
- const evalContext = React135__default.useMemo(
34273
+ const evalContext = React80__default.useMemo(
34020
34274
  () => ({
34021
34275
  formValues: formData,
34022
34276
  globalVariables: externalContext?.globalVariables ?? {},
@@ -34025,7 +34279,7 @@ var init_Form = __esm({
34025
34279
  }),
34026
34280
  [formData, externalContext]
34027
34281
  );
34028
- React135__default.useEffect(() => {
34282
+ React80__default.useEffect(() => {
34029
34283
  debug("forms", "initialData-sync", {
34030
34284
  mode: formMode,
34031
34285
  normalizedInitialData,
@@ -34036,7 +34290,7 @@ var init_Form = __esm({
34036
34290
  setFormData(normalizedInitialData);
34037
34291
  }
34038
34292
  }, [normalizedInitialData]);
34039
- const processCalculations = React135__default.useCallback(
34293
+ const processCalculations = React80__default.useCallback(
34040
34294
  (changedFieldId, newFormData) => {
34041
34295
  if (!hiddenCalculations.length) return;
34042
34296
  const context = {
@@ -34061,7 +34315,7 @@ var init_Form = __esm({
34061
34315
  },
34062
34316
  [hiddenCalculations, externalContext, eventBus]
34063
34317
  );
34064
- const checkViolations = React135__default.useCallback(
34318
+ const checkViolations = React80__default.useCallback(
34065
34319
  (changedFieldId, newFormData) => {
34066
34320
  if (!violationTriggers.length) return;
34067
34321
  const context = {
@@ -34099,7 +34353,7 @@ var init_Form = __esm({
34099
34353
  processCalculations(name, newFormData);
34100
34354
  checkViolations(name, newFormData);
34101
34355
  };
34102
- const isFieldVisible = React135__default.useCallback(
34356
+ const isFieldVisible = React80__default.useCallback(
34103
34357
  (fieldName) => {
34104
34358
  const condition = conditionalFields[fieldName];
34105
34359
  if (!condition) return true;
@@ -34107,7 +34361,7 @@ var init_Form = __esm({
34107
34361
  },
34108
34362
  [conditionalFields, evalContext]
34109
34363
  );
34110
- const isSectionVisible = React135__default.useCallback(
34364
+ const isSectionVisible = React80__default.useCallback(
34111
34365
  (section) => {
34112
34366
  if (!section.condition) return true;
34113
34367
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -34183,7 +34437,7 @@ var init_Form = __esm({
34183
34437
  eventBus.emit(`UI:${onCancel}`);
34184
34438
  }
34185
34439
  };
34186
- const renderField = React135__default.useCallback(
34440
+ const renderField = React80__default.useCallback(
34187
34441
  (field) => {
34188
34442
  const fieldName = field.name || field.field;
34189
34443
  if (!fieldName) return null;
@@ -34204,7 +34458,7 @@ var init_Form = __esm({
34204
34458
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
34205
34459
  );
34206
34460
  const effectiveFields = entityDerivedFields ?? fields;
34207
- const normalizedFields = React135__default.useMemo(() => {
34461
+ const normalizedFields = React80__default.useMemo(() => {
34208
34462
  if (!effectiveFields || effectiveFields.length === 0) return [];
34209
34463
  return effectiveFields.map((field) => {
34210
34464
  if (typeof field === "string") {
@@ -34226,7 +34480,7 @@ var init_Form = __esm({
34226
34480
  return field;
34227
34481
  });
34228
34482
  }, [effectiveFields, resolvedEntity]);
34229
- const schemaFields = React135__default.useMemo(() => {
34483
+ const schemaFields = React80__default.useMemo(() => {
34230
34484
  if (normalizedFields.length === 0) return null;
34231
34485
  if (isDebugEnabled()) {
34232
34486
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -34236,7 +34490,7 @@ var init_Form = __esm({
34236
34490
  }
34237
34491
  return normalizedFields.map(renderField).filter(Boolean);
34238
34492
  }, [normalizedFields, renderField, entityName, conditionalFields]);
34239
- const sectionElements = React135__default.useMemo(() => {
34493
+ const sectionElements = React80__default.useMemo(() => {
34240
34494
  if (!sections || sections.length === 0) return null;
34241
34495
  return sections.map((section) => {
34242
34496
  if (!isSectionVisible(section)) {
@@ -35962,7 +36216,7 @@ var init_List = __esm({
35962
36216
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
35963
36217
  return [];
35964
36218
  }, [entity]);
35965
- const getItemActions = React135__default.useCallback(
36219
+ const getItemActions = React80__default.useCallback(
35966
36220
  (item) => {
35967
36221
  if (!itemActions) return [];
35968
36222
  if (typeof itemActions === "function") {
@@ -36435,7 +36689,7 @@ var init_MediaGallery = __esm({
36435
36689
  [selectable, selectedItems, selectionEvent, eventBus]
36436
36690
  );
36437
36691
  const entityData = Array.isArray(entity) ? entity : [];
36438
- const items = React135__default.useMemo(() => {
36692
+ const items = React80__default.useMemo(() => {
36439
36693
  if (propItems) return propItems;
36440
36694
  if (entityData.length === 0) return [];
36441
36695
  return entityData.map((record, idx) => ({
@@ -36599,7 +36853,7 @@ var init_MediaGallery = __esm({
36599
36853
  }
36600
36854
  });
36601
36855
  function extractTitle2(children) {
36602
- if (!React135__default.isValidElement(children)) return void 0;
36856
+ if (!React80__default.isValidElement(children)) return void 0;
36603
36857
  const props = children.props;
36604
36858
  if (typeof props.title === "string") {
36605
36859
  return props.title;
@@ -37312,7 +37566,7 @@ var init_PageHeader = __esm({
37312
37566
  info: "bg-info/10 text-info"
37313
37567
  };
37314
37568
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
37315
- 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(React135__default.Fragment, { children: [
37569
+ 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(React80__default.Fragment, { children: [
37316
37570
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
37317
37571
  crumb.href ? /* @__PURE__ */ jsx(
37318
37572
  "a",
@@ -37627,7 +37881,7 @@ var init_debugRegistry = __esm({
37627
37881
  }
37628
37882
  });
37629
37883
  function useDebugData() {
37630
- const [data, setData] = React135.useState(() => ({
37884
+ const [data, setData] = React80.useState(() => ({
37631
37885
  traits: [],
37632
37886
  ticks: [],
37633
37887
  guards: [],
@@ -37641,7 +37895,7 @@ function useDebugData() {
37641
37895
  },
37642
37896
  lastUpdate: Date.now()
37643
37897
  }));
37644
- React135.useEffect(() => {
37898
+ React80.useEffect(() => {
37645
37899
  const updateData = () => {
37646
37900
  setData({
37647
37901
  traits: getAllTraits(),
@@ -37750,12 +38004,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
37750
38004
  return positions;
37751
38005
  }
37752
38006
  function WalkMinimap() {
37753
- const [walkStep, setWalkStep] = React135.useState(null);
37754
- const [traits2, setTraits] = React135.useState([]);
37755
- const [coveredEdges, setCoveredEdges] = React135.useState([]);
37756
- const [completedTraits, setCompletedTraits] = React135.useState(/* @__PURE__ */ new Set());
37757
- const prevTraitRef = React135.useRef(null);
37758
- React135.useEffect(() => {
38007
+ const [walkStep, setWalkStep] = React80.useState(null);
38008
+ const [traits2, setTraits] = React80.useState([]);
38009
+ const [coveredEdges, setCoveredEdges] = React80.useState([]);
38010
+ const [completedTraits, setCompletedTraits] = React80.useState(/* @__PURE__ */ new Set());
38011
+ const prevTraitRef = React80.useRef(null);
38012
+ React80.useEffect(() => {
37759
38013
  const interval = setInterval(() => {
37760
38014
  const w = window;
37761
38015
  const step = w.__orbitalWalkStep;
@@ -38202,15 +38456,15 @@ var init_EntitiesTab = __esm({
38202
38456
  }
38203
38457
  });
38204
38458
  function EventFlowTab({ events: events2 }) {
38205
- const [filter, setFilter] = React135.useState("all");
38206
- const containerRef = React135.useRef(null);
38207
- const [autoScroll, setAutoScroll] = React135.useState(true);
38208
- React135.useEffect(() => {
38459
+ const [filter, setFilter] = React80.useState("all");
38460
+ const containerRef = React80.useRef(null);
38461
+ const [autoScroll, setAutoScroll] = React80.useState(true);
38462
+ React80.useEffect(() => {
38209
38463
  if (autoScroll && containerRef.current) {
38210
38464
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
38211
38465
  }
38212
38466
  }, [events2.length, autoScroll]);
38213
- const filteredEvents = React135.useMemo(() => {
38467
+ const filteredEvents = React80.useMemo(() => {
38214
38468
  if (filter === "all") return events2;
38215
38469
  return events2.filter((e) => e.type === filter);
38216
38470
  }, [events2, filter]);
@@ -38329,7 +38583,7 @@ var init_EventFlowTab = __esm({
38329
38583
  }
38330
38584
  });
38331
38585
  function GuardsPanel({ guards }) {
38332
- const [filter, setFilter] = React135.useState("all");
38586
+ const [filter, setFilter] = React80.useState("all");
38333
38587
  if (guards.length === 0) {
38334
38588
  return /* @__PURE__ */ jsx(
38335
38589
  EmptyState,
@@ -38342,7 +38596,7 @@ function GuardsPanel({ guards }) {
38342
38596
  }
38343
38597
  const passedCount = guards.filter((g) => g.result).length;
38344
38598
  const failedCount = guards.length - passedCount;
38345
- const filteredGuards = React135.useMemo(() => {
38599
+ const filteredGuards = React80.useMemo(() => {
38346
38600
  if (filter === "all") return guards;
38347
38601
  if (filter === "passed") return guards.filter((g) => g.result);
38348
38602
  return guards.filter((g) => !g.result);
@@ -38503,10 +38757,10 @@ function EffectBadge({ effect }) {
38503
38757
  ] });
38504
38758
  }
38505
38759
  function TransitionTimeline({ transitions }) {
38506
- const containerRef = React135.useRef(null);
38507
- const [autoScroll, setAutoScroll] = React135.useState(true);
38508
- const [expandedId, setExpandedId] = React135.useState(null);
38509
- React135.useEffect(() => {
38760
+ const containerRef = React80.useRef(null);
38761
+ const [autoScroll, setAutoScroll] = React80.useState(true);
38762
+ const [expandedId, setExpandedId] = React80.useState(null);
38763
+ React80.useEffect(() => {
38510
38764
  if (autoScroll && containerRef.current) {
38511
38765
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
38512
38766
  }
@@ -38792,9 +39046,9 @@ function getAllEvents(traits2) {
38792
39046
  }
38793
39047
  function EventDispatcherTab({ traits: traits2, schema }) {
38794
39048
  const eventBus = useEventBus();
38795
- const [log12, setLog] = React135.useState([]);
38796
- const prevStatesRef = React135.useRef(/* @__PURE__ */ new Map());
38797
- React135.useEffect(() => {
39049
+ const [log12, setLog] = React80.useState([]);
39050
+ const prevStatesRef = React80.useRef(/* @__PURE__ */ new Map());
39051
+ React80.useEffect(() => {
38798
39052
  for (const trait of traits2) {
38799
39053
  const prev = prevStatesRef.current.get(trait.id);
38800
39054
  if (prev && prev !== trait.currentState) {
@@ -38964,10 +39218,10 @@ function VerifyModePanel({
38964
39218
  serverCount,
38965
39219
  localCount
38966
39220
  }) {
38967
- const [expanded, setExpanded] = React135.useState(true);
38968
- const scrollRef = React135.useRef(null);
38969
- const prevCountRef = React135.useRef(0);
38970
- React135.useEffect(() => {
39221
+ const [expanded, setExpanded] = React80.useState(true);
39222
+ const scrollRef = React80.useRef(null);
39223
+ const prevCountRef = React80.useRef(0);
39224
+ React80.useEffect(() => {
38971
39225
  if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
38972
39226
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
38973
39227
  }
@@ -39033,10 +39287,10 @@ function RuntimeDebugger({
39033
39287
  defaultTab,
39034
39288
  schema
39035
39289
  }) {
39036
- const [isCollapsed, setIsCollapsed] = React135.useState(mode === "verify" ? true : defaultCollapsed);
39037
- const [isVisible, setIsVisible] = React135.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
39290
+ const [isCollapsed, setIsCollapsed] = React80.useState(mode === "verify" ? true : defaultCollapsed);
39291
+ const [isVisible, setIsVisible] = React80.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
39038
39292
  const debugData = useDebugData();
39039
- React135.useEffect(() => {
39293
+ React80.useEffect(() => {
39040
39294
  if (mode === "inline") return;
39041
39295
  return onDebugToggle((enabled) => {
39042
39296
  setIsVisible(enabled);
@@ -39045,7 +39299,7 @@ function RuntimeDebugger({
39045
39299
  }
39046
39300
  });
39047
39301
  }, [mode]);
39048
- React135.useEffect(() => {
39302
+ React80.useEffect(() => {
39049
39303
  if (mode === "inline") return;
39050
39304
  const handleKeyDown = (e) => {
39051
39305
  if (e.key === "`" && isVisible) {
@@ -39594,7 +39848,7 @@ function SequenceBar({
39594
39848
  onSlotRemove(index);
39595
39849
  }, [onSlotRemove, playing]);
39596
39850
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
39597
- return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React135__default.Fragment, { children: [
39851
+ return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React80__default.Fragment, { children: [
39598
39852
  i > 0 && /* @__PURE__ */ jsx(
39599
39853
  Typography,
39600
39854
  {
@@ -40995,7 +41249,7 @@ var init_StatCard = __esm({
40995
41249
  const labelToUse = propLabel ?? propTitle;
40996
41250
  const eventBus = useEventBus();
40997
41251
  const { t } = useTranslate();
40998
- const handleActionClick = React135__default.useCallback(() => {
41252
+ const handleActionClick = React80__default.useCallback(() => {
40999
41253
  if (action?.event) {
41000
41254
  eventBus.emit(`UI:${action.event}`, {});
41001
41255
  }
@@ -41006,7 +41260,7 @@ var init_StatCard = __esm({
41006
41260
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
41007
41261
  const isLoading = externalLoading ?? false;
41008
41262
  const error = externalError;
41009
- const computeMetricValue = React135__default.useCallback(
41263
+ const computeMetricValue = React80__default.useCallback(
41010
41264
  (metric, items) => {
41011
41265
  if (metric.value !== void 0) {
41012
41266
  return metric.value;
@@ -41045,7 +41299,7 @@ var init_StatCard = __esm({
41045
41299
  },
41046
41300
  []
41047
41301
  );
41048
- const schemaStats = React135__default.useMemo(() => {
41302
+ const schemaStats = React80__default.useMemo(() => {
41049
41303
  if (!metrics || metrics.length === 0) return null;
41050
41304
  return metrics.map((metric) => ({
41051
41305
  label: metric.label,
@@ -41053,7 +41307,7 @@ var init_StatCard = __esm({
41053
41307
  format: metric.format
41054
41308
  }));
41055
41309
  }, [metrics, data, computeMetricValue]);
41056
- const calculatedTrend = React135__default.useMemo(() => {
41310
+ const calculatedTrend = React80__default.useMemo(() => {
41057
41311
  if (manualTrend !== void 0) return manualTrend;
41058
41312
  if (previousValue === void 0 || currentValue === void 0)
41059
41313
  return void 0;
@@ -42189,7 +42443,7 @@ var init_Timeline = __esm({
42189
42443
  }) => {
42190
42444
  const { t } = useTranslate();
42191
42445
  const entityData = Array.isArray(entity) ? entity : [];
42192
- const items = React135__default.useMemo(() => {
42446
+ const items = React80__default.useMemo(() => {
42193
42447
  if (propItems) return propItems;
42194
42448
  if (entityData.length === 0) return [];
42195
42449
  return entityData.map((record, idx) => {
@@ -42296,7 +42550,7 @@ var init_Timeline = __esm({
42296
42550
  }
42297
42551
  });
42298
42552
  function extractToastProps(children) {
42299
- if (!React135__default.isValidElement(children)) {
42553
+ if (!React80__default.isValidElement(children)) {
42300
42554
  if (typeof children === "string") {
42301
42555
  return { message: children };
42302
42556
  }
@@ -42334,7 +42588,7 @@ var init_ToastSlot = __esm({
42334
42588
  eventBus.emit("UI:CLOSE");
42335
42589
  };
42336
42590
  if (!isVisible) return null;
42337
- const isCustomContent = React135__default.isValidElement(children) && !message;
42591
+ const isCustomContent = React80__default.isValidElement(children) && !message;
42338
42592
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
42339
42593
  Toast,
42340
42594
  {
@@ -42603,7 +42857,7 @@ var init_WizardContainer = __esm({
42603
42857
  const isCompleted = index < currentStep;
42604
42858
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
42605
42859
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
42606
- return /* @__PURE__ */ jsxs(React135__default.Fragment, { children: [
42860
+ return /* @__PURE__ */ jsxs(React80__default.Fragment, { children: [
42607
42861
  /* @__PURE__ */ jsx(
42608
42862
  Button,
42609
42863
  {
@@ -42985,12 +43239,12 @@ var init_WorldMapTemplate = __esm({
42985
43239
  }
42986
43240
  });
42987
43241
  function lazyThree(name, loader) {
42988
- const Lazy = React135__default.lazy(() => loader().then((m) => ({ default: m[name] })));
43242
+ const Lazy = React80__default.lazy(() => loader().then((m) => ({ default: m[name] })));
42989
43243
  function ThreeWrapper(props) {
42990
- return React135__default.createElement(
42991
- React135__default.Suspense,
43244
+ return React80__default.createElement(
43245
+ React80__default.Suspense,
42992
43246
  { fallback: null },
42993
- React135__default.createElement(Lazy, props)
43247
+ React80__default.createElement(Lazy, props)
42994
43248
  );
42995
43249
  }
42996
43250
  ThreeWrapper.displayName = `Lazy(${name})`;
@@ -43594,7 +43848,7 @@ function SuspenseConfigProvider({
43594
43848
  config,
43595
43849
  children
43596
43850
  }) {
43597
- return React135__default.createElement(
43851
+ return React80__default.createElement(
43598
43852
  SuspenseConfigContext.Provider,
43599
43853
  { value: config },
43600
43854
  children
@@ -44077,7 +44331,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
44077
44331
  const key = `${parentId}-${index}-trait:${traitName}`;
44078
44332
  return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
44079
44333
  }
44080
- return /* @__PURE__ */ jsx(React135__default.Fragment, { children: child }, `${parentId}-${index}`);
44334
+ return /* @__PURE__ */ jsx(React80__default.Fragment, { children: child }, `${parentId}-${index}`);
44081
44335
  }
44082
44336
  if (!child || typeof child !== "object") return null;
44083
44337
  const childId = `${parentId}-${index}`;
@@ -44114,14 +44368,14 @@ function isPatternConfig(value) {
44114
44368
  if (value === null || value === void 0) return false;
44115
44369
  if (typeof value !== "object") return false;
44116
44370
  if (Array.isArray(value)) return false;
44117
- if (React135__default.isValidElement(value)) return false;
44371
+ if (React80__default.isValidElement(value)) return false;
44118
44372
  if (value instanceof Date) return false;
44119
44373
  if (typeof value === "function") return false;
44120
44374
  const record = value;
44121
44375
  return "type" in record && typeof record.type === "string";
44122
44376
  }
44123
44377
  function isPlainConfigObject(value) {
44124
- if (React135__default.isValidElement(value)) return false;
44378
+ if (React80__default.isValidElement(value)) return false;
44125
44379
  if (value instanceof Date) return false;
44126
44380
  const proto = Object.getPrototypeOf(value);
44127
44381
  return proto === Object.prototype || proto === null;
@@ -44482,7 +44736,7 @@ function resolveLambdaBindings(body, argName, arg) {
44482
44736
  if (Array.isArray(body)) {
44483
44737
  return body.map((b) => resolveLambdaBindings(b, argName, arg));
44484
44738
  }
44485
- if (body !== null && typeof body === "object" && !React135__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
44739
+ if (body !== null && typeof body === "object" && !React80__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
44486
44740
  const out = {};
44487
44741
  for (const [k, v] of Object.entries(body)) {
44488
44742
  out[k] = resolveLambdaBindings(v, argName, arg);
@@ -44501,7 +44755,7 @@ function getSlotContentRenderer2() {
44501
44755
  function makeLambdaFn(argName, lambdaBody, callerKey) {
44502
44756
  return (item, index) => {
44503
44757
  const resolvedBody = resolveLambdaBindings(lambdaBody, argName, item);
44504
- if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React135__default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
44758
+ if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React80__default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
44505
44759
  return null;
44506
44760
  }
44507
44761
  const record = resolvedBody;
@@ -44519,7 +44773,7 @@ function makeLambdaFn(argName, lambdaBody, callerKey) {
44519
44773
  props: childProps,
44520
44774
  priority: 0
44521
44775
  };
44522
- return React135__default.createElement(SlotContentRenderer2, { content: childContent });
44776
+ return React80__default.createElement(SlotContentRenderer2, { content: childContent });
44523
44777
  };
44524
44778
  }
44525
44779
  function convertNode(node, callerKey) {
@@ -44538,7 +44792,7 @@ function convertNode(node, callerKey) {
44538
44792
  });
44539
44793
  return anyChanged ? mapped : node;
44540
44794
  }
44541
- if (typeof node === "object" && !React135__default.isValidElement(node) && !(node instanceof Date)) {
44795
+ if (typeof node === "object" && !React80__default.isValidElement(node) && !(node instanceof Date)) {
44542
44796
  return convertObjectProps(node);
44543
44797
  }
44544
44798
  return node;