@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/card.js
CHANGED
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
import { defineComponent as T, ref as h, watch as p, computed as n } from "vue";
|
|
2
|
-
import { B as H } from "./chunks/index.
|
|
2
|
+
import { B as H } from "./chunks/index.965ac1af.js";
|
|
3
3
|
import { a as I, C as D } from "./chunks/chevron-up.674ec2e5.js";
|
|
4
4
|
import { u as M } from "./chunks/use-has-slot.6052d56a.js";
|
|
5
5
|
import { g as O } from "./chunks/unique-id.a2a2b458.js";
|
|
6
6
|
import { u as U } from "./chunks/i18n.155748d6.js";
|
|
7
|
+
import { o as z } from "./chunks/resize.a041304d.js";
|
|
7
8
|
import { u as R } from "./chunks/use-expandable-content-height.62fc84e5.js";
|
|
8
|
-
import { BentoButtonActions as
|
|
9
|
-
import { n as
|
|
10
|
-
import "./assets/
|
|
11
|
-
var
|
|
12
|
-
const
|
|
9
|
+
import { BentoButtonActions as W, BentoButtonActionsLayout as y } from "./button.js";
|
|
10
|
+
import { n as F } from "./chunks/_plugin-vue2_normalizer.71e2aa87.js";
|
|
11
|
+
import "./assets/index15.css";
|
|
12
|
+
var u = /* @__PURE__ */ ((e) => (e.PRIMARY = "primary", e.SECONDARY = "secondary", e))(u || {}), i = /* @__PURE__ */ ((e) => (e.DEFAULT = "default", e.SMALL = "small", e))(i || {});
|
|
13
|
+
const N = {
|
|
13
14
|
"en-US": {
|
|
14
15
|
showCardContent: "Show card content",
|
|
15
16
|
hideCardContent: "Hide card content"
|
|
16
17
|
}
|
|
17
|
-
},
|
|
18
|
-
i18n: { messages:
|
|
18
|
+
}, j = T({
|
|
19
|
+
i18n: { messages: N },
|
|
19
20
|
name: "bento-card",
|
|
20
|
-
components: { ChevronUpIcon: I, ChevronDownIcon: D, BentoTypography: H, BentoButtonActions:
|
|
21
|
+
components: { ChevronUpIcon: I, ChevronDownIcon: D, BentoTypography: H, BentoButtonActions: W },
|
|
21
22
|
props: {
|
|
22
23
|
/**
|
|
23
24
|
* Defines the color of card background
|
|
24
25
|
*/
|
|
25
26
|
background: {
|
|
26
27
|
type: String,
|
|
27
|
-
default:
|
|
28
|
-
validator: (e) => Object.values(
|
|
28
|
+
default: u.PRIMARY,
|
|
29
|
+
validator: (e) => Object.values(u).includes(e)
|
|
29
30
|
},
|
|
30
31
|
/**
|
|
31
32
|
* Defines the title size of the card header
|
|
@@ -103,19 +104,19 @@ const F = {
|
|
|
103
104
|
},
|
|
104
105
|
emits: ["click", "expanded"],
|
|
105
106
|
setup(e, { emit: a, slots: t }) {
|
|
106
|
-
const { t:
|
|
107
|
+
const { t: d } = U(), o = M(t), c = h(null), f = O("card"), l = h(!e.closed);
|
|
107
108
|
p(
|
|
108
109
|
() => e.closed,
|
|
109
|
-
(
|
|
110
|
-
l.value = !
|
|
110
|
+
(s) => {
|
|
111
|
+
l.value = !s;
|
|
111
112
|
}
|
|
112
113
|
);
|
|
113
|
-
const
|
|
114
|
+
const r = n(() => o("default") || o("description") || o("header")), v = n(() => o("default") || o("header")), b = n(
|
|
114
115
|
() => {
|
|
115
|
-
var
|
|
116
|
-
return (o("content") || ((
|
|
116
|
+
var s;
|
|
117
|
+
return (o("content") || ((s = e.actions) == null ? void 0 : s.length)) && (!e.expandable || e.expandable && l.value);
|
|
117
118
|
}
|
|
118
|
-
),
|
|
119
|
+
), g = n(() => e.expandable && !e.disabled ? 0 : -1), x = n(() => ({
|
|
119
120
|
[`b-card--${e.background}`]: e.background,
|
|
120
121
|
"b-card--expandable": e.expandable,
|
|
121
122
|
"b-card--disabled": e.expandable && e.disabled
|
|
@@ -126,89 +127,88 @@ const F = {
|
|
|
126
127
|
"b-card__toggle--small-text": e.titleSize === i.SMALL
|
|
127
128
|
})), S = n(() => ({
|
|
128
129
|
"b-card__body--expandable": e.expandable && o("content"),
|
|
129
|
-
"b-card__body--without-header": !e.expandable && !
|
|
130
|
+
"b-card__body--without-header": !e.expandable && !r.value
|
|
130
131
|
})), k = n(() => ({
|
|
131
|
-
"b-card__content--without-header": !e.expandable && !
|
|
132
|
+
"b-card__content--without-header": !e.expandable && !r.value,
|
|
132
133
|
"b-card__content--expandable": e.expandable
|
|
133
134
|
})), A = n(() => {
|
|
134
|
-
const
|
|
135
|
+
const s = !e.expandable && e.actions && !o("content");
|
|
135
136
|
return {
|
|
136
|
-
"b-card__actions--without-content":
|
|
137
|
-
"b-card__actions--without-content-and-with-header":
|
|
137
|
+
"b-card__actions--without-content": s,
|
|
138
|
+
"b-card__actions--without-content-and-with-header": s && r.value
|
|
138
139
|
};
|
|
139
|
-
}),
|
|
140
|
+
}), E = n(() => ({
|
|
140
141
|
"b-card__title-wrapper--truncated": o("header")
|
|
141
|
-
})),
|
|
142
|
+
})), L = n(
|
|
142
143
|
() => ({
|
|
143
144
|
el: "div",
|
|
144
145
|
variant: e.titleSize === i.DEFAULT ? "title" : "body",
|
|
145
146
|
strongest: e.titleSize === i.SMALL,
|
|
146
147
|
wide: e.titleSize === i.SMALL
|
|
147
148
|
})
|
|
148
|
-
), { updateContentHeight:
|
|
149
|
+
), { updateContentHeight: _, contentHeight: C } = R(c, l), B = n(
|
|
149
150
|
() => e.expandable && C.value ? { "max-height": C.value } : {}
|
|
150
151
|
);
|
|
151
152
|
return p(
|
|
153
|
+
() => c.value,
|
|
152
154
|
() => {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
},
|
|
159
|
-
{ immediate: !0 }
|
|
155
|
+
let s = null;
|
|
156
|
+
!s && c.value && (s = z(c.value, () => {
|
|
157
|
+
c.value && _();
|
|
158
|
+
}));
|
|
159
|
+
}
|
|
160
160
|
), {
|
|
161
161
|
// Values
|
|
162
|
-
cardId:
|
|
163
|
-
cardConditionalClasses:
|
|
162
|
+
cardId: f,
|
|
163
|
+
cardConditionalClasses: x,
|
|
164
164
|
cardBodyConditionalClasses: S,
|
|
165
165
|
cardHeaderConditionalClasses: m,
|
|
166
166
|
cardContentConditionalClasses: k,
|
|
167
167
|
cardActionsConditionalClasses: A,
|
|
168
|
-
cardTitleWrapperConditionalClasses:
|
|
168
|
+
cardTitleWrapperConditionalClasses: E,
|
|
169
169
|
cardToggleConditionalClasses: w,
|
|
170
170
|
showCardBody: b,
|
|
171
171
|
showContent: l,
|
|
172
|
-
tabIndex:
|
|
173
|
-
showHeader:
|
|
174
|
-
showTitleWrapper:
|
|
175
|
-
typography:
|
|
172
|
+
tabIndex: g,
|
|
173
|
+
showHeader: r,
|
|
174
|
+
showTitleWrapper: v,
|
|
175
|
+
typography: L,
|
|
176
176
|
// Expand animation
|
|
177
|
-
contentDiv:
|
|
177
|
+
contentDiv: c,
|
|
178
178
|
contentMaxHeight: B,
|
|
179
179
|
// Methods
|
|
180
180
|
hasSlot: o,
|
|
181
181
|
onClick: () => {
|
|
182
182
|
e.disabled || a("click");
|
|
183
183
|
},
|
|
184
|
-
t:
|
|
184
|
+
t: d,
|
|
185
185
|
toggleExpansion: () => {
|
|
186
|
-
!e.disabled && e.expandable && (l.value = !l.value, a("expanded", l.value),
|
|
186
|
+
!e.disabled && e.expandable && (l.value = !l.value, a("expanded", l.value), _());
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
189
|
}
|
|
190
190
|
});
|
|
191
|
-
var
|
|
191
|
+
var P = function() {
|
|
192
192
|
var a = this, t = a._self._c;
|
|
193
|
-
return a._self._setupProxy, t("div", { staticClass: "b-card", class: a.cardConditionalClasses, attrs: { "data-testid": "card" }, on: { click: a.onClick } }, [a.hasSlot("image") ? t("div", { staticClass: "b-card__image" }, [a._t("image")], 2) : a._e(), a.showHeader ? t("div", { staticClass: "b-card__header", class: a.cardHeaderConditionalClasses, attrs: { tabindex: a.tabIndex, "aria-controls": a.expandable ? a.cardId : null, "aria-expanded": a.expandable ? `${a.showContent}` : null, role: a.expandable ? "button" : null }, on: { click: a.toggleExpansion, keypress: [function(
|
|
194
|
-
return !
|
|
195
|
-
}, function(
|
|
196
|
-
return !
|
|
193
|
+
return a._self._setupProxy, t("div", { staticClass: "b-card", class: a.cardConditionalClasses, attrs: { "data-testid": "card" }, on: { click: a.onClick } }, [a.hasSlot("image") ? t("div", { staticClass: "b-card__image" }, [a._t("image")], 2) : a._e(), a.showHeader ? t("div", { staticClass: "b-card__header", class: a.cardHeaderConditionalClasses, attrs: { tabindex: a.tabIndex, "aria-controls": a.expandable ? a.cardId : null, "aria-expanded": a.expandable ? `${a.showContent}` : null, role: a.expandable ? "button" : null }, on: { click: a.toggleExpansion, keypress: [function(d) {
|
|
194
|
+
return !d.type.indexOf("key") && a._k(d.keyCode, "enter", 13, d.key, "Enter") ? null : a.toggleExpansion.apply(null, arguments);
|
|
195
|
+
}, function(d) {
|
|
196
|
+
return !d.type.indexOf("key") && a._k(d.keyCode, "space", 32, d.key, [" ", "Spacebar"]) ? null : a.toggleExpansion.apply(null, arguments);
|
|
197
197
|
}] } }, [t("div", { staticClass: "b-card__header-wrapper" }, [a.showTitleWrapper ? t("div", { staticClass: "b-card__header-slot-wrapper" }, [t("div", { staticClass: "b-card__title-wrapper", class: a.cardTitleWrapperConditionalClasses }, [a.expandable ? t("div", { staticClass: "b-card__toggle", class: a.cardToggleConditionalClasses }, [a.showContent ? t("chevron-up-icon", { attrs: { "svg-title": a.t("hideCardContent"), "aria-hidden": "true" } }) : t("chevron-down-icon", { attrs: { "svg-title": a.t("showCardContent"), "aria-hidden": "true" } })], 1) : a._e(), a.hasSlot("default") ? t("bento-typography", a._b({ staticClass: "b-card__title" }, "bento-typography", a.typography, !1), [a._t("default")], 2) : a._e()], 1), a.hasSlot("header") ? [a._t("header")] : a._e()], 2) : a._e(), a.hasSlot("description") ? t("bento-typography", { staticClass: "b-card__description", attrs: { el: "div", variant: "body" } }, [a._t("description")], 2) : a._e()], 1)]) : a._e(), t("Transition", { attrs: { name: "b-card__animation" } }, [a.showCardBody ? t("div", { style: a.contentMaxHeight }, [t("div", { ref: "contentDiv", staticClass: "b-card__body", class: a.cardBodyConditionalClasses, attrs: { id: a.expandable ? a.cardId : null } }, [a.hasSlot("content") ? t("div", { staticClass: "b-card__content", class: a.cardContentConditionalClasses }, [a._t("content")], 2) : a._e(), a.actions ? t("div", { staticClass: "b-card__actions", class: a.cardActionsConditionalClasses }, [t("bento-button-actions", { attrs: { actions: a.actions, layout: a.actionsLayout } })], 1) : a._e()])]) : a._e()])], 1);
|
|
198
|
-
},
|
|
199
|
-
N,
|
|
198
|
+
}, Y = [], q = /* @__PURE__ */ F(
|
|
200
199
|
j,
|
|
201
200
|
P,
|
|
201
|
+
Y,
|
|
202
202
|
!1,
|
|
203
203
|
null,
|
|
204
|
-
"
|
|
204
|
+
"f25b077b",
|
|
205
205
|
null,
|
|
206
206
|
null
|
|
207
207
|
);
|
|
208
|
-
const
|
|
208
|
+
const oa = q.exports;
|
|
209
209
|
export {
|
|
210
|
-
|
|
211
|
-
|
|
210
|
+
oa as BentoCard,
|
|
211
|
+
u as BentoCardBackground,
|
|
212
212
|
i as BentoCardTitleSize
|
|
213
213
|
};
|
|
214
214
|
//# sourceMappingURL=card.js.map
|
package/dist/card.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.js","sources":["../src/components/card/card.types.ts","../src/components/card/card.vue"],"sourcesContent":["/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoCardBackground {\n PRIMARY = 'primary',\n SECONDARY = 'secondary',\n}\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoCardTitleSize {\n DEFAULT = 'default',\n SMALL = 'small',\n}\n","<template>\n <div class=\"b-card\" :class=\"cardConditionalClasses\" data-testid=\"card\" @click=\"onClick\">\n <div v-if=\"hasSlot('image')\" class=\"b-card__image\">\n <slot name=\"image\"></slot>\n </div>\n <div\n v-if=\"showHeader\"\n class=\"b-card__header\"\n :class=\"cardHeaderConditionalClasses\"\n :tabindex=\"tabIndex\"\n :aria-controls=\"expandable ? cardId : null\"\n :aria-expanded=\"expandable ? `${showContent}` : null\"\n :role=\"expandable ? 'button' : null\"\n @click=\"toggleExpansion\"\n @keypress.enter=\"toggleExpansion\"\n @keypress.space=\"toggleExpansion\"\n >\n <div class=\"b-card__header-wrapper\">\n <div v-if=\"showTitleWrapper\" class=\"b-card__header-slot-wrapper\">\n <div class=\"b-card__title-wrapper\" :class=\"cardTitleWrapperConditionalClasses\">\n <div v-if=\"expandable\" class=\"b-card__toggle\" :class=\"cardToggleConditionalClasses\">\n <chevron-up-icon v-if=\"showContent\" :svg-title=\"t('hideCardContent')\" aria-hidden=\"true\" />\n <chevron-down-icon v-else :svg-title=\"t('showCardContent')\" aria-hidden=\"true\" />\n </div>\n <bento-typography v-if=\"hasSlot('default')\" class=\"b-card__title\" v-bind=\"typography\">\n <slot />\n </bento-typography>\n </div>\n\n <template v-if=\"hasSlot('header')\">\n <slot name=\"header\"></slot>\n </template>\n </div>\n\n <bento-typography v-if=\"hasSlot('description')\" class=\"b-card__description\" el=\"div\" variant=\"body\">\n <slot name=\"description\" />\n </bento-typography>\n </div>\n </div>\n\n <Transition name=\"b-card__animation\">\n <div v-if=\"showCardBody\" :style=\"contentMaxHeight\">\n <div\n :id=\"expandable ? cardId : null\"\n ref=\"contentDiv\"\n class=\"b-card__body\"\n :class=\"cardBodyConditionalClasses\"\n >\n <div v-if=\"hasSlot('content')\" class=\"b-card__content\" :class=\"cardContentConditionalClasses\">\n <slot name=\"content\" />\n </div>\n\n <div v-if=\"actions\" class=\"b-card__actions\" :class=\"cardActionsConditionalClasses\">\n <bento-button-actions :actions=\"actions\" :layout=\"actionsLayout\"></bento-button-actions>\n </div>\n </div>\n </div>\n </Transition>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, PropType, ref, watch } from 'vue';\n\n // Components\n import { BentoTypography } from '@/components/typography';\n import { BentoButtonActions, BentoButtonActionsLayout, BentoButtonActionsList } from '@/components/button';\n import { BentoCardBackground, BentoCardTitleSize } from '@/components/card/card.types';\n import ChevronDownIcon from '@adyen/ui-assets-icons-16/vue/chevron-down';\n import ChevronUpIcon from '@adyen/ui-assets-icons-16/vue/chevron-up';\n\n // Utils\n import { useHasSlot } from '@/composables';\n import { generateUid } from '@/utils/ts/unique-id';\n import { useI18n } from '@/utils/ts/i18n';\n\n import messages from './messages.json';\n import { useExpandableContentHeight } from '@/composables/use-expandable-content-height/use-expandable-content-height';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n /**\n * A card is a flexible and composable container.\n * Use cards to represent a single object or to visually group certain content, like legal information within company settings.\n *\n * @example\n * import { BentoCard } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoCard },\n * template: `\n * <bento-card>\n * Title of the Card\n * </bento-card>\n * `\n * };\n */\n export default defineComponent({\n i18n: { messages },\n name: 'bento-card',\n components: { ChevronUpIcon, ChevronDownIcon, BentoTypography, BentoButtonActions },\n props: {\n /**\n * Defines the color of card background\n */\n background: {\n type: String as PropType<BentoCardBackground | `${BentoCardBackground}`>,\n default: BentoCardBackground.PRIMARY,\n validator: (value: BentoCardBackground) => Object.values(BentoCardBackground).includes(value),\n },\n /**\n * Defines the title size of the card header\n */\n titleSize: {\n type: String as PropType<BentoCardTitleSize | `${BentoCardTitleSize}`>,\n default: BentoCardTitleSize.DEFAULT,\n validator: (value: BentoCardTitleSize) => Object.values(BentoCardTitleSize).includes(value),\n },\n /**\n * The whole content of the card will be expandable in accordion manner\n */\n expandable: {\n type: Boolean,\n default: false,\n },\n /**\n * Sets the expandable card in a closed state\n */\n closed: {\n type: Boolean,\n default: false,\n },\n /**\n * Disables the expandable card\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n /**\n * List of actions that will be used to render the buttons.\n * First element in the list will be rendered as \"primary\".\n * All elements after the first will be rendered as \"secondary\".\n *\n * Each object in the list should have a `title`, an `event` and\n * (optional) a Vue `icon` from the library `@adyen/ui-assets-icons-16`.\n *\n * `title`: Button's text.\n *\n * `event`: Event triggered when clicking the Button.\n *\n * `icon`: Vue Icon from the library `@adyen/ui-assets-icons-16`.\n *\n * ```\n * [{\n * title: 'Primary',\n * event: () => { ... },\n * icon: FourPeopleIcon\n * }, {\n * title: 'Secondary',\n * event: () => { ... }\n * }]\n * ```\n */\n actions: {\n type: Array as PropType<BentoButtonActionsList>,\n default: null,\n },\n /**\n * Defines the layout in which the button actions is presented.\n * It can be one of:\n *\n * @values BUTTONS_START\n * @values BUTTONS_END\n * @values FILL_CONTAINER\n * @values SPACE_BETWEEN\n * @values VERTICAL_STACK\n */\n actionsLayout: {\n type: String as PropType<BentoButtonActionsLayout | `${BentoButtonActionsLayout}`>,\n default: BentoButtonActionsLayout.BUTTONS_END,\n validator: (value: BentoButtonActionsLayout) => Object.values(BentoButtonActionsLayout).includes(value),\n },\n },\n emits: ['click', 'expanded'],\n setup(props, { emit, slots }) {\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const hasSlot = useHasSlot(slots);\n const contentDiv = ref<HTMLDivElement>(null);\n\n const cardId = generateUid('card');\n const showContent = ref(!props.closed);\n watch(\n () => props.closed,\n value => {\n showContent.value = !value;\n }\n );\n const showHeader = computed(() => hasSlot('default') || hasSlot('description') || hasSlot('header'));\n const showTitleWrapper = computed(() => hasSlot('default') || hasSlot('header'));\n const showCardBody = computed(\n () =>\n (hasSlot('content') || props.actions?.length) &&\n (!props.expandable || (props.expandable && showContent.value))\n );\n const tabIndex = computed(() => (props.expandable && !props.disabled ? 0 : -1));\n\n const cardConditionalClasses = computed(() => ({\n [`b-card--${props.background}`]: props.background,\n 'b-card--expandable': props.expandable,\n 'b-card--disabled': props.expandable && props.disabled,\n }));\n\n const cardHeaderConditionalClasses = computed(() => ({\n 'b-card__header--expandable': props.expandable,\n 'b-card__header--without-body': !props.expandable && !showCardBody.value,\n }));\n\n const cardToggleConditionalClasses = computed(() => ({\n 'b-card__toggle--small-text': props.titleSize === BentoCardTitleSize.SMALL,\n }));\n\n const cardBodyConditionalClasses = computed(() => ({\n 'b-card__body--expandable': props.expandable && hasSlot('content'),\n 'b-card__body--without-header': !props.expandable && !showHeader.value,\n }));\n\n const cardContentConditionalClasses = computed(() => ({\n 'b-card__content--without-header': !props.expandable && !showHeader.value,\n 'b-card__content--expandable': props.expandable,\n }));\n\n const cardActionsConditionalClasses = computed(() => {\n const isNotExpandableWithoutContent = !props.expandable && props.actions && !hasSlot('content');\n\n return {\n 'b-card__actions--without-content': isNotExpandableWithoutContent,\n 'b-card__actions--without-content-and-with-header':\n isNotExpandableWithoutContent && showHeader.value,\n };\n });\n\n const cardTitleWrapperConditionalClasses = computed(() => ({\n 'b-card__title-wrapper--truncated': hasSlot('header'),\n }));\n\n const typography = computed(\n () =>\n ({\n el: 'div',\n variant: props.titleSize === BentoCardTitleSize.DEFAULT ? 'title' : 'body',\n strongest: props.titleSize === BentoCardTitleSize.SMALL,\n wide: props.titleSize === BentoCardTitleSize.SMALL,\n } as InstanceType<typeof BentoTypography>['$props'])\n );\n\n // Toggle open and close logic and animation\n const { updateContentHeight, contentHeight } = useExpandableContentHeight(contentDiv, showContent);\n\n const contentMaxHeight = computed(() =>\n props.expandable && contentHeight.value ? { 'max-height': contentHeight.value } : {}\n );\n\n watch(\n () => slots.content?.(),\n () => {\n if (props.expandable) {\n updateContentHeight();\n }\n },\n { immediate: true }\n );\n\n const toggleExpansion = () => {\n if (!props.disabled && props.expandable) {\n showContent.value = !showContent.value;\n emit('expanded', showContent.value);\n updateContentHeight();\n }\n };\n\n const onClick = () => {\n if (!props.disabled) {\n emit('click');\n }\n };\n\n return {\n // Values\n cardId,\n cardConditionalClasses,\n cardBodyConditionalClasses,\n cardHeaderConditionalClasses,\n cardContentConditionalClasses,\n cardActionsConditionalClasses,\n cardTitleWrapperConditionalClasses,\n cardToggleConditionalClasses,\n showCardBody,\n showContent,\n tabIndex,\n showHeader,\n showTitleWrapper,\n typography,\n\n // Expand animation\n contentDiv,\n contentMaxHeight,\n\n // Methods\n hasSlot,\n onClick,\n t,\n toggleExpansion,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./card.scss\" />\n"],"names":["BentoCardBackground","BentoCardBackground2","BentoCardTitleSize","BentoCardTitleSize2","_sfc_main","defineComponent","messages","ChevronUpIcon","ChevronDownIcon","BentoTypography","BentoButtonActions","value","BentoButtonActionsLayout","props","emit","slots","t","useI18n","hasSlot","useHasSlot","contentDiv","ref","cardId","generateUid","showContent","watch","showHeader","computed","showTitleWrapper","showCardBody","_a","tabIndex","cardConditionalClasses","cardHeaderConditionalClasses","cardToggleConditionalClasses","cardBodyConditionalClasses","cardContentConditionalClasses","cardActionsConditionalClasses","isNotExpandableWithoutContent","cardTitleWrapperConditionalClasses","typography","updateContentHeight","contentHeight","useExpandableContentHeight","contentMaxHeight"],"mappings":";;;;;;;;;;AAGY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,UAAA,WACAA,EAAA,YAAA,aAFQA,IAAAD,KAAA,CAAA,CAAA,GAQAE,IAAA,kBAAAC,OACRA,EAAA,UAAA,WACAA,EAAA,QAAA,SAFQA,IAAAD,KAAA,CAAA,CAAA;;;;;;GCsFZE,IAAAC,EAAA;AAAA,EAAA,MAAA,EAAA,UAAAC,EAAA;AAAA,EACA,MAAA;AAAA,EACA,YAAA,EAAA,eAAAC,GAAA,iBAAAC,GAAA,iBAAAC,GAAA,oBAAAC,EAAA;AAAA,EACA,OAAA;AAAA;AAAA;AAAA;AAAA,IACA,YAAA;AAAA,MAIA,MAAA;AAAA,MACA,SAAAV,EAAA;AAAA,MACA,WAAA,CAAAW,MAAA,OAAA,OAAAX,CAAA,EAAA,SAAAW,CAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IACA,WAAA;AAAA,MAIA,MAAA;AAAA,MACA,SAAAT,EAAA;AAAA,MACA,WAAA,CAAAS,MAAA,OAAA,OAAAT,CAAA,EAAA,SAAAS,CAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IACA,YAAA;AA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X,EAAA;AAAA,MACA;AAAA,IACA,GAIA,EAAA,qBAAAuC,GAAA,eAAAC,EAAA,IAAAC,EAAAvB,GAAAI,CAAA,GAEAoB,IAAAjB;AAAA,MAAA,MAAAd,EAAA,cAAA6B,EAAA,QAAA,EAAA,cAAAA,EAAA,MAAA,IAAA,CAAA;AAAA,IACA;AAGA,WAAAjB;AAAA,MAAA,MAAA;;AAAA,gBAAAK,IAAAf,EAAA,YAAA,gBAAAe,EAAA,KAAAf;AAAA;AAAA,MACA,MAAA;AAEA,QAAAF,EAAA,cACA4B,EAAA;AAAA,MACA;AAAA,MACA,EAAA,WAAA,GAAA;AAAA,IACA,GAiBA;AAAA;AAAA,MAAA,QAAAnB;AAAA,MAEA,wBAAAU;AAAA,MACA,4BAAAG;AAAA,MACA,8BAAAF;AAAA,MACA,+BAAAG;AAAA,MACA,+BAAAC;AAAA,MACA,oCAAAE;AAAA,MACA,8BAAAL;AAAA,MACA,cAAAL;AAAA,MACA,aAAAL;AAAA,MACA,UAAAO;AAAA,MACA,YAAAL;AAAA,MACA,kBAAAE;AAAA,MACA,YAAAY;AAAA;AAAA,MACA,YAAApB;AAAA,MAGA,kBAAAwB;AAAA;AAAA,MACA,SAAA1B;AAAA,MAGA,SA5BA,MAAA;AACA,QAAAL,EAAA,YACAC,EAAA,OAAA;AAAA,MACA;AAAA,MA0BA,GAAAE;AAAA,MACA,iBAtCA,MAAA;AACA,QAAA,CAAAH,EAAA,YAAAA,EAAA,eACAW,EAAA,QAAA,CAAAA,EAAA,OACAV,EAAA,YAAAU,EAAA,KAAA,GACAiB,EAAA;AAAA,MACA;AAAA,IAkCA;AAAA,EACA;AAEA,CAAA;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"card.js","sources":["../src/components/card/card.types.ts","../src/components/card/card.vue"],"sourcesContent":["/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoCardBackground {\n PRIMARY = 'primary',\n SECONDARY = 'secondary',\n}\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoCardTitleSize {\n DEFAULT = 'default',\n SMALL = 'small',\n}\n","<template>\n <div class=\"b-card\" :class=\"cardConditionalClasses\" data-testid=\"card\" @click=\"onClick\">\n <div v-if=\"hasSlot('image')\" class=\"b-card__image\">\n <slot name=\"image\"></slot>\n </div>\n <div\n v-if=\"showHeader\"\n class=\"b-card__header\"\n :class=\"cardHeaderConditionalClasses\"\n :tabindex=\"tabIndex\"\n :aria-controls=\"expandable ? cardId : null\"\n :aria-expanded=\"expandable ? `${showContent}` : null\"\n :role=\"expandable ? 'button' : null\"\n @click=\"toggleExpansion\"\n @keypress.enter=\"toggleExpansion\"\n @keypress.space=\"toggleExpansion\"\n >\n <div class=\"b-card__header-wrapper\">\n <div v-if=\"showTitleWrapper\" class=\"b-card__header-slot-wrapper\">\n <div class=\"b-card__title-wrapper\" :class=\"cardTitleWrapperConditionalClasses\">\n <div v-if=\"expandable\" class=\"b-card__toggle\" :class=\"cardToggleConditionalClasses\">\n <chevron-up-icon v-if=\"showContent\" :svg-title=\"t('hideCardContent')\" aria-hidden=\"true\" />\n <chevron-down-icon v-else :svg-title=\"t('showCardContent')\" aria-hidden=\"true\" />\n </div>\n <bento-typography v-if=\"hasSlot('default')\" class=\"b-card__title\" v-bind=\"typography\">\n <slot />\n </bento-typography>\n </div>\n\n <template v-if=\"hasSlot('header')\">\n <slot name=\"header\"></slot>\n </template>\n </div>\n\n <bento-typography v-if=\"hasSlot('description')\" class=\"b-card__description\" el=\"div\" variant=\"body\">\n <slot name=\"description\" />\n </bento-typography>\n </div>\n </div>\n\n <Transition name=\"b-card__animation\">\n <div v-if=\"showCardBody\" :style=\"contentMaxHeight\">\n <div\n :id=\"expandable ? cardId : null\"\n ref=\"contentDiv\"\n class=\"b-card__body\"\n :class=\"cardBodyConditionalClasses\"\n >\n <div v-if=\"hasSlot('content')\" class=\"b-card__content\" :class=\"cardContentConditionalClasses\">\n <slot name=\"content\" />\n </div>\n\n <div v-if=\"actions\" class=\"b-card__actions\" :class=\"cardActionsConditionalClasses\">\n <bento-button-actions :actions=\"actions\" :layout=\"actionsLayout\"></bento-button-actions>\n </div>\n </div>\n </div>\n </Transition>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, PropType, ref, watch } from 'vue';\n\n // Components\n import { BentoTypography } from '@/components/typography';\n import { BentoButtonActions, BentoButtonActionsLayout, BentoButtonActionsList } from '@/components/button';\n import { BentoCardBackground, BentoCardTitleSize } from '@/components/card/card.types';\n import ChevronDownIcon from '@adyen/ui-assets-icons-16/vue/chevron-down';\n import ChevronUpIcon from '@adyen/ui-assets-icons-16/vue/chevron-up';\n\n // Utils\n import { useHasSlot } from '@/composables';\n import { generateUid } from '@/utils/ts/unique-id';\n import { useI18n } from '@/utils/ts/i18n';\n import { observeSizeOfElement } from '@/utils/ts/resize';\n\n import messages from './messages.json';\n import { useExpandableContentHeight } from '@/composables/use-expandable-content-height/use-expandable-content-height';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n /**\n * A card is a flexible and composable container.\n * Use cards to represent a single object or to visually group certain content, like legal information within company settings.\n *\n * @example\n * import { BentoCard } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoCard },\n * template: `\n * <bento-card>\n * Title of the Card\n * </bento-card>\n * `\n * };\n */\n export default defineComponent({\n i18n: { messages },\n name: 'bento-card',\n components: { ChevronUpIcon, ChevronDownIcon, BentoTypography, BentoButtonActions },\n props: {\n /**\n * Defines the color of card background\n */\n background: {\n type: String as PropType<BentoCardBackground | `${BentoCardBackground}`>,\n default: BentoCardBackground.PRIMARY,\n validator: (value: BentoCardBackground) => Object.values(BentoCardBackground).includes(value),\n },\n /**\n * Defines the title size of the card header\n */\n titleSize: {\n type: String as PropType<BentoCardTitleSize | `${BentoCardTitleSize}`>,\n default: BentoCardTitleSize.DEFAULT,\n validator: (value: BentoCardTitleSize) => Object.values(BentoCardTitleSize).includes(value),\n },\n /**\n * The whole content of the card will be expandable in accordion manner\n */\n expandable: {\n type: Boolean,\n default: false,\n },\n /**\n * Sets the expandable card in a closed state\n */\n closed: {\n type: Boolean,\n default: false,\n },\n /**\n * Disables the expandable card\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n /**\n * List of actions that will be used to render the buttons.\n * First element in the list will be rendered as \"primary\".\n * All elements after the first will be rendered as \"secondary\".\n *\n * Each object in the list should have a `title`, an `event` and\n * (optional) a Vue `icon` from the library `@adyen/ui-assets-icons-16`.\n *\n * `title`: Button's text.\n *\n * `event`: Event triggered when clicking the Button.\n *\n * `icon`: Vue Icon from the library `@adyen/ui-assets-icons-16`.\n *\n * ```\n * [{\n * title: 'Primary',\n * event: () => { ... },\n * icon: FourPeopleIcon\n * }, {\n * title: 'Secondary',\n * event: () => { ... }\n * }]\n * ```\n */\n actions: {\n type: Array as PropType<BentoButtonActionsList>,\n default: null,\n },\n /**\n * Defines the layout in which the button actions is presented.\n * It can be one of:\n *\n * @values BUTTONS_START\n * @values BUTTONS_END\n * @values FILL_CONTAINER\n * @values SPACE_BETWEEN\n * @values VERTICAL_STACK\n */\n actionsLayout: {\n type: String as PropType<BentoButtonActionsLayout | `${BentoButtonActionsLayout}`>,\n default: BentoButtonActionsLayout.BUTTONS_END,\n validator: (value: BentoButtonActionsLayout) => Object.values(BentoButtonActionsLayout).includes(value),\n },\n },\n emits: ['click', 'expanded'],\n setup(props, { emit, slots }) {\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const hasSlot = useHasSlot(slots);\n const contentDiv = ref<HTMLDivElement>(null);\n\n const cardId = generateUid('card');\n const showContent = ref(!props.closed);\n watch(\n () => props.closed,\n value => {\n showContent.value = !value;\n }\n );\n const showHeader = computed(() => hasSlot('default') || hasSlot('description') || hasSlot('header'));\n const showTitleWrapper = computed(() => hasSlot('default') || hasSlot('header'));\n const showCardBody = computed(\n () =>\n (hasSlot('content') || props.actions?.length) &&\n (!props.expandable || (props.expandable && showContent.value))\n );\n const tabIndex = computed(() => (props.expandable && !props.disabled ? 0 : -1));\n\n const cardConditionalClasses = computed(() => ({\n [`b-card--${props.background}`]: props.background,\n 'b-card--expandable': props.expandable,\n 'b-card--disabled': props.expandable && props.disabled,\n }));\n\n const cardHeaderConditionalClasses = computed(() => ({\n 'b-card__header--expandable': props.expandable,\n 'b-card__header--without-body': !props.expandable && !showCardBody.value,\n }));\n\n const cardToggleConditionalClasses = computed(() => ({\n 'b-card__toggle--small-text': props.titleSize === BentoCardTitleSize.SMALL,\n }));\n\n const cardBodyConditionalClasses = computed(() => ({\n 'b-card__body--expandable': props.expandable && hasSlot('content'),\n 'b-card__body--without-header': !props.expandable && !showHeader.value,\n }));\n\n const cardContentConditionalClasses = computed(() => ({\n 'b-card__content--without-header': !props.expandable && !showHeader.value,\n 'b-card__content--expandable': props.expandable,\n }));\n\n const cardActionsConditionalClasses = computed(() => {\n const isNotExpandableWithoutContent = !props.expandable && props.actions && !hasSlot('content');\n\n return {\n 'b-card__actions--without-content': isNotExpandableWithoutContent,\n 'b-card__actions--without-content-and-with-header':\n isNotExpandableWithoutContent && showHeader.value,\n };\n });\n\n const cardTitleWrapperConditionalClasses = computed(() => ({\n 'b-card__title-wrapper--truncated': hasSlot('header'),\n }));\n\n const typography = computed(\n () =>\n ({\n el: 'div',\n variant: props.titleSize === BentoCardTitleSize.DEFAULT ? 'title' : 'body',\n strongest: props.titleSize === BentoCardTitleSize.SMALL,\n wide: props.titleSize === BentoCardTitleSize.SMALL,\n } as InstanceType<typeof BentoTypography>['$props'])\n );\n\n // Toggle open and close logic and animation\n const { updateContentHeight, contentHeight } = useExpandableContentHeight(contentDiv, showContent);\n\n const contentMaxHeight = computed(() =>\n props.expandable && contentHeight.value ? { 'max-height': contentHeight.value } : {}\n );\n\n watch(\n () => contentDiv.value,\n () => {\n let observer: ResizeObserver | null = null;\n if (!observer && contentDiv.value) {\n observer = observeSizeOfElement(contentDiv.value, () => {\n if (contentDiv.value) {\n updateContentHeight();\n }\n });\n }\n }\n );\n\n const toggleExpansion = () => {\n if (!props.disabled && props.expandable) {\n showContent.value = !showContent.value;\n emit('expanded', showContent.value);\n updateContentHeight();\n }\n };\n\n const onClick = () => {\n if (!props.disabled) {\n emit('click');\n }\n };\n\n return {\n // Values\n cardId,\n cardConditionalClasses,\n cardBodyConditionalClasses,\n cardHeaderConditionalClasses,\n cardContentConditionalClasses,\n cardActionsConditionalClasses,\n cardTitleWrapperConditionalClasses,\n cardToggleConditionalClasses,\n showCardBody,\n showContent,\n tabIndex,\n showHeader,\n showTitleWrapper,\n typography,\n\n // Expand animation\n contentDiv,\n contentMaxHeight,\n\n // Methods\n hasSlot,\n onClick,\n t,\n toggleExpansion,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./card.scss\" />\n"],"names":["BentoCardBackground","BentoCardBackground2","BentoCardTitleSize","BentoCardTitleSize2","_sfc_main","defineComponent","messages","ChevronUpIcon","ChevronDownIcon","BentoTypography","BentoButtonActions","value","BentoButtonActionsLayout","props","emit","slots","t","useI18n","hasSlot","useHasSlot","contentDiv","ref","cardId","generateUid","showContent","watch","showHeader","computed","showTitleWrapper","showCardBody","_a","tabIndex","cardConditionalClasses","cardHeaderConditionalClasses","cardToggleConditionalClasses","cardBodyConditionalClasses","cardContentConditionalClasses","cardActionsConditionalClasses","isNotExpandableWithoutContent","cardTitleWrapperConditionalClasses","typography","updateContentHeight","contentHeight","useExpandableContentHeight","contentMaxHeight","observer","observeSizeOfElement"],"mappings":";;;;;;;;;;;AAGY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,UAAA,WACAA,EAAA,YAAA,aAFQA,IAAAD,KAAA,CAAA,CAAA,GAQAE,IAAA,kBAAAC,OACRA,EAAA,UAAA,WACAA,EAAA,QAAA,SAFQA,IAAAD,KAAA,CAAA,CAAA;;;;;;GCuFZE,IAAAC,EAAA;AAAA,EAAA,MAAA,EAAA,UAAAC,EAAA;AAAA,EACA,MAAA;AAAA,EACA,YAAA,EAAA,eAAAC,G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L,EAAA,YACAC,EAAA,OAAA;AAAA,MACA;AAAA,MA0BA,GAAAE;AAAA,MACA,iBAtCA,MAAA;AACA,QAAA,CAAAH,EAAA,YAAAA,EAAA,eACAW,EAAA,QAAA,CAAAA,EAAA,OACAV,EAAA,YAAAU,EAAA,KAAA,GACAiB,EAAA;AAAA,MACA;AAAA,IAkCA;AAAA,EACA;AAEA,CAAA;;;;;;;;;;;;;;;;;;;"}
|
package/dist/checkbox.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { B as h, b as a } from "./chunks/checkbox.
|
|
2
|
-
import { a as N } from "./chunks/checkbox.
|
|
1
|
+
import { B as h, b as a } from "./chunks/checkbox.5343e28e.js";
|
|
2
|
+
import { a as N } from "./chunks/checkbox.5343e28e.js";
|
|
3
3
|
import { defineComponent as f, toRef as b, computed as d, ref as m, watch as _ } from "vue";
|
|
4
4
|
import { g } from "./chunks/unique-id.a2a2b458.js";
|
|
5
|
-
import { d as y } from "./chunks/index.
|
|
5
|
+
import { d as y } from "./chunks/index.965ac1af.js";
|
|
6
6
|
import { u as x } from "./chunks/use-form-layout-loading.d03e5d48.js";
|
|
7
|
-
import { C as v } from "./chunks/controls-group.
|
|
8
|
-
import { E } from "./chunks/error-message.
|
|
7
|
+
import { C as v } from "./chunks/controls-group.2a21bd83.js";
|
|
8
|
+
import { E } from "./chunks/error-message.8302a46c.js";
|
|
9
9
|
import { n as k } from "./chunks/_plugin-vue2_normalizer.71e2aa87.js";
|
|
10
|
-
import "./assets/
|
|
10
|
+
import "./assets/index16.css";
|
|
11
11
|
var s = /* @__PURE__ */ ((r) => (r.HORIZONTAL = "horizontal", r.VERTICAL = "vertical", r))(s || {});
|
|
12
12
|
const C = f({
|
|
13
13
|
name: "bento-checkbox-group",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as b, computed as r, ref as _ } from "vue";
|
|
2
|
-
import { B as d } from "./index.
|
|
2
|
+
import { B as d } from "./index.965ac1af.js";
|
|
3
3
|
import { u as f } from "./use-has-slot.6052d56a.js";
|
|
4
4
|
import { n as p } from "./_plugin-vue2_normalizer.71e2aa87.js";
|
|
5
5
|
import "../assets/base-button.css";
|
|
@@ -85,4 +85,4 @@ export {
|
|
|
85
85
|
U as B,
|
|
86
86
|
s as a
|
|
87
87
|
};
|
|
88
|
-
//# sourceMappingURL=base-button.
|
|
88
|
+
//# sourceMappingURL=base-button.7886a7e6.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-button.
|
|
1
|
+
{"version":3,"file":"base-button.7886a7e6.js","sources":["../../src/components/internal/base-button/base-button.types.ts","../../src/components/internal/base-button/base-button.vue"],"sourcesContent":["export enum BentoBaseButtonPropClass {\n DESTRUCTIVE = 'critical',\n ICON_ONLY = 'icon-only',\n}\n\nexport enum BentoBaseButtonEvent {\n BLUR = 'blur',\n CLICK = 'click',\n FOCUS = 'focus',\n KEYDOWN_ESC = 'keydown.esc',\n}\n\nexport enum BaseButtonType {\n BUTTON = 'button',\n RESET = 'reset',\n SUBMIT = 'submit',\n}\n","<template>\n <button\n ref=\"bentoBaseButtonRef\"\n class=\"b-base-button\"\n :class=\"conditionalClasses\"\n :disabled=\"disabled\"\n :type=\"type\"\n :aria-expanded=\"ariaAttributes['aria-expanded']\"\n @click=\"onClickButton\"\n @focus=\"onFocusButton\"\n @blur=\"onBlurButton\"\n >\n <span v-if=\"hasSlot('iconLeft')\" class=\"b-base-button__icon-left\" data-testid=\"icon-button-left\">\n <slot name=\"iconLeft\" />\n </span>\n <bento-typography v-if=\"hasSlot('default')\" el=\"span\" variant=\"body\" stronger class=\"b-base-button__label\">\n <slot />\n </bento-typography>\n <span v-if=\"hasSlot('iconRight')\" class=\"b-base-button__icon-right\" data-testid=\"icon-button-right\">\n <slot name=\"iconRight\" />\n </span>\n </button>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, PropType, ref } from 'vue';\n import { BentoBaseButtonEvent, BentoBaseButtonPropClass } from './base-button.types';\n import type { ButtonHTMLAttributes } from 'vue/types/jsx';\n import { BentoTypography } from '@/components/typography';\n import { useHasSlot } from '@/composables';\n import { Booleanish } from '@/types';\n\n /**\n * Base button component to use as a base for all the various types of bento buttons. For internal use only.\n *\n * * @example\n * import { BaseButton, BaseButtonEvent } from '@/components/internal/base-button';\n * import YourImportedIcon from @adyen/ui-assets-icons-16/example-icon';\n *\n * export default {\n * components: { BaseButton, YourImportedIcon },\n * props: {\n * text:\n * },\n * template: `\n * <base-button class=\"your-custom-button-styles\" @click=\"onClick\">\n * <template #iconLeft><your-imported-icon></template>\n * Button text\n * <template #iconRight><your-imported-icon></template>\n * </base-button>\n * `,\n * emits: [BentoButtonEvent.CLICK],\n * setup: (prps, { emit }) => {\n * const onClick = value => emit(BaseButtonEvent.CLICK, value);\n *\n * return {\n * onClick,\n * };\n * }\n * }\n */\n export default defineComponent({\n name: 'base-button',\n components: { BentoTypography },\n props: {\n /**\n * Disables button functionality\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n /**\n * Displays button as critical\n */\n critical: {\n type: Boolean,\n default: false,\n },\n /**\n * The default behavior of the button.\n * Possible values are: 'button', 'reset', 'submit'\n */\n type: {\n type: String as PropType<ButtonHTMLAttributes['type']>,\n default: 'button',\n },\n },\n emits: [\n BentoBaseButtonEvent.CLICK,\n BentoBaseButtonEvent.FOCUS,\n BentoBaseButtonEvent.BLUR,\n BentoBaseButtonEvent.KEYDOWN_ESC,\n ],\n setup(props, { slots, emit, attrs }) {\n const ariaAttributes = computed(() => ({\n 'aria-expanded': attrs['aria-expanded']?.toString() as Booleanish,\n }));\n\n const bentoBaseButtonRef = ref(null);\n\n const conditionalClasses = computed(() => ({\n [`b-base-button--${BentoBaseButtonPropClass.DESTRUCTIVE}`]: props.critical,\n [`b-base-button--${BentoBaseButtonPropClass.ICON_ONLY}`]: !slots.default,\n }));\n\n const onClickButton = (e: MouseEvent) => {\n if (!props.disabled) {\n emit(BentoBaseButtonEvent.CLICK, e);\n } else {\n e.preventDefault();\n e.stopPropagation();\n }\n };\n\n const onFocusButton = (e: FocusEvent) => {\n emit(BentoBaseButtonEvent.FOCUS, e);\n };\n\n const onBlurButton = (e: FocusEvent) => {\n emit(BentoBaseButtonEvent.BLUR, e);\n };\n\n return {\n // Values\n ariaAttributes,\n conditionalClasses,\n\n // Methods\n onClickButton,\n onFocusButton,\n onBlurButton,\n hasSlot: useHasSlot(slots),\n\n // Refs\n bentoBaseButtonRef,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./base-button.scss\" />\n"],"names":["BentoBaseButtonPropClass","BentoBaseButtonPropClass2","BentoBaseButtonEvent","BentoBaseButtonEvent2","_sfc_main","defineComponent","BentoTypography","props","slots","emit","attrs","ariaAttributes","computed","_a","bentoBaseButtonRef","ref","conditionalClasses","e","useHasSlot"],"mappings":";;;;;AAAY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,cAAA,YACAA,EAAA,YAAA,aAFQA,IAAAD,KAAA,CAAA,CAAA,GAKAE,IAAA,kBAAAC,OACRA,EAAA,OAAA,QACAA,EAAA,QAAA,SACAA,EAAA,QAAA,SACAA,EAAA,cAAA,eAJQA,IAAAD,KAAA,CAAA,CAAA;ACwDZ,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,MAAA;AAAA,MAKA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA,EACA;AAAA,EACA,OAAA;AAAA,IACAJ,EAAA;AAAA,IACAA,EAAA;AAAA,IACAA,EAAA;AAAA,IACAA,EAAA;AAAA,EACA;AAAA,EACA,MAAAK,GAAA,EAAA,OAAAC,GAAA,MAAAC,GAAA,OAAAC,EAAA,GAAA;AAEA,UAAAC,IAAAC,EAAA,MAAA;;AAAA;AAAA,QAAA,kBAAAC,IAAAH,EAAA,eAAA,MAAA,gBAAAG,EAAA;AAAA,MACA;AAAA,KAAA,GAGAC,IAAAC,EAAA,IAAA,GAEAC,IAAAJ,EAAA,OAAA;AAAA,MAAA,CAAA,kBAAAZ,EAAA,aAAA,GAAAO,EAAA;AAAA,MACA,CAAA,kBAAAP,EAAA,WAAA,GAAA,CAAAQ,EAAA;AAAA,IACA,EAAA;AAoBA,WAAA;AAAA;AAAA,MAAA,gBAAAG;AAAA,MAEA,oBAAAK;AAAA;AAAA,MACA,eApBA,CAAAC,MAAA;AACA,QAAAV,EAAA,YAGAU,EAAA,eAAA,GACAA,EAAA,gBAAA,KAHAR,EAAAP,EAAA,OAAAe,CAAA;AAAA,MAIA;AAAA,MAiBA,eAdA,CAAAA,MAAA;AACA,QAAAR,EAAAP,EAAA,OAAAe,CAAA;AAAA,MAAA;AAAA,MAcA,cAXA,CAAAA,MAAA;AACA,QAAAR,EAAAP,EAAA,MAAAe,CAAA;AAAA,MAAA;AAAA,MAWA,SAAAC,EAAAV,CAAA;AAAA;AAAA,MACA,oBAAAM;AAAA,IAGA;AAAA,EACA;AAEA,CAAA;;;;;;;;;;;;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defineComponent as G, useAttrs as I, ref as v, computed as i, watch as p, onMounted as R } from "vue";
|
|
2
|
-
import { B as k } from "./index.
|
|
3
|
-
import { a as P } from "./button.
|
|
2
|
+
import { B as k } from "./index.965ac1af.js";
|
|
3
|
+
import { a as P } from "./button.e09d5980.js";
|
|
4
4
|
import { BentoDivider as T } from "../divider.js";
|
|
5
|
-
import { B as w } from "./index.
|
|
5
|
+
import { B as w } from "./index.2625175a.js";
|
|
6
6
|
import { u as F } from "./use-has-slot.6052d56a.js";
|
|
7
7
|
import { u as N } from "./i18n.155748d6.js";
|
|
8
8
|
import { C as x } from "./cross.a2cadac5.js";
|
|
@@ -208,4 +208,4 @@ export {
|
|
|
208
208
|
C as e,
|
|
209
209
|
dt as f
|
|
210
210
|
};
|
|
211
|
-
//# sourceMappingURL=base-modal.
|
|
211
|
+
//# sourceMappingURL=base-modal.88e7b9d4.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-modal.ec74044e.js","sources":["../../src/components/modal/modal.types.ts","../../src/components/modal/components/base-modal/base-modal.vue"],"sourcesContent":["/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoModalVariant {\n DEFAULT = 'BentoModalDefault',\n DIALOG = 'BentoModalDialog',\n}\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoModalSize {\n SMALL = 'small',\n MEDIUM = 'medium',\n LARGE = 'large',\n}\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoModalColumnLayoutVariant {\n SMALLER = 'smaller',\n EQUAL = 'equal',\n BIGGER = 'bigger',\n}\n\nexport enum BentoModalRole {\n DIALOG = 'dialog',\n ALERT_DIALOG = 'alertdialog',\n}\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoModalDialogType {\n CONFIRMATION = 'confirmation',\n DESTRUCTIVE = 'destructive',\n INFO = 'info',\n ACKNOWLEDGEMENT = 'acknowledgement',\n}\n\nexport enum BentoModalEvent {\n CLOSE_MODAL = 'close-modal',\n}\n","<template>\n <div class=\"b-modal-base\">\n <dialog\n ref=\"modal\"\n :role=\"modalRole\"\n :aria-label=\"computedAriaLabel\"\n class=\"b-modal-base__container\"\n :class=\"modalConditionalClasses\"\n :open=\"initiallyOpen\"\n @animationend=\"closeModalAfterAnimation\"\n @click=\"isDismissible && closeModalOnClickOutside($event)\"\n @keydown.esc=\"internalModalActionClose\"\n >\n <bento-focus-trap>\n <div class=\"b-modal-base__wrapper\">\n <div\n v-if=\"hasSlot('default') || !hideCloseButton\"\n class=\"b-modal-base__header-container\"\n :style=\"customPaddingStyles.header\"\n >\n <div class=\"b-modal-base__header\">\n <bento-typography\n class=\"b-modal-base__title\"\n aria-label=\"base modal title\"\n el=\"span\"\n variant=\"title\"\n stronger\n >\n <slot v-if=\"hasSlot('default')\" />\n </bento-typography>\n <bento-button\n v-if=\"!hideCloseButton\"\n class=\"b-modal-base__close-button\"\n variant=\"tertiary\"\n type=\"button\"\n @click=\"internalModalActionClose\"\n >\n <cross-icon svg-title=\"close\" />\n </bento-button>\n </div>\n\n <bento-divider v-if=\"hasColumnLayout\" class=\"b-modal-base__divider\" />\n </div>\n\n <div\n class=\"b-modal-base__content\"\n :class=\"modalContentConditionalClasses\"\n :style=\"customPaddingStyles.content\"\n >\n <bento-typography\n v-if=\"hasSlot('content') || (hasSlot('content-col-1') && hasSlot('content-col-2'))\"\n aria-label=\"base modal content\"\n el=\"div\"\n variant=\"body\"\n stronger\n >\n <grid-layout\n v-if=\"hasColumnLayout\"\n :column-width=\"computedColumnWidth\"\n :container-type=\"GridLayoutContainerType.NORMAL\"\n class=\"b-modal-base__grid\"\n >\n <template #col-1><slot name=\"content-col-1\"></slot></template>\n <template #col-2><slot name=\"content-col-2\"></slot></template>\n </grid-layout>\n <slot v-else name=\"content\" />\n </bento-typography>\n </div>\n\n <div\n v-if=\"hasSlot('actions')\"\n class=\"b-modal-base__actions-container\"\n :style=\"customPaddingStyles.actions\"\n >\n <bento-divider v-if=\"hasColumnLayout\" class=\"b-modal-base__divider\" />\n\n <div aria-label=\"modal actions\" class=\"b-modal-base__actions\">\n <slot name=\"actions\" />\n </div>\n </div>\n </div>\n </bento-focus-trap>\n </dialog>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, onMounted, PropType, ref, useAttrs, watch } from 'vue';\n import {\n BentoModalColumnLayoutVariant,\n BentoModalEvent,\n BentoModalRole,\n BentoModalSize,\n } from '@/components/modal/modal.types';\n\n import { BentoTypography } from '@/components/typography';\n import { BentoButton, BentoButtonActionsList } from '@/components/button';\n import { BentoDivider } from '@/components/divider';\n import { BentoFocusTrap } from '@/components/focus-trap';\n import { GridLayout, GridLayoutContainerType } from '@/internal';\n import { useHasSlot } from '@/composables';\n import { useI18n } from '@/utils/ts/i18n';\n import CrossIcon from '@adyen/ui-assets-icons-16/vue/cross';\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n const LOADING_BTN_CLOSE_AFTER_SUCCESS_DELAY_TIME = 500;\n\n export default defineComponent({\n i18n: { messages },\n name: 'base-modal',\n components: { CrossIcon, BentoTypography, BentoButton, BentoDivider, BentoFocusTrap, GridLayout },\n props: {\n /**\n * List of actions that will be used to render the buttons.\n * First element in the list will be rendered as \"primary\".\n * All elements after the first will be rendered as \"secondary\".\n * But you may change the color of 1-st action to red with 'critial' key\n * Not more than 3 action buttons can be provided\n * Or 2 action buttons and 1 Label for them\n *\n * Each object in the list should have a `title`, an `event` and\n * (optional) a Vue `icon` from the library `@adyen/ui-assets-icons-16`.\n *\n * `title`: Button's text.\n *\n * `event`: Event triggered when clicking the Button.\n *\n * `icon`: Vue Icon from the library `@adyen/ui-assets-icons-16`.\n *\n * ```\n * [{\n * title: 'Primary',2\n * event: () => { ... },\n * icon: FourPeopleIcon\n * }, {\n * title: 'Secondary',\n * event: () => { ... }\n * }]\n * ```\n */\n actions: {\n type: Array as PropType<BentoButtonActionsList>,\n default: null,\n },\n\n /**\n * If a column layout is provided, it renders the respective left column width variant. This can be smaller than the second column, the same size as the second column or bigger than the second column.\n */\n columnsSize: {\n type: String as PropType<BentoModalColumnLayoutVariant>,\n default: BentoModalColumnLayoutVariant.SMALLER,\n },\n\n /**\n * If provided, manages the padding of the whole modal container\n */\n customPadding: { type: String, default: null },\n\n /**\n * Hides a cross icon on the right side of the title\n */\n hideCloseButton: { type: Boolean, required: true },\n\n /**\n * Sets the open attribute on the dialog element, use isOpen instead to toggle modal visbility.\n */\n initiallyOpen: { type: Boolean, default: false },\n\n /**\n * If set to true, it allows the modal to be closed by clicking outside of it\n */\n isDismissible: { type: Boolean, required: true },\n\n /**\n * Controls the modal's state from the outside. Set it to true to open the modal\n */\n isOpen: { type: Boolean, required: true },\n\n /**\n * Defines whether the modal will be an alert modal\n */\n modalRole: { type: String, default: BentoModalRole.DIALOG },\n\n /**\n * Allows the inner elments to overflow the dialog\n */\n overflowVisible: { type: Boolean, default: false },\n\n /**\n * Sets the width of the modal\n */\n size: {\n type: String as PropType<BentoModalSize | `${BentoModalSize}`>,\n default: BentoModalSize.SMALL,\n },\n\n /**\n * If provided, renders the modal's content in a two-column layout an wth dividers separating its content\n */\n withColumnLayout: { type: Boolean, default: false },\n },\n emits: [BentoModalEvent.CLOSE_MODAL],\n setup(props, { slots, emit }) {\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const attrs = useAttrs();\n const hasSlot = useHasSlot(slots);\n const modal = ref(null);\n const isClosing = ref(false);\n\n const customPaddingStyles = computed(() => {\n if (!props.customPadding) {\n return {};\n }\n\n const xPadding = {\n paddingLeft: props.customPadding,\n paddingRight: props.customPadding,\n };\n\n const content = { ...xPadding, paddingTop: undefined, paddingBottom: undefined };\n\n if (!hasSlot('default')) {\n content.paddingTop = props.customPadding;\n }\n\n if (!hasSlot('actions')) {\n content.paddingBottom = props.customPadding;\n }\n\n return {\n header: { ...xPadding, paddingTop: props.customPadding },\n content,\n actions: { ...xPadding, paddingBottom: props.customPadding },\n };\n });\n\n const computedAriaLabel = computed(\n () => (attrs['aria-label'] as string) ?? (t('ariaLabelFallback') as string)\n );\n const hasColumnLayout = computed(() => props.withColumnLayout && props.size === BentoModalSize.LARGE);\n\n const openModal = (): void => {\n modal.value.showModal();\n };\n\n const emitCloseEvent = (): void => {\n emit(BentoModalEvent.CLOSE_MODAL);\n };\n\n // Handle closing and closing animation for dialog element\n const closeModalAfterAnimation = () => {\n if (isClosing.value) {\n modal.value.close();\n emitCloseEvent();\n isClosing.value = false;\n }\n };\n\n const startCloseModalAnimation = () => {\n if (!modal.value.open) {\n return;\n }\n isClosing.value = true;\n };\n\n // If the user has pressed escape, clicked outside or clicked the close icon\n const internalModalActionClose = (event?: Event) => {\n if (event) {\n event.preventDefault();\n }\n if (!props.isDismissible) {\n return;\n }\n startCloseModalAnimation();\n };\n\n /**\n * Since the dialog HTML element doesn't automatically close when clicking outside, a check on when the user is clicking is needed.\n * If the click doesn't happen in the dialog box itself, the modal closes\n */\n const closeModalOnClickOutside = ({ target }: Event): void => {\n if (target && (target as HTMLElement).tagName === BentoModalRole.DIALOG.toUpperCase()) {\n internalModalActionClose();\n }\n };\n\n const modalConditionalClasses = computed(() => ({\n [`b-modal-base__container--${props.size}`]: props.size,\n 'b-modal-base__container--hide': isClosing.value,\n 'b-modal-base__container--overflow-visible': props.overflowVisible,\n 'b-modal-base__container--column-layout': hasColumnLayout.value,\n }));\n\n const modalContentConditionalClasses = computed(() => ({\n 'b-modal-base__content--column-layout': hasColumnLayout.value,\n 'b-modal-base__content--with-header': hasSlot('default'),\n 'b-modal-base__content--with-actions': hasSlot('actions'),\n }));\n\n const computedColumnWidth = computed(() => {\n if (props.columnsSize === BentoModalColumnLayoutVariant.SMALLER) {\n return [{ small: 4, medium: 4, large: 4 }];\n }\n if (props.columnsSize === BentoModalColumnLayoutVariant.BIGGER) {\n return [{ small: 8, medium: 8, large: 8 }];\n }\n return [{ small: 6, medium: 6, large: 6 }];\n });\n\n watch(\n () => [props.isOpen, modal.value],\n ([newIsOpen, newModalValue], [, oldModalValue]): void => {\n if (!newModalValue) {\n return;\n }\n\n const isFirstMutation = !oldModalValue;\n if (newIsOpen) {\n openModal();\n } else if (!isFirstMutation) {\n startCloseModalAnimation();\n }\n }\n );\n\n // If the first button is a loading button then close the modal have 0.5 seconds\n // if the state is changed to 'success'.\n watch(\n () => props.actions,\n () => {\n if (props.actions?.[0]?.state === 'success') {\n setTimeout(startCloseModalAnimation, LOADING_BTN_CLOSE_AFTER_SUCCESS_DELAY_TIME);\n }\n },\n { deep: true }\n );\n\n onMounted(() => {\n if (props.isOpen && modal.value) {\n openModal();\n }\n });\n\n return {\n // Refs\n modal,\n computedAriaLabel,\n\n // Handling the state\n openModal,\n closeModalOnClickOutside,\n closeModalAfterAnimation,\n startCloseModalAnimation,\n\n // Methods\n internalModalActionClose,\n hasSlot,\n emitCloseEvent,\n t,\n\n // Styles\n modalConditionalClasses,\n modalContentConditionalClasses,\n customPaddingStyles,\n hasColumnLayout,\n computedColumnWidth,\n\n // Enums\n GridLayoutContainerType,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./base-modal.scss\" />\n"],"names":["BentoModalVariant","BentoModalVariant2","BentoModalSize","BentoModalSize2","BentoModalColumnLayoutVariant","BentoModalColumnLayoutVariant2","BentoModalRole","BentoModalRole2","BentoModalDialogType","BentoModalDialogType2","BentoModalEvent","BentoModalEvent2","LOADING_BTN_CLOSE_AFTER_SUCCESS_DELAY_TIME","_sfc_main","defineComponent","messages","CrossIcon","BentoTypography","BentoButton","BentoDivider","BentoFocusTrap","GridLayout","props","slots","emit","t","useI18n","attrs","useAttrs","hasSlot","useHasSlot","modal","ref","isClosing","customPaddingStyles","computed","xPadding","content","computedAriaLabel","hasColumnLayout","openModal","emitCloseEvent","closeModalAfterAnimation","startCloseModalAnimation","internalModalActionClose","event","closeModalOnClickOutside","target","modalConditionalClasses","modalContentConditionalClasses","computedColumnWidth","watch","newIsOpen","newModalValue","oldModalValue","_b","_a","onMounted","GridLayoutContainerType"],"mappings":";;;;;;;;;;;AAGY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,UAAA,qBACAA,EAAA,SAAA,oBAFQA,IAAAD,KAAA,CAAA,CAAA,GAQAE,IAAA,kBAAAC,OACRA,EAAA,QAAA,SACAA,EAAA,SAAA,UACAA,EAAA,QAAA,SAHQA,IAAAD,KAAA,CAAA,CAAA,GASAE,IAAA,kBAAAC,OACRA,EAAA,UAAA,WACAA,EAAA,QAAA,SACAA,EAAA,SAAA,UAHQA,IAA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AAA7B,EAAA;AAAA,MACA,MAAA;;AAEA,UAAAiC,KAAAC,IAAAlC,EAAA,YAAA,gBAAAkC,EAAA,OAAA,gBAAAD,EAAA,WAAA,aACA,WAAAZ,GAAA/B,CAAA;AAAA,MACA;AAAA,MACA,EAAA,MAAA,GAAA;AAAA,IACA,GAGA6C,EAAA,MAAA;AACA,MAAAnC,EAAA,UAAAS,EAAA,SACAS,EAAA;AAAA,IACA,CAAA,GAGA;AAAA;AAAA,MAAA,OAAAT;AAAA,MAEA,mBAAAO;AAAA;AAAA,MACA,WAAAE;AAAA,MAGA,0BAAAM;AAAA,MACA,0BAAAJ;AAAA,MACA,0BAAAC;AAAA;AAAA,MACA,0BAAAC;AAAA,MAGA,SAAAf;AAAA,MACA,gBAAAY;AAAA,MACA,GAAAhB;AAAA;AAAA,MACA,yBAAAuB;AAAA,MAGA,gCAAAC;AAAA,MACA,qBAAAf;AAAA,MACA,iBAAAK;AAAA,MACA,qBAAAW;AAAA;AAAA,MACA,yBAAAQ;AAAA,IAGA;AAAA,EACA;AAEA,CAAA;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"base-modal.88e7b9d4.js","sources":["../../src/components/modal/modal.types.ts","../../src/components/modal/components/base-modal/base-modal.vue"],"sourcesContent":["/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoModalVariant {\n DEFAULT = 'BentoModalDefault',\n DIALOG = 'BentoModalDialog',\n}\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoModalSize {\n SMALL = 'small',\n MEDIUM = 'medium',\n LARGE = 'large',\n}\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoModalColumnLayoutVariant {\n SMALLER = 'smaller',\n EQUAL = 'equal',\n BIGGER = 'bigger',\n}\n\nexport enum BentoModalRole {\n DIALOG = 'dialog',\n ALERT_DIALOG = 'alertdialog',\n}\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoModalDialogType {\n CONFIRMATION = 'confirmation',\n DESTRUCTIVE = 'destructive',\n INFO = 'info',\n ACKNOWLEDGEMENT = 'acknowledgement',\n}\n\nexport enum BentoModalEvent {\n CLOSE_MODAL = 'close-modal',\n}\n","<template>\n <div class=\"b-modal-base\">\n <dialog\n ref=\"modal\"\n :role=\"modalRole\"\n :aria-label=\"computedAriaLabel\"\n class=\"b-modal-base__container\"\n :class=\"modalConditionalClasses\"\n :open=\"initiallyOpen\"\n @animationend=\"closeModalAfterAnimation\"\n @click=\"isDismissible && closeModalOnClickOutside($event)\"\n @keydown.esc=\"internalModalActionClose\"\n >\n <bento-focus-trap>\n <div class=\"b-modal-base__wrapper\">\n <div\n v-if=\"hasSlot('default') || !hideCloseButton\"\n class=\"b-modal-base__header-container\"\n :style=\"customPaddingStyles.header\"\n >\n <div class=\"b-modal-base__header\">\n <bento-typography\n class=\"b-modal-base__title\"\n aria-label=\"base modal title\"\n el=\"span\"\n variant=\"title\"\n stronger\n >\n <slot v-if=\"hasSlot('default')\" />\n </bento-typography>\n <bento-button\n v-if=\"!hideCloseButton\"\n class=\"b-modal-base__close-button\"\n variant=\"tertiary\"\n type=\"button\"\n @click=\"internalModalActionClose\"\n >\n <cross-icon svg-title=\"close\" />\n </bento-button>\n </div>\n\n <bento-divider v-if=\"hasColumnLayout\" class=\"b-modal-base__divider\" />\n </div>\n\n <div\n class=\"b-modal-base__content\"\n :class=\"modalContentConditionalClasses\"\n :style=\"customPaddingStyles.content\"\n >\n <bento-typography\n v-if=\"hasSlot('content') || (hasSlot('content-col-1') && hasSlot('content-col-2'))\"\n aria-label=\"base modal content\"\n el=\"div\"\n variant=\"body\"\n stronger\n >\n <grid-layout\n v-if=\"hasColumnLayout\"\n :column-width=\"computedColumnWidth\"\n :container-type=\"GridLayoutContainerType.NORMAL\"\n class=\"b-modal-base__grid\"\n >\n <template #col-1><slot name=\"content-col-1\"></slot></template>\n <template #col-2><slot name=\"content-col-2\"></slot></template>\n </grid-layout>\n <slot v-else name=\"content\" />\n </bento-typography>\n </div>\n\n <div\n v-if=\"hasSlot('actions')\"\n class=\"b-modal-base__actions-container\"\n :style=\"customPaddingStyles.actions\"\n >\n <bento-divider v-if=\"hasColumnLayout\" class=\"b-modal-base__divider\" />\n\n <div aria-label=\"modal actions\" class=\"b-modal-base__actions\">\n <slot name=\"actions\" />\n </div>\n </div>\n </div>\n </bento-focus-trap>\n </dialog>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, onMounted, PropType, ref, useAttrs, watch } from 'vue';\n import {\n BentoModalColumnLayoutVariant,\n BentoModalEvent,\n BentoModalRole,\n BentoModalSize,\n } from '@/components/modal/modal.types';\n\n import { BentoTypography } from '@/components/typography';\n import { BentoButton, BentoButtonActionsList } from '@/components/button';\n import { BentoDivider } from '@/components/divider';\n import { BentoFocusTrap } from '@/components/focus-trap';\n import { GridLayout, GridLayoutContainerType } from '@/internal';\n import { useHasSlot } from '@/composables';\n import { useI18n } from '@/utils/ts/i18n';\n import CrossIcon from '@adyen/ui-assets-icons-16/vue/cross';\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n const LOADING_BTN_CLOSE_AFTER_SUCCESS_DELAY_TIME = 500;\n\n export default defineComponent({\n i18n: { messages },\n name: 'base-modal',\n components: { CrossIcon, BentoTypography, BentoButton, BentoDivider, BentoFocusTrap, GridLayout },\n props: {\n /**\n * List of actions that will be used to render the buttons.\n * First element in the list will be rendered as \"primary\".\n * All elements after the first will be rendered as \"secondary\".\n * But you may change the color of 1-st action to red with 'critial' key\n * Not more than 3 action buttons can be provided\n * Or 2 action buttons and 1 Label for them\n *\n * Each object in the list should have a `title`, an `event` and\n * (optional) a Vue `icon` from the library `@adyen/ui-assets-icons-16`.\n *\n * `title`: Button's text.\n *\n * `event`: Event triggered when clicking the Button.\n *\n * `icon`: Vue Icon from the library `@adyen/ui-assets-icons-16`.\n *\n * ```\n * [{\n * title: 'Primary',2\n * event: () => { ... },\n * icon: FourPeopleIcon\n * }, {\n * title: 'Secondary',\n * event: () => { ... }\n * }]\n * ```\n */\n actions: {\n type: Array as PropType<BentoButtonActionsList>,\n default: null,\n },\n\n /**\n * If a column layout is provided, it renders the respective left column width variant. This can be smaller than the second column, the same size as the second column or bigger than the second column.\n */\n columnsSize: {\n type: String as PropType<BentoModalColumnLayoutVariant>,\n default: BentoModalColumnLayoutVariant.SMALLER,\n },\n\n /**\n * If provided, manages the padding of the whole modal container\n */\n customPadding: { type: String, default: null },\n\n /**\n * Hides a cross icon on the right side of the title\n */\n hideCloseButton: { type: Boolean, required: true },\n\n /**\n * Sets the open attribute on the dialog element, use isOpen instead to toggle modal visbility.\n */\n initiallyOpen: { type: Boolean, default: false },\n\n /**\n * If set to true, it allows the modal to be closed by clicking outside of it\n */\n isDismissible: { type: Boolean, required: true },\n\n /**\n * Controls the modal's state from the outside. Set it to true to open the modal\n */\n isOpen: { type: Boolean, required: true },\n\n /**\n * Defines whether the modal will be an alert modal\n */\n modalRole: { type: String, default: BentoModalRole.DIALOG },\n\n /**\n * Allows the inner elments to overflow the dialog\n */\n overflowVisible: { type: Boolean, default: false },\n\n /**\n * Sets the width of the modal\n */\n size: {\n type: String as PropType<BentoModalSize | `${BentoModalSize}`>,\n default: BentoModalSize.SMALL,\n },\n\n /**\n * If provided, renders the modal's content in a two-column layout an wth dividers separating its content\n */\n withColumnLayout: { type: Boolean, default: false },\n },\n emits: [BentoModalEvent.CLOSE_MODAL],\n setup(props, { slots, emit }) {\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const attrs = useAttrs();\n const hasSlot = useHasSlot(slots);\n const modal = ref(null);\n const isClosing = ref(false);\n\n const customPaddingStyles = computed(() => {\n if (!props.customPadding) {\n return {};\n }\n\n const xPadding = {\n paddingLeft: props.customPadding,\n paddingRight: props.customPadding,\n };\n\n const content = { ...xPadding, paddingTop: undefined, paddingBottom: undefined };\n\n if (!hasSlot('default')) {\n content.paddingTop = props.customPadding;\n }\n\n if (!hasSlot('actions')) {\n content.paddingBottom = props.customPadding;\n }\n\n return {\n header: { ...xPadding, paddingTop: props.customPadding },\n content,\n actions: { ...xPadding, paddingBottom: props.customPadding },\n };\n });\n\n const computedAriaLabel = computed(\n () => (attrs['aria-label'] as string) ?? (t('ariaLabelFallback') as string)\n );\n const hasColumnLayout = computed(() => props.withColumnLayout && props.size === BentoModalSize.LARGE);\n\n const openModal = (): void => {\n modal.value.showModal();\n };\n\n const emitCloseEvent = (): void => {\n emit(BentoModalEvent.CLOSE_MODAL);\n };\n\n // Handle closing and closing animation for dialog element\n const closeModalAfterAnimation = () => {\n if (isClosing.value) {\n modal.value.close();\n emitCloseEvent();\n isClosing.value = false;\n }\n };\n\n const startCloseModalAnimation = () => {\n if (!modal.value.open) {\n return;\n }\n isClosing.value = true;\n };\n\n // If the user has pressed escape, clicked outside or clicked the close icon\n const internalModalActionClose = (event?: Event) => {\n if (event) {\n event.preventDefault();\n }\n if (!props.isDismissible) {\n return;\n }\n startCloseModalAnimation();\n };\n\n /**\n * Since the dialog HTML element doesn't automatically close when clicking outside, a check on when the user is clicking is needed.\n * If the click doesn't happen in the dialog box itself, the modal closes\n */\n const closeModalOnClickOutside = ({ target }: Event): void => {\n if (target && (target as HTMLElement).tagName === BentoModalRole.DIALOG.toUpperCase()) {\n internalModalActionClose();\n }\n };\n\n const modalConditionalClasses = computed(() => ({\n [`b-modal-base__container--${props.size}`]: props.size,\n 'b-modal-base__container--hide': isClosing.value,\n 'b-modal-base__container--overflow-visible': props.overflowVisible,\n 'b-modal-base__container--column-layout': hasColumnLayout.value,\n }));\n\n const modalContentConditionalClasses = computed(() => ({\n 'b-modal-base__content--column-layout': hasColumnLayout.value,\n 'b-modal-base__content--with-header': hasSlot('default'),\n 'b-modal-base__content--with-actions': hasSlot('actions'),\n }));\n\n const computedColumnWidth = computed(() => {\n if (props.columnsSize === BentoModalColumnLayoutVariant.SMALLER) {\n return [{ small: 4, medium: 4, large: 4 }];\n }\n if (props.columnsSize === BentoModalColumnLayoutVariant.BIGGER) {\n return [{ small: 8, medium: 8, large: 8 }];\n }\n return [{ small: 6, medium: 6, large: 6 }];\n });\n\n watch(\n () => [props.isOpen, modal.value],\n ([newIsOpen, newModalValue], [, oldModalValue]): void => {\n if (!newModalValue) {\n return;\n }\n\n const isFirstMutation = !oldModalValue;\n if (newIsOpen) {\n openModal();\n } else if (!isFirstMutation) {\n startCloseModalAnimation();\n }\n }\n );\n\n // If the first button is a loading button then close the modal have 0.5 seconds\n // if the state is changed to 'success'.\n watch(\n () => props.actions,\n () => {\n if (props.actions?.[0]?.state === 'success') {\n setTimeout(startCloseModalAnimation, LOADING_BTN_CLOSE_AFTER_SUCCESS_DELAY_TIME);\n }\n },\n { deep: true }\n );\n\n onMounted(() => {\n if (props.isOpen && modal.value) {\n openModal();\n }\n });\n\n return {\n // Refs\n modal,\n computedAriaLabel,\n\n // Handling the state\n openModal,\n closeModalOnClickOutside,\n closeModalAfterAnimation,\n startCloseModalAnimation,\n\n // Methods\n internalModalActionClose,\n hasSlot,\n emitCloseEvent,\n t,\n\n // Styles\n modalConditionalClasses,\n modalContentConditionalClasses,\n customPaddingStyles,\n hasColumnLayout,\n computedColumnWidth,\n\n // Enums\n GridLayoutContainerType,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./base-modal.scss\" />\n"],"names":["BentoModalVariant","BentoModalVariant2","BentoModalSize","BentoModalSize2","BentoModalColumnLayoutVariant","BentoModalColumnLayoutVariant2","BentoModalRole","BentoModalRole2","BentoModalDialogType","BentoModalDialogType2","BentoModalEvent","BentoModalEvent2","LOADING_BTN_CLOSE_AFTER_SUCCESS_DELAY_TIME","_sfc_main","defineComponent","messages","CrossIcon","BentoTypography","BentoButton","BentoDivider","BentoFocusTrap","GridLayout","props","slots","emit","t","useI18n","attrs","useAttrs","hasSlot","useHasSlot","modal","ref","isClosing","customPaddingStyles","computed","xPadding","content","computedAriaLabel","hasColumnLayout","openModal","emitCloseEvent","closeModalAfterAnimation","startCloseModalAnimation","internalModalActionClose","event","closeModalOnClickOutside","target","modalConditionalClasses","modalContentConditionalClasses","computedColumnWidth","watch","newIsOpen","newModalValue","oldModalValue","_b","_a","onMounted","GridLayoutContainerType"],"mappings":";;;;;;;;;;;AAGY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,UAAA,qBACAA,EAAA,SAAA,oBAFQA,IAAAD,KAAA,CAAA,CAAA,GAQAE,IAAA,kBAAAC,OACRA,EAAA,QAAA,SACAA,EAAA,SAAA,UACAA,EAAA,QAAA,SAHQA,IAAAD,KAAA,CAAA,CAAA,GASAE,IAAA,kBAAAC,OACRA,EAAA,UAAA,WACAA,EAAA,QAAA,SACAA,EAAA,SAAA,UAHQA,IAAAD,KAAA,CAAA,CAAA,GAMAE,IAAA,kBAAAC,OACRA,EAAA,SAAA,UACAA,EAAA,eAAA,eAFQA,IAAAD,KAAA,CAAA,CAAA,GAQAE,IAAA,kBAAAC,OACRA,EAAA,eAAA,gBACAA,EAAA,cAAA,eACAA,EAAA,OAAA,QACAA,EAAA,kBAAA,mBAJQA,IAAAD,KAAA,CAAA,CAAA,GAOAE,IAAA,kBAAAC,OACRA,EAAA,cAAA,eADQA,IAAAD,KAAA,CAAA,CAAA;;;;;GCiEZE,IAAA,KAEAC,IAAAC,EAAA;AAAA,EAAA,MAAA,EAAA,UAAAC,EAAA;AAAA,EACA,MAAA;AAAA,EACA,YAAA,EAAA,WAAAC,GAAA,iBAAAC,GAAA,aAAAC,GAAA,cAAAC,GAAA,gBAAAC,GAAA,YAAAC,EAAA;AAAA,EACA,OAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IACA,SAAA;AAAA,MA6BA,MAAA;AAAA,MACA,SAAA;AAAA,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ide as u } from "vue";
|
|
2
|
+
import { M as d, B as p } from "./index.37283390.js";
|
|
3
|
+
import { BentoPopoverPositions as _ } from "../popover.js";
|
|
4
|
+
import { BentoButtonActions as l } from "../button.js";
|
|
5
|
+
import { n as m } from "./_plugin-vue2_normalizer.71e2aa87.js";
|
|
6
|
+
import "../assets/button-actions-with-menu.css";
|
|
7
|
+
const f = {}, v = /* @__PURE__ */ a({
|
|
8
|
+
...f,
|
|
9
|
+
__name: "button-actions-with-menu",
|
|
10
|
+
props: {
|
|
11
|
+
/**
|
|
12
|
+
* List of actions that will be used to render the buttons.
|
|
13
|
+
* First element in the list will be rendered as "primary".
|
|
14
|
+
* All elements after the first will be rendered as "secondary".
|
|
15
|
+
*
|
|
16
|
+
* Each object in the list should have a `title`, an `event` and
|
|
17
|
+
* (optional) a Vue `icon` from the library `@adyen/ui-assets-icons-16`.
|
|
18
|
+
*
|
|
19
|
+
* `title`: Button's text.
|
|
20
|
+
*
|
|
21
|
+
* `event`: Event triggered when clicking the Button.
|
|
22
|
+
*
|
|
23
|
+
* `icon` (optional): Vue Icon from the library `@adyen/ui-assets-icons-16`.
|
|
24
|
+
*
|
|
25
|
+
* @see BentoButton for a list of all the other props supported by each button action.
|
|
26
|
+
*
|
|
27
|
+
* ```
|
|
28
|
+
* [{
|
|
29
|
+
* title: 'Primary',
|
|
30
|
+
* event: () => { ... },
|
|
31
|
+
* icon: FourPeopleIcon,
|
|
32
|
+
* link: {
|
|
33
|
+
variant: 'default',
|
|
34
|
+
external: true,
|
|
35
|
+
to: 'https://www.adyen.com/'
|
|
36
|
+
},
|
|
37
|
+
* }, {
|
|
38
|
+
* title: 'Secondary',
|
|
39
|
+
* event: () => { ... }
|
|
40
|
+
* disabled: true,
|
|
41
|
+
* variant: 'primary',
|
|
42
|
+
* critical: true
|
|
43
|
+
* }]
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
actions: {
|
|
47
|
+
type: Array,
|
|
48
|
+
required: !0
|
|
49
|
+
},
|
|
50
|
+
/**
|
|
51
|
+
* The number of actions to be displayed. The rest of the actions will be collapsed in a menu component.
|
|
52
|
+
*/
|
|
53
|
+
displayedActions: {
|
|
54
|
+
type: Number,
|
|
55
|
+
default: void 0
|
|
56
|
+
},
|
|
57
|
+
/**
|
|
58
|
+
* Set inverse color scheme to buttons and menu
|
|
59
|
+
*/
|
|
60
|
+
inverse: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
default: !1
|
|
63
|
+
},
|
|
64
|
+
/**
|
|
65
|
+
* The position of where the menu should open.
|
|
66
|
+
*/
|
|
67
|
+
menuPosition: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: "bottom-start",
|
|
70
|
+
validator: (s) => Object.values(_).includes(s)
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
setup(s) {
|
|
74
|
+
const t = s, n = i(() => t.actions.slice(0, t.displayedActions)), e = r(t, "inverse");
|
|
75
|
+
u(d, e);
|
|
76
|
+
const c = i(
|
|
77
|
+
() => t.displayedActions !== void 0 && t.displayedActions < t.actions.length ? t.actions.slice(t.displayedActions, t.actions.length).map((o) => ({
|
|
78
|
+
text: o.title,
|
|
79
|
+
handler: o.event,
|
|
80
|
+
icon: o.icon,
|
|
81
|
+
critical: o.critical,
|
|
82
|
+
disabled: o.disabled
|
|
83
|
+
})) : []
|
|
84
|
+
);
|
|
85
|
+
return { __sfc: !0, props: t, computedActions: n, inverseRef: e, computedMenuActions: c, BentoMenu: p, BentoButtonActions: l };
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
var A = function() {
|
|
89
|
+
var t = this, n = t._self._c, e = t._self._setupProxy;
|
|
90
|
+
return n("div", { staticClass: "b-button-actions-with-menu" }, [n("div", { staticClass: "b-button-actions-with-menu__container-wrapper", attrs: { role: "group" } }, [n(e.BentoButtonActions, { attrs: { actions: e.computedActions, inverse: t.inverse } }), e.computedMenuActions.length ? n(e.BentoMenu, { attrs: { data: e.computedMenuActions, "menu-position": t.menuPosition } }) : t._e()], 1)]);
|
|
91
|
+
}, y = [], b = /* @__PURE__ */ m(
|
|
92
|
+
v,
|
|
93
|
+
A,
|
|
94
|
+
y,
|
|
95
|
+
!1,
|
|
96
|
+
null,
|
|
97
|
+
"7d0c6a50",
|
|
98
|
+
null,
|
|
99
|
+
null
|
|
100
|
+
);
|
|
101
|
+
const C = b.exports;
|
|
102
|
+
export {
|
|
103
|
+
C as B
|
|
104
|
+
};
|
|
105
|
+
//# sourceMappingURL=button-actions-with-menu.a5413243.js.map
|