beez-ui 0.6.2 → 0.8.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.
Files changed (127) hide show
  1. package/CHANGELOG.md +150 -96
  2. package/README.md +33 -6
  3. package/dist/components/account-menu.d.ts +53 -0
  4. package/dist/components/account-menu.js +405 -0
  5. package/dist/components/alert.js +1 -1
  6. package/dist/components/animated-collapse.d.ts +19 -0
  7. package/dist/components/animated-collapse.js +81 -0
  8. package/dist/components/animated-count.d.ts +13 -0
  9. package/dist/components/animated-count.js +105 -0
  10. package/dist/components/animated-list-item.d.ts +25 -0
  11. package/dist/components/animated-list-item.js +132 -0
  12. package/dist/components/avatar.d.ts +2 -1
  13. package/dist/components/avatar.js +4 -3
  14. package/dist/components/bouncing-dots-loader.d.ts +19 -0
  15. package/dist/components/bouncing-dots-loader.js +47 -0
  16. package/dist/components/calendar.js +102 -0
  17. package/dist/components/carousel.js +61 -48
  18. package/dist/components/checkbox.js +1 -1
  19. package/dist/components/confirm-delete-button.d.ts +29 -0
  20. package/dist/components/confirm-delete-button.js +254 -0
  21. package/dist/components/data-table.js +34 -4
  22. package/dist/components/dropdown-menu.js +5 -2
  23. package/dist/components/empty-state.d.ts +24 -0
  24. package/dist/components/empty-state.js +37 -0
  25. package/dist/components/error-state.d.ts +20 -0
  26. package/dist/components/error-state.js +145 -0
  27. package/dist/components/external-browser-handoff.d.ts +27 -0
  28. package/dist/components/external-browser-handoff.js +306 -0
  29. package/dist/components/file-upload.d.ts +78 -0
  30. package/dist/components/file-upload.js +678 -0
  31. package/dist/components/filter-query-bar.js +11 -6
  32. package/dist/components/form.d.ts +5 -0
  33. package/dist/components/form.js +11 -9
  34. package/dist/components/info-popover.d.ts +23 -0
  35. package/dist/components/info-popover.js +158 -0
  36. package/dist/components/input-group.js +1 -1
  37. package/dist/components/input.js +1 -1
  38. package/dist/components/month-calendar-header.d.ts +65 -0
  39. package/dist/components/month-calendar-header.js +337 -0
  40. package/dist/components/month-grid.d.ts +59 -0
  41. package/dist/components/month-grid.js +301 -0
  42. package/dist/components/notification-bell.d.ts +50 -0
  43. package/dist/components/notification-bell.js +338 -0
  44. package/dist/components/notification-panel.d.ts +56 -0
  45. package/dist/components/notification-panel.js +281 -0
  46. package/dist/components/open-in-browser-cta.d.ts +22 -0
  47. package/dist/components/open-in-browser-cta.js +61 -0
  48. package/dist/components/pagination.d.ts +1 -0
  49. package/dist/components/pagination.js +9 -4
  50. package/dist/components/presence-swap.d.ts +22 -0
  51. package/dist/components/presence-swap.js +162 -0
  52. package/dist/components/progress-ring.d.ts +20 -0
  53. package/dist/components/progress-ring.js +53 -0
  54. package/dist/components/pwa-update-control.d.ts +18 -0
  55. package/dist/components/pwa-update-control.js +119 -0
  56. package/dist/components/radio-group.js +1 -1
  57. package/dist/components/reaction-button.d.ts +26 -0
  58. package/dist/components/reaction-button.js +114 -0
  59. package/dist/components/rich-link-editor.d.ts +25 -0
  60. package/dist/components/rich-link-editor.js +320 -0
  61. package/dist/components/rich-markdown-content.d.ts +10 -0
  62. package/dist/components/rich-markdown-content.js +56 -0
  63. package/dist/components/rich-text-content.d.ts +19 -0
  64. package/dist/components/rich-text-content.js +26 -0
  65. package/dist/components/select.js +1 -1
  66. package/dist/components/sheet.js +12 -9
  67. package/dist/components/sidebar.js +9 -5
  68. package/dist/components/skeleton.d.ts +6 -0
  69. package/dist/components/skeleton.js +7 -1
  70. package/dist/components/switch.js +1 -1
  71. package/dist/components/textarea.js +1 -1
  72. package/dist/components/typing-animation.js +42 -15
  73. package/dist/emoji-picker.d.ts +27 -0
  74. package/dist/emoji-picker.js +283 -0
  75. package/dist/hooks/use-horizontal-swipe.d.ts +23 -0
  76. package/dist/hooks/use-horizontal-swipe.js +80 -0
  77. package/dist/hooks/use-is-hydrated.d.ts +6 -0
  78. package/dist/hooks/use-is-hydrated.js +20 -0
  79. package/dist/hooks/use-minute-clock.d.ts +23 -0
  80. package/dist/hooks/use-minute-clock.js +147 -0
  81. package/dist/hooks/use-month-transition-direction.d.ts +21 -0
  82. package/dist/hooks/use-month-transition-direction.js +110 -0
  83. package/dist/hooks/use-rich-link-editor.d.ts +55 -0
  84. package/dist/hooks/use-rich-link-editor.js +515 -0
  85. package/dist/hooks/use-viewer-time-zone.d.ts +6 -0
  86. package/dist/hooks/use-viewer-time-zone.js +20 -0
  87. package/dist/index.d.ts +44 -0
  88. package/dist/index.js +43 -0
  89. package/dist/lib/browser-clipboard.d.ts +13 -0
  90. package/dist/lib/browser-clipboard.js +48 -0
  91. package/dist/lib/browser-navigation.d.ts +21 -0
  92. package/dist/lib/browser-navigation.js +42 -0
  93. package/dist/lib/column-filter-value.d.ts +12 -0
  94. package/dist/lib/column-filter-value.js +52 -0
  95. package/dist/lib/file-acceptance.d.ts +43 -0
  96. package/dist/lib/file-acceptance.js +107 -0
  97. package/dist/lib/format-file-size.d.ts +16 -0
  98. package/dist/lib/format-file-size.js +34 -0
  99. package/dist/lib/fuzzy-search.d.ts +17 -0
  100. package/dist/lib/fuzzy-search.js +183 -0
  101. package/dist/lib/horizontal-swipe.d.ts +23 -0
  102. package/dist/lib/horizontal-swipe.js +29 -0
  103. package/dist/lib/in-app-browser.d.ts +35 -0
  104. package/dist/lib/in-app-browser.js +80 -0
  105. package/dist/lib/month-grid.d.ts +42 -0
  106. package/dist/lib/month-grid.js +74 -0
  107. package/dist/lib/name-initials.d.ts +7 -0
  108. package/dist/lib/name-initials.js +11 -0
  109. package/dist/lib/rich-text/link-markdown-constants.d.ts +147 -0
  110. package/dist/lib/rich-text/link-markdown-constants.js +458 -0
  111. package/dist/lib/rich-text/link-markdown-types.d.ts +53 -0
  112. package/dist/lib/rich-text/link-markdown-types.js +1 -0
  113. package/dist/lib/rich-text/link-markdown.d.ts +193 -0
  114. package/dist/lib/rich-text/link-markdown.js +592 -0
  115. package/dist/lib/rich-text/rich-markdown.d.ts +41 -0
  116. package/dist/lib/rich-text/rich-markdown.js +105 -0
  117. package/dist/lib/rich-text/rich-text-editor-dom.d.ts +26 -0
  118. package/dist/lib/rich-text/rich-text-editor-dom.js +79 -0
  119. package/dist/motion/glide-indicator.d.ts +37 -3
  120. package/dist/motion/glide-indicator.js +37 -3
  121. package/dist/motion/motion-slot.js +47 -18
  122. package/dist/motion/surface-keyframes.js +18 -6
  123. package/dist/motion/tokens.d.ts +41 -2
  124. package/dist/motion/tokens.js +40 -1
  125. package/dist/providers/beez-ui-provider.js +49 -17
  126. package/dist/styles.css +1 -1
  127. package/package.json +212 -2
@@ -0,0 +1,132 @@
1
+ "use client";
2
+ import { c as _c } from "react/compiler-runtime";
3
+ import { motion, useIsPresent } from "motion/react";
4
+ import { usePrefersReducedMotion } from "../hooks/use-prefers-reduced-motion.js";
5
+ import { cn } from "../lib/utils.js";
6
+ import { MOTION_EASE, MOTION_ITEM_ENTER_SCALE, MOTION_LIST_ITEM_DISTANCE, MOTION_TIMING, SPRING_LAYOUT } from "../motion/tokens.js";
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ const ANIMATED_LIST_ITEM_ELEMENTS = {
9
+ li: motion.li,
10
+ div: motion.div,
11
+ article: motion.article
12
+ };
13
+ const LIST_ITEM_TRANSITION = {
14
+ duration: MOTION_TIMING.panel,
15
+ ease: MOTION_EASE,
16
+ layout: SPRING_LAYOUT
17
+ };
18
+ const LIST_ITEM_EXIT_TRANSITION = {
19
+ duration: MOTION_TIMING.exit,
20
+ ease: MOTION_EASE
21
+ };
22
+ /** Reduced motion keeps enter/exit semantics (inert while leaving) but without travel or delay. */
23
+ const INSTANT_TRANSITION = { duration: 0 };
24
+ /**
25
+ * Wrap the list in `<AnimatePresence initial={false}>` so only items added after the
26
+ * first render animate in, and removed items animate out before leaving the DOM.
27
+ * A leaving item turns inert and hidden from assistive technology, so it can no
28
+ * longer be focused, clicked or announced during its exit.
29
+ * @param props - Native attributes, element type and content.
30
+ * @returns The animated item.
31
+ */
32
+ export function AnimatedListItem(t0) {
33
+ const $ = _c(22);
34
+ let children;
35
+ let className;
36
+ let elementProps;
37
+ let t1;
38
+ let t2;
39
+ if ($[0] !== t0) {
40
+ ({children, as: t1, layout: t2, className, ...elementProps} = t0);
41
+ $[0] = t0;
42
+ $[1] = children;
43
+ $[2] = className;
44
+ $[3] = elementProps;
45
+ $[4] = t1;
46
+ $[5] = t2;
47
+ } else {
48
+ children = $[1];
49
+ className = $[2];
50
+ elementProps = $[3];
51
+ t1 = $[4];
52
+ t2 = $[5];
53
+ }
54
+ const as = t1 === undefined ? "li" : t1;
55
+ const layout = t2 === undefined ? true : t2;
56
+ const MotionElement = ANIMATED_LIST_ITEM_ELEMENTS[as];
57
+ const isPresent = useIsPresent();
58
+ const shouldReduceMotion = usePrefersReducedMotion();
59
+ const t3 = isPresent ? elementProps["aria-hidden"] : true;
60
+ const t4 = !isPresent || undefined;
61
+ let t5;
62
+ if ($[6] !== className) {
63
+ t5 = cn("min-w-0", className);
64
+ $[6] = className;
65
+ $[7] = t5;
66
+ } else {
67
+ t5 = $[7];
68
+ }
69
+ const t6 = layout && !shouldReduceMotion ? "position" : false;
70
+ let t7;
71
+ let t8;
72
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
73
+ t7 = {
74
+ opacity: 0,
75
+ y: MOTION_LIST_ITEM_DISTANCE,
76
+ scale: MOTION_ITEM_ENTER_SCALE
77
+ };
78
+ t8 = {
79
+ opacity: 1,
80
+ y: 0,
81
+ scale: 1
82
+ };
83
+ $[8] = t7;
84
+ $[9] = t8;
85
+ } else {
86
+ t7 = $[8];
87
+ t8 = $[9];
88
+ }
89
+ const t9 = shouldReduceMotion ? INSTANT_TRANSITION : LIST_ITEM_EXIT_TRANSITION;
90
+ let t10;
91
+ if ($[10] !== t9) {
92
+ t10 = {
93
+ opacity: 0,
94
+ scale: MOTION_ITEM_ENTER_SCALE,
95
+ transition: t9
96
+ };
97
+ $[10] = t9;
98
+ $[11] = t10;
99
+ } else {
100
+ t10 = $[11];
101
+ }
102
+ const t11 = shouldReduceMotion ? INSTANT_TRANSITION : LIST_ITEM_TRANSITION;
103
+ let t12;
104
+ if ($[12] !== MotionElement || $[13] !== children || $[14] !== elementProps || $[15] !== t10 || $[16] !== t11 || $[17] !== t3 || $[18] !== t4 || $[19] !== t5 || $[20] !== t6) {
105
+ t12 = /* @__PURE__ */ _jsx(MotionElement, {
106
+ "data-slot": "animated-list-item",
107
+ ...elementProps,
108
+ "aria-hidden": t3,
109
+ inert: t4,
110
+ className: t5,
111
+ layout: t6,
112
+ initial: t7,
113
+ animate: t8,
114
+ exit: t10,
115
+ transition: t11,
116
+ children
117
+ });
118
+ $[12] = MotionElement;
119
+ $[13] = children;
120
+ $[14] = elementProps;
121
+ $[15] = t10;
122
+ $[16] = t11;
123
+ $[17] = t3;
124
+ $[18] = t4;
125
+ $[19] = t5;
126
+ $[20] = t6;
127
+ $[21] = t12;
128
+ } else {
129
+ t12 = $[21];
130
+ }
131
+ return t12;
132
+ }
@@ -7,10 +7,11 @@ export type AvatarImageProps = Omit<React.ComponentProps<"img">, "src"> & {
7
7
  declare function Avatar({ className, size, ...props }: AvatarPrimitive.Root.Props & {
8
8
  size?: "default" | "sm" | "lg";
9
9
  }): React.JSX.Element;
10
- /** Delegates loading, failure and fallback synchronization to the avatar primitive. */
10
+ /** Delegates loading, failure and fallback synchronization to the avatar primitive; loaded images develop in place. */
11
11
  declare function AvatarImage({ alt, className, src, ...props }: AvatarImageProps): React.JSX.Element;
12
12
  declare function AvatarFallback({ className, ...props }: AvatarPrimitive.Fallback.Props): React.JSX.Element;
13
13
  declare function AvatarBadge({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
14
+ /** Overlaps avatars; the hovered one lifts slightly above its neighbours. */
14
15
  declare function AvatarGroup({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
15
16
  declare function AvatarGroupCount({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
16
17
  export { Avatar, AvatarImage, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarBadge, };
@@ -51,7 +51,7 @@ function Avatar(t0) {
51
51
  }
52
52
  return t3;
53
53
  }
54
- /** Delegates loading, failure and fallback synchronization to the avatar primitive. */
54
+ /** Delegates loading, failure and fallback synchronization to the avatar primitive; loaded images develop in place. */
55
55
  function AvatarImage(t0) {
56
56
  const $ = _c(15);
57
57
  let className;
@@ -94,7 +94,7 @@ function AvatarImage(t0) {
94
94
  let t6;
95
95
  if ($[9] !== alt || $[10] !== props || $[11] !== t3 || $[12] !== t4 || $[13] !== t5) {
96
96
  t6 = /* @__PURE__ */ _jsx(MotionSlot, {
97
- kind: "field",
97
+ kind: "reveal",
98
98
  children: /* @__PURE__ */ _jsx(AvatarPrimitive.Image, {
99
99
  render: t3,
100
100
  keepMounted: true,
@@ -190,6 +190,7 @@ function AvatarBadge(t0) {
190
190
  }
191
191
  return t2;
192
192
  }
193
+ /** Overlaps avatars; the hovered one lifts slightly above its neighbours. */
193
194
  function AvatarGroup(t0) {
194
195
  const $ = _c(8);
195
196
  let className;
@@ -205,7 +206,7 @@ function AvatarGroup(t0) {
205
206
  }
206
207
  let t1;
207
208
  if ($[3] !== className) {
208
- t1 = cn("group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background", className);
209
+ t1 = cn("group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background *:data-[slot=avatar]:transition-[translate] *:data-[slot=avatar]:duration-200 *:data-[slot=avatar]:ease-out *:data-[slot=avatar]:hover:z-10 *:data-[slot=avatar]:hover:-translate-y-0.5", className);
209
210
  $[3] = className;
210
211
  $[4] = t1;
211
212
  } else {
@@ -0,0 +1,19 @@
1
+ /** Animated three-dot bouncing loader with synchronized floor shadows. */
2
+ import type { HTMLAttributes } from "react";
3
+ export type BouncingDotsLoaderSize = "sm" | "md";
4
+ export type BouncingDotsLoaderProps = Omit<HTMLAttributes<HTMLDivElement>, "aria-label" | "role"> & {
5
+ /**
6
+ * Accessible label announced by assistive technologies. Also rendered as visually hidden text
7
+ * so screen readers can read it independently of the `aria-label`.
8
+ */
9
+ label?: string;
10
+ /** Use `"sm"` for inline or compact contexts and `"md"` (default) for standalone loading panels. */
11
+ size?: BouncingDotsLoaderSize;
12
+ };
13
+ /**
14
+ * Renders the loader as a `role="status"` region. It fades in after a short delay, so loads that
15
+ * finish quickly never flash it. Reduced motion stops the bounce through the shared fallback.
16
+ * @param props - Label, size and native attributes.
17
+ * @returns The loader.
18
+ */
19
+ export declare function BouncingDotsLoader({ label, size, className, ...rest }: BouncingDotsLoaderProps): import("react").JSX.Element;
@@ -0,0 +1,47 @@
1
+ import { cn } from "../lib/utils.js";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ const DEFAULT_LOADING_LABEL = "Cargando...";
4
+ /** Stage, dot and shadow geometry per size; the keyframes in `keyframes.css` match these values. */
5
+ const LOADER_SIZE_CLASS_NAMES = {
6
+ md: {
7
+ stage: "h-[3.75rem] w-[12.5rem]",
8
+ dot: "size-5 animate-[beez-bouncing-dot-md_0.5s_ease_infinite_alternate]",
9
+ shadow: "top-[3.875rem] h-1 w-5"
10
+ },
11
+ sm: {
12
+ stage: "h-[1.875rem] w-[6.5rem]",
13
+ dot: "size-2.5 animate-[beez-bouncing-dot-sm_0.5s_ease_infinite_alternate]",
14
+ shadow: "top-[1.9375rem] h-[0.1875rem] w-2.5"
15
+ }
16
+ };
17
+ /** Horizontal slot and phase of each dot: the middle and right dots trail the left one. */
18
+ const DOT_POSITION_CLASS_NAMES = [
19
+ "left-[15%]",
20
+ "left-[45%] delay-200",
21
+ "right-[15%] delay-300"
22
+ ];
23
+ /**
24
+ * Renders the loader as a `role="status"` region. It fades in after a short delay, so loads that
25
+ * finish quickly never flash it. Reduced motion stops the bounce through the shared fallback.
26
+ * @param props - Label, size and native attributes.
27
+ * @returns The loader.
28
+ */
29
+ export function BouncingDotsLoader({ label = DEFAULT_LOADING_LABEL, size = "md", className, ...rest }) {
30
+ const sizeClassNames = LOADER_SIZE_CLASS_NAMES[size];
31
+ return /* @__PURE__ */ _jsxs("div", {
32
+ "data-slot": "bouncing-dots-loader",
33
+ "data-size": size,
34
+ ...rest,
35
+ "aria-label": label,
36
+ role: "status",
37
+ className: cn("flex w-full items-center justify-center animate-in fade-in fill-mode-both delay-120 duration-300", className),
38
+ children: [/* @__PURE__ */ _jsxs("div", {
39
+ "aria-hidden": "true",
40
+ className: cn("relative z-[1]", sizeClassNames.stage),
41
+ children: [DOT_POSITION_CLASS_NAMES.map((positionClassName) => /* @__PURE__ */ _jsx("span", { className: cn("absolute top-0 origin-bottom rounded-full bg-foreground", sizeClassNames.dot, positionClassName) }, `dot-${positionClassName}`)), DOT_POSITION_CLASS_NAMES.map((positionClassName) => /* @__PURE__ */ _jsx("span", { className: cn("absolute -z-[1] rounded-full bg-foreground/35 blur-[1px] animate-[beez-bouncing-dot-shadow_0.5s_ease_infinite_alternate]", sizeClassNames.shadow, positionClassName) }, `shadow-${positionClassName}`))]
42
+ }), /* @__PURE__ */ _jsx("span", {
43
+ className: "sr-only",
44
+ children: label
45
+ })]
46
+ });
47
+ }
@@ -3,6 +3,9 @@ import { c as _c } from "react/compiler-runtime";
3
3
  import * as React from "react";
4
4
  import { es } from "react-day-picker/locale";
5
5
  import { DayPicker, getDefaultClassNames } from "react-day-picker";
6
+ import { animate, frame } from "motion/react";
7
+ import { usePrefersReducedMotion } from "../hooks/use-prefers-reduced-motion.js";
8
+ import { MOTION_EASE, MOTION_MONTH_DISTANCE, MOTION_TIMING } from "../motion/tokens.js";
6
9
  import { cn } from "../lib/utils.js";
7
10
  import { Button, buttonVariants } from "./button.js";
8
11
  import { ChevronLeft, ChevronRight, ChevronDown } from "lucide-react";
@@ -173,6 +176,7 @@ function Calendar(t0) {
173
176
  Root: _temp,
174
177
  Chevron: _temp2,
175
178
  DayButton: t34,
179
+ Month: CalendarMonth,
176
180
  WeekNumber: _temp3,
177
181
  ...components
178
182
  };
@@ -247,6 +251,104 @@ function _temp(t0) {
247
251
  ...props_0
248
252
  });
249
253
  }
254
+ /**
255
+ * Renders one displayed month and slides it in from the side the user navigated from.
256
+ * DayPicker keys months by display position, so this instance survives navigation and can
257
+ * compare the new month with the previous one. The first render and reduced motion stay static.
258
+ * @param props - DayPicker month properties, including the month being displayed.
259
+ * @returns The month container with its caption and grid.
260
+ */
261
+ function CalendarMonth(t0) {
262
+ const $ = _c(13);
263
+ let calendarMonth;
264
+ let children;
265
+ let displayIndex;
266
+ let props;
267
+ if ($[0] !== t0) {
268
+ ({calendarMonth, displayIndex, children, ...props} = t0);
269
+ $[0] = t0;
270
+ $[1] = calendarMonth;
271
+ $[2] = children;
272
+ $[3] = displayIndex;
273
+ $[4] = props;
274
+ } else {
275
+ calendarMonth = $[1];
276
+ children = $[2];
277
+ displayIndex = $[3];
278
+ props = $[4];
279
+ }
280
+ const monthRef = React.useRef(null);
281
+ const monthTime = calendarMonth.date.getTime();
282
+ const previousMonthTimeRef = React.useRef(monthTime);
283
+ const reduceMotion = usePrefersReducedMotion();
284
+ let t1;
285
+ let t2;
286
+ if ($[5] !== monthTime || $[6] !== reduceMotion) {
287
+ t1 = () => {
288
+ const previousMonthTime = previousMonthTimeRef.current;
289
+ previousMonthTimeRef.current = monthTime;
290
+ const element = monthRef.current;
291
+ if (!element || reduceMotion || previousMonthTime === monthTime) {
292
+ return;
293
+ }
294
+ const isForward = monthTime > previousMonthTime;
295
+ const isRightToLeft = getComputedStyle(element).direction === "rtl";
296
+ const direction = isForward !== isRightToLeft ? 1 : -1;
297
+ const original = {
298
+ opacity: element.style.opacity,
299
+ transform: element.style.transform
300
+ };
301
+ const restore = () => {
302
+ element.style.opacity = original.opacity;
303
+ element.style.transform = original.transform;
304
+ };
305
+ const animation = animate(element, {
306
+ opacity: [0, 1],
307
+ transform: [`translateX(${direction * MOTION_MONTH_DISTANCE}px)`, "translateX(0px)"]
308
+ }, {
309
+ duration: MOTION_TIMING.monthSwap,
310
+ ease: [...MOTION_EASE]
311
+ });
312
+ let isActive = true;
313
+ animation.then(() => frame.postRender(() => {
314
+ if (isActive) {
315
+ restore();
316
+ }
317
+ }));
318
+ return () => {
319
+ isActive = false;
320
+ animation.cancel();
321
+ restore();
322
+ };
323
+ };
324
+ t2 = [monthTime, reduceMotion];
325
+ $[5] = monthTime;
326
+ $[6] = reduceMotion;
327
+ $[7] = t1;
328
+ $[8] = t2;
329
+ } else {
330
+ t1 = $[7];
331
+ t2 = $[8];
332
+ }
333
+ React.useLayoutEffect(t1, t2);
334
+ let t3;
335
+ if ($[9] !== children || $[10] !== displayIndex || $[11] !== props) {
336
+ t3 = /* @__PURE__ */ _jsx("div", {
337
+ ref: monthRef,
338
+ "data-slot": "calendar-month",
339
+ "data-display-index": displayIndex,
340
+ ...props,
341
+ children
342
+ });
343
+ $[9] = children;
344
+ $[10] = displayIndex;
345
+ $[11] = props;
346
+ $[12] = t3;
347
+ } else {
348
+ t3 = $[12];
349
+ }
350
+ return t3;
351
+ }
250
352
  function CalendarDayButton(t0) {
251
353
  const $ = _c(21);
252
354
  let className;
@@ -7,6 +7,17 @@ import { cn } from "../lib/utils.js";
7
7
  import { Button } from "./button.js";
8
8
  import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
9
9
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
+ /** Arrow keys that move to the previous and next slide along each axis. */
11
+ const CAROUSEL_KEYS = {
12
+ horizontal: {
13
+ previous: "ArrowLeft",
14
+ next: "ArrowRight"
15
+ },
16
+ vertical: {
17
+ previous: "ArrowUp",
18
+ next: "ArrowDown"
19
+ }
20
+ };
10
21
  const CarouselContext = React.createContext(null);
11
22
  function useCarousel() {
12
23
  const context = React.useContext(CarouselContext);
@@ -16,7 +27,7 @@ function useCarousel() {
16
27
  return context;
17
28
  }
18
29
  function Carousel(t0) {
19
- const $ = _c(47);
30
+ const $ = _c(48);
20
31
  let children;
21
32
  let className;
22
33
  let opts;
@@ -100,28 +111,30 @@ function Carousel(t0) {
100
111
  }
101
112
  const scrollNext = t6;
102
113
  let t7;
103
- if ($[18] !== scrollNext || $[19] !== scrollPrev) {
114
+ if ($[18] !== orientation || $[19] !== scrollNext || $[20] !== scrollPrev) {
104
115
  t7 = (event) => {
105
- if (event.key === "ArrowLeft") {
116
+ const keys = CAROUSEL_KEYS[orientation];
117
+ if (event.key === keys.previous) {
106
118
  event.preventDefault();
107
119
  scrollPrev();
108
120
  } else {
109
- if (event.key === "ArrowRight") {
121
+ if (event.key === keys.next) {
110
122
  event.preventDefault();
111
123
  scrollNext();
112
124
  }
113
125
  }
114
126
  };
115
- $[18] = scrollNext;
116
- $[19] = scrollPrev;
117
- $[20] = t7;
127
+ $[18] = orientation;
128
+ $[19] = scrollNext;
129
+ $[20] = scrollPrev;
130
+ $[21] = t7;
118
131
  } else {
119
- t7 = $[20];
132
+ t7 = $[21];
120
133
  }
121
134
  const handleKeyDown = t7;
122
135
  let t8;
123
136
  let t9;
124
- if ($[21] !== api || $[22] !== setApi) {
137
+ if ($[22] !== api || $[23] !== setApi) {
125
138
  t8 = () => {
126
139
  if (!api || !setApi) {
127
140
  return;
@@ -129,18 +142,18 @@ function Carousel(t0) {
129
142
  setApi(api);
130
143
  };
131
144
  t9 = [api, setApi];
132
- $[21] = api;
133
- $[22] = setApi;
134
- $[23] = t8;
135
- $[24] = t9;
145
+ $[22] = api;
146
+ $[23] = setApi;
147
+ $[24] = t8;
148
+ $[25] = t9;
136
149
  } else {
137
- t8 = $[23];
138
- t9 = $[24];
150
+ t8 = $[24];
151
+ t9 = $[25];
139
152
  }
140
153
  React.useEffect(t8, t9);
141
154
  let t10;
142
155
  let t11;
143
- if ($[25] !== api) {
156
+ if ($[26] !== api) {
144
157
  t10 = () => {
145
158
  if (!api) {
146
159
  return;
@@ -160,17 +173,17 @@ function Carousel(t0) {
160
173
  };
161
174
  };
162
175
  t11 = [api, onSelect];
163
- $[25] = api;
164
- $[26] = t10;
165
- $[27] = t11;
176
+ $[26] = api;
177
+ $[27] = t10;
178
+ $[28] = t11;
166
179
  } else {
167
- t10 = $[26];
168
- t11 = $[27];
180
+ t10 = $[27];
181
+ t11 = $[28];
169
182
  }
170
183
  React.useEffect(t10, t11);
171
184
  const t12 = orientation || (opts?.axis === "y" ? "vertical" : "horizontal");
172
185
  let t13;
173
- if ($[28] !== api || $[29] !== canScrollNext || $[30] !== canScrollPrev || $[31] !== carouselRef || $[32] !== opts || $[33] !== scrollNext || $[34] !== scrollPrev || $[35] !== t12) {
186
+ if ($[29] !== api || $[30] !== canScrollNext || $[31] !== canScrollPrev || $[32] !== carouselRef || $[33] !== opts || $[34] !== scrollNext || $[35] !== scrollPrev || $[36] !== t12) {
174
187
  t13 = {
175
188
  carouselRef,
176
189
  api,
@@ -181,28 +194,28 @@ function Carousel(t0) {
181
194
  canScrollPrev,
182
195
  canScrollNext
183
196
  };
184
- $[28] = api;
185
- $[29] = canScrollNext;
186
- $[30] = canScrollPrev;
187
- $[31] = carouselRef;
188
- $[32] = opts;
189
- $[33] = scrollNext;
190
- $[34] = scrollPrev;
191
- $[35] = t12;
192
- $[36] = t13;
197
+ $[29] = api;
198
+ $[30] = canScrollNext;
199
+ $[31] = canScrollPrev;
200
+ $[32] = carouselRef;
201
+ $[33] = opts;
202
+ $[34] = scrollNext;
203
+ $[35] = scrollPrev;
204
+ $[36] = t12;
205
+ $[37] = t13;
193
206
  } else {
194
- t13 = $[36];
207
+ t13 = $[37];
195
208
  }
196
209
  let t14;
197
- if ($[37] !== className) {
210
+ if ($[38] !== className) {
198
211
  t14 = cn("relative", className);
199
- $[37] = className;
200
- $[38] = t14;
212
+ $[38] = className;
213
+ $[39] = t14;
201
214
  } else {
202
- t14 = $[38];
215
+ t14 = $[39];
203
216
  }
204
217
  let t15;
205
- if ($[39] !== children || $[40] !== handleKeyDown || $[41] !== props || $[42] !== t14) {
218
+ if ($[40] !== children || $[41] !== handleKeyDown || $[42] !== props || $[43] !== t14) {
206
219
  t15 = /* @__PURE__ */ _jsx("div", {
207
220
  onKeyDownCapture: handleKeyDown,
208
221
  className: t14,
@@ -212,25 +225,25 @@ function Carousel(t0) {
212
225
  ...props,
213
226
  children
214
227
  });
215
- $[39] = children;
216
- $[40] = handleKeyDown;
217
- $[41] = props;
218
- $[42] = t14;
219
- $[43] = t15;
228
+ $[40] = children;
229
+ $[41] = handleKeyDown;
230
+ $[42] = props;
231
+ $[43] = t14;
232
+ $[44] = t15;
220
233
  } else {
221
- t15 = $[43];
234
+ t15 = $[44];
222
235
  }
223
236
  let t16;
224
- if ($[44] !== t13 || $[45] !== t15) {
237
+ if ($[45] !== t13 || $[46] !== t15) {
225
238
  t16 = /* @__PURE__ */ _jsx(CarouselContext.Provider, {
226
239
  value: t13,
227
240
  children: t15
228
241
  });
229
- $[44] = t13;
230
- $[45] = t15;
231
- $[46] = t16;
242
+ $[45] = t13;
243
+ $[46] = t15;
244
+ $[47] = t16;
232
245
  } else {
233
- t16 = $[46];
246
+ t16 = $[47];
234
247
  }
235
248
  return t16;
236
249
  }
@@ -21,7 +21,7 @@ function Checkbox(t0) {
21
21
  }
22
22
  let t1;
23
23
  if ($[3] !== className) {
24
- t1 = cn("peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input shadow-xs transition-shadow outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary", className);
24
+ t1 = cn("peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input shadow-xs transition-[color,background-color,border-color,box-shadow] outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary", className);
25
25
  $[3] = className;
26
26
  $[4] = t1;
27
27
  } else {
@@ -0,0 +1,29 @@
1
+ /** Row action menu whose destructive item asks for an inline confirmation before running. */
2
+ import { type ReactNode } from "react";
3
+ export interface ConfirmDeleteButtonLabels {
4
+ /** Dismisses the confirmation. */
5
+ cancel?: string;
6
+ /** Runs `onConfirm`. */
7
+ confirm?: string;
8
+ /** Destructive menu item that opens the confirmation. */
9
+ delete?: string;
10
+ /** Accessible name of the icon-only menu trigger. */
11
+ menu?: string;
12
+ }
13
+ export interface ConfirmDeleteButtonProps {
14
+ /** Question shown in the confirmation, also used as its accessible name. */
15
+ message: string;
16
+ onConfirm: () => void;
17
+ /** Extra menu items (for example Edit), rendered before the delete item. */
18
+ extraMenuItems?: ReactNode;
19
+ labels?: ConfirmDeleteButtonLabels;
20
+ className?: string;
21
+ }
22
+ /**
23
+ * Renders an icon menu with a destructive item. Choosing it opens a confirmation anchored to
24
+ * the trigger; only its confirm button runs `onConfirm`. Escape, an outside click or Cancel
25
+ * dismiss it without side effects.
26
+ * @param props - Confirmation copy, callback, extra items and optional labels.
27
+ * @returns The menu trigger with its confirmation.
28
+ */
29
+ export declare function ConfirmDeleteButton({ message, onConfirm, extraMenuItems, labels, className, }: ConfirmDeleteButtonProps): import("react").JSX.Element;