@bridge-ui/vue 0.22.1 → 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.
@@ -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 : "secondary"), y = r(() => v.value), b = r(() => {
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.solid ? "outline" : "flat" }), {
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, usesTrailingSnackbarActions as _ } from "@bridge-ui/core/Layer";
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, rightButtons: S, ...C } = b.entry.props, w = n(() => g(b.hostSnackbar, C)), T = n(() => w.value.color ?? "primary"), E = n(() => w.value.rounded ?? "lg"), D = () => {
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 O(e) {
26
+ function A(e) {
21
27
  e?.(), b.api.close(b.entry.id);
22
28
  }
23
- let k = n(() => !!(S && (x?.accept || x?.reject))), A = n(() => _(w.value.padding)), j = n(() => !S && !A.value && !!(x?.accept || x?.reject)), M = n(() => !!(A.value && x?.accept?.label));
24
- return (n, g) => (f(), r(p(e), u({ "stack-id": l.entry.id }, w.value, {
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: D,
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": T.value,
39
- "snackbar-rounded": E.value,
40
- onRun: g[0] ||= (e) => O(p(x)?.accept?.onClick)
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": T.value,
51
- "snackbar-rounded": E.value,
52
- onRun: g[1] ||= (e) => O(p(x)?.reject?.onClick)
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": T.value,
67
- "snackbar-rounded": E.value,
68
- onRun: g[2] ||= (e) => O(p(x)?.accept?.onClick)
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
- k.value ? {
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": T.value,
86
- "snackbar-rounded": E.value,
91
+ "snackbar-color": D.value,
92
+ "snackbar-rounded": O.value,
87
93
  "has-reject": !!p(x)?.reject,
88
- onRun: g[3] ||= (e) => O(p(x)?.accept?.onClick)
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": T.value,
99
- "snackbar-rounded": E.value,
104
+ "snackbar-color": D.value,
105
+ "snackbar-rounded": O.value,
100
106
  "has-accept": !!p(x)?.accept,
101
- onRun: g[4] ||= (e) => O(p(x)?.reject?.onClick)
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
- * Whether the action renders as a solid bordered button.
29
+ * Button variant (ignored when `link` is set).
30
+ *
31
+ * @default "flat"
30
32
  */
31
- solid?: boolean;
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 `secondary` by default.
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 inline or trailing actions (mapped to slots by the host).
94
+ * Preset actions (mapped to slots by the host according to `actionsPlacement`).
92
95
  */
93
96
  actions?: SnackbarActions;
94
97
  /**
95
- * Renders `actions` as a vertical column on the right edge.
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 false
104
+ * @default "bottom"
98
105
  */
99
- rightButtons?: boolean;
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';
@@ -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,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 items-start": !$.value,
76
- "w-full flex": $.value
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
- "w-6": !!(x(q) || x(M).icon),
82
- "pt-0.5": !!x(L).img
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)], 16),
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 items-start": !$.value,
134
- "w-full flex": $.value
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
- "w-6": !!(x(q) || x(M).icon),
140
- "pt-0.5": !!x(L).img
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)], 16),
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 re, ref as i, toValue as ie, useAttrs as ae, watch as a } from "vue";
4
- import { get as o, isNil as oe, isNull as se, isObject as ce, omit as le } from "es-toolkit/compat";
5
- import { snackbarColorProps as ue, snackbarPaddingProps as de, snackbarPositionProps as fe, snackbarRoundedProps as pe, snackbarTransitionProps as me } from "@bridge-ui/core/Tokens";
6
- import { cn as s, mergeBridgeUILayeredClasses as c, splitComponentProps as he } from "@bridge-ui/core/Utils";
7
- import { requestAfterNextPaint as l } from "@bridge-ui/core/Runtime";
8
- import { LAYER_STACK_BASE_Z_INDEX as u, SNACKBAR_LEAVE_FALLBACK_MS as ge, acquireLayerStackOrder as _e, getLayerStackEntry as ve, getSnackbarTransitionClass as ye, hasSnackbarTransition as be, pushLayerStack as xe, resolveEffectiveSnackbarTransition as Se, subscribeLayerStack as d } from "@bridge-ui/core/Layer";
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 Ce = [
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 f(f, we, p = {}) {
29
- let Te = ae(), m = i(!1), h = i(""), g = i(1), _ = i(0), v = i(!1), y = i(!1), b = i(0), x = i(!1), S = null, C = i(0), w = i(null), T = null, E = null, D = i(u), O = null, k = i("closed"), A = i(null), j = null, M = r(() => he({
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
- ...Te,
32
- ...f
31
+ ...we,
32
+ ...p
33
33
  },
34
- bridgeKeys: Ce
35
- })), { merged: N, entry: P } = n({
36
- libDefaults: we,
34
+ bridgeKeys: Se
35
+ })), { merged: P, entry: F } = n({
36
+ libDefaults: Ce,
37
37
  componentName: "Snackbar",
38
- props: () => M.value.componentProps
39
- }), F = r(() => N.value.customProps), I = r(() => le(M.value.inheritedAttrs, ["onShowChange"])), L = ee({
40
- entry: P,
41
- props: () => M.value.componentProps
42
- }), R = r(() => !oe(p.show) && ie(p.show)), z = r(() => {
43
- let e = N.value.transition ?? "none", t = e in me ? e : "none";
44
- return Se(t);
45
- }), B = r(() => be(z.value)), Ee = r(() => ye(z.value)), V = r(() => {
46
- let e = c(ue, P.value?.tokens?.color);
47
- return o(e, N.value.color);
48
- }), H = r(() => {
49
- let e = c(de, P.value?.tokens?.padding);
50
- return o(e, N.value.padding);
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 = c(pe, P.value?.tokens?.rounded);
53
- return o(e, N.value.rounded);
54
- }), Oe = r(() => se(N.value.icon) ? null : N.value.icon ? N.value.icon : o(V.value, "icon") ?? o(te, N.value.color)), U = r(() => N.value.duration === !1 ? 0 : N.value.duration ?? 0), W = r(() => R.value && m.value && U.value > 0 && N.value.progressbar !== !1), G = r(() => N.value.teleportTo !== !1), ke = 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 = c(fe, P.value?.tokens?.position);
57
- return o(e, N.value.position ?? "bottom-center");
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
- A.value &&= (clearTimeout(A.value), null);
60
+ j.value &&= (clearTimeout(j.value), null);
61
61
  }
62
62
  function q() {
63
- j !== null && (clearTimeout(j), j = null);
63
+ M !== null && (clearTimeout(M), M = null);
64
64
  }
65
65
  function J() {
66
- E?.(), E = null;
66
+ D?.(), D = null;
67
67
  }
68
68
  function Y(e) {
69
- e || p.onClose?.(), ce(p.show) && "value" in p.show && (p.show.value = e), p.onShowChange?.(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
- y.value && (y.value = !1, k.value = "closed", K(), q(), R.value ? Y(!1) : p.onLeaveComplete?.(), m.value = !1);
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(), y.value = !0, B.value ? (k.value = "closed", q(), j = setTimeout(() => {
76
- j = null, X();
77
- }, ge)) : X();
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
- y.value = !1, q(), B.value ? (k.value = "closed", J(), E = l(() => {
81
- k.value = "open";
82
- })) : k.value = "open";
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
- R.value && Y(!1);
85
+ z.value && Y(!1);
86
86
  }
87
87
  function Q(e) {
88
- K(), _.value = e, b.value = Date.now(), C.value = e, A.value = setTimeout(() => {
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
- !A.value || U.value <= 0 || (K(), _.value -= Date.now() - b.value, g.value = Math.max(_.value / U.value, 0), x.value = !1, v.value = !0);
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 || !v.value) return;
97
- let e = Math.max(_.value, 0);
98
- v.value = !1, x.value = !1, requestAnimationFrame(() => {
99
- x.value = !0;
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
- y.value && m.value && k.value === "closed" && e.target === e.currentTarget && e.propertyName !== "none" && e.elapsedTime !== 0 && X();
103
+ b.value && h.value && A.value === "closed" && e.target === e.currentTarget && e.propertyName !== "none" && e.elapsedTime !== 0 && X();
104
104
  }
105
- a(R, (e) => {
106
- e ? (m.value = !0, je()) : m.value && Ae();
107
- }, { immediate: !0 }), a([
108
- R,
109
- m,
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() : (v.value = !1, Q(n));
113
- }, { immediate: !0 }), a([U, W], ([, e], t, n) => {
114
- x.value = !1, g.value = 1, e && n(l(() => {
115
- x.value = !0;
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 = ve(h.value);
120
- e && (D.value = e.zIndex);
119
+ let e = _e(g.value);
120
+ e && (O.value = e.zIndex);
121
121
  }
122
122
  function Fe(e) {
123
- w.value = t(e), T?.setContainer(w.value);
123
+ T.value = t(e), E?.setContainer(T.value);
124
124
  }
125
- a([m, G], ([e, t]) => {
126
- t && (e ? (S = _e(), T = xe({
127
- order: S,
125
+ o([h, G], ([e, t]) => {
126
+ t && (e ? (C = ge(), E = be({
127
+ order: C,
128
128
  lockScroll: !1,
129
- id: p.stackId,
130
- container: w.value ?? void 0,
129
+ id: m.stackId,
130
+ container: T.value ?? void 0,
131
131
  onEscape: () => {
132
132
  Z();
133
133
  }
134
- }), h.value = T.id, D.value = T.zIndex, $(), O = d($), ne(() => {
135
- T?.setContainer(w.value);
136
- })) : (O?.(), O = null, T?.release(), T = null, S = null, h.value = "", D.value = u));
137
- }, { immediate: !0 }), re(() => {
138
- K(), q(), J(), O?.(), O = null, T?.release(), T = null;
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(F.value?.portal, {
140
+ let Ie = r(() => e(I.value?.portal, {
141
141
  "data-snackbar-layer": !0,
142
- style: { zIndex: D.value }
143
- }, s({
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
- [o(L.value, "portal") ?? ""]: !0
147
- }))), Le = r(() => e(F.value?.root, {
148
- ...I.value,
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": k.value,
152
+ "data-state": A.value,
153
153
  onTransitionend: Pe,
154
- role: I.value.role ?? "status",
155
- "aria-live": I.value["aria-live"] ?? "polite"
156
- }, s({
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
- [o(De.value, "base") ?? ""]: !0,
161
- [Ee.value]: B.value,
162
- [o(L.value, "root") ?? ""]: !0
163
- }))), Re = r(() => e(F.value?.icon, {}, s({
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
- [o(V.value, "iconColor") ?? ""]: !0,
166
- [o(L.value, "icon") ?? ""]: !0
167
- }))), ze = r(() => e(F.value?.title, {}, s({
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
- [o(V.value, "titleColor") ?? ""]: !0,
170
- [o(L.value, "title") ?? ""]: !0
171
- }))), Be = r(() => e(F.value?.description, {}, s({
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
- [o(L.value, "description") ?? ""]: !0
174
- }))), Ve = r(() => e(F.value?.progress, {}, {
175
- class: s({
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
- [o(V.value, "progressColor") ?? ""]: !0,
178
- [o(L.value, "progress") ?? ""]: !0
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(${x.value && !v.value ? 0 : g.value})`,
183
- transition: x.value && !v.value ? `transform ${C.value}ms linear` : "none"
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(F.value?.content, {}, s({
188
- [o(H.value, "contentRight") ?? ""]: t,
189
- [o(H.value, "content") ?? ""]: !t,
190
- [o(L.value, "content") ?? ""]: !0
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: N,
194
+ merged: P,
195
195
  iconBind: Re,
196
- rendered: m,
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 { f as useSnackbar };
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 with `padding="small"`).
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.22.1",
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.22.1",
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"