@adyen/bento-vue2 1.16.0 → 1.17.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/packages/vue2/src/components/checkbox/components/checkbox-group/checkbox-group.types.d.ts +2 -1
- package/dist/@types/packages/vue2/src/components/checkbox/components/checkbox-group/index.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/data-grid/composables/use-lazy-loading/use-lazy-loading.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/menu/menu.vue.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/payment-method/composables/index.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/payment-method/composables/use-payment-icon/use-payment-icon.d.ts +4 -0
- package/dist/@types/packages/vue2/src/components/payment-method/payment-method.vue.d.ts +3 -1
- package/dist/@types/packages/vue2/src/components/radio-group/radio-group.types.d.ts +3 -6
- package/dist/@types/packages/vue2/src/components/radio-group/radio-group.vue.d.ts +17 -22
- package/dist/accordion.js +3 -3
- package/dist/action-bar.js +6 -6
- package/dist/alert.js +7 -7
- package/dist/assets/base-modal.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/index38.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/index46.css +1 -1
- package/dist/assets/index47.css +1 -1
- 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/avatar-image.js +1 -1
- package/dist/button.js +5 -5
- package/dist/card.js +3 -3
- package/dist/checkbox.js +6 -6
- package/dist/checkbox.js.map +1 -1
- package/dist/chunks/{arrow-left.3364fcac.js → arrow-left.2db60716.js} +2 -2
- package/dist/chunks/{arrow-left.3364fcac.js.map → arrow-left.2db60716.js.map} +1 -1
- package/dist/chunks/{base-button.0da9c5b8.js → base-button.7b173f0c.js} +2 -2
- package/dist/chunks/{base-button.0da9c5b8.js.map → base-button.7b173f0c.js.map} +1 -1
- package/dist/chunks/{base-modal.e87e997c.js → base-modal.1180d950.js} +6 -6
- package/dist/chunks/{base-modal.e87e997c.js.map → base-modal.1180d950.js.map} +1 -1
- package/dist/chunks/{button-actions-with-menu.e2f54e3a.js → button-actions-with-menu.101db268.js} +3 -3
- package/dist/chunks/{button-actions-with-menu.e2f54e3a.js.map → button-actions-with-menu.101db268.js.map} +1 -1
- package/dist/chunks/{button.6050544b.js → button.5d0c33b3.js} +3 -3
- package/dist/chunks/{button.6050544b.js.map → button.5d0c33b3.js.map} +1 -1
- package/dist/chunks/{calendar.74dbf195.js → calendar.a64cead0.js} +5 -5
- package/dist/chunks/{calendar.74dbf195.js.map → calendar.a64cead0.js.map} +1 -1
- package/dist/chunks/{checkbox.e77bb779.js → checkbox.d1adfacc.js} +4 -4
- package/dist/chunks/{checkbox.e77bb779.js.map → checkbox.d1adfacc.js.map} +1 -1
- package/dist/chunks/{checkmark-circle-fill.7a7cedf8.js → checkmark-circle-fill.345311d2.js} +2 -2
- package/dist/chunks/{checkmark-circle-fill.7a7cedf8.js.map → checkmark-circle-fill.345311d2.js.map} +1 -1
- package/dist/chunks/{checkmark-small.90120f18.js → checkmark-small.520f01b1.js} +2 -2
- package/dist/chunks/{checkmark-small.90120f18.js.map → checkmark-small.520f01b1.js.map} +1 -1
- package/dist/chunks/{checkmark.d9f63666.js → checkmark.a6ed8f47.js} +2 -2
- package/dist/chunks/{checkmark.d9f63666.js.map → checkmark.a6ed8f47.js.map} +1 -1
- package/dist/chunks/{chevron-left.97a9a569.js → chevron-left.5edf02ac.js} +2 -2
- package/dist/chunks/{chevron-left.97a9a569.js.map → chevron-left.5edf02ac.js.map} +1 -1
- package/dist/chunks/{chevron-up.47c6b4cf.js → chevron-up.81185563.js} +2 -2
- package/dist/chunks/{chevron-up.47c6b4cf.js.map → chevron-up.81185563.js.map} +1 -1
- package/dist/chunks/{controls-group.e72e1aa2.js → controls-group.0f02d583.js} +3 -3
- package/dist/chunks/{controls-group.e72e1aa2.js.map → controls-group.0f02d583.js.map} +1 -1
- package/dist/chunks/{copy.d1a20b0c.js → copy.63cb6668.js} +4 -4
- package/dist/chunks/{copy.d1a20b0c.js.map → copy.63cb6668.js.map} +1 -1
- package/dist/chunks/{cross-circle-fill.c0077c13.js → cross-circle-fill.27580c4b.js} +2 -2
- package/dist/chunks/{cross-circle-fill.c0077c13.js.map → cross-circle-fill.27580c4b.js.map} +1 -1
- package/dist/chunks/{cross-small.189cbd3c.js → cross-small.e851e0de.js} +2 -2
- package/dist/chunks/{cross-small.189cbd3c.js.map → cross-small.e851e0de.js.map} +1 -1
- package/dist/chunks/{cross.ad9be76b.js → cross.04678d81.js} +2 -2
- package/dist/chunks/{cross.ad9be76b.js.map → cross.04678d81.js.map} +1 -1
- package/dist/chunks/{dropdown-default-textbox.29ac8970.js → dropdown-default-textbox.25ef120f.js} +4 -4
- package/dist/chunks/{dropdown-default-textbox.29ac8970.js.map → dropdown-default-textbox.25ef120f.js.map} +1 -1
- package/dist/chunks/{dropdown.91a69131.js → dropdown.9096a595.js} +14 -14
- package/dist/chunks/{dropdown.91a69131.js.map → dropdown.9096a595.js.map} +1 -1
- package/dist/chunks/{error-message.b9419287.js → error-message.01187b47.js} +3 -3
- package/dist/chunks/{error-message.b9419287.js.map → error-message.01187b47.js.map} +1 -1
- package/dist/chunks/{fixed-scroller.0146b898.js → fixed-scroller.cbab7134.js} +3 -3
- package/dist/chunks/{fixed-scroller.0146b898.js.map → fixed-scroller.cbab7134.js.map} +1 -1
- package/dist/chunks/{footer-actions.9bdf8416.js → footer-actions.cf51cdef.js} +3 -3
- package/dist/chunks/{footer-actions.9bdf8416.js.map → footer-actions.cf51cdef.js.map} +1 -1
- package/dist/chunks/{index.fb2f88c6.js → index.0a498a56.js} +3 -3
- package/dist/chunks/{index.fb2f88c6.js.map → index.0a498a56.js.map} +1 -1
- package/dist/chunks/{index.c4c59719.js → index.1cbce5a5.js} +502 -496
- package/dist/chunks/index.1cbce5a5.js.map +1 -0
- package/dist/chunks/{index.c4de22d3.js → index.433594f1.js} +3 -3
- package/dist/chunks/{index.c4de22d3.js.map → index.433594f1.js.map} +1 -1
- package/dist/chunks/{index.ea487c48.js → index.4ea5bda4.js} +2 -2
- package/dist/chunks/{index.ea487c48.js.map → index.4ea5bda4.js.map} +1 -1
- package/dist/chunks/{index.be0a3199.js → index.58ecd7ad.js} +2 -2
- package/dist/chunks/{index.be0a3199.js.map → index.58ecd7ad.js.map} +1 -1
- package/dist/chunks/{index.e876bfd9.js → index.786ee2d7.js} +6 -6
- package/dist/chunks/{index.e876bfd9.js.map → index.786ee2d7.js.map} +1 -1
- package/dist/chunks/{index.6d903b9b.js → index.7c480d3a.js} +3 -3
- package/dist/chunks/{index.6d903b9b.js.map → index.7c480d3a.js.map} +1 -1
- package/dist/chunks/{index.657f464c.js → index.80a842a9.js} +2 -2
- package/dist/chunks/{index.657f464c.js.map → index.80a842a9.js.map} +1 -1
- package/dist/chunks/{index.56204a08.js → index.ab6d4c73.js} +2 -2
- package/dist/chunks/{index.56204a08.js.map → index.ab6d4c73.js.map} +1 -1
- package/dist/chunks/{index.da09aaef.js → index.b2f96aa4.js} +96 -89
- package/dist/chunks/{index.da09aaef.js.map → index.b2f96aa4.js.map} +1 -1
- package/dist/chunks/{index.911b7a93.js → index.f1208b85.js} +149 -149
- package/dist/chunks/index.f1208b85.js.map +1 -0
- package/dist/chunks/{index.cbd58064.js → index.fa59768c.js} +7 -7
- package/dist/chunks/{index.cbd58064.js.map → index.fa59768c.js.map} +1 -1
- package/dist/chunks/{info-filled.1c693e75.js → info-filled.c37e091d.js} +2 -2
- package/dist/chunks/{info-filled.1c693e75.js.map → info-filled.c37e091d.js.map} +1 -1
- package/dist/chunks/{info.cdd7d4de.js → info.8b6328aa.js} +2 -2
- package/dist/chunks/{info.cdd7d4de.js.map → info.8b6328aa.js.map} +1 -1
- package/dist/chunks/{listbox-option-tag.e69e6052.js → listbox-option-tag.ae6d3f5d.js} +3 -3
- package/dist/chunks/{listbox-option-tag.e69e6052.js.map → listbox-option-tag.ae6d3f5d.js.map} +1 -1
- package/dist/chunks/{listbox.e7b0d444.js → listbox.8f2e4e83.js} +8 -8
- package/dist/chunks/{listbox.e7b0d444.js.map → listbox.8f2e4e83.js.map} +1 -1
- package/dist/chunks/{loading-button.92c986d5.js → loading-button.6055bc08.js} +4 -4
- package/dist/chunks/{loading-button.92c986d5.js.map → loading-button.6055bc08.js.map} +1 -1
- package/dist/chunks/{refresh.0900199c.js → refresh.71a03998.js} +2 -2
- package/dist/chunks/{refresh.0900199c.js.map → refresh.71a03998.js.map} +1 -1
- package/dist/chunks/{search.aefc7b18.js → search.471270fe.js} +2 -2
- package/dist/chunks/{search.aefc7b18.js.map → search.471270fe.js.map} +1 -1
- package/dist/chunks/{tooltip.0311abc2.js → tooltip.a007fd93.js} +3 -3
- package/dist/chunks/{tooltip.0311abc2.js.map → tooltip.a007fd93.js.map} +1 -1
- package/dist/code-snippet.js +7 -7
- package/dist/code-snippet.js.map +1 -1
- package/dist/country.js +2 -2
- package/dist/currency.js +1 -1
- package/dist/data-grid.js +1 -1
- package/dist/date-picker.js +18 -18
- package/dist/date-range-picker.js +2 -2
- package/dist/date.js +1 -1
- package/dist/divider.js +1 -1
- package/dist/dropdown.js +6 -6
- package/dist/empty-state.js +3 -3
- package/dist/filter-bar.js +20 -20
- package/dist/focus-trap.js +1 -1
- package/dist/form-layout.js +2 -2
- package/dist/header.js +128 -129
- package/dist/header.js.map +1 -1
- package/dist/index.js +297 -2936
- package/dist/index.js.map +1 -1
- package/dist/info-icon.js +4 -4
- package/dist/input-field.js +4 -4
- package/dist/internal.js +7 -7
- package/dist/link.js +1 -1
- package/dist/loading-indicator.js +1 -1
- package/dist/menu.js +1 -1
- package/dist/modal.js +5 -5
- package/dist/pagination.js +4 -4
- package/dist/payment-method.js +46 -46
- package/dist/payment-method.js.map +1 -1
- package/dist/popover.js +1 -1
- package/dist/popper-container.js +1 -1
- package/dist/radio-group.js +86 -96
- package/dist/radio-group.js.map +1 -1
- package/dist/search-bar.js +4 -4
- package/dist/secondary-nav.js +2 -2
- package/dist/segmented-control.js +4 -4
- package/dist/sidepanel.js +7 -7
- package/dist/status.js +2 -2
- package/dist/stepper.js +4 -4
- package/dist/structured-list.js +1 -1
- package/dist/summary-grid.js +3 -3
- package/dist/tabs.js +3 -3
- package/dist/tag.js +3 -3
- package/dist/textarea.js +4 -4
- package/dist/timeline.js +6 -6
- package/dist/toast.js +5 -5
- package/dist/toggle.js +3 -3
- package/dist/tutorial.js +5 -5
- package/dist/typography.js +1 -1
- package/dist/web-types.json +15 -5
- package/package.json +2 -2
- package/dist/@types/packages/vue2/src/components/payment-method/composables/usePaymentIcon.d.ts +0 -3
- package/dist/chunks/index.911b7a93.js.map +0 -1
- package/dist/chunks/index.c4c59719.js.map +0 -1
- /package/dist/assets/{cross-circle-fill.css → cross.css} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { defineComponent as o, computed as _ } from "vue";
|
|
2
2
|
import { BentoInfoIcon as i } from "../info-icon.js";
|
|
3
|
-
import { B as a } from "./index.
|
|
3
|
+
import { B as a } from "./index.ab6d4c73.js";
|
|
4
4
|
import { u as l } from "./i18n.eb5b985b.js";
|
|
5
5
|
import { n } from "./_plugin-vue2_normalizer.71e2aa87.js";
|
|
6
|
-
import { C as p } from "./cross-circle-fill.
|
|
6
|
+
import { C as p } from "./cross-circle-fill.27580c4b.js";
|
|
7
7
|
import "../assets/error-message.css";
|
|
8
8
|
const c = {
|
|
9
9
|
"en-US": {
|
|
@@ -108,4 +108,4 @@ export {
|
|
|
108
108
|
M as E,
|
|
109
109
|
S as F
|
|
110
110
|
};
|
|
111
|
-
//# sourceMappingURL=error-message.
|
|
111
|
+
//# sourceMappingURL=error-message.01187b47.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-message.
|
|
1
|
+
{"version":3,"file":"error-message.01187b47.js","sources":["../../src/components/internal/field-label/field-label.vue","../../src/components/internal/error-message/error-message.vue"],"sourcesContent":["<template>\n <label class=\"b-field-label\" :class=\"conditionalClasses\">\n <bento-typography el=\"span\" stronger>\n <template v-if=\"label\"> {{ label }}</template>\n <template v-else><slot></slot></template>\n </bento-typography>\n <bento-typography v-if=\"!!tooltipText\" el=\"span\" class=\"b-field-label__tooltip-wrapper\">\n <bento-info-icon :tooltip-text=\"tooltipText\" class=\"b-field-label__tooltip\" />\n </bento-typography>\n <bento-typography v-if=\"required\" class=\"b-field-label__requirement\" el=\"span\"\n >({{ t('required') }})</bento-typography\n >\n <bento-typography v-else-if=\"optional\" class=\"b-field-label__requirement\" el=\"span\"\n >({{ t('optional') }})</bento-typography\n >\n </label>\n</template>\n\n<script setup lang=\"ts\">\n import { BentoInfoIcon } from '@/components/info-icon';\n import { BentoTypography } from '@/components/typography';\n\n import { useI18n } from '@/utils/ts/i18n';\n\n import messages from './messages.json';\n import { computed } from 'vue';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const props = defineProps({\n /**\n * Renders the dropdown with a condensed style.\n */\n condensed: { type: Boolean, default: false },\n /**\n * Field label\n */\n label: {\n type: String,\n default: null,\n },\n /**\n * Sets the field as optional\n */\n optional: {\n type: Boolean,\n default: false,\n },\n /**\n * Sets the field as required\n */\n required: {\n type: Boolean,\n default: false,\n },\n /**\n * Adds a info icon next to the label to display the passed tooltip message.\n */\n tooltipText: {\n type: String,\n default: null,\n },\n });\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const conditionalClasses = computed(() => ({ 'b-field-label--condensed': props.condensed }));\n</script>\n\n<script lang=\"ts\">\n /**\n * Internal component to handle the labels for all field components\n\n * @example\n * import { FieldLabel } from '@/components/internal/field-label';\n *\n * export default {\n * components: { FieldLabel },\n * template: `\n * <field-label label=\"Label\" tooltip-text=\"Tooltip info\" required />\n * `\n * }\n */\n export default {\n i18n: { messages },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./field-label.scss\" />\n","<template>\n <bento-typography :id=\"$attrs.id\" class=\"b-error-message\" el=\"span\" aria-live=\"polite\">\n <div class=\"b-error-message__icon\">\n <cross-circle-icon :svg-title=\"t('error')\" />\n </div>\n {{ errorMessage }}\n </bento-typography>\n</template>\n\n<script setup lang=\"ts\">\n import { BentoTypography } from '@/components/typography';\n import CrossCircleIcon from '@adyen/ui-assets-icons-16/vue/cross-circle-fill';\n import { useI18n } from '@/utils/ts/i18n';\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n /**\n * An error message component should be used whenever it is necessary to add an error message to a component.\n * If adding to a form component, the proper accessibility measures should be taken when necessary\n * (ex. associating an element with this one using aria-describedby).\n\n * @example\n * import { ErrorMessage } from '@/components/internal/error-message';\n *\n * export default {\n * components: { ErrorMessage },\n * template: `\n * <error-message :error-message=\"errorMessage\" />\n * `\n * }\n */\n\n defineProps({\n /**\n * The rendered error message\n */\n errorMessage: {\n type: String,\n required: true,\n },\n });\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n</script>\n\n<script lang=\"ts\">\n export default {\n i18n: { messages },\n name: 'error-message',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./error-message.scss\" />\n"],"names":["__default__$1","messages$1","useI18n","conditionalClasses","computed","props","__default__","messages","t"],"mappings":";;;;;;;;;;;;GAmFIA,IAAA;AAAA,EAAe,MAAA,EAAA,UAAAC,EAAA;AAEf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBArBA,EAAA,EAAA,IAAAC,EAAA,GAEAC,IAAAC,EAAA,OAAA,EAAA,4BAAAC,EAAA,UAAA,EAAA;;;;;;;;;;;;;;;;;;;;;GCnBAC,IAAA;AAAA,EAAe,MAAA,EAAA,UAAAC,EAAA;AAAA,EACM,MAAA;AAErB;;;;;;;;;;;;AAPA,UAAA,EAAA,GAAAC,EAAA,IAAAN,EAAA;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ref as r, onMounted as R, computed as f, defineComponent as x } from "vue";
|
|
2
|
-
import { a as L } from "./button.
|
|
2
|
+
import { a as L } from "./button.5d0c33b3.js";
|
|
3
3
|
import { u as y } from "./i18n.eb5b985b.js";
|
|
4
|
-
import { C, a as b } from "./chevron-left.
|
|
4
|
+
import { C, a as b } from "./chevron-left.5edf02ac.js";
|
|
5
5
|
import { o as m } from "./resize.a041304d.js";
|
|
6
6
|
import { n as W } from "./_plugin-vue2_normalizer.71e2aa87.js";
|
|
7
7
|
import "../assets/fixed-scroller.css";
|
|
@@ -105,4 +105,4 @@ const U = P.exports;
|
|
|
105
105
|
export {
|
|
106
106
|
U as F
|
|
107
107
|
};
|
|
108
|
-
//# sourceMappingURL=fixed-scroller.
|
|
108
|
+
//# sourceMappingURL=fixed-scroller.cbab7134.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixed-scroller.0146b898.js","sources":["../../src/components/internal/fixed-scroller/composables/useFixedScroller.ts","../../src/components/internal/fixed-scroller/fixed-scroller.vue"],"sourcesContent":["import { observeSizeOfElement } from '@/utils/ts/resize';\nimport { computed, onMounted, ref } from 'vue';\nimport type { Ref } from 'vue';\n\n// Adding an offset of \"1\" so that the border can be shown within the boundaries\nconst OVERFLOW_CLIP_OFFSET = 1;\n// Add the gradient offset to the calculations\nconst GRADIENT_OFFSET = 40;\n\ninterface useFixedScrollerProps {\n contentRef?: Ref<HTMLElement | undefined>;\n containerRef?: Ref<HTMLElement | undefined>;\n leftButtonRef?: Ref<HTMLElement | undefined>;\n rightButtonRef?: Ref<HTMLElement | undefined>;\n}\n\n/**\n * Function to calculate the offset of each view and change the \"view\" via offsets\n * through the functions `scrollLeft` and `scrollRight` whilst providing a way to\n * show and hide the buttons based on the current \"view\" via\n * `shouldShowLeftButton` and `shouldShowRightButton`.\n *\n * Each view is pre-calculated (offsetArray) and updated if the content changes as a computed ref:\n * First view: Always 0 (x axis beginning).\n * Last view: total content space - visible width\n * Intermediate views: Previous offset (to the left) plus the visible space taking\n * away the space the buttons take so that the whole view can be rendered\n *\n *\n * @param {useFixedScrollerProps} props - All the necessary references to calculate the scroll\n * @param {Ref<HTMLElement | undefined>} props.containerRef - Reference to the container, this defines the visible space width\n * @param {Ref<HTMLElement | undefined>} props.contentRef - Reference to the content itself, this defines the total content width\n * @param {Ref<HTMLElement | undefined>} props.leftButtonRef - Reference to the left button, used to calculate total space in which the content will be rendered\n * @param {Ref<HTMLElement | undefined>} props.rightButtonRef - Reference to the right button, used to calculate total space in which the content will be rendered\n * @returns {Object} response - Values used in the view to show the buttons and to change the view right or left\n * @returns {Ref<number>} response.offset - Offset value by which the view will move on the x axis. To be used in `styles`.\n * @returns {ComputedRef<boolean>} response.shouldShowLeftButton - Indicates if the button on the left should be shown\n * @returns {ComputedRef<boolean>} response.shouldShowRightButton - Indicates if the button on the right should be shown\n * @returns {() => {}} response.scrollLeft - Used to shift the view to the left\n * @returns {() => {}} response.scrollRight - Used to shift the view to the right\n */\nexport const useFixedScroller = ({\n contentRef,\n containerRef,\n leftButtonRef,\n rightButtonRef,\n}: useFixedScrollerProps) => {\n const offset = ref(0);\n const currentView = ref(0);\n\n // Calculated using 'scrollWidth' to get the full width of the content\n const totalContentWidth = ref(0);\n // Calculated using 'clientWidth' to get the rendered componen width\n const visibleSpaceWidth = ref(0);\n\n onMounted(() => {\n observeSizeOfElement(containerRef.value, () => {\n if (containerRef.value) {\n // Set new width when resized\n visibleSpaceWidth.value = containerRef.value.offsetWidth;\n // Reset the offset and view\n currentView.value = 0;\n offset.value = 0;\n }\n });\n\n observeSizeOfElement(contentRef.value, () => {\n totalContentWidth.value = contentRef.value?.scrollWidth;\n });\n });\n\n // Sum of the space used by the Left and Right buttons\n // Used to calculate how much space the \"actual\" visible space is\n const buttonsWidth = computed(() => {\n const leftButtonWidth = leftButtonRef.value?.scrollWidth\n ? leftButtonRef.value.scrollWidth + GRADIENT_OFFSET\n : 0;\n const rightButtonWidth = rightButtonRef.value?.scrollWidth\n ? rightButtonRef.value.scrollWidth + GRADIENT_OFFSET\n : 0;\n\n return leftButtonWidth + rightButtonWidth;\n });\n // Total number of pages/views available.\n // Calculated as \"ceil\" because if the space doesn't fit \"one view\" (irrational number) the content flows to the next view (integer).\n const totalViews = computed(() => Math.ceil(totalContentWidth.value / visibleSpaceWidth.value) ?? 0);\n\n // Calculation of offsets per view (index).\n // This allows to easily swap the offset without on-the-fly calculations\n const offsetArray = computed(() => {\n const calculatedOffsetList = new Array(totalViews.value).fill(0);\n\n calculatedOffsetList.forEach((_, index) => {\n // First offset will be 0\n if (index === 0) {\n return;\n }\n\n // Calculate last\n if (index === totalViews.value - 1) {\n calculatedOffsetList[calculatedOffsetList.length - 1] = -(\n totalContentWidth.value -\n visibleSpaceWidth.value +\n OVERFLOW_CLIP_OFFSET\n );\n\n return;\n }\n\n // Calculate each offset - Move 1 view\n const previousOffset = calculatedOffsetList[index - 1];\n calculatedOffsetList[index] = -(visibleSpaceWidth.value + Math.abs(previousOffset) - buttonsWidth.value);\n });\n\n return calculatedOffsetList;\n });\n\n // Hide left button when it's the first view\n const shouldShowLeftButton = computed(() => currentView.value !== 0);\n // Hide right button if it's the last view\n const shouldShowRightButton = computed(\n () => offset.value >= -(totalContentWidth.value - visibleSpaceWidth.value - 1)\n );\n\n /**\n * Shifts the current offset by one view to the left.\n */\n const scrollLeft = () => {\n // Do nothing if it is already in page 0\n if (currentView.value === 0) {\n return;\n }\n\n currentView.value -= 1;\n offset.value = offsetArray.value[currentView.value];\n };\n\n /**\n * Shifts the current offset by one view to the right.\n */\n const scrollRight = () => {\n // Do nothing if it is already in last page\n if (currentView.value === totalViews.value - 1) {\n return;\n }\n\n currentView.value += 1;\n offset.value = offsetArray.value[currentView.value];\n };\n\n return {\n offset,\n shouldShowLeftButton,\n shouldShowRightButton,\n\n // Methods\n scrollLeft,\n scrollRight,\n };\n};\n","<template>\n <div ref=\"fixedScrollerRef\" class=\"b-fixed-scroller\">\n <div class=\"b-fixed-scroller__container\">\n <div\n ref=\"contentRef\"\n class=\"b-fixed-scroller__content\"\n :style=\"{\n transform: `translateX(${offset}px)`,\n paddingTop: shouldShowLeftButton || shouldShowRightButton ? `${extraPaddingTop}px` : null,\n }\"\n >\n <slot></slot>\n </div>\n </div>\n\n <div v-if=\"shouldShowLeftButton\" ref=\"leftButtonRef\" class=\"b-fixed-scroller__left\">\n <bento-button variant=\"secondary\" :aria-label=\"t('scrollLeft')\" :condensed=\"condensed\" @click=\"scrollLeft\">\n <template #iconLeft>\n <chevron-left-icon svg-title=\"checked\" aria-hidden=\"true\" />\n </template>\n </bento-button>\n </div>\n <div v-if=\"shouldShowRightButton\" ref=\"rightButtonRef\" class=\"b-fixed-scroller__right\">\n <bento-button\n variant=\"secondary\"\n :aria-label=\"t('scrollRight')\"\n :condensed=\"condensed\"\n @click=\"scrollRight\"\n >\n <template #iconLeft>\n <chevron-right-icon svg-title=\"checked\" aria-hidden=\"true\" />\n </template>\n </bento-button>\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { ref } from 'vue';\n import { BentoButton } from '@/components/button';\n import { useFixedScroller } from './composables';\n import { useI18n } from '@/utils/ts/i18n';\n import ChevronLeftIcon from '@adyen/ui-assets-icons-16/vue/chevron-left';\n import ChevronRightIcon from '@adyen/ui-assets-icons-16/vue/chevron-right';\n\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const contentRef = ref(null);\n const fixedScrollerRef = ref(null);\n const leftButtonRef = ref(null);\n const rightButtonRef = ref(null);\n\n defineProps({\n /**\n * Applies the condensed style to the buttons\n */\n condensed: { type: Boolean, default: false },\n /**\n * Padding to be applied to the top of the scroller container\n */\n extraPaddingTop: { type: Number, default: 0 },\n });\n\n const { offset, shouldShowLeftButton, shouldShowRightButton, scrollLeft, scrollRight } = useFixedScroller({\n contentRef,\n containerRef: fixedScrollerRef,\n leftButtonRef,\n rightButtonRef,\n });\n</script>\n\n<script lang=\"ts\">\n /**\n * Allows to horizontally scroll content by one view at a time.\n *\n * @example\n * import { FixedScroller } from '@/internal';\n *\n * export default {\n * components: { FixedScroller },\n * template: `\n * <fixed-scroller>\n * <div style=\"display: flex; gap: 8px;\">\n * {{ Content here }}\n * </div>\n * </fixed-scroller>\n * `\n * }\n */\n export default {\n i18n: { messages },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./fixed-scroller.scss\" />\n"],"names":["OVERFLOW_CLIP_OFFSET","GRADIENT_OFFSET","useFixedScroller","contentRef","containerRef","leftButtonRef","rightButtonRef","offset","ref","currentView","totalContentWidth","visibleSpaceWidth","onMounted","observeSizeOfElement","_a","buttonsWidth","computed","leftButtonWidth","rightButtonWidth","_b","totalViews","offsetArray","calculatedOffsetList","_","index","previousOffset","shouldShowLeftButton","shouldShowRightButton","__default__","messages","t","useI18n","fixedScrollerRef","scrollLeft","scrollRight"],"mappings":";;;;;;;AAKA,MAAAA,IAAA,GAEAC,IAAA,IAkCOC,IAAA,CAAA;AAAA,EAA0B,YAAAC;AAAA,EAC7B,cAAAC;AAAA,EACA,eAAAC;AAAA,EACA,gBAAAC;AAEJ,MAAA;AACI,QAAAC,IAAAC,EAAA,CAAA,GACAC,IAAAD,EAAA,CAAA,GAGAE,IAAAF,EAAA,CAAA,GAEAG,IAAAH,EAAA,CAAA;AAEA,EAAAI,EAAA,MAAA;AACI,IAAAC,EAAAT,EAAA,OAAA,MAAA;AACI,MAAAA,EAAA,UAEIO,EAAA,QAAAP,EAAA,MAAA,aAEAK,EAAA,QAAA,GACAF,EAAA,QAAA;AAAA,IACJ,CAAA,GAGJM,EAAAV,EAAA,OAAA,MAAA;;AACI,MAAAO,EAAA,SAAAI,IAAAX,EAAA,UAAA,gBAAAW,EAAA;AAAA,IAA4C,CAAA;AAAA,EAC/C,CAAA;AAKL,QAAAC,IAAAC,EAAA,MAAA;;AACI,UAAAC,KAAAH,IAAAT,EAAA,UAAA,QAAAS,EAAA,cAAAT,EAAA,MAAA,cAAAJ,IAAA,GAGAiB,KAAAC,IAAAb,EAAA,UAAA,QAAAa,EAAA,cAAAb,EAAA,MAAA,cAAAL,IAAA;AAIA,WAAAgB,IAAAC;AAAA,EAAyB,CAAA,GAI7BE,IAAAJ,EAAA,MAAA,KAAA,KAAAN,EAAA,QAAAC,EAAA,KAAA,KAAA,CAAA,GAIAU,IAAAL,EAAA,MAAA;AACI,UAAAM,IAAA,IAAA,MAAAF,EAAA,KAAA,EAAA,KAAA,CAAA;AAEA,WAAAE,EAAA,QAAA,CAAAC,GAAAC,MAAA;AAEI,UAAAA,MAAA;AACI;AAIJ,UAAAA,MAAAJ,EAAA,QAAA,GAAA;AACI,QAAAE,EAAAA,EAAA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scroller.cbab7134.js","sources":["../../src/components/internal/fixed-scroller/composables/useFixedScroller.ts","../../src/components/internal/fixed-scroller/fixed-scroller.vue"],"sourcesContent":["import { observeSizeOfElement } from '@/utils/ts/resize';\nimport { computed, onMounted, ref } from 'vue';\nimport type { Ref } from 'vue';\n\n// Adding an offset of \"1\" so that the border can be shown within the boundaries\nconst OVERFLOW_CLIP_OFFSET = 1;\n// Add the gradient offset to the calculations\nconst GRADIENT_OFFSET = 40;\n\ninterface useFixedScrollerProps {\n contentRef?: Ref<HTMLElement | undefined>;\n containerRef?: Ref<HTMLElement | undefined>;\n leftButtonRef?: Ref<HTMLElement | undefined>;\n rightButtonRef?: Ref<HTMLElement | undefined>;\n}\n\n/**\n * Function to calculate the offset of each view and change the \"view\" via offsets\n * through the functions `scrollLeft` and `scrollRight` whilst providing a way to\n * show and hide the buttons based on the current \"view\" via\n * `shouldShowLeftButton` and `shouldShowRightButton`.\n *\n * Each view is pre-calculated (offsetArray) and updated if the content changes as a computed ref:\n * First view: Always 0 (x axis beginning).\n * Last view: total content space - visible width\n * Intermediate views: Previous offset (to the left) plus the visible space taking\n * away the space the buttons take so that the whole view can be rendered\n *\n *\n * @param {useFixedScrollerProps} props - All the necessary references to calculate the scroll\n * @param {Ref<HTMLElement | undefined>} props.containerRef - Reference to the container, this defines the visible space width\n * @param {Ref<HTMLElement | undefined>} props.contentRef - Reference to the content itself, this defines the total content width\n * @param {Ref<HTMLElement | undefined>} props.leftButtonRef - Reference to the left button, used to calculate total space in which the content will be rendered\n * @param {Ref<HTMLElement | undefined>} props.rightButtonRef - Reference to the right button, used to calculate total space in which the content will be rendered\n * @returns {Object} response - Values used in the view to show the buttons and to change the view right or left\n * @returns {Ref<number>} response.offset - Offset value by which the view will move on the x axis. To be used in `styles`.\n * @returns {ComputedRef<boolean>} response.shouldShowLeftButton - Indicates if the button on the left should be shown\n * @returns {ComputedRef<boolean>} response.shouldShowRightButton - Indicates if the button on the right should be shown\n * @returns {() => {}} response.scrollLeft - Used to shift the view to the left\n * @returns {() => {}} response.scrollRight - Used to shift the view to the right\n */\nexport const useFixedScroller = ({\n contentRef,\n containerRef,\n leftButtonRef,\n rightButtonRef,\n}: useFixedScrollerProps) => {\n const offset = ref(0);\n const currentView = ref(0);\n\n // Calculated using 'scrollWidth' to get the full width of the content\n const totalContentWidth = ref(0);\n // Calculated using 'clientWidth' to get the rendered componen width\n const visibleSpaceWidth = ref(0);\n\n onMounted(() => {\n observeSizeOfElement(containerRef.value, () => {\n if (containerRef.value) {\n // Set new width when resized\n visibleSpaceWidth.value = containerRef.value.offsetWidth;\n // Reset the offset and view\n currentView.value = 0;\n offset.value = 0;\n }\n });\n\n observeSizeOfElement(contentRef.value, () => {\n totalContentWidth.value = contentRef.value?.scrollWidth;\n });\n });\n\n // Sum of the space used by the Left and Right buttons\n // Used to calculate how much space the \"actual\" visible space is\n const buttonsWidth = computed(() => {\n const leftButtonWidth = leftButtonRef.value?.scrollWidth\n ? leftButtonRef.value.scrollWidth + GRADIENT_OFFSET\n : 0;\n const rightButtonWidth = rightButtonRef.value?.scrollWidth\n ? rightButtonRef.value.scrollWidth + GRADIENT_OFFSET\n : 0;\n\n return leftButtonWidth + rightButtonWidth;\n });\n // Total number of pages/views available.\n // Calculated as \"ceil\" because if the space doesn't fit \"one view\" (irrational number) the content flows to the next view (integer).\n const totalViews = computed(() => Math.ceil(totalContentWidth.value / visibleSpaceWidth.value) ?? 0);\n\n // Calculation of offsets per view (index).\n // This allows to easily swap the offset without on-the-fly calculations\n const offsetArray = computed(() => {\n const calculatedOffsetList = new Array(totalViews.value).fill(0);\n\n calculatedOffsetList.forEach((_, index) => {\n // First offset will be 0\n if (index === 0) {\n return;\n }\n\n // Calculate last\n if (index === totalViews.value - 1) {\n calculatedOffsetList[calculatedOffsetList.length - 1] = -(\n totalContentWidth.value -\n visibleSpaceWidth.value +\n OVERFLOW_CLIP_OFFSET\n );\n\n return;\n }\n\n // Calculate each offset - Move 1 view\n const previousOffset = calculatedOffsetList[index - 1];\n calculatedOffsetList[index] = -(visibleSpaceWidth.value + Math.abs(previousOffset) - buttonsWidth.value);\n });\n\n return calculatedOffsetList;\n });\n\n // Hide left button when it's the first view\n const shouldShowLeftButton = computed(() => currentView.value !== 0);\n // Hide right button if it's the last view\n const shouldShowRightButton = computed(\n () => offset.value >= -(totalContentWidth.value - visibleSpaceWidth.value - 1)\n );\n\n /**\n * Shifts the current offset by one view to the left.\n */\n const scrollLeft = () => {\n // Do nothing if it is already in page 0\n if (currentView.value === 0) {\n return;\n }\n\n currentView.value -= 1;\n offset.value = offsetArray.value[currentView.value];\n };\n\n /**\n * Shifts the current offset by one view to the right.\n */\n const scrollRight = () => {\n // Do nothing if it is already in last page\n if (currentView.value === totalViews.value - 1) {\n return;\n }\n\n currentView.value += 1;\n offset.value = offsetArray.value[currentView.value];\n };\n\n return {\n offset,\n shouldShowLeftButton,\n shouldShowRightButton,\n\n // Methods\n scrollLeft,\n scrollRight,\n };\n};\n","<template>\n <div ref=\"fixedScrollerRef\" class=\"b-fixed-scroller\">\n <div class=\"b-fixed-scroller__container\">\n <div\n ref=\"contentRef\"\n class=\"b-fixed-scroller__content\"\n :style=\"{\n transform: `translateX(${offset}px)`,\n paddingTop: shouldShowLeftButton || shouldShowRightButton ? `${extraPaddingTop}px` : null,\n }\"\n >\n <slot></slot>\n </div>\n </div>\n\n <div v-if=\"shouldShowLeftButton\" ref=\"leftButtonRef\" class=\"b-fixed-scroller__left\">\n <bento-button variant=\"secondary\" :aria-label=\"t('scrollLeft')\" :condensed=\"condensed\" @click=\"scrollLeft\">\n <template #iconLeft>\n <chevron-left-icon svg-title=\"checked\" aria-hidden=\"true\" />\n </template>\n </bento-button>\n </div>\n <div v-if=\"shouldShowRightButton\" ref=\"rightButtonRef\" class=\"b-fixed-scroller__right\">\n <bento-button\n variant=\"secondary\"\n :aria-label=\"t('scrollRight')\"\n :condensed=\"condensed\"\n @click=\"scrollRight\"\n >\n <template #iconLeft>\n <chevron-right-icon svg-title=\"checked\" aria-hidden=\"true\" />\n </template>\n </bento-button>\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { ref } from 'vue';\n import { BentoButton } from '@/components/button';\n import { useFixedScroller } from './composables';\n import { useI18n } from '@/utils/ts/i18n';\n import ChevronLeftIcon from '@adyen/ui-assets-icons-16/vue/chevron-left';\n import ChevronRightIcon from '@adyen/ui-assets-icons-16/vue/chevron-right';\n\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const contentRef = ref(null);\n const fixedScrollerRef = ref(null);\n const leftButtonRef = ref(null);\n const rightButtonRef = ref(null);\n\n defineProps({\n /**\n * Applies the condensed style to the buttons\n */\n condensed: { type: Boolean, default: false },\n /**\n * Padding to be applied to the top of the scroller container\n */\n extraPaddingTop: { type: Number, default: 0 },\n });\n\n const { offset, shouldShowLeftButton, shouldShowRightButton, scrollLeft, scrollRight } = useFixedScroller({\n contentRef,\n containerRef: fixedScrollerRef,\n leftButtonRef,\n rightButtonRef,\n });\n</script>\n\n<script lang=\"ts\">\n /**\n * Allows to horizontally scroll content by one view at a time.\n *\n * @example\n * import { FixedScroller } from '@/internal';\n *\n * export default {\n * components: { FixedScroller },\n * template: `\n * <fixed-scroller>\n * <div style=\"display: flex; gap: 8px;\">\n * {{ Content here }}\n * </div>\n * </fixed-scroller>\n * `\n * }\n */\n export default {\n i18n: { messages },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./fixed-scroller.scss\" />\n"],"names":["OVERFLOW_CLIP_OFFSET","GRADIENT_OFFSET","useFixedScroller","contentRef","containerRef","leftButtonRef","rightButtonRef","offset","ref","currentView","totalContentWidth","visibleSpaceWidth","onMounted","observeSizeOfElement","_a","buttonsWidth","computed","leftButtonWidth","rightButtonWidth","_b","totalViews","offsetArray","calculatedOffsetList","_","index","previousOffset","shouldShowLeftButton","shouldShowRightButton","__default__","messages","t","useI18n","fixedScrollerRef","scrollLeft","scr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AAF,EAAAE,CAAA,IAAA,EAAAb,EAAA,QAAA,KAAA,IAAAc,CAAA,IAAAV,EAAA;AAAA,IAAkG,CAAA,GAGtGO;AAAA,EAAO,CAAA,GAIXI,IAAAV,EAAA,MAAAP,EAAA,UAAA,CAAA,GAEAkB,IAAAX;AAAA,IAA8B,MAAAT,EAAA,SAAA,EAAAG,EAAA,QAAAC,EAAA,QAAA;AAAA,EACkD;AA6BhF,SAAA;AAAA,IAAO,QAAAJ;AAAA,IACH,sBAAAmB;AAAA,IACA,uBAAAC;AAAA;AAAA,IACA,YA1BJ,MAAA;AAEI,MAAAlB,EAAA,UAAA,MAIAA,EAAA,SAAA,GACAF,EAAA,QAAAc,EAAA,MAAAZ,EAAA,KAAA;AAAA,IAAkD;AAAA,IAsBlD,aAhBJ,MAAA;AAEI,MAAAA,EAAA,UAAAW,EAAA,QAAA,MAIAX,EAAA,SAAA,GACAF,EAAA,QAAAc,EAAA,MAAAZ,EAAA,KAAA;AAAA,IAAkD;AAAA,EAUlD;AAER;;;;;GClEImB,IAAA;AAAA,EAAe,MAAA,EAAA,UAAAC,EAAA;AAEf;;;;;;;;;;;;;;AA9CA,UAAA,EAAA,GAAAC,EAAA,IAAAC,EAAA,GAEA5B,IAAAK,EAAA,IAAA,GACAwB,IAAAxB,EAAA,IAAA,GACAH,IAAAG,EAAA,IAAA,GACAF,IAAAE,EAAA,IAAA,GAaA,EAAA,QAAAD,GAAA,sBAAAmB,GAAA,uBAAAC,GAAA,YAAAM,GAAA,aAAAC,EAAA,IAAAhC,EAAA;AAAA,MAA0G,YAAAC;AAAA,MACtG,cAAA6B;AAAA,MACc,eAAA3B;AAAA,MACd,gBAAAC;AAAA,IACA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as i, toRefs as r, computed as l, onMounted as c } from "vue";
|
|
2
|
-
import { B as _ } from "./index.
|
|
3
|
-
import { B as u } from "./button.
|
|
2
|
+
import { B as _ } from "./index.ab6d4c73.js";
|
|
3
|
+
import { B as u } from "./button.5d0c33b3.js";
|
|
4
4
|
import { BentoButtonActions as d } from "../button.js";
|
|
5
5
|
import { n as p } from "./_plugin-vue2_normalizer.71e2aa87.js";
|
|
6
6
|
import "../assets/footer-actions.css";
|
|
@@ -95,4 +95,4 @@ const w = b.exports;
|
|
|
95
95
|
export {
|
|
96
96
|
w as F
|
|
97
97
|
};
|
|
98
|
-
//# sourceMappingURL=footer-actions.
|
|
98
|
+
//# sourceMappingURL=footer-actions.cf51cdef.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footer-actions.
|
|
1
|
+
{"version":3,"file":"footer-actions.cf51cdef.js","sources":["../../src/components/internal/footer-actions/footer-actions.vue"],"sourcesContent":["<template>\n <div class=\"b-footer-actions\">\n <div class=\"b-footer-actions__wrapper\">\n <bento-typography v-if=\"actionsLabel\" class=\"b-footer-actions__label\" el=\"span\" variant=\"body\" stronger>\n {{ actionsLabel }}\n </bento-typography>\n\n <bento-button-actions\n v-if=\"alignedActions.leftAligned\"\n class=\"b-footer-actions__left-group\"\n :actions=\"alignedActions.leftAligned\"\n layout=\"buttons-start\"\n ></bento-button-actions>\n\n <bento-button-actions\n class=\"b-footer-actions__right-group\"\n :actions=\"alignedActions.rightAligned\"\n layout=\"buttons-end\"\n ></bento-button-actions>\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { BentoTypography } from '@/components/typography';\n import { computed, onMounted, PropType, toRefs } from 'vue';\n import { BentoButtonActions, BentoButtonActionsList, BentoButtonVariant } from '@/components/button';\n\n const props = defineProps({\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 required: true,\n },\n /**\n * Text label that is displayed left to the action buttons\n */\n actionsLabel: {\n type: String,\n default: null,\n },\n /**\n * If passed - sets first button color to red\n */\n destructiveActions: {\n type: Boolean,\n default: false,\n },\n });\n\n const { actions, destructiveActions } = toRefs(props);\n\n const alignedActions = computed(() => {\n const rightAlignedButtons =\n actions.value.length < 3 ? actions.value : actions.value.slice(0, actions.value.length - 1);\n\n // Add red color to the 1-st Action button\n rightAlignedButtons[0].critical = destructiveActions.value || rightAlignedButtons[0].critical;\n\n return {\n leftAligned:\n actions.value.length === 3\n ? [\n {\n ...actions.value[actions.value.length - 1],\n variant: BentoButtonVariant.SECONDARY,\n },\n ]\n : null,\n rightAligned: [...rightAlignedButtons],\n };\n });\n\n onMounted(() => {\n if (props.actions && props.actions.length > 3) {\n throw new Error('Not more than 3 action buttons may be provided to Bento Modal default variant');\n }\n\n if (props.actionsLabel && props.actions && props.actions.length > 2) {\n throw new Error(\n 'Not more than 2 action buttons may be provided with actions label to Bento Modal default variant'\n );\n }\n });\n</script>\n\n<script lang=\"ts\">\n /**\n * Internal component to handle the logic of displaying actions in default Modal and Sidepanel\n\n * @example\n * import { FooterActions } from '@/components/internal/footer-actions';\n *\n * export default {\n * components: { FooterActions },\n * template: `\n * <footer-actions :actions=\"BentoButtonActionsList\" actions-label=\"Label\" :destructive-actions=\"true\" />\n * `\n * }\n */\n export default {};\n</script>\n\n<style lang=\"scss\" scoped src=\"./footer-actions.scss\" />\n"],"names":["__default__","actions","destructiveActions","toRefs","props","alignedActions","computed","rightAlignedButtons","BentoButtonVariant","onMounted"],"mappings":";;;;;;AA+HI,MAAAA,IAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAlDA,EAAA,SAAAC,GAAA,oBAAAC,EAAA,IAAAC,EAAAC,CAAA,GAEAC,IAAAC,EAAA,MAAA;AACI,YAAAC,IAAAN,EAAA,MAAA,SAAA,IAAAA,EAAA,QAAAA,EAAA,MAAA,MAAA,GAAAA,EAAA,MAAA,SAAA,CAAA;AAIA,aAAAM,EAAA,CAAA,EAAA,WAAAL,EAAA,SAAAK,EAAA,CAAA,EAAA,UAEA;AAAA,QAAO,aAAAN,EAAA,MAAA,WAAA,IAAA;AAAA,UAGO;AAAA,YACI,GAAAA,EAAA,MAAAA,EAAA,MAAA,SAAA,CAAA;AAAA,YAC6C,SAAAO,EAAA;AAAA,UACb;AAAA,QAChC,IAAA;AAAA,QAEJ,cAAA,CAAA,GAAAD,CAAA;AAAA,MAC2B;AAAA,IACzC,CAAA;AAGJ,WAAAE,EAAA,MAAA;AACI,UAAAL,EAAA,WAAAA,EAAA,QAAA,SAAA;AACI,cAAA,IAAA,MAAA,+EAAA;AAGJ,UAAAA,EAAA,gBAAAA,EAAA,WAAAA,EAAA,QAAA,SAAA;AACI,cAAA,IAAA;AAAA,UAAU;AAAA,QACN;AAAA,IAER,CAAA;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ref as i, computed as n, defineComponent as l, toRefs as o } from "vue";
|
|
2
|
-
import { B as c } from "./index.
|
|
2
|
+
import { B as c } from "./index.ab6d4c73.js";
|
|
3
3
|
import "./index.4c062058.js";
|
|
4
4
|
import { n as u } from "./_plugin-vue2_normalizer.71e2aa87.js";
|
|
5
|
-
import "../assets/
|
|
5
|
+
import "../assets/index12.css";
|
|
6
6
|
const _ = (a) => {
|
|
7
7
|
const t = i(a);
|
|
8
8
|
return n(() => t.value ? t.value.trim().charAt(0).toUpperCase() : null);
|
|
@@ -80,4 +80,4 @@ export {
|
|
|
80
80
|
s as a,
|
|
81
81
|
_ as u
|
|
82
82
|
};
|
|
83
|
-
//# sourceMappingURL=index.
|
|
83
|
+
//# sourceMappingURL=index.0a498a56.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.
|
|
1
|
+
{"version":3,"file":"index.0a498a56.js","sources":["../../src/composables/initials.ts","../../src/components/avatar-image/avatar-image.types.ts","../../src/components/avatar-image/avatar-image.vue"],"sourcesContent":["import { computed, ComputedRef, ref } from 'vue';\nimport { MaybeRef } from '@/types';\n\n/** Extracts the first letter of a username\n * @param username - The name to return the initials of\n * Common patterns:\n * 1. John => J\n * 2. John Smith => J\n * John Smith Doe Holly => J\n */\nexport const useInitials = (username: MaybeRef<string | null>): ComputedRef<string | null> => {\n const computedUsername = ref(username);\n return computed(() => (computedUsername.value ? computedUsername.value.trim().charAt(0).toUpperCase() : null));\n};\n","export enum BentoAvatarImageVariant {\n LARGE = 'large',\n SMALL = 'small',\n}\n\nexport enum BentoAvatarImageColor {\n BLUE = 'blue',\n GREEN = 'green',\n RED = 'red',\n YELLOW = 'yellow',\n}\n","<template>\n <div class=\"b-avatar-image\" :class=\"conditionalClasses\" aria-hidden=\"true\" data-testid=\"avatar\">\n <img v-if=\"src\" :src=\"src\" class=\"b-avatar-image__image\" alt=\"Profile picture\" data-testid=\"avatar-content\" />\n <div v-else class=\"b-avatar-image__default\" data-testid=\"avatar-content\">\n <bento-typography el=\"span\" variant=\"body\" strongest>\n {{ initials }}\n </bento-typography>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, PropType, toRefs } from 'vue';\n import { BentoAvatarImageColor, BentoAvatarImageVariant } from './avatar-image.types';\n import { BentoTypography } from '@/components/typography';\n import { useInitials } from '@/composables';\n\n export default defineComponent({\n name: 'avatar-image',\n components: { BentoTypography },\n props: {\n /**\n * Image src to load the profile picture.\n */\n src: {\n type: String,\n default: null,\n },\n /**\n * Name of the user that will be used to extract initials to display default value.\n * John => J\n * John Smith => JS\n * John Smith Doe => JD\n * John Smith Doe Holly => JH\n */\n username: {\n type: String,\n default: null,\n },\n /**\n * Variants supported for small and large.\n * Default - large\n */\n variant: {\n type: String as PropType<BentoAvatarImageVariant>,\n default: BentoAvatarImageVariant.LARGE,\n validator: (value: BentoAvatarImageVariant) => Object.values(BentoAvatarImageVariant).includes(value),\n },\n /**\n * Avatar color. Defaults to yellow.\n */\n color: {\n type: String as PropType<BentoAvatarImageColor>,\n default: BentoAvatarImageColor.YELLOW,\n validator: (value: BentoAvatarImageColor) => Object.values(BentoAvatarImageColor).includes(value),\n },\n },\n setup(props) {\n const { username } = toRefs(props);\n const initials = useInitials(username);\n\n const conditionalClasses = computed(() => ({\n [`b-avatar-image--${BentoAvatarImageVariant.SMALL}`]: props.variant === BentoAvatarImageVariant.SMALL,\n [`b-avatar-image--${props.color}`]: props.color,\n }));\n\n return {\n // Values\n conditionalClasses,\n initials,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./avatar-image.scss\" />\n"],"names":["useInitials","username","computedUsername","ref","computed","BentoAvatarImageVariant","BentoAvatarImageVariant2","BentoAvatarImageColor","BentoAvatarImageColor2","_sfc_main","defineComponent","BentoTypography","value","props","toRefs","initials"],"mappings":";;;;;AAUa,MAAAA,IAAA,CAAAC,MAAA;AACT,QAAAC,IAAAC,EAAAF,CAAA;AACA,SAAAG,EAAA,MAAAF,EAAA,QAAAA,EAAA,MAAA,KAAA,EAAA,OAAA,CAAA,EAAA,YAAA,IAAA,IAAA;AACJ;ACbY,IAAAG,IAAA,kBAAAC,OACRA,EAAA,QAAA,SACAA,EAAA,QAAA,SAFQA,IAAAD,KAAA,CAAA,CAAA,GAKAE,IAAA,kBAAAC,OACRA,EAAA,OAAA,QACAA,EAAA,QAAA,SACAA,EAAA,MAAA,OACAA,EAAA,SAAA,UAJQA,IAAAD,KAAA,CAAA,CAAA;ACYZ,MAAAE,IAAAC,EAAA;AAAA,EAAA,MAAA;AAAA,EACA,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