@adyen/bento-vue2 1.99.0 → 1.100.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/index.d.ts +19 -13
- package/dist/action-bar.js +1 -1
- package/dist/ai-tag.js +1 -1
- package/dist/alert.js +1 -1
- package/dist/anchor-scroller.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/button-actions.css +1 -1
- package/dist/assets/button.css +1 -1
- package/dist/assets/card.css +1 -1
- package/dist/assets/data-grid.css +1 -1
- package/dist/assets/dialog-page.css +1 -1
- package/dist/assets/draggable-handle.css +1 -1
- package/dist/assets/dropdown.css +1 -1
- package/dist/assets/file-uploader.css +1 -1
- package/dist/assets/filter-bar.css +1 -1
- package/dist/assets/input-field.css +1 -1
- package/dist/assets/inspector.css +1 -1
- package/dist/assets/modal-fullscreen.css +1 -1
- package/dist/assets/navigation-menu-group.css +1 -1
- package/dist/assets/rich-text-editor.css +1 -1
- package/dist/assets/secondary-nav.css +1 -1
- package/dist/assets/selection-card-group.css +1 -1
- package/dist/assets/sidepanel.css +1 -1
- package/dist/assets/textarea.css +1 -1
- package/dist/button.js +3 -3
- package/dist/card.js +1 -1
- package/dist/chunks/{action-bar.X-dXuOcv.js → action-bar.DxZchfve.js} +4 -4
- package/dist/chunks/{action-bar.X-dXuOcv.js.map → action-bar.DxZchfve.js.map} +1 -1
- package/dist/chunks/{ai-button.DvOq4s2_.js → ai-button.y1t1nqpv.js} +2 -2
- package/dist/chunks/{ai-button.DvOq4s2_.js.map → ai-button.y1t1nqpv.js.map} +1 -1
- package/dist/chunks/{ai-tag.Cdn4JK1m.js → ai-tag.CD1eQnr_.js} +2 -2
- package/dist/chunks/{ai-tag.Cdn4JK1m.js.map → ai-tag.CD1eQnr_.js.map} +1 -1
- package/dist/chunks/{alert.BDkEbdf4.js → alert.DP17WjNE.js} +2 -2
- package/dist/chunks/{alert.BDkEbdf4.js.map → alert.DP17WjNE.js.map} +1 -1
- package/dist/chunks/{anchor-scroller.Bu7GtOqH.js → anchor-scroller.BiHtyUJz.js} +3 -3
- package/dist/chunks/{anchor-scroller.Bu7GtOqH.js.map → anchor-scroller.BiHtyUJz.js.map} +1 -1
- package/dist/chunks/{base-modal.DgMSsQf3.js → base-modal.BbMTTAi5.js} +5 -5
- package/dist/chunks/{base-modal.DgMSsQf3.js.map → base-modal.BbMTTAi5.js.map} +1 -1
- package/dist/chunks/{button-actions-with-menu.BV5aDUCD.js → button-actions-with-menu.CpqyoKG5.js} +2 -2
- package/dist/chunks/{button-actions-with-menu.BV5aDUCD.js.map → button-actions-with-menu.CpqyoKG5.js.map} +1 -1
- package/dist/chunks/{button-actions.BD4Dyp4U.js → button-actions.Dxez8SNL.js} +2 -2
- package/dist/chunks/{button-actions.BD4Dyp4U.js.map → button-actions.Dxez8SNL.js.map} +1 -1
- package/dist/chunks/button.Df_UH5wZ.js +112 -0
- package/dist/chunks/button.Df_UH5wZ.js.map +1 -0
- package/dist/chunks/{calendar.CmhzIZZM.js → calendar.BKddGc3j.js} +3 -3
- package/dist/chunks/{calendar.CmhzIZZM.js.map → calendar.BKddGc3j.js.map} +1 -1
- package/dist/chunks/{card.Bm7JEsCC.js → card.BzDmgKjO.js} +2 -2
- package/dist/chunks/{card.Bm7JEsCC.js.map → card.BzDmgKjO.js.map} +1 -1
- package/dist/chunks/{code-snippet.DuJAubi9.js → code-snippet.CY_C6Xyz.js} +5 -5
- package/dist/chunks/{code-snippet.DuJAubi9.js.map → code-snippet.CY_C6Xyz.js.map} +1 -1
- package/dist/chunks/{copy.CWKdfVcd.js → copy.DSFXER-x.js} +2 -2
- package/dist/chunks/{copy.CWKdfVcd.js.map → copy.DSFXER-x.js.map} +1 -1
- package/dist/chunks/{dashboard-section.CRn7tlX_.js → dashboard-section.BtqE_6Zy.js} +3 -3
- package/dist/chunks/{dashboard-section.CRn7tlX_.js.map → dashboard-section.BtqE_6Zy.js.map} +1 -1
- package/dist/chunks/{dashed-underline.BoHt4iGu.js → dashed-underline.Cl158pHL.js} +2 -2
- package/dist/chunks/{dashed-underline.BoHt4iGu.js.map → dashed-underline.Cl158pHL.js.map} +1 -1
- package/dist/chunks/{data-grid-template.BYMLOzkm.js → data-grid-template.yOSdF4nN.js} +4 -4
- package/dist/chunks/{data-grid-template.BYMLOzkm.js.map → data-grid-template.yOSdF4nN.js.map} +1 -1
- package/dist/chunks/{data-grid.D_Xu49bl.js → data-grid.D26rPQcn.js} +12 -12
- package/dist/chunks/{data-grid.D_Xu49bl.js.map → data-grid.D26rPQcn.js.map} +1 -1
- package/dist/chunks/{date-picker.bbVKo7JX.js → date-picker.nNtLItmg.js} +6 -6
- package/dist/chunks/{date-picker.bbVKo7JX.js.map → date-picker.nNtLItmg.js.map} +1 -1
- package/dist/chunks/{date-range-picker.AnFyWMCq.js → date-range-picker.DL-oePHl.js} +8 -8
- package/dist/chunks/{date-range-picker.AnFyWMCq.js.map → date-range-picker.DL-oePHl.js.map} +1 -1
- package/dist/chunks/{date-time-picker.Bpxfkj71.js → date-time-picker.D89IemgM.js} +5 -5
- package/dist/chunks/{date-time-picker.Bpxfkj71.js.map → date-time-picker.D89IemgM.js.map} +1 -1
- package/dist/chunks/{dialog-page.BendBRv6.js → dialog-page.D_m11exR.js} +2 -2
- package/dist/chunks/{dialog-page.BendBRv6.js.map → dialog-page.D_m11exR.js.map} +1 -1
- package/dist/chunks/{draggable-handle.BnRkhlee.js → draggable-handle.BDUQTWrd.js} +268 -263
- package/dist/chunks/{draggable-handle.BnRkhlee.js.map → draggable-handle.BDUQTWrd.js.map} +1 -1
- package/dist/chunks/{draggable.D5WFD5eX.js → draggable.Jqy1iXq_.js} +2 -2
- package/dist/chunks/{draggable.D5WFD5eX.js.map → draggable.Jqy1iXq_.js.map} +1 -1
- package/dist/chunks/{dropdown-tag.VcqAOFuG.js → dropdown-tag.CCItycfH.js} +2 -2
- package/dist/chunks/{dropdown-tag.VcqAOFuG.js.map → dropdown-tag.CCItycfH.js.map} +1 -1
- package/dist/chunks/{dropdown.B21PZqp4.js → dropdown.CLHXtH0r.js} +3 -3
- package/dist/chunks/{dropdown.B21PZqp4.js.map → dropdown.CLHXtH0r.js.map} +1 -1
- package/dist/chunks/{empty-state.Dttc-ZO_.js → empty-state.Be3Np0rd.js} +2 -2
- package/dist/chunks/{empty-state.Dttc-ZO_.js.map → empty-state.Be3Np0rd.js.map} +1 -1
- package/dist/chunks/{file-uploader.BLoJVqZQ.js → file-uploader.C1GuWVEI.js} +3 -3
- package/dist/chunks/{file-uploader.BLoJVqZQ.js.map → file-uploader.C1GuWVEI.js.map} +1 -1
- package/dist/chunks/{filter-bar.CY9xbtNy.js → filter-bar.Dq3fo3rZ.js} +1316 -1224
- package/dist/chunks/filter-bar.Dq3fo3rZ.js.map +1 -0
- package/dist/chunks/{fixed-scroller.4xAzt_OI.js → fixed-scroller.BFuYW-M3.js} +2 -2
- package/dist/chunks/{fixed-scroller.4xAzt_OI.js.map → fixed-scroller.BFuYW-M3.js.map} +1 -1
- package/dist/chunks/{footer-actions.C89dbDV4.js → footer-actions.BB94G3iB.js} +3 -3
- package/dist/chunks/{footer-actions.C89dbDV4.js.map → footer-actions.BB94G3iB.js.map} +1 -1
- package/dist/chunks/{form-layout-title.xrix5vY3.js → form-layout-title.DLvU9CD1.js} +2 -2
- package/dist/chunks/{form-layout-title.xrix5vY3.js.map → form-layout-title.DLvU9CD1.js.map} +1 -1
- package/dist/chunks/{header-meta.Cpk3Z8c2.js → header-meta.Bq8moJ6A.js} +2 -2
- package/dist/chunks/{header-meta.Cpk3Z8c2.js.map → header-meta.Bq8moJ6A.js.map} +1 -1
- package/dist/chunks/{header-with-views.BQEJxWz0.js → header-with-views.yjk4GuOn.js} +8 -8
- package/dist/chunks/{header-with-views.BQEJxWz0.js.map → header-with-views.yjk4GuOn.js.map} +1 -1
- package/dist/chunks/{header.BRBY9Ilh.js → header.C8dI-yo1.js} +3 -3
- package/dist/chunks/{header.BRBY9Ilh.js.map → header.C8dI-yo1.js.map} +1 -1
- package/dist/chunks/{input-field-password.WBxRJUhP.js → input-field-password.Dkty2s5M.js} +4 -4
- package/dist/chunks/{input-field-password.WBxRJUhP.js.map → input-field-password.Dkty2s5M.js.map} +1 -1
- package/dist/chunks/{input-field-phone-number.DR6dpYYz.js → input-field-phone-number.CdT4hLCR.js} +2 -2
- package/dist/chunks/{input-field-phone-number.DR6dpYYz.js.map → input-field-phone-number.CdT4hLCR.js.map} +1 -1
- package/dist/chunks/{input-field.y5qXcCAH.js → input-field.3BC9gdvi.js} +36 -26
- package/dist/chunks/{input-field.y5qXcCAH.js.map → input-field.3BC9gdvi.js.map} +1 -1
- package/dist/chunks/{input-time.DrJ3n7Cc.js → input-time.OTVaDCFj.js} +3 -3
- package/dist/chunks/{input-time.DrJ3n7Cc.js.map → input-time.OTVaDCFj.js.map} +1 -1
- package/dist/chunks/{inspector.8QKfd0HF.js → inspector.Cas-Z-VC.js} +2 -2
- package/dist/chunks/{inspector.8QKfd0HF.js.map → inspector.Cas-Z-VC.js.map} +1 -1
- package/dist/chunks/{list-item.BO75rSht.js → list-item.Cf3IFDnG.js} +2 -2
- package/dist/chunks/{list-item.BO75rSht.js.map → list-item.Cf3IFDnG.js.map} +1 -1
- package/dist/chunks/{modal-fullscreen.CH2wwAtk.js → modal-fullscreen.B1iYD7lc.js} +5 -5
- package/dist/chunks/{modal-fullscreen.CH2wwAtk.js.map → modal-fullscreen.B1iYD7lc.js.map} +1 -1
- package/dist/chunks/{modal.e1Ym209E.js → modal.Cp2cNQbD.js} +5 -5
- package/dist/chunks/{modal.e1Ym209E.js.map → modal.Cp2cNQbD.js.map} +1 -1
- package/dist/chunks/{navigation-menu-group.E1Oam9-n.js → navigation-menu-group.Dvs0wWHC.js} +2 -2
- package/dist/chunks/{navigation-menu-group.E1Oam9-n.js.map → navigation-menu-group.Dvs0wWHC.js.map} +1 -1
- package/dist/chunks/{pagination.CxW1zuWi.js → pagination.9fxG-UWo.js} +3 -3
- package/dist/chunks/{pagination.CxW1zuWi.js.map → pagination.9fxG-UWo.js.map} +1 -1
- package/dist/chunks/{promo-banner.BVBt9w4u.js → promo-banner.eVbU1xqj.js} +2 -2
- package/dist/chunks/{promo-banner.BVBt9w4u.js.map → promo-banner.eVbU1xqj.js.map} +1 -1
- package/dist/chunks/{rich-text-editor.VWCBSRmM.js → rich-text-editor.DYfdUHI6.js} +2 -2
- package/dist/chunks/{rich-text-editor.VWCBSRmM.js.map → rich-text-editor.DYfdUHI6.js.map} +1 -1
- package/dist/chunks/{search-bar.nRiF5eNx.js → search-bar.d8qlBngk.js} +3 -3
- package/dist/chunks/{search-bar.nRiF5eNx.js.map → search-bar.d8qlBngk.js.map} +1 -1
- package/dist/chunks/{secondary-nav.BlI1PBNr.js → secondary-nav.BQ6DM8_b.js} +3 -3
- package/dist/chunks/{secondary-nav.BlI1PBNr.js.map → secondary-nav.BQ6DM8_b.js.map} +1 -1
- package/dist/chunks/{sidepanel.CN_u-b5X.js → sidepanel.CUqjE_-9.js} +5 -5
- package/dist/chunks/{sidepanel.CN_u-b5X.js.map → sidepanel.CUqjE_-9.js.map} +1 -1
- package/dist/chunks/{structured-list-item.CL1jhdTX.js → structured-list-item.jO4KtMuc.js} +3 -3
- package/dist/chunks/{structured-list-item.CL1jhdTX.js.map → structured-list-item.jO4KtMuc.js.map} +1 -1
- package/dist/chunks/{summary-grid.types.Cjrwg4vd.js → summary-grid.types.BsjF5xAH.js} +3 -3
- package/dist/chunks/{summary-grid.types.Cjrwg4vd.js.map → summary-grid.types.BsjF5xAH.js.map} +1 -1
- package/dist/chunks/{tab.B2qRfTqx.js → tab.qhcMgSD1.js} +2 -2
- package/dist/chunks/{tab.B2qRfTqx.js.map → tab.qhcMgSD1.js.map} +1 -1
- package/dist/chunks/{textarea.CbCrtcQ2.js → textarea.BOQbOPm4.js} +2 -2
- package/dist/chunks/{textarea.CbCrtcQ2.js.map → textarea.BOQbOPm4.js.map} +1 -1
- package/dist/chunks/{timeline-item.BVOztUi9.js → timeline-item.DXhpupK_.js} +6 -6
- package/dist/chunks/{timeline-item.BVOztUi9.js.map → timeline-item.DXhpupK_.js.map} +1 -1
- package/dist/chunks/{toast.BMGR5QrI.js → toast.BDV4ab4e.js} +2 -2
- package/dist/chunks/{toast.BMGR5QrI.js.map → toast.BDV4ab4e.js.map} +1 -1
- package/dist/chunks/{tutorial.WeP9PjhU.js → tutorial.CAcBuXib.js} +2 -2
- package/dist/chunks/{tutorial.WeP9PjhU.js.map → tutorial.CAcBuXib.js.map} +1 -1
- package/dist/chunks/{use-date-input-formatter.DhduXYC3.js → use-date-input-formatter.BR_O2GeY.js} +2 -2
- package/dist/chunks/{use-date-input-formatter.DhduXYC3.js.map → use-date-input-formatter.BR_O2GeY.js.map} +1 -1
- package/dist/code-snippet.js +1 -1
- package/dist/dashboard-template.js +1 -1
- package/dist/dashed-underline.js +1 -1
- package/dist/data-grid-template.js +1 -1
- package/dist/data-grid.js +1 -1
- package/dist/date-picker.js +2 -2
- package/dist/date-range-picker.js +2 -2
- package/dist/date-time-picker.js +1 -1
- package/dist/draggable.js +2 -2
- package/dist/dropdown.js +2 -2
- package/dist/empty-state.js +1 -1
- package/dist/file-uploader.js +1 -1
- package/dist/filter-bar.js +1 -1
- package/dist/form-layout.js +1 -1
- package/dist/header-with-views.js +1 -1
- package/dist/header.js +1 -1
- package/dist/index.js +50 -50
- package/dist/input-field-password.js +1 -1
- package/dist/input-field-phone-number.js +1 -1
- package/dist/input-field.js +1 -1
- package/dist/input-time.js +1 -1
- package/dist/inspector.js +1 -1
- package/dist/internal.js +8 -8
- package/dist/list.js +1 -1
- package/dist/menu.js +1 -1
- package/dist/modal-fullscreen.js +1 -1
- package/dist/modal.js +2 -2
- package/dist/navigation-menu.js +1 -1
- package/dist/pagination.js +1 -1
- package/dist/popover.js +1 -1
- package/dist/promo-banner.js +1 -1
- package/dist/rich-text-editor.js +1 -1
- package/dist/search-bar.js +2 -2
- package/dist/secondary-nav.js +1 -1
- package/dist/sidepanel.js +1 -1
- package/dist/structured-list.js +1 -1
- package/dist/summary-grid.js +1 -1
- package/dist/tabs.js +1 -1
- package/dist/textarea.js +1 -1
- package/dist/timeline.js +1 -1
- package/dist/toast.js +1 -1
- package/dist/tutorial.js +1 -1
- package/dist/web-types.json +97 -76
- package/package.json +4 -4
- package/dist/chunks/button.DITA6YtS.js +0 -110
- package/dist/chunks/button.DITA6YtS.js.map +0 -1
- package/dist/chunks/filter-bar.CY9xbtNy.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { defineComponent as k, ref as M, computed as i, watch as x, nextTick as E } from "vue";
|
|
2
2
|
import { s as J, a as P } from "./set-time-in-date.CU7HeZLY.js";
|
|
3
|
-
import { e as G, s as S } from "./calendar.
|
|
4
|
-
import { B as q } from "./date-picker.
|
|
5
|
-
import { B as z, i as B } from "./input-time.
|
|
3
|
+
import { e as G, s as S } from "./calendar.BKddGc3j.js";
|
|
4
|
+
import { B as q } from "./date-picker.nNtLItmg.js";
|
|
5
|
+
import { B as z, i as B } from "./input-time.OTVaDCFj.js";
|
|
6
6
|
import "./index.Cl4_42j5.js";
|
|
7
|
-
import { u as U } from "./use-date-input-formatter.
|
|
7
|
+
import { u as U } from "./use-date-input-formatter.BR_O2GeY.js";
|
|
8
8
|
import { u as R } from "./use-touch-device.DTqFAbXh.js";
|
|
9
9
|
import { u as j } from "./index.B6WW_F-J.js";
|
|
10
10
|
import { B as L } from "./form-layout-group.zE6TNlzD.js";
|
|
@@ -192,4 +192,4 @@ const Ye = K.exports;
|
|
|
192
192
|
export {
|
|
193
193
|
Ye as d
|
|
194
194
|
};
|
|
195
|
-
//# sourceMappingURL=date-time-picker.
|
|
195
|
+
//# sourceMappingURL=date-time-picker.D89IemgM.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-time-picker.Bpxfkj71.js","sources":["../../src/components/date-time-picker/date-time-picker.vue"],"sourcesContent":["<template>\n <div class=\"b-date-time-picker\">\n <bento-form-layout-group class=\"b-date-time-picker__inputs\" layout=\"50-50\" :error-message=\"props.errorMessage\">\n <bento-date-picker\n class=\"b-date-time-picker__date-input\"\n v-bind=\"resolvedDateProps\"\n :model-value=\"dateValue\"\n @update:model-value=\"onDateChanged\"\n />\n <bento-input-time\n class=\"b-date-time-picker__time-input\"\n v-bind=\"resolvedTimeProps\"\n :model-value=\"timeValue\"\n @update:model-value=\"onTimeChanged\"\n />\n </bento-form-layout-group>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, nextTick, ref, watch } from 'vue';\n import { setMilliseconds } from 'date-fns/setMilliseconds';\n import { startOfDay } from 'date-fns/startOfDay';\n\n // Components\n import { BentoDatePicker } from '@/components/date-picker';\n import { BentoFormLayoutGroup } from '@/components/form-layout';\n import { BentoInputTime } from '@/components/input-time';\n\n // Utils\n import { useDateInputFormatter, useTouchDevice } from '@/composables';\n import { useI18n } from '@/utils/ts/i18n';\n import { dateToTimeInputString, setTimeInDateObject } from '@/utils/ts/format-date';\n import { isValidTimeString } from '@/utils/ts/time-input';\n\n // Types\n import type {\n BentoDateTimePickerEmits,\n BentoDateTimePickerProps,\n BentoDateTimePickerValue,\n } from './date-time-picker.types';\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const props = defineProps({\n modelValue: { default: null },\n disabled: { type: Boolean, default: false },\n errorMessage: { default: null },\n isDateDisabled: { default: undefined },\n max: { default: null },\n min: { default: null },\n readonly: { type: Boolean, default: false },\n required: { type: Boolean, default: false },\n dateProps: { default: () => ({}) },\n timeProps: { default: () => ({}) }\n});\n\n const emit = defineEmits([\"update:model-value\", \"input:valid\", \"input:error\"]);\n const currentDate = ref<Date | null>(null);\n const currentTimeText = ref('');\n const dateError = ref<keyof MessageSchema | null>(null);\n const timeError = ref<keyof MessageSchema | null>(null);\n const { dateFormat } = useDateInputFormatter();\n const { isTouchDevice } = useTouchDevice();\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const dateValue = computed(() => currentDate.value);\n const timeValue = computed(() => currentTimeText.value);\n const resolvedIsDateDisabled = computed(() => props.dateProps?.isDateDisabled ?? props.isDateDisabled);\n const dateDescription = computed(() => {\n if (isTouchDevice.value) {\n return props.dateProps?.description;\n } else {\n return props.dateProps?.description\n ? `${props.dateProps.description} ${t(dateFormat.value)}`\n : t(dateFormat.value);\n }\n });\n\n const isMergedDateInBounds = (date: Date) => {\n if (resolvedIsDateDisabled.value?.(startOfDay(date))) {\n return false;\n }\n\n if (props.min && date < setMilliseconds(props.min, 0)) {\n return false;\n }\n\n if (props.max && date > setMilliseconds(props.max, 0)) {\n return false;\n }\n\n return true;\n };\n\n const resolvedDateProps = computed(() => ({\n disabled: props.disabled,\n isDateDisabled: props.isDateDisabled,\n max: props.max,\n min: props.min,\n readonly: props.readonly,\n required: props.required,\n errorMessage: dateErrorMessage.value,\n ...props.dateProps,\n description: dateDescription.value,\n }));\n\n const resolvedTimeProps = computed(() => ({\n disabled: props.disabled,\n errorMessage: timeErrorMessage.value,\n readonly: props.readonly,\n required: props.required,\n ...props.timeProps,\n }));\n\n const dateErrorMessage = computed(() => {\n if (props.errorMessage) {\n return props.errorMessage;\n }\n return dateError.value ? t(dateError.value) : null;\n });\n\n const timeErrorMessage = computed(() => {\n if (props.errorMessage) {\n return props.errorMessage;\n }\n return timeError.value ? t(timeError.value) : null;\n });\n\n const clearErrors = () => {\n dateError.value = null;\n timeError.value = null;\n };\n\n /**\n * Guards the modelValue watcher from clearing user input when the null was emitted\n * by our own validation logic (e.g. partial/invalid input). Without this flag,\n * the parent's v-model round-trip would trigger the watcher and wipe the fields.\n * Reset on nextTick so that genuine external resets (e.g. a form clear button)\n * still clear the UI.\n */\n const isSelfEmittedUpdate = ref(false);\n\n watch(\n () => props.modelValue,\n newValue => {\n if (isSelfEmittedUpdate.value) {\n return;\n }\n\n if (newValue) {\n // Sync internal state when a valid Date is set (e.g. programmatic update from parent)\n currentDate.value = newValue;\n currentTimeText.value = dateToTimeInputString(newValue);\n } else {\n // External reset (e.g. parent sets modelValue to null via a form clear button):\n // clear all internal state so the UI resets fully.\n currentDate.value = null;\n currentTimeText.value = '';\n clearErrors();\n }\n },\n { immediate: true }\n );\n\n const validateBounds = (value: BentoDateTimePickerValue) => !value || isMergedDateInBounds(value);\n\n const emitValidationState = (isValid: boolean) => {\n if (isValid) {\n emit('input:valid');\n } else {\n emit('input:error');\n }\n };\n\n const emitModelValue = (value: BentoDateTimePickerValue) => {\n isSelfEmittedUpdate.value = true;\n emit('update:model-value', value);\n nextTick(() => {\n isSelfEmittedUpdate.value = false;\n });\n };\n\n const emitValidatedValue = (value: BentoDateTimePickerValue) => {\n emitModelValue(value);\n emitValidationState(validateBounds(value));\n };\n\n const emitInvalidModelValue = (value: BentoDateTimePickerValue) => {\n emitModelValue(value);\n emitValidationState(false);\n };\n\n const onDateChanged = (date: Date | null) => {\n currentDate.value = date;\n\n // Date invalid/cleared: error if time is populated, valid if both empty\n if (!date) {\n if (currentTimeText.value) {\n dateError.value = 'invalidDateFormat';\n emitInvalidModelValue(null);\n } else {\n clearErrors();\n emitValidatedValue(null);\n }\n return;\n }\n\n clearErrors();\n\n // Prefill time with midnight when empty so the user sees a value\n if (!currentTimeText.value) {\n currentTimeText.value = '00:00:00';\n }\n\n const time = currentTimeText.value;\n\n // Date valid but time invalid: preserve date, signal error\n if (!isValidTimeString(time)) {\n emitInvalidModelValue(null);\n return;\n }\n\n // Both valid: merge and emit\n emitValidatedValue(setTimeInDateObject(date, time));\n };\n\n const onTimeChanged = (time: string) => {\n currentTimeText.value = time;\n\n // Time cleared: error if date is set (time is required once prefilled), valid-null if both empty\n if (!time) {\n if (currentDate.value) {\n timeError.value = 'enterTimeForDate';\n emitInvalidModelValue(null);\n } else {\n clearErrors();\n emitValidatedValue(null);\n }\n return;\n }\n\n timeError.value = null;\n\n // Time invalid: preserve date, signal error\n if (!isValidTimeString(time)) {\n emitInvalidModelValue(null);\n return;\n }\n\n // Time valid but no date: signal error\n if (!currentDate.value) {\n dateError.value = 'invalidDateFormat';\n emitInvalidModelValue(null);\n return;\n }\n\n // Both valid: merge and emit\n emitValidatedValue(setTimeInDateObject(currentDate.value, time));\n };\n</script>\n\n<script lang=\"ts\">\n /**\n * Date time picker that combines a date picker (single date) with a time input.\n *\n * @example\n * import { BentoDateTimePicker } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoDateTimePicker },\n * template: `\n * <bento-date-time-picker\n * :date-props=\"{ label: 'Date' }\"\n * :time-props=\"{ label: 'Time' }\"\n * required\n * :model-value=\"dateTimeValue\"\n * @update:model-value=\"newValue => dateTimeValue = newValue\"\n * />\n * `\n * }\n */\n export default {\n i18n: { messages },\n name: 'bento-date-time-picker',\n inheritAttrs: false,\n model: { prop: 'modelValue', event: 'update:model-value' },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./date-time-picker.scss\" />\n"],"names":["__default__","messages","currentDate","ref","currentTimeText","dateError","timeError","dateFormat","useDateInputFormatter","isTouchDevice","useTouchDevice","t","useI18n","dateValue","computed","timeValue","resolvedIsDateDisabled","_a","props","dateDescription","_b","isMergedDateInBounds","date","startOfDay","setMilliseconds","resolvedDateProps","dateErrorMessage","resolvedTimeProps","timeErrorMessage","clearErrors","isSelfEmittedUpdate","watch","newValue","dateToTimeInputString","validateBounds","value","emitValidationState","isValid","emit","emitModelValue","nextTick","emitValidatedValue","emitInvalidModelValue","time","isValidTimeString","setTimeInDateObject"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2RIA,IAAA;AAAA,EAAe,MAAA,EAAA,UAAAC,EAAA;AAAA,EACM,MAAA;AAAA,EACX,cAAA;AAAA,EACQ,OAAA,EAAA,MAAA,cAAA,OAAA,qBAAA;AAElB;;;;;;;;;;;;;;;;iBArOAC,IAAAC,EAAA,IAAA,GACA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A,MAAA;AAGJ,MAAAZ,EAAA,GAGAzB,EAAA,UACIA,EAAA,QAAA;AAGJ,YAAAuC,IAAAvC,EAAA;AAGA,UAAA,CAAAwC,EAAAD,CAAA,GAAA;AACI,QAAAD,EAAA,IAAA;AACA;AAAA,MAAA;AAIJ,MAAAD,EAAAI,EAAAvB,GAAAqB,CAAA,CAAA;AAAA,IAAkD,kBAGtD,CAAAA,MAAA;AAII,UAHAvC,EAAA,QAAAuC,GAGA,CAAAA,GAAA;AACI,QAAAzC,EAAA,SACII,EAAA,QAAA,oBACAoC,EAAA,IAAA,MAEAb,EAAA,GACAY,EAAA,IAAA;AAEJ;AAAA,MAAA;AAMJ,UAHAnC,EAAA,QAAA,MAGA,CAAAsC,EAAAD,CAAA,GAAA;AACI,QAAAD,EAAA,IAAA;AACA;AAAA,MAAA;AAIJ,UAAA,CAAAxC,EAAA,OAAA;AACI,QAAAG,EAAA,QAAA,qBACAqC,EAAA,IAAA;AACA;AAAA,MAAA;AAIJ,MAAAD,EAAAI,EAAA3C,EAAA,OAAAyC,CAAA,CAAA;AAAA,IAA+D;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"date-time-picker.D89IemgM.js","sources":["../../src/components/date-time-picker/date-time-picker.vue"],"sourcesContent":["<template>\n <div class=\"b-date-time-picker\">\n <bento-form-layout-group class=\"b-date-time-picker__inputs\" layout=\"50-50\" :error-message=\"props.errorMessage\">\n <bento-date-picker\n class=\"b-date-time-picker__date-input\"\n v-bind=\"resolvedDateProps\"\n :model-value=\"dateValue\"\n @update:model-value=\"onDateChanged\"\n />\n <bento-input-time\n class=\"b-date-time-picker__time-input\"\n v-bind=\"resolvedTimeProps\"\n :model-value=\"timeValue\"\n @update:model-value=\"onTimeChanged\"\n />\n </bento-form-layout-group>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, nextTick, ref, watch } from 'vue';\n import { setMilliseconds } from 'date-fns/setMilliseconds';\n import { startOfDay } from 'date-fns/startOfDay';\n\n // Components\n import { BentoDatePicker } from '@/components/date-picker';\n import { BentoFormLayoutGroup } from '@/components/form-layout';\n import { BentoInputTime } from '@/components/input-time';\n\n // Utils\n import { useDateInputFormatter, useTouchDevice } from '@/composables';\n import { useI18n } from '@/utils/ts/i18n';\n import { dateToTimeInputString, setTimeInDateObject } from '@/utils/ts/format-date';\n import { isValidTimeString } from '@/utils/ts/time-input';\n\n // Types\n import type {\n BentoDateTimePickerEmits,\n BentoDateTimePickerProps,\n BentoDateTimePickerValue,\n } from './date-time-picker.types';\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const props = defineProps({\n modelValue: { default: null },\n disabled: { type: Boolean, default: false },\n errorMessage: { default: null },\n isDateDisabled: { default: undefined },\n max: { default: null },\n min: { default: null },\n readonly: { type: Boolean, default: false },\n required: { type: Boolean, default: false },\n dateProps: { default: () => ({}) },\n timeProps: { default: () => ({}) }\n});\n\n const emit = defineEmits([\"update:model-value\", \"input:valid\", \"input:error\"]);\n const currentDate = ref<Date | null>(null);\n const currentTimeText = ref('');\n const dateError = ref<keyof MessageSchema | null>(null);\n const timeError = ref<keyof MessageSchema | null>(null);\n const { dateFormat } = useDateInputFormatter();\n const { isTouchDevice } = useTouchDevice();\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const dateValue = computed(() => currentDate.value);\n const timeValue = computed(() => currentTimeText.value);\n const resolvedIsDateDisabled = computed(() => props.dateProps?.isDateDisabled ?? props.isDateDisabled);\n const dateDescription = computed(() => {\n if (isTouchDevice.value) {\n return props.dateProps?.description;\n } else {\n return props.dateProps?.description\n ? `${props.dateProps.description} ${t(dateFormat.value)}`\n : t(dateFormat.value);\n }\n });\n\n const isMergedDateInBounds = (date: Date) => {\n if (resolvedIsDateDisabled.value?.(startOfDay(date))) {\n return false;\n }\n\n if (props.min && date < setMilliseconds(props.min, 0)) {\n return false;\n }\n\n if (props.max && date > setMilliseconds(props.max, 0)) {\n return false;\n }\n\n return true;\n };\n\n const resolvedDateProps = computed(() => ({\n disabled: props.disabled,\n isDateDisabled: props.isDateDisabled,\n max: props.max,\n min: props.min,\n readonly: props.readonly,\n required: props.required,\n errorMessage: dateErrorMessage.value,\n ...props.dateProps,\n description: dateDescription.value,\n }));\n\n const resolvedTimeProps = computed(() => ({\n disabled: props.disabled,\n errorMessage: timeErrorMessage.value,\n readonly: props.readonly,\n required: props.required,\n ...props.timeProps,\n }));\n\n const dateErrorMessage = computed(() => {\n if (props.errorMessage) {\n return props.errorMessage;\n }\n return dateError.value ? t(dateError.value) : null;\n });\n\n const timeErrorMessage = computed(() => {\n if (props.errorMessage) {\n return props.errorMessage;\n }\n return timeError.value ? t(timeError.value) : null;\n });\n\n const clearErrors = () => {\n dateError.value = null;\n timeError.value = null;\n };\n\n /**\n * Guards the modelValue watcher from clearing user input when the null was emitted\n * by our own validation logic (e.g. partial/invalid input). Without this flag,\n * the parent's v-model round-trip would trigger the watcher and wipe the fields.\n * Reset on nextTick so that genuine external resets (e.g. a form clear button)\n * still clear the UI.\n */\n const isSelfEmittedUpdate = ref(false);\n\n watch(\n () => props.modelValue,\n newValue => {\n if (isSelfEmittedUpdate.value) {\n return;\n }\n\n if (newValue) {\n // Sync internal state when a valid Date is set (e.g. programmatic update from parent)\n currentDate.value = newValue;\n currentTimeText.value = dateToTimeInputString(newValue);\n } else {\n // External reset (e.g. parent sets modelValue to null via a form clear button):\n // clear all internal state so the UI resets fully.\n currentDate.value = null;\n currentTimeText.value = '';\n clearErrors();\n }\n },\n { immediate: true }\n );\n\n const validateBounds = (value: BentoDateTimePickerValue) => !value || isMergedDateInBounds(value);\n\n const emitValidationState = (isValid: boolean) => {\n if (isValid) {\n emit('input:valid');\n } else {\n emit('input:error');\n }\n };\n\n const emitModelValue = (value: BentoDateTimePickerValue) => {\n isSelfEmittedUpdate.value = true;\n emit('update:model-value', value);\n nextTick(() => {\n isSelfEmittedUpdate.value = false;\n });\n };\n\n const emitValidatedValue = (value: BentoDateTimePickerValue) => {\n emitModelValue(value);\n emitValidationState(validateBounds(value));\n };\n\n const emitInvalidModelValue = (value: BentoDateTimePickerValue) => {\n emitModelValue(value);\n emitValidationState(false);\n };\n\n const onDateChanged = (date: Date | null) => {\n currentDate.value = date;\n\n // Date invalid/cleared: error if time is populated, valid if both empty\n if (!date) {\n if (currentTimeText.value) {\n dateError.value = 'invalidDateFormat';\n emitInvalidModelValue(null);\n } else {\n clearErrors();\n emitValidatedValue(null);\n }\n return;\n }\n\n clearErrors();\n\n // Prefill time with midnight when empty so the user sees a value\n if (!currentTimeText.value) {\n currentTimeText.value = '00:00:00';\n }\n\n const time = currentTimeText.value;\n\n // Date valid but time invalid: preserve date, signal error\n if (!isValidTimeString(time)) {\n emitInvalidModelValue(null);\n return;\n }\n\n // Both valid: merge and emit\n emitValidatedValue(setTimeInDateObject(date, time));\n };\n\n const onTimeChanged = (time: string) => {\n currentTimeText.value = time;\n\n // Time cleared: error if date is set (time is required once prefilled), valid-null if both empty\n if (!time) {\n if (currentDate.value) {\n timeError.value = 'enterTimeForDate';\n emitInvalidModelValue(null);\n } else {\n clearErrors();\n emitValidatedValue(null);\n }\n return;\n }\n\n timeError.value = null;\n\n // Time invalid: preserve date, signal error\n if (!isValidTimeString(time)) {\n emitInvalidModelValue(null);\n return;\n }\n\n // Time valid but no date: signal error\n if (!currentDate.value) {\n dateError.value = 'invalidDateFormat';\n emitInvalidModelValue(null);\n return;\n }\n\n // Both valid: merge and emit\n emitValidatedValue(setTimeInDateObject(currentDate.value, time));\n };\n</script>\n\n<script lang=\"ts\">\n /**\n * Date time picker that combines a date picker (single date) with a time input.\n *\n * @example\n * import { BentoDateTimePicker } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoDateTimePicker },\n * template: `\n * <bento-date-time-picker\n * :date-props=\"{ label: 'Date' }\"\n * :time-props=\"{ label: 'Time' }\"\n * required\n * :model-value=\"dateTimeValue\"\n * @update:model-value=\"newValue => dateTimeValue = newValue\"\n * />\n * `\n * }\n */\n export default {\n i18n: { messages },\n name: 'bento-date-time-picker',\n inheritAttrs: false,\n model: { prop: 'modelValue', event: 'update:model-value' },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./date-time-picker.scss\" />\n"],"names":["__default__","messages","currentDate","ref","currentTimeText","dateError","timeError","dateFormat","useDateInputFormatter","isTouchDevice","useTouchDevice","t","useI18n","dateValue","computed","timeValue","resolvedIsDateDisabled","_a","props","dateDescription","_b","isMergedDateInBounds","date","startOfDay","setMilliseconds","resolvedDateProps","dateErrorMessage","resolvedTimeProps","timeErrorMessage","clearErrors","isSelfEmittedUpdate","watch","newValue","dateToTimeInputString","validateBounds","value","emitValidationState","isValid","emit","emitModelValue","nextTick","emitValidatedValue","emitInvalidModelValue","time","isValidTimeString","setTimeInDateObject"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2RIA,IAAA;AAAA,EAAe,MAAA,EAAA,UAAAC,EAAA;AAAA,EACM,MAAA;AAAA,EACX,cAAA;AAAA,EACQ,OAAA,EAAA,MAAA,cAAA,OAAA,qBAAA;AAElB;;;;;;;;;;;;;;;;iBArOAC,IAAAC,EAAA,IAAA,GACAC,IAAAD,EAAA,EAAA,GACAE,IAAAF,EAAA,IAAA,GACAG,IAAAH,EAAA,IAAA,GACA,EAAA,YAAAI,EAAA,IAAAC,EAAA,GACA,EAAA,eAAAC,EAAA,IAAAC,EAAA,GACA,EAAA,GAAAC,EAAA,IAAAC,EAAA,GAEAC,IAAAC,EAAA,MAAAZ,EAAA,KAAA,GACAa,IAAAD,EAAA,MAAAV,EAAA,KAAA,GACAY,IAAAF,EAAA,MAAA;;AAAA,eAAAG,IAAAC,EAAA,cAAA,gBAAAD,EAAA,mBAAAC,EAAA;AAAA,KAAA,GACAC,IAAAL,EAAA,MAAA;;AACI,aAAAL,EAAA,SACIQ,IAAAC,EAAA,cAAA,gBAAAD,EAAA,eAEAG,IAAAF,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AAA,GAAA;AACI,QAAAD,EAAA,IAAA;AACA;AAAA,MAAA;AAIJ,UAAA,CAAAxC,EAAA,OAAA;AACI,QAAAG,EAAA,QAAA,qBACAqC,EAAA,IAAA;AACA;AAAA,MAAA;AAIJ,MAAAD,EAAAI,EAAA3C,EAAA,OAAAyC,CAAA,CAAA;AAAA,IAA+D;;;;;;;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as U, useSlots as F, ref as P, computed as n, inject as N, watch as h, nextTick as S, onMounted as H, onUnmounted as J } from "vue";
|
|
2
|
-
import { B as M } from "./button.
|
|
2
|
+
import { B as M } from "./button.Df_UH5wZ.js";
|
|
3
3
|
import { A as z } from "./arrow-left.CRREfabP.js";
|
|
4
4
|
import { u as K } from "./use-has-slot.C9lQZ6nz.js";
|
|
5
5
|
import { u as Y } from "./index.B6WW_F-J.js";
|
|
@@ -140,4 +140,4 @@ export {
|
|
|
140
140
|
q as a,
|
|
141
141
|
de as b
|
|
142
142
|
};
|
|
143
|
-
//# sourceMappingURL=dialog-page.
|
|
143
|
+
//# sourceMappingURL=dialog-page.D_m11exR.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-page.BendBRv6.js","sources":["../../src/components/internal/dialog-page/dialog-page.types.ts","../../src/components/internal/dialog-page/dialog-page.keys.ts","../../src/components/internal/dialog-page/dialog-page.vue"],"sourcesContent":["import { type Ref } from 'vue';\n\nexport enum BentoDialogPageAnimation {\n TRANSITION_LEVEL_DEEPER = 'b-dialog-page__animation--level-deeper',\n TRANSITION_LEVEL_UPPER = 'b-dialog-page__animation--level-upper',\n}\n\nexport interface BentoDialogPageConfigData {\n activePage: Ref<string>;\n animation: Ref<string>;\n isAnimationActive?: Ref<boolean>;\n isOpen: Ref<boolean>;\n pages: Ref<Array<string>>;\n previousPages: Ref<Array<string>>;\n updatePage: (page: string) => void;\n}\n\nexport type BentoDialogPageRegisterPage = (pageId: string) => { unregisterPage: () => void };\n","export const DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY = Symbol('dialog registerPage injection key');\nexport const DIALOG_PAGE_CONFIG_INJECTION_KEY = Symbol('dialog page config data injection key');\n","<template>\n <Transition :name=\"animation\" mode=\"out-in\" @after-leave=\"updateAnimation\" @leave=\"startAnimation\">\n <div v-if=\"isOpen && showPage\" class=\"b-dialog-page\">\n <div v-if=\"hasSlot('header')\" class=\"b-dialog-page__header\" :class=\"headerConditionalClasses\">\n <div\n v-if=\"showBackButton\"\n class=\"b-dialog-page__back-button\"\n :style=\"backButtonStyling\"\n data-testid=\"back-button\"\n >\n <bento-button variant=\"tertiary\" @click=\"goToPreviousPage(previousPage)\">\n <arrow-left-icon :svg-title=\"t('goToPreviousPage')\" />\n </bento-button>\n </div>\n <slot name=\"header\"></slot>\n </div>\n <div\n v-if=\"hasSlot('content')\"\n ref=\"contentElement\"\n class=\"b-dialog-page__content\"\n :tabindex=\"isScrollable ? 0 : null\"\n @scroll=\"onScroll\"\n >\n <slot name=\"content\" />\n </div>\n <div v-if=\"hasSlot('footer')\" class=\"b-dialog-page__footer\" :class=\"footerConditionalClasses\">\n <slot name=\"footer\" />\n </div>\n </div>\n </Transition>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, inject, nextTick, onMounted, onUnmounted, type PropType, ref, useSlots, watch } from 'vue';\n\n import { BentoButton } from '@/components/button';\n import ArrowLeftIcon from '@adyen/ui-assets-icons-16/vue/arrow-left';\n\n import { useHasSlot } from '@/composables/use-has-slot/use-has-slot';\n import { useI18n } from '@/utils/ts/i18n';\n import { isDevelopmentEnviroment } from '@/utils/ts/dev-environment';\n\n import {\n BentoDialogPageAnimation,\n type BentoDialogPageConfigData,\n type BentoDialogPageRegisterPage,\n } from './dialog-page.types';\n import type { CSSProperties } from 'vue/types/jsx.d.ts';\n\n import { DIALOG_PAGE_CONFIG_INJECTION_KEY, DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY } from './dialog-page.keys';\n\n import messages from './messages.json';\n import { useScroll } from '@vueuse/core';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const props = defineProps({\n /**\n * Identifier of the page, used with activePage prop to handle navigation\n */\n pageId: {\n type: String,\n default: undefined,\n },\n\n /**\n * Show header and actions border\n */\n alwaysShowBorder: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Pass custom styling to the back button to position it correctly with the header slot\n */\n backButtonStyling: { type: Object as PropType<CSSProperties>, default: null },\n\n /**\n * ID of the page for the back button to navigate to. Only use it to overwrite the default back behavior\n * Used when the back button should not take the user to the natural previous page\n * Set to `null` to hide back button in the page\n */\n previousPage: {\n type: String,\n default: undefined,\n },\n });\n\n const emit = defineEmits([\"animationend\"]);\n\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n // Refs\n const contentElement = ref<HTMLDivElement>(null);\n const hasScroll = ref(false);\n const isMounted = ref(false);\n\n const { arrivedState } = useScroll(contentElement);\n\n // Logic to choose which page is active/shown\n const showPage = computed(() => (activePage.value ? activePage.value === props.pageId : true));\n\n // Scrolling styling logic\n const headerConditionalClasses = computed(() => ({\n 'b-dialog-page__header--with-border': props.alwaysShowBorder || (hasScroll.value && !arrivedState.top),\n }));\n\n const footerConditionalClasses = computed(() => ({\n 'b-dialog-page__footer--with-border': props.alwaysShowBorder || (hasScroll.value && !arrivedState.bottom),\n }));\n\n const isScrollable = computed(() => !(arrivedState.bottom && arrivedState.top));\n\n const onScroll = () => {\n if (!contentElement.value) {\n return;\n }\n };\n\n const calculateScroll = async watchedValue => {\n if (!watchedValue) {\n return;\n }\n // Wait for content to be rendered to be able to calculate the height\n await nextTick();\n if (!isMounted.value) {\n return;\n }\n hasScroll.value = contentElement.value && contentElement.value.scrollHeight > contentElement.value.clientHeight;\n };\n\n const { activePage, animation, isAnimationActive, isOpen, pages, previousPages, updatePage } =\n inject<BentoDialogPageConfigData>(DIALOG_PAGE_CONFIG_INJECTION_KEY);\n\n watch(() => isOpen.value, calculateScroll, { immediate: true });\n watch(() => showPage.value, calculateScroll, { immediate: true });\n\n // Logic to determine whether the back button should be shown on the page\n const showBackButton = computed(() => {\n if (props.previousPage) {\n return true;\n }\n if (props.previousPage === null) {\n return false;\n }\n return hasPreviousPages.value && showPage.value;\n });\n\n // Animation\n const updateAnimation = () => {\n animation.value = BentoDialogPageAnimation.TRANSITION_LEVEL_DEEPER;\n if (isAnimationActive) {\n isAnimationActive.value = false;\n }\n\n emit('animationend');\n };\n\n const startAnimation = () => {\n if (isAnimationActive) {\n isAnimationActive.value = true;\n }\n };\n\n // Previous page logic\n const hasPreviousPages = computed(() => previousPages.value.length > 1);\n const lastPage = computed(() => previousPages.value[previousPages.value.length - 1]);\n const isActivePageValid = computed(() => pages.value.some(page => page === activePage.value));\n\n const goToPreviousPage = async (page: string) => {\n if (page) {\n const index = previousPages.value.indexOf(page);\n if (index !== -1) {\n previousPages.value = previousPages.value.slice(0, index + 1);\n } else {\n previousPages.value = [page];\n }\n } else {\n previousPages.value.pop();\n }\n\n animation.value = BentoDialogPageAnimation.TRANSITION_LEVEL_UPPER;\n await nextTick();\n if (!isMounted.value) {\n return;\n }\n updatePage(lastPage.value);\n };\n\n // Add new page to the previousPage array to keep track of user navigation\n watch(\n () => activePage.value,\n async () => {\n await nextTick();\n if (!isMounted.value || !isOpen.value) {\n return;\n }\n\n if (!!activePage.value && !isActivePageValid.value) {\n if (isDevelopmentEnviroment) {\n // eslint-disable-next-line no-console\n console.error(\n `The activePage passed \"${activePage.value}\" does not match the id of any of the pages`\n );\n return;\n }\n }\n\n if (activePage.value !== lastPage.value) {\n previousPages.value.push(activePage.value);\n }\n },\n { immediate: true }\n );\n\n // Register page to parent component and inject data from parent component\n const registerPage = inject<BentoDialogPageRegisterPage>(DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY);\n const { unregisterPage } = registerPage(props.pageId);\n\n onMounted(() => {\n isMounted.value = true;\n });\n\n // Unregister page on unmounting the page\n onUnmounted(() => {\n isMounted.value = false;\n unregisterPage();\n });\n</script>\n\n<script lang=\"ts\">\n /**\n * DialogPage is an internal component used to render different pages of dialog components (Modal, ModalFullscreen and Sidepanel)\n *\n * @example\n * import { DialogPage } from '@/internal';\n *\n * export default {\n * components: { DialogPage },\n * template: `\n * <dialog-page pageId='step1' always-show-border>\n * <template #header>Header</template>\n * <template #content>Content</template>\n * <template #footer>Footer</template>\n * </dialog-page>\n * `\n * }\n */\n export default {\n i18n: { messages },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./dialog-page.scss\" />\n"],"names":["BentoDialogPageAnimation","BentoDialogPageAnimation2","DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY","DIALOG_PAGE_CONFIG_INJECTION_KEY","__default__","messages","slots","useSlots","hasSlot","useHasSlot","t","useI18n","contentElement","ref","hasScroll","isMounted","arrivedState","useScroll","showPage","computed","activePage","props","headerConditionalClasses","footerConditionalClasses","isScrollable","onScroll","calculateScroll","watchedValue","nextTick","animation","isAnimationActive","isOpen","pages","previousPages","updatePage","inject","watch","showBackButton","hasPreviousPages","updateAnimation","emit","startAnimation","lastPage","isActivePageValid","page","goToPreviousPage","index","isDevelopmentEnviroment","registerPage","unregisterPage","onMounted","onUnmounted"],"mappings":";;;;;;;;;AAEO,IAAAA,IAAA,kBAAAC,OACHA,EAAA,0BAAA,0CACAA,EAAA,yBAAA,yCAFQA,IAAAD,KAAA,CAAA,CAAA;ACFL,MAAAE,IAAA,uBAAA,mCAAA,GACAC,IAAA,uBAAA,uCAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GC0PHC,KAAA;AAAA,EAAe,MAAA,EAAA,UAAAC,EAAA;AAEf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAlKAC,IAAAC,EAAA,GACAC,IAAAC,EAAAH,CAAA,GACA,EAAA,GAAAI,EAAA,IAAAC,EAAA,GAGAC,IAAAC,EAAA,IAAA,GACAC,IAAAD,EAAA,EAAA,GACAE,IAAAF,EAAA,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AAAA,EAAA,MAAA,SAAA,CAAA,CAAA,GACAU,IAAAxB,EAAA,MAAAa,EAAA,MAAA,KAAA,CAAAY,MAAAA,MAAAxB,EAAA,KAAA,CAAA,GAEAyB,IAAA,OAAAD,MAAA;AACI,UAAAA,GAAA;AACI,cAAAE,IAAAb,EAAA,MAAA,QAAAW,CAAA;AACA,QAAAE,MAAA,KACIb,EAAA,QAAAA,EAAA,MAAA,MAAA,GAAAa,IAAA,CAAA,IAEAb,EAAA,QAAA,CAAAW,CAAA;AAAA,MACJ;AAEA,QAAAX,EAAA,MAAA,IAAA;AAKJ,MAFAJ,EAAA,QAAA7B,EAAA,wBACA,MAAA4B,EAAA,GACAb,EAAA,SAGAmB,EAAAQ,EAAA,KAAA;AAAA,IAAyB;AAI7B,IAAAN;AAAA,MAAA,MAAAhB,EAAA;AAAA,MACqB,YAAA;AAGb,YADA,MAAAQ,EAAA,GACA,GAAAb,EAAA,SAAA,CAAAgB,EAAA,QAIA;AAAA,cAAAX,EAAA,SAAA,CAAAuB,EAAA,SACII,GAAA;AAEI,oBAAA;AAAA,cAAQ,0BAAA3B,EAAA,KAAA;AAAA,YACsC;AAE9C;AAAA,UAAA;AAIR,UAAAA,EAAA,UAAAsB,EAAA,SACIT,EAAA,MAAA,KAAAb,EAAA,KAAA;AAAA;AAAA,MACJ;AAAA,MACJ,EAAA,WAAA,GAAA;AAAA,IACkB;AAItB,UAAA4B,IAAAb,EAAAjC,CAAA,GACA,EAAA,gBAAA+C,EAAA,IAAAD,EAAA3B,EAAA,MAAA;AAEA,WAAA6B,EAAA,MAAA;AACI,MAAAnC,EAAA,QAAA;AAAA,IAAkB,CAAA,GAItBoC,EAAA,MAAA;AACI,MAAApC,EAAA,QAAA,IACAkC,EAAA;AAAA,IAAe,CAAA;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"dialog-page.D_m11exR.js","sources":["../../src/components/internal/dialog-page/dialog-page.types.ts","../../src/components/internal/dialog-page/dialog-page.keys.ts","../../src/components/internal/dialog-page/dialog-page.vue"],"sourcesContent":["import { type Ref } from 'vue';\n\nexport enum BentoDialogPageAnimation {\n TRANSITION_LEVEL_DEEPER = 'b-dialog-page__animation--level-deeper',\n TRANSITION_LEVEL_UPPER = 'b-dialog-page__animation--level-upper',\n}\n\nexport interface BentoDialogPageConfigData {\n activePage: Ref<string>;\n animation: Ref<string>;\n isAnimationActive?: Ref<boolean>;\n isOpen: Ref<boolean>;\n pages: Ref<Array<string>>;\n previousPages: Ref<Array<string>>;\n updatePage: (page: string) => void;\n}\n\nexport type BentoDialogPageRegisterPage = (pageId: string) => { unregisterPage: () => void };\n","export const DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY = Symbol('dialog registerPage injection key');\nexport const DIALOG_PAGE_CONFIG_INJECTION_KEY = Symbol('dialog page config data injection key');\n","<template>\n <Transition :name=\"animation\" mode=\"out-in\" @after-leave=\"updateAnimation\" @leave=\"startAnimation\">\n <div v-if=\"isOpen && showPage\" class=\"b-dialog-page\">\n <div v-if=\"hasSlot('header')\" class=\"b-dialog-page__header\" :class=\"headerConditionalClasses\">\n <div\n v-if=\"showBackButton\"\n class=\"b-dialog-page__back-button\"\n :style=\"backButtonStyling\"\n data-testid=\"back-button\"\n >\n <bento-button variant=\"tertiary\" @click=\"goToPreviousPage(previousPage)\">\n <arrow-left-icon :svg-title=\"t('goToPreviousPage')\" />\n </bento-button>\n </div>\n <slot name=\"header\"></slot>\n </div>\n <div\n v-if=\"hasSlot('content')\"\n ref=\"contentElement\"\n class=\"b-dialog-page__content\"\n :tabindex=\"isScrollable ? 0 : null\"\n @scroll=\"onScroll\"\n >\n <slot name=\"content\" />\n </div>\n <div v-if=\"hasSlot('footer')\" class=\"b-dialog-page__footer\" :class=\"footerConditionalClasses\">\n <slot name=\"footer\" />\n </div>\n </div>\n </Transition>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, inject, nextTick, onMounted, onUnmounted, type PropType, ref, useSlots, watch } from 'vue';\n\n import { BentoButton } from '@/components/button';\n import ArrowLeftIcon from '@adyen/ui-assets-icons-16/vue/arrow-left';\n\n import { useHasSlot } from '@/composables/use-has-slot/use-has-slot';\n import { useI18n } from '@/utils/ts/i18n';\n import { isDevelopmentEnviroment } from '@/utils/ts/dev-environment';\n\n import {\n BentoDialogPageAnimation,\n type BentoDialogPageConfigData,\n type BentoDialogPageRegisterPage,\n } from './dialog-page.types';\n import type { CSSProperties } from 'vue/types/jsx.d.ts';\n\n import { DIALOG_PAGE_CONFIG_INJECTION_KEY, DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY } from './dialog-page.keys';\n\n import messages from './messages.json';\n import { useScroll } from '@vueuse/core';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const props = defineProps({\n /**\n * Identifier of the page, used with activePage prop to handle navigation\n */\n pageId: {\n type: String,\n default: undefined,\n },\n\n /**\n * Show header and actions border\n */\n alwaysShowBorder: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Pass custom styling to the back button to position it correctly with the header slot\n */\n backButtonStyling: { type: Object as PropType<CSSProperties>, default: null },\n\n /**\n * ID of the page for the back button to navigate to. Only use it to overwrite the default back behavior\n * Used when the back button should not take the user to the natural previous page\n * Set to `null` to hide back button in the page\n */\n previousPage: {\n type: String,\n default: undefined,\n },\n });\n\n const emit = defineEmits([\"animationend\"]);\n\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n // Refs\n const contentElement = ref<HTMLDivElement>(null);\n const hasScroll = ref(false);\n const isMounted = ref(false);\n\n const { arrivedState } = useScroll(contentElement);\n\n // Logic to choose which page is active/shown\n const showPage = computed(() => (activePage.value ? activePage.value === props.pageId : true));\n\n // Scrolling styling logic\n const headerConditionalClasses = computed(() => ({\n 'b-dialog-page__header--with-border': props.alwaysShowBorder || (hasScroll.value && !arrivedState.top),\n }));\n\n const footerConditionalClasses = computed(() => ({\n 'b-dialog-page__footer--with-border': props.alwaysShowBorder || (hasScroll.value && !arrivedState.bottom),\n }));\n\n const isScrollable = computed(() => !(arrivedState.bottom && arrivedState.top));\n\n const onScroll = () => {\n if (!contentElement.value) {\n return;\n }\n };\n\n const calculateScroll = async watchedValue => {\n if (!watchedValue) {\n return;\n }\n // Wait for content to be rendered to be able to calculate the height\n await nextTick();\n if (!isMounted.value) {\n return;\n }\n hasScroll.value = contentElement.value && contentElement.value.scrollHeight > contentElement.value.clientHeight;\n };\n\n const { activePage, animation, isAnimationActive, isOpen, pages, previousPages, updatePage } =\n inject<BentoDialogPageConfigData>(DIALOG_PAGE_CONFIG_INJECTION_KEY);\n\n watch(() => isOpen.value, calculateScroll, { immediate: true });\n watch(() => showPage.value, calculateScroll, { immediate: true });\n\n // Logic to determine whether the back button should be shown on the page\n const showBackButton = computed(() => {\n if (props.previousPage) {\n return true;\n }\n if (props.previousPage === null) {\n return false;\n }\n return hasPreviousPages.value && showPage.value;\n });\n\n // Animation\n const updateAnimation = () => {\n animation.value = BentoDialogPageAnimation.TRANSITION_LEVEL_DEEPER;\n if (isAnimationActive) {\n isAnimationActive.value = false;\n }\n\n emit('animationend');\n };\n\n const startAnimation = () => {\n if (isAnimationActive) {\n isAnimationActive.value = true;\n }\n };\n\n // Previous page logic\n const hasPreviousPages = computed(() => previousPages.value.length > 1);\n const lastPage = computed(() => previousPages.value[previousPages.value.length - 1]);\n const isActivePageValid = computed(() => pages.value.some(page => page === activePage.value));\n\n const goToPreviousPage = async (page: string) => {\n if (page) {\n const index = previousPages.value.indexOf(page);\n if (index !== -1) {\n previousPages.value = previousPages.value.slice(0, index + 1);\n } else {\n previousPages.value = [page];\n }\n } else {\n previousPages.value.pop();\n }\n\n animation.value = BentoDialogPageAnimation.TRANSITION_LEVEL_UPPER;\n await nextTick();\n if (!isMounted.value) {\n return;\n }\n updatePage(lastPage.value);\n };\n\n // Add new page to the previousPage array to keep track of user navigation\n watch(\n () => activePage.value,\n async () => {\n await nextTick();\n if (!isMounted.value || !isOpen.value) {\n return;\n }\n\n if (!!activePage.value && !isActivePageValid.value) {\n if (isDevelopmentEnviroment) {\n // eslint-disable-next-line no-console\n console.error(\n `The activePage passed \"${activePage.value}\" does not match the id of any of the pages`\n );\n return;\n }\n }\n\n if (activePage.value !== lastPage.value) {\n previousPages.value.push(activePage.value);\n }\n },\n { immediate: true }\n );\n\n // Register page to parent component and inject data from parent component\n const registerPage = inject<BentoDialogPageRegisterPage>(DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY);\n const { unregisterPage } = registerPage(props.pageId);\n\n onMounted(() => {\n isMounted.value = true;\n });\n\n // Unregister page on unmounting the page\n onUnmounted(() => {\n isMounted.value = false;\n unregisterPage();\n });\n</script>\n\n<script lang=\"ts\">\n /**\n * DialogPage is an internal component used to render different pages of dialog components (Modal, ModalFullscreen and Sidepanel)\n *\n * @example\n * import { DialogPage } from '@/internal';\n *\n * export default {\n * components: { DialogPage },\n * template: `\n * <dialog-page pageId='step1' always-show-border>\n * <template #header>Header</template>\n * <template #content>Content</template>\n * <template #footer>Footer</template>\n * </dialog-page>\n * `\n * }\n */\n export default {\n i18n: { messages },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./dialog-page.scss\" />\n"],"names":["BentoDialogPageAnimation","BentoDialogPageAnimation2","DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY","DIALOG_PAGE_CONFIG_INJECTION_KEY","__default__","messages","slots","useSlots","hasSlot","useHasSlot","t","useI18n","contentElement","ref","hasScroll","isMounted","arrivedState","useScroll","showPage","computed","activePage","props","headerConditionalClasses","footerConditionalClasses","isScrollable","onScroll","calculateScroll","watchedValue","nextTick","animation","isAnimationActive","isOpen","pages","previousPages","updatePage","inject","watch","showBackButton","hasPreviousPages","updateAnimation","emit","startAnimation","lastPage","isActivePageValid","page","goToPreviousPage","index","isDevelopmentEnviroment","registerPage","unregisterPage","onMounted","onUnmounted"],"mappings":";;;;;;;;;AAEO,IAAAA,IAAA,kBAAAC,OACHA,EAAA,0BAAA,0CACAA,EAAA,y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