@almadar/ui 2.1.10 → 2.2.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-7NEWMNNU.js → chunk-3JGAROCW.js} +2 -0
- package/dist/{chunk-6OACETQB.js → chunk-42WRQA7T.js} +2 -2
- package/dist/{chunk-XDCOHA5C.js → chunk-CC3UOKHI.js} +228 -260
- package/dist/{chunk-BTXQJGFB.js → chunk-DKQN5FVU.js} +1 -1
- package/dist/{chunk-JLEMVREZ.js → chunk-GOZKH7QW.js} +6 -3
- package/dist/chunk-TSETXL2E.js +103 -0
- package/dist/components/index.d.ts +68 -32
- package/dist/components/index.js +139 -144
- package/dist/components/organisms/game/three/index.d.ts +7 -1
- package/dist/context/index.d.ts +2 -2
- package/dist/context/index.js +3 -3
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +4 -3
- package/dist/locales/index.js +1 -102
- package/dist/providers/index.js +6 -5
- package/dist/renderer/index.js +0 -1
- package/dist/{useUISlots-D0mttBSP.d.ts → useUISlots-BBjNvQtb.d.ts} +1 -1
- package/package.json +6 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { apiClient } from './chunk-3HJHHULT.js';
|
|
2
|
-
import { SelectionContext, entityDataKeys, useEntityList } from './chunk-
|
|
2
|
+
import { SelectionContext, entityDataKeys, useEntityList } from './chunk-GOZKH7QW.js';
|
|
3
3
|
import { useEventBus } from './chunk-YXZM3WCF.js';
|
|
4
4
|
import { subscribe, getSnapshot, clearEntities, removeEntity, updateSingleton, updateEntity, spawnEntity, getSingleton, getAllEntities, getByType, getEntity } from './chunk-N7MVUW4R.js';
|
|
5
5
|
import { useCallback, useState, useEffect, useMemo, useContext, useSyncExternalStore } from 'react';
|
|
@@ -899,8 +899,8 @@ function useUIEvents(dispatch, validEvents, eventBusInstance) {
|
|
|
899
899
|
const validEventsKey = validEvents ? validEvents.slice().sort().join(",") : "";
|
|
900
900
|
const stableValidEvents = useMemo(
|
|
901
901
|
() => validEvents,
|
|
902
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
903
902
|
[validEventsKey]
|
|
903
|
+
// intentional — validEventsKey is the stable dep, not validEvents array ref
|
|
904
904
|
);
|
|
905
905
|
useEffect(() => {
|
|
906
906
|
const unsubscribes = [];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useTheme, useUISlots } from './chunk-
|
|
2
|
-
import { useTranslate, useQuerySingleton } from './chunk-
|
|
1
|
+
import { useTheme, useUISlots } from './chunk-DKQN5FVU.js';
|
|
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';
|
|
5
5
|
import { __publicField } from './chunk-PKBMQBKP.js';
|
|
@@ -3587,6 +3587,7 @@ function Card2({
|
|
|
3587
3587
|
action
|
|
3588
3588
|
}) {
|
|
3589
3589
|
const eventBus = useEventBus();
|
|
3590
|
+
const { t } = useTranslate();
|
|
3590
3591
|
const isClickable = !!onClick || !!action;
|
|
3591
3592
|
const handleClick = () => {
|
|
3592
3593
|
if (action) eventBus.emit(`UI:${action}`, {});
|
|
@@ -3611,7 +3612,7 @@ function Card2({
|
|
|
3611
3612
|
"img",
|
|
3612
3613
|
{
|
|
3613
3614
|
src: image,
|
|
3614
|
-
alt: title || "
|
|
3615
|
+
alt: title || t("card.imageAlt"),
|
|
3615
3616
|
className: "w-full h-full object-cover"
|
|
3616
3617
|
}
|
|
3617
3618
|
) }),
|
|
@@ -6640,8 +6641,7 @@ function DataTable({
|
|
|
6640
6641
|
] }),
|
|
6641
6642
|
/* @__PURE__ */ jsx(Box, { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs("table", { className: "w-full", children: [
|
|
6642
6643
|
/* @__PURE__ */ jsx("thead", { className: "bg-[var(--color-table-header)] border-b-2 border-[var(--color-border)]", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
6643
|
-
selectable &&
|
|
6644
|
-
/* @__PURE__ */ jsx("th", { className: "w-12 px-4 py-3", children: /* @__PURE__ */ jsx(
|
|
6644
|
+
selectable && /* @__PURE__ */ jsx("th", { className: "w-12 px-4 py-3", children: /* @__PURE__ */ jsx(
|
|
6645
6645
|
Checkbox,
|
|
6646
6646
|
{
|
|
6647
6647
|
checked: allSelected,
|
|
@@ -6649,173 +6649,156 @@ function DataTable({
|
|
|
6649
6649
|
onChange: handleSelectAll
|
|
6650
6650
|
}
|
|
6651
6651
|
) }),
|
|
6652
|
-
normalizedColumns.map((col) => (
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
"
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
String(col.key)
|
|
6669
|
-
)
|
|
6652
|
+
normalizedColumns.map((col) => /* @__PURE__ */ jsx(
|
|
6653
|
+
"th",
|
|
6654
|
+
{
|
|
6655
|
+
"data-column": String(col.key),
|
|
6656
|
+
className: cn(
|
|
6657
|
+
"px-4 py-3 text-left text-xs font-bold text-[var(--color-foreground)] uppercase tracking-wider whitespace-nowrap",
|
|
6658
|
+
col.sortable && "cursor-pointer select-none hover:bg-[var(--color-table-row-hover)]"
|
|
6659
|
+
),
|
|
6660
|
+
style: { width: col.width },
|
|
6661
|
+
onClick: () => col.sortable && handleSort(String(col.key)),
|
|
6662
|
+
children: /* @__PURE__ */ jsxs(HStack, { className: "items-center gap-1", children: [
|
|
6663
|
+
col.header,
|
|
6664
|
+
col.sortable && sortBy === col.key && (sortDirection === "asc" ? /* @__PURE__ */ jsx(ChevronUp, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4" }))
|
|
6665
|
+
] })
|
|
6666
|
+
},
|
|
6667
|
+
String(col.key)
|
|
6670
6668
|
)),
|
|
6671
6669
|
rowActions && /* @__PURE__ */ jsx("th", { className: "w-12 px-4 py-3" })
|
|
6672
6670
|
] }) }),
|
|
6673
|
-
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-gray-200 dark:divide-gray-700", children: isLoading ? (
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
/* @__PURE__ */ jsx(
|
|
6683
|
-
Typography,
|
|
6684
|
-
{
|
|
6685
|
-
variant: "small",
|
|
6686
|
-
className: "text-[var(--color-muted-foreground)]",
|
|
6687
|
-
children: t("common.loading")
|
|
6688
|
-
}
|
|
6689
|
-
)
|
|
6690
|
-
] })
|
|
6691
|
-
}
|
|
6692
|
-
) })
|
|
6693
|
-
) : error ? (
|
|
6694
|
-
// eslint-disable-next-line almadar/no-raw-dom-elements -- native table elements in DataTable
|
|
6695
|
-
/* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsxs(
|
|
6696
|
-
"td",
|
|
6697
|
-
{
|
|
6698
|
-
colSpan: normalizedColumns.length + (selectable ? 1 : 0) + (rowActions ? 1 : 0),
|
|
6699
|
-
className: "px-4 py-12 text-center text-[var(--color-error)]",
|
|
6700
|
-
children: [
|
|
6701
|
-
t("error.generic") + ": ",
|
|
6702
|
-
error.message
|
|
6703
|
-
]
|
|
6704
|
-
}
|
|
6705
|
-
) })
|
|
6706
|
-
) : items.length === 0 ? (
|
|
6707
|
-
// eslint-disable-next-line almadar/no-raw-dom-elements -- native table elements in DataTable
|
|
6708
|
-
/* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx(
|
|
6709
|
-
"td",
|
|
6710
|
-
{
|
|
6711
|
-
colSpan: normalizedColumns.length + (selectable ? 1 : 0) + (rowActions ? 1 : 0),
|
|
6712
|
-
className: "px-4 py-12",
|
|
6713
|
-
children: /* @__PURE__ */ jsx(
|
|
6714
|
-
EmptyState,
|
|
6671
|
+
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-gray-200 dark:divide-gray-700", children: isLoading ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx(
|
|
6672
|
+
"td",
|
|
6673
|
+
{
|
|
6674
|
+
colSpan: normalizedColumns.length + (selectable ? 1 : 0) + (rowActions ? 1 : 0),
|
|
6675
|
+
className: "px-4 py-12 text-center",
|
|
6676
|
+
children: /* @__PURE__ */ jsxs(VStack, { className: "items-center gap-2", children: [
|
|
6677
|
+
/* @__PURE__ */ jsx(Spinner, { size: "lg" }),
|
|
6678
|
+
/* @__PURE__ */ jsx(
|
|
6679
|
+
Typography,
|
|
6715
6680
|
{
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
|
|
6719
|
-
actionLabel: emptyAction?.label,
|
|
6720
|
-
actionEvent: emptyAction?.event
|
|
6681
|
+
variant: "small",
|
|
6682
|
+
className: "text-[var(--color-muted-foreground)]",
|
|
6683
|
+
children: t("common.loading")
|
|
6721
6684
|
}
|
|
6722
6685
|
)
|
|
6723
|
-
}
|
|
6724
|
-
|
|
6725
|
-
) :
|
|
6726
|
-
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
|
|
6730
|
-
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
|
|
6735
|
-
|
|
6736
|
-
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
6686
|
+
] })
|
|
6687
|
+
}
|
|
6688
|
+
) }) : error ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsxs(
|
|
6689
|
+
"td",
|
|
6690
|
+
{
|
|
6691
|
+
colSpan: normalizedColumns.length + (selectable ? 1 : 0) + (rowActions ? 1 : 0),
|
|
6692
|
+
className: "px-4 py-12 text-center text-[var(--color-error)]",
|
|
6693
|
+
children: [
|
|
6694
|
+
t("error.generic") + ": ",
|
|
6695
|
+
error.message
|
|
6696
|
+
]
|
|
6697
|
+
}
|
|
6698
|
+
) }) : items.length === 0 ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx(
|
|
6699
|
+
"td",
|
|
6700
|
+
{
|
|
6701
|
+
colSpan: normalizedColumns.length + (selectable ? 1 : 0) + (rowActions ? 1 : 0),
|
|
6702
|
+
className: "px-4 py-12",
|
|
6703
|
+
children: /* @__PURE__ */ jsx(
|
|
6704
|
+
EmptyState,
|
|
6705
|
+
{
|
|
6706
|
+
icon: emptyIcon,
|
|
6707
|
+
title: resolvedEmptyTitle,
|
|
6708
|
+
description: resolvedEmptyDescription,
|
|
6709
|
+
actionLabel: emptyAction?.label,
|
|
6710
|
+
actionEvent: emptyAction?.event
|
|
6711
|
+
}
|
|
6712
|
+
)
|
|
6713
|
+
}
|
|
6714
|
+
) }) : items.map((row, rowIndex) => /* @__PURE__ */ jsxs(
|
|
6715
|
+
"tr",
|
|
6716
|
+
{
|
|
6717
|
+
"data-entity-row": true,
|
|
6718
|
+
className: cn(
|
|
6719
|
+
"border-b border-[var(--color-table-border)] last:border-0 hover:bg-[var(--color-table-row-hover)] transition-colors",
|
|
6720
|
+
selectedIds.includes(row.id) && "bg-[var(--color-primary)]/10 font-medium",
|
|
6721
|
+
isRowClickable && "cursor-pointer"
|
|
6722
|
+
),
|
|
6723
|
+
onClick: () => isRowClickable && handleRowClick(row),
|
|
6724
|
+
children: [
|
|
6725
|
+
selectable && /* @__PURE__ */ jsx("td", { className: "px-4 py-3", children: /* @__PURE__ */ jsx(
|
|
6726
|
+
Checkbox,
|
|
6727
|
+
{
|
|
6728
|
+
checked: selectedIds.includes(row.id),
|
|
6729
|
+
onChange: () => handleSelectRow(row.id)
|
|
6730
|
+
}
|
|
6731
|
+
) }),
|
|
6732
|
+
normalizedColumns.map((col) => {
|
|
6733
|
+
const cellValue = getNestedValue(
|
|
6734
|
+
row,
|
|
6735
|
+
String(col.key)
|
|
6736
|
+
);
|
|
6737
|
+
return /* @__PURE__ */ jsx(
|
|
6738
|
+
"td",
|
|
6739
|
+
{
|
|
6740
|
+
"data-column": String(col.key),
|
|
6741
|
+
className: "px-4 py-3 text-sm text-[var(--color-foreground)] whitespace-nowrap sm:whitespace-normal",
|
|
6742
|
+
children: col.render ? col.render(cellValue, row, rowIndex) : String(cellValue ?? "")
|
|
6743
|
+
},
|
|
6744
|
+
String(col.key)
|
|
6745
|
+
);
|
|
6746
|
+
}),
|
|
6747
|
+
rowActions && /* @__PURE__ */ jsxs("td", { className: "px-4 py-3 relative", children: [
|
|
6748
|
+
/* @__PURE__ */ jsx(
|
|
6749
|
+
Button,
|
|
6740
6750
|
{
|
|
6741
|
-
|
|
6742
|
-
|
|
6751
|
+
variant: "ghost",
|
|
6752
|
+
className: "p-1 rounded hover:bg-[var(--color-muted)]",
|
|
6753
|
+
onClick: (e) => {
|
|
6754
|
+
e.stopPropagation();
|
|
6755
|
+
setOpenActionMenu(
|
|
6756
|
+
openActionMenu === row.id ? null : row.id
|
|
6757
|
+
);
|
|
6758
|
+
},
|
|
6759
|
+
children: /* @__PURE__ */ jsx(MoreHorizontal, { className: "h-4 w-4 text-[var(--color-muted-foreground)]" })
|
|
6743
6760
|
}
|
|
6744
|
-
)
|
|
6745
|
-
|
|
6746
|
-
const cellValue = getNestedValue(
|
|
6747
|
-
row,
|
|
6748
|
-
String(col.key)
|
|
6749
|
-
);
|
|
6750
|
-
return (
|
|
6751
|
-
// eslint-disable-next-line almadar/no-raw-dom-elements -- native table elements in DataTable
|
|
6752
|
-
/* @__PURE__ */ jsx(
|
|
6753
|
-
"td",
|
|
6754
|
-
{
|
|
6755
|
-
className: "px-4 py-3 text-sm text-[var(--color-foreground)] whitespace-nowrap sm:whitespace-normal",
|
|
6756
|
-
children: col.render ? col.render(cellValue, row, rowIndex) : String(cellValue ?? "")
|
|
6757
|
-
},
|
|
6758
|
-
String(col.key)
|
|
6759
|
-
)
|
|
6760
|
-
);
|
|
6761
|
-
}),
|
|
6762
|
-
rowActions && // eslint-disable-next-line almadar/no-raw-dom-elements -- native table elements in DataTable
|
|
6763
|
-
/* @__PURE__ */ jsxs("td", { className: "px-4 py-3 relative", children: [
|
|
6761
|
+
),
|
|
6762
|
+
openActionMenu === row.id && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6764
6763
|
/* @__PURE__ */ jsx(
|
|
6765
|
-
|
|
6764
|
+
Box,
|
|
6766
6765
|
{
|
|
6767
|
-
|
|
6768
|
-
className: "p-1 rounded hover:bg-[var(--color-muted)]",
|
|
6766
|
+
className: "fixed inset-0 z-40",
|
|
6769
6767
|
onClick: (e) => {
|
|
6770
6768
|
e.stopPropagation();
|
|
6771
|
-
setOpenActionMenu(
|
|
6772
|
-
|
|
6773
|
-
);
|
|
6774
|
-
},
|
|
6775
|
-
children: /* @__PURE__ */ jsx(MoreHorizontal, { className: "h-4 w-4 text-[var(--color-muted-foreground)]" })
|
|
6769
|
+
setOpenActionMenu(null);
|
|
6770
|
+
}
|
|
6776
6771
|
}
|
|
6777
6772
|
),
|
|
6778
|
-
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
|
|
6785
|
-
|
|
6786
|
-
|
|
6787
|
-
|
|
6788
|
-
|
|
6789
|
-
|
|
6790
|
-
(
|
|
6791
|
-
|
|
6792
|
-
|
|
6793
|
-
|
|
6794
|
-
variant: "ghost",
|
|
6795
|
-
"data-event": action.event,
|
|
6796
|
-
"data-testid": action.event ? `action-${action.event}` : void 0,
|
|
6797
|
-
className: cn(
|
|
6798
|
-
"w-full flex items-center gap-2 px-4 py-2 text-sm",
|
|
6799
|
-
action.variant === "danger" ? "text-[var(--color-error)] hover:bg-[var(--color-error)]/10" : "text-[var(--color-foreground)] hover:bg-[var(--color-muted)]"
|
|
6800
|
-
),
|
|
6801
|
-
onClick: (e) => {
|
|
6802
|
-
e.stopPropagation();
|
|
6803
|
-
action.onClick(row);
|
|
6804
|
-
setOpenActionMenu(null);
|
|
6805
|
-
},
|
|
6806
|
-
children: [
|
|
6807
|
-
action.icon && /* @__PURE__ */ jsx(action.icon, { className: "h-4 w-4" }),
|
|
6808
|
-
action.label
|
|
6809
|
-
]
|
|
6773
|
+
/* @__PURE__ */ jsx(VStack, { className: "absolute right-0 mt-1 w-48 bg-[var(--color-card)] rounded-[var(--radius-lg)] shadow-[var(--shadow-lg)] border border-[var(--color-border)] py-1 z-50", children: (rowActions ?? []).filter(
|
|
6774
|
+
(action) => !action.show || action.show(row)
|
|
6775
|
+
).map((action, idx) => /* @__PURE__ */ jsxs(
|
|
6776
|
+
Button,
|
|
6777
|
+
{
|
|
6778
|
+
variant: "ghost",
|
|
6779
|
+
"data-event": action.event,
|
|
6780
|
+
"data-testid": action.event ? `action-${action.event}` : void 0,
|
|
6781
|
+
className: cn(
|
|
6782
|
+
"w-full flex items-center gap-2 px-4 py-2 text-sm",
|
|
6783
|
+
action.variant === "danger" ? "text-[var(--color-error)] hover:bg-[var(--color-error)]/10" : "text-[var(--color-foreground)] hover:bg-[var(--color-muted)]"
|
|
6784
|
+
),
|
|
6785
|
+
onClick: (e) => {
|
|
6786
|
+
e.stopPropagation();
|
|
6787
|
+
action.onClick(row);
|
|
6788
|
+
setOpenActionMenu(null);
|
|
6810
6789
|
},
|
|
6811
|
-
|
|
6812
|
-
|
|
6813
|
-
|
|
6790
|
+
children: [
|
|
6791
|
+
action.icon && /* @__PURE__ */ jsx(action.icon, { className: "h-4 w-4" }),
|
|
6792
|
+
action.label
|
|
6793
|
+
]
|
|
6794
|
+
},
|
|
6795
|
+
idx
|
|
6796
|
+
)) })
|
|
6814
6797
|
] })
|
|
6815
|
-
]
|
|
6816
|
-
|
|
6817
|
-
|
|
6818
|
-
|
|
6798
|
+
] })
|
|
6799
|
+
]
|
|
6800
|
+
},
|
|
6801
|
+
row.id
|
|
6819
6802
|
)) })
|
|
6820
6803
|
] }) }),
|
|
6821
6804
|
totalCount !== void 0 && totalPages > 1 && /* @__PURE__ */ jsx(Box, { className: "px-4 py-3 border-t-2 border-[var(--color-border)]", children: /* @__PURE__ */ jsx(
|
|
@@ -7053,16 +7036,13 @@ var PageHeader = ({
|
|
|
7053
7036
|
return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
|
|
7054
7037
|
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(React41__default.Fragment, { children: [
|
|
7055
7038
|
idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
|
|
7056
|
-
crumb.href ? (
|
|
7057
|
-
|
|
7058
|
-
|
|
7059
|
-
|
|
7060
|
-
|
|
7061
|
-
|
|
7062
|
-
|
|
7063
|
-
children: crumb.label
|
|
7064
|
-
}
|
|
7065
|
-
)
|
|
7039
|
+
crumb.href ? /* @__PURE__ */ jsx(
|
|
7040
|
+
"a",
|
|
7041
|
+
{
|
|
7042
|
+
href: crumb.href,
|
|
7043
|
+
className: "text-[var(--color-muted-foreground)] hover:text-[var(--color-foreground)]",
|
|
7044
|
+
children: crumb.label
|
|
7045
|
+
}
|
|
7066
7046
|
) : /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-[var(--color-foreground)] font-medium", children: crumb.label })
|
|
7067
7047
|
] }, idx)) }) }),
|
|
7068
7048
|
/* @__PURE__ */ jsxs(Box, { className: "flex items-start justify-between gap-4", children: [
|
|
@@ -7443,8 +7423,9 @@ var DetailPanel = ({
|
|
|
7443
7423
|
/* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "semibold", children: section.title }),
|
|
7444
7424
|
/* @__PURE__ */ jsx(Divider, {}),
|
|
7445
7425
|
/* @__PURE__ */ jsx(SimpleGrid, { minChildWidth: "250px", maxCols: 2, gap: "lg", children: section.fields.map((field, fieldIdx) => {
|
|
7426
|
+
const fieldKey = typeof field === "string" ? field : void 0;
|
|
7446
7427
|
const resolved = typeof field === "string" ? { label: formatFieldLabel(field), value: normalizedData ? formatFieldValue(getNestedValue(normalizedData, field), field) : "\u2014", icon: getFieldIcon(field) } : field;
|
|
7447
|
-
return /* @__PURE__ */ jsxs(HStack, { gap: "sm", align: "start", children: [
|
|
7428
|
+
return /* @__PURE__ */ jsxs(HStack, { gap: "sm", align: "start", "data-field": fieldKey, children: [
|
|
7448
7429
|
resolved.icon && /* @__PURE__ */ jsx(
|
|
7449
7430
|
Icon,
|
|
7450
7431
|
{
|
|
@@ -7597,11 +7578,12 @@ var Form = ({
|
|
|
7597
7578
|
const resolvedSubmitLabel = submitLabel ?? t("common.save");
|
|
7598
7579
|
const resolvedCancelLabel = cancelLabel ?? t("common.cancel");
|
|
7599
7580
|
const normalizedInitialData = initialData ?? {};
|
|
7600
|
-
const
|
|
7581
|
+
const resolvedEntity = entity && typeof entity === "object" && !Array.isArray(entity) ? entity : void 0;
|
|
7582
|
+
const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
|
|
7601
7583
|
const entityDerivedFields = React41__default.useMemo(() => {
|
|
7602
7584
|
if (fields && fields.length > 0) return void 0;
|
|
7603
|
-
if (!
|
|
7604
|
-
return
|
|
7585
|
+
if (!resolvedEntity) return void 0;
|
|
7586
|
+
return resolvedEntity.fields.map(
|
|
7605
7587
|
(f) => ({
|
|
7606
7588
|
name: f.name,
|
|
7607
7589
|
type: f.type,
|
|
@@ -7751,7 +7733,7 @@ var Form = ({
|
|
|
7751
7733
|
const inputType = determineInputType(field);
|
|
7752
7734
|
const label = field.label || fieldName.charAt(0).toUpperCase() + fieldName.slice(1).replace(/([A-Z])/g, " $1");
|
|
7753
7735
|
const currentValue = formData[fieldName] ?? field.defaultValue ?? "";
|
|
7754
|
-
return /* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
|
|
7736
|
+
return /* @__PURE__ */ jsxs(VStack, { gap: "xs", "data-field": fieldName, children: [
|
|
7755
7737
|
inputType !== "checkbox" && /* @__PURE__ */ jsxs(Typography, { as: "label", variant: "label", weight: "bold", children: [
|
|
7756
7738
|
label,
|
|
7757
7739
|
field.required && /* @__PURE__ */ jsx(Typography, { as: "span", color: "error", className: "ml-1", children: "*" })
|
|
@@ -7958,47 +7940,44 @@ var Form = ({
|
|
|
7958
7940
|
);
|
|
7959
7941
|
}
|
|
7960
7942
|
}
|
|
7961
|
-
return (
|
|
7962
|
-
|
|
7963
|
-
|
|
7964
|
-
|
|
7965
|
-
|
|
7966
|
-
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
children:
|
|
7970
|
-
|
|
7971
|
-
|
|
7972
|
-
|
|
7973
|
-
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
|
|
7983
|
-
|
|
7984
|
-
|
|
7985
|
-
|
|
7986
|
-
|
|
7987
|
-
|
|
7988
|
-
|
|
7989
|
-
|
|
7990
|
-
|
|
7991
|
-
|
|
7992
|
-
|
|
7993
|
-
|
|
7994
|
-
|
|
7995
|
-
|
|
7996
|
-
|
|
7997
|
-
|
|
7998
|
-
|
|
7999
|
-
]
|
|
8000
|
-
}
|
|
8001
|
-
)
|
|
7943
|
+
return /* @__PURE__ */ jsxs(
|
|
7944
|
+
"form",
|
|
7945
|
+
{
|
|
7946
|
+
className: cn(layoutStyles[layout], gapStyles5[gap], className),
|
|
7947
|
+
onSubmit: handleSubmit,
|
|
7948
|
+
...props,
|
|
7949
|
+
children: [
|
|
7950
|
+
error && /* @__PURE__ */ jsx(Alert, { variant: "error", className: "mb-4", children: error.message || t("error.occurred") }),
|
|
7951
|
+
sectionElements && sectionElements.length > 0 && /* @__PURE__ */ jsx(VStack, { gap: gap === "sm" ? "sm" : gap === "lg" ? "lg" : "md", children: sectionElements }),
|
|
7952
|
+
schemaFields,
|
|
7953
|
+
children,
|
|
7954
|
+
(schemaFields && schemaFields.length > 0 || sectionElements && sectionElements.length > 0) && /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "pt-4", children: [
|
|
7955
|
+
/* @__PURE__ */ jsx(
|
|
7956
|
+
Button,
|
|
7957
|
+
{
|
|
7958
|
+
type: "submit",
|
|
7959
|
+
variant: "primary",
|
|
7960
|
+
disabled: isLoading,
|
|
7961
|
+
"data-event": submitEvent,
|
|
7962
|
+
"data-testid": `action-${submitEvent}`,
|
|
7963
|
+
children: isLoading ? t("form.saving") : resolvedSubmitLabel
|
|
7964
|
+
}
|
|
7965
|
+
),
|
|
7966
|
+
shouldShowCancel && /* @__PURE__ */ jsx(
|
|
7967
|
+
Button,
|
|
7968
|
+
{
|
|
7969
|
+
type: "button",
|
|
7970
|
+
variant: "secondary",
|
|
7971
|
+
onClick: handleCancel,
|
|
7972
|
+
disabled: isLoading,
|
|
7973
|
+
"data-event": cancelEvent,
|
|
7974
|
+
"data-testid": `action-${cancelEvent}`,
|
|
7975
|
+
children: resolvedCancelLabel
|
|
7976
|
+
}
|
|
7977
|
+
)
|
|
7978
|
+
] })
|
|
7979
|
+
]
|
|
7980
|
+
}
|
|
8002
7981
|
);
|
|
8003
7982
|
};
|
|
8004
7983
|
function formatDateValue(value) {
|
|
@@ -8118,6 +8097,7 @@ var CardGrid = ({
|
|
|
8118
8097
|
return /* @__PURE__ */ jsxs(
|
|
8119
8098
|
Box,
|
|
8120
8099
|
{
|
|
8100
|
+
"data-entity-row": true,
|
|
8121
8101
|
className: cn(
|
|
8122
8102
|
"bg-[var(--color-card)] rounded-[var(--radius-lg)] border border-[var(--color-border)] p-4 shadow-[var(--shadow-sm)]",
|
|
8123
8103
|
"cursor-pointer hover:border-[var(--color-primary)] transition-colors"
|
|
@@ -8402,19 +8382,16 @@ function LinkPattern({
|
|
|
8402
8382
|
emit(`UI:${onClick}`, { href });
|
|
8403
8383
|
}
|
|
8404
8384
|
};
|
|
8405
|
-
return (
|
|
8406
|
-
|
|
8407
|
-
|
|
8408
|
-
"
|
|
8409
|
-
|
|
8410
|
-
|
|
8411
|
-
|
|
8412
|
-
|
|
8413
|
-
|
|
8414
|
-
|
|
8415
|
-
children: label
|
|
8416
|
-
}
|
|
8417
|
-
)
|
|
8385
|
+
return /* @__PURE__ */ jsx(
|
|
8386
|
+
"a",
|
|
8387
|
+
{
|
|
8388
|
+
href: href ?? "#",
|
|
8389
|
+
target: external ? "_blank" : void 0,
|
|
8390
|
+
rel: external ? "noopener noreferrer" : void 0,
|
|
8391
|
+
onClick: onClick ? handleClick : void 0,
|
|
8392
|
+
className,
|
|
8393
|
+
children: label
|
|
8394
|
+
}
|
|
8418
8395
|
);
|
|
8419
8396
|
}
|
|
8420
8397
|
LinkPattern.displayName = "LinkPattern";
|
|
@@ -8485,19 +8462,16 @@ function ImagePattern({
|
|
|
8485
8462
|
objectFit = "cover",
|
|
8486
8463
|
className
|
|
8487
8464
|
}) {
|
|
8488
|
-
return (
|
|
8489
|
-
|
|
8490
|
-
|
|
8491
|
-
|
|
8492
|
-
|
|
8493
|
-
|
|
8494
|
-
|
|
8495
|
-
|
|
8496
|
-
|
|
8497
|
-
|
|
8498
|
-
style: { objectFit }
|
|
8499
|
-
}
|
|
8500
|
-
)
|
|
8465
|
+
return /* @__PURE__ */ jsx(
|
|
8466
|
+
"img",
|
|
8467
|
+
{
|
|
8468
|
+
src,
|
|
8469
|
+
alt,
|
|
8470
|
+
width,
|
|
8471
|
+
height,
|
|
8472
|
+
className,
|
|
8473
|
+
style: { objectFit }
|
|
8474
|
+
}
|
|
8501
8475
|
);
|
|
8502
8476
|
}
|
|
8503
8477
|
ImagePattern.displayName = "ImagePattern";
|
|
@@ -8955,30 +8929,24 @@ function CustomPattern({
|
|
|
8955
8929
|
}
|
|
8956
8930
|
);
|
|
8957
8931
|
case "a":
|
|
8958
|
-
return (
|
|
8959
|
-
|
|
8960
|
-
|
|
8961
|
-
"
|
|
8962
|
-
|
|
8963
|
-
|
|
8964
|
-
|
|
8965
|
-
|
|
8966
|
-
|
|
8967
|
-
children: renderContent
|
|
8968
|
-
}
|
|
8969
|
-
)
|
|
8932
|
+
return /* @__PURE__ */ jsx(
|
|
8933
|
+
"a",
|
|
8934
|
+
{
|
|
8935
|
+
href: href ?? "#",
|
|
8936
|
+
target: external ? "_blank" : void 0,
|
|
8937
|
+
rel: external ? "noopener noreferrer" : void 0,
|
|
8938
|
+
...commonProps,
|
|
8939
|
+
children: renderContent
|
|
8940
|
+
}
|
|
8970
8941
|
);
|
|
8971
8942
|
case "img":
|
|
8972
|
-
return (
|
|
8973
|
-
|
|
8974
|
-
|
|
8975
|
-
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
|
|
8979
|
-
...commonProps
|
|
8980
|
-
}
|
|
8981
|
-
)
|
|
8943
|
+
return /* @__PURE__ */ jsx(
|
|
8944
|
+
"img",
|
|
8945
|
+
{
|
|
8946
|
+
src,
|
|
8947
|
+
alt: alt ?? "",
|
|
8948
|
+
...commonProps
|
|
8949
|
+
}
|
|
8982
8950
|
);
|
|
8983
8951
|
case "input":
|
|
8984
8952
|
return /* @__PURE__ */ jsx(
|