@adyen/bento-vue3 1.40.0 → 1.41.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 +6 -0
- package/dist/@types/packages/vue2/src/components/currency/currency.types.d.ts +18 -0
- package/dist/@types/packages/vue2/src/components/currency/currency.vue.d.ts +34 -211
- package/dist/@types/packages/vue2/src/components/data-grid/components/data-grid-columns/data-grid-columns.types.d.ts +0 -1
- package/dist/@types/packages/vue2/src/components/data-grid/components/data-grid-columns/data-grid-columns.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/data-grid/composables/index.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/data-grid/composables/use-calculate-column-width/use-calculate-column-width.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/data-grid/composables/use-scroller/use-scroller.d.ts +10 -1
- package/dist/@types/packages/vue2/src/components/data-grid/composables/{use-selector.d.ts → use-selector/use-selector.d.ts} +2 -2
- package/dist/@types/packages/vue2/src/components/data-grid/composables/use-sorter.d.ts +1 -2
- package/dist/@types/packages/vue2/src/components/data-grid/data-grid.vue.d.ts +16 -1
- package/dist/@types/packages/vue2/src/components/image/image.vue.d.ts +43 -72
- package/dist/@types/packages/vue2/src/components/image/index.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/layout/components/layout-row/layout-row.vue.d.ts +54 -0
- package/dist/@types/packages/vue2/src/components/layout/index.d.ts +3 -0
- package/dist/@types/packages/vue2/src/components/layout/layout.keys.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/layout/layout.types.d.ts +19 -0
- package/dist/@types/packages/vue2/src/components/layout/layout.vue.d.ts +53 -0
- package/dist/@types/packages/vue2/src/components/promo-banner/__mock-image.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/promo-banner/index.d.ts +2 -0
- package/dist/@types/packages/vue2/src/components/promo-banner/promo-banner.types.d.ts +83 -0
- package/dist/@types/packages/vue2/src/components/promo-banner/promo-banner.vue.d.ts +65 -0
- package/dist/@types/packages/vue2/src/components/selection-card/components/selection-card-group/selection-card-group.types.d.ts +2 -0
- package/dist/@types/packages/vue2/src/components/selection-card/components/selection-card-group/selection-card-group.vue.d.ts +19 -4
- package/dist/@types/packages/vue2/src/components/structured-list/components/structered-list-item/structured-list-item.vue.d.ts +1 -3
- package/dist/@types/packages/vue2/src/components/structured-list/structured-list.vue.d.ts +1 -3
- package/dist/@types/packages/vue2/src/components/tutorial/components/tutorial-popover/tutorial-popover.vue.d.ts +4 -4
- package/dist/@types/packages/vue2/src/index.d.ts +2 -0
- package/dist/action-bar.js +1 -1
- package/dist/assets/accordion-item.css +1 -1
- package/dist/assets/action-bar.css +1 -1
- package/dist/assets/base-modal.css +1 -1
- package/dist/assets/card.css +1 -1
- package/dist/assets/currency.css +1 -1
- package/dist/assets/data-grid.css +1 -1
- package/dist/assets/dialog-page.css +1 -1
- package/dist/assets/inspector.css +1 -1
- package/dist/assets/layout-row.css +1 -0
- package/dist/assets/menu.css +1 -1
- package/dist/assets/modal-fullscreen.css +1 -1
- package/dist/assets/popover.css +1 -1
- package/dist/assets/promo-banner.css +1 -0
- package/dist/assets/selection-card-group.css +1 -1
- package/dist/assets/sidepanel.css +1 -1
- package/dist/assets/structured-list-item.css +1 -1
- package/dist/checkbox.js +2 -2
- package/dist/chunks/{action-bar.CNH2XWmk.js → action-bar.BZIBGja0.js} +2 -2
- package/dist/chunks/{action-bar.CNH2XWmk.js.map → action-bar.BZIBGja0.js.map} +1 -1
- package/dist/chunks/{checkbox-group.Bu6WRt6i.js → checkbox-group.Zf-GivDW.js} +2 -2
- package/dist/chunks/{checkbox-group.Bu6WRt6i.js.map → checkbox-group.Zf-GivDW.js.map} +1 -1
- package/dist/chunks/{checkbox.DfUxRkJe.js → checkbox.DdMkyTo5.js} +15 -15
- package/dist/chunks/{checkbox.DfUxRkJe.js.map → checkbox.DdMkyTo5.js.map} +1 -1
- package/dist/chunks/{code-snippet.DqTEK8cz.js → code-snippet.Dp_tDJ-S.js} +3 -3
- package/dist/chunks/{code-snippet.DqTEK8cz.js.map → code-snippet.Dp_tDJ-S.js.map} +1 -1
- package/dist/chunks/{currency.BGrGBnhm.js → currency.Dz2x17_Q.js} +57 -70
- package/dist/chunks/currency.Dz2x17_Q.js.map +1 -0
- package/dist/chunks/{dashboard-section.rv0r2_-a.js → dashboard-section.BdRXcY4u.js} +2 -2
- package/dist/chunks/{dashboard-section.rv0r2_-a.js.map → dashboard-section.BdRXcY4u.js.map} +1 -1
- package/dist/chunks/{data-grid.DR-w_KKU.js → data-grid.BC2tOBxm.js} +1329 -1276
- package/dist/chunks/data-grid.BC2tOBxm.js.map +1 -0
- package/dist/chunks/{date-picker.mfXjVZ9w.js → date-picker.B6HK0sb2.js} +14 -14
- package/dist/chunks/{date-picker.mfXjVZ9w.js.map → date-picker.B6HK0sb2.js.map} +1 -1
- package/dist/chunks/{date-range-picker.Cs8Ia3Qs.js → date-range-picker.3iWt1Cd6.js} +23 -23
- package/dist/chunks/{date-range-picker.Cs8Ia3Qs.js.map → date-range-picker.3iWt1Cd6.js.map} +1 -1
- package/dist/chunks/{dropdown-tag.DeoUXbp4.js → dropdown-tag.ChFJ9l5g.js} +2 -2
- package/dist/chunks/{dropdown-tag.DeoUXbp4.js.map → dropdown-tag.ChFJ9l5g.js.map} +1 -1
- package/dist/chunks/{dropdown.DBxpqjEM.js → dropdown.CMKdLPHi.js} +26 -26
- package/dist/chunks/{dropdown.DBxpqjEM.js.map → dropdown.CMKdLPHi.js.map} +1 -1
- package/dist/chunks/es6.b4enG1py.js +10 -0
- package/dist/chunks/es6.b4enG1py.js.map +1 -0
- package/dist/chunks/{filter-bar.DiW13x-f.js → filter-bar.pKcJryD3.js} +7 -7
- package/dist/chunks/{filter-bar.DiW13x-f.js.map → filter-bar.pKcJryD3.js.map} +1 -1
- package/dist/chunks/image.vue_vue_type_script_setup_true_lang.BMoSMeM-.js +47 -0
- package/dist/chunks/image.vue_vue_type_script_setup_true_lang.BMoSMeM-.js.map +1 -0
- package/dist/chunks/index.ChdIlujs.js +248 -0
- package/dist/chunks/{index.DKQuLmwu.js.map → index.ChdIlujs.js.map} +1 -1
- package/dist/chunks/{input-field.DbeVnbwg.js → input-field.Bk2p3kIb.js} +2 -2
- package/dist/chunks/{input-field.DbeVnbwg.js.map → input-field.Bk2p3kIb.js.map} +1 -1
- package/dist/chunks/layout-row.rzhGrBQ3.js +101 -0
- package/dist/chunks/layout-row.rzhGrBQ3.js.map +1 -0
- package/dist/chunks/{pagination.B-OihXTg.js → pagination.D_4FRHE9.js} +2 -2
- package/dist/chunks/{pagination.B-OihXTg.js.map → pagination.D_4FRHE9.js.map} +1 -1
- package/dist/chunks/promo-banner.BRn1iznD.js +126 -0
- package/dist/chunks/promo-banner.BRn1iznD.js.map +1 -0
- package/dist/chunks/{search-bar.DN-QKFlJ.js → search-bar.D_4u91te.js} +3 -3
- package/dist/chunks/{search-bar.DN-QKFlJ.js.map → search-bar.D_4u91te.js.map} +1 -1
- package/dist/chunks/{secondary-nav.C-7Qq6rE.js → secondary-nav.CQ3aLyrM.js} +4 -4
- package/dist/chunks/{secondary-nav.C-7Qq6rE.js.map → secondary-nav.CQ3aLyrM.js.map} +1 -1
- package/dist/chunks/selection-card-group.Du3Cwf47.js +474 -0
- package/dist/chunks/selection-card-group.Du3Cwf47.js.map +1 -0
- package/dist/chunks/{structured-list-item.BhNJlDub.js → structured-list-item.CujUEOTK.js} +3 -3
- package/dist/chunks/structured-list-item.CujUEOTK.js.map +1 -0
- package/dist/chunks/{timeline-item.CEolKFn0.js → timeline-item.B8VvkDfR.js} +2 -2
- package/dist/chunks/{timeline-item.CEolKFn0.js.map → timeline-item.B8VvkDfR.js.map} +1 -1
- package/dist/chunks/{tutorial.vue_vue_type_script_setup_true_lang.Bz6QyDuV.js → tutorial.vue_vue_type_script_setup_true_lang.CGpbGgfc.js} +9 -9
- package/dist/chunks/{tutorial.vue_vue_type_script_setup_true_lang.Bz6QyDuV.js.map → tutorial.vue_vue_type_script_setup_true_lang.CGpbGgfc.js.map} +1 -1
- package/dist/chunks/{use-cached-selected-values.C7Lt5U_S.js → use-cached-selected-values.DaRzXFIt.js} +2 -2
- package/dist/chunks/{use-cached-selected-values.C7Lt5U_S.js.map → use-cached-selected-values.DaRzXFIt.js.map} +1 -1
- package/dist/code-snippet.js +1 -1
- package/dist/currency.js +1 -1
- package/dist/dashboard-template.js +1 -1
- package/dist/data-grid.js +1 -1
- package/dist/date-picker.js +1 -1
- package/dist/date-range-picker.js +1 -1
- package/dist/dropdown.js +3 -3
- package/dist/filter-bar.js +1 -1
- package/dist/image.js +1 -1
- package/dist/index.js +197 -190
- package/dist/index.js.map +1 -1
- package/dist/input-field.js +1 -1
- package/dist/internal.js +1 -1
- package/dist/layout.js +6 -0
- package/dist/layout.js.map +1 -0
- package/dist/pagination.js +1 -1
- package/dist/promo-banner.js +7 -0
- package/dist/promo-banner.js.map +1 -0
- package/dist/search-bar.js +2 -2
- package/dist/secondary-nav.js +1 -1
- package/dist/selection-card.js +1 -1
- package/dist/structured-list.js +1 -1
- package/dist/styles/bento-dark.css +16 -0
- package/dist/styles/bento-light.css +16 -0
- package/dist/styles/bento.css +16 -0
- package/dist/styles/legacy.css +16 -0
- package/dist/styles/styleguide.css +16 -0
- package/dist/timeline.js +1 -1
- package/dist/tutorial.js +1 -1
- package/dist/web-types.json +1 -1
- package/package.json +2 -2
- package/dist/@types/packages/vue2/src/components/image/image.types.d.ts +0 -19
- package/dist/chunks/currency.BGrGBnhm.js.map +0 -1
- package/dist/chunks/data-grid.DR-w_KKU.js.map +0 -1
- package/dist/chunks/es6.BvpG4Oi6.js +0 -9
- package/dist/chunks/es6.BvpG4Oi6.js.map +0 -1
- package/dist/chunks/image.0KzfycGE.js +0 -78
- package/dist/chunks/image.0KzfycGE.js.map +0 -1
- package/dist/chunks/index.DKQuLmwu.js +0 -182
- package/dist/chunks/selection-card-group.DkSYInMF.js +0 -392
- package/dist/chunks/selection-card-group.DkSYInMF.js.map +0 -1
- package/dist/chunks/structured-list-item.BhNJlDub.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as pe, useAttrs as ce, useSlots as fe, ref as A, provide as be, inject as ve, toRef as ye, computed as o, toRefs as me, openBlock as d, createBlock as p, unref as t, normalizeClass as we, withCtx as v, renderSlot as c, createCommentVNode as i, createElementVNode as O, createElementBlock as y, withModifiers as Y, mergeProps as R, withKeys as De, createTextVNode as he, toDisplayString as Ee, createVNode as ge } from "vue";
|
|
2
|
-
import { a as Se, I as Te, B as j } from "./dropdown.
|
|
2
|
+
import { a as Se, I as Te, B as j } from "./dropdown.CMKdLPHi.js";
|
|
3
3
|
import { p as _e, d as W, B as w } from "./typography.DNzU41ah.js";
|
|
4
4
|
import { g as D } from "./generate-uid.D-HFI38h.js";
|
|
5
5
|
import { g as Ae } from "./get-slot-text.D5WBGjic.js";
|
|
@@ -364,4 +364,4 @@ export {
|
|
|
364
364
|
I as d,
|
|
365
365
|
Be as e
|
|
366
366
|
};
|
|
367
|
-
//# sourceMappingURL=input-field.
|
|
367
|
+
//# sourceMappingURL=input-field.Bk2p3kIb.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-field.DbeVnbwg.js","sources":["../../../vue2/src/components/input-field/input-field.types.ts","../../../vue2/src/components/input-field/input-field.vue"],"sourcesContent":["import { BentoDropdown } from '@/components/dropdown/';\nimport type { HTMLAttributes } from 'vue/types/jsx';\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoInputFieldVariant {\n DEFAULT = 'default',\n PAYMENT_METHOD = 'payment-method',\n STATIC_VALUE = 'static-value',\n DROPDOWN = 'dropdown',\n}\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoInputFieldElementPosition {\n START = 'start',\n END = 'end',\n}\n\nexport enum BentoInputFieldStateClass {\n CONDENSED = 'condensed',\n DISABLED = 'disabled',\n READONLY = 'readonly',\n ERROR = 'error',\n}\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoInputFieldType {\n SEARCH = 'search',\n TEXT = 'text',\n NUMBER = 'number',\n}\n\nexport type BentoInputFieldValue = string | number;\n\ntype DropdownProps = InstanceType<typeof BentoDropdown>['$props'];\nexport type BentoInputDropdownProps = {\n items: DropdownProps['items'];\n value: DropdownProps['value'];\n dynamicFiltering?: DropdownProps['dynamicFiltering'];\n 'aria-label'?: HTMLAttributes['aria-label'];\n};\n\n/**\n * @deprecated The use of these enums is no longer supported.\n * Use `v-on:` or `@` to listen to the events being emitted.\n * This enum will be removed in 2.0.\n */\nexport enum BentoInputFieldEvent {\n INPUT = 'input',\n ESCAPE_PRESSED = 'escape-pressed',\n UPDATE_DROPDOWN = 'update:dropdown',\n DROPDOWN_INPUT = 'dropdown-input',\n FOCUS = 'focus',\n CHANGE = 'change',\n BLUR = 'blur',\n KEYDOWN = 'keydown',\n}\n","<template>\n <bento-typography\n class=\"b-input-field\"\n data-testid=\"input-text-container\"\n :class=\"inputFieldConditionalClasses\"\n el=\"div\"\n variant=\"body\"\n >\n <field-label\n v-if=\"hasSlot('default')\"\n :for=\"inputFieldId\"\n data-testid=\"input-field-label\"\n :tooltip-text=\"tooltipText\"\n :optional=\"optional\"\n :required=\"required\"\n @click=\"focusInput\"\n >\n <slot></slot>\n </field-label>\n\n <div class=\"b-input-field__input-box\" data-testid=\"input-box\" :aria-disabled=\"disabled\" @click=\"focusInput\">\n <!-- Optional Icon for Default text variant -->\n <span\n v-if=\"isDefaultVariant && (hasSlot('defaultIconBefore') || hasSlot('iconBefore'))\"\n :aria-hidden=\"ariaHidden ? 'true' : undefined\"\n class=\"b-input-field__icon-before\"\n >\n <slot v-if=\"hasSlot('iconBefore')\" name=\"iconBefore\" />\n <slot v-if=\"hasSlot('defaultIconBefore') && !hasSlot('iconBefore')\" name=\"defaultIconBefore\" />\n </span>\n\n <!-- Mandatory Icon for Payment Method variant -->\n <span\n v-if=\"isPaymentMethodVariant && hasSlot('paymentMethod')\"\n :aria-hidden=\"ariaHidden ? 'true' : undefined\"\n class=\"b-input-field__payment-method\"\n >\n <slot name=\"paymentMethod\" />\n </span>\n\n <!-- Dropdown at start -->\n <div\n v-if=\"shouldDisplayDropdownAtStart\"\n :id=\"dropdownId\"\n class=\"b-input-field__dropdown b-input-field__dropdown--start\"\n @click.stop\n >\n <bento-dropdown\n v-if=\"dropdown\"\n v-bind=\"inputFieldDropdownProps\"\n :disabled=\"disabled\"\n :readonly=\"isReadOnly\"\n @input=\"onDropdownInput\"\n />\n </div>\n\n <!-- Static Value at start -->\n <bento-typography\n v-if=\"shouldDisplayStaticValueAtStart\"\n :id=\"staticValueId\"\n class=\"b-input-field__static-value b-input-field__static-value--start\"\n el=\"span\"\n variant=\"body\"\n >\n <slot name=\"staticValue\" />\n </bento-typography>\n <div class=\"b-input-field__input-container\">\n <input\n :id=\"inputFieldId\"\n v-bind=\"attrs\"\n ref=\"inputFieldElement\"\n class=\"b-input-field__input\"\n :aria-label=\"computedAriaLabel\"\n :aria-describedby=\"computedAriaDescribedBy\"\n :aria-owns=\"computedAriaOwns\"\n :aria-invalid=\"shouldShowError\"\n :placeholder=\"placeholder\"\n :type=\"type\"\n :value=\"value\"\n :disabled=\"disabled\"\n :readonly=\"isReadOnly\"\n @input=\"onInput\"\n @change=\"emit('change')\"\n @focus=\"onFocus\"\n @blur=\"onBlur\"\n @keydown=\"emit('keydown', $event)\"\n @keydown.esc=\"emit('escape-pressed')\"\n />\n\n <!-- Hint at the end -->\n <bento-typography v-if=\"hint && isFocused && value\" el=\"span\" class=\"b-input-field__hint\">\n {{ hint }}\n </bento-typography>\n </div>\n\n <span\n v-if=\"hasSlot('iconAfter')\"\n :aria-hidden=\"ariaHidden ? 'true' : undefined\"\n class=\"b-input-field__icon-after\"\n data-testid=\"input-text__icon-after\"\n >\n <slot name=\"iconAfter\" />\n </span>\n\n <!-- Static Value at the end -->\n <bento-typography\n v-if=\"shouldDisplayStaticValueAtEnd\"\n :id=\"staticValueId\"\n class=\"b-input-field__static-value b-input-field__static-value--end\"\n el=\"span\"\n variant=\"body\"\n >\n <slot name=\"staticValue\" />\n </bento-typography>\n\n <!-- Dropdown at end -->\n <div\n v-if=\"shouldDisplayDropdownAtEnd\"\n :id=\"dropdownId\"\n data-testid=\"input-field-dropdown-container-end\"\n class=\"b-input-field__dropdown b-input-field__dropdown--end\"\n @click.stop\n >\n <bento-dropdown\n v-if=\"dropdown\"\n :id=\"dropdownId\"\n v-bind=\"inputFieldDropdownProps\"\n :disabled=\"disabled\"\n :readonly=\"isReadOnly\"\n @input=\"onDropdownInput\"\n />\n </div>\n </div>\n\n <error-message\n v-if=\"shouldShowError && !!errorMessage\"\n :id=\"errorId\"\n :error-message=\"errorMessage\"\n class=\"b-input-field__error-message\"\n />\n\n <span v-if=\"hasSlot('description')\" :id=\"descriptionId\" class=\"b-input-field__description\" @click=\"focusInput\">\n <bento-typography el=\"span\" variant=\"body\">\n <slot id=\"description\" name=\"description\" />\n </bento-typography>\n </span>\n </bento-typography>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, inject, PropType, provide, Ref, ref, toRef, toRefs, useAttrs, useSlots } from 'vue';\n\n // Components\n import { BentoDropdown } from '@/components/dropdown';\n import { BentoTypography } from '@/components/typography';\n import { ErrorMessage, FieldLabel } from '@/internal';\n\n // Utils\n import { deprecate } from '@/utils/ts/deprecate';\n import { generateUid } from '@/core/utils/ts';\n import { getSlotText } from '@/utils/ts/get-slot-text';\n import { useAriaLabel } from '@/utils/ts/aria-label';\n import { useI18n } from '@/utils/ts/i18n';\n import { printDevelopmentWarning } from '@/utils/ts/print-development-warning';\n import {\n INPUT_FIELD_COMPONENT_INJECTION_KEY,\n INPUT_FIELD_HINT_INJECTION_KEY,\n } from '@/components/input-field/input-field.keys';\n\n // Composables\n import { useFormLayoutFieldLoading, useHasSlot } from '@/composables';\n\n // Types\n import {\n BentoInputDropdownProps,\n BentoInputFieldElementPosition,\n BentoInputFieldStateClass,\n BentoInputFieldType,\n BentoInputFieldValue,\n BentoInputFieldVariant,\n } from './input-field.types';\n import { BentoListboxSelectedValue } from '@/types';\n\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const attrs = useAttrs();\n const slots = useSlots();\n\n const props = defineProps({\n /**\n * Indicates whether the element is exposed to an accessibility API.\n */\n ariaHidden: { type: Boolean, default: true },\n\n /**\n * @deprecated from version 2.0.0. Use the aria-label attribute instead.\n */\n /**\n * Text that labels an the input element\n */\n ariaLabel: { type: String, default: undefined },\n\n /**\n * Reduces height of the input\n */\n condensed: { type: Boolean, default: false },\n\n /**\n * Disables the possibility of changing value in the input-field\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Dropdown props for the small selectable dropdown menu.\n * Properties supported:\n *\n * - `value`: Selected value of the dropdown\n * - `items`: List of available items\n * - `aria-label`: Text that labels the dropdown element\n *\n */\n dropdown: {\n type: Object as PropType<BentoInputDropdownProps>,\n default: undefined,\n },\n\n /**\n * Position of the dropdown before or after input value\n */\n dropdownPosition: {\n type: String as PropType<BentoInputFieldElementPosition | `${BentoInputFieldElementPosition}`>,\n default: BentoInputFieldElementPosition.START,\n validator: (value: BentoInputFieldElementPosition) =>\n Object.values(BentoInputFieldElementPosition).includes(value),\n },\n\n /**\n * Adds error validation class for outlining input-field.\n *\n * @deprecated Use \"errorMessage\" prop instead\n */\n error: { type: Boolean, default: false },\n\n /**\n * Renders input-field with an error state and the error message beneath the input box\n */\n errorMessage: { type: String, default: null },\n\n /**\n * Highlights the dropdown is optional.\n */\n optional: { type: Boolean, default: false },\n\n /**\n * Text displayed as the placeholder of the input-field\n */\n placeholder: { type: String, default: '' },\n\n /**\n * Highlights the dropdown is required.\n */\n required: { type: Boolean, default: false },\n\n /**\n * Setting this property to true will set the input field to read only state.\n */\n readonly: { type: Boolean, default: false },\n\n /**\n * Static text that displayed before or after input value\n * Applicable to the Static Value variant\n */\n staticValue: { type: String, default: '' },\n\n /**\n * Position of Static Value before or after input value\n */\n staticValuePosition: {\n type: String as PropType<BentoInputFieldElementPosition | `${BentoInputFieldElementPosition}`>,\n default: BentoInputFieldElementPosition.START,\n validator: (value: BentoInputFieldElementPosition) =>\n Object.values(BentoInputFieldElementPosition).includes(value),\n },\n\n /**\n * Adds a info icon next to the label to display the passed tooltip message.\n */\n tooltipText: { type: String, default: null },\n\n /**\n * A string specifying the type of control to render.\n * All `input` types are available but only `search`, `text` and `number` are fully supported.\n *\n * If `type` is `search`, use `bento-search-bar` instead.\n */\n type: {\n type: String as PropType<BentoInputFieldType | `${BentoInputFieldType}` | HTMLInputElement['type']>,\n default: BentoInputFieldType.TEXT,\n },\n\n /**\n * Text displayed as the value of the input-field\n */\n value: { type: [String, Number] as PropType<BentoInputFieldValue>, default: undefined },\n\n /**\n * Describes the different variants for the input element\n */\n variant: {\n type: String as PropType<BentoInputFieldVariant | `${BentoInputFieldVariant}`>,\n default: BentoInputFieldVariant.DEFAULT,\n validator: (value: BentoInputFieldVariant) => Object.values(BentoInputFieldVariant).includes(value),\n },\n });\n\n const emit = defineEmits<{\n /**\n * Emitted when the Input Field's internal dropdown changes it's value. Contains every dropdown prop passed with the updated selected value as 'value'\n */\n (e: 'update:dropdown', updatedDropdownProps: BentoInputDropdownProps): void;\n\n /**\n * Emitted when the element has lost focus\n */\n (e: 'blur'): void;\n\n /**\n * Emitted when the user modifies the element's value. Unlike the 'input' event, the change event is not necessarily fired for each alteration to an element's value\n */\n (e: 'change'): void;\n\n /**\n * Emitted when the Input Field's internal dropdown changes it's value\n */\n (e: 'dropdown-input', selectedValue: BentoListboxSelectedValue): void;\n\n /**\n * Emitted when the \"ESC\" key is pressed\n */\n (e: 'escape-pressed'): void;\n\n /**\n * Emitted when the element has received focus\n */\n (e: 'focus'): void;\n\n /**\n * Emitted when a key is pressed\n */\n (e: 'keydown', event: KeyboardEvent): void;\n\n /**\n * Emitted when the component's model changes\n */\n (e: 'input', inputValue: string): void;\n }>();\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const hasSlot = useHasSlot(slots);\n const inputFieldElement = ref(null);\n const inputFieldId = generateUid('input');\n const dropdownId = generateUid('input-dropdown');\n const staticValueId = generateUid('input-static-value');\n const descriptionId = generateUid('input-description');\n const errorId = generateUid('input-error');\n const isFocused = ref(false);\n\n // Provide INPUT_FIELD_COMPONENT_INJECTION_KEY as true, to set the input only dropdown size variant in the BentoDropdown comp\n provide(INPUT_FIELD_COMPONENT_INJECTION_KEY, true);\n // Renders the input with a hint if a string is provided\n const hint = inject<Ref<string | undefined>>(INPUT_FIELD_HINT_INJECTION_KEY, ref(undefined));\n\n const onFocus = () => {\n isFocused.value = true;\n emit('focus');\n };\n\n const onBlur = () => {\n isFocused.value = false;\n emit('blur');\n };\n\n const { isReadOnly } = useFormLayoutFieldLoading(toRef(props, 'readonly'));\n\n const shouldShowStaticValue = computed(\n () => props.variant === BentoInputFieldVariant.STATIC_VALUE && !!slots.staticValue\n );\n\n const isDefaultVariant = computed(() => props.variant === BentoInputFieldVariant.DEFAULT);\n\n const isPaymentMethodVariant = computed(() => props.variant === BentoInputFieldVariant.PAYMENT_METHOD);\n\n const shouldDisplayStaticValueAtStart = computed(\n () => shouldShowStaticValue.value && props.staticValuePosition === BentoInputFieldElementPosition.START\n );\n const shouldDisplayStaticValueAtEnd = computed(\n () => shouldShowStaticValue.value && props.staticValuePosition === BentoInputFieldElementPosition.END\n );\n\n const shouldShowDropdown = computed(() => props.variant === BentoInputFieldVariant.DROPDOWN && !!props.dropdown);\n const shouldDisplayDropdownAtStart = computed(\n () => shouldShowDropdown.value && props.dropdownPosition === BentoInputFieldElementPosition.START\n );\n const shouldDisplayDropdownAtEnd = computed(\n () => shouldShowDropdown.value && props.dropdownPosition === BentoInputFieldElementPosition.END\n );\n\n const shouldShowError = computed(\n () => !props.disabled && !isReadOnly.value && (!!props.errorMessage || props.error)\n );\n\n const computedAriaOwns = computed(() => {\n if (shouldShowDropdown.value === true && shouldShowStaticValue.value === true) {\n return `${staticValueId} ${dropdownId}`;\n }\n if (shouldShowDropdown.value === true) {\n return `${dropdownId}`;\n }\n if (shouldShowStaticValue.value === true) {\n return `${staticValueId}`;\n }\n return null;\n });\n\n // vue-i18n issue with t() used in script - direct usage in template works\n // requires either createI18n({ legacy: false }) or to be wrapped in computed()\n const computedAriaLabelFallbackMessage = computed(() => t('ariaLabelFallback'));\n const computedAriaLabelDropdowFallback = computed(() =>\n t('ariaLabelDropdownFallback', { inputLabel: computedAriaLabel.value })\n );\n\n const ariaLabelAttribute = ref(attrs['aria-label']);\n const { ariaLabel } = toRefs(props);\n const computedAriaLabel = useAriaLabel({\n ariaLabel: ariaLabelAttribute.value as string,\n // TODO: take this line away when the aria-label props is removed\n label: ariaLabel,\n defaultFallback: hasSlot('default')\n ? (getSlotText(slots)('default') as string)\n : computedAriaLabelFallbackMessage,\n });\n\n const computedAriaDescribedBy = computed(\n () =>\n `${hasSlot('description') ? descriptionId : ''} ${\n shouldShowError.value && !!props.errorMessage ? errorId : ''\n }`\n );\n\n const inputFieldConditionalClasses = computed(() => ({\n [`b-input-field--${BentoInputFieldStateClass.CONDENSED}`]: props.condensed,\n [`b-input-field--${BentoInputFieldStateClass.DISABLED}`]: props.disabled,\n [`b-input-field--${BentoInputFieldStateClass.READONLY}`]: isReadOnly.value,\n [`b-input-field--${BentoInputFieldStateClass.ERROR}`]: shouldShowError.value,\n }));\n\n const inputFieldDropdownProps = computed(() => ({\n 'aria-label': computedAriaLabelDropdowFallback.value,\n ...props.dropdown,\n }));\n\n const onInput = (event: Event) => {\n const inputValue = (event.target as HTMLInputElement).value;\n if (!props.disabled && !isReadOnly.value) {\n emit('input', inputValue);\n }\n };\n\n const onDropdownInput = (selectedValue: BentoListboxSelectedValue) => {\n emit('dropdown-input', selectedValue);\n emit('update:dropdown', { ...props?.dropdown, value: selectedValue });\n };\n\n const focusInput = () => {\n inputFieldElement.value.focus();\n };\n\n // Expose method so that other components can focus on it in Vue3\n defineExpose({\n focusInput,\n });\n\n if (!Object.values(BentoInputFieldType).includes(props.type as BentoInputFieldType)) {\n printDevelopmentWarning(`\"bento-input-field\" dropdown does not support the type ${props.type}`);\n }\n\n /**\n * Deprecations\n */\n if (props.error) {\n deprecate(\n 'BentoInputField \"error\" property',\n `Use the BentoInputField \"errorMessage\" property instead to indicate that there is a modifier error.\n Having the field as \"undefined\" will hide/remove the error.\n <bento-dropdown errorMessage=\"Error message text\" />`,\n '2.0.0'\n );\n }\n\n if (hasSlot('defaultIconBefore')) {\n deprecate(\n 'BentoInputField \"defaultIconBefore\" slot',\n `Use the BentoInputField \"iconBefore\" slot instead to add an icon at the left side of the input field\n <bento-input-field>\n \\t<template #iconBefore>\n \\t\\t<my-icon-goes-here />\n \\t</template>\n </bento-input-field>`,\n '2.0.0'\n );\n }\n</script>\n\n<script lang=\"ts\">\n /**\n * Input field component is used to create interactive controls for web-based\n * forms in order to accept data from the user.\n *\n * @example\n * import { BentoInputField } from '@adyen/bento-vue2'\n *\n * const inputValue = ref('');\n *\n * export default {\n * components: { BentoInputField },\n * tempate: `\n * <bento-input-field\n * :value=\"inputValue\"\n * :input=\"newValue => inputValue.value = newValue\"\n * >\n * }\n */\n export default {\n i18n: { messages },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./input-field.scss\" />\n"],"names":["BentoInputFieldVariant","BentoInputFieldVariant2","BentoInputFieldElementPosition","BentoInputFieldElementPosition2","BentoInputFieldStateClass","BentoInputFieldStateClass2","BentoInputFieldType","BentoInputFieldType2","BentoInputFieldEvent","BentoInputFieldEvent2","__default__","messages","attrs","useAttrs","slots","useSlots","props","__props","emit","__emit","t","useI18n","hasSlot","useHasSlot","inputFieldElement","ref","inputFieldId","generateUid","dropdownId","staticValueId","descriptionId","errorId","isFocused","provide","INPUT_FIELD_COMPONENT_INJECTION_KEY","hint","inject","INPUT_FIELD_HINT_INJECTION_KEY","onFocus","onBlur","isReadOnly","useFormLayoutFieldLoading","toRef","shouldShowStaticValue","computed","isDefaultVariant","isPaymentMethodVariant","shouldDisplayStaticValueAtStart","shouldDisplayStaticValueAtEnd","shouldShowDropdown","shouldDisplayDropdownAtStart","shouldDisplayDropdownAtEnd","shouldShowError","computedAriaOwns","computedAriaLabelFallbackMessage","computedAriaLabelDropdowFallback","computedAriaLabel","ariaLabelAttribute","ariaLabel","toRefs","useAriaLabel","getSlotText","computedAriaDescribedBy","inputFieldConditionalClasses","inputFieldDropdownProps","onInput","event","inputValue","onDropdownInput","selectedValue","focusInput","__expose","printDevelopmentWarning","deprecate"],"mappings":";;;;;;;;;;;;AAMY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,UAAA,WACAA,EAAA,iBAAA,kBACAA,EAAA,eAAA,gBACAA,EAAA,WAAA,YAJQA,IAAAD,KAAA,CAAA,CAAA,GAUAE,IAAA,kBAAAC,OACRA,EAAA,QAAA,SACAA,EAAA,MAAA,OAFQA,IAAAD,KAAA,CAAA,CAAA,GAKAE,IAAA,kBAAAC,OACRA,EAAA,YAAA,aACAA,EAAA,WAAA,YACAA,EAAA,WAAA,YACAA,EAAA,QAAA,SAJQA,IAAAD,KAAA,CAAA,CAAA,GAUAE,IAAA,kBAAAC,OACRA,EAAA,SAAA,UACAA,EAAA,OAAA,QACAA,EAAA,SAAA,UAHQA,IAAAD,KAAA,CAAA,CAAA,GAqBAE,KAAA,kBAAAC,OACRA,EAAA,QAAA,SACAA,EAAA,iBAAA,kBACAA,EAAA,kBAAA,mBACAA,EAAA,iBAAA,kBACAA,EAAA,QAAA,SACAA,EAAA,SAAA,UACAA,EAAA,OAAA,QACAA,EAAA,UAAA,WARQA,IAAAD,MAAA,CAAA,CAAA;;;;;;0TCkeRE,KAAA;AAAA,EAAe,MAAA,EAAA,UAAAC,EAAA;AAEf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA7VA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MACG,GAAAvC,EAAA;AAAA,IACtC,EAAA,GAGbiD,KAAA,CAAAC,MAAA;AACI,YAAAC,IAAAD,EAAA,OAAA;AACA,MAAA,CAAAlD,EAAA,YAAA,CAAAwB,EAAA,SACItB,EAAA,SAAAiD,CAAA;AAAA,IACJ,GAGJC,IAAA,CAAAC,MAAA;AACI,MAAAnD,EAAA,kBAAAmD,CAAA,GACAnD,EAAA,mBAAA,EAAA,GAAAF,KAAA,gBAAAA,EAAA,UAAA,OAAAqD,EAAA,CAAA;AAAA,IAAoE,GAGxEC,IAAA,MAAA;AACI,MAAA9C,EAAA,MAAA,MAAA;AAAA,IAA8B;AAIlC,WAAA+C,EAAA;AAAA,MAAa,YAAAD;AAAA,IACT,CAAA,GAGJ,OAAA,OAAAhE,CAAA,EAAA,SAAAU,EAAA,IAAA,KACIwD,GAAA,0DAAAxD,EAAA,IAAA,EAAA,GAMJA,EAAA,SACIyD;AAAA,MAAA;AAAA,MACI;AAAA;AAAA;AAAA,MACA;AAAA,IAGA,GAIRnD,EAAA,mBAAA,KACImD;AAAA,MAAA;AAAA,MACI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MACA;AAAA,IAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"input-field.Bk2p3kIb.js","sources":["../../../vue2/src/components/input-field/input-field.types.ts","../../../vue2/src/components/input-field/input-field.vue"],"sourcesContent":["import { BentoDropdown } from '@/components/dropdown/';\nimport type { HTMLAttributes } from 'vue/types/jsx';\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoInputFieldVariant {\n DEFAULT = 'default',\n PAYMENT_METHOD = 'payment-method',\n STATIC_VALUE = 'static-value',\n DROPDOWN = 'dropdown',\n}\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoInputFieldElementPosition {\n START = 'start',\n END = 'end',\n}\n\nexport enum BentoInputFieldStateClass {\n CONDENSED = 'condensed',\n DISABLED = 'disabled',\n READONLY = 'readonly',\n ERROR = 'error',\n}\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoInputFieldType {\n SEARCH = 'search',\n TEXT = 'text',\n NUMBER = 'number',\n}\n\nexport type BentoInputFieldValue = string | number;\n\ntype DropdownProps = InstanceType<typeof BentoDropdown>['$props'];\nexport type BentoInputDropdownProps = {\n items: DropdownProps['items'];\n value: DropdownProps['value'];\n dynamicFiltering?: DropdownProps['dynamicFiltering'];\n 'aria-label'?: HTMLAttributes['aria-label'];\n};\n\n/**\n * @deprecated The use of these enums is no longer supported.\n * Use `v-on:` or `@` to listen to the events being emitted.\n * This enum will be removed in 2.0.\n */\nexport enum BentoInputFieldEvent {\n INPUT = 'input',\n ESCAPE_PRESSED = 'escape-pressed',\n UPDATE_DROPDOWN = 'update:dropdown',\n DROPDOWN_INPUT = 'dropdown-input',\n FOCUS = 'focus',\n CHANGE = 'change',\n BLUR = 'blur',\n KEYDOWN = 'keydown',\n}\n","<template>\n <bento-typography\n class=\"b-input-field\"\n data-testid=\"input-text-container\"\n :class=\"inputFieldConditionalClasses\"\n el=\"div\"\n variant=\"body\"\n >\n <field-label\n v-if=\"hasSlot('default')\"\n :for=\"inputFieldId\"\n data-testid=\"input-field-label\"\n :tooltip-text=\"tooltipText\"\n :optional=\"optional\"\n :required=\"required\"\n @click=\"focusInput\"\n >\n <slot></slot>\n </field-label>\n\n <div class=\"b-input-field__input-box\" data-testid=\"input-box\" :aria-disabled=\"disabled\" @click=\"focusInput\">\n <!-- Optional Icon for Default text variant -->\n <span\n v-if=\"isDefaultVariant && (hasSlot('defaultIconBefore') || hasSlot('iconBefore'))\"\n :aria-hidden=\"ariaHidden ? 'true' : undefined\"\n class=\"b-input-field__icon-before\"\n >\n <slot v-if=\"hasSlot('iconBefore')\" name=\"iconBefore\" />\n <slot v-if=\"hasSlot('defaultIconBefore') && !hasSlot('iconBefore')\" name=\"defaultIconBefore\" />\n </span>\n\n <!-- Mandatory Icon for Payment Method variant -->\n <span\n v-if=\"isPaymentMethodVariant && hasSlot('paymentMethod')\"\n :aria-hidden=\"ariaHidden ? 'true' : undefined\"\n class=\"b-input-field__payment-method\"\n >\n <slot name=\"paymentMethod\" />\n </span>\n\n <!-- Dropdown at start -->\n <div\n v-if=\"shouldDisplayDropdownAtStart\"\n :id=\"dropdownId\"\n class=\"b-input-field__dropdown b-input-field__dropdown--start\"\n @click.stop\n >\n <bento-dropdown\n v-if=\"dropdown\"\n v-bind=\"inputFieldDropdownProps\"\n :disabled=\"disabled\"\n :readonly=\"isReadOnly\"\n @input=\"onDropdownInput\"\n />\n </div>\n\n <!-- Static Value at start -->\n <bento-typography\n v-if=\"shouldDisplayStaticValueAtStart\"\n :id=\"staticValueId\"\n class=\"b-input-field__static-value b-input-field__static-value--start\"\n el=\"span\"\n variant=\"body\"\n >\n <slot name=\"staticValue\" />\n </bento-typography>\n <div class=\"b-input-field__input-container\">\n <input\n :id=\"inputFieldId\"\n v-bind=\"attrs\"\n ref=\"inputFieldElement\"\n class=\"b-input-field__input\"\n :aria-label=\"computedAriaLabel\"\n :aria-describedby=\"computedAriaDescribedBy\"\n :aria-owns=\"computedAriaOwns\"\n :aria-invalid=\"shouldShowError\"\n :placeholder=\"placeholder\"\n :type=\"type\"\n :value=\"value\"\n :disabled=\"disabled\"\n :readonly=\"isReadOnly\"\n @input=\"onInput\"\n @change=\"emit('change')\"\n @focus=\"onFocus\"\n @blur=\"onBlur\"\n @keydown=\"emit('keydown', $event)\"\n @keydown.esc=\"emit('escape-pressed')\"\n />\n\n <!-- Hint at the end -->\n <bento-typography v-if=\"hint && isFocused && value\" el=\"span\" class=\"b-input-field__hint\">\n {{ hint }}\n </bento-typography>\n </div>\n\n <span\n v-if=\"hasSlot('iconAfter')\"\n :aria-hidden=\"ariaHidden ? 'true' : undefined\"\n class=\"b-input-field__icon-after\"\n data-testid=\"input-text__icon-after\"\n >\n <slot name=\"iconAfter\" />\n </span>\n\n <!-- Static Value at the end -->\n <bento-typography\n v-if=\"shouldDisplayStaticValueAtEnd\"\n :id=\"staticValueId\"\n class=\"b-input-field__static-value b-input-field__static-value--end\"\n el=\"span\"\n variant=\"body\"\n >\n <slot name=\"staticValue\" />\n </bento-typography>\n\n <!-- Dropdown at end -->\n <div\n v-if=\"shouldDisplayDropdownAtEnd\"\n :id=\"dropdownId\"\n data-testid=\"input-field-dropdown-container-end\"\n class=\"b-input-field__dropdown b-input-field__dropdown--end\"\n @click.stop\n >\n <bento-dropdown\n v-if=\"dropdown\"\n :id=\"dropdownId\"\n v-bind=\"inputFieldDropdownProps\"\n :disabled=\"disabled\"\n :readonly=\"isReadOnly\"\n @input=\"onDropdownInput\"\n />\n </div>\n </div>\n\n <error-message\n v-if=\"shouldShowError && !!errorMessage\"\n :id=\"errorId\"\n :error-message=\"errorMessage\"\n class=\"b-input-field__error-message\"\n />\n\n <span v-if=\"hasSlot('description')\" :id=\"descriptionId\" class=\"b-input-field__description\" @click=\"focusInput\">\n <bento-typography el=\"span\" variant=\"body\">\n <slot id=\"description\" name=\"description\" />\n </bento-typography>\n </span>\n </bento-typography>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, inject, PropType, provide, Ref, ref, toRef, toRefs, useAttrs, useSlots } from 'vue';\n\n // Components\n import { BentoDropdown } from '@/components/dropdown';\n import { BentoTypography } from '@/components/typography';\n import { ErrorMessage, FieldLabel } from '@/internal';\n\n // Utils\n import { deprecate } from '@/utils/ts/deprecate';\n import { generateUid } from '@/core/utils/ts';\n import { getSlotText } from '@/utils/ts/get-slot-text';\n import { useAriaLabel } from '@/utils/ts/aria-label';\n import { useI18n } from '@/utils/ts/i18n';\n import { printDevelopmentWarning } from '@/utils/ts/print-development-warning';\n import {\n INPUT_FIELD_COMPONENT_INJECTION_KEY,\n INPUT_FIELD_HINT_INJECTION_KEY,\n } from '@/components/input-field/input-field.keys';\n\n // Composables\n import { useFormLayoutFieldLoading, useHasSlot } from '@/composables';\n\n // Types\n import {\n BentoInputDropdownProps,\n BentoInputFieldElementPosition,\n BentoInputFieldStateClass,\n BentoInputFieldType,\n BentoInputFieldValue,\n BentoInputFieldVariant,\n } from './input-field.types';\n import { BentoListboxSelectedValue } from '@/types';\n\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const attrs = useAttrs();\n const slots = useSlots();\n\n const props = defineProps({\n /**\n * Indicates whether the element is exposed to an accessibility API.\n */\n ariaHidden: { type: Boolean, default: true },\n\n /**\n * @deprecated from version 2.0.0. Use the aria-label attribute instead.\n */\n /**\n * Text that labels an the input element\n */\n ariaLabel: { type: String, default: undefined },\n\n /**\n * Reduces height of the input\n */\n condensed: { type: Boolean, default: false },\n\n /**\n * Disables the possibility of changing value in the input-field\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Dropdown props for the small selectable dropdown menu.\n * Properties supported:\n *\n * - `value`: Selected value of the dropdown\n * - `items`: List of available items\n * - `aria-label`: Text that labels the dropdown element\n *\n */\n dropdown: {\n type: Object as PropType<BentoInputDropdownProps>,\n default: undefined,\n },\n\n /**\n * Position of the dropdown before or after input value\n */\n dropdownPosition: {\n type: String as PropType<BentoInputFieldElementPosition | `${BentoInputFieldElementPosition}`>,\n default: BentoInputFieldElementPosition.START,\n validator: (value: BentoInputFieldElementPosition) =>\n Object.values(BentoInputFieldElementPosition).includes(value),\n },\n\n /**\n * Adds error validation class for outlining input-field.\n *\n * @deprecated Use \"errorMessage\" prop instead\n */\n error: { type: Boolean, default: false },\n\n /**\n * Renders input-field with an error state and the error message beneath the input box\n */\n errorMessage: { type: String, default: null },\n\n /**\n * Highlights the dropdown is optional.\n */\n optional: { type: Boolean, default: false },\n\n /**\n * Text displayed as the placeholder of the input-field\n */\n placeholder: { type: String, default: '' },\n\n /**\n * Highlights the dropdown is required.\n */\n required: { type: Boolean, default: false },\n\n /**\n * Setting this property to true will set the input field to read only state.\n */\n readonly: { type: Boolean, default: false },\n\n /**\n * Static text that displayed before or after input value\n * Applicable to the Static Value variant\n */\n staticValue: { type: String, default: '' },\n\n /**\n * Position of Static Value before or after input value\n */\n staticValuePosition: {\n type: String as PropType<BentoInputFieldElementPosition | `${BentoInputFieldElementPosition}`>,\n default: BentoInputFieldElementPosition.START,\n validator: (value: BentoInputFieldElementPosition) =>\n Object.values(BentoInputFieldElementPosition).includes(value),\n },\n\n /**\n * Adds a info icon next to the label to display the passed tooltip message.\n */\n tooltipText: { type: String, default: null },\n\n /**\n * A string specifying the type of control to render.\n * All `input` types are available but only `search`, `text` and `number` are fully supported.\n *\n * If `type` is `search`, use `bento-search-bar` instead.\n */\n type: {\n type: String as PropType<BentoInputFieldType | `${BentoInputFieldType}` | HTMLInputElement['type']>,\n default: BentoInputFieldType.TEXT,\n },\n\n /**\n * Text displayed as the value of the input-field\n */\n value: { type: [String, Number] as PropType<BentoInputFieldValue>, default: undefined },\n\n /**\n * Describes the different variants for the input element\n */\n variant: {\n type: String as PropType<BentoInputFieldVariant | `${BentoInputFieldVariant}`>,\n default: BentoInputFieldVariant.DEFAULT,\n validator: (value: BentoInputFieldVariant) => Object.values(BentoInputFieldVariant).includes(value),\n },\n });\n\n const emit = defineEmits<{\n /**\n * Emitted when the Input Field's internal dropdown changes it's value. Contains every dropdown prop passed with the updated selected value as 'value'\n */\n (e: 'update:dropdown', updatedDropdownProps: BentoInputDropdownProps): void;\n\n /**\n * Emitted when the element has lost focus\n */\n (e: 'blur'): void;\n\n /**\n * Emitted when the user modifies the element's value. Unlike the 'input' event, the change event is not necessarily fired for each alteration to an element's value\n */\n (e: 'change'): void;\n\n /**\n * Emitted when the Input Field's internal dropdown changes it's value\n */\n (e: 'dropdown-input', selectedValue: BentoListboxSelectedValue): void;\n\n /**\n * Emitted when the \"ESC\" key is pressed\n */\n (e: 'escape-pressed'): void;\n\n /**\n * Emitted when the element has received focus\n */\n (e: 'focus'): void;\n\n /**\n * Emitted when a key is pressed\n */\n (e: 'keydown', event: KeyboardEvent): void;\n\n /**\n * Emitted when the component's model changes\n */\n (e: 'input', inputValue: string): void;\n }>();\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const hasSlot = useHasSlot(slots);\n const inputFieldElement = ref(null);\n const inputFieldId = generateUid('input');\n const dropdownId = generateUid('input-dropdown');\n const staticValueId = generateUid('input-static-value');\n const descriptionId = generateUid('input-description');\n const errorId = generateUid('input-error');\n const isFocused = ref(false);\n\n // Provide INPUT_FIELD_COMPONENT_INJECTION_KEY as true, to set the input only dropdown size variant in the BentoDropdown comp\n provide(INPUT_FIELD_COMPONENT_INJECTION_KEY, true);\n // Renders the input with a hint if a string is provided\n const hint = inject<Ref<string | undefined>>(INPUT_FIELD_HINT_INJECTION_KEY, ref(undefined));\n\n const onFocus = () => {\n isFocused.value = true;\n emit('focus');\n };\n\n const onBlur = () => {\n isFocused.value = false;\n emit('blur');\n };\n\n const { isReadOnly } = useFormLayoutFieldLoading(toRef(props, 'readonly'));\n\n const shouldShowStaticValue = computed(\n () => props.variant === BentoInputFieldVariant.STATIC_VALUE && !!slots.staticValue\n );\n\n const isDefaultVariant = computed(() => props.variant === BentoInputFieldVariant.DEFAULT);\n\n const isPaymentMethodVariant = computed(() => props.variant === BentoInputFieldVariant.PAYMENT_METHOD);\n\n const shouldDisplayStaticValueAtStart = computed(\n () => shouldShowStaticValue.value && props.staticValuePosition === BentoInputFieldElementPosition.START\n );\n const shouldDisplayStaticValueAtEnd = computed(\n () => shouldShowStaticValue.value && props.staticValuePosition === BentoInputFieldElementPosition.END\n );\n\n const shouldShowDropdown = computed(() => props.variant === BentoInputFieldVariant.DROPDOWN && !!props.dropdown);\n const shouldDisplayDropdownAtStart = computed(\n () => shouldShowDropdown.value && props.dropdownPosition === BentoInputFieldElementPosition.START\n );\n const shouldDisplayDropdownAtEnd = computed(\n () => shouldShowDropdown.value && props.dropdownPosition === BentoInputFieldElementPosition.END\n );\n\n const shouldShowError = computed(\n () => !props.disabled && !isReadOnly.value && (!!props.errorMessage || props.error)\n );\n\n const computedAriaOwns = computed(() => {\n if (shouldShowDropdown.value === true && shouldShowStaticValue.value === true) {\n return `${staticValueId} ${dropdownId}`;\n }\n if (shouldShowDropdown.value === true) {\n return `${dropdownId}`;\n }\n if (shouldShowStaticValue.value === true) {\n return `${staticValueId}`;\n }\n return null;\n });\n\n // vue-i18n issue with t() used in script - direct usage in template works\n // requires either createI18n({ legacy: false }) or to be wrapped in computed()\n const computedAriaLabelFallbackMessage = computed(() => t('ariaLabelFallback'));\n const computedAriaLabelDropdowFallback = computed(() =>\n t('ariaLabelDropdownFallback', { inputLabel: computedAriaLabel.value })\n );\n\n const ariaLabelAttribute = ref(attrs['aria-label']);\n const { ariaLabel } = toRefs(props);\n const computedAriaLabel = useAriaLabel({\n ariaLabel: ariaLabelAttribute.value as string,\n // TODO: take this line away when the aria-label props is removed\n label: ariaLabel,\n defaultFallback: hasSlot('default')\n ? (getSlotText(slots)('default') as string)\n : computedAriaLabelFallbackMessage,\n });\n\n const computedAriaDescribedBy = computed(\n () =>\n `${hasSlot('description') ? descriptionId : ''} ${\n shouldShowError.value && !!props.errorMessage ? errorId : ''\n }`\n );\n\n const inputFieldConditionalClasses = computed(() => ({\n [`b-input-field--${BentoInputFieldStateClass.CONDENSED}`]: props.condensed,\n [`b-input-field--${BentoInputFieldStateClass.DISABLED}`]: props.disabled,\n [`b-input-field--${BentoInputFieldStateClass.READONLY}`]: isReadOnly.value,\n [`b-input-field--${BentoInputFieldStateClass.ERROR}`]: shouldShowError.value,\n }));\n\n const inputFieldDropdownProps = computed(() => ({\n 'aria-label': computedAriaLabelDropdowFallback.value,\n ...props.dropdown,\n }));\n\n const onInput = (event: Event) => {\n const inputValue = (event.target as HTMLInputElement).value;\n if (!props.disabled && !isReadOnly.value) {\n emit('input', inputValue);\n }\n };\n\n const onDropdownInput = (selectedValue: BentoListboxSelectedValue) => {\n emit('dropdown-input', selectedValue);\n emit('update:dropdown', { ...props?.dropdown, value: selectedValue });\n };\n\n const focusInput = () => {\n inputFieldElement.value.focus();\n };\n\n // Expose method so that other components can focus on it in Vue3\n defineExpose({\n focusInput,\n });\n\n if (!Object.values(BentoInputFieldType).includes(props.type as BentoInputFieldType)) {\n printDevelopmentWarning(`\"bento-input-field\" dropdown does not support the type ${props.type}`);\n }\n\n /**\n * Deprecations\n */\n if (props.error) {\n deprecate(\n 'BentoInputField \"error\" property',\n `Use the BentoInputField \"errorMessage\" property instead to indicate that there is a modifier error.\n Having the field as \"undefined\" will hide/remove the error.\n <bento-dropdown errorMessage=\"Error message text\" />`,\n '2.0.0'\n );\n }\n\n if (hasSlot('defaultIconBefore')) {\n deprecate(\n 'BentoInputField \"defaultIconBefore\" slot',\n `Use the BentoInputField \"iconBefore\" slot instead to add an icon at the left side of the input field\n <bento-input-field>\n \\t<template #iconBefore>\n \\t\\t<my-icon-goes-here />\n \\t</template>\n </bento-input-field>`,\n '2.0.0'\n );\n }\n</script>\n\n<script lang=\"ts\">\n /**\n * Input field component is used to create interactive controls for web-based\n * forms in order to accept data from the user.\n *\n * @example\n * import { BentoInputField } from '@adyen/bento-vue2'\n *\n * const inputValue = ref('');\n *\n * export default {\n * components: { BentoInputField },\n * tempate: `\n * <bento-input-field\n * :value=\"inputValue\"\n * :input=\"newValue => inputValue.value = newValue\"\n * >\n * }\n */\n export default {\n i18n: { messages },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./input-field.scss\" />\n"],"names":["BentoInputFieldVariant","BentoInputFieldVariant2","BentoInputFieldElementPosition","BentoInputFieldElementPosition2","BentoInputFieldStateClass","BentoInputFieldStateClass2","BentoInputFieldType","BentoInputFieldType2","BentoInputFieldEvent","BentoInputFieldEvent2","__default__","messages","attrs","useAttrs","slots","useSlots","props","__props","emit","__emit","t","useI18n","hasSlot","useHasSlot","inputFieldElement","ref","inputFieldId","generateUid","dropdownId","staticValueId","descriptionId","errorId","isFocused","provide","INPUT_FIELD_COMPONENT_INJECTION_KEY","hint","inject","INPUT_FIELD_HINT_INJECTION_KEY","onFocus","onBlur","isReadOnly","useFormLayoutFieldLoading","toRef","shouldShowStaticValue","computed","isDefaultVariant","isPaymentMethodVariant","shouldDisplayStaticValueAtStart","shouldDisplayStaticValueAtEnd","shouldShowDropdown","shouldDisplayDropdownAtStart","shouldDisplayDropdownAtEnd","shouldShowError","computedAriaOwns","computedAriaLabelFallbackMessage","computedAriaLabelDropdowFallback","computedAriaLabel","ariaLabelAttribute","ariaLabel","toRefs","useAriaLabel","getSlotText","computedAriaDescribedBy","inputFieldConditionalClasses","inputFieldDropdownProps","onInput","event","inputValue","onDropdownInput","selectedValue","focusInput","__expose","printDevelopmentWarning","deprecate"],"mappings":";;;;;;;;;;;;AAMY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,UAAA,WACAA,EAAA,iBAAA,kBACAA,EAAA,eAAA,gBACAA,EAAA,WAAA,YAJQA,IAAAD,KAAA,CAAA,CAAA,GAUAE,IAAA,kBAAAC,OACRA,EAAA,QAAA,SACAA,EAAA,MAAA,OAFQA,IAAAD,KAAA,CAAA,CAAA,GAKAE,IAAA,kBAAAC,OACRA,EAAA,YAAA,aACAA,EAAA,WAAA,YACAA,EAAA,WAAA,YACAA,EAAA,QAAA,SAJQA,IAAAD,KAAA,CAAA,CAAA,GAUAE,IAAA,kBAAAC,OACRA,EAAA,SAAA,UACAA,EAAA,OAAA,QACAA,EAAA,SAAA,UAHQA,IAAAD,KAAA,CAAA,CAAA,GAqBAE,KAAA,kBAAAC,OACRA,EAAA,QAAA,SACAA,EAAA,iBAAA,kBACAA,EAAA,kBAAA,mBACAA,EAAA,iBAAA,kBACAA,EAAA,QAAA,SACAA,EAAA,SAAA,UACAA,EAAA,OAAA,QACAA,EAAA,UAAA,WARQA,IAAAD,MAAA,CAAA,CAAA;;;;;;0T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A;AAAA,MACD,CAAA,kBAAAZ,EAAA,QAAA,EAAA,GAAAoC,EAAA;AAAA,MACK,CAAA,kBAAApC,EAAA,KAAA,EAAA,GAAAgD,EAAA;AAAA,IACE,EAAA,GAG3EY,IAAApB,EAAA,OAAA;AAAA,MAAgD,cAAAW,GAAA;AAAA,MACG,GAAAvC,EAAA;AAAA,IACtC,EAAA,GAGbiD,KAAA,CAAAC,MAAA;AACI,YAAAC,IAAAD,EAAA,OAAA;AACA,MAAA,CAAAlD,EAAA,YAAA,CAAAwB,EAAA,SACItB,EAAA,SAAAiD,CAAA;AAAA,IACJ,GAGJC,IAAA,CAAAC,MAAA;AACI,MAAAnD,EAAA,kBAAAmD,CAAA,GACAnD,EAAA,mBAAA,EAAA,GAAAF,KAAA,gBAAAA,EAAA,UAAA,OAAAqD,EAAA,CAAA;AAAA,IAAoE,GAGxEC,IAAA,MAAA;AACI,MAAA9C,EAAA,MAAA,MAAA;AAAA,IAA8B;AAIlC,WAAA+C,EAAA;AAAA,MAAa,YAAAD;AAAA,IACT,CAAA,GAGJ,OAAA,OAAAhE,CAAA,EAAA,SAAAU,EAAA,IAAA,KACIwD,GAAA,0DAAAxD,EAAA,IAAA,EAAA,GAMJA,EAAA,SACIyD;AAAA,MAAA;AAAA,MACI;AAAA;AAAA;AAAA,MACA;AAAA,IAGA,GAIRnD,EAAA,mBAAA,KACImD;AAAA,MAAA;AAAA,MACI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MACA;AAAA,IAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { defineComponent as $, provide as T, toRef as g, computed as l, openBlock as d, createBlock as E, resolveDynamicComponent as x, unref as u, normalizeClass as c, withCtx as z, renderSlot as m, useSlots as N, inject as O, ref as i, watch as M, nextTick as V, onMounted as j, createElementBlock as k, createElementVNode as L, createCommentVNode as P } from "vue";
|
|
2
|
+
import { _ as B } from "./_plugin-vue_export-helper.CHgC5LLL.js";
|
|
3
|
+
import { B as W } from "./typography.DNzU41ah.js";
|
|
4
|
+
import { u as Y } from "./use-has-slot.B7eQSabc.js";
|
|
5
|
+
import { c as A } from "./index.ChdIlujs.js";
|
|
6
|
+
import "../assets/layout-row.css";
|
|
7
|
+
const I = Symbol("Layout size inject key"), D = {}, F = /* @__PURE__ */ $({
|
|
8
|
+
...D,
|
|
9
|
+
__name: "layout",
|
|
10
|
+
props: {
|
|
11
|
+
variant: { default: "page" },
|
|
12
|
+
size: { default: "full-width" }
|
|
13
|
+
},
|
|
14
|
+
setup(f) {
|
|
15
|
+
const o = f;
|
|
16
|
+
T(I, g(o, "size"));
|
|
17
|
+
const p = l(() => ({
|
|
18
|
+
"b-layout--component": o.variant === "component"
|
|
19
|
+
})), e = o.variant === "page" ? "main" : "div";
|
|
20
|
+
return (a, s) => (d(), E(x(u(e)), {
|
|
21
|
+
class: c(["b-layout", p.value])
|
|
22
|
+
}, {
|
|
23
|
+
default: z(() => [
|
|
24
|
+
m(a.$slots, "default", {}, void 0, !0)
|
|
25
|
+
]),
|
|
26
|
+
_: 3
|
|
27
|
+
}, 8, ["class"]));
|
|
28
|
+
}
|
|
29
|
+
}), oo = /* @__PURE__ */ B(F, [["__scopeId", "data-v-4426e4ab"]]), H = ["3-9", "9-3", "4-8", "8-4", "6-6"], J = { key: 0 }, K = {}, Q = /* @__PURE__ */ $({
|
|
30
|
+
...K,
|
|
31
|
+
__name: "layout-row",
|
|
32
|
+
props: {
|
|
33
|
+
columnsLayout: { default: "6-6" }
|
|
34
|
+
},
|
|
35
|
+
setup(f) {
|
|
36
|
+
const o = f, p = N(), e = Y(p), a = O(I, i("full-width")), s = i(null), _ = i(null), y = i(null), v = l(() => a.value === "full-width"), w = l(() => H.includes(o.columnsLayout)), R = l(() => `b-layout-row--${a.value}`), S = l(() => ({
|
|
37
|
+
"b-layout-row__column-wrapper": v.value
|
|
38
|
+
})), h = l(() => {
|
|
39
|
+
const t = w.value ? o.columnsLayout.split("-") : [6, 6], n = (r) => v.value ? t[r] : a.value;
|
|
40
|
+
return {
|
|
41
|
+
col1: `b-layout-row__column--${n(0)}`,
|
|
42
|
+
col2: `b-layout-row__column--${n(1)}`
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
return M(
|
|
46
|
+
A("(min-width: 768px)"),
|
|
47
|
+
async (t) => {
|
|
48
|
+
var r, C, b;
|
|
49
|
+
await V();
|
|
50
|
+
const n = ((r = s.value) == null ? void 0 : r.firstChild) === _.value;
|
|
51
|
+
t && !n ? (C = s.value) == null || C.prepend(_.value) : !t && (o.columnsLayout === "3-9" || o.columnsLayout === "4-8") && ((b = s.value) == null || b.prepend(y.value));
|
|
52
|
+
},
|
|
53
|
+
{ immediate: !0 }
|
|
54
|
+
), j(() => {
|
|
55
|
+
if (!v.value && (e("col-1") || e("col-2")))
|
|
56
|
+
throw new Error(
|
|
57
|
+
"Column slots can only be used with the `full-width` size. Please check documentation for more info."
|
|
58
|
+
);
|
|
59
|
+
if (!w.value)
|
|
60
|
+
throw new Error(
|
|
61
|
+
`${o.columnsLayout} is not a valid column layout. Please refer to the documentation for the list of available column layouts.`
|
|
62
|
+
);
|
|
63
|
+
}), (t, n) => (d(), E(u(W), {
|
|
64
|
+
el: "div",
|
|
65
|
+
"rich-text": "",
|
|
66
|
+
class: c(["b-layout-row", R.value])
|
|
67
|
+
}, {
|
|
68
|
+
default: z(() => [
|
|
69
|
+
u(e)("default") ? (d(), k("div", J, [
|
|
70
|
+
m(t.$slots, "default", {}, void 0, !0)
|
|
71
|
+
])) : u(e)("col-1") && u(e)("col-2") ? (d(), k("div", {
|
|
72
|
+
key: 1,
|
|
73
|
+
ref_key: "row",
|
|
74
|
+
ref: s,
|
|
75
|
+
class: c(S.value)
|
|
76
|
+
}, [
|
|
77
|
+
L("div", {
|
|
78
|
+
ref_key: "col1",
|
|
79
|
+
ref: _,
|
|
80
|
+
class: c(h.value.col1)
|
|
81
|
+
}, [
|
|
82
|
+
m(t.$slots, "col-1", {}, void 0, !0)
|
|
83
|
+
], 2),
|
|
84
|
+
L("div", {
|
|
85
|
+
ref_key: "col2",
|
|
86
|
+
ref: y,
|
|
87
|
+
class: c(h.value.col2)
|
|
88
|
+
}, [
|
|
89
|
+
m(t.$slots, "col-2", {}, void 0, !0)
|
|
90
|
+
], 2)
|
|
91
|
+
], 2)) : P("", !0)
|
|
92
|
+
]),
|
|
93
|
+
_: 3
|
|
94
|
+
}, 8, ["class"]));
|
|
95
|
+
}
|
|
96
|
+
}), to = /* @__PURE__ */ B(Q, [["__scopeId", "data-v-5c7301bb"]]);
|
|
97
|
+
export {
|
|
98
|
+
to as a,
|
|
99
|
+
oo as l
|
|
100
|
+
};
|
|
101
|
+
//# sourceMappingURL=layout-row.rzhGrBQ3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout-row.rzhGrBQ3.js","sources":["../../../vue2/src/components/layout/layout.keys.ts","../../../vue2/src/components/layout/layout.vue","../../../vue2/src/components/layout/layout.types.ts","../../../vue2/src/components/layout/components/layout-row/layout-row.vue"],"sourcesContent":["export const LAYOUT_SIZE_INJECTION_KEY = Symbol('Layout size inject key');\n","<template>\n <component :is=\"wrapperElement\" class=\"b-layout\" :class=\"conditionalClasses\">\n <slot />\n </component>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, provide, toRef } from 'vue';\n import { BentoLayoutProps } from './layout.types';\n import { LAYOUT_SIZE_INJECTION_KEY } from '@/components/layout/layout.keys';\n\n const props = withDefaults(defineProps<BentoLayoutProps>(), {\n size: 'full-width',\n variant: 'page',\n });\n\n provide(LAYOUT_SIZE_INJECTION_KEY, toRef(props, 'size'));\n\n const conditionalClasses = computed(() => ({\n 'b-layout--component': props.variant === 'component',\n }));\n\n const wrapperElement = props.variant === 'page' ? 'main' : 'div';\n</script>\n\n<script lang=\"ts\">\n /**\n * Layout is a basic scaffolding of a page that defines spacing, some functionality and responsive behaviour of its top level sections.\n *\n * @example\n * import { BentoLayout, BentoLayoutRow } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoLayout, BentoLayoutRow },\n * template: `\n * <bento-layout size=\"narrow\">\n * <bento-layout-row>\n * Row 1\n * </bento-layout-row>\n * <bento-layout-row>\n * Row 2\n * </bento-layout-row>\n * </bento-layout>\n * `\n * }\n */\n export default {};\n</script>\n\n<style lang=\"scss\" scoped src=\"./layout.scss\" />\n","/**\n * @private\n */\nexport const BentoLayoutVariantOptions = ['page', 'component'] as const;\nexport const BentoLayoutSizeOptions = ['full-width', 'narrow', 'half-width'] as const;\nexport const BentoLayoutRowColumnLayoutOptions = ['3-9', '9-3', '4-8', '8-4', '6-6'] as const;\n\n// Public\nexport type BentoLayoutVariant = (typeof BentoLayoutVariantOptions)[number];\nexport type BentoLayoutSize = (typeof BentoLayoutSizeOptions)[number];\nexport type BentoLayoutRowColumnLayout = (typeof BentoLayoutRowColumnLayoutOptions)[number];\n\nexport interface BentoLayoutProps {\n /** Defines if the layout is used in a page or only a section */\n variant?: BentoLayoutVariant;\n /** Defines the size of the page */\n size?: BentoLayoutSize;\n}\n\nexport interface BentoLayoutRowProps {\n /** Sets the layout of the columns when multiple columns are used */\n columnsLayout?: BentoLayoutRowColumnLayout;\n}\n","<template>\n <bento-typography el=\"div\" rich-text class=\"b-layout-row\" :class=\"conditionalRowClass\">\n <div v-if=\"hasSlot('default')\">\n <slot />\n </div>\n <div v-else-if=\"hasSlot('col-1') && hasSlot('col-2')\" ref=\"row\" :class=\"conditionalRowWithColumnsClass\">\n <div ref=\"col1\" :class=\"conditionalColumnClass.col1\">\n <slot name=\"col-1\"></slot>\n </div>\n <div ref=\"col2\" :class=\"conditionalColumnClass.col2\">\n <slot name=\"col-2\"></slot>\n </div>\n </div>\n </bento-typography>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, inject, nextTick, onMounted, ref, Ref, useSlots, watch } from 'vue';\n import { BentoTypography } from '@/components/typography';\n import { useHasSlot } from '@/composables';\n import {\n BentoLayoutRowColumnLayoutOptions,\n type BentoLayoutRowProps,\n type BentoLayoutSize,\n } from '../../layout.types';\n import { useMediaQuery } from '@vueuse/core';\n\n import { LAYOUT_SIZE_INJECTION_KEY } from '@/components/layout/layout.keys';\n\n const props = withDefaults(defineProps<BentoLayoutRowProps>(), {\n columnsLayout: '6-6',\n });\n\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n const size = inject<Ref<BentoLayoutSize>>(LAYOUT_SIZE_INJECTION_KEY, ref('full-width'));\n\n const row = ref<HTMLElement>(null);\n const col1 = ref<HTMLElement>(null);\n const col2 = ref<HTMLElement>(null);\n\n const isFullWidth = computed(() => size.value === 'full-width');\n const isValidColumnLayout = computed(() => BentoLayoutRowColumnLayoutOptions.includes(props.columnsLayout));\n\n const conditionalRowClass = computed(() => `b-layout-row--${size.value}`);\n\n const conditionalRowWithColumnsClass = computed(() => ({\n 'b-layout-row__column-wrapper': isFullWidth.value,\n }));\n\n const conditionalColumnClass = computed(() => {\n const columns = isValidColumnLayout.value ? props.columnsLayout.split('-') : [6, 6];\n const getColumnModifier = index => (isFullWidth.value ? columns[index] : size.value);\n\n return {\n col1: `b-layout-row__column--${getColumnModifier(0)}`,\n col2: `b-layout-row__column--${getColumnModifier(1)}`,\n };\n });\n\n watch(\n useMediaQuery('(min-width: 768px)'),\n async isLargeScreen => {\n await nextTick();\n const areColumnsInTheRightOrder = row.value?.firstChild === col1.value;\n if (isLargeScreen && !areColumnsInTheRightOrder) {\n row.value?.prepend(col1.value);\n } else if (!isLargeScreen && (props.columnsLayout === '3-9' || props.columnsLayout === '4-8')) {\n row.value?.prepend(col2.value);\n }\n },\n { immediate: true }\n );\n\n onMounted(() => {\n if (!isFullWidth.value && (hasSlot('col-1') || hasSlot('col-2'))) {\n throw new Error(\n 'Column slots can only be used with the `full-width` size. Please check documentation for more info.'\n );\n }\n\n if (!isValidColumnLayout.value) {\n throw new Error(\n `${props.columnsLayout} is not a valid column layout. Please refer to the documentation for the list of available column layouts.`\n );\n }\n });\n</script>\n\n<script lang=\"ts\">\n /**\n * Page row is subcomponent of Layout meant to be used to generate the row layout.\n *\n * @example\n * import { BentoLayout, BentoLayoutRow } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoLayout, BentoLayoutRow },\n * template: `\n * <bento-layout>\n * <bento-layout-row columns-layout=\"3-9\">\n * <template #col-1>Narrow 3-9</template>\n * <template #col-2>Wide 3-9</template>\n * </bento-layout-row>\n * <bento-layout-row>\n * <template #col-1>6-6</template>\n * <template #col-2>6-6</template>\n * </bento-layout-row>\n * </bento-layout>\n * `\n * }\n */\n export default {};\n</script>\n\n<style lang=\"scss\" scoped src=\"./layout-row.scss\" />\n"],"names":["LAYOUT_SIZE_INJECTION_KEY","__default__$1","props","__props","provide","toRef","conditionalClasses","computed","wrapperElement","BentoLayoutRowColumnLayoutOptions","__default__","slots","useSlots","hasSlot","useHasSlot","size","inject","ref","row","col1","col2","isFullWidth","isValidColumnLayout","conditionalRowClass","conditionalRowWithColumnsClass","conditionalColumnClass","columns","getColumnModifier","index","watch","useMediaQuery","isLargeScreen","nextTick","areColumnsInTheRightOrder","_a","_b","_c","onMounted"],"mappings":";;;;;;AAAa,MAAAA,IAAA,OAAA,wBAAA,GC8CTC,IAAA,CAAA;;;;;;;;AAnCA,UAAAC,IAAAC;AAKA,IAAAC,EAAAJ,GAAAK,EAAAH,GAAA,MAAA,CAAA;AAEA,UAAAI,IAAAC,EAAA,OAAA;AAAA,MAA2C,uBAAAL,EAAA,YAAA;AAAA,IACE,EAAA,GAG7CM,IAAAN,EAAA,YAAA,SAAA,SAAA;;;;;;;;;;mECjBGO,IAAA,CAAA,OAAA,OAAA,OAAA,OAAA,KAAA,mBC2GHC,IAAA,CAAA;;;;;;;AA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,cAAA,IAAA;AAAA,UAAU;AAAA,QACN;AAIR,UAAA,CAAAS,EAAA;AACI,cAAA,IAAA;AAAA,UAAU,GAAApB,EAAA,aAAA;AAAA,QACgB;AAAA,IAE9B,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as y, ref as R, computed as C, openBlock as i, createElementBlock as v, createVNode as p, unref as t, withCtx as d, createBlock as $, resolveDynamicComponent as F, mergeProps as L, createSlots as J, createTextVNode as O, toDisplayString as P, createCommentVNode as S, createElementVNode as c, useSlots as G, useAttrs as K, toRefs as q, normalizeClass as Q, renderSlot as X } from "vue";
|
|
2
2
|
import { B as w } from "./typography.DNzU41ah.js";
|
|
3
|
-
import { B as Z } from "./dropdown.
|
|
3
|
+
import { B as Z } from "./dropdown.CMKdLPHi.js";
|
|
4
4
|
import { g as M } from "./generate-uid.D-HFI38h.js";
|
|
5
5
|
import { u as B, g as D, a as V } from "./i18n.CPGoe9tN.js";
|
|
6
6
|
import { _ } from "./_plugin-vue_export-helper.CHgC5LLL.js";
|
|
@@ -466,4 +466,4 @@ const Le = /* @__PURE__ */ _(be, [["render", $e]]), x = {
|
|
|
466
466
|
export {
|
|
467
467
|
Je as B
|
|
468
468
|
};
|
|
469
|
-
//# sourceMappingURL=pagination.
|
|
469
|
+
//# sourceMappingURL=pagination.D_4FRHE9.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.B-OihXTg.js","sources":["../../../vue2/src/components/pagination/components/pagination-results-per-page/pagination-results-per-page.vue","../../../vue2/src/components/pagination/components/pagination-context/pagination-context.vue","../../../../node_modules/.pnpm/@adyen+ui-assets-icons-16@4.1.0_vue@2.7.16/node_modules/@adyen/ui-assets-icons-16/dist/vue/skip-left.vue","../../../../node_modules/.pnpm/@adyen+ui-assets-icons-16@4.1.0_vue@2.7.16/node_modules/@adyen/ui-assets-icons-16/dist/vue/skip-right.vue","../../../../node_modules/.pnpm/@adyen+ui-assets-icons-16@4.1.0_vue@2.7.16/node_modules/@adyen/ui-assets-icons-16/dist/vue/chevron-left-small.vue","../../../../node_modules/.pnpm/@adyen+ui-assets-icons-16@4.1.0_vue@2.7.16/node_modules/@adyen/ui-assets-icons-16/dist/vue/chevron-right-small.vue","../../../vue2/src/components/pagination/components/pagination-controls/pagination-controls.vue","../../../vue2/src/components/pagination/pagination.vue"],"sourcesContent":["<template>\n <div class=\"b-pagination-results-per-page\">\n <bento-typography el=\"div\">\n <component\n :is=\"i18nComponent\"\n v-bind=\"getI18nProps(translationPathKey)\"\n class=\"b-pagination-results-per-page__dropdown-container\"\n tag=\"div\"\n :plural=\"totalCount\"\n >\n <template #itemCount>\n <bento-dropdown\n :id=\"dropdownId\"\n :aria-label=\"t(translationPathKey, { itemCount: itemsPerPage, totalCount })\"\n class=\"b-pagination-results-per-page__dropdown\"\n condensed\n :items=\"dropdownOptions\"\n :value=\"itemsPerPage\"\n @input=\"onSelectChange\"\n />\n </template>\n <template v-if=\"!!totalCount\" #totalCount>{{ totalCount }}</template>\n </component>\n </bento-typography>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, ref } from 'vue';\n import { BentoTypography } from '@/components/typography';\n import { BentoDropdown } from '@/components/dropdown';\n import { generateUid } from '@/core/utils/ts';\n import { getI18nComponent, getI18nProps, useI18n } from '@/utils/ts/i18n';\n\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const PREDEFINED_RESULTS_PER_PAGE_VALUES = [\n { label: '10', value: 10 },\n { label: '20', value: 20 },\n { label: '50', value: 50 },\n { label: '75', value: 75 },\n { label: '100', value: 100 },\n ];\n\n const props = withDefaults(\n defineProps<{\n /**\n * The amount of items the pager is paging through.\n */\n itemsPerPage?: number;\n /**\n * The total number of items the pager is paging through.\n */\n totalCount?: number;\n }>(),\n {\n itemsPerPage: 50,\n totalCount: null,\n }\n );\n\n const emit = defineEmits<{\n (e: 'select', value: number);\n }>();\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const dropdownId = generateUid('b-pagination-context-number-elements');\n const dropdownOptions = ref(PREDEFINED_RESULTS_PER_PAGE_VALUES);\n const i18nComponent = getI18nComponent();\n\n const onSelectChange = (selectedNumberOfResults: number) => {\n emit('select', selectedNumberOfResults);\n };\n\n const translationPathKey = computed(() => (props.totalCount ? 'showingItemsWithTotal' : 'showingItems'));\n</script>\n\n<script lang=\"ts\">\n export default {\n i18n: { messages },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./pagination-results-per-page.scss\" />\n","<template>\n <div class=\"b-pagination-context\">\n <bento-typography v-if=\"totalPages > 1\" el=\"div\">\n <component :is=\"i18nComponent\" v-bind=\"getI18nProps('pageOfTotalPages')\" tag=\"div\">\n <template #page>\n <bento-dropdown\n :id=\"dropdownId\"\n :aria-label=\"t('pageOfTotalPages', { page, totalPages })\"\n class=\"b-pagination-context__dropdown\"\n condensed\n :items=\"listOfAvailablePages\"\n :value=\"page\"\n :virtual-scroll=\"virtualScroll\"\n @input=\"onPageSelectChange\"\n />\n </template>\n <template #totalPages>{{ totalPages }}</template>\n </component>\n </bento-typography>\n <bento-typography v-else-if=\"totalPages === 1\" el=\"span\">\n {{ t('pageOneOfOne') }}\n </bento-typography>\n <bento-typography v-else el=\"span\">\n {{ t('pageNumber', { page }) }}\n </bento-typography>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed } from 'vue';\n import { BentoTypography } from '@/components/typography';\n import { BentoDropdown } from '@/components/dropdown';\n import { BentoListboxOptionItem } from '@/types';\n import { generateUid } from '@/core/utils/ts';\n import messages from './messages.json';\n import { getI18nComponent, getI18nProps, useI18n } from '@/utils/ts/i18n';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const props = withDefaults(\n defineProps<{\n /**\n * The current page number of the pager.\n */\n page?: number;\n\n /**\n * The total number of items the pager is paging through.\n */\n totalPages?: number;\n\n /**\n * Enables virtual scrolling on all dropdowns if set to true.\n */\n virtualScroll?: boolean;\n }>(),\n {\n page: 1,\n totalPages: null,\n virtualScroll: false,\n }\n );\n const emit = defineEmits<{\n (e: 'page-selected', value: string | number);\n }>();\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const dropdownId = generateUid('bento-pagination-context-current-page');\n const onPageSelectChange = (selectedPage: string | number) => emit('page-selected', selectedPage);\n const i18nComponent = getI18nComponent();\n\n // Generate a list of pages from 1 to \"totalPages\"\n const transformIntoOption = (value: number): BentoListboxOptionItem => ({\n label: value.toString(),\n value,\n });\n const transformToPageNumber = (_, index) => index + 1;\n const listOfAvailablePages = computed(() =>\n Array.from(new Array(props.totalPages), transformToPageNumber).map(transformIntoOption)\n );\n</script>\n\n<script lang=\"ts\">\n export default {\n i18n: { messages },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./pagination-context.scss\" />\n","\n<template>\n <svg role=\"img\" v-bind=\"$attrs\" class=\"ui-assets-icons-16\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\"><title v-if=\"$attrs['svg-title']\">{{ $attrs['svg-title'] }}</title><path fill=\"#00112C\" d=\"M9.06055 8.00011L12.0605 5.00011L10.9999 3.93945L6.93923 8.00011L10.9999 12.0608L12.0605 11.0001L9.06055 8.00011Z\"/><path fill=\"#00112C\" d=\"M4.25 4.25L4.25 11.75H5.75L5.75 4.25L4.25 4.25Z\"/></svg>\n</template>\n<script>\n let uuid = 0;\n\n export default {\n beforeCreate() {\n this.uuid = uuid.toString();\n uuid += 1;\n },\n };\n</script>\n<style>\n @import '../css/main.css';\n</style>\n","\n<template>\n <svg role=\"img\" v-bind=\"$attrs\" class=\"ui-assets-icons-16\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\"><title v-if=\"$attrs['svg-title']\">{{ $attrs['svg-title'] }}</title><path fill=\"#00112C\" d=\"M6.93945 7.99962L3.93945 10.9996L5.00011 12.0603L9.06077 7.99963L5.00011 3.93896L3.93945 4.99963L6.93945 7.99962Z\"/><path fill=\"#00112C\" d=\"M11.75 11.7497V4.24974L10.25 4.24974V11.7497H11.75Z\"/></svg>\n</template>\n<script>\n let uuid = 0;\n\n export default {\n beforeCreate() {\n this.uuid = uuid.toString();\n uuid += 1;\n },\n };\n</script>\n<style>\n @import '../css/main.css';\n</style>\n","\n<template>\n <svg role=\"img\" v-bind=\"$attrs\" class=\"ui-assets-icons-16\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\"><title v-if=\"$attrs['svg-title']\">{{ $attrs['svg-title'] }}</title><path fill=\"#00112C\" d=\"M10.5608 5.00011L7.56077 8.00011L10.5608 11.0001L9.50011 12.0608L5.43945 8.00011L9.50011 3.93945L10.5608 5.00011Z\"/></svg>\n</template>\n<script>\n let uuid = 0;\n\n export default {\n beforeCreate() {\n this.uuid = uuid.toString();\n uuid += 1;\n },\n };\n</script>\n<style>\n @import '../css/main.css';\n</style>\n","\n<template>\n <svg role=\"img\" v-bind=\"$attrs\" class=\"ui-assets-icons-16\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\"><title v-if=\"$attrs['svg-title']\">{{ $attrs['svg-title'] }}</title><path fill=\"#00112C\" d=\"M5.43924 10.9999L8.43924 7.99989L5.43924 4.99989L6.4999 3.93923L10.5606 7.99989L6.4999 12.0605L5.43924 10.9999Z\"/></svg>\n</template>\n<script>\n let uuid = 0;\n\n export default {\n beforeCreate() {\n this.uuid = uuid.toString();\n uuid += 1;\n },\n };\n</script>\n<style>\n @import '../css/main.css';\n</style>\n","<template>\n <ul class=\"b-pagination-controls\">\n <li class=\"b-pagination-controls__item\">\n <!-- Navigate to the first page -->\n <bento-button :disabled=\"isCurrentPageFirst\" variant=\"tertiary\" condensed @click=\"navigate(1)\">\n <template #iconLeft>\n <skip-left :svg-title=\"t('navigateToTheFirstPage')\" />\n </template>\n </bento-button>\n </li>\n <li class=\"b-pagination-controls__item\">\n <!-- Navigate to the previous page -->\n <bento-button :disabled=\"isCurrentPageFirst\" variant=\"tertiary\" condensed @click=\"navigate(page - 1)\">\n <template #iconLeft>\n <chevron-left :svg-title=\"t('navigateToThePreviousPage')\" />\n </template>\n </bento-button>\n </li>\n <li class=\"b-pagination-controls__item\">\n <!-- Navigate to the next page -->\n <bento-button :disabled=\"isNextButtonDisabled\" variant=\"tertiary\" condensed @click=\"navigate(page + 1)\">\n <template #iconLeft>\n <chevron-right :svg-title=\"t('navigateToTheNextPage')\" />\n </template>\n </bento-button>\n </li>\n <li class=\"b-pagination-controls__item\">\n <!-- Navigate to the last page -->\n <bento-button\n :disabled=\"isLastPageButtonDisabled\"\n variant=\"tertiary\"\n condensed\n @click=\"navigate(totalPages)\"\n >\n <template #iconLeft>\n <skip-right :svg-title=\"t('navigateToTheLastPage')\" />\n </template>\n </bento-button>\n </li>\n </ul>\n</template>\n\n<script setup lang=\"ts\">\n import { computed } from 'vue';\n import { BentoButton } from '@/components/button';\n import { useI18n } from '@/utils/ts/i18n';\n import SkipLeft from '@adyen/ui-assets-icons-16/vue/skip-left';\n import SkipRight from '@adyen/ui-assets-icons-16/vue/skip-right';\n import ChevronLeft from '@adyen/ui-assets-icons-16/vue/chevron-left-small';\n import ChevronRight from '@adyen/ui-assets-icons-16/vue/chevron-right-small';\n\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const props = withDefaults(\n defineProps<{\n /**\n * Use to determine if the pager has a \"next page\".\n */\n hasNext?: boolean;\n\n /**\n * The current page number of the pager.\n */\n page: number;\n\n /**\n * The current page number of the pager.\n */\n totalPages?: number;\n }>(),\n {\n hasNext: null,\n totalPages: null,\n }\n );\n\n const emit = defineEmits<{\n (e: 'navigate', value: number);\n }>();\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const isCurrentPageFirst = computed(() => props.page === 1);\n const isCurrentPageLast = computed(() => props.page === props.totalPages);\n const isNextButtonDisabled = computed(() => {\n const hasNoNextPage = !props.hasNext;\n return hasNoNextPage || isCurrentPageLast.value;\n });\n const isLastPageButtonDisabled = computed(() => {\n const hasNoNextPage = !props.hasNext;\n const hasNoTotalPagesNumber = !props.totalPages;\n\n return hasNoNextPage || isCurrentPageLast.value || hasNoTotalPagesNumber;\n });\n\n const navigate = (pageArg: number) => {\n emit('navigate', pageArg);\n };\n</script>\n\n<script lang=\"ts\">\n export default {\n i18n: { messages },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./pagination-controls.scss\" />\n","<template>\n <div class=\"b-pagination\">\n <nav :aria-label=\"computedAriaLabel\" class=\"b-pagination__navigation\" :class=\"navigationConditionalClasses()\">\n <bento-pagination-results-per-page\n v-if=\"!hidePageSize\"\n class=\"b-pagination__results-per-page\"\n :items-per-page=\"size\"\n :total-count=\"totalCount\"\n @select=\"onItemsPerPageChange\"\n />\n <bento-typography v-else-if=\"hasSlot('default')\"><slot /></bento-typography>\n\n <div class=\"b-pagination__page-navigator\">\n <bento-pagination-context\n class=\"b-pagination__context\"\n :total-pages=\"totalPages\"\n :page=\"page\"\n :total-count=\"totalCount\"\n :virtual-scroll=\"virtualScroll\"\n @page-selected=\"onPageSelected\"\n />\n\n <div class=\"b-pagination__divider\"></div>\n\n <bento-pagination-controls\n class=\"b-pagination__controls\"\n :has-next=\"hasNext\"\n :page=\"page\"\n :total-pages=\"totalPages\"\n @navigate=\"navigate\"\n />\n </div>\n </nav>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, ref, toRefs, useAttrs, useSlots } from 'vue';\n import { BentoTypography } from '@/components/typography';\n import BentoPaginationResultsPerPage from './components/pagination-results-per-page/pagination-results-per-page.vue';\n import BentoPaginationContext from './components/pagination-context/pagination-context.vue';\n import BentoPaginationControls from './components/pagination-controls/pagination-controls.vue';\n import { useAriaLabel } from '@/utils/ts/aria-label';\n import { useHasSlot } from '@/composables';\n\n const props = withDefaults(\n defineProps<{\n /**\n * @deprecated from version 2.0.0. Use the aria-label attribute instead.\n */\n /**\n * A brief description of the purpose of the navigation (for a11y).\n * Omit the term \"navigation\", as the screen reader will read both the role and the contents of the label.\n */\n ariaLabel?: string;\n\n /**\n * Use to determine if the pager has a \"next page\".\n */\n hasNext?: boolean;\n\n /**\n * Toggles the visibility of the \"results per page\" part of the pagination component.\n */\n hidePageSize?: boolean;\n\n /**\n * The current page number of the pager.\n */\n page?: number;\n\n /**\n * The size of the items the pager is paging through.\n */\n size?: number;\n\n /**\n * The total number of items the pager is paging through.\n */\n totalCount?: number;\n\n /**\n * Enables virtual scrolling on all dropdowns if set to true.\n */\n virtualScroll?: boolean;\n }>(),\n {\n ariaLabel: null,\n hasNext: null,\n hidePageSize: false,\n page: 1,\n size: 20,\n totalCount: null,\n virtualScroll: false,\n }\n );\n\n const emit = defineEmits<{\n /**\n * Triggered when the navigation controls are clicked or the items per page is changed (i.e. when the arrow buttons to the\n * rightmost of the screen or either dropdown is updated). It indicates to which page it should go next and also the page size.\n */\n (e: 'navigate', page: number, items?: number): void;\n\n /**\n * Triggered when the number of items per page is changed from the left hand dropdown.\n * It indicates the new number of items that will be displayed.\n */\n (e: 'items-page', size: number): void;\n\n /**\n * Triggered when the navigation controls are clicked, whether the arrow buttons to the\n * right most of the screen or the dropdown on the right hand is updated.\n * It indicates to which page it should go next\n * (easily achieved using the [sync modifier](https://v2.vuejs.org/v2/guide/components-custom-events.html#sync-Modifier))\n * e.g. `:page.sync=\"currentPage\"`\n */\n (e: 'update:page', page: number): void;\n\n /**\n * Triggered when the number of items per page is changed from the left hand dropdown.\n * It indicates the new number of items that will be displayed.\n * (easily achieved using the [sync modifier](https://v2.vuejs.org/v2/guide/components-custom-events.html#sync-Modifier))\n * e.g. `:size.sync=\"itemsPerPage\"`\n */\n (e: 'update:size', size: number): void;\n }>();\n\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n\n const attrs = useAttrs();\n const ariaLabelAttribute = ref(attrs['aria-label']);\n const { ariaLabel } = toRefs(props);\n const computedAriaLabel = useAriaLabel({\n ariaLabel: ariaLabelAttribute.value as string,\n // TODO: take this line away when the aria-label props is removed\n label: ariaLabel,\n });\n\n const totalPages = computed(() =>\n !props.totalCount || !props.size ? null : Math.ceil(props.totalCount / props.size)\n );\n\n const navigate = (pageArg: number, itemsPerPage?: number) => {\n if (props.hidePageSize) {\n emit('navigate', pageArg);\n } else {\n emit('navigate', pageArg, itemsPerPage ?? props?.size);\n }\n emit('update:page', pageArg);\n };\n\n const onPageSelected = (pageNumber: number) => {\n navigate(pageNumber);\n };\n\n const onItemsPerPageChange = (elements: number) => {\n emit('items-page', elements);\n emit('update:size', elements);\n\n // Always go to first page when the\n // number of items page changes\n navigate(1, elements);\n };\n\n const navigationConditionalClasses = () => ({\n 'b-pagination__navigation--only-page-navigator': !hasSlot('default') && props.hidePageSize,\n });\n</script>\n\n<script lang=\"ts\">\n /**\n * Paginiation component to help users page through data sets.\n *\n * There are two ways of doing navigation in this component:\n * 1. (Basic) You tell the component if there is a next page (hasNext)\n * 2. (Enhanced) You tell the component:\n * - How many total items exist (totalCount)\n * - The max number of items that you show/fetch per page (size)\n * - In this case you should not set the hasNext props\n *\n * If you have the data available and opt to use the Enhanced way you get extra controls:\n * - Page dropdown selector\n * - Last page button\n * - \"Showing 10 of 200 items\" text\n *\n * @usage\n * import { BentoPagination } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoPagination },\n * template: `\n * <bento-pagination :has-next=\"isNextPage\" />\n * `,\n * }\n */\n\n export default {};\n</script>\n\n<style lang=\"scss\" scoped src=\"./pagination.scss\" />\n"],"names":["__default__$3","messages$2","PREDEFINED_RESULTS_PER_PAGE_VALUES","props","__props","emit","__emit","t","useI18n","dropdownId","generateUid","dropdownOptions","ref","i18nComponent","getI18nComponent","onSelectChange","selectedNumberOfResults","translationPathKey","computed","__default__$2","messages$1","onPageSelectChange","selectedPage","transformIntoOption","value","transformToPageNumber","_","index","listOfAvailablePages","uuid$3","openBlock","createElementBlock","mergeProps","_ctx","createCommentVNode","uuid$2","uuid$1","uuid","__default__$1","messages","isCurrentPageFirst","isCurrentPageLast","isNextButtonDisabled","isLastPageButtonDisabled","hasNoNextPage","hasNoTotalPagesNumber","navigate","pageArg","__default__","slots","useSlots","hasSlot","useHasSlot","attrs","useAttrs","ariaLabelAttribute","ariaLabel","toRefs","computedAriaLabel","useAriaLabel","totalPages","itemsPerPage","onPageSelected","pageNumber","onItemsPerPageChange","elements","navigationConditionalClasses"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oDAgFIA,KAAA;AAAA,EAAe,MAAA,EAAA,UAAAC,EAAA;AAEf;;;;;;;;;AA5CA,UAAAC,IAAA;AAAA,MAA2C,EAAA,OAAA,MAAA,OAAA,GAAA;AAAA,MACd,EAAA,OAAA,MAAA,OAAA,GAAA;AAAA,MACA,EAAA,OAAA,MAAA,OAAA,GAAA;AAAA,MACA,EAAA,OAAA,MAAA,OAAA,GAAA;AAAA,MACA,EAAA,OAAA,OAAA,OAAA,IAAA;AAAA,IACE,GAG/BC,IAAAC,GAiBAC,IAAAC,GAIA,EAAA,GAAAC,EAAA,IAAAC,EAAA,EAAA,UAAAP,EAAA,CAAA,GACAQ,IAAAC,EAAA,sCAAA,GACAC,IAAAC,EAAAV,CAAA,GACAW,IAAAC,EAAA,GAEAC,IAAA,CAAAC,MAAA;AACI,MAAAX,EAAA,UAAAW,CAAA;AAAA,IAAsC,GAG1CC,IAAAC,EAAA,MAAAf,EAAA,aAAA,0BAAA,cAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CCOAgB,KAAA;AAAA,EAAe,MAAA,EAAA,UAAAC,EAAA;AAEf;;;;;;;;;;AA9CA,UAAAjB,IAAAC,GAuBAC,IAAAC,GAIA,EAAA,GAAAC,EAAA,IAAAC,EAAA,EAAA,UAAAY,EAAA,CAAA,GACAX,IAAAC,EAAA,uCAAA,GACAW,IAAA,CAAAC,MAAAjB,EAAA,iBAAAiB,CAAA,GACAT,IAA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ACAC,IAAA3C,EAAAyC,EAAA,YAAA,CAAA,GACA,EAAA,WAAAG,EAAA,IAAAC,EAAAtD,CAAA,GACAuD,IAAAC,EAAA;AAAA,MAAuC,WAAAJ,EAAA;AAAA;AAAA,MACL,OAAAC;AAAA,IAEvB,CAAA,GAGXI,IAAA1C;AAAA,MAAmB,MAAA,CAAAf,EAAA,cAAA,CAAAA,EAAA,OAAA,OAAA,KAAA,KAAAA,EAAA,aAAAA,EAAA,IAAA;AAAA,IACkE,GAGrF2C,IAAA,CAAAC,GAAAc,MAAA;AACI,MAAA1D,EAAA,eACIE,EAAA,YAAA0C,CAAA,IAEA1C,EAAA,YAAA0C,GAAAc,MAAA1D,KAAA,gBAAAA,EAAA,KAAA,GAEJE,EAAA,eAAA0C,CAAA;AAAA,IAA2B,GAG/Be,IAAA,CAAAC,MAAA;AACI,MAAAjB,EAAAiB,CAAA;AAAA,IAAmB,GAGvBC,IAAA,CAAAC,MAAA;AACI,MAAA5D,EAAA,cAAA4D,CAAA,GACA5D,EAAA,eAAA4D,CAAA,GAIAnB,EAAA,GAAAmB,CAAA;AAAA,IAAoB,GAGxBC,IAAA,OAAA;AAAA,MAA4C,iDAAA,CAAAf,EAAA,SAAA,KAAAhD,EAAA;AAAA,IACsC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","x_google_ignoreList":[2,3,4,5]}
|
|
1
|
+
{"version":3,"file":"pagination.D_4FRHE9.js","sources":["../../../vue2/src/components/pagination/components/pagination-results-per-page/pagination-results-per-page.vue","../../../vue2/src/components/pagination/components/pagination-context/pagination-context.vue","../../../../node_modules/.pnpm/@adyen+ui-assets-icons-16@4.1.0_vue@2.7.16/node_modules/@adyen/ui-assets-icons-16/dist/vue/skip-left.vue","../../../../node_modules/.pnpm/@adyen+ui-assets-icons-16@4.1.0_vue@2.7.16/node_modules/@adyen/ui-assets-icons-16/dist/vue/skip-right.vue","../../../../node_modules/.pnpm/@adyen+ui-assets-icons-16@4.1.0_vue@2.7.16/node_modules/@adyen/ui-assets-icons-16/dist/vue/chevron-left-small.vue","../../../../node_modules/.pnpm/@adyen+ui-assets-icons-16@4.1.0_vue@2.7.16/node_modules/@adyen/ui-assets-icons-16/dist/vue/chevron-right-small.vue","../../../vue2/src/components/pagination/components/pagination-controls/pagination-controls.vue","../../../vue2/src/components/pagination/pagination.vue"],"sourcesContent":["<template>\n <div class=\"b-pagination-results-per-page\">\n <bento-typography el=\"div\">\n <component\n :is=\"i18nComponent\"\n v-bind=\"getI18nProps(translationPathKey)\"\n class=\"b-pagination-results-per-page__dropdown-container\"\n tag=\"div\"\n :plural=\"totalCount\"\n >\n <template #itemCount>\n <bento-dropdown\n :id=\"dropdownId\"\n :aria-label=\"t(translationPathKey, { itemCount: itemsPerPage, totalCount })\"\n class=\"b-pagination-results-per-page__dropdown\"\n condensed\n :items=\"dropdownOptions\"\n :value=\"itemsPerPage\"\n @input=\"onSelectChange\"\n />\n </template>\n <template v-if=\"!!totalCount\" #totalCount>{{ totalCount }}</template>\n </component>\n </bento-typography>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, ref } from 'vue';\n import { BentoTypography } from '@/components/typography';\n import { BentoDropdown } from '@/components/dropdown';\n import { generateUid } from '@/core/utils/ts';\n import { getI18nComponent, getI18nProps, useI18n } from '@/utils/ts/i18n';\n\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const PREDEFINED_RESULTS_PER_PAGE_VALUES = [\n { label: '10', value: 10 },\n { label: '20', value: 20 },\n { label: '50', value: 50 },\n { label: '75', value: 75 },\n { label: '100', value: 100 },\n ];\n\n const props = withDefaults(\n defineProps<{\n /**\n * The amount of items the pager is paging through.\n */\n itemsPerPage?: number;\n /**\n * The total number of items the pager is paging through.\n */\n totalCount?: number;\n }>(),\n {\n itemsPerPage: 50,\n totalCount: null,\n }\n );\n\n const emit = defineEmits<{\n (e: 'select', value: number);\n }>();\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const dropdownId = generateUid('b-pagination-context-number-elements');\n const dropdownOptions = ref(PREDEFINED_RESULTS_PER_PAGE_VALUES);\n const i18nComponent = getI18nComponent();\n\n const onSelectChange = (selectedNumberOfResults: number) => {\n emit('select', selectedNumberOfResults);\n };\n\n const translationPathKey = computed(() => (props.totalCount ? 'showingItemsWithTotal' : 'showingItems'));\n</script>\n\n<script lang=\"ts\">\n export default {\n i18n: { messages },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./pagination-results-per-page.scss\" />\n","<template>\n <div class=\"b-pagination-context\">\n <bento-typography v-if=\"totalPages > 1\" el=\"div\">\n <component :is=\"i18nComponent\" v-bind=\"getI18nProps('pageOfTotalPages')\" tag=\"div\">\n <template #page>\n <bento-dropdown\n :id=\"dropdownId\"\n :aria-label=\"t('pageOfTotalPages', { page, totalPages })\"\n class=\"b-pagination-context__dropdown\"\n condensed\n :items=\"listOfAvailablePages\"\n :value=\"page\"\n :virtual-scroll=\"virtualScroll\"\n @input=\"onPageSelectChange\"\n />\n </template>\n <template #totalPages>{{ totalPages }}</template>\n </component>\n </bento-typography>\n <bento-typography v-else-if=\"totalPages === 1\" el=\"span\">\n {{ t('pageOneOfOne') }}\n </bento-typography>\n <bento-typography v-else el=\"span\">\n {{ t('pageNumber', { page }) }}\n </bento-typography>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed } from 'vue';\n import { BentoTypography } from '@/components/typography';\n import { BentoDropdown } from '@/components/dropdown';\n import { BentoListboxOptionItem } from '@/types';\n import { generateUid } from '@/core/utils/ts';\n import messages from './messages.json';\n import { getI18nComponent, getI18nProps, useI18n } from '@/utils/ts/i18n';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const props = withDefaults(\n defineProps<{\n /**\n * The current page number of the pager.\n */\n page?: number;\n\n /**\n * The total number of items the pager is paging through.\n */\n totalPages?: number;\n\n /**\n * Enables virtual scrolling on all dropdowns if set to true.\n */\n virtualScroll?: boolean;\n }>(),\n {\n page: 1,\n totalPages: null,\n virtualScroll: false,\n }\n );\n const emit = defineEmits<{\n (e: 'page-selected', value: string | number);\n }>();\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const dropdownId = generateUid('bento-pagination-context-current-page');\n const onPageSelectChange = (selectedPage: string | number) => emit('page-selected', selectedPage);\n const i18nComponent = getI18nComponent();\n\n // Generate a list of pages from 1 to \"totalPages\"\n const transformIntoOption = (value: number): BentoListboxOptionItem => ({\n label: value.toString(),\n value,\n });\n const transformToPageNumber = (_, index) => index + 1;\n const listOfAvailablePages = computed(() =>\n Array.from(new Array(props.totalPages), transformToPageNumber).map(transformIntoOption)\n );\n</script>\n\n<script lang=\"ts\">\n export default {\n i18n: { messages },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./pagination-context.scss\" />\n","\n<template>\n <svg role=\"img\" v-bind=\"$attrs\" class=\"ui-assets-icons-16\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\"><title v-if=\"$attrs['svg-title']\">{{ $attrs['svg-title'] }}</title><path fill=\"#00112C\" d=\"M9.06055 8.00011L12.0605 5.00011L10.9999 3.93945L6.93923 8.00011L10.9999 12.0608L12.0605 11.0001L9.06055 8.00011Z\"/><path fill=\"#00112C\" d=\"M4.25 4.25L4.25 11.75H5.75L5.75 4.25L4.25 4.25Z\"/></svg>\n</template>\n<script>\n let uuid = 0;\n\n export default {\n beforeCreate() {\n this.uuid = uuid.toString();\n uuid += 1;\n },\n };\n</script>\n<style>\n @import '../css/main.css';\n</style>\n","\n<template>\n <svg role=\"img\" v-bind=\"$attrs\" class=\"ui-assets-icons-16\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\"><title v-if=\"$attrs['svg-title']\">{{ $attrs['svg-title'] }}</title><path fill=\"#00112C\" d=\"M6.93945 7.99962L3.93945 10.9996L5.00011 12.0603L9.06077 7.99963L5.00011 3.93896L3.93945 4.99963L6.93945 7.99962Z\"/><path fill=\"#00112C\" d=\"M11.75 11.7497V4.24974L10.25 4.24974V11.7497H11.75Z\"/></svg>\n</template>\n<script>\n let uuid = 0;\n\n export default {\n beforeCreate() {\n this.uuid = uuid.toString();\n uuid += 1;\n },\n };\n</script>\n<style>\n @import '../css/main.css';\n</style>\n","\n<template>\n <svg role=\"img\" v-bind=\"$attrs\" class=\"ui-assets-icons-16\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\"><title v-if=\"$attrs['svg-title']\">{{ $attrs['svg-title'] }}</title><path fill=\"#00112C\" d=\"M10.5608 5.00011L7.56077 8.00011L10.5608 11.0001L9.50011 12.0608L5.43945 8.00011L9.50011 3.93945L10.5608 5.00011Z\"/></svg>\n</template>\n<script>\n let uuid = 0;\n\n export default {\n beforeCreate() {\n this.uuid = uuid.toString();\n uuid += 1;\n },\n };\n</script>\n<style>\n @import '../css/main.css';\n</style>\n","\n<template>\n <svg role=\"img\" v-bind=\"$attrs\" class=\"ui-assets-icons-16\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\"><title v-if=\"$attrs['svg-title']\">{{ $attrs['svg-title'] }}</title><path fill=\"#00112C\" d=\"M5.43924 10.9999L8.43924 7.99989L5.43924 4.99989L6.4999 3.93923L10.5606 7.99989L6.4999 12.0605L5.43924 10.9999Z\"/></svg>\n</template>\n<script>\n let uuid = 0;\n\n export default {\n beforeCreate() {\n this.uuid = uuid.toString();\n uuid += 1;\n },\n };\n</script>\n<style>\n @import '../css/main.css';\n</style>\n","<template>\n <ul class=\"b-pagination-controls\">\n <li class=\"b-pagination-controls__item\">\n <!-- Navigate to the first page -->\n <bento-button :disabled=\"isCurrentPageFirst\" variant=\"tertiary\" condensed @click=\"navigate(1)\">\n <template #iconLeft>\n <skip-left :svg-title=\"t('navigateToTheFirstPage')\" />\n </template>\n </bento-button>\n </li>\n <li class=\"b-pagination-controls__item\">\n <!-- Navigate to the previous page -->\n <bento-button :disabled=\"isCurrentPageFirst\" variant=\"tertiary\" condensed @click=\"navigate(page - 1)\">\n <template #iconLeft>\n <chevron-left :svg-title=\"t('navigateToThePreviousPage')\" />\n </template>\n </bento-button>\n </li>\n <li class=\"b-pagination-controls__item\">\n <!-- Navigate to the next page -->\n <bento-button :disabled=\"isNextButtonDisabled\" variant=\"tertiary\" condensed @click=\"navigate(page + 1)\">\n <template #iconLeft>\n <chevron-right :svg-title=\"t('navigateToTheNextPage')\" />\n </template>\n </bento-button>\n </li>\n <li class=\"b-pagination-controls__item\">\n <!-- Navigate to the last page -->\n <bento-button\n :disabled=\"isLastPageButtonDisabled\"\n variant=\"tertiary\"\n condensed\n @click=\"navigate(totalPages)\"\n >\n <template #iconLeft>\n <skip-right :svg-title=\"t('navigateToTheLastPage')\" />\n </template>\n </bento-button>\n </li>\n </ul>\n</template>\n\n<script setup lang=\"ts\">\n import { computed } from 'vue';\n import { BentoButton } from '@/components/button';\n import { useI18n } from '@/utils/ts/i18n';\n import SkipLeft from '@adyen/ui-assets-icons-16/vue/skip-left';\n import SkipRight from '@adyen/ui-assets-icons-16/vue/skip-right';\n import ChevronLeft from '@adyen/ui-assets-icons-16/vue/chevron-left-small';\n import ChevronRight from '@adyen/ui-assets-icons-16/vue/chevron-right-small';\n\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const props = withDefaults(\n defineProps<{\n /**\n * Use to determine if the pager has a \"next page\".\n */\n hasNext?: boolean;\n\n /**\n * The current page number of the pager.\n */\n page: number;\n\n /**\n * The current page number of the pager.\n */\n totalPages?: number;\n }>(),\n {\n hasNext: null,\n totalPages: null,\n }\n );\n\n const emit = defineEmits<{\n (e: 'navigate', value: number);\n }>();\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const isCurrentPageFirst = computed(() => props.page === 1);\n const isCurrentPageLast = computed(() => props.page === props.totalPages);\n const isNextButtonDisabled = computed(() => {\n const hasNoNextPage = !props.hasNext;\n return hasNoNextPage || isCurrentPageLast.value;\n });\n const isLastPageButtonDisabled = computed(() => {\n const hasNoNextPage = !props.hasNext;\n const hasNoTotalPagesNumber = !props.totalPages;\n\n return hasNoNextPage || isCurrentPageLast.value || hasNoTotalPagesNumber;\n });\n\n const navigate = (pageArg: number) => {\n emit('navigate', pageArg);\n };\n</script>\n\n<script lang=\"ts\">\n export default {\n i18n: { messages },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./pagination-controls.scss\" />\n","<template>\n <div class=\"b-pagination\">\n <nav :aria-label=\"computedAriaLabel\" class=\"b-pagination__navigation\" :class=\"navigationConditionalClasses()\">\n <bento-pagination-results-per-page\n v-if=\"!hidePageSize\"\n class=\"b-pagination__results-per-page\"\n :items-per-page=\"size\"\n :total-count=\"totalCount\"\n @select=\"onItemsPerPageChange\"\n />\n <bento-typography v-else-if=\"hasSlot('default')\"><slot /></bento-typography>\n\n <div class=\"b-pagination__page-navigator\">\n <bento-pagination-context\n class=\"b-pagination__context\"\n :total-pages=\"totalPages\"\n :page=\"page\"\n :total-count=\"totalCount\"\n :virtual-scroll=\"virtualScroll\"\n @page-selected=\"onPageSelected\"\n />\n\n <div class=\"b-pagination__divider\"></div>\n\n <bento-pagination-controls\n class=\"b-pagination__controls\"\n :has-next=\"hasNext\"\n :page=\"page\"\n :total-pages=\"totalPages\"\n @navigate=\"navigate\"\n />\n </div>\n </nav>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, ref, toRefs, useAttrs, useSlots } from 'vue';\n import { BentoTypography } from '@/components/typography';\n import BentoPaginationResultsPerPage from './components/pagination-results-per-page/pagination-results-per-page.vue';\n import BentoPaginationContext from './components/pagination-context/pagination-context.vue';\n import BentoPaginationControls from './components/pagination-controls/pagination-controls.vue';\n import { useAriaLabel } from '@/utils/ts/aria-label';\n import { useHasSlot } from '@/composables';\n\n const props = withDefaults(\n defineProps<{\n /**\n * @deprecated from version 2.0.0. Use the aria-label attribute instead.\n */\n /**\n * A brief description of the purpose of the navigation (for a11y).\n * Omit the term \"navigation\", as the screen reader will read both the role and the contents of the label.\n */\n ariaLabel?: string;\n\n /**\n * Use to determine if the pager has a \"next page\".\n */\n hasNext?: boolean;\n\n /**\n * Toggles the visibility of the \"results per page\" part of the pagination component.\n */\n hidePageSize?: boolean;\n\n /**\n * The current page number of the pager.\n */\n page?: number;\n\n /**\n * The size of the items the pager is paging through.\n */\n size?: number;\n\n /**\n * The total number of items the pager is paging through.\n */\n totalCount?: number;\n\n /**\n * Enables virtual scrolling on all dropdowns if set to true.\n */\n virtualScroll?: boolean;\n }>(),\n {\n ariaLabel: null,\n hasNext: null,\n hidePageSize: false,\n page: 1,\n size: 20,\n totalCount: null,\n virtualScroll: false,\n }\n );\n\n const emit = defineEmits<{\n /**\n * Triggered when the navigation controls are clicked or the items per page is changed (i.e. when the arrow buttons to the\n * rightmost of the screen or either dropdown is updated). It indicates to which page it should go next and also the page size.\n */\n (e: 'navigate', page: number, items?: number): void;\n\n /**\n * Triggered when the number of items per page is changed from the left hand dropdown.\n * It indicates the new number of items that will be displayed.\n */\n (e: 'items-page', size: number): void;\n\n /**\n * Triggered when the navigation controls are clicked, whether the arrow buttons to the\n * right most of the screen or the dropdown on the right hand is updated.\n * It indicates to which page it should go next\n * (easily achieved using the [sync modifier](https://v2.vuejs.org/v2/guide/components-custom-events.html#sync-Modifier))\n * e.g. `:page.sync=\"currentPage\"`\n */\n (e: 'update:page', page: number): void;\n\n /**\n * Triggered when the number of items per page is changed from the left hand dropdown.\n * It indicates the new number of items that will be displayed.\n * (easily achieved using the [sync modifier](https://v2.vuejs.org/v2/guide/components-custom-events.html#sync-Modifier))\n * e.g. `:size.sync=\"itemsPerPage\"`\n */\n (e: 'update:size', size: number): void;\n }>();\n\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n\n const attrs = useAttrs();\n const ariaLabelAttribute = ref(attrs['aria-label']);\n const { ariaLabel } = toRefs(props);\n const computedAriaLabel = useAriaLabel({\n ariaLabel: ariaLabelAttribute.value as string,\n // TODO: take this line away when the aria-label props is removed\n label: ariaLabel,\n });\n\n const totalPages = computed(() =>\n !props.totalCount || !props.size ? null : Math.ceil(props.totalCount / props.size)\n );\n\n const navigate = (pageArg: number, itemsPerPage?: number) => {\n if (props.hidePageSize) {\n emit('navigate', pageArg);\n } else {\n emit('navigate', pageArg, itemsPerPage ?? props?.size);\n }\n emit('update:page', pageArg);\n };\n\n const onPageSelected = (pageNumber: number) => {\n navigate(pageNumber);\n };\n\n const onItemsPerPageChange = (elements: number) => {\n emit('items-page', elements);\n emit('update:size', elements);\n\n // Always go to first page when the\n // number of items page changes\n navigate(1, elements);\n };\n\n const navigationConditionalClasses = () => ({\n 'b-pagination__navigation--only-page-navigator': !hasSlot('default') && props.hidePageSize,\n });\n</script>\n\n<script lang=\"ts\">\n /**\n * Paginiation component to help users page through data sets.\n *\n * There are two ways of doing navigation in this component:\n * 1. (Basic) You tell the component if there is a next page (hasNext)\n * 2. (Enhanced) You tell the component:\n * - How many total items exist (totalCount)\n * - The max number of items that you show/fetch per page (size)\n * - In this case you should not set the hasNext props\n *\n * If you have the data available and opt to use the Enhanced way you get extra controls:\n * - Page dropdown selector\n * - Last page button\n * - \"Showing 10 of 200 items\" text\n *\n * @usage\n * import { BentoPagination } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoPagination },\n * template: `\n * <bento-pagination :has-next=\"isNextPage\" />\n * `,\n * }\n */\n\n export default {};\n</script>\n\n<style lang=\"scss\" scoped src=\"./pagination.scss\" />\n"],"names":["__default__$3","messages$2","PREDEFINED_RESULTS_PER_PAGE_VALUES","props","__props","emit","__emit","t","useI18n","dropdownId","generateUid","dropdownOptions","ref","i18nComponent","getI18nComponent","onSelectChange","selectedNumberOfResults","translationPathKey","computed","__default__$2","messages$1","onPageSelectChange","selectedPage","transformIntoOption","value","transformToPageNumber","_","index","listOfAvailablePages","uuid$3","openBlock","createElementBlock","mergeProps","_ctx","createCommentVNode","uuid$2","uuid$1","uuid","__default__$1","messages","isCurrentPageFirst","isCurrentPageLast","isNextButtonDisabled","isLastPageButtonDisabled","hasNoNextPage","hasNoTotalPagesNumber","navigate","pageArg","__default__","slots","useSlots","hasSlot","useHasSlot","attrs","useAttrs","ariaLabelAttribute","ariaLabel","toRefs","computedAriaLabel","useAriaLabel","totalPages","itemsPerPage","onPageSelected","pageNumber","onItemsPerPageChange","elements","navigationConditionalClasses"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oDAgFIA,KAAA;AAAA,EAAe,MAAA,EAAA,UAAAC,EAAA;AAEf;;;;;;;;;AA5CA,UAAAC,IAAA;AAAA,MAA2C,EAAA,OAAA,MAAA,OAAA,GAAA;AAAA,MACd,EAAA,OAAA,MAAA,OAAA,GAAA;AAAA,MACA,EAAA,OAAA,MAAA,OAAA,GAAA;AAAA,MACA,EAAA,OAAA,MAAA,OAAA,GAAA;AAAA,MACA,EAAA,OAAA,OAAA,OAAA,IAAA;AAAA,IACE,GAG/BC,IAAAC,GAiBAC,IAAAC,GAIA,EAAA,GAAAC,EAAA,IAAAC,EAAA,EAAA,UAAAP,EAAA,CAAA,GACAQ,IAAAC,EAAA,sCAAA,GACAC,IAAAC,EAAAV,CAAA,GACAW,IAAAC,EAAA,GAEAC,IAAA,CAAAC,MAAA;AACI,MAAAX,EAAA,UAAAW,CAAA;AAAA,IAAsC,GAG1CC,IAAAC,EAAA,MAAAf,EAAA,aAAA,0BAAA,cAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CCOAgB,KAAA;AAAA,EAAe,MAAA,EAAA,UAAAC,EAAA;AAEf;;;;;;;;;;AA9CA,UAAAjB,IAAAC,GAuBAC,IAAAC,GAIA,EAAA,GAAAC,EAAA,IAAAC,EAAA,EAAA,UAAAY,EAAA,CAAA,GACAX,IAAAC,EAAA,uCAAA,GACAW,IAAA,CAAAC,MAAAjB,EAAA,iBAAAiB,CAAA,GACAT,IAAAC,EAAA,GAGAS,IAAA,CAAAC,OAAA;AAAA,MAAwE,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,WAAAG,EAAA,IAAAC,EAAAtD,CAAA,GACAuD,IAAAC,EAAA;AAAA,MAAuC,WAAAJ,EAAA;AAAA;AAAA,MACL,OAAAC;AAAA,IAEvB,CAAA,GAGXI,IAAA1C;AAAA,MAAmB,MAAA,CAAAf,EAAA,cAAA,CAAAA,EAAA,OAAA,OAAA,KAAA,KAAAA,EAAA,aAAAA,EAAA,IAAA;AAAA,IACkE,GAGrF2C,IAAA,CAAAC,GAAAc,MAAA;AACI,MAAA1D,EAAA,eACIE,EAAA,YAAA0C,CAAA,IAEA1C,EAAA,YAAA0C,GAAAc,MAAA1D,KAAA,gBAAAA,EAAA,KAAA,GAEJE,EAAA,eAAA0C,CAAA;AAAA,IAA2B,GAG/Be,IAAA,CAAAC,MAAA;AACI,MAAAjB,EAAAiB,CAAA;AAAA,IAAmB,GAGvBC,IAAA,CAAAC,MAAA;AACI,MAAA5D,EAAA,cAAA4D,CAAA,GACA5D,EAAA,eAAA4D,CAAA,GAIAnB,EAAA,GAAAmB,CAAA;AAAA,IAAoB,GAGxBC,IAAA,OAAA;AAAA,MAA4C,iDAAA,CAAAf,EAAA,SAAA,KAAAhD,EAAA;AAAA,IACsC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","x_google_ignoreList":[2,3,4,5]}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { defineComponent as V, ref as j, computed as r, openBlock as n, createElementBlock as g, normalizeClass as z, unref as s, createElementVNode as l, createVNode as y, withCtx as o, createTextVNode as d, toDisplayString as p, renderSlot as $, Fragment as G, renderList as H, createBlock as c, createSlots as U, resolveDynamicComponent as R, createCommentVNode as B } from "vue";
|
|
2
|
+
import { a as Z } from "./index.ChdIlujs.js";
|
|
3
|
+
import { B as k } from "./button.pwNCxwPu.js";
|
|
4
|
+
import { B as f, _ as w, a as F } from "./image.vue_vue_type_script_setup_true_lang.BMoSMeM-.js";
|
|
5
|
+
import { B as Y } from "./typography.DNzU41ah.js";
|
|
6
|
+
import { u as J } from "./i18n.CPGoe9tN.js";
|
|
7
|
+
import { g as P } from "./generate-uid.D-HFI38h.js";
|
|
8
|
+
import { _ as q } from "./_plugin-vue_export-helper.CHgC5LLL.js";
|
|
9
|
+
import "../assets/promo-banner.css";
|
|
10
|
+
var b = /* @__PURE__ */ ((t) => (t.BLUE = "blue", t.GREY = "grey", t.GREEN = "green", t))(b || {}), m = /* @__PURE__ */ ((t) => (t.HORIZONTAL = "horizontal", t.VERTICAL = "vertical", t))(m || {});
|
|
11
|
+
const h = {
|
|
12
|
+
"en-US": {
|
|
13
|
+
dismiss: "Dismiss"
|
|
14
|
+
},
|
|
15
|
+
"ja-JP": {
|
|
16
|
+
dismiss: "却下"
|
|
17
|
+
},
|
|
18
|
+
"pt-BR": {
|
|
19
|
+
dismiss: "Descartar"
|
|
20
|
+
}
|
|
21
|
+
}, x = ["aria-labelledby"], K = { class: "b-promo-banner__content" }, M = { class: "b-promo-banner__content-header" }, Q = { class: "b-promo-banner__content-actions" }, W = { class: "b-promo-banner__image" }, X = {
|
|
22
|
+
i18n: { messages: h },
|
|
23
|
+
name: "bento-promo-banner"
|
|
24
|
+
}, ee = /* @__PURE__ */ V({
|
|
25
|
+
...X,
|
|
26
|
+
props: {
|
|
27
|
+
actions: { default: null },
|
|
28
|
+
color: { default: b.GREY },
|
|
29
|
+
isDismissible: { type: Boolean, default: !0 },
|
|
30
|
+
dismissButtonText: { default: null },
|
|
31
|
+
image: {},
|
|
32
|
+
layout: { default: m.HORIZONTAL },
|
|
33
|
+
title: {}
|
|
34
|
+
},
|
|
35
|
+
emits: ["dismiss"],
|
|
36
|
+
setup(t, { emit: T }) {
|
|
37
|
+
const { t: C } = J({ messages: h }), a = t, I = T, u = j(null), L = Z(u), _ = P("promoBannerTitle"), O = r(() => a.image.aspectRatio === f.P16_9 ? 800 : a.image.aspectRatio === f.P2_1 ? 850 : a.image.aspectRatio === f.P1_1 ? 623 : 0), E = r(() => a.layout === m.HORIZONTAL && L.width.value <= O.value ? m.VERTICAL : a.layout), N = r(
|
|
38
|
+
() => [`b-promo-banner--${E.value}`, `b-promo-banner--${a.color}`].join(" ")
|
|
39
|
+
), A = (i) => i.iconOnly && (i.iconLeft || i.iconRight || i.icon), D = r(() => a.dismissButtonText || C("dismiss"));
|
|
40
|
+
return (i, v) => (n(), g("section", {
|
|
41
|
+
ref_key: "promoBannerRef",
|
|
42
|
+
ref: u,
|
|
43
|
+
class: z(["b-promo-banner", N.value]),
|
|
44
|
+
"aria-labelledby": s(_)
|
|
45
|
+
}, [
|
|
46
|
+
l("div", K, [
|
|
47
|
+
l("div", M, [
|
|
48
|
+
y(s(Y), {
|
|
49
|
+
id: s(_),
|
|
50
|
+
variant: "title",
|
|
51
|
+
large: ""
|
|
52
|
+
}, {
|
|
53
|
+
default: o(() => [
|
|
54
|
+
d(p(i.title), 1)
|
|
55
|
+
]),
|
|
56
|
+
_: 1
|
|
57
|
+
}, 8, ["id"]),
|
|
58
|
+
$(i.$slots, "description", {}, void 0, !0)
|
|
59
|
+
]),
|
|
60
|
+
l("div", Q, [
|
|
61
|
+
i.actions ? (n(!0), g(G, { key: 0 }, H(i.actions, (e, S) => (n(), c(s(k), {
|
|
62
|
+
key: S,
|
|
63
|
+
variant: e.variant,
|
|
64
|
+
critical: e.critical,
|
|
65
|
+
disabled: e.disabled,
|
|
66
|
+
inverse: e.inverse,
|
|
67
|
+
"icon-only": e.iconOnly,
|
|
68
|
+
link: e.link,
|
|
69
|
+
onClick: e.event
|
|
70
|
+
}, U({ _: 2 }, [
|
|
71
|
+
e.icon || e.iconLeft ? {
|
|
72
|
+
name: "iconLeft",
|
|
73
|
+
fn: o(() => [
|
|
74
|
+
(n(), c(R(e.icon || e.iconLeft), {
|
|
75
|
+
"svg-title": e.title
|
|
76
|
+
}, null, 8, ["svg-title"]))
|
|
77
|
+
]),
|
|
78
|
+
key: "0"
|
|
79
|
+
} : void 0,
|
|
80
|
+
A(e) ? void 0 : {
|
|
81
|
+
name: "default",
|
|
82
|
+
fn: o(() => [
|
|
83
|
+
d(p(e.title), 1)
|
|
84
|
+
]),
|
|
85
|
+
key: "1"
|
|
86
|
+
},
|
|
87
|
+
e.iconRight ? {
|
|
88
|
+
name: "iconRight",
|
|
89
|
+
fn: o(() => [
|
|
90
|
+
(n(), c(R(e.iconRight), {
|
|
91
|
+
"svg-title": e.title
|
|
92
|
+
}, null, 8, ["svg-title"]))
|
|
93
|
+
]),
|
|
94
|
+
key: "2"
|
|
95
|
+
} : void 0
|
|
96
|
+
]), 1032, ["variant", "critical", "disabled", "inverse", "icon-only", "link", "onClick"]))), 128)) : B("", !0),
|
|
97
|
+
i.isDismissible ? (n(), c(s(k), {
|
|
98
|
+
key: 1,
|
|
99
|
+
variant: "secondary",
|
|
100
|
+
onClick: v[0] || (v[0] = (e) => I("dismiss"))
|
|
101
|
+
}, {
|
|
102
|
+
default: o(() => [
|
|
103
|
+
d(p(D.value), 1)
|
|
104
|
+
]),
|
|
105
|
+
_: 1
|
|
106
|
+
})) : B("", !0)
|
|
107
|
+
])
|
|
108
|
+
]),
|
|
109
|
+
l("div", W, [
|
|
110
|
+
y(s(w), {
|
|
111
|
+
class: "b-promo-banner__image-item",
|
|
112
|
+
src: i.image.src,
|
|
113
|
+
alt: i.image.alt ?? "",
|
|
114
|
+
"aspect-ratio": i.image.aspectRatio,
|
|
115
|
+
"object-fit": s(F).CONTAIN
|
|
116
|
+
}, null, 8, ["src", "alt", "aspect-ratio", "object-fit"])
|
|
117
|
+
])
|
|
118
|
+
], 10, x));
|
|
119
|
+
}
|
|
120
|
+
}), ce = /* @__PURE__ */ q(ee, [["__scopeId", "data-v-efd58f1e"]]);
|
|
121
|
+
export {
|
|
122
|
+
b as B,
|
|
123
|
+
m as a,
|
|
124
|
+
ce as p
|
|
125
|
+
};
|
|
126
|
+
//# sourceMappingURL=promo-banner.BRn1iznD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promo-banner.BRn1iznD.js","sources":["../../../vue2/src/components/promo-banner/promo-banner.types.ts","../../../vue2/src/components/promo-banner/promo-banner.vue"],"sourcesContent":["import { BentoButtonActionObject } from '@/core/components/button-actions/button-actions.types';\nimport { BentoButtonVariant } from '../button';\nimport { BentoImageAspectRatio, BentoImageProps } from '../image';\n\nexport interface BentoPromoBannerProps {\n /**\n * List of actions that will be used to render the buttons.\n *\n * Each object in the list should have a `title`, an `event` and a `variant`.\n *\n * `title`: Button's text.\n * `event`: Event triggered when clicking the Button.\n * `variant`: Button's style.\n *\n * ```\n * [{\n * title: 'Primary',\n * event: () => { ... },\n * variant: 'primary'\n * }, {\n * title: 'Secondary',\n * event: () => { ... }\n * variant: 'secondary'\n * }]\n * ```\n */\n actions?: BentoPromoBannerAction[];\n\n /**\n * Defines the color of banner's background\n */\n color?: `${BentoPromoBannerColor}`;\n\n /**\n * Defines whether the banner has a `Dismiss` button\n */\n isDismissible?: boolean;\n\n /**\n * Defines whether the banner has a `Dismiss` button\n */\n dismissButtonText?: string;\n\n /**\n * Defines the image used in the banner.\n *\n * The promotional banner adapts to different container sizes based on the image's `aspect-ratio`.\n * Only the following `aspect-ratio` values are supported: `16:9`, `2:1`, and `1:1`.\n *\n * In Storybook, to verify the image display, update `image.src` and `image.aspectRatio` as follows:\n * - `./1-1.png` with an aspect ratio of `1:1`\n * - `./2-1.png` with an aspect ratio of `2:1`\n * - `./16-9.png` with an aspect ratio of `16:9`\n */\n image: BentoPromoBannerImage;\n\n /**\n * Defines style of the banner.\n *\n * The horizontal layout is responsive to the container size and\n * changes depending on the image aspect ratio.\n *\n * The vertical layout remains the same regardless of container size.\n */\n layout?: `${BentoPromoBannerLayout}`;\n\n /**\n * Defines the title text to be shown on the banner\n */\n title: string;\n}\n\nexport type BentoPromoBannerImageAspectRatio = `${\n | BentoImageAspectRatio.P16_9\n | BentoImageAspectRatio.P2_1\n | BentoImageAspectRatio.P1_1}`;\n\nexport type BentoPromoBannerButtonVariant = `${BentoButtonVariant.PRIMARY | BentoButtonVariant.SECONDARY}`;\n\nexport type BentoPromoBannerAction<IconType = object> = BentoButtonActionObject<IconType> & {\n variant: BentoPromoBannerButtonVariant;\n};\n\nexport type BentoPromoBannerImage = {\n src: BentoImageProps['src'];\n alt?: BentoImageProps['alt'];\n aspectRatio: BentoPromoBannerImageAspectRatio;\n};\n\nexport enum BentoPromoBannerColor {\n BLUE = 'blue',\n GREY = 'grey',\n GREEN = 'green',\n}\n\nexport enum BentoPromoBannerLayout {\n HORIZONTAL = 'horizontal',\n VERTICAL = 'vertical',\n}\n","<template>\n <section\n ref=\"promoBannerRef\"\n class=\"b-promo-banner\"\n :class=\"bannerConditionalClass\"\n :aria-labelledby=\"promoBannerTitleId\"\n >\n <div class=\"b-promo-banner__content\">\n <div class=\"b-promo-banner__content-header\">\n <bento-typography :id=\"promoBannerTitleId\" variant=\"title\" large>\n {{ title }}\n </bento-typography>\n\n <slot name=\"description\" />\n </div>\n\n <div class=\"b-promo-banner__content-actions\">\n <template v-if=\"actions\">\n <bento-button\n v-for=\"(button, index) in actions\"\n :key=\"index\"\n :variant=\"button.variant\"\n :critical=\"button.critical\"\n :disabled=\"button.disabled\"\n :inverse=\"button.inverse\"\n :icon-only=\"button.iconOnly\"\n :link=\"button.link\"\n @click=\"button.event\"\n >\n <template v-if=\"button.icon || button.iconLeft\" #iconLeft>\n <component :is=\"button.icon || button.iconLeft\" :svg-title=\"button.title\"></component>\n </template>\n\n <template v-if=\"!isIconOnly(button)\" #default>\n {{ button.title }}\n </template>\n\n <template v-if=\"button.iconRight\" #iconRight>\n <component :is=\"button.iconRight\" :svg-title=\"button.title\"></component>\n </template>\n </bento-button>\n </template>\n\n <bento-button v-if=\"isDismissible\" variant=\"secondary\" @click=\"emit('dismiss')\">\n {{ computedDismissButtonText }}\n </bento-button>\n </div>\n </div>\n\n <div class=\"b-promo-banner__image\">\n <bento-image\n class=\"b-promo-banner__image-item\"\n :src=\"image.src\"\n :alt=\"image.alt ?? ''\"\n :aspect-ratio=\"image.aspectRatio\"\n :object-fit=\"BentoImageObjectFit.CONTAIN\"\n ></bento-image>\n </div>\n </section>\n</template>\n\n<script setup lang=\"ts\">\n import { useElementSize } from '@vueuse/core';\n import { computed, ref } from 'vue';\n\n // Components\n import { BentoButton, BentoButtonActionObject } from '@/components/button';\n import { BentoImage, BentoImageAspectRatio, BentoImageObjectFit } from '@/components/image';\n import { BentoTypography } from '@/components/typography';\n import { BentoPromoBannerColor, BentoPromoBannerLayout, BentoPromoBannerProps } from './promo-banner.types';\n\n // Utils\n import { useI18n } from '@/utils/ts/i18n';\n\n import { generateUid } from '@/core/utils/ts';\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 props = withDefaults(defineProps<BentoPromoBannerProps>(), {\n actions: null,\n color: BentoPromoBannerColor.GREY,\n isDismissible: true,\n dismissButtonText: null,\n layout: BentoPromoBannerLayout.HORIZONTAL,\n });\n\n const emit = defineEmits<{\n /**\n * Emits a dismiss event when dismiss button on the promotional banner is pressed\n */\n (e: 'dismiss');\n }>();\n\n const promoBannerRef = ref(null);\n const promoBannerSize = useElementSize(promoBannerRef);\n const promoBannerTitleId = generateUid('promoBannerTitle');\n\n const horizontalLayoutBreakpoint = computed(() => {\n if (props.image.aspectRatio === BentoImageAspectRatio.P16_9) {\n return 800;\n } else if (props.image.aspectRatio === BentoImageAspectRatio.P2_1) {\n return 850;\n } else if (props.image.aspectRatio === BentoImageAspectRatio.P1_1) {\n return 623;\n }\n\n return 0;\n });\n\n const bannerLayoutClass = computed(() => {\n // only horizontal layout is responsive and, by design, follows the container size\n if (\n props.layout === BentoPromoBannerLayout.HORIZONTAL &&\n promoBannerSize.width.value <= horizontalLayoutBreakpoint.value\n ) {\n return BentoPromoBannerLayout.VERTICAL;\n }\n\n return props.layout;\n });\n\n const bannerConditionalClass = computed(() =>\n [`b-promo-banner--${bannerLayoutClass.value}`, `b-promo-banner--${props.color}`].join(' ')\n );\n\n const isIconOnly = (button: BentoButtonActionObject) =>\n button.iconOnly && (button.iconLeft || button.iconRight || button.icon);\n\n const computedDismissButtonText = computed(() => props.dismissButtonText || t('dismiss'));\n</script>\n\n<script lang=\"ts\">\n /**\n * Promotional Banner highlights important information, announcements, or promotions.\n *\n * @example\n * import { BentoPromoBanner } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoPromoBanner },\n * template: `\n * <bento-promo-banner\n * title=\"Title\"\n * description=\"Brief description explaining and giving more information about the title\"\n * :image=\"{ src: '16-1.png', aspectRatio: '16:9' }\"\n * :actions=\"[{ title: 'Primary', event: () => {} }]\"\n * >\n * </bento-promo-banner>\n * `\n * };\n */\n export default {\n i18n: { messages },\n name: 'bento-promo-banner',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./promo-banner.scss\" />\n"],"names":["BentoPromoBannerColor","BentoPromoBannerColor2","BentoPromoBannerLayout","BentoPromoBannerLayout2","__default__","messages","t","useI18n","props","__props","emit","__emit","promoBannerRef","ref","promoBannerSize","useElementSize","promoBannerTitleId","generateUid","horizontalLayoutBreakpoint","computed","BentoImageAspectRatio","bannerLayoutClass","bannerConditionalClass","isIconOnly","button","computedDismissButtonText"],"mappings":";;;;;;;;;AAyFY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,OAAA,QACAA,EAAA,OAAA,QACAA,EAAA,QAAA,SAHQA,IAAAD,KAAA,CAAA,CAAA,GAMAE,IAAA,kBAAAC,OACRA,EAAA,aAAA,cACAA,EAAA,WAAA,YAFQA,IAAAD,KAAA,CAAA,CAAA;;;;;;;;;;;iNC2DRE,IAAA;AAAA,EAAe,MAAA,EAAA,UAAAC,EAAA;AAAA,EACM,MAAA;AAErB;;;;;;;;;;;;;AA9EA,UAAA,EAAA,GAAAC,EAAA,IAAAC,EAAA,EAAA,UAAAF,EAAA,CAAA,GAEAG,IAAAC,GAQAC,IAAAC,GAOAC,IAAAC,EAAA,IAAA,GACAC,IAAAC,EAAAH,CAAA,GACAI,IAAAC,EAAA,kBAAA,GAEAC,IAAAC,EAAA,MACIX,EAAA,MAAA,gBAAAY,EAAA,QACI,MAAOZ,EAAA,MAAA,gBAAAY,EAAA,OAEP,MAAOZ,EAAA,MAAA,gBAAAY,EAAA,OAEP,MAGJ,CAAO,GAGXC,IAAAF,EAAA,MAEIX,EAAA,WAAAN,EAAA,cAAAY,EAAA,MAAA,SAAAI,EAAA,QAIIhB,EAAA,WAGJM,EAAA,MAAa,GAGjBc,IAAAH;AAAA,MAA+B,MAAA,CAAA,mBAAAE,EAAA,KAAA,IAAA,mBAAAb,EAAA,KAAA,EAAA,EAAA,KAAA,GAAA;AAAA,IAC8D,GAG7Fe,IAAA,CAAAC,MAAAA,EAAA,aAAAA,EAAA,YAAAA,EAAA,aAAAA,EAAA,OAGAC,IAAAN,EAAA,MAAAX,EAAA,qBAAAF,EAAA,SAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|