@coderabbitai/carrot-ui 0.1.22 → 0.2.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 (3) hide show
  1. package/dist/index.d.ts +111 -20
  2. package/dist/index.js +1136 -923
  3. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -339,6 +339,8 @@ export declare const Card: ReturnType<typeof forwardRef<HTMLDivElement, CardProp
339
339
  Section: typeof CardSection;
340
340
  };
341
341
 
342
+ declare function Card_2({ value, title, description, icon, disabled, className, }: RadioGroupCardProps): JSX.Element;
343
+
342
344
  declare const CardBody: ForwardRefExoticComponent<CardBodyProps & RefAttributes<HTMLDivElement>>;
343
345
 
344
346
  export declare interface CardBodyProps {
@@ -604,7 +606,7 @@ export declare const createTooltipHandle: typeof Tooltip_2.createHandle;
604
606
  * For simple static tables, use `Table` directly. Use `DataTable` when you
605
607
  * need interactive features.
606
608
  */
607
- export declare function DataTable<TData>({ columns, data, sortable, paginated, pageSize, pageSizeOptions, selectable, rowSelection: controlledRowSelection, onRowSelectionChange, onRowClick, emptyMessage, className, tableOptions, }: DataTableProps<TData>): JSX.Element;
609
+ export declare function DataTable<TData>({ columns, data, sortable, paginated, pageSize, pageSizeOptions, selectable, rowSelection: controlledRowSelection, onRowSelectionChange, onRowClick, loading, loadingRows, emptyMessage, className, tableOptions, }: DataTableProps<TData>): JSX.Element;
608
610
 
609
611
  /**
610
612
  * A faceted filter button for DataTable, inspired by shadcn's Tasks example.
@@ -664,6 +666,10 @@ export declare interface DataTableProps<TData> {
664
666
  onRowSelectionChange?: (selection: RowSelectionState) => void;
665
667
  /** Called when a row is clicked */
666
668
  onRowClick?: (row: Row<TData>) => void;
669
+ /** Show skeleton loading state. Default false. */
670
+ loading?: boolean;
671
+ /** Number of skeleton rows to show when loading. Default 5. */
672
+ loadingRows?: number;
667
673
  /** Message shown when data is empty. Default "No results." */
668
674
  emptyMessage?: string | ReactNode;
669
675
  /** Additional class on the outer wrapper */
@@ -1285,8 +1291,23 @@ export declare interface PopoverTriggerProps extends ComponentProps<typeof Popov
1285
1291
  export declare const RadioGroup: {
1286
1292
  Root: ForwardRefExoticComponent<Omit<RadioGroupRootProps, "ref"> & RefAttributes<HTMLDivElement>>;
1287
1293
  Item: ForwardRefExoticComponent<Omit<RadioGroupItemProps, "ref"> & RefAttributes<HTMLSpanElement>>;
1294
+ Card: typeof Card_2;
1288
1295
  };
1289
1296
 
1297
+ declare interface RadioGroupCardProps {
1298
+ /** Unique value identifying this card */
1299
+ readonly value: string;
1300
+ /** Card title */
1301
+ readonly title: string;
1302
+ /** Optional description below the title */
1303
+ readonly description?: string;
1304
+ /** Optional icon rendered to the left of the text */
1305
+ readonly icon?: ReactNode;
1306
+ /** Disable this card */
1307
+ readonly disabled?: boolean;
1308
+ readonly className?: string;
1309
+ }
1310
+
1290
1311
  export declare interface RadioGroupItemProps extends ComponentProps<typeof Radio.Root> {
1291
1312
  /** Size of the radio indicator */
1292
1313
  size?: RadioGroupItemSize;
@@ -1297,6 +1318,8 @@ export declare interface RadioGroupItemProps extends ComponentProps<typeof Radio
1297
1318
  export declare type RadioGroupItemSize = keyof typeof sizeStyles_10;
1298
1319
 
1299
1320
  export declare interface RadioGroupRootProps extends ComponentProps<typeof RadioGroup_2> {
1321
+ /** Layout direction. Default "vertical". */
1322
+ orientation?: "horizontal" | "vertical";
1300
1323
  }
1301
1324
 
1302
1325
  export { Row }
@@ -1567,6 +1590,7 @@ export declare interface SettingsRowProps {
1567
1590
  }
1568
1591
 
1569
1592
  export declare const Sidebar: typeof SidebarRoot & {
1593
+ Provider: typeof SidebarProvider;
1570
1594
  Section: typeof SidebarSection;
1571
1595
  Header: typeof SidebarHeader;
1572
1596
  Label: ForwardRefExoticComponent<Omit<SidebarLabelProps, "ref"> & RefAttributes<HTMLDivElement>>;
@@ -1595,6 +1619,10 @@ export declare interface SidebarCollapseButtonProps {
1595
1619
  declare interface SidebarContextValue {
1596
1620
  readonly collapsed: boolean;
1597
1621
  readonly toggle: () => void;
1622
+ readonly linkComponent?: SidebarLinkComponent;
1623
+ readonly mobile: boolean;
1624
+ readonly mobileOpen: boolean;
1625
+ readonly setMobileOpen: (open: boolean) => void;
1598
1626
  }
1599
1627
 
1600
1628
  /**
@@ -1617,7 +1645,7 @@ declare interface SidebarContextValue {
1617
1645
  */
1618
1646
  declare function SidebarHeader({ className, children }: SidebarHeaderProps): JSX.Element;
1619
1647
 
1620
- declare interface SidebarHeaderProps {
1648
+ export declare interface SidebarHeaderProps {
1621
1649
  readonly className?: string;
1622
1650
  readonly children: ReactNode;
1623
1651
  }
@@ -1650,14 +1678,21 @@ export declare interface SidebarLayersProps {
1650
1678
  readonly children: ReactNode;
1651
1679
  }
1652
1680
 
1653
- 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;
1654
1682
 
1655
- 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"> {
1656
1691
  /** Display name */
1657
1692
  readonly name: string;
1658
- /** Link URL (renders as <a>) or omit for button */
1693
+ /** Link URL renders via `linkComponent` (or native `<a>` if none provided) */
1659
1694
  readonly href?: string;
1660
- /** 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>` */
1661
1696
  readonly as?: "div";
1662
1697
  /** Whether this link is currently active */
1663
1698
  readonly active?: boolean;
@@ -1669,35 +1704,69 @@ export declare interface SidebarLinkProps {
1669
1704
  readonly external?: boolean;
1670
1705
  /** Show a pulsing activity indicator dot */
1671
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;
1672
1713
  /** Click handler */
1673
1714
  readonly onClick?: () => void;
1674
- readonly className?: string;
1675
1715
  }
1676
1716
 
1677
1717
  /**
1678
- * Sidebar with collapsible state and directional layer transitions.
1718
+ * Context-only provider for sidebar state no visual output.
1679
1719
  *
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.
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).
1683
1723
  *
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
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
+ * ```
1691
1734
  */
1692
- 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;
1693
1736
 
1694
- export declare interface SidebarRootProps {
1737
+ export declare interface SidebarProviderProps {
1695
1738
  /** Start in collapsed state (uncontrolled) */
1696
1739
  readonly defaultCollapsed?: boolean;
1697
1740
  /** Controlled collapsed state */
1698
1741
  readonly collapsed?: boolean;
1699
1742
  /** Callback when collapsed state changes (controlled mode) */
1700
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;
1701
1770
  readonly className?: string;
1702
1771
  readonly children: ReactNode;
1703
1772
  }
@@ -1873,6 +1942,7 @@ export declare const Table: ReturnType<typeof forwardRef<HTMLDivElement, TablePr
1873
1942
  Row: typeof TableRow;
1874
1943
  HeaderCell: typeof TableHeaderCell;
1875
1944
  Cell: typeof TableCell;
1945
+ Skeleton: typeof TableSkeleton;
1876
1946
  };
1877
1947
 
1878
1948
  declare const TableBody: ForwardRefExoticComponent<TableBodyProps & RefAttributes<HTMLTableSectionElement>>;
@@ -1925,6 +1995,27 @@ export declare interface TableRowProps extends Omit<ComponentProps<"tr">, "child
1925
1995
  children: ReactNode;
1926
1996
  }
1927
1997
 
1998
+ /**
1999
+ * Skeleton loading rows for the Table.
2000
+ * Renders inside a `<tbody>` with the specified number of rows and columns.
2001
+ *
2002
+ * ```tsx
2003
+ * <Table>
2004
+ * <Table.Header>...</Table.Header>
2005
+ * {loading ? <Table.Skeleton columns={3} /> : <Table.Body>...</Table.Body>}
2006
+ * </Table>
2007
+ * ```
2008
+ */
2009
+ declare function TableSkeleton({ columns, rows, className }: TableSkeletonProps): JSX.Element;
2010
+
2011
+ declare interface TableSkeletonProps {
2012
+ /** Number of columns to render */
2013
+ readonly columns: number;
2014
+ /** Number of skeleton rows. Default 5. */
2015
+ readonly rows?: number;
2016
+ readonly className?: string;
2017
+ }
2018
+
1928
2019
  export declare const Tabs: {
1929
2020
  Root: ForwardRefExoticComponent<Omit<TabsRootProps, "ref"> & RefAttributes<HTMLDivElement>>;
1930
2021
  List: ForwardRefExoticComponent<Omit<TabsListProps, "ref"> & RefAttributes<HTMLDivElement>>;