@almadar/ui 4.48.0 → 4.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,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,192 @@ 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
+ items,
21053
+ layout
21054
+ } = args;
21055
+ const enabled = Boolean(dragGroup || accepts || sortable);
21056
+ const eventBus = useEventBus();
21057
+ const parentRoot = React80__default.useContext(RootCtx);
21058
+ const isRoot = enabled && parentRoot === null;
21059
+ const [localOrder, setLocalOrder] = React80__default.useState(null);
21060
+ const orderedItems = localOrder ?? items;
21061
+ React80__default.useEffect(() => {
21062
+ setLocalOrder(null);
21063
+ }, [items]);
21064
+ const itemIds = React80__default.useMemo(
21065
+ () => orderedItems.map((it, idx) => {
21066
+ const raw = it[dndItemIdField];
21067
+ return raw ?? `__idx_${idx}`;
21068
+ }),
21069
+ [orderedItems, dndItemIdField]
21070
+ );
21071
+ const zonesRef = React80__default.useRef(/* @__PURE__ */ new Map());
21072
+ const registerZone = React80__default.useCallback((zoneId2, meta2) => {
21073
+ zonesRef.current.set(zoneId2, meta2);
21074
+ }, []);
21075
+ const unregisterZone = React80__default.useCallback((zoneId2) => {
21076
+ zonesRef.current.delete(zoneId2);
21077
+ }, []);
21078
+ const zoneId = React80__default.useId();
21079
+ const ownGroup = dragGroup ?? accepts ?? zoneId;
21080
+ const meta = React80__default.useMemo(
21081
+ () => ({ group: ownGroup, dropEvent, reorderEvent, itemIds }),
21082
+ [ownGroup, dropEvent, reorderEvent, itemIds]
21083
+ );
21084
+ React80__default.useEffect(() => {
21085
+ const target = isRoot ? null : parentRoot;
21086
+ if (!target) {
21087
+ zonesRef.current.set(zoneId, meta);
21088
+ return () => zonesRef.current.delete(zoneId);
21089
+ }
21090
+ target.registerZone(zoneId, meta);
21091
+ return () => target.unregisterZone(zoneId);
21092
+ }, [parentRoot, isRoot, zoneId, meta]);
21093
+ const sensors = useSensors(
21094
+ useSensor(PointerSensor, { activationConstraint: { distance: 5 } }),
21095
+ useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates })
21096
+ );
21097
+ const findZoneByItem = React80__default.useCallback(
21098
+ (id) => {
21099
+ for (const z of zonesRef.current.values()) {
21100
+ if (z.itemIds.includes(id)) return z;
21101
+ }
21102
+ return void 0;
21103
+ },
21104
+ []
21105
+ );
21106
+ const findZoneByGroup = React80__default.useCallback(
21107
+ (group) => {
21108
+ for (const z of zonesRef.current.values()) {
21109
+ if (z.group === group) return z;
21110
+ }
21111
+ return void 0;
21112
+ },
21113
+ []
21114
+ );
21115
+ const handleDragEnd = React80__default.useCallback(
21116
+ (event) => {
21117
+ const { active, over } = event;
21118
+ if (!over) return;
21119
+ const sourceZone = findZoneByItem(active.id);
21120
+ const overData = over.data?.current;
21121
+ const targetGroup = overData?.dndGroup;
21122
+ if (!sourceZone || !targetGroup) return;
21123
+ const targetZone = findZoneByGroup(targetGroup);
21124
+ if (!targetZone) return;
21125
+ if (sourceZone.group !== targetZone.group) {
21126
+ if (targetZone.dropEvent) {
21127
+ const newIndex2 = targetZone.itemIds.indexOf(over.id);
21128
+ eventBus.emit(targetZone.dropEvent, {
21129
+ id: String(active.id),
21130
+ sourceGroup: sourceZone.group,
21131
+ targetGroup: targetZone.group,
21132
+ newIndex: newIndex2 === -1 ? targetZone.itemIds.length : newIndex2
21133
+ });
21134
+ }
21135
+ return;
21136
+ }
21137
+ const oldIndex = sourceZone.itemIds.indexOf(active.id);
21138
+ const newIndex = sourceZone.itemIds.indexOf(over.id);
21139
+ if (oldIndex === -1 || newIndex === -1 || oldIndex === newIndex) return;
21140
+ if (sourceZone.group === ownGroup) {
21141
+ const reordered = arrayMove(orderedItems, oldIndex, newIndex);
21142
+ setLocalOrder(reordered);
21143
+ }
21144
+ if (sourceZone.reorderEvent) {
21145
+ eventBus.emit(sourceZone.reorderEvent, {
21146
+ id: String(active.id),
21147
+ oldIndex,
21148
+ newIndex
21149
+ });
21150
+ }
21151
+ },
21152
+ [orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
21153
+ );
21154
+ const SortableItem = React80__default.useCallback(
21155
+ ({ id, children }) => {
21156
+ const {
21157
+ attributes,
21158
+ listeners: listeners6,
21159
+ setNodeRef,
21160
+ transform,
21161
+ transition,
21162
+ isDragging
21163
+ } = useSortable({ id, data: { dndGroup: ownGroup } });
21164
+ const style = {
21165
+ transform: CSS.Transform.toString(transform),
21166
+ transition,
21167
+ opacity: isDragging ? 0.4 : 1,
21168
+ cursor: enabled ? "grab" : void 0
21169
+ };
21170
+ return /* @__PURE__ */ jsx(
21171
+ Box,
21172
+ {
21173
+ className: "touch-none",
21174
+ ref: setNodeRef,
21175
+ style,
21176
+ ...attributes,
21177
+ ...listeners6,
21178
+ children
21179
+ }
21180
+ );
21181
+ },
21182
+ [ownGroup, enabled]
21183
+ );
21184
+ const DropZoneShell = ({ children }) => {
21185
+ const { setNodeRef, isOver } = useDroppable({
21186
+ id: `dnd-zone-${zoneId}`,
21187
+ data: { dndGroup: ownGroup }
21188
+ });
21189
+ return /* @__PURE__ */ jsx(
21190
+ Box,
21191
+ {
21192
+ ref: setNodeRef,
21193
+ className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg" : void 0,
21194
+ children
21195
+ }
21196
+ );
21197
+ };
21198
+ const rootContextValue = React80__default.useMemo(
21199
+ () => ({ registerZone, unregisterZone }),
21200
+ [registerZone, unregisterZone]
21201
+ );
21202
+ const wrapContainer = React80__default.useCallback(
21203
+ (children) => {
21204
+ if (!enabled) return children;
21205
+ const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
21206
+ const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
21207
+ if (isRoot) {
21208
+ return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, children: inner }) });
21209
+ }
21210
+ return inner;
21211
+ },
21212
+ [enabled, layout, sensors, handleDragEnd, itemIds, isRoot, rootContextValue]
21213
+ );
21214
+ return {
21215
+ enabled,
21216
+ wrapContainer,
21217
+ SortableItem,
21218
+ orderedItems
21219
+ };
21220
+ }
21221
+ var RootCtx;
21222
+ var init_useDataDnd = __esm({
21223
+ "components/molecules/useDataDnd.tsx"() {
21224
+ "use client";
21225
+ init_useEventBus();
21226
+ init_Box();
21227
+ RootCtx = React80__default.createContext(null);
21228
+ }
21229
+ });
21041
21230
  function fieldLabel2(key) {
21042
21231
  return key.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
21043
21232
  }
@@ -21101,14 +21290,31 @@ function DataGrid({
21101
21290
  hasMore,
21102
21291
  children,
21103
21292
  pageSize = 0,
21104
- renderItem: schemaRenderItem
21293
+ renderItem: schemaRenderItem,
21294
+ dragGroup,
21295
+ accepts,
21296
+ sortable,
21297
+ dropEvent,
21298
+ reorderEvent,
21299
+ dndItemIdField
21105
21300
  }) {
21106
21301
  const eventBus = useEventBus();
21107
21302
  const { t } = useTranslate();
21108
21303
  const [selectedIds, setSelectedIds] = useState(/* @__PURE__ */ new Set());
21109
21304
  const [visibleCount, setVisibleCount] = useState(pageSize || Infinity);
21110
21305
  const fieldDefs = fields ?? columns ?? [];
21111
- const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
21306
+ const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
21307
+ const dnd = useDataDnd({
21308
+ items: allDataRaw,
21309
+ layout: "grid",
21310
+ dragGroup,
21311
+ accepts,
21312
+ sortable,
21313
+ dropEvent,
21314
+ reorderEvent,
21315
+ dndItemIdField
21316
+ });
21317
+ const allData = dnd.orderedItems;
21112
21318
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
21113
21319
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
21114
21320
  const toggleSelection = useCallback((id) => {
@@ -21180,203 +21386,205 @@ function DataGrid({
21180
21386
  const allIds = data.map((item, i) => item.id || String(i));
21181
21387
  const allSelected = allIds.length > 0 && allIds.every((id) => selectedIds.has(id));
21182
21388
  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: [
21389
+ const idFieldName = dndItemIdField ?? "id";
21390
+ return dnd.wrapContainer(
21391
+ /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
21392
+ selectable && someSelected && /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "items-center px-2 py-2 bg-muted rounded-sm", children: [
21393
+ /* @__PURE__ */ jsx(
21394
+ "input",
21395
+ {
21396
+ type: "checkbox",
21397
+ checked: allSelected,
21398
+ onChange: toggleAll,
21399
+ className: "w-4 h-4 accent-primary",
21400
+ "aria-label": "Select all"
21401
+ }
21402
+ ),
21403
+ /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "font-semibold", children: [
21404
+ selectedIds.size,
21405
+ " ",
21406
+ t("common.selected") || "selected"
21407
+ ] })
21408
+ ] }),
21185
21409
  /* @__PURE__ */ jsx(
21186
- "input",
21410
+ Box,
21187
21411
  {
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(
21217
- "bg-card rounded-lg",
21218
- "border border-border",
21219
- "shadow-sm hover:shadow-lg",
21220
- "hover:border-primary transition-all",
21221
- "p-4",
21222
- isSelected && "ring-2 ring-primary border-primary"
21223
- ),
21224
- children: children(itemData, index)
21225
- },
21226
- id
21227
- );
21228
- }
21229
- const titleValue = getNestedValue(itemData, titleField?.name ?? "");
21230
- return /* @__PURE__ */ jsxs(
21231
- Box,
21232
- {
21233
- "data-entity-row": true,
21234
- "data-entity-id": id,
21235
- className: cn(
21236
- "bg-card rounded-lg",
21237
- "border border-border",
21238
- "shadow-sm hover:shadow-lg",
21239
- "hover:border-primary transition-all",
21240
- "flex flex-col",
21241
- isSelected && "ring-2 ring-primary border-primary"
21242
- ),
21243
- children: [
21244
- imageField && (() => {
21245
- const imgUrl = getNestedValue(itemData, imageField);
21246
- if (!imgUrl || typeof imgUrl !== "string") return null;
21247
- return /* @__PURE__ */ jsx(Box, { className: "w-full aspect-video overflow-hidden rounded-t-lg", children: /* @__PURE__ */ jsx(
21248
- "img",
21249
- {
21250
- src: imgUrl,
21251
- alt: titleValue !== void 0 ? String(titleValue) : "",
21252
- className: "w-full h-full object-cover",
21253
- loading: "lazy"
21254
- }
21255
- ) });
21256
- })(),
21257
- /* @__PURE__ */ jsx(Box, { className: "p-4 pb-0", children: /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-start", children: [
21258
- selectable && /* @__PURE__ */ jsx(
21259
- "input",
21260
- {
21261
- type: "checkbox",
21262
- checked: isSelected,
21263
- onChange: () => toggleSelection(id),
21264
- onClick: (e) => e.stopPropagation(),
21265
- className: "w-4 h-4 mt-1 flex-shrink-0 accent-primary",
21266
- "aria-label": `Select ${titleValue !== void 0 ? String(titleValue) : "item"}`
21267
- }
21412
+ className: cn("grid", gapStyles6[gap], colsClass, className),
21413
+ style: gridTemplateColumns ? { gridTemplateColumns } : void 0,
21414
+ children: data.map((item, index) => {
21415
+ const itemData = item;
21416
+ const id = itemData.id || String(index);
21417
+ const isSelected = selectedIds.has(id);
21418
+ const dndId = itemData[idFieldName] ?? `__idx_${index}`;
21419
+ const wrapDnd = (node) => dnd.enabled ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
21420
+ if (hasRenderProp) {
21421
+ return wrapDnd(
21422
+ /* @__PURE__ */ jsx(
21423
+ Box,
21424
+ {
21425
+ "data-entity-row": true,
21426
+ "data-entity-id": id,
21427
+ className: cn(isSelected && "ring-2 ring-primary rounded-lg"),
21428
+ children: children(itemData, index)
21429
+ },
21430
+ id
21431
+ )
21432
+ );
21433
+ }
21434
+ const titleValue = getNestedValue(itemData, titleField?.name ?? "");
21435
+ return wrapDnd(
21436
+ /* @__PURE__ */ jsxs(
21437
+ Box,
21438
+ {
21439
+ "data-entity-row": true,
21440
+ "data-entity-id": id,
21441
+ className: cn(
21442
+ "bg-card rounded-lg",
21443
+ "border border-border",
21444
+ "shadow-sm hover:shadow-lg",
21445
+ "hover:border-primary transition-all",
21446
+ "flex flex-col",
21447
+ isSelected && "ring-2 ring-primary border-primary"
21268
21448
  ),
21269
- /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: "flex-1 min-w-0", children: [
21270
- titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21271
- titleField?.icon && /* @__PURE__ */ jsx(Icon, { name: titleField.icon, size: "sm", className: "text-primary flex-shrink-0" }),
21272
- /* @__PURE__ */ jsx(
21273
- Typography,
21449
+ children: [
21450
+ imageField && (() => {
21451
+ const imgUrl = getNestedValue(itemData, imageField);
21452
+ if (!imgUrl || typeof imgUrl !== "string") return null;
21453
+ return /* @__PURE__ */ jsx(Box, { className: "w-full aspect-video overflow-hidden rounded-t-lg", children: /* @__PURE__ */ jsx(
21454
+ "img",
21274
21455
  {
21275
- variant: titleField?.variant === "h3" ? "h3" : "h4",
21276
- className: "font-semibold truncate",
21277
- children: String(titleValue)
21456
+ src: imgUrl,
21457
+ alt: titleValue !== void 0 ? String(titleValue) : "",
21458
+ className: "w-full h-full object-cover",
21459
+ loading: "lazy"
21278
21460
  }
21279
- )
21280
- ] }),
21281
- badgeFields.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap", children: badgeFields.map((field) => {
21282
- const val = getNestedValue(itemData, field.name);
21283
- if (val === void 0 || val === null) return null;
21284
- return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21285
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
21286
- /* @__PURE__ */ jsx(Badge, { variant: resolveBadgeVariant(field, String(val)), children: String(val) })
21287
- ] }, field.name);
21288
- }) })
21289
- ] }),
21290
- dangerActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: dangerActions.map((action, idx) => /* @__PURE__ */ jsxs(
21291
- Button,
21292
- {
21293
- variant: "ghost",
21294
- size: "sm",
21295
- onClick: handleActionClick(action, itemData),
21296
- "data-testid": `action-${action.event}`,
21297
- "data-row-id": String(itemData.id),
21298
- className: "text-error hover:text-error hover:bg-error/10 px-2",
21299
- children: [
21300
- action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs" }),
21301
- action.label
21302
- ]
21303
- },
21304
- idx
21305
- )) })
21306
- ] }) }),
21307
- bodyFields.length > 0 && /* @__PURE__ */ jsx(Box, { className: "px-4 py-3 flex-1", children: /* @__PURE__ */ jsx(VStack, { gap: "xs", children: bodyFields.map((field) => {
21308
- const value = getNestedValue(itemData, field.name);
21309
- if (value === void 0 || value === null || value === "") return null;
21310
- if (field.format === "boolean") {
21311
- return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-center", children: [
21312
- /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21313
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21314
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
21461
+ ) });
21462
+ })(),
21463
+ /* @__PURE__ */ jsx(Box, { className: "p-4 pb-0", children: /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-start", children: [
21464
+ selectable && /* @__PURE__ */ jsx(
21465
+ "input",
21466
+ {
21467
+ type: "checkbox",
21468
+ checked: isSelected,
21469
+ onChange: () => toggleSelection(id),
21470
+ onClick: (e) => e.stopPropagation(),
21471
+ className: "w-4 h-4 mt-1 flex-shrink-0 accent-primary",
21472
+ "aria-label": `Select ${titleValue !== void 0 ? String(titleValue) : "item"}`
21473
+ }
21474
+ ),
21475
+ /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: "flex-1 min-w-0", children: [
21476
+ titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21477
+ titleField?.icon && /* @__PURE__ */ jsx(Icon, { name: titleField.icon, size: "sm", className: "text-primary flex-shrink-0" }),
21478
+ /* @__PURE__ */ jsx(
21479
+ Typography,
21480
+ {
21481
+ variant: titleField?.variant === "h3" ? "h3" : "h4",
21482
+ className: "font-semibold truncate",
21483
+ children: String(titleValue)
21484
+ }
21485
+ )
21486
+ ] }),
21487
+ badgeFields.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap", children: badgeFields.map((field) => {
21488
+ const val = getNestedValue(itemData, field.name);
21489
+ if (val === void 0 || val === null) return null;
21490
+ return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21491
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
21492
+ /* @__PURE__ */ jsx(Badge, { variant: resolveBadgeVariant(field, String(val)), children: String(val) })
21493
+ ] }, field.name);
21494
+ }) })
21315
21495
  ] }),
21316
- /* @__PURE__ */ jsx(Badge, { variant: value ? "success" : "neutral", children: value ? t("common.yes") || "Yes" : t("common.no") || "No" })
21317
- ] }, field.name);
21318
- }
21319
- return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-center", children: [
21320
- /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21321
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21322
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
21323
- ] }),
21324
- /* @__PURE__ */ jsx(
21325
- Typography,
21326
- {
21327
- variant: field.variant === "caption" ? "caption" : "small",
21328
- className: "text-right truncate max-w-[60%]",
21329
- children: formatValue(value, field.format)
21496
+ dangerActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: dangerActions.map((action, idx) => /* @__PURE__ */ jsxs(
21497
+ Button,
21498
+ {
21499
+ variant: "ghost",
21500
+ size: "sm",
21501
+ onClick: handleActionClick(action, itemData),
21502
+ "data-testid": `action-${action.event}`,
21503
+ "data-row-id": String(itemData.id),
21504
+ className: "text-error hover:text-error hover:bg-error/10 px-2",
21505
+ children: [
21506
+ action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs" }),
21507
+ action.label
21508
+ ]
21509
+ },
21510
+ idx
21511
+ )) })
21512
+ ] }) }),
21513
+ bodyFields.length > 0 && /* @__PURE__ */ jsx(Box, { className: "px-4 py-3 flex-1", children: /* @__PURE__ */ jsx(VStack, { gap: "xs", children: bodyFields.map((field) => {
21514
+ const value = getNestedValue(itemData, field.name);
21515
+ if (value === void 0 || value === null || value === "") return null;
21516
+ if (field.format === "boolean") {
21517
+ return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-center", children: [
21518
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21519
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21520
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
21521
+ ] }),
21522
+ /* @__PURE__ */ jsx(Badge, { variant: value ? "success" : "neutral", children: value ? t("common.yes") || "Yes" : t("common.no") || "No" })
21523
+ ] }, field.name);
21330
21524
  }
21331
- )
21332
- ] }, field.name);
21333
- }) }) }),
21334
- 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(
21335
- Button,
21336
- {
21337
- variant: action.variant === "primary" ? "primary" : "ghost",
21338
- size: "sm",
21339
- onClick: handleActionClick(action, itemData),
21340
- "data-testid": `action-${action.event}`,
21341
- "data-row-id": String(itemData.id),
21342
- children: [
21343
- action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
21344
- action.label
21345
- ]
21346
- },
21347
- idx
21348
- )) }) })
21349
- ]
21350
- },
21351
- id
21352
- );
21353
- })
21354
- }
21355
- ),
21356
- hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
21357
- Button,
21358
- {
21359
- variant: "ghost",
21360
- size: "sm",
21361
- onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
21362
- children: [
21363
- /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
21364
- t("common.showMore"),
21365
- " (",
21366
- allData.length - visibleCount,
21367
- " remaining)"
21368
- ]
21369
- }
21370
- ) }),
21371
- infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
21372
- InfiniteScrollSentinel,
21373
- {
21374
- loadMoreEvent,
21375
- isLoading,
21376
- hasMore
21377
- }
21378
- )
21379
- ] });
21525
+ return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-center", children: [
21526
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21527
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21528
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
21529
+ ] }),
21530
+ /* @__PURE__ */ jsx(
21531
+ Typography,
21532
+ {
21533
+ variant: field.variant === "caption" ? "caption" : "small",
21534
+ className: "text-right truncate max-w-[60%]",
21535
+ children: formatValue(value, field.format)
21536
+ }
21537
+ )
21538
+ ] }, field.name);
21539
+ }) }) }),
21540
+ 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(
21541
+ Button,
21542
+ {
21543
+ variant: action.variant === "primary" ? "primary" : "ghost",
21544
+ size: "sm",
21545
+ onClick: handleActionClick(action, itemData),
21546
+ "data-testid": `action-${action.event}`,
21547
+ "data-row-id": String(itemData.id),
21548
+ children: [
21549
+ action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
21550
+ action.label
21551
+ ]
21552
+ },
21553
+ idx
21554
+ )) }) })
21555
+ ]
21556
+ },
21557
+ id
21558
+ )
21559
+ );
21560
+ })
21561
+ }
21562
+ ),
21563
+ hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
21564
+ Button,
21565
+ {
21566
+ variant: "ghost",
21567
+ size: "sm",
21568
+ onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
21569
+ children: [
21570
+ /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
21571
+ t("common.showMore"),
21572
+ " (",
21573
+ allData.length - visibleCount,
21574
+ " remaining)"
21575
+ ]
21576
+ }
21577
+ ) }),
21578
+ infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
21579
+ InfiniteScrollSentinel,
21580
+ {
21581
+ loadMoreEvent,
21582
+ isLoading,
21583
+ hasMore
21584
+ }
21585
+ )
21586
+ ] })
21587
+ );
21380
21588
  }
21381
21589
  var dataGridLog, BADGE_VARIANTS, gapStyles6;
21382
21590
  var init_DataGrid = __esm({
@@ -21393,6 +21601,7 @@ var init_DataGrid = __esm({
21393
21601
  init_Button();
21394
21602
  init_Icon();
21395
21603
  init_InfiniteScrollSentinel();
21604
+ init_useDataDnd();
21396
21605
  dataGridLog = createLogger("almadar:ui:data-grid");
21397
21606
  BADGE_VARIANTS = /* @__PURE__ */ new Set([
21398
21607
  "default",
@@ -21487,17 +21696,34 @@ function DataList({
21487
21696
  hasMore,
21488
21697
  children,
21489
21698
  pageSize = 5,
21490
- renderItem: schemaRenderItem
21699
+ renderItem: schemaRenderItem,
21700
+ dragGroup,
21701
+ accepts,
21702
+ sortable: sortableProp,
21703
+ dropEvent,
21704
+ reorderEvent: dndReorderEvent,
21705
+ dndItemIdField
21491
21706
  }) {
21492
21707
  const eventBus = useEventBus();
21493
21708
  const { t } = useTranslate();
21494
- const [visibleCount, setVisibleCount] = React135__default.useState(pageSize || Infinity);
21709
+ const [visibleCount, setVisibleCount] = React80__default.useState(pageSize || Infinity);
21495
21710
  const fieldDefs = fields ?? columns ?? [];
21496
- const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
21711
+ const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
21712
+ const dnd = useDataDnd({
21713
+ items: allDataRaw,
21714
+ layout: "list",
21715
+ dragGroup,
21716
+ accepts,
21717
+ sortable: sortableProp,
21718
+ dropEvent,
21719
+ reorderEvent: dndReorderEvent,
21720
+ dndItemIdField
21721
+ });
21722
+ const allData = dnd.orderedItems;
21497
21723
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
21498
21724
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
21499
21725
  const hasRenderProp = typeof children === "function";
21500
- React135__default.useEffect(() => {
21726
+ React80__default.useEffect(() => {
21501
21727
  const renderItemTypeOf = typeof schemaRenderItem;
21502
21728
  const childrenTypeOf = typeof children;
21503
21729
  if (data.length > 0 && !hasRenderProp) {
@@ -21553,7 +21779,7 @@ function DataList({
21553
21779
  const items2 = data.map((item) => item);
21554
21780
  const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
21555
21781
  const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
21556
- return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React135__default.Fragment, { children: [
21782
+ return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React80__default.Fragment, { children: [
21557
21783
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
21558
21784
  group.items.map((itemData, index) => {
21559
21785
  const id = itemData.id || `${gi}-${index}`;
@@ -21601,10 +21827,50 @@ function DataList({
21601
21827
  }
21602
21828
  const items = data.map((item) => item);
21603
21829
  const groups = groupBy ? groupData(items, groupBy) : [{ label: "", items }];
21830
+ const idFieldName = dndItemIdField ?? "id";
21604
21831
  const renderItem = (itemData, index, isLast) => {
21832
+ const dndId = itemData[idFieldName] ?? `__idx_${index}`;
21833
+ const wrapDnd = (node) => dnd.enabled ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
21605
21834
  if (hasRenderProp) {
21606
21835
  const id2 = itemData.id || String(index);
21607
- return /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id2, children: [
21836
+ return wrapDnd(
21837
+ /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id2, children: [
21838
+ /* @__PURE__ */ jsxs(Box, { className: "group flex items-stretch gap-2", children: [
21839
+ /* @__PURE__ */ jsx(Box, { className: "flex-1 min-w-0", children: children(itemData, index) }),
21840
+ itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(
21841
+ HStack,
21842
+ {
21843
+ gap: "xs",
21844
+ className: "flex-shrink-0",
21845
+ children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
21846
+ Button,
21847
+ {
21848
+ variant: action.variant ?? "ghost",
21849
+ size: "sm",
21850
+ onClick: handleActionClick(action, itemData),
21851
+ "data-testid": `action-${action.event}`,
21852
+ "data-row-id": String(itemData.id),
21853
+ className: cn(
21854
+ action.variant === "danger" && "text-error hover:bg-error/10"
21855
+ ),
21856
+ children: [
21857
+ action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
21858
+ action.label
21859
+ ]
21860
+ },
21861
+ idx
21862
+ ))
21863
+ }
21864
+ )
21865
+ ] }),
21866
+ isCard && !isLast && /* @__PURE__ */ jsx(Box, { className: "mx-6 border-b border-border/40" })
21867
+ ] }, id2)
21868
+ );
21869
+ }
21870
+ const id = itemData.id || String(index);
21871
+ const titleValue = getNestedValue(itemData, titleField?.name ?? "");
21872
+ return wrapDnd(
21873
+ /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id, children: [
21608
21874
  /* @__PURE__ */ jsxs(
21609
21875
  Box,
21610
21876
  {
@@ -21615,166 +21881,124 @@ function DataList({
21615
21881
  !isCard && !isCompact && "rounded-lg border border-transparent hover:border-border"
21616
21882
  ),
21617
21883
  children: [
21618
- /* @__PURE__ */ jsx(Box, { className: "flex-1 min-w-0", children: children(itemData, index) }),
21619
- itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(
21620
- HStack,
21621
- {
21622
- gap: "xs",
21623
- className: "flex-shrink-0",
21624
- children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
21625
- Button,
21884
+ /* @__PURE__ */ jsxs(Box, { className: "flex-1 min-w-0", children: [
21885
+ /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "items-center", children: [
21886
+ titleField?.icon && /* @__PURE__ */ jsx(
21887
+ Icon,
21626
21888
  {
21627
- variant: action.variant ?? "ghost",
21628
- size: "sm",
21629
- onClick: handleActionClick(action, itemData),
21630
- "data-testid": `action-${action.event}`,
21631
- "data-row-id": String(itemData.id),
21632
- className: cn(
21633
- action.variant === "danger" && "text-error hover:bg-error/10"
21634
- ),
21635
- children: [
21636
- action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
21637
- action.label
21638
- ]
21639
- },
21640
- idx
21641
- ))
21642
- }
21643
- )
21889
+ name: titleField.icon,
21890
+ size: isCompact ? "xs" : "sm",
21891
+ className: "text-primary flex-shrink-0"
21892
+ }
21893
+ ),
21894
+ titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsx(
21895
+ Typography,
21896
+ {
21897
+ variant: titleField?.variant === "h3" ? "h3" : "h4",
21898
+ className: cn("font-semibold truncate flex-1", isCompact && "text-sm"),
21899
+ children: String(titleValue)
21900
+ }
21901
+ ),
21902
+ badgeFields.map((field) => {
21903
+ const val = getNestedValue(itemData, field.name);
21904
+ if (val === void 0 || val === null) return null;
21905
+ return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center flex-shrink-0", children: [
21906
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
21907
+ /* @__PURE__ */ jsx(Badge, { variant: statusVariant3(String(val)), children: String(val) })
21908
+ ] }, field.name);
21909
+ })
21910
+ ] }),
21911
+ bodyFields.length > 0 && !isCompact && /* @__PURE__ */ jsx(HStack, { gap: "md", className: "mt-1.5 flex-wrap", children: bodyFields.map((field) => {
21912
+ const value = getNestedValue(itemData, field.name);
21913
+ if (value === void 0 || value === null || value === "") return null;
21914
+ return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21915
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21916
+ /* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "secondary", children: [
21917
+ field.label ?? fieldLabel3(field.name),
21918
+ ":"
21919
+ ] }),
21920
+ /* @__PURE__ */ jsx(Typography, { variant: "small", children: formatValue2(value, field.format) })
21921
+ ] }, field.name);
21922
+ }) }),
21923
+ progressFields.map((field) => {
21924
+ const value = getNestedValue(itemData, field.name);
21925
+ if (typeof value !== "number") return null;
21926
+ return /* @__PURE__ */ jsxs(Box, { className: "mt-2 max-w-xs", children: [
21927
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center mb-1", children: [
21928
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21929
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel3(field.name) })
21930
+ ] }),
21931
+ /* @__PURE__ */ jsx(ProgressBar, { value, max: 100 })
21932
+ ] }, field.name);
21933
+ })
21934
+ ] }),
21935
+ itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
21936
+ Button,
21937
+ {
21938
+ variant: action.variant ?? "ghost",
21939
+ size: "sm",
21940
+ onClick: handleActionClick(action, itemData),
21941
+ "data-testid": `action-${action.event}`,
21942
+ "data-row-id": String(itemData.id),
21943
+ className: cn(
21944
+ action.variant === "danger" && "text-error hover:bg-error/10"
21945
+ ),
21946
+ children: [
21947
+ action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
21948
+ action.label
21949
+ ]
21950
+ },
21951
+ idx
21952
+ )) })
21644
21953
  ]
21645
21954
  }
21646
21955
  ),
21647
21956
  isCard && !isLast && /* @__PURE__ */ jsx(Box, { className: "mx-6 border-b border-border/40" })
21648
- ] }, id2);
21649
- }
21650
- const id = itemData.id || String(index);
21651
- const titleValue = getNestedValue(itemData, titleField?.name ?? "");
21652
- return /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id, children: [
21653
- /* @__PURE__ */ jsxs(
21654
- Box,
21655
- {
21656
- className: cn(
21657
- "group flex items-center gap-4 transition-all duration-200",
21658
- isCompact ? "px-4 py-2" : "px-6 py-4",
21659
- "hover:bg-muted/80",
21660
- !isCard && !isCompact && "rounded-lg border border-transparent hover:border-border"
21661
- ),
21662
- children: [
21663
- /* @__PURE__ */ jsxs(Box, { className: "flex-1 min-w-0", children: [
21664
- /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "items-center", children: [
21665
- titleField?.icon && /* @__PURE__ */ jsx(
21666
- Icon,
21667
- {
21668
- name: titleField.icon,
21669
- size: isCompact ? "xs" : "sm",
21670
- className: "text-primary flex-shrink-0"
21671
- }
21672
- ),
21673
- titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsx(
21674
- Typography,
21675
- {
21676
- variant: titleField?.variant === "h3" ? "h3" : "h4",
21677
- className: cn("font-semibold truncate flex-1", isCompact && "text-sm"),
21678
- children: String(titleValue)
21679
- }
21680
- ),
21681
- badgeFields.map((field) => {
21682
- const val = getNestedValue(itemData, field.name);
21683
- if (val === void 0 || val === null) return null;
21684
- return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center flex-shrink-0", children: [
21685
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
21686
- /* @__PURE__ */ jsx(Badge, { variant: statusVariant3(String(val)), children: String(val) })
21687
- ] }, field.name);
21688
- })
21689
- ] }),
21690
- bodyFields.length > 0 && !isCompact && /* @__PURE__ */ jsx(HStack, { gap: "md", className: "mt-1.5 flex-wrap", children: bodyFields.map((field) => {
21691
- const value = getNestedValue(itemData, field.name);
21692
- if (value === void 0 || value === null || value === "") return null;
21693
- return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21694
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21695
- /* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "secondary", children: [
21696
- field.label ?? fieldLabel3(field.name),
21697
- ":"
21698
- ] }),
21699
- /* @__PURE__ */ jsx(Typography, { variant: "small", children: formatValue2(value, field.format) })
21700
- ] }, field.name);
21701
- }) }),
21702
- progressFields.map((field) => {
21703
- const value = getNestedValue(itemData, field.name);
21704
- if (typeof value !== "number") return null;
21705
- return /* @__PURE__ */ jsxs(Box, { className: "mt-2 max-w-xs", children: [
21706
- /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center mb-1", children: [
21707
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21708
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel3(field.name) })
21709
- ] }),
21710
- /* @__PURE__ */ jsx(ProgressBar, { value, max: 100 })
21711
- ] }, field.name);
21712
- })
21713
- ] }),
21714
- itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
21715
- Button,
21716
- {
21717
- variant: action.variant ?? "ghost",
21718
- size: "sm",
21719
- onClick: handleActionClick(action, itemData),
21720
- "data-testid": `action-${action.event}`,
21721
- "data-row-id": String(itemData.id),
21722
- className: cn(
21723
- action.variant === "danger" && "text-error hover:bg-error/10"
21724
- ),
21725
- children: [
21726
- action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
21727
- action.label
21728
- ]
21729
- },
21730
- idx
21731
- )) })
21732
- ]
21733
- }
21734
- ),
21735
- isCard && !isLast && /* @__PURE__ */ jsx(Box, { className: "mx-6 border-b border-border/40" })
21736
- ] }, id);
21957
+ ] }, id)
21958
+ );
21737
21959
  };
21738
- return /* @__PURE__ */ jsxs(
21739
- Box,
21740
- {
21741
- className: cn(
21742
- isCard && "bg-card rounded-xl border border-border shadow-lg overflow-hidden",
21743
- !isCard && gapClass,
21744
- className
21745
- ),
21746
- children: [
21747
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React135__default.Fragment, { children: [
21748
- group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
21749
- group.items.map(
21750
- (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
21960
+ return dnd.wrapContainer(
21961
+ /* @__PURE__ */ jsxs(
21962
+ Box,
21963
+ {
21964
+ className: cn(
21965
+ isCard && "bg-card rounded-xl border border-border shadow-lg overflow-hidden",
21966
+ !isCard && gapClass,
21967
+ className
21968
+ ),
21969
+ children: [
21970
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React80__default.Fragment, { children: [
21971
+ group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
21972
+ group.items.map(
21973
+ (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
21974
+ )
21975
+ ] }, gi)),
21976
+ hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
21977
+ Button,
21978
+ {
21979
+ variant: "ghost",
21980
+ size: "sm",
21981
+ onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
21982
+ children: [
21983
+ /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
21984
+ t("common.showMore"),
21985
+ " (",
21986
+ allData.length - visibleCount,
21987
+ " remaining)"
21988
+ ]
21989
+ }
21990
+ ) }),
21991
+ infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
21992
+ InfiniteScrollSentinel,
21993
+ {
21994
+ loadMoreEvent,
21995
+ isLoading,
21996
+ hasMore
21997
+ }
21751
21998
  )
21752
- ] }, gi)),
21753
- hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
21754
- Button,
21755
- {
21756
- variant: "ghost",
21757
- size: "sm",
21758
- onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
21759
- children: [
21760
- /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
21761
- t("common.showMore"),
21762
- " (",
21763
- allData.length - visibleCount,
21764
- " remaining)"
21765
- ]
21766
- }
21767
- ) }),
21768
- infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
21769
- InfiniteScrollSentinel,
21770
- {
21771
- loadMoreEvent,
21772
- isLoading,
21773
- hasMore
21774
- }
21775
- )
21776
- ]
21777
- }
21999
+ ]
22000
+ }
22001
+ )
21778
22002
  );
21779
22003
  }
21780
22004
  var dataListLog;
@@ -21794,6 +22018,7 @@ var init_DataList = __esm({
21794
22018
  init_ProgressBar();
21795
22019
  init_Divider();
21796
22020
  init_InfiniteScrollSentinel();
22021
+ init_useDataDnd();
21797
22022
  dataListLog = createLogger("almadar:ui:data-list");
21798
22023
  DataList.displayName = "DataList";
21799
22024
  }
@@ -22980,7 +23205,7 @@ var init_WizardProgress = __esm({
22980
23205
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
22981
23206
  const isActive = index === currentStep;
22982
23207
  const isCompleted = index < currentStep;
22983
- return /* @__PURE__ */ jsxs(React135__default.Fragment, { children: [
23208
+ return /* @__PURE__ */ jsxs(React80__default.Fragment, { children: [
22984
23209
  /* @__PURE__ */ jsx(
22985
23210
  "button",
22986
23211
  {
@@ -23891,7 +24116,7 @@ function InventoryGrid({
23891
24116
  const eventBus = useEventBus();
23892
24117
  const slotCount = totalSlots ?? items.length;
23893
24118
  const emptySlotCount = Math.max(0, slotCount - items.length);
23894
- const handleSelect = React135.useCallback(
24119
+ const handleSelect = React80.useCallback(
23895
24120
  (id) => {
23896
24121
  onSelect?.(id);
23897
24122
  if (selectEvent) {
@@ -24104,15 +24329,15 @@ function GameCanvas2D({
24104
24329
  fps = 60,
24105
24330
  className
24106
24331
  }) {
24107
- const canvasRef = React135.useRef(null);
24108
- const rafRef = React135.useRef(0);
24109
- const frameRef = React135.useRef(0);
24110
- const lastTimeRef = React135.useRef(0);
24111
- const onDrawRef = React135.useRef(onDraw);
24332
+ const canvasRef = React80.useRef(null);
24333
+ const rafRef = React80.useRef(0);
24334
+ const frameRef = React80.useRef(0);
24335
+ const lastTimeRef = React80.useRef(0);
24336
+ const onDrawRef = React80.useRef(onDraw);
24112
24337
  onDrawRef.current = onDraw;
24113
- const onTickRef = React135.useRef(onTick);
24338
+ const onTickRef = React80.useRef(onTick);
24114
24339
  onTickRef.current = onTick;
24115
- React135.useEffect(() => {
24340
+ React80.useEffect(() => {
24116
24341
  const canvas = canvasRef.current;
24117
24342
  if (!canvas) return;
24118
24343
  const ctx = canvas.getContext("2d");
@@ -24401,7 +24626,7 @@ function TurnPanel({
24401
24626
  className
24402
24627
  }) {
24403
24628
  const eventBus = useEventBus();
24404
- const handleAction = React135.useCallback(
24629
+ const handleAction = React80.useCallback(
24405
24630
  (event) => {
24406
24631
  if (event) {
24407
24632
  eventBus.emit(event, { turn: currentTurn, phase, activeTeam });
@@ -24547,7 +24772,7 @@ function UnitCommandBar({
24547
24772
  className
24548
24773
  }) {
24549
24774
  const eventBus = useEventBus();
24550
- const handleCommand = React135.useCallback(
24775
+ const handleCommand = React80.useCallback(
24551
24776
  (event) => {
24552
24777
  if (event) {
24553
24778
  eventBus.emit(event, { unitId: selectedUnitId });
@@ -25032,7 +25257,7 @@ function GameMenu({
25032
25257
  } catch {
25033
25258
  }
25034
25259
  const eventBus = eventBusProp || eventBusFromHook;
25035
- const handleOptionClick = React135.useCallback(
25260
+ const handleOptionClick = React80.useCallback(
25036
25261
  (option) => {
25037
25262
  if (option.event && eventBus) {
25038
25263
  eventBus.emit(`UI:${option.event}`, { option });
@@ -25146,7 +25371,7 @@ function GameOverScreen({
25146
25371
  } catch {
25147
25372
  }
25148
25373
  const eventBus = eventBusProp || eventBusFromHook;
25149
- const handleActionClick = React135.useCallback(
25374
+ const handleActionClick = React80.useCallback(
25150
25375
  (action) => {
25151
25376
  if (action.event && eventBus) {
25152
25377
  eventBus.emit(`UI:${action.event}`, { action });
@@ -27635,7 +27860,7 @@ var init_StepFlow = __esm({
27635
27860
  className
27636
27861
  }) => {
27637
27862
  if (orientation === "vertical") {
27638
- 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: [
27863
+ 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: [
27639
27864
  /* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
27640
27865
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
27641
27866
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
@@ -27646,7 +27871,7 @@ var init_StepFlow = __esm({
27646
27871
  ] })
27647
27872
  ] }) }, index)) });
27648
27873
  }
27649
- 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: [
27874
+ 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: [
27650
27875
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
27651
27876
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
27652
27877
  /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -28528,7 +28753,7 @@ var init_LikertScale = __esm({
28528
28753
  md: "text-base",
28529
28754
  lg: "text-lg"
28530
28755
  };
28531
- LikertScale = React135__default.forwardRef(
28756
+ LikertScale = React80__default.forwardRef(
28532
28757
  ({
28533
28758
  question,
28534
28759
  options = DEFAULT_LIKERT_OPTIONS,
@@ -28540,7 +28765,7 @@ var init_LikertScale = __esm({
28540
28765
  variant = "radios",
28541
28766
  className
28542
28767
  }, ref) => {
28543
- const groupId = React135__default.useId();
28768
+ const groupId = React80__default.useId();
28544
28769
  const eventBus = useEventBus();
28545
28770
  const handleSelect = useCallback(
28546
28771
  (next) => {
@@ -30766,7 +30991,7 @@ var init_DocBreadcrumb = __esm({
30766
30991
  "aria-label": "Breadcrumb",
30767
30992
  children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", wrap: true, children: items.map((item, idx) => {
30768
30993
  const isLast = idx === items.length - 1;
30769
- return /* @__PURE__ */ jsxs(React135__default.Fragment, { children: [
30994
+ return /* @__PURE__ */ jsxs(React80__default.Fragment, { children: [
30770
30995
  idx > 0 && /* @__PURE__ */ jsx(
30771
30996
  Icon,
30772
30997
  {
@@ -31656,7 +31881,7 @@ var init_MiniStateMachine = __esm({
31656
31881
  const x = 2 + i * (NODE_W + GAP + ARROW_W + GAP);
31657
31882
  const tc = transitionCounts[s.name] ?? 0;
31658
31883
  const role = getStateRole(s.name, s.isInitial, s.isTerminal, tc, maxTC);
31659
- return /* @__PURE__ */ jsxs(React135__default.Fragment, { children: [
31884
+ return /* @__PURE__ */ jsxs(React80__default.Fragment, { children: [
31660
31885
  /* @__PURE__ */ jsx(
31661
31886
  AvlState,
31662
31887
  {
@@ -33033,7 +33258,7 @@ var init_DocumentViewer = __esm({
33033
33258
  }
33034
33259
  });
33035
33260
  function extractTitle(children) {
33036
- if (!React135__default.isValidElement(children)) return void 0;
33261
+ if (!React80__default.isValidElement(children)) return void 0;
33037
33262
  const props = children.props;
33038
33263
  if (typeof props.title === "string") {
33039
33264
  return props.title;
@@ -33088,7 +33313,7 @@ function LinearView({
33088
33313
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
33089
33314
  const isDone = i < currentIdx;
33090
33315
  const isCurrent = i === currentIdx;
33091
- return /* @__PURE__ */ jsxs(React135__default.Fragment, { children: [
33316
+ return /* @__PURE__ */ jsxs(React80__default.Fragment, { children: [
33092
33317
  i > 0 && /* @__PURE__ */ jsx(
33093
33318
  Typography,
33094
33319
  {
@@ -33988,12 +34213,12 @@ var init_Form = __esm({
33988
34213
  const isSchemaEntity = isOrbitalEntitySchema(entity);
33989
34214
  const resolvedEntity = isSchemaEntity ? entity : void 0;
33990
34215
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
33991
- const normalizedInitialData = React135__default.useMemo(() => {
34216
+ const normalizedInitialData = React80__default.useMemo(() => {
33992
34217
  const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
33993
34218
  const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
33994
34219
  return entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
33995
34220
  }, [entity, initialData]);
33996
- const entityDerivedFields = React135__default.useMemo(() => {
34221
+ const entityDerivedFields = React80__default.useMemo(() => {
33997
34222
  if (fields && fields.length > 0) return void 0;
33998
34223
  if (!resolvedEntity) return void 0;
33999
34224
  return resolvedEntity.fields.map(
@@ -34012,16 +34237,16 @@ var init_Form = __esm({
34012
34237
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
34013
34238
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
34014
34239
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
34015
- const [formData, setFormData] = React135__default.useState(
34240
+ const [formData, setFormData] = React80__default.useState(
34016
34241
  normalizedInitialData
34017
34242
  );
34018
- const [collapsedSections, setCollapsedSections] = React135__default.useState(
34243
+ const [collapsedSections, setCollapsedSections] = React80__default.useState(
34019
34244
  /* @__PURE__ */ new Set()
34020
34245
  );
34021
- const [submitError, setSubmitError] = React135__default.useState(null);
34022
- const formRef = React135__default.useRef(null);
34246
+ const [submitError, setSubmitError] = React80__default.useState(null);
34247
+ const formRef = React80__default.useRef(null);
34023
34248
  const formMode = props.mode;
34024
- const mountedRef = React135__default.useRef(false);
34249
+ const mountedRef = React80__default.useRef(false);
34025
34250
  if (!mountedRef.current) {
34026
34251
  mountedRef.current = true;
34027
34252
  debug("forms", "mount", {
@@ -34034,7 +34259,7 @@ var init_Form = __esm({
34034
34259
  });
34035
34260
  }
34036
34261
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
34037
- const evalContext = React135__default.useMemo(
34262
+ const evalContext = React80__default.useMemo(
34038
34263
  () => ({
34039
34264
  formValues: formData,
34040
34265
  globalVariables: externalContext?.globalVariables ?? {},
@@ -34043,7 +34268,7 @@ var init_Form = __esm({
34043
34268
  }),
34044
34269
  [formData, externalContext]
34045
34270
  );
34046
- React135__default.useEffect(() => {
34271
+ React80__default.useEffect(() => {
34047
34272
  debug("forms", "initialData-sync", {
34048
34273
  mode: formMode,
34049
34274
  normalizedInitialData,
@@ -34054,7 +34279,7 @@ var init_Form = __esm({
34054
34279
  setFormData(normalizedInitialData);
34055
34280
  }
34056
34281
  }, [normalizedInitialData]);
34057
- const processCalculations = React135__default.useCallback(
34282
+ const processCalculations = React80__default.useCallback(
34058
34283
  (changedFieldId, newFormData) => {
34059
34284
  if (!hiddenCalculations.length) return;
34060
34285
  const context = {
@@ -34079,7 +34304,7 @@ var init_Form = __esm({
34079
34304
  },
34080
34305
  [hiddenCalculations, externalContext, eventBus]
34081
34306
  );
34082
- const checkViolations = React135__default.useCallback(
34307
+ const checkViolations = React80__default.useCallback(
34083
34308
  (changedFieldId, newFormData) => {
34084
34309
  if (!violationTriggers.length) return;
34085
34310
  const context = {
@@ -34117,7 +34342,7 @@ var init_Form = __esm({
34117
34342
  processCalculations(name, newFormData);
34118
34343
  checkViolations(name, newFormData);
34119
34344
  };
34120
- const isFieldVisible = React135__default.useCallback(
34345
+ const isFieldVisible = React80__default.useCallback(
34121
34346
  (fieldName) => {
34122
34347
  const condition = conditionalFields[fieldName];
34123
34348
  if (!condition) return true;
@@ -34125,7 +34350,7 @@ var init_Form = __esm({
34125
34350
  },
34126
34351
  [conditionalFields, evalContext]
34127
34352
  );
34128
- const isSectionVisible = React135__default.useCallback(
34353
+ const isSectionVisible = React80__default.useCallback(
34129
34354
  (section) => {
34130
34355
  if (!section.condition) return true;
34131
34356
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -34201,7 +34426,7 @@ var init_Form = __esm({
34201
34426
  eventBus.emit(`UI:${onCancel}`);
34202
34427
  }
34203
34428
  };
34204
- const renderField = React135__default.useCallback(
34429
+ const renderField = React80__default.useCallback(
34205
34430
  (field) => {
34206
34431
  const fieldName = field.name || field.field;
34207
34432
  if (!fieldName) return null;
@@ -34222,7 +34447,7 @@ var init_Form = __esm({
34222
34447
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
34223
34448
  );
34224
34449
  const effectiveFields = entityDerivedFields ?? fields;
34225
- const normalizedFields = React135__default.useMemo(() => {
34450
+ const normalizedFields = React80__default.useMemo(() => {
34226
34451
  if (!effectiveFields || effectiveFields.length === 0) return [];
34227
34452
  return effectiveFields.map((field) => {
34228
34453
  if (typeof field === "string") {
@@ -34244,7 +34469,7 @@ var init_Form = __esm({
34244
34469
  return field;
34245
34470
  });
34246
34471
  }, [effectiveFields, resolvedEntity]);
34247
- const schemaFields = React135__default.useMemo(() => {
34472
+ const schemaFields = React80__default.useMemo(() => {
34248
34473
  if (normalizedFields.length === 0) return null;
34249
34474
  if (isDebugEnabled()) {
34250
34475
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -34254,7 +34479,7 @@ var init_Form = __esm({
34254
34479
  }
34255
34480
  return normalizedFields.map(renderField).filter(Boolean);
34256
34481
  }, [normalizedFields, renderField, entityName, conditionalFields]);
34257
- const sectionElements = React135__default.useMemo(() => {
34482
+ const sectionElements = React80__default.useMemo(() => {
34258
34483
  if (!sections || sections.length === 0) return null;
34259
34484
  return sections.map((section) => {
34260
34485
  if (!isSectionVisible(section)) {
@@ -35980,7 +36205,7 @@ var init_List = __esm({
35980
36205
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
35981
36206
  return [];
35982
36207
  }, [entity]);
35983
- const getItemActions = React135__default.useCallback(
36208
+ const getItemActions = React80__default.useCallback(
35984
36209
  (item) => {
35985
36210
  if (!itemActions) return [];
35986
36211
  if (typeof itemActions === "function") {
@@ -36453,7 +36678,7 @@ var init_MediaGallery = __esm({
36453
36678
  [selectable, selectedItems, selectionEvent, eventBus]
36454
36679
  );
36455
36680
  const entityData = Array.isArray(entity) ? entity : [];
36456
- const items = React135__default.useMemo(() => {
36681
+ const items = React80__default.useMemo(() => {
36457
36682
  if (propItems) return propItems;
36458
36683
  if (entityData.length === 0) return [];
36459
36684
  return entityData.map((record, idx) => ({
@@ -36617,7 +36842,7 @@ var init_MediaGallery = __esm({
36617
36842
  }
36618
36843
  });
36619
36844
  function extractTitle2(children) {
36620
- if (!React135__default.isValidElement(children)) return void 0;
36845
+ if (!React80__default.isValidElement(children)) return void 0;
36621
36846
  const props = children.props;
36622
36847
  if (typeof props.title === "string") {
36623
36848
  return props.title;
@@ -37330,7 +37555,7 @@ var init_PageHeader = __esm({
37330
37555
  info: "bg-info/10 text-info"
37331
37556
  };
37332
37557
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
37333
- 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: [
37558
+ 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: [
37334
37559
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
37335
37560
  crumb.href ? /* @__PURE__ */ jsx(
37336
37561
  "a",
@@ -37645,7 +37870,7 @@ var init_debugRegistry = __esm({
37645
37870
  }
37646
37871
  });
37647
37872
  function useDebugData() {
37648
- const [data, setData] = React135.useState(() => ({
37873
+ const [data, setData] = React80.useState(() => ({
37649
37874
  traits: [],
37650
37875
  ticks: [],
37651
37876
  guards: [],
@@ -37659,7 +37884,7 @@ function useDebugData() {
37659
37884
  },
37660
37885
  lastUpdate: Date.now()
37661
37886
  }));
37662
- React135.useEffect(() => {
37887
+ React80.useEffect(() => {
37663
37888
  const updateData = () => {
37664
37889
  setData({
37665
37890
  traits: getAllTraits(),
@@ -37768,12 +37993,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
37768
37993
  return positions;
37769
37994
  }
37770
37995
  function WalkMinimap() {
37771
- const [walkStep, setWalkStep] = React135.useState(null);
37772
- const [traits2, setTraits] = React135.useState([]);
37773
- const [coveredEdges, setCoveredEdges] = React135.useState([]);
37774
- const [completedTraits, setCompletedTraits] = React135.useState(/* @__PURE__ */ new Set());
37775
- const prevTraitRef = React135.useRef(null);
37776
- React135.useEffect(() => {
37996
+ const [walkStep, setWalkStep] = React80.useState(null);
37997
+ const [traits2, setTraits] = React80.useState([]);
37998
+ const [coveredEdges, setCoveredEdges] = React80.useState([]);
37999
+ const [completedTraits, setCompletedTraits] = React80.useState(/* @__PURE__ */ new Set());
38000
+ const prevTraitRef = React80.useRef(null);
38001
+ React80.useEffect(() => {
37777
38002
  const interval = setInterval(() => {
37778
38003
  const w = window;
37779
38004
  const step = w.__orbitalWalkStep;
@@ -38220,15 +38445,15 @@ var init_EntitiesTab = __esm({
38220
38445
  }
38221
38446
  });
38222
38447
  function EventFlowTab({ events: events2 }) {
38223
- const [filter, setFilter] = React135.useState("all");
38224
- const containerRef = React135.useRef(null);
38225
- const [autoScroll, setAutoScroll] = React135.useState(true);
38226
- React135.useEffect(() => {
38448
+ const [filter, setFilter] = React80.useState("all");
38449
+ const containerRef = React80.useRef(null);
38450
+ const [autoScroll, setAutoScroll] = React80.useState(true);
38451
+ React80.useEffect(() => {
38227
38452
  if (autoScroll && containerRef.current) {
38228
38453
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
38229
38454
  }
38230
38455
  }, [events2.length, autoScroll]);
38231
- const filteredEvents = React135.useMemo(() => {
38456
+ const filteredEvents = React80.useMemo(() => {
38232
38457
  if (filter === "all") return events2;
38233
38458
  return events2.filter((e) => e.type === filter);
38234
38459
  }, [events2, filter]);
@@ -38347,7 +38572,7 @@ var init_EventFlowTab = __esm({
38347
38572
  }
38348
38573
  });
38349
38574
  function GuardsPanel({ guards }) {
38350
- const [filter, setFilter] = React135.useState("all");
38575
+ const [filter, setFilter] = React80.useState("all");
38351
38576
  if (guards.length === 0) {
38352
38577
  return /* @__PURE__ */ jsx(
38353
38578
  EmptyState,
@@ -38360,7 +38585,7 @@ function GuardsPanel({ guards }) {
38360
38585
  }
38361
38586
  const passedCount = guards.filter((g) => g.result).length;
38362
38587
  const failedCount = guards.length - passedCount;
38363
- const filteredGuards = React135.useMemo(() => {
38588
+ const filteredGuards = React80.useMemo(() => {
38364
38589
  if (filter === "all") return guards;
38365
38590
  if (filter === "passed") return guards.filter((g) => g.result);
38366
38591
  return guards.filter((g) => !g.result);
@@ -38521,10 +38746,10 @@ function EffectBadge({ effect }) {
38521
38746
  ] });
38522
38747
  }
38523
38748
  function TransitionTimeline({ transitions }) {
38524
- const containerRef = React135.useRef(null);
38525
- const [autoScroll, setAutoScroll] = React135.useState(true);
38526
- const [expandedId, setExpandedId] = React135.useState(null);
38527
- React135.useEffect(() => {
38749
+ const containerRef = React80.useRef(null);
38750
+ const [autoScroll, setAutoScroll] = React80.useState(true);
38751
+ const [expandedId, setExpandedId] = React80.useState(null);
38752
+ React80.useEffect(() => {
38528
38753
  if (autoScroll && containerRef.current) {
38529
38754
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
38530
38755
  }
@@ -38810,9 +39035,9 @@ function getAllEvents(traits2) {
38810
39035
  }
38811
39036
  function EventDispatcherTab({ traits: traits2, schema }) {
38812
39037
  const eventBus = useEventBus();
38813
- const [log12, setLog] = React135.useState([]);
38814
- const prevStatesRef = React135.useRef(/* @__PURE__ */ new Map());
38815
- React135.useEffect(() => {
39038
+ const [log12, setLog] = React80.useState([]);
39039
+ const prevStatesRef = React80.useRef(/* @__PURE__ */ new Map());
39040
+ React80.useEffect(() => {
38816
39041
  for (const trait of traits2) {
38817
39042
  const prev = prevStatesRef.current.get(trait.id);
38818
39043
  if (prev && prev !== trait.currentState) {
@@ -38982,10 +39207,10 @@ function VerifyModePanel({
38982
39207
  serverCount,
38983
39208
  localCount
38984
39209
  }) {
38985
- const [expanded, setExpanded] = React135.useState(true);
38986
- const scrollRef = React135.useRef(null);
38987
- const prevCountRef = React135.useRef(0);
38988
- React135.useEffect(() => {
39210
+ const [expanded, setExpanded] = React80.useState(true);
39211
+ const scrollRef = React80.useRef(null);
39212
+ const prevCountRef = React80.useRef(0);
39213
+ React80.useEffect(() => {
38989
39214
  if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
38990
39215
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
38991
39216
  }
@@ -39051,10 +39276,10 @@ function RuntimeDebugger({
39051
39276
  defaultTab,
39052
39277
  schema
39053
39278
  }) {
39054
- const [isCollapsed, setIsCollapsed] = React135.useState(mode === "verify" ? true : defaultCollapsed);
39055
- const [isVisible, setIsVisible] = React135.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
39279
+ const [isCollapsed, setIsCollapsed] = React80.useState(mode === "verify" ? true : defaultCollapsed);
39280
+ const [isVisible, setIsVisible] = React80.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
39056
39281
  const debugData = useDebugData();
39057
- React135.useEffect(() => {
39282
+ React80.useEffect(() => {
39058
39283
  if (mode === "inline") return;
39059
39284
  return onDebugToggle((enabled) => {
39060
39285
  setIsVisible(enabled);
@@ -39063,7 +39288,7 @@ function RuntimeDebugger({
39063
39288
  }
39064
39289
  });
39065
39290
  }, [mode]);
39066
- React135.useEffect(() => {
39291
+ React80.useEffect(() => {
39067
39292
  if (mode === "inline") return;
39068
39293
  const handleKeyDown = (e) => {
39069
39294
  if (e.key === "`" && isVisible) {
@@ -39612,7 +39837,7 @@ function SequenceBar({
39612
39837
  onSlotRemove(index);
39613
39838
  }, [onSlotRemove, playing]);
39614
39839
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
39615
- return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React135__default.Fragment, { children: [
39840
+ return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React80__default.Fragment, { children: [
39616
39841
  i > 0 && /* @__PURE__ */ jsx(
39617
39842
  Typography,
39618
39843
  {
@@ -41013,7 +41238,7 @@ var init_StatCard = __esm({
41013
41238
  const labelToUse = propLabel ?? propTitle;
41014
41239
  const eventBus = useEventBus();
41015
41240
  const { t } = useTranslate();
41016
- const handleActionClick = React135__default.useCallback(() => {
41241
+ const handleActionClick = React80__default.useCallback(() => {
41017
41242
  if (action?.event) {
41018
41243
  eventBus.emit(`UI:${action.event}`, {});
41019
41244
  }
@@ -41024,7 +41249,7 @@ var init_StatCard = __esm({
41024
41249
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
41025
41250
  const isLoading = externalLoading ?? false;
41026
41251
  const error = externalError;
41027
- const computeMetricValue = React135__default.useCallback(
41252
+ const computeMetricValue = React80__default.useCallback(
41028
41253
  (metric, items) => {
41029
41254
  if (metric.value !== void 0) {
41030
41255
  return metric.value;
@@ -41063,7 +41288,7 @@ var init_StatCard = __esm({
41063
41288
  },
41064
41289
  []
41065
41290
  );
41066
- const schemaStats = React135__default.useMemo(() => {
41291
+ const schemaStats = React80__default.useMemo(() => {
41067
41292
  if (!metrics || metrics.length === 0) return null;
41068
41293
  return metrics.map((metric) => ({
41069
41294
  label: metric.label,
@@ -41071,7 +41296,7 @@ var init_StatCard = __esm({
41071
41296
  format: metric.format
41072
41297
  }));
41073
41298
  }, [metrics, data, computeMetricValue]);
41074
- const calculatedTrend = React135__default.useMemo(() => {
41299
+ const calculatedTrend = React80__default.useMemo(() => {
41075
41300
  if (manualTrend !== void 0) return manualTrend;
41076
41301
  if (previousValue === void 0 || currentValue === void 0)
41077
41302
  return void 0;
@@ -42207,7 +42432,7 @@ var init_Timeline = __esm({
42207
42432
  }) => {
42208
42433
  const { t } = useTranslate();
42209
42434
  const entityData = Array.isArray(entity) ? entity : [];
42210
- const items = React135__default.useMemo(() => {
42435
+ const items = React80__default.useMemo(() => {
42211
42436
  if (propItems) return propItems;
42212
42437
  if (entityData.length === 0) return [];
42213
42438
  return entityData.map((record, idx) => {
@@ -42314,7 +42539,7 @@ var init_Timeline = __esm({
42314
42539
  }
42315
42540
  });
42316
42541
  function extractToastProps(children) {
42317
- if (!React135__default.isValidElement(children)) {
42542
+ if (!React80__default.isValidElement(children)) {
42318
42543
  if (typeof children === "string") {
42319
42544
  return { message: children };
42320
42545
  }
@@ -42352,7 +42577,7 @@ var init_ToastSlot = __esm({
42352
42577
  eventBus.emit("UI:CLOSE");
42353
42578
  };
42354
42579
  if (!isVisible) return null;
42355
- const isCustomContent = React135__default.isValidElement(children) && !message;
42580
+ const isCustomContent = React80__default.isValidElement(children) && !message;
42356
42581
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
42357
42582
  Toast,
42358
42583
  {
@@ -42621,7 +42846,7 @@ var init_WizardContainer = __esm({
42621
42846
  const isCompleted = index < currentStep;
42622
42847
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
42623
42848
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
42624
- return /* @__PURE__ */ jsxs(React135__default.Fragment, { children: [
42849
+ return /* @__PURE__ */ jsxs(React80__default.Fragment, { children: [
42625
42850
  /* @__PURE__ */ jsx(
42626
42851
  Button,
42627
42852
  {
@@ -43003,12 +43228,12 @@ var init_WorldMapTemplate = __esm({
43003
43228
  }
43004
43229
  });
43005
43230
  function lazyThree(name, loader) {
43006
- const Lazy = React135__default.lazy(() => loader().then((m) => ({ default: m[name] })));
43231
+ const Lazy = React80__default.lazy(() => loader().then((m) => ({ default: m[name] })));
43007
43232
  function ThreeWrapper(props) {
43008
- return React135__default.createElement(
43009
- React135__default.Suspense,
43233
+ return React80__default.createElement(
43234
+ React80__default.Suspense,
43010
43235
  { fallback: null },
43011
- React135__default.createElement(Lazy, props)
43236
+ React80__default.createElement(Lazy, props)
43012
43237
  );
43013
43238
  }
43014
43239
  ThreeWrapper.displayName = `Lazy(${name})`;
@@ -43612,7 +43837,7 @@ function SuspenseConfigProvider({
43612
43837
  config,
43613
43838
  children
43614
43839
  }) {
43615
- return React135__default.createElement(
43840
+ return React80__default.createElement(
43616
43841
  SuspenseConfigContext.Provider,
43617
43842
  { value: config },
43618
43843
  children
@@ -44095,7 +44320,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
44095
44320
  const key = `${parentId}-${index}-trait:${traitName}`;
44096
44321
  return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
44097
44322
  }
44098
- return /* @__PURE__ */ jsx(React135__default.Fragment, { children: child }, `${parentId}-${index}`);
44323
+ return /* @__PURE__ */ jsx(React80__default.Fragment, { children: child }, `${parentId}-${index}`);
44099
44324
  }
44100
44325
  if (!child || typeof child !== "object") return null;
44101
44326
  const childId = `${parentId}-${index}`;
@@ -44132,14 +44357,14 @@ function isPatternConfig(value) {
44132
44357
  if (value === null || value === void 0) return false;
44133
44358
  if (typeof value !== "object") return false;
44134
44359
  if (Array.isArray(value)) return false;
44135
- if (React135__default.isValidElement(value)) return false;
44360
+ if (React80__default.isValidElement(value)) return false;
44136
44361
  if (value instanceof Date) return false;
44137
44362
  if (typeof value === "function") return false;
44138
44363
  const record = value;
44139
44364
  return "type" in record && typeof record.type === "string";
44140
44365
  }
44141
44366
  function isPlainConfigObject(value) {
44142
- if (React135__default.isValidElement(value)) return false;
44367
+ if (React80__default.isValidElement(value)) return false;
44143
44368
  if (value instanceof Date) return false;
44144
44369
  const proto = Object.getPrototypeOf(value);
44145
44370
  return proto === Object.prototype || proto === null;
@@ -44500,7 +44725,7 @@ function resolveLambdaBindings(body, argName, arg) {
44500
44725
  if (Array.isArray(body)) {
44501
44726
  return body.map((b) => resolveLambdaBindings(b, argName, arg));
44502
44727
  }
44503
- if (body !== null && typeof body === "object" && !React135__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
44728
+ if (body !== null && typeof body === "object" && !React80__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
44504
44729
  const out = {};
44505
44730
  for (const [k, v] of Object.entries(body)) {
44506
44731
  out[k] = resolveLambdaBindings(v, argName, arg);
@@ -44519,7 +44744,7 @@ function getSlotContentRenderer2() {
44519
44744
  function makeLambdaFn(argName, lambdaBody, callerKey) {
44520
44745
  return (item, index) => {
44521
44746
  const resolvedBody = resolveLambdaBindings(lambdaBody, argName, item);
44522
- if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React135__default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
44747
+ if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React80__default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
44523
44748
  return null;
44524
44749
  }
44525
44750
  const record = resolvedBody;
@@ -44537,7 +44762,7 @@ function makeLambdaFn(argName, lambdaBody, callerKey) {
44537
44762
  props: childProps,
44538
44763
  priority: 0
44539
44764
  };
44540
- return React135__default.createElement(SlotContentRenderer2, { content: childContent });
44765
+ return React80__default.createElement(SlotContentRenderer2, { content: childContent });
44541
44766
  };
44542
44767
  }
44543
44768
  function convertNode(node, callerKey) {
@@ -44556,7 +44781,7 @@ function convertNode(node, callerKey) {
44556
44781
  });
44557
44782
  return anyChanged ? mapped : node;
44558
44783
  }
44559
- if (typeof node === "object" && !React135__default.isValidElement(node) && !(node instanceof Date)) {
44784
+ if (typeof node === "object" && !React80__default.isValidElement(node) && !(node instanceof Date)) {
44560
44785
  return convertObjectProps(node);
44561
44786
  }
44562
44787
  return node;