@adyen/bento-vue2 1.95.0 → 1.96.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@types/index.d.ts +77 -0
- package/dist/assets/accordion-item.css +1 -1
- package/dist/assets/action-bar.css +1 -1
- package/dist/assets/base-modal.css +1 -1
- package/dist/assets/button-actions.css +1 -1
- package/dist/assets/card.css +1 -1
- package/dist/assets/data-grid.css +1 -1
- package/dist/assets/date-picker.css +1 -1
- package/dist/assets/dialog-page.css +1 -1
- package/dist/assets/draggable-handle.css +1 -1
- package/dist/assets/dropdown.css +1 -1
- package/dist/assets/field-label.css +1 -1
- package/dist/assets/file-uploader.css +1 -1
- package/dist/assets/filter-bar.css +1 -1
- package/dist/assets/input-field-password.css +1 -1
- package/dist/assets/inspector.css +1 -1
- package/dist/assets/modal-fullscreen.css +1 -1
- package/dist/assets/navigation-menu-group.css +1 -1
- package/dist/assets/secondary-nav.css +1 -1
- package/dist/assets/sidepanel.css +1 -1
- package/dist/chunks/{calendar.ofn3G6eW.js → calendar.D0JIbmoS.js} +310 -304
- package/dist/chunks/calendar.D0JIbmoS.js.map +1 -0
- package/dist/chunks/{code-snippet.B3iCsNmb.js → code-snippet.lcQRsLdZ.js} +2 -2
- package/dist/chunks/{code-snippet.B3iCsNmb.js.map → code-snippet.lcQRsLdZ.js.map} +1 -1
- package/dist/chunks/{dashboard-section.HFJcf8-_.js → dashboard-section.DiGQXS9L.js} +2 -2
- package/dist/chunks/{dashboard-section.HFJcf8-_.js.map → dashboard-section.DiGQXS9L.js.map} +1 -1
- package/dist/chunks/{data-grid-template.BjfPUEoH.js → data-grid-template.BVppx9kZ.js} +2 -2
- package/dist/chunks/{data-grid-template.BjfPUEoH.js.map → data-grid-template.BVppx9kZ.js.map} +1 -1
- package/dist/chunks/{data-grid.Cua2Jxvq.js → data-grid.Djy7XjVS.js} +10 -10
- package/dist/chunks/{data-grid.Cua2Jxvq.js.map → data-grid.Djy7XjVS.js.map} +1 -1
- package/dist/chunks/{date-picker.CYDTf6De.js → date-picker.BWxvyK5J.js} +40 -40
- package/dist/chunks/date-picker.BWxvyK5J.js.map +1 -0
- package/dist/chunks/{date-range-picker.DGGvwRfn.js → date-range-picker.gfRJmzXn.js} +10 -10
- package/dist/chunks/{date-range-picker.DGGvwRfn.js.map → date-range-picker.gfRJmzXn.js.map} +1 -1
- package/dist/chunks/{date-time-picker.CyNb-xDm.js → date-time-picker.BIl9kFLh.js} +5 -5
- package/dist/chunks/{date-time-picker.CyNb-xDm.js.map → date-time-picker.BIl9kFLh.js.map} +1 -1
- package/dist/chunks/{draggable-handle.CU1L7J87.js → draggable-handle.DIhHtHG9.js} +530 -499
- package/dist/chunks/{draggable-handle.CU1L7J87.js.map → draggable-handle.DIhHtHG9.js.map} +1 -1
- package/dist/chunks/{dropdown-tag.C1qg52L9.js → dropdown-tag.CuDxdSfb.js} +2 -2
- package/dist/chunks/{dropdown-tag.C1qg52L9.js.map → dropdown-tag.CuDxdSfb.js.map} +1 -1
- package/dist/chunks/{dropdown.BEurqT8m.js → dropdown.C70AlvOT.js} +264 -257
- package/dist/chunks/dropdown.C70AlvOT.js.map +1 -0
- package/dist/chunks/{filter-bar.gjMPoK6d.js → filter-bar.C6ZBgizQ.js} +15 -15
- package/dist/chunks/{filter-bar.gjMPoK6d.js.map → filter-bar.C6ZBgizQ.js.map} +1 -1
- package/dist/chunks/{header-with-views.B2Ok5KI1.js → header-with-views.m0xMmoav.js} +3 -3
- package/dist/chunks/{header-with-views.B2Ok5KI1.js.map → header-with-views.m0xMmoav.js.map} +1 -1
- package/dist/chunks/{input-field-password.viF49CQh.js → input-field-password.CRqYWZGS.js} +34 -34
- package/dist/chunks/input-field-password.CRqYWZGS.js.map +1 -0
- package/dist/chunks/{input-field-phone-number.DnpTj7q5.js → input-field-phone-number.DHiuL0cF.js} +2 -2
- package/dist/chunks/{input-field-phone-number.DnpTj7q5.js.map → input-field-phone-number.DHiuL0cF.js.map} +1 -1
- package/dist/chunks/{input-field.D86PSAiu.js → input-field.BkQZ6Qzl.js} +2 -2
- package/dist/chunks/{input-field.D86PSAiu.js.map → input-field.BkQZ6Qzl.js.map} +1 -1
- package/dist/chunks/{input-time.LyKZXnVO.js → input-time.BiOHvUEA.js} +3 -3
- package/dist/chunks/{input-time.LyKZXnVO.js.map → input-time.BiOHvUEA.js.map} +1 -1
- package/dist/chunks/{pagination.CJ3d1O_s.js → pagination.DItyAwy1.js} +2 -2
- package/dist/chunks/{pagination.CJ3d1O_s.js.map → pagination.DItyAwy1.js.map} +1 -1
- package/dist/chunks/{search-bar.BvHhXdNu.js → search-bar.D-WK8eMQ.js} +3 -3
- package/dist/chunks/{search-bar.BvHhXdNu.js.map → search-bar.D-WK8eMQ.js.map} +1 -1
- package/dist/chunks/secondary-nav.C7lEDaoj.js +259 -0
- package/dist/chunks/{secondary-nav.BvbT8LXa.js.map → secondary-nav.C7lEDaoj.js.map} +1 -1
- package/dist/chunks/tab.QEKU5Udp.js +256 -0
- package/dist/chunks/{tab.YQXssvyU.js.map → tab.QEKU5Udp.js.map} +1 -1
- package/dist/chunks/{use-cached-selected-values.txnml8sE.js → use-cached-selected-values.D0s14AxT.js} +2 -2
- package/dist/chunks/{use-cached-selected-values.txnml8sE.js.map → use-cached-selected-values.D0s14AxT.js.map} +1 -1
- package/dist/chunks/{use-date-input-formatter.D7Ud6Ana.js → use-date-input-formatter.B5GQd3s2.js} +2 -2
- package/dist/chunks/{use-date-input-formatter.D7Ud6Ana.js.map → use-date-input-formatter.B5GQd3s2.js.map} +1 -1
- package/dist/code-snippet.js +1 -1
- package/dist/dashboard-template.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-time-picker.js +1 -1
- package/dist/draggable.js +1 -1
- package/dist/dropdown.js +3 -3
- package/dist/filter-bar.js +1 -1
- package/dist/header-with-views.js +1 -1
- package/dist/index.js +22 -22
- package/dist/input-field-password.js +1 -1
- package/dist/input-field-phone-number.js +1 -1
- package/dist/input-field.js +1 -1
- package/dist/input-time.js +1 -1
- package/dist/internal.js +2 -2
- package/dist/pagination.js +1 -1
- package/dist/search-bar.js +2 -2
- package/dist/secondary-nav.js +1 -1
- package/dist/tabs.js +1 -1
- package/dist/web-types.json +11 -1
- package/package.json +3 -3
- package/dist/chunks/calendar.ofn3G6eW.js.map +0 -1
- package/dist/chunks/date-picker.CYDTf6De.js.map +0 -1
- package/dist/chunks/dropdown.BEurqT8m.js.map +0 -1
- package/dist/chunks/input-field-password.viF49CQh.js.map +0 -1
- package/dist/chunks/secondary-nav.BvbT8LXa.js +0 -223
- package/dist/chunks/tab.YQXssvyU.js +0 -229
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { defineComponent as S, inject as $, ref as T, computed as p, watch as D, toRef as F, readonly as R, provide as L } from "vue";
|
|
2
|
+
import { B as V } from "./dropdown.C70AlvOT.js";
|
|
3
|
+
import { B as w } from "./typography.C8lPlsbD.js";
|
|
4
|
+
import { B as A } from "./tag.CbNFG45Y.js";
|
|
5
|
+
import { C as M } from "./cross-circle-fill.DTDtgLMf.js";
|
|
6
|
+
import { b as P } from "./index.CJYgd0QI.js";
|
|
7
|
+
import { u as O } from "./index.B6WW_F-J.js";
|
|
8
|
+
import { a as z } from "./es6.Cu3DYUPA.js";
|
|
9
|
+
import { B as U } from "./button.DITA6YtS.js";
|
|
10
|
+
import { C as H } from "./chevron-down.eYtgv5ly.js";
|
|
11
|
+
import { C as j } from "./chevron-up.d8cwIlA_.js";
|
|
12
|
+
import { g as G } from "./generate-uid.NJ8tVoha.js";
|
|
13
|
+
import { u as J } from "./use-expandable-content-height.2WJLCL-R.js";
|
|
14
|
+
import { n as B } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
|
|
15
|
+
import "../assets/secondary-nav.css";
|
|
16
|
+
const k = /* @__PURE__ */ Symbol("secondary nav state"), X = {
|
|
17
|
+
"de-DE": {
|
|
18
|
+
errorCount: "Fehler | Fehler"
|
|
19
|
+
},
|
|
20
|
+
"en-GB": {
|
|
21
|
+
errorCount: "error | errors"
|
|
22
|
+
},
|
|
23
|
+
"en-US": {
|
|
24
|
+
errorCount: "error | errors"
|
|
25
|
+
},
|
|
26
|
+
"es-ES": {
|
|
27
|
+
errorCount: "error | errores"
|
|
28
|
+
},
|
|
29
|
+
"es-MX": {
|
|
30
|
+
errorCount: "error | errores"
|
|
31
|
+
},
|
|
32
|
+
"fr-FR": {
|
|
33
|
+
errorCount: "erreur | erreurs"
|
|
34
|
+
},
|
|
35
|
+
"it-IT": {
|
|
36
|
+
errorCount: "errore | errori"
|
|
37
|
+
},
|
|
38
|
+
"ja-JP": {
|
|
39
|
+
errorCount: "エラー | エラー"
|
|
40
|
+
},
|
|
41
|
+
"pt-BR": {
|
|
42
|
+
errorCount: "erro | erros"
|
|
43
|
+
},
|
|
44
|
+
"zh-CN": {
|
|
45
|
+
errorCount: "错误 | 错误"
|
|
46
|
+
}
|
|
47
|
+
}, q = { i18n: { messages: X } }, Q = /* @__PURE__ */ S({
|
|
48
|
+
...q,
|
|
49
|
+
__name: "secondary-nav-item",
|
|
50
|
+
props: {
|
|
51
|
+
label: null,
|
|
52
|
+
value: null,
|
|
53
|
+
items: null,
|
|
54
|
+
isSubItem: { type: Boolean },
|
|
55
|
+
errorCounter: null
|
|
56
|
+
},
|
|
57
|
+
emits: ["click"],
|
|
58
|
+
setup(_, { emit: o }) {
|
|
59
|
+
const e = _, { tc: r } = O(), { activeItemValue: t, updateActiveItemValue: i, allowExpandableItemNavigation: y } = $(k), m = "b-secondary-nav-item__animation--content", u = T(!1), N = G("secondary-nav-sub-items"), g = T(null), v = p(() => {
|
|
60
|
+
var s;
|
|
61
|
+
return !!((s = e.items) != null && s.length);
|
|
62
|
+
}), d = p(() => t.value === e.value), I = p(() => v.value && !y.value), { contentHeight: b } = J(g, u), C = p(() => b.value ? { "max-height": b.value } : {}), h = p(() => ({
|
|
63
|
+
"b-secondary-nav-item__option--active": d.value,
|
|
64
|
+
"b-secondary-nav-item__option--expandable": v.value,
|
|
65
|
+
"b-secondary-nav-item__option--sub-item": e.isSubItem
|
|
66
|
+
})), x = (s) => {
|
|
67
|
+
o("click", s), i(e.value);
|
|
68
|
+
}, n = () => {
|
|
69
|
+
u.value = !u.value;
|
|
70
|
+
}, a = (s, c) => s.some(
|
|
71
|
+
(f) => f.value === c || (f.items ? a(f.items, c) : !1)
|
|
72
|
+
), l = (s) => s.some((c) => !!c.errorCounter || (c.items ? l(c.items) : !1));
|
|
73
|
+
return D(
|
|
74
|
+
[t, () => e.items],
|
|
75
|
+
([s]) => {
|
|
76
|
+
v.value && e.items && (a(e.items, s) || l(e.items)) && (u.value = !0);
|
|
77
|
+
},
|
|
78
|
+
{ immediate: !0, deep: !0 }
|
|
79
|
+
), { __sfc: !0, tc: r, activeItemValue: t, updateActiveItemValue: i, allowExpandableItemNavigation: y, CONTENT_TRANSITION_NAME: m, props: e, isOpen: u, subItemsId: N, subItemsRef: g, hasSubItems: v, isItemSelected: d, expandleItemIsToggleOnly: I, contentHeight: b, subItemsMaxHeight: C, conditionalClasses: h, emit: o, onClick: x, onToggleClick: n, hasActiveDescendant: a, hasDescendantErrors: l, BentoButton: U, BentoTag: A, BentoTypography: w, ChevronDownIcon: H, ChevronUpIcon: j, CrossCircleFillIcon: M };
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
var Y = function() {
|
|
83
|
+
var o = this, e = o._self._c, r = o._self._setupProxy;
|
|
84
|
+
return e("div", { staticClass: "b-secondary-nav-item" }, [e("div", { staticClass: "b-secondary-nav-item__wrapper" }, [e("button", { staticClass: "b-secondary-nav-item__option", class: r.conditionalClasses, attrs: { "aria-current": r.isItemSelected ? "page" : void 0, "aria-expanded": r.expandleItemIsToggleOnly ? `${r.isOpen}` : void 0, "aria-controls": r.expandleItemIsToggleOnly ? r.subItemsId : void 0 }, on: { click: function(t) {
|
|
85
|
+
r.expandleItemIsToggleOnly ? r.onToggleClick() : r.onClick(t);
|
|
86
|
+
} } }, [e(r.BentoTypography, { staticClass: "b-secondary-nav-item__title", attrs: { variant: "body", stronger: "" } }, [o._v(" " + o._s(o.label) + " ")]), o.errorCounter ? e(r.BentoTag, { staticClass: "b-secondary-nav-item__error-counter", attrs: { variant: "red" }, scopedSlots: o._u([{ key: "icon", fn: function() {
|
|
87
|
+
return [e(r.CrossCircleFillIcon, { attrs: { "aria-hidden": "true" } })];
|
|
88
|
+
}, proxy: !0 }], null, !1, 196511213) }, [e("span", [o._v(o._s(o.errorCounter))]), e("span", { staticClass: "b-secondary-nav-item__visually-hidden" }, [o._v(o._s(r.tc("errorCount", o.errorCounter)))])]) : o._e()], 1), r.hasSubItems ? e(r.BentoButton, { staticClass: "b-secondary-nav-item__toggle", attrs: { "aria-hidden": r.expandleItemIsToggleOnly, tabindex: r.expandleItemIsToggleOnly ? -1 : void 0, variant: "tertiary", "aria-label": r.isOpen ? `Collapse ${o.label}` : `Expand ${o.label}`, "aria-expanded": r.expandleItemIsToggleOnly ? void 0 : `${r.isOpen}`, "aria-controls": r.expandleItemIsToggleOnly ? void 0 : r.subItemsId }, on: { click: function(t) {
|
|
89
|
+
return t.stopPropagation(), r.onToggleClick.apply(null, arguments);
|
|
90
|
+
} }, scopedSlots: o._u([{ key: "iconLeft", fn: function() {
|
|
91
|
+
return [r.isOpen ? e(r.ChevronUpIcon, { staticClass: "b-secondary-nav-item__icon", attrs: { "aria-hidden": "true" } }) : e(r.ChevronDownIcon, { staticClass: "b-secondary-nav-item__icon", attrs: { "aria-hidden": "true" } })];
|
|
92
|
+
}, proxy: !0 }], null, !1, 3107710104) }) : o._e()], 1), e("Transition", { attrs: { name: r.CONTENT_TRANSITION_NAME } }, [r.hasSubItems && r.isOpen ? e("div", { style: r.subItemsMaxHeight, attrs: { id: r.subItemsId } }, [e("ul", { ref: "subItemsRef", staticClass: "b-secondary-nav-item__sub-items" }, o._l(o.items, function(t) {
|
|
93
|
+
return e("li", { key: t.value }, [e("secondary-nav-item", { attrs: { label: t.label, value: t.value, items: t.items, "error-counter": t.errorCounter, "is-sub-item": "" } })], 1);
|
|
94
|
+
}), 0)]) : o._e()])], 1);
|
|
95
|
+
}, K = [], W = /* @__PURE__ */ B(
|
|
96
|
+
Q,
|
|
97
|
+
Y,
|
|
98
|
+
K,
|
|
99
|
+
!1,
|
|
100
|
+
null,
|
|
101
|
+
"14334916"
|
|
102
|
+
);
|
|
103
|
+
const E = W.exports, Z = {}, ee = /* @__PURE__ */ S({
|
|
104
|
+
...Z,
|
|
105
|
+
__name: "secondary-nav-category",
|
|
106
|
+
props: {
|
|
107
|
+
label: null,
|
|
108
|
+
items: null
|
|
109
|
+
},
|
|
110
|
+
setup(_) {
|
|
111
|
+
return { __sfc: !0, BentoTypography: w, SecondaryNavItem: E };
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
var re = function() {
|
|
115
|
+
var o = this, e = o._self._c, r = o._self._setupProxy;
|
|
116
|
+
return e("section", { staticClass: "b-secondary-nav-category", attrs: { "aria-label": o.label } }, [e(r.BentoTypography, { staticClass: "b-secondary-nav-category__label", attrs: { el: "h1", variant: "caption", stronger: "" } }, [o._v(o._s(o.label))]), e("ul", { staticClass: "b-secondary-nav__list" }, o._l(o.items, function(t) {
|
|
117
|
+
return e("li", { key: t.value }, [e(r.SecondaryNavItem, { attrs: { label: t.label, value: t.value, items: t.items, "error-counter": t.errorCounter } })], 1);
|
|
118
|
+
}), 0)], 1);
|
|
119
|
+
}, oe = [], te = /* @__PURE__ */ B(
|
|
120
|
+
ee,
|
|
121
|
+
re,
|
|
122
|
+
oe,
|
|
123
|
+
!1,
|
|
124
|
+
null,
|
|
125
|
+
"777b2ce6"
|
|
126
|
+
);
|
|
127
|
+
const ne = te.exports, ae = {
|
|
128
|
+
"de-DE": {
|
|
129
|
+
errorCount: "Fehler | Fehler",
|
|
130
|
+
mobileDropdownAriaLabel: "Navigationsoptionen Dropdown-Menü"
|
|
131
|
+
},
|
|
132
|
+
"en-GB": {
|
|
133
|
+
errorCount: "error | errors",
|
|
134
|
+
mobileDropdownAriaLabel: "Navigation options drop-down"
|
|
135
|
+
},
|
|
136
|
+
"en-US": {
|
|
137
|
+
errorCount: "error | errors",
|
|
138
|
+
mobileDropdownAriaLabel: "Navigation options dropdown"
|
|
139
|
+
},
|
|
140
|
+
"es-ES": {
|
|
141
|
+
errorCount: "error | errores",
|
|
142
|
+
mobileDropdownAriaLabel: "Menú desplegable de opciones de navegación"
|
|
143
|
+
},
|
|
144
|
+
"es-MX": {
|
|
145
|
+
errorCount: "error | errores",
|
|
146
|
+
mobileDropdownAriaLabel: "Menú desplegable de opciones de navegación"
|
|
147
|
+
},
|
|
148
|
+
"fr-FR": {
|
|
149
|
+
errorCount: "erreur | erreurs",
|
|
150
|
+
mobileDropdownAriaLabel: "Menu déroulant des options de navigation"
|
|
151
|
+
},
|
|
152
|
+
"it-IT": {
|
|
153
|
+
errorCount: "errore | errori",
|
|
154
|
+
mobileDropdownAriaLabel: "Menu a tendina delle opzioni di navigazione"
|
|
155
|
+
},
|
|
156
|
+
"ja-JP": {
|
|
157
|
+
errorCount: "エラー | エラー",
|
|
158
|
+
mobileDropdownAriaLabel: "ナビゲーションオプションのドロップダウン"
|
|
159
|
+
},
|
|
160
|
+
"pt-BR": {
|
|
161
|
+
errorCount: "erro | erros",
|
|
162
|
+
mobileDropdownAriaLabel: "Menu suspenso de opções de navegação"
|
|
163
|
+
},
|
|
164
|
+
"zh-CN": {
|
|
165
|
+
errorCount: "错误 | 错误",
|
|
166
|
+
mobileDropdownAriaLabel: "导航选项下拉菜单"
|
|
167
|
+
}
|
|
168
|
+
}, se = {
|
|
169
|
+
i18n: { messages: ae }
|
|
170
|
+
}, le = /* @__PURE__ */ S({
|
|
171
|
+
...se,
|
|
172
|
+
__name: "secondary-nav",
|
|
173
|
+
props: {
|
|
174
|
+
items: null,
|
|
175
|
+
value: null,
|
|
176
|
+
allowExpandableItemNavigation: { type: Boolean }
|
|
177
|
+
},
|
|
178
|
+
emits: ["change"],
|
|
179
|
+
setup(_, { emit: o }) {
|
|
180
|
+
const e = _, { t: r, tc: t } = O(), i = P({
|
|
181
|
+
s: z
|
|
182
|
+
}), y = i.smallerOrEqual("s"), m = (n) => "items" in n && !("value" in n), u = (n, a = 0) => n.flatMap((l) => {
|
|
183
|
+
var c, f;
|
|
184
|
+
const s = {
|
|
185
|
+
label: l.label,
|
|
186
|
+
value: l.value,
|
|
187
|
+
data: { level: a, hasSubItems: !!((c = l.items) != null && c.length), errorCounter: l.errorCounter }
|
|
188
|
+
};
|
|
189
|
+
return (f = l.items) != null && f.length ? [s, ...u(l.items, a + 1)] : [s];
|
|
190
|
+
}), N = (n) => {
|
|
191
|
+
var a;
|
|
192
|
+
return !e.allowExpandableItemNavigation && ((a = n.data) == null ? void 0 : a.hasSubItems);
|
|
193
|
+
}, g = p(() => e.items.some((n) => m(n))), v = p(() => e.items.flatMap((n) => {
|
|
194
|
+
var a;
|
|
195
|
+
return m(n) ? [
|
|
196
|
+
{
|
|
197
|
+
label: n.label,
|
|
198
|
+
value: `category-${n.label}`,
|
|
199
|
+
items: u(n.items)
|
|
200
|
+
}
|
|
201
|
+
] : (a = n.items) != null && a.length ? u([n]) : [
|
|
202
|
+
{
|
|
203
|
+
label: n.label,
|
|
204
|
+
value: n.value,
|
|
205
|
+
data: { level: 0, errorCounter: n.errorCounter }
|
|
206
|
+
}
|
|
207
|
+
];
|
|
208
|
+
})), d = (n) => n.flatMap((a) => {
|
|
209
|
+
var l;
|
|
210
|
+
return [a, ...(l = a.items) != null && l.length ? d(a.items) : []];
|
|
211
|
+
}), I = (n) => {
|
|
212
|
+
var a;
|
|
213
|
+
return ((a = d(n).find((l) => {
|
|
214
|
+
var s;
|
|
215
|
+
return e.allowExpandableItemNavigation || !((s = l.items) != null && s.length);
|
|
216
|
+
})) == null ? void 0 : a.value) ?? "";
|
|
217
|
+
}, b = p(() => e.items.length ? I(
|
|
218
|
+
e.items.flatMap(
|
|
219
|
+
(n) => m(n) ? d(n.items) : d([n])
|
|
220
|
+
)
|
|
221
|
+
) : ""), C = T(e.value ?? b.value), h = (n) => {
|
|
222
|
+
C.value = n, o("change", n);
|
|
223
|
+
}, x = {
|
|
224
|
+
activeItemValue: R(C),
|
|
225
|
+
updateActiveItemValue: h,
|
|
226
|
+
allowExpandableItemNavigation: F(e, "allowExpandableItemNavigation")
|
|
227
|
+
};
|
|
228
|
+
return D(
|
|
229
|
+
() => e.value,
|
|
230
|
+
(n) => {
|
|
231
|
+
n !== void 0 && (C.value = n);
|
|
232
|
+
}
|
|
233
|
+
), L(k, x), { __sfc: !0, t: r, tc: t, breakpoints: i, isMobile: y, props: e, emit: o, isCategory: m, mapNestedItems: u, isMobileOptionDisabled: N, hasCategories: g, mobileDropdownItems: v, flattenNestedItems: d, findFirstSelectableNestedItemValue: I, activeItemValueFallback: b, activeItemValue: C, updateActiveItemValue: h, state: x, SecondaryNavItem: E, SecondaryNavCategory: ne, BentoDropdown: V, BentoTypography: w, BentoTag: A, CrossCircleFillIcon: M };
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
var ie = function() {
|
|
237
|
+
var o = this, e = o._self._c, r = o._self._setupProxy;
|
|
238
|
+
return e("nav", { staticClass: "b-secondary-nav" }, [r.isMobile ? e(r.BentoDropdown, { attrs: { "aria-label": r.t("mobileDropdownAriaLabel"), items: r.mobileDropdownItems, "static-categories": r.hasCategories, "model-value": r.activeItemValue, "is-option-disabled": r.isMobileOptionDisabled }, on: { "update:model-value": r.updateActiveItemValue }, scopedSlots: o._u([{ key: "display-value", fn: function({ label: t }) {
|
|
239
|
+
return [e(r.BentoTypography, { attrs: { el: "span" } }, [o._v(" " + o._s(t) + " ")])];
|
|
240
|
+
} }, { key: "default", fn: function({ label: t, data: i }) {
|
|
241
|
+
return [e(r.BentoTypography, { class: { "b-secondary-nav__option": !0, "b-secondary-nav__nested-option": !!(i != null && i.level) }, attrs: { el: "div" } }, [o._v(" " + o._s(t) + " "), i != null && i.errorCounter ? e(r.BentoTag, { staticClass: "b-secondary-nav__error-counter", attrs: { variant: "red" }, scopedSlots: o._u([{ key: "icon", fn: function() {
|
|
242
|
+
return [e(r.CrossCircleFillIcon, { attrs: { "aria-hidden": "true" } })];
|
|
243
|
+
}, proxy: !0 }], null, !0) }, [e("span", [o._v(o._s(i.errorCounter))]), e("span", { staticClass: "b-secondary-nav__visually-hidden" }, [o._v(o._s(r.tc("errorCount", i.errorCounter)))])]) : o._e()], 1)];
|
|
244
|
+
} }], null, !1, 2211008849) }) : e("ul", { staticClass: "b-secondary-nav__list" }, o._l(o.items, function(t) {
|
|
245
|
+
return e("li", { key: t.label }, ["items" in t && !("value" in t) ? e(r.SecondaryNavCategory, { attrs: { label: t.label, items: t.items } }) : e(r.SecondaryNavItem, { attrs: { label: t.label, value: t.value, items: t.items, "error-counter": t.errorCounter } })], 1);
|
|
246
|
+
}), 0)], 1);
|
|
247
|
+
}, ue = [], ce = /* @__PURE__ */ B(
|
|
248
|
+
le,
|
|
249
|
+
ie,
|
|
250
|
+
ue,
|
|
251
|
+
!1,
|
|
252
|
+
null,
|
|
253
|
+
"900dc964"
|
|
254
|
+
);
|
|
255
|
+
const Te = ce.exports;
|
|
256
|
+
export {
|
|
257
|
+
Te as s
|
|
258
|
+
};
|
|
259
|
+
//# sourceMappingURL=secondary-nav.C7lEDaoj.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secondary-nav.BvbT8LXa.js","sources":["../../src/components/secondary-nav/secondary-nav.keys.ts","../../src/components/secondary-nav/components/secondary-nav-item/secondary-nav-item.vue","../../src/components/secondary-nav/components/secondary-nav-category/secondary-nav-category.vue","../../src/components/secondary-nav/secondary-nav.vue"],"sourcesContent":["import { type InjectionKey } from 'vue';\nimport { type BentoSecondaryNavState } from './secondary-nav.types';\n\nexport const SECONDARY_NAV_STATE = Symbol('secondary nav state') as InjectionKey<BentoSecondaryNavState>;\n","<template>\n <div class=\"b-secondary-nav-item\">\n <div class=\"b-secondary-nav-item__wrapper\">\n <button\n class=\"b-secondary-nav-item__option\"\n :class=\"conditionalClasses\"\n :aria-current=\"isItemSelected ? 'page' : undefined\"\n :aria-expanded=\"expandleItemIsToggleOnly ? `${isOpen}` : undefined\"\n :aria-controls=\"expandleItemIsToggleOnly ? subItemsId : undefined\"\n @click=\"expandleItemIsToggleOnly ? onToggleClick() : onClick($event)\"\n >\n <bento-typography class=\"b-secondary-nav-item__title\" variant=\"body\" stronger>\n {{ label }}\n </bento-typography>\n <bento-tag v-if=\"errorCounter\" class=\"b-secondary-nav-item__error-counter\" variant=\"red\">\n <template #icon>\n <cross-circle-fill-icon aria-hidden=\"true\" />\n </template>\n <span>{{ errorCounter }}</span>\n <span class=\"b-secondary-nav-item__visually-hidden\">{{ tc('errorCount', errorCounter) }}</span>\n </bento-tag>\n </button>\n <bento-button\n v-if=\"hasSubItems\"\n :aria-hidden=\"expandleItemIsToggleOnly\"\n :tabindex=\"expandleItemIsToggleOnly ? -1 : undefined\"\n class=\"b-secondary-nav-item__toggle\"\n variant=\"tertiary\"\n :aria-label=\"isOpen ? `Collapse ${label}` : `Expand ${label}`\"\n :aria-expanded=\"!expandleItemIsToggleOnly ? `${isOpen}` : undefined\"\n :aria-controls=\"!expandleItemIsToggleOnly ? subItemsId : undefined\"\n @click.stop=\"onToggleClick\"\n >\n <template #iconLeft>\n <chevron-up-icon v-if=\"isOpen\" class=\"b-secondary-nav-item__icon\" aria-hidden=\"true\" />\n <chevron-down-icon v-else class=\"b-secondary-nav-item__icon\" aria-hidden=\"true\" />\n </template>\n </bento-button>\n </div>\n <Transition :name=\"CONTENT_TRANSITION_NAME\">\n <div v-if=\"hasSubItems && isOpen\" :id=\"subItemsId\" :style=\"subItemsMaxHeight\">\n <ul ref=\"subItemsRef\" class=\"b-secondary-nav-item__sub-items\">\n <li v-for=\"item in items\" :key=\"item.value\">\n <secondary-nav-item\n :label=\"item.label\"\n :value=\"item.value\"\n :items=\"item.items\"\n :error-counter=\"item.errorCounter\"\n is-sub-item\n />\n </li>\n </ul>\n </div>\n </Transition>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\n import { SECONDARY_NAV_STATE } from '../../secondary-nav.keys';\n import { BentoButton } from '@/components/button';\n import { BentoTag } from '@/components/tag';\n import { BentoTypography } from '@/components/typography';\n import ChevronDownIcon from '@adyen/ui-assets-icons-16/vue/chevron-down';\n import ChevronUpIcon from '@adyen/ui-assets-icons-16/vue/chevron-up';\n import CrossCircleFillIcon from '@adyen/ui-assets-icons-16/vue/cross-circle-fill';\n import { computed, inject, ref, watch } from 'vue';\n import { useI18n } from '@/utils/ts/i18n';\n import { generateUid } from '@/core/utils/ts';\n import { type BentoSecondaryNavItemsItem } from '../../secondary-nav.types';\n import { useExpandableContentHeight } from '@/composables/use-expandable-content-height/use-expandable-content-height';\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const { tc } = useI18n<{ message: MessageSchema }>({ messages });\n const { activeItemValue, updateActiveItemValue, allowExpandableItemNavigation } = inject(SECONDARY_NAV_STATE);\n const CONTENT_TRANSITION_NAME = 'b-secondary-nav-item__animation--content';\n\n const props = defineProps({\n label: null,\n value: null,\n items: null,\n isSubItem: { type: Boolean },\n errorCounter: null\n});\n\n const isOpen = ref(false);\n const subItemsId = generateUid('secondary-nav-sub-items');\n const subItemsRef = ref<HTMLUListElement>(null);\n const hasSubItems = computed(() => !!props.items?.length);\n const isItemSelected = computed(() => activeItemValue.value === props.value);\n const expandleItemIsToggleOnly = computed(() => hasSubItems.value && !allowExpandableItemNavigation.value);\n const { contentHeight } = useExpandableContentHeight(subItemsRef, isOpen);\n const subItemsMaxHeight = computed(() => (contentHeight.value ? { 'max-height': contentHeight.value } : {}));\n\n const conditionalClasses = computed(() => ({\n 'b-secondary-nav-item__option--active': isItemSelected.value,\n 'b-secondary-nav-item__option--expandable': hasSubItems.value,\n 'b-secondary-nav-item__option--sub-item': props.isSubItem,\n }));\n\n const emit = defineEmits([\"click\"]);\n\n const onClick = (e: MouseEvent) => {\n emit('click', e);\n updateActiveItemValue(props.value);\n };\n\n const onToggleClick = () => {\n isOpen.value = !isOpen.value;\n };\n\n const hasActiveDescendant = (items: Array<BentoSecondaryNavItemsItem>, value: string): boolean => {\n return items.some(\n item => item.value === value || (item.items ? hasActiveDescendant(item.items, value) : false)\n );\n };\n\n const hasDescendantErrors = (items: Array<BentoSecondaryNavItemsItem>): boolean =>\n items.some(item => !!item.errorCounter || (item.items ? hasDescendantErrors(item.items) : false));\n\n watch(\n [activeItemValue, () => props.items],\n ([activeValue]) => {\n if (hasSubItems.value && props.items) {\n if (hasActiveDescendant(props.items, activeValue) || hasDescendantErrors(props.items)) {\n isOpen.value = true;\n }\n }\n },\n { immediate: true, deep: true }\n );\n</script>\n\n<script lang=\"ts\">\n /**\n * This component shouldn't be used directly. It is internally used by {@see BentoSecondaryNav}\n */\n export default { i18n: { messages } };\n</script>\n\n<style lang=\"scss\" scoped src=\"./secondary-nav-item.scss\" />\n","<template>\n <section class=\"b-secondary-nav-category\" :aria-label=\"label\">\n <bento-typography el=\"h1\" class=\"b-secondary-nav-category__label\" variant=\"caption\" stronger>{{\n label\n }}</bento-typography>\n <ul class=\"b-secondary-nav__list\">\n <li v-for=\"item in items\" :key=\"item.value\">\n <secondary-nav-item\n :label=\"item.label\"\n :value=\"item.value\"\n :items=\"item.items\"\n :error-counter=\"item.errorCounter\"\n />\n </li>\n </ul>\n </section>\n</template>\n\n<script lang=\"ts\" setup>\n import { BentoTypography } from '@/components/typography';\n import { SecondaryNavItem } from '../secondary-nav-item';\n import { type BentoSecondaryNavItemsItem } from '../../secondary-nav.types';\n\n defineProps({\n label: null,\n items: null\n});\n</script>\n\n<script lang=\"ts\">\n /**\n * This component shouldn't be used directly. It is internally used by {@see BentoSecondaryNav}\n */\n export default {};\n</script>\n\n<style lang=\"scss\" scoped src=\"./secondary-nav-category.scss\" />\n","<template>\n <nav class=\"b-secondary-nav\">\n <bento-dropdown\n v-if=\"isMobile\"\n :aria-label=\"t('mobileDropdownAriaLabel')\"\n :items=\"mobileDropdownItems\"\n :static-categories=\"hasCategories\"\n :model-value=\"activeItemValue\"\n :is-option-disabled=\"isMobileOptionDisabled\"\n @update:model-value=\"updateActiveItemValue\"\n >\n <template #display-value=\"{ label }\">\n <bento-typography el=\"span\">\n {{ label }}\n </bento-typography>\n </template>\n <template #default=\"{ label, data }\">\n <bento-typography\n el=\"div\"\n :class=\"{ 'b-secondary-nav__option': true, 'b-secondary-nav__nested-option': !!data?.level }\"\n >\n {{ label }}\n <bento-tag v-if=\"data?.errorCounter\" class=\"b-secondary-nav__error-counter\" variant=\"red\">\n <template #icon>\n <cross-circle-fill-icon aria-hidden=\"true\" />\n </template>\n <span>{{ data.errorCounter }}</span>\n <span class=\"b-secondary-nav__visually-hidden\">{{ tc('errorCount', data.errorCounter) }}</span>\n </bento-tag>\n </bento-typography>\n </template>\n </bento-dropdown>\n <ul v-else class=\"b-secondary-nav__list\">\n <li v-for=\"item in items\" :key=\"item.label\">\n <secondary-nav-category\n v-if=\"'items' in item && !('value' in item)\"\n :label=\"item.label\"\n :items=\"item.items\"\n />\n <secondary-nav-item\n v-else\n :label=\"item.label\"\n :value=\"item.value\"\n :items=\"item.items\"\n :error-counter=\"item.errorCounter\"\n />\n </li>\n </ul>\n </nav>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, provide, readonly, ref, toRef, watch } from 'vue';\n import { SecondaryNavItem } from './components/secondary-nav-item';\n import { SecondaryNavCategory } from './components/secondary-nav-category';\n import { SECONDARY_NAV_STATE } from './secondary-nav.keys';\n import {\n type BentoSecondaryNavItems,\n type BentoSecondaryNavItemsCategory,\n type BentoSecondaryNavItemsItem,\n type BentoSecondaryNavState,\n } from './secondary-nav.types';\n import { BentoDropdown } from '@/components/dropdown';\n import { BentoTypography } from '@/components/typography';\n import { BentoTag } from '@/components/tag';\n import CrossCircleFillIcon from '@adyen/ui-assets-icons-16/vue/cross-circle-fill';\n import { useBreakpoints } from '@vueuse/core';\n import { useI18n } from '@/utils/ts/i18n';\n import { type BentoListboxOptionItem, type BentoListboxOptions } from '@/types/listbox';\n import { BMediaQuerySMax } from '@adyen/bento-design-tokens/dist/js/bento/es6';\n\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const { t, tc } = useI18n<{ message: MessageSchema }>({ messages });\n\n const breakpoints = useBreakpoints({\n s: BMediaQuerySMax,\n });\n\n const isMobile = breakpoints.smallerOrEqual('s');\n const props = defineProps({\n items: null,\n value: null,\n allowExpandableItemNavigation: { type: Boolean }\n});\n\n const emit = defineEmits([\"change\"]);\n\n const isCategory = (item: BentoSecondaryNavItems[number]): item is BentoSecondaryNavItemsCategory =>\n 'items' in item && !('value' in item);\n\n const mapNestedItems = (items: Array<BentoSecondaryNavItemsItem>, level = 0): BentoListboxOptions =>\n items.flatMap((item): BentoListboxOptions => {\n const currentItem: BentoListboxOptionItem = {\n label: item.label,\n value: item.value,\n data: { level, hasSubItems: !!item.items?.length, errorCounter: item.errorCounter },\n };\n\n if (item.items?.length) {\n return [currentItem, ...mapNestedItems(item.items, level + 1)];\n }\n\n return [currentItem];\n });\n\n const isMobileOptionDisabled = (option: BentoListboxOptionItem): boolean =>\n !props.allowExpandableItemNavigation && (option.data as { hasSubItems?: boolean })?.hasSubItems;\n\n const hasCategories = computed(() => props.items.some(item => isCategory(item)));\n const mobileDropdownItems = computed<BentoListboxOptions>(() => {\n return props.items.flatMap(item => {\n if (isCategory(item)) {\n return [\n {\n label: item.label,\n value: `category-${item.label}`,\n items: mapNestedItems(item.items),\n } satisfies BentoListboxOptionItem,\n ];\n }\n\n if (item.items?.length) {\n return mapNestedItems([item]);\n }\n\n return [\n {\n label: item.label,\n value: item.value,\n data: { level: 0, errorCounter: item.errorCounter },\n } satisfies BentoListboxOptionItem,\n ];\n });\n });\n\n const flattenNestedItems = (items: Array<BentoSecondaryNavItemsItem>): Array<BentoSecondaryNavItemsItem> =>\n items.flatMap(item => [item, ...(item.items?.length ? flattenNestedItems(item.items) : [])]);\n\n const findFirstSelectableNestedItemValue = (items: Array<BentoSecondaryNavItemsItem>): string =>\n flattenNestedItems(items).find(item => props.allowExpandableItemNavigation || !item.items?.length)?.value ?? '';\n\n const activeItemValueFallback = computed(() => {\n if (!props.items.length) {\n return '';\n }\n\n return findFirstSelectableNestedItemValue(\n props.items.flatMap(item =>\n isCategory(item) ? flattenNestedItems(item.items) : flattenNestedItems([item])\n )\n );\n });\n\n const activeItemValue = ref(props.value ?? activeItemValueFallback.value);\n const updateActiveItemValue = (value: string) => {\n activeItemValue.value = value;\n emit('change', value);\n };\n\n // The component's state is inject on `secondary-nav-item` to determine the\n // current active item and to change its value\n const state: BentoSecondaryNavState = {\n activeItemValue: readonly(activeItemValue),\n updateActiveItemValue,\n allowExpandableItemNavigation: toRef(props, 'allowExpandableItemNavigation'),\n };\n\n watch(\n () => props.value,\n value => {\n if (value !== undefined) {\n activeItemValue.value = value;\n }\n }\n );\n\n provide(SECONDARY_NAV_STATE, state);\n</script>\n\n<script lang=\"ts\">\n /**\n * Secondary Nav offers users a structured way to access information.\n * It also provides a clear hierarchy for users to understand and navigate through various information.\n *\n * @example\n * import { BentoSecondaryNav } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoSecondaryNav },\n * template: `\n * <bento-secondary-nav :value=\"value\" :items=\"items\" />\n * `,\n * setup() {\n * const value = ref(2) // Active item value\n * const items: BentoSecondaryNavItemInfo[] = [\n * { label: 'Option 1', value: 1 },\n * { label: 'Option 2', value: 2 },\n * ];\n * return { items, value };\n * }\n * }\n */\n export default {\n i18n: { messages },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./secondary-nav.scss\" />\n"],"names":["SECONDARY_NAV_STATE","__default__$2","messages$1","tc","useI18n","activeItemValue","updateActiveItemValue","allowExpandableItemNavigation","inject","CONTENT_TRANSITION_NAME","isOpen","ref","subItemsId","generateUid","subItemsRef","hasSubItems","computed","_a","props","isItemSelected","expandleItemIsToggleOnly","contentHeight","useExpandableContentHeight","subItemsMaxHeight","conditionalClasses","onClick","e","emit","onToggleClick","hasActiveDescendant","items","value","item","hasDescendantErrors","watch","activeValue","__default__$1","__default__","messages","t","breakpoints","useBreakpoints","BMediaQuerySMax","isMobile","isCategory","mapNestedItems","level","currentItem","_b","isMobileOptionDisabled","option","hasCategories","mobileDropdownItems","flattenNestedItems","findFirstSelectableNestedItemValue","activeItemValueFallback","state","readonly","toRef","provide"],"mappings":";;;;;;;;;;;;;;;AAGO,MAAAA,IAAA,uBAAA,qBAAA;;;;GCuIHC,IAAA,EAAA,MAAA,EAAA,UAAAC,EAAA,EAAA;;;;;;;;;;;;iBAhEA,EAAA,IAAAC,EAAA,IAAAC,EAAA,GACA,EAAA,iBAAAC,GAAA,uBAAAC,GAAA,+BAAAC,EAAA,IAAAC,EAAAR,CAAA,GACAS,IAAA,4CAUAC,IAAAC,EAAA,EAAA,GACAC,IAAAC,EAAA,yBAAA,GACAC,IAAAH,EAAA,IAAA,GACAI,IAAAC,EAAA,MAAA;;AAAA,cAAA,GAAAC,IAAAC,EAAA,UAAA,QAAAD,EAAA;AAAA,KAAA,GACAE,IAAAH,EAAA,MAAAX,EAAA,UAAAa,EAAA,KAAA,GACAE,IAAAJ,EAAA,MAAAD,EAAA,SAAA,CAAAR,EAAA,KAAA,GACA,EAAA,eAAAc,EAAA,IAAAC,EAAAR,GAAAJ,CAAA,GACAa,IAAAP,EAAA,MAAAK,EAAA,QAAA,EAAA,cAAAA,EAAA,MAAA,IAAA,CAAA,CAAA,GAEAG,IAAAR,EAAA,OAAA;AAAA,MAA2C,wCAAAG,EAAA;AAAA,MACgB,4CAAAJ,EAAA;AAAA,MACC,0CAAAG,EAAA;AAAA,IACR,EAAA,GAKpDO,IAAA,CAAAC,MAAA;AACI,MAAAC,EAAA,SAAAD,CAAA,GACApB,EAAAY,EAAA,KAAA;AAAA,IAAiC,GAGrCU,IAAA,MAAA;AACI,MAAAlB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,MAAA,SAIAoC;AAAA,MAAOpC,EAAA,MAAA;AAAA,QACS,CAAAc,MAAAY,EAAAZ,CAAA,IAAAqB,EAAArB,EAAA,KAAA,IAAAqB,EAAA,CAAArB,CAAA,CAAA;AAAA,MACqE;AAAA,IACjF,IANA,EAOJ,GAGJ3B,IAAAM,EAAAO,EAAA,SAAAqC,EAAA,KAAA,GACAjD,IAAA,CAAAyB,MAAA;AACI,MAAA1B,EAAA,QAAA0B,GACAJ,EAAA,UAAAI,CAAA;AAAA,IAAoB,GAKxByB,IAAA;AAAA,MAAsC,iBAAAC,EAAApD,CAAA;AAAA,MACO,uBAAAC;AAAA,MACzC,+BAAAoD,EAAAxC,GAAA,+BAAA;AAAA,IAC2E;AAG/E,WAAAgB;AAAA,MAAA,MAAAhB,EAAA;AAAA,MACgB,CAAAa,MAAA;AAER,QAAAA,MAAA,WACI1B,EAAA,QAAA0B;AAAA,MACJ;AAAA,IACJ,GAGJ4B,EAAA3D,GAAAwD,CAAA;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"secondary-nav.C7lEDaoj.js","sources":["../../src/components/secondary-nav/secondary-nav.keys.ts","../../src/components/secondary-nav/components/secondary-nav-item/secondary-nav-item.vue","../../src/components/secondary-nav/components/secondary-nav-category/secondary-nav-category.vue","../../src/components/secondary-nav/secondary-nav.vue"],"sourcesContent":["import { type InjectionKey } from 'vue';\nimport { type BentoSecondaryNavState } from './secondary-nav.types';\n\nexport const SECONDARY_NAV_STATE = Symbol('secondary nav state') as InjectionKey<BentoSecondaryNavState>;\n","<template>\n <div class=\"b-secondary-nav-item\">\n <div class=\"b-secondary-nav-item__wrapper\">\n <button\n class=\"b-secondary-nav-item__option\"\n :class=\"conditionalClasses\"\n :aria-current=\"isItemSelected ? 'page' : undefined\"\n :aria-expanded=\"expandleItemIsToggleOnly ? `${isOpen}` : undefined\"\n :aria-controls=\"expandleItemIsToggleOnly ? subItemsId : undefined\"\n @click=\"expandleItemIsToggleOnly ? onToggleClick() : onClick($event)\"\n >\n <bento-typography class=\"b-secondary-nav-item__title\" variant=\"body\" stronger>\n {{ label }}\n </bento-typography>\n <bento-tag v-if=\"errorCounter\" class=\"b-secondary-nav-item__error-counter\" variant=\"red\">\n <template #icon>\n <cross-circle-fill-icon aria-hidden=\"true\" />\n </template>\n <span>{{ errorCounter }}</span>\n <span class=\"b-secondary-nav-item__visually-hidden\">{{ tc('errorCount', errorCounter) }}</span>\n </bento-tag>\n </button>\n <bento-button\n v-if=\"hasSubItems\"\n :aria-hidden=\"expandleItemIsToggleOnly\"\n :tabindex=\"expandleItemIsToggleOnly ? -1 : undefined\"\n class=\"b-secondary-nav-item__toggle\"\n variant=\"tertiary\"\n :aria-label=\"isOpen ? `Collapse ${label}` : `Expand ${label}`\"\n :aria-expanded=\"!expandleItemIsToggleOnly ? `${isOpen}` : undefined\"\n :aria-controls=\"!expandleItemIsToggleOnly ? subItemsId : undefined\"\n @click.stop=\"onToggleClick\"\n >\n <template #iconLeft>\n <chevron-up-icon v-if=\"isOpen\" class=\"b-secondary-nav-item__icon\" aria-hidden=\"true\" />\n <chevron-down-icon v-else class=\"b-secondary-nav-item__icon\" aria-hidden=\"true\" />\n </template>\n </bento-button>\n </div>\n <Transition :name=\"CONTENT_TRANSITION_NAME\">\n <div v-if=\"hasSubItems && isOpen\" :id=\"subItemsId\" :style=\"subItemsMaxHeight\">\n <ul ref=\"subItemsRef\" class=\"b-secondary-nav-item__sub-items\">\n <li v-for=\"item in items\" :key=\"item.value\">\n <secondary-nav-item\n :label=\"item.label\"\n :value=\"item.value\"\n :items=\"item.items\"\n :error-counter=\"item.errorCounter\"\n is-sub-item\n />\n </li>\n </ul>\n </div>\n </Transition>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\n import { SECONDARY_NAV_STATE } from '../../secondary-nav.keys';\n import { BentoButton } from '@/components/button';\n import { BentoTag } from '@/components/tag';\n import { BentoTypography } from '@/components/typography';\n import ChevronDownIcon from '@adyen/ui-assets-icons-16/vue/chevron-down';\n import ChevronUpIcon from '@adyen/ui-assets-icons-16/vue/chevron-up';\n import CrossCircleFillIcon from '@adyen/ui-assets-icons-16/vue/cross-circle-fill';\n import { computed, inject, ref, watch } from 'vue';\n import { useI18n } from '@/utils/ts/i18n';\n import { generateUid } from '@/core/utils/ts';\n import { type BentoSecondaryNavItemsItem } from '../../secondary-nav.types';\n import { useExpandableContentHeight } from '@/composables/use-expandable-content-height/use-expandable-content-height';\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const { tc } = useI18n<{ message: MessageSchema }>({ messages });\n const { activeItemValue, updateActiveItemValue, allowExpandableItemNavigation } = inject(SECONDARY_NAV_STATE);\n const CONTENT_TRANSITION_NAME = 'b-secondary-nav-item__animation--content';\n\n const props = defineProps({\n label: null,\n value: null,\n items: null,\n isSubItem: { type: Boolean },\n errorCounter: null\n});\n\n const isOpen = ref(false);\n const subItemsId = generateUid('secondary-nav-sub-items');\n const subItemsRef = ref<HTMLUListElement>(null);\n const hasSubItems = computed(() => !!props.items?.length);\n const isItemSelected = computed(() => activeItemValue.value === props.value);\n const expandleItemIsToggleOnly = computed(() => hasSubItems.value && !allowExpandableItemNavigation.value);\n const { contentHeight } = useExpandableContentHeight(subItemsRef, isOpen);\n const subItemsMaxHeight = computed(() => (contentHeight.value ? { 'max-height': contentHeight.value } : {}));\n\n const conditionalClasses = computed(() => ({\n 'b-secondary-nav-item__option--active': isItemSelected.value,\n 'b-secondary-nav-item__option--expandable': hasSubItems.value,\n 'b-secondary-nav-item__option--sub-item': props.isSubItem,\n }));\n\n const emit = defineEmits([\"click\"]);\n\n const onClick = (e: MouseEvent) => {\n emit('click', e);\n updateActiveItemValue(props.value);\n };\n\n const onToggleClick = () => {\n isOpen.value = !isOpen.value;\n };\n\n const hasActiveDescendant = (items: Array<BentoSecondaryNavItemsItem>, value: string): boolean => {\n return items.some(\n item => item.value === value || (item.items ? hasActiveDescendant(item.items, value) : false)\n );\n };\n\n const hasDescendantErrors = (items: Array<BentoSecondaryNavItemsItem>): boolean =>\n items.some(item => !!item.errorCounter || (item.items ? hasDescendantErrors(item.items) : false));\n\n watch(\n [activeItemValue, () => props.items],\n ([activeValue]) => {\n if (hasSubItems.value && props.items) {\n if (hasActiveDescendant(props.items, activeValue) || hasDescendantErrors(props.items)) {\n isOpen.value = true;\n }\n }\n },\n { immediate: true, deep: true }\n );\n</script>\n\n<script lang=\"ts\">\n /**\n * This component shouldn't be used directly. It is internally used by {@see BentoSecondaryNav}\n */\n export default { i18n: { messages } };\n</script>\n\n<style lang=\"scss\" scoped src=\"./secondary-nav-item.scss\" />\n","<template>\n <section class=\"b-secondary-nav-category\" :aria-label=\"label\">\n <bento-typography el=\"h1\" class=\"b-secondary-nav-category__label\" variant=\"caption\" stronger>{{\n label\n }}</bento-typography>\n <ul class=\"b-secondary-nav__list\">\n <li v-for=\"item in items\" :key=\"item.value\">\n <secondary-nav-item\n :label=\"item.label\"\n :value=\"item.value\"\n :items=\"item.items\"\n :error-counter=\"item.errorCounter\"\n />\n </li>\n </ul>\n </section>\n</template>\n\n<script lang=\"ts\" setup>\n import { BentoTypography } from '@/components/typography';\n import { SecondaryNavItem } from '../secondary-nav-item';\n import { type BentoSecondaryNavItemsItem } from '../../secondary-nav.types';\n\n defineProps({\n label: null,\n items: null\n});\n</script>\n\n<script lang=\"ts\">\n /**\n * This component shouldn't be used directly. It is internally used by {@see BentoSecondaryNav}\n */\n export default {};\n</script>\n\n<style lang=\"scss\" scoped src=\"./secondary-nav-category.scss\" />\n","<template>\n <nav class=\"b-secondary-nav\">\n <bento-dropdown\n v-if=\"isMobile\"\n :aria-label=\"t('mobileDropdownAriaLabel')\"\n :items=\"mobileDropdownItems\"\n :static-categories=\"hasCategories\"\n :model-value=\"activeItemValue\"\n :is-option-disabled=\"isMobileOptionDisabled\"\n @update:model-value=\"updateActiveItemValue\"\n >\n <template #display-value=\"{ label }\">\n <bento-typography el=\"span\">\n {{ label }}\n </bento-typography>\n </template>\n <template #default=\"{ label, data }\">\n <bento-typography\n el=\"div\"\n :class=\"{ 'b-secondary-nav__option': true, 'b-secondary-nav__nested-option': !!data?.level }\"\n >\n {{ label }}\n <bento-tag v-if=\"data?.errorCounter\" class=\"b-secondary-nav__error-counter\" variant=\"red\">\n <template #icon>\n <cross-circle-fill-icon aria-hidden=\"true\" />\n </template>\n <span>{{ data.errorCounter }}</span>\n <span class=\"b-secondary-nav__visually-hidden\">{{ tc('errorCount', data.errorCounter) }}</span>\n </bento-tag>\n </bento-typography>\n </template>\n </bento-dropdown>\n <ul v-else class=\"b-secondary-nav__list\">\n <li v-for=\"item in items\" :key=\"item.label\">\n <secondary-nav-category\n v-if=\"'items' in item && !('value' in item)\"\n :label=\"item.label\"\n :items=\"item.items\"\n />\n <secondary-nav-item\n v-else\n :label=\"item.label\"\n :value=\"item.value\"\n :items=\"item.items\"\n :error-counter=\"item.errorCounter\"\n />\n </li>\n </ul>\n </nav>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, provide, readonly, ref, toRef, watch } from 'vue';\n import { SecondaryNavItem } from './components/secondary-nav-item';\n import { SecondaryNavCategory } from './components/secondary-nav-category';\n import { SECONDARY_NAV_STATE } from './secondary-nav.keys';\n import {\n type BentoSecondaryNavItems,\n type BentoSecondaryNavItemsCategory,\n type BentoSecondaryNavItemsItem,\n type BentoSecondaryNavState,\n } from './secondary-nav.types';\n import { BentoDropdown } from '@/components/dropdown';\n import { BentoTypography } from '@/components/typography';\n import { BentoTag } from '@/components/tag';\n import CrossCircleFillIcon from '@adyen/ui-assets-icons-16/vue/cross-circle-fill';\n import { useBreakpoints } from '@vueuse/core';\n import { useI18n } from '@/utils/ts/i18n';\n import { type BentoListboxOptionItem, type BentoListboxOptions } from '@/types/listbox';\n import { BMediaQuerySMax } from '@adyen/bento-design-tokens/dist/js/bento/es6';\n\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const { t, tc } = useI18n<{ message: MessageSchema }>({ messages });\n\n const breakpoints = useBreakpoints({\n s: BMediaQuerySMax,\n });\n\n const isMobile = breakpoints.smallerOrEqual('s');\n const props = defineProps({\n items: null,\n value: null,\n allowExpandableItemNavigation: { type: Boolean }\n});\n\n const emit = defineEmits([\"change\"]);\n\n const isCategory = (item: BentoSecondaryNavItems[number]): item is BentoSecondaryNavItemsCategory =>\n 'items' in item && !('value' in item);\n\n const mapNestedItems = (items: Array<BentoSecondaryNavItemsItem>, level = 0): BentoListboxOptions =>\n items.flatMap((item): BentoListboxOptions => {\n const currentItem: BentoListboxOptionItem = {\n label: item.label,\n value: item.value,\n data: { level, hasSubItems: !!item.items?.length, errorCounter: item.errorCounter },\n };\n\n if (item.items?.length) {\n return [currentItem, ...mapNestedItems(item.items, level + 1)];\n }\n\n return [currentItem];\n });\n\n const isMobileOptionDisabled = (option: BentoListboxOptionItem): boolean =>\n !props.allowExpandableItemNavigation && (option.data as { hasSubItems?: boolean })?.hasSubItems;\n\n const hasCategories = computed(() => props.items.some(item => isCategory(item)));\n const mobileDropdownItems = computed<BentoListboxOptions>(() => {\n return props.items.flatMap(item => {\n if (isCategory(item)) {\n return [\n {\n label: item.label,\n value: `category-${item.label}`,\n items: mapNestedItems(item.items),\n } satisfies BentoListboxOptionItem,\n ];\n }\n\n if (item.items?.length) {\n return mapNestedItems([item]);\n }\n\n return [\n {\n label: item.label,\n value: item.value,\n data: { level: 0, errorCounter: item.errorCounter },\n } satisfies BentoListboxOptionItem,\n ];\n });\n });\n\n const flattenNestedItems = (items: Array<BentoSecondaryNavItemsItem>): Array<BentoSecondaryNavItemsItem> =>\n items.flatMap(item => [item, ...(item.items?.length ? flattenNestedItems(item.items) : [])]);\n\n const findFirstSelectableNestedItemValue = (items: Array<BentoSecondaryNavItemsItem>): string =>\n flattenNestedItems(items).find(item => props.allowExpandableItemNavigation || !item.items?.length)?.value ?? '';\n\n const activeItemValueFallback = computed(() => {\n if (!props.items.length) {\n return '';\n }\n\n return findFirstSelectableNestedItemValue(\n props.items.flatMap(item =>\n isCategory(item) ? flattenNestedItems(item.items) : flattenNestedItems([item])\n )\n );\n });\n\n const activeItemValue = ref(props.value ?? activeItemValueFallback.value);\n const updateActiveItemValue = (value: string) => {\n activeItemValue.value = value;\n emit('change', value);\n };\n\n // The component's state is inject on `secondary-nav-item` to determine the\n // current active item and to change its value\n const state: BentoSecondaryNavState = {\n activeItemValue: readonly(activeItemValue),\n updateActiveItemValue,\n allowExpandableItemNavigation: toRef(props, 'allowExpandableItemNavigation'),\n };\n\n watch(\n () => props.value,\n value => {\n if (value !== undefined) {\n activeItemValue.value = value;\n }\n }\n );\n\n provide(SECONDARY_NAV_STATE, state);\n</script>\n\n<script lang=\"ts\">\n /**\n * Secondary Nav offers users a structured way to access information.\n * It also provides a clear hierarchy for users to understand and navigate through various information.\n *\n * @example\n * import { BentoSecondaryNav } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoSecondaryNav },\n * template: `\n * <bento-secondary-nav :value=\"value\" :items=\"items\" />\n * `,\n * setup() {\n * const value = ref(2) // Active item value\n * const items: BentoSecondaryNavItemInfo[] = [\n * { label: 'Option 1', value: 1 },\n * { label: 'Option 2', value: 2 },\n * ];\n * return { items, value };\n * }\n * }\n */\n export default {\n i18n: { messages },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./secondary-nav.scss\" />\n"],"names":["SECONDARY_NAV_STATE","__default__$2","messages$1","tc","useI18n","activeItemValue","updateActiveItemValue","allowExpandableItemNavigation","inject","CONTENT_TRANSITION_NAME","isOpen","ref","subItemsId","generateUid","subItemsRef","hasSubItems","computed","_a","props","isItemSelected","expandleItemIsToggleOnly","contentHeight","useExpandableContentHeight","subItemsMaxHeight","conditionalClasses","onClick","e","emit","onToggleClick","hasActiveDescendant","items","value","item","hasDescendantErrors","watch","activeValue","__default__$1","__default__","messages","t","breakpoints","useBreakpoints","BMediaQuerySMax","isMobile","isCategory","mapNestedItems","level","currentItem","_b","isMobileOptionDisabled","option","hasCategories","mobileDropdownItems","flattenNest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AqC,EAAA,KAAA,GACAjD,IAAA,CAAAyB,MAAA;AACI,MAAA1B,EAAA,QAAA0B,GACAJ,EAAA,UAAAI,CAAA;AAAA,IAAoB,GAKxByB,IAAA;AAAA,MAAsC,iBAAAC,EAAApD,CAAA;AAAA,MACO,uBAAAC;AAAA,MACzC,+BAAAoD,EAAAxC,GAAA,+BAAA;AAAA,IAC2E;AAG/E,WAAAgB;AAAA,MAAA,MAAAhB,EAAA;AAAA,MACgB,CAAAa,MAAA;AAER,QAAAA,MAAA,WACI1B,EAAA,QAAA0B;AAAA,MACJ;AAAA,IACJ,GAGJ4B,EAAA3D,GAAAwD,CAAA;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import { defineComponent as N, ref as p, provide as g, watch as x, nextTick as k, computed as m, unref as $, onUnmounted as A, toRefs as j, inject as B } from "vue";
|
|
2
|
+
import { B as G } from "./typography.C8lPlsbD.js";
|
|
3
|
+
import { B as J } from "./tag.CbNFG45Y.js";
|
|
4
|
+
import { C as U } from "./cross-circle-fill.DTDtgLMf.js";
|
|
5
|
+
import { u as z } from "./index.B6WW_F-J.js";
|
|
6
|
+
import { g as M } from "./generate-uid.NJ8tVoha.js";
|
|
7
|
+
import { T as R, a as O, E as q } from "./tabs.keys.B4qGhjp2.js";
|
|
8
|
+
import { F as H } from "./fixed-scroller.4xAzt_OI.js";
|
|
9
|
+
import { n as S } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
|
|
10
|
+
import "../assets/tab.css";
|
|
11
|
+
const F = (s, e) => {
|
|
12
|
+
const a = s === 0 ? e.length - 1 : s - 1, t = e[a];
|
|
13
|
+
return t.disabled || t.hidden ? F(a, e) : a;
|
|
14
|
+
}, D = (s, e) => {
|
|
15
|
+
const a = s === e.length - 1 ? 0 : s + 1, t = e[a];
|
|
16
|
+
return t.disabled || t.hidden ? D(a, e) : a;
|
|
17
|
+
}, Q = {
|
|
18
|
+
"de-DE": {
|
|
19
|
+
errorCount: "Fehler | Fehler"
|
|
20
|
+
},
|
|
21
|
+
"en-GB": {
|
|
22
|
+
errorCount: "error | errors"
|
|
23
|
+
},
|
|
24
|
+
"en-US": {
|
|
25
|
+
errorCount: "error | errors"
|
|
26
|
+
},
|
|
27
|
+
"es-ES": {
|
|
28
|
+
errorCount: "error | errores"
|
|
29
|
+
},
|
|
30
|
+
"es-MX": {
|
|
31
|
+
errorCount: "error | errores"
|
|
32
|
+
},
|
|
33
|
+
"fr-FR": {
|
|
34
|
+
errorCount: "erreur | erreurs"
|
|
35
|
+
},
|
|
36
|
+
"it-IT": {
|
|
37
|
+
errorCount: "errore | errori"
|
|
38
|
+
},
|
|
39
|
+
"ja-JP": {
|
|
40
|
+
errorCount: "エラー | エラー"
|
|
41
|
+
},
|
|
42
|
+
"pt-BR": {
|
|
43
|
+
errorCount: "erro | erros"
|
|
44
|
+
},
|
|
45
|
+
"zh-CN": {
|
|
46
|
+
errorCount: "错误 | 错误"
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var w = /* @__PURE__ */ ((s) => (s.ACTIVE_TAB_INDEX = "update:active-tab-index", s))(w || {});
|
|
50
|
+
const V = N({
|
|
51
|
+
i18n: { messages: Q },
|
|
52
|
+
components: {
|
|
53
|
+
BentoTag: J,
|
|
54
|
+
BentoTypography: G,
|
|
55
|
+
CrossCircleFillIcon: U,
|
|
56
|
+
FixedScroller: H
|
|
57
|
+
},
|
|
58
|
+
props: {
|
|
59
|
+
/**
|
|
60
|
+
* Sets the active tab by its index (0 being the first tab item).
|
|
61
|
+
*/
|
|
62
|
+
activeTabIndex: { type: Number, default: 0 },
|
|
63
|
+
/*
|
|
64
|
+
* Renders the tab with a sticky positioning.
|
|
65
|
+
*/
|
|
66
|
+
sticky: { type: Boolean, default: !1 },
|
|
67
|
+
/**
|
|
68
|
+
* Additional configurable options for tabs rendered with a sticky positioning.
|
|
69
|
+
* It must be an object of type {@see BentoStickyTabsOption}
|
|
70
|
+
* @property {Ref<number>} stickyOptions.top - Top position the tabs should take up when rendered as sticky.
|
|
71
|
+
*/
|
|
72
|
+
stickyOptions: { type: Object, default: null }
|
|
73
|
+
},
|
|
74
|
+
emits: [w.ACTIVE_TAB_INDEX],
|
|
75
|
+
setup(s, { emit: e }) {
|
|
76
|
+
const { tc: a } = z(), t = p([]), u = p(null), b = p(), l = p(""), n = p(!1);
|
|
77
|
+
let c;
|
|
78
|
+
g(R, l);
|
|
79
|
+
const _ = (r) => () => {
|
|
80
|
+
var o;
|
|
81
|
+
t.value = (o = t.value) == null ? void 0 : o.filter(({ id: i }) => i !== r);
|
|
82
|
+
};
|
|
83
|
+
g(O, ({
|
|
84
|
+
title: r,
|
|
85
|
+
disabled: o,
|
|
86
|
+
errorCounter: i,
|
|
87
|
+
withNotificationIndicator: f,
|
|
88
|
+
counter: h,
|
|
89
|
+
hidden: W,
|
|
90
|
+
setElementRef: Y
|
|
91
|
+
}) => {
|
|
92
|
+
const I = M("b-tab");
|
|
93
|
+
return t.value.push({
|
|
94
|
+
counter: h,
|
|
95
|
+
disabled: o,
|
|
96
|
+
errorCounter: i,
|
|
97
|
+
hidden: W,
|
|
98
|
+
id: I,
|
|
99
|
+
title: r,
|
|
100
|
+
withNotificationIndicator: f,
|
|
101
|
+
setElementRef: Y
|
|
102
|
+
}), { id: I, unregisterTab: _(I) };
|
|
103
|
+
});
|
|
104
|
+
const d = (r) => {
|
|
105
|
+
if (r.code === "ArrowLeft" || r.code === "ArrowRight") {
|
|
106
|
+
const o = t.value.find((f) => document.activeElement.id === f.id);
|
|
107
|
+
let i = t.value.indexOf(o);
|
|
108
|
+
r.code === "ArrowLeft" ? i = F(i, t.value) : r.code === "ArrowRight" && (i = D(i, t.value)), u.value.children[i].focus();
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
x(
|
|
112
|
+
[() => s.activeTabIndex, t],
|
|
113
|
+
([r, o]) => {
|
|
114
|
+
k(() => {
|
|
115
|
+
var f;
|
|
116
|
+
const i = o[r];
|
|
117
|
+
l.value = i && !i.disabled ? i.id : (f = t.value.find(({ disabled: h }) => !h)) == null ? void 0 : f.id;
|
|
118
|
+
});
|
|
119
|
+
},
|
|
120
|
+
{ immediate: !0 }
|
|
121
|
+
);
|
|
122
|
+
const C = (r) => {
|
|
123
|
+
l.value = r;
|
|
124
|
+
const o = t.value.findIndex(({ id: i }) => i === l.value);
|
|
125
|
+
e(w.ACTIVE_TAB_INDEX, o);
|
|
126
|
+
}, y = (r) => r ? "disabled" : !1, T = m(() => {
|
|
127
|
+
var r;
|
|
128
|
+
return (r = s.stickyOptions) != null && r.top ? $(s.stickyOptions.top) : 0;
|
|
129
|
+
}), P = m(() => s.sticky && T.value > 0 ? !0 : n.value), E = () => {
|
|
130
|
+
c && (c.disconnect(), c = null), n.value = !1;
|
|
131
|
+
}, K = (r) => {
|
|
132
|
+
s.sticky && T.value === 0 && (c = new IntersectionObserver(
|
|
133
|
+
([o]) => {
|
|
134
|
+
n.value = o.intersectionRatio < 1;
|
|
135
|
+
},
|
|
136
|
+
{ threshold: [1] }
|
|
137
|
+
), c.observe(r));
|
|
138
|
+
};
|
|
139
|
+
x(
|
|
140
|
+
[() => s.sticky, b, T],
|
|
141
|
+
([r, o]) => {
|
|
142
|
+
E(), r && o && k(() => K(o));
|
|
143
|
+
},
|
|
144
|
+
{ immediate: !0 }
|
|
145
|
+
), A(() => {
|
|
146
|
+
E();
|
|
147
|
+
});
|
|
148
|
+
const X = m(() => ({
|
|
149
|
+
"b-tabs__tab-list-wrapper--sticky": s.sticky,
|
|
150
|
+
"b-tabs__tab-list-wrapper--pinned": P.value
|
|
151
|
+
})), L = m(
|
|
152
|
+
() => {
|
|
153
|
+
var r;
|
|
154
|
+
return (
|
|
155
|
+
// This helps us detect when the tabs are pinned without calculations on the tabs positions because it makes the tabs intersect by 1 pixel with the element on top of it, which is getting aught by the intersection observer.
|
|
156
|
+
// Followed this example: https://css-tricks.com/how-to-detect-when-a-sticky-element-gets-pinned/
|
|
157
|
+
s.sticky ? {
|
|
158
|
+
top: `${(((r = s.stickyOptions) == null ? void 0 : r.top) ?? 0) - 1}px`
|
|
159
|
+
} : {}
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
);
|
|
163
|
+
return {
|
|
164
|
+
tc: a,
|
|
165
|
+
tabs: t,
|
|
166
|
+
tablist: u,
|
|
167
|
+
tablistwrapper: b,
|
|
168
|
+
activeTabId: l,
|
|
169
|
+
tablistWrapperConditionalClasses: X,
|
|
170
|
+
tablistWrapperStyles: L,
|
|
171
|
+
onKeydownTabsNavigation: d,
|
|
172
|
+
handleTabChange: C,
|
|
173
|
+
isDisabled: y
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
var Z = function() {
|
|
178
|
+
var e = this, a = e._self._c;
|
|
179
|
+
return e._self._setupProxy, a("div", { staticClass: "b-tabs" }, [a("div", { ref: "tablistwrapper", staticClass: "b-tabs__tab-list-wrapper", class: e.tablistWrapperConditionalClasses, style: e.tablistWrapperStyles }, [a("fixed-scroller", { attrs: { condensed: "", "extra-padding-top": 2 } }, [a("div", { ref: "tablist", staticClass: "b-tabs__tab-list", attrs: { role: "tablist" }, on: { keydown: e.onKeydownTabsNavigation } }, e._l(e.tabs, function({
|
|
180
|
+
counter: t,
|
|
181
|
+
disabled: u,
|
|
182
|
+
errorCounter: b,
|
|
183
|
+
hidden: l,
|
|
184
|
+
id: n,
|
|
185
|
+
title: c,
|
|
186
|
+
withNotificationIndicator: _,
|
|
187
|
+
setElementRef: v
|
|
188
|
+
}) {
|
|
189
|
+
return a("button", { directives: [{ name: "show", rawName: "v-show", value: !l, expression: "!hidden" }], key: n, ref: v, refInFor: !0, staticClass: "b-tabs__tab", class: {
|
|
190
|
+
"b-tabs__tab--active": e.activeTabId === n,
|
|
191
|
+
"b-tabs__tab--disabled": u
|
|
192
|
+
}, attrs: { id: n, role: "tab", type: "button", "aria-controls": `${n}-tabpanel`, "aria-hidden": l ? "true" : "false", "aria-selected": e.activeTabId === n ? "true" : "false", tabindex: e.activeTabId === n && !u.value ? null : -1, disabled: e.isDisabled(u) }, on: { click: function(d) {
|
|
193
|
+
return e.handleTabChange(n);
|
|
194
|
+
}, keydown: function(d) {
|
|
195
|
+
return !d.type.indexOf("key") && e._k(d.keyCode, "enter", 13, d.key, "Enter") && e._k(d.keyCode, "space", 32, d.key, [" ", "Spacebar"]) ? null : e.handleTabChange(n);
|
|
196
|
+
} } }, [a("span", { staticClass: "b-tabs__tab-text" }, [a("bento-typography", { staticClass: "b-tabs__tab-title", attrs: { el: "span", variant: "body", stronger: "" } }, [e._v(" " + e._s(c) + " ")]), t != null ? a("bento-typography", { staticClass: "b-tabs__tab-counter", class: {
|
|
197
|
+
"b-tabs__tab-counter--active": e.activeTabId === n
|
|
198
|
+
}, attrs: { el: "span", variant: "body", stronger: "" } }, [e._v(" " + e._s(t) + " ")]) : e._e(), b != null ? a("bento-tag", { staticClass: "b-tabs__tab-error-counter", attrs: { variant: "red" }, scopedSlots: e._u([{ key: "icon", fn: function() {
|
|
199
|
+
return [a("cross-circle-fill-icon", { attrs: { "aria-hidden": "true" } })];
|
|
200
|
+
}, proxy: !0 }], null, !0) }, [a("span", [e._v(e._s(b))]), a("span", { staticClass: "b-tabs__visually-hidden" }, [e._v(e._s(e.tc("errorCount", b)))])]) : e._e(), _ ? a("span", { staticClass: "b-tabs__tab-notification-dot", attrs: { "aria-hidden": "true" } }) : e._e()], 1), a("span", { directives: [{ name: "show", rawName: "v-show", value: e.activeTabId === n, expression: "activeTabId === id" }], staticClass: "b-tabs__tab-underline", attrs: { "aria-hidden": "true" } })]);
|
|
201
|
+
}), 0)])], 1), e._t("default")], 2);
|
|
202
|
+
}, ee = [], te = /* @__PURE__ */ S(
|
|
203
|
+
V,
|
|
204
|
+
Z,
|
|
205
|
+
ee,
|
|
206
|
+
!1,
|
|
207
|
+
null,
|
|
208
|
+
"c941b744"
|
|
209
|
+
);
|
|
210
|
+
const ve = te.exports, ae = {
|
|
211
|
+
name: "bento-tab"
|
|
212
|
+
}, re = /* @__PURE__ */ N({
|
|
213
|
+
...ae,
|
|
214
|
+
props: {
|
|
215
|
+
counter: { default: null },
|
|
216
|
+
disabled: { type: Boolean, default: !1 },
|
|
217
|
+
errorCounter: { default: null },
|
|
218
|
+
hidden: { type: Boolean, default: !1 },
|
|
219
|
+
title: null,
|
|
220
|
+
withNotificationIndicator: { type: Boolean, default: !1 },
|
|
221
|
+
setElementRef: { type: Function, default: void 0 }
|
|
222
|
+
},
|
|
223
|
+
setup(s) {
|
|
224
|
+
const e = s, { counter: a, disabled: t, errorCounter: u, hidden: b, withNotificationIndicator: l } = j(e), n = p(), c = (T) => {
|
|
225
|
+
n.value = T;
|
|
226
|
+
};
|
|
227
|
+
g(q, c);
|
|
228
|
+
const _ = m(() => n.value ?? e.title), v = B(O), d = B(R), { id: C, unregisterTab: y } = v({
|
|
229
|
+
counter: a,
|
|
230
|
+
disabled: t,
|
|
231
|
+
errorCounter: u,
|
|
232
|
+
hidden: b,
|
|
233
|
+
title: _,
|
|
234
|
+
withNotificationIndicator: l,
|
|
235
|
+
setElementRef: e.setElementRef
|
|
236
|
+
});
|
|
237
|
+
return A(() => y()), { __sfc: !0, props: e, counter: a, disabled: t, errorCounter: u, hidden: b, withNotificationIndicator: l, componentTitle: n, setTitle: c, computedTitle: _, registerTab: v, activeTabId: d, id: C, unregisterTab: y };
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
var se = function() {
|
|
241
|
+
var e = this, a = e._self._c, t = e._self._setupProxy;
|
|
242
|
+
return a("div", { directives: [{ name: "show", rawName: "v-show", value: t.activeTabId === t.id, expression: "activeTabId === id" }], staticClass: "b-tab", attrs: { id: `${t.id}-tabpanel`, role: "tabpanel", "aria-labelledby": t.id } }, [t.activeTabId === t.id ? [e._t("default")] : e._e()], 2);
|
|
243
|
+
}, ne = [], oe = /* @__PURE__ */ S(
|
|
244
|
+
re,
|
|
245
|
+
se,
|
|
246
|
+
ne,
|
|
247
|
+
!1,
|
|
248
|
+
null,
|
|
249
|
+
"95343e8e"
|
|
250
|
+
);
|
|
251
|
+
const Te = oe.exports;
|
|
252
|
+
export {
|
|
253
|
+
Te as B,
|
|
254
|
+
ve as a
|
|
255
|
+
};
|
|
256
|
+
//# sourceMappingURL=tab.QEKU5Udp.js.map
|