@alfakit/vue 0.1.8 → 0.1.10
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 +14 -0
- package/dist/app/components.d.ts.map +1 -1
- package/dist/app/components.js +1 -0
- package/dist/app/components.js.map +1 -1
- package/dist/components/actions/ActionModal.js.map +1 -1
- package/dist/components/actions/ActionModal.vue.d.ts.map +1 -1
- package/dist/components/actions/ActionModal.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/actions/ActionModal.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/dev-tools/DevToolsInspector.js.map +1 -1
- package/dist/components/dev-tools/DevToolsInspector.vue.d.ts.map +1 -1
- package/dist/components/dev-tools/DevToolsInspector.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/dev-tools/DevToolsInspector.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/fields/CheckboxListField.js.map +1 -1
- package/dist/components/fields/CheckboxListField.vue.d.ts.map +1 -1
- package/dist/components/fields/CheckboxListField.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/components/fields/CheckboxListField.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/fields/DatePickerField.js.map +1 -1
- package/dist/components/fields/DatePickerField.vue.d.ts.map +1 -1
- package/dist/components/fields/DatePickerField.vue_vue_type_script_setup_true_lang.js +34 -32
- package/dist/components/fields/DatePickerField.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/fields/RichEditorSuggestions.js.map +1 -1
- package/dist/components/fields/RichEditorSuggestions.vue.d.ts +1 -1
- package/dist/components/fields/RichEditorSuggestions.vue.d.ts.map +1 -1
- package/dist/components/fields/RichEditorSuggestions.vue_vue_type_script_setup_true_lang.js +29 -23
- package/dist/components/fields/RichEditorSuggestions.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/fields/RichEditorToolbarGroup.js.map +1 -1
- package/dist/components/fields/RichEditorToolbarGroup.vue.d.ts.map +1 -1
- package/dist/components/fields/RichEditorToolbarGroup.vue_vue_type_script_setup_true_lang.js +9 -4
- package/dist/components/fields/RichEditorToolbarGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/file-manager/FileManagerView.js.map +1 -1
- package/dist/components/file-manager/FileManagerView.vue.d.ts.map +1 -1
- package/dist/components/file-manager/FileManagerView.vue_vue_type_script_setup_true_lang.js +5 -1
- package/dist/components/file-manager/FileManagerView.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/form/FormBlock.js.map +1 -1
- package/dist/components/form/FormBlock.vue.d.ts.map +1 -1
- package/dist/components/form/FormBlock.vue_vue_type_script_setup_true_lang.js +79 -78
- package/dist/components/form/FormBlock.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/layout/CalloutComponent.js.map +1 -1
- package/dist/components/layout/CalloutComponent.vue.d.ts.map +1 -1
- package/dist/components/layout/CalloutComponent.vue_vue_type_script_setup_true_lang.js +43 -39
- package/dist/components/layout/CalloutComponent.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/layout/EmptyStateComponent.js.map +1 -1
- package/dist/components/layout/EmptyStateComponent.vue.d.ts.map +1 -1
- package/dist/components/layout/EmptyStateComponent.vue_vue_type_script_setup_true_lang.js +29 -26
- package/dist/components/layout/EmptyStateComponent.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/layout/MixedContent.js.map +1 -1
- package/dist/components/layout/MixedContent.vue.d.ts +5 -3
- package/dist/components/layout/MixedContent.vue.d.ts.map +1 -1
- package/dist/components/layout/MixedContent.vue_vue_type_script_setup_true_lang.js +5 -4
- package/dist/components/layout/MixedContent.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/layout/SectionComponent.js.map +1 -1
- package/dist/components/layout/SectionComponent.vue.d.ts.map +1 -1
- package/dist/components/layout/SectionComponent.vue_vue_type_script_setup_true_lang.js +12 -8
- package/dist/components/layout/SectionComponent.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/notifications/NotificationsMenu.js.map +1 -1
- package/dist/components/notifications/NotificationsMenu.vue.d.ts.map +1 -1
- package/dist/components/notifications/NotificationsMenu.vue_vue_type_script_setup_true_lang.js +133 -104
- package/dist/components/notifications/NotificationsMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/panel/BottomNav.js.map +1 -1
- package/dist/components/panel/BottomNav.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/components/panel/BottomNav.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/panel/KeyboardShortcuts.js.map +1 -1
- package/dist/components/panel/KeyboardShortcuts.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/panel/KeyboardShortcuts.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/panel/NavGroup.js.map +1 -1
- package/dist/components/panel/NavGroup.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/components/panel/NavGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/panel/NavItem.js.map +1 -1
- package/dist/components/panel/NavItem.vue.d.ts.map +1 -1
- package/dist/components/panel/NavItem.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/panel/NavItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/panel/NavSubItem.js.map +1 -1
- package/dist/components/panel/NavSubItem.vue.d.ts.map +1 -1
- package/dist/components/panel/NavSubItem.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/panel/NavSubItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/panel/ShortcutsOverlay.js.map +1 -1
- package/dist/components/panel/ShortcutsOverlay.vue.d.ts.map +1 -1
- package/dist/components/panel/ShortcutsOverlay.vue_vue_type_script_setup_true_lang.js +20 -19
- package/dist/components/panel/ShortcutsOverlay.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/table/ColumnManager.js.map +1 -1
- package/dist/components/table/ColumnManager.vue.d.ts.map +1 -1
- package/dist/components/table/ColumnManager.vue_vue_type_script_setup_true_lang.js +6 -6
- package/dist/components/table/ColumnManager.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/table/Spreadsheet.js.map +1 -1
- package/dist/components/table/Spreadsheet.vue.d.ts.map +1 -1
- package/dist/components/table/Spreadsheet.vue_vue_type_script_setup_true_lang.js +37 -33
- package/dist/components/table/Spreadsheet.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/translation-manager/TranslationManagerView.js.map +1 -1
- package/dist/components/translation-manager/TranslationManagerView.vue.d.ts.map +1 -1
- package/dist/components/translation-manager/TranslationManagerView.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/translation-manager/TranslationManagerView.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/ui/SidebarMenuButton.js.map +1 -1
- package/dist/components/ui/SidebarMenuButton.vue.d.ts.map +1 -1
- package/dist/components/ui/SidebarMenuButton.vue_vue_type_script_setup_true_lang.js +12 -12
- package/dist/components/ui/SidebarMenuButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/ui/TooltipTrigger.js.map +1 -1
- package/dist/components/ui/TooltipTrigger.vue.d.ts +2 -2
- package/dist/components/ui/TooltipTrigger.vue.d.ts.map +1 -1
- package/dist/components/ui/TooltipTrigger.vue_vue_type_script_setup_true_lang.js +10 -7
- package/dist/components/ui/TooltipTrigger.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/widgets/StatCard.js.map +1 -1
- package/dist/components/widgets/StatCard.vue.d.ts.map +1 -1
- package/dist/components/widgets/StatCard.vue_vue_type_script_setup_true_lang.js +30 -30
- package/dist/components/widgets/StatCard.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/eject-manifest.json +2 -2
- package/dist/layouts/TopNavLayout.js.map +1 -1
- package/dist/layouts/TopNavLayout.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/layouts/TopNavLayout.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/layouts/TopNavMenu.js.map +1 -1
- package/dist/layouts/TopNavMenu.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/layouts/TopNavMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/pages/AlfakitPage.js.map +1 -1
- package/dist/pages/AlfakitPage.vue.d.ts.map +1 -1
- package/dist/pages/AlfakitPage.vue_vue_type_script_setup_true_lang.js +16 -19
- package/dist/pages/AlfakitPage.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/standalone/AlfakitComponent.js.map +1 -1
- package/dist/standalone/AlfakitComponent.vue.d.ts.map +1 -1
- package/dist/standalone/AlfakitComponent.vue_vue_type_script_setup_true_lang.js +29 -24
- package/dist/standalone/AlfakitComponent.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/standalone/runtime.d.ts.map +1 -1
- package/dist/standalone/runtime.js +25 -25
- package/dist/standalone/runtime.js.map +1 -1
- package/dist/standalone.css +12 -7
- package/dist/starter-kit/AlfakitStarterKitRoot.js.map +1 -1
- package/dist/starter-kit/AlfakitStarterKitRoot.vue.d.ts.map +1 -1
- package/dist/starter-kit/AlfakitStarterKitRoot.vue_vue_type_script_setup_true_lang.js +25 -21
- package/dist/starter-kit/AlfakitStarterKitRoot.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/starter-kit/navigation.d.ts +6 -1
- package/dist/starter-kit/navigation.d.ts.map +1 -1
- package/dist/starter-kit/navigation.js +11 -10
- package/dist/starter-kit/navigation.js.map +1 -1
- package/dist/styles.css +2 -1
- package/dist/themes.css +4 -0
- package/package.json +2 -2
- package/src/app/components.ts +3 -0
- package/src/components/actions/ActionModal.vue +2 -0
- package/src/components/dev-tools/DevToolsInspector.vue +1 -1
- package/src/components/fields/CheckboxListField.vue +2 -2
- package/src/components/fields/DatePickerField.vue +1 -0
- package/src/components/fields/RichEditorSuggestions.vue +13 -6
- package/src/components/fields/RichEditorToolbarGroup.vue +16 -1
- package/src/components/file-manager/FileManagerView.vue +3 -1
- package/src/components/form/FormBlock.vue +15 -2
- package/src/components/layout/CalloutComponent.vue +15 -2
- package/src/components/layout/EmptyStateComponent.vue +10 -1
- package/src/components/layout/MixedContent.vue +12 -4
- package/src/components/layout/SectionComponent.vue +20 -4
- package/src/components/notifications/NotificationsMenu.vue +45 -1
- package/src/components/panel/BottomNav.vue +2 -2
- package/src/components/panel/KeyboardShortcuts.vue +1 -1
- package/src/components/panel/NavGroup.vue +3 -3
- package/src/components/panel/NavItem.vue +5 -1
- package/src/components/panel/NavSubItem.vue +5 -1
- package/src/components/panel/ShortcutsOverlay.vue +27 -22
- package/src/components/table/ColumnManager.vue +6 -4
- package/src/components/table/Spreadsheet.vue +9 -4
- package/src/components/translation-manager/TranslationManagerView.vue +1 -1
- package/src/components/ui/SidebarMenuButton.vue +6 -0
- package/src/components/ui/TooltipTrigger.vue +4 -1
- package/src/components/widgets/StatCard.vue +6 -3
- package/src/layouts/TopNavLayout.vue +2 -2
- package/src/layouts/TopNavMenu.vue +1 -1
- package/src/pages/AlfakitPage.vue +13 -3
- package/src/standalone/AlfakitComponent.vue +16 -5
- package/src/standalone/runtime.ts +3 -0
- package/src/starter-kit/AlfakitStarterKitRoot.vue +7 -0
- package/src/starter-kit/navigation.ts +12 -1
- package/src/styles.css +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormBlock.vue.d.ts","sourceRoot":"","sources":["../../../src/components/form/FormBlock.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FormBlock.vue.d.ts","sourceRoot":"","sources":["../../../src/components/form/FormBlock.vue"],"names":[],"mappings":"AA6RA,OAAO,KAAK,EAA+B,SAAS,IAAI,eAAe,EAAE,MAAM,eAAe,CAAA;AAmC9F;;;GAGG;AACH,KAAK,WAAW,GAAG;IAAE,KAAK,EAAE,eAAe,CAAA;CAAE,CAAC;;AAoT9C,wBAMG"}
|
|
@@ -1,106 +1,107 @@
|
|
|
1
|
-
import { useActionRunner as e, useAlfakitProps as t, usePageSchema as ee, usePanel as n, useT as
|
|
2
|
-
import { useStore as
|
|
3
|
-
import
|
|
4
|
-
import { provideForm as
|
|
5
|
-
import
|
|
6
|
-
import { showToast as
|
|
7
|
-
import { FormStore as
|
|
8
|
-
import { router as
|
|
9
|
-
import { computed as
|
|
1
|
+
import { useActionRunner as e, useAlfakitProps as t, usePageSchema as ee, usePanel as n, useStandalone as te, useT as ne } from "../../context.js";
|
|
2
|
+
import { useStore as r } from "../../composables/use-store.js";
|
|
3
|
+
import re from "../actions/ActionList.js";
|
|
4
|
+
import { provideForm as ie } from "./form-context.js";
|
|
5
|
+
import ae from "../schema/SchemaRenderer.js";
|
|
6
|
+
import { showToast as oe } from "../notifications/flash-toasts.js";
|
|
7
|
+
import { FormStore as i, applyFormRefresh as a, formActionsVisible as o, formIdPrefix as s, formIdentity as c, formRefreshFor as l, isImplicitSubmit as u, isLeavingVisit as d, pageFlash as f, pageFormName as p, registerConflictForm as m, registerFormSubmitter as se, registerPageForm as ce, resolvePartialProps as le, shouldResyncForm as ue, wizardProgressStore as de } from "@alfakit/core";
|
|
8
|
+
import { router as h } from "@inertiajs/vue3";
|
|
9
|
+
import { computed as g, createCommentVNode as fe, createElementBlock as _, createElementVNode as pe, createVNode as v, defineComponent as y, onBeforeUnmount as b, onMounted as x, onScopeDispose as me, openBlock as S, unref as C, useId as w, watch as T, withModifiers as E } from "vue";
|
|
10
10
|
//#region src/components/form/FormBlock.vue?vue&type=script&setup=true&lang.ts
|
|
11
|
-
var
|
|
11
|
+
var D = ["disabled"], O = {
|
|
12
12
|
key: 0,
|
|
13
13
|
"data-slot": "form-actions",
|
|
14
14
|
class: "border-t pt-6"
|
|
15
|
-
},
|
|
15
|
+
}, k = /*@__PURE__*/ y({
|
|
16
16
|
__name: "FormBlock",
|
|
17
17
|
props: { block: {} },
|
|
18
|
-
setup(
|
|
19
|
-
let
|
|
20
|
-
token:
|
|
21
|
-
component:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
setup(y) {
|
|
19
|
+
let k = y, A = n(), j = ee(), M = t(), N = e(), P = ne(), F = g(() => j.value?.token ?? ""), I = te(), L = w(), R = new i(k.block, {
|
|
20
|
+
token: F.value,
|
|
21
|
+
component: k.block.component,
|
|
22
|
+
idPrefix: I ? s(`form-${L}`) : void 0,
|
|
23
|
+
refreshUrl: A.value.endpoints.schemaRefresh,
|
|
24
|
+
optionsUrl: A.value.endpoints.schemaOptions,
|
|
25
|
+
validateUrl: A.value.endpoints.schemaValidate,
|
|
26
|
+
onNotifications: (e) => e.forEach((e) => oe(e)),
|
|
26
27
|
onRefreshed: () => {
|
|
27
|
-
|
|
28
|
+
k.block.liveFilters && h.reload({ only: le(["page"]) });
|
|
28
29
|
}
|
|
29
30
|
});
|
|
30
|
-
|
|
31
|
-
let R;
|
|
32
|
-
C(() => {
|
|
33
|
-
let e = d(A.block.component);
|
|
34
|
-
e && (R = m(e, L));
|
|
35
|
-
});
|
|
31
|
+
ie(R);
|
|
36
32
|
let z;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
x(() => {
|
|
34
|
+
let e = p(k.block.component);
|
|
35
|
+
e && (z = ce(e, R));
|
|
36
|
+
});
|
|
40
37
|
let B;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}),
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}),
|
|
50
|
-
let
|
|
51
|
-
|
|
38
|
+
x(() => {
|
|
39
|
+
k.block.component === "form" && (B = m(R));
|
|
40
|
+
}), b(() => B?.());
|
|
41
|
+
let V;
|
|
42
|
+
x(() => {
|
|
43
|
+
V = se(k.block.component, (e, t) => Q(e, t));
|
|
44
|
+
}), b(() => {
|
|
45
|
+
z?.(), V?.();
|
|
46
|
+
}), T(() => c(j.value, k.block), () => R.fill(k.block)), T(F, (e) => R.setToken(e));
|
|
47
|
+
let H = null, U = !1, W = !1, G = null;
|
|
48
|
+
T(() => k.block, (e) => {
|
|
49
|
+
U && (U = !1, R.fill(e)), W && (W = !1, R.isDirty || R.fill(e));
|
|
50
|
+
}), T(() => M.value.errors, (e) => R.setErrors(e ?? {}), { immediate: !0 });
|
|
51
|
+
let K = r(R.store), q = g(() => ({
|
|
52
|
+
token: F.value,
|
|
52
53
|
component: "page"
|
|
53
|
-
})),
|
|
54
|
+
})), J = !1, Y = g(() => k.block.actions.map((e) => ({
|
|
54
55
|
...e,
|
|
55
56
|
hasModal: !1
|
|
56
|
-
}))),
|
|
57
|
-
if (e.url && !e.hasAction) return
|
|
58
|
-
|
|
59
|
-
},
|
|
57
|
+
}))), X = g(() => Y.value[0]), he = r(de(R)), Z = g(() => o(k.block, he.value)), Q = async (e, t) => {
|
|
58
|
+
if (e.url && !e.hasAction) return N.trigger(e, t);
|
|
59
|
+
J = !0, H = k.block, R.setProcessing(!0), R.whenSettled(() => N.execute(e, t, R.state.values));
|
|
60
|
+
}, $ = null, ge = h.on("start", (e) => {
|
|
60
61
|
let t = e.detail.visit;
|
|
61
|
-
|
|
62
|
-
}),
|
|
63
|
-
let t =
|
|
64
|
-
if (!t &&
|
|
65
|
-
|
|
62
|
+
J && !$ && t.method !== "get" && ($ = t.id), t.method !== "get" && (G = k.block);
|
|
63
|
+
}), _e = h.on("success", (e) => {
|
|
64
|
+
let t = $;
|
|
65
|
+
if (!t && ue(f(e.detail.page), R)) {
|
|
66
|
+
k.block === G ? W = !0 : R.fill(k.block);
|
|
66
67
|
return;
|
|
67
68
|
}
|
|
68
|
-
t && (e.detail.visitId ?? t) === t &&
|
|
69
|
-
}),
|
|
70
|
-
let t =
|
|
71
|
-
t &&
|
|
72
|
-
}),
|
|
73
|
-
|
|
74
|
-
}),
|
|
75
|
-
|
|
69
|
+
t && (e.detail.visitId ?? t) === t && f(e.detail.page).alfakitAction?.status !== "halted" && (k.block === H ? U = !0 : R.fill(k.block));
|
|
70
|
+
}), ve = h.on("success", (e) => {
|
|
71
|
+
let t = l(f(e.detail.page), k.block.component);
|
|
72
|
+
t && a(R, t);
|
|
73
|
+
}), ye = h.on("finish", (e) => {
|
|
74
|
+
$ && e.detail.visit.id !== $ || (R.setProcessing(!1), J = !1, $ = null);
|
|
75
|
+
}), be = h.on("before", (e) => {
|
|
76
|
+
A.value.unsavedChangesAlerts && R.isDirty && !J && d(e.detail.visit) && !window.confirm(P("unsaved_changes", {}, "You have unsaved changes. Leave anyway?")) && e.preventDefault();
|
|
76
77
|
});
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
me(() => {
|
|
79
|
+
ge(), _e(), ve(), ye(), be(), R.destroy();
|
|
79
80
|
});
|
|
80
|
-
let
|
|
81
|
-
|
|
82
|
-
},
|
|
83
|
-
|
|
81
|
+
let xe = () => {
|
|
82
|
+
X.value && Z.value && Q(X.value, q.value);
|
|
83
|
+
}, Se = (e) => {
|
|
84
|
+
X.value && Z.value && u(e, e.currentTarget) && (e.preventDefault(), Q(X.value, q.value));
|
|
84
85
|
};
|
|
85
|
-
return (e, t) => (
|
|
86
|
+
return (e, t) => (S(), _("form", {
|
|
86
87
|
"data-slot": "form-block",
|
|
87
88
|
class: "flex flex-col gap-6",
|
|
88
|
-
onSubmit:
|
|
89
|
-
onKeydown:
|
|
90
|
-
}, [
|
|
91
|
-
disabled:
|
|
89
|
+
onSubmit: E(xe, ["prevent"]),
|
|
90
|
+
onKeydown: Se
|
|
91
|
+
}, [pe("fieldset", {
|
|
92
|
+
disabled: C(K).processing || k.block.operation === "view",
|
|
92
93
|
class: "contents"
|
|
93
|
-
}, [
|
|
94
|
-
components:
|
|
95
|
-
columns:
|
|
96
|
-
}, null, 8, ["components", "columns"])], 8,
|
|
97
|
-
actions:
|
|
98
|
-
context:
|
|
99
|
-
"on-trigger":
|
|
100
|
-
}, null, 8, ["actions", "context"])])) :
|
|
94
|
+
}, [v(ae, {
|
|
95
|
+
components: C(K).components,
|
|
96
|
+
columns: C(K).columns
|
|
97
|
+
}, null, 8, ["components", "columns"])], 8, D), Y.value.length > 0 && Z.value ? (S(), _("div", O, [v(re, {
|
|
98
|
+
actions: Y.value,
|
|
99
|
+
context: q.value,
|
|
100
|
+
"on-trigger": Q
|
|
101
|
+
}, null, 8, ["actions", "context"])])) : fe("", !0)], 32));
|
|
101
102
|
}
|
|
102
103
|
});
|
|
103
104
|
//#endregion
|
|
104
|
-
export {
|
|
105
|
+
export { k as default };
|
|
105
106
|
|
|
106
107
|
//# sourceMappingURL=FormBlock.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormBlock.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_withModifiers","_createElementVNode","_unref","_createVNode","SchemaRenderer","ActionList","_createCommentVNode","ActionList_default","SchemaRenderer_default","_hoisted_1","_hoisted_2","FormBlock_vue_vue_type_script_setup_true_lang_default","props","__props","panel","usePanel","page","usePageSchema","pageProps","useAlfakitProps","runner","useActionRunner","t","useT","token","computed","store","FormStore","notifications","showToast","n","router","resolvePartialProps","unregisterPageForm","name","pageFormName","registerPageForm","unregisterConflictForm","onMounted","registerConflictForm","onBeforeUnmount","unregisterSubmitter","registerFormSubmitter","trigger","action","ctx","watch","formIdentity","value","submittedBlock","refillPending","resyncPending","visitBlock","block","errors","state","useStore","context","submitting","actions","primary","progress","wizardProgressStore","showActions","formActionsVisible","submitVisit","offStart","visit","event","offSuccess","id","shouldResyncForm","pageFlash","offRefresh","refresh","formRefreshFor","applyFormRefresh","offFinish","offBefore","isLeavingVisit","onSubmit","onKeydown","isImplicitSubmit","openBlock","createElementBlock","withModifiers","createElementVNode","unref","createVNode","createCommentVNode"],"sources":["../../../src/components/form/FormBlock.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { ActionContext, ActionSchema, FormBlock as FormBlockSchema } from '@alfakit/core'\nimport {\n FormStore,\n applyFormRefresh,\n formActionsVisible,\n formIdentity,\n formRefreshFor,\n isImplicitSubmit,\n isLeavingVisit,\n pageFlash,\n pageFormName,\n registerConflictForm,\n registerFormSubmitter,\n registerPageForm,\n resolvePartialProps,\n shouldResyncForm,\n wizardProgressStore,\n} from '@alfakit/core'\nimport { router } from '@inertiajs/vue3'\nimport { computed, onBeforeUnmount, onMounted, onScopeDispose, watch } from 'vue'\nimport { useStore } from '../../composables/use-store'\nimport { useActionRunner, useAlfakitProps, usePageSchema, usePanel, useT } from '../../context'\nimport ActionList from '../actions/ActionList.vue'\nimport SchemaRenderer from '../schema/SchemaRenderer.vue'\nimport { showToast } from '../notifications/flash-toasts'\nimport { provideForm } from './form-context'\n\n/**\n * A page form: its state lives in a FormStore, and its buttons are actions that post the\n * current values through the action endpoint.\n */\nconst props = defineProps<{ block: FormBlockSchema }>()\n\nconst panel = usePanel()\nconst page = usePageSchema()\nconst pageProps = useAlfakitProps()\nconst runner = useActionRunner()\nconst t = useT()\nconst token = computed(() => page.value?.token ?? '')\n\nconst store = new FormStore(props.block, {\n token: token.value,\n component: props.block.component,\n refreshUrl: panel.value.endpoints.schemaRefresh,\n optionsUrl: panel.value.endpoints.schemaOptions,\n validateUrl: panel.value.endpoints.schemaValidate,\n // A halted wizard step shows what its hook sent.\n onNotifications: (notifications) => notifications.forEach((n) => showToast(n)),\n // Live dashboard filters are applied by the refresh; the widgets reload to follow.\n onRefreshed: () => {\n if (props.block.liveFilters) router.reload({ only: resolvePartialProps(['page']) })\n },\n})\n\nprovideForm(store)\n\n// Named forms of custom pages (`<PageForm name>`) publish their store for page method calls\n// (browser only: mounted hooks never run during a server render).\nlet unregisterPageForm: (() => void) | undefined\n\nonMounted(() => {\n const name = pageFormName(props.block.component)\n\n if (name) unregisterPageForm = registerPageForm(name, store)\n})\n\n// Edit pages: the conflict banner diffs and merges the main form (`detectConflicts()`).\nlet unregisterConflictForm: (() => void) | undefined\n\nonMounted(() => {\n if (props.block.component === 'form') unregisterConflictForm = registerConflictForm(store)\n})\n\nonBeforeUnmount(() => unregisterConflictForm?.())\n\n// Buttons elsewhere with `formId('form')` (a header \"Save\") submit through this form.\nlet unregisterSubmitter: (() => void) | undefined\n\nonMounted(() => {\n unregisterSubmitter = registerFormSubmitter(props.block.component, (action, ctx) =>\n trigger(action, ctx),\n )\n})\n\nonBeforeUnmount(() => {\n unregisterPageForm?.()\n unregisterSubmitter?.()\n})\n\n// The store survives reloads of the same form (table sorting/paging, polling,\n// relation-manager actions all deliver a new `block` object); only a different form\n// identity starts from server state again. The token is re-issued per response, so it\n// is swapped in place instead of being part of the identity.\nwatch(\n () => formIdentity(page.value, props.block),\n () => store.fill(props.block),\n)\n\nwatch(token, (value) => store.setToken(value))\n\n// After this form's own successful submit, refill from the server's new state. The new\n// block may arrive before or after Inertia's `success` event, so handle both orders.\nlet submittedBlock: FormBlockSchema | null = null\nlet refillPending = false\n// Another action succeeded and its new block has not arrived yet.\nlet resyncPending = false\n// The block when the latest non-GET visit started, to tell whether its response arrived.\nlet visitBlock: FormBlockSchema | null = null\n\nwatch(\n () => props.block,\n (block) => {\n if (refillPending) {\n refillPending = false\n store.fill(block)\n }\n\n if (resyncPending) {\n resyncPending = false\n\n if (!store.isDirty) store.fill(block)\n }\n },\n)\n\nwatch(\n () => pageProps.value.errors,\n (errors) => store.setErrors((errors as Record<string, string>) ?? {}),\n { immediate: true },\n)\n\nconst state = useStore(store.store)\nconst context = computed<ActionContext>(() => ({ token: token.value, component: 'page' }))\nlet submitting = false\n\nconst actions = computed<ActionSchema[]>(() =>\n props.block.actions.map((action) => ({ ...action, hasModal: false })),\n)\nconst primary = computed(() => actions.value[0])\n\n// Wizard forms (`HasWizard` pages) show their buttons on the last step only.\nconst progress = useStore(wizardProgressStore(store))\nconst showActions = computed(() => formActionsVisible(props.block, progress.value))\n\nconst trigger = async (action: ActionSchema, ctx: ActionContext) => {\n if (action.url && !action.hasAction) {\n return runner.trigger(action, ctx)\n }\n\n submitting = true\n submittedBlock = props.block\n store.setProcessing(true)\n // A click that blurred a live field started a refresh: send the state it returns.\n store.whenSettled(() => runner.execute(action, ctx, store.state.values))\n}\n\n// Track this form's own submit visit so unrelated reloads finishing meanwhile (polling,\n// relation-manager paging) neither end its processing state nor count as its success.\nlet submitVisit: string | null = null\n\nconst offStart = router.on('start', (event) => {\n const visit = event.detail.visit\n\n if (submitting && !submitVisit && visit.method !== 'get') {\n submitVisit = visit.id\n }\n\n if (visit.method !== 'get') visitBlock = props.block\n})\n\nconst offSuccess = router.on('success', (event) => {\n const id = submitVisit\n\n // Another action changed the record: show the server's new form unless it holds edits.\n if (!id && shouldResyncForm(pageFlash(event.detail.page), store)) {\n if (props.block !== visitBlock) {\n store.fill(props.block)\n } else {\n resyncPending = true\n }\n\n return\n }\n\n if (!id || (event.detail.visitId ?? id) !== id) return\n\n // A halted action (rate limit, `halt()`) saved nothing: keep what the user typed.\n if (pageFlash(event.detail.page).alfakitAction?.status === 'halted') return\n\n if (props.block !== submittedBlock) {\n store.fill(props.block)\n } else {\n refillPending = true\n }\n})\n\n// `refreshFormData([...])`: an action changed the record; copy those fields in.\nconst offRefresh = router.on('success', (event) => {\n const refresh = formRefreshFor(pageFlash(event.detail.page), props.block.component)\n\n if (refresh) applyFormRefresh(store, refresh)\n})\n\nconst offFinish = router.on('finish', (event) => {\n if (submitVisit && event.detail.visit.id !== submitVisit) return\n\n store.setProcessing(false)\n submitting = false\n submitVisit = null\n})\n\nconst offBefore = router.on('before', (event) => {\n if (!panel.value.unsavedChangesAlerts) {\n return\n }\n\n if (\n store.isDirty &&\n !submitting &&\n isLeavingVisit(event.detail.visit) &&\n !window.confirm(t('unsaved_changes', {}, 'You have unsaved changes. Leave anyway?'))\n ) {\n event.preventDefault()\n }\n})\n\nonScopeDispose(() => {\n offStart()\n offSuccess()\n offRefresh()\n offFinish()\n offBefore()\n store.destroy()\n})\n\nconst onSubmit = () => {\n if (primary.value && showActions.value) {\n void trigger(primary.value, context.value)\n }\n}\n\n// Enter in a text field runs the primary action (actions are type=\"button\").\nconst onKeydown = (event: KeyboardEvent) => {\n if (\n primary.value &&\n showActions.value &&\n isImplicitSubmit(event, event.currentTarget as HTMLFormElement)\n ) {\n event.preventDefault()\n void trigger(primary.value, context.value)\n }\n}\n</script>\n\n<template>\n <form\n data-slot=\"form-block\"\n class=\"flex flex-col gap-6\"\n @submit.prevent=\"onSubmit\"\n @keydown=\"onKeydown\"\n >\n <fieldset :disabled=\"state.processing || props.block.operation === 'view'\" class=\"contents\">\n <SchemaRenderer :components=\"state.components\" :columns=\"state.columns\" />\n </fieldset>\n <div v-if=\"actions.length > 0 && showActions\" data-slot=\"form-actions\" class=\"border-t pt-6\">\n <ActionList :actions=\"actions\" :context=\"context\" :on-trigger=\"trigger\" />\n </div>\n </form>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;EAgCA,IAAMc,IAAQC,GAERC,IAAQC,EAAS,GACjBC,IAAOC,GAAc,GACrBC,IAAYC,EAAgB,GAC5BC,IAASC,EAAgB,GACzBC,IAAIC,EAAK,GACTC,IAAQC,QAAeT,EAAK,OAAO,SAAS,EAAE,GAE9CU,IAAQ,IAAIC,GAAUf,EAAM,OAAO;GACvC,OAAOY,EAAM;GACb,WAAWZ,EAAM,MAAM;GACvB,YAAYE,EAAM,MAAM,UAAU;GAClC,YAAYA,EAAM,MAAM,UAAU;GAClC,aAAaA,EAAM,MAAM,UAAU;GAEnC,kBAAkB,MAAkBc,EAAc,SAAS,MAAMC,GAAUC,CAAC,CAAC;GAE7E,mBAAmB;IACjB,AAAIlB,EAAM,MAAM,eAAamB,EAAO,OAAO,EAAE,MAAMC,EAAoB,CAAC,MAAM,CAAC,EAAE,CAAC;GACpF;EACF,CAAC;EAED,GAAYN,CAAK;EAIjB,IAAIO;EAEJ,QAAgB;GACd,IAAMC,IAAOC,EAAavB,EAAM,MAAM,SAAS;GAE/C,AAAIsB,MAAM,IAAqBE,EAAiBF,GAAMR,CAAK;EAC7D,CAAC;EAGD,IAAIW;EAMJ,AAJAC,QAAgB;GACd,A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CAACgC,KACDqB,EAAeX,EAAM,OAAO,KAAK,KACjC,CAAC,OAAO,QAAQ9C,EAAE,mBAAmB,CAAC,GAAG,yCAAyC,CAAC,KAEnF8C,EAAM,eAAe;EAEzB,CAAC;EAED,SAAqB;GAMnB,AALAF,GAAS,GACTG,GAAW,GACXI,GAAW,GACXI,GAAU,GACVC,GAAU,GACVpD,EAAM,QAAQ;EAChB,CAAC;EAED,IAAMsD,UAAiB;GACrB,AAAIpB,EAAQ,SAASG,EAAY,SAC/BpB,EAAaiB,EAAQ,OAAOH,EAAQ,KAAK;EAE7C,GAGMwB,MAAa,MAAyB;GAC1C,AACErB,EAAQ,SACRG,EAAY,SACZmB,EAAiBd,GAAOA,EAAM,aAAgC,MAE9DA,EAAM,eAAe,GACrBzB,EAAaiB,EAAQ,OAAOH,EAAQ,KAAK;EAE7C;oBAIE3D,EAAA,GAAAC,EAYO,QAAA;GAXL,aAAU;GACV,OAAM;GACL,UAAMC,EAAUgF,GAAQ,CAAA,SAAA,CAAA;GACf;EAEV/E,GAAAA,CAAAA,GAEW,YAAA;GAFA,UAAUC,EAAAqD,CAAA,CAAK,CAAC,cAAc3C,EAAM,MAAM,cAAS;GAAa,OAAM;EAC/ET,GAAAA,CAAAA,EAA0EC,IAAA;GAAzD,YAAYF,EAAAqD,CAAA,CAAK,CAAC;GAAa,SAASrD,EAAAqD,CAAA,CAAK,CAAC;EAEtD,GAAA,MAAA,GAAA,CAAA,cAAA,SAAA,CAAA,CAAA,GAAA,GAAA9C,CAAA,GAAAkD,EAAA,MAAQ,SAAM,KAAQI,EAAA,SAAjCjE,EAAA,GAAAC,EAEM,OAFNW,GAEM,CADJP,EAA0EE,IAAA;GAA7D,SAASsD,EAAA;GAAU,SAASF,EAAA;GAAU,cAAYd"}
|
|
1
|
+
{"version":3,"file":"FormBlock.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_withModifiers","_createElementVNode","_unref","_createVNode","SchemaRenderer","ActionList","_createCommentVNode","ActionList_default","SchemaRenderer_default","_hoisted_1","_hoisted_2","FormBlock_vue_vue_type_script_setup_true_lang_default","props","__props","panel","usePanel","page","usePageSchema","pageProps","useAlfakitProps","runner","useActionRunner","t","useT","token","computed","standalone","useStandalone","instanceId","useId","store","FormStore","formIdPrefix","notifications","showToast","n","router","resolvePartialProps","unregisterPageForm","name","pageFormName","registerPageForm","unregisterConflictForm","onMounted","registerConflictForm","onBeforeUnmount","unregisterSubmitter","registerFormSubmitter","trigger","action","ctx","watch","formIdentity","value","submittedBlock","refillPending","resyncPending","visitBlock","block","errors","state","useStore","context","submitting","actions","primary","progress","wizardProgressStore","showActions","formActionsVisible","submitVisit","offStart","visit","event","offSuccess","id","shouldResyncForm","pageFlash","offRefresh","refresh","formRefreshFor","applyFormRefresh","offFinish","offBefore","isLeavingVisit","onSubmit","onKeydown","isImplicitSubmit","openBlock","createElementBlock","withModifiers","createElementVNode","unref","createVNode","createCommentVNode"],"sources":["../../../src/components/form/FormBlock.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { ActionContext, ActionSchema, FormBlock as FormBlockSchema } from '@alfakit/core'\nimport {\n FormStore,\n applyFormRefresh,\n formActionsVisible,\n formIdPrefix,\n formIdentity,\n formRefreshFor,\n isImplicitSubmit,\n isLeavingVisit,\n pageFlash,\n pageFormName,\n registerConflictForm,\n registerFormSubmitter,\n registerPageForm,\n resolvePartialProps,\n shouldResyncForm,\n wizardProgressStore,\n} from '@alfakit/core'\nimport { router } from '@inertiajs/vue3'\nimport { computed, onBeforeUnmount, onMounted, onScopeDispose, useId, watch } from 'vue'\nimport { useStore } from '../../composables/use-store'\nimport {\n useActionRunner,\n useAlfakitProps,\n usePageSchema,\n usePanel,\n useStandalone,\n useT,\n} from '../../context'\nimport ActionList from '../actions/ActionList.vue'\nimport SchemaRenderer from '../schema/SchemaRenderer.vue'\nimport { showToast } from '../notifications/flash-toasts'\nimport { provideForm } from './form-context'\n\n/**\n * A page form: its state lives in a FormStore, and its buttons are actions that post the\n * current values through the action endpoint.\n */\nconst props = defineProps<{ block: FormBlockSchema }>()\n\nconst panel = usePanel()\nconst page = usePageSchema()\nconst pageProps = useAlfakitProps()\nconst runner = useActionRunner()\nconst t = useT()\nconst token = computed(() => page.value?.token ?? '')\n\n// Several standalone components can share a page (and field names): each form gets its own\n// field id prefix, so labels and errors point at their own inputs.\nconst standalone = useStandalone()\nconst instanceId = useId()\nconst store = new FormStore(props.block, {\n token: token.value,\n component: props.block.component,\n idPrefix: standalone ? formIdPrefix(`form-${instanceId}`) : undefined,\n refreshUrl: panel.value.endpoints.schemaRefresh,\n optionsUrl: panel.value.endpoints.schemaOptions,\n validateUrl: panel.value.endpoints.schemaValidate,\n // A halted wizard step shows what its hook sent.\n onNotifications: (notifications) => notifications.forEach((n) => showToast(n)),\n // Live dashboard filters are applied by the refresh; the widgets reload to follow.\n onRefreshed: () => {\n if (props.block.liveFilters) router.reload({ only: resolvePartialProps(['page']) })\n },\n})\n\nprovideForm(store)\n\n// Named forms of custom pages (`<PageForm name>`) publish their store for page method calls\n// (browser only: mounted hooks never run during a server render).\nlet unregisterPageForm: (() => void) | undefined\n\nonMounted(() => {\n const name = pageFormName(props.block.component)\n\n if (name) unregisterPageForm = registerPageForm(name, store)\n})\n\n// Edit pages: the conflict banner diffs and merges the main form (`detectConflicts()`).\nlet unregisterConflictForm: (() => void) | undefined\n\nonMounted(() => {\n if (props.block.component === 'form') unregisterConflictForm = registerConflictForm(store)\n})\n\nonBeforeUnmount(() => unregisterConflictForm?.())\n\n// Buttons elsewhere with `formId('form')` (a header \"Save\") submit through this form.\nlet unregisterSubmitter: (() => void) | undefined\n\nonMounted(() => {\n unregisterSubmitter = registerFormSubmitter(props.block.component, (action, ctx) =>\n trigger(action, ctx),\n )\n})\n\nonBeforeUnmount(() => {\n unregisterPageForm?.()\n unregisterSubmitter?.()\n})\n\n// The store survives reloads of the same form (table sorting/paging, polling,\n// relation-manager actions all deliver a new `block` object); only a different form\n// identity starts from server state again. The token is re-issued per response, so it\n// is swapped in place instead of being part of the identity.\nwatch(\n () => formIdentity(page.value, props.block),\n () => store.fill(props.block),\n)\n\nwatch(token, (value) => store.setToken(value))\n\n// After this form's own successful submit, refill from the server's new state. The new\n// block may arrive before or after Inertia's `success` event, so handle both orders.\nlet submittedBlock: FormBlockSchema | null = null\nlet refillPending = false\n// Another action succeeded and its new block has not arrived yet.\nlet resyncPending = false\n// The block when the latest non-GET visit started, to tell whether its response arrived.\nlet visitBlock: FormBlockSchema | null = null\n\nwatch(\n () => props.block,\n (block) => {\n if (refillPending) {\n refillPending = false\n store.fill(block)\n }\n\n if (resyncPending) {\n resyncPending = false\n\n if (!store.isDirty) store.fill(block)\n }\n },\n)\n\nwatch(\n () => pageProps.value.errors,\n (errors) => store.setErrors((errors as Record<string, string>) ?? {}),\n { immediate: true },\n)\n\nconst state = useStore(store.store)\nconst context = computed<ActionContext>(() => ({ token: token.value, component: 'page' }))\nlet submitting = false\n\nconst actions = computed<ActionSchema[]>(() =>\n props.block.actions.map((action) => ({ ...action, hasModal: false })),\n)\nconst primary = computed(() => actions.value[0])\n\n// Wizard forms (`HasWizard` pages) show their buttons on the last step only.\nconst progress = useStore(wizardProgressStore(store))\nconst showActions = computed(() => formActionsVisible(props.block, progress.value))\n\nconst trigger = async (action: ActionSchema, ctx: ActionContext) => {\n if (action.url && !action.hasAction) {\n return runner.trigger(action, ctx)\n }\n\n submitting = true\n submittedBlock = props.block\n store.setProcessing(true)\n // A click that blurred a live field started a refresh: send the state it returns.\n store.whenSettled(() => runner.execute(action, ctx, store.state.values))\n}\n\n// Track this form's own submit visit so unrelated reloads finishing meanwhile (polling,\n// relation-manager paging) neither end its processing state nor count as its success.\nlet submitVisit: string | null = null\n\nconst offStart = router.on('start', (event) => {\n const visit = event.detail.visit\n\n if (submitting && !submitVisit && visit.method !== 'get') {\n submitVisit = visit.id\n }\n\n if (visit.method !== 'get') visitBlock = props.block\n})\n\nconst offSuccess = router.on('success', (event) => {\n const id = submitVisit\n\n // Another action changed the record: show the server's new form unless it holds edits.\n if (!id && shouldResyncForm(pageFlash(event.detail.page), store)) {\n if (props.block !== visitBlock) {\n store.fill(props.block)\n } else {\n resyncPending = true\n }\n\n return\n }\n\n if (!id || (event.detail.visitId ?? id) !== id) return\n\n // A halted action (rate limit, `halt()`) saved nothing: keep what the user typed.\n if (pageFlash(event.detail.page).alfakitAction?.status === 'halted') return\n\n if (props.block !== submittedBlock) {\n store.fill(props.block)\n } else {\n refillPending = true\n }\n})\n\n// `refreshFormData([...])`: an action changed the record; copy those fields in.\nconst offRefresh = router.on('success', (event) => {\n const refresh = formRefreshFor(pageFlash(event.detail.page), props.block.component)\n\n if (refresh) applyFormRefresh(store, refresh)\n})\n\nconst offFinish = router.on('finish', (event) => {\n if (submitVisit && event.detail.visit.id !== submitVisit) return\n\n store.setProcessing(false)\n submitting = false\n submitVisit = null\n})\n\nconst offBefore = router.on('before', (event) => {\n if (!panel.value.unsavedChangesAlerts) {\n return\n }\n\n if (\n store.isDirty &&\n !submitting &&\n isLeavingVisit(event.detail.visit) &&\n !window.confirm(t('unsaved_changes', {}, 'You have unsaved changes. Leave anyway?'))\n ) {\n event.preventDefault()\n }\n})\n\nonScopeDispose(() => {\n offStart()\n offSuccess()\n offRefresh()\n offFinish()\n offBefore()\n store.destroy()\n})\n\nconst onSubmit = () => {\n if (primary.value && showActions.value) {\n void trigger(primary.value, context.value)\n }\n}\n\n// Enter in a text field runs the primary action (actions are type=\"button\").\nconst onKeydown = (event: KeyboardEvent) => {\n if (\n primary.value &&\n showActions.value &&\n isImplicitSubmit(event, event.currentTarget as HTMLFormElement)\n ) {\n event.preventDefault()\n void trigger(primary.value, context.value)\n }\n}\n</script>\n\n<template>\n <form\n data-slot=\"form-block\"\n class=\"flex flex-col gap-6\"\n @submit.prevent=\"onSubmit\"\n @keydown=\"onKeydown\"\n >\n <fieldset :disabled=\"state.processing || props.block.operation === 'view'\" class=\"contents\">\n <SchemaRenderer :components=\"state.components\" :columns=\"state.columns\" />\n </fieldset>\n <div v-if=\"actions.length > 0 && showActions\" data-slot=\"form-actions\" class=\"border-t pt-6\">\n <ActionList :actions=\"actions\" :context=\"context\" :on-trigger=\"trigger\" />\n </div>\n </form>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;EAwCA,IAAMc,IAAQC,GAERC,IAAQC,EAAS,GACjBC,IAAOC,GAAc,GACrBC,IAAYC,EAAgB,GAC5BC,IAASC,EAAgB,GACzBC,IAAIC,GAAK,GACTC,IAAQC,QAAeT,EAAK,OAAO,SAAS,EAAE,GAI9CU,IAAaC,GAAc,GAC3BC,IAAaC,EAAM,GACnBC,IAAQ,IAAIC,EAAUnB,EAAM,OAAO;GACvC,OAAOY,EAAM;GACb,WAAWZ,EAAM,MAAM;GACvB,UAAUc,IAAaM,EAAa,QAAQJ,GAAY,IAAI,KAAA;GAC5D,YAAYd,EAAM,MAAM,UAAU;GAClC,YAAYA,EAAM,MAAM,UAAU;GAClC,aAAaA,EAAM,MAAM,UAAU;GAEnC,kBAAkB,MAAkBmB,EAAc,SAAS,MAAMC,GAAUC,CAAC,CAAC;GAE7E,mBAAmB;IACjB,AAAIvB,EAAM,MAAM,eAAawB,EAAO,OAAO,EAAE,MAAMC,GAAoB,CAAC,MAAM,CAAC,EAAE,CAAC;GACpF;EACF,CAAC;EAED,GAAYP,CAAK;EAIjB,IAAIQ;EAEJ,QAAgB;GACd,IAAMC,IAAOC,EAAa5B,EAAM,MAAM,SAAS;GAE/C,AAAI2B,MAAM,IAAqBE,GAAiBF,GAAMT,CAAK;EAC7D,CAAC;EAGD,IAAIY;EAMJ,AAJAC,QAAgB;GACd,AAAI/B,EAAM,MAAM,cAAc,WAAQ,IAAyBgC,EAAqBd,CAAK;EAC3F,CAAC,GAEDe,QAAsBH,IAAyB,CAAC;EAGhD,IAAII;EAsBJ,AApBAH,QAAgB;GACd,IAAsBI,GAAsBnC,EAAM,MAAM,YAAY,GAAQ,MAC1EoC,EAAQC,GAAQC,CAAG,CACrB;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U,GACVC,GAAU,GACVrD,EAAM,QAAQ;EAChB,CAAC;EAED,IAAMuD,WAAiB;GACrB,AAAIpB,EAAQ,SAASG,EAAY,SAC/BpB,EAAaiB,EAAQ,OAAOH,EAAQ,KAAK;EAE7C,GAGMwB,MAAa,MAAyB;GAC1C,AACErB,EAAQ,SACRG,EAAY,SACZmB,EAAiBd,GAAOA,EAAM,aAAgC,MAE9DA,EAAM,eAAe,GACrBzB,EAAaiB,EAAQ,OAAOH,EAAQ,KAAK;EAE7C;oBAIEhE,EAAA,GAAAC,EAYO,QAAA;GAXL,aAAU;GACV,OAAM;GACL,UAAMC,EAAUqF,IAAQ,CAAA,SAAA,CAAA;GACf;EAEVpF,GAAAA,CAAAA,GAEW,YAAA;GAFA,UAAUC,EAAA0D,CAAA,CAAK,CAAC,cAAchD,EAAM,MAAM,cAAS;GAAa,OAAM;EAC/ET,GAAAA,CAAAA,EAA0EC,IAAA;GAAzD,YAAYF,EAAA0D,CAAA,CAAK,CAAC;GAAa,SAAS1D,EAAA0D,CAAA,CAAK,CAAC;EAEtD,GAAA,MAAA,GAAA,CAAA,cAAA,SAAA,CAAA,CAAA,GAAA,GAAAnD,CAAA,GAAAuD,EAAA,MAAQ,SAAM,KAAQI,EAAA,SAAjCtE,EAAA,GAAAC,EAEM,OAFNW,GAEM,CADJP,EAA0EE,IAAA;GAA7D,SAAS2D,EAAA;GAAU,SAASF,EAAA;GAAU,cAAYd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CalloutComponent.js","names":["_sfc_main","CalloutComponent_vue_vue_type_script_setup_true_lang_default","CalloutComponent_default"],"sources":["../../../src/components/layout/CalloutComponent.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { CalloutSchema } from '@alfakit/core'\nimport { actionsAlignmentClass } from '@alfakit/core'\nimport { computed } from 'vue'\nimport { colorClass, textColorClasses } from '../../lib/colors'\nimport { Icon } from '../../lib/icons'\nimport { cn } from '../../lib/utils'\nimport { usePageActionContext } from '../actions/action-context'\nimport ActionList from '../actions/ActionList.vue'\nimport MixedContent from './MixedContent.vue'\n\nconst CALLOUT_COLORS: Record<string, string> = {\n primary: 'border-primary/30 bg-primary/5 [&_[data-slot=callout-icon]]:text-primary',\n secondary: 'border-border bg-secondary [&_[data-slot=callout-icon]]:text-secondary-foreground',\n success: 'border-success/30 bg-success/5 [&_[data-slot=callout-icon]]:text-success',\n warning: 'border-warning/40 bg-warning/10 [&_[data-slot=callout-icon]]:text-warning',\n danger: 'border-destructive/30 bg-destructive/5 [&_[data-slot=callout-icon]]:text-destructive',\n info: 'border-info/30 bg-info/5 [&_[data-slot=callout-icon]]:text-info',\n gray: 'border-border bg-muted/40 [&_[data-slot=callout-icon]]:text-muted-foreground',\n}\n\nconst CALLOUT_ICON_SIZES: Record<string, string> = {\n xs: 'size-4',\n sm: 'size-4',\n md: 'size-5',\n lg: 'size-6',\n xl: 'size-7',\n '2xl': 'size-8',\n}\n\nconst props = defineProps<{ component: CalloutSchema }>()\nconst
|
|
1
|
+
{"version":3,"file":"CalloutComponent.js","names":["_sfc_main","CalloutComponent_vue_vue_type_script_setup_true_lang_default","CalloutComponent_default"],"sources":["../../../src/components/layout/CalloutComponent.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { CalloutSchema } from '@alfakit/core'\nimport { actionsAlignmentClass } from '@alfakit/core'\nimport { computed } from 'vue'\nimport { colorClass, textColorClasses } from '../../lib/colors'\nimport { Icon } from '../../lib/icons'\nimport { cn } from '../../lib/utils'\nimport { usePageActionContext } from '../actions/action-context'\nimport { useOptionalFormStore } from '../form/form-context'\nimport ActionList from '../actions/ActionList.vue'\nimport { useFieldActionContext } from '../schema/field-actions'\nimport MixedContent from './MixedContent.vue'\n\nconst CALLOUT_COLORS: Record<string, string> = {\n primary: 'border-primary/30 bg-primary/5 [&_[data-slot=callout-icon]]:text-primary',\n secondary: 'border-border bg-secondary [&_[data-slot=callout-icon]]:text-secondary-foreground',\n success: 'border-success/30 bg-success/5 [&_[data-slot=callout-icon]]:text-success',\n warning: 'border-warning/40 bg-warning/10 [&_[data-slot=callout-icon]]:text-warning',\n danger: 'border-destructive/30 bg-destructive/5 [&_[data-slot=callout-icon]]:text-destructive',\n info: 'border-info/30 bg-info/5 [&_[data-slot=callout-icon]]:text-info',\n gray: 'border-border bg-muted/40 [&_[data-slot=callout-icon]]:text-muted-foreground',\n}\n\nconst CALLOUT_ICON_SIZES: Record<string, string> = {\n xs: 'size-4',\n sm: 'size-4',\n md: 'size-5',\n lg: 'size-6',\n xl: 'size-7',\n '2xl': 'size-8',\n}\n\nconst props = defineProps<{ component: CalloutSchema }>()\n// Inside a form the actions run as field actions of this component, so `$get` / `$set`\n// reach the form (like a section's header actions).\nconst form = useOptionalFormStore()\nconst pageContext = usePageActionContext()\nconst fieldContext = useFieldActionContext(() => props.component)\nconst context = computed(() => (form ? fieldContext.value : pageContext))\nconst tone = computed(() => props.component.color ?? props.component.status)\n// `iconColor()`, or the status colour once `color(null)` removed the background.\nconst iconColor = computed(\n () => props.component.iconColor ?? (props.component.color ? undefined : props.component.status),\n)\n</script>\n\n<template>\n <div\n data-slot=\"callout\"\n :data-color=\"props.component.color ?? 'gray'\"\n :data-status=\"props.component.status\"\n :role=\"tone === 'danger' || tone === 'warning' ? 'alert' : 'note'\"\n :class=\"\n cn(\n 'flex items-start gap-3 rounded-lg border p-4 text-sm',\n colorClass(CALLOUT_COLORS, props.component.color),\n )\n \"\n v-bind=\"props.component.extraAttributes\"\n >\n <span v-if=\"props.component.icon\" data-slot=\"callout-icon\" class=\"mt-0.5 shrink-0\">\n <Icon\n :name=\"props.component.icon\"\n :class=\"\n cn(\n (props.component.iconSize && CALLOUT_ICON_SIZES[props.component.iconSize]) || 'size-5',\n iconColor && colorClass(textColorClasses, iconColor),\n )\n \"\n />\n </span>\n <div class=\"flex min-w-0 flex-1 flex-col gap-1\">\n <p v-if=\"props.component.heading\" class=\"leading-6 font-semibold\">\n {{ props.component.heading }}\n </p>\n <div\n v-if=\"props.component.description\"\n class=\"text-muted-foreground alfakit-prose\"\n v-html=\"props.component.description\"\n />\n <ActionList\n v-if=\"props.component.actions && props.component.actions.length > 0\"\n :actions=\"props.component.actions\"\n :context=\"context\"\n size=\"sm\"\n :class=\"cn('mt-2', actionsAlignmentClass(props.component.footerActionsAlignment))\"\n />\n <MixedContent\n :items=\"props.component.footer\"\n :context=\"context\"\n name=\"callout-footer\"\n class=\"mt-2\"\n />\n </div>\n <MixedContent\n :items=\"props.component.controls\"\n :context=\"context\"\n name=\"callout-controls\"\n class=\"-me-1 -mt-1 shrink-0 gap-1\"\n />\n </div>\n</template>\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CalloutComponent.vue.d.ts","sourceRoot":"","sources":["../../../src/components/layout/CalloutComponent.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CalloutComponent.vue.d.ts","sourceRoot":"","sources":["../../../src/components/layout/CalloutComponent.vue"],"names":[],"mappings":"AAwGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AA+BlD,KAAK,WAAW,GAAG;IAAE,SAAS,EAAE,aAAa,CAAA;CAAE,CAAC;;AAwKhD,wBAMG"}
|
|
@@ -3,26 +3,28 @@ import { cn as t } from "../../lib/utils.js";
|
|
|
3
3
|
import { colorClass as n, textColorClasses as r } from "../../lib/colors.js";
|
|
4
4
|
import i from "../../lib/Icon.js";
|
|
5
5
|
import a from "../actions/ActionList.js";
|
|
6
|
-
import o from "
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
6
|
+
import { useOptionalFormStore as o } from "../form/form-context.js";
|
|
7
|
+
import { useFieldActionContext as s } from "../schema/field-actions.js";
|
|
8
|
+
import c from "./MixedContent.js";
|
|
9
|
+
import { actionsAlignmentClass as l } from "@alfakit/core";
|
|
10
|
+
import { computed as u, createBlock as d, createCommentVNode as f, createElementBlock as p, createElementVNode as m, createVNode as h, defineComponent as g, mergeProps as _, normalizeClass as v, openBlock as y, toDisplayString as b, unref as x } from "vue";
|
|
9
11
|
//#region src/components/layout/CalloutComponent.vue?vue&type=script&setup=true&lang.ts
|
|
10
|
-
var
|
|
12
|
+
var S = [
|
|
11
13
|
"data-color",
|
|
12
14
|
"data-status",
|
|
13
15
|
"role"
|
|
14
|
-
],
|
|
16
|
+
], C = {
|
|
15
17
|
key: 0,
|
|
16
18
|
"data-slot": "callout-icon",
|
|
17
19
|
class: "mt-0.5 shrink-0"
|
|
18
|
-
},
|
|
20
|
+
}, w = { class: "flex min-w-0 flex-1 flex-col gap-1" }, T = {
|
|
19
21
|
key: 0,
|
|
20
22
|
class: "leading-6 font-semibold"
|
|
21
|
-
},
|
|
23
|
+
}, E = ["innerHTML"], D = /*@__PURE__*/ g({
|
|
22
24
|
__name: "CalloutComponent",
|
|
23
25
|
props: { component: {} },
|
|
24
|
-
setup(
|
|
25
|
-
let
|
|
26
|
+
setup(g) {
|
|
27
|
+
let D = {
|
|
26
28
|
primary: "border-primary/30 bg-primary/5 [&_[data-slot=callout-icon]]:text-primary",
|
|
27
29
|
secondary: "border-border bg-secondary [&_[data-slot=callout-icon]]:text-secondary-foreground",
|
|
28
30
|
success: "border-success/30 bg-success/5 [&_[data-slot=callout-icon]]:text-success",
|
|
@@ -30,58 +32,60 @@ var b = [
|
|
|
30
32
|
danger: "border-destructive/30 bg-destructive/5 [&_[data-slot=callout-icon]]:text-destructive",
|
|
31
33
|
info: "border-info/30 bg-info/5 [&_[data-slot=callout-icon]]:text-info",
|
|
32
34
|
gray: "border-border bg-muted/40 [&_[data-slot=callout-icon]]:text-muted-foreground"
|
|
33
|
-
},
|
|
35
|
+
}, O = {
|
|
34
36
|
xs: "size-4",
|
|
35
37
|
sm: "size-4",
|
|
36
38
|
md: "size-5",
|
|
37
39
|
lg: "size-6",
|
|
38
40
|
xl: "size-7",
|
|
39
41
|
"2xl": "size-8"
|
|
40
|
-
},
|
|
41
|
-
return (e,
|
|
42
|
+
}, k = g, A = o(), j = e(), M = s(() => k.component), N = u(() => A ? M.value : j), P = u(() => k.component.color ?? k.component.status), F = u(() => k.component.iconColor ?? (k.component.color ? void 0 : k.component.status));
|
|
43
|
+
return (e, o) => (y(), p("div", _({
|
|
42
44
|
"data-slot": "callout",
|
|
43
|
-
"data-color":
|
|
44
|
-
"data-status":
|
|
45
|
-
role:
|
|
46
|
-
class:
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
name:
|
|
50
|
-
class:
|
|
51
|
-
}, null, 8, ["name", "class"])])) :
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
45
|
+
"data-color": k.component.color ?? "gray",
|
|
46
|
+
"data-status": k.component.status,
|
|
47
|
+
role: P.value === "danger" || P.value === "warning" ? "alert" : "note",
|
|
48
|
+
class: x(t)("flex items-start gap-3 rounded-lg border p-4 text-sm", x(n)(D, k.component.color))
|
|
49
|
+
}, k.component.extraAttributes), [
|
|
50
|
+
k.component.icon ? (y(), p("span", C, [h(x(i), {
|
|
51
|
+
name: k.component.icon,
|
|
52
|
+
class: v(x(t)(k.component.iconSize && O[k.component.iconSize] || "size-5", F.value && x(n)(x(r), F.value)))
|
|
53
|
+
}, null, 8, ["name", "class"])])) : f("", !0),
|
|
54
|
+
m("div", w, [
|
|
55
|
+
k.component.heading ? (y(), p("p", T, b(k.component.heading), 1)) : f("", !0),
|
|
56
|
+
k.component.description ? (y(), p("div", {
|
|
55
57
|
key: 1,
|
|
56
58
|
class: "text-muted-foreground alfakit-prose",
|
|
57
|
-
innerHTML:
|
|
58
|
-
}, null, 8,
|
|
59
|
-
|
|
59
|
+
innerHTML: k.component.description
|
|
60
|
+
}, null, 8, E)) : f("", !0),
|
|
61
|
+
k.component.actions && k.component.actions.length > 0 ? (y(), d(a, {
|
|
60
62
|
key: 2,
|
|
61
|
-
actions:
|
|
62
|
-
context:
|
|
63
|
+
actions: k.component.actions,
|
|
64
|
+
context: N.value,
|
|
63
65
|
size: "sm",
|
|
64
|
-
class:
|
|
66
|
+
class: v(x(t)("mt-2", x(l)(k.component.footerActionsAlignment)))
|
|
65
67
|
}, null, 8, [
|
|
66
68
|
"actions",
|
|
67
69
|
"context",
|
|
68
70
|
"class"
|
|
69
|
-
])) :
|
|
70
|
-
|
|
71
|
-
items:
|
|
71
|
+
])) : f("", !0),
|
|
72
|
+
h(c, {
|
|
73
|
+
items: k.component.footer,
|
|
74
|
+
context: N.value,
|
|
72
75
|
name: "callout-footer",
|
|
73
76
|
class: "mt-2"
|
|
74
|
-
}, null, 8, ["items"])
|
|
77
|
+
}, null, 8, ["items", "context"])
|
|
75
78
|
]),
|
|
76
|
-
|
|
77
|
-
items:
|
|
79
|
+
h(c, {
|
|
80
|
+
items: k.component.controls,
|
|
81
|
+
context: N.value,
|
|
78
82
|
name: "callout-controls",
|
|
79
83
|
class: "-me-1 -mt-1 shrink-0 gap-1"
|
|
80
|
-
}, null, 8, ["items"])
|
|
81
|
-
], 16,
|
|
84
|
+
}, null, 8, ["items", "context"])
|
|
85
|
+
], 16, S));
|
|
82
86
|
}
|
|
83
87
|
});
|
|
84
88
|
//#endregion
|
|
85
|
-
export {
|
|
89
|
+
export { D as default };
|
|
86
90
|
|
|
87
91
|
//# sourceMappingURL=CalloutComponent.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CalloutComponent.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_mergeProps","_unref","_createVNode","Icon","_normalizeClass","_createCommentVNode","_createElementVNode","_toDisplayString","_createBlock","ActionList","MixedContent","Icon_default","ActionList_default","MixedContent_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","CalloutComponent_vue_vue_type_script_setup_true_lang_default","CALLOUT_COLORS","CALLOUT_ICON_SIZES","props","__props","
|
|
1
|
+
{"version":3,"file":"CalloutComponent.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_mergeProps","_unref","_createVNode","Icon","_normalizeClass","_createCommentVNode","_createElementVNode","_toDisplayString","_createBlock","ActionList","MixedContent","Icon_default","ActionList_default","MixedContent_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","CalloutComponent_vue_vue_type_script_setup_true_lang_default","CALLOUT_COLORS","CALLOUT_ICON_SIZES","props","__props","form","useOptionalFormStore","pageContext","usePageActionContext","fieldContext","useFieldActionContext","context","computed","tone","iconColor","openBlock","createElementBlock","mergeProps","unref","cn","colorClass","createVNode","normalizeClass","textColorClasses","createCommentVNode","createElementVNode","toDisplayString","createBlock","actionsAlignmentClass"],"sources":["../../../src/components/layout/CalloutComponent.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { CalloutSchema } from '@alfakit/core'\nimport { actionsAlignmentClass } from '@alfakit/core'\nimport { computed } from 'vue'\nimport { colorClass, textColorClasses } from '../../lib/colors'\nimport { Icon } from '../../lib/icons'\nimport { cn } from '../../lib/utils'\nimport { usePageActionContext } from '../actions/action-context'\nimport { useOptionalFormStore } from '../form/form-context'\nimport ActionList from '../actions/ActionList.vue'\nimport { useFieldActionContext } from '../schema/field-actions'\nimport MixedContent from './MixedContent.vue'\n\nconst CALLOUT_COLORS: Record<string, string> = {\n primary: 'border-primary/30 bg-primary/5 [&_[data-slot=callout-icon]]:text-primary',\n secondary: 'border-border bg-secondary [&_[data-slot=callout-icon]]:text-secondary-foreground',\n success: 'border-success/30 bg-success/5 [&_[data-slot=callout-icon]]:text-success',\n warning: 'border-warning/40 bg-warning/10 [&_[data-slot=callout-icon]]:text-warning',\n danger: 'border-destructive/30 bg-destructive/5 [&_[data-slot=callout-icon]]:text-destructive',\n info: 'border-info/30 bg-info/5 [&_[data-slot=callout-icon]]:text-info',\n gray: 'border-border bg-muted/40 [&_[data-slot=callout-icon]]:text-muted-foreground',\n}\n\nconst CALLOUT_ICON_SIZES: Record<string, string> = {\n xs: 'size-4',\n sm: 'size-4',\n md: 'size-5',\n lg: 'size-6',\n xl: 'size-7',\n '2xl': 'size-8',\n}\n\nconst props = defineProps<{ component: CalloutSchema }>()\n// Inside a form the actions run as field actions of this component, so `$get` / `$set`\n// reach the form (like a section's header actions).\nconst form = useOptionalFormStore()\nconst pageContext = usePageActionContext()\nconst fieldContext = useFieldActionContext(() => props.component)\nconst context = computed(() => (form ? fieldContext.value : pageContext))\nconst tone = computed(() => props.component.color ?? props.component.status)\n// `iconColor()`, or the status colour once `color(null)` removed the background.\nconst iconColor = computed(\n () => props.component.iconColor ?? (props.component.color ? undefined : props.component.status),\n)\n</script>\n\n<template>\n <div\n data-slot=\"callout\"\n :data-color=\"props.component.color ?? 'gray'\"\n :data-status=\"props.component.status\"\n :role=\"tone === 'danger' || tone === 'warning' ? 'alert' : 'note'\"\n :class=\"\n cn(\n 'flex items-start gap-3 rounded-lg border p-4 text-sm',\n colorClass(CALLOUT_COLORS, props.component.color),\n )\n \"\n v-bind=\"props.component.extraAttributes\"\n >\n <span v-if=\"props.component.icon\" data-slot=\"callout-icon\" class=\"mt-0.5 shrink-0\">\n <Icon\n :name=\"props.component.icon\"\n :class=\"\n cn(\n (props.component.iconSize && CALLOUT_ICON_SIZES[props.component.iconSize]) || 'size-5',\n iconColor && colorClass(textColorClasses, iconColor),\n )\n \"\n />\n </span>\n <div class=\"flex min-w-0 flex-1 flex-col gap-1\">\n <p v-if=\"props.component.heading\" class=\"leading-6 font-semibold\">\n {{ props.component.heading }}\n </p>\n <div\n v-if=\"props.component.description\"\n class=\"text-muted-foreground alfakit-prose\"\n v-html=\"props.component.description\"\n />\n <ActionList\n v-if=\"props.component.actions && props.component.actions.length > 0\"\n :actions=\"props.component.actions\"\n :context=\"context\"\n size=\"sm\"\n :class=\"cn('mt-2', actionsAlignmentClass(props.component.footerActionsAlignment))\"\n />\n <MixedContent\n :items=\"props.component.footer\"\n :context=\"context\"\n name=\"callout-footer\"\n class=\"mt-2\"\n />\n </div>\n <MixedContent\n :items=\"props.component.controls\"\n :context=\"context\"\n name=\"callout-controls\"\n class=\"-me-1 -mt-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GAsBM;IArBKM,EAAM,UAAU,WAAzBxB,EAAA,GAAAC,EAEI,KAFJkB,GAEIV,EADCe,EAAM,UAAU,OAAO,GAAA,CAAA,KAAAqB,EAAA,IAAA,EAAA;IAGpBrB,EAAM,UAAU,eADxBxB,EAAA,GAAAC,EAIE,OAAA;;KAFA,OAAM;KACN,WAAQuB,EAAM,UAAU;;IAGlBA,EAAM,UAAU,WAAWA,EAAM,UAAU,QAAQ,SAAM,KADjExB,EAAA,GAAAU,EAMEC,GAAA;;KAJC,SAASa,EAAM,UAAU;KACzB,SAASQ,EAAA;KACV,MAAK;KACJ,OAAK1B,EAAEH,EAAAqC,CAAA,CAAE,CAAA,QAASrC,EAAA8C,CAAA,CAAqB,CAACzB,EAAM,UAAU,sBAAsB,CAAA,CAAA;;;;;;IAEjFpB,EAKEQ,GAAA;KAJC,OAAOY,EAAM,UAAU;KACvB,SAASQ,EAAA;KACV,MAAK;KACL,OAAM;;;GAGV5B,EAKEQ,GAAA;IAJC,OAAOY,EAAM,UAAU;IACvB,SAASQ,EAAA;IACV,MAAK;IACL,OAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmptyStateComponent.js","names":["_sfc_main","EmptyStateComponent_vue_vue_type_script_setup_true_lang_default","EmptyStateComponent_default"],"sources":["../../../src/components/layout/EmptyStateComponent.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { EmptyStateComponentSchema } from '@alfakit/core'\nimport { colorClass, iconBackgroundColorClasses } from '../../lib/colors'\nimport { Icon } from '../../lib/icons'\nimport { cn } from '../../lib/utils'\nimport { usePageActionContext } from '../actions/action-context'\nimport ActionList from '../actions/ActionList.vue'\nimport MixedContent from './MixedContent.vue'\n\nconst props = defineProps<{ component: EmptyStateComponentSchema }>()\nconst
|
|
1
|
+
{"version":3,"file":"EmptyStateComponent.js","names":["_sfc_main","EmptyStateComponent_vue_vue_type_script_setup_true_lang_default","EmptyStateComponent_default"],"sources":["../../../src/components/layout/EmptyStateComponent.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { EmptyStateComponentSchema } from '@alfakit/core'\nimport { computed } from 'vue'\nimport { colorClass, iconBackgroundColorClasses } from '../../lib/colors'\nimport { Icon } from '../../lib/icons'\nimport { cn } from '../../lib/utils'\nimport { usePageActionContext } from '../actions/action-context'\nimport { useOptionalFormStore } from '../form/form-context'\nimport ActionList from '../actions/ActionList.vue'\nimport { useFieldActionContext } from '../schema/field-actions'\nimport MixedContent from './MixedContent.vue'\n\nconst props = defineProps<{ component: EmptyStateComponentSchema }>()\n// Inside a form the actions run as field actions of this component, so `$get` / `$set`\n// reach the form (like a section's header actions).\nconst form = useOptionalFormStore()\nconst pageContext = usePageActionContext()\nconst fieldContext = useFieldActionContext(() => props.component)\nconst context = computed(() => (form ? fieldContext.value : pageContext))\n</script>\n\n<template>\n <div\n data-slot=\"empty-state\"\n :class=\"\n cn(\n 'flex flex-col items-center justify-center gap-3 px-6 py-10 text-center',\n props.component.contained && 'rounded-xl border border-dashed',\n )\n \"\n v-bind=\"props.component.extraAttributes\"\n >\n <div\n v-if=\"props.component.icon\"\n :class=\"\n cn(\n 'flex size-12 items-center justify-center rounded-full',\n colorClass(iconBackgroundColorClasses, props.component.color),\n )\n \"\n >\n <Icon :name=\"props.component.icon\" class=\"size-6\" />\n </div>\n <h3 v-if=\"props.component.heading\" class=\"text-base font-semibold\">\n {{ props.component.heading }}\n </h3>\n <div\n v-if=\"props.component.description\"\n class=\"text-muted-foreground max-w-md text-sm\"\n v-html=\"props.component.description\"\n />\n <ActionList\n v-if=\"props.component.actions && props.component.actions.length > 0\"\n :actions=\"props.component.actions\"\n :context=\"context\"\n class=\"mt-2 justify-center\"\n />\n <MixedContent\n :items=\"props.component.footer\"\n :context=\"context\"\n name=\"empty-state-footer\"\n class=\"justify-center\"\n />\n </div>\n</template>\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmptyStateComponent.vue.d.ts","sourceRoot":"","sources":["../../../src/components/layout/EmptyStateComponent.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EmptyStateComponent.vue.d.ts","sourceRoot":"","sources":["../../../src/components/layout/EmptyStateComponent.vue"],"names":[],"mappings":"AAmEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAA;AAW9D,KAAK,WAAW,GAAG;IAAE,SAAS,EAAE,yBAAyB,CAAA;CAAE,CAAC;;AA2H5D,wBAMG"}
|
|
@@ -3,49 +3,52 @@ import { cn as t } from "../../lib/utils.js";
|
|
|
3
3
|
import { colorClass as n, iconBackgroundColorClasses as r } from "../../lib/colors.js";
|
|
4
4
|
import i from "../../lib/Icon.js";
|
|
5
5
|
import a from "../actions/ActionList.js";
|
|
6
|
-
import o from "
|
|
7
|
-
import {
|
|
6
|
+
import { useOptionalFormStore as o } from "../form/form-context.js";
|
|
7
|
+
import { useFieldActionContext as s } from "../schema/field-actions.js";
|
|
8
|
+
import c from "./MixedContent.js";
|
|
9
|
+
import { computed as l, createBlock as u, createCommentVNode as d, createElementBlock as f, createVNode as p, defineComponent as m, mergeProps as h, normalizeClass as g, openBlock as _, toDisplayString as v, unref as y } from "vue";
|
|
8
10
|
//#region src/components/layout/EmptyStateComponent.vue?vue&type=script&setup=true&lang.ts
|
|
9
|
-
var
|
|
11
|
+
var b = {
|
|
10
12
|
key: 1,
|
|
11
13
|
class: "text-base font-semibold"
|
|
12
|
-
},
|
|
14
|
+
}, x = ["innerHTML"], S = /*@__PURE__*/ m({
|
|
13
15
|
__name: "EmptyStateComponent",
|
|
14
16
|
props: { component: {} },
|
|
15
|
-
setup(
|
|
16
|
-
let
|
|
17
|
-
return (e,
|
|
17
|
+
setup(m) {
|
|
18
|
+
let S = m, C = o(), w = e(), T = s(() => S.component), E = l(() => C ? T.value : w);
|
|
19
|
+
return (e, o) => (_(), f("div", h({
|
|
18
20
|
"data-slot": "empty-state",
|
|
19
|
-
class:
|
|
20
|
-
},
|
|
21
|
-
|
|
21
|
+
class: y(t)("flex flex-col items-center justify-center gap-3 px-6 py-10 text-center", S.component.contained && "rounded-xl border border-dashed")
|
|
22
|
+
}, S.component.extraAttributes), [
|
|
23
|
+
S.component.icon ? (_(), f("div", {
|
|
22
24
|
key: 0,
|
|
23
|
-
class:
|
|
24
|
-
}, [
|
|
25
|
-
name:
|
|
25
|
+
class: g(y(t)("flex size-12 items-center justify-center rounded-full", y(n)(y(r), S.component.color)))
|
|
26
|
+
}, [p(y(i), {
|
|
27
|
+
name: S.component.icon,
|
|
26
28
|
class: "size-6"
|
|
27
|
-
}, null, 8, ["name"])], 2)) :
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
}, null, 8, ["name"])], 2)) : d("", !0),
|
|
30
|
+
S.component.heading ? (_(), f("h3", b, v(S.component.heading), 1)) : d("", !0),
|
|
31
|
+
S.component.description ? (_(), f("div", {
|
|
30
32
|
key: 2,
|
|
31
33
|
class: "text-muted-foreground max-w-md text-sm",
|
|
32
|
-
innerHTML:
|
|
33
|
-
}, null, 8,
|
|
34
|
-
|
|
34
|
+
innerHTML: S.component.description
|
|
35
|
+
}, null, 8, x)) : d("", !0),
|
|
36
|
+
S.component.actions && S.component.actions.length > 0 ? (_(), u(a, {
|
|
35
37
|
key: 3,
|
|
36
|
-
actions:
|
|
37
|
-
context:
|
|
38
|
+
actions: S.component.actions,
|
|
39
|
+
context: E.value,
|
|
38
40
|
class: "mt-2 justify-center"
|
|
39
|
-
}, null, 8, ["actions", "context"])) :
|
|
40
|
-
|
|
41
|
-
items:
|
|
41
|
+
}, null, 8, ["actions", "context"])) : d("", !0),
|
|
42
|
+
p(c, {
|
|
43
|
+
items: S.component.footer,
|
|
44
|
+
context: E.value,
|
|
42
45
|
name: "empty-state-footer",
|
|
43
46
|
class: "justify-center"
|
|
44
|
-
}, null, 8, ["items"])
|
|
47
|
+
}, null, 8, ["items", "context"])
|
|
45
48
|
], 16));
|
|
46
49
|
}
|
|
47
50
|
});
|
|
48
51
|
//#endregion
|
|
49
|
-
export {
|
|
52
|
+
export { S as default };
|
|
50
53
|
|
|
51
54
|
//# sourceMappingURL=EmptyStateComponent.vue_vue_type_script_setup_true_lang.js.map
|