UNPKG

bootstrap-vue-next

Version:

Seamless integration of Vue 3, Bootstrap 5, and TypeScript for modern, type-safe UI development

899 lines (898 loc) 31.3 kB
import { C as useVModel } from "./dist-Dn5blevd.mjs"; import { t as useId$1 } from "./useId-CCwnEmGh.mjs"; import { t as useDefaults } from "./useDefaults-CCWS15M8.mjs"; import { A as isBeforeOrSame, G as $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3, I as $11d87f3f76e88657$export$b21e0b124e224484, P as $35ea8db9cb2ccb90$export$680ea196effce5f, W as $14e0f24ef4ac5c92$export$aa8b41735afcabd2, X as isNullish, Z as createContext, a as createContent, b as normalizeHourCycle, c as syncSegmentValues, d as usePrimitiveElement, f as Primitive, g as useDateFormatter, h as useDirection, i as isSegmentNavigationKey, k as isBefore, l as syncTimeSegmentValues, m as useKbd, p as useLocale, r as getTimeFieldSegmentElements, s as initializeTimeSegmentValues, t as useDateField, u as VisuallyHidden_default, w as getDefaultTime, x as areAllDaysBetweenValid, y as normalizeDateStep } from "./useDateField-PQjSLAVI.mjs"; import { i as DateFieldRoot_default, n as DateRangeFieldRoot_default, r as DateFieldInput_default, t as DateRangeFieldInput_default } from "./DateRangeFieldInput-bA6IK9lx.mjs"; import { Fragment, computed, createBlock, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeModels, mergeProps, nextTick, normalizeClass, onMounted, openBlock, ref, renderList, renderSlot, toDisplayString, toHandlers, toRefs, unref, useModel, watch, withCtx, withKeys } from "vue"; //#region ../../node_modules/.pnpm/reka-ui@2.9.2_vue@3.5.31_typescript@5.9.3_/node_modules/reka-ui/dist/TimeRangeField/TimeRangeFieldRoot.js var [injectTimeRangeFieldRootContext, provideTimeRangeFieldRootContext] = createContext("TimeRangeFieldRoot"); function convertValue(value, date = $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3($14e0f24ef4ac5c92$export$aa8b41735afcabd2())) { if (value && "day" in value) return value; return $11d87f3f76e88657$export$b21e0b124e224484(date, value); } var TimeRangeFieldRoot_default = /* @__PURE__ */ defineComponent({ inheritAttrs: false, __name: "TimeRangeFieldRoot", props: { defaultValue: { type: Object, required: false, default: void 0 }, defaultPlaceholder: { type: Object, required: false }, placeholder: { type: Object, required: false, default: void 0 }, modelValue: { type: [Object, null], required: false }, hourCycle: { type: null, required: false }, step: { type: Object, required: false }, granularity: { type: String, required: false }, hideTimeZone: { type: Boolean, required: false }, maxValue: { type: Object, required: false }, minValue: { type: Object, required: false }, locale: { type: String, required: false }, disabled: { type: Boolean, required: false, default: false }, readonly: { type: Boolean, required: false, default: false }, id: { type: String, required: false }, dir: { type: String, required: false }, isTimeUnavailable: { type: Function, required: false, default: void 0 }, asChild: { type: Boolean, required: false }, as: { type: null, required: false }, name: { type: String, required: false }, required: { type: Boolean, required: false } }, emits: ["update:modelValue", "update:placeholder"], setup(__props, { expose: __expose, emit: __emit }) { const props = __props; const emits = __emit; const { disabled, readonly, granularity, defaultValue, minValue, maxValue, dir: propDir, locale: propLocale, isTimeUnavailable: propsIsTimeUnavailable } = toRefs(props); const locale = useLocale(propLocale); const dir = useDirection(propDir); const formatter = useDateFormatter(locale.value, { hourCycle: normalizeHourCycle(props.hourCycle) }); const { primitiveElement, currentElement: parentElement } = usePrimitiveElement(); const segmentElements = ref(/* @__PURE__ */ new Set()); const step = computed(() => normalizeDateStep(props)); const convertedMinValue = computed(() => minValue.value ? convertValue(minValue.value) : void 0); const convertedMaxValue = computed(() => maxValue.value ? convertValue(maxValue.value) : void 0); onMounted(() => { getTimeFieldSegmentElements(parentElement.value).forEach((item) => segmentElements.value.add(item)); }); const modelValue = useVModel(props, "modelValue", emits, { defaultValue: defaultValue.value ?? { start: void 0, end: void 0 }, passive: props.modelValue === void 0 }); const isStartInvalid = computed(() => { if (!modelValue.value?.start) return false; const convertedStartValue$1 = convertValue(modelValue.value.start); if (propsIsTimeUnavailable.value?.(convertedStartValue$1)) return true; if (convertedMinValue.value && isBefore(convertedStartValue$1, convertedMinValue.value)) return true; if (convertedMaxValue.value && isBefore(convertedMaxValue.value, convertedStartValue$1)) return true; return false; }); const isEndInvalid = computed(() => { if (!modelValue.value?.end) return false; const convertedEndValue$1 = convertValue(modelValue.value.end); if (propsIsTimeUnavailable.value?.(convertedEndValue$1)) return true; if (convertedMinValue.value && isBefore(convertedEndValue$1, convertedMinValue.value)) return true; if (convertedMaxValue.value && isBefore(convertedMaxValue.value, convertedEndValue$1)) return true; return false; }); const isInvalid = computed(() => { if (isStartInvalid.value || isEndInvalid.value) return true; if (!modelValue.value?.start || !modelValue.value?.end) return false; const convertedModelValue$1 = { start: convertValue(modelValue.value.start), end: convertValue(modelValue.value.end) }; if (!isBeforeOrSame(convertedModelValue$1.start, convertedModelValue$1.end)) return true; if (propsIsTimeUnavailable.value !== void 0) { if (!areAllDaysBetweenValid(convertedModelValue$1.start, convertedModelValue$1.end, propsIsTimeUnavailable.value, void 0)) return true; } return false; }); const startValue = ref(modelValue.value?.start?.copy()); const endValue = ref(modelValue.value?.end?.copy()); watch([startValue, endValue], ([_startValue, _endValue]) => { modelValue.value = { start: _startValue?.copy(), end: _endValue?.copy() }; }); const convertedStartValue = computed({ get() { if (isNullish(startValue.value)) return startValue.value; return convertValue(startValue.value); }, set(newValue) { if (newValue) startValue.value = startValue.value && "day" in startValue.value ? newValue : new $35ea8db9cb2ccb90$export$680ea196effce5f(newValue.hour, newValue.minute, newValue.second, startValue.value?.millisecond); else startValue.value = newValue; return newValue; } }); const convertedEndValue = computed({ get() { if (isNullish(endValue.value)) return endValue.value; return convertValue(endValue.value); }, set(newValue) { if (newValue) endValue.value = endValue.value && "day" in endValue.value ? newValue : new $35ea8db9cb2ccb90$export$680ea196effce5f(newValue.hour, newValue.minute, newValue.second, endValue.value?.millisecond); else endValue.value = newValue; return newValue; } }); const convertedModelValue = computed(() => ({ start: convertedStartValue.value, end: convertedEndValue.value })); const defaultDate = getDefaultTime({ defaultPlaceholder: props.placeholder, defaultValue: modelValue.value?.start }); const placeholder = useVModel(props, "placeholder", emits, { defaultValue: props.defaultPlaceholder ?? defaultDate.copy(), passive: props.placeholder === void 0 }); const convertedPlaceholder = computed({ get() { return convertValue(placeholder.value); }, set(newValue) { if (newValue) placeholder.value = "day" in placeholder.value ? newValue.copy() : new $35ea8db9cb2ccb90$export$680ea196effce5f(newValue.hour, newValue.minute, newValue.second, placeholder.value?.millisecond); return newValue; } }); const inferredGranularity = computed(() => { if (granularity.value) return granularity.value; return "minute"; }); const initialSegments = initializeTimeSegmentValues(inferredGranularity.value); const startSegmentValues = ref(convertedStartValue.value ? { ...syncTimeSegmentValues({ value: convertedStartValue.value, formatter }) } : { ...initialSegments }); const endSegmentValues = ref(convertedEndValue.value ? { ...syncTimeSegmentValues({ value: convertedEndValue.value, formatter }) } : { ...initialSegments }); const startSegmentContent = computed(() => createContent({ granularity: inferredGranularity.value, dateRef: convertedPlaceholder.value, formatter, hideTimeZone: props.hideTimeZone, hourCycle: props.hourCycle, segmentValues: startSegmentValues.value, locale, isTimeValue: true })); const endSegmentContent = computed(() => createContent({ granularity: inferredGranularity.value, dateRef: convertedPlaceholder.value, formatter, hideTimeZone: props.hideTimeZone, hourCycle: props.hourCycle, segmentValues: endSegmentValues.value, locale, isTimeValue: true })); const segmentContents = computed(() => ({ start: startSegmentContent.value.arr, end: endSegmentContent.value.arr })); const editableSegmentContents = computed(() => ({ start: segmentContents.value.start.filter(({ part }) => part !== "literal"), end: segmentContents.value.end.filter(({ part }) => part !== "literal") })); watch(convertedModelValue, (_modelValue) => { if (_modelValue?.start && convertedStartValue.value ? _modelValue.start.compare(convertedStartValue.value) !== 0 : _modelValue?.start !== convertedStartValue.value) convertedStartValue.value = _modelValue?.start?.copy(); if (_modelValue?.end && convertedEndValue.value ? _modelValue.end.compare(convertedEndValue.value) !== 0 : _modelValue?.end !== convertedEndValue.value) convertedEndValue.value = _modelValue?.end?.copy(); }); watch([convertedStartValue, locale], ([_startValue]) => { if (_startValue !== void 0) startSegmentValues.value = { ...syncSegmentValues({ value: _startValue, formatter }) }; else if (Object.values(startSegmentValues.value).every((value) => value !== null) && _startValue === void 0) startSegmentValues.value = { ...initialSegments }; }); watch(locale, (value) => { if (formatter.getLocale() !== value) { formatter.setLocale(value); nextTick(() => { segmentElements.value.clear(); getTimeFieldSegmentElements(parentElement.value).forEach((item) => segmentElements.value.add(item)); }); } }); watch(convertedModelValue, (_modelValue) => { if (_modelValue && _modelValue.start !== void 0 && placeholder.value.compare(_modelValue.start) !== 0) placeholder.value = _modelValue.start.copy(); }); watch([convertedEndValue, locale], ([_endValue]) => { if (_endValue !== void 0) endSegmentValues.value = { ...syncSegmentValues({ value: _endValue, formatter }) }; else if (Object.values(endSegmentValues.value).every((value) => value !== null) && _endValue === void 0) endSegmentValues.value = { ...initialSegments }; }); const currentFocusedElement = ref(null); const currentSegmentIndex = computed(() => Array.from(segmentElements.value).findIndex((el) => el.getAttribute("data-reka-time-field-segment") === currentFocusedElement.value?.getAttribute("data-reka-time-field-segment") && el.getAttribute("data-reka-time-range-field-segment-type") === currentFocusedElement.value?.getAttribute("data-reka-time-range-field-segment-type"))); const nextFocusableSegment = computed(() => { const sign = dir.value === "rtl" ? -1 : 1; if (sign < 0 ? currentSegmentIndex.value < 0 : currentSegmentIndex.value > segmentElements.value.size - 1) return null; return Array.from(segmentElements.value)[currentSegmentIndex.value + sign]; }); const prevFocusableSegment = computed(() => { const sign = dir.value === "rtl" ? -1 : 1; if (sign > 0 ? currentSegmentIndex.value < 0 : currentSegmentIndex.value > segmentElements.value.size - 1) return null; return Array.from(segmentElements.value)[currentSegmentIndex.value - sign]; }); const kbd = useKbd(); function handleKeydown(e) { if (!isSegmentNavigationKey(e.key)) return; if (e.key === kbd.ARROW_LEFT) prevFocusableSegment.value?.focus(); if (e.key === kbd.ARROW_RIGHT) nextFocusableSegment.value?.focus(); } function setFocusedElement(el) { currentFocusedElement.value = el; } provideTimeRangeFieldRootContext({ locale, startValue: convertedStartValue, endValue: convertedEndValue, placeholder: convertedPlaceholder, disabled, formatter, hourCycle: props.hourCycle, step, readonly, isInvalid, segmentValues: { start: startSegmentValues, end: endSegmentValues }, segmentContents: editableSegmentContents, elements: segmentElements, setFocusedElement, focusNext() { nextFocusableSegment.value?.focus(); } }); __expose({ setFocusedElement }); return (_ctx, _cache) => { return openBlock(), createBlock(unref(Primitive), mergeProps(_ctx.$attrs, { ref_key: "primitiveElement", ref: primitiveElement, role: "group", "aria-disabled": unref(disabled) ? true : void 0, "data-disabled": unref(disabled) ? "" : void 0, "data-readonly": unref(readonly) ? "" : void 0, "data-invalid": isInvalid.value ? "" : void 0, dir: unref(dir), onKeydown: withKeys(handleKeydown, ["left", "right"]) }), { default: withCtx(() => [renderSlot(_ctx.$slots, "default", { modelValue: unref(modelValue), segments: segmentContents.value, isInvalid: isInvalid.value }), createVNode(unref(VisuallyHidden_default), { id: _ctx.id, as: "input", feature: "focusable", tabindex: "-1", value: `${unref(modelValue)?.start?.toString()} - ${unref(modelValue)?.end?.toString()}`, name: _ctx.name, disabled: unref(disabled), required: _ctx.required, onFocus: _cache[0] || (_cache[0] = ($event) => Array.from(segmentElements.value)?.[0]?.focus()) }, null, 8, [ "id", "value", "name", "disabled", "required" ])]), _: 3 }, 16, [ "aria-disabled", "data-disabled", "data-readonly", "data-invalid", "dir" ]); }; } }); //#endregion //#region ../../node_modules/.pnpm/reka-ui@2.9.2_vue@3.5.31_typescript@5.9.3_/node_modules/reka-ui/dist/TimeRangeField/TimeRangeFieldInput.js var TimeRangeFieldInput_default = /* @__PURE__ */ defineComponent({ __name: "TimeRangeFieldInput", props: { part: { type: null, required: true }, type: { type: String, required: true }, asChild: { type: Boolean, required: false }, as: { type: null, required: false } }, setup(__props) { const props = __props; const rootContext = injectTimeRangeFieldRootContext(); const hasLeftFocus = ref(true); const { handleSegmentClick, handleSegmentKeydown, attributes } = useDateField({ hasLeftFocus, lastKeyZero: ref(false), placeholder: rootContext.placeholder, hourCycle: rootContext.hourCycle, step: rootContext.step, segmentValues: rootContext.segmentValues[props.type], formatter: rootContext.formatter, part: props.part, disabled: rootContext.disabled, readonly: rootContext.readonly, focusNext: rootContext.focusNext, modelValue: props.type === "start" ? rootContext.startValue : rootContext.endValue }); const disabled = computed(() => rootContext.disabled.value); const readonly = computed(() => rootContext.readonly.value); const isInvalid = computed(() => rootContext.isInvalid.value); return (_ctx, _cache) => { return openBlock(), createBlock(unref(Primitive), mergeProps({ as: _ctx.as, "as-child": _ctx.asChild }, unref(attributes), { contenteditable: disabled.value || readonly.value ? false : _ctx.part !== "literal", "data-reka-time-field-segment": _ctx.part, "data-reka-time-range-field-segment-type": _ctx.type, "aria-disabled": disabled.value ? true : void 0, "aria-readonly": readonly.value ? true : void 0, "data-disabled": disabled.value ? "" : void 0, "data-invalid": isInvalid.value ? "" : void 0, "aria-invalid": isInvalid.value ? true : void 0 }, toHandlers(_ctx.part !== "literal" ? { mousedown: unref(handleSegmentClick), keydown: unref(handleSegmentKeydown), focusout: () => { hasLeftFocus.value = true; }, focusin: (e) => { unref(rootContext).setFocusedElement(e.target); } } : {})), { default: withCtx(() => [renderSlot(_ctx.$slots, "default")]), _: 3 }, 16, [ "as", "as-child", "contenteditable", "data-reka-time-field-segment", "data-reka-time-range-field-segment-type", "aria-disabled", "aria-readonly", "data-disabled", "data-invalid", "aria-invalid" ]); }; } }); //#endregion //#region src/components/BDateField/BDateField.vue var BDateField_default = /* @__PURE__ */ defineComponent({ __name: "BDateField", props: /* @__PURE__ */ mergeModels({ defaultPlaceholder: { default: void 0 }, defaultValue: { default: void 0 }, dir: { default: void 0 }, disabled: { type: Boolean, default: false }, granularity: { default: void 0 }, hideTimeZone: { type: Boolean, default: void 0 }, hourCycle: { default: void 0 }, id: { default: void 0 }, isDateUnavailable: { type: Function, default: void 0 }, locale: { default: void 0 }, maxValue: { default: void 0 }, minValue: { default: void 0 }, name: { default: void 0 }, readonly: { type: Boolean, default: false }, required: { type: Boolean, default: false }, size: { default: void 0 }, state: { type: [Boolean, null], default: null }, step: { default: void 0 } }, { "modelValue": { default: null }, "modelModifiers": {}, "placeholder": {}, "placeholderModifiers": {} }), emits: ["update:modelValue", "update:placeholder"], setup(__props) { const props = useDefaults(__props, "BDateField"); const modelValue = useModel(__props, "modelValue"); const placeholderModel = useModel(__props, "placeholder"); const computedId = useId$1(() => props.id, "date-field"); const computedRootClasses = computed(() => ({ "disabled": props.disabled, "readonly": props.readonly, "is-valid": props.state === true, "is-invalid": props.state === false, [`form-control-${props.size}`]: props.size !== void 0 })); return (_ctx, _cache) => { return openBlock(), createBlock(unref(DateFieldRoot_default), { id: unref(computedId), modelValue: modelValue.value, "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event), placeholder: placeholderModel.value, "onUpdate:placeholder": _cache[1] || (_cache[1] = ($event) => placeholderModel.value = $event), "default-value": unref(props).defaultValue, "default-placeholder": unref(props).defaultPlaceholder, "hour-cycle": unref(props).hourCycle, step: unref(props).step, granularity: unref(props).granularity, "hide-time-zone": unref(props).hideTimeZone, "max-value": unref(props).maxValue, "min-value": unref(props).minValue, locale: unref(props).locale, disabled: unref(props).disabled, readonly: unref(props).readonly, name: unref(props).name, required: unref(props).required, dir: unref(props).dir, "is-date-unavailable": unref(props).isDateUnavailable, class: normalizeClass([computedRootClasses.value, "b-date-field form-control d-inline-flex align-items-center gap-0"]) }, { default: withCtx(({ segments, isInvalid, modelValue: currentValue }) => [renderSlot(_ctx.$slots, "default", { modelValue: currentValue, segments, isInvalid }, () => [(openBlock(true), createElementBlock(Fragment, null, renderList(segments, ({ part, value }) => { return openBlock(), createElementBlock(Fragment, { key: part }, [part === "literal" ? (openBlock(), createBlock(unref(DateFieldInput_default), { key: 0, part, class: "b-date-field-literal" }, { default: withCtx(() => [createTextVNode(toDisplayString(value), 1)]), _: 2 }, 1032, ["part"])) : (openBlock(), createBlock(unref(DateFieldInput_default), { key: 1, part, class: "b-date-field-segment" }, { default: withCtx(() => [createTextVNode(toDisplayString(value), 1)]), _: 2 }, 1032, ["part"]))], 64); }), 128))])]), _: 3 }, 8, [ "id", "modelValue", "placeholder", "default-value", "default-placeholder", "hour-cycle", "step", "granularity", "hide-time-zone", "max-value", "min-value", "locale", "disabled", "readonly", "name", "required", "dir", "is-date-unavailable", "class" ]); }; } }); //#endregion //#region src/components/BDateField/BDateRangeField.vue var BDateRangeField_default = /* @__PURE__ */ defineComponent({ __name: "BDateRangeField", props: /* @__PURE__ */ mergeModels({ defaultPlaceholder: { default: void 0 }, defaultValue: { default: void 0 }, dir: { default: void 0 }, disabled: { type: Boolean, default: false }, granularity: { default: void 0 }, hideTimeZone: { type: Boolean, default: void 0 }, hourCycle: { default: void 0 }, id: { default: void 0 }, isDateUnavailable: { type: Function, default: void 0 }, locale: { default: void 0 }, maxValue: { default: void 0 }, minValue: { default: void 0 }, name: { default: void 0 }, readonly: { type: Boolean, default: false }, required: { type: Boolean, default: false }, size: { default: void 0 }, state: { type: [Boolean, null], default: null }, step: { default: void 0 } }, { "modelValue": { default: null }, "modelModifiers": {}, "placeholder": {}, "placeholderModifiers": {} }), emits: ["update:modelValue", "update:placeholder"], setup(__props) { const props = useDefaults(__props, "BDateRangeField"); const modelValue = useModel(__props, "modelValue"); const placeholderModel = useModel(__props, "placeholder"); const computedId = useId$1(() => props.id, "date-range-field"); const computedRootClasses = computed(() => ({ "disabled": props.disabled, "readonly": props.readonly, "is-valid": props.state === true, "is-invalid": props.state === false, [`form-control-${props.size}`]: props.size !== void 0 })); return (_ctx, _cache) => { return openBlock(), createBlock(unref(DateRangeFieldRoot_default), { id: unref(computedId), modelValue: modelValue.value, "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event), placeholder: placeholderModel.value, "onUpdate:placeholder": _cache[1] || (_cache[1] = ($event) => placeholderModel.value = $event), "default-value": unref(props).defaultValue, "default-placeholder": unref(props).defaultPlaceholder, "hour-cycle": unref(props).hourCycle, step: unref(props).step, granularity: unref(props).granularity, "hide-time-zone": unref(props).hideTimeZone, "max-value": unref(props).maxValue, "min-value": unref(props).minValue, locale: unref(props).locale, disabled: unref(props).disabled, readonly: unref(props).readonly, name: unref(props).name, required: unref(props).required, dir: unref(props).dir, "is-date-unavailable": unref(props).isDateUnavailable, class: normalizeClass([computedRootClasses.value, "b-date-range-field form-control d-inline-flex align-items-center gap-0"]) }, { default: withCtx(({ segments, isInvalid, modelValue: currentValue }) => [renderSlot(_ctx.$slots, "default", { modelValue: currentValue, segments, isInvalid }, () => [ (openBlock(true), createElementBlock(Fragment, null, renderList(segments.start, ({ part, value }) => { return openBlock(), createElementBlock(Fragment, { key: `start-${part}` }, [part === "literal" ? (openBlock(), createBlock(unref(DateRangeFieldInput_default), { key: 0, type: "start", part, class: "b-date-range-field-literal" }, { default: withCtx(() => [createTextVNode(toDisplayString(value), 1)]), _: 2 }, 1032, ["part"])) : (openBlock(), createBlock(unref(DateRangeFieldInput_default), { key: 1, type: "start", part, class: "b-date-range-field-segment" }, { default: withCtx(() => [createTextVNode(toDisplayString(value), 1)]), _: 2 }, 1032, ["part"]))], 64); }), 128)), _cache[2] || (_cache[2] = createElementVNode("span", { class: "b-date-range-field-separator", "aria-hidden": "true" }, " – ", -1)), (openBlock(true), createElementBlock(Fragment, null, renderList(segments.end, ({ part, value }) => { return openBlock(), createElementBlock(Fragment, { key: `end-${part}` }, [part === "literal" ? (openBlock(), createBlock(unref(DateRangeFieldInput_default), { key: 0, type: "end", part, class: "b-date-range-field-literal" }, { default: withCtx(() => [createTextVNode(toDisplayString(value), 1)]), _: 2 }, 1032, ["part"])) : (openBlock(), createBlock(unref(DateRangeFieldInput_default), { key: 1, type: "end", part, class: "b-date-range-field-segment" }, { default: withCtx(() => [createTextVNode(toDisplayString(value), 1)]), _: 2 }, 1032, ["part"]))], 64); }), 128)) ])]), _: 3 }, 8, [ "id", "modelValue", "placeholder", "default-value", "default-placeholder", "hour-cycle", "step", "granularity", "hide-time-zone", "max-value", "min-value", "locale", "disabled", "readonly", "name", "required", "dir", "is-date-unavailable", "class" ]); }; } }); //#endregion //#region src/components/BDateField/BTimeRangeField.vue var BTimeRangeField_default = /* @__PURE__ */ defineComponent({ __name: "BTimeRangeField", props: /* @__PURE__ */ mergeModels({ defaultPlaceholder: { default: void 0 }, defaultValue: { default: void 0 }, dir: { default: void 0 }, disabled: { type: Boolean, default: false }, granularity: { default: void 0 }, hideTimeZone: { type: Boolean, default: void 0 }, hourCycle: { default: void 0 }, id: { default: void 0 }, isTimeUnavailable: { type: Function, default: void 0 }, locale: { default: void 0 }, maxValue: { default: void 0 }, minValue: { default: void 0 }, name: { default: void 0 }, readonly: { type: Boolean, default: false }, required: { type: Boolean, default: false }, size: { default: void 0 }, state: { type: [Boolean, null], default: null }, step: { default: void 0 }, stepSnapping: { type: Boolean, default: false } }, { "modelValue": { default: null }, "modelModifiers": {}, "placeholder": {}, "placeholderModifiers": {} }), emits: ["update:modelValue", "update:placeholder"], setup(__props) { const props = useDefaults(__props, "BTimeRangeField"); const modelValue = useModel(__props, "modelValue"); const placeholderModel = useModel(__props, "placeholder"); const computedId = useId$1(() => props.id, "time-range-field"); const computedRootClasses = computed(() => ({ "disabled": props.disabled, "readonly": props.readonly, "is-valid": props.state === true, "is-invalid": props.state === false, [`form-control-${props.size}`]: props.size !== void 0 })); return (_ctx, _cache) => { return openBlock(), createBlock(unref(TimeRangeFieldRoot_default), { id: unref(computedId), modelValue: modelValue.value, "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event), placeholder: placeholderModel.value, "onUpdate:placeholder": _cache[1] || (_cache[1] = ($event) => placeholderModel.value = $event), "default-value": unref(props).defaultValue, "default-placeholder": unref(props).defaultPlaceholder, "hour-cycle": unref(props).hourCycle, step: unref(props).step, granularity: unref(props).granularity, "hide-time-zone": unref(props).hideTimeZone, "max-value": unref(props).maxValue, "min-value": unref(props).minValue, locale: unref(props).locale, disabled: unref(props).disabled, readonly: unref(props).readonly, name: unref(props).name, required: unref(props).required, dir: unref(props).dir, "is-time-unavailable": unref(props).isTimeUnavailable, class: normalizeClass([computedRootClasses.value, "b-time-range-field form-control d-inline-flex align-items-center gap-0"]) }, { default: withCtx(({ segments, isInvalid, modelValue: currentValue }) => [renderSlot(_ctx.$slots, "default", { modelValue: currentValue, segments, isInvalid }, () => [ (openBlock(true), createElementBlock(Fragment, null, renderList(segments.start, ({ part, value }) => { return openBlock(), createElementBlock(Fragment, { key: `start-${part}` }, [part === "literal" ? (openBlock(), createBlock(unref(TimeRangeFieldInput_default), { key: 0, type: "start", part, class: "b-time-range-field-literal" }, { default: withCtx(() => [createTextVNode(toDisplayString(value), 1)]), _: 2 }, 1032, ["part"])) : (openBlock(), createBlock(unref(TimeRangeFieldInput_default), { key: 1, type: "start", part, class: "b-time-range-field-segment" }, { default: withCtx(() => [createTextVNode(toDisplayString(value), 1)]), _: 2 }, 1032, ["part"]))], 64); }), 128)), _cache[2] || (_cache[2] = createElementVNode("span", { class: "b-time-range-field-separator", "aria-hidden": "true" }, " – ", -1)), (openBlock(true), createElementBlock(Fragment, null, renderList(segments.end, ({ part, value }) => { return openBlock(), createElementBlock(Fragment, { key: `end-${part}` }, [part === "literal" ? (openBlock(), createBlock(unref(TimeRangeFieldInput_default), { key: 0, type: "end", part, class: "b-time-range-field-literal" }, { default: withCtx(() => [createTextVNode(toDisplayString(value), 1)]), _: 2 }, 1032, ["part"])) : (openBlock(), createBlock(unref(TimeRangeFieldInput_default), { key: 1, type: "end", part, class: "b-time-range-field-segment" }, { default: withCtx(() => [createTextVNode(toDisplayString(value), 1)]), _: 2 }, 1032, ["part"]))], 64); }), 128)) ])]), _: 3 }, 8, [ "id", "modelValue", "placeholder", "default-value", "default-placeholder", "hour-cycle", "step", "granularity", "hide-time-zone", "max-value", "min-value", "locale", "disabled", "readonly", "name", "required", "dir", "is-time-unavailable", "class" ]); }; } }); //#endregion export { BDateRangeField_default as n, BDateField_default as r, BTimeRangeField_default as t }; //# sourceMappingURL=BDateField-CRFFJ4Sj.mjs.map