UNPKG

@payfit/unity-components

Version:

40 lines (39 loc) 1.27 kB
import { DateRangePicker as e } from "./DateRangePicker.js"; import { useFieldContext as t } from "../../hooks/tanstack-form-context.js"; import { useFieldA11yContext as n } from "../form-field/TanstackFormField.context.js"; import { forwardRef as r } from "react"; import { jsx as i } from "react/jsx-runtime"; //#region src/components/date-range-picker/TanstackDateRangePicker.tsx var a = r(({ onClearButtonPress: r, onBlur: a, onFocus: o, onChange: s, onOpenChange: c, isReadOnly: l, isDisabled: u, ...d }, f) => { let p = t(), m = n(), h = p.state.meta.isTouched && !p.state.meta.isValid, g = [m.helperTextId, m.feedbackTextId].filter(Boolean).join(" "); return /* @__PURE__ */ i(e, { ...d, ref: f, id: m.inputId, value: p.state.value, onChange: (e) => { p.handleChange(e), s?.(e); }, onBlur: () => { p.handleBlur(), a?.(); }, onFocus: () => { o?.(); }, onOpenChange: (e) => { c?.(e); }, onClearButtonPress: () => { p.setValue(null), r?.(); }, isReadOnly: l, isDisabled: u, isInvalid: h, "aria-labelledby": m.labelId, "aria-describedby": g.length > 0 ? g : void 0, "aria-details": m.contextualLinkId }); }); a.displayName = "TanstackDateRangePicker"; //#endregion export { a as TanstackDateRangePicker };