@mshuja288/aksuicore 0.2.0 → 0.3.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/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/dist/aksui.css +59 -0
- package/dist/index.cjs +83 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -2
- package/dist/index.d.ts +16 -2
- package/dist/index.js +83 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/patterns/RecordWorkspace.tsx +82 -0
- package/src/patterns/index.ts +6 -1
- package/src/primitives/ConfirmDeleteDialog.tsx +34 -0
- package/src/primitives/index.ts +1 -0
- package/src/theme/patterns.css +59 -0
package/dist/index.js
CHANGED
|
@@ -434,6 +434,21 @@ function Dialog({
|
|
|
434
434
|
) });
|
|
435
435
|
}
|
|
436
436
|
var FormDialog = Dialog;
|
|
437
|
+
function ConfirmDeleteDialog({
|
|
438
|
+
open,
|
|
439
|
+
message,
|
|
440
|
+
pending = false,
|
|
441
|
+
onCancel,
|
|
442
|
+
onConfirm
|
|
443
|
+
}) {
|
|
444
|
+
return /* @__PURE__ */ jsx(Dialog, { title: "Confirm delete", open, onClose: pending ? () => void 0 : onCancel, wide: false, children: /* @__PURE__ */ jsxs("div", { className: "card-form", children: [
|
|
445
|
+
/* @__PURE__ */ jsx("p", { className: "hint", children: message }),
|
|
446
|
+
/* @__PURE__ */ jsxs("div", { className: "actions", children: [
|
|
447
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: onCancel, disabled: pending, children: "Cancel" }),
|
|
448
|
+
/* @__PURE__ */ jsx(Button, { variant: "danger", onClick: onConfirm, disabled: pending, children: pending ? "Deleting\u2026" : "Delete" })
|
|
449
|
+
] })
|
|
450
|
+
] }) });
|
|
451
|
+
}
|
|
437
452
|
function useIsClient() {
|
|
438
453
|
return useSyncExternalStore(
|
|
439
454
|
() => () => {
|
|
@@ -711,6 +726,11 @@ function useIsClient2() {
|
|
|
711
726
|
() => false
|
|
712
727
|
);
|
|
713
728
|
}
|
|
729
|
+
var EXPORT_FORMAT_OPTIONS = [
|
|
730
|
+
{ format: "csv", label: "CSV" },
|
|
731
|
+
{ format: "xlsx", label: "Excel" },
|
|
732
|
+
{ format: "json", label: "JSON" }
|
|
733
|
+
];
|
|
714
734
|
function compareColumnValues(column, left, right) {
|
|
715
735
|
const leftRaw = column.display ? column.display(left) : column.value(left);
|
|
716
736
|
const rightRaw = column.display ? column.display(right) : column.value(right);
|
|
@@ -753,6 +773,13 @@ function PreviewIcon() {
|
|
|
753
773
|
/* @__PURE__ */ jsx("circle", { cx: "10", cy: "10", r: "2.4", fill: "none", stroke: "currentColor", strokeWidth: "1.6" })
|
|
754
774
|
] });
|
|
755
775
|
}
|
|
776
|
+
function DownloadIcon() {
|
|
777
|
+
return /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 20 20", "aria-hidden": "true", children: [
|
|
778
|
+
/* @__PURE__ */ jsx("path", { d: "M10 3.5v8.2", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round" }),
|
|
779
|
+
/* @__PURE__ */ jsx("path", { d: "M6.5 9.2 10 12.8l3.5-3.6", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
780
|
+
/* @__PURE__ */ jsx("path", { d: "M4 15.5h12", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round" })
|
|
781
|
+
] });
|
|
782
|
+
}
|
|
756
783
|
function DetailList({ lines }) {
|
|
757
784
|
return /* @__PURE__ */ jsx("dl", { className: "record-detail-list", children: lines.map((line) => /* @__PURE__ */ jsxs("div", { className: "record-detail-row", children: [
|
|
758
785
|
/* @__PURE__ */ jsx("dt", { children: line.label }),
|
|
@@ -773,6 +800,9 @@ function RecordWorkspace({
|
|
|
773
800
|
onDelete,
|
|
774
801
|
canUpdate,
|
|
775
802
|
canDelete,
|
|
803
|
+
onDownload,
|
|
804
|
+
canDownload = true,
|
|
805
|
+
downloadBusy = false,
|
|
776
806
|
toolbar,
|
|
777
807
|
form
|
|
778
808
|
}) {
|
|
@@ -780,6 +810,7 @@ function RecordWorkspace({
|
|
|
780
810
|
const [filters, setFilters] = useState({});
|
|
781
811
|
const [sort, setSort] = useState(null);
|
|
782
812
|
const [sideOpen, setSideOpen] = useState(false);
|
|
813
|
+
const [downloadOpen, setDownloadOpen] = useState(false);
|
|
783
814
|
const [previewEnabled, setPreviewEnabled] = useState(false);
|
|
784
815
|
const [previewKey, setPreviewKey] = useState(null);
|
|
785
816
|
const [tooltip, setTooltip] = useState(null);
|
|
@@ -825,8 +856,16 @@ function RecordWorkspace({
|
|
|
825
856
|
const start = showAll ? 0 : (currentPage - 1) * numericPageSize;
|
|
826
857
|
const pageItems = showAll ? sorted : sorted.slice(start, start + numericPageSize);
|
|
827
858
|
const showAdd = canAdd && Boolean(onAdd);
|
|
859
|
+
const showDownload = Boolean(onDownload) && canDownload;
|
|
828
860
|
const showFilters = filterableColumns.length > 0;
|
|
829
861
|
const previewItem = previewKey === null ? null : sorted.find((item) => rowKey(item) === previewKey) ?? null;
|
|
862
|
+
function requestDownload(format) {
|
|
863
|
+
if (!onDownload || downloadBusy) {
|
|
864
|
+
return;
|
|
865
|
+
}
|
|
866
|
+
onDownload(format);
|
|
867
|
+
setDownloadOpen(false);
|
|
868
|
+
}
|
|
830
869
|
function cellText(column, item) {
|
|
831
870
|
const raw = column.display ? column.display(item) : column.value(item);
|
|
832
871
|
return raw === null || raw === void 0 || raw === "" ? "\u2014" : String(raw);
|
|
@@ -1026,6 +1065,33 @@ function RecordWorkspace({
|
|
|
1026
1065
|
/* @__PURE__ */ jsx(PlusIcon, {}),
|
|
1027
1066
|
/* @__PURE__ */ jsx("span", { children: addLabel })
|
|
1028
1067
|
] }) : null,
|
|
1068
|
+
showDownload ? /* @__PURE__ */ jsxs("div", { className: "side-rail-download", children: [
|
|
1069
|
+
/* @__PURE__ */ jsxs(
|
|
1070
|
+
"button",
|
|
1071
|
+
{
|
|
1072
|
+
type: "button",
|
|
1073
|
+
className: "ghost side-rail-download-toggle",
|
|
1074
|
+
"aria-expanded": downloadOpen,
|
|
1075
|
+
disabled: downloadBusy,
|
|
1076
|
+
onClick: () => setDownloadOpen((open) => !open),
|
|
1077
|
+
children: [
|
|
1078
|
+
/* @__PURE__ */ jsx(DownloadIcon, {}),
|
|
1079
|
+
/* @__PURE__ */ jsx("span", { children: downloadBusy ? "Downloading\u2026" : "Download" })
|
|
1080
|
+
]
|
|
1081
|
+
}
|
|
1082
|
+
),
|
|
1083
|
+
downloadOpen ? /* @__PURE__ */ jsx("div", { className: "side-rail-download-formats", role: "group", "aria-label": "Download format", children: EXPORT_FORMAT_OPTIONS.map((option) => /* @__PURE__ */ jsx(
|
|
1084
|
+
"button",
|
|
1085
|
+
{
|
|
1086
|
+
type: "button",
|
|
1087
|
+
className: "ghost side-rail-download-format",
|
|
1088
|
+
disabled: downloadBusy,
|
|
1089
|
+
onClick: () => requestDownload(option.format),
|
|
1090
|
+
children: option.label
|
|
1091
|
+
},
|
|
1092
|
+
option.format
|
|
1093
|
+
)) }) : null
|
|
1094
|
+
] }) : null,
|
|
1029
1095
|
showFilters ? /* @__PURE__ */ jsxs("div", { className: "side-rail-filters", children: [
|
|
1030
1096
|
/* @__PURE__ */ jsxs("div", { className: "filter-panel-head", children: [
|
|
1031
1097
|
/* @__PURE__ */ jsx("h3", { children: "Filters" }),
|
|
@@ -1079,6 +1145,22 @@ function RecordWorkspace({
|
|
|
1079
1145
|
/* @__PURE__ */ jsx(PreviewIcon, {})
|
|
1080
1146
|
] }),
|
|
1081
1147
|
showAdd ? /* @__PURE__ */ jsx("button", { type: "button", className: "ghost side-rail-icon", title: addLabel, "aria-label": addLabel, onClick: onAdd, children: /* @__PURE__ */ jsx(PlusIcon, {}) }) : null,
|
|
1148
|
+
showDownload ? /* @__PURE__ */ jsx(
|
|
1149
|
+
"button",
|
|
1150
|
+
{
|
|
1151
|
+
type: "button",
|
|
1152
|
+
className: "ghost side-rail-icon",
|
|
1153
|
+
title: "Download",
|
|
1154
|
+
"aria-label": "Download",
|
|
1155
|
+
"aria-expanded": downloadOpen,
|
|
1156
|
+
disabled: downloadBusy,
|
|
1157
|
+
onClick: () => {
|
|
1158
|
+
setSideOpen(true);
|
|
1159
|
+
setDownloadOpen(true);
|
|
1160
|
+
},
|
|
1161
|
+
children: /* @__PURE__ */ jsx(DownloadIcon, {})
|
|
1162
|
+
}
|
|
1163
|
+
) : null,
|
|
1082
1164
|
showFilters ? /* @__PURE__ */ jsxs(
|
|
1083
1165
|
"button",
|
|
1084
1166
|
{
|
|
@@ -1122,6 +1204,6 @@ function RecordWorkspace({
|
|
|
1122
1204
|
}
|
|
1123
1205
|
var RecordTable = RecordWorkspace;
|
|
1124
1206
|
|
|
1125
|
-
export { AppSelect, AppShell, Button, DateField, Dialog, FormActions, FormDialog, Pagination, RecordTable, RecordWorkspace, Select, SideNav, Snackbar, StatusMessage, Topbar, aksuiThemeVersion, aksuiTokens };
|
|
1207
|
+
export { AppSelect, AppShell, Button, ConfirmDeleteDialog, DateField, Dialog, FormActions, FormDialog, Pagination, RecordTable, RecordWorkspace, Select, SideNav, Snackbar, StatusMessage, Topbar, aksuiThemeVersion, aksuiTokens };
|
|
1126
1208
|
//# sourceMappingURL=index.js.map
|
|
1127
1209
|
//# sourceMappingURL=index.js.map
|