@particle-academy/react-fancy 4.17.1 → 4.18.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.
- package/dist/index.cjs +56 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +49 -16
- package/dist/index.d.ts +49 -16
- package/dist/index.js +56 -17
- package/dist/index.js.map +1 -1
- package/package.json +6 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,46 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ElementType, ButtonHTMLAttributes, AnchorHTMLAttributes, ReactNode, InputHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes, FormHTMLAttributes, TdHTMLAttributes, HTMLAttributes, ComponentType, CSSProperties, ReactElement, RefObject } from 'react';
|
|
3
3
|
import { ClassValue } from 'clsx';
|
|
4
4
|
|
|
5
5
|
type Size = "xs" | "sm" | "md" | "lg" | "xl";
|
|
6
|
+
/**
|
|
7
|
+
* What a navigation primitive owes a router.
|
|
8
|
+
*
|
|
9
|
+
* Every nav surface here — `Navbar.Item`, `Sidebar.Item`, `Menu.Item`,
|
|
10
|
+
* `MobileMenu.Item`, `Breadcrumbs.Item` — used to hardcode a plain `<a href>`.
|
|
11
|
+
* That is a FULL PAGE LOAD in every client-routed app, and the only way around
|
|
12
|
+
* it was to nest a router `<Link>` inside the item: an anchor inside an anchor,
|
|
13
|
+
* which is invalid HTML and the same nested-anchor shape that already cost this
|
|
14
|
+
* suite an SSR hydration bug.
|
|
15
|
+
*
|
|
16
|
+
* `as` is the seam {@link ButtonProps.as} already had. It is router-agnostic on
|
|
17
|
+
* purpose — one prop serves Inertia, TanStack Router, React Router and Next
|
|
18
|
+
* rather than a package per router:
|
|
19
|
+
*
|
|
20
|
+
* ```tsx
|
|
21
|
+
* // href-based routers (Inertia, Next)
|
|
22
|
+
* <Navbar.Item as={Link} href="/dashboard">Dashboard</Navbar.Item>
|
|
23
|
+
*
|
|
24
|
+
* // to-based routers (TanStack Router, React Router) — `to` reaches the Link
|
|
25
|
+
* // through the forwarded rest props
|
|
26
|
+
* <Navbar.Item as={Link} to="/dashboard">Dashboard</Navbar.Item>
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* Link mode engages on `href` OR `as`, because a `to`-based router never passes
|
|
30
|
+
* an `href` and would otherwise silently render the non-interactive fallback.
|
|
31
|
+
*/
|
|
32
|
+
interface NavigableProps {
|
|
33
|
+
/** Target URL. Renders link mode with a plain `<a>` unless `as` is given. */
|
|
34
|
+
href?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Link-mode element override — the component to render INSTEAD of the plain
|
|
37
|
+
* `<a>`, e.g. a router's `<Link>` so navigation happens client-side. Receives
|
|
38
|
+
* `className`, the item's `data-*` handles, and every unrecognized prop, so
|
|
39
|
+
* router-specific props (`to`, `params`, `preload`, `search`) pass straight
|
|
40
|
+
* through. Ignored in button mode.
|
|
41
|
+
*/
|
|
42
|
+
as?: ElementType;
|
|
43
|
+
}
|
|
6
44
|
/**
|
|
7
45
|
* The full Tailwind v4 named color palette — every default hue, including all
|
|
8
46
|
* five gray families. Components that accept a `color` should type it as this
|
|
@@ -1827,9 +1865,8 @@ interface BreadcrumbsProps {
|
|
|
1827
1865
|
shrink?: boolean;
|
|
1828
1866
|
className?: string;
|
|
1829
1867
|
}
|
|
1830
|
-
interface BreadcrumbsItemProps {
|
|
1868
|
+
interface BreadcrumbsItemProps extends NavigableProps {
|
|
1831
1869
|
children: ReactNode;
|
|
1832
|
-
href?: string;
|
|
1833
1870
|
active?: boolean;
|
|
1834
1871
|
/**
|
|
1835
1872
|
* Navigate by callback instead of by URL, for a crumb with no href.
|
|
@@ -1843,7 +1880,7 @@ interface BreadcrumbsItemProps {
|
|
|
1843
1880
|
className?: string;
|
|
1844
1881
|
}
|
|
1845
1882
|
|
|
1846
|
-
declare function BreadcrumbsItem({ children, href, active, onClick, className, }: BreadcrumbsItemProps): react.JSX.Element;
|
|
1883
|
+
declare function BreadcrumbsItem({ children, href, as: As, active, onClick, className, ...rest }: BreadcrumbsItemProps): react.JSX.Element;
|
|
1847
1884
|
declare namespace BreadcrumbsItem {
|
|
1848
1885
|
var displayName: string;
|
|
1849
1886
|
}
|
|
@@ -1869,9 +1906,8 @@ interface NavbarItemsProps {
|
|
|
1869
1906
|
children: ReactNode;
|
|
1870
1907
|
className?: string;
|
|
1871
1908
|
}
|
|
1872
|
-
interface NavbarItemProps {
|
|
1909
|
+
interface NavbarItemProps extends NavigableProps {
|
|
1873
1910
|
children: ReactNode;
|
|
1874
|
-
href?: string;
|
|
1875
1911
|
active?: boolean;
|
|
1876
1912
|
className?: string;
|
|
1877
1913
|
}
|
|
@@ -1889,7 +1925,7 @@ declare namespace NavbarItems {
|
|
|
1889
1925
|
var displayName: string;
|
|
1890
1926
|
}
|
|
1891
1927
|
|
|
1892
|
-
declare function NavbarItem({ children, href, active, className, }: NavbarItemProps): react.JSX.Element;
|
|
1928
|
+
declare function NavbarItem({ children, href, as: As, active, className, ...rest }: NavbarItemProps): react.JSX.Element;
|
|
1893
1929
|
declare namespace NavbarItem {
|
|
1894
1930
|
var displayName: string;
|
|
1895
1931
|
}
|
|
@@ -2434,9 +2470,8 @@ interface MenuProps {
|
|
|
2434
2470
|
orientation?: MenuOrientation;
|
|
2435
2471
|
className?: string;
|
|
2436
2472
|
}
|
|
2437
|
-
interface MenuItemProps {
|
|
2473
|
+
interface MenuItemProps extends NavigableProps {
|
|
2438
2474
|
children: ReactNode;
|
|
2439
|
-
href?: string;
|
|
2440
2475
|
icon?: ReactNode;
|
|
2441
2476
|
active?: boolean;
|
|
2442
2477
|
disabled?: boolean;
|
|
@@ -2460,7 +2495,7 @@ interface MenuContextValue {
|
|
|
2460
2495
|
orientation: MenuOrientation;
|
|
2461
2496
|
}
|
|
2462
2497
|
|
|
2463
|
-
declare function MenuItem({ children, href, icon, active, disabled, badge, onClick, className, }: MenuItemProps): react.JSX.Element;
|
|
2498
|
+
declare function MenuItem({ children, href, as: As, icon, active, disabled, badge, onClick, className, ...rest }: MenuItemProps): react.JSX.Element;
|
|
2464
2499
|
declare namespace MenuItem {
|
|
2465
2500
|
var displayName: string;
|
|
2466
2501
|
}
|
|
@@ -2499,9 +2534,8 @@ interface SidebarProps {
|
|
|
2499
2534
|
collapseMode?: SidebarCollapseMode;
|
|
2500
2535
|
className?: string;
|
|
2501
2536
|
}
|
|
2502
|
-
interface SidebarItemProps {
|
|
2537
|
+
interface SidebarItemProps extends NavigableProps {
|
|
2503
2538
|
children: ReactNode;
|
|
2504
|
-
href?: string;
|
|
2505
2539
|
icon?: ReactNode;
|
|
2506
2540
|
active?: boolean;
|
|
2507
2541
|
disabled?: boolean;
|
|
@@ -2530,7 +2564,7 @@ interface SidebarContextValue {
|
|
|
2530
2564
|
setCollapsed: (collapsed: boolean) => void;
|
|
2531
2565
|
}
|
|
2532
2566
|
|
|
2533
|
-
declare function SidebarItem({ children, href, icon, active, disabled, badge, onClick, className, }: SidebarItemProps): react.JSX.Element;
|
|
2567
|
+
declare function SidebarItem({ children, href, as: As, icon, active, disabled, badge, onClick, className, ...rest }: SidebarItemProps): react.JSX.Element;
|
|
2534
2568
|
declare namespace SidebarItem {
|
|
2535
2569
|
var displayName: string;
|
|
2536
2570
|
}
|
|
@@ -2574,9 +2608,8 @@ interface MobileMenuBottomBarProps {
|
|
|
2574
2608
|
children: ReactNode;
|
|
2575
2609
|
className?: string;
|
|
2576
2610
|
}
|
|
2577
|
-
interface MobileMenuItemProps {
|
|
2611
|
+
interface MobileMenuItemProps extends NavigableProps {
|
|
2578
2612
|
children: ReactNode;
|
|
2579
|
-
href?: string;
|
|
2580
2613
|
icon?: ReactNode;
|
|
2581
2614
|
active?: boolean;
|
|
2582
2615
|
disabled?: boolean;
|
|
@@ -2598,7 +2631,7 @@ declare namespace MobileMenuBottomBar {
|
|
|
2598
2631
|
var displayName: string;
|
|
2599
2632
|
}
|
|
2600
2633
|
|
|
2601
|
-
declare function MobileMenuItem({ children, href, icon, active, disabled, badge, onClick, className, }: MobileMenuItemProps): react.JSX.Element;
|
|
2634
|
+
declare function MobileMenuItem({ children, href, as: As, icon, active, disabled, badge, onClick, className, ...rest }: MobileMenuItemProps): react.JSX.Element;
|
|
2602
2635
|
declare namespace MobileMenuItem {
|
|
2603
2636
|
var displayName: string;
|
|
2604
2637
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,46 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ElementType, ButtonHTMLAttributes, AnchorHTMLAttributes, ReactNode, InputHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes, FormHTMLAttributes, TdHTMLAttributes, HTMLAttributes, ComponentType, CSSProperties, ReactElement, RefObject } from 'react';
|
|
3
3
|
import { ClassValue } from 'clsx';
|
|
4
4
|
|
|
5
5
|
type Size = "xs" | "sm" | "md" | "lg" | "xl";
|
|
6
|
+
/**
|
|
7
|
+
* What a navigation primitive owes a router.
|
|
8
|
+
*
|
|
9
|
+
* Every nav surface here — `Navbar.Item`, `Sidebar.Item`, `Menu.Item`,
|
|
10
|
+
* `MobileMenu.Item`, `Breadcrumbs.Item` — used to hardcode a plain `<a href>`.
|
|
11
|
+
* That is a FULL PAGE LOAD in every client-routed app, and the only way around
|
|
12
|
+
* it was to nest a router `<Link>` inside the item: an anchor inside an anchor,
|
|
13
|
+
* which is invalid HTML and the same nested-anchor shape that already cost this
|
|
14
|
+
* suite an SSR hydration bug.
|
|
15
|
+
*
|
|
16
|
+
* `as` is the seam {@link ButtonProps.as} already had. It is router-agnostic on
|
|
17
|
+
* purpose — one prop serves Inertia, TanStack Router, React Router and Next
|
|
18
|
+
* rather than a package per router:
|
|
19
|
+
*
|
|
20
|
+
* ```tsx
|
|
21
|
+
* // href-based routers (Inertia, Next)
|
|
22
|
+
* <Navbar.Item as={Link} href="/dashboard">Dashboard</Navbar.Item>
|
|
23
|
+
*
|
|
24
|
+
* // to-based routers (TanStack Router, React Router) — `to` reaches the Link
|
|
25
|
+
* // through the forwarded rest props
|
|
26
|
+
* <Navbar.Item as={Link} to="/dashboard">Dashboard</Navbar.Item>
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* Link mode engages on `href` OR `as`, because a `to`-based router never passes
|
|
30
|
+
* an `href` and would otherwise silently render the non-interactive fallback.
|
|
31
|
+
*/
|
|
32
|
+
interface NavigableProps {
|
|
33
|
+
/** Target URL. Renders link mode with a plain `<a>` unless `as` is given. */
|
|
34
|
+
href?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Link-mode element override — the component to render INSTEAD of the plain
|
|
37
|
+
* `<a>`, e.g. a router's `<Link>` so navigation happens client-side. Receives
|
|
38
|
+
* `className`, the item's `data-*` handles, and every unrecognized prop, so
|
|
39
|
+
* router-specific props (`to`, `params`, `preload`, `search`) pass straight
|
|
40
|
+
* through. Ignored in button mode.
|
|
41
|
+
*/
|
|
42
|
+
as?: ElementType;
|
|
43
|
+
}
|
|
6
44
|
/**
|
|
7
45
|
* The full Tailwind v4 named color palette — every default hue, including all
|
|
8
46
|
* five gray families. Components that accept a `color` should type it as this
|
|
@@ -1827,9 +1865,8 @@ interface BreadcrumbsProps {
|
|
|
1827
1865
|
shrink?: boolean;
|
|
1828
1866
|
className?: string;
|
|
1829
1867
|
}
|
|
1830
|
-
interface BreadcrumbsItemProps {
|
|
1868
|
+
interface BreadcrumbsItemProps extends NavigableProps {
|
|
1831
1869
|
children: ReactNode;
|
|
1832
|
-
href?: string;
|
|
1833
1870
|
active?: boolean;
|
|
1834
1871
|
/**
|
|
1835
1872
|
* Navigate by callback instead of by URL, for a crumb with no href.
|
|
@@ -1843,7 +1880,7 @@ interface BreadcrumbsItemProps {
|
|
|
1843
1880
|
className?: string;
|
|
1844
1881
|
}
|
|
1845
1882
|
|
|
1846
|
-
declare function BreadcrumbsItem({ children, href, active, onClick, className, }: BreadcrumbsItemProps): react.JSX.Element;
|
|
1883
|
+
declare function BreadcrumbsItem({ children, href, as: As, active, onClick, className, ...rest }: BreadcrumbsItemProps): react.JSX.Element;
|
|
1847
1884
|
declare namespace BreadcrumbsItem {
|
|
1848
1885
|
var displayName: string;
|
|
1849
1886
|
}
|
|
@@ -1869,9 +1906,8 @@ interface NavbarItemsProps {
|
|
|
1869
1906
|
children: ReactNode;
|
|
1870
1907
|
className?: string;
|
|
1871
1908
|
}
|
|
1872
|
-
interface NavbarItemProps {
|
|
1909
|
+
interface NavbarItemProps extends NavigableProps {
|
|
1873
1910
|
children: ReactNode;
|
|
1874
|
-
href?: string;
|
|
1875
1911
|
active?: boolean;
|
|
1876
1912
|
className?: string;
|
|
1877
1913
|
}
|
|
@@ -1889,7 +1925,7 @@ declare namespace NavbarItems {
|
|
|
1889
1925
|
var displayName: string;
|
|
1890
1926
|
}
|
|
1891
1927
|
|
|
1892
|
-
declare function NavbarItem({ children, href, active, className, }: NavbarItemProps): react.JSX.Element;
|
|
1928
|
+
declare function NavbarItem({ children, href, as: As, active, className, ...rest }: NavbarItemProps): react.JSX.Element;
|
|
1893
1929
|
declare namespace NavbarItem {
|
|
1894
1930
|
var displayName: string;
|
|
1895
1931
|
}
|
|
@@ -2434,9 +2470,8 @@ interface MenuProps {
|
|
|
2434
2470
|
orientation?: MenuOrientation;
|
|
2435
2471
|
className?: string;
|
|
2436
2472
|
}
|
|
2437
|
-
interface MenuItemProps {
|
|
2473
|
+
interface MenuItemProps extends NavigableProps {
|
|
2438
2474
|
children: ReactNode;
|
|
2439
|
-
href?: string;
|
|
2440
2475
|
icon?: ReactNode;
|
|
2441
2476
|
active?: boolean;
|
|
2442
2477
|
disabled?: boolean;
|
|
@@ -2460,7 +2495,7 @@ interface MenuContextValue {
|
|
|
2460
2495
|
orientation: MenuOrientation;
|
|
2461
2496
|
}
|
|
2462
2497
|
|
|
2463
|
-
declare function MenuItem({ children, href, icon, active, disabled, badge, onClick, className, }: MenuItemProps): react.JSX.Element;
|
|
2498
|
+
declare function MenuItem({ children, href, as: As, icon, active, disabled, badge, onClick, className, ...rest }: MenuItemProps): react.JSX.Element;
|
|
2464
2499
|
declare namespace MenuItem {
|
|
2465
2500
|
var displayName: string;
|
|
2466
2501
|
}
|
|
@@ -2499,9 +2534,8 @@ interface SidebarProps {
|
|
|
2499
2534
|
collapseMode?: SidebarCollapseMode;
|
|
2500
2535
|
className?: string;
|
|
2501
2536
|
}
|
|
2502
|
-
interface SidebarItemProps {
|
|
2537
|
+
interface SidebarItemProps extends NavigableProps {
|
|
2503
2538
|
children: ReactNode;
|
|
2504
|
-
href?: string;
|
|
2505
2539
|
icon?: ReactNode;
|
|
2506
2540
|
active?: boolean;
|
|
2507
2541
|
disabled?: boolean;
|
|
@@ -2530,7 +2564,7 @@ interface SidebarContextValue {
|
|
|
2530
2564
|
setCollapsed: (collapsed: boolean) => void;
|
|
2531
2565
|
}
|
|
2532
2566
|
|
|
2533
|
-
declare function SidebarItem({ children, href, icon, active, disabled, badge, onClick, className, }: SidebarItemProps): react.JSX.Element;
|
|
2567
|
+
declare function SidebarItem({ children, href, as: As, icon, active, disabled, badge, onClick, className, ...rest }: SidebarItemProps): react.JSX.Element;
|
|
2534
2568
|
declare namespace SidebarItem {
|
|
2535
2569
|
var displayName: string;
|
|
2536
2570
|
}
|
|
@@ -2574,9 +2608,8 @@ interface MobileMenuBottomBarProps {
|
|
|
2574
2608
|
children: ReactNode;
|
|
2575
2609
|
className?: string;
|
|
2576
2610
|
}
|
|
2577
|
-
interface MobileMenuItemProps {
|
|
2611
|
+
interface MobileMenuItemProps extends NavigableProps {
|
|
2578
2612
|
children: ReactNode;
|
|
2579
|
-
href?: string;
|
|
2580
2613
|
icon?: ReactNode;
|
|
2581
2614
|
active?: boolean;
|
|
2582
2615
|
disabled?: boolean;
|
|
@@ -2598,7 +2631,7 @@ declare namespace MobileMenuBottomBar {
|
|
|
2598
2631
|
var displayName: string;
|
|
2599
2632
|
}
|
|
2600
2633
|
|
|
2601
|
-
declare function MobileMenuItem({ children, href, icon, active, disabled, badge, onClick, className, }: MobileMenuItemProps): react.JSX.Element;
|
|
2634
|
+
declare function MobileMenuItem({ children, href, as: As, icon, active, disabled, badge, onClick, className, ...rest }: MobileMenuItemProps): react.JSX.Element;
|
|
2602
2635
|
declare namespace MobileMenuItem {
|
|
2603
2636
|
var displayName: string;
|
|
2604
2637
|
}
|
package/dist/index.js
CHANGED
|
@@ -9348,17 +9348,30 @@ var Accordion = Object.assign(AccordionRoot, {
|
|
|
9348
9348
|
function BreadcrumbsItem({
|
|
9349
9349
|
children,
|
|
9350
9350
|
href,
|
|
9351
|
+
as: As,
|
|
9351
9352
|
active = false,
|
|
9352
9353
|
onClick,
|
|
9353
|
-
className
|
|
9354
|
+
className,
|
|
9355
|
+
...rest
|
|
9354
9356
|
}) {
|
|
9355
9357
|
const baseClass = cn(
|
|
9356
9358
|
"text-sm",
|
|
9357
9359
|
active ? "font-medium text-zinc-900 dark:text-white" : "text-zinc-500 hover:text-zinc-700 dark:text-zinc-400 dark:hover:text-zinc-300",
|
|
9358
9360
|
className
|
|
9359
9361
|
);
|
|
9360
|
-
if (href && !active) {
|
|
9361
|
-
|
|
9362
|
+
if ((href || As) && !active) {
|
|
9363
|
+
const Link = As ?? "a";
|
|
9364
|
+
return /* @__PURE__ */ jsx(
|
|
9365
|
+
Link,
|
|
9366
|
+
{
|
|
9367
|
+
"data-react-fancy-breadcrumbs-item": "",
|
|
9368
|
+
...href ? { href } : {},
|
|
9369
|
+
onClick,
|
|
9370
|
+
className: baseClass,
|
|
9371
|
+
...rest,
|
|
9372
|
+
children
|
|
9373
|
+
}
|
|
9374
|
+
);
|
|
9362
9375
|
}
|
|
9363
9376
|
if (onClick && !active) {
|
|
9364
9377
|
return /* @__PURE__ */ jsx(
|
|
@@ -9368,11 +9381,12 @@ function BreadcrumbsItem({
|
|
|
9368
9381
|
"data-react-fancy-breadcrumbs-item": "",
|
|
9369
9382
|
onClick,
|
|
9370
9383
|
className: cn(baseClass, "cursor-pointer border-0 bg-transparent p-0"),
|
|
9384
|
+
...rest,
|
|
9371
9385
|
children
|
|
9372
9386
|
}
|
|
9373
9387
|
);
|
|
9374
9388
|
}
|
|
9375
|
-
return /* @__PURE__ */ jsx("span", { "data-react-fancy-breadcrumbs-item": "", className: baseClass, "aria-current": active ? "page" : void 0, children });
|
|
9389
|
+
return /* @__PURE__ */ jsx("span", { "data-react-fancy-breadcrumbs-item": "", className: baseClass, "aria-current": active ? "page" : void 0, ...rest, children });
|
|
9376
9390
|
}
|
|
9377
9391
|
BreadcrumbsItem.displayName = "BreadcrumbsItem";
|
|
9378
9392
|
function BreadcrumbsDropdown({ items, activeLabel }) {
|
|
@@ -9490,18 +9504,30 @@ NavbarItems.displayName = "NavbarItems";
|
|
|
9490
9504
|
function NavbarItem({
|
|
9491
9505
|
children,
|
|
9492
9506
|
href,
|
|
9507
|
+
as: As,
|
|
9493
9508
|
active = false,
|
|
9494
|
-
className
|
|
9509
|
+
className,
|
|
9510
|
+
...rest
|
|
9495
9511
|
}) {
|
|
9496
9512
|
const baseClass = cn(
|
|
9497
9513
|
"rounded-lg px-3 py-2 text-sm font-medium transition-colors",
|
|
9498
9514
|
active ? "bg-zinc-100 text-zinc-900 dark:bg-zinc-800 dark:text-white" : "text-zinc-600 hover:bg-zinc-50 hover:text-zinc-900 dark:text-zinc-400 dark:hover:bg-zinc-800 dark:hover:text-white",
|
|
9499
9515
|
className
|
|
9500
9516
|
);
|
|
9501
|
-
if (href) {
|
|
9502
|
-
|
|
9517
|
+
if (href || As) {
|
|
9518
|
+
const Link = As ?? "a";
|
|
9519
|
+
return /* @__PURE__ */ jsx(
|
|
9520
|
+
Link,
|
|
9521
|
+
{
|
|
9522
|
+
"data-react-fancy-navbar-item": "",
|
|
9523
|
+
...href ? { href } : {},
|
|
9524
|
+
className: baseClass,
|
|
9525
|
+
...rest,
|
|
9526
|
+
children
|
|
9527
|
+
}
|
|
9528
|
+
);
|
|
9503
9529
|
}
|
|
9504
|
-
return /* @__PURE__ */ jsx("div", { "data-react-fancy-navbar-item": "", className: baseClass, children });
|
|
9530
|
+
return /* @__PURE__ */ jsx("div", { "data-react-fancy-navbar-item": "", className: baseClass, ...rest, children });
|
|
9505
9531
|
}
|
|
9506
9532
|
NavbarItem.displayName = "NavbarItem";
|
|
9507
9533
|
function NavbarToggle({ className }) {
|
|
@@ -12318,21 +12344,25 @@ function useMenu() {
|
|
|
12318
12344
|
function MenuItem({
|
|
12319
12345
|
children,
|
|
12320
12346
|
href,
|
|
12347
|
+
as: As,
|
|
12321
12348
|
icon,
|
|
12322
12349
|
active = false,
|
|
12323
12350
|
disabled = false,
|
|
12324
12351
|
badge,
|
|
12325
12352
|
onClick,
|
|
12326
|
-
className
|
|
12353
|
+
className,
|
|
12354
|
+
...rest
|
|
12327
12355
|
}) {
|
|
12328
12356
|
const { orientation } = useMenu();
|
|
12329
12357
|
const isVertical = orientation === "vertical";
|
|
12330
|
-
const
|
|
12331
|
-
const
|
|
12358
|
+
const isLink = Boolean(href || As);
|
|
12359
|
+
const Tag = isLink ? As ?? "a" : "button";
|
|
12360
|
+
const tagProps = isLink ? { ...href ? { href } : {}, onClick } : { type: "button", onClick };
|
|
12332
12361
|
return /* @__PURE__ */ jsxs(
|
|
12333
12362
|
Tag,
|
|
12334
12363
|
{
|
|
12335
12364
|
...tagProps,
|
|
12365
|
+
...rest,
|
|
12336
12366
|
"data-react-fancy-menu-item": "",
|
|
12337
12367
|
"data-active": active || void 0,
|
|
12338
12368
|
"aria-current": active ? "page" : void 0,
|
|
@@ -12483,16 +12513,19 @@ function getLetters(children) {
|
|
|
12483
12513
|
function SidebarItem({
|
|
12484
12514
|
children,
|
|
12485
12515
|
href,
|
|
12516
|
+
as: As,
|
|
12486
12517
|
icon,
|
|
12487
12518
|
active = false,
|
|
12488
12519
|
disabled = false,
|
|
12489
12520
|
badge,
|
|
12490
12521
|
onClick,
|
|
12491
|
-
className
|
|
12522
|
+
className,
|
|
12523
|
+
...rest
|
|
12492
12524
|
}) {
|
|
12493
12525
|
const { collapsed, collapseMode } = useSidebar();
|
|
12494
|
-
const
|
|
12495
|
-
const
|
|
12526
|
+
const isLink = Boolean(href || As);
|
|
12527
|
+
const Tag = isLink ? As ?? "a" : "button";
|
|
12528
|
+
const tagProps = isLink ? { ...href ? { href } : {}, onClick } : { type: "button", onClick };
|
|
12496
12529
|
const showIconOnly = collapsed && collapseMode === "icons" && icon;
|
|
12497
12530
|
const showLetters = collapsed && (collapseMode === "letters" || collapseMode === "icons" && !icon);
|
|
12498
12531
|
const title = typeof children === "string" ? children : void 0;
|
|
@@ -12500,6 +12533,7 @@ function SidebarItem({
|
|
|
12500
12533
|
Tag,
|
|
12501
12534
|
{
|
|
12502
12535
|
...tagProps,
|
|
12536
|
+
...rest,
|
|
12503
12537
|
"data-react-fancy-sidebar-item": "",
|
|
12504
12538
|
"data-active": active || void 0,
|
|
12505
12539
|
"aria-current": active ? "page" : void 0,
|
|
@@ -12752,22 +12786,26 @@ MobileMenuBottomBar.displayName = "MobileMenuBottomBar";
|
|
|
12752
12786
|
function MobileMenuItem({
|
|
12753
12787
|
children,
|
|
12754
12788
|
href,
|
|
12789
|
+
as: As,
|
|
12755
12790
|
icon,
|
|
12756
12791
|
active = false,
|
|
12757
12792
|
disabled = false,
|
|
12758
12793
|
badge,
|
|
12759
12794
|
onClick,
|
|
12760
|
-
className
|
|
12795
|
+
className,
|
|
12796
|
+
...rest
|
|
12761
12797
|
}) {
|
|
12762
12798
|
const { variant } = useMobileMenu();
|
|
12763
12799
|
const isBottomBar = variant === "bottom-bar";
|
|
12764
|
-
const
|
|
12765
|
-
const
|
|
12800
|
+
const isLink = Boolean(href || As);
|
|
12801
|
+
const Tag = isLink ? As ?? "a" : "button";
|
|
12802
|
+
const tagProps = isLink ? { ...href ? { href } : {}, onClick } : { type: "button", onClick };
|
|
12766
12803
|
if (isBottomBar) {
|
|
12767
12804
|
return /* @__PURE__ */ jsxs(
|
|
12768
12805
|
Tag,
|
|
12769
12806
|
{
|
|
12770
12807
|
...tagProps,
|
|
12808
|
+
...rest,
|
|
12771
12809
|
"data-react-fancy-mobile-menu-item": "",
|
|
12772
12810
|
"data-active": active || void 0,
|
|
12773
12811
|
"aria-current": active ? "page" : void 0,
|
|
@@ -12791,6 +12829,7 @@ function MobileMenuItem({
|
|
|
12791
12829
|
Tag,
|
|
12792
12830
|
{
|
|
12793
12831
|
...tagProps,
|
|
12832
|
+
...rest,
|
|
12794
12833
|
"data-react-fancy-mobile-menu-item": "",
|
|
12795
12834
|
"data-active": active || void 0,
|
|
12796
12835
|
"aria-current": active ? "page" : void 0,
|