@coderabbitai/carrot-ui 0.1.21 → 0.1.22

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.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Accordion as Accordion_2 } from '@base-ui/react/accordion';
2
2
  import { AlertDialog as AlertDialog_2 } from '@base-ui/react/alert-dialog';
3
+ import { AlertDialogDescriptionProps as AlertDialogDescriptionProps_2 } from '@base-ui/react';
3
4
  import { Button as Button_2 } from '@base-ui/react/button';
4
5
  import { Checkbox as Checkbox_2 } from '@base-ui/react/checkbox';
5
6
  import { ClassValue } from 'clsx';
@@ -150,29 +151,18 @@ export declare interface AppHeaderActionsProps {
150
151
  className?: string;
151
152
  }
152
153
 
154
+ /**
155
+ * AppHeader breadcrumb — renders a Logo link followed by breadcrumb segments.
156
+ *
157
+ * Delegates to the standalone Breadcrumb component for the segment rendering.
158
+ * The Logo + first separator is AppHeader-specific.
159
+ */
153
160
  declare function AppHeaderBreadcrumb({ items, linkComponent: LinkEl, className, }: AppHeaderBreadcrumbProps): JSX.Element;
154
161
 
155
- declare interface AppHeaderBreadcrumbItem {
156
- label: string;
157
- icon?: ReactNode;
158
- href?: string;
159
- selector?: boolean;
160
- options?: AppHeaderBreadcrumbOption[];
161
- onSelect?: (value: string) => void;
162
- value?: string;
163
- }
164
-
165
- declare interface AppHeaderBreadcrumbOption {
166
- value: string;
167
- label: string;
168
- icon?: ReactNode;
169
- [key: string]: unknown;
170
- }
171
-
172
162
  export declare interface AppHeaderBreadcrumbProps {
173
- items: AppHeaderBreadcrumbItem[];
163
+ items: BreadcrumbItem[];
174
164
  /** Custom link component (e.g. TanStack Router's Link, Next.js Link, etc.). Defaults to <a>. */
175
- linkComponent?: LinkComponent;
165
+ linkComponent?: LinkComponent_2;
176
166
  className?: string;
177
167
  }
178
168
 
@@ -239,6 +229,60 @@ export declare type BadgeSize = keyof typeof sizeStyles_5;
239
229
 
240
230
  export declare type BadgeVariant = keyof typeof variantStyles_2;
241
231
 
232
+ /**
233
+ * Breadcrumb navigation with support for links, selectors, and icons.
234
+ *
235
+ * Each segment can be:
236
+ * - **Static text** — plain label (last segment, current page)
237
+ * - **Link** — clickable label that navigates to a parent page
238
+ * - **Selector** — label + chevron dropdown to switch between siblings
239
+ * (e.g. switch repos). The label can also be a link independently.
240
+ *
241
+ * Usage:
242
+ * ```tsx
243
+ * <Breadcrumb
244
+ * items={[
245
+ * { label: "Repositories", href: "/repositories" },
246
+ * { label: "landing", href: "/repos/landing", selector: true, options: repos, value: "landing" },
247
+ * { label: "Settings" },
248
+ * ]}
249
+ * />
250
+ * ```
251
+ */
252
+ export declare function Breadcrumb({ items, linkComponent: LinkEl, className, }: BreadcrumbProps): JSX.Element;
253
+
254
+ export declare interface BreadcrumbItem {
255
+ /** Display label for this segment */
256
+ readonly label: string;
257
+ /** Optional icon rendered before the label */
258
+ readonly icon?: ReactNode;
259
+ /** Link URL — makes the label a clickable link */
260
+ readonly href?: string;
261
+ /** Enable a dropdown selector (ChevronUpDown trigger) */
262
+ readonly selector?: boolean;
263
+ /** Options for the selector dropdown */
264
+ readonly options?: BreadcrumbOption[];
265
+ /** Callback when a selector option is chosen */
266
+ readonly onSelect?: (value: string) => void;
267
+ /** Currently selected value for the selector */
268
+ readonly value?: string;
269
+ }
270
+
271
+ export declare interface BreadcrumbOption {
272
+ readonly value: string;
273
+ readonly label: string;
274
+ readonly icon?: ReactNode;
275
+ readonly [key: string]: unknown;
276
+ }
277
+
278
+ export declare interface BreadcrumbProps {
279
+ /** Breadcrumb segments */
280
+ readonly items: BreadcrumbItem[];
281
+ /** Custom link component (e.g. TanStack Router's Link, Next.js Link). Defaults to <a>. */
282
+ readonly linkComponent?: LinkComponent;
283
+ readonly className?: string;
284
+ }
285
+
242
286
  /**
243
287
  * Button component built on Base UI with Tailwind CSS styling.
244
288
  *
@@ -415,6 +459,28 @@ export declare interface ComboboxContentProps {
415
459
  className?: string;
416
460
  }
417
461
 
462
+ /**
463
+ * Groups related combobox items with an optional label.
464
+ * Wraps Base UI's Combobox.Group.
465
+ */
466
+ export declare const ComboboxGroup: ForwardRefExoticComponent<ComboboxGroupProps & RefAttributes<HTMLDivElement>>;
467
+
468
+ /**
469
+ * Accessible label automatically associated with its parent group.
470
+ * Renders via Menu.GroupLabel for consistent styling.
471
+ */
472
+ export declare const ComboboxGroupLabel: ForwardRefExoticComponent<ComboboxGroupLabelProps & RefAttributes<HTMLDivElement>>;
473
+
474
+ export declare interface ComboboxGroupLabelProps {
475
+ readonly className?: string;
476
+ readonly children: ReactNode;
477
+ }
478
+
479
+ export declare interface ComboboxGroupProps {
480
+ readonly className?: string;
481
+ readonly children: ReactNode;
482
+ }
483
+
418
484
  export declare interface ComboboxItem {
419
485
  readonly value: string;
420
486
  readonly label: string;
@@ -450,6 +516,16 @@ export declare interface ComboboxProps {
450
516
  readonly className?: string;
451
517
  }
452
518
 
519
+ /**
520
+ * Visual separator between combobox groups.
521
+ * Renders via Menu.Separator for consistent styling.
522
+ */
523
+ export declare const ComboboxSeparator: ForwardRefExoticComponent<ComboboxSeparatorProps & RefAttributes<HTMLDivElement>>;
524
+
525
+ export declare interface ComboboxSeparatorProps {
526
+ readonly className?: string;
527
+ }
528
+
453
529
  /**
454
530
  * Fully composable trigger. Renders whatever children you give it as the
455
531
  * element that opens the combobox popup.
@@ -666,10 +742,11 @@ export declare const Dialog: {
666
742
  Content: typeof DialogContent;
667
743
  Panel: ForwardRefExoticComponent<DialogPanelProps & RefAttributes<HTMLDivElement>>;
668
744
  Title: ForwardRefExoticComponent<Omit<DialogTitleProps, "ref"> & RefAttributes<HTMLHeadingElement>>;
745
+ /** @deprecated Use a plain `<p>` inside Dialog.Body instead. */
746
+ Description: ForwardRefExoticComponent<Omit<AlertDialogDescriptionProps_2, "ref"> & RefAttributes<HTMLParagraphElement>>;
669
747
  Body: ForwardRefExoticComponent<DialogBodyProps & RefAttributes<HTMLDivElement>>;
670
748
  Footer: ForwardRefExoticComponent<DialogFooterProps & RefAttributes<HTMLDivElement>>;
671
749
  Close: ForwardRefExoticComponent<Omit<DialogCloseProps, "ref"> & RefAttributes<HTMLButtonElement>>;
672
- Description: ForwardRefExoticComponent<Omit<DialogDescriptionProps, "ref"> & RefAttributes<HTMLParagraphElement>>;
673
750
  };
674
751
 
675
752
  export declare interface DialogBackdropProps extends ComponentProps<typeof Dialog_2.Backdrop> {
@@ -689,9 +766,6 @@ export declare interface DialogContentProps extends ComponentProps<typeof Dialog
689
766
  size?: DialogSize;
690
767
  }
691
768
 
692
- export declare interface DialogDescriptionProps extends ComponentProps<typeof Dialog_2.Description> {
693
- }
694
-
695
769
  export declare interface DialogFooterProps {
696
770
  className?: string;
697
771
  children: ReactNode;
@@ -956,7 +1030,7 @@ export declare interface FormTextareaProps extends ComponentProps<typeof Field.C
956
1030
  * When `active`, renders its own static background with the press inset
957
1031
  * effect (same as standalone active state). The group pill handles hover.
958
1032
  */
959
- export declare function Hover({ children, active, background, backgroundClassName, borderRadius, focus, interactive, instantHover, disabled, fullWidth, className, }: HoverProps): JSX.Element;
1033
+ export declare function Hover({ children, active, background, backgroundClassName, borderRadius, focus, interactive, instantHover, disabled, fullWidth, className, ...rest }: HoverProps): JSX.Element;
960
1034
 
961
1035
  export declare function HoverGroup({ children, background, borderRadius, className, }: HoverGroupProps): JSX.Element;
962
1036
 
@@ -969,7 +1043,7 @@ export declare interface HoverGroupProps {
969
1043
  className?: string;
970
1044
  }
971
1045
 
972
- export declare interface HoverProps {
1046
+ export declare interface HoverProps extends Omit<ComponentProps<"div">, "children"> {
973
1047
  children: ReactNode;
974
1048
  /** Force the hover background visible (e.g. active/selected state) */
975
1049
  active?: boolean;
@@ -990,7 +1064,6 @@ export declare interface HoverProps {
990
1064
  disabled?: boolean;
991
1065
  /** Stretch to full width */
992
1066
  fullWidth?: boolean;
993
- className?: string;
994
1067
  }
995
1068
 
996
1069
  declare type LinkComponent = ComponentType<{
@@ -1000,6 +1073,13 @@ declare type LinkComponent = ComponentType<{
1000
1073
  children?: ReactNode;
1001
1074
  }>;
1002
1075
 
1076
+ declare type LinkComponent_2 = ComponentType<{
1077
+ to?: string;
1078
+ href?: string;
1079
+ className?: string;
1080
+ children?: ReactNode;
1081
+ }>;
1082
+
1003
1083
  /**
1004
1084
  * CodeRabbit logo mark.
1005
1085
  */
@@ -1059,23 +1139,9 @@ export declare interface NavLinksProps {
1059
1139
  * Full-page layout shell with a sidebar and content area.
1060
1140
  *
1061
1141
  * Structure: sidebar (fixed width) + content panel (flex-1).
1142
+ * The content panel renders as a rounded card on bg-cui-base-0.
1062
1143
  */
1063
1144
  export declare const PageLayout: ForwardRefExoticComponent<PageLayoutProps & RefAttributes<HTMLDivElement>> & {
1064
- Sidebar: (({ defaultCollapsed, className, children, }: SidebarRootProps) => JSX.Element) & {
1065
- Header: ForwardRefExoticComponent<Omit<SidebarHeaderProps, "ref"> & RefAttributes<HTMLDivElement>>;
1066
- CollapseButton: ({ className }: SidebarCollapseButtonProps) => JSX.Element | null;
1067
- BackButton: ({ onClick, className, children, }: SidebarBackButtonProps) => JSX.Element;
1068
- Label: ForwardRefExoticComponent<Omit<SidebarLabelProps, "ref"> & RefAttributes<HTMLSpanElement>>;
1069
- Search: ({ label, icon, onClick, className, }: SidebarSearchProps) => JSX.Element;
1070
- Nav: ({ className, children }: SidebarNavProps) => JSX.Element;
1071
- NavItem: ({ active, nested, icon, href, onClick, className, children, }: SidebarNavItemProps) => JSX.Element;
1072
- Footer: ForwardRefExoticComponent<Omit<SidebarFooterProps, "ref"> & RefAttributes<HTMLDivElement>>;
1073
- };
1074
- SidebarHeader: ForwardRefExoticComponent<Omit<SidebarHeaderProps, "ref"> & RefAttributes<HTMLDivElement>>;
1075
- SidebarSearch: ({ label, icon, onClick, className, }: SidebarSearchProps) => JSX.Element;
1076
- SidebarNav: ({ className, children }: SidebarNavProps) => JSX.Element;
1077
- SidebarNavItem: ({ active, nested, icon, href, onClick, className, children, }: SidebarNavItemProps) => JSX.Element;
1078
- SidebarFooter: ForwardRefExoticComponent<Omit<SidebarFooterProps, "ref"> & RefAttributes<HTMLDivElement>>;
1079
1145
  Header: ForwardRefExoticComponent<Omit<PageLayoutHeaderProps, "ref"> & RefAttributes<HTMLDivElement>>;
1080
1146
  Body: ForwardRefExoticComponent<Omit<PageLayoutBodyProps, "ref"> & RefAttributes<HTMLDivElement>>;
1081
1147
  };
@@ -1087,7 +1153,7 @@ export declare interface PageLayoutHeaderProps extends ComponentProps<"div"> {
1087
1153
  }
1088
1154
 
1089
1155
  export declare interface PageLayoutProps {
1090
- /** Sidebar content (typically PageLayout.Sidebar) */
1156
+ /** Sidebar content */
1091
1157
  readonly sidebar?: ReactNode;
1092
1158
  readonly className?: string;
1093
1159
  readonly children: ReactNode;
@@ -1501,95 +1567,146 @@ export declare interface SettingsRowProps {
1501
1567
  }
1502
1568
 
1503
1569
  export declare const Sidebar: typeof SidebarRoot & {
1504
- Header: ForwardRefExoticComponent<Omit<SidebarHeaderProps, "ref"> & RefAttributes<HTMLDivElement>>;
1570
+ Section: typeof SidebarSection;
1571
+ Header: typeof SidebarHeader;
1572
+ Label: ForwardRefExoticComponent<Omit<SidebarLabelProps, "ref"> & RefAttributes<HTMLDivElement>>;
1573
+ Link: typeof SidebarLink;
1574
+ BackLink: typeof SidebarBackLink;
1505
1575
  CollapseButton: typeof SidebarCollapseButton;
1506
- BackButton: typeof SidebarBackButton;
1507
- Label: ForwardRefExoticComponent<Omit<SidebarLabelProps, "ref"> & RefAttributes<HTMLSpanElement>>;
1508
- Search: typeof SidebarSearch;
1509
- Nav: typeof SidebarNav;
1510
- NavItem: typeof SidebarNavItem;
1511
- Footer: ForwardRefExoticComponent<Omit<SidebarFooterProps, "ref"> & RefAttributes<HTMLDivElement>>;
1576
+ Layers: typeof SidebarLayers;
1512
1577
  };
1513
1578
 
1514
- /**
1515
- * Back navigation row for nested sidebar contexts.
1516
- * Replaces the org switcher header when drilling into a sub-section.
1517
- * Shows ArrowLeftIcon + section title when expanded, just the arrow when collapsed.
1518
- */
1519
- declare function SidebarBackButton({ onClick, className, children, }: SidebarBackButtonProps): JSX.Element;
1579
+ declare function SidebarBackLink({ name, onClick, className }: SidebarBackLinkProps): JSX.Element;
1520
1580
 
1521
- export declare interface SidebarBackButtonProps {
1522
- /** Click handler — typically navigates back to the parent route */
1581
+ export declare interface SidebarBackLinkProps {
1582
+ /** Display name */
1583
+ readonly name: string;
1584
+ /** Click handler */
1523
1585
  readonly onClick?: () => void;
1524
1586
  readonly className?: string;
1525
- /** Section title displayed next to the back arrow */
1526
- readonly children: ReactNode;
1527
1587
  }
1528
1588
 
1529
- /**
1530
- * Toggle button for collapsing/expanding the sidebar.
1531
- * Chevron direction flips based on collapsed state.
1532
- */
1533
- declare function SidebarCollapseButton({ className }: SidebarCollapseButtonProps): JSX.Element | null;
1589
+ declare function SidebarCollapseButton({ className }: SidebarCollapseButtonProps): JSX.Element;
1534
1590
 
1535
1591
  export declare interface SidebarCollapseButtonProps {
1536
1592
  readonly className?: string;
1537
1593
  }
1538
1594
 
1539
- export declare interface SidebarContextValue {
1595
+ declare interface SidebarContextValue {
1540
1596
  readonly collapsed: boolean;
1541
1597
  readonly toggle: () => void;
1542
1598
  }
1543
1599
 
1544
- export declare interface SidebarFooterProps extends ComponentProps<"div"> {
1545
- }
1600
+ /**
1601
+ * Header row that smoothly hides its children when the sidebar collapses.
1602
+ *
1603
+ * Matches the Vue DSidebar header pattern:
1604
+ * - `AnimatePresence mode="popLayout"` keeps CollapseButton stable in layout
1605
+ * - Children slide out with `x: -320, scale: 0.5` spring animation
1606
+ * - Row uses `justify-center` so CollapseButton centers when collapsed
1607
+ * - Padding `px-2` only applied when expanded
1608
+ *
1609
+ * Usage:
1610
+ * ```tsx
1611
+ * <Sidebar.Header>
1612
+ * <Logo />
1613
+ * <span>CodeRabbit</span>
1614
+ * </Sidebar.Header>
1615
+ * ```
1616
+ * The `CollapseButton` is rendered automatically at the end of the row.
1617
+ */
1618
+ declare function SidebarHeader({ className, children }: SidebarHeaderProps): JSX.Element;
1546
1619
 
1547
- export declare interface SidebarHeaderProps extends ComponentProps<"div"> {
1620
+ declare interface SidebarHeaderProps {
1621
+ readonly className?: string;
1622
+ readonly children: ReactNode;
1548
1623
  }
1549
1624
 
1550
- export declare interface SidebarLabelProps extends ComponentProps<"span"> {
1625
+ export declare interface SidebarLabelProps extends ComponentProps<"div"> {
1551
1626
  }
1552
1627
 
1553
- declare function SidebarNav({ className, children }: SidebarNavProps): JSX.Element;
1554
-
1555
- declare function SidebarNavItem({ active, nested, icon, href, onClick, className, children, }: SidebarNavItemProps): JSX.Element;
1628
+ /**
1629
+ * Wraps sidebar content in directional slide animations.
1630
+ *
1631
+ * When `activeKey` changes, the old content slides out and new content
1632
+ * slides in. `direction="forward"` slides left (drilling in),
1633
+ * `direction="back"` slides right (going up).
1634
+ *
1635
+ * Usage:
1636
+ * ```tsx
1637
+ * <Sidebar.Layers activeKey={currentSection} direction={navDirection}>
1638
+ * {currentSection === "main" ? <MainNav /> : <SettingsNav />}
1639
+ * </Sidebar.Layers>
1640
+ * ```
1641
+ */
1642
+ declare function SidebarLayers({ activeKey, direction, className, children, }: SidebarLayersProps): JSX.Element;
1556
1643
 
1557
- export declare interface SidebarNavItemProps {
1558
- readonly active?: boolean;
1559
- /** Show a trailing chevron indicating this item navigates to a nested section */
1560
- readonly nested?: boolean;
1561
- readonly icon?: ReactNode;
1562
- readonly href?: string;
1563
- readonly onClick?: () => void;
1644
+ export declare interface SidebarLayersProps {
1645
+ /** Unique key for the current layer — changes trigger the animation */
1646
+ readonly activeKey: string;
1647
+ /** Direction of the transition: forward drills in, back goes up */
1648
+ readonly direction?: "forward" | "back";
1564
1649
  readonly className?: string;
1565
1650
  readonly children: ReactNode;
1566
1651
  }
1567
1652
 
1568
- export declare interface SidebarNavProps {
1653
+ declare function SidebarLink({ name, href, as, active, icon, nested, external, showIndicator, onClick, className, }: SidebarLinkProps): JSX.Element;
1654
+
1655
+ export declare interface SidebarLinkProps {
1656
+ /** Display name */
1657
+ readonly name: string;
1658
+ /** Link URL (renders as <a>) or omit for button */
1659
+ readonly href?: string;
1660
+ /** Render as "div" when nested inside an interactive container (e.g. DropdownMenu.Trigger) to avoid nested <button> */
1661
+ readonly as?: "div";
1662
+ /** Whether this link is currently active */
1663
+ readonly active?: boolean;
1664
+ /** Icon component rendered before the name */
1665
+ readonly icon?: ReactNode;
1666
+ /** Show a trailing chevron indicating navigation to a nested layer */
1667
+ readonly nested?: boolean;
1668
+ /** Show an external link arrow and open in new tab */
1669
+ readonly external?: boolean;
1670
+ /** Show a pulsing activity indicator dot */
1671
+ readonly showIndicator?: boolean;
1672
+ /** Click handler */
1673
+ readonly onClick?: () => void;
1569
1674
  readonly className?: string;
1570
- readonly children: ReactNode;
1571
1675
  }
1572
1676
 
1573
1677
  /**
1574
- * Sidebar panel with collapsible state.
1575
- * Provides collapsed/toggle context to all sub-components.
1678
+ * Sidebar with collapsible state and directional layer transitions.
1679
+ *
1680
+ * Supports both uncontrolled (`defaultCollapsed`) and controlled
1681
+ * (`collapsed` + `onCollapsedChange`) modes. Use controlled mode
1682
+ * to persist state across route changes or sync with external storage.
1683
+ *
1684
+ * Sub-components:
1685
+ * - `Sidebar.Section` — groups related links
1686
+ * - `Sidebar.Label` — section label that collapses smoothly
1687
+ * - `Sidebar.Link` — nav link with Hover + Tooltip
1688
+ * - `Sidebar.BackLink` — back navigation with directional slide
1689
+ * - `Sidebar.CollapseButton` — toggle sidebar width
1690
+ * - `Sidebar.Layers` — directional animation container for nested sidebars
1576
1691
  */
1577
- declare function SidebarRoot({ defaultCollapsed, className, children, }: SidebarRootProps): JSX.Element;
1692
+ declare function SidebarRoot({ defaultCollapsed, collapsed: controlledCollapsed, onCollapsedChange, className, children, }: SidebarRootProps): JSX.Element;
1578
1693
 
1579
1694
  export declare interface SidebarRootProps {
1580
- /** Start in collapsed state */
1695
+ /** Start in collapsed state (uncontrolled) */
1581
1696
  readonly defaultCollapsed?: boolean;
1697
+ /** Controlled collapsed state */
1698
+ readonly collapsed?: boolean;
1699
+ /** Callback when collapsed state changes (controlled mode) */
1700
+ readonly onCollapsedChange?: (collapsed: boolean) => void;
1582
1701
  readonly className?: string;
1583
1702
  readonly children: ReactNode;
1584
1703
  }
1585
1704
 
1586
- declare function SidebarSearch({ label, icon, onClick, className, }: SidebarSearchProps): JSX.Element;
1705
+ declare function SidebarSection({ className, children }: SidebarSectionProps): JSX.Element;
1587
1706
 
1588
- export declare interface SidebarSearchProps {
1589
- readonly label?: string;
1590
- readonly icon?: ReactNode;
1591
- readonly onClick?: () => void;
1707
+ export declare interface SidebarSectionProps {
1592
1708
  readonly className?: string;
1709
+ readonly children: ReactNode;
1593
1710
  }
1594
1711
 
1595
1712
  declare const sizeStyles: {