@almadar/ui 3.4.0 → 3.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/avl/index.cjs +73 -58
- package/dist/avl/index.js +73 -58
- package/dist/components/atoms/Avatar.d.ts +2 -2
- package/dist/components/atoms/Box.d.ts +3 -3
- package/dist/components/atoms/Button.d.ts +2 -2
- package/dist/components/atoms/InfiniteScrollSentinel.d.ts +3 -2
- package/dist/components/atoms/RangeSlider.d.ts +2 -2
- package/dist/components/atoms/Stack.d.ts +2 -2
- package/dist/components/atoms/TextHighlight.d.ts +1 -1
- package/dist/components/atoms/game/ControlButton.d.ts +3 -2
- package/dist/components/index.cjs +73 -55
- package/dist/components/index.js +73 -55
- package/dist/components/molecules/Alert.d.ts +2 -1
- package/dist/components/molecules/CalendarGrid.d.ts +2 -1
- package/dist/components/molecules/Card.d.ts +2 -2
- package/dist/components/molecules/DataGrid.d.ts +2 -2
- package/dist/components/molecules/DataList.d.ts +5 -5
- package/dist/components/molecules/Drawer.d.ts +2 -1
- package/dist/components/molecules/NumberStepper.d.ts +2 -2
- package/dist/components/molecules/PullToRefresh.d.ts +3 -2
- package/dist/components/molecules/SortableList.d.ts +5 -4
- package/dist/components/molecules/StarRating.d.ts +2 -2
- package/dist/components/molecules/SwipeableRow.d.ts +3 -3
- package/dist/components/molecules/UploadDropZone.d.ts +2 -2
- package/dist/components/molecules/game/DialogueBox.d.ts +3 -2
- package/dist/components/molecules/game/GameMenu.d.ts +3 -3
- package/dist/components/molecules/game/GameOverScreen.d.ts +3 -2
- package/dist/components/molecules/game/InventoryPanel.d.ts +3 -2
- package/dist/components/organisms/ComponentPatterns.d.ts +52 -22
- package/dist/components/organisms/CustomPattern.d.ts +3 -3
- package/dist/components/organisms/GraphCanvas.d.ts +3 -2
- package/dist/components/organisms/game/three/index.cjs +0 -3
- package/dist/components/organisms/game/three/index.js +0 -3
- package/dist/docs/index.cjs +0 -3
- package/dist/docs/index.d.cts +5 -5
- package/dist/docs/index.js +0 -3
- package/dist/hooks/event-bus-types.d.ts +10 -10
- package/dist/hooks/index.cjs +0 -3
- package/dist/hooks/index.js +0 -3
- package/dist/hooks/useDraggable.d.ts +2 -1
- package/dist/hooks/useEventBus.d.ts +2 -1
- package/dist/lib/verificationRegistry.d.ts +2 -2
- package/dist/marketing/index.cjs +0 -3
- package/dist/marketing/index.d.cts +5 -5
- package/dist/marketing/index.js +0 -3
- package/dist/providers/index.cjs +73 -58
- package/dist/providers/index.js +73 -58
- package/dist/runtime/createClientEffectHandlers.d.ts +2 -1
- package/dist/runtime/index.cjs +73 -55
- package/dist/runtime/index.js +73 -55
- package/package.json +6 -3
package/dist/runtime/index.cjs
CHANGED
|
@@ -221,9 +221,6 @@ var init_useEventBus = __esm({
|
|
|
221
221
|
emit: (type, payload, source) => {
|
|
222
222
|
const event = {
|
|
223
223
|
type,
|
|
224
|
-
// Narrow at the bus boundary: public emit accepts an opaque object so
|
|
225
|
-
// generic UI emit sites don't require casts; the envelope stores the
|
|
226
|
-
// payload as EventPayload which listeners consume directly.
|
|
227
224
|
payload,
|
|
228
225
|
timestamp: Date.now(),
|
|
229
226
|
source
|
|
@@ -8169,38 +8166,16 @@ var init_MapView = __esm({
|
|
|
8169
8166
|
}
|
|
8170
8167
|
});
|
|
8171
8168
|
function ButtonPattern({
|
|
8172
|
-
|
|
8173
|
-
variant = "primary",
|
|
8174
|
-
size = "md",
|
|
8175
|
-
disabled = false,
|
|
8169
|
+
action,
|
|
8176
8170
|
onClick,
|
|
8177
8171
|
event,
|
|
8178
8172
|
icon,
|
|
8179
|
-
iconPosition
|
|
8180
|
-
|
|
8173
|
+
iconPosition,
|
|
8174
|
+
...rest
|
|
8181
8175
|
}) {
|
|
8182
|
-
const
|
|
8183
|
-
const
|
|
8184
|
-
|
|
8185
|
-
if (eventName && !disabled) {
|
|
8186
|
-
emit(`UI:${eventName}`, {});
|
|
8187
|
-
}
|
|
8188
|
-
};
|
|
8189
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8190
|
-
Button,
|
|
8191
|
-
{
|
|
8192
|
-
variant,
|
|
8193
|
-
size,
|
|
8194
|
-
disabled,
|
|
8195
|
-
onClick: handleClick,
|
|
8196
|
-
className,
|
|
8197
|
-
children: [
|
|
8198
|
-
icon && iconPosition === "left" && /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: icon, size: "sm" }),
|
|
8199
|
-
label,
|
|
8200
|
-
icon && iconPosition === "right" && /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: icon, size: "sm" })
|
|
8201
|
-
]
|
|
8202
|
-
}
|
|
8203
|
-
);
|
|
8176
|
+
const resolvedAction = action ?? onClick ?? event;
|
|
8177
|
+
const iconProps = iconPosition === "right" ? { iconRight: icon } : { icon };
|
|
8178
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Button, { ...rest, action: resolvedAction, ...iconProps });
|
|
8204
8179
|
}
|
|
8205
8180
|
function TextPattern({
|
|
8206
8181
|
content,
|
|
@@ -15798,7 +15773,11 @@ var init_CardGrid = __esm({
|
|
|
15798
15773
|
return;
|
|
15799
15774
|
}
|
|
15800
15775
|
if (action.event) {
|
|
15801
|
-
|
|
15776
|
+
const payload = {
|
|
15777
|
+
id: itemData.id,
|
|
15778
|
+
row: itemData
|
|
15779
|
+
};
|
|
15780
|
+
eventBus.emit(`UI:${action.event}`, payload);
|
|
15802
15781
|
}
|
|
15803
15782
|
if (action.onClick) {
|
|
15804
15783
|
action.onClick(itemData);
|
|
@@ -18468,7 +18447,8 @@ var init_DataGrid = __esm({
|
|
|
18468
18447
|
if (next.has(id)) next.delete(id);
|
|
18469
18448
|
else next.add(id);
|
|
18470
18449
|
if (selectionEvent) {
|
|
18471
|
-
|
|
18450
|
+
const payload = { selectedIds: Array.from(next) };
|
|
18451
|
+
eventBus.emit(`UI:${selectionEvent}`, payload);
|
|
18472
18452
|
}
|
|
18473
18453
|
return next;
|
|
18474
18454
|
});
|
|
@@ -18479,7 +18459,8 @@ var init_DataGrid = __esm({
|
|
|
18479
18459
|
const allSelected2 = allIds2.length > 0 && allIds2.every((id) => prev.has(id));
|
|
18480
18460
|
const next = allSelected2 ? /* @__PURE__ */ new Set() : new Set(allIds2);
|
|
18481
18461
|
if (selectionEvent) {
|
|
18482
|
-
|
|
18462
|
+
const payload = { selectedIds: Array.from(next) };
|
|
18463
|
+
eventBus.emit(`UI:${selectionEvent}`, payload);
|
|
18483
18464
|
}
|
|
18484
18465
|
return next;
|
|
18485
18466
|
});
|
|
@@ -18491,7 +18472,11 @@ var init_DataGrid = __esm({
|
|
|
18491
18472
|
const dangerActions = itemActions?.filter((a) => a.variant === "danger") ?? [];
|
|
18492
18473
|
const handleActionClick = (action, itemData) => (e) => {
|
|
18493
18474
|
e.stopPropagation();
|
|
18494
|
-
|
|
18475
|
+
const payload = {
|
|
18476
|
+
id: itemData.id,
|
|
18477
|
+
row: itemData
|
|
18478
|
+
};
|
|
18479
|
+
eventBus.emit(`UI:${action.event}`, payload);
|
|
18495
18480
|
};
|
|
18496
18481
|
const gridTemplateColumns = cols ? void 0 : `repeat(auto-fit, minmax(min(${minCardWidth}px, 100%), 1fr))`;
|
|
18497
18482
|
const colsClass = cols ? {
|
|
@@ -18819,7 +18804,11 @@ var init_DataList = __esm({
|
|
|
18819
18804
|
);
|
|
18820
18805
|
const handleActionClick = (action, itemData) => (e) => {
|
|
18821
18806
|
e.stopPropagation();
|
|
18822
|
-
|
|
18807
|
+
const payload = {
|
|
18808
|
+
id: itemData.id,
|
|
18809
|
+
row: itemData
|
|
18810
|
+
};
|
|
18811
|
+
eventBus.emit(`UI:${action.event}`, payload);
|
|
18823
18812
|
};
|
|
18824
18813
|
if (isLoading) {
|
|
18825
18814
|
return /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "text-center py-8", children: /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "body", color: "secondary", children: t("loading.items") || "Loading..." }) });
|
|
@@ -27001,7 +26990,8 @@ var init_DetailPanel = __esm({
|
|
|
27001
26990
|
return;
|
|
27002
26991
|
}
|
|
27003
26992
|
if (action.event) {
|
|
27004
|
-
|
|
26993
|
+
const payload = data2 ? { id: data2.id, row: data2 } : {};
|
|
26994
|
+
eventBus.emit(`UI:${action.event}`, payload);
|
|
27005
26995
|
}
|
|
27006
26996
|
if (action.onClick) {
|
|
27007
26997
|
action.onClick();
|
|
@@ -28443,9 +28433,10 @@ var init_Form = __esm({
|
|
|
28443
28433
|
};
|
|
28444
28434
|
const handleSubmit = (e) => {
|
|
28445
28435
|
e.preventDefault();
|
|
28446
|
-
|
|
28436
|
+
const payload = { data: formData };
|
|
28437
|
+
eventBus.emit(`UI:${submitEvent}`, payload);
|
|
28447
28438
|
if (onSubmit) {
|
|
28448
|
-
eventBus.emit(`UI:${onSubmit}`,
|
|
28439
|
+
eventBus.emit(`UI:${onSubmit}`, payload);
|
|
28449
28440
|
}
|
|
28450
28441
|
};
|
|
28451
28442
|
const handleCancel = () => {
|
|
@@ -29813,6 +29804,31 @@ function normalizeFields2(fields) {
|
|
|
29813
29804
|
if (!fields) return [];
|
|
29814
29805
|
return fields.map((f3) => typeof f3 === "string" ? f3 : f3.key ?? f3.name ?? "");
|
|
29815
29806
|
}
|
|
29807
|
+
function entityFieldsFromListItem(item) {
|
|
29808
|
+
const {
|
|
29809
|
+
icon: _icon,
|
|
29810
|
+
metadata: _metadata,
|
|
29811
|
+
onClick: _onClick,
|
|
29812
|
+
avatar: _avatar,
|
|
29813
|
+
_fields,
|
|
29814
|
+
...rest
|
|
29815
|
+
} = item;
|
|
29816
|
+
const result = {};
|
|
29817
|
+
for (const [key, value] of Object.entries(rest)) {
|
|
29818
|
+
if (typeof value === "function" || value !== null && typeof value === "object" && "$$typeof" in value) {
|
|
29819
|
+
continue;
|
|
29820
|
+
}
|
|
29821
|
+
result[key] = value;
|
|
29822
|
+
}
|
|
29823
|
+
if (_fields && typeof _fields === "object") {
|
|
29824
|
+
for (const [k, v] of Object.entries(_fields)) {
|
|
29825
|
+
if (typeof v !== "function") {
|
|
29826
|
+
result[k] = v;
|
|
29827
|
+
}
|
|
29828
|
+
}
|
|
29829
|
+
}
|
|
29830
|
+
return result;
|
|
29831
|
+
}
|
|
29816
29832
|
function getStatusStyle(fieldName, value) {
|
|
29817
29833
|
const val = String(value).toLowerCase();
|
|
29818
29834
|
if (val.includes("complete") || val.includes("done"))
|
|
@@ -30016,18 +30032,17 @@ var init_List = __esm({
|
|
|
30016
30032
|
label: action.label,
|
|
30017
30033
|
event: action.event,
|
|
30018
30034
|
onClick: () => {
|
|
30035
|
+
const row = entityFieldsFromListItem(item);
|
|
30019
30036
|
if (action.navigatesTo) {
|
|
30020
30037
|
const url = action.navigatesTo.replace(
|
|
30021
30038
|
/\{\{(\w+)\}\}/g,
|
|
30022
|
-
(_, key) => String(
|
|
30039
|
+
(_, key) => String(row[key] ?? item.id ?? "")
|
|
30023
30040
|
);
|
|
30024
|
-
eventBus.emit("UI:NAVIGATE", { url, row
|
|
30041
|
+
eventBus.emit("UI:NAVIGATE", { url, row });
|
|
30025
30042
|
return;
|
|
30026
30043
|
}
|
|
30027
30044
|
if (action.event) {
|
|
30028
|
-
eventBus.emit(`UI:${action.event}`, {
|
|
30029
|
-
row: item
|
|
30030
|
-
});
|
|
30045
|
+
eventBus.emit(`UI:${action.event}`, { row });
|
|
30031
30046
|
}
|
|
30032
30047
|
}
|
|
30033
30048
|
}));
|
|
@@ -30107,7 +30122,7 @@ var init_List = __esm({
|
|
|
30107
30122
|
);
|
|
30108
30123
|
const hasExplicitClick = !!(viewAction?.event || item.onClick);
|
|
30109
30124
|
const rowAction = viewAction?.event ?? "VIEW";
|
|
30110
|
-
const rowActionPayload = { row: item };
|
|
30125
|
+
const rowActionPayload = { row: entityFieldsFromListItem(item) };
|
|
30111
30126
|
const primaryField = effectiveFieldNames?.[0];
|
|
30112
30127
|
const statusField = effectiveFieldNames?.find(
|
|
30113
30128
|
(f3) => f3.toLowerCase().includes("status")
|
|
@@ -35926,16 +35941,19 @@ var init_Timeline = __esm({
|
|
|
35926
35941
|
] }),
|
|
35927
35942
|
item.description && /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "small", color: "secondary", children: item.description }),
|
|
35928
35943
|
item.tags && item.tags.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(HStack, { gap: "xs", wrap: true, children: item.tags.map((tag, tagIdx) => /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "default", children: tag }, tagIdx)) }),
|
|
35929
|
-
itemActions && itemActions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(HStack, { gap: "xs", className: "mt-1", children: itemActions.map((action, actionIdx) =>
|
|
35930
|
-
|
|
35931
|
-
|
|
35932
|
-
|
|
35933
|
-
|
|
35934
|
-
|
|
35935
|
-
|
|
35936
|
-
|
|
35937
|
-
|
|
35938
|
-
|
|
35944
|
+
itemActions && itemActions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(HStack, { gap: "xs", className: "mt-1", children: itemActions.map((action, actionIdx) => {
|
|
35945
|
+
const { icon: _icon, ...rowSafe } = item;
|
|
35946
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
35947
|
+
Box,
|
|
35948
|
+
{
|
|
35949
|
+
action: action.event,
|
|
35950
|
+
actionPayload: { row: rowSafe },
|
|
35951
|
+
className: "cursor-pointer hover:opacity-80 transition-opacity",
|
|
35952
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "default", children: action.label })
|
|
35953
|
+
},
|
|
35954
|
+
actionIdx
|
|
35955
|
+
);
|
|
35956
|
+
}) })
|
|
35939
35957
|
] })
|
|
35940
35958
|
] }, item.id);
|
|
35941
35959
|
}) })
|
package/dist/runtime/index.js
CHANGED
|
@@ -176,9 +176,6 @@ var init_useEventBus = __esm({
|
|
|
176
176
|
emit: (type, payload, source) => {
|
|
177
177
|
const event = {
|
|
178
178
|
type,
|
|
179
|
-
// Narrow at the bus boundary: public emit accepts an opaque object so
|
|
180
|
-
// generic UI emit sites don't require casts; the envelope stores the
|
|
181
|
-
// payload as EventPayload which listeners consume directly.
|
|
182
179
|
payload,
|
|
183
180
|
timestamp: Date.now(),
|
|
184
181
|
source
|
|
@@ -8124,38 +8121,16 @@ var init_MapView = __esm({
|
|
|
8124
8121
|
}
|
|
8125
8122
|
});
|
|
8126
8123
|
function ButtonPattern({
|
|
8127
|
-
|
|
8128
|
-
variant = "primary",
|
|
8129
|
-
size = "md",
|
|
8130
|
-
disabled = false,
|
|
8124
|
+
action,
|
|
8131
8125
|
onClick,
|
|
8132
8126
|
event,
|
|
8133
8127
|
icon,
|
|
8134
|
-
iconPosition
|
|
8135
|
-
|
|
8128
|
+
iconPosition,
|
|
8129
|
+
...rest
|
|
8136
8130
|
}) {
|
|
8137
|
-
const
|
|
8138
|
-
const
|
|
8139
|
-
|
|
8140
|
-
if (eventName && !disabled) {
|
|
8141
|
-
emit(`UI:${eventName}`, {});
|
|
8142
|
-
}
|
|
8143
|
-
};
|
|
8144
|
-
return /* @__PURE__ */ jsxs(
|
|
8145
|
-
Button,
|
|
8146
|
-
{
|
|
8147
|
-
variant,
|
|
8148
|
-
size,
|
|
8149
|
-
disabled,
|
|
8150
|
-
onClick: handleClick,
|
|
8151
|
-
className,
|
|
8152
|
-
children: [
|
|
8153
|
-
icon && iconPosition === "left" && /* @__PURE__ */ jsx(Icon, { name: icon, size: "sm" }),
|
|
8154
|
-
label,
|
|
8155
|
-
icon && iconPosition === "right" && /* @__PURE__ */ jsx(Icon, { name: icon, size: "sm" })
|
|
8156
|
-
]
|
|
8157
|
-
}
|
|
8158
|
-
);
|
|
8131
|
+
const resolvedAction = action ?? onClick ?? event;
|
|
8132
|
+
const iconProps = iconPosition === "right" ? { iconRight: icon } : { icon };
|
|
8133
|
+
return /* @__PURE__ */ jsx(Button, { ...rest, action: resolvedAction, ...iconProps });
|
|
8159
8134
|
}
|
|
8160
8135
|
function TextPattern({
|
|
8161
8136
|
content,
|
|
@@ -15753,7 +15728,11 @@ var init_CardGrid = __esm({
|
|
|
15753
15728
|
return;
|
|
15754
15729
|
}
|
|
15755
15730
|
if (action.event) {
|
|
15756
|
-
|
|
15731
|
+
const payload = {
|
|
15732
|
+
id: itemData.id,
|
|
15733
|
+
row: itemData
|
|
15734
|
+
};
|
|
15735
|
+
eventBus.emit(`UI:${action.event}`, payload);
|
|
15757
15736
|
}
|
|
15758
15737
|
if (action.onClick) {
|
|
15759
15738
|
action.onClick(itemData);
|
|
@@ -18423,7 +18402,8 @@ var init_DataGrid = __esm({
|
|
|
18423
18402
|
if (next.has(id)) next.delete(id);
|
|
18424
18403
|
else next.add(id);
|
|
18425
18404
|
if (selectionEvent) {
|
|
18426
|
-
|
|
18405
|
+
const payload = { selectedIds: Array.from(next) };
|
|
18406
|
+
eventBus.emit(`UI:${selectionEvent}`, payload);
|
|
18427
18407
|
}
|
|
18428
18408
|
return next;
|
|
18429
18409
|
});
|
|
@@ -18434,7 +18414,8 @@ var init_DataGrid = __esm({
|
|
|
18434
18414
|
const allSelected2 = allIds2.length > 0 && allIds2.every((id) => prev.has(id));
|
|
18435
18415
|
const next = allSelected2 ? /* @__PURE__ */ new Set() : new Set(allIds2);
|
|
18436
18416
|
if (selectionEvent) {
|
|
18437
|
-
|
|
18417
|
+
const payload = { selectedIds: Array.from(next) };
|
|
18418
|
+
eventBus.emit(`UI:${selectionEvent}`, payload);
|
|
18438
18419
|
}
|
|
18439
18420
|
return next;
|
|
18440
18421
|
});
|
|
@@ -18446,7 +18427,11 @@ var init_DataGrid = __esm({
|
|
|
18446
18427
|
const dangerActions = itemActions?.filter((a) => a.variant === "danger") ?? [];
|
|
18447
18428
|
const handleActionClick = (action, itemData) => (e) => {
|
|
18448
18429
|
e.stopPropagation();
|
|
18449
|
-
|
|
18430
|
+
const payload = {
|
|
18431
|
+
id: itemData.id,
|
|
18432
|
+
row: itemData
|
|
18433
|
+
};
|
|
18434
|
+
eventBus.emit(`UI:${action.event}`, payload);
|
|
18450
18435
|
};
|
|
18451
18436
|
const gridTemplateColumns = cols ? void 0 : `repeat(auto-fit, minmax(min(${minCardWidth}px, 100%), 1fr))`;
|
|
18452
18437
|
const colsClass = cols ? {
|
|
@@ -18774,7 +18759,11 @@ var init_DataList = __esm({
|
|
|
18774
18759
|
);
|
|
18775
18760
|
const handleActionClick = (action, itemData) => (e) => {
|
|
18776
18761
|
e.stopPropagation();
|
|
18777
|
-
|
|
18762
|
+
const payload = {
|
|
18763
|
+
id: itemData.id,
|
|
18764
|
+
row: itemData
|
|
18765
|
+
};
|
|
18766
|
+
eventBus.emit(`UI:${action.event}`, payload);
|
|
18778
18767
|
};
|
|
18779
18768
|
if (isLoading) {
|
|
18780
18769
|
return /* @__PURE__ */ jsx(Box, { className: "text-center py-8", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "secondary", children: t("loading.items") || "Loading..." }) });
|
|
@@ -26956,7 +26945,8 @@ var init_DetailPanel = __esm({
|
|
|
26956
26945
|
return;
|
|
26957
26946
|
}
|
|
26958
26947
|
if (action.event) {
|
|
26959
|
-
|
|
26948
|
+
const payload = data2 ? { id: data2.id, row: data2 } : {};
|
|
26949
|
+
eventBus.emit(`UI:${action.event}`, payload);
|
|
26960
26950
|
}
|
|
26961
26951
|
if (action.onClick) {
|
|
26962
26952
|
action.onClick();
|
|
@@ -28398,9 +28388,10 @@ var init_Form = __esm({
|
|
|
28398
28388
|
};
|
|
28399
28389
|
const handleSubmit = (e) => {
|
|
28400
28390
|
e.preventDefault();
|
|
28401
|
-
|
|
28391
|
+
const payload = { data: formData };
|
|
28392
|
+
eventBus.emit(`UI:${submitEvent}`, payload);
|
|
28402
28393
|
if (onSubmit) {
|
|
28403
|
-
eventBus.emit(`UI:${onSubmit}`,
|
|
28394
|
+
eventBus.emit(`UI:${onSubmit}`, payload);
|
|
28404
28395
|
}
|
|
28405
28396
|
};
|
|
28406
28397
|
const handleCancel = () => {
|
|
@@ -29768,6 +29759,31 @@ function normalizeFields2(fields) {
|
|
|
29768
29759
|
if (!fields) return [];
|
|
29769
29760
|
return fields.map((f3) => typeof f3 === "string" ? f3 : f3.key ?? f3.name ?? "");
|
|
29770
29761
|
}
|
|
29762
|
+
function entityFieldsFromListItem(item) {
|
|
29763
|
+
const {
|
|
29764
|
+
icon: _icon,
|
|
29765
|
+
metadata: _metadata,
|
|
29766
|
+
onClick: _onClick,
|
|
29767
|
+
avatar: _avatar,
|
|
29768
|
+
_fields,
|
|
29769
|
+
...rest
|
|
29770
|
+
} = item;
|
|
29771
|
+
const result = {};
|
|
29772
|
+
for (const [key, value] of Object.entries(rest)) {
|
|
29773
|
+
if (typeof value === "function" || value !== null && typeof value === "object" && "$$typeof" in value) {
|
|
29774
|
+
continue;
|
|
29775
|
+
}
|
|
29776
|
+
result[key] = value;
|
|
29777
|
+
}
|
|
29778
|
+
if (_fields && typeof _fields === "object") {
|
|
29779
|
+
for (const [k, v] of Object.entries(_fields)) {
|
|
29780
|
+
if (typeof v !== "function") {
|
|
29781
|
+
result[k] = v;
|
|
29782
|
+
}
|
|
29783
|
+
}
|
|
29784
|
+
}
|
|
29785
|
+
return result;
|
|
29786
|
+
}
|
|
29771
29787
|
function getStatusStyle(fieldName, value) {
|
|
29772
29788
|
const val = String(value).toLowerCase();
|
|
29773
29789
|
if (val.includes("complete") || val.includes("done"))
|
|
@@ -29971,18 +29987,17 @@ var init_List = __esm({
|
|
|
29971
29987
|
label: action.label,
|
|
29972
29988
|
event: action.event,
|
|
29973
29989
|
onClick: () => {
|
|
29990
|
+
const row = entityFieldsFromListItem(item);
|
|
29974
29991
|
if (action.navigatesTo) {
|
|
29975
29992
|
const url = action.navigatesTo.replace(
|
|
29976
29993
|
/\{\{(\w+)\}\}/g,
|
|
29977
|
-
(_, key) => String(
|
|
29994
|
+
(_, key) => String(row[key] ?? item.id ?? "")
|
|
29978
29995
|
);
|
|
29979
|
-
eventBus.emit("UI:NAVIGATE", { url, row
|
|
29996
|
+
eventBus.emit("UI:NAVIGATE", { url, row });
|
|
29980
29997
|
return;
|
|
29981
29998
|
}
|
|
29982
29999
|
if (action.event) {
|
|
29983
|
-
eventBus.emit(`UI:${action.event}`, {
|
|
29984
|
-
row: item
|
|
29985
|
-
});
|
|
30000
|
+
eventBus.emit(`UI:${action.event}`, { row });
|
|
29986
30001
|
}
|
|
29987
30002
|
}
|
|
29988
30003
|
}));
|
|
@@ -30062,7 +30077,7 @@ var init_List = __esm({
|
|
|
30062
30077
|
);
|
|
30063
30078
|
const hasExplicitClick = !!(viewAction?.event || item.onClick);
|
|
30064
30079
|
const rowAction = viewAction?.event ?? "VIEW";
|
|
30065
|
-
const rowActionPayload = { row: item };
|
|
30080
|
+
const rowActionPayload = { row: entityFieldsFromListItem(item) };
|
|
30066
30081
|
const primaryField = effectiveFieldNames?.[0];
|
|
30067
30082
|
const statusField = effectiveFieldNames?.find(
|
|
30068
30083
|
(f3) => f3.toLowerCase().includes("status")
|
|
@@ -35881,16 +35896,19 @@ var init_Timeline = __esm({
|
|
|
35881
35896
|
] }),
|
|
35882
35897
|
item.description && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "secondary", children: item.description }),
|
|
35883
35898
|
item.tags && item.tags.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", wrap: true, children: item.tags.map((tag, tagIdx) => /* @__PURE__ */ jsx(Badge, { variant: "default", children: tag }, tagIdx)) }),
|
|
35884
|
-
itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "mt-1", children: itemActions.map((action, actionIdx) =>
|
|
35885
|
-
|
|
35886
|
-
|
|
35887
|
-
|
|
35888
|
-
|
|
35889
|
-
|
|
35890
|
-
|
|
35891
|
-
|
|
35892
|
-
|
|
35893
|
-
|
|
35899
|
+
itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "mt-1", children: itemActions.map((action, actionIdx) => {
|
|
35900
|
+
const { icon: _icon, ...rowSafe } = item;
|
|
35901
|
+
return /* @__PURE__ */ jsx(
|
|
35902
|
+
Box,
|
|
35903
|
+
{
|
|
35904
|
+
action: action.event,
|
|
35905
|
+
actionPayload: { row: rowSafe },
|
|
35906
|
+
className: "cursor-pointer hover:opacity-80 transition-opacity",
|
|
35907
|
+
children: /* @__PURE__ */ jsx(Badge, { variant: "default", children: action.label })
|
|
35908
|
+
},
|
|
35909
|
+
actionIdx
|
|
35910
|
+
);
|
|
35911
|
+
}) })
|
|
35894
35912
|
] })
|
|
35895
35913
|
] }, item.id);
|
|
35896
35914
|
}) })
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@almadar/ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.1",
|
|
4
4
|
"description": "React UI components, hooks, and providers for Almadar",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/components/index.js",
|
|
@@ -118,9 +118,9 @@
|
|
|
118
118
|
"access": "public"
|
|
119
119
|
},
|
|
120
120
|
"dependencies": {
|
|
121
|
-
"@almadar/core": ">=5.6.
|
|
121
|
+
"@almadar/core": ">=5.6.1",
|
|
122
122
|
"@almadar/evaluator": ">=2.9.2",
|
|
123
|
-
"@almadar/patterns": ">=2.
|
|
123
|
+
"@almadar/patterns": ">=2.17.1",
|
|
124
124
|
"@almadar/runtime": ">=4.3.0",
|
|
125
125
|
"@almadar/std": ">=6.4.1",
|
|
126
126
|
"@almadar/syntax": ">=1.3.1",
|
|
@@ -152,6 +152,8 @@
|
|
|
152
152
|
},
|
|
153
153
|
"devDependencies": {
|
|
154
154
|
"@almadar/eslint-plugin": ">=2.3.0",
|
|
155
|
+
"@react-three/drei": "^10.7.7",
|
|
156
|
+
"@react-three/fiber": "^9.6.0",
|
|
155
157
|
"@react-three/postprocessing": "3.0.4",
|
|
156
158
|
"@storybook/addon-docs": "^10.2.6",
|
|
157
159
|
"@storybook/addon-links": "^10.2.6",
|
|
@@ -185,6 +187,7 @@
|
|
|
185
187
|
"react-router-dom": "^7.13.0",
|
|
186
188
|
"storybook": "^10.2.6",
|
|
187
189
|
"tailwindcss": "^3.4.0",
|
|
190
|
+
"three": "^0.160.1",
|
|
188
191
|
"tsup": "^8.0.0",
|
|
189
192
|
"tsx": "^4.7.0",
|
|
190
193
|
"typescript": "^5.4.0",
|