@xleddyl/443-components-vue 0.16.102 → 0.16.104

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.
Files changed (41) hide show
  1. package/CATALOG.md +147 -147
  2. package/README.md +49 -28
  3. package/dist/components/layout/AppShell.vue +89 -1
  4. package/dist/components/layout/AppShell.vue.d.ts +12 -2
  5. package/dist/components/overlays/ConfirmDialog.vue.d.ts +8 -0
  6. package/dist/components/overlays/ConfirmHost.vue.d.ts +8 -0
  7. package/dist/components/overlays/Drawer.vue +9 -1
  8. package/dist/components/overlays/Drawer.vue.d.ts +10 -0
  9. package/dist/components/overlays/Modal.vue.d.ts +8 -0
  10. package/dist/components/overlays/Toaster.vue +2 -1
  11. package/dist/components/templates/DashboardLayout.vue +11 -1
  12. package/dist/components/templates/DashboardLayout.vue.d.ts +10 -0
  13. package/dist/components/templates/FormDrawer.vue +3 -1
  14. package/dist/components/templates/FormDrawer.vue.d.ts +6 -0
  15. package/dist/components/templates/FormModal.vue.d.ts +4 -0
  16. package/dist/components/templates/SettingsModal.vue.d.ts +8 -0
  17. package/dist/composables/usePreferences.d.ts +1 -0
  18. package/dist/composables/usePreferences.mjs +2 -1
  19. package/dist/composables/useRouteRecord.mjs +6 -4
  20. package/dist/icons/builtin.d.ts +3 -0
  21. package/dist/icons/builtin.mjs +9 -0
  22. package/dist/internal/forms/leave.mjs +9 -2
  23. package/dist/internal/overlays/DialogFrame.vue +152 -90
  24. package/dist/internal/overlays/DialogFrame.vue.d.ts +8 -0
  25. package/dist/internal/overlays/OverlayView.vue.d.ts +10 -0
  26. package/dist/internal/overlays/avoid.mjs +16 -0
  27. package/dist/internal/overlays/dialog.d.ts +3 -0
  28. package/dist/internal/overlays/dialog.mjs +61 -15
  29. package/dist/internal/overlays/dock.d.ts +16 -0
  30. package/dist/internal/overlays/dock.mjs +10 -0
  31. package/dist/locale/de.mjs +8 -0
  32. package/dist/locale/en.mjs +8 -0
  33. package/dist/locale/it.mjs +8 -0
  34. package/dist/locale/types.d.ts +8 -0
  35. package/dist/styles/feedback/skeleton.css +6 -0
  36. package/dist/styles/layout/app-shell.css +75 -0
  37. package/dist/styles/layout/stack.css +7 -0
  38. package/dist/styles/overlays/drawer.css +59 -0
  39. package/dist/styles/overlays/modal.css +5 -0
  40. package/dist/styles/templates/settings-modal.css +1 -0
  41. package/package.json +1 -1
@@ -17,6 +17,7 @@
17
17
  :guard="guard"
18
18
  :guard-title="guardTitle"
19
19
  :guard-message="guardMessage"
20
+ :docked="docked"
20
21
  @navigate="(index) => emit('navigate', index)"
21
22
  @after-leave="emit('afterLeave')"
22
23
  >
@@ -130,7 +131,8 @@ const props = defineProps({
130
131
  guardTitle: { type: String, required: false },
131
132
  guardMessage: { type: String, required: false },
132
133
  beforeClose: { type: Function, required: false },
133
- onCancel: { type: Function, required: false }
134
+ onCancel: { type: Function, required: false },
135
+ docked: { type: Boolean, required: false }
134
136
  });
135
137
  const emit = defineEmits(["delete", "submitted", "navigate", "afterLeave"]);
136
138
  const open = defineModel("open", { type: Boolean, ...{ default: false } });
@@ -33,6 +33,7 @@ declare const __VLS_export: <S extends FormSchema, V extends object>(__VLS_props
33
33
  guardMessage?: string;
34
34
  beforeClose?: DialogBeforeClose;
35
35
  onCancel?: () => unknown;
36
+ docked?: boolean;
36
37
  } & {
37
38
  open?: boolean;
38
39
  tab?: TabItem["value"];
@@ -62,10 +63,14 @@ declare const __VLS_export: <S extends FormSchema, V extends object>(__VLS_props
62
63
  readonly guard?: boolean | undefined;
63
64
  readonly guardTitle?: string | undefined;
64
65
  readonly guardMessage?: string | undefined;
66
+ readonly docked?: boolean | undefined;
67
+ readonly expandLabel?: string | undefined;
68
+ readonly collapseLabel?: string | undefined;
65
69
  readonly open?: boolean | undefined;
66
70
  readonly tab?: TabItem["value"] | undefined;
67
71
  readonly key?: PropertyKey | undefined;
68
72
  readonly prefix?: "k-modal" | "k-drawer" | undefined;
73
+ readonly dock?: boolean | undefined;
69
74
  readonly style?: import("vue").StyleValue;
70
75
  readonly results?: (string | number) | undefined;
71
76
  readonly placeholder?: string | undefined | undefined;
@@ -263,6 +268,7 @@ declare const __VLS_export: <S extends FormSchema, V extends object>(__VLS_props
263
268
  readonly onVnodeUnmounted?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
264
269
  readonly onCancel?: ((payload: Event) => void) | undefined;
265
270
  readonly rootClass?: unknown;
271
+ readonly expandable?: boolean | undefined;
266
272
  readonly closedby?: import("../../index.ts").DialogClosedBy | undefined;
267
273
  readonly onClose?: (() => any) | undefined;
268
274
  readonly onOpen?: (() => any) | undefined;
@@ -65,6 +65,7 @@ declare const __VLS_export: <S extends FormSchema, V extends object>(__VLS_props
65
65
  readonly tab?: import("../layout/types.ts").TabItem["value"] | undefined;
66
66
  readonly key?: PropertyKey | undefined;
67
67
  readonly prefix?: "k-modal" | "k-drawer" | undefined;
68
+ readonly dock?: boolean | undefined;
68
69
  readonly style?: import("vue").StyleValue;
69
70
  readonly results?: (string | number) | undefined;
70
71
  readonly placeholder?: string | undefined | undefined;
@@ -262,6 +263,9 @@ declare const __VLS_export: <S extends FormSchema, V extends object>(__VLS_props
262
263
  readonly onVnodeUnmounted?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
263
264
  readonly onCancel?: ((payload: Event) => void) | undefined;
264
265
  readonly rootClass?: unknown;
266
+ readonly expandable?: boolean | undefined;
267
+ readonly expandLabel?: string | undefined;
268
+ readonly collapseLabel?: string | undefined;
265
269
  readonly closedby?: import("../../index.ts").DialogClosedBy | undefined;
266
270
  readonly onClose?: (() => any) | undefined;
267
271
  readonly onOpen?: (() => any) | undefined;
@@ -57,6 +57,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
57
57
  prefix?: "k-modal" | "k-drawer" | undefined;
58
58
  fill?: boolean;
59
59
  size?: import("../overlays/types").ModalSize;
60
+ dock?: boolean;
60
61
  tabs?: import("../layout/types.ts").TabItem[];
61
62
  label?: string;
62
63
  style?: import("vue").StyleValue;
@@ -266,6 +267,9 @@ declare const __VLS_base: import("vue").DefineComponent<{
266
267
  trail?: string[];
267
268
  rootClass?: unknown;
268
269
  hideClose?: boolean;
270
+ expandable?: boolean;
271
+ expandLabel?: string;
272
+ collapseLabel?: string;
269
273
  "onUpdate:tab"?: ((value: string | number | undefined) => any) | undefined;
270
274
  closedby?: import("../../index.ts").DialogClosedBy;
271
275
  minHeight?: string;
@@ -313,6 +317,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
313
317
  prefix?: "k-modal" | "k-drawer" | undefined;
314
318
  fill?: boolean;
315
319
  size?: import("../overlays/types").ModalSize;
320
+ dock?: boolean;
316
321
  tabs?: import("../layout/types.ts").TabItem[];
317
322
  label?: string;
318
323
  style?: import("vue").StyleValue;
@@ -522,6 +527,9 @@ declare const __VLS_base: import("vue").DefineComponent<{
522
527
  trail?: string[];
523
528
  rootClass?: unknown;
524
529
  hideClose?: boolean;
530
+ expandable?: boolean;
531
+ expandLabel?: string;
532
+ collapseLabel?: string;
525
533
  "onUpdate:tab"?: ((value: string | number | undefined) => any) | undefined;
526
534
  closedby?: import("../../index.ts").DialogClosedBy;
527
535
  minHeight?: string;
@@ -8,6 +8,7 @@ export declare const PREFERENCE_KEYS: {
8
8
  readonly shell: (storageKey: string) => string;
9
9
  readonly grid: (storageKey: string) => string;
10
10
  readonly workspace: (storageKey: string) => string;
11
+ readonly dock: (storageKey: string) => string;
11
12
  };
12
13
  export interface UsePreferenceOptions<T> {
13
14
  validate?: (value: unknown) => value is T;
@@ -16,7 +16,8 @@ export const PREFERENCE_KEYS = {
16
16
  preset: "preset",
17
17
  shell: (storageKey) => `shell:${storageKey}`,
18
18
  grid: (storageKey) => `grid:${storageKey}`,
19
- workspace: (storageKey) => `workspace:${storageKey}`
19
+ workspace: (storageKey) => `workspace:${storageKey}`,
20
+ dock: (storageKey) => `dock:${storageKey}`
20
21
  };
21
22
  function toPreferences(source) {
22
23
  if (source && "install" in source && "clientOnly" in source && "store" in source) return source;
@@ -8,7 +8,7 @@ import {
8
8
  import { useRouterLike } from "../internal/layout/route.mjs";
9
9
  import { useRouteState } from "./useRouteState.mjs";
10
10
  import { dialogScope, runNavigationGuard } from "../internal/forms/leave.mjs";
11
- import { modalStack } from "../internal/overlays/dialog.mjs";
11
+ import { topDialog } from "../internal/overlays/dialog.mjs";
12
12
  export const NEW_ROUTE_RECORD = "new";
13
13
  export function useRouteRecord(key, options = {}) {
14
14
  const router = useRouterLike();
@@ -24,6 +24,7 @@ export function useRouteRecord(key, options = {}) {
24
24
  return Object.fromEntries((options.linkedKeys ?? []).map((name) => [name, void 0]));
25
25
  }
26
26
  let allowed;
27
+ const beforeLeave = options.beforeLeave ?? (() => dialogScope(topDialog())?.confirmLeave() ?? true);
27
28
  function routeValue(route) {
28
29
  return location === "hash" ? hashParamValue(route?.hash, key) : firstQueryValue(route?.query?.[key]);
29
30
  }
@@ -38,8 +39,10 @@ export function useRouteRecord(key, options = {}) {
38
39
  );
39
40
  return Promise.all(writes).then((results) => results.every(Boolean));
40
41
  }
41
- function openRecord(recordId, linked = {}) {
42
- return write({ ...cleared(), ...linked, [key]: recordId ?? newId }, "push");
42
+ async function openRecord(recordId, linked = {}) {
43
+ const target = recordId ?? newId;
44
+ if (param.value && param.value !== target && !await beforeLeave()) return false;
45
+ return write({ ...cleared(), ...linked, [key]: target }, "push");
43
46
  }
44
47
  function close() {
45
48
  return write({ ...cleared(), [key]: void 0 }, "push");
@@ -63,7 +66,6 @@ export function useRouteRecord(key, options = {}) {
63
66
  { immediate: true }
64
67
  );
65
68
  }
66
- const beforeLeave = options.beforeLeave ?? (() => dialogScope(modalStack[modalStack.length - 1])?.confirmLeave() ?? true);
67
69
  if (router && getCurrentInstance()) {
68
70
  let removeGuard;
69
71
  onMounted(() => {
@@ -74,6 +74,9 @@ export declare const builtinIcons: {
74
74
  readonly cube: readonly ["m21 7.5l-9-5.25L3 7.5m18 0l-9 5.25m9-5.25v9l-9 5.25M3 7.5l9 5.25M3 7.5v9l9 5.25m0-9v9"];
75
75
  readonly bolt: readonly ["m3.75 13.5l10.5-11.25L12 10.5h8.25L9.75 21.75L12 13.5z"];
76
76
  readonly 'adjustments-horizontal': readonly ["M10.5 6h9.75M10.5 6a1.5 1.5 0 1 1-3 0m3 0a1.5 1.5 0 1 0-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-9.75 0h9.75"];
77
+ readonly 'arrows-pointing-out': readonly ["M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"];
78
+ readonly 'arrows-pointing-in': readonly ["M9 9V4.5M9 9H4.5M9 9 3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5 5.25 5.25"];
79
+ readonly 'cursor-arrow-rays': readonly ["M15.042 21.672 13.684 16.6m0 0-2.51 2.225.569-9.47 5.227 7.917-3.286-.672ZM12 2.25V4.5m5.834.166-1.591 1.591M20.25 10.5H18M7.757 14.743l-1.59 1.59M6 10.5H3.75m4.007-4.243-1.59-1.59"];
77
80
  readonly 'rectangle-stack': readonly ["M6 6.878V6a2.25 2.25 0 0 1 2.25-2.25h7.5A2.25 2.25 0 0 1 18 6v.878m-12 0q.354-.126.75-.128h10.5q.396.002.75.128m-12 0A2.25 2.25 0 0 0 4.5 9v.878m13.5-3A2.25 2.25 0 0 1 19.5 9v.878m0 0a2.3 2.3 0 0 0-.75-.128H5.25q-.396.002-.75.128m15 0A2.25 2.25 0 0 1 21 12v6a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 18v-6c0-.98.626-1.813 1.5-2.122"];
78
81
  readonly sparkles: readonly ["M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09m8.445-7.188L18 9.75l-.259-1.035a3.38 3.38 0 0 0-2.455-2.456L14.25 6l1.036-.259a3.38 3.38 0 0 0 2.455-2.456L18 2.25l.259 1.035a3.38 3.38 0 0 0 2.456 2.456L21.75 6l-1.035.259a3.38 3.38 0 0 0-2.456 2.456m-1.365 11.852L16.5 21.75l-.394-1.183a2.25 2.25 0 0 0-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 0 0 1.423-1.423l.394-1.183l.394 1.183a2.25 2.25 0 0 0 1.423 1.423l1.183.394l-1.183.394a2.25 2.25 0 0 0-1.423 1.423"];
79
82
  readonly 'question-mark-circle': readonly ["M9.879 7.519c1.172-1.025 3.071-1.025 4.243 0c1.171 1.025 1.171 2.687 0 3.712q-.308.268-.67.442c-.746.361-1.452.999-1.452 1.827v.75M21 12a9 9 0 1 1-18 0a9 9 0 0 1 18 0m-9 5.25h.008v.008H12z"];
@@ -176,6 +176,15 @@ export const builtinIcons = {
176
176
  "adjustments-horizontal": [
177
177
  "M10.5 6h9.75M10.5 6a1.5 1.5 0 1 1-3 0m3 0a1.5 1.5 0 1 0-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-9.75 0h9.75"
178
178
  ],
179
+ "arrows-pointing-out": [
180
+ "M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"
181
+ ],
182
+ "arrows-pointing-in": [
183
+ "M9 9V4.5M9 9H4.5M9 9 3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5 5.25 5.25"
184
+ ],
185
+ "cursor-arrow-rays": [
186
+ "M15.042 21.672 13.684 16.6m0 0-2.51 2.225.569-9.47 5.227 7.917-3.286-.672ZM12 2.25V4.5m5.834.166-1.591 1.591M20.25 10.5H18M7.757 14.743l-1.59 1.59M6 10.5H3.75m4.007-4.243-1.59-1.59"
187
+ ],
179
188
  "rectangle-stack": [
180
189
  "M6 6.878V6a2.25 2.25 0 0 1 2.25-2.25h7.5A2.25 2.25 0 0 1 18 6v.878m-12 0q.354-.126.75-.128h10.5q.396.002.75.128m-12 0A2.25 2.25 0 0 0 4.5 9v.878m13.5-3A2.25 2.25 0 0 1 19.5 9v.878m0 0a2.3 2.3 0 0 0-.75-.128H5.25q-.396.002-.75.128m15 0A2.25 2.25 0 0 1 21 12v6a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 18v-6c0-.98.626-1.813 1.5-2.122"
181
190
  ],
@@ -61,9 +61,16 @@ export function createLeaveScope(discard, options = {}) {
61
61
  ...definedOptions(firstDirty()?.options?.())
62
62
  };
63
63
  }
64
+ let accepted = false;
64
65
  function confirmLeave(extra) {
65
- if (!dirty.value) return Promise.resolve(true);
66
- return discard({ ...confirmOptions(), ...definedOptions(extra) });
66
+ if (!dirty.value || accepted) return Promise.resolve(true);
67
+ return discard({ ...confirmOptions(), ...definedOptions(extra) }).then((confirmed) => {
68
+ if (confirmed && isClient()) {
69
+ accepted = true;
70
+ setTimeout(() => accepted = false);
71
+ }
72
+ return confirmed;
73
+ });
67
74
  }
68
75
  return {
69
76
  dirty,
@@ -1,94 +1,117 @@
1
1
  <template>
2
- <dialog
3
- ref="dialogRef"
4
- :class="[prefix, rootClass]"
5
- :aria-labelledby="labelledBy"
6
- :aria-label="labelledBy ? void 0 : label"
7
- :aria-describedby="hasDescription ? descriptionId : void 0"
8
- :closedby="dismissible ? 'closerequest' : 'none'"
9
- @cancel="onCancel"
10
- @close="onClose"
11
- @pointerdown="onPointerDown"
12
- @click="onClick"
13
- >
14
- <div v-if="present" ref="panelRef" :class="`${prefix}-panel`" tabindex="-1">
15
- <header
16
- v-if="hasHeader"
17
- :class="[`${prefix}-header`, { 'has-tabs': hasTabs, 'has-toolbar': !!slots.toolbar }]"
18
- >
19
- <div v-if="slots.header" :id="headerId" class="k-dialog-header-slot">
20
- <slot
21
- name="header"
22
- :close="close"
23
- :title-id="titleId"
24
- :description-id="descriptionId"
25
- />
26
- </div>
27
- <template v-else>
28
- <div :class="`${prefix}-heading`">
29
- <div v-if="slots['title-trailing']" :class="`${prefix}-title-row`">
30
- <h2 v-if="hasTitle" :id="titleId" :class="titleClass">
2
+ <Teleport :to="dockTarget" :disabled="!teleported">
3
+ <dialog
4
+ ref="dialogRef"
5
+ v-bind="$attrs"
6
+ :class="[
7
+ prefix,
8
+ rootClass,
9
+ { 'is-dockable': dockable, 'is-docked': docked, 'is-expanded': teleported && expanded }
10
+ ]"
11
+ :aria-labelledby="labelledBy"
12
+ :aria-label="labelledBy ? void 0 : label"
13
+ :aria-describedby="hasDescription ? descriptionId : void 0"
14
+ :closedby="dismissible && !docked ? 'closerequest' : 'none'"
15
+ @cancel="onCancel"
16
+ @close="onClose"
17
+ @pointerdown="onPointerDown"
18
+ @click="onClick"
19
+ @keydown.esc="onDockedEscape"
20
+ >
21
+ <div v-if="present" ref="panelRef" :class="`${prefix}-panel`" tabindex="-1">
22
+ <header
23
+ v-if="hasHeader"
24
+ :class="[
25
+ `${prefix}-header`,
26
+ { 'has-tabs': hasTabs, 'has-toolbar': !!slots.toolbar }
27
+ ]"
28
+ >
29
+ <div v-if="slots.header" :id="headerId" class="k-dialog-header-slot">
30
+ <slot
31
+ name="header"
32
+ :close="close"
33
+ :title-id="titleId"
34
+ :description-id="descriptionId"
35
+ />
36
+ </div>
37
+ <template v-else>
38
+ <div :class="`${prefix}-heading`">
39
+ <div v-if="slots['title-trailing']" :class="`${prefix}-title-row`">
40
+ <h2 v-if="hasTitle" :id="titleId" :class="titleClass">
41
+ <DialogTrail :trail="trail" @navigate="navigate">
42
+ <slot name="title">{{ title }}</slot>
43
+ </DialogTrail>
44
+ </h2>
45
+ <slot name="title-trailing" />
46
+ </div>
47
+ <h2 v-else-if="hasTitle" :id="titleId" :class="titleClass">
31
48
  <DialogTrail :trail="trail" @navigate="navigate">
32
49
  <slot name="title">{{ title }}</slot>
33
50
  </DialogTrail>
34
51
  </h2>
35
- <slot name="title-trailing" />
52
+ <p v-if="hasDescription" :id="descriptionId" :class="`${prefix}-description`">
53
+ <slot name="description">{{ description }}</slot>
54
+ </p>
36
55
  </div>
37
- <h2 v-else-if="hasTitle" :id="titleId" :class="titleClass">
38
- <DialogTrail :trail="trail" @navigate="navigate">
39
- <slot name="title">{{ title }}</slot>
40
- </DialogTrail>
41
- </h2>
42
- <p v-if="hasDescription" :id="descriptionId" :class="`${prefix}-description`">
43
- <slot name="description">{{ description }}</slot>
44
- </p>
45
- </div>
46
- </template>
47
- <div v-if="$slots.actions || showClose || hasTrail" :class="`${prefix}-actions`">
48
- <Button
49
- v-if="hasTrail"
50
- variant="ghost"
51
- tone="neutral"
52
- size="sm"
53
- icon="arrow-left"
54
- :disabled="loading"
55
- @click="navigate(trail.length - 1)"
56
+ </template>
57
+ <div
58
+ v-if="$slots.actions || showClose || hasTrail || showExpand"
59
+ :class="`${prefix}-actions`"
56
60
  >
57
- {{ backText }}
58
- </Button>
59
- <slot name="actions" :close="close" />
60
- <Button
61
- v-if="showClose"
62
- icon="x-mark"
63
- variant="ghost"
64
- tone="neutral"
61
+ <Button
62
+ v-if="hasTrail"
63
+ variant="ghost"
64
+ tone="neutral"
65
+ size="sm"
66
+ icon="arrow-left"
67
+ :disabled="loading"
68
+ @click="navigate(trail.length - 1)"
69
+ >
70
+ {{ backText }}
71
+ </Button>
72
+ <slot name="actions" :close="close" />
73
+ <Button
74
+ v-if="showExpand"
75
+ :icon="expanded ? 'arrows-pointing-in' : 'arrows-pointing-out'"
76
+ variant="ghost"
77
+ tone="neutral"
78
+ size="sm"
79
+ :disabled="loading"
80
+ :aria-label="expanded ? collapseText : expandText"
81
+ @click="expanded = !expanded"
82
+ />
83
+ <Button
84
+ v-if="showClose"
85
+ icon="x-mark"
86
+ variant="ghost"
87
+ tone="neutral"
88
+ size="sm"
89
+ :disabled="loading"
90
+ :class="`${prefix}-close`"
91
+ :aria-label="closeText"
92
+ @click="requestClose('close-button')"
93
+ />
94
+ </div>
95
+ <div v-if="slots.toolbar" :class="`${prefix}-toolbar`">
96
+ <slot name="toolbar" />
97
+ </div>
98
+ <Tabs
99
+ v-if="hasTabs"
100
+ v-model="tab"
101
+ :items="tabs"
102
+ :controls="panelId"
103
+ :label="label ?? title"
104
+ variant="underline"
65
105
  size="sm"
66
- :disabled="loading"
67
- :class="`${prefix}-close`"
68
- :aria-label="closeText"
69
- @click="requestClose('close-button')"
106
+ :class="`${prefix}-tabs`"
70
107
  />
71
- </div>
72
- <div v-if="slots.toolbar" :class="`${prefix}-toolbar`">
73
- <slot name="toolbar" />
74
- </div>
75
- <Tabs
76
- v-if="hasTabs"
77
- v-model="tab"
78
- :items="tabs"
79
- :controls="panelId"
80
- :label="label ?? title"
81
- variant="underline"
82
- size="sm"
83
- :class="`${prefix}-tabs`"
84
- />
85
- </header>
86
- <div
87
- :id="hasTabs ? panelId : void 0"
88
- ref="bodyRef"
89
- :role="hasTabs ? 'tabpanel' : void 0"
90
- :aria-label="hasTabs ? activeTabItem?.label : void 0"
91
- :class="[
108
+ </header>
109
+ <div
110
+ :id="hasTabs ? panelId : void 0"
111
+ ref="bodyRef"
112
+ :role="hasTabs ? 'tabpanel' : void 0"
113
+ :aria-label="hasTabs ? activeTabItem?.label : void 0"
114
+ :class="[
92
115
  `${prefix}-body`,
93
116
  {
94
117
  'is-flush': flush,
@@ -97,19 +120,21 @@
97
120
  'is-overflow-bottom': overflowBottom
98
121
  }
99
122
  ]"
100
- >
101
- <slot :close="close" :title-id="labelledBy ?? titleId" :tab="activeTab" />
123
+ >
124
+ <slot :close="close" :title-id="labelledBy ?? titleId" :tab="activeTab" />
125
+ </div>
126
+ <footer v-if="$slots.footer" :class="`${prefix}-footer`">
127
+ <slot name="footer" :close="close" />
128
+ </footer>
102
129
  </div>
103
- <footer v-if="$slots.footer" :class="`${prefix}-footer`">
104
- <slot name="footer" :close="close" />
105
- </footer>
106
- </div>
107
- </dialog>
130
+ </dialog>
131
+ </Teleport>
108
132
  </template>
109
133
 
110
134
  <script setup>
111
135
  import {
112
136
  computed,
137
+ inject,
113
138
  nextTick,
114
139
  onBeforeUnmount,
115
140
  onMounted,
@@ -130,7 +155,9 @@ import { createLeaveScope, provideScope, setDialogScope } from "../forms/leave";
130
155
  import { provideFieldBoundary } from "../../composables/useFieldBoundary";
131
156
  import { useScrollEdges } from "../core/scroll-edges";
132
157
  import { useModalDialog } from "./dialog";
158
+ import { DOCK_KEY } from "./dock";
133
159
  import { hasNameAttrs } from "../forms/name";
160
+ defineOptions({ inheritAttrs: false });
134
161
  const props = defineProps({
135
162
  prefix: { type: String, required: true },
136
163
  rootClass: { type: null, required: true },
@@ -149,7 +176,11 @@ const props = defineProps({
149
176
  backLabel: { type: String, required: false },
150
177
  guard: { type: Boolean, required: false, default: true },
151
178
  guardTitle: { type: String, required: false },
152
- guardMessage: { type: String, required: false }
179
+ guardMessage: { type: String, required: false },
180
+ dock: { type: Boolean, required: false },
181
+ expandable: { type: Boolean, required: false },
182
+ expandLabel: { type: String, required: false },
183
+ collapseLabel: { type: String, required: false }
153
184
  });
154
185
  provideFieldBoundary();
155
186
  const parentScope = useLeaveScope();
@@ -169,6 +200,18 @@ async function guardedClose(reason) {
169
200
  const { t } = useLocale();
170
201
  const closeText = computed(() => props.closeLabel ?? t("common.close"));
171
202
  const backText = computed(() => props.backLabel ?? t("common.back"));
203
+ const expandText = computed(() => props.expandLabel ?? t("dock.expand"));
204
+ const collapseText = computed(() => props.collapseLabel ?? t("dock.collapse"));
205
+ const dockHost = inject(DOCK_KEY, null);
206
+ const mounted = ref(false);
207
+ const expanded = ref(false);
208
+ const dockable = computed(() => Boolean(props.dock && dockHost));
209
+ const dockTarget = computed(() => dockHost?.target.value ?? null);
210
+ const teleported = computed(
211
+ () => dockable.value && mounted.value && !!dockTarget.value && !!dockHost?.wide.value
212
+ );
213
+ const docked = computed(() => teleported.value && !expanded.value);
214
+ const showExpand = computed(() => Boolean(props.expandable && teleported.value));
172
215
  const slots = defineSlots();
173
216
  const emit = defineEmits(["open", "close", "afterLeave", "navigate"]);
174
217
  const open = defineModel("open", { type: Boolean, ...{ required: true } });
@@ -215,18 +258,37 @@ const { present, requestClose, onCancel, onClose, onPointerDown, onClick } = use
215
258
  dialog: dialogRef,
216
259
  panel: panelRef,
217
260
  open,
261
+ modal: () => !docked.value,
262
+ interceptClose: (reason) => {
263
+ if (!expanded.value || !teleported.value) return false;
264
+ if (reason !== "escape" && reason !== "backdrop") return false;
265
+ expanded.value = false;
266
+ return true;
267
+ },
218
268
  dismissible: () => props.dismissible && !props.loading,
219
269
  beforeClose: () => leave.dirty.value || props.beforeClose ? guardedClose : void 0,
220
270
  onOpen: () => emit("open"),
221
271
  onClose: () => emit("close"),
222
272
  onAfterLeave: () => emit("afterLeave")
223
273
  });
274
+ function onDockedEscape(event) {
275
+ const dialog = dialogRef.value;
276
+ if (!docked.value || !dialog || event.defaultPrevented) return;
277
+ if (!(event.target instanceof Element) || event.target.closest("dialog") !== dialog) return;
278
+ if (dialog.querySelector(":popover-open")) return;
279
+ event.preventDefault();
280
+ if (props.dismissible && !props.loading) requestClose("escape");
281
+ }
282
+ watch(open, (value) => {
283
+ if (!value) expanded.value = false;
284
+ });
224
285
  async function navigate(index) {
225
286
  if (props.loading) return;
226
287
  if (!await leave.confirmLeave()) return;
227
288
  emit("navigate", index);
228
289
  }
229
290
  onMounted(() => {
291
+ mounted.value = true;
230
292
  if (dialogRef.value) setDialogScope(dialogRef.value, leave);
231
293
  });
232
294
  onBeforeUnmount(() => {
@@ -44,6 +44,10 @@ declare const __VLS_base: import("vue").DefineComponent<{
44
44
  guard?: boolean;
45
45
  guardTitle?: string;
46
46
  guardMessage?: string;
47
+ dock?: boolean;
48
+ expandable?: boolean;
49
+ expandLabel?: string;
50
+ collapseLabel?: string;
47
51
  open: boolean;
48
52
  tab?: TabItem["value"];
49
53
  key?: PropertyKey | undefined;
@@ -269,6 +273,10 @@ declare const __VLS_base: import("vue").DefineComponent<{
269
273
  guard?: boolean;
270
274
  guardTitle?: string;
271
275
  guardMessage?: string;
276
+ dock?: boolean;
277
+ expandable?: boolean;
278
+ expandLabel?: string;
279
+ collapseLabel?: string;
272
280
  open: boolean;
273
281
  tab?: TabItem["value"];
274
282
  key?: PropertyKey | undefined;
@@ -6,6 +6,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
6
6
  prefix?: "k-modal" | "k-drawer" | undefined;
7
7
  fill?: boolean;
8
8
  size?: "sm" | "md" | "lg" | "xl" | "full" | undefined;
9
+ dock?: boolean;
9
10
  tabs?: import("../../index.ts").TabItem[];
10
11
  label?: string;
11
12
  title?: string | undefined;
@@ -225,10 +226,14 @@ declare const __VLS_export: import("vue").DefineComponent<{
225
226
  backLabel?: string;
226
227
  guardTitle?: string;
227
228
  guardMessage?: string;
229
+ expandable?: boolean;
230
+ expandLabel?: string;
231
+ collapseLabel?: string;
228
232
  onOpen?: ((() => any) & (() => any)) | undefined;
229
233
  "onUpdate:tab"?: (((value: string | number | undefined) => any) & ((value: string | number | undefined) => any)) | undefined;
230
234
  closedby?: import("../../index.ts").DialogClosedBy;
231
235
  minHeight?: string;
236
+ docked?: boolean;
232
237
  }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
233
238
  close: () => any;
234
239
  resolve: (result: unknown) => any;
@@ -240,6 +245,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
240
245
  prefix?: "k-modal" | "k-drawer" | undefined;
241
246
  fill?: boolean;
242
247
  size?: "sm" | "md" | "lg" | "xl" | "full" | undefined;
248
+ dock?: boolean;
243
249
  tabs?: import("../../index.ts").TabItem[];
244
250
  label?: string;
245
251
  title?: string | undefined;
@@ -459,10 +465,14 @@ declare const __VLS_export: import("vue").DefineComponent<{
459
465
  backLabel?: string;
460
466
  guardTitle?: string;
461
467
  guardMessage?: string;
468
+ expandable?: boolean;
469
+ expandLabel?: string;
470
+ collapseLabel?: string;
462
471
  onOpen?: ((() => any) & (() => any)) | undefined;
463
472
  "onUpdate:tab"?: (((value: string | number | undefined) => any) & ((value: string | number | undefined) => any)) | undefined;
464
473
  closedby?: import("../../index.ts").DialogClosedBy;
465
474
  minHeight?: string;
475
+ docked?: boolean;
466
476
  }> & Readonly<{
467
477
  onClose?: (() => any) | undefined;
468
478
  onResolve?: ((result: unknown) => any) | undefined;
@@ -73,10 +73,26 @@ export function useToasterAvoidance(options) {
73
73
  }
74
74
  return next;
75
75
  }
76
+ function dockInsets(dock, toaster) {
77
+ const horizontal = horizontalOf(options.position());
78
+ if (horizontal === "left") return NONE;
79
+ const rect = dock.getBoundingClientRect();
80
+ if (!rect.width) return NONE;
81
+ const viewport = document.documentElement.clientWidth;
82
+ const occupied = Math.max(0, Math.ceil(viewport - rect.left));
83
+ const free = rect.left - 2 * rootPixels();
84
+ if (free < toasterWidth(toaster, viewport)) return NONE;
85
+ return { ...NONE, right: occupied };
86
+ }
76
87
  function compute() {
77
88
  frame = 0;
78
89
  const dialog = current;
79
90
  const toaster = options.toaster.value;
91
+ if (dialog && toaster && dialog.classList.contains("k-shell-dock-frame")) {
92
+ const next2 = dockInsets(dialog, toaster);
93
+ if (!sameInsets(next2, insets.value)) insets.value = next2;
94
+ return;
95
+ }
80
96
  const panel = dialog?.querySelector(':scope > [class$="-panel"]');
81
97
  if (!dialog || !toaster || !panel) {
82
98
  if (!dialog && !sameInsets(insets.value, NONE)) insets.value = NONE;
@@ -1,11 +1,14 @@
1
1
  import type { Ref } from 'vue';
2
2
  import type { DialogBeforeClose, DialogCloseReason } from '../../components/overlays/types';
3
3
  export declare const modalStack: import("vue").ShallowReactive<HTMLDialogElement[]>;
4
+ export declare function topDialog(): HTMLDialogElement | undefined;
4
5
  export declare function releaseModal(dialog: HTMLDialogElement | null | undefined): void;
5
6
  export interface ModalDialogOptions {
6
7
  dialog: Readonly<Ref<HTMLDialogElement | null | undefined>>;
7
8
  panel: Readonly<Ref<HTMLElement | null | undefined>>;
8
9
  open: Ref<boolean>;
10
+ modal?: () => boolean;
11
+ interceptClose?: (reason: DialogCloseReason) => boolean;
9
12
  dismissible: () => boolean;
10
13
  beforeClose?: () => DialogBeforeClose | undefined;
11
14
  onOpen?: () => void;