@bridge-ui/vue 0.22.1 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ai/skills/bridge-ui-overlays/SKILL.md +4 -2
- package/dist/Actions/Snackbar/BridgeSnackbarAction.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/Actions/Snackbar/BridgeSnackbarItem.vue_vue_type_script_setup_true_lang.js +31 -25
- package/dist/Actions/Snackbar/bridgeSnackbar.types.d.ts +14 -7
- package/dist/Actions/Snackbar/index.d.ts +1 -1
- package/dist/Actions/index.d.ts +1 -1
- package/dist/Components/ColorField/composables/useColorField.js +1 -1
- package/dist/Components/DateField/composables/useDateField.js +1 -1
- package/dist/Components/DateRangeField/composables/useDateRangeField.js +1 -1
- package/dist/Components/DateTimeField/composables/useDateTimeField.js +1 -1
- package/dist/Components/DateTimeRangeField/composables/useDateTimeRangeField.js +1 -1
- package/dist/Components/Drawer/Drawer.vue_vue_type_script_setup_true_lang.js +7 -7
- package/dist/Components/Drawer/composables/useDrawer.d.ts +1 -0
- package/dist/Components/Drawer/composables/useDrawer.js +96 -90
- package/dist/Components/Menu/composables/useMenu.d.ts +8 -8
- package/dist/Components/Menu/composables/useMenu.js +81 -195
- package/dist/Components/Modal/Modal.vue_vue_type_script_setup_true_lang.js +7 -7
- package/dist/Components/Modal/composables/useModal.d.ts +1 -0
- package/dist/Components/Modal/composables/useModal.js +120 -114
- package/dist/Components/Popover/Popover.js +4 -0
- package/dist/Components/Popover/Popover.vue.d.ts +39 -0
- package/dist/Components/Popover/Popover.vue_vue_type_script_setup_true_lang.js +100 -0
- package/dist/Components/Popover/composables/popoverParts.d.ts +52 -0
- package/dist/Components/Popover/composables/popoverParts.js +35 -0
- package/dist/Components/Popover/composables/usePopover.d.ts +68 -0
- package/dist/Components/Popover/composables/usePopover.js +119 -0
- package/dist/Components/Popover/composables/usePopoverBase.d.ts +130 -0
- package/dist/Components/Popover/composables/usePopoverBase.js +210 -0
- package/dist/Components/Popover/index.d.ts +4 -0
- package/dist/Components/Popover/index.js +3 -0
- package/dist/Components/Popover/popover.types.d.ts +207 -0
- package/dist/Components/Resizable/composables/useResizable.js +85 -85
- package/dist/Components/Snackbar/Snackbar.vue.d.ts +1 -1
- package/dist/Components/Snackbar/Snackbar.vue_vue_type_script_setup_true_lang.js +23 -23
- package/dist/Components/Snackbar/composables/useSnackbar.js +107 -107
- package/dist/Components/Snackbar/snackbar.types.d.ts +1 -1
- package/dist/Components/TimeField/composables/useTimeField.js +1 -1
- package/dist/Components/TimeRangeField/composables/useTimeRangeField.js +1 -1
- package/dist/augments.d.ts +5 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +78 -76
- package/docs/README.md +1 -0
- package/docs/components/Menu.md +4 -0
- package/docs/components/Popover.md +210 -0
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: bridge-ui-overlays
|
|
3
3
|
description: >-
|
|
4
|
-
Bridge UI Vue overlays and imperative actions — Modal, Drawer, Menu, Tooltip,
|
|
4
|
+
Bridge UI Vue overlays and imperative actions — Modal, Drawer, Menu, Popover, Tooltip,
|
|
5
5
|
Snackbar, useModalAction, useDialogAction, useDrawerAction, useSnackbarAction,
|
|
6
6
|
BridgeUIHosts. Use when opening layers or toast/dialog flows.
|
|
7
7
|
---
|
|
@@ -21,6 +21,7 @@ Overlays: **`v-model`**. Modal/Drawer body: **`Card`** (no `ModalCard`).
|
|
|
21
21
|
| Modal | `.ai/docs/components/Modal.md` |
|
|
22
22
|
| Drawer | `.ai/docs/components/Drawer.md` |
|
|
23
23
|
| Menu | `.ai/docs/components/Menu.md` |
|
|
24
|
+
| Popover | `.ai/docs/components/Popover.md` |
|
|
24
25
|
| Tooltip | `.ai/docs/components/Tooltip.md` |
|
|
25
26
|
| Snackbar | `.ai/docs/components/Snackbar.md` |
|
|
26
27
|
| useModalAction | `.ai/docs/components/useModalAction.md` |
|
|
@@ -34,4 +35,5 @@ Overlays: **`v-model`**. Modal/Drawer body: **`Card`** (no `ModalCard`).
|
|
|
34
35
|
1. Mount `BridgeUIHosts` before using action hooks.
|
|
35
36
|
2. `align` on Modal applies on all breakpoints — use `useBreakpoint` for mobile bottom sheets (keep the reactive object; do not destructure helpers).
|
|
36
37
|
3. Menu panel children are real components (`List` / `ListItem`, etc.). Docs may show a local `MenuContent` helper — that is **not** a Bridge export.
|
|
37
|
-
4.
|
|
38
|
+
4. Use `Popover` (not `Menu`) for forms, filters or rich content in a floating panel — `Menu` is for action lists and captures arrow keys.
|
|
39
|
+
5. Match action `open` option shapes to the `use*Action` docs. Escape closes the top nested layer only.
|
|
@@ -19,7 +19,7 @@ var h = /*@__PURE__*/ o({
|
|
|
19
19
|
},
|
|
20
20
|
emits: ["run"],
|
|
21
21
|
setup(o, { emit: h }) {
|
|
22
|
-
let g = o, _ = h, v = r(() => g.role === "accept" ? g.snackbarColor : "
|
|
22
|
+
let g = o, _ = h, v = r(() => g.role === "accept" ? g.snackbarColor : "dark"), y = r(() => v.value), b = r(() => {
|
|
23
23
|
if (!g.action.link) return {};
|
|
24
24
|
let { onClick: e, ...t } = g.action.link;
|
|
25
25
|
return t;
|
|
@@ -27,12 +27,12 @@ var h = /*@__PURE__*/ o({
|
|
|
27
27
|
let e = g.snackbarRounded ?? "lg", t = f(p, e), n = f(t, "tr"), r = f(t, "br"), i = {
|
|
28
28
|
trailing: "mr-4 shrink-0",
|
|
29
29
|
"right-accept": m({
|
|
30
|
-
"w-full rounded-none": !0,
|
|
30
|
+
"w-full h-full rounded-none": !0,
|
|
31
31
|
[n ?? ""]: !0,
|
|
32
32
|
[r ?? ""]: !g.hasReject
|
|
33
33
|
}),
|
|
34
34
|
"right-reject": m({
|
|
35
|
-
"w-full rounded-none": !0,
|
|
35
|
+
"w-full h-full rounded-none": !0,
|
|
36
36
|
[r ?? ""]: !0,
|
|
37
37
|
[n ?? ""]: !g.hasAccept
|
|
38
38
|
})
|
|
@@ -64,7 +64,7 @@ var h = /*@__PURE__*/ o({
|
|
|
64
64
|
size: "sm",
|
|
65
65
|
onClick: T,
|
|
66
66
|
color: v.value
|
|
67
|
-
}, w.value, { variant: o.action.
|
|
67
|
+
}, w.value, { variant: o.action.variant ?? "flat" }), {
|
|
68
68
|
default: d(() => [a(l(o.action.label), 1)]),
|
|
69
69
|
_: 1
|
|
70
70
|
}, 16, ["color", "variant"]));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import e from "../../Components/Snackbar/Snackbar.js";
|
|
2
2
|
import t from "./BridgeSnackbarAction.js";
|
|
3
3
|
import { computed as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createSlots as s, createVNode as c, defineComponent as l, mergeProps as u, normalizeClass as d, openBlock as f, unref as p, withCtx as m } from "vue";
|
|
4
|
-
import { completeLayerHide as h, mergeLayerShellProps as g
|
|
4
|
+
import { completeLayerHide as h, mergeLayerShellProps as g } from "@bridge-ui/core/Layer";
|
|
5
5
|
// src/Actions/Snackbar/BridgeSnackbarItem.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
-
var v = { class: "flex flex-col border-l border-dark-200 dark:border-dark-700" }, y = {
|
|
6
|
+
var _ = { class: "flex items-center gap-x-2" }, v = { class: "flex flex-col min-w-20 border-l border-dark-200 dark:border-dark-700" }, y = {
|
|
7
7
|
key: 1,
|
|
8
8
|
class: "flex flex-1 h-0"
|
|
9
9
|
}, b = /*@__PURE__*/ l({
|
|
@@ -14,30 +14,36 @@ var v = { class: "flex flex-col border-l border-dark-200 dark:border-dark-700" }
|
|
|
14
14
|
hostSnackbar: {}
|
|
15
15
|
},
|
|
16
16
|
setup(l) {
|
|
17
|
-
let b = l, { actions: x,
|
|
17
|
+
let b = l, { actions: x, actionsPlacement: S = "bottom", ...C } = b.entry.props, w = n(() => !!(x?.accept?.label || x?.reject?.label)), T = n(() => w.value && S === "right"), E = n(() => {
|
|
18
|
+
let e = g(b.hostSnackbar, C);
|
|
19
|
+
return T.value && C.closeButton === void 0 ? {
|
|
20
|
+
...e,
|
|
21
|
+
closeButton: !1
|
|
22
|
+
} : e;
|
|
23
|
+
}), D = n(() => E.value.color ?? "primary"), O = n(() => E.value.rounded ?? "lg"), k = () => {
|
|
18
24
|
b.api.close(b.entry.id);
|
|
19
25
|
};
|
|
20
|
-
function
|
|
26
|
+
function A(e) {
|
|
21
27
|
e?.(), b.api.close(b.entry.id);
|
|
22
28
|
}
|
|
23
|
-
let
|
|
24
|
-
return (n, g) => (f(), r(p(e), u({ "stack-id": l.entry.id },
|
|
29
|
+
let j = n(() => w.value && S === "bottom"), M = n(() => S === "trailing" && !!x?.accept?.label);
|
|
30
|
+
return (n, g) => (f(), r(p(e), u({ "stack-id": l.entry.id }, E.value, {
|
|
25
31
|
"teleport-to": !1,
|
|
26
32
|
"model-value": l.entry.show,
|
|
27
|
-
onClose:
|
|
33
|
+
onClose: k,
|
|
28
34
|
"onUpdate:modelValue": g[5] ||= (e) => l.api.syncShow(l.entry.id, e),
|
|
29
35
|
onLeaveComplete: g[6] ||= () => p(h)(l.api.entries.value, l.entry.id, !1, l.api.removeEntry)
|
|
30
36
|
}), s({ _: 2 }, [
|
|
31
37
|
j.value ? {
|
|
32
38
|
name: "actions",
|
|
33
|
-
fn: m(() => [p(x)?.accept?.label ? (f(), r(t, {
|
|
39
|
+
fn: m(() => [o("div", _, [p(x)?.accept?.label ? (f(), r(t, {
|
|
34
40
|
key: 0,
|
|
35
41
|
role: "accept",
|
|
36
42
|
layout: "inline",
|
|
37
43
|
action: p(x).accept,
|
|
38
|
-
"snackbar-color":
|
|
39
|
-
"snackbar-rounded":
|
|
40
|
-
onRun: g[0] ||= (e) =>
|
|
44
|
+
"snackbar-color": D.value,
|
|
45
|
+
"snackbar-rounded": O.value,
|
|
46
|
+
onRun: g[0] ||= (e) => A(p(x)?.accept?.onClick)
|
|
41
47
|
}, null, 8, [
|
|
42
48
|
"action",
|
|
43
49
|
"snackbar-color",
|
|
@@ -47,14 +53,14 @@ var v = { class: "flex flex-col border-l border-dark-200 dark:border-dark-700" }
|
|
|
47
53
|
role: "reject",
|
|
48
54
|
layout: "inline",
|
|
49
55
|
action: p(x).reject,
|
|
50
|
-
"snackbar-color":
|
|
51
|
-
"snackbar-rounded":
|
|
52
|
-
onRun: g[1] ||= (e) =>
|
|
56
|
+
"snackbar-color": D.value,
|
|
57
|
+
"snackbar-rounded": O.value,
|
|
58
|
+
onRun: g[1] ||= (e) => A(p(x)?.reject?.onClick)
|
|
53
59
|
}, null, 8, [
|
|
54
60
|
"action",
|
|
55
61
|
"snackbar-color",
|
|
56
62
|
"snackbar-rounded"
|
|
57
|
-
])) : i("", !0)]),
|
|
63
|
+
])) : i("", !0)])]),
|
|
58
64
|
key: "0"
|
|
59
65
|
} : void 0,
|
|
60
66
|
M.value ? {
|
|
@@ -63,9 +69,9 @@ var v = { class: "flex flex-col border-l border-dark-200 dark:border-dark-700" }
|
|
|
63
69
|
role: "accept",
|
|
64
70
|
layout: "trailing",
|
|
65
71
|
action: p(x).accept,
|
|
66
|
-
"snackbar-color":
|
|
67
|
-
"snackbar-rounded":
|
|
68
|
-
onRun: g[2] ||= (e) =>
|
|
72
|
+
"snackbar-color": D.value,
|
|
73
|
+
"snackbar-rounded": O.value,
|
|
74
|
+
onRun: g[2] ||= (e) => A(p(x)?.accept?.onClick)
|
|
69
75
|
}, null, 8, [
|
|
70
76
|
"action",
|
|
71
77
|
"snackbar-color",
|
|
@@ -73,7 +79,7 @@ var v = { class: "flex flex-col border-l border-dark-200 dark:border-dark-700" }
|
|
|
73
79
|
])]),
|
|
74
80
|
key: "1"
|
|
75
81
|
} : void 0,
|
|
76
|
-
|
|
82
|
+
T.value ? {
|
|
77
83
|
name: "right",
|
|
78
84
|
fn: m(() => [o("div", v, [p(x)?.accept?.label ? (f(), a("div", {
|
|
79
85
|
key: 0,
|
|
@@ -82,10 +88,10 @@ var v = { class: "flex flex-col border-l border-dark-200 dark:border-dark-700" }
|
|
|
82
88
|
role: "accept",
|
|
83
89
|
layout: "right-accept",
|
|
84
90
|
action: p(x).accept,
|
|
85
|
-
"snackbar-color":
|
|
86
|
-
"snackbar-rounded":
|
|
91
|
+
"snackbar-color": D.value,
|
|
92
|
+
"snackbar-rounded": O.value,
|
|
87
93
|
"has-reject": !!p(x)?.reject,
|
|
88
|
-
onRun: g[3] ||= (e) =>
|
|
94
|
+
onRun: g[3] ||= (e) => A(p(x)?.accept?.onClick)
|
|
89
95
|
}, null, 8, [
|
|
90
96
|
"action",
|
|
91
97
|
"snackbar-color",
|
|
@@ -95,10 +101,10 @@ var v = { class: "flex flex-col border-l border-dark-200 dark:border-dark-700" }
|
|
|
95
101
|
role: "reject",
|
|
96
102
|
layout: "right-reject",
|
|
97
103
|
action: p(x).reject,
|
|
98
|
-
"snackbar-color":
|
|
99
|
-
"snackbar-rounded":
|
|
104
|
+
"snackbar-color": D.value,
|
|
105
|
+
"snackbar-rounded": O.value,
|
|
100
106
|
"has-accept": !!p(x)?.accept,
|
|
101
|
-
onRun: g[4] ||= (e) =>
|
|
107
|
+
onRun: g[4] ||= (e) => A(p(x)?.reject?.onClick)
|
|
102
108
|
}, null, 8, [
|
|
103
109
|
"action",
|
|
104
110
|
"snackbar-color",
|
|
@@ -26,9 +26,11 @@ export interface SnackbarAction {
|
|
|
26
26
|
*/
|
|
27
27
|
onClick?: () => void;
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* Button variant (ignored when `link` is set).
|
|
30
|
+
*
|
|
31
|
+
* @default "flat"
|
|
30
32
|
*/
|
|
31
|
-
|
|
33
|
+
variant?: ButtonOwnProps["variant"];
|
|
32
34
|
}
|
|
33
35
|
export interface SnackbarActions {
|
|
34
36
|
/**
|
|
@@ -36,11 +38,12 @@ export interface SnackbarActions {
|
|
|
36
38
|
*/
|
|
37
39
|
accept?: SnackbarAction;
|
|
38
40
|
/**
|
|
39
|
-
* Secondary action (e.g. Dismiss, Cancel). Uses `
|
|
41
|
+
* Secondary action (e.g. Dismiss, Cancel). Uses the neutral `dark` color by default.
|
|
40
42
|
*/
|
|
41
43
|
reject?: SnackbarAction;
|
|
42
44
|
}
|
|
43
45
|
export type BridgeSnackbarShellProps = Partial<Omit<SnackbarOwnProps, "stackId">>;
|
|
46
|
+
export type SnackbarActionsPlacement = "right" | "bottom" | "trailing";
|
|
44
47
|
export type SnackbarActionLayout = "inline" | "trailing" | "right-accept" | "right-reject";
|
|
45
48
|
export type SnackbarActionColor = keyof SnackbarColor;
|
|
46
49
|
export type SnackbarActionRounded = keyof SnackbarRounded;
|
|
@@ -88,15 +91,19 @@ export type BridgeSnackbarItemProps = {
|
|
|
88
91
|
};
|
|
89
92
|
export type BridgeSnackbarContentProps = BridgeSnackbarShellProps & {
|
|
90
93
|
/**
|
|
91
|
-
* Preset
|
|
94
|
+
* Preset actions (mapped to slots by the host according to `actionsPlacement`).
|
|
92
95
|
*/
|
|
93
96
|
actions?: SnackbarActions;
|
|
94
97
|
/**
|
|
95
|
-
*
|
|
98
|
+
* Where `actions` render:
|
|
99
|
+
* - `bottom`: a row below the title / description.
|
|
100
|
+
* - `trailing`: the accept action next to the close button (`reject` is ignored).
|
|
101
|
+
* - `right`: a vertical column on the right edge (hides the close button
|
|
102
|
+
* unless `closeButton` is set explicitly).
|
|
96
103
|
*
|
|
97
|
-
* @default
|
|
104
|
+
* @default "bottom"
|
|
98
105
|
*/
|
|
99
|
-
|
|
106
|
+
actionsPlacement?: SnackbarActionsPlacement;
|
|
100
107
|
};
|
|
101
108
|
export type BridgeSnackbarEntry = {
|
|
102
109
|
id: LayerId;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type { BridgeSnackbarActionProps, BridgeSnackbarApi, BridgeSnackbarContentProps, BridgeSnackbarEntry, BridgeSnackbarHostProps, BridgeSnackbarItemProps, BridgeSnackbarOpenOptions, BridgeSnackbarShellProps, BridgeSnackbarUpdateOptions, SnackbarAction, SnackbarActionColor, SnackbarActionLayout, SnackbarActions, } from './bridgeSnackbar.types';
|
|
1
|
+
export type { BridgeSnackbarActionProps, BridgeSnackbarApi, BridgeSnackbarContentProps, BridgeSnackbarEntry, BridgeSnackbarHostProps, BridgeSnackbarItemProps, BridgeSnackbarOpenOptions, BridgeSnackbarShellProps, BridgeSnackbarUpdateOptions, SnackbarAction, SnackbarActionColor, SnackbarActionLayout, SnackbarActions, SnackbarActionsPlacement, } from './bridgeSnackbar.types';
|
|
2
2
|
export { default as BridgeSnackbarHost } from './BridgeSnackbarHost.vue';
|
|
3
3
|
export { BridgeSnackbarHostMissingError, useSnackbarAction, } from './useSnackbarAction';
|
package/dist/Actions/index.d.ts
CHANGED
|
@@ -7,4 +7,4 @@ export type { BridgeDrawerApi, BridgeDrawerController, BridgeDrawerEntry, Bridge
|
|
|
7
7
|
export { BridgeModalHost, BridgeModalHostMissingError, useModalAction, } from './Modal';
|
|
8
8
|
export type { BridgeModalApi, BridgeModalController, BridgeModalEntry, BridgeModalHostProps, BridgeModalOpenOptions, BridgeModalShellProps, BridgeModalUpdateOptions, } from './Modal';
|
|
9
9
|
export { BridgeSnackbarHost, BridgeSnackbarHostMissingError, useSnackbarAction, } from './Snackbar';
|
|
10
|
-
export type { BridgeSnackbarActionProps, BridgeSnackbarApi, BridgeSnackbarEntry, BridgeSnackbarHostProps, BridgeSnackbarOpenOptions, BridgeSnackbarShellProps, BridgeSnackbarUpdateOptions, SnackbarAction, SnackbarActions, } from './Snackbar';
|
|
10
|
+
export type { BridgeSnackbarActionProps, BridgeSnackbarApi, BridgeSnackbarEntry, BridgeSnackbarHostProps, BridgeSnackbarOpenOptions, BridgeSnackbarShellProps, BridgeSnackbarUpdateOptions, SnackbarAction, SnackbarActions, SnackbarActionsPlacement, } from './Snackbar';
|
|
@@ -115,7 +115,7 @@ function w(p, w, T) {
|
|
|
115
115
|
M.value.editable && (A.value = e.target.value);
|
|
116
116
|
},
|
|
117
117
|
onKeydown: (e) => {
|
|
118
|
-
G.inputBind.value.onKeydown?.(e), e.key === "Escape" && (A.value = null, H(!1)), e.key === "Enter" && M.value.editable && A.value !== null && (e.preventDefault(), Z(A.value));
|
|
118
|
+
G.inputBind.value.onKeydown?.(e), e.key === "Escape" && (O.value && e.preventDefault(), A.value = null, H(!1)), e.key === "Enter" && M.value.editable && A.value !== null && (e.preventDefault(), Z(A.value));
|
|
119
119
|
}
|
|
120
120
|
}, void 0, G.inputBind.value)), de = o(() => M.value.overlay), fe = o(() => ({
|
|
121
121
|
modal: M.value.customProps?.modal,
|
|
@@ -112,7 +112,7 @@ function T(p, m, T) {
|
|
|
112
112
|
q.inputBind.value.onFocus?.(e), W(!0);
|
|
113
113
|
},
|
|
114
114
|
onKeydown: (e) => {
|
|
115
|
-
q.inputBind.value.onKeydown?.(e), e.key === "Escape" && W(!1);
|
|
115
|
+
q.inputBind.value.onKeydown?.(e), e.key === "Escape" && (A.value && e.preventDefault(), W(!1));
|
|
116
116
|
}
|
|
117
117
|
}, void 0, q.inputBind.value)), re = c(() => N.value.overlay), ie = c(() => ({
|
|
118
118
|
modal: N.value.customProps?.modal,
|
|
@@ -101,7 +101,7 @@ function S(S, C, w) {
|
|
|
101
101
|
B.inputBind.value.onFocus?.(e), R(!0);
|
|
102
102
|
},
|
|
103
103
|
onKeydown: (e) => {
|
|
104
|
-
B.inputBind.value.onKeydown?.(e), e.key === "Escape" && R(!1);
|
|
104
|
+
B.inputBind.value.onKeydown?.(e), e.key === "Escape" && (k.value && e.preventDefault(), R(!1));
|
|
105
105
|
}
|
|
106
106
|
}, void 0, B.inputBind.value)), re = s(() => M.value.overlay), Q = s(() => ({
|
|
107
107
|
modal: M.value.customProps?.modal,
|
|
@@ -89,7 +89,7 @@ function C(C, w, T) {
|
|
|
89
89
|
G.inputBind.value.onFocus?.(e), H(!0);
|
|
90
90
|
},
|
|
91
91
|
onKeydown: (e) => {
|
|
92
|
-
G.inputBind.value.onKeydown?.(e), e.key === "Escape" && H(!1);
|
|
92
|
+
G.inputBind.value.onKeydown?.(e), e.key === "Escape" && (A.value && e.preventDefault(), H(!1));
|
|
93
93
|
}
|
|
94
94
|
}, void 0, G.inputBind.value)), te = l(() => N.value.overlay), ne = l(() => ({
|
|
95
95
|
modal: N.value.customProps?.modal,
|
|
@@ -87,7 +87,7 @@ function T(g, T, E) {
|
|
|
87
87
|
H.inputBind.value.onFocus?.(e), z(!0);
|
|
88
88
|
},
|
|
89
89
|
onKeydown: (e) => {
|
|
90
|
-
H.inputBind.value.onKeydown?.(e), e.key === "Escape" && z(!1);
|
|
90
|
+
H.inputBind.value.onKeydown?.(e), e.key === "Escape" && (A.value && e.preventDefault(), z(!1));
|
|
91
91
|
}
|
|
92
92
|
}, void 0, H.inputBind.value)), ne = l(() => N.value.overlay), re = l(() => ({
|
|
93
93
|
modal: N.value.customProps?.modal,
|
|
@@ -64,7 +64,7 @@ var g = /*@__PURE__*/ s({
|
|
|
64
64
|
}),
|
|
65
65
|
emits: /*@__PURE__*/ l(["close", "show-change"], ["update:modelValue"]),
|
|
66
66
|
setup(s, { expose: l, emit: g }) {
|
|
67
|
-
let _ = g, v = s, y = h(s, "modelValue"), { merged: b, mounted: x, rootBind: S, panelBind: C,
|
|
67
|
+
let _ = g, v = s, y = h(s, "modelValue"), { merged: b, mounted: x, rootBind: S, panelBind: C, setRootRef: w, overlayBind: T, wrapperBind: E, setPanelRef: D, layerStackId: O } = e(v, {
|
|
68
68
|
size: "md",
|
|
69
69
|
blur: "none",
|
|
70
70
|
scroll: "paper",
|
|
@@ -80,16 +80,16 @@ var g = /*@__PURE__*/ s({
|
|
|
80
80
|
onClose: () => _("close"),
|
|
81
81
|
onShowChange: (e) => _("show-change", e)
|
|
82
82
|
});
|
|
83
|
-
l({ stackId: n(() => v.stackId ??
|
|
84
|
-
let
|
|
83
|
+
l({ stackId: n(() => v.stackId ?? O.value) });
|
|
84
|
+
let k = n(() => b.value.teleportTo === !1), A = n(() => b.value.teleportTo === !1 ? "body" : b.value.teleportTo), j = n(() => v.hideBackdrop !== !0 && b.value.hideBackdrop !== !0);
|
|
85
85
|
return (e, n) => m(x) ? (f(), r(t, {
|
|
86
86
|
key: 0,
|
|
87
|
-
to:
|
|
88
|
-
disabled:
|
|
89
|
-
}, [o("div",
|
|
87
|
+
to: A.value,
|
|
88
|
+
disabled: k.value
|
|
89
|
+
}, [o("div", u({ ref: m(w) }, m(S)), [j.value ? (f(), a("div", u({
|
|
90
90
|
key: 0,
|
|
91
91
|
"aria-hidden": "true"
|
|
92
|
-
}, m(
|
|
92
|
+
}, m(T)), null, 16)) : i("", !0), o("div", d(c(m(E))), [o("div", u({ ref: m(D) }, m(C)), [p(e.$slots, "default")], 16)], 16)], 16)], 8, ["to", "disabled"])) : i("", !0);
|
|
93
93
|
}
|
|
94
94
|
});
|
|
95
95
|
export { g as default };
|
|
@@ -45,6 +45,7 @@ export declare function useDrawer(props: DrawerOwnProps, libDefaults: DrawerLibD
|
|
|
45
45
|
"aria-label": string | undefined;
|
|
46
46
|
"aria-labelledby": string | undefined;
|
|
47
47
|
}>>;
|
|
48
|
+
setRootRef: (element: null | Element | ComponentPublicInstance) => void;
|
|
48
49
|
overlayBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<{
|
|
49
50
|
"data-drawer-part": string;
|
|
50
51
|
"data-state": "open" | "closed";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { mergePartBind as e, resolveVnodeRefElement as t, useBridgeUIComponent as
|
|
2
|
-
import { computed as
|
|
3
|
-
import { get as
|
|
4
|
-
import { drawerBlurProps as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { createFocusTrap as
|
|
7
|
-
import { DRAWER_LEAVE_FALLBACK_MS as
|
|
1
|
+
import { mergePartBind as e, resolveVnodeRefElement as t, useBridgeUIComponent as ee, useBridgeUIMergedRegistryClasses as te } from "../../../Utils/index.js";
|
|
2
|
+
import { computed as n, nextTick as ne, onBeforeUnmount as re, ref as r, toValue as ie, useAttrs as ae, watch as i } from "vue";
|
|
3
|
+
import { get as a } from "es-toolkit/compat";
|
|
4
|
+
import { drawerBlurProps as oe, drawerPlacementPanelProps as se, drawerPlacementProps as ce, drawerSizeProps as o } from "@bridge-ui/core/Tokens";
|
|
5
|
+
import { cn as s, mergeBridgeUILayeredClasses as c, splitComponentProps as le } from "@bridge-ui/core/Utils";
|
|
6
|
+
import { createFocusTrap as l, isModalBackdropClick as ue, requestAfterNextPaint as de } from "@bridge-ui/core/Runtime";
|
|
7
|
+
import { DRAWER_LEAVE_FALLBACK_MS as fe, LAYER_STACK_BASE_Z_INDEX as u, acquireLayerStackOrder as pe, countDrawerTransitionLayers as d, getDrawerOverlayTransitionClass as f, getDrawerPanelTransitionClass as p, getLayerFocusTrapGuards as me, getLayerStackEntry as he, hasDrawerTransition as ge, pushLayerStack as _e, resolveEffectiveDrawerTransition as ve, subscribeLayerStack as ye } from "@bridge-ui/core/Layer";
|
|
8
8
|
// src/Components/Drawer/composables/useDrawer.ts
|
|
9
9
|
var be = [
|
|
10
10
|
"blur",
|
|
@@ -28,162 +28,168 @@ var be = [
|
|
|
28
28
|
"disableEnforceFocus",
|
|
29
29
|
"disableRestoreFocus"
|
|
30
30
|
];
|
|
31
|
-
function m(m,
|
|
32
|
-
let
|
|
31
|
+
function m(m, xe, h = {}) {
|
|
32
|
+
let Se = ae(), g = r(!1), _ = r(!1), v = r(""), y = r(u), b = r("closed"), x = r(null), S = r(null), C = !1, w = 0, T = null, E = null, D = null, O = null, k = null, A = null, j = n(() => ie(h.show ?? !1));
|
|
33
33
|
function M(e) {
|
|
34
|
-
e ||
|
|
34
|
+
e || h.onClose?.(), h.show && (h.show.value = e), h.onShowChange?.(e);
|
|
35
35
|
}
|
|
36
|
-
let N =
|
|
36
|
+
let N = n(() => le({
|
|
37
37
|
bridgeKeys: be,
|
|
38
38
|
props: {
|
|
39
|
-
...
|
|
39
|
+
...Se,
|
|
40
40
|
...m
|
|
41
41
|
}
|
|
42
|
-
})), { merged: P, entry: F } =
|
|
43
|
-
libDefaults:
|
|
42
|
+
})), { merged: P, entry: F } = ee({
|
|
43
|
+
libDefaults: xe,
|
|
44
44
|
componentName: "Drawer",
|
|
45
45
|
props: () => N.value.componentProps
|
|
46
|
-
}), I =
|
|
46
|
+
}), I = n(() => P.value.customProps), L = te({
|
|
47
47
|
entry: F,
|
|
48
48
|
props: () => N.value.componentProps
|
|
49
|
-
}), R =
|
|
50
|
-
let e =
|
|
51
|
-
return
|
|
52
|
-
}),
|
|
53
|
-
let e =
|
|
54
|
-
return
|
|
55
|
-
}),
|
|
56
|
-
let e =
|
|
57
|
-
return
|
|
58
|
-
}),
|
|
59
|
-
onTransitionend:
|
|
60
|
-
style: { zIndex:
|
|
49
|
+
}), R = n(() => ve(P.value.transition ?? "none")), z = n(() => ge(R.value)), B = n(() => P.value.scroll ?? "paper"), V = n(() => P.value.keepMounted && !g.value), H = n(() => P.value.placement ?? "left"), Ce = n(() => H.value === "left" || H.value === "right" ? "horizontal" : "vertical"), we = n(() => {
|
|
50
|
+
let e = c(ce, F.value?.tokens?.placement);
|
|
51
|
+
return a(e, H.value);
|
|
52
|
+
}), Te = n(() => a(se, H.value)), Ee = n(() => {
|
|
53
|
+
let e = c(oe, F.value?.tokens?.blur);
|
|
54
|
+
return a(e, P.value.blur);
|
|
55
|
+
}), De = n(() => {
|
|
56
|
+
let e = c(o, F.value?.tokens?.size);
|
|
57
|
+
return a(e, [P.value.size, Ce.value]);
|
|
58
|
+
}), Oe = n(() => f(R.value)), ke = n(() => p(R.value, H.value)), U = n(() => !P.value.persistent), Ae = n(() => N.value.inheritedAttrs), je = n(() => e(I.value?.root, Ae.value, {
|
|
59
|
+
onTransitionend: Re,
|
|
60
|
+
style: { zIndex: y.value },
|
|
61
61
|
"aria-hidden": V.value ? !0 : void 0,
|
|
62
|
-
class:
|
|
62
|
+
class: s({
|
|
63
63
|
"fixed inset-0": !0,
|
|
64
64
|
"overflow-y-auto": B.value === "body",
|
|
65
65
|
"overflow-hidden": B.value === "paper",
|
|
66
66
|
"invisible pointer-events-none": V.value,
|
|
67
|
-
[
|
|
67
|
+
[a(L.value, "root") ?? ""]: !0
|
|
68
68
|
})
|
|
69
|
-
})),
|
|
69
|
+
})), Me = n(() => e(I.value?.overlay, { onClick: Z }, {
|
|
70
70
|
"data-drawer-part": "overlay",
|
|
71
|
-
"data-state":
|
|
72
|
-
class:
|
|
71
|
+
"data-state": b.value,
|
|
72
|
+
class: s({
|
|
73
73
|
"fixed inset-0 bg-black/50": !0,
|
|
74
|
-
[
|
|
75
|
-
[
|
|
76
|
-
[
|
|
74
|
+
[Ee.value ?? ""]: !0,
|
|
75
|
+
[Oe.value]: z.value,
|
|
76
|
+
[a(L.value, "overlay") ?? ""]: !0
|
|
77
77
|
})
|
|
78
|
-
})),
|
|
78
|
+
})), Ne = n(() => e(I.value?.wrapper, { onClick: Q }, s({
|
|
79
79
|
"flex min-h-full w-full transform": !0,
|
|
80
|
-
[
|
|
81
|
-
[
|
|
82
|
-
}))),
|
|
80
|
+
[we.value ?? ""]: !0,
|
|
81
|
+
[a(L.value, "wrapper") ?? ""]: !0
|
|
82
|
+
}))), Pe = n(() => e(I.value?.panel, {
|
|
83
83
|
role: "dialog",
|
|
84
84
|
"aria-modal": !0,
|
|
85
85
|
"aria-label": P.value.ariaLabel,
|
|
86
86
|
"aria-labelledby": P.value.ariaLabelledBy
|
|
87
87
|
}, {
|
|
88
88
|
"data-drawer-part": "panel",
|
|
89
|
-
"data-state":
|
|
90
|
-
class:
|
|
89
|
+
"data-state": b.value,
|
|
90
|
+
class: s({
|
|
91
91
|
"relative rounded-none": !0,
|
|
92
|
-
[
|
|
93
|
-
[
|
|
92
|
+
[Te.value ?? ""]: !0,
|
|
93
|
+
[De.value ?? ""]: !0,
|
|
94
94
|
"overflow-y-auto bridge-scroll-fade-y bridge-hide-scrollbar": B.value === "paper",
|
|
95
|
-
[
|
|
96
|
-
[
|
|
95
|
+
[ke.value]: z.value,
|
|
96
|
+
[a(L.value, "panel") ?? ""]: !0
|
|
97
97
|
})
|
|
98
98
|
}));
|
|
99
99
|
function W() {
|
|
100
|
-
|
|
100
|
+
E?.release(), E = null;
|
|
101
101
|
}
|
|
102
102
|
function G() {
|
|
103
|
-
!
|
|
104
|
-
container:
|
|
103
|
+
!g.value || b.value !== "open" || !S.value ? W() : (D?.setContainer(x.value), W(), E = l({
|
|
104
|
+
container: S.value,
|
|
105
105
|
disableAutoFocus: !P.value.autoFocus,
|
|
106
106
|
disableEnforceFocus: P.value.disableEnforceFocus,
|
|
107
107
|
disableRestoreFocus: P.value.disableRestoreFocus,
|
|
108
|
-
...me(() =>
|
|
108
|
+
...me(() => v.value)
|
|
109
109
|
}));
|
|
110
110
|
}
|
|
111
|
-
function
|
|
112
|
-
|
|
111
|
+
function Fe(e) {
|
|
112
|
+
x.value = t(e), D?.setContainer(x.value);
|
|
113
|
+
}
|
|
114
|
+
function Ie(e) {
|
|
115
|
+
S.value = t(e), G();
|
|
113
116
|
}
|
|
114
117
|
function K() {
|
|
115
118
|
A !== null && (clearTimeout(A), A = null);
|
|
116
119
|
}
|
|
117
120
|
function q() {
|
|
118
|
-
|
|
121
|
+
O?.(), O = null;
|
|
119
122
|
}
|
|
120
123
|
function J() {
|
|
121
|
-
|
|
124
|
+
C && (C = !1, K(), w = 0, g.value = !1, W(), j.value ? M(!1) : h.onShowChange?.(!1), b.value = "closed", P.value.keepMounted || (_.value = !1));
|
|
122
125
|
}
|
|
123
126
|
function Y() {
|
|
124
|
-
q(),
|
|
125
|
-
A = null,
|
|
126
|
-
},
|
|
127
|
+
q(), D?.releaseScrollLock(), C = !0, z.value ? (b.value = "closed", w = d(R.value, { hideBackdrop: P.value.hideBackdrop }), w === 0 ? J() : (K(), A = setTimeout(() => {
|
|
128
|
+
A = null, w > 0 && J();
|
|
129
|
+
}, fe))) : J();
|
|
127
130
|
}
|
|
128
|
-
function
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
})) :
|
|
131
|
+
function Le() {
|
|
132
|
+
D?.restoreScrollLock(), C = !1, K(), w = 0, z.value ? (b.value = "closed", q(), O = de(() => {
|
|
133
|
+
b.value = "open";
|
|
134
|
+
})) : b.value = "open";
|
|
132
135
|
}
|
|
133
|
-
function
|
|
134
|
-
if (!
|
|
136
|
+
function Re(e) {
|
|
137
|
+
if (!C || !_.value || b.value !== "closed") return;
|
|
135
138
|
let t = e.target;
|
|
136
|
-
(t?.dataset.drawerPart === "overlay" || t?.dataset.drawerPart === "panel") && e.propertyName !== "none" && e.elapsedTime !== 0 && (--
|
|
139
|
+
(t?.dataset.drawerPart === "overlay" || t?.dataset.drawerPart === "panel") && e.propertyName !== "none" && e.elapsedTime !== 0 && (--w, w <= 0 && J());
|
|
137
140
|
}
|
|
138
141
|
function X() {
|
|
139
|
-
U.value && (z.value ?
|
|
142
|
+
U.value && (z.value ? _.value && Y() : M(!1));
|
|
140
143
|
}
|
|
141
144
|
function Z() {
|
|
142
145
|
P.value.closeOnOverlay !== !1 && U.value && X();
|
|
143
146
|
}
|
|
144
147
|
function Q(e) {
|
|
145
|
-
|
|
148
|
+
ue(e) && Z();
|
|
146
149
|
}
|
|
147
|
-
function
|
|
150
|
+
function ze() {
|
|
148
151
|
j.value && P.value.closeOnEscape !== !1 && U.value && X();
|
|
149
152
|
}
|
|
150
|
-
|
|
151
|
-
e ? (
|
|
152
|
-
}, { immediate: !0 }),
|
|
153
|
-
|
|
154
|
-
|
|
153
|
+
i(j, (e) => {
|
|
154
|
+
e ? (_.value = !0, g.value = !0, Le()) : _.value && Y();
|
|
155
|
+
}, { immediate: !0 }), i([
|
|
156
|
+
g,
|
|
157
|
+
b,
|
|
155
158
|
() => P.value.autoFocus,
|
|
156
159
|
() => P.value.disableEnforceFocus,
|
|
157
160
|
() => P.value.disableRestoreFocus
|
|
158
161
|
], () => {
|
|
159
|
-
|
|
162
|
+
ne(() => {
|
|
160
163
|
G();
|
|
161
164
|
});
|
|
162
165
|
});
|
|
163
166
|
function $() {
|
|
164
|
-
let e = he(
|
|
165
|
-
e && (
|
|
167
|
+
let e = he(v.value);
|
|
168
|
+
e && (y.value = e.zIndex);
|
|
166
169
|
}
|
|
167
|
-
return
|
|
168
|
-
e ? (
|
|
170
|
+
return i(g, (e) => {
|
|
171
|
+
e ? (T === null && (T = pe()), D = _e({
|
|
169
172
|
trapsFocus: !0,
|
|
170
|
-
order:
|
|
171
|
-
id:
|
|
172
|
-
onEscape:
|
|
173
|
-
container:
|
|
173
|
+
order: T,
|
|
174
|
+
id: h.stackId,
|
|
175
|
+
onEscape: ze,
|
|
176
|
+
container: x.value ?? void 0,
|
|
174
177
|
lockScroll: P.value.disableScrollLock !== !0
|
|
175
|
-
}),
|
|
176
|
-
}, { immediate: !0 }),
|
|
177
|
-
|
|
178
|
+
}), v.value = D.id, y.value = D.zIndex, $(), k = ye($)) : (k?.(), k = null, D?.release(), D = null, v.value = "", y.value = u, _.value || (T = null));
|
|
179
|
+
}, { immediate: !0 }), i(() => P.value.disableScrollLock, (e) => {
|
|
180
|
+
D?.setLockScroll(e !== !0);
|
|
181
|
+
}), re(() => {
|
|
182
|
+
K(), q(), k?.(), k = null, W(), D?.release(), D = null, T = null;
|
|
178
183
|
}), {
|
|
179
184
|
merged: P,
|
|
180
|
-
mounted:
|
|
181
|
-
rootBind:
|
|
182
|
-
panelBind:
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
185
|
+
mounted: _,
|
|
186
|
+
rootBind: je,
|
|
187
|
+
panelBind: Pe,
|
|
188
|
+
setRootRef: Fe,
|
|
189
|
+
overlayBind: Me,
|
|
190
|
+
wrapperBind: Ne,
|
|
191
|
+
setPanelRef: Ie,
|
|
192
|
+
layerStackId: v,
|
|
187
193
|
handleOverlayClick: Z,
|
|
188
194
|
handleWrapperClick: Q
|
|
189
195
|
};
|