@adyen/bento-vue3 1.28.0 → 1.28.1

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 (28) hide show
  1. package/dist/@types/packages/vue2/src/components/segmented-control/segmented-control.vue.d.ts +2 -2
  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/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/menu.css +1 -1
  9. package/dist/assets/modal-fullscreen.css +1 -1
  10. package/dist/assets/popover.css +1 -1
  11. package/dist/assets/segmented-control.css +1 -1
  12. package/dist/assets/sidepanel.css +1 -1
  13. package/dist/chunks/{data-grid.BwfZhc09.js → data-grid.CTLlk_RW.js} +2 -2
  14. package/dist/chunks/{data-grid.BwfZhc09.js.map → data-grid.CTLlk_RW.js.map} +1 -1
  15. package/dist/chunks/{date-range-picker.CiwDo2jW.js → date-range-picker.C36PxTCQ.js} +2 -2
  16. package/dist/chunks/{date-range-picker.CiwDo2jW.js.map → date-range-picker.C36PxTCQ.js.map} +1 -1
  17. package/dist/chunks/{filter-bar.U2ZcPmSU.js → filter-bar.DmPkRBf4.js} +2 -2
  18. package/dist/chunks/{filter-bar.U2ZcPmSU.js.map → filter-bar.DmPkRBf4.js.map} +1 -1
  19. package/dist/chunks/{segmented-control.NnFfAdTq.js → segmented-control.DyINOWUl.js} +11 -11
  20. package/dist/chunks/segmented-control.DyINOWUl.js.map +1 -0
  21. package/dist/data-grid.js +1 -1
  22. package/dist/date-range-picker.js +1 -1
  23. package/dist/filter-bar.js +1 -1
  24. package/dist/index.js +4 -4
  25. package/dist/segmented-control.js +1 -1
  26. package/dist/web-types.json +1 -1
  27. package/package.json +2 -2
  28. package/dist/chunks/segmented-control.NnFfAdTq.js.map +0 -1
@@ -20,7 +20,7 @@ const O = ["id", "aria-checked", "aria-label", "checked", "disabled", "value"],
20
20
  },
21
21
  emits: ["update:model-value"],
22
22
  setup(o, { emit: b }) {
23
- const e = o, p = m(), r = U("segmented-control-button"), a = c(() => e.value === e.modelValue), d = c(() => ({
23
+ const e = o, p = m(), d = U("segmented-control-button"), a = c(() => e.value === e.modelValue), r = c(() => ({
24
24
  "b-segmented-control-button--hug-content": !e.fullWidth,
25
25
  "b-segmented-control-button--full-width": e.fullWidth,
26
26
  "b-segmented-control-button--truncate": e.truncate,
@@ -29,10 +29,10 @@ const O = ["id", "aria-checked", "aria-label", "checked", "disabled", "value"],
29
29
  e.disabled || b("update:model-value", e.value);
30
30
  };
31
31
  return (g, v) => (i(), f("div", {
32
- class: _(["b-segmented-control-button", t(d)])
32
+ class: _(["b-segmented-control-button", t(r)])
33
33
  }, [
34
34
  C("input", {
35
- id: t(r),
35
+ id: t(d),
36
36
  "aria-checked": t(a),
37
37
  "aria-label": o.label,
38
38
  checked: t(a),
@@ -45,7 +45,7 @@ const O = ["id", "aria-checked", "aria-label", "checked", "disabled", "value"],
45
45
  }, null, 40, O),
46
46
  o.label ? (i(), f("label", {
47
47
  key: 0,
48
- for: t(r),
48
+ for: t(d),
49
49
  class: "b-segmented-control-button__label-container"
50
50
  }, [
51
51
  k(t(z), {
@@ -77,7 +77,7 @@ const O = ["id", "aria-checked", "aria-label", "checked", "disabled", "value"],
77
77
  },
78
78
  emits: ["update:model-value"],
79
79
  setup(o, { emit: b }) {
80
- const e = o, p = I(e, "modelValue"), r = m(), a = m(), d = m(), s = c(() => !e.wrap);
80
+ const e = o, p = I(e, "modelValue"), d = m(), a = m(), r = m(), s = c(() => !e.wrap);
81
81
  L(
82
82
  () => e.items,
83
83
  () => {
@@ -87,9 +87,9 @@ const O = ["id", "aria-checked", "aria-label", "checked", "disabled", "value"],
87
87
  },
88
88
  { immediate: !0 }
89
89
  ), D(() => {
90
- F(r.value, () => {
90
+ F(d.value, () => {
91
91
  var l;
92
- r.value && (d.value = (l = a == null ? void 0 : a.value) == null ? void 0 : l.map(
92
+ d.value && (r.value = (l = a == null ? void 0 : a.value) == null ? void 0 : l.map(
93
93
  (u) => u.$refs.segmentedControlButtonLabel.$el.offsetWidth < u.$refs.segmentedControlButtonLabel.$el.scrollWidth
94
94
  ));
95
95
  });
@@ -99,7 +99,7 @@ const O = ["id", "aria-checked", "aria-label", "checked", "disabled", "value"],
99
99
  var n;
100
100
  return {
101
101
  ...l,
102
- tooltipText: s.value && ((n = d == null ? void 0 : d.value) != null && n[u]) ? l.label : void 0
102
+ tooltipText: s.value && ((n = r == null ? void 0 : r.value) != null && n[u]) ? l.label : void 0
103
103
  };
104
104
  })
105
105
  ), v = (l) => {
@@ -112,7 +112,7 @@ const O = ["id", "aria-checked", "aria-label", "checked", "disabled", "value"],
112
112
  }));
113
113
  return (l, u) => (i(), f("div", {
114
114
  ref_key: "segmentedControlRef",
115
- ref: r,
115
+ ref: d,
116
116
  role: "group",
117
117
  class: _(["b-segmented-control", t(w)])
118
118
  }, [
@@ -135,8 +135,8 @@ const O = ["id", "aria-checked", "aria-label", "checked", "disabled", "value"],
135
135
  ])), 128))
136
136
  ], 2));
137
137
  }
138
- }), ee = /* @__PURE__ */ B(J, [["__scopeId", "data-v-783f6ec5"]]);
138
+ }), ee = /* @__PURE__ */ B(J, [["__scopeId", "data-v-71d1a35c"]]);
139
139
  export {
140
140
  ee as B
141
141
  };
142
- //# sourceMappingURL=segmented-control.NnFfAdTq.js.map
142
+ //# sourceMappingURL=segmented-control.DyINOWUl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"segmented-control.DyINOWUl.js","sources":["../../../vue2/src/components/segmented-control/components/segmented-control-button/segmented-control-button.vue","../../../vue2/src/components/segmented-control/segmented-control.vue"],"sourcesContent":["<template>\n <div class=\"b-segmented-control-button\" :class=\"conditionalClasses\">\n <input\n :id=\"segmentedControlButtonId\"\n :aria-checked=\"isChecked\"\n :aria-label=\"label\"\n :checked=\"isChecked\"\n :disabled=\"disabled\"\n :value=\"value\"\n type=\"radio\"\n class=\"b-segmented-control-button__input\"\n role=\"radio\"\n @change=\"onClick\"\n />\n <label v-if=\"label\" :for=\"segmentedControlButtonId\" class=\"b-segmented-control-button__label-container\">\n <bento-typography\n ref=\"segmentedControlButtonLabel\"\n class=\"b-segmented-control-button__label\"\n el=\"span\"\n variant=\"body\"\n stronger\n >\n {{ label }}\n </bento-typography>\n </label>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { BentoTypography } from '@/components/typography';\n import { generateUid } from '@/utils/ts/unique-id';\n import { computed, ComputedRef, ref } from 'vue';\n\n const props = withDefaults(\n defineProps<{\n /**\n * Disable the radio button (optional)\n */\n disabled?: boolean;\n\n /**\n * Renders the button with a 100% width\n */\n fullWidth?: boolean;\n\n /**\n * The string the button will showcase\n */\n label: string;\n\n /**\n * This property should not be used directly.\n * It will be used by v-model directive on the segmented control component\n */\n modelValue?: string | number;\n\n /**\n * Renders the button with a truncated text if the space is not enough to render the whole content\n */\n truncate?: boolean;\n\n /**\n * Indicates the value of the input that will be returned when it's selected\n */\n value: string | number;\n\n /**\n * Renders the button with centered text in case the text has to wrap multiple lines\n */\n wrap?: boolean;\n }>(),\n {\n disabled: false,\n fullWidth: false,\n modelValue: null,\n truncate: false,\n wrap: false,\n }\n );\n\n const emit = defineEmits<{\n /**\n * Emitted every time the segmented control internal value is changed\n */\n (e: 'update:model-value', value: string | number);\n }>();\n\n const segmentedControlButtonLabel = ref();\n const segmentedControlButtonId = generateUid('segmented-control-button');\n const isChecked: ComputedRef<boolean> = computed(() => props.value === props.modelValue);\n const conditionalClasses = computed(() => ({\n 'b-segmented-control-button--hug-content': !props.fullWidth,\n 'b-segmented-control-button--full-width': props.fullWidth,\n 'b-segmented-control-button--truncate': props.truncate,\n 'b-segmented-control-button--wrap': props.wrap && !props.truncate,\n }));\n const onClick = () => {\n if (!props.disabled) {\n emit('update:model-value', props.value);\n }\n };\n</script>\n\n<script lang=\"ts\">\n /**\n * Internal component to be used within the BentoSegmentedControl component only\n */\n export default {\n name: 'bento-segmented-control-button',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./segmented-control-button.scss\" />\n","<template>\n <div ref=\"segmentedControlRef\" role=\"group\" class=\"b-segmented-control\" :class=\"conditionalClasses\">\n <segmented-control-button\n v-for=\"(item, index) in computedItems\"\n ref=\"segmentedControlButtonRef\"\n :key=\"`segmented-control-item-${index}-${item.label}`\"\n v-bento-tooltip-directive=\"item.tooltipText\"\n class=\"b-segmented-control__item\"\n :label=\"item.label\"\n :value=\"item.value\"\n :disabled=\"item.disabled\"\n :truncate=\"truncate\"\n :wrap=\"wrap\"\n :full-width=\"fullWidth\"\n :model-value=\"inputValue\"\n @update:model-value=\"onInput\"\n />\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, onMounted, ref, toRef, watch } from 'vue';\n import SegmentedControlButton from './components/segmented-control-button/segmented-control-button.vue';\n import { BentoSegmentedControlItem } from './segmented-control.types';\n import { observeSizeOfElement } from '@/utils/ts/resize';\n import { printDevelopmentWarning } from '@/utils/ts/print-development-warning';\n import { BentoTooltipDirective as vBentoTooltipDirective } from '@/directives';\n\n const emit = defineEmits<{\n /**\n * Emitted every time the segmented control internal value is changed\n */\n (e: 'update:model-value', value: any);\n }>();\n\n const props = withDefaults(\n defineProps<{\n /**\n * Accessible name describing the segmented control.\n * @deprecated from version 2.0.0. Use the aria-label attribute instead.\n */\n ariaLabel?: string;\n\n /**\n * If set to true, renders the component full width.\n */\n fullWidth?: boolean;\n\n /**\n * Items that will populate the segmented control.\n */\n items: BentoSegmentedControlItem[];\n\n /**\n * Determines the selected value of the group. Corresponds to the BentoSegmentedControlItem's value.\n */\n modelValue: string | number;\n\n /**\n * If set to true, wraps the items in the segmented control to show their content whenever these don't fit in the available space anymore.\n */\n wrap?: boolean;\n }>(),\n {\n ariaLabel: null,\n fullWidth: false,\n wrap: false,\n }\n );\n\n const inputValue = toRef(props, 'modelValue');\n\n const segmentedControlRef = ref();\n const segmentedControlButtonRef = ref();\n const hasEllipsis = ref();\n\n const truncate = computed(() => !props.wrap);\n\n watch(\n () => props.items,\n () => {\n if (props.items.length > 5) {\n printDevelopmentWarning(\n 'Do not use when you need to provide more than 5 segments at a time. If you need to provide more options, use a dropdown component.'\n );\n }\n },\n { immediate: true }\n );\n\n onMounted(() => {\n observeSizeOfElement(segmentedControlRef.value, () => {\n if (segmentedControlRef.value) {\n hasEllipsis.value = segmentedControlButtonRef?.value?.map(\n el =>\n el.$refs.segmentedControlButtonLabel.$el.offsetWidth <\n el.$refs.segmentedControlButtonLabel.$el.scrollWidth\n );\n }\n });\n });\n\n const computedItems = computed(() =>\n props.items.map((el, index) => ({\n ...el,\n tooltipText: truncate.value && hasEllipsis?.value?.[index] ? el.label : undefined,\n }))\n );\n\n const onInput = value => {\n emit('update:model-value', value);\n };\n\n const conditionalClasses = computed(() => ({\n 'b-segmented-control--hug': !props.fullWidth,\n 'b-segmented-control--full-width': props.fullWidth,\n 'b-segmented-control--truncate': truncate.value,\n 'b-segmented-control--wrap': props.wrap,\n }));\n</script>\n\n<script lang=\"ts\">\n /**\n * @example\n * import { BentoSegmentedControl } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoSegmentedControl },\n * template: `\n * <bento-segmented-control\n * :items=\"[{ label: 'Segment 1', value: 1 }, { label: 'Segment 2', value: 2 }, { label: 'Segment 3', value: 3, disabled: true }]\"\n * :model-value=\"1\"\n * @update:model-value=\"yourUpdateHandler\"\n * />\n * `\n * }\n */\n export default {\n name: 'bento-segmented-control',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./segmented-control.scss\" />\n"],"names":["__default__$1","segmentedControlButtonLabel","ref","segmentedControlButtonId","generateUid","isChecked","computed","props","conditionalClasses","onClick","emit","__default__","inputValue","toRef","segmentedControlRef","segmentedControlButtonRef","hasEllipsis","truncate","watch","printDevelopmentWarning","onMounted","observeSizeOfElement","_a","el","computedItems","index","onInput","value"],"mappings":";;;;;;;6FA2GIA,IAAA;AAAA,E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A,QAAAM,EAAAG,MAAAF,EAAA,QAAA;AAAA,QACqE;AAAA,OAAA;AAAA,IAC1E,GAGNG,IAAA,CAAAC,MAAA;AACI,MAAAjB,EAAA,sBAAAiB,CAAA;AAAA,IAAgC,GAGpCnB,IAAAF,EAAA,OAAA;AAAA,MAA2C,4BAAA,CAAAC,EAAA;AAAA,MACJ,mCAAAA,EAAA;AAAA,MACM,iCAAAU,EAAA;AAAA,MACC,6BAAAV,EAAA;AAAA,IACP,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/data-grid.js CHANGED
@@ -1,4 +1,4 @@
1
- import { B as e, d as o, a as r, f as n, e as i, c as B, b as d } from "./chunks/data-grid.BwfZhc09.js";
1
+ import { B as e, d as o, a as r, f as n, e as i, c as B, b as d } from "./chunks/data-grid.CTLlk_RW.js";
2
2
  export {
3
3
  e as BentoColumnOverflow,
4
4
  o as BentoDataGrid,
@@ -1,4 +1,4 @@
1
- import { B as t, a as r } from "./chunks/date-range-picker.CiwDo2jW.js";
1
+ import { B as t, a as r } from "./chunks/date-range-picker.C36PxTCQ.js";
2
2
  import { C as o } from "./chunks/calendar.CwULNbSL.js";
3
3
  export {
4
4
  t as BentoDateRangePicker,
@@ -1,4 +1,4 @@
1
- import { B as r, b as a, a as B, c as n } from "./chunks/filter-bar.U2ZcPmSU.js";
1
+ import { B as r, b as a, a as B, c as n } from "./chunks/filter-bar.DmPkRBf4.js";
2
2
  export {
3
3
  r as BentoFilterBar,
4
4
  a as BentoFilterBarEvent,
package/dist/index.js CHANGED
@@ -7,9 +7,9 @@ import { B as M, c as G, b as A, a as O } from "./chunks/alert.C0gIf7Ka.js";
7
7
  import { B as z, b as j, a as N } from "./chunks/button.DoqHEvPh.js";
8
8
  import { c as _, B as U, a as Z } from "./chunks/card.C7zLKdcy.js";
9
9
  import { d as H } from "./chunks/dashed-underline.DGTW7Y_-.js";
10
- import { B as J, d as Q, a as X, f as Y, e as $, c as ee, b as te } from "./chunks/data-grid.BwfZhc09.js";
10
+ import { B as J, d as Q, a as X, f as Y, e as $, c as ee, b as te } from "./chunks/data-grid.CTLlk_RW.js";
11
11
  import { B as ae, a as ne } from "./chunks/date-picker.CoPmllNh.js";
12
- import { B as se, a as Be } from "./chunks/date-range-picker.CiwDo2jW.js";
12
+ import { B as se, a as Be } from "./chunks/date-range-picker.C36PxTCQ.js";
13
13
  import { B as me, a as pe, u as de } from "./chunks/dropdown.CxBlK83Q.js";
14
14
  import { B as le } from "./chunks/divider.CnwfddJD.js";
15
15
  import { B as fe, a as xe } from "./chunks/checkbox.xjIFibII.js";
@@ -20,7 +20,7 @@ import { a as Ee, B as Fe, u as Pe, b as Le, c as Ve } from "./chunks/country.ty
20
20
  import { c as we, B as Me } from "./chunks/currency.CgVd9fQN.js";
21
21
  import { B as Ae, a as Oe } from "./chunks/date.2ndGvIGE.js";
22
22
  import { B as ze, b as je, c as Ne, a as Ke } from "./chunks/empty-state.BBxgpI-D.js";
23
- import { B as Ue, b as Ze, a as We, c as He } from "./chunks/filter-bar.U2ZcPmSU.js";
23
+ import { B as Ue, b as Ze, a as We, c as He } from "./chunks/filter-bar.DmPkRBf4.js";
24
24
  import { f as Je, a as Qe, c as Xe, b as Ye } from "./chunks/form-layout-title.4Gz8-dJv.js";
25
25
  import { B as et, a as tt, b as ot } from "./chunks/image.0KzfycGE.js";
26
26
  import { B as nt } from "./chunks/info-icon.DvL1e5Iu.js";
@@ -38,7 +38,7 @@ import { B as Kt, a as _t } from "./chunks/popover.DRb2GW7t.js";
38
38
  import { b as Zt, B as Wt, a as Ht } from "./chunks/radio-group.B9HCffiZ.js";
39
39
  import { B as Jt, b as Qt, a as Xt } from "./chunks/search-bar.DxskyM4e.js";
40
40
  import { s as $t } from "./chunks/secondary-nav.D66nxbU-.js";
41
- import { B as to } from "./chunks/segmented-control.NnFfAdTq.js";
41
+ import { B as to } from "./chunks/segmented-control.DyINOWUl.js";
42
42
  import { B as ao } from "./chunks/segmented-control.types.BHRLV8KU.js";
43
43
  import { B as ro, s as so, a as Bo } from "./chunks/selection-card-group.C-YLePO4.js";
44
44
  import { a as mo, B as po, s as uo } from "./chunks/sidepanel.B-LtA15e.js";
@@ -1,4 +1,4 @@
1
- import { B as t } from "./chunks/segmented-control.NnFfAdTq.js";
1
+ import { B as t } from "./chunks/segmented-control.DyINOWUl.js";
2
2
  import { B as r } from "./chunks/segmented-control.types.BHRLV8KU.js";
3
3
  export {
4
4
  t as BentoSegmentedControl,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "@adyen/bento-vue3",
4
- "version": "1.28.0",
4
+ "version": "1.28.1",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adyen/bento-vue3",
3
- "version": "1.28.0",
3
+ "version": "1.28.1",
4
4
  "description": "Adyen Bento Vue 3 components",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -52,7 +52,7 @@
52
52
  "url": "git@github.com:Adyen/bento.git"
53
53
  },
54
54
  "dependencies": {
55
- "@adyen/bento-design-tokens": "1.28.0",
55
+ "@adyen/bento-design-tokens": "1.28.1",
56
56
  "@adyen/ui-assets-icons-16": "4.1.0",
57
57
  "@adyen/ui-assets-payment-method-icons": "6.1.0",
58
58
  "@codemirror/commands": "6.3.3",
@@ -1 +0,0 @@
1
- {"version":3,"file":"segmented-control.NnFfAdTq.js","sources":["../../../vue2/src/components/segmented-control/components/segmented-control-button/segmented-control-button.vue","../../../vue2/src/components/segmented-control/segmented-control.vue"],"sourcesContent":["<template>\n <div class=\"b-segmented-control-button\" :class=\"conditionalClasses\">\n <input\n :id=\"segmentedControlButtonId\"\n :aria-checked=\"isChecked\"\n :aria-label=\"label\"\n :checked=\"isChecked\"\n :disabled=\"disabled\"\n :value=\"value\"\n type=\"radio\"\n class=\"b-segmented-control-button__input\"\n role=\"radio\"\n @change=\"onClick\"\n />\n <label v-if=\"label\" :for=\"segmentedControlButtonId\" class=\"b-segmented-control-button__label-container\">\n <bento-typography\n ref=\"segmentedControlButtonLabel\"\n class=\"b-segmented-control-button__label\"\n el=\"span\"\n variant=\"body\"\n stronger\n >\n {{ label }}\n </bento-typography>\n </label>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { BentoTypography } from '@/components/typography';\n import { generateUid } from '@/utils/ts/unique-id';\n import { computed, ComputedRef, ref } from 'vue';\n\n const props = withDefaults(\n defineProps<{\n /**\n * Disable the radio button (optional)\n */\n disabled?: boolean;\n\n /**\n * Renders the button with a 100% width\n */\n fullWidth?: boolean;\n\n /**\n * The string the button will showcase\n */\n label: string;\n\n /**\n * This property should not be used directly.\n * It will be used by v-model directive on the segmented control component\n */\n modelValue?: string | number;\n\n /**\n * Renders the button with a truncated text if the space is not enough to render the whole content\n */\n truncate?: boolean;\n\n /**\n * Indicates the value of the input that will be returned when it's selected\n */\n value: string | number;\n\n /**\n * Renders the button with centered text in case the text has to wrap multiple lines\n */\n wrap?: boolean;\n }>(),\n {\n disabled: false,\n fullWidth: false,\n modelValue: null,\n truncate: false,\n wrap: false,\n }\n );\n\n const emit = defineEmits<{\n /**\n * Emitted every time the segmented control internal value is changed\n */\n (e: 'update:model-value', value: string | number);\n }>();\n\n const segmentedControlButtonLabel = ref();\n const segmentedControlButtonId = generateUid('segmented-control-button');\n const isChecked: ComputedRef<boolean> = computed(() => props.value === props.modelValue);\n const conditionalClasses = computed(() => ({\n 'b-segmented-control-button--hug-content': !props.fullWidth,\n 'b-segmented-control-button--full-width': props.fullWidth,\n 'b-segmented-control-button--truncate': props.truncate,\n 'b-segmented-control-button--wrap': props.wrap && !props.truncate,\n }));\n const onClick = () => {\n if (!props.disabled) {\n emit('update:model-value', props.value);\n }\n };\n</script>\n\n<script lang=\"ts\">\n /**\n * Internal component to be used within the BentoSegmentedControl component only\n */\n export default {\n name: 'bento-segmented-control-button',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./segmented-control-button.scss\" />\n","<template>\n <div ref=\"segmentedControlRef\" role=\"group\" class=\"b-segmented-control\" :class=\"conditionalClasses\">\n <segmented-control-button\n v-for=\"(item, index) in computedItems\"\n ref=\"segmentedControlButtonRef\"\n :key=\"`segmented-control-item-${index}-${item.label}`\"\n v-bento-tooltip-directive=\"item.tooltipText\"\n class=\"b-segmented-control__item\"\n :label=\"item.label\"\n :value=\"item.value\"\n :disabled=\"item.disabled\"\n :truncate=\"truncate\"\n :wrap=\"wrap\"\n :full-width=\"fullWidth\"\n :model-value=\"inputValue\"\n @update:model-value=\"onInput\"\n />\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, onMounted, ref, toRef, watch } from 'vue';\n import SegmentedControlButton from './components/segmented-control-button/segmented-control-button.vue';\n import { BentoSegmentedControlItem } from './segmented-control.types';\n import { observeSizeOfElement } from '@/utils/ts/resize';\n import { printDevelopmentWarning } from '@/utils/ts/print-development-warning';\n import { BentoTooltipDirective as vBentoTooltipDirective } from '@/directives';\n\n const emit = defineEmits<{\n /**\n * Emitted every time the segmented control internal value is changed\n */\n (e: 'update:model-value', value: string | number);\n }>();\n\n const props = withDefaults(\n defineProps<{\n /**\n * Accessible name describing the segmented control.\n * @deprecated from version 2.0.0. Use the aria-label attribute instead.\n */\n ariaLabel?: string;\n\n /**\n * If set to true, renders the component full width.\n */\n fullWidth?: boolean;\n\n /**\n * Items that will populate the segmented control.\n */\n items: BentoSegmentedControlItem[];\n\n /**\n * Determines the selected value of the group. Corresponds to the BentoSegmentedControlItem's value.\n */\n modelValue: string | number;\n\n /**\n * If set to true, wraps the items in the segmented control to show their content whenever these don't fit in the available space anymore.\n */\n wrap?: boolean;\n }>(),\n {\n ariaLabel: null,\n fullWidth: false,\n wrap: false,\n }\n );\n\n const inputValue = toRef(props, 'modelValue');\n\n const segmentedControlRef = ref();\n const segmentedControlButtonRef = ref();\n const hasEllipsis = ref();\n\n const truncate = computed(() => !props.wrap);\n\n watch(\n () => props.items,\n () => {\n if (props.items.length > 5) {\n printDevelopmentWarning(\n 'Do not use when you need to provide more than 5 segments at a time. If you need to provide more options, use a dropdown component.'\n );\n }\n },\n { immediate: true }\n );\n\n onMounted(() => {\n observeSizeOfElement(segmentedControlRef.value, () => {\n if (segmentedControlRef.value) {\n hasEllipsis.value = segmentedControlButtonRef?.value?.map(\n el =>\n el.$refs.segmentedControlButtonLabel.$el.offsetWidth <\n el.$refs.segmentedControlButtonLabel.$el.scrollWidth\n );\n }\n });\n });\n\n const computedItems = computed(() =>\n props.items.map((el, index) => ({\n ...el,\n tooltipText: truncate.value && hasEllipsis?.value?.[index] ? el.label : undefined,\n }))\n );\n\n const onInput = value => {\n emit('update:model-value', value);\n };\n\n const conditionalClasses = computed(() => ({\n 'b-segmented-control--hug': !props.fullWidth,\n 'b-segmented-control--full-width': props.fullWidth,\n 'b-segmented-control--truncate': truncate.value,\n 'b-segmented-control--wrap': props.wrap,\n }));\n</script>\n\n<script lang=\"ts\">\n /**\n * @example\n * import { BentoSegmentedControl } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoSegmentedControl },\n * template: `\n * <bento-segmented-control\n * :items=\"[{ label: 'Segment 1', value: 1 }, { label: 'Segment 2', value: 2 }, { label: 'Segment 3', value: 3, disabled: true }]\"\n * :model-value=\"1\"\n * @update:model-value=\"yourUpdateHandler\"\n * />\n * `\n * }\n */\n export default {\n name: 'bento-segmented-control',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./segmented-control.scss\" />\n"],"names":["__default__$1","segmentedControlButtonLabel","ref","segmentedControlButtonId","generateUid","isChecked","computed","props","conditionalClasses","onClick","emit","__default__","inputValue","toRef","segmentedControlRef","segmentedControlButtonRef","hasEllipsis","truncate","watch","printDevelopmentWarning","onMounted","observeSizeOfElement","_a","el","computedItems","index","onInput","value"],"mappings":";;;;;;;6FA2GIA,IAAA;AAAA,EAAe,MAAA;AAEf;;;;;;;;;;;;;iBAtBAC,IAAAC,EAAA,GACAC,IAAAC,EAAA,0BAAA,G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