@adyen/bento-vue3 1.26.0 → 1.27.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/@types/components.d.ts +4 -0
- package/dist/@types/packages/core/src/utils/ts/storybook.d.ts +12 -0
- package/dist/@types/packages/vue2/src/components/button/components/button-actions/button-actions.types.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/button/components/button-actions/button-actions.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/code-snippet/code-snippet.types.d.ts +2 -1
- package/dist/@types/packages/vue2/src/components/code-snippet/code-snippet.vue.d.ts +3 -3
- package/dist/@types/packages/vue2/src/components/code-snippet/utils/get-lang-loader.d.ts +2 -1
- package/dist/@types/packages/vue2/src/components/data-grid/composables/use-calculate-column-width/use-calculate-column-width.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/data-grid/composables/use-column-hovering/use-column-hovering.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/data-grid/composables/use-column-reorderer/use-column-reorderer.d.ts +2 -0
- package/dist/@types/packages/vue2/src/components/data-grid/composables/use-config-settings/use-config-settings.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/data-grid/composables/use-resizer.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/data-grid/data-grid.types.d.ts +2 -1
- package/dist/@types/packages/vue2/src/components/data-grid/data-grid.vue.d.ts +15 -0
- package/dist/@types/packages/vue2/src/components/dropdown/components/dropdown-options-container/dropdown-options-container.vue.d.ts +1 -18
- package/dist/@types/packages/vue2/src/components/filter-bar/components/all-filters-modal/all-filters-modal.vue.d.ts +12 -0
- package/dist/@types/packages/vue2/src/components/structured-list/components/structered-list-item/structured-list-item.vue.d.ts +36 -54
- package/dist/@types/packages/vue2/src/components/structured-list/structured-list.vue.d.ts +27 -22
- package/dist/@types/packages/vue2/src/components/tabs/tabs.vue.d.ts +76 -1
- package/dist/@types/packages/vue2/src/components/tutorial/tutorial.vue.d.ts +21 -2
- package/dist/@types/packages/vue2/src/index.d.ts +1 -0
- package/dist/@types/packages/vue2/src/templates/dashboard-template/components/dashboard-section/dashboard-section.vue.d.ts +78 -0
- package/dist/@types/packages/vue2/src/templates/dashboard-template/dashboard-template.types.d.ts +8 -0
- package/dist/@types/packages/vue2/src/templates/dashboard-template/dashboard-template.vue.d.ts +103 -0
- package/dist/@types/packages/vue2/src/templates/dashboard-template/index.d.ts +3 -0
- package/dist/@types/packages/vue2/src/utils/ts/storybook.d.ts +1 -12
- package/dist/accordion.js +3 -3
- package/dist/action-bar.js +71 -155
- package/dist/action-bar.js.map +1 -1
- package/dist/alert.js +6 -6
- package/dist/assets/base-modal.css +1 -1
- package/dist/assets/button-actions.css +1 -1
- package/dist/assets/button.css +1 -1
- package/dist/assets/dialog-page.css +1 -1
- package/dist/assets/dropdown.css +1 -1
- package/dist/assets/index.css +1 -1
- package/dist/assets/index10.css +1 -1
- package/dist/assets/index11.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/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/index49.css +1 -0
- 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/assets/use-cached-selected-values.css +1 -1
- package/dist/avatar-image.js +1 -1
- package/dist/badge.js +1 -1
- package/dist/button.js +4 -4
- package/dist/card.js +4 -4
- package/dist/checkbox.js +6 -6
- package/dist/chunks/{base-button.e84acf30.js → base-button.a0140a4c.js} +2 -2
- package/dist/chunks/{base-button.e84acf30.js.map → base-button.a0140a4c.js.map} +1 -1
- package/dist/chunks/{base-modal.29e062d0.js → base-modal.4102f69d.js} +7 -7
- package/dist/chunks/{base-modal.29e062d0.js.map → base-modal.4102f69d.js.map} +1 -1
- package/dist/chunks/{button-actions-with-menu.7fce47a2.js → button-actions-with-menu.4f311411.js} +4 -4
- package/dist/chunks/{button-actions-with-menu.7fce47a2.js.map → button-actions-with-menu.4f311411.js.map} +1 -1
- package/dist/chunks/{button-actions.642b37de.js → button-actions.82163994.js} +42 -40
- package/dist/chunks/button-actions.82163994.js.map +1 -0
- package/dist/chunks/{button.60dad578.js → button.ae4760cd.js} +27 -26
- package/dist/chunks/button.ae4760cd.js.map +1 -0
- package/dist/chunks/{calendar.f38cdab9.js → calendar.a9c5a68c.js} +6 -6
- package/dist/chunks/{calendar.f38cdab9.js.map → calendar.a9c5a68c.js.map} +1 -1
- package/dist/chunks/{checkbox-input.ab758a81.js → checkbox-input.99336948.js} +2 -2
- package/dist/chunks/{checkbox-input.ab758a81.js.map → checkbox-input.99336948.js.map} +1 -1
- package/dist/chunks/{checkbox.f55ee3a5.js → checkbox.9c30c07b.js} +4 -4
- package/dist/chunks/{checkbox.f55ee3a5.js.map → checkbox.9c30c07b.js.map} +1 -1
- package/dist/chunks/{checkmark-circle-fill.f3a69c6a.js → checkmark-circle-fill.c45a999d.js} +2 -2
- package/dist/chunks/{checkmark-circle-fill.f3a69c6a.js.map → checkmark-circle-fill.c45a999d.js.map} +1 -1
- package/dist/chunks/{checkmark-small.d7e31e5e.js → checkmark-small.c79220d9.js} +2 -2
- package/dist/chunks/{checkmark-small.d7e31e5e.js.map → checkmark-small.c79220d9.js.map} +1 -1
- package/dist/chunks/{chevron-left.963d35e9.js → chevron-left.4ee92950.js} +2 -2
- package/dist/chunks/{chevron-left.963d35e9.js.map → chevron-left.4ee92950.js.map} +1 -1
- package/dist/chunks/{chevron-up.05ca20db.js → chevron-up.638a9f34.js} +2 -2
- package/dist/chunks/{chevron-up.05ca20db.js.map → chevron-up.638a9f34.js.map} +1 -1
- package/dist/chunks/{controls-group.9e0f17b2.js → controls-group.8357e3fd.js} +3 -3
- package/dist/chunks/{controls-group.9e0f17b2.js.map → controls-group.8357e3fd.js.map} +1 -1
- package/dist/chunks/{copy.852d4cb8.js → copy.60ee6ac3.js} +4 -4
- package/dist/chunks/{copy.852d4cb8.js.map → copy.60ee6ac3.js.map} +1 -1
- package/dist/chunks/{cross-circle-fill.81925c7f.js → cross-circle-fill.1abec1a2.js} +2 -2
- package/dist/chunks/{cross-circle-fill.81925c7f.js.map → cross-circle-fill.1abec1a2.js.map} +1 -1
- package/dist/chunks/{cross-small.9bc6a02f.js → cross-small.b85406fe.js} +2 -2
- package/dist/chunks/{cross-small.9bc6a02f.js.map → cross-small.b85406fe.js.map} +1 -1
- package/dist/chunks/{cross.a60533f6.js → cross.26509efc.js} +2 -2
- package/dist/chunks/{cross.a60533f6.js.map → cross.26509efc.js.map} +1 -1
- package/dist/chunks/{dialog-page.ea67bb14.js → dialog-page.cb6ce9b6.js} +3 -3
- package/dist/chunks/{dialog-page.ea67bb14.js.map → dialog-page.cb6ce9b6.js.map} +1 -1
- package/dist/chunks/{dropdown-default-textbox.ad5063c2.js → dropdown-default-textbox.cda0798f.js} +5 -5
- package/dist/chunks/{dropdown-default-textbox.ad5063c2.js.map → dropdown-default-textbox.cda0798f.js.map} +1 -1
- package/dist/chunks/{dropdown.d8587f36.js → dropdown.0ae3b842.js} +122 -132
- package/dist/chunks/dropdown.0ae3b842.js.map +1 -0
- package/dist/chunks/{error-message.3fb5573a.js → error-message.d2bdeb80.js} +3 -3
- package/dist/chunks/{error-message.3fb5573a.js.map → error-message.d2bdeb80.js.map} +1 -1
- package/dist/chunks/{events.58c00e6d.js → events.f14a214b.js} +5 -5
- package/dist/chunks/events.f14a214b.js.map +1 -0
- package/dist/chunks/{fixed-scroller.59aefd1b.js → fixed-scroller.7b42cb1e.js} +3 -3
- package/dist/chunks/{fixed-scroller.59aefd1b.js.map → fixed-scroller.7b42cb1e.js.map} +1 -1
- package/dist/chunks/{footer-actions.89e68269.js → footer-actions.64f6f5d8.js} +4 -4
- package/dist/chunks/{footer-actions.89e68269.js.map → footer-actions.64f6f5d8.js.map} +1 -1
- package/dist/chunks/{index.96cd0d4c.js → index.2d7b4511.js} +15 -15
- package/dist/chunks/{index.96cd0d4c.js.map → index.2d7b4511.js.map} +1 -1
- package/dist/chunks/index.2fcd1233.js +103 -0
- package/dist/chunks/index.2fcd1233.js.map +1 -0
- package/dist/chunks/{index.9bf04b01.js → index.6295e754.js} +3 -3
- package/dist/chunks/{index.9bf04b01.js.map → index.6295e754.js.map} +1 -1
- package/dist/chunks/{index.030c1dd7.js → index.6bb6f38c.js} +7 -7
- package/dist/chunks/{index.030c1dd7.js.map → index.6bb6f38c.js.map} +1 -1
- package/dist/chunks/{index.ba3396d3.js → index.8aa536a8.js} +3 -3
- package/dist/chunks/{index.ba3396d3.js.map → index.8aa536a8.js.map} +1 -1
- package/dist/chunks/{index.8be283d5.js → index.9d7fb316.js} +2 -2
- package/dist/chunks/{index.8be283d5.js.map → index.9d7fb316.js.map} +1 -1
- package/dist/chunks/{index.5bdebf9d.js → index.a001a0a8.js} +7 -7
- package/dist/chunks/{index.5bdebf9d.js.map → index.a001a0a8.js.map} +1 -1
- package/dist/chunks/{index.07122048.js → index.b18c78d6.js} +2 -2
- package/dist/chunks/{index.07122048.js.map → index.b18c78d6.js.map} +1 -1
- package/dist/chunks/{index.6e0e9d21.js → index.eb38a6c4.js} +3 -3
- package/dist/chunks/{index.6e0e9d21.js.map → index.eb38a6c4.js.map} +1 -1
- package/dist/chunks/{index.a3d60e4f.js → index.ee15db35.js} +2 -2
- package/dist/chunks/{index.a3d60e4f.js.map → index.ee15db35.js.map} +1 -1
- package/dist/chunks/{index.146f967e.js → index.f9d081d2.js} +2 -2
- package/dist/chunks/{index.146f967e.js.map → index.f9d081d2.js.map} +1 -1
- package/dist/chunks/index.fedbb4c2.js +125 -0
- package/dist/chunks/index.fedbb4c2.js.map +1 -0
- package/dist/chunks/{info.205b4496.js → info.550f9511.js} +2 -2
- package/dist/chunks/{info.205b4496.js.map → info.550f9511.js.map} +1 -1
- package/dist/chunks/{keyboard-navigation.ca47dfa8.js → keyboard-navigation.bbc3d15c.js} +2 -2
- package/dist/chunks/{keyboard-navigation.ca47dfa8.js.map → keyboard-navigation.bbc3d15c.js.map} +1 -1
- package/dist/chunks/{listbox-option-tag.b6182b2e.js → listbox-option-tag.2aea037c.js} +3 -3
- package/dist/chunks/{listbox-option-tag.b6182b2e.js.map → listbox-option-tag.2aea037c.js.map} +1 -1
- package/dist/chunks/{loading-button.0391ad8b.js → loading-button.6b81b546.js} +4 -4
- package/dist/chunks/{loading-button.0391ad8b.js.map → loading-button.6b81b546.js.map} +1 -1
- package/dist/chunks/{payment-method.31a68b9b.js → payment-method.d5595a7c.js} +2 -2
- package/dist/chunks/{payment-method.31a68b9b.js.map → payment-method.d5595a7c.js.map} +1 -1
- package/dist/chunks/{refresh.53691839.js → refresh.bd60f6a8.js} +2 -2
- package/dist/chunks/{refresh.53691839.js.map → refresh.bd60f6a8.js.map} +1 -1
- package/dist/chunks/{search.4e4ee4dd.js → search.ade93bda.js} +2 -2
- package/dist/chunks/{search.4e4ee4dd.js.map → search.ade93bda.js.map} +1 -1
- package/dist/chunks/{tooltip.1084d92b.js → tooltip.36172265.js} +4 -4
- package/dist/chunks/{tooltip.1084d92b.js.map → tooltip.36172265.js.map} +1 -1
- package/dist/chunks/{use-bento-toast-controller.98d8613c.js → use-bento-toast-controller.3dc4e113.js} +2 -2
- package/dist/chunks/{use-bento-toast-controller.98d8613c.js.map → use-bento-toast-controller.3dc4e113.js.map} +1 -1
- package/dist/chunks/{use-cached-selected-values.852aeafe.js → use-cached-selected-values.3c312296.js} +396 -375
- package/dist/chunks/use-cached-selected-values.3c312296.js.map +1 -0
- package/dist/code-snippet.js +137 -135
- package/dist/code-snippet.js.map +1 -1
- package/dist/country.js +2 -2
- package/dist/currency.js +1 -1
- package/dist/dashboard-template.js +169 -0
- package/dist/dashboard-template.js.map +1 -0
- package/dist/data-grid-template.js +1 -1
- package/dist/data-grid.js +52 -44
- package/dist/data-grid.js.map +1 -1
- package/dist/date-picker.js +19 -19
- 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 +85 -83
- 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 +66 -63
- package/dist/index.js.map +1 -1
- package/dist/info-icon.js +4 -4
- package/dist/input-field.js +4 -4
- 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 +66 -72
- package/dist/segmented-control.js.map +1 -1
- package/dist/selection-card.js +5 -5
- package/dist/sidepanel.js +7 -7
- package/dist/status.js +2 -2
- package/dist/stepper.js +5 -5
- package/dist/structured-list.js +1 -1
- package/dist/summary-grid.js +3 -3
- package/dist/tabs.js +80 -78
- package/dist/tabs.js.map +1 -1
- package/dist/tag.js +3 -3
- package/dist/textarea.js +4 -4
- package/dist/timeline.js +7 -7
- package/dist/toast.js +4 -4
- package/dist/toggle.js +3 -3
- package/dist/tutorial.js +125 -110
- package/dist/tutorial.js.map +1 -1
- package/dist/typography.js +1 -1
- package/dist/web-types.json +1 -1
- package/package.json +8 -6
- package/dist/chunks/button-actions.642b37de.js.map +0 -1
- package/dist/chunks/button.60dad578.js.map +0 -1
- package/dist/chunks/checkmark.87919b24.js +0 -29
- package/dist/chunks/checkmark.87919b24.js.map +0 -1
- package/dist/chunks/dropdown.d8587f36.js.map +0 -1
- package/dist/chunks/events.58c00e6d.js.map +0 -1
- package/dist/chunks/index.c8ffede1.js +0 -168
- package/dist/chunks/index.c8ffede1.js.map +0 -1
- package/dist/chunks/use-cached-selected-values.852aeafe.js.map +0 -1
- /package/dist/assets/{checkmark-circle-fill.css → cross.css} +0 -0
package/dist/tutorial.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { B as Y } from "./chunks/index.
|
|
3
|
-
import { B as
|
|
4
|
-
import { B as $ } from "./chunks/index.
|
|
1
|
+
import { defineComponent as k, ref as B, openBlock as c, createBlock as O, unref as o, withCtx as v, createElementVNode as p, normalizeStyle as q, createElementBlock as b, mergeProps as N, toDisplayString as E, createCommentVNode as S, computed as l, isRef as Z, watch as I, nextTick as z, createVNode as y, withKeys as H, createSlots as U, createTextVNode as R, renderSlot as W, pushScopeId as X, popScopeId as G, Fragment as J, renderList as Q } from "vue";
|
|
2
|
+
import { B as Y } from "./chunks/index.6bb6f38c.js";
|
|
3
|
+
import { B as P, a as tt } from "./chunks/index.a001a0a8.js";
|
|
4
|
+
import { B as $ } from "./chunks/index.ee15db35.js";
|
|
5
5
|
import { BentoImage as et } from "./image.js";
|
|
6
6
|
import { u as ot } from "./chunks/i18n.f7e6533e.js";
|
|
7
|
-
import { R as st } from "./chunks/refresh.
|
|
8
|
-
import { _ as
|
|
9
|
-
import { a as
|
|
10
|
-
import { B as it } from "./chunks/button-actions.
|
|
11
|
-
import "./assets/
|
|
12
|
-
var
|
|
13
|
-
const lt = /* @__PURE__ */
|
|
7
|
+
import { R as st } from "./chunks/refresh.bd60f6a8.js";
|
|
8
|
+
import { _ as F } from "./chunks/_plugin-vue_export-helper.dad06003.js";
|
|
9
|
+
import { a as A, h as nt, o as at } from "./chunks/index.6295e754.js";
|
|
10
|
+
import { B as it } from "./chunks/button-actions.82163994.js";
|
|
11
|
+
import "./assets/index37.css";
|
|
12
|
+
var V;
|
|
13
|
+
const lt = /* @__PURE__ */ k({
|
|
14
14
|
__name: "tutorial-indicator",
|
|
15
15
|
props: {
|
|
16
16
|
/**
|
|
@@ -18,25 +18,25 @@ const lt = /* @__PURE__ */ R({
|
|
|
18
18
|
* The indicator will position itself around the target element.
|
|
19
19
|
*/
|
|
20
20
|
targetElement: {
|
|
21
|
-
type: (
|
|
21
|
+
type: (V = A.props) == null ? void 0 : V.targetElement.type,
|
|
22
22
|
required: !0
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
setup(t) {
|
|
26
|
-
const e =
|
|
26
|
+
const e = B({
|
|
27
27
|
width: "0",
|
|
28
28
|
height: "0",
|
|
29
29
|
borderRadius: "0"
|
|
30
30
|
});
|
|
31
|
-
function
|
|
31
|
+
function u(d) {
|
|
32
32
|
try {
|
|
33
|
-
const
|
|
34
|
-
return Number.isNaN(
|
|
33
|
+
const _ = parseFloat(getComputedStyle(d).getPropertyValue("border-radius"));
|
|
34
|
+
return Number.isNaN(_) ? "" : `${_ + 2 * 2}px`;
|
|
35
35
|
} catch {
|
|
36
36
|
return "";
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
const
|
|
39
|
+
const a = [
|
|
40
40
|
nt(),
|
|
41
41
|
at({
|
|
42
42
|
mainAxis: 2,
|
|
@@ -44,15 +44,15 @@ const lt = /* @__PURE__ */ R({
|
|
|
44
44
|
}),
|
|
45
45
|
{
|
|
46
46
|
name: "updateIndicatorSize",
|
|
47
|
-
fn: ({ x:
|
|
48
|
-
const
|
|
49
|
-
return e.value.width = `${
|
|
47
|
+
fn: ({ x: d, y: _, elements: s }) => {
|
|
48
|
+
const n = s.reference;
|
|
49
|
+
return e.value.width = `${n.offsetWidth + 4 * 2}px`, e.value.height = `${n.offsetHeight + 4 * 2}px`, e.value.borderRadius = u(n), { x: d, y: _ };
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
];
|
|
53
|
-
return (
|
|
53
|
+
return (d, _) => (c(), O(o(A), {
|
|
54
54
|
"target-element": t.targetElement,
|
|
55
|
-
middleware:
|
|
55
|
+
middleware: a,
|
|
56
56
|
position: "top-start",
|
|
57
57
|
"fixed-positioning": "",
|
|
58
58
|
"disabled-focus-trap": "",
|
|
@@ -60,53 +60,53 @@ const lt = /* @__PURE__ */ R({
|
|
|
60
60
|
"data-testid": "tutorial-indicator"
|
|
61
61
|
}, {
|
|
62
62
|
default: v(() => [
|
|
63
|
-
|
|
63
|
+
p("div", {
|
|
64
64
|
class: "b-tutorial-indicator__highlight",
|
|
65
|
-
style:
|
|
65
|
+
style: q(e.value)
|
|
66
66
|
}, null, 4)
|
|
67
67
|
]),
|
|
68
68
|
_: 1
|
|
69
69
|
}, 8, ["target-element"]));
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
|
-
const rt = /* @__PURE__ */
|
|
73
|
-
let
|
|
72
|
+
const rt = /* @__PURE__ */ F(lt, [["__scopeId", "data-v-672deffb"]]);
|
|
73
|
+
let D = 0;
|
|
74
74
|
const ut = {
|
|
75
75
|
beforeCreate() {
|
|
76
|
-
this.uuid =
|
|
76
|
+
this.uuid = D.toString(), D += 1;
|
|
77
77
|
}
|
|
78
|
-
}, ct = { key: 0 }, pt = ["clip-path"], dt = /* @__PURE__ */
|
|
78
|
+
}, ct = { key: 0 }, pt = ["clip-path"], dt = /* @__PURE__ */ p("path", {
|
|
79
79
|
fill: "#00112C",
|
|
80
80
|
d: "M9.51195 0.398918C8.00859 0.0998821 6.45033 0.253358 5.0342 0.839937C3.61808 1.42652 2.40769 2.41985 1.55611 3.69433C0.704529 4.96881 0.25 6.4672 0.25 8C0.25 10.0554 1.06652 12.0267 2.51992 13.4801C3.97333 14.9335 5.94457 15.75 8 15.75C9.53281 15.75 11.0312 15.2955 12.3057 14.4439C13.5801 13.5923 14.5735 12.3819 15.1601 10.9658C15.7466 9.54967 15.9001 7.99141 15.6011 6.48805C15.3021 4.9847 14.5639 3.60378 13.4801 2.51993C12.3962 1.43607 11.0153 0.697953 9.51195 0.398918ZM5.60823 2.22576C6.75027 1.75271 8.00693 1.62894 9.21931 1.8701C10.4317 2.11125 11.5453 2.70651 12.4194 3.58059C13.2935 4.45466 13.8887 5.56831 14.1299 6.78069C14.3711 7.99307 14.2473 9.24974 13.7742 10.3918C13.5555 10.9198 13.2667 11.4124 12.9177 11.8573L4.14271 3.0823C4.58761 2.73333 5.08018 2.44448 5.60823 2.22576ZM3.08208 4.14298L11.857 12.9179C11.7327 13.0154 11.6044 13.1085 11.4723 13.1967C10.4445 13.8834 9.23613 14.25 8 14.25C6.3424 14.25 4.75268 13.5915 3.58058 12.4194C2.40848 11.2473 1.75 9.65761 1.75 8C1.75 6.76387 2.11656 5.5555 2.80331 4.52769C2.89155 4.39564 2.98456 4.26733 3.08208 4.14298Z"
|
|
81
81
|
}, null, -1), _t = [
|
|
82
82
|
dt
|
|
83
|
-
], ft = ["id"], vt = /* @__PURE__ */
|
|
83
|
+
], ft = ["id"], vt = /* @__PURE__ */ p("rect", {
|
|
84
84
|
width: "16",
|
|
85
85
|
height: "16",
|
|
86
86
|
fill: "#fff"
|
|
87
87
|
}, null, -1), mt = [
|
|
88
88
|
vt
|
|
89
89
|
];
|
|
90
|
-
function gt(t,
|
|
91
|
-
return
|
|
90
|
+
function gt(t, r, e, u, a, d) {
|
|
91
|
+
return c(), b("svg", N({ role: "img" }, t.$attrs, {
|
|
92
92
|
class: "ui-assets-icons-16",
|
|
93
93
|
xmlns: "http://www.w3.org/2000/svg",
|
|
94
94
|
width: "16",
|
|
95
95
|
height: "16",
|
|
96
96
|
fill: "none"
|
|
97
97
|
}), [
|
|
98
|
-
t.$attrs["svg-title"] ? (
|
|
99
|
-
|
|
98
|
+
t.$attrs["svg-title"] ? (c(), b("title", ct, E(t.$attrs["svg-title"]), 1)) : S("", !0),
|
|
99
|
+
p("g", {
|
|
100
100
|
"clip-path": "url(#uia-icons-16-blocked__a" + t.uuid + ")"
|
|
101
101
|
}, _t, 8, pt),
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
p("defs", null, [
|
|
103
|
+
p("clipPath", {
|
|
104
104
|
id: "uia-icons-16-blocked__a" + t.uuid
|
|
105
105
|
}, mt, 8, ft)
|
|
106
106
|
])
|
|
107
107
|
], 16);
|
|
108
108
|
}
|
|
109
|
-
const ht = /* @__PURE__ */
|
|
109
|
+
const ht = /* @__PURE__ */ F(ut, [["render", gt]]), L = {
|
|
110
110
|
"en-US": {
|
|
111
111
|
finish: "Finish",
|
|
112
112
|
next: "Next",
|
|
@@ -116,12 +116,12 @@ const ht = /* @__PURE__ */ k(ut, [["render", gt]]), V = {
|
|
|
116
116
|
startTour: "Start tour",
|
|
117
117
|
stepsOfTotal: "{step} of {totalSteps}"
|
|
118
118
|
}
|
|
119
|
-
}, yt = (t) => (X("data-v-9513f48c"), t = t(), G(), t), St = { key: 0 }, Ot = /* @__PURE__ */ yt(() => /* @__PURE__ */
|
|
119
|
+
}, yt = (t) => (X("data-v-9513f48c"), t = t(), G(), t), St = { key: 0 }, Ot = /* @__PURE__ */ yt(() => /* @__PURE__ */ p("div", {
|
|
120
120
|
"aria-hidden": "true",
|
|
121
121
|
class: "b-tutorial-popover__ripple"
|
|
122
122
|
}, null, -1)), bt = { class: "b-tutorial-popover__header" }, Ct = { class: "b-tutorial-popover__footer" }, Tt = { class: "b-tutorial-popover__actions" }, Bt = {
|
|
123
|
-
i18n: { messages:
|
|
124
|
-
}, Et = /* @__PURE__ */
|
|
123
|
+
i18n: { messages: L }
|
|
124
|
+
}, Et = /* @__PURE__ */ k({
|
|
125
125
|
...Bt,
|
|
126
126
|
__name: "tutorial-popover",
|
|
127
127
|
props: {
|
|
@@ -158,8 +158,8 @@ const ht = /* @__PURE__ */ k(ut, [["render", gt]]), V = {
|
|
|
158
158
|
*/
|
|
159
159
|
position: {
|
|
160
160
|
type: String,
|
|
161
|
-
default:
|
|
162
|
-
validator: (t) => Object.values(
|
|
161
|
+
default: P.BOTTOM_START,
|
|
162
|
+
validator: (t) => Object.values(P).includes(t)
|
|
163
163
|
},
|
|
164
164
|
/**
|
|
165
165
|
* Options to control the scroll into view behavior.
|
|
@@ -212,106 +212,106 @@ const ht = /* @__PURE__ */ k(ut, [["render", gt]]), V = {
|
|
|
212
212
|
}
|
|
213
213
|
},
|
|
214
214
|
emits: ["next", "finish", "restart"],
|
|
215
|
-
setup(t, { emit:
|
|
216
|
-
const e = t,
|
|
217
|
-
title:
|
|
218
|
-
event: () =>
|
|
215
|
+
setup(t, { emit: r }) {
|
|
216
|
+
const e = t, u = { behavior: "smooth" }, { t: a } = ot({ messages: L }), d = l(() => ({
|
|
217
|
+
title: a("skipTour"),
|
|
218
|
+
event: () => r("finish")
|
|
219
|
+
})), _ = l(() => ({
|
|
220
|
+
title: a("startTour"),
|
|
221
|
+
event: () => r("next")
|
|
219
222
|
})), s = l(() => ({
|
|
220
|
-
title:
|
|
221
|
-
event: () =>
|
|
222
|
-
})),
|
|
223
|
-
title:
|
|
224
|
-
event: () =>
|
|
225
|
-
})),
|
|
226
|
-
title:
|
|
227
|
-
event: () =>
|
|
228
|
-
})), B = l(() =>
|
|
229
|
-
title: r("ok"),
|
|
230
|
-
event: () => n("finish")
|
|
231
|
-
})), g = C(!1), F = C(!1), m = l(() => {
|
|
223
|
+
title: a("next"),
|
|
224
|
+
event: () => r("next")
|
|
225
|
+
})), n = l(() => ({
|
|
226
|
+
title: a("finish"),
|
|
227
|
+
event: () => r("finish")
|
|
228
|
+
})), g = l(() => ({
|
|
229
|
+
title: a("ok"),
|
|
230
|
+
event: () => r("finish")
|
|
231
|
+
})), C = B(!1), h = B(!1), m = l(() => {
|
|
232
232
|
var i;
|
|
233
|
-
return
|
|
234
|
-
}),
|
|
233
|
+
return Z(e.targetElement) ? ((i = e.targetElement.value) == null ? void 0 : i.$el) || e.targetElement.value : e.targetElement.$el || e.targetElement;
|
|
234
|
+
}), T = l(() => e.step === 0), w = l(() => e.step === e.totalSteps), j = l(() => !T.value), K = l(() => [
|
|
235
235
|
{
|
|
236
|
-
text:
|
|
237
|
-
handler: () =>
|
|
236
|
+
text: a("restartTour"),
|
|
237
|
+
handler: () => r("restart"),
|
|
238
238
|
icon: st
|
|
239
239
|
},
|
|
240
|
-
...
|
|
240
|
+
...w.value ? [] : [
|
|
241
241
|
{
|
|
242
242
|
text: "Skip tour",
|
|
243
|
-
handler: () =>
|
|
243
|
+
handler: () => r("finish"),
|
|
244
244
|
icon: ht
|
|
245
245
|
}
|
|
246
246
|
]
|
|
247
|
-
]),
|
|
247
|
+
]), M = l(() => {
|
|
248
248
|
let i;
|
|
249
|
-
|
|
250
|
-
const
|
|
251
|
-
return
|
|
249
|
+
T.value ? i = e.single ? g.value : _.value : w.value ? i = n.value : i = s.value;
|
|
250
|
+
const f = [i];
|
|
251
|
+
return T.value && !e.single ? f.push(d.value) : e.action && f.push(e.action), f;
|
|
252
252
|
});
|
|
253
|
-
return
|
|
253
|
+
return I(
|
|
254
254
|
() => e.active,
|
|
255
255
|
async (i) => {
|
|
256
|
-
var
|
|
257
|
-
i && ((
|
|
258
|
-
e.scrollOptions != null ? e.scrollOptions :
|
|
259
|
-
), await z()),
|
|
256
|
+
var f, x;
|
|
257
|
+
i && ((f = m.value) != null && f.scrollIntoView) && ((x = m.value) == null || x.scrollIntoView(
|
|
258
|
+
e.scrollOptions != null ? e.scrollOptions : u
|
|
259
|
+
), await z()), C.value = i, h.value = i;
|
|
260
260
|
},
|
|
261
261
|
{ immediate: !0 }
|
|
262
|
-
), (i,
|
|
263
|
-
|
|
262
|
+
), (i, f) => t.active && o(m) ? (c(), b("div", St, [
|
|
263
|
+
h.value && o(m) ? (c(), O(o(rt), {
|
|
264
264
|
key: 0,
|
|
265
265
|
"target-element": o(m)
|
|
266
|
-
}, null, 8, ["target-element"])) :
|
|
267
|
-
|
|
266
|
+
}, null, 8, ["target-element"])) : S("", !0),
|
|
267
|
+
y(o(tt), {
|
|
268
268
|
"target-element": o(m),
|
|
269
269
|
position: t.position,
|
|
270
|
-
open:
|
|
270
|
+
open: C.value,
|
|
271
271
|
"aria-label": t.title,
|
|
272
272
|
"fixed-positioning": "",
|
|
273
273
|
class: "b-tutorial-popover",
|
|
274
|
-
onKeydown:
|
|
274
|
+
onKeydown: f[0] || (f[0] = H((x) => r("finish"), ["esc", "native"]))
|
|
275
275
|
}, U({
|
|
276
276
|
default: v(() => [
|
|
277
277
|
Ot,
|
|
278
|
-
|
|
279
|
-
|
|
278
|
+
p("div", bt, [
|
|
279
|
+
y(o($), {
|
|
280
280
|
variant: "title",
|
|
281
281
|
el: "span"
|
|
282
282
|
}, {
|
|
283
283
|
default: v(() => [
|
|
284
|
-
|
|
284
|
+
R(E(t.title), 1)
|
|
285
285
|
]),
|
|
286
286
|
_: 1
|
|
287
287
|
}),
|
|
288
|
-
o(
|
|
288
|
+
o(j) ? (c(), O(o($), {
|
|
289
289
|
key: 0,
|
|
290
290
|
el: "span",
|
|
291
291
|
class: "b-tutorial-popover__steps"
|
|
292
292
|
}, {
|
|
293
293
|
default: v(() => [
|
|
294
|
-
|
|
294
|
+
R(E(o(a)("stepsOfTotal", { step: t.step, totalSteps: t.totalSteps })), 1)
|
|
295
295
|
]),
|
|
296
296
|
_: 1
|
|
297
|
-
})) :
|
|
297
|
+
})) : S("", !0)
|
|
298
298
|
]),
|
|
299
|
-
|
|
299
|
+
y(o($), null, {
|
|
300
300
|
default: v(() => [
|
|
301
301
|
W(i.$slots, "default", {}, void 0, !0)
|
|
302
302
|
]),
|
|
303
303
|
_: 3
|
|
304
304
|
}),
|
|
305
|
-
|
|
306
|
-
o(
|
|
305
|
+
p("div", Ct, [
|
|
306
|
+
o(T) ? S("", !0) : (c(), O(o(Y), {
|
|
307
307
|
key: 0,
|
|
308
|
-
data: o(
|
|
308
|
+
data: o(K),
|
|
309
309
|
class: "b-tutorial-popover__menu",
|
|
310
310
|
"data-testid": "menu-button"
|
|
311
311
|
}, null, 8, ["data"])),
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
actions: o(
|
|
312
|
+
p("div", Tt, [
|
|
313
|
+
y(o(it), {
|
|
314
|
+
actions: o(M),
|
|
315
315
|
layout: "buttons-end"
|
|
316
316
|
}, null, 8, ["actions"])
|
|
317
317
|
])
|
|
@@ -322,7 +322,7 @@ const ht = /* @__PURE__ */ k(ut, [["render", gt]]), V = {
|
|
|
322
322
|
t.image ? {
|
|
323
323
|
name: "image",
|
|
324
324
|
fn: v(() => [
|
|
325
|
-
|
|
325
|
+
y(o(et), N(t.image, {
|
|
326
326
|
"aspect-ratio": "landscape",
|
|
327
327
|
class: "b-tutorial-popover__image"
|
|
328
328
|
}), null, 16)
|
|
@@ -330,13 +330,20 @@ const ht = /* @__PURE__ */ k(ut, [["render", gt]]), V = {
|
|
|
330
330
|
key: "0"
|
|
331
331
|
} : void 0
|
|
332
332
|
]), 1032, ["target-element", "position", "open", "aria-label"])
|
|
333
|
-
])) :
|
|
333
|
+
])) : S("", !0);
|
|
334
334
|
}
|
|
335
335
|
});
|
|
336
|
-
const
|
|
337
|
-
...
|
|
336
|
+
const xt = /* @__PURE__ */ F(Et, [["__scopeId", "data-v-9513f48c"]]), $t = { class: "b-tutorial" }, It = {}, jt = /* @__PURE__ */ k({
|
|
337
|
+
...It,
|
|
338
338
|
__name: "tutorial",
|
|
339
339
|
props: {
|
|
340
|
+
/**
|
|
341
|
+
* The current step index. If provided, will start the tutorial in that step.
|
|
342
|
+
*/
|
|
343
|
+
index: {
|
|
344
|
+
type: Number,
|
|
345
|
+
default: null
|
|
346
|
+
},
|
|
340
347
|
/**
|
|
341
348
|
* The steps configuration for the tutorial.
|
|
342
349
|
*
|
|
@@ -356,33 +363,41 @@ const $t = /* @__PURE__ */ k(Et, [["__scopeId", "data-v-9513f48c"]]), It = { cla
|
|
|
356
363
|
default: null
|
|
357
364
|
}
|
|
358
365
|
},
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
366
|
+
emits: ["update:index"],
|
|
367
|
+
setup(t, { emit: r }) {
|
|
368
|
+
const e = t, u = B(e.index || 0), a = l(() => e.steps.length - 1), d = l(() => a.value === 0);
|
|
369
|
+
function _(s, n) {
|
|
362
370
|
return {
|
|
363
371
|
// Visual
|
|
364
372
|
targetElement: s.target,
|
|
365
373
|
image: s.image,
|
|
366
374
|
title: s.title,
|
|
367
|
-
step:
|
|
368
|
-
totalSteps:
|
|
375
|
+
step: n,
|
|
376
|
+
totalSteps: a.value,
|
|
369
377
|
action: s.action,
|
|
370
|
-
scrollOptions:
|
|
378
|
+
scrollOptions: e.scrollOptions,
|
|
371
379
|
// Config
|
|
372
|
-
active:
|
|
373
|
-
single:
|
|
380
|
+
active: n === u.value,
|
|
381
|
+
single: d.value,
|
|
374
382
|
position: s.position
|
|
375
383
|
};
|
|
376
384
|
}
|
|
377
|
-
return (
|
|
378
|
-
(
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
385
|
+
return I(u, (s) => {
|
|
386
|
+
r("update:index", s);
|
|
387
|
+
}), I(
|
|
388
|
+
() => e.index,
|
|
389
|
+
(s) => {
|
|
390
|
+
s >= -1 && s <= a.value && (u.value = s);
|
|
391
|
+
}
|
|
392
|
+
), (s, n) => (c(), b("div", $t, [
|
|
393
|
+
(c(!0), b(J, null, Q(t.steps, (g, C) => (c(), O(o(xt), N(_(g, C), {
|
|
394
|
+
key: g.title,
|
|
395
|
+
onFinish: n[0] || (n[0] = (h) => u.value = -1),
|
|
396
|
+
onNext: n[1] || (n[1] = (h) => u.value += 1),
|
|
397
|
+
onRestart: n[2] || (n[2] = (h) => u.value = 0)
|
|
383
398
|
}), {
|
|
384
399
|
default: v(() => [
|
|
385
|
-
|
|
400
|
+
R(E(g.description), 1)
|
|
386
401
|
]),
|
|
387
402
|
_: 2
|
|
388
403
|
}, 1040))), 128))
|
package/dist/tutorial.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tutorial.js","sources":["../../vue2/src/components/tutorial/components/tutorial-popover/components/tutorial-indicator/tutorial-indicator.vue","../../../node_modules/@adyen/ui-assets-icons-16/dist/vue/blocked.vue","../../vue2/src/components/tutorial/components/tutorial-popover/tutorial-popover.vue","../../vue2/src/components/tutorial/tutorial.vue"],"sourcesContent":["<template>\n <popper-container\n :target-element=\"targetElement\"\n :middleware=\"middleware\"\n position=\"top-start\"\n fixed-positioning\n disabled-focus-trap\n class=\"b-tutorial-indicator\"\n data-testid=\"tutorial-indicator\"\n >\n <div class=\"b-tutorial-indicator__highlight\" :style=\"computedStyles\"></div>\n </popper-container>\n</template>\n\n<script setup lang=\"ts\">\n import { ref } from 'vue';\n import { hide, type Middleware, offset } from '@floating-ui/vue';\n import { PopperContainer } from '@/components/popper-container';\n\n const BORDER_OFFSET = 2;\n\n defineProps({\n /**\n * Tutorial indicator's target element.\n * The indicator will position itself around the target element.\n */\n targetElement: {\n type: PopperContainer.props?.targetElement.type,\n required: true,\n },\n });\n\n const computedStyles = ref({\n width: '0',\n height: '0',\n borderRadius: '0',\n });\n\n function getBorderRadius(element: HTMLElement) {\n try {\n const radius = parseFloat(getComputedStyle(element).getPropertyValue('border-radius'));\n return Number.isNaN(radius) ? '' : `${radius + 2 * BORDER_OFFSET}px`;\n } catch {\n return '';\n }\n }\n\n const middleware = [\n hide(),\n offset({\n mainAxis: BORDER_OFFSET,\n alignmentAxis: -BORDER_OFFSET,\n }),\n {\n name: 'updateIndicatorSize',\n fn: ({ x, y, elements }) => {\n const target = elements.reference as HTMLElement;\n computedStyles.value.width = `${target.offsetWidth + 4 * BORDER_OFFSET}px`;\n computedStyles.value.height = `${target.offsetHeight + 4 * BORDER_OFFSET}px`;\n computedStyles.value.borderRadius = getBorderRadius(target);\n return { x, y };\n },\n } as Middleware,\n ];\n</script>\n\n<style lang=\"scss\" scoped src=\"./tutorial-indicator.scss\" />\n","\n<template>\n <svg role=\"img\" v-bind=\"$attrs\" class=\"ui-assets-icons-16\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\"><title v-if=\"$attrs['svg-title']\">{{ $attrs['svg-title'] }}</title><g :clip-path=\"'url(#uia-icons-16-blocked__a' + uuid + ')'\"><path fill=\"#00112C\" d=\"M9.51195 0.398918C8.00859 0.0998821 6.45033 0.253358 5.0342 0.839937C3.61808 1.42652 2.40769 2.41985 1.55611 3.69433C0.704529 4.96881 0.25 6.4672 0.25 8C0.25 10.0554 1.06652 12.0267 2.51992 13.4801C3.97333 14.9335 5.94457 15.75 8 15.75C9.53281 15.75 11.0312 15.2955 12.3057 14.4439C13.5801 13.5923 14.5735 12.3819 15.1601 10.9658C15.7466 9.54967 15.9001 7.99141 15.6011 6.48805C15.3021 4.9847 14.5639 3.60378 13.4801 2.51993C12.3962 1.43607 11.0153 0.697953 9.51195 0.398918ZM5.60823 2.22576C6.75027 1.75271 8.00693 1.62894 9.21931 1.8701C10.4317 2.11125 11.5453 2.70651 12.4194 3.58059C13.2935 4.45466 13.8887 5.56831 14.1299 6.78069C14.3711 7.99307 14.2473 9.24974 13.7742 10.3918C13.5555 10.9198 13.2667 11.4124 12.9177 11.8573L4.14271 3.0823C4.58761 2.73333 5.08018 2.44448 5.60823 2.22576ZM3.08208 4.14298L11.857 12.9179C11.7327 13.0154 11.6044 13.1085 11.4723 13.1967C10.4445 13.8834 9.23613 14.25 8 14.25C6.3424 14.25 4.75268 13.5915 3.58058 12.4194C2.40848 11.2473 1.75 9.65761 1.75 8C1.75 6.76387 2.11656 5.5555 2.80331 4.52769C2.89155 4.39564 2.98456 4.26733 3.08208 4.14298Z\"/></g><defs><clipPath :id=\"'uia-icons-16-blocked__a' + uuid\"><rect width=\"16\" height=\"16\" fill=\"#fff\"/></clipPath></defs></svg>\n</template>\n<script>\n let uuid = 0;\n\n export default {\n beforeCreate() {\n this.uuid = uuid.toString();\n uuid += 1;\n },\n };\n</script>\n<style>\n @import '../css/main.css';\n</style>\n","<template>\n <div v-if=\"active && targetElement\">\n <tutorial-indicator v-if=\"isIndicatorVisible && targetElement\" :target-element=\"targetElement\" />\n\n <bento-popover\n :target-element=\"targetElement\"\n :position=\"position\"\n :open=\"isPopoverOpen\"\n :aria-label=\"title\"\n fixed-positioning\n class=\"b-tutorial-popover\"\n @keydown.esc.native=\"emit('finish')\"\n >\n <template v-if=\"image\" #image>\n <bento-image v-bind=\"image\" aspect-ratio=\"landscape\" class=\"b-tutorial-popover__image\" />\n </template>\n\n <div aria-hidden=\"true\" class=\"b-tutorial-popover__ripple\"></div>\n\n <div class=\"b-tutorial-popover__header\">\n <bento-typography variant=\"title\" el=\"span\"> {{ title }} </bento-typography>\n\n <bento-typography v-if=\"showSteps\" el=\"span\" class=\"b-tutorial-popover__steps\">\n {{ t('stepsOfTotal', { step, totalSteps }) }}\n </bento-typography>\n </div>\n\n <bento-typography>\n <slot />\n </bento-typography>\n\n <div class=\"b-tutorial-popover__footer\">\n <bento-menu\n v-if=\"!isFirstStep\"\n :data=\"menuData\"\n class=\"b-tutorial-popover__menu\"\n data-testid=\"menu-button\"\n />\n <div class=\"b-tutorial-popover__actions\">\n <bento-button-actions :actions=\"computedActions\" layout=\"buttons-end\" />\n </div>\n </div>\n </bento-popover>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, isRef, nextTick, PropType, ref, type default as Vue, watch } from 'vue';\n import { BentoMenu } from '@/components/menu';\n import { BentoPopover, BentoPopoverPositions } from '@/components/popover';\n import { BentoTypography } from '@/components/typography';\n import { type BentoButtonActionObject, BentoButtonActions } from '@/components/button';\n import { BentoImage } from '@/components/image';\n import { TutorialIndicator } from './components/tutorial-indicator';\n import { useI18n } from '@/utils/ts/i18n';\n import type { BentoMenuItem } from '@/components/menu/components';\n import type { VueNodeElement } from '@/types';\n import type { BentoTutorialScrollOptions, BentoTutorialStep } from '../../tutorial.types';\n import RefreshIcon from '@adyen/ui-assets-icons-16/vue/refresh';\n import BlockedIcon from '@adyen/ui-assets-icons-16/vue/blocked';\n\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const DEFAULT_SCROLL_OPTIONS: BentoTutorialScrollOptions = { behavior: 'smooth' };\n\n const props = defineProps({\n /**\n * Optional configuration for the secondary action.\n * In tour tutorials, this is ignored for the introductory step.\n */\n action: {\n type: Object as PropType<BentoButtonActionObject>,\n default: null,\n },\n\n /**\n * Indicates whether this popover is the active step (and should be visible).\n */\n active: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Optional illustration to display at the top of the popover.\n */\n image: {\n type: Object as PropType<BentoTutorialStep['image']>,\n default: null,\n },\n\n /**\n * Popover's position relative to the target element.\n * Possible values are:\n * 'auto', 'auto-start', 'auto-end',\n * 'top', 'top-start', 'top-end'\n * 'right', 'right-start', 'right-end'\n * 'bottom', 'bottom-start', 'bottom-end'\n * 'left', 'left-start', 'left-end'\n */\n position: {\n type: String as PropType<`${BentoPopoverPositions}`>,\n default: BentoPopoverPositions.BOTTOM_START,\n validator: (value: BentoPopoverPositions) => Object.values(BentoPopoverPositions).includes(value),\n },\n\n /**\n * Options to control the scroll into view behavior.\n * Takes the same options as the `scrollIntoView` function\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView}\n */\n scrollOptions: {\n type: [Boolean, Object] as PropType<BentoTutorialScrollOptions>,\n default: null,\n },\n\n /**\n * Indicates whether this popover is a single tutorial or a tour.\n */\n single: {\n type: Boolean,\n default: false,\n },\n\n /**\n * The tutorial step number.\n * In tour tutorials, `0` is the introductory step, and is displayed next\n * to the title.\n */\n step: {\n type: Number,\n default: null,\n },\n\n /**\n * Tutorial popover's target element.\n * The popover will position itself relatively to target element.\n */\n targetElement: {\n type: [Element, Object] as PropType<VueNodeElement>,\n required: true,\n },\n\n /**\n * The tutorial step title.\n */\n title: {\n type: String,\n required: true,\n },\n\n /**\n * Total count of steps.\n * In tour tutorials, this does not include the introductory step, and is\n * displayed next to the title.\n */\n totalSteps: {\n type: Number,\n default: null,\n },\n });\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const emit = defineEmits<{\n /**\n * Emitted when the user clicks the primary action in popovers during introductory or intermediate steps of tour tutorials\n */\n (e: 'next'): void;\n\n /**\n * Emitted when the user clicks the primary action in a single tutorial, the last step of a tour, or skips the tutorial\n */\n (e: 'finish'): void;\n\n /**\n * Emitted when the user selects the restart tour option\n */\n (e: 'restart'): void;\n }>();\n\n const ACTION_SKIP = computed<BentoButtonActionObject>(() => ({\n title: t('skipTour') as string,\n event: () => emit('finish'),\n }));\n\n const ACTION_START = computed<BentoButtonActionObject>(() => ({\n title: t('startTour') as string,\n event: () => emit('next'),\n }));\n\n const ACTION_NEXT = computed<BentoButtonActionObject>(() => ({\n title: t('next') as string,\n event: () => emit('next'),\n }));\n\n const ACTION_FINISH = computed<BentoButtonActionObject>(() => ({\n title: t('finish') as string,\n event: () => emit('finish'),\n }));\n\n const ACTION_OK = computed<BentoButtonActionObject>(() => ({\n title: t('ok') as string,\n event: () => emit('finish'),\n }));\n\n const isPopoverOpen = ref(false);\n const isIndicatorVisible = ref(false);\n\n const targetElement = computed(() => {\n if (isRef(props.targetElement)) {\n return ((props.targetElement.value as Vue)?.$el || props.targetElement.value) as HTMLElement;\n }\n return ((props.targetElement as Vue).$el || props.targetElement) as HTMLElement;\n });\n\n const isFirstStep = computed(() => props.step === 0);\n const isLastStep = computed(() => props.step === props.totalSteps);\n\n const showSteps = computed(() => !isFirstStep.value);\n\n const menuData = computed<BentoMenuItem[]>(() => [\n {\n text: t('restartTour'),\n handler: () => emit('restart'),\n icon: RefreshIcon,\n },\n ...(isLastStep.value\n ? []\n : [\n {\n text: 'Skip tour',\n handler: () => emit('finish'),\n icon: BlockedIcon,\n },\n ]),\n ]);\n\n const computedActions = computed(() => {\n let primaryAction: BentoButtonActionObject;\n if (isFirstStep.value) {\n primaryAction = props.single ? ACTION_OK.value : ACTION_START.value;\n } else if (isLastStep.value) {\n primaryAction = ACTION_FINISH.value;\n } else {\n primaryAction = ACTION_NEXT.value;\n }\n\n const actions = [primaryAction];\n if (isFirstStep.value && !props.single) {\n actions.push(ACTION_SKIP.value);\n } else if (props.action) {\n actions.push(props.action);\n }\n\n return actions;\n });\n\n watch(\n () => props.active,\n async isActive => {\n if (isActive && targetElement.value?.scrollIntoView) {\n targetElement.value?.scrollIntoView(\n props.scrollOptions != null ? props.scrollOptions : DEFAULT_SCROLL_OPTIONS\n );\n\n // Skip to next tick to preserve popover appear animation\n await nextTick();\n }\n\n isPopoverOpen.value = isActive;\n isIndicatorVisible.value = isActive;\n },\n { immediate: true }\n );\n</script>\n\n<script lang=\"ts\">\n export default {\n i18n: { messages },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./tutorial-popover.scss\" />\n","<template>\n <div class=\"b-tutorial\">\n <tutorial-popover\n v-for=\"(step, index) in steps\"\n v-bind=\"getPopoverProps(step, index)\"\n :key=\"step.title\"\n @finish=\"currentStep = -1\"\n @next=\"currentStep += 1\"\n @restart=\"currentStep = 0\"\n >\n {{ step.description }}\n </tutorial-popover>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, PropType, ref } from 'vue';\n import { TutorialPopover } from './components/tutorial-popover';\n import type { BentoTutorialScrollOptions, BentoTutorialStep } from './tutorial.types';\n\n const props = defineProps({\n /**\n * The steps configuration for the tutorial.\n *\n */\n steps: {\n type: Array as PropType<BentoTutorialStep[]>,\n required: true,\n validator: (value: BentoTutorialStep[]) => value.length > 0,\n },\n\n /**\n * Options to control the scroll into view behavior.\n * Takes the same options as the `scrollIntoView` function\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView}\n */\n scrollOptions: {\n type: [Boolean, Object] as PropType<BentoTutorialScrollOptions>,\n default: null,\n },\n });\n\n const currentStep = ref(0);\n\n const totalSteps = computed(() => props.steps.length - 1);\n const isSingleTutorial = computed(() => totalSteps.value === 0);\n\n function getPopoverProps(step: BentoTutorialStep, index: number) {\n return {\n // Visual\n targetElement: step.target,\n image: step.image,\n title: step.title,\n step: index,\n totalSteps: totalSteps.value,\n action: step.action,\n scrollOptions: props.scrollOptions,\n\n // Config\n active: index === currentStep.value,\n single: isSingleTutorial.value,\n position: step.position,\n };\n }\n</script>\n\n<script lang=\"ts\">\n /**\n * The Tutorial is a temporary popover that should be used to educate users about\n * new or unfamiliar features or experiences.\n *\n * You can use single tutorial or chain them into a tour.\n *\n * Only use this component for new features/experiences that are not obvious and\n * self-explanatory on their own.\n *\n * @example\n * import { BentoTutorial } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoTutorial },\n * template: `\n * <bento-tutorial\n * :steps=\"[\n * {\n * target: targetElement1,\n * title: 'Tutorial intro title',\n * description: 'Intro body content',\n * image: { src: imageSource, alt: 'Alt text' }\n * },\n * {\n * target: targetElement1,\n * title: 'Tutorial intro title',\n * description: 'Intro body content',\n * action: { title: 'Action label', event: () => {} }\n * },\n * ]\"\n * />\n * `\n * }\n */\n export default {};\n</script>\n"],"names":["computedStyles","ref","getBorderRadius","element","radius","middleware","hide","offset","x","y","elements","target","uuid","openBlock","createElementBlock","mergeProps","_ctx","_hoisted_1$2","toDisplayString","__default__$1","messages","DEFAULT_SCROLL_OPTIONS","t","useI18n","ACTION_SKIP","computed","emit","ACTION_START","ACTION_NEXT","ACTION_FINISH","ACTION_OK","isPopoverOpen","isIndicatorVisible","targetElement","isRef","props","_a","isFirstStep","isLastStep","showSteps","menuData","RefreshIcon","BlockedIcon","computedActions","primaryAction","actions","watch","isActive","_b","nextTick","__default__","currentStep","totalSteps","isSingleTutorial","getPopoverProps","step","index"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAgCI,UAAAA,IAAAC,EAAA;AAAA,MAA2B,OAAA;AAAA,MAChB,QAAA;AAAA,MACC,cAAA;AAAA,IACM,CAAA;AAGlB,aAAAC,EAAAC,GAAA;AACI,UAAA;AACI,cAAAC,IAAA,WAAA,iBAAAD,CAAA,EAAA,iBAAA,eAAA,CAAA;AACA,eAAA,OAAA,MAAAC,CAAA,IAAA,KAAA,GAAAA,IAAA,IAAA;AAAA,MAAmD,QAAA;AAEnD,eAAA;AAAA,MAAO;AAAA,IACX;AAGJ,UAAAC,IAAA;AAAA,MAAmBC,GAAA;AAAA,MACVC,GAAA;AAAA,QACE,UAAA;AAAA,QACO,eAAA;AAAA,MACM,CAAA;AAAA,MACnB;AAAA,QACD,MAAA;AAAA,QACU,IAAA,CAAA,EAAA,GAAAC,GAAA,GAAAC,GAAA,UAAAC,EAAA,MAAA;AAEF,gBAAAC,IAAAD,EAAA;AACA,iBAAAV,EAAA,MAAA,QAAA,GAAAW,EAAA,cAAA,IAAA,OACAX,EAAA,MAAA,SAAA,GAAAW,EAAA,eAAA,IAAA,OACAX,EAAA,MAAA,eAAAE,EAAAS,CAAA,GACA,EAAA,GAAAH,GAAA,GAAAC,EAAA;AAAA,QAAc;AAAA,MAClB;AAAA,IACJ;;;;;;;;;;;;;;;;;;;;;ACzDJ,IAAAG,IAAA;;EAGI,eAAA;8BAEIA,KAAA;AAAA;;EAR8P,MAAA;AAAA,EAAe,GAAA;;;;EAAooC,OAA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AAA,OAAAA,EAAA,gBAAAd;AAAA,WAKrB,MAAA4B,EAAA,IAGJlB,EAAA,QAAAgB,GACAf,EAAA,QAAAe;AAAA,MAA2B;AAAA,MAC/B,EAAA,WAAA,GAAA;AAAA,IACkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oGC9KtBG,KAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;iBA3DAC,IAAAlD,EAAA,CAAA,GAEAmD,IAAA3B,EAAA,MAAAU,EAAA,MAAA,SAAA,CAAA,GACAkB,IAAA5B,EAAA,MAAA2B,EAAA,UAAA,CAAA;AAEA,aAAAE,EAAAC,GAAAC,GAAA;AACI,aAAA;AAAA;AAAA,QAAO,eAAAD,EAAA;AAAA,QAEiB,OAAAA,EAAA;AAAA,QACR,OAAAA,EAAA;AAAA,QACA,MAAAC;AAAA,QACN,YAAAJ,EAAA;AAAA,QACiB,QAAAG,EAAA;AAAA,QACV,eAAApB,EAAA;AAAA;AAAA,QACQ,QAAAqB,MAAAL,EAAA;AAAA,QAGS,QAAAE,EAAA;AAAA,QACL,UAAAE,EAAA;AAAA,MACV;AAAA,IACnB;;;;;;;;;;;;;;;;","x_google_ignoreList":[1]}
|
|
1
|
+
{"version":3,"file":"tutorial.js","sources":["../../vue2/src/components/tutorial/components/tutorial-popover/components/tutorial-indicator/tutorial-indicator.vue","../../../node_modules/@adyen/ui-assets-icons-16/dist/vue/blocked.vue","../../vue2/src/components/tutorial/components/tutorial-popover/tutorial-popover.vue","../../vue2/src/components/tutorial/tutorial.vue"],"sourcesContent":["<template>\n <popper-container\n :target-element=\"targetElement\"\n :middleware=\"middleware\"\n position=\"top-start\"\n fixed-positioning\n disabled-focus-trap\n class=\"b-tutorial-indicator\"\n data-testid=\"tutorial-indicator\"\n >\n <div class=\"b-tutorial-indicator__highlight\" :style=\"computedStyles\"></div>\n </popper-container>\n</template>\n\n<script setup lang=\"ts\">\n import { ref } from 'vue';\n import { hide, type Middleware, offset } from '@floating-ui/vue';\n import { PopperContainer } from '@/components/popper-container';\n\n const BORDER_OFFSET = 2;\n\n defineProps({\n /**\n * Tutorial indicator's target element.\n * The indicator will position itself around the target element.\n */\n targetElement: {\n type: PopperContainer.props?.targetElement.type,\n required: true,\n },\n });\n\n const computedStyles = ref({\n width: '0',\n height: '0',\n borderRadius: '0',\n });\n\n function getBorderRadius(element: HTMLElement) {\n try {\n const radius = parseFloat(getComputedStyle(element).getPropertyValue('border-radius'));\n return Number.isNaN(radius) ? '' : `${radius + 2 * BORDER_OFFSET}px`;\n } catch {\n return '';\n }\n }\n\n const middleware = [\n hide(),\n offset({\n mainAxis: BORDER_OFFSET,\n alignmentAxis: -BORDER_OFFSET,\n }),\n {\n name: 'updateIndicatorSize',\n fn: ({ x, y, elements }) => {\n const target = elements.reference as HTMLElement;\n computedStyles.value.width = `${target.offsetWidth + 4 * BORDER_OFFSET}px`;\n computedStyles.value.height = `${target.offsetHeight + 4 * BORDER_OFFSET}px`;\n computedStyles.value.borderRadius = getBorderRadius(target);\n return { x, y };\n },\n } as Middleware,\n ];\n</script>\n\n<style lang=\"scss\" scoped src=\"./tutorial-indicator.scss\" />\n","\n<template>\n <svg role=\"img\" v-bind=\"$attrs\" class=\"ui-assets-icons-16\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\"><title v-if=\"$attrs['svg-title']\">{{ $attrs['svg-title'] }}</title><g :clip-path=\"'url(#uia-icons-16-blocked__a' + uuid + ')'\"><path fill=\"#00112C\" d=\"M9.51195 0.398918C8.00859 0.0998821 6.45033 0.253358 5.0342 0.839937C3.61808 1.42652 2.40769 2.41985 1.55611 3.69433C0.704529 4.96881 0.25 6.4672 0.25 8C0.25 10.0554 1.06652 12.0267 2.51992 13.4801C3.97333 14.9335 5.94457 15.75 8 15.75C9.53281 15.75 11.0312 15.2955 12.3057 14.4439C13.5801 13.5923 14.5735 12.3819 15.1601 10.9658C15.7466 9.54967 15.9001 7.99141 15.6011 6.48805C15.3021 4.9847 14.5639 3.60378 13.4801 2.51993C12.3962 1.43607 11.0153 0.697953 9.51195 0.398918ZM5.60823 2.22576C6.75027 1.75271 8.00693 1.62894 9.21931 1.8701C10.4317 2.11125 11.5453 2.70651 12.4194 3.58059C13.2935 4.45466 13.8887 5.56831 14.1299 6.78069C14.3711 7.99307 14.2473 9.24974 13.7742 10.3918C13.5555 10.9198 13.2667 11.4124 12.9177 11.8573L4.14271 3.0823C4.58761 2.73333 5.08018 2.44448 5.60823 2.22576ZM3.08208 4.14298L11.857 12.9179C11.7327 13.0154 11.6044 13.1085 11.4723 13.1967C10.4445 13.8834 9.23613 14.25 8 14.25C6.3424 14.25 4.75268 13.5915 3.58058 12.4194C2.40848 11.2473 1.75 9.65761 1.75 8C1.75 6.76387 2.11656 5.5555 2.80331 4.52769C2.89155 4.39564 2.98456 4.26733 3.08208 4.14298Z\"/></g><defs><clipPath :id=\"'uia-icons-16-blocked__a' + uuid\"><rect width=\"16\" height=\"16\" fill=\"#fff\"/></clipPath></defs></svg>\n</template>\n<script>\n let uuid = 0;\n\n export default {\n beforeCreate() {\n this.uuid = uuid.toString();\n uuid += 1;\n },\n };\n</script>\n<style>\n @import '../css/main.css';\n</style>\n","<template>\n <div v-if=\"active && targetElement\">\n <tutorial-indicator v-if=\"isIndicatorVisible && targetElement\" :target-element=\"targetElement\" />\n\n <bento-popover\n :target-element=\"targetElement\"\n :position=\"position\"\n :open=\"isPopoverOpen\"\n :aria-label=\"title\"\n fixed-positioning\n class=\"b-tutorial-popover\"\n @keydown.esc.native=\"emit('finish')\"\n >\n <template v-if=\"image\" #image>\n <bento-image v-bind=\"image\" aspect-ratio=\"landscape\" class=\"b-tutorial-popover__image\" />\n </template>\n\n <div aria-hidden=\"true\" class=\"b-tutorial-popover__ripple\"></div>\n\n <div class=\"b-tutorial-popover__header\">\n <bento-typography variant=\"title\" el=\"span\"> {{ title }} </bento-typography>\n\n <bento-typography v-if=\"showSteps\" el=\"span\" class=\"b-tutorial-popover__steps\">\n {{ t('stepsOfTotal', { step, totalSteps }) }}\n </bento-typography>\n </div>\n\n <bento-typography>\n <slot />\n </bento-typography>\n\n <div class=\"b-tutorial-popover__footer\">\n <bento-menu\n v-if=\"!isFirstStep\"\n :data=\"menuData\"\n class=\"b-tutorial-popover__menu\"\n data-testid=\"menu-button\"\n />\n <div class=\"b-tutorial-popover__actions\">\n <bento-button-actions :actions=\"computedActions\" layout=\"buttons-end\" />\n </div>\n </div>\n </bento-popover>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, isRef, nextTick, PropType, ref, type default as Vue, watch } from 'vue';\n import { BentoMenu } from '@/components/menu';\n import { BentoPopover, BentoPopoverPositions } from '@/components/popover';\n import { BentoTypography } from '@/components/typography';\n import { type BentoButtonActionObject, BentoButtonActions } from '@/components/button';\n import { BentoImage } from '@/components/image';\n import { TutorialIndicator } from './components/tutorial-indicator';\n import { useI18n } from '@/utils/ts/i18n';\n import type { BentoMenuItem } from '@/components/menu/components';\n import type { VueNodeElement } from '@/types';\n import type { BentoTutorialScrollOptions, BentoTutorialStep } from '../../tutorial.types';\n import RefreshIcon from '@adyen/ui-assets-icons-16/vue/refresh';\n import BlockedIcon from '@adyen/ui-assets-icons-16/vue/blocked';\n\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const DEFAULT_SCROLL_OPTIONS: BentoTutorialScrollOptions = { behavior: 'smooth' };\n\n const props = defineProps({\n /**\n * Optional configuration for the secondary action.\n * In tour tutorials, this is ignored for the introductory step.\n */\n action: {\n type: Object as PropType<BentoButtonActionObject>,\n default: null,\n },\n\n /**\n * Indicates whether this popover is the active step (and should be visible).\n */\n active: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Optional illustration to display at the top of the popover.\n */\n image: {\n type: Object as PropType<BentoTutorialStep['image']>,\n default: null,\n },\n\n /**\n * Popover's position relative to the target element.\n * Possible values are:\n * 'auto', 'auto-start', 'auto-end',\n * 'top', 'top-start', 'top-end'\n * 'right', 'right-start', 'right-end'\n * 'bottom', 'bottom-start', 'bottom-end'\n * 'left', 'left-start', 'left-end'\n */\n position: {\n type: String as PropType<`${BentoPopoverPositions}`>,\n default: BentoPopoverPositions.BOTTOM_START,\n validator: (value: BentoPopoverPositions) => Object.values(BentoPopoverPositions).includes(value),\n },\n\n /**\n * Options to control the scroll into view behavior.\n * Takes the same options as the `scrollIntoView` function\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView}\n */\n scrollOptions: {\n type: [Boolean, Object] as PropType<BentoTutorialScrollOptions>,\n default: null,\n },\n\n /**\n * Indicates whether this popover is a single tutorial or a tour.\n */\n single: {\n type: Boolean,\n default: false,\n },\n\n /**\n * The tutorial step number.\n * In tour tutorials, `0` is the introductory step, and is displayed next\n * to the title.\n */\n step: {\n type: Number,\n default: null,\n },\n\n /**\n * Tutorial popover's target element.\n * The popover will position itself relatively to target element.\n */\n targetElement: {\n type: [Element, Object] as PropType<VueNodeElement>,\n required: true,\n },\n\n /**\n * The tutorial step title.\n */\n title: {\n type: String,\n required: true,\n },\n\n /**\n * Total count of steps.\n * In tour tutorials, this does not include the introductory step, and is\n * displayed next to the title.\n */\n totalSteps: {\n type: Number,\n default: null,\n },\n });\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const emit = defineEmits<{\n /**\n * Emitted when the user clicks the primary action in popovers during introductory or intermediate steps of tour tutorials\n */\n (e: 'next'): void;\n\n /**\n * Emitted when the user clicks the primary action in a single tutorial, the last step of a tour, or skips the tutorial\n */\n (e: 'finish'): void;\n\n /**\n * Emitted when the user selects the restart tour option\n */\n (e: 'restart'): void;\n }>();\n\n const ACTION_SKIP = computed<BentoButtonActionObject>(() => ({\n title: t('skipTour') as string,\n event: () => emit('finish'),\n }));\n\n const ACTION_START = computed<BentoButtonActionObject>(() => ({\n title: t('startTour') as string,\n event: () => emit('next'),\n }));\n\n const ACTION_NEXT = computed<BentoButtonActionObject>(() => ({\n title: t('next') as string,\n event: () => emit('next'),\n }));\n\n const ACTION_FINISH = computed<BentoButtonActionObject>(() => ({\n title: t('finish') as string,\n event: () => emit('finish'),\n }));\n\n const ACTION_OK = computed<BentoButtonActionObject>(() => ({\n title: t('ok') as string,\n event: () => emit('finish'),\n }));\n\n const isPopoverOpen = ref(false);\n const isIndicatorVisible = ref(false);\n\n const targetElement = computed(() => {\n if (isRef(props.targetElement)) {\n return ((props.targetElement.value as Vue)?.$el || props.targetElement.value) as HTMLElement;\n }\n return ((props.targetElement as Vue).$el || props.targetElement) as HTMLElement;\n });\n\n const isFirstStep = computed(() => props.step === 0);\n const isLastStep = computed(() => props.step === props.totalSteps);\n\n const showSteps = computed(() => !isFirstStep.value);\n\n const menuData = computed<BentoMenuItem[]>(() => [\n {\n text: t('restartTour'),\n handler: () => emit('restart'),\n icon: RefreshIcon,\n },\n ...(isLastStep.value\n ? []\n : [\n {\n text: 'Skip tour',\n handler: () => emit('finish'),\n icon: BlockedIcon,\n },\n ]),\n ]);\n\n const computedActions = computed(() => {\n let primaryAction: BentoButtonActionObject;\n if (isFirstStep.value) {\n primaryAction = props.single ? ACTION_OK.value : ACTION_START.value;\n } else if (isLastStep.value) {\n primaryAction = ACTION_FINISH.value;\n } else {\n primaryAction = ACTION_NEXT.value;\n }\n\n const actions = [primaryAction];\n if (isFirstStep.value && !props.single) {\n actions.push(ACTION_SKIP.value);\n } else if (props.action) {\n actions.push(props.action);\n }\n\n return actions;\n });\n\n watch(\n () => props.active,\n async isActive => {\n if (isActive && targetElement.value?.scrollIntoView) {\n targetElement.value?.scrollIntoView(\n props.scrollOptions != null ? props.scrollOptions : DEFAULT_SCROLL_OPTIONS\n );\n\n // Skip to next tick to preserve popover appear animation\n await nextTick();\n }\n\n isPopoverOpen.value = isActive;\n isIndicatorVisible.value = isActive;\n },\n { immediate: true }\n );\n</script>\n\n<script lang=\"ts\">\n export default {\n i18n: { messages },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./tutorial-popover.scss\" />\n","<template>\n <div class=\"b-tutorial\">\n <tutorial-popover\n v-for=\"(step, i) in steps\"\n v-bind=\"getPopoverProps(step, i)\"\n :key=\"step.title\"\n @finish=\"currentStep = -1\"\n @next=\"currentStep += 1\"\n @restart=\"currentStep = 0\"\n >\n {{ step.description }}\n </tutorial-popover>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, PropType, ref, watch } from 'vue';\n import { TutorialPopover } from './components/tutorial-popover';\n import type { BentoTutorialScrollOptions, BentoTutorialStep } from './tutorial.types';\n\n const props = defineProps({\n /**\n * The current step index. If provided, will start the tutorial in that step.\n */\n index: {\n type: Number,\n default: null,\n },\n\n /**\n * The steps configuration for the tutorial.\n *\n */\n steps: {\n type: Array as PropType<BentoTutorialStep[]>,\n required: true,\n validator: (value: BentoTutorialStep[]) => value.length > 0,\n },\n\n /**\n * Options to control the scroll into view behavior.\n * Takes the same options as the `scrollIntoView` function\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView}\n */\n scrollOptions: {\n type: [Boolean, Object] as PropType<BentoTutorialScrollOptions>,\n default: null,\n },\n });\n\n const emit = defineEmits<{\n /**\n * Fired every time the step index is changed. `-1` value means the tutorial is finished/skipped.\n */\n (e: 'update:index', value: number);\n }>();\n\n const currentStep = ref(props.index || 0);\n\n const totalSteps = computed(() => props.steps.length - 1);\n const isSingleTutorial = computed(() => totalSteps.value === 0);\n\n function getPopoverProps(step: BentoTutorialStep, index: number) {\n return {\n // Visual\n targetElement: step.target,\n image: step.image,\n title: step.title,\n step: index,\n totalSteps: totalSteps.value,\n action: step.action,\n scrollOptions: props.scrollOptions,\n\n // Config\n active: index === currentStep.value,\n single: isSingleTutorial.value,\n position: step.position,\n };\n }\n\n watch(currentStep, step => {\n emit('update:index', step);\n });\n\n watch(\n () => props.index,\n value => {\n if (value >= -1 && value <= totalSteps.value) {\n currentStep.value = value;\n }\n }\n );\n</script>\n\n<script lang=\"ts\">\n /**\n * The Tutorial is a temporary popover that should be used to educate users about\n * new or unfamiliar features or experiences.\n *\n * You can use single tutorial or chain them into a tour.\n *\n * Only use this component for new features/experiences that are not obvious and\n * self-explanatory on their own.\n *\n * @example\n * import { BentoTutorial } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoTutorial },\n * template: `\n * <bento-tutorial\n * :steps=\"[\n * {\n * target: targetElement1,\n * title: 'Tutorial intro title',\n * description: 'Intro body content',\n * image: { src: imageSource, alt: 'Alt text' }\n * },\n * {\n * target: targetElement1,\n * title: 'Tutorial intro title',\n * description: 'Intro body content',\n * action: { title: 'Action label', event: () => {} }\n * },\n * ]\"\n * />\n * `\n * }\n */\n export default {};\n</script>\n"],"names":["computedStyles","ref","getBorderRadius","element","radius","middleware","hide","offset","x","y","elements","target","uuid","openBlock","createElementBlock","mergeProps","_ctx","_hoisted_1$2","toDisplayString","__default__$1","messages","DEFAULT_SCROLL_OPTIONS","t","useI18n","ACTION_SKIP","computed","emit","ACTION_START","ACTION_NEXT","ACTION_FINISH","ACTION_OK","isPopoverOpen","isIndicatorVisible","targetElement","isRef","props","_a","isFirstStep","isLastStep","showSteps","menuData","RefreshIcon","BlockedIcon","computedActions","primaryAction","actions","watch","isActive","_b","nextTick","__default__","currentStep","totalSteps","isSingleTutorial","getPopoverProps","step","index","value"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAgCI,UAAAA,IAAAC,EAAA;AAAA,MAA2B,OAAA;AAAA,MAChB,QAAA;AAAA,MACC,cAAA;AAAA,IACM,CAAA;AAGlB,aAAAC,EAAAC,GAAA;AACI,UAAA;AACI,cAAAC,IAAA,WAAA,iBAAAD,CAAA,EAAA,iBAAA,eAAA,CAAA;AACA,eAAA,OAAA,MAAAC,CAAA,IAAA,KAAA,GAAAA,IAAA,IAAA;AAAA,MAAmD,QAAA;AAEnD,eAAA;AAAA,MAAO;AAAA,IACX;AAGJ,UAAAC,IAAA;AAAA,MAAmBC,GAAA;AAAA,MACVC,GAAA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AAAA,QAGS,QAAAE,EAAA;AAAA,QACL,UAAAE,EAAA;AAAA,MACV;AAAA,IACnB;AAGJ,WAAAT,EAAAK,GAAA,CAAAI,MAAA;AACI,MAAA7B,EAAA,gBAAA6B,CAAA;AAAA,IAAyB,CAAA,GAG7BT;AAAA,MAAA,MAAAX,EAAA;AAAA,MACgB,CAAAsB,MAAA;AAER,QAAAA,KAAA,MAAAA,KAAAL,EAAA,UACID,EAAA,QAAAM;AAAA,MACJ;AAAA,IACJ;;;;;;;;;;;;;;;","x_google_ignoreList":[1]}
|
package/dist/typography.js
CHANGED
package/dist/web-types.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adyen/bento-vue3",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.27.0",
|
|
4
4
|
"description": "Adyen Bento Vue 3 components",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"build:watch": "NODE_ENV=development npm run build:lib -- --mode development --watch",
|
|
28
28
|
"build:prod": "npm run clean:build && npm run build:lib && npm run build:types && npm run build:webtypes",
|
|
29
29
|
"build:types": "vue-tsc -p ./tsconfig.d.json && npm run copy-components-defs",
|
|
30
|
-
"test": "TZ='Europe/Paris' vitest run",
|
|
30
|
+
"test": "TZ='Europe/Paris' vitest run --config ./vitest.config.ts",
|
|
31
31
|
"test:coverage": "npm run test -- --coverage",
|
|
32
32
|
"test:watch": "TZ='Europe/Paris' vitest watch",
|
|
33
33
|
"copy-components-defs": "cp ../vue2/src/components.d.ts dist/@types",
|
|
@@ -52,10 +52,15 @@
|
|
|
52
52
|
"url": "git@github.com:Adyen/bento.git"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@adyen/bento-design-tokens": "1.
|
|
55
|
+
"@adyen/bento-design-tokens": "1.27.0",
|
|
56
56
|
"@adyen/ui-assets-icons-16": "4.1.0",
|
|
57
57
|
"@adyen/ui-assets-payment-method-icons": "6.1.0",
|
|
58
58
|
"@codemirror/commands": "6.3.3",
|
|
59
|
+
"@codemirror/lang-java": "6.0.1",
|
|
60
|
+
"@codemirror/lang-javascript": "6.2.2",
|
|
61
|
+
"@codemirror/lang-json": "6.0.1",
|
|
62
|
+
"@codemirror/lang-python": "6.1.6",
|
|
63
|
+
"@codemirror/lang-xml": "6.1.0",
|
|
59
64
|
"@codemirror/language-data": "6.4.0",
|
|
60
65
|
"@codemirror/state": "6.4.0",
|
|
61
66
|
"@codemirror/view": "6.23.0",
|
|
@@ -101,9 +106,6 @@
|
|
|
101
106
|
"axe-core": "4.4.2",
|
|
102
107
|
"clean-webpack-plugin": "3.0.0",
|
|
103
108
|
"css-loader": "5.2.7",
|
|
104
|
-
"eslint-import-resolver-typescript": "2.7.0",
|
|
105
|
-
"eslint-import-resolver-webpack": "0.13.2",
|
|
106
|
-
"eslint-plugin-import": "2.26.0",
|
|
107
109
|
"fork-ts-checker-webpack-plugin": "6.5.2",
|
|
108
110
|
"html-webpack-plugin": "4.5.2",
|
|
109
111
|
"sass": "1.54.6",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"button-actions.642b37de.js","sources":["../../../vue2/src/components/button/components/button-actions/button-actions.types.ts","../../../vue2/src/components/button/components/button-actions/button-actions.vue"],"sourcesContent":["import type { VueNodeElement } from '@/types';\nimport type { BentoButtonProps, BentoLoadingButtonState } from '@/components/button';\n\nexport interface BentoButtonActionObject extends BentoButtonProps {\n title: string;\n event?: (event: Event) => void;\n icon?: VueNodeElement;\n iconLeft?: VueNodeElement;\n iconRight?: VueNodeElement;\n state?: BentoLoadingButtonState | `${BentoLoadingButtonState}`;\n}\n\nexport type BentoButtonActionsList = Array<BentoButtonActionObject>;\n\nexport enum BentoButtonActionsLayoutBasic {\n BUTTONS_END = 'buttons-end',\n FILL_CONTAINER = 'fill-container',\n SPACE_BETWEEN = 'space-between',\n VERTICAL_STACK = 'vertical-stack',\n}\nexport enum BentoButtonActionsLayoutExtended {\n BUTTONS_START = 'buttons-start',\n}\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport const BentoButtonActionsLayout = { ...BentoButtonActionsLayoutBasic, ...BentoButtonActionsLayoutExtended };\nexport type BentoButtonActionsLayout = BentoButtonActionsLayoutBasic | BentoButtonActionsLayoutExtended;\n","<template>\n <div class=\"b-button-actions\">\n <div class=\"b-button-actions__container-wrapper\" :class=\"conditionalClasses\" role=\"group\">\n <div v-for=\"(button, index) in reversedActionsList\" :key=\"index\" class=\"b-button-actions__button-wrapper\">\n <bento-loading-button\n v-if=\"button.state\"\n :condensed=\"button.condensed\"\n :critical=\"button.critical\"\n :disabled=\"button.disabled\"\n :inverse=\"inverse\"\n :state=\"button.state\"\n :variant=\"button.variant || generateButtonVariantByIndex(index)\"\n v-on=\"generateButtonEvents(button)\"\n >\n {{ button.title }}\n </bento-loading-button>\n <bento-button\n v-else\n :condensed=\"button.condensed\"\n :critical=\"button.critical\"\n :disabled=\"button.disabled\"\n :inverse=\"inverse\"\n :link=\"button.link\"\n :variant=\"button.variant || generateButtonVariantByIndex(index)\"\n v-on=\"generateButtonEvents(button)\"\n >\n <template v-if=\"button.icon || button.iconLeft\" #iconLeft>\n <component :is=\"button.icon || button.iconLeft\" :svg-title=\"button.title\"></component>\n </template>\n {{ button.title }}\n <template v-if=\"button.iconRight\" #iconRight>\n <component :is=\"button.iconRight\" :svg-title=\"button.title\"></component>\n </template>\n </bento-button>\n </div>\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, PropType } from 'vue';\n import BentoButton from '../../button.vue';\n import { BentoButtonActionObject, BentoButtonActionsLayout, BentoButtonActionsList } from './button-actions.types';\n import { BentoLoadingButton } from '../loading-button';\n\n const props = defineProps({\n /**\n * List of actions that will be used to render the buttons.\n * First element in the list will be rendered as \"primary\".\n * All elements after the first will be rendered as \"secondary\".\n *\n * Each object in the list should have a `title`, an `event` and\n * (optional) a Vue `icon` from the library `@adyen/ui-assets-icons-16`.\n *\n * `title`: Button's text.\n *\n * `event`: Event triggered when clicking the Button.\n *\n * `icon` (optional): Vue Icon from the library `@adyen/ui-assets-icons-16`.\n *\n * @see BentoButton for a list of all the other props supported by each button action.\n *\n * ```\n * [{\n * title: 'Primary',\n * event: () => { ... },\n * icon: FourPeopleIcon,\n * link: {\n * variant: 'default',\n * external: true,\n * to: 'https://www.adyen.com/'\n * },\n * }, {\n * title: 'Secondary',\n * event: () => { ... }\n * disabled: true,\n * variant: 'secondary',\n * critical: true\n * }]\n * ```\n */\n actions: {\n type: Array as PropType<BentoButtonActionsList>,\n required: true,\n },\n\n /**\n * Sets the Button Actions to color scheme inverse\n */\n inverse: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Defines the layout in which the button actions is presented.\n * It can be one of:\n *\n * @values BUTTONS_START\n * @values BUTTONS_END\n * @values FILL_CONTAINER\n * @values SPACE_BETWEEN\n * @values VERTICAL_STACK\n */\n layout: {\n type: String as PropType<BentoButtonActionsLayout | `${BentoButtonActionsLayout}`>,\n default: BentoButtonActionsLayout.BUTTONS_END,\n validator: (layout: BentoButtonActionsLayout) => Object.values(BentoButtonActionsLayout).includes(layout),\n },\n });\n\n const reversedActionsList = computed(() => props.actions.slice().reverse());\n const generateButtonVariantByIndex = actionIndex => {\n const lastActionIndex = props.actions.length - 1;\n return actionIndex === lastActionIndex ? 'primary' : 'secondary';\n };\n\n const conditionalClasses = computed(() => ({\n [`b-button-actions--${props.layout}`]: true,\n }));\n\n const generateButtonEvents = (button: BentoButtonActionObject) =>\n button?.event !== undefined\n ? {\n click: button.event,\n }\n : {};\n</script>\n\n<script lang=\"ts\">\n /**\n * ButtonActions component component manages a set of actions a user can choose from by displaying a group of buttons.\n *\n * @example\n * import { BentoButtonActions } from '@adyen/bento-vue2';\n * import MachineLearningIcon from '@adyen/ui-assets-icons-16/vue/machine-learning';\n *\n * const clickedAction = () => { //your action here }\n *\n * <template>\n * <bento-button-actions\n * :actions=\"[{\n * title: 'Primary',\n * event: clickedAction,\n * icon: MachineLearningIcon,\n * }, {\n * title: 'Secondary',\n * event: clickedAction,\n * }, {\n * title: 'Tertiary',\n * event: clickedAction,\n * }]\"\n * />\n * </template>\n */\n export default {};\n</script>\n\n<style lang=\"scss\" scoped src=\"./button-actions.scss\" />\n"],"names":["BentoButtonActionsLayoutBasic","BentoButtonActionsLayoutBasic2","BentoButtonActionsLayoutExtended","BentoButtonActionsLayoutExtended2","BentoButtonActionsLayout","__default__","reversedActionsList","computed","props","generateButtonVariantByIndex","actionIndex","lastActionIndex","conditionalClasses","generateButtonEvents","button"],"mappings":";;;;;AAcY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,cAAA,eACAA,EAAA,iBAAA,kBACAA,EAAA,gBAAA,iBACAA,EAAA,iBAAA,kBAJQA,IAAAD,KAAA,CAAA,CAAA,GAMAE,IAAA,kBAAAC,OACRA,EAAA,gBAAA,iBADQA,IAAAD,KAAA,CAAA,CAAA;AAOL,MAAAE,IAAA,EAAA,GAAAJ,GAAA,GAAAE,EAAA,sCCgIHG,IAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA5CAC,IAAAC,EAAA,MAAAC,EAAA,QAAA,MAAA,EAAA,QAAA,CAAA,GACAC,IAAA,CAAAC,MAAA;AACI,YAAAC,IAAAH,EAAA,QAAA,SAAA;AACA,aAAAE,MAAAC,IAAA,YAAA;AAAA,IAAqD,GAGzDC,IAAAL,EAAA,OAAA;AAAA,MAA2C,CAAA,qBAAAC,EAAA,QAAA,GAAA;AAAA,IACA,EAAA,GAG3CK,IAAA,CAAAC,OAAAA,KAAA,gBAAAA,EAAA,WAAA,SAAA;AAAA,MAEU,OAAAA,EAAA;AAAA,IACkB,IAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|