@adyen/bento-vue2 1.77.0 → 1.78.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.
Files changed (65) hide show
  1. package/dist/@types/index.d.ts +137 -98
  2. package/dist/assets/accordion-item.css +1 -1
  3. package/dist/assets/action-bar.css +1 -1
  4. package/dist/assets/base-modal.css +1 -1
  5. package/dist/assets/button-actions.css +1 -1
  6. package/dist/assets/card.css +1 -1
  7. package/dist/assets/checkbox-group.css +1 -1
  8. package/dist/assets/data-grid.css +1 -1
  9. package/dist/assets/date-range-picker.css +1 -1
  10. package/dist/assets/dialog-page.css +1 -1
  11. package/dist/assets/file-uploader.css +1 -1
  12. package/dist/assets/filter-bar.css +1 -1
  13. package/dist/assets/index.css +1 -0
  14. package/dist/assets/inspector.css +1 -1
  15. package/dist/assets/modal-fullscreen.css +1 -1
  16. package/dist/assets/radio-group.css +1 -1
  17. package/dist/assets/selection-card-group.css +1 -1
  18. package/dist/assets/sidepanel.css +1 -1
  19. package/dist/checkbox.js +2 -2
  20. package/dist/chunks/checkbox-group.HqNbZx2y.js +141 -0
  21. package/dist/chunks/checkbox-group.HqNbZx2y.js.map +1 -0
  22. package/dist/chunks/{checkbox.itbBlXev.js → checkbox.CqF5Dank.js} +18 -18
  23. package/dist/chunks/{checkbox.itbBlXev.js.map → checkbox.CqF5Dank.js.map} +1 -1
  24. package/dist/chunks/{data-grid.B-kBw540.js → data-grid.BhwTkhfk.js} +508 -503
  25. package/dist/chunks/data-grid.BhwTkhfk.js.map +1 -0
  26. package/dist/chunks/date-range-picker.CmKA76Yu.js +898 -0
  27. package/dist/chunks/date-range-picker.CmKA76Yu.js.map +1 -0
  28. package/dist/chunks/date-range-picker.types.Ckt7zxGy.js +5 -0
  29. package/dist/chunks/date-range-picker.types.Ckt7zxGy.js.map +1 -0
  30. package/dist/chunks/es6.MoTTyETW.js.map +1 -1
  31. package/dist/chunks/{filter-bar.BLnSnOlj.js → filter-bar.Bj4LgjzJ.js} +5 -5
  32. package/dist/chunks/filter-bar.Bj4LgjzJ.js.map +1 -0
  33. package/dist/chunks/{header-with-views.C6Y7mAkq.js → header-with-views.D6JUlnEf.js} +2 -2
  34. package/dist/chunks/{header-with-views.C6Y7mAkq.js.map → header-with-views.D6JUlnEf.js.map} +1 -1
  35. package/dist/chunks/link.D8qpqg3W.js.map +1 -1
  36. package/dist/chunks/{radio-group.B8ukv-pw.js → radio-group.0JNwgkZa.js} +64 -63
  37. package/dist/chunks/radio-group.0JNwgkZa.js.map +1 -0
  38. package/dist/chunks/{rich-text-editor.DzH-Z5oi.js → rich-text-editor.NFLhgVJo.js} +2 -2
  39. package/dist/chunks/{rich-text-editor.DzH-Z5oi.js.map → rich-text-editor.NFLhgVJo.js.map} +1 -1
  40. package/dist/chunks/{selection-card-group.D4rcUyvV.js → selection-card-group.u-2Y_9o2.js} +97 -94
  41. package/dist/chunks/{selection-card-group.D4rcUyvV.js.map → selection-card-group.u-2Y_9o2.js.map} +1 -1
  42. package/dist/data-grid.js +1 -1
  43. package/dist/date-range-picker.js +5 -4
  44. package/dist/date-range-picker.js.map +1 -1
  45. package/dist/filter-bar.js +1 -1
  46. package/dist/header-with-views.js +1 -1
  47. package/dist/index.js +382 -357
  48. package/dist/index.js.map +1 -1
  49. package/dist/radio-group.js +1 -1
  50. package/dist/rich-text-editor.js +1 -1
  51. package/dist/selection-card.js +1 -1
  52. package/dist/styles/bento-dark.css +5 -0
  53. package/dist/styles/bento-light.css +5 -0
  54. package/dist/styles/bento.css +5 -0
  55. package/dist/styles/legacy.css +5 -0
  56. package/dist/styles/styleguide.css +5 -0
  57. package/dist/web-types.json +44 -16
  58. package/package.json +6 -6
  59. package/dist/chunks/checkbox-group.C3RH5Gcg.js +0 -152
  60. package/dist/chunks/checkbox-group.C3RH5Gcg.js.map +0 -1
  61. package/dist/chunks/data-grid.B-kBw540.js.map +0 -1
  62. package/dist/chunks/date-range-picker.BtPxkPN0.js +0 -942
  63. package/dist/chunks/date-range-picker.BtPxkPN0.js.map +0 -1
  64. package/dist/chunks/filter-bar.BLnSnOlj.js.map +0 -1
  65. package/dist/chunks/radio-group.B8ukv-pw.js.map +0 -1
@@ -1,21 +1,22 @@
1
- import { defineComponent as A, useSlots as O, computed as l, inject as j, ref as m, watch as P, provide as W, onMounted as Y } from "vue";
2
- import { b as F } from "./index.BDK4hwK_.js";
1
+ import { defineComponent as O, useSlots as D, computed as n, inject as F, ref as C, watch as j, provide as P, onMounted as W } from "vue";
2
+ import { b as Y } from "./index.BDK4hwK_.js";
3
3
  import { a as Q, b as U } from "./es6.MoTTyETW.js";
4
4
  import { B as H } from "./typography.hlOAxsEn.js";
5
- import { C as J } from "./checkbox-input.B0NsfSNR.js";
6
- import { u as K } from "./aria-label.CaUURpnB.js";
7
- import { g as M } from "./generate-uid.NJ8tVoha.js";
8
- import { u as X } from "./use-has-slot.C9lQZ6nz.js";
9
- import { a as Z } from "./radio-input.kzb4gxLW.js";
10
- import { n as D } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
11
- import { G as ee } from "./grid-layout.1aIiz2N_.js";
12
- import { E as te } from "./field-label.Auq-Pzho.js";
13
- import { C as oe } from "./controls-group.82mB_GDw.js";
5
+ import { u as J } from "./aria-label.CaUURpnB.js";
6
+ import { g as $ } from "./generate-uid.NJ8tVoha.js";
7
+ import { u as K } from "./use-has-slot.C9lQZ6nz.js";
8
+ import { a as X } from "./radio-input.kzb4gxLW.js";
9
+ import { C as Z } from "./checkbox-input.B0NsfSNR.js";
10
+ import { n as N } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
11
+ import { u as ee } from "./form-field.BBqLu-vs.js";
12
+ import { G as te } from "./grid-layout.1aIiz2N_.js";
13
+ import { E as oe } from "./field-label.Auq-Pzho.js";
14
+ import { C as le } from "./controls-group.82mB_GDw.js";
14
15
  import "../assets/selection-card-group.css";
15
- var B = /* @__PURE__ */ ((c) => (c.DISABLED = "disabled", c.READONLY = "readonly", c.ERROR = "error", c))(B || {});
16
- const N = Symbol("selection card radio input injection key"), ae = {
16
+ var E = /* @__PURE__ */ ((c) => (c.DISABLED = "disabled", c.READONLY = "readonly", c.ERROR = "error", c))(E || {});
17
+ const q = Symbol("selection card radio input injection key"), ae = {
17
18
  name: "bento-selection-card"
18
- }, le = /* @__PURE__ */ A({
19
+ }, ne = /* @__PURE__ */ O({
19
20
  ...ae,
20
21
  props: {
21
22
  /**
@@ -78,67 +79,69 @@ const N = Symbol("selection card radio input injection key"), ae = {
78
79
  },
79
80
  emits: ["input", "update:model-value"],
80
81
  setup(c, { emit: e }) {
81
- const t = c, o = O(), a = X(o), v = M("selection-card-input-id"), s = M("selection-card-description"), C = l(
82
+ const t = c, o = D(), l = K(o), h = $("selection-card-input-id"), s = $("selection-card-description"), d = n(
82
83
  () => t.modelValue
83
- ), E = l(
84
+ ), B = n(
84
85
  () => t.modelValue
85
- ), S = l(() => ({
86
- "b-selection-card--checked": p.value,
86
+ ), V = n(() => ({
87
+ "b-selection-card--checked": R.value,
87
88
  "b-selection-card--fully-clickable": t.fullyClickable
88
- })), _ = l(() => ({
89
- [`b-selection-card--${B.DISABLED}`]: t.disabled,
90
- [`b-selection-card--${B.ERROR}`]: t.hasError,
91
- [`b-selection-card--${B.READONLY}`]: t.readonly,
89
+ })), x = n(() => ({
90
+ [`b-selection-card--${E.DISABLED}`]: t.disabled,
91
+ [`b-selection-card--${E.ERROR}`]: t.hasError,
92
+ [`b-selection-card--${E.READONLY}`]: t.readonly,
92
93
  "b-selection-card--center-aligned": y.value
93
- })), h = l(() => ({
94
+ })), _ = n(() => ({
94
95
  "b-selection-card__checkbox-container--center-aligned": y.value
95
- })), R = l(() => ({
96
+ })), g = n(() => ({
96
97
  "b-selection-card__checkbox-container-text--center-aligned": y.value
97
- })), b = l(() => ({
98
- "b-selection-card__slot--with-icon": a("icon")
99
- })), r = K({
98
+ })), S = n(() => ({
99
+ "b-selection-card__slot--with-icon": l("icon")
100
+ })), b = J({
100
101
  ariaLabel: t.title,
101
102
  label: t.value
102
- }), g = l(() => Array.isArray(t.modelValue)), p = l(() => k.value ? t.value === t.modelValue : g.value ? t.modelValue.some((i) => i === t.value) : t.modelValue), k = j(N, m(!1)), y = l(() => !t.subtitle && !t.description), u = m(null), n = m(null), d = m(null), q = (i) => {
103
- var f, x, $, L, T, G;
104
- if (u.value.$refs.inputRef === i.target) {
105
- const z = V();
106
- w(z);
103
+ }), a = n(() => Array.isArray(t.modelValue)), R = n(() => u.value ? t.value === t.modelValue : a.value ? t.modelValue.some((i) => i === t.value) : t.modelValue), u = F(q, C(!1)), y = n(() => !t.subtitle && !t.description), p = C(null), m = C(null), r = C(null), v = (i) => {
104
+ var f, k, L, T, G, A;
105
+ if (p.value.$refs.inputRef === i.target) {
106
+ const z = w();
107
+ M(z);
107
108
  return;
108
109
  }
109
- if (t.disabled && t.readonly || !t.fullyClickable && (n.value && ((x = (f = n.value) == null ? void 0 : f.$el) != null && x.contains(i.target)) || d.value && ((L = ($ = d.value) == null ? void 0 : $.$el) != null && L.contains(i.target)) || u.value && ((G = (T = u.value) == null ? void 0 : T.$el) != null && G.contains(i.target))))
110
+ if (t.disabled && t.readonly || !t.fullyClickable && (m.value && ((k = (f = m.value) == null ? void 0 : f.$el) != null && k.contains(i.target)) || r.value && ((T = (L = r.value) == null ? void 0 : L.$el) != null && T.contains(i.target)) || p.value && ((A = (G = p.value) == null ? void 0 : G.$el) != null && A.contains(i.target))))
110
111
  return;
111
- const I = V();
112
- w(I);
113
- }, V = () => {
112
+ const I = w();
113
+ M(I);
114
+ }, w = () => {
114
115
  var I;
115
- const i = ((I = u.value) == null ? void 0 : I.$refs.inputRef).checked;
116
- if (g.value) {
117
- const f = [...t.modelValue], x = f.indexOf(t.value);
118
- return x === -1 ? f.push(t.value) : f.splice(x, 1), f;
116
+ const i = ((I = p.value) == null ? void 0 : I.$refs.inputRef).checked;
117
+ if (a.value) {
118
+ const f = [...t.modelValue], k = f.indexOf(t.value);
119
+ return k === -1 ? f.push(t.value) : f.splice(k, 1), f;
119
120
  }
120
- return k.value ? t.value : i;
121
- }, w = (i) => {
121
+ return u.value ? t.value : i;
122
+ }, M = (i) => {
122
123
  !t.disabled && !t.readonly && (e("update:model-value", i), e("input", i));
123
124
  };
124
- return { __sfc: !0, props: t, emit: e, slots: o, hasSlot: a, inputId: v, descriptionId: s, computedRadioInputModelValue: C, computedCheckboxInputModelValue: E, conditionalClasses: S, containerConditionalClasses: _, checkboxContainerConditionalClasses: h, checkboxContainerTextConditionalClasses: R, slotConditionalClasses: b, ariaLabel: r, isCheckboxGroup: g, isChecked: p, isRadioInput: k, isTitleOnly: y, inputRef: u, slotRef: n, dynamicSlotRef: d, handleCardClick: q, toggleInput: V, onChange: w, BentoTypography: H, CheckboxInput: J, RadioInput: Z };
125
+ return { __sfc: !0, props: t, emit: e, slots: o, hasSlot: l, inputId: h, descriptionId: s, computedRadioInputModelValue: d, computedCheckboxInputModelValue: B, conditionalClasses: V, containerConditionalClasses: x, checkboxContainerConditionalClasses: _, checkboxContainerTextConditionalClasses: g, slotConditionalClasses: S, ariaLabel: b, isCheckboxGroup: a, isChecked: R, isRadioInput: u, isTitleOnly: y, inputRef: p, slotRef: m, dynamicSlotRef: r, handleCardClick: v, toggleInput: w, onChange: M, BentoTypography: H, CheckboxInput: Z, RadioInput: X };
125
126
  }
126
127
  });
127
- var ne = function() {
128
+ var re = function() {
128
129
  var e = this, t = e._self._c, o = e._self._setupProxy;
129
- return t("div", { staticClass: "b-selection-card", class: o.conditionalClasses, on: { click: o.handleCardClick } }, [t("div", { staticClass: "b-selection-card__container", class: o.containerConditionalClasses }, [t("div", { staticClass: "b-selection-card__checkbox-container", class: o.checkboxContainerConditionalClasses }, [t("div", { staticClass: "b-selection-card__checkbox-container-text", class: o.checkboxContainerTextConditionalClasses }, [o.hasSlot("icon") ? t("div", { staticClass: "b-selection-card__icon", attrs: { role: "presentation" } }, [e._t("icon")], 2) : e._e(), t("label", { staticClass: "b-selection-card__text", attrs: { for: o.inputId }, on: { click: function(a) {
130
- return a.stopPropagation(), a.preventDefault(), o.handleCardClick.apply(null, arguments);
130
+ return t("div", { staticClass: "b-selection-card", class: o.conditionalClasses, on: { click: o.handleCardClick } }, [t("div", { staticClass: "b-selection-card__container", class: o.containerConditionalClasses }, [t("div", { staticClass: "b-selection-card__checkbox-container", class: o.checkboxContainerConditionalClasses }, [t("div", { staticClass: "b-selection-card__checkbox-container-text", class: o.checkboxContainerTextConditionalClasses }, [o.hasSlot("icon") ? t("div", { staticClass: "b-selection-card__icon", attrs: { role: "presentation" } }, [e._t("icon")], 2) : e._e(), t("label", { staticClass: "b-selection-card__text", attrs: { for: o.inputId }, on: { click: function(l) {
131
+ return l.stopPropagation(), l.preventDefault(), o.handleCardClick.apply(null, arguments);
131
132
  } } }, [e.subtitle ? t(o.BentoTypography, { staticClass: "b-selection-card__description", attrs: { el: "span", variant: "caption" } }, [e._v(" " + e._s(e.subtitle) + " ")]) : e._e(), t(o.BentoTypography, { attrs: { el: "span", variant: "title" } }, [e._v(e._s(e.title))]), e.description ? t(o.BentoTypography, { staticClass: "b-selection-card__description", attrs: { id: "descriptionId", el: "span", variant: "body" } }, [e._v(" " + e._s(e.description) + " ")]) : e._e()], 1)]), o.isRadioInput ? t(o.RadioInput, { ref: "inputRef", attrs: { id: o.inputId, "aria-label": o.ariaLabel, "aria-describedby": e.description ? o.descriptionId : void 0, disabled: e.disabled, "has-error": e.hasError, "aria-readonly": e.readonly ?? void 0, value: e.value, readonly: e.readonly, "model-value": o.computedRadioInputModelValue } }) : t(o.CheckboxInput, { ref: "inputRef", attrs: { id: o.inputId, "aria-label": o.ariaLabel, "aria-describedby": e.description ? o.descriptionId : void 0, disabled: e.disabled, "has-error": e.hasError, "aria-readonly": e.readonly ?? void 0, value: e.value, readonly: e.readonly, "model-value": o.computedCheckboxInputModelValue } })], 1), o.hasSlot("content") ? t(o.BentoTypography, { ref: "slotRef", staticClass: "b-selection-card__slot", class: o.slotConditionalClasses, attrs: { el: "div" } }, [e._t("content")], 2) : e._e(), o.hasSlot("dynamicContent") && o.isChecked ? t(o.BentoTypography, { ref: "dynamicSlotRef", staticClass: "b-selection-card__slot", class: o.slotConditionalClasses, attrs: { el: "div" } }, [e._t("dynamicContent")], 2) : e._e()], 1)]);
132
- }, re = [], se = /* @__PURE__ */ D(
133
- le,
133
+ }, se = [], ie = /* @__PURE__ */ N(
134
134
  ne,
135
135
  re,
136
+ se,
136
137
  !1,
137
138
  null,
138
139
  "e98bb71b"
139
140
  );
140
- const ie = se.exports, ce = {}, ue = /* @__PURE__ */ A({
141
- ...ce,
141
+ const ce = ie.exports, ue = {
142
+ model: { prop: "modelValue" }
143
+ }, de = /* @__PURE__ */ O({
144
+ ...ue,
142
145
  __name: "selection-card-group",
143
146
  props: {
144
147
  description: { default: null },
@@ -158,58 +161,58 @@ const ie = se.exports, ce = {}, ue = /* @__PURE__ */ A({
158
161
  modelValue: { default: null },
159
162
  variant: { default: "checkbox" }
160
163
  },
161
- emits: ["input", "update:model-value"],
164
+ emits: ["update:model-value", "input"],
162
165
  setup(c, { emit: e }) {
163
- const t = c, o = O(), a = (n) => !!o[n], v = l(() => ({
166
+ const t = c, { emitValue: o } = ee(e), l = D(), h = (r) => !!l[r], s = n(() => ({
164
167
  "b-selection-card-group__items--horizontal": t.layout === "horizontal"
165
- })), s = m(t.modelValue);
166
- P(
168
+ })), d = C(t.modelValue);
169
+ j(
167
170
  () => t.modelValue,
168
171
  () => {
169
- s.value = t.modelValue;
172
+ d.value = t.modelValue;
170
173
  }
171
174
  );
172
- const C = M("error"), E = l(() => !t.disabled && !t.readonly && !!t.errorMessage), S = m(null), { width: _ } = F(S), h = l(() => Q.split("px")[0]), R = l(() => U.split("px")[0]), b = l(() => _.value < h.value ? "small" : _.value >= h.value && _.value < R.value ? "medium" : "large"), r = l(() => {
173
- var n;
174
- return ((n = t.itemsPerRow) == null ? void 0 : n[b == null ? void 0 : b.value]) || t.items.length;
175
- }), g = l(() => {
175
+ const B = $("error"), V = n(() => !t.disabled && !t.readonly && !!t.errorMessage), x = C(null), { width: _ } = Y(x), g = n(() => Q.split("px")[0]), S = n(() => U.split("px")[0]), b = n(() => _.value < g.value ? "small" : _.value >= g.value && _.value < S.value ? "medium" : "large"), a = n(() => {
176
+ var r;
177
+ return ((r = t.itemsPerRow) == null ? void 0 : r[b == null ? void 0 : b.value]) || t.items.length;
178
+ }), R = n(() => {
176
179
  if (!t.itemsPerRow)
177
180
  return [];
178
- const n = [];
179
- for (let d = 0; d < t.items.length; d += r == null ? void 0 : r.value)
180
- n.push(t.items.slice(d, d + (r == null ? void 0 : r.value)));
181
- return n;
182
- }), p = l(() => 12 / (r == null ? void 0 : r.value)), k = l(() => r != null && r.value ? new Array(r == null ? void 0 : r.value).fill({
181
+ const r = [];
182
+ for (let v = 0; v < t.items.length; v += a == null ? void 0 : a.value)
183
+ r.push(t.items.slice(v, v + (a == null ? void 0 : a.value)));
184
+ return r;
185
+ }), u = n(() => 12 / (a == null ? void 0 : a.value)), y = n(() => a != null && a.value ? new Array(a == null ? void 0 : a.value).fill({
183
186
  // Instead of passing the actual screen sizes values, passing the same values per each screen size and recomputing it makes sure visually the change is smoother and not laggy
184
- small: p.value,
185
- medium: p.value,
186
- large: p.value
187
- }) : []), y = (n) => {
188
- s.value = n, e("update:model-value", n), e("input", n);
189
- }, u = l(() => t.variant === "radio");
190
- return W(N, u), Y(() => {
191
- t.itemsPerRow && Object.values(t.itemsPerRow).forEach((n) => {
192
- if (n && (n < 2 || n > 6))
187
+ small: u.value,
188
+ medium: u.value,
189
+ large: u.value
190
+ }) : []), p = (r) => {
191
+ d.value = r, o(r);
192
+ }, m = n(() => t.variant === "radio");
193
+ return P(q, m), W(() => {
194
+ t.itemsPerRow && Object.values(t.itemsPerRow).forEach((r) => {
195
+ if (r && (r < 2 || r > 6))
193
196
  throw new Error(
194
197
  "itemsPerRow values must have a value between 2 and 6 items per row. Read the documentation for more information."
195
198
  );
196
199
  });
197
- }), { __sfc: !0, props: t, emit: e, slots: o, hasSlot: a, conditionalItemsClasses: v, inputValue: s, errorMessageId: C, shouldShowGroupError: E, containerRef: S, width: _, smallBreakpoint: h, mediumBreakpoint: R, currentBreakpoint: b, computedItemsPerRow: r, computedRows: g, itemColumnWidth: p, computedColumnWidth: k, onInput: y, isRadioVariant: u, BentoSelectionCard: ie, ControlsGroup: oe, ErrorMessage: te, GridLayout: ee };
200
+ }), { __sfc: !0, props: t, emit: e, emitValue: o, slots: l, hasSlot: h, conditionalItemsClasses: s, inputValue: d, errorMessageId: B, shouldShowGroupError: V, containerRef: x, width: _, smallBreakpoint: g, mediumBreakpoint: S, currentBreakpoint: b, computedItemsPerRow: a, computedRows: R, itemColumnWidth: u, computedColumnWidth: y, onInput: p, isRadioVariant: m, BentoSelectionCard: ce, ControlsGroup: le, ErrorMessage: oe, GridLayout: te };
198
201
  }
199
202
  });
200
- var de = function() {
203
+ var pe = function() {
201
204
  var e = this, t = e._self._c, o = e._self._setupProxy;
202
- return t(o.ControlsGroup, { ref: "containerRef", staticClass: "b-selection-card-group", attrs: { "aria-describedby": o.shouldShowGroupError ? o.errorMessageId : null, label: e.label, "hide-label": e.hideLabel, description: e.description, disabled: e.disabled, "tooltip-text": e.tooltipText, readonly: e.readonly, required: e.required, optional: e.optional, "component-name": "selection-card-group" } }, [!e.itemsPerRow || e.layout === "vertical" ? t("div", { staticClass: "b-selection-card-group__items", class: o.conditionalItemsClasses }, e._l(e.items, function(a) {
203
- return t(o.BentoSelectionCard, e._b({ key: `selection-card-${a.value}`, staticClass: "b-selection-card-group__item", attrs: { "model-value": o.inputValue, readonly: e.readonly || a.readonly, "has-error": o.shouldShowGroupError, disabled: e.disabled || a.disabled }, on: { "update:model-value": o.onInput }, scopedSlots: e._u([o.hasSlot("icon") && a.icon ? { key: "icon", fn: function() {
204
- return [e._t("icon", null, null, a)];
205
- }, proxy: !0 } : null, o.hasSlot("content") && a.content ? { key: "content", fn: function() {
206
- return [e._t("content", null, null, a)];
207
- }, proxy: !0 } : null, o.hasSlot("dynamicContent") && a.dynamicContent ? { key: "dynamicContent", fn: function() {
208
- return [e._t("dynamicContent", null, null, a)];
209
- }, proxy: !0 } : null], null, !0) }, "bento-selection-card", a, !1));
210
- }), 1) : [t("div", { key: `selection-card-group-layout-breakpoint-${o.currentBreakpoint}` }, e._l(o.computedRows, function(a, v) {
211
- return t(o.GridLayout, { key: `selection-card-group-row-${v}-cols-${o.computedItemsPerRow}`, staticClass: "b-selection-card-group__items--wrap", attrs: { "column-width": o.computedColumnWidth }, scopedSlots: e._u([e._l(a, function(s, C) {
212
- return { key: `col-${C + 1}`, fn: function() {
205
+ return t(o.ControlsGroup, { ref: "containerRef", staticClass: "b-selection-card-group", attrs: { "aria-describedby": o.shouldShowGroupError ? o.errorMessageId : null, label: e.label, "hide-label": e.hideLabel, description: e.description, disabled: e.disabled, "tooltip-text": e.tooltipText, readonly: e.readonly, required: e.required, optional: e.optional, "component-name": "selection-card-group" } }, [!e.itemsPerRow || e.layout === "vertical" ? t("div", { staticClass: "b-selection-card-group__items", class: o.conditionalItemsClasses }, e._l(e.items, function(l) {
206
+ return t(o.BentoSelectionCard, e._b({ key: `selection-card-${l.value}`, staticClass: "b-selection-card-group__item", attrs: { "model-value": o.inputValue, readonly: e.readonly || l.readonly, "has-error": o.shouldShowGroupError, disabled: e.disabled || l.disabled }, on: { "update:model-value": o.onInput }, scopedSlots: e._u([o.hasSlot("icon") && l.icon ? { key: "icon", fn: function() {
207
+ return [e._t("icon", null, null, l)];
208
+ }, proxy: !0 } : null, o.hasSlot("content") && l.content ? { key: "content", fn: function() {
209
+ return [e._t("content", null, null, l)];
210
+ }, proxy: !0 } : null, o.hasSlot("dynamicContent") && l.dynamicContent ? { key: "dynamicContent", fn: function() {
211
+ return [e._t("dynamicContent", null, null, l)];
212
+ }, proxy: !0 } : null], null, !0) }, "bento-selection-card", l, !1));
213
+ }), 1) : [t("div", { key: `selection-card-group-layout-breakpoint-${o.currentBreakpoint}` }, e._l(o.computedRows, function(l, h) {
214
+ return t(o.GridLayout, { key: `selection-card-group-row-${h}-cols-${o.computedItemsPerRow}`, staticClass: "b-selection-card-group__items--wrap", attrs: { "column-width": o.computedColumnWidth }, scopedSlots: e._u([e._l(l, function(s, d) {
215
+ return { key: `col-${d + 1}`, fn: function() {
213
216
  return [t(o.BentoSelectionCard, e._b({ key: `selection-card-${s.value}`, staticClass: "b-selection-card-group__item b-selection-card-group__item--full-height", attrs: { "model-value": o.inputValue, readonly: e.readonly || s.readonly, "has-error": o.shouldShowGroupError, disabled: e.disabled || s.disabled }, on: { "update:model-value": o.onInput }, scopedSlots: e._u([o.hasSlot("icon") && s.icon ? { key: "icon", fn: function() {
214
217
  return [e._t("icon", null, null, s)];
215
218
  }, proxy: !0 } : null, o.hasSlot("content") && s.content ? { key: "content", fn: function() {
@@ -220,18 +223,18 @@ var de = function() {
220
223
  }, proxy: !0 };
221
224
  })], null, !0) });
222
225
  }), 1)], o.shouldShowGroupError ? t(o.ErrorMessage, { staticClass: "b-selection-card-group__error-message", attrs: { id: o.errorMessageId, "error-message": e.errorMessage } }) : e._e()], 2);
223
- }, pe = [], fe = /* @__PURE__ */ D(
224
- ue,
226
+ }, fe = [], _e = /* @__PURE__ */ N(
225
227
  de,
226
228
  pe,
229
+ fe,
227
230
  !1,
228
231
  null,
229
- "b5cb85fc"
232
+ "fab59f5f"
230
233
  );
231
- const Be = fe.exports;
234
+ const Ve = _e.exports;
232
235
  export {
233
- ie as B,
234
- B as a,
235
- Be as s
236
+ ce as B,
237
+ E as a,
238
+ Ve as s
236
239
  };
237
- //# sourceMappingURL=selection-card-group.D4rcUyvV.js.map
240
+ //# sourceMappingURL=selection-card-group.u-2Y_9o2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"selection-card-group.D4rcUyvV.js","sources":["../../src/components/selection-card/selection-card.types.ts","../../src/components/selection-card/selection-card.keys.ts","../../src/components/selection-card/selection-card.vue","../../src/components/selection-card/components/selection-card-group/selection-card-group.vue"],"sourcesContent":["import { type RadioInputValue } from '@/components/internal/radio-input';\nimport { type BentoCheckboxType } from '../checkbox/checkbox.types';\nimport { type VueNodeElement } from '@/types/elements';\n\nexport enum BentoSelectionCardState {\n DISABLED = 'disabled',\n READONLY = 'readonly',\n ERROR = 'error',\n}\n\nexport type BentoSelectionCardValue = string | number;\n\nexport type BentoSelectionCardModelValue = BentoCheckboxType | RadioInputValue;\n\nexport interface BentoSelectionCardItem {\n content?: string | object;\n description?: string;\n disabled?: boolean;\n dynamicContent?: string | object;\n fullyClickable?: boolean;\n hasError?: boolean;\n icon?: VueNodeElement;\n readonly?: boolean;\n subtitle?: string;\n title: string;\n value: BentoSelectionCardValue;\n}\n","export const SELECTION_CARD_RADIO_INPUT_INJECTION_KEY = Symbol('selection card radio input injection key');\n","<template>\n <div class=\"b-selection-card\" :class=\"conditionalClasses\" @click=\"handleCardClick\">\n <div class=\"b-selection-card__container\" :class=\"containerConditionalClasses\">\n <div class=\"b-selection-card__checkbox-container\" :class=\"checkboxContainerConditionalClasses\">\n <div class=\"b-selection-card__checkbox-container-text\" :class=\"checkboxContainerTextConditionalClasses\">\n <div v-if=\"hasSlot('icon')\" class=\"b-selection-card__icon\" role=\"presentation\">\n <slot name=\"icon\" />\n </div>\n <label :for=\"inputId\" class=\"b-selection-card__text\" @click.stop.prevent=\"handleCardClick\">\n <bento-typography\n v-if=\"subtitle\"\n class=\"b-selection-card__description\"\n el=\"span\"\n variant=\"caption\"\n >\n {{ subtitle }}\n </bento-typography>\n <bento-typography el=\"span\" variant=\"title\">{{ title }}</bento-typography>\n <bento-typography\n v-if=\"description\"\n id=\"descriptionId\"\n class=\"b-selection-card__description\"\n el=\"span\"\n variant=\"body\"\n >\n {{ description }}\n </bento-typography>\n </label>\n </div>\n <radio-input\n v-if=\"isRadioInput\"\n :id=\"inputId\"\n ref=\"inputRef\"\n :aria-label=\"ariaLabel\"\n :aria-describedby=\"description ? descriptionId : undefined\"\n :disabled=\"disabled\"\n :has-error=\"hasError\"\n :aria-readonly=\"readonly ?? undefined\"\n :value=\"value\"\n :readonly=\"readonly\"\n :model-value=\"computedRadioInputModelValue\"\n />\n <checkbox-input\n v-else\n :id=\"inputId\"\n ref=\"inputRef\"\n :aria-label=\"ariaLabel\"\n :aria-describedby=\"description ? descriptionId : undefined\"\n :disabled=\"disabled\"\n :has-error=\"hasError\"\n :aria-readonly=\"readonly ?? undefined\"\n :value=\"value\"\n :readonly=\"readonly\"\n :model-value=\"computedCheckboxInputModelValue\"\n />\n </div>\n <bento-typography\n v-if=\"hasSlot('content')\"\n ref=\"slotRef\"\n el=\"div\"\n class=\"b-selection-card__slot\"\n :class=\"slotConditionalClasses\"\n >\n <slot name=\"content\" />\n </bento-typography>\n <bento-typography\n v-if=\"hasSlot('dynamicContent') && isChecked\"\n ref=\"dynamicSlotRef\"\n el=\"div\"\n class=\"b-selection-card__slot\"\n :class=\"slotConditionalClasses\"\n >\n <slot name=\"dynamicContent\" />\n </bento-typography>\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { BentoTypography } from '@/components/typography';\n import { type BentoCheckboxType, type BentoMultiCheckboxType, CheckboxInput } from '../internal/checkbox-input';\n import { RadioInput, type RadioInputValue } from '../internal/radio-input';\n import { useAriaLabel } from '@/utils/ts/aria-label';\n import { generateUid } from '@/core/utils/ts';\n import { computed, type ComputedRef, inject, type PropType, type Ref, ref, useSlots } from 'vue';\n import { useHasSlot } from '@/composables';\n import type { BentoSelectionCardModelValue, BentoSelectionCardValue } from './selection-card.types';\n import { BentoSelectionCardState } from './selection-card.types';\n import { SELECTION_CARD_RADIO_INPUT_INJECTION_KEY } from './selection-card.keys';\n\n const props = defineProps({\n /**\n * The description of the selection card\n */\n description: {\n type: String,\n default: undefined,\n },\n\n /**\n * Disables the selection card\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Makes the entire selection card clickable. Clicking over interactive elements inside the card with this prop enabled will not be possible.\n */\n fullyClickable: { type: Boolean, default: false },\n\n /**\n * Shows the selection card in error state\n */\n hasError: { type: Boolean, default: false },\n\n /**\n * This property should not be used directly.\n * It will be used by v-model directive on selection card component.\n *\n * When handling a single input, use a string or a number.\n *\n * When handling multiple inputs, use an array of keys.\n * These keys exist as a set \"value\" prop for each input.\n */\n modelValue: {\n type: [Boolean, String, Array] as PropType<BentoSelectionCardModelValue>,\n default: null,\n },\n\n /**\n * Sets the selection card to readonly\n */\n readonly: { type: Boolean, default: false },\n\n /**\n * The subtitle of the selection card\n */\n subtitle: {\n type: String,\n default: undefined,\n },\n\n /**\n * The title of the selection card\n */\n title: {\n type: String,\n required: true,\n },\n\n /**\n * Indicates the value of the input that will be returned when it's checked.\n */\n value: {\n type: [String, Number] as PropType<BentoSelectionCardValue>,\n required: true,\n },\n });\n\n const emit = defineEmits([\"input\", \"update:model-value\"]);\n\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n\n const inputId = generateUid('selection-card-input-id');\n const descriptionId = generateUid('selection-card-description');\n\n const computedRadioInputModelValue: ComputedRef<RadioInputValue> = computed(\n () => props.modelValue as RadioInputValue\n );\n const computedCheckboxInputModelValue: ComputedRef<BentoCheckboxType> = computed(\n () => props.modelValue as BentoCheckboxType\n );\n\n const conditionalClasses = computed(() => ({\n 'b-selection-card--checked': isChecked.value,\n 'b-selection-card--fully-clickable': props.fullyClickable,\n }));\n\n const containerConditionalClasses = computed(() => ({\n [`b-selection-card--${BentoSelectionCardState.DISABLED}`]: props.disabled,\n [`b-selection-card--${BentoSelectionCardState.ERROR}`]: props.hasError,\n [`b-selection-card--${BentoSelectionCardState.READONLY}`]: props.readonly,\n 'b-selection-card--center-aligned': isTitleOnly.value,\n }));\n\n const checkboxContainerConditionalClasses = computed(() => ({\n 'b-selection-card__checkbox-container--center-aligned': isTitleOnly.value,\n }));\n\n const checkboxContainerTextConditionalClasses = computed(() => ({\n 'b-selection-card__checkbox-container-text--center-aligned': isTitleOnly.value,\n }));\n\n const slotConditionalClasses = computed(() => ({\n 'b-selection-card__slot--with-icon': hasSlot('icon'),\n }));\n\n const ariaLabel = useAriaLabel({\n ariaLabel: props.title,\n label: props.value as string,\n });\n\n const isCheckboxGroup = computed(() => Array.isArray(props.modelValue));\n\n const isChecked: ComputedRef<boolean> = computed(() => {\n if (isRadioInput.value) {\n return props.value === props.modelValue;\n }\n if (!isCheckboxGroup.value) {\n return props.modelValue as boolean;\n }\n\n return (props.modelValue as BentoMultiCheckboxType).some(item => item === props.value);\n });\n\n const isRadioInput: Ref<boolean> = inject(SELECTION_CARD_RADIO_INPUT_INJECTION_KEY, ref(false));\n\n const isTitleOnly = computed(() => !props.subtitle && !props.description);\n\n const inputRef = ref<InstanceType<typeof RadioInput> | InstanceType<typeof CheckboxInput>>(null);\n const slotRef = ref(null);\n const dynamicSlotRef = ref(null);\n\n // Handle click on the whole card area\n const handleCardClick = (event: Event) => {\n if (inputRef.value.$refs.inputRef === event.target) {\n const newValue = toggleInput();\n onChange(newValue);\n return;\n }\n\n // Do nothing if disabled or readonly\n if (props.disabled && props.readonly) {\n return;\n }\n\n // If it's not fully clickable prevent selecting the card if the click\n // originated in a slot\n if (!props.fullyClickable) {\n // Check if the click originated from the slot - in that case, do nothng\n if (slotRef.value && slotRef.value?.$el?.contains(event.target)) {\n return;\n }\n // Check if the click originated from the dynamic slot - in that case, do nothng\n if (dynamicSlotRef.value && dynamicSlotRef.value?.$el?.contains(event.target)) {\n return;\n }\n // Check if the click originated from the input - in that case do nothing, as the input will emit the event already\n if (inputRef.value && inputRef.value?.$el?.contains(event.target as Node)) {\n return;\n }\n }\n\n // If the click originated outside of these two areas, emit the change event\n const newValue = toggleInput();\n\n onChange(newValue);\n };\n\n const toggleInput = (): BentoSelectionCardModelValue => {\n const currentValue: boolean = (inputRef.value?.$refs.inputRef as HTMLInputElement).checked;\n\n if (isCheckboxGroup.value) {\n const newCheckedList = [...(props.modelValue as BentoMultiCheckboxType)];\n const index = newCheckedList.indexOf(props.value);\n\n if (index === -1) {\n newCheckedList.push(props.value);\n } else {\n newCheckedList.splice(index, 1);\n }\n return newCheckedList;\n }\n\n if (isRadioInput.value) {\n return props.value;\n }\n return currentValue;\n };\n\n const onChange = newValue => {\n if (!props.disabled && !props.readonly) {\n emit('update:model-value', newValue);\n emit('input', newValue);\n }\n };\n</script>\n\n<script lang=\"ts\">\n /**\n * Selection card component. If used standalone, only the checkbox variant can be used. If the checkbox variant is needed, please use the bento-selection-card-group component.\n *\n * @example\n * import { BentoSelectionCard } from '@adyen/bento-vue2';\n * import EmoticonHappyIcon from '@adyen/ui-assets-icons-16/vue/emoticon-happy';\n *\n * export default {\n * components: { BentoSelectionCard, EmoticonHappyIcon },\n * template: `\n * <bento-selection-card title=\"Card title\" :model-value.sync=\"yourModelValue\">\n * <template #icon>\n * <emoticon-happy-icon />\n * </template>\n * </bento-selection-card>\n * `\n * }\n */\n export default {\n name: 'bento-selection-card',\n };\n</script>\n<style lang=\"scss\" scoped src=\"./selection-card.scss\" />\n","<template>\n <controls-group\n ref=\"containerRef\"\n :aria-describedby=\"shouldShowGroupError ? errorMessageId : null\"\n :label=\"label\"\n :hide-label=\"hideLabel\"\n :description=\"description\"\n :disabled=\"disabled\"\n :tooltip-text=\"tooltipText\"\n :readonly=\"readonly\"\n :required=\"required\"\n :optional=\"optional\"\n class=\"b-selection-card-group\"\n component-name=\"selection-card-group\"\n >\n <div\n v-if=\"!itemsPerRow || layout === 'vertical'\"\n class=\"b-selection-card-group__items\"\n :class=\"conditionalItemsClasses\"\n >\n <bento-selection-card\n v-for=\"item in items\"\n :key=\"`selection-card-${item.value}`\"\n class=\"b-selection-card-group__item\"\n v-bind=\"item\"\n :model-value=\"inputValue\"\n :readonly=\"readonly || item.readonly\"\n :has-error=\"shouldShowGroupError\"\n :disabled=\"disabled || item.disabled\"\n @update:model-value=\"onInput\"\n >\n <template v-if=\"hasSlot('icon') && item.icon\" #icon>\n <slot name=\"icon\" v-bind=\"item\"></slot>\n </template>\n <template v-if=\"hasSlot('content') && item.content\" #content>\n <slot name=\"content\" v-bind=\"item\"></slot>\n </template>\n <template v-if=\"hasSlot('dynamicContent') && item.dynamicContent\" #dynamicContent>\n <slot name=\"dynamicContent\" v-bind=\"item\"></slot>\n </template>\n </bento-selection-card>\n </div>\n <template v-else>\n <div :key=\"`selection-card-group-layout-breakpoint-${currentBreakpoint}`\">\n <grid-layout\n v-for=\"(row, rowIndex) in computedRows\"\n :key=\"`selection-card-group-row-${rowIndex}-cols-${computedItemsPerRow}`\"\n class=\"b-selection-card-group__items--wrap\"\n :column-width=\"computedColumnWidth\"\n >\n <template v-for=\"(item, columnIndex) in row\" #[`col-${columnIndex+1}`]>\n <bento-selection-card\n :key=\"`selection-card-${item.value}`\"\n class=\"b-selection-card-group__item b-selection-card-group__item--full-height\"\n v-bind=\"item\"\n :model-value=\"inputValue\"\n :readonly=\"readonly || item.readonly\"\n :has-error=\"shouldShowGroupError\"\n :disabled=\"disabled || item.disabled\"\n @update:model-value=\"onInput\"\n >\n <template v-if=\"hasSlot('icon') && item.icon\" #icon>\n <slot name=\"icon\" v-bind=\"item\"></slot>\n </template>\n <template v-if=\"hasSlot('content') && item.content\" #content>\n <slot name=\"content\" v-bind=\"item\"></slot>\n </template>\n <template v-if=\"hasSlot('dynamicContent') && item.dynamicContent\" #dynamicContent>\n <slot name=\"dynamicContent\" v-bind=\"item\"></slot>\n </template>\n </bento-selection-card>\n </template>\n </grid-layout>\n </div>\n </template>\n <error-message\n v-if=\"shouldShowGroupError\"\n :id=\"errorMessageId\"\n :error-message=\"errorMessage\"\n class=\"b-selection-card-group__error-message\"\n />\n </controls-group>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, onMounted, provide, ref, useSlots, watch } from 'vue';\n import { useElementSize } from '@vueuse/core';\n import { BMediaQueryMMax, BMediaQuerySMax } from '@adyen/bento-design-tokens/dist/js/bento/es6';\n import { type BentoSelectionCardGroupProps } from './selection-card-group.types';\n import BentoSelectionCard from '../../selection-card.vue';\n import { ControlsGroup, ErrorMessage, GridLayout } from '../../../internal';\n import { type BentoSelectionCardModelValue } from '../../selection-card.types';\n import { SELECTION_CARD_RADIO_INPUT_INJECTION_KEY } from '../../selection-card.keys';\n import { generateUid } from '@/core/utils/ts';\n\n const props = defineProps({\n description: { default: null },\n disabled: { type: Boolean, default: false },\n errorMessage: { default: null },\n label: { default: null },\n optional: { type: Boolean, default: false },\n placeholder: null,\n readonly: { type: Boolean, default: false },\n required: { type: Boolean, default: false },\n tooltipText: { default: null },\n formId: { default: null },\n hideLabel: { type: Boolean, default: null },\n layout: { default: 'vertical' },\n items: null,\n itemsPerRow: { default: undefined },\n modelValue: { default: null },\n variant: { default: 'checkbox' }\n});\n\n const emit = defineEmits([\"input\", \"update:model-value\"]);\n const slots = useSlots();\n // Slots logic\n // Temporary, use-has-slots composable doesn't currently work for vue3 named scoped slots\n // We do the same in bento-checkbox-group\n const hasSlot = name => !!slots[name];\n\n const conditionalItemsClasses = computed(() => ({\n 'b-selection-card-group__items--horizontal': props.layout === 'horizontal',\n }));\n\n const inputValue = ref(props.modelValue);\n watch(\n () => props.modelValue,\n () => {\n inputValue.value = props.modelValue;\n }\n );\n\n // Error message logic\n const errorMessageId = generateUid('error');\n const shouldShowGroupError = computed(() => !props.disabled && !props.readonly && !!props.errorMessage);\n\n // itemsPerRow logic\n const containerRef = ref<HTMLElement | null>(null);\n const { width } = useElementSize(containerRef);\n\n const smallBreakpoint = computed(() => BMediaQuerySMax.split('px')[0]);\n const mediumBreakpoint = computed(() => BMediaQueryMMax.split('px')[0]);\n\n const currentBreakpoint = computed(() => {\n if (width.value < smallBreakpoint.value) {\n return 'small';\n }\n if (width.value >= smallBreakpoint.value && width.value < mediumBreakpoint.value) {\n return 'medium';\n }\n return 'large';\n });\n\n const computedItemsPerRow = computed(() => {\n return (props.itemsPerRow?.[currentBreakpoint?.value] as number) || props.items.length;\n });\n\n const computedRows = computed(() => {\n if (!props.itemsPerRow) {\n return [];\n }\n const rows = [];\n for (let i = 0; i < props.items.length; i += computedItemsPerRow?.value) {\n rows.push(props.items.slice(i, i + computedItemsPerRow?.value));\n }\n return rows;\n });\n\n // We need to compute the column width on 12 because we're using a 12-column system for out grid-layout logic\n const itemColumnWidth = computed(() => 12 / computedItemsPerRow?.value);\n\n /**\n * Filling the columnWidth array with the same parameters per item to pass\n * to the `grid-layout` layout so the each card can have\n * the same width according to the screen size.\n */\n const computedColumnWidth = computed(() => {\n return computedItemsPerRow?.value\n ? new Array(computedItemsPerRow?.value).fill({\n // Instead of passing the actual screen sizes values, passing the same values per each screen size and recomputing it makes sure visually the change is smoother and not laggy\n small: itemColumnWidth.value,\n medium: itemColumnWidth.value,\n large: itemColumnWidth.value,\n })\n : [];\n });\n\n const onInput = value => {\n inputValue.value = value;\n emit('update:model-value', value);\n emit('input', value);\n };\n\n const isRadioVariant = computed(() => props.variant === 'radio');\n\n provide(SELECTION_CARD_RADIO_INPUT_INJECTION_KEY, isRadioVariant);\n\n onMounted(() => {\n if (props.itemsPerRow) {\n Object.values(props.itemsPerRow).forEach(el => {\n if (el && (el < 2 || el > 6)) {\n throw new Error(\n 'itemsPerRow values must have a value between 2 and 6 items per row. Read the documentation for more information.'\n );\n }\n });\n }\n });\n</script>\n\n<script lang=\"ts\">\n /**\n * Group of bento-selection-cards.\n *\n * @example\n * import { BentoSelectionCardGroup } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoSelectionCardGroup },\n * template: `\n * <bento-selection-card-group\n * :items=\"[\n * {\n * title: 'Card 1',\n * value: 'card-1',\n * content: 'Slot content 1',\n * icon: RetailIcon,\n * },\n * {\n * title: 'Card 2',\n * value: 'card-2',\n * content: 'Slot content 2',\n * icon: LeafIcon,\n * },\n * ]\"\n * >\n * <template #icon=\"{ icon }\">\n * <component :is=\"icon\"/>\n * </template>\n * <template #content=\"{ content }\">\n * <div>{{ content }}</div>\n * </template>\n * </bento-selection-card-group>\n * `,\n * }\n */\n export default {};\n</script>\n\n<style lang=\"scss\" scoped src=\"./selection-card-group.scss\" />\n"],"names":["BentoSelectionCardState","BentoSelectionCardState2","SELECTION_CARD_RADIO_INPUT_INJECTION_KEY","__default__$1","slots","useSlots","hasSlot","useHasSlot","inputId","generateUid","descriptionId","computedRadioInputModelValue","computed","props","computedCheckboxInputModelValue","conditionalClasses","isChecked","containerConditionalClasses","isTitleOnly","checkboxContainerConditionalClasses","checkboxContainerTextConditionalClasses","slotConditionalClasses","ariaLabel","useAriaLabel","isCheckboxGroup","isRadioInput","item","inject","ref","inputRef","slotRef","dynamicSlotRef","handleCardClick","event","newValue2","toggleInput","onChange","_b","_a","_d","_c","_f","_e","newValue","currentValue","newCheckedList","index","emit","__default__","name","conditionalItemsClasses","inputValue","watch","errorMessageId","shouldShowGroupError","containerRef","width","useElementSize","smallBreakpoint","BMediaQuerySMax","mediumBreakpoint","BMediaQueryMMax","currentBreakpoint","computedItemsPerRow","computedRows","rows","i","itemColumnWidth","computedColumnWidth","onInput","value","isRadioVariant","provide","onMounted","el"],"mappings":";;;;;;;;;;;;;;AAIY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,WAAA,YACAA,EAAA,WAAA,YACAA,EAAA,QAAA,SAHQA,IAAAD,KAAA,CAAA,CAAA;ACJC,MAAAE,IAAA,OAAA,0CAAA,GCmTTC,KAAA;AAAA,EAAe,MAAA;AAEf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBArJAC,IAAAC,EAAA,GACAC,IAAAC,EAAAH,CAAA,GAEAI,IAAAC,EAAA,yBAAA,GACAC,IAAAD,EAAA,4BAAA,GAEAE,IAAAC;AAAA,MAAmE,MAAAC,EAAA;AAAA,IACnD,GAEhBC,IAAAF;AAAA,MAAwE,MAAAC,EAAA;AAAA,IACxD,GAGhBE,IAAAH,EAAA,OAAA;AAAA,MAA2C,6BAAAI,EAAA;AAAA,MACA,qCAAAH,EAAA;AAAA,IACI,EAAA,GAG/CI,IAAAL,EAAA,OAAA;AAAA,MAAoD,CAAA,qBAAAZ,EAAA,QAAA,EAAA,GAAA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EAAAtE,GAAAqE,CAAA,GAEAE,EAAA,MAAA;AACI,MAAA5D,EAAA,eACI,OAAA,OAAAA,EAAA,WAAA,EAAA,QAAA,CAAA6D,MAAA;AACI,YAAAA,MAAAA,IAAA,KAAAA,IAAA;AACI,gBAAA,IAAA;AAAA,YAAU;AAAA,UACN;AAAA,MAER,CAAA;AAAA,IAER,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"selection-card-group.u-2Y_9o2.js","sources":["../../src/components/selection-card/selection-card.types.ts","../../src/components/selection-card/selection-card.keys.ts","../../src/components/selection-card/selection-card.vue","../../src/components/selection-card/components/selection-card-group/selection-card-group.vue"],"sourcesContent":["import { type RadioInputValue } from '@/components/internal/radio-input';\nimport { type BentoCheckboxType } from '../checkbox/checkbox.types';\nimport { type VueNodeElement } from '@/types/elements';\n\nexport enum BentoSelectionCardState {\n DISABLED = 'disabled',\n READONLY = 'readonly',\n ERROR = 'error',\n}\n\nexport type BentoSelectionCardValue = string | number;\n\nexport type BentoSelectionCardModelValue = BentoCheckboxType | RadioInputValue;\n\nexport interface BentoSelectionCardItem {\n content?: string | object;\n description?: string;\n disabled?: boolean;\n dynamicContent?: string | object;\n fullyClickable?: boolean;\n hasError?: boolean;\n icon?: VueNodeElement;\n readonly?: boolean;\n subtitle?: string;\n title: string;\n value: BentoSelectionCardValue;\n}\n","export const SELECTION_CARD_RADIO_INPUT_INJECTION_KEY = Symbol('selection card radio input injection key');\n","<template>\n <div class=\"b-selection-card\" :class=\"conditionalClasses\" @click=\"handleCardClick\">\n <div class=\"b-selection-card__container\" :class=\"containerConditionalClasses\">\n <div class=\"b-selection-card__checkbox-container\" :class=\"checkboxContainerConditionalClasses\">\n <div class=\"b-selection-card__checkbox-container-text\" :class=\"checkboxContainerTextConditionalClasses\">\n <div v-if=\"hasSlot('icon')\" class=\"b-selection-card__icon\" role=\"presentation\">\n <slot name=\"icon\" />\n </div>\n <label :for=\"inputId\" class=\"b-selection-card__text\" @click.stop.prevent=\"handleCardClick\">\n <bento-typography\n v-if=\"subtitle\"\n class=\"b-selection-card__description\"\n el=\"span\"\n variant=\"caption\"\n >\n {{ subtitle }}\n </bento-typography>\n <bento-typography el=\"span\" variant=\"title\">{{ title }}</bento-typography>\n <bento-typography\n v-if=\"description\"\n id=\"descriptionId\"\n class=\"b-selection-card__description\"\n el=\"span\"\n variant=\"body\"\n >\n {{ description }}\n </bento-typography>\n </label>\n </div>\n <radio-input\n v-if=\"isRadioInput\"\n :id=\"inputId\"\n ref=\"inputRef\"\n :aria-label=\"ariaLabel\"\n :aria-describedby=\"description ? descriptionId : undefined\"\n :disabled=\"disabled\"\n :has-error=\"hasError\"\n :aria-readonly=\"readonly ?? undefined\"\n :value=\"value\"\n :readonly=\"readonly\"\n :model-value=\"computedRadioInputModelValue\"\n />\n <checkbox-input\n v-else\n :id=\"inputId\"\n ref=\"inputRef\"\n :aria-label=\"ariaLabel\"\n :aria-describedby=\"description ? descriptionId : undefined\"\n :disabled=\"disabled\"\n :has-error=\"hasError\"\n :aria-readonly=\"readonly ?? undefined\"\n :value=\"value\"\n :readonly=\"readonly\"\n :model-value=\"computedCheckboxInputModelValue\"\n />\n </div>\n <bento-typography\n v-if=\"hasSlot('content')\"\n ref=\"slotRef\"\n el=\"div\"\n class=\"b-selection-card__slot\"\n :class=\"slotConditionalClasses\"\n >\n <slot name=\"content\" />\n </bento-typography>\n <bento-typography\n v-if=\"hasSlot('dynamicContent') && isChecked\"\n ref=\"dynamicSlotRef\"\n el=\"div\"\n class=\"b-selection-card__slot\"\n :class=\"slotConditionalClasses\"\n >\n <slot name=\"dynamicContent\" />\n </bento-typography>\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { BentoTypography } from '@/components/typography';\n import { type BentoCheckboxType, type BentoMultiCheckboxType, CheckboxInput } from '../internal/checkbox-input';\n import { RadioInput, type RadioInputValue } from '../internal/radio-input';\n import { useAriaLabel } from '@/utils/ts/aria-label';\n import { generateUid } from '@/core/utils/ts';\n import { computed, type ComputedRef, inject, type PropType, type Ref, ref, useSlots } from 'vue';\n import { useHasSlot } from '@/composables';\n import type { BentoSelectionCardModelValue, BentoSelectionCardValue } from './selection-card.types';\n import { BentoSelectionCardState } from './selection-card.types';\n import { SELECTION_CARD_RADIO_INPUT_INJECTION_KEY } from './selection-card.keys';\n\n const props = defineProps({\n /**\n * The description of the selection card\n */\n description: {\n type: String,\n default: undefined,\n },\n\n /**\n * Disables the selection card\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Makes the entire selection card clickable. Clicking over interactive elements inside the card with this prop enabled will not be possible.\n */\n fullyClickable: { type: Boolean, default: false },\n\n /**\n * Shows the selection card in error state\n */\n hasError: { type: Boolean, default: false },\n\n /**\n * This property should not be used directly.\n * It will be used by v-model directive on selection card component.\n *\n * When handling a single input, use a string or a number.\n *\n * When handling multiple inputs, use an array of keys.\n * These keys exist as a set \"value\" prop for each input.\n */\n modelValue: {\n type: [Boolean, String, Array] as PropType<BentoSelectionCardModelValue>,\n default: null,\n },\n\n /**\n * Sets the selection card to readonly\n */\n readonly: { type: Boolean, default: false },\n\n /**\n * The subtitle of the selection card\n */\n subtitle: {\n type: String,\n default: undefined,\n },\n\n /**\n * The title of the selection card\n */\n title: {\n type: String,\n required: true,\n },\n\n /**\n * Indicates the value of the input that will be returned when it's checked.\n */\n value: {\n type: [String, Number] as PropType<BentoSelectionCardValue>,\n required: true,\n },\n });\n\n const emit = defineEmits([\"input\", \"update:model-value\"]);\n\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n\n const inputId = generateUid('selection-card-input-id');\n const descriptionId = generateUid('selection-card-description');\n\n const computedRadioInputModelValue: ComputedRef<RadioInputValue> = computed(\n () => props.modelValue as RadioInputValue\n );\n const computedCheckboxInputModelValue: ComputedRef<BentoCheckboxType> = computed(\n () => props.modelValue as BentoCheckboxType\n );\n\n const conditionalClasses = computed(() => ({\n 'b-selection-card--checked': isChecked.value,\n 'b-selection-card--fully-clickable': props.fullyClickable,\n }));\n\n const containerConditionalClasses = computed(() => ({\n [`b-selection-card--${BentoSelectionCardState.DISABLED}`]: props.disabled,\n [`b-selection-card--${BentoSelectionCardState.ERROR}`]: props.hasError,\n [`b-selection-card--${BentoSelectionCardState.READONLY}`]: props.readonly,\n 'b-selection-card--center-aligned': isTitleOnly.value,\n }));\n\n const checkboxContainerConditionalClasses = computed(() => ({\n 'b-selection-card__checkbox-container--center-aligned': isTitleOnly.value,\n }));\n\n const checkboxContainerTextConditionalClasses = computed(() => ({\n 'b-selection-card__checkbox-container-text--center-aligned': isTitleOnly.value,\n }));\n\n const slotConditionalClasses = computed(() => ({\n 'b-selection-card__slot--with-icon': hasSlot('icon'),\n }));\n\n const ariaLabel = useAriaLabel({\n ariaLabel: props.title,\n label: props.value as string,\n });\n\n const isCheckboxGroup = computed(() => Array.isArray(props.modelValue));\n\n const isChecked: ComputedRef<boolean> = computed(() => {\n if (isRadioInput.value) {\n return props.value === props.modelValue;\n }\n if (!isCheckboxGroup.value) {\n return props.modelValue as boolean;\n }\n\n return (props.modelValue as BentoMultiCheckboxType).some(item => item === props.value);\n });\n\n const isRadioInput: Ref<boolean> = inject(SELECTION_CARD_RADIO_INPUT_INJECTION_KEY, ref(false));\n\n const isTitleOnly = computed(() => !props.subtitle && !props.description);\n\n const inputRef = ref<InstanceType<typeof RadioInput> | InstanceType<typeof CheckboxInput>>(null);\n const slotRef = ref(null);\n const dynamicSlotRef = ref(null);\n\n // Handle click on the whole card area\n const handleCardClick = (event: Event) => {\n if (inputRef.value.$refs.inputRef === event.target) {\n const newValue = toggleInput();\n onChange(newValue);\n return;\n }\n\n // Do nothing if disabled or readonly\n if (props.disabled && props.readonly) {\n return;\n }\n\n // If it's not fully clickable prevent selecting the card if the click\n // originated in a slot\n if (!props.fullyClickable) {\n // Check if the click originated from the slot - in that case, do nothng\n if (slotRef.value && slotRef.value?.$el?.contains(event.target)) {\n return;\n }\n // Check if the click originated from the dynamic slot - in that case, do nothng\n if (dynamicSlotRef.value && dynamicSlotRef.value?.$el?.contains(event.target)) {\n return;\n }\n // Check if the click originated from the input - in that case do nothing, as the input will emit the event already\n if (inputRef.value && inputRef.value?.$el?.contains(event.target as Node)) {\n return;\n }\n }\n\n // If the click originated outside of these two areas, emit the change event\n const newValue = toggleInput();\n\n onChange(newValue);\n };\n\n const toggleInput = (): BentoSelectionCardModelValue => {\n const currentValue: boolean = (inputRef.value?.$refs.inputRef as HTMLInputElement).checked;\n\n if (isCheckboxGroup.value) {\n const newCheckedList = [...(props.modelValue as BentoMultiCheckboxType)];\n const index = newCheckedList.indexOf(props.value);\n\n if (index === -1) {\n newCheckedList.push(props.value);\n } else {\n newCheckedList.splice(index, 1);\n }\n return newCheckedList;\n }\n\n if (isRadioInput.value) {\n return props.value;\n }\n return currentValue;\n };\n\n const onChange = newValue => {\n if (!props.disabled && !props.readonly) {\n emit('update:model-value', newValue);\n emit('input', newValue);\n }\n };\n</script>\n\n<script lang=\"ts\">\n /**\n * Selection card component. If used standalone, only the checkbox variant can be used. If the checkbox variant is needed, please use the bento-selection-card-group component.\n *\n * @example\n * import { BentoSelectionCard } from '@adyen/bento-vue2';\n * import EmoticonHappyIcon from '@adyen/ui-assets-icons-16/vue/emoticon-happy';\n *\n * export default {\n * components: { BentoSelectionCard, EmoticonHappyIcon },\n * template: `\n * <bento-selection-card title=\"Card title\" :model-value.sync=\"yourModelValue\">\n * <template #icon>\n * <emoticon-happy-icon />\n * </template>\n * </bento-selection-card>\n * `\n * }\n */\n export default {\n name: 'bento-selection-card',\n };\n</script>\n<style lang=\"scss\" scoped src=\"./selection-card.scss\" />\n","<template>\n <controls-group\n ref=\"containerRef\"\n :aria-describedby=\"shouldShowGroupError ? errorMessageId : null\"\n :label=\"label\"\n :hide-label=\"hideLabel\"\n :description=\"description\"\n :disabled=\"disabled\"\n :tooltip-text=\"tooltipText\"\n :readonly=\"readonly\"\n :required=\"required\"\n :optional=\"optional\"\n class=\"b-selection-card-group\"\n component-name=\"selection-card-group\"\n >\n <div\n v-if=\"!itemsPerRow || layout === 'vertical'\"\n class=\"b-selection-card-group__items\"\n :class=\"conditionalItemsClasses\"\n >\n <bento-selection-card\n v-for=\"item in items\"\n :key=\"`selection-card-${item.value}`\"\n class=\"b-selection-card-group__item\"\n v-bind=\"item\"\n :model-value=\"inputValue\"\n :readonly=\"readonly || item.readonly\"\n :has-error=\"shouldShowGroupError\"\n :disabled=\"disabled || item.disabled\"\n @update:model-value=\"onInput\"\n >\n <template v-if=\"hasSlot('icon') && item.icon\" #icon>\n <slot name=\"icon\" v-bind=\"item\"></slot>\n </template>\n <template v-if=\"hasSlot('content') && item.content\" #content>\n <slot name=\"content\" v-bind=\"item\"></slot>\n </template>\n <template v-if=\"hasSlot('dynamicContent') && item.dynamicContent\" #dynamicContent>\n <slot name=\"dynamicContent\" v-bind=\"item\"></slot>\n </template>\n </bento-selection-card>\n </div>\n <template v-else>\n <div :key=\"`selection-card-group-layout-breakpoint-${currentBreakpoint}`\">\n <grid-layout\n v-for=\"(row, rowIndex) in computedRows\"\n :key=\"`selection-card-group-row-${rowIndex}-cols-${computedItemsPerRow}`\"\n class=\"b-selection-card-group__items--wrap\"\n :column-width=\"computedColumnWidth\"\n >\n <template v-for=\"(item, columnIndex) in row\" #[`col-${columnIndex+1}`]>\n <bento-selection-card\n :key=\"`selection-card-${item.value}`\"\n class=\"b-selection-card-group__item b-selection-card-group__item--full-height\"\n v-bind=\"item\"\n :model-value=\"inputValue\"\n :readonly=\"readonly || item.readonly\"\n :has-error=\"shouldShowGroupError\"\n :disabled=\"disabled || item.disabled\"\n @update:model-value=\"onInput\"\n >\n <template v-if=\"hasSlot('icon') && item.icon\" #icon>\n <slot name=\"icon\" v-bind=\"item\"></slot>\n </template>\n <template v-if=\"hasSlot('content') && item.content\" #content>\n <slot name=\"content\" v-bind=\"item\"></slot>\n </template>\n <template v-if=\"hasSlot('dynamicContent') && item.dynamicContent\" #dynamicContent>\n <slot name=\"dynamicContent\" v-bind=\"item\"></slot>\n </template>\n </bento-selection-card>\n </template>\n </grid-layout>\n </div>\n </template>\n <error-message\n v-if=\"shouldShowGroupError\"\n :id=\"errorMessageId\"\n :error-message=\"errorMessage\"\n class=\"b-selection-card-group__error-message\"\n />\n </controls-group>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, onMounted, provide, ref, useSlots, watch } from 'vue';\n import { useElementSize } from '@vueuse/core';\n import { BMediaQueryMMax, BMediaQuerySMax } from '@adyen/bento-design-tokens/dist/js/bento/es6';\n import { type BentoSelectionCardGroupEmits, type BentoSelectionCardGroupProps } from './selection-card-group.types';\n import BentoSelectionCard from '../../selection-card.vue';\n import { ControlsGroup, ErrorMessage, GridLayout } from '../../../internal';\n import { SELECTION_CARD_RADIO_INPUT_INJECTION_KEY } from '../../selection-card.keys';\n import { generateUid } from '@/core/utils/ts';\n import { useFormFieldEmits } from '@/utils/ts/form-field/form-field';\n\n const props = defineProps({\n description: { default: null },\n disabled: { type: Boolean, default: false },\n errorMessage: { default: null },\n label: { default: null },\n optional: { type: Boolean, default: false },\n placeholder: null,\n readonly: { type: Boolean, default: false },\n required: { type: Boolean, default: false },\n tooltipText: { default: null },\n formId: { default: null },\n hideLabel: { type: Boolean, default: null },\n layout: { default: 'vertical' },\n items: null,\n itemsPerRow: { default: undefined },\n modelValue: { default: null },\n variant: { default: 'checkbox' }\n});\n\n const emit = defineEmits([\"update:model-value\", \"input\"]);\n\n const { emitValue } = useFormFieldEmits(emit);\n\n const slots = useSlots();\n // Slots logic\n // Temporary, use-has-slots composable doesn't currently work for vue3 named scoped slots\n // We do the same in bento-checkbox-group\n const hasSlot = name => !!slots[name];\n\n const conditionalItemsClasses = computed(() => ({\n 'b-selection-card-group__items--horizontal': props.layout === 'horizontal',\n }));\n\n const inputValue = ref(props.modelValue);\n watch(\n () => props.modelValue,\n () => {\n inputValue.value = props.modelValue;\n }\n );\n\n // Error message logic\n const errorMessageId = generateUid('error');\n const shouldShowGroupError = computed(() => !props.disabled && !props.readonly && !!props.errorMessage);\n\n // itemsPerRow logic\n const containerRef = ref<HTMLElement | null>(null);\n const { width } = useElementSize(containerRef);\n\n const smallBreakpoint = computed(() => BMediaQuerySMax.split('px')[0]);\n const mediumBreakpoint = computed(() => BMediaQueryMMax.split('px')[0]);\n\n const currentBreakpoint = computed(() => {\n if (width.value < smallBreakpoint.value) {\n return 'small';\n }\n if (width.value >= smallBreakpoint.value && width.value < mediumBreakpoint.value) {\n return 'medium';\n }\n return 'large';\n });\n\n const computedItemsPerRow = computed(() => {\n return (props.itemsPerRow?.[currentBreakpoint?.value] as number) || props.items.length;\n });\n\n const computedRows = computed(() => {\n if (!props.itemsPerRow) {\n return [];\n }\n const rows = [];\n for (let i = 0; i < props.items.length; i += computedItemsPerRow?.value) {\n rows.push(props.items.slice(i, i + computedItemsPerRow?.value));\n }\n return rows;\n });\n\n // We need to compute the column width on 12 because we're using a 12-column system for out grid-layout logic\n const itemColumnWidth = computed(() => 12 / computedItemsPerRow?.value);\n\n /**\n * Filling the columnWidth array with the same parameters per item to pass\n * to the `grid-layout` layout so the each card can have\n * the same width according to the screen size.\n */\n const computedColumnWidth = computed(() => {\n return computedItemsPerRow?.value\n ? new Array(computedItemsPerRow?.value).fill({\n // Instead of passing the actual screen sizes values, passing the same values per each screen size and recomputing it makes sure visually the change is smoother and not laggy\n small: itemColumnWidth.value,\n medium: itemColumnWidth.value,\n large: itemColumnWidth.value,\n })\n : [];\n });\n\n const onInput = value => {\n inputValue.value = value;\n emitValue(value);\n };\n\n const isRadioVariant = computed(() => props.variant === 'radio');\n\n provide(SELECTION_CARD_RADIO_INPUT_INJECTION_KEY, isRadioVariant);\n\n onMounted(() => {\n if (props.itemsPerRow) {\n Object.values(props.itemsPerRow).forEach(el => {\n if (el && (el < 2 || el > 6)) {\n throw new Error(\n 'itemsPerRow values must have a value between 2 and 6 items per row. Read the documentation for more information.'\n );\n }\n });\n }\n });\n</script>\n\n<script lang=\"ts\">\n /**\n * Group of bento-selection-cards.\n *\n * @example\n * import { BentoSelectionCardGroup } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoSelectionCardGroup },\n * template: `\n * <bento-selection-card-group\n * :items=\"[\n * {\n * title: 'Card 1',\n * value: 'card-1',\n * content: 'Slot content 1',\n * icon: RetailIcon,\n * },\n * {\n * title: 'Card 2',\n * value: 'card-2',\n * content: 'Slot content 2',\n * icon: LeafIcon,\n * },\n * ]\"\n * >\n * <template #icon=\"{ icon }\">\n * <component :is=\"icon\"/>\n * </template>\n * <template #content=\"{ content }\">\n * <div>{{ content }}</div>\n * </template>\n * </bento-selection-card-group>\n * `,\n * }\n */\n export default {\n model: { prop: 'modelValue' },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./selection-card-group.scss\" />\n"],"names":["BentoSelectionCardState","BentoSelectionCardState2","SELECTION_CARD_RADIO_INPUT_INJECTION_KEY","__default__$1","slots","useSlots","hasSlot","useHasSlot","inputId","generateUid","descriptionId","computedRadioInputModelValue","computed","props","computedCheckboxInputModelValue","conditionalClasses","isChecked","containerConditionalClasses","isTitleOnly","checkboxContainerConditionalClasses","checkboxContainerTextConditionalClasses","slotConditionalClasses","ariaLabel","useAriaLabel","isCheckboxGroup","isRadioInput","item","inject","ref","inputRef","slotRef","dynamicSlotRef","handleCardClick","event","newValue2","toggleInput","onChange","_b","_a","_d","_c","_f","_e","newValue","currentValue","newCheckedList","index","emit","__default__","emitValue","useFormFieldEmits","name","conditionalItemsClasses","inputValue","watch","errorMessageId","shouldShowGroupError","containerRef","width","useElementSize","smallBreakpoint","BMediaQuerySMax","mediumBreakpoint","BMediaQueryMMax","currentBreakpoint","computedItemsPerRow","computedRows","rows","i","itemColumnWidth","computedColumnWidth","onInput","value","isRadioVariant","provide","onMounted","el"],"mappings":";;;;;;;;;;;;;;;AAIY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,WAAA,YACAA,EAAA,WAAA,YACAA,EAAA,QAAA,SAHQA,IAAAD,KAAA,CAAA,CAAA;ACJC,MAAA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,EAAA;AACI,QAAAE,EAAA,KAAAtD,EAAA,MAAA,MAAAuD,GAAAA,KAAAH,KAAA,gBAAAA,EAAA,MAAA,CAAA;AAEJ,aAAAE;AAAA,IAAO,CAAA,GAIXE,IAAAzD,EAAA,MAAA,MAAAqD,KAAA,gBAAAA,EAAA,MAAA,GAOAK,IAAA1D,EAAA,MACIqD,KAAA,QAAAA,EAAA,QAAA,IAAA,MAAAA,KAAA,gBAAAA,EAAA,KAAA,EAAA,KAAA;AAAA;AAAA,MACiD,OAAAI,EAAA;AAAA,MAEhB,QAAAA,EAAA;AAAA,MACC,OAAAA,EAAA;AAAA,IACD,CAAA,IAAA,CAAA,CAE1B,GAGXE,IAAA,CAAAC,MAAA;AACI,MAAAnB,EAAA,QAAAmB,GACAvB,EAAAuB,CAAA;AAAA,IAAe,GAGnBC,IAAA7D,EAAA,MAAAC,EAAA,YAAA,OAAA;AAEA,WAAA6D,EAAAxE,GAAAuE,CAAA,GAEAE,EAAA,MAAA;AACI,MAAA9D,EAAA,eACI,OAAA,OAAAA,EAAA,WAAA,EAAA,QAAA,CAAA+D,MAAA;AACI,YAAAA,MAAAA,IAAA,KAAAA,IAAA;AACI,gBAAA,IAAA;AAAA,YAAU;AAAA,UACN;AAAA,MAER,CAAA;AAAA,IAER,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/data-grid.js CHANGED
@@ -1,4 +1,4 @@
1
- import { g as e, d as o, a as r, b as n, f as i, e as B, c as d, B as s } from "./chunks/data-grid.B-kBw540.js";
1
+ import { g as e, d as o, a as r, b as n, f as i, e as B, c as d, B as s } from "./chunks/data-grid.BhwTkhfk.js";
2
2
  export {
3
3
  e as BentoColumnOverflow,
4
4
  o as BentoDataGrid,
@@ -1,9 +1,10 @@
1
- import { B as t, a as n } from "./chunks/date-range-picker.BtPxkPN0.js";
2
- import { C as o, a as i } from "./chunks/calendar.Fm_dfQC5.js";
1
+ import { B as t } from "./chunks/date-range-picker.CmKA76Yu.js";
2
+ import { B as n } from "./chunks/date-range-picker.types.Ckt7zxGy.js";
3
+ import { C as i, a as B } from "./chunks/calendar.Fm_dfQC5.js";
3
4
  export {
4
5
  t as BentoDateRangePicker,
5
6
  n as BentoDateRangePickerEvent,
6
- o as BentoDateRangePickerFirstDayOfWeek,
7
- i as BentoDateRangePickerVariant
7
+ i as BentoDateRangePickerFirstDayOfWeek,
8
+ B as BentoDateRangePickerVariant
8
9
  };
9
10
  //# sourceMappingURL=date-range-picker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"date-range-picker.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
1
+ {"version":3,"file":"date-range-picker.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -1,4 +1,4 @@
1
- import { a, B as r, c as B, b as n, d as o } from "./chunks/filter-bar.BLnSnOlj.js";
1
+ import { a, B as r, c as B, b as n, d as o } from "./chunks/filter-bar.Bj4LgjzJ.js";
2
2
  export {
3
3
  a as BentoBaseFilter,
4
4
  r as BentoFilterBar,
@@ -1,4 +1,4 @@
1
- import { h as r } from "./chunks/header-with-views.C6Y7mAkq.js";
1
+ import { h as r } from "./chunks/header-with-views.D6JUlnEf.js";
2
2
  export {
3
3
  r as BentoHeaderWithViews
4
4
  };