@apteva/apteva-kit 0.1.49 → 0.1.50
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/index.js +33 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -30
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -916,26 +916,29 @@ function Table({ widget, onAction }) {
|
|
|
916
916
|
// src/components/Widgets/WidgetRenderer.tsx
|
|
917
917
|
|
|
918
918
|
function WidgetRenderer({ widget, onAction }) {
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "
|
|
933
|
-
"
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
919
|
+
const renderWidget = () => {
|
|
920
|
+
switch (widget.type) {
|
|
921
|
+
case "card":
|
|
922
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Card, { widget, onAction });
|
|
923
|
+
case "list":
|
|
924
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, List, { widget, onAction });
|
|
925
|
+
case "button":
|
|
926
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { widget, onAction });
|
|
927
|
+
case "button_group":
|
|
928
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ButtonGroup, { widget, onAction });
|
|
929
|
+
case "table":
|
|
930
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Table, { widget, onAction });
|
|
931
|
+
default:
|
|
932
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "p-4 border border-yellow-300 bg-yellow-50 rounded-lg", children: [
|
|
933
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm text-yellow-800", children: [
|
|
934
|
+
"Unknown widget type: ",
|
|
935
|
+
widget.type
|
|
936
|
+
] }),
|
|
937
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "pre", { className: "text-xs mt-2 overflow-auto", children: JSON.stringify(widget, null, 2) })
|
|
938
|
+
] });
|
|
939
|
+
}
|
|
940
|
+
};
|
|
941
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "apteva-widget", children: renderWidget() });
|
|
939
942
|
}
|
|
940
943
|
|
|
941
944
|
// src/components/Widgets/Widgets.tsx
|
|
@@ -972,13 +975,13 @@ function Widgets({
|
|
|
972
975
|
function WidgetSkeleton({ type, className }) {
|
|
973
976
|
switch (type) {
|
|
974
977
|
case "card":
|
|
975
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: cn("animate-pulse rounded-lg border border-neutral-200 dark:border-neutral-800 overflow-hidden", className), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "p-4 space-y-3", children: [
|
|
978
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: cn("apteva-widget-skeleton animate-pulse rounded-lg border border-neutral-200 dark:border-neutral-800 overflow-hidden", className), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "p-4 space-y-3", children: [
|
|
976
979
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-4 bg-neutral-200 dark:bg-neutral-700 rounded w-3/4" }),
|
|
977
980
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-full" }),
|
|
978
981
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-5/6" })
|
|
979
982
|
] }) });
|
|
980
983
|
case "list":
|
|
981
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: cn("animate-pulse space-y-2", className), children: [1, 2, 3].map((i) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-3 p-3 rounded-lg border border-neutral-200 dark:border-neutral-800", children: [
|
|
984
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: cn("apteva-widget-skeleton animate-pulse space-y-2", className), children: [1, 2, 3].map((i) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-3 p-3 rounded-lg border border-neutral-200 dark:border-neutral-800", children: [
|
|
982
985
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-10 h-10 bg-neutral-200 dark:bg-neutral-700 rounded-full flex-shrink-0" }),
|
|
983
986
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex-1 space-y-2", children: [
|
|
984
987
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-1/2" }),
|
|
@@ -986,13 +989,13 @@ function WidgetSkeleton({ type, className }) {
|
|
|
986
989
|
] })
|
|
987
990
|
] }, i)) });
|
|
988
991
|
case "button_group":
|
|
989
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: cn("animate-pulse flex gap-2", className), children: [
|
|
992
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: cn("apteva-widget-skeleton animate-pulse flex gap-2", className), children: [
|
|
990
993
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-9 bg-neutral-200 dark:bg-neutral-700 rounded-lg w-20" }),
|
|
991
994
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-9 bg-neutral-200 dark:bg-neutral-700 rounded-lg w-20" }),
|
|
992
995
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-9 bg-neutral-200 dark:bg-neutral-700 rounded-lg w-20" })
|
|
993
996
|
] });
|
|
994
997
|
case "form":
|
|
995
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: cn("animate-pulse rounded-lg border border-neutral-200 dark:border-neutral-800 p-4 space-y-4", className), children: [
|
|
998
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: cn("apteva-widget-skeleton animate-pulse rounded-lg border border-neutral-200 dark:border-neutral-800 p-4 space-y-4", className), children: [
|
|
996
999
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-4 bg-neutral-200 dark:bg-neutral-700 rounded w-1/3" }),
|
|
997
1000
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-3", children: [
|
|
998
1001
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-10 bg-neutral-200 dark:bg-neutral-700 rounded" }),
|
|
@@ -1001,7 +1004,7 @@ function WidgetSkeleton({ type, className }) {
|
|
|
1001
1004
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-9 bg-neutral-200 dark:bg-neutral-700 rounded w-24" })
|
|
1002
1005
|
] });
|
|
1003
1006
|
case "chart":
|
|
1004
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: cn("animate-pulse rounded-lg border border-neutral-200 dark:border-neutral-800 p-4", className), children: [
|
|
1007
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: cn("apteva-widget-skeleton animate-pulse rounded-lg border border-neutral-200 dark:border-neutral-800 p-4", className), children: [
|
|
1005
1008
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-4 bg-neutral-200 dark:bg-neutral-700 rounded w-1/4 mb-4" }),
|
|
1006
1009
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-end gap-2 h-32", children: [
|
|
1007
1010
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex-1 bg-neutral-200 dark:bg-neutral-700 rounded-t h-1/2" }),
|
|
@@ -1012,16 +1015,16 @@ function WidgetSkeleton({ type, className }) {
|
|
|
1012
1015
|
] })
|
|
1013
1016
|
] });
|
|
1014
1017
|
case "image":
|
|
1015
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: cn("animate-pulse", className), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "aspect-video bg-neutral-200 dark:bg-neutral-700 rounded-lg" }) });
|
|
1018
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: cn("apteva-widget-skeleton animate-pulse", className), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "aspect-video bg-neutral-200 dark:bg-neutral-700 rounded-lg" }) });
|
|
1016
1019
|
case "gallery":
|
|
1017
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: cn("animate-pulse grid grid-cols-3 gap-2", className), children: [1, 2, 3].map((i) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "aspect-square bg-neutral-200 dark:bg-neutral-700 rounded-lg" }, i)) });
|
|
1020
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: cn("apteva-widget-skeleton animate-pulse grid grid-cols-3 gap-2", className), children: [1, 2, 3].map((i) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "aspect-square bg-neutral-200 dark:bg-neutral-700 rounded-lg" }, i)) });
|
|
1018
1021
|
case "map":
|
|
1019
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: cn("animate-pulse", className), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-48 bg-neutral-200 dark:bg-neutral-700 rounded-lg flex items-center justify-center", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "svg", { className: "w-8 h-8 text-neutral-400 dark:text-neutral-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: [
|
|
1022
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: cn("apteva-widget-skeleton animate-pulse", className), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-48 bg-neutral-200 dark:bg-neutral-700 rounded-lg flex items-center justify-center", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "svg", { className: "w-8 h-8 text-neutral-400 dark:text-neutral-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: [
|
|
1020
1023
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z" }),
|
|
1021
1024
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M15 11a3 3 0 11-6 0 3 3 0 016 0z" })
|
|
1022
1025
|
] }) }) });
|
|
1023
1026
|
case "table":
|
|
1024
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: cn("animate-pulse rounded-lg border border-neutral-200 dark:border-neutral-800 overflow-hidden", className), children: [
|
|
1027
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: cn("apteva-widget-skeleton animate-pulse rounded-lg border border-neutral-200 dark:border-neutral-800 overflow-hidden", className), children: [
|
|
1025
1028
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex bg-neutral-100 dark:bg-neutral-800 border-b border-neutral-200 dark:border-neutral-700", children: [
|
|
1026
1029
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex-1 px-4 py-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-3 bg-neutral-300 dark:bg-neutral-600 rounded w-16" }) }),
|
|
1027
1030
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex-1 px-4 py-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-3 bg-neutral-300 dark:bg-neutral-600 rounded w-20" }) }),
|
|
@@ -1034,7 +1037,7 @@ function WidgetSkeleton({ type, className }) {
|
|
|
1034
1037
|
] }, i))
|
|
1035
1038
|
] });
|
|
1036
1039
|
default:
|
|
1037
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: cn("animate-pulse rounded-lg border border-neutral-200 dark:border-neutral-800 p-4", className), children: [
|
|
1040
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: cn("apteva-widget-skeleton animate-pulse rounded-lg border border-neutral-200 dark:border-neutral-800 p-4", className), children: [
|
|
1038
1041
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-4 bg-neutral-200 dark:bg-neutral-700 rounded w-1/2 mb-2" }),
|
|
1039
1042
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-full" })
|
|
1040
1043
|
] });
|