@adyen/bento-vue3 1.74.0 → 1.75.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.
Files changed (83) hide show
  1. package/dist/@types/index.d.ts +1660 -614
  2. package/dist/assets/accordion-item.css +1 -1
  3. package/dist/assets/action-bar.css +1 -1
  4. package/dist/assets/base-modal.css +1 -1
  5. package/dist/assets/button-actions.css +1 -1
  6. package/dist/assets/card.css +1 -1
  7. package/dist/assets/data-grid-template.css +1 -1
  8. package/dist/assets/data-grid.css +1 -1
  9. package/dist/assets/dialog-page.css +1 -1
  10. package/dist/assets/dropdown-tag.css +1 -1
  11. package/dist/assets/file-uploader.css +1 -1
  12. package/dist/assets/filter-bar.css +1 -1
  13. package/dist/assets/input-field-password.css +1 -1
  14. package/dist/assets/input-field.css +1 -1
  15. package/dist/assets/inspector.css +1 -1
  16. package/dist/assets/modal-fullscreen.css +1 -1
  17. package/dist/assets/selection-card-group.css +1 -1
  18. package/dist/assets/sidepanel.css +1 -1
  19. package/dist/assets/use-cached-selected-values.css +1 -1
  20. package/dist/chunks/{code-snippet.CO78Nfj0.js → code-snippet.Bjf1ma1L.js} +2 -2
  21. package/dist/chunks/{code-snippet.CO78Nfj0.js.map → code-snippet.Bjf1ma1L.js.map} +1 -1
  22. package/dist/chunks/data-grid.8Neri_45.js +4146 -0
  23. package/dist/chunks/data-grid.8Neri_45.js.map +1 -0
  24. package/dist/chunks/{date-range-picker.cmg75lC-.js → date-range-picker.DSMt6XMF.js} +3 -3
  25. package/dist/chunks/{date-range-picker.cmg75lC-.js.map → date-range-picker.DSMt6XMF.js.map} +1 -1
  26. package/dist/chunks/dropdown-tag.DFeoXIgH.js +242 -0
  27. package/dist/chunks/dropdown-tag.DFeoXIgH.js.map +1 -0
  28. package/dist/chunks/{dropdown.bLsoTZbw.js → dropdown.KStrJVoP.js} +2 -2
  29. package/dist/chunks/{dropdown.bLsoTZbw.js.map → dropdown.KStrJVoP.js.map} +1 -1
  30. package/dist/chunks/es6.MoTTyETW.js.map +1 -1
  31. package/dist/chunks/{filter-bar.nX73NKNC.js → filter-bar.C6A0MJ8m.js} +9 -8
  32. package/dist/chunks/filter-bar.C6A0MJ8m.js.map +1 -0
  33. package/dist/chunks/{header-with-views.BLW817ZC.js → header-with-views.f5BlTD7U.js} +2 -2
  34. package/dist/chunks/{header-with-views.BLW817ZC.js.map → header-with-views.f5BlTD7U.js.map} +1 -1
  35. package/dist/chunks/{input-field-password.BtM3-txc.js → input-field-password.BGyFeRu0.js} +185 -167
  36. package/dist/chunks/input-field-password.BGyFeRu0.js.map +1 -0
  37. package/dist/chunks/{input-field-phone-number.oaNB69nM.js → input-field-phone-number.DSvCOtqX.js} +3 -3
  38. package/dist/chunks/{input-field-phone-number.oaNB69nM.js.map → input-field-phone-number.DSvCOtqX.js.map} +1 -1
  39. package/dist/chunks/{input-field.D_tADgPG.js → input-field.Dm47icwU.js} +124 -119
  40. package/dist/chunks/input-field.Dm47icwU.js.map +1 -0
  41. package/dist/chunks/{pagination.D1Gdo5to.js → pagination.BaBWNlIF.js} +2 -2
  42. package/dist/chunks/{pagination.D1Gdo5to.js.map → pagination.BaBWNlIF.js.map} +1 -1
  43. package/dist/chunks/radio-group.DWNqrkZ3.js.map +1 -1
  44. package/dist/chunks/{search-bar.BD_R-vgA.js → search-bar.CbNBCQnM.js} +3 -3
  45. package/dist/chunks/{search-bar.BD_R-vgA.js.map → search-bar.CbNBCQnM.js.map} +1 -1
  46. package/dist/chunks/{secondary-nav.Du2PL7Ok.js → secondary-nav.DXsgUTqk.js} +2 -2
  47. package/dist/chunks/{secondary-nav.Du2PL7Ok.js.map → secondary-nav.DXsgUTqk.js.map} +1 -1
  48. package/dist/chunks/selection-card-group.F8alOPtl.js +412 -0
  49. package/dist/chunks/{selection-card-group._RgLiMyQ.js.map → selection-card-group.F8alOPtl.js.map} +1 -1
  50. package/dist/chunks/textarea.C1jkfowf.js.map +1 -1
  51. package/dist/chunks/{use-cached-selected-values.C32tjNKy.js → use-cached-selected-values.8MdrR9wt.js} +501 -467
  52. package/dist/chunks/use-cached-selected-values.8MdrR9wt.js.map +1 -0
  53. package/dist/code-snippet.js +1 -1
  54. package/dist/data-grid.js +1 -1
  55. package/dist/date-range-picker.js +1 -1
  56. package/dist/dropdown.js +3 -3
  57. package/dist/filter-bar.js +1 -1
  58. package/dist/header-with-views.js +1 -1
  59. package/dist/index.js +15 -15
  60. package/dist/input-field-password.js +1 -1
  61. package/dist/input-field-phone-number.js +1 -1
  62. package/dist/input-field.js +1 -1
  63. package/dist/internal.js +1 -1
  64. package/dist/pagination.js +1 -1
  65. package/dist/search-bar.js +2 -2
  66. package/dist/secondary-nav.js +1 -1
  67. package/dist/selection-card.js +1 -1
  68. package/dist/styles/bento-dark.css +1 -1
  69. package/dist/styles/bento-light.css +1 -1
  70. package/dist/styles/bento.css +1 -1
  71. package/dist/styles/legacy.css +1 -1
  72. package/dist/styles/styleguide.css +1 -1
  73. package/dist/web-types.json +1 -1
  74. package/package.json +5 -5
  75. package/dist/chunks/data-grid.BjPdbx50.js +0 -4071
  76. package/dist/chunks/data-grid.BjPdbx50.js.map +0 -1
  77. package/dist/chunks/dropdown-tag.DvQQIJsw.js +0 -308
  78. package/dist/chunks/dropdown-tag.DvQQIJsw.js.map +0 -1
  79. package/dist/chunks/filter-bar.nX73NKNC.js.map +0 -1
  80. package/dist/chunks/input-field-password.BtM3-txc.js.map +0 -1
  81. package/dist/chunks/input-field.D_tADgPG.js.map +0 -1
  82. package/dist/chunks/selection-card-group._RgLiMyQ.js +0 -474
  83. package/dist/chunks/use-cached-selected-values.C32tjNKy.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"input-field-password.BtM3-txc.js","sources":["../../../vue2/src/components/input-field-password/input-field-password.types.ts","../../../vue2/src/components/input-field-password/assets/capslock.svg","../../../vue2/src/components/input-field-password/utilities/input-field-password.validation.ts","../../../vue2/src/components/input-field-password/input-field-password.vue"],"sourcesContent":["import type { BentoInputFieldProps, BentoInputFieldValue } from '@/components/input-field/input-field.types';\n\n/**\n * Public\n */\n\nexport interface BentoInputFieldPasswordValidationListItem {\n label?: string;\n key?: BentoInputFieldPasswordDefaultRuleKeys | string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n validate?: (value: BentoInputFieldValue, ...args: Array<any>) => boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n additionalArgs?: Array<any>;\n disabled?: boolean;\n}\n\nexport type BentoInputFieldPasswordDefaultRuleKeys =\n | 'minLength'\n | 'requireLowercase'\n | 'requireNumeric'\n | 'requireSpecialCharacter'\n | 'requireUppercase';\n\nexport type BentoInputFieldPasswordErrorsList = Record<BentoInputFieldPasswordDefaultRuleKeys | string, string>;\n\nexport interface BentoInputFieldPasswordValidation {\n title?: string;\n suggestion?: string;\n extendDefaultValidation?: boolean;\n list: Array<BentoInputFieldPasswordValidationListItem>;\n}\n\nexport interface BentoInputFieldPasswordProps {\n /**\n * Reduces height of the input\n */\n condensed?: BentoInputFieldProps['condensed'];\n\n /**\n * The debounce time in milliseconds for running validation and emitting the `input` event after the user has stopped typing.\n * This helps to avoid excessive validation checks on every keystroke. Defaults to `500`.\n */\n debounceTime?: number;\n\n /**\n * Disables the possibility of changing value in the input-field\n */\n disabled?: BentoInputFieldProps['disabled'];\n\n /**\n * Performs real-time validations over the input value. Default: `false`.\n * Disabling the option (set to `true`) will not run pre-defined validations or custom validations defined in the `validation` field.\n */\n disableValidation?: boolean;\n\n /**\n * Renders input-field with an error state and the error message beneath the input box\n */\n errorMessage?: BentoInputFieldProps['errorMessage'];\n\n /**\n * Text displayed as the placeholder of the input-field\n */\n placeholder?: BentoInputFieldProps['placeholder'];\n\n /**\n * Setting this property to true will set the input field to read only state.\n */\n readonly?: BentoInputFieldProps['readonly'];\n\n /**\n * Text displayed as the value of the input-field\n */\n value?: BentoInputFieldProps['value'];\n\n /**\n * Label to be shown with the input field\n */\n label?: string;\n\n /**\n * Configuration object for password field validation.\n *\n * This object defines the validation criteria and associated messages for a password field.\n * It includes the following properties:\n *\n * - `title`: The title displayed at the top of the validation hint.\n * - `suggestion`: The message displayed at the bottom of the validation hint, providing additional guidance.\n * - `extendDefaultValidation`: Set to true if you want to add your custom rules to the default validation instead of overriding the list.\n * - `list`: An array of callback functions to be executed on the value after each user input, validating the password against the specified rules.\n *\n * By default, the validation checks that:\n *\n * - The value has a minimum length of 12 characters.\n * - The value contains at least one lowercase letter.\n * - The value contains at least one uppercase letter.\n * - The value contains at least one numeric digit.\n * - The value contains at least one special character.\n *\n *\n */\n validation?: BentoInputFieldPasswordValidation;\n\n /**\n * Whether the password validation hint is displayed when the input field is activated via focus or input\n */\n withHint?: boolean;\n}\n\n/**\n * Private\n */\n\nexport enum BentoInputFieldPasswordType {\n TEXT = 'text',\n PASSWORD = 'password',\n}\n\nexport enum BentoInputFieldPasswordDefaultRule {\n MIN_LENGTH = 'minLength',\n REQUIRE_LOWERCASE = 'requireLowercase',\n REQUIRE_NUMERIC = 'requireNumeric',\n REQUIRE_SPECIAL_CHARACTER = 'requireSpecialCharacter',\n REQUIRE_UPPERCASE = 'requireUppercase',\n}\n","export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='capslock'%3e%3cg%20id='Union'%3e%3cpath%20d='M13.75%205.63952L8%201.03952L2.25%205.63952V7.74999H4.75V11.75H11.25V7.74999H13.75V5.63952ZM6.25%206.24999H3.88809L8%202.96046L12.1119%206.24999H9.75V10.25H6.25V6.24999Z'%20fill='%2300112C'/%3e%3cpath%20d='M11.25%2014.75V13.25H4.75V14.75H11.25Z'%20fill='%2300112C'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e\"","import { type BentoInputFieldValue } from '@/components/input-field';\n\nfunction stringifyValue(value: BentoInputFieldValue): string {\n return value?.toString() ?? '';\n}\n\n/**\n * Validates if the length of the provided value is greater than or equal to the specified length.\n *\n * @param value - The input value to check.\n * @param length - The minimum required length of the value. Defaults to 12.\n * @returns `true` if the length of the value is greater than or equal to the specified length, `false` otherwise.\n */\nexport function minLength(value: BentoInputFieldValue, length = 12): boolean {\n return stringifyValue(value).length >= length;\n}\n\n/**\n * Validates if the provided value contains at least one lowercase letter.\n *\n * @param value - The input value to check.\n * @returns `true` if the value contains at least one lowercase letter, `false` otherwise.\n */\nexport function requireLowercase(value: BentoInputFieldValue): boolean {\n return /[a-z]/.test(stringifyValue(value));\n}\n\n/**\n * Validates if the provided value contains at least one uppercase letter.\n *\n * @param value - The input value to check.\n * @returns `true` if the value contains at least one uppercase letter, `false` otherwise.\n */\nexport function requireUppercase(value: BentoInputFieldValue): boolean {\n return /[A-Z]/.test(stringifyValue(value));\n}\n\n/**\n * Validates if the provided value contains at least one numerical digit.\n *\n * @param value - The input value to check.\n * @returns `true` if the value contains at least one numerical digit, `false` otherwise.\n */\nexport function requireNumeric(value: BentoInputFieldValue): boolean {\n return /\\d/.test(stringifyValue(value));\n}\n\n/**\n * Validates if the provided value contains at least one special character (non-alphanumeric).\n *\n * @param value - The input value to check.\n * @returns `true` if the value contains at least one special character, `false` otherwise.\n */\nexport function requireSpecialCharacter(value: BentoInputFieldValue): boolean {\n return /[^a-zA-Z0-9]/.test(stringifyValue(value));\n}\n","<template>\n <div ref=\"inputFieldPasswordRef\">\n <bento-input-field\n ref=\"inputFieldPasswordInputRef\"\n v-bind=\"inputFieldArgs\"\n class=\"b-input-field-password__input\"\n spellcheck=\"false\"\n @blur=\"onBlur\"\n @focus=\"onFocus\"\n @input=\"onInput\"\n @keydown=\"checkCapsLock\"\n @keyup=\"checkCapsLock\"\n >\n <template #default>{{ label }}</template>\n\n <template v-if=\"isCapsLockOn\" #iconBefore>\n <div\n class=\"b-input-field-password__caps-lock-indicator\"\n @mouseenter=\"handleCapsLockMouseEnter\"\n @mouseleave=\"handleCapsLockMouseLeave\"\n >\n <bento-image\n ref=\"inputFieldPasswordCapsLockIconRef\"\n :src=\"CapsLockIcon\"\n :alt=\"t('capsLockEnabled')\"\n />\n </div>\n\n <tooltip\n v-if=\"inputFieldPasswordCapsLockIconRef\"\n :class=\"tooltipConditionalClass\"\n :content=\"t('capsLockEnabled')\"\n :disabled-focus-trap=\"true\"\n :fallback-position=\"['top', 'bottom']\"\n :is-shown=\"isTooltipDisplayed\"\n :target-element=\"inputFieldPasswordCapsLockIconRef\"\n />\n </template>\n\n <template v-if=\"!disabled\" #iconAfter>\n <bento-button variant=\"tertiary\" @click=\"toggleInputType\">\n <template #iconLeft>\n <show-icon v-if=\"!isPasswordReadable\" :svg-title=\"t('showPassword')\" />\n <hide-icon v-if=\"isPasswordReadable\" :svg-title=\"t('hidePassword')\" />\n </template>\n </bento-button>\n </template>\n </bento-input-field>\n\n <bento-popover\n v-if=\"hasValidations\"\n :open=\"isHintDisplayed\"\n :target-element=\"inputFieldPasswordInputRef\"\n :disable-focus-trap=\"true\"\n :aria-label=\"computedValidations.title\"\n :aria-describedby=\"validationListId\"\n position=\"right-start\"\n >\n <div :id=\"validationPopoverId\">\n <bento-typography v-if=\"computedValidations.title\" class=\"b-input-field-password__validation-title\">\n {{ computedValidations.title }}\n </bento-typography>\n\n <p v-if=\"!hasErrors\" class=\"b-input-field-password__validation-status--valid\" role=\"alert\">\n {{ t('validationValid') }}\n </p>\n\n <ul :id=\"validationListId\" class=\"b-input-field-password__validation-list\">\n <li\n v-for=\"(rule, index) in computedValidationList\"\n :key=\"index\"\n :class=\"passwordValidityConditionalClass[index]\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >\n <span class=\"b-input-field-password__validation-list-icon\">\n <checkmark-circle-fill-icon\n v-if=\"passwordValidity[index]\"\n :svg-title=\"t('validationChecked')\"\n />\n\n <dot-icon v-else :svg-title=\"t('validationUnchecked')\" />\n </span>\n\n <bento-typography class=\"b-input-field-password__validation-list-text\" el=\"span\">\n {{ rule.label }}\n </bento-typography>\n </li>\n </ul>\n\n <bento-typography\n v-if=\"computedValidations.suggestion\"\n class=\"b-input-field-password__validation-suggestion\"\n >\n {{ computedValidations.suggestion }}\n </bento-typography>\n </div>\n </bento-popover>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { BentoButton } from '@/components/button';\n import { BentoImage } from '@/components/image';\n import { BentoInputField } from '@/components/input-field';\n import { BentoPopover } from '@/components/popover';\n import { BentoTypography } from '@/components/typography';\n import { Tooltip } from '@/internal';\n import type { BentoInputFieldProps } from '@/components/input-field/input-field.types';\n import {\n BentoInputFieldPasswordDefaultRule,\n type BentoInputFieldPasswordErrorsList,\n type BentoInputFieldPasswordProps,\n BentoInputFieldPasswordType,\n type BentoInputFieldPasswordValidation,\n type BentoInputFieldPasswordValidationListItem,\n } from './input-field-password.types';\n import CheckmarkCircleFillIcon from '@adyen/ui-assets-icons-16/vue/checkmark-circle-fill';\n import DotIcon from '@adyen/ui-assets-icons-16/vue/dot';\n import HideIcon from '@adyen/ui-assets-icons-16/vue/hide';\n import ShowIcon from '@adyen/ui-assets-icons-16/vue/show';\n import CapsLockIcon from './assets/capslock.svg';\n\n import { useFocusWithin, watchDebounced } from '@vueuse/core';\n import { computed, provide, ref, type SetupContext, useAttrs, watch } from 'vue';\n\n import { useI18n } from '@/utils/ts/i18n';\n\n import {\n minLength,\n requireLowercase,\n requireNumeric,\n requireSpecialCharacter,\n requireUppercase,\n } from '@/components/input-field-password/utilities/input-field-password.validation';\n import { generateUid } from '@/core/utils/ts';\n import messages from './messages.json';\n import { INPUT_FIELD_PARENT_COMPONENT_INJECTION_KEY } from '@/components/input-field/input-field.keys';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const { t, n } = useI18n<{ message: MessageSchema }>({ messages });\n\n const props = withDefaults(defineProps<BentoInputFieldPasswordProps>(), {\n condensed: false,\n debounceTime: DEBOUNCE_DURATION,\n disabled: false,\n disableValidation: false,\n label: null,\n errorMessage: null,\n placeholder: '',\n readonly: false,\n validation: undefined,\n value: undefined,\n withHint: true,\n });\n\n const emit = defineEmits<{\n /**\n * Emitted when the element has lost focus\n */\n (e: 'blur'): void;\n\n /**\n * Emitted when the element has received focus\n */\n (e: 'focus'): void;\n\n /**\n * Emits an `input:valid` event when the value is validated against the provided validations.\n * This emit has a debounce and is emitted after an `input` event.\n */\n (e: 'input:valid'): void;\n\n /**\n * Emits an `input:error` event when the value fails the validation.\n * This emit has a debounce and is emitted after an `input` event.\n */\n (e: 'input:error', errors: BentoInputFieldPasswordErrorsList): void;\n\n /**\n * Emits an `input` event whenever the value in the input is changed.\n */\n (e: 'input', value: BentoInputFieldPasswordProps['value']): void;\n }>();\n\n const attrs = useAttrs();\n\n const inputType = ref(BentoInputFieldPasswordType.PASSWORD);\n const inputValue = ref(props.value);\n const isHintDisplayed = ref(false);\n const isTouched = ref(false);\n const passwordValidity = ref<Array<boolean>>([]);\n const errorsList = ref<BentoInputFieldPasswordErrorsList>({});\n const capsLockTooltipTimeoutID = ref<ReturnType<typeof setTimeout>>(null);\n const isTooltipDisplayed = ref(false);\n const inputFieldPasswordRef = ref(null);\n const inputFieldPasswordInputRef = ref(null);\n const inputFieldPasswordCapsLockIconRef = ref(null);\n const isCapsLockOn = ref(false);\n\n provide(INPUT_FIELD_PARENT_COMPONENT_INJECTION_KEY, 'bento-input-field-password');\n\n const { focused } = useFocusWithin(inputFieldPasswordRef);\n\n const validationListId = generateUid('validationListId');\n const validationPopoverId = generateUid('validationPopoverId');\n\n const isPasswordReadable = computed(() => inputType.value === BentoInputFieldPasswordType.TEXT);\n\n const passwordValidityConditionalClass = computed(() =>\n passwordValidity.value.map(validity =>\n validity\n ? 'b-input-field-password__validation-list--valid'\n : 'b-input-field-password__validation-list--invalid'\n )\n );\n\n const tooltipConditionalClass = computed(() =>\n capsLockTooltipTimeoutID.value ? 'b-input-field-password__input-tooltip--timed' : ''\n );\n\n const inputFieldArgs = computed<BentoInputFieldProps & SetupContext['attrs']>(() => ({\n ariaHidden: false,\n condensed: props.condensed,\n disabled: props.disabled,\n errorMessage: props.errorMessage,\n placeholder: props.placeholder,\n readonly: props.readonly,\n type: inputType.value,\n value: inputValue.value,\n\n 'aria-haspopup': hasValidations.value ? 'dialog' : false,\n 'aria-describedby': hasValidations.value ? validationPopoverId : '',\n\n ...attrs,\n }));\n\n const computedValidations = computed<BentoInputFieldPasswordValidation>(() => {\n if (props.validation && !props.validation.extendDefaultValidation) {\n return props.validation;\n }\n\n const defaultValidationList = [\n {\n label: t('validationMinLength', { numberOfCharacters: n(MIN_PASSWORD_LENGTH) }),\n key: BentoInputFieldPasswordDefaultRule.MIN_LENGTH,\n validate: minLength,\n },\n {\n label: t('validationRequireLowercase', { numberOne: n(1) }),\n key: BentoInputFieldPasswordDefaultRule.REQUIRE_LOWERCASE,\n validate: requireLowercase,\n },\n {\n label: t('validationRequireUppercase', { numberOne: n(1) }),\n key: BentoInputFieldPasswordDefaultRule.REQUIRE_UPPERCASE,\n validate: requireUppercase,\n },\n {\n label: t('validationRequireNumeric', { numberOne: n(1) }),\n key: BentoInputFieldPasswordDefaultRule.REQUIRE_NUMERIC,\n validate: requireNumeric,\n },\n {\n label: t('validationRequireSpecialCharacter', { numberOne: n(1) }),\n key: BentoInputFieldPasswordDefaultRule.REQUIRE_SPECIAL_CHARACTER,\n validate: requireSpecialCharacter,\n },\n ];\n\n let validationList: Array<BentoInputFieldPasswordValidationListItem> = defaultValidationList;\n\n if (props.validation) {\n const defaultValidationKeys: Array<string> = defaultValidationList.map(rule => rule.key);\n const customRuleKeys = props.validation?.list?.map(rule => rule.key);\n // remove from the custom list any rules with default keys (rules that are overriding existent rules)\n const customValidationList =\n props.validation?.list?.filter(rule => !defaultValidationKeys.includes(rule.key)) ?? [];\n\n // loop through the default list and replace default rule with the custom rule if it exists\n const validationListWithOverrides = defaultValidationList.map(rule => {\n if (customRuleKeys?.includes(rule.key)) {\n const customRule = props.validation?.list?.find(customRule => customRule.key === rule.key);\n return customRule;\n } else {\n return rule;\n }\n });\n validationList = [...validationListWithOverrides, ...customValidationList];\n }\n\n return {\n title: props.validation?.title ?? t('validationTitle'),\n suggestion: props.validation?.suggestion ?? t('validationSuggestion'),\n list: validationList,\n };\n });\n\n const computedValidationList = computed(() => computedValidations.value?.list?.filter(rule => !rule.disabled));\n\n const hasErrors = computed(() => passwordValidity.value?.some(validation => !validation));\n const hasValidations = computed(\n () => inputFieldPasswordInputRef.value && computedValidations.value?.list?.length > 0\n );\n\n const checkCapsLock = (e: KeyboardEvent) => {\n // Check if getModifierState exists and is a function in case the user's browser is autofilling\n if (typeof e.getModifierState === 'function') {\n isCapsLockOn.value = e.getModifierState('CapsLock');\n }\n };\n\n const toggleInputType = () => {\n if (isPasswordReadable.value) {\n inputType.value = BentoInputFieldPasswordType.PASSWORD;\n } else {\n inputType.value = BentoInputFieldPasswordType.TEXT;\n }\n };\n\n const onInput = (value: string) => {\n if (props.disabled) {\n return;\n }\n\n inputValue.value = value;\n\n emit('input', inputValue.value);\n };\n\n const onFocus = () => {\n emit('focus');\n };\n\n const onBlur = () => {\n emit('blur');\n };\n\n const checkValidity = (value: BentoInputFieldPasswordProps['value']) => {\n const rulesValidityObj = computedValidationList.value?.map(validationItem => ({\n key: validationItem.key,\n label: validationItem.label,\n isValid: validationItem.validate(value, ...(validationItem.additionalArgs ?? [])),\n }));\n let customRuleIndex = 1;\n\n passwordValidity.value = rulesValidityObj?.map(error => error.isValid);\n\n errorsList.value = rulesValidityObj\n ?.filter(rule => !rule.isValid)\n .reduce((errorsObject, error) => {\n const key = error.key ?? `custom-rule-${customRuleIndex++}`;\n return {\n ...errorsObject,\n [key]: error.label,\n };\n }, {});\n };\n\n const handleCapsLockMouseLeave = () => {\n isTooltipDisplayed.value = false;\n capsLockTooltipTimeoutID.value = null;\n };\n\n const handleCapsLockMouseEnter = () => {\n isTooltipDisplayed.value = true;\n };\n\n watch(\n () => props.value,\n newValue => {\n inputValue.value = newValue;\n }\n );\n\n watch(focused, focused => {\n // Always set dirty to true when blur occurs\n if (!focused) {\n isTouched.value = true;\n }\n\n // Disable validations & hint if \"disableValidation\" is \"true\"\n if (!props.disableValidation) {\n if (props.withHint) {\n isHintDisplayed.value = focused;\n }\n checkValidity(inputValue.value);\n }\n });\n\n watch(isCapsLockOn, isCapsLockOn => {\n if (!isCapsLockOn) {\n clearTimeout(capsLockTooltipTimeoutID.value);\n\n capsLockTooltipTimeoutID.value = null;\n isTooltipDisplayed.value = false;\n } else {\n isTooltipDisplayed.value = true;\n\n capsLockTooltipTimeoutID.value = setTimeout(() => {\n capsLockTooltipTimeoutID.value = null;\n isTooltipDisplayed.value = false;\n }, TOOLTIP_TIMEOUT);\n }\n });\n\n watchDebounced(\n inputValue,\n inputValue => {\n checkValidity(inputValue);\n\n if (!hasErrors.value) {\n emit('input:valid');\n } else {\n emit('input:error', errorsList.value);\n }\n },\n // wait for 0.5s before checking validity OR 2s of continuous typing\n { debounce: props.debounceTime, maxWait: DEBOUNCE_MAX_WAIT }\n );\n</script>\n\n<script lang=\"ts\">\n const MIN_PASSWORD_LENGTH = 12;\n const DEBOUNCE_DURATION = 500;\n const DEBOUNCE_MAX_WAIT = 2000;\n const TOOLTIP_TIMEOUT = 2000;\n\n /**\n * The input field password is a component designed to support users' preference for entering values securely.\n * This is an extension of the `bento-input-field` component.\n *\n * @example\n * import { BentoInputFieldPassword } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoInputFieldPassword },\n * template: `\n * <bento-input-field-password\n * label=\"Label\"\n * error-message=\"Error\"\n * :validation=\"{\n * extendDefaultValidation: true,\n * list: [\n * { label: '18 characters', key: 'minLength', validate: minLength, additionalArgs: [18] },\n * { label: 'Always true', key: 'alwaysTrue', validate: () => true },\n * { key: 'requireSpecialCharacter', disabled: true }\n * ],\n * }\"\n * />\n * `\n * }\n */\n export default {\n i18n: { messages },\n name: 'bento-input-field-password',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./input-field-password.scss\" />\n"],"names":["BentoInputFieldPasswordType","BentoInputFieldPasswordType2","BentoInputFieldPasswordDefaultRule","BentoInputFieldPasswordDefaultRule2","CapsLockIcon","stringifyValue","value","minLength","length","requireLowercase","requireUppercase","requireNumeric","requireSpecialCharacter","MIN_PASSWORD_LENGTH","DEBOUNCE_DURATION","DEBOUNCE_MAX_WAIT","TOOLTIP_TIMEOUT","__default__","messages","t","n","useI18n","props","__props","emit","__emit","attrs","useAttrs","inputType","ref","inputValue","isHintDisplayed","isTouched","passwordValidity","errorsList","capsLockTooltipTimeoutID","isTooltipDisplayed","inputFieldPasswordRef","inputFieldPasswordInputRef","inputFieldPasswordCapsLockIconRef","isCapsLockOn","provide","INPUT_FIELD_PARENT_COMPONENT_INJECTION_KEY","focused","useFocusWithin","validationListId","generateUid","validationPopoverId","isPasswordReadable","computed","passwordValidityConditionalClass","validity","tooltipConditionalClass","inputFieldArgs","hasValidations","computedValidations","defaultValidationList","validationList","defaultValidationKeys","rule","customRuleKeys","_b","_a","customValidationList","_d","_c","customRule2","_e","_f","computedValidationList","hasErrors","validation","checkCapsLock","toggleInputType","onInput","onFocus","onBlur","checkValidity","rulesValidityObj","validationItem","customRuleIndex","error","errorsObject","key","handleCapsLockMouseLeave","handleCapsLockMouseEnter","watch","newValue","focused2","isCapsLockOn2","watchDebounced","inputValue2"],"mappings":";;;;;;;;;;;;;;;;AAiHY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,OAAA,QACAA,EAAA,WAAA,YAFQA,IAAAD,KAAA,CAAA,CAAA,GAKAE,IAAA,kBAAAC,OACRA,EAAA,aAAA,aACAA,EAAA,oBAAA,oBACAA,EAAA,kBAAA,kBACAA,EAAA,4BAAA,2BACAA,EAAA,oBAAA,oBALQA,IAAAD,KAAA,CAAA,CAAA;ACtHZ,MAAAE,KAAA;ACEA,SAAAC,EAAAC,GAAA;AACI,UAAAA,KAAA,gBAAAA,EAAA,eAAA;AACJ;AASgB,SAAAC,GAAAD,GAAAE,IAAA,IAAA;AACZ,SAAAH,EAAAC,CAAA,EAAA,UAAAE;AACJ;AAQO,SAAAC,GAAAH,GAAA;AACH,SAAA,QAA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WAAAkD;AAAA,MAAA,MAAAhE,EAAA;AAAA,MACgB,CAAAiE,MAAA;AAER,QAAAzD,EAAA,QAAAyD;AAAA,MAAmB;AAAA,IACvB,GAGJD,EAAA3C,IAAA,CAAA6C,MAAA;AAEI,MAAAA,MACIxD,GAAA,QAAA,KAIJV,EAAA,sBACIA,EAAA,aACIS,EAAA,QAAAyD,IAEJX,EAAA/C,EAAA,KAAA;AAAA,IACJ,CAAA,GAGJwD,EAAA9C,GAAA,CAAAiD,MAAA;AACI,MAAAA,KAMIrD,EAAA,QAAA,IAEAD,EAAA,QAAA,WAAA,MAAA;AACI,QAAAA,EAAA,QAAA,MACAC,EAAA,QAAA;AAAA,MAA2B,GAAApB,EAAA,MAT/B,aAAAmB,EAAA,KAAA,GAEAA,EAAA,QAAA,MACAC,EAAA,QAAA;AAAA,IAQJ,CAAA,GAGJsD;AAAA,MAAA5D;AAAA,MACI,CAAA6D,MAAA;AAEI,QAAAd,EAAAc,CAAA,GAEArB,EAAA,QAGI9C,EAAA,eAAAU,EAAA,KAAA,IAFAV,EAAA,aAAA;AAAA,MAGJ;AAAA;AAAA,MACJ,EAAA,UAAAF,EAAA,cAAA,SAAAP,GAAA;AAAA,IAE2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"input-field.D_tADgPG.js","sources":["../../../vue2/src/components/input-field/input-field.types.ts","../../../vue2/src/components/input-field/input-field.vue"],"sourcesContent":["import { type BentoDropdownProps } from '../dropdown/dropdown.types';\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 = BentoDropdownProps;\nexport type BentoInputDropdownProps = {\n /**\n * Text that labels the dropdown element\n */\n 'aria-label'?: string;\n /**\n * Enables dynamic filtering\n */\n dynamicFiltering?: DropdownProps['dynamicFiltering'];\n /**\n * List of available items\n */\n items: DropdownProps['items'];\n /**\n * Sets the dropdown in read-only mode\n */\n readonly?: DropdownProps['readonly'];\n /**\n * Selected value of the dropdown\n */\n value?: DropdownProps['value'];\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\nexport interface BentoInputFieldProps {\n /**\n * Indicates whether the element is exposed to an accessibility API.\n */\n ariaHidden?: boolean;\n\n /**\n * Text that labels an the input element\n *\n * @deprecated from version 2.0.0. Use the aria-label attribute instead.\n */\n ariaLabel?: string;\n\n /**\n * Reduces height of the input\n */\n condensed?: boolean;\n\n /**\n * Disables the possibility of changing value in the input-field\n */\n disabled?: boolean;\n\n /**\n * Dropdown props for the small selectable dropdown menu.\n * Properties supported:\n *\n * - `aria-label`: Text that labels the dropdown element\n * - `dynamicFiltering`: Enables dynamic filtering\n * - `items`: List of available items\n * - `readonly`: Sets the dropdown in read-only mode\n * - `value`: Selected value of the dropdown\n */\n dropdown?: BentoInputDropdownProps;\n\n /**\n * Position of the dropdown before or after input value\n */\n dropdownPosition?: BentoInputFieldElementPosition | `${BentoInputFieldElementPosition}`;\n\n /**\n * Adds error validation class for outlining input-field.\n *\n * @deprecated Use \"errorMessage\" prop instead\n */\n error?: boolean;\n\n /**\n * Renders input-field with an error state and the error message beneath the input box\n */\n errorMessage?: string;\n\n /**\n * Highlights the dropdown is optional.\n */\n optional?: boolean;\n\n /**\n * Text displayed as the placeholder of the input-field\n */\n placeholder?: string;\n\n /**\n * When present, indicates that the user must specify a value for the input before the owning form can be submitted.\n * The `required` attribute is supported by input types like `text`, `search`, and `number`.\n */\n required?: boolean;\n\n /**\n * Setting this property to true will set the input field to read only state.\n */\n readonly?: boolean;\n\n /**\n * Renders a font numeric style with slashed zeros instead of normal ones.\n */\n slashedZero?: boolean;\n\n /**\n * Static text that displayed before or after input value\n * Applicable to the Static Value variant\n */\n staticValue?: string;\n\n /**\n * Position of Static Value before or after input value\n */\n staticValuePosition?: BentoInputFieldElementPosition | `${BentoInputFieldElementPosition}`;\n\n /**\n * Adds a info icon next to the label to display the passed tooltip message.\n */\n tooltipText?: string;\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?: BentoInputFieldType | `${BentoInputFieldType}` | HTMLInputElement['type'];\n\n /**\n * Text displayed as the value of the input-field\n */\n value?: BentoInputFieldValue;\n\n /**\n * Describes the different variants for the input element\n */\n variant?: BentoInputFieldVariant | `${BentoInputFieldVariant}`;\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 ref=\"inputDropdownElement\"\n v-bind=\"inputFieldDropdownProps\"\n :disabled=\"disabled\"\n :readonly=\"isDropdownReadOnly\"\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 :required=\"required\"\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 @keyup=\"emit('keyup', $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 ref=\"inputDropdownElement\"\n v-bind=\"inputFieldDropdownProps\"\n :disabled=\"disabled\"\n :readonly=\"isDropdownReadOnly\"\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, provide, type 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 INPUT_FIELD_PARENT_COMPONENT_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 type BentoInputDropdownProps,\n BentoInputFieldElementPosition,\n type BentoInputFieldProps,\n BentoInputFieldStateClass,\n BentoInputFieldType,\n BentoInputFieldVariant,\n } from './input-field.types';\n import { type BentoListboxSelectedValue } from '@/types/listbox';\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 = withDefaults(defineProps<BentoInputFieldProps>(), {\n ariaHidden: true,\n ariaLabel: undefined,\n condensed: false,\n disabled: false,\n dropdown: undefined,\n dropdownPosition: BentoInputFieldElementPosition.START,\n error: false,\n errorMessage: null,\n optional: false,\n placeholder: '',\n required: false,\n readonly: false,\n slashedZero: false,\n staticValue: '',\n staticValuePosition: BentoInputFieldElementPosition.START,\n tooltipText: null,\n type: BentoInputFieldType.TEXT,\n value: undefined,\n variant: BentoInputFieldVariant.DEFAULT,\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 down\n */\n (e: 'keydown', event: KeyboardEvent): void;\n\n /**\n * Emitted when a key is pressed and lifted up\n */\n (e: 'keyup', 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 inputDropdownElement = 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 const isDropdownReadOnly = computed<BentoInputDropdownProps['readonly']>(\n () => isReadOnly.value || props.dropdown?.readonly\n );\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 [`b-input-field--slashed-zero`]: props.slashedZero,\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 const focus = () => {\n if (props.variant === 'dropdown') {\n inputDropdownElement.value.focus();\n } else {\n focusInput();\n }\n };\n\n // Expose method so that other components can focus on it in Vue3\n defineExpose({\n focusInput,\n focus,\n });\n\n const inputFieldParentComponent = inject(INPUT_FIELD_PARENT_COMPONENT_INJECTION_KEY, '');\n\n if (!Object.values(BentoInputFieldType).includes(props.type as BentoInputFieldType) && !inputFieldParentComponent) {\n if (props.type === 'tel') {\n printDevelopmentWarning(\n `\"bento-input-field\" dropdown does not support the type '${props.type}', use \"bento-input-field-phone-number\" instead.`\n );\n } else if (props.type === 'password') {\n printDevelopmentWarning(\n `\"bento-input-field\" dropdown does not support the type '${props.type}', use \"bento-input-field-password\" instead.`\n );\n } else {\n printDevelopmentWarning(`\"bento-input-field\" dropdown does not support the type '${props.type}'`);\n }\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","inputDropdownElement","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","isDropdownReadOnly","computed","_a","shouldShowStaticValue","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","inputFieldParentComponent","INPUT_FIELD_PARENT_COMPONENT_INJECTION_KEY","printDevelopmentWarning","deprecate"],"mappings":";;;;;;;;;;;;AAKY,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,GAqCAE,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;;;;;;sUC8YRE,KAAA;AAAA,EAAe,MAAA,EAAA,UAAAC,EAAA;AAEf;;;;;;;;;;;;;;;;;;;;;;;;;;AAnRA,UAAAC,IAAAC,GAAA,GACAC,IAAAC,GAAA,GAEAC,IAAAC,GAsBAC,IAAAC,GA+CA,EAAA,GAAAC,EAAA,IAAAC,GAAA,EAAA,UAAAV,EAAA,CAAA,GACAW,IAAAC,GAAAT,CAAA,GACAU,IAAAC,EAAA,IAAA,GACAC,IAAAD,EAAA,IAAA,GACAE,IAAAC,EAAA,OAAA,GACAC,IAAAD,EAAA,gBAAA,GACAE,IAAAF,EAAA,oBAAA,GACAG,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,CAAAyB,EAAA,SACIvB,EAAA,SAAAoD,CAAA;AAAA,IACJ,GAGJC,IAAA,CAAAC,MAAA;AACI,MAAAtD,EAAA,kBAAAsD,CAAA,GACAtD,EAAA,mBAAA,EAAA,GAAAF,KAAA,gBAAAA,EAAA,UAAA,OAAAwD,EAAA,CAAA;AAAA,IAAoE,GAGxEC,IAAA,MAAA;AACI,MAAAjD,EAAA,MAAA,MAAA;AAAA,IAA8B;AAYlC,IAAAkD,EAAA;AAAA,MAAa,YAAAD;AAAA,MACT,OAVJ,MAAA;AACI,QAAAzD,EAAA,YAAA,aACIU,EAAA,MAAA,MAAA,IAEA+C,EAAA;AAAA,MACJ;AAAA,IAMA,CAAA;AAGJ,UAAAE,KAAAtC,EAAAuC,IAAA,EAAA;AAEA,WAAA,CAAA,OAAA,OAAAtE,CAAA,EAAA,SAAAU,EAAA,IAAA,KAAA,CAAA2D,OACI3D,EAAA,SAAA,QACI6D;AAAA,MAAA,2DAAA7D,EAAA,IAAA;AAAA,IACyE,IACzEA,EAAA,SAAA,aAEA6D;AAAA,MAAA,2DAAA7D,EAAA,IAAA;AAAA,IACyE,IAGzE6D,EAAA,2DAAA7D,EAAA,IAAA,GAAA,IAORA,EAAA,SACI8D;AAAA,MAAA;AAAA,MACI;AAAA;AAAA;AAAA,MACA;AAAA,IAGA,GAIRxD,EAAA,mBAAA,KACIwD;AAAA,MAAA;AAAA,MACI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MACA;AAAA,IAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,474 +0,0 @@
1
- import { defineComponent as ae, useSlots as le, computed as o, inject as re, ref as V, createElementBlock as E, openBlock as i, normalizeClass as k, createElementVNode as q, createBlock as f, createCommentVNode as $, unref as t, renderSlot as y, withModifiers as ie, createVNode as de, withCtx as u, createTextVNode as Y, toDisplayString as Q, watch as se, provide as ue, onMounted as ce, Fragment as Z, renderList as W, mergeProps as m, createSlots as F } from "vue";
2
- import { b as fe } from "./index.E60QniEu.js";
3
- import { a as ve, b as ye } from "./es6.MoTTyETW.js";
4
- import { B as I } from "./typography.yBEME_Gu.js";
5
- import { C as be } from "./checkbox-input.BXNGT9U0.js";
6
- import { u as me } from "./aria-label.CaUURpnB.js";
7
- import { g as H } from "./generate-uid.NJ8tVoha.js";
8
- import { u as pe } from "./use-has-slot.B7eQSabc.js";
9
- import { a as he } from "./radio-input.CBNE-AkM.js";
10
- import { _ as te } from "./_plugin-vue_export-helper.CHgC5LLL.js";
11
- import { C as ge } from "./controls-group.cbGiHr7n.js";
12
- import { G as ke } from "./grid-layout.DDaRNz4-.js";
13
- import { E as Ce } from "./field-label.C97CrBI_.js";
14
- import "../assets/selection-card-group.css";
15
- var G = /* @__PURE__ */ ((e) => (e.DISABLED = "disabled", e.READONLY = "readonly", e.ERROR = "error", e))(G || {});
16
- const oe = Symbol("selection card radio input injection key"), Se = {
17
- key: 0,
18
- class: "b-selection-card__icon",
19
- role: "presentation"
20
- }, Re = ["for"], $e = {
21
- name: "bento-selection-card"
22
- }, Ve = /* @__PURE__ */ ae({
23
- ...$e,
24
- props: {
25
- /**
26
- * The description of the selection card
27
- */
28
- description: {
29
- type: String,
30
- default: void 0
31
- },
32
- /**
33
- * Disables the selection card
34
- */
35
- disabled: { type: Boolean, default: !1 },
36
- /**
37
- * Makes the entire selection card clickable. Clicking over interactive elements inside the card with this prop enabled will not be possible.
38
- */
39
- fullyClickable: { type: Boolean, default: !1 },
40
- /**
41
- * Shows the selection card in error state
42
- */
43
- hasError: { type: Boolean, default: !1 },
44
- /**
45
- * This property should not be used directly.
46
- * It will be used by v-model directive on selection card component.
47
- *
48
- * When handling a single input, use a string or a number.
49
- *
50
- * When handling multiple inputs, use an array of keys.
51
- * These keys exist as a set "value" prop for each input.
52
- */
53
- modelValue: {
54
- type: [Boolean, String, Array],
55
- default: null
56
- },
57
- /**
58
- * Sets the selection card to readonly
59
- */
60
- readonly: { type: Boolean, default: !1 },
61
- /**
62
- * The subtitle of the selection card
63
- */
64
- subtitle: {
65
- type: String,
66
- default: void 0
67
- },
68
- /**
69
- * The title of the selection card
70
- */
71
- title: {
72
- type: String,
73
- required: !0
74
- },
75
- /**
76
- * Indicates the value of the input that will be returned when it's checked.
77
- */
78
- value: {
79
- type: [String, Number],
80
- required: !0
81
- }
82
- },
83
- emits: ["input", "update:model-value"],
84
- setup(e, { emit: j }) {
85
- const a = e, x = j, z = le(), c = pe(z), B = H("selection-card-input-id"), p = H("selection-card-description"), L = o(
86
- () => a.modelValue
87
- ), C = o(
88
- () => a.modelValue
89
- ), N = o(() => ({
90
- "b-selection-card--checked": S.value,
91
- "b-selection-card--fully-clickable": a.fullyClickable
92
- })), _ = o(() => ({
93
- [`b-selection-card--${G.DISABLED}`]: a.disabled,
94
- [`b-selection-card--${G.ERROR}`]: a.hasError,
95
- [`b-selection-card--${G.READONLY}`]: a.readonly,
96
- "b-selection-card--center-aligned": R.value
97
- })), O = o(() => ({
98
- "b-selection-card__checkbox-container--center-aligned": R.value
99
- })), U = o(() => ({
100
- "b-selection-card__checkbox-container-text--center-aligned": R.value
101
- })), h = o(() => ({
102
- "b-selection-card__slot--with-icon": c("icon")
103
- })), n = me({
104
- ariaLabel: a.title,
105
- label: a.value
106
- }), D = o(() => Array.isArray(a.modelValue)), S = o(() => w.value ? a.value === a.modelValue : D.value ? a.modelValue.some((r) => r === a.value) : a.modelValue), w = re(oe, V(!1)), R = o(() => !a.subtitle && !a.description), b = V(null), l = V(null), v = V(null), d = (r) => {
107
- var g, A, J, K, P, X;
108
- if (b.value.$refs.inputRef === r.target) {
109
- const ne = T();
110
- s(ne);
111
- return;
112
- }
113
- if (a.disabled && a.readonly || !a.fullyClickable && (l.value && ((A = (g = l.value) == null ? void 0 : g.$el) != null && A.contains(r.target)) || v.value && ((K = (J = v.value) == null ? void 0 : J.$el) != null && K.contains(r.target)) || b.value && ((X = (P = b.value) == null ? void 0 : P.$el) != null && X.contains(r.target))))
114
- return;
115
- const M = T();
116
- s(M);
117
- }, T = () => {
118
- var M;
119
- const r = ((M = b.value) == null ? void 0 : M.$refs.inputRef).checked;
120
- if (D.value) {
121
- const g = [...a.modelValue], A = g.indexOf(a.value);
122
- return A === -1 ? g.push(a.value) : g.splice(A, 1), g;
123
- }
124
- return w.value ? a.value : r;
125
- }, s = (r) => {
126
- !a.disabled && !a.readonly && (x("update:model-value", r), x("input", r));
127
- };
128
- return (r, M) => (i(), E("div", {
129
- class: k(["b-selection-card", N.value]),
130
- onClick: d
131
- }, [
132
- q("div", {
133
- class: k(["b-selection-card__container", _.value])
134
- }, [
135
- q("div", {
136
- class: k(["b-selection-card__checkbox-container", O.value])
137
- }, [
138
- q("div", {
139
- class: k(["b-selection-card__checkbox-container-text", U.value])
140
- }, [
141
- t(c)("icon") ? (i(), E("div", Se, [
142
- y(r.$slots, "icon", {}, void 0, !0)
143
- ])) : $("", !0),
144
- q("label", {
145
- for: t(B),
146
- class: "b-selection-card__text",
147
- onClick: ie(d, ["stop", "prevent"])
148
- }, [
149
- e.subtitle ? (i(), f(t(I), {
150
- key: 0,
151
- class: "b-selection-card__description",
152
- el: "span",
153
- variant: "caption"
154
- }, {
155
- default: u(() => [
156
- Y(Q(e.subtitle), 1)
157
- ]),
158
- _: 1
159
- })) : $("", !0),
160
- de(t(I), {
161
- el: "span",
162
- variant: "title"
163
- }, {
164
- default: u(() => [
165
- Y(Q(e.title), 1)
166
- ]),
167
- _: 1
168
- }),
169
- e.description ? (i(), f(t(I), {
170
- key: 1,
171
- id: "descriptionId",
172
- class: "b-selection-card__description",
173
- el: "span",
174
- variant: "body"
175
- }, {
176
- default: u(() => [
177
- Y(Q(e.description), 1)
178
- ]),
179
- _: 1
180
- })) : $("", !0)
181
- ], 8, Re)
182
- ], 2),
183
- t(w) ? (i(), f(t(he), {
184
- key: 0,
185
- id: t(B),
186
- ref_key: "inputRef",
187
- ref: b,
188
- "aria-label": t(n),
189
- "aria-describedby": e.description ? t(p) : void 0,
190
- disabled: e.disabled,
191
- "has-error": e.hasError,
192
- "aria-readonly": e.readonly ?? void 0,
193
- value: e.value,
194
- readonly: e.readonly,
195
- "model-value": L.value
196
- }, null, 8, ["id", "aria-label", "aria-describedby", "disabled", "has-error", "aria-readonly", "value", "readonly", "model-value"])) : (i(), f(t(be), {
197
- key: 1,
198
- id: t(B),
199
- ref_key: "inputRef",
200
- ref: b,
201
- "aria-label": t(n),
202
- "aria-describedby": e.description ? t(p) : void 0,
203
- disabled: e.disabled,
204
- "has-error": e.hasError,
205
- "aria-readonly": e.readonly ?? void 0,
206
- value: e.value,
207
- readonly: e.readonly,
208
- "model-value": C.value
209
- }, null, 8, ["id", "aria-label", "aria-describedby", "disabled", "has-error", "aria-readonly", "value", "readonly", "model-value"]))
210
- ], 2),
211
- t(c)("content") ? (i(), f(t(I), {
212
- key: 0,
213
- ref_key: "slotRef",
214
- ref: l,
215
- el: "div",
216
- class: k(["b-selection-card__slot", h.value])
217
- }, {
218
- default: u(() => [
219
- y(r.$slots, "content", {}, void 0, !0)
220
- ]),
221
- _: 3
222
- }, 8, ["class"])) : $("", !0),
223
- t(c)("dynamicContent") && S.value ? (i(), f(t(I), {
224
- key: 1,
225
- ref_key: "dynamicSlotRef",
226
- ref: v,
227
- el: "div",
228
- class: k(["b-selection-card__slot", h.value])
229
- }, {
230
- default: u(() => [
231
- y(r.$slots, "dynamicContent", {}, void 0, !0)
232
- ]),
233
- _: 3
234
- }, 8, ["class"])) : $("", !0)
235
- ], 2)
236
- ], 2));
237
- }
238
- }), ee = /* @__PURE__ */ te(Ve, [["__scopeId", "data-v-925457bd"]]), Ee = {}, xe = /* @__PURE__ */ ae({
239
- ...Ee,
240
- __name: "selection-card-group",
241
- props: {
242
- /**
243
- * Descriptive supporting text visbile underneath the label.
244
- */
245
- description: { type: String, default: null },
246
- /**
247
- * If set to true, renders all cards in the group in a disabled state.
248
- */
249
- disabled: { type: Boolean, default: !1 },
250
- /**
251
- * Renders all cards in an error state with an error message.
252
- */
253
- errorMessage: { type: String, default: null },
254
- /**
255
- * The form id the selection card group is associated with. Defaults to null, as a selection card group can also be used standalone.
256
- */
257
- formId: { type: String, default: null },
258
- /**
259
- * Shows/hides the group label.
260
- */
261
- hideLabel: { type: Boolean, default: null },
262
- /**
263
- * Label of the group. Required for accessibility purposes, even if it's not shown
264
- */
265
- label: {
266
- type: String,
267
- required: !0
268
- },
269
- /**
270
- * The selection card group's layout. It can be vertical or horizontal. Defaults to vertical.
271
- * @values horizontal, vertical
272
- */
273
- layout: {
274
- type: String,
275
- default: "vertical"
276
- },
277
- /**
278
- * The selection card group's items.
279
- */
280
- items: {
281
- type: Array,
282
- required: !0
283
- },
284
- /**
285
- * Sets the responsive number of items rendered in each row.
286
- */
287
- itemsPerRow: {
288
- type: Object,
289
- default: void 0
290
- },
291
- /**
292
- * Determines the initially selected value of the group. Corresponds to the BentoSelectionCardItem's value.
293
- * Defaults to no value selected.
294
- */
295
- modelValue: {
296
- type: [Array, String, Number],
297
- default: null
298
- },
299
- /**
300
- * Indicates the field is optional.
301
- */
302
- optional: { type: Boolean, default: !1 },
303
- /**
304
- * Indicates the field is required.
305
- */
306
- required: { type: Boolean, default: !1 },
307
- /**
308
- * Tooltip message.
309
- */
310
- tooltipText: { type: String, default: null },
311
- /**
312
- * If set to true, renders all cards in the group in a readonly state.
313
- */
314
- readonly: { type: Boolean, default: !1 },
315
- /**
316
- * Renders the cards with a checkbox or a radio input. Selection logic will also apply in accordance.
317
- * @values checkbox, radio
318
- */
319
- variant: { type: String, default: "checkbox" }
320
- },
321
- emits: ["input", "update:model-value"],
322
- setup(e, { emit: j }) {
323
- const a = e, x = j, z = le(), c = (l) => !!z[l], B = o(() => ({
324
- "b-selection-card-group__items--horizontal": a.layout === "horizontal"
325
- })), p = V(a.modelValue);
326
- se(
327
- () => a.modelValue,
328
- () => {
329
- p.value = a.modelValue;
330
- }
331
- );
332
- const L = H("error"), C = o(() => !a.disabled && !a.readonly && !!a.errorMessage), N = V(null), { width: _ } = fe(N), O = o(() => ve.split("px")[0]), U = o(() => ye.split("px")[0]), h = o(() => _.value < O.value ? "small" : _.value >= O.value && _.value < U.value ? "medium" : "large"), n = o(() => {
333
- var l;
334
- return ((l = a.itemsPerRow) == null ? void 0 : l[h == null ? void 0 : h.value]) || a.items.length;
335
- }), D = o(() => {
336
- if (!a.itemsPerRow)
337
- return [];
338
- const l = [];
339
- for (let v = 0; v < a.items.length; v += n == null ? void 0 : n.value)
340
- l.push(a.items.slice(v, v + (n == null ? void 0 : n.value)));
341
- return l;
342
- }), S = o(() => 12 / (n == null ? void 0 : n.value)), w = o(() => n != null && n.value ? new Array(n == null ? void 0 : n.value).fill({
343
- // Instead of passing the actual screen sizes values, passing the same values per each screen size and recomputing it makes sure visually the change is smoother and not laggy
344
- small: S.value,
345
- medium: S.value,
346
- large: S.value
347
- }) : []), R = (l) => {
348
- p.value = l, x("update:model-value", l), x("input", l);
349
- }, b = o(() => a.variant === "radio");
350
- return ue(oe, b), ce(() => {
351
- a.itemsPerRow && Object.values(a.itemsPerRow).forEach((l) => {
352
- if (l && (l < 2 || l > 6))
353
- throw new Error(
354
- "itemsPerRow values must have a value between 2 and 6 items per row. Read the documentation for more information."
355
- );
356
- });
357
- }), (l, v) => (i(), f(t(ge), {
358
- ref_key: "containerRef",
359
- ref: N,
360
- "aria-describedby": C.value ? t(L) : null,
361
- label: e.label,
362
- "hide-label": e.hideLabel,
363
- description: e.description,
364
- disabled: e.disabled,
365
- "tooltip-text": e.tooltipText,
366
- readonly: e.readonly,
367
- required: e.required,
368
- optional: e.optional,
369
- class: "b-selection-card-group",
370
- "component-name": "selection-card-group"
371
- }, {
372
- default: u(() => [
373
- !e.itemsPerRow || e.layout === "vertical" ? (i(), E("div", {
374
- key: 0,
375
- class: k(["b-selection-card-group__items", B.value])
376
- }, [
377
- (i(!0), E(Z, null, W(e.items, (d) => (i(), f(ee, m({
378
- key: `selection-card-${d.value}`,
379
- class: "b-selection-card-group__item",
380
- ref_for: !0
381
- }, d, {
382
- "model-value": p.value,
383
- readonly: e.readonly || d.readonly,
384
- "has-error": C.value,
385
- disabled: e.disabled || d.disabled,
386
- "onUpdate:modelValue": R
387
- }), F({ _: 2 }, [
388
- c("icon") && d.icon ? {
389
- name: "icon",
390
- fn: u(() => [
391
- y(l.$slots, "icon", m({ ref_for: !0 }, d), void 0, !0)
392
- ]),
393
- key: "0"
394
- } : void 0,
395
- c("content") && d.content ? {
396
- name: "content",
397
- fn: u(() => [
398
- y(l.$slots, "content", m({ ref_for: !0 }, d), void 0, !0)
399
- ]),
400
- key: "1"
401
- } : void 0,
402
- c("dynamicContent") && d.dynamicContent ? {
403
- name: "dynamicContent",
404
- fn: u(() => [
405
- y(l.$slots, "dynamicContent", m({ ref_for: !0 }, d), void 0, !0)
406
- ]),
407
- key: "2"
408
- } : void 0
409
- ]), 1040, ["model-value", "readonly", "has-error", "disabled"]))), 128))
410
- ], 2)) : (i(), E("div", {
411
- key: `selection-card-group-layout-breakpoint-${h.value}`
412
- }, [
413
- (i(!0), E(Z, null, W(D.value, (d, T) => (i(), f(t(ke), {
414
- key: `selection-card-group-row-${T}-cols-${n.value}`,
415
- class: "b-selection-card-group__items--wrap",
416
- "column-width": w.value
417
- }, F({ _: 2 }, [
418
- W(d, (s, r) => ({
419
- name: `col-${r + 1}`,
420
- fn: u(() => [
421
- (i(), f(ee, m({
422
- key: `selection-card-${s.value}`,
423
- class: "b-selection-card-group__item b-selection-card-group__item--full-height",
424
- ref_for: !0
425
- }, s, {
426
- "model-value": p.value,
427
- readonly: e.readonly || s.readonly,
428
- "has-error": C.value,
429
- disabled: e.disabled || s.disabled,
430
- "onUpdate:modelValue": R
431
- }), F({ _: 2 }, [
432
- c("icon") && s.icon ? {
433
- name: "icon",
434
- fn: u(() => [
435
- y(l.$slots, "icon", m({ ref_for: !0 }, s), void 0, !0)
436
- ]),
437
- key: "0"
438
- } : void 0,
439
- c("content") && s.content ? {
440
- name: "content",
441
- fn: u(() => [
442
- y(l.$slots, "content", m({ ref_for: !0 }, s), void 0, !0)
443
- ]),
444
- key: "1"
445
- } : void 0,
446
- c("dynamicContent") && s.dynamicContent ? {
447
- name: "dynamicContent",
448
- fn: u(() => [
449
- y(l.$slots, "dynamicContent", m({ ref_for: !0 }, s), void 0, !0)
450
- ]),
451
- key: "2"
452
- } : void 0
453
- ]), 1040, ["model-value", "readonly", "has-error", "disabled"]))
454
- ])
455
- }))
456
- ]), 1032, ["column-width"]))), 128))
457
- ])),
458
- C.value ? (i(), f(t(Ce), {
459
- key: 2,
460
- id: t(L),
461
- "error-message": e.errorMessage,
462
- class: "b-selection-card-group__error-message"
463
- }, null, 8, ["id", "error-message"])) : $("", !0)
464
- ]),
465
- _: 3
466
- }, 8, ["aria-describedby", "label", "hide-label", "description", "disabled", "tooltip-text", "readonly", "required", "optional"]));
467
- }
468
- }), je = /* @__PURE__ */ te(xe, [["__scopeId", "data-v-e9577916"]]);
469
- export {
470
- ee as B,
471
- G as a,
472
- je as s
473
- };
474
- //# sourceMappingURL=selection-card-group._RgLiMyQ.js.map