@adyen/bento-vue2 1.6.1 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@types/components.d.ts +2 -0
- package/dist/@types/packages/core/src/components/button/button.types.d.ts +3 -1
- package/dist/@types/packages/vue2/src/components/action-bar/action-bar.vue.d.ts +43 -0
- package/dist/@types/packages/vue2/src/components/action-bar/index.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/alert/alert.vue.d.ts +4 -4
- package/dist/@types/packages/vue2/src/components/avatar-image/avatar-image.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/button/button.vue.d.ts +290 -281
- package/dist/@types/packages/vue2/src/components/button/components/button-actions/button-actions.vue.d.ts +9 -0
- package/dist/@types/packages/vue2/src/components/button/components/loading-button/loading-button.vue.d.ts +3 -3
- package/dist/@types/packages/vue2/src/components/checkbox/checkbox.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/checkbox/components/checkbox-group/checkbox-group.vue.d.ts +5 -5
- package/dist/@types/packages/vue2/src/components/code-snippet/code-snippet.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/country/country.vue.d.ts +4 -3
- package/dist/@types/packages/vue2/src/components/data-grid/data-grid.vue.d.ts +53 -70
- package/dist/@types/packages/vue2/src/components/date/date.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/date-picker/date-picker.vue.d.ts +20 -2
- package/dist/@types/packages/vue2/src/components/date-range-picker/components/date-range-picker-calendar/date-range-picker-calendar.vue.d.ts +18 -0
- package/dist/@types/packages/vue2/src/components/date-range-picker/date-range-picker.vue.d.ts +20 -2
- package/dist/@types/packages/vue2/src/components/dropdown/components/dropdown-base-textbox/dropdown-base-textbox.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/dropdown/components/dropdown-default-textbox/dropdown-default-textbox.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/dropdown/components/dropdown-options-container/dropdown-options-container.vue.d.ts +45 -27
- package/dist/@types/packages/vue2/src/components/dropdown/components/dropdown-small-textbox/dropdown-small-textbox.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/dropdown/components/variants/dropdown-avatar/dropdown-avatar.vue.d.ts +21 -3
- package/dist/@types/packages/vue2/src/components/dropdown/components/variants/dropdown-country/dropdown-country.vue.d.ts +24 -6
- package/dist/@types/packages/vue2/src/components/dropdown/components/variants/dropdown-currency/dropdown-currency.vue.d.ts +21 -3
- package/dist/@types/packages/vue2/src/components/dropdown/components/variants/dropdown-payment-method/dropdown-payment-method.vue.d.ts +21 -3
- package/dist/@types/packages/vue2/src/components/dropdown/components/variants/dropdown-tag/dropdown-tag.vue.d.ts +21 -3
- package/dist/@types/packages/vue2/src/components/dropdown/dropdown.types.d.ts +2 -0
- package/dist/@types/packages/vue2/src/components/dropdown/dropdown.vue.d.ts +22 -4
- package/dist/@types/packages/vue2/src/components/empty-state/empty-state.vue.d.ts +5 -2
- package/dist/@types/packages/vue2/src/components/filter-bar/components/all-filters-modal/all-filters-modal.vue.d.ts +234 -12
- package/dist/@types/packages/vue2/src/components/filter-bar/components/boolean-filter/boolean-filter.vue.d.ts +12 -5
- package/dist/@types/packages/vue2/src/components/filter-bar/components/filter-bar-button/filter-bar-button.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/filter-bar/components/select-filter/variants/select-country-filter/select-country-filter.vue.d.ts +2 -1
- package/dist/@types/packages/vue2/src/components/filter-bar/components/select-filter/variants/select-tag-filter/select-tag-filter.vue.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/filter-bar/filter-bar.types.d.ts +12 -2
- package/dist/@types/packages/vue2/src/components/filter-bar/filter-bar.vue.d.ts +10 -0
- package/dist/@types/packages/vue2/src/components/form-layout/components/form-layout-field-tip/form-layout-field-tip.vue.d.ts +3 -3
- package/dist/@types/packages/vue2/src/components/header/header.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/info-icon/info-icon.vue.d.ts +3 -3
- package/dist/@types/packages/vue2/src/components/input-field/input-field.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/internal/button-actions-with-menu/button-actions-with-menu.vue.d.ts +21 -0
- package/dist/@types/packages/vue2/src/components/internal/calendar/calendar.vue.d.ts +18 -0
- package/dist/@types/packages/vue2/src/components/internal/calendar/components/calendar-month/calendar-month.vue.d.ts +19 -0
- package/dist/@types/packages/vue2/src/components/internal/controls-group/controls-group.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/internal/fixed-scroller/fixed-scroller.vue.d.ts +22 -1
- package/dist/@types/packages/vue2/src/components/internal/listbox/listbox.vue.d.ts +94 -8
- package/dist/@types/packages/vue2/src/components/internal/teleport/index.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/internal/teleport/teleport.vue.d.ts +50 -0
- package/dist/@types/packages/vue2/src/components/link/link.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/menu/menu.keys.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/menu/menu.vue.d.ts +15 -11
- package/dist/@types/packages/vue2/src/components/pagination/components/pagination-context/pagination-context.vue.d.ts +9 -0
- package/dist/@types/packages/vue2/src/components/pagination/pagination.vue.d.ts +9 -0
- package/dist/@types/packages/vue2/src/components/payment-method/payment-method.vue.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/popover/popover.vue.d.ts +4 -4
- package/dist/@types/packages/vue2/src/components/popper-container/popper-container.vue.d.ts +5 -5
- package/dist/@types/packages/vue2/src/components/radio-group/radio-group.vue.d.ts +10 -5
- package/dist/@types/packages/vue2/src/components/segmented-control/components/segmented-control-button/segmented-control-button.vue.d.ts +21 -0
- package/dist/@types/packages/vue2/src/components/segmented-control/segmented-control.vue.d.ts +21 -5
- package/dist/@types/packages/vue2/src/components/stepper/stepper.vue.d.ts +3 -3
- package/dist/@types/packages/vue2/src/components/summary-grid/components/summary-grid-item/summary-grid-item.vue.d.ts +1 -2
- package/dist/@types/packages/vue2/src/components/summary-grid/components/summary-grid-item-amount/summary-grid-item-amount.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/summary-grid/summary-grid.keys.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/summary-grid/summary-grid.types.d.ts +3 -0
- package/dist/@types/packages/vue2/src/components/tabs/components/tab.types.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/tabs/components/tab.vue.d.ts +9 -0
- package/dist/@types/packages/vue2/src/components/tabs/tabs.types.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/tabs/tabs.vue.d.ts +2 -0
- package/dist/@types/packages/vue2/src/components/textarea/textarea.vue.d.ts +5 -5
- package/dist/@types/packages/vue2/src/components/timeline/components/timeline-item/timeline-item.vue.d.ts +6 -3
- package/dist/@types/packages/vue2/src/components/timeline/timeline.types.d.ts +9 -2
- package/dist/@types/packages/vue2/src/components/tooltip/tooltip.vue.d.ts +13 -13
- package/dist/@types/packages/vue2/src/components/tutorial/components/tutorial-popover/components/tutorial-indicator/index.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/tutorial/components/tutorial-popover/components/tutorial-indicator/tutorial-indicator.vue.d.ts +12 -0
- package/dist/@types/packages/vue2/src/components/tutorial/components/tutorial-popover/index.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/tutorial/components/tutorial-popover/tutorial-popover.vue.d.ts +226 -0
- package/dist/@types/packages/vue2/src/components/tutorial/index.d.ts +2 -0
- package/dist/@types/packages/vue2/src/components/tutorial/tutorial.types.d.ts +13 -0
- package/dist/@types/packages/vue2/src/components/tutorial/tutorial.vue.d.ts +16 -0
- package/dist/@types/packages/vue2/src/composables/index.d.ts +5 -2
- package/dist/@types/packages/vue2/src/composables/use-click-outside/use-click-outside.d.ts +3 -0
- package/dist/@types/packages/vue2/src/composables/use-form-validate/index.d.ts +2 -0
- package/dist/@types/packages/vue2/src/composables/use-form-validate/use-form.d.ts +12 -0
- package/dist/@types/packages/vue2/src/composables/use-form-validate/use-form.types.d.ts +5 -0
- package/dist/@types/packages/vue2/src/composables/use-virtual-list/index.d.ts +2 -0
- package/dist/@types/packages/vue2/src/composables/use-virtual-list/use-virtual-list.d.ts +15 -0
- package/dist/@types/packages/vue2/src/composables/use-virtual-list/use-virtual-list.types.d.ts +20 -0
- package/dist/@types/packages/vue2/src/index.d.ts +1 -0
- package/dist/@types/packages/vue2/src/templates/data-grid-template/data-grid-template.vue.d.ts +2 -2
- package/dist/@types/packages/vue2/src/types/listbox.d.ts +12 -0
- package/dist/accordion.js +41 -32
- package/dist/accordion.js.map +1 -1
- package/dist/action-bar.js +191 -0
- package/dist/action-bar.js.map +1 -0
- package/dist/alert.js +3 -3
- package/dist/assets/base-modal.css +1 -1
- package/dist/assets/button-actions-with-menu.css +1 -0
- package/dist/assets/button.css +1 -1
- package/dist/assets/calendar.css +1 -1
- package/dist/assets/checkbox.css +1 -1
- package/dist/assets/checkmark.css +1 -0
- package/dist/assets/chevron-left.css +1 -0
- package/dist/assets/dropdown-default-textbox.css +1 -1
- package/dist/assets/dropdown.css +1 -1
- package/dist/assets/fixed-scroller.css +1 -0
- package/dist/assets/index.css +1 -1
- package/dist/assets/index10.css +1 -1
- package/dist/assets/index11.css +1 -1
- package/dist/assets/index12.css +1 -1
- package/dist/assets/index13.css +1 -1
- package/dist/assets/index14.css +1 -1
- package/dist/assets/index15.css +1 -1
- package/dist/assets/index16.css +1 -1
- package/dist/assets/index17.css +1 -1
- package/dist/assets/index18.css +1 -1
- package/dist/assets/index19.css +1 -1
- package/dist/assets/index2.css +1 -1
- package/dist/assets/index20.css +1 -1
- package/dist/assets/index21.css +1 -1
- package/dist/assets/index22.css +1 -1
- package/dist/assets/index23.css +1 -1
- package/dist/assets/index24.css +1 -1
- package/dist/assets/index25.css +1 -1
- package/dist/assets/index26.css +1 -1
- package/dist/assets/index27.css +1 -1
- package/dist/assets/index28.css +1 -1
- package/dist/assets/index29.css +1 -1
- package/dist/assets/index3.css +1 -1
- package/dist/assets/index30.css +1 -1
- package/dist/assets/index31.css +1 -1
- package/dist/assets/index32.css +1 -1
- package/dist/assets/index33.css +1 -1
- package/dist/assets/index34.css +1 -1
- package/dist/assets/index35.css +1 -1
- package/dist/assets/index36.css +1 -1
- package/dist/assets/index37.css +1 -1
- package/dist/assets/index39.css +1 -1
- package/dist/assets/index4.css +1 -1
- package/dist/assets/index40.css +1 -1
- package/dist/assets/index41.css +1 -1
- package/dist/assets/index42.css +1 -1
- package/dist/assets/index43.css +1 -1
- package/dist/assets/index44.css +1 -1
- package/dist/assets/index45.css +1 -0
- package/dist/assets/index5.css +1 -1
- package/dist/assets/index6.css +1 -1
- package/dist/assets/index7.css +1 -1
- package/dist/assets/index8.css +1 -1
- package/dist/assets/index9.css +1 -1
- package/dist/assets/listbox.css +1 -1
- package/dist/assets/refresh.css +1 -0
- package/dist/avatar-image.js +1 -1
- package/dist/badge.js +1 -1
- package/dist/button.js +21 -14
- package/dist/button.js.map +1 -1
- package/dist/card.js +54 -54
- package/dist/card.js.map +1 -1
- package/dist/checkbox.js +6 -6
- package/dist/chunks/{base-button.d1ba66cd.js → base-button.7886a7e6.js} +2 -2
- package/dist/chunks/{base-button.d1ba66cd.js.map → base-button.7886a7e6.js.map} +1 -1
- package/dist/chunks/{base-modal.ec74044e.js → base-modal.88e7b9d4.js} +4 -4
- package/dist/chunks/{base-modal.ec74044e.js.map → base-modal.88e7b9d4.js.map} +1 -1
- package/dist/chunks/button-actions-with-menu.a5413243.js +105 -0
- package/dist/chunks/button-actions-with-menu.a5413243.js.map +1 -0
- package/dist/chunks/button.e09d5980.js +125 -0
- package/dist/chunks/button.e09d5980.js.map +1 -0
- package/dist/chunks/{calendar.b74f8a0f.js → calendar.24d0ac04.js} +294 -272
- package/dist/chunks/calendar.24d0ac04.js.map +1 -0
- package/dist/chunks/{checkbox.96ee3f71.js → checkbox.5343e28e.js} +7 -7
- package/dist/chunks/{checkbox.96ee3f71.js.map → checkbox.5343e28e.js.map} +1 -1
- package/dist/chunks/checkmark.78f3ed9c.js +26 -0
- package/dist/chunks/checkmark.78f3ed9c.js.map +1 -0
- package/dist/chunks/{chevron-right.3b826337.js → chevron-left.c10778d3.js} +8 -8
- package/dist/chunks/chevron-left.c10778d3.js.map +1 -0
- package/dist/chunks/{controls-group.e9537e45.js → controls-group.2a21bd83.js} +2 -2
- package/dist/chunks/{controls-group.e9537e45.js.map → controls-group.2a21bd83.js.map} +1 -1
- package/dist/chunks/{copy.2ff56819.js → copy.346eadb1.js} +4 -4
- package/dist/chunks/{copy.2ff56819.js.map → copy.346eadb1.js.map} +1 -1
- package/dist/chunks/{dropdown-default-textbox.3df0bf23.js → dropdown-default-textbox.25134789.js} +4 -4
- package/dist/chunks/dropdown-default-textbox.25134789.js.map +1 -0
- package/dist/chunks/{dropdown.3f198167.js → dropdown.f1253a54.js} +111 -81
- package/dist/chunks/dropdown.f1253a54.js.map +1 -0
- package/dist/chunks/{error-message.f5454f19.js → error-message.8302a46c.js} +2 -2
- package/dist/chunks/{error-message.f5454f19.js.map → error-message.8302a46c.js.map} +1 -1
- package/dist/chunks/fixed-scroller.8994e30a.js +108 -0
- package/dist/chunks/fixed-scroller.8994e30a.js.map +1 -0
- package/dist/chunks/{footer-actions.00d20947.js → footer-actions.c9b2cb74.js} +3 -3
- package/dist/chunks/{footer-actions.00d20947.js.map → footer-actions.c9b2cb74.js.map} +1 -1
- package/dist/chunks/{index.c39c64c9.js → index.2625175a.js} +2 -2
- package/dist/chunks/{index.c39c64c9.js.map → index.2625175a.js.map} +1 -1
- package/dist/chunks/index.37283390.js +475 -0
- package/dist/chunks/index.37283390.js.map +1 -0
- package/dist/chunks/index.8ac70774.js +1328 -0
- package/dist/chunks/index.8ac70774.js.map +1 -0
- package/dist/chunks/{index.2fce7703.js → index.965ac1af.js} +2 -2
- package/dist/chunks/{index.2fce7703.js.map → index.965ac1af.js.map} +1 -1
- package/dist/chunks/{index.eb52e785.js → index.a201f750.js} +6 -5
- package/dist/chunks/{index.eb52e785.js.map → index.a201f750.js.map} +1 -1
- package/dist/chunks/{index.a709a6b0.js → index.b83f8b7e.js} +2 -2
- package/dist/chunks/{index.a709a6b0.js.map → index.b83f8b7e.js.map} +1 -1
- package/dist/chunks/{index.298f5eed.js → index.d6b5f5e1.js} +6 -6
- package/dist/chunks/{index.298f5eed.js.map → index.d6b5f5e1.js.map} +1 -1
- package/dist/chunks/{index.31949c1a.js → index.e566354f.js} +91 -74
- package/dist/chunks/index.e566354f.js.map +1 -0
- package/dist/chunks/{listbox-option-tag.1362a2d7.js → listbox-option-tag.6a09e8e2.js} +8 -7
- package/dist/chunks/{listbox-option-tag.1362a2d7.js.map → listbox-option-tag.6a09e8e2.js.map} +1 -1
- package/dist/chunks/{listbox.e7bf46e4.js → listbox.73c38f38.js} +479 -385
- package/dist/chunks/listbox.73c38f38.js.map +1 -0
- package/dist/chunks/{loading-button.0ad06c99.js → loading-button.c65682d6.js} +2 -2
- package/dist/chunks/{loading-button.0ad06c99.js.map → loading-button.c65682d6.js.map} +1 -1
- package/dist/chunks/refresh.eb485c6f.js +26 -0
- package/dist/chunks/refresh.eb485c6f.js.map +1 -0
- package/dist/chunks/summary-grid.keys.1d1028c2.js +5 -0
- package/dist/chunks/summary-grid.keys.1d1028c2.js.map +1 -0
- package/dist/chunks/{tooltip.68e81e9c.js → tooltip.104e5fac.js} +39 -36
- package/dist/chunks/{tooltip.68e81e9c.js.map → tooltip.104e5fac.js.map} +1 -1
- package/dist/code-snippet.js +7 -7
- package/dist/code-snippet.js.map +1 -1
- package/dist/country.js +537 -528
- package/dist/country.js.map +1 -1
- package/dist/currency.js +1 -1
- package/dist/data-grid.js +10 -10
- package/dist/data-grid.js.map +1 -1
- package/dist/date-picker.js +99 -89
- package/dist/date-picker.js.map +1 -1
- package/dist/date-range-picker.js +2 -2
- package/dist/date.js +1 -1
- package/dist/divider.js +1 -1
- package/dist/dropdown.js +4 -4
- package/dist/empty-state.js +8 -7
- package/dist/empty-state.js.map +1 -1
- package/dist/filter-bar.js +500 -486
- package/dist/filter-bar.js.map +1 -1
- package/dist/focus-trap.js +1 -1
- package/dist/form-layout.js +2 -2
- package/dist/header.js +104 -183
- package/dist/header.js.map +1 -1
- package/dist/image.js +3 -3
- package/dist/index.js +171 -169
- package/dist/index.js.map +1 -1
- package/dist/info-icon.js +3 -3
- package/dist/input-field.js +7 -7
- package/dist/internal.js +20 -106
- package/dist/internal.js.map +1 -1
- package/dist/link.js +2 -2
- package/dist/loading-indicator.js +1 -1
- package/dist/menu.js +3 -466
- package/dist/menu.js.map +1 -1
- package/dist/modal.js +3 -3
- package/dist/pagination.js +40 -26
- package/dist/pagination.js.map +1 -1
- package/dist/payment-method.js +33 -26
- package/dist/payment-method.js.map +1 -1
- package/dist/popover.js +4 -4
- package/dist/popper-container.js +6 -1270
- package/dist/popper-container.js.map +1 -1
- package/dist/radio-group.js +97 -81
- package/dist/radio-group.js.map +1 -1
- package/dist/search-bar.js +2 -2
- package/dist/segmented-control.js +100 -70
- package/dist/segmented-control.js.map +1 -1
- package/dist/sidepanel.js +53 -51
- package/dist/sidepanel.js.map +1 -1
- package/dist/status.js +2 -2
- package/dist/stepper.js +3 -3
- package/dist/structured-list.js +1 -1
- package/dist/summary-grid.js +109 -119
- package/dist/summary-grid.js.map +1 -1
- package/dist/tabs.js +81 -71
- package/dist/tabs.js.map +1 -1
- package/dist/tag.js +3 -3
- package/dist/textarea.js +4 -4
- package/dist/timeline.js +170 -162
- package/dist/timeline.js.map +1 -1
- package/dist/toast.js +3 -3
- package/dist/toggle.js +6 -6
- package/dist/tutorial.js +307 -0
- package/dist/tutorial.js.map +1 -0
- package/dist/typography.js +1 -1
- package/dist/web-types.json +828 -122
- package/package.json +7 -4
- package/dist/assets/chevron-right.css +0 -1
- package/dist/chunks/button.eb60d460.js +0 -117
- package/dist/chunks/button.eb60d460.js.map +0 -1
- package/dist/chunks/calendar.b74f8a0f.js.map +0 -1
- package/dist/chunks/chevron-right.3b826337.js.map +0 -1
- package/dist/chunks/dropdown-default-textbox.3df0bf23.js.map +0 -1
- package/dist/chunks/dropdown.3f198167.js.map +0 -1
- package/dist/chunks/index.31949c1a.js.map +0 -1
- package/dist/chunks/listbox.e7bf46e4.js.map +0 -1
package/dist/radio-group.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-group.js","sources":["../src/components/radio-group/components/radio-button/radio-button.types.ts","../src/components/radio-group/radio-group.types.ts","../src/components/radio-group/components/radio-button/radio-button.vue","../src/components/radio-group/radio-group.vue"],"sourcesContent":["export enum BentoRadioButtonStateClass {\n DISABLED = 'disabled',\n READONLY = 'readonly',\n ERROR = 'error',\n}\n","/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoRadioGroupVariant {\n HORIZONTAL = 'horizontal',\n VERTICAL = 'vertical',\n}\n\nexport interface BentoRadioGroupItem {\n value: string | number;\n label: string;\n description?: string;\n disabled?: boolean;\n readonly?: boolean;\n hasError?: boolean;\n}\n\nexport type BentoRadioGroupItems = Array<BentoRadioGroupItem>;\n\nexport enum BentoRadioGroupEvent {\n UPDATE = 'update:model-value',\n INPUT = 'input',\n}\n","<template>\n <div class=\"b-radio-button\" data-testid=\"radio-button-container\" :class=\"conditionalClassContainer\">\n <input\n :id=\"radioButtonId\"\n :aria-checked=\"isChecked\"\n :aria-label=\"ariaLabel\"\n :aria-invalid=\"ariaInvalid\"\n :aria-describedby=\"hasSlot('description') ? descriptionId : ''\"\n :checked=\"isChecked\"\n :disabled=\"disabled\"\n :aria-readonly=\"readonly ? readonly : undefined\"\n :value=\"value\"\n type=\"radio\"\n class=\"b-radio-button__input\"\n :class=\"conditionalClassInput\"\n role=\"radio\"\n @click=\"onClick\"\n @change=\"onChange\"\n />\n <label v-if=\"hasSlot('default')\" :for=\"radioButtonId\" class=\"b-radio-button__label-container\">\n <bento-typography v-if=\"hasSlot('default')\" class=\"b-radio-button__label\" el=\"span\" variant=\"body\">\n <slot></slot>\n </bento-typography>\n <bento-typography\n v-if=\"hasSlot('default') && hasSlot('description')\"\n :id=\"descriptionId\"\n class=\"b-radio-button__description\"\n el=\"span\"\n variant=\"body\"\n >\n <slot name=\"description\"></slot>\n </bento-typography>\n </label>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { BentoTypography } from '@/components/typography';\n import type { HTMLAttributes } from 'vue/types/jsx';\n import { useAriaLabel } from '@/utils/ts/aria-label';\n import { generateUid } from '@/utils/ts/unique-id';\n import { computed, ComputedRef, defineComponent, toRefs } from 'vue';\n import { useDefaultSlotValidator, useHasSlot } from '@/composables';\n import { BentoRadioButtonStateClass } from './radio-button.types';\n import { BentoRadioGroupEvent } from '../../radio-group.types';\n import { getSlotText } from '@/utils/ts/get-slot-text';\n\n /**\n * Radio buttons are used when two or more options are mutually exclusive,\n * the user can only select a single option from a list of pre-defined options.\n * The label tag area is also clickable.\n * Only to be used internally.\n *\n * @usage\n * import { RadioButton } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { RadioButton },\n * template: `\n * <radio-button\n * disabled\n * value=\"inputRadio\"\n * >\n * Label text\n * <template #description>Description text below label</template>\n * </radio-button>\n * `,\n * }\n */\n export default defineComponent({\n name: 'radio-button',\n components: { BentoTypography },\n props: {\n /**\n * Disable the radio button (optional)\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n /**\n * Shows radio-button in error state (optional)\n */\n hasError: {\n type: Boolean,\n default: false,\n },\n /**\n * This property should not be used directly.\n * It will be used by v-model directive on radio component.\n */\n modelValue: {\n type: [String, Number],\n default: null,\n },\n /**\n * Sets the radio button to readonly (optional)\n */\n readonly: {\n type: Boolean,\n default: false,\n },\n /**\n * Indicates the value of the input that will be returned when it's checked\n */\n value: {\n type: [String, Number],\n required: true,\n },\n },\n emits: [BentoRadioGroupEvent.UPDATE],\n setup(props, { slots, emit }) {\n const { value } = toRefs(props);\n const radioButtonId = generateUid('radio-button');\n const descriptionId = generateUid('description');\n\n const defaultSlotValue = getSlotText(slots)('default');\n const descriptionSlotValue = getSlotText(slots)('description');\n\n useDefaultSlotValidator('radio-button', slots.default, slots.description);\n\n const conditionalClassContainer = computed(() => ({\n [`b-radio-button--${BentoRadioButtonStateClass.DISABLED}`]: props.disabled,\n [`b-radio-button--${BentoRadioButtonStateClass.READONLY}`]: props.readonly,\n }));\n const conditionalClassInput = computed(() => ({\n [`b-radio-button__input--${BentoRadioButtonStateClass.ERROR}`]: props.hasError,\n }));\n\n const ariaLabel = useAriaLabel({\n ariaLabel: getSlotText(slots)('default'),\n label: value.value as string,\n });\n const ariaInvalid = computed<HTMLAttributes['aria-invalid']>(() => props.hasError);\n\n const isChecked: ComputedRef<boolean> = computed(() => props.value === props.modelValue);\n\n const onChange = () => {\n if (!props.disabled && !props.readonly) {\n emit(BentoRadioGroupEvent.UPDATE, props.value);\n }\n };\n\n // readonly attr doesn't work with radio button, so we need to manually ignore the click instead\n const onClick = event => {\n if (props.readonly) {\n event.preventDefault();\n }\n };\n\n return {\n // Values\n ariaLabel,\n ariaInvalid,\n isChecked,\n defaultSlotValue,\n descriptionSlotValue,\n conditionalClassContainer,\n conditionalClassInput,\n radioButtonId,\n descriptionId,\n\n // Methods\n hasSlot: useHasSlot(slots),\n onChange,\n onClick,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./radio-button.scss\" />\n","<template>\n <div class=\"b-radio-group\">\n <controls-group\n class=\"b-radio-group__buttons\"\n :aria-describedby=\"shouldShowErrorMessage ? errorId : ''\"\n :class=\"conditionalClasses\"\n :description=\"description\"\n :disabled=\"disabled\"\n :form=\"formId\"\n :label=\"label\"\n :optional=\"optional\"\n :required=\"required\"\n :hide-label=\"hideLabel\"\n :tooltip-text=\"tooltipText\"\n >\n <radio-button\n v-for=\"item in items\"\n :key=\"item.value\"\n :model-value=\"inputValue\"\n :value=\"item.value\"\n :disabled=\"disabled || item.disabled\"\n :readonly=\"isReadOnly || item.readonly\"\n :has-error=\"shouldShowError || item.hasError\"\n @update:model-value=\"onInput\"\n >\n {{ item.label }}\n <template v-if=\"item.description\" #description>{{ item.description }}</template>\n </radio-button>\n </controls-group>\n <error-message\n v-if=\"shouldShowErrorMessage\"\n :id=\"errorId\"\n :error-message=\"errorMessage\"\n class=\"b-radio-group__error-message\"\n />\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, PropType, toRef } from 'vue';\n import { ControlsGroup, ErrorMessage } from '@/components/internal';\n import RadioButton from './components/radio-button/radio-button.vue';\n import { generateUid } from '@/utils/ts/unique-id';\n import { deprecate } from '@/utils/ts/deprecate';\n import { BentoRadioGroupEvent, BentoRadioGroupItems, BentoRadioGroupVariant } from './radio-group.types';\n import { useFormLayoutFieldLoading } from '@/composables/use-form-layout-loading/use-form-layout-loading';\n\n /**\n * A radio group component should be used whenever it is necessary to use a set of radio buttons\n * This component conforms to the official WAI-ARIA guidelines for grouping controls: https://www.w3.org/WAI/tutorials/forms/grouping/\n *\n * import { BentoRadioGroup } from '@adyen/bento-vue2/';\n *\n * export default {\n * components: { BentoRadioGroup },\n * template: `\n * <bento-radio-group\n * label=\"Your group label\"\n * :items=\"[\n * { value: 1, label: 'Your label' },\n * { value: 2, label: 'Another label', description: 'Your descriptive sub label' },\n * ]\"\n * variant=\"horizontal\"\n * />\n * `\n * };\n */\n export default defineComponent({\n name: 'bento-radio-group',\n components: { ControlsGroup, ErrorMessage, RadioButton },\n model: { prop: 'modelValue' },\n props: {\n /**\n * Descriptive supporting text visbile underneath the label.\n */\n description: { type: String, default: null },\n\n /**\n * If set to true, renders all radio-buttons in the group in a disabled state.\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * If string is passed, all radio-buttons in an error state and renders the string beneath the buttons.\n */\n errorMessage: { type: String, default: null },\n\n /**\n * The form id the radio group is associated with. Defaults to null, as a radio group can also be used standalone.\n */\n formId: { type: String, default: null },\n\n /**\n * If set to true, renders all radio-buttons in the group in an error state.\n *\n * @deprecated Use \"errorMessage\" prop instead\n */\n hasError: { type: Boolean, default: false },\n\n /**\n * Shows/hides the group label.\n */\n hideLabel: { type: Boolean, default: null },\n\n /**\n * The radio group's items.\n */\n items: { type: Array as PropType<BentoRadioGroupItems>, required: true },\n\n /**\n * The name associated with the group. Required for accessibility purposes.\n */\n label: { type: String, required: true },\n\n /**\n * Determines the initially selected value of the group. Corresponds to the BentoRadioButtonItem's value.\n * Defaults to no value selected.\n */\n modelValue: { type: [Number, String, null], default: null },\n\n /**\n * Indicates the field is optional.\n */\n optional: { type: Boolean, default: false },\n\n /**\n * If set to true, renders all radio-buttons in the group in a readonly state.\n */\n readonly: { type: Boolean, default: false },\n\n /**\n * Indicates the field is required.\n */\n required: { type: Boolean, default: false },\n\n /**\n * Tooltip message.\n */\n tooltipText: { type: String, default: null },\n\n /**\n * The radio group's layout. It can be vertical or horizontal. Defaults to vertical.\n */\n variant: {\n type: String as PropType<BentoRadioGroupVariant | `${BentoRadioGroupVariant}`>,\n default: BentoRadioGroupVariant.VERTICAL,\n validator: (value: BentoRadioGroupVariant) => Object.values(BentoRadioGroupVariant).includes(value),\n },\n },\n emits: [BentoRadioGroupEvent.UPDATE, BentoRadioGroupEvent.INPUT],\n setup(props, { emit }) {\n const inputValue = toRef(props, 'modelValue');\n const errorId = generateUid('error');\n const { isReadOnly } = useFormLayoutFieldLoading(toRef(props, 'readonly'));\n\n const shouldShowError = computed(\n () => !props.disabled && !isReadOnly.value && (!!props.errorMessage || props.hasError)\n );\n const shouldShowErrorMessage = computed(() => !props.disabled && !isReadOnly.value && !!props.errorMessage);\n\n const conditionalClasses = computed(() => ({\n 'b-radio-group__buttons--horizontal': props.variant === BentoRadioGroupVariant.HORIZONTAL,\n }));\n\n const onInput = value => {\n emit(BentoRadioGroupEvent.UPDATE, value);\n emit(BentoRadioGroupEvent.INPUT, value);\n };\n\n if (props.hasError) {\n deprecate(\n 'BentoRadioGroup \"hasError\" property',\n `Use the BentoRadioGroup \"errorMessage\" property instead to indicate that there is a modifier error.\n Having the field as \"undefined\" will hide/remove the error.\n <bento-radio-group errorMessage=\"Error message text\" />`,\n '2.0.0'\n );\n }\n\n return {\n // Values\n inputValue,\n errorId,\n isReadOnly,\n shouldShowError,\n shouldShowErrorMessage,\n conditionalClasses,\n\n // Methods\n onInput,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./radio-group.scss\" />\n"],"names":["BentoRadioButtonStateClass","BentoRadioButtonStateClass2","BentoRadioGroupVariant","BentoRadioGroupVariant2","BentoRadioGroupEvent","BentoRadioGroupEvent2","_sfc_main$1","defineComponent","BentoTypography","props","slots","emit","value","toRefs","radioButtonId","generateUid","descriptionId","defaultSlotValue","getSlotText","descriptionSlotValue","useDefaultSlotValidator","conditionalClassContainer","computed","conditionalClassInput","ariaLabel","useAriaLabel","ariaInvalid","isChecked","onChange","onClick","event","useHasSlot","_sfc_main","ControlsGroup","ErrorMessage","RadioButton","inputValue","toRef","errorId","isReadOnly","useFormLayoutFieldLoading","shouldShowError","shouldShowErrorMessage","conditionalClasses","onInput","deprecate"],"mappings":";;;;;;;;;;;;AAAY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,WAAA,YACAA,EAAA,WAAA,YACAA,EAAA,QAAA,SAHQA,IAAAD,KAAA,CAAA,CAAA,GCGAE,IAAA,kBAAAC,OACRA,EAAA,aAAA,cACAA,EAAA,WAAA,YAFQA,IAAAD,KAAA,CAAA,CAAA,GAgBAE,IAAA,kBAAAC,OACRA,EAAA,SAAA,sBACAA,EAAA,QAAA,SAFQA,IAAAD,KAAA,CAAA,CAAA;ACkDZ,MAAAE,IAAAC,EAAA;AAAA,EAAA,MAAA;AAAA,EACA,YAAA,EAAA,iBAAAC,EAAA;AAAA,EACA,OAAA;AAAA;AAAA;AAAA;AAAA,IACA,UAAA;AAAA,MAIA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IACA,UAAA;AAAA,MAIA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA,IACA,YAAA;AAAA,MAKA,MAAA,CAAA,QAAA,MAAA;AA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"radio-group.js","sources":["../src/components/radio-group/components/radio-button/radio-button.types.ts","../src/components/radio-group/radio-group.types.ts","../src/components/radio-group/components/radio-button/radio-button.vue","../src/components/radio-group/radio-group.vue"],"sourcesContent":["export enum BentoRadioButtonStateClass {\n DISABLED = 'disabled',\n READONLY = 'readonly',\n ERROR = 'error',\n}\n","/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoRadioGroupVariant {\n HORIZONTAL = 'horizontal',\n VERTICAL = 'vertical',\n}\n\nexport interface BentoRadioGroupItem {\n value: string | number;\n label: string;\n description?: string;\n disabled?: boolean;\n readonly?: boolean;\n hasError?: boolean;\n}\n\nexport type BentoRadioGroupItems = Array<BentoRadioGroupItem>;\n\nexport enum BentoRadioGroupEvent {\n UPDATE = 'update:model-value',\n INPUT = 'input',\n}\n","<template>\n <div class=\"b-radio-button\" data-testid=\"radio-button-container\" :class=\"conditionalClassContainer\">\n <input\n :id=\"radioButtonId\"\n :aria-checked=\"isChecked\"\n :aria-label=\"ariaLabel\"\n :aria-invalid=\"ariaInvalid\"\n :aria-describedby=\"hasSlot('description') ? descriptionId : ''\"\n :checked=\"isChecked\"\n :disabled=\"disabled\"\n :aria-readonly=\"readonly ? readonly : undefined\"\n :value=\"value\"\n type=\"radio\"\n class=\"b-radio-button__input\"\n :class=\"conditionalClassInput\"\n role=\"radio\"\n @click=\"onClick\"\n @change=\"onChange\"\n />\n <label v-if=\"hasSlot('default')\" :for=\"radioButtonId\" class=\"b-radio-button__label-container\">\n <bento-typography v-if=\"hasSlot('default')\" class=\"b-radio-button__label\" el=\"span\" variant=\"body\">\n <slot></slot>\n </bento-typography>\n <bento-typography\n v-if=\"hasSlot('default') && hasSlot('description')\"\n :id=\"descriptionId\"\n class=\"b-radio-button__description\"\n el=\"span\"\n variant=\"body\"\n >\n <slot name=\"description\"></slot>\n </bento-typography>\n <bento-typography v-if=\"hasSlot('content') && isChecked\" class=\"b-radio-button__content\" el=\"div\">\n <slot name=\"content\"></slot>\n </bento-typography>\n </label>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { BentoTypography } from '@/components/typography';\n import type { HTMLAttributes } from 'vue/types/jsx';\n import { useAriaLabel } from '@/utils/ts/aria-label';\n import { generateUid } from '@/utils/ts/unique-id';\n import { computed, ComputedRef, defineComponent, toRefs } from 'vue';\n import { useDefaultSlotValidator, useHasSlot } from '@/composables';\n import { BentoRadioButtonStateClass } from './radio-button.types';\n import { BentoRadioGroupEvent } from '../../radio-group.types';\n import { getSlotText } from '@/utils/ts/get-slot-text';\n\n /**\n * Radio buttons are used when two or more options are mutually exclusive,\n * the user can only select a single option from a list of pre-defined options.\n * The label tag area is also clickable.\n * Only to be used internally.\n *\n * @usage\n * import { RadioButton } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { RadioButton },\n * template: `\n * <radio-button\n * disabled\n * value=\"inputRadio\"\n * >\n * Label text\n * <template #description>Description text below label</template>\n * </radio-button>\n * `,\n * }\n */\n export default defineComponent({\n name: 'radio-button',\n components: { BentoTypography },\n props: {\n /**\n * Disable the radio button (optional)\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n /**\n * Shows radio-button in error state (optional)\n */\n hasError: {\n type: Boolean,\n default: false,\n },\n /**\n * This property should not be used directly.\n * It will be used by v-model directive on radio component.\n */\n modelValue: {\n type: [String, Number],\n default: null,\n },\n /**\n * Sets the radio button to readonly (optional)\n */\n readonly: {\n type: Boolean,\n default: false,\n },\n /**\n * Indicates the value of the input that will be returned when it's checked\n */\n value: {\n type: [String, Number],\n required: true,\n },\n },\n emits: [BentoRadioGroupEvent.UPDATE],\n setup(props, { slots, emit }) {\n const { value } = toRefs(props);\n const radioButtonId = generateUid('radio-button');\n const descriptionId = generateUid('description');\n\n const defaultSlotValue = getSlotText(slots)('default');\n const descriptionSlotValue = getSlotText(slots)('description');\n\n useDefaultSlotValidator('radio-button', slots.default, slots.description);\n\n const conditionalClassContainer = computed(() => ({\n [`b-radio-button--${BentoRadioButtonStateClass.DISABLED}`]: props.disabled,\n [`b-radio-button--${BentoRadioButtonStateClass.READONLY}`]: props.readonly,\n }));\n const conditionalClassInput = computed(() => ({\n [`b-radio-button__input--${BentoRadioButtonStateClass.ERROR}`]: props.hasError,\n }));\n\n const ariaLabel = useAriaLabel({\n ariaLabel: getSlotText(slots)('default'),\n label: value.value as string,\n });\n const ariaInvalid = computed<HTMLAttributes['aria-invalid']>(() => props.hasError);\n\n const isChecked: ComputedRef<boolean> = computed(() => props.value === props.modelValue);\n\n const onChange = () => {\n if (!props.disabled && !props.readonly) {\n emit(BentoRadioGroupEvent.UPDATE, props.value);\n }\n };\n\n // readonly attr doesn't work with radio button, so we need to manually ignore the click instead\n const onClick = event => {\n if (props.readonly) {\n event.preventDefault();\n }\n };\n\n return {\n // Values\n ariaLabel,\n ariaInvalid,\n isChecked,\n defaultSlotValue,\n descriptionSlotValue,\n conditionalClassContainer,\n conditionalClassInput,\n radioButtonId,\n descriptionId,\n\n // Methods\n hasSlot: useHasSlot(slots),\n onChange,\n onClick,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./radio-button.scss\" />\n","<template>\n <div class=\"b-radio-group\">\n <controls-group\n class=\"b-radio-group__buttons\"\n :aria-describedby=\"shouldShowErrorMessage ? errorId : ''\"\n :class=\"conditionalClasses\"\n :description=\"description\"\n :disabled=\"disabled\"\n :form=\"formId\"\n :label=\"label\"\n :optional=\"optional\"\n :required=\"required\"\n :hide-label=\"hideLabel\"\n :tooltip-text=\"tooltipText\"\n >\n <radio-button\n v-for=\"item in items\"\n :key=\"item.value\"\n :model-value=\"inputValue\"\n :value=\"item.value\"\n :disabled=\"disabled || item.disabled\"\n :readonly=\"isReadOnly || item.readonly\"\n :has-error=\"shouldShowError || item.hasError\"\n @update:model-value=\"onInput\"\n >\n {{ item.label }}\n <template v-if=\"item.description\" #description>{{ item.description }}</template>\n <template v-if=\"contentSlotAvailable\" #content>\n <slot name=\"content\"></slot>\n </template>\n </radio-button>\n </controls-group>\n <error-message\n v-if=\"shouldShowErrorMessage\"\n :id=\"errorId\"\n :error-message=\"errorMessage\"\n class=\"b-radio-group__error-message\"\n />\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, PropType, toRef, watch } from 'vue';\n import { ControlsGroup, ErrorMessage } from '@/components/internal';\n import RadioButton from './components/radio-button/radio-button.vue';\n import { useHasSlot } from '@/composables';\n import { generateUid } from '@/utils/ts/unique-id';\n import { deprecate } from '@/utils/ts/deprecate';\n import { BentoRadioGroupEvent, BentoRadioGroupItems, BentoRadioGroupVariant } from './radio-group.types';\n import { useFormLayoutFieldLoading } from '@/composables/use-form-layout-loading/use-form-layout-loading';\n\n /**\n * A radio group component should be used whenever it is necessary to use a set of radio buttons\n * This component conforms to the official WAI-ARIA guidelines for grouping controls: https://www.w3.org/WAI/tutorials/forms/grouping/\n *\n * import { BentoRadioGroup } from '@adyen/bento-vue2/';\n *\n * export default {\n * components: { BentoRadioGroup },\n * template: `\n * <bento-radio-group\n * label=\"Your group label\"\n * :items=\"[\n * { value: 1, label: 'Your label' },\n * { value: 2, label: 'Another label', description: 'Your descriptive sub label' },\n * ]\"\n * variant=\"horizontal\"\n * />\n * `\n * };\n */\n export default defineComponent({\n name: 'bento-radio-group',\n components: { ControlsGroup, ErrorMessage, RadioButton },\n model: { prop: 'modelValue' },\n props: {\n /**\n * Descriptive supporting text visbile underneath the label.\n */\n description: { type: String, default: null },\n\n /**\n * If set to true, renders all radio-buttons in the group in a disabled state.\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * If string is passed, all radio-buttons in an error state and renders the string beneath the buttons.\n */\n errorMessage: { type: String, default: null },\n\n /**\n * The form id the radio group is associated with. Defaults to null, as a radio group can also be used standalone.\n */\n formId: { type: String, default: null },\n\n /**\n * If set to true, renders all radio-buttons in the group in an error state.\n *\n * @deprecated Use \"errorMessage\" prop instead\n */\n hasError: { type: Boolean, default: false },\n\n /**\n * Shows/hides the group label.\n */\n hideLabel: { type: Boolean, default: null },\n\n /**\n * The radio group's items.\n */\n items: { type: Array as PropType<BentoRadioGroupItems>, required: true },\n\n /**\n * The name associated with the group. Required for accessibility purposes.\n */\n label: { type: String, required: true },\n\n /**\n * Determines the initially selected value of the group. Corresponds to the BentoRadioButtonItem's value.\n * Defaults to no value selected.\n */\n modelValue: { type: [Number, String, null], default: null },\n\n /**\n * Indicates the field is optional.\n */\n optional: { type: Boolean, default: false },\n\n /**\n * If set to true, renders all radio-buttons in the group in a readonly state.\n */\n readonly: { type: Boolean, default: false },\n\n /**\n * Indicates the field is required.\n */\n required: { type: Boolean, default: false },\n\n /**\n * Tooltip message.\n */\n tooltipText: { type: String, default: null },\n\n /**\n * The radio group's layout. It can be vertical or horizontal. Defaults to vertical.\n */\n variant: {\n type: String as PropType<BentoRadioGroupVariant | `${BentoRadioGroupVariant}`>,\n default: BentoRadioGroupVariant.VERTICAL,\n validator: (value: BentoRadioGroupVariant) => Object.values(BentoRadioGroupVariant).includes(value),\n },\n },\n emits: [BentoRadioGroupEvent.UPDATE, BentoRadioGroupEvent.INPUT],\n setup(props, { slots, emit }) {\n const inputValue = toRef(props, 'modelValue');\n const errorId = generateUid('error');\n const { isReadOnly } = useFormLayoutFieldLoading(toRef(props, 'readonly'));\n const hasSlot = useHasSlot(slots);\n\n const shouldShowError = computed(\n () => !props.disabled && !isReadOnly.value && (!!props.errorMessage || props.hasError)\n );\n const shouldShowErrorMessage = computed(() => !props.disabled && !isReadOnly.value && !!props.errorMessage);\n\n const conditionalClasses = computed(() => ({\n 'b-radio-group__buttons--horizontal': props.variant === BentoRadioGroupVariant.HORIZONTAL,\n }));\n\n // Content slot logic\n const isVertical = computed(() => props.variant === 'vertical');\n const hasContentSlot = computed(() => hasSlot('content'));\n const contentSlotAvailable = computed(() => hasContentSlot?.value && isVertical?.value);\n const shouldShowSlotError = computed(() => hasContentSlot?.value && !isVertical?.value);\n\n const onInput = value => {\n emit(BentoRadioGroupEvent.UPDATE, value);\n emit(BentoRadioGroupEvent.INPUT, value);\n };\n\n if (props.hasError) {\n deprecate(\n 'BentoRadioGroup \"hasError\" property',\n `Use the BentoRadioGroup \"errorMessage\" property instead to indicate that there is a modifier error.\n Having the field as \"undefined\" will hide/remove the error.\n <bento-radio-group errorMessage=\"Error message text\" />`,\n '2.0.0'\n );\n }\n\n watch(\n shouldShowSlotError,\n newVal => {\n if (newVal) {\n throw new Error('The content slot is only available for the vertical radio group layout');\n }\n },\n {\n immediate: true,\n }\n );\n\n return {\n // Values\n inputValue,\n errorId,\n isReadOnly,\n shouldShowError,\n shouldShowErrorMessage,\n conditionalClasses,\n contentSlotAvailable,\n isVertical,\n shouldShowSlotError,\n hasContentSlot,\n hasSlot,\n\n // Methods\n onInput,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./radio-group.scss\" />\n"],"names":["BentoRadioButtonStateClass","BentoRadioButtonStateClass2","BentoRadioGroupVariant","BentoRadioGroupVariant2","BentoRadioGroupEvent","BentoRadioGroupEvent2","_sfc_main$1","defineComponent","BentoTypography","props","slots","emit","value","toRefs","radioButtonId","generateUid","descriptionId","defaultSlotValue","getSlotText","descriptionSlotValue","useDefaultSlotValidator","conditionalClassContainer","computed","conditionalClassInput","ariaLabel","useAriaLabel","ariaInvalid","isChecked","onChange","onClick","event","useHasSlot","_sfc_main","ControlsGroup","ErrorMessage","RadioButton","inputValue","toRef","errorId","isReadOnly","useFormLayoutFieldLoading","hasSlot","shouldShowError","shouldShowErrorMessage","conditionalClasses","isVertical","hasContentSlot","contentSlotAvailable","shouldShowSlotError","onInput","deprecate","watch","newVal"],"mappings":";;;;;;;;;;;;AAAY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,WAAA,YACAA,EAAA,WAAA,YACAA,EAAA,QAAA,SAHQA,IAAAD,KAAA,CAAA,CAAA,GCGAE,IAAA,kBAAAC,OACRA,EAAA,aAAA,cACAA,EAAA,WAAA,YAFQA,IAAAD,KAAA,CAAA,CAAA,GAgBAE,IAAA,kBAAAC,OACRA,EAAA,SA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EAAA,GAIA2C,IAAAvB,EAAA,MAAAb,EAAA,YAAA,UAAA,GACAqC,IAAAxB,EAAA,MAAAmB,EAAA,SAAA,CAAA,GACAM,IAAAzB,EAAA,OAAAwB,KAAA,gBAAAA,EAAA,WAAAD,KAAA,gBAAAA,EAAA,MAAA,GACAG,IAAA1B,EAAA,OAAAwB,KAAA,gBAAAA,EAAA,UAAA,EAAAD,KAAA,QAAAA,EAAA,MAAA,GAEAI,IAAA,CAAArC,MAAA;AACA,MAAAD,EAAAP,EAAA,QAAAQ,CAAA,GACAD,EAAAP,EAAA,OAAAQ,CAAA;AAAA,IAAA;AAGA,WAAAH,EAAA,YACAyC;AAAA,MAAA;AAAA,MACA;AAAA;AAAA;AAAA,MACA;AAAA,IAGA,GAIAC;AAAA,MAAAH;AAAA,MACA,CAAAI,MAAA;AAEA,YAAAA;AACA,gBAAA,IAAA,MAAA,wEAAA;AAAA,MACA;AAAA,MACA;AAAA,QACA,WAAA;AAAA,MACA;AAAA,IACA,GAGA;AAAA;AAAA,MAAA,YAAAhB;AAAA,MAEA,SAAAE;AAAA,MACA,YAAAC;AAAA,MACA,iBAAAG;AAAA,MACA,wBAAAC;AAAA,MACA,oBAAAC;AAAA,MACA,sBAAAG;AAAA,MACA,YAAAF;AAAA,MACA,qBAAAG;AAAA,MACA,gBAAAF;AAAA,MACA,SAAAL;AAAA;AAAA,MACA,SAAAQ;AAAA,IAGA;AAAA,EACA;AAEA,CAAA;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/search-bar.js
CHANGED
|
@@ -5,8 +5,8 @@ import { BentoInputField as m } from "./input-field.js";
|
|
|
5
5
|
import { S as h } from "./chunks/search.a8055e95.js";
|
|
6
6
|
import { C as y } from "./chunks/cross-circle-fill.d5e9ae44.js";
|
|
7
7
|
import { n as C } from "./chunks/_plugin-vue2_normalizer.71e2aa87.js";
|
|
8
|
-
import { u as w } from "./chunks/dropdown.
|
|
9
|
-
import "./assets/
|
|
8
|
+
import { u as w } from "./chunks/dropdown.f1253a54.js";
|
|
9
|
+
import "./assets/index9.css";
|
|
10
10
|
var o = /* @__PURE__ */ ((t) => (t.CLEAR = "clear", t.ESCAPE = "escape-pressed", t.INPUT = "input", t.UPDATE = "update:search-term", t))(o || {}), b = /* @__PURE__ */ ((t) => (t.CLEAR = "search-clear", t.INPUT = "search-input", t.UPDATE = "update:search-term", t))(b || {});
|
|
11
11
|
const v = {
|
|
12
12
|
"en-US": {
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { B as
|
|
3
|
-
import { g } from "./chunks/unique-id.a2a2b458.js";
|
|
4
|
-
import { C as
|
|
5
|
-
import { n as
|
|
6
|
-
import {
|
|
7
|
-
import { u as
|
|
8
|
-
import {
|
|
9
|
-
import "./
|
|
10
|
-
|
|
1
|
+
import { defineComponent as g, ref as r, computed as s, toRef as k, toRefs as w, onMounted as L } from "vue";
|
|
2
|
+
import { B as x } from "./chunks/index.965ac1af.js";
|
|
3
|
+
import { g as I } from "./chunks/unique-id.a2a2b458.js";
|
|
4
|
+
import { C as S } from "./chunks/checkmark.78f3ed9c.js";
|
|
5
|
+
import { n as v } from "./chunks/_plugin-vue2_normalizer.71e2aa87.js";
|
|
6
|
+
import { u as $ } from "./chunks/i18n.155748d6.js";
|
|
7
|
+
import { u as W } from "./chunks/aria-label.ac9651a5.js";
|
|
8
|
+
import { o as T } from "./chunks/resize.a041304d.js";
|
|
9
|
+
import { b as A } from "./chunks/tooltip.104e5fac.js";
|
|
10
|
+
import "./assets/index8.css";
|
|
11
|
+
const F = g({
|
|
11
12
|
name: "bento-segmented-control-button",
|
|
12
|
-
components: { BentoTypography:
|
|
13
|
+
components: { BentoTypography: x, CheckmarkIcon: S },
|
|
13
14
|
props: {
|
|
14
15
|
/**
|
|
15
16
|
* The string the button will showcase
|
|
@@ -46,19 +47,36 @@ const P = f({
|
|
|
46
47
|
fullWidth: {
|
|
47
48
|
type: Boolean,
|
|
48
49
|
default: !1
|
|
50
|
+
},
|
|
51
|
+
/**
|
|
52
|
+
* Renders the button with a truncated text if the space is not enough to render the whole content
|
|
53
|
+
*/
|
|
54
|
+
truncate: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
default: !1
|
|
57
|
+
},
|
|
58
|
+
/**
|
|
59
|
+
* Renders the button with centered text in case the text has to wrap multiple lines
|
|
60
|
+
*/
|
|
61
|
+
wrap: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
default: !1
|
|
49
64
|
}
|
|
50
65
|
},
|
|
51
66
|
emits: ["update:model-value"],
|
|
52
67
|
setup(t, { emit: e }) {
|
|
53
|
-
const n =
|
|
68
|
+
const n = r(), o = I("segmented-control-button"), a = s(() => t.value === t.modelValue), i = s(() => ({
|
|
54
69
|
"b-segmented-control-button--hug-content": !t.fullWidth,
|
|
55
|
-
"b-segmented-control-button--full-width": t.fullWidth
|
|
70
|
+
"b-segmented-control-button--full-width": t.fullWidth,
|
|
71
|
+
"b-segmented-control-button--truncate": t.truncate,
|
|
72
|
+
"b-segmented-control-button--wrap": t.wrap && !t.truncate
|
|
56
73
|
}));
|
|
57
74
|
return {
|
|
58
75
|
// Values
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
76
|
+
segmentedControlButtonLabel: n,
|
|
77
|
+
segmentedControlButtonId: o,
|
|
78
|
+
isChecked: a,
|
|
79
|
+
conditionalClasses: i,
|
|
62
80
|
// Methods
|
|
63
81
|
onClick: () => {
|
|
64
82
|
t.disabled || e("update:model-value", t.value);
|
|
@@ -66,29 +84,30 @@ const P = f({
|
|
|
66
84
|
};
|
|
67
85
|
}
|
|
68
86
|
});
|
|
69
|
-
var
|
|
87
|
+
var P = function() {
|
|
70
88
|
var e = this, n = e._self._c;
|
|
71
|
-
return e._self._setupProxy, n("div", { staticClass: "b-segmented-control-button", class: e.conditionalClasses }, [n("input", { staticClass: "b-segmented-control-button__input", attrs: { id: e.segmentedControlButtonId, "aria-checked": e.isChecked, "aria-label": e.label, disabled: e.disabled, type: "radio", role: "radio" }, domProps: { checked: e.isChecked, value: e.value }, on: { change: e.onClick } }), e.label ? n("label", { staticClass: "b-segmented-control-button__label-container", attrs: { for: e.segmentedControlButtonId } }, [e.isChecked ? n("checkmark-icon", { staticClass: "b-segmented-control-button__icon", attrs: { "aria-hidden": "true" } }) : e._e(), n("bento-typography", { staticClass: "b-segmented-control-button__label", attrs: { el: "span", variant: "body", stronger: "" } }, [e._v(" " + e._s(e.label) + " ")])], 1) : e._e()]);
|
|
72
|
-
},
|
|
89
|
+
return e._self._setupProxy, n("div", { staticClass: "b-segmented-control-button", class: e.conditionalClasses }, [n("input", { staticClass: "b-segmented-control-button__input", attrs: { id: e.segmentedControlButtonId, "aria-checked": e.isChecked, "aria-label": e.label, disabled: e.disabled, type: "radio", role: "radio" }, domProps: { checked: e.isChecked, value: e.value }, on: { change: e.onClick } }), e.label ? n("label", { staticClass: "b-segmented-control-button__label-container", attrs: { for: e.segmentedControlButtonId } }, [e.isChecked ? n("checkmark-icon", { staticClass: "b-segmented-control-button__icon", attrs: { "aria-hidden": "true" } }) : e._e(), n("bento-typography", { ref: "segmentedControlButtonLabel", staticClass: "b-segmented-control-button__label", attrs: { el: "span", variant: "body", stronger: "" } }, [e._v(" " + e._s(e.label) + " ")])], 1) : e._e()]);
|
|
90
|
+
}, R = [], V = /* @__PURE__ */ v(
|
|
91
|
+
F,
|
|
73
92
|
P,
|
|
74
93
|
R,
|
|
75
|
-
U,
|
|
76
94
|
!1,
|
|
77
95
|
null,
|
|
78
|
-
"
|
|
96
|
+
"eb54027d",
|
|
79
97
|
null,
|
|
80
98
|
null
|
|
81
99
|
);
|
|
82
|
-
const
|
|
83
|
-
var
|
|
84
|
-
const
|
|
100
|
+
const U = V.exports;
|
|
101
|
+
var f = /* @__PURE__ */ ((t) => (t.UPDATE = "update:model-value", t))(f || {});
|
|
102
|
+
const q = {
|
|
85
103
|
"en-US": {
|
|
86
104
|
ariaLabelFallback: "Segmented control"
|
|
87
105
|
}
|
|
88
|
-
},
|
|
106
|
+
}, D = g({
|
|
89
107
|
name: "bento-segmented-control",
|
|
90
|
-
i18n: { messages:
|
|
91
|
-
components: {
|
|
108
|
+
i18n: { messages: q },
|
|
109
|
+
components: { SegmentedControlButton: U },
|
|
110
|
+
directives: { BentoTooltipDirective: A },
|
|
92
111
|
props: {
|
|
93
112
|
/**
|
|
94
113
|
* Items that will populate the segmented control.
|
|
@@ -121,68 +140,79 @@ const F = {
|
|
|
121
140
|
fullWidth: {
|
|
122
141
|
type: Boolean,
|
|
123
142
|
default: !1
|
|
143
|
+
},
|
|
144
|
+
/**
|
|
145
|
+
* 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.
|
|
146
|
+
*/
|
|
147
|
+
wrap: {
|
|
148
|
+
type: Boolean,
|
|
149
|
+
default: !1
|
|
124
150
|
}
|
|
125
151
|
},
|
|
126
|
-
emits: [
|
|
152
|
+
emits: [f.UPDATE],
|
|
127
153
|
setup(t, { attrs: e, emit: n }) {
|
|
128
|
-
const { t: o } =
|
|
129
|
-
|
|
130
|
-
S(() => {
|
|
131
|
-
const i = {
|
|
132
|
-
root: null,
|
|
133
|
-
// To prevent the observer from triggering on vertical intersection
|
|
134
|
-
rootMargin: "100% 0% 100% 0%",
|
|
135
|
-
threshold: 1
|
|
136
|
-
};
|
|
137
|
-
d = new IntersectionObserver((s) => {
|
|
138
|
-
s && s.length && (s[s.length - 1].isIntersecting ? a.value = !0 : a.value = !1);
|
|
139
|
-
}, i), d.observe(_.value);
|
|
140
|
-
}), B(() => {
|
|
141
|
-
d.disconnect();
|
|
142
|
-
});
|
|
143
|
-
const v = u(e["aria-label"]), { ariaLabel: C } = I(t), h = x({
|
|
144
|
-
ariaLabel: v.value,
|
|
154
|
+
const { t: o } = $(), a = k(t, "modelValue"), i = r(e["aria-label"]), { ariaLabel: _ } = w(t), C = W({
|
|
155
|
+
ariaLabel: i.value,
|
|
145
156
|
// TODO: take this line away when the aria-label props is removed
|
|
146
|
-
label:
|
|
157
|
+
label: _,
|
|
147
158
|
defaultFallback: o("ariaLabelFallback")
|
|
148
|
-
}),
|
|
149
|
-
|
|
150
|
-
|
|
159
|
+
}), m = r(), d = r(), u = r(), b = s(() => !t.wrap);
|
|
160
|
+
L(() => {
|
|
161
|
+
T(m.value, () => {
|
|
162
|
+
var l;
|
|
163
|
+
m.value && (u.value = (l = d == null ? void 0 : d.value) == null ? void 0 : l.map(
|
|
164
|
+
(c) => c.$refs.segmentedControlButtonLabel.$el.offsetWidth < c.$refs.segmentedControlButtonLabel.$el.scrollWidth
|
|
165
|
+
));
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
const h = s(
|
|
169
|
+
() => t.items.map((l, c) => {
|
|
170
|
+
var p;
|
|
171
|
+
return {
|
|
172
|
+
...l,
|
|
173
|
+
tooltipText: b.value && ((p = u == null ? void 0 : u.value) != null && p[c]) ? l.label : void 0
|
|
174
|
+
};
|
|
175
|
+
})
|
|
176
|
+
), y = (l) => {
|
|
177
|
+
n(f.UPDATE, l);
|
|
178
|
+
}, B = s(() => ({
|
|
179
|
+
"b-segmented-control--hug": !t.fullWidth,
|
|
180
|
+
"b-segmented-control--full-width": t.fullWidth,
|
|
181
|
+
"b-segmented-control--truncate": b.value,
|
|
182
|
+
"b-segmented-control--wrap": t.wrap
|
|
151
183
|
}));
|
|
152
184
|
return {
|
|
153
185
|
// Values
|
|
154
|
-
computedAriaLabel:
|
|
155
|
-
inputValue:
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
186
|
+
computedAriaLabel: C,
|
|
187
|
+
inputValue: a,
|
|
188
|
+
segmentedControlRef: m,
|
|
189
|
+
segmentedControlButtonRef: d,
|
|
190
|
+
computedItems: h,
|
|
191
|
+
truncate: b,
|
|
192
|
+
conditionalClasses: B,
|
|
161
193
|
// Methods
|
|
162
|
-
onInput:
|
|
163
|
-
n(c.UPDATE, i);
|
|
164
|
-
}
|
|
194
|
+
onInput: y
|
|
165
195
|
};
|
|
166
196
|
}
|
|
167
197
|
});
|
|
168
|
-
var
|
|
198
|
+
var N = function() {
|
|
169
199
|
var e = this, n = e._self._c;
|
|
170
|
-
return e._self._setupProxy, n("div", {
|
|
171
|
-
return n("segmented-control-button", { key: `segmented-control-item-${
|
|
172
|
-
}), 1)
|
|
173
|
-
},
|
|
174
|
-
q,
|
|
200
|
+
return e._self._setupProxy, n("div", { ref: "segmentedControlRef", staticClass: "b-segmented-control", class: e.conditionalClasses, attrs: { role: "group" } }, e._l(e.computedItems, function(o, a) {
|
|
201
|
+
return n("segmented-control-button", { directives: [{ name: "bento-tooltip-directive", rawName: "v-bento-tooltip-directive", value: o.tooltipText, expression: "item.tooltipText" }], key: `segmented-control-item-${a}-${o.label}`, ref: "segmentedControlButtonRef", refInFor: !0, staticClass: "b-segmented-control__item", attrs: { label: o.label, value: o.value, disabled: o.disabled, truncate: e.truncate, wrap: e.wrap, "full-width": e.fullWidth, "model-value": e.inputValue }, on: { "update:model-value": e.onInput } });
|
|
202
|
+
}), 1);
|
|
203
|
+
}, E = [], z = /* @__PURE__ */ v(
|
|
175
204
|
D,
|
|
176
|
-
|
|
205
|
+
N,
|
|
206
|
+
E,
|
|
177
207
|
!1,
|
|
178
208
|
null,
|
|
179
|
-
"
|
|
209
|
+
"da20e96f",
|
|
180
210
|
null,
|
|
181
211
|
null
|
|
182
212
|
);
|
|
183
|
-
const
|
|
213
|
+
const Y = z.exports;
|
|
184
214
|
export {
|
|
185
|
-
|
|
186
|
-
|
|
215
|
+
Y as BentoSegmentedControl,
|
|
216
|
+
f as BentoSegmentedControlEvent
|
|
187
217
|
};
|
|
188
218
|
//# sourceMappingURL=segmented-control.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"segmented-control.js","sources":["../src/components/segmented-control/components/segmented-control-button/segmented-control-button.vue","../src/components/segmented-control/segmented-control.types.ts","../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 <checkmark-icon v-if=\"isChecked\" aria-hidden=\"true\" class=\"b-segmented-control-button__icon\" />\n <bento-typography class=\"b-segmented-control-button__label\" el=\"span\" variant=\"body\" stronger>\n {{ label }}\n </bento-typography>\n </label>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { BentoTypography } from '@/components/typography';\n import { generateUid } from '@/utils/ts/unique-id';\n import { computed, ComputedRef, defineComponent } from 'vue';\n import CheckmarkIcon from '@adyen/ui-assets-icons-16/vue/checkmark';\n /**\n * Internal component to be used within the BentoSegmentedControl component only\n */\n export default defineComponent({\n name: 'bento-segmented-control-button',\n components: { BentoTypography, CheckmarkIcon },\n props: {\n /**\n * The string the button will showcase\n */\n label: {\n type: String,\n required: true,\n },\n /**\n * Indicates the value of the input that will be returned when it's selected\n */\n value: {\n type: [String, Number],\n required: true,\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: {\n type: [String, Number],\n default: null,\n },\n /**\n * Disable the radio button (optional)\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n /**\n * Renders the button with a 100% width\n */\n fullWidth: {\n type: Boolean,\n default: false,\n },\n },\n emits: ['update:model-value'],\n setup(props, { emit }) {\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 }));\n const onClick = () => {\n if (!props.disabled) {\n emit('update:model-value', props.value);\n }\n };\n return {\n // Values\n segmentedControlButtonId,\n isChecked,\n conditionalClasses,\n // Methods\n onClick,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./segmented-control-button.scss\" />\n","export interface BentoSegmentedControlItem {\n label: string;\n value: string | number;\n disabled?: boolean;\n}\n\nexport enum BentoSegmentedControlEvent {\n UPDATE = 'update:model-value',\n}\n","<template>\n <div class=\"b-segmented-control__wrapper\">\n <bento-dropdown\n v-if=\"isSegmentedControlHidden\"\n :id=\"dropdownId\"\n :aria-hidden=\"isSegmentedControlVisible\"\n :value=\"modelValue\"\n :items=\"items\"\n :aria-label=\"computedAriaLabel\"\n @input=\"onInput\"\n />\n <fieldset\n ref=\"segmentedControlRef\"\n role=\"group\"\n class=\"b-segmented-control\"\n :class=\"conditionalClasses\"\n :aria-hidden=\"isSegmentedControlHidden\"\n >\n <segmented-control-button\n v-for=\"(item, index) in items\"\n :key=\"`segmented-control-item-${index}-${item.label}`\"\n class=\"b-segmented-control__item\"\n :label=\"item.label\"\n :value=\"item.value\"\n :disabled=\"item.disabled\"\n :full-width=\"fullWidth\"\n :model-value=\"inputValue\"\n @update:model-value=\"onInput\"\n ></segmented-control-button>\n </fieldset>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, onMounted, onUnmounted, PropType, ref, toRef, toRefs } from 'vue';\n import SegmentedControlButton from './components/segmented-control-button/segmented-control-button.vue';\n import { BentoSegmentedControlEvent, BentoSegmentedControlItem } from './segmented-control.types';\n import { BentoDropdown } from '@/components/dropdown';\n import { generateUid } from '@/utils/ts/unique-id';\n import { useI18n } from '@/utils/ts/i18n';\n import { useAriaLabel } from '@/utils/ts/aria-label';\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\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 defineComponent({\n name: 'bento-segmented-control',\n i18n: { messages },\n components: { BentoDropdown, SegmentedControlButton },\n props: {\n /**\n * Items that will populate the segmented control.\n */\n items: {\n type: Array as PropType<BentoSegmentedControlItem[]>,\n required: true,\n validator: (arr: Array<BentoSegmentedControlItem[]>) => arr.length <= 5,\n },\n /**\n * Determines the selected value of the group. Corresponds to the BentoSegmentedControlItem's value.\n */\n modelValue: {\n type: [Number, String, null],\n required: true,\n },\n /**\n * @deprecated from version 2.0.0. Use the aria-label attribute instead.\n */\n /**\n * Accessible name describing the segmented control.\n */\n ariaLabel: {\n type: String,\n default: null,\n },\n /**\n * If set to true, renders the component full width.\n */\n fullWidth: {\n type: Boolean,\n default: false,\n },\n },\n\n emits: [BentoSegmentedControlEvent.UPDATE],\n setup(props, { attrs, emit }) {\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const inputValue = toRef(props, 'modelValue');\n const dropdownId = generateUid('segmented-control-dropdown');\n const segmentedControlRef = ref(null);\n const isSegmentedControlVisible = ref(true);\n let observer: IntersectionObserver;\n\n onMounted(() => {\n const config = {\n root: null,\n // To prevent the observer from triggering on vertical intersection\n rootMargin: '100% 0% 100% 0%',\n threshold: 1,\n };\n observer = new IntersectionObserver(entries => {\n if (entries && entries.length) {\n if (entries[entries.length - 1].isIntersecting) {\n // The segmented control is still visible within the viewport\n isSegmentedControlVisible.value = true;\n } else {\n // The segmented control is not fully visible anymore in the viewport\n isSegmentedControlVisible.value = false;\n }\n }\n }, config);\n observer.observe(segmentedControlRef.value);\n });\n\n onUnmounted(() => {\n observer.disconnect();\n });\n\n const ariaLabelAttribute = ref(attrs['aria-label']);\n const { ariaLabel } = toRefs(props);\n const computedAriaLabel = useAriaLabel({\n ariaLabel: ariaLabelAttribute.value as string,\n // TODO: take this line away when the aria-label props is removed\n label: ariaLabel,\n defaultFallback: t('ariaLabelFallback'),\n });\n\n const isSegmentedControlHidden = computed(() => isSegmentedControlVisible.value === false);\n\n const conditionalClasses = computed(() => ({\n 'b-segmented-control--hidden': isSegmentedControlHidden.value,\n 'b-segmented-control--full-width': props.fullWidth,\n }));\n\n const onInput = value => {\n emit(BentoSegmentedControlEvent.UPDATE, value);\n };\n\n return {\n // Values\n computedAriaLabel,\n inputValue,\n dropdownId,\n segmentedControlRef,\n conditionalClasses,\n isSegmentedControlVisible,\n isSegmentedControlHidden,\n\n // Methods\n onInput,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./segmented-control.scss\" />\n"],"names":["_sfc_main$1","defineComponent","BentoTypography","CheckmarkIcon","props","emit","segmentedControlButtonId","generateUid","isChecked","computed","conditionalClasses","BentoSegmentedControlEvent","BentoSegmentedControlEvent2","_sfc_main","messages","BentoDropdown","SegmentedControlButton","arr","attrs","t","useI18n","inputValue","toRef","dropdownId","segmentedControlRef","ref","isSegmentedControlVisible","observer","onMounted","config","entries","onUnmounted","ariaLabelAttribute","ariaLabel","toRefs","computedAriaLabel","useAriaLabel","isSegmentedControlHidden","value"],"mappings":";;;;;;;;;AA+BA,MAAAA,IAAAC,EAAA;AAAA,EAAA,MAAA;AAAA,EACA,YAAA,EAAA,iBAAAC,GAAA,eAAAC,EAAA;AAAA,EACA,OAAA;AAAA;AAAA;AAAA;AAAA,IACA,OAAA;AAAA,MAIA,MAAA;AAAA,MACA,UAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IACA,OAAA;AAAA,MAIA,MAAA,CAAA,QAAA,MAAA;AAAA,MACA,UAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA,IACA,YAAA;AAAA,MAKA,MAAA,CAAA,QAAA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IACA,UAAA;AAAA,MAIA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IACA,WAAA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;AAAA,IAcA;AAAA,EACA;AAEA,CAAA;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"segmented-control.js","sources":["../src/components/segmented-control/components/segmented-control-button/segmented-control-button.vue","../src/components/segmented-control/segmented-control.types.ts","../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 <checkmark-icon v-if=\"isChecked\" aria-hidden=\"true\" class=\"b-segmented-control-button__icon\" />\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 lang=\"ts\">\n import { BentoTypography } from '@/components/typography';\n import { generateUid } from '@/utils/ts/unique-id';\n import { computed, ComputedRef, defineComponent, ref } from 'vue';\n import CheckmarkIcon from '@adyen/ui-assets-icons-16/vue/checkmark';\n /**\n * Internal component to be used within the BentoSegmentedControl component only\n */\n export default defineComponent({\n name: 'bento-segmented-control-button',\n components: { BentoTypography, CheckmarkIcon },\n props: {\n /**\n * The string the button will showcase\n */\n label: {\n type: String,\n required: true,\n },\n /**\n * Indicates the value of the input that will be returned when it's selected\n */\n value: {\n type: [String, Number],\n required: true,\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: {\n type: [String, Number],\n default: null,\n },\n /**\n * Disable the radio button (optional)\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n /**\n * Renders the button with a 100% width\n */\n fullWidth: {\n type: Boolean,\n default: false,\n },\n /**\n * Renders the button with a truncated text if the space is not enough to render the whole content\n */\n truncate: {\n type: Boolean,\n default: false,\n },\n /**\n * Renders the button with centered text in case the text has to wrap multiple lines\n */\n wrap: {\n type: Boolean,\n default: false,\n },\n },\n emits: ['update:model-value'],\n setup(props, { emit }) {\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 return {\n // Values\n segmentedControlButtonLabel,\n segmentedControlButtonId,\n isChecked,\n conditionalClasses,\n // Methods\n onClick,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./segmented-control-button.scss\" />\n","export interface BentoSegmentedControlItem {\n label: string;\n value: string | number;\n disabled?: boolean;\n}\n\nexport enum BentoSegmentedControlEvent {\n UPDATE = 'update:model-value',\n}\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 ></segmented-control-button>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, onMounted, PropType, ref, toRef, toRefs } from 'vue';\n import SegmentedControlButton from './components/segmented-control-button/segmented-control-button.vue';\n import { BentoSegmentedControlEvent, BentoSegmentedControlItem } from './segmented-control.types';\n import { BentoTooltipDirective } from '@/directives';\n import { useI18n } from '@/utils/ts/i18n';\n import { useAriaLabel } from '@/utils/ts/aria-label';\n import messages from './messages.json';\n import { observeSizeOfElement } from '@/utils/ts/resize';\n\n type MessageSchema = (typeof messages)['en-US'];\n\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 defineComponent({\n name: 'bento-segmented-control',\n i18n: { messages },\n components: { SegmentedControlButton },\n directives: { BentoTooltipDirective },\n props: {\n /**\n * Items that will populate the segmented control.\n */\n items: {\n type: Array as PropType<BentoSegmentedControlItem[]>,\n required: true,\n validator: (arr: Array<BentoSegmentedControlItem[]>) => arr.length <= 5,\n },\n /**\n * Determines the selected value of the group. Corresponds to the BentoSegmentedControlItem's value.\n */\n modelValue: {\n type: [Number, String, null],\n required: true,\n },\n /**\n * @deprecated from version 2.0.0. Use the aria-label attribute instead.\n */\n /**\n * Accessible name describing the segmented control.\n */\n ariaLabel: {\n type: String,\n default: null,\n },\n /**\n * If set to true, renders the component full width.\n */\n fullWidth: {\n type: Boolean,\n default: false,\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: {\n type: Boolean,\n default: false,\n },\n },\n\n emits: [BentoSegmentedControlEvent.UPDATE],\n setup(props, { attrs, emit }) {\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const inputValue = toRef(props, 'modelValue');\n\n const ariaLabelAttribute = ref(attrs['aria-label']);\n const { ariaLabel } = toRefs(props);\n const computedAriaLabel = useAriaLabel({\n ariaLabel: ariaLabelAttribute.value as string,\n // TODO: take this line away when the aria-label props is removed\n label: ariaLabel,\n defaultFallback: t('ariaLabelFallback'),\n });\n\n const segmentedControlRef = ref();\n const segmentedControlButtonRef = ref();\n const hasEllipsis = ref();\n\n const truncate = computed(() => !props.wrap);\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(BentoSegmentedControlEvent.UPDATE, 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\n return {\n // Values\n computedAriaLabel,\n inputValue,\n segmentedControlRef,\n segmentedControlButtonRef,\n computedItems,\n truncate,\n conditionalClasses,\n\n // Methods\n onInput,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./segmented-control.scss\" />\n"],"names":["_sfc_main$1","defineComponent","BentoTypography","CheckmarkIcon","props","emit","segmentedControlButtonLabel","ref","segmentedControlButtonId","generateUid","isChecked","computed","conditionalClasses","BentoSegmentedControlEvent","BentoSegmentedControlEvent2","_sfc_main","messages","SegmentedControlButton","BentoTooltipDirective","arr","attrs","t","useI18n","inputValue","toRef","ariaLabelAttribute","ariaLabel","toRefs","computedAriaLabel","useAriaLabel","segmentedControlRef","segmentedControlButtonRef","hasEllipsis","truncate","onMounted","observeSizeOfElement","_a","el","computedItems","index","onInput","value"],"mappings":";;;;;;;;;;AAqCA,MAAAA,IAAAC,EAAA;AAAA,EAAA,MAAA;AAAA,EACA,YAAA,EAAA,iBAAAC,GAAA,eAA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AAA,CAAAP,EAAA,IAAA;AAEA,IAAA8B,EAAA,MAAA;AACA,MAAAC,EAAAL,EAAA,OAAA,MAAA;;AACA,QAAAA,EAAA,UACAE,EAAA,SAAAI,IAAAL,KAAA,gBAAAA,EAAA,UAAA,gBAAAK,EAAA;AAAA,UAAA,CAAAC,MAAAA,EAAA,MAAA,4BAAA,IAAA,cAAAA,EAAA,MAAA,4BAAA,IAAA;AAAA;AAAA,MAKA,CAAA;AAAA,IACA,CAAA;AAGA,UAAAC,IAAA3B;AAAA,MAAA,MAAAP,EAAA,MAAA,IAAA,CAAAiC,GAAAE,MAAA;;AAAA;AAAA,UACA,GAAAF;AAAA,UACA,aAAAJ,EAAA,WAAAG,IAAAJ,KAAA,gBAAAA,EAAA,UAAA,QAAAI,EAAAG,MAAAF,EAAA,QAAA;AAAA,QACA;AAAA,OAAA;AAAA,IACA,GAGAG,IAAA,CAAAC,MAAA;AACA,MAAApC,EAAAQ,EAAA,QAAA4B,CAAA;AAAA,IAAA,GAGA7B,IAAAD,EAAA,OAAA;AAAA,MAAA,4BAAA,CAAAP,EAAA;AAAA,MACA,mCAAAA,EAAA;AAAA,MACA,iCAAA6B,EAAA;AAAA,MACA,6BAAA7B,EAAA;AAAA,IACA,EAAA;AAGA,WAAA;AAAA;AAAA,MAAA,mBAAAwB;AAAA,MAEA,YAAAL;AAAA,MACA,qBAAAO;AAAA,MACA,2BAAAC;AAAA,MACA,eAAAO;AAAA,MACA,UAAAL;AAAA,MACA,oBAAArB;AAAA;AAAA,MACA,SAAA4B;AAAA,IAGA;AAAA,EACA;AAEA,CAAA;;;;;;;;;;;;;;;;;"}
|
package/dist/sidepanel.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { defineComponent as L, ref as r, inject as B, onUnmounted as V, computed as p, watch as
|
|
2
|
-
import { a as w } from "./chunks/button.
|
|
3
|
-
import { B as G } from "./chunks/index.
|
|
4
|
-
import { F as $ } from "./chunks/footer-actions.
|
|
1
|
+
import { defineComponent as L, ref as r, inject as B, onUnmounted as V, computed as p, watch as y, nextTick as N, toRefs as F, provide as O } from "vue";
|
|
2
|
+
import { a as w } from "./chunks/button.e09d5980.js";
|
|
3
|
+
import { B as G } from "./chunks/index.965ac1af.js";
|
|
4
|
+
import { F as $ } from "./chunks/footer-actions.c9b2cb74.js";
|
|
5
5
|
import { A as H } from "./chunks/arrow-left.1d5d08bd.js";
|
|
6
6
|
import { u as R } from "./chunks/i18n.155748d6.js";
|
|
7
|
-
import { n as
|
|
8
|
-
import { B as j } from "./chunks/index.
|
|
7
|
+
import { n as D } from "./chunks/_plugin-vue2_normalizer.71e2aa87.js";
|
|
8
|
+
import { B as j } from "./chunks/index.2625175a.js";
|
|
9
9
|
import { C as J } from "./chunks/cross.a2cadac5.js";
|
|
10
|
-
import "./assets/
|
|
11
|
-
var
|
|
12
|
-
const
|
|
10
|
+
import "./assets/index12.css";
|
|
11
|
+
var h = /* @__PURE__ */ ((l) => (l.UPDATE_ACTIVE_PAGE = "update:active-page", l.UPDATE_IS_OPEN = "update:is-open", l))(h || {}), T = /* @__PURE__ */ ((l) => (l.TRANSITION_LEVEL_DEEPER = "b-sidepanel-page__animation--level-deeper", l.TRANSITION_LEVEL_UPPER = "b-sidepanel-page__animation--level-upper", l))(T || {});
|
|
12
|
+
const k = Symbol("sidepanel registerPage injection key"), x = Symbol("sidepanel config data injection key"), K = {
|
|
13
13
|
"en-US": {
|
|
14
14
|
goToPreviousPage: "Go to previous page"
|
|
15
15
|
}
|
|
@@ -78,28 +78,28 @@ const D = Symbol("sidepanel registerPage injection key"), x = Symbol("sidepanel
|
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
80
|
setup(l) {
|
|
81
|
-
const a = l, { t } = R(), e = r(null),
|
|
81
|
+
const a = l, { t } = R(), e = r(null), n = r(!1), P = r(!0), i = r(!1), u = B(k), { unregisterPage: s } = u({ title: a.title, pageId: a.pageId });
|
|
82
82
|
V(() => s());
|
|
83
|
-
const { activePage:
|
|
84
|
-
"b-sidepanel-page__header--with-border":
|
|
83
|
+
const { activePage: v, animation: _, goToPreviousPage: d, hasPreviousPages: f, isOpen: E } = B(x), g = p(() => v.value ? v.value === a.pageId : !0), C = p(() => a.previousPage ? !0 : a.previousPage === null ? !1 : f.value && g.value), I = p(() => ({
|
|
84
|
+
"b-sidepanel-page__header--with-border": n.value && !P.value
|
|
85
85
|
})), A = p(() => ({
|
|
86
|
-
"b-sidepanel-page__actions--with-border":
|
|
86
|
+
"b-sidepanel-page__actions--with-border": n.value && !i.value
|
|
87
87
|
})), S = () => {
|
|
88
88
|
e.value && (P.value = e.value.scrollTop === 0, i.value = e.value.scrollHeight - e.value.clientHeight === e.value.scrollTop);
|
|
89
|
-
}, m = async (
|
|
90
|
-
|
|
89
|
+
}, m = async (o) => {
|
|
90
|
+
o && (await N(), n.value = e.value && e.value.scrollHeight > e.value.clientHeight);
|
|
91
91
|
};
|
|
92
|
-
return
|
|
93
|
-
_.value ===
|
|
92
|
+
return y(() => E.value, m, { immediate: !0 }), y(() => g.value, m, { immediate: !0 }), { __sfc: !0, props: a, t, contentElement: e, hasScroll: n, isScrollAtTop: P, isScrollAtBottom: i, registerPage: u, unregisterPage: s, activePage: v, animation: _, goToPreviousPage: d, hasPreviousPages: f, isOpen: E, showPage: g, showBackButton: C, headerConditionalClasses: I, actionsConditionalClasses: A, onScroll: S, calculateScroll: m, updateAnimation: () => {
|
|
93
|
+
_.value === T.TRANSITION_LEVEL_UPPER && (_.value = T.TRANSITION_LEVEL_DEEPER);
|
|
94
94
|
}, BentoButton: w, BentoTypography: G, FooterActions: $, ArrowLeftIcon: H };
|
|
95
95
|
}
|
|
96
96
|
});
|
|
97
97
|
var M = function() {
|
|
98
98
|
var a = this, t = a._self._c, e = a._self._setupProxy;
|
|
99
|
-
return t("Transition", { attrs: { name: e.animation, mode: "out-in" }, on: { "after-leave": e.updateAnimation } }, [t("div", { directives: [{ name: "show", rawName: "v-show", value: e.showPage, expression: "showPage" }], staticClass: "b-sidepanel-page" }, [t("div", { staticClass: "b-sidepanel-page__header", class: e.headerConditionalClasses }, [e.showBackButton ? t(e.BentoButton, { attrs: { variant: "tertiary" }, on: { click: function(
|
|
99
|
+
return t("Transition", { attrs: { name: e.animation, mode: "out-in" }, on: { "after-leave": e.updateAnimation } }, [t("div", { directives: [{ name: "show", rawName: "v-show", value: e.showPage, expression: "showPage" }], staticClass: "b-sidepanel-page" }, [t("div", { staticClass: "b-sidepanel-page__header", class: e.headerConditionalClasses }, [e.showBackButton ? t(e.BentoButton, { attrs: { variant: "tertiary" }, on: { click: function(n) {
|
|
100
100
|
return e.goToPreviousPage(a.previousPage);
|
|
101
101
|
} } }, [t(e.ArrowLeftIcon, { attrs: { "svg-title": e.t("goToPreviousPage") } })], 1) : a._e(), t(e.BentoTypography, { staticClass: "b-sidepanel-page__title", attrs: { el: "h2", variant: "title" } }, [a._v(" " + a._s(a.title) + " ")])], 1), t("div", { ref: "contentElement", staticClass: "b-sidepanel-page__content", on: { scroll: e.onScroll } }, [t(e.BentoTypography, { attrs: { el: "div", variant: "body" } }, [a._t("default")], 2)], 1), a.actions ? t("div", { staticClass: "b-sidepanel-page__actions", class: e.actionsConditionalClasses }, [t(e.FooterActions, { attrs: { actions: a.actions, "actions-label": a.actionsLabel, "destructive-actions": a.destructiveActions } })], 1) : a._e()])]);
|
|
102
|
-
}, q = [], Q = /* @__PURE__ */
|
|
102
|
+
}, q = [], Q = /* @__PURE__ */ D(
|
|
103
103
|
z,
|
|
104
104
|
M,
|
|
105
105
|
q,
|
|
@@ -144,15 +144,15 @@ const _e = Q.exports, W = {
|
|
|
144
144
|
}
|
|
145
145
|
},
|
|
146
146
|
setup(l, { emit: a }) {
|
|
147
|
-
const t = l, { activePage: e, isOpen:
|
|
148
|
-
if (
|
|
149
|
-
const c = s.value.indexOf(
|
|
150
|
-
c !== -1 ? s.value = s.value.slice(0, c + 1) : s.value = [
|
|
147
|
+
const t = l, { activePage: e, isOpen: n } = F(t), { t: P } = R(), i = r(null), u = r([]), s = r([]), v = p(() => s.value.length > 1), _ = r(T.TRANSITION_LEVEL_DEEPER), d = r(!1), f = p(() => s.value[s.value.length - 1]), E = p(() => u.value.some((o) => o.pageId === e.value)), g = (o) => {
|
|
148
|
+
if (o) {
|
|
149
|
+
const c = s.value.indexOf(o);
|
|
150
|
+
c !== -1 ? s.value = s.value.slice(0, c + 1) : s.value = [o];
|
|
151
151
|
} else
|
|
152
152
|
s.value.pop();
|
|
153
|
-
_.value =
|
|
153
|
+
_.value = T.TRANSITION_LEVEL_UPPER, a(h.UPDATE_ACTIVE_PAGE, f.value);
|
|
154
154
|
};
|
|
155
|
-
|
|
155
|
+
y(
|
|
156
156
|
() => e.value,
|
|
157
157
|
async () => {
|
|
158
158
|
if (await N(), e.value && !E.value) {
|
|
@@ -164,56 +164,58 @@ const _e = Q.exports, W = {
|
|
|
164
164
|
{ immediate: !0 }
|
|
165
165
|
);
|
|
166
166
|
const C = p(() => ({
|
|
167
|
-
"b-sidepanel--hide":
|
|
167
|
+
"b-sidepanel--hide": d.value
|
|
168
168
|
})), I = () => {
|
|
169
|
-
|
|
170
|
-
}, A = (
|
|
171
|
-
|
|
172
|
-
}, S = ({ target:
|
|
173
|
-
|
|
169
|
+
d.value && (i.value.close(), s.value[0] && a(h.UPDATE_ACTIVE_PAGE, s.value[0]), s.value = [], d.value = !1, a(h.UPDATE_IS_OPEN, !1));
|
|
170
|
+
}, A = () => {
|
|
171
|
+
i.value.open && (d.value = !0);
|
|
172
|
+
}, S = ({ target: o }) => {
|
|
173
|
+
o && o.tagName === "DIALOG" && A();
|
|
174
174
|
};
|
|
175
|
-
|
|
176
|
-
() =>
|
|
175
|
+
y(
|
|
176
|
+
() => n.value,
|
|
177
177
|
async () => {
|
|
178
|
-
await N(), i.value && (
|
|
178
|
+
await N(), i.value && (n.value ? (i.value.showModal(), s.value.length || s.value.push(e.value)) : i.value.open && A());
|
|
179
179
|
},
|
|
180
180
|
{ immediate: !0 }
|
|
181
181
|
);
|
|
182
|
-
const m = (
|
|
182
|
+
const m = (o) => () => {
|
|
183
183
|
var c;
|
|
184
|
-
u.value = (c = u.value) == null ? void 0 : c.filter(({ pageId: U }) => U !==
|
|
185
|
-
}, b = ({ title:
|
|
184
|
+
u.value = (c = u.value) == null ? void 0 : c.filter(({ pageId: U }) => U !== o);
|
|
185
|
+
}, b = ({ title: o, pageId: c }) => (u.value.push({ title: o, pageId: c }), { unregisterPage: m(c) });
|
|
186
186
|
return O(x, {
|
|
187
187
|
activePage: e,
|
|
188
188
|
animation: _,
|
|
189
189
|
goToPreviousPage: g,
|
|
190
|
-
hasPreviousPages:
|
|
191
|
-
isOpen:
|
|
192
|
-
}), O(
|
|
190
|
+
hasPreviousPages: v,
|
|
191
|
+
isOpen: n
|
|
192
|
+
}), O(k, b), { __sfc: !0, props: t, emit: a, activePage: e, isOpen: n, t: P, sidepanel: i, pages: u, previousPages: s, hasPreviousPages: v, animation: _, isClosing: d, lastPage: f, isActivePageValid: E, goToPreviousPage: g, conditionalClasses: C, closeSidepanelAfterAnimation: I, startCloseSidepanelAnimation: A, closeSidepanelOnClickOutside: S, unregisterPage: m, registerPage: b, BentoButton: w, BentoFocusTrap: j, CrossIcon: J };
|
|
193
193
|
}
|
|
194
194
|
});
|
|
195
195
|
var ee = function() {
|
|
196
196
|
var a = this, t = a._self._c, e = a._self._setupProxy;
|
|
197
|
-
return t("dialog", { ref: "sidepanel", staticClass: "b-sidepanel", class: e.conditionalClasses, on: { animationend: e.closeSidepanelAfterAnimation, click: function(
|
|
198
|
-
a.isDismissible && e.closeSidepanelOnClickOutside(
|
|
199
|
-
}, keydown: function(
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
197
|
+
return t("dialog", { ref: "sidepanel", staticClass: "b-sidepanel", class: e.conditionalClasses, on: { animationend: e.closeSidepanelAfterAnimation, click: function(n) {
|
|
198
|
+
a.isDismissible && e.closeSidepanelOnClickOutside(n);
|
|
199
|
+
}, keydown: function(n) {
|
|
200
|
+
if (!n.type.indexOf("key") && a._k(n.keyCode, "esc", 27, n.key, ["Esc", "Escape"]))
|
|
201
|
+
return null;
|
|
202
|
+
n.preventDefault(), a.isDismissible && e.startCloseSidepanelAnimation;
|
|
203
|
+
} } }, [t(e.BentoFocusTrap, [a.isDismissible ? t("div", { staticClass: "b-sidepanel__close-button" }, [t(e.BentoButton, { attrs: { variant: "tertiary" }, on: { click: e.startCloseSidepanelAnimation } }, [t(e.CrossIcon, { attrs: { "svg-title": e.t("close") } })], 1)], 1) : a._e(), a._t("default")], 2)], 1);
|
|
204
|
+
}, ae = [], te = /* @__PURE__ */ D(
|
|
203
205
|
Z,
|
|
204
206
|
ee,
|
|
205
207
|
ae,
|
|
206
208
|
!1,
|
|
207
209
|
null,
|
|
208
|
-
"
|
|
210
|
+
"cafda1bf",
|
|
209
211
|
null,
|
|
210
212
|
null
|
|
211
213
|
);
|
|
212
|
-
const
|
|
214
|
+
const de = te.exports;
|
|
213
215
|
export {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
216
|
+
de as BentoSidepanel,
|
|
217
|
+
T as BentoSidepanelAnimation,
|
|
218
|
+
h as BentoSidepanelEvent,
|
|
217
219
|
_e as BentoSidepanelPage
|
|
218
220
|
};
|
|
219
221
|
//# sourceMappingURL=sidepanel.js.map
|