@adyen/bento-vue2 0.10.0 → 0.10.1-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@types/components/currency/currency.vue.d.ts +9 -0
- package/dist/@types/components/data-grid/data-grid.vue.d.ts +3 -3
- package/dist/@types/components/date/date.vue.d.ts +9 -0
- package/dist/@types/components/modal/components/base-modal/base-modal.vue.d.ts +10 -0
- package/dist/@types/components/modal/components/modal-default/modal-default.vue.d.ts +9 -0
- package/dist/@types/components/modal/components/modal-dialog/modal-dialog.vue.d.ts +9 -0
- package/dist/@types/components/modal/modal.vue.d.ts +11 -0
- package/dist/@types/components/segmented-control/components/segmented-control-button/segmented-control-button.vue.d.ts +1 -1
- package/dist/@types/components/segmented-control/index.d.ts +2 -0
- package/dist/@types/components/segmented-control/segmented-control.types.d.ts +8 -0
- package/dist/@types/components/segmented-control/segmented-control.vue.d.ts +53 -0
- package/dist/@types/components.d.ts +2 -4
- package/dist/@types/index.d.ts +1 -0
- package/dist/accordion.js +206 -0
- package/dist/accordion.js.map +1 -0
- package/dist/alert.js +103 -0
- package/dist/alert.js.map +1 -0
- package/dist/assets/base-button.css +1 -0
- package/dist/assets/button-actions.css +1 -0
- package/dist/assets/button.css +1 -0
- package/dist/assets/checkbox.css +1 -0
- package/dist/assets/checkmark-circle-fill.css +1 -0
- package/dist/assets/checkmark-small.css +1 -0
- package/dist/assets/chevron-left.css +1 -0
- package/dist/assets/chevron-up.css +1 -0
- package/dist/assets/copy.css +1 -0
- package/dist/assets/cross-circle-fill.css +1 -0
- package/dist/assets/cross-small.css +1 -0
- package/dist/assets/cross.css +1 -0
- package/dist/assets/dropdown.css +1 -0
- package/dist/assets/grid-layout.css +1 -0
- package/dist/assets/index.css +1 -0
- package/dist/assets/index10.css +1 -0
- package/dist/assets/index11.css +1 -0
- package/dist/assets/index12.css +1 -0
- package/dist/assets/index13.css +1 -0
- package/dist/assets/index14.css +1 -0
- package/dist/assets/index15.css +1 -0
- package/dist/assets/index16.css +1 -0
- package/dist/assets/index17.css +1 -0
- package/dist/assets/index18.css +1 -0
- package/dist/assets/index19.css +1 -0
- package/dist/assets/index2.css +1 -0
- package/dist/assets/index20.css +1 -0
- package/dist/assets/index21.css +1 -0
- package/dist/assets/index22.css +1 -0
- package/dist/assets/index23.css +1 -0
- package/dist/assets/index24.css +1 -0
- package/dist/assets/index25.css +1 -0
- package/dist/assets/index26.css +1 -0
- package/dist/assets/index27.css +1 -0
- package/dist/assets/index28.css +1 -0
- package/dist/assets/index29.css +1 -0
- package/dist/assets/index3.css +1 -0
- package/dist/assets/index30.css +1 -0
- package/dist/assets/index31.css +1 -0
- package/dist/assets/index32.css +1 -0
- package/dist/assets/index33.css +1 -0
- package/dist/assets/index34.css +1 -0
- package/dist/assets/index35.css +1 -0
- package/dist/assets/index36.css +1 -0
- package/dist/assets/index37.css +1 -0
- package/dist/assets/index38.css +1 -0
- package/dist/assets/index4.css +1 -0
- package/dist/assets/index5.css +1 -0
- package/dist/assets/index6.css +1 -0
- package/dist/assets/index7.css +1 -0
- package/dist/assets/index8.css +1 -0
- package/dist/assets/index9.css +1 -0
- package/dist/assets/info-filled.css +1 -0
- package/dist/assets/listbox-option-tag.css +1 -0
- package/dist/assets/listbox.css +1 -0
- package/dist/assets/search.css +1 -0
- package/dist/assets/tooltip.css +1 -0
- package/dist/avatar-image.js +7 -0
- package/dist/avatar-image.js.map +1 -0
- package/dist/badge.js +57 -0
- package/dist/badge.js.map +1 -0
- package/dist/button.js +110 -0
- package/dist/button.js.map +1 -0
- package/dist/card.js +178 -0
- package/dist/card.js.map +1 -0
- package/dist/checkbox.js +94 -0
- package/dist/checkbox.js.map +1 -0
- package/dist/chunks/_plugin-vue2_normalizer.71e2aa87.js +33 -0
- package/dist/chunks/_plugin-vue2_normalizer.71e2aa87.js.map +1 -0
- package/dist/chunks/aria-label.ac9651a5.js +13 -0
- package/dist/chunks/aria-label.ac9651a5.js.map +1 -0
- package/dist/chunks/base-button.38651156.js +83 -0
- package/dist/chunks/base-button.38651156.js.map +1 -0
- package/dist/chunks/button-actions.59406268.js +105 -0
- package/dist/chunks/button-actions.59406268.js.map +1 -0
- package/dist/chunks/button.31b757d1.js +102 -0
- package/dist/chunks/button.31b757d1.js.map +1 -0
- package/dist/chunks/checkbox.fab16cce.js +138 -0
- package/dist/chunks/checkbox.fab16cce.js.map +1 -0
- package/dist/chunks/checkmark-circle-fill.d1aa324d.js +26 -0
- package/dist/chunks/checkmark-circle-fill.d1aa324d.js.map +1 -0
- package/dist/chunks/checkmark-small.1371dd20.js +26 -0
- package/dist/chunks/checkmark-small.1371dd20.js.map +1 -0
- package/dist/chunks/chevron-left.e3a49e62.js +47 -0
- package/dist/chunks/chevron-left.e3a49e62.js.map +1 -0
- package/dist/chunks/chevron-up.416431cd.js +47 -0
- package/dist/chunks/chevron-up.416431cd.js.map +1 -0
- package/dist/chunks/copy.fa9aa27e.js +105 -0
- package/dist/chunks/copy.fa9aa27e.js.map +1 -0
- package/dist/chunks/cross-circle-fill.0a1d738c.js +26 -0
- package/dist/chunks/cross-circle-fill.0a1d738c.js.map +1 -0
- package/dist/chunks/cross-small.7ecb1b97.js +26 -0
- package/dist/chunks/cross-small.7ecb1b97.js.map +1 -0
- package/dist/chunks/cross.db1f9177.js +26 -0
- package/dist/chunks/cross.db1f9177.js.map +1 -0
- package/dist/chunks/directive.23e35ab0.js +21 -0
- package/dist/chunks/directive.23e35ab0.js.map +1 -0
- package/dist/chunks/dropdown.0d394d2f.js +771 -0
- package/dist/chunks/dropdown.0d394d2f.js.map +1 -0
- package/dist/chunks/grid-layout.14423a2e.js +69 -0
- package/dist/chunks/grid-layout.14423a2e.js.map +1 -0
- package/dist/chunks/hasSlot.dceac207.js +5 -0
- package/dist/chunks/hasSlot.dceac207.js.map +1 -0
- package/dist/chunks/i18n.8934ef6c.js +1695 -0
- package/dist/chunks/i18n.8934ef6c.js.map +1 -0
- package/dist/chunks/index.2e54c294.js +801 -0
- package/dist/chunks/index.2e54c294.js.map +1 -0
- package/dist/chunks/index.34eba2c4.js +107 -0
- package/dist/chunks/index.34eba2c4.js.map +1 -0
- package/dist/chunks/index.59dc2e3f.js +801 -0
- package/dist/chunks/index.59dc2e3f.js.map +1 -0
- package/dist/chunks/index.73d7902e.js +29 -0
- package/dist/chunks/index.73d7902e.js.map +1 -0
- package/dist/chunks/index.8c38e06b.js +441 -0
- package/dist/chunks/index.8c38e06b.js.map +1 -0
- package/dist/chunks/index.8e9cdc73.js +441 -0
- package/dist/chunks/index.8e9cdc73.js.map +1 -0
- package/dist/chunks/index.a7a22907.js +929 -0
- package/dist/chunks/index.a7a22907.js.map +1 -0
- package/dist/chunks/index.ad5e1dbd.js +107 -0
- package/dist/chunks/index.ad5e1dbd.js.map +1 -0
- package/dist/chunks/index.e2141d95.js +86 -0
- package/dist/chunks/index.e2141d95.js.map +1 -0
- package/dist/chunks/index.f4582460.js +86 -0
- package/dist/chunks/index.f4582460.js.map +1 -0
- package/dist/chunks/index.f55fdc32.js +1118 -0
- package/dist/chunks/index.f55fdc32.js.map +1 -0
- package/dist/chunks/info-filled.9748686e.js +26 -0
- package/dist/chunks/info-filled.9748686e.js.map +1 -0
- package/dist/chunks/listbox-option-tag.2e5c4012.js +111 -0
- package/dist/chunks/listbox-option-tag.2e5c4012.js.map +1 -0
- package/dist/chunks/listbox-option-tag.f44b4ee0.js +111 -0
- package/dist/chunks/listbox-option-tag.f44b4ee0.js.map +1 -0
- package/dist/chunks/listbox.152dab0a.js +485 -0
- package/dist/chunks/listbox.152dab0a.js.map +1 -0
- package/dist/chunks/on-click-outside.3e0c3e2a.js +91 -0
- package/dist/chunks/on-click-outside.3e0c3e2a.js.map +1 -0
- package/dist/chunks/search.6be3396b.js +26 -0
- package/dist/chunks/search.6be3396b.js.map +1 -0
- package/dist/chunks/toastController.b1b08299.js +15 -0
- package/dist/chunks/toastController.b1b08299.js.map +1 -0
- package/dist/chunks/tooltip.a4625a7b.js +220 -0
- package/dist/chunks/tooltip.a4625a7b.js.map +1 -0
- package/dist/chunks/unique-id.a2a2b458.js +34 -0
- package/dist/chunks/unique-id.a2a2b458.js.map +1 -0
- package/dist/chunks/use-default-slot-validator.83d977a1.js +11 -0
- package/dist/chunks/use-default-slot-validator.83d977a1.js.map +1 -0
- package/dist/chunks/useCountryItems.cbe60557.js +29 -0
- package/dist/chunks/useCountryItems.cbe60557.js.map +1 -0
- package/dist/click-outside.js +23 -0
- package/dist/click-outside.js.map +1 -0
- package/dist/controls-group.js +59 -0
- package/dist/controls-group.js.map +1 -0
- package/dist/country.js +5979 -0
- package/dist/country.js.map +1 -0
- package/dist/currency.js +119 -0
- package/dist/currency.js.map +1 -0
- package/dist/data-grid.js +1169 -0
- package/dist/data-grid.js.map +1 -0
- package/dist/date-picker.js +8 -0
- package/dist/date-picker.js.map +1 -0
- package/dist/date.js +6 -0
- package/dist/date.js.map +1 -0
- package/dist/divider.js +35 -0
- package/dist/divider.js.map +1 -0
- package/dist/dropdown.js +262 -0
- package/dist/dropdown.js.map +1 -0
- package/dist/filter-bar.js +1735 -0
- package/dist/filter-bar.js.map +1 -0
- package/dist/focus-trap.js +5 -0
- package/dist/focus-trap.js.map +1 -0
- package/dist/header.js +205 -0
- package/dist/header.js.map +1 -0
- package/dist/index.js +335 -21278
- package/dist/index.js.map +1 -1
- package/dist/info-icon.js +61 -0
- package/dist/info-icon.js.map +1 -0
- package/dist/input-field.js +168 -0
- package/dist/input-field.js.map +1 -0
- package/dist/internal.js +13 -0
- package/dist/internal.js.map +1 -0
- package/dist/link.js +46 -0
- package/dist/link.js.map +1 -0
- package/dist/loading-indicator.js +51 -0
- package/dist/loading-indicator.js.map +1 -0
- package/dist/menu.js +474 -0
- package/dist/menu.js.map +1 -0
- package/dist/modal.js +709 -0
- package/dist/modal.js.map +1 -0
- package/dist/pagination.js +487 -0
- package/dist/pagination.js.map +1 -0
- package/dist/payment-method.js +84 -0
- package/dist/payment-method.js.map +1 -0
- package/dist/popover.js +284 -0
- package/dist/popover.js.map +1 -0
- package/dist/popper-container.js +225 -0
- package/dist/popper-container.js.map +1 -0
- package/dist/radio-group.js +192 -0
- package/dist/radio-group.js.map +1 -0
- package/dist/search-bar.js +106 -0
- package/dist/search-bar.js.map +1 -0
- package/dist/status.js +47 -0
- package/dist/status.js.map +1 -0
- package/dist/structured-list.js +98 -0
- package/dist/structured-list.js.map +1 -0
- package/dist/summary-grid.js +526 -0
- package/dist/summary-grid.js.map +1 -0
- package/dist/tabs.js +106 -0
- package/dist/tabs.js.map +1 -0
- package/dist/tag.js +73 -0
- package/dist/tag.js.map +1 -0
- package/dist/textarea.js +64 -0
- package/dist/textarea.js.map +1 -0
- package/dist/toast.js +132 -0
- package/dist/toast.js.map +1 -0
- package/dist/toggle.js +6 -0
- package/dist/toggle.js.map +1 -0
- package/dist/typography.js +111 -0
- package/dist/typography.js.map +1 -0
- package/dist/web-types.json +130 -13
- package/package.json +6 -4
- package/dist/@types/utils/ts/inject-css.d.ts +0 -2
package/dist/tabs.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import "./assets/index32.css";
|
|
2
|
+
import { defineComponent as b, inject as c, ref as l, provide as _, onMounted as T } from "vue";
|
|
3
|
+
import { n as d } from "./chunks/_plugin-vue2_normalizer.71e2aa87.js";
|
|
4
|
+
import { BentoTypography as m, BentoTypographyElement as g, BentoTypographyVariant as h } from "./typography.js";
|
|
5
|
+
import { g as I } from "./chunks/unique-id.a2a2b458.js";
|
|
6
|
+
const u = Symbol("tabs registerTab injection key"), f = Symbol("tabs active tab ID key"), w = b({
|
|
7
|
+
props: {
|
|
8
|
+
/**
|
|
9
|
+
* Title of the tab
|
|
10
|
+
*/
|
|
11
|
+
title: {
|
|
12
|
+
type: String,
|
|
13
|
+
required: !0
|
|
14
|
+
},
|
|
15
|
+
/**
|
|
16
|
+
* Determines whether the tab is disabled
|
|
17
|
+
*/
|
|
18
|
+
disabled: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: !1
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
setup(a) {
|
|
24
|
+
const t = c(u), e = c(f), i = t(a);
|
|
25
|
+
return { activeTabId: e, id: i };
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
var x = function() {
|
|
29
|
+
var t = this, e = t._self._c;
|
|
30
|
+
return t._self._setupProxy, e("div", { directives: [{ name: "show", rawName: "v-show", value: t.activeTabId === t.id, expression: "activeTabId === id" }], attrs: { id: `${t.id}-tabpanel`, role: "tabpanel", "aria-labelledby": t.id } }, [t._t("default")], 2);
|
|
31
|
+
}, k = [], B = /* @__PURE__ */ d(
|
|
32
|
+
w,
|
|
33
|
+
x,
|
|
34
|
+
k,
|
|
35
|
+
!1,
|
|
36
|
+
null,
|
|
37
|
+
null,
|
|
38
|
+
null,
|
|
39
|
+
null
|
|
40
|
+
);
|
|
41
|
+
const D = B.exports, p = (a, t) => {
|
|
42
|
+
const e = a === 0 ? t.length - 1 : a - 1;
|
|
43
|
+
return t[e].disabled ? p(e, t) : e;
|
|
44
|
+
}, v = (a, t) => {
|
|
45
|
+
const e = a === t.length - 1 ? 0 : a + 1;
|
|
46
|
+
return t[e].disabled ? v(e, t) : e;
|
|
47
|
+
}, A = b({
|
|
48
|
+
components: {
|
|
49
|
+
BentoTypography: m
|
|
50
|
+
},
|
|
51
|
+
setup() {
|
|
52
|
+
const a = l([]), t = l(null), e = l("");
|
|
53
|
+
_(f, e), _(u, ({ title: s, disabled: n }) => {
|
|
54
|
+
const o = I("b-tab");
|
|
55
|
+
return a.value.push({ disabled: n, id: o, title: s }), o;
|
|
56
|
+
});
|
|
57
|
+
const r = (s) => {
|
|
58
|
+
if (s.code === "ArrowLeft" || s.code === "ArrowRight") {
|
|
59
|
+
const n = a.value.find((y) => document.activeElement.id === y.id);
|
|
60
|
+
let o = a.value.indexOf(n);
|
|
61
|
+
s.code === "ArrowLeft" ? o = p(o, a.value) : s.code === "ArrowRight" && (o = v(o, a.value)), t.value.children[o].focus();
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
return T(() => {
|
|
65
|
+
const s = a.value.find((n) => !n.disabled);
|
|
66
|
+
s && (e.value = s.id);
|
|
67
|
+
}), {
|
|
68
|
+
BentoTypographyElement: g,
|
|
69
|
+
BentoTypographyVariant: h,
|
|
70
|
+
tabs: a,
|
|
71
|
+
tablist: t,
|
|
72
|
+
activeTabId: e,
|
|
73
|
+
onKeydownTabsNavigation: r
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
var C = function() {
|
|
78
|
+
var t = this, e = t._self._c;
|
|
79
|
+
return t._self._setupProxy, e("div", { staticClass: "b-tabs" }, [e("div", { ref: "tablist", staticClass: "b-tabs__tab-list", attrs: { role: "tablist" }, on: { keydown: t.onKeydownTabsNavigation } }, t._l(t.tabs, function({ disabled: i, id: r, title: s }) {
|
|
80
|
+
return e("button", { key: r, staticClass: "b-tabs__tab", class: {
|
|
81
|
+
"b-tabs__tab--active": t.activeTabId === r,
|
|
82
|
+
"b-tabs__tab--disabled": i
|
|
83
|
+
}, attrs: { id: r, role: "tab", type: "button", "aria-controls": `${r}-tabpanel`, "aria-selected": t.activeTabId === r ? "true" : "false", tabindex: t.activeTabId === r && !i ? null : -1, disabled: i }, on: { click: function(n) {
|
|
84
|
+
t.activeTabId = r;
|
|
85
|
+
}, keydown: function(n) {
|
|
86
|
+
if (!n.type.indexOf("key") && t._k(n.keyCode, "enter", 13, n.key, "Enter") && t._k(n.keyCode, "space", 32, n.key, [" ", "Spacebar"]))
|
|
87
|
+
return null;
|
|
88
|
+
t.activeTabId = r;
|
|
89
|
+
} } }, [e("bento-typography", { staticClass: "b-tabs__tab-title", attrs: { el: t.BentoTypographyElement.SPAN, variant: t.BentoTypographyVariant.BODY, stronger: "" } }, [t._v(" " + t._s(s) + " ")]), e("span", { directives: [{ name: "show", rawName: "v-show", value: !i, expression: "!disabled" }], staticClass: "b-tabs__tab-underline" })], 1);
|
|
90
|
+
}), 0), t._t("default")], 2);
|
|
91
|
+
}, E = [], N = /* @__PURE__ */ d(
|
|
92
|
+
A,
|
|
93
|
+
C,
|
|
94
|
+
E,
|
|
95
|
+
!1,
|
|
96
|
+
null,
|
|
97
|
+
"0003f992",
|
|
98
|
+
null,
|
|
99
|
+
null
|
|
100
|
+
);
|
|
101
|
+
const Y = N.exports;
|
|
102
|
+
export {
|
|
103
|
+
D as BentoTab,
|
|
104
|
+
Y as BentoTabs
|
|
105
|
+
};
|
|
106
|
+
//# sourceMappingURL=tabs.js.map
|
package/dist/tabs.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.js","sources":["../src/components/tabs/tabs.keys.ts","../src/components/tabs/components/tab.vue","../src/components/tabs/tabs.utils.ts","../src/components/tabs/tabs.vue"],"sourcesContent":["export const TABS_REGISTER_TAB_INJECTION_KEY = Symbol('tabs registerTab injection key');\nexport const TABS_ACTIVE_TAB_ID_KEY = Symbol('tabs active tab ID key');\n","<template>\n <div v-show=\"activeTabId === id\" :id=\"`${id}-tabpanel`\" role=\"tabpanel\" :aria-labelledby=\"id\">\n <slot></slot>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { defineComponent, inject } from 'vue';\n import { TABS_ACTIVE_TAB_ID_KEY, TABS_REGISTER_TAB_INJECTION_KEY } from '../tabs.keys';\n import { RegisterBentoTab } from '../tabs.types';\n\n export default defineComponent({\n props: {\n /**\n * Title of the tab\n */\n title: {\n type: String,\n required: true,\n },\n /**\n * Determines whether the tab is disabled\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n },\n setup(props) {\n const registerTab: RegisterBentoTab = inject(TABS_REGISTER_TAB_INJECTION_KEY);\n const activeTabId = inject(TABS_ACTIVE_TAB_ID_KEY);\n const id = registerTab(props);\n\n return { activeTabId, id };\n },\n });\n</script>\n","import { BentoTab } from './components/tab.types';\n\nexport const getPreviousTabIndex = (activeTabIndex: number, tabsValue: BentoTab[]) => {\n const newActiveTabIndex = activeTabIndex === 0 ? tabsValue.length - 1 : activeTabIndex - 1;\n if (tabsValue[newActiveTabIndex].disabled) {\n return getPreviousTabIndex(newActiveTabIndex, tabsValue);\n }\n return newActiveTabIndex;\n};\n\nexport const getNextTabIndex = (activeTabIndex: number, tabsValue: BentoTab[]) => {\n const newActiveTabIndex = activeTabIndex === tabsValue.length - 1 ? 0 : activeTabIndex + 1;\n if (tabsValue[newActiveTabIndex].disabled) {\n return getNextTabIndex(newActiveTabIndex, tabsValue);\n }\n return newActiveTabIndex;\n};\n","<template>\n <div class=\"b-tabs\">\n <div ref=\"tablist\" class=\"b-tabs__tab-list\" role=\"tablist\" @keydown=\"onKeydownTabsNavigation\">\n <button\n v-for=\"{ disabled, id, title } in tabs\"\n :id=\"id\"\n :key=\"id\"\n class=\"b-tabs__tab\"\n :class=\"{\n 'b-tabs__tab--active': activeTabId === id,\n 'b-tabs__tab--disabled': disabled,\n }\"\n role=\"tab\"\n type=\"button\"\n :aria-controls=\"`${id}-tabpanel`\"\n :aria-selected=\"activeTabId === id ? 'true' : 'false'\"\n :tabindex=\"activeTabId === id && !disabled ? null : -1\"\n :disabled=\"disabled\"\n @click=\"activeTabId = id\"\n @keydown.enter.space=\"activeTabId = id\"\n >\n <bento-typography\n class=\"b-tabs__tab-title\"\n :el=\"BentoTypographyElement.SPAN\"\n :variant=\"BentoTypographyVariant.BODY\"\n stronger\n >\n {{ title }}\n </bento-typography>\n <span v-show=\"!disabled\" class=\"b-tabs__tab-underline\"></span>\n </button>\n </div>\n <slot />\n </div>\n</template>\n\n<script lang=\"ts\">\n import { defineComponent, onMounted, provide, ref } from 'vue';\n\n // components\n import { BentoTypography, BentoTypographyElement, BentoTypographyVariant } from '@/components/typography';\n\n // utils\n import { generateUid } from '@/utils/ts/unique-id';\n import { getNextTabIndex, getPreviousTabIndex } from './tabs.utils';\n\n // types\n import { BentoTab } from './components/tab.types';\n import { RegisterBentoTab } from './tabs.types';\n\n // keys\n import { TABS_ACTIVE_TAB_ID_KEY, TABS_REGISTER_TAB_INJECTION_KEY } from './tabs.keys';\n\n /**\n * Tabs are used to navigate between different, but related content views within a page.\n * This component conforms to the official WAI-ARIA guidelines for tabs: https://www.w3.org/WAI/ARIA/apg/patterns/tabs/\n *\n * @example\n * import { BentoTabs, BentoTab } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoTabs, BentoTab },\n * template: `\n * <bento-tabs v-bind=\"$props\">\n * <bento-tab title=\"Maria Ahlefeldt\">\n * (16 January 1755 - 20 December 1810) was a Danish, (originally German), composer. She is known as the first female composer in Denmark.\n * </bento-tab>\n * <bento-tab title=\"Carl Andersen\">\n * (29 April 1847 - 7 May 1909) was a Danish flutist, conductor and composer born in Copenhagen, son of the flutist Christian Joachim Andersen.\n * </bento-tab>\n * <bento-tab title=\"Karl Truffel\">\n * (1 March 1981 - 7 November 1992) was a Danish dog and commander born in Berlin, son of the machinist Tom Jahoor Truffel.\n * </bento-tab>\n * <bento-tab title=\"Maria Ahlefeldt\" :disabled=\"true\">\n * (16 January 1755 - 20 December 1810) was a Danish, (originally German), composer. She is known as the first female composer in Denmark.\n * </bento-tab>\n * </bento-tabs>\n * `\n * };\n */\n\n // component\n export default defineComponent({\n components: {\n BentoTypography,\n },\n setup() {\n const tabs = ref<BentoTab[]>([]);\n const tablist = ref(null);\n const activeTabId = ref('');\n\n provide(TABS_ACTIVE_TAB_ID_KEY, activeTabId);\n\n // register tab\n const registerTab: RegisterBentoTab = ({ title, disabled }) => {\n const id = generateUid('b-tab');\n\n // add tab to tabs\n tabs.value.push({ disabled, id, title });\n\n // return values to the Tab component\n return id;\n };\n\n // provide activeTab and registerTab to tab items\n provide(TABS_REGISTER_TAB_INJECTION_KEY, registerTab);\n\n // keyboard navigation\n const onKeydownTabsNavigation = (e: KeyboardEvent) => {\n if (e.code === 'ArrowLeft' || e.code === 'ArrowRight') {\n // find tab that is focussed\n const activeTab = tabs.value.find(tab => document.activeElement.id === tab.id);\n let activeTabIndex = tabs.value.indexOf(activeTab);\n\n // conditionally increase or decrease the\n if (e.code === 'ArrowLeft') {\n activeTabIndex = getPreviousTabIndex(activeTabIndex, tabs.value);\n } else if (e.code === 'ArrowRight') {\n activeTabIndex = getNextTabIndex(activeTabIndex, tabs.value);\n }\n\n // focus new active tab\n tablist.value.children[activeTabIndex].focus();\n }\n };\n\n // set first (enabled) tab to active\n onMounted(() => {\n const firstEnabledTab = tabs.value.find(tab => !tab.disabled);\n\n if (firstEnabledTab) {\n activeTabId.value = firstEnabledTab.id;\n }\n });\n\n return {\n BentoTypographyElement,\n BentoTypographyVariant,\n tabs,\n tablist,\n activeTabId,\n onKeydownTabsNavigation,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./tabs.scss\" />\n"],"names":["TABS_REGISTER_TAB_INJECTION_KEY","TABS_ACTIVE_TAB_ID_KEY","_sfc_main$1","defineComponent","props","registerTab","inject","activeTabId","id","getPreviousTabIndex","activeTabIndex","tabsValue","newActiveTabIndex","getNextTabIndex","_sfc_main","BentoTypography","tabs","ref","tablist","provide","title","disabled","generateUid","onKeydownTabsNavigation","e","activeTab","tab","onMounted","firstEnabledTab","BentoTypographyElement","BentoTypographyVariant"],"mappings":";;;;;AAAa,MAAAA,IAAA,OAAA,gCAAA,GACAC,IAAA,OAAA,wBAAA,GCUbC,IAAAC,EAAA;AAAA,EAAA,OAAA;AAAA;AAAA;AAAA;AAAA,IACA,OAAA;AAAA,MAIA,MAAA;AAAA,MACA,UAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IACA,UAAA;AAAA,MAIA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA,EACA;AAAA,EACA,MAAAC,GAAA;AAEA,UAAAC,IAAAC,EAAAN,CAAA,GACAO,IAAAD,EAAAL,CAAA,GACAO,IAAAH,EAAAD,CAAA;AAEA,WAAA,EAAA,aAAAG,GAAA,IAAAC,EAAA;AAAA,EAAA;AAEA,CAAA;;;;;;;;;;;;;;qBCjCaC,IAAA,CAAAC,GAAAC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,EAAA,QAAAqB,EAAA;AAAA,IACA,CAAA,GAGA;AAAA,MAAA,wBAAAC;AAAA,MACA,wBAAAC;AAAA,MACA,MAAAd;AAAA,MACA,SAAAE;AAAA,MACA,aAAAX;AAAA,MACA,yBAAAgB;AAAA,IACA;AAAA,EACA;AAEA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/tag.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import "./assets/index27.css";
|
|
2
|
+
import { defineComponent as m, computed as l } from "vue";
|
|
3
|
+
import { BentoTypography as _, BentoTypographyVariant as p, BentoTypographyElement as d } from "./typography.js";
|
|
4
|
+
import { u as b } from "./chunks/aria-label.ac9651a5.js";
|
|
5
|
+
import { B as v } from "./chunks/tooltip.a4625a7b.js";
|
|
6
|
+
import { n as f } from "./chunks/_plugin-vue2_normalizer.71e2aa87.js";
|
|
7
|
+
var n = /* @__PURE__ */ ((e) => (e.GREY = "grey", e.BLUE = "blue", e.GREEN = "green", e.ORANGE = "orange", e.RED = "red", e.WHITE = "white", e))(n || {});
|
|
8
|
+
const g = m({
|
|
9
|
+
name: "bento-tag",
|
|
10
|
+
components: { BentoTypography: _ },
|
|
11
|
+
directives: { BentoTooltipDirective: v },
|
|
12
|
+
inheritAttrs: !1,
|
|
13
|
+
props: {
|
|
14
|
+
/**
|
|
15
|
+
* The label text content of the Tag.
|
|
16
|
+
*/
|
|
17
|
+
label: { type: String, default: null },
|
|
18
|
+
/**
|
|
19
|
+
* The variant variant of tag
|
|
20
|
+
*/
|
|
21
|
+
variant: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: n.GREY,
|
|
24
|
+
validator: (e) => Object.values(n).includes(e)
|
|
25
|
+
},
|
|
26
|
+
/**
|
|
27
|
+
* The number of characters to limit the number of displayed characters for the tag text, truncating it with an ellipsis of three dots "...".
|
|
28
|
+
*/
|
|
29
|
+
truncate: { type: Number, default: null }
|
|
30
|
+
},
|
|
31
|
+
setup(e, { slots: t }) {
|
|
32
|
+
var i;
|
|
33
|
+
const r = b({
|
|
34
|
+
label: e.label || ((i = t.default) == null ? void 0 : i.call(t)[0].text.trim()),
|
|
35
|
+
defaultFallback: "tag"
|
|
36
|
+
}), c = l(() => ({
|
|
37
|
+
[`b-tag--${e.variant}`]: e.variant
|
|
38
|
+
})), a = l(() => {
|
|
39
|
+
var u;
|
|
40
|
+
return e.label || ((u = t.default) == null ? void 0 : u.call(t)[0].text.trim()) || "tag";
|
|
41
|
+
}), o = l(() => e.truncate && a.value.length > e.truncate), s = l(() => e.truncate && o.value ? `${a.value.slice(0, e.truncate)}...` : a.value);
|
|
42
|
+
return {
|
|
43
|
+
// Values
|
|
44
|
+
computedAriaLabel: r,
|
|
45
|
+
textFromSlot: a,
|
|
46
|
+
formattedText: s,
|
|
47
|
+
tagConditionalClasses: c,
|
|
48
|
+
shouldShowTooltip: o,
|
|
49
|
+
// Enums
|
|
50
|
+
BentoTypographyVariant: p,
|
|
51
|
+
BentoTypographyElement: d
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
var y = function() {
|
|
56
|
+
var t = this, r = t._self._c;
|
|
57
|
+
return t._self._setupProxy, r("span", { directives: [{ name: "bento-tooltip-directive", rawName: "v-bento-tooltip-directive", value: t.shouldShowTooltip ? t.textFromSlot : null, expression: "shouldShowTooltip ? textFromSlot : null" }], staticClass: "b-tag", class: t.tagConditionalClasses, attrs: { "aria-label": t.computedAriaLabel, role: "mark" } }, [r("bento-typography", { staticClass: "b-tag__label", attrs: { el: t.BentoTypographyElement.SPAN, variant: t.BentoTypographyVariant.CAPTION, stronger: "" } }, [t._v(" " + t._s(t.formattedText) + " ")])], 1);
|
|
58
|
+
}, h = [], x = /* @__PURE__ */ f(
|
|
59
|
+
g,
|
|
60
|
+
y,
|
|
61
|
+
h,
|
|
62
|
+
!1,
|
|
63
|
+
null,
|
|
64
|
+
"b3ca3eb4",
|
|
65
|
+
null,
|
|
66
|
+
null
|
|
67
|
+
);
|
|
68
|
+
const R = x.exports;
|
|
69
|
+
export {
|
|
70
|
+
R as BentoTag,
|
|
71
|
+
n as BentoTagVariant
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=tag.js.map
|
package/dist/tag.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag.js","sources":["../src/components/tag/tag.types.ts","../src/components/tag/tag.vue"],"sourcesContent":["export enum BentoTagVariant {\n GREY = 'grey',\n BLUE = 'blue',\n GREEN = 'green',\n ORANGE = 'orange',\n RED = 'red',\n WHITE = 'white',\n}\n","<template>\n <span\n v-bento-tooltip-directive=\"shouldShowTooltip ? textFromSlot : null\"\n class=\"b-tag\"\n :class=\"tagConditionalClasses\"\n :aria-label=\"computedAriaLabel\"\n role=\"mark\"\n >\n <bento-typography\n class=\"b-tag__label\"\n :el=\"BentoTypographyElement.SPAN\"\n :variant=\"BentoTypographyVariant.CAPTION\"\n stronger\n >\n {{ formattedText }}\n </bento-typography>\n </span>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, PropType } from 'vue';\n import { BentoTagVariant } from './tag.types';\n import { BentoTypography, BentoTypographyElement, BentoTypographyVariant } from '@/components/typography';\n import { BentoTooltipDirective } from '@/directives';\n import { useAriaLabel } from '@/utils/ts/aria-label';\n\n export default defineComponent({\n name: 'bento-tag',\n components: { BentoTypography },\n directives: { BentoTooltipDirective },\n inheritAttrs: false,\n props: {\n /**\n * The label text content of the Tag.\n */\n label: { type: String, default: null },\n\n /**\n * The variant variant of tag\n */\n variant: {\n type: String as PropType<BentoTagVariant>,\n default: BentoTagVariant.GREY,\n validator: (value: BentoTagVariant) => Object.values(BentoTagVariant).includes(value),\n },\n\n /**\n * The number of characters to limit the number of displayed characters for the tag text, truncating it with an ellipsis of three dots \"...\".\n */\n truncate: { type: Number, default: null },\n },\n setup(props, { slots }) {\n const computedAriaLabel = useAriaLabel({\n label: props.label || slots.default?.()[0].text.trim(),\n defaultFallback: 'tag',\n });\n\n const tagConditionalClasses = computed(() => ({\n [`b-tag--${props.variant}`]: props.variant,\n }));\n\n const textFromSlot = computed(() => props.label || slots.default?.()[0].text.trim() || 'tag');\n const shouldShowTooltip = computed(() => props.truncate && textFromSlot.value.length > props.truncate);\n\n const formattedText = computed(() => {\n if (!props.truncate) {\n return textFromSlot.value;\n }\n\n return shouldShowTooltip.value\n ? `${textFromSlot.value.slice(0, props.truncate)}...`\n : textFromSlot.value;\n });\n\n return {\n // Values\n computedAriaLabel,\n textFromSlot,\n formattedText,\n tagConditionalClasses,\n shouldShowTooltip,\n\n // Enums\n BentoTypographyVariant,\n BentoTypographyElement,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./tag.scss\" />\n"],"names":["BentoTagVariant","BentoTagVariant2","_sfc_main","defineComponent","BentoTypography","BentoTooltipDirective","value","props","slots","computedAriaLabel","useAriaLabel","_a","tagConditionalClasses","computed","textFromSlot","shouldShowTooltip","formattedText","BentoTypographyVariant","BentoTypographyElement"],"mappings":";;;;;;AAAY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,OAAA,QACAA,EAAA,OAAA,QACAA,EAAA,QAAA,SACAA,EAAA,SAAA,UACAA,EAAA,MAAA,OACAA,EAAA,QAAA,SANQA,IAAAD,KAAA,CAAA,CAAA;AC0BZ,MAAAE,IAAAC,EAAA;AAAA,EAAA,MAAA;AAAA,EACA,YAAA,EAAA,iBAAAC,EAAA;AAAA,EACA,YAAA,EAAA,uBAAAC,EAAA;AAAA,EACA,cAAA;AAAA,EACA,OAAA;AAAA;AAAA;AAAA;AAAA,IACA,OAAA,EAAA,MAAA,QAAA,SAAA,KAAA;AAAA;AAAA;AAAA;AAAA,IAIA,SAAA;AAAA,MAKA,MAAA;AAAA,MACA,SAAAL,EAAA;AAAA,MACA,WAAA,CAAAM,MAAA,OAAA,OAAAN,CAAA,EAAA,SAAAM,CAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IACA,UAAA,EAAA,MAAA,QAAA,SAAA,KAAA;AAAA,EAKA;AAAA,EACA,MAAAC,GAAA,EAAA,OAAAC,EAAA,GAAA;;AAEA,UAAAC,IAAAC,EAAA;AAAA,MAAA,OAAAH,EAAA,WAAAI,IAAAH,EAAA,YAAA,gBAAAG,EAAA,KAAAH,GAAA,GAAA,KAAA;AAAA,MACA,iBAAA;AAAA,IACA,CAAA,GAGAI,IAAAC,EAAA,OAAA;AAAA,MAAA,CAAA,UAAAN,EAAA,SAAA,GAAAA,EAAA;AAAA,IACA,EAAA,GAGAO,IAAAD,EAAA,MAAA;;AAAA,aAAAN,EAAA,WAAAI,IAAAH,EAAA,YAAA,gBAAAG,EAAA,KAAAH,GAAA,GAAA,KAAA,WAAA;AAAA,KAAA,GACAO,IAAAF,EAAA,MAAAN,EAAA,YAAAO,EAAA,MAAA,SAAAP,EAAA,QAAA,GAEAS,IAAAH,EAAA,MACAN,EAAA,YAIAQ,EAAA,QAAA,GAAAD,EAAA,MAAA,MAAA,GAAAP,EAAA,QAAA,SAHAO,EAAA,KAKA;AAGA,WAAA;AAAA;AAAA,MAAA,mBAAAL;AAAA,MAEA,cAAAK;AAAA,MACA,eAAAE;AAAA,MACA,uBAAAJ;AAAA,MACA,mBAAAG;AAAA;AAAA,MACA,wBAAAE;AAAA,MAGA,wBAAAC;AAAA,IACA;AAAA,EACA;AAEA,CAAA;;;;;;;;;;;;;;;"}
|
package/dist/textarea.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import "./assets/index2.css";
|
|
2
|
+
import { defineComponent as n } from "vue";
|
|
3
|
+
import { n as r } from "./chunks/_plugin-vue2_normalizer.71e2aa87.js";
|
|
4
|
+
const l = n({
|
|
5
|
+
name: "adl-textarea",
|
|
6
|
+
inheritAttrs: !1,
|
|
7
|
+
props: {
|
|
8
|
+
/**
|
|
9
|
+
* Text displayed as the label of the textarea
|
|
10
|
+
*/
|
|
11
|
+
label: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: ""
|
|
14
|
+
},
|
|
15
|
+
/**
|
|
16
|
+
* Text displayed as the help text of the textarea
|
|
17
|
+
*/
|
|
18
|
+
description: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: ""
|
|
21
|
+
},
|
|
22
|
+
/**
|
|
23
|
+
* Text displayed as the placeholder of the textarea
|
|
24
|
+
*/
|
|
25
|
+
placeholder: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: ""
|
|
28
|
+
},
|
|
29
|
+
/**
|
|
30
|
+
* Text displayed as the value of the textarea
|
|
31
|
+
*/
|
|
32
|
+
value: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: ""
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
emits: ["input"],
|
|
38
|
+
setup(a, { emit: e }) {
|
|
39
|
+
return {
|
|
40
|
+
// Methods
|
|
41
|
+
onInput: (s) => {
|
|
42
|
+
e("input", s.target.value);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
var _ = function() {
|
|
48
|
+
var e = this, t = e._self._c;
|
|
49
|
+
return e._self._setupProxy, t("label", { staticClass: "adl2-textarea" }, [e.label ? t("span", { staticClass: "adl2-textarea__label" }, [e._v(e._s(e.label))]) : e._e(), t("textarea", { staticClass: "adl2-textarea__input", attrs: { placeholder: e.placeholder }, domProps: { value: e.value }, on: { input: e.onInput } }), e.description ? t("span", { staticClass: "adl2-textarea__description" }, [e._v(e._s(e.description))]) : e._e()]);
|
|
50
|
+
}, p = [], o = /* @__PURE__ */ r(
|
|
51
|
+
l,
|
|
52
|
+
_,
|
|
53
|
+
p,
|
|
54
|
+
!1,
|
|
55
|
+
null,
|
|
56
|
+
"1eceed15",
|
|
57
|
+
null,
|
|
58
|
+
null
|
|
59
|
+
);
|
|
60
|
+
const u = o.exports;
|
|
61
|
+
export {
|
|
62
|
+
u as AdlTextarea
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=textarea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textarea.js","sources":["../src/components/textarea/textarea.vue"],"sourcesContent":["<template>\n <label class=\"adl2-textarea\">\n <span v-if=\"label\" class=\"adl2-textarea__label\">{{ label }}</span>\n <textarea class=\"adl2-textarea__input\" :placeholder=\"placeholder\" :value=\"value\" @input=\"onInput\"></textarea>\n <span v-if=\"description\" class=\"adl2-textarea__description\">{{ description }}</span>\n </label>\n</template>\n\n<script lang=\"ts\">\n import { defineComponent } from 'vue';\n\n export default defineComponent({\n name: 'adl-textarea',\n inheritAttrs: false,\n props: {\n /**\n * Text displayed as the label of the textarea\n */\n label: {\n type: String,\n default: '',\n },\n /**\n * Text displayed as the help text of the textarea\n */\n description: {\n type: String,\n default: '',\n },\n /**\n * Text displayed as the placeholder of the textarea\n */\n placeholder: {\n type: String,\n default: '',\n },\n /**\n * Text displayed as the value of the textarea\n */\n value: {\n type: String,\n default: '',\n },\n },\n emits: ['input'],\n setup(props, { emit }) {\n const onInput = (event: Event) => {\n emit('input', (event.target as HTMLTextAreaElement).value);\n };\n\n return {\n // Methods\n onInput,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./textarea.scss\" />\n"],"names":["_sfc_main","defineComponent","props","emit","event"],"mappings":";;;AAWA,MAAAA,IAAAC,EAAA;AAAA,EAAA,MAAA;AAAA,EACA,cAAA;AAAA,EACA,OAAA;AAAA;AAAA;AAAA;AAAA,IACA,OAAA;AAAA,MAIA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IACA,aAAA;AAAA,MAIA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IACA,aAAA;AAAA,MAIA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IACA,OAAA;AAAA,MAIA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA,EACA;AAAA,EACA,OAAA,CAAA,OAAA;AAAA,EACA,MAAAC,GAAA,EAAA,MAAAC,EAAA,GAAA;AAMA,WAAA;AAAA;AAAA,MAAA,SAJA,CAAAC,MAAA;AACA,QAAAD,EAAA,SAAAC,EAAA,OAAA,KAAA;AAAA,MAAA;AAAA,IAKA;AAAA,EACA;AAEA,CAAA;;;;;;;;;;;;;;;"}
|
package/dist/toast.js
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import "./assets/index36.css";
|
|
2
|
+
import { defineComponent as p, ref as u, computed as c, onMounted as b, watch as T } from "vue";
|
|
3
|
+
import { u as y } from "./chunks/toastController.b1b08299.js";
|
|
4
|
+
import { I as B } from "./chunks/info-filled.9748686e.js";
|
|
5
|
+
import { C } from "./chunks/cross-small.7ecb1b97.js";
|
|
6
|
+
import { B as k, a as S } from "./chunks/button.31b757d1.js";
|
|
7
|
+
import { BentoTypography as x, BentoTypographyElement as w, BentoTypographyVariant as I } from "./typography.js";
|
|
8
|
+
import { h as $ } from "./chunks/hasSlot.dceac207.js";
|
|
9
|
+
import { n as d } from "./chunks/_plugin-vue2_normalizer.71e2aa87.js";
|
|
10
|
+
const A = {
|
|
11
|
+
"en-US": {
|
|
12
|
+
dismiss: "Dismiss"
|
|
13
|
+
}
|
|
14
|
+
}, R = p({
|
|
15
|
+
i18n: { messages: A },
|
|
16
|
+
name: "toast-item",
|
|
17
|
+
components: { BentoButton: k, BentoTypography: x, CrossIcon: C, InfoIcon: B },
|
|
18
|
+
inheritAttrs: !1,
|
|
19
|
+
props: {
|
|
20
|
+
text: {
|
|
21
|
+
type: String,
|
|
22
|
+
required: !0
|
|
23
|
+
},
|
|
24
|
+
action: {
|
|
25
|
+
type: Object,
|
|
26
|
+
default: null
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
emits: ["click", "dismiss"],
|
|
30
|
+
setup(a, { slots: t, emit: s }) {
|
|
31
|
+
const o = () => s("dismiss"), e = () => {
|
|
32
|
+
a.action.handler(), s("dismiss");
|
|
33
|
+
};
|
|
34
|
+
return {
|
|
35
|
+
// Enums
|
|
36
|
+
BentoButtonVariant: S,
|
|
37
|
+
BentoTypographyElement: w,
|
|
38
|
+
BentoTypographyVariant: I,
|
|
39
|
+
// Methods
|
|
40
|
+
dismissButtonClicked: o,
|
|
41
|
+
hasSlot: $(t),
|
|
42
|
+
onActionClicked: e
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
var D = function() {
|
|
47
|
+
var t = this, s = t._self._c;
|
|
48
|
+
return t._self._setupProxy, s("div", { staticClass: "b-toast-item", attrs: { "data-testid": "toast-item" } }, [s("div", { staticClass: "b-toast-item__container" }, [s("info-icon", { staticClass: "b-toast-item__left-icon b-toast-item__info-icon", attrs: { name: "info", "aria-hidden": "true" } }), s("output", { attrs: { role: "status" } }, [s("bento-typography", { attrs: { el: t.BentoTypographyElement.SPAN, variant: t.BentoTypographyVariant.BODY, strongest: "" } }, [t._v(" " + t._s(t.text) + " ")])], 1)], 1), s("div", { staticClass: "b-toast-item__container" }, [t.action ? s("bento-button", { staticClass: "b-toast-item__right-icon", attrs: { variant: t.BentoButtonVariant.TERTIARY }, on: { click: t.onActionClicked } }, [t._v(" " + t._s(t.action.text) + " ")]) : t._e(), s("bento-button", { staticClass: "b-toast-item__right-icon", attrs: { variant: t.BentoButtonVariant.TERTIARY }, on: { click: t.dismissButtonClicked }, scopedSlots: t._u([{ key: "iconLeft", fn: function() {
|
|
49
|
+
return [s("cross-icon", { attrs: { "svg-title": t.$t("dismiss") } })];
|
|
50
|
+
}, proxy: !0 }]) })], 1)]);
|
|
51
|
+
}, E = [], H = /* @__PURE__ */ d(
|
|
52
|
+
R,
|
|
53
|
+
D,
|
|
54
|
+
E,
|
|
55
|
+
!1,
|
|
56
|
+
null,
|
|
57
|
+
"36035c0a",
|
|
58
|
+
null,
|
|
59
|
+
null
|
|
60
|
+
);
|
|
61
|
+
const O = H.exports, P = 5e3, V = p({
|
|
62
|
+
name: "bento-toast",
|
|
63
|
+
components: { ToastItem: O },
|
|
64
|
+
inheritAttrs: !1,
|
|
65
|
+
setup() {
|
|
66
|
+
const { state: a } = y(), t = u(null), s = u(null), o = c(() => a.queue.slice(-3)), e = () => {
|
|
67
|
+
clearTimeout(t.value);
|
|
68
|
+
}, l = (n) => {
|
|
69
|
+
t.value = setTimeout(() => {
|
|
70
|
+
e(), n.dismiss();
|
|
71
|
+
}, P);
|
|
72
|
+
}, _ = () => {
|
|
73
|
+
e();
|
|
74
|
+
const n = o.value.slice(-1)[0];
|
|
75
|
+
n && l(n);
|
|
76
|
+
};
|
|
77
|
+
b(() => {
|
|
78
|
+
_();
|
|
79
|
+
}), T(
|
|
80
|
+
() => o.value,
|
|
81
|
+
() => {
|
|
82
|
+
o.value.length && (e(), _());
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
const f = c(
|
|
86
|
+
() => o.value.map((n, i) => {
|
|
87
|
+
const g = o.value.length - 1;
|
|
88
|
+
return {
|
|
89
|
+
top: `${10 * i}px`,
|
|
90
|
+
width: `${100 - 10 * (g - i)}%`
|
|
91
|
+
};
|
|
92
|
+
})
|
|
93
|
+
), h = c(() => {
|
|
94
|
+
var r;
|
|
95
|
+
const n = (r = s.value) == null ? void 0 : r.offsetWidth, i = o.value.length - 1, m = i ? 10 * i : 0;
|
|
96
|
+
return {
|
|
97
|
+
bottom: `${n}px`,
|
|
98
|
+
height: `${m}px`
|
|
99
|
+
};
|
|
100
|
+
});
|
|
101
|
+
return {
|
|
102
|
+
// Values,
|
|
103
|
+
computedPositioning: f,
|
|
104
|
+
computedHeight: h,
|
|
105
|
+
toastsToShow: o,
|
|
106
|
+
toast: s
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
var F = function() {
|
|
111
|
+
var t = this, s = t._self._c;
|
|
112
|
+
return t._self._setupProxy, t.toastsToShow.length ? s("div", { staticClass: "b-toast", style: t.computedHeight }, [s("transition-group", { staticClass: "b-toast__container", attrs: { name: "b-toast", tag: "ul", "aria-live": "polite", "move-class": "b-toast__container--move", "enter-active-class": "b-toast__container--enter-active", "leave-active-class": "b-toast__container--leave-active", "enter-from-class": "b-toast__container--enter-from", "leave-to-class": "b-toast__container--leave-to" } }, t._l(t.toastsToShow, function(o, e) {
|
|
113
|
+
return s("li", { key: e, staticClass: "b-toast__item", style: t.computedPositioning[e], attrs: { inert: e !== t.toastsToShow.length - 1 } }, [s("toast-item", { ref: e === t.toastsToShow.length - 1 ? "toast" : null, refInFor: !0, class: e !== t.toastsToShow.length - 1 ? "b-toast--light-background" : null, attrs: { text: o.text, action: o.action }, on: { dismiss: function(l) {
|
|
114
|
+
return o.dismiss();
|
|
115
|
+
} } })], 1);
|
|
116
|
+
}), 0)], 1) : t._e();
|
|
117
|
+
}, Y = [], q = /* @__PURE__ */ d(
|
|
118
|
+
V,
|
|
119
|
+
F,
|
|
120
|
+
Y,
|
|
121
|
+
!1,
|
|
122
|
+
null,
|
|
123
|
+
"d558ce5a",
|
|
124
|
+
null,
|
|
125
|
+
null
|
|
126
|
+
);
|
|
127
|
+
const K = q.exports;
|
|
128
|
+
export {
|
|
129
|
+
K as BentoToast,
|
|
130
|
+
y as useBentoToastController
|
|
131
|
+
};
|
|
132
|
+
//# sourceMappingURL=toast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.js","sources":["../src/components/toast/components/toast-item/toast-item.vue","../src/components/toast/toast.vue"],"sourcesContent":["<template>\n <div class=\"b-toast-item\" data-testid=\"toast-item\">\n <div class=\"b-toast-item__container\">\n <info-icon\n class=\"b-toast-item__left-icon b-toast-item__info-icon\"\n name=\"info\"\n aria-hidden=\"true\"\n ></info-icon>\n <output role=\"status\">\n <bento-typography :el=\"BentoTypographyElement.SPAN\" :variant=\"BentoTypographyVariant.BODY\" strongest>\n {{ text }}\n </bento-typography>\n </output>\n </div>\n <div class=\"b-toast-item__container\">\n <bento-button\n v-if=\"action\"\n class=\"b-toast-item__right-icon\"\n :variant=\"BentoButtonVariant.TERTIARY\"\n @click=\"onActionClicked\"\n >\n {{ action.text }}\n </bento-button>\n <bento-button\n class=\"b-toast-item__right-icon\"\n :variant=\"BentoButtonVariant.TERTIARY\"\n @click=\"dismissButtonClicked\"\n >\n <template #iconLeft>\n <cross-icon :svg-title=\"$t('dismiss')\" />\n </template>\n </bento-button>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { defineComponent, PropType } from 'vue';\n import InfoIcon from '@adyen/ui-assets-icons-16/vue/info-filled';\n import CrossIcon from '@adyen/ui-assets-icons-16/vue/cross-small';\n import messages from './messages.json';\n import { BentoToastItemAction } from './toast-item.types';\n import { BentoButton, BentoButtonVariant } from '@/components/button';\n import { BentoTypography, BentoTypographyElement, BentoTypographyVariant } from '@/components/typography';\n import { hasSlot } from '@/utils/ts/hasSlot';\n\n /**\n * @example\n * Toast item component, for internal use only.\n *\n * import { BentoToastItem } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoToastItem },\n * template: `\n * <bento-toast-item>\n * This is a toast message\n * <template #primaryAction>Button text</template>\n * </bento-toast-item>\n * `\n * }\n */\n export default defineComponent({\n i18n: { messages },\n name: 'toast-item',\n components: { BentoButton, BentoTypography, CrossIcon, InfoIcon },\n inheritAttrs: false,\n props: {\n text: {\n type: String,\n required: true,\n },\n action: {\n type: Object as PropType<BentoToastItemAction>,\n default: null,\n },\n },\n emits: ['click', 'dismiss'],\n setup(props, { slots, emit }) {\n const dismissButtonClicked = () => emit('dismiss');\n const onActionClicked = () => {\n props.action.handler();\n emit('dismiss');\n };\n\n return {\n // Enums\n BentoButtonVariant,\n BentoTypographyElement,\n BentoTypographyVariant,\n\n // Methods\n dismissButtonClicked,\n hasSlot: hasSlot(slots),\n onActionClicked,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./toast-item.scss\" />\n","<template>\n <div v-if=\"toastsToShow.length\" class=\"b-toast\" :style=\"computedHeight\">\n <transition-group\n name=\"b-toast\"\n tag=\"ul\"\n class=\"b-toast__container\"\n aria-live=\"polite\"\n move-class=\"b-toast__container--move\"\n enter-active-class=\"b-toast__container--enter-active\"\n leave-active-class=\"b-toast__container--leave-active\"\n enter-from-class=\"b-toast__container--enter-from\"\n leave-to-class=\"b-toast__container--leave-to\"\n >\n <li\n v-for=\"(item, index) in toastsToShow\"\n :key=\"index\"\n class=\"b-toast__item\"\n :style=\"computedPositioning[index]\"\n :inert=\"index !== toastsToShow.length - 1\"\n >\n <toast-item\n :ref=\"index === toastsToShow.length - 1 ? 'toast' : null\"\n :class=\"index !== toastsToShow.length - 1 ? 'b-toast--light-background' : null\"\n :text=\"item.text\"\n :action=\"item.action\"\n @dismiss=\"item.dismiss()\"\n />\n </li>\n </transition-group>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, onMounted, ref, watch } from 'vue';\n import { ToastItem } from './components/toast-item';\n import { useBentoToastController } from '@/utils/ts/toastController';\n\n const DURATION = 5000;\n\n /**\n * @example\n * import { BentoToast, useBentoToastController } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoToast },\n * template: `\n * // in your project root\n * <bento-toast />\n * setup() {\n * bentoToastController = useBentoToastController();\n * onTrigger = () => {\n * bentoToastController.addToast({ text: 'Your toast text', action: { text: 'Button text', handler: () => { your code here } });\n * }\n * `\n * }\n */\n export default defineComponent({\n name: 'bento-toast',\n components: { ToastItem },\n inheritAttrs: false,\n setup() {\n const { state } = useBentoToastController();\n const dismissTimer = ref(null);\n const toast = ref(null);\n const toastsToShow = computed(() => state.queue.slice(-3));\n\n const cancelDismissTimer = () => {\n clearTimeout(dismissTimer.value);\n };\n\n const startTimer = toastToDismiss => {\n dismissTimer.value = setTimeout(() => {\n cancelDismissTimer();\n toastToDismiss.dismiss();\n }, DURATION);\n };\n\n const startDismissTimer = () => {\n cancelDismissTimer();\n\n const toastToDismiss = toastsToShow.value.slice(-1)[0];\n if (toastToDismiss) {\n startTimer(toastToDismiss);\n }\n };\n\n onMounted(() => {\n startDismissTimer();\n });\n\n watch(\n () => toastsToShow.value,\n () => {\n if (toastsToShow.value.length) {\n cancelDismissTimer();\n startDismissTimer();\n }\n }\n );\n\n const computedPositioning = computed(() =>\n toastsToShow.value.map((el, index) => {\n const diff = 10;\n const width = 100;\n const min = 10;\n const numberOfElements = toastsToShow.value.length - 1;\n return {\n top: `${diff * index}px`,\n width: `${width - min * (numberOfElements - index)}%`,\n };\n })\n );\n\n const computedHeight = computed(() => {\n // Get shown toast element height (last in the queue)\n const visibleToastHeight = toast.value?.offsetWidth;\n // Get number of elements excluding the toast currently displayed\n const numberOfElements = toastsToShow.value.length - 1;\n // Set height = number of stacked elements\n const stackedToastHeight = 10;\n // Set a stack height only if there's elements present\n const stackHeight = numberOfElements ? stackedToastHeight * numberOfElements : 0;\n // Set bottom to be padding + height of the visible toast :)\n return {\n bottom: `${visibleToastHeight}px`,\n height: `${stackHeight}px`,\n };\n });\n\n return {\n // Values,\n computedPositioning,\n computedHeight,\n toastsToShow,\n toast,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./toast.scss\" />\n"],"names":["_sfc_main$1","defineComponent","messages","BentoButton","BentoTypography","CrossIcon","InfoIcon","props","slots","emit","dismissButtonClicked","onActionClicked","BentoButtonVariant","BentoTypographyElement","BentoTypographyVariant","hasSlot","DURATION","_sfc_main","ToastItem","state","useBentoToastController","dismissTimer","ref","toast","toastsToShow","computed","cancelDismissTimer","startTimer","toastToDismiss","startDismissTimer","onMounted","watch","computedPositioning","el","index","numberOfElements","computedHeight","visibleToastHeight","_a","stackHeight"],"mappings":";;;;;;;;;;;;;GA8DAA,IAAAC,EAAA;AAAA,EAAA,MAAA,EAAA,UAAAC,EAAA;AAAA,EACA,MAAA;AAAA,EACA,YAAA,EAAA,aAAAC,GAAA,iBAAAC,GAAA,WAAAC,GAAA,UAAAC,EAAA;AAAA,EACA,cAAA;AAAA,EACA,OAAA;AAAA,IACA,MAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AAAA,IACA;AAAA,IACA,QAAA;AAAA,MACA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EAAA;AAAA,MACA;AAAA,IACA;AAGA,UAAAG,IAAAP;AAAA,MAAA,MAAAD,EAAA,MAAA,IAAA,CAAAS,GAAAC,MAAA;AAKA,cAAAC,IAAAX,EAAA,MAAA,SAAA;AACA,eAAA;AAAA,UAAA,KAAA,GAAA,KAAAU;AAAA,UACA,OAAA,GAAA,MAAA,MAAAC,IAAAD;AAAA,QACA;AAAA,MACA,CAAA;AAAA,IACA,GAGAE,IAAAX,EAAA,MAAA;;AAEA,YAAAY,KAAAC,IAAAf,EAAA,UAAA,gBAAAe,EAAA,aAEAH,IAAAX,EAAA,MAAA,SAAA,GAIAe,IAAAJ,IAFA,KAEAA,IAAA;AAEA,aAAA;AAAA,QAAA,QAAA,GAAAE;AAAA,QACA,QAAA,GAAAE;AAAA,MACA;AAAA,IACA,CAAA;AAGA,WAAA;AAAA;AAAA,MAAA,qBAAAP;AAAA,MAEA,gBAAAI;AAAA,MACA,cAAAZ;AAAA,MACA,OAAAD;AAAA,IACA;AAAA,EACA;AAEA,CAAA;;;;;;;;;;;;;;;;;;;"}
|
package/dist/toggle.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toggle.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import "./assets/index35.css";
|
|
2
|
+
import { defineComponent as r, computed as i } from "vue";
|
|
3
|
+
import { n as u } from "./chunks/_plugin-vue2_normalizer.71e2aa87.js";
|
|
4
|
+
var a = /* @__PURE__ */ ((t) => (t.CAPTION = "caption", t.BODY = "body", t.SUBTITLE = "subtitle", t.TITLE = "title", t))(a || {}), e = /* @__PURE__ */ ((t) => (t.WIDE = "wide", t.STRONGER = "stronger", t.STRONGER_WIDE = "stronger-wide", t.STRONGEST = "strongest", t.STRONGEST_WIDE = "strongest-wide", t.MEDIUM = "m", t.LARGE = "l", t.MOBILE = "mobile", t))(e || {}), l = /* @__PURE__ */ ((t) => (t.H1 = "h1", t.H2 = "h2", t.H3 = "h3", t.H4 = "h4", t.H5 = "h5", t.H6 = "h6", t.DIV = "div", t.PARAGRAPH = "p", t.SPAN = "span", t))(l || {});
|
|
5
|
+
const _ = r({
|
|
6
|
+
name: "bento-typography",
|
|
7
|
+
inheritAttrs: !0,
|
|
8
|
+
props: {
|
|
9
|
+
/**
|
|
10
|
+
* Sets the HTML DOM element.
|
|
11
|
+
* @values h1, h2, h3, h4, h5, h6, div, p, span
|
|
12
|
+
*/
|
|
13
|
+
el: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: l.PARAGRAPH,
|
|
16
|
+
validator: (t) => Object.values(l).includes(t)
|
|
17
|
+
},
|
|
18
|
+
/**
|
|
19
|
+
* Adds the stronger class modifier.
|
|
20
|
+
* Applicable to Caption, Body and Subtitle variants.
|
|
21
|
+
*/
|
|
22
|
+
stronger: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: !1
|
|
25
|
+
},
|
|
26
|
+
/**
|
|
27
|
+
* Adds the strongest class modifier.
|
|
28
|
+
* Applicable to Caption, Body and Subtitle variants.
|
|
29
|
+
*/
|
|
30
|
+
strongest: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: !1
|
|
33
|
+
},
|
|
34
|
+
/**
|
|
35
|
+
* Sets the type of typography variant.
|
|
36
|
+
* @values caption, body, subtitle, title.
|
|
37
|
+
*/
|
|
38
|
+
variant: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: a.BODY,
|
|
41
|
+
validator: (t) => Object.values(a).includes(t)
|
|
42
|
+
},
|
|
43
|
+
/**
|
|
44
|
+
* Adds the medium class modifier.
|
|
45
|
+
* Applicable to the Title variant.
|
|
46
|
+
*/
|
|
47
|
+
medium: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: !1
|
|
50
|
+
},
|
|
51
|
+
/**
|
|
52
|
+
* Adds the large class modifier.
|
|
53
|
+
* Applicable to the Title variant.
|
|
54
|
+
*/
|
|
55
|
+
large: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: !1
|
|
58
|
+
},
|
|
59
|
+
/**
|
|
60
|
+
* Adds the medium class modifier.
|
|
61
|
+
* Applicable to tje Body variant.
|
|
62
|
+
*/
|
|
63
|
+
wide: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: !1
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
setup(t) {
|
|
69
|
+
return {
|
|
70
|
+
conditionalClasses: i(() => ({
|
|
71
|
+
// Caption
|
|
72
|
+
[`b-typography--${a.CAPTION}`]: t.variant === a.CAPTION,
|
|
73
|
+
[`b-typography--${a.CAPTION}-${e.WIDE}`]: t.variant === a.CAPTION && t.wide,
|
|
74
|
+
[`b-typography--${a.CAPTION}-${e.STRONGER}`]: t.variant === a.CAPTION && t.stronger,
|
|
75
|
+
// Body
|
|
76
|
+
[`b-typography--${a.BODY}`]: t.variant === a.BODY,
|
|
77
|
+
[`b-typography--${a.BODY}-${e.WIDE}`]: t.variant === a.BODY && t.wide,
|
|
78
|
+
[`b-typography--${a.BODY}-${e.STRONGER}`]: t.variant === a.BODY && t.stronger,
|
|
79
|
+
[`b-typography--${a.BODY}-${e.STRONGEST}`]: t.variant === a.BODY && t.strongest,
|
|
80
|
+
// Subtitle
|
|
81
|
+
[`b-typography--${a.SUBTITLE}`]: t.variant === a.SUBTITLE,
|
|
82
|
+
[`b-typography--${a.SUBTITLE}-${e.STRONGER}`]: t.variant === a.SUBTITLE && t.stronger,
|
|
83
|
+
// Title
|
|
84
|
+
[`b-typography--${a.TITLE}`]: t.variant === a.TITLE && !t.medium && !t.large,
|
|
85
|
+
[`b-typography--${a.TITLE}-${e.MEDIUM}`]: t.variant === a.TITLE && t.medium,
|
|
86
|
+
[`b-typography--${a.TITLE}-${e.LARGE}`]: t.variant === a.TITLE && t.large
|
|
87
|
+
}))
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
var d = function() {
|
|
92
|
+
var n = this, s = n._self._c;
|
|
93
|
+
return n._self._setupProxy, s(n.el, { tag: "component", staticClass: "b-typography", class: n.conditionalClasses, attrs: { "data-testid": "typography" } }, [n._t("default")], 2);
|
|
94
|
+
}, I = [], O = /* @__PURE__ */ u(
|
|
95
|
+
_,
|
|
96
|
+
d,
|
|
97
|
+
I,
|
|
98
|
+
!1,
|
|
99
|
+
null,
|
|
100
|
+
"9eb470a5",
|
|
101
|
+
null,
|
|
102
|
+
null
|
|
103
|
+
);
|
|
104
|
+
const b = O.exports;
|
|
105
|
+
export {
|
|
106
|
+
b as BentoTypography,
|
|
107
|
+
l as BentoTypographyElement,
|
|
108
|
+
e as BentoTypographyModifier,
|
|
109
|
+
a as BentoTypographyVariant
|
|
110
|
+
};
|
|
111
|
+
//# sourceMappingURL=typography.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typography.js","sources":["../src/components/typography/typography.types.ts","../src/components/typography/typography.vue"],"sourcesContent":["export enum BentoTypographyVariant {\n CAPTION = 'caption',\n BODY = 'body',\n SUBTITLE = 'subtitle',\n TITLE = 'title',\n}\n\nexport enum BentoTypographyModifier {\n WIDE = 'wide',\n STRONGER = 'stronger',\n STRONGER_WIDE = 'stronger-wide',\n STRONGEST = 'strongest',\n STRONGEST_WIDE = 'strongest-wide',\n MEDIUM = 'm',\n LARGE = 'l',\n MOBILE = 'mobile',\n}\n\nexport enum BentoTypographyElement {\n H1 = 'h1',\n H2 = 'h2',\n H3 = 'h3',\n H4 = 'h4',\n H5 = 'h5',\n H6 = 'h6',\n DIV = 'div',\n PARAGRAPH = 'p',\n SPAN = 'span',\n}\n","<template>\n <component :is=\"el\" class=\"b-typography\" :class=\"conditionalClasses\" data-testid=\"typography\">\n <slot />\n </component>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, PropType } from 'vue';\n import { BentoTypographyElement, BentoTypographyModifier, BentoTypographyVariant } from './typography.types';\n\n /**\n * The Typography component makes it easy to apply a default set of font weights, sizes and other text styles\n * easily to text. The variants and properties match with those found in Figma.\n *\n * For example, seeing text with the typography styling of\n *\n * @example\n * import { BentoTypography } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoTypography },\n * template: `\n * <bento-typography>\n * ... text content\n * </bento-typography>\n * `\n * }\n */\n export default defineComponent({\n name: 'bento-typography',\n inheritAttrs: true,\n props: {\n /**\n * Sets the HTML DOM element.\n * @values h1, h2, h3, h4, h5, h6, div, p, span\n */\n el: {\n type: String as PropType<BentoTypographyElement>,\n default: BentoTypographyElement.PARAGRAPH,\n validator: (value: BentoTypographyElement) => Object.values(BentoTypographyElement).includes(value),\n },\n\n /**\n * Adds the stronger class modifier.\n * Applicable to Caption, Body and Subtitle variants.\n */\n stronger: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Adds the strongest class modifier.\n * Applicable to Caption, Body and Subtitle variants.\n */\n strongest: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Sets the type of typography variant.\n * @values caption, body, subtitle, title.\n */\n variant: {\n type: String as PropType<BentoTypographyVariant>,\n default: BentoTypographyVariant.BODY,\n validator: (value: BentoTypographyVariant) => Object.values(BentoTypographyVariant).includes(value),\n },\n\n /**\n * Adds the medium class modifier.\n * Applicable to the Title variant.\n */\n medium: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Adds the large class modifier.\n * Applicable to the Title variant.\n */\n large: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Adds the medium class modifier.\n * Applicable to tje Body variant.\n */\n wide: {\n type: Boolean,\n default: false,\n },\n },\n setup(props) {\n const conditionalClasses = computed(() => ({\n // Caption\n [`b-typography--${BentoTypographyVariant.CAPTION}`]: props.variant === BentoTypographyVariant.CAPTION,\n [`b-typography--${BentoTypographyVariant.CAPTION}-${BentoTypographyModifier.WIDE}`]:\n props.variant === BentoTypographyVariant.CAPTION && props.wide,\n [`b-typography--${BentoTypographyVariant.CAPTION}-${BentoTypographyModifier.STRONGER}`]:\n props.variant === BentoTypographyVariant.CAPTION && props.stronger,\n\n // Body\n [`b-typography--${BentoTypographyVariant.BODY}`]: props.variant === BentoTypographyVariant.BODY,\n [`b-typography--${BentoTypographyVariant.BODY}-${BentoTypographyModifier.WIDE}`]:\n props.variant === BentoTypographyVariant.BODY && props.wide,\n [`b-typography--${BentoTypographyVariant.BODY}-${BentoTypographyModifier.STRONGER}`]:\n props.variant === BentoTypographyVariant.BODY && props.stronger,\n [`b-typography--${BentoTypographyVariant.BODY}-${BentoTypographyModifier.STRONGEST}`]:\n props.variant === BentoTypographyVariant.BODY && props.strongest,\n\n // Subtitle\n [`b-typography--${BentoTypographyVariant.SUBTITLE}`]: props.variant === BentoTypographyVariant.SUBTITLE,\n [`b-typography--${BentoTypographyVariant.SUBTITLE}-${BentoTypographyModifier.STRONGER}`]:\n props.variant === BentoTypographyVariant.SUBTITLE && props.stronger,\n\n // Title\n [`b-typography--${BentoTypographyVariant.TITLE}`]:\n props.variant === BentoTypographyVariant.TITLE && !props.medium && !props.large,\n [`b-typography--${BentoTypographyVariant.TITLE}-${BentoTypographyModifier.MEDIUM}`]:\n props.variant === BentoTypographyVariant.TITLE && props.medium,\n [`b-typography--${BentoTypographyVariant.TITLE}-${BentoTypographyModifier.LARGE}`]:\n props.variant === BentoTypographyVariant.TITLE && props.large,\n }));\n\n return {\n conditionalClasses,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./typography.scss\" />\n"],"names":["BentoTypographyVariant","BentoTypographyVariant2","BentoTypographyModifier","BentoTypographyModifier2","BentoTypographyElement","BentoTypographyElement2","_sfc_main","defineComponent","value","props","computed"],"mappings":";;;AAAY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,UAAA,WACAA,EAAA,OAAA,QACAA,EAAA,WAAA,YACAA,EAAA,QAAA,SAJQA,IAAAD,KAAA,CAAA,CAAA,GAOAE,IAAA,kBAAAC,OACRA,EAAA,OAAA,QACAA,EAAA,WAAA,YACAA,EAAA,gBAAA,iBACAA,EAAA,YAAA,aACAA,EAAA,iBAAA,kBACAA,EAAA,SAAA,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