@bridge-ui/vue 0.22.0 → 0.23.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/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/Chip/Chip.vue.d.ts +0 -1
- package/dist/Components/Chip/Chip.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/Components/EmptyState/EmptyState.vue.d.ts +0 -3
- package/dist/Components/EmptyState/EmptyState.vue_vue_type_script_setup_true_lang.js +4 -4
- 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/package.json +2 -2
|
@@ -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';
|
|
@@ -5,7 +5,6 @@ declare const __VLS_base: import('vue').DefineComponent<ChipOwnProps, {}, {}, {}
|
|
|
5
5
|
}, string, import('vue').PublicProps, Readonly<ChipOwnProps> & Readonly<{
|
|
6
6
|
onDismiss?: ((event: MouseEvent | KeyboardEvent) => any) | undefined;
|
|
7
7
|
}>, {
|
|
8
|
-
size: import('@bridge-ui/core/Utils').MergeProps<import('@bridge-ui/core/Tokens').ChipSize, import('./chip.types').ChipSizeOverrides>;
|
|
9
8
|
disabled: boolean;
|
|
10
9
|
clearLabel: string;
|
|
11
10
|
dismissible: boolean;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { EmptyStateOwnProps, EmptyStateSlots } from './emptyState.types';
|
|
2
2
|
type __VLS_Slots = EmptyStateSlots;
|
|
3
3
|
declare const __VLS_base: import('vue').DefineComponent<EmptyStateOwnProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<EmptyStateOwnProps> & Readonly<{}>, {
|
|
4
|
-
size: import('@bridge-ui/core/Utils').MergeProps<import('@bridge-ui/core/Tokens').EmptyStateSize, import('./emptyState.types').EmptyStateSizeOverrides>;
|
|
5
|
-
align: import('@bridge-ui/core/Utils').MergeProps<import('@bridge-ui/core/Tokens').EmptyStateAlign, import('./emptyState.types').EmptyStateAlignOverrides>;
|
|
6
4
|
mediaDecorative: boolean;
|
|
7
|
-
titleAs: "p" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "div";
|
|
8
5
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
9
6
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
10
7
|
declare const _default: typeof __VLS_export;
|
|
@@ -7,18 +7,18 @@ var x = /*@__PURE__*/ d({
|
|
|
7
7
|
inheritAttrs: !1,
|
|
8
8
|
__name: "EmptyState",
|
|
9
9
|
props: {
|
|
10
|
-
align: {
|
|
10
|
+
align: {},
|
|
11
11
|
classes: {},
|
|
12
12
|
customProps: {},
|
|
13
13
|
description: {},
|
|
14
14
|
icon: {},
|
|
15
15
|
mediaDecorative: {
|
|
16
16
|
type: Boolean,
|
|
17
|
-
default:
|
|
17
|
+
default: void 0
|
|
18
18
|
},
|
|
19
|
-
size: {
|
|
19
|
+
size: {},
|
|
20
20
|
title: {},
|
|
21
|
-
titleAs: {
|
|
21
|
+
titleAs: {}
|
|
22
22
|
},
|
|
23
23
|
setup(d) {
|
|
24
24
|
let { slots: x, merged: S, iconBind: C, rootBind: w, titleBind: T, mediaBind: E, actionsBind: D, descriptionBind: O } = i(d, {
|
|
@@ -5,7 +5,7 @@ import { useSnackbar as r } from "./composables/useSnackbar.js";
|
|
|
5
5
|
import { Teleport as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, defineComponent as f, guardReactiveProps as p, mergeModels as m, mergeProps as h, normalizeClass as g, normalizeProps as _, openBlock as v, renderSlot as y, toDisplayString as b, unref as x, useModel as S, useSlots as ee, withCtx as C } from "vue";
|
|
6
6
|
import { cn as w } from "@bridge-ui/core/Utils";
|
|
7
7
|
// src/Components/Snackbar/Snackbar.vue?vue&type=script&setup=true&lang.ts
|
|
8
|
-
var T = { class: "w-full max-w-sm pointer-events-auto" }, E = ["src"], D = { class: "flex ml-4 shrink-0" }, O = ["aria-label"], k = ["src"], A = { class: "flex ml-4 shrink-0" }, j = ["aria-label"], M = /*@__PURE__*/ f({
|
|
8
|
+
var T = { class: "w-full max-w-sm pointer-events-auto" }, E = ["src"], D = { class: "flex items-center ml-4 shrink-0" }, O = ["aria-label"], k = ["src"], A = { class: "flex items-center ml-4 shrink-0" }, j = ["aria-label"], M = /*@__PURE__*/ f({
|
|
9
9
|
inheritAttrs: !1,
|
|
10
10
|
__name: "Snackbar",
|
|
11
11
|
props: /*@__PURE__*/ m({
|
|
@@ -72,14 +72,15 @@ var T = { class: "w-full max-w-sm pointer-events-auto" }, E = ["src"], D = { cla
|
|
|
72
72
|
to: ne.value
|
|
73
73
|
}, [l("div", _(p(x(te))), [l("div", T, [l("div", h({ ref: x(W) }, x(B), { class: x(w)(x(B).class, { flex: $.value }) }), [
|
|
74
74
|
l("div", _(p(x(U)($.value))), [l("div", { class: g({
|
|
75
|
-
"flex
|
|
76
|
-
"
|
|
75
|
+
"w-full flex": $.value,
|
|
76
|
+
"flex items-start": !$.value && !x(M).trailing,
|
|
77
|
+
"flex items-center": !$.value && !!x(M).trailing
|
|
77
78
|
}) }, [
|
|
78
79
|
X.value ? (v(), c("div", {
|
|
79
80
|
key: 0,
|
|
80
81
|
class: g(["shrink-0", {
|
|
81
|
-
"
|
|
82
|
-
"
|
|
82
|
+
"pt-0.5": !!x(L).img,
|
|
83
|
+
"w-6": !!x(M).icon || !x(L).img && !!x(q)
|
|
83
84
|
}])
|
|
84
85
|
}, [
|
|
85
86
|
y(e.$slots, "icon"),
|
|
@@ -87,7 +88,7 @@ var T = { class: "w-full max-w-sm pointer-events-auto" }, E = ["src"], D = { cla
|
|
|
87
88
|
key: 0,
|
|
88
89
|
alt: "",
|
|
89
90
|
src: x(L).img,
|
|
90
|
-
class: "w-10 h-10 rounded-full"
|
|
91
|
+
class: "w-10 h-10 rounded-full object-cover"
|
|
91
92
|
}, null, 8, E)) : s("", !0),
|
|
92
93
|
!x(M).icon && !x(L).img && x(q) ? (v(), o(x(t), h({ key: 1 }, x(z), { icon: x(q) }), null, 16, ["icon"])) : s("", !0)
|
|
93
94
|
], 2)) : s("", !0),
|
|
@@ -106,11 +107,7 @@ var T = { class: "w-full max-w-sm pointer-events-auto" }, E = ["src"], D = { cla
|
|
|
106
107
|
default: C(() => [y(e.$slots, "description", {}, () => [u(b(x(L).description), 1)])]),
|
|
107
108
|
_: 3
|
|
108
109
|
}, 16)) : s("", !0),
|
|
109
|
-
y(e.$slots, "default")
|
|
110
|
-
x(M).actions ? (v(), c("div", {
|
|
111
|
-
key: 2,
|
|
112
|
-
class: g(["flex mt-3 gap-x-3", x(L).classes?.actions])
|
|
113
|
-
}, [y(e.$slots, "actions")], 2)) : s("", !0)
|
|
110
|
+
y(e.$slots, "default")
|
|
114
111
|
], 2),
|
|
115
112
|
l("div", D, [y(e.$slots, "trailing"), x(L).closeButton === !1 ? s("", !0) : (v(), c("button", {
|
|
116
113
|
key: 0,
|
|
@@ -122,7 +119,10 @@ var T = { class: "w-full max-w-sm pointer-events-auto" }, E = ["src"], D = { cla
|
|
|
122
119
|
size: "lg",
|
|
123
120
|
icon: "clear"
|
|
124
121
|
})], 8, O))])
|
|
125
|
-
], 2)
|
|
122
|
+
], 2), x(M).actions ? (v(), c("div", {
|
|
123
|
+
key: 0,
|
|
124
|
+
class: g(["flex mt-3 gap-x-3", x(L).classes?.actions])
|
|
125
|
+
}, [y(e.$slots, "actions")], 2)) : s("", !0)], 16),
|
|
126
126
|
y(e.$slots, "right"),
|
|
127
127
|
x(G) ? (v(), c("div", _(h({ key: 0 }, x(K))), null, 16)) : s("", !0)
|
|
128
128
|
], 16)])], 16)], 8, ["to"])) : x(R) ? (v(), c("div", h({
|
|
@@ -130,14 +130,15 @@ var T = { class: "w-full max-w-sm pointer-events-auto" }, E = ["src"], D = { cla
|
|
|
130
130
|
ref: x(W)
|
|
131
131
|
}, x(B), { class: x(w)(x(B).class, { flex: $.value }) }), [
|
|
132
132
|
l("div", _(p(x(U)($.value))), [l("div", { class: g({
|
|
133
|
-
"flex
|
|
134
|
-
"
|
|
133
|
+
"w-full flex": $.value,
|
|
134
|
+
"flex items-start": !$.value && !x(M).trailing,
|
|
135
|
+
"flex items-center": !$.value && !!x(M).trailing
|
|
135
136
|
}) }, [
|
|
136
137
|
X.value ? (v(), c("div", {
|
|
137
138
|
key: 0,
|
|
138
139
|
class: g(["shrink-0", {
|
|
139
|
-
"
|
|
140
|
-
"
|
|
140
|
+
"pt-0.5": !!x(L).img,
|
|
141
|
+
"w-6": !!x(M).icon || !x(L).img && !!x(q)
|
|
141
142
|
}])
|
|
142
143
|
}, [
|
|
143
144
|
y(e.$slots, "icon"),
|
|
@@ -145,7 +146,7 @@ var T = { class: "w-full max-w-sm pointer-events-auto" }, E = ["src"], D = { cla
|
|
|
145
146
|
key: 0,
|
|
146
147
|
alt: "",
|
|
147
148
|
src: x(L).img,
|
|
148
|
-
class: "w-10 h-10 rounded-full"
|
|
149
|
+
class: "w-10 h-10 rounded-full object-cover"
|
|
149
150
|
}, null, 8, k)) : s("", !0),
|
|
150
151
|
!x(M).icon && !x(L).img && x(q) ? (v(), o(x(t), h({ key: 1 }, x(z), { icon: x(q) }), null, 16, ["icon"])) : s("", !0)
|
|
151
152
|
], 2)) : s("", !0),
|
|
@@ -164,11 +165,7 @@ var T = { class: "w-full max-w-sm pointer-events-auto" }, E = ["src"], D = { cla
|
|
|
164
165
|
default: C(() => [y(e.$slots, "description", {}, () => [u(b(x(L).description), 1)])]),
|
|
165
166
|
_: 3
|
|
166
167
|
}, 16)) : s("", !0),
|
|
167
|
-
y(e.$slots, "default")
|
|
168
|
-
x(M).actions ? (v(), c("div", {
|
|
169
|
-
key: 2,
|
|
170
|
-
class: g(["flex mt-3 gap-x-3", x(L).classes?.actions])
|
|
171
|
-
}, [y(e.$slots, "actions")], 2)) : s("", !0)
|
|
168
|
+
y(e.$slots, "default")
|
|
172
169
|
], 2),
|
|
173
170
|
l("div", A, [y(e.$slots, "trailing"), x(L).closeButton === !1 ? s("", !0) : (v(), c("button", {
|
|
174
171
|
key: 0,
|
|
@@ -180,7 +177,10 @@ var T = { class: "w-full max-w-sm pointer-events-auto" }, E = ["src"], D = { cla
|
|
|
180
177
|
size: "lg",
|
|
181
178
|
icon: "clear"
|
|
182
179
|
})], 8, j))])
|
|
183
|
-
], 2)
|
|
180
|
+
], 2), x(M).actions ? (v(), c("div", {
|
|
181
|
+
key: 0,
|
|
182
|
+
class: g(["flex mt-3 gap-x-3", x(L).classes?.actions])
|
|
183
|
+
}, [y(e.$slots, "actions")], 2)) : s("", !0)], 16),
|
|
184
184
|
y(e.$slots, "right"),
|
|
185
185
|
x(G) ? (v(), c("div", _(h({ key: 0 }, x(K))), null, 16)) : s("", !0)
|
|
186
186
|
], 16)) : s("", !0);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { mergePartBind as e, resolveVnodeRefElement as t, useBridgeUIComponent as n, useBridgeUIMergedRegistryClasses as ee } from "../../../Utils/index.js";
|
|
2
2
|
import { snackbarDefaultIcons as te } from "../snackbarDefaultIcons.js";
|
|
3
|
-
import { computed as r, nextTick as ne, onBeforeUnmount as
|
|
4
|
-
import { get as
|
|
5
|
-
import { snackbarColorProps as
|
|
6
|
-
import { cn as
|
|
7
|
-
import { requestAfterNextPaint as
|
|
8
|
-
import { LAYER_STACK_BASE_Z_INDEX as
|
|
3
|
+
import { computed as r, nextTick as ne, onBeforeUnmount as i, ref as a, toValue as re, useAttrs as ie, watch as o } from "vue";
|
|
4
|
+
import { get as s, isNil as ae, isNull as oe, isObject as se, omit as ce } from "es-toolkit/compat";
|
|
5
|
+
import { snackbarColorProps as le, snackbarPaddingProps as ue, snackbarPositionProps as de, snackbarRoundedProps as fe, snackbarTransitionProps as pe } from "@bridge-ui/core/Tokens";
|
|
6
|
+
import { cn as c, mergeBridgeUILayeredClasses as l, splitComponentProps as me } from "@bridge-ui/core/Utils";
|
|
7
|
+
import { requestAfterNextPaint as u } from "@bridge-ui/core/Runtime";
|
|
8
|
+
import { LAYER_STACK_BASE_Z_INDEX as d, SNACKBAR_LEAVE_FALLBACK_MS as he, acquireLayerStackOrder as ge, getLayerStackEntry as _e, getSnackbarTransitionClass as ve, hasSnackbarTransition as ye, pushLayerStack as be, resolveEffectiveSnackbarTransition as xe, subscribeLayerStack as f } from "@bridge-ui/core/Layer";
|
|
9
9
|
// src/Components/Snackbar/composables/useSnackbar.ts
|
|
10
|
-
var
|
|
10
|
+
var Se = [
|
|
11
11
|
"img",
|
|
12
12
|
"icon",
|
|
13
13
|
"color",
|
|
@@ -25,175 +25,175 @@ var Ce = [
|
|
|
25
25
|
"description",
|
|
26
26
|
"progressbar"
|
|
27
27
|
];
|
|
28
|
-
function
|
|
29
|
-
let
|
|
28
|
+
function p(p, Ce, m = {}) {
|
|
29
|
+
let we = ie(), h = a(!1), g = a(""), _ = a(1), v = a(0), y = a(!1), b = a(!1), x = a(0), S = a(!1), C = null, w = a(0), T = a(null), E = null, D = null, O = a(d), k = null, A = a("closed"), j = a(null), M = null, N = r(() => me({
|
|
30
30
|
props: {
|
|
31
|
-
...
|
|
32
|
-
...
|
|
31
|
+
...we,
|
|
32
|
+
...p
|
|
33
33
|
},
|
|
34
|
-
bridgeKeys:
|
|
35
|
-
})), { merged:
|
|
36
|
-
libDefaults:
|
|
34
|
+
bridgeKeys: Se
|
|
35
|
+
})), { merged: P, entry: F } = n({
|
|
36
|
+
libDefaults: Ce,
|
|
37
37
|
componentName: "Snackbar",
|
|
38
|
-
props: () =>
|
|
39
|
-
}),
|
|
40
|
-
entry:
|
|
41
|
-
props: () =>
|
|
42
|
-
}),
|
|
43
|
-
let e =
|
|
44
|
-
return
|
|
45
|
-
}),
|
|
46
|
-
let e =
|
|
47
|
-
return
|
|
48
|
-
}),
|
|
49
|
-
let e =
|
|
50
|
-
return
|
|
38
|
+
props: () => N.value.componentProps
|
|
39
|
+
}), I = r(() => P.value.customProps), L = r(() => ce(N.value.inheritedAttrs, ["onShowChange"])), R = ee({
|
|
40
|
+
entry: F,
|
|
41
|
+
props: () => N.value.componentProps
|
|
42
|
+
}), z = r(() => !ae(m.show) && re(m.show)), B = r(() => {
|
|
43
|
+
let e = P.value.transition ?? "none", t = e in pe ? e : "none";
|
|
44
|
+
return xe(t);
|
|
45
|
+
}), V = r(() => ye(B.value)), Te = r(() => ve(B.value)), H = r(() => {
|
|
46
|
+
let e = l(le, F.value?.tokens?.color);
|
|
47
|
+
return s(e, P.value.color);
|
|
48
|
+
}), Ee = r(() => {
|
|
49
|
+
let e = l(ue, F.value?.tokens?.padding);
|
|
50
|
+
return s(e, P.value.padding);
|
|
51
51
|
}), De = r(() => {
|
|
52
|
-
let e =
|
|
53
|
-
return
|
|
54
|
-
}), Oe = r(() =>
|
|
52
|
+
let e = l(fe, F.value?.tokens?.rounded);
|
|
53
|
+
return s(e, P.value.rounded);
|
|
54
|
+
}), Oe = r(() => oe(P.value.icon) ? null : P.value.icon ? P.value.icon : s(H.value, "icon") ?? s(te, P.value.color)), U = r(() => P.value.duration === !1 ? 0 : P.value.duration ?? 0), W = r(() => z.value && h.value && U.value > 0 && P.value.progressbar !== !1), G = r(() => P.value.teleportTo !== !1), ke = r(() => {
|
|
55
55
|
if (!G.value) return "";
|
|
56
|
-
let e =
|
|
57
|
-
return
|
|
56
|
+
let e = l(de, F.value?.tokens?.position);
|
|
57
|
+
return s(e, P.value.position ?? "bottom-center");
|
|
58
58
|
});
|
|
59
59
|
function K() {
|
|
60
|
-
|
|
60
|
+
j.value &&= (clearTimeout(j.value), null);
|
|
61
61
|
}
|
|
62
62
|
function q() {
|
|
63
|
-
|
|
63
|
+
M !== null && (clearTimeout(M), M = null);
|
|
64
64
|
}
|
|
65
65
|
function J() {
|
|
66
|
-
|
|
66
|
+
D?.(), D = null;
|
|
67
67
|
}
|
|
68
68
|
function Y(e) {
|
|
69
|
-
e ||
|
|
69
|
+
e || m.onClose?.(), se(m.show) && "value" in m.show && (m.show.value = e), m.onShowChange?.(e);
|
|
70
70
|
}
|
|
71
71
|
function X() {
|
|
72
|
-
|
|
72
|
+
b.value && (b.value = !1, A.value = "closed", K(), q(), z.value ? Y(!1) : m.onLeaveComplete?.(), h.value = !1);
|
|
73
73
|
}
|
|
74
74
|
function Ae() {
|
|
75
|
-
J(), K(),
|
|
76
|
-
|
|
77
|
-
},
|
|
75
|
+
J(), K(), b.value = !0, V.value ? (A.value = "closed", q(), M = setTimeout(() => {
|
|
76
|
+
M = null, X();
|
|
77
|
+
}, he)) : X();
|
|
78
78
|
}
|
|
79
79
|
function je() {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
})) :
|
|
80
|
+
b.value = !1, q(), V.value ? (A.value = "closed", J(), D = u(() => {
|
|
81
|
+
A.value = "open";
|
|
82
|
+
})) : A.value = "open";
|
|
83
83
|
}
|
|
84
84
|
function Z() {
|
|
85
|
-
|
|
85
|
+
z.value && Y(!1);
|
|
86
86
|
}
|
|
87
87
|
function Q(e) {
|
|
88
|
-
K(),
|
|
88
|
+
K(), v.value = e, x.value = Date.now(), w.value = e, j.value = setTimeout(() => {
|
|
89
89
|
Z();
|
|
90
90
|
}, e);
|
|
91
91
|
}
|
|
92
92
|
function Me() {
|
|
93
|
-
!
|
|
93
|
+
!j.value || U.value <= 0 || (K(), v.value -= Date.now() - x.value, _.value = Math.max(v.value / U.value, 0), S.value = !1, y.value = !0);
|
|
94
94
|
}
|
|
95
95
|
function Ne() {
|
|
96
|
-
if (U.value <= 0 || !
|
|
97
|
-
let e = Math.max(
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
if (U.value <= 0 || !y.value) return;
|
|
97
|
+
let e = Math.max(v.value, 0);
|
|
98
|
+
y.value = !1, S.value = !1, requestAnimationFrame(() => {
|
|
99
|
+
S.value = !0;
|
|
100
100
|
}), Q(e);
|
|
101
101
|
}
|
|
102
102
|
function Pe(e) {
|
|
103
|
-
|
|
103
|
+
b.value && h.value && A.value === "closed" && e.target === e.currentTarget && e.propertyName !== "none" && e.elapsedTime !== 0 && X();
|
|
104
104
|
}
|
|
105
|
-
|
|
106
|
-
e ? (
|
|
107
|
-
}, { immediate: !0 }),
|
|
108
|
-
|
|
109
|
-
|
|
105
|
+
o(z, (e) => {
|
|
106
|
+
e ? (h.value = !0, je()) : h.value && Ae();
|
|
107
|
+
}, { immediate: !0 }), o([
|
|
108
|
+
z,
|
|
109
|
+
h,
|
|
110
110
|
U
|
|
111
111
|
], ([e, t, n]) => {
|
|
112
|
-
!e || !t || n <= 0 ? K() : (
|
|
113
|
-
}, { immediate: !0 }),
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
!e || !t || n <= 0 ? K() : (y.value = !1, Q(n));
|
|
113
|
+
}, { immediate: !0 }), o([U, W], ([, e], t, n) => {
|
|
114
|
+
S.value = !1, _.value = 1, e && n(u(() => {
|
|
115
|
+
S.value = !0;
|
|
116
116
|
}));
|
|
117
117
|
}, { immediate: !0 });
|
|
118
118
|
function $() {
|
|
119
|
-
let e =
|
|
120
|
-
e && (
|
|
119
|
+
let e = _e(g.value);
|
|
120
|
+
e && (O.value = e.zIndex);
|
|
121
121
|
}
|
|
122
122
|
function Fe(e) {
|
|
123
|
-
|
|
123
|
+
T.value = t(e), E?.setContainer(T.value);
|
|
124
124
|
}
|
|
125
|
-
|
|
126
|
-
t && (e ? (
|
|
127
|
-
order:
|
|
125
|
+
o([h, G], ([e, t]) => {
|
|
126
|
+
t && (e ? (C = ge(), E = be({
|
|
127
|
+
order: C,
|
|
128
128
|
lockScroll: !1,
|
|
129
|
-
id:
|
|
130
|
-
container:
|
|
129
|
+
id: m.stackId,
|
|
130
|
+
container: T.value ?? void 0,
|
|
131
131
|
onEscape: () => {
|
|
132
132
|
Z();
|
|
133
133
|
}
|
|
134
|
-
}),
|
|
135
|
-
|
|
136
|
-
})) : (
|
|
137
|
-
}, { immediate: !0 }),
|
|
138
|
-
K(), q(), J(),
|
|
134
|
+
}), g.value = E.id, O.value = E.zIndex, $(), k = f($), ne(() => {
|
|
135
|
+
E?.setContainer(T.value);
|
|
136
|
+
})) : (k?.(), k = null, E?.release(), E = null, C = null, g.value = "", O.value = d));
|
|
137
|
+
}, { immediate: !0 }), i(() => {
|
|
138
|
+
K(), q(), J(), k?.(), k = null, E?.release(), E = null;
|
|
139
139
|
});
|
|
140
|
-
let Ie = r(() => e(
|
|
140
|
+
let Ie = r(() => e(I.value?.portal, {
|
|
141
141
|
"data-snackbar-layer": !0,
|
|
142
|
-
style: { zIndex:
|
|
143
|
-
},
|
|
142
|
+
style: { zIndex: O.value }
|
|
143
|
+
}, c({
|
|
144
144
|
"fixed inset-0 flex pointer-events-none px-4 py-6 sm:p-5 sm:pt-4": !0,
|
|
145
145
|
[ke.value ?? ""]: !0,
|
|
146
|
-
[
|
|
147
|
-
}))), Le = r(() => e(
|
|
148
|
-
...
|
|
146
|
+
[s(R.value, "portal") ?? ""]: !0
|
|
147
|
+
}))), Le = r(() => e(I.value?.root, {
|
|
148
|
+
...L.value,
|
|
149
149
|
"data-snackbar-part": "panel",
|
|
150
150
|
onMouseenter: Me,
|
|
151
151
|
onMouseleave: Ne,
|
|
152
|
-
"data-state":
|
|
152
|
+
"data-state": A.value,
|
|
153
153
|
onTransitionend: Pe,
|
|
154
|
-
role:
|
|
155
|
-
"aria-live":
|
|
156
|
-
},
|
|
154
|
+
role: L.value.role ?? "status",
|
|
155
|
+
"aria-live": L.value["aria-live"] ?? "polite"
|
|
156
|
+
}, c({
|
|
157
157
|
"relative w-full max-w-sm overflow-hidden pointer-events-auto": !0,
|
|
158
158
|
"bg-white shadow-lg ring-1 ring-black/5": !0,
|
|
159
159
|
"dark:bg-dark-800 dark:border dark:border-dark-700": !0,
|
|
160
|
-
[
|
|
161
|
-
[
|
|
162
|
-
[
|
|
163
|
-
}))), Re = r(() => e(
|
|
160
|
+
[s(De.value, "base") ?? ""]: !0,
|
|
161
|
+
[Te.value]: V.value,
|
|
162
|
+
[s(R.value, "root") ?? ""]: !0
|
|
163
|
+
}))), Re = r(() => e(I.value?.icon, {}, c({
|
|
164
164
|
"w-6 h-6 shrink-0": !0,
|
|
165
|
-
[
|
|
166
|
-
[
|
|
167
|
-
}))), ze = r(() => e(
|
|
165
|
+
[s(H.value, "iconColor") ?? ""]: !0,
|
|
166
|
+
[s(R.value, "icon") ?? ""]: !0
|
|
167
|
+
}))), ze = r(() => e(I.value?.title, {}, c({
|
|
168
168
|
"font-medium": !0,
|
|
169
|
-
[
|
|
170
|
-
[
|
|
171
|
-
}))), Be = r(() => e(
|
|
169
|
+
[s(H.value, "titleColor") ?? ""]: !0,
|
|
170
|
+
[s(R.value, "title") ?? ""]: !0
|
|
171
|
+
}))), Be = r(() => e(I.value?.description, {}, c({
|
|
172
172
|
"mt-1 font-normal text-dark-500 dark:text-dark-500": !0,
|
|
173
|
-
[
|
|
174
|
-
}))), Ve = r(() => e(
|
|
175
|
-
class:
|
|
173
|
+
[s(R.value, "description") ?? ""]: !0
|
|
174
|
+
}))), Ve = r(() => e(I.value?.progress, {}, {
|
|
175
|
+
class: c({
|
|
176
176
|
"absolute bottom-0 left-0 h-0.5 w-full rounded-full": !0,
|
|
177
|
-
[
|
|
178
|
-
[
|
|
177
|
+
[s(H.value, "progressColor") ?? ""]: !0,
|
|
178
|
+
[s(R.value, "progress") ?? ""]: !0
|
|
179
179
|
}),
|
|
180
180
|
style: W.value ? {
|
|
181
181
|
transformOrigin: "left center",
|
|
182
|
-
transform: `scaleX(${
|
|
183
|
-
transition:
|
|
182
|
+
transform: `scaleX(${S.value && !y.value ? 0 : _.value})`,
|
|
183
|
+
transition: S.value && !y.value ? `transform ${w.value}ms linear` : "none"
|
|
184
184
|
} : void 0
|
|
185
185
|
}));
|
|
186
186
|
function He(t) {
|
|
187
|
-
return e(
|
|
188
|
-
|
|
189
|
-
[
|
|
190
|
-
[
|
|
187
|
+
return e(I.value?.content, {}, c({
|
|
188
|
+
"w-0 flex-1 flex flex-col justify-center": t,
|
|
189
|
+
[s(Ee.value, "content") ?? ""]: !0,
|
|
190
|
+
[s(R.value, "content") ?? ""]: !0
|
|
191
191
|
}));
|
|
192
192
|
}
|
|
193
193
|
return {
|
|
194
|
-
merged:
|
|
194
|
+
merged: P,
|
|
195
195
|
iconBind: Re,
|
|
196
|
-
rendered:
|
|
196
|
+
rendered: h,
|
|
197
197
|
panelBind: Le,
|
|
198
198
|
titleBind: ze,
|
|
199
199
|
isPortaled: G,
|
|
@@ -207,4 +207,4 @@ function f(f, we, p = {}) {
|
|
|
207
207
|
descriptionBind: Be
|
|
208
208
|
};
|
|
209
209
|
}
|
|
210
|
-
export {
|
|
210
|
+
export { p as useSnackbar };
|
|
@@ -209,7 +209,7 @@ export interface SnackbarSlots {
|
|
|
209
209
|
*/
|
|
210
210
|
title?: Slot<undefined>;
|
|
211
211
|
/**
|
|
212
|
-
* Content before the close button (e.g. compact accept action
|
|
212
|
+
* Content before the close button (e.g. a compact accept action).
|
|
213
213
|
*/
|
|
214
214
|
trailing?: Slot<undefined>;
|
|
215
215
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.23.0",
|
|
5
5
|
"author": "BridgeUI",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"name": "@bridge-ui/vue",
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
}
|
|
114
114
|
},
|
|
115
115
|
"dependencies": {
|
|
116
|
-
"@bridge-ui/core": "^0.
|
|
116
|
+
"@bridge-ui/core": "^0.23.0",
|
|
117
117
|
"clsx": "^2.1.1",
|
|
118
118
|
"es-toolkit": "^1.52.0",
|
|
119
119
|
"tailwind-merge": "^3.7.0"
|