@adyen/bento-vue2 1.8.0 → 1.9.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/packages/vue2/src/components/data-grid/composables/useKeyboardNavigator/useKeyboardNavigator.d.ts +6 -2
- package/dist/@types/packages/vue2/src/components/data-grid/composables/useScroller/useScroller.d.ts +6 -0
- package/dist/@types/packages/vue2/src/components/data-grid/data-grid.vue.d.ts +23 -391
- package/dist/@types/packages/vue2/src/components/divider/divider.vue.d.ts +1 -5
- package/dist/@types/packages/vue2/src/components/dropdown/components/dropdown-default-textbox/dropdown-default-textbox.vue.d.ts +10 -0
- package/dist/@types/packages/vue2/src/components/dropdown/components/variants/dropdown-avatar/dropdown-avatar.vue.d.ts +9 -0
- package/dist/@types/packages/vue2/src/components/dropdown/components/variants/dropdown-country/dropdown-country.vue.d.ts +9 -0
- package/dist/@types/packages/vue2/src/components/dropdown/components/variants/dropdown-currency/dropdown-currency.vue.d.ts +9 -0
- package/dist/@types/packages/vue2/src/components/dropdown/components/variants/dropdown-payment-method/dropdown-payment-method.vue.d.ts +9 -0
- package/dist/@types/packages/vue2/src/components/dropdown/components/variants/dropdown-tag/dropdown-tag.vue.d.ts +9 -0
- package/dist/@types/packages/vue2/src/components/dropdown/dropdown.vue.d.ts +12 -0
- package/dist/@types/packages/vue2/src/components/filter-bar/components/base-filter/base-filter.vue.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/input-field/input-field.types.d.ts +1 -3
- package/dist/@types/packages/vue2/src/components/internal/field-label/field-label.vue.d.ts +9 -0
- package/dist/accordion.js +3 -3
- package/dist/action-bar.js +8 -8
- package/dist/alert.js +26 -26
- package/dist/alert.js.map +1 -1
- package/dist/assets/base-modal.css +1 -1
- package/dist/assets/checkbox.css +1 -1
- package/dist/assets/copy.css +1 -1
- package/dist/assets/cross.css +1 -1
- package/dist/assets/dropdown-default-textbox.css +1 -1
- package/dist/assets/dropdown.css +1 -1
- package/dist/assets/field-label.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/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/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/listbox.css +1 -1
- package/dist/avatar-image.js +1 -1
- package/dist/badge.js +2 -2
- package/dist/button.js +5 -5
- package/dist/card.js +5 -5
- package/dist/checkbox.js +6 -6
- package/dist/chunks/arrow-left.2db60716.js +26 -0
- package/dist/chunks/arrow-left.2db60716.js.map +1 -0
- package/dist/chunks/{base-button.7886a7e6.js → base-button.df9a9bea.js} +3 -3
- package/dist/chunks/{base-button.7886a7e6.js.map → base-button.df9a9bea.js.map} +1 -1
- package/dist/chunks/{base-modal.31634fe8.js → base-modal.75319f4e.js} +8 -8
- package/dist/chunks/{base-modal.31634fe8.js.map → base-modal.75319f4e.js.map} +1 -1
- package/dist/chunks/{button-actions-with-menu.5faea13e.js → button-actions-with-menu.32770485.js} +3 -3
- package/dist/chunks/{button-actions-with-menu.5faea13e.js.map → button-actions-with-menu.32770485.js.map} +1 -1
- package/dist/chunks/{button.e09d5980.js → button.7dd8d4de.js} +3 -3
- package/dist/chunks/{button.e09d5980.js.map → button.7dd8d4de.js.map} +1 -1
- package/dist/chunks/{calendar.47e9e755.js → calendar.a885d8fc.js} +6 -6
- package/dist/chunks/{calendar.47e9e755.js.map → calendar.a885d8fc.js.map} +1 -1
- package/dist/chunks/{checkbox.2277450e.js → checkbox.65743b08.js} +33 -33
- package/dist/chunks/checkbox.65743b08.js.map +1 -0
- package/dist/chunks/checkmark-circle-fill.345311d2.js +26 -0
- package/dist/chunks/checkmark-circle-fill.345311d2.js.map +1 -0
- package/dist/chunks/checkmark-small.520f01b1.js +26 -0
- package/dist/chunks/checkmark-small.520f01b1.js.map +1 -0
- package/dist/chunks/checkmark.a6ed8f47.js +26 -0
- package/dist/chunks/checkmark.a6ed8f47.js.map +1 -0
- package/dist/chunks/chevron-left.5edf02ac.js +47 -0
- package/dist/chunks/chevron-left.5edf02ac.js.map +1 -0
- package/dist/chunks/chevron-up.81185563.js +47 -0
- package/dist/chunks/chevron-up.81185563.js.map +1 -0
- package/dist/chunks/{controls-group.6c5bfccd.js → controls-group.dd967ccf.js} +3 -3
- package/dist/chunks/{controls-group.6c5bfccd.js.map → controls-group.dd967ccf.js.map} +1 -1
- package/dist/chunks/copy.e12b418e.js +103 -0
- package/dist/chunks/copy.e12b418e.js.map +1 -0
- package/dist/chunks/cross-circle-fill.7c07d16a.js +26 -0
- package/dist/chunks/cross-circle-fill.7c07d16a.js.map +1 -0
- package/dist/chunks/cross.04678d81.js +26 -0
- package/dist/chunks/cross.04678d81.js.map +1 -0
- package/dist/chunks/{dropdown-default-textbox.25134789.js → dropdown-default-textbox.465db4d4.js} +29 -24
- package/dist/chunks/{dropdown-default-textbox.25134789.js.map → dropdown-default-textbox.465db4d4.js.map} +1 -1
- package/dist/chunks/{dropdown.ce937989.js → dropdown.6461dbe3.js} +212 -205
- package/dist/chunks/dropdown.6461dbe3.js.map +1 -0
- package/dist/chunks/field-label.01df3cba.js +111 -0
- package/dist/chunks/field-label.01df3cba.js.map +1 -0
- package/dist/chunks/{fixed-scroller.8994e30a.js → fixed-scroller.42354ccc.js} +4 -4
- package/dist/chunks/{fixed-scroller.8994e30a.js.map → fixed-scroller.42354ccc.js.map} +1 -1
- package/dist/chunks/{footer-actions.c9b2cb74.js → footer-actions.2cd9079e.js} +3 -3
- package/dist/chunks/{footer-actions.c9b2cb74.js.map → footer-actions.2cd9079e.js.map} +1 -1
- package/dist/chunks/{get-slot-text.c1114034.js → get-slot-text.99c3d860.js} +2 -2
- package/dist/chunks/{get-slot-text.c1114034.js.map → get-slot-text.99c3d860.js.map} +1 -1
- package/dist/chunks/{grid-layout.a806acb2.js → grid-layout.e0025286.js} +2 -2
- package/dist/chunks/{grid-layout.a806acb2.js.map → grid-layout.e0025286.js.map} +1 -1
- package/dist/chunks/{i18n.155748d6.js → i18n.eb5b985b.js} +2 -2
- package/dist/chunks/{i18n.155748d6.js.map → i18n.eb5b985b.js.map} +1 -1
- package/dist/chunks/{index.89942d3a.js → index.02da8d63.js} +6 -5
- package/dist/chunks/{index.89942d3a.js.map → index.02da8d63.js.map} +1 -1
- package/dist/chunks/{index.a5de5242.js → index.0890dc99.js} +7 -7
- package/dist/chunks/{index.a5de5242.js.map → index.0890dc99.js.map} +1 -1
- package/dist/chunks/{index.66503760.js → index.152b2b16.js} +4 -4
- package/dist/chunks/{index.66503760.js.map → index.152b2b16.js.map} +1 -1
- package/dist/chunks/{index.a99ffd48.js → index.16914bb1.js} +30 -29
- package/dist/chunks/{index.a99ffd48.js.map → index.16914bb1.js.map} +1 -1
- package/dist/chunks/{index.b83f8b7e.js → index.322692c8.js} +3 -3
- package/dist/chunks/{index.b83f8b7e.js.map → index.322692c8.js.map} +1 -1
- package/dist/chunks/index.4c062058.js +8 -0
- package/dist/chunks/{index.af05ced4.js.map → index.4c062058.js.map} +1 -1
- package/dist/chunks/{index.86fc63ca.js → index.6cef7328.js} +3 -3
- package/dist/chunks/{index.86fc63ca.js.map → index.6cef7328.js.map} +1 -1
- package/dist/chunks/{index.965ac1af.js → index.b201e81d.js} +2 -2
- package/dist/chunks/{index.965ac1af.js.map → index.b201e81d.js.map} +1 -1
- package/dist/chunks/{index.210d2169.js → index.d1beb704.js} +7 -7
- package/dist/chunks/{index.210d2169.js.map → index.d1beb704.js.map} +1 -1
- package/dist/chunks/{index.d8bd7596.js → index.f358c4bd.js} +9 -9
- package/dist/chunks/index.f358c4bd.js.map +1 -0
- package/dist/chunks/info-filled.27bd4bfb.js +47 -0
- package/dist/chunks/info-filled.27bd4bfb.js.map +1 -0
- package/dist/chunks/{listbox-option-tag.97af47fc.js → listbox-option-tag.55cd9c16.js} +8 -7
- package/dist/chunks/{listbox-option-tag.97af47fc.js.map → listbox-option-tag.55cd9c16.js.map} +1 -1
- package/dist/chunks/{listbox.d039b178.js → listbox.a117e6d4.js} +45 -41
- package/dist/chunks/{listbox.d039b178.js.map → listbox.a117e6d4.js.map} +1 -1
- package/dist/chunks/{loading-button.9a9cbbad.js → loading-button.459b9ab4.js} +4 -4
- package/dist/chunks/{loading-button.9a9cbbad.js.map → loading-button.459b9ab4.js.map} +1 -1
- package/dist/chunks/refresh.71a03998.js +26 -0
- package/dist/chunks/refresh.71a03998.js.map +1 -0
- package/dist/chunks/search.471270fe.js +26 -0
- package/dist/chunks/search.471270fe.js.map +1 -0
- package/dist/chunks/{toastController.0e01443d.js → toastController.fd667b68.js} +2 -2
- package/dist/chunks/{toastController.0e01443d.js.map → toastController.fd667b68.js.map} +1 -1
- package/dist/chunks/{tooltip.ecd0f707.js → tooltip.b8929659.js} +4 -4
- package/dist/chunks/{tooltip.ecd0f707.js.map → tooltip.b8929659.js.map} +1 -1
- package/dist/chunks/{use-default-slot-validator.cbdfe693.js → use-default-slot-validator.b9bff4c6.js} +2 -2
- package/dist/chunks/{use-default-slot-validator.cbdfe693.js.map → use-default-slot-validator.b9bff4c6.js.map} +1 -1
- package/dist/chunks/use-has-slot.fbeb19ec.js +6 -0
- package/dist/chunks/{use-has-slot.6052d56a.js.map → use-has-slot.fbeb19ec.js.map} +1 -1
- package/dist/chunks/{useCountryItems.5d7b436e.js → useCountryItems.34ac8740.js} +2 -2
- package/dist/chunks/{useCountryItems.5d7b436e.js.map → useCountryItems.34ac8740.js.map} +1 -1
- package/dist/code-snippet.js +106 -106
- package/dist/code-snippet.js.map +1 -1
- package/dist/country.js +3 -3
- package/dist/currency.js +2 -2
- package/dist/data-grid.js +768 -832
- package/dist/data-grid.js.map +1 -1
- package/dist/date-picker.js +23 -22
- 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 +13 -27
- package/dist/divider.js.map +1 -1
- package/dist/dropdown.js +5 -5
- package/dist/empty-state.js +3 -3
- package/dist/filter-bar.js +695 -565
- package/dist/filter-bar.js.map +1 -1
- package/dist/focus-trap.js +1 -1
- package/dist/form-layout.js +3 -3
- package/dist/header.js +5 -5
- package/dist/index.js +16 -16
- package/dist/info-icon.js +5 -5
- package/dist/info-icon.js.map +1 -1
- package/dist/input-field.js +40 -42
- package/dist/input-field.js.map +1 -1
- package/dist/internal.js +8 -8
- package/dist/link.js +2 -2
- package/dist/loading-indicator.js +1 -1
- package/dist/menu.js +1 -1
- package/dist/modal.js +5 -5
- package/dist/pagination.js +45 -45
- package/dist/pagination.js.map +1 -1
- package/dist/payment-method.js +3 -3
- package/dist/payment-method.js.map +1 -1
- package/dist/popover.js +1 -1
- package/dist/popper-container.js +1 -1
- package/dist/radio-group.js +7 -7
- package/dist/search-bar.js +5 -5
- package/dist/segmented-control.js +5 -5
- package/dist/sidepanel.js +8 -8
- package/dist/status.js +2 -2
- package/dist/stepper.js +40 -40
- package/dist/stepper.js.map +1 -1
- package/dist/structured-list.js +1 -1
- package/dist/summary-grid.js +5 -5
- package/dist/tabs.js +3 -3
- package/dist/tag.js +4 -4
- package/dist/textarea.js +21 -21
- package/dist/textarea.js.map +1 -1
- package/dist/timeline.js +113 -113
- package/dist/timeline.js.map +1 -1
- package/dist/toast.js +6 -6
- package/dist/toggle.js +6 -6
- package/dist/tutorial.js +71 -71
- package/dist/tutorial.js.map +1 -1
- package/dist/typography.js +1 -1
- package/dist/web-types.json +650 -615
- package/package.json +4 -4
- package/dist/assets/arrow-left.css +0 -1
- package/dist/assets/checkmark-circle-fill.css +0 -1
- package/dist/assets/checkmark-small.css +0 -1
- package/dist/assets/checkmark.css +0 -1
- package/dist/assets/chevron-left.css +0 -1
- package/dist/assets/chevron-up.css +0 -1
- package/dist/assets/cross-circle-fill.css +0 -1
- package/dist/assets/info-filled.css +0 -1
- package/dist/assets/refresh.css +0 -1
- package/dist/assets/search.css +0 -1
- package/dist/chunks/arrow-left.1d5d08bd.js +0 -26
- package/dist/chunks/arrow-left.1d5d08bd.js.map +0 -1
- package/dist/chunks/checkbox.2277450e.js.map +0 -1
- package/dist/chunks/checkmark-circle-fill.2cfbb81b.js +0 -26
- package/dist/chunks/checkmark-circle-fill.2cfbb81b.js.map +0 -1
- package/dist/chunks/checkmark-small.5ca15f00.js +0 -26
- package/dist/chunks/checkmark-small.5ca15f00.js.map +0 -1
- package/dist/chunks/checkmark.78f3ed9c.js +0 -26
- package/dist/chunks/checkmark.78f3ed9c.js.map +0 -1
- package/dist/chunks/chevron-left.c10778d3.js +0 -47
- package/dist/chunks/chevron-left.c10778d3.js.map +0 -1
- package/dist/chunks/chevron-up.674ec2e5.js +0 -47
- package/dist/chunks/chevron-up.674ec2e5.js.map +0 -1
- package/dist/chunks/copy.a85c2e9f.js +0 -103
- package/dist/chunks/copy.a85c2e9f.js.map +0 -1
- package/dist/chunks/cross-circle-fill.d5e9ae44.js +0 -26
- package/dist/chunks/cross-circle-fill.d5e9ae44.js.map +0 -1
- package/dist/chunks/cross.a2cadac5.js +0 -26
- package/dist/chunks/cross.a2cadac5.js.map +0 -1
- package/dist/chunks/dropdown.ce937989.js.map +0 -1
- package/dist/chunks/field-label.330edb60.js +0 -107
- package/dist/chunks/field-label.330edb60.js.map +0 -1
- package/dist/chunks/index.af05ced4.js +0 -7
- package/dist/chunks/index.d8bd7596.js.map +0 -1
- package/dist/chunks/info-filled.48f3268f.js +0 -47
- package/dist/chunks/info-filled.48f3268f.js.map +0 -1
- package/dist/chunks/refresh.eb485c6f.js +0 -26
- package/dist/chunks/refresh.eb485c6f.js.map +0 -1
- package/dist/chunks/search.a8055e95.js +0 -26
- package/dist/chunks/search.a8055e95.js.map +0 -1
- package/dist/chunks/use-has-slot.6052d56a.js +0 -6
package/dist/stepper.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { defineComponent as V, ref as p, computed as o, watch as A, provide as w, readonly as K, useSlots as W, inject as z, onMounted as Z } from "vue";
|
|
2
|
-
import { B as L } from "./chunks/index.
|
|
2
|
+
import { B as L } from "./chunks/index.b201e81d.js";
|
|
3
3
|
import { B as I, a as M } from "./chunks/keyboard-navigation.ca47dfa8.js";
|
|
4
|
-
import { u as U } from "./chunks/i18n.
|
|
4
|
+
import { u as U } from "./chunks/i18n.eb5b985b.js";
|
|
5
5
|
import { n as T } from "./chunks/_plugin-vue2_normalizer.71e2aa87.js";
|
|
6
|
-
import { B as j } from "./chunks/base-button.
|
|
7
|
-
import { C as G } from "./chunks/checkmark-small.
|
|
8
|
-
import "./assets/
|
|
9
|
-
const q = (
|
|
10
|
-
function s(
|
|
6
|
+
import { B as j } from "./chunks/base-button.df9a9bea.js";
|
|
7
|
+
import { C as G } from "./chunks/checkmark-small.520f01b1.js";
|
|
8
|
+
import "./assets/index17.css";
|
|
9
|
+
const q = (i) => {
|
|
10
|
+
function s(r) {
|
|
11
11
|
return ({ detail: u }) => {
|
|
12
12
|
var t;
|
|
13
13
|
u.preventDefault();
|
|
14
|
-
const c =
|
|
15
|
-
c < 0 || (t =
|
|
14
|
+
const c = i.value.indexOf(document.activeElement);
|
|
15
|
+
c < 0 || (t = i.value[c + r]) == null || t.focus();
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
const n = s(-1), e = s(1);
|
|
@@ -23,7 +23,7 @@ const q = (l) => {
|
|
|
23
23
|
[I.ARROW_LEFT]: n
|
|
24
24
|
};
|
|
25
25
|
}, R = Symbol("stepper state");
|
|
26
|
-
var B = /* @__PURE__ */ ((
|
|
26
|
+
var B = /* @__PURE__ */ ((i) => (i.LINEAR = "linear", i.NON_LINEAR = "non-linear", i))(B || {}), O = /* @__PURE__ */ ((i) => (i.HORIZONTAL = "horizontal", i.VERTICAL = "vertical", i))(O || {});
|
|
27
27
|
const J = {
|
|
28
28
|
"en-US": {
|
|
29
29
|
step: "Step {currentIndex}/{totalSteps} {content}"
|
|
@@ -59,19 +59,19 @@ const J = {
|
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
61
|
emits: ["update:index"],
|
|
62
|
-
setup(
|
|
63
|
-
const n =
|
|
62
|
+
setup(i, { emit: s }) {
|
|
63
|
+
const n = i, { t: e } = U(), r = p([]), u = p(n.index), c = p(u.value), t = (a) => {
|
|
64
64
|
a > c.value && (c.value = a), u.value = a;
|
|
65
65
|
}, S = o(() => {
|
|
66
66
|
var a;
|
|
67
|
-
return (a =
|
|
68
|
-
}), v = o(() =>
|
|
69
|
-
() =>
|
|
67
|
+
return (a = r.value[u.value]) == null ? void 0 : a.stepContent;
|
|
68
|
+
}), v = o(() => r.value.length), y = o(() => r.value.map(({ buttonElement: a }) => a)), b = o(() => n.variant === O.HORIZONTAL), _ = o(
|
|
69
|
+
() => r.value.map(({ buttonElement: a, substeps: h }, m) => {
|
|
70
70
|
const N = u.value === m;
|
|
71
71
|
return !b.value && N ? [a].concat(h.map((g) => g.buttonElement)) : [a];
|
|
72
72
|
}).flat()
|
|
73
73
|
), d = (a) => {
|
|
74
|
-
|
|
74
|
+
r.value.push({
|
|
75
75
|
stepContent: a.stepContent,
|
|
76
76
|
buttonElement: a.buttonElement,
|
|
77
77
|
substeps: a.substeps
|
|
@@ -91,7 +91,7 @@ const J = {
|
|
|
91
91
|
s("update:index", a);
|
|
92
92
|
});
|
|
93
93
|
const x = q(_);
|
|
94
|
-
return w(R, K(f)), { __sfc: !0, props: n, emit: s, t: e, childrenSteps:
|
|
94
|
+
return w(R, K(f)), { __sfc: !0, props: n, emit: s, t: e, childrenSteps: r, activeStepIndex: u, latestActiveStep: c, navigateToStep: t, currentStepContent: S, stepsAmount: v, childrenStepsElements: y, isHorizontalVariant: b, allVisibleStepsElements: _, registerStep: d, stepperState: f, conditionalClasses: C, keyboardNavigationListeners: x, BentoTypography: L, vBentoKeyboardNavigationDirective: M };
|
|
95
95
|
}
|
|
96
96
|
});
|
|
97
97
|
var Y = function() {
|
|
@@ -116,21 +116,21 @@ const se = {
|
|
|
116
116
|
};
|
|
117
117
|
var ne = function() {
|
|
118
118
|
var s = this, n = s._self._c;
|
|
119
|
-
return n("svg", s._b({ attrs: { role: "img", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "none" } }, "svg", s.$attrs, !1), [s.$attrs["svg-title"] ? n("title", [s._v(s._s(s.$attrs["svg-title"]))]) : s._e(), n("path", { attrs: { fill: "#00112C",
|
|
119
|
+
return n("svg", s._b({ staticClass: "ui-assets-icons-16", attrs: { role: "img", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "none" } }, "svg", s.$attrs, !1), [s.$attrs["svg-title"] ? n("title", [s._v(s._s(s.$attrs["svg-title"]))]) : s._e(), n("path", { attrs: { fill: "#00112C", d: "M8 5.25C6.48122 5.25 5.25 6.48122 5.25 8C5.25 9.51878 6.48122 10.75 8 10.75C9.51878 10.75 10.75 9.51878 10.75 8C10.75 6.48122 9.51878 5.25 8 5.25Z" } })]);
|
|
120
120
|
}, ae = [], oe = /* @__PURE__ */ T(
|
|
121
121
|
se,
|
|
122
122
|
ne,
|
|
123
123
|
ae,
|
|
124
124
|
!1,
|
|
125
125
|
null,
|
|
126
|
-
|
|
126
|
+
null,
|
|
127
127
|
null,
|
|
128
128
|
null
|
|
129
129
|
);
|
|
130
|
-
const
|
|
130
|
+
const ie = oe.exports, le = {
|
|
131
131
|
name: "step"
|
|
132
|
-
},
|
|
133
|
-
...
|
|
132
|
+
}, re = /* @__PURE__ */ V({
|
|
133
|
+
...le,
|
|
134
134
|
props: {
|
|
135
135
|
/**
|
|
136
136
|
* Completed status. Used on non-linear steppers to indicate if the step is completed.
|
|
@@ -148,20 +148,20 @@ const le = oe.exports, re = {
|
|
|
148
148
|
}
|
|
149
149
|
},
|
|
150
150
|
emits: ["update:substep-index"],
|
|
151
|
-
setup(
|
|
152
|
-
const n =
|
|
153
|
-
var
|
|
154
|
-
return (
|
|
151
|
+
setup(i, { emit: s }) {
|
|
152
|
+
const n = i, e = W(), r = p(null), u = p(null), c = p([]), t = z(R), S = o(() => {
|
|
153
|
+
var l;
|
|
154
|
+
return (l = r.value) == null ? void 0 : l.$el;
|
|
155
155
|
}), v = o(() => t == null ? void 0 : t.value.steps.indexOf(S.value)), y = o(() => {
|
|
156
|
-
var
|
|
157
|
-
return (
|
|
158
|
-
}), b = o(() => c.value.map(({ buttonElement:
|
|
159
|
-
|
|
160
|
-
}, C = (
|
|
156
|
+
var l;
|
|
157
|
+
return (l = u.value) == null ? void 0 : l.$el.textContent;
|
|
158
|
+
}), b = o(() => c.value.map(({ buttonElement: l }) => l)), _ = p(n.substepIndex), d = p(_.value), f = (l) => {
|
|
159
|
+
l > d.value && (d.value = l), _.value = l;
|
|
160
|
+
}, C = (l) => {
|
|
161
161
|
c.value.push({
|
|
162
|
-
stepContent:
|
|
163
|
-
buttonElement:
|
|
164
|
-
substeps:
|
|
162
|
+
stepContent: l.stepContent,
|
|
163
|
+
buttonElement: l.buttonElement,
|
|
164
|
+
substeps: l.substeps
|
|
165
165
|
});
|
|
166
166
|
}, x = p({
|
|
167
167
|
activeStepIndex: _,
|
|
@@ -173,8 +173,8 @@ const le = oe.exports, re = {
|
|
|
173
173
|
navigateToStep: f,
|
|
174
174
|
registerStep: C
|
|
175
175
|
});
|
|
176
|
-
w(R, x), A(() => n.substepIndex, f), A(_, (
|
|
177
|
-
s("update:substep-index",
|
|
176
|
+
w(R, x), A(() => n.substepIndex, f), A(_, (l) => {
|
|
177
|
+
s("update:substep-index", l);
|
|
178
178
|
}), Z(() => {
|
|
179
179
|
if (!t)
|
|
180
180
|
throw new Error(
|
|
@@ -197,20 +197,20 @@ const le = oe.exports, re = {
|
|
|
197
197
|
"b-step--completed": E.value,
|
|
198
198
|
"b-step--substep": a.value
|
|
199
199
|
}));
|
|
200
|
-
return { __sfc: !0, slots: e, props: n, emit: s, buttonComponent:
|
|
200
|
+
return { __sfc: !0, slots: e, props: n, emit: s, buttonComponent: r, stepContent: u, substeps: c, stepper: t, buttonElement: S, index: v, stepContentValue: y, substepsButtonElements: b, activeSubStepIndex: _, latestActiveSubStepIndex: d, navigateToSubstep: f, registerSubstep: C, stepState: x, isSubstep: a, isFocused: h, isActive: m, isSubstepsVisible: N, isCompleted: E, isDisabled: g, navigateToStep: D, ariaCurrentValue: k, ariaDisabledValue: P, tabIndexValue: F, conditionalClasses: H, BaseButton: j, BentoTypography: L, CheckmarkSmallIcon: G, DotIcon: ie };
|
|
201
201
|
}
|
|
202
202
|
});
|
|
203
203
|
var ue = function() {
|
|
204
204
|
var s = this, n = s._self._c, e = s._self._setupProxy;
|
|
205
|
-
return n("li", { staticClass: "b-step", class: e.conditionalClasses }, [n(e.BaseButton, { ref: "buttonComponent", staticClass: "b-step__button", attrs: { "aria-current": e.ariaCurrentValue, "aria-disabled": e.ariaDisabledValue, type: "button", tabindex: e.tabIndexValue, disabled: e.isDisabled }, on: { click: e.navigateToStep, focus: function(
|
|
205
|
+
return n("li", { staticClass: "b-step", class: e.conditionalClasses }, [n(e.BaseButton, { ref: "buttonComponent", staticClass: "b-step__button", attrs: { "aria-current": e.ariaCurrentValue, "aria-disabled": e.ariaDisabledValue, type: "button", tabindex: e.tabIndexValue, disabled: e.isDisabled }, on: { click: e.navigateToStep, focus: function(r) {
|
|
206
206
|
e.isFocused = !0;
|
|
207
|
-
}, blur: function(
|
|
207
|
+
}, blur: function(r) {
|
|
208
208
|
e.isFocused = !1;
|
|
209
209
|
} }, scopedSlots: s._u([{ key: "iconLeft", fn: function() {
|
|
210
210
|
return [n(e.BentoTypography, { staticClass: "b-step__index", attrs: { el: "span", variant: "body", stronger: "", "aria-hidden": "true" } }, [e.isCompleted ? n(e.CheckmarkSmallIcon) : e.isSubstep ? n(e.DotIcon) : [s._v(s._s(e.index + 1))]], 2)];
|
|
211
211
|
}, proxy: !0 }]) }, [n(e.BentoTypography, { ref: "stepContent", staticClass: "b-step__content", attrs: { el: "span", variant: "body", stronger: e.isActive } }, [s._t("default")], 2)], 1), n("ul", { directives: [{ name: "show", rawName: "v-show", value: e.isSubstepsVisible, expression: "isSubstepsVisible" }], ref: "substepList", staticClass: "b-step__substep-list" }, [s._t("substeps")], 2)], 1);
|
|
212
212
|
}, ce = [], pe = /* @__PURE__ */ T(
|
|
213
|
-
|
|
213
|
+
re,
|
|
214
214
|
ue,
|
|
215
215
|
ce,
|
|
216
216
|
!1,
|
package/dist/stepper.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stepper.js","sources":["../src/components/stepper/composables/useKeyboardNavigation/useKeyboardNavigation.ts","../src/components/stepper/stepper.keys.ts","../src/components/stepper/stepper.types.ts","../src/components/stepper/stepper.vue","../../../node_modules/@adyen/ui-assets-icons-16/dist/vue/dot.vue","../src/components/stepper/components/step/step.vue"],"sourcesContent":["import { Ref } from 'vue';\n\nimport { BentoKeyboardNavigationKeyDownEvent } from '@/types';\n\n/**\n * Returns keyboard navigation's event handlers to navigate through the steps\n *\n * @param steps the list of bento-steps DOM elements to focus on the navigation\n * @returns\n */\nexport const useKeyboardNavigation = (steps: Ref<HTMLButtonElement[]>) => {\n // Returns the event handler that moves the focus on a given step offset\n function focusOnStep(indexOffset: number) {\n return ({ detail: event }) => {\n event.preventDefault();\n\n const currentIndex = steps.value.indexOf(document.activeElement as HTMLButtonElement);\n if (currentIndex < 0) {\n return;\n }\n\n steps.value[currentIndex + indexOffset]?.focus();\n };\n }\n\n const focusOnPreviousStep = focusOnStep(-1);\n const focusOnNextStep = focusOnStep(1);\n\n return {\n [BentoKeyboardNavigationKeyDownEvent.ARROW_DOWN]: focusOnNextStep,\n [BentoKeyboardNavigationKeyDownEvent.ARROW_RIGHT]: focusOnNextStep,\n [BentoKeyboardNavigationKeyDownEvent.ARROW_UP]: focusOnPreviousStep,\n [BentoKeyboardNavigationKeyDownEvent.ARROW_LEFT]: focusOnPreviousStep,\n };\n};\n","import type { InjectionKey } from 'vue';\n\nimport type { BentoStepperState } from './stepper.types';\n\nexport const STEPPER_STATE = Symbol('stepper state') as InjectionKey<BentoStepperState>;\n","import type { ComputedRef, Ref } from 'vue';\n\nexport enum BentoStepperTypeOption {\n LINEAR = 'linear',\n NON_LINEAR = 'non-linear',\n}\n\nexport enum BentoStepperVariantOption {\n HORIZONTAL = 'horizontal',\n VERTICAL = 'vertical',\n}\n\nexport interface BentoStepperStepExposeState {\n buttonElement: HTMLButtonElement | Ref<HTMLButtonElement>;\n substeps: BentoStepperStepExposeState[] | Ref<BentoStepperStepExposeState[]>;\n stepContent: string | ComputedRef<string>;\n}\n\nexport type BentoStepperState = Ref<{\n activeStepIndex: number;\n latestActiveStep: number;\n type: `${BentoStepperTypeOption}`;\n variant: `${BentoStepperVariantOption}`;\n steps: HTMLElement[];\n isParentStep?: boolean;\n navigateToStep: (index: number) => void;\n registerStep: (stepState: BentoStepperStepExposeState) => void;\n}>;\n","<template>\n <nav class=\"b-stepper\">\n <ol\n v-bento-keyboard-navigation-directive\n class=\"b-stepper__list\"\n :class=\"conditionalClasses\"\n v-on=\"keyboardNavigationListeners\"\n >\n <slot></slot>\n </ol>\n\n <bento-typography el=\"span\" variant=\"body\" stronger class=\"b-stepper__text-stepper\"\n >{{\n t('step', { currentIndex: activeStepIndex + 1, totalSteps: stepsAmount, content: currentStepContent })\n }}\n </bento-typography>\n </nav>\n</template>\n\n<script setup lang=\"ts\">\n import { BentoTypography } from '@/components/typography';\n\n import { computed, PropType, provide, readonly, ref, watch } from 'vue';\n import { BentoKeyboardNavigationDirective as vBentoKeyboardNavigationDirective } from '@/directives';\n\n import { useKeyboardNavigation } from './composables/useKeyboardNavigation/useKeyboardNavigation';\n import { useI18n } from '@/utils/ts/i18n';\n\n import { STEPPER_STATE } from './stepper.keys';\n import {\n BentoStepperState,\n BentoStepperStepExposeState,\n BentoStepperTypeOption,\n BentoStepperVariantOption,\n } from './stepper.types';\n\n import messages from './messages.json';\n\n const props = defineProps({\n /**\n * Type of stepper; defines how the stepper should behave. Default: linear\n * @values linear, non-linear\n */\n type: {\n type: String as PropType<`${BentoStepperTypeOption}`>,\n default: 'linear',\n },\n /**\n * Stepper variant; defines how the stepper should be displayed. Default: vertical\n * @values vertical, horizontal\n */\n variant: {\n type: String as PropType<`${BentoStepperVariantOption}`>,\n default: 'vertical',\n },\n /**\n * Active step index\n */\n index: {\n type: Number,\n default: 0,\n },\n });\n\n const emit = defineEmits<{\n /**\n * Event triggered when step is updated by the stepper\n */\n (e: 'update:index', index: number): void;\n }>();\n\n type MessageSchema = (typeof messages)['en-US'];\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const childrenSteps = ref<BentoStepperStepExposeState[]>([]);\n const activeStepIndex = ref(props.index);\n const latestActiveStep = ref(activeStepIndex.value);\n\n const navigateToStep = (index: number) => {\n // Stores latest active step index so users can navigate backwards and forwards on linear stepper\n if (index > latestActiveStep.value) {\n latestActiveStep.value = index;\n }\n activeStepIndex.value = index;\n };\n\n const currentStepContent = computed(() => childrenSteps.value[activeStepIndex.value]?.stepContent);\n const stepsAmount = computed(() => childrenSteps.value.length);\n const childrenStepsElements = computed(() => childrenSteps.value.map(({ buttonElement }) => buttonElement));\n const isHorizontalVariant = computed(() => props.variant === BentoStepperVariantOption.HORIZONTAL);\n\n // List of all visible steps nested on the stepper, including the substeps of the children steps\n // Flattening the steps on a single list makes the keyboard navigation easier to be handled\n const allVisibleStepsElements = computed(() =>\n childrenSteps.value\n .map(({ buttonElement, substeps }, index) => {\n const isStepActive = activeStepIndex.value === index;\n const isSubstepsVisible = !isHorizontalVariant.value && isStepActive;\n\n if (!isSubstepsVisible) {\n return [buttonElement];\n }\n\n return [buttonElement].concat(substeps.map(step => step.buttonElement));\n })\n .flat()\n );\n\n // Maps BentoStep children components whenever the DOM is updated to keep track of steps indexes\n const registerStep = (stepState: BentoStepperStepExposeState) => {\n childrenSteps.value.push({\n stepContent: stepState.stepContent as string,\n buttonElement: stepState.buttonElement as HTMLButtonElement,\n substeps: stepState.substeps as BentoStepperStepExposeState[],\n });\n };\n\n const stepperState: BentoStepperState = ref({\n activeStepIndex,\n latestActiveStep,\n steps: childrenStepsElements,\n type: props.type,\n variant: props.variant,\n navigateToStep,\n registerStep,\n });\n\n const conditionalClasses = computed(() => ({\n 'b-stepper__list--horizontal': isHorizontalVariant.value,\n }));\n\n watch(() => props.index, navigateToStep);\n watch(activeStepIndex, index => {\n emit('update:index', index);\n });\n\n const keyboardNavigationListeners = useKeyboardNavigation(allVisibleStepsElements);\n\n // Provides stepper state to BentoStep children components\n provide(STEPPER_STATE, readonly(stepperState));\n</script>\n\n<script lang=\"ts\">\n /**\n * Steppers break down complex processes into manageable steps to guide users through a sequential or multi-step process.\n *\n * @example\n * import { BentoStep, BentoStepper } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoStep, BentoStepper },\n * template: `\n * <bento-stepper :index=\"1\">\n * <bento-step>Step 1</bento-step>\n * <bento-step>Step 2</bento-step>\n * <bento-step>Step 3</bento-step>\n * </bento-stepper>\n * `\n * }\n */\n\n export default {\n i18n: { messages },\n name: 'stepper',\n };\n</script>\n\n<style scoped src=\"./stepper.scss\" />\n","\n<template>\n <svg role=\"img\" v-bind=\"$attrs\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\"><title v-if=\"$attrs['svg-title']\">{{ $attrs['svg-title'] }}</title><path fill=\"#00112C\" fill-rule=\"evenodd\" d=\"M8 5.25C6.48122 5.25 5.25 6.48122 5.25 8C5.25 9.51878 6.48122 10.75 8 10.75C9.51878 10.75 10.75 9.51878 10.75 8C10.75 6.48122 9.51878 5.25 8 5.25Z\" clip-rule=\"evenodd\"/></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 scoped lang=\"scss\">\n svg {\n display: inline-flex;\n flex-shrink: 0;\n }\n \n svg,\n svg * {\n fill: currentcolor;\n }\n</style>\n","<template>\n <li :class=\"conditionalClasses\" class=\"b-step\">\n <base-button\n ref=\"buttonComponent\"\n :aria-current=\"ariaCurrentValue\"\n :aria-disabled=\"ariaDisabledValue\"\n class=\"b-step__button\"\n type=\"button\"\n :tabindex=\"tabIndexValue\"\n :disabled=\"isDisabled\"\n @click=\"navigateToStep\"\n @focus=\"isFocused = true\"\n @blur=\"isFocused = false\"\n >\n <template #iconLeft>\n <bento-typography el=\"span\" variant=\"body\" stronger class=\"b-step__index\" aria-hidden=\"true\">\n <checkmark-small-icon v-if=\"isCompleted\" />\n <template v-else-if=\"!isSubstep\">{{ index + 1 }}</template>\n <dot-icon v-else />\n </bento-typography>\n </template>\n\n <bento-typography ref=\"stepContent\" el=\"span\" variant=\"body\" :stronger=\"isActive\" class=\"b-step__content\">\n <slot></slot>\n </bento-typography>\n </base-button>\n\n <ul v-show=\"isSubstepsVisible\" ref=\"substepList\" class=\"b-step__substep-list\">\n <slot name=\"substeps\"></slot>\n </ul>\n </li>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, inject, onMounted, provide, ref, useSlots, watch } from 'vue';\n import { BaseButton } from '@/components/internal/base-button';\n import { BentoTypography } from '@/components/typography';\n import CheckmarkSmallIcon from '@adyen/ui-assets-icons-16/vue/checkmark-small';\n import DotIcon from '@adyen/ui-assets-icons-16/vue/dot';\n\n import { STEPPER_STATE } from '../../stepper.keys';\n import {\n BentoStepperState,\n BentoStepperStepExposeState,\n BentoStepperTypeOption,\n BentoStepperVariantOption,\n } from '../../stepper.types';\n import { Booleanish } from '@/types';\n\n const slots = useSlots();\n\n const props = defineProps({\n /**\n * Completed status. Used on non-linear steppers to indicate if the step is completed.\n */\n completed: {\n type: Boolean,\n default: false,\n },\n /**\n * Active substep index\n */\n substepIndex: {\n type: Number,\n default: 0,\n },\n });\n\n const emit = defineEmits<{\n /**\n * Event triggered when substep is updated by the parent step\n */\n (e: 'update:substep-index', index: number): void;\n }>();\n\n // Element refs\n const buttonComponent = ref<InstanceType<typeof BaseButton> | null>(null);\n const stepContent = ref<InstanceType<typeof BentoTypography> | null>(null);\n const substeps = ref<BentoStepperStepExposeState[]>([]);\n\n // Injects parent BentoStepper state data\n const stepper = inject(STEPPER_STATE);\n\n const buttonElement = computed(() => buttonComponent.value?.$el as HTMLButtonElement);\n const index = computed(() => stepper?.value.steps.indexOf(buttonElement.value));\n\n const stepContentValue = computed(() => stepContent.value?.$el.textContent);\n\n // Substep logic\n const substepsButtonElements = computed(() => substeps.value.map(({ buttonElement }) => buttonElement));\n\n const activeSubStepIndex = ref(props.substepIndex);\n const latestActiveSubStepIndex = ref(activeSubStepIndex.value);\n\n const navigateToSubstep = (value: number) => {\n if (value > latestActiveSubStepIndex.value) {\n latestActiveSubStepIndex.value = value;\n }\n\n activeSubStepIndex.value = value;\n };\n\n const registerSubstep = (stepState: BentoStepperStepExposeState) => {\n substeps.value.push({\n stepContent: stepState.stepContent as string,\n buttonElement: stepState.buttonElement as HTMLButtonElement,\n substeps: stepState.substeps as BentoStepperStepExposeState[],\n });\n };\n\n const stepState: BentoStepperState = ref({\n activeStepIndex: activeSubStepIndex,\n latestActiveStep: latestActiveSubStepIndex,\n type: stepper.value.type,\n variant: stepper.value.variant,\n steps: substepsButtonElements,\n isParentStep: true,\n navigateToStep: navigateToSubstep,\n registerStep: registerSubstep,\n });\n\n provide(STEPPER_STATE, stepState);\n\n watch(() => props.substepIndex, navigateToSubstep);\n watch(activeSubStepIndex, value => {\n emit('update:substep-index', value);\n });\n\n onMounted(() => {\n if (!stepper) {\n throw new Error(\n 'BentoStep components should only be used inside BentoStepper or other BentoStep components.'\n );\n }\n\n stepper.value.registerStep({\n buttonElement,\n stepContent: stepContentValue,\n substeps,\n });\n });\n\n // Step states\n const isSubstep = computed(() => stepper.value.isParentStep);\n const isFocused = ref(false);\n const isActive = computed(() => stepper?.value.activeStepIndex === index.value);\n const isSubstepsVisible = computed(\n () =>\n isActive.value &&\n stepper.value.variant !== BentoStepperVariantOption.HORIZONTAL &&\n !isSubstep.value &&\n slots.substeps\n );\n const isCompleted = computed(() => {\n if (stepper?.value.type === BentoStepperTypeOption.NON_LINEAR) {\n return props.completed;\n }\n\n return stepper?.value.latestActiveStep > index.value;\n });\n const isDisabled = computed(\n () => stepper?.value.type === BentoStepperTypeOption.LINEAR && index.value > stepper?.value.latestActiveStep\n );\n\n const navigateToStep = () => {\n if (isDisabled.value) {\n return;\n }\n\n stepper.value.navigateToStep(index.value);\n };\n\n // Styling and a11y\n const ariaCurrentValue = computed(() => (isActive.value ? 'step' : ('false' as Booleanish)));\n const ariaDisabledValue = computed(() => isDisabled.value.toString() as Booleanish);\n const tabIndexValue = computed(() => (isFocused.value || (index.value === 0 && !isSubstep.value) ? '0' : '-1'));\n\n const conditionalClasses = computed(() => ({\n 'b-step--active': isActive.value,\n 'b-step--completed': isCompleted.value,\n 'b-step--substep': isSubstep.value,\n }));\n</script>\n\n<script lang=\"ts\">\n /**\n * Steps are components placed inside BentoSteppers to break down complex processes\n *\n * @example\n * import { BentoStep } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoStep },\n * template: `\n * <bento-stepper>\n * <bento-step>Step 1</bento-step>\n * <bento-step>\n * Step 2\n * <template #substeps>\n * <bento-step>Substep 1</bento-step>\n * <bento-step>Substep 2</bento-step>\n * </template>\n * </bento-step>\n * </bento-stepper>\n * `\n * }\n */\n\n export default {\n name: 'step',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./step.scss\" />\n"],"names":["useKeyboardNavigation","steps","focusOnStep","indexOffset","event","currentIndex","_a","focusOnPreviousStep","focusOnNextStep","BentoKeyboardNavigationKeyDownEvent","STEPPER_STATE","BentoStepperTypeOption","BentoStepperTypeOption2","BentoStepperVariantOption","BentoStepperVariantOption2","__default__$1","messages","t","useI18n","childrenSteps","ref","activeStepIndex","props","latestActiveStep","navigateToStep","index","currentStepContent","computed","stepsAmount","childrenStepsElements","buttonElement","isHorizontalVariant","allVisibleStepsElements","substeps","isStepActive","step","registerStep","stepState","stepperState","conditionalClasses","watch","emit","keyboardNavigationListeners","provide","readonly","uuid","_sfc_main$1","__default__","slots","useSlots","buttonComponent","stepContent","stepper","inject","stepContentValue","substepsButtonElements","buttonElement2","activeSubStepIndex","latestActiveSubStepIndex","navigateToSubstep","value","registerSubstep","stepState2","onMounted","isSubstep","isFocused","isActive","isSubstepsVisible","isCompleted","isDisabled","ariaCurrentValue","ariaDisabledValue","tabIndexValue"],"mappings":";;;;;;;;AAUa,MAAAA,IAAA,CAAAC,MAAA;AAET,WAAAC,EAAAC,GAAA;AACI,WAAA,CAAA,EAAA,QAAAC,EAAA,MAAA;;AACI,MAAAA,EAAA,eAAA;AAEA,YAAAC,IAAAJ,EAAA,MAAA,QAAA,SAAA,aAAA;AACA,MAAAI,IAAA,MAIAC,IAAAL,EAAA,MAAAI,IAAAF,CAAA,MAAA,QAAAG,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,QACa,UAAArB;AAAA,MACb,CAAA;AAAA,IACH,CAAA;AAIL,UAAA+B,IAAArC,EAAA,MAAAyB,EAAA,MAAA,YAAA,GACAa,IAAA7C,EAAA,EAAA,GACA8C,IAAAvC,EAAA,OAAAyB,KAAA,gBAAAA,EAAA,MAAA,qBAAA3B,EAAA,KAAA,GACA0C,IAAAxC;AAAA,MAA0B,MAAAuC,EAAA,SAAAd,EAAA,MAAA,YAAAvC,EAAA,cAAA,CAAAmD,EAAA,SAAAhB,EAAA;AAAA,IAKZ,GAEdoB,IAAAzC,EAAA,OACIyB,KAAA,gBAAAA,EAAA,MAAA,UAAAzC,EAAA,aACIW,EAAA,aAGJ8B,KAAA,gBAAAA,EAAA,MAAA,oBAAA3B,EAAA,KAA+C,GAEnD4C,IAAA1C;AAAA,MAAmB,OAAAyB,KAAA,gBAAAA,EAAA,MAAA,UAAAzC,EAAA,UAAAc,EAAA,SAAA2B,KAAA,gBAAAA,EAAA,MAAA;AAAA,IAC6E,GAGhG5B,IAAA,MAAA;AACI,MAAA6C,EAAA,SAIAjB,EAAA,MAAA,eAAA3B,EAAA,KAAA;AAAA,IAAwC,GAI5C6C,IAAA3C,EAAA,MAAAuC,EAAA,QAAA,SAAA,OAAA,GACAK,IAAA5C,EAAA,MAAA0C,EAAA,MAAA,SAAA,CAAA,GACAG,IAAA7C,EAAA,MAAAsC,EAAA,SAAAxC,EAAA,UAAA,KAAA,CAAAuC,EAAA,QAAA,MAAA,IAAA,GAEAzB,IAAAZ,EAAA,OAAA;AAAA,MAA2C,kBAAAuC,EAAA;AAAA,MACZ,qBAAAE,EAAA;AAAA,MACM,mBAAAJ,EAAA;AAAA,IACJ,EAAA;;;;;;;;;;;;;;;;;;;;;;;;","x_google_ignoreList":[4]}
|
|
1
|
+
{"version":3,"file":"stepper.js","sources":["../src/components/stepper/composables/useKeyboardNavigation/useKeyboardNavigation.ts","../src/components/stepper/stepper.keys.ts","../src/components/stepper/stepper.types.ts","../src/components/stepper/stepper.vue","../node_modules/@adyen/ui-assets-icons-16/dist/vue/dot.vue","../src/components/stepper/components/step/step.vue"],"sourcesContent":["import { Ref } from 'vue';\n\nimport { BentoKeyboardNavigationKeyDownEvent } from '@/types';\n\n/**\n * Returns keyboard navigation's event handlers to navigate through the steps\n *\n * @param steps the list of bento-steps DOM elements to focus on the navigation\n * @returns\n */\nexport const useKeyboardNavigation = (steps: Ref<HTMLButtonElement[]>) => {\n // Returns the event handler that moves the focus on a given step offset\n function focusOnStep(indexOffset: number) {\n return ({ detail: event }) => {\n event.preventDefault();\n\n const currentIndex = steps.value.indexOf(document.activeElement as HTMLButtonElement);\n if (currentIndex < 0) {\n return;\n }\n\n steps.value[currentIndex + indexOffset]?.focus();\n };\n }\n\n const focusOnPreviousStep = focusOnStep(-1);\n const focusOnNextStep = focusOnStep(1);\n\n return {\n [BentoKeyboardNavigationKeyDownEvent.ARROW_DOWN]: focusOnNextStep,\n [BentoKeyboardNavigationKeyDownEvent.ARROW_RIGHT]: focusOnNextStep,\n [BentoKeyboardNavigationKeyDownEvent.ARROW_UP]: focusOnPreviousStep,\n [BentoKeyboardNavigationKeyDownEvent.ARROW_LEFT]: focusOnPreviousStep,\n };\n};\n","import type { InjectionKey } from 'vue';\n\nimport type { BentoStepperState } from './stepper.types';\n\nexport const STEPPER_STATE = Symbol('stepper state') as InjectionKey<BentoStepperState>;\n","import type { ComputedRef, Ref } from 'vue';\n\nexport enum BentoStepperTypeOption {\n LINEAR = 'linear',\n NON_LINEAR = 'non-linear',\n}\n\nexport enum BentoStepperVariantOption {\n HORIZONTAL = 'horizontal',\n VERTICAL = 'vertical',\n}\n\nexport interface BentoStepperStepExposeState {\n buttonElement: HTMLButtonElement | Ref<HTMLButtonElement>;\n substeps: BentoStepperStepExposeState[] | Ref<BentoStepperStepExposeState[]>;\n stepContent: string | ComputedRef<string>;\n}\n\nexport type BentoStepperState = Ref<{\n activeStepIndex: number;\n latestActiveStep: number;\n type: `${BentoStepperTypeOption}`;\n variant: `${BentoStepperVariantOption}`;\n steps: HTMLElement[];\n isParentStep?: boolean;\n navigateToStep: (index: number) => void;\n registerStep: (stepState: BentoStepperStepExposeState) => void;\n}>;\n","<template>\n <nav class=\"b-stepper\">\n <ol\n v-bento-keyboard-navigation-directive\n class=\"b-stepper__list\"\n :class=\"conditionalClasses\"\n v-on=\"keyboardNavigationListeners\"\n >\n <slot></slot>\n </ol>\n\n <bento-typography el=\"span\" variant=\"body\" stronger class=\"b-stepper__text-stepper\"\n >{{\n t('step', { currentIndex: activeStepIndex + 1, totalSteps: stepsAmount, content: currentStepContent })\n }}\n </bento-typography>\n </nav>\n</template>\n\n<script setup lang=\"ts\">\n import { BentoTypography } from '@/components/typography';\n\n import { computed, PropType, provide, readonly, ref, watch } from 'vue';\n import { BentoKeyboardNavigationDirective as vBentoKeyboardNavigationDirective } from '@/directives';\n\n import { useKeyboardNavigation } from './composables/useKeyboardNavigation/useKeyboardNavigation';\n import { useI18n } from '@/utils/ts/i18n';\n\n import { STEPPER_STATE } from './stepper.keys';\n import {\n BentoStepperState,\n BentoStepperStepExposeState,\n BentoStepperTypeOption,\n BentoStepperVariantOption,\n } from './stepper.types';\n\n import messages from './messages.json';\n\n const props = defineProps({\n /**\n * Type of stepper; defines how the stepper should behave. Default: linear\n * @values linear, non-linear\n */\n type: {\n type: String as PropType<`${BentoStepperTypeOption}`>,\n default: 'linear',\n },\n /**\n * Stepper variant; defines how the stepper should be displayed. Default: vertical\n * @values vertical, horizontal\n */\n variant: {\n type: String as PropType<`${BentoStepperVariantOption}`>,\n default: 'vertical',\n },\n /**\n * Active step index\n */\n index: {\n type: Number,\n default: 0,\n },\n });\n\n const emit = defineEmits<{\n /**\n * Event triggered when step is updated by the stepper\n */\n (e: 'update:index', index: number): void;\n }>();\n\n type MessageSchema = (typeof messages)['en-US'];\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const childrenSteps = ref<BentoStepperStepExposeState[]>([]);\n const activeStepIndex = ref(props.index);\n const latestActiveStep = ref(activeStepIndex.value);\n\n const navigateToStep = (index: number) => {\n // Stores latest active step index so users can navigate backwards and forwards on linear stepper\n if (index > latestActiveStep.value) {\n latestActiveStep.value = index;\n }\n activeStepIndex.value = index;\n };\n\n const currentStepContent = computed(() => childrenSteps.value[activeStepIndex.value]?.stepContent);\n const stepsAmount = computed(() => childrenSteps.value.length);\n const childrenStepsElements = computed(() => childrenSteps.value.map(({ buttonElement }) => buttonElement));\n const isHorizontalVariant = computed(() => props.variant === BentoStepperVariantOption.HORIZONTAL);\n\n // List of all visible steps nested on the stepper, including the substeps of the children steps\n // Flattening the steps on a single list makes the keyboard navigation easier to be handled\n const allVisibleStepsElements = computed(() =>\n childrenSteps.value\n .map(({ buttonElement, substeps }, index) => {\n const isStepActive = activeStepIndex.value === index;\n const isSubstepsVisible = !isHorizontalVariant.value && isStepActive;\n\n if (!isSubstepsVisible) {\n return [buttonElement];\n }\n\n return [buttonElement].concat(substeps.map(step => step.buttonElement));\n })\n .flat()\n );\n\n // Maps BentoStep children components whenever the DOM is updated to keep track of steps indexes\n const registerStep = (stepState: BentoStepperStepExposeState) => {\n childrenSteps.value.push({\n stepContent: stepState.stepContent as string,\n buttonElement: stepState.buttonElement as HTMLButtonElement,\n substeps: stepState.substeps as BentoStepperStepExposeState[],\n });\n };\n\n const stepperState: BentoStepperState = ref({\n activeStepIndex,\n latestActiveStep,\n steps: childrenStepsElements,\n type: props.type,\n variant: props.variant,\n navigateToStep,\n registerStep,\n });\n\n const conditionalClasses = computed(() => ({\n 'b-stepper__list--horizontal': isHorizontalVariant.value,\n }));\n\n watch(() => props.index, navigateToStep);\n watch(activeStepIndex, index => {\n emit('update:index', index);\n });\n\n const keyboardNavigationListeners = useKeyboardNavigation(allVisibleStepsElements);\n\n // Provides stepper state to BentoStep children components\n provide(STEPPER_STATE, readonly(stepperState));\n</script>\n\n<script lang=\"ts\">\n /**\n * Steppers break down complex processes into manageable steps to guide users through a sequential or multi-step process.\n *\n * @example\n * import { BentoStep, BentoStepper } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoStep, BentoStepper },\n * template: `\n * <bento-stepper :index=\"1\">\n * <bento-step>Step 1</bento-step>\n * <bento-step>Step 2</bento-step>\n * <bento-step>Step 3</bento-step>\n * </bento-stepper>\n * `\n * }\n */\n\n export default {\n i18n: { messages },\n name: 'stepper',\n };\n</script>\n\n<style scoped src=\"./stepper.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><path fill=\"#00112C\" d=\"M8 5.25C6.48122 5.25 5.25 6.48122 5.25 8C5.25 9.51878 6.48122 10.75 8 10.75C9.51878 10.75 10.75 9.51878 10.75 8C10.75 6.48122 9.51878 5.25 8 5.25Z\"/></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 <li :class=\"conditionalClasses\" class=\"b-step\">\n <base-button\n ref=\"buttonComponent\"\n :aria-current=\"ariaCurrentValue\"\n :aria-disabled=\"ariaDisabledValue\"\n class=\"b-step__button\"\n type=\"button\"\n :tabindex=\"tabIndexValue\"\n :disabled=\"isDisabled\"\n @click=\"navigateToStep\"\n @focus=\"isFocused = true\"\n @blur=\"isFocused = false\"\n >\n <template #iconLeft>\n <bento-typography el=\"span\" variant=\"body\" stronger class=\"b-step__index\" aria-hidden=\"true\">\n <checkmark-small-icon v-if=\"isCompleted\" />\n <template v-else-if=\"!isSubstep\">{{ index + 1 }}</template>\n <dot-icon v-else />\n </bento-typography>\n </template>\n\n <bento-typography ref=\"stepContent\" el=\"span\" variant=\"body\" :stronger=\"isActive\" class=\"b-step__content\">\n <slot></slot>\n </bento-typography>\n </base-button>\n\n <ul v-show=\"isSubstepsVisible\" ref=\"substepList\" class=\"b-step__substep-list\">\n <slot name=\"substeps\"></slot>\n </ul>\n </li>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, inject, onMounted, provide, ref, useSlots, watch } from 'vue';\n import { BaseButton } from '@/components/internal/base-button';\n import { BentoTypography } from '@/components/typography';\n import CheckmarkSmallIcon from '@adyen/ui-assets-icons-16/vue/checkmark-small';\n import DotIcon from '@adyen/ui-assets-icons-16/vue/dot';\n\n import { STEPPER_STATE } from '../../stepper.keys';\n import {\n BentoStepperState,\n BentoStepperStepExposeState,\n BentoStepperTypeOption,\n BentoStepperVariantOption,\n } from '../../stepper.types';\n import { Booleanish } from '@/types';\n\n const slots = useSlots();\n\n const props = defineProps({\n /**\n * Completed status. Used on non-linear steppers to indicate if the step is completed.\n */\n completed: {\n type: Boolean,\n default: false,\n },\n /**\n * Active substep index\n */\n substepIndex: {\n type: Number,\n default: 0,\n },\n });\n\n const emit = defineEmits<{\n /**\n * Event triggered when substep is updated by the parent step\n */\n (e: 'update:substep-index', index: number): void;\n }>();\n\n // Element refs\n const buttonComponent = ref<InstanceType<typeof BaseButton> | null>(null);\n const stepContent = ref<InstanceType<typeof BentoTypography> | null>(null);\n const substeps = ref<BentoStepperStepExposeState[]>([]);\n\n // Injects parent BentoStepper state data\n const stepper = inject(STEPPER_STATE);\n\n const buttonElement = computed(() => buttonComponent.value?.$el as HTMLButtonElement);\n const index = computed(() => stepper?.value.steps.indexOf(buttonElement.value));\n\n const stepContentValue = computed(() => stepContent.value?.$el.textContent);\n\n // Substep logic\n const substepsButtonElements = computed(() => substeps.value.map(({ buttonElement }) => buttonElement));\n\n const activeSubStepIndex = ref(props.substepIndex);\n const latestActiveSubStepIndex = ref(activeSubStepIndex.value);\n\n const navigateToSubstep = (value: number) => {\n if (value > latestActiveSubStepIndex.value) {\n latestActiveSubStepIndex.value = value;\n }\n\n activeSubStepIndex.value = value;\n };\n\n const registerSubstep = (stepState: BentoStepperStepExposeState) => {\n substeps.value.push({\n stepContent: stepState.stepContent as string,\n buttonElement: stepState.buttonElement as HTMLButtonElement,\n substeps: stepState.substeps as BentoStepperStepExposeState[],\n });\n };\n\n const stepState: BentoStepperState = ref({\n activeStepIndex: activeSubStepIndex,\n latestActiveStep: latestActiveSubStepIndex,\n type: stepper.value.type,\n variant: stepper.value.variant,\n steps: substepsButtonElements,\n isParentStep: true,\n navigateToStep: navigateToSubstep,\n registerStep: registerSubstep,\n });\n\n provide(STEPPER_STATE, stepState);\n\n watch(() => props.substepIndex, navigateToSubstep);\n watch(activeSubStepIndex, value => {\n emit('update:substep-index', value);\n });\n\n onMounted(() => {\n if (!stepper) {\n throw new Error(\n 'BentoStep components should only be used inside BentoStepper or other BentoStep components.'\n );\n }\n\n stepper.value.registerStep({\n buttonElement,\n stepContent: stepContentValue,\n substeps,\n });\n });\n\n // Step states\n const isSubstep = computed(() => stepper.value.isParentStep);\n const isFocused = ref(false);\n const isActive = computed(() => stepper?.value.activeStepIndex === index.value);\n const isSubstepsVisible = computed(\n () =>\n isActive.value &&\n stepper.value.variant !== BentoStepperVariantOption.HORIZONTAL &&\n !isSubstep.value &&\n slots.substeps\n );\n const isCompleted = computed(() => {\n if (stepper?.value.type === BentoStepperTypeOption.NON_LINEAR) {\n return props.completed;\n }\n\n return stepper?.value.latestActiveStep > index.value;\n });\n const isDisabled = computed(\n () => stepper?.value.type === BentoStepperTypeOption.LINEAR && index.value > stepper?.value.latestActiveStep\n );\n\n const navigateToStep = () => {\n if (isDisabled.value) {\n return;\n }\n\n stepper.value.navigateToStep(index.value);\n };\n\n // Styling and a11y\n const ariaCurrentValue = computed(() => (isActive.value ? 'step' : ('false' as Booleanish)));\n const ariaDisabledValue = computed(() => isDisabled.value.toString() as Booleanish);\n const tabIndexValue = computed(() => (isFocused.value || (index.value === 0 && !isSubstep.value) ? '0' : '-1'));\n\n const conditionalClasses = computed(() => ({\n 'b-step--active': isActive.value,\n 'b-step--completed': isCompleted.value,\n 'b-step--substep': isSubstep.value,\n }));\n</script>\n\n<script lang=\"ts\">\n /**\n * Steps are components placed inside BentoSteppers to break down complex processes\n *\n * @example\n * import { BentoStep } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoStep },\n * template: `\n * <bento-stepper>\n * <bento-step>Step 1</bento-step>\n * <bento-step>\n * Step 2\n * <template #substeps>\n * <bento-step>Substep 1</bento-step>\n * <bento-step>Substep 2</bento-step>\n * </template>\n * </bento-step>\n * </bento-stepper>\n * `\n * }\n */\n\n export default {\n name: 'step',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./step.scss\" />\n"],"names":["useKeyboardNavigation","steps","focusOnStep","indexOffset","event","currentIndex","_a","focusOnPreviousStep","focusOnNextStep","BentoKeyboardNavigationKeyDownEvent","STEPPER_STATE","BentoStepperTypeOption","BentoStepperTypeOption2","BentoStepperVariantOption","BentoStepperVariantOption2","__default__$1","messages","t","useI18n","childrenSteps","ref","activeStepIndex","props","latestActiveStep","navigateToStep","index","currentStepContent","computed","stepsAmount","childrenStepsElements","buttonElement","isHorizontalVariant","allVisibleStepsElements","substeps","isStepActive","step","registerStep","stepState","stepperState","conditionalClasses","watch","emit","keyboardNavigationListeners","provide","readonly","uuid","_sfc_main$1","__default__","slots","useSlots","buttonComponent","stepContent","stepper","inject","stepContentValue","substepsButtonElements","buttonElement2","activeSubStepIndex","latestActiveSubStepIndex","navigateToSubstep","value","registerSubstep","stepState2","onMounted","isSubstep","isFocused","isActive","isSubstepsVisible","isCompleted","isDisabled","ariaCurrentValue","ariaDisabledValue","tabIndexValue"],"mappings":";;;;;;;;AAUa,MAAAA,IAAA,CAAAC,MAAA;AAET,WAAAC,EAAAC,GAAA;AACI,WAAA,CAAA,EAAA,QAAAC,EAAA,MAAA;;AACI,MAAAA,EAAA,eAAA;AAEA,YAAAC,IAAAJ,EAAA,MAAA,QAAA,SAAA,aAAA;AACA,MAAAI,IAAA,MAIAC,IAAAL,EAAA,MAAAI,IAAAF,CAAA,MAAA,QAAAG,EAAA;AAAA,IAA+C;AAAA,EAC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A;AAAA,IACH,CAAA;AAIL,UAAA+B,IAAArC,EAAA,MAAAyB,EAAA,MAAA,YAAA,GACAa,IAAA7C,EAAA,EAAA,GACA8C,IAAAvC,EAAA,OAAAyB,KAAA,gBAAAA,EAAA,MAAA,qBAAA3B,EAAA,KAAA,GACA0C,IAAAxC;AAAA,MAA0B,MAAAuC,EAAA,SAAAd,EAAA,MAAA,YAAAvC,EAAA,cAAA,CAAAmD,EAAA,SAAAhB,EAAA;AAAA,IAKZ,GAEdoB,IAAAzC,EAAA,OACIyB,KAAA,gBAAAA,EAAA,MAAA,UAAAzC,EAAA,aACIW,EAAA,aAGJ8B,KAAA,gBAAAA,EAAA,MAAA,oBAAA3B,EAAA,KAA+C,GAEnD4C,IAAA1C;AAAA,MAAmB,OAAAyB,KAAA,gBAAAA,EAAA,MAAA,UAAAzC,EAAA,UAAAc,EAAA,SAAA2B,KAAA,gBAAAA,EAAA,MAAA;AAAA,IAC6E,GAGhG5B,IAAA,MAAA;AACI,MAAA6C,EAAA,SAIAjB,EAAA,MAAA,eAAA3B,EAAA,KAAA;AAAA,IAAwC,GAI5C6C,IAAA3C,EAAA,MAAAuC,EAAA,QAAA,SAAA,OAAA,GACAK,IAAA5C,EAAA,MAAA0C,EAAA,MAAA,SAAA,CAAA,GACAG,IAAA7C,EAAA,MAAAsC,EAAA,SAAAxC,EAAA,UAAA,KAAA,CAAAuC,EAAA,QAAA,MAAA,IAAA,GAEAzB,IAAAZ,EAAA,OAAA;AAAA,MAA2C,kBAAAuC,EAAA;AAAA,MACZ,qBAAAE,EAAA;AAAA,MACM,mBAAAJ,EAAA;AAAA,IACJ,EAAA;;;;;;;;;;;;;;;;;;;;;;;;","x_google_ignoreList":[4]}
|
package/dist/structured-list.js
CHANGED
package/dist/summary-grid.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { defineComponent as l, provide as x, toRefs as $, computed as u } from "vue";
|
|
2
|
-
import { u as v } from "./chunks/use-has-slot.
|
|
2
|
+
import { u as v } from "./chunks/use-has-slot.fbeb19ec.js";
|
|
3
3
|
import { S as h } from "./chunks/summary-grid.keys.1d1028c2.js";
|
|
4
|
-
import { G as E } from "./chunks/grid-layout.
|
|
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.b201e81d.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.e12b418e.js";
|
|
10
|
+
import "./assets/index18.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 _, 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.b201e81d.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.42354ccc.js";
|
|
7
|
+
import "./assets/index19.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.b201e81d.js";
|
|
3
3
|
import { u as m } from "./chunks/aria-label.ac9651a5.js";
|
|
4
|
-
import { g as s } from "./chunks/get-slot-text.
|
|
5
|
-
import { b as _ } from "./chunks/tooltip.
|
|
4
|
+
import { g as s } from "./chunks/get-slot-text.99c3d860.js";
|
|
5
|
+
import { b as _ } from "./chunks/tooltip.b8929659.js";
|
|
6
6
|
import { n as v } from "./chunks/_plugin-vue2_normalizer.71e2aa87.js";
|
|
7
|
-
import "./assets/
|
|
7
|
+
import "./assets/index20.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 z, useAttrs as V, toRefs as S, ref as d, toRef as Y, computed as n, watch as m, nextTick as Z, onMounted as G } from "vue";
|
|
2
|
-
import { a as j } from "./chunks/button.
|
|
3
|
-
import { B as J } from "./chunks/index.
|
|
2
|
+
import { a as j } from "./chunks/button.7dd8d4de.js";
|
|
3
|
+
import { B as J } from "./chunks/index.b201e81d.js";
|
|
4
4
|
import { n as I } from "./chunks/_plugin-vue2_normalizer.71e2aa87.js";
|
|
5
5
|
import { g as K } from "./chunks/unique-id.a2a2b458.js";
|
|
6
6
|
import { o as Q } from "./chunks/resize.a041304d.js";
|
|
7
7
|
import { u as X } from "./chunks/aria-label.ac9651a5.js";
|
|
8
|
-
import { u as ee } from "./chunks/i18n.
|
|
8
|
+
import { u as ee } from "./chunks/i18n.eb5b985b.js";
|
|
9
9
|
import { u as te } from "./chunks/use-form-layout-loading.d03e5d48.js";
|
|
10
|
-
import { E as ae, F as le } from "./chunks/field-label.
|
|
11
|
-
import "./assets/
|
|
10
|
+
import { E as ae, F as le } from "./chunks/field-label.01df3cba.js";
|
|
11
|
+
import "./assets/index21.css";
|
|
12
12
|
let A = 0;
|
|
13
13
|
const re = {
|
|
14
14
|
beforeCreate() {
|
|
@@ -17,30 +17,30 @@ const re = {
|
|
|
17
17
|
};
|
|
18
18
|
var se = function() {
|
|
19
19
|
var e = this, a = e._self._c;
|
|
20
|
-
return a("svg", e._b({ attrs: { role: "img", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "none" } }, "svg", e.$attrs, !1), [e.$attrs["svg-title"] ? a("title", [e._v(e._s(e.$attrs["svg-title"]))]) : e._e(), a("path", { attrs: { fill: "#00112C",
|
|
20
|
+
return a("svg", e._b({ staticClass: "ui-assets-icons-16", attrs: { role: "img", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "none" } }, "svg", e.$attrs, !1), [e.$attrs["svg-title"] ? a("title", [e._v(e._s(e.$attrs["svg-title"]))]) : e._e(), a("path", { attrs: { fill: "#00112C", d: "M2.25 8C2.25 4.82436 4.82436 2.25 8 2.25C11.1756 2.25 13.75 4.82436 13.75 8C13.75 11.1756 11.1756 13.75 8 13.75C4.82436 13.75 2.25 11.1756 2.25 8ZM7.00011 5.93945L5.93945 7.00011L6.93945 8.00011L5.93945 9.00011L7.00011 10.0608L8.00011 9.06077L9.00011 10.0608L10.0608 9.00011L9.06077 8.00011L10.0608 7.00011L9.00011 5.93945L8.00011 6.93945L7.00011 5.93945Z" } })]);
|
|
21
21
|
}, oe = [], ne = /* @__PURE__ */ I(
|
|
22
22
|
re,
|
|
23
23
|
se,
|
|
24
24
|
oe,
|
|
25
25
|
!1,
|
|
26
26
|
null,
|
|
27
|
-
|
|
27
|
+
null,
|
|
28
28
|
null,
|
|
29
29
|
null
|
|
30
30
|
);
|
|
31
31
|
const ie = ne.exports;
|
|
32
|
-
var y = /* @__PURE__ */ ((l) => (l.HORIZONTAL = "horizontal", l.VERTICAL = "vertical", l.BOTH = "both", l.NONE = "none", l))(y || {}),
|
|
33
|
-
const
|
|
32
|
+
var y = /* @__PURE__ */ ((l) => (l.HORIZONTAL = "horizontal", l.VERTICAL = "vertical", l.BOTH = "both", l.NONE = "none", l))(y || {}), c = /* @__PURE__ */ ((l) => (l.CLEARABLE = "clearable", l.DISABLED = "disabled", l.ERROR = "error", l.READONLY = "readonly", l))(c || {}), i = /* @__PURE__ */ ((l) => (l.BLUR = "blur", l.CHANGE = "change", l.CLEAR = "clear", l.ESCAPE_PRESSED = "escape-pressed", l.FOCUS = "focus", l.INPUT = "input", l))(i || {});
|
|
33
|
+
const ue = {
|
|
34
34
|
"en-US": {
|
|
35
35
|
clearText: "Clear text",
|
|
36
36
|
textarea: "textarea",
|
|
37
37
|
yourTextCanBenAtMost: "Your text can be at most {characterLimit} characters"
|
|
38
38
|
}
|
|
39
|
-
},
|
|
40
|
-
i18n: { messages:
|
|
39
|
+
}, ce = {
|
|
40
|
+
i18n: { messages: ue },
|
|
41
41
|
name: "bento-textarea"
|
|
42
42
|
}, de = /* @__PURE__ */ z({
|
|
43
|
-
...
|
|
43
|
+
...ce,
|
|
44
44
|
props: {
|
|
45
45
|
/**
|
|
46
46
|
* Text that labels an the input element
|
|
@@ -133,16 +133,16 @@ const ce = {
|
|
|
133
133
|
{ immediate: !0 }
|
|
134
134
|
);
|
|
135
135
|
const C = n(() => !!a.errorMessage || v.value), O = n(() => ({
|
|
136
|
-
[`b-textarea--${
|
|
136
|
+
[`b-textarea--${c.DISABLED}`]: a.disabled
|
|
137
137
|
})), F = n(() => ({
|
|
138
|
-
[`b-textarea__input--${
|
|
139
|
-
[`b-textarea__input--${
|
|
140
|
-
[`b-textarea__input--${
|
|
138
|
+
[`b-textarea__input--${c.CLEARABLE}`]: a.clearable,
|
|
139
|
+
[`b-textarea__input--${c.READONLY}`]: f.value,
|
|
140
|
+
[`b-textarea__input--${c.ERROR}`]: C.value,
|
|
141
141
|
["b-textarea__input--dynamic-height"]: !r.value
|
|
142
142
|
})), M = n(() => ({
|
|
143
143
|
["b-textarea__label-box--no-label"]: !a.label
|
|
144
144
|
})), P = n(() => ({
|
|
145
|
-
[`b-textarea__label-item--${
|
|
145
|
+
[`b-textarea__label-item--${c.ERROR}`]: v.value
|
|
146
146
|
})), T = n(() => h("yourTextCanBenAtMost", { characterLimit: a.characterLimit })), x = d(t["aria-label"]), { ariaLabel: L, label: E } = S(a), $ = X({
|
|
147
147
|
ariaLabel: x.value,
|
|
148
148
|
// TODO: take this line away when the aria-label props is removed
|
|
@@ -152,8 +152,8 @@ const ce = {
|
|
|
152
152
|
() => a.clearable && o.value && !a.disabled && !f.value
|
|
153
153
|
), H = () => {
|
|
154
154
|
o.value = "", e(i.CLEAR), e(i.INPUT, "");
|
|
155
|
-
}, N = (
|
|
156
|
-
|
|
155
|
+
}, N = (u) => {
|
|
156
|
+
u.stopImmediatePropagation(), !a.disabled && !f.value && (o.value = u.target.value, e(i.INPUT, o.value));
|
|
157
157
|
}, U = () => {
|
|
158
158
|
s.value.scrollTop = 0, e(i.BLUR);
|
|
159
159
|
}, D = () => {
|
|
@@ -166,8 +166,8 @@ const ce = {
|
|
|
166
166
|
return G(() => {
|
|
167
167
|
Q(s.value, () => {
|
|
168
168
|
var R;
|
|
169
|
-
const
|
|
170
|
-
g.value =
|
|
169
|
+
const u = (R = s == null ? void 0 : s.value) == null ? void 0 : R.offsetWidth;
|
|
170
|
+
g.value = u ? `${u}px` : "100%";
|
|
171
171
|
}), r.value || b();
|
|
172
172
|
}), { __sfc: !0, attrs: t, props: a, emit: e, height: r, textareaId: B, textareaElement: s, textareaValue: o, defaultTextareaHeight: p, textareaHeight: _, textareaWidth: g, t: h, isReadOnly: f, counter: k, isOverCharacterLimit: v, calculateHeight: b, invalidInput: C, conditionalClasses: O, conditionalClassesInput: F, conditionalClassesLabelBox: M, conditionalClassesLabelItem: P, counterErrorText: T, ariaLabelAttribute: x, ariaLabel: L, label: E, computedAriaLabel: $, showClearButton: w, onClear: H, onInput: N, onBlur: U, onFocus: D, onChange: W, onPressEscape: q, BentoButton: j, BentoTypography: J, ErrorMessage: ae, FieldLabel: le, CrossCircleFillSmallIcon: ie };
|
|
173
173
|
}
|
package/dist/textarea.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textarea.js","sources":["../../../node_modules/@adyen/ui-assets-icons-16/dist/vue/cross-circle-fill-small.vue","../src/components/textarea/textarea.types.ts","../src/components/textarea/textarea.vue"],"sourcesContent":["\n<template>\n <svg role=\"img\" v-bind=\"$attrs\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\"><title v-if=\"$attrs['svg-title']\">{{ $attrs['svg-title'] }}</title><path fill=\"#00112C\" fill-rule=\"evenodd\" d=\"M2.25 8C2.25 4.82436 4.82436 2.25 8 2.25C11.1756 2.25 13.75 4.82436 13.75 8C13.75 11.1756 11.1756 13.75 8 13.75C4.82436 13.75 2.25 11.1756 2.25 8ZM5.46967 5.46967C5.17678 5.76256 5.17678 6.23744 5.46967 6.53033L6.93934 8L5.46967 9.46967C5.17678 9.76256 5.17678 10.2374 5.46967 10.5303C5.76256 10.8232 6.23744 10.8232 6.53033 10.5303L8 9.06066L9.46967 10.5303C9.76256 10.8232 10.2374 10.8232 10.5303 10.5303C10.8232 10.2374 10.8232 9.76256 10.5303 9.46967L9.06066 8L10.5303 6.53033C10.8232 6.23744 10.8232 5.76256 10.5303 5.46967C10.2374 5.17678 9.76256 5.17678 9.46967 5.46967L8 6.93934L6.53033 5.46967C6.23744 5.17678 5.76256 5.17678 5.46967 5.46967Z\" clip-rule=\"evenodd\"/></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 scoped lang=\"scss\">\n svg {\n display: inline-flex;\n flex-shrink: 0;\n }\n \n svg,\n svg * {\n fill: currentcolor;\n }\n</style>\n","/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoTextareaResizeOption {\n HORIZONTAL = 'horizontal',\n VERTICAL = 'vertical',\n BOTH = 'both',\n NONE = 'none',\n}\n\nexport enum BentoTextareaStateClass {\n CLEARABLE = 'clearable',\n DISABLED = 'disabled',\n ERROR = 'error',\n READONLY = 'readonly',\n}\n\nexport enum BentoTextareaEvent {\n BLUR = 'blur',\n CHANGE = 'change',\n CLEAR = 'clear',\n ESCAPE_PRESSED = 'escape-pressed',\n FOCUS = 'focus',\n INPUT = 'input',\n}\n","<template>\n <div class=\"b-textarea\" :class=\"conditionalClasses\" :style=\"{ width: textareaWidth }\">\n <div class=\"b-textarea__label-box\" :class=\"conditionalClassesLabelBox\">\n <field-label\n v-if=\"label\"\n :for=\"textareaId\"\n :label=\"label\"\n :tooltip-text=\"tooltipText\"\n :optional=\"optional\"\n :required=\"required\"\n />\n <bento-typography\n v-if=\"characterLimit\"\n el=\"span\"\n class=\"b-textarea__label-item\"\n :class=\"conditionalClassesLabelItem\"\n >\n {{ counter }}\n </bento-typography>\n </div>\n <bento-typography el=\"div\" class=\"b-textarea__input-box\" :aria-disabled=\"disabled\">\n <textarea\n :id=\"textareaId\"\n ref=\"textareaElement\"\n :value=\"textareaValue\"\n class=\"b-textarea__input\"\n :class=\"conditionalClassesInput\"\n :aria-label=\"computedAriaLabel\"\n :aria-invalid=\"invalidInput\"\n :readonly=\"isReadOnly\"\n :disabled=\"disabled\"\n :placeholder=\"placeholder\"\n :style=\"{ resize: resizable, height: textareaHeight }\"\n @blur=\"onBlur\"\n @change=\"onChange\"\n @focus=\"onFocus\"\n @input=\"onInput\"\n @keydown.esc=\"onPressEscape\"\n >\n </textarea>\n\n <div v-if=\"showClearButton\" class=\"b-textarea__clear-button\">\n <bento-button\n variant=\"tertiary\"\n :disabled=\"disabled\"\n @click=\"onClear\"\n @keypress.enter=\"onClear\"\n @keyup.space=\"onClear\"\n >\n <template #iconLeft>\n <cross-circle-fill-small-icon :svg-title=\"t('clearText')\" />\n </template>\n </bento-button>\n </div>\n </bento-typography>\n\n <error-message v-if=\"isOverCharacterLimit\" :error-message=\"counterErrorText\" />\n\n <error-message v-if=\"errorMessage\" :error-message=\"errorMessage\" />\n\n <bento-typography v-if=\"description\" class=\"b-textarea__description\" el=\"span\">\n {{ description }}\n </bento-typography>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, nextTick, onMounted, PropType, ref, toRef, toRefs, useAttrs, watch } from 'vue';\n\n // Components\n import { BentoButton } from '@/components/button';\n import { BentoTypography } from '@/components/typography';\n import { ErrorMessage, FieldLabel } from '@/internal';\n import CrossCircleFillSmallIcon from '@adyen/ui-assets-icons-16/vue/cross-circle-fill-small';\n\n // Utils\n import { generateUid } from '@/utils/ts/unique-id';\n import { observeSizeOfElement } from '@/utils/ts/resize';\n import { useAriaLabel } from '@/utils/ts/aria-label';\n import { useI18n } from '@/utils/ts/i18n';\n\n // Composables\n import { useFormLayoutFieldLoading } from '@/composables/use-form-layout-loading/use-form-layout-loading';\n\n // Types\n import { BentoTextareaEvent, BentoTextareaResizeOption, BentoTextareaStateClass } from './textarea.types';\n\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const attrs = useAttrs();\n\n const props = defineProps({\n /**\n * Text that labels an the input element\n */\n ariaLabel: { type: String, default: undefined },\n\n /**\n * Text that shows number of characters in textarea\n */\n characterLimit: { type: Number, default: undefined },\n\n /**\n * Text displayed as the help text of the textarea\n */\n description: { type: String, default: '' },\n\n /**\n * Disables the possibility of changing value in the textarea\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * If set to true, shows a button to clear all the text\n */\n clearable: { type: Boolean, default: false },\n\n /**\n * Adds error text\n */\n errorMessage: { type: String, default: '' },\n\n /**\n * Sets the height of the textarea, e.g 200px OR 20vh\n */\n height: { type: String, default: null },\n\n /**\n * Text displayed as the label of the textarea\n */\n label: { type: String, default: '' },\n\n /**\n * Highlights the textarea is optional.\n */\n optional: { type: Boolean, default: false },\n\n /**\n * Text displayed as the placeholder of the textarea\n */\n placeholder: { type: String, default: '' },\n\n /**\n * Set the textarea to read only state.\n */\n readonly: { type: Boolean, default: false },\n\n /**\n * Indicates the possibility of resize the textarea\n */\n resizable: {\n type: String as PropType<BentoTextareaResizeOption | `${BentoTextareaResizeOption}`>,\n default: BentoTextareaResizeOption.BOTH,\n validator: (value: BentoTextareaResizeOption) => Object.values(BentoTextareaResizeOption).includes(value),\n },\n\n /**\n * Highlights the textarea is required.\n */\n required: { type: Boolean, default: false },\n\n /**\n * Adds a info icon next to the label to display the passed tooltip message.\n */\n tooltipText: { type: String, default: null },\n\n /**\n * Text displayed as the value of the textarea\n */\n value: { type: String, default: '' },\n });\n\n const emit = defineEmits<{\n /**\n * Emitted when the element has lost focus\n */\n (e: BentoTextareaEvent.BLUR): void;\n\n /**\n * Emitted when the user modifies the element's value. Unlike the 'input' event, the change event is not necessarily fired for each alteration to an element's value\n */\n (e: BentoTextareaEvent.CHANGE): void;\n\n /**\n * Emitted when the \"Clear\" button was clicked\n */\n (e: BentoTextareaEvent.CLEAR): void;\n\n /**\n * Emitted when the \"ESC\" key is pressed\n */\n (e: BentoTextareaEvent.ESCAPE_PRESSED): void;\n\n /**\n * Emitted when the element has received focus\n */\n (e: BentoTextareaEvent.FOCUS): void;\n\n /**\n * Emitted when the component's model changes\n */\n (e: BentoTextareaEvent.INPUT, value: string): void;\n }>();\n\n const { height } = toRefs(props);\n\n const textareaId = generateUid('textarea');\n const textareaElement = ref<HTMLTextAreaElement>(null);\n const textareaValue = ref(props.value);\n const defaultTextareaHeight = 44;\n const textareaHeight = ref(props.height || `${defaultTextareaHeight}px`);\n const textareaWidth = ref('100%');\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const { isReadOnly } = useFormLayoutFieldLoading(toRef(props, 'readonly'));\n\n const counter = computed(() => `${textareaValue.value.length} / ${props.characterLimit}`);\n const isOverCharacterLimit = computed(\n () => props.characterLimit && textareaValue.value.length > props.characterLimit\n );\n\n const calculateHeight = () => {\n const borderWidth = 3;\n if (textareaElement.value && textareaElement.value.scrollHeight > defaultTextareaHeight) {\n textareaHeight.value = `${textareaElement.value.scrollHeight + borderWidth}px`;\n }\n };\n\n watch(height, () => {\n if (!height.value) {\n calculateHeight();\n } else {\n textareaHeight.value = height.value;\n }\n });\n\n watch(\n () => props.value,\n () => {\n textareaValue.value = props.value;\n },\n { immediate: true }\n );\n\n watch(\n () => textareaValue.value,\n async () => {\n if (!height.value) {\n // Hack to make the textarea calculate its height properly\n // Set the textarea back to the original value before calculating the height\n textareaHeight.value = `${defaultTextareaHeight}px`;\n if (!textareaValue.value) {\n return;\n }\n\n await nextTick();\n calculateHeight();\n }\n },\n { immediate: true }\n );\n\n const invalidInput = computed(() => !!props.errorMessage || isOverCharacterLimit.value);\n\n const conditionalClasses = computed(() => ({\n [`b-textarea--${BentoTextareaStateClass.DISABLED}`]: props.disabled,\n }));\n\n const conditionalClassesInput = computed(() => ({\n [`b-textarea__input--${BentoTextareaStateClass.CLEARABLE}`]: props.clearable,\n [`b-textarea__input--${BentoTextareaStateClass.READONLY}`]: isReadOnly.value,\n [`b-textarea__input--${BentoTextareaStateClass.ERROR}`]: invalidInput.value,\n [`b-textarea__input--dynamic-height`]: !height.value,\n }));\n\n const conditionalClassesLabelBox = computed(() => ({\n [`b-textarea__label-box--no-label`]: !props.label,\n }));\n\n const conditionalClassesLabelItem = computed(() => ({\n [`b-textarea__label-item--${BentoTextareaStateClass.ERROR}`]: isOverCharacterLimit.value,\n }));\n\n const counterErrorText = computed(() => t('yourTextCanBenAtMost', { characterLimit: props.characterLimit }));\n\n const ariaLabelAttribute = ref(attrs['aria-label']);\n const { ariaLabel, label } = toRefs(props);\n const computedAriaLabel = useAriaLabel({\n ariaLabel: ariaLabelAttribute.value as string,\n // TODO: take this line away when the aria-label props is removed\n label: ariaLabel,\n defaultFallback: label,\n });\n\n const showClearButton = computed(\n () => props.clearable && textareaValue.value && !props.disabled && !isReadOnly.value\n );\n\n const onClear = () => {\n textareaValue.value = '';\n emit(BentoTextareaEvent.CLEAR);\n emit(BentoTextareaEvent.INPUT, '');\n };\n\n const onInput = (event: InputEvent) => {\n event.stopImmediatePropagation();\n\n if (!props.disabled && !isReadOnly.value) {\n textareaValue.value = (event.target as HTMLInputElement).value;\n /**\n * Triggered when input value is changed\n *\n * @event input\n * @property {String} inputValue - the updated textarea value\n */\n emit(BentoTextareaEvent.INPUT, textareaValue.value);\n }\n };\n\n const onBlur = () => {\n textareaElement.value.scrollTop = 0;\n emit(BentoTextareaEvent.BLUR);\n };\n\n const onFocus = () => {\n textareaElement.value.focus();\n emit(BentoTextareaEvent.FOCUS);\n };\n\n const onChange = () => {\n emit(BentoTextareaEvent.CHANGE);\n };\n\n const onPressEscape = () => {\n emit(BentoTextareaEvent.ESCAPE_PRESSED);\n };\n\n onMounted(() => {\n observeSizeOfElement(textareaElement.value, () => {\n const offsetWidth = textareaElement?.value?.offsetWidth;\n textareaWidth.value = offsetWidth ? `${offsetWidth}px` : '100%';\n });\n\n if (!height.value) {\n calculateHeight();\n }\n });\n</script>\n\n<script lang=\"ts\">\n export default {\n i18n: { messages },\n name: 'bento-textarea',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./textarea.scss\" />\n"],"names":["uuid","_sfc_main$1","BentoTextareaResizeOption","BentoTextareaResizeOption2","BentoTextareaStateClass","BentoTextareaStateClass2","BentoTextareaEvent","BentoTextareaEvent2","__default__","messages","attrs","useAttrs","height","toRefs","props","textareaId","generateUid","textareaElement","ref","textareaValue","defaultTextareaHeight","textareaHeight","textareaWidth","t","useI18n","isReadOnly","useFormLayoutFieldLoading","toRef","counter","computed","isOverCharacterLimit","calculateHeight","watch","nextTick","invalidInput","conditionalClasses","conditionalClassesInput","conditionalClassesLabelBox","conditionalClassesLabelItem","counterErrorText","ariaLabelAttribute","ariaLabel","label","computedAriaLabel","useAriaLabel","showClearButton","onClear","emit","onInput","event","onBlur","onFocus","onChange","onPressEscape","onMounted","observeSizeOfElement","offsetWidth","_a"],"mappings":";;;;;;;;;;;AA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IACJ,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"textarea.js","sources":["../node_modules/@adyen/ui-assets-icons-16/dist/vue/cross-circle-fill-small.vue","../src/components/textarea/textarea.types.ts","../src/components/textarea/textarea.vue"],"sourcesContent":["\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><path fill=\"#00112C\" d=\"M2.25 8C2.25 4.82436 4.82436 2.25 8 2.25C11.1756 2.25 13.75 4.82436 13.75 8C13.75 11.1756 11.1756 13.75 8 13.75C4.82436 13.75 2.25 11.1756 2.25 8ZM7.00011 5.93945L5.93945 7.00011L6.93945 8.00011L5.93945 9.00011L7.00011 10.0608L8.00011 9.06077L9.00011 10.0608L10.0608 9.00011L9.06077 8.00011L10.0608 7.00011L9.00011 5.93945L8.00011 6.93945L7.00011 5.93945Z\"/></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","/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoTextareaResizeOption {\n HORIZONTAL = 'horizontal',\n VERTICAL = 'vertical',\n BOTH = 'both',\n NONE = 'none',\n}\n\nexport enum BentoTextareaStateClass {\n CLEARABLE = 'clearable',\n DISABLED = 'disabled',\n ERROR = 'error',\n READONLY = 'readonly',\n}\n\nexport enum BentoTextareaEvent {\n BLUR = 'blur',\n CHANGE = 'change',\n CLEAR = 'clear',\n ESCAPE_PRESSED = 'escape-pressed',\n FOCUS = 'focus',\n INPUT = 'input',\n}\n","<template>\n <div class=\"b-textarea\" :class=\"conditionalClasses\" :style=\"{ width: textareaWidth }\">\n <div class=\"b-textarea__label-box\" :class=\"conditionalClassesLabelBox\">\n <field-label\n v-if=\"label\"\n :for=\"textareaId\"\n :label=\"label\"\n :tooltip-text=\"tooltipText\"\n :optional=\"optional\"\n :required=\"required\"\n />\n <bento-typography\n v-if=\"characterLimit\"\n el=\"span\"\n class=\"b-textarea__label-item\"\n :class=\"conditionalClassesLabelItem\"\n >\n {{ counter }}\n </bento-typography>\n </div>\n <bento-typography el=\"div\" class=\"b-textarea__input-box\" :aria-disabled=\"disabled\">\n <textarea\n :id=\"textareaId\"\n ref=\"textareaElement\"\n :value=\"textareaValue\"\n class=\"b-textarea__input\"\n :class=\"conditionalClassesInput\"\n :aria-label=\"computedAriaLabel\"\n :aria-invalid=\"invalidInput\"\n :readonly=\"isReadOnly\"\n :disabled=\"disabled\"\n :placeholder=\"placeholder\"\n :style=\"{ resize: resizable, height: textareaHeight }\"\n @blur=\"onBlur\"\n @change=\"onChange\"\n @focus=\"onFocus\"\n @input=\"onInput\"\n @keydown.esc=\"onPressEscape\"\n >\n </textarea>\n\n <div v-if=\"showClearButton\" class=\"b-textarea__clear-button\">\n <bento-button\n variant=\"tertiary\"\n :disabled=\"disabled\"\n @click=\"onClear\"\n @keypress.enter=\"onClear\"\n @keyup.space=\"onClear\"\n >\n <template #iconLeft>\n <cross-circle-fill-small-icon :svg-title=\"t('clearText')\" />\n </template>\n </bento-button>\n </div>\n </bento-typography>\n\n <error-message v-if=\"isOverCharacterLimit\" :error-message=\"counterErrorText\" />\n\n <error-message v-if=\"errorMessage\" :error-message=\"errorMessage\" />\n\n <bento-typography v-if=\"description\" class=\"b-textarea__description\" el=\"span\">\n {{ description }}\n </bento-typography>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, nextTick, onMounted, PropType, ref, toRef, toRefs, useAttrs, watch } from 'vue';\n\n // Components\n import { BentoButton } from '@/components/button';\n import { BentoTypography } from '@/components/typography';\n import { ErrorMessage, FieldLabel } from '@/internal';\n import CrossCircleFillSmallIcon from '@adyen/ui-assets-icons-16/vue/cross-circle-fill-small';\n\n // Utils\n import { generateUid } from '@/utils/ts/unique-id';\n import { observeSizeOfElement } from '@/utils/ts/resize';\n import { useAriaLabel } from '@/utils/ts/aria-label';\n import { useI18n } from '@/utils/ts/i18n';\n\n // Composables\n import { useFormLayoutFieldLoading } from '@/composables/use-form-layout-loading/use-form-layout-loading';\n\n // Types\n import { BentoTextareaEvent, BentoTextareaResizeOption, BentoTextareaStateClass } from './textarea.types';\n\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const attrs = useAttrs();\n\n const props = defineProps({\n /**\n * Text that labels an the input element\n */\n ariaLabel: { type: String, default: undefined },\n\n /**\n * Text that shows number of characters in textarea\n */\n characterLimit: { type: Number, default: undefined },\n\n /**\n * Text displayed as the help text of the textarea\n */\n description: { type: String, default: '' },\n\n /**\n * Disables the possibility of changing value in the textarea\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * If set to true, shows a button to clear all the text\n */\n clearable: { type: Boolean, default: false },\n\n /**\n * Adds error text\n */\n errorMessage: { type: String, default: '' },\n\n /**\n * Sets the height of the textarea, e.g 200px OR 20vh\n */\n height: { type: String, default: null },\n\n /**\n * Text displayed as the label of the textarea\n */\n label: { type: String, default: '' },\n\n /**\n * Highlights the textarea is optional.\n */\n optional: { type: Boolean, default: false },\n\n /**\n * Text displayed as the placeholder of the textarea\n */\n placeholder: { type: String, default: '' },\n\n /**\n * Set the textarea to read only state.\n */\n readonly: { type: Boolean, default: false },\n\n /**\n * Indicates the possibility of resize the textarea\n */\n resizable: {\n type: String as PropType<BentoTextareaResizeOption | `${BentoTextareaResizeOption}`>,\n default: BentoTextareaResizeOption.BOTH,\n validator: (value: BentoTextareaResizeOption) => Object.values(BentoTextareaResizeOption).includes(value),\n },\n\n /**\n * Highlights the textarea is required.\n */\n required: { type: Boolean, default: false },\n\n /**\n * Adds a info icon next to the label to display the passed tooltip message.\n */\n tooltipText: { type: String, default: null },\n\n /**\n * Text displayed as the value of the textarea\n */\n value: { type: String, default: '' },\n });\n\n const emit = defineEmits<{\n /**\n * Emitted when the element has lost focus\n */\n (e: BentoTextareaEvent.BLUR): void;\n\n /**\n * Emitted when the user modifies the element's value. Unlike the 'input' event, the change event is not necessarily fired for each alteration to an element's value\n */\n (e: BentoTextareaEvent.CHANGE): void;\n\n /**\n * Emitted when the \"Clear\" button was clicked\n */\n (e: BentoTextareaEvent.CLEAR): void;\n\n /**\n * Emitted when the \"ESC\" key is pressed\n */\n (e: BentoTextareaEvent.ESCAPE_PRESSED): void;\n\n /**\n * Emitted when the element has received focus\n */\n (e: BentoTextareaEvent.FOCUS): void;\n\n /**\n * Emitted when the component's model changes\n */\n (e: BentoTextareaEvent.INPUT, value: string): void;\n }>();\n\n const { height } = toRefs(props);\n\n const textareaId = generateUid('textarea');\n const textareaElement = ref<HTMLTextAreaElement>(null);\n const textareaValue = ref(props.value);\n const defaultTextareaHeight = 44;\n const textareaHeight = ref(props.height || `${defaultTextareaHeight}px`);\n const textareaWidth = ref('100%');\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const { isReadOnly } = useFormLayoutFieldLoading(toRef(props, 'readonly'));\n\n const counter = computed(() => `${textareaValue.value.length} / ${props.characterLimit}`);\n const isOverCharacterLimit = computed(\n () => props.characterLimit && textareaValue.value.length > props.characterLimit\n );\n\n const calculateHeight = () => {\n const borderWidth = 3;\n if (textareaElement.value && textareaElement.value.scrollHeight > defaultTextareaHeight) {\n textareaHeight.value = `${textareaElement.value.scrollHeight + borderWidth}px`;\n }\n };\n\n watch(height, () => {\n if (!height.value) {\n calculateHeight();\n } else {\n textareaHeight.value = height.value;\n }\n });\n\n watch(\n () => props.value,\n () => {\n textareaValue.value = props.value;\n },\n { immediate: true }\n );\n\n watch(\n () => textareaValue.value,\n async () => {\n if (!height.value) {\n // Hack to make the textarea calculate its height properly\n // Set the textarea back to the original value before calculating the height\n textareaHeight.value = `${defaultTextareaHeight}px`;\n if (!textareaValue.value) {\n return;\n }\n\n await nextTick();\n calculateHeight();\n }\n },\n { immediate: true }\n );\n\n const invalidInput = computed(() => !!props.errorMessage || isOverCharacterLimit.value);\n\n const conditionalClasses = computed(() => ({\n [`b-textarea--${BentoTextareaStateClass.DISABLED}`]: props.disabled,\n }));\n\n const conditionalClassesInput = computed(() => ({\n [`b-textarea__input--${BentoTextareaStateClass.CLEARABLE}`]: props.clearable,\n [`b-textarea__input--${BentoTextareaStateClass.READONLY}`]: isReadOnly.value,\n [`b-textarea__input--${BentoTextareaStateClass.ERROR}`]: invalidInput.value,\n [`b-textarea__input--dynamic-height`]: !height.value,\n }));\n\n const conditionalClassesLabelBox = computed(() => ({\n [`b-textarea__label-box--no-label`]: !props.label,\n }));\n\n const conditionalClassesLabelItem = computed(() => ({\n [`b-textarea__label-item--${BentoTextareaStateClass.ERROR}`]: isOverCharacterLimit.value,\n }));\n\n const counterErrorText = computed(() => t('yourTextCanBenAtMost', { characterLimit: props.characterLimit }));\n\n const ariaLabelAttribute = ref(attrs['aria-label']);\n const { ariaLabel, label } = toRefs(props);\n const computedAriaLabel = useAriaLabel({\n ariaLabel: ariaLabelAttribute.value as string,\n // TODO: take this line away when the aria-label props is removed\n label: ariaLabel,\n defaultFallback: label,\n });\n\n const showClearButton = computed(\n () => props.clearable && textareaValue.value && !props.disabled && !isReadOnly.value\n );\n\n const onClear = () => {\n textareaValue.value = '';\n emit(BentoTextareaEvent.CLEAR);\n emit(BentoTextareaEvent.INPUT, '');\n };\n\n const onInput = (event: InputEvent) => {\n event.stopImmediatePropagation();\n\n if (!props.disabled && !isReadOnly.value) {\n textareaValue.value = (event.target as HTMLInputElement).value;\n /**\n * Triggered when input value is changed\n *\n * @event input\n * @property {String} inputValue - the updated textarea value\n */\n emit(BentoTextareaEvent.INPUT, textareaValue.value);\n }\n };\n\n const onBlur = () => {\n textareaElement.value.scrollTop = 0;\n emit(BentoTextareaEvent.BLUR);\n };\n\n const onFocus = () => {\n textareaElement.value.focus();\n emit(BentoTextareaEvent.FOCUS);\n };\n\n const onChange = () => {\n emit(BentoTextareaEvent.CHANGE);\n };\n\n const onPressEscape = () => {\n emit(BentoTextareaEvent.ESCAPE_PRESSED);\n };\n\n onMounted(() => {\n observeSizeOfElement(textareaElement.value, () => {\n const offsetWidth = textareaElement?.value?.offsetWidth;\n textareaWidth.value = offsetWidth ? `${offsetWidth}px` : '100%';\n });\n\n if (!height.value) {\n calculateHeight();\n }\n });\n</script>\n\n<script lang=\"ts\">\n export default {\n i18n: { messages },\n name: 'bento-textarea',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./textarea.scss\" />\n"],"names":["uuid","_sfc_main$1","BentoTextareaResizeOption","BentoTextareaResizeOption2","BentoTextareaStateClass","BentoTextareaStateClass2","BentoTextareaEvent","BentoTextareaEvent2","__default__","messages","attrs","useAttrs","height","toRefs","props","textareaId","generateUid","textareaElement","ref","textareaValue","defaultTextareaHeight","textareaHeight","textareaWidth","t","useI18n","isReadOnly","useFormLayoutFieldLoading","toRef","counter","computed","isOverCharacterLimit","calculateHeight","watch","nextTick","invalidInput","conditionalClasses","conditionalClassesInput","conditionalClassesLabelBox","conditionalClassesLabelItem","counterErrorText","ariaLabelAttribute","ariaLabel","label","computedAriaLabel","useAriaLabel","showClearButton","onClear","emit","onInput","event","onBlur","onFocus","onChange","onPressEscape","onMounted","observeSizeOfElement","offsetWidth","_a"],"mappings":";;;;;;;;;;;AAKA,IAAAA,IAAA;AAEA,MAAAC,KAAA;AAAA,EACA,eAAA;AACA,SAAA,OAAAD,EAAA,SAAA,GACAA,KAAA;AAAA,EACA;AACA;;;;;;;;;;;;;;;ACTY,IAAAE,IAAA,kBAAAC,OACRA,EAAA,aAAA,cACAA,EAAA,WAAA,YACAA,EAAA,OAAA,QACAA,EAAA,OAAA,QAJQA,IAAAD,KAAA,CAAA,CAAA,GAOAE,IAAA,kBAAAC,OACRA,EAAA,YAAA,aACAA,EAAA,WAAA,YACAA,EAAA,QAAA,SACAA,EAAA,WAAA,YAJQA,IAAAD,KAAA,CAAA,CAA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