@adyen/bento-vue2 1.22.0 → 1.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/README.md +2 -0
- package/dist/@types/index.d.ts +346 -258
- package/dist/accordion.js +3 -3
- package/dist/action-bar.js +7 -7
- package/dist/alert.js +73 -54
- package/dist/alert.js.map +1 -1
- package/dist/assets/base-modal.css +1 -1
- package/dist/assets/button.css +1 -1
- package/dist/assets/dialog-page.css +1 -1
- package/dist/assets/grid-layout.css +1 -1
- package/dist/assets/index10.css +1 -1
- package/dist/assets/index11.css +1 -1
- package/dist/assets/index12.css +1 -1
- package/dist/assets/index13.css +1 -1
- package/dist/assets/index14.css +1 -1
- package/dist/assets/index15.css +1 -1
- package/dist/assets/index16.css +1 -1
- package/dist/assets/index17.css +1 -1
- package/dist/assets/index18.css +1 -1
- package/dist/assets/index19.css +1 -1
- package/dist/assets/index2.css +1 -1
- package/dist/assets/index20.css +1 -1
- package/dist/assets/index21.css +1 -1
- package/dist/assets/index22.css +1 -1
- package/dist/assets/index23.css +1 -1
- package/dist/assets/index24.css +1 -1
- package/dist/assets/index25.css +1 -1
- package/dist/assets/index26.css +1 -1
- package/dist/assets/index27.css +1 -1
- package/dist/assets/index28.css +1 -1
- package/dist/assets/index29.css +1 -1
- package/dist/assets/index3.css +1 -1
- package/dist/assets/index30.css +1 -1
- package/dist/assets/index31.css +1 -1
- package/dist/assets/index32.css +1 -1
- package/dist/assets/index33.css +1 -1
- package/dist/assets/index34.css +1 -1
- package/dist/assets/index35.css +1 -1
- package/dist/assets/index36.css +1 -1
- package/dist/assets/index37.css +1 -1
- package/dist/assets/index38.css +1 -1
- package/dist/assets/index39.css +1 -1
- package/dist/assets/index4.css +1 -1
- package/dist/assets/index40.css +1 -1
- package/dist/assets/index41.css +1 -1
- package/dist/assets/index42.css +1 -1
- package/dist/assets/index43.css +1 -1
- package/dist/assets/index44.css +1 -1
- package/dist/assets/index45.css +1 -1
- package/dist/assets/index46.css +1 -1
- package/dist/assets/index47.css +1 -1
- package/dist/assets/index48.css +1 -1
- package/dist/assets/index5.css +1 -1
- package/dist/assets/index6.css +1 -1
- package/dist/assets/index7.css +1 -1
- package/dist/assets/index8.css +1 -1
- package/dist/assets/index9.css +1 -1
- package/dist/avatar-image.js +1 -1
- package/dist/button.js +5 -5
- package/dist/card.js +4 -4
- package/dist/checkbox.js +6 -6
- package/dist/chunks/{base-button.6bd3ae4d.js → base-button.090f511d.js} +2 -2
- package/dist/chunks/{base-button.6bd3ae4d.js.map → base-button.090f511d.js.map} +1 -1
- package/dist/chunks/{base-modal.bf917e7d.js → base-modal.aa09a60c.js} +7 -7
- package/dist/chunks/{base-modal.bf917e7d.js.map → base-modal.aa09a60c.js.map} +1 -1
- package/dist/chunks/{button-actions-with-menu.ec7dfc53.js → button-actions-with-menu.879c4573.js} +4 -4
- package/dist/chunks/{button-actions-with-menu.ec7dfc53.js.map → button-actions-with-menu.879c4573.js.map} +1 -1
- package/dist/chunks/{button-actions.2bf1d9d1.js → button-actions.239456cb.js} +3 -3
- package/dist/chunks/{button-actions.2bf1d9d1.js.map → button-actions.239456cb.js.map} +1 -1
- package/dist/chunks/{button.80c3c527.js → button.6e6324f0.js} +3 -3
- package/dist/chunks/{button.80c3c527.js.map → button.6e6324f0.js.map} +1 -1
- package/dist/chunks/{calendar.8cbb911d.js → calendar.1e416969.js} +5 -5
- package/dist/chunks/{calendar.8cbb911d.js.map → calendar.1e416969.js.map} +1 -1
- package/dist/chunks/{checkbox-input.17e832f1.js → checkbox-input.1c3cc8ed.js} +2 -2
- package/dist/chunks/{checkbox-input.17e832f1.js.map → checkbox-input.1c3cc8ed.js.map} +1 -1
- package/dist/chunks/{checkbox.11454247.js → checkbox.f38276e6.js} +4 -4
- package/dist/chunks/{checkbox.11454247.js.map → checkbox.f38276e6.js.map} +1 -1
- package/dist/chunks/{checkmark-circle-fill.75b87a2c.js → checkmark-circle-fill.345311d2.js} +2 -2
- package/dist/chunks/{checkmark-circle-fill.75b87a2c.js.map → checkmark-circle-fill.345311d2.js.map} +1 -1
- package/dist/chunks/{checkmark-small.07adbfcb.js → checkmark-small.520f01b1.js} +2 -2
- package/dist/chunks/{checkmark-small.07adbfcb.js.map → checkmark-small.520f01b1.js.map} +1 -1
- package/dist/chunks/{checkmark.9979f1c1.js → checkmark.a6ed8f47.js} +2 -2
- package/dist/chunks/{checkmark.9979f1c1.js.map → checkmark.a6ed8f47.js.map} +1 -1
- package/dist/chunks/{chevron-left.64e168be.js → chevron-left.5edf02ac.js} +2 -2
- package/dist/chunks/{chevron-left.64e168be.js.map → chevron-left.5edf02ac.js.map} +1 -1
- package/dist/chunks/{chevron-up.628ac446.js → chevron-up.81185563.js} +2 -2
- package/dist/chunks/{chevron-up.628ac446.js.map → chevron-up.81185563.js.map} +1 -1
- package/dist/chunks/{controls-group.0892d082.js → controls-group.f1dfa419.js} +3 -3
- package/dist/chunks/{controls-group.0892d082.js.map → controls-group.f1dfa419.js.map} +1 -1
- package/dist/chunks/{copy.2d2c6b85.js → copy.acc9f1b0.js} +4 -4
- package/dist/chunks/{copy.2d2c6b85.js.map → copy.acc9f1b0.js.map} +1 -1
- package/dist/chunks/{cross-circle-fill.34e86c56.js → cross-circle-fill.27580c4b.js} +2 -2
- package/dist/chunks/{cross-circle-fill.34e86c56.js.map → cross-circle-fill.27580c4b.js.map} +1 -1
- package/dist/chunks/{cross-small.e3c016cb.js → cross-small.e851e0de.js} +2 -2
- package/dist/chunks/{cross-small.e3c016cb.js.map → cross-small.e851e0de.js.map} +1 -1
- package/dist/chunks/{cross.e5433f3b.js → cross.04678d81.js} +2 -2
- package/dist/chunks/{cross.e5433f3b.js.map → cross.04678d81.js.map} +1 -1
- package/dist/chunks/{dialog-page.21f1eb92.js → dialog-page.75b295b7.js} +3 -3
- package/dist/chunks/{dialog-page.21f1eb92.js.map → dialog-page.75b295b7.js.map} +1 -1
- package/dist/chunks/{dropdown-default-textbox.9c23c94d.js → dropdown-default-textbox.c1f8fe5f.js} +57 -37
- package/dist/chunks/dropdown-default-textbox.c1f8fe5f.js.map +1 -0
- package/dist/chunks/{dropdown.dad8cedd.js → dropdown.669b858b.js} +20 -21
- package/dist/chunks/{dropdown.dad8cedd.js.map → dropdown.669b858b.js.map} +1 -1
- package/dist/chunks/{error-message.5fdafd8c.js → error-message.8734e591.js} +3 -3
- package/dist/chunks/{error-message.5fdafd8c.js.map → error-message.8734e591.js.map} +1 -1
- package/dist/chunks/{fixed-scroller.e917ed3f.js → fixed-scroller.772ad033.js} +3 -3
- package/dist/chunks/{fixed-scroller.e917ed3f.js.map → fixed-scroller.772ad033.js.map} +1 -1
- package/dist/chunks/{footer-actions.599e5a1d.js → footer-actions.11071f12.js} +4 -4
- package/dist/chunks/{footer-actions.599e5a1d.js.map → footer-actions.11071f12.js.map} +1 -1
- package/dist/chunks/{index.823243d9.js → index.03ae22b4.js} +2 -2
- package/dist/chunks/{index.823243d9.js.map → index.03ae22b4.js.map} +1 -1
- package/dist/chunks/index.49ce3f6a.js +49 -0
- package/dist/chunks/index.49ce3f6a.js.map +1 -0
- package/dist/chunks/{index.0c4a8dd9.js → index.51308a21.js} +3 -3
- package/dist/chunks/{index.0c4a8dd9.js.map → index.51308a21.js.map} +1 -1
- package/dist/chunks/{index.937a82c2.js → index.5d5f2200.js} +7 -7
- package/dist/chunks/{index.937a82c2.js.map → index.5d5f2200.js.map} +1 -1
- package/dist/chunks/{index.73634ace.js → index.73abb1a9.js} +31 -32
- package/dist/chunks/{index.73634ace.js.map → index.73abb1a9.js.map} +1 -1
- package/dist/chunks/{index.929dda57.js → index.87180cdd.js} +107 -106
- package/dist/chunks/index.87180cdd.js.map +1 -0
- package/dist/chunks/{index.d681cfda.js → index.8e6bc325.js} +12 -11
- package/dist/chunks/index.8e6bc325.js.map +1 -0
- package/dist/chunks/{index.7d2ea1de.js → index.94980f50.js} +2 -2
- package/dist/chunks/{index.7d2ea1de.js.map → index.94980f50.js.map} +1 -1
- package/dist/chunks/index.ba6c1040.js +79 -0
- package/dist/chunks/index.ba6c1040.js.map +1 -0
- package/dist/chunks/{index.3ddbe834.js → index.f19887a1.js} +2 -2
- package/dist/chunks/{index.3ddbe834.js.map → index.f19887a1.js.map} +1 -1
- package/dist/chunks/{index.66c8d79f.js → index.ff09389c.js} +7 -7
- package/dist/chunks/{index.66c8d79f.js.map → index.ff09389c.js.map} +1 -1
- package/dist/chunks/{info.b11d377e.js → info.8b6328aa.js} +2 -2
- package/dist/chunks/{info.b11d377e.js.map → info.8b6328aa.js.map} +1 -1
- package/dist/chunks/{listbox-option-tag.52ca5a60.js → listbox-option-tag.c0a56a95.js} +3 -3
- package/dist/chunks/{listbox-option-tag.52ca5a60.js.map → listbox-option-tag.c0a56a95.js.map} +1 -1
- package/dist/chunks/{listbox.6d8bd2ae.js → listbox.e6e1bc90.js} +8 -8
- package/dist/chunks/{listbox.6d8bd2ae.js.map → listbox.e6e1bc90.js.map} +1 -1
- package/dist/chunks/{loading-button.73c0bd64.js → loading-button.84a5529d.js} +4 -4
- package/dist/chunks/{loading-button.73c0bd64.js.map → loading-button.84a5529d.js.map} +1 -1
- package/dist/chunks/{payment-method.eeb54552.js → payment-method.faa302de.js} +2 -2
- package/dist/chunks/{payment-method.eeb54552.js.map → payment-method.faa302de.js.map} +1 -1
- package/dist/chunks/{refresh.f8e1b23c.js → refresh.71a03998.js} +2 -2
- package/dist/chunks/{refresh.f8e1b23c.js.map → refresh.71a03998.js.map} +1 -1
- package/dist/chunks/{search.4b38a2ef.js → search.471270fe.js} +2 -2
- package/dist/chunks/{search.4b38a2ef.js.map → search.471270fe.js.map} +1 -1
- package/dist/chunks/{tooltip.a9133b59.js → tooltip.8e9d733c.js} +3 -3
- package/dist/chunks/{tooltip.a9133b59.js.map → tooltip.8e9d733c.js.map} +1 -1
- package/dist/chunks/use-bento-toast-controller.7d4436ad.js +52 -0
- package/dist/chunks/use-bento-toast-controller.7d4436ad.js.map +1 -0
- package/dist/chunks/use-click-outside.941d1600.js +14 -0
- package/dist/chunks/use-click-outside.941d1600.js.map +1 -0
- package/dist/code-snippet.js +7 -7
- package/dist/code-snippet.js.map +1 -1
- package/dist/country.js +2 -2
- package/dist/currency.js +1 -1
- package/dist/data-grid-template.js +1 -1
- package/dist/data-grid.js +898 -805
- package/dist/data-grid.js.map +1 -1
- package/dist/date-picker.js +39 -40
- package/dist/date-picker.js.map +1 -1
- package/dist/date-range-picker.js +2 -2
- package/dist/date.js +1 -1
- package/dist/divider.js +1 -1
- package/dist/dropdown.js +7 -7
- package/dist/empty-state.js +3 -3
- package/dist/filter-bar.js +410 -421
- package/dist/filter-bar.js.map +1 -1
- package/dist/focus-trap.js +1 -1
- package/dist/form-layout.js +2 -2
- package/dist/header.js +5 -5
- package/dist/index.js +247 -269
- package/dist/index.js.map +1 -1
- package/dist/info-icon.js +4 -4
- package/dist/input-field.js +38 -34
- package/dist/input-field.js.map +1 -1
- package/dist/internal.js +8 -8
- package/dist/link.js +1 -1
- package/dist/loading-indicator.js +1 -1
- package/dist/menu.js +1 -1
- package/dist/modal-fullscreen.js +7 -7
- package/dist/modal.js +6 -6
- package/dist/pagination.js +4 -4
- package/dist/payment-method.js +1 -1
- package/dist/popover.js +1 -1
- package/dist/popper-container.js +1 -1
- package/dist/radio-group.js +4 -4
- package/dist/search-bar.js +4 -4
- package/dist/secondary-nav.js +2 -2
- package/dist/segmented-control.js +4 -4
- package/dist/selection-card.js +5 -5
- package/dist/sidepanel.js +7 -7
- package/dist/status.js +2 -2
- package/dist/stepper.js +144 -133
- package/dist/stepper.js.map +1 -1
- package/dist/structured-list.js +1 -1
- package/dist/summary-grid.js +3 -3
- package/dist/tabs.js +3 -3
- package/dist/tag.js +3 -3
- package/dist/textarea.js +4 -4
- package/dist/timeline.js +7 -7
- package/dist/toast.js +143 -98
- package/dist/toast.js.map +1 -1
- package/dist/toggle.js +3 -3
- package/dist/tutorial.js +7 -7
- package/dist/typography.js +1 -1
- package/dist/web-types.json +204 -117
- package/package.json +3 -3
- package/dist/chunks/directive.0408e565.js +0 -23
- package/dist/chunks/directive.0408e565.js.map +0 -1
- package/dist/chunks/dropdown-default-textbox.9c23c94d.js.map +0 -1
- package/dist/chunks/index.0c33067d.js +0 -127
- package/dist/chunks/index.0c33067d.js.map +0 -1
- package/dist/chunks/index.5af5de46.js +0 -83
- package/dist/chunks/index.5af5de46.js.map +0 -1
- package/dist/chunks/index.929dda57.js.map +0 -1
- package/dist/chunks/index.d681cfda.js.map +0 -1
- package/dist/chunks/info-filled.ee9571d9.js +0 -26
- package/dist/chunks/info-filled.ee9571d9.js.map +0 -1
- package/dist/chunks/toastController.fd667b68.js +0 -15
- package/dist/chunks/toastController.fd667b68.js.map +0 -1
- /package/dist/assets/{cross-small.css → cross.css} +0 -0
package/dist/structured-list.js
CHANGED
package/dist/summary-grid.js
CHANGED
|
@@ -4,10 +4,10 @@ import { S as h } from "./chunks/summary-grid.keys.1d1028c2.js";
|
|
|
4
4
|
import { G as E } from "./chunks/grid-layout.e0025286.js";
|
|
5
5
|
import { n as c } from "./chunks/_plugin-vue2_normalizer.71e2aa87.js";
|
|
6
6
|
import { BentoInfoIcon as O } from "./info-icon.js";
|
|
7
|
-
import { B as L, a as g } from "./chunks/index.
|
|
7
|
+
import { B as L, a as g } from "./chunks/index.ba6c1040.js";
|
|
8
8
|
import { BentoTag as M, BentoTagVariant as f } from "./tag.js";
|
|
9
|
-
import { C as G } from "./chunks/copy.
|
|
10
|
-
import "./assets/
|
|
9
|
+
import { C as G } from "./chunks/copy.acc9f1b0.js";
|
|
10
|
+
import "./assets/index29.css";
|
|
11
11
|
const P = l({
|
|
12
12
|
name: "bento-summary-grid",
|
|
13
13
|
components: { GridLayout: E },
|
package/dist/tabs.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { defineComponent as m, toRefs as C, ref as b, provide as u, computed as w, inject as p, onUnmounted as A, watch as N, nextTick as B } from "vue";
|
|
2
2
|
import { E as k, T as I, a as h } from "./chunks/tabs.keys.358742f2.js";
|
|
3
3
|
import { n as g } from "./chunks/_plugin-vue2_normalizer.71e2aa87.js";
|
|
4
|
-
import { B as R } from "./chunks/index.
|
|
4
|
+
import { B as R } from "./chunks/index.ba6c1040.js";
|
|
5
5
|
import { g as D } from "./chunks/unique-id.a2a2b458.js";
|
|
6
|
-
import { F as S } from "./chunks/fixed-scroller.
|
|
7
|
-
import "./assets/
|
|
6
|
+
import { F as S } from "./chunks/fixed-scroller.772ad033.js";
|
|
7
|
+
import "./assets/index30.css";
|
|
8
8
|
const K = m({
|
|
9
9
|
props: {
|
|
10
10
|
/**
|
package/dist/tag.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { defineComponent as c, computed as o } from "vue";
|
|
2
|
-
import { B as d } from "./chunks/index.
|
|
2
|
+
import { B as d } from "./chunks/index.ba6c1040.js";
|
|
3
3
|
import { u as m } from "./chunks/aria-label.ac9651a5.js";
|
|
4
4
|
import { g as s } from "./chunks/get-slot-text.99c3d860.js";
|
|
5
|
-
import { b as _ } from "./chunks/tooltip.
|
|
5
|
+
import { b as _ } from "./chunks/tooltip.8e9d733c.js";
|
|
6
6
|
import { n as v } from "./chunks/_plugin-vue2_normalizer.71e2aa87.js";
|
|
7
|
-
import "./assets/
|
|
7
|
+
import "./assets/index31.css";
|
|
8
8
|
var r = /* @__PURE__ */ ((t) => (t.GREY = "grey", t.BLUE = "blue", t.GREEN = "green", t.ORANGE = "orange", t.RED = "red", t.WHITE = "white", t))(r || {});
|
|
9
9
|
const p = c({
|
|
10
10
|
name: "bento-tag",
|
package/dist/textarea.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { defineComponent as K, useAttrs as Q, toRefs as O, ref as d, toRef as X, computed as n, watch as L, nextTick as ee, onMounted as te, onUnmounted as ae } from "vue";
|
|
2
|
-
import { a as le } from "./chunks/button.
|
|
3
|
-
import { B as re } from "./chunks/index.
|
|
2
|
+
import { a as le } from "./chunks/button.6e6324f0.js";
|
|
3
|
+
import { B as re } from "./chunks/index.ba6c1040.js";
|
|
4
4
|
import { n as T } from "./chunks/_plugin-vue2_normalizer.71e2aa87.js";
|
|
5
5
|
import { g as se } from "./chunks/unique-id.a2a2b458.js";
|
|
6
6
|
import { o as F } from "./chunks/resize.a041304d.js";
|
|
7
7
|
import { u as oe } from "./chunks/aria-label.ac9651a5.js";
|
|
8
8
|
import { u as ne } from "./chunks/i18n.eb5b985b.js";
|
|
9
9
|
import { u as ie } from "./chunks/use-form-layout-loading.d03e5d48.js";
|
|
10
|
-
import { E as ue, F as ce } from "./chunks/error-message.
|
|
11
|
-
import "./assets/
|
|
10
|
+
import { E as ue, F as ce } from "./chunks/error-message.8734e591.js";
|
|
11
|
+
import "./assets/index32.css";
|
|
12
12
|
let H = 0;
|
|
13
13
|
const de = {
|
|
14
14
|
beforeCreate() {
|
package/dist/timeline.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { defineComponent as Y, computed as r, ref as N, toRefs as Z, provide as A, inject as D, onUnmounted as G } from "vue";
|
|
2
|
-
import { a as z } from "./chunks/button.
|
|
2
|
+
import { a as z } from "./chunks/button.6e6324f0.js";
|
|
3
3
|
import { BentoTextarea as Q } from "./textarea.js";
|
|
4
4
|
import { u as H } from "./chunks/i18n.eb5b985b.js";
|
|
5
|
-
import { B as X } from "./chunks/button-actions.
|
|
5
|
+
import { B as X } from "./chunks/button-actions.239456cb.js";
|
|
6
6
|
import { n as x } from "./chunks/_plugin-vue2_normalizer.71e2aa87.js";
|
|
7
|
-
import { B as ee } from "./chunks/index.
|
|
8
|
-
import { B as te } from "./chunks/index.
|
|
7
|
+
import { B as ee } from "./chunks/index.03ae22b4.js";
|
|
8
|
+
import { B as te } from "./chunks/index.8e6bc325.js";
|
|
9
9
|
import { BentoTag as ie } from "./tag.js";
|
|
10
|
-
import { B as ae, d as se } from "./chunks/index.
|
|
11
|
-
import { B as ne, a as oe, S as re } from "./chunks/index.
|
|
10
|
+
import { B as ae, d as se } from "./chunks/index.ba6c1040.js";
|
|
11
|
+
import { B as ne, a as oe, S as re } from "./chunks/index.ff09389c.js";
|
|
12
12
|
import { g as le } from "./chunks/unique-id.a2a2b458.js";
|
|
13
13
|
import { u as me } from "./chunks/use-has-slot.fbeb19ec.js";
|
|
14
14
|
import { r as ce, e as de, t as w, g as k } from "./chunks/index.f55fdc32.js";
|
|
15
15
|
import { c as ue, a as _e } from "./chunks/index.86453263.js";
|
|
16
|
-
import "./assets/
|
|
16
|
+
import "./assets/index33.css";
|
|
17
17
|
var F = 1e3 * 60, M = 60 * 24, U = M * 30, j = M * 365;
|
|
18
18
|
function B(t, e) {
|
|
19
19
|
var i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
package/dist/toast.js
CHANGED
|
@@ -1,126 +1,171 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { a as
|
|
6
|
-
import { B as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import "./assets/
|
|
10
|
-
const
|
|
1
|
+
import { defineComponent as $, ref as c, computed as d, watch as k, onMounted as Y, nextTick as q } from "vue";
|
|
2
|
+
import "./chunks/index.4c062058.js";
|
|
3
|
+
import { C as L } from "./chunks/cross-small.e851e0de.js";
|
|
4
|
+
import { u as P } from "./chunks/i18n.eb5b985b.js";
|
|
5
|
+
import { a as N } from "./chunks/button.6e6324f0.js";
|
|
6
|
+
import { B as U } from "./chunks/index.ba6c1040.js";
|
|
7
|
+
import { n as B } from "./chunks/_plugin-vue2_normalizer.71e2aa87.js";
|
|
8
|
+
import { u as O } from "./chunks/use-bento-toast-controller.7d4436ad.js";
|
|
9
|
+
import "./assets/index34.css";
|
|
10
|
+
const M = {
|
|
11
11
|
"en-US": {
|
|
12
12
|
dismiss: "Dismiss"
|
|
13
13
|
}
|
|
14
|
-
},
|
|
15
|
-
i18n: { messages:
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
}, W = {
|
|
15
|
+
i18n: { messages: M }
|
|
16
|
+
}, z = /* @__PURE__ */ $({
|
|
17
|
+
...W,
|
|
18
|
+
__name: "toast-item",
|
|
18
19
|
props: {
|
|
19
|
-
|
|
20
|
-
type: String,
|
|
21
|
-
required: !0
|
|
22
|
-
},
|
|
23
|
-
action: {
|
|
24
|
-
type: Object,
|
|
25
|
-
default: null
|
|
26
|
-
}
|
|
20
|
+
toast: { type: Object, required: !0 }
|
|
27
21
|
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
};
|
|
33
|
-
return {
|
|
34
|
-
// Methods
|
|
35
|
-
dismissButtonClicked: e,
|
|
36
|
-
hasSlot: w(t),
|
|
37
|
-
onActionClicked: o
|
|
38
|
-
};
|
|
22
|
+
setup(u) {
|
|
23
|
+
const t = u, { t: s } = P();
|
|
24
|
+
return { __sfc: !0, props: t, t: s, onAction: () => {
|
|
25
|
+
typeof t.toast.action.handler == "function" && t.toast.action.handler(), t.toast.dismiss();
|
|
26
|
+
}, CrossIcon: L, BentoButton: N, BentoTypography: U };
|
|
39
27
|
}
|
|
40
28
|
});
|
|
41
|
-
var
|
|
42
|
-
var t = this, s = t._self._c;
|
|
43
|
-
return
|
|
44
|
-
return
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
29
|
+
var V = function() {
|
|
30
|
+
var t = this, s = t._self._c, e = t._self._setupProxy;
|
|
31
|
+
return s("div", { staticClass: "b-toast-item" }, [s("output", { staticClass: "b-toast-item__text", attrs: { role: "status" } }, [s(e.BentoTypography, { attrs: { title: t.toast.text, el: "span", variant: "body", strongest: "" } }, [t._v(" " + t._s(t.toast.text) + " ")])], 1), t.toast.action ? s(e.BentoButton, { staticClass: "b-toast-item__btn", attrs: { variant: "tertiary", "data-testid": "toast-item-action-btn" }, on: { click: e.onAction } }, [t._v(" " + t._s(t.toast.action.text) + " ")]) : t._e(), s(e.BentoButton, { staticClass: "b-toast-item__btn", attrs: { variant: "tertiary", "data-testid": "toast-item-close-btn" }, on: { click: function(o) {
|
|
32
|
+
return t.toast.dismiss();
|
|
33
|
+
} }, scopedSlots: t._u([{ key: "iconLeft", fn: function() {
|
|
34
|
+
return [s(e.CrossIcon, { attrs: { "svg-title": e.t("dismiss") } })];
|
|
35
|
+
}, proxy: !0 }]) })], 1);
|
|
36
|
+
}, j = [], E = /* @__PURE__ */ B(
|
|
37
|
+
z,
|
|
38
|
+
V,
|
|
39
|
+
j,
|
|
50
40
|
!1,
|
|
51
41
|
null,
|
|
52
|
-
"
|
|
42
|
+
"e4019e01",
|
|
53
43
|
null,
|
|
54
44
|
null
|
|
55
45
|
);
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
setup() {
|
|
60
|
-
const {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
n && l(n);
|
|
46
|
+
const H = E.exports, F = /* @__PURE__ */ $({
|
|
47
|
+
__name: "toast-shadow-stack",
|
|
48
|
+
emits: ["update"],
|
|
49
|
+
setup(u, { emit: t }) {
|
|
50
|
+
const { stack: s } = O(), e = c(), o = c(), l = c(), m = c(), f = [o, l, m], v = d(() => s.value.slice(0, 3)), r = async () => {
|
|
51
|
+
await q();
|
|
52
|
+
const { top: h } = e.value.getBoundingClientRect(), T = s.value.map((b, y) => {
|
|
53
|
+
if (y > 2)
|
|
54
|
+
return { ...b, bottom: 0, height: 0 };
|
|
55
|
+
const { height: p, top: g } = f[y].value.$el.getBoundingClientRect();
|
|
56
|
+
return { ...b, height: p, bottom: g - h };
|
|
57
|
+
});
|
|
58
|
+
t("update", T);
|
|
70
59
|
};
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}),
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
60
|
+
return k(s, r), Y(() => {
|
|
61
|
+
s.value.length > 0 && r();
|
|
62
|
+
}), { __sfc: !0, stack: s, emit: t, shadowStack: e, toast0: o, toast1: l, toast2: m, toastRefs: f, toasts: v, shareToastsWithDimensions: r, ToastItem: H };
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
var X = function() {
|
|
66
|
+
var t = this, s = t._self._c, e = t._self._setupProxy;
|
|
67
|
+
return s("div", { ref: "shadowStack", staticClass: "b-toast-shadow-stack" }, [e.toasts[0] ? s(e.ToastItem, { ref: "toast0", attrs: { toast: e.toasts[0] } }) : t._e(), e.toasts[1] ? s(e.ToastItem, { ref: "toast1", attrs: { toast: e.toasts[1] } }) : t._e(), e.toasts[2] ? s(e.ToastItem, { ref: "toast2", attrs: { toast: e.toasts[2] } }) : t._e()], 1);
|
|
68
|
+
}, G = [], J = /* @__PURE__ */ B(
|
|
69
|
+
F,
|
|
70
|
+
X,
|
|
71
|
+
G,
|
|
72
|
+
!1,
|
|
73
|
+
null,
|
|
74
|
+
"9e646b8f",
|
|
75
|
+
null,
|
|
76
|
+
null
|
|
77
|
+
);
|
|
78
|
+
const K = J.exports, Q = /* @__PURE__ */ $({
|
|
79
|
+
__name: "toast",
|
|
80
|
+
setup(u) {
|
|
81
|
+
const s = c(!1), { stack: e } = O();
|
|
82
|
+
k(
|
|
83
|
+
e,
|
|
84
|
+
(a) => {
|
|
85
|
+
a.length > 0 && !s.value && (s.value = !0);
|
|
86
|
+
},
|
|
87
|
+
{ immediate: !0 }
|
|
78
88
|
);
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
89
|
+
const o = c(!1), l = c([]), m = 40, f = 10, v = d(() => l.value.length), r = d(() => Math.min(o.value ? 2 : 0, v.value - 1)), h = d(() => {
|
|
90
|
+
const a = l.value[r.value];
|
|
91
|
+
return a ? a.bottom + a.height : 0;
|
|
92
|
+
}), T = d(() => {
|
|
93
|
+
const a = h.value - m;
|
|
94
|
+
return l.value.map((n, _) => {
|
|
95
|
+
const S = _ > r.value, R = !o.value && _ > 1, D = S ? a + f * (R ? 2 : 1) : n.bottom;
|
|
82
96
|
return {
|
|
83
|
-
|
|
84
|
-
|
|
97
|
+
...n,
|
|
98
|
+
styles: {
|
|
99
|
+
height: `${S ? m : n.height}px`,
|
|
100
|
+
transform: S ? `translateY(${D * -1}px) scaleX(${R ? "0.8" : "0.9"})` : `translateY(${D * -1}px)`,
|
|
101
|
+
"z-index": v.value - _
|
|
102
|
+
},
|
|
103
|
+
// first toast has different animation, and toasts above index 2/3 are not visible so no need for a custom animation
|
|
104
|
+
dismissTransform: _ > 0 && _ < (o.value ? 4 : 3) ? `translateY(${(D - n.height) * -1}px) scale(0.5, 0.1)` : null,
|
|
105
|
+
isFirst: _ === 0,
|
|
106
|
+
isInert: _ > (o.value ? 2 : 0)
|
|
85
107
|
};
|
|
86
|
-
})
|
|
87
|
-
),
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
108
|
+
});
|
|
109
|
+
}), b = (a) => {
|
|
110
|
+
a.dataset.dismissTransform && (a.style.transform = a.dataset.dismissTransform);
|
|
111
|
+
}, y = d(() => {
|
|
112
|
+
let a = 0;
|
|
113
|
+
if (r.value >= 0) {
|
|
114
|
+
const n = f * Math.min(v.value - 1 - r.value, o.value ? 1 : 2);
|
|
115
|
+
a = Math.min(h.value + n, document.body.parentElement.clientHeight);
|
|
116
|
+
}
|
|
117
|
+
return `${a}px`;
|
|
94
118
|
});
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
toast: s
|
|
119
|
+
let p = null, g = null, i = 5e3;
|
|
120
|
+
const I = (a, n) => {
|
|
121
|
+
g = Date.now(), p = setTimeout(() => a.dismiss(), n);
|
|
122
|
+
}, x = (a) => {
|
|
123
|
+
clearTimeout(p), a ? (i = 5e3, o.value || I(a, i)) : i = 0;
|
|
101
124
|
};
|
|
125
|
+
k(
|
|
126
|
+
() => T.value[0],
|
|
127
|
+
(a, n) => {
|
|
128
|
+
(a == null ? void 0 : a.id) !== (n == null ? void 0 : n.id) && x(a);
|
|
129
|
+
},
|
|
130
|
+
{ immediate: !0 }
|
|
131
|
+
);
|
|
132
|
+
const A = () => {
|
|
133
|
+
i = i - Date.now() + g, clearTimeout(p);
|
|
134
|
+
}, C = () => {
|
|
135
|
+
i > 0 && I(T.value[0], i);
|
|
136
|
+
};
|
|
137
|
+
k(o, (a) => {
|
|
138
|
+
a ? A() : C();
|
|
139
|
+
});
|
|
140
|
+
const w = c();
|
|
141
|
+
return { __sfc: !0, TOAST_DISPLAY_DURATION: 5e3, renderToast: s, stack: e, hovered: o, toastsWithDimensions: l, collapsedToastHeight: m, stackIndicatorHeight: f, queueSize: v, lastVisibleToastIndex: r, lastVisibleToastBottom: h, queue: T, onBeforeToastLeave: b, stackHeight: y, dismissTimout: p, timeoutStart: g, remainingTimeToDismiss: i, startTimer: I, startNewDismissTimer: x, pauseDismissTimer: A, resumeDismissTimer: C, root: w, checkHover: () => setTimeout(() => {
|
|
142
|
+
o.value = o.value ? w.value.matches(":hover") : !1;
|
|
143
|
+
}), ToastShadowStack: K, ToastItem: H };
|
|
102
144
|
}
|
|
103
145
|
});
|
|
104
|
-
var
|
|
105
|
-
var t = this, s = t._self._c;
|
|
106
|
-
return
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
146
|
+
var Z = function() {
|
|
147
|
+
var t = this, s = t._self._c, e = t._self._setupProxy;
|
|
148
|
+
return e.renderToast ? s("div", { ref: "root", staticClass: "b-toast", style: { height: e.stackHeight }, attrs: { "data-testid": "toast" }, on: { mouseenter: function(o) {
|
|
149
|
+
e.hovered = !0;
|
|
150
|
+
}, mouseleave: function(o) {
|
|
151
|
+
e.hovered = !1;
|
|
152
|
+
} } }, [s(e.ToastShadowStack, { on: { update: function(o) {
|
|
153
|
+
e.toastsWithDimensions = o;
|
|
154
|
+
} } }), s("transition-group", { attrs: { name: "b-toast__queue", tag: "div", "aria-live": "polite", "enter-class": "b-toast__queue--enter", "leave-to-class": "b-toast__queue--leave-to" }, on: { "before-leave": e.onBeforeToastLeave, "after-leave": e.checkHover } }, t._l(e.queue, function(o) {
|
|
155
|
+
return s(e.ToastItem, t._b({ key: o.id, staticClass: "b-toast__item", class: { "b-toast__item--first": o.isFirst }, style: o.styles, attrs: { toast: o, inert: o.isInert, "data-testid": "toast-item" } }, "toast-item", { "data-dismiss-transform": o.dismissTransform }, !1));
|
|
156
|
+
}), 1)], 1) : t._e();
|
|
157
|
+
}, tt = [], et = /* @__PURE__ */ B(
|
|
158
|
+
Q,
|
|
159
|
+
Z,
|
|
160
|
+
tt,
|
|
115
161
|
!1,
|
|
116
162
|
null,
|
|
117
|
-
"
|
|
163
|
+
"9a3ea236",
|
|
118
164
|
null,
|
|
119
165
|
null
|
|
120
166
|
);
|
|
121
|
-
const
|
|
167
|
+
const ut = et.exports;
|
|
122
168
|
export {
|
|
123
|
-
|
|
124
|
-
y as useBentoToastController
|
|
169
|
+
ut as BentoToast
|
|
125
170
|
};
|
|
126
171
|
//# sourceMappingURL=toast.js.map
|
package/dist/toast.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast.js","sources":["../src/components/toast/components/toast-item/toast-item.vue","../src/components/toast/toast.vue"],"sourcesContent":["<template>\n <div class=\"b-toast-item\" data-testid=\"toast-item\">\n <div class=\"b-toast-item__container\">\n <info-icon\n class=\"b-toast-item__left-icon b-toast-item__info-icon\"\n name=\"info\"\n aria-hidden=\"true\"\n ></info-icon>\n <output role=\"status\">\n <bento-typography el=\"span\" variant=\"body\" strongest>\n {{ text }}\n </bento-typography>\n </output>\n </div>\n <div class=\"b-toast-item__container\">\n <bento-button v-if=\"action\" class=\"b-toast-item__right-icon\" variant=\"tertiary\" @click=\"onActionClicked\">\n {{ action.text }}\n </bento-button>\n <bento-button class=\"b-toast-item__right-icon\" variant=\"tertiary\" @click=\"dismissButtonClicked\">\n <template #iconLeft>\n <cross-icon :svg-title=\"$t('dismiss')\" />\n </template>\n </bento-button>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { defineComponent, PropType } from 'vue';\n import InfoIcon from '@adyen/ui-assets-icons-16/vue/info-filled';\n import CrossIcon from '@adyen/ui-assets-icons-16/vue/cross-small';\n import messages from './messages.json';\n import { BentoToastItemAction } from './toast-item.types';\n import { BentoButton } from '@/components/button';\n import { BentoTypography } from '@/components/typography';\n import { useHasSlot } from '@/composables';\n\n /**\n * @example\n * Toast item component, for internal use only.\n *\n * import { BentoToastItem } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoToastItem },\n * template: `\n * <bento-toast-item>\n * This is a toast message\n * <template #primaryAction>Button text</template>\n * </bento-toast-item>\n * `\n * }\n */\n export default defineComponent({\n i18n: { messages },\n name: 'toast-item',\n components: { BentoButton, BentoTypography, CrossIcon, InfoIcon },\n props: {\n text: {\n type: String,\n required: true,\n },\n action: {\n type: Object as PropType<BentoToastItemAction>,\n default: null,\n },\n },\n emits: ['click', 'dismiss'],\n setup(props, { slots, emit }) {\n const dismissButtonClicked = () => emit('dismiss');\n const onActionClicked = () => {\n props.action.handler();\n emit('dismiss');\n };\n\n return {\n // Methods\n dismissButtonClicked,\n hasSlot: useHasSlot(slots),\n onActionClicked,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./toast-item.scss\" />\n","<template>\n <div v-if=\"toastsToShow.length\" class=\"b-toast\" :style=\"computedHeight\">\n <transition-group\n name=\"b-toast\"\n tag=\"ul\"\n class=\"b-toast__container\"\n aria-live=\"polite\"\n move-class=\"b-toast__container--move\"\n enter-active-class=\"b-toast__container--enter-active\"\n leave-active-class=\"b-toast__container--leave-active\"\n enter-from-class=\"b-toast__container--enter-from\"\n leave-to-class=\"b-toast__container--leave-to\"\n >\n <li\n v-for=\"(item, index) in toastsToShow\"\n :key=\"index\"\n class=\"b-toast__item\"\n :style=\"computedPositioning[index]\"\n :inert=\"index !== toastsToShow.length - 1\"\n >\n <toast-item\n :ref=\"index === toastsToShow.length - 1 ? 'toast' : null\"\n :class=\"index !== toastsToShow.length - 1 ? 'b-toast--light-background' : null\"\n :text=\"item.text\"\n :action=\"item.action\"\n @dismiss=\"item.dismiss()\"\n />\n </li>\n </transition-group>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, onMounted, ref, watch } from 'vue';\n import { ToastItem } from './components/toast-item';\n import { useBentoToastController } from '@/utils/ts/toastController';\n\n const DURATION = 5000;\n\n /**\n * @example\n * import { BentoToast, useBentoToastController } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoToast },\n * template: `\n * // in your project root\n * <bento-toast />\n * setup() {\n * bentoToastController = useBentoToastController();\n * onTrigger = () => {\n * bentoToastController.addToast({ text: 'Your toast text', action: { text: 'Button text', handler: () => { your code here } });\n * }\n * `\n * }\n */\n export default defineComponent({\n name: 'bento-toast',\n components: { ToastItem },\n setup() {\n const { state } = useBentoToastController();\n const dismissTimer = ref(null);\n const toast = ref(null);\n const toastsToShow = computed(() => state.queue.slice(-3));\n\n const cancelDismissTimer = () => {\n clearTimeout(dismissTimer.value);\n };\n\n const startTimer = toastToDismiss => {\n dismissTimer.value = setTimeout(() => {\n cancelDismissTimer();\n toastToDismiss.dismiss();\n }, DURATION);\n };\n\n const startDismissTimer = () => {\n cancelDismissTimer();\n\n const toastToDismiss = toastsToShow.value.slice(-1)[0];\n if (toastToDismiss) {\n startTimer(toastToDismiss);\n }\n };\n\n onMounted(() => {\n startDismissTimer();\n });\n\n watch(\n () => toastsToShow.value,\n () => {\n if (toastsToShow.value.length) {\n cancelDismissTimer();\n startDismissTimer();\n }\n }\n );\n\n const computedPositioning = computed(() =>\n toastsToShow.value.map((el, index) => {\n const diff = 10;\n const width = 100;\n const min = 10;\n const numberOfElements = toastsToShow.value.length - 1;\n return {\n top: `${diff * index}px`,\n width: `${width - min * (numberOfElements - index)}%`,\n };\n })\n );\n\n const computedHeight = computed(() => {\n // Get shown toast element height (last in the queue)\n const visibleToastHeight = toast.value?.offsetWidth;\n // Get number of elements excluding the toast currently displayed\n const numberOfElements = toastsToShow.value.length - 1;\n // Set height = number of stacked elements\n const stackedToastHeight = 10;\n // Set a stack height only if there's elements present\n const stackHeight = numberOfElements ? stackedToastHeight * numberOfElements : 0;\n // Set bottom to be padding + height of the visible toast :)\n return {\n bottom: `${visibleToastHeight}px`,\n height: `${stackHeight}px`,\n };\n });\n\n return {\n // Values,\n computedPositioning,\n computedHeight,\n toastsToShow,\n toast,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./toast.scss\" />\n"],"names":["_sfc_main$1","defineComponent","messages","BentoButton","BentoTypography","CrossIcon","InfoIcon","props","slots","emit","dismissButtonClicked","onActionClicked","useHasSlot","DURATION","_sfc_main","ToastItem","state","useBentoToastController","dismissTimer","ref","toast","toastsToShow","computed","cancelDismissTimer","startTimer","toastToDismiss","startDismissTimer","onMounted","watch","computedPositioning","el","index","numberOfElements","computedHeight","visibleToastHeight","_a","stackHeight"],"mappings":";;;;;;;;;;;;;GAqDAA,IAAAC,EAAA;AAAA,EAAA,MAAA,EAAA,UAAAC,EAAA;AAAA,EACA,MAAA;AAAA,EACA,YAAA,EAAA,aAAAC,GAAA,iBAAAC,GAAA,WAAAC,GAAA,UAAAC,EAAA;AAAA,EACA,OAAA;AAAA,IACA,MAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AAAA,IACA;AAAA,IACA,QAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA,EACA;AAAA,EACA,OAAA,CAAA,SAAA,SAAA;AAAA,EACA,MAAAC,GAAA,EAAA,OAAAC,GAAA,MAAAC,EAAA,GAAA;AAEA,UAAAC,IAAA,MAAAD,EAAA,SAAA,GACAE,IAAA,MAAA;AACA,MAAAJ,EAAA,OAAA,QAAA,GACAE,EAAA,SAAA;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A,gBAAAe,EAAA,aAEAH,IAAAX,EAAA,MAAA,SAAA,GAIAe,IAAAJ,IAFA,KAEAA,IAAA;AAEA,aAAA;AAAA,QAAA,QAAA,GAAAE;AAAA,QACA,QAAA,GAAAE;AAAA,MACA;AAAA,IACA,CAAA;AAGA,WAAA;AAAA;AAAA,MAAA,qBAAAP;AAAA,MAEA,gBAAAI;AAAA,MACA,cAAAZ;AAAA,MACA,OAAAD;AAAA,IACA;AAAA,EACA;AAEA,CAAA;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"toast.js","sources":["../src/components/toast/components/toast-item/toast-item.vue","../src/components/toast/components/toast-shadow-stack/toast-shadow-stack.vue","../src/components/toast/toast.vue"],"sourcesContent":["<template>\n <div class=\"b-toast-item\">\n <output class=\"b-toast-item__text\" role=\"status\">\n <bento-typography :title=\"toast.text\" el=\"span\" variant=\"body\" strongest>\n {{ toast.text }}\n </bento-typography>\n </output>\n <bento-button\n v-if=\"toast.action\"\n class=\"b-toast-item__btn\"\n variant=\"tertiary\"\n data-testid=\"toast-item-action-btn\"\n @click=\"onAction\"\n >\n {{ toast.action.text }}\n </bento-button>\n <bento-button\n class=\"b-toast-item__btn\"\n variant=\"tertiary\"\n data-testid=\"toast-item-close-btn\"\n @click=\"toast.dismiss()\"\n >\n <template #iconLeft>\n <cross-icon :svg-title=\"t('dismiss')\" />\n </template>\n </bento-button>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { PropType } from 'vue';\n import CrossIcon from '@adyen/ui-assets-icons-16/vue/cross-small';\n import { useI18n } from '@/utils/ts/i18n';\n import { BentoButton } from '@/components/button';\n import { BentoTypography } from '@/components/typography';\n import type { BentoToastItem } from '@/composables';\n import messages from './messages.json';\n\n const props = defineProps({\n toast: { type: Object as PropType<BentoToastItem>, required: true },\n });\n\n type MessageSchema = (typeof messages)['en-US'];\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const onAction = () => {\n if (typeof props.toast.action.handler === 'function') {\n props.toast.action.handler();\n }\n props.toast.dismiss();\n };\n</script>\n\n<script lang=\"ts\">\n export default {\n i18n: { messages },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./toast-item.scss\" />\n","<template>\n <div ref=\"shadowStack\" class=\"b-toast-shadow-stack\">\n <!--\n since we only interested in the size of the last 3 toasts and order of the toast items\n is not guaranteed when we use ref with v-for (more info at the end of this section https://vuejs.org/guide/essentials/template-refs.html#refs-inside-v-for),\n toast items would be rendered independently with individual ref references.\n -->\n <toast-item v-if=\"toasts[0]\" ref=\"toast0\" :toast=\"toasts[0]\" />\n <toast-item v-if=\"toasts[1]\" ref=\"toast1\" :toast=\"toasts[1]\" />\n <toast-item v-if=\"toasts[2]\" ref=\"toast2\" :toast=\"toasts[2]\" />\n </div>\n</template>\n\n<script setup lang=\"ts\">\n /**\n * This component will \"shadow-render\" ToastItems positioned relatively to each other,\n * would grab their positions and size and would emit augmented list of toasts with those\n * additional details. This would allow us to have perfect control over toasts positioning and animation\n * in the parent Toast component, where ToastItems would actually be visible.\n */\n import { computed, nextTick, onMounted, ref, watch } from 'vue';\n import { useBentoToastController } from '@/composables';\n import type { BentoToastItemWithDimensions } from './toast-shadow-stack.types';\n import ToastItem from '../toast-item/toast-item.vue';\n\n const { stack } = useBentoToastController();\n\n const emit = defineEmits<{\n /**\n *\n */\n (e: 'update', toasts: Array<BentoToastItemWithDimensions>): void;\n }>();\n\n const shadowStack = ref<HTMLElement>();\n const toast0 = ref<InstanceType<typeof ToastItem>>();\n const toast1 = ref<InstanceType<typeof ToastItem>>();\n const toast2 = ref<InstanceType<typeof ToastItem>>();\n const toastRefs = [toast0, toast1, toast2];\n\n // only get 3 last toast as only they would be rendered on the screen\n const toasts = computed(() => stack.value.slice(0, 3));\n\n const shareToastsWithDimensions = async () => {\n // Wait for all toasts to render, so we would be able to get their ClientRect\n await nextTick();\n\n // Parent container \"top\" value should be 0, but can be something else due to CSS. So have to account for it\n const { top: parentTop } = shadowStack.value.getBoundingClientRect();\n\n const toastsWithDimensions = stack.value.map((toast, index) => {\n if (index > 2) {\n return { ...toast, bottom: 0, height: 0 };\n }\n const { height, top } = toastRefs[index].value.$el.getBoundingClientRect();\n return { ...toast, height, bottom: top - parentTop };\n });\n emit('update', toastsWithDimensions);\n };\n\n watch(stack, shareToastsWithDimensions);\n\n onMounted(() => {\n // Refs would be null until component is mounted, so let's make sure we only do it after that\n if (stack.value.length > 0) {\n shareToastsWithDimensions();\n }\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./toast-shadow-stack.scss\" />\n","<template>\n <div\n v-if=\"renderToast\"\n ref=\"root\"\n class=\"b-toast\"\n data-testid=\"toast\"\n :style=\"{ height: stackHeight }\"\n @mouseenter=\"hovered = true\"\n @mouseleave=\"hovered = false\"\n >\n <toast-shadow-stack @update=\"toastsWithDimensions = $event\" />\n\n <transition-group\n name=\"b-toast__queue\"\n tag=\"div\"\n aria-live=\"polite\"\n enter-class=\"b-toast__queue--enter\"\n leave-to-class=\"b-toast__queue--leave-to\"\n @before-leave=\"onBeforeToastLeave\"\n @after-leave=\"checkHover\"\n >\n <toast-item\n v-for=\"toast in queue\"\n v-bind=\"{ 'data-dismiss-transform': toast.dismissTransform }\"\n :key=\"toast.id\"\n :toast=\"toast\"\n :style=\"toast.styles\"\n :class=\"{ 'b-toast__item--first': toast.isFirst }\"\n :inert=\"toast.isInert\"\n data-testid=\"toast-item\"\n class=\"b-toast__item\"\n />\n </transition-group>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, ref, watch } from 'vue';\n import { useBentoToastController } from '@/composables';\n import ToastShadowStack from './components/toast-shadow-stack/toast-shadow-stack.vue';\n import type { BentoToastItemWithDimensions } from './components/toast-shadow-stack/toast-shadow-stack.types';\n import ToastItem from './components/toast-item/toast-item.vue';\n\n // By design, top-most toast should be visible for 5 seconds before auto-dismiss\n const TOAST_DISPLAY_DURATION = 5000;\n\n // Delay first render of the toast until we actually need it, to skip all the positioning calculation logic\n // until we actually have anything to render.\n const renderToast = ref(false);\n const { stack } = useBentoToastController();\n\n watch(\n stack,\n toastStack => {\n if (toastStack.length > 0 && !renderToast.value) {\n renderToast.value = true;\n }\n },\n { immediate: true }\n );\n\n const hovered = ref(false);\n const toastsWithDimensions = ref<Array<BentoToastItemWithDimensions>>([]);\n // In collapsed mode we need for toast to \"stick out\", but not overflow another toast in the forefront.\n // Random number that satisfies this condition (single-line toast is roughly 52px height)\n const collapsedToastHeight = 40;\n // How much pixels of the stacked toast will be \"sticking out\" from the visible toast\n const stackIndicatorHeight = 10;\n\n const queueSize = computed(() => toastsWithDimensions.value.length);\n const lastVisibleToastIndex = computed(() => Math.min(hovered.value ? 2 : 0, queueSize.value - 1));\n const lastVisibleToastBottom = computed(() => {\n const toast = toastsWithDimensions.value[lastVisibleToastIndex.value];\n return toast ? toast.bottom + toast.height : 0;\n });\n\n const queue = computed(() => {\n const translateBaseValue = lastVisibleToastBottom.value - collapsedToastHeight;\n return toastsWithDimensions.value.map((toast, index) => {\n const collapsed = index > lastVisibleToastIndex.value;\n const isSmallerStack = !hovered.value && index > 1;\n const translateY = collapsed\n ? translateBaseValue + stackIndicatorHeight * (isSmallerStack ? 2 : 1)\n : toast.bottom;\n\n return {\n ...toast,\n styles: {\n height: `${collapsed ? collapsedToastHeight : toast.height}px`,\n transform: collapsed\n ? `translateY(${translateY * -1}px) scaleX(${isSmallerStack ? '0.8' : '0.9'})`\n : `translateY(${translateY * -1}px)`,\n 'z-index': queueSize.value - index,\n },\n // first toast has different animation, and toasts above index 2/3 are not visible so no need for a custom animation\n dismissTransform:\n index > 0 && index < (hovered.value ? 4 : 3)\n ? `translateY(${(translateY - toast.height) * -1}px) scale(0.5, 0.1)`\n : null,\n isFirst: index === 0,\n isInert: index > (hovered.value ? 2 : 0),\n };\n });\n });\n\n const onBeforeToastLeave = (el: HTMLElement) => {\n // We have to swap transformation on the toast element that is about to be removed\n // Unfortunately we cannot do it via transition classes as transformation function is\n // unique per toast, and we cannot use reactivity because it won't be applied for a toast\n // that is removed. So direct DOM manipulation is the only way it seems.\n if (el.dataset.dismissTransform) {\n /* eslint-disable no-param-reassign -- explicitly manipulating with DOM properties, no way around it unfortunately */\n el.style.transform = el.dataset.dismissTransform;\n }\n };\n\n const stackHeight = computed(() => {\n // Track stack container height, so that hover over would work without glitches\n // (when mouse is over space between toasts)\n let height = 0;\n if (lastVisibleToastIndex.value >= 0) {\n const stackIndicator =\n stackIndicatorHeight *\n Math.min(queueSize.value - 1 - lastVisibleToastIndex.value, hovered.value ? 1 : 2);\n height = Math.min(lastVisibleToastBottom.value + stackIndicator, document.body.parentElement.clientHeight);\n }\n return `${height}px`;\n });\n\n let dismissTimout = null;\n let timeoutStart = null;\n let remainingTimeToDismiss = TOAST_DISPLAY_DURATION;\n\n const startTimer = (toast, duration) => {\n timeoutStart = Date.now();\n dismissTimout = setTimeout(() => toast.dismiss(), duration);\n };\n\n const startNewDismissTimer = toast => {\n // stop previous timeouts, if any\n clearTimeout(dismissTimout);\n if (toast) {\n remainingTimeToDismiss = TOAST_DISPLAY_DURATION;\n if (!hovered.value) {\n startTimer(toast, remainingTimeToDismiss);\n }\n } else {\n remainingTimeToDismiss = 0;\n }\n };\n\n watch(\n () => queue.value[0],\n (firstToast, oldFirstToast) => {\n if (firstToast?.id === oldFirstToast?.id) {\n return;\n }\n startNewDismissTimer(firstToast);\n },\n { immediate: true }\n );\n\n const pauseDismissTimer = () => {\n remainingTimeToDismiss = remainingTimeToDismiss - Date.now() + timeoutStart;\n clearTimeout(dismissTimout);\n };\n\n const resumeDismissTimer = () => {\n if (remainingTimeToDismiss > 0) {\n startTimer(queue.value[0], remainingTimeToDismiss);\n }\n };\n\n watch(hovered, isHovered => {\n if (isHovered) {\n pauseDismissTimer();\n } else {\n resumeDismissTimer();\n }\n });\n\n const root = ref<HTMLElement>();\n // \"mouseleave\" event would be emitted for the root element when the mouse moves out of the root element,\n // but browser wouldn't emit this event when root element shrinks to the point when mouse is not over element anymore.\n // This can happen when user clicks on dismiss button the top-most toast and doesn't move the mouse during animation,\n // after which browser would think that root element is still hovered. This workaround addresses this particular issue.\n const checkHover = () =>\n setTimeout(() => {\n hovered.value = hovered.value ? root.value.matches(':hover') : false;\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./toast.scss\" />\n"],"names":["__default__","messages","t","useI18n","props","stack","useBentoToastController","shadowStack","ref","toast0","toast1","toast2","toastRefs","toasts","computed","shareToastsWithDimensions","nextTick","parentTop","toastsWithDimensions","toast","index","height","top","emit","watch","onMounted","renderToast","toastStack","hovered","collapsedToastHeight","stackIndicatorHeight","queueSize","lastVisibleToastIndex","lastVisibleToastBottom","queue","translateBaseValue","collapsed","isSmallerStack","translateY","onBeforeToastLeave","el","stackHeight","stackIndicator","dismissTimout","timeoutStart","remainingTimeToDismiss","startTimer","duration","startNewDismissTimer","firstToast","oldFirstToast","pauseDismissTimer","resumeDismissTimer","isHovered","root"],"mappings":";;;;;;;;;;;;;GAsDIA,IAAA;AAAA,EAAe,MAAA,EAAA,UAAAC,EAAA;AAEf;;;;;;;iBAbA,EAAA,GAAAC,EAAA,IAAAC,EAAA;kDAEA,MAAA;AACI,MAAA,OAAAC,EAAA,MAAA,OAAA,WAAA,cACIA,EAAA,MAAA,OAAA,QAAA,GAEJA,EAAA,MAAA,QAAA;AAAA,IAAoB;;;;;;;;;;;;;;;;;;;;;;;;ACxBxB,UAAA,EAAA,OAAAC,EAAA,IAAAC,EAAA,GASAC,IAAAC,EAAA,GACAC,IAAAD,EAAA,GACAE,IAAAF,EAAA,GACAG,IAAAH,EAAA,GACAI,IAAA,CAAAH,GAAAC,GAAAC,CAAA,GAGAE,IAAAC,EAAA,MAAAT,EAAA,MAAA,MAAA,GAAA,CAAA,CAAA,GAEAU,IAAA,YAAA;AAEI,YAAAC,EAAA;AAGA,YAAA,EAAA,KAAAC,EAAA,IAAAV,EAAA,MAAA,sBAAA,GAEAW,IAAAb,EAAA,MAAA,IAAA,CAAAc,GAAAC,MAAA;AACI,YAAAA,IAA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,MAAAU,EAAA,MAAA,CAAA;AAAA,MACuB,CAAAe,GAAAC,MAAA;AAEf,SAAAD,KAAA,gBAAAA,EAAA,SAAAC,KAAA,gBAAAA,EAAA,OAGAF,EAAAC,CAAA;AAAA,MAA+B;AAAA,MACnC,EAAA,WAAA,GAAA;AAAA,IACkB;AAGtB,UAAAE,IAAA,MAAA;AACI,MAAAN,IAAAA,IAAA,KAAA,IAAA,IAAAD,GACA,aAAAD,CAAA;AAAA,IAA0B,GAG9BS,IAAA,MAAA;AACI,MAAAP,IAAA,KACIC,EAAAZ,EAAA,MAAA,CAAA,GAAAW,CAAA;AAAA,IACJ;AAGJ,IAAArB,EAAAI,GAAA,CAAAyB,MAAA;AACI,MAAAA,IACIF,EAAA,IAEAC,EAAA;AAAA,IACJ,CAAA;AAGJ,UAAAE,IAAA9C,EAAA;kcAKA,MAAA,WAAA,MAAA;AAEQ,MAAAoB,EAAA,QAAAA,EAAA,QAAA0B,EAAA,MAAA,QAAA,QAAA,IAAA;AAAA,IAA+D,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/toggle.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { defineComponent as k, ref as p, computed as u, toRefs as I, watch as A } from "vue";
|
|
2
|
-
import { C as B } from "./chunks/checkmark-small.
|
|
3
|
-
import { B as L } from "./chunks/index.
|
|
2
|
+
import { C as B } from "./chunks/checkmark-small.520f01b1.js";
|
|
3
|
+
import { B as L } from "./chunks/index.ba6c1040.js";
|
|
4
4
|
import { g as E } from "./chunks/unique-id.a2a2b458.js";
|
|
5
5
|
import { u as F } from "./chunks/use-default-slot-validator.b9bff4c6.js";
|
|
6
6
|
import { u as R } from "./chunks/use-has-slot.fbeb19ec.js";
|
|
7
7
|
import { g } from "./chunks/get-slot-text.99c3d860.js";
|
|
8
8
|
import { u as x } from "./chunks/aria-label.ac9651a5.js";
|
|
9
9
|
import { n as T } from "./chunks/_plugin-vue2_normalizer.71e2aa87.js";
|
|
10
|
-
import "./assets/
|
|
10
|
+
import "./assets/index47.css";
|
|
11
11
|
var f = /* @__PURE__ */ ((t) => (t.LABEL_FIRST = "label-first", t))(f || {}), d = /* @__PURE__ */ ((t) => (t.BEFORE = "before", t.AFTER = "after", t))(d || {});
|
|
12
12
|
const D = k({
|
|
13
13
|
name: "bento-toggle",
|
package/dist/tutorial.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { defineComponent as g, ref as d, computed as a, isRef as R, watch as F, nextTick as $ } from "vue";
|
|
2
|
-
import { B as I } from "./chunks/index.
|
|
3
|
-
import { B as S, a as P } from "./chunks/index.
|
|
4
|
-
import { B as k } from "./chunks/index.
|
|
2
|
+
import { B as I } from "./chunks/index.87180cdd.js";
|
|
3
|
+
import { B as S, a as P } from "./chunks/index.5d5f2200.js";
|
|
4
|
+
import { B as k } from "./chunks/index.ba6c1040.js";
|
|
5
5
|
import { BentoImage as w } from "./image.js";
|
|
6
6
|
import { u as A } from "./chunks/i18n.eb5b985b.js";
|
|
7
|
-
import { R as N } from "./chunks/refresh.
|
|
7
|
+
import { R as N } from "./chunks/refresh.71a03998.js";
|
|
8
8
|
import { n as f } from "./chunks/_plugin-vue2_normalizer.71e2aa87.js";
|
|
9
|
-
import { a as T, h as D, o as M } from "./chunks/index.
|
|
10
|
-
import { B as V } from "./chunks/button-actions.
|
|
11
|
-
import "./assets/
|
|
9
|
+
import { a as T, h as D, o as M } from "./chunks/index.51308a21.js";
|
|
10
|
+
import { B as V } from "./chunks/button-actions.239456cb.js";
|
|
11
|
+
import "./assets/index41.css";
|
|
12
12
|
var E;
|
|
13
13
|
const j = /* @__PURE__ */ g({
|
|
14
14
|
__name: "tutorial-indicator",
|
package/dist/typography.js
CHANGED