@adyen/bento-vue2 1.34.0 → 1.35.1
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 +2 -2
- package/dist/accordion.js +1 -1
- package/dist/action-bar.js +1 -1
- package/dist/alert.js +1 -1
- package/dist/assets/accordion-item.css +1 -1
- package/dist/assets/action-bar.css +1 -1
- package/dist/assets/avatar.css +1 -1
- package/dist/assets/base-modal.css +1 -1
- package/dist/assets/calendar.css +1 -1
- package/dist/assets/card.css +1 -1
- package/dist/assets/checkbox.css +1 -1
- package/dist/assets/code-snippet.css +1 -1
- package/dist/assets/currency.css +1 -0
- package/dist/assets/data-grid.css +1 -1
- package/dist/assets/date-range-picker.css +1 -1
- package/dist/assets/dialog-page.css +1 -1
- package/dist/assets/dropdown.css +1 -1
- package/dist/assets/error-message.css +1 -1
- package/dist/assets/filter-bar.css +1 -1
- package/dist/assets/header.css +1 -1
- package/dist/assets/inspector.css +1 -1
- package/dist/assets/loading-button.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/structured-list-item.css +1 -1
- package/dist/assets/tutorial.css +1 -1
- package/dist/avatar.js +1 -1
- package/dist/button.js +2 -2
- package/dist/card.js +1 -1
- package/dist/checkbox.js +2 -2
- package/dist/chunks/accordion-item.BDNSykyK.js +116 -0
- package/dist/chunks/accordion-item.BDNSykyK.js.map +1 -0
- package/dist/chunks/{action-bar.CsRmYQ-k.js → action-bar.CCVKS1xo.js} +51 -37
- package/dist/chunks/{action-bar.CsRmYQ-k.js.map → action-bar.CCVKS1xo.js.map} +1 -1
- package/dist/chunks/{alert.DtT7BRdr.js → alert.CVsckdGC.js} +17 -11
- package/dist/chunks/{alert.DtT7BRdr.js.map → alert.CVsckdGC.js.map} +1 -1
- package/dist/chunks/{avatar.0ffdL8i0.js → avatar.qcWk9clF.js} +9 -9
- package/dist/chunks/avatar.qcWk9clF.js.map +1 -0
- package/dist/chunks/{base-modal.zHjXVjwU.js → base-modal.BaHkDH5f.js} +15 -9
- package/dist/chunks/{base-modal.zHjXVjwU.js.map → base-modal.BaHkDH5f.js.map} +1 -1
- package/dist/chunks/{button-actions-with-menu.B6Nb6Ohu.js → button-actions-with-menu.Bl82u6yP.js} +4 -4
- package/dist/chunks/{button-actions-with-menu.B6Nb6Ohu.js.map → button-actions-with-menu.Bl82u6yP.js.map} +1 -1
- package/dist/chunks/{button-actions.BQHr68sA.js → button-actions.DN4eIQes.js} +2 -2
- package/dist/chunks/{button-actions.BQHr68sA.js.map → button-actions.DN4eIQes.js.map} +1 -1
- package/dist/chunks/{calendar.CaTMWZUM.js → calendar.BFrqPClW.js} +230 -230
- package/dist/chunks/calendar.BFrqPClW.js.map +1 -0
- package/dist/chunks/card.lWLgpCWM.js +123 -0
- package/dist/chunks/card.lWLgpCWM.js.map +1 -0
- package/dist/chunks/{checkbox-group.D_mCZMPr.js → checkbox-group.C0cqbJWx.js} +4 -4
- package/dist/chunks/{checkbox-group.D_mCZMPr.js.map → checkbox-group.C0cqbJWx.js.map} +1 -1
- package/dist/chunks/{checkbox.CaX67eM_.js → checkbox.B3u_hzUo.js} +38 -28
- package/dist/chunks/{checkbox.CaX67eM_.js.map → checkbox.B3u_hzUo.js.map} +1 -1
- package/dist/chunks/{code-snippet.DgKK7fE8.js → code-snippet.BgjvWTHP.js} +43 -34
- package/dist/chunks/code-snippet.BgjvWTHP.js.map +1 -0
- package/dist/chunks/{controls-group.6aTaRWFI.js → controls-group.DLBxlPfl.js} +2 -2
- package/dist/chunks/{controls-group.6aTaRWFI.js.map → controls-group.DLBxlPfl.js.map} +1 -1
- package/dist/chunks/{copy.B1DYKX_q.js → copy.CmxcGt77.js} +31 -23
- package/dist/chunks/{copy.B1DYKX_q.js.map → copy.CmxcGt77.js.map} +1 -1
- package/dist/chunks/{currency.D_2CN1OJ.js → currency.CbZqZrBz.js} +9 -8
- package/dist/chunks/{currency.D_2CN1OJ.js.map → currency.CbZqZrBz.js.map} +1 -1
- package/dist/chunks/{dashboard-section.DWfQGGwS.js → dashboard-section.BfXtTf6l.js} +2 -2
- package/dist/chunks/{dashboard-section.DWfQGGwS.js.map → dashboard-section.BfXtTf6l.js.map} +1 -1
- package/dist/chunks/{dashed-underline.C7gLtEqx.js → dashed-underline.xq5j9fGG.js} +2 -2
- package/dist/chunks/{dashed-underline.C7gLtEqx.js.map → dashed-underline.xq5j9fGG.js.map} +1 -1
- package/dist/chunks/{data-grid-template.2xocKVqX.js → data-grid-template.C8AR5CxA.js} +2 -2
- package/dist/chunks/{data-grid-template.2xocKVqX.js.map → data-grid-template.C8AR5CxA.js.map} +1 -1
- package/dist/chunks/{data-grid.CUn6MrZz.js → data-grid.BCTcokYm.js} +472 -426
- package/dist/chunks/{data-grid.CUn6MrZz.js.map → data-grid.BCTcokYm.js.map} +1 -1
- package/dist/chunks/{date-picker.C6_KbCYT.js → date-picker.CPG0zksD.js} +91 -83
- package/dist/chunks/date-picker.CPG0zksD.js.map +1 -0
- package/dist/chunks/{date-range-picker.DaTgBXP1.js → date-range-picker.Bt439x32.js} +265 -243
- package/dist/chunks/date-range-picker.Bt439x32.js.map +1 -0
- package/dist/chunks/{date.DaiTzNEZ.js → date.C0uwNQjg.js} +80 -80
- package/dist/chunks/{date.DaiTzNEZ.js.map → date.C0uwNQjg.js.map} +1 -1
- package/dist/chunks/{dropdown-tag.pJ_sQbJN.js → dropdown-tag.Cd4LGtwl.js} +3 -3
- package/dist/chunks/{dropdown-tag.pJ_sQbJN.js.map → dropdown-tag.Cd4LGtwl.js.map} +1 -1
- package/dist/chunks/{dropdown.DpsQPLy-.js → dropdown.B4KMM58m.js} +158 -139
- package/dist/chunks/dropdown.B4KMM58m.js.map +1 -0
- package/dist/chunks/{error-message.BnFyGbR7.js → error-message.GCYDEzGL.js} +28 -14
- package/dist/chunks/{error-message.BnFyGbR7.js.map → error-message.GCYDEzGL.js.map} +1 -1
- package/dist/chunks/es6.BvpG4Oi6.js.map +1 -1
- package/dist/chunks/{filter-bar.DGBvcKsz.js → filter-bar.Co2YeUUg.js} +604 -589
- package/dist/chunks/filter-bar.Co2YeUUg.js.map +1 -0
- package/dist/chunks/{footer-actions.CwHY2-Ap.js → footer-actions.CxxS87iQ.js} +2 -2
- package/dist/chunks/{footer-actions.CwHY2-Ap.js.map → footer-actions.CxxS87iQ.js.map} +1 -1
- package/dist/chunks/{form-layout-title.CRsR3o2x.js → form-layout-title.DomnJXLE.js} +2 -2
- package/dist/chunks/{form-layout-title.CRsR3o2x.js.map → form-layout-title.DomnJXLE.js.map} +1 -1
- package/dist/chunks/{index.B_UZQ6qF.js → get-date-locale.BN8xEjY0.js} +855 -204
- package/dist/chunks/get-date-locale.BN8xEjY0.js.map +1 -0
- package/dist/chunks/{header.BmNDoXio.js → header.zacQVbjn.js} +79 -73
- package/dist/chunks/{header.BmNDoXio.js.map → header.zacQVbjn.js.map} +1 -1
- package/dist/chunks/{index.Z84QE0E2.js → index.CrhTVr5J.js} +2 -2
- package/dist/chunks/{index.Z84QE0E2.js.map → index.CrhTVr5J.js.map} +1 -1
- package/dist/chunks/{index.xqFSZOAb.js → index.DDnf1O9p.js} +2 -2
- package/dist/chunks/{index.xqFSZOAb.js.map → index.DDnf1O9p.js.map} +1 -1
- package/dist/chunks/{index.B_EJflcs.js → index.DPafeRJa.js} +2 -2
- package/dist/chunks/{index.B_EJflcs.js.map → index.DPafeRJa.js.map} +1 -1
- package/dist/chunks/{input-field.S5HIZtYA.js → input-field.DBrzeKBj.js} +3 -3
- package/dist/chunks/{input-field.S5HIZtYA.js.map → input-field.DBrzeKBj.js.map} +1 -1
- package/dist/chunks/{inspector.types.D6kCCKNk.js → inspector.types.lu_MoQn5.js} +17 -9
- package/dist/chunks/{inspector.types.D6kCCKNk.js.map → inspector.types.lu_MoQn5.js.map} +1 -1
- package/dist/chunks/{loading-button.DDPZYO6r.js → loading-button.DoX2sopf.js} +39 -25
- package/dist/chunks/loading-button.DoX2sopf.js.map +1 -0
- package/dist/chunks/{menu.DSOJEn4v.js → menu.DHakGFS4.js} +2 -2
- package/dist/chunks/{menu.DSOJEn4v.js.map → menu.DHakGFS4.js.map} +1 -1
- package/dist/chunks/{modal-fullscreen.BQKE0bm0.js → modal-fullscreen.mIlp0LnL.js} +25 -19
- package/dist/chunks/{modal-fullscreen.BQKE0bm0.js.map → modal-fullscreen.mIlp0LnL.js.map} +1 -1
- package/dist/chunks/{modal.ClqkmzVZ.js → modal.CtTQWN8H.js} +25 -19
- package/dist/chunks/modal.CtTQWN8H.js.map +1 -0
- package/dist/chunks/{pagination.he0lQGAV.js → pagination.By-p9MjL.js} +2 -2
- package/dist/chunks/{pagination.he0lQGAV.js.map → pagination.By-p9MjL.js.map} +1 -1
- package/dist/chunks/{popover.UmNw_M-C.js → popover.BDaf6hmW.js} +2 -2
- package/dist/chunks/{popover.UmNw_M-C.js.map → popover.BDaf6hmW.js.map} +1 -1
- package/dist/chunks/{radio-group.D7cuMKzV.js → radio-group.OaYz1wJf.js} +3 -3
- package/dist/chunks/{radio-group.D7cuMKzV.js.map → radio-group.OaYz1wJf.js.map} +1 -1
- package/dist/chunks/{search-bar.BPyYb0WB.js → search-bar.eC-crOww.js} +14 -6
- package/dist/chunks/{search-bar.BPyYb0WB.js.map → search-bar.eC-crOww.js.map} +1 -1
- package/dist/chunks/{secondary-nav.CMUfpgQf.js → secondary-nav.1xw-o8OR.js} +2 -2
- package/dist/chunks/{secondary-nav.CMUfpgQf.js.map → secondary-nav.1xw-o8OR.js.map} +1 -1
- package/dist/chunks/{selection-card-group.DbMfzyTG.js → selection-card-group.BLPaJy5U.js} +3 -3
- package/dist/chunks/{selection-card-group.DbMfzyTG.js.map → selection-card-group.BLPaJy5U.js.map} +1 -1
- package/dist/chunks/{sidepanel.Ck6Ts9RR.js → sidepanel.ZYT_vzbj.js} +24 -18
- package/dist/chunks/{sidepanel.Ck6Ts9RR.js.map → sidepanel.ZYT_vzbj.js.map} +1 -1
- package/dist/chunks/{structured-list-item.DpLscUX4.js → structured-list-item.D7D8VpQY.js} +22 -16
- package/dist/chunks/{structured-list-item.DpLscUX4.js.map → structured-list-item.D7D8VpQY.js.map} +1 -1
- package/dist/chunks/{summary-grid-item-custom.B7Re6OCf.js → summary-grid-item-custom.v0QSLZKT.js} +2 -2
- package/dist/chunks/{summary-grid-item-custom.B7Re6OCf.js.map → summary-grid-item-custom.v0QSLZKT.js.map} +1 -1
- package/dist/chunks/{textarea.BRMpTWKS.js → textarea.C0IMS5XS.js} +2 -2
- package/dist/chunks/{textarea.BRMpTWKS.js.map → textarea.C0IMS5XS.js.map} +1 -1
- package/dist/chunks/{timeline-item.jh7UnviR.js → timeline-item.Dmd78uwQ.js} +53 -47
- package/dist/chunks/{timeline-item.jh7UnviR.js.map → timeline-item.Dmd78uwQ.js.map} +1 -1
- package/dist/chunks/{tutorial.DERGsCkg.js → tutorial.D64_0i0-.js} +50 -38
- package/dist/chunks/{tutorial.DERGsCkg.js.map → tutorial.D64_0i0-.js.map} +1 -1
- package/dist/chunks/{use-cached-selected-values.B39-iEp4.js → use-cached-selected-values.BOAumEi7.js} +54 -40
- package/dist/chunks/{use-cached-selected-values.B39-iEp4.js.map → use-cached-selected-values.BOAumEi7.js.map} +1 -1
- package/dist/code-snippet.js +1 -1
- package/dist/currency.js +1 -1
- 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 +2 -2
- package/dist/date-range-picker.js +2 -2
- package/dist/date.js +1 -1
- package/dist/dropdown.js +3 -3
- package/dist/filter-bar.js +1 -1
- package/dist/form-layout.js +1 -1
- package/dist/header.js +1 -1
- package/dist/index.js +43 -43
- package/dist/input-field.js +1 -1
- package/dist/inspector.js +1 -1
- package/dist/internal.js +5 -5
- package/dist/menu.js +1 -1
- package/dist/modal-fullscreen.js +1 -1
- package/dist/modal.js +2 -2
- package/dist/pagination.js +1 -1
- package/dist/popover.js +1 -1
- package/dist/radio-group.js +1 -1
- package/dist/search-bar.js +2 -2
- package/dist/secondary-nav.js +1 -1
- package/dist/selection-card.js +1 -1
- package/dist/sidepanel.js +1 -1
- package/dist/structured-list.js +1 -1
- package/dist/styles/bento.css +3 -0
- package/dist/styles/legacy.css +3 -0
- package/dist/styles/styleguide.css +3 -0
- 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 +9 -9
- package/package.json +2 -2
- package/dist/chunks/accordion-item.IMlV_Vik.js +0 -100
- package/dist/chunks/accordion-item.IMlV_Vik.js.map +0 -1
- package/dist/chunks/avatar.0ffdL8i0.js.map +0 -1
- package/dist/chunks/calendar.CaTMWZUM.js.map +0 -1
- package/dist/chunks/card.ignL7-CH.js +0 -115
- package/dist/chunks/card.ignL7-CH.js.map +0 -1
- package/dist/chunks/code-snippet.DgKK7fE8.js.map +0 -1
- package/dist/chunks/date-picker.C6_KbCYT.js.map +0 -1
- package/dist/chunks/date-range-picker.DaTgBXP1.js.map +0 -1
- package/dist/chunks/dropdown.DpsQPLy-.js.map +0 -1
- package/dist/chunks/filter-bar.DGBvcKsz.js.map +0 -1
- package/dist/chunks/index.B_UZQ6qF.js.map +0 -1
- package/dist/chunks/loading-button.DDPZYO6r.js.map +0 -1
- package/dist/chunks/modal.ClqkmzVZ.js.map +0 -1
|
@@ -1,22 +1,32 @@
|
|
|
1
1
|
import { defineComponent as $, toRefs as k, computed as o, ref as N } from "vue";
|
|
2
2
|
import { B as w } from "./typography.CqQaHXhq.js";
|
|
3
|
-
import { u as
|
|
4
|
-
import { u as
|
|
3
|
+
import { u as R } from "./use-default-slot-validator.BDn0wkYP.js";
|
|
4
|
+
import { u as j } from "./use-has-slot.C9lQZ6nz.js";
|
|
5
5
|
import { g as C } from "./unique-id.XFfoKuc2.js";
|
|
6
6
|
import { g as f } from "./get-slot-text.Cgn-E48s.js";
|
|
7
|
-
import { u as
|
|
7
|
+
import { u as F } from "./i18n.BQkEbtPM.js";
|
|
8
8
|
import { u as z } from "./aria-label.CaUURpnB.js";
|
|
9
9
|
import { B as H } from "./tag.Bo_6RnVE.js";
|
|
10
|
-
import { a as
|
|
11
|
-
import { E as
|
|
12
|
-
import { n as
|
|
10
|
+
import { a as J, C as B } from "./checkbox-input.BH7MGdMj.js";
|
|
11
|
+
import { E as O } from "./error-message.GCYDEzGL.js";
|
|
12
|
+
import { n as Y } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
|
|
13
13
|
import "../assets/checkbox.css";
|
|
14
14
|
var i = /* @__PURE__ */ ((a) => (a.UPDATE = "update:model-value", a.INPUT = "input", a))(i || {});
|
|
15
15
|
const K = {
|
|
16
16
|
"en-US": {
|
|
17
|
-
|
|
17
|
+
checkbox: "Checkbox",
|
|
18
18
|
optional: "optional",
|
|
19
19
|
required: "required"
|
|
20
|
+
},
|
|
21
|
+
"pt-BR": {
|
|
22
|
+
checkbox: "Caixa de seleção",
|
|
23
|
+
optional: "opcional",
|
|
24
|
+
required: "obrigatório"
|
|
25
|
+
},
|
|
26
|
+
"ja-JP": {
|
|
27
|
+
checkbox: "チェックボックス",
|
|
28
|
+
optional: "任意",
|
|
29
|
+
required: "必須"
|
|
20
30
|
}
|
|
21
31
|
}, Q = $({
|
|
22
32
|
name: "bento-checkbox",
|
|
@@ -24,8 +34,8 @@ const K = {
|
|
|
24
34
|
components: {
|
|
25
35
|
BentoTag: H,
|
|
26
36
|
BentoTypography: w,
|
|
27
|
-
CheckboxInput:
|
|
28
|
-
ErrorMessage:
|
|
37
|
+
CheckboxInput: J,
|
|
38
|
+
ErrorMessage: O
|
|
29
39
|
},
|
|
30
40
|
model: { prop: "modelValue" },
|
|
31
41
|
props: {
|
|
@@ -93,33 +103,33 @@ const K = {
|
|
|
93
103
|
},
|
|
94
104
|
emits: [i.UPDATE, i.INPUT],
|
|
95
105
|
setup(a, { attrs: e, emit: t, slots: r }) {
|
|
96
|
-
const { t: m } =
|
|
97
|
-
|
|
106
|
+
const { t: m } = F(), h = C("description"), _ = C("error"), d = j(r), { disabled: v, indeterminate: A, modelValue: b, readonly: E, value: I } = k(a), y = f(r)("default"), g = f(r)("description");
|
|
107
|
+
R("bento-checkbox", r.default, r.description);
|
|
98
108
|
const l = o(() => Array.isArray(b.value)), s = o(() => l.value ? b.value.some((u) => u === I.value) : b.value), n = o(() => A.value), x = o(
|
|
99
109
|
() => !a.disabled && !a.readonly && (a.hasError || !!a.errorMessage)
|
|
100
|
-
), S = o(() => !a.disabled && !a.readonly && !!a.errorMessage), c = o(() => d("content")), p = o(() => (n == null ? void 0 : n.value) || (s == null ? void 0 : s.value)),
|
|
110
|
+
), S = o(() => !a.disabled && !a.readonly && !!a.errorMessage), c = o(() => d("content")), p = o(() => (n == null ? void 0 : n.value) || (s == null ? void 0 : s.value)), q = o(
|
|
101
111
|
() => (c == null ? void 0 : c.value) && (l == null ? void 0 : l.value) && (p == null ? void 0 : p.value)
|
|
102
112
|
), D = o(
|
|
103
113
|
() => n.value ? "mixed" : `${!!s.value}`
|
|
104
|
-
),
|
|
105
|
-
() => `${S.value ?
|
|
106
|
-
),
|
|
107
|
-
ariaLabel:
|
|
114
|
+
), L = o(
|
|
115
|
+
() => `${S.value ? _ : ""} ${y && g ? h : ""}`.trim() || null
|
|
116
|
+
), T = N(e["aria-label"]), { ariaLabel: M } = k(a), P = z({
|
|
117
|
+
ariaLabel: T.value,
|
|
108
118
|
// TODO: take this line away when the aria-label props is removed
|
|
109
|
-
label:
|
|
110
|
-
defaultFallback: d("default") ? f(r)("default") : m("
|
|
111
|
-
}),
|
|
119
|
+
label: M,
|
|
120
|
+
defaultFallback: d("default") ? f(r)("default") : m("checkbox")
|
|
121
|
+
}), U = o(() => x.value), V = o(() => ({
|
|
112
122
|
[`b-checkbox--${B.DISABLED}`]: v.value,
|
|
113
123
|
[`b-checkbox--${B.READONLY}`]: E.value
|
|
114
124
|
}));
|
|
115
125
|
return {
|
|
116
126
|
// Values
|
|
117
|
-
descriptionId:
|
|
118
|
-
errorId:
|
|
127
|
+
descriptionId: h,
|
|
128
|
+
errorId: _,
|
|
119
129
|
ariaChecked: D,
|
|
120
|
-
ariaDescribedBy:
|
|
121
|
-
ariaInvalid:
|
|
122
|
-
computedAriaLabel:
|
|
130
|
+
ariaDescribedBy: L,
|
|
131
|
+
ariaInvalid: U,
|
|
132
|
+
computedAriaLabel: P,
|
|
123
133
|
conditionalClass: V,
|
|
124
134
|
defaultSlotValue: y,
|
|
125
135
|
descriptionSlotValue: g,
|
|
@@ -128,7 +138,7 @@ const K = {
|
|
|
128
138
|
isIndeterminate: n,
|
|
129
139
|
shouldShowError: x,
|
|
130
140
|
shouldShowErrorMessage: S,
|
|
131
|
-
contentSlotAvailable:
|
|
141
|
+
contentSlotAvailable: q,
|
|
132
142
|
hasContentSlot: c,
|
|
133
143
|
// Methods
|
|
134
144
|
hasSlot: d,
|
|
@@ -142,17 +152,17 @@ const K = {
|
|
|
142
152
|
var W = function() {
|
|
143
153
|
var e = this, t = e._self._c;
|
|
144
154
|
return e._self._setupProxy, t("label", { staticClass: "b-checkbox", class: e.conditionalClass }, [t("checkbox-input", e._b({ ref: "input", attrs: { "aria-label": e.computedAriaLabel, "aria-describedby": e.ariaDescribedBy, disabled: e.disabled, "has-error": e.shouldShowError, indeterminate: e.isIndeterminate, value: e.value, "model-value": e.modelValue, readonly: e.readonly }, on: { "update:model-value": e.onChange } }, "checkbox-input", e.$attrs, !1)), e.hasSlot("default") || e.shouldShowErrorMessage ? t("span", { staticClass: "b-checkbox__text" }, [e.hasSlot("default") ? t("bento-typography", { staticClass: "b-checkbox__label", attrs: { el: "span", variant: "body" } }, [t("span", [e._t("default")], 2), e.optional ? t("bento-typography", { staticClass: "b-checkbox__label-requirement", attrs: { el: "span" } }, [e._v("(" + e._s(e.t("optional")) + ")")]) : e.required ? t("bento-typography", { staticClass: "b-checkbox__label-requirement", attrs: { el: "span" } }, [e._v("(" + e._s(e.t("required")) + ")")]) : e._e(), e.tag ? t("bento-tag", e._b({ staticClass: "b-checkbox__label-tag" }, "bento-tag", e.tag, !1)) : e._e()], 1) : e._e(), e.hasSlot("default") && e.hasSlot("description") ? t("bento-typography", { staticClass: "b-checkbox__description", attrs: { id: e.descriptionId, el: "span", variant: "body" } }, [e._t("description")], 2) : e._e(), e.shouldShowErrorMessage ? t("error-message", { attrs: { id: e.errorId, "error-message": e.errorMessage } }) : e._e(), e.contentSlotAvailable ? t("bento-typography", { staticClass: "b-checkbox__content", attrs: { el: "span", variant: "body" } }, [e._t("content")], 2) : e._e()], 1) : e._e()], 1);
|
|
145
|
-
}, X = [], Z = /* @__PURE__ */
|
|
155
|
+
}, X = [], Z = /* @__PURE__ */ Y(
|
|
146
156
|
Q,
|
|
147
157
|
W,
|
|
148
158
|
X,
|
|
149
159
|
!1,
|
|
150
160
|
null,
|
|
151
|
-
"
|
|
161
|
+
"a911cfdc"
|
|
152
162
|
);
|
|
153
163
|
const be = Z.exports;
|
|
154
164
|
export {
|
|
155
165
|
be as B,
|
|
156
166
|
i as a
|
|
157
167
|
};
|
|
158
|
-
//# sourceMappingURL=checkbox.
|
|
168
|
+
//# sourceMappingURL=checkbox.B3u_hzUo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.CaX67eM_.js","sources":["../../src/components/checkbox/checkbox.types.ts","../../src/components/checkbox/checkbox.vue"],"sourcesContent":["import type { BentoTag } from '@/components/tag';\nimport type { BentoCheckboxType, BentoMultiCheckboxType } from '../internal/checkbox-input';\nimport { BentoCheckboxState } from '../internal/checkbox-input';\n\nexport { BentoCheckboxState, BentoCheckboxType, BentoMultiCheckboxType };\n\nexport enum BentoCheckboxEvent {\n UPDATE = 'update:model-value',\n INPUT = 'input',\n}\n\nexport type BentoCheckboxTag = InstanceType<typeof BentoTag>['$props'];\n","<template>\n <label class=\"b-checkbox\" :class=\"conditionalClass\">\n <checkbox-input\n ref=\"input\"\n v-bind=\"$attrs\"\n :aria-label=\"computedAriaLabel\"\n :aria-describedby=\"ariaDescribedBy\"\n :disabled=\"disabled\"\n :has-error=\"shouldShowError\"\n :indeterminate=\"isIndeterminate\"\n :value=\"value\"\n :model-value=\"modelValue\"\n :readonly=\"readonly\"\n @update:model-value=\"onChange\"\n />\n <span v-if=\"hasSlot('default') || shouldShowErrorMessage\" class=\"b-checkbox__text\">\n <bento-typography v-if=\"hasSlot('default')\" class=\"b-checkbox__label\" el=\"span\" variant=\"body\">\n <span><slot /></span>\n <bento-typography v-if=\"optional\" class=\"b-checkbox__label-requirement\" el=\"span\"\n >({{ t('optional') }})</bento-typography\n >\n <bento-typography v-else-if=\"required\" class=\"b-checkbox__label-requirement\" el=\"span\"\n >({{ t('required') }})</bento-typography\n >\n <bento-tag v-if=\"tag\" class=\"b-checkbox__label-tag\" v-bind=\"tag\" />\n </bento-typography>\n <bento-typography\n v-if=\"hasSlot('default') && hasSlot('description')\"\n :id=\"descriptionId\"\n class=\"b-checkbox__description\"\n el=\"span\"\n variant=\"body\"\n >\n <slot name=\"description\"></slot>\n </bento-typography>\n <error-message v-if=\"shouldShowErrorMessage\" :id=\"errorId\" :error-message=\"errorMessage\" />\n\n <bento-typography v-if=\"contentSlotAvailable\" class=\"b-checkbox__content\" el=\"span\" variant=\"body\">\n <slot name=\"content\"></slot>\n </bento-typography>\n </span>\n </label>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, PropType, ref, toRefs } from 'vue';\n import {\n BentoCheckboxEvent,\n BentoCheckboxState,\n BentoCheckboxTag,\n BentoCheckboxType,\n BentoMultiCheckboxType,\n } from './checkbox.types';\n import { BentoTypography } from '@/components/typography';\n import { CheckboxInput } from '@/components/internal/checkbox-input';\n import { ErrorMessage } from '@/components/internal/error-message';\n import type { HTMLAttributes } from 'vue/types/jsx';\n import { useDefaultSlotValidator, useHasSlot } from '@/composables';\n import { generateUid } from '@/utils/ts/unique-id';\n import { getSlotText } from '@/utils/ts/get-slot-text';\n import { useI18n } from '@/utils/ts/i18n';\n import { useAriaLabel } from '@/utils/ts/aria-label';\n import { BentoTag } from '@/components/tag';\n import { BentoCheckboxGroupItems } from './components/checkbox-group/checkbox-group.types';\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n /**\n * Checkboxes are used to make a binary choice about an option.\n * The label tag area is also clickable.\n *\n * @usage\n * import { BentoCheckbox } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoCheckbox },\n * template: `\n * <bento-checkbox>\n * Label text\n * <template #description>Sub label text</template>\n * </bento-checkbox>\n * `,\n * }\n */\n export default defineComponent({\n name: 'bento-checkbox',\n i18n: { messages },\n components: {\n BentoTag,\n BentoTypography,\n CheckboxInput,\n ErrorMessage,\n },\n model: { prop: 'modelValue' },\n props: {\n /**\n * @deprecated from version 2.0.0. Use the aria-label attribute instead.\n */\n /**\n * Accessible name for the radio button component. It is strongly recommended to pas this value in case this component is used without a label.\n */\n ariaLabel: { type: String, default: null },\n\n /**\n * Setting this property to true will disable the checkbox in your form.\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Renders the checkbox in an error state with an error message.\n */\n errorMessage: { type: String, default: null },\n\n /**\n * Setting this property to true will show the checkbox in error state.\n */\n hasError: { type: Boolean, default: false },\n\n /**\n * The :indeterminate CSS pseudo-class represents any form element\n * whose state is indeterminate, such as checkboxes which have their HTML indeterminate attribute\n * set to true, radio buttons which are members of a group in which all radio buttons are unchecked,\n * and indeterminate <progress> elements. https://developer.mozilla.org/en-US/docs/Web/CSS/:indeterminate\n * This property lets you control the input.indeterminate native property.\n */\n indeterminate: { type: Boolean, default: false },\n\n /**\n * When handling a single checkbox with a singular state, use a boolean.\n *\n * When handling multiple checkboxes, use an array of keys.\n * These keys exist as a set \"value\" prop for each checkbox.\n */\n modelValue: {\n type: [Boolean, Array] as PropType<BentoCheckboxType | BentoCheckboxGroupItems>,\n default: false,\n },\n\n /**\n * Highlights the checkbox is optional.\n */\n optional: { type: Boolean, default: false },\n\n /**\n * Setting this property to true will set the checkbox to read only state.\n */\n readonly: { type: Boolean, default: false },\n\n /**\n * Highlights the checkbox is required.\n */\n required: { type: Boolean, default: false },\n\n /**\n * Sets the properties of the BentoTag component that is placed next to the label.\n * {@see BentoTag}\n */\n tag: { type: Object as PropType<BentoCheckboxTag>, default: undefined },\n\n /**\n * The value of the component. The DOM API casts this to a string.\n * The browser uses \"on\" as the default value.\n *\n * In the case of multiple checkboxes this value is used as a unique key.\n */\n value: { type: [String, Number], default: null },\n },\n emits: [BentoCheckboxEvent.UPDATE, BentoCheckboxEvent.INPUT],\n setup(props, { attrs, emit, slots }) {\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const descriptionId = generateUid('description');\n const errorId = generateUid('error');\n const hasSlot = useHasSlot(slots);\n\n const { disabled, indeterminate, modelValue, readonly, value } = toRefs(props);\n\n const defaultSlotValue = getSlotText(slots)('default');\n const descriptionSlotValue = getSlotText(slots)('description');\n\n useDefaultSlotValidator('bento-checkbox', slots.default, slots.description);\n\n const isCheckboxGroup = computed(() => Array.isArray(modelValue.value));\n const isChecked = computed(() => {\n if (!isCheckboxGroup.value) {\n return modelValue.value as boolean;\n }\n\n return (modelValue.value as BentoMultiCheckboxType).some(item => item === value.value);\n });\n const isIndeterminate = computed(() => indeterminate.value);\n\n const shouldShowError = computed(\n () => !props.disabled && !props.readonly && (props.hasError || !!props.errorMessage)\n );\n const shouldShowErrorMessage = computed(() => !props.disabled && !props.readonly && !!props.errorMessage);\n\n // Content slot logic\n const hasContentSlot = computed(() => hasSlot('content'));\n const isCheckedOrIntermediate = computed(() => isIndeterminate?.value || isChecked?.value);\n const contentSlotAvailable = computed(\n () => hasContentSlot?.value && isCheckboxGroup?.value && isCheckedOrIntermediate?.value\n );\n\n // ARIA fields\n const ariaChecked = computed<HTMLAttributes['aria-checked']>(() =>\n isIndeterminate.value ? 'mixed' : `${!!isChecked.value}`\n );\n\n const ariaDescribedBy = computed<HTMLAttributes['aria-describedby']>(\n () =>\n `${shouldShowErrorMessage.value ? errorId : ''} ${\n defaultSlotValue && descriptionSlotValue ? descriptionId : ''\n }`.trim() || null\n );\n\n const ariaLabelAttribute = ref(attrs['aria-label']);\n const { ariaLabel } = toRefs(props);\n const computedAriaLabel = useAriaLabel({\n ariaLabel: ariaLabelAttribute.value as string,\n // TODO: take this line away when the aria-label props is removed\n label: ariaLabel,\n defaultFallback: hasSlot('default')\n ? (getSlotText(slots)('default') as string)\n : t('ariaLabelFallback'),\n });\n\n const ariaInvalid = computed<HTMLAttributes['aria-invalid']>(() => shouldShowError.value);\n\n const conditionalClass = computed(() => ({\n [`b-checkbox--${BentoCheckboxState.DISABLED}`]: disabled.value,\n [`b-checkbox--${BentoCheckboxState.READONLY}`]: readonly.value,\n }));\n\n const onChange = (newValue: BentoCheckboxType | BentoCheckboxGroupItems) => {\n if (disabled.value) {\n return;\n }\n emit(BentoCheckboxEvent.UPDATE, newValue);\n emit(BentoCheckboxEvent.INPUT, newValue);\n };\n\n return {\n // Values\n descriptionId,\n errorId,\n ariaChecked,\n ariaDescribedBy,\n ariaInvalid,\n computedAriaLabel,\n conditionalClass,\n defaultSlotValue,\n descriptionSlotValue,\n isCheckboxGroup,\n isChecked,\n isIndeterminate,\n shouldShowError,\n shouldShowErrorMessage,\n contentSlotAvailable,\n hasContentSlot,\n\n // Methods\n hasSlot,\n onChange,\n\n t,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./checkbox.scss\" />\n"],"names":["BentoCheckboxEvent","BentoCheckboxEvent2","_sfc_main","defineComponent","messages","BentoTag","BentoTypography","CheckboxInput","ErrorMessage","props","attrs","emit","slots","t","useI18n","descriptionId","generateUid","errorId","hasSlot","useHasSlot","disabled","indeterminate","modelValue","readonly","value","toRefs","defaultSlotValue","getSlotText","descriptionSlotValue","useDefaultSlotValidator","isCheckboxGroup","computed","isChecked","item","isIndeterminate","shouldShowError","shouldShowErrorMessage","hasContentSlot","isCheckedOrIntermediate","contentSlotAvailable","ariaChecked","ariaDescribedBy","ariaLabelAttribute","ref","ariaLabel","computedAriaLabel","useAriaLabel","ariaInvalid","conditionalClass","CheckboxInputState","newValue"],"mappings":";;;;;;;;;;;;;AAMY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,SAAA,sBACAA,EAAA,QAAA,SAFQA,IAAAD,KAAA,CAAA,CAAA;;;;;;;GC+EZE,IAAAC,EAAA;AAAA,EAAA,MAAA;AAAA,EACA,MAAA,EAAA,UAAAC,EAAA;AAAA,EACA,YAAA;AAAA,IACA,UAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,cAAAC;AAAA,EACA;AAAA,EACA,OAAA,EAAA,MAAA,aAAA;AAAA,EACA,OAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IACA,WAAA,EAAA,MAAA,QAAA,SAAA,KAAA;AAAA;AAAA;AAAA;AAAA,IAOA,UAAA,EAAA,MAAA,SAAA,SAAA,GAAA;AAAA;AAAA;AAAA;AAAA,IAKA,cAAA,EAAA,MAAA,QAAA,SAAA,KAAA;AAAA;AAAA;AAAA;AAAA,IAKA,UAAA,EAAA,MAAA,SAAA,SAAA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAKA,eAAA,EAAA,MAAA,SAAA,SAAA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IASA,YAAA;AAAA,MAQA,MAAA,CAAA,SAAA,KAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IACA,UAAA,EAAA,MAAA,SAAA,SAAA,GAAA;AAAA;AAAA;AAAA;AAAA,IAKA,UAAA,EAAA,MAAA,SAAA,SAAA,GAAA;AAAA;AAAA;AAAA;AAAA,IAKA,UAAA,EAAA,MAAA,SAAA,SAAA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAKA,KAAA,EAAA,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A,MAAA;AAAA,MAwBA,GAAArC;AAAA,IAEA;AAAA,EACA;AAEA,CAAA;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"checkbox.B3u_hzUo.js","sources":["../../src/components/checkbox/checkbox.types.ts","../../src/components/checkbox/checkbox.vue"],"sourcesContent":["import type { BentoTag } from '@/components/tag';\nimport type { BentoCheckboxType, BentoMultiCheckboxType } from '../internal/checkbox-input';\nimport { BentoCheckboxState } from '../internal/checkbox-input';\n\nexport { BentoCheckboxState, BentoCheckboxType, BentoMultiCheckboxType };\n\nexport enum BentoCheckboxEvent {\n UPDATE = 'update:model-value',\n INPUT = 'input',\n}\n\nexport type BentoCheckboxTag = InstanceType<typeof BentoTag>['$props'];\n","<template>\n <label class=\"b-checkbox\" :class=\"conditionalClass\">\n <checkbox-input\n ref=\"input\"\n v-bind=\"$attrs\"\n :aria-label=\"computedAriaLabel\"\n :aria-describedby=\"ariaDescribedBy\"\n :disabled=\"disabled\"\n :has-error=\"shouldShowError\"\n :indeterminate=\"isIndeterminate\"\n :value=\"value\"\n :model-value=\"modelValue\"\n :readonly=\"readonly\"\n @update:model-value=\"onChange\"\n />\n <span v-if=\"hasSlot('default') || shouldShowErrorMessage\" class=\"b-checkbox__text\">\n <bento-typography v-if=\"hasSlot('default')\" class=\"b-checkbox__label\" el=\"span\" variant=\"body\">\n <span><slot /></span>\n <bento-typography v-if=\"optional\" class=\"b-checkbox__label-requirement\" el=\"span\"\n >({{ t('optional') }})</bento-typography\n >\n <bento-typography v-else-if=\"required\" class=\"b-checkbox__label-requirement\" el=\"span\"\n >({{ t('required') }})</bento-typography\n >\n <bento-tag v-if=\"tag\" class=\"b-checkbox__label-tag\" v-bind=\"tag\" />\n </bento-typography>\n <bento-typography\n v-if=\"hasSlot('default') && hasSlot('description')\"\n :id=\"descriptionId\"\n class=\"b-checkbox__description\"\n el=\"span\"\n variant=\"body\"\n >\n <slot name=\"description\"></slot>\n </bento-typography>\n <error-message v-if=\"shouldShowErrorMessage\" :id=\"errorId\" :error-message=\"errorMessage\" />\n\n <bento-typography v-if=\"contentSlotAvailable\" class=\"b-checkbox__content\" el=\"span\" variant=\"body\">\n <slot name=\"content\"></slot>\n </bento-typography>\n </span>\n </label>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, PropType, ref, toRefs } from 'vue';\n import {\n BentoCheckboxEvent,\n BentoCheckboxState,\n BentoCheckboxTag,\n BentoCheckboxType,\n BentoMultiCheckboxType,\n } from './checkbox.types';\n import { BentoTypography } from '@/components/typography';\n import { CheckboxInput } from '@/components/internal/checkbox-input';\n import { ErrorMessage } from '@/components/internal/error-message';\n import type { HTMLAttributes } from 'vue/types/jsx';\n import { useDefaultSlotValidator, useHasSlot } from '@/composables';\n import { generateUid } from '@/utils/ts/unique-id';\n import { getSlotText } from '@/utils/ts/get-slot-text';\n import { useI18n } from '@/utils/ts/i18n';\n import { useAriaLabel } from '@/utils/ts/aria-label';\n import { BentoTag } from '@/components/tag';\n import { BentoCheckboxGroupItems } from './components/checkbox-group/checkbox-group.types';\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n /**\n * Checkboxes are used to make a binary choice about an option.\n * The label tag area is also clickable.\n *\n * @usage\n * import { BentoCheckbox } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoCheckbox },\n * template: `\n * <bento-checkbox>\n * Label text\n * <template #description>Sub label text</template>\n * </bento-checkbox>\n * `,\n * }\n */\n export default defineComponent({\n name: 'bento-checkbox',\n i18n: { messages },\n components: {\n BentoTag,\n BentoTypography,\n CheckboxInput,\n ErrorMessage,\n },\n model: { prop: 'modelValue' },\n props: {\n /**\n * @deprecated from version 2.0.0. Use the aria-label attribute instead.\n */\n /**\n * Accessible name for the radio button component. It is strongly recommended to pas this value in case this component is used without a label.\n */\n ariaLabel: { type: String, default: null },\n\n /**\n * Setting this property to true will disable the checkbox in your form.\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Renders the checkbox in an error state with an error message.\n */\n errorMessage: { type: String, default: null },\n\n /**\n * Setting this property to true will show the checkbox in error state.\n */\n hasError: { type: Boolean, default: false },\n\n /**\n * The :indeterminate CSS pseudo-class represents any form element\n * whose state is indeterminate, such as checkboxes which have their HTML indeterminate attribute\n * set to true, radio buttons which are members of a group in which all radio buttons are unchecked,\n * and indeterminate <progress> elements. https://developer.mozilla.org/en-US/docs/Web/CSS/:indeterminate\n * This property lets you control the input.indeterminate native property.\n */\n indeterminate: { type: Boolean, default: false },\n\n /**\n * When handling a single checkbox with a singular state, use a boolean.\n *\n * When handling multiple checkboxes, use an array of keys.\n * These keys exist as a set \"value\" prop for each checkbox.\n */\n modelValue: {\n type: [Boolean, Array] as PropType<BentoCheckboxType | BentoCheckboxGroupItems>,\n default: false,\n },\n\n /**\n * Highlights the checkbox is optional.\n */\n optional: { type: Boolean, default: false },\n\n /**\n * Setting this property to true will set the checkbox to read only state.\n */\n readonly: { type: Boolean, default: false },\n\n /**\n * Highlights the checkbox is required.\n */\n required: { type: Boolean, default: false },\n\n /**\n * Sets the properties of the BentoTag component that is placed next to the label.\n * {@see BentoTag}\n */\n tag: { type: Object as PropType<BentoCheckboxTag>, default: undefined },\n\n /**\n * The value of the component. The DOM API casts this to a string.\n * The browser uses \"on\" as the default value.\n *\n * In the case of multiple checkboxes this value is used as a unique key.\n */\n value: { type: [String, Number], default: null },\n },\n emits: [BentoCheckboxEvent.UPDATE, BentoCheckboxEvent.INPUT],\n setup(props, { attrs, emit, slots }) {\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const descriptionId = generateUid('description');\n const errorId = generateUid('error');\n const hasSlot = useHasSlot(slots);\n\n const { disabled, indeterminate, modelValue, readonly, value } = toRefs(props);\n\n const defaultSlotValue = getSlotText(slots)('default');\n const descriptionSlotValue = getSlotText(slots)('description');\n\n useDefaultSlotValidator('bento-checkbox', slots.default, slots.description);\n\n const isCheckboxGroup = computed(() => Array.isArray(modelValue.value));\n const isChecked = computed(() => {\n if (!isCheckboxGroup.value) {\n return modelValue.value as boolean;\n }\n\n return (modelValue.value as BentoMultiCheckboxType).some(item => item === value.value);\n });\n const isIndeterminate = computed(() => indeterminate.value);\n\n const shouldShowError = computed(\n () => !props.disabled && !props.readonly && (props.hasError || !!props.errorMessage)\n );\n const shouldShowErrorMessage = computed(() => !props.disabled && !props.readonly && !!props.errorMessage);\n\n // Content slot logic\n const hasContentSlot = computed(() => hasSlot('content'));\n const isCheckedOrIntermediate = computed(() => isIndeterminate?.value || isChecked?.value);\n const contentSlotAvailable = computed(\n () => hasContentSlot?.value && isCheckboxGroup?.value && isCheckedOrIntermediate?.value\n );\n\n // ARIA fields\n const ariaChecked = computed<HTMLAttributes['aria-checked']>(() =>\n isIndeterminate.value ? 'mixed' : `${!!isChecked.value}`\n );\n\n const ariaDescribedBy = computed<HTMLAttributes['aria-describedby']>(\n () =>\n `${shouldShowErrorMessage.value ? errorId : ''} ${\n defaultSlotValue && descriptionSlotValue ? descriptionId : ''\n }`.trim() || null\n );\n\n const ariaLabelAttribute = ref(attrs['aria-label']);\n const { ariaLabel } = toRefs(props);\n const computedAriaLabel = useAriaLabel({\n ariaLabel: ariaLabelAttribute.value as string,\n // TODO: take this line away when the aria-label props is removed\n label: ariaLabel,\n defaultFallback: hasSlot('default') ? (getSlotText(slots)('default') as string) : t('checkbox'),\n });\n\n const ariaInvalid = computed<HTMLAttributes['aria-invalid']>(() => shouldShowError.value);\n\n const conditionalClass = computed(() => ({\n [`b-checkbox--${BentoCheckboxState.DISABLED}`]: disabled.value,\n [`b-checkbox--${BentoCheckboxState.READONLY}`]: readonly.value,\n }));\n\n const onChange = (newValue: BentoCheckboxType | BentoCheckboxGroupItems) => {\n if (disabled.value) {\n return;\n }\n emit(BentoCheckboxEvent.UPDATE, newValue);\n emit(BentoCheckboxEvent.INPUT, newValue);\n };\n\n return {\n // Values\n descriptionId,\n errorId,\n ariaChecked,\n ariaDescribedBy,\n ariaInvalid,\n computedAriaLabel,\n conditionalClass,\n defaultSlotValue,\n descriptionSlotValue,\n isCheckboxGroup,\n isChecked,\n isIndeterminate,\n shouldShowError,\n shouldShowErrorMessage,\n contentSlotAvailable,\n hasContentSlot,\n\n // Methods\n hasSlot,\n onChange,\n\n t,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./checkbox.scss\" />\n"],"names":["BentoCheckboxEvent","BentoCheckboxEvent2","_sfc_main","defineComponent","messages","BentoTag","BentoTypography","CheckboxInput","ErrorMessage","props","attrs","emit","slots","t","useI18n","descriptionId","generateUid","errorId","hasSlot","useHasSlot","disabled","indeterminate","modelValue","readonly","value","toRefs","defaultSlotValue","getSlotText","descriptionSlotValue","useDefaultSlotValidator","isCheckboxGroup","computed","isChecked","item","isIndeterminate","shouldShowError","shouldShowErrorMessage","hasContentSlot","isCheckedOrIntermediate","contentSlotAvailable","ariaChecked","ariaDescribedBy","ariaLabelAttribute","ref","ariaLabel","computedAriaLabel","useAriaLabel","ariaInvalid","conditionalClass","CheckboxInputState","newValue"],"mappings":";;;;;;;;;;;;;AAMY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,SAAA,sBACAA,EAAA,QAAA,SAFQA,IAAAD,KAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;GC+EZE,IAAAC,EAAA;AAAA,EAAA,MAAA;AAAA,EACA,MAAA,EAAA,UAAAC,EAAA;AAAA,EACA,YAAA;AAAA,IACA,UAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,cAAAC;AAAA,EACA;AAAA,EACA,OAAA,EAAA,MAAA,aAAA;AAAA,EACA,OAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IACA,WAAA,EAAA,MAAA,QAAA,SAAA,KAAA;AAAA;AAAA;AAAA;AAAA,IAOA,UAAA,EAAA,MAAA,SAAA,SAAA,GAAA;AAAA;AAAA;AAAA;AAAA,IAKA,cAAA,EAAA,MAAA,QAAA,SAAA,KAAA;AAAA;AAAA;AAAA;AAAA,IAKA,UAAA,EAA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AAWA,WAAA;AAAA;AAAA,MAAA,eAAAR;AAAA,MAEA,SAAAE;AAAA,MACA,aAAAuB;AAAA,MACA,iBAAAC;AAAA,MACA,aAAAM;AAAA,MACA,mBAAAF;AAAA,MACA,kBAAAG;AAAA,MACA,kBAAAtB;AAAA,MACA,sBAAAE;AAAA,MACA,iBAAAE;AAAA,MACA,WAAAE;AAAA,MACA,iBAAAE;AAAA,MACA,iBAAAC;AAAA,MACA,wBAAAC;AAAA,MACA,sBAAAG;AAAA,MACA,gBAAAF;AAAA;AAAA,MACA,SAAAnB;AAAA,MAGA,UA5BA,CAAAgC,MAAA;AACA,QAAA9B,EAAA,UAGAT,EAAAX,EAAA,QAAAkD,CAAA,GACAvC,EAAAX,EAAA,OAAAkD,CAAA;AAAA,MAAA;AAAA,MAwBA,GAAArC;AAAA,IAEA;AAAA,EACA;AAEA,CAAA;;;;;;;;;;;;;"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { defineComponent as j, ref as d, computed as l, shallowRef as x, onMounted as R, watch as
|
|
2
|
-
import { s as
|
|
1
|
+
import { defineComponent as j, ref as d, computed as l, shallowRef as x, onMounted as R, watch as D, watchEffect as J } from "vue";
|
|
2
|
+
import { s as P, H as V, t as n, j as G, x as $, a as U, b as W, p as z, E as F, h as X, k as Y, i as K, c as L, d as N, l as q, e as Q, C as h } from "./codemirror.BlV6WO5w.js";
|
|
3
3
|
import { B as Z, a as ee, b as te, c as ne } from "./es6.BvpG4Oi6.js";
|
|
4
|
-
import { B as ae } from "./dropdown.
|
|
4
|
+
import { B as ae } from "./dropdown.B4KMM58m.js";
|
|
5
5
|
import { B as oe } from "./button.79klAcOK.js";
|
|
6
6
|
import { B as se } from "./typography.CqQaHXhq.js";
|
|
7
7
|
import { B as ie } from "./loading-indicator.DXc7I1Lm.js";
|
|
8
8
|
import { u as le } from "./i18n.BQkEbtPM.js";
|
|
9
9
|
import { E as re } from "./expand.CwwKq7Uc.js";
|
|
10
|
-
import { h as ce } from "./base-modal.
|
|
11
|
-
import { C as de } from "./copy.
|
|
12
|
-
import { B as
|
|
13
|
-
import { n as
|
|
10
|
+
import { h as ce } from "./base-modal.BaHkDH5f.js";
|
|
11
|
+
import { C as de } from "./copy.CmxcGt77.js";
|
|
12
|
+
import { B as ge } from "./tooltip.BN6fOXzi.js";
|
|
13
|
+
import { n as ue } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
|
|
14
14
|
import "../assets/code-snippet.css";
|
|
15
15
|
const pe = {
|
|
16
16
|
red: Z,
|
|
@@ -18,7 +18,7 @@ const pe = {
|
|
|
18
18
|
green: te,
|
|
19
19
|
blue: ne,
|
|
20
20
|
invalid: "#ffffff"
|
|
21
|
-
}, fe = (e, t) =>
|
|
21
|
+
}, fe = (e, t) => V.define([
|
|
22
22
|
{
|
|
23
23
|
tag: n.keyword,
|
|
24
24
|
color: e.red
|
|
@@ -85,10 +85,10 @@ const pe = {
|
|
|
85
85
|
tag: n.invalid,
|
|
86
86
|
color: e.invalid
|
|
87
87
|
}
|
|
88
|
-
]), me = (e) =>
|
|
89
|
-
var
|
|
88
|
+
]), me = (e) => P(fe(pe, e));
|
|
89
|
+
var g = /* @__PURE__ */ ((e) => (e.INLINE = "inline", e.SINGLELINE = "singleline", e.MULTILINE = "multiline", e))(g || {}), s = /* @__PURE__ */ ((e) => (e.JSON = "json", e.XML = "xml", e.JAVA = "java", e.JAVASCRIPT = "javascript", e.PYTHON = "python", e))(s || {}), r = /* @__PURE__ */ ((e) => (e.ACTION = "action", e.CHANGE = "change", e))(r || {});
|
|
90
90
|
const be = {
|
|
91
|
-
[s.JSON]:
|
|
91
|
+
[s.JSON]: G,
|
|
92
92
|
[s.XML]: $,
|
|
93
93
|
[s.JAVASCRIPT]: U,
|
|
94
94
|
[s.JAVA]: W,
|
|
@@ -111,8 +111,17 @@ ${_e(e, o)}`;
|
|
|
111
111
|
}
|
|
112
112
|
}, ye = {
|
|
113
113
|
"en-US": {
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
expand: "Expand",
|
|
115
|
+
nothingToDisplay: "Nothing to display",
|
|
116
|
+
run: "Run"
|
|
117
|
+
},
|
|
118
|
+
"pt-BR": {
|
|
119
|
+
expand: "Expandir",
|
|
120
|
+
nothingToDisplay: "Nada para exibir"
|
|
121
|
+
},
|
|
122
|
+
"ja-JP": {
|
|
123
|
+
expand: "展開",
|
|
124
|
+
nothingToDisplay: "表示するものがありません"
|
|
116
125
|
}
|
|
117
126
|
}, Ce = j({
|
|
118
127
|
i18n: { messages: ye },
|
|
@@ -126,15 +135,15 @@ ${_e(e, o)}`;
|
|
|
126
135
|
BentoLoadingIndicator: ie,
|
|
127
136
|
ExpandIcon: re
|
|
128
137
|
},
|
|
129
|
-
directives: { BentoTooltipDirective:
|
|
138
|
+
directives: { BentoTooltipDirective: ge },
|
|
130
139
|
props: {
|
|
131
140
|
/**
|
|
132
141
|
* Defines the variant of code-snippet
|
|
133
142
|
*/
|
|
134
143
|
variant: {
|
|
135
144
|
type: String,
|
|
136
|
-
default:
|
|
137
|
-
validator: (e) => Object.values(
|
|
145
|
+
default: g.MULTILINE,
|
|
146
|
+
validator: (e) => Object.values(g).includes(e)
|
|
138
147
|
},
|
|
139
148
|
/**
|
|
140
149
|
* Language name for syntax highlighting rules
|
|
@@ -200,21 +209,21 @@ ${_e(e, o)}`;
|
|
|
200
209
|
emits: [r.ACTION, r.CHANGE],
|
|
201
210
|
setup(e, { emit: t }) {
|
|
202
211
|
const { t: a } = le(), o = d(null), _ = [], c = () => {
|
|
203
|
-
}, A = l(() => e.langLabel ?? e.lang.toUpperCase()),
|
|
204
|
-
"b-code-snippet--inline":
|
|
205
|
-
"b-code-snippet--scrollable": !
|
|
206
|
-
})),
|
|
212
|
+
}, A = l(() => e.langLabel ?? e.lang.toUpperCase()), u = l(() => e.variant === g.INLINE), I = l(() => ({
|
|
213
|
+
"b-code-snippet--inline": u.value,
|
|
214
|
+
"b-code-snippet--scrollable": !u.value
|
|
215
|
+
})), T = l(() => ({
|
|
207
216
|
"b-code-snippet__code-area-content--editable": e.editable
|
|
208
|
-
})),
|
|
217
|
+
})), E = he(e.lang), v = x(), p = x(), w = new h(), B = new h(), S = new h(), i = d(null), f = d(0);
|
|
209
218
|
R(async () => {
|
|
210
|
-
const m = await
|
|
219
|
+
const m = await E();
|
|
211
220
|
i.value = e.content;
|
|
212
221
|
const M = ({ state: b }) => {
|
|
213
222
|
i.value = b.doc.toString();
|
|
214
223
|
}, y = [
|
|
215
224
|
X(),
|
|
216
225
|
Y.of([K, ve]),
|
|
217
|
-
|
|
226
|
+
w.of(m()),
|
|
218
227
|
B.of(me(e.lang)),
|
|
219
228
|
S.of(L.readOnly.of(!e.editable)),
|
|
220
229
|
N.updateListener.of((b) => M(b))
|
|
@@ -228,7 +237,7 @@ ${_e(e, o)}`;
|
|
|
228
237
|
state: C,
|
|
229
238
|
parent: v.value
|
|
230
239
|
});
|
|
231
|
-
}),
|
|
240
|
+
}), D(
|
|
232
241
|
() => e.content,
|
|
233
242
|
() => {
|
|
234
243
|
if (e.content !== i.value) {
|
|
@@ -246,14 +255,14 @@ ${_e(e, o)}`;
|
|
|
246
255
|
const k = l(() => a(e.actionableText)), O = () => {
|
|
247
256
|
t(r.ACTION, i.value);
|
|
248
257
|
};
|
|
249
|
-
|
|
258
|
+
J(() => {
|
|
250
259
|
i.value !== null && t(r.CHANGE, i.value);
|
|
251
260
|
});
|
|
252
261
|
const H = d(!1);
|
|
253
262
|
return {
|
|
254
263
|
// Values
|
|
255
264
|
availableLanguages: _,
|
|
256
|
-
codeAreaContentConditionalClasses:
|
|
265
|
+
codeAreaContentConditionalClasses: T,
|
|
257
266
|
conditionalClasses: I,
|
|
258
267
|
container: v,
|
|
259
268
|
currentContents: i,
|
|
@@ -261,7 +270,7 @@ ${_e(e, o)}`;
|
|
|
261
270
|
editor: p,
|
|
262
271
|
selectedLanguage: o,
|
|
263
272
|
showModal: H,
|
|
264
|
-
isInlineVariant:
|
|
273
|
+
isInlineVariant: u,
|
|
265
274
|
// Methods
|
|
266
275
|
handleChangeLanguage: c,
|
|
267
276
|
onActionClicked: O,
|
|
@@ -282,25 +291,25 @@ var xe = function() {
|
|
|
282
291
|
}, proxy: !0 }], null, !1, 3789760120) }) : t._e(), t.actionable ? a("bento-button", { attrs: { variant: "primary", tertiary: "", condensed: "" }, on: { click: t.onActionClicked }, scopedSlots: t._u([{ key: "iconLeft", fn: function() {
|
|
283
292
|
return [a("bento-typography", { staticClass: "b-code-snippet__action-button", attrs: { el: "span" } }, [t._v(" " + t._s(t.runText) + " ")])];
|
|
284
293
|
}, proxy: !0 }], null, !1, 4293069853) }) : t._e()], 1)]), t.content || t.editable ? a("code", { staticClass: "b-code-snippet__code-area" }, [a("div", { ref: "container", staticClass: "b-code-snippet__code-area-content", class: t.codeAreaContentConditionalClasses })]) : a("section", [t._t("empty-state", function() {
|
|
285
|
-
return [a("div", { staticClass: "b-code-snippet__empty-state" }, [t._v("
|
|
294
|
+
return [a("div", { staticClass: "b-code-snippet__empty-state" }, [t._v(t._s(t.t("nothingToDisplay")))])];
|
|
286
295
|
})], 2), t.expandable ? a("base-modal", { staticClass: "b-code-snippet__modal", attrs: { "hide-close-button": !0, "custom-padding": "0px", "is-dismissible": !0, "is-open": t.showModal, size: "large" }, on: { "close-modal": function(o) {
|
|
287
296
|
t.showModal = !1;
|
|
288
297
|
} }, scopedSlots: t._u([{ key: "content", fn: function() {
|
|
289
298
|
return [a("bento-code-snippet", t._b({}, "bento-code-snippet", { ...t.$props, expandable: !1 }, !1))];
|
|
290
299
|
}, proxy: !0 }], null, !1, 3343589027) }) : t._e()], 1);
|
|
291
|
-
}, Le = [], Ne = /* @__PURE__ */
|
|
300
|
+
}, Le = [], Ne = /* @__PURE__ */ ue(
|
|
292
301
|
Ce,
|
|
293
302
|
xe,
|
|
294
303
|
Le,
|
|
295
304
|
!1,
|
|
296
305
|
null,
|
|
297
|
-
"
|
|
306
|
+
"10a1a4c8"
|
|
298
307
|
);
|
|
299
|
-
const
|
|
308
|
+
const De = Ne.exports;
|
|
300
309
|
export {
|
|
301
|
-
|
|
310
|
+
g as B,
|
|
302
311
|
s as a,
|
|
303
312
|
r as b,
|
|
304
|
-
|
|
313
|
+
De as c
|
|
305
314
|
};
|
|
306
|
-
//# sourceMappingURL=code-snippet.
|
|
315
|
+
//# sourceMappingURL=code-snippet.BgjvWTHP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-snippet.BgjvWTHP.js","sources":["../../src/components/code-snippet/highlight.ts","../../src/components/code-snippet/code-snippet.types.ts","../../src/components/code-snippet/utils/get-lang-loader.ts","../../src/components/code-snippet/utils/indent-same-as-line-before-extension.ts","../../src/components/code-snippet/code-snippet.vue"],"sourcesContent":["import { HighlightStyle, syntaxHighlighting } from '@codemirror/language';\nimport { tags as t } from '@lezer/highlight';\nimport {\n BCodeSnippetCodeAreaHighlightBlue,\n BCodeSnippetCodeAreaHighlightGreen,\n BCodeSnippetCodeAreaHighlightOrange,\n BCodeSnippetCodeAreaHighlightRed,\n} from '@adyen/bento-design-tokens/dist/js/bento/es6';\nimport { BentoCodeSnippetSupportedLanguage } from './code-snippet.types';\n\nconst lightThemeColors = {\n red: BCodeSnippetCodeAreaHighlightRed,\n orange: BCodeSnippetCodeAreaHighlightOrange,\n green: BCodeSnippetCodeAreaHighlightGreen,\n blue: BCodeSnippetCodeAreaHighlightBlue,\n invalid: '#ffffff',\n};\n\nconst highlightStyle = (colors, language: BentoCodeSnippetSupportedLanguage | `${BentoCodeSnippetSupportedLanguage}`) =>\n HighlightStyle.define([\n {\n tag: t.keyword,\n color: colors.red,\n },\n {\n tag: [t.name, t.deleted, t.character, t.propertyName, t.macroName],\n color: colors.green,\n },\n {\n tag: [t.function(t.variableName), t.labelName],\n color: colors.blue,\n },\n {\n tag: [t.color, t.constant(t.name), t.standard(t.name)],\n color: colors.red,\n },\n {\n tag: [t.definition(t.name), ...(language !== 'json' ? [t.separator] : [])],\n color: colors.red,\n },\n {\n tag: [t.typeName, t.className, t.number, t.changed, t.annotation, t.modifier, t.self, t.namespace],\n color: colors.orange,\n },\n {\n tag: [t.operator, t.operatorKeyword, t.url, t.escape, t.regexp, t.link, t.special(t.string)],\n color: colors.blue,\n },\n {\n tag: [t.meta, t.comment],\n color: colors.orange,\n },\n {\n tag: t.strong,\n fontWeight: 'bold',\n },\n {\n tag: t.emphasis,\n fontStyle: 'italic',\n },\n {\n tag: t.strikethrough,\n textDecoration: 'line-through',\n },\n {\n tag: t.link,\n color: colors.orange,\n textDecoration: 'underline',\n },\n {\n tag: t.heading,\n fontWeight: 'bold',\n color: colors.blue,\n },\n {\n tag: [t.atom, t.bool, t.special(t.variableName)],\n color: colors.red,\n },\n {\n tag: [t.processingInstruction, t.string, t.inserted],\n color: colors.blue,\n },\n {\n tag: t.invalid,\n color: colors.invalid,\n },\n ]);\n\nexport const lightThemeHighlight = (\n language: BentoCodeSnippetSupportedLanguage | `${BentoCodeSnippetSupportedLanguage}`\n) => syntaxHighlighting(highlightStyle(lightThemeColors, language));\n","/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoCodeSnippetVariant {\n INLINE = 'inline',\n SINGLELINE = 'singleline',\n MULTILINE = 'multiline',\n}\n\n// These supported types need to be kept in line with the ones in packages/vue2/src/components/code-snippet/composables/useLanguage.ts function and vice-versa\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoCodeSnippetSupportedLanguage {\n JSON = 'json',\n XML = 'xml',\n JAVA = 'java',\n JAVASCRIPT = 'javascript',\n PYTHON = 'python',\n}\n\nexport enum BentoCodeSnippetEvent {\n ACTION = 'action',\n CHANGE = 'change',\n}\n","import { BentoCodeSnippetSupportedLanguage } from '@/components/code-snippet/code-snippet.types';\nimport { json } from '@codemirror/lang-json';\nimport { xml } from '@codemirror/lang-xml';\nimport { javascript } from '@codemirror/lang-javascript';\nimport { java } from '@codemirror/lang-java';\nimport { python } from '@codemirror/lang-python';\n\n/**\n * TODO: This should be handled with dynamic imports,\n * without relying on importing every single language/package available.\n * These supported types need to be kept in line with the ones in packages/vue2/src/components/code-snippet/code-snippet.types.ts enum\n */\nconst importsMap = {\n [BentoCodeSnippetSupportedLanguage.JSON]: json,\n [BentoCodeSnippetSupportedLanguage.XML]: xml,\n [BentoCodeSnippetSupportedLanguage.JAVASCRIPT]: javascript,\n [BentoCodeSnippetSupportedLanguage.JAVA]: java,\n [BentoCodeSnippetSupportedLanguage.PYTHON]: python,\n};\n\n/**\n * Returns a language loder for `CodeMirror`.\n * Supported languages: json, xml, javascript & java\n *\n * @param language Language to be used\n * @returns Language configuration loader to be used in codemirror\n */\nexport const getLangLoader = (language: BentoCodeSnippetSupportedLanguage | `${BentoCodeSnippetSupportedLanguage}`) => {\n const loadLang = async () => importsMap[language];\n\n return loadLang;\n};\n","import { EditorSelection, type EditorState, type SelectionRange } from '@codemirror/state';\n\n/**\n * Calculate indentation for a new line based on line before it.\n * @param state - The editor state\n * @param line - the selection range, in this case one line\n * @returns the indentation string to be pre-pended on a new line.\n */\nconst getIndentation = (state: EditorState, line: SelectionRange) => {\n const currentLine = state.doc.lineAt(line.from);\n const indentMatch = /^\\s*/.exec(currentLine.text);\n return indentMatch ? indentMatch[0] : '';\n};\n\n/**\n * This extension to codemirror will, upon pressing the 'Enter' key, indent the new line\n * the same as the line before it.\n */\nexport const INDENT_SAME_AS_LINE_BEFORE = {\n key: 'Enter',\n run: ({ state, dispatch }) => {\n const changes = state.changeByRange(range => {\n const indentation = getIndentation(state, range);\n const newText = `\\n${indentation}`;\n return {\n changes: { from: range.from, to: range.to, insert: newText },\n range: EditorSelection.cursor(range.from + newText.length),\n };\n });\n dispatch(state.update(changes, { scrollIntoView: true, userEvent: 'input' }));\n return true;\n },\n};\n\nexport default INDENT_SAME_AS_LINE_BEFORE;\n","<template>\n <div class=\"b-code-snippet\" :class=\"conditionalClasses\">\n <section v-if=\"!isInlineVariant\" class=\"b-code-snippet__action-bar\">\n <div class=\"b-code-snippet__action-bar--start\">\n <bento-dropdown\n v-if=\"availableLanguages.length > 0\"\n v-model=\"selectedLanguage\"\n v-bind=\"$props\"\n :disabled=\"availableLanguages.length === 1\"\n :items=\"availableLanguages\"\n class=\"b-code-snippet__language-picker\"\n @input=\"handleChangeLanguage\"\n />\n <bento-typography el=\"span\" stronger>\n {{ displayedLang }}\n </bento-typography>\n </div>\n <div class=\"b-code-snippet__action-bar--end\">\n <bento-loading-indicator v-if=\"loading\" />\n <copy v-if=\"currentContents !== null\" class=\"b-structured-list__icon\" :text=\"currentContents\" />\n <bento-button\n v-if=\"expandable\"\n variant=\"tertiary\"\n condensed\n :aria-label=\"t('expand')\"\n @click=\"showModal = true\"\n >\n <template #iconLeft>\n <expand-icon />\n </template>\n </bento-button>\n <bento-button v-if=\"actionable\" variant=\"primary\" tertiary condensed @click=\"onActionClicked\">\n <template #iconLeft>\n <bento-typography el=\"span\" class=\"b-code-snippet__action-button\">\n {{ runText }}\n </bento-typography>\n </template>\n </bento-button>\n </div>\n </section>\n <code v-if=\"content || editable\" class=\"b-code-snippet__code-area\">\n <div ref=\"container\" class=\"b-code-snippet__code-area-content\" :class=\"codeAreaContentConditionalClasses\" />\n </code>\n <section v-else>\n <slot name=\"empty-state\">\n <!-- TODO: switch with empty-state component when ready -->\n <div class=\"b-code-snippet__empty-state\">{{ t('nothingToDisplay') }}</div>\n </slot>\n </section>\n <base-modal\n v-if=\"expandable\"\n class=\"b-code-snippet__modal\"\n :hide-close-button=\"true\"\n :custom-padding=\"'0px'\"\n :is-dismissible=\"true\"\n :is-open=\"showModal\"\n size=\"large\"\n @close-modal=\"showModal = false\"\n >\n <template #content>\n <bento-code-snippet v-bind=\"{ ...$props, expandable: false }\" />\n </template>\n </base-modal>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, onMounted, PropType, ref, shallowRef, watch, watchEffect } from 'vue';\n import { EditorView, highlightActiveLine, keymap, lineNumbers } from '@codemirror/view';\n import { Compartment, EditorState } from '@codemirror/state';\n import { history, indentWithTab } from '@codemirror/commands';\n import { lightThemeHighlight } from './highlight';\n import { getLangLoader, INDENT_SAME_AS_LINE_BEFORE } from './utils';\n import { BentoDropdown } from '@/components/dropdown';\n import { BentoButton } from '@/components/button';\n import { BentoTypography } from '@/components/typography';\n import { BentoTooltipDirective } from '@/directives';\n import { BentoLoadingIndicator } from '@/components/loading-indicator';\n import { useI18n } from '@/utils/ts/i18n';\n import { Copy } from '@/internal';\n import ExpandIcon from '@adyen/ui-assets-icons-16/vue/expand';\n import {\n BentoCodeSnippetEvent,\n BentoCodeSnippetSupportedLanguage,\n BentoCodeSnippetVariant,\n } from '@/components/code-snippet/code-snippet.types';\n import BaseModal from '@/components/modal/components/base-modal/base-modal.vue';\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n /**\n * A code-snippet is a container to display code in a readable way.\n * Come with added functionalities like syntax highlighting, editing and actioning the code\n *\n * @example\n * import { BentoCodeSnippet } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoCodeSnippet },\n * template: `\n * <bento-code-snippet :variant=\"BentoCodeSnippetVariant.MULTILINE\" content=\"{ example: 1234 }\" />\n * `\n * }\n */\n export default defineComponent({\n i18n: { messages },\n name: 'bento-code-snippet',\n components: {\n BentoTypography,\n BentoButton,\n BentoDropdown,\n Copy,\n BaseModal,\n BentoLoadingIndicator,\n ExpandIcon,\n },\n directives: { BentoTooltipDirective },\n props: {\n /**\n * Defines the variant of code-snippet\n */\n variant: {\n type: String as PropType<BentoCodeSnippetVariant | `${BentoCodeSnippetVariant}`>,\n default: BentoCodeSnippetVariant.MULTILINE,\n validator: (value: BentoCodeSnippetVariant) => Object.values(BentoCodeSnippetVariant).includes(value),\n },\n /**\n * Language name for syntax highlighting rules\n */\n lang: {\n type: String as PropType<BentoCodeSnippetSupportedLanguage | `${BentoCodeSnippetSupportedLanguage}`>,\n default: BentoCodeSnippetSupportedLanguage.JSON,\n validator: (value: BentoCodeSnippetSupportedLanguage) =>\n Object.values(BentoCodeSnippetSupportedLanguage).includes(value),\n },\n /**\n * Label to show in the action-bar, describing the language\n */\n langLabel: {\n type: String,\n default: null,\n },\n /**\n * The code content\n */\n content: {\n type: String,\n default: '',\n },\n /**\n * Allows editing of the code-snippet content by the user\n */\n editable: {\n type: Boolean,\n default: false,\n },\n /**\n * Displays a button that when clicked will emit an action event\n * Leaves to the parent component the logic of what to do with it\n */\n actionable: {\n type: Boolean,\n default: false,\n },\n /**\n * Displays a button that can expand the codeblock into a modal to easily\n * view large blocks of code.\n */\n expandable: {\n type: Boolean,\n default: false,\n },\n /**\n * Displays a button that when clicked will emit a run event\n * Leaves to the parent component the logic of what to do with it\n */\n actionableText: {\n type: String,\n default: 'run',\n },\n /**\n * Toggles the loading indicator within the action bar\n */\n loading: {\n type: Boolean,\n default: false,\n },\n },\n emits: [BentoCodeSnippetEvent.ACTION, BentoCodeSnippetEvent.CHANGE],\n setup(props, { emit }) {\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n // language\n const selectedLanguage = ref<string | null>(null);\n const availableLanguages = []; // TODO: implement\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n const handleChangeLanguage = () => {};\n const displayedLang = computed(() => props.langLabel ?? props.lang.toUpperCase());\n\n const isInlineVariant = computed(() => props.variant === BentoCodeSnippetVariant.INLINE);\n\n const conditionalClasses = computed(() => ({\n 'b-code-snippet--inline': isInlineVariant.value,\n 'b-code-snippet--scrollable': !isInlineVariant.value,\n }));\n\n const codeAreaContentConditionalClasses = computed(() => ({\n 'b-code-snippet__code-area-content--editable': props.editable,\n }));\n\n const loadLang = getLangLoader(props.lang);\n\n const container = shallowRef<HTMLDivElement>();\n const editor = shallowRef<EditorView>();\n const languageConf = new Compartment();\n const editorTheme = new Compartment();\n const editorReadOnly = new Compartment();\n\n const currentContents = ref(null);\n const contentLength = ref(0);\n\n onMounted(async () => {\n const language = await loadLang();\n\n // alongside the updateListener plugin it acts as a watcher of changes to the editor state\n currentContents.value = props.content;\n const updateCurrentContents = ({ state }) => {\n currentContents.value = state.doc.toString();\n };\n\n const extensions = [\n highlightActiveLine(),\n keymap.of([indentWithTab, INDENT_SAME_AS_LINE_BEFORE]),\n languageConf.of(language()),\n editorTheme.of(lightThemeHighlight(props.lang)),\n\n editorReadOnly.of(EditorState.readOnly.of(!props.editable)),\n EditorView.updateListener.of(content => updateCurrentContents(content)),\n ];\n\n if (props.variant === 'multiline') {\n extensions.push([lineNumbers(), history()]);\n }\n\n const state = EditorState.create({\n doc: props.content,\n extensions: [...extensions],\n });\n contentLength.value = state.doc.length;\n\n editor.value = new EditorView({\n state,\n parent: container.value,\n });\n });\n watch(\n () => props.content,\n () => {\n if (props.content !== currentContents.value) {\n const upcomingContentLength = props.content.length;\n editor.value.dispatch({\n changes: {\n from: 0,\n to: contentLength.value,\n insert: props.content,\n },\n });\n contentLength.value = upcomingContentLength;\n }\n }\n );\n\n const runText = computed(() => t(props.actionableText as 'run'));\n const onActionClicked = () => {\n emit(BentoCodeSnippetEvent.ACTION, currentContents.value);\n };\n\n watchEffect(() => {\n if (currentContents.value !== null) {\n emit(BentoCodeSnippetEvent.CHANGE, currentContents.value);\n }\n });\n\n const showModal = ref(false);\n\n return {\n // Values\n availableLanguages,\n codeAreaContentConditionalClasses,\n conditionalClasses,\n container,\n currentContents,\n displayedLang,\n editor,\n selectedLanguage,\n showModal,\n isInlineVariant,\n\n // Methods\n handleChangeLanguage,\n onActionClicked,\n runText,\n\n // Translations\n t,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./code-snippet.scss\"></style>\n"],"names":["lightThemeColors","BCodeSnippetCodeAreaHighlightRed","BCodeSnippetCodeAreaHighlightOrange","BCodeSnippetCodeAreaHighlightGreen","BCodeSnippetCodeAreaHighlightBlue","highlightStyle","colors","language","HighlightStyle","tags","lightThemeHighlight","syntaxHighlighting","BentoCodeSnippetVariant","BentoCodeSnippetVariant2","BentoCodeSnippetSupportedLanguage","BentoCodeSnippetSupportedLanguage2","BentoCodeSnippetEvent","BentoCodeSnippetEvent2","importsMap","json","xml","javascript","java","python","getLangLoader","getIndentation","state","line","currentLine","indentMatch","INDENT_SAME_AS_LINE_BEFORE","dispatch","changes","range","newText","EditorSelection","_sfc_main","defineComponent","messages","BentoTypography","BentoButton","BentoDropdown","Copy","BaseModal","BentoLoadingIndicator","ExpandIcon","BentoTooltipDirective","value","props","emit","t","useI18n","selectedLanguage","ref","availableLanguages","handleChangeLanguage","displayedLang","computed","isInlineVariant","conditionalClasses","codeAreaContentConditionalClasses","loadLang","container","shallowRef","editor","languageConf","Compartment","editorTheme","editorReadOnly","currentContents","contentLength","onMounted","updateCurrentContents","state2","extensions","highlightActiveLine","keymap","indentWithTab","EditorState","EditorView","content","lineNumbers","history","watch","upcomingContentLength","runText","onActionClicked","watchEffect","showModal"],"mappings":";;;;;;;;;;;;;;AAUA,MAAAA,KAAA;AAAA,EAAyB,KAAAC;AAAA,EAChB,QAAAC;AAAA,EACG,OAAAC;AAAA,EACD,MAAAC;AAAA,EACD,SAAA;AAEV,GAEAC,KAAA,CAAAC,GAAAC,MAAAC,EAAA,OAAA;AAAA,EAC0B;AAAA,IAClB,KAAAC,EAAA;AAAA,IACW,OAAAH,EAAA;AAAA,EACO;AAAA,EAClB;AAAA,IACA,KAAA,CAAAG,EAAA,MAAAA,EAAA,SAAAA,EAAA,WAAAA,EAAA,cAAAA,EAAA,SAAA;AAAA,IACqE,OAAAH,EAAA;AAAA,EACnD;AAAA,EAClB;AAAA,IACA,KAAA,CAAAG,EAAA,SAAAA,EAAA,YAAA,GAAAA,EAAA,SAAA;AAAA,IACiD,OAAAH,EAAA;AAAA,EAC/B;AAAA,EAClB;AAAA,IACA,KAAA,CAAAG,EAAA,OAAAA,EAAA,SAAAA,EAAA,IAAA,GAAAA,EAAA,SAAAA,EAAA,IAAA,CAAA;AAAA,IACyD,OAAAH,EAAA;AAAA,EACvC;AAAA,EAClB;AAAA,IACA,KAAA,CAAAG,EAAA,WAAAA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AA,MACA,QAAAQ;AAAA,MACA,kBAAAZ;AAAA,MACA,WAAAoC;AAAA,MACA,iBAAA9B;AAAA;AAAA,MACA,sBAAAH;AAAA,MAGA,iBAAA+B;AAAA,MACA,SAAAD;AAAA;AAAA,MACA,GAAAnC;AAAA,IAGA;AAAA,EACA;AAEA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as d, useAttrs as p, computed as s } from "vue";
|
|
2
2
|
import { d as c, B as b } from "./typography.CqQaHXhq.js";
|
|
3
|
-
import { F as u } from "./error-message.
|
|
3
|
+
import { F as u } from "./error-message.GCYDEzGL.js";
|
|
4
4
|
import { n as _ } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
|
|
5
5
|
import "../assets/controls-group.css";
|
|
6
6
|
const f = {}, m = /* @__PURE__ */ d({
|
|
@@ -78,4 +78,4 @@ const B = g.exports;
|
|
|
78
78
|
export {
|
|
79
79
|
B as C
|
|
80
80
|
};
|
|
81
|
-
//# sourceMappingURL=controls-group.
|
|
81
|
+
//# sourceMappingURL=controls-group.DLBxlPfl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controls-group.
|
|
1
|
+
{"version":3,"file":"controls-group.DLBxlPfl.js","sources":["../../src/components/internal/controls-group/controls-group.vue"],"sourcesContent":["<template>\n <fieldset\n class=\"b-controls-group\"\n :class=\"conditionalClasses\"\n :form=\"form\"\n :disabled=\"disabled\"\n :aria-describedby=\"ariaAttributes['aria-describedby']\"\n >\n <legend class=\"b-controls-group__label-container\" :class=\"legendConditionalClasses\">\n <field-label\n v-if=\"label\"\n class=\"b-controls-group__label\"\n :label=\"label\"\n :tooltip-text=\"tooltipText\"\n :optional=\"optional\"\n :required=\"required\"\n />\n <bento-typography v-if=\"description\" class=\"b-controls-group__description\" el=\"span\">\n {{ description }}\n </bento-typography>\n </legend>\n <slot />\n </fieldset>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, useAttrs } from 'vue';\n import { BentoTypography } from '@/components/typography';\n import { FieldLabel } from '@/components/internal/field-label';\n import { deprecate } from '@/utils/ts/deprecate';\n\n const attrs = useAttrs();\n\n const props = defineProps({\n /**\n * Descriptive supporting text visbile underneath the label.\n */\n description: { type: String, default: null },\n\n /**\n * The name of the component to cite when throwing a depreacte error.\n */\n componentName: { type: String, required: true },\n\n /**\n * Sets all child controls of the <fieldset> as disabled.\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * The value of the id attribute of a <form> element the <fieldset> is to part of, even if it is not inside the form itself.\n */\n form: { type: String, default: null },\n\n /**\n * Shows/hides the group label.\n */\n hideLabel: { type: Boolean, default: null },\n\n /**\n * The name associated with the group. Required for accessibility purposes.\n * The label is shown when `hideLabel` is set to `true` or if `description` is passed\n */\n label: { type: String, required: true },\n\n /**\n * Indicates the field is optional.\n */\n optional: { type: Boolean, default: false },\n\n /**\n * Indicates the field is required.\n */\n required: { type: Boolean, default: false },\n\n /**\n * Tooltip message.\n */\n tooltipText: { type: String, default: null },\n });\n\n const ariaAttributes = computed(() => ({\n 'aria-describedby': attrs['aria-describedby']?.toString() as string,\n }));\n\n const conditionalClasses = computed(() => ({\n 'b-controls-group--disabled': props.disabled,\n }));\n\n const legendConditionalClasses = computed(() => {\n const isLabelAndDescriptionPresent = props.label && props.description;\n const shouldShowLabel = isLabelAndDescriptionPresent || props.hideLabel === false;\n\n return {\n 'b-controls-group__label-container--hidden': !shouldShowLabel,\n };\n });\n\n // eslint-disable-next-line eqeqeq -- Needs to show deprecate message when hideLabel is not set and no description available\n const hasNoPropsDefined = !props.description && props.hideLabel == undefined;\n if (hasNoPropsDefined) {\n deprecate(\n `${props.componentName}: The property \\`label\\` will always be rendered by default.`,\n `After version 2.0.0, the label will be shown by default.\n To continue hiding the label set \\`:hide-label=\"true\"\\`. Up until version 2.0.0, to display the label set \\`hide-label=\"false\"\\`.\n \\`label\\` will always be rendered when \\`description\\` is passed alongside with \\`label\\``,\n `2.0.0`\n );\n }\n</script>\n\n<script lang=\"ts\">\n /**\n * A controls group components should be used whenever it is necessary to group a set of controls (i.e. radio buttons or checkboxes)\n * This component conforms to the official WAI-ARIA guidelines for grouping controls: https://www.w3.org/WAI/tutorials/forms/grouping/\n *\n * NOTE: This component should not be used by itself but more implemented by other exported components\n * @example\n * import { ControlsGroup, BentoCheckbox, BentoRadioButton } from '@adyen/bento-vue2/';\n *\n * export default {\n * components: { ControlsGroup, BentoRadioButton },\n * template: `\n * <controls-group\n * label=\"Your group label\"\n * description=\"Description\"\n * >\n * <bento-radio-button\n * disabled\n * value=\"inputRadio\"\n * >\n * Label text\n * </bento-radio-button>\n * <bento-radio-button\n * value=\"inputRadio\"\n * >\n * Another label text\n * </bento-radio-button>\n * </controls-group>\n * `\n * };\n */\n export default {};\n</script>\n\n<style lang=\"scss\" scoped src=\"@/core/components/controls-group/controls-group.scss\" />\n"],"names":["__default__","attrs","useAttrs","ariaAttributes","computed","_a","conditionalClasses","props","legendConditionalClasses","hasNoPropsDefined","deprecate"],"mappings":";;;;;AA8II,MAAAA,IAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA/GAC,IAAAC,EAAA,GAkDAC,IAAAC,EAAA,MAAA;;AAAA;AAAA,QAAuC,qBAAAC,IAAAJ,EAAA,kBAAA,MAAA,gBAAAI,EAAA;AAAA,MACqB;AAAA,KAAA,GAG5DC,IAAAF,EAAA,OAAA;AAAA,MAA2C,8BAAAG,EAAA;AAAA,IACH,EAAA,GAGxCC,IAAAJ,EAAA,OAII;AAAA,MAAO,6CAAA,EAHPG,EAAA,SAAAA,EAAA,eACAA,EAAA,cAAA;AAAA,IAGkD,EAClD,GAIJE,IAAA,CAAAF,EAAA,eAAAA,EAAA,aAAA;AACA,WAAAE,KACIC;AAAA,MAAA,GAAAH,EAAA,aAAA;AAAA,MAC0B;AAAA,MACtB;AAAA,IAGA;;;;;;;;;;;;;;;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as v, ref as i, computed as s } from "vue";
|
|
2
2
|
import { B as _ } from "./button.79klAcOK.js";
|
|
3
3
|
import { d as f } from "./popper-container.CnWphJTN.js";
|
|
4
4
|
import { u as y } from "./i18n.BQkEbtPM.js";
|
|
5
5
|
import { n as c } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
|
|
6
6
|
import { B as C } from "./tooltip.BN6fOXzi.js";
|
|
7
7
|
import "../assets/copy.css";
|
|
8
|
-
var
|
|
8
|
+
var r = /* @__PURE__ */ ((o) => (o.DEFAULT = "default", o.COPYING = "copying", o.ERROR = "error", o))(r || {});
|
|
9
9
|
let a = 0;
|
|
10
10
|
const m = {
|
|
11
11
|
beforeCreate() {
|
|
@@ -25,11 +25,19 @@ var x = function() {
|
|
|
25
25
|
);
|
|
26
26
|
const T = g.exports, R = {
|
|
27
27
|
"en-US": {
|
|
28
|
-
copy: "Copy",
|
|
29
28
|
copied: "Copied!",
|
|
29
|
+
copy: "Copy",
|
|
30
30
|
copyFailed: "Copy failed. Try manually."
|
|
31
|
+
},
|
|
32
|
+
"pt-BR": {
|
|
33
|
+
copied: "Copiado!",
|
|
34
|
+
copy: "Copiar"
|
|
35
|
+
},
|
|
36
|
+
"ja-JP": {
|
|
37
|
+
copied: "コピーしました!",
|
|
38
|
+
copy: "コピー"
|
|
31
39
|
}
|
|
32
|
-
},
|
|
40
|
+
}, P = v({
|
|
33
41
|
i18n: { messages: R },
|
|
34
42
|
name: "copy",
|
|
35
43
|
components: { BentoButton: _, CopyIcon: T },
|
|
@@ -67,47 +75,47 @@ const T = g.exports, R = {
|
|
|
67
75
|
}
|
|
68
76
|
},
|
|
69
77
|
setup(o) {
|
|
70
|
-
const { t } = y(), e = i(
|
|
78
|
+
const { t } = y(), e = i(r.DEFAULT), n = i(!1), l = async () => {
|
|
71
79
|
try {
|
|
72
|
-
await navigator.clipboard.writeText(o.text), e.value =
|
|
80
|
+
await navigator.clipboard.writeText(o.text), e.value = r.COPYING, n.value = !0;
|
|
73
81
|
} catch {
|
|
74
|
-
e.value =
|
|
82
|
+
e.value = r.ERROR;
|
|
75
83
|
}
|
|
76
|
-
},
|
|
77
|
-
e.value =
|
|
78
|
-
},
|
|
84
|
+
}, p = () => {
|
|
85
|
+
e.value = r.DEFAULT, n.value = !1;
|
|
86
|
+
}, u = s(() => {
|
|
79
87
|
switch (e.value) {
|
|
80
|
-
case
|
|
88
|
+
case r.COPYING:
|
|
81
89
|
return t("copied");
|
|
82
|
-
case
|
|
90
|
+
case r.ERROR:
|
|
83
91
|
return t("copyFailed");
|
|
84
|
-
case
|
|
92
|
+
case r.DEFAULT:
|
|
85
93
|
default:
|
|
86
94
|
return t("copy");
|
|
87
95
|
}
|
|
88
|
-
}),
|
|
96
|
+
}), d = s(() => o != null && o.buttonText ? void 0 : t("copy"));
|
|
89
97
|
return {
|
|
90
|
-
copyText:
|
|
98
|
+
copyText: u,
|
|
91
99
|
onClickCopy: l,
|
|
92
|
-
resetText:
|
|
93
|
-
showScreenReaderAlert:
|
|
94
|
-
svgTitle:
|
|
100
|
+
resetText: p,
|
|
101
|
+
showScreenReaderAlert: n,
|
|
102
|
+
svgTitle: d,
|
|
95
103
|
// Translations
|
|
96
104
|
t
|
|
97
105
|
};
|
|
98
106
|
}
|
|
99
107
|
});
|
|
100
|
-
var
|
|
108
|
+
var h = function() {
|
|
101
109
|
var t = this, e = t._self._c;
|
|
102
110
|
return t._self._setupProxy, e("div", { staticClass: "b-copy", on: { mouseleave: t.resetText, focusout: t.resetText } }, [t.$slots.default ? e("span", { directives: [{ name: "bento-tooltip-directive", rawName: "v-bento-tooltip-directive:[tooltipPosition]", value: t.copyText, expression: "copyText", arg: t.tooltipPosition }], on: { click: t.onClickCopy } }, [t._t("default")], 2) : e("bento-button", t._b({ directives: [{ name: "bento-tooltip-directive", rawName: "v-bento-tooltip-directive:[tooltipPosition]", value: t.copyText, expression: "copyText", arg: t.tooltipPosition }], on: { click: t.onClickCopy }, scopedSlots: t._u([{ key: "iconLeft", fn: function() {
|
|
103
111
|
return [e("copy-icon", { attrs: { "svg-title": t.svgTitle } })];
|
|
104
112
|
}, proxy: !0 }, t.buttonText ? { key: "default", fn: function() {
|
|
105
113
|
return [t._v(" " + t._s(t.buttonText) + " ")];
|
|
106
114
|
}, proxy: !0 } : null], null, !0) }, "bento-button", t.button, !1)), t.showScreenReaderAlert ? e("div", { staticClass: "b-copy__screen-reader-alert", attrs: { role: "alert" } }, [t._v(t._s(t.t("copied")))]) : t._e()], 1);
|
|
107
|
-
},
|
|
115
|
+
}, w = [], H = /* @__PURE__ */ c(
|
|
116
|
+
P,
|
|
108
117
|
h,
|
|
109
118
|
w,
|
|
110
|
-
P,
|
|
111
119
|
!1,
|
|
112
120
|
null,
|
|
113
121
|
"5acdaec1"
|
|
@@ -115,6 +123,6 @@ var w = function() {
|
|
|
115
123
|
const A = H.exports;
|
|
116
124
|
export {
|
|
117
125
|
A as C,
|
|
118
|
-
|
|
126
|
+
r as a
|
|
119
127
|
};
|
|
120
|
-
//# sourceMappingURL=copy.
|
|
128
|
+
//# sourceMappingURL=copy.CmxcGt77.js.map
|