@adyen/bento-vue2 1.92.0 → 1.92.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/assets/accordion-item.css +1 -1
  2. package/dist/assets/action-bar.css +1 -1
  3. package/dist/assets/base-modal.css +1 -1
  4. package/dist/assets/button-actions.css +1 -1
  5. package/dist/assets/card.css +1 -1
  6. package/dist/assets/data-grid.css +1 -1
  7. package/dist/assets/dialog-page.css +1 -1
  8. package/dist/assets/file-uploader.css +1 -1
  9. package/dist/assets/input-field.css +1 -1
  10. package/dist/assets/inspector.css +1 -1
  11. package/dist/assets/modal-fullscreen.css +1 -1
  12. package/dist/assets/secondary-nav.css +1 -1
  13. package/dist/assets/sidepanel.css +1 -1
  14. package/dist/checkbox.js +2 -2
  15. package/dist/chunks/{checkbox-group.DWZvFkjz.js → checkbox-group.DmKZQlxZ.js} +2 -2
  16. package/dist/chunks/{checkbox-group.DWZvFkjz.js.map → checkbox-group.DmKZQlxZ.js.map} +1 -1
  17. package/dist/chunks/{checkbox.BZP0wtnE.js → checkbox.BObXaofv.js} +18 -18
  18. package/dist/chunks/{checkbox.BZP0wtnE.js.map → checkbox.BObXaofv.js.map} +1 -1
  19. package/dist/chunks/{data-grid.hMM9F36T.js → data-grid.CJzEtn4Q.js} +4 -4
  20. package/dist/chunks/{data-grid.hMM9F36T.js.map → data-grid.CJzEtn4Q.js.map} +1 -1
  21. package/dist/chunks/{date-picker.BSo6Cvum.js → date-picker.C9DIeaWH.js} +2 -2
  22. package/dist/chunks/{date-picker.BSo6Cvum.js.map → date-picker.C9DIeaWH.js.map} +1 -1
  23. package/dist/chunks/{date-range-picker.D90k5b8p.js → date-range-picker.zT42F9r4.js} +3 -3
  24. package/dist/chunks/{date-range-picker.D90k5b8p.js.map → date-range-picker.zT42F9r4.js.map} +1 -1
  25. package/dist/chunks/{filter-bar.C9rWMIWO.js → filter-bar.C5NxhUhF.js} +11 -11
  26. package/dist/chunks/{filter-bar.C9rWMIWO.js.map → filter-bar.C5NxhUhF.js.map} +1 -1
  27. package/dist/chunks/{header-with-views.g6J7x6l2.js → header-with-views.DKD7O8pU.js} +4 -4
  28. package/dist/chunks/{header-with-views.g6J7x6l2.js.map → header-with-views.DKD7O8pU.js.map} +1 -1
  29. package/dist/chunks/{input-field-password.CiDdI6A_.js → input-field-password.hd-w1gkL.js} +2 -2
  30. package/dist/chunks/{input-field-password.CiDdI6A_.js.map → input-field-password.hd-w1gkL.js.map} +1 -1
  31. package/dist/chunks/{input-field-phone-number.DFS58acU.js → input-field-phone-number.BRmSDrCn.js} +2 -2
  32. package/dist/chunks/{input-field-phone-number.DFS58acU.js.map → input-field-phone-number.BRmSDrCn.js.map} +1 -1
  33. package/dist/chunks/input-field.BgzXEyxn.js +219 -0
  34. package/dist/chunks/input-field.BgzXEyxn.js.map +1 -0
  35. package/dist/chunks/{input-time.BhAUyKZM.js → input-time.CF2kTtAp.js} +2 -2
  36. package/dist/chunks/{input-time.BhAUyKZM.js.map → input-time.CF2kTtAp.js.map} +1 -1
  37. package/dist/chunks/{modal.BXxwn9H4.js → modal.B6n5AWs2.js} +105 -113
  38. package/dist/chunks/{modal.BXxwn9H4.js.map → modal.B6n5AWs2.js.map} +1 -1
  39. package/dist/chunks/{rich-text-editor.DPpIzYid.js → rich-text-editor.CmsmiW87.js} +2 -2
  40. package/dist/chunks/{rich-text-editor.DPpIzYid.js.map → rich-text-editor.CmsmiW87.js.map} +1 -1
  41. package/dist/chunks/{search-bar.BEOieKeA.js → search-bar.Brb3OP-y.js} +2 -2
  42. package/dist/chunks/{search-bar.BEOieKeA.js.map → search-bar.Brb3OP-y.js.map} +1 -1
  43. package/dist/chunks/{selection-card-group.CLJPaknG.js → selection-card-group.5jzX23fU.js} +8 -8
  44. package/dist/chunks/{selection-card-group.CLJPaknG.js.map → selection-card-group.5jzX23fU.js.map} +1 -1
  45. package/dist/data-grid.js +1 -1
  46. package/dist/date-picker.js +1 -1
  47. package/dist/date-range-picker.js +1 -1
  48. package/dist/filter-bar.js +1 -1
  49. package/dist/header-with-views.js +1 -1
  50. package/dist/index.js +15 -15
  51. package/dist/input-field-password.js +1 -1
  52. package/dist/input-field-phone-number.js +1 -1
  53. package/dist/input-field.js +1 -1
  54. package/dist/input-time.js +1 -1
  55. package/dist/modal.js +1 -1
  56. package/dist/rich-text-editor.js +1 -1
  57. package/dist/search-bar.js +1 -1
  58. package/dist/selection-card.js +1 -1
  59. package/dist/web-types.json +1 -1
  60. package/package.json +2 -2
  61. package/dist/chunks/input-field.CGLjYab8.js +0 -222
  62. package/dist/chunks/input-field.CGLjYab8.js.map +0 -1
@@ -0,0 +1,219 @@
1
+ import { defineComponent as de, useAttrs as se, useSlots as ue, ref as f, provide as pe, inject as x, toRef as ce, computed as r, toRefs as fe } from "vue";
2
+ import { b as be, I as _e, c as me, B as we } from "./dropdown.BYJwx-JD.js";
3
+ import { p as L, d as T, B as De } from "./typography.C8lPlsbD.js";
4
+ import { u as ye } from "./form-field.D_2g7vaP.js";
5
+ import { g as b } from "./generate-uid.NJ8tVoha.js";
6
+ import { g as H } from "./get-slot-text.Bjb9dTSV.js";
7
+ import { u as he } from "./aria-label.CaUURpnB.js";
8
+ import { u as ve } from "./index.B6WW_F-J.js";
9
+ import { u as Ee } from "./use-form-layout-loading.CWbjZiwP.js";
10
+ import { u as Le } from "./use-has-slot.C9lQZ6nz.js";
11
+ import { F as Te } from "./field-label.DjjjkcO6.js";
12
+ import { E as Ae } from "./error-message.CyERcfdt.js";
13
+ import { n as Fe } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
14
+ import "../assets/input-field.css";
15
+ var d = /* @__PURE__ */ ((t) => (t.DEFAULT = "default", t.PAYMENT_METHOD = "payment-method", t.STATIC_VALUE = "static-value", t.DROPDOWN = "dropdown", t))(d || {}), l = /* @__PURE__ */ ((t) => (t.START = "start", t.END = "end", t))(l || {}), _ = /* @__PURE__ */ ((t) => (t.CONDENSED = "condensed", t.DISABLED = "disabled", t.READONLY = "readonly", t.ERROR = "error", t))(_ || {}), A = /* @__PURE__ */ ((t) => (t.SEARCH = "search", t.TEXT = "text", t.NUMBER = "number", t))(A || {}), Ie = /* @__PURE__ */ ((t) => (t.INPUT = "input", t.ESCAPE_PRESSED = "escape-pressed", t.UPDATE_DROPDOWN = "update:dropdown", t.DROPDOWN_INPUT = "dropdown-input", t.FOCUS = "focus", t.CHANGE = "change", t.BLUR = "blur", t.KEYDOWN = "keydown", t))(Ie || {});
16
+ const ge = {
17
+ "de-DE": {
18
+ ariaLabelDropdownFallback: "{inputLabel} Dropdown",
19
+ ariaLabelFallback: "Eingabefeld"
20
+ },
21
+ "en-GB": {
22
+ ariaLabelDropdownFallback: "{inputLabel} Drop-down",
23
+ ariaLabelFallback: "Input field"
24
+ },
25
+ "en-US": {
26
+ ariaLabelDropdownFallback: "{inputLabel} Dropdown",
27
+ ariaLabelFallback: "Input field"
28
+ },
29
+ "es-ES": {
30
+ ariaLabelDropdownFallback: "{inputLabel} desplegable",
31
+ ariaLabelFallback: "Campo de entrada"
32
+ },
33
+ "es-MX": {
34
+ ariaLabelDropdownFallback: "{inputLabel} desplegable",
35
+ ariaLabelFallback: "Campo de entrada"
36
+ },
37
+ "fr-FR": {
38
+ ariaLabelDropdownFallback: "Menu déroulant {inputLabel}",
39
+ ariaLabelFallback: "Champ de saisie"
40
+ },
41
+ "it-IT": {
42
+ ariaLabelDropdownFallback: "Menu a discesa {inputLabel}",
43
+ ariaLabelFallback: "Campo di immissione"
44
+ },
45
+ "ja-JP": {
46
+ ariaLabelDropdownFallback: "{inputLabel}ドロップダウン",
47
+ ariaLabelFallback: "入力フィールド"
48
+ },
49
+ "pt-BR": {
50
+ ariaLabelDropdownFallback: "Menu suspenso {inputLabel}",
51
+ ariaLabelFallback: "Campo de entrada"
52
+ },
53
+ "zh-CN": {
54
+ ariaLabelDropdownFallback: "{inputLabel} 下拉菜单",
55
+ ariaLabelFallback: "输入字段"
56
+ }
57
+ }, ke = {
58
+ name: "bento-input-field",
59
+ inheritAttrs: !1,
60
+ model: { prop: "modelValue" },
61
+ i18n: { messages: ge }
62
+ }, Se = /* @__PURE__ */ de({
63
+ ...ke,
64
+ props: {
65
+ description: { default: "" },
66
+ disabled: { type: Boolean, default: !1 },
67
+ errorMessage: { default: null },
68
+ label: { default: "" },
69
+ optional: { type: Boolean, default: !1 },
70
+ placeholder: { default: "" },
71
+ readonly: { type: Boolean, default: !1 },
72
+ required: { type: Boolean, default: !1 },
73
+ tooltipText: { default: null },
74
+ ariaHidden: { type: Boolean, default: !0 },
75
+ ariaLabel: { default: void 0 },
76
+ condensed: { type: Boolean, default: !1 },
77
+ dropdown: { default: void 0 },
78
+ dropdownPosition: { default: l.START },
79
+ error: { type: Boolean, default: !1 },
80
+ modelValue: { default: void 0 },
81
+ slashedZero: { type: Boolean, default: !1 },
82
+ staticValue: { default: "" },
83
+ staticValuePosition: { default: l.START },
84
+ type: { default: A.TEXT },
85
+ value: { default: void 0 },
86
+ variant: { default: d.DEFAULT }
87
+ },
88
+ emits: ["blur", "click", "change", "dropdown-input", "escape-pressed", "focus", "keydown", "keyup", "input", "update:dropdown", "update:model-value"],
89
+ setup(t, { expose: a, emit: o }) {
90
+ const e = t, n = se(), s = ue(), { emitValue: F } = ye(o), { t: w } = ve(), I = Le(s), g = f(null), k = f(null), Y = b("input"), D = b("input-dropdown"), y = b("input-static-value"), S = b("input-description"), C = b("input-error"), h = f(!1);
91
+ function q(i) {
92
+ return i["data-testid"] ?? "input-text-container";
93
+ }
94
+ function W(i) {
95
+ return Object.fromEntries(
96
+ Object.entries(i).filter(([m]) => !m.startsWith("aria-") && m !== "data-testid")
97
+ );
98
+ }
99
+ pe(be, !0);
100
+ const j = x(_e, f(void 0)), J = () => {
101
+ h.value = !0, o("focus");
102
+ }, K = () => {
103
+ h.value = !1, o("blur");
104
+ }, { isReadOnly: u } = Ee(ce(e, "readonly")), z = r(
105
+ () => {
106
+ var i;
107
+ return u.value || ((i = e.dropdown) == null ? void 0 : i.readonly);
108
+ }
109
+ ), p = r(
110
+ () => e.variant === d.STATIC_VALUE && !!s.staticValue
111
+ ), X = r(() => e.variant === d.DEFAULT), G = r(() => e.variant === d.PAYMENT_METHOD), Z = r(
112
+ () => p.value && e.staticValuePosition === l.START
113
+ ), Q = r(
114
+ () => p.value && e.staticValuePosition === l.END
115
+ ), c = r(() => e.variant === d.DROPDOWN && !!e.dropdown), ee = r(
116
+ () => c.value && e.dropdownPosition === l.START
117
+ ), ae = r(
118
+ () => c.value && e.dropdownPosition === l.END
119
+ ), v = r(
120
+ () => !e.disabled && !u.value && (!!e.errorMessage || e.error)
121
+ ), N = r(() => H(s)("default") || e.label), O = r(() => H(s)("description") || e.description), te = r(() => c.value === !0 && p.value === !0 ? `${y} ${D}` : c.value === !0 ? `${D}` : p.value === !0 ? `${y}` : null), R = r(
122
+ () => n != null && n["aria-labelledby"] ? void 0 : w("ariaLabelFallback")
123
+ ), P = r(
124
+ () => w("ariaLabelDropdownFallback", { inputLabel: V.value })
125
+ ), B = f(n["aria-label"]), { ariaLabel: M } = fe(e), V = he({
126
+ ariaLabel: B.value,
127
+ // TODO: take this line away when the aria-label props is removed
128
+ label: M,
129
+ defaultFallback: N.value || R
130
+ }), oe = r(
131
+ () => `${O.value ? S : ""} ${v.value && e.errorMessage ? C : ""}`
132
+ ), ne = r(() => ({
133
+ [`b-input-field--${_.CONDENSED}`]: e.condensed,
134
+ [`b-input-field--${_.DISABLED}`]: e.disabled,
135
+ [`b-input-field--${_.READONLY}`]: u.value,
136
+ [`b-input-field--${_.ERROR}`]: v.value,
137
+ "b-input-field--slashed-zero": e.slashedZero
138
+ })), re = r(() => ({
139
+ "aria-label": P.value,
140
+ ...e.dropdown
141
+ })), ie = (i) => {
142
+ const m = i.target.value;
143
+ !e.disabled && !u.value && F(m);
144
+ }, le = (i) => {
145
+ o("dropdown-input", i), o("update:dropdown", { ...e == null ? void 0 : e.dropdown, value: i });
146
+ }, E = () => {
147
+ g.value.focus();
148
+ }, U = () => {
149
+ e.variant === "dropdown" ? k.value.focus() : E();
150
+ };
151
+ a({
152
+ focusInput: E,
153
+ focus: U
154
+ });
155
+ const $ = x(me, "");
156
+ return !Object.values(A).includes(e.type) && !$ && (e.type === "tel" ? L(
157
+ `"bento-input-field" dropdown does not support the type '${e.type}', use "bento-input-field-phone-number" instead.`
158
+ ) : e.type === "password" ? L(
159
+ `"bento-input-field" dropdown does not support the type '${e.type}', use "bento-input-field-password" instead.`
160
+ ) : L(`"bento-input-field" dropdown does not support the type '${e.type}'`)), e.error && T(
161
+ 'BentoInputField "error" property',
162
+ `Use the BentoInputField "errorMessage" property instead to indicate that there is a modifier error.
163
+ Having the field as "undefined" will hide/remove the error.
164
+ <bento-dropdown errorMessage="Error message text" />`,
165
+ "2.0.0"
166
+ ), I("defaultIconBefore") && T(
167
+ 'BentoInputField "defaultIconBefore" slot',
168
+ `Use the BentoInputField "iconBefore" slot instead to add an icon at the left side of the input field
169
+ <bento-input-field>
170
+ <template #iconBefore>
171
+ <my-icon-goes-here />
172
+ </template>
173
+ </bento-input-field>`,
174
+ "2.0.0"
175
+ ), e.value && T(
176
+ 'BentoInputField "value" property',
177
+ `The use of "value" prop in "BentoInputField" is no longer supported.
178
+ Use the "v-model" or "model-value" property instead.`,
179
+ "2.0.0"
180
+ ), { __sfc: !0, attrs: n, slots: s, props: e, emit: o, emitValue: F, t: w, hasSlot: I, inputFieldElement: g, inputDropdownElement: k, inputFieldId: Y, dropdownId: D, staticValueId: y, descriptionId: S, errorId: C, isFocused: h, getDataTestId: q, getRootAttributes: W, hint: j, onFocus: J, onBlur: K, isReadOnly: u, isDropdownReadOnly: z, shouldShowStaticValue: p, isDefaultVariant: X, isPaymentMethodVariant: G, shouldDisplayStaticValueAtStart: Z, shouldDisplayStaticValueAtEnd: Q, shouldShowDropdown: c, shouldDisplayDropdownAtStart: ee, shouldDisplayDropdownAtEnd: ae, shouldShowError: v, computedLabel: N, computedDescription: O, computedAriaOwns: te, computedAriaLabelFallbackMessage: R, computedAriaLabelDropdowFallback: P, ariaLabelAttribute: B, ariaLabel: M, computedAriaLabel: V, computedAriaDescribedBy: oe, inputFieldConditionalClasses: ne, inputFieldDropdownProps: re, onInput: ie, onDropdownInput: le, focusInput: E, focus: U, inputFieldParentComponent: $, BentoDropdown: we, BentoTypography: De, ErrorMessage: Ae, FieldLabel: Te };
181
+ }
182
+ });
183
+ var Ce = function() {
184
+ var a = this, o = a._self._c, e = a._self._setupProxy;
185
+ return o(e.BentoTypography, a._b({ staticClass: "b-input-field", class: e.inputFieldConditionalClasses, attrs: { "data-testid": e.getDataTestId(a.$attrs), el: "div", variant: "body" } }, "bento-typography", e.getRootAttributes(a.$attrs), !1), [e.hasSlot("default") || a.label ? o(e.FieldLabel, { attrs: { for: e.inputFieldId, "data-testid": "input-field-label", "tooltip-text": a.tooltipText, optional: a.optional, required: a.required, label: a.label }, on: { click: e.focusInput } }, [a._t("default")], 2) : a._e(), o("div", { staticClass: "b-input-field__input-box", attrs: { "data-testid": "input-box", "aria-disabled": a.disabled }, on: { click: e.focusInput } }, [e.isDefaultVariant && (e.hasSlot("defaultIconBefore") || e.hasSlot("iconBefore")) ? o("span", { staticClass: "b-input-field__icon-before", attrs: { "aria-hidden": a.ariaHidden ? "true" : void 0 } }, [e.hasSlot("iconBefore") ? a._t("iconBefore") : a._e(), e.hasSlot("defaultIconBefore") && !e.hasSlot("iconBefore") ? a._t("defaultIconBefore") : a._e()], 2) : a._e(), e.isPaymentMethodVariant && e.hasSlot("paymentMethod") ? o("span", { staticClass: "b-input-field__payment-method", attrs: { "aria-hidden": a.ariaHidden ? "true" : void 0 } }, [a._t("paymentMethod")], 2) : a._e(), e.shouldDisplayDropdownAtStart ? o("div", { staticClass: "b-input-field__dropdown b-input-field__dropdown--start", attrs: { id: e.dropdownId }, on: { click: function(n) {
186
+ n.stopPropagation();
187
+ } } }, [a.dropdown ? o(e.BentoDropdown, a._b({ ref: "inputDropdownElement", attrs: { disabled: a.disabled, readonly: e.isDropdownReadOnly }, on: { "update:model-value": e.onDropdownInput } }, "bento-dropdown", e.inputFieldDropdownProps, !1)) : a._e()], 1) : a._e(), e.shouldDisplayStaticValueAtStart ? o(e.BentoTypography, { staticClass: "b-input-field__static-value b-input-field__static-value--start", attrs: { id: e.staticValueId, el: "span", variant: "body" } }, [a._t("staticValue")], 2) : a._e(), o("div", { staticClass: "b-input-field__input-container" }, [o("input", a._b({ ref: "inputFieldElement", staticClass: "b-input-field__input", attrs: { id: e.inputFieldId, "aria-label": e.computedAriaLabel, "aria-describedby": e.computedAriaDescribedBy, "aria-owns": e.computedAriaOwns, "aria-invalid": e.shouldShowError, placeholder: a.placeholder, required: a.required, "aria-required": a.required, type: a.type, disabled: a.disabled, readonly: e.isReadOnly }, domProps: { value: a.modelValue ?? a.value }, on: { input: e.onInput, change: function(n) {
188
+ return e.emit("change");
189
+ }, focus: e.onFocus, blur: e.onBlur, keydown: [function(n) {
190
+ return e.emit("keydown", n);
191
+ }, function(n) {
192
+ return !n.type.indexOf("key") && a._k(n.keyCode, "esc", 27, n.key, ["Esc", "Escape"]) ? null : e.emit("escape-pressed");
193
+ }], keyup: function(n) {
194
+ return e.emit("keyup", n);
195
+ }, click: function(n) {
196
+ return e.emit("click", n);
197
+ } } }, "input", a.$attrs, !1)), e.hint && e.isFocused && (a.modelValue || a.value) ? o(e.BentoTypography, { staticClass: "b-input-field__hint", attrs: { el: "span" } }, [a._v(" " + a._s(e.hint) + " ")]) : a._e()], 1), e.hasSlot("iconAfter") ? o("span", { staticClass: "b-input-field__icon-after", attrs: { "aria-hidden": a.ariaHidden ? "true" : void 0, "data-testid": "input-text__icon-after" } }, [a._t("iconAfter")], 2) : a._e(), e.shouldDisplayStaticValueAtEnd ? o(e.BentoTypography, { staticClass: "b-input-field__static-value b-input-field__static-value--end", attrs: { id: e.staticValueId, el: "span", variant: "body" } }, [a._t("staticValue")], 2) : a._e(), e.shouldDisplayDropdownAtEnd ? o("div", { staticClass: "b-input-field__dropdown b-input-field__dropdown--end", attrs: { id: e.dropdownId, "data-testid": "input-field-dropdown-container-end" }, on: { click: function(n) {
198
+ n.stopPropagation();
199
+ } } }, [a.dropdown ? o(e.BentoDropdown, a._b({ ref: "inputDropdownElement", attrs: { id: e.dropdownId, disabled: a.disabled, readonly: e.isDropdownReadOnly }, on: { "update:model-value": e.onDropdownInput } }, "bento-dropdown", e.inputFieldDropdownProps, !1)) : a._e()], 1) : a._e()], 1), e.shouldShowError && a.errorMessage ? o(e.ErrorMessage, { staticClass: "b-input-field__error-message", attrs: { id: e.errorId, "error-message": a.errorMessage } }) : a._e(), e.hasSlot("description") || a.description ? o("span", { staticClass: "b-input-field__description", attrs: { id: e.descriptionId }, on: { click: e.focusInput } }, [o(e.BentoTypography, { attrs: { el: "span", variant: "body" } }, [a._t("description", function() {
200
+ return [a._v(" " + a._s(a.description) + " ")];
201
+ }, { id: "description" })], 2)], 1) : a._e()], 1);
202
+ }, Ne = [], Oe = /* @__PURE__ */ Fe(
203
+ Se,
204
+ Ce,
205
+ Ne,
206
+ !1,
207
+ null,
208
+ "31db9892"
209
+ );
210
+ const Je = Oe.exports;
211
+ export {
212
+ Je as B,
213
+ l as a,
214
+ Ie as b,
215
+ _ as c,
216
+ A as d,
217
+ d as e
218
+ };
219
+ //# sourceMappingURL=input-field.BgzXEyxn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input-field.BgzXEyxn.js","sources":["../../src/components/input-field/input-field.types.ts","../../src/components/input-field/input-field.vue"],"sourcesContent":["import { type BentoDropdownProps } from '../dropdown/dropdown.types';\nimport { type FormField } from '../../types/form-field';\n\n/**\n * @deprecated Since v2.0.0. Use string literal instead.\n */\nexport enum BentoInputFieldVariant {\n DEFAULT = 'default',\n PAYMENT_METHOD = 'payment-method',\n STATIC_VALUE = 'static-value',\n DROPDOWN = 'dropdown',\n}\n\n/**\n * @deprecated Since v2.0.0. Use string literal instead.\n */\nexport enum BentoInputFieldElementPosition {\n START = 'start',\n END = 'end',\n}\n\nexport enum BentoInputFieldStateClass {\n CONDENSED = 'condensed',\n DISABLED = 'disabled',\n READONLY = 'readonly',\n ERROR = 'error',\n}\n\n/**\n * @deprecated Since v2.0.0. Use string literal instead.\n */\nexport enum BentoInputFieldType {\n SEARCH = 'search',\n TEXT = 'text',\n NUMBER = 'number',\n}\n\nexport type BentoInputFieldValue = string | number;\n\ntype DropdownProps = BentoDropdownProps;\nexport interface BentoInputDropdownProps {\n /**\n * Text that labels the dropdown element\n */\n 'aria-label'?: string;\n /**\n * Enables dynamic filtering\n */\n dynamicFiltering?: DropdownProps['dynamicFiltering'];\n /**\n * List of available items\n */\n items: DropdownProps['items'];\n /**\n * Sets the dropdown in read-only mode\n */\n readonly?: DropdownProps['readonly'];\n /**\n * Selected value of the dropdown\n * @deprecated Since v2.0.0. Use `model-value` instead.\n */\n value?: DropdownProps['value'];\n /**\n * Selected value of the dropdown\n */\n modelValue?: DropdownProps['modelValue'];\n}\n\n/**\n * @deprecated Since v2.0.0. Use `@<emit name>` instead.\n */\nexport enum BentoInputFieldEvent {\n INPUT = 'input',\n ESCAPE_PRESSED = 'escape-pressed',\n UPDATE_DROPDOWN = 'update:dropdown',\n DROPDOWN_INPUT = 'dropdown-input',\n FOCUS = 'focus',\n CHANGE = 'change',\n BLUR = 'blur',\n KEYDOWN = 'keydown',\n}\n\nexport interface BentoInputFieldProps extends FormField {\n /**\n * Indicates whether the element is exposed to an accessibility API.\n */\n ariaHidden?: boolean;\n\n /**\n * Text that labels an the input element\n *\n * @deprecated Since v2.0.0. Use `aria-label` instead.\n */\n ariaLabel?: string;\n\n /**\n * Reduces height of the input\n */\n condensed?: boolean;\n\n /**\n * Dropdown props for the small selectable dropdown menu.\n * Properties supported:\n *\n * - `aria-label`: Text that labels the dropdown element\n * - `dynamicFiltering`: Enables dynamic filtering\n * - `items`: List of available items\n * - `readonly`: Sets the dropdown in read-only mode\n * - `value`: Selected value of the dropdown\n */\n dropdown?: BentoInputDropdownProps;\n\n /**\n * Position of the dropdown before or after input value\n */\n dropdownPosition?: BentoInputFieldElementPosition | `${BentoInputFieldElementPosition}`;\n\n /**\n * Adds error validation class for outlining input-field.\n *\n * @deprecated Since v2.0.0. Use `errorMessage` instead.\n */\n error?: boolean;\n\n /**\n * Text displayed as the value of the input-field\n */\n modelValue?: BentoInputFieldValue;\n\n /**\n * Renders a font numeric style with slashed zeros instead of normal ones.\n */\n slashedZero?: boolean;\n\n /**\n * Static text that displayed before or after input value\n * Applicable to the Static Value variant\n */\n staticValue?: string;\n\n /**\n * Position of Static Value before or after input value\n */\n staticValuePosition?: BentoInputFieldElementPosition | `${BentoInputFieldElementPosition}`;\n\n /**\n * A string specifying the type of control to render.\n * All `input` types are available but only `search`, `text` and `number` are fully supported.\n *\n * If `type` is `search`, use `bento-search-bar` instead.\n */\n type?: BentoInputFieldType | `${BentoInputFieldType}` | HTMLInputElement['type'];\n\n /**\n * Text displayed as the value of the input-field\n * @deprecated Since v2.0.0. Use `v-model` or `model-value` instead.\n */\n value?: BentoInputFieldValue;\n\n /**\n * Describes the different variants for the input element\n */\n variant?: BentoInputFieldVariant | `${BentoInputFieldVariant}`;\n}\n","<template>\n <bento-typography\n class=\"b-input-field\"\n v-bind=\"getRootAttributes($attrs)\"\n :data-testid=\"getDataTestId($attrs)\"\n :class=\"inputFieldConditionalClasses\"\n el=\"div\"\n variant=\"body\"\n >\n <field-label\n v-if=\"hasSlot('default') || label\"\n :for=\"inputFieldId\"\n data-testid=\"input-field-label\"\n :tooltip-text=\"tooltipText\"\n :optional=\"optional\"\n :required=\"required\"\n :label=\"label\"\n @click=\"focusInput\"\n >\n <slot></slot>\n </field-label>\n\n <div class=\"b-input-field__input-box\" data-testid=\"input-box\" :aria-disabled=\"disabled\" @click=\"focusInput\">\n <!-- Optional Icon for Default text variant -->\n <span\n v-if=\"isDefaultVariant && (hasSlot('defaultIconBefore') || hasSlot('iconBefore'))\"\n :aria-hidden=\"ariaHidden ? 'true' : undefined\"\n class=\"b-input-field__icon-before\"\n >\n <slot v-if=\"hasSlot('iconBefore')\" name=\"iconBefore\" />\n <slot v-if=\"hasSlot('defaultIconBefore') && !hasSlot('iconBefore')\" name=\"defaultIconBefore\" />\n </span>\n\n <!-- Mandatory Icon for Payment Method variant -->\n <span\n v-if=\"isPaymentMethodVariant && hasSlot('paymentMethod')\"\n :aria-hidden=\"ariaHidden ? 'true' : undefined\"\n class=\"b-input-field__payment-method\"\n >\n <slot name=\"paymentMethod\" />\n </span>\n\n <!-- Dropdown at start -->\n <div\n v-if=\"shouldDisplayDropdownAtStart\"\n :id=\"dropdownId\"\n class=\"b-input-field__dropdown b-input-field__dropdown--start\"\n @click.stop\n >\n <bento-dropdown\n v-if=\"dropdown\"\n ref=\"inputDropdownElement\"\n v-bind=\"inputFieldDropdownProps\"\n :disabled=\"disabled\"\n :readonly=\"isDropdownReadOnly\"\n @update:model-value=\"onDropdownInput\"\n />\n </div>\n\n <!-- Static Value at start -->\n <bento-typography\n v-if=\"shouldDisplayStaticValueAtStart\"\n :id=\"staticValueId\"\n class=\"b-input-field__static-value b-input-field__static-value--start\"\n el=\"span\"\n variant=\"body\"\n >\n <slot name=\"staticValue\" />\n </bento-typography>\n <div class=\"b-input-field__input-container\">\n <input\n :id=\"inputFieldId\"\n v-bind=\"$attrs\"\n ref=\"inputFieldElement\"\n class=\"b-input-field__input\"\n :aria-label=\"computedAriaLabel\"\n :aria-describedby=\"computedAriaDescribedBy\"\n :aria-owns=\"computedAriaOwns\"\n :aria-invalid=\"shouldShowError\"\n :placeholder=\"placeholder\"\n :required=\"required\"\n :aria-required=\"required\"\n :type=\"type\"\n :value=\"modelValue ?? value\"\n :disabled=\"disabled\"\n :readonly=\"isReadOnly\"\n @input=\"onInput\"\n @change=\"emit('change')\"\n @focus=\"onFocus\"\n @blur=\"onBlur\"\n @keydown=\"emit('keydown', $event)\"\n @keyup=\"emit('keyup', $event)\"\n @keydown.esc=\"emit('escape-pressed')\"\n @click=\"emit('click', $event)\"\n />\n\n <!-- Hint at the end -->\n <bento-typography\n v-if=\"hint && isFocused && (modelValue || value)\"\n el=\"span\"\n class=\"b-input-field__hint\"\n >\n {{ hint }}\n </bento-typography>\n </div>\n\n <span\n v-if=\"hasSlot('iconAfter')\"\n :aria-hidden=\"ariaHidden ? 'true' : undefined\"\n class=\"b-input-field__icon-after\"\n data-testid=\"input-text__icon-after\"\n >\n <slot name=\"iconAfter\" />\n </span>\n\n <!-- Static Value at the end -->\n <bento-typography\n v-if=\"shouldDisplayStaticValueAtEnd\"\n :id=\"staticValueId\"\n class=\"b-input-field__static-value b-input-field__static-value--end\"\n el=\"span\"\n variant=\"body\"\n >\n <slot name=\"staticValue\" />\n </bento-typography>\n\n <!-- Dropdown at end -->\n <div\n v-if=\"shouldDisplayDropdownAtEnd\"\n :id=\"dropdownId\"\n data-testid=\"input-field-dropdown-container-end\"\n class=\"b-input-field__dropdown b-input-field__dropdown--end\"\n @click.stop\n >\n <bento-dropdown\n v-if=\"dropdown\"\n :id=\"dropdownId\"\n ref=\"inputDropdownElement\"\n v-bind=\"inputFieldDropdownProps\"\n :disabled=\"disabled\"\n :readonly=\"isDropdownReadOnly\"\n @update:model-value=\"onDropdownInput\"\n />\n </div>\n </div>\n\n <error-message\n v-if=\"shouldShowError && !!errorMessage\"\n :id=\"errorId\"\n :error-message=\"errorMessage\"\n class=\"b-input-field__error-message\"\n />\n\n <span\n v-if=\"hasSlot('description') || description\"\n :id=\"descriptionId\"\n class=\"b-input-field__description\"\n @click=\"focusInput\"\n >\n <bento-typography el=\"span\" variant=\"body\">\n <slot id=\"description\" name=\"description\">\n {{ description }}\n </slot>\n </bento-typography>\n </span>\n </bento-typography>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, inject, provide, type Ref, ref, toRef, toRefs, useAttrs, useSlots } from 'vue';\n\n // Components\n import { BentoDropdown } from '@/components/dropdown';\n import { BentoTypography } from '@/components/typography';\n import { ErrorMessage, FieldLabel } from '@/internal';\n\n // Utils\n import { deprecate } from '@/utils/ts/deprecate';\n import { useFormFieldEmits } from '@/utils/ts/form-field/form-field';\n import { generateUid } from '@/core/utils/ts';\n import { getSlotText } from '@/utils/ts/get-slot-text';\n import { useAriaLabel } from '@/utils/ts/aria-label';\n import { useI18n } from '@/utils/ts/i18n';\n import { printDevelopmentWarning } from '@/utils/ts/print-development-warning';\n import {\n INPUT_FIELD_COMPONENT_INJECTION_KEY,\n INPUT_FIELD_HINT_INJECTION_KEY,\n INPUT_FIELD_PARENT_COMPONENT_INJECTION_KEY,\n } from '@/components/input-field/input-field.keys';\n import { type BentoListboxSelectedValue } from '@/types/listbox';\n\n // Composables\n import { useFormLayoutFieldLoading, useHasSlot } from '@/composables';\n\n // Types\n import {\n type BentoInputDropdownProps,\n BentoInputFieldElementPosition,\n type BentoInputFieldProps,\n BentoInputFieldStateClass,\n BentoInputFieldType,\n type BentoInputFieldValue,\n BentoInputFieldVariant,\n } from './input-field.types';\n\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const attrs = useAttrs();\n const slots = useSlots();\n\n const props = defineProps({\n description: { default: '' },\n disabled: { type: Boolean, default: false },\n errorMessage: { default: null },\n label: { default: '' },\n optional: { type: Boolean, default: false },\n placeholder: { default: '' },\n readonly: { type: Boolean, default: false },\n required: { type: Boolean, default: false },\n tooltipText: { default: null },\n ariaHidden: { type: Boolean, default: true },\n ariaLabel: { default: undefined },\n condensed: { type: Boolean, default: false },\n dropdown: { default: undefined },\n dropdownPosition: { default: BentoInputFieldElementPosition.START },\n error: { type: Boolean, default: false },\n modelValue: { default: undefined },\n slashedZero: { type: Boolean, default: false },\n staticValue: { default: '' },\n staticValuePosition: { default: BentoInputFieldElementPosition.START },\n type: { default: BentoInputFieldType.TEXT },\n value: { default: undefined },\n variant: { default: BentoInputFieldVariant.DEFAULT }\n});\n\n const emit = defineEmits([\"blur\", \"click\", \"change\", \"dropdown-input\", \"escape-pressed\", \"focus\", \"keydown\", \"keyup\", \"input\", \"update:dropdown\", \"update:model-value\"]);\n\n const { emitValue } = useFormFieldEmits<BentoInputFieldValue>(emit);\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const hasSlot = useHasSlot(slots);\n const inputFieldElement = ref(null);\n const inputDropdownElement = ref(null);\n const inputFieldId = generateUid('input');\n const dropdownId = generateUid('input-dropdown');\n const staticValueId = generateUid('input-static-value');\n const descriptionId = generateUid('input-description');\n const errorId = generateUid('input-error');\n const isFocused = ref(false);\n\n /**\n * Gets the overriden or the default data-testid attribute\n * @param attributes - the live attributes object\n */\n function getDataTestId(attributes: Record<string, unknown>) {\n return (attributes['data-testid'] as string) ?? 'input-text-container';\n }\n /**\n * Filters out all aria attributes for the root element.\n * @param attributes - the live attributes object\n */\n function getRootAttributes(attributes: Record<string, unknown>) {\n return Object.fromEntries(\n Object.entries(attributes).filter(([key]) => !key.startsWith('aria-') && key !== 'data-testid')\n );\n }\n\n // Provide INPUT_FIELD_COMPONENT_INJECTION_KEY as true, to set the input only dropdown size variant in the BentoDropdown comp\n provide(INPUT_FIELD_COMPONENT_INJECTION_KEY, true);\n // Renders the input with a hint if a string is provided\n const hint = inject<Ref<string | undefined>>(INPUT_FIELD_HINT_INJECTION_KEY, ref(undefined));\n\n const onFocus = () => {\n isFocused.value = true;\n emit('focus');\n };\n\n const onBlur = () => {\n isFocused.value = false;\n emit('blur');\n };\n\n const { isReadOnly } = useFormLayoutFieldLoading(toRef(props, 'readonly'));\n const isDropdownReadOnly = computed<BentoInputDropdownProps['readonly']>(\n () => isReadOnly.value || props.dropdown?.readonly\n );\n\n const shouldShowStaticValue = computed(\n () => props.variant === BentoInputFieldVariant.STATIC_VALUE && !!slots.staticValue\n );\n\n const isDefaultVariant = computed(() => props.variant === BentoInputFieldVariant.DEFAULT);\n\n const isPaymentMethodVariant = computed(() => props.variant === BentoInputFieldVariant.PAYMENT_METHOD);\n\n const shouldDisplayStaticValueAtStart = computed(\n () => shouldShowStaticValue.value && props.staticValuePosition === BentoInputFieldElementPosition.START\n );\n const shouldDisplayStaticValueAtEnd = computed(\n () => shouldShowStaticValue.value && props.staticValuePosition === BentoInputFieldElementPosition.END\n );\n\n const shouldShowDropdown = computed(() => props.variant === BentoInputFieldVariant.DROPDOWN && !!props.dropdown);\n const shouldDisplayDropdownAtStart = computed(\n () => shouldShowDropdown.value && props.dropdownPosition === BentoInputFieldElementPosition.START\n );\n const shouldDisplayDropdownAtEnd = computed(\n () => shouldShowDropdown.value && props.dropdownPosition === BentoInputFieldElementPosition.END\n );\n\n const shouldShowError = computed(\n () => !props.disabled && !isReadOnly.value && (!!props.errorMessage || props.error)\n );\n\n const computedLabel = computed(() => (getSlotText(slots)('default') as string) || props.label);\n const computedDescription = computed(() => (getSlotText(slots)('description') as string) || props.description);\n\n const computedAriaOwns = computed(() => {\n if (shouldShowDropdown.value === true && shouldShowStaticValue.value === true) {\n return `${staticValueId} ${dropdownId}`;\n }\n if (shouldShowDropdown.value === true) {\n return `${dropdownId}`;\n }\n if (shouldShowStaticValue.value === true) {\n return `${staticValueId}`;\n }\n return null;\n });\n\n // vue-i18n issue with t() used in script - direct usage in template works\n // requires either createI18n({ legacy: false }) or to be wrapped in computed()\n const computedAriaLabelFallbackMessage = computed(() =>\n attrs?.['aria-labelledby'] ? undefined : t('ariaLabelFallback')\n );\n const computedAriaLabelDropdowFallback = computed(() =>\n t('ariaLabelDropdownFallback', { inputLabel: computedAriaLabel.value })\n );\n\n const ariaLabelAttribute = ref(attrs['aria-label']);\n const { ariaLabel } = toRefs(props);\n const computedAriaLabel = useAriaLabel({\n ariaLabel: ariaLabelAttribute.value as string,\n // TODO: take this line away when the aria-label props is removed\n label: ariaLabel,\n defaultFallback: computedLabel.value || computedAriaLabelFallbackMessage,\n });\n\n const computedAriaDescribedBy = computed(\n () =>\n `${computedDescription.value ? descriptionId : ''} ${\n shouldShowError.value && !!props.errorMessage ? errorId : ''\n }`\n );\n\n const inputFieldConditionalClasses = computed(() => ({\n [`b-input-field--${BentoInputFieldStateClass.CONDENSED}`]: props.condensed,\n [`b-input-field--${BentoInputFieldStateClass.DISABLED}`]: props.disabled,\n [`b-input-field--${BentoInputFieldStateClass.READONLY}`]: isReadOnly.value,\n [`b-input-field--${BentoInputFieldStateClass.ERROR}`]: shouldShowError.value,\n [`b-input-field--slashed-zero`]: props.slashedZero,\n }));\n\n const inputFieldDropdownProps = computed(() => ({\n 'aria-label': computedAriaLabelDropdowFallback.value,\n ...props.dropdown,\n }));\n\n const onInput = (event: Event) => {\n const inputValue = (event.target as HTMLInputElement).value;\n if (!props.disabled && !isReadOnly.value) {\n emitValue(inputValue);\n }\n };\n\n const onDropdownInput = (selectedValue: BentoListboxSelectedValue) => {\n emit('dropdown-input', selectedValue);\n emit('update:dropdown', { ...props?.dropdown, value: selectedValue });\n };\n\n const focusInput = () => {\n inputFieldElement.value.focus();\n };\n\n const focus = () => {\n if (props.variant === 'dropdown') {\n inputDropdownElement.value.focus();\n } else {\n focusInput();\n }\n };\n\n // Expose method so that other components can focus on it in Vue3\n defineExpose({\n focusInput,\n focus,\n });\n\n const inputFieldParentComponent = inject(INPUT_FIELD_PARENT_COMPONENT_INJECTION_KEY, '');\n\n if (!Object.values(BentoInputFieldType).includes(props.type as BentoInputFieldType) && !inputFieldParentComponent) {\n if (props.type === 'tel') {\n printDevelopmentWarning(\n `\"bento-input-field\" dropdown does not support the type '${props.type}', use \"bento-input-field-phone-number\" instead.`\n );\n } else if (props.type === 'password') {\n printDevelopmentWarning(\n `\"bento-input-field\" dropdown does not support the type '${props.type}', use \"bento-input-field-password\" instead.`\n );\n } else {\n printDevelopmentWarning(`\"bento-input-field\" dropdown does not support the type '${props.type}'`);\n }\n }\n\n /**\n * Deprecations\n */\n if (props.error) {\n deprecate(\n 'BentoInputField \"error\" property',\n `Use the BentoInputField \"errorMessage\" property instead to indicate that there is a modifier error.\n Having the field as \"undefined\" will hide/remove the error.\n <bento-dropdown errorMessage=\"Error message text\" />`,\n '2.0.0'\n );\n }\n\n if (hasSlot('defaultIconBefore')) {\n deprecate(\n 'BentoInputField \"defaultIconBefore\" slot',\n `Use the BentoInputField \"iconBefore\" slot instead to add an icon at the left side of the input field\n <bento-input-field>\n \\t<template #iconBefore>\n \\t\\t<my-icon-goes-here />\n \\t</template>\n </bento-input-field>`,\n '2.0.0'\n );\n }\n\n if (props.value) {\n deprecate(\n 'BentoInputField \"value\" property',\n `The use of \"value\" prop in \"BentoInputField\" is no longer supported.\n Use the \"v-model\" or \"model-value\" property instead.`,\n '2.0.0'\n );\n }\n</script>\n\n<script lang=\"ts\">\n /**\n * Input field component is used to create interactive controls for web-based\n * forms in order to accept data from the user.\n *\n * @example\n * import { BentoInputField } from '@adyen/bento-vue2'\n *\n * const inputValue = ref('');\n *\n * export default {\n * components: { BentoInputField },\n * tempate: `\n * <bento-input-field\n * :model-value=\"inputValue\"\n * :@update:model-value=\"newValue => inputValue.value = newValue\"\n * >\n * }\n */\n export default {\n name: 'bento-input-field',\n inheritAttrs: false,\n model: { prop: 'modelValue' },\n i18n: { messages },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./input-field.scss\" />\n"],"names":["BentoInputFieldVariant","BentoInputFieldVariant2","BentoInputFieldElementPosition","BentoInputFieldElementPosition2","BentoInputFieldStateClass","BentoInputFieldStateClass2","BentoInputFieldType","BentoInputFieldType2","BentoInputFieldEvent","BentoInputFieldEvent2","__default__","messages","attrs","useAttrs","slots","useSlots","emitValue","useFormFieldEmits","emit","t","useI18n","hasSlot","useHasSlot","inputFieldElement","ref","inputDropdownElement","inputFieldId","generateUid","dropdownId","staticValueId","descriptionId","errorId","isFocused","getDataTestId","attributes","getRootAttributes","key","provide","INPUT_FIELD_COMPONENT_INJECTION_KEY","hint","inject","INPUT_FIELD_HINT_INJECTION_KEY","onFocus","onBlur","isReadOnly","useFormLayoutFieldLoading","toRef","props","isDropdownReadOnly","computed","_a","shouldShowStaticValue","isDefaultVariant","isPaymentMethodVariant","shouldDisplayStaticValueAtStart","shouldDisplayStaticValueAtEnd","shouldShowDropdown","shouldDisplayDropdownAtStart","shouldDisplayDropdownAtEnd","shouldShowError","computedLabel","getSlotText","computedDescription","computedAriaOwns","computedAriaLabelFallbackMessage","computedAriaLabelDropdowFallback","computedAriaLabel","ariaLabelAttribute","ariaLabel","toRefs","useAriaLabel","computedAriaDescribedBy","inputFieldConditionalClasses","inputFieldDropdownProps","onInput","event","inputValue","onDropdownInput","selectedValue","focusInput","focus","expose","inputFieldParentComponent","INPUT_FIELD_PARENT_COMPONENT_INJECTION_KEY","printDevelopmentWarning","deprecate"],"mappings":";;;;;;;;;;;;;;AAMO,IAAAA,IAAA,kBAAAC,OACHA,EAAA,UAAA,WACAA,EAAA,iBAAA,kBACAA,EAAA,eAAA,gBACAA,EAAA,WAAA,YAJQA,IAAAD,KAAA,CAAA,CAAA,GAULE,IAAA,kBAAAC,OACHA,EAAA,QAAA,SACAA,EAAA,MAAA,OAFQA,IAAAD,KAAA,CAAA,CAAA,GAKLE,IAAA,kBAAAC,OACHA,EAAA,YAAA,aACAA,EAAA,WAAA,YACAA,EAAA,WAAA,YACAA,EAAA,QAAA,SAJQA,IAAAD,KAAA,CAAA,CAAA,GAULE,IAAA,kBAAAC,OACHA,EAAA,SAAA,UACAA,EAAA,OAAA,QACAA,EAAA,SAAA,UAHQA,IAAAD,KAAA,CAAA,CAAA,GAwCLE,KAAA,kBAAAC,OACHA,EAAA,QAAA,SACAA,EAAA,iBAAA,kBACAA,EAAA,kBAAA,mBACAA,EAAA,iBAAA,kBACAA,EAAA,QAAA,SACAA,EAAA,SAAA,UACAA,EAAA,OAAA,QACAA,EAAA,UAAA,WARQA,IAAAD,MAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GC+YRE,KAAA;AAAA,EAAe,MAAA;AAAA,EACL,cAAA;AAAA,EACQ,OAAA,EAAA,MAAA,aAAA;AAAA,EACc,MAAA,EAAA,UAAAC,GAAA;AAEhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA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A,KAAA,CAAAmC,MACInC,EAAA,SAAA,QACIqC;AAAA,MAAA,2DAAArC,EAAA,IAAA;AAAA,IACyE,IACzEA,EAAA,SAAA,aAEAqC;AAAA,MAAA,2DAAArC,EAAA,IAAA;AAAA,IACyE,IAGzEqC,EAAA,2DAAArC,EAAA,IAAA,GAAA,IAORA,EAAA,SACIsC;AAAA,MAAA;AAAA,MACI;AAAA;AAAA;AAAA,MACA;AAAA,IAGA,GAIRhE,EAAA,mBAAA,KACIgE;AAAA,MAAA;AAAA,MACI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MACA;AAAA,IAMA,GAIRtC,EAAA,SACIsC;AAAA,MAAA;AAAA,MACI;AAAA;AAAA,MACA;AAAA,IAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as S, provide as y, useSlots as D, ref as g, computed as l, watch as h } from "vue";
2
- import { B as H } from "./input-field.CGLjYab8.js";
2
+ import { B as H } from "./input-field.BgzXEyxn.js";
3
3
  import { c as I } from "./dropdown.BYJwx-JD.js";
4
4
  import { d as b } from "./use-cached-selected-values.Du8-wWR2.js";
5
5
  import { u as B } from "./index.B6WW_F-J.js";
@@ -132,4 +132,4 @@ export {
132
132
  Q as B,
133
133
  f as i
134
134
  };
135
- //# sourceMappingURL=input-time.BhAUyKZM.js.map
135
+ //# sourceMappingURL=input-time.CF2kTtAp.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"input-time.BhAUyKZM.js","sources":["../../src/utils/ts/time-input.ts","../../src/components/input-time/input-time.vue"],"sourcesContent":["const validDigitRegex = /[\\d]/;\n\nconst hourRegex = /^\\d{2}$/;\nconst minuteRegex = /^\\d{2}:\\d{2}$/;\n\n/**\n * Validates a complete time string in HH:MM:SS format.\n * Hours: 00-24, Minutes: 00-59, Seconds: 00-59\n * @param timeText The time string to validate\n * @returns True if the time string is valid, false otherwise\n */\nexport const isValidTimeString = (timeText: string): boolean =>\n /^(?:[01]\\d|2[0-4]):(?:[0-5]\\d):(?:[0-5]\\d)$/.test(timeText);\n\nexport const validateTimeInput = (event: KeyboardEvent) => {\n const { selectionStart } = event.target as HTMLInputElement;\n\n const allowedKeys = ['Backspace', 'Tab', 'ArrowLeft', 'ArrowRight'];\n const isValidKey = validDigitRegex.test(event.key) || allowedKeys.includes(event.key);\n const isValidColon = [1, 2, 4, 5].includes(selectionStart) && event.key === ':';\n\n if (!isValidKey && !isValidColon) {\n event.preventDefault();\n }\n};\n\nexport const formatTimeInputValue = (value: string) => {\n if (!value) {\n return value;\n }\n\n let formattedValue = value;\n\n // Format if the first value is bigger than 2, because it can't be bigger than 24 hours\n if (formattedValue.length === 1 && parseInt(value, 10) > 2) {\n return `0${formattedValue}:`;\n }\n\n const [secondToLastDigit, lastDigit] = formattedValue.slice(-2);\n if ([2, 5].includes(formattedValue.length) && lastDigit === ':') {\n formattedValue = `${formattedValue.slice(0, formattedValue.length - 2)}0${secondToLastDigit}`;\n }\n\n // Add `:` after hour/minute\n if (hourRegex.test(formattedValue) || minuteRegex.test(formattedValue)) {\n formattedValue += ':';\n }\n return formattedValue;\n};\n","<template>\n <bento-input-field\n class=\"b-input-time\"\n :type=\"inputType\"\n :step=\"isTouchDevice ? 1 : undefined\"\n :condensed=\"props.condensed\"\n :disabled=\"props.disabled\"\n :error-message=\"inputErrorMessage\"\n :label=\"props.label\"\n :model-value=\"inputModelValue\"\n :optional=\"props.optional\"\n :placeholder=\"computedPlaceholder\"\n :readonly=\"props.readonly\"\n :required=\"props.required\"\n :tooltip-text=\"props.tooltipText\"\n v-bind=\"$attrs\"\n @update:model-value=\"onInput\"\n @keydown=\"onKeyDown\"\n >\n <template v-if=\"hasSlot('default')\" #default>\n <slot name=\"default\"></slot>\n </template>\n <template v-if=\"!isTouchDevice\" #description>\n <slot name=\"description\">{{\n props.description ? `${props.description} ${t('timeFormatDescription')}` : t('timeFormatDescription')\n }}</slot>\n </template>\n </bento-input-field>\n</template>\n\n<script setup lang=\"ts\">\n // Components\n import { BentoInputField } from '@/components/input-field';\n import { INPUT_FIELD_PARENT_COMPONENT_INJECTION_KEY } from '@/components/input-field/input-field.keys';\n\n // Utils\n import { debounce } from '@/utils/ts/debounce';\n import { useI18n } from '@/utils/ts/i18n';\n import { formatTimeInputValue, isValidTimeString, validateTimeInput } from '@/utils/ts/time-input';\n\n // Types\n import type { BentoInputFieldValue } from '@/components/input-field/input-field.types';\n import { type BentoInputTimeProps } from './input-time.types';\n\n // Localization\n import messages from './messages.json';\n\n import { computed, provide, ref, useSlots, watch } from 'vue';\n import { useHasSlot, useTouchDevice } from '@/composables';\n\n const VALIDATION_DEBOUNCE_TIME = 300;\n\n provide(INPUT_FIELD_PARENT_COMPONENT_INJECTION_KEY, 'bento-input-time');\n\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n const { isTouchDevice } = useTouchDevice();\n\n type MessageSchema = (typeof messages)['en-US'];\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const props = defineProps({\n description: { default: undefined },\n disabled: { type: Boolean, default: false },\n errorMessage: { default: null },\n label: { default: '' },\n optional: { type: Boolean, default: false },\n placeholder: { default: '' },\n readonly: { type: Boolean, default: false },\n required: { type: Boolean, default: false },\n tooltipText: { default: null },\n condensed: { type: Boolean, default: false },\n modelValue: { default: undefined }\n});\n\n const emit = defineEmits([\"update:model-value\", \"keydown\", \"input:valid\", \"input:error\"]);\n\n const internalError = ref(false);\n const computedErrorMessage = computed(() => {\n if (props.errorMessage) {\n return props.errorMessage;\n }\n return internalError.value ? t('invalidTimeFormat') : null;\n });\n const inputErrorMessage = computed(() => (isTouchDevice.value ? props.errorMessage : computedErrorMessage.value));\n const inputType = computed(() => (isTouchDevice.value ? 'time' : undefined));\n const inputModelValue = computed(() => props.modelValue);\n const computedPlaceholder = computed(() => (isTouchDevice ? undefined : props.placeholder));\n\n const validateTime = (timeText: string) => {\n if (!timeText) {\n internalError.value = false;\n return;\n }\n\n const isValid = isValidTimeString(timeText);\n internalError.value = !isValid;\n\n if (isValid) {\n emit('input:valid');\n } else {\n emit('input:error');\n }\n };\n const validateTimeWithDebounce = debounce(validateTime, VALIDATION_DEBOUNCE_TIME);\n\n // Watch for external modelValue changes (e.g., when parent resets the value)\n watch(\n () => props.modelValue,\n newValue => {\n const timeText = String(newValue ?? '');\n // Clear the error only when the new value is a complete, valid time string\n if (timeText.length === 8 && isValidTimeString(timeText)) {\n internalError.value = false;\n }\n }\n );\n\n const onInput = (value: BentoInputFieldValue) => {\n if (props.disabled || props.readonly) {\n return;\n }\n\n if (isTouchDevice.value) {\n emit('update:model-value', String(value ?? ''));\n emit('input:valid');\n } else {\n const formatted = formatTimeInputValue(String(value ?? ''));\n emit('update:model-value', formatted);\n validateTimeWithDebounce(formatted);\n }\n };\n\n const onKeyDown = (event: KeyboardEvent) => {\n if (!isTouchDevice.value) {\n validateTimeInput(event);\n }\n emit('keydown', event);\n };\n</script>\n\n<script lang=\"ts\">\n /**\n * Input time component for entering time values in HH:MM:SS format.\n * This is an extension of the `bento-input-field` component with built-in\n * time formatting and validation logic.\n *\n * @usage\n * import { BentoInputTime } from '@adyen/bento-vue2';\n *\n * const timeValue = ref('');\n *\n * export default {\n * components: { BentoInputTime },\n * template: `\n * <bento-input-time\n * label=\"Start time\"\n * :model-value=\"timeValue\"\n * @update:model-value=\"newValue => timeValue.value = newValue\"\n * />\n * `\n * }\n */\n export default {\n i18n: { messages },\n name: 'bento-input-time',\n inheritAttrs: false,\n model: { prop: 'modelValue' },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./input-time.scss\" />\n"],"names":["validDigitRegex","hourRegex","minuteRegex","isValidTimeString","timeText","validateTimeInput","event","selectionStart","allowedKeys","isValidKey","isValidColon","formatTimeInputValue","value","formattedValue","secondToLastDigit","lastDigit","__default__","messages","VALIDATION_DEBOUNCE_TIME","provide","INPUT_FIELD_PARENT_COMPONENT_INJECTION_KEY","slots","useSlots","hasSlot","useHasSlot","isTouchDevice","useTouchDevice","t","useI18n","internalError","ref","computedErrorMessage","computed","props","inputErrorMessage","inputType","inputModelValue","computedPlaceholder","validateTime","isValid","emit","validateTimeWithDebounce","debounce","watch","newValue","formatted"],"mappings":";;;;;;;;;AAAA,MAAAA,IAAA,QAEAC,IAAA,WACAC,IAAA,iBAQOC,IAAA,CAAAC,MAAA,8CAAA,KAAAA,CAAA,GAGAC,IAAA,CAAAC,MAAA;AACH,QAAA,EAAA,gBAAAC,EAAA,IAAAD,EAAA,QAEAE,IAAA,CAAA,aAAA,OAAA,aAAA,YAAA,GACAC,IAAAT,EAAA,KAAAM,EAAA,GAAA,KAAAE,EAAA,SAAAF,EAAA,GAAA,GACAI,IAAA,CAAA,GAAA,GAAA,GAAA,CAAA,EAAA,SAAAH,CAAA,KAAAD,EAAA,QAAA;AAEA,EAAA,CAAAG,KAAA,CAAAC,KACIJ,EAAA,eAAA;AAER,GAEOK,IAAA,CAAAC,MAAA;AACH,MAAA,CAAAA;AACI,WAAAA;AAGJ,MAAAC,IAAAD;AAGA,MAAAC,EAAA,WAAA,KAAA,SAAAD,GAAA,EAAA,IAAA;AACI,WAAA,IAAAC,CAAA;AAGJ,QAAA,CAAAC,GAAAC,CAAA,IAAAF,EAAA,MAAA,EAAA;AACA,SAAA,CAAA,GAAA,CAAA,EAAA,SAAAA,EAAA,MAAA,KAAAE,MAAA,QACIF,IAAA,GAAAA,EAAA,MAAA,GAAAA,EAAA,SAAA,CAAA,CAAA,IAAAC,CAAA,MAIJb,EAAA,KAAAY,CAAA,KAAAX,EAAA,KAAAW,CAAA,OACIA,KAAA,MAEJA;AACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GCmHIG,IAAA;AAAA,EAAe,MAAA,EAAA,UAAAC,EAAA;AAAA,EACM,MAAA;AAAA,EACX,cAAA;AAAA,EACQ,OAAA,EAAA,MAAA,aAAA;AAElB;;;;;;;;;;;;;;;;;iBAtHAC,IAAA;AAEA,IAAAC,EAAAC,GAAA,kBAAA;AAEA,UA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B,EAAAC,CAAA,GAEJkC,EAAA,WAAAlC,CAAA;AAAA,IAAqB;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"input-time.CF2kTtAp.js","sources":["../../src/utils/ts/time-input.ts","../../src/components/input-time/input-time.vue"],"sourcesContent":["const validDigitRegex = /[\\d]/;\n\nconst hourRegex = /^\\d{2}$/;\nconst minuteRegex = /^\\d{2}:\\d{2}$/;\n\n/**\n * Validates a complete time string in HH:MM:SS format.\n * Hours: 00-24, Minutes: 00-59, Seconds: 00-59\n * @param timeText The time string to validate\n * @returns True if the time string is valid, false otherwise\n */\nexport const isValidTimeString = (timeText: string): boolean =>\n /^(?:[01]\\d|2[0-4]):(?:[0-5]\\d):(?:[0-5]\\d)$/.test(timeText);\n\nexport const validateTimeInput = (event: KeyboardEvent) => {\n const { selectionStart } = event.target as HTMLInputElement;\n\n const allowedKeys = ['Backspace', 'Tab', 'ArrowLeft', 'ArrowRight'];\n const isValidKey = validDigitRegex.test(event.key) || allowedKeys.includes(event.key);\n const isValidColon = [1, 2, 4, 5].includes(selectionStart) && event.key === ':';\n\n if (!isValidKey && !isValidColon) {\n event.preventDefault();\n }\n};\n\nexport const formatTimeInputValue = (value: string) => {\n if (!value) {\n return value;\n }\n\n let formattedValue = value;\n\n // Format if the first value is bigger than 2, because it can't be bigger than 24 hours\n if (formattedValue.length === 1 && parseInt(value, 10) > 2) {\n return `0${formattedValue}:`;\n }\n\n const [secondToLastDigit, lastDigit] = formattedValue.slice(-2);\n if ([2, 5].includes(formattedValue.length) && lastDigit === ':') {\n formattedValue = `${formattedValue.slice(0, formattedValue.length - 2)}0${secondToLastDigit}`;\n }\n\n // Add `:` after hour/minute\n if (hourRegex.test(formattedValue) || minuteRegex.test(formattedValue)) {\n formattedValue += ':';\n }\n return formattedValue;\n};\n","<template>\n <bento-input-field\n class=\"b-input-time\"\n :type=\"inputType\"\n :step=\"isTouchDevice ? 1 : undefined\"\n :condensed=\"props.condensed\"\n :disabled=\"props.disabled\"\n :error-message=\"inputErrorMessage\"\n :label=\"props.label\"\n :model-value=\"inputModelValue\"\n :optional=\"props.optional\"\n :placeholder=\"computedPlaceholder\"\n :readonly=\"props.readonly\"\n :required=\"props.required\"\n :tooltip-text=\"props.tooltipText\"\n v-bind=\"$attrs\"\n @update:model-value=\"onInput\"\n @keydown=\"onKeyDown\"\n >\n <template v-if=\"hasSlot('default')\" #default>\n <slot name=\"default\"></slot>\n </template>\n <template v-if=\"!isTouchDevice\" #description>\n <slot name=\"description\">{{\n props.description ? `${props.description} ${t('timeFormatDescription')}` : t('timeFormatDescription')\n }}</slot>\n </template>\n </bento-input-field>\n</template>\n\n<script setup lang=\"ts\">\n // Components\n import { BentoInputField } from '@/components/input-field';\n import { INPUT_FIELD_PARENT_COMPONENT_INJECTION_KEY } from '@/components/input-field/input-field.keys';\n\n // Utils\n import { debounce } from '@/utils/ts/debounce';\n import { useI18n } from '@/utils/ts/i18n';\n import { formatTimeInputValue, isValidTimeString, validateTimeInput } from '@/utils/ts/time-input';\n\n // Types\n import type { BentoInputFieldValue } from '@/components/input-field/input-field.types';\n import { type BentoInputTimeProps } from './input-time.types';\n\n // Localization\n import messages from './messages.json';\n\n import { computed, provide, ref, useSlots, watch } from 'vue';\n import { useHasSlot, useTouchDevice } from '@/composables';\n\n const VALIDATION_DEBOUNCE_TIME = 300;\n\n provide(INPUT_FIELD_PARENT_COMPONENT_INJECTION_KEY, 'bento-input-time');\n\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n const { isTouchDevice } = useTouchDevice();\n\n type MessageSchema = (typeof messages)['en-US'];\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const props = defineProps({\n description: { default: undefined },\n disabled: { type: Boolean, default: false },\n errorMessage: { default: null },\n label: { default: '' },\n optional: { type: Boolean, default: false },\n placeholder: { default: '' },\n readonly: { type: Boolean, default: false },\n required: { type: Boolean, default: false },\n tooltipText: { default: null },\n condensed: { type: Boolean, default: false },\n modelValue: { default: undefined }\n});\n\n const emit = defineEmits([\"update:model-value\", \"keydown\", \"input:valid\", \"input:error\"]);\n\n const internalError = ref(false);\n const computedErrorMessage = computed(() => {\n if (props.errorMessage) {\n return props.errorMessage;\n }\n return internalError.value ? t('invalidTimeFormat') : null;\n });\n const inputErrorMessage = computed(() => (isTouchDevice.value ? props.errorMessage : computedErrorMessage.value));\n const inputType = computed(() => (isTouchDevice.value ? 'time' : undefined));\n const inputModelValue = computed(() => props.modelValue);\n const computedPlaceholder = computed(() => (isTouchDevice ? undefined : props.placeholder));\n\n const validateTime = (timeText: string) => {\n if (!timeText) {\n internalError.value = false;\n return;\n }\n\n const isValid = isValidTimeString(timeText);\n internalError.value = !isValid;\n\n if (isValid) {\n emit('input:valid');\n } else {\n emit('input:error');\n }\n };\n const validateTimeWithDebounce = debounce(validateTime, VALIDATION_DEBOUNCE_TIME);\n\n // Watch for external modelValue changes (e.g., when parent resets the value)\n watch(\n () => props.modelValue,\n newValue => {\n const timeText = String(newValue ?? '');\n // Clear the error only when the new value is a complete, valid time string\n if (timeText.length === 8 && isValidTimeString(timeText)) {\n internalError.value = false;\n }\n }\n );\n\n const onInput = (value: BentoInputFieldValue) => {\n if (props.disabled || props.readonly) {\n return;\n }\n\n if (isTouchDevice.value) {\n emit('update:model-value', String(value ?? ''));\n emit('input:valid');\n } else {\n const formatted = formatTimeInputValue(String(value ?? ''));\n emit('update:model-value', formatted);\n validateTimeWithDebounce(formatted);\n }\n };\n\n const onKeyDown = (event: KeyboardEvent) => {\n if (!isTouchDevice.value) {\n validateTimeInput(event);\n }\n emit('keydown', event);\n };\n</script>\n\n<script lang=\"ts\">\n /**\n * Input time component for entering time values in HH:MM:SS format.\n * This is an extension of the `bento-input-field` component with built-in\n * time formatting and validation logic.\n *\n * @usage\n * import { BentoInputTime } from '@adyen/bento-vue2';\n *\n * const timeValue = ref('');\n *\n * export default {\n * components: { BentoInputTime },\n * template: `\n * <bento-input-time\n * label=\"Start time\"\n * :model-value=\"timeValue\"\n * @update:model-value=\"newValue => timeValue.value = newValue\"\n * />\n * `\n * }\n */\n export default {\n i18n: { messages },\n name: 'bento-input-time',\n inheritAttrs: false,\n model: { prop: 'modelValue' },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./input-time.scss\" />\n"],"names":["validDigitRegex","hourRegex","minuteRegex","isValidTimeString","timeText","validateTimeInput","event","selectionStart","allowedKeys","isValidKey","isValidColon","formatTimeInputValue","value","formattedValue","secondToLastDigit","lastDigit","__default__","messages","VALIDATION_DEBOUNCE_TIME","provide","INPUT_FIELD_PARENT_COMPONENT_INJECTION_KEY","slots","useSlots","hasSlot","useHasSlot","isTouchDevice","useTouchDevice","t","useI18n","internalError","ref","computedErrorMessage","computed","props","inputErrorMessage","inputType","inputModelValue","computedPlaceholder","validateTime","isValid","emit","validateTimeWithDebounce","debounce","watch","newValue","formatted"],"mappings":";;;;;;;;;AAAA,MAAAA,IAAA,QAEAC,IAAA,WACAC,IAAA,iBAQOC,IAAA,CAAAC,MAAA,8CAAA,KAAAA,CAAA,GAGAC,IAAA,CAAAC,MAAA;AACH,QAAA,EAAA,gBAAAC,EAAA,IAAAD,EAAA,QAEAE,IAAA,CAAA,aAAA,OAAA,aAAA,YAAA,GACAC,IAAAT,EAAA,KAAAM,EAAA,GAAA,KAAAE,EAAA,SAAAF,EAAA,GAAA,GACAI,IAAA,CAAA,GAAA,GAAA,GAAA,CAAA,EAAA,SAAAH,CAAA,KAAAD,EAAA,QAAA;AAEA,EAAA,CAAAG,KAAA,CAAAC,KACIJ,EAAA,eAAA;AAER,GAEOK,IAAA,CAAAC,MAAA;AACH,MAAA,CAAAA;AACI,WAAAA;AAGJ,MAAAC,IAAAD;AAGA,MAAAC,EAAA,WAAA,KAAA,SAAAD,GAAA,EAAA,IAAA;AACI,WAAA,IAAAC,CAAA;AAGJ,QAAA,CAAAC,GAAAC,CAAA,IAAAF,EAAA,MAAA,EAAA;AACA,SAAA,CAAA,GAAA,CAAA,EAAA,SAAAA,EAAA,MAAA,K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