chesai-ui 0.16.11 → 0.16.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { jsxs as y, jsx as i } from "react/jsx-runtime";
1
+ import { jsxs as y, jsx as s } from "react/jsx-runtime";
2
2
  import { useVirtualizer as N } from "@tanstack/react-virtual";
3
3
  import { clsx as x } from "clsx";
4
4
  import { startOfMonth as D, isBefore as M, addMonths as I, endOfMonth as T, eachDayOfInterval as k, getDay as S, format as b, isSameDay as u, isAfter as z, isToday as j } from "date-fns";
@@ -17,7 +17,7 @@ const v = C(
17
17
  return k({ start: n, end: o });
18
18
  }, [r]), h = g(() => S(d[0]), [d]);
19
19
  return /* @__PURE__ */ y("div", { className: "mb-4 px-4", children: [
20
- /* @__PURE__ */ i(
20
+ /* @__PURE__ */ s(
21
21
  A,
22
22
  {
23
23
  variant: "label-large",
@@ -26,27 +26,27 @@ const v = C(
26
26
  }
27
27
  ),
28
28
  /* @__PURE__ */ y("div", { className: "grid grid-cols-7 gap-y-2", children: [
29
- Array.from({ length: h }).map((n, o) => /* @__PURE__ */ i("div", {}, `empty-${o}`)),
29
+ Array.from({ length: h }).map((n, o) => /* @__PURE__ */ s("div", {}, `empty-${o}`)),
30
30
  d.map((n) => {
31
31
  const o = n.toISOString();
32
- let l = !1, s = !1, f = !1, p = !1;
32
+ let l = !1, i = !1, f = !1, p = !1;
33
33
  if (c === "single" && a instanceof Date)
34
34
  l = u(n, a);
35
35
  else if (c === "range") {
36
36
  const e = a;
37
- e?.from && (s = u(n, e.from)), e?.to && (f = u(n, e.to)), e?.from && e?.to && (p = z(n, e.from) && M(n, e.to));
37
+ e?.from && (i = u(n, e.from)), e?.to && (f = u(n, e.to)), e?.from && e?.to && (p = z(n, e.from) && M(n, e.to));
38
38
  }
39
39
  const t = j(n);
40
- return /* @__PURE__ */ i(
40
+ return /* @__PURE__ */ s(
41
41
  "div",
42
42
  {
43
43
  className: x(
44
44
  "relative flex aspect-square items-center justify-center p-0",
45
45
  p && "bg-secondary-container/30",
46
- s && "bg-gradient-to-r from-transparent to-secondary-container/30",
47
- f && "bg-gradient-to-l from-transparent to-secondary-container/30"
46
+ i && "bg-gradient-to-r rtl:bg-gradient-to-l from-transparent to-secondary-container/30",
47
+ f && "bg-gradient-to-l rtl:bg-gradient-to-r from-transparent to-secondary-container/30"
48
48
  ),
49
- children: /* @__PURE__ */ i(
49
+ children: /* @__PURE__ */ s(
50
50
  "button",
51
51
  {
52
52
  type: "button",
@@ -54,11 +54,11 @@ const v = C(
54
54
  className: x(
55
55
  "relative z-10 flex h-9 w-9 items-center justify-center rounded-full text-sm font-medium transition-colors",
56
56
  // Selected State
57
- l || s || f ? "bg-primary text-on-primary shadow-sm" : "text-on-surface",
57
+ l || i || f ? "bg-primary text-on-primary shadow-sm" : "text-on-surface",
58
58
  // Today State
59
- !l && !s && !f && t && "border border-primary text-primary font-bold",
60
- // Hover State (only if not selected)
61
- !l && !s && !f && "hover:bg-surface-container-highest"
59
+ !l && !i && !f && t && "border border-primary text-primary font-bold",
60
+ // Hover State
61
+ !l && !i && !f && "hover:bg-surface-container-highest"
62
62
  ),
63
63
  children: b(n, "d")
64
64
  }
@@ -70,7 +70,6 @@ const v = C(
70
70
  ] })
71
71
  ] });
72
72
  },
73
- // Custom comparison function for React.memo to strictly prevent re-renders
74
73
  (r, a) => r.monthDate.getTime() === a.monthDate.getTime() && r.value === a.value && r.mode === a.mode
75
74
  );
76
75
  v.displayName = "MonthGrid";
@@ -94,17 +93,15 @@ const W = ({
94
93
  return o.findIndex(
95
94
  (e) => e.getFullYear() === (t || /* @__PURE__ */ new Date()).getFullYear() && e.getMonth() === (t || /* @__PURE__ */ new Date()).getMonth()
96
95
  );
97
- }, [o, r, m]), s = N({
96
+ }, [o, r, m]), i = N({
98
97
  count: o.length,
99
98
  getScrollElement: () => n.current,
100
99
  estimateSize: () => 340,
101
- // Consistent height estimate
102
100
  overscan: 1,
103
- // Reduced overscan for performance (renders fewer invisible items)
104
101
  initialOffset: l !== -1 ? l * 340 : 0
105
102
  });
106
103
  O(() => {
107
- l !== -1 && n.current && s.scrollToIndex(l, { align: "start" });
104
+ l !== -1 && n.current && i.scrollToIndex(l, { align: "start" });
108
105
  }, []);
109
106
  const f = (t) => {
110
107
  if (m === "single")
@@ -115,7 +112,7 @@ const W = ({
115
112
  }
116
113
  };
117
114
  return /* @__PURE__ */ y("div", { className: "flex h-full w-full flex-col bg-surface-container", children: [
118
- /* @__PURE__ */ i("div", { className: "grid shrink-0 grid-cols-7 border-b border-outline-variant/50 bg-surface-container-high px-4 py-2 z-20", children: ["S", "M", "T", "W", "T", "F", "S"].map((t, e) => /* @__PURE__ */ i(
115
+ /* @__PURE__ */ s("div", { className: "grid shrink-0 grid-cols-7 border-b border-outline-variant/50 bg-surface-container-high px-4 py-2 z-20", children: ["S", "M", "T", "W", "T", "F", "S"].map((t, e) => /* @__PURE__ */ s(
119
116
  "div",
120
117
  {
121
118
  className: "flex h-8 items-center justify-center text-xs font-bold text-on-surface-variant",
@@ -123,29 +120,29 @@ const W = ({
123
120
  },
124
121
  e
125
122
  )) }),
126
- /* @__PURE__ */ i(
123
+ /* @__PURE__ */ s(
127
124
  F,
128
125
  {
129
126
  ref: n,
130
127
  className: "flex-1 overflow-y-auto pt-2 contain-strict",
131
- children: /* @__PURE__ */ i(
128
+ children: /* @__PURE__ */ s(
132
129
  "div",
133
130
  {
134
131
  style: {
135
- height: `${s.getTotalSize()}px`,
132
+ height: `${i.getTotalSize()}px`,
136
133
  width: "100%",
137
134
  position: "relative"
138
135
  },
139
- children: s.getVirtualItems().map((t) => /* @__PURE__ */ i(
136
+ children: i.getVirtualItems().map((t) => /* @__PURE__ */ s(
140
137
  "div",
141
138
  {
142
139
  "data-index": t.index,
143
- ref: s.measureElement,
140
+ ref: i.measureElement,
144
141
  className: "absolute top-0 left-0 w-full",
145
142
  style: {
146
143
  transform: `translateY(${t.start}px)`
147
144
  },
148
- children: /* @__PURE__ */ i(
145
+ children: /* @__PURE__ */ s(
149
146
  v,
150
147
  {
151
148
  monthDate: o[t.index],