UNPKG

@frontify/fondue

Version:
69 lines (68 loc) 2.08 kB
import { jsxs as S, jsx as t } from "react/jsx-runtime"; import { forwardRef as z } from "react"; import E from "../../foundation/Icon/Generated/IconCalendar.es.js"; import F from "../../foundation/Icon/Generated/IconCaretDown.es.js"; import I from "../../foundation/Icon/Generated/IconCaretUp.es.js"; import { IconSize as c } from "../../foundation/Icon/IconSize.es.js"; import { merge as l } from "../../utilities/merge.es.js"; import { Validation as o } from "../../utilities/validation.es.js"; import { TextInput as O } from "../TextInput/TextInput.es.js"; const R = z( ({ value: e, onClick: i, isClearable: s, placeHolder: m, isCalendarOpen: f, validation: r = o.Default, onDateChanged: a }, d) => { const w = r === o.Error || r === o.Warning, g = "tw-right-14", p = "tw-right-8", h = "tw-right-4", n = ((u) => { switch (u) { case 0: return h; case 1: return p; case 2: return g; } return ""; })( (e && s ? 1 : 0) + (w ? 1 : 0) ); return /* @__PURE__ */ S("div", { ref: d, children: [ /* @__PURE__ */ t( "div", { className: l([ "tw-absolute tw-top-2 tw-text-black-60 tw-z-[1]", n ]), children: f ? /* @__PURE__ */ t(I, { size: c.Size20 }) : /* @__PURE__ */ t(F, { size: c.Size20 }) } ), /* @__PURE__ */ t( "div", { className: l([ "tw-absolute tw-top-0 tw-left-0 tw-bottom-0 tw-z-10", n ]), onClick: i, "data-test-id": "open-close-click-zone" } ), /* @__PURE__ */ t( O, { decorator: /* @__PURE__ */ t(E, {}), placeholder: m, value: e, clearable: s, onEnterPressed: i, onClear: () => { a && a(null); }, validation: r } ) ] }); } ); R.displayName = "FondueDatePickerTrigger"; export { R as DatePickerTrigger }; //# sourceMappingURL=DatePickerTrigger.es.js.map