@particle-academy/react-fancy 4.17.1 → 4.19.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/README.md CHANGED
@@ -265,7 +265,16 @@ src/
265
265
 
266
266
  ## Demo Pages
267
267
 
268
- Component demos live in the monorepo at `resources/js/react-demos/pages/`. Each component has a `ComponentNameDemo.tsx` that exercises all props and states using the `DemoSection` wrapper component.
268
+ Every component has a live demo page on the showcase site, at
269
+ `https://ui.particle.academy/packages/react-fancy/<component>` — e.g.
270
+ [`/packages/react-fancy/button`](https://ui.particle.academy/packages/react-fancy/button).
271
+ Each one exercises the component's props and states, with the source for every
272
+ example shown inline.
273
+
274
+ Those pages are the demos: one file per component in the showcase repo
275
+ ([`Particle-Academy/pa-ux-sandbox`](https://github.com/Particle-Academy/pa-ux-sandbox))
276
+ at `resources/js/Pages/Packages/ComponentDocs/<ComponentName>.tsx`. The older
277
+ `resources/js/react-demos/pages/` tree they replaced no longer exists.
269
278
 
270
279
  ---
271
280
 
@@ -318,7 +327,7 @@ Purely visual primitives (labels, dividers, layout shells) only owe the first bu
318
327
  - tsup handles the build — ESM, CJS, and `.d.ts` generation.
319
328
  - `react`, `react-dom`, and `lucide-react` are external dependencies, never bundled.
320
329
  - After any change, verify with `pnpm --filter @particle-academy/react-fancy build` before considering the work done.
321
- - When updating a component, update its demo page in `resources/js/react-demos/pages/` to cover all new features.
330
+ - When updating a component, update its demo page in the showcase repo — `resources/js/Pages/Packages/ComponentDocs/<ComponentName>.tsx` in [`Particle-Academy/pa-ux-sandbox`](https://github.com/Particle-Academy/pa-ux-sandbox) to cover all new features. That page is what `/packages/react-fancy/<component>` renders.
322
331
 
323
332
  ---
324
333
 
package/dist/index.cjs CHANGED
@@ -9350,17 +9350,30 @@ var Accordion = Object.assign(AccordionRoot, {
9350
9350
  function BreadcrumbsItem({
9351
9351
  children,
9352
9352
  href,
9353
+ as: As,
9353
9354
  active = false,
9354
9355
  onClick,
9355
- className
9356
+ className,
9357
+ ...rest
9356
9358
  }) {
9357
9359
  const baseClass = cn(
9358
9360
  "text-sm",
9359
9361
  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",
9360
9362
  className
9361
9363
  );
9362
- if (href && !active) {
9363
- return /* @__PURE__ */ jsxRuntime.jsx("a", { "data-react-fancy-breadcrumbs-item": "", href, className: baseClass, children });
9364
+ if ((href || As) && !active) {
9365
+ const Link = As ?? "a";
9366
+ return /* @__PURE__ */ jsxRuntime.jsx(
9367
+ Link,
9368
+ {
9369
+ "data-react-fancy-breadcrumbs-item": "",
9370
+ ...href ? { href } : {},
9371
+ onClick,
9372
+ className: baseClass,
9373
+ ...rest,
9374
+ children
9375
+ }
9376
+ );
9364
9377
  }
9365
9378
  if (onClick && !active) {
9366
9379
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -9370,11 +9383,12 @@ function BreadcrumbsItem({
9370
9383
  "data-react-fancy-breadcrumbs-item": "",
9371
9384
  onClick,
9372
9385
  className: cn(baseClass, "cursor-pointer border-0 bg-transparent p-0"),
9386
+ ...rest,
9373
9387
  children
9374
9388
  }
9375
9389
  );
9376
9390
  }
9377
- return /* @__PURE__ */ jsxRuntime.jsx("span", { "data-react-fancy-breadcrumbs-item": "", className: baseClass, "aria-current": active ? "page" : void 0, children });
9391
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { "data-react-fancy-breadcrumbs-item": "", className: baseClass, "aria-current": active ? "page" : void 0, ...rest, children });
9378
9392
  }
9379
9393
  BreadcrumbsItem.displayName = "BreadcrumbsItem";
9380
9394
  function BreadcrumbsDropdown({ items, activeLabel }) {
@@ -9492,18 +9506,30 @@ NavbarItems.displayName = "NavbarItems";
9492
9506
  function NavbarItem({
9493
9507
  children,
9494
9508
  href,
9509
+ as: As,
9495
9510
  active = false,
9496
- className
9511
+ className,
9512
+ ...rest
9497
9513
  }) {
9498
9514
  const baseClass = cn(
9499
9515
  "rounded-lg px-3 py-2 text-sm font-medium transition-colors",
9500
9516
  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",
9501
9517
  className
9502
9518
  );
9503
- if (href) {
9504
- return /* @__PURE__ */ jsxRuntime.jsx("a", { "data-react-fancy-navbar-item": "", href, className: baseClass, children });
9519
+ if (href || As) {
9520
+ const Link = As ?? "a";
9521
+ return /* @__PURE__ */ jsxRuntime.jsx(
9522
+ Link,
9523
+ {
9524
+ "data-react-fancy-navbar-item": "",
9525
+ ...href ? { href } : {},
9526
+ className: baseClass,
9527
+ ...rest,
9528
+ children
9529
+ }
9530
+ );
9505
9531
  }
9506
- return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-react-fancy-navbar-item": "", className: baseClass, children });
9532
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-react-fancy-navbar-item": "", className: baseClass, ...rest, children });
9507
9533
  }
9508
9534
  NavbarItem.displayName = "NavbarItem";
9509
9535
  function NavbarToggle({ className }) {
@@ -12320,21 +12346,25 @@ function useMenu() {
12320
12346
  function MenuItem({
12321
12347
  children,
12322
12348
  href,
12349
+ as: As,
12323
12350
  icon,
12324
12351
  active = false,
12325
12352
  disabled = false,
12326
12353
  badge,
12327
12354
  onClick,
12328
- className
12355
+ className,
12356
+ ...rest
12329
12357
  }) {
12330
12358
  const { orientation } = useMenu();
12331
12359
  const isVertical = orientation === "vertical";
12332
- const Tag = href ? "a" : "button";
12333
- const tagProps = href ? { href } : { type: "button", onClick };
12360
+ const isLink = Boolean(href || As);
12361
+ const Tag = isLink ? As ?? "a" : "button";
12362
+ const tagProps = isLink ? { ...href ? { href } : {}, onClick } : { type: "button", onClick };
12334
12363
  return /* @__PURE__ */ jsxRuntime.jsxs(
12335
12364
  Tag,
12336
12365
  {
12337
12366
  ...tagProps,
12367
+ ...rest,
12338
12368
  "data-react-fancy-menu-item": "",
12339
12369
  "data-active": active || void 0,
12340
12370
  "aria-current": active ? "page" : void 0,
@@ -12485,16 +12515,19 @@ function getLetters(children) {
12485
12515
  function SidebarItem({
12486
12516
  children,
12487
12517
  href,
12518
+ as: As,
12488
12519
  icon,
12489
12520
  active = false,
12490
12521
  disabled = false,
12491
12522
  badge,
12492
12523
  onClick,
12493
- className
12524
+ className,
12525
+ ...rest
12494
12526
  }) {
12495
12527
  const { collapsed, collapseMode } = useSidebar();
12496
- const Tag = href ? "a" : "button";
12497
- const tagProps = href ? { href } : { type: "button", onClick };
12528
+ const isLink = Boolean(href || As);
12529
+ const Tag = isLink ? As ?? "a" : "button";
12530
+ const tagProps = isLink ? { ...href ? { href } : {}, onClick } : { type: "button", onClick };
12498
12531
  const showIconOnly = collapsed && collapseMode === "icons" && icon;
12499
12532
  const showLetters = collapsed && (collapseMode === "letters" || collapseMode === "icons" && !icon);
12500
12533
  const title = typeof children === "string" ? children : void 0;
@@ -12502,6 +12535,7 @@ function SidebarItem({
12502
12535
  Tag,
12503
12536
  {
12504
12537
  ...tagProps,
12538
+ ...rest,
12505
12539
  "data-react-fancy-sidebar-item": "",
12506
12540
  "data-active": active || void 0,
12507
12541
  "aria-current": active ? "page" : void 0,
@@ -12754,22 +12788,26 @@ MobileMenuBottomBar.displayName = "MobileMenuBottomBar";
12754
12788
  function MobileMenuItem({
12755
12789
  children,
12756
12790
  href,
12791
+ as: As,
12757
12792
  icon,
12758
12793
  active = false,
12759
12794
  disabled = false,
12760
12795
  badge,
12761
12796
  onClick,
12762
- className
12797
+ className,
12798
+ ...rest
12763
12799
  }) {
12764
12800
  const { variant } = useMobileMenu();
12765
12801
  const isBottomBar = variant === "bottom-bar";
12766
- const Tag = href ? "a" : "button";
12767
- const tagProps = href ? { href } : { type: "button", onClick };
12802
+ const isLink = Boolean(href || As);
12803
+ const Tag = isLink ? As ?? "a" : "button";
12804
+ const tagProps = isLink ? { ...href ? { href } : {}, onClick } : { type: "button", onClick };
12768
12805
  if (isBottomBar) {
12769
12806
  return /* @__PURE__ */ jsxRuntime.jsxs(
12770
12807
  Tag,
12771
12808
  {
12772
12809
  ...tagProps,
12810
+ ...rest,
12773
12811
  "data-react-fancy-mobile-menu-item": "",
12774
12812
  "data-active": active || void 0,
12775
12813
  "aria-current": active ? "page" : void 0,
@@ -12793,6 +12831,7 @@ function MobileMenuItem({
12793
12831
  Tag,
12794
12832
  {
12795
12833
  ...tagProps,
12834
+ ...rest,
12796
12835
  "data-react-fancy-mobile-menu-item": "",
12797
12836
  "data-active": active || void 0,
12798
12837
  "aria-current": active ? "page" : void 0,