@adyen/bento-vue3 1.4.1 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@types/components.d.ts +4 -0
- package/dist/@types/packages/vue2/src/components/code-snippet/code-snippet.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/data-grid/components/data-grid-lazy-load/data-grid-lazy-load.vue.d.ts +17 -0
- package/dist/@types/packages/vue2/src/components/data-grid/components/index.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/data-grid/composables/index.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/data-grid/composables/useCalculateColumnHeadersTopPosition/useCalculateColumnHeadersTopPosition.d.ts +2 -0
- package/dist/@types/packages/vue2/src/components/data-grid/composables/useLazyLoading/useLazyLoading.d.ts +8 -0
- package/dist/@types/packages/vue2/src/components/data-grid/data-grid.types.d.ts +3 -1
- package/dist/@types/packages/vue2/src/components/data-grid/data-grid.vue.d.ts +28 -2
- package/dist/@types/packages/vue2/src/components/dropdown/components/dropdown-options-container/dropdown-options-container.vue.d.ts +455 -123
- package/dist/@types/packages/vue2/src/components/dropdown/dropdown.vue.d.ts +3 -3
- package/dist/@types/packages/vue2/src/components/filter-bar/components/all-filters-modal/all-filters-modal.vue.d.ts +13 -13
- package/dist/@types/packages/vue2/src/components/filter-bar/components/all-filters-modal/components/all-filters-modal-button/all-filters-modal-button.vue.d.ts +4 -4
- package/dist/@types/packages/vue2/src/components/filter-bar/components/base-filter/base-filter.vue.d.ts +12 -3
- package/dist/@types/packages/vue2/src/components/filter-bar/components/base-filter-button/base-filter-button.vue.d.ts +3 -3
- package/dist/@types/packages/vue2/src/components/filter-bar/components/date-range-filter/date-range-filter.vue.d.ts +5 -1
- package/dist/@types/packages/vue2/src/components/filter-bar/components/filter-bar-button/filter-bar-button.vue.d.ts +12 -3
- package/dist/@types/packages/vue2/src/components/form-layout/components/form-layout-group/form-layout-group.types.d.ts +2 -1
- package/dist/@types/packages/vue2/src/components/form-layout/components/form-layout-group/form-layout-group.vue.d.ts +2 -0
- package/dist/@types/packages/vue2/src/components/image/index.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/internal/base-button/base-button.vue.d.ts +2 -0
- package/dist/@types/packages/vue2/src/components/internal/button-actions-with-menu/button-actions-with-menu.vue.d.ts +24 -0
- package/dist/@types/packages/vue2/src/components/internal/listbox/listbox.vue.d.ts +3 -3
- package/dist/@types/packages/vue2/src/components/modal/components/base-modal/base-modal.vue.d.ts +3 -1
- package/dist/@types/packages/vue2/src/components/popover/popover.vue.d.ts +14 -3
- package/dist/@types/packages/vue2/src/components/popper-container/popper-container.types.d.ts +1 -9
- package/dist/@types/packages/vue2/src/components/popper-container/popper-container.utils.d.ts +5 -21
- package/dist/@types/packages/vue2/src/components/popper-container/popper-container.vue.d.ts +122 -72
- package/dist/@types/packages/vue2/src/components/segmented-control/segmented-control.vue.d.ts +3 -2
- package/dist/@types/packages/vue2/src/components/stepper/components/step/index.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/stepper/components/step/step.vue.d.ts +35 -0
- package/dist/@types/packages/vue2/src/components/stepper/composables/useKeyboardNavigation/useKeyboardNavigation.d.ts +15 -0
- package/dist/@types/packages/vue2/src/components/stepper/index.d.ts +3 -0
- package/dist/@types/packages/vue2/src/components/stepper/stepper.keys.d.ts +3 -0
- package/dist/@types/packages/vue2/src/components/stepper/stepper.types.d.ts +24 -0
- package/dist/@types/packages/vue2/src/components/stepper/stepper.vue.d.ts +44 -0
- package/dist/@types/packages/vue2/src/components/summary-grid/components/summary-grid-item-amount/summary-grid-item-amount.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/tooltip/tooltip.vue.d.ts +363 -82
- package/dist/@types/packages/vue2/src/index.d.ts +1 -0
- package/dist/@types/packages/vue2/src/types/index.d.ts +1 -0
- package/dist/@types/packages/vue2/src/types/lazy-load.d.ts +1 -0
- package/dist/accordion.js +3 -3
- package/dist/alert.js +4 -4
- package/dist/assets/base-button.css +1 -1
- package/dist/assets/base-modal.css +1 -1
- package/dist/assets/button.css +1 -1
- package/dist/assets/calendar.css +1 -1
- package/dist/assets/checkbox.css +1 -1
- package/dist/assets/dropdown-default-textbox.css +1 -1
- package/dist/assets/dropdown.css +1 -1
- package/dist/assets/index.css +1 -1
- package/dist/assets/index10.css +1 -1
- package/dist/assets/index11.css +1 -1
- package/dist/assets/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 -0
- package/dist/assets/index5.css +1 -1
- package/dist/assets/index6.css +1 -1
- package/dist/assets/index7.css +1 -1
- package/dist/assets/index8.css +1 -1
- package/dist/assets/index9.css +1 -1
- package/dist/assets/tooltip.css +1 -1
- package/dist/avatar-image.js +1 -1
- package/dist/badge.js +1 -1
- package/dist/button.js +5 -5
- package/dist/card.js +4 -4
- package/dist/checkbox.js +6 -6
- package/dist/chunks/base-button.9740f320.js +116 -0
- package/dist/chunks/base-button.9740f320.js.map +1 -0
- package/dist/chunks/base-modal.be77971f.js +296 -0
- package/dist/chunks/base-modal.be77971f.js.map +1 -0
- package/dist/chunks/{button.7d09c245.js → button.7072457f.js} +3 -3
- package/dist/chunks/{button.7d09c245.js.map → button.7072457f.js.map} +1 -1
- package/dist/chunks/{calendar.0e42130b.js → calendar.1e50c7d1.js} +5 -5
- package/dist/chunks/{calendar.0e42130b.js.map → calendar.1e50c7d1.js.map} +1 -1
- package/dist/chunks/{checkbox.17462cb0.js → checkbox.638bab98.js} +24 -24
- package/dist/chunks/{checkbox.17462cb0.js.map → checkbox.638bab98.js.map} +1 -1
- package/dist/chunks/{chevron-up.c03b58f8.js → chevron-up.9bf21068.js} +3 -3
- package/dist/chunks/{chevron-up.c03b58f8.js.map → chevron-up.9bf21068.js.map} +1 -1
- package/dist/chunks/{controls-group.0d6db9c0.js → controls-group.efcf4e8d.js} +2 -2
- package/dist/chunks/{controls-group.0d6db9c0.js.map → controls-group.efcf4e8d.js.map} +1 -1
- package/dist/chunks/{copy.c9a29be0.js → copy.527c3d76.js} +3 -3
- package/dist/chunks/{copy.c9a29be0.js.map → copy.527c3d76.js.map} +1 -1
- package/dist/chunks/debounce.b5ef6acf.js +10 -0
- package/dist/chunks/debounce.b5ef6acf.js.map +1 -0
- package/dist/chunks/{dropdown-default-textbox.cd789a95.js → dropdown-default-textbox.a1789dc7.js} +19 -18
- package/dist/chunks/{dropdown-default-textbox.cd789a95.js.map → dropdown-default-textbox.a1789dc7.js.map} +1 -1
- package/dist/chunks/{dropdown.ff4f94a8.js → dropdown.22e51667.js} +9 -7
- package/dist/chunks/dropdown.22e51667.js.map +1 -0
- package/dist/chunks/{error-message.8c67a507.js → error-message.37b6c7aa.js} +2 -2
- package/dist/chunks/{error-message.8c67a507.js.map → error-message.37b6c7aa.js.map} +1 -1
- package/dist/chunks/{footer-actions.a587e374.js → footer-actions.5275203a.js} +3 -3
- package/dist/chunks/{footer-actions.a587e374.js.map → footer-actions.5275203a.js.map} +1 -1
- package/dist/chunks/{grid-layout.984317d7.js → grid-layout.c98e6bc7.js} +2 -2
- package/dist/chunks/{grid-layout.984317d7.js.map → grid-layout.c98e6bc7.js.map} +1 -1
- package/dist/chunks/{index.77c651df.js → index.32ed68b7.js} +2 -2
- package/dist/chunks/{index.77c651df.js.map → index.32ed68b7.js.map} +1 -1
- package/dist/chunks/{index.fdb0c13d.js → index.604da8e9.js} +3 -3
- package/dist/chunks/{index.fdb0c13d.js.map → index.604da8e9.js.map} +1 -1
- package/dist/chunks/{index.fd1cd23a.js → index.a57930ba.js} +197 -188
- package/dist/chunks/index.a57930ba.js.map +1 -0
- package/dist/chunks/{index.ee69b530.js → index.c22c4278.js} +6 -6
- package/dist/chunks/{index.ee69b530.js.map → index.c22c4278.js.map} +1 -1
- package/dist/chunks/{index.140bf28f.js → index.c62ea69f.js} +2 -2
- package/dist/chunks/{index.140bf28f.js.map → index.c62ea69f.js.map} +1 -1
- package/dist/chunks/{index.450b70d5.js → index.dd20095f.js} +3 -3
- package/dist/chunks/{index.450b70d5.js.map → index.dd20095f.js.map} +1 -1
- package/dist/chunks/{debounce.f8d92e44.js → keyboard-navigation.ca47dfa8.js} +11 -17
- package/dist/chunks/keyboard-navigation.ca47dfa8.js.map +1 -0
- package/dist/chunks/{listbox-option-tag.ffe70226.js → listbox-option-tag.fa70334e.js} +3 -3
- package/dist/chunks/{listbox-option-tag.ffe70226.js.map → listbox-option-tag.fa70334e.js.map} +1 -1
- package/dist/chunks/{listbox.f535a736.js → listbox.4205c0de.js} +12 -11
- package/dist/chunks/{listbox.f535a736.js.map → listbox.4205c0de.js.map} +1 -1
- package/dist/chunks/{loading-button.bc6e3967.js → loading-button.41c15584.js} +2 -2
- package/dist/chunks/{loading-button.bc6e3967.js.map → loading-button.41c15584.js.map} +1 -1
- package/dist/chunks/{tooltip.973c86d3.js → tooltip.c8350cd0.js} +37 -36
- package/dist/chunks/{tooltip.973c86d3.js.map → tooltip.c8350cd0.js.map} +1 -1
- package/dist/chunks/use-has-slot.3daaffc6.js +17 -0
- package/dist/chunks/use-has-slot.3daaffc6.js.map +1 -0
- package/dist/code-snippet.js +469 -466
- package/dist/code-snippet.js.map +1 -1
- package/dist/country.js +2 -2
- package/dist/currency.js +1 -1
- package/dist/data-grid.js +963 -834
- package/dist/data-grid.js.map +1 -1
- package/dist/date-picker.js +8 -8
- package/dist/date-range-picker.js +2 -2
- package/dist/date.js +1 -1
- package/dist/divider.js +1 -1
- package/dist/dropdown.js +4 -4
- package/dist/empty-state.js +21 -21
- package/dist/empty-state.js.map +1 -1
- package/dist/filter-bar.js +853 -784
- package/dist/filter-bar.js.map +1 -1
- package/dist/focus-trap.js +1 -1
- package/dist/form-layout.js +72 -51
- package/dist/form-layout.js.map +1 -1
- package/dist/header.js +190 -112
- package/dist/header.js.map +1 -1
- package/dist/image.js +3 -1
- package/dist/index.js +219 -211
- package/dist/index.js.map +1 -1
- package/dist/info-icon.js +2 -2
- package/dist/input-field.js +5 -5
- package/dist/internal.js +7 -7
- package/dist/link.js +2 -2
- package/dist/loading-indicator.js +1 -1
- package/dist/menu.js +114 -104
- package/dist/menu.js.map +1 -1
- package/dist/modal.js +33 -30
- package/dist/modal.js.map +1 -1
- package/dist/pagination.js +4 -4
- package/dist/payment-method.js +2 -2
- package/dist/popover.js +72 -61
- package/dist/popover.js.map +1 -1
- package/dist/popper-container.js +1238 -192
- package/dist/popper-container.js.map +1 -1
- package/dist/radio-group.js +5 -5
- package/dist/search-bar.js +3 -3
- package/dist/segmented-control.js +15 -15
- package/dist/segmented-control.js.map +1 -1
- package/dist/sidepanel.js +7 -7
- package/dist/sidepanel.js.map +1 -1
- package/dist/status.js +2 -2
- package/dist/stepper.js +276 -0
- package/dist/stepper.js.map +1 -0
- package/dist/structured-list.js +1 -1
- package/dist/summary-grid.js +5 -5
- package/dist/tabs.js +2 -2
- package/dist/tag.js +3 -3
- package/dist/textarea.js +4 -4
- package/dist/timeline.js +5 -5
- package/dist/toast.js +4 -4
- package/dist/toggle.js +12 -12
- package/dist/toggle.js.map +1 -1
- package/dist/typography.js +1 -1
- package/dist/web-types.json +1 -1
- package/package.json +3 -3
- package/dist/chunks/base-button.c4ac1ad1.js +0 -108
- package/dist/chunks/base-button.c4ac1ad1.js.map +0 -1
- package/dist/chunks/base-modal.db7a9829.js +0 -291
- package/dist/chunks/base-modal.db7a9829.js.map +0 -1
- package/dist/chunks/debounce.f8d92e44.js.map +0 -1
- package/dist/chunks/dropdown.ff4f94a8.js.map +0 -1
- package/dist/chunks/index.fd1cd23a.js.map +0 -1
- package/dist/chunks/use-has-slot.9fac7123.js +0 -16
- package/dist/chunks/use-has-slot.9fac7123.js.map +0 -1
package/dist/toggle.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { defineComponent as $, ref as y, computed as p, toRefs as V, watch as D, resolveComponent as _, openBlock as n, createElementBlock as
|
|
1
|
+
import { defineComponent as $, ref as y, computed as p, toRefs as V, watch as D, resolveComponent as _, openBlock as n, createElementBlock as k, normalizeClass as T, withDirectives as w, createElementVNode as b, vModelCheckbox as O, createBlock as g, createCommentVNode as i, withCtx as h, renderSlot as v } from "vue";
|
|
2
2
|
import { C as N } from "./chunks/checkmark-small.3e93a119.js";
|
|
3
|
-
import { B as U } from "./chunks/index.
|
|
3
|
+
import { B as U } from "./chunks/index.32ed68b7.js";
|
|
4
4
|
import { g as j } from "./chunks/unique-id.a2a2b458.js";
|
|
5
|
-
import { u as z } from "./chunks/use-has-slot.
|
|
5
|
+
import { u as z } from "./chunks/use-has-slot.3daaffc6.js";
|
|
6
6
|
import { u as H } from "./chunks/use-default-slot-validator.1169c221.js";
|
|
7
7
|
import { g as m } from "./chunks/get-slot-text.bead058f.js";
|
|
8
8
|
import { u as M } from "./chunks/aria-label.ac9651a5.js";
|
|
9
9
|
import { _ as P } from "./chunks/_plugin-vue_export-helper.dad06003.js";
|
|
10
|
-
import "./assets/
|
|
10
|
+
import "./assets/index40.css";
|
|
11
11
|
var C = /* @__PURE__ */ ((e) => (e.LABEL_FIRST = "label-first", e))(C || {}), d = /* @__PURE__ */ ((e) => (e.BEFORE = "before", e.AFTER = "after", e))(d || {});
|
|
12
12
|
const q = $({
|
|
13
13
|
name: "bento-toggle",
|
|
@@ -58,12 +58,12 @@ const q = $({
|
|
|
58
58
|
setup(e, { attrs: t, slots: a, emit: f }) {
|
|
59
59
|
const c = z(a), u = y(e.value), r = j("toggle-description"), s = m(a)("default"), o = m(a)("description");
|
|
60
60
|
H("bento-toggle", a.default, a.description);
|
|
61
|
-
const S = p(() => c("default") ? m(a)("default") : null), B = y(t["aria-label"]), { ariaLabel: E } = V(e),
|
|
61
|
+
const S = p(() => c("default") ? m(a)("default") : null), B = y(t["aria-label"]), { ariaLabel: E } = V(e), I = M({
|
|
62
62
|
ariaLabel: B.value,
|
|
63
63
|
// TODO: take this line away when the aria-label props is removed
|
|
64
64
|
label: E,
|
|
65
65
|
defaultFallback: S
|
|
66
|
-
}),
|
|
66
|
+
}), L = p(() => r ?? null), A = p(() => ({
|
|
67
67
|
[`b-toggle--${C.LABEL_FIRST}`]: e.labelPosition === d.BEFORE,
|
|
68
68
|
"b-toggle--disabled": e.disabled,
|
|
69
69
|
"b-toggle--readonly": e.readonly
|
|
@@ -81,8 +81,8 @@ const q = $({
|
|
|
81
81
|
// Refs
|
|
82
82
|
toggleInput: u,
|
|
83
83
|
// Values
|
|
84
|
-
computedAriaLabel:
|
|
85
|
-
computedDescription:
|
|
84
|
+
computedAriaLabel: I,
|
|
85
|
+
computedDescription: L,
|
|
86
86
|
defaultSlotValue: s,
|
|
87
87
|
descriptionSlotValue: o,
|
|
88
88
|
conditionalClasses: A,
|
|
@@ -103,7 +103,7 @@ const G = ["aria-label", "aria-describedby", "disabled", "aria-readonly"], J = {
|
|
|
103
103
|
};
|
|
104
104
|
function W(e, t, a, f, c, u) {
|
|
105
105
|
const r = _("checkmark-small"), s = _("bento-typography");
|
|
106
|
-
return n(),
|
|
106
|
+
return n(), k("label", {
|
|
107
107
|
class: T(["b-toggle", e.conditionalClasses]),
|
|
108
108
|
"data-testid": "label"
|
|
109
109
|
}, [
|
|
@@ -126,14 +126,14 @@ function W(e, t, a, f, c, u) {
|
|
|
126
126
|
e.toggleInput ? (n(), g(r, { key: 0 })) : i("", !0)
|
|
127
127
|
])
|
|
128
128
|
]),
|
|
129
|
-
e.hasSlot("default") ? (n(),
|
|
129
|
+
e.hasSlot("default") ? (n(), k("span", Q, [
|
|
130
130
|
e.hasSlot("default") ? (n(), g(s, {
|
|
131
131
|
key: 0,
|
|
132
132
|
el: "span",
|
|
133
133
|
variant: "body",
|
|
134
134
|
"data-testid": "inner-label"
|
|
135
135
|
}, {
|
|
136
|
-
default:
|
|
136
|
+
default: h(() => [
|
|
137
137
|
v(e.$slots, "default", {}, void 0, !0)
|
|
138
138
|
]),
|
|
139
139
|
_: 3
|
|
@@ -145,7 +145,7 @@ function W(e, t, a, f, c, u) {
|
|
|
145
145
|
variant: "body",
|
|
146
146
|
class: "b-toggle__description"
|
|
147
147
|
}, {
|
|
148
|
-
default:
|
|
148
|
+
default: h(() => [
|
|
149
149
|
v(e.$slots, "description", {}, void 0, !0)
|
|
150
150
|
]),
|
|
151
151
|
_: 3
|
package/dist/toggle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle.js","sources":["../../vue2/src/components/toggle/toggle.types.ts","../../vue2/src/components/toggle/toggle.vue"],"sourcesContent":["export enum BentoTogglePropClass {\n LABEL_FIRST = 'label-first',\n}\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoToggleLabelPosition {\n BEFORE = 'before',\n AFTER = 'after',\n}\n","<template>\n <label class=\"b-toggle\" :class=\"conditionalClasses\" data-testid=\"label\">\n <input\n v-model=\"toggleInput\"\n :aria-label=\"computedAriaLabel\"\n :aria-describedby=\"computedDescription\"\n :disabled=\"disabled\"\n :aria-readonly=\"readonly\"\n role=\"switch\"\n class=\"b-toggle__input\"\n type=\"checkbox\"\n @change=\"$event => onChange($event)\"\n @click=\"onClick\"\n />\n <span class=\"b-toggle__track\" aria-hidden=\"true\">\n <span class=\"b-toggle__handle\">\n <checkmark-small v-if=\"toggleInput\" />\n </span>\n </span>\n <span v-if=\"hasSlot('default')\" class=\"b-toggle__label-container\">\n <bento-typography v-if=\"hasSlot('default')\" el=\"span\" variant=\"body\" data-testid=\"inner-label\">\n <slot></slot>\n </bento-typography>\n <bento-typography\n v-if=\"hasSlot('default') && hasSlot('description')\"\n :id=\"descriptionId\"\n el=\"span\"\n variant=\"body\"\n class=\"b-toggle__description\"\n >\n <slot name=\"description\" />\n </bento-typography>\n </span>\n </label>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, PropType, ref, toRefs, watch } from 'vue';\n import CheckmarkSmall from '@adyen/ui-assets-icons-16/vue/checkmark-small';\n import { BentoToggleLabelPosition, BentoTogglePropClass } from './toggle.types';\n import { BentoTypography } from '@/components/typography';\n import { generateUid } from '@/utils/ts/unique-id';\n import { useDefaultSlotValidator, useHasSlot } from '@/composables';\n import { getSlotText } from '@/utils/ts/get-slot-text/get-slot-text';\n import { useAriaLabel } from '@/utils/ts/aria-label';\n\n /**\n * A wrapper around the bento toggle, providing checkbox functionality with a knob-like toggle\n *\n * @usage\n * import { BentoToggle, BentoLabelPosition } from '@adyen/adl-vue2';\n *\n * export default {\n * components: { BentoToggle },\n * template: `\n * <bento-toggle\n * :value=\"toggleValue\"`\n * label-position=\"LabelPosition.BEFORE\"\n * @input=\"optionalHandler($event)\"\n * >\n * Label Text\n * </bento-toggle>\n * `,\n * }\n */\n export default defineComponent({\n name: 'bento-toggle',\n components: { BentoTypography, CheckmarkSmall },\n props: {\n /**\n * @deprecated from version 2.0.0. Use the aria-label attribute instead.\n */\n /**\n * Accessible name for the toggle. It is strongly recommended to pass such value when the toggle is used without a label\n */\n ariaLabel: {\n type: String,\n default: undefined,\n },\n /**\n * Disable the toggle (optional)\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n /**\n * Position of the label relative to the toggle (optional)\n * @values before, after\n */\n labelPosition: {\n type: String as PropType<BentoToggleLabelPosition | `${BentoToggleLabelPosition}`>,\n default: BentoToggleLabelPosition.BEFORE,\n validator: (value: BentoToggleLabelPosition) => Object.values(BentoToggleLabelPosition).includes(value),\n },\n /**\n * Setting this property to true will set the toggle to read only state.\n */\n readonly: {\n type: Boolean,\n default: false,\n },\n /**\n * Indicates if the switch is \"on\" or \"off\"\n */\n value: {\n type: Boolean,\n default: false,\n },\n },\n emits: ['input'],\n setup(props, { attrs, slots, emit }) {\n const hasSlot = useHasSlot(slots);\n\n const toggleInput = ref(props.value);\n const descriptionId: string = generateUid('toggle-description');\n\n const defaultSlotValue = getSlotText(slots)('default');\n const descriptionSlotValue = getSlotText(slots)('description');\n\n useDefaultSlotValidator('bento-toggle', slots.default, slots.description);\n\n const labelSlot = computed((): string => (hasSlot('default') ? getSlotText(slots)('default') : null));\n\n const ariaLabelAttribute = ref(attrs['aria-label']);\n const { ariaLabel } = 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: labelSlot,\n });\n\n const computedDescription = computed((): string | null => descriptionId ?? null);\n\n const conditionalClasses = computed((): { [key: string]: boolean } => ({\n [`b-toggle--${BentoTogglePropClass.LABEL_FIRST}`]:\n props.labelPosition === BentoToggleLabelPosition.BEFORE,\n 'b-toggle--disabled': props.disabled,\n 'b-toggle--readonly': props.readonly,\n }));\n\n const onChange = (event: Event) => {\n emit('input', (event.target as HTMLInputElement).checked);\n };\n\n // readonly attr doesn't work with checkbox, so we need to manually ignore the click instead\n const onClick = (event: Event) => {\n if (props.readonly) {\n event.preventDefault();\n }\n };\n\n watch(\n () => props.value,\n newValue => {\n toggleInput.value = newValue;\n }\n );\n\n return {\n // Refs\n toggleInput,\n\n // Values\n computedAriaLabel,\n computedDescription,\n defaultSlotValue,\n descriptionSlotValue,\n conditionalClasses,\n descriptionId,\n\n // Method\n hasSlot,\n onChange,\n onClick,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./toggle.scss\" />\n"],"names":["BentoTogglePropClass","BentoTogglePropClass2","BentoToggleLabelPosition","BentoToggleLabelPosition2","_sfc_main","defineComponent","BentoTypography","CheckmarkSmall","value","props","attrs","slots","emit","hasSlot","useHasSlot","toggleInput","ref","descriptionId","generateUid","defaultSlotValue","getSlotText","descriptionSlotValue","useDefaultSlotValidator","labelSlot","computed","ariaLabelAttribute","ariaLabel","toRefs","computedAriaLabel","useAriaLabel","computedDescription","conditionalClasses","onChange","event","onClick","watch","newValue","_hoisted_1","openBlock","createElementBlock","normalizeClass","_ctx","_cache","$event","vModelCheckbox","createElementVNode","_hoisted_3","createBlock","_component_checkmark_small","createCommentVNode","_hoisted_4","_component_bento_typography"],"mappings":";;;;;;;;;;AAAY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,cAAA,eADQA,IAAAD,KAAA,CAAA,CAAA,GAOAE,IAAA,kBAAAC,OACRA,EAAA,SAAA,UACAA,EAAA,QAAA,SAFQA,IAAAD,KAAA,CAAA,CAAA;AC0DR,MAAAE,IAAAC,EAAA;AAAA,EAA+B,MAAA;AAAA,EACrB,YAAA,EAAA,iBAAAC,GAAA,gBAAAC,EAAA;AAAA,EACwC,OAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IACvC,WAAA;AAAA,MAOQ,MAAA;AAAA,MACD,SAAA;AAAA,IACG;AAAA;AAAA;AAAA;AAAA,IACb,UAAA;AAAA,MAIU,MAAA;AAAA,MACA,SAAA;AAAA,IACG;AAAA;AAAA;AAAA;AAAA;AAAA,IACb,eAAA;AAAA,MAKe,MAAA;AAAA,MACL,SAAAL,EAAA;A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AC,EAAA,QAAAW,GAAA;AAAA,MAELT,EAAA,QAAA,SAAA,KAAAH,EAAA,GAAAS,EAAAI,GAAA;AAAA,QAFkC,KAAA;AAAA,QAAC,IAAA;AAAA,QAAe,SAAA;AAAA;;;;;;MAI3D,CAAA,KAAAF,EAAA,IAAA,EAAA;AAAA,MAOSR,EAAA,QAAA,SAAA,KAAAA,EAAA,QAAA,aAAA,KAAAH,EAAA,GAAAS,EAAAI,GAAA;AAAA,QANG,KAAA;AAAA,QACf,IAAAV,EAAA;AAAA,QACK,IAAA;AAAA,QACR,SAAA;AAAA;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"toggle.js","sources":["../../vue2/src/components/toggle/toggle.types.ts","../../vue2/src/components/toggle/toggle.vue"],"sourcesContent":["export enum BentoTogglePropClass {\n LABEL_FIRST = 'label-first',\n}\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoToggleLabelPosition {\n BEFORE = 'before',\n AFTER = 'after',\n}\n","<template>\n <label class=\"b-toggle\" :class=\"conditionalClasses\" data-testid=\"label\">\n <input\n v-model=\"toggleInput\"\n :aria-label=\"computedAriaLabel\"\n :aria-describedby=\"computedDescription\"\n :disabled=\"disabled\"\n :aria-readonly=\"readonly\"\n role=\"switch\"\n class=\"b-toggle__input\"\n type=\"checkbox\"\n @change=\"$event => onChange($event)\"\n @click=\"onClick\"\n />\n <span class=\"b-toggle__track\" aria-hidden=\"true\">\n <span class=\"b-toggle__handle\">\n <checkmark-small v-if=\"toggleInput\" />\n </span>\n </span>\n <span v-if=\"hasSlot('default')\" class=\"b-toggle__label-container\">\n <bento-typography v-if=\"hasSlot('default')\" el=\"span\" variant=\"body\" data-testid=\"inner-label\">\n <slot></slot>\n </bento-typography>\n <bento-typography\n v-if=\"hasSlot('default') && hasSlot('description')\"\n :id=\"descriptionId\"\n el=\"span\"\n variant=\"body\"\n class=\"b-toggle__description\"\n >\n <slot name=\"description\" />\n </bento-typography>\n </span>\n </label>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, PropType, ref, toRefs, watch } from 'vue';\n import CheckmarkSmall from '@adyen/ui-assets-icons-16/vue/checkmark-small';\n import { BentoToggleLabelPosition, BentoTogglePropClass } from './toggle.types';\n import { BentoTypography } from '@/components/typography';\n import { generateUid } from '@/utils/ts/unique-id';\n import { useDefaultSlotValidator, useHasSlot } from '@/composables';\n import { getSlotText } from '@/utils/ts/get-slot-text/get-slot-text';\n import { useAriaLabel } from '@/utils/ts/aria-label';\n\n /**\n * A wrapper around the bento toggle, providing checkbox functionality with a knob-like toggle\n *\n * @usage\n * import { BentoToggle, BentoLabelPosition } from '@adyen/adl-vue2';\n *\n * export default {\n * components: { BentoToggle },\n * template: `\n * <bento-toggle\n * :value=\"toggleValue\"`\n * label-position=\"LabelPosition.BEFORE\"\n * @input=\"optionalHandler($event)\"\n * >\n * Label Text\n * </bento-toggle>\n * `,\n * }\n */\n export default defineComponent({\n name: 'bento-toggle',\n components: { BentoTypography, CheckmarkSmall },\n props: {\n /**\n * @deprecated from version 2.0.0. Use the aria-label attribute instead.\n */\n /**\n * Accessible name for the toggle. It is strongly recommended to pass such value when the toggle is used without a label\n */\n ariaLabel: {\n type: String,\n default: undefined,\n },\n /**\n * Disable the toggle (optional)\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n /**\n * Position of the label relative to the toggle (optional)\n * @values before, after\n */\n labelPosition: {\n type: String as PropType<BentoToggleLabelPosition | `${BentoToggleLabelPosition}`>,\n default: BentoToggleLabelPosition.BEFORE,\n validator: (value: BentoToggleLabelPosition) => Object.values(BentoToggleLabelPosition).includes(value),\n },\n /**\n * Setting this property to true will set the toggle to read only state.\n */\n readonly: {\n type: Boolean,\n default: false,\n },\n /**\n * Indicates if the switch is \"on\" or \"off\"\n */\n value: {\n type: Boolean,\n default: false,\n },\n },\n emits: ['input'],\n setup(props, { attrs, slots, emit }) {\n const hasSlot = useHasSlot(slots);\n\n const toggleInput = ref(props.value);\n const descriptionId: string = generateUid('toggle-description');\n\n const defaultSlotValue = getSlotText(slots)('default');\n const descriptionSlotValue = getSlotText(slots)('description');\n\n useDefaultSlotValidator('bento-toggle', slots.default, slots.description);\n\n const labelSlot = computed((): string => (hasSlot('default') ? getSlotText(slots)('default') : null));\n\n const ariaLabelAttribute = ref(attrs['aria-label']);\n const { ariaLabel } = 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: labelSlot,\n });\n\n const computedDescription = computed((): string | null => descriptionId ?? null);\n\n const conditionalClasses = computed((): { [key: string]: boolean } => ({\n [`b-toggle--${BentoTogglePropClass.LABEL_FIRST}`]:\n props.labelPosition === BentoToggleLabelPosition.BEFORE,\n 'b-toggle--disabled': props.disabled,\n 'b-toggle--readonly': props.readonly,\n }));\n\n const onChange = (event: Event) => {\n emit('input', (event.target as HTMLInputElement).checked);\n };\n\n // readonly attr doesn't work with checkbox, so we need to manually ignore the click instead\n const onClick = (event: Event) => {\n if (props.readonly) {\n event.preventDefault();\n }\n };\n\n watch(\n () => props.value,\n newValue => {\n toggleInput.value = newValue;\n }\n );\n\n return {\n // Refs\n toggleInput,\n\n // Values\n computedAriaLabel,\n computedDescription,\n defaultSlotValue,\n descriptionSlotValue,\n conditionalClasses,\n descriptionId,\n\n // Method\n hasSlot,\n onChange,\n onClick,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./toggle.scss\" />\n"],"names":["BentoTogglePropClass","BentoTogglePropClass2","BentoToggleLabelPosition","BentoToggleLabelPosition2","_sfc_main","defineComponent","BentoTypography","CheckmarkSmallIcon","value","props","attrs","slots","emit","hasSlot","useHasSlot","toggleInput","ref","descriptionId","generateUid","defaultSlotValue","getSlotText","descriptionSlotValue","useDefaultSlotValidator","labelSlot","computed","ariaLabelAttribute","ariaLabel","toRefs","computedAriaLabel","useAriaLabel","computedDescription","conditionalClasses","onChange","event","onClick","watch","newValue","_hoisted_1","openBlock","createElementBlock","normalizeClass","_ctx","_cache","$event","vModelCheckbox","createElementVNode","_hoisted_3","createBlock","_component_checkmark_small","createCommentVNode","_hoisted_4","_component_bento_typography"],"mappings":";;;;;;;;;;AAAY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,cAAA,eADQA,IAAAD,KAAA,CAAA,CAAA,GAOAE,IAAA,kBAAAC,OACRA,EAAA,SAAA,UACAA,EAAA,QAAA,SAFQA,IAAAD,KAAA,CAAA,CAAA;AC0DR,MAAAE,IAAAC,EAAA;AAAA,EAA+B,MAAA;AAAA,EACrB,YAAA,EAAA,iBAAAC,GAAA,gBAAAC,EAAA;AAAA,EACwC,OAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IACvC,WAAA;AAAA,MAOQ,MAAA;AAAA,MACD,SAAA;AAAA,IACG;AAAA;AAAA;AAAA;AAAA,IACb,UAAA;AAAA,MAIU,MAAA;AAAA,MACA,SAAA;AAAA,IACG;AAAA;AAAA;AAAA;AAAA;AAAA,IACb,eAAA;AAAA,MAKe,MAAA;AAAA,MACL,SAAAL,EAAA;AAAA,MAC4B,WAAA,CAAAM,MAAA,OAAA,OAAAN,CAAA,EAAA,SAAAM,CAAA;AAAA,IACoE;AAAA;AAAA;AAAA;AAAA,IAC1G,UAAA;AAAA,MAIU,MAAA;AAAA,MACA,SAAA;AAAA,IACG;AAAA;AAAA;AAAA;AAAA,IACb,OAAA;AAAA,MAIO,MAAA;AAAA,MACG,SAAA;AAAA,IACG;AAAA,EACb;AAAA,EACJ,OAAA,CAAA,OAAA;AAAA,EACe,MAAAC,GAAA,EAAA,OAAAC,GAAA,OAAAC,GAAA,MAAAC,EAAA,GAAA;AAEX,UAAAC,IAAAC,EAAAH,CAAA,GAEAI,IAAAC,EAAAP,EAAA,KAAA,GACAQ,IAAAC,EAAA,oBAAA,GAEAC,IAAAC,EAAAT,CAAA,EAAA,SAAA,GACAU,IAAAD,EAAAT,CAAA,EAAA,aAA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
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Adyen Bento Vue 3 components",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -52,14 +52,14 @@
|
|
|
52
52
|
"url": "git@github.com:Adyen/bento.git"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@adyen/bento-design-tokens": "1.
|
|
55
|
+
"@adyen/bento-design-tokens": "1.5.0",
|
|
56
56
|
"@adyen/ui-assets-icons-16": "3.1.0",
|
|
57
57
|
"@adyen/ui-assets-payment-method-icons": "5.2.0",
|
|
58
58
|
"@codemirror/commands": "6.3.3",
|
|
59
59
|
"@codemirror/language-data": "6.4.0",
|
|
60
60
|
"@codemirror/state": "6.4.0",
|
|
61
61
|
"@codemirror/view": "6.23.0",
|
|
62
|
-
"@
|
|
62
|
+
"@floating-ui/vue": "1.0.6",
|
|
63
63
|
"date-fns": "2.28.0",
|
|
64
64
|
"focus-lock": "0.11.0",
|
|
65
65
|
"uuid": "9.0.0",
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { defineComponent as C, computed as _, ref as m, resolveComponent as y, openBlock as n, createElementBlock as i, normalizeClass as h, renderSlot as r, createCommentVNode as l, createBlock as S, withCtx as k } from "vue";
|
|
2
|
-
import { B as g } from "./index.77c651df.js";
|
|
3
|
-
import { u as B } from "./use-has-slot.9fac7123.js";
|
|
4
|
-
import { _ as L } from "./_plugin-vue_export-helper.dad06003.js";
|
|
5
|
-
import "../assets/base-button.css";
|
|
6
|
-
var d = /* @__PURE__ */ ((t) => (t.DESTRUCTIVE = "critical", t.ICON_ONLY = "icon-only", t))(d || {}), o = /* @__PURE__ */ ((t) => (t.BLUR = "blur", t.CLICK = "click", t.FOCUS = "focus", t.KEYDOWN_ESC = "keydown.esc", t))(o || {});
|
|
7
|
-
const $ = C({
|
|
8
|
-
name: "base-button",
|
|
9
|
-
components: { BentoTypography: g },
|
|
10
|
-
props: {
|
|
11
|
-
/**
|
|
12
|
-
* Disables button functionality
|
|
13
|
-
*/
|
|
14
|
-
disabled: {
|
|
15
|
-
type: Boolean,
|
|
16
|
-
default: !1
|
|
17
|
-
},
|
|
18
|
-
/**
|
|
19
|
-
* Displays button as critical
|
|
20
|
-
*/
|
|
21
|
-
critical: {
|
|
22
|
-
type: Boolean,
|
|
23
|
-
default: !1
|
|
24
|
-
},
|
|
25
|
-
/**
|
|
26
|
-
* The default behavior of the button.
|
|
27
|
-
* Possible values are: 'button', 'reset', 'submit'
|
|
28
|
-
*/
|
|
29
|
-
type: {
|
|
30
|
-
type: String,
|
|
31
|
-
default: "button"
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
emits: [
|
|
35
|
-
o.CLICK,
|
|
36
|
-
o.FOCUS,
|
|
37
|
-
o.BLUR,
|
|
38
|
-
o.KEYDOWN_ESC
|
|
39
|
-
],
|
|
40
|
-
setup(t, { slots: a, emit: c, attrs: u }) {
|
|
41
|
-
const p = _(() => {
|
|
42
|
-
var e;
|
|
43
|
-
return {
|
|
44
|
-
"aria-expanded": (e = u["aria-expanded"]) == null ? void 0 : e.toString()
|
|
45
|
-
};
|
|
46
|
-
}), b = m(null), s = _(() => ({
|
|
47
|
-
[`b-base-button--${d.DESTRUCTIVE}`]: t.critical,
|
|
48
|
-
[`b-base-button--${d.ICON_ONLY}`]: !a.default
|
|
49
|
-
}));
|
|
50
|
-
return {
|
|
51
|
-
// Values
|
|
52
|
-
ariaAttributes: p,
|
|
53
|
-
conditionalClasses: s,
|
|
54
|
-
// Methods
|
|
55
|
-
onClickButton: (e) => {
|
|
56
|
-
t.disabled ? (e.preventDefault(), e.stopPropagation()) : c(o.CLICK, e);
|
|
57
|
-
},
|
|
58
|
-
hasSlot: B(a),
|
|
59
|
-
// Refs
|
|
60
|
-
bentoBaseButtonRef: b
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
const I = ["disabled", "type", "aria-expanded"], O = {
|
|
65
|
-
key: 0,
|
|
66
|
-
class: "b-base-button__icon-left",
|
|
67
|
-
"data-testid": "icon-button-left"
|
|
68
|
-
}, R = {
|
|
69
|
-
key: 2,
|
|
70
|
-
class: "b-base-button__icon-right",
|
|
71
|
-
"data-testid": "icon-button-right"
|
|
72
|
-
};
|
|
73
|
-
function v(t, a, c, u, p, b) {
|
|
74
|
-
const s = y("bento-typography");
|
|
75
|
-
return n(), i("button", {
|
|
76
|
-
ref: "bentoBaseButtonRef",
|
|
77
|
-
class: h(["b-base-button", t.conditionalClasses]),
|
|
78
|
-
disabled: t.disabled,
|
|
79
|
-
type: t.type,
|
|
80
|
-
"aria-expanded": t.ariaAttributes["aria-expanded"],
|
|
81
|
-
onClick: a[0] || (a[0] = (...f) => t.onClickButton && t.onClickButton(...f))
|
|
82
|
-
}, [
|
|
83
|
-
t.hasSlot("iconLeft") ? (n(), i("span", O, [
|
|
84
|
-
r(t.$slots, "iconLeft", {}, void 0, !0)
|
|
85
|
-
])) : l("", !0),
|
|
86
|
-
t.hasSlot("default") ? (n(), S(s, {
|
|
87
|
-
key: 1,
|
|
88
|
-
el: "span",
|
|
89
|
-
variant: "body",
|
|
90
|
-
stronger: "",
|
|
91
|
-
class: "b-base-button__label"
|
|
92
|
-
}, {
|
|
93
|
-
default: k(() => [
|
|
94
|
-
r(t.$slots, "default", {}, void 0, !0)
|
|
95
|
-
]),
|
|
96
|
-
_: 3
|
|
97
|
-
})) : l("", !0),
|
|
98
|
-
t.hasSlot("iconRight") ? (n(), i("span", R, [
|
|
99
|
-
r(t.$slots, "iconRight", {}, void 0, !0)
|
|
100
|
-
])) : l("", !0)
|
|
101
|
-
], 10, I);
|
|
102
|
-
}
|
|
103
|
-
const K = /* @__PURE__ */ L($, [["render", v], ["__scopeId", "data-v-29782ba2"]]);
|
|
104
|
-
export {
|
|
105
|
-
K as B,
|
|
106
|
-
o as a
|
|
107
|
-
};
|
|
108
|
-
//# sourceMappingURL=base-button.c4ac1ad1.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base-button.c4ac1ad1.js","sources":["../../../vue2/src/components/internal/base-button/base-button.types.ts","../../../vue2/src/components/internal/base-button/base-button.vue"],"sourcesContent":["export enum BentoBaseButtonPropClass {\n DESTRUCTIVE = 'critical',\n ICON_ONLY = 'icon-only',\n}\n\nexport enum BentoBaseButtonEvent {\n BLUR = 'blur',\n CLICK = 'click',\n FOCUS = 'focus',\n KEYDOWN_ESC = 'keydown.esc',\n}\n\nexport enum BaseButtonType {\n BUTTON = 'button',\n RESET = 'reset',\n SUBMIT = 'submit',\n}\n","<template>\n <button\n ref=\"bentoBaseButtonRef\"\n class=\"b-base-button\"\n :class=\"conditionalClasses\"\n :disabled=\"disabled\"\n :type=\"type\"\n :aria-expanded=\"ariaAttributes['aria-expanded']\"\n @click=\"onClickButton\"\n >\n <span v-if=\"hasSlot('iconLeft')\" class=\"b-base-button__icon-left\" data-testid=\"icon-button-left\">\n <slot name=\"iconLeft\" />\n </span>\n <bento-typography v-if=\"hasSlot('default')\" el=\"span\" variant=\"body\" stronger class=\"b-base-button__label\">\n <slot />\n </bento-typography>\n <span v-if=\"hasSlot('iconRight')\" class=\"b-base-button__icon-right\" data-testid=\"icon-button-right\">\n <slot name=\"iconRight\" />\n </span>\n </button>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, PropType, ref } from 'vue';\n import { BentoBaseButtonEvent, BentoBaseButtonPropClass } from './base-button.types';\n import type { ButtonHTMLAttributes } from 'vue/types/jsx';\n import { BentoTypography } from '@/components/typography';\n import { useHasSlot } from '@/composables';\n import { Booleanish } from '@/types';\n\n /**\n * Base button component to use as a base for all the various types of bento buttons. For internal use only.\n *\n * * @example\n * import { BaseButton, BaseButtonEvent } from '@/components/internal/base-button';\n * import YourImportedIcon from @adyen/ui-assets-icons-16/example-icon';\n *\n * export default {\n * components: { BaseButton, YourImportedIcon },\n * props: {\n * text:\n * },\n * template: `\n * <base-button class=\"your-custom-button-styles\" @click=\"onClick\">\n * <template #iconLeft><your-imported-icon></template>\n * Button text\n * <template #iconRight><your-imported-icon></template>\n * </base-button>\n * `,\n * emits: [BentoButtonEvent.CLICK],\n * setup: (prps, { emit }) => {\n * const onClick = value => emit(BaseButtonEvent.CLICK, value);\n *\n * return {\n * onClick,\n * };\n * }\n * }\n */\n export default defineComponent({\n name: 'base-button',\n components: { BentoTypography },\n props: {\n /**\n * Disables button functionality\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n /**\n * Displays button as critical\n */\n critical: {\n type: Boolean,\n default: false,\n },\n /**\n * The default behavior of the button.\n * Possible values are: 'button', 'reset', 'submit'\n */\n type: {\n type: String as PropType<ButtonHTMLAttributes['type']>,\n default: 'button',\n },\n },\n emits: [\n BentoBaseButtonEvent.CLICK,\n BentoBaseButtonEvent.FOCUS,\n BentoBaseButtonEvent.BLUR,\n BentoBaseButtonEvent.KEYDOWN_ESC,\n ],\n setup(props, { slots, emit, attrs }) {\n const ariaAttributes = computed(() => ({\n 'aria-expanded': attrs['aria-expanded']?.toString() as Booleanish,\n }));\n\n const bentoBaseButtonRef = ref(null);\n\n const conditionalClasses = computed(() => ({\n [`b-base-button--${BentoBaseButtonPropClass.DESTRUCTIVE}`]: props.critical,\n [`b-base-button--${BentoBaseButtonPropClass.ICON_ONLY}`]: !slots.default,\n }));\n\n const onClickButton = (e: MouseEvent) => {\n if (!props.disabled) {\n emit(BentoBaseButtonEvent.CLICK, e);\n } else {\n e.preventDefault();\n e.stopPropagation();\n }\n };\n\n return {\n // Values\n ariaAttributes,\n conditionalClasses,\n\n // Methods\n onClickButton,\n hasSlot: useHasSlot(slots),\n\n // Refs\n bentoBaseButtonRef,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./base-button.scss\" />\n"],"names":["BentoBaseButtonPropClass","BentoBaseButtonPropClass2","BentoBaseButtonEvent","BentoBaseButtonEvent2","_sfc_main","defineComponent","BentoTypography","props","slots","emit","attrs","ariaAttributes","computed","_a","bentoBaseButtonRef","ref","conditionalClasses","useHasSlot","openBlock","createElementBlock","normalizeClass","_ctx","createCommentVNode","createBlock","_component_bento_typography","_hoisted_3"],"mappings":";;;;;AAAY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,cAAA,YACAA,EAAA,YAAA,aAFQA,IAAAD,KAAA,CAAA,CAAA,GAKAE,IAAA,kBAAAC,OACRA,EAAA,OAAA,QACAA,EAAA,QAAA,SACAA,EAAA,QAAA,SACAA,EAAA,cAAA,eAJQA,IAAAD,KAAA,CAAA,CAAA;ACsDR,MAAAE,IAAAC,EAAA;AAAA,EAA+B,MAAA;AAAA,EACrB,YAAA,EAAA,iBAAAC,EAAA;AAAA,EACwB,OAAA;AAAA;AAAA;AAAA;AAAA,IACvB,UAAA;AAAA,MAIO,MAAA;AAAA,MACA,SAAA;AAAA,IACG;AAAA;AAAA;AAAA;AAAA,IACb,UAAA;AAAA,MAIU,MAAA;AAAA,MACA,SAAA;AAAA,IACG;AAAA;AAAA;AAAA;AAAA;AAAA,IACb,MAAA;AAAA,MAKM,MAAA;AAAA,MACI,SAAA;AAAA,IACG;AAAA,EACb;AAAA,EACJ,OAAA;AAAA,IACOJ,EAAA;AAAA,IACkBA,EAAA;AAAA,IACAA,EAAA;AAAA,IACAA,EAAA;AAAA,EACA;AAAA,EACzB,MAAAK,GAAA,EAAA,OAAAC,GAAA,MAAAC,GAAA,OAAAC,EAAA,GAAA;AAEI,UAAAC,IAAAC,EAAA,MAAA;;AAAA;AAAA,QAAuC,kBAAAC,IAAAH,EAAA,eAAA,MAAA,gBAAAG,EAAA;AAAA,MACe;AAAA,KAAA,GAGtDC,IAAAC,EAAA,IAAA,GAEAC,IAAAJ,EAAA,OAAA;AAAA,MAA2C,CAAA,kBAAAZ,EAAA,aAAA,GAAAO,EAAA;AAAA,MAC2B,CAAA,kBAAAP,EAAA,WAAA,GAAA,CAAAQ,EAAA;AAAA,IACD,EAAA;AAYrE,WAAA;AAAA;AAAA,MAAO,gBAAAG;AAAA,MAEH,oBAAAK;AAAA;AAAA,MACA,eAZJ,CAAA,MAAA;AACI,QAAAT,EAAA,YAGI,EAAA,eAAA,GACA,EAAA,gBAAA,KAHAE,EAAAP,EAAA,OAAA,CAAA;AAAA,MAIJ;AAAA,MASA,SAAAe,EAAAT,CAAA;AAAA;AAAA,MACyB,oBAAAM;AAAA,IAGzB;AAAA,EACJ;AAER,CAAA;;EApH2C,KAAA;AAAA,EAA2B,OAAA;AAAA;;EAM1B,KAAA;AAAA,EAA4B,OAAA;AAAA;;;;AAb/D,SAAAI,EAAA,GAAAC,EAAA,UAAA;AAAA,IACG,KAAA;AAAA,IACP,OAAAC,EAAA,CAAA,iBAAAC,EAAA,kBAAA,CAAA;AAAA,IACU,UAAAA,EAAA;AAAA,IACG,MAAAA,EAAA;AAAA,IACR,iBAAAA,EAAA,eAAA,eAAA;AAAA;EAEa,GAAA;AAAA;;IAGK,CAAA,KAAAC,EAAA,IAAA,EAAA;AAAA,IAELD,EAAA,QAAA,SAAA,KAAAH,EAAA,GAAAK,EAAAC,GAAA;AAAA,MAFkC,KAAA;AAAA,MAAC,IAAA;AAAA,MAAe,SAAA;AAAA,MAAe,UAAA;AAAA;;;;;;;IAGpFH,EAAA,QAAA,WAAA,KAAAH,EAAA,GAAAC,EAAA,QAAAM,GAAA;AAAA;;;;;"}
|
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
import { defineComponent as F, useAttrs as z, ref as U, computed as u, watch as I, onMounted as q, resolveComponent as c, openBlock as s, createElementBlock as h, createElementVNode as _, normalizeClass as M, withKeys as K, createVNode as S, withCtx as m, normalizeStyle as E, renderSlot as f, createCommentVNode as l, createBlock as y } from "vue";
|
|
2
|
-
import { B as V } from "./index.77c651df.js";
|
|
3
|
-
import { a as W } from "./button.7d09c245.js";
|
|
4
|
-
import { BentoDivider as H } from "../divider.js";
|
|
5
|
-
import { B as Q } from "./index.fdb0c13d.js";
|
|
6
|
-
import { u as Y } from "./use-has-slot.9fac7123.js";
|
|
7
|
-
import { u as j } from "./i18n.6c402773.js";
|
|
8
|
-
import { C as J } from "./cross.5c36a670.js";
|
|
9
|
-
import { G as X, a as Z } from "./grid-layout.984317d7.js";
|
|
10
|
-
import { _ as x } from "./_plugin-vue_export-helper.dad06003.js";
|
|
11
|
-
import "../assets/base-modal.css";
|
|
12
|
-
var ee = /* @__PURE__ */ ((e) => (e.DEFAULT = "BentoModalDefault", e.DIALOG = "BentoModalDialog", e))(ee || {}), A = /* @__PURE__ */ ((e) => (e.SMALL = "small", e.MEDIUM = "medium", e.LARGE = "large", e))(A || {}), C = /* @__PURE__ */ ((e) => (e.SMALLER = "smaller", e.EQUAL = "equal", e.BIGGER = "bigger", e))(C || {}), O = /* @__PURE__ */ ((e) => (e.DIALOG = "dialog", e.ALERT_DIALOG = "alertdialog", e))(O || {}), oe = /* @__PURE__ */ ((e) => (e.CONFIRMATION = "confirmation", e.DESTRUCTIVE = "destructive", e.INFO = "info", e.ACKNOWLEDGEMENT = "acknowledgement", e))(oe || {}), k = /* @__PURE__ */ ((e) => (e.CLOSE_MODAL = "close-modal", e))(k || {});
|
|
13
|
-
const w = {
|
|
14
|
-
"en-US": {
|
|
15
|
-
ariaLabelFallback: "modal"
|
|
16
|
-
}
|
|
17
|
-
}, te = 500, ae = F({
|
|
18
|
-
i18n: { messages: w },
|
|
19
|
-
name: "base-modal",
|
|
20
|
-
components: { CrossIcon: J, BentoTypography: V, BentoButton: W, BentoDivider: H, BentoFocusTrap: Q, GridLayout: X },
|
|
21
|
-
props: {
|
|
22
|
-
/**
|
|
23
|
-
* List of actions that will be used to render the buttons.
|
|
24
|
-
* First element in the list will be rendered as "primary".
|
|
25
|
-
* All elements after the first will be rendered as "secondary".
|
|
26
|
-
* But you may change the color of 1-st action to red with 'critial' key
|
|
27
|
-
* Not more than 3 action buttons can be provided
|
|
28
|
-
* Or 2 action buttons and 1 Label for them
|
|
29
|
-
*
|
|
30
|
-
* Each object in the list should have a `title`, an `event` and
|
|
31
|
-
* (optional) a Vue `icon` from the library `@adyen/ui-assets-icons-16`.
|
|
32
|
-
*
|
|
33
|
-
* `title`: Button's text.
|
|
34
|
-
*
|
|
35
|
-
* `event`: Event triggered when clicking the Button.
|
|
36
|
-
*
|
|
37
|
-
* `icon`: Vue Icon from the library `@adyen/ui-assets-icons-16`.
|
|
38
|
-
*
|
|
39
|
-
* ```
|
|
40
|
-
* [{
|
|
41
|
-
* title: 'Primary',2
|
|
42
|
-
* event: () => { ... },
|
|
43
|
-
* icon: FourPeopleIcon
|
|
44
|
-
* }, {
|
|
45
|
-
* title: 'Secondary',
|
|
46
|
-
* event: () => { ... }
|
|
47
|
-
* }]
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
actions: {
|
|
51
|
-
type: Array,
|
|
52
|
-
default: null
|
|
53
|
-
},
|
|
54
|
-
/**
|
|
55
|
-
* If a column layout is provided, it renders the respective left column width variant. This can be smaller than the second column, the same size as the second column or bigger than the second column.
|
|
56
|
-
*/
|
|
57
|
-
columnsSize: {
|
|
58
|
-
type: String,
|
|
59
|
-
default: C.SMALLER
|
|
60
|
-
},
|
|
61
|
-
/**
|
|
62
|
-
* If provided, manages the padding of the whole modal container
|
|
63
|
-
*/
|
|
64
|
-
customPadding: { type: String, default: null },
|
|
65
|
-
/**
|
|
66
|
-
* Hides a cross icon on the right side of the title
|
|
67
|
-
*/
|
|
68
|
-
hideCloseButton: { type: Boolean, required: !0 },
|
|
69
|
-
/**
|
|
70
|
-
* Sets the open attribute on the dialog element, use isOpen instead to toggle modal visbility.
|
|
71
|
-
*/
|
|
72
|
-
initiallyOpen: { type: Boolean, default: !1 },
|
|
73
|
-
/**
|
|
74
|
-
* If set to true, it allows the modal to be closed by clicking outside of it
|
|
75
|
-
*/
|
|
76
|
-
isDismissible: { type: Boolean, required: !0 },
|
|
77
|
-
/**
|
|
78
|
-
* Controls the modal's state from the outside. Set it to true to open the modal
|
|
79
|
-
*/
|
|
80
|
-
isOpen: { type: Boolean, required: !0 },
|
|
81
|
-
/**
|
|
82
|
-
* Defines whether the modal will be an alert modal
|
|
83
|
-
*/
|
|
84
|
-
modalRole: { type: String, default: O.DIALOG },
|
|
85
|
-
/**
|
|
86
|
-
* Allows the inner elments to overflow the dialog
|
|
87
|
-
*/
|
|
88
|
-
overflowVisible: { type: Boolean, default: !1 },
|
|
89
|
-
/**
|
|
90
|
-
* Sets the width of the modal
|
|
91
|
-
*/
|
|
92
|
-
size: {
|
|
93
|
-
type: String,
|
|
94
|
-
default: A.SMALL
|
|
95
|
-
},
|
|
96
|
-
/**
|
|
97
|
-
* If provided, renders the modal's content in a two-column layout an wth dividers separating its content
|
|
98
|
-
*/
|
|
99
|
-
withColumnLayout: { type: Boolean, default: !1 }
|
|
100
|
-
},
|
|
101
|
-
emits: [k.CLOSE_MODAL],
|
|
102
|
-
setup(e, { slots: i, emit: B }) {
|
|
103
|
-
const { t: v } = j({ messages: w }), G = z(), d = Y(i), t = U(null), g = u(() => {
|
|
104
|
-
if (!e.customPadding)
|
|
105
|
-
return {};
|
|
106
|
-
const o = {
|
|
107
|
-
paddingLeft: e.customPadding,
|
|
108
|
-
paddingRight: e.customPadding
|
|
109
|
-
}, n = { ...o, paddingTop: void 0, paddingBottom: void 0 };
|
|
110
|
-
return d("default") || (n.paddingTop = e.customPadding), d("actions") || (n.paddingBottom = e.customPadding), {
|
|
111
|
-
header: { ...o, paddingTop: e.customPadding },
|
|
112
|
-
content: n,
|
|
113
|
-
actions: { ...o, paddingBottom: e.customPadding }
|
|
114
|
-
};
|
|
115
|
-
}), L = u(
|
|
116
|
-
() => G["aria-label"] ?? v("ariaLabelFallback")
|
|
117
|
-
), r = u(() => e.withColumnLayout && e.size === A.LARGE), b = () => {
|
|
118
|
-
t.value.showModal();
|
|
119
|
-
}, p = () => {
|
|
120
|
-
B(k.CLOSE_MODAL);
|
|
121
|
-
}, a = () => {
|
|
122
|
-
t.value.close(), p();
|
|
123
|
-
}, D = () => {
|
|
124
|
-
a();
|
|
125
|
-
}, R = ({ target: o }) => {
|
|
126
|
-
o && o.tagName === O.DIALOG.toUpperCase() && a();
|
|
127
|
-
}, T = u(() => ({
|
|
128
|
-
[`b-modal-base__container--${e.size}`]: e.size,
|
|
129
|
-
"b-modal-base__container--visible": e.isOpen,
|
|
130
|
-
"b-modal-base__container--overflow-visible": e.overflowVisible,
|
|
131
|
-
"b-modal-base__container--column-layout": r.value
|
|
132
|
-
})), P = u(() => ({
|
|
133
|
-
"b-modal-base__content--column-layout": r.value,
|
|
134
|
-
"b-modal-base__content--with-header": d("default"),
|
|
135
|
-
"b-modal-base__content--with-actions": d("actions")
|
|
136
|
-
})), N = u(() => e.columnsSize === C.SMALLER ? [{ small: 4, medium: 4, large: 4 }] : e.columnsSize === C.BIGGER ? [{ small: 8, medium: 8, large: 8 }] : [{ small: 6, medium: 6, large: 6 }]);
|
|
137
|
-
return I(
|
|
138
|
-
() => [e.isOpen, t.value],
|
|
139
|
-
([o, n], [, $]) => {
|
|
140
|
-
if (!n)
|
|
141
|
-
return;
|
|
142
|
-
o ? b() : !$ || a();
|
|
143
|
-
}
|
|
144
|
-
), I(
|
|
145
|
-
() => e.actions,
|
|
146
|
-
() => {
|
|
147
|
-
var o, n;
|
|
148
|
-
((n = (o = e.actions) == null ? void 0 : o[0]) == null ? void 0 : n.state) === "success" && setTimeout(a, te);
|
|
149
|
-
},
|
|
150
|
-
{ deep: !0 }
|
|
151
|
-
), q(() => {
|
|
152
|
-
e.isOpen && t.value && b();
|
|
153
|
-
}), {
|
|
154
|
-
// Refs
|
|
155
|
-
modal: t,
|
|
156
|
-
computedAriaLabel: L,
|
|
157
|
-
// Handling the state
|
|
158
|
-
openModal: b,
|
|
159
|
-
closeModalOnClickOutside: R,
|
|
160
|
-
// Methods
|
|
161
|
-
onCloseButtonClick: D,
|
|
162
|
-
hasSlot: d,
|
|
163
|
-
emitCloseEvent: p,
|
|
164
|
-
t: v,
|
|
165
|
-
// Styles
|
|
166
|
-
modalConditionalClasses: T,
|
|
167
|
-
modalContentConditionalClasses: P,
|
|
168
|
-
customPaddingStyles: g,
|
|
169
|
-
hasColumnLayout: r,
|
|
170
|
-
computedColumnWidth: N,
|
|
171
|
-
// Enums
|
|
172
|
-
GridLayoutContainerType: Z
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
const ne = { class: "b-modal-base" }, se = ["role", "aria-label", "open"], le = { class: "b-modal-base__wrapper" }, ie = { class: "b-modal-base__header" }, de = {
|
|
177
|
-
"aria-label": "modal actions",
|
|
178
|
-
class: "b-modal-base__actions"
|
|
179
|
-
};
|
|
180
|
-
function re(e, i, B, v, G, d) {
|
|
181
|
-
const t = c("bento-typography"), g = c("cross-icon"), L = c("bento-button"), r = c("bento-divider"), b = c("grid-layout"), p = c("bento-focus-trap");
|
|
182
|
-
return s(), h("div", ne, [
|
|
183
|
-
_("dialog", {
|
|
184
|
-
ref: "modal",
|
|
185
|
-
role: e.modalRole,
|
|
186
|
-
"aria-label": e.computedAriaLabel,
|
|
187
|
-
class: M(["b-modal-base__container", e.modalConditionalClasses]),
|
|
188
|
-
open: e.initiallyOpen,
|
|
189
|
-
onClick: i[0] || (i[0] = (a) => e.isDismissible && e.closeModalOnClickOutside(a)),
|
|
190
|
-
onKeydown: i[1] || (i[1] = K((...a) => e.emitCloseEvent && e.emitCloseEvent(...a), ["esc"]))
|
|
191
|
-
}, [
|
|
192
|
-
S(p, null, {
|
|
193
|
-
default: m(() => [
|
|
194
|
-
_("div", le, [
|
|
195
|
-
e.hasSlot("default") || !e.hideCloseButton ? (s(), h("div", {
|
|
196
|
-
key: 0,
|
|
197
|
-
class: "b-modal-base__header-container",
|
|
198
|
-
style: E(e.customPaddingStyles.header)
|
|
199
|
-
}, [
|
|
200
|
-
_("div", ie, [
|
|
201
|
-
S(t, {
|
|
202
|
-
class: "b-modal-base__title",
|
|
203
|
-
"aria-label": "base modal title",
|
|
204
|
-
el: "span",
|
|
205
|
-
variant: "title",
|
|
206
|
-
stronger: ""
|
|
207
|
-
}, {
|
|
208
|
-
default: m(() => [
|
|
209
|
-
e.hasSlot("default") ? f(e.$slots, "default", { key: 0 }, void 0, !0) : l("", !0)
|
|
210
|
-
]),
|
|
211
|
-
_: 3
|
|
212
|
-
}),
|
|
213
|
-
e.hideCloseButton ? l("", !0) : (s(), y(L, {
|
|
214
|
-
key: 0,
|
|
215
|
-
class: "b-modal-base__close-button",
|
|
216
|
-
variant: "tertiary",
|
|
217
|
-
type: "button",
|
|
218
|
-
onClick: e.onCloseButtonClick
|
|
219
|
-
}, {
|
|
220
|
-
default: m(() => [
|
|
221
|
-
S(g, { "svg-title": "close" })
|
|
222
|
-
]),
|
|
223
|
-
_: 1
|
|
224
|
-
}, 8, ["onClick"]))
|
|
225
|
-
]),
|
|
226
|
-
e.hasColumnLayout ? (s(), y(r, {
|
|
227
|
-
key: 0,
|
|
228
|
-
class: "b-modal-base__divider"
|
|
229
|
-
})) : l("", !0)
|
|
230
|
-
], 4)) : l("", !0),
|
|
231
|
-
_("div", {
|
|
232
|
-
class: M(["b-modal-base__content", e.modalContentConditionalClasses]),
|
|
233
|
-
style: E(e.customPaddingStyles.content)
|
|
234
|
-
}, [
|
|
235
|
-
e.hasSlot("content") || e.hasSlot("content-col-1") && e.hasSlot("content-col-2") ? (s(), y(t, {
|
|
236
|
-
key: 0,
|
|
237
|
-
"aria-label": "base modal content",
|
|
238
|
-
el: "div",
|
|
239
|
-
variant: "body",
|
|
240
|
-
stronger: ""
|
|
241
|
-
}, {
|
|
242
|
-
default: m(() => [
|
|
243
|
-
e.hasColumnLayout ? (s(), y(b, {
|
|
244
|
-
key: 0,
|
|
245
|
-
"column-width": e.computedColumnWidth,
|
|
246
|
-
"container-type": e.GridLayoutContainerType.NORMAL,
|
|
247
|
-
class: "b-modal-base__grid"
|
|
248
|
-
}, {
|
|
249
|
-
"col-1": m(() => [
|
|
250
|
-
f(e.$slots, "content-col-1", {}, void 0, !0)
|
|
251
|
-
]),
|
|
252
|
-
"col-2": m(() => [
|
|
253
|
-
f(e.$slots, "content-col-2", {}, void 0, !0)
|
|
254
|
-
]),
|
|
255
|
-
_: 3
|
|
256
|
-
}, 8, ["column-width", "container-type"])) : f(e.$slots, "content", { key: 1 }, void 0, !0)
|
|
257
|
-
]),
|
|
258
|
-
_: 3
|
|
259
|
-
})) : l("", !0)
|
|
260
|
-
], 6),
|
|
261
|
-
e.hasSlot("actions") ? (s(), h("div", {
|
|
262
|
-
key: 1,
|
|
263
|
-
class: "b-modal-base__actions-container",
|
|
264
|
-
style: E(e.customPaddingStyles.actions)
|
|
265
|
-
}, [
|
|
266
|
-
e.hasColumnLayout ? (s(), y(r, {
|
|
267
|
-
key: 0,
|
|
268
|
-
class: "b-modal-base__divider"
|
|
269
|
-
})) : l("", !0),
|
|
270
|
-
_("div", de, [
|
|
271
|
-
f(e.$slots, "actions", {}, void 0, !0)
|
|
272
|
-
])
|
|
273
|
-
], 4)) : l("", !0)
|
|
274
|
-
])
|
|
275
|
-
]),
|
|
276
|
-
_: 3
|
|
277
|
-
})
|
|
278
|
-
], 42, se)
|
|
279
|
-
]);
|
|
280
|
-
}
|
|
281
|
-
const Le = /* @__PURE__ */ x(ae, [["render", re], ["__scopeId", "data-v-b3662c97"]]);
|
|
282
|
-
export {
|
|
283
|
-
ee as B,
|
|
284
|
-
A as a,
|
|
285
|
-
C as b,
|
|
286
|
-
O as c,
|
|
287
|
-
oe as d,
|
|
288
|
-
k as e,
|
|
289
|
-
Le as f
|
|
290
|
-
};
|
|
291
|
-
//# sourceMappingURL=base-modal.db7a9829.js.map
|