@questpie/admin 3.0.3 → 3.0.4
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/README.md +34 -5
- package/dist/client/blocks/block-renderer.d.mts +2 -2
- package/dist/client/blocks/block-renderer.mjs +4 -1
- package/dist/client/builder/types/action-types.d.mts +31 -3
- package/dist/client/builder/types/collection-types.d.mts +140 -0
- package/dist/client/builder/types/ui-config.d.mts +16 -2
- package/dist/client/builder/types/views.d.mts +57 -0
- package/dist/client/builder/types/widget-types.d.mts +5 -0
- package/dist/client/components/actions/action-button.mjs +137 -199
- package/dist/client/components/actions/action-dialog.mjs +198 -156
- package/dist/client/components/actions/confirmation-dialog.mjs +2 -2
- package/dist/client/components/actions/header-actions.mjs +52 -53
- package/dist/client/components/admin-link.d.mts +2 -2
- package/dist/client/components/auth/auth-loading.mjs +41 -18
- package/dist/client/components/blocks/block-fields-renderer.mjs +64 -28
- package/dist/client/components/blocks/block-insert-button.mjs +4 -4
- package/dist/client/components/blocks/block-item.mjs +2 -2
- package/dist/client/components/blocks/block-library-sidebar.mjs +2 -2
- package/dist/client/components/component-renderer.mjs +1 -1
- package/dist/client/components/fields/array-field.mjs +14 -14
- package/dist/client/components/fields/asset-preview-field.mjs +1 -1
- package/dist/client/components/fields/blocks-field/blocks-field.mjs +84 -104
- package/dist/client/components/fields/json-field.mjs +2 -2
- package/dist/client/components/fields/object-array-field.mjs +22 -22
- package/dist/client/components/fields/object-field.mjs +5 -5
- package/dist/client/components/fields/relation/displays/cards-display.mjs +16 -9
- package/dist/client/components/fields/relation/displays/chips-display.mjs +15 -12
- package/dist/client/components/fields/relation/displays/grid-display.mjs +15 -11
- package/dist/client/components/fields/relation/displays/list-display.mjs +33 -20
- package/dist/client/components/fields/relation/displays/table-display.mjs +62 -93
- package/dist/client/components/fields/relation/relation-items-display.mjs +1 -1
- package/dist/client/components/fields/relation-picker.mjs +7 -6
- package/dist/client/components/fields/relation-select.mjs +71 -47
- package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs +392 -82
- package/dist/client/components/fields/rich-text-editor/extensions.mjs +54 -23
- package/dist/client/components/fields/rich-text-editor/image-popover.mjs +24 -50
- package/dist/client/components/fields/rich-text-editor/image-upload.mjs +66 -0
- package/dist/client/components/fields/rich-text-editor/index.d.mts +38 -0
- package/dist/client/components/fields/rich-text-editor/index.mjs +637 -376
- package/dist/client/components/fields/rich-text-editor/link-utils.mjs +26 -0
- package/dist/client/components/fields/rich-text-editor/presets.d.mts +10 -0
- package/dist/client/components/fields/rich-text-editor/slash-commands.mjs +27 -6
- package/dist/client/components/fields/rich-text-editor/toolbar.mjs +464 -346
- package/dist/client/components/fields/rich-text-editor/types.d.mts +77 -0
- package/dist/client/components/fields/upload-field.mjs +45 -49
- package/dist/client/components/filter-builder/columns-tab.mjs +69 -62
- package/dist/client/components/filter-builder/filter-builder-sheet.mjs +473 -308
- package/dist/client/components/filter-builder/filters-tab.mjs +109 -82
- package/dist/client/components/filter-builder/saved-views-tab.mjs +300 -198
- package/dist/client/components/history-sidebar.mjs +850 -340
- package/dist/client/components/layout/field-layout-renderer.mjs +6 -5
- package/dist/client/components/locale-switcher.mjs +8 -8
- package/dist/client/components/media/media-grid.mjs +12 -9
- package/dist/client/components/media/media-picker-dialog.mjs +242 -230
- package/dist/client/components/preview/live-preview-mode.mjs +1 -1
- package/dist/client/components/primitives/asset-preview.mjs +37 -22
- package/dist/client/components/primitives/date-input.mjs +212 -249
- package/dist/client/components/primitives/dropzone.mjs +192 -159
- package/dist/client/components/primitives/field-select-control.mjs +93 -0
- package/dist/client/components/primitives/select-multi.mjs +251 -230
- package/dist/client/components/primitives/select-single.mjs +345 -290
- package/dist/client/components/primitives/time-input.mjs +2 -2
- package/dist/client/components/sheets/resource-sheet.mjs +2 -0
- package/dist/client/components/ui/accordion.mjs +4 -4
- package/dist/client/components/ui/alert.mjs +3 -3
- package/dist/client/components/ui/badge.mjs +4 -4
- package/dist/client/components/ui/button.mjs +47 -37
- package/dist/client/components/ui/card.mjs +2 -2
- package/dist/client/components/ui/checkbox.mjs +1 -1
- package/dist/client/components/ui/command.mjs +5 -5
- package/dist/client/components/ui/dialog.mjs +3 -3
- package/dist/client/components/ui/drawer.mjs +1 -1
- package/dist/client/components/ui/dropdown-menu.mjs +157 -15
- package/dist/client/components/ui/empty-state.mjs +88 -59
- package/dist/client/components/ui/field.mjs +2 -2
- package/dist/client/components/ui/input-group.mjs +3 -3
- package/dist/client/components/ui/input.mjs +1 -1
- package/dist/client/components/ui/kbd.mjs +1 -1
- package/dist/client/components/ui/label.mjs +1 -1
- package/dist/client/components/ui/popover.mjs +19 -11
- package/dist/client/components/ui/scroll-fade.mjs +170 -0
- package/dist/client/components/ui/search-input.mjs +1 -1
- package/dist/client/components/ui/select.mjs +129 -27
- package/dist/client/components/ui/sheet.mjs +54 -34
- package/dist/client/components/ui/sidebar.mjs +15 -14
- package/dist/client/components/ui/skeleton.mjs +28 -12
- package/dist/client/components/ui/switch.mjs +2 -2
- package/dist/client/components/ui/table.mjs +82 -74
- package/dist/client/components/ui/tabs.mjs +26 -31
- package/dist/client/components/ui/textarea.mjs +1 -1
- package/dist/client/components/ui/tooltip.mjs +1 -1
- package/dist/client/components/widgets/chart-widget.mjs +134 -96
- package/dist/client/components/widgets/progress-widget.mjs +59 -34
- package/dist/client/components/widgets/quick-actions-widget.mjs +184 -113
- package/dist/client/components/widgets/recent-items-widget.mjs +144 -102
- package/dist/client/components/widgets/stats-widget.mjs +91 -72
- package/dist/client/components/widgets/table-widget.mjs +159 -246
- package/dist/client/components/widgets/timeline-widget.mjs +66 -43
- package/dist/client/components/widgets/value-widget.mjs +261 -152
- package/dist/client/components/widgets/widget-empty-state.mjs +88 -0
- package/dist/client/components/widgets/widget-skeletons.mjs +53 -20
- package/dist/client/contexts/focus-context.d.mts +2 -2
- package/dist/client/hooks/use-action.mjs +63 -55
- package/dist/client/hooks/use-audit-history.mjs +1 -65
- package/dist/client/hooks/use-collection-validation.mjs +36 -23
- package/dist/client/hooks/use-collection.mjs +96 -1
- package/dist/client/hooks/use-saved-views.mjs +70 -49
- package/dist/client/hooks/use-server-actions.mjs +59 -40
- package/dist/client/hooks/use-server-validation.mjs +156 -41
- package/dist/client/hooks/use-server-widget-data.mjs +1 -1
- package/dist/client/hooks/use-setup-status.d.mts +3 -3
- package/dist/client/hooks/use-setup-status.mjs +2 -2
- package/dist/client/hooks/use-transition-stage.mjs +2 -10
- package/dist/client/hooks/use-validation-error-map.mjs +31 -13
- package/dist/client/hooks/use-view-state.mjs +238 -174
- package/dist/client/i18n/date-locale.mjs +33 -0
- package/dist/client/i18n/hooks.mjs +17 -1
- package/dist/client/lib/utils.mjs +3 -2
- package/dist/client/preview/block-scope-context.d.mts +2 -2
- package/dist/client/preview/preview-banner.d.mts +2 -2
- package/dist/client/preview/preview-field.d.mts +4 -4
- package/dist/client/preview/preview-field.mjs +2 -2
- package/dist/client/runtime/provider.mjs +8 -1
- package/dist/client/runtime/translations-provider.mjs +1 -1
- package/dist/client/scope/picker.d.mts +2 -2
- package/dist/client/scope/provider.d.mts +2 -2
- package/dist/client/styles/base.css +1022 -0
- package/dist/client/styles/index.css +3 -589
- package/dist/client/utils/auto-expand-fields.mjs +4 -2
- package/dist/client/utils/keyboard-shortcuts.mjs +26 -0
- package/dist/client/utils/use-lazy-component.mjs +80 -0
- package/dist/client/views/auth/auth-layout.d.mts +18 -11
- package/dist/client/views/auth/auth-layout.mjs +291 -80
- package/dist/client/views/auth/forgot-password-form.d.mts +2 -2
- package/dist/client/views/auth/forgot-password-form.mjs +2 -2
- package/dist/client/views/auth/login-form.d.mts +2 -2
- package/dist/client/views/auth/login-form.mjs +1 -1
- package/dist/client/views/auth/reset-password-form.d.mts +2 -2
- package/dist/client/views/auth/reset-password-form.mjs +2 -2
- package/dist/client/views/auth/setup-form.d.mts +2 -2
- package/dist/client/views/collection/auto-form-fields.mjs +11 -9
- package/dist/client/views/collection/bulk-action-toolbar.mjs +173 -138
- package/dist/client/views/collection/cells/complex-cells.mjs +22 -22
- package/dist/client/views/collection/cells/primitive-cells.mjs +1 -1
- package/dist/client/views/collection/cells/relation-cells.mjs +147 -129
- package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs +224 -278
- package/dist/client/views/collection/cells/shared/relation-chip.mjs +64 -36
- package/dist/client/views/collection/cells/upload-cells.mjs +199 -9
- package/dist/client/views/collection/columns/build-columns.mjs +29 -9
- package/dist/client/views/collection/columns/column-defaults.mjs +2 -2
- package/dist/client/views/collection/field-renderer.mjs +50 -89
- package/dist/client/views/collection/form-view.mjs +237 -227
- package/dist/client/views/collection/table-view.mjs +1162 -229
- package/dist/client/views/collection/view-skeletons.mjs +222 -79
- package/dist/client/views/common/global-search.mjs +29 -18
- package/dist/client/views/dashboard/dashboard-grid.mjs +678 -501
- package/dist/client/views/dashboard/dashboard-widget.mjs +6 -3
- package/dist/client/views/dashboard/widget-card.mjs +23 -14
- package/dist/client/views/globals/global-form-view.mjs +634 -589
- package/dist/client/views/layout/admin-layout-provider.mjs +67 -70
- package/dist/client/views/layout/admin-layout.d.mts +3 -6
- package/dist/client/views/layout/admin-layout.mjs +149 -172
- package/dist/client/views/layout/admin-router.mjs +747 -544
- package/dist/client/views/layout/admin-sidebar.d.mts +38 -1
- package/dist/client/views/layout/admin-sidebar.mjs +751 -591
- package/dist/client/views/layout/admin-theme.d.mts +10 -0
- package/dist/client/views/layout/admin-theme.mjs +84 -0
- package/dist/client/views/layout/admin-view-layout.mjs +161 -0
- package/dist/client/views/pages/accept-invite-page.d.mts +2 -2
- package/dist/client/views/pages/accept-invite-page.mjs +49 -26
- package/dist/client/views/pages/dashboard-page.d.mts +2 -2
- package/dist/client/views/pages/forgot-password-page.d.mts +2 -2
- package/dist/client/views/pages/forgot-password-page.mjs +2 -19
- package/dist/client/views/pages/invite-page.d.mts +2 -2
- package/dist/client/views/pages/invite-page.mjs +2 -19
- package/dist/client/views/pages/login-page.d.mts +1 -1
- package/dist/client/views/pages/login-page.mjs +4 -21
- package/dist/client/views/pages/reset-password-page.d.mts +2 -2
- package/dist/client/views/pages/reset-password-page.mjs +3 -20
- package/dist/client/views/pages/setup-page.d.mts +2 -2
- package/dist/client/views/pages/setup-page.mjs +3 -20
- package/dist/client.d.mts +6 -2
- package/dist/client.mjs +2 -1
- package/dist/components/rich-text/rich-text-renderer.d.mts +2 -2
- package/dist/index.d.mts +6 -2
- package/dist/index.mjs +2 -1
- package/dist/server/augmentation/dashboard.d.mts +67 -3
- package/dist/server/augmentation/form-layout.d.mts +21 -0
- package/dist/server/augmentation/index.d.mts +1 -1
- package/dist/server/codegen/admin-client-template.mjs +4 -0
- package/dist/server/fields/blocks.d.mts +1 -1
- package/dist/server/fields/blocks.mjs +12 -0
- package/dist/server/fields/rich-text.d.mts +1 -1
- package/dist/server/fields/rich-text.mjs +8 -0
- package/dist/server/i18n/index.mjs +17 -1
- package/dist/server/i18n/messages/cs.mjs +23 -0
- package/dist/server/i18n/messages/de.mjs +23 -0
- package/dist/server/i18n/messages/en.mjs +64 -1
- package/dist/server/i18n/messages/es.mjs +23 -0
- package/dist/server/i18n/messages/fr.mjs +23 -0
- package/dist/server/i18n/messages/pl.mjs +23 -0
- package/dist/server/i18n/messages/pt.mjs +23 -0
- package/dist/server/i18n/messages/sk.mjs +83 -1
- package/dist/server/modules/admin/block/introspection.mjs +4 -1
- package/dist/server/modules/admin/block/prefetch.mjs +12 -2
- package/dist/server/modules/admin/collections/account.d.mts +50 -50
- package/dist/server/modules/admin/collections/admin-locks.d.mts +54 -54
- package/dist/server/modules/admin/collections/admin-preferences.d.mts +39 -39
- package/dist/server/modules/admin/collections/admin-saved-views.d.mts +47 -47
- package/dist/server/modules/admin/collections/apikey.d.mts +68 -68
- package/dist/server/modules/admin/collections/assets.d.mts +20 -20
- package/dist/server/modules/admin/collections/assets.mjs +0 -1
- package/dist/server/modules/admin/collections/session.d.mts +42 -42
- package/dist/server/modules/admin/collections/user.d.mts +12 -0
- package/dist/server/modules/admin/collections/user.mjs +40 -9
- package/dist/server/modules/admin/collections/verification.d.mts +2 -2
- package/dist/server/modules/admin/dto/admin-config.dto.mjs +2 -0
- package/dist/server/modules/admin/factories.mjs +7 -18
- package/dist/server/modules/admin/index.d.mts +1 -1
- package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
- package/dist/server/modules/admin/routes/admin-config.mjs +34 -16
- package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
- package/dist/server/modules/admin/routes/execute-action.mjs +33 -0
- package/dist/server/modules/admin/routes/locales.d.mts +2 -2
- package/dist/server/modules/admin/routes/preview.d.mts +11 -11
- package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
- package/dist/server/modules/admin/routes/setup.d.mts +10 -10
- package/dist/server/modules/admin/routes/setup.mjs +7 -7
- package/dist/server/modules/admin/routes/translations.d.mts +4 -4
- package/dist/server/modules/admin/routes/translations.mjs +5 -1
- package/dist/server/modules/admin/routes/widget-data.d.mts +5 -5
- package/dist/server/modules/admin-preferences/collections/admin-preferences.mjs +1 -1
- package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +27 -27
- package/dist/server/modules/audit/.generated/module.d.mts +1 -1
- package/dist/server/modules/audit/.generated/module.mjs +1 -1
- package/dist/server/modules/audit/collections/audit-log.d.mts +2 -2
- package/dist/server/modules/audit/collections/audit-log.mjs +1 -1
- package/dist/server/modules/audit/config/app.mjs +99 -42
- package/dist/server/modules/audit/jobs/audit-cleanup.mjs +1 -1
- package/dist/server/plugin.mjs +4 -2
- package/dist/server/proxy-factories.d.mts +4 -3
- package/dist/server/proxy-factories.mjs +34 -8
- package/dist/shared/types/saved-views.types.d.mts +2 -0
- package/package.json +6 -4
- package/dist/client/components/fields/rich-text-editor/link-popover.mjs +0 -85
- package/dist/client/components/ui/spinner.mjs +0 -52
- package/dist/client/components/ui/toolbar.mjs +0 -136
- package/dist/client/contexts/breadcrumb-context.mjs +0 -60
- package/dist/client/views/layout/admin-topbar.mjs +0 -236
|
@@ -3,6 +3,7 @@ import { cn } from "../../lib/utils.mjs";
|
|
|
3
3
|
import { selectClient, useAdminStore } from "../../runtime/provider.mjs";
|
|
4
4
|
import { WidgetCard } from "../../views/dashboard/widget-card.mjs";
|
|
5
5
|
import { useServerWidgetData } from "../../hooks/use-server-widget-data.mjs";
|
|
6
|
+
import { WidgetEmptyState } from "./widget-empty-state.mjs";
|
|
6
7
|
import { ProgressWidgetSkeleton } from "./widget-skeletons.mjs";
|
|
7
8
|
import { c } from "react/compiler-runtime";
|
|
8
9
|
import { useQuery } from "@tanstack/react-query";
|
|
@@ -38,7 +39,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
38
39
|
* ```
|
|
39
40
|
*/
|
|
40
41
|
function ProgressWidget(t0) {
|
|
41
|
-
const $ = c(
|
|
42
|
+
const $ = c(47);
|
|
42
43
|
const { config } = t0;
|
|
43
44
|
const client = useAdminStore(selectClient);
|
|
44
45
|
const resolveText = useResolveText();
|
|
@@ -89,7 +90,7 @@ function ProgressWidget(t0) {
|
|
|
89
90
|
$[12] = t6;
|
|
90
91
|
} else t6 = $[12];
|
|
91
92
|
const clientQuery = useQuery(t6);
|
|
92
|
-
const { data, isLoading, error, refetch } = useServerData ? serverQuery : clientQuery;
|
|
93
|
+
const { data, isLoading, error, refetch, isFetching } = useServerData ? serverQuery : clientQuery;
|
|
93
94
|
let t7;
|
|
94
95
|
if ($[13] !== config.title || $[14] !== resolveText) {
|
|
95
96
|
t7 = config.title ? resolveText(config.title) : void 0;
|
|
@@ -130,7 +131,7 @@ function ProgressWidget(t0) {
|
|
|
130
131
|
children: /* @__PURE__ */ jsx("div", {
|
|
131
132
|
className: "bg-muted h-2 w-full overflow-hidden rounded-full",
|
|
132
133
|
children: /* @__PURE__ */ jsx("div", {
|
|
133
|
-
className: cn("h-full rounded-full transition-
|
|
134
|
+
className: cn("h-full rounded-full transition-[width] duration-500", getProgressColor()),
|
|
134
135
|
style: { width: `${percentage}%` }
|
|
135
136
|
})
|
|
136
137
|
})
|
|
@@ -138,10 +139,10 @@ function ProgressWidget(t0) {
|
|
|
138
139
|
/* @__PURE__ */ jsxs("div", {
|
|
139
140
|
className: "flex items-center justify-between text-sm",
|
|
140
141
|
children: [/* @__PURE__ */ jsx("span", {
|
|
141
|
-
className: "text-muted-foreground",
|
|
142
|
+
className: "text-muted-foreground tabular-nums",
|
|
142
143
|
children: data.label || `${data.current.toLocaleString()} / ${data.target.toLocaleString()}`
|
|
143
144
|
}), showPercentage && /* @__PURE__ */ jsxs("span", {
|
|
144
|
-
className: "font-medium",
|
|
145
|
+
className: "font-medium tabular-nums",
|
|
145
146
|
children: [percentageFormatted, "%"]
|
|
146
147
|
})]
|
|
147
148
|
}),
|
|
@@ -150,7 +151,11 @@ function ProgressWidget(t0) {
|
|
|
150
151
|
children: data.subtitle
|
|
151
152
|
})
|
|
152
153
|
]
|
|
153
|
-
}) :
|
|
154
|
+
}) : /* @__PURE__ */ jsx(WidgetEmptyState, {
|
|
155
|
+
iconName: "ph:target",
|
|
156
|
+
title: "No progress data",
|
|
157
|
+
description: "There is no target value to display."
|
|
158
|
+
});
|
|
154
159
|
$[21] = data;
|
|
155
160
|
$[22] = getProgressColor;
|
|
156
161
|
$[23] = percentage;
|
|
@@ -160,40 +165,60 @@ function ProgressWidget(t0) {
|
|
|
160
165
|
} else t10 = $[26];
|
|
161
166
|
const progressContent = t10;
|
|
162
167
|
let t11;
|
|
163
|
-
if ($[27]
|
|
164
|
-
t11 =
|
|
165
|
-
$[27] =
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
$[28] = error;
|
|
171
|
-
$[29] = t12;
|
|
172
|
-
} else t12 = $[29];
|
|
168
|
+
if ($[27] !== config.description || $[28] !== resolveText) {
|
|
169
|
+
t11 = config.description ? resolveText(config.description) : void 0;
|
|
170
|
+
$[27] = config.description;
|
|
171
|
+
$[28] = resolveText;
|
|
172
|
+
$[29] = t11;
|
|
173
|
+
} else t11 = $[29];
|
|
174
|
+
const t12 = isFetching && !isLoading;
|
|
173
175
|
let t13;
|
|
174
|
-
if ($[30]
|
|
175
|
-
t13 =
|
|
176
|
-
$[30] =
|
|
177
|
-
|
|
178
|
-
} else t13 = $[31];
|
|
176
|
+
if ($[30] === Symbol.for("react.memo_cache_sentinel")) {
|
|
177
|
+
t13 = /* @__PURE__ */ jsx(ProgressWidgetSkeleton, {});
|
|
178
|
+
$[30] = t13;
|
|
179
|
+
} else t13 = $[30];
|
|
179
180
|
let t14;
|
|
180
|
-
if ($[
|
|
181
|
-
t14 =
|
|
181
|
+
if ($[31] !== error) {
|
|
182
|
+
t14 = error instanceof Error ? error : error ? new Error(String(error)) : null;
|
|
183
|
+
$[31] = error;
|
|
184
|
+
$[32] = t14;
|
|
185
|
+
} else t14 = $[32];
|
|
186
|
+
let t15;
|
|
187
|
+
if ($[33] !== refetch) {
|
|
188
|
+
t15 = () => refetch();
|
|
189
|
+
$[33] = refetch;
|
|
190
|
+
$[34] = t15;
|
|
191
|
+
} else t15 = $[34];
|
|
192
|
+
let t16;
|
|
193
|
+
if ($[35] !== config.actions || $[36] !== config.cardVariant || $[37] !== config.className || $[38] !== config.icon || $[39] !== isLoading || $[40] !== progressContent || $[41] !== t11 || $[42] !== t12 || $[43] !== t14 || $[44] !== t15 || $[45] !== title) {
|
|
194
|
+
t16 = /* @__PURE__ */ jsx(WidgetCard, {
|
|
182
195
|
title,
|
|
196
|
+
description: t11,
|
|
197
|
+
icon: config.icon,
|
|
198
|
+
variant: config.cardVariant,
|
|
183
199
|
isLoading,
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
200
|
+
isRefreshing: t12,
|
|
201
|
+
loadingSkeleton: t13,
|
|
202
|
+
error: t14,
|
|
203
|
+
onRefresh: t15,
|
|
204
|
+
actions: config.actions,
|
|
205
|
+
className: config.className,
|
|
187
206
|
children: progressContent
|
|
188
207
|
});
|
|
189
|
-
$[
|
|
190
|
-
$[
|
|
191
|
-
$[
|
|
192
|
-
$[
|
|
193
|
-
$[
|
|
194
|
-
$[
|
|
195
|
-
|
|
196
|
-
|
|
208
|
+
$[35] = config.actions;
|
|
209
|
+
$[36] = config.cardVariant;
|
|
210
|
+
$[37] = config.className;
|
|
211
|
+
$[38] = config.icon;
|
|
212
|
+
$[39] = isLoading;
|
|
213
|
+
$[40] = progressContent;
|
|
214
|
+
$[41] = t11;
|
|
215
|
+
$[42] = t12;
|
|
216
|
+
$[43] = t14;
|
|
217
|
+
$[44] = t15;
|
|
218
|
+
$[45] = title;
|
|
219
|
+
$[46] = t16;
|
|
220
|
+
} else t16 = $[46];
|
|
221
|
+
return t16;
|
|
197
222
|
}
|
|
198
223
|
|
|
199
224
|
//#endregion
|
|
@@ -2,6 +2,7 @@ import { useResolveText } from "../../i18n/hooks.mjs";
|
|
|
2
2
|
import { cn, formatLabel } from "../../lib/utils.mjs";
|
|
3
3
|
import { resolveIconElement } from "../component-renderer.mjs";
|
|
4
4
|
import { WidgetCard } from "../../views/dashboard/widget-card.mjs";
|
|
5
|
+
import { WidgetEmptyState } from "./widget-empty-state.mjs";
|
|
5
6
|
import { c } from "react/compiler-runtime";
|
|
6
7
|
import { Icon } from "@iconify/react";
|
|
7
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -20,189 +21,259 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
20
21
|
* of other dashboard widgets like recent-items.
|
|
21
22
|
*/
|
|
22
23
|
function QuickActionsWidget(t0) {
|
|
23
|
-
const $ = c(
|
|
24
|
+
const $ = c(56);
|
|
24
25
|
const { config, basePath: t1, navigate } = t0;
|
|
25
26
|
const basePath = t1 === void 0 ? "/admin" : t1;
|
|
26
27
|
const resolveText = useResolveText();
|
|
27
|
-
const {
|
|
28
|
+
const { layout: t2 } = config;
|
|
28
29
|
const layout = t2 === void 0 ? "list" : t2;
|
|
29
|
-
let t3;
|
|
30
|
-
if ($[0] !== config.title || $[1] !== resolveText) {
|
|
31
|
-
t3 = config.title ? resolveText(config.title) : "Quick Actions";
|
|
32
|
-
$[0] = config.title;
|
|
33
|
-
$[1] = resolveText;
|
|
34
|
-
$[2] = t3;
|
|
35
|
-
} else t3 = $[2];
|
|
36
|
-
const title = t3;
|
|
37
30
|
let T0;
|
|
31
|
+
let t3;
|
|
38
32
|
let t4;
|
|
39
33
|
let t5;
|
|
40
34
|
let t6;
|
|
41
35
|
let t7;
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
let t8;
|
|
37
|
+
let t9;
|
|
38
|
+
if ($[0] !== basePath || $[1] !== config.actions || $[2] !== config.cardVariant || $[3] !== config.className || $[4] !== config.description || $[5] !== config.label || $[6] !== config.quickActions || $[7] !== config.title || $[8] !== layout || $[9] !== navigate || $[10] !== resolveText) {
|
|
39
|
+
t9 = Symbol.for("react.early_return_sentinel");
|
|
44
40
|
bb0: {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
const quickActions = config.quickActions ?? config.actions ?? [];
|
|
42
|
+
let t10$1;
|
|
43
|
+
if ($[19] !== config.label || $[20] !== config.title || $[21] !== resolveText) {
|
|
44
|
+
t10$1 = config.title ? resolveText(config.title) : config.label ? resolveText(config.label) : "Quick Actions";
|
|
45
|
+
$[19] = config.label;
|
|
46
|
+
$[20] = config.title;
|
|
47
|
+
$[21] = resolveText;
|
|
48
|
+
$[22] = t10$1;
|
|
49
|
+
} else t10$1 = $[22];
|
|
50
|
+
const title = t10$1;
|
|
51
|
+
let t11$1;
|
|
52
|
+
if ($[23] !== basePath) {
|
|
53
|
+
t11$1 = (action, fallback) => {
|
|
54
|
+
if (!action) return fallback;
|
|
55
|
+
if (action.type === "create") return `${basePath}/collections/${action.collection}/create`;
|
|
56
|
+
if (action.type === "page") return `${basePath}/${action.pageId}`;
|
|
57
|
+
return action.href;
|
|
58
|
+
};
|
|
59
|
+
$[23] = basePath;
|
|
60
|
+
$[24] = t11$1;
|
|
61
|
+
} else t11$1 = $[24];
|
|
62
|
+
const resolveActionHref = t11$1;
|
|
63
|
+
let t12;
|
|
64
|
+
if ($[25] !== basePath || $[26] !== resolveActionHref || $[27] !== resolveText) {
|
|
65
|
+
t12 = (action_0, index) => {
|
|
66
|
+
if (typeof action_0 === "string") {
|
|
67
|
+
const [collection, actionType] = action_0.split(".");
|
|
50
68
|
return {
|
|
51
|
-
id: `${
|
|
69
|
+
id: `${action_0}-${index}`,
|
|
52
70
|
label: `${actionType === "create" ? "New" : actionType} ${formatLabel(collection)}`,
|
|
53
71
|
href: `${basePath}/collections/${collection}/${actionType === "create" ? "create" : ""}`,
|
|
54
72
|
icon: void 0,
|
|
55
73
|
variant: "default"
|
|
56
74
|
};
|
|
57
75
|
}
|
|
76
|
+
const serverAction = "action" in action_0 ? action_0.action : void 0;
|
|
58
77
|
return {
|
|
59
78
|
id: `action-${index}`,
|
|
60
|
-
label: resolveText(
|
|
61
|
-
href:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
79
|
+
label: resolveText(action_0.label),
|
|
80
|
+
href: resolveActionHref(serverAction, action_0.href),
|
|
81
|
+
external: serverAction?.type === "link" ? serverAction.external : false,
|
|
82
|
+
onClick: action_0.onClick,
|
|
83
|
+
icon: action_0.icon,
|
|
84
|
+
variant: action_0.variant || "default"
|
|
65
85
|
};
|
|
66
86
|
};
|
|
67
|
-
$[
|
|
68
|
-
$[
|
|
69
|
-
$[
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
87
|
+
$[25] = basePath;
|
|
88
|
+
$[26] = resolveActionHref;
|
|
89
|
+
$[27] = resolveText;
|
|
90
|
+
$[28] = t12;
|
|
91
|
+
} else t12 = $[28];
|
|
92
|
+
const parsedActions = quickActions.map(t12);
|
|
93
|
+
let t13;
|
|
94
|
+
if ($[29] !== navigate) {
|
|
95
|
+
t13 = (action_1) => {
|
|
96
|
+
if (action_1.onClick) action_1.onClick();
|
|
97
|
+
else if (action_1.href && action_1.external) window.open(action_1.href, "_blank", "noopener,noreferrer");
|
|
98
|
+
else if (action_1.href && navigate) navigate(action_1.href);
|
|
77
99
|
};
|
|
78
|
-
$[
|
|
79
|
-
$[
|
|
80
|
-
} else
|
|
81
|
-
const handleClick =
|
|
100
|
+
$[29] = navigate;
|
|
101
|
+
$[30] = t13;
|
|
102
|
+
} else t13 = $[30];
|
|
103
|
+
const handleClick = t13;
|
|
82
104
|
const variantStyles = {
|
|
83
|
-
default: "hover:bg-
|
|
84
|
-
primary: "
|
|
85
|
-
secondary: "hover:bg-secondary cursor-pointer",
|
|
86
|
-
outline: "border
|
|
105
|
+
default: "border-border-subtle bg-surface-low/60 hover:border-border hover:bg-surface-high cursor-pointer",
|
|
106
|
+
primary: "border-primary/30 bg-primary/10 text-foreground hover:border-primary/45 hover:bg-primary/15 [&_svg]:text-primary cursor-pointer",
|
|
107
|
+
secondary: "border-border-subtle bg-secondary/60 hover:bg-secondary cursor-pointer",
|
|
108
|
+
outline: "border-border bg-background hover:bg-muted cursor-pointer"
|
|
87
109
|
};
|
|
88
110
|
const iconVariantStyles = {
|
|
89
111
|
default: "bg-muted text-muted-foreground",
|
|
90
|
-
primary: "bg-primary/
|
|
112
|
+
primary: "bg-primary/15 text-primary",
|
|
91
113
|
secondary: "bg-secondary text-secondary-foreground",
|
|
92
114
|
outline: "bg-background text-muted-foreground"
|
|
93
115
|
};
|
|
94
116
|
if (parsedActions.length === 0) {
|
|
95
|
-
let
|
|
96
|
-
if ($[
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
117
|
+
let t14;
|
|
118
|
+
if ($[31] !== config.description || $[32] !== resolveText) {
|
|
119
|
+
t14 = config.description ? resolveText(config.description) : void 0;
|
|
120
|
+
$[31] = config.description;
|
|
121
|
+
$[32] = resolveText;
|
|
122
|
+
$[33] = t14;
|
|
123
|
+
} else t14 = $[33];
|
|
124
|
+
let t15;
|
|
125
|
+
if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
|
|
126
|
+
t15 = /* @__PURE__ */ jsx(WidgetEmptyState, {
|
|
127
|
+
iconName: "ph:lightning",
|
|
128
|
+
title: "No actions configured",
|
|
129
|
+
description: "There are no shortcuts to display."
|
|
100
130
|
});
|
|
101
|
-
$[
|
|
102
|
-
} else
|
|
103
|
-
let
|
|
104
|
-
if ($[
|
|
105
|
-
|
|
131
|
+
$[34] = t15;
|
|
132
|
+
} else t15 = $[34];
|
|
133
|
+
let t16;
|
|
134
|
+
if ($[35] !== config.cardVariant || $[36] !== config.className || $[37] !== t14 || $[38] !== title) {
|
|
135
|
+
t16 = /* @__PURE__ */ jsx(WidgetCard, {
|
|
106
136
|
title,
|
|
107
|
-
|
|
137
|
+
description: t14,
|
|
138
|
+
variant: config.cardVariant,
|
|
139
|
+
className: config.className,
|
|
140
|
+
children: t15
|
|
108
141
|
});
|
|
109
|
-
$[
|
|
110
|
-
$[
|
|
111
|
-
|
|
112
|
-
|
|
142
|
+
$[35] = config.cardVariant;
|
|
143
|
+
$[36] = config.className;
|
|
144
|
+
$[37] = t14;
|
|
145
|
+
$[38] = title;
|
|
146
|
+
$[39] = t16;
|
|
147
|
+
} else t16 = $[39];
|
|
148
|
+
t9 = t16;
|
|
113
149
|
break bb0;
|
|
114
150
|
}
|
|
115
151
|
if (layout === "grid") {
|
|
116
|
-
|
|
152
|
+
let t14;
|
|
153
|
+
if ($[40] !== config.description || $[41] !== resolveText) {
|
|
154
|
+
t14 = config.description ? resolveText(config.description) : void 0;
|
|
155
|
+
$[40] = config.description;
|
|
156
|
+
$[41] = resolveText;
|
|
157
|
+
$[42] = t14;
|
|
158
|
+
} else t14 = $[42];
|
|
159
|
+
t9 = /* @__PURE__ */ jsx(WidgetCard, {
|
|
117
160
|
title,
|
|
161
|
+
description: t14,
|
|
162
|
+
variant: config.cardVariant,
|
|
163
|
+
className: config.className,
|
|
118
164
|
children: /* @__PURE__ */ jsx("div", {
|
|
119
|
-
className: "grid grid-cols-2 gap-
|
|
120
|
-
children: parsedActions.map((
|
|
121
|
-
const iconElement = resolveIconElement(
|
|
165
|
+
className: "grid h-full grid-cols-2 gap-3",
|
|
166
|
+
children: parsedActions.map((action_2) => {
|
|
167
|
+
const iconElement = resolveIconElement(action_2.icon, { className: "h-4 w-4" });
|
|
122
168
|
return /* @__PURE__ */ jsxs("button", {
|
|
123
169
|
type: "button",
|
|
124
|
-
onClick: () => handleClick(
|
|
125
|
-
className: cn("flex flex-col items-center justify-center gap-2 p-3 text-center transition-
|
|
170
|
+
onClick: () => handleClick(action_2),
|
|
171
|
+
className: cn("flex min-h-24 flex-col items-center justify-center gap-2 rounded-md border p-3 text-center", "transition-[background-color,border-color,transform] active:scale-[0.96]", variantStyles[action_2.variant]),
|
|
126
172
|
children: [iconElement && /* @__PURE__ */ jsx("div", {
|
|
127
|
-
className: cn("flex h-9 w-9 items-center justify-center", iconVariantStyles[
|
|
173
|
+
className: cn("flex h-9 w-9 items-center justify-center rounded-md", iconVariantStyles[action_2.variant]),
|
|
128
174
|
children: iconElement
|
|
129
175
|
}), /* @__PURE__ */ jsx("span", {
|
|
130
|
-
className: "text-xs font-medium",
|
|
131
|
-
children:
|
|
176
|
+
className: "text-xs leading-tight font-medium text-balance",
|
|
177
|
+
children: action_2.label
|
|
132
178
|
})]
|
|
133
|
-
},
|
|
179
|
+
}, action_2.id);
|
|
134
180
|
})
|
|
135
181
|
})
|
|
136
182
|
});
|
|
137
183
|
break bb0;
|
|
138
184
|
}
|
|
139
185
|
T0 = WidgetCard;
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
186
|
+
t5 = title;
|
|
187
|
+
if ($[43] !== config.description || $[44] !== resolveText) {
|
|
188
|
+
t6 = config.description ? resolveText(config.description) : void 0;
|
|
189
|
+
$[43] = config.description;
|
|
190
|
+
$[44] = resolveText;
|
|
191
|
+
$[45] = t6;
|
|
192
|
+
} else t6 = $[45];
|
|
193
|
+
t7 = config.cardVariant;
|
|
194
|
+
t8 = config.className;
|
|
195
|
+
t3 = "-mx-1 space-y-1";
|
|
196
|
+
t4 = parsedActions.map((action_3) => {
|
|
197
|
+
const iconElement_0 = resolveIconElement(action_3.icon, { className: "h-4 w-4" });
|
|
144
198
|
return /* @__PURE__ */ jsxs("button", {
|
|
145
199
|
type: "button",
|
|
146
|
-
onClick: () => handleClick(
|
|
147
|
-
className: cn("flex w-full items-center gap-3 px-2 py-2 text-left transition-
|
|
200
|
+
onClick: () => handleClick(action_3),
|
|
201
|
+
className: cn("group flex min-h-10 w-full items-center gap-3 rounded-md px-2 py-2 text-left transition-[background-color,transform] active:scale-[0.96]", variantStyles[action_3.variant]),
|
|
148
202
|
children: [
|
|
149
203
|
iconElement_0 && /* @__PURE__ */ jsx("div", {
|
|
150
|
-
className: cn("flex h-8 w-8 shrink-0 items-center justify-center", iconVariantStyles[
|
|
204
|
+
className: cn("flex h-8 w-8 shrink-0 items-center justify-center rounded-md", iconVariantStyles[action_3.variant]),
|
|
151
205
|
children: iconElement_0
|
|
152
206
|
}),
|
|
153
207
|
/* @__PURE__ */ jsx("span", {
|
|
154
208
|
className: "flex-1 truncate text-sm font-medium",
|
|
155
|
-
children:
|
|
209
|
+
children: action_3.label
|
|
156
210
|
}),
|
|
157
211
|
/* @__PURE__ */ jsx(Icon, {
|
|
158
212
|
icon: "ph:arrow-right",
|
|
159
213
|
className: "text-muted-foreground h-4 w-4 opacity-0 transition-opacity group-hover:opacity-100"
|
|
160
214
|
})
|
|
161
215
|
]
|
|
162
|
-
},
|
|
216
|
+
}, action_3.id);
|
|
163
217
|
});
|
|
164
218
|
}
|
|
165
|
-
$[
|
|
166
|
-
$[
|
|
167
|
-
$[
|
|
168
|
-
$[
|
|
169
|
-
$[
|
|
170
|
-
$[
|
|
171
|
-
$[
|
|
172
|
-
$[
|
|
173
|
-
$[
|
|
174
|
-
$[
|
|
175
|
-
$[
|
|
219
|
+
$[0] = basePath;
|
|
220
|
+
$[1] = config.actions;
|
|
221
|
+
$[2] = config.cardVariant;
|
|
222
|
+
$[3] = config.className;
|
|
223
|
+
$[4] = config.description;
|
|
224
|
+
$[5] = config.label;
|
|
225
|
+
$[6] = config.quickActions;
|
|
226
|
+
$[7] = config.title;
|
|
227
|
+
$[8] = layout;
|
|
228
|
+
$[9] = navigate;
|
|
229
|
+
$[10] = resolveText;
|
|
230
|
+
$[11] = T0;
|
|
231
|
+
$[12] = t3;
|
|
232
|
+
$[13] = t4;
|
|
233
|
+
$[14] = t5;
|
|
234
|
+
$[15] = t6;
|
|
235
|
+
$[16] = t7;
|
|
236
|
+
$[17] = t8;
|
|
237
|
+
$[18] = t9;
|
|
176
238
|
} else {
|
|
177
|
-
T0 = $[
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
239
|
+
T0 = $[11];
|
|
240
|
+
t3 = $[12];
|
|
241
|
+
t4 = $[13];
|
|
242
|
+
t5 = $[14];
|
|
243
|
+
t6 = $[15];
|
|
244
|
+
t7 = $[16];
|
|
245
|
+
t8 = $[17];
|
|
246
|
+
t9 = $[18];
|
|
182
247
|
}
|
|
183
|
-
if (
|
|
184
|
-
let
|
|
185
|
-
if ($[
|
|
186
|
-
|
|
187
|
-
className:
|
|
188
|
-
children:
|
|
248
|
+
if (t9 !== Symbol.for("react.early_return_sentinel")) return t9;
|
|
249
|
+
let t10;
|
|
250
|
+
if ($[46] !== t3 || $[47] !== t4) {
|
|
251
|
+
t10 = /* @__PURE__ */ jsx("div", {
|
|
252
|
+
className: t3,
|
|
253
|
+
children: t4
|
|
189
254
|
});
|
|
190
|
-
$[
|
|
191
|
-
$[
|
|
192
|
-
$[
|
|
193
|
-
} else
|
|
194
|
-
let
|
|
195
|
-
if ($[
|
|
196
|
-
|
|
197
|
-
title:
|
|
198
|
-
|
|
255
|
+
$[46] = t3;
|
|
256
|
+
$[47] = t4;
|
|
257
|
+
$[48] = t10;
|
|
258
|
+
} else t10 = $[48];
|
|
259
|
+
let t11;
|
|
260
|
+
if ($[49] !== T0 || $[50] !== t10 || $[51] !== t5 || $[52] !== t6 || $[53] !== t7 || $[54] !== t8) {
|
|
261
|
+
t11 = /* @__PURE__ */ jsx(T0, {
|
|
262
|
+
title: t5,
|
|
263
|
+
description: t6,
|
|
264
|
+
variant: t7,
|
|
265
|
+
className: t8,
|
|
266
|
+
children: t10
|
|
199
267
|
});
|
|
200
|
-
$[
|
|
201
|
-
$[
|
|
202
|
-
$[
|
|
203
|
-
$[
|
|
204
|
-
|
|
205
|
-
|
|
268
|
+
$[49] = T0;
|
|
269
|
+
$[50] = t10;
|
|
270
|
+
$[51] = t5;
|
|
271
|
+
$[52] = t6;
|
|
272
|
+
$[53] = t7;
|
|
273
|
+
$[54] = t8;
|
|
274
|
+
$[55] = t11;
|
|
275
|
+
} else t11 = $[55];
|
|
276
|
+
return t11;
|
|
206
277
|
}
|
|
207
278
|
|
|
208
279
|
//#endregion
|