@adyen/bento-vue3 1.76.2 → 1.77.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 +216 -33
- 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/date-range-picker.css +1 -1
- package/dist/assets/dialog-page.css +1 -1
- package/dist/assets/dropdown-default-textbox.css +1 -1
- package/dist/assets/dropdown-tag.css +1 -1
- package/dist/assets/dropdown.css +1 -1
- package/dist/assets/file-uploader.css +1 -1
- package/dist/assets/filter-bar.css +1 -1
- package/dist/assets/input-field-phone-number.css +1 -1
- package/dist/assets/input-field.css +1 -1
- package/dist/assets/inspector.css +1 -1
- package/dist/assets/modal-fullscreen.css +1 -1
- package/dist/assets/pagination.css +1 -1
- package/dist/assets/payment-method.css +1 -1
- package/dist/assets/secondary-nav.css +1 -1
- package/dist/assets/sidepanel.css +1 -1
- package/dist/assets/tag.css +1 -1
- package/dist/assets/textarea.css +1 -1
- package/dist/assets/timeline-item.css +1 -1
- package/dist/checkbox.js +2 -2
- package/dist/chunks/{checkbox-group.8ebmaHsA.js → checkbox-group.COUx8Ne8.js} +2 -2
- package/dist/chunks/{checkbox-group.8ebmaHsA.js.map → checkbox-group.COUx8Ne8.js.map} +1 -1
- package/dist/chunks/{checkbox.BI0dqARY.js → checkbox.SffuKyNj.js} +3 -3
- package/dist/chunks/{checkbox.BI0dqARY.js.map → checkbox.SffuKyNj.js.map} +1 -1
- package/dist/chunks/{code-snippet.Bjf1ma1L.js → code-snippet.ByoBEM00.js} +2 -2
- package/dist/chunks/{code-snippet.Bjf1ma1L.js.map → code-snippet.ByoBEM00.js.map} +1 -1
- package/dist/chunks/{currency.CBZMwm21.js → currency.WmvQjX7l.js} +2 -2
- package/dist/chunks/{currency.CBZMwm21.js.map → currency.WmvQjX7l.js.map} +1 -1
- package/dist/chunks/{data-grid.VBEJO94f.js → data-grid.CMIG82Xt.js} +7 -7
- package/dist/chunks/{data-grid.VBEJO94f.js.map → data-grid.CMIG82Xt.js.map} +1 -1
- package/dist/chunks/date-picker.CsGq3iSK.js +244 -0
- package/dist/chunks/date-picker.CsGq3iSK.js.map +1 -0
- package/dist/chunks/date-picker.types.Ckt7zxGy.js +5 -0
- package/dist/chunks/date-picker.types.Ckt7zxGy.js.map +1 -0
- package/dist/chunks/date-range-picker.C19CWG27.js +1149 -0
- package/dist/chunks/date-range-picker.C19CWG27.js.map +1 -0
- package/dist/chunks/{dropdown-default-textbox.MkU0tMf1.js → dropdown-default-textbox._KEBXjKT.js} +88 -86
- package/dist/chunks/dropdown-default-textbox._KEBXjKT.js.map +1 -0
- package/dist/chunks/dropdown-tag.B90dpg8J.js +301 -0
- package/dist/chunks/dropdown-tag.B90dpg8J.js.map +1 -0
- package/dist/chunks/dropdown.DYDHM__3.js +833 -0
- package/dist/chunks/{dropdown.KStrJVoP.js.map → dropdown.DYDHM__3.js.map} +1 -1
- package/dist/chunks/es6.MoTTyETW.js.map +1 -1
- package/dist/chunks/{file-uploader.By0MTfKk.js → file-uploader.BDXQ7Ccv.js} +416 -415
- package/dist/chunks/{file-uploader.By0MTfKk.js.map → file-uploader.BDXQ7Ccv.js.map} +1 -1
- package/dist/chunks/{filter-bar.JXmlFnHV.js → filter-bar.CmF92iAr.js} +303 -303
- package/dist/chunks/filter-bar.CmF92iAr.js.map +1 -0
- package/dist/chunks/form-field.BBqLu-vs.js +10 -0
- package/dist/chunks/form-field.BBqLu-vs.js.map +1 -0
- package/dist/chunks/get-slot-text.CQRAP2_q.js +12 -0
- package/dist/chunks/get-slot-text.CQRAP2_q.js.map +1 -0
- package/dist/chunks/{header-with-views.Dg2usaMY.js → header-with-views.xPfeOz0Y.js} +3 -3
- package/dist/chunks/{header-with-views.Dg2usaMY.js.map → header-with-views.xPfeOz0Y.js.map} +1 -1
- package/dist/chunks/{input-field-password.B6nJ7ygZ.js → input-field-password.BZBYVyAb.js} +3 -3
- package/dist/chunks/{input-field-password.B6nJ7ygZ.js.map → input-field-password.BZBYVyAb.js.map} +1 -1
- package/dist/chunks/{input-field-phone-number.D_UBAN2s.js → input-field-phone-number.a8Mw5PAW.js} +5 -5
- package/dist/chunks/{input-field-phone-number.D_UBAN2s.js.map → input-field-phone-number.a8Mw5PAW.js.map} +1 -1
- package/dist/chunks/{input-field.C29FCI4j.js → input-field.CYGGIK48.js} +48 -48
- package/dist/chunks/input-field.CYGGIK48.js.map +1 -0
- package/dist/chunks/{listbox-option-tag.uHSB7MO6.js → listbox-option-tag.Cwe9Bn-R.js} +2 -2
- package/dist/chunks/{listbox-option-tag.uHSB7MO6.js.map → listbox-option-tag.Cwe9Bn-R.js.map} +1 -1
- package/dist/chunks/{pagination.BaBWNlIF.js → pagination.CYdGcyMA.js} +49 -49
- package/dist/chunks/pagination.CYdGcyMA.js.map +1 -0
- package/dist/chunks/{payment-method.CDnn1bjo.js → payment-method.D6PeTYWq.js} +45 -42
- package/dist/chunks/payment-method.D6PeTYWq.js.map +1 -0
- package/dist/chunks/payment-method.types.BqtH7RM2.js.map +1 -1
- package/dist/chunks/{radio-group.DWNqrkZ3.js → radio-group.B_8R6vGx.js} +3 -3
- package/dist/chunks/{radio-group.DWNqrkZ3.js.map → radio-group.B_8R6vGx.js.map} +1 -1
- package/dist/chunks/{rich-text-editor.Bh7KS617.js → rich-text-editor.B6Ftqv55.js} +2 -2
- package/dist/chunks/{rich-text-editor.Bh7KS617.js.map → rich-text-editor.B6Ftqv55.js.map} +1 -1
- package/dist/chunks/{search-bar.RS02IcLc.js → search-bar.D3Ri_RUK.js} +3 -3
- package/dist/chunks/{search-bar.RS02IcLc.js.map → search-bar.D3Ri_RUK.js.map} +1 -1
- package/dist/chunks/{secondary-nav.DXsgUTqk.js → secondary-nav.CAb20jWW.js} +24 -24
- package/dist/chunks/secondary-nav.CAb20jWW.js.map +1 -0
- package/dist/chunks/{summary-grid.types.ByQ4u19J.js → summary-grid.types.cE1fyLvC.js} +2 -2
- package/dist/chunks/{summary-grid.types.ByQ4u19J.js.map → summary-grid.types.cE1fyLvC.js.map} +1 -1
- package/dist/chunks/tag.CjaB9DxL.js +57 -0
- package/dist/chunks/tag.CjaB9DxL.js.map +1 -0
- package/dist/chunks/textarea.C_gnXj6b.js +254 -0
- package/dist/chunks/textarea.C_gnXj6b.js.map +1 -0
- package/dist/chunks/{timeline-item.DNjubXL2.js → timeline-item.rSY0Xce3.js} +48 -48
- package/dist/chunks/timeline-item.rSY0Xce3.js.map +1 -0
- package/dist/chunks/{toggle.Dd_NA8eH.js → toggle.BHCUjMpp.js} +2 -2
- package/dist/chunks/{toggle.Dd_NA8eH.js.map → toggle.BHCUjMpp.js.map} +1 -1
- package/dist/code-snippet.js +1 -1
- package/dist/currency.js +1 -1
- package/dist/data-grid.js +1 -1
- package/dist/date-picker.js +7 -6
- package/dist/date-picker.js.map +1 -1
- package/dist/date-range-picker.js +1 -1
- package/dist/dropdown.js +3 -3
- package/dist/file-uploader.js +1 -1
- package/dist/filter-bar.js +1 -1
- package/dist/header-with-views.js +1 -1
- package/dist/index.js +246 -245
- package/dist/index.js.map +1 -1
- package/dist/input-field-password.js +1 -1
- package/dist/input-field-phone-number.js +1 -1
- package/dist/input-field.js +1 -1
- package/dist/internal.js +1 -1
- package/dist/pagination.js +1 -1
- package/dist/payment-method.js +1 -1
- package/dist/radio-group.js +1 -1
- package/dist/rich-text-editor.js +1 -1
- package/dist/search-bar.js +2 -2
- package/dist/secondary-nav.js +1 -1
- package/dist/styles/bento-dark.css +4 -0
- package/dist/styles/bento-light.css +4 -0
- package/dist/styles/bento.css +4 -0
- package/dist/styles/legacy.css +4 -0
- package/dist/styles/styleguide.css +4 -0
- package/dist/summary-grid.js +1 -1
- package/dist/tag.js +1 -1
- package/dist/textarea.js +1 -1
- package/dist/timeline.js +1 -1
- package/dist/toggle.js +1 -1
- package/dist/web-types.json +1 -1
- package/package.json +5 -5
- package/dist/chunks/date-picker.OI-sQ232.js +0 -234
- package/dist/chunks/date-picker.OI-sQ232.js.map +0 -1
- package/dist/chunks/date-range-picker.D7IwIR5V.js +0 -1114
- package/dist/chunks/date-range-picker.D7IwIR5V.js.map +0 -1
- package/dist/chunks/dropdown-default-textbox.MkU0tMf1.js.map +0 -1
- package/dist/chunks/dropdown-tag.DFeoXIgH.js +0 -242
- package/dist/chunks/dropdown-tag.DFeoXIgH.js.map +0 -1
- package/dist/chunks/dropdown.KStrJVoP.js +0 -825
- package/dist/chunks/filter-bar.JXmlFnHV.js.map +0 -1
- package/dist/chunks/get-slot-text.DQlZEsId.js +0 -12
- package/dist/chunks/get-slot-text.DQlZEsId.js.map +0 -1
- package/dist/chunks/input-field.C29FCI4j.js.map +0 -1
- package/dist/chunks/pagination.BaBWNlIF.js.map +0 -1
- package/dist/chunks/payment-method.CDnn1bjo.js.map +0 -1
- package/dist/chunks/secondary-nav.DXsgUTqk.js.map +0 -1
- package/dist/chunks/tag.CEmpyuYX.js +0 -50
- package/dist/chunks/tag.CEmpyuYX.js.map +0 -1
- package/dist/chunks/textarea.C1jkfowf.js +0 -246
- package/dist/chunks/textarea.C1jkfowf.js.map +0 -1
- package/dist/chunks/timeline-item.DNjubXL2.js.map +0 -1
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { defineComponent as Le, useAttrs as Ee, toRefs as $, ref as u, toRef as xe, computed as s, watch as U, nextTick as Ce, onMounted as Re, onUnmounted as Ae, createElementBlock as z, openBlock as c, normalizeClass as E, createElementVNode as M, normalizeStyle as q, createVNode as S, createBlock as h, createCommentVNode as d, unref as l, withCtx as x, createTextVNode as Y, toDisplayString as G, withKeys as w } from "vue";
|
|
2
|
+
import { B as Be } from "./button.DhcxX2GJ.js";
|
|
3
|
+
import { d as De, B as F } from "./typography.yBEME_Gu.js";
|
|
4
|
+
import { C as ke } from "./cross-circle-fill-small.Dv5-PxwF.js";
|
|
5
|
+
import { g as Ie } from "./generate-uid.NJ8tVoha.js";
|
|
6
|
+
import { o as X } from "./resize.Bqks3WUm.js";
|
|
7
|
+
import { u as Ue } from "./aria-label.CaUURpnB.js";
|
|
8
|
+
import { u as Me } from "./index.pdBj0KQU.js";
|
|
9
|
+
import { u as Se } from "./form-field.BBqLu-vs.js";
|
|
10
|
+
import { u as we } from "./use-form-layout-loading.D3lALhtC.js";
|
|
11
|
+
import { B as Fe } from "./es6.MoTTyETW.js";
|
|
12
|
+
import { F as Oe, E as j } from "./field-label.C97CrBI_.js";
|
|
13
|
+
import { _ as Pe } from "./_plugin-vue_export-helper.CHgC5LLL.js";
|
|
14
|
+
import "../assets/textarea.css";
|
|
15
|
+
var p = /* @__PURE__ */ ((t) => (t.CLEARABLE = "clearable", t.DISABLED = "disabled", t.ERROR = "error", t.READONLY = "readonly", t))(p || {}), n = /* @__PURE__ */ ((t) => (t.BLUR = "blur", t.CHANGE = "change", t.CLEAR = "clear", t.ESCAPE_PRESSED = "escape-pressed", t.FOCUS = "focus", t.INPUT = "input", t.UPDATE_MODEL_VALUE = "update:model-value", t.KEYDOWN = "keydown", t.KEYUP = "keyup", t))(n || {});
|
|
16
|
+
const J = {
|
|
17
|
+
"en-US": {
|
|
18
|
+
clearText: "Clear text",
|
|
19
|
+
textarea: "textarea",
|
|
20
|
+
yourTextCanBenAtMost: "Your text can be at most {characterLimit} characters"
|
|
21
|
+
}
|
|
22
|
+
}, Te = ["id", "value", "aria-label", "aria-invalid", "readonly", "required", "disabled", "placeholder"], He = {
|
|
23
|
+
key: 0,
|
|
24
|
+
class: "b-textarea__clear-button"
|
|
25
|
+
}, Ke = parseFloat(Fe), Ne = {
|
|
26
|
+
i18n: { messages: J },
|
|
27
|
+
name: "bento-textarea",
|
|
28
|
+
model: { prop: "modelValue" }
|
|
29
|
+
}, Ve = /* @__PURE__ */ Le({
|
|
30
|
+
...Ne,
|
|
31
|
+
props: {
|
|
32
|
+
ariaLabel: { default: void 0 },
|
|
33
|
+
characterLimit: { default: void 0 },
|
|
34
|
+
clearable: { type: Boolean, default: !1 },
|
|
35
|
+
height: { default: null },
|
|
36
|
+
resizable: { default: "both" },
|
|
37
|
+
value: { default: "" },
|
|
38
|
+
modelValue: { default: "" },
|
|
39
|
+
description: { default: "" },
|
|
40
|
+
disabled: { type: Boolean, default: !1 },
|
|
41
|
+
errorMessage: { default: "" },
|
|
42
|
+
label: { default: "" },
|
|
43
|
+
optional: { type: Boolean, default: !1 },
|
|
44
|
+
placeholder: { default: "" },
|
|
45
|
+
readonly: { type: Boolean, default: !1 },
|
|
46
|
+
required: { type: Boolean, default: !1 },
|
|
47
|
+
tooltipText: { default: null }
|
|
48
|
+
},
|
|
49
|
+
setup(t, { expose: Q, emit: Z }) {
|
|
50
|
+
const ee = Ee(), a = t, i = Z, { height: C } = $(a), O = Ie("textarea"), o = u(null), m = u(null), r = u(a.modelValue || a.value), f = 44, v = u(a.height || `${f}px`), P = u(0), R = u("100%"), A = u(!1);
|
|
51
|
+
let y = null, g = null;
|
|
52
|
+
const { t: T, n: H } = Me({ messages: J }), { isReadOnly: _ } = we(xe(a, "readonly")), { emitValue: K } = Se(i), ae = s(() => {
|
|
53
|
+
var e;
|
|
54
|
+
return `${H(((e = r == null ? void 0 : r.value) == null ? void 0 : e.length) ?? 0)} / ${H(a.characterLimit)}`;
|
|
55
|
+
}), L = s(() => !C.value), B = s(
|
|
56
|
+
() => a.characterLimit && r.value.length > a.characterLimit
|
|
57
|
+
), D = () => {
|
|
58
|
+
if (o.value) {
|
|
59
|
+
const e = Math.max(
|
|
60
|
+
o.value.scrollHeight <= f ? f : o.value.scrollHeight + Ke * 2,
|
|
61
|
+
P.value,
|
|
62
|
+
f
|
|
63
|
+
);
|
|
64
|
+
v.value = `${e}px`;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
U(C, () => {
|
|
68
|
+
L.value ? D() : v.value = C.value;
|
|
69
|
+
}), U(
|
|
70
|
+
() => [a.value, a.modelValue],
|
|
71
|
+
() => {
|
|
72
|
+
r.value = a.modelValue || a.value;
|
|
73
|
+
},
|
|
74
|
+
{ immediate: !0 }
|
|
75
|
+
), U(
|
|
76
|
+
() => r.value,
|
|
77
|
+
async () => {
|
|
78
|
+
if (L.value) {
|
|
79
|
+
if (v.value = `${f}px`, !r.value)
|
|
80
|
+
return;
|
|
81
|
+
await Ce(), D();
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
{ immediate: !0 }
|
|
85
|
+
);
|
|
86
|
+
const N = s(() => !!a.errorMessage || B.value), te = s(() => ({
|
|
87
|
+
[`b-textarea--${p.DISABLED}`]: a.disabled
|
|
88
|
+
})), le = s(() => ({
|
|
89
|
+
[`b-textarea__input--${p.CLEARABLE}`]: a.clearable,
|
|
90
|
+
[`b-textarea__input--${p.READONLY}`]: _.value,
|
|
91
|
+
[`b-textarea__input--${p.ERROR}`]: N.value,
|
|
92
|
+
"b-textarea__input--dynamic-height": L.value
|
|
93
|
+
})), oe = s(() => ({
|
|
94
|
+
"b-textarea__label-box--no-label": !a.label
|
|
95
|
+
})), re = s(() => ({
|
|
96
|
+
[`b-textarea__label-item--${p.ERROR}`]: B.value
|
|
97
|
+
})), se = s(() => T("yourTextCanBenAtMost", { characterLimit: a.characterLimit })), ie = u(ee["aria-label"]), { ariaLabel: ue, label: k } = $(a), ne = Ue({
|
|
98
|
+
ariaLabel: ie.value,
|
|
99
|
+
// TODO: take this line away when the aria-label props is removed
|
|
100
|
+
label: ue,
|
|
101
|
+
defaultFallback: k
|
|
102
|
+
}), ce = s(
|
|
103
|
+
() => a.clearable && r.value && !a.disabled && !_.value
|
|
104
|
+
), I = () => {
|
|
105
|
+
r.value = "", i(n.CLEAR), K("");
|
|
106
|
+
}, de = (e) => {
|
|
107
|
+
e.stopImmediatePropagation(), !a.disabled && !_.value && (r.value = e.target.value, K(r.value));
|
|
108
|
+
}, pe = () => {
|
|
109
|
+
o.value.scrollTop = 0, i(n.BLUR);
|
|
110
|
+
}, me = () => {
|
|
111
|
+
o.value.focus(), i(n.FOCUS);
|
|
112
|
+
}, fe = () => {
|
|
113
|
+
i(n.CHANGE);
|
|
114
|
+
}, ve = () => {
|
|
115
|
+
i(n.ESCAPE_PRESSED);
|
|
116
|
+
}, be = (e) => {
|
|
117
|
+
e.stopPropagation(), i(n.KEYDOWN, e);
|
|
118
|
+
}, he = (e) => {
|
|
119
|
+
e.stopPropagation(), i(n.KEYUP, e);
|
|
120
|
+
}, ye = () => {
|
|
121
|
+
A.value = !0;
|
|
122
|
+
}, ge = () => {
|
|
123
|
+
A.value = !1;
|
|
124
|
+
}, V = (e = !1) => {
|
|
125
|
+
var W;
|
|
126
|
+
const b = o.value.style.width;
|
|
127
|
+
if (o.value.style.height && (A.value && (P.value = parseInt(o.value.style.height, 10)), v.value = o.value.style.height), e && !b)
|
|
128
|
+
return;
|
|
129
|
+
const _e = (W = m == null ? void 0 : m.value) == null ? void 0 : W.offsetWidth;
|
|
130
|
+
!b || parseInt(b, 10) > _e ? R.value = "100%" : R.value = b;
|
|
131
|
+
};
|
|
132
|
+
return Q({
|
|
133
|
+
focus: () => {
|
|
134
|
+
o.value.focus();
|
|
135
|
+
}
|
|
136
|
+
}), Re(() => {
|
|
137
|
+
y = X(o.value, () => {
|
|
138
|
+
V(!0);
|
|
139
|
+
}), g = X(m.value, () => {
|
|
140
|
+
V();
|
|
141
|
+
}), L.value && D(), a.value && De(
|
|
142
|
+
'BentoTextarea "value" property',
|
|
143
|
+
`The use of "value" prop in "BentoTextarea" is no longer supported.
|
|
144
|
+
Use the "v-model" or "model-value" property instead.`,
|
|
145
|
+
"2.0.0"
|
|
146
|
+
);
|
|
147
|
+
}), Ae(() => {
|
|
148
|
+
y == null || y.disconnect(), g == null || g.disconnect();
|
|
149
|
+
}), (e, b) => (c(), z("div", {
|
|
150
|
+
ref_key: "textareaComponent",
|
|
151
|
+
ref: m,
|
|
152
|
+
class: E(["b-textarea", te.value])
|
|
153
|
+
}, [
|
|
154
|
+
M("div", {
|
|
155
|
+
style: q({ width: R.value })
|
|
156
|
+
}, [
|
|
157
|
+
M("div", {
|
|
158
|
+
class: E(["b-textarea__label-box", oe.value])
|
|
159
|
+
}, [
|
|
160
|
+
l(k) ? (c(), h(l(Oe), {
|
|
161
|
+
key: 0,
|
|
162
|
+
for: l(O),
|
|
163
|
+
label: l(k),
|
|
164
|
+
"tooltip-text": e.tooltipText,
|
|
165
|
+
optional: e.optional,
|
|
166
|
+
required: e.required
|
|
167
|
+
}, null, 8, ["for", "label", "tooltip-text", "optional", "required"])) : d("", !0),
|
|
168
|
+
e.characterLimit ? (c(), h(l(F), {
|
|
169
|
+
key: 1,
|
|
170
|
+
el: "span",
|
|
171
|
+
class: E(["b-textarea__label-item", re.value])
|
|
172
|
+
}, {
|
|
173
|
+
default: x(() => [
|
|
174
|
+
Y(G(ae.value), 1)
|
|
175
|
+
]),
|
|
176
|
+
_: 1
|
|
177
|
+
}, 8, ["class"])) : d("", !0)
|
|
178
|
+
], 2),
|
|
179
|
+
S(l(F), {
|
|
180
|
+
el: "div",
|
|
181
|
+
class: "b-textarea__input-box",
|
|
182
|
+
"aria-disabled": e.disabled
|
|
183
|
+
}, {
|
|
184
|
+
default: x(() => [
|
|
185
|
+
M("textarea", {
|
|
186
|
+
id: l(O),
|
|
187
|
+
ref_key: "textareaElement",
|
|
188
|
+
ref: o,
|
|
189
|
+
value: r.value,
|
|
190
|
+
class: E(["b-textarea__input", le.value]),
|
|
191
|
+
"aria-label": l(ne),
|
|
192
|
+
"aria-invalid": N.value,
|
|
193
|
+
readonly: l(_),
|
|
194
|
+
required: e.required,
|
|
195
|
+
disabled: e.disabled,
|
|
196
|
+
placeholder: e.placeholder,
|
|
197
|
+
style: q({ resize: e.resizable, height: v.value }),
|
|
198
|
+
onBlur: pe,
|
|
199
|
+
onChange: fe,
|
|
200
|
+
onFocus: me,
|
|
201
|
+
onInput: de,
|
|
202
|
+
onKeydown: [
|
|
203
|
+
w(ve, ["esc"]),
|
|
204
|
+
be
|
|
205
|
+
],
|
|
206
|
+
onKeyup: he,
|
|
207
|
+
onMousedown: ye,
|
|
208
|
+
onMouseup: ge
|
|
209
|
+
}, " ", 46, Te),
|
|
210
|
+
ce.value ? (c(), z("div", He, [
|
|
211
|
+
S(l(Be), {
|
|
212
|
+
variant: "tertiary",
|
|
213
|
+
disabled: e.disabled,
|
|
214
|
+
onClick: I,
|
|
215
|
+
onKeypress: w(I, ["enter"]),
|
|
216
|
+
onKeyup: w(I, ["space"])
|
|
217
|
+
}, {
|
|
218
|
+
iconLeft: x(() => [
|
|
219
|
+
S(l(ke), {
|
|
220
|
+
"svg-title": l(T)("clearText")
|
|
221
|
+
}, null, 8, ["svg-title"])
|
|
222
|
+
]),
|
|
223
|
+
_: 1
|
|
224
|
+
}, 8, ["disabled"])
|
|
225
|
+
])) : d("", !0)
|
|
226
|
+
]),
|
|
227
|
+
_: 1
|
|
228
|
+
}, 8, ["aria-disabled"]),
|
|
229
|
+
B.value ? (c(), h(l(j), {
|
|
230
|
+
key: 0,
|
|
231
|
+
"error-message": se.value
|
|
232
|
+
}, null, 8, ["error-message"])) : d("", !0),
|
|
233
|
+
e.errorMessage ? (c(), h(l(j), {
|
|
234
|
+
key: 1,
|
|
235
|
+
"error-message": e.errorMessage
|
|
236
|
+
}, null, 8, ["error-message"])) : d("", !0),
|
|
237
|
+
e.description ? (c(), h(l(F), {
|
|
238
|
+
key: 2,
|
|
239
|
+
class: "b-textarea__description",
|
|
240
|
+
el: "span"
|
|
241
|
+
}, {
|
|
242
|
+
default: x(() => [
|
|
243
|
+
Y(G(e.description), 1)
|
|
244
|
+
]),
|
|
245
|
+
_: 1
|
|
246
|
+
})) : d("", !0)
|
|
247
|
+
], 4)
|
|
248
|
+
], 2));
|
|
249
|
+
}
|
|
250
|
+
}), la = /* @__PURE__ */ Pe(Ve, [["__scopeId", "data-v-af3922c9"]]);
|
|
251
|
+
export {
|
|
252
|
+
la as B
|
|
253
|
+
};
|
|
254
|
+
//# sourceMappingURL=textarea.C_gnXj6b.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textarea.C_gnXj6b.js","sources":["../../../vue2/src/components/textarea/textarea.types.ts","../../../vue2/src/components/textarea/textarea.vue"],"sourcesContent":["import type { FormField } from '../../types/form-field';\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoTextareaResizeOption {\n HORIZONTAL = 'horizontal',\n VERTICAL = 'vertical',\n BOTH = 'both',\n NONE = 'none',\n}\n\nexport enum BentoTextareaStateClass {\n CLEARABLE = 'clearable',\n DISABLED = 'disabled',\n ERROR = 'error',\n READONLY = 'readonly',\n}\n\nexport enum BentoTextareaEvent {\n BLUR = 'blur',\n CHANGE = 'change',\n CLEAR = 'clear',\n ESCAPE_PRESSED = 'escape-pressed',\n FOCUS = 'focus',\n INPUT = 'input',\n UPDATE_MODEL_VALUE = 'update:model-value',\n KEYDOWN = 'keydown',\n KEYUP = 'keyup',\n}\n\nexport interface BentoTextareaProps extends FormField {\n /**\n * Text that labels the input element\n * @default undefined\n */\n ariaLabel?: string;\n\n /**\n * Text that shows number of characters in textarea\n * @default undefined\n */\n characterLimit?: number;\n\n /**\n * If set to true, shows a button to clear all the text\n * @default false\n */\n clearable?: boolean;\n\n /**\n * Sets the height of the textarea, e.g 200px OR 20vh\n * @default null\n */\n height?: string | null;\n\n /**\n * Indicates the possibility of resize the textarea.\n * Accepts the Enum or the string literal version.\n * @default BentoTextareaResizeOption.BOTH\n */\n resizable?: BentoTextareaResizeOption | `${BentoTextareaResizeOption}`;\n\n /**\n * Text displayed as the value of the textarea\n * @deprecated for usage with properties since version 2.0. Use `v-model` or `model-value` instead.\n */\n value?: string;\n\n /**\n * Text displayed as the value of the textarea\n */\n modelValue?: string;\n}\n","<template>\n <div ref=\"textareaComponent\" class=\"b-textarea\" :class=\"conditionalClasses\">\n <div :style=\"{ width: textareaWrapperWidth }\">\n <div class=\"b-textarea__label-box\" :class=\"conditionalClassesLabelBox\">\n <field-label\n v-if=\"label\"\n :for=\"textareaId\"\n :label=\"label\"\n :tooltip-text=\"tooltipText\"\n :optional=\"optional\"\n :required=\"required\"\n />\n <bento-typography\n v-if=\"characterLimit\"\n el=\"span\"\n class=\"b-textarea__label-item\"\n :class=\"conditionalClassesLabelItem\"\n >\n {{ counter }}\n </bento-typography>\n </div>\n <bento-typography el=\"div\" class=\"b-textarea__input-box\" :aria-disabled=\"disabled\">\n <textarea\n :id=\"textareaId\"\n ref=\"textareaElement\"\n :value=\"textareaValue\"\n class=\"b-textarea__input\"\n :class=\"conditionalClassesInput\"\n :aria-label=\"computedAriaLabel\"\n :aria-invalid=\"invalidInput\"\n :readonly=\"isReadOnly\"\n :required=\"required\"\n :disabled=\"disabled\"\n :placeholder=\"placeholder\"\n :style=\"{ resize: resizable, height: textareaHeight }\"\n @blur=\"onBlur\"\n @change=\"onChange\"\n @focus=\"onFocus\"\n @input=\"onInput\"\n @keydown.esc=\"onPressEscape\"\n @keydown=\"onKeyDown\"\n @keyup=\"onKeyUp\"\n @mousedown=\"onMouseDown\"\n @mouseup=\"onMouseUp\"\n >\n </textarea>\n\n <div v-if=\"showClearButton\" class=\"b-textarea__clear-button\">\n <bento-button\n variant=\"tertiary\"\n :disabled=\"disabled\"\n @click=\"onClear\"\n @keypress.enter=\"onClear\"\n @keyup.space=\"onClear\"\n >\n <template #iconLeft>\n <cross-circle-fill-small-icon :svg-title=\"t('clearText')\" />\n </template>\n </bento-button>\n </div>\n </bento-typography>\n\n <error-message v-if=\"isOverCharacterLimit\" :error-message=\"counterErrorText\" />\n\n <error-message v-if=\"errorMessage\" :error-message=\"errorMessage\" />\n\n <bento-typography v-if=\"description\" class=\"b-textarea__description\" el=\"span\">\n {{ description }}\n </bento-typography>\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, nextTick, onMounted, onUnmounted, ref, toRef, toRefs, useAttrs, watch } from 'vue';\n\n // Components\n import { BentoButton } from '@/components/button';\n import { BentoTypography } from '@/components/typography';\n import { ErrorMessage, FieldLabel } from '@/internal';\n import CrossCircleFillSmallIcon from '@adyen/ui-assets-icons-16/vue/cross-circle-fill-small';\n\n // Utils\n import { generateUid } from '@/core/utils/ts';\n import { observeSizeOfElement } from '@/utils/ts/resize';\n import { useAriaLabel } from '@/utils/ts/aria-label';\n import { useI18n } from '@/utils/ts/i18n';\n import { deprecate } from '@/utils/ts/deprecate';\n import { useFormFieldEmits } from '@/utils/ts/form-field/form-field';\n\n // Composables\n import { useFormLayoutFieldLoading } from '@/composables/use-form-layout-loading/use-form-layout-loading';\n\n // Constants\n import { BTextareaInputFocusBorderWidth } from '@adyen/bento-design-tokens/dist/js/bento/es6';\n\n // Types\n import { BentoTextareaEvent, type BentoTextareaProps, BentoTextareaStateClass } from './textarea.types';\n\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const attrs = useAttrs();\n\n const props = withDefaults(defineProps<BentoTextareaProps>(), {\n ariaLabel: undefined,\n characterLimit: undefined,\n description: '',\n disabled: false,\n clearable: false,\n errorMessage: '',\n height: null,\n label: '',\n optional: false,\n placeholder: '',\n readonly: false,\n resizable: 'both',\n required: false,\n tooltipText: null,\n value: '',\n modelValue: '',\n });\n\n const emit = defineEmits<{\n /**\n * Emitted when the element has lost focus\n */\n (e: BentoTextareaEvent.BLUR): void;\n\n /**\n * Emitted when the user modifies the element's value. Unlike the 'input' event, the change event is not necessarily fired for each alteration to an element's value\n */\n (e: BentoTextareaEvent.CHANGE): void;\n\n /**\n * Emitted when the \"Clear\" button was clicked\n */\n (e: BentoTextareaEvent.CLEAR): void;\n\n /**\n * Emitted when the \"ESC\" key is pressed\n */\n (e: BentoTextareaEvent.ESCAPE_PRESSED): void;\n\n /**\n * Emitted when the element has received focus\n */\n (e: BentoTextareaEvent.FOCUS): void;\n\n /**\n * Emitted when the component's model changes\n *\n * @deprecated since version 2.0. Use `v-model` or `update:model-value` instead.\n *\n */\n (e: BentoTextareaEvent.INPUT, value: string): void;\n\n /**\n * Emitted when the component's model changes\n */\n (e: BentoTextareaEvent.UPDATE_MODEL_VALUE, value: string): void;\n\n /**\n * Emitted when the text area keydown event is fired\n */\n (e: BentoTextareaEvent.KEYDOWN, event: KeyboardEvent): void;\n\n /**\n * Emitted when the text area keyup event is fired\n */\n (e: BentoTextareaEvent.KEYUP, event: KeyboardEvent): void;\n }>();\n\n const { height } = toRefs(props);\n\n const textareaId = generateUid('textarea');\n const textareaElement = ref<HTMLTextAreaElement>(null);\n const textareaComponent = ref<HTMLDivElement>(null);\n const textareaValue = ref(props.modelValue || props.value);\n const defaultTextareaHeight = 44;\n const textareaHeight = ref(props.height || `${defaultTextareaHeight}px`);\n const userSetHeight = ref<number>(0);\n const textareaWrapperWidth = ref('100%'); // The width set to the wrapper of the label, textarea and description\n const isUserResizing = ref(false);\n let textareaElementObserver: ResizeObserver | null = null;\n let textareaComponentObserver: ResizeObserver | null = null;\n\n const { t, n } = useI18n<{ message: MessageSchema }>({ messages });\n\n const { isReadOnly } = useFormLayoutFieldLoading(toRef(props, 'readonly'));\n\n const { emitValue } = useFormFieldEmits<string>(emit);\n\n const counter = computed(() => `${n(textareaValue?.value?.length ?? 0)} / ${n(props.characterLimit)}`);\n const isDynamicHeight = computed(() => !height.value);\n const isOverCharacterLimit = computed(\n () => props.characterLimit && textareaValue.value.length > props.characterLimit\n );\n\n /**\n * Calculates and sets the height of the textarea.\n * The height is determined by the maximum of the following values:\n *\n * 1. The content's scroll height (with a minimum of `defaultTextareaHeight`) + the border width.\n * 2. The height set by the user manually resizing the textarea (`userSetHeight`).\n * 3. The default minimum height (`defaultTextareaHeight`).\n *\n * This ensures the textarea grows with content, shrinks when content is removed,\n * but never goes below the manually set height or the default height.\n */\n const calculateHeight = () => {\n if (textareaElement.value) {\n const newHeight = Math.max(\n textareaElement.value.scrollHeight <= defaultTextareaHeight\n ? defaultTextareaHeight\n : textareaElement.value.scrollHeight + TEXTAREA_BORDER_WIDTH * 2,\n userSetHeight.value,\n defaultTextareaHeight\n );\n textareaHeight.value = `${newHeight}px`;\n }\n };\n\n watch(height, () => {\n if (isDynamicHeight.value) {\n calculateHeight();\n } else {\n textareaHeight.value = height.value;\n }\n });\n\n watch(\n () => [props.value, props.modelValue],\n () => {\n textareaValue.value = props.modelValue || props.value;\n },\n { immediate: true }\n );\n\n watch(\n () => textareaValue.value,\n async () => {\n if (isDynamicHeight.value) {\n // Hack to make the textarea calculate its height properly\n // Set the textarea back to the original value before calculating the height\n textareaHeight.value = `${defaultTextareaHeight}px`;\n if (!textareaValue.value) {\n return;\n }\n\n await nextTick();\n calculateHeight();\n }\n },\n { immediate: true }\n );\n\n const invalidInput = computed(() => !!props.errorMessage || isOverCharacterLimit.value);\n\n const conditionalClasses = computed(() => ({\n [`b-textarea--${BentoTextareaStateClass.DISABLED}`]: props.disabled,\n }));\n\n const conditionalClassesInput = computed(() => ({\n [`b-textarea__input--${BentoTextareaStateClass.CLEARABLE}`]: props.clearable,\n [`b-textarea__input--${BentoTextareaStateClass.READONLY}`]: isReadOnly.value,\n [`b-textarea__input--${BentoTextareaStateClass.ERROR}`]: invalidInput.value,\n [`b-textarea__input--dynamic-height`]: isDynamicHeight.value,\n }));\n\n const conditionalClassesLabelBox = computed(() => ({\n [`b-textarea__label-box--no-label`]: !props.label,\n }));\n\n const conditionalClassesLabelItem = computed(() => ({\n [`b-textarea__label-item--${BentoTextareaStateClass.ERROR}`]: isOverCharacterLimit.value,\n }));\n\n const counterErrorText = computed(() => t('yourTextCanBenAtMost', { characterLimit: props.characterLimit }));\n\n const ariaLabelAttribute = ref(attrs['aria-label']);\n const { ariaLabel, label } = toRefs(props);\n const computedAriaLabel = useAriaLabel({\n ariaLabel: ariaLabelAttribute.value as string,\n // TODO: take this line away when the aria-label props is removed\n label: ariaLabel,\n defaultFallback: label,\n });\n\n const showClearButton = computed(\n () => props.clearable && textareaValue.value && !props.disabled && !isReadOnly.value\n );\n\n const onClear = () => {\n textareaValue.value = '';\n emit(BentoTextareaEvent.CLEAR);\n emitValue('');\n };\n\n const onInput = (event: InputEvent) => {\n event.stopImmediatePropagation();\n\n if (!props.disabled && !isReadOnly.value) {\n textareaValue.value = (event.target as HTMLInputElement).value;\n /**\n * Triggered when input value is changed\n *\n * @event input\n * @property {String} inputValue - the updated textarea value\n */\n emitValue(textareaValue.value);\n }\n };\n\n const onBlur = () => {\n textareaElement.value.scrollTop = 0;\n emit(BentoTextareaEvent.BLUR);\n };\n\n const onFocus = () => {\n textareaElement.value.focus();\n emit(BentoTextareaEvent.FOCUS);\n };\n\n const onChange = () => {\n emit(BentoTextareaEvent.CHANGE);\n };\n\n const onPressEscape = () => {\n emit(BentoTextareaEvent.ESCAPE_PRESSED);\n };\n\n const onKeyDown = (event: KeyboardEvent) => {\n event.stopPropagation();\n emit(BentoTextareaEvent.KEYDOWN, event);\n };\n\n const onKeyUp = (event: KeyboardEvent) => {\n event.stopPropagation();\n emit(BentoTextareaEvent.KEYUP, event);\n };\n\n const onMouseDown = () => {\n isUserResizing.value = true;\n };\n\n const onMouseUp = () => {\n isUserResizing.value = false;\n };\n\n /**\n * Updates the textarea width depending if the container or the user update its size.\n * @param isTextareaElement - sets to true if the element being observed is the textarea HTML element.\n */\n const resizeTextareaWrapper = (isTextareaElement = false) => {\n // Width assigned by the browser whenever the textarea is manually resized. String of the format `<value>px`.\n const textareaStyleWidth = textareaElement.value.style.width;\n\n // Make sure the tracked textareaHeight is always in sync with the height size in case we manually resize the textarea\n if (textareaElement.value.style.height) {\n if (isUserResizing.value) {\n userSetHeight.value = parseInt(textareaElement.value.style.height, 10);\n }\n textareaHeight.value = textareaElement.value.style.height;\n }\n\n // If the textarea element observer is being triggered, but there's no textareaStyleWidth, we want to ignore it, as no manual resize as happened yet\n // The component wrapper will handle the resizing logic instead\n if (isTextareaElement && !textareaStyleWidth) {\n return;\n }\n\n // Width of the whole bento-textarea component\n const textareaComponentWidth = textareaComponent?.value?.offsetWidth;\n\n // If there is no textareaStyleWidth or the textareaStyleWidth is larger than the component container, the wrapper should be 100% of the container\n if (!textareaStyleWidth || parseInt(textareaStyleWidth, 10) > textareaComponentWidth) {\n textareaWrapperWidth.value = '100%';\n } else {\n // Else the wrapper should always be as wide as the textarea element itself\n textareaWrapperWidth.value = textareaStyleWidth;\n }\n };\n\n const focus = () => {\n textareaElement.value.focus();\n };\n\n defineExpose({\n focus,\n });\n\n onMounted(() => {\n textareaElementObserver = observeSizeOfElement(textareaElement.value, () => {\n resizeTextareaWrapper(true);\n });\n\n textareaComponentObserver = observeSizeOfElement(textareaComponent.value, () => {\n resizeTextareaWrapper();\n });\n\n if (isDynamicHeight.value) {\n calculateHeight();\n }\n\n if (props.value) {\n deprecate(\n 'BentoTextarea \"value\" property',\n `The use of \"value\" prop in \"BentoTextarea\" is no longer supported.\n Use the \"v-model\" or \"model-value\" property instead.`,\n '2.0.0'\n );\n }\n });\n\n onUnmounted(() => {\n textareaElementObserver?.disconnect();\n textareaComponentObserver?.disconnect();\n });\n</script>\n\n<script lang=\"ts\">\n const TEXTAREA_BORDER_WIDTH = parseFloat(BTextareaInputFocusBorderWidth);\n\n export default {\n i18n: { messages },\n name: 'bento-textarea',\n model: { prop: 'modelValue' },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./textarea.scss\" />\n"],"names":["BentoTextareaStateClass","BentoTextareaStateClass2","BentoTextareaEvent","BentoTextareaEvent2","TEXTAREA_BORDER_WIDTH","BTextareaInputFocusBorderWidth","__default__","messages","attrs","useAttrs","props","__props","emit","__emit","height","toRefs","textareaId","generateUid","textareaElement","ref","textareaComponent","textareaValue","defaultTextareaHeight","textareaHeight","userSetHeight","textareaWrapperWidth","isUserResizing","textareaElementObserver","textareaComponentObserver","t","n","useI18n","isReadOnly","useFormLayoutFieldLoading","toRef","emitValue","useFormFieldEmits","counter","computed","_a","isDynamicHeight","isOverCharacterLimit","calculateHeight","newHeight","watch","nextTick","invalidInput","conditionalClasses","conditionalClassesInput","conditionalClassesLabelBox","conditionalClassesLabelItem","counterErrorText","ariaLabelAttribute","ariaLabel","label","computedAriaLabel","useAriaLabel","showClearButton","onClear","onInput","event","onBlur","onFocus","onChange","onPressEscape","onKeyDown","onKeyUp","onMouseDown","onMouseUp","resizeTextareaWrapper","isTextareaElement","textareaStyleWidth","textareaComponentWidth","__expose","onMounted","observeSizeOfElement","deprecate","onUnmounted"],"mappings":";;;;;;;;;;;;;;AAYY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,YAAA,aACAA,EAAA,WAAA,YACAA,EAAA,QAAA,SACAA,EAAA,WAAA,YAJQA,IAAAD,KAAA,CAAA,CAAA,GAOAE,IAAA,kBAAAC,OACRA,EAAA,OAAA,QACAA,EAAA,SAAA,UACAA,EAAA,QAAA,SACAA,EAAA,iBAAA,kBACAA,EAAA,QAAA,SACAA,EAAA,QAAA,SACAA,EAAA,qBAAA,sBACAA,EAAA,UAAA,WACAA,EAAA,QAAA,SATQA,IAAAD,KAAA,CAAA,CAAA;;;;;;;;;;GCoZRE,KAAA,WAAAC,EAAA,GAEAC,KAAA;AAAA,EAAe,MAAA,EAAA,UAAAC,EAAA;AAAA,EACM,MAAA;AAAA,EACX,OAAA,EAAA,MAAA,aAAA;AAEV;;;;;;;;;;;;;;;;;;;;;AAtUA,UAAAC,KAAAC,GAAA,GAEAC,IAAAC,GAmBAC,IAAAC,GAkDA,EAAA,QAAAC,EAAA,IAAAC,EAAAL,CAAA,GAEAM,IAAAC,GAAA,UAAA,GACAC,IAAAC,EAAA,IAAA,GACAC,IAAAD,EAAA,IAAA,GACAE,IAAAF,EAAAT,EAAA,cAAAA,EAAA,KAAA,GACAY,IAAA,IACAC,IAAAJ,EAAAT,EAAA,UAAA,GAAAY,CAAA,IAAA,GACAE,IAAAL,EAAA,CAAA,GACAM,IAAAN,EAAA,MAAA,GACAO,IAAAP,EAAA,EAAA;AACA,QAAAQ,IAAA,MACAC,IAAA;AAEA,UAAA,EAAA,GAAAC,GAAA,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AA4B;AAAA,IAI5B,CAAA,GAGJwD,GAAA,MAAA;AACI,MAAA/C,IAAAgD,EAAAzD,EAAA,OAAA,MAAA;AACI,QAAAmD,EAAA,EAAA;AAAA,MAA0B,CAAA,GAG9BzC,IAAA+C,EAAAvD,EAAA,OAAA,MAAA;AACI,QAAAiD,EAAA;AAAA,MAAsB,CAAA,GAG1B7B,EAAA,SACIE,EAAA,GAGJhC,EAAA,SACIkE;AAAA,QAAA;AAAA,QACI;AAAA;AAAA,QACA;AAAA,MAEA;AAAA,IAER,CAAA,GAGJC,GAAA,MAAA;AACI,MAAAlD,KAAA,QAAAA,EAAA,cACAC,KAAA,QAAAA,EAAA;AAAA,IAAsC,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { defineComponent as ae, computed as o, ref as M, toRefs as ce, watch as fe, provide as
|
|
1
|
+
import { defineComponent as ae, computed as o, ref as M, toRefs as ce, watch as fe, provide as V, nextTick as ve, resolveComponent as w, createElementBlock as f, openBlock as i, createCommentVNode as u, createElementVNode as g, createBlock as S, withCtx as p, createTextVNode as k, toDisplayString as y, createVNode as L, renderSlot as z, mergeProps as H, inject as K, onUnmounted as _e, normalizeClass as W, Fragment as Y, renderList as be } from "vue";
|
|
2
2
|
import { B as se } from "./button.DhcxX2GJ.js";
|
|
3
|
-
import { B as he } from "./textarea.
|
|
3
|
+
import { B as he } from "./textarea.C_gnXj6b.js";
|
|
4
4
|
import { u as oe } from "./index.pdBj0KQU.js";
|
|
5
5
|
import { B as pe } from "./button-actions.BQ3AFQqt.js";
|
|
6
6
|
import { _ as q } from "./_plugin-vue_export-helper.CHgC5LLL.js";
|
|
7
7
|
import { B as ge } from "./date.DZvVL-uz.js";
|
|
8
8
|
import { B as ye } from "./link.cwPmWlsk.js";
|
|
9
|
-
import { B as Ne } from "./tag.
|
|
9
|
+
import { B as Ne } from "./tag.CjaB9DxL.js";
|
|
10
10
|
import { B as Te, d as we } from "./typography.yBEME_Gu.js";
|
|
11
|
-
import { a as
|
|
11
|
+
import { a as Ee, B as Ie, S as ke } from "./structured-list-item.BTPh7SPj.js";
|
|
12
12
|
/* empty css */
|
|
13
13
|
import { g as Ce } from "./generate-uid.NJ8tVoha.js";
|
|
14
14
|
import { u as Se } from "./use-has-slot.B7eQSabc.js";
|
|
@@ -61,9 +61,9 @@ const re = Symbol("timeline register entry injection key"), de = Symbol("timelin
|
|
|
61
61
|
},
|
|
62
62
|
emits: ["add-timeline-note"],
|
|
63
63
|
setup(e, { emit: l }) {
|
|
64
|
-
const { t: n } = oe({ messages: ee }),
|
|
64
|
+
const { t: n } = oe({ messages: ee }), E = o(() => n("addNote")), m = o(() => n("cancel")), N = M(), a = (v) => {
|
|
65
65
|
N.value = v;
|
|
66
|
-
}, _ = M(null), T = M(null), s = M(!1),
|
|
66
|
+
}, _ = M(null), T = M(null), s = M(!1), I = async () => {
|
|
67
67
|
var v, C;
|
|
68
68
|
s.value = !s.value, await ve(), s.value ? (v = _.value.$refs.textareaElement) == null || v.focus() : (C = T.value.$el) == null || C.focus();
|
|
69
69
|
}, b = () => {
|
|
@@ -71,7 +71,7 @@ const re = Symbol("timeline register entry injection key"), de = Symbol("timelin
|
|
|
71
71
|
description: N.value,
|
|
72
72
|
timestamp: { date: /* @__PURE__ */ new Date() },
|
|
73
73
|
type: "note"
|
|
74
|
-
}),
|
|
74
|
+
}), I();
|
|
75
75
|
}, d = M([]), h = o(
|
|
76
76
|
() => e.showMore && d.value.length > e.showMore.limit ? d.value.length - e.showMore.limit : null
|
|
77
77
|
), c = M(!1), { timegapLimit: r } = ce(e), t = o(() => Array.from(d.value.keys())), $ = o(() => e.showMore ? e.showMore.placement === A.BEFORE_LAST ? [
|
|
@@ -99,7 +99,7 @@ const re = Symbol("timeline register entry injection key"), de = Symbol("timelin
|
|
|
99
99
|
() => d.value.length,
|
|
100
100
|
() => D()
|
|
101
101
|
);
|
|
102
|
-
const
|
|
102
|
+
const U = {
|
|
103
103
|
showAll: c,
|
|
104
104
|
showMoreIndex: B,
|
|
105
105
|
hiddenItems: h,
|
|
@@ -107,10 +107,10 @@ const re = Symbol("timeline register entry injection key"), de = Symbol("timelin
|
|
|
107
107
|
timegapLimit: r,
|
|
108
108
|
timelineEntries: d
|
|
109
109
|
};
|
|
110
|
-
return
|
|
111
|
-
addNoteLabel:
|
|
110
|
+
return V(re, O), V(de, U), {
|
|
111
|
+
addNoteLabel: E,
|
|
112
112
|
cancelLabel: m,
|
|
113
|
-
toggleAddNote:
|
|
113
|
+
toggleAddNote: I,
|
|
114
114
|
updateNoteContent: a,
|
|
115
115
|
addNoteToTimeline: b,
|
|
116
116
|
showAddNoteTextArea: s,
|
|
@@ -122,8 +122,8 @@ const re = Symbol("timeline register entry injection key"), de = Symbol("timelin
|
|
|
122
122
|
}), De = { class: "b-timeline" }, je = {
|
|
123
123
|
key: 0,
|
|
124
124
|
class: "b-timeline__add-note-section"
|
|
125
|
-
},
|
|
126
|
-
function Ye(e, l, n,
|
|
125
|
+
}, Ue = { key: 1 }, Fe = { class: "b-timeline__items" };
|
|
126
|
+
function Ye(e, l, n, E, m, N) {
|
|
127
127
|
const a = w("bento-button"), _ = w("bento-textarea"), T = w("bento-button-actions");
|
|
128
128
|
return i(), f("div", De, [
|
|
129
129
|
e.addNote ? (i(), f("div", je, [
|
|
@@ -138,14 +138,14 @@ function Ye(e, l, n, I, m, N) {
|
|
|
138
138
|
]),
|
|
139
139
|
_: 1
|
|
140
140
|
}, 8, ["onClick"])),
|
|
141
|
-
e.showAddNoteTextArea ? (i(), f("div",
|
|
141
|
+
e.showAddNoteTextArea ? (i(), f("div", Ue, [
|
|
142
142
|
L(_, {
|
|
143
143
|
ref: "addNoteTextareaRef",
|
|
144
144
|
label: e.addNoteLabel,
|
|
145
145
|
"character-limit": 150,
|
|
146
146
|
resizable: "vertical",
|
|
147
|
-
|
|
148
|
-
}, null, 8, ["label", "
|
|
147
|
+
"onUpdate:modelValue": e.updateNoteContent
|
|
148
|
+
}, null, 8, ["label", "onUpdate:modelValue"]),
|
|
149
149
|
L(T, {
|
|
150
150
|
actions: [
|
|
151
151
|
{ title: e.addNoteLabel, event: e.addNoteToTimeline },
|
|
@@ -154,19 +154,19 @@ function Ye(e, l, n, I, m, N) {
|
|
|
154
154
|
}, null, 8, ["actions"])
|
|
155
155
|
])) : u("", !0)
|
|
156
156
|
])) : u("", !0),
|
|
157
|
-
g("ol",
|
|
158
|
-
|
|
157
|
+
g("ol", Fe, [
|
|
158
|
+
z(e.$slots, "default", {}, void 0, !0)
|
|
159
159
|
])
|
|
160
160
|
]);
|
|
161
161
|
}
|
|
162
|
-
const gt = /* @__PURE__ */ q(Be, [["render", Ye], ["__scopeId", "data-v-
|
|
162
|
+
const gt = /* @__PURE__ */ q(Be, [["render", Ye], ["__scopeId", "data-v-a77a7332"]]);
|
|
163
163
|
let te = 0;
|
|
164
|
-
const
|
|
164
|
+
const Ve = {
|
|
165
165
|
beforeCreate() {
|
|
166
166
|
this.uuid = te.toString(), te += 1;
|
|
167
167
|
}
|
|
168
|
-
},
|
|
169
|
-
function He(e, l, n,
|
|
168
|
+
}, ze = { key: 0 };
|
|
169
|
+
function He(e, l, n, E, m, N) {
|
|
170
170
|
return i(), f("svg", H({ role: "img" }, e.$attrs, {
|
|
171
171
|
class: "ui-assets-icons-16",
|
|
172
172
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -174,16 +174,16 @@ function He(e, l, n, I, m, N) {
|
|
|
174
174
|
height: "16",
|
|
175
175
|
fill: "none"
|
|
176
176
|
}), [
|
|
177
|
-
e.$attrs["svg-title"] ? (i(), f("title",
|
|
177
|
+
e.$attrs["svg-title"] ? (i(), f("title", ze, y(e.$attrs["svg-title"]), 1)) : u("", !0),
|
|
178
178
|
l[0] || (l[0] = g("path", {
|
|
179
179
|
fill: "#001222",
|
|
180
180
|
d: "M10 3.25C11.5188 3.25 12.75 4.48122 12.75 6V10C12.75 11.5188 11.5188 12.75 10 12.75H6C4.48122 12.75 3.25 11.5188 3.25 10V6C3.25 4.48122 4.48122 3.25 6 3.25H10Z"
|
|
181
181
|
}, null, -1))
|
|
182
182
|
], 16);
|
|
183
183
|
}
|
|
184
|
-
const qe = /* @__PURE__ */ q(
|
|
184
|
+
const qe = /* @__PURE__ */ q(Ve, [["render", He]]);
|
|
185
185
|
function ne(e, l, n) {
|
|
186
|
-
const
|
|
186
|
+
const E = Le(), m = (n == null ? void 0 : n.locale) ?? E.locale ?? Me, N = Ae(e, l);
|
|
187
187
|
if (isNaN(N))
|
|
188
188
|
throw new RangeError("Invalid time value");
|
|
189
189
|
const a = Object.assign({}, n, {
|
|
@@ -192,10 +192,10 @@ function ne(e, l, n) {
|
|
|
192
192
|
}), [_, T] = Oe(
|
|
193
193
|
n == null ? void 0 : n.in,
|
|
194
194
|
...N > 0 ? [l, e] : [e, l]
|
|
195
|
-
), s = $e((n == null ? void 0 : n.roundingMethod) ?? "round"),
|
|
195
|
+
), s = $e((n == null ? void 0 : n.roundingMethod) ?? "round"), I = T.getTime() - _.getTime(), b = I / x, d = Z(T) - Z(_), h = (I - d) / x, c = n == null ? void 0 : n.unit;
|
|
196
196
|
let r;
|
|
197
197
|
if (c ? r = c : b < 1 ? r = "second" : b < 60 ? r = "minute" : b < G ? r = "hour" : h < Q ? r = "day" : h < X ? r = "month" : r = "year", r === "second") {
|
|
198
|
-
const t = s(
|
|
198
|
+
const t = s(I / 1e3);
|
|
199
199
|
return m.formatDistance("xSeconds", t, a);
|
|
200
200
|
} else if (r === "minute") {
|
|
201
201
|
const t = s(b);
|
|
@@ -234,8 +234,8 @@ const ie = {
|
|
|
234
234
|
BentoLink: ye,
|
|
235
235
|
BentoTag: Ne,
|
|
236
236
|
BentoTypography: Te,
|
|
237
|
-
BentoStructuredList:
|
|
238
|
-
BentoStructuredListItem:
|
|
237
|
+
BentoStructuredList: Ie,
|
|
238
|
+
BentoStructuredListItem: Ee,
|
|
239
239
|
SquareSmallIcon: qe
|
|
240
240
|
},
|
|
241
241
|
i18n: { messages: ie },
|
|
@@ -313,7 +313,7 @@ const ie = {
|
|
|
313
313
|
}
|
|
314
314
|
},
|
|
315
315
|
setup(e, { slots: l }) {
|
|
316
|
-
const { t: n } = oe({ messages: ie }),
|
|
316
|
+
const { t: n } = oe({ messages: ie }), E = o(() => e.type === "note"), m = o(() => e.variant === R.CRITICAL ? "red" : e.variant === R.SUCCESS ? "green" : e.status);
|
|
317
317
|
e.variant && we(
|
|
318
318
|
'BentoTimelineItem "variant" property',
|
|
319
319
|
`Use the BentoTimelineItem "status" modifier instead to modify the color of the timeline icon.
|
|
@@ -321,34 +321,34 @@ const ie = {
|
|
|
321
321
|
"2.0.0"
|
|
322
322
|
);
|
|
323
323
|
const N = o(() => ({
|
|
324
|
-
[`b-timeline-item__icon--${m.value}`]: m.value && !
|
|
324
|
+
[`b-timeline-item__icon--${m.value}`]: m.value && !E.value
|
|
325
325
|
})), a = o(() => ({
|
|
326
|
-
"b-timeline-item--note":
|
|
326
|
+
"b-timeline-item--note": E.value
|
|
327
327
|
}));
|
|
328
|
-
|
|
328
|
+
V(ke, !0);
|
|
329
329
|
const _ = {
|
|
330
330
|
title: e.title,
|
|
331
331
|
date: e.timestamp.date
|
|
332
|
-
}, T = K(re), { timelineEntries: s, unregisterTimelineEntry:
|
|
333
|
-
_e(() =>
|
|
332
|
+
}, T = K(re), { timelineEntries: s, unregisterTimelineEntry: I } = T(_);
|
|
333
|
+
_e(() => I());
|
|
334
334
|
const { showAll: b, showMoreIndex: d, hiddenItems: h, visibleIndexes: c, timegapLimit: r } = K(de), t = o(() => s.value.indexOf(_)), $ = o(() => b.value || !c.value), B = o(
|
|
335
335
|
() => $.value ? !0 : c.value.includes(t.value)
|
|
336
336
|
), D = o(() => typeof e.title == "object"), j = o(() => e.title), O = o(() => {
|
|
337
337
|
var P;
|
|
338
338
|
if (!r.value)
|
|
339
339
|
return null;
|
|
340
|
-
const
|
|
341
|
-
if (!
|
|
340
|
+
const F = (P = s.value[t.value - 1]) == null ? void 0 : P.date, me = $.value || c.value.includes(t.value - 1);
|
|
341
|
+
if (!F || !me)
|
|
342
342
|
return null;
|
|
343
343
|
const { date: J } = s.value[t.value], ue = parseInt(
|
|
344
|
-
ne(
|
|
344
|
+
ne(F, J, { unit: r.value.unit }),
|
|
345
345
|
10
|
|
346
346
|
);
|
|
347
|
-
return r.value.amount < ue ? ne(
|
|
348
|
-
}),
|
|
347
|
+
return r.value.amount < ue ? ne(F, J, { roundingMethod: "floor" }) : null;
|
|
348
|
+
}), U = o(() => O.value ? n("timegap", { timegap: O.value }) : ""), v = o(() => h.value && d.value === t.value), C = o(() => t.value !== -1 && t.value === s.value.length - 1);
|
|
349
349
|
return {
|
|
350
350
|
// Values
|
|
351
|
-
isNoteType:
|
|
351
|
+
isNoteType: E,
|
|
352
352
|
iconConditionalClasses: N,
|
|
353
353
|
conditionalClasses: a,
|
|
354
354
|
displayShowMoreButton: v,
|
|
@@ -358,7 +358,7 @@ const ie = {
|
|
|
358
358
|
isLinkTitle: D,
|
|
359
359
|
linkTitleProps: j,
|
|
360
360
|
timegap: O,
|
|
361
|
-
timegapAriaLabel:
|
|
361
|
+
timegapAriaLabel: U,
|
|
362
362
|
isLastItem: C,
|
|
363
363
|
// Methods
|
|
364
364
|
generateUid: Ce,
|
|
@@ -383,8 +383,8 @@ const ie = {
|
|
|
383
383
|
key: 1,
|
|
384
384
|
class: "b-timeline-item__row"
|
|
385
385
|
}, tt = { class: "b-timeline-item__content" };
|
|
386
|
-
function nt(e, l, n,
|
|
387
|
-
const a = w("bento-typography"), _ = w("square-small-icon"), T = w("bento-link"), s = w("bento-date"),
|
|
386
|
+
function nt(e, l, n, E, m, N) {
|
|
387
|
+
const a = w("bento-typography"), _ = w("square-small-icon"), T = w("bento-link"), s = w("bento-date"), I = w("bento-structured-list-item"), b = w("bento-structured-list"), d = w("bento-tag"), h = w("bento-button");
|
|
388
388
|
return e.isVisible ? (i(), f("li", {
|
|
389
389
|
key: 0,
|
|
390
390
|
class: W(["b-timeline-item", e.conditionalClasses])
|
|
@@ -443,7 +443,7 @@ function nt(e, l, n, I, m, N) {
|
|
|
443
443
|
class: "b-timeline-item__description"
|
|
444
444
|
}, {
|
|
445
445
|
default: p(() => [
|
|
446
|
-
|
|
446
|
+
z(e.$slots, "default", {}, () => [
|
|
447
447
|
k(y(e.description), 1)
|
|
448
448
|
], !0)
|
|
449
449
|
]),
|
|
@@ -488,7 +488,7 @@ function nt(e, l, n, I, m, N) {
|
|
|
488
488
|
class: "b-timeline-item__description"
|
|
489
489
|
}, {
|
|
490
490
|
default: p(() => [
|
|
491
|
-
|
|
491
|
+
z(e.$slots, "default", {}, () => [
|
|
492
492
|
k(y(e.description), 1)
|
|
493
493
|
], !0)
|
|
494
494
|
]),
|
|
@@ -497,7 +497,7 @@ function nt(e, l, n, I, m, N) {
|
|
|
497
497
|
!e.isNoteType && e.dataList ? (i(), f("div", xe, [
|
|
498
498
|
L(b, null, {
|
|
499
499
|
default: p(() => [
|
|
500
|
-
(i(!0), f(Y, null, be(e.dataList, (c) => (i(), S(
|
|
500
|
+
(i(!0), f(Y, null, be(e.dataList, (c) => (i(), S(I, {
|
|
501
501
|
key: e.generateUid(c.label),
|
|
502
502
|
label: c.label
|
|
503
503
|
}, {
|
|
@@ -553,4 +553,4 @@ export {
|
|
|
553
553
|
le as d,
|
|
554
554
|
gt as t
|
|
555
555
|
};
|
|
556
|
-
//# sourceMappingURL=timeline-item.
|
|
556
|
+
//# sourceMappingURL=timeline-item.rSY0Xce3.js.map
|