@danxbot/ui 15.26.0 → 15.27.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.
@@ -1,8 +1,29 @@
1
- import type { ReactNode } from "react";
1
+ import type { MouseEvent, ReactNode } from "react";
2
2
  export type Crumb = {
3
3
  label: ReactNode;
4
4
  href?: string;
5
- onClick?: () => void;
5
+ /**
6
+ * Receives the click event, which a client-side router NEEDS in order to
7
+ * suppress the browser's own navigation.
8
+ *
9
+ * The anchor below keeps its real `href` (hover URL, ctrl/cmd-click to a new
10
+ * tab) and only falls back to `#` when there is none, so a crumb with an
11
+ * `href` and a router-driven `onClick` used to do the client-side navigation
12
+ * AND a full page load. Take the event and suppress it:
13
+ *
14
+ * ```tsx
15
+ * onClick: (e) => {
16
+ * // A modified or middle click is a request for a new tab — let it through.
17
+ * if (e.defaultPrevented || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
18
+ * e.preventDefault();
19
+ * navigate(crumb.href);
20
+ * }
21
+ * ```
22
+ *
23
+ * A zero-argument `() => void` handler still type-checks. The last crumb is
24
+ * the current page, a non-link span, and never fires this.
25
+ */
26
+ onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;
6
27
  };
7
28
  export interface BreadcrumbProps {
8
29
  items: Crumb[];
@@ -0,0 +1,15 @@
1
+ import type { NavSection } from "./AppShell";
2
+ export interface SectionNavProps {
3
+ /** The AppShell data model, reused: a group `label` is optional per section. */
4
+ sections: NavSection[];
5
+ /** The `id` of the current item. Matches nothing → nothing is marked current. */
6
+ activeId?: string;
7
+ /**
8
+ * Names the `<nav>` landmark, the collapsed popup, and is the collapsed
9
+ * control's text while `activeId` matches no item. Make it say what the list
10
+ * is ("Settings"), not that it is a list.
11
+ */
12
+ label: string;
13
+ className?: string;
14
+ }
15
+ export declare function SectionNav({ sections, activeId, label, className }: SectionNavProps): import("react").JSX.Element | null;
@@ -0,0 +1,10 @@
1
+ import type { NavSection } from "./AppShell";
2
+ export interface NavSectionsProps {
3
+ sections: NavSection[];
4
+ activeId?: string;
5
+ /** Icon-only rows with the label moved into a tooltip. The shell's rail. */
6
+ collapsed?: boolean;
7
+ /** Runs after the item's own `onClick`, on every row click. */
8
+ onNavigate?: () => void;
9
+ }
10
+ export declare function NavSections({ sections, activeId, collapsed, onNavigate }: NavSectionsProps): import("react").JSX.Element;
@@ -41,6 +41,7 @@ export { Toaster, ToastProvider, useToast, type ToasterProps, type ToastProvider
41
41
  export { Menu, MenuItem, MenuGroup, MenuRadioGroup, MenuRadioItem, MenuCheckboxItem, MenuSeparator, type MenuProps, type MenuItemProps, type MenuItemTone, type MenuGroupProps, type MenuRadioGroupProps, type MenuRadioItemProps, type MenuCheckboxItemProps, } from "./components/Menu";
42
42
  export { ThemeMenu, type ThemeMenuProps } from "./components/ThemeMenu";
43
43
  export { AppShell, type AppShellProps, type NavItem, type NavSection, } from "./components/AppShell";
44
+ export { SectionNav, type SectionNavProps } from "./components/SectionNav";
44
45
  export { FileUpload, type FileUploadProps, type UploadFile } from "./components/FileUpload";
45
46
  export { ImageUploadField, type ImageUploadFieldProps, type ImageUploadFieldShape, type ImageUploadFieldSize, } from "./components/ImageUploadField";
46
47
  export { DatePicker, type DatePickerProps, type DateRange } from "./components/DatePicker";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danxbot/ui",
3
- "version": "15.26.0",
3
+ "version": "15.27.0",
4
4
  "type": "module",
5
5
  "description": "Danxbot — a domain-agnostic React design system with motion as a first-class primitive.",
6
6
  "license": "MIT",
@@ -74,7 +74,7 @@
74
74
  "gates": "npm run shoot && npm run a11y && node scripts/shoot-overlays.mjs && npm run probe",
75
75
  "a11y": "node scripts/a11y-scan.mjs",
76
76
  "shoot": "node scripts/shoot.mjs",
77
- "probe": "node scripts/probe-scale.mjs && node scripts/probe-switch.mjs && node scripts/probe-slider.mjs && node scripts/probe-panel.mjs && node scripts/probe-popover-width.mjs && node scripts/probe-api.mjs && node scripts/probe-api-live.mjs && node scripts/probe-tabs-overflow.mjs && node scripts/probe-stat-row.mjs && node scripts/probe-packaging.mjs && node scripts/probe-containment.mjs && node scripts/probe-popover-containment.mjs && node scripts/probe-theme-menu-overflow.mjs && node scripts/probe-shell.mjs && node scripts/probe-nav-trigger-tap-target.mjs && node scripts/probe-card-header.mjs && node scripts/probe-inline-edit.mjs && node scripts/probe-read-more.mjs",
77
+ "probe": "node scripts/probe-scale.mjs && node scripts/probe-switch.mjs && node scripts/probe-slider.mjs && node scripts/probe-panel.mjs && node scripts/probe-popover-width.mjs && node scripts/probe-api.mjs && node scripts/probe-api-live.mjs && node scripts/probe-tabs-overflow.mjs && node scripts/probe-stat-row.mjs && node scripts/probe-packaging.mjs && node scripts/probe-containment.mjs && node scripts/probe-popover-containment.mjs && node scripts/probe-theme-menu-overflow.mjs && node scripts/probe-shell.mjs && node scripts/probe-nav-trigger-tap-target.mjs && node scripts/probe-card-header.mjs && node scripts/probe-inline-edit.mjs && node scripts/probe-read-more.mjs && node scripts/probe-section-nav.mjs",
78
78
  "sync": "node scripts/sync.mjs",
79
79
  "visual": "node scripts/visual-docker.mjs",
80
80
  "visual:update": "node scripts/visual-docker.mjs --update-snapshots",