UNPKG

bootstrap-vue-next

Version:

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

1 lines 30 kB
{"version":3,"file":"BTimeField-DSWZeGYP.mjs","names":["today","getLocalTimeZone","toCalendarDateTime","Time","isEqualDay"],"sources":["../../../node_modules/.pnpm/reka-ui@2.9.2_vue@3.5.31_typescript@5.9.3_/node_modules/reka-ui/dist/TimeField/TimeFieldRoot.js","../../../node_modules/.pnpm/reka-ui@2.9.2_vue@3.5.31_typescript@5.9.3_/node_modules/reka-ui/dist/TimeField/TimeFieldInput.js","../src/components/BTimeField/BTimeField.vue","../src/components/BTimeField/BTimeField.vue"],"sourcesContent":["import { createContext } from \"../shared/createContext.js\";\nimport { isNullish } from \"../shared/nullish.js\";\nimport { getDefaultTime, isBefore } from \"../date/comparators.js\";\nimport { normalizeDateStep, normalizeHourCycle } from \"../date/utils.js\";\nimport { useDateFormatter } from \"../shared/useDateFormatter.js\";\nimport { useDirection } from \"../shared/useDirection.js\";\nimport { useKbd } from \"../shared/useKbd.js\";\nimport { useLocale } from \"../shared/useLocale.js\";\nimport { Primitive } from \"../Primitive/Primitive.js\";\nimport { usePrimitiveElement } from \"../Primitive/usePrimitiveElement.js\";\nimport { VisuallyHidden_default } from \"../VisuallyHidden/VisuallyHidden.js\";\nimport { createContent, initializeTimeSegmentValues, syncTimeSegmentValues } from \"../date/parser.js\";\nimport { getTimeFieldSegmentElements, isSegmentNavigationKey } from \"../date/segment.js\";\nimport { computed, createBlock, createVNode, defineComponent, mergeProps, nextTick, onMounted, openBlock, ref, renderSlot, toRefs, unref, watch, withCtx, withKeys } from \"vue\";\nimport { useVModel } from \"@vueuse/core\";\nimport { Time, getLocalTimeZone, isEqualDay, toCalendarDateTime, today } from \"@internationalized/date\";\n\n//#region src/TimeField/TimeFieldRoot.vue?vue&type=script&setup=true&lang.ts\nconst [injectTimeFieldRootContext, provideTimeFieldRootContext] = createContext(\"TimeFieldRoot\");\nfunction convertValue(value, date = today(getLocalTimeZone())) {\n\tif (value && \"day\" in value) return value;\n\treturn toCalendarDateTime(date, value);\n}\nvar TimeFieldRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({\n\tinheritAttrs: false,\n\t__name: \"TimeFieldRoot\",\n\tprops: {\n\t\tdefaultValue: {\n\t\t\ttype: Object,\n\t\t\trequired: false,\n\t\t\tdefault: void 0\n\t\t},\n\t\tdefaultPlaceholder: {\n\t\t\ttype: Object,\n\t\t\trequired: false\n\t\t},\n\t\tplaceholder: {\n\t\t\ttype: Object,\n\t\t\trequired: false,\n\t\t\tdefault: void 0\n\t\t},\n\t\tmodelValue: {\n\t\t\ttype: [Object, null],\n\t\t\trequired: false\n\t\t},\n\t\thourCycle: {\n\t\t\ttype: null,\n\t\t\trequired: false\n\t\t},\n\t\tstep: {\n\t\t\ttype: Object,\n\t\t\trequired: false\n\t\t},\n\t\tstepSnapping: {\n\t\t\ttype: Boolean,\n\t\t\trequired: false,\n\t\t\tdefault: false\n\t\t},\n\t\tgranularity: {\n\t\t\ttype: String,\n\t\t\trequired: false\n\t\t},\n\t\thideTimeZone: {\n\t\t\ttype: Boolean,\n\t\t\trequired: false\n\t\t},\n\t\tmaxValue: {\n\t\t\ttype: Object,\n\t\t\trequired: false\n\t\t},\n\t\tminValue: {\n\t\t\ttype: Object,\n\t\t\trequired: false\n\t\t},\n\t\tlocale: {\n\t\t\ttype: String,\n\t\t\trequired: false\n\t\t},\n\t\tdisabled: {\n\t\t\ttype: Boolean,\n\t\t\trequired: false,\n\t\t\tdefault: false\n\t\t},\n\t\treadonly: {\n\t\t\ttype: Boolean,\n\t\t\trequired: false,\n\t\t\tdefault: false\n\t\t},\n\t\tid: {\n\t\t\ttype: String,\n\t\t\trequired: false\n\t\t},\n\t\tdir: {\n\t\t\ttype: String,\n\t\t\trequired: false\n\t\t},\n\t\tasChild: {\n\t\t\ttype: Boolean,\n\t\t\trequired: false\n\t\t},\n\t\tas: {\n\t\t\ttype: null,\n\t\t\trequired: false\n\t\t},\n\t\tname: {\n\t\t\ttype: String,\n\t\t\trequired: false\n\t\t},\n\t\trequired: {\n\t\t\ttype: Boolean,\n\t\t\trequired: false\n\t\t}\n\t},\n\temits: [\"update:modelValue\", \"update:placeholder\"],\n\tsetup(__props, { expose: __expose, emit: __emit }) {\n\t\tconst props = __props;\n\t\tconst emits = __emit;\n\t\tconst { disabled, readonly, granularity, defaultValue, minValue, maxValue, stepSnapping, dir: propDir, locale: propLocale } = toRefs(props);\n\t\tconst locale = useLocale(propLocale);\n\t\tconst dir = useDirection(propDir);\n\t\tconst formatter = useDateFormatter(locale.value, { hourCycle: normalizeHourCycle(props.hourCycle) });\n\t\tconst { primitiveElement, currentElement: parentElement } = usePrimitiveElement();\n\t\tconst segmentElements = ref(/* @__PURE__ */ new Set());\n\t\tconst step = computed(() => normalizeDateStep(props));\n\t\tconst convertedMinValue = computed(() => minValue.value ? convertValue(minValue.value) : void 0);\n\t\tconst convertedMaxValue = computed(() => maxValue.value ? convertValue(maxValue.value) : void 0);\n\t\tonMounted(() => {\n\t\t\tgetTimeFieldSegmentElements(parentElement.value).forEach((item) => segmentElements.value.add(item));\n\t\t});\n\t\tconst modelValue = useVModel(props, \"modelValue\", emits, {\n\t\t\tdefaultValue: defaultValue.value,\n\t\t\tpassive: props.modelValue === void 0\n\t\t});\n\t\tconst convertedModelValue = computed({\n\t\t\tget() {\n\t\t\t\tif (isNullish(modelValue.value)) return modelValue.value;\n\t\t\t\treturn convertValue(modelValue.value);\n\t\t\t},\n\t\t\tset(newValue) {\n\t\t\t\tif (newValue) modelValue.value = modelValue.value && \"day\" in modelValue.value ? newValue : new Time(newValue.hour, newValue.minute, newValue.second, modelValue.value?.millisecond);\n\t\t\t\telse modelValue.value = newValue;\n\t\t\t\treturn newValue;\n\t\t\t}\n\t\t});\n\t\tconst defaultDate = getDefaultTime({\n\t\t\tdefaultPlaceholder: props.placeholder,\n\t\t\tdefaultValue: modelValue.value\n\t\t});\n\t\tconst placeholder = useVModel(props, \"placeholder\", emits, {\n\t\t\tdefaultValue: props.defaultPlaceholder ?? defaultDate.copy(),\n\t\t\tpassive: props.placeholder === void 0\n\t\t});\n\t\tconst convertedPlaceholder = computed({\n\t\t\tget() {\n\t\t\t\treturn convertValue(placeholder.value);\n\t\t\t},\n\t\t\tset(newValue) {\n\t\t\t\tif (newValue) placeholder.value = \"day\" in placeholder.value ? newValue.copy() : new Time(newValue.hour, newValue.minute, newValue.second, placeholder.value?.millisecond);\n\t\t\t\treturn newValue;\n\t\t\t}\n\t\t});\n\t\tconst inferredGranularity = computed(() => {\n\t\t\tif (granularity.value) return granularity.value;\n\t\t\treturn \"minute\";\n\t\t});\n\t\tconst isInvalid = computed(() => {\n\t\t\tif (!modelValue.value) return false;\n\t\t\tif (convertedMinValue.value && isBefore(convertedModelValue.value, convertedMinValue.value)) return true;\n\t\t\tif (convertedMaxValue.value && isBefore(convertedMaxValue.value, convertedModelValue.value)) return true;\n\t\t\treturn false;\n\t\t});\n\t\tconst initialSegments = initializeTimeSegmentValues(inferredGranularity.value);\n\t\tconst segmentValues = ref(modelValue.value ? { ...syncTimeSegmentValues({\n\t\t\tvalue: convertedModelValue.value,\n\t\t\tformatter\n\t\t}) } : { ...initialSegments });\n\t\tconst allSegmentContent = computed(() => createContent({\n\t\t\tgranularity: inferredGranularity.value,\n\t\t\tdateRef: convertedPlaceholder.value,\n\t\t\tformatter,\n\t\t\thideTimeZone: props.hideTimeZone,\n\t\t\thourCycle: props.hourCycle,\n\t\t\tsegmentValues: segmentValues.value,\n\t\t\tlocale,\n\t\t\tisTimeValue: true\n\t\t}));\n\t\tconst segmentContents = computed(() => {\n\t\t\tconst contents = allSegmentContent.value.arr;\n\t\t\tif (props.hourCycle === 12) return contents.map((segment) => {\n\t\t\t\tif (segment.part === \"hour\" && \"hour\" in segmentValues.value) {\n\t\t\t\t\tconst hour = segmentValues.value.hour;\n\t\t\t\t\tif (hour !== null) {\n\t\t\t\t\t\tconst displayHour = hour === 0 ? 12 : hour > 12 ? hour - 12 : hour;\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...segment,\n\t\t\t\t\t\t\tvalue: displayHour.toString()\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn segment;\n\t\t\t});\n\t\t\treturn contents;\n\t\t});\n\t\tconst editableSegmentContents = computed(() => segmentContents.value.filter(({ part }) => part !== \"literal\"));\n\t\twatch(locale, (value) => {\n\t\t\tif (formatter.getLocale() !== value) {\n\t\t\t\tformatter.setLocale(value);\n\t\t\t\tnextTick(() => {\n\t\t\t\t\tsegmentElements.value.clear();\n\t\t\t\t\tgetTimeFieldSegmentElements(parentElement.value).forEach((item) => segmentElements.value.add(item));\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t\twatch(convertedModelValue, (_modelValue) => {\n\t\t\tif (!isNullish(_modelValue) && (!isEqualDay(convertedPlaceholder.value, _modelValue) || convertedPlaceholder.value.compare(_modelValue) !== 0)) placeholder.value = _modelValue.copy();\n\t\t});\n\t\twatch([convertedModelValue, locale], ([_modelValue]) => {\n\t\t\tif (!isNullish(_modelValue)) segmentValues.value = { ...syncTimeSegmentValues({\n\t\t\t\tvalue: _modelValue,\n\t\t\t\tformatter\n\t\t\t}) };\n\t\t\telse if (Object.values(segmentValues.value).every((value) => value !== null) && isNullish(_modelValue)) segmentValues.value = { ...initialSegments };\n\t\t});\n\t\tconst currentFocusedElement = ref(null);\n\t\tconst currentSegmentIndex = computed(() => Array.from(segmentElements.value).findIndex((el) => el.getAttribute(\"data-reka-time-field-segment\") === currentFocusedElement.value?.getAttribute(\"data-reka-time-field-segment\")));\n\t\tconst nextFocusableSegment = computed(() => {\n\t\t\tconst sign = dir.value === \"rtl\" ? -1 : 1;\n\t\t\tconst nextCondition = sign < 0 ? currentSegmentIndex.value < 0 : currentSegmentIndex.value > segmentElements.value.size - 1;\n\t\t\tif (nextCondition) return null;\n\t\t\tconst segmentToFocus = Array.from(segmentElements.value)[currentSegmentIndex.value + sign];\n\t\t\treturn segmentToFocus;\n\t\t});\n\t\tconst prevFocusableSegment = computed(() => {\n\t\t\tconst sign = dir.value === \"rtl\" ? -1 : 1;\n\t\t\tconst prevCondition = sign > 0 ? currentSegmentIndex.value < 0 : currentSegmentIndex.value > segmentElements.value.size - 1;\n\t\t\tif (prevCondition) return null;\n\t\t\tconst segmentToFocus = Array.from(segmentElements.value)[currentSegmentIndex.value - sign];\n\t\t\treturn segmentToFocus;\n\t\t});\n\t\tconst kbd = useKbd();\n\t\tfunction handleKeydown(e) {\n\t\t\tif (!isSegmentNavigationKey(e.key)) return;\n\t\t\tif (e.key === kbd.ARROW_LEFT) prevFocusableSegment.value?.focus();\n\t\t\tif (e.key === kbd.ARROW_RIGHT) nextFocusableSegment.value?.focus();\n\t\t}\n\t\tfunction setFocusedElement(el) {\n\t\t\tcurrentFocusedElement.value = el;\n\t\t}\n\t\tprovideTimeFieldRootContext({\n\t\t\tlocale,\n\t\t\tmodelValue: convertedModelValue,\n\t\t\tplaceholder: convertedPlaceholder,\n\t\t\tdisabled,\n\t\t\tformatter,\n\t\t\thourCycle: props.hourCycle,\n\t\t\tstep,\n\t\t\tstepSnapping,\n\t\t\treadonly,\n\t\t\tsegmentValues,\n\t\t\tisInvalid,\n\t\t\tsegmentContents: editableSegmentContents,\n\t\t\telements: segmentElements,\n\t\t\tsetFocusedElement,\n\t\t\tfocusNext() {\n\t\t\t\tnextFocusableSegment.value?.focus();\n\t\t\t}\n\t\t});\n\t\t__expose({ setFocusedElement });\n\t\treturn (_ctx, _cache) => {\n\t\t\treturn openBlock(), createBlock(unref(Primitive), mergeProps(_ctx.$attrs, {\n\t\t\t\tref_key: \"primitiveElement\",\n\t\t\t\tref: primitiveElement,\n\t\t\t\trole: \"group\",\n\t\t\t\t\"aria-disabled\": unref(disabled) ? true : void 0,\n\t\t\t\t\"data-disabled\": unref(disabled) ? \"\" : void 0,\n\t\t\t\t\"data-readonly\": unref(readonly) ? \"\" : void 0,\n\t\t\t\t\"data-invalid\": isInvalid.value ? \"\" : void 0,\n\t\t\t\tdir: unref(dir),\n\t\t\t\tonKeydown: withKeys(handleKeydown, [\"left\", \"right\"])\n\t\t\t}), {\n\t\t\t\tdefault: withCtx(() => [renderSlot(_ctx.$slots, \"default\", {\n\t\t\t\t\tmodelValue: unref(modelValue),\n\t\t\t\t\tsegments: segmentContents.value,\n\t\t\t\t\tisInvalid: isInvalid.value\n\t\t\t\t}), createVNode(unref(VisuallyHidden_default), {\n\t\t\t\t\tid: _ctx.id,\n\t\t\t\t\tas: \"input\",\n\t\t\t\t\tfeature: \"focusable\",\n\t\t\t\t\ttabindex: \"-1\",\n\t\t\t\t\tvalue: unref(modelValue) ? unref(modelValue).toString() : \"\",\n\t\t\t\t\tname: _ctx.name,\n\t\t\t\t\tdisabled: unref(disabled),\n\t\t\t\t\trequired: _ctx.required,\n\t\t\t\t\tonFocus: _cache[0] || (_cache[0] = ($event) => Array.from(segmentElements.value)?.[0]?.focus())\n\t\t\t\t}, null, 8, [\n\t\t\t\t\t\"id\",\n\t\t\t\t\t\"value\",\n\t\t\t\t\t\"name\",\n\t\t\t\t\t\"disabled\",\n\t\t\t\t\t\"required\"\n\t\t\t\t])]),\n\t\t\t\t_: 3\n\t\t\t}, 16, [\n\t\t\t\t\"aria-disabled\",\n\t\t\t\t\"data-disabled\",\n\t\t\t\t\"data-readonly\",\n\t\t\t\t\"data-invalid\",\n\t\t\t\t\"dir\"\n\t\t\t]);\n\t\t};\n\t}\n});\n\n//#endregion\n//#region src/TimeField/TimeFieldRoot.vue\nvar TimeFieldRoot_default = TimeFieldRoot_vue_vue_type_script_setup_true_lang_default;\n\n//#endregion\nexport { TimeFieldRoot_default, injectTimeFieldRootContext };\n//# sourceMappingURL=TimeFieldRoot.js.map","import { Primitive } from \"../Primitive/Primitive.js\";\nimport { useDateField } from \"../date/useDateField.js\";\nimport { injectTimeFieldRootContext } from \"./TimeFieldRoot.js\";\nimport { computed, createBlock, defineComponent, mergeProps, openBlock, ref, renderSlot, toHandlers, unref, withCtx } from \"vue\";\n\n//#region src/TimeField/TimeFieldInput.vue?vue&type=script&setup=true&lang.ts\nvar TimeFieldInput_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({\n\t__name: \"TimeFieldInput\",\n\tprops: {\n\t\tpart: {\n\t\t\ttype: null,\n\t\t\trequired: true\n\t\t},\n\t\tasChild: {\n\t\t\ttype: Boolean,\n\t\t\trequired: false\n\t\t},\n\t\tas: {\n\t\t\ttype: null,\n\t\t\trequired: false\n\t\t}\n\t},\n\tsetup(__props) {\n\t\tconst props = __props;\n\t\tconst rootContext = injectTimeFieldRootContext();\n\t\tconst hasLeftFocus = ref(true);\n\t\tconst lastKeyZero = ref(false);\n\t\tconst { handleSegmentClick, handleSegmentKeydown, handleSegmentFocusOut, attributes } = useDateField({\n\t\t\thasLeftFocus,\n\t\t\tlastKeyZero,\n\t\t\tplaceholder: rootContext.placeholder,\n\t\t\thourCycle: rootContext.hourCycle,\n\t\t\tstep: rootContext.step,\n\t\t\tstepSnapping: rootContext.stepSnapping,\n\t\t\tsegmentValues: rootContext.segmentValues,\n\t\t\tformatter: rootContext.formatter,\n\t\t\tpart: props.part,\n\t\t\tdisabled: rootContext.disabled,\n\t\t\treadonly: rootContext.readonly,\n\t\t\tfocusNext: rootContext.focusNext,\n\t\t\tmodelValue: rootContext.modelValue\n\t\t});\n\t\tconst disabled = computed(() => rootContext.disabled.value);\n\t\tconst readonly = computed(() => rootContext.readonly.value);\n\t\tconst isInvalid = computed(() => rootContext.isInvalid.value);\n\t\treturn (_ctx, _cache) => {\n\t\t\treturn openBlock(), createBlock(unref(Primitive), mergeProps({\n\t\t\t\tas: _ctx.as,\n\t\t\t\t\"as-child\": _ctx.asChild\n\t\t\t}, unref(attributes), {\n\t\t\t\tcontenteditable: disabled.value || readonly.value ? false : _ctx.part !== \"literal\",\n\t\t\t\t\"data-reka-time-field-segment\": _ctx.part,\n\t\t\t\t\"aria-disabled\": disabled.value ? true : void 0,\n\t\t\t\t\"aria-readonly\": readonly.value ? true : void 0,\n\t\t\t\t\"data-disabled\": disabled.value ? \"\" : void 0,\n\t\t\t\t\"data-invalid\": isInvalid.value ? \"\" : void 0,\n\t\t\t\t\"aria-invalid\": isInvalid.value ? true : void 0\n\t\t\t}, toHandlers(_ctx.part !== \"literal\" ? {\n\t\t\t\tmousedown: unref(handleSegmentClick),\n\t\t\t\tkeydown: unref(handleSegmentKeydown),\n\t\t\t\tfocusout: () => {\n\t\t\t\t\thasLeftFocus.value = true;\n\t\t\t\t\tunref(handleSegmentFocusOut)();\n\t\t\t\t},\n\t\t\t\tfocusin: (e) => {\n\t\t\t\t\tunref(rootContext).setFocusedElement(e.target);\n\t\t\t\t}\n\t\t\t} : {})), {\n\t\t\t\tdefault: withCtx(() => [renderSlot(_ctx.$slots, \"default\")]),\n\t\t\t\t_: 3\n\t\t\t}, 16, [\n\t\t\t\t\"as\",\n\t\t\t\t\"as-child\",\n\t\t\t\t\"contenteditable\",\n\t\t\t\t\"data-reka-time-field-segment\",\n\t\t\t\t\"aria-disabled\",\n\t\t\t\t\"aria-readonly\",\n\t\t\t\t\"data-disabled\",\n\t\t\t\t\"data-invalid\",\n\t\t\t\t\"aria-invalid\"\n\t\t\t]);\n\t\t};\n\t}\n});\n\n//#endregion\n//#region src/TimeField/TimeFieldInput.vue\nvar TimeFieldInput_default = TimeFieldInput_vue_vue_type_script_setup_true_lang_default;\n\n//#endregion\nexport { TimeFieldInput_default };\n//# sourceMappingURL=TimeFieldInput.js.map","<template>\n <TimeFieldRoot\n :id=\"computedId\"\n v-slot=\"{segments, isInvalid, modelValue: currentValue}\"\n v-model=\"modelValue\"\n v-model:placeholder=\"placeholderModel\"\n :default-value=\"props.defaultValue\"\n :default-placeholder=\"props.defaultPlaceholder\"\n :hour-cycle=\"props.hourCycle\"\n :step=\"props.step\"\n :step-snapping=\"props.stepSnapping\"\n :granularity=\"props.granularity\"\n :hide-time-zone=\"props.hideTimeZone\"\n :max-value=\"props.maxValue\"\n :min-value=\"props.minValue\"\n :locale=\"props.locale\"\n :disabled=\"props.disabled\"\n :readonly=\"props.readonly\"\n :name=\"props.name\"\n :required=\"props.required\"\n :dir=\"props.dir\"\n :class=\"computedRootClasses\"\n class=\"b-time-field form-control d-inline-flex align-items-center gap-0\"\n >\n <slot :model-value=\"currentValue\" :segments=\"segments\" :is-invalid=\"isInvalid\">\n <template v-for=\"{part, value} in segments\" :key=\"part\">\n <TimeFieldInput v-if=\"part === 'literal'\" :part=\"part\" class=\"b-time-field-literal\">\n {{ value }}\n </TimeFieldInput>\n <TimeFieldInput v-else :part=\"part\" class=\"b-time-field-segment\">\n {{ value }}\n </TimeFieldInput>\n </template>\n </slot>\n </TimeFieldRoot>\n</template>\n\n<script setup lang=\"ts\">\nimport {computed} from 'vue'\nimport {TimeFieldInput, TimeFieldRoot} from 'reka-ui'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {useId} from '../../composables/useId'\nimport type {BTimeFieldSlots} from '../../types'\nimport type {BTimeFieldProps} from '../../types/ComponentProps'\n\nconst _props = withDefaults(defineProps<Omit<BTimeFieldProps, 'modelValue' | 'placeholder'>>(), {\n defaultPlaceholder: undefined,\n defaultValue: undefined,\n dir: undefined,\n disabled: false,\n granularity: undefined,\n hideTimeZone: undefined,\n hourCycle: undefined,\n id: undefined,\n locale: undefined,\n maxValue: undefined,\n minValue: undefined,\n name: undefined,\n readonly: false,\n required: false,\n size: undefined,\n state: null,\n step: undefined,\n stepSnapping: false,\n})\nconst props = useDefaults(_props, 'BTimeField')\ndefineSlots<BTimeFieldSlots>()\n\nconst modelValue = defineModel<Exclude<BTimeFieldProps['modelValue'], undefined>>({\n default: null,\n})\n\nconst placeholderModel = defineModel<BTimeFieldProps['placeholder']>('placeholder')\n\nconst computedId = useId(() => props.id, 'time-field')\n\nconst computedRootClasses = computed(() => ({\n 'disabled': props.disabled,\n 'readonly': props.readonly,\n 'is-valid': props.state === true,\n 'is-invalid': props.state === false,\n [`form-control-${props.size}`]: props.size !== undefined,\n}))\n</script>\n","<template>\n <TimeFieldRoot\n :id=\"computedId\"\n v-slot=\"{segments, isInvalid, modelValue: currentValue}\"\n v-model=\"modelValue\"\n v-model:placeholder=\"placeholderModel\"\n :default-value=\"props.defaultValue\"\n :default-placeholder=\"props.defaultPlaceholder\"\n :hour-cycle=\"props.hourCycle\"\n :step=\"props.step\"\n :step-snapping=\"props.stepSnapping\"\n :granularity=\"props.granularity\"\n :hide-time-zone=\"props.hideTimeZone\"\n :max-value=\"props.maxValue\"\n :min-value=\"props.minValue\"\n :locale=\"props.locale\"\n :disabled=\"props.disabled\"\n :readonly=\"props.readonly\"\n :name=\"props.name\"\n :required=\"props.required\"\n :dir=\"props.dir\"\n :class=\"computedRootClasses\"\n class=\"b-time-field form-control d-inline-flex align-items-center gap-0\"\n >\n <slot :model-value=\"currentValue\" :segments=\"segments\" :is-invalid=\"isInvalid\">\n <template v-for=\"{part, value} in segments\" :key=\"part\">\n <TimeFieldInput v-if=\"part === 'literal'\" :part=\"part\" class=\"b-time-field-literal\">\n {{ value }}\n </TimeFieldInput>\n <TimeFieldInput v-else :part=\"part\" class=\"b-time-field-segment\">\n {{ value }}\n </TimeFieldInput>\n </template>\n </slot>\n </TimeFieldRoot>\n</template>\n\n<script setup lang=\"ts\">\nimport {computed} from 'vue'\nimport {TimeFieldInput, TimeFieldRoot} from 'reka-ui'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {useId} from '../../composables/useId'\nimport type {BTimeFieldSlots} from '../../types'\nimport type {BTimeFieldProps} from '../../types/ComponentProps'\n\nconst _props = withDefaults(defineProps<Omit<BTimeFieldProps, 'modelValue' | 'placeholder'>>(), {\n defaultPlaceholder: undefined,\n defaultValue: undefined,\n dir: undefined,\n disabled: false,\n granularity: undefined,\n hideTimeZone: undefined,\n hourCycle: undefined,\n id: undefined,\n locale: undefined,\n maxValue: undefined,\n minValue: undefined,\n name: undefined,\n readonly: false,\n required: false,\n size: undefined,\n state: null,\n step: undefined,\n stepSnapping: false,\n})\nconst props = useDefaults(_props, 'BTimeField')\ndefineSlots<BTimeFieldSlots>()\n\nconst modelValue = defineModel<Exclude<BTimeFieldProps['modelValue'], undefined>>({\n default: null,\n})\n\nconst placeholderModel = defineModel<BTimeFieldProps['placeholder']>('placeholder')\n\nconst computedId = useId(() => props.id, 'time-field')\n\nconst computedRootClasses = computed(() => ({\n 'disabled': props.disabled,\n 'readonly': props.readonly,\n 'is-valid': props.state === true,\n 'is-invalid': props.state === false,\n [`form-control-${props.size}`]: props.size !== undefined,\n}))\n</script>\n"],"x_google_ignoreList":[0,1],"mappings":";;;;;;;;AAkBA,IAAM,CAAC,4BAA4B,+BAA+B,cAAc,gBAAgB;AAChG,SAAS,aAAa,OAAO,OAAOA,0CAAMC,2CAAkB,CAAC,EAAE;AAC9D,KAAI,SAAS,SAAS,MAAO,QAAO;AACpC,QAAOC,0CAAmB,MAAM,MAAM;;AAsSvC,IAAI,wBApS4E,gCAAgB;CAC/F,cAAc;CACd,QAAQ;CACR,OAAO;EACN,cAAc;GACb,MAAM;GACN,UAAU;GACV,SAAS,KAAK;GACd;EACD,oBAAoB;GACnB,MAAM;GACN,UAAU;GACV;EACD,aAAa;GACZ,MAAM;GACN,UAAU;GACV,SAAS,KAAK;GACd;EACD,YAAY;GACX,MAAM,CAAC,QAAQ,KAAK;GACpB,UAAU;GACV;EACD,WAAW;GACV,MAAM;GACN,UAAU;GACV;EACD,MAAM;GACL,MAAM;GACN,UAAU;GACV;EACD,cAAc;GACb,MAAM;GACN,UAAU;GACV,SAAS;GACT;EACD,aAAa;GACZ,MAAM;GACN,UAAU;GACV;EACD,cAAc;GACb,MAAM;GACN,UAAU;GACV;EACD,UAAU;GACT,MAAM;GACN,UAAU;GACV;EACD,UAAU;GACT,MAAM;GACN,UAAU;GACV;EACD,QAAQ;GACP,MAAM;GACN,UAAU;GACV;EACD,UAAU;GACT,MAAM;GACN,UAAU;GACV,SAAS;GACT;EACD,UAAU;GACT,M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