@adyen/bento-vue2 1.67.0 → 1.68.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 +2066 -2264
- 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/checkbox.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/filter-bar.css +1 -1
- package/dist/assets/header-meta.css +1 -0
- package/dist/assets/header-with-views.css +1 -1
- package/dist/assets/header.css +1 -1
- package/dist/assets/input-field-phone-number.css +1 -1
- package/dist/assets/input-field.css +1 -1
- package/dist/assets/inspector.css +1 -1
- package/dist/assets/menu.css +1 -1
- package/dist/assets/modal-fullscreen.css +1 -1
- package/dist/assets/popover.css +1 -1
- package/dist/assets/sidepanel.css +1 -1
- package/dist/assets/summary-grid.css +1 -1
- package/dist/assets/textarea.css +1 -1
- package/dist/assets/use-cached-selected-values.css +1 -1
- package/dist/button.js +1 -1
- package/dist/card.js +1 -1
- package/dist/checkbox.js +2 -2
- package/dist/chunks/{action-bar.BxX3I27_.js → action-bar.Dy6tfK8c.js} +4 -4
- package/dist/chunks/{action-bar.BxX3I27_.js.map → action-bar.Dy6tfK8c.js.map} +1 -1
- package/dist/chunks/{base-modal.QGDM_kjG.js → base-modal.CkkfT6r6.js} +55 -118
- package/dist/chunks/base-modal.CkkfT6r6.js.map +1 -0
- package/dist/chunks/{button-actions-with-menu.itkbcqzk.js → button-actions-with-menu.CcxUTbsI.js} +3 -3
- package/dist/chunks/{button-actions-with-menu.itkbcqzk.js.map → button-actions-with-menu.CcxUTbsI.js.map} +1 -1
- package/dist/chunks/{button-actions.BKdI_ooV.js → button-actions.Ju27CRNG.js} +2 -2
- package/dist/chunks/button-actions.Ju27CRNG.js.map +1 -0
- package/dist/chunks/{card.BktfAMv5.js → card.CASAAsuJ.js} +2 -2
- package/dist/chunks/{card.BktfAMv5.js.map → card.CASAAsuJ.js.map} +1 -1
- package/dist/chunks/{checkbox-group.BVMGnokj.js → checkbox-group.QdX-NrSG.js} +2 -2
- package/dist/chunks/{checkbox-group.BVMGnokj.js.map → checkbox-group.QdX-NrSG.js.map} +1 -1
- package/dist/chunks/{checkbox.Bg5FM5Oa.js → checkbox.DCD6SSXC.js} +38 -37
- package/dist/chunks/checkbox.DCD6SSXC.js.map +1 -0
- package/dist/chunks/{code-snippet.DDiQ9R3o.js → code-snippet.dIKi0D7d.js} +3 -3
- package/dist/chunks/{code-snippet.DDiQ9R3o.js.map → code-snippet.dIKi0D7d.js.map} +1 -1
- package/dist/chunks/{country.Df7erZov.js → country.melpzEsY.js} +2 -2
- package/dist/chunks/{country.Df7erZov.js.map → country.melpzEsY.js.map} +1 -1
- package/dist/chunks/{dashboard-section.Beep1lY8.js → dashboard-section.DBT99mLj.js} +2 -2
- package/dist/chunks/{dashboard-section.Beep1lY8.js.map → dashboard-section.DBT99mLj.js.map} +1 -1
- package/dist/chunks/{dashed-underline.BQwLgzz6.js → dashed-underline.BbH6Lnd2.js} +2 -2
- package/dist/chunks/{dashed-underline.BQwLgzz6.js.map → dashed-underline.BbH6Lnd2.js.map} +1 -1
- package/dist/chunks/{data-grid-template.nkx0pCMA.js → data-grid-template.B2lDfM2o.js} +2 -2
- package/dist/chunks/{data-grid-template.nkx0pCMA.js.map → data-grid-template.B2lDfM2o.js.map} +1 -1
- package/dist/chunks/{data-grid.CkwZVy3a.js → data-grid.B7Z9_WDY.js} +1198 -1143
- package/dist/chunks/data-grid.B7Z9_WDY.js.map +1 -0
- package/dist/chunks/{date-picker.BLBXaDHv.js → date-picker.DGIS6Pp-.js} +2 -2
- package/dist/chunks/{date-picker.BLBXaDHv.js.map → date-picker.DGIS6Pp-.js.map} +1 -1
- package/dist/chunks/{date-range-picker.am63DgMj.js → date-range-picker.CIaKRXIQ.js} +5 -5
- package/dist/chunks/{date-range-picker.am63DgMj.js.map → date-range-picker.CIaKRXIQ.js.map} +1 -1
- package/dist/chunks/dropdown-default-textbox.94q6opSD.js.map +1 -1
- package/dist/chunks/dropdown-tag.BaosvGGZ.js +240 -0
- package/dist/chunks/dropdown-tag.BaosvGGZ.js.map +1 -0
- package/dist/chunks/{dropdown.HA6ISg2h.js → dropdown.DazYAy4B.js} +220 -363
- package/dist/chunks/dropdown.DazYAy4B.js.map +1 -0
- package/dist/chunks/es6.n1ewaW31.js.map +1 -1
- package/dist/chunks/{filter-bar.DbqsoAI1.js → filter-bar.DL19SXF1.js} +674 -669
- package/dist/chunks/filter-bar.DL19SXF1.js.map +1 -0
- package/dist/chunks/{footer-actions.BUfQFz7J.js → footer-actions.BE_zzX-e.js} +2 -2
- package/dist/chunks/{footer-actions.BUfQFz7J.js.map → footer-actions.BE_zzX-e.js.map} +1 -1
- package/dist/chunks/header-meta.CfloYa86.js +183 -0
- package/dist/chunks/header-meta.CfloYa86.js.map +1 -0
- package/dist/chunks/{header-with-views.JllLR2nW.js → header-with-views.Bxvu8mq_.js} +526 -520
- package/dist/chunks/header-with-views.Bxvu8mq_.js.map +1 -0
- package/dist/chunks/header.DvHS-PnC.js +103 -0
- package/dist/chunks/header.DvHS-PnC.js.map +1 -0
- package/dist/chunks/{input-field-password.BtOdV0gF.js → input-field-password.C1zTapiN.js} +4 -4
- package/dist/chunks/{input-field-password.BtOdV0gF.js.map → input-field-password.C1zTapiN.js.map} +1 -1
- package/dist/chunks/{input-field-phone-number.Dq-LnGag.js → input-field-phone-number.K8BYjWfa.js} +623 -607
- package/dist/chunks/{input-field-phone-number.Dq-LnGag.js.map → input-field-phone-number.K8BYjWfa.js.map} +1 -1
- package/dist/chunks/{input-field.Bg77qHT2.js → input-field.5S-pUNxA.js} +7 -7
- package/dist/chunks/input-field.5S-pUNxA.js.map +1 -0
- package/dist/chunks/{menu.EgYjFAku.js → menu.dX3_vU05.js} +154 -153
- package/dist/chunks/{menu.EgYjFAku.js.map → menu.dX3_vU05.js.map} +1 -1
- package/dist/chunks/{modal-fullscreen.BNTUOC7o.js → modal-fullscreen.DHotw1RI.js} +76 -63
- package/dist/chunks/modal-fullscreen.DHotw1RI.js.map +1 -0
- package/dist/chunks/{modal.OvB4kEGR.js → modal.eoNQ6E3U.js} +4 -4
- package/dist/chunks/{modal.OvB4kEGR.js.map → modal.eoNQ6E3U.js.map} +1 -1
- package/dist/chunks/{pagination.Dw153NzQ.js → pagination.4J7ZMyf5.js} +2 -2
- package/dist/chunks/{pagination.Dw153NzQ.js.map → pagination.4J7ZMyf5.js.map} +1 -1
- package/dist/chunks/popover.Bo4Bkudr.js +145 -0
- package/dist/chunks/popover.Bo4Bkudr.js.map +1 -0
- package/dist/chunks/popover.types.CBqyA4ly.js +6 -0
- package/dist/chunks/popover.types.CBqyA4ly.js.map +1 -0
- package/dist/chunks/{rich-text-editor.CRJRvfJn.js → rich-text-editor.BUKLdRkN.js} +2 -2
- package/dist/chunks/{rich-text-editor.CRJRvfJn.js.map → rich-text-editor.BUKLdRkN.js.map} +1 -1
- package/dist/chunks/{search-bar.BTZSePJh.js → search-bar.CuBj5FAE.js} +3 -3
- package/dist/chunks/{search-bar.BTZSePJh.js.map → search-bar.CuBj5FAE.js.map} +1 -1
- package/dist/chunks/{secondary-nav.BBhSBNn7.js → secondary-nav.C6usurfD.js} +2 -2
- package/dist/chunks/{secondary-nav.BBhSBNn7.js.map → secondary-nav.C6usurfD.js.map} +1 -1
- package/dist/chunks/{sidepanel.Dt-BnFzN.js → sidepanel.DyThBUgV.js} +2 -2
- package/dist/chunks/{sidepanel.Dt-BnFzN.js.map → sidepanel.DyThBUgV.js.map} +1 -1
- package/dist/chunks/{summary-grid.types.DsvtLg3D.js → summary-grid.types.D_FU3sUq.js} +4 -4
- package/dist/chunks/summary-grid.types.D_FU3sUq.js.map +1 -0
- package/dist/chunks/{textarea.RAU710Uw.js → textarea.UPM6N9V1.js} +7 -7
- package/dist/chunks/textarea.UPM6N9V1.js.map +1 -0
- package/dist/chunks/{timeline-item.Dz66luo5.js → timeline-item.DqLhj0Lb.js} +3 -3
- package/dist/chunks/{timeline-item.Dz66luo5.js.map → timeline-item.DqLhj0Lb.js.map} +1 -1
- package/dist/chunks/{tutorial.DAKO-fKz.js → tutorial.DRRfp81j.js} +7 -6
- package/dist/chunks/{tutorial.DAKO-fKz.js.map → tutorial.DRRfp81j.js.map} +1 -1
- package/dist/chunks/{use-cached-selected-values.DQPABFfG.js → use-cached-selected-values.0EeyFfyF.js} +413 -410
- package/dist/chunks/use-cached-selected-values.0EeyFfyF.js.map +1 -0
- package/dist/chunks/{use-country-items.HFnjuDsG.js → use-country-items.BllTb5MK.js} +2 -2
- package/dist/chunks/{use-country-items.HFnjuDsG.js.map → use-country-items.BllTb5MK.js.map} +1 -1
- package/dist/chunks/{use-country-phon-code.DVgE19zT.js → use-country-phon-code.BOaJ9PDl.js} +507 -498
- package/dist/chunks/{use-country-phon-code.DVgE19zT.js.map → use-country-phon-code.BOaJ9PDl.js.map} +1 -1
- package/dist/code-snippet.js +1 -1
- package/dist/country.js +2 -2
- package/dist/dashboard-template.js +1 -1
- package/dist/dashed-underline.js +1 -1
- package/dist/data-grid-template.js +1 -1
- package/dist/data-grid.js +1 -1
- package/dist/date-picker.js +1 -1
- package/dist/date-range-picker.js +1 -1
- package/dist/dropdown.js +3 -3
- package/dist/filter-bar.js +1 -1
- package/dist/header-with-views.js +1 -1
- package/dist/header.js +1 -1
- package/dist/index.js +155 -154
- package/dist/index.js.map +1 -1
- 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/internal.js +15 -14
- package/dist/menu.js +1 -1
- package/dist/modal-fullscreen.js +1 -1
- package/dist/modal.js +11 -11
- package/dist/pagination.js +1 -1
- package/dist/popover.js +3 -2
- package/dist/popover.js.map +1 -1
- package/dist/rich-text-editor.js +1 -1
- package/dist/search-bar.js +2 -2
- package/dist/secondary-nav.js +1 -1
- package/dist/sidepanel.js +1 -1
- package/dist/styles/bento-dark.css +10 -2
- package/dist/styles/bento-light.css +10 -2
- package/dist/styles/bento.css +10 -2
- package/dist/styles/legacy.css +10 -2
- package/dist/styles/styleguide.css +10 -2
- package/dist/summary-grid.js +1 -1
- package/dist/textarea.js +1 -1
- package/dist/timeline.js +1 -1
- package/dist/tutorial.js +1 -1
- package/dist/web-types.json +265 -51
- package/package.json +6 -6
- package/dist/assets/info-icon-with-popover.css +0 -1
- package/dist/chunks/base-modal.QGDM_kjG.js.map +0 -1
- package/dist/chunks/button-actions.BKdI_ooV.js.map +0 -1
- package/dist/chunks/checkbox.Bg5FM5Oa.js.map +0 -1
- package/dist/chunks/data-grid.CkwZVy3a.js.map +0 -1
- package/dist/chunks/dropdown-tag.DYIkCBa6.js +0 -215
- package/dist/chunks/dropdown-tag.DYIkCBa6.js.map +0 -1
- package/dist/chunks/dropdown.HA6ISg2h.js.map +0 -1
- package/dist/chunks/filter-bar.DbqsoAI1.js.map +0 -1
- package/dist/chunks/header-with-views.JllLR2nW.js.map +0 -1
- package/dist/chunks/header.04Y0unpy.js +0 -188
- package/dist/chunks/header.04Y0unpy.js.map +0 -1
- package/dist/chunks/info-icon-with-popover.B1DnkW4B.js +0 -71
- package/dist/chunks/info-icon-with-popover.B1DnkW4B.js.map +0 -1
- package/dist/chunks/input-field.Bg77qHT2.js.map +0 -1
- package/dist/chunks/modal-fullscreen.BNTUOC7o.js.map +0 -1
- package/dist/chunks/popover.BGHbPUOr.js +0 -295
- package/dist/chunks/popover.BGHbPUOr.js.map +0 -1
- package/dist/chunks/summary-grid.types.DsvtLg3D.js.map +0 -1
- package/dist/chunks/textarea.RAU710Uw.js.map +0 -1
- package/dist/chunks/use-cached-selected-values.DQPABFfG.js.map +0 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { defineComponent as T, useSlots as Y, ref as
|
|
1
|
+
import { defineComponent as T, useSlots as Y, ref as c, computed as l, inject as Q, watch as w, nextTick as X, onUnmounted as Z, useAttrs as V, toRefs as tt, onMounted as et, provide as D } from "vue";
|
|
2
2
|
import { B as at } from "./button.hF-nD1Og.js";
|
|
3
3
|
import { B as ot } from "./focus-trap.C-wIQqpO.js";
|
|
4
4
|
import { u as q } from "./use-has-slot.C9lQZ6nz.js";
|
|
5
5
|
import { u as nt } from "./i18n.BQkEbtPM.js";
|
|
6
6
|
import { M as st } from "./base-modal.keys.C2PQXcE2.js";
|
|
7
7
|
import { g as lt } from "./generate-uid.NJ8tVoha.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
8
|
+
import { C as it } from "./cross.CC_B-vG-.js";
|
|
9
|
+
import { D as ut, B as ct, b as rt, a as dt } from "./dialog-page.CLHZqQeU.js";
|
|
10
|
+
import { B as mt } from "./typography.J1v_SPG3.js";
|
|
11
|
+
import { F as pt } from "./footer-actions.BE_zzX-e.js";
|
|
12
|
+
import { o as ft } from "./resize.Bqks3WUm.js";
|
|
13
|
+
import { a as gt, G as _t } from "./grid-layout.HvTAa4to.js";
|
|
13
14
|
import { n as W } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
|
|
14
|
-
import { C as _t } from "./cross.CC_B-vG-.js";
|
|
15
15
|
import { B as vt } from "./directive.Cbdox5VL.js";
|
|
16
16
|
import "../assets/base-modal.css";
|
|
17
17
|
var yt = /* @__PURE__ */ ((a) => (a.DEFAULT = "default", a.DIALOG = "dialog", a))(yt || {}), Ct = /* @__PURE__ */ ((a) => (a.DEFAULT = "BentoModalDefault", a.DIALOG = "BentoModalDialog", a))(Ct || {}), G = /* @__PURE__ */ ((a) => (a.SMALL = "small", a.MEDIUM = "medium", a.LARGE = "large", a))(G || {}), E = /* @__PURE__ */ ((a) => (a.SMALLER = "smaller", a.EQUAL = "equal", a.BIGGER = "bigger", a))(E || {}), F = /* @__PURE__ */ ((a) => (a.DIALOG = "dialog", a.ALERT_DIALOG = "alertdialog", a))(F || {}), ht = /* @__PURE__ */ ((a) => (a.CONFIRMATION = "confirmation", a.DESTRUCTIVE = "destructive", a.INFO = "info", a.ACKNOWLEDGEMENT = "acknowledgement", a))(ht || {}), At = /* @__PURE__ */ ((a) => (a.CLOSE_MODAL = "close-modal", a))(At || {});
|
|
@@ -26,110 +26,47 @@ const Lt = {
|
|
|
26
26
|
"pt-BR": {
|
|
27
27
|
close: "Fechar"
|
|
28
28
|
}
|
|
29
|
-
}, j = Symbol("modal config data injection key"), bt = T({}),
|
|
29
|
+
}, j = Symbol("modal config data injection key"), bt = T({}), Pt = /* @__PURE__ */ T({
|
|
30
30
|
...bt,
|
|
31
31
|
__name: "modal-page",
|
|
32
32
|
props: {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
* But you may change the color of 1-st action to red with 'critial' key
|
|
38
|
-
* Not more than 3 action buttons can be provided
|
|
39
|
-
* Or 2 action buttons and 1 Label for them
|
|
40
|
-
*
|
|
41
|
-
* Each object in the list should have a `title`, an `event` and
|
|
42
|
-
* (optional) a Vue `icon` from the library `@adyen/ui-assets-icons-16`.
|
|
43
|
-
*
|
|
44
|
-
* `title`: Button's text.
|
|
45
|
-
*
|
|
46
|
-
* `event`: Event triggered when clicking the Button.
|
|
47
|
-
*
|
|
48
|
-
* `icon`: Vue Icon from the library `@adyen/ui-assets-icons-16`.
|
|
49
|
-
*
|
|
50
|
-
* ```
|
|
51
|
-
* [{
|
|
52
|
-
* title: 'Primary',2
|
|
53
|
-
* event: () => { ... },
|
|
54
|
-
* icon: FourPeopleIcon
|
|
55
|
-
* }, {
|
|
56
|
-
* title: 'Secondary',
|
|
57
|
-
* event: () => { ... }
|
|
58
|
-
* }]
|
|
59
|
-
* ```
|
|
60
|
-
*/
|
|
61
|
-
actions: {
|
|
62
|
-
type: Array,
|
|
63
|
-
default: null
|
|
64
|
-
},
|
|
65
|
-
/**
|
|
66
|
-
* Text label that is displayed left to the action buttons
|
|
67
|
-
*/
|
|
68
|
-
actionsLabel: { type: String, default: null },
|
|
69
|
-
/**
|
|
70
|
-
* 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.
|
|
71
|
-
*/
|
|
72
|
-
columnsSize: {
|
|
73
|
-
type: String,
|
|
74
|
-
default: E.SMALLER
|
|
75
|
-
},
|
|
76
|
-
/**
|
|
77
|
-
* If provided, manages the padding of the whole modal container
|
|
78
|
-
*/
|
|
79
|
-
customPadding: { type: String, default: null },
|
|
80
|
-
/**
|
|
81
|
-
* If passed - sets first button color to red
|
|
82
|
-
*/
|
|
33
|
+
actions: { default: null },
|
|
34
|
+
actionsLabel: { default: null },
|
|
35
|
+
columnsSize: { default: E.SMALLER },
|
|
36
|
+
customPadding: { default: null },
|
|
83
37
|
destructiveActions: { type: Boolean, default: !1 },
|
|
84
|
-
/**
|
|
85
|
-
* If provided, renders the modal's content in a two-column layout an wth dividers separating its content
|
|
86
|
-
*/
|
|
87
38
|
withColumnLayout: { type: Boolean, default: !1 },
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
*/
|
|
91
|
-
pageId: {
|
|
92
|
-
type: String,
|
|
93
|
-
default: void 0
|
|
94
|
-
},
|
|
95
|
-
/**
|
|
96
|
-
* ID of the page for the back button to navigate to. Only use it to overwrite the default back behavior
|
|
97
|
-
* Used when the back button should not take the user to the natural previous page
|
|
98
|
-
* Set to `null` to hide back button in the page
|
|
99
|
-
*/
|
|
100
|
-
previousPage: {
|
|
101
|
-
type: String,
|
|
102
|
-
default: void 0
|
|
103
|
-
}
|
|
39
|
+
pageId: { default: void 0 },
|
|
40
|
+
previousPage: { default: void 0 }
|
|
104
41
|
},
|
|
105
42
|
setup(a) {
|
|
106
|
-
const e = a, o = 26, t = Y(), n = q(t),
|
|
43
|
+
const e = a, o = 26, t = Y(), n = q(t), r = c(null), O = l(() => ({
|
|
107
44
|
"b-modal-page--custom-padding": e.customPadding
|
|
108
45
|
})), I = l(() => {
|
|
109
|
-
var
|
|
46
|
+
var u;
|
|
110
47
|
return {
|
|
111
48
|
"b-modal-page__content--with-header": n("default"),
|
|
112
|
-
"b-modal-page__content--with-actions": n("actions") || ((
|
|
49
|
+
"b-modal-page__content--with-actions": n("actions") || ((u = e.actions) == null ? void 0 : u.length)
|
|
113
50
|
};
|
|
114
51
|
}), R = l(() => {
|
|
115
52
|
if (!e.customPadding)
|
|
116
53
|
return {};
|
|
117
|
-
const
|
|
54
|
+
const u = {
|
|
118
55
|
paddingLeft: e.customPadding,
|
|
119
56
|
paddingRight: e.customPadding
|
|
120
|
-
}, i = { ...
|
|
57
|
+
}, i = { ...u, paddingTop: void 0, paddingBottom: void 0 };
|
|
121
58
|
return n("default") || (i.paddingTop = e.customPadding), n("actions") || (i.paddingBottom = e.customPadding), {
|
|
122
59
|
header: {
|
|
123
|
-
...
|
|
60
|
+
...u,
|
|
124
61
|
paddingTop: e.customPadding,
|
|
125
62
|
paddingRight: `${parseInt(e.customPadding, 10) + o}px`,
|
|
126
63
|
flex: 1
|
|
127
64
|
},
|
|
128
65
|
content: i,
|
|
129
|
-
actions: { ...
|
|
66
|
+
actions: { ...u, paddingBottom: e.customPadding },
|
|
130
67
|
backButton: { top: e.customPadding, paddingLeft: e.customPadding }
|
|
131
68
|
};
|
|
132
|
-
}), d = l(() => e.withColumnLayout && L.value === G.LARGE),
|
|
69
|
+
}), d = l(() => e.withColumnLayout && L.value === G.LARGE), f = l(() => e.columnsSize === E.SMALLER ? [
|
|
133
70
|
{ small: 4, medium: 4, large: 4 },
|
|
134
71
|
{ small: 8, medium: 8, large: 8 }
|
|
135
72
|
] : e.columnsSize === E.BIGGER ? [
|
|
@@ -138,28 +75,28 @@ const Lt = {
|
|
|
138
75
|
] : [
|
|
139
76
|
{ small: 6, medium: 6, large: 6 },
|
|
140
77
|
{ small: 6, medium: 6, large: 6 }
|
|
141
|
-
]), { activePage:
|
|
78
|
+
]), { activePage: g, height: _, isAnimationActive: m, pageCustomPadding: B, showCloseButton: x, size: L } = Q(j), h = l(() => g.value === e.pageId || !g.value);
|
|
142
79
|
let p = null;
|
|
143
80
|
return w(
|
|
144
|
-
() =>
|
|
145
|
-
async (
|
|
81
|
+
() => g.value,
|
|
82
|
+
async (u, i) => {
|
|
146
83
|
var A, k;
|
|
147
|
-
h.value && (await X(), _.value = `${(k = (A =
|
|
148
|
-
var v,
|
|
149
|
-
const b = `${(
|
|
84
|
+
h.value && (await X(), _.value = `${(k = (A = r.value) == null ? void 0 : A.$el) == null ? void 0 : k.clientHeight}px`, B.value = e.customPadding, m.value = i !== void 0, p = ft(r.value, () => {
|
|
85
|
+
var v, P;
|
|
86
|
+
const b = `${(P = (v = r.value) == null ? void 0 : v.$el) == null ? void 0 : P.clientHeight}px`;
|
|
150
87
|
b && b !== _.value && (_.value = b);
|
|
151
88
|
}));
|
|
152
89
|
},
|
|
153
90
|
{ immediate: !0 }
|
|
154
91
|
), Z(() => {
|
|
155
92
|
p == null || p.disconnect();
|
|
156
|
-
}), { __sfc: !0, CLOSE_BUTTON_ICON_WIDTH: o, slots: t, hasSlot: n, page:
|
|
93
|
+
}), { __sfc: !0, CLOSE_BUTTON_ICON_WIDTH: o, slots: t, hasSlot: n, page: r, props: e, modalPageConditionalClasses: O, modalContentConditionalClasses: I, customPaddingStyles: R, hasColumnLayout: d, computedColumnWidth: f, activePage: g, height: _, isAnimationActive: m, pageCustomPadding: B, showCloseButton: x, size: L, isCurrentPage: h, pageElementObserver: p, BentoTypography: mt, GridLayout: _t, GridLayoutContainerType: gt, FooterActions: pt, DialogPage: ut };
|
|
157
94
|
}
|
|
158
95
|
});
|
|
159
|
-
var
|
|
96
|
+
var St = function() {
|
|
160
97
|
var n;
|
|
161
98
|
var e = this, o = e._self._c, t = e._self._setupProxy;
|
|
162
|
-
return o(t.DialogPage, { ref: "page", staticClass: "b-modal-page", class: t.modalPageConditionalClasses, attrs: { "page-id": e.pageId, "always-show-border": t.hasColumnLayout, "back-button-styling": (n = t.customPaddingStyles) == null ? void 0 : n.backButton, "previous-page": e.previousPage }, on: { animationend: function(
|
|
99
|
+
return o(t.DialogPage, { ref: "page", staticClass: "b-modal-page", class: t.modalPageConditionalClasses, attrs: { "page-id": e.pageId, "always-show-border": t.hasColumnLayout, "back-button-styling": (n = t.customPaddingStyles) == null ? void 0 : n.backButton, "previous-page": e.previousPage }, on: { animationend: function(r) {
|
|
163
100
|
t.isAnimationActive = !1;
|
|
164
101
|
} }, scopedSlots: e._u([t.hasSlot("default") || t.showCloseButton ? { key: "header", fn: function() {
|
|
165
102
|
return [o("div", { staticClass: "b-modal-page__header-container", style: t.customPaddingStyles.header }, [o("div", { staticClass: "b-modal-page__header" }, [o(t.BentoTypography, { staticClass: "b-modal-page__title", attrs: { el: "span", variant: "title", stronger: "" } }, [t.hasSlot("default") ? e._t("default") : e._e()], 2)], 1)])];
|
|
@@ -175,12 +112,12 @@ var Pt = function() {
|
|
|
175
112
|
return [o("div", { staticClass: "b-modal-page__actions-container", style: t.customPaddingStyles.actions }, [o(t.FooterActions, { attrs: { actions: e.actions, "actions-label": e.actionsLabel, "destructive-actions": e.destructiveActions } })], 1)];
|
|
176
113
|
}, proxy: !0 } : null], null, !0) });
|
|
177
114
|
}, Et = [], Ot = /* @__PURE__ */ W(
|
|
178
|
-
St,
|
|
179
115
|
Pt,
|
|
116
|
+
St,
|
|
180
117
|
Et,
|
|
181
118
|
!1,
|
|
182
119
|
null,
|
|
183
|
-
"
|
|
120
|
+
"8cb6e769"
|
|
184
121
|
);
|
|
185
122
|
const It = Ot.exports, Bt = T({
|
|
186
123
|
i18n: { messages: Lt },
|
|
@@ -277,21 +214,21 @@ const It = Ot.exports, Bt = T({
|
|
|
277
214
|
},
|
|
278
215
|
emits: ["update:active-page", "close-modal"],
|
|
279
216
|
setup(a, { expose: e, emit: o }) {
|
|
280
|
-
const t = a, n = 500, { t:
|
|
217
|
+
const t = a, n = 500, { t: r } = nt(), O = Y(), I = V(), R = q(O), d = c(null), f = c(!1), g = lt("modal"), _ = l(() => t.isDismissible && !t.hideCloseButton), m = c(t.customPadding), B = l(() => m.value ? { top: m.value, right: m.value } : {}), x = l(() => I["aria-label"] ?? r("ariaLabelFallback")), L = l(() => t.withColumnLayout && t.size === G.LARGE), h = () => {
|
|
281
218
|
d.value.showModal();
|
|
282
219
|
}, p = () => {
|
|
283
220
|
o("close-modal");
|
|
284
|
-
},
|
|
285
|
-
|
|
221
|
+
}, u = () => {
|
|
222
|
+
f.value && (d.value.close(), y.value[0] && o("update:active-page", y.value[0]), y.value = [], f.value = !1, p());
|
|
286
223
|
}, i = () => {
|
|
287
|
-
d.value.open && (
|
|
224
|
+
d.value.open && (f.value = !0);
|
|
288
225
|
}, A = (s) => {
|
|
289
226
|
s && s.preventDefault(), !(!t.isDismissible && t.modalRole === F.DIALOG) && i();
|
|
290
227
|
}, k = () => {
|
|
291
228
|
t.isDismissible && A();
|
|
292
229
|
}, b = l(() => ({
|
|
293
230
|
[`b-modal-base__container--${t.size}`]: t.size,
|
|
294
|
-
"b-modal-base__container--hide":
|
|
231
|
+
"b-modal-base__container--hide": f.value,
|
|
295
232
|
"b-modal-base__container--column-layout": L.value,
|
|
296
233
|
"b-modal-base__container--animation": M.value
|
|
297
234
|
}));
|
|
@@ -313,11 +250,11 @@ const It = Ot.exports, Bt = T({
|
|
|
313
250
|
t.isOpen && d.value && h();
|
|
314
251
|
}), e({
|
|
315
252
|
internalModalActionClose: A
|
|
316
|
-
}), D(st,
|
|
317
|
-
const { activePage: v, isOpen:
|
|
253
|
+
}), D(st, g);
|
|
254
|
+
const { activePage: v, isOpen: P, size: z } = tt(t), U = c(ct.TRANSITION_LEVEL_DEEPER), S = c([]), y = c([]), $ = (s) => o("update:active-page", s), H = (s) => () => {
|
|
318
255
|
var C;
|
|
319
|
-
|
|
320
|
-
}, J = (s) => (s &&
|
|
256
|
+
S.value = (C = S.value) == null ? void 0 : C.filter((N) => N !== s);
|
|
257
|
+
}, J = (s) => (s && S.value.push(s), { unregisterPage: H(s) }), K = c(""), M = c(!1);
|
|
321
258
|
return D(j, {
|
|
322
259
|
activePage: v,
|
|
323
260
|
height: K,
|
|
@@ -325,14 +262,14 @@ const It = Ot.exports, Bt = T({
|
|
|
325
262
|
pageCustomPadding: m,
|
|
326
263
|
showCloseButton: _,
|
|
327
264
|
size: z
|
|
328
|
-
}), D(
|
|
265
|
+
}), D(rt, {
|
|
329
266
|
activePage: v,
|
|
330
267
|
animation: U,
|
|
331
|
-
isOpen:
|
|
332
|
-
pages:
|
|
268
|
+
isOpen: P,
|
|
269
|
+
pages: S,
|
|
333
270
|
previousPages: y,
|
|
334
271
|
updatePage: $
|
|
335
|
-
}), D(
|
|
272
|
+
}), D(dt, J), { __sfc: !0, LOADING_BTN_CLOSE_AFTER_SUCCESS_DELAY_TIME: n, t: r, slots: O, attrs: I, hasSlot: R, modal: d, isClosing: f, modalId: g, emit: o, props: t, showCloseButton: _, pageCustomPadding: m, customPaddingStyles: B, computedAriaLabel: x, hasColumnLayout: L, openModal: h, emitCloseEvent: p, closeModalAfterAnimation: u, startCloseModalAnimation: i, internalModalActionClose: A, closeModalOnClickOutside: k, modalConditionalClasses: b, activePage: v, isOpen: P, size: z, animation: U, pages: S, previousPages: y, updatePage: $, unregisterPage: H, registerPage: J, height: K, isAnimationActive: M, BentoButton: at, BentoFocusTrap: ot, vBentoClickOutsideDirective: vt, BentoModalPage: It, CrossIcon: it };
|
|
336
273
|
}
|
|
337
274
|
});
|
|
338
275
|
var Dt = function() {
|
|
@@ -360,14 +297,14 @@ var Dt = function() {
|
|
|
360
297
|
);
|
|
361
298
|
const Qt = Tt.exports;
|
|
362
299
|
export {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
300
|
+
yt as B,
|
|
301
|
+
Ct as a,
|
|
302
|
+
G as b,
|
|
303
|
+
E as c,
|
|
304
|
+
F as d,
|
|
305
|
+
ht as e,
|
|
306
|
+
At as f,
|
|
307
|
+
It as g,
|
|
371
308
|
Qt as h
|
|
372
309
|
};
|
|
373
|
-
//# sourceMappingURL=base-modal.
|
|
310
|
+
//# sourceMappingURL=base-modal.CkkfT6r6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-modal.CkkfT6r6.js","sources":["../../src/components/modal/modal.types.ts","../../src/components/modal/modal.keys.ts","../../src/components/modal/components/modal-page/modal-page.vue","../../src/components/modal/components/base-modal/base-modal.vue"],"sourcesContent":["import { ComputedRef, Ref } from 'vue';\n\n/**\n * Public\n */\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoModalVariant {\n DEFAULT = 'default',\n DIALOG = 'dialog',\n}\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoModalVariantMapping {\n DEFAULT = 'BentoModalDefault',\n DIALOG = 'BentoModalDialog',\n}\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoModalSize {\n SMALL = 'small',\n MEDIUM = 'medium',\n LARGE = 'large',\n}\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoModalColumnLayoutVariant {\n SMALLER = 'smaller',\n EQUAL = 'equal',\n BIGGER = 'bigger',\n}\n\nexport enum BentoModalRole {\n DIALOG = 'dialog',\n ALERT_DIALOG = 'alertdialog',\n}\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoModalDialogType {\n CONFIRMATION = 'confirmation',\n DESTRUCTIVE = 'destructive',\n INFO = 'info',\n ACKNOWLEDGEMENT = 'acknowledgement',\n}\n\nexport enum BentoModalEvent {\n CLOSE_MODAL = 'close-modal',\n}\n\n/**\n * Private\n */\nexport interface BentoModalConfigData {\n activePage: Ref<string>;\n height: Ref<string>;\n isAnimationActive: Ref<boolean>;\n pageCustomPadding: Ref<string>;\n showCloseButton: ComputedRef<boolean>;\n size: Ref<BentoModalSize | `${BentoModalSize}`>;\n}\n","export const MODAL_CONFIG_INJECTION_KEY = Symbol('modal config data injection key');\n","<template>\n <dialog-page\n ref=\"page\"\n class=\"b-modal-page\"\n :class=\"modalPageConditionalClasses\"\n :page-id=\"pageId\"\n :always-show-border=\"hasColumnLayout\"\n :back-button-styling=\"customPaddingStyles?.backButton\"\n :previous-page=\"previousPage\"\n @animationend=\"isAnimationActive = false\"\n >\n <template v-if=\"hasSlot('default') || showCloseButton\" #header>\n <div class=\"b-modal-page__header-container\" :style=\"customPaddingStyles.header\">\n <div class=\"b-modal-page__header\">\n <bento-typography class=\"b-modal-page__title\" el=\"span\" variant=\"title\" stronger>\n <slot v-if=\"hasSlot('default')\" />\n </bento-typography>\n </div>\n </div>\n </template>\n\n <template #content>\n <div\n class=\"b-modal-page__content\"\n :class=\"modalContentConditionalClasses\"\n :style=\"customPaddingStyles.content\"\n >\n <bento-typography\n v-if=\"hasSlot('content') || (hasSlot('content-col-1') && hasSlot('content-col-2'))\"\n el=\"div\"\n >\n <grid-layout\n v-if=\"hasColumnLayout\"\n :column-width=\"computedColumnWidth\"\n :container-type=\"GridLayoutContainerType.NORMAL\"\n no-gap\n class=\"b-modal-page__grid\"\n >\n <template #col-1><slot name=\"content-col-1\"></slot></template>\n <template #col-2><slot name=\"content-col-2\"></slot></template>\n </grid-layout>\n <slot v-else name=\"content\" />\n </bento-typography>\n </div>\n </template>\n <template v-if=\"hasSlot('actions')\" #footer>\n <div class=\"b-modal-page__actions-container\" :style=\"customPaddingStyles.actions\">\n <div aria-label=\"modal actions\" class=\"b-modal-page__actions\">\n <slot name=\"actions\" />\n </div>\n </div>\n </template>\n <template v-else-if=\"actions && actions.length > 0\" #footer>\n <div class=\"b-modal-page__actions-container\" :style=\"customPaddingStyles.actions\">\n <footer-actions\n :actions=\"actions\"\n :actions-label=\"actionsLabel\"\n :destructive-actions=\"destructiveActions\"\n />\n </div>\n </template>\n </dialog-page>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, defineComponent, inject, nextTick, onUnmounted, ref, useSlots, watch } from 'vue';\n import {\n BentoModalColumnLayoutVariant,\n BentoModalConfigData,\n BentoModalSize,\n } from '@/components/modal/modal.types';\n import { BentoTypography } from '@/components/typography';\n import { GridLayout, GridLayoutContainerType } from '@/internal';\n import { useHasSlot } from '@/composables';\n\n import { FooterActions } from '@/components/internal/footer-actions';\n\n import DialogPage from '@/internal/dialog-page/dialog-page.vue';\n import { MODAL_CONFIG_INJECTION_KEY } from '../../modal.keys';\n import { observeSizeOfElement } from '@/utils/ts/resize';\n import type { BentoModalPageProps } from './modal-page.types';\n\n const CLOSE_BUTTON_ICON_WIDTH = 26;\n\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n const page = ref<InstanceType<typeof DialogPage>>(null);\n\n const props = defineProps({\n actions: { default: null },\n actionsLabel: { default: null },\n columnsSize: { default: BentoModalColumnLayoutVariant.SMALLER },\n customPadding: { default: null },\n destructiveActions: { type: Boolean, default: false },\n withColumnLayout: { type: Boolean, default: false },\n pageId: { default: undefined },\n previousPage: { default: undefined }\n});\n\n const modalPageConditionalClasses = computed(() => ({\n 'b-modal-page--custom-padding': props.customPadding,\n }));\n\n const modalContentConditionalClasses = computed(() => ({\n 'b-modal-page__content--with-header': hasSlot('default'),\n 'b-modal-page__content--with-actions': hasSlot('actions') || props.actions?.length,\n }));\n\n // Setting custom padding styles\n const customPaddingStyles = computed(() => {\n if (!props.customPadding) {\n return {};\n }\n\n const xPadding = {\n paddingLeft: props.customPadding,\n paddingRight: props.customPadding,\n };\n\n const content = { ...xPadding, paddingTop: undefined, paddingBottom: undefined };\n\n if (!hasSlot('default')) {\n content.paddingTop = props.customPadding;\n }\n\n if (!hasSlot('actions')) {\n content.paddingBottom = props.customPadding;\n }\n\n return {\n header: {\n ...xPadding,\n paddingTop: props.customPadding,\n paddingRight: `${parseInt(props.customPadding, 10) + CLOSE_BUTTON_ICON_WIDTH}px`,\n flex: 1,\n },\n content,\n actions: { ...xPadding, paddingBottom: props.customPadding },\n backButton: { top: props.customPadding, paddingLeft: props.customPadding },\n };\n });\n\n // Column layout styles\n const hasColumnLayout = computed(() => props.withColumnLayout && size.value === BentoModalSize.LARGE);\n\n const computedColumnWidth = computed(() => {\n if (props.columnsSize === BentoModalColumnLayoutVariant.SMALLER) {\n return [\n { small: 4, medium: 4, large: 4 },\n { small: 8, medium: 8, large: 8 },\n ];\n }\n if (props.columnsSize === BentoModalColumnLayoutVariant.BIGGER) {\n return [\n { small: 8, medium: 8, large: 8 },\n { small: 4, medium: 4, large: 4 },\n ];\n }\n return [\n { small: 6, medium: 6, large: 6 },\n { small: 6, medium: 6, large: 6 },\n ];\n });\n\n // Register page to parent component and inject data from parent component\n const { activePage, height, isAnimationActive, pageCustomPadding, showCloseButton, size } =\n inject<BentoModalConfigData>(MODAL_CONFIG_INJECTION_KEY);\n\n const isCurrentPage = computed(() => activePage.value === props.pageId || !activePage.value);\n\n // Animation\n // Set resize observer on mount of update the height of the dialog on resize\n let pageElementObserver: ResizeObserver | null = null;\n\n // Watching activePage changes to set the height of the page and set isAnimationActive\n watch(\n () => activePage.value,\n async (value, oldValue) => {\n if (isCurrentPage.value) {\n await nextTick();\n height.value = `${page.value?.$el?.clientHeight}px`;\n pageCustomPadding.value = props.customPadding;\n // only set isAnimationActive to true if its going from two different pages and not from null to the first page\n isAnimationActive.value = oldValue !== undefined;\n\n pageElementObserver = observeSizeOfElement(page.value, () => {\n const pageHeight = `${page.value?.$el?.clientHeight}px`;\n if (pageHeight && pageHeight !== height.value) {\n height.value = pageHeight;\n }\n });\n }\n },\n { immediate: true }\n );\n\n // Disconnect observer on unmounting the page\n onUnmounted(() => {\n pageElementObserver?.disconnect();\n });\n</script>\n\n<script lang=\"ts\">\n /**\n * ModalPage is used to render different pages of the Modal component\n *\n * @example\n * import { BentoModal, BentoModalPage } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoModal, BentoModalPage },\n * template: `\n * <bento-modal active-page='page1' :is-open='true'>\n * <bento-modal-page\n * pageId='page1'\n * actions-label='Move to next page'\n * :actions=\"[\n * {\n * title: 'Next page',\n * event: () => {\n * activePage.value = 'page2';\n * },\n * }]\">\n * Page 1\n * <template #content>\n * Page 1 content\n * </template>\n * </bento-modal-page>\n * <bento-modal-page\n * pageId='page2'\n * :actions=\"[\n * {\n * title: 'Save',\n * event: () => {},\n * }]\">\n * Page 2\n * <template #content>\n * Page 2 content\n * </template>\n * </bento-modal-page>\n * </bento-modal>\n * `\n * }\n */\n export default defineComponent({});\n</script>\n\n<style lang=\"scss\" scoped src=\"./modal-page.scss\" />\n","<template>\n <div class=\"b-modal-base\">\n <dialog\n ref=\"modal\"\n :role=\"modalRole\"\n :aria-label=\"computedAriaLabel\"\n :style=\"{ height: height }\"\n class=\"b-modal-base__container\"\n :class=\"modalConditionalClasses\"\n :open=\"initiallyOpen\"\n @animationend=\"closeModalAfterAnimation\"\n @keydown.esc=\"internalModalActionClose\"\n >\n <bento-focus-trap\n v-if=\"isOpen || initiallyOpen\"\n :id=\"modalId\"\n v-bento-click-outside-directive=\"closeModalOnClickOutside\"\n >\n <bento-button\n v-if=\"showCloseButton\"\n class=\"b-modal-base__close-button\"\n variant=\"tertiary\"\n type=\"button\"\n :style=\"customPaddingStyles\"\n @click=\"internalModalActionClose\"\n >\n <cross-icon :svg-title=\"t('close')\" />\n </bento-button>\n <template v-if=\"props.activePage\">\n <slot />\n </template>\n <bento-modal-page\n v-else\n :with-column-layout=\"withColumnLayout\"\n :size=\"size\"\n :custom-padding=\"customPadding\"\n :columns-size=\"columnsSize\"\n >\n <template v-if=\"hasSlot('default')\" #default>\n <slot></slot>\n </template>\n <template v-if=\"hasSlot('content-col-1')\" #content-col-1\n ><slot name=\"content-col-1\"></slot\n ></template>\n <template v-if=\"hasSlot('content-col-2')\" #content-col-2\n ><slot name=\"content-col-2\"></slot\n ></template>\n <template v-if=\"hasSlot('content')\" #content><slot name=\"content\"></slot></template>\n <template v-if=\"hasSlot('actions')\" #actions><slot name=\"actions\"></slot></template>\n </bento-modal-page>\n </bento-focus-trap>\n </dialog>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import {\n computed,\n defineComponent,\n onMounted,\n PropType,\n provide,\n ref,\n toRefs,\n useAttrs,\n useSlots,\n watch,\n } from 'vue';\n import {\n BentoModalColumnLayoutVariant,\n BentoModalConfigData,\n BentoModalRole,\n BentoModalSize,\n } from '@/components/modal/modal.types';\n import { BentoButton, BentoButtonActionsList } from '@/components/button';\n import { BentoFocusTrap } from '@/components/focus-trap';\n import { useHasSlot } from '@/composables';\n import { useI18n } from '@/utils/ts/i18n';\n import { MODAL_DIALOG_ID_INJECTION_KEY } from '@/components/modal/components/base-modal/base-modal.keys';\n import { generateUid } from '@/core/utils/ts';\n import { BentoClickOutsideDirective as vBentoClickOutsideDirective } from '@/directives/click-outside';\n import messages from './messages.json';\n\n import { BentoModalPage } from '@/components/modal';\n import CrossIcon from '@adyen/ui-assets-icons-16/vue/cross';\n\n import { MODAL_CONFIG_INJECTION_KEY } from '../../modal.keys';\n import {\n BentoDialogPageAnimation,\n BentoDialogPageConfigData,\n BentoDialogPageRegisterPage,\n DIALOG_PAGE_CONFIG_INJECTION_KEY,\n DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY,\n } from '@/internal';\n\n type MessageSchema = (typeof messages)['en-US'];\n const LOADING_BTN_CLOSE_AFTER_SUCCESS_DELAY_TIME = 500;\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const slots = useSlots();\n const attrs = useAttrs();\n const hasSlot = useHasSlot(slots);\n const modal = ref<HTMLDialogElement>(null);\n const isClosing = ref(false);\n const modalId = generateUid('modal');\n\n const emit = defineEmits([\"update:active-page\", \"close-modal\"]);\n\n const props = defineProps({\n /**\n * List of actions that will be used to render the buttons.\n * First element in the list will be rendered as \"primary\".\n * All elements after the first will be rendered as \"secondary\".\n * But you may change the color of 1-st action to red with 'critial' key\n * Not more than 3 action buttons can be provided\n * Or 2 action buttons and 1 Label for them\n *\n * Each object in the list should have a `title`, an `event` and\n * (optional) a Vue `icon` from the library `@adyen/ui-assets-icons-16`.\n *\n * `title`: Button's text.\n *\n * `event`: Event triggered when clicking the Button.\n *\n * `icon`: Vue Icon from the library `@adyen/ui-assets-icons-16`.\n *\n * ```\n * [{\n * title: 'Primary',2\n * event: () => { ... },\n * icon: FourPeopleIcon\n * }, {\n * title: 'Secondary',\n * event: () => { ... }\n * }]\n * ```\n */\n actions: {\n type: Array as PropType<BentoButtonActionsList>,\n default: null,\n },\n\n /**\n * The id of the current active page\n * Should be the same id as the BentoModalPage to be displayed\n */\n activePage: {\n type: String,\n default: null,\n },\n\n /**\n * 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.\n */\n columnsSize: {\n type: String as PropType<BentoModalColumnLayoutVariant>,\n default: BentoModalColumnLayoutVariant.SMALLER,\n },\n\n /**\n * If provided, manages the padding of the whole modal container\n */\n customPadding: { type: String, default: null },\n\n /**\n * If passed - sets first button color to red\n */\n destructiveActions: { type: Boolean, default: false },\n\n /**\n * Hides a cross icon on the right side of the title\n */\n hideCloseButton: { type: Boolean, required: true },\n\n /**\n * Sets the open attribute on the dialog element, use isOpen instead to toggle modal visbility.\n */\n initiallyOpen: { type: Boolean, default: false },\n\n /**\n * If set to true, it allows the modal to be closed by clicking outside of it\n */\n isDismissible: { type: Boolean, required: true },\n\n /**\n * Controls the modal's state from the outside. Set it to true to open the modal\n */\n isOpen: { type: Boolean, required: true },\n\n /**\n * Defines whether the modal will be an alert modal\n */\n modalRole: { type: String, default: BentoModalRole.DIALOG },\n\n /**\n * Sets the width of the modal\n */\n size: {\n type: String as PropType<BentoModalSize | `${BentoModalSize}`>,\n default: BentoModalSize.SMALL,\n },\n\n /**\n * If provided, renders the modal's content in a two-column layout an wth dividers separating its content\n */\n withColumnLayout: { type: Boolean, default: false },\n });\n\n const showCloseButton = computed(() => props.isDismissible && !props.hideCloseButton);\n\n const pageCustomPadding = ref(props.customPadding);\n\n const customPaddingStyles = computed(() => {\n if (!pageCustomPadding.value) {\n return {};\n }\n\n return { top: pageCustomPadding.value, right: pageCustomPadding.value };\n });\n\n const computedAriaLabel = computed(() => (attrs['aria-label'] as string) ?? (t('ariaLabelFallback') as string));\n const hasColumnLayout = computed(() => props.withColumnLayout && props.size === BentoModalSize.LARGE);\n\n const openModal = (): void => {\n modal.value.showModal();\n };\n\n const emitCloseEvent = (): void => {\n emit('close-modal');\n };\n\n // Handle closing and closing animation for dialog element\n const closeModalAfterAnimation = () => {\n if (isClosing.value) {\n modal.value.close();\n if (previousPages.value[0]) {\n emit('update:active-page', previousPages.value[0]);\n }\n previousPages.value = [];\n isClosing.value = false;\n emitCloseEvent();\n }\n };\n\n const startCloseModalAnimation = () => {\n if (!modal.value.open) {\n return;\n }\n isClosing.value = true;\n };\n\n /**\n * If the user has pressed escape, clicked outside or clicked the close icon.\n * Needs to be called from outside, following the \"dialog.close()\" pattern,\n * when the closing event is triggered outside of the \"base-modal\"\n * component (e.g. from a closing action).\n */\n const internalModalActionClose = (event?: Event) => {\n if (event) {\n event.preventDefault();\n }\n if (!props.isDismissible && props.modalRole === BentoModalRole.DIALOG) {\n return;\n }\n startCloseModalAnimation();\n };\n\n const closeModalOnClickOutside = () => {\n if (props.isDismissible) {\n internalModalActionClose();\n }\n };\n\n const modalConditionalClasses = computed(() => ({\n [`b-modal-base__container--${props.size}`]: props.size,\n 'b-modal-base__container--hide': isClosing.value,\n 'b-modal-base__container--column-layout': hasColumnLayout.value,\n 'b-modal-base__container--animation': isAnimationActive.value,\n }));\n\n watch(\n () => [props.isOpen, modal.value],\n ([newIsOpen, newModalValue], [, oldModalValue]): void => {\n if (!newModalValue) {\n return;\n }\n\n const isFirstMutation = !oldModalValue;\n if (newIsOpen) {\n openModal();\n // add the first page to the array when the modal opens\n if (!previousPages.value.length) {\n previousPages.value.push(activePage.value);\n }\n } else if (!isFirstMutation) {\n startCloseModalAnimation();\n }\n }\n );\n\n // If the first button is a loading button then close the modal have 0.5 seconds\n // if the state is changed to 'success'.\n watch(\n () => props.actions,\n () => {\n if (props.actions?.[0]?.state === 'success') {\n setTimeout(startCloseModalAnimation, LOADING_BTN_CLOSE_AFTER_SUCCESS_DELAY_TIME);\n }\n },\n { deep: true }\n );\n\n onMounted(() => {\n if (props.isOpen && modal.value) {\n openModal();\n }\n });\n\n /**\n * Expose methods through its 'ref'\n */\n defineExpose({\n internalModalActionClose,\n });\n\n // Let's Children components know they are inside a Modal (dialog element)\n provide(MODAL_DIALOG_ID_INJECTION_KEY, modalId);\n\n // Modal pagination\n const { activePage, isOpen, size } = toRefs(props);\n const animation = ref(BentoDialogPageAnimation.TRANSITION_LEVEL_DEEPER);\n\n const pages = ref<string[]>([]);\n const previousPages = ref([]);\n\n const updatePage = page => emit('update:active-page', page);\n\n // unregister page if removed / destroyed\n const unregisterPage = (pageIdToRemove: string) => () => {\n pages.value = pages.value?.filter(pageId => pageId !== pageIdToRemove);\n };\n\n // Provide data and function to register page to subcomponent\n const registerPage: BentoDialogPageRegisterPage = pageId => {\n if (pageId) {\n pages.value.push(pageId);\n }\n\n return { unregisterPage: unregisterPage(pageId) };\n };\n\n const height = ref('');\n const isAnimationActive = ref(false);\n\n provide<BentoModalConfigData>(MODAL_CONFIG_INJECTION_KEY, {\n activePage,\n height,\n isAnimationActive,\n pageCustomPadding,\n showCloseButton,\n size,\n });\n\n provide<BentoDialogPageConfigData>(DIALOG_PAGE_CONFIG_INJECTION_KEY, {\n activePage,\n animation,\n isOpen,\n pages,\n previousPages,\n updatePage,\n });\n\n provide(DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY, registerPage);\n</script>\n\n<script lang=\"ts\">\n /**\n * Dialog container. It creates a dialog HTML element for the modal to use.\n *\n * @example\n * import BaseModal from './components/base-modal/base-modal.vue';\n *\n * export default {\n * components: { BaseModal },\n * template: `\n * <base-modal\n * :hide-close-button=\"true\"\n * :is-dismissible=\"false\"\n * :is-open=\"isOpen\"\n * @close-modal=\"isOpen = false\"\n * >\n * <template #content-col-1>\n * // Content on the left side column\n * </template>\n *\n * <template #content-col-2>\n * // Content on the right side column\n * </template>\n *\n * <template v-if=\"actions\" #actions>\n * <footer-actions :actions=\"actions\" />\n * </template>\n * </base-modal>\n * `,\n * setup() {\n * const isOpen = ref(true)\n * const footerActions = [{\n * title: 'Primary action',\n * event: () => { ... }\n * }]\n * }\n * }\n */\n export default defineComponent({\n i18n: { messages },\n name: 'base-modal',\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./base-modal.scss\" />\n"],"names":["BentoModalVariant","BentoModalVariant2","BentoModalVariantMapping","BentoModalVariantMapping2","BentoModalSize","BentoModalSize2","BentoModalColumnLayoutVariant","BentoModalColumnLayoutVariant2","BentoModalRole","BentoModalRole2","BentoModalDialogType","BentoModalDialogType2","BentoModalEvent","BentoModalEvent2","MODAL_CONFIG_INJECTION_KEY","__default__$1","defineComponent","CLOSE_BUTTON_ICON_WIDTH","slots","useSlots","hasSlot","useHasSlot","page","ref","modalPageConditionalClasses","computed","props","modalContentConditionalClasses","_a","customPaddingStyles","xPadding","content","hasColumnLayout","size","computedColumnWidth","activePage","height","isAnimationActive","pageCustomPadding","showCloseButton","inject","isCurrentPage","pageElementObserver","watch","value","oldValue","nextTick","_b","observeSizeOfElement","pageHeight","onUnmounted","__default__","messages","LOADING_BTN_CLOSE_AFTER_SUCCESS_DELAY_TIME","t","useI18n","attrs","useAttrs","modal","isClosing","modalId","generateUid","computedAriaLabel","openModal","emitCloseEvent","emit","closeModalAfterAnimation","previousPages","startCloseModalAnimation","internalModalActionClose","event","closeModalOnClickOutside","modalConditionalClasses","newIsOpen","newModalValue","oldModalValue","onMounted","expose","provide","MODAL_DIALOG_ID_INJECTION_KEY","isOpen","toRefs","animation","BentoDialogPageAnimation","pages","updatePage","unregisterPage","pageIdToRemove","pageId","registerPage","DI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jE,WAAA+C;AAAA,MACA,QAAAF;AAAA,MACA,OAAAI;AAAA,MACA,eAAAjB;AAAA,MACA,YAAAkB;AAAA,IACA,CAAA,GAGJP,EAAAa,IAAAF,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/chunks/{button-actions-with-menu.itkbcqzk.js → button-actions-with-menu.CcxUTbsI.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ref as f, watch as A, nextTick as v, defineComponent as b, toRef as h, computed as _, provide as m } from "vue";
|
|
2
|
-
import { M as y, B } from "./menu.
|
|
3
|
-
import { f as w, B as C } from "./button-actions.
|
|
2
|
+
import { M as y, B } from "./menu.dX3_vU05.js";
|
|
3
|
+
import { f as w, B as C } from "./button-actions.Ju27CRNG.js";
|
|
4
4
|
import { u as M } from "./index.BdrLbvtJ.js";
|
|
5
5
|
import { n as N } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
|
|
6
6
|
import "../assets/button-actions-with-menu.css";
|
|
@@ -80,4 +80,4 @@ const U = k.exports;
|
|
|
80
80
|
export {
|
|
81
81
|
U as B
|
|
82
82
|
};
|
|
83
|
-
//# sourceMappingURL=button-actions-with-menu.
|
|
83
|
+
//# sourceMappingURL=button-actions-with-menu.CcxUTbsI.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-actions-with-menu.
|
|
1
|
+
{"version":3,"file":"button-actions-with-menu.CcxUTbsI.js","sources":["../../src/components/internal/button-actions-with-menu/composables/use-responsive-actions.ts","../../src/components/internal/button-actions-with-menu/button-actions-with-menu.vue"],"sourcesContent":["import { useWindowSize } from '@vueuse/core';\nimport { nextTick, Ref, ref, watch } from 'vue';\n\ninterface UseResponsiveActionsProps {\n breakpoint?: number;\n container: Ref<HTMLElement>;\n defaultActionsCount: number;\n offset?: Ref<HTMLElement>;\n}\n\nexport const useResponsiveActions = (props: UseResponsiveActionsProps) => {\n const { breakpoint, container, defaultActionsCount, offset } = props;\n\n const { width: windowWidth } = useWindowSize();\n\n const displayedActionsCount = ref<number>(defaultActionsCount);\n\n const AVERAGE_BUTTON_WIDTH = 150; // button size + gap\n\n const showActions = async () => {\n await nextTick();\n\n const availableSpace = container.value.clientWidth;\n const totalActionWidth =\n AVERAGE_BUTTON_WIDTH * displayedActionsCount.value +\n (offset?.value?.offsetWidth ?? 0) +\n AVERAGE_BUTTON_WIDTH;\n\n // Only add actions if there's enough space and we haven't reached max\n if (availableSpace >= totalActionWidth && displayedActionsCount.value < defaultActionsCount) {\n displayedActionsCount.value += 1;\n\n showActions(); // keep trying to show more\n }\n };\n\n const hideActions = async () => {\n await nextTick();\n\n const availableSpace = container.value.clientWidth;\n const totalActionWidth = AVERAGE_BUTTON_WIDTH * displayedActionsCount.value + (offset?.value?.offsetWidth ?? 0);\n\n // Hide actions if they overflow the container\n if (availableSpace < totalActionWidth && displayedActionsCount.value > 0) {\n displayedActionsCount.value -= 1;\n\n hideActions(); // keep hiding until it fits\n }\n };\n\n watch([windowWidth, container], async ([newWidth, containerEl], [oldWidth]) => {\n if (!containerEl || !defaultActionsCount || newWidth > breakpoint) {\n return;\n }\n\n await nextTick();\n\n const isIncreasing = newWidth > oldWidth;\n\n if (isIncreasing) {\n showActions();\n } else {\n hideActions();\n }\n });\n\n return {\n displayedActionsCount,\n };\n};\n","<template>\n <div class=\"b-button-actions-with-menu\">\n <div\n ref=\"buttonActionsWithMenu\"\n role=\"group\"\n class=\"b-button-actions-with-menu__container-wrapper\"\n :class=\"conditionalClasses\"\n >\n <bento-button-actions :actions=\"computedActions\" :inverse=\"inverse\" :layout=\"actionsLayout\" />\n <bento-menu\n v-if=\"computedMenuActions.length\"\n ref=\"menu\"\n :data=\"computedMenuActions\"\n :menu-position=\"menuPosition\"\n />\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { BentoButtonActions } from '@/components/button';\n import { BentoMenuItem } from '@/components/menu/components/menu-item/menu-item.types';\n import { MENU_INVERSE_INJECTION_KEY } from '@/components/menu/menu.keys';\n import BentoMenu from '@/components/menu/menu.vue';\n import { computed, provide, ref, toRef } from 'vue';\n import { BUTTON_ACTIONS_WITH_MENU_CONTAINER_INJECTION_KEY } from './button-actions-with-menu.keys';\n import { ButtonActionsWithMenuProps } from './button-actions-with-menu.types';\n import { useResponsiveActions } from './composables/use-responsive-actions';\n\n const props = defineProps({\n actions: null,\n actionsLayout: { default: 'buttons-end' },\n disableResponsiveBehavior: { type: Boolean, default: false },\n displayedActions: { default: undefined },\n inverse: { type: Boolean, default: false },\n hideDisplayedActionsBreakpoint: { default: 0 },\n menuPosition: { default: 'bottom-start' }\n});\n\n const inverseRef = toRef(props, 'inverse');\n const buttonActionsWithMenu = ref<HTMLDivElement>(null);\n const menu = ref(null);\n const stackButtons = ref(false);\n\n const computedActions = computed(() => {\n const displayedActionsLimit = props.hideDisplayedActionsBreakpoint\n ? displayedActionsCount.value\n : props.displayedActions;\n\n return props.actions.slice(0, displayedActionsLimit);\n });\n const computedMenuRef = computed(() => menu?.value?.$el);\n\n const { displayedActionsCount } = useResponsiveActions({\n breakpoint: props.hideDisplayedActionsBreakpoint,\n container: buttonActionsWithMenu,\n defaultActionsCount: props.displayedActions,\n offset: computedMenuRef,\n });\n\n provide(MENU_INVERSE_INJECTION_KEY, inverseRef);\n\n if (!props.disableResponsiveBehavior) {\n provide(BUTTON_ACTIONS_WITH_MENU_CONTAINER_INJECTION_KEY, { buttonActionsWithMenu, menu, stackButtons });\n }\n\n const conditionalClasses = computed(() => ({\n [`b-button-actions-with-menu__container-wrapper--buttons-end`]: props.actionsLayout === 'buttons-end',\n [`b-button-actions-with-menu__container-wrapper--buttons-start`]: props.actionsLayout === 'buttons-start',\n [`b-button-actions-with-menu__container-wrapper--stacked-buttons`]: stackButtons.value,\n }));\n\n const computedMenuActions = computed(() =>\n displayedActionsCount.value !== undefined && displayedActionsCount.value < props.actions.length\n ? (props.actions.slice(displayedActionsCount.value, props.actions.length).map(el => ({\n text: el.title,\n handler: el.event,\n icon: el.icon,\n critical: el.critical,\n disabled: el.disabled,\n })) as BentoMenuItem[])\n : []\n );\n</script>\n\n<script lang=\"ts\">\n /**\n * An internal button actions component with the option to display some of the actions in a menu.\n *\n * @example\n * <button-actions-with-menu\n * :actions=\"[\n * {\n * title: 'Primary',\n * event: () => { ... },\n * icon: FourPeopleIcon,\n * link: {\n * variant: 'default',\n * external: true,\n * to: 'https://www.adyen.com/'\n * },\n * },\n * {\n * title: 'Secondary',\n * event: () => { ... }\n * disabled: true,\n * variant: BentoButtonVariant.PRIMARY,\n * critical: true\n * }]\"\n * :displayedActions=\"2\"\n * />\n */\n export default {};\n</script>\n\n<style lang=\"scss\" scoped src=\"./button-actions-with-menu.scss\" />\n"],"names":["useResponsiveActions","props","breakpoint","container","defaultActionsCount","offset","windowWidth","useWindowSize","displayedActionsCount","ref","AVERAGE_BUTTON_WIDTH","showActions","nextTick","availableSpace","totalActionWidth","_a","hideActions","watch","newWidth","containerEl","oldWidth","__default__","inverseRef","toRef","buttonActionsWithMenu","menu","stackButtons","computedActions","computed","displayedActionsLimit","computedMenuRef","provide","MENU_INVERSE_INJECTION_KEY","BUTTON_ACTIONS_WITH_MENU_CONTAINER_INJECTION_KEY","conditionalClasses","computedMenuActions","el"],"mappings":";;;;;;AAUa,MAAAA,IAAA,CAAAC,MAAA;AACT,QAAA,EAAA,YAAAC,GAAA,WAAAC,GAAA,qBAAAC,GAAA,QAAAC,EAAA,IAAAJ,GAEA,EAAA,OAAAK,EAAA,IAAAC,EAAA,GAEAC,IAAAC,EAAAL,CAAA,GAEAM,IAAA,KAEAC,IAAA,YAAA;;AACI,UAAAC,EAAA;AAEA,UAAAC,IAAAV,EAAA,MAAA,aACAW,IAAAJ,IAAAF,EAAA,WAAAO,IAAAV,KAAA,gBAAAA,EAAA,UAAA,gBAAAU,EAAA,gBAAA,KAAAL;AAMA,IAAAG,KAAAC,KAAAN,EAAA,QAAAJ,MACII,EAAA,SAAA,GAEAG,EAAA;AAAA,EACJ,GAGJK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MAA2C,8DAAA3B,EAAA,kBAAA;AAAA,MACiD,gEAAAA,EAAA,kBAAA;AAAA,MACE,kEAAAyB,EAAA;AAAA,IACT,EAAA,GAGrFS,IAAAP;AAAA,MAA4B,MAAApB,EAAA,UAAA,UAAAA,EAAA,QAAAP,EAAA,QAAA,SAAAA,EAAA,QAAA,MAAAO,EAAA,OAAAP,EAAA,QAAA,MAAA,EAAA,IAAA,CAAAmC,OAAA;AAAA,QAEiE,MAAAA,EAAA;AAAA,QACtE,SAAAA,EAAA;AAAA,QACG,MAAAA,EAAA;AAAA,QACH,UAAAA,EAAA;AAAA,QACI,UAAAA,EAAA;AAAA,MACA,EAAA,IAAA,CAAA;AAAA,IAEhB;;;;;;;;;;;;;;;;"}
|
|
@@ -179,7 +179,7 @@ var X = function() {
|
|
|
179
179
|
Z,
|
|
180
180
|
!1,
|
|
181
181
|
null,
|
|
182
|
-
"
|
|
182
|
+
"5ea3e6cd"
|
|
183
183
|
);
|
|
184
184
|
const dt = tt.exports;
|
|
185
185
|
export {
|
|
@@ -191,4 +191,4 @@ export {
|
|
|
191
191
|
i as e,
|
|
192
192
|
J as f
|
|
193
193
|
};
|
|
194
|
-
//# sourceMappingURL=button-actions.
|
|
194
|
+
//# sourceMappingURL=button-actions.Ju27CRNG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-actions.Ju27CRNG.js","sources":["../../src/components/button/components/button-actions/button-actions.types.ts","../../../core/src/components/loading-button/loading-button.types.ts","../../src/components/button/components/loading-button/loading-button.vue","../../src/components/internal/button-actions-with-menu/button-actions-with-menu.keys.ts","../../src/components/button/components/button-actions/composables/use-stack-buttons/use-stack-buttons.ts","../../src/components/button/components/button-actions/button-actions.vue"],"sourcesContent":["import type { BentoButtonProps } from '@adyen/bento-core/src/components/button/button.types';\nimport type { BentoLoadingButtonState } from '@adyen/bento-core/src/components/loading-button/loading-button.types';\nimport type { VueNodeElement } from '@/types';\n\nexport interface BentoButtonActionObject extends BentoButtonProps {\n title: string;\n event?: (event: Event) => void;\n icon?: VueNodeElement;\n iconLeft?: VueNodeElement;\n iconRight?: VueNodeElement;\n state?: BentoLoadingButtonState | `${BentoLoadingButtonState}`;\n iconOnly?: boolean;\n}\n\nexport type BentoButtonActionsList = Array<BentoButtonActionObject>;\n\nexport enum BentoButtonActionsLayoutBasic {\n BUTTONS_END = 'buttons-end',\n FILL_CONTAINER = 'fill-container',\n SPACE_BETWEEN = 'space-between',\n VERTICAL_STACK = 'vertical-stack',\n}\nexport enum BentoButtonActionsLayoutExtended {\n BUTTONS_START = 'buttons-start',\n}\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport const BentoButtonActionsLayout = { ...BentoButtonActionsLayoutBasic, ...BentoButtonActionsLayoutExtended };\nexport type BentoButtonActionsLayout = BentoButtonActionsLayoutBasic | BentoButtonActionsLayoutExtended;\n\nexport interface BentoButtonActionsProps {\n /**\n * List of actions that will be used to render the buttons.\n * First element in the list will be rendered as \"primary\".\n * All elements after the first will be rendered as \"secondary\".\n *\n * Each object in the list should have a `title`, an `event` and\n * (optional) a Vue `icon` from the library `@adyen/ui-assets-icons-16`.\n *\n * `title`: Button's text.\n *\n * `event`: Event triggered when clicking the Button.\n *\n * `icon` (optional): Vue Icon from the library `@adyen/ui-assets-icons-16`.\n *\n * @see BentoButton for a list of all the other props supported by each button action.\n *\n * ```\n * [{\n * title: 'Primary',\n * event: () => { ... },\n * icon: FourPeopleIcon,\n * link: {\n * variant: 'default',\n * external: true,\n * to: 'https://www.adyen.com/'\n * },\n * }, {\n * title: 'Secondary',\n * event: () => { ... }\n * disabled: true,\n * variant: 'secondary',\n * critical: true\n * }]\n * ```\n */\n actions: BentoButtonActionsList;\n\n /**\n * Sets the Button Actions to color scheme inverse\n */\n inverse?: boolean;\n\n /**\n * Defines the layout in which the button actions is presented.\n * It can be one of:\n *\n * @values BUTTONS_START\n * @values BUTTONS_END\n * @values FILL_CONTAINER\n * @values SPACE_BETWEEN\n * @values VERTICAL_STACK\n */\n layout?: BentoButtonActionsLayout | `${BentoButtonActionsLayout}`;\n}\n","export enum BentoLoadingButtonState {\n START = 'start',\n LOADING = 'loading',\n SUCCESS = 'success',\n FAIL = 'fail',\n}\n\nexport type BentoLoadingButtonIconState = Partial<{ [key in BentoLoadingButtonState]: string }>;\n","<template>\n <bento-button\n :critical=\"isCritical\"\n :variant=\"variant\"\n :condensed=\"condensed\"\n :disabled=\"disabled\"\n :inverse=\"inverse\"\n class=\"b-loading-button\"\n :class=\"conditionalClasses\"\n @click.capture.stop=\"onClick\"\n >\n <slot></slot>\n\n <template v-if=\"state === 'start' && hasSlot('iconLeft')\" #iconLeft>\n <slot name=\"iconLeft\"></slot>\n </template>\n <template v-else-if=\"state !== 'start'\" #iconLeft>\n <span class=\"b-loading-button__icon\" data-testid=\"loading-button-rotating-icon\">\n <cross v-if=\"state === 'fail'\" :svg-title=\"t('failed')\" />\n <checkmark v-else-if=\"state === 'success'\" :svg-title=\"t('succeded')\" />\n <!-- TODO: Replace with new loading-indicator component -->\n <bento-loading-indicator v-else-if=\"state === 'loading'\" small :inverse=\"isInverseLoadingIndicator\" />\n </span>\n </template>\n </bento-button>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, PropType, useSlots } from 'vue';\n import { BentoLoadingButtonState } from '@/core/components/loading-button/loading-button.types';\n import { BentoLoadingIndicator } from '@/components/loading-indicator';\n import BentoButton from '@/components/button/button.vue';\n import Cross from '@adyen/ui-assets-icons-16/vue/cross-circle-fill';\n import Checkmark from '@adyen/ui-assets-icons-16/vue/checkmark-circle-fill';\n import { useHasSlot } from '@/composables/use-has-slot/use-has-slot';\n\n import { useI18n } from '@/utils/ts/i18n';\n\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const props = defineProps({\n /**\n * Reduces sizing of button\n */\n condensed: {\n type: BentoButton.props.condensed.type,\n default: false,\n },\n\n /**\n * Displays loading-button as critical\n */\n critical: {\n type: BentoButton.props.critical.type,\n default: false,\n },\n\n /**\n * Disables button functonality\n */\n disabled: {\n type: BentoButton.props.disabled.type,\n default: false,\n },\n\n /**\n * Sets color set to inverse\n */\n inverse: {\n type: Boolean,\n default: false,\n },\n\n /**\n * State of the button.\n * @values start, loading, success, fail\n */\n state: {\n type: String as PropType<BentoLoadingButtonState | `${BentoLoadingButtonState}`>,\n default: BentoLoadingButtonState.START,\n validator: (value: BentoLoadingButtonState) => Object.values(BentoLoadingButtonState).includes(value),\n },\n\n /**\n * Types of flavour of Button\n */\n variant: {\n type: BentoButton.props.variant.type,\n default: 'primary',\n validator: BentoButton.props.variant.validator,\n },\n });\n\n const emit = defineEmits([\"click\"]);\n\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const conditionalClasses = computed(() => ({\n [`b-loading-button--${props.variant}-${BentoLoadingButtonState.LOADING}`]:\n props.state === BentoLoadingButtonState.LOADING && !props.disabled,\n 'b-loading-button--loading': props.state === BentoLoadingButtonState.LOADING && !props.disabled,\n [`b-loading-button--${props.variant}-${BentoLoadingButtonState.SUCCESS}`]:\n props.state === BentoLoadingButtonState.SUCCESS,\n [`b-loading-button--inverse`]: props.inverse,\n }));\n\n const isInverseLoadingIndicator = computed(\n () => (props.variant === 'primary' && !props.inverse) || (props.variant !== 'primary' && props.inverse)\n );\n const isCritical = computed(\n () =>\n (props.critical && props.state === BentoLoadingButtonState.START) ||\n props.state === BentoLoadingButtonState.FAIL\n );\n\n const onClick = (e: MouseEvent) => {\n // Prevent Vue3 from triggering event twice\n e.stopPropagation();\n\n if (props.state !== BentoLoadingButtonState.LOADING) {\n emit('click', e);\n }\n };\n</script>\n\n<script lang=\"ts\">\n /**\n * Loading Button component is used for cases where pressing a button starts an event that requires a loading state, e.g. when you have any sort of asynchronous action and are waiting for a response\n *\n * @example\n * import { BentoLoadingButton } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoLoadingButton },\n * template: `\n * <bento-loading-button state=\"loading\" variant=\"secondary\">\n * Loading\n * </bento-loading button>\n * `\n * }\n */\n export default {\n i18n: { messages },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"@/core/components/loading-button/loading-button.scss\" />\n","export const BUTTON_ACTIONS_WITH_MENU_CONTAINER_INJECTION_KEY = Symbol(\n 'button actions with menu container injection key'\n);\n","import { computed, inject, nextTick, onMounted, onUnmounted, ref, Ref, watch } from 'vue';\nimport { observeSizeOfElement } from '@/utils/ts/resize';\nimport { BButtonActionsButtonsEndColumnGap } from '@adyen/bento-design-tokens/dist/js/bento/es6';\nimport { BentoButtonActionsList } from '../../button-actions.types';\nimport { BUTTON_ACTIONS_WITH_MENU_CONTAINER_INJECTION_KEY } from '@/internal/button-actions-with-menu/button-actions-with-menu.keys';\n\nconst CONTAINER_QUERY = 242;\nconst BUTTONS_GAP = parseInt(BButtonActionsButtonsEndColumnGap, 10);\n\n/**\n * Calculates the width of the container and the buttons and decides if the buttons should be stacked or not\n *\n * @param buttonActions Reference to the container element\n * @param buttons Reference array of button elements\n * @param actions Button actions actions prop\n */\nexport const useStackButtons = (\n buttonActions: Ref<HTMLDivElement>,\n buttons: Ref<HTMLDivElement[]>,\n actions: BentoButtonActionsList\n) => {\n const originalButtonsWidth = ref(0);\n let containerObserver: ResizeObserver | null = null;\n\n const { buttonActionsWithMenu, menu, stackButtons } = inject(BUTTON_ACTIONS_WITH_MENU_CONTAINER_INJECTION_KEY, {\n buttonActionsWithMenu: ref(null),\n menu: ref(null),\n stackButtons: ref(false),\n });\n\n const container = computed(() => buttonActionsWithMenu.value ?? buttonActions.value);\n\n const computedButtons = computed(() => (menu.value ? [...buttons.value, menu.value.$el] : buttons.value));\n\n const areButtonsWiderThanContainer = (updateOriginalButtonsWidth?: boolean) => {\n const buttonsWidth = computedButtons.value?.reduce(\n (acc, button) => acc + button.clientWidth + BUTTONS_GAP,\n -BUTTONS_GAP - 1 // to remove the extra spacing, as if there's 3 buttons, only two will have a gap in between\n );\n\n const containersWidth = container.value.clientWidth;\n\n if (updateOriginalButtonsWidth) {\n originalButtonsWidth.value = containersWidth >= CONTAINER_QUERY && !stackButtons.value ? buttonsWidth : 0;\n }\n return originalButtonsWidth.value > containersWidth;\n };\n\n watch(\n () => actions,\n () => {\n nextTick(() => {\n stackButtons.value = areButtonsWiderThanContainer(true);\n });\n },\n { deep: true }\n );\n\n onMounted(() => {\n containerObserver = observeSizeOfElement(container.value, () => {\n stackButtons.value = areButtonsWiderThanContainer(originalButtonsWidth.value === 0);\n });\n });\n\n onUnmounted(() => {\n containerObserver?.disconnect();\n });\n\n return stackButtons;\n};\n","<template>\n <div ref=\"buttonActions\" class=\"b-button-actions\">\n <div class=\"b-button-actions__container-wrapper\" :class=\"conditionalClasses\" role=\"group\">\n <div\n v-for=\"(button, index) in reversedActionsList\"\n :key=\"index\"\n ref=\"buttons\"\n class=\"b-button-actions__button-wrapper\"\n >\n <bento-loading-button\n v-if=\"button.state\"\n :condensed=\"button.condensed\"\n :critical=\"button.critical\"\n :disabled=\"button.disabled\"\n :inverse=\"inverse\"\n :state=\"button.state\"\n :variant=\"button.variant || generateButtonVariantByIndex(index)\"\n v-on=\"generateButtonEvents(button)\"\n >\n {{ button.title }}\n </bento-loading-button>\n <bento-button\n v-else\n :condensed=\"button.condensed\"\n :critical=\"button.critical\"\n :disabled=\"button.disabled\"\n :inverse=\"inverse\"\n :link=\"button.link\"\n :variant=\"button.variant || generateButtonVariantByIndex(index)\"\n v-on=\"generateButtonEvents(button)\"\n >\n <template v-if=\"button.icon || button.iconLeft\" #iconLeft>\n <component :is=\"button.icon || button.iconLeft\" :svg-title=\"button.title\"></component>\n </template>\n <template v-if=\"!isIconOnly(button)\" #default>\n {{ button.title }}\n </template>\n <template v-if=\"button.iconRight\" #iconRight>\n <component :is=\"button.iconRight\" :svg-title=\"button.title\"></component>\n </template>\n </bento-button>\n </div>\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, ref } from 'vue';\n import BentoButton from '../../button.vue';\n import { BentoButtonActionObject, BentoButtonActionsLayout } from './button-actions.types';\n import type { BentoButtonActionsProps } from './button-actions.types';\n import { BentoLoadingButton } from '../loading-button';\n import { useStackButtons } from './composables/use-stack-buttons/use-stack-buttons';\n\n const props = defineProps({\n actions: null,\n inverse: { type: Boolean, default: false },\n layout: { default: BentoButtonActionsLayout.BUTTONS_END }\n});\n\n const buttonActions = ref<HTMLDivElement>(null);\n const buttons = ref<HTMLDivElement[]>(null);\n const stackButtons = useStackButtons(buttonActions, buttons, props.actions);\n\n const reversedActionsList = computed(() => props.actions.slice().reverse());\n const generateButtonVariantByIndex = actionIndex => {\n const lastActionIndex = props.actions.length - 1;\n return actionIndex === lastActionIndex ? 'primary' : 'secondary';\n };\n\n const conditionalClasses = computed(() => ({\n [`b-button-actions--${props.layout}`]: true,\n [`b-button-actions--stacked-buttons`]: stackButtons.value,\n }));\n\n const generateButtonEvents = (button: BentoButtonActionObject) =>\n button?.event !== undefined\n ? {\n click: button.event,\n }\n : {};\n\n const isIconOnly = (button: BentoButtonActionObject) =>\n button.iconOnly && (button.iconLeft || button.iconRight || button.icon);\n</script>\n\n<script lang=\"ts\">\n /**\n * ButtonActions component manages a set of actions a user can choose from by displaying a group of buttons.\n *\n * @example\n * import { BentoButtonActions } from '@adyen/bento-vue2';\n * import MachineLearningIcon from '@adyen/ui-assets-icons-16/vue/machine-learning';\n *\n * const clickedAction = () => { //your action here }\n *\n * <template>\n * <bento-button-actions\n * :actions=\"[{\n * title: 'Primary',\n * event: clickedAction,\n * icon: MachineLearningIcon,\n * }, {\n * title: 'Secondary',\n * event: clickedAction,\n * }, {\n * title: 'Tertiary',\n * event: clickedAction,\n * }]\"\n * />\n * </template>\n */\n export default {};\n</script>\n\n<style lang=\"scss\" scoped src=\"@/core/components/button-actions/button-actions.scss\" />\n"],"names":["BentoButtonActionsLayoutBasic","BentoButtonActionsLayoutBasic2","BentoButtonActionsLayoutExtended","BentoButtonActionsLayoutExtended2","BentoButtonActionsLayout","BentoLoadingButtonState","BentoLoadingButtonState2","__default__$1","messages","slots","useSlots","hasSlot","useHasSlot","t","useI18n","conditionalClasses","computed","props","isInverseLoadingIndicator","isCritical","e","emit","BUTTON_ACTIONS_WITH_MENU_CONTAINER_INJECTION_KEY","CONTAINER_QUERY","BUTTONS_GAP","BButtonActionsButtonsEndColumnGap","useStackButtons","buttonActions","buttons","actions","originalButtonsWidth","ref","containerObserver","buttonActionsWithMenu","menu","stackButtons","inject","container","computedButtons","areButtonsWiderThanContainer","updateOriginalButtonsWidth","buttonsWidth","_a","acc","button","containersWidth","watch","nextTick","onMounted","observeSizeOfElement","onUnmounted","__default__","reversedActionsList","generateButtonVariantByIndex","actionIndex","lastActionIndex"],"mappings":";;;;;;;;;;;AAgBY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,cAAA,eACAA,EAAA,iBAAA,kBACAA,EAAA,gBAAA,iBACAA,EAAA,iBAAA,kBAJQA,IAAAD,KAAA,CAAA,CAAA,GAMAE,IAAA,kBAAAC,OACRA,EAAA,gBAAA,iBADQA,IAAAD,KAAA,CAAA,CAAA;AAOL,MAAAE,IAAA,EAAA,GAAAJ,GAAA,GAAAE,EAAA;AC7BK,IAAAG,IAAA,kBAAAC,OACRA,EAAA,QAAA,SACAA,EAAA,UAAA,WACAA,EAAA,UAAA,WACAA,EAAA,OAAA,QAJQA,IAAAD,KAAA,CAAA,CAAA;;;;;;;;;;;;GCiJRE,IAAA;AAAA,EAAe,MAAA,EAAA,UAAAC,EAAA;AAEf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAlDAC,IAAAC,EAAA,GACAC,IAAAC,EAAAH,CAAA,GACA,EAAA,GAAAI,EAAA,IAAAC,EAAA,GAEAC,IAAAC,EAAA,OAAA;AAAA,MAA2C,CAAA,qBAAAC,EAAA,OAAA,IAAAZ,EAAA,OAAA,EAAA,GAAAY,EAAA,UAAAZ,EAAA,WAAA,CAAAY,EAAA;AAAA,MA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@@ import { u as z } from "./use-has-slot.C9lQZ6nz.js";
|
|
|
7
7
|
import { g as W } from "./generate-uid.NJ8tVoha.js";
|
|
8
8
|
import { u as F } from "./i18n.BQkEbtPM.js";
|
|
9
9
|
import { o as K } from "./resize.Bqks3WUm.js";
|
|
10
|
-
import { c as N, B as P } from "./button-actions.
|
|
10
|
+
import { c as N, B as P } from "./button-actions.Ju27CRNG.js";
|
|
11
11
|
import { n as Y } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
|
|
12
12
|
import "../assets/card.css";
|
|
13
13
|
var y = /* @__PURE__ */ ((s) => (s.PRIMARY = "primary", s.SECONDARY = "secondary", s))(y || {}), i = /* @__PURE__ */ ((s) => (s.DEFAULT = "default", s.SMALL = "small", s))(i || {});
|
|
@@ -133,4 +133,4 @@ export {
|
|
|
133
133
|
i as a,
|
|
134
134
|
pe as c
|
|
135
135
|
};
|
|
136
|
-
//# sourceMappingURL=card.
|
|
136
|
+
//# sourceMappingURL=card.CASAAsuJ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.BktfAMv5.js","sources":["../../src/components/card/card.types.ts","../../src/components/card/card.vue"],"sourcesContent":["/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoCardBackground {\n PRIMARY = 'primary',\n SECONDARY = 'secondary',\n}\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoCardTitleSize {\n DEFAULT = 'default',\n SMALL = 'small',\n}\n","<template>\n <div\n class=\"b-card\"\n :class=\"cardConditionalClasses\"\n :tabindex=\"tabIndex\"\n data-testid=\"card\"\n @click=\"onClick\"\n @keydown.enter=\"onKeyDown\"\n @keydown.space=\"onKeyDown\"\n >\n <div v-if=\"hasSlot('image')\" class=\"b-card__image\">\n <slot name=\"image\"></slot>\n </div>\n <div\n v-if=\"showHeader\"\n class=\"b-card__header\"\n :class=\"cardHeaderConditionalClasses\"\n :tabindex=\"headerTabIndex\"\n :aria-controls=\"expandable ? cardId : null\"\n :aria-expanded=\"expandable ? `${showContent}` : null\"\n :role=\"expandable ? 'button' : null\"\n @click=\"toggleExpansion\"\n @keypress.enter=\"toggleExpansion\"\n @keypress.space=\"toggleExpansion\"\n >\n <div class=\"b-card__header-wrapper\">\n <div v-if=\"showTitleWrapper\" class=\"b-card__header-slot-wrapper\">\n <div class=\"b-card__title-wrapper\" :class=\"cardTitleWrapperConditionalClasses\">\n <div v-if=\"expandable\" class=\"b-card__toggle\" :class=\"cardToggleConditionalClasses\">\n <chevron-up-icon v-if=\"showContent\" :svg-title=\"t('hideContent')\" aria-hidden=\"true\" />\n <chevron-down-icon v-else :svg-title=\"t('showContent')\" aria-hidden=\"true\" />\n </div>\n <bento-typography v-if=\"hasSlot('default')\" class=\"b-card__title\" v-bind=\"typography\">\n <slot />\n </bento-typography>\n </div>\n\n <template v-if=\"hasSlot('header')\">\n <slot name=\"header\"></slot>\n </template>\n </div>\n\n <bento-typography v-if=\"hasSlot('description')\" class=\"b-card__description\" el=\"div\" variant=\"body\">\n <slot name=\"description\" />\n </bento-typography>\n </div>\n </div>\n\n <Transition name=\"b-card__animation\">\n <div v-if=\"showCardBody\" class=\"b-card__wrapper\" :style=\"contentMaxHeight\">\n <div\n :id=\"expandable ? cardId : null\"\n ref=\"contentDiv\"\n class=\"b-card__body\"\n :class=\"cardBodyConditionalClasses\"\n >\n <div v-if=\"hasSlot('content')\" class=\"b-card__content\" :class=\"cardContentConditionalClasses\">\n <slot name=\"content\" />\n </div>\n\n <div v-if=\"actions\" class=\"b-card__actions\" :class=\"cardActionsConditionalClasses\">\n <bento-button-actions :actions=\"actions\" :layout=\"actionsLayout\"></bento-button-actions>\n </div>\n </div>\n </div>\n </Transition>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, ref, useSlots, watch } from 'vue';\n\n // Components\n import { BentoTypography } from '@/components/typography';\n import { BentoButtonActions, BentoButtonActionsLayout, BentoButtonActionsList } from '@/components/button';\n import { BentoCardBackground, BentoCardTitleSize } from '@/components/card/card.types';\n import ChevronDownIcon from '@adyen/ui-assets-icons-16/vue/chevron-down';\n import ChevronUpIcon from '@adyen/ui-assets-icons-16/vue/chevron-up';\n\n // Composables\n import { useExpandableContentHeight } from '@/composables/use-expandable-content-height/use-expandable-content-height';\n\n // Utils\n import { useHasSlot } from '@/composables';\n import { generateUid } from '@/core/utils/ts';\n import { useI18n } from '@/utils/ts/i18n';\n import { observeSizeOfElement } from '@/utils/ts/resize';\n\n import messages from './messages.json';\n import { deprecate } from '@/utils/ts/deprecate';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n\n const props = defineProps({\n actions: { default: null },\n actionsLayout: { default: BentoButtonActionsLayout.BUTTONS_END },\n background: { default: BentoCardBackground.PRIMARY },\n clickable: { type: Boolean, default: false },\n closed: { type: Boolean, default: false },\n disabled: { type: Boolean, default: false },\n expandable: { type: Boolean, default: false },\n titleSize: { default: BentoCardTitleSize.DEFAULT }\n});\n\n const emit = defineEmits([\"click\", \"expanded\"]);\n\n const contentDiv = ref<HTMLDivElement>(null);\n\n const cardId = generateUid('card');\n const showContent = ref(!props.closed);\n watch(\n () => props.closed,\n value => {\n showContent.value = !value;\n }\n );\n const showHeader = computed(() => hasSlot('default') || hasSlot('description') || hasSlot('header'));\n const showTitleWrapper = computed(() => hasSlot('default') || hasSlot('header'));\n const showCardBody = computed(\n () =>\n (hasSlot('content') || props.actions?.length) &&\n (!props.expandable || (props.expandable && showContent.value))\n );\n const tabIndex = computed(() => (props.clickable && !props.disabled ? 0 : -1));\n const headerTabIndex = computed(() => (props.expandable && !props.disabled ? 0 : -1));\n\n const cardConditionalClasses = computed(() => ({\n [`b-card--${props.background}`]: props.background,\n 'b-card--clickable': props.clickable,\n 'b-card--expandable': props.expandable,\n 'b-card--disabled': (props.clickable || props.expandable) && props.disabled,\n }));\n\n const cardHeaderConditionalClasses = computed(() => ({\n 'b-card__header--expandable': props.expandable,\n 'b-card__header--without-body': !props.expandable && !showCardBody.value,\n }));\n\n const cardToggleConditionalClasses = computed(() => ({\n 'b-card__toggle--small-text': props.titleSize === BentoCardTitleSize.SMALL,\n }));\n\n const cardBodyConditionalClasses = computed(() => ({\n 'b-card__body--expandable': props.expandable && hasSlot('content'),\n 'b-card__body--without-header': !props.expandable && !showHeader.value,\n }));\n\n const cardContentConditionalClasses = computed(() => ({\n 'b-card__content--without-header': !props.expandable && !showHeader.value,\n 'b-card__content--expandable': props.expandable,\n }));\n\n const cardActionsConditionalClasses = computed(() => {\n const isNotExpandableWithoutContent = !props.expandable && props.actions && !hasSlot('content');\n\n return {\n 'b-card__actions--without-content': isNotExpandableWithoutContent,\n 'b-card__actions--without-content-and-with-header': isNotExpandableWithoutContent && showHeader.value,\n };\n });\n\n const cardTitleWrapperConditionalClasses = computed(() => ({\n 'b-card__title-wrapper--truncated': hasSlot('header'),\n }));\n\n const typography = computed(\n () =>\n ({\n el: 'div',\n variant: props.titleSize === BentoCardTitleSize.DEFAULT ? 'title' : 'body',\n strongest: props.titleSize === BentoCardTitleSize.SMALL,\n wide: props.titleSize === BentoCardTitleSize.SMALL,\n }) as InstanceType<typeof BentoTypography>['$props']\n );\n\n // Toggle open and close logic and animation\n const { updateContentHeight, contentHeight } = useExpandableContentHeight(contentDiv, showContent);\n\n const contentMaxHeight = computed(() =>\n props.expandable && contentHeight.value ? { 'max-height': contentHeight.value } : {}\n );\n\n watch(\n () => contentDiv.value,\n () => {\n let observer: ResizeObserver | null = null;\n if (!observer && contentDiv.value) {\n observer = observeSizeOfElement(contentDiv.value, () => {\n if (contentDiv.value) {\n updateContentHeight();\n }\n });\n }\n }\n );\n\n const toggleExpansion = () => {\n if (!props.disabled && props.expandable) {\n showContent.value = !showContent.value;\n emit('expanded', showContent.value);\n updateContentHeight();\n }\n };\n\n const onClick = () => {\n if (!props.disabled) {\n emit('click');\n\n if (!props.clickable) {\n deprecate(\n 'BentoCard \"@click\" property',\n `Use the BentoCard \"@click\" with the \"clickable\" property to enable accessible styles.`,\n '2.0.0'\n );\n }\n }\n };\n\n const onKeyDown = () => {\n if (props.clickable && !props.disabled) {\n emit('click');\n }\n };\n</script>\n\n<script lang=\"ts\">\n /**\n * A card is a flexible and composable container.\n * Use cards to represent a single object or to visually group certain content, like legal information within company settings.\n *\n * @example\n * import { BentoCard } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoCard },\n * template: `\n * <bento-card>\n * Title of the Card\n * </bento-card>\n * `\n * };\n */\n export default {\n i18n: { messages },\n name: 'bento-card',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"@/core/components/card/card.scss\" />\n"],"names":["BentoCardBackground","BentoCardBackground2","BentoCardTitleSize","BentoCardTitleSize2","__default__","messages","t","useI18n","slots","useSlots","hasSlot","useHasSlot","contentDiv","ref","cardId","generateUid","showContent","props","watch","value","showHeader","computed","showTitleWrapper","showCardBody","_a","tabIndex","headerTabIndex","cardConditionalClasses","cardHeaderConditionalClasses","cardToggleConditionalClasses","cardBodyConditionalClasses","cardContentConditionalClasses","cardActionsConditionalClasses","isNotExpandableWithoutContent","cardTitleWrapperConditionalClasses","typography","updateContentHeight","contentHeight","useExpandableContentHeight","contentMaxHeight","observer","observeSizeOfElement","emit","deprecate"],"mappings":";;;;;;;;;;;;AAGY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,UAAA,WACAA,EAAA,YAAA,aAFQA,IAAAD,KAAA,CAAA,CAAA,GAQAE,IAAA,kBAAAC,OACRA,EAAA,UAAA,WACAA,EAAA,QAAA,SAFQA,IAAAD,KAAA,CAAA,CAAA;;;;;;;;;;;;;;GC4ORE,IAAA;AAAA,EAAe,MAAA,EAAA,UAAAC,EAAA;AAAA,EACM,MAAA;AAErB;;;;;;;;;;;;;;iBA7JA,EAAA,GAAAC,EAAA,IAAAC,EAAA,GAEAC,IAAAC,EAAA,GACAC,IAAAC,EAAAH,CAAA,GAeAI,IA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I0B;AAAA,QAAA;AAAA,QACI;AAAA,QACA;AAAA,MACA;AAAA,IAGZ,cAGJ,MAAA;AACI,MAAA1B,EAAA,aAAA,CAAAA,EAAA,YACIyB,EAAA,OAAA;AAAA,IACJ;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"card.CASAAsuJ.js","sources":["../../src/components/card/card.types.ts","../../src/components/card/card.vue"],"sourcesContent":["/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoCardBackground {\n PRIMARY = 'primary',\n SECONDARY = 'secondary',\n}\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoCardTitleSize {\n DEFAULT = 'default',\n SMALL = 'small',\n}\n","<template>\n <div\n class=\"b-card\"\n :class=\"cardConditionalClasses\"\n :tabindex=\"tabIndex\"\n data-testid=\"card\"\n @click=\"onClick\"\n @keydown.enter=\"onKeyDown\"\n @keydown.space=\"onKeyDown\"\n >\n <div v-if=\"hasSlot('image')\" class=\"b-card__image\">\n <slot name=\"image\"></slot>\n </div>\n <div\n v-if=\"showHeader\"\n class=\"b-card__header\"\n :class=\"cardHeaderConditionalClasses\"\n :tabindex=\"headerTabIndex\"\n :aria-controls=\"expandable ? cardId : null\"\n :aria-expanded=\"expandable ? `${showContent}` : null\"\n :role=\"expandable ? 'button' : null\"\n @click=\"toggleExpansion\"\n @keypress.enter=\"toggleExpansion\"\n @keypress.space=\"toggleExpansion\"\n >\n <div class=\"b-card__header-wrapper\">\n <div v-if=\"showTitleWrapper\" class=\"b-card__header-slot-wrapper\">\n <div class=\"b-card__title-wrapper\" :class=\"cardTitleWrapperConditionalClasses\">\n <div v-if=\"expandable\" class=\"b-card__toggle\" :class=\"cardToggleConditionalClasses\">\n <chevron-up-icon v-if=\"showContent\" :svg-title=\"t('hideContent')\" aria-hidden=\"true\" />\n <chevron-down-icon v-else :svg-title=\"t('showContent')\" aria-hidden=\"true\" />\n </div>\n <bento-typography v-if=\"hasSlot('default')\" class=\"b-card__title\" v-bind=\"typography\">\n <slot />\n </bento-typography>\n </div>\n\n <template v-if=\"hasSlot('header')\">\n <slot name=\"header\"></slot>\n </template>\n </div>\n\n <bento-typography v-if=\"hasSlot('description')\" class=\"b-card__description\" el=\"div\" variant=\"body\">\n <slot name=\"description\" />\n </bento-typography>\n </div>\n </div>\n\n <Transition name=\"b-card__animation\">\n <div v-if=\"showCardBody\" class=\"b-card__wrapper\" :style=\"contentMaxHeight\">\n <div\n :id=\"expandable ? cardId : null\"\n ref=\"contentDiv\"\n class=\"b-card__body\"\n :class=\"cardBodyConditionalClasses\"\n >\n <div v-if=\"hasSlot('content')\" class=\"b-card__content\" :class=\"cardContentConditionalClasses\">\n <slot name=\"content\" />\n </div>\n\n <div v-if=\"actions\" class=\"b-card__actions\" :class=\"cardActionsConditionalClasses\">\n <bento-button-actions :actions=\"actions\" :layout=\"actionsLayout\"></bento-button-actions>\n </div>\n </div>\n </div>\n </Transition>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, ref, useSlots, watch } from 'vue';\n\n // Components\n import { BentoTypography } from '@/components/typography';\n import { BentoButtonActions, BentoButtonActionsLayout, BentoButtonActionsList } from '@/components/button';\n import { BentoCardBackground, BentoCardTitleSize } from '@/components/card/card.types';\n import ChevronDownIcon from '@adyen/ui-assets-icons-16/vue/chevron-down';\n import ChevronUpIcon from '@adyen/ui-assets-icons-16/vue/chevron-up';\n\n // Composables\n import { useExpandableContentHeight } from '@/composables/use-expandable-content-height/use-expandable-content-height';\n\n // Utils\n import { useHasSlot } from '@/composables';\n import { generateUid } from '@/core/utils/ts';\n import { useI18n } from '@/utils/ts/i18n';\n import { observeSizeOfElement } from '@/utils/ts/resize';\n\n import messages from './messages.json';\n import { deprecate } from '@/utils/ts/deprecate';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n\n const props = defineProps({\n actions: { default: null },\n actionsLayout: { default: BentoButtonActionsLayout.BUTTONS_END },\n background: { default: BentoCardBackground.PRIMARY },\n clickable: { type: Boolean, default: false },\n closed: { type: Boolean, default: false },\n disabled: { type: Boolean, default: false },\n expandable: { type: Boolean, default: false },\n titleSize: { default: BentoCardTitleSize.DEFAULT }\n});\n\n const emit = defineEmits([\"click\", \"expanded\"]);\n\n const contentDiv = ref<HTMLDivElement>(null);\n\n const cardId = generateUid('card');\n const showContent = ref(!props.closed);\n watch(\n () => props.closed,\n value => {\n showContent.value = !value;\n }\n );\n const showHeader = computed(() => hasSlot('default') || hasSlot('description') || hasSlot('header'));\n const showTitleWrapper = computed(() => hasSlot('default') || hasSlot('header'));\n const showCardBody = computed(\n () =>\n (hasSlot('content') || props.actions?.length) &&\n (!props.expandable || (props.expandable && showContent.value))\n );\n const tabIndex = computed(() => (props.clickable && !props.disabled ? 0 : -1));\n const headerTabIndex = computed(() => (props.expandable && !props.disabled ? 0 : -1));\n\n const cardConditionalClasses = computed(() => ({\n [`b-card--${props.background}`]: props.background,\n 'b-card--clickable': props.clickable,\n 'b-card--expandable': props.expandable,\n 'b-card--disabled': (props.clickable || props.expandable) && props.disabled,\n }));\n\n const cardHeaderConditionalClasses = computed(() => ({\n 'b-card__header--expandable': props.expandable,\n 'b-card__header--without-body': !props.expandable && !showCardBody.value,\n }));\n\n const cardToggleConditionalClasses = computed(() => ({\n 'b-card__toggle--small-text': props.titleSize === BentoCardTitleSize.SMALL,\n }));\n\n const cardBodyConditionalClasses = computed(() => ({\n 'b-card__body--expandable': props.expandable && hasSlot('content'),\n 'b-card__body--without-header': !props.expandable && !showHeader.value,\n }));\n\n const cardContentConditionalClasses = computed(() => ({\n 'b-card__content--without-header': !props.expandable && !showHeader.value,\n 'b-card__content--expandable': props.expandable,\n }));\n\n const cardActionsConditionalClasses = computed(() => {\n const isNotExpandableWithoutContent = !props.expandable && props.actions && !hasSlot('content');\n\n return {\n 'b-card__actions--without-content': isNotExpandableWithoutContent,\n 'b-card__actions--without-content-and-with-header': isNotExpandableWithoutContent && showHeader.value,\n };\n });\n\n const cardTitleWrapperConditionalClasses = computed(() => ({\n 'b-card__title-wrapper--truncated': hasSlot('header'),\n }));\n\n const typography = computed(\n () =>\n ({\n el: 'div',\n variant: props.titleSize === BentoCardTitleSize.DEFAULT ? 'title' : 'body',\n strongest: props.titleSize === BentoCardTitleSize.SMALL,\n wide: props.titleSize === BentoCardTitleSize.SMALL,\n }) as InstanceType<typeof BentoTypography>['$props']\n );\n\n // Toggle open and close logic and animation\n const { updateContentHeight, contentHeight } = useExpandableContentHeight(contentDiv, showContent);\n\n const contentMaxHeight = computed(() =>\n props.expandable && contentHeight.value ? { 'max-height': contentHeight.value } : {}\n );\n\n watch(\n () => contentDiv.value,\n () => {\n let observer: ResizeObserver | null = null;\n if (!observer && contentDiv.value) {\n observer = observeSizeOfElement(contentDiv.value, () => {\n if (contentDiv.value) {\n updateContentHeight();\n }\n });\n }\n }\n );\n\n const toggleExpansion = () => {\n if (!props.disabled && props.expandable) {\n showContent.value = !showContent.value;\n emit('expanded', showContent.value);\n updateContentHeight();\n }\n };\n\n const onClick = () => {\n if (!props.disabled) {\n emit('click');\n\n if (!props.clickable) {\n deprecate(\n 'BentoCard \"@click\" property',\n `Use the BentoCard \"@click\" with the \"clickable\" property to enable accessible styles.`,\n '2.0.0'\n );\n }\n }\n };\n\n const onKeyDown = () => {\n if (props.clickable && !props.disabled) {\n emit('click');\n }\n };\n</script>\n\n<script lang=\"ts\">\n /**\n * A card is a flexible and composable container.\n * Use cards to represent a single object or to visually group certain content, like legal information within company settings.\n *\n * @example\n * import { BentoCard } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoCard },\n * template: `\n * <bento-card>\n * Title of the Card\n * </bento-card>\n * `\n * };\n */\n export default {\n i18n: { messages },\n name: 'bento-card',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"@/core/components/card/card.scss\" />\n"],"names":["BentoCardBackground","BentoCardBackground2","BentoCardTitleSize","BentoCardTitleSize2","__default__","messages","t","useI18n","slots","useSlots","hasSlot","useHasSlot","contentDiv","ref","cardId","generateUid","showContent","props","watch","value","showHeader","computed","showTitleWrapper","showCardBody","_a","tabIndex","headerTabIndex","cardConditionalClasses","cardHeaderConditionalClasses","cardToggleConditionalClasses","cardBodyConditionalClasses","cardContentConditionalClasses","cardActionsConditionalClasses","isNotExpandableWithoutContent","cardTitleWrapperConditionalClasses","typography","updateContentHeight","contentHeight","useExpandableContentHeight","contentMaxHeight","observer","observeSizeOfElement","emit","deprecate"],"mappings":";;;;;;;;;;;;AAGY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,UAAA,WACAA,EAAA,YAAA,aAFQA,IAAAD,KAAA,CAAA,CAAA,GAQAE,IAAA,kBAAAC,OACRA,EAAA,UAAA,WACAA,EAAA,QAAA,SAFQA,IAAAD,KAAA,CAAA,CAAA;;;;;;;;;;;;;;GC4ORE,IAAA;AAAA,EAAe,MAAA,EAAA,UAAAC,EAAA;AAAA,EACM,MAAA;AAErB;;;;;;;;;;;;;;iBA7JA,EAAA,GAAAC,EAAA,IAAAC,EAAA,GAEAC,IAAAC,EAAA,GACAC,IAAAC,EAAAH,CAAA,GAeAI,IAAAC,EAAA,IAAA,GAEAC,IAAAC,EAAA,MAAA,GACAC,IAAAH,EAAA,CAAAI,EAAA,MAAA;AACA,IAAAC;AAAA,MAAA,MAAAD,EAAA;AAAA,MACgB,CAAAE,MAAA;AAER,QAAAH,EAAA,QAAA,CAAAG;AAAA,MAAqB;AAAA,IACzB;AAEJ,UAAAC,IAAAC,EAAA,MAAAX,EAAA,SAAA,KAAAA,EAAA,aAAA,KAAAA,EAAA,QAAA,CAAA,GACAY,IAAAD,EAAA,MAAAX,EAAA,SAAA,KAAAA,EAAA,QAAA,CAAA,GACAa,IAAAF;AAAA,MAAqB,MAAA;;AAAA,gBAAAX,EAAA,SAAA,OAAAc,IAAAP,EAAA,YAAA,gBAAAO,EAAA,aAAA,CAA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