beez-ui 2.7.1 → 3.0.1

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 (110) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/README.md +43 -13
  3. package/THIRD_PARTY_NOTICES.md +1 -1
  4. package/dist/components/account-menu.d.ts +4 -3
  5. package/dist/components/account-menu.js +63 -54
  6. package/dist/components/alert.d.ts +15 -15
  7. package/dist/components/alert.js +289 -270
  8. package/dist/components/animated-theme-toggler.js +1 -1
  9. package/dist/components/avatar.d.ts +56 -31
  10. package/dist/components/avatar.js +394 -277
  11. package/dist/components/badge.d.ts +8 -28
  12. package/dist/components/badge.js +55 -108
  13. package/dist/components/calendar.d.ts +36 -26
  14. package/dist/components/calendar.js +132 -1227
  15. package/dist/components/card.d.ts +36 -25
  16. package/dist/components/card.js +895 -72
  17. package/dist/components/carousel.d.ts +63 -47
  18. package/dist/components/carousel.js +496 -777
  19. package/dist/components/data-table.d.ts +5 -4
  20. package/dist/components/data-table.js +7 -6
  21. package/dist/components/dialog-surface.d.ts +23 -1
  22. package/dist/components/dialog-surface.js +99 -3
  23. package/dist/components/dialog.d.ts +80 -45
  24. package/dist/components/dialog.js +258 -503
  25. package/dist/components/dropdown-menu.d.ts +56 -73
  26. package/dist/components/dropdown-menu.js +79 -714
  27. package/dist/components/field.d.ts +3 -1
  28. package/dist/components/field.js +49 -39
  29. package/dist/components/filter-presets-bar.js +2 -2
  30. package/dist/components/filter-query-bar.js +1 -1
  31. package/dist/components/hover-card.d.ts +42 -41
  32. package/dist/components/hover-card.js +57 -483
  33. package/dist/components/pagination.d.ts +53 -31
  34. package/dist/components/pagination.js +176 -412
  35. package/dist/components/popover.d.ts +11 -23
  36. package/dist/components/popover.js +19 -304
  37. package/dist/components/{alert-dialog.d.ts → primitives/alert-dialog.d.ts} +17 -5
  38. package/dist/components/{alert-dialog.js → primitives/alert-dialog.js} +102 -54
  39. package/dist/components/primitives/avatar.d.ts +46 -0
  40. package/dist/components/primitives/avatar.js +268 -0
  41. package/dist/components/primitives/calendar.d.ts +37 -0
  42. package/dist/components/primitives/calendar.js +1250 -0
  43. package/dist/components/primitives/carousel.d.ts +106 -0
  44. package/dist/components/primitives/carousel.js +928 -0
  45. package/dist/components/primitives/dialog.d.ts +62 -0
  46. package/dist/components/primitives/dialog.js +490 -0
  47. package/dist/components/primitives/dropdown-menu-items.d.ts +59 -0
  48. package/dist/components/primitives/dropdown-menu-items.js +265 -0
  49. package/dist/components/primitives/dropdown-menu.d.ts +64 -0
  50. package/dist/components/primitives/dropdown-menu.js +557 -0
  51. package/dist/components/primitives/hover-card.d.ts +50 -0
  52. package/dist/components/primitives/hover-card.js +507 -0
  53. package/dist/components/primitives/pagination.d.ts +65 -0
  54. package/dist/components/primitives/pagination.js +373 -0
  55. package/dist/components/primitives/popover.d.ts +22 -0
  56. package/dist/components/primitives/popover.js +213 -0
  57. package/dist/components/primitives/select.d.ts +36 -0
  58. package/dist/components/primitives/select.js +407 -0
  59. package/dist/components/primitives/tooltip.d.ts +30 -0
  60. package/dist/components/primitives/tooltip.js +277 -0
  61. package/dist/components/radio-group.d.ts +30 -17
  62. package/dist/components/radio-group.js +266 -315
  63. package/dist/components/rich-link-editor.js +1 -1
  64. package/dist/components/select.d.ts +51 -42
  65. package/dist/components/select.js +163 -495
  66. package/dist/components/skeleton.d.ts +16 -15
  67. package/dist/components/skeleton.js +99 -205
  68. package/dist/components/split-button.js +1 -1
  69. package/dist/components/switch.d.ts +3 -6
  70. package/dist/components/switch.js +163 -170
  71. package/dist/components/tabs.d.ts +3 -11
  72. package/dist/components/tabs.js +61 -75
  73. package/dist/components/themed-toaster.d.ts +1 -1
  74. package/dist/components/themed-toaster.js +1 -1
  75. package/dist/components/toaster.d.ts +1 -1
  76. package/dist/components/toaster.js +1 -1
  77. package/dist/components/tooltip.d.ts +36 -31
  78. package/dist/components/tooltip.js +44 -284
  79. package/dist/constants/alert.d.ts +5 -1
  80. package/dist/constants/alert.js +5 -1
  81. package/dist/constants/avatar.d.ts +29 -1
  82. package/dist/constants/avatar.js +25 -0
  83. package/dist/constants/calendar.d.ts +12 -0
  84. package/dist/constants/calendar.js +12 -0
  85. package/dist/constants/card.d.ts +23 -0
  86. package/dist/constants/card.js +20 -0
  87. package/dist/constants/carousel.d.ts +31 -13
  88. package/dist/constants/carousel.js +32 -11
  89. package/dist/constants/dialog.d.ts +6 -1
  90. package/dist/constants/dialog.js +5 -1
  91. package/dist/constants/dropdown-menu.d.ts +2 -2
  92. package/dist/constants/dropdown-menu.js +2 -2
  93. package/dist/constants/pagination.d.ts +13 -2
  94. package/dist/constants/pagination.js +13 -2
  95. package/dist/constants/select.d.ts +4 -2
  96. package/dist/constants/select.js +4 -2
  97. package/dist/constants/switch.d.ts +5 -16
  98. package/dist/constants/switch.js +6 -14
  99. package/dist/hooks/use-today.d.ts +7 -0
  100. package/dist/hooks/use-today.js +50 -0
  101. package/dist/hooks.d.ts +1 -0
  102. package/dist/hooks.js +1 -0
  103. package/dist/index.d.ts +0 -1
  104. package/dist/index.js +0 -1
  105. package/dist/motion/glide-indicator.d.ts +1 -1
  106. package/dist/motion/glide-indicator.js +1 -1
  107. package/dist/motion/presence.d.ts +0 -1
  108. package/dist/motion/presence.js +0 -1
  109. package/dist/styles.css +1 -1
  110. package/package.json +1 -6
@@ -38,6 +38,8 @@ export declare function useFieldAria({ id, description, error, ...aria }: FieldA
38
38
  export declare function usesFieldCopy(props: FieldCopyProps): boolean;
39
39
  type FieldProps = Omit<FieldCopyProps, "label"> & {
40
40
  label?: string;
41
+ /** Keeps the label for assistive technology only, for layouts that already show their own label. */
42
+ hideLabel?: boolean;
41
43
  aria: FieldAria;
42
44
  className?: string;
43
45
  children: ReactNode;
@@ -47,5 +49,5 @@ type FieldProps = Omit<FieldCopyProps, "label"> & {
47
49
  * a negative margin at zero and a closed row would still pay it; each row carries its own space instead. The wrapper
48
50
  * keeps the bare control's full-width contract, so a field fills a flex row like the control alone does.
49
51
  */
50
- export declare function Field({ label, description, error, aria, className, children }: FieldProps): import("react").JSX.Element;
52
+ export declare function Field({ label, hideLabel, description, error, aria, className, children }: FieldProps): import("react").JSX.Element;
51
53
  export {};
@@ -31,6 +31,14 @@ const digitVariants = {
31
31
  };
32
32
  const instantTransition = { duration: 0 };
33
33
  /**
34
+ * Arc `spring.snappy` without its bounce: a rolled digit must land on its line, since even the small overshoot of the
35
+ * bouncy preset pushes it past rest toward the side it came from.
36
+ */
37
+ const digitRollSpring = {
38
+ ...ARC_SPRING_SNAPPY,
39
+ bounce: 0
40
+ };
41
+ /**
34
42
  * Reads one component of a count as a number, in English or Spanish formatting: grouping separators are dropped and
35
43
  * a decimal comma becomes a point.
36
44
  * @param component - A count, or one side of a time or ratio.
@@ -109,7 +117,7 @@ function RollingNumber(t0) {
109
117
  let t4;
110
118
  if ($[8] !== reduceMotion) {
111
119
  t4 = reduceMotion ? instantTransition : {
112
- y: ARC_SPRING_SNAPPY,
120
+ y: digitRollSpring,
113
121
  width: ARC_SPRING_MORPH,
114
122
  opacity: { duration: ARC_DURATION.fast },
115
123
  filter: { duration: ARC_DURATION.fast }
@@ -624,77 +632,79 @@ export function usesFieldCopy(props) {
624
632
  * keeps the bare control's full-width contract, so a field fills a flex row like the control alone does.
625
633
  */
626
634
  export function Field(t0) {
627
- const $ = _c(17);
628
- const { label, description, error, aria, className, children } = t0;
629
- let t1;
635
+ const $ = _c(18);
636
+ const { label, hideLabel: t1, description, error, aria, className, children } = t0;
637
+ const hideLabel = t1 === undefined ? false : t1;
638
+ let t2;
630
639
  if ($[0] !== className) {
631
- t1 = cn("grid w-full min-w-0", className);
640
+ t2 = cn("grid w-full min-w-0", className);
632
641
  $[0] = className;
633
- $[1] = t1;
642
+ $[1] = t2;
634
643
  } else {
635
- t1 = $[1];
644
+ t2 = $[1];
636
645
  }
637
- let t2;
638
- if ($[2] !== aria.controlId || $[3] !== label) {
639
- t2 = label ? /* @__PURE__ */ _jsx("label", {
646
+ let t3;
647
+ if ($[2] !== aria.controlId || $[3] !== hideLabel || $[4] !== label) {
648
+ t3 = label ? /* @__PURE__ */ _jsx("label", {
640
649
  "data-slot": "field-label",
641
650
  htmlFor: aria.controlId,
642
- className: "mb-(--space-2) text-sm leading-(--leading-body) font-medium text-foreground",
651
+ className: hideLabel ? "sr-only" : "mb-(--space-2) text-sm leading-(--leading-body) font-medium text-foreground",
643
652
  children: label
644
653
  }) : null;
645
654
  $[2] = aria.controlId;
646
- $[3] = label;
647
- $[4] = t2;
655
+ $[3] = hideLabel;
656
+ $[4] = label;
657
+ $[5] = t3;
648
658
  } else {
649
- t2 = $[4];
659
+ t3 = $[5];
650
660
  }
651
- let t3;
652
- if ($[5] !== aria.descriptionId || $[6] !== description) {
653
- t3 = /* @__PURE__ */ _jsx(FieldMessage, {
661
+ let t4;
662
+ if ($[6] !== aria.descriptionId || $[7] !== description) {
663
+ t4 = /* @__PURE__ */ _jsx(FieldMessage, {
654
664
  id: aria.descriptionId,
655
665
  text: description,
656
666
  className: "text-text-muted"
657
667
  });
658
- $[5] = aria.descriptionId;
659
- $[6] = description;
660
- $[7] = t3;
668
+ $[6] = aria.descriptionId;
669
+ $[7] = description;
670
+ $[8] = t4;
661
671
  } else {
662
- t3 = $[7];
672
+ t4 = $[8];
663
673
  }
664
- let t4;
665
- if ($[8] !== aria.errorId || $[9] !== error) {
666
- t4 = /* @__PURE__ */ _jsx(FieldMessage, {
674
+ let t5;
675
+ if ($[9] !== aria.errorId || $[10] !== error) {
676
+ t5 = /* @__PURE__ */ _jsx(FieldMessage, {
667
677
  id: aria.errorId,
668
678
  text: error,
669
679
  className: "text-danger",
670
680
  alert: true
671
681
  });
672
- $[8] = aria.errorId;
673
- $[9] = error;
674
- $[10] = t4;
682
+ $[9] = aria.errorId;
683
+ $[10] = error;
684
+ $[11] = t5;
675
685
  } else {
676
- t4 = $[10];
686
+ t5 = $[11];
677
687
  }
678
- let t5;
679
- if ($[11] !== children || $[12] !== t1 || $[13] !== t2 || $[14] !== t3 || $[15] !== t4) {
680
- t5 = /* @__PURE__ */ _jsxs("div", {
688
+ let t6;
689
+ if ($[12] !== children || $[13] !== t2 || $[14] !== t3 || $[15] !== t4 || $[16] !== t5) {
690
+ t6 = /* @__PURE__ */ _jsxs("div", {
681
691
  "data-slot": "field",
682
- className: t1,
692
+ className: t2,
683
693
  children: [
684
- t2,
685
- children,
686
694
  t3,
687
- t4
695
+ children,
696
+ t4,
697
+ t5
688
698
  ]
689
699
  });
690
- $[11] = children;
691
- $[12] = t1;
700
+ $[12] = children;
692
701
  $[13] = t2;
693
702
  $[14] = t3;
694
703
  $[15] = t4;
695
704
  $[16] = t5;
705
+ $[17] = t6;
696
706
  } else {
697
- t5 = $[16];
707
+ t6 = $[17];
698
708
  }
699
- return t5;
709
+ return t6;
700
710
  }
@@ -11,8 +11,8 @@ import { ControlButton } from "./control-button.js";
11
11
  import { FilterQueryBar } from "./filter-query-bar.js";
12
12
  import { Input } from "./input.js";
13
13
  import { Label } from "./label.js";
14
- import { Popover, PopoverContent, PopoverTrigger } from "./popover.js";
15
- import { Tooltip, TooltipContent, TooltipTrigger } from "./tooltip.js";
14
+ import { Popover, PopoverContent, PopoverTrigger } from "./primitives/popover.js";
15
+ import { Tooltip, TooltipContent, TooltipTrigger } from "./primitives/tooltip.js";
16
16
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
17
  const ENTER_KEY = "Enter";
18
18
  /** Suggestions of the query editor render in their own popover, outside the edit popover. */
@@ -4,7 +4,7 @@ import * as React from "react";
4
4
  import { Calendar, Check, CircleDot, CircleMinus, CircleSlash, Folder, Hash, List, Type, User, X } from "lucide-react";
5
5
  import { ControlButton } from "./control-button.js";
6
6
  import { Input } from "./input.js";
7
- import { Popover, PopoverAnchor, PopoverContent } from "./popover.js";
7
+ import { Popover, PopoverAnchor, PopoverContent } from "./primitives/popover.js";
8
8
  import { GlideSlot } from "../motion/glide-slot.js";
9
9
  import { cn } from "../lib/utils.js";
10
10
  import { getActiveFilterToken, getValueHighlightRanges, normalizeFilterSlug, parseFilterQuery, PRESENCE_HAS_META_KEY, PRESENCE_NO_META_KEY, UNASSIGNED_FOLDER_FILTER_VALUE } from "./filter-query-grammar.js";
@@ -2,48 +2,49 @@
2
2
  * Arc's Hover Card (https://uiarc.dev, MIT License, see THIRD_PARTY_NOTICES.md): a read-only preview of a person or
3
3
  * link that opens after half a second of hover or on keyboard focus, grows from the trigger edge on a smooth spring
4
4
  * and closes fast on leave. While a card is open, and briefly after it closes, moving to another trigger opens its
5
- * card almost at once and only fades. It keeps the Radix composition and adds Arc's `HoverCardProfile` preset.
5
+ * card almost at once and only fades. It follows Arc's closed API, `<HoverCard content={...}>` around its trigger,
6
+ * with Arc's `HoverCardProfile` preset and open state and placement extensions.
6
7
  */
7
- import * as React from "react";
8
- import { HoverCard as HoverCardPrimitive } from "radix-ui";
9
- /**
10
- * Owns the open state and timing of one hover card.
11
- * @param props - Radix root properties. `openDelay` defaults to Arc's 500ms and `closeDelay` to 140ms; within the
12
- * skip window the card waits at most 80ms.
13
- * @returns The hover card root.
14
- */
15
- declare function HoverCard({ openDelay, closeDelay, ...props }: React.ComponentProps<typeof HoverCardPrimitive.Root>): React.JSX.Element;
16
- declare function HoverCardTrigger({ ...props }: React.ComponentProps<typeof HoverCardPrimitive.Trigger>): React.JSX.Element;
17
- /**
18
- * Renders Arc's card: raised surface, hairline border, panel radius and floating shadow, 18.5rem wide at most.
19
- * @param props - Radix content properties. `align` defaults to `center`, `sideOffset` to 8px and `collisionPadding`
20
- * to 12px.
21
- * @returns The portaled card.
22
- */
23
- declare function HoverCardContent({ className, align, sideOffset, collisionPadding, ...props }: React.ComponentProps<typeof HoverCardPrimitive.Content>): React.JSX.Element;
24
- /** One number of `HoverCardProfile`, such as followers or projects. */
25
- export interface HoverCardStat {
26
- label: string;
27
- value: string | number;
28
- }
29
- /** A person preview for `HoverCardContent`. */
30
- export interface HoverCardProfileProps {
31
- name: string;
32
- /** Role and team, such as "Diseñadora de producto, Pagos". */
33
- role?: string;
34
- /** A portrait URL, or your own image element such as an `Image` adapter. Initials show when it is missing. */
35
- avatar?: string | React.ReactNode;
36
- bio?: string;
37
- stats?: HoverCardStat[];
38
- /** A footer line, such as a location and local time. */
39
- meta?: React.ReactNode;
8
+ import type { ReactElement, ReactNode } from "react";
9
+ import { HoverCardProfile, type HoverCardProfileProps, type HoverCardStat } from "./primitives/hover-card.js";
10
+ /** Side of the trigger a hover card prefers. */
11
+ export type HoverCardSide = "top" | "bottom" | "left" | "right";
12
+ /** Alignment of the card against its trigger. */
13
+ export type HoverCardAlign = "start" | "center" | "end";
14
+ export type HoverCardProps = {
15
+ /** The trigger, such as a mention button or link. Rendered with `asChild`, so it must accept a ref and be focusable. */
16
+ children: ReactElement;
17
+ /** The preview. `HoverCardProfile` covers people. Keep it read only: focus never moves into the card. */
18
+ content: ReactNode;
19
+ /** Preferred side of the trigger. Defaults to `bottom`. */
20
+ side?: HoverCardSide;
21
+ /** Alignment against the trigger. Defaults to `start`. */
22
+ align?: HoverCardAlign;
23
+ /** Milliseconds of hover before the first card opens. Defaults to 500. */
24
+ openDelay?: number;
25
+ /** Grace, in milliseconds, after the pointer leaves. Defaults to 140. */
26
+ closeDelay?: number;
27
+ /** Class on the card surface. */
40
28
  className?: string;
41
- }
29
+ /** Class on the card surface, merged after `className`. */
30
+ contentClassName?: string;
31
+ /** Gap, in px, between the card and its trigger. Defaults to 8. */
32
+ sideOffset?: number;
33
+ /** Distance, in px, the card keeps from the viewport edges. Defaults to 12. */
34
+ collisionPadding?: number;
35
+ /** Controlled open state. */
36
+ open?: boolean;
37
+ /** Initial open state when uncontrolled. */
38
+ defaultOpen?: boolean;
39
+ /** Called when the card opens or closes, for example to load its data on open. */
40
+ onOpenChange?: (open: boolean) => void;
41
+ };
42
42
  /**
43
- * Arc's person preview: portrait, name, role, a short bio, a couple of numbers and a quiet footer line. Its rows
44
- * settle in with a tiny stagger, and stay still when the user prefers reduced motion.
45
- * @param props - The person's details.
46
- * @returns The profile, meant as the child of `HoverCardContent`.
43
+ * A read-only preview that opens after a short hover or keyboard focus and stays open while the pointer travels into
44
+ * it.
45
+ * @param props - The trigger, the preview and optional timing, placement and open state.
46
+ * @returns The trigger with its hover card.
47
47
  */
48
- declare function HoverCardProfile({ name, role, avatar, bio, stats, meta, className }: HoverCardProfileProps): React.JSX.Element;
49
- export { HoverCard, HoverCardTrigger, HoverCardContent, HoverCardProfile };
48
+ declare function HoverCard({ children, content, side, align, openDelay, closeDelay, className, contentClassName, sideOffset, collisionPadding, open, defaultOpen, onOpenChange, }: HoverCardProps): import("react").JSX.Element;
49
+ export { HoverCard, HoverCardProfile };
50
+ export type { HoverCardProfileProps, HoverCardStat };