@adyen/bento-vue2 1.87.1 → 1.88.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/index.d.ts +127 -63
- package/dist/action-bar.js +1 -1
- package/dist/assets/accordion-item.css +1 -1
- package/dist/assets/action-bar.css +1 -1
- package/dist/assets/base-modal.css +1 -1
- package/dist/assets/button-actions.css +1 -1
- package/dist/assets/card.css +1 -1
- package/dist/assets/data-grid.css +1 -1
- package/dist/assets/dialog-page.css +1 -1
- package/dist/assets/dropdown.css +1 -1
- package/dist/assets/file-uploader.css +1 -1
- package/dist/assets/inspector.css +1 -1
- package/dist/assets/modal-fullscreen.css +1 -1
- package/dist/assets/radio-input.css +1 -1
- package/dist/assets/sidepanel.css +1 -1
- package/dist/checkbox.js +2 -2
- package/dist/chunks/action-bar.rHHYcsRV.js +233 -0
- package/dist/chunks/action-bar.rHHYcsRV.js.map +1 -0
- package/dist/chunks/{checkbox-group.BtsDJN9I.js → checkbox-group.ntiYZadA.js} +2 -2
- package/dist/chunks/{checkbox-group.BtsDJN9I.js.map → checkbox-group.ntiYZadA.js.map} +1 -1
- package/dist/chunks/{checkbox.Dxvh9si9.js → checkbox.DfB3ZeA-.js} +18 -18
- package/dist/chunks/{checkbox.Dxvh9si9.js.map → checkbox.DfB3ZeA-.js.map} +1 -1
- package/dist/chunks/{code-snippet.CaAEHdBl.js → code-snippet.D5ET8Yc1.js} +2 -2
- package/dist/chunks/{code-snippet.CaAEHdBl.js.map → code-snippet.D5ET8Yc1.js.map} +1 -1
- package/dist/chunks/{data-grid.BvukOpky.js → data-grid.u3f__x8_.js} +470 -463
- package/dist/chunks/data-grid.u3f__x8_.js.map +1 -0
- package/dist/chunks/{date-range-picker.BJ-ARlkH.js → date-range-picker.B9XHHv9W.js} +3 -3
- package/dist/chunks/{date-range-picker.BJ-ARlkH.js.map → date-range-picker.B9XHHv9W.js.map} +1 -1
- package/dist/chunks/{dropdown-tag.DSCZALNp.js → dropdown-tag.Dmq73cu9.js} +2 -2
- package/dist/chunks/{dropdown-tag.DSCZALNp.js.map → dropdown-tag.Dmq73cu9.js.map} +1 -1
- package/dist/chunks/{dropdown.ET_mq1_P.js → dropdown.Do5c4SST.js} +25 -25
- package/dist/chunks/dropdown.Do5c4SST.js.map +1 -0
- package/dist/chunks/{filter-bar.DrkWf7T6.js → filter-bar.B_RHM9kR.js} +11 -11
- package/dist/chunks/{filter-bar.DrkWf7T6.js.map → filter-bar.B_RHM9kR.js.map} +1 -1
- package/dist/chunks/{header-with-views.DLoIc0yO.js → header-with-views.F1h5e4Wn.js} +3 -3
- package/dist/chunks/{header-with-views.DLoIc0yO.js.map → header-with-views.F1h5e4Wn.js.map} +1 -1
- package/dist/chunks/{input-field-password.TIzrVzR6.js → input-field-password.nYiBJRzJ.js} +3 -3
- package/dist/chunks/{input-field-password.TIzrVzR6.js.map → input-field-password.nYiBJRzJ.js.map} +1 -1
- package/dist/chunks/{input-field-phone-number.s2fP7BVR.js → input-field-phone-number.BhLVrf55.js} +3 -3
- package/dist/chunks/{input-field-phone-number.s2fP7BVR.js.map → input-field-phone-number.BhLVrf55.js.map} +1 -1
- package/dist/chunks/{input-field.CSCJTxk1.js → input-field.CFdpdjK5.js} +2 -2
- package/dist/chunks/{input-field.CSCJTxk1.js.map → input-field.CFdpdjK5.js.map} +1 -1
- package/dist/chunks/{pagination.iN0eYByB.js → pagination.BKIqR6O6.js} +2 -2
- package/dist/chunks/{pagination.iN0eYByB.js.map → pagination.BKIqR6O6.js.map} +1 -1
- package/dist/chunks/{radio-group.5ZxqWguJ.js → radio-group.DhDhTbZp.js} +2 -2
- package/dist/chunks/{radio-group.5ZxqWguJ.js.map → radio-group.DhDhTbZp.js.map} +1 -1
- package/dist/chunks/{radio-input.kzb4gxLW.js → radio-input.CLlYadKI.js} +14 -14
- package/dist/chunks/radio-input.CLlYadKI.js.map +1 -0
- package/dist/chunks/{rich-text-editor.BJ-FvvNc.js → rich-text-editor.BjjQ0hue.js} +2 -2
- package/dist/chunks/{rich-text-editor.BJ-FvvNc.js.map → rich-text-editor.BjjQ0hue.js.map} +1 -1
- package/dist/chunks/{search-bar.GPl6NU_w.js → search-bar.k0tIoWcb.js} +3 -3
- package/dist/chunks/{search-bar.GPl6NU_w.js.map → search-bar.k0tIoWcb.js.map} +1 -1
- package/dist/chunks/{secondary-nav.DMHDxGDq.js → secondary-nav.CV6EiZPL.js} +2 -2
- package/dist/chunks/{secondary-nav.DMHDxGDq.js.map → secondary-nav.CV6EiZPL.js.map} +1 -1
- package/dist/chunks/{selection-card-group.Hol_gJKN.js → selection-card-group.CMTwk1iJ.js} +8 -8
- package/dist/chunks/{selection-card-group.Hol_gJKN.js.map → selection-card-group.CMTwk1iJ.js.map} +1 -1
- package/dist/code-snippet.js +1 -1
- package/dist/data-grid.js +1 -1
- package/dist/date-range-picker.js +1 -1
- package/dist/dropdown.js +2 -2
- package/dist/filter-bar.js +1 -1
- package/dist/header-with-views.js +1 -1
- package/dist/index.js +20 -20
- package/dist/input-field-password.js +1 -1
- package/dist/input-field-phone-number.js +1 -1
- package/dist/input-field.js +1 -1
- package/dist/pagination.js +1 -1
- package/dist/radio-group.js +2 -2
- package/dist/rich-text-editor.js +1 -1
- package/dist/search-bar.js +2 -2
- package/dist/secondary-nav.js +1 -1
- package/dist/selection-card.js +1 -1
- package/dist/web-types.json +57 -3
- package/package.json +5 -5
- package/dist/chunks/action-bar.ChMlt59Z.js +0 -163
- package/dist/chunks/action-bar.ChMlt59Z.js.map +0 -1
- package/dist/chunks/data-grid.BvukOpky.js.map +0 -1
- package/dist/chunks/dropdown.ET_mq1_P.js.map +0 -1
- package/dist/chunks/radio-input.kzb4gxLW.js.map +0 -1
package/dist/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"framework": "vue",
|
|
3
3
|
"name": "@adyen/bento-vue2",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.88.0",
|
|
5
5
|
"contributions": {
|
|
6
6
|
"html": {
|
|
7
7
|
"description-markup": "markdown",
|
|
@@ -137,6 +137,33 @@
|
|
|
137
137
|
},
|
|
138
138
|
"default": "null"
|
|
139
139
|
},
|
|
140
|
+
{
|
|
141
|
+
"name": "state",
|
|
142
|
+
"description": "State of the action bar.",
|
|
143
|
+
"value": {
|
|
144
|
+
"kind": "expression",
|
|
145
|
+
"type": "BentoActionBarState"
|
|
146
|
+
},
|
|
147
|
+
"default": "'start'"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"name": "showUndoAction",
|
|
151
|
+
"description": "Displays the undo action button in `success` state.",
|
|
152
|
+
"value": {
|
|
153
|
+
"kind": "expression",
|
|
154
|
+
"type": "boolean"
|
|
155
|
+
},
|
|
156
|
+
"default": "false"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"name": "showRetryAction",
|
|
160
|
+
"description": "Displays the retry action button in `fail` state.",
|
|
161
|
+
"value": {
|
|
162
|
+
"kind": "expression",
|
|
163
|
+
"type": "boolean"
|
|
164
|
+
},
|
|
165
|
+
"default": "false"
|
|
166
|
+
},
|
|
140
167
|
{
|
|
141
168
|
"name": "variant",
|
|
142
169
|
"description": "Variant for the action bar",
|
|
@@ -153,10 +180,29 @@
|
|
|
153
180
|
"description": "Event emitted when the user click the close button"
|
|
154
181
|
},
|
|
155
182
|
{
|
|
156
|
-
"name": "cancel"
|
|
183
|
+
"name": "cancel",
|
|
184
|
+
"description": "Event emitted when the user clicks the cancel button in `confirmation` variant."
|
|
157
185
|
},
|
|
158
186
|
{
|
|
159
|
-
"name": "save"
|
|
187
|
+
"name": "save",
|
|
188
|
+
"description": "Event emitted when the user clicks the save button in `confirmation` variant."
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"name": "undo-action",
|
|
192
|
+
"description": "Event emitted when the user clicks the undo button in `success` state."
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"name": "retry-action",
|
|
196
|
+
"description": "Event emitted when the user clicks the retry button in `fail` state."
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"name": "cancel-action",
|
|
200
|
+
"description": "Event emitted when the user clicks the cancel button in `fail` state."
|
|
201
|
+
}
|
|
202
|
+
],
|
|
203
|
+
"slots": [
|
|
204
|
+
{
|
|
205
|
+
"name": "stateLabel"
|
|
160
206
|
}
|
|
161
207
|
],
|
|
162
208
|
"source": {
|
|
@@ -164,6 +210,14 @@
|
|
|
164
210
|
"symbol": "default"
|
|
165
211
|
}
|
|
166
212
|
},
|
|
213
|
+
{
|
|
214
|
+
"name": "action-bar-default",
|
|
215
|
+
"description": "",
|
|
216
|
+
"source": {
|
|
217
|
+
"module": "./src/components/action-bar/__tests__/action-bar-default.vue",
|
|
218
|
+
"symbol": "default"
|
|
219
|
+
}
|
|
220
|
+
},
|
|
167
221
|
{
|
|
168
222
|
"name": "action-bar-stub",
|
|
169
223
|
"description": "",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adyen/bento-vue2",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.88.0",
|
|
4
4
|
"description": "Adyen Bento Vue2 components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"unified": "11.0.5",
|
|
52
52
|
"uuid": "11.0.5",
|
|
53
53
|
"vue-demi": "0.14.10",
|
|
54
|
-
"@adyen/bento-design-tokens": "1.
|
|
54
|
+
"@adyen/bento-design-tokens": "1.88.0"
|
|
55
55
|
},
|
|
56
56
|
"dependenciesMeta": {
|
|
57
57
|
"@adyen/bento-vue-i18n-demi": {
|
|
@@ -137,11 +137,11 @@
|
|
|
137
137
|
"vue-template-compiler": "2.7.16",
|
|
138
138
|
"vue-tsc": "2.2.10",
|
|
139
139
|
"zod": "3.25.35",
|
|
140
|
-
"@adyen/bento-cli": "0.9.3",
|
|
141
140
|
"@adyen/bento-core": "0.0.1",
|
|
142
141
|
"@adyen/bento-vue-i18n-demi": "0.1.0",
|
|
143
|
-
"@adyen/ui-assets-
|
|
144
|
-
"@adyen/ui-assets-icons
|
|
142
|
+
"@adyen/ui-assets-icons-16": "7.7.3",
|
|
143
|
+
"@adyen/ui-assets-payment-method-icons": "10.7.1",
|
|
144
|
+
"@adyen/bento-cli": "0.9.4"
|
|
145
145
|
},
|
|
146
146
|
"optionalDependencies": {
|
|
147
147
|
"vue-router": "~3.6"
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { defineComponent as O, computed as o, ref as b, toRefs as P, watch as g, provide as R, nextTick as C } from "vue";
|
|
2
|
-
import { B as F } from "./button.Ctj3rkxw.js";
|
|
3
|
-
import { B as W } from "./typography.C8lPlsbD.js";
|
|
4
|
-
import { B as L } from "./button-actions-with-menu.D14S1pym.js";
|
|
5
|
-
import { C as U } from "./cross.CC_B-vG-.js";
|
|
6
|
-
import { u as k } from "./index.B6WW_F-J.js";
|
|
7
|
-
import { u as M } from "./index.CwzYJHw2.js";
|
|
8
|
-
import { P as z, B as D } from "./button-actions.DyPS54Yi.js";
|
|
9
|
-
import { n as G } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
|
|
10
|
-
import "../assets/action-bar.css";
|
|
11
|
-
const J = {
|
|
12
|
-
"en-US": {
|
|
13
|
-
actionBar: "Action bar",
|
|
14
|
-
cancel: "Cancel",
|
|
15
|
-
close: "Close",
|
|
16
|
-
save: "Save",
|
|
17
|
-
selected: "selected",
|
|
18
|
-
unsavedChanges: "Unsaved changes | unsaved change | unsaved changes"
|
|
19
|
-
},
|
|
20
|
-
"ja-JP": {
|
|
21
|
-
actionBar: "アクションバー",
|
|
22
|
-
cancel: "キャンセル",
|
|
23
|
-
close: "閉じる",
|
|
24
|
-
save: "保存",
|
|
25
|
-
selected: "選択済み",
|
|
26
|
-
unsavedChanges: "保存されていない変更 | 保存されていない変更 | 保存されていない変更"
|
|
27
|
-
},
|
|
28
|
-
"pt-BR": {
|
|
29
|
-
actionBar: "Barra de ação",
|
|
30
|
-
cancel: "Cancelar",
|
|
31
|
-
close: "Fechar",
|
|
32
|
-
save: "Salvar",
|
|
33
|
-
selected: "selecionado",
|
|
34
|
-
unsavedChanges: "Alterações não salvas | alteração não salva | alterações não salvas"
|
|
35
|
-
}
|
|
36
|
-
}, K = {
|
|
37
|
-
i18n: { messages: J }
|
|
38
|
-
}, j = /* @__PURE__ */ O({
|
|
39
|
-
...K,
|
|
40
|
-
__name: "action-bar",
|
|
41
|
-
props: {
|
|
42
|
-
/**
|
|
43
|
-
* List of actions that will be used to render the buttons.
|
|
44
|
-
* Required and used for the `default` variant.
|
|
45
|
-
*
|
|
46
|
-
* Each object in the list should have a `title`, an `event` and,
|
|
47
|
-
* optionally, an `icon`.
|
|
48
|
-
*
|
|
49
|
-
* The component will display 4 actions and the hide the rest inside a menu.
|
|
50
|
-
*
|
|
51
|
-
* @see BentoButton for a list of all the other props supported by each button action.
|
|
52
|
-
*/
|
|
53
|
-
actions: {
|
|
54
|
-
type: Array,
|
|
55
|
-
default: () => []
|
|
56
|
-
},
|
|
57
|
-
/**
|
|
58
|
-
* How many actions should be visible outside the menu, cannot be more than 4
|
|
59
|
-
*/
|
|
60
|
-
visibleActions: {
|
|
61
|
-
type: Number,
|
|
62
|
-
default: 4,
|
|
63
|
-
validator: (i) => i > 0 && i <= 4
|
|
64
|
-
},
|
|
65
|
-
/**
|
|
66
|
-
* Use when there are sticky elements at the bottom, like sticky pagination
|
|
67
|
-
*/
|
|
68
|
-
extraBottomSpacing: {
|
|
69
|
-
type: Boolean,
|
|
70
|
-
default: !1
|
|
71
|
-
},
|
|
72
|
-
/**
|
|
73
|
-
* Show how many items are selected.
|
|
74
|
-
* When omitted in the `confirmation` variant, a generic "Unsaved changes" label is displayed.
|
|
75
|
-
*/
|
|
76
|
-
itemCounter: {
|
|
77
|
-
type: Number,
|
|
78
|
-
default: null
|
|
79
|
-
},
|
|
80
|
-
/**
|
|
81
|
-
* Label for the selection, e.g. 'selected'/'changed'
|
|
82
|
-
*/
|
|
83
|
-
selectionLabel: {
|
|
84
|
-
type: String,
|
|
85
|
-
default: null
|
|
86
|
-
},
|
|
87
|
-
/**
|
|
88
|
-
* Variant for the action bar
|
|
89
|
-
* @values default, confirmation
|
|
90
|
-
*/
|
|
91
|
-
variant: {
|
|
92
|
-
type: String,
|
|
93
|
-
default: "default"
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
emits: ["close", "cancel", "save"],
|
|
97
|
-
setup(i, { emit: n }) {
|
|
98
|
-
const a = i, t = 100, v = 7, B = 500, m = 32, { t: r, tc: S, n: I } = k(), E = o(() => a.selectionLabel ? a.selectionLabel : r("selected")), l = b(null), { extraBottomSpacing: h, visibleActions: y } = P(a), { width: c } = M(), e = b(null), u = b(null), A = o(() => a.variant === "confirmation");
|
|
99
|
-
g(
|
|
100
|
-
() => y.value,
|
|
101
|
-
(s) => {
|
|
102
|
-
u.value = s <= 4 ? s : 4, e.value = u.value;
|
|
103
|
-
},
|
|
104
|
-
{ immediate: !0 }
|
|
105
|
-
);
|
|
106
|
-
const T = o(() => ({
|
|
107
|
-
"b-action-bar--extra-spacing": h.value,
|
|
108
|
-
"b-action-bar--confirmation": A.value
|
|
109
|
-
}));
|
|
110
|
-
R(z, v);
|
|
111
|
-
const N = o(() => {
|
|
112
|
-
const s = a.actions.map((x) => ({
|
|
113
|
-
...x,
|
|
114
|
-
variant: "secondary"
|
|
115
|
-
})), p = s.slice(0, e.value).reverse(), f = s.slice(e.value);
|
|
116
|
-
return [...p, ...f];
|
|
117
|
-
}), V = o(() => [
|
|
118
|
-
{
|
|
119
|
-
title: r("save"),
|
|
120
|
-
event: () => n("save")
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
title: r("cancel"),
|
|
124
|
-
variant: "secondary",
|
|
125
|
-
event: () => n("cancel")
|
|
126
|
-
}
|
|
127
|
-
]), w = o(() => a.itemCounter == null || a.itemCounter < 1), d = async () => {
|
|
128
|
-
await C(), c.value > l.value.clientWidth + m + t && e.value < u.value && (e.value += 1, d());
|
|
129
|
-
}, _ = async () => {
|
|
130
|
-
await C(), c.value < l.value.clientWidth + m && e.value > 0 && (e.value -= 1, _());
|
|
131
|
-
};
|
|
132
|
-
return g(
|
|
133
|
-
() => c.value,
|
|
134
|
-
async (s, p) => {
|
|
135
|
-
if (await C(), !l.value)
|
|
136
|
-
return;
|
|
137
|
-
const f = s > p;
|
|
138
|
-
c.value < B ? e.value = 0 : f ? d() : _();
|
|
139
|
-
},
|
|
140
|
-
{ immediate: !0 }
|
|
141
|
-
), { __sfc: !0, AVERAGE_BUTTON_SIZE: t, MENU_OFFSET: v, RESPONSIVE_BREAKPOINT: B, SPACING: m, props: a, emit: n, t: r, tc: S, n: I, label: E, actionBar: l, extraBottomSpacing: h, visibleActions: y, width: c, internalDisplayedActions: e, internalVisibleActions: u, isConfirmationVariant: A, conditionalClasses: T, actionsInternal: N, confirmationActions: V, noItemCounter: w, showActions: d, hideActions: _, BentoButton: F, BentoButtonActions: D, BentoTypography: W, ButtonActionsWithMenu: L, CrossIcon: U };
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
var Y = function() {
|
|
145
|
-
var n = this, a = n._self._c, t = n._self._setupProxy;
|
|
146
|
-
return a("Transition", { attrs: { name: "b-action-bar__animation", appear: "" } }, [a("section", { staticClass: "b-action-bar", class: t.conditionalClasses, attrs: { "aria-label": t.t("actionBar") } }, [a("div", { ref: "actionBar", staticClass: "b-action-bar__container" }, [t.isConfirmationVariant ? n._e() : a("div", { staticClass: "b-action-bar__close-button" }, [a(t.BentoButton, { attrs: { variant: "tertiary", inverse: "", "aria-label": t.t("close") }, on: { click: function(v) {
|
|
147
|
-
return t.emit("close");
|
|
148
|
-
} }, scopedSlots: n._u([{ key: "iconLeft", fn: function() {
|
|
149
|
-
return [a(t.CrossIcon, { attrs: { "aria-hidden": !0 } })];
|
|
150
|
-
}, proxy: !0 }], null, !1, 4214210411) })], 1), a(t.BentoTypography, { staticClass: "b-action-bar__selection", attrs: { el: "span", stronger: "" } }, [t.isConfirmationVariant && t.noItemCounter ? [n._v(" " + n._s(t.tc("unsavedChanges", 0)) + " ")] : [n._v(" " + n._s(t.n(n.itemCounter)) + " " + n._s(t.isConfirmationVariant ? t.tc("unsavedChanges", n.itemCounter) : t.label) + " ")]], 2), t.isConfirmationVariant ? a(t.BentoButtonActions, { staticClass: "b-action-bar__actions", attrs: { actions: t.confirmationActions, inverse: "" } }) : a(t.ButtonActionsWithMenu, { staticClass: "b-action-bar__actions", attrs: { actions: t.actionsInternal, "displayed-actions": t.internalDisplayedActions, "menu-position": "top-end", "disable-responsive-behavior": "", inverse: "" } })], 1)])]);
|
|
151
|
-
}, Z = [], $ = /* @__PURE__ */ G(
|
|
152
|
-
j,
|
|
153
|
-
Y,
|
|
154
|
-
Z,
|
|
155
|
-
!1,
|
|
156
|
-
null,
|
|
157
|
-
"3723457e"
|
|
158
|
-
);
|
|
159
|
-
const ot = $.exports;
|
|
160
|
-
export {
|
|
161
|
-
ot as B
|
|
162
|
-
};
|
|
163
|
-
//# sourceMappingURL=action-bar.ChMlt59Z.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action-bar.ChMlt59Z.js","sources":["../../src/components/action-bar/action-bar.vue"],"sourcesContent":["<template>\n <Transition name=\"b-action-bar__animation\" appear>\n <section class=\"b-action-bar\" :class=\"conditionalClasses\" :aria-label=\"t('actionBar')\">\n <div ref=\"actionBar\" class=\"b-action-bar__container\">\n <div v-if=\"!isConfirmationVariant\" class=\"b-action-bar__close-button\">\n <bento-button variant=\"tertiary\" inverse :aria-label=\"t('close')\" @click=\"emit('close')\">\n <template #iconLeft><cross-icon :aria-hidden=\"true\" /></template>\n </bento-button>\n </div>\n <bento-typography el=\"span\" stronger class=\"b-action-bar__selection\">\n <template v-if=\"isConfirmationVariant && noItemCounter\">\n {{ tc('unsavedChanges', 0) }}\n </template>\n <template v-else>\n {{ n(itemCounter) }}\n {{ isConfirmationVariant ? tc('unsavedChanges', itemCounter) : label }}\n </template>\n </bento-typography>\n <bento-button-actions\n v-if=\"isConfirmationVariant\"\n :actions=\"confirmationActions\"\n class=\"b-action-bar__actions\"\n inverse\n />\n <button-actions-with-menu\n v-else\n :actions=\"actionsInternal\"\n class=\"b-action-bar__actions\"\n :displayed-actions=\"internalDisplayedActions\"\n menu-position=\"top-end\"\n disable-responsive-behavior\n inverse\n />\n </div>\n </section>\n </Transition>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, nextTick, type PropType, provide, ref, toRefs, watch } from 'vue';\n import { BentoButton, BentoButtonActions, type BentoButtonActionsList } from '@/components/button';\n import { BentoTypography } from '@/components/typography';\n\n import { type BentoActionBarVariant } from '@/components/action-bar/action-bar.types';\n import ButtonActionsWithMenu from '@/components/internal/button-actions-with-menu/button-actions-with-menu.vue';\n import CrossIcon from '@adyen/ui-assets-icons-16/vue/cross';\n\n import { useI18n } from '@/utils/ts/i18n';\n import { useWindowSize } from '@vueuse/core';\n\n import messages from './messages.json';\n import { POPOVER_OFFSET_INJECTION_KEY } from '@/components/popover/popover.keys';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n // Constants\n const AVERAGE_BUTTON_SIZE = 100;\n const MENU_OFFSET = 7;\n const RESPONSIVE_BREAKPOINT = 500;\n const SPACING = 32;\n\n const props = defineProps({\n /**\n * List of actions that will be used to render the buttons.\n * Required and used for the `default` variant.\n *\n * Each object in the list should have a `title`, an `event` and,\n * optionally, an `icon`.\n *\n * The component will display 4 actions and the hide the rest inside a menu.\n *\n * @see BentoButton for a list of all the other props supported by each button action.\n */\n actions: {\n type: Array as PropType<BentoButtonActionsList>,\n default: () => [],\n },\n /**\n * How many actions should be visible outside the menu, cannot be more than 4\n */\n visibleActions: {\n type: Number,\n default: 4,\n validator: (value: number) => value > 0 && value <= 4,\n },\n /**\n * Use when there are sticky elements at the bottom, like sticky pagination\n */\n extraBottomSpacing: {\n type: Boolean,\n default: false,\n },\n /**\n * Show how many items are selected.\n * When omitted in the `confirmation` variant, a generic \"Unsaved changes\" label is displayed.\n */\n itemCounter: {\n type: Number,\n default: null,\n },\n /**\n * Label for the selection, e.g. 'selected'/'changed'\n */\n selectionLabel: {\n type: String,\n default: null,\n },\n /**\n * Variant for the action bar\n * @values default, confirmation\n */\n variant: {\n type: String as PropType<BentoActionBarVariant>,\n default: 'default',\n },\n });\n\n const emit = defineEmits([\"close\", \"cancel\", \"save\"]);\n\n const { t, tc, n } = useI18n<{ message: MessageSchema }>({ messages });\n const label = computed(() => (props.selectionLabel ? props.selectionLabel : t('selected')));\n\n // Refs\n const actionBar = ref<HTMLDivElement>(null);\n const { extraBottomSpacing, visibleActions } = toRefs(props);\n const { width } = useWindowSize();\n const internalDisplayedActions = ref(null);\n const internalVisibleActions = ref(null);\n\n const isConfirmationVariant = computed(() => props.variant === 'confirmation');\n\n watch(\n () => visibleActions.value,\n value => {\n internalVisibleActions.value = value <= 4 ? value : 4;\n internalDisplayedActions.value = internalVisibleActions.value;\n },\n { immediate: true }\n );\n\n // Styling\n const conditionalClasses = computed(() => ({\n 'b-action-bar--extra-spacing': extraBottomSpacing.value,\n 'b-action-bar--confirmation': isConfirmationVariant.value,\n }));\n\n // Provide POPOVER_OFFSET_INJECTION_KEY to change the value of the popover offset\n provide(POPOVER_OFFSET_INJECTION_KEY, MENU_OFFSET);\n\n // Manipulate actions array to display as intended\n const actionsInternal = computed(() => {\n // All buttons should be of type secondary in the action bar\n const actions = props.actions.map(action => ({\n ...action,\n variant: 'secondary',\n })) as BentoButtonActionsList;\n // Shown actions should display from left to right in action bar, instead of right to left which is the button actions default\n const shownActions = actions.slice(0, internalDisplayedActions.value).reverse();\n const hiddenActions = actions.slice(internalDisplayedActions.value);\n\n return [...shownActions, ...hiddenActions];\n });\n\n const confirmationActions = computed<BentoButtonActionsList>(() => [\n {\n title: t('save'),\n event: () => emit('save'),\n },\n {\n title: t('cancel'),\n variant: 'secondary',\n event: () => emit('cancel'),\n },\n ]);\n\n const noItemCounter = computed(() => {\n return props.itemCounter == null || props.itemCounter < 1;\n });\n\n // Recursive functions to determine how many actions should be visible/hidden based on the screens width\n const showActions = async () => {\n await nextTick();\n if (\n width.value > actionBar.value.clientWidth + SPACING + AVERAGE_BUTTON_SIZE &&\n internalDisplayedActions.value < internalVisibleActions.value\n ) {\n internalDisplayedActions.value += 1;\n showActions();\n }\n };\n\n const hideActions = async () => {\n await nextTick();\n if (width.value < actionBar.value.clientWidth + SPACING && internalDisplayedActions.value > 0) {\n internalDisplayedActions.value -= 1;\n hideActions();\n }\n };\n\n // Screen width watcher to toggle hidden/visible actions\n watch(\n () => width.value,\n async (newValue, oldValue) => {\n await nextTick();\n if (!actionBar.value) {\n return;\n }\n const isIncreasing = newValue > oldValue;\n if (width.value < RESPONSIVE_BREAKPOINT) {\n internalDisplayedActions.value = 0;\n } else if (isIncreasing) {\n showActions();\n } else {\n hideActions();\n }\n },\n { immediate: true }\n );\n</script>\n\n<script lang=\"ts\">\n /**\n * Action bar is a floating bar that provides users with quick access to key actions that can be applied to one or multiple items.\n *\n * @example\n * import { BentoActionBar } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoActionBar },\n * template: `\n * <bento-action-bar\n * :actions='[\n * {\n * title: 'Delete',\n * critical: true,\n * icon: BinIcon,\n * event: () => true,\n * },\n * {\n * title: 'Edit',\n * icon: EditIcon,\n * event: () => true,\n * }\n * ]'\n * @close=\"closeAction\"\n * :item-counter=\"5\"\n * />\n * `\n * }\n */\n export default {\n i18n: { messages },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./action-bar.scss\" />\n"],"names":["__default__","messages","AVERAGE_BUTTON_SIZE","MENU_OFFSET","RESPONSIVE_BREAKPOINT","SPACING","t","tc","n","useI18n","label","computed","props","actionBar","ref","extraBottomSpacing","visibleActions","toRefs","width","useWindowSize","internalDisplayedActions","internalVisibleActions","isConfirmationVariant","watch","value","conditionalClasses","provide","POPOVER_OFFSET_INJECTION_KEY","actionsInternal","actions","action","shownActions","hiddenActions","confirmationActions","emit","noItemCounter","showActions","nextTick","hideActions","newValue","oldValue","isIncreasing"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0PIA,IAAA;AAAA,EAAe,MAAA,EAAA,UAAAC,EAAA;AAEf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBApMAC,IAAA,KACAC,IAAA,GACAC,IAAA,KACAC,IAAA,IA4DA,EAAA,GAAAC,GAAA,IAAAC,GAAA,GAAAC,EAAA,IAAAC,EAAA,GACAC,IAAAC,EAAA,MAAAC,EAAA,iBAAAA,EAAA,iBAAAN,EAAA,UAAA,CAAA,GAGAO,IAAAC,EAAA,IAAA,GACA,EAAA,oBAAAC,GAAA,gBAAAC,EAAA,IAAAC,EAAAL,CAAA,GACA,EAAA,OAAAM,EAAA,IAAAC,EAAA,GACAC,IAAAN,EAAA,IAAA,GACAO,IAAAP,EAAA,IAAA,GAEAQ,IAAAX,EAAA,MAAAC,EAAA,YAAA,cAAA;AAEA,IAAAW;AAAA,MAAA,MAAAP,EAAA;AAAA,MACyB,CAAAQ,MAAA;AAEjB,QAAAH,EAAA,QAAAG,KAAA,IAAAA,IAAA,GACAJ,EAAA,QAAAC,EAAA;AAAA,MAAwD;AAAA,MAC5D,EAAA,WAAA,GAAA;AAAA,IACkB;AAItB,UAAAI,IAAAd,EAAA,OAAA;AAAA,MAA2C,+BAAAI,EAAA;AAAA,MACW,8BAAAO,EAAA;AAAA,IACE,EAAA;AAIxD,IAAAI,EAAAC,GAAAxB,CAAA;AAGA,UAAAyB,IAAAjB,EAAA,MAAA;AAEI,YAAAkB,IAAAjB,EAAA,QAAA,IAAA,CAAAkB,OAAA;AAAA,QAA6C,GAAAA;AAAA,QACtC,SAAA;AAAA,MACM,EAAA,GAGbC,IAAAF,EAAA,MAAA,GAAAT,EAAA,KAAA,EAAA,QAAA,GACAY,IAAAH,EAAA,MAAAT,EAAA,KAAA;AAEA,aAAA,CAAA,GAAAW,GAAA,GAAAC,CAAA;AAAA,IAAyC,CAAA,GAG7CC,IAAAtB,EAAA,MAAA;AAAA,MAAmE;AAAA,QAC/D,OAAAL,EAAA,MAAA;AAAA,QACmB,OAAA,MAAA4B,EAAA,MAAA;AAAA,MACS;AAAA,MAC5B;AAAA,QACA,OAAA5B,EAAA,QAAA;AAAA,QACqB,SAAA;AAAA,QACR,OAAA,MAAA4B,EAAA,QAAA;AAAA,MACiB;AAAA,IAC9B,CAAA,GAGJC,IAAAxB,EAAA,MACIC,EAAA,eAAA,QAAAA,EAAA,cAAA,CAAwD,GAI5DwB,IAAA,YAAA;AACI,YAAAC,EAAA,GACAnB,EAAA,QAAAL,EAAA,MAAA,cAAAR,IAAAH,KAAAkB,EAAA,QAAAC,EAAA,UAIID,EAAA,SAAA,GACAgB,EAAA;AAAA,IACJ,GAGJE,IAAA,YAAA;AACI,YAAAD,EAAA,GACAnB,EAAA,QAAAL,EAAA,MAAA,cAAAR,KAAAe,EAAA,QAAA,MACIA,EAAA,SAAA,GACAkB,EAAA;AAAA,IACJ;AAIJ,WAAAf;AAAA,MAAA,MAAAL,EAAA;AAAA,MACgB,OAAAqB,GAAAC,MAAA;AAGR,YADA,MAAAH,EAAA,GACA,CAAAxB,EAAA;AACI;AAEJ,cAAA4B,IAAAF,IAAAC;AACA,QAAAtB,EAAA,QAAAd,IACIgB,EAAA,QAAA,IAAiCqB,IAEjCL,EAAA,IAEAE,EAAA;AAAA,MACJ;AAAA,MACJ,EAAA,WAAA,GAAA;AAAA,IACkB;;;;;;;;;;;;;;;;;;;"}
|