@evinvest/uikit 0.15.2 → 0.17.0

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.
package/dist/index.js CHANGED
@@ -109,37 +109,46 @@ function useDismissableLayer(opts) {
109
109
 
110
110
  // src/primitives/use-floating.ts
111
111
  import * as React5 from "react";
112
+ var ABSOLUTE = Object.freeze({ position: "absolute", top: 0, left: 0 });
113
+ var POSITIONED = /* @__PURE__ */ new Set(["relative", "absolute", "fixed", "sticky"]);
114
+ function toContainingBlock(floating, x, y) {
115
+ const parent = floating.offsetParent;
116
+ const doc = floating.ownerDocument;
117
+ const root = parent === doc.body || parent === doc.documentElement || parent === null;
118
+ const positioned = parent instanceof HTMLElement && (!root || POSITIONED.has(doc.defaultView?.getComputedStyle(parent).position ?? ""));
119
+ if (!positioned) {
120
+ const win = doc.defaultView;
121
+ return { x: x + (win?.scrollX ?? 0), y: y + (win?.scrollY ?? 0), root: true };
122
+ }
123
+ const p = parent.getBoundingClientRect();
124
+ return {
125
+ x: x - p.left - parent.clientLeft + parent.scrollLeft,
126
+ y: y - p.top - parent.clientTop + parent.scrollTop,
127
+ root: false
128
+ };
129
+ }
130
+ function layoutSize(el) {
131
+ return { width: el.offsetWidth, height: el.offsetHeight };
132
+ }
133
+ function viewport() {
134
+ const el = document.documentElement;
135
+ return {
136
+ vw: el.clientWidth || window.innerWidth,
137
+ vh: el.clientHeight || window.innerHeight
138
+ };
139
+ }
112
140
  function useFloating(opts) {
113
141
  const { anchorRef, open, side = "bottom", align = "center", offset = 4 } = opts;
114
142
  const floatingRef = React5.useRef(null);
115
- const [style, setStyle] = React5.useState({
116
- position: "fixed",
117
- top: 0,
118
- left: 0
119
- });
120
- const [resolved, setResolved] = React5.useState({
143
+ const [placedSide, setPlacedSide] = React5.useState(side);
144
+ const placement = React5.useRef({
121
145
  side,
122
- align
146
+ shiftX: 0,
147
+ shiftY: 0
123
148
  });
124
149
  React5.useLayoutEffect(() => {
125
150
  if (!open) return;
126
- function update() {
127
- const anchor = anchorRef.current;
128
- const floating = floatingRef.current;
129
- if (!anchor || !floating) return;
130
- const a = anchor.getBoundingClientRect();
131
- const f = floating.getBoundingClientRect();
132
- const vw = window.innerWidth;
133
- const vh = window.innerHeight;
134
- let placed = side;
135
- if (side === "bottom" && a.bottom + offset + f.height > vh && a.top - offset - f.height > 0)
136
- placed = "top";
137
- else if (side === "top" && a.top - offset - f.height < 0 && a.bottom + offset + f.height < vh)
138
- placed = "bottom";
139
- else if (side === "right" && a.right + offset + f.width > vw && a.left - offset - f.width > 0)
140
- placed = "left";
141
- else if (side === "left" && a.left - offset - f.width < 0 && a.right + offset + f.width < vw)
142
- placed = "right";
151
+ function ideal(a, f, placed) {
143
152
  let top = 0;
144
153
  let left = 0;
145
154
  const vertical = placed === "top" || placed === "bottom";
@@ -156,29 +165,71 @@ function useFloating(opts) {
156
165
  else if (align === "end") top = a.bottom - f.height;
157
166
  else top = a.top + a.height / 2 - f.height / 2;
158
167
  }
159
- left = Math.max(offset, Math.min(left, vw - f.width - offset));
160
- top = Math.max(offset, Math.min(top, vh - f.height - offset));
161
- setStyle({ position: "fixed", top: Math.round(top), left: Math.round(left) });
162
- setResolved({ side: placed, align });
163
- }
164
- let frame = 0;
165
- function schedule() {
166
- if (frame) return;
167
- frame = requestAnimationFrame(() => {
168
- frame = 0;
169
- update();
170
- });
171
- }
172
- update();
173
- window.addEventListener("scroll", schedule, true);
174
- window.addEventListener("resize", schedule);
168
+ return { top, left };
169
+ }
170
+ function write(floating, f, top, left, contain) {
171
+ const p = toContainingBlock(floating, left, top);
172
+ let { x, y } = p;
173
+ if (contain && p.root) {
174
+ const icbWidth = floating.ownerDocument.documentElement.clientWidth || window.innerWidth;
175
+ x = Math.max(0, Math.min(x, icbWidth - f.width));
176
+ y = Math.max(0, y);
177
+ }
178
+ floating.style.translate = `${Math.round(x)}px ${Math.round(y)}px`;
179
+ }
180
+ function place() {
181
+ const anchor = anchorRef.current;
182
+ const floating = floatingRef.current;
183
+ if (!anchor || !floating) return;
184
+ const a = anchor.getBoundingClientRect();
185
+ const f = layoutSize(floating);
186
+ const { vw, vh } = viewport();
187
+ let placed = side;
188
+ if (side === "bottom" && a.bottom + offset + f.height > vh && a.top - offset - f.height > 0)
189
+ placed = "top";
190
+ else if (side === "top" && a.top - offset - f.height < 0 && a.bottom + offset + f.height < vh)
191
+ placed = "bottom";
192
+ else if (side === "right" && a.right + offset + f.width > vw && a.left - offset - f.width > 0)
193
+ placed = "left";
194
+ else if (side === "left" && a.left - offset - f.width < 0 && a.right + offset + f.width < vw)
195
+ placed = "right";
196
+ const { top, left } = ideal(a, f, placed);
197
+ const clampedLeft = Math.max(offset, Math.min(left, vw - f.width - offset));
198
+ const clampedTop = Math.max(offset, Math.min(top, vh - f.height - offset));
199
+ placement.current = {
200
+ side: placed,
201
+ shiftX: clampedLeft - left,
202
+ shiftY: clampedTop - top
203
+ };
204
+ write(floating, f, clampedTop, clampedLeft, false);
205
+ setPlacedSide((prev) => prev === placed ? prev : placed);
206
+ }
207
+ function sync() {
208
+ const anchor = anchorRef.current;
209
+ const floating = floatingRef.current;
210
+ if (!anchor || !floating) return;
211
+ const a = anchor.getBoundingClientRect();
212
+ const f = layoutSize(floating);
213
+ const { side: placed, shiftX, shiftY } = placement.current;
214
+ const { top, left } = ideal(a, f, placed);
215
+ write(floating, f, top + shiftY, left + shiftX, true);
216
+ }
217
+ place();
218
+ window.addEventListener("scroll", sync, true);
219
+ window.addEventListener("resize", place);
220
+ let observer;
221
+ if (typeof ResizeObserver !== "undefined") {
222
+ observer = new ResizeObserver(place);
223
+ if (anchorRef.current) observer.observe(anchorRef.current);
224
+ if (floatingRef.current) observer.observe(floatingRef.current);
225
+ }
175
226
  return () => {
176
- if (frame) cancelAnimationFrame(frame);
177
- window.removeEventListener("scroll", schedule, true);
178
- window.removeEventListener("resize", schedule);
227
+ window.removeEventListener("scroll", sync, true);
228
+ window.removeEventListener("resize", place);
229
+ observer?.disconnect();
179
230
  };
180
231
  }, [open, side, align, offset, anchorRef]);
181
- return { floatingRef, style, side: resolved.side, align: resolved.align };
232
+ return { floatingRef, style: ABSOLUTE, side: placedSide, align };
182
233
  }
183
234
 
184
235
  // src/primitives/focus-scope.tsx
@@ -227,9 +278,44 @@ function useFocusScope(enabled) {
227
278
 
228
279
  // src/primitives/presence.ts
229
280
  import * as React7 from "react";
281
+ import { flushSync } from "react-dom";
282
+ var EXIT_FALLBACK_MS = 1e3;
230
283
  function usePresence(present) {
231
284
  const ref = React7.useRef(null);
232
- return { isPresent: present, ref };
285
+ const [mounted, setMounted] = React7.useState(present);
286
+ React7.useLayoutEffect(() => {
287
+ if (present) {
288
+ setMounted(true);
289
+ return;
290
+ }
291
+ const node = ref.current;
292
+ if (!node) {
293
+ setMounted(false);
294
+ return;
295
+ }
296
+ const name = getComputedStyle(node).animationName;
297
+ if (name === "" || name === "none") {
298
+ setMounted(false);
299
+ return;
300
+ }
301
+ const prevPointerEvents = node.style.pointerEvents;
302
+ node.style.pointerEvents = "none";
303
+ const onEnd = (e) => {
304
+ if (e.target !== node) return;
305
+ if (e.animationName && !name.includes(e.animationName)) return;
306
+ flushSync(() => setMounted(false));
307
+ };
308
+ node.addEventListener("animationend", onEnd);
309
+ node.addEventListener("animationcancel", onEnd);
310
+ const timer = setTimeout(() => setMounted(false), EXIT_FALLBACK_MS);
311
+ return () => {
312
+ clearTimeout(timer);
313
+ node.removeEventListener("animationend", onEnd);
314
+ node.removeEventListener("animationcancel", onEnd);
315
+ node.style.pointerEvents = prevPointerEvents;
316
+ };
317
+ }, [present]);
318
+ return { isPresent: present || mounted, ref };
233
319
  }
234
320
 
235
321
  // src/primitives/use-roving-focus.ts
@@ -5197,14 +5283,14 @@ function useItem() {
5197
5283
  function NavigationMenu({
5198
5284
  className,
5199
5285
  children,
5200
- viewport = true,
5286
+ viewport: viewport2 = true,
5201
5287
  ...props
5202
5288
  }) {
5203
5289
  return /* @__PURE__ */ jsxs18(
5204
5290
  "nav",
5205
5291
  {
5206
5292
  "data-slot": "navigation-menu",
5207
- "data-viewport": viewport,
5293
+ "data-viewport": viewport2,
5208
5294
  role: "navigation",
5209
5295
  className: cn(
5210
5296
  NAVIGATION_MENU,
@@ -5213,7 +5299,7 @@ function NavigationMenu({
5213
5299
  ...props,
5214
5300
  children: [
5215
5301
  children,
5216
- viewport && /* @__PURE__ */ jsx48(NavigationMenuViewport, {})
5302
+ viewport2 && /* @__PURE__ */ jsx48(NavigationMenuViewport, {})
5217
5303
  ]
5218
5304
  }
5219
5305
  );
@@ -5891,15 +5977,16 @@ function SheetDescription({ className, ...props }) {
5891
5977
  import * as React62 from "react";
5892
5978
 
5893
5979
  // src/generated/drawer.ts
5894
- var DRAWER_CONTENT_BASE = "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex h-auto border transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500";
5980
+ var DRAWER_CONTENT_BASE = "bg-background fixed z-50 flex h-auto border";
5895
5981
  var drawerDirectionClasses = {
5896
- "bottom": "data-[state=open]:slide-in-from-bottom data-[state=closed]:slide-out-to-bottom inset-x-0 bottom-0 mt-24 max-h-[80vh] flex-col rounded-t-lg border-b-0",
5897
- "top": "data-[state=open]:slide-in-from-top data-[state=closed]:slide-out-to-top inset-x-0 top-0 mb-24 max-h-[80vh] flex-col rounded-b-lg border-t-0",
5898
- "left": "data-[state=open]:slide-in-from-left data-[state=closed]:slide-out-to-left inset-y-0 left-0 w-3/4 flex-row border-r sm:max-w-sm",
5899
- "right": "data-[state=open]:slide-in-from-right data-[state=closed]:slide-out-to-right inset-y-0 right-0 w-3/4 flex-row border-l sm:max-w-sm"
5982
+ "bottom": "inset-x-0 bottom-0 mt-24 max-h-[80vh] flex-col rounded-t-lg border-b-0",
5983
+ "top": "inset-x-0 top-0 mb-24 max-h-[80vh] flex-col rounded-b-lg border-t-0",
5984
+ "left": "inset-y-0 left-0 w-3/4 flex-row border-r sm:max-w-sm",
5985
+ "right": "inset-y-0 right-0 w-3/4 flex-row border-l sm:max-w-sm"
5900
5986
  };
5901
- var DRAWER_OVERLAY = "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50";
5902
- var DRAWER_HANDLE = "bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full";
5987
+ var DRAWER_OVERLAY = "fixed inset-0 z-50 bg-black/50";
5988
+ var DRAWER_HANDLE = "bg-muted mx-auto mt-4 h-2 w-[100px] shrink-0 rounded-full";
5989
+ var DRAWER_BODY = "flex min-h-0 flex-1 flex-col overflow-y-auto";
5903
5990
  var DRAWER_HEADER = "flex flex-col gap-0.5 p-4 text-center sm:gap-1.5 sm:text-left";
5904
5991
  var DRAWER_FOOTER = "mt-auto flex flex-col gap-2 p-4";
5905
5992
  var DRAWER_TITLE = "text-ink font-semibold";
@@ -5907,6 +5994,10 @@ var DRAWER_DESCRIPTION = "text-ink-soft text-sm";
5907
5994
 
5908
5995
  // src/components/drawer.tsx
5909
5996
  import { jsx as jsx52, jsxs as jsxs22 } from "react/jsx-runtime";
5997
+ var CLOSE_THRESHOLD = 0.25;
5998
+ var VELOCITY_THRESHOLD = 0.4;
5999
+ var DRAG_AFTER_OPEN_MS = 500;
6000
+ var EXIT_FALLBACK_MS2 = 600;
5910
6001
  var DrawerContext = React62.createContext(null);
5911
6002
  function useDrawer() {
5912
6003
  const ctx = React62.useContext(DrawerContext);
@@ -5971,16 +6062,169 @@ function DrawerOverlay({ className, ...props }) {
5971
6062
  }
5972
6063
  );
5973
6064
  }
6065
+ var EDGE_SIGN = {
6066
+ bottom: 1,
6067
+ top: -1,
6068
+ right: 1,
6069
+ left: -1
6070
+ };
6071
+ function isVertical(direction) {
6072
+ return direction === "bottom" || direction === "top";
6073
+ }
6074
+ function translateAlong(direction, px) {
6075
+ return isVertical(direction) ? `translate3d(0, ${px}px, 0)` : `translate3d(${px}px, 0, 0)`;
6076
+ }
6077
+ function dampen(px) {
6078
+ return Math.max(8 * (Math.log(px + 1) - 2), 0);
6079
+ }
6080
+ function shouldDrag(target, panel, direction, towardsEdge) {
6081
+ if (!(target instanceof Element)) return false;
6082
+ if (target.tagName === "SELECT") return false;
6083
+ if (target.closest("[data-vaul-no-drag]")) return false;
6084
+ if (!isVertical(direction)) return true;
6085
+ if (!towardsEdge) return false;
6086
+ const selection = window.getSelection?.()?.toString();
6087
+ if (selection && selection.length > 0) return false;
6088
+ let el = target;
6089
+ while (el && el !== panel) {
6090
+ if (el.scrollHeight > el.clientHeight && el.scrollTop > 0) return false;
6091
+ el = el.parentElement;
6092
+ }
6093
+ return true;
6094
+ }
6095
+ function useDrawerDrag(opts) {
6096
+ const { panelRef, scrimRef, direction, open, present, openedAtRef, onClose } = opts;
6097
+ const dragRef = React62.useRef(null);
6098
+ React62.useEffect(() => {
6099
+ if (!present) return;
6100
+ const panel = panelRef.current;
6101
+ if (!panel) return;
6102
+ const onTouchMove = (e) => {
6103
+ if (dragRef.current?.allowed) e.preventDefault();
6104
+ };
6105
+ panel.addEventListener("touchmove", onTouchMove, { passive: false });
6106
+ return () => panel.removeEventListener("touchmove", onTouchMove);
6107
+ }, [present, panelRef]);
6108
+ const axisPos = (e) => isVertical(direction) ? e.clientY : e.clientX;
6109
+ const onPointerDown = (e) => {
6110
+ const panel = panelRef.current;
6111
+ if (!panel || e.button > 0 || !open || dragRef.current) return;
6112
+ const target = e.target;
6113
+ if (target.closest('[data-slot="drawer-close"]')) return;
6114
+ if (!panel.contains(target)) return;
6115
+ const rect = panel.getBoundingClientRect();
6116
+ dragRef.current = {
6117
+ pointerId: e.pointerId,
6118
+ target,
6119
+ start: axisPos(e),
6120
+ time: Date.now(),
6121
+ size: isVertical(direction) ? rect.height : rect.width,
6122
+ allowed: null,
6123
+ delta: 0
6124
+ };
6125
+ try {
6126
+ target.setPointerCapture?.(e.pointerId);
6127
+ } catch {
6128
+ }
6129
+ };
6130
+ const onPointerMove = (e) => {
6131
+ const drag = dragRef.current;
6132
+ const panel = panelRef.current;
6133
+ if (!drag || !panel) return;
6134
+ const delta = (axisPos(e) - drag.start) * EDGE_SIGN[direction];
6135
+ drag.delta = delta;
6136
+ if (!drag.allowed) {
6137
+ if (Date.now() - openedAtRef.current < DRAG_AFTER_OPEN_MS) return;
6138
+ if (!shouldDrag(drag.target, panel, direction, delta > 0)) return;
6139
+ drag.allowed = true;
6140
+ panel.setAttribute("data-dragging", "true");
6141
+ scrimRef.current?.setAttribute("data-dragging", "true");
6142
+ }
6143
+ const scrim = scrimRef.current;
6144
+ if (delta < 0) {
6145
+ panel.style.transform = translateAlong(direction, -dampen(-delta) * EDGE_SIGN[direction]);
6146
+ if (scrim) scrim.style.opacity = "1";
6147
+ return;
6148
+ }
6149
+ panel.style.transform = translateAlong(direction, delta * EDGE_SIGN[direction]);
6150
+ if (scrim) {
6151
+ scrim.style.opacity = `${Math.min(1, Math.max(0, 1 - delta / drag.size))}`;
6152
+ }
6153
+ };
6154
+ const endGesture = (e, cancelled) => {
6155
+ const drag = dragRef.current;
6156
+ const panel = panelRef.current;
6157
+ if (!drag || !panel || e.pointerId !== drag.pointerId) return;
6158
+ dragRef.current = null;
6159
+ try {
6160
+ drag.target.releasePointerCapture?.(drag.pointerId);
6161
+ } catch {
6162
+ }
6163
+ if (!drag.allowed) return;
6164
+ panel.removeAttribute("data-dragging");
6165
+ panel.style.transform = "";
6166
+ const scrim = scrimRef.current;
6167
+ if (scrim) {
6168
+ scrim.removeAttribute("data-dragging");
6169
+ scrim.style.opacity = "";
6170
+ }
6171
+ if (cancelled || drag.delta <= 0) return;
6172
+ const dt = Date.now() - drag.time;
6173
+ const velocity = dt > 0 ? drag.delta / dt : 0;
6174
+ if (velocity > VELOCITY_THRESHOLD || drag.delta >= drag.size * CLOSE_THRESHOLD) {
6175
+ onClose();
6176
+ }
6177
+ };
6178
+ return {
6179
+ onPointerDown,
6180
+ onPointerMove,
6181
+ onPointerUp: (e) => endGesture(e, false),
6182
+ onPointerCancel: (e) => endGesture(e, true)
6183
+ };
6184
+ }
5974
6185
  function DrawerContent({ className, children, ...props }) {
5975
6186
  const { open, setOpen, direction } = useDrawer();
6187
+ const [present, setPresent] = React62.useState(open);
6188
+ if (open && !present) setPresent(true);
6189
+ const closing = present && !open;
5976
6190
  const scopeRef = useFocusScope(open);
5977
- if (!open) return null;
6191
+ const panelRef = React62.useRef(null);
6192
+ const scrimRef = React62.useRef(null);
6193
+ const openedAtRef = React62.useRef(0);
6194
+ React62.useEffect(() => {
6195
+ if (open) openedAtRef.current = Date.now();
6196
+ }, [open]);
6197
+ React62.useEffect(() => {
6198
+ if (!open) return;
6199
+ const prev = document.body.style.overflow;
6200
+ document.body.style.overflow = "hidden";
6201
+ return () => {
6202
+ document.body.style.overflow = prev;
6203
+ };
6204
+ }, [open]);
6205
+ React62.useEffect(() => {
6206
+ if (!closing) return;
6207
+ const id = setTimeout(() => setPresent(false), EXIT_FALLBACK_MS2);
6208
+ return () => clearTimeout(id);
6209
+ }, [closing]);
6210
+ const drag = useDrawerDrag({
6211
+ panelRef,
6212
+ scrimRef,
6213
+ direction,
6214
+ open,
6215
+ present,
6216
+ openedAtRef,
6217
+ onClose: () => setOpen(false)
6218
+ });
6219
+ if (!present) return null;
6220
+ const state = closing ? "closed" : "open";
5978
6221
  return /* @__PURE__ */ jsxs22(Portal, { children: [
5979
6222
  /* @__PURE__ */ jsx52(
5980
6223
  "div",
5981
6224
  {
6225
+ ref: scrimRef,
5982
6226
  "data-slot": "drawer-overlay",
5983
- "data-state": "open",
6227
+ "data-state": state,
5984
6228
  className: DRAWER_OVERLAY,
5985
6229
  onClick: () => setOpen(false)
5986
6230
  }
@@ -5991,12 +6235,21 @@ function DrawerContent({ className, children, ...props }) {
5991
6235
  role: "dialog",
5992
6236
  "aria-modal": "true",
5993
6237
  "data-slot": "drawer-content",
5994
- "data-state": "open",
6238
+ "data-state": state,
5995
6239
  "data-vaul-drawer-direction": direction,
5996
- ref: mergeRefs(scopeRef),
6240
+ ref: mergeRefs(scopeRef, panelRef),
5997
6241
  onKeyDown: (e) => {
5998
6242
  if (e.key === "Escape") setOpen(false);
5999
6243
  },
6244
+ onTransitionEnd: (e) => {
6245
+ if (closing && e.propertyName === "transform" && e.target === e.currentTarget) {
6246
+ setPresent(false);
6247
+ }
6248
+ },
6249
+ onPointerDown: drag.onPointerDown,
6250
+ onPointerMove: drag.onPointerMove,
6251
+ onPointerUp: drag.onPointerUp,
6252
+ onPointerCancel: drag.onPointerCancel,
6000
6253
  className: cn(DRAWER_CONTENT_BASE, drawerDirectionClasses[direction], className),
6001
6254
  ...props,
6002
6255
  children: [
@@ -6007,7 +6260,14 @@ function DrawerContent({ className, children, ...props }) {
6007
6260
  className: DRAWER_HANDLE
6008
6261
  }
6009
6262
  ) : null,
6010
- children
6263
+ /* @__PURE__ */ jsx52(
6264
+ "div",
6265
+ {
6266
+ "data-slot": "drawer-body",
6267
+ className: DRAWER_BODY,
6268
+ children
6269
+ }
6270
+ )
6011
6271
  ]
6012
6272
  }
6013
6273
  )
@@ -6704,17 +6964,17 @@ function ChartLegendContent({
6704
6964
  import * as React66 from "react";
6705
6965
 
6706
6966
  // src/generated/calendar.ts
6707
- var CALENDAR_ROOT = "bg-background p-3 w-fit";
6967
+ var CALENDAR_ROOT = "p-3 w-fit";
6708
6968
  var CALENDAR_NAV_BUTTON = "size-8 p-0 select-none";
6709
6969
  var CALENDAR_NAV = "flex items-center justify-between gap-1 w-full px-1";
6710
6970
  var CALENDAR_CAPTION = "text-sm font-medium select-none";
6711
6971
  var CALENDAR_GRID = "w-full border-collapse mt-4";
6712
6972
  var CALENDAR_WEEKDAY_ROW = "flex";
6713
- var CALENDAR_WEEKDAY = "text-ink-soft rounded-md flex-1 font-normal text-[0.8rem] select-none";
6973
+ var CALENDAR_WEEKDAY = "text-ink-soft rounded-md w-9 shrink-0 font-normal text-[0.8rem] select-none";
6714
6974
  var CALENDAR_WEEK = "flex w-full mt-2";
6715
- var CALENDAR_DAY_EMPTY = "relative w-full h-full p-0 aspect-square select-none";
6716
- var CALENDAR_DAY_CELL = "relative w-full h-full p-0 text-center aspect-square select-none";
6717
- var CALENDAR_DAY = "size-auto w-full aspect-square font-normal leading-none";
6975
+ var CALENDAR_DAY_EMPTY = "relative size-9 shrink-0 p-0 select-none";
6976
+ var CALENDAR_DAY_CELL = "relative size-9 shrink-0 p-0 text-center select-none";
6977
+ var CALENDAR_DAY = "size-auto w-full aspect-square font-normal leading-none tabular-nums";
6718
6978
  var CALENDAR_DAY_SELECTED = "bg-primary text-on-primary";
6719
6979
  var CALENDAR_DAY_TODAY = "bg-hover text-ink rounded-md";
6720
6980
 
@@ -6813,7 +7073,7 @@ function Calendar({
6813
7073
  const cells = [];
6814
7074
  for (let i = 0; i < lead; i += 1) cells.push(null);
6815
7075
  for (let day = 1; day <= total; day += 1) cells.push(day);
6816
- while (cells.length % 7 !== 0) cells.push(null);
7076
+ while (cells.length < 42) cells.push(null);
6817
7077
  const weeks = [];
6818
7078
  for (let i = 0; i < cells.length; i += 7) weeks.push(cells.slice(i, i + 7));
6819
7079
  const navClass = buttonVariants({
@@ -6955,6 +7215,25 @@ function CalendarIcon() {
6955
7215
  }
6956
7216
  );
6957
7217
  }
7218
+ function XIcon3() {
7219
+ return /* @__PURE__ */ jsx57(
7220
+ "svg",
7221
+ {
7222
+ className: "size-4",
7223
+ xmlns: "http://www.w3.org/2000/svg",
7224
+ width: "24",
7225
+ height: "24",
7226
+ viewBox: "0 0 24 24",
7227
+ fill: "none",
7228
+ stroke: "currentColor",
7229
+ strokeWidth: "2",
7230
+ strokeLinecap: "round",
7231
+ strokeLinejoin: "round",
7232
+ "aria-hidden": true,
7233
+ children: /* @__PURE__ */ jsx57("path", { d: "M18 6 6 18M6 6l12 12" })
7234
+ }
7235
+ );
7236
+ }
6958
7237
  var pad = (n) => String(n).padStart(2, "0");
6959
7238
  function atMinute(d) {
6960
7239
  return new Date(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), d.getMinutes());
@@ -7162,6 +7441,18 @@ function DateTimePicker({
7162
7441
  onClick: onClear,
7163
7442
  children: labels.clear ?? "Clear"
7164
7443
  }
7444
+ ),
7445
+ /* @__PURE__ */ jsx57(
7446
+ "button",
7447
+ {
7448
+ type: "button",
7449
+ className: buttonVariants({ variant: "ghost", size: "sm", icon: true }),
7450
+ "data-slot": "date-time-picker-close",
7451
+ "aria-label": labels.close ?? "Close",
7452
+ disabled,
7453
+ onClick: () => setOpen(false),
7454
+ children: /* @__PURE__ */ jsx57(XIcon3, {})
7455
+ }
7165
7456
  )
7166
7457
  ] })
7167
7458
  ]