UNPKG

fui-fancyui

Version:
81 lines (80 loc) 2.14 kB
"use client"; import { jsxs as v, jsx as e } from "react/jsx-runtime"; import { useState as G, useEffect as R } from "react"; import S from "../FancySVGAtom/FancySVGAtom.js"; import V from "../YearInput/YearInput.js"; import w from "../../icons/SVGChevronLeft/SVGChevronLeft.js"; import A from "../../icons/SVGChevronRight/SVGChevronRight.js"; import { StyledYearSelector as B, StyledButton as d, SVGDesignCSS as p } from "./YearSelector.style.js"; import { sizeSettings as y } from "./sizeSettings.js"; function I(h) { const { selectedYear: a = (/* @__PURE__ */ new Date()).getFullYear(), sizeC: t = "md", themeType: f = "primary", themeTypeSecondary: o = "secondary", layer: Y = 3, secondaryLayer: s = 0, borderRadius: x, minYear: C, maxYear: T, yearChangeHandler: r, ariaTextLeftArrow: $, ariaTextRightArrow: z, ...b } = h, [m, i] = G(a), c = (l) => { const n = m + l; i(n), r == null || r(n); }, g = (l) => { const u = l.target.value; i(Number(u)), r == null || r(Number(u)); }; return R(() => { i(a); }, [a]), /* @__PURE__ */ v( B, { $sizeC: t, $borderRadius: x, $layer: Y, $themeType: f, ...b, children: [ /* @__PURE__ */ e( d, { "aria-label": $, onClick: () => c(-1), $themeType: o, $layer: s, children: /* @__PURE__ */ e(S, { isPassive: !0, sizeC: y[t].iconSize, externalStyle: p, children: /* @__PURE__ */ e(w, {}) }) } ), /* @__PURE__ */ e( V, { sizeC: t, year: m, themeType: o, onBlur: g, min: C, max: T } ), /* @__PURE__ */ e( d, { "aria-label": z, onClick: () => c(1), $themeType: o, $layer: s, children: /* @__PURE__ */ e(S, { isPassive: !0, sizeC: y[t].iconSize, externalStyle: p, children: /* @__PURE__ */ e(A, {}) }) } ) ] } ); } export { I as default };