@coderabbitai/carrot-ui 0.1.23 → 0.2.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.
package/dist/index.d.ts CHANGED
@@ -1590,6 +1590,7 @@ export declare interface SettingsRowProps {
1590
1590
  }
1591
1591
 
1592
1592
  export declare const Sidebar: typeof SidebarRoot & {
1593
+ Provider: typeof SidebarProvider;
1593
1594
  Section: typeof SidebarSection;
1594
1595
  Header: typeof SidebarHeader;
1595
1596
  Label: ForwardRefExoticComponent<Omit<SidebarLabelProps, "ref"> & RefAttributes<HTMLDivElement>>;
@@ -1618,6 +1619,10 @@ export declare interface SidebarCollapseButtonProps {
1618
1619
  declare interface SidebarContextValue {
1619
1620
  readonly collapsed: boolean;
1620
1621
  readonly toggle: () => void;
1622
+ readonly linkComponent?: SidebarLinkComponent;
1623
+ readonly mobile: boolean;
1624
+ readonly mobileOpen: boolean;
1625
+ readonly setMobileOpen: (open: boolean) => void;
1621
1626
  }
1622
1627
 
1623
1628
  /**
@@ -1640,7 +1645,7 @@ declare interface SidebarContextValue {
1640
1645
  */
1641
1646
  declare function SidebarHeader({ className, children }: SidebarHeaderProps): JSX.Element;
1642
1647
 
1643
- declare interface SidebarHeaderProps {
1648
+ export declare interface SidebarHeaderProps {
1644
1649
  readonly className?: string;
1645
1650
  readonly children: ReactNode;
1646
1651
  }
@@ -1673,14 +1678,21 @@ export declare interface SidebarLayersProps {
1673
1678
  readonly children: ReactNode;
1674
1679
  }
1675
1680
 
1676
- declare function SidebarLink({ name, href, as, active, icon, nested, external, showIndicator, onClick, className, }: SidebarLinkProps): JSX.Element;
1681
+ declare function SidebarLink({ name, href, as, active, icon, nested, external, showIndicator, trailing, disabled, loading, onClick, className, ...rest }: SidebarLinkProps): JSX.Element;
1677
1682
 
1678
- export declare interface SidebarLinkProps {
1683
+ export declare type SidebarLinkComponent = ComponentType<{
1684
+ readonly to?: string;
1685
+ readonly href?: string;
1686
+ readonly className?: string;
1687
+ readonly children?: ReactNode;
1688
+ }>;
1689
+
1690
+ export declare interface SidebarLinkProps extends Omit<ComponentProps<"div">, "children"> {
1679
1691
  /** Display name */
1680
1692
  readonly name: string;
1681
- /** Link URL (renders as <a>) or omit for button */
1693
+ /** Link URL renders via `linkComponent` (or native `<a>` if none provided) */
1682
1694
  readonly href?: string;
1683
- /** Render as "div" when nested inside an interactive container (e.g. DropdownMenu.Trigger) to avoid nested <button> */
1695
+ /** Render as "div" when nested inside an interactive container (e.g. DropdownMenu.Trigger) to avoid nested `<button>` */
1684
1696
  readonly as?: "div";
1685
1697
  /** Whether this link is currently active */
1686
1698
  readonly active?: boolean;
@@ -1692,35 +1704,69 @@ export declare interface SidebarLinkProps {
1692
1704
  readonly external?: boolean;
1693
1705
  /** Show a pulsing activity indicator dot */
1694
1706
  readonly showIndicator?: boolean;
1707
+ /** Arbitrary trailing content rendered after the name (e.g. badges, lock icons) */
1708
+ readonly trailing?: ReactNode;
1709
+ /** Disable the link — reduces opacity and prevents clicks */
1710
+ readonly disabled?: boolean;
1711
+ /** Show a skeleton placeholder instead of the link content */
1712
+ readonly loading?: boolean;
1695
1713
  /** Click handler */
1696
1714
  readonly onClick?: () => void;
1697
- readonly className?: string;
1698
1715
  }
1699
1716
 
1700
1717
  /**
1701
- * Sidebar with collapsible state and directional layer transitions.
1718
+ * Context-only provider for sidebar state no visual output.
1702
1719
  *
1703
- * Supports both uncontrolled (`defaultCollapsed`) and controlled
1704
- * (`collapsed` + `onCollapsedChange`) modes. Use controlled mode
1705
- * to persist state across route changes or sync with external storage.
1720
+ * Wrap your entire page layout with this when you need `useSidebar()`
1721
+ * outside the visual `<Sidebar>` container (e.g. in the page header
1722
+ * or in portaled components).
1706
1723
  *
1707
- * Sub-components:
1708
- * - `Sidebar.Section` groups related links
1709
- * - `Sidebar.Label` — section label that collapses smoothly
1710
- * - `Sidebar.Link` — nav link with Hover + Tooltip
1711
- * - `Sidebar.BackLink` back navigation with directional slide
1712
- * - `Sidebar.CollapseButton` — toggle sidebar width
1713
- * - `Sidebar.Layers` — directional animation container for nested sidebars
1724
+ * When `<Sidebar>` is rendered inside a `<Sidebar.Provider>`, it
1725
+ * skips creating its own context and uses the provider's state.
1726
+ *
1727
+ * ```tsx
1728
+ * <Sidebar.Provider collapsed={collapsed} onCollapsedChange={setCollapsed}>
1729
+ * <PageLayout sidebar={<Sidebar>...</Sidebar>}>
1730
+ * <MyHeader />
1731
+ * </PageLayout>
1732
+ * </Sidebar.Provider>
1733
+ * ```
1714
1734
  */
1715
- declare function SidebarRoot({ defaultCollapsed, collapsed: controlledCollapsed, onCollapsedChange, className, children, }: SidebarRootProps): JSX.Element;
1735
+ declare function SidebarProvider({ defaultCollapsed, collapsed: controlledCollapsed, onCollapsedChange, linkComponent, children, }: SidebarProviderProps): JSX.Element;
1716
1736
 
1717
- export declare interface SidebarRootProps {
1737
+ export declare interface SidebarProviderProps {
1718
1738
  /** Start in collapsed state (uncontrolled) */
1719
1739
  readonly defaultCollapsed?: boolean;
1720
1740
  /** Controlled collapsed state */
1721
1741
  readonly collapsed?: boolean;
1722
1742
  /** Callback when collapsed state changes (controlled mode) */
1723
1743
  readonly onCollapsedChange?: (collapsed: boolean) => void;
1744
+ /** Custom link component for client-side navigation */
1745
+ readonly linkComponent?: SidebarLinkComponent;
1746
+ readonly children: ReactNode;
1747
+ }
1748
+
1749
+ /**
1750
+ * Responsive sidebar with collapsible state and directional layer transitions.
1751
+ *
1752
+ * When rendered inside a `<Sidebar.Provider>`, uses the provider's context
1753
+ * and only renders the visual shell. Otherwise, creates its own context.
1754
+ *
1755
+ * **Desktop** (`md:` and up): renders inline with collapse/expand animation.
1756
+ * **Mobile** (below `md:`): shows collapsed icons inline. Tapping an icon
1757
+ * or the collapse button opens the full sidebar in a left-side Drawer.
1758
+ */
1759
+ declare function SidebarRoot({ defaultCollapsed, collapsed: controlledCollapsed, onCollapsedChange, linkComponent, className, children, }: SidebarRootProps): JSX.Element;
1760
+
1761
+ export declare interface SidebarRootProps {
1762
+ /** Start in collapsed state (uncontrolled). Ignored when inside a Sidebar.Provider. */
1763
+ readonly defaultCollapsed?: boolean;
1764
+ /** Controlled collapsed state. Ignored when inside a Sidebar.Provider. */
1765
+ readonly collapsed?: boolean;
1766
+ /** Callback when collapsed state changes. Ignored when inside a Sidebar.Provider. */
1767
+ readonly onCollapsedChange?: (collapsed: boolean) => void;
1768
+ /** Custom link component for client-side navigation. Ignored when inside a Sidebar.Provider. */
1769
+ readonly linkComponent?: SidebarLinkComponent;
1724
1770
  readonly className?: string;
1725
1771
  readonly children: ReactNode;
1726
1772
  }