@almadar/ui 2.4.0 → 2.5.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.
- package/dist/{chunk-HWZL7IZG.js → chunk-FYYU3CHN.js} +491 -73
- package/dist/{chunk-DKQN5FVU.js → chunk-YLKXEXBP.js} +24 -24
- package/dist/components/index.d.ts +185 -27
- package/dist/components/index.js +200 -78
- package/dist/context/index.js +2 -2
- package/dist/providers/index.js +2 -2
- package/package.json +36 -33
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useTheme, useUISlots } from './chunk-
|
|
1
|
+
import { useTheme, useUISlots } from './chunk-YLKXEXBP.js';
|
|
2
2
|
import { useTranslate, useQuerySingleton } from './chunk-GOZKH7QW.js';
|
|
3
3
|
import { useEventBus } from './chunk-YXZM3WCF.js';
|
|
4
4
|
import { cn, debugGroup, debug, debugGroupEnd, getNestedValue, isDebugEnabled } from './chunk-KKCVDUK7.js';
|
|
@@ -7,8 +7,8 @@ import { __publicField } from './chunk-PKBMQBKP.js';
|
|
|
7
7
|
import * as LucideIcons from 'lucide-react';
|
|
8
8
|
import { Loader2, ChevronDown, X, Check, Copy, AlertCircle, User, Sun, Moon, FileQuestion, Inbox, Search, Info, XCircle, CheckCircle, AlertTriangle, ChevronRight, Filter, Plus, ChevronLeft, HelpCircle, ChevronUp, MoreHorizontal, TrendingUp, TrendingDown, Minus, ArrowLeft, Calendar, Tag, Clock, CheckCircle2, DollarSign, FileText, Package } from 'lucide-react';
|
|
9
9
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
10
|
-
import * as
|
|
11
|
-
import
|
|
10
|
+
import * as React50 from 'react';
|
|
11
|
+
import React50__default, { useCallback, useRef, useState, useLayoutEffect, useEffect, lazy, createContext, useMemo, useId, useContext, Suspense } from 'react';
|
|
12
12
|
import { evaluate, createMinimalContext } from '@almadar/evaluator';
|
|
13
13
|
import { createPortal } from 'react-dom';
|
|
14
14
|
import ReactMarkdown from 'react-markdown';
|
|
@@ -17,6 +17,9 @@ import remarkMath from 'remark-math';
|
|
|
17
17
|
import rehypeKatex from 'rehype-katex';
|
|
18
18
|
import SyntaxHighlighter from 'react-syntax-highlighter/dist/esm/prism';
|
|
19
19
|
import dark from 'react-syntax-highlighter/dist/esm/styles/prism/vsc-dark-plus';
|
|
20
|
+
import { MapContainer, TileLayer, Marker, Popup, useMap } from 'react-leaflet';
|
|
21
|
+
import L from 'leaflet';
|
|
22
|
+
import 'leaflet/dist/leaflet.css';
|
|
20
23
|
|
|
21
24
|
var iconAliases = {
|
|
22
25
|
"close": LucideIcons.X,
|
|
@@ -154,7 +157,7 @@ var iconSizeStyles = {
|
|
|
154
157
|
md: "h-4 w-4",
|
|
155
158
|
lg: "h-5 w-5"
|
|
156
159
|
};
|
|
157
|
-
var Button =
|
|
160
|
+
var Button = React50__default.forwardRef(
|
|
158
161
|
({
|
|
159
162
|
className,
|
|
160
163
|
variant = "primary",
|
|
@@ -212,7 +215,7 @@ var Button = React47__default.forwardRef(
|
|
|
212
215
|
}
|
|
213
216
|
);
|
|
214
217
|
Button.displayName = "Button";
|
|
215
|
-
var Input =
|
|
218
|
+
var Input = React50__default.forwardRef(
|
|
216
219
|
({
|
|
217
220
|
className,
|
|
218
221
|
inputType,
|
|
@@ -324,7 +327,7 @@ var Input = React47__default.forwardRef(
|
|
|
324
327
|
}
|
|
325
328
|
);
|
|
326
329
|
Input.displayName = "Input";
|
|
327
|
-
var Label =
|
|
330
|
+
var Label = React50__default.forwardRef(
|
|
328
331
|
({ className, required, children, ...props }, ref) => {
|
|
329
332
|
return /* @__PURE__ */ jsxs(
|
|
330
333
|
"label",
|
|
@@ -344,7 +347,7 @@ var Label = React47__default.forwardRef(
|
|
|
344
347
|
}
|
|
345
348
|
);
|
|
346
349
|
Label.displayName = "Label";
|
|
347
|
-
var Textarea =
|
|
350
|
+
var Textarea = React50__default.forwardRef(
|
|
348
351
|
({ className, error, ...props }, ref) => {
|
|
349
352
|
return /* @__PURE__ */ jsx(
|
|
350
353
|
"textarea",
|
|
@@ -367,7 +370,7 @@ var Textarea = React47__default.forwardRef(
|
|
|
367
370
|
}
|
|
368
371
|
);
|
|
369
372
|
Textarea.displayName = "Textarea";
|
|
370
|
-
var Select =
|
|
373
|
+
var Select = React50__default.forwardRef(
|
|
371
374
|
({ className, options, placeholder, error, ...props }, ref) => {
|
|
372
375
|
return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
373
376
|
/* @__PURE__ */ jsxs(
|
|
@@ -403,7 +406,7 @@ var Select = React47__default.forwardRef(
|
|
|
403
406
|
}
|
|
404
407
|
);
|
|
405
408
|
Select.displayName = "Select";
|
|
406
|
-
var Checkbox =
|
|
409
|
+
var Checkbox = React50__default.forwardRef(
|
|
407
410
|
({ className, label, id, ...props }, ref) => {
|
|
408
411
|
const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
|
|
409
412
|
return /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
@@ -469,7 +472,7 @@ var shadowStyles = {
|
|
|
469
472
|
md: "shadow-[var(--shadow-main)]",
|
|
470
473
|
lg: "shadow-[var(--shadow-lg)]"
|
|
471
474
|
};
|
|
472
|
-
var Card =
|
|
475
|
+
var Card = React50__default.forwardRef(
|
|
473
476
|
({
|
|
474
477
|
className,
|
|
475
478
|
variant = "bordered",
|
|
@@ -505,9 +508,9 @@ var Card = React47__default.forwardRef(
|
|
|
505
508
|
}
|
|
506
509
|
);
|
|
507
510
|
Card.displayName = "Card";
|
|
508
|
-
var CardHeader =
|
|
511
|
+
var CardHeader = React50__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
|
|
509
512
|
CardHeader.displayName = "CardHeader";
|
|
510
|
-
var CardTitle =
|
|
513
|
+
var CardTitle = React50__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
511
514
|
"h3",
|
|
512
515
|
{
|
|
513
516
|
ref,
|
|
@@ -520,11 +523,11 @@ var CardTitle = React47__default.forwardRef(({ className, ...props }, ref) => /*
|
|
|
520
523
|
}
|
|
521
524
|
));
|
|
522
525
|
CardTitle.displayName = "CardTitle";
|
|
523
|
-
var CardContent =
|
|
526
|
+
var CardContent = React50__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
|
|
524
527
|
CardContent.displayName = "CardContent";
|
|
525
528
|
var CardBody = CardContent;
|
|
526
529
|
CardBody.displayName = "CardBody";
|
|
527
|
-
var CardFooter =
|
|
530
|
+
var CardFooter = React50__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
528
531
|
"div",
|
|
529
532
|
{
|
|
530
533
|
ref,
|
|
@@ -570,20 +573,28 @@ var sizeStyles2 = {
|
|
|
570
573
|
md: "px-2.5 py-1 text-sm",
|
|
571
574
|
lg: "px-3 py-1.5 text-base"
|
|
572
575
|
};
|
|
573
|
-
var Badge =
|
|
574
|
-
({ className, variant = "default", size = "sm", label, children, ...props }, ref) => {
|
|
575
|
-
|
|
576
|
+
var Badge = React50__default.forwardRef(
|
|
577
|
+
({ className, variant = "default", size = "sm", label, icon, children, ...props }, ref) => {
|
|
578
|
+
const iconSizes2 = { sm: "w-3 h-3", md: "w-3.5 h-3.5", lg: "w-4 h-4" };
|
|
579
|
+
const resolvedIcon = typeof icon === "string" ? (() => {
|
|
580
|
+
const I = resolveIcon(icon);
|
|
581
|
+
return I ? /* @__PURE__ */ jsx(I, { className: iconSizes2[size] }) : null;
|
|
582
|
+
})() : icon;
|
|
583
|
+
return /* @__PURE__ */ jsxs(
|
|
576
584
|
"span",
|
|
577
585
|
{
|
|
578
586
|
ref,
|
|
579
587
|
className: cn(
|
|
580
|
-
"inline-flex items-center font-bold rounded-[var(--radius-sm)]",
|
|
588
|
+
"inline-flex items-center gap-1 font-bold rounded-[var(--radius-sm)]",
|
|
581
589
|
variantStyles3[variant],
|
|
582
590
|
sizeStyles2[size],
|
|
583
591
|
className
|
|
584
592
|
),
|
|
585
593
|
...props,
|
|
586
|
-
children:
|
|
594
|
+
children: [
|
|
595
|
+
resolvedIcon,
|
|
596
|
+
children || label
|
|
597
|
+
]
|
|
587
598
|
}
|
|
588
599
|
);
|
|
589
600
|
}
|
|
@@ -595,7 +606,7 @@ var sizeStyles3 = {
|
|
|
595
606
|
md: "h-6 w-6",
|
|
596
607
|
lg: "h-8 w-8"
|
|
597
608
|
};
|
|
598
|
-
var Spinner =
|
|
609
|
+
var Spinner = React50__default.forwardRef(
|
|
599
610
|
({ className, size = "md", ...props }, ref) => {
|
|
600
611
|
return /* @__PURE__ */ jsx(
|
|
601
612
|
"div",
|
|
@@ -860,7 +871,7 @@ var positionStyles = {
|
|
|
860
871
|
fixed: "fixed",
|
|
861
872
|
sticky: "sticky"
|
|
862
873
|
};
|
|
863
|
-
var Box =
|
|
874
|
+
var Box = React50__default.forwardRef(
|
|
864
875
|
({
|
|
865
876
|
padding,
|
|
866
877
|
paddingX,
|
|
@@ -1205,7 +1216,7 @@ var ProgressBar = ({
|
|
|
1205
1216
|
return null;
|
|
1206
1217
|
};
|
|
1207
1218
|
ProgressBar.displayName = "ProgressBar";
|
|
1208
|
-
var Radio =
|
|
1219
|
+
var Radio = React50__default.forwardRef(
|
|
1209
1220
|
({
|
|
1210
1221
|
label,
|
|
1211
1222
|
helperText,
|
|
@@ -1309,7 +1320,7 @@ var Radio = React47__default.forwardRef(
|
|
|
1309
1320
|
}
|
|
1310
1321
|
);
|
|
1311
1322
|
Radio.displayName = "Radio";
|
|
1312
|
-
var Switch =
|
|
1323
|
+
var Switch = React50.forwardRef(
|
|
1313
1324
|
({
|
|
1314
1325
|
checked,
|
|
1315
1326
|
defaultChecked = false,
|
|
@@ -1320,10 +1331,10 @@ var Switch = React47.forwardRef(
|
|
|
1320
1331
|
name,
|
|
1321
1332
|
className
|
|
1322
1333
|
}, ref) => {
|
|
1323
|
-
const [isChecked, setIsChecked] =
|
|
1334
|
+
const [isChecked, setIsChecked] = React50.useState(
|
|
1324
1335
|
checked !== void 0 ? checked : defaultChecked
|
|
1325
1336
|
);
|
|
1326
|
-
|
|
1337
|
+
React50.useEffect(() => {
|
|
1327
1338
|
if (checked !== void 0) {
|
|
1328
1339
|
setIsChecked(checked);
|
|
1329
1340
|
}
|
|
@@ -1994,8 +2005,8 @@ var LawReferenceTooltip = ({
|
|
|
1994
2005
|
position = "top",
|
|
1995
2006
|
className
|
|
1996
2007
|
}) => {
|
|
1997
|
-
const [isVisible, setIsVisible] =
|
|
1998
|
-
const timeoutRef =
|
|
2008
|
+
const [isVisible, setIsVisible] = React50__default.useState(false);
|
|
2009
|
+
const timeoutRef = React50__default.useRef(null);
|
|
1999
2010
|
const handleMouseEnter = () => {
|
|
2000
2011
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
2001
2012
|
timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
|
|
@@ -2004,7 +2015,7 @@ var LawReferenceTooltip = ({
|
|
|
2004
2015
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
2005
2016
|
setIsVisible(false);
|
|
2006
2017
|
};
|
|
2007
|
-
|
|
2018
|
+
React50__default.useEffect(() => {
|
|
2008
2019
|
return () => {
|
|
2009
2020
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
2010
2021
|
};
|
|
@@ -2253,9 +2264,9 @@ function ScoreDisplay({
|
|
|
2253
2264
|
animated = true,
|
|
2254
2265
|
locale = "en-US"
|
|
2255
2266
|
}) {
|
|
2256
|
-
const [displayValue, setDisplayValue] =
|
|
2257
|
-
const [isAnimating, setIsAnimating] =
|
|
2258
|
-
|
|
2267
|
+
const [displayValue, setDisplayValue] = React50.useState(value);
|
|
2268
|
+
const [isAnimating, setIsAnimating] = React50.useState(false);
|
|
2269
|
+
React50.useEffect(() => {
|
|
2259
2270
|
if (!animated || displayValue === value) {
|
|
2260
2271
|
setDisplayValue(value);
|
|
2261
2272
|
return;
|
|
@@ -2328,9 +2339,9 @@ function ControlButton({
|
|
|
2328
2339
|
className
|
|
2329
2340
|
}) {
|
|
2330
2341
|
const eventBus = useEventBus();
|
|
2331
|
-
const [isPressed, setIsPressed] =
|
|
2342
|
+
const [isPressed, setIsPressed] = React50.useState(false);
|
|
2332
2343
|
const actualPressed = pressed ?? isPressed;
|
|
2333
|
-
const handlePointerDown =
|
|
2344
|
+
const handlePointerDown = React50.useCallback(
|
|
2334
2345
|
(e) => {
|
|
2335
2346
|
e.preventDefault();
|
|
2336
2347
|
if (disabled) return;
|
|
@@ -2340,7 +2351,7 @@ function ControlButton({
|
|
|
2340
2351
|
},
|
|
2341
2352
|
[disabled, pressEvent, eventBus, onPress]
|
|
2342
2353
|
);
|
|
2343
|
-
const handlePointerUp =
|
|
2354
|
+
const handlePointerUp = React50.useCallback(
|
|
2344
2355
|
(e) => {
|
|
2345
2356
|
e.preventDefault();
|
|
2346
2357
|
if (disabled) return;
|
|
@@ -2350,7 +2361,7 @@ function ControlButton({
|
|
|
2350
2361
|
},
|
|
2351
2362
|
[disabled, releaseEvent, eventBus, onRelease]
|
|
2352
2363
|
);
|
|
2353
|
-
const handlePointerLeave =
|
|
2364
|
+
const handlePointerLeave = React50.useCallback(
|
|
2354
2365
|
(e) => {
|
|
2355
2366
|
if (isPressed) {
|
|
2356
2367
|
setIsPressed(false);
|
|
@@ -2578,7 +2589,7 @@ var ErrorState = ({
|
|
|
2578
2589
|
);
|
|
2579
2590
|
};
|
|
2580
2591
|
ErrorState.displayName = "ErrorState";
|
|
2581
|
-
var ErrorBoundary = class extends
|
|
2592
|
+
var ErrorBoundary = class extends React50__default.Component {
|
|
2582
2593
|
constructor(props) {
|
|
2583
2594
|
super(props);
|
|
2584
2595
|
__publicField(this, "reset", () => {
|
|
@@ -4186,8 +4197,8 @@ var Menu = ({
|
|
|
4186
4197
|
"bottom-start": "top-full left-0 mt-2",
|
|
4187
4198
|
"bottom-end": "top-full right-0 mt-2"
|
|
4188
4199
|
};
|
|
4189
|
-
const triggerChild =
|
|
4190
|
-
const triggerElement =
|
|
4200
|
+
const triggerChild = React50__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx("span", { children: trigger });
|
|
4201
|
+
const triggerElement = React50__default.cloneElement(
|
|
4191
4202
|
triggerChild,
|
|
4192
4203
|
{
|
|
4193
4204
|
ref: triggerRef,
|
|
@@ -4649,8 +4660,8 @@ var Popover = ({
|
|
|
4649
4660
|
onMouseEnter: handleOpen,
|
|
4650
4661
|
onMouseLeave: handleClose
|
|
4651
4662
|
};
|
|
4652
|
-
const childElement =
|
|
4653
|
-
const triggerElement =
|
|
4663
|
+
const childElement = React50__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
|
|
4664
|
+
const triggerElement = React50__default.cloneElement(
|
|
4654
4665
|
childElement,
|
|
4655
4666
|
{
|
|
4656
4667
|
ref: triggerRef,
|
|
@@ -5380,8 +5391,8 @@ var Tooltip = ({
|
|
|
5380
5391
|
if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
|
|
5381
5392
|
};
|
|
5382
5393
|
}, []);
|
|
5383
|
-
const triggerElement =
|
|
5384
|
-
const trigger =
|
|
5394
|
+
const triggerElement = React50__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
|
|
5395
|
+
const trigger = React50__default.cloneElement(triggerElement, {
|
|
5385
5396
|
ref: triggerRef,
|
|
5386
5397
|
onMouseEnter: handleMouseEnter,
|
|
5387
5398
|
onMouseLeave: handleMouseLeave,
|
|
@@ -5630,7 +5641,7 @@ var WizardProgress = ({
|
|
|
5630
5641
|
children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: steps.map((step, index) => {
|
|
5631
5642
|
const isActive = index === currentStep;
|
|
5632
5643
|
const isCompleted = index < currentStep;
|
|
5633
|
-
return /* @__PURE__ */ jsxs(
|
|
5644
|
+
return /* @__PURE__ */ jsxs(React50__default.Fragment, { children: [
|
|
5634
5645
|
/* @__PURE__ */ jsx(
|
|
5635
5646
|
"button",
|
|
5636
5647
|
{
|
|
@@ -5760,7 +5771,7 @@ var WizardNavigation = ({
|
|
|
5760
5771
|
);
|
|
5761
5772
|
};
|
|
5762
5773
|
WizardNavigation.displayName = "WizardNavigation";
|
|
5763
|
-
var MarkdownContent =
|
|
5774
|
+
var MarkdownContent = React50__default.memo(
|
|
5764
5775
|
({ content, direction, className }) => {
|
|
5765
5776
|
const { t: _t } = useTranslate();
|
|
5766
5777
|
return /* @__PURE__ */ jsx(
|
|
@@ -5861,7 +5872,7 @@ var MarkdownContent = React47__default.memo(
|
|
|
5861
5872
|
(prev, next) => prev.content === next.content && prev.className === next.className && prev.direction === next.direction
|
|
5862
5873
|
);
|
|
5863
5874
|
MarkdownContent.displayName = "MarkdownContent";
|
|
5864
|
-
var CodeBlock =
|
|
5875
|
+
var CodeBlock = React50__default.memo(
|
|
5865
5876
|
({
|
|
5866
5877
|
code,
|
|
5867
5878
|
language = "text",
|
|
@@ -6848,6 +6859,266 @@ var ProgressDots = ({
|
|
|
6848
6859
|
}) });
|
|
6849
6860
|
};
|
|
6850
6861
|
ProgressDots.displayName = "ProgressDots";
|
|
6862
|
+
var sizeMap5 = {
|
|
6863
|
+
sm: { button: "sm", gap: "gap-0.5", container: "w-28" },
|
|
6864
|
+
md: { button: "md", gap: "gap-1", container: "w-40" },
|
|
6865
|
+
lg: { button: "lg", gap: "gap-1.5", container: "w-52" }
|
|
6866
|
+
};
|
|
6867
|
+
var arrowIcons = {
|
|
6868
|
+
up: "\u25B2",
|
|
6869
|
+
down: "\u25BC",
|
|
6870
|
+
left: "\u25C0",
|
|
6871
|
+
right: "\u25B6"
|
|
6872
|
+
};
|
|
6873
|
+
function DPad({
|
|
6874
|
+
onDirection,
|
|
6875
|
+
directionEvent,
|
|
6876
|
+
size = "md",
|
|
6877
|
+
includeDiagonals = false,
|
|
6878
|
+
className,
|
|
6879
|
+
disabled
|
|
6880
|
+
}) {
|
|
6881
|
+
const eventBus = useEventBus();
|
|
6882
|
+
const sizes = sizeMap5[size];
|
|
6883
|
+
const [activeDirections, setActiveDirections] = React50.useState(/* @__PURE__ */ new Set());
|
|
6884
|
+
const handlePress = React50.useCallback(
|
|
6885
|
+
(direction) => {
|
|
6886
|
+
setActiveDirections((prev) => new Set(prev).add(direction));
|
|
6887
|
+
if (directionEvent) eventBus.emit(`UI:${directionEvent}`, { direction, pressed: true });
|
|
6888
|
+
onDirection?.(direction, true);
|
|
6889
|
+
},
|
|
6890
|
+
[directionEvent, eventBus, onDirection]
|
|
6891
|
+
);
|
|
6892
|
+
const handleRelease = React50.useCallback(
|
|
6893
|
+
(direction) => {
|
|
6894
|
+
setActiveDirections((prev) => {
|
|
6895
|
+
const next = new Set(prev);
|
|
6896
|
+
next.delete(direction);
|
|
6897
|
+
return next;
|
|
6898
|
+
});
|
|
6899
|
+
if (directionEvent) eventBus.emit(`UI:${directionEvent}`, { direction, pressed: false });
|
|
6900
|
+
onDirection?.(direction, false);
|
|
6901
|
+
},
|
|
6902
|
+
[directionEvent, eventBus, onDirection]
|
|
6903
|
+
);
|
|
6904
|
+
const createButton = (direction) => /* @__PURE__ */ jsx(
|
|
6905
|
+
ControlButton,
|
|
6906
|
+
{
|
|
6907
|
+
icon: arrowIcons[direction],
|
|
6908
|
+
size: sizes.button,
|
|
6909
|
+
variant: "secondary",
|
|
6910
|
+
pressed: activeDirections.has(direction),
|
|
6911
|
+
onPress: () => handlePress(direction),
|
|
6912
|
+
onRelease: () => handleRelease(direction),
|
|
6913
|
+
disabled
|
|
6914
|
+
},
|
|
6915
|
+
direction
|
|
6916
|
+
);
|
|
6917
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("inline-grid grid-cols-3", sizes.gap, sizes.container, className), children: [
|
|
6918
|
+
/* @__PURE__ */ jsx("div", {}),
|
|
6919
|
+
createButton("up"),
|
|
6920
|
+
/* @__PURE__ */ jsx("div", {}),
|
|
6921
|
+
createButton("left"),
|
|
6922
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx("div", { className: "w-6 h-6 rounded-full bg-gray-700 border-2 border-gray-600" }) }),
|
|
6923
|
+
createButton("right"),
|
|
6924
|
+
/* @__PURE__ */ jsx("div", {}),
|
|
6925
|
+
createButton("down"),
|
|
6926
|
+
/* @__PURE__ */ jsx("div", {})
|
|
6927
|
+
] });
|
|
6928
|
+
}
|
|
6929
|
+
DPad.displayName = "DPad";
|
|
6930
|
+
var sizeMap6 = {
|
|
6931
|
+
sm: "sm",
|
|
6932
|
+
md: "md",
|
|
6933
|
+
lg: "lg"
|
|
6934
|
+
};
|
|
6935
|
+
var layoutMap = {
|
|
6936
|
+
horizontal: "flex flex-row gap-2",
|
|
6937
|
+
vertical: "flex flex-col gap-2",
|
|
6938
|
+
diamond: "grid grid-cols-3 gap-1"
|
|
6939
|
+
};
|
|
6940
|
+
function ActionButtons({
|
|
6941
|
+
buttons,
|
|
6942
|
+
onAction,
|
|
6943
|
+
actionEvent,
|
|
6944
|
+
layout = "horizontal",
|
|
6945
|
+
size = "md",
|
|
6946
|
+
className,
|
|
6947
|
+
disabled
|
|
6948
|
+
}) {
|
|
6949
|
+
const eventBus = useEventBus();
|
|
6950
|
+
const [activeButtons, setActiveButtons] = React50.useState(/* @__PURE__ */ new Set());
|
|
6951
|
+
const handlePress = React50.useCallback(
|
|
6952
|
+
(id) => {
|
|
6953
|
+
setActiveButtons((prev) => new Set(prev).add(id));
|
|
6954
|
+
if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
|
|
6955
|
+
onAction?.(id, true);
|
|
6956
|
+
},
|
|
6957
|
+
[actionEvent, eventBus, onAction]
|
|
6958
|
+
);
|
|
6959
|
+
const handleRelease = React50.useCallback(
|
|
6960
|
+
(id) => {
|
|
6961
|
+
setActiveButtons((prev) => {
|
|
6962
|
+
const next = new Set(prev);
|
|
6963
|
+
next.delete(id);
|
|
6964
|
+
return next;
|
|
6965
|
+
});
|
|
6966
|
+
if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: false });
|
|
6967
|
+
onAction?.(id, false);
|
|
6968
|
+
},
|
|
6969
|
+
[actionEvent, eventBus, onAction]
|
|
6970
|
+
);
|
|
6971
|
+
if (layout === "diamond" && buttons.length === 4) {
|
|
6972
|
+
const [top, right, bottom, left] = buttons;
|
|
6973
|
+
return /* @__PURE__ */ jsxs("div", { className: cn(layoutMap[layout], className), children: [
|
|
6974
|
+
/* @__PURE__ */ jsx("div", {}),
|
|
6975
|
+
/* @__PURE__ */ jsx(
|
|
6976
|
+
ControlButton,
|
|
6977
|
+
{
|
|
6978
|
+
icon: top.icon,
|
|
6979
|
+
label: top.label,
|
|
6980
|
+
size: sizeMap6[size],
|
|
6981
|
+
variant: top.variant,
|
|
6982
|
+
pressed: activeButtons.has(top.id),
|
|
6983
|
+
onPress: () => handlePress(top.id),
|
|
6984
|
+
onRelease: () => handleRelease(top.id),
|
|
6985
|
+
disabled
|
|
6986
|
+
}
|
|
6987
|
+
),
|
|
6988
|
+
/* @__PURE__ */ jsx("div", {}),
|
|
6989
|
+
/* @__PURE__ */ jsx(
|
|
6990
|
+
ControlButton,
|
|
6991
|
+
{
|
|
6992
|
+
icon: left.icon,
|
|
6993
|
+
label: left.label,
|
|
6994
|
+
size: sizeMap6[size],
|
|
6995
|
+
variant: left.variant,
|
|
6996
|
+
pressed: activeButtons.has(left.id),
|
|
6997
|
+
onPress: () => handlePress(left.id),
|
|
6998
|
+
onRelease: () => handleRelease(left.id),
|
|
6999
|
+
disabled
|
|
7000
|
+
}
|
|
7001
|
+
),
|
|
7002
|
+
/* @__PURE__ */ jsx("div", {}),
|
|
7003
|
+
/* @__PURE__ */ jsx(
|
|
7004
|
+
ControlButton,
|
|
7005
|
+
{
|
|
7006
|
+
icon: right.icon,
|
|
7007
|
+
label: right.label,
|
|
7008
|
+
size: sizeMap6[size],
|
|
7009
|
+
variant: right.variant,
|
|
7010
|
+
pressed: activeButtons.has(right.id),
|
|
7011
|
+
onPress: () => handlePress(right.id),
|
|
7012
|
+
onRelease: () => handleRelease(right.id),
|
|
7013
|
+
disabled
|
|
7014
|
+
}
|
|
7015
|
+
),
|
|
7016
|
+
/* @__PURE__ */ jsx("div", {}),
|
|
7017
|
+
/* @__PURE__ */ jsx(
|
|
7018
|
+
ControlButton,
|
|
7019
|
+
{
|
|
7020
|
+
icon: bottom.icon,
|
|
7021
|
+
label: bottom.label,
|
|
7022
|
+
size: sizeMap6[size],
|
|
7023
|
+
variant: bottom.variant,
|
|
7024
|
+
pressed: activeButtons.has(bottom.id),
|
|
7025
|
+
onPress: () => handlePress(bottom.id),
|
|
7026
|
+
onRelease: () => handleRelease(bottom.id),
|
|
7027
|
+
disabled
|
|
7028
|
+
}
|
|
7029
|
+
),
|
|
7030
|
+
/* @__PURE__ */ jsx("div", {})
|
|
7031
|
+
] });
|
|
7032
|
+
}
|
|
7033
|
+
return /* @__PURE__ */ jsx("div", { className: cn(layoutMap[layout], className), children: buttons.map((button) => /* @__PURE__ */ jsx(
|
|
7034
|
+
ControlButton,
|
|
7035
|
+
{
|
|
7036
|
+
icon: button.icon,
|
|
7037
|
+
label: button.label,
|
|
7038
|
+
size: sizeMap6[size],
|
|
7039
|
+
variant: button.variant,
|
|
7040
|
+
pressed: activeButtons.has(button.id),
|
|
7041
|
+
onPress: () => handlePress(button.id),
|
|
7042
|
+
onRelease: () => handleRelease(button.id),
|
|
7043
|
+
disabled
|
|
7044
|
+
},
|
|
7045
|
+
button.id
|
|
7046
|
+
)) });
|
|
7047
|
+
}
|
|
7048
|
+
ActionButtons.displayName = "ActionButtons";
|
|
7049
|
+
var sizeMap7 = {
|
|
7050
|
+
sm: "text-xs px-2 py-1",
|
|
7051
|
+
md: "text-sm px-3 py-1.5",
|
|
7052
|
+
lg: "text-base px-4 py-2"
|
|
7053
|
+
};
|
|
7054
|
+
var variantMap2 = {
|
|
7055
|
+
default: "bg-gray-800/80 border-gray-700",
|
|
7056
|
+
primary: "bg-blue-900/80 border-blue-700",
|
|
7057
|
+
success: "bg-green-900/80 border-green-700",
|
|
7058
|
+
warning: "bg-yellow-900/80 border-yellow-700",
|
|
7059
|
+
danger: "bg-red-900/80 border-red-700"
|
|
7060
|
+
};
|
|
7061
|
+
function StatBadge({
|
|
7062
|
+
label,
|
|
7063
|
+
value = 0,
|
|
7064
|
+
max,
|
|
7065
|
+
format = "number",
|
|
7066
|
+
icon,
|
|
7067
|
+
size = "md",
|
|
7068
|
+
variant = "default",
|
|
7069
|
+
className,
|
|
7070
|
+
// Ignored config props (used for schema binding)
|
|
7071
|
+
source: _source,
|
|
7072
|
+
field: _field
|
|
7073
|
+
}) {
|
|
7074
|
+
const numValue = typeof value === "number" ? value : parseInt(String(value), 10) || 0;
|
|
7075
|
+
return /* @__PURE__ */ jsxs(
|
|
7076
|
+
"div",
|
|
7077
|
+
{
|
|
7078
|
+
className: cn(
|
|
7079
|
+
"inline-flex items-center gap-2 rounded-lg border backdrop-blur-sm",
|
|
7080
|
+
sizeMap7[size] ?? sizeMap7.md,
|
|
7081
|
+
variantMap2[variant] ?? variantMap2.default,
|
|
7082
|
+
className
|
|
7083
|
+
),
|
|
7084
|
+
children: [
|
|
7085
|
+
icon && /* @__PURE__ */ jsx("span", { className: "flex-shrink-0 text-lg", children: typeof icon === "string" ? (() => {
|
|
7086
|
+
const I = resolveIcon(icon);
|
|
7087
|
+
return I ? /* @__PURE__ */ jsx(I, { className: "w-4 h-4" }) : icon;
|
|
7088
|
+
})() : icon }),
|
|
7089
|
+
/* @__PURE__ */ jsx("span", { className: "text-gray-400 font-medium", children: label }),
|
|
7090
|
+
format === "hearts" && max && /* @__PURE__ */ jsx(
|
|
7091
|
+
HealthBar,
|
|
7092
|
+
{
|
|
7093
|
+
current: numValue,
|
|
7094
|
+
max,
|
|
7095
|
+
format: "hearts",
|
|
7096
|
+
size: size === "lg" ? "md" : "sm"
|
|
7097
|
+
}
|
|
7098
|
+
),
|
|
7099
|
+
format === "bar" && max && /* @__PURE__ */ jsx(
|
|
7100
|
+
HealthBar,
|
|
7101
|
+
{
|
|
7102
|
+
current: numValue,
|
|
7103
|
+
max,
|
|
7104
|
+
format: "bar",
|
|
7105
|
+
size: size === "lg" ? "md" : "sm"
|
|
7106
|
+
}
|
|
7107
|
+
),
|
|
7108
|
+
format === "number" && /* @__PURE__ */ jsx(
|
|
7109
|
+
ScoreDisplay,
|
|
7110
|
+
{
|
|
7111
|
+
value: numValue,
|
|
7112
|
+
size: size === "lg" ? "md" : "sm",
|
|
7113
|
+
animated: true
|
|
7114
|
+
}
|
|
7115
|
+
),
|
|
7116
|
+
format === "text" && /* @__PURE__ */ jsx("span", { className: "font-bold text-white", children: value })
|
|
7117
|
+
]
|
|
7118
|
+
}
|
|
7119
|
+
);
|
|
7120
|
+
}
|
|
7121
|
+
StatBadge.displayName = "StatBadge";
|
|
6851
7122
|
var GROUP_COLORS = [
|
|
6852
7123
|
"#3b82f6",
|
|
6853
7124
|
// blue-500
|
|
@@ -7161,6 +7432,119 @@ var GraphView = ({
|
|
|
7161
7432
|
);
|
|
7162
7433
|
};
|
|
7163
7434
|
GraphView.displayName = "GraphView";
|
|
7435
|
+
var defaultIcon = L.icon({
|
|
7436
|
+
iconUrl: "https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png",
|
|
7437
|
+
iconRetinaUrl: "https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon-2x.png",
|
|
7438
|
+
shadowUrl: "https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png",
|
|
7439
|
+
iconSize: [25, 41],
|
|
7440
|
+
iconAnchor: [12, 41],
|
|
7441
|
+
popupAnchor: [1, -34],
|
|
7442
|
+
shadowSize: [41, 41]
|
|
7443
|
+
});
|
|
7444
|
+
L.Marker.prototype.options.icon = defaultIcon;
|
|
7445
|
+
function MapUpdater({ centerLat, centerLng, zoom }) {
|
|
7446
|
+
const map = useMap();
|
|
7447
|
+
const prevRef = useRef({ centerLat, centerLng, zoom });
|
|
7448
|
+
useEffect(() => {
|
|
7449
|
+
const prev = prevRef.current;
|
|
7450
|
+
if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
|
|
7451
|
+
map.setView([centerLat, centerLng], zoom);
|
|
7452
|
+
prevRef.current = { centerLat, centerLng, zoom };
|
|
7453
|
+
}
|
|
7454
|
+
}, [map, centerLat, centerLng, zoom]);
|
|
7455
|
+
return null;
|
|
7456
|
+
}
|
|
7457
|
+
function MapClickHandler({ onMapClick }) {
|
|
7458
|
+
const map = useMap();
|
|
7459
|
+
useEffect(() => {
|
|
7460
|
+
if (!onMapClick) return;
|
|
7461
|
+
const handler = (e) => {
|
|
7462
|
+
onMapClick(e.latlng.lat, e.latlng.lng);
|
|
7463
|
+
};
|
|
7464
|
+
map.on("click", handler);
|
|
7465
|
+
return () => {
|
|
7466
|
+
map.off("click", handler);
|
|
7467
|
+
};
|
|
7468
|
+
}, [map, onMapClick]);
|
|
7469
|
+
return null;
|
|
7470
|
+
}
|
|
7471
|
+
function MapView({
|
|
7472
|
+
markers = [],
|
|
7473
|
+
centerLat = 51.505,
|
|
7474
|
+
centerLng = -0.09,
|
|
7475
|
+
zoom = 13,
|
|
7476
|
+
height = "400px",
|
|
7477
|
+
onMarkerClick,
|
|
7478
|
+
onMapClick,
|
|
7479
|
+
mapClickEvent,
|
|
7480
|
+
markerClickEvent,
|
|
7481
|
+
showClickedPin = false,
|
|
7482
|
+
className,
|
|
7483
|
+
showAttribution = true
|
|
7484
|
+
}) {
|
|
7485
|
+
const eventBus = useEventBus();
|
|
7486
|
+
const [clickedPosition, setClickedPosition] = useState(null);
|
|
7487
|
+
const handleMapClick = useCallback((lat, lng) => {
|
|
7488
|
+
if (showClickedPin) {
|
|
7489
|
+
setClickedPosition({ lat, lng });
|
|
7490
|
+
}
|
|
7491
|
+
onMapClick?.(lat, lng);
|
|
7492
|
+
if (mapClickEvent) {
|
|
7493
|
+
eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
|
|
7494
|
+
}
|
|
7495
|
+
}, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
|
|
7496
|
+
const handleMarkerClick = useCallback((marker) => {
|
|
7497
|
+
onMarkerClick?.(marker);
|
|
7498
|
+
if (markerClickEvent) {
|
|
7499
|
+
eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
|
|
7500
|
+
}
|
|
7501
|
+
}, [onMarkerClick, markerClickEvent, eventBus]);
|
|
7502
|
+
return /* @__PURE__ */ jsx(
|
|
7503
|
+
Box,
|
|
7504
|
+
{
|
|
7505
|
+
className: cn("relative w-full overflow-hidden rounded-lg", className),
|
|
7506
|
+
style: { height },
|
|
7507
|
+
"data-testid": "map-view",
|
|
7508
|
+
children: /* @__PURE__ */ jsxs(
|
|
7509
|
+
MapContainer,
|
|
7510
|
+
{
|
|
7511
|
+
center: [centerLat, centerLng],
|
|
7512
|
+
zoom,
|
|
7513
|
+
style: { height: "100%", width: "100%" },
|
|
7514
|
+
attributionControl: showAttribution,
|
|
7515
|
+
children: [
|
|
7516
|
+
/* @__PURE__ */ jsx(
|
|
7517
|
+
TileLayer,
|
|
7518
|
+
{
|
|
7519
|
+
url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
|
7520
|
+
attribution: showAttribution ? '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>' : void 0
|
|
7521
|
+
}
|
|
7522
|
+
),
|
|
7523
|
+
/* @__PURE__ */ jsx(MapUpdater, { centerLat, centerLng, zoom }),
|
|
7524
|
+
/* @__PURE__ */ jsx(MapClickHandler, { onMapClick: handleMapClick }),
|
|
7525
|
+
showClickedPin && clickedPosition && /* @__PURE__ */ jsx(Marker, { position: [clickedPosition.lat, clickedPosition.lng], children: /* @__PURE__ */ jsx(Popup, { children: /* @__PURE__ */ jsxs(Typography, { variant: "body2", children: [
|
|
7526
|
+
clickedPosition.lat.toFixed(5),
|
|
7527
|
+
", ",
|
|
7528
|
+
clickedPosition.lng.toFixed(5)
|
|
7529
|
+
] }) }) }),
|
|
7530
|
+
markers.map((marker) => /* @__PURE__ */ jsx(
|
|
7531
|
+
Marker,
|
|
7532
|
+
{
|
|
7533
|
+
position: [marker.lat, marker.lng],
|
|
7534
|
+
eventHandlers: onMarkerClick || markerClickEvent ? { click: () => handleMarkerClick(marker) } : void 0,
|
|
7535
|
+
children: marker.label ? /* @__PURE__ */ jsxs(Popup, { children: [
|
|
7536
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", children: marker.label }),
|
|
7537
|
+
marker.category ? /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: marker.category }) : null
|
|
7538
|
+
] }) : null
|
|
7539
|
+
},
|
|
7540
|
+
marker.id
|
|
7541
|
+
))
|
|
7542
|
+
]
|
|
7543
|
+
}
|
|
7544
|
+
)
|
|
7545
|
+
}
|
|
7546
|
+
);
|
|
7547
|
+
}
|
|
7164
7548
|
function fieldLabel(key) {
|
|
7165
7549
|
return key.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
|
|
7166
7550
|
}
|
|
@@ -7975,7 +8359,7 @@ var StatCard = ({
|
|
|
7975
8359
|
trend: manualTrend,
|
|
7976
8360
|
trendDirection: manualDirection,
|
|
7977
8361
|
invertTrend = false,
|
|
7978
|
-
icon:
|
|
8362
|
+
icon: iconProp,
|
|
7979
8363
|
iconBg = "bg-[var(--color-muted)]",
|
|
7980
8364
|
iconColor = "text-[var(--color-foreground)]",
|
|
7981
8365
|
subtitle,
|
|
@@ -7987,10 +8371,11 @@ var StatCard = ({
|
|
|
7987
8371
|
isLoading: externalLoading,
|
|
7988
8372
|
error: externalError
|
|
7989
8373
|
}) => {
|
|
8374
|
+
const Icon2 = typeof iconProp === "string" ? resolveIcon(iconProp) ?? void 0 : iconProp;
|
|
7990
8375
|
const labelToUse = propLabel ?? propTitle;
|
|
7991
8376
|
const eventBus = useEventBus();
|
|
7992
8377
|
const { t } = useTranslate();
|
|
7993
|
-
const handleActionClick =
|
|
8378
|
+
const handleActionClick = React50__default.useCallback(() => {
|
|
7994
8379
|
if (action?.event) {
|
|
7995
8380
|
eventBus.emit(`UI:${action.event}`, {});
|
|
7996
8381
|
}
|
|
@@ -8001,7 +8386,7 @@ var StatCard = ({
|
|
|
8001
8386
|
const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
8002
8387
|
const isLoading = externalLoading ?? false;
|
|
8003
8388
|
const error = externalError;
|
|
8004
|
-
const computeMetricValue =
|
|
8389
|
+
const computeMetricValue = React50__default.useCallback(
|
|
8005
8390
|
(metric, items) => {
|
|
8006
8391
|
if (metric.value !== void 0) {
|
|
8007
8392
|
return metric.value;
|
|
@@ -8040,7 +8425,7 @@ var StatCard = ({
|
|
|
8040
8425
|
},
|
|
8041
8426
|
[]
|
|
8042
8427
|
);
|
|
8043
|
-
const schemaStats =
|
|
8428
|
+
const schemaStats = React50__default.useMemo(() => {
|
|
8044
8429
|
if (!metrics || metrics.length === 0) return null;
|
|
8045
8430
|
return metrics.map((metric) => ({
|
|
8046
8431
|
label: metric.label,
|
|
@@ -8048,7 +8433,7 @@ var StatCard = ({
|
|
|
8048
8433
|
format: metric.format
|
|
8049
8434
|
}));
|
|
8050
8435
|
}, [metrics, data, computeMetricValue]);
|
|
8051
|
-
const calculatedTrend =
|
|
8436
|
+
const calculatedTrend = React50__default.useMemo(() => {
|
|
8052
8437
|
if (manualTrend !== void 0) return manualTrend;
|
|
8053
8438
|
if (previousValue === void 0 || currentValue === void 0)
|
|
8054
8439
|
return void 0;
|
|
@@ -8184,7 +8569,7 @@ var PageHeader = ({
|
|
|
8184
8569
|
info: "bg-[var(--color-info)]/10 text-[var(--color-info)]"
|
|
8185
8570
|
};
|
|
8186
8571
|
return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
|
|
8187
|
-
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(
|
|
8572
|
+
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(React50__default.Fragment, { children: [
|
|
8188
8573
|
idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
|
|
8189
8574
|
crumb.href ? /* @__PURE__ */ jsx(
|
|
8190
8575
|
"a",
|
|
@@ -8817,7 +9202,7 @@ var Form = ({
|
|
|
8817
9202
|
const normalizedInitialData = initialData ?? {};
|
|
8818
9203
|
const resolvedEntity = entity && typeof entity === "object" && !Array.isArray(entity) ? entity : void 0;
|
|
8819
9204
|
const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
|
|
8820
|
-
const entityDerivedFields =
|
|
9205
|
+
const entityDerivedFields = React50__default.useMemo(() => {
|
|
8821
9206
|
if (fields && fields.length > 0) return void 0;
|
|
8822
9207
|
if (!resolvedEntity) return void 0;
|
|
8823
9208
|
return resolvedEntity.fields.map(
|
|
@@ -8836,14 +9221,14 @@ var Form = ({
|
|
|
8836
9221
|
const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
|
|
8837
9222
|
const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
|
|
8838
9223
|
const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
|
|
8839
|
-
const [formData, setFormData] =
|
|
9224
|
+
const [formData, setFormData] = React50__default.useState(
|
|
8840
9225
|
normalizedInitialData
|
|
8841
9226
|
);
|
|
8842
|
-
const [collapsedSections, setCollapsedSections] =
|
|
9227
|
+
const [collapsedSections, setCollapsedSections] = React50__default.useState(
|
|
8843
9228
|
/* @__PURE__ */ new Set()
|
|
8844
9229
|
);
|
|
8845
9230
|
const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
|
|
8846
|
-
const evalContext =
|
|
9231
|
+
const evalContext = React50__default.useMemo(
|
|
8847
9232
|
() => ({
|
|
8848
9233
|
formValues: formData,
|
|
8849
9234
|
globalVariables: externalContext?.globalVariables ?? {},
|
|
@@ -8852,13 +9237,13 @@ var Form = ({
|
|
|
8852
9237
|
}),
|
|
8853
9238
|
[formData, externalContext]
|
|
8854
9239
|
);
|
|
8855
|
-
|
|
9240
|
+
React50__default.useEffect(() => {
|
|
8856
9241
|
const data = initialData;
|
|
8857
9242
|
if (data && Object.keys(data).length > 0) {
|
|
8858
9243
|
setFormData(data);
|
|
8859
9244
|
}
|
|
8860
9245
|
}, [initialData]);
|
|
8861
|
-
const processCalculations =
|
|
9246
|
+
const processCalculations = React50__default.useCallback(
|
|
8862
9247
|
(changedFieldId, newFormData) => {
|
|
8863
9248
|
if (!hiddenCalculations.length) return;
|
|
8864
9249
|
const context = {
|
|
@@ -8883,7 +9268,7 @@ var Form = ({
|
|
|
8883
9268
|
},
|
|
8884
9269
|
[hiddenCalculations, externalContext, eventBus]
|
|
8885
9270
|
);
|
|
8886
|
-
const checkViolations =
|
|
9271
|
+
const checkViolations = React50__default.useCallback(
|
|
8887
9272
|
(changedFieldId, newFormData) => {
|
|
8888
9273
|
if (!violationTriggers.length) return;
|
|
8889
9274
|
const context = {
|
|
@@ -8920,7 +9305,7 @@ var Form = ({
|
|
|
8920
9305
|
processCalculations(name, newFormData);
|
|
8921
9306
|
checkViolations(name, newFormData);
|
|
8922
9307
|
};
|
|
8923
|
-
const isFieldVisible =
|
|
9308
|
+
const isFieldVisible = React50__default.useCallback(
|
|
8924
9309
|
(fieldName) => {
|
|
8925
9310
|
const condition = conditionalFields[fieldName];
|
|
8926
9311
|
if (!condition) return true;
|
|
@@ -8928,7 +9313,7 @@ var Form = ({
|
|
|
8928
9313
|
},
|
|
8929
9314
|
[conditionalFields, evalContext]
|
|
8930
9315
|
);
|
|
8931
|
-
const isSectionVisible =
|
|
9316
|
+
const isSectionVisible = React50__default.useCallback(
|
|
8932
9317
|
(section) => {
|
|
8933
9318
|
if (!section.condition) return true;
|
|
8934
9319
|
return Boolean(evaluateFormExpression(section.condition, evalContext));
|
|
@@ -8960,7 +9345,7 @@ var Form = ({
|
|
|
8960
9345
|
eventBus.emit(`UI:${onCancel}`);
|
|
8961
9346
|
}
|
|
8962
9347
|
};
|
|
8963
|
-
const renderField =
|
|
9348
|
+
const renderField = React50__default.useCallback(
|
|
8964
9349
|
(field) => {
|
|
8965
9350
|
const fieldName = field.name || field.field;
|
|
8966
9351
|
if (!fieldName) return null;
|
|
@@ -8981,7 +9366,7 @@ var Form = ({
|
|
|
8981
9366
|
[formData, isFieldVisible, relationsData, relationsLoading, isLoading]
|
|
8982
9367
|
);
|
|
8983
9368
|
const effectiveFields = entityDerivedFields ?? fields;
|
|
8984
|
-
const normalizedFields =
|
|
9369
|
+
const normalizedFields = React50__default.useMemo(() => {
|
|
8985
9370
|
if (!effectiveFields || effectiveFields.length === 0) return [];
|
|
8986
9371
|
return effectiveFields.map((field) => {
|
|
8987
9372
|
if (typeof field === "string") {
|
|
@@ -8990,7 +9375,7 @@ var Form = ({
|
|
|
8990
9375
|
return field;
|
|
8991
9376
|
});
|
|
8992
9377
|
}, [effectiveFields]);
|
|
8993
|
-
const schemaFields =
|
|
9378
|
+
const schemaFields = React50__default.useMemo(() => {
|
|
8994
9379
|
if (normalizedFields.length === 0) return null;
|
|
8995
9380
|
if (isDebugEnabled()) {
|
|
8996
9381
|
debugGroup(`Form: ${entityName || "unknown"}`);
|
|
@@ -9000,7 +9385,7 @@ var Form = ({
|
|
|
9000
9385
|
}
|
|
9001
9386
|
return normalizedFields.map(renderField).filter(Boolean);
|
|
9002
9387
|
}, [normalizedFields, renderField, entityName, conditionalFields]);
|
|
9003
|
-
const sectionElements =
|
|
9388
|
+
const sectionElements = React50__default.useMemo(() => {
|
|
9004
9389
|
if (!sections || sections.length === 0) return null;
|
|
9005
9390
|
return sections.map((section) => {
|
|
9006
9391
|
if (!isSectionVisible(section)) {
|
|
@@ -9583,14 +9968,14 @@ function SpacerPattern({ size = "flex" }) {
|
|
|
9583
9968
|
if (size === "flex") {
|
|
9584
9969
|
return /* @__PURE__ */ jsx(Spacer, {});
|
|
9585
9970
|
}
|
|
9586
|
-
const
|
|
9971
|
+
const sizeMap8 = {
|
|
9587
9972
|
xs: "0.25rem",
|
|
9588
9973
|
sm: "0.5rem",
|
|
9589
9974
|
md: "1rem",
|
|
9590
9975
|
lg: "1.5rem",
|
|
9591
9976
|
xl: "2rem"
|
|
9592
9977
|
};
|
|
9593
|
-
return /* @__PURE__ */ jsx(Box, { style: { width:
|
|
9978
|
+
return /* @__PURE__ */ jsx(Box, { style: { width: sizeMap8[size], height: sizeMap8[size], flexShrink: 0 } });
|
|
9594
9979
|
}
|
|
9595
9980
|
SpacerPattern.displayName = "SpacerPattern";
|
|
9596
9981
|
function DividerPattern({
|
|
@@ -9851,7 +10236,7 @@ function InputPattern({
|
|
|
9851
10236
|
className
|
|
9852
10237
|
}) {
|
|
9853
10238
|
const { emit } = useEventBus();
|
|
9854
|
-
const [localValue, setLocalValue] =
|
|
10239
|
+
const [localValue, setLocalValue] = React50__default.useState(value);
|
|
9855
10240
|
const handleChange = (e) => {
|
|
9856
10241
|
setLocalValue(e.target.value);
|
|
9857
10242
|
if (onChange) {
|
|
@@ -9888,7 +10273,7 @@ function TextareaPattern({
|
|
|
9888
10273
|
className
|
|
9889
10274
|
}) {
|
|
9890
10275
|
const { emit } = useEventBus();
|
|
9891
|
-
const [localValue, setLocalValue] =
|
|
10276
|
+
const [localValue, setLocalValue] = React50__default.useState(value);
|
|
9892
10277
|
const handleChange = (e) => {
|
|
9893
10278
|
setLocalValue(e.target.value);
|
|
9894
10279
|
if (onChange) {
|
|
@@ -9919,7 +10304,7 @@ function SelectPattern({
|
|
|
9919
10304
|
className
|
|
9920
10305
|
}) {
|
|
9921
10306
|
const { emit } = useEventBus();
|
|
9922
|
-
const [localValue, setLocalValue] =
|
|
10307
|
+
const [localValue, setLocalValue] = React50__default.useState(value);
|
|
9923
10308
|
const handleChange = (e) => {
|
|
9924
10309
|
setLocalValue(e.target.value);
|
|
9925
10310
|
if (onChange) {
|
|
@@ -9948,7 +10333,7 @@ function CheckboxPattern({
|
|
|
9948
10333
|
className
|
|
9949
10334
|
}) {
|
|
9950
10335
|
const { emit } = useEventBus();
|
|
9951
|
-
const [localChecked, setLocalChecked] =
|
|
10336
|
+
const [localChecked, setLocalChecked] = React50__default.useState(checked);
|
|
9952
10337
|
const handleChange = (e) => {
|
|
9953
10338
|
setLocalChecked(e.target.checked);
|
|
9954
10339
|
if (onChange) {
|
|
@@ -10125,6 +10510,35 @@ function FloatButtonPattern({
|
|
|
10125
10510
|
);
|
|
10126
10511
|
}
|
|
10127
10512
|
FloatButtonPattern.displayName = "FloatButtonPattern";
|
|
10513
|
+
function MapViewPattern({
|
|
10514
|
+
markers,
|
|
10515
|
+
centerLat,
|
|
10516
|
+
centerLng,
|
|
10517
|
+
zoom,
|
|
10518
|
+
height,
|
|
10519
|
+
mapClickEvent,
|
|
10520
|
+
markerClickEvent,
|
|
10521
|
+
showClickedPin,
|
|
10522
|
+
className,
|
|
10523
|
+
showAttribution
|
|
10524
|
+
}) {
|
|
10525
|
+
return /* @__PURE__ */ jsx(
|
|
10526
|
+
MapView,
|
|
10527
|
+
{
|
|
10528
|
+
markers,
|
|
10529
|
+
centerLat,
|
|
10530
|
+
centerLng,
|
|
10531
|
+
zoom,
|
|
10532
|
+
height,
|
|
10533
|
+
mapClickEvent,
|
|
10534
|
+
markerClickEvent,
|
|
10535
|
+
showClickedPin,
|
|
10536
|
+
className,
|
|
10537
|
+
showAttribution
|
|
10538
|
+
}
|
|
10539
|
+
);
|
|
10540
|
+
}
|
|
10541
|
+
MapViewPattern.displayName = "MapViewPattern";
|
|
10128
10542
|
var ALLOWED_CUSTOM_COMPONENTS = [
|
|
10129
10543
|
"div",
|
|
10130
10544
|
"span",
|
|
@@ -10349,7 +10763,7 @@ function SuspenseConfigProvider({
|
|
|
10349
10763
|
config,
|
|
10350
10764
|
children
|
|
10351
10765
|
}) {
|
|
10352
|
-
return
|
|
10766
|
+
return React50__default.createElement(
|
|
10353
10767
|
SuspenseConfigContext.Provider,
|
|
10354
10768
|
{ value: config },
|
|
10355
10769
|
children
|
|
@@ -10425,6 +10839,8 @@ var COMPONENT_REGISTRY = {
|
|
|
10425
10839
|
ContainerPattern,
|
|
10426
10840
|
SimpleGridPattern,
|
|
10427
10841
|
FloatButtonPattern,
|
|
10842
|
+
// Map patterns
|
|
10843
|
+
MapViewPattern,
|
|
10428
10844
|
// Custom pattern
|
|
10429
10845
|
CustomPattern
|
|
10430
10846
|
};
|
|
@@ -10487,7 +10903,9 @@ var PATTERN_TO_COMPONENT = {
|
|
|
10487
10903
|
"simple-grid": "SimpleGridPattern",
|
|
10488
10904
|
"float-button": "FloatButtonPattern",
|
|
10489
10905
|
// Custom pattern
|
|
10490
|
-
custom: "CustomPattern"
|
|
10906
|
+
custom: "CustomPattern",
|
|
10907
|
+
// Map patterns
|
|
10908
|
+
"map-view": "MapViewPattern"
|
|
10491
10909
|
};
|
|
10492
10910
|
function getComponentForPattern(patternType) {
|
|
10493
10911
|
const componentName = PATTERN_TO_COMPONENT[patternType];
|
|
@@ -10830,4 +11248,4 @@ function UISlotRenderer({
|
|
|
10830
11248
|
}
|
|
10831
11249
|
UISlotRenderer.displayName = "UISlotRenderer";
|
|
10832
11250
|
|
|
10833
|
-
export { Accordion, Alert, Avatar, Badge, Box, Breadcrumb, Button, ButtonGroup, CalendarGrid, Card, Card2, CardBody, CardContent, CardFooter, CardGrid, CardHeader, CardTitle, Center, ChartLegend, Checkbox, CodeBlock, ConditionalWrapper, Container, ControlButton, DataGrid, DataList, DataTable, DateRangeSelector, DayCell, DetailPanel, Divider, Drawer, EmptyState, EntityDisplayEvents, ErrorBoundary, ErrorState, FilterGroup, Flex, FlipCard, FlipContainer, FloatingActionButton, Form, FormField, FormSectionHeader, GraphView, Grid, HStack, Heading, HealthBar, Icon, Input, InputGroup, Label, LawReferenceTooltip, LineChart, LoadingState, MarkdownContent, MasterDetail, Menu, Modal, Overlay, PageHeader, Pagination, Popover, ProgressBar, ProgressDots, QuizBlock, Radio, RelationSelect, RepeatableFormSection, ScaledDiagram, ScoreDisplay, SearchInput, Select, SidePanel, SimpleGrid, Skeleton, SlotContentRenderer, Spacer, Spinner, Sprite, Stack, StatCard, StateIndicator, SuspenseConfigProvider, Switch, Tabs, Text, TextHighlight, Textarea, ThemeSelector, ThemeToggle, TimeSlotCell, Toast, Tooltip, Typography, UISlotComponent, UISlotRenderer, VStack, ViolationAlert, WizardNavigation, WizardProgress, drawSprite };
|
|
11251
|
+
export { Accordion, ActionButtons, Alert, Avatar, Badge, Box, Breadcrumb, Button, ButtonGroup, CalendarGrid, Card, Card2, CardBody, CardContent, CardFooter, CardGrid, CardHeader, CardTitle, Center, ChartLegend, Checkbox, CodeBlock, ConditionalWrapper, Container, ControlButton, DPad, DataGrid, DataList, DataTable, DateRangeSelector, DayCell, DetailPanel, Divider, Drawer, EmptyState, EntityDisplayEvents, ErrorBoundary, ErrorState, FilterGroup, Flex, FlipCard, FlipContainer, FloatingActionButton, Form, FormField, FormSectionHeader, GraphView, Grid, HStack, Heading, HealthBar, Icon, Input, InputGroup, Label, LawReferenceTooltip, LineChart, LoadingState, MapView, MarkdownContent, MasterDetail, Menu, Modal, Overlay, PageHeader, Pagination, Popover, ProgressBar, ProgressDots, QuizBlock, Radio, RelationSelect, RepeatableFormSection, ScaledDiagram, ScoreDisplay, SearchInput, Select, SidePanel, SimpleGrid, Skeleton, SlotContentRenderer, Spacer, Spinner, Sprite, Stack, StatBadge, StatCard, StateIndicator, SuspenseConfigProvider, Switch, Tabs, Text, TextHighlight, Textarea, ThemeSelector, ThemeToggle, TimeSlotCell, Toast, Tooltip, Typography, UISlotComponent, UISlotRenderer, VStack, ViolationAlert, WizardNavigation, WizardProgress, drawSprite };
|