bootstrap-vue-next 0.46.2 → 0.46.4
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/{BApp-GXR1wS6K.js → BApp-Bg5xEz8H.js} +14 -2
- package/dist/BApp-Bg5xEz8H.js.map +1 -0
- package/dist/{BAutocomplete-DGvKY7-D.js → BAutocomplete-BFbbKtpz.js} +2 -2
- package/dist/{BAutocomplete-DGvKY7-D.js.map → BAutocomplete-BFbbKtpz.js.map} +1 -1
- package/dist/{BFormInput-BwvdFGDu.js → BFormInput-_AkAy6Wk.js} +4 -4
- package/dist/BFormInput-_AkAy6Wk.js.map +1 -0
- package/dist/{BFormOtp-I1t8dqPS.js → BFormOtp-C3vmDnzs.js} +2 -2
- package/dist/{BFormOtp-I1t8dqPS.js.map → BFormOtp-C3vmDnzs.js.map} +1 -1
- package/dist/{BFormTextarea-DlDe26DL.js → BFormTextarea-CBBlEcrV.js} +4 -4
- package/dist/BFormTextarea-CBBlEcrV.js.map +1 -0
- package/dist/bootstrap-vue-next.mjs +5 -5
- package/dist/composables/useFormInput.d.mts +1 -0
- package/dist/composables/useFormInput.d.ts +1 -0
- package/dist/src/components/BApp/index.mjs +1 -1
- package/dist/src/components/BAutocomplete/index.mjs +1 -1
- package/dist/src/components/BFormInput/index.mjs +1 -1
- package/dist/src/components/BFormOtp/index.mjs +1 -1
- package/dist/src/components/BFormTextarea/index.mjs +1 -1
- package/dist/src/components/index.mjs +5 -5
- package/dist/{useFormInput-DZ_3ZH1o.js → useFormInput-C-iXRxog.js} +18 -4
- package/dist/useFormInput-C-iXRxog.js.map +1 -0
- package/package.json +1 -1
- package/dist/BApp-GXR1wS6K.js.map +0 -1
- package/dist/BFormInput-BwvdFGDu.js.map +0 -1
- package/dist/BFormTextarea-DlDe26DL.js.map +0 -1
- package/dist/useFormInput-DZ_3ZH1o.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BFormTextarea-DlDe26DL.js","names":[],"sources":["../src/composables/useTextareaResize.ts","../src/components/BFormTextarea/BFormTextarea.vue","../src/components/BFormTextarea/BFormTextarea.vue"],"sourcesContent":["import {useToNumber} from '@vueuse/core'\nimport type {Numberish} from '../types/CommonTypes'\nimport {\n computed,\n type CSSProperties,\n type MaybeRefOrGetter,\n nextTick,\n onMounted,\n ref,\n type ShallowRef,\n toValue,\n} from 'vue'\nimport {isVisible} from '../utils/dom'\n\nexport const useTextareaResize = (\n input: Readonly<ShallowRef<HTMLTextAreaElement | null>>,\n {\n maxRows,\n noAutoShrink,\n rows,\n }: {\n rows: MaybeRefOrGetter<Numberish>\n maxRows: MaybeRefOrGetter<Numberish | undefined>\n noAutoShrink: MaybeRefOrGetter<boolean>\n }\n) => {\n const height = ref<number | null | string>(0)\n const maxRowsNumber = useToNumber(\n computed(() => toValue(maxRows) || Number.NaN),\n {\n method: 'parseInt',\n nanToZero: true,\n }\n )\n const rowsNumber = useToNumber(rows, {\n method: 'parseInt',\n nanToZero: true,\n })\n const computedMinRows = computed(() => Math.max(rowsNumber.value || 2, 2))\n const computedMaxRows = computed(() => Math.max(computedMinRows.value, maxRowsNumber.value || 0))\n const computedRows = computed(() =>\n computedMinRows.value === computedMaxRows.value ? computedMinRows.value : null\n )\n\n const handleHeightChange = async () => {\n // Element must be visible (not hidden) and in document\n // Must be checked after above checks\n if (!input.value || !isVisible(input.value)) {\n height.value = null\n return\n }\n\n // Get current computed styles\n const computedStyle = getComputedStyle(input.value)\n // Height of one line of text in px\n const lineHeight = Number.parseFloat(computedStyle.lineHeight) || 1\n // Calculate height of border and padding\n const border =\n (Number.parseFloat(computedStyle.borderTopWidth) || 0) +\n (Number.parseFloat(computedStyle.borderBottomWidth) || 0)\n const padding =\n (Number.parseFloat(computedStyle.paddingTop) || 0) +\n (Number.parseFloat(computedStyle.paddingBottom) || 0)\n // Calculate offset\n const offset = border + padding\n // Minimum height for min rows (which must be 2 rows or greater for cross-browser support)\n const minHeight = lineHeight * computedMinRows.value + offset\n\n // Get the current style height (with `px` units)\n const oldHeight = input.value.style.height || computedStyle.height\n // Probe scrollHeight by temporarily changing the height to `auto`\n height.value = 'auto'\n await nextTick() // We need to wait for the dom to update. These cannot be batched in the same tick\n // Re-check input.value after await since the element may have been unmounted\n // (e.g., during SSR hydration when BFormGroup re-renders its wrapper element)\n if (!input.value) return\n const {scrollHeight} = input.value\n // Place the original old height back on the element, just in case `computedProp`\n // returns the same value as before\n height.value = oldHeight\n await nextTick() // We need to wait for the dom to update. These cannot be batched in the same tick\n if (!input.value) return\n\n // Calculate content height in 'rows' (scrollHeight includes padding but not border)\n const contentRows = Math.max((scrollHeight - padding) / lineHeight, 2)\n // Calculate number of rows to display (limited within min/max rows)\n const rows = Math.min(Math.max(contentRows, computedMinRows.value), computedMaxRows.value)\n // Calculate the required height of the textarea including border and padding (in pixels)\n const newHeight = Math.max(Math.ceil(rows * lineHeight + offset), minHeight)\n\n // Computed height remains the larger of `oldHeight` and new `height`,\n // when height is in `sticky` mode (prop `no-auto-shrink` is true)\n if (toValue(noAutoShrink) && (Number.parseFloat(oldHeight.toString()) || 0) > newHeight) {\n height.value = oldHeight\n return\n }\n\n // Return the new computed CSS height in px units\n height.value = `${newHeight}px`\n }\n\n onMounted(handleHeightChange)\n\n const computedStyles = computed<CSSProperties>(() => ({\n resize: 'none',\n height:\n typeof height.value === 'string'\n ? height.value\n : height.value\n ? `${height.value}px`\n : undefined,\n }))\n\n return {\n onInput: handleHeightChange,\n computedStyles,\n computedRows,\n }\n}\n","<template>\n <textarea\n :id=\"computedId\"\n ref=\"_input\"\n :class=\"computedClasses\"\n :name=\"props.name || undefined\"\n :form=\"props.form || undefined\"\n :value=\"modelValue ?? undefined\"\n :disabled=\"isDisabled\"\n :placeholder=\"props.placeholder\"\n :required=\"props.required || undefined\"\n :autocomplete=\"props.autocomplete || undefined\"\n :readonly=\"props.readonly || props.plaintext\"\n :aria-required=\"props.required || undefined\"\n :aria-invalid=\"computedAriaInvalid\"\n :rows=\"computedRows || 2\"\n :style=\"computedStyles\"\n :wrap=\"props.wrap || undefined\"\n @input=\"\n (e) => {\n onInput(e)\n handleHeightChange()\n }\n \"\n @change=\"onChange\"\n @blur=\"onBlur\"\n />\n</template>\n\n<script setup lang=\"ts\">\nimport type {BFormTextareaProps} from '../../types'\nimport {computed, type CSSProperties, useTemplateRef} from 'vue'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {normalizeInput} from '../../utils/normalizeInput'\nimport {useFormInput} from '../../composables/useFormInput'\nimport {useTextareaResize} from '../../composables/useTextareaResize'\n\nconst _props = withDefaults(defineProps<Omit<BFormTextareaProps, 'modelValue'>>(), {\n // CommonInputProps\n ariaInvalid: undefined,\n autocomplete: undefined,\n autofocus: false,\n debounce: 0,\n debounceMaxWait: Number.NaN,\n disabled: false,\n form: undefined,\n formatter: undefined,\n id: undefined,\n lazyFormatter: false,\n list: undefined,\n modelValue: '',\n name: undefined,\n placeholder: undefined,\n plaintext: false,\n readonly: false,\n required: false,\n size: undefined,\n state: undefined,\n // End CommonInputProps\n noResize: false,\n noAutoShrink: false,\n maxRows: undefined,\n rows: 2,\n wrap: 'soft',\n})\nconst props = useDefaults(_props, 'BFormTextarea')\n\nconst [modelValue, modelModifiers] = defineModel<\n Exclude<BFormTextareaProps['modelValue'], undefined>,\n 'trim' | 'lazy' | 'number'\n>({\n default: '',\n set: (v) => normalizeInput(v, modelModifiers),\n})\n\nconst input = useTemplateRef('_input')\n\nconst {\n computedId,\n computedAriaInvalid,\n onInput,\n stateClass,\n onChange,\n onBlur,\n focus,\n blur,\n isDisabled,\n} = useFormInput(props, input, modelValue, modelModifiers)\n\nconst computedClasses = computed(() => [\n stateClass.value,\n props.plaintext ? 'form-control-plaintext' : 'form-control',\n {\n [`form-control-${props.size}`]: !!props.size,\n },\n])\n\nconst {\n computedStyles: resizeStyles,\n onInput: handleHeightChange,\n computedRows,\n} = useTextareaResize(input, {\n maxRows: () => props.maxRows,\n rows: () => props.rows,\n noAutoShrink: () => props.noAutoShrink,\n})\n\nconst computedStyles = computed<CSSProperties>(() => ({\n resize: props.noResize ? 'none' : undefined,\n ...(props.maxRows || props.noAutoShrink ? resizeStyles.value : undefined),\n}))\n\ndefineExpose({\n blur,\n element: input,\n flushDebounce: onBlur,\n focus,\n})\n</script>\n","<template>\n <textarea\n :id=\"computedId\"\n ref=\"_input\"\n :class=\"computedClasses\"\n :name=\"props.name || undefined\"\n :form=\"props.form || undefined\"\n :value=\"modelValue ?? undefined\"\n :disabled=\"isDisabled\"\n :placeholder=\"props.placeholder\"\n :required=\"props.required || undefined\"\n :autocomplete=\"props.autocomplete || undefined\"\n :readonly=\"props.readonly || props.plaintext\"\n :aria-required=\"props.required || undefined\"\n :aria-invalid=\"computedAriaInvalid\"\n :rows=\"computedRows || 2\"\n :style=\"computedStyles\"\n :wrap=\"props.wrap || undefined\"\n @input=\"\n (e) => {\n onInput(e)\n handleHeightChange()\n }\n \"\n @change=\"onChange\"\n @blur=\"onBlur\"\n />\n</template>\n\n<script setup lang=\"ts\">\nimport type {BFormTextareaProps} from '../../types'\nimport {computed, type CSSProperties, useTemplateRef} from 'vue'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {normalizeInput} from '../../utils/normalizeInput'\nimport {useFormInput} from '../../composables/useFormInput'\nimport {useTextareaResize} from '../../composables/useTextareaResize'\n\nconst _props = withDefaults(defineProps<Omit<BFormTextareaProps, 'modelValue'>>(), {\n // CommonInputProps\n ariaInvalid: undefined,\n autocomplete: undefined,\n autofocus: false,\n debounce: 0,\n debounceMaxWait: Number.NaN,\n disabled: false,\n form: undefined,\n formatter: undefined,\n id: undefined,\n lazyFormatter: false,\n list: undefined,\n modelValue: '',\n name: undefined,\n placeholder: undefined,\n plaintext: false,\n readonly: false,\n required: false,\n size: undefined,\n state: undefined,\n // End CommonInputProps\n noResize: false,\n noAutoShrink: false,\n maxRows: undefined,\n rows: 2,\n wrap: 'soft',\n})\nconst props = useDefaults(_props, 'BFormTextarea')\n\nconst [modelValue, modelModifiers] = defineModel<\n Exclude<BFormTextareaProps['modelValue'], undefined>,\n 'trim' | 'lazy' | 'number'\n>({\n default: '',\n set: (v) => normalizeInput(v, modelModifiers),\n})\n\nconst input = useTemplateRef('_input')\n\nconst {\n computedId,\n computedAriaInvalid,\n onInput,\n stateClass,\n onChange,\n onBlur,\n focus,\n blur,\n isDisabled,\n} = useFormInput(props, input, modelValue, modelModifiers)\n\nconst computedClasses = computed(() => [\n stateClass.value,\n props.plaintext ? 'form-control-plaintext' : 'form-control',\n {\n [`form-control-${props.size}`]: !!props.size,\n },\n])\n\nconst {\n computedStyles: resizeStyles,\n onInput: handleHeightChange,\n computedRows,\n} = useTextareaResize(input, {\n maxRows: () => props.maxRows,\n rows: () => props.rows,\n noAutoShrink: () => props.noAutoShrink,\n})\n\nconst computedStyles = computed<CSSProperties>(() => ({\n resize: props.noResize ? 'none' : undefined,\n ...(props.maxRows || props.noAutoShrink ? resizeStyles.value : undefined),\n}))\n\ndefineExpose({\n blur,\n element: input,\n flushDebounce: onBlur,\n focus,\n})\n</script>\n"],"mappings":";;;;;;AAcA,IAAa,qBACX,OACA,EACE,SACA,cACA,WAMC;CACH,MAAM,SAAS,IAA4B,CAAC;CAC5C,MAAM,gBAAgB,YACpB,eAAe,QAAQ,OAAO,KAAK,GAAU,GAC7C;EACE,QAAQ;EACR,WAAW;CACb,CACF;CACA,MAAM,aAAa,YAAY,MAAM;EACnC,QAAQ;EACR,WAAW;CACb,CAAC;CACD,MAAM,kBAAkB,eAAe,KAAK,IAAI,WAAW,SAAS,GAAG,CAAC,CAAC;CACzE,MAAM,kBAAkB,eAAe,KAAK,IAAI,gBAAgB,OAAO,cAAc,SAAS,CAAC,CAAC;CAChG,MAAM,eAAe,eACnB,gBAAgB,UAAU,gBAAgB,QAAQ,gBAAgB,QAAQ,IAC5E;CAEA,MAAM,qBAAqB,YAAY;EAGrC,IAAI,CAAC,MAAM,SAAS,CAAC,UAAU,MAAM,KAAK,GAAG;G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c,MAAA,mBAAA;IACd,MAAM,MAAA,YAAA,KAAY;IAClB,OAAK,eAAE,eAAA,KAAc;IACrB,MAAM,MAAA,KAAA,CAAK,CAAC,QAAQ,KAAA;IACpB,SAAK,OAAA,OAAA,OAAA,MAAU,MAAC;KAAe,MAAA,OAAA,CAAO,CAAC,CAAC;KAAU,MAAA,kBAAA,CAAkB,CAAA;;IAMpE,UAAM,OAAA,OAAA,OAAA,MAAE,GAAA,SAAA,MAAA,QAAA,KAAA,MAAA,QAAA,CAAA,CAAA,GAAA,IAAA;IACR,QAAI,OAAA,OAAA,OAAA,MAAE,GAAA,SAAA,MAAA,MAAA,KAAA,MAAA,MAAA,CAAA,CAAA,GAAA,IAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useFormInput-DZ_3ZH1o.js","names":[],"sources":["../src/utils/normalizeInput.ts","../src/composables/useFormInput.ts"],"sourcesContent":["import type {Numberish} from '../types/CommonTypes'\n\nexport const normalizeInput = (\n v: Numberish | null,\n modelModifiers: Record<'number' | 'lazy' | 'trim', true | undefined>\n) => {\n if (v === null) return\n let update = v\n if (modelModifiers.number && typeof update === 'string' && update !== '') {\n const parsed = Number.parseFloat(update)\n update = Number.isNaN(parsed) ? update : parsed\n }\n return update\n}\n","import type {Numberish} from '../types/CommonTypes'\nimport {computed, inject, nextTick, onActivated, onMounted, type Ref, type ShallowRef} from 'vue'\nimport {useAriaInvalid} from './useAriaInvalid'\nimport {useId} from './useId'\nimport {useFocus, useToNumber} from '@vueuse/core'\nimport type {CommonInputProps} from '../types/FormCommonInputProps'\nimport {formGroupKey} from '../utils/keys'\nimport {useDebounceFn} from '../utils/debounce'\nimport {useStateClass} from './useStateClass'\n\nexport const useFormInput = (\n props: Readonly<CommonInputProps>,\n input:\n | Readonly<ShallowRef<HTMLInputElement | null>>\n | Readonly<ShallowRef<HTMLTextAreaElement | null>>,\n modelValue: Ref<Numberish | null>,\n modelModifiers: Record<'number' | 'lazy' | 'trim', true | undefined>\n) => {\n const computedId = useId(() => props.id, 'input')\n const debounceNumber = useToNumber(() => props.debounce ?? 0, {nanToZero: true})\n const debounceMaxWaitNumber = useToNumber(() => props.debounceMaxWait ?? Number.NaN)\n\n // This automatically adds the appropriate \"for\" attribute to a BFormGroup label\n const formGroupData = inject(formGroupKey, null)?.()\n formGroupData?.track(computedId)\n const computedState = computed(() =>\n props.state !== undefined ? props.state : (formGroupData?.state.value ?? null)\n )\n const isDisabled = computed(() => props.disabled || (formGroupData?.disabled.value ?? false))\n const computedAriaInvalid = useAriaInvalid(() => props.ariaInvalid, computedState)\n const stateClass = useStateClass(computedState)\n\n const internalUpdateModelValue = useDebounceFn(\n (value: Numberish) => {\n modelValue.value = value\n },\n () => (modelModifiers.lazy === true ? 0 : debounceNumber.value),\n {maxWait: () => (modelModifiers.lazy === true ? Number.NaN : debounceMaxWaitNumber.value)}\n )\n\n const updateModelValue = (value: Numberish, force = false, immediate = false) => {\n if (modelModifiers.lazy === true && force === false) return\n if (immediate) {\n modelValue.value = value\n } else {\n internalUpdateModelValue(value)\n }\n }\n\n const {focused} = useFocus(input, {\n initialValue: props.autofocus,\n })\n\n const _formatValue = (value: string, evt: Readonly<Event>, force = false) => {\n if (props.formatter !== undefined && (!props.lazyFormatter || force)) {\n return props.formatter(value, evt)\n }\n return value\n }\n onMounted(() => {\n if (input.value) {\n input.value.value = modelValue.value?.toString() ?? ''\n }\n })\n\n onActivated(() => {\n nextTick(() => {\n if (props.autofocus) {\n focused.value = true\n }\n })\n })\n\n const syncDisplayedValue = (nextValue: string) => {\n if (input.value && input.value.value !== nextValue) {\n input.value.value = nextValue\n }\n }\n\n const onInput = (evt: Readonly<Event>) => {\n const {value} = evt.target as HTMLInputElement\n const formattedValue = _formatValue(value, evt)\n if (evt.defaultPrevented) {\n evt.preventDefault()\n return\n }\n\n const nextModel = formattedValue\n\n updateModelValue(nextModel)\n // If the formatter changed the value, directly update the input's visual value\n // to keep the displayed text in sync with the model. Without this, if the\n // formatted value equals the previous model value, Vue's reactivity won't\n // re-render the input and the raw (unformatted) text remains visible.\n if (formattedValue !== value) {\n syncDisplayedValue(formattedValue)\n }\n }\n\n const onChange = (evt: Readonly<Event>) => {\n const {value} = evt.target as HTMLInputElement\n const formattedValue = _formatValue(value, evt)\n if (evt.defaultPrevented) {\n evt.preventDefault()\n return\n }\n\n const nextModel = formattedValue\n if (modelValue.value !== nextModel) {\n updateModelValue(formattedValue, true)\n }\n }\n\n const onBlur = (evt: Readonly<FocusEvent>) => {\n if (\n !modelModifiers.lazy &&\n !props.lazyFormatter &&\n !modelModifiers.trim &&\n debounceNumber.value <= 0\n )\n return\n\n const {value} = evt.target as HTMLInputElement\n const formattedValue = _formatValue(value, evt, true)\n\n const nextModel = modelModifiers.trim ? formattedValue.trim() : formattedValue\n\n // Cancel before modelValue.value comparison and update\n internalUpdateModelValue.cancel()\n if (modelValue.value !== nextModel) {\n updateModelValue(nextModel, true, true)\n }\n\n // If the formatter or trim changed the displayed text, directly sync the DOM.\n // This handles the case where lazyFormatter defers formatting to blur and the\n // formatted value equals the current model (so Vue's reactivity won't re-render).\n if (nextModel !== value) {\n syncDisplayedValue(nextModel)\n }\n }\n\n const focus = () => {\n if (!isDisabled.value) {\n focused.value = true\n }\n }\n\n const blur = () => {\n if (!isDisabled.value) {\n focused.value = false\n }\n }\n\n return {\n input,\n computedId,\n computedAriaInvalid,\n onInput,\n onChange,\n onBlur,\n focus,\n blur,\n stateClass,\n isDisabled,\n }\n}\n"],"mappings":";;;;;;;;;AAEA,IAAa,kBACX,GACA,mBACG;CACH,IAAI,MAAM,MAAM;CAChB,IAAI,SAAS;CACb,IAAI,eAAe,UAAU,OAAO,WAAW,YAAY,WAAW,IAAI;EACxE,MAAM,SAAS,OAAO,WAAW,MAAM;EACvC,SAAS,OAAO,MAAM,MAAM,IAAI,SAAS;CAC3C;CACA,OAAO;AACT;;;ACHA,IAAa,gBACX,OACA,OAGA,YACA,mBACG;CACH,MAAM,aAAa,cAAY,MAA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