@almadar/ui 3.3.1 → 3.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/avl/index.cjs +67 -30
- package/dist/avl/index.js +67 -30
- package/dist/components/atoms/Avatar.d.ts +3 -2
- package/dist/components/atoms/Box.d.ts +4 -3
- package/dist/components/atoms/Button.d.ts +3 -2
- package/dist/components/atoms/InfiniteScrollSentinel.d.ts +3 -2
- package/dist/components/atoms/Input.d.ts +3 -2
- package/dist/components/atoms/Overlay.d.ts +2 -1
- package/dist/components/atoms/Radio.d.ts +2 -1
- package/dist/components/atoms/RangeSlider.d.ts +3 -2
- package/dist/components/atoms/Select.d.ts +2 -1
- package/dist/components/atoms/Stack.d.ts +3 -2
- package/dist/components/atoms/TextHighlight.d.ts +3 -2
- package/dist/components/atoms/Textarea.d.ts +2 -1
- package/dist/components/atoms/game/ControlButton.d.ts +3 -2
- package/dist/components/atoms/game/Sprite.d.ts +2 -1
- package/dist/components/index.cjs +67 -27
- package/dist/components/index.js +67 -27
- 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 +3 -2
- package/dist/components/molecules/DataGrid.d.ts +4 -3
- package/dist/components/molecules/DataList.d.ts +7 -6
- package/dist/components/molecules/Drawer.d.ts +2 -1
- package/dist/components/molecules/NumberStepper.d.ts +3 -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 +3 -2
- package/dist/components/molecules/SwipeableRow.d.ts +4 -3
- package/dist/components/molecules/UploadDropZone.d.ts +3 -2
- package/dist/components/molecules/game/DialogueBox.d.ts +3 -2
- package/dist/components/molecules/game/GameMenu.d.ts +4 -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/CardGrid.d.ts +3 -2
- package/dist/components/organisms/CustomPattern.d.ts +5 -4
- package/dist/components/organisms/DataTable.d.ts +2 -1
- package/dist/components/organisms/Form.d.ts +3 -2
- package/dist/components/organisms/GraphCanvas.d.ts +3 -2
- package/dist/components/organisms/List.d.ts +4 -2
- package/dist/components/organisms/Timeline.d.ts +2 -1
- 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 +10 -9
- 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 +8 -7
- package/dist/marketing/index.js +0 -3
- package/dist/providers/index.cjs +67 -30
- package/dist/providers/index.js +67 -30
- package/dist/runtime/createClientEffectHandlers.d.ts +2 -1
- package/dist/runtime/index.cjs +67 -27
- package/dist/runtime/index.js +67 -27
- package/package.json +3 -3
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
|
|
@@ -15753,7 +15750,11 @@ var init_CardGrid = __esm({
|
|
|
15753
15750
|
return;
|
|
15754
15751
|
}
|
|
15755
15752
|
if (action.event) {
|
|
15756
|
-
|
|
15753
|
+
const payload = {
|
|
15754
|
+
id: itemData.id,
|
|
15755
|
+
row: itemData
|
|
15756
|
+
};
|
|
15757
|
+
eventBus.emit(`UI:${action.event}`, payload);
|
|
15757
15758
|
}
|
|
15758
15759
|
if (action.onClick) {
|
|
15759
15760
|
action.onClick(itemData);
|
|
@@ -18423,7 +18424,8 @@ var init_DataGrid = __esm({
|
|
|
18423
18424
|
if (next.has(id)) next.delete(id);
|
|
18424
18425
|
else next.add(id);
|
|
18425
18426
|
if (selectionEvent) {
|
|
18426
|
-
|
|
18427
|
+
const payload = { selectedIds: Array.from(next) };
|
|
18428
|
+
eventBus.emit(`UI:${selectionEvent}`, payload);
|
|
18427
18429
|
}
|
|
18428
18430
|
return next;
|
|
18429
18431
|
});
|
|
@@ -18434,7 +18436,8 @@ var init_DataGrid = __esm({
|
|
|
18434
18436
|
const allSelected2 = allIds2.length > 0 && allIds2.every((id) => prev.has(id));
|
|
18435
18437
|
const next = allSelected2 ? /* @__PURE__ */ new Set() : new Set(allIds2);
|
|
18436
18438
|
if (selectionEvent) {
|
|
18437
|
-
|
|
18439
|
+
const payload = { selectedIds: Array.from(next) };
|
|
18440
|
+
eventBus.emit(`UI:${selectionEvent}`, payload);
|
|
18438
18441
|
}
|
|
18439
18442
|
return next;
|
|
18440
18443
|
});
|
|
@@ -18446,7 +18449,11 @@ var init_DataGrid = __esm({
|
|
|
18446
18449
|
const dangerActions = itemActions?.filter((a) => a.variant === "danger") ?? [];
|
|
18447
18450
|
const handleActionClick = (action, itemData) => (e) => {
|
|
18448
18451
|
e.stopPropagation();
|
|
18449
|
-
|
|
18452
|
+
const payload = {
|
|
18453
|
+
id: itemData.id,
|
|
18454
|
+
row: itemData
|
|
18455
|
+
};
|
|
18456
|
+
eventBus.emit(`UI:${action.event}`, payload);
|
|
18450
18457
|
};
|
|
18451
18458
|
const gridTemplateColumns = cols ? void 0 : `repeat(auto-fit, minmax(min(${minCardWidth}px, 100%), 1fr))`;
|
|
18452
18459
|
const colsClass = cols ? {
|
|
@@ -18774,7 +18781,11 @@ var init_DataList = __esm({
|
|
|
18774
18781
|
);
|
|
18775
18782
|
const handleActionClick = (action, itemData) => (e) => {
|
|
18776
18783
|
e.stopPropagation();
|
|
18777
|
-
|
|
18784
|
+
const payload = {
|
|
18785
|
+
id: itemData.id,
|
|
18786
|
+
row: itemData
|
|
18787
|
+
};
|
|
18788
|
+
eventBus.emit(`UI:${action.event}`, payload);
|
|
18778
18789
|
};
|
|
18779
18790
|
if (isLoading) {
|
|
18780
18791
|
return /* @__PURE__ */ jsx(Box, { className: "text-center py-8", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "secondary", children: t("loading.items") || "Loading..." }) });
|
|
@@ -26956,7 +26967,8 @@ var init_DetailPanel = __esm({
|
|
|
26956
26967
|
return;
|
|
26957
26968
|
}
|
|
26958
26969
|
if (action.event) {
|
|
26959
|
-
|
|
26970
|
+
const payload = data2 ? { id: data2.id, row: data2 } : {};
|
|
26971
|
+
eventBus.emit(`UI:${action.event}`, payload);
|
|
26960
26972
|
}
|
|
26961
26973
|
if (action.onClick) {
|
|
26962
26974
|
action.onClick();
|
|
@@ -28398,9 +28410,10 @@ var init_Form = __esm({
|
|
|
28398
28410
|
};
|
|
28399
28411
|
const handleSubmit = (e) => {
|
|
28400
28412
|
e.preventDefault();
|
|
28401
|
-
|
|
28413
|
+
const payload = { data: formData };
|
|
28414
|
+
eventBus.emit(`UI:${submitEvent}`, payload);
|
|
28402
28415
|
if (onSubmit) {
|
|
28403
|
-
eventBus.emit(`UI:${onSubmit}`,
|
|
28416
|
+
eventBus.emit(`UI:${onSubmit}`, payload);
|
|
28404
28417
|
}
|
|
28405
28418
|
};
|
|
28406
28419
|
const handleCancel = () => {
|
|
@@ -29768,6 +29781,31 @@ function normalizeFields2(fields) {
|
|
|
29768
29781
|
if (!fields) return [];
|
|
29769
29782
|
return fields.map((f3) => typeof f3 === "string" ? f3 : f3.key ?? f3.name ?? "");
|
|
29770
29783
|
}
|
|
29784
|
+
function entityFieldsFromListItem(item) {
|
|
29785
|
+
const {
|
|
29786
|
+
icon: _icon,
|
|
29787
|
+
metadata: _metadata,
|
|
29788
|
+
onClick: _onClick,
|
|
29789
|
+
avatar: _avatar,
|
|
29790
|
+
_fields,
|
|
29791
|
+
...rest
|
|
29792
|
+
} = item;
|
|
29793
|
+
const result = {};
|
|
29794
|
+
for (const [key, value] of Object.entries(rest)) {
|
|
29795
|
+
if (typeof value === "function" || value !== null && typeof value === "object" && "$$typeof" in value) {
|
|
29796
|
+
continue;
|
|
29797
|
+
}
|
|
29798
|
+
result[key] = value;
|
|
29799
|
+
}
|
|
29800
|
+
if (_fields && typeof _fields === "object") {
|
|
29801
|
+
for (const [k, v] of Object.entries(_fields)) {
|
|
29802
|
+
if (typeof v !== "function") {
|
|
29803
|
+
result[k] = v;
|
|
29804
|
+
}
|
|
29805
|
+
}
|
|
29806
|
+
}
|
|
29807
|
+
return result;
|
|
29808
|
+
}
|
|
29771
29809
|
function getStatusStyle(fieldName, value) {
|
|
29772
29810
|
const val = String(value).toLowerCase();
|
|
29773
29811
|
if (val.includes("complete") || val.includes("done"))
|
|
@@ -29971,18 +30009,17 @@ var init_List = __esm({
|
|
|
29971
30009
|
label: action.label,
|
|
29972
30010
|
event: action.event,
|
|
29973
30011
|
onClick: () => {
|
|
30012
|
+
const row = entityFieldsFromListItem(item);
|
|
29974
30013
|
if (action.navigatesTo) {
|
|
29975
30014
|
const url = action.navigatesTo.replace(
|
|
29976
30015
|
/\{\{(\w+)\}\}/g,
|
|
29977
|
-
(_, key) => String(
|
|
30016
|
+
(_, key) => String(row[key] ?? item.id ?? "")
|
|
29978
30017
|
);
|
|
29979
|
-
eventBus.emit("UI:NAVIGATE", { url, row
|
|
30018
|
+
eventBus.emit("UI:NAVIGATE", { url, row });
|
|
29980
30019
|
return;
|
|
29981
30020
|
}
|
|
29982
30021
|
if (action.event) {
|
|
29983
|
-
eventBus.emit(`UI:${action.event}`, {
|
|
29984
|
-
row: item
|
|
29985
|
-
});
|
|
30022
|
+
eventBus.emit(`UI:${action.event}`, { row });
|
|
29986
30023
|
}
|
|
29987
30024
|
}
|
|
29988
30025
|
}));
|
|
@@ -30062,7 +30099,7 @@ var init_List = __esm({
|
|
|
30062
30099
|
);
|
|
30063
30100
|
const hasExplicitClick = !!(viewAction?.event || item.onClick);
|
|
30064
30101
|
const rowAction = viewAction?.event ?? "VIEW";
|
|
30065
|
-
const rowActionPayload = { row: item };
|
|
30102
|
+
const rowActionPayload = { row: entityFieldsFromListItem(item) };
|
|
30066
30103
|
const primaryField = effectiveFieldNames?.[0];
|
|
30067
30104
|
const statusField = effectiveFieldNames?.find(
|
|
30068
30105
|
(f3) => f3.toLowerCase().includes("status")
|
|
@@ -35881,16 +35918,19 @@ var init_Timeline = __esm({
|
|
|
35881
35918
|
] }),
|
|
35882
35919
|
item.description && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "secondary", children: item.description }),
|
|
35883
35920
|
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
|
-
|
|
35921
|
+
itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "mt-1", children: itemActions.map((action, actionIdx) => {
|
|
35922
|
+
const { icon: _icon, ...rowSafe } = item;
|
|
35923
|
+
return /* @__PURE__ */ jsx(
|
|
35924
|
+
Box,
|
|
35925
|
+
{
|
|
35926
|
+
action: action.event,
|
|
35927
|
+
actionPayload: { row: rowSafe },
|
|
35928
|
+
className: "cursor-pointer hover:opacity-80 transition-opacity",
|
|
35929
|
+
children: /* @__PURE__ */ jsx(Badge, { variant: "default", children: action.label })
|
|
35930
|
+
},
|
|
35931
|
+
actionIdx
|
|
35932
|
+
);
|
|
35933
|
+
}) })
|
|
35894
35934
|
] })
|
|
35895
35935
|
] }, item.id);
|
|
35896
35936
|
}) })
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@almadar/ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
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.
|
|
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",
|